103 m_IsSymbolEditor( false ),
106 m_ShowPinsElectricalType( true ),
107 m_ShowPinNumbers( false ),
108 m_ShowDisabled( false ),
109 m_ShowGraphicsDisabled( false ),
110 m_OverrideItemColors( false ),
180 text->SetText( wxString( wxT(
"??" ) ) );
192 m_schematic( nullptr )
202 draw( item, aLayer,
false );
210#ifdef CONNECTIVITY_DEBUG
212 auto sch_item =
dynamic_cast<const SCH_ITEM*
>( aItem );
213 auto conn = sch_item ? sch_item->
Connection( *g_CurrentSheet ) :
nullptr;
218 auto label = conn->Name(
true );
225 m_gal->StrokeText( conn->Name(
true ), pos, 0.0, 0 );
240 :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
245 switch( aItem->
Type() )
251 draw(
static_cast<const LIB_SHAPE*
>( aItem ), aLayer, aDimmed );
254 draw(
static_cast<const LIB_PIN*
>( aItem ), aLayer, aDimmed );
257 draw(
static_cast<const LIB_FIELD*
>( aItem ), aLayer, aDimmed );
260 draw(
static_cast<const LIB_TEXT*
>( aItem ), aLayer, aDimmed );
290 draw(
static_cast<const SCH_FIELD*
>( aItem ), aLayer, aDimmed );
383 color =
static_cast<const SCH_LINE*
>( aItem )->GetLineColor();
453 else if(
const EDA_TEXT* otherTextItem =
dynamic_cast<const EDA_TEXT*
>( aItem ) )
455 color = otherTextItem->GetTextColor();
460 color = m_schSettings.GetLayerColor( aLayer );
462 if( aItem->IsBrightened() )
466 if( aDrawingShadows )
468 if( aItem->IsSelected() )
478 else if( aItem->IsSelected() && aDrawingShadows )
480 if( aDrawingShadows )
483 else if( aItem->IsSelected()
491 if( m_schSettings.m_ShowDisabled
492 || ( m_schSettings.m_ShowGraphicsDisabled && aItem->Type() !=
LIB_FIELD_T ) )
497 if( aDimmed && !( aItem->IsSelected() && aDrawingShadows ) )
504 if( aItem->GetForcedTransparency() > 0.0 )
505 color =
color.WithAlpha(
color.a * ( 1.0 - aItem->GetForcedTransparency() ) );
511float SCH_PAINTER::getLineWidth(
const EDA_ITEM* aItem,
bool aDrawingShadows )
const
517 if(
dynamic_cast<const LIB_ITEM*
>( aItem ) )
518 pen =
static_cast<const LIB_ITEM*
>( aItem )->GetEffectivePenWidth( &m_schSettings );
519 else if(
dynamic_cast<const SCH_ITEM*
>( aItem ) )
528 if( aDrawingShadows && aItem->
IsType( g_ScaledSelectionTypes ) )
536float SCH_PAINTER::getTextThickness(
const EDA_ITEM* aItem )
const
538 int pen = m_schSettings.GetDefaultPenWidth();
540 switch( aItem->
Type() )
543 pen =
static_cast<const SCH_FIELD*
>( aItem )->GetEffectiveTextPenWidth( pen );
547 pen =
static_cast<const SCH_TEXT*
>( aItem )->GetEffectiveTextPenWidth( pen );
555 pen =
static_cast<const SCH_LABEL_BASE*
>( aItem )->GetEffectiveTextPenWidth( pen );
559 pen =
static_cast<const SCH_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth( pen );
563 pen = std::max( pen,
static_cast<const LIB_FIELD*
>( aItem )->GetEffectiveTextPenWidth() );
567 pen = std::max( pen,
static_cast<const LIB_TEXT*
>( aItem )->GetEffectiveTextPenWidth() );
571 pen = std::max( pen,
static_cast<const LIB_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth() );
582int SCH_PAINTER::getOperatingPointTextSize()
const
585 int screenTextSize =
std::abs( (
int) m_gal->GetScreenWorldMatrix().GetScale().y * 7 );
588 return KiROUND( ( docTextSize + screenTextSize * 2 ) / 3 );
611void SCH_PAINTER::strokeText(
const wxString& aText,
const VECTOR2D& aPosition,
623 m_gal->SetIsStroke( font->
IsStroke() );
625 font->
Draw( m_gal, aText, aPosition, aAttrs, aFontMetrics );
629void SCH_PAINTER::bitmapText(
const wxString& aText,
const VECTOR2D& aPosition,
637 m_gal->SetHorizontalJustify( aAttrs.
m_Halign );
638 m_gal->SetVerticalJustify( aAttrs.
m_Valign );
640 m_gal->BitmapText( aText, aPosition, aAttrs.
m_Angle );
644void SCH_PAINTER::knockoutText(
const wxString& aText,
const VECTOR2D& aPosition,
667 callback_gal.SetIsStroke(
true );
669 font->
Draw( &callback_gal, aText, aPosition, attrs, aFontMetrics );
683 m_gal->SetIsStroke(
false );
684 m_gal->SetIsFill(
true );
685 m_gal->SetFillColor( attrs.
m_Color );
686 m_gal->DrawPolygon( finalPoly );
690void SCH_PAINTER::boxText(
const wxString& aText,
const VECTOR2D& aPosition,
726 m_gal->SetIsFill(
true );
727 m_gal->SetIsStroke(
false );
734 m_gal->DrawLine( a, b );
735 m_gal->DrawLine( b, c );
739void SCH_PAINTER::draw(
const LIB_SYMBOL* aSymbol,
int aLayer,
bool aDrawFields,
int aUnit,
740 int aConvert,
bool aDimmed )
743 aUnit = m_schSettings.m_ShowUnit;
746 aConvert = m_schSettings.m_ShowConvert;
748 std::unique_ptr< LIB_SYMBOL > tmpSymbol;
753 tmpSymbol = aSymbol->
Flatten();
754 drawnSymbol = tmpSymbol.get();
760 [](
const LIB_ITEM& item,
int layer )
762 int layers[512], layers_count;
765 for(
int ii = 0; ii < layers_count; ++ii )
767 if( layers[ii] == layer )
779 if( !childOnLayer( item, aLayer ) )
788 draw( &item, aLayer, aDimmed );
793bool SCH_PAINTER::setDeviceColors(
const LIB_ITEM* aItem,
int aLayer,
bool aDimmed )
802 m_gal->SetIsFill(
false );
803 m_gal->SetIsStroke(
true );
804 m_gal->SetLineWidth( getLineWidth( aItem,
true ) );
805 m_gal->SetStrokeColor( getRenderColor( aItem,
LAYER_DEVICE,
true, aDimmed ) );
806 m_gal->SetFillColor( getRenderColor( aItem,
LAYER_DEVICE,
true, aDimmed ) );
822 m_gal->SetIsFill(
true );
824 m_gal->SetIsStroke(
false );
838 m_gal->SetFillColor( getRenderColor( aItem,
LAYER_DEVICE,
false, aDimmed ) );
844 if( m_schSettings.m_OverrideItemColors )
850 fillColour = fillColour.
Mix(
855 m_gal->SetFillColor( fillColour );
860 m_gal->SetIsStroke(
true );
861 m_gal->SetLineWidth( getLineWidth( aItem,
false ) );
862 m_gal->SetStrokeColor( getRenderColor( aItem, aLayer,
false, aDimmed ) );
866 m_gal->SetIsStroke(
false );
877void SCH_PAINTER::draw(
const LIB_SHAPE* aShape,
int aLayer,
bool aDimmed )
879 if( !isUnitAndConversionShown( aShape ) )
882 if( aShape->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
885 if( !setDeviceColors( aShape, aLayer, aDimmed ) )
890 COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows, aDimmed );
895 switch( shape->GetShape() )
908 EDA_ANGLE angle1 = midAngle - startAngle;
913 m_gal->DrawArc( center, ( start - center ).
EuclideanNorm(), startAngle, angle );
918 m_gal->DrawCircle(
mapCoords( shape->GetPosition() ), shape->GetRadius() );
922 m_gal->DrawRectangle(
mapCoords( shape->GetPosition() ),
929 std::deque<VECTOR2D> mappedPts;
934 m_gal->DrawPolygon( mappedPts );
953 if(
eeconfig()->m_Selection.fill_shapes )
958 m_gal->SetIsFill( aShape->
IsFilled() );
960 m_gal->SetIsFill(
true );
964 m_gal->SetIsStroke(
true );
965 m_gal->SetIsFill(
false );
966 m_gal->SetLineWidth( getLineWidth( aShape,
true ) );
967 m_gal->SetStrokeColor(
color );
976 m_gal->SetIsFill(
true );
977 m_gal->SetIsStroke(
false );
983 float lineWidth = getLineWidth( aShape, drawingShadows );
987 m_gal->SetIsFill(
false );
988 m_gal->SetIsStroke(
true );
989 m_gal->SetLineWidth( lineWidth );
990 m_gal->SetStrokeColor(
color );
1000 for(
SHAPE* shape : shapes )
1013 for(
SHAPE* shape : shapes )
1021 m_gal->SetIsFill(
true );
1022 m_gal->SetIsStroke(
false );
1023 drawShape( aShape );
1029void SCH_PAINTER::draw(
const LIB_FIELD* aField,
int aLayer,
bool aDimmed )
1036 if( !isUnitAndConversionShown( aField ) )
1043 bool foundLayer =
false;
1047 for(
int i = 0; i < layers_count; ++i )
1049 if( layers[i] == aLayer )
1056 COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
1060 if( m_schSettings.m_IsSymbolEditor ||
eeconfig()->m_Appearance.show_hidden_fields )
1066 m_gal->SetStrokeColor(
color );
1067 m_gal->SetFillColor(
color );
1071 if( drawingShadows && getFont( aField )->IsOutline() )
1075 m_gal->SetIsStroke(
false );
1076 m_gal->SetIsFill(
true );
1088 if( drawingShadows )
1096 if( aField->
IsMoving() && m_schematic )
1098 m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
1105void SCH_PAINTER::draw(
const LIB_TEXT* aText,
int aLayer,
bool aDimmed )
1107 if( !isUnitAndConversionShown( aText ) )
1110 if( aText->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1118 COLOR4D color = getRenderColor( aText, aLayer, drawingShadows, aDimmed );
1122 if( !m_schematic ||
eeconfig()->m_Appearance.show_hidden_fields )
1130 m_gal->SetFillColor(
color );
1131 m_gal->SetStrokeColor(
color );
1133 if( drawingShadows && getFont( aText )->IsOutline() )
1137 m_gal->SetIsStroke(
false );
1138 m_gal->SetIsFill(
true );
1154 double shadowOffset = 0.0;
1156 if( drawingShadows )
1158 double shadowWidth = getShadowWidth( !aText->
IsSelected() );
1161 const double adjust = 1.2f;
1162 shadowOffset = shadowWidth/2.0f * adjust;
1193void SCH_PAINTER::draw(
const LIB_TEXTBOX* aTextBox,
int aLayer,
bool aDimmed )
1195 if( !isUnitAndConversionShown( aTextBox ) )
1198 if( aTextBox->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1207 COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows, aDimmed );
1208 float borderWidth = getLineWidth( aTextBox, drawingShadows );
1222 m_gal->SetStrokeColor(
color );
1223 m_gal->SetFillColor(
color );
1227 m_gal->SetIsFill(
true );
1228 m_gal->SetIsStroke(
false );
1229 m_gal->SetLineWidth( borderWidth );
1238 m_gal->SetIsFill(
true );
1239 m_gal->SetIsStroke(
false );
1240 m_gal->SetLineWidth( borderWidth );
1250 if( borderWidth > 0 )
1255 if( m_schSettings.m_OverrideItemColors || aTextBox->
IsBrightened()
1258 borderColor = m_schSettings.GetLayerColor( aLayer );
1264 borderColor = borderColor.
Mix( bg, 0.5f );
1267 m_gal->SetIsFill(
false );
1268 m_gal->SetIsStroke(
true );
1269 m_gal->SetStrokeColor( borderColor );
1270 m_gal->SetLineWidth( borderWidth );
1281 for(
SHAPE* shape : shapes )
1295 for(
SHAPE* shape : shapes )
1303int SCH_PAINTER::internalPinDecoSize(
const LIB_PIN &aPin )
1305 if( m_schSettings.m_PinSymbolSize > 0 )
1306 return m_schSettings.m_PinSymbolSize;
1314int SCH_PAINTER::externalPinDecoSize(
const LIB_PIN &aPin )
1316 if( m_schSettings.m_PinSymbolSize > 0 )
1317 return m_schSettings.m_PinSymbolSize;
1325 bool aDrawingShadows,
bool aBrightened )
1329 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
1331 m_gal->SetIsFill(
false );
1332 m_gal->SetIsStroke(
true );
1333 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
1334 : m_schSettings.GetDanglineSymbolThickness() );
1340void SCH_PAINTER::draw(
const LIB_PIN* aPin,
int aLayer,
bool aDimmed )
1342 if( !isUnitAndConversionShown( aPin ) )
1358 if( !m_schematic ||
eeconfig()->m_Appearance.show_hidden_pins )
1366 if( drawingDangling )
1405 int textSize = getOperatingPointTextSize();
1407 int textOffset =
KiROUND( textSize * 0.22 );
1410 if( len > textSize )
1414 mid.
x +=
KiROUND( textOffset * 1.2 );
1419 mid.
y -=
KiROUND( textOffset * 1.2 );
1440 m_gal->SetIsStroke(
true );
1441 m_gal->SetIsFill(
false );
1442 m_gal->SetLineWidth( getLineWidth( aPin, drawingShadows ) );
1443 m_gal->SetStrokeColor(
color );
1444 m_gal->SetFontBold(
false );
1445 m_gal->SetFontUnderlined(
false );
1446 m_gal->SetFontItalic(
false );
1449 const int diam = radius*2;
1454 m_gal->DrawLine( p0, pos );
1466 m_gal->DrawLine( p0, pos );
1470 m_gal->DrawCircle( p0 + dir * radius, radius );
1471 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1475 pc = p0 - dir * clock_size ;
1477 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1479 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1481 m_gal->DrawCircle( p0 + dir * radius, radius );
1482 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1487 pc = p0 - dir * clock_size ;
1489 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1491 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1495 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1501 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1506 m_gal->DrawLine( p0, pos );
1510 m_gal->DrawLine( p0, pos );
1514 triLine( p0 +
VECTOR2D( 0, clock_size ),
1515 p0 +
VECTOR2D( -dir.
x * clock_size, 0 ),
1520 triLine( p0 +
VECTOR2D( clock_size, 0 ),
1521 p0 +
VECTOR2D( 0, -dir.
y * clock_size ),
1527 m_gal->DrawLine( p0, pos );
1531 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1537 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1544 m_gal->DrawLine( p0, pos );
1553 m_gal->DrawLine( p0, pos );
1555 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius,
1556 p0 +
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius );
1557 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius,
1558 p0 +
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius );
1569 if( drawingShadows && !
eeconfig()->m_Selection.draw_selected_children )
1573 float penWidth = (float) m_schSettings.GetDefaultPenWidth();
1575 float nameStrokeWidth = getLineWidth( aPin,
false );
1576 float numStrokeWidth = getLineWidth( aPin,
false );
1578 bool showPinNumbers = m_schSettings.m_ShowPinNumbers || libEntry->
ShowPinNumbers();
1586 enum { INSIDE = 0,
OUTSIDE, ABOVE, BELOW };
1587 int size[4] = { 0, 0, 0, 0 };
1588 float thickness[4] = { numStrokeWidth, numStrokeWidth, numStrokeWidth, numStrokeWidth };
1596 thickness[INSIDE] = nameStrokeWidth;
1597 colour [INSIDE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1601 thickness[ABOVE] = numStrokeWidth;
1602 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1606 else if( showPinNames && showPinNumbers )
1609 thickness[ABOVE] = nameStrokeWidth;
1610 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1614 thickness[BELOW] = numStrokeWidth;
1615 colour [BELOW] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1618 else if( showPinNames )
1621 thickness[ABOVE] = nameStrokeWidth;
1622 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1625 else if( showPinNumbers )
1628 thickness[ABOVE] = numStrokeWidth;
1629 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1633 if( m_schSettings.m_ShowPinsElectricalType )
1645 #define BITMAP_FONT_SIZE_THRESHOLD 3.5
1655 c = getRenderColor( aPin,
LAYER_HIDDEN, drawingShadows, aDimmed );
1658 float insideOffset = (float) textOffset - thickness[INSIDE] / 2.0f;
1660 float aboveOffset =
PIN_TEXT_MARGIN + penWidth / 2.0f + thickness[ABOVE] / 2.0f;
1661 float belowOffset =
PIN_TEXT_MARGIN + penWidth / 2.0f + thickness[BELOW] / 2.0f;
1666 if( drawingShadows )
1668 float shadowWidth = getShadowWidth( aPin->
IsBrightened() );
1670 for(
float& t : thickness )
1680 const float adjust = 1.2f;
1681 float shadowOffset = shadowWidth/2.0f * adjust;
1682 insideOffset -= shadowOffset;
1683 outsideOffset -= shadowOffset;
1691 if(
text[i].IsEmpty() )
1695 m_gal->SetStrokeColor( colour[i] );
1696 m_gal->SetFillColor( colour[i] );
1710 else if( drawingShadows )
1714 else if( nonCached( aPin ) && renderTextAsBitmap )
1716 bitmapText(
text[i], aPos, attrs );
1731 drawText( INSIDE, pos +
VECTOR2D( -insideOffset - (
float) len, 0 ),
1741 drawText( ABOVE, pos +
VECTOR2D( -len / 2.0, -aboveOffset ),
1746 drawText( BELOW, pos +
VECTOR2D( -len / 2.0, belowOffset ),
1754 drawText( INSIDE, pos +
VECTOR2D( insideOffset + (
float) len, 0 ),
1764 drawText( ABOVE, pos +
VECTOR2D( len / 2.0, -aboveOffset ),
1769 drawText( BELOW, pos +
VECTOR2D( len / 2.0, belowOffset ),
1777 drawText( INSIDE, pos +
VECTOR2D( 0, insideOffset + (
float) len ),
1787 drawText( ABOVE, pos +
VECTOR2D( -aboveOffset, len / 2.0 ),
1792 drawText( BELOW, pos +
VECTOR2D( belowOffset, len / 2.0 ),
1800 drawText( INSIDE, pos +
VECTOR2D( 0, -insideOffset - (
float) len ),
1810 drawText( ABOVE, pos +
VECTOR2D( -aboveOffset, -len / 2.0 ),
1815 drawText( BELOW, pos +
VECTOR2D( belowOffset, -len / 2.0 ),
1821 wxFAIL_MSG(
"Unknown pin orientation" );
1828void SCH_PAINTER::drawDanglingSymbol(
const VECTOR2I& aPos,
const COLOR4D& aColor,
int aWidth,
1829 bool aDangling,
bool aDrawingShadows,
bool aBrightened )
1841 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
1842 m_gal->SetIsStroke(
true );
1843 m_gal->SetIsFill(
false );
1844 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
1845 : m_schSettings.GetDanglineSymbolThickness() );
1847 m_gal->DrawRectangle( aPos - radius, aPos + radius );
1862 if( junctionSize > 1 )
1864 m_gal->SetIsStroke( drawingShadows );
1865 m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
1866 m_gal->SetStrokeColor(
color );
1867 m_gal->SetIsFill( !drawingShadows );
1868 m_gal->SetFillColor(
color );
1869 m_gal->DrawCircle( aJct->
GetPosition(), junctionSize );
1874void SCH_PAINTER::draw(
const SCH_LINE* aLine,
int aLayer )
1885 if( aLine->
IsNew() && drawingDangling )
1889 float width = getLineWidth( aLine, drawingShadows );
1892 if( ( drawingDangling || drawingShadows ) && !aLine->
IsNew() )
1900 KiROUND( getLineWidth( aLine, drawingShadows ) ),
1910 drawDanglingSymbol( aLine->
GetEndPoint(), danglingColor,
1911 KiROUND( getLineWidth( aLine, drawingShadows ) ),
1917 if( drawingDangling )
1922 int textSize = getOperatingPointTextSize();
1924 int textOffset =
KiROUND( textSize * 0.22 );
1929 pos.
y -= textOffset;
1935 pos.
x +=
KiROUND( textOffset * 1.2 );
1951 m_gal->SetIsStroke(
true );
1952 m_gal->SetStrokeColor(
color );
1953 m_gal->SetLineWidth( width );
1969 m_gal->DrawLine( a+1, b );
1971 m_gal->DrawLine( a, b );
1977void SCH_PAINTER::draw(
const SCH_SHAPE* aShape,
int aLayer )
1981 COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows );
1989 switch( shape->GetShape() )
1998 endAngle - startAngle );
2003 m_gal->DrawCircle( shape->GetPosition(), shape->GetRadius() );
2007 m_gal->DrawRectangle( shape->GetPosition(), shape->GetEnd() );
2012 std::deque<VECTOR2D> pts;
2014 for(
const VECTOR2I& pt : shape->GetPolyShape().Outline( 0 ).CPoints() )
2015 pts.push_back( pt );
2017 m_gal->DrawPolygon( pts );
2023 m_gal->DrawCurve( shape->GetStart(), shape->GetBezierC1(), shape->GetBezierC2(),
2035 if(
eeconfig()->m_Selection.fill_shapes )
2040 m_gal->SetIsFill( aShape->
IsFilled() );
2042 m_gal->SetIsFill(
true );
2044 m_gal->SetIsStroke(
false );
2045 m_gal->SetFillColor(
color );
2049 m_gal->SetIsStroke(
true );
2050 m_gal->SetIsFill(
false );
2051 m_gal->SetLineWidth( getLineWidth( aShape,
true ) );
2052 m_gal->SetStrokeColor(
color );
2055 drawShape( aShape );
2061 m_gal->SetIsFill(
true );
2062 m_gal->SetIsStroke(
false );
2063 m_gal->SetFillColor(
color );
2065 drawShape( aShape );
2070 float lineWidth = getLineWidth( aShape, drawingShadows );
2074 m_gal->SetIsFill(
false );
2075 m_gal->SetIsStroke(
true );
2076 m_gal->SetLineWidth( lineWidth );
2077 m_gal->SetStrokeColor(
color );
2081 drawShape( aShape );
2087 for(
SHAPE* shape : shapes )
2094 m_gal->DrawLine( a+1, b );
2096 m_gal->DrawLine( a, b );
2100 for(
SHAPE* shape : shapes )
2108void SCH_PAINTER::draw(
const SCH_TEXT* aText,
int aLayer )
2115 switch( aText->
Type() )
2125 COLOR4D color = getRenderColor( aText, aLayer, drawingShadows );
2134 if( conn && conn->
IsBus() )
2140 if( !m_schematic ||
eeconfig()->m_Appearance.show_hidden_fields )
2146 m_gal->SetStrokeColor(
color );
2147 m_gal->SetFillColor(
color );
2157 if( drawingShadows && !font->
IsOutline() )
2159 m_gal->SetIsFill(
false );
2160 m_gal->SetIsStroke(
true );
2167 double fudge = getShadowWidth( !aText->
IsSelected() ) / 1.52;
2170 text_offset.
x -= fudge;
2172 text_offset.
y -= fudge;
2174 text_offset.
x += fudge;
2176 text_offset.
y += fudge;
2181 else if( drawingShadows )
2187 m_gal->SetIsStroke(
false );
2188 m_gal->SetIsFill(
true );
2195 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2196 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2206 int adjust =
KiROUND( sizeDiff * 0.4 );
2207 VECTOR2I adjust_offset( 0, - adjust );
2210 text_offset += adjust_offset;
2213 if( nonCached( aText )
2215 && !shownText.Contains( wxT(
"\n" ) ) )
2217 bitmapText( shownText, aText->
GetDrawPos() + text_offset, attrs );
2222 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2230 m_gal->DrawGlyphs( *cache );
2234 strokeText( shownText, aText->
GetDrawPos() + text_offset, attrs,
2247 COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows );
2248 float borderWidth = getLineWidth( aTextBox, drawingShadows );
2262 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2263 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2267 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2275 m_gal->DrawGlyphs( *cache );
2286 m_gal->SetFillColor(
color );
2287 m_gal->SetStrokeColor(
color );
2291 m_gal->SetIsFill(
true );
2292 m_gal->SetIsStroke(
false );
2293 m_gal->SetLineWidth( borderWidth );
2301 m_gal->SetIsFill(
true );
2302 m_gal->SetIsStroke(
false );
2303 m_gal->SetLineWidth( borderWidth );
2312 if( borderWidth > 0 )
2317 if( m_schSettings.m_OverrideItemColors || aTextBox->
IsBrightened()
2320 borderColor = m_schSettings.GetLayerColor( aLayer );
2323 m_gal->SetIsFill(
false );
2324 m_gal->SetIsStroke(
true );
2325 m_gal->SetStrokeColor( borderColor );
2326 m_gal->SetLineWidth( borderWidth );
2336 for(
SHAPE* shape : shapes )
2344 m_gal->DrawLine( a+1, b );
2346 m_gal->DrawLine( a, b );
2350 for(
SHAPE* shape : shapes )
2383 ORIENT o = orientations[ 0 ];
2385 for( ORIENT& i : orientations )
2387 if( i.flag == orientation )
2396 for(
int i = 0; i < o.n_rots; i++ )
2397 item.Rotate(
VECTOR2I(0, 0 ),
true );
2400 item.MirrorVertical(
VECTOR2I( 0, 0 ) );
2403 item.MirrorHorizontal(
VECTOR2I( 0, 0 ) );
2408wxString SCH_PAINTER::expandLibItemTextVars(
const wxString& aSourceText,
2411 std::function<bool( wxString* )> symbolResolver =
2412 [&]( wxString* token ) ->
bool
2414 return aSymbolContext->
ResolveTextVar( &m_schematic->CurrentSheet(), token );
2425 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2428 draw( &field, aLayer, aSymbol->
GetDNP() );
2460 tempItem.SetFlags( aSymbol->
GetFlags() );
2468 textItem->
SetText( expandLibItemTextVars( textItem->
GetText(), aSymbol ) );
2475 textboxItem->
SetText( expandLibItemTextVars( textboxItem->
GetText(), aSymbol ) );
2480 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2483 LIB_PIN* tempPin = tempPins[ i ];
2503 for(
unsigned i = 0; i < tempPins.size(); ++i )
2506 LIB_PIN* tempPin = tempPins[ i ];
2521 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2522 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2529 m_gal->AdvanceDepth();
2530 m_gal->SetIsStroke(
true );
2531 m_gal->SetIsFill(
true );
2536 std::swap( pt1.
x, pt2.
x );
2543void SCH_PAINTER::draw(
const SCH_FIELD* aField,
int aLayer,
bool aDimmed )
2550 if( !drawingShadows && aField->
GetLayer() != aLayer )
2555 COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
2559 if( !m_schematic ||
eeconfig()->m_Appearance.show_hidden_fields )
2567 if( shownText.IsEmpty() )
2603 if( m_schSettings.GetDrawBoundingBoxes() )
2605 m_gal->SetIsFill(
false );
2606 m_gal->SetIsStroke(
true );
2608 :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
2613 m_gal->SetStrokeColor(
color );
2614 m_gal->SetFillColor(
color );
2616 if( drawingShadows && getFont( aField )->IsOutline() )
2618 BOX2I shadow_box = bbox;
2622 m_gal->SetIsStroke(
false );
2623 m_gal->SetIsFill(
true );
2636 if( drawingShadows )
2641 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2642 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2646 if( nonCached( aField ) && aField->
RenderAsBitmap( m_gal->GetWorldScale() ) )
2648 bitmapText( shownText, textpos, attributes );
2653 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2656 cache = aField->
GetRenderCache( shownText, textpos, attributes );
2661 m_gal->DrawGlyphs( *cache );
2665 strokeText( shownText, textpos, attributes, aField->
GetFontMetrics() );
2677 m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
2679 m_gal->DrawLine( bbox.
Centre(), parentPos );
2689 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2692 draw( &field, aLayer,
false );
2703 if( drawingDangling )
2715 std::vector<VECTOR2I> pts;
2716 std::deque<VECTOR2D> pts2;
2721 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2723 m_gal->SetIsStroke(
true );
2724 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2725 m_gal->SetStrokeColor(
color );
2727 if( drawingShadows )
2729 m_gal->SetIsFill(
eeconfig()->m_Selection.fill_shapes );
2730 m_gal->SetFillColor(
color );
2731 m_gal->DrawPolygon( pts2 );
2735 m_gal->SetIsFill(
false );
2736 m_gal->DrawPolyline( pts2 );
2739 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer );
2743void SCH_PAINTER::draw(
const SCH_LABEL* aLabel,
int aLayer )
2748 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2751 draw( &field, aLayer,
false );
2762 if( drawingDangling )
2774 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer );
2783 if( !( drawingShadows || drawingDangling ) ||
eeconfig()->m_Selection.draw_selected_children )
2786 draw( &field, aLayer,
false );
2797 if( drawingDangling )
2816 if( conn && conn->
IsBus() )
2820 std::vector<VECTOR2I> pts;
2821 std::deque<VECTOR2D> pts2;
2826 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2828 m_gal->SetIsFill(
true );
2830 m_gal->SetIsStroke(
true );
2831 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2832 m_gal->SetStrokeColor(
color );
2833 m_gal->DrawPolyline( pts2 );
2835 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer );
2846 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2849 draw( &field, aLayer,
false );
2872 std::vector<VECTOR2I> pts;
2873 std::deque<VECTOR2D> pts2;
2878 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2880 m_gal->SetIsFill(
false );
2881 m_gal->SetFillColor(
color );
2882 m_gal->SetIsStroke(
true );
2883 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2884 m_gal->SetStrokeColor(
color );
2888 m_gal->DrawLine( pts2[0], pts2[1] );
2889 m_gal->SetIsFill(
true );
2890 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).
EuclideanNorm() );
2894 m_gal->DrawLine( pts2[0], pts2[1] );
2895 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).
EuclideanNorm() );
2899 m_gal->DrawPolyline( pts2 );
2904void SCH_PAINTER::draw(
const SCH_SHEET* aSheet,
int aLayer )
2908 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2911 draw( &field, aLayer,
false );
2926 m_gal->SetIsFill(
true );
2927 m_gal->SetIsStroke(
false );
2929 m_gal->DrawRectangle( pos, pos + size );
2934 m_gal->SetStrokeColor( getRenderColor( aSheet,
LAYER_SHEET, drawingShadows ) );
2935 m_gal->SetIsStroke(
true );
2936 m_gal->SetLineWidth( getLineWidth( aSheet, drawingShadows ) );
2937 m_gal->SetIsFill(
false );
2939 m_gal->DrawRectangle( pos, pos + size );
2951 m_gal->SetIsStroke(
true );
2952 m_gal->SetLineWidth( getLineWidth( aNC, drawingShadows ) );
2953 m_gal->SetStrokeColor( getRenderColor( aNC,
LAYER_NOCONNECT, drawingShadows ) );
2954 m_gal->SetIsFill(
false );
2957 int delta = std::max( aNC->
GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
2993 if( drawingDangling )
2995 m_gal->SetIsFill(
false );
2996 m_gal->SetIsStroke(
true );
2997 m_gal->SetStrokeColor(
color.Brightened( 0.3 ) );
2998 m_gal->SetLineWidth( drawingShadows ? getShadowWidth( aEntry->
IsBrightened() )
2999 : m_schSettings.GetDanglineSymbolThickness() );
3009 m_gal->DrawCircle( aEntry->
GetEnd(),
3018 draw( &line, aLayer );
3032 if( img_scale != 1.0 )
3033 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
3037 m_gal->DrawBitmap( *aBitmap->
GetImage() );
3045 m_gal->SetIsStroke(
true );
3046 m_gal->SetStrokeColor(
color );
3047 m_gal->SetLineWidth ( getShadowWidth( aBitmap->
IsBrightened() ) );
3048 m_gal->SetIsFill(
false );
3055 bm_size.
x /= img_scale;
3056 bm_size.
y /= img_scale;
3057 VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
3060 m_gal->DrawRectangle( origin, end );
3079 m_gal->SetIsFill( !drawingShadows );
3080 m_gal->SetFillColor(
color );
3081 m_gal->SetIsStroke( drawingShadows );
3082 m_gal->SetLineWidth( getLineWidth( aMarker, drawingShadows ) );
3083 m_gal->SetStrokeColor(
color );
3088 m_gal->DrawPolygon( polygon );
VECTOR2D mapCoords(const VECTOR2D &aSource)
constexpr EDA_IU_SCALE schIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
const Vec & GetPosition() const
const Vec & GetOrigin() const
void Offset(coord_type dx, coord_type dy)
void RevertYAxis()
Mirror the rectangle from the X axis (negate Y pos and size).
void SetX(coord_type val)
void SetY(coord_type val)
coord_type GetTop() const
coord_type GetHeight() const
coord_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
Color settings are a bit different than most of the settings objects in that there can be more than o...
bool GetOverrideSchItemColors() const
COLOR4D GetColor(int aLayer) 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)
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
bool IsBrightened() const
virtual wxString GetClass() const =0
Return the class name.
bool IsForceVisible() const
EDA_ITEM_FLAGS GetFlags() const
FILL_T GetFillMode() const
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const
Make a set of SHAPE objects representing the EDA_SHAPE.
void CalcArcAngles(EDA_ANGLE &aStartAngle, EDA_ANGLE &aEndAngle) const
Calc arc start and end angles such that aStartAngle < aEndAngle.
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
COLOR4D GetFillColor() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
BOX2I GetTextBox(int aLine=-1, bool aInvertY=false) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
const VECTOR2I & GetTextPos() const
COLOR4D GetTextColor() const
const EDA_ANGLE & GetTextAngle() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
KIFONT::FONT * GetFont() const
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, const VECTOR2I &aOffset={ 0, 0 }) const
virtual EDA_ANGLE GetDrawRotation() const
virtual VECTOR2I GetDrawPos() const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
const TEXT_ATTRIBUTES & GetAttributes() const
virtual wxString GetShownText(bool aAllowExtraText, int aDepth=0) const
Return the string actually shown after processing of the base text.
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 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.
COLOR4D m_backgroundColor
void SetDefaultPenWidth(int aWidth)
void SetGapLengthRatio(double aRatio)
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
void SetDashLengthRatio(double aRatio)
COLOR4D m_layerColors[LAYER_ID_COUNT]
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.
float getShadowWidth(bool aForHighlight) const
KIFONT::FONT * getFont(const EDA_TEXT *aText) const
void draw(const EDA_ITEM *, int, bool aDimmed)
bool isUnitAndConversionShown(const LIB_ITEM *aItem) const
static std::vector< KICAD_T > g_ScaledSelectionTypes
COLOR4D getRenderColor(const EDA_ITEM *aItem, int aLayer, bool aDrawingShadows, bool aDimmed=false) const
SCH_RENDER_SETTINGS m_schSettings
bool nonCached(const EDA_ITEM *aItem)
virtual COLOR4D GetColor(const VIEW_ITEM *aItem, int aLayer) const override
Returns the color that should be used to draw the specific VIEW_ITEM on the specific layer using curr...
bool m_OverrideItemColors
void LoadColors(const COLOR_SETTINGS *aSettings) override
bool GetShowPageLimits() const override
An abstract base class for deriving all objects that can be added to a VIEW.
static constexpr int VIEW_MAX_LAYERS
Rendering order modifier for layers that are marked as top layers.
Field object used in symbol libraries.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
The base class for drawable items used by schematic library symbols.
virtual int GetPenWidth() const =0
const KIFONT::METRICS & GetFontMetrics() const
LIB_SYMBOL * GetParent() const
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
void SetShape(GRAPHIC_PINSHAPE aShape)
ELECTRICAL_PINTYPE GetType() const
void SetName(const wxString &aName)
void SetType(ELECTRICAL_PINTYPE aType)
PIN_ORIENTATION GetOrientation() const
wxString GetShownNumber() const
int GetNumberTextSize() const
wxString GetShownName() const
void SetOperatingPoint(const wxString &aText)
VECTOR2I GetPosition() const override
const wxString & GetOperatingPoint() const
wxString const GetElectricalTypeName() const
GRAPHIC_PINSHAPE GetShape() const
int GetNameTextSize() const
STROKE_PARAMS GetStroke() const
VECTOR2I GetPosition() const override
virtual std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the LIB_SHAPE.
Define a library symbol object.
int GetPinNameOffset() const
bool ShowPinNames() const
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
void AddDrawItem(LIB_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
void GetPins(LIB_PINS &aList, int aUnit=0, int aConvert=0) const
Return a list of pin object pointers from the draw item list.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
bool ShowPinNumbers() const
VECTOR2I GetDrawPos() const override
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
Define a symbol library graphical text item.
const BOX2I GetBoundingBox() const override
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.
PLOT_DASH_TYPE 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.
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.
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
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
bool RenderAsBitmap(double aWorldScale) const override
bool IsConnectivityDirty() const
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
const KIFONT::METRICS & GetFontMetrics() const
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)
VECTOR2I GetMidPoint() const
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
bool IsEndDangling() const
void SetLineStyle(const PLOT_DASH_TYPE aStyle)
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
PLOT_DASH_TYPE GetEffectiveLineStyle() const
void SetEndPoint(const VECTOR2I &aPosition)
const wxString & GetOperatingPoint() const
SCH_LAYER_ID GetColorLayer() const
VECTOR2I GetPosition() const override
VECTOR2I GetPosition() const override
const wxString & GetOperatingPoint() const
bool IsDangling() const override
wxString GetShownName() const
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
PLOT_DASH_TYPE GetEffectiveLineStyle() const
VECTOR2I GetCenter() 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.
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...
const std::vector< VECTOR2I > & CPoints() const
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.
An abstract shape on 2D plane.
static void Stroke(const SHAPE *aShape, PLOT_DASH_TYPE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, std::function< void(const VECTOR2I &a, const VECTOR2I &b)> aStroker)
KIGFX::COLOR4D GetColor() const
PLOT_DASH_TYPE GetPlotStyle() const
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
#define DEFAULT_LABEL_SIZE_RATIO
The offset of the pin name string from the end of the pin in mils.
#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 DEFAULT_TEXT_OFFSET_RATIO
Ratio of the font height to space around global labels.
#define DEFAULT_TEXT_SIZE
Ratio of the font height to the baseline of the text above the wire.
#define UNSELECTED_END_SIZE
The default pin len value when creating pins(can be changed in preference menu)
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
static constexpr EDA_ANGLE & ANGLE_VERTICAL
static constexpr EDA_ANGLE & ANGLE_90
static constexpr EDA_ANGLE & ANGLE_0
#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.
double m_MinPlotPenWidth
Sets an absolute minimum pen width for plotting.
@ LAYER_DRAW_BITMAPS
to handle and draw images bitmaps
@ LAYER_AUX_ITEMS
Auxiliary items (guides, rule, etc)
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SELECTION_SHADOWS
@ LAYER_SCHEMATIC_BACKGROUND
@ LAYER_SCHEMATIC_AUX_ITEMS
std::vector< LIB_PIN * > LIB_PINS
Helper for defining a list of pin object pointers.
static int externalPinDecoSize(const RENDER_SETTINGS *aSettings, const LIB_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
static int internalPinDecoSize(const RENDER_SETTINGS *aSettings, const LIB_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
#define TARGET_PIN_RADIUS
#define UNIMPLEMENTED_FOR(type)
The Cairo implementation of the graphics abstraction layer.
static LIB_SYMBOL * dummy()
Used when a LIB_SYMBOL is not found in library to draw a dummy shape.
EESCHEMA_SETTINGS * eeconfig()
static bool isFieldsLayer(int aLayer)
static void orientSymbol(LIB_SYMBOL *symbol, int orientation)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ OUTSIDE
Text appears outside the dimension line (default)
@ PT_NC
not connected (must be left open)
PIN_ORIENTATION
The symbol library pin object orientations.
#define TARGET_BUSENTRY_RADIUS
#define BITMAP_FONT_SIZE_THRESHOLD
std::vector< FAB_LAYER_COLOR > dummy
wxString UnescapeString(const wxString &aSource)
PLOT_DASH_TYPE
Dashed line types.
constexpr int MilsToIU(int mils) const
constexpr int mmToIU(double mm) const
Definition for symbol library class.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
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