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();
369 if( isSymbolChild && shape->
GetFillMode() == FILL_T::FILLED_SHAPE )
410 else if(
const EDA_TEXT* otherTextItem =
dynamic_cast<const EDA_TEXT*
>( aItem ) )
413 color = otherTextItem->GetTextColor();
418 color = m_schSettings.GetLayerColor( aLayer );
420 if( aItem->IsBrightened() )
424 if( aDrawingShadows )
426 if( aItem->IsSelected() )
436 else if( aItem->IsSelected() && aDrawingShadows )
438 if( aDrawingShadows )
449 if( m_schSettings.m_ShowDisabled
450 || ( m_schSettings.m_ShowGraphicsDisabled && aItem->Type() !=
SCH_FIELD_T ) )
455 if( aDimmed && !( aItem->IsSelected() && aDrawingShadows ) )
462 if( aItem->GetForcedTransparency() > 0.0 )
463 color =
color.WithAlpha(
color.a * ( 1.0 - aItem->GetForcedTransparency() ) );
469float SCH_PAINTER::getLineWidth(
const SCH_ITEM* aItem,
bool aDrawingShadows )
const
478 if( aDrawingShadows && aItem->
IsType( g_ScaledSelectionTypes ) )
486float SCH_PAINTER::getTextThickness(
const SCH_ITEM* aItem )
const
488 int pen = m_schSettings.GetDefaultPenWidth();
490 switch( aItem->
Type() )
493 pen =
static_cast<const SCH_FIELD*
>( aItem )->GetEffectiveTextPenWidth( pen );
497 pen =
static_cast<const SCH_TEXT*
>( aItem )->GetEffectiveTextPenWidth( pen );
505 pen =
static_cast<const SCH_LABEL_BASE*
>( aItem )->GetEffectiveTextPenWidth( pen );
510 pen =
static_cast<const SCH_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth( pen );
521int SCH_PAINTER::getOperatingPointTextSize()
const
524 int screenTextSize =
std::abs( (
int) m_gal->GetScreenWorldMatrix().GetScale().y * 7 );
527 return KiROUND( ( docTextSize + screenTextSize * 2 ) / 3 );
544void SCH_PAINTER::strokeText(
const wxString& aText,
const VECTOR2D& aPosition,
557 m_gal->SetIsStroke( font->
IsStroke() );
559 font->
Draw( m_gal, aText, aPosition, aAttrs, aFontMetrics );
563void SCH_PAINTER::bitmapText(
const wxString& aText,
const VECTOR2D& aPosition,
571 m_gal->SetHorizontalJustify( aAttrs.
m_Halign );
572 m_gal->SetVerticalJustify( aAttrs.
m_Valign );
574 m_gal->BitmapText( aText, aPosition, aAttrs.
m_Angle );
578void SCH_PAINTER::knockoutText(
const wxString& aText,
const VECTOR2D& aPosition,
601 callback_gal.SetIsStroke(
true );
603 font->
Draw( &callback_gal, aText, aPosition, attrs, aFontMetrics );
617 m_gal->SetIsStroke(
false );
618 m_gal->SetIsFill(
true );
619 m_gal->SetFillColor( attrs.
m_Color );
620 m_gal->DrawPolygon( finalPoly );
624void SCH_PAINTER::boxText(
const wxString& aText,
const VECTOR2D& aPosition,
661 m_gal->SetIsFill(
true );
662 m_gal->SetIsStroke(
false );
669 m_gal->DrawLine( a, b );
670 m_gal->DrawLine( b, c );
674void SCH_PAINTER::draw(
const LIB_SYMBOL* aSymbol,
int aLayer,
bool aDrawFields,
int aUnit,
675 int aBodyStyle,
bool aDimmed )
678 aUnit = m_schSettings.m_ShowUnit;
681 aBodyStyle = m_schSettings.m_ShowBodyStyle;
683 std::unique_ptr< LIB_SYMBOL > tmpSymbol;
688 tmpSymbol = aSymbol->
Flatten();
689 drawnSymbol = tmpSymbol.get();
695 [](
const SCH_ITEM& item,
int layer )
697 int layers[512], layers_count;
700 for(
int ii = 0; ii < layers_count; ++ii )
702 if( layers[ii] == layer )
714 if( !childOnLayer( item, aLayer ) )
723 draw( &item, aLayer, aDimmed );
728bool SCH_PAINTER::setDeviceColors(
const SCH_ITEM* aItem,
int aLayer,
bool aDimmed )
738 m_gal->SetIsFill(
false );
739 m_gal->SetIsStroke(
true );
740 m_gal->SetLineWidth( getLineWidth( aItem,
true ) );
741 m_gal->SetStrokeColor( getRenderColor( aItem,
LAYER_DEVICE,
true, aDimmed ) );
742 m_gal->SetFillColor( getRenderColor( aItem,
LAYER_DEVICE,
true, aDimmed ) );
758 m_gal->SetIsFill(
true );
760 m_gal->SetIsStroke(
false );
774 m_gal->SetFillColor( getRenderColor( aItem,
LAYER_DEVICE,
false, aDimmed ) );
781 if( transparency > 0.0 )
782 fillColour = fillColour.
WithAlpha( fillColour.
a * ( 1.0 - transparency ) );
784 if( m_schSettings.m_OverrideItemColors )
790 fillColour = fillColour.
Mix( bg, 0.5f );
794 m_gal->SetFillColor( fillColour );
799 m_gal->SetIsStroke(
true );
800 m_gal->SetLineWidth( getLineWidth( aItem,
false ) );
801 m_gal->SetStrokeColor( getRenderColor( aItem, aLayer,
false, aDimmed ) );
805 m_gal->SetIsStroke(
false );
816int SCH_PAINTER::internalPinDecoSize(
const SCH_PIN &aPin )
818 if( m_schSettings.m_PinSymbolSize > 0 )
819 return m_schSettings.m_PinSymbolSize;
827int SCH_PAINTER::externalPinDecoSize(
const SCH_PIN &aPin )
829 if( m_schSettings.m_PinSymbolSize > 0 )
830 return m_schSettings.m_PinSymbolSize;
837void SCH_PAINTER::drawPinDanglingIndicator(
const VECTOR2I& aPos,
const COLOR4D& aColor,
838 bool aDrawingShadows,
bool aBrightened )
842 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
844 m_gal->SetIsFill(
false );
845 m_gal->SetIsStroke(
true );
846 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
847 : m_schSettings.GetDanglingIndicatorThickness() );
853void SCH_PAINTER::draw(
const SCH_PIN* aPin,
int aLayer,
bool aDimmed )
860 if( !isUnitAndConversionShown( aPin ) )
865 if( m_schSettings.IsPrinting() && drawingShadows )
880 if( m_schSettings.IsPrinting() )
884 : m_schSettings.m_ShowHiddenPins;
899 if( drawingDangling )
907 if( m_schSettings.GetDrawBoundingBoxes() )
908 drawItemBoundingBox( aPin );
916 int textSize = getOperatingPointTextSize();
918 int textOffset =
KiROUND( textSize * 0.22 );
925 mid.
x +=
KiROUND( textOffset * 1.2 );
930 mid.
y -=
KiROUND( textOffset * 1.2 );
951 m_gal->SetIsStroke(
true );
952 m_gal->SetIsFill(
false );
953 m_gal->SetLineWidth( getLineWidth( aPin, drawingShadows ) );
954 m_gal->SetStrokeColor(
color );
955 m_gal->SetFontBold(
false );
956 m_gal->SetFontUnderlined(
false );
957 m_gal->SetFontItalic(
false );
960 const int diam = radius*2;
965 m_gal->DrawLine( p0, pos );
978 m_gal->DrawLine( p0, pos );
982 m_gal->DrawCircle( p0 + dir * radius, radius );
983 m_gal->DrawLine( p0 + dir * ( diam ), pos );
987 pc = p0 - dir * clock_size ;
989 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
993 m_gal->DrawCircle( p0 + dir * radius, radius );
994 m_gal->DrawLine( p0 + dir * ( diam ), pos );
999 pc = p0 - dir * clock_size ;
1001 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1003 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1007 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1013 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1018 m_gal->DrawLine( p0, pos );
1022 m_gal->DrawLine( p0, pos );
1026 triLine( p0 +
VECTOR2D( 0, clock_size ),
1027 p0 +
VECTOR2D( -dir.
x * clock_size, 0 ),
1032 triLine( p0 +
VECTOR2D( clock_size, 0 ),
1033 p0 +
VECTOR2D( 0, -dir.
y * clock_size ),
1039 m_gal->DrawLine( p0, pos );
1043 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1049 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1056 m_gal->DrawLine( p0, pos );
1065 m_gal->DrawLine( p0, pos );
1067 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius,
1068 p0 +
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius );
1069 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius,
1070 p0 +
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius );
1075 if( drawingShadows && !
eeconfig()->m_Selection.draw_selected_children )
1080 float penWidth = (float) m_schSettings.GetDefaultPenWidth();
1082 float nameStrokeWidth = getLineWidth( aPin,
false );
1083 float numStrokeWidth = getLineWidth( aPin,
false );
1085 bool showPinNumbers = m_schSettings.m_ShowPinNumbers || symbol->
GetShowPinNumbers();
1093 enum { INSIDE = 0,
OUTSIDE, ABOVE, BELOW };
1094 int size[4] = { 0, 0, 0, 0 };
1095 float thickness[4] = { numStrokeWidth, numStrokeWidth, numStrokeWidth, numStrokeWidth };
1103 thickness[INSIDE] = nameStrokeWidth;
1104 colour [INSIDE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1108 thickness[ABOVE] = numStrokeWidth;
1109 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1113 else if( showPinNames && showPinNumbers )
1116 thickness[ABOVE] = nameStrokeWidth;
1117 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1121 thickness[BELOW] = numStrokeWidth;
1122 colour [BELOW] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1125 else if( showPinNames )
1128 thickness[ABOVE] = nameStrokeWidth;
1129 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1132 else if( showPinNumbers )
1135 thickness[ABOVE] = numStrokeWidth;
1136 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1140 if( m_schSettings.m_ShowPinsElectricalType )
1152 #define BITMAP_FONT_SIZE_THRESHOLD 3.5
1162 c = getRenderColor( aPin,
LAYER_HIDDEN, drawingShadows, aDimmed );
1165 float insideOffset = (float) textOffset - thickness[INSIDE] / 2.0f;
1167 float aboveOffset =
PIN_TEXT_MARGIN + penWidth / 2.0f + thickness[ABOVE] / 2.0f;
1168 float belowOffset =
PIN_TEXT_MARGIN + penWidth / 2.0f + thickness[BELOW] / 2.0f;
1173 if( drawingShadows )
1175 float shadowWidth = getShadowWidth( aPin->
IsBrightened() );
1177 for(
float& t : thickness )
1187 const float adjust = 1.2f;
1188 float shadowOffset = shadowWidth/2.0f * adjust;
1189 insideOffset -= shadowOffset;
1190 outsideOffset -= shadowOffset;
1198 if(
text[i].IsEmpty() )
1202 m_gal->SetStrokeColor( colour[i] );
1203 m_gal->SetFillColor( colour[i] );
1217 else if( drawingShadows )
1221 else if( nonCached( aPin ) && renderTextAsBitmap )
1223 bitmapText(
text[i], aPos, attrs );
1238 drawText( INSIDE, pos +
VECTOR2D( -insideOffset - (
float) len, 0 ),
1248 drawText( ABOVE, pos +
VECTOR2D( -len / 2.0, -aboveOffset ),
1253 drawText( BELOW, pos +
VECTOR2D( -len / 2.0, belowOffset ),
1261 drawText( INSIDE, pos +
VECTOR2D( insideOffset + (
float) len, 0 ),
1271 drawText( ABOVE, pos +
VECTOR2D( len / 2.0, -aboveOffset ),
1276 drawText( BELOW, pos +
VECTOR2D( len / 2.0, belowOffset ),
1284 drawText( INSIDE, pos +
VECTOR2D( 0, insideOffset + (
float) len ),
1294 drawText( ABOVE, pos +
VECTOR2D( -aboveOffset, len / 2.0 ),
1299 drawText( BELOW, pos +
VECTOR2D( belowOffset, len / 2.0 ),
1307 drawText( INSIDE, pos +
VECTOR2D( 0, -insideOffset - (
float) len ),
1317 drawText( ABOVE, pos +
VECTOR2D( -aboveOffset, -len / 2.0 ),
1322 drawText( BELOW, pos +
VECTOR2D( belowOffset, -len / 2.0 ),
1328 wxFAIL_MSG(
"Unknown pin orientation" );
1335void SCH_PAINTER::drawDanglingIndicator(
const VECTOR2I& aPos,
const COLOR4D& aColor,
int aWidth,
1336 bool aDangling,
bool aDrawingShadows,
bool aBrightened )
1338 if( m_schSettings.IsPrinting() )
1351 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
1352 m_gal->SetIsStroke(
true );
1353 m_gal->SetIsFill(
false );
1354 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
1355 : m_schSettings.GetDanglingIndicatorThickness() );
1357 m_gal->DrawRectangle( aPos - radius, aPos + radius );
1365 if( m_schSettings.IsPrinting() && drawingShadows )
1375 if( junctionSize > 1 )
1377 m_gal->SetIsStroke( drawingShadows );
1378 m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
1379 m_gal->SetStrokeColor(
color );
1380 m_gal->SetIsFill( !drawingShadows );
1381 m_gal->SetFillColor(
color );
1382 m_gal->DrawCircle( aJct->
GetPosition(), junctionSize );
1387void SCH_PAINTER::draw(
const SCH_LINE* aLine,
int aLayer )
1391 if( m_schSettings.IsPrinting() && drawingShadows )
1402 if( aLine->
IsNew() && drawingDangling )
1406 float width = getLineWidth( aLine, drawingShadows );
1409 if( ( drawingDangling || drawingShadows ) && !aLine->
IsNew() )
1438 if( drawingDangling )
1443 int textSize = getOperatingPointTextSize();
1445 int textOffset =
KiROUND( textSize * 0.22 );
1450 pos.
y -= textOffset;
1456 pos.
x +=
KiROUND( textOffset * 1.2 );
1472 m_gal->SetIsStroke(
true );
1473 m_gal->SetStrokeColor(
color );
1474 m_gal->SetLineWidth( width );
1489 m_gal->DrawLine( a+1, b );
1491 m_gal->DrawLine( a, b );
1497void SCH_PAINTER::draw(
const SCH_SHAPE* aShape,
int aLayer,
bool aDimmed )
1499 if( !isUnitAndConversionShown( aShape ) )
1502 if( aShape->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1507 if( m_schSettings.IsPrinting() && drawingShadows )
1511 COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows );
1519 switch( shape->GetShape() )
1523 VECTOR2D start = shape->GetStart();
1532 EDA_ANGLE angle1 = midAngle - startAngle;
1537 m_gal->DrawArc( center, ( start - center ).
EuclideanNorm(), startAngle, angle );
1542 m_gal->DrawCircle( shape->GetPosition(), shape->GetRadius() );
1546 m_gal->DrawRectangle( shape->GetPosition(), shape->GetEnd() );
1551 const std::vector<SHAPE*> polySegments = shape->MakeEffectiveShapes(
true );
1552 std::deque<VECTOR2D> pts;
1554 for(
SHAPE* polySegment : polySegments )
1555 pts.push_back(
static_cast<SHAPE_SEGMENT*
>( polySegment )->GetSeg().
A );
1559 for(
SHAPE* polySegment : polySegments )
1562 m_gal->DrawPolygon( pts );
1568 m_gal->DrawCurve( shape->GetStart(), shape->GetBezierC1(),
1569 shape->GetBezierC2(), shape->GetEnd() );
1580 if(
eeconfig()->m_Selection.fill_shapes )
1585 m_gal->SetIsFill( aShape->
IsFilled() );
1587 m_gal->SetIsFill(
true );
1589 m_gal->SetIsStroke(
false );
1590 m_gal->SetFillColor(
color );
1594 m_gal->SetIsStroke(
true );
1595 m_gal->SetIsFill(
false );
1596 m_gal->SetLineWidth( getLineWidth( aShape,
true ) );
1597 m_gal->SetStrokeColor(
color );
1600 drawShape( aShape );
1616 if( !m_schSettings.PrintBlackAndWhiteReq() )
1621 m_gal->SetIsFill(
true );
1622 m_gal->SetIsStroke(
false );
1623 m_gal->SetFillColor(
color );
1625 drawShape( aShape );
1636 m_gal->SetIsFill(
true );
1637 m_gal->SetIsStroke(
false );
1638 m_gal->SetFillColor(
color );
1640 drawShape( aShape );
1643 float lineWidth = getLineWidth( aShape, drawingShadows );
1647 m_gal->SetIsFill(
false );
1648 m_gal->SetIsStroke(
true );
1649 m_gal->SetLineWidth( lineWidth );
1650 m_gal->SetStrokeColor(
color );
1654 drawShape( aShape );
1660 for(
SHAPE* shape : shapes )
1667 m_gal->DrawLine( a+1, b );
1669 m_gal->DrawLine( a, b );
1673 for(
SHAPE* shape : shapes )
1681void SCH_PAINTER::draw(
const SCH_TEXT* aText,
int aLayer,
bool aDimmed )
1683 if( !isUnitAndConversionShown( aText ) )
1686 if( aText->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1691 if( m_schSettings.IsPrinting() && drawingShadows )
1697 switch( aText->
Type() )
1709 COLOR4D color = getRenderColor( aText, aLayer, drawingShadows, aDimmed );
1718 if( conn && conn->
IsBus() )
1724 if( m_schSettings.m_IsSymbolEditor ||
eeconfig()->m_Appearance.show_hidden_fields )
1730 m_gal->SetStrokeColor(
color );
1731 m_gal->SetFillColor(
color );
1741 if( drawingShadows && font->
IsOutline() )
1746 m_gal->SetIsStroke(
false );
1747 m_gal->SetIsFill(
true );
1759 double shadowOffset = 0.0;
1761 if( drawingShadows )
1763 double shadowWidth = getShadowWidth( !aText->
IsSelected() );
1766 const double adjust = 1.2f;
1767 shadowOffset = shadowWidth/2.0f * adjust;
1781 pos.
y = bBox.
GetTop() - shadowOffset;
1784 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
1793 pos.
x = bBox.
GetLeft() - shadowOffset;
1802 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
1813 else if( drawingShadows )
1815 m_gal->SetIsFill(
false );
1816 m_gal->SetIsStroke(
true );
1826 text_offset.
x -= fudge;
1828 text_offset.
y -= fudge;
1830 text_offset.
x += fudge;
1832 text_offset.
y += fudge;
1840 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1841 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1851 int adjust =
KiROUND( sizeDiff * 0.4 );
1852 VECTOR2I adjust_offset( 0, - adjust );
1855 text_offset += adjust_offset;
1858 if( nonCached( aText )
1860 && !shownText.Contains( wxT(
"\n" ) ) )
1862 bitmapText( shownText, aText->
GetDrawPos() + text_offset, attrs );
1867 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
1875 m_gal->DrawGlyphs( *cache );
1879 strokeText( shownText, aText->
GetDrawPos() + text_offset, attrs,
1889void SCH_PAINTER::draw(
const SCH_TEXTBOX* aTextBox,
int aLayer,
bool aDimmed )
1899 if( !isUnitAndConversionShown( aTextBox ) )
1902 if( aTextBox->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1907 if( m_schSettings.IsPrinting() && drawingShadows )
1910 COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows, aDimmed );
1912 float borderWidth = getLineWidth( aTextBox, drawingShadows );
1926 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1927 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1931 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
1939 m_gal->DrawGlyphs( *cache );
1950 m_gal->SetFillColor(
color );
1951 m_gal->SetStrokeColor(
color );
1955 m_gal->SetIsFill(
true );
1956 m_gal->SetIsStroke(
false );
1957 m_gal->SetLineWidth( borderWidth );
1965 if( aTextBox->
IsFilled() && !m_schSettings.PrintBlackAndWhiteReq() )
1967 m_gal->SetIsFill(
true );
1968 m_gal->SetIsStroke(
false );
1969 m_gal->SetLineWidth( borderWidth );
1984 if( m_schSettings.m_OverrideItemColors || aTextBox->
IsBrightened()
1987 borderColor = m_schSettings.GetLayerColor( aLayer );
1990 if( transparency > 0.0 )
1991 borderColor = borderColor.
WithAlpha( borderColor.
a * ( 1.0 - transparency ) );
1995 borderColor = borderColor.
Mix( bg, 0.5f );
1999 m_gal->SetIsFill(
false );
2000 m_gal->SetIsStroke(
true );
2001 m_gal->SetStrokeColor( borderColor );
2002 m_gal->SetLineWidth( borderWidth );
2012 for(
SHAPE* shape : shapes )
2020 m_gal->DrawLine( a+1, b );
2022 m_gal->DrawLine( a, b );
2026 for(
SHAPE* shape : shapes )
2034void SCH_PAINTER::draw(
const SCH_TABLE* aTable,
int aLayer,
bool aDimmed )
2037 draw( cell, aLayer, aDimmed );
2052 lineWidth = stroke.GetWidth();
2053 color = stroke.GetColor();
2054 lineStyle = stroke.GetLineStyle();
2056 if( lineWidth == 0 )
2057 lineWidth = m_schSettings.GetDefaultPenWidth();
2065 m_gal->SetIsFill(
false );
2066 m_gal->SetIsStroke(
true );
2067 m_gal->SetStrokeColor(
color );
2068 m_gal->SetLineWidth( (
float) lineWidth );
2072 [&](
const SHAPE& shape )
2079 m_gal->DrawLine( a+1, b );
2081 m_gal->DrawLine( a, b );
2090 m_gal->DrawLine( ptA, ptB );
2104 m_gal->DrawRectangle( ptA, ptB );
2109 strokeShape( rect );
2119 for(
int col = 0; col < aTable->
GetColCount() - 1; ++col )
2121 for(
int row = 0; row < aTable->
GetRowCount(); ++row )
2127 strokeLine( topRight, cell->
GetEnd() );
2134 for(
int row = 0; row < aTable->
GetRowCount() - 1; ++row )
2136 for(
int col = 0; col < aTable->
GetColCount(); ++col )
2142 strokeLine( botLeft, cell->
GetEnd() );
2159 strokeRect( pos, end );
2164wxString SCH_PAINTER::expandLibItemTextVars(
const wxString& aSourceText,
2167 std::function<bool( wxString* )> symbolResolver =
2168 [&]( wxString* token ) ->
bool
2170 return aSymbolContext->
ResolveTextVar( &m_schematic->CurrentSheet(), token );
2181 if( m_schSettings.IsPrinting() && drawingShadows )
2184 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2187 draw( &field, aLayer, aSymbol->
GetDNP() );
2205 std::vector<SCH_PIN*> originalPins = originalSymbol->
GetPins( unit, bodyStyle );
2209 std::vector<SCH_PIN*> tempPins = tempSymbol.
GetPins( unit, bodyStyle );
2217 tempItem.SetFlags( aSymbol->
GetFlags() );
2225 textItem->
SetText( expandLibItemTextVars( textItem->
GetText(), aSymbol ) );
2232 textboxItem->
SetText( expandLibItemTextVars( textboxItem->
GetText(), aSymbol ) );
2237 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2240 SCH_PIN* tempPin = tempPins[ i ];
2260 for(
unsigned i = 0; i < tempPins.size(); ++i )
2263 SCH_PIN* tempPin = tempPins[ i ];
2278 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2279 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2286 m_gal->AdvanceDepth();
2287 m_gal->SetIsStroke(
true );
2288 m_gal->SetIsFill(
true );
2293 std::swap( pt1.
x, pt2.
x );
2300void SCH_PAINTER::draw(
const SCH_FIELD* aField,
int aLayer,
bool aDimmed )
2304 if( m_schSettings.IsPrinting() && drawingShadows )
2310 if( !isUnitAndConversionShown( aField ) )
2317 bool foundLayer =
false;
2321 for(
int i = 0; i < layers_count; ++i )
2323 if( layers[i] == aLayer )
2332 COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
2337 : m_schSettings.m_ShowHiddenFields;
2347 if( shownText.IsEmpty() )
2383 if( m_schSettings.GetDrawBoundingBoxes() )
2384 drawItemBoundingBox( aField );
2386 m_gal->SetStrokeColor(
color );
2387 m_gal->SetFillColor(
color );
2389 if( drawingShadows && getFont( aField )->IsOutline() )
2391 BOX2I shadow_box = bbox;
2394 m_gal->SetIsStroke(
false );
2395 m_gal->SetIsFill(
true );
2408 if( drawingShadows )
2413 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2414 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2418 if( nonCached( aField ) && aField->
RenderAsBitmap( m_gal->GetWorldScale() ) )
2420 bitmapText( shownText, textpos, attributes );
2425 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2428 cache = aField->
GetRenderCache( shownText, textpos, attributes );
2433 m_gal->DrawGlyphs( *cache );
2437 strokeText( shownText, textpos, attributes, aField->
GetFontMetrics() );
2445 if( aField->
IsMoving() && m_schematic )
2449 m_gal->SetLineWidth( m_schSettings.GetOutlineWidth() );
2451 m_gal->DrawLine( bbox.
Centre(), parentPos );
2460 if( m_schSettings.IsPrinting() && drawingShadows )
2465 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2468 draw( &field, aLayer,
false );
2479 if( drawingDangling )
2491 std::vector<VECTOR2I> pts;
2492 std::deque<VECTOR2D> pts2;
2497 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2499 m_gal->SetIsStroke(
true );
2500 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2501 m_gal->SetStrokeColor(
color );
2503 if( drawingShadows )
2505 m_gal->SetIsFill(
eeconfig()->m_Selection.fill_shapes );
2506 m_gal->SetFillColor(
color );
2507 m_gal->DrawPolygon( pts2 );
2511 m_gal->SetIsFill(
false );
2512 m_gal->DrawPolyline( pts2 );
2515 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2519void SCH_PAINTER::draw(
const SCH_LABEL* aLabel,
int aLayer )
2523 if( m_schSettings.IsPrinting() && drawingShadows )
2528 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2531 draw( &field, aLayer,
false );
2542 if( drawingDangling )
2554 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2562 if( m_schSettings.IsPrinting() && drawingShadows )
2567 if( !( drawingShadows || drawingDangling ) ||
eeconfig()->m_Selection.draw_selected_children )
2570 draw( &field, aLayer,
false );
2581 if( drawingDangling )
2600 if( conn && conn->
IsBus() )
2604 std::vector<VECTOR2I> pts;
2605 std::deque<VECTOR2D> pts2;
2610 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2612 m_gal->SetIsFill(
true );
2614 m_gal->SetIsStroke(
true );
2615 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2616 m_gal->SetStrokeColor(
color );
2617 m_gal->DrawPolyline( pts2 );
2619 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2630 if( m_schSettings.IsPrinting() && drawingShadows )
2633 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2636 draw( &field, aLayer,
false );
2659 std::vector<VECTOR2I> pts;
2660 std::deque<VECTOR2D> pts2;
2665 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2667 m_gal->SetIsFill(
false );
2668 m_gal->SetFillColor(
color );
2669 m_gal->SetIsStroke(
true );
2670 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2671 m_gal->SetStrokeColor(
color );
2675 m_gal->DrawLine( pts2[0], pts2[1] );
2676 m_gal->SetIsFill(
true );
2677 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).
EuclideanNorm() );
2681 m_gal->DrawLine( pts2[0], pts2[1] );
2682 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).
EuclideanNorm() );
2686 m_gal->DrawPolyline( pts2 );
2691void SCH_PAINTER::draw(
const SCH_SHEET* aSheet,
int aLayer )
2695 if( m_schSettings.IsPrinting() && drawingShadows )
2698 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2701 draw( &field, aLayer,
false );
2717 if( !m_schSettings.PrintBlackAndWhiteReq() )
2720 m_gal->SetIsFill(
true );
2721 m_gal->SetIsStroke(
false );
2723 m_gal->DrawRectangle( pos, pos + size );
2729 m_gal->SetStrokeColor( getRenderColor( aSheet,
LAYER_SHEET, drawingShadows ) );
2730 m_gal->SetIsStroke(
true );
2731 m_gal->SetLineWidth( getLineWidth( aSheet, drawingShadows ) );
2732 m_gal->SetIsFill(
false );
2734 m_gal->DrawRectangle( pos, pos + size );
2743 if( m_schSettings.IsPrinting() && drawingShadows )
2749 m_gal->SetIsStroke(
true );
2750 m_gal->SetLineWidth( getLineWidth( aNC, drawingShadows ) );
2751 m_gal->SetStrokeColor( getRenderColor( aNC,
LAYER_NOCONNECT, drawingShadows ) );
2752 m_gal->SetIsFill(
false );
2755 int delta = std::max( aNC->
GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
2768 if( m_schSettings.IsPrinting() && drawingShadows )
2795 if( drawingDangling )
2797 m_gal->SetIsFill(
false );
2798 m_gal->SetIsStroke(
true );
2799 m_gal->SetStrokeColor(
color.Brightened( 0.3 ) );
2800 m_gal->SetLineWidth( m_schSettings.GetDanglingIndicatorThickness() );
2810 m_gal->DrawCircle( aEntry->
GetEnd(),
2819 draw( &line, aLayer );
2833 if( img_scale != 1.0 )
2834 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
2838 m_gal->DrawBitmap( *aBitmap->
GetImage() );
2846 m_gal->SetIsStroke(
true );
2847 m_gal->SetStrokeColor(
color );
2848 m_gal->SetLineWidth ( getShadowWidth( aBitmap->
IsBrightened() ) );
2849 m_gal->SetIsFill(
false );
2856 bm_size.
x /= img_scale;
2857 bm_size.
y /= img_scale;
2858 VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
2861 m_gal->DrawRectangle( origin, end );
2873 if( m_schSettings.IsPrinting() && drawingShadows )
2883 m_gal->SetIsFill( !drawingShadows );
2884 m_gal->SetFillColor(
color );
2885 m_gal->SetIsStroke( drawingShadows );
2886 m_gal->SetLineWidth( getLineWidth( aMarker, drawingShadows ) );
2887 m_gal->SetStrokeColor(
color );
2892 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.
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 ...
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
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)
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.
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