135 m_schematic( nullptr )
146 draw( item, aLayer,
false );
154#ifdef CONNECTIVITY_DEBUG
156 auto sch_item =
dynamic_cast<const SCH_ITEM*
>( aItem );
157 auto conn = sch_item ? sch_item->
Connection( *g_CurrentSheet ) :
nullptr;
162 auto label = conn->Name(
true );
169 m_gal->StrokeText( conn->Name(
true ), pos, 0.0, 0 );
177 switch( aItem->
Type() )
183 drawBoundingBox =
false;
184 draw(
static_cast<const SCH_PIN*
>( aItem ), aLayer, aDimmed );
196 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
199 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
202 draw(
static_cast<const SCH_TEXT*
>( aItem ), aLayer, aDimmed );
208 draw(
static_cast<const SCH_TABLE*
>( aItem ), aLayer, aDimmed );
217 draw(
static_cast<const SCH_FIELD*
>( aItem ), aLayer, aDimmed );
250 if( drawBoundingBox )
266 box =
static_cast<const SCH_SYMBOL*
>( aItem )->GetBodyBoundingBox();
271 :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
338 color =
static_cast<const SCH_LINE*
>( aItem )->GetLineColor();
368 if( isSymbolChild && shape->
GetFillMode() == FILL_T::FILLED_SHAPE )
409 else if(
const EDA_TEXT* otherTextItem =
dynamic_cast<const EDA_TEXT*
>( aItem ) )
412 color = otherTextItem->GetTextColor();
417 color = m_schSettings.GetLayerColor( aLayer );
419 if( aItem->IsBrightened() )
423 if( aDrawingShadows )
425 if( aItem->IsSelected() )
435 else if( aItem->IsSelected() && aDrawingShadows )
437 if( aDrawingShadows )
448 if( m_schSettings.m_ShowDisabled
449 || ( m_schSettings.m_ShowGraphicsDisabled && aItem->Type() !=
SCH_FIELD_T ) )
454 if( aDimmed && !( aItem->IsSelected() && aDrawingShadows ) )
461 if( aItem->GetForcedTransparency() > 0.0 )
462 color =
color.WithAlpha(
color.a * ( 1.0 - aItem->GetForcedTransparency() ) );
468float SCH_PAINTER::getLineWidth(
const SCH_ITEM* aItem,
bool aDrawingShadows )
const
477 if( aDrawingShadows && aItem->
IsType( g_ScaledSelectionTypes ) )
485float SCH_PAINTER::getTextThickness(
const SCH_ITEM* aItem )
const
487 int pen = m_schSettings.GetDefaultPenWidth();
489 switch( aItem->
Type() )
492 pen =
static_cast<const SCH_FIELD*
>( aItem )->GetEffectiveTextPenWidth( pen );
496 pen =
static_cast<const SCH_TEXT*
>( aItem )->GetEffectiveTextPenWidth( pen );
504 pen =
static_cast<const SCH_LABEL_BASE*
>( aItem )->GetEffectiveTextPenWidth( pen );
509 pen =
static_cast<const SCH_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth( pen );
520int SCH_PAINTER::getOperatingPointTextSize()
const
523 int screenTextSize =
std::abs( (
int) m_gal->GetScreenWorldMatrix().GetScale().y * 7 );
526 return KiROUND( ( docTextSize + screenTextSize * 2 ) / 3 );
533#define MAP_COORDS( aCoord ) VECTOR2D( aCoord.x, invertY ? -aCoord.y : aCoord.y )
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,
633 bool invertY = aInvertY;
670 m_gal->SetIsFill(
true );
671 m_gal->SetIsStroke(
false );
678 m_gal->DrawLine( a, b );
679 m_gal->DrawLine( b, c );
683void SCH_PAINTER::draw(
const LIB_SYMBOL* aSymbol,
int aLayer,
bool aDrawFields,
int aUnit,
684 int aBodyStyle,
bool aDimmed )
687 aUnit = m_schSettings.m_ShowUnit;
690 aBodyStyle = m_schSettings.m_ShowBodyStyle;
692 std::unique_ptr< LIB_SYMBOL > tmpSymbol;
697 tmpSymbol = aSymbol->
Flatten();
698 drawnSymbol = tmpSymbol.get();
704 [](
const SCH_ITEM& item,
int layer )
706 int layers[512], layers_count;
709 for(
int ii = 0; ii < layers_count; ++ii )
711 if( layers[ii] == layer )
723 if( !childOnLayer( item, aLayer ) )
732 draw( &item, aLayer, aDimmed );
737bool SCH_PAINTER::setDeviceColors(
const SCH_ITEM* aItem,
int aLayer,
bool aDimmed )
747 m_gal->SetIsFill(
false );
748 m_gal->SetIsStroke(
true );
749 m_gal->SetLineWidth( getLineWidth( aItem,
true ) );
750 m_gal->SetStrokeColor( getRenderColor( aItem,
LAYER_DEVICE,
true, aDimmed ) );
751 m_gal->SetFillColor( getRenderColor( aItem,
LAYER_DEVICE,
true, aDimmed ) );
767 m_gal->SetIsFill(
true );
769 m_gal->SetIsStroke(
false );
783 m_gal->SetFillColor( getRenderColor( aItem,
LAYER_DEVICE,
false, aDimmed ) );
790 if( transparency > 0.0 )
791 fillColour = fillColour.
WithAlpha( fillColour.
a * ( 1.0 - transparency ) );
793 if( m_schSettings.m_OverrideItemColors )
799 fillColour = fillColour.
Mix( bg, 0.5f );
803 m_gal->SetFillColor( fillColour );
808 m_gal->SetIsStroke(
true );
809 m_gal->SetLineWidth( getLineWidth( aItem,
false ) );
810 m_gal->SetStrokeColor( getRenderColor( aItem, aLayer,
false, aDimmed ) );
814 m_gal->SetIsStroke(
false );
825int SCH_PAINTER::internalPinDecoSize(
const SCH_PIN &aPin )
827 if( m_schSettings.m_PinSymbolSize > 0 )
828 return m_schSettings.m_PinSymbolSize;
836int SCH_PAINTER::externalPinDecoSize(
const SCH_PIN &aPin )
838 if( m_schSettings.m_PinSymbolSize > 0 )
839 return m_schSettings.m_PinSymbolSize;
846void SCH_PAINTER::drawPinDanglingIndicator(
const VECTOR2I& aPos,
const COLOR4D& aColor,
847 bool aDrawingShadows,
bool aBrightened )
851 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
853 m_gal->SetIsFill(
false );
854 m_gal->SetIsStroke(
true );
855 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
856 : m_schSettings.GetDanglingIndicatorThickness() );
862void SCH_PAINTER::draw(
const SCH_PIN* aPin,
int aLayer,
bool aDimmed )
864 if( !isUnitAndConversionShown( aPin ) )
869 if( m_schSettings.IsPrinting() && drawingShadows )
885 if( m_schSettings.IsPrinting() )
889 : m_schSettings.m_ShowHiddenPins;
904 if( drawingDangling )
912 if( m_schSettings.GetDrawBoundingBoxes() )
913 drawItemBoundingBox( aPin );
946 int textSize = getOperatingPointTextSize();
948 int textOffset =
KiROUND( textSize * 0.22 );
955 mid.
x +=
KiROUND( textOffset * 1.2 );
960 mid.
y -=
KiROUND( textOffset * 1.2 );
981 m_gal->SetIsStroke(
true );
982 m_gal->SetIsFill(
false );
983 m_gal->SetLineWidth( getLineWidth( aPin, drawingShadows ) );
984 m_gal->SetStrokeColor(
color );
985 m_gal->SetFontBold(
false );
986 m_gal->SetFontUnderlined(
false );
987 m_gal->SetFontItalic(
false );
990 const int diam = radius*2;
995 m_gal->DrawLine( p0, pos );
1008 m_gal->DrawLine( p0, pos );
1012 m_gal->DrawCircle( p0 + dir * radius, radius );
1013 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1017 pc = p0 - dir * clock_size ;
1019 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1021 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1023 m_gal->DrawCircle( p0 + dir * radius, radius );
1024 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1029 pc = p0 - dir * clock_size ;
1031 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1033 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1037 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1043 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1048 m_gal->DrawLine( p0, pos );
1052 m_gal->DrawLine( p0, pos );
1056 triLine( p0 +
VECTOR2D( 0, clock_size ),
1057 p0 +
VECTOR2D( -dir.
x * clock_size, 0 ),
1062 triLine( p0 +
VECTOR2D( clock_size, 0 ),
1063 p0 +
VECTOR2D( 0, -dir.
y * clock_size ),
1069 m_gal->DrawLine( p0, pos );
1073 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1079 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1086 m_gal->DrawLine( p0, pos );
1095 m_gal->DrawLine( p0, pos );
1097 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius,
1098 p0 +
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius );
1099 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius,
1100 p0 +
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius );
1105 if( drawingShadows && !
eeconfig()->m_Selection.draw_selected_children )
1110 float penWidth = (float) m_schSettings.GetDefaultPenWidth();
1112 float nameStrokeWidth = getLineWidth( aPin,
false );
1113 float numStrokeWidth = getLineWidth( aPin,
false );
1115 bool showPinNumbers = m_schSettings.m_ShowPinNumbers || symbol->
GetShowPinNumbers();
1123 enum { INSIDE = 0,
OUTSIDE, ABOVE, BELOW };
1124 int size[4] = { 0, 0, 0, 0 };
1125 float thickness[4] = { numStrokeWidth, numStrokeWidth, numStrokeWidth, numStrokeWidth };
1133 thickness[INSIDE] = nameStrokeWidth;
1134 colour [INSIDE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1138 thickness[ABOVE] = numStrokeWidth;
1139 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1143 else if( showPinNames && showPinNumbers )
1146 thickness[ABOVE] = nameStrokeWidth;
1147 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1151 thickness[BELOW] = numStrokeWidth;
1152 colour [BELOW] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1155 else if( showPinNames )
1158 thickness[ABOVE] = nameStrokeWidth;
1159 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1162 else if( showPinNumbers )
1165 thickness[ABOVE] = numStrokeWidth;
1166 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1170 if( m_schSettings.m_ShowPinsElectricalType )
1182 #define BITMAP_FONT_SIZE_THRESHOLD 3.5
1192 c = getRenderColor( aPin,
LAYER_HIDDEN, drawingShadows, aDimmed );
1195 float insideOffset = (float) textOffset - thickness[INSIDE] / 2.0f;
1197 float aboveOffset =
PIN_TEXT_MARGIN + penWidth / 2.0f + thickness[ABOVE] / 2.0f;
1198 float belowOffset =
PIN_TEXT_MARGIN + penWidth / 2.0f + thickness[BELOW] / 2.0f;
1203 if( drawingShadows )
1205 float shadowWidth = getShadowWidth( aPin->
IsBrightened() );
1207 for(
float& t : thickness )
1217 const float adjust = 1.2f;
1218 float shadowOffset = shadowWidth/2.0f * adjust;
1219 insideOffset -= shadowOffset;
1220 outsideOffset -= shadowOffset;
1228 if(
text[i].IsEmpty() )
1232 m_gal->SetStrokeColor( colour[i] );
1233 m_gal->SetFillColor( colour[i] );
1247 else if( drawingShadows )
1251 else if( nonCached( aPin ) && renderTextAsBitmap )
1253 bitmapText(
text[i], aPos, attrs );
1268 drawText( INSIDE, pos +
VECTOR2D( -insideOffset - (
float) len, 0 ),
1278 drawText( ABOVE, pos +
VECTOR2D( -len / 2.0, -aboveOffset ),
1283 drawText( BELOW, pos +
VECTOR2D( -len / 2.0, belowOffset ),
1291 drawText( INSIDE, pos +
VECTOR2D( insideOffset + (
float) len, 0 ),
1301 drawText( ABOVE, pos +
VECTOR2D( len / 2.0, -aboveOffset ),
1306 drawText( BELOW, pos +
VECTOR2D( len / 2.0, belowOffset ),
1314 drawText( INSIDE, pos +
VECTOR2D( 0, insideOffset + (
float) len ),
1324 drawText( ABOVE, pos +
VECTOR2D( -aboveOffset, len / 2.0 ),
1329 drawText( BELOW, pos +
VECTOR2D( belowOffset, len / 2.0 ),
1337 drawText( INSIDE, pos +
VECTOR2D( 0, -insideOffset - (
float) len ),
1347 drawText( ABOVE, pos +
VECTOR2D( -aboveOffset, -len / 2.0 ),
1352 drawText( BELOW, pos +
VECTOR2D( belowOffset, -len / 2.0 ),
1358 wxFAIL_MSG(
"Unknown pin orientation" );
1365void SCH_PAINTER::drawDanglingIndicator(
const VECTOR2I& aPos,
const COLOR4D& aColor,
int aWidth,
1366 bool aDangling,
bool aDrawingShadows,
bool aBrightened )
1368 if( m_schSettings.IsPrinting() )
1381 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
1382 m_gal->SetIsStroke(
true );
1383 m_gal->SetIsFill(
false );
1384 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
1385 : m_schSettings.GetDanglingIndicatorThickness() );
1387 m_gal->DrawRectangle( aPos - radius, aPos + radius );
1395 if( m_schSettings.IsPrinting() && drawingShadows )
1405 if( junctionSize > 1 )
1407 m_gal->SetIsStroke( drawingShadows );
1408 m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
1409 m_gal->SetStrokeColor(
color );
1410 m_gal->SetIsFill( !drawingShadows );
1411 m_gal->SetFillColor(
color );
1412 m_gal->DrawCircle( aJct->
GetPosition(), junctionSize );
1417void SCH_PAINTER::draw(
const SCH_LINE* aLine,
int aLayer )
1421 if( m_schSettings.IsPrinting() && drawingShadows )
1432 if( aLine->
IsNew() && drawingDangling )
1436 float width = getLineWidth( aLine, drawingShadows );
1439 if( ( drawingDangling || drawingShadows ) && !aLine->
IsNew() )
1468 if( drawingDangling )
1473 int textSize = getOperatingPointTextSize();
1475 int textOffset =
KiROUND( textSize * 0.22 );
1480 pos.
y -= textOffset;
1486 pos.
x +=
KiROUND( textOffset * 1.2 );
1502 m_gal->SetIsStroke(
true );
1503 m_gal->SetStrokeColor(
color );
1504 m_gal->SetLineWidth( width );
1519 m_gal->DrawLine( a+1, b );
1521 m_gal->DrawLine( a, b );
1527void SCH_PAINTER::draw(
const SCH_SHAPE* aShape,
int aLayer,
bool aDimmed )
1529 if( !isUnitAndConversionShown( aShape ) )
1532 if( aShape->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1537 if( m_schSettings.IsPrinting() && drawingShadows )
1541 COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows );
1550 switch( shape->GetShape() )
1563 EDA_ANGLE angle1 = midAngle - startAngle;
1568 m_gal->DrawArc( center, ( start - center ).
EuclideanNorm(), startAngle, angle );
1573 m_gal->DrawCircle(
MAP_COORDS( shape->GetPosition() ), shape->GetRadius() );
1577 m_gal->DrawRectangle(
MAP_COORDS( shape->GetPosition() ),
1583 const std::vector<SHAPE*> polySegments = shape->MakeEffectiveShapes(
true );
1584 std::deque<VECTOR2D> mappedPts;
1586 for(
SHAPE* polySegment : polySegments )
1595 for(
SHAPE* polySegment : polySegments )
1598 m_gal->DrawPolygon( mappedPts );
1604 m_gal->DrawCurve(
MAP_COORDS( shape->GetStart() ),
1618 if(
eeconfig()->m_Selection.fill_shapes )
1623 m_gal->SetIsFill( aShape->
IsFilled() );
1625 m_gal->SetIsFill(
true );
1627 m_gal->SetIsStroke(
false );
1628 m_gal->SetFillColor(
color );
1632 m_gal->SetIsStroke(
true );
1633 m_gal->SetIsFill(
false );
1634 m_gal->SetLineWidth( getLineWidth( aShape,
true ) );
1635 m_gal->SetStrokeColor(
color );
1638 drawShape( aShape );
1643 if( aShape->
IsFilled() && !m_schSettings.PrintBlackAndWhiteReq() )
1648 m_gal->SetIsFill(
true );
1649 m_gal->SetIsStroke(
false );
1650 m_gal->SetFillColor(
color );
1652 drawShape( aShape );
1658 float lineWidth = getLineWidth( aShape, drawingShadows );
1662 m_gal->SetIsFill(
false );
1663 m_gal->SetIsStroke(
true );
1664 m_gal->SetLineWidth( lineWidth );
1665 m_gal->SetStrokeColor(
color );
1669 drawShape( aShape );
1675 for(
SHAPE* shape : shapes )
1688 for(
SHAPE* shape : shapes )
1696void SCH_PAINTER::draw(
const SCH_TEXT* aText,
int aLayer,
bool aDimmed )
1698 if( !isUnitAndConversionShown( aText ) )
1701 if( aText->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1706 if( m_schSettings.IsPrinting() && drawingShadows )
1712 switch( aText->
Type() )
1724 COLOR4D color = getRenderColor( aText, aLayer, drawingShadows, aDimmed );
1733 if( conn && conn->
IsBus() )
1739 if( m_schSettings.m_IsSymbolEditor ||
eeconfig()->m_Appearance.show_hidden_fields )
1745 m_gal->SetStrokeColor(
color );
1746 m_gal->SetFillColor(
color );
1757 if( drawingShadows && font->
IsOutline() )
1763 m_gal->SetIsStroke(
false );
1764 m_gal->SetIsFill(
true );
1776 double shadowOffset = 0.0;
1778 if( drawingShadows )
1780 double shadowWidth = getShadowWidth( !aText->
IsSelected() );
1783 const double adjust = 1.2f;
1784 shadowOffset = shadowWidth/2.0f * adjust;
1798 pos.
y = bBox.
GetTop() - shadowOffset;
1801 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
1810 pos.
x = bBox.
GetLeft() - shadowOffset;
1819 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
1830 else if( drawingShadows )
1832 m_gal->SetIsFill(
false );
1833 m_gal->SetIsStroke(
true );
1843 text_offset.
x -= fudge;
1845 text_offset.
y -= fudge;
1847 text_offset.
x += fudge;
1849 text_offset.
y += fudge;
1857 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1858 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1868 int adjust =
KiROUND( sizeDiff * 0.4 );
1869 VECTOR2I adjust_offset( 0, - adjust );
1872 text_offset += adjust_offset;
1875 if( nonCached( aText )
1877 && !shownText.Contains( wxT(
"\n" ) ) )
1879 bitmapText( shownText, aText->
GetDrawPos() + text_offset, attrs );
1884 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
1892 m_gal->DrawGlyphs( *cache );
1896 strokeText( shownText, aText->
GetDrawPos() + text_offset, attrs,
1906void SCH_PAINTER::draw(
const SCH_TEXTBOX* aTextBox,
int aLayer,
bool aDimmed )
1916 if( !isUnitAndConversionShown( aTextBox ) )
1919 if( aTextBox->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1924 if( m_schSettings.IsPrinting() && drawingShadows )
1927 COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows, aDimmed );
1929 float borderWidth = getLineWidth( aTextBox, drawingShadows );
1944 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1945 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1949 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
1957 m_gal->DrawGlyphs( *cache );
1968 m_gal->SetFillColor(
color );
1969 m_gal->SetStrokeColor(
color );
1973 m_gal->SetIsFill(
true );
1974 m_gal->SetIsStroke(
false );
1975 m_gal->SetLineWidth( borderWidth );
1984 if( aTextBox->
IsFilled() && !m_schSettings.PrintBlackAndWhiteReq() )
1986 m_gal->SetIsFill(
true );
1987 m_gal->SetIsStroke(
false );
1988 m_gal->SetLineWidth( borderWidth );
2004 if( m_schSettings.m_OverrideItemColors || aTextBox->
IsBrightened()
2007 borderColor = m_schSettings.GetLayerColor( aLayer );
2010 if( transparency > 0.0 )
2011 borderColor = borderColor.
WithAlpha( borderColor.
a * ( 1.0 - transparency ) );
2015 borderColor = borderColor.
Mix( bg, 0.5f );
2019 m_gal->SetIsFill(
false );
2020 m_gal->SetIsStroke(
true );
2021 m_gal->SetStrokeColor( borderColor );
2022 m_gal->SetLineWidth( borderWidth );
2033 for(
SHAPE* shape : shapes )
2047 for(
SHAPE* shape : shapes )
2055void SCH_PAINTER::draw(
const SCH_TABLE* aTable,
int aLayer,
bool aDimmed )
2058 draw( cell, aLayer, aDimmed );
2073 lineWidth = stroke.GetWidth();
2074 color = stroke.GetColor();
2075 lineStyle = stroke.GetLineStyle();
2077 if( lineWidth == 0 )
2078 lineWidth = m_schSettings.GetDefaultPenWidth();
2086 m_gal->SetIsFill(
false );
2087 m_gal->SetIsStroke(
true );
2088 m_gal->SetStrokeColor(
color );
2089 m_gal->SetLineWidth( (
float) lineWidth );
2093 [&](
const SHAPE& shape )
2100 m_gal->DrawLine( a+1, b );
2102 m_gal->DrawLine( a, b );
2111 m_gal->DrawLine( ptA, ptB );
2125 m_gal->DrawRectangle( ptA, ptB );
2130 strokeShape( rect );
2140 for(
int col = 0; col < aTable->
GetColCount() - 1; ++col )
2142 for(
int row = 0; row < aTable->
GetRowCount(); ++row )
2148 strokeLine( topRight, cell->
GetEnd() );
2155 for(
int row = 0; row < aTable->
GetRowCount() - 1; ++row )
2157 for(
int col = 0; col < aTable->
GetColCount(); ++col )
2163 strokeLine( botLeft, cell->
GetEnd() );
2180 strokeRect( pos, end );
2210 ORIENT o = orientations[ 0 ];
2212 for( ORIENT& i : orientations )
2214 if( i.flag == orientation )
2223 for(
int i = 0; i < o.n_rots; i++ )
2224 item.Rotate(
VECTOR2I( 0, 0 ),
true );
2227 item.MirrorVertically( 0 );
2230 item.MirrorHorizontally( 0 );
2235wxString SCH_PAINTER::expandLibItemTextVars(
const wxString& aSourceText,
2238 std::function<bool( wxString* )> symbolResolver =
2239 [&]( wxString* token ) ->
bool
2241 return aSymbolContext->
ResolveTextVar( &m_schematic->CurrentSheet(), token );
2252 if( m_schSettings.IsPrinting() && drawingShadows )
2255 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2258 draw( &field, aLayer, aSymbol->
GetDNP() );
2276 bool invertY =
true;
2278 std::vector<SCH_PIN*> originalPins = originalSymbol->
GetPins( unit, bodyStyle );
2282 std::vector<SCH_PIN*> tempPins = tempSymbol.
GetPins( unit, bodyStyle );
2290 tempItem.SetFlags( aSymbol->
GetFlags() );
2298 textItem->
SetText( expandLibItemTextVars( textItem->
GetText(), aSymbol ) );
2305 textboxItem->
SetText( expandLibItemTextVars( textboxItem->
GetText(), aSymbol ) );
2310 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2313 SCH_PIN* tempPin = tempPins[ i ];
2333 for(
unsigned i = 0; i < tempPins.size(); ++i )
2336 SCH_PIN* tempPin = tempPins[ i ];
2351 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2352 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2359 m_gal->AdvanceDepth();
2360 m_gal->SetIsStroke(
true );
2361 m_gal->SetIsFill(
true );
2366 std::swap( pt1.
x, pt2.
x );
2373void SCH_PAINTER::draw(
const SCH_FIELD* aField,
int aLayer,
bool aDimmed )
2377 if( m_schSettings.IsPrinting() && drawingShadows )
2383 if( !isUnitAndConversionShown( aField ) )
2390 bool foundLayer =
false;
2394 for(
int i = 0; i < layers_count; ++i )
2396 if( layers[i] == aLayer )
2405 COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
2410 : m_schSettings.m_ShowHiddenFields;
2420 if( shownText.IsEmpty() )
2456 if( m_schSettings.GetDrawBoundingBoxes() )
2457 drawItemBoundingBox( aField );
2459 m_gal->SetStrokeColor(
color );
2460 m_gal->SetFillColor(
color );
2462 if( drawingShadows && getFont( aField )->IsOutline() )
2464 BOX2I shadow_box = bbox;
2465 bool invertY =
true;
2469 m_gal->SetIsStroke(
false );
2470 m_gal->SetIsFill(
true );
2484 if( drawingShadows )
2489 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2490 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2494 if( nonCached( aField ) && aField->
RenderAsBitmap( m_gal->GetWorldScale() ) )
2496 bitmapText( shownText, textpos, attributes );
2501 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2504 cache = aField->
GetRenderCache( shownText, textpos, attributes );
2509 m_gal->DrawGlyphs( *cache );
2513 strokeText( shownText, textpos, attributes, aField->
GetFontMetrics() );
2521 if( aField->
IsMoving() && m_schematic )
2525 m_gal->SetLineWidth( m_schSettings.GetOutlineWidth() );
2527 m_gal->DrawLine( bbox.
Centre(), parentPos );
2536 if( m_schSettings.IsPrinting() && drawingShadows )
2541 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2544 draw( &field, aLayer,
false );
2555 if( drawingDangling )
2567 std::vector<VECTOR2I> pts;
2568 std::deque<VECTOR2D> pts2;
2573 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2575 m_gal->SetIsStroke(
true );
2576 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2577 m_gal->SetStrokeColor(
color );
2579 if( drawingShadows )
2581 m_gal->SetIsFill(
eeconfig()->m_Selection.fill_shapes );
2582 m_gal->SetFillColor(
color );
2583 m_gal->DrawPolygon( pts2 );
2587 m_gal->SetIsFill(
false );
2588 m_gal->DrawPolyline( pts2 );
2591 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2595void SCH_PAINTER::draw(
const SCH_LABEL* aLabel,
int aLayer )
2599 if( m_schSettings.IsPrinting() && drawingShadows )
2604 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2607 draw( &field, aLayer,
false );
2618 if( drawingDangling )
2630 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2638 if( m_schSettings.IsPrinting() && drawingShadows )
2643 if( !( drawingShadows || drawingDangling ) ||
eeconfig()->m_Selection.draw_selected_children )
2646 draw( &field, aLayer,
false );
2657 if( drawingDangling )
2676 if( conn && conn->
IsBus() )
2680 std::vector<VECTOR2I> pts;
2681 std::deque<VECTOR2D> pts2;
2686 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2688 m_gal->SetIsFill(
true );
2690 m_gal->SetIsStroke(
true );
2691 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2692 m_gal->SetStrokeColor(
color );
2693 m_gal->DrawPolyline( pts2 );
2695 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2706 if( m_schSettings.IsPrinting() && drawingShadows )
2709 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2712 draw( &field, aLayer,
false );
2735 std::vector<VECTOR2I> pts;
2736 std::deque<VECTOR2D> pts2;
2741 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2743 m_gal->SetIsFill(
false );
2744 m_gal->SetFillColor(
color );
2745 m_gal->SetIsStroke(
true );
2746 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2747 m_gal->SetStrokeColor(
color );
2751 m_gal->DrawLine( pts2[0], pts2[1] );
2752 m_gal->SetIsFill(
true );
2753 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).
EuclideanNorm() );
2757 m_gal->DrawLine( pts2[0], pts2[1] );
2758 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).
EuclideanNorm() );
2762 m_gal->DrawPolyline( pts2 );
2767void SCH_PAINTER::draw(
const SCH_SHEET* aSheet,
int aLayer )
2771 if( m_schSettings.IsPrinting() && drawingShadows )
2774 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2777 draw( &field, aLayer,
false );
2793 if( !m_schSettings.PrintBlackAndWhiteReq() )
2796 m_gal->SetIsFill(
true );
2797 m_gal->SetIsStroke(
false );
2799 m_gal->DrawRectangle( pos, pos + size );
2805 m_gal->SetStrokeColor( getRenderColor( aSheet,
LAYER_SHEET, drawingShadows ) );
2806 m_gal->SetIsStroke(
true );
2807 m_gal->SetLineWidth( getLineWidth( aSheet, drawingShadows ) );
2808 m_gal->SetIsFill(
false );
2810 m_gal->DrawRectangle( pos, pos + size );
2819 if( m_schSettings.IsPrinting() && drawingShadows )
2825 m_gal->SetIsStroke(
true );
2826 m_gal->SetLineWidth( getLineWidth( aNC, drawingShadows ) );
2827 m_gal->SetStrokeColor( getRenderColor( aNC,
LAYER_NOCONNECT, drawingShadows ) );
2828 m_gal->SetIsFill(
false );
2831 int delta = std::max( aNC->
GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
2844 if( m_schSettings.IsPrinting() && drawingShadows )
2871 if( drawingDangling )
2873 m_gal->SetIsFill(
false );
2874 m_gal->SetIsStroke(
true );
2875 m_gal->SetStrokeColor(
color.Brightened( 0.3 ) );
2876 m_gal->SetLineWidth( m_schSettings.GetDanglingIndicatorThickness() );
2886 m_gal->DrawCircle( aEntry->
GetEnd(),
2895 draw( &line, aLayer );
2909 if( img_scale != 1.0 )
2910 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
2914 m_gal->DrawBitmap( *aBitmap->
GetImage() );
2922 m_gal->SetIsStroke(
true );
2923 m_gal->SetStrokeColor(
color );
2924 m_gal->SetLineWidth ( getShadowWidth( aBitmap->
IsBrightened() ) );
2925 m_gal->SetIsFill(
false );
2932 bm_size.
x /= img_scale;
2933 bm_size.
y /= img_scale;
2934 VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
2937 m_gal->DrawRectangle( origin, end );
2949 if( m_schSettings.IsPrinting() && drawingShadows )
2959 m_gal->SetIsFill( !drawingShadows );
2960 m_gal->SetFillColor(
color );
2961 m_gal->SetIsStroke( drawingShadows );
2962 m_gal->SetLineWidth( getLineWidth( aMarker, drawingShadows ) );
2963 m_gal->SetStrokeColor(
color );
2968 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)
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
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,...
BOX2I GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
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
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, const VECTOR2I &aOffset={ 0, 0 }) const
virtual EDA_ANGLE GetDrawRotation() const
virtual VECTOR2I GetDrawPos() const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
const TEXT_ATTRIBUTES & GetAttributes() const
virtual void SetText(const wxString &aText)
VECTOR2I GetTextSize() const
APP_SETTINGS_BASE * KifaceSettings() const
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
virtual bool IsStroke() const
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics) const
Draw a string.
virtual bool IsOutline() const
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const METRICS &aFontMetrics) const
Compute the boundary limits of aText (the bounding box of all shapes).
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
COLOR4D & Invert()
Makes the color inverted, alpha remains the same.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
COLOR4D & Desaturate()
Removes color (in HSL model)
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
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.
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,...
virtual int GetPenWidth() const
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 ...
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
KIGFX::COLOR4D GetBorderColor() const
std::vector< SCH_SHEET_PIN * > & GetPins()
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.
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
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 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_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)
static void orientSymbol(LIB_SYMBOL *symbol, int orientation)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ OUTSIDE
Text appears outside the dimension line (default)
@ PT_NC
not connected (must be left open)
PIN_ORIENTATION
The symbol library pin object orientations.
#define TARGET_BUSENTRY_RADIUS
#define BITMAP_FONT_SIZE_THRESHOLD
#define MAP_COORDS(aCoord)
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.
double EuclideanNorm(const VECTOR2I &vector)
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
VECTOR2< double > VECTOR2D