98 m_IsSymbolEditor( false ),
101 m_ShowPinsElectricalType( true ),
102 m_ShowPinNumbers( false ),
103 m_ShowDisabled( false ),
104 m_ShowGraphicsDisabled( false ),
105 m_OverrideItemColors( false ),
175 text->SetText( wxString( wxT(
"??" ) ) );
187 m_schematic( nullptr )
197 draw( item, aLayer,
false );
205#ifdef CONNECTIVITY_DEBUG
207 auto sch_item =
dynamic_cast<const SCH_ITEM*
>( aItem );
208 auto conn = sch_item ? sch_item->
Connection( *g_CurrentSheet ) :
nullptr;
213 auto label = conn->Name(
true );
220 m_gal->StrokeText( conn->Name(
true ), pos, 0.0, 0 );
235 :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
240 switch( aItem->
Type() )
246 draw(
static_cast<const LIB_SHAPE*
>( aItem ), aLayer, aDimmed );
249 draw(
static_cast<const LIB_PIN*
>( aItem ), aLayer, aDimmed );
252 draw(
static_cast<const LIB_FIELD*
>( aItem ), aLayer, aDimmed );
255 draw(
static_cast<const LIB_TEXT*
>( aItem ), aLayer, aDimmed );
285 draw(
static_cast<const SCH_FIELD*
>( aItem ), aLayer, aDimmed );
380 color =
static_cast<const SCH_LINE*
>( aItem )->GetLineColor();
450 else if(
const EDA_TEXT* otherTextItem =
dynamic_cast<const EDA_TEXT*
>( aItem ) )
452 color = otherTextItem->GetTextColor();
457 color = m_schSettings.GetLayerColor( aLayer );
459 if( aItem->IsBrightened() )
463 if( aDrawingShadows )
465 if( aItem->IsSelected() )
475 else if( aItem->IsSelected() && aDrawingShadows )
477 if( aDrawingShadows )
480 else if( aItem->IsSelected()
488 if( m_schSettings.m_ShowDisabled
489 || ( m_schSettings.m_ShowGraphicsDisabled && aItem->Type() !=
LIB_FIELD_T ) )
494 if( aDimmed && !( aItem->IsSelected() && aDrawingShadows ) )
505float SCH_PAINTER::getLineWidth(
const EDA_ITEM* aItem,
bool aDrawingShadows )
const
511 if(
dynamic_cast<const LIB_ITEM*
>( aItem ) )
512 pen =
static_cast<const LIB_ITEM*
>( aItem )->GetEffectivePenWidth( &m_schSettings );
513 else if(
dynamic_cast<const SCH_ITEM*
>( aItem ) )
522 if( aDrawingShadows && aItem->
IsType( g_ScaledSelectionTypes ) )
530float SCH_PAINTER::getTextThickness(
const EDA_ITEM* aItem )
const
532 int pen = m_schSettings.GetDefaultPenWidth();
534 switch( aItem->
Type() )
537 pen =
static_cast<const SCH_FIELD*
>( aItem )->GetEffectiveTextPenWidth( pen );
541 pen =
static_cast<const SCH_TEXT*
>( aItem )->GetEffectiveTextPenWidth( pen );
549 pen =
static_cast<const SCH_LABEL_BASE*
>( aItem )->GetEffectiveTextPenWidth( pen );
553 pen =
static_cast<const SCH_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth( pen );
557 pen = std::max( pen,
static_cast<const LIB_FIELD*
>( aItem )->GetEffectiveTextPenWidth() );
561 pen = std::max( pen,
static_cast<const LIB_TEXT*
>( aItem )->GetEffectiveTextPenWidth() );
565 pen = std::max( pen,
static_cast<const LIB_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth() );
576int SCH_PAINTER::getOperatingPointTextSize()
const
579 int screenTextSize =
std::abs( (
int) m_gal->GetScreenWorldMatrix().GetScale().y * 7 );
582 return KiROUND( ( docTextSize + screenTextSize * 2 ) / 3 );
605void SCH_PAINTER::strokeText(
const wxString& aText,
const VECTOR2D& aPosition,
617 m_gal->SetIsStroke( font->
IsStroke() );
619 font->
Draw( m_gal, aText, aPosition, aAttrs );
623void SCH_PAINTER::bitmapText(
const wxString& aText,
const VECTOR2D& aPosition,
631 m_gal->SetHorizontalJustify( aAttrs.
m_Halign );
632 m_gal->SetVerticalJustify( aAttrs.
m_Valign );
634 m_gal->BitmapText( aText, aPosition, aAttrs.
m_Angle );
638void SCH_PAINTER::knockoutText(
const wxString& aText,
const VECTOR2D& aPosition,
661 callback_gal.SetIsStroke(
true );
663 font->
Draw( &callback_gal, aText, aPosition, attrs );
677 m_gal->SetIsStroke(
false );
678 m_gal->SetIsFill(
true );
679 m_gal->SetFillColor( attrs.
m_Color );
680 m_gal->DrawPolygon( finalPoly );
684void SCH_PAINTER::boxText(
const wxString& aText,
const VECTOR2D& aPosition,
720 m_gal->SetIsFill(
true );
721 m_gal->SetIsStroke(
false );
728 m_gal->DrawLine( a, b );
729 m_gal->DrawLine( b, c );
733void SCH_PAINTER::draw(
const LIB_SYMBOL *aSymbol,
int aLayer,
bool aDrawFields,
int aUnit,
734 int aConvert,
bool aDimmed )
737 aUnit = m_schSettings.m_ShowUnit;
740 aConvert = m_schSettings.m_ShowConvert;
742 std::unique_ptr< LIB_SYMBOL > tmpSymbol;
747 tmpSymbol = aSymbol->
Flatten();
748 drawnSymbol = tmpSymbol.get();
756 if( aUnit && item.GetUnit() && aUnit != item.GetUnit() )
759 if( aConvert && item.GetConvert() && aConvert != item.GetConvert() )
762 draw( &item, aLayer, aDimmed );
767bool SCH_PAINTER::setDeviceColors(
const LIB_ITEM* aItem,
int aLayer,
bool aDimmed )
776 m_gal->SetIsFill(
false );
777 m_gal->SetIsStroke(
true );
778 m_gal->SetLineWidth( getLineWidth( aItem,
true ) );
779 m_gal->SetStrokeColor( getRenderColor( aItem,
LAYER_DEVICE,
true, aDimmed ) );
780 m_gal->SetFillColor( getRenderColor( aItem,
LAYER_DEVICE,
true, aDimmed ) );
796 m_gal->SetIsFill(
true );
798 m_gal->SetIsStroke(
false );
812 m_gal->SetFillColor( getRenderColor( aItem,
LAYER_DEVICE,
false, aDimmed ) );
820 fillColour = fillColour.
Mix(
825 m_gal->SetFillColor( fillColour );
830 m_gal->SetIsStroke(
true );
831 m_gal->SetLineWidth( getLineWidth( aItem,
false ) );
832 m_gal->SetStrokeColor( getRenderColor( aItem, aLayer,
false, aDimmed ) );
836 m_gal->SetIsStroke(
false );
847void SCH_PAINTER::draw(
const LIB_SHAPE *aShape,
int aLayer,
bool aDimmed )
849 if( !isUnitAndConversionShown( aShape ) )
852 if( aShape->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
855 if( !setDeviceColors( aShape, aLayer, aDimmed ) )
860 COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows, aDimmed );
865 switch( shape->GetShape() )
871 shape->CalcArcAngles( startAngle, endAngle );
875 m_gal->DrawArc(
mapCoords( shape->GetCenter() ), shape->GetRadius(),
876 startAngle, endAngle );
881 m_gal->DrawCircle(
mapCoords( shape->GetPosition() ), shape->GetRadius() );
885 m_gal->DrawRectangle(
mapCoords( shape->GetPosition() ),
892 std::deque<VECTOR2D> mappedPts;
897 m_gal->DrawPolygon( mappedPts );
903 std::deque<VECTOR2D> mappedPts;
905 for(
const VECTOR2I& p : shape->GetBezierPoints() )
908 m_gal->DrawPolygon( mappedPts );
919 if(
eeconfig()->m_Selection.fill_shapes )
924 m_gal->SetIsFill( aShape->
IsFilled() );
926 m_gal->SetIsFill(
true );
930 m_gal->SetIsStroke(
true );
931 m_gal->SetIsFill(
false );
932 m_gal->SetLineWidth( getLineWidth( aShape,
true ) );
933 m_gal->SetStrokeColor(
color );
942 m_gal->SetIsFill(
true );
943 m_gal->SetIsStroke(
false );
949 float lineWidth = getLineWidth( aShape, drawingShadows );
953 m_gal->SetIsFill(
false );
954 m_gal->SetIsStroke(
true );
955 m_gal->SetLineWidth( lineWidth );
956 m_gal->SetStrokeColor(
color );
966 for(
SHAPE* shape : shapes )
979 for(
SHAPE* shape : shapes )
987 m_gal->SetIsFill(
true );
988 m_gal->SetIsStroke(
false );
995void SCH_PAINTER::draw(
const LIB_FIELD *aField,
int aLayer,
bool aDimmed )
1002 if( !isUnitAndConversionShown( aField ) )
1009 bool foundLayer =
false;
1013 for(
int i = 0; i < layers_count; ++i )
1015 if( layers[i] == aLayer )
1022 COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
1026 if( m_schSettings.m_IsSymbolEditor ||
eeconfig()->m_Appearance.show_hidden_fields )
1032 m_gal->SetStrokeColor(
color );
1033 m_gal->SetFillColor(
color );
1037 if( drawingShadows && getFont( aField )->IsOutline() )
1041 m_gal->SetIsStroke(
false );
1042 m_gal->SetIsFill(
true );
1054 if( drawingShadows )
1061 if( aField->
IsMoving() && m_schematic )
1063 m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
1070void SCH_PAINTER::draw(
const LIB_TEXT* aText,
int aLayer,
bool aDimmed )
1072 if( !isUnitAndConversionShown( aText ) )
1075 if( aText->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1083 COLOR4D color = getRenderColor( aText, aLayer, drawingShadows, aDimmed );
1087 if( !m_schematic ||
eeconfig()->m_Appearance.show_hidden_fields )
1095 m_gal->SetFillColor(
color );
1096 m_gal->SetStrokeColor(
color );
1098 if( drawingShadows && getFont( aText )->IsOutline() )
1102 m_gal->SetIsStroke(
false );
1103 m_gal->SetIsFill(
true );
1114 if( drawingShadows )
1140 strokeText( shownText, pos, attrs );
1145void SCH_PAINTER::draw(
const LIB_TEXTBOX* aTextBox,
int aLayer,
bool aDimmed )
1147 if( !isUnitAndConversionShown( aTextBox ) )
1150 if( aTextBox->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1159 COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows, aDimmed );
1160 float borderWidth = getLineWidth( aTextBox, drawingShadows );
1171 strokeText( shownText, aTextBox->
GetDrawPos(), attrs );
1174 m_gal->SetStrokeColor(
color );
1175 m_gal->SetFillColor(
color );
1179 m_gal->SetIsFill(
true );
1180 m_gal->SetIsStroke(
false );
1181 m_gal->SetLineWidth( borderWidth );
1190 m_gal->SetIsFill(
true );
1191 m_gal->SetIsStroke(
false );
1192 m_gal->SetLineWidth( borderWidth );
1202 if( borderWidth > 0 )
1207 if( m_schSettings.m_OverrideItemColors || aTextBox->
IsBrightened()
1208 || borderColor == COLOR4D::UNSPECIFIED )
1210 borderColor = m_schSettings.GetLayerColor( aLayer );
1216 borderColor = borderColor.
Mix( bg, 0.5f );
1219 m_gal->SetIsFill(
false );
1220 m_gal->SetIsStroke(
true );
1221 m_gal->SetStrokeColor( borderColor );
1222 m_gal->SetLineWidth( borderWidth );
1233 for(
SHAPE* shape : shapes )
1247 for(
SHAPE* shape : shapes )
1257 if( m_schSettings.m_PinSymbolSize > 0 )
1258 return m_schSettings.m_PinSymbolSize;
1268 if( m_schSettings.m_PinSymbolSize > 0 )
1269 return m_schSettings.m_PinSymbolSize;
1277 bool aDrawingShadows,
bool aBrightened )
1281 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
1283 m_gal->SetIsFill(
false );
1284 m_gal->SetIsStroke(
true );
1285 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
1286 : m_schSettings.GetDanglineSymbolThickness() );
1292void SCH_PAINTER::draw(
const LIB_PIN *aPin,
int aLayer,
bool aDimmed )
1294 if( !isUnitAndConversionShown( aPin ) )
1310 if( !m_schematic ||
eeconfig()->m_Appearance.show_hidden_pins )
1318 if( drawingDangling )
1357 int textSize = getOperatingPointTextSize();
1359 int textOffset =
KiROUND( textSize * 0.22 );
1362 if( len > textSize )
1366 mid.
x +=
KiROUND( textOffset * 1.2 );
1371 mid.
y -=
KiROUND( textOffset * 1.2 );
1391 m_gal->SetIsStroke(
true );
1392 m_gal->SetIsFill(
false );
1393 m_gal->SetLineWidth( getLineWidth( aPin, drawingShadows ) );
1394 m_gal->SetStrokeColor(
color );
1395 m_gal->SetFontBold(
false );
1396 m_gal->SetFontUnderlined(
false );
1397 m_gal->SetFontItalic(
false );
1400 const int diam = radius*2;
1405 m_gal->DrawLine( p0, pos );
1417 m_gal->DrawLine( p0, pos );
1421 m_gal->DrawCircle( p0 + dir * radius, radius );
1422 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1426 pc = p0 - dir * clock_size ;
1428 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1430 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1432 m_gal->DrawCircle( p0 + dir * radius, radius );
1433 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1438 pc = p0 - dir * clock_size ;
1440 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1442 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1446 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1452 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1457 m_gal->DrawLine( p0, pos );
1461 m_gal->DrawLine( p0, pos );
1465 triLine( p0 +
VECTOR2D( 0, clock_size ),
1466 p0 +
VECTOR2D( -dir.
x * clock_size, 0 ),
1471 triLine( p0 +
VECTOR2D( clock_size, 0 ),
1472 p0 +
VECTOR2D( 0, -dir.
y * clock_size ),
1478 m_gal->DrawLine( p0, pos );
1482 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1488 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1495 m_gal->DrawLine( p0, pos );
1504 m_gal->DrawLine( p0, pos );
1506 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius,
1507 p0 +
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius );
1508 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius,
1509 p0 +
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius );
1520 if( drawingShadows && !
eeconfig()->m_Selection.draw_selected_children )
1524 float penWidth = (float) m_schSettings.GetDefaultPenWidth();
1526 float nameStrokeWidth = getLineWidth( aPin,
false );
1527 float numStrokeWidth = getLineWidth( aPin,
false );
1529 bool showPinNumbers = m_schSettings.m_ShowPinNumbers || libEntry->
ShowPinNumbers();
1537 enum { INSIDE = 0,
OUTSIDE, ABOVE, BELOW };
1538 int size[4] = { 0, 0, 0, 0 };
1539 float thickness[4] = { numStrokeWidth, numStrokeWidth, numStrokeWidth, numStrokeWidth };
1547 thickness[INSIDE] = nameStrokeWidth;
1548 colour [INSIDE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1552 thickness[ABOVE] = numStrokeWidth;
1553 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1560 thickness[ABOVE] = nameStrokeWidth;
1561 colour [ABOVE] = getRenderColor( aPin,
LAYER_PINNAM, drawingShadows, aDimmed );
1565 thickness[BELOW] = numStrokeWidth;
1566 colour [BELOW] = getRenderColor( aPin,
LAYER_PINNUM, drawingShadows, aDimmed );
1570 if( m_schSettings.m_ShowPinsElectricalType )
1582 #define BITMAP_FONT_SIZE_THRESHOLD 3.5
1592 c = getRenderColor( aPin,
LAYER_HIDDEN, drawingShadows, aDimmed );
1595 float insideOffset = (float) textOffset - thickness[INSIDE] / 2.0f;
1597 float aboveOffset =
PIN_TEXT_MARGIN + penWidth / 2.0f + thickness[ABOVE] / 2.0f;
1598 float belowOffset =
PIN_TEXT_MARGIN + penWidth / 2.0f + thickness[BELOW] / 2.0f;
1603 if( drawingShadows )
1605 float shadowWidth = getShadowWidth( aPin->
IsBrightened() );
1607 for(
float& t : thickness )
1615 if(
text[i].IsEmpty() )
1619 m_gal->SetStrokeColor( colour[i] );
1620 m_gal->SetFillColor( colour[i] );
1631 if( drawingShadows && !font->
IsOutline() )
1633 strokeText(
text[i], aPos, attrs );
1635 else if( drawingShadows )
1637 boxText(
text[i], aPos, attrs );
1639 else if( nonCached( aPin ) && renderTextAsBitmap )
1641 bitmapText(
text[i], aPos, attrs );
1646 strokeText(
text[i], aPos, attrs );
1656 drawText( INSIDE, pos +
VECTOR2D( -insideOffset - (
float) len, 0 ),
1666 drawText( ABOVE, pos +
VECTOR2D( -len / 2.0, -aboveOffset ),
1671 drawText( BELOW, pos +
VECTOR2D( -len / 2.0, belowOffset ),
1679 drawText( INSIDE, pos +
VECTOR2D( insideOffset + (
float) len, 0 ),
1689 drawText( ABOVE, pos +
VECTOR2D( len / 2.0, -aboveOffset ),
1694 drawText( BELOW, pos +
VECTOR2D( len / 2.0, belowOffset ),
1702 drawText( INSIDE, pos +
VECTOR2D( 0, insideOffset + (
float) len ),
1712 drawText( ABOVE, pos +
VECTOR2D( -aboveOffset, len / 2.0 ),
1717 drawText( BELOW, pos +
VECTOR2D( belowOffset, len / 2.0 ),
1725 drawText( INSIDE, pos +
VECTOR2D( 0, -insideOffset - (
float) len ),
1735 drawText( ABOVE, pos +
VECTOR2D( -aboveOffset, -len / 2.0 ),
1740 drawText( BELOW, pos +
VECTOR2D( belowOffset, -len / 2.0 ),
1746 wxFAIL_MSG(
"Unknown pin orientation" );
1753void SCH_PAINTER::drawDanglingSymbol(
const VECTOR2I& aPos,
const COLOR4D& aColor,
int aWidth,
1754 bool aDangling,
bool aDrawingShadows,
bool aBrightened )
1766 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
1767 m_gal->SetIsStroke(
true );
1768 m_gal->SetIsFill(
false );
1769 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
1770 : m_schSettings.GetDanglineSymbolThickness() );
1772 m_gal->DrawRectangle( aPos - radius, aPos + radius );
1787 if( junctionSize > 1 )
1789 m_gal->SetIsStroke( drawingShadows );
1790 m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
1791 m_gal->SetStrokeColor(
color );
1792 m_gal->SetIsFill( !drawingShadows );
1793 m_gal->SetFillColor(
color );
1794 m_gal->DrawCircle( aJct->
GetPosition(), junctionSize );
1799void SCH_PAINTER::draw(
const SCH_LINE *aLine,
int aLayer )
1810 if( aLine->
IsNew() && drawingDangling )
1814 float width = getLineWidth( aLine, drawingShadows );
1817 if( ( drawingDangling || drawingShadows ) && !aLine->
IsNew() )
1825 KiROUND( getLineWidth( aLine, drawingShadows ) ),
1835 drawDanglingSymbol( aLine->
GetEndPoint(), danglingColor,
1836 KiROUND( getLineWidth( aLine, drawingShadows ) ),
1842 if( drawingDangling )
1847 int textSize = getOperatingPointTextSize();
1849 int textOffset =
KiROUND( textSize * 0.22 );
1854 pos.
y -= textOffset;
1860 pos.
x +=
KiROUND( textOffset * 1.2 );
1874 m_gal->SetIsStroke(
true );
1875 m_gal->SetStrokeColor(
color );
1876 m_gal->SetLineWidth( width );
1892 m_gal->DrawLine( a+1, b );
1894 m_gal->DrawLine( a, b );
1900void SCH_PAINTER::draw(
const SCH_SHAPE* aShape,
int aLayer )
1904 COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows );
1912 switch( shape->GetShape() )
1926 m_gal->DrawCircle( shape->GetPosition(), shape->GetRadius() );
1930 m_gal->DrawRectangle( shape->GetPosition(), shape->GetEnd() );
1935 std::deque<VECTOR2D> pts;
1937 for(
const VECTOR2I& pt : shape->GetPolyShape().Outline( 0 ).CPoints() )
1938 pts.push_back( pt );
1940 m_gal->DrawPolygon( pts );
1946 std::deque<VECTOR2D> pts;
1948 for(
const VECTOR2I &p : shape->GetPolyShape().Outline( 0 ).CPoints() )
1951 m_gal->DrawPolygon( pts );
1962 if(
eeconfig()->m_Selection.fill_shapes )
1967 m_gal->SetIsFill( aShape->
IsFilled() );
1969 m_gal->SetIsFill(
true );
1971 m_gal->SetIsStroke(
false );
1972 m_gal->SetFillColor(
color );
1976 m_gal->SetIsStroke(
true );
1977 m_gal->SetIsFill(
false );
1978 m_gal->SetLineWidth( getLineWidth( aShape,
true ) );
1979 m_gal->SetStrokeColor(
color );
1982 drawShape( aShape );
1988 m_gal->SetIsFill(
true );
1989 m_gal->SetIsStroke(
false );
1990 m_gal->SetFillColor(
color );
1992 drawShape( aShape );
1997 float lineWidth = getLineWidth( aShape, drawingShadows );
2001 m_gal->SetIsFill(
false );
2002 m_gal->SetIsStroke(
true );
2003 m_gal->SetLineWidth( lineWidth );
2004 m_gal->SetStrokeColor(
color );
2008 drawShape( aShape );
2014 for(
SHAPE* shape : shapes )
2021 m_gal->DrawLine( a+1, b );
2023 m_gal->DrawLine( a, b );
2027 for(
SHAPE* shape : shapes )
2035void SCH_PAINTER::draw(
const SCH_TEXT *aText,
int aLayer )
2043 switch( aText->
Type() )
2053 COLOR4D color = getRenderColor( aText, aLayer, drawingShadows );
2062 if( conn && conn->
IsBus() )
2068 if( !m_schematic ||
eeconfig()->m_Appearance.show_hidden_fields )
2074 if( drawingDangling )
2086 m_gal->SetStrokeColor(
color );
2087 m_gal->SetFillColor(
color );
2097 if( drawingShadows && !font->
IsOutline() )
2099 m_gal->SetIsFill(
false );
2100 m_gal->SetIsStroke(
true );
2103 strokeText( shownText, aText->
GetDrawPos() + text_offset, attrs );
2106 else if( drawingShadows )
2112 m_gal->SetIsStroke(
false );
2113 m_gal->SetIsFill(
true );
2120 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2121 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2131 int adjust =
KiROUND( sizeDiff * 0.4 );
2132 VECTOR2I adjust_offset( 0, - adjust );
2135 text_offset += adjust_offset;
2138 if( nonCached( aText )
2140 && !shownText.Contains( wxT(
"\n" ) ) )
2142 bitmapText( shownText, aText->
GetDrawPos() + text_offset, attrs );
2147 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2154 for(
const std::unique_ptr<KIFONT::GLYPH>& glyph : *cache )
2155 m_gal->DrawGlyph( *glyph );
2159 strokeText( shownText, aText->
GetDrawPos() + text_offset, attrs );
2171 COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows );
2172 float borderWidth = getLineWidth( aTextBox, drawingShadows );
2193 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2194 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2198 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2205 for(
const std::unique_ptr<KIFONT::GLYPH>& glyph : *cache )
2206 m_gal->DrawGlyph( *glyph );
2210 strokeText( shownText, aTextBox->
GetDrawPos(), attrs );
2217 m_gal->SetFillColor(
color );
2218 m_gal->SetStrokeColor(
color );
2222 m_gal->SetIsFill(
true );
2223 m_gal->SetIsStroke(
false );
2224 m_gal->SetLineWidth( borderWidth );
2232 m_gal->SetIsFill(
true );
2233 m_gal->SetIsStroke(
false );
2234 m_gal->SetLineWidth( borderWidth );
2243 if( borderWidth > 0 )
2248 if( m_schSettings.m_OverrideItemColors || aTextBox->
IsBrightened()
2249 || borderColor == COLOR4D::UNSPECIFIED )
2251 borderColor = m_schSettings.GetLayerColor( aLayer );
2254 m_gal->SetIsFill(
false );
2255 m_gal->SetIsStroke(
true );
2256 m_gal->SetStrokeColor( borderColor );
2257 m_gal->SetLineWidth( borderWidth );
2267 for(
SHAPE* shape : shapes )
2275 m_gal->DrawLine( a+1, b );
2277 m_gal->DrawLine( a, b );
2281 for(
SHAPE* shape : shapes )
2314 ORIENT o = orientations[ 0 ];
2316 for( ORIENT& i : orientations )
2318 if( i.flag == orientation )
2327 for(
int i = 0; i < o.n_rots; i++ )
2328 item.Rotate(
VECTOR2I(0, 0 ),
true );
2331 item.MirrorVertical(
VECTOR2I( 0, 0 ) );
2334 item.MirrorHorizontal(
VECTOR2I( 0, 0 ) );
2341 std::function<bool( wxString* )> symbolResolver =
2342 [&]( wxString* token ) ->
bool
2355 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2358 draw( &field, aLayer, aSymbol->
GetDNP() );
2390 tempItem.SetFlags( aSymbol->
GetFlags() );
2410 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2413 LIB_PIN* tempPin = tempPins[ i ];
2433 for(
unsigned i = 0; i < tempPins.size(); ++i )
2436 LIB_PIN* tempPin = tempPins[ i ];
2452 m_gal->AdvanceDepth();
2453 m_gal->SetIsStroke(
true );
2454 m_gal->SetIsFill(
true );
2459 std::swap( pt1.
x, pt2.
x );
2466void SCH_PAINTER::draw(
const SCH_FIELD* aField,
int aLayer,
bool aDimmed )
2473 if( !drawingShadows && aField->
GetLayer() != aLayer )
2478 COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
2482 if( !m_schematic ||
eeconfig()->m_Appearance.show_hidden_fields )
2490 if( shownText.IsEmpty() )
2526 if( m_schSettings.GetDrawBoundingBoxes() )
2528 m_gal->SetIsFill(
false );
2529 m_gal->SetIsStroke(
true );
2531 :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
2536 m_gal->SetStrokeColor(
color );
2537 m_gal->SetFillColor(
color );
2539 if( drawingShadows && getFont( aField )->IsOutline() )
2541 BOX2I shadow_box = bbox;
2545 m_gal->SetIsStroke(
false );
2546 m_gal->SetIsFill(
true );
2559 if( drawingShadows )
2564 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2565 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2569 if( nonCached( aField ) && aField->
RenderAsBitmap( m_gal->GetWorldScale() ) )
2571 bitmapText( shownText, textpos, attributes );
2576 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2579 cache = aField->
GetRenderCache( shownText, textpos, attributes );
2583 for(
const std::unique_ptr<KIFONT::GLYPH>& glyph : *cache )
2584 m_gal->DrawGlyph( *glyph );
2588 strokeText( shownText, textpos, attributes );
2600 m_gal->SetLineWidth( m_schSettings.m_outlineWidth );
2602 m_gal->DrawLine( bbox.
Centre(), parentPos );
2611 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2614 draw( &field, aLayer,
false );
2625 std::vector<VECTOR2I> pts;
2626 std::deque<VECTOR2D> pts2;
2631 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2639 m_gal->SetIsFill( fillBg );
2641 m_gal->SetIsStroke(
true );
2642 m_gal->SetLineWidth( getTextThickness( aLabel ) );
2643 m_gal->SetStrokeColor(
color );
2644 m_gal->DrawPolyline( pts2 );
2646 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer );
2650void SCH_PAINTER::draw(
const SCH_LABEL *aLabel,
int aLayer )
2654 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2657 draw( &field, aLayer,
false );
2666 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer );
2674 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2677 draw( &field, aLayer,
false );
2695 if( conn && conn->
IsBus() )
2699 std::vector<VECTOR2I> pts;
2700 std::deque<VECTOR2D> pts2;
2705 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2707 m_gal->SetIsFill(
true );
2709 m_gal->SetIsStroke(
true );
2710 m_gal->SetLineWidth( getTextThickness( aLabel ) );
2711 m_gal->SetStrokeColor(
color );
2712 m_gal->DrawPolyline( pts2 );
2714 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer );
2722 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2725 draw( &field, aLayer,
false );
2748 std::vector<VECTOR2I> pts;
2749 std::deque<VECTOR2D> pts2;
2754 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2756 m_gal->SetIsFill(
false );
2757 m_gal->SetFillColor(
color );
2758 m_gal->SetIsStroke(
true );
2759 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2760 m_gal->SetStrokeColor(
color );
2764 m_gal->DrawLine( pts2[0], pts2[1] );
2765 m_gal->SetIsFill(
true );
2766 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).
EuclideanNorm() );
2770 m_gal->DrawLine( pts2[0], pts2[1] );
2771 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).
EuclideanNorm() );
2775 m_gal->DrawPolyline( pts2 );
2780void SCH_PAINTER::draw(
const SCH_SHEET *aSheet,
int aLayer )
2784 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2787 draw( &field, aLayer,
false );
2797 if( drawingShadows )
2800 &&
eeconfig()->m_Selection.draw_selected_children )
2804 else if( sheetPin->IsBrightened() || sheetPin->IsSelected() )
2814 int width = std::max( aSheet->
GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
2815 VECTOR2I initial_pos = sheetPin->GetTextPos();
2819 switch( sheetPin->GetSide() )
2828 sheetPin->SetTextPos( offset_pos );
2830 m_gal->DrawLine( offset_pos, initial_pos );
2831 sheetPin->SetTextPos( initial_pos );
2841 m_gal->SetIsFill(
true );
2842 m_gal->SetIsStroke(
false );
2844 m_gal->DrawRectangle( pos, pos + size );
2849 m_gal->SetStrokeColor( getRenderColor( aSheet,
LAYER_SHEET, drawingShadows ) );
2850 m_gal->SetIsStroke(
true );
2851 m_gal->SetLineWidth( getLineWidth( aSheet, drawingShadows ) );
2852 m_gal->SetIsFill(
false );
2854 m_gal->DrawRectangle( pos, pos + size );
2866 m_gal->SetIsStroke(
true );
2867 m_gal->SetLineWidth( getLineWidth( aNC, drawingShadows ) );
2868 m_gal->SetStrokeColor( getRenderColor( aNC,
LAYER_NOCONNECT, drawingShadows ) );
2869 m_gal->SetIsFill(
false );
2872 int delta = std::max( aNC->
GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
2908 if( drawingDangling )
2910 m_gal->SetIsFill(
false );
2911 m_gal->SetIsStroke(
true );
2912 m_gal->SetStrokeColor(
color.Brightened( 0.3 ) );
2913 m_gal->SetLineWidth( drawingShadows ? getShadowWidth( aEntry->
IsBrightened() )
2914 : m_schSettings.GetDanglineSymbolThickness() );
2924 m_gal->DrawCircle( aEntry->
GetEnd(),
2933 draw( &line, aLayer );
2947 if( img_scale != 1.0 )
2948 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
2952 m_gal->DrawBitmap( *aBitmap->
GetImage() );
2960 m_gal->SetIsStroke(
true );
2961 m_gal->SetStrokeColor(
color );
2962 m_gal->SetLineWidth ( getShadowWidth( aBitmap->
IsBrightened() ) );
2963 m_gal->SetIsFill(
false );
2970 bm_size.
x /= img_scale;
2971 bm_size.
y /= img_scale;
2972 VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
2975 m_gal->DrawRectangle( origin, end );
2994 m_gal->SetIsFill( !drawingShadows );
2995 m_gal->SetFillColor(
color );
2996 m_gal->SetIsStroke( drawingShadows );
2997 m_gal->SetLineWidth( getLineWidth( aMarker, drawingShadows ) );
2998 m_gal->SetStrokeColor(
color );
3003 m_gal->DrawPolygon( polygon );
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 void SetText(const wxString &aText)
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const
Return the string actually shown after processing of the base text.
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)
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttrs) const
Draw a string.
virtual bool IsStroke() const
virtual bool IsOutline() const
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic) 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.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
The base class for drawable items used by schematic library symbols.
virtual int GetPenWidth() const =0
LIB_SYMBOL * GetParent() const
void SetShape(GRAPHIC_PINSHAPE aShape)
ELECTRICAL_PINTYPE GetType() const
int GetOrientation() const
void SetName(const wxString &aName)
void SetType(ELECTRICAL_PINTYPE aType)
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(int aDepth=0, bool aAllowExtraText=true) 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
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,...
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) 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.
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
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
virtual bool IsDangling() 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.
int GetEffectiveDiameter() const
VECTOR2I GetPosition() const override
bool IsDangling() const override
LABEL_FLAG_SHAPE GetShape() const override
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.
int GetPenWidth() const override
std::vector< SCH_FIELD > & GetFields()
VECTOR2I GetPosition() const override
KIGFX::COLOR4D GetBorderColor() const
std::vector< SCH_SHEET_PIN * > & GetPins()
KIGFX::COLOR4D GetBackgroundColor() const
bool ResolveTextVar(wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
VECTOR2I GetPosition() const override
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.
VECTOR2I GetDrawPos() const override
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) 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.
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 intersection For aFastMode meaning, see function booleanOp.
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
int NewOutline()
Creates a new hole in a given outline.
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
#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.
@ 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 VECTOR2D mapCoords(const VECTOR2D &aCoord)
static bool isFieldsLayer(int aLayer)
static void orientSymbol(LIB_SYMBOL *symbol, int orientation)
wxString expandLibItemTextVars(const wxString &aSourceText, const SCH_SYMBOL *aSymbolContext)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ OUTSIDE
Text appears outside the dimension line (default)
@ PT_NC
not connected (must be left open)
#define TARGET_BUSENTRY_RADIUS
#define BITMAP_FONT_SIZE_THRESHOLD
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
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)
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