103 m_schematic( nullptr )
114 draw( item, aLayer,
false );
123#ifdef CONNECTIVITY_DEBUG
125 auto sch_item =
dynamic_cast<const SCH_ITEM*
>( aItem );
126 auto conn = sch_item ? sch_item->
Connection( *g_CurrentSheet ) :
nullptr;
131 auto label = conn->Name(
true );
138 m_gal->StrokeText( *
m_gal, conn->Name(
true ), pos, 0.0, 0 );
146 switch( aItem->
Type() )
152 drawBoundingBox =
false;
153 draw(
static_cast<const SCH_PIN*
>( aItem ), aLayer, aDimmed );
165 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
168 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
171 draw(
static_cast<const SCH_TEXT*
>( aItem ), aLayer, aDimmed );
177 draw(
static_cast<const SCH_TABLE*
>( aItem ), aLayer, aDimmed );
180 draw(
static_cast<const SCH_LABEL*
>( aItem ), aLayer, aDimmed );
186 draw(
static_cast<const SCH_FIELD*
>( aItem ), aLayer, aDimmed );
222 if( drawBoundingBox )
238 box =
static_cast<const SCH_SYMBOL*
>( aItem )->GetBodyBoundingBox();
243 :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
301 bool aDimmed,
bool aIgnoreNets )
const
303 auto isBackgroundLayer =
320 color =
static_cast<const SCH_LINE*
>( aItem )->GetLineColor();
334 if( isBackgroundLayer( aLayer ) )
343 if( isBackgroundLayer( aLayer ) )
347 case FILL_T::NO_FILL:
351 case FILL_T::REVERSE_HATCH:
352 case FILL_T::CROSS_HATCH:
353 case FILL_T::FILLED_SHAPE:
357 case FILL_T::FILLED_WITH_COLOR:
361 case FILL_T::FILLED_WITH_BG_BODYCOLOR:
366 wxFAIL_MSG( wxT(
"Unsupported fill type" ) );
375 else if( isSymbolChild )
386 else if( aItem->
IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
392 else if( aIgnoreNets )
405 if( isBackgroundLayer( aLayer ) )
410 else if(
const EDA_TEXT* otherTextItem =
dynamic_cast<const EDA_TEXT*
>( aItem ) )
413 color = otherTextItem->GetTextColor();
421 if( isBackgroundLayer( aLayer) )
427 if( shape->
GetFillMode() == FILL_T::FILLED_WITH_COLOR )
446 if( aDrawingShadows )
453 else if( isBackgroundLayer( aLayer ) )
458 else if( aItem->
IsSelected() && aDrawingShadows )
462 else if( aItem->
IsSelected() && isBackgroundLayer( aLayer ) )
475 if( aDimmed && !( aItem->
IsSelected() && aDrawingShadows ) )
490 bool aDrawingWireColorHighlights )
const
503 if( aDrawingWireColorHighlights )
514 width += colorHighlightWidth;
525 switch( aItem->
Type() )
528 pen =
static_cast<const SCH_FIELD*
>( aItem )->GetEffectiveTextPenWidth( pen );
532 pen =
static_cast<const SCH_TEXT*
>( aItem )->GetEffectiveTextPenWidth( pen );
540 pen =
static_cast<const SCH_LABEL_BASE*
>( aItem )->GetEffectiveTextPenWidth( pen );
545 pen =
static_cast<const SCH_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth( pen );
562 return KiROUND( ( docTextSize + screenTextSize * 2 ) / 3 );
624 font->
Draw( &aGal, aText, aPosition, aAttrs, aFontMetrics );
666 callback_gal.SetIsStroke(
true );
668 font->
Draw( &callback_gal, aText, aPosition, attrs, aFontMetrics );
719 int aBodyStyle,
bool aDimmed )
727 std::unique_ptr< LIB_SYMBOL > tmpSymbol;
732 tmpSymbol = aSymbol->
Flatten();
733 drawnSymbol = tmpSymbol.get();
739 [](
const SCH_ITEM& item,
int layer )
749 if( !childOnLayer( item, aLayer ) )
758 draw( &item, aLayer, aDimmed );
785 bool aDrawingShadows,
bool aBrightened )
808 const COLOR4D& aColor,
bool aDrawingShadows,
818 double lineWidth = aSize / 10.0;
820 if( aDrawingShadows )
828 double x_right = aSize / 1.6180339887;
829 double x_middle = x_right / 2.0;
841 m_gal->
DrawCurve( bottomPt, bottomAnchorPt, leftSideAnchorPt1, leftPt );
842 m_gal->
DrawCurve( leftPt, leftSideAnchorPt2, rightSideAnchorPt2, rightPt );
843 m_gal->
DrawCurve( rightPt, rightSideAnchorPt1, bottomAnchorPt, bottomPt );
857 bool aRotate,
int aExtraLineWidth,
const COLOR4D& aColor )
885 const double lineYOffset = aSize / 4;
886 const double arrowHead = aSize / 8;
902 topLineREnd -
VECTOR2D{ aSize * 0.7, 0 } );
905 aGal.
DrawLine( topLineREnd, topLineREnd -
VECTOR2D{ arrowHead * 1.2, arrowHead } );
906 aGal.
DrawLine( topLineREnd, topLineREnd -
VECTOR2D{ arrowHead * 1.2, -arrowHead } );
910 aGal.
DrawLine( btmLineREnd, btmLineREnd -
VECTOR2D{ arrowHead * 1.2, arrowHead } );
911 aGal.
DrawLine( btmLineREnd, btmLineREnd -
VECTOR2D{ arrowHead * 1.2, -arrowHead } );
920 aGal.
DrawArc( topLineREnd -
VECTOR2D{ aSize - lineYOffset * 2, -lineYOffset },
973 if( drawingDangling )
992 int textOffset =
KiROUND( textSize * 0.22 );
999 mid.
x +=
KiROUND( textOffset * 1.2 );
1004 mid.
y -=
KiROUND( textOffset * 1.2 );
1034 const int diam =
radius*2;
1037 if( aPin->
GetType() == ELECTRICAL_PINTYPE::PT_NC )
1051 case GRAPHIC_PINSHAPE::LINE:
1055 case GRAPHIC_PINSHAPE::INVERTED:
1060 case GRAPHIC_PINSHAPE::INVERTED_CLOCK:
1061 pc = p0 - dir * clock_size ;
1065 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1071 case GRAPHIC_PINSHAPE::CLOCK_LOW:
1072 case GRAPHIC_PINSHAPE::FALLING_EDGE_CLOCK:
1073 pc = p0 - dir * clock_size ;
1077 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1095 case GRAPHIC_PINSHAPE::CLOCK:
1101 p0 +
VECTOR2D( -dir.
x * clock_size, 0 ),
1107 p0 +
VECTOR2D( 0, -dir.
y * clock_size ),
1112 case GRAPHIC_PINSHAPE::INPUT_LOW:
1129 case GRAPHIC_PINSHAPE::OUTPUT_LOW:
1138 case GRAPHIC_PINSHAPE::NONLOGIC:
1149 if( drawingShadows && !
eeconfig()->m_Selection.draw_selected_children )
1159 float shadowWidth = 0.0f;
1161 if( drawingShadows )
1171 const auto textRendersAsBitmap = [&](
KIGFX::GAL& aGal,
int aTextSize )
1183 const auto drawTextInfo =
1187 const bool renderTextAsBitmap = textRendersAsBitmap( *
m_gal, aTextInfo.
m_TextSize );
1201 if( drawingShadows )
1216 else if(
nonCached( aPin ) && renderTextAsBitmap )
1229 const auto getColorForLayer = [&](
int aDrawnLayer )
1234 return getRenderColor( aPin, aDrawnLayer, drawingShadows, aDimmed );
1239 if( std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> numInfo = cache.
GetPinNumberInfo( shadowWidth ) )
1241 drawTextInfo( *numInfo, getColorForLayer(
LAYER_PINNUM ) );
1244 if( std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> nameInfo = cache.
GetPinNameInfo( shadowWidth ) )
1246 drawTextInfo( *nameInfo, getColorForLayer(
LAYER_PINNAM ) );
1258 if( std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> elecTypeInfo =
1291 bool aDangling,
bool aDrawingShadows,
bool aBrightened )
1318 bool highlightNetclassColors =
false;
1336 if( highlightNetclassColors && aLayer == aJct->
GetLayer() )
1343 if( junctionSize > 1 )
1360 bool drawingBusses = aLayer ==
LAYER_BUS;
1364 bool highlightNetclassColors =
false;
1365 double highlightAlpha = 0.6;
1367 double hopOverScale = 0.0;
1378 if( !highlightNetclassColors && drawingNetColorHighlights )
1392 if( aLine->
IsNew() && drawingDangling )
1396 float width =
getLineWidth( aLine, drawingShadows, drawingNetColorHighlights );
1399 if( highlightNetclassColors )
1404 else if( drawingBusses )
1408 if( drawingNetColorHighlights )
1420 if( ( drawingDangling || drawingShadows ) && !aLine->
IsNew() )
1449 if( drawingDangling )
1456 int textOffset =
KiROUND( textSize * 0.22 );
1461 pos.
y -= textOffset;
1467 pos.
x +=
KiROUND( textOffset * 1.2 );
1488 std::vector<VECTOR3I> curr_wire_shape;
1490 if( aLine->
IsWire() && hopOverScale > 0.0 )
1492 double lineWidth =
getLineWidth( aLine,
false, drawingNetColorHighlights );
1493 double arcRadius = lineWidth * hopOverScale;
1502 for(
size_t ii = 1; ii < curr_wire_shape.size(); ii++ )
1504 VECTOR2I start( curr_wire_shape[ii-1].x, curr_wire_shape[ii-1].y );
1506 if( curr_wire_shape[ii-1].z == 0 )
1509 VECTOR2I end( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
1511 ( lineStyle <= LINE_STYLE::FIRST_TYPE || drawingShadows ), width );
1516 VECTOR2I arc_middle( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
1518 VECTOR2I arc_end( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
1530 EDA_ANGLE angle1 = midAngle - startAngle;
1563 switch( shape->GetShape() )
1567 VECTOR2D start = shape->GetStart();
1576 EDA_ANGLE angle1 = midAngle - startAngle;
1585 case SHAPE_T::CIRCLE:
1589 case SHAPE_T::RECTANGLE:
1595 const std::vector<SHAPE*> polySegments = shape->MakeEffectiveShapes(
true );
1597 if( !polySegments.empty() )
1599 std::deque<VECTOR2D> pts;
1601 for(
SHAPE* polySegment : polySegments )
1602 pts.push_back(
static_cast<SHAPE_SEGMENT*
>( polySegment )->GetSeg().
A );
1607 for(
SHAPE* polySegment : polySegments )
1615 case SHAPE_T::BEZIER:
1618 shape->GetBezierC2(), shape->GetEnd() );
1629 if(
eeconfig()->m_Selection.fill_shapes )
1633 if( aShape->
GetShape() == SHAPE_T::ARC )
1651 drawShape( aShape );
1658 case FILL_T::NO_FILL:
1661 case FILL_T::FILLED_SHAPE:
1666 case FILL_T::REVERSE_HATCH:
1667 case FILL_T::CROSS_HATCH:
1679 case FILL_T::FILLED_WITH_COLOR:
1680 case FILL_T::FILLED_WITH_BG_BODYCOLOR:
1688 drawShape( aShape );
1693 wxFAIL_MSG( wxT(
"Unsupported fill type" ) );
1700 if( aShape->
GetFillMode() == FILL_T::FILLED_SHAPE )
1706 drawShape( aShape );
1709 float lineWidth =
getLineWidth( aShape, drawingShadows );
1718 if( lineStyle <= LINE_STYLE::FIRST_TYPE || drawingShadows )
1720 drawShape( aShape );
1726 for(
SHAPE* shape : shapes )
1739 for(
SHAPE* shape : shapes )
1763 switch( aText->
Type() )
1784 if( conn && conn->
IsBus() )
1807 if( drawingShadows && font->
IsOutline() )
1825 double shadowOffset = 0.0;
1827 if( drawingShadows )
1832 const double adjust = 1.2f;
1833 shadowOffset = shadowWidth/2.0f * adjust;
1847 pos.
y = bBox.
GetTop() - shadowOffset;
1850 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
1859 pos.
x = bBox.
GetLeft() - shadowOffset;
1868 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
1879 else if( drawingShadows )
1892 text_offset.
x -= fudge;
1894 text_offset.
y -= fudge;
1896 text_offset.
x += fudge;
1898 text_offset.
y += fudge;
1918 int adjust =
KiROUND( sizeDiff * 0.4 );
1919 VECTOR2I adjust_offset( 0, - adjust );
1922 text_offset += adjust_offset;
1927 && !shownText.Contains( wxT(
"\n" ) ) )
1934 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
1959 switch( aText->
Type() )
1967 showAnchor = !
static_cast<const SCH_LABEL*
>( aText )->IsDangling();
2012 float borderWidth =
getLineWidth( aTextBox, drawingShadows );
2031 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2092 if( transparency > 0.0 )
2093 borderColor = borderColor.
WithAlpha( borderColor.
a * ( 1.0 - transparency ) );
2097 borderColor = borderColor.
Mix( bg, 0.5f );
2106 if( borderStyle <= LINE_STYLE::FIRST_TYPE || drawingShadows )
2114 for(
SHAPE* shape : shapes )
2128 for(
SHAPE* shape : shapes )
2142 draw( cell, aLayer, aDimmed );
2154 if( lineWidth == 0 )
2160 if( lineStyle == LINE_STYLE::DEFAULT )
2161 lineStyle = LINE_STYLE::SOLID;
2168 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
2170 m_gal->DrawLine( ptA, ptB );
2174 SHAPE_SEGMENT seg( ptA, ptB );
2175 STROKE_PARAMS::Stroke( &seg, lineStyle, lineWidth, &m_schSettings,
2176 [&]( const VECTOR2I& a, const VECTOR2I& b )
2180 m_gal->DrawLine( a+1, b );
2182 m_gal->DrawLine( a, b );
2189wxString SCH_PAINTER::expandLibItemTextVars(
const wxString& aSourceText,
2192 std::function<bool( wxString* )> symbolResolver =
2193 [&]( wxString* token ) ->
bool
2198 return aSymbolContext->
ResolveTextVar( &m_schematic->CurrentSheet(), token );
2208 bool DNP = aSymbol->
GetDNP();
2212 if( m_schSettings.IsPrinting() && drawingShadows )
2215 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2218 draw( &field, aLayer, DNP );
2230 int unit = m_schematic ? aSymbol->
GetUnitSelection( &m_schematic->CurrentSheet() ) : 1;
2236 std::vector<SCH_PIN*> originalPins = originalSymbol->
GetPins( unit, bodyStyle );
2240 std::vector<SCH_PIN*> tempPins = tempSymbol.
GetPins( unit, bodyStyle );
2248 tempItem.SetFlags( aSymbol->
GetFlags() );
2256 textItem->
SetText( expandLibItemTextVars( textItem->
GetText(), aSymbol ) );
2263 textboxItem->
SetText( expandLibItemTextVars( textboxItem->
GetText(), aSymbol ) );
2268 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2271 SCH_PIN* tempPin = tempPins[ i ];
2292 for(
unsigned i = 0; i < tempPins.size(); ++i )
2295 SCH_PIN* tempPin = tempPins[ i ];
2309 std::max( bbox.
GetY() - pins.
GetY(),
2313 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2314 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2321 m_gal->AdvanceDepth();
2322 m_gal->SetIsStroke(
true );
2323 m_gal->SetIsFill(
true );
2324 m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ) );
2325 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ) );
2327 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2328 std::swap( pt1.
x, pt2.
x );
2329 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2341 m_gal->AdvanceDepth();
2342 m_gal->SetIsStroke(
true );
2343 m_gal->SetIsFill(
true );
2344 m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ).WithAlpha( 0.5 ) );
2345 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ).WithAlpha( 0.5 ) );
2352 int offset = 2 * strokeWidth;
2359 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ).WithAlpha( 0.1 ) );
2360 m_gal->DrawCircle(
center, offset );
2361 m_gal->AdvanceDepth();
2362 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ).WithAlpha( 0.5 ) );
2363 m_gal->DrawCurve(
left, top, bottom,
right, 1 );
2368void SCH_PAINTER::draw(
const SCH_FIELD* aField,
int aLayer,
bool aDimmed )
2372 if( m_schSettings.IsPrinting() && drawingShadows )
2378 if( !isUnitAndConversionShown( aField ) )
2381 if( aField->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
2388 if( std::find( layers.begin(), layers.end(), aLayer ) == layers.end() )
2393 COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
2398 : m_schSettings.m_ShowHiddenFields;
2408 if( shownText.IsEmpty() )
2444 if( m_schSettings.GetDrawBoundingBoxes() )
2445 drawItemBoundingBox( aField );
2447 m_gal->SetStrokeColor(
color );
2448 m_gal->SetFillColor(
color );
2450 if( drawingShadows && getFont( aField )->IsOutline() )
2452 BOX2I shadow_box = bbox;
2455 m_gal->SetIsStroke(
false );
2456 m_gal->SetIsFill(
true );
2469 if( drawingShadows )
2474 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2475 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2479 if( nonCached( aField ) && aField->
RenderAsBitmap( m_gal->GetWorldScale() ) )
2481 bitmapText( *m_gal, shownText, textpos, attributes );
2486 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2489 cache = aField->
GetRenderCache( shownText, textpos, attributes );
2494 m_gal->DrawGlyphs( *cache );
2526 drawLocalPowerIcon( pos, size, rotated,
color, drawingShadows, aField->
IsBrightened() );
2530 if( aField->
IsMoving() && m_schematic )
2534 m_gal->SetLineWidth( m_schSettings.GetOutlineWidth() );
2536 m_gal->DrawLine( aField->
GetPosition(), parentPos );
2540 drawAnchor( aField->
GetPosition(), drawingShadows );
2549 if( m_schSettings.IsPrinting() && drawingShadows )
2554 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2557 draw( &field, aLayer,
false );
2568 if( drawingDangling )
2580 std::vector<VECTOR2I> pts;
2581 std::deque<VECTOR2D> pts2;
2586 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2588 m_gal->SetIsStroke(
true );
2589 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2590 m_gal->SetStrokeColor(
color );
2592 if( drawingShadows )
2594 m_gal->SetIsFill(
eeconfig()->m_Selection.fill_shapes );
2595 m_gal->SetFillColor(
color );
2596 m_gal->DrawPolygon( pts2 );
2600 m_gal->SetIsFill(
false );
2601 m_gal->DrawPolyline( pts2 );
2604 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2608void SCH_PAINTER::draw(
const SCH_LABEL* aLabel,
int aLayer,
bool aDimmed )
2612 if( m_schSettings.IsPrinting() && drawingShadows )
2617 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2620 draw( &field, aLayer,
false );
2631 if( drawingDangling )
2643 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2651 if( m_schSettings.IsPrinting() && drawingShadows )
2656 if( !( drawingShadows || drawingDangling ) ||
eeconfig()->m_Selection.draw_selected_children )
2659 draw( &field, aLayer,
false );
2670 if( drawingDangling )
2682 std::vector<VECTOR2I> i_pts;
2683 std::deque<VECTOR2D> d_pts;
2687 for(
const VECTOR2I& i_pt : i_pts )
2688 d_pts.emplace_back(
VECTOR2D( i_pt.x, i_pt.y ) );
2690 m_gal->SetIsFill(
true );
2692 m_gal->SetIsStroke(
true );
2693 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2694 m_gal->SetStrokeColor(
color );
2695 m_gal->DrawPolyline( d_pts );
2697 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2708 if( m_schSettings.IsPrinting() && drawingShadows )
2711 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2714 draw( &field, aLayer,
false );
2737 std::vector<VECTOR2I> pts;
2738 std::deque<VECTOR2D> pts2;
2743 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2745 m_gal->SetIsFill(
false );
2746 m_gal->SetFillColor(
color );
2747 m_gal->SetIsStroke(
true );
2748 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2749 m_gal->SetStrokeColor(
color );
2753 m_gal->DrawLine( pts2[0], pts2[1] );
2754 m_gal->SetIsFill(
true );
2755 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).EuclideanNorm() );
2759 m_gal->DrawLine( pts2[0], pts2[1] );
2760 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).EuclideanNorm() );
2764 m_gal->DrawPolyline( pts2 );
2769void SCH_PAINTER::draw(
const SCH_SHEET* aSheet,
int aLayer )
2772 bool DNP = aSheet->
GetDNP();
2776 if( m_schSettings.IsPrinting() && drawingShadows )
2779 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2782 draw( &field, aLayer, DNP );
2785 draw(
static_cast<SCH_HIERLABEL*
>( sheetPin ), aLayer, DNP );
2798 if( !m_schSettings.PrintBlackAndWhiteReq() )
2801 m_gal->SetIsFill(
true );
2802 m_gal->SetIsStroke(
false );
2804 m_gal->DrawRectangle( pos, pos + size );
2810 m_gal->SetStrokeColor( getRenderColor( aSheet,
LAYER_SHEET, drawingShadows ) );
2811 m_gal->SetIsStroke(
true );
2812 m_gal->SetLineWidth( getLineWidth( aSheet, drawingShadows ) );
2813 m_gal->SetIsFill(
false );
2815 m_gal->DrawRectangle( pos, pos + size );
2824 std::max( bbox.
GetY() - pins.
GetY(),
2828 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2829 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2836 m_gal->SetIsStroke(
true );
2837 m_gal->SetIsFill(
true );
2838 m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ) );
2839 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ) );
2841 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2842 std::swap( pt1.
x, pt2.
x );
2843 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2855 m_gal->AdvanceDepth();
2856 m_gal->SetIsStroke(
true );
2857 m_gal->SetIsFill(
true );
2858 m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ).WithAlpha( 0.5 ) );
2859 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ).WithAlpha( 0.5 ) );
2866 int offset = 2 * strokeWidth;
2873 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ).WithAlpha( 0.1 ) );
2874 m_gal->DrawCircle(
center, offset );
2875 m_gal->AdvanceDepth();
2876 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ).WithAlpha( 0.5 ) );
2877 m_gal->DrawCurve(
left, top, bottom,
right, 1 );
2886 if( m_schSettings.IsPrinting() && drawingShadows )
2892 m_gal->SetIsStroke(
true );
2893 m_gal->SetLineWidth( getLineWidth( aNC, drawingShadows ) );
2894 m_gal->SetStrokeColor( getRenderColor( aNC,
LAYER_NOCONNECT, drawingShadows ) );
2895 m_gal->SetIsFill(
false );
2898 int delta = std::max( aNC->
GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
2913 bool drawingBusses = aLayer ==
LAYER_BUS;
2915 if( m_schSettings.IsPrinting() && drawingShadows )
2918 bool highlightNetclassColors =
false;
2926 if( !highlightNetclassColors && drawingNetColorHighlights )
2929 if( m_schSettings.m_OverrideItemColors && drawingNetColorHighlights )
2957 if( highlightNetclassColors )
2962 else if( drawingBusses )
2966 if( drawingNetColorHighlights )
2978 if( drawingDangling )
2980 m_gal->SetIsFill(
false );
2981 m_gal->SetIsStroke(
true );
2982 m_gal->SetStrokeColor(
color.Brightened( 0.3 ) );
2983 m_gal->SetLineWidth( m_schSettings.GetDanglingIndicatorThickness() );
2993 m_gal->DrawCircle( aEntry->
GetEnd(),
3002 draw( &line, aLayer );
3018 if( img_scale != 1.0 )
3019 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
3023 m_gal->DrawBitmap( refImage.
GetImage() );
3031 m_gal->SetIsStroke(
true );
3032 m_gal->SetStrokeColor(
color );
3033 m_gal->SetLineWidth ( getShadowWidth( aBitmap->
IsBrightened() ) );
3034 m_gal->SetIsFill(
false );
3042 bm_size.
x /= img_scale;
3043 bm_size.
y /= img_scale;
3044 const VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
3047 m_gal->DrawRectangle( origin,
end );
3059 if( m_schSettings.IsPrinting() && drawingShadows )
3069 m_gal->SetIsFill( !drawingShadows );
3070 m_gal->SetFillColor(
color );
3071 m_gal->SetIsStroke( drawingShadows );
3072 m_gal->SetLineWidth( getLineWidth( aMarker, drawingShadows ) );
3073 m_gal->SetStrokeColor(
color );
3078 m_gal->DrawPolygon( polygon );
3083void SCH_PAINTER::draw(
const SCH_GROUP* aGroup,
int aLayer )
3085 const bool drawingShadows =
false;
3106 m_gal->SetStrokeColor(
color );
3107 m_gal->SetLineWidth( m_schSettings.GetOutlineWidth() * 2.0f );
3114 m_gal->DrawLine( topLeft, topLeft + width );
3115 m_gal->DrawLine( topLeft + width, topLeft + width + height );
3116 m_gal->DrawLine( topLeft + width + height, topLeft + height );
3117 m_gal->DrawLine( topLeft + height, topLeft );
3121 if(
name.IsEmpty() )
3125 int scaledSize = abs(
KiROUND( m_gal->GetScreenWorldMatrix().GetScale().x * ptSize ) );
3129 int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
3135 m_gal->DrawLine( topLeft, topLeft - titleHeight );
3136 m_gal->DrawLine( topLeft - titleHeight, topLeft + width - titleHeight );
3137 m_gal->DrawLine( topLeft + width - titleHeight, topLeft + width );
3153 LINE_STYLE aLineStyle,
bool aDrawDirectLine,
int aWidth )
3155 if( aDrawDirectLine )
3157 m_gal->DrawLine( aStartPoint, aEndPoint );
3167 m_gal->DrawLine( start + 1,
end );
3169 m_gal->DrawLine( start,
end );
constexpr EDA_IU_SCALE schIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
std::optional< BOX2I > OPT_BOX2I
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
constexpr const Vec & GetPosition() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr coord_type GetY() const
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr coord_type GetX() const
constexpr size_type GetHeight() const
constexpr coord_type GetLeft() const
constexpr void SetX(coord_type val)
constexpr const Vec & GetOrigin() const
constexpr void SetY(coord_type val)
const BOX2< Vec > GetBoundingBoxRotated(const VECTOR2I &aRotCenter, const EDA_ANGLE &aAngle) const
Useful to calculate bounding box of rotated items, when rotation is not cardinal.
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr void Offset(coord_type dx, coord_type dy)
constexpr coord_type GetBottom() const
Represent basic circle geometry with utility geometry functions.
VECTOR2I Center
Public to make access simpler.
int Radius
Public to make access simpler.
bool IsHorizontal() const
A base class for most all the KiCad significant classes used in schematics and boards.
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
bool IsBrightened() const
bool IsForceVisible() const
EDA_ITEM_FLAGS GetFlags() const
const SHAPE_POLY_SET & GetHatching() const
FILL_T GetFillMode() const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
COLOR4D GetFillColor() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const VECTOR2I & GetTextPos() const
COLOR4D GetTextColor() const
const EDA_ANGLE & GetTextAngle() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
KIFONT::FONT * GetFont() const
BOX2I GetTextBox(int aLine=-1) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, const VECTOR2I &aOffset={ 0, 0 }) const
virtual EDA_ANGLE GetDrawRotation() const
virtual VECTOR2I GetDrawPos() const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
const TEXT_ATTRIBUTES & GetAttributes() const
virtual void SetText(const wxString &aText)
VECTOR2I GetTextSize() const
APP_SETTINGS_BASE * KifaceSettings() const
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
virtual bool IsStroke() const
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics) const
Draw a string.
virtual bool IsOutline() const
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const METRICS &aFontMetrics) const
Compute the boundary limits of aText (the bounding box of all shapes).
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
COLOR4D & Invert()
Makes the color inverted, alpha remains the same.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
COLOR4D & Desaturate()
Removes color (in HSL model)
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Attribute save/restore for GAL attributes.
Abstract interface for drawing on a 2D-surface.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void Rotate(double aAngle)
Rotate the context.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
void SetVerticalJustify(const GR_TEXT_V_ALIGN_T aVerticalJustify)
void SetFontBold(const bool aBold)
void SetFontUnderlined(bool aUnderlined)
void SetHorizontalJustify(const GR_TEXT_H_ALIGN_T aHorizontalJustify)
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
virtual void Restore()
Restore the context.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
void SetGlyphSize(const VECTOR2I aSize)
virtual void DrawGlyphs(const std::vector< std::unique_ptr< KIFONT::GLYPH > > &aGlyphs)
Draw polygons representing font glyphs.
virtual void DrawCurve(const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint, double aFilterValue=0.0)
Draw a cubic bezier spline.
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
Draw an arc.
void SetFontItalic(bool aItalic)
virtual void BitmapText(const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle)
Draw a text using a bitmap font.
virtual void Save()
Save the context.
double GetWorldScale() const
Get the world scale.
Contains all the knowledge about how to draw graphical object onto any particular output device.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
int GetDefaultPenWidth() const
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
bool PrintBlackAndWhiteReq() const
bool GetDrawBoundingBoxes() const
virtual bool Draw(const VIEW_ITEM *, int) override
Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.
void drawPinDanglingIndicator(const SCH_PIN &aPin, const COLOR4D &aColor, bool aDrawingShadows, bool aBrightened)
float getTextThickness(const SCH_ITEM *aItem) const
void drawLocalPowerIcon(const VECTOR2D &aPos, double aSize, bool aRotate, const COLOR4D &aColor, bool aDrawingShadows, bool aBrightened)
Draw an local power pin indicator icon.
float getShadowWidth(bool aForHighlight) const
COLOR4D getRenderColor(const SCH_ITEM *aItem, int aLayer, bool aDrawingShadows, bool aDimmed=false, bool aIgnoreNets=false) const
int externalPinDecoSize(const SCH_PIN &aPin)
KIFONT::FONT * getFont(const EDA_TEXT *aText) const
void draw(const EDA_ITEM *, int, bool aDimmed)
static std::vector< KICAD_T > g_ScaledSelectionTypes
void drawLine(const VECTOR2I &aStartPoint, const VECTOR2I &aEndPoint, LINE_STYLE aLineStyle, bool aDrawDirectLine=false, int aWidth=0)
int getOperatingPointTextSize() const
float getLineWidth(const SCH_ITEM *aItem, bool aDrawingShadows, bool aDrawingWireColorHighlights=false) const
void triLine(const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c)
SCH_RENDER_SETTINGS m_schSettings
void drawAnchor(const VECTOR2I &aPos, bool aDrawingShadows)
Draw anchor indicating the anchor position of text objects, local labels, or fields.
bool nonCached(const EDA_ITEM *aItem)
Indicates the item is drawn on a non-cached layer in OpenGL.
void drawDanglingIndicator(const VECTOR2I &aPos, const COLOR4D &aColor, int aWidth, bool aDangling, bool aDrawingShadows, bool aBrightened)
Draw the target (an open square) for a wire or label which has no connection or is being moved.
void drawItemBoundingBox(const EDA_ITEM *aItem)
int internalPinDecoSize(const SCH_PIN &aPin)
bool isUnitAndConversionShown(const SCH_ITEM *aItem) const
An abstract base class for deriving all objects that can be added to a VIEW.
double GetForcedTransparency() const
Define a library symbol object.
std::vector< SCH_PIN * > GetPins(int aUnit, int aBodyStyle) const
Return a list of pin object pointers from the draw item list.
static LIB_SYMBOL * GetDummy()
Returns a dummy LIB_SYMBOL, used when one is missing in the schematic.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
void ShapeToPolygon(SHAPE_LINE_CHAIN &aPolygon, int aScale=-1) const
Return the shape polygon in internal units in a SHAPE_LINE_CHAIN the coordinates are relatives to the...
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
A pin layout helper is a class that manages the layout of the parts of a pin on a schematic symbol:
OPT_BOX2I GetAltIconBBox()
Get the box of the alt mode icon, if there is one.
std::optional< TEXT_INFO > GetPinNameInfo(int aShadowWidth)
Get the text info for the pin name.
std::optional< TEXT_INFO > GetPinElectricalTypeInfo(int aShadowWidth)
CIRCLE GetDanglingIndicator() const
Gets the dangling indicator geometry for this pin, if the pin were to be dangling.
std::optional< TEXT_INFO > GetPinNumberInfo(int aShadowWidth)
void SetRenderParameters(int aNameThickness, int aNumberThickness, bool aShowElectricalType, bool aShowAltIcons)
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
const BITMAP_BASE & GetImage() const
Get the underlying image.
double GetImageScale() const
SCHEMATIC_SETTINGS & Settings() const
SCH_SCREEN * GetCurrentScreen() const
Object to handle a bitmap image that can be inserted in a schematic.
VECTOR2I GetPosition() const override
REFERENCE_IMAGE & GetReferenceImage()
Base class for a bus or wire entry.
bool IsStartDangling() const
VECTOR2I GetPosition() const override
bool IsEndDangling() const
virtual STROKE_PARAMS GetStroke() const override
int GetPenWidth() const override
LINE_STYLE GetEffectiveLineStyle() const
Class for a wire to bus entry.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
virtual bool IsDangling() const override
Determines dangling state from connectivity and cached connected rule areas.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
VECTOR2I GetPosition() const override
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
bool CanAutoplace() const
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const wxString &forResolvedText, const VECTOR2I &forPosition, TEXT_ATTRIBUTES &aAttrs) const
VECTOR2I GetParentPosition() const
void CreateGraphicShape(const RENDER_SETTINGS *aRenderSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
A set of SCH_ITEMs (i.e., without duplicates).
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Base class for any item which can be embedded within the SCHEMATIC container class,...
const SYMBOL * GetParentSymbol() const
SCHEMATIC * Schematic() const
Search the item hierarchy to find a SCHEMATIC.
std::vector< int > ViewGetLayers() const override
Return the layers the item is drawn on (which may be more than its "home" layer)
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
bool RenderAsBitmap(double aWorldScale) const override
bool IsConnectivityDirty() const
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
wxString GetClass() const override
Return the class name.
const KIFONT::METRICS & GetFontMetrics() const
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
int GetEffectiveDiameter() const
VECTOR2I GetPosition() const override
bool IsDangling() const override
COLOR4D GetLabelColor() const
LABEL_FLAG_SHAPE GetShape() const
std::vector< SCH_FIELD > & GetFields()
Segment description base class to describe items which have 2 end points (track, wire,...
void SetStartPoint(const VECTOR2I &aPosition)
std::vector< VECTOR3I > BuildWireWithHopShape(const SCH_SCREEN *aScreen, double aArcRadius) const
For wires only: build the list of points to draw the shape using segments and 180 deg arcs Points are...
bool IsWire() const
Return true if the line is a wire.
bool IsStartDangling() const
void SetLineColor(const COLOR4D &aColor)
void SetLineWidth(const int aSize)
LINE_STYLE GetEffectiveLineStyle() const
VECTOR2I GetMidPoint() const
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
bool IsEndDangling() const
bool IsBus() const
Return true if the line is a bus.
void SetLineStyle(const LINE_STYLE aStyle)
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
void SetEndPoint(const VECTOR2I &aPosition)
const wxString & GetOperatingPoint() const
SCH_LAYER_ID GetColorLayer() const
VECTOR2I GetPosition() const override
VECTOR2I GetPosition() const override
int GetNumberTextSize() const
const wxString & GetOperatingPoint() const
void SetName(const wxString &aName)
bool IsGlobalPower() const
Return whether this pin forms a global power connection: i.e., is part of a power symbol and of type ...
VECTOR2I GetPinRoot() const
bool IsDangling() const override
void SetShape(GRAPHIC_PINSHAPE aShape)
VECTOR2I GetPosition() const override
int GetNameTextSize() const
wxString GetShownName() const
PIN_LAYOUT_CACHE & GetLayoutCache() const
Get the layout cache associated with this pin.
void SetOperatingPoint(const wxString &aText)
void SetType(ELECTRICAL_PINTYPE aType)
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
bool m_OverrideItemColors
float GetDanglingIndicatorThickness() const
bool m_ShowPinsElectricalType
bool m_ShowGraphicsDisabled
std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the SCH_SHAPE.
LINE_STYLE GetEffectiveLineStyle() const
STROKE_PARAMS GetStroke() const override
VECTOR2I GetPosition() const override
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
std::vector< SCH_FIELD > & GetFields()
Return a reference to the vector holding the sheet's fields.
VECTOR2I GetPosition() const override
const BOX2I GetBodyBoundingBox() const
Return a bounding box for the sheet body but not the fields.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
KIGFX::COLOR4D GetBorderColor() const
bool GetExcludedFromSim() const override
std::vector< SCH_SHEET_PIN * > & GetPins()
bool GetDNP() const override
Set or clear the 'Do Not Populate' flags.
KIGFX::COLOR4D GetBackgroundColor() const
BOX2I GetBodyAndPinsBoundingBox() const override
Return a bounding box for the symbol body and pins but not the fields.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly) const override
Populate a std::vector with SCH_FIELDs, sorted in ordinal order.
VECTOR2I GetPosition() const override
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
int GetOrientation() const override
Get the display symbol orientation.
bool IsSymbolLikePowerLocalLabel() const
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
BOX2I GetBodyBoundingBox() const override
Return a bounding box for the symbol body but not the pins or fields.
std::vector< SCH_TABLECELL * > GetCells() const
void DrawBorders(const std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2, const STROKE_PARAMS &aStroke)> &aCallback) const
virtual wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
VECTOR2I GetDrawPos() const override
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
VECTOR2I GetPosition() const override
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
virtual VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
void Fracture()
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
int NewOutline()
Creates a new empty polygon in the set and returns its index.
void BooleanSubtract(const SHAPE_POLY_SET &b)
Perform boolean polyset difference.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
const SEG & GetSeg() const
An abstract shape on 2D plane.
Simple container to manage line stroke parameters.
LINE_STYLE GetLineStyle() const
KIGFX::COLOR4D GetColor() const
static void Stroke(const SHAPE *aShape, LINE_STYLE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, const std::function< void(const VECTOR2I &a, const VECTOR2I &b)> &aStroker)
const TRANSFORM & GetTransform() const
bool GetDNP() const override
Set or clear the 'Do Not Populate' flag.
bool GetExcludedFromSim() const override
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
#define DANGLING_SYMBOL_SIZE
The size of the rectangle indicating an unconnected wire or label.
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define UNSELECTED_END_SIZE
The size of the rectangle indicating the anchor of a text object (including fields)
#define TEXT_ANCHOR_SIZE
The default pin len value when creating pins(can be changed in preference menu)
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
static constexpr EDA_ANGLE ANGLE_270
static constexpr EDA_ANGLE ANGLE_180
#define IS_SHOWN_AS_BITMAP
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_DANGLING
indicates a pin is dangling
#define STARTPOINT
When a line is selected, these flags indicate which.
int GetPenSizeForDemiBold(int aTextSize)
int GetPenSizeForNormal(int aTextSize)
int ClampTextPenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
@ LAYER_DRAW_BITMAPS
Draw images.
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_SHAPES_BACKGROUND
@ LAYER_EXCLUDED_FROM_SIM
@ LAYER_NET_COLOR_HIGHLIGHT
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SELECTION_SHADOWS
@ LAYER_SCHEMATIC_BACKGROUND
#define UNIMPLEMENTED_FOR(type)
The Cairo implementation of the graphics abstraction layer.
static void boxText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
static void bitmapText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs)
EESCHEMA_SETTINGS * eeconfig()
static void strokeText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
static void knockoutText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
static void drawAltPinModesIcon(GAL &aGal, const VECTOR2D &aPos, double aSize, bool aBaseSelected, bool aRotate, int aExtraLineWidth, const COLOR4D &aColor)
Draw an alternate pin mode indicator icon.
static bool isFieldsLayer(int aLayer)
static BOX2I GetTextExtents(const wxString &aText, const VECTOR2D &aPosition, KIFONT::FONT &aFont, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
bool contains(const _Container &__container, _Value __value)
Returns true if the container contains the given value.
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
#define TARGET_BUSENTRY_RADIUS
Class to handle a set of SCH_ITEMs.
#define BITMAP_FONT_SIZE_THRESHOLD
#define TARGET_PIN_RADIUS
Utility functions for working with shapes.
int PrintableCharCount(const wxString &aString)
Return the number of printable (ie: non-formatting) chars.
LINE_STYLE
Dashed line types.
constexpr int MilsToIU(int mils) const
int highlight_netclass_colors_thickness
bool highlight_netclass_colors
double highlight_netclass_colors_alpha
GR_TEXT_H_ALIGN_T m_HAlign
GR_TEXT_V_ALIGN_T m_VAlign
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_INDETERMINATE
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
const VECTOR2I CalcArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
constexpr int sign(T val)
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D