119 draw( item, aLayer,
false );
128#ifdef CONNECTIVITY_DEBUG
130 auto sch_item =
dynamic_cast<const SCH_ITEM*
>( aItem );
131 auto conn = sch_item ? sch_item->
Connection( *g_CurrentSheet ) :
nullptr;
136 auto label = conn->Name(
true );
141 m_canvas->SetLineWidth( Mils2ui( 2 ) );
142 m_canvas->SetGlyphSize(
VECTOR2D( Mils2ui( 20 ), Mils2ui( 20 ) ) );
143 m_canvas->StrokeText( *m_canvas, conn->Name(
true ), pos, 0.0, 0 );
151 switch( aItem->
Type() )
157 drawBoundingBox =
false;
158 draw(
static_cast<const SCH_PIN*
>( aItem ), aLayer, aDimmed );
170 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
173 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
176 draw(
static_cast<const SCH_TEXT*
>( aItem ), aLayer, aDimmed );
182 draw(
static_cast<const SCH_TABLE*
>( aItem ), aLayer, aDimmed );
185 draw(
static_cast<const SCH_LABEL*
>( aItem ), aLayer, aDimmed );
191 draw(
static_cast<const SCH_FIELD*
>( aItem ), aLayer, aDimmed );
227 if( drawBoundingBox )
243 box =
static_cast<const SCH_SYMBOL*
>( aItem )->GetBodyBoundingBox();
245 m_gal->SetIsFill(
false );
246 m_gal->SetIsStroke(
true );
248 :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
300 return (
float) std::fabs( matrix.
GetScale().
x * milsWidth ) +
schIUScale.MilsToIU( milsWidth );
305 bool aDimmed,
bool aIgnoreNets )
const
307 auto isBackgroundLayer =
324 color =
static_cast<const SCH_LINE*
>( aItem )->GetLineColor();
332 color =
static_cast<const SCH_JUNCTION*
>( aItem )->GetJunctionColor();
338 if( isBackgroundLayer( aLayer ) )
347 if( isBackgroundLayer( aLayer ) )
370 wxFAIL_MSG( wxT(
"Unsupported fill type" ) );
379 else if( isSymbolChild )
390 else if( aItem->
IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
396 else if( aIgnoreNets )
403 color =
static_cast<const SCH_FIELD*
>( aItem )->GetFieldColor();
409 if( isBackgroundLayer( aLayer ) )
414 else if(
const EDA_TEXT* otherTextItem =
dynamic_cast<const EDA_TEXT*
>( aItem ) )
417 color = otherTextItem->GetTextColor();
428 if( isBackgroundLayer( aLayer) )
453 if( aDrawingShadows )
460 else if( isBackgroundLayer( aLayer ) )
465 else if( aItem->
IsSelected() && aDrawingShadows )
469 else if( aItem->
IsSelected() && isBackgroundLayer( aLayer ) )
479 color = color.
Darken( 0.5f );
482 if( aDimmed && !( aItem->
IsSelected() && aDrawingShadows ) )
486 color = color.
Mix( sheetColour, 0.5f );
497 bool aDrawingWireColorHighlights )
const
510 if( aDrawingWireColorHighlights )
512 float colorHighlightWidth =
schIUScale.MilsToIU( 15.0 );
518 width += colorHighlightWidth;
529 switch( aItem->
Type() )
532 pen =
static_cast<const SCH_FIELD*
>( aItem )->GetEffectiveTextPenWidth( pen );
536 pen =
static_cast<const SCH_TEXT*
>( aItem )->GetEffectiveTextPenWidth( pen );
544 pen =
static_cast<const SCH_LABEL_BASE*
>( aItem )->GetEffectiveTextPenWidth( pen );
549 pen =
static_cast<const SCH_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth( pen );
563 int screenTextSize =
std::abs( (
int)
m_gal->GetScreenWorldMatrix().GetScale().y * 7 );
566 return KiROUND( ( docTextSize + screenTextSize * 2 ) / 3.0 );
615 std::optional<VECTOR2I> aMousePos = std::nullopt, wxString* aActiveUrl =
nullptr )
625 font->
Draw( &aGal, aText, aPosition, aAttrs, aFontMetrics, aMousePos, aActiveUrl );
667 callback_gal.SetIsStroke(
true );
669 font->
Draw( &callback_gal, aText, aPosition, attrs, aFontMetrics );
711 m_gal->DrawLine( a, b );
712 m_gal->DrawLine( b, c );
717 int aBodyStyle,
bool aDimmed )
725 std::unique_ptr< LIB_SYMBOL > tmpSymbol;
730 tmpSymbol = aSymbol->
Flatten();
731 drawnSymbol = tmpSymbol.get();
737 [](
const SCH_ITEM& item,
int layer )
747 if( !childOnLayer( item, aLayer ) )
756 draw( &item, aLayer, aDimmed );
783 bool aDrawingShadows,
bool aBrightened )
795 m_gal->SetIsFill(
false );
796 m_gal->SetIsStroke(
true );
797 m_gal->SetLineWidth( lineWidth );
806 const COLOR4D& aColor,
bool aDrawingShadows,
809 double lineWidth = aSize / 10.0;
811 if( aDrawingShadows )
814 std::vector<SCH_SHAPE> shapeList;
817 m_gal->SetLineWidth( lineWidth );
818 m_gal->SetIsStroke(
true );
819 m_gal->SetStrokeColor( aColor );
820 m_gal->SetFillColor( aColor );
822 for(
const SCH_SHAPE& shape : shapeList )
828 m_gal->DrawCurve( shape.GetStart(), shape.GetBezierC1(), shape.GetBezierC2(), shape.GetEnd() );
830 m_gal->DrawCircle( shape.getCenter(), shape.GetRadius() );
839 bool aRotate,
int aExtraLineWidth,
const COLOR4D& aColor )
867 const double lineYOffset = aSize / 4;
868 const double arrowHead = aSize / 8;
884 topLineREnd -
VECTOR2D{ aSize * 0.7, 0 } );
887 aGal.
DrawLine( topLineREnd, topLineREnd -
VECTOR2D{ arrowHead * 1.2, arrowHead } );
888 aGal.
DrawLine( topLineREnd, topLineREnd -
VECTOR2D{ arrowHead * 1.2, -arrowHead } );
892 aGal.
DrawLine( btmLineREnd, btmLineREnd -
VECTOR2D{ arrowHead * 1.2, arrowHead } );
893 aGal.
DrawLine( btmLineREnd, btmLineREnd -
VECTOR2D{ arrowHead * 1.2, -arrowHead } );
902 aGal.
DrawArc( topLineREnd -
VECTOR2D{ aSize - lineYOffset * 2, -lineYOffset },
923 if(
m_schSettings.IsPrinting() && ( drawingShadows || drawingDangling ) )
955 if( drawingDangling )
974 int textOffset =
KiROUND( textSize * 0.22 );
981 mid.
x +=
KiROUND( textOffset * 1.2 );
986 mid.
y -=
KiROUND( textOffset * 1.2 );
1007 m_gal->SetIsStroke(
true );
1008 m_gal->SetIsFill(
false );
1010 m_gal->SetStrokeColor( color );
1011 m_gal->SetFontBold(
false );
1012 m_gal->SetFontUnderlined(
false );
1013 m_gal->SetFontItalic(
false );
1016 const int diam =
radius*2;
1021 m_gal->DrawLine( p0, pos );
1034 m_gal->DrawLine( p0, pos );
1039 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1043 pc = p0 - dir * clock_size ;
1047 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1050 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1055 pc = p0 - dir * clock_size ;
1059 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1074 m_gal->DrawLine( p0, pos );
1078 m_gal->DrawLine( p0, pos );
1083 p0 +
VECTOR2D( -dir.
x * clock_size, 0 ),
1089 p0 +
VECTOR2D( 0, -dir.
y * clock_size ),
1095 m_gal->DrawLine( p0, pos );
1112 m_gal->DrawLine( p0, pos );
1121 m_gal->DrawLine( p0, pos );
1131 if( drawingShadows && !
eeconfig()->m_Selection.draw_selected_children )
1141 float shadowWidth = 0.0f;
1143 if( drawingShadows )
1152 const auto textRendersAsBitmap =
1166 const auto drawBrace =
1171 VECTOR2D mid = ( aTop + aBottom ) / 2.0;
1189 double braceOffset = aLeftBrace ? -aBraceWidth : aBraceWidth;
1190 p2.
y += braceOffset / 2;
1191 p3.
y += braceOffset;
1192 p4.
y += braceOffset / 2;
1197 double braceOffset = aLeftBrace ? -aBraceWidth : aBraceWidth;
1198 p2.
x += braceOffset / 2;
1199 p3.
x += braceOffset;
1200 p4.
x += braceOffset / 2;
1210 const auto drawBracesAroundText =
1214 if( aLines.size() <= 1 )
1218 int braceWidth = aAttrs.m_Size.x / 3;
1221 int maxLineWidth = 0;
1227 for(
const wxString& line : aLines )
1229 wxString trimmedLine = line;
1230 trimmedLine.Trim(
true ).Trim(
false );
1232 aAttrs.m_StrokeWidth,
false,
false,
1234 maxLineWidth = std::max( maxLineWidth, lineExtents.
x );
1242 int textHeight = aAttrs.m_Size.y;
1243 int extraHeight = textHeight / 3;
1248 braceEnd.
x += ( (int) aLines.size() - 1 ) * aLineSpacing;
1251 braceStart.
x -= 2 * extraHeight;
1254 int braceSpacing = maxLineWidth / 2 + braceWidth;
1256 VECTOR2D topBraceStart = braceStart;
1257 topBraceStart.
y -= braceSpacing;
1260 topBraceEnd.
y -= braceSpacing;
1262 drawBrace( aGal, topBraceStart, topBraceEnd, braceWidth,
true, aAttrs );
1264 VECTOR2D bottomBraceStart = braceStart;
1265 bottomBraceStart.
y += braceSpacing;
1267 VECTOR2D bottomBraceEnd = braceEnd;
1268 bottomBraceEnd.
y += braceSpacing;
1270 drawBrace( aGal, bottomBraceStart, bottomBraceEnd, braceWidth,
false, aAttrs );
1275 braceEnd.
y += ( (int) aLines.size() - 1 ) * aLineSpacing;
1278 braceStart.
y -= 2 * extraHeight;
1281 int braceSpacing = maxLineWidth / 2 + braceWidth;
1285 leftTop.
x -= braceSpacing;
1288 leftBottom.
x -= braceSpacing;
1290 drawBrace( aGal, leftTop, leftBottom, braceWidth,
true, aAttrs );
1294 rightTop.
x += braceSpacing;
1297 rightBottom.
x += braceSpacing;
1299 drawBrace( aGal, rightTop, rightBottom, braceWidth,
false, aAttrs );
1303 const auto drawBracesAroundTextBitmap =
1308 if( aLines.size() <= 1 )
1311 int braceWidth = aAttrs.m_Size.x / 4;
1314 int maxLineWidth = aAttrs.m_Size.x * 4;
1320 int textHalfHeight = aAttrs.m_Size.y / 2;
1325 braceEnd.
x += ( (int) aLines.size() - 1 ) * aLineSpacing;
1328 leftStart.
y -= maxLineWidth / 2.0 + braceWidth / 2.0;
1331 leftEnd.
y -= maxLineWidth / 2.0 + braceWidth / 2.0;
1333 drawBrace( aGal, leftStart, leftEnd, braceWidth,
true, aAttrs );
1336 rightStart.
y += maxLineWidth / 2.0 + braceWidth / 2.0;
1339 rightEnd.
y += maxLineWidth / 2.0 + braceWidth / 2.0;
1341 drawBrace( aGal, rightStart, rightEnd, braceWidth,
false, aAttrs );
1346 braceEnd.
y += ( (int) aLines.size() - 1 ) * aLineSpacing;
1349 braceTop.
y -= textHalfHeight;
1352 braceBottom.
y += textHalfHeight;
1355 leftTop.
x -= maxLineWidth / 2.0 + braceWidth / 2.0;
1358 leftBottom.
x -= maxLineWidth / 2.0 + braceWidth / 2.0;
1360 drawBrace( aGal, leftTop, leftBottom, braceWidth,
true, aAttrs );
1363 rightTop.
x += maxLineWidth / 2.0 + braceWidth / 2.0;
1365 VECTOR2D rightBottom = braceBottom;
1366 rightBottom.
x += maxLineWidth / 2.0 + braceWidth / 2.0;
1368 drawBrace( aGal, rightTop, rightBottom, braceWidth,
false, aAttrs );
1373 const auto drawMultiLineText =
1378 if( aText.StartsWith(
"[" ) && aText.EndsWith(
"]" ) && aText.Contains(
"\n" ) )
1381 wxString content = aText.Mid( 1, aText.Length() - 2 );
1382 wxArrayString lines;
1385 if( lines.size() > 1 )
1388 int lineSpacing =
KiROUND( aAttrs.m_Size.y * 1.3 );
1399 int totalWidth = ( (int) lines.size() - 1 ) * lineSpacing;
1400 startPos.
x -= totalWidth;
1404 int totalWidth = ( (int) lines.size() - 1 ) * lineSpacing;
1405 startPos.
x -= totalWidth / 2.0;
1409 for(
size_t i = 0; i < lines.size(); i++ )
1412 linePos.
x += i * lineSpacing;
1414 wxString line = lines[i];
1415 line.Trim(
true ).Trim(
false );
1417 strokeText( aGal, line, linePos, aAttrs, aFontMetrics );
1426 int totalHeight = ( (int) lines.size() - 1 ) * lineSpacing;
1427 startPos.
y -= totalHeight;
1431 int totalHeight = ( (int) lines.size() - 1 ) * lineSpacing;
1432 startPos.
y -= totalHeight / 2.0;
1436 for(
size_t i = 0; i < lines.size(); i++ )
1439 linePos.
y += (int) i * lineSpacing;
1441 wxString line = lines[i];
1442 line.Trim(
true ).Trim(
false );
1444 strokeText( aGal, line, linePos, aAttrs, aFontMetrics );
1449 drawBracesAroundText( aGal, lines, startPos, lineSpacing, aAttrs );
1455 strokeText( aGal, aText, aPosition, aAttrs, aFontMetrics );
1458 const auto boxMultiLineText =
1463 if( aText.StartsWith(
"[" ) && aText.EndsWith(
"]" ) && aText.Contains(
"\n" ) )
1465 wxString content = aText.Mid( 1, aText.Length() - 2 );
1466 wxArrayString lines;
1469 if( lines.size() > 1 )
1471 int lineSpacing =
KiROUND( aAttrs.m_Size.y * 1.3 );
1479 int totalWidth = ( (int) lines.size() - 1 ) * lineSpacing;
1480 startPos.
x -= totalWidth;
1484 int totalWidth = ( (int) lines.size() - 1 ) * lineSpacing;
1485 startPos.
x -= totalWidth / 2.0;
1488 for(
size_t i = 0; i < lines.size(); i++ )
1491 linePos.
x += (int) i * lineSpacing;
1493 wxString line = lines[i];
1494 line.Trim(
true ).Trim(
false );
1496 boxText( aGal, line, linePos, aAttrs, aFontMetrics );
1504 int totalHeight = ( (int) lines.size() - 1 ) * lineSpacing;
1505 startPos.
y -= totalHeight;
1509 int totalHeight = ( (int) lines.size() - 1 ) * lineSpacing;
1510 startPos.
y -= totalHeight / 2.0;
1513 for(
size_t i = 0; i < lines.size(); i++ )
1516 linePos.
y += (int) i * lineSpacing;
1518 wxString line = lines[i];
1519 line.Trim(
true ).Trim(
false );
1521 boxText( aGal, line, linePos, aAttrs, aFontMetrics );
1525 drawBracesAroundText( aGal, lines, startPos, lineSpacing, aAttrs );
1530 boxText( aGal, aText, aPosition, aAttrs, aFontMetrics );
1533 const auto drawMultiLineBitmapText =
1538 if( aText.StartsWith(
"[" ) && aText.EndsWith(
"]" ) && aText.Contains(
"\n" ) )
1540 wxString content = aText.Mid( 1, aText.Length() - 2 );
1541 wxArrayString lines;
1544 if( lines.size() > 1 )
1546 int lineSpacing =
KiROUND( aAttrs.m_Size.y * 1.3 );
1554 int totalWidth = ( (int) lines.size() - 1 ) * lineSpacing;
1555 startPos.
x -= totalWidth;
1559 int totalWidth = ( (int) lines.size() - 1 ) * lineSpacing;
1560 startPos.
x -= totalWidth / 2.0;
1563 for(
size_t i = 0; i < lines.size(); i++ )
1566 linePos.
x += (int) i * lineSpacing;
1568 wxString line = lines[i];
1569 line.Trim(
true ).Trim(
false );
1579 int totalHeight = ( (int) lines.size() - 1 ) * lineSpacing;
1580 startPos.
y -= totalHeight;
1584 int totalHeight = ( (int) lines.size() - 1 ) * lineSpacing;
1585 startPos.
y -= totalHeight / 2.0;
1588 for(
size_t i = 0; i < lines.size(); i++ )
1591 linePos.
y += (int) i * lineSpacing;
1593 wxString line = lines[i];
1594 line.Trim(
true ).Trim(
false );
1601 drawBracesAroundTextBitmap( aGal, lines, startPos, lineSpacing, aAttrs );
1606 bitmapText( aGal, aText, aPosition, aAttrs );
1609 const auto drawTextInfo =
1613 const bool renderTextAsBitmap = textRendersAsBitmap( *
m_gal, aTextInfo.
m_TextSize );
1616 m_gal->SetStrokeColor( aColor );
1617 m_gal->SetFillColor( aColor );
1627 if( drawingShadows )
1642 else if(
nonCached( aPin ) && renderTextAsBitmap )
1655 const auto getColorForLayer =
1656 [&](
int aDrawnLayer )
1661 return getRenderColor( aPin, aDrawnLayer, drawingShadows, aDimmed );
1666 if( std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> numInfo = cache.
GetPinNumberInfo( shadowWidth ) )
1668 drawTextInfo( *numInfo, getColorForLayer(
LAYER_PINNUM ) );
1679 origInfo.
m_TextSize = std::max( 1, ( numInfo->m_TextSize * 4 ) / 5 );
1696 drawTextInfo( origInfo, dimmed );
1700 if( std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> nameInfo = cache.
GetPinNameInfo( shadowWidth ) )
1702 drawTextInfo( *nameInfo, getColorForLayer(
LAYER_PINNAM ) );
1721 if( sig->GetTerminalPinA() == aPin->
m_Uuid || sig->GetTerminalPinB() == aPin->
m_Uuid )
1727 m_gal->SetStrokeColor( emphasis );
1728 m_gal->SetIsFill(
false );
1729 m_gal->SetIsStroke(
true );
1752 m_gal->SetStrokeColor( color );
1753 m_gal->SetIsStroke(
true );
1763 bool aDangling,
bool aDrawingShadows,
bool aBrightened )
1779 m_gal->SetIsStroke(
true );
1780 m_gal->SetIsFill(
false );
1790 bool highlightNetclassColors =
false;
1808 if( highlightNetclassColors && aLayer == aJct->
GetLayer() )
1815 if( junctionSize > 1 )
1817 m_gal->SetIsStroke( drawingShadows );
1819 m_gal->SetStrokeColor( color );
1820 m_gal->SetIsFill( !drawingShadows );
1821 m_gal->SetFillColor( color );
1832 bool drawingBusses = aLayer ==
LAYER_BUS;
1836 bool highlightNetclassColors =
false;
1837 double highlightAlpha = 0.6;
1839 double hopOverScale = 0.0;
1854 if( !highlightNetclassColors && drawingNetColorHighlights )
1857 if( drawingNetColorHighlights && !( aLine->
IsWire() || aLine->
IsBus() ) )
1860 if(
m_schSettings.m_OverrideItemColors && drawingNetColorHighlights )
1871 if( aLine->
IsNew() && drawingDangling )
1875 float width =
getLineWidth( aLine, drawingShadows, drawingNetColorHighlights );
1878 if( highlightNetclassColors )
1883 else if( drawingBusses )
1890 if( drawingWires && !drawingShadows &&
m_schematic
1891 && !
m_schematic->GetHighlightedNetChain().IsEmpty() )
1895 if( conn && !conn->
Name().IsEmpty() )
1903 color =
chain->GetColor().WithAlpha( color.
a );
1909 if( drawingNetColorHighlights )
1918 color = color.
WithAlpha( color.
a * highlightAlpha );
1921 if( ( drawingDangling || drawingShadows ) && !aLine->
IsNew() )
1926 COLOR4D indicatorColor( color );
1939 COLOR4D indicatorColor( color );
1950 if( drawingDangling )
1957 int textOffset =
KiROUND( textSize * 0.22 );
1962 pos.
y -= textOffset;
1968 pos.
x +=
KiROUND( textOffset * 1.2 );
1984 m_gal->SetIsStroke(
true );
1985 m_gal->SetIsFill(
false );
1986 m_gal->SetStrokeColor( color );
1987 m_gal->SetLineWidth( width );
1989 std::vector<VECTOR3I> curr_wire_shape;
1991 if( ( aLine->
IsWire() || aLine->
IsBus() ) && hopOverScale > 0.0 )
1993 double arcRadius = defaultLineWidth * hopOverScale;
2002 for(
size_t ii = 1; ii < curr_wire_shape.size(); ii++ )
2004 VECTOR2I start( curr_wire_shape[ii-1].x, curr_wire_shape[ii-1].y );
2006 if( curr_wire_shape[ii-1].z == 0 )
2009 VECTOR2I end( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
2015 VECTOR2I arc_middle( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
2017 VECTOR2I arc_end( curr_wire_shape[ii].x, curr_wire_shape[ii].y );
2029 EDA_ANGLE angle1 = midAngle - startAngle;
2034 m_gal->DrawArc(
center, ( dstart -
center ).EuclideanNorm(), startAngle, angle );
2054 if(
static_cast<const SCH_RULE_AREA*
>( aShape )->IsDirectiveLabelOnlyArea() )
2072 switch( shape->GetShape() )
2076 VECTOR2D start = shape->GetStart();
2085 EDA_ANGLE angle1 = midAngle - startAngle;
2090 m_gal->DrawArc(
center, ( start -
center ).EuclideanNorm(), startAngle, angle );
2095 m_gal->DrawCircle( shape->GetPosition(), shape->GetRadius() );
2099 if( shape->GetCornerRadius() > 0 )
2104 shape->GetRectangleWidth(),
2105 shape->GetRectangleHeight() ),
2106 shape->GetCornerRadius(),
true );
2109 m_gal->DrawPolygon( poly );
2113 m_gal->DrawRectangle( shape->GetPosition(), shape->GetEnd() );
2119 const std::vector<SHAPE*> polySegments = shape->MakeEffectiveShapes(
true );
2121 if( !polySegments.empty() )
2123 std::deque<VECTOR2D> pts;
2125 for(
SHAPE* polySegment : polySegments )
2126 pts.push_back(
static_cast<SHAPE_SEGMENT*
>( polySegment )->GetSeg().
A );
2130 for(
SHAPE* polySegment : polySegments )
2133 m_gal->DrawPolygon( pts );
2140 m_gal->DrawCurve( shape->GetStart(), shape->GetBezierC1(),
2141 shape->GetBezierC2(), shape->GetEnd() );
2146 m_gal->DrawEllipse( shape->GetEllipseCenter(), shape->GetEllipseMajorRadius(),
2147 shape->GetEllipseMinorRadius(), shape->GetEllipseRotation() );
2151 m_gal->DrawEllipseArc( shape->GetEllipseCenter(), shape->GetEllipseMajorRadius(),
2152 shape->GetEllipseMinorRadius(), shape->GetEllipseRotation(),
2153 shape->GetEllipseStartAngle(), shape->GetEllipseEndAngle() );
2163 if(
eeconfig()->m_Selection.fill_shapes )
2170 m_gal->SetIsFill(
true );
2172 m_gal->SetFillColor( color );
2176 m_gal->SetIsFill(
false );
2181 m_gal->SetIsStroke(
true );
2183 m_gal->SetStrokeColor( color );
2185 drawShape( aShape );
2203 m_gal->SetIsFill(
false );
2204 m_gal->SetIsStroke(
true );
2205 m_gal->SetStrokeColor( color );
2209 m_gal->DrawLine( seg.A, seg.B );
2218 m_gal->SetIsFill(
true );
2219 m_gal->SetIsStroke(
false );
2220 m_gal->SetFillColor( color );
2222 drawShape( aShape );
2227 wxFAIL_MSG( wxT(
"Unsupported fill type" ) );
2236 m_gal->SetIsFill(
true );
2237 m_gal->SetIsStroke(
false );
2238 m_gal->SetFillColor( color );
2240 drawShape( aShape );
2243 float lineWidth =
getLineWidth( aShape, drawingShadows );
2247 m_gal->SetIsFill(
false );
2248 m_gal->SetIsStroke(
true );
2249 m_gal->SetLineWidth( lineWidth );
2250 m_gal->SetStrokeColor( color );
2254 drawShape( aShape );
2258 std::vector<SHAPE*> shapes;
2281 for(
SHAPE* shape : shapes )
2287 m_gal->DrawLine( a + 1, b );
2289 m_gal->DrawLine( a, b );
2293 for(
SHAPE* shape : shapes )
2317 switch( aText->
Type() )
2338 if( conn && conn->
IsBus() )
2352 bool transparentColor = !drawingShadows && color.
a <= 0.0;
2354 m_gal->SetStrokeColor( color );
2355 m_gal->SetFillColor( color );
2356 m_gal->SetHoverColor( color );
2366 if( transparentColor )
2371 else if( drawingShadows && font->
IsOutline() )
2383 m_gal->SetIsFill(
true );
2384 m_gal->SetIsStroke(
false );
2394 double shadowOffset = 0.0;
2396 if( drawingShadows )
2401 const double adjust = 1.2f;
2402 shadowOffset = shadowWidth/2.0f * adjust;
2416 pos.
y = bBox.
GetTop() - shadowOffset;
2419 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
2428 pos.
x = bBox.
GetLeft() - shadowOffset;
2437 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
2448 else if( drawingShadows )
2450 m_gal->SetIsFill(
false );
2451 m_gal->SetIsStroke(
true );
2461 text_offset.
x -= fudge;
2463 text_offset.
y -= fudge;
2465 text_offset.
x += fudge;
2467 text_offset.
y += fudge;
2493 && !shownText.Contains( wxT(
"\n" ) ) )
2500 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2508 m_gal->DrawGlyphs( *cache );
2527 switch( aText->
Type() )
2535 showAnchor = !
static_cast<const SCH_LABEL*
>( aText )->IsDangling();
2580 float borderWidth =
getLineWidth( aTextBox, drawingShadows );
2607 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2615 m_gal->DrawGlyphs( *cache );
2629 bool transparentColor = !drawingShadows && color.
a <= 0.0;
2631 m_gal->SetFillColor( color );
2632 m_gal->SetStrokeColor( color );
2633 m_gal->SetHoverColor( color );
2637 m_gal->SetIsFill(
true );
2638 m_gal->SetIsStroke(
false );
2639 m_gal->SetLineWidth( borderWidth );
2650 m_gal->SetIsFill(
true );
2651 m_gal->SetIsStroke(
false );
2652 m_gal->SetLineWidth( borderWidth );
2659 if( transparentColor )
2676 if( transparency > 0.0 )
2677 borderColor = borderColor.
WithAlpha( borderColor.
a * ( 1.0 - transparency ) );
2681 borderColor = borderColor.
Mix( bg, 0.5f );
2685 m_gal->SetIsFill(
false );
2686 m_gal->SetIsStroke(
true );
2687 m_gal->SetStrokeColor( borderColor );
2688 m_gal->SetLineWidth( borderWidth );
2698 for(
SHAPE* shape : shapes )
2706 m_gal->DrawLine( a+1, b );
2708 m_gal->DrawLine( a, b );
2712 for(
SHAPE* shape : shapes )
2726 draw( cell, aLayer, aDimmed );
2738 if( lineWidth == 0 )
2747 m_gal->SetIsFill(
false );
2748 m_gal->SetIsStroke(
true );
2749 m_gal->SetStrokeColor( color );
2750 m_gal->SetLineWidth( (
float) lineWidth );
2754 m_gal->DrawLine( ptA, ptB );
2764 m_gal->DrawLine( a+1, b );
2766 m_gal->DrawLine( a, b );
2776 std::function<bool( wxString* )> symbolResolver =
2777 [&]( wxString* token ) ->
bool
2791 auto t1 = std::chrono::high_resolution_clock::now();
2794 std::optional<SCH_SHEET_PATH> optSheetPath;
2796 wxString variantName;
2803 "SCH_PAINTER::draw symbol %s: Current sheet path='%s', variant='%s', size=%zu, empty=%d",
2806 optSheetPath->Path().AsString(),
2807 optSheetPath->size(),
2808 optSheetPath->empty() ? 1 : 0 );
2811 SCH_SHEET_PATH* sheetPath = optSheetPath ? &optSheetPath.value() :
nullptr;
2812 bool DNP = aSymbol->
GetDNP( sheetPath, variantName );
2819 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2822 draw( &field, aLayer, DNP );
2840 std::vector<SCH_PIN*> originalPins = originalSymbol->
GetGraphicalPins( unit, bodyStyle );
2843 auto tCopy1 = std::chrono::high_resolution_clock::now();
2844 LIB_SYMBOL tempSymbol( *originalSymbol,
nullptr,
false );
2845 auto tCopy2 = std::chrono::high_resolution_clock::now();
2847 if( std::chrono::duration_cast<std::chrono::microseconds>( tCopy2 - tCopy1 ).count() > 100 )
2850 std::chrono::duration_cast<std::chrono::microseconds>( tCopy2 - tCopy1 ).count() );
2853 std::vector<SCH_PIN*> tempPins = tempSymbol.
GetGraphicalPins( unit, bodyStyle );
2861 tempItem.SetFlags( aSymbol->
GetFlags() );
2881 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2884 SCH_PIN* tempPin = tempPins[ i ];
2903 const wxString effective =
2906 if( effective != original )
2931 for(
unsigned i = 0; i < tempPins.size(); ++i )
2934 SCH_PIN* tempPin = tempPins[ i ];
2957 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2958 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2965 m_gal->AdvanceDepth();
2966 m_gal->SetIsStroke(
true );
2967 m_gal->SetIsFill(
true );
2968 m_gal->SetStrokeColor( marker_color );
2969 m_gal->SetFillColor( marker_color );
2971 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2972 std::swap( pt1.
x, pt2.
x );
2973 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2985 m_gal->AdvanceDepth();
2986 m_gal->SetIsStroke(
true );
2987 m_gal->SetIsFill(
true );
2988 m_gal->SetStrokeColor( marker_color );
2989 m_gal->SetFillColor( marker_color );
2996 int offset = 2 * strokeWidth;
3005 m_gal->AdvanceDepth();
3006 m_gal->SetFillColor( marker_color );
3010 auto t2 = std::chrono::high_resolution_clock::now();
3012 if( std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count() > 100 )
3015 std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count() );
3040 if( std::find( layers.begin(), layers.end(), aLayer ) == layers.end() )
3060 bool transparentColor = !drawingShadows && color.
a <= 0.0;
3071 wxString shownText = aField->
GetShownText( sheetPath,
true, 0, variant );
3073 if( shownText.IsEmpty() )
3115 m_gal->SetStrokeColor( color );
3116 m_gal->SetFillColor( color );
3117 m_gal->SetHoverColor( color );
3119 if( transparentColor )
3123 else if( drawingShadows &&
getFont( aField )->IsOutline() )
3141 if( drawingShadows )
3164 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
3167 cache = aField->
GetRenderCache( shownText, textpos, attributes );
3172 m_gal->DrawGlyphs( *cache );
3215 bool parentMoving = fieldParent && fieldParent->
IsMoving();
3225 else if( aField->
IsSelected() && !parentMoving )
3241 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
3244 draw( &field, aLayer,
false );
3255 if( drawingDangling )
3269 bool transparentColor = !drawingShadows && color.
a <= 0.0;
3271 if( !transparentColor )
3273 std::vector<VECTOR2I> pts;
3274 std::deque<VECTOR2D> pts2;
3279 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
3281 m_gal->SetIsStroke(
true );
3283 m_gal->SetStrokeColor( color );
3285 if( drawingShadows )
3288 m_gal->SetFillColor( color );
3289 m_gal->DrawPolygon( pts2 );
3293 m_gal->SetIsFill(
false );
3294 m_gal->DrawPolyline( pts2 );
3298 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
3311 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
3314 draw( &field, aLayer,
false );
3325 if( drawingDangling )
3339 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
3352 if( !( drawingShadows || drawingDangling ) ||
eeconfig()->m_Selection.draw_selected_children )
3355 draw( &field, aLayer,
false );
3366 if( drawingDangling )
3380 bool transparentColor = !drawingShadows && color.
a <= 0.0;
3382 if( !transparentColor )
3384 std::vector<VECTOR2I> i_pts;
3385 std::deque<VECTOR2D> d_pts;
3389 for(
const VECTOR2I& i_pt : i_pts )
3390 d_pts.emplace_back(
VECTOR2D( i_pt.x, i_pt.y ) );
3392 m_gal->SetIsFill(
true );
3394 m_gal->SetIsStroke(
true );
3396 m_gal->SetStrokeColor( color );
3397 m_gal->DrawPolyline( d_pts );
3400 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer, aDimmed );
3414 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
3417 draw( &field, aLayer,
false );
3440 if( !drawingShadows && color.
a <= 0.0 )
3443 std::vector<VECTOR2I> pts;
3444 std::deque<VECTOR2D> pts2;
3449 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
3451 m_gal->SetIsFill(
false );
3452 m_gal->SetFillColor( color );
3453 m_gal->SetIsStroke(
true );
3455 m_gal->SetStrokeColor( color );
3459 m_gal->DrawLine( pts2[0], pts2[1] );
3460 m_gal->SetIsFill(
true );
3461 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).EuclideanNorm() );
3465 m_gal->DrawLine( pts2[0], pts2[1] );
3466 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).EuclideanNorm() );
3470 m_gal->DrawPolyline( pts2 );
3485 DNP = aSheet->
GetDNP( sheetPath, variant );
3495 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
3498 draw( &field, aLayer, DNP );
3522 if( backgroundColor.
a > 0.0 )
3525 m_gal->SetIsFill(
true );
3526 m_gal->SetIsStroke(
false );
3528 m_gal->DrawRectangle( pos, pos + size );
3536 m_gal->SetIsStroke(
true );
3538 m_gal->SetIsFill(
false );
3540 m_gal->DrawRectangle( pos, pos + size );
3552 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
3553 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
3560 m_gal->AdvanceDepth();
3561 m_gal->SetIsStroke(
true );
3562 m_gal->SetIsFill(
true );
3566 m_gal->DrawSegment( pt1, pt2, strokeWidth );
3567 std::swap( pt1.
x, pt2.
x );
3568 m_gal->DrawSegment( pt1, pt2, strokeWidth );
3580 m_gal->AdvanceDepth();
3581 m_gal->SetIsStroke(
true );
3582 m_gal->SetIsFill(
true );
3591 int offset = 2 * strokeWidth;
3600 m_gal->AdvanceDepth();
3617 m_gal->SetIsStroke(
true );
3620 m_gal->SetIsFill(
false );
3638 bool drawingBusses = aLayer ==
LAYER_BUS;
3643 bool highlightNetclassColors =
false;
3651 if( !highlightNetclassColors && drawingNetColorHighlights )
3654 if(
m_schSettings.m_OverrideItemColors && drawingNetColorHighlights )
3682 if( highlightNetclassColors )
3687 else if( drawingBusses )
3691 if( drawingNetColorHighlights )
3703 if( drawingDangling )
3705 m_gal->SetIsFill(
false );
3706 m_gal->SetIsStroke(
true );
3727 draw( &line, aLayer );
3734 auto t1 = std::chrono::high_resolution_clock::now();
3744 if( img_scale != 1.0 )
3757 m_gal->SetIsStroke(
true );
3758 m_gal->SetStrokeColor( color );
3760 m_gal->SetIsFill(
false );
3768 bm_size.
x /= img_scale;
3769 bm_size.
y /= img_scale;
3770 const VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
3773 m_gal->DrawRectangle( origin,
end );
3778 auto t2 = std::chrono::high_resolution_clock::now();
3780 if( std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count() > 100 )
3783 std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count() );
3802 m_gal->SetIsFill( !drawingShadows );
3803 m_gal->SetFillColor( color );
3804 m_gal->SetIsStroke( drawingShadows );
3806 m_gal->SetStrokeColor( color );
3811 m_gal->DrawPolygon( polygon );
3818 const bool drawingShadows =
false;
3839 m_gal->SetStrokeColor( color );
3847 m_gal->DrawLine( topLeft, topLeft + width );
3848 m_gal->DrawLine( topLeft + width, topLeft + width + height );
3849 m_gal->DrawLine( topLeft + width + height, topLeft + height );
3850 m_gal->DrawLine( topLeft + height, topLeft );
3854 if(
name.IsEmpty() )
3858 int scaledSize = abs(
KiROUND(
m_gal->GetScreenWorldMatrix().GetScale().x * ptSize ) );
3859 int unscaledSize =
schIUScale.MilsToIU( ptSize );
3862 int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
3868 m_gal->DrawLine( topLeft, topLeft - titleHeight );
3869 m_gal->DrawLine( topLeft - titleHeight, topLeft + width - titleHeight );
3870 m_gal->DrawLine( topLeft + width - titleHeight, topLeft + width );
3887 LINE_STYLE aLineStyle,
bool aDrawDirectLine,
int aWidth )
3889 if( aDrawDirectLine )
3891 m_gal->DrawLine( aStartPoint, aEndPoint );
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.
VECTOR2I GetRolloverPos() const
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
int GetEllipseMinorRadius() const
const VECTOR2I & GetEllipseCenter() const
EDA_ANGLE GetEllipseEndAngle() const
FILL_T GetFillMode() const
int GetEllipseMajorRadius() const
EDA_ANGLE GetEllipseRotation() const
const std::vector< SEG > & GetHatchLines() const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
COLOR4D GetFillColor() const
EDA_ANGLE GetEllipseStartAngle() const
virtual void UpdateHatching() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
COLOR4D GetTextColor() const
virtual VECTOR2I GetTextPos() const
void SetActiveUrl(const wxString &aUrl) const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
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
virtual bool HasHyperlink() const
wxString GetHyperlink() const
virtual KIFONT::FONT * GetDrawFont(const RENDER_SETTINGS *aSettings) const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
virtual EDA_ANGLE GetTextAngle() const
const TEXT_ATTRIBUTES & GetAttributes() const
virtual void SetText(const wxString &aText)
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, std::optional< VECTOR2I > aMousePos=std::nullopt, wxString *aActiveUrl=nullptr) 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 & Darken(double aFactor)
Makes the color darker by a given factor.
std::shared_ptr< wxString > m_text
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 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.
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 DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
Draw an arc.
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.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
PAINTER(GAL *aGal)
Initialize this object for painting on any of the polymorphic GRAPHICS_ABSTRACTION_LAYER* derivatives...
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)
wxString expandLibItemTextVars(const wxString &aSourceText, const SCH_SYMBOL *aSymbolContext)
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
wxString AsString() const
Define a library symbol object.
std::vector< const SCH_PIN * > GetGraphicalPins(int aUnit=0, int aBodyStyle=0) const
Graphical pins: Return schematic pin objects as drawn (unexpanded), filtered by unit/body.
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.
OPT_BOX2I GetPinNumberBBox()
Get the bounding box of the pin number, 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
A round rectangle shape, based on a rectangle and a radius.
void TransformToPolygon(SHAPE_POLY_SET &aBuffer, int aMaxError) const
Get the polygonal representation of the roundrect.
double GetHopOverScale()
Accessor that computes the current hop-over size.
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).
wxString Name(bool aIgnoreSheet=false) const
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
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0, const wxString &aVariantName=wxEmptyString) const
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
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 ResolveText(const wxString &aText, const SCH_SHEET_PATH *aPath, int aDepth=0) const
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
A net chain is a collection of nets that are connected together through passive components.
VECTOR2I GetPosition() const override
int GetNumberTextSize() const
void SetNumber(const wxString &aNumber)
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
const wxString & GetShownName() const
PIN_LAYOUT_CACHE & GetLayoutCache() const
Get the layout cache associated with this pin.
const wxString & GetRemappedFromNumber() const
Transient, render-only original pin number for a pad-remapped pin (issue #2282).
void SetOperatingPoint(const wxString &aText)
void SetType(ELECTRICAL_PINTYPE aType)
void SetRemappedFromNumber(const wxString &aNumber)
wxString GetEffectivePadNumber(const SCH_SHEET_PATH &aSheet, const wxString &aVariantName, const LIB_ID &aFootprintLibId, const std::set< wxString > *aFootprintPadNumbers, PAD_RESOLUTION *aState=nullptr) const
Resolve the footprint pad number this symbol pin lands on (issue #2282).
const wxString & GetShownNumber() const
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the SCH_SHAPE.
LINE_STYLE GetEffectiveLineStyle() const
int GetHatchLineWidth() const override
STROKE_PARAMS GetStroke() const override
VECTOR2I GetPosition() const override
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
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.
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
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 GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flags.
std::vector< SCH_SHEET_PIN * > & GetPins()
KIGFX::COLOR4D GetBackgroundColor() const
bool GetExcludedFromSim(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
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.
static void BuildLocalPowerIconShape(std::vector< SCH_SHAPE > &aShapeList, const VECTOR2D &aPos, double aSize, double aLineWidth, bool aHorizontal)
Build the local power pin indicator icon shape, at coordinate aPos.
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.
virtual bool GetDNP(const SCH_SHEET_PATH *aInstance=nullptr, const wxString &aVariantName=wxEmptyString) const override
Set or clear the 'Do Not Populate' flag.
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 RENDER_SETTINGS *aSettings, const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
VECTOR2I GetDrawPos() const override
VECTOR2I GetPosition() const override
VECTOR2I GetOffsetToMatchSCH_FIELD(SCH_RENDER_SETTINGS *aRenderSettings) const
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.
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 Fracture(bool aSimplify=true)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
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
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.
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
@ FILLED_WITH_BG_BODYCOLOR
@ FILLED_SHAPE
Fill with object color.
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.
const wxChar *const traceSchPainter
Flag to enable debug output of schematic painter operations.
@ 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)
MATRIX3x3< double > MATRIX3x3D
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, std::optional< VECTOR2I > aMousePos=std::nullopt, wxString *aActiveUrl=nullptr)
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)
@ PT_NC
not connected (must be left open)
#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.
wxString GetDefaultVariantName()
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.
int PrintableCharCount(const wxString &aString)
Return the number of printable (ie: non-formatting) chars.
LINE_STYLE
Dashed line types.
bool show_remapped_pin_numbers
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
@ VALUE
Field Value of part, i.e. "3.3K".
KIBIS top(path, &reporter)
const SHAPE_LINE_CHAIN chain
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_INDETERMINATE
wxLogTrace helper definitions.
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