136 m_schematic( nullptr )
147 draw( item, aLayer,
false );
155#ifdef CONNECTIVITY_DEBUG
157 auto sch_item =
dynamic_cast<const SCH_ITEM*
>( aItem );
158 auto conn = sch_item ? sch_item->
Connection( *g_CurrentSheet ) :
nullptr;
163 auto label = conn->Name(
true );
170 m_gal->StrokeText( conn->Name(
true ), pos, 0.0, 0 );
178 switch( aItem->
Type() )
184 drawBoundingBox =
false;
185 draw(
static_cast<const SCH_PIN*
>( aItem ), aLayer, aDimmed );
197 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
200 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
203 draw(
static_cast<const SCH_TEXT*
>( aItem ), aLayer, aDimmed );
209 draw(
static_cast<const SCH_TABLE*
>( aItem ), aLayer, aDimmed );
218 draw(
static_cast<const SCH_FIELD*
>( aItem ), aLayer, aDimmed );
251 if( drawBoundingBox )
267 box =
static_cast<const SCH_SYMBOL*
>( aItem )->GetBodyBoundingBox();
272 :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
339 color =
static_cast<const SCH_LINE*
>( aItem )->GetLineColor();
373 else if( shape->
GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
415 else if(
const EDA_TEXT* otherTextItem =
dynamic_cast<const EDA_TEXT*
>( aItem ) )
418 color = otherTextItem->GetTextColor();
423 color = m_schSettings.GetLayerColor( aLayer );
425 if( aItem->IsBrightened() )
429 if( aDrawingShadows )
431 if( aItem->IsSelected() )
441 else if( aItem->IsSelected() && aDrawingShadows )
454 if( m_schSettings.m_ShowDisabled
455 || ( m_schSettings.m_ShowGraphicsDisabled && aItem->Type() !=
SCH_FIELD_T ) )
460 if( aDimmed && !( aItem->IsSelected() && aDrawingShadows ) )
467 if( aItem->GetForcedTransparency() > 0.0 )
468 color =
color.WithAlpha(
color.a * ( 1.0 - aItem->GetForcedTransparency() ) );
474float SCH_PAINTER::getLineWidth(
const SCH_ITEM* aItem,
bool aDrawingShadows )
const
483 if( aDrawingShadows && aItem->
IsType( g_ScaledSelectionTypes ) )
491float SCH_PAINTER::getTextThickness(
const SCH_ITEM* aItem )
const
493 int pen = m_schSettings.GetDefaultPenWidth();
495 switch( aItem->
Type() )
498 pen =
static_cast<const SCH_FIELD*
>( aItem )->GetEffectiveTextPenWidth( pen );
502 pen =
static_cast<const SCH_TEXT*
>( aItem )->GetEffectiveTextPenWidth( pen );
510 pen =
static_cast<const SCH_LABEL_BASE*
>( aItem )->GetEffectiveTextPenWidth( pen );
515 pen =
static_cast<const SCH_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth( pen );
526int SCH_PAINTER::getOperatingPointTextSize()
const
529 int screenTextSize =
std::abs( (
int) m_gal->GetScreenWorldMatrix().GetScale().y * 7 );
532 return KiROUND( ( docTextSize + screenTextSize * 2 ) / 3 );
549void SCH_PAINTER::strokeText(
const wxString& aText,
const VECTOR2D& aPosition,
562 m_gal->SetIsStroke( font->
IsStroke() );
564 font->
Draw( m_gal, aText, aPosition, aAttrs, aFontMetrics );
568void SCH_PAINTER::bitmapText(
const wxString& aText,
const VECTOR2D& aPosition,
576 m_gal->SetHorizontalJustify( aAttrs.
m_Halign );
577 m_gal->SetVerticalJustify( aAttrs.
m_Valign );
579 m_gal->BitmapText( aText, aPosition, aAttrs.
m_Angle );
583void SCH_PAINTER::knockoutText(
const wxString& aText,
const VECTOR2D& aPosition,
606 callback_gal.SetIsStroke(
true );
608 font->
Draw( &callback_gal, aText, aPosition, attrs, aFontMetrics );
622 m_gal->SetIsStroke(
false );
623 m_gal->SetIsFill(
true );
624 m_gal->SetFillColor( attrs.
m_Color );
625 m_gal->DrawPolygon( finalPoly );
629void SCH_PAINTER::boxText(
const wxString& aText,
const VECTOR2D& aPosition,
666 m_gal->SetIsFill(
true );
667 m_gal->SetIsStroke(
false );
674 m_gal->DrawLine( a, b );
675 m_gal->DrawLine( b, c );
679void SCH_PAINTER::draw(
const LIB_SYMBOL* aSymbol,
int aLayer,
bool aDrawFields,
int aUnit,
680 int aBodyStyle,
bool aDimmed )
683 aUnit = m_schSettings.m_ShowUnit;
686 aBodyStyle = m_schSettings.m_ShowBodyStyle;
688 std::unique_ptr< LIB_SYMBOL > tmpSymbol;
693 tmpSymbol = aSymbol->
Flatten();
694 drawnSymbol = tmpSymbol.get();
700 [](
const SCH_ITEM& item,
int layer )
702 int layers[512], layers_count;
705 for(
int ii = 0; ii < layers_count; ++ii )
707 if( layers[ii] == layer )
719 if( !childOnLayer( item, aLayer ) )
728 draw( &item, aLayer, aDimmed );
733int SCH_PAINTER::internalPinDecoSize(
const SCH_PIN &aPin )
735 if( m_schSettings.m_PinSymbolSize > 0 )
736 return m_schSettings.m_PinSymbolSize;
744int SCH_PAINTER::externalPinDecoSize(
const SCH_PIN &aPin )
746 if( m_schSettings.m_PinSymbolSize > 0 )
747 return m_schSettings.m_PinSymbolSize;
754void SCH_PAINTER::drawPinDanglingIndicator(
const VECTOR2I& aPos,
const COLOR4D& aColor,
755 bool aDrawingShadows,
bool aBrightened )
759 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
761 m_gal->SetIsFill(
false );
762 m_gal->SetIsStroke(
true );
763 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
764 : m_schSettings.GetDanglingIndicatorThickness() );
770void SCH_PAINTER::draw(
const SCH_PIN* aPin,
int aLayer,
bool aDimmed )
777 if( !isUnitAndConversionShown( aPin ) )
782 if( m_schSettings.IsPrinting() && drawingShadows )
797 if( m_schSettings.IsPrinting() )
801 : m_schSettings.m_ShowHiddenPins;
816 if( drawingDangling )
824 if( m_schSettings.GetDrawBoundingBoxes() )
825 drawItemBoundingBox( aPin );
833 int textSize = getOperatingPointTextSize();
835 int textOffset =
KiROUND( textSize * 0.22 );
842 mid.
x +=
KiROUND( textOffset * 1.2 );
847 mid.
y -=
KiROUND( textOffset * 1.2 );
868 m_gal->SetIsStroke(
true );
869 m_gal->SetIsFill(
false );
870 m_gal->SetLineWidth( getLineWidth( aPin, drawingShadows ) );
871 m_gal->SetStrokeColor(
color );
872 m_gal->SetFontBold(
false );
873 m_gal->SetFontUnderlined(
false );
874 m_gal->SetFontItalic(
false );
877 const int diam = radius*2;
882 m_gal->DrawLine( p0, pos );
895 m_gal->DrawLine( p0, pos );
899 m_gal->DrawCircle( p0 + dir * radius, radius );
900 m_gal->DrawLine( p0 + dir * ( diam ), pos );
904 pc = p0 - dir * clock_size ;
906 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
910 m_gal->DrawCircle( p0 + dir * radius, radius );
911 m_gal->DrawLine( p0 + dir * ( diam ), pos );
916 pc = p0 - dir * clock_size ;
918 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
930 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
935 m_gal->DrawLine( p0, pos );
939 m_gal->DrawLine( p0, pos );
943 triLine( p0 +
VECTOR2D( 0, clock_size ),
949 triLine( p0 +
VECTOR2D( clock_size, 0 ),
956 m_gal->DrawLine( p0, pos );
966 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
973 m_gal->DrawLine( p0, pos );
982 m_gal->DrawLine( p0, pos );
984 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius,
985 p0 +
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius );
986 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius,
987 p0 +
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius );
992 if( drawingShadows && !
eeconfig()->m_Selection.draw_selected_children )
997 float penWidth = (float) m_schSettings.GetDefaultPenWidth();
999 float nameStrokeWidth = getLineWidth( aPin,
false );
1000 float numStrokeWidth = getLineWidth( aPin,
false );
1002 bool showPinNumbers = m_schSettings.m_ShowPinNumbers || symbol->
GetShowPinNumbers();
1010 enum { INSIDE = 0,
OUTSIDE, ABOVE, BELOW };
1011 int size[4] = { 0, 0, 0, 0 };
1012 float thickness[4] = { numStrokeWidth, numStrokeWidth, numStrokeWidth, numStrokeWidth };
1020 thickness[INSIDE] = nameStrokeWidth;
1021 colour [INSIDE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1025 thickness[ABOVE] = numStrokeWidth;
1026 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1030 else if( showPinNames && showPinNumbers )
1033 thickness[ABOVE] = nameStrokeWidth;
1034 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1038 thickness[BELOW] = numStrokeWidth;
1039 colour [BELOW] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1042 else if( showPinNames )
1045 thickness[ABOVE] = nameStrokeWidth;
1046 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1049 else if( showPinNumbers )
1052 thickness[ABOVE] = numStrokeWidth;
1053 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1057 if( m_schSettings.m_ShowPinsElectricalType )
1069 #define BITMAP_FONT_SIZE_THRESHOLD 3.5
1079 c = getRenderColor( aPin,
LAYER_HIDDEN, drawingShadows, aDimmed );
1082 float insideOffset = (float) textOffset - thickness[INSIDE] / 2.0f;
1084 float aboveOffset =
PIN_TEXT_MARGIN + penWidth / 2.0f + thickness[ABOVE] / 2.0f;
1085 float belowOffset =
PIN_TEXT_MARGIN + penWidth / 2.0f + thickness[BELOW] / 2.0f;
1090 if( drawingShadows )
1092 float shadowWidth = getShadowWidth( aPin->
IsBrightened() );
1094 for(
float& t : thickness )
1104 const float adjust = 1.2f;
1105 float shadowOffset = shadowWidth/2.0f * adjust;
1106 insideOffset -= shadowOffset;
1107 outsideOffset -= shadowOffset;
1115 if(
text[i].IsEmpty() )
1119 m_gal->SetStrokeColor( colour[i] );
1120 m_gal->SetFillColor( colour[i] );
1134 else if( drawingShadows )
1138 else if( nonCached( aPin ) && renderTextAsBitmap )
1140 bitmapText(
text[i], aPos, attrs );
1155 drawText( INSIDE, pos +
VECTOR2D( -insideOffset - (
float) len, 0 ),
1165 drawText( ABOVE, pos +
VECTOR2D( -len / 2.0, -aboveOffset ),
1170 drawText( BELOW, pos +
VECTOR2D( -len / 2.0, belowOffset ),
1178 drawText( INSIDE, pos +
VECTOR2D( insideOffset + (
float) len, 0 ),
1188 drawText( ABOVE, pos +
VECTOR2D( len / 2.0, -aboveOffset ),
1193 drawText( BELOW, pos +
VECTOR2D( len / 2.0, belowOffset ),
1201 drawText( INSIDE, pos +
VECTOR2D( 0, insideOffset + (
float) len ),
1211 drawText( ABOVE, pos +
VECTOR2D( -aboveOffset, len / 2.0 ),
1216 drawText( BELOW, pos +
VECTOR2D( belowOffset, len / 2.0 ),
1224 drawText( INSIDE, pos +
VECTOR2D( 0, -insideOffset - (
float) len ),
1234 drawText( ABOVE, pos +
VECTOR2D( -aboveOffset, -len / 2.0 ),
1239 drawText( BELOW, pos +
VECTOR2D( belowOffset, -len / 2.0 ),
1245 wxFAIL_MSG(
"Unknown pin orientation" );
1251void SCH_PAINTER::drawAnchor(
const VECTOR2I& aPos,
bool aDrawingShadows )
1253 if( m_schSettings.IsPrinting() )
1258 const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
1265 m_gal->SetStrokeColor(
color );
1266 m_gal->SetIsStroke(
true );
1267 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth(
false )
1268 : m_schSettings.GetDanglingIndicatorThickness() );
1270 m_gal->DrawLine( aPos -
VECTOR2I( radius, 0 ), aPos +
VECTOR2I( radius, 0 ) );
1271 m_gal->DrawLine( aPos -
VECTOR2I( 0, radius ), aPos +
VECTOR2I( 0, radius ) );
1277void SCH_PAINTER::drawDanglingIndicator(
const VECTOR2I& aPos,
const COLOR4D& aColor,
int aWidth,
1278 bool aDangling,
bool aDrawingShadows,
bool aBrightened )
1280 if( m_schSettings.IsPrinting() )
1293 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
1294 m_gal->SetIsStroke(
true );
1295 m_gal->SetIsFill(
false );
1296 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
1297 : m_schSettings.GetDanglingIndicatorThickness() );
1299 m_gal->DrawRectangle( aPos - radius, aPos + radius );
1307 if( m_schSettings.IsPrinting() && drawingShadows )
1317 if( junctionSize > 1 )
1319 m_gal->SetIsStroke( drawingShadows );
1320 m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
1321 m_gal->SetStrokeColor(
color );
1322 m_gal->SetIsFill( !drawingShadows );
1323 m_gal->SetFillColor(
color );
1324 m_gal->DrawCircle( aJct->
GetPosition(), junctionSize );
1329void SCH_PAINTER::draw(
const SCH_LINE* aLine,
int aLayer )
1333 if( m_schSettings.IsPrinting() && drawingShadows )
1344 if( aLine->
IsNew() && drawingDangling )
1348 float width = getLineWidth( aLine, drawingShadows );
1351 if( ( drawingDangling || drawingShadows ) && !aLine->
IsNew() )
1380 if( drawingDangling )
1385 int textSize = getOperatingPointTextSize();
1387 int textOffset =
KiROUND( textSize * 0.22 );
1392 pos.
y -= textOffset;
1398 pos.
x +=
KiROUND( textOffset * 1.2 );
1414 m_gal->SetIsStroke(
true );
1415 m_gal->SetStrokeColor(
color );
1416 m_gal->SetLineWidth( width );
1431 m_gal->DrawLine( a+1, b );
1433 m_gal->DrawLine( a, b );
1439void SCH_PAINTER::draw(
const SCH_SHAPE* aShape,
int aLayer,
bool aDimmed )
1441 if( !isUnitAndConversionShown( aShape ) )
1444 if( aShape->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1449 if( m_schSettings.IsPrinting() && drawingShadows )
1453 COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows );
1461 switch( shape->GetShape() )
1465 VECTOR2D start = shape->GetStart();
1474 EDA_ANGLE angle1 = midAngle - startAngle;
1479 m_gal->DrawArc( center, ( start - center ).EuclideanNorm(), startAngle, angle );
1484 m_gal->DrawCircle( shape->GetPosition(), shape->GetRadius() );
1488 m_gal->DrawRectangle( shape->GetPosition(), shape->GetEnd() );
1493 const std::vector<SHAPE*> polySegments = shape->MakeEffectiveShapes(
true );
1495 if( !polySegments.empty() )
1497 std::deque<VECTOR2D> pts;
1499 for(
SHAPE* polySegment : polySegments )
1500 pts.push_back(
static_cast<SHAPE_SEGMENT*
>( polySegment )->GetSeg().
A );
1505 for(
SHAPE* polySegment : polySegments )
1508 m_gal->DrawPolygon( pts );
1515 m_gal->DrawCurve( shape->GetStart(), shape->GetBezierC1(),
1516 shape->GetBezierC2(), shape->GetEnd() );
1527 if(
eeconfig()->m_Selection.fill_shapes )
1532 m_gal->SetIsFill( aShape->
IsFilled() );
1534 m_gal->SetIsFill(
true );
1536 m_gal->SetIsStroke(
false );
1537 m_gal->SetFillColor(
color );
1541 m_gal->SetIsStroke(
true );
1542 m_gal->SetIsFill(
false );
1543 m_gal->SetLineWidth( getLineWidth( aShape,
true ) );
1544 m_gal->SetStrokeColor(
color );
1547 drawShape( aShape );
1563 if( !m_schSettings.PrintBlackAndWhiteReq() )
1565 m_gal->SetIsFill(
true );
1566 m_gal->SetIsStroke(
false );
1567 m_gal->SetFillColor(
color );
1569 drawShape( aShape );
1580 m_gal->SetIsFill(
true );
1581 m_gal->SetIsStroke(
false );
1582 m_gal->SetFillColor(
color );
1584 drawShape( aShape );
1587 float lineWidth = getLineWidth( aShape, drawingShadows );
1591 m_gal->SetIsFill(
false );
1592 m_gal->SetIsStroke(
true );
1593 m_gal->SetLineWidth( lineWidth );
1594 m_gal->SetStrokeColor(
color );
1598 drawShape( aShape );
1604 for(
SHAPE* shape : shapes )
1611 m_gal->DrawLine( a+1, b );
1613 m_gal->DrawLine( a, b );
1617 for(
SHAPE* shape : shapes )
1625void SCH_PAINTER::draw(
const SCH_TEXT* aText,
int aLayer,
bool aDimmed )
1627 if( !isUnitAndConversionShown( aText ) )
1630 if( aText->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1635 if( m_schSettings.IsPrinting() && drawingShadows )
1641 switch( aText->
Type() )
1653 COLOR4D color = getRenderColor( aText, aLayer, drawingShadows, aDimmed );
1662 if( conn && conn->
IsBus() )
1668 if( m_schSettings.m_IsSymbolEditor ||
eeconfig()->m_Appearance.show_hidden_fields )
1674 m_gal->SetStrokeColor(
color );
1675 m_gal->SetFillColor(
color );
1685 if( drawingShadows && font->
IsOutline() )
1690 m_gal->SetIsStroke(
false );
1691 m_gal->SetIsFill(
true );
1703 double shadowOffset = 0.0;
1705 if( drawingShadows )
1707 double shadowWidth = getShadowWidth( !aText->
IsSelected() );
1710 const double adjust = 1.2f;
1711 shadowOffset = shadowWidth/2.0f * adjust;
1725 pos.
y = bBox.
GetTop() - shadowOffset;
1728 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
1737 pos.
x = bBox.
GetLeft() - shadowOffset;
1746 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
1757 else if( drawingShadows )
1759 m_gal->SetIsFill(
false );
1760 m_gal->SetIsStroke(
true );
1770 text_offset.
x -= fudge;
1772 text_offset.
y -= fudge;
1774 text_offset.
x += fudge;
1776 text_offset.
y += fudge;
1784 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1785 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1795 int adjust =
KiROUND( sizeDiff * 0.4 );
1796 VECTOR2I adjust_offset( 0, - adjust );
1799 text_offset += adjust_offset;
1802 if( nonCached( aText )
1804 && !shownText.Contains( wxT(
"\n" ) ) )
1806 bitmapText( shownText, aText->
GetDrawPos() + text_offset, attrs );
1811 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
1819 m_gal->DrawGlyphs( *cache );
1823 strokeText( shownText, aText->
GetDrawPos() + text_offset, attrs,
1836 switch( aText->
Type() )
1844 showAnchor = !
static_cast<const SCH_LABEL*
>( aText )->IsDangling();
1861 drawAnchor( aText->
GetPosition(), drawingShadows );
1866void SCH_PAINTER::draw(
const SCH_TEXTBOX* aTextBox,
int aLayer,
bool aDimmed )
1876 if( !isUnitAndConversionShown( aTextBox ) )
1879 if( aTextBox->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1884 if( m_schSettings.IsPrinting() && drawingShadows )
1887 COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows, aDimmed );
1889 float borderWidth = getLineWidth( aTextBox, drawingShadows );
1903 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1904 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1908 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
1916 m_gal->DrawGlyphs( *cache );
1920 strokeText( shownText, aTextBox->
GetDrawPos(), attrs,
1928 m_gal->SetFillColor(
color );
1929 m_gal->SetStrokeColor(
color );
1933 m_gal->SetIsFill(
true );
1934 m_gal->SetIsStroke(
false );
1935 m_gal->SetLineWidth( borderWidth );
1943 if( aTextBox->
IsFilled() && !m_schSettings.PrintBlackAndWhiteReq() )
1945 m_gal->SetIsFill(
true );
1946 m_gal->SetIsStroke(
false );
1947 m_gal->SetLineWidth( borderWidth );
1962 if( m_schSettings.m_OverrideItemColors || aTextBox->
IsBrightened()
1965 borderColor = m_schSettings.GetLayerColor( aLayer );
1968 if( transparency > 0.0 )
1969 borderColor = borderColor.
WithAlpha( borderColor.
a * ( 1.0 - transparency ) );
1973 borderColor = borderColor.
Mix( bg, 0.5f );
1977 m_gal->SetIsFill(
false );
1978 m_gal->SetIsStroke(
true );
1979 m_gal->SetStrokeColor( borderColor );
1980 m_gal->SetLineWidth( borderWidth );
1990 for(
SHAPE* shape : shapes )
1998 m_gal->DrawLine( a+1, b );
2000 m_gal->DrawLine( a, b );
2004 for(
SHAPE* shape : shapes )
2012void SCH_PAINTER::draw(
const SCH_TABLE* aTable,
int aLayer,
bool aDimmed )
2015 draw( cell, aLayer, aDimmed );
2030 lineWidth = stroke.GetWidth();
2031 color = stroke.GetColor();
2032 lineStyle = stroke.GetLineStyle();
2034 if( lineWidth == 0 )
2035 lineWidth = m_schSettings.GetDefaultPenWidth();
2043 m_gal->SetIsFill(
false );
2044 m_gal->SetIsStroke(
true );
2045 m_gal->SetStrokeColor(
color );
2046 m_gal->SetLineWidth( (
float) lineWidth );
2050 [&](
const SHAPE& shape )
2057 m_gal->DrawLine( a+1, b );
2059 m_gal->DrawLine( a, b );
2068 m_gal->DrawLine( ptA, ptB );
2082 m_gal->DrawRectangle( ptA, ptB );
2087 strokeShape( rect );
2097 for(
int col = 0; col < aTable->
GetColCount() - 1; ++col )
2099 for(
int row = 0; row < aTable->
GetRowCount(); ++row )
2105 strokeLine( topRight, cell->
GetEnd() );
2112 for(
int row = 0; row < aTable->
GetRowCount() - 1; ++row )
2114 for(
int col = 0; col < aTable->
GetColCount(); ++col )
2120 strokeLine( botLeft, cell->
GetEnd() );
2137 strokeRect( pos, end );
2142wxString SCH_PAINTER::expandLibItemTextVars(
const wxString& aSourceText,
2145 std::function<bool( wxString* )> symbolResolver =
2146 [&]( wxString* token ) ->
bool
2148 return aSymbolContext->
ResolveTextVar( &m_schematic->CurrentSheet(), token );
2158 bool DNP = aSymbol->
GetDNP();
2162 if( m_schSettings.IsPrinting() && drawingShadows )
2165 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2168 draw( &field, aLayer, DNP || markExclusion );
2186 std::vector<SCH_PIN*> originalPins = originalSymbol->
GetPins( unit, bodyStyle );
2190 std::vector<SCH_PIN*> tempPins = tempSymbol.
GetPins( unit, bodyStyle );
2198 tempItem.SetFlags( aSymbol->
GetFlags() );
2206 textItem->
SetText( expandLibItemTextVars( textItem->
GetText(), aSymbol ) );
2213 textboxItem->
SetText( expandLibItemTextVars( textboxItem->
GetText(), aSymbol ) );
2218 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2221 SCH_PIN* tempPin = tempPins[ i ];
2240 DNP || markExclusion );
2242 for(
unsigned i = 0; i < tempPins.size(); ++i )
2245 SCH_PIN* tempPin = tempPins[ i ];
2253 if( DNP || markExclusion )
2262 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2263 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2270 m_gal->AdvanceDepth();
2271 m_gal->SetIsStroke(
true );
2272 m_gal->SetIsFill(
true );
2273 m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ) );
2274 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ) );
2276 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2277 std::swap( pt1.
x, pt2.
x );
2278 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2284void SCH_PAINTER::draw(
const SCH_FIELD* aField,
int aLayer,
bool aDimmed )
2288 if( m_schSettings.IsPrinting() && drawingShadows )
2294 if( !isUnitAndConversionShown( aField ) )
2301 bool foundLayer =
false;
2305 for(
int i = 0; i < layers_count; ++i )
2307 if( layers[i] == aLayer )
2316 COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
2321 : m_schSettings.m_ShowHiddenFields;
2331 if( shownText.IsEmpty() )
2367 if( m_schSettings.GetDrawBoundingBoxes() )
2368 drawItemBoundingBox( aField );
2370 m_gal->SetStrokeColor(
color );
2371 m_gal->SetFillColor(
color );
2373 if( drawingShadows && getFont( aField )->IsOutline() )
2375 BOX2I shadow_box = bbox;
2378 m_gal->SetIsStroke(
false );
2379 m_gal->SetIsFill(
true );
2392 if( drawingShadows )
2397 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2398 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2402 if( nonCached( aField ) && aField->
RenderAsBitmap( m_gal->GetWorldScale() ) )
2404 bitmapText( shownText, textpos, attributes );
2409 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2412 cache = aField->
GetRenderCache( shownText, textpos, attributes );
2417 m_gal->DrawGlyphs( *cache );
2421 strokeText( shownText, textpos, attributes, aField->
GetFontMetrics() );
2429 if( aField->
IsMoving() && m_schematic )
2433 m_gal->SetLineWidth( m_schSettings.GetOutlineWidth() );
2435 m_gal->DrawLine( aField->
GetPosition(), parentPos );
2439 drawAnchor( aField->
GetPosition(), drawingShadows );
2448 if( m_schSettings.IsPrinting() && drawingShadows )
2453 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2456 draw( &field, aLayer,
false );
2467 if( drawingDangling )
2479 std::vector<VECTOR2I> pts;
2480 std::deque<VECTOR2D> pts2;
2485 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2487 m_gal->SetIsStroke(
true );
2488 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2489 m_gal->SetStrokeColor(
color );
2491 if( drawingShadows )
2493 m_gal->SetIsFill(
eeconfig()->m_Selection.fill_shapes );
2494 m_gal->SetFillColor(
color );
2495 m_gal->DrawPolygon( pts2 );
2499 m_gal->SetIsFill(
false );
2500 m_gal->DrawPolyline( pts2 );
2503 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2507void SCH_PAINTER::draw(
const SCH_LABEL* aLabel,
int aLayer )
2511 if( m_schSettings.IsPrinting() && drawingShadows )
2516 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2519 draw( &field, aLayer,
false );
2530 if( drawingDangling )
2542 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2550 if( m_schSettings.IsPrinting() && drawingShadows )
2555 if( !( drawingShadows || drawingDangling ) ||
eeconfig()->m_Selection.draw_selected_children )
2558 draw( &field, aLayer,
false );
2569 if( drawingDangling )
2588 if( conn && conn->
IsBus() )
2589 color = getRenderColor( aLabel,
LAYER_BUS, drawingShadows, aDimmed );
2592 std::vector<VECTOR2I> pts;
2593 std::deque<VECTOR2D> pts2;
2598 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2600 m_gal->SetIsFill(
true );
2602 m_gal->SetIsStroke(
true );
2603 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2604 m_gal->SetStrokeColor(
color );
2605 m_gal->DrawPolyline( pts2 );
2607 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2618 if( m_schSettings.IsPrinting() && drawingShadows )
2621 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2624 draw( &field, aLayer,
false );
2647 std::vector<VECTOR2I> pts;
2648 std::deque<VECTOR2D> pts2;
2653 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2655 m_gal->SetIsFill(
false );
2656 m_gal->SetFillColor(
color );
2657 m_gal->SetIsStroke(
true );
2658 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2659 m_gal->SetStrokeColor(
color );
2663 m_gal->DrawLine( pts2[0], pts2[1] );
2664 m_gal->SetIsFill(
true );
2665 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).EuclideanNorm() );
2669 m_gal->DrawLine( pts2[0], pts2[1] );
2670 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).EuclideanNorm() );
2674 m_gal->DrawPolyline( pts2 );
2679void SCH_PAINTER::draw(
const SCH_SHEET* aSheet,
int aLayer )
2682 bool DNP = aSheet->
GetDNP();
2686 if( m_schSettings.IsPrinting() && drawingShadows )
2689 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2692 draw( &field, aLayer, DNP || markExclusion );
2695 draw(
static_cast<SCH_HIERLABEL*
>( sheetPin ), aLayer, DNP || markExclusion );
2708 if( !m_schSettings.PrintBlackAndWhiteReq() )
2711 m_gal->SetIsFill(
true );
2712 m_gal->SetIsStroke(
false );
2714 m_gal->DrawRectangle( pos, pos + size );
2720 m_gal->SetStrokeColor( getRenderColor( aSheet,
LAYER_SHEET, drawingShadows ) );
2721 m_gal->SetIsStroke(
true );
2722 m_gal->SetLineWidth( getLineWidth( aSheet, drawingShadows ) );
2723 m_gal->SetIsFill(
false );
2725 m_gal->DrawRectangle( pos, pos + size );
2728 if( DNP || markExclusion )
2737 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2738 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2745 m_gal->AdvanceDepth();
2746 m_gal->SetIsStroke(
true );
2747 m_gal->SetIsFill(
true );
2748 m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ) );
2749 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ) );
2751 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2752 std::swap( pt1.
x, pt2.
x );
2753 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2763 if( m_schSettings.IsPrinting() && drawingShadows )
2769 m_gal->SetIsStroke(
true );
2770 m_gal->SetLineWidth( getLineWidth( aNC, drawingShadows ) );
2771 m_gal->SetStrokeColor( getRenderColor( aNC,
LAYER_NOCONNECT, drawingShadows ) );
2772 m_gal->SetIsFill(
false );
2775 int delta = std::max( aNC->
GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
2788 if( m_schSettings.IsPrinting() && drawingShadows )
2815 if( drawingDangling )
2817 m_gal->SetIsFill(
false );
2818 m_gal->SetIsStroke(
true );
2819 m_gal->SetStrokeColor(
color.Brightened( 0.3 ) );
2820 m_gal->SetLineWidth( m_schSettings.GetDanglingIndicatorThickness() );
2830 m_gal->DrawCircle( aEntry->
GetEnd(),
2839 draw( &line, aLayer );
2853 if( img_scale != 1.0 )
2854 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
2858 m_gal->DrawBitmap( *aBitmap->
GetImage() );
2866 m_gal->SetIsStroke(
true );
2867 m_gal->SetStrokeColor(
color );
2868 m_gal->SetLineWidth ( getShadowWidth( aBitmap->
IsBrightened() ) );
2869 m_gal->SetIsFill(
false );
2876 bm_size.
x /= img_scale;
2877 bm_size.
y /= img_scale;
2878 VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
2881 m_gal->DrawRectangle( origin, end );
2893 if( m_schSettings.IsPrinting() && drawingShadows )
2903 m_gal->SetIsFill( !drawingShadows );
2904 m_gal->SetFillColor(
color );
2905 m_gal->SetIsStroke( drawingShadows );
2906 m_gal->SetLineWidth( getLineWidth( aMarker, drawingShadows ) );
2907 m_gal->SetStrokeColor(
color );
2912 m_gal->DrawPolygon( polygon );
constexpr EDA_IU_SCALE schIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
const Vec & GetPosition() const
const Vec & GetOrigin() const
void Offset(coord_type dx, coord_type dy)
size_type GetHeight() const
void SetX(coord_type val)
void SetY(coord_type val)
coord_type GetTop() const
size_type GetWidth() const
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
coord_type GetRight() const
coord_type GetLeft() const
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.
coord_type GetBottom() const
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
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.
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.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr)
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.
Abstract interface for drawing on a 2D-surface.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
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)
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
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.
void SetGlyphSize(const VECTOR2I aSize)
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.
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
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.
COLOR4D getRenderColor(const SCH_ITEM *aItem, int aLayer, bool aDrawingShadows, bool aDimmed=false) const
float getShadowWidth(bool aForHighlight) const
KIFONT::FONT * getFont(const EDA_TEXT *aText) const
void draw(const EDA_ITEM *, int, bool aDimmed)
static std::vector< KICAD_T > g_ScaledSelectionTypes
SCH_RENDER_SETTINGS m_schSettings
bool nonCached(const EDA_ITEM *aItem)
void drawItemBoundingBox(const EDA_ITEM *aItem)
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
static constexpr int VIEW_MAX_LAYERS
Rendering order modifier for layers that are marked as top layers.
Define a library symbol object.
std::vector< SCH_PIN * > GetPins(int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
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 AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
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.
Object to handle a bitmap image that can be inserted in a schematic.
double GetImageScale() const
VECTOR2I GetPosition() const override
BITMAP_BASE * GetImage() const
Base class for a bus or wire entry.
LINE_STYLE GetLineStyle() const
VECTOR2I GetPosition() const override
bool IsDanglingStart() const
virtual STROKE_PARAMS GetStroke() const override
bool IsDanglingEnd() const
int GetPenWidth() const override
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.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
VECTOR2I GetPosition() const override
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) 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...
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
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
bool RenderAsBitmap(double aWorldScale) const override
bool IsConnectivityDirty() const
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
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
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)
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
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
wxString GetShownNumber() 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
wxString GetElectricalTypeName() const
bool IsDangling() const override
PIN_ORIENTATION GetOrientation() const
void SetShape(GRAPHIC_PINSHAPE aShape)
VECTOR2I GetPosition() const override
int GetNameTextSize() const
wxString GetShownName() const
void SetOperatingPoint(const wxString &aText)
void SetType(ELECTRICAL_PINTYPE aType)
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
bool m_OverrideItemColors
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()
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
Set or clear the 'Do Not Populate' flaga.
KIGFX::COLOR4D GetBackgroundColor() const
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.
TRANSFORM & GetTransform()
int GetOrientation() const
Get the display symbol orientation.
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
BOX2I GetBodyAndPinsBoundingBox() const
Return a bounding box for the symbol body and pins but not the fields.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
BOX2I GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the pins or fields.
const STROKE_PARAMS & GetSeparatorsStroke() const
bool StrokeExternal() const
std::vector< SCH_TABLECELL * > GetCells() const
const STROKE_PARAMS & GetBorderStroke() const
VECTOR2I GetPosition() const override
SCH_TABLECELL * GetCell(int aRow, int aCol) const
bool StrokeColumns() const
bool StrokeHeader() 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.
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
void Fracture(POLYGON_MODE aFastMode)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
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.
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.
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)
A base class for LIB_SYMBOL and SCH_SYMBOL.
int GetPinNameOffset() const
bool GetDNP() const
Set or clear the 'Do Not Populate' flaga.
virtual bool GetShowPinNames() const
virtual bool GetShowPinNumbers() const
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)
#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
#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.
@ ARC
use RECTANGLE instead of RECT to avoid collision in a Windows header
@ FILLED_WITH_BG_BODYCOLOR
int GetPenSizeForDemiBold(int aTextSize)
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
@ LAYER_DRAW_BITMAPS
to handle and draw images bitmaps
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_EXCLUDED_FROM_SIM
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SELECTION_SHADOWS
@ LAYER_SCHEMATIC_BACKGROUND
#define UNIMPLEMENTED_FOR(type)
The Cairo implementation of the graphics abstraction layer.
static LIB_SYMBOL * dummy()
Used when a LIB_SYMBOL is not found in library to draw a dummy shape.
EESCHEMA_SETTINGS * eeconfig()
static bool isFieldsLayer(int aLayer)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ OUTSIDE
Text appears outside the dimension line (default)
@ PT_NC
not connected (must be left open)
#define TARGET_BUSENTRY_RADIUS
#define BITMAP_FONT_SIZE_THRESHOLD
static int externalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
static int internalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
#define TARGET_PIN_RADIUS
std::vector< FAB_LAYER_COLOR > dummy
LINE_STYLE
Dashed line types.
constexpr int MilsToIU(int mils) const
constexpr int mmToIU(double mm) const
@ 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 ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D