139 m_schematic( nullptr )
150 draw( item, aLayer,
false );
158#ifdef CONNECTIVITY_DEBUG
160 auto sch_item =
dynamic_cast<const SCH_ITEM*
>( aItem );
161 auto conn = sch_item ? sch_item->
Connection( *g_CurrentSheet ) :
nullptr;
166 auto label = conn->Name(
true );
173 m_gal->StrokeText( *
m_gal, conn->Name(
true ), pos, 0.0, 0 );
181 switch( aItem->
Type() )
187 drawBoundingBox =
false;
188 draw(
static_cast<const SCH_PIN*
>( aItem ), aLayer, aDimmed );
200 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
203 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
206 draw(
static_cast<const SCH_TEXT*
>( aItem ), aLayer, aDimmed );
212 draw(
static_cast<const SCH_TABLE*
>( aItem ), aLayer, aDimmed );
221 draw(
static_cast<const SCH_FIELD*
>( aItem ), aLayer, aDimmed );
254 if( drawBoundingBox )
270 box =
static_cast<const SCH_SYMBOL*
>( aItem )->GetBodyBoundingBox();
275 :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
344 color =
static_cast<const SCH_LINE*
>( aItem )->GetLineColor();
376 else if( shape->
GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
418 else if(
const EDA_TEXT* otherTextItem =
dynamic_cast<const EDA_TEXT*
>( aItem ) )
421 color = otherTextItem->GetTextColor();
426 color = m_schSettings.GetLayerColor( aLayer );
428 if( aItem->IsBrightened() )
432 if( aDrawingShadows )
434 if( aItem->IsSelected() )
444 else if( aItem->IsSelected() && aDrawingShadows )
457 if( m_schSettings.m_ShowDisabled
458 || ( m_schSettings.m_ShowGraphicsDisabled && aItem->Type() !=
SCH_FIELD_T ) )
463 if( aDimmed && !( aItem->IsSelected() && aDrawingShadows ) )
470 if( aItem->GetForcedTransparency() > 0.0 )
471 color =
color.WithAlpha(
color.a * ( 1.0 - aItem->GetForcedTransparency() ) );
477float SCH_PAINTER::getLineWidth(
const SCH_ITEM* aItem,
bool aDrawingShadows,
478 bool aDrawingWireColorHighlights )
const
487 if( aDrawingShadows && aItem->
IsType( g_ScaledSelectionTypes ) )
491 if( aDrawingWireColorHighlights )
502 width += colorHighlightWidth;
509float SCH_PAINTER::getTextThickness(
const SCH_ITEM* aItem )
const
511 int pen = m_schSettings.GetDefaultPenWidth();
513 switch( aItem->
Type() )
516 pen =
static_cast<const SCH_FIELD*
>( aItem )->GetEffectiveTextPenWidth( pen );
520 pen =
static_cast<const SCH_TEXT*
>( aItem )->GetEffectiveTextPenWidth( pen );
528 pen =
static_cast<const SCH_LABEL_BASE*
>( aItem )->GetEffectiveTextPenWidth( pen );
533 pen =
static_cast<const SCH_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth( pen );
544int SCH_PAINTER::getOperatingPointTextSize()
const
547 int screenTextSize =
std::abs( (
int) m_gal->GetScreenWorldMatrix().GetScale().y * 7 );
550 return KiROUND( ( docTextSize + screenTextSize * 2 ) / 3 );
612 font->
Draw( &aGal, aText, aPosition, aAttrs, aFontMetrics );
654 callback_gal.SetIsStroke(
true );
656 font->
Draw( &callback_gal, aText, aPosition, attrs, aFontMetrics );
701 m_gal->DrawLine( a, b );
702 m_gal->DrawLine( b, c );
706void SCH_PAINTER::draw(
const LIB_SYMBOL* aSymbol,
int aLayer,
bool aDrawFields,
int aUnit,
707 int aBodyStyle,
bool aDimmed )
710 aUnit = m_schSettings.m_ShowUnit;
713 aBodyStyle = m_schSettings.m_ShowBodyStyle;
715 std::unique_ptr< LIB_SYMBOL > tmpSymbol;
720 tmpSymbol = aSymbol->
Flatten();
721 drawnSymbol = tmpSymbol.get();
727 [](
const SCH_ITEM& item,
int layer )
729 int layers[512], layers_count;
732 for(
int ii = 0; ii < layers_count; ++ii )
734 if( layers[ii] == layer )
746 if( !childOnLayer( item, aLayer ) )
755 draw( &item, aLayer, aDimmed );
760int SCH_PAINTER::internalPinDecoSize(
const SCH_PIN &aPin )
762 if( m_schSettings.m_PinSymbolSize > 0 )
763 return m_schSettings.m_PinSymbolSize;
771int SCH_PAINTER::externalPinDecoSize(
const SCH_PIN &aPin )
773 if( m_schSettings.m_PinSymbolSize > 0 )
774 return m_schSettings.m_PinSymbolSize;
781void SCH_PAINTER::drawPinDanglingIndicator(
const SCH_PIN& aPin,
const COLOR4D& aColor,
782 bool aDrawingShadows,
bool aBrightened )
787 float lineWidth = aDrawingShadows ? getShadowWidth( aBrightened )
788 : m_schSettings.GetDanglingIndicatorThickness();
792 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
794 m_gal->SetIsFill(
false );
795 m_gal->SetIsStroke(
true );
796 m_gal->SetLineWidth( lineWidth );
805 bool aRotate,
int aExtraLineWidth,
const COLOR4D& aColor )
832 const double lineYOffset = aSize / 4;
833 const double arrowHead = aSize / 8;
849 topLineREnd -
VECTOR2D{ aSize * 0.7, 0 } );
851 aGal.
DrawLine( topLineREnd, topLineREnd -
VECTOR2D{ arrowHead * 1.2, arrowHead } );
852 aGal.
DrawLine( topLineREnd, topLineREnd -
VECTOR2D{ arrowHead * 1.2, -arrowHead } );
856 aGal.
DrawLine( btmLineREnd, btmLineREnd -
VECTOR2D{ arrowHead * 1.2, arrowHead } );
857 aGal.
DrawLine( btmLineREnd, btmLineREnd -
VECTOR2D{ arrowHead * 1.2, -arrowHead } );
865 aGal.
DrawArc( topLineREnd -
VECTOR2D{ aSize - lineYOffset * 2, -lineYOffset },
872void SCH_PAINTER::draw(
const SCH_PIN* aPin,
int aLayer,
bool aDimmed )
879 if( !isUnitAndConversionShown( aPin ) )
884 if( m_schSettings.IsPrinting() && drawingShadows )
889 const bool isDangling = m_schSettings.m_IsSymbolEditor || aPin->
HasFlag(
IS_DANGLING );
899 if( m_schSettings.IsPrinting() )
903 : m_schSettings.m_ShowHiddenPins;
918 if( drawingDangling )
926 if( m_schSettings.GetDrawBoundingBoxes() )
927 drawItemBoundingBox( aPin );
935 int textSize = getOperatingPointTextSize();
937 int textOffset =
KiROUND( textSize * 0.22 );
944 mid.
x +=
KiROUND( textOffset * 1.2 );
949 mid.
y -=
KiROUND( textOffset * 1.2 );
970 m_gal->SetIsStroke(
true );
971 m_gal->SetIsFill(
false );
972 m_gal->SetLineWidth( getLineWidth( aPin, drawingShadows ) );
973 m_gal->SetStrokeColor(
color );
974 m_gal->SetFontBold(
false );
975 m_gal->SetFontUnderlined(
false );
976 m_gal->SetFontItalic(
false );
979 const int diam = radius*2;
984 m_gal->DrawLine( p0, pos );
997 m_gal->DrawLine( p0, pos );
1001 m_gal->DrawCircle( p0 + dir * radius, radius );
1002 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1006 pc = p0 - dir * clock_size ;
1008 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1010 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1012 m_gal->DrawCircle( p0 + dir * radius, radius );
1013 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1018 pc = p0 - dir * clock_size ;
1020 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1022 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1026 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1032 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1037 m_gal->DrawLine( p0, pos );
1041 m_gal->DrawLine( p0, pos );
1045 triLine( p0 +
VECTOR2D( 0, clock_size ),
1046 p0 +
VECTOR2D( -dir.
x * clock_size, 0 ),
1051 triLine( p0 +
VECTOR2D( clock_size, 0 ),
1052 p0 +
VECTOR2D( 0, -dir.
y * clock_size ),
1058 m_gal->DrawLine( p0, pos );
1062 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1068 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1075 m_gal->DrawLine( p0, pos );
1084 m_gal->DrawLine( p0, pos );
1086 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius,
1087 p0 +
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius );
1088 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius,
1089 p0 +
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius );
1094 if( drawingShadows && !
eeconfig()->m_Selection.draw_selected_children )
1098 float nameStrokeWidth = getLineWidth( aPin,
false );
1099 float numStrokeWidth = getLineWidth( aPin,
false );
1104 float shadowWidth = 0.0f;
1106 if( drawingShadows )
1113 m_schSettings.m_ShowPinsElectricalType,
1114 m_schSettings.m_ShowPinAltIcons );
1116 const auto textRendersAsBitmap = [&](
KIGFX::GAL& aGal,
int aTextSize )
1128 const auto drawTextInfo =
1132 const bool renderTextAsBitmap = textRendersAsBitmap( *m_gal, aTextInfo.
m_TextSize );
1135 m_gal->SetStrokeColor( aColor );
1136 m_gal->SetFillColor( aColor );
1146 if( drawingShadows )
1161 else if( nonCached( aPin ) && renderTextAsBitmap )
1174 const auto getColorForLayer = [&](
int aDrawnLayer )
1177 return getRenderColor( aPin,
LAYER_HIDDEN, drawingShadows, aDimmed );
1179 return getRenderColor( aPin, aDrawnLayer, drawingShadows, aDimmed );
1184 if( std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> numInfo = cache.
GetPinNumberInfo( shadowWidth ) )
1186 drawTextInfo( *numInfo, getColorForLayer(
LAYER_PINNUM ) );
1189 if( std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> nameInfo = cache.
GetPinNameInfo( shadowWidth ) )
1191 drawTextInfo( *nameInfo, getColorForLayer(
LAYER_PINNAM ) );
1203 if( std::optional<PIN_LAYOUT_CACHE::TEXT_INFO> elecTypeInfo =
1212void SCH_PAINTER::drawAnchor(
const VECTOR2I& aPos,
bool aDrawingShadows )
1214 if( m_schSettings.IsPrinting() )
1219 const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
1226 m_gal->SetStrokeColor(
color );
1227 m_gal->SetIsStroke(
true );
1228 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth(
false )
1229 : m_schSettings.GetDanglingIndicatorThickness() );
1231 m_gal->DrawLine( aPos -
VECTOR2I( radius, 0 ), aPos +
VECTOR2I( radius, 0 ) );
1232 m_gal->DrawLine( aPos -
VECTOR2I( 0, radius ), aPos +
VECTOR2I( 0, radius ) );
1238void SCH_PAINTER::drawDanglingIndicator(
const VECTOR2I& aPos,
const COLOR4D& aColor,
int aWidth,
1239 bool aDangling,
bool aDrawingShadows,
bool aBrightened )
1241 if( m_schSettings.IsPrinting() )
1254 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
1255 m_gal->SetIsStroke(
true );
1256 m_gal->SetIsFill(
false );
1257 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
1258 : m_schSettings.GetDanglingIndicatorThickness() );
1260 m_gal->DrawRectangle( aPos - radius, aPos + radius );
1266 bool highlightNetclassColors =
false;
1276 if( m_schSettings.IsPrinting() && drawingShadows )
1284 if( highlightNetclassColors && aLayer == aJct->
GetLayer() )
1287 color = getRenderColor( aJct, aJct->
GetLayer(), drawingShadows );
1291 if( junctionSize > 1 )
1293 m_gal->SetIsStroke( drawingShadows );
1294 m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
1295 m_gal->SetStrokeColor(
color );
1296 m_gal->SetIsFill( !drawingShadows );
1297 m_gal->SetFillColor(
color );
1298 m_gal->DrawCircle( aJct->
GetPosition(), junctionSize );
1303void SCH_PAINTER::draw(
const SCH_LINE* aLine,
int aLayer )
1308 bool drawingBusses = aLayer ==
LAYER_BUS;
1312 bool highlightNetclassColors =
false;
1313 double highlightAlpha = 0.6;
1322 if( !highlightNetclassColors && drawingNetColorHighlights )
1325 if( m_schSettings.m_OverrideItemColors && drawingNetColorHighlights )
1328 if( m_schSettings.IsPrinting() && drawingShadows )
1336 if( aLine->
IsNew() && drawingDangling )
1340 float width = getLineWidth( aLine, drawingShadows, drawingNetColorHighlights );
1343 if( highlightNetclassColors )
1348 else if( drawingBusses )
1352 if( drawingNetColorHighlights )
1364 if( ( drawingDangling || drawingShadows ) && !aLine->
IsNew() )
1393 if( drawingDangling )
1398 int textSize = getOperatingPointTextSize();
1400 int textOffset =
KiROUND( textSize * 0.22 );
1405 pos.
y -= textOffset;
1411 pos.
x +=
KiROUND( textOffset * 1.2 );
1427 m_gal->SetIsStroke(
true );
1428 m_gal->SetStrokeColor(
color );
1429 m_gal->SetLineWidth( width );
1444 m_gal->DrawLine( a+1, b );
1446 m_gal->DrawLine( a, b );
1452void SCH_PAINTER::draw(
const SCH_SHAPE* aShape,
int aLayer,
bool aDimmed )
1454 if( !isUnitAndConversionShown( aShape ) )
1457 if( aShape->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1462 if( m_schSettings.IsPrinting() && drawingShadows )
1466 COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows, aDimmed );
1474 switch( shape->GetShape() )
1478 VECTOR2D start = shape->GetStart();
1487 EDA_ANGLE angle1 = midAngle - startAngle;
1492 m_gal->DrawArc( center, ( start - center ).EuclideanNorm(), startAngle, angle );
1497 m_gal->DrawCircle( shape->GetPosition(), shape->GetRadius() );
1501 m_gal->DrawRectangle( shape->GetPosition(), shape->GetEnd() );
1506 const std::vector<SHAPE*> polySegments = shape->MakeEffectiveShapes(
true );
1508 if( !polySegments.empty() )
1510 std::deque<VECTOR2D> pts;
1512 for(
SHAPE* polySegment : polySegments )
1513 pts.push_back(
static_cast<SHAPE_SEGMENT*
>( polySegment )->GetSeg().
A );
1518 for(
SHAPE* polySegment : polySegments )
1521 m_gal->DrawPolygon( pts );
1528 m_gal->DrawCurve( shape->GetStart(), shape->GetBezierC1(),
1529 shape->GetBezierC2(), shape->GetEnd() );
1540 if(
eeconfig()->m_Selection.fill_shapes )
1545 m_gal->SetIsFill( aShape->
IsFilled() );
1547 m_gal->SetIsFill(
true );
1549 m_gal->SetIsStroke(
false );
1550 m_gal->SetFillColor(
color );
1554 m_gal->SetIsStroke(
true );
1555 m_gal->SetIsFill(
false );
1556 m_gal->SetLineWidth( getLineWidth( aShape,
true ) );
1557 m_gal->SetStrokeColor(
color );
1560 drawShape( aShape );
1576 if( !m_schSettings.PrintBlackAndWhiteReq() )
1578 m_gal->SetIsFill(
true );
1579 m_gal->SetIsStroke(
false );
1580 m_gal->SetFillColor(
color );
1582 drawShape( aShape );
1593 m_gal->SetIsFill(
true );
1594 m_gal->SetIsStroke(
false );
1595 m_gal->SetFillColor(
color );
1597 drawShape( aShape );
1600 float lineWidth = getLineWidth( aShape, drawingShadows );
1604 m_gal->SetIsFill(
false );
1605 m_gal->SetIsStroke(
true );
1606 m_gal->SetLineWidth( lineWidth );
1607 m_gal->SetStrokeColor(
color );
1611 drawShape( aShape );
1617 for(
SHAPE* shape : shapes )
1624 m_gal->DrawLine( a+1, b );
1626 m_gal->DrawLine( a, b );
1630 for(
SHAPE* shape : shapes )
1638void SCH_PAINTER::draw(
const SCH_TEXT* aText,
int aLayer,
bool aDimmed )
1640 if( !isUnitAndConversionShown( aText ) )
1643 if( aText->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1648 if( m_schSettings.IsPrinting() && drawingShadows )
1654 switch( aText->
Type() )
1666 COLOR4D color = getRenderColor( aText, aLayer, drawingShadows, aDimmed );
1675 if( conn && conn->
IsBus() )
1681 if( m_schSettings.m_IsSymbolEditor ||
eeconfig()->m_Appearance.show_hidden_fields )
1687 m_gal->SetStrokeColor(
color );
1688 m_gal->SetFillColor(
color );
1698 if( drawingShadows && font->
IsOutline() )
1703 m_gal->SetIsStroke(
false );
1704 m_gal->SetIsFill(
true );
1716 double shadowOffset = 0.0;
1718 if( drawingShadows )
1720 double shadowWidth = getShadowWidth( !aText->
IsSelected() );
1723 const double adjust = 1.2f;
1724 shadowOffset = shadowWidth/2.0f * adjust;
1738 pos.
y = bBox.
GetTop() - shadowOffset;
1741 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
1750 pos.
x = bBox.
GetLeft() - shadowOffset;
1759 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
1770 else if( drawingShadows )
1772 m_gal->SetIsFill(
false );
1773 m_gal->SetIsStroke(
true );
1783 text_offset.
x -= fudge;
1785 text_offset.
y -= fudge;
1787 text_offset.
x += fudge;
1789 text_offset.
y += fudge;
1798 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1799 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1809 int adjust =
KiROUND( sizeDiff * 0.4 );
1810 VECTOR2I adjust_offset( 0, - adjust );
1813 text_offset += adjust_offset;
1816 if( nonCached( aText )
1818 && !shownText.Contains( wxT(
"\n" ) ) )
1825 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
1833 m_gal->DrawGlyphs( *cache );
1850 switch( aText->
Type() )
1858 showAnchor = !
static_cast<const SCH_LABEL*
>( aText )->IsDangling();
1875 drawAnchor( aText->
GetPosition(), drawingShadows );
1880void SCH_PAINTER::draw(
const SCH_TEXTBOX* aTextBox,
int aLayer,
bool aDimmed )
1890 if( !isUnitAndConversionShown( aTextBox ) )
1893 if( aTextBox->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1898 if( m_schSettings.IsPrinting() && drawingShadows )
1901 COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows, aDimmed );
1903 float borderWidth = getLineWidth( aTextBox, drawingShadows );
1917 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1918 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
1922 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
1930 m_gal->DrawGlyphs( *cache );
1942 m_gal->SetFillColor(
color );
1943 m_gal->SetStrokeColor(
color );
1947 m_gal->SetIsFill(
true );
1948 m_gal->SetIsStroke(
false );
1949 m_gal->SetLineWidth( borderWidth );
1957 if( aTextBox->
IsFilled() && !m_schSettings.PrintBlackAndWhiteReq() )
1959 m_gal->SetIsFill(
true );
1960 m_gal->SetIsStroke(
false );
1961 m_gal->SetLineWidth( borderWidth );
1976 if( m_schSettings.m_OverrideItemColors || aTextBox->
IsBrightened()
1979 borderColor = m_schSettings.GetLayerColor( aLayer );
1982 if( transparency > 0.0 )
1983 borderColor = borderColor.
WithAlpha( borderColor.
a * ( 1.0 - transparency ) );
1987 borderColor = borderColor.
Mix( bg, 0.5f );
1991 m_gal->SetIsFill(
false );
1992 m_gal->SetIsStroke(
true );
1993 m_gal->SetStrokeColor( borderColor );
1994 m_gal->SetLineWidth( borderWidth );
2004 for(
SHAPE* shape : shapes )
2012 m_gal->DrawLine( a+1, b );
2014 m_gal->DrawLine( a, b );
2018 for(
SHAPE* shape : shapes )
2026void SCH_PAINTER::draw(
const SCH_TABLE* aTable,
int aLayer,
bool aDimmed )
2029 draw( cell, aLayer, aDimmed );
2044 lineWidth = stroke.GetWidth();
2045 color = stroke.GetColor();
2046 lineStyle = stroke.GetLineStyle();
2048 if( lineWidth == 0 )
2049 lineWidth = m_schSettings.GetDefaultPenWidth();
2057 m_gal->SetIsFill(
false );
2058 m_gal->SetIsStroke(
true );
2059 m_gal->SetStrokeColor(
color );
2060 m_gal->SetLineWidth( (
float) lineWidth );
2064 [&](
const SHAPE& shape )
2071 m_gal->DrawLine( a+1, b );
2073 m_gal->DrawLine( a, b );
2082 m_gal->DrawLine( ptA, ptB );
2096 m_gal->DrawRectangle( ptA, ptB );
2101 strokeShape( rect );
2111 for(
int col = 0; col < aTable->
GetColCount() - 1; ++col )
2113 for(
int row = 0; row < aTable->
GetRowCount(); ++row )
2119 strokeLine( topRight, cell->
GetEnd() );
2126 for(
int row = 0; row < aTable->
GetRowCount() - 1; ++row )
2128 for(
int col = 0; col < aTable->
GetColCount(); ++col )
2134 strokeLine( botLeft, cell->
GetEnd() );
2151 strokeRect( pos, end );
2156wxString SCH_PAINTER::expandLibItemTextVars(
const wxString& aSourceText,
2159 std::function<bool( wxString* )> symbolResolver =
2160 [&]( wxString* token ) ->
bool
2165 return aSymbolContext->
ResolveTextVar( &m_schematic->CurrentSheet(), token );
2175 bool DNP = aSymbol->
GetDNP();
2179 if( m_schSettings.IsPrinting() && drawingShadows )
2182 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2185 draw( &field, aLayer, DNP || markExclusion );
2197 int unit = m_schematic ? aSymbol->
GetUnitSelection( &m_schematic->CurrentSheet() ) : 1;
2203 std::vector<SCH_PIN*> originalPins = originalSymbol->
GetPins( unit, bodyStyle );
2207 std::vector<SCH_PIN*> tempPins = tempSymbol.
GetPins( unit, bodyStyle );
2215 tempItem.SetFlags( aSymbol->
GetFlags() );
2223 textItem->
SetText( expandLibItemTextVars( textItem->
GetText(), aSymbol ) );
2230 textboxItem->
SetText( expandLibItemTextVars( textboxItem->
GetText(), aSymbol ) );
2235 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2238 SCH_PIN* tempPin = tempPins[ i ];
2257 DNP || markExclusion );
2259 for(
unsigned i = 0; i < tempPins.size(); ++i )
2262 SCH_PIN* tempPin = tempPins[ i ];
2270 if( DNP || markExclusion )
2279 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2280 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2287 m_gal->AdvanceDepth();
2288 m_gal->SetIsStroke(
true );
2289 m_gal->SetIsFill(
true );
2290 m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ) );
2291 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ) );
2293 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2294 std::swap( pt1.
x, pt2.
x );
2295 m_gal->DrawSegment( pt1, pt2, strokeWidth );
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( *m_gal, 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 );
2445 if( aField->
IsMoving() && m_schematic )
2449 m_gal->SetLineWidth( m_schSettings.GetOutlineWidth() );
2451 m_gal->DrawLine( aField->
GetPosition(), parentPos );
2455 drawAnchor( aField->
GetPosition(), drawingShadows );
2464 if( m_schSettings.IsPrinting() && drawingShadows )
2469 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2472 draw( &field, aLayer,
false );
2483 if( drawingDangling )
2495 std::vector<VECTOR2I> pts;
2496 std::deque<VECTOR2D> pts2;
2501 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2503 m_gal->SetIsStroke(
true );
2504 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2505 m_gal->SetStrokeColor(
color );
2507 if( drawingShadows )
2509 m_gal->SetIsFill(
eeconfig()->m_Selection.fill_shapes );
2510 m_gal->SetFillColor(
color );
2511 m_gal->DrawPolygon( pts2 );
2515 m_gal->SetIsFill(
false );
2516 m_gal->DrawPolyline( pts2 );
2519 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2523void SCH_PAINTER::draw(
const SCH_LABEL* aLabel,
int aLayer )
2527 if( m_schSettings.IsPrinting() && drawingShadows )
2532 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2535 draw( &field, aLayer,
false );
2546 if( drawingDangling )
2558 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2566 if( m_schSettings.IsPrinting() && drawingShadows )
2571 if( !( drawingShadows || drawingDangling ) ||
eeconfig()->m_Selection.draw_selected_children )
2574 draw( &field, aLayer,
false );
2585 if( drawingDangling )
2604 if( conn && conn->
IsBus() )
2605 color = getRenderColor( aLabel,
LAYER_BUS, drawingShadows, aDimmed );
2608 std::vector<VECTOR2I> pts;
2609 std::deque<VECTOR2D> pts2;
2614 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2616 m_gal->SetIsFill(
true );
2618 m_gal->SetIsStroke(
true );
2619 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2620 m_gal->SetStrokeColor(
color );
2621 m_gal->DrawPolyline( pts2 );
2623 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2634 if( m_schSettings.IsPrinting() && drawingShadows )
2637 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2640 draw( &field, aLayer,
false );
2663 std::vector<VECTOR2I> pts;
2664 std::deque<VECTOR2D> pts2;
2669 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2671 m_gal->SetIsFill(
false );
2672 m_gal->SetFillColor(
color );
2673 m_gal->SetIsStroke(
true );
2674 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2675 m_gal->SetStrokeColor(
color );
2679 m_gal->DrawLine( pts2[0], pts2[1] );
2680 m_gal->SetIsFill(
true );
2681 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).EuclideanNorm() );
2685 m_gal->DrawLine( pts2[0], pts2[1] );
2686 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).EuclideanNorm() );
2690 m_gal->DrawPolyline( pts2 );
2695void SCH_PAINTER::draw(
const SCH_SHEET* aSheet,
int aLayer )
2698 bool DNP = aSheet->
GetDNP();
2702 if( m_schSettings.IsPrinting() && drawingShadows )
2705 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2708 draw( &field, aLayer, DNP || markExclusion );
2711 draw(
static_cast<SCH_HIERLABEL*
>( sheetPin ), aLayer, DNP || markExclusion );
2724 if( !m_schSettings.PrintBlackAndWhiteReq() )
2727 m_gal->SetIsFill(
true );
2728 m_gal->SetIsStroke(
false );
2730 m_gal->DrawRectangle( pos, pos + size );
2736 m_gal->SetStrokeColor( getRenderColor( aSheet,
LAYER_SHEET, drawingShadows ) );
2737 m_gal->SetIsStroke(
true );
2738 m_gal->SetLineWidth( getLineWidth( aSheet, drawingShadows ) );
2739 m_gal->SetIsFill(
false );
2741 m_gal->DrawRectangle( pos, pos + size );
2744 if( DNP || markExclusion )
2753 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2754 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2761 m_gal->SetIsStroke(
true );
2762 m_gal->SetIsFill(
true );
2763 m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ) );
2764 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ) );
2766 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2767 std::swap( pt1.
x, pt2.
x );
2768 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2777 if( m_schSettings.IsPrinting() && drawingShadows )
2783 m_gal->SetIsStroke(
true );
2784 m_gal->SetLineWidth( getLineWidth( aNC, drawingShadows ) );
2785 m_gal->SetStrokeColor( getRenderColor( aNC,
LAYER_NOCONNECT, drawingShadows ) );
2786 m_gal->SetIsFill(
false );
2789 int delta = std::max( aNC->
GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
2804 bool drawingBusses = aLayer ==
LAYER_BUS;
2806 if( m_schSettings.IsPrinting() && drawingShadows )
2809 bool highlightNetclassColors =
false;
2817 if( !highlightNetclassColors && drawingNetColorHighlights )
2820 if( m_schSettings.m_OverrideItemColors && drawingNetColorHighlights )
2845 if( highlightNetclassColors )
2850 else if( drawingBusses )
2854 if( drawingNetColorHighlights )
2866 if( drawingDangling )
2868 m_gal->SetIsFill(
false );
2869 m_gal->SetIsStroke(
true );
2870 m_gal->SetStrokeColor(
color.Brightened( 0.3 ) );
2871 m_gal->SetLineWidth( m_schSettings.GetDanglingIndicatorThickness() );
2881 m_gal->DrawCircle( aEntry->
GetEnd(),
2890 draw( &line, aLayer );
2906 if( img_scale != 1.0 )
2907 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
2911 m_gal->DrawBitmap( refImage.
GetImage() );
2919 m_gal->SetIsStroke(
true );
2920 m_gal->SetStrokeColor(
color );
2921 m_gal->SetLineWidth ( getShadowWidth( aBitmap->
IsBrightened() ) );
2922 m_gal->SetIsFill(
false );
2929 bm_size.
x /= img_scale;
2930 bm_size.
y /= img_scale;
2931 const VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
2932 const VECTOR2D end = origin + bm_size;
2934 m_gal->DrawRectangle( origin, end );
2946 if( m_schSettings.IsPrinting() && drawingShadows )
2956 m_gal->SetIsFill( !drawingShadows );
2957 m_gal->SetFillColor(
color );
2958 m_gal->SetIsStroke( drawingShadows );
2959 m_gal->SetLineWidth( getLineWidth( aMarker, drawingShadows ) );
2960 m_gal->SetStrokeColor(
color );
2965 m_gal->DrawPolygon( polygon );
constexpr EDA_IU_SCALE schIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
std::optional< BOX2I > OPT_BOX2I
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr const Vec & GetPosition() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr coord_type GetY() const
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr coord_type GetX() const
constexpr size_type GetHeight() const
constexpr coord_type GetLeft() const
constexpr void SetX(coord_type val)
constexpr const Vec & GetOrigin() const
constexpr void SetY(coord_type val)
const BOX2< Vec > GetBoundingBoxRotated(const VECTOR2I &aRotCenter, const EDA_ANGLE &aAngle) const
Useful to calculate bounding box of rotated items, when rotation is not cardinal.
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr void Offset(coord_type dx, coord_type dy)
constexpr coord_type GetBottom() const
Represent basic circle geometry with utility geometry functions.
VECTOR2I Center
Public to make access simpler.
int Radius
Public to make access simpler.
bool IsHorizontal() const
A base class for most all the KiCad significant classes used in schematics and boards.
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
bool IsBrightened() const
bool IsForceVisible() const
EDA_ITEM_FLAGS GetFlags() const
FILL_T GetFillMode() const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
COLOR4D GetFillColor() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const VECTOR2I & GetTextPos() const
COLOR4D GetTextColor() const
const EDA_ANGLE & GetTextAngle() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
KIFONT::FONT * GetFont() const
BOX2I GetTextBox(int aLine=-1) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, const VECTOR2I &aOffset={ 0, 0 }) const
virtual EDA_ANGLE GetDrawRotation() const
virtual VECTOR2I GetDrawPos() const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
const TEXT_ATTRIBUTES & GetAttributes() const
virtual void SetText(const wxString &aText)
VECTOR2I GetTextSize() const
APP_SETTINGS_BASE * KifaceSettings() const
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
virtual bool IsStroke() const
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics) const
Draw a string.
virtual bool IsOutline() const
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const METRICS &aFontMetrics) const
Compute the boundary limits of aText (the bounding box of all shapes).
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
COLOR4D & Invert()
Makes the color inverted, alpha remains the same.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
COLOR4D & Desaturate()
Removes color (in HSL model)
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Attribute save/restore for GAL attributes.
Abstract interface for drawing on a 2D-surface.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void Rotate(double aAngle)
Rotate the context.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
void SetVerticalJustify(const GR_TEXT_V_ALIGN_T aVerticalJustify)
void SetHorizontalJustify(const GR_TEXT_H_ALIGN_T aHorizontalJustify)
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
virtual void Restore()
Restore the context.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
void SetGlyphSize(const VECTOR2I aSize)
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
Draw an arc.
virtual void BitmapText(const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle)
Draw a text using a bitmap font.
virtual void Save()
Save the context.
double GetWorldScale() const
Get the world scale.
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.
A pin layout helper is a class that manages the layout of the parts of a pin on a schematic symbol:
OPT_BOX2I GetAltIconBBox()
Get the box of the alt mode icon, if there is one.
std::optional< TEXT_INFO > GetPinNameInfo(int aShadowWidth)
Get the text info for the pin name.
std::optional< TEXT_INFO > GetPinElectricalTypeInfo(int aShadowWidth)
CIRCLE GetDanglingIndicator() const
Gets the dangling indicator geometry for this pin, if the pin were to be dangling.
std::optional< TEXT_INFO > GetPinNumberInfo(int aShadowWidth)
void SetRenderParameters(int aNameThickness, int aNumberThickness, bool aShowElectricalType, bool aShowAltIcons)
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
const BITMAP_BASE & GetImage() const
Get the underlying image.
double GetImageScale() const
Object to handle a bitmap image that can be inserted in a schematic.
VECTOR2I GetPosition() const override
REFERENCE_IMAGE & GetReferenceImage()
Base class for a bus or wire entry.
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
bool IsBus() const
Return true if the line is a bus.
void SetLineStyle(const LINE_STYLE aStyle)
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
void SetEndPoint(const VECTOR2I &aPosition)
const wxString & GetOperatingPoint() const
SCH_LAYER_ID GetColorLayer() const
VECTOR2I GetPosition() const override
VECTOR2I GetPosition() const override
int GetNumberTextSize() const
const wxString & GetOperatingPoint() const
void SetName(const wxString &aName)
bool IsGlobalPower() const
Return whether this pin forms a global power connection: i.e., is part of a power symbol and of type ...
VECTOR2I GetPinRoot() const
bool IsDangling() const override
void SetShape(GRAPHIC_PINSHAPE aShape)
VECTOR2I GetPosition() const override
int GetNameTextSize() const
wxString GetShownName() const
PIN_LAYOUT_CACHE & GetLayoutCache() const
Get the layout cache associated with this pin.
void SetOperatingPoint(const wxString &aText)
void SetType(ELECTRICAL_PINTYPE aType)
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
bool m_OverrideItemColors
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)
bool GetDNP() const
Set or clear the 'Do Not Populate' flaga.
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
static constexpr EDA_ANGLE ANGLE_270
static constexpr EDA_ANGLE ANGLE_180
#define IS_SHOWN_AS_BITMAP
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_DANGLING
indicates a pin is dangling
#define STARTPOINT
When a line is selected, these flags indicate which.
@ 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_NET_COLOR_HIGHLIGHT
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SELECTION_SHADOWS
@ LAYER_SCHEMATIC_BACKGROUND
#define UNIMPLEMENTED_FOR(type)
The Cairo implementation of the graphics abstraction layer.
static LIB_SYMBOL * dummy()
Used when a LIB_SYMBOL is not found in library to draw a dummy shape.
static void boxText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
static void bitmapText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs)
EESCHEMA_SETTINGS * eeconfig()
static void strokeText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
static void knockoutText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
static void drawAltPinModesIcon(GAL &aGal, const VECTOR2D &aPos, double aSize, bool aBaseSelected, bool aRotate, int aExtraLineWidth, const COLOR4D &aColor)
Draw an alternate pin mode indicator icon.
static bool isFieldsLayer(int aLayer)
static BOX2I GetTextExtents(const wxString &aText, const VECTOR2D &aPosition, KIFONT::FONT &aFont, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ 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
Utility functions for working with shapes.
std::vector< FAB_LAYER_COLOR > dummy
LINE_STYLE
Dashed line types.
constexpr int MilsToIU(int mils) const
int highlight_netclass_colors_thickness
bool highlight_netclass_colors
double highlight_netclass_colors_alpha
GR_TEXT_H_ALIGN_T m_HAlign
GR_TEXT_V_ALIGN_T m_VAlign
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_INDETERMINATE
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
const VECTOR2I CalcArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
constexpr int sign(T val)
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D