138 m_schematic( nullptr )
149 draw( item, aLayer,
false );
157#ifdef CONNECTIVITY_DEBUG
159 auto sch_item =
dynamic_cast<const SCH_ITEM*
>( aItem );
160 auto conn = sch_item ? sch_item->
Connection( *g_CurrentSheet ) :
nullptr;
165 auto label = conn->Name(
true );
172 m_gal->StrokeText( *
m_gal, conn->Name(
true ), pos, 0.0, 0 );
180 switch( aItem->
Type() )
186 drawBoundingBox =
false;
187 draw(
static_cast<const SCH_PIN*
>( aItem ), aLayer, aDimmed );
199 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
202 draw(
static_cast<const SCH_SHAPE*
>( aItem ), aLayer, aDimmed );
205 draw(
static_cast<const SCH_TEXT*
>( aItem ), aLayer, aDimmed );
211 draw(
static_cast<const SCH_TABLE*
>( aItem ), aLayer, aDimmed );
220 draw(
static_cast<const SCH_FIELD*
>( aItem ), aLayer, aDimmed );
253 if( drawBoundingBox )
269 box =
static_cast<const SCH_SYMBOL*
>( aItem )->GetBodyBoundingBox();
274 :
COLOR4D( 0.2, 0.2, 0.2, 1 ) );
343 color =
static_cast<const SCH_LINE*
>( aItem )->GetLineColor();
375 else if( shape->
GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
417 else if(
const EDA_TEXT* otherTextItem =
dynamic_cast<const EDA_TEXT*
>( aItem ) )
420 color = otherTextItem->GetTextColor();
425 color = m_schSettings.GetLayerColor( aLayer );
427 if( aItem->IsBrightened() )
431 if( aDrawingShadows )
433 if( aItem->IsSelected() )
443 else if( aItem->IsSelected() && aDrawingShadows )
456 if( m_schSettings.m_ShowDisabled
457 || ( m_schSettings.m_ShowGraphicsDisabled && aItem->Type() !=
SCH_FIELD_T ) )
462 if( aDimmed && !( aItem->IsSelected() && aDrawingShadows ) )
469 if( aItem->GetForcedTransparency() > 0.0 )
470 color =
color.WithAlpha(
color.a * ( 1.0 - aItem->GetForcedTransparency() ) );
476float SCH_PAINTER::getLineWidth(
const SCH_ITEM* aItem,
bool aDrawingShadows,
477 bool aDrawingWireColorHighlights )
const
486 if( aDrawingShadows && aItem->
IsType( g_ScaledSelectionTypes ) )
490 if( aDrawingWireColorHighlights )
501 width += colorHighlightWidth;
508float SCH_PAINTER::getTextThickness(
const SCH_ITEM* aItem )
const
510 int pen = m_schSettings.GetDefaultPenWidth();
512 switch( aItem->
Type() )
515 pen =
static_cast<const SCH_FIELD*
>( aItem )->GetEffectiveTextPenWidth( pen );
519 pen =
static_cast<const SCH_TEXT*
>( aItem )->GetEffectiveTextPenWidth( pen );
527 pen =
static_cast<const SCH_LABEL_BASE*
>( aItem )->GetEffectiveTextPenWidth( pen );
532 pen =
static_cast<const SCH_TEXTBOX*
>( aItem )->GetEffectiveTextPenWidth( pen );
543int SCH_PAINTER::getOperatingPointTextSize()
const
546 int screenTextSize =
std::abs( (
int) m_gal->GetScreenWorldMatrix().GetScale().y * 7 );
549 return KiROUND( ( docTextSize + screenTextSize * 2 ) / 3 );
611 font->
Draw( &aGal, aText, aPosition, aAttrs, aFontMetrics );
653 callback_gal.SetIsStroke(
true );
655 font->
Draw( &callback_gal, aText, aPosition, attrs, aFontMetrics );
700 m_gal->DrawLine( a, b );
701 m_gal->DrawLine( b, c );
705void SCH_PAINTER::draw(
const LIB_SYMBOL* aSymbol,
int aLayer,
bool aDrawFields,
int aUnit,
706 int aBodyStyle,
bool aDimmed )
709 aUnit = m_schSettings.m_ShowUnit;
712 aBodyStyle = m_schSettings.m_ShowBodyStyle;
714 std::unique_ptr< LIB_SYMBOL > tmpSymbol;
719 tmpSymbol = aSymbol->
Flatten();
720 drawnSymbol = tmpSymbol.get();
726 [](
const SCH_ITEM& item,
int layer )
728 int layers[512], layers_count;
731 for(
int ii = 0; ii < layers_count; ++ii )
733 if( layers[ii] == layer )
745 if( !childOnLayer( item, aLayer ) )
754 draw( &item, aLayer, aDimmed );
759int SCH_PAINTER::internalPinDecoSize(
const SCH_PIN &aPin )
761 if( m_schSettings.m_PinSymbolSize > 0 )
762 return m_schSettings.m_PinSymbolSize;
770int SCH_PAINTER::externalPinDecoSize(
const SCH_PIN &aPin )
772 if( m_schSettings.m_PinSymbolSize > 0 )
773 return m_schSettings.m_PinSymbolSize;
780void SCH_PAINTER::drawPinDanglingIndicator(
const VECTOR2I& aPos,
const COLOR4D& aColor,
781 bool aDrawingShadows,
bool aBrightened )
785 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
787 m_gal->SetIsFill(
false );
788 m_gal->SetIsStroke(
true );
789 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
790 : m_schSettings.GetDanglingIndicatorThickness() );
800 bool aRotate,
int aExtraLineWidth,
const COLOR4D& aColor )
827 const double lineYOffset = aSize / 4;
828 const double arrowHead = aSize / 8;
844 topLineREnd -
VECTOR2D{ aSize * 0.7, 0 } );
846 aGal.
DrawLine( topLineREnd, topLineREnd -
VECTOR2D{ arrowHead * 1.2, arrowHead } );
847 aGal.
DrawLine( topLineREnd, topLineREnd -
VECTOR2D{ arrowHead * 1.2, -arrowHead } );
851 aGal.
DrawLine( btmLineREnd, btmLineREnd -
VECTOR2D{ arrowHead * 1.2, arrowHead } );
852 aGal.
DrawLine( btmLineREnd, btmLineREnd -
VECTOR2D{ arrowHead * 1.2, -arrowHead } );
860 aGal.
DrawArc( topLineREnd -
VECTOR2D{ aSize - lineYOffset * 2, -lineYOffset },
880 const double aIconSize = 0 ) :
881 m_gal( aGal ), m_attrs( aAttrs ), m_fontMetrics( aFontMetrics ),
882 m_iconSize( aIconSize ), m_iconGap( aIconSize / 4.0 ), m_shadowWidth( aShadowWidth )
891 const float adjust = 1.2f;
892 m_shadowOffset = m_shadowWidth / 2.0f * adjust;
938 int offset = m_iconSize / 2 + m_iconGap;
939 for( std::size_t i = 0; i < aNIcons; ++i )
942 offset += m_iconGap + m_iconSize;
1027 return size > 0 && colour != COLOR4D::UNSPECIFIED && !
text.IsEmpty();
1038 m_pin( aPin ), m_offsets{ 0, 0, 0, 0 }, m_penWidth( aPenWidth ),
1039 m_pinTextMargin( aPinTextMargin )
1055 float textOffset = m_pin.GetParentSymbol()->GetPinNameOffset();
1057 m_offsets[
INSIDE] = textOffset - m_slots[
INSIDE].thickness / 2.0;
1059 m_offsets[ABOVE] = m_pinTextMargin + m_penWidth / 2.0 + m_slots[ABOVE].thickness / 2.0;
1060 m_offsets[BELOW] = m_pinTextMargin + m_penWidth / 2.0 + m_slots[BELOW].thickness / 2.0;
1062 if( m_pin.IsDangling() )
1083 for(
SLOT& slot : m_slots )
1085 slot.colour = aColor;
1094 for(
int i = 0; i < 4; ++i )
1096 if( &aSlot == &m_slots[i] )
1098 slotId =
static_cast<SLOT_ID>( i );
1106 const float len = m_pin.GetLength();
1111 case PIN_TEXTS::SLOT_ID::INSIDE:
1120 case PIN_TEXTS::SLOT_ID::OUTSIDE:
1129 case PIN_TEXTS::SLOT_ID::ABOVE:
1131 VECTOR2D( -len / 2.0, -m_offsets[ABOVE] ),
1138 case PIN_TEXTS::SLOT_ID::BELOW:
1140 VECTOR2D( -len / 2.0, m_offsets[BELOW] ),
1149 switch( aPinOrientation )
1151 case PIN_ORIENTATION::PIN_LEFT:
1153 case PIN_ORIENTATION::PIN_RIGHT:
1154 placement.
Pos = { -placement.
Pos.
x, placement.
Pos.
y };
1158 case PIN_ORIENTATION::PIN_UP:
1159 placement.
Pos = { placement.
Pos.
y, placement.
Pos.
x };
1164 case PIN_ORIENTATION::PIN_DOWN:
1165 placement.
Pos = { placement.
Pos.
y, -placement.
Pos.
x };
1168 case PIN_ORIENTATION::INHERIT:
1169 wxFAIL_MSG(
"Unknown pin orientation" );
1173 placement.
Pos += m_pin.GetPosition();
1186void SCH_PAINTER::draw(
const SCH_PIN* aPin,
int aLayer,
bool aDimmed )
1193 if( !isUnitAndConversionShown( aPin ) )
1198 if( m_schSettings.IsPrinting() && drawingShadows )
1203 const bool isDangling = m_schSettings.m_IsSymbolEditor || aPin->
HasFlag(
IS_DANGLING );
1213 if( m_schSettings.IsPrinting() )
1217 : m_schSettings.m_ShowHiddenPins;
1225 if( drawingDangling && isDangling && aPin->
IsGlobalPower() )
1232 if( drawingDangling )
1240 if( m_schSettings.GetDrawBoundingBoxes() )
1241 drawItemBoundingBox( aPin );
1249 int textSize = getOperatingPointTextSize();
1251 int textOffset =
KiROUND( textSize * 0.22 );
1254 if( len > textSize )
1258 mid.
x +=
KiROUND( textOffset * 1.2 );
1263 mid.
y -=
KiROUND( textOffset * 1.2 );
1284 m_gal->SetIsStroke(
true );
1285 m_gal->SetIsFill(
false );
1286 m_gal->SetLineWidth( getLineWidth( aPin, drawingShadows ) );
1287 m_gal->SetStrokeColor(
color );
1288 m_gal->SetFontBold(
false );
1289 m_gal->SetFontUnderlined(
false );
1290 m_gal->SetFontItalic(
false );
1293 const int diam = radius*2;
1298 m_gal->DrawLine( p0, pos );
1311 m_gal->DrawLine( p0, pos );
1315 m_gal->DrawCircle( p0 + dir * radius, radius );
1316 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1320 pc = p0 - dir * clock_size ;
1322 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1324 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1326 m_gal->DrawCircle( p0 + dir * radius, radius );
1327 m_gal->DrawLine( p0 + dir * ( diam ), pos );
1332 pc = p0 - dir * clock_size ;
1334 triLine( p0 +
VECTOR2D( dir.
y, -dir.
x) * clock_size,
1336 p0 +
VECTOR2D( -dir.
y, dir.
x) * clock_size );
1340 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1346 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1351 m_gal->DrawLine( p0, pos );
1355 m_gal->DrawLine( p0, pos );
1359 triLine( p0 +
VECTOR2D( 0, clock_size ),
1360 p0 +
VECTOR2D( -dir.
x * clock_size, 0 ),
1365 triLine( p0 +
VECTOR2D( clock_size, 0 ),
1366 p0 +
VECTOR2D( 0, -dir.
y * clock_size ),
1372 m_gal->DrawLine( p0, pos );
1376 triLine( p0 +
VECTOR2D(dir.
x, 0) * diam,
1382 triLine( p0 +
VECTOR2D( 0, dir.
y) * diam,
1389 m_gal->DrawLine( p0, pos );
1398 m_gal->DrawLine( p0, pos );
1400 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius,
1401 p0 +
VECTOR2D( dir.
x + dir.
y, dir.
y - dir.
x ) * radius );
1402 m_gal->DrawLine( p0 -
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius,
1403 p0 +
VECTOR2D( dir.
x - dir.
y, dir.
x + dir.
y ) * radius );
1408 if( drawingShadows && !
eeconfig()->m_Selection.draw_selected_children )
1413 float penWidth = (float) m_schSettings.GetDefaultPenWidth();
1414 float nameStrokeWidth = getLineWidth( aPin,
false );
1415 float numStrokeWidth = getLineWidth( aPin,
false );
1417 bool showPinNumbers = m_schSettings.m_ShowPinNumbers || symbol->
GetShowPinNumbers();
1433 slot.
role = PIN_TEXTS::SLOT_ROLE::NAME;
1443 slot.
role = PIN_TEXTS::SLOT_ROLE::NUMBER;
1450 assignNameToSlot( PIN_TEXTS::SLOT_ID::INSIDE );
1451 if( showPinNumbers )
1452 assignNumberToSlot( PIN_TEXTS::SLOT_ID::ABOVE );
1455 else if( showPinNames && showPinNumbers )
1457 assignNameToSlot( PIN_TEXTS::SLOT_ID::ABOVE );
1458 assignNumberToSlot( PIN_TEXTS::SLOT_ID::BELOW );
1460 else if( showPinNames )
1462 assignNameToSlot( PIN_TEXTS::SLOT_ID::ABOVE );
1464 else if( showPinNumbers )
1466 assignNumberToSlot( PIN_TEXTS::SLOT_ID::ABOVE );
1469 if( m_schSettings.m_ShowPinsElectricalType )
1476 outside.
role = PIN_TEXTS::SLOT_ROLE::ELECTRICAL_TYPE;
1487 float shadowWidth = 0.0f;
1489 if( drawingShadows )
1497 if( !slot.ShouldDraw() )
1507 m_gal->SetStrokeColor( slot.colour );
1508 m_gal->SetFillColor( slot.colour );
1525 slot.text, placement.
Pos, placement.
IconSide, 1, drawingShadows );
1527 if( drawingShadows )
1540 else if( nonCached( aPin ) && renderTextAsBitmap )
1551 const bool hasAltIcon =
1552 ( slot.role == PIN_TEXTS::SLOT_ROLE::NAME ) && !aPin->
GetAlternates().empty()
1553 && GetSettings()->m_ShowPinAltIcons && !renderTextAsBitmap;
1557 wxASSERT( locs.
IconPos.size() >= 1 );
1575void SCH_PAINTER::drawAnchor(
const VECTOR2I& aPos,
bool aDrawingShadows )
1577 if( m_schSettings.IsPrinting() )
1582 const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
1589 m_gal->SetStrokeColor(
color );
1590 m_gal->SetIsStroke(
true );
1591 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth(
false )
1592 : m_schSettings.GetDanglingIndicatorThickness() );
1594 m_gal->DrawLine( aPos -
VECTOR2I( radius, 0 ), aPos +
VECTOR2I( radius, 0 ) );
1595 m_gal->DrawLine( aPos -
VECTOR2I( 0, radius ), aPos +
VECTOR2I( 0, radius ) );
1601void SCH_PAINTER::drawDanglingIndicator(
const VECTOR2I& aPos,
const COLOR4D& aColor,
int aWidth,
1602 bool aDangling,
bool aDrawingShadows,
bool aBrightened )
1604 if( m_schSettings.IsPrinting() )
1617 m_gal->SetStrokeColor( aColor.
Brightened( 0.3 ) );
1618 m_gal->SetIsStroke(
true );
1619 m_gal->SetIsFill(
false );
1620 m_gal->SetLineWidth( aDrawingShadows ? getShadowWidth( aBrightened )
1621 : m_schSettings.GetDanglingIndicatorThickness() );
1623 m_gal->DrawRectangle( aPos - radius, aPos + radius );
1629 bool highlightNetclassColors =
false;
1639 if( m_schSettings.IsPrinting() && drawingShadows )
1647 if( highlightNetclassColors && aLayer == aJct->
GetLayer() )
1650 color = getRenderColor( aJct, aJct->
GetLayer(), drawingShadows );
1654 if( junctionSize > 1 )
1656 m_gal->SetIsStroke( drawingShadows );
1657 m_gal->SetLineWidth( getLineWidth( aJct, drawingShadows ) );
1658 m_gal->SetStrokeColor(
color );
1659 m_gal->SetIsFill( !drawingShadows );
1660 m_gal->SetFillColor(
color );
1661 m_gal->DrawCircle( aJct->
GetPosition(), junctionSize );
1666void SCH_PAINTER::draw(
const SCH_LINE* aLine,
int aLayer )
1671 bool drawingBusses = aLayer ==
LAYER_BUS;
1675 bool highlightNetclassColors =
false;
1676 double highlightAlpha = 0.6;
1685 if( !highlightNetclassColors && drawingNetColorHighlights )
1688 if( m_schSettings.m_OverrideItemColors && drawingNetColorHighlights )
1691 if( m_schSettings.IsPrinting() && drawingShadows )
1699 if( aLine->
IsNew() && drawingDangling )
1703 float width = getLineWidth( aLine, drawingShadows, drawingNetColorHighlights );
1706 if( highlightNetclassColors )
1711 else if( drawingBusses )
1715 if( drawingNetColorHighlights )
1727 if( ( drawingDangling || drawingShadows ) && !aLine->
IsNew() )
1756 if( drawingDangling )
1761 int textSize = getOperatingPointTextSize();
1763 int textOffset =
KiROUND( textSize * 0.22 );
1768 pos.
y -= textOffset;
1774 pos.
x +=
KiROUND( textOffset * 1.2 );
1790 m_gal->SetIsStroke(
true );
1791 m_gal->SetStrokeColor(
color );
1792 m_gal->SetLineWidth( width );
1807 m_gal->DrawLine( a+1, b );
1809 m_gal->DrawLine( a, b );
1815void SCH_PAINTER::draw(
const SCH_SHAPE* aShape,
int aLayer,
bool aDimmed )
1817 if( !isUnitAndConversionShown( aShape ) )
1820 if( aShape->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
1825 if( m_schSettings.IsPrinting() && drawingShadows )
1829 COLOR4D color = getRenderColor( aShape, aLayer, drawingShadows, aDimmed );
1837 switch( shape->GetShape() )
1841 VECTOR2D start = shape->GetStart();
1850 EDA_ANGLE angle1 = midAngle - startAngle;
1855 m_gal->DrawArc( center, ( start - center ).EuclideanNorm(), startAngle, angle );
1860 m_gal->DrawCircle( shape->GetPosition(), shape->GetRadius() );
1864 m_gal->DrawRectangle( shape->GetPosition(), shape->GetEnd() );
1869 const std::vector<SHAPE*> polySegments = shape->MakeEffectiveShapes(
true );
1871 if( !polySegments.empty() )
1873 std::deque<VECTOR2D> pts;
1875 for(
SHAPE* polySegment : polySegments )
1876 pts.push_back(
static_cast<SHAPE_SEGMENT*
>( polySegment )->GetSeg().
A );
1881 for(
SHAPE* polySegment : polySegments )
1884 m_gal->DrawPolygon( pts );
1891 m_gal->DrawCurve( shape->GetStart(), shape->GetBezierC1(),
1892 shape->GetBezierC2(), shape->GetEnd() );
1903 if(
eeconfig()->m_Selection.fill_shapes )
1908 m_gal->SetIsFill( aShape->
IsFilled() );
1910 m_gal->SetIsFill(
true );
1912 m_gal->SetIsStroke(
false );
1913 m_gal->SetFillColor(
color );
1917 m_gal->SetIsStroke(
true );
1918 m_gal->SetIsFill(
false );
1919 m_gal->SetLineWidth( getLineWidth( aShape,
true ) );
1920 m_gal->SetStrokeColor(
color );
1923 drawShape( aShape );
1939 if( !m_schSettings.PrintBlackAndWhiteReq() )
1941 m_gal->SetIsFill(
true );
1942 m_gal->SetIsStroke(
false );
1943 m_gal->SetFillColor(
color );
1945 drawShape( aShape );
1956 m_gal->SetIsFill(
true );
1957 m_gal->SetIsStroke(
false );
1958 m_gal->SetFillColor(
color );
1960 drawShape( aShape );
1963 float lineWidth = getLineWidth( aShape, drawingShadows );
1967 m_gal->SetIsFill(
false );
1968 m_gal->SetIsStroke(
true );
1969 m_gal->SetLineWidth( lineWidth );
1970 m_gal->SetStrokeColor(
color );
1974 drawShape( aShape );
1980 for(
SHAPE* shape : shapes )
1987 m_gal->DrawLine( a+1, b );
1989 m_gal->DrawLine( a, b );
1993 for(
SHAPE* shape : shapes )
2001void SCH_PAINTER::draw(
const SCH_TEXT* aText,
int aLayer,
bool aDimmed )
2003 if( !isUnitAndConversionShown( aText ) )
2006 if( aText->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
2011 if( m_schSettings.IsPrinting() && drawingShadows )
2017 switch( aText->
Type() )
2029 COLOR4D color = getRenderColor( aText, aLayer, drawingShadows, aDimmed );
2038 if( conn && conn->
IsBus() )
2044 if( m_schSettings.m_IsSymbolEditor ||
eeconfig()->m_Appearance.show_hidden_fields )
2050 m_gal->SetStrokeColor(
color );
2051 m_gal->SetFillColor(
color );
2061 if( drawingShadows && font->
IsOutline() )
2066 m_gal->SetIsStroke(
false );
2067 m_gal->SetIsFill(
true );
2079 double shadowOffset = 0.0;
2081 if( drawingShadows )
2083 double shadowWidth = getShadowWidth( !aText->
IsSelected() );
2086 const double adjust = 1.2f;
2087 shadowOffset = shadowWidth/2.0f * adjust;
2101 pos.
y = bBox.
GetTop() - shadowOffset;
2104 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
2113 pos.
x = bBox.
GetLeft() - shadowOffset;
2122 wxFAIL_MSG( wxT(
"Indeterminate state legal only in dialogs." ) );
2133 else if( drawingShadows )
2135 m_gal->SetIsFill(
false );
2136 m_gal->SetIsStroke(
true );
2146 text_offset.
x -= fudge;
2148 text_offset.
y -= fudge;
2150 text_offset.
x += fudge;
2152 text_offset.
y += fudge;
2161 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2162 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2172 int adjust =
KiROUND( sizeDiff * 0.4 );
2173 VECTOR2I adjust_offset( 0, - adjust );
2176 text_offset += adjust_offset;
2179 if( nonCached( aText )
2181 && !shownText.Contains( wxT(
"\n" ) ) )
2188 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2196 m_gal->DrawGlyphs( *cache );
2213 switch( aText->
Type() )
2221 showAnchor = !
static_cast<const SCH_LABEL*
>( aText )->IsDangling();
2238 drawAnchor( aText->
GetPosition(), drawingShadows );
2243void SCH_PAINTER::draw(
const SCH_TEXTBOX* aTextBox,
int aLayer,
bool aDimmed )
2253 if( !isUnitAndConversionShown( aTextBox ) )
2256 if( aTextBox->
IsPrivate() && !m_schSettings.m_IsSymbolEditor )
2261 if( m_schSettings.IsPrinting() && drawingShadows )
2264 COLOR4D color = getRenderColor( aTextBox, aLayer, drawingShadows, aDimmed );
2266 float borderWidth = getLineWidth( aTextBox, drawingShadows );
2280 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2281 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2285 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2293 m_gal->DrawGlyphs( *cache );
2305 m_gal->SetFillColor(
color );
2306 m_gal->SetStrokeColor(
color );
2310 m_gal->SetIsFill(
true );
2311 m_gal->SetIsStroke(
false );
2312 m_gal->SetLineWidth( borderWidth );
2320 if( aTextBox->
IsFilled() && !m_schSettings.PrintBlackAndWhiteReq() )
2322 m_gal->SetIsFill(
true );
2323 m_gal->SetIsStroke(
false );
2324 m_gal->SetLineWidth( borderWidth );
2339 if( m_schSettings.m_OverrideItemColors || aTextBox->
IsBrightened()
2342 borderColor = m_schSettings.GetLayerColor( aLayer );
2345 if( transparency > 0.0 )
2346 borderColor = borderColor.
WithAlpha( borderColor.
a * ( 1.0 - transparency ) );
2350 borderColor = borderColor.
Mix( bg, 0.5f );
2354 m_gal->SetIsFill(
false );
2355 m_gal->SetIsStroke(
true );
2356 m_gal->SetStrokeColor( borderColor );
2357 m_gal->SetLineWidth( borderWidth );
2367 for(
SHAPE* shape : shapes )
2375 m_gal->DrawLine( a+1, b );
2377 m_gal->DrawLine( a, b );
2381 for(
SHAPE* shape : shapes )
2389void SCH_PAINTER::draw(
const SCH_TABLE* aTable,
int aLayer,
bool aDimmed )
2392 draw( cell, aLayer, aDimmed );
2407 lineWidth = stroke.GetWidth();
2408 color = stroke.GetColor();
2409 lineStyle = stroke.GetLineStyle();
2411 if( lineWidth == 0 )
2412 lineWidth = m_schSettings.GetDefaultPenWidth();
2420 m_gal->SetIsFill(
false );
2421 m_gal->SetIsStroke(
true );
2422 m_gal->SetStrokeColor(
color );
2423 m_gal->SetLineWidth( (
float) lineWidth );
2427 [&](
const SHAPE& shape )
2434 m_gal->DrawLine( a+1, b );
2436 m_gal->DrawLine( a, b );
2445 m_gal->DrawLine( ptA, ptB );
2459 m_gal->DrawRectangle( ptA, ptB );
2464 strokeShape( rect );
2474 for(
int col = 0; col < aTable->
GetColCount() - 1; ++col )
2476 for(
int row = 0; row < aTable->
GetRowCount(); ++row )
2482 strokeLine( topRight, cell->
GetEnd() );
2489 for(
int row = 0; row < aTable->
GetRowCount() - 1; ++row )
2491 for(
int col = 0; col < aTable->
GetColCount(); ++col )
2497 strokeLine( botLeft, cell->
GetEnd() );
2514 strokeRect( pos, end );
2519wxString SCH_PAINTER::expandLibItemTextVars(
const wxString& aSourceText,
2522 std::function<bool( wxString* )> symbolResolver =
2523 [&]( wxString* token ) ->
bool
2528 return aSymbolContext->
ResolveTextVar( &m_schematic->CurrentSheet(), token );
2538 bool DNP = aSymbol->
GetDNP();
2542 if( m_schSettings.IsPrinting() && drawingShadows )
2545 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2548 draw( &field, aLayer, DNP || markExclusion );
2560 int unit = m_schematic ? aSymbol->
GetUnitSelection( &m_schematic->CurrentSheet() ) : 1;
2566 std::vector<SCH_PIN*> originalPins = originalSymbol->
GetPins( unit, bodyStyle );
2570 std::vector<SCH_PIN*> tempPins = tempSymbol.
GetPins( unit, bodyStyle );
2578 tempItem.SetFlags( aSymbol->
GetFlags() );
2586 textItem->
SetText( expandLibItemTextVars( textItem->
GetText(), aSymbol ) );
2593 textboxItem->
SetText( expandLibItemTextVars( textboxItem->
GetText(), aSymbol ) );
2598 for(
unsigned i = 0; i < tempPins.size(); ++ i )
2601 SCH_PIN* tempPin = tempPins[ i ];
2620 DNP || markExclusion );
2622 for(
unsigned i = 0; i < tempPins.size(); ++i )
2625 SCH_PIN* tempPin = tempPins[ i ];
2633 if( DNP || markExclusion )
2642 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
2643 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
2650 m_gal->AdvanceDepth();
2651 m_gal->SetIsStroke(
true );
2652 m_gal->SetIsFill(
true );
2653 m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ) );
2654 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ) );
2656 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2657 std::swap( pt1.
x, pt2.
x );
2658 m_gal->DrawSegment( pt1, pt2, strokeWidth );
2664void SCH_PAINTER::draw(
const SCH_FIELD* aField,
int aLayer,
bool aDimmed )
2668 if( m_schSettings.IsPrinting() && drawingShadows )
2674 if( !isUnitAndConversionShown( aField ) )
2681 bool foundLayer =
false;
2685 for(
int i = 0; i < layers_count; ++i )
2687 if( layers[i] == aLayer )
2696 COLOR4D color = getRenderColor( aField, aLayer, drawingShadows, aDimmed );
2701 : m_schSettings.m_ShowHiddenFields;
2711 if( shownText.IsEmpty() )
2747 if( m_schSettings.GetDrawBoundingBoxes() )
2748 drawItemBoundingBox( aField );
2750 m_gal->SetStrokeColor(
color );
2751 m_gal->SetFillColor(
color );
2753 if( drawingShadows && getFont( aField )->IsOutline() )
2755 BOX2I shadow_box = bbox;
2758 m_gal->SetIsStroke(
false );
2759 m_gal->SetIsFill(
true );
2772 if( drawingShadows )
2777 m_gal->SetStrokeColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2778 m_gal->SetFillColor( m_schSettings.GetLayerColor(
LAYER_HOVERED ) );
2782 if( nonCached( aField ) && aField->
RenderAsBitmap( m_gal->GetWorldScale() ) )
2784 bitmapText( *m_gal, shownText, textpos, attributes );
2789 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2792 cache = aField->
GetRenderCache( shownText, textpos, attributes );
2797 m_gal->DrawGlyphs( *cache );
2809 if( aField->
IsMoving() && m_schematic )
2813 m_gal->SetLineWidth( m_schSettings.GetOutlineWidth() );
2815 m_gal->DrawLine( aField->
GetPosition(), parentPos );
2819 drawAnchor( aField->
GetPosition(), drawingShadows );
2828 if( m_schSettings.IsPrinting() && drawingShadows )
2833 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2836 draw( &field, aLayer,
false );
2847 if( drawingDangling )
2859 std::vector<VECTOR2I> pts;
2860 std::deque<VECTOR2D> pts2;
2865 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2867 m_gal->SetIsStroke(
true );
2868 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2869 m_gal->SetStrokeColor(
color );
2871 if( drawingShadows )
2873 m_gal->SetIsFill(
eeconfig()->m_Selection.fill_shapes );
2874 m_gal->SetFillColor(
color );
2875 m_gal->DrawPolygon( pts2 );
2879 m_gal->SetIsFill(
false );
2880 m_gal->DrawPolyline( pts2 );
2883 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2887void SCH_PAINTER::draw(
const SCH_LABEL* aLabel,
int aLayer )
2891 if( m_schSettings.IsPrinting() && drawingShadows )
2896 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
2899 draw( &field, aLayer,
false );
2910 if( drawingDangling )
2922 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2930 if( m_schSettings.IsPrinting() && drawingShadows )
2935 if( !( drawingShadows || drawingDangling ) ||
eeconfig()->m_Selection.draw_selected_children )
2938 draw( &field, aLayer,
false );
2949 if( drawingDangling )
2968 if( conn && conn->
IsBus() )
2969 color = getRenderColor( aLabel,
LAYER_BUS, drawingShadows, aDimmed );
2972 std::vector<VECTOR2I> pts;
2973 std::deque<VECTOR2D> pts2;
2978 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
2980 m_gal->SetIsFill(
true );
2982 m_gal->SetIsStroke(
true );
2983 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
2984 m_gal->SetStrokeColor(
color );
2985 m_gal->DrawPolyline( pts2 );
2987 draw(
static_cast<const SCH_TEXT*
>( aLabel ), aLayer,
false );
2998 if( m_schSettings.IsPrinting() && drawingShadows )
3001 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
3004 draw( &field, aLayer,
false );
3027 std::vector<VECTOR2I> pts;
3028 std::deque<VECTOR2D> pts2;
3033 pts2.emplace_back(
VECTOR2D( p.x, p.y ) );
3035 m_gal->SetIsFill(
false );
3036 m_gal->SetFillColor(
color );
3037 m_gal->SetIsStroke(
true );
3038 m_gal->SetLineWidth( getLineWidth( aLabel, drawingShadows ) );
3039 m_gal->SetStrokeColor(
color );
3043 m_gal->DrawLine( pts2[0], pts2[1] );
3044 m_gal->SetIsFill(
true );
3045 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).EuclideanNorm() );
3049 m_gal->DrawLine( pts2[0], pts2[1] );
3050 m_gal->DrawCircle( pts2[2], ( pts2[2] - pts2[1] ).EuclideanNorm() );
3054 m_gal->DrawPolyline( pts2 );
3059void SCH_PAINTER::draw(
const SCH_SHEET* aSheet,
int aLayer )
3062 bool DNP = aSheet->
GetDNP();
3066 if( m_schSettings.IsPrinting() && drawingShadows )
3069 if( !drawingShadows ||
eeconfig()->m_Selection.draw_selected_children )
3072 draw( &field, aLayer, DNP || markExclusion );
3075 draw(
static_cast<SCH_HIERLABEL*
>( sheetPin ), aLayer, DNP || markExclusion );
3088 if( !m_schSettings.PrintBlackAndWhiteReq() )
3091 m_gal->SetIsFill(
true );
3092 m_gal->SetIsStroke(
false );
3094 m_gal->DrawRectangle( pos, pos + size );
3100 m_gal->SetStrokeColor( getRenderColor( aSheet,
LAYER_SHEET, drawingShadows ) );
3101 m_gal->SetIsStroke(
true );
3102 m_gal->SetLineWidth( getLineWidth( aSheet, drawingShadows ) );
3103 m_gal->SetIsFill(
false );
3105 m_gal->DrawRectangle( pos, pos + size );
3108 if( DNP || markExclusion )
3117 margins.
x = std::max( margins.
x * 0.6, margins.
y * 0.3 );
3118 margins.
y = std::max( margins.
y * 0.6, margins.
x * 0.3 );
3125 m_gal->AdvanceDepth();
3126 m_gal->SetIsStroke(
true );
3127 m_gal->SetIsFill(
true );
3128 m_gal->SetStrokeColor( m_schSettings.GetLayerColor( layer ) );
3129 m_gal->SetFillColor( m_schSettings.GetLayerColor( layer ) );
3131 m_gal->DrawSegment( pt1, pt2, strokeWidth );
3132 std::swap( pt1.
x, pt2.
x );
3133 m_gal->DrawSegment( pt1, pt2, strokeWidth );
3143 if( m_schSettings.IsPrinting() && drawingShadows )
3149 m_gal->SetIsStroke(
true );
3150 m_gal->SetLineWidth( getLineWidth( aNC, drawingShadows ) );
3151 m_gal->SetStrokeColor( getRenderColor( aNC,
LAYER_NOCONNECT, drawingShadows ) );
3152 m_gal->SetIsFill(
false );
3155 int delta = std::max( aNC->
GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
3170 bool drawingBusses = aLayer ==
LAYER_BUS;
3172 if( m_schSettings.IsPrinting() && drawingShadows )
3175 bool highlightNetclassColors =
false;
3183 if( !highlightNetclassColors && drawingNetColorHighlights )
3186 if( m_schSettings.m_OverrideItemColors && drawingNetColorHighlights )
3211 if( highlightNetclassColors )
3216 else if( drawingBusses )
3220 if( drawingNetColorHighlights )
3232 if( drawingDangling )
3234 m_gal->SetIsFill(
false );
3235 m_gal->SetIsStroke(
true );
3236 m_gal->SetStrokeColor(
color.Brightened( 0.3 ) );
3237 m_gal->SetLineWidth( m_schSettings.GetDanglingIndicatorThickness() );
3247 m_gal->DrawCircle( aEntry->
GetEnd(),
3256 draw( &line, aLayer );
3272 if( img_scale != 1.0 )
3273 m_gal->Scale(
VECTOR2D( img_scale, img_scale ) );
3277 m_gal->DrawBitmap( refImage.
GetImage() );
3285 m_gal->SetIsStroke(
true );
3286 m_gal->SetStrokeColor(
color );
3287 m_gal->SetLineWidth ( getShadowWidth( aBitmap->
IsBrightened() ) );
3288 m_gal->SetIsFill(
false );
3295 bm_size.
x /= img_scale;
3296 bm_size.
y /= img_scale;
3297 const VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
3298 const VECTOR2D end = origin + bm_size;
3300 m_gal->DrawRectangle( origin, end );
3312 if( m_schSettings.IsPrinting() && drawingShadows )
3322 m_gal->SetIsFill( !drawingShadows );
3323 m_gal->SetFillColor(
color );
3324 m_gal->SetIsStroke( drawingShadows );
3325 m_gal->SetLineWidth( getLineWidth( aMarker, drawingShadows ) );
3326 m_gal->SetStrokeColor(
color );
3331 m_gal->DrawPolygon( polygon );
constexpr EDA_IU_SCALE schIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr const Vec & GetPosition() const
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr const Vec GetEnd() const
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr coord_type GetY() const
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr coord_type GetX() const
constexpr size_type GetHeight() const
constexpr coord_type GetLeft() const
constexpr void SetX(coord_type val)
constexpr const Vec & GetOrigin() const
constexpr void SetY(coord_type val)
const BOX2< Vec > GetBoundingBoxRotated(const VECTOR2I &aRotCenter, const EDA_ANGLE &aAngle) const
Useful to calculate bounding box of rotated items, when rotation is not cardinal.
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr void Offset(coord_type dx, coord_type dy)
constexpr coord_type GetBottom() const
Directions
Available directions, there are 8 of them, as on a rectilinear map (north = up) + an extra undefined ...
bool IsHorizontal() const
A base class for most all the KiCad significant classes used in schematics and boards.
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
void ClearFlags(EDA_ITEM_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
EDA_ITEM * GetParent() const
bool HasFlag(EDA_ITEM_FLAGS aFlag) const
bool IsBrightened() const
bool IsForceVisible() const
EDA_ITEM_FLAGS GetFlags() const
FILL_T GetFillMode() const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
COLOR4D GetFillColor() const
A mix-in class (via multiple inheritance) that handles texts such as labels, parts,...
const VECTOR2I & GetTextPos() const
COLOR4D GetTextColor() const
const EDA_ANGLE & GetTextAngle() const
virtual const wxString & GetText() const
Return the string associated with the text object.
virtual bool IsVisible() const
KIFONT::FONT * GetFont() const
BOX2I GetTextBox(int aLine=-1) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, const VECTOR2I &aOffset={ 0, 0 }) const
virtual EDA_ANGLE GetDrawRotation() const
virtual VECTOR2I GetDrawPos() const
bool HasTextVars() const
Indicates the ShownText has text var references which need to be processed.
const TEXT_ATTRIBUTES & GetAttributes() const
virtual void SetText(const wxString &aText)
VECTOR2I GetTextSize() const
APP_SETTINGS_BASE * KifaceSettings() const
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false, const std::vector< wxString > *aEmbeddedFiles=nullptr, bool aForDrawingSheet=false)
virtual bool IsStroke() const
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttributes, const METRICS &aFontMetrics) const
Draw a string.
virtual bool IsOutline() const
VECTOR2I StringBoundaryLimits(const wxString &aText, const VECTOR2I &aSize, int aThickness, bool aBold, bool aItalic, const METRICS &aFontMetrics) const
Compute the boundary limits of aText (the bounding box of all shapes).
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
COLOR4D & Invert()
Makes the color inverted, alpha remains the same.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
COLOR4D & Desaturate()
Removes color (in HSL model)
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Abstract interface for drawing on a 2D-surface.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void Rotate(double aAngle)
Rotate the context.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
void SetVerticalJustify(const GR_TEXT_V_ALIGN_T aVerticalJustify)
void SetHorizontalJustify(const GR_TEXT_H_ALIGN_T aHorizontalJustify)
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void Translate(const VECTOR2D &aTranslation)
Translate the context.
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
virtual void Restore()
Restore the context.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
void SetGlyphSize(const VECTOR2I aSize)
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
Draw an arc.
virtual void BitmapText(const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle)
Draw a text using a bitmap font.
virtual void Save()
Save the context.
double GetWorldScale() const
Get the world scale.
Contains all the knowledge about how to draw graphical object onto any particular output device.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
Helper class to gather logic relating to the positioning of text in the four pin "slots":
const_iterator begin() const
void SetColorOverride(const COLOR4D &aColor)
Replace all slot colours with a new colour.
std::array< int, 4 > m_offsets
const_iterator end() const
TEXT_PLACEMENT GetTextPlacement(const PIN_TEXTS::SLOT &aSlot, PIN_ORIENTATION aPinOrientation) const
std::array< SLOT, 4 >::const_iterator const_iterator
SLOT & GetSlot(SLOT_ID aSlot)
std::array< SLOT, 4 > m_slots
bool SlotRendersAsBitmap(const SLOT &aSlot, KIGFX::GAL &aGal) const
const SLOT & GetSlot(SLOT_ID aSlot) const
const float m_pinTextMargin
const void ComputeOffsets()
PIN_TEXTS(const SCH_PIN &aPin, float aPenWidth, float aPinTextMargin)
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
bool GetDrawBoundingBoxes() const
virtual bool Draw(const VIEW_ITEM *, int) override
Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.
COLOR4D getRenderColor(const SCH_ITEM *aItem, int aLayer, bool aDrawingShadows, bool aDimmed=false) const
float getShadowWidth(bool aForHighlight) const
KIFONT::FONT * getFont(const EDA_TEXT *aText) const
void draw(const EDA_ITEM *, int, bool aDimmed)
static std::vector< KICAD_T > g_ScaledSelectionTypes
SCH_RENDER_SETTINGS m_schSettings
bool nonCached(const EDA_ITEM *aItem)
void drawItemBoundingBox(const EDA_ITEM *aItem)
bool isUnitAndConversionShown(const SCH_ITEM *aItem) const
Small helper class to figure out the layout of text and text-adjacent icons, including text shadows a...
const KIFONT::METRICS & m_fontMetrics
LOCATIONS getTextLayout(const wxString &aText, const VECTOR2I &aPos, GR_TEXT_H_ALIGN_T aIconSide, std::size_t aNIcons, bool aDrawShadow)
Get the layout of text and icons for a given text string at a position.
TEXT_AND_ICON_LAYOUT(KIGFX::GAL &aGal, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics, const double aShadowWidth, const double aIconSize=0)
Create a new layout helper.
const TEXT_ATTRIBUTES & m_attrs
An abstract base class for deriving all objects that can be added to a VIEW.
double GetForcedTransparency() const
static constexpr int VIEW_MAX_LAYERS
Rendering order modifier for layers that are marked as top layers.
Define a library symbol object.
std::vector< SCH_PIN * > GetPins(int aUnit=0, int aBodyStyle=0) const
Return a list of pin object pointers from the draw item list.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
std::unique_ptr< LIB_SYMBOL > Flatten() const
Return a flattened symbol inheritance to the caller.
void AddDrawItem(SCH_ITEM *aItem, bool aSort=true)
Add a new draw aItem to the draw object list and sort according to aSort.
void ShapeToPolygon(SHAPE_LINE_CHAIN &aPolygon, int aScale=-1) const
Return the shape polygon in internal units in a SHAPE_LINE_CHAIN the coordinates are relatives to the...
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
const BITMAP_BASE & GetImage() const
Get the underlying image.
double GetImageScale() const
Object to handle a bitmap image that can be inserted in a schematic.
VECTOR2I GetPosition() const override
REFERENCE_IMAGE & GetReferenceImage()
Base class for a bus or wire entry.
LINE_STYLE GetLineStyle() const
VECTOR2I GetPosition() const override
bool IsDanglingStart() const
virtual STROKE_PARAMS GetStroke() const override
bool IsDanglingEnd() const
int GetPenWidth() const override
Class for a wire to bus entry.
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
virtual bool IsDangling() const override
Determines dangling state from connectivity and cached connected rule areas.
Instances are attached to a symbol or sheet and provide a place for the symbol's value,...
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
VECTOR2I GetPosition() const override
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const wxString &forResolvedText, const VECTOR2I &forPosition, TEXT_ATTRIBUTES &aAttrs) const
VECTOR2I GetParentPosition() const
void CreateGraphicShape(const RENDER_SETTINGS *aRenderSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const override
This offset depends on the orientation, the type of text, and the area required to draw the associate...
void CreateGraphicShape(const RENDER_SETTINGS *aSettings, std::vector< VECTOR2I > &aPoints, const VECTOR2I &aPos) const override
Calculate the graphic shape (a polygon) associated to the text.
Base class for any item which can be embedded within the SCHEMATIC container class,...
const SYMBOL * GetParentSymbol() const
SCH_LAYER_ID GetLayer() const
Return the layer this item is on.
bool RenderAsBitmap(double aWorldScale) const override
bool IsConnectivityDirty() const
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the layers the item is drawn on (which may be more than its "home" layer)
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
wxString GetClass() const override
Return the class name.
const KIFONT::METRICS & GetFontMetrics() const
int GetEffectivePenWidth(const SCH_RENDER_SETTINGS *aSettings) const
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
int GetEffectiveDiameter() const
VECTOR2I GetPosition() const override
bool IsDangling() const override
LABEL_FLAG_SHAPE GetShape() const
std::vector< SCH_FIELD > & GetFields()
Segment description base class to describe items which have 2 end points (track, wire,...
void SetStartPoint(const VECTOR2I &aPosition)
bool IsWire() const
Return true if the line is a wire.
bool IsStartDangling() const
void SetLineColor(const COLOR4D &aColor)
void SetLineWidth(const int aSize)
LINE_STYLE GetEffectiveLineStyle() const
VECTOR2I GetMidPoint() const
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
bool IsEndDangling() const
bool IsBus() const
Return true if the line is a bus.
void SetLineStyle(const LINE_STYLE aStyle)
virtual void SetStroke(const STROKE_PARAMS &aStroke) override
void SetEndPoint(const VECTOR2I &aPosition)
const wxString & GetOperatingPoint() const
SCH_LAYER_ID GetColorLayer() const
VECTOR2I GetPosition() const override
VECTOR2I GetPosition() const override
int GetNumberTextSize() const
const std::map< wxString, ALT > & GetAlternates() const
wxString GetShownNumber() const
const wxString & GetOperatingPoint() const
void SetName(const wxString &aName)
bool IsGlobalPower() const
Return whether this pin forms a global power connection: i.e., is part of a power symbol and of type ...
VECTOR2I GetPinRoot() const
wxString GetElectricalTypeName() const
bool IsDangling() const override
PIN_ORIENTATION GetOrientation() const
void SetShape(GRAPHIC_PINSHAPE aShape)
VECTOR2I GetPosition() const override
int GetNameTextSize() const
wxString GetShownName() const
void SetOperatingPoint(const wxString &aText)
void SetType(ELECTRICAL_PINTYPE aType)
GRAPHIC_PINSHAPE GetShape() const
ELECTRICAL_PINTYPE GetType() const
bool m_OverrideItemColors
std::vector< SHAPE * > MakeEffectiveShapes(bool aEdgeOnly=false) const override
Make a set of SHAPE objects representing the SCH_SHAPE.
LINE_STYLE GetEffectiveLineStyle() const
STROKE_PARAMS GetStroke() const override
VECTOR2I GetPosition() const override
Define a sheet pin (label) used in sheets to create hierarchical schematics.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
std::vector< SCH_FIELD > & GetFields()
VECTOR2I GetPosition() const override
const BOX2I GetBodyBoundingBox() const
Return a bounding box for the sheet body but not the fields.
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
KIGFX::COLOR4D GetBorderColor() const
bool GetExcludedFromSim() const override
std::vector< SCH_SHEET_PIN * > & GetPins()
bool GetDNP() const
Set or clear the 'Do Not Populate' flaga.
KIGFX::COLOR4D GetBackgroundColor() const
VECTOR2I GetPosition() const override
bool ResolveTextVar(const SCH_SHEET_PATH *aPath, wxString *token, int aDepth=0) const
Resolve any references to system tokens supported by the symbol.
TRANSFORM & GetTransform()
int GetOrientation() const
Get the display symbol orientation.
int GetUnitSelection(const SCH_SHEET_PATH *aSheet) const
Return the instance-specific unit selection for the given sheet path.
BOX2I GetBodyAndPinsBoundingBox() const
Return a bounding box for the symbol body and pins but not the fields.
SCH_PIN * GetPin(const wxString &number) const
Find a symbol pin by number.
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populate a std::vector with SCH_FIELDs.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
BOX2I GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the pins or fields.
const STROKE_PARAMS & GetSeparatorsStroke() const
bool StrokeExternal() const
std::vector< SCH_TABLECELL * > GetCells() const
const STROKE_PARAMS & GetBorderStroke() const
VECTOR2I GetPosition() const override
SCH_TABLECELL * GetCell(int aRow, int aCol) const
bool StrokeColumns() const
bool StrokeHeader() const
virtual wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
VECTOR2I GetDrawPos() const override
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
bool IsHypertext() const override
Allow items to support hypertext actions when hovered/clicked.
VECTOR2I GetPosition() const override
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
virtual wxString GetShownText(const SCH_SHEET_PATH *aPath, bool aAllowExtraText, int aDepth=0) const
virtual VECTOR2I GetSchematicTextOffset(const RENDER_SETTINGS *aSettings) const
This offset depends on the orientation, the type of text, and the area required to draw the associate...
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset difference For aFastMode meaning, see function booleanOp.
void Fracture(POLYGON_MODE aFastMode)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
int NewOutline()
Creates a new empty polygon in the set and returns its index.
const BOX2I BBox(int aClearance=0) const override
Compute a bounding box of the shape, with a margin of aClearance a collision.
const SEG & GetSeg() const
An abstract shape on 2D plane.
Simple container to manage line stroke parameters.
KIGFX::COLOR4D GetColor() const
static void Stroke(const SHAPE *aShape, LINE_STYLE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, const std::function< void(const VECTOR2I &a, const VECTOR2I &b)> &aStroker)
A base class for LIB_SYMBOL and SCH_SYMBOL.
int GetPinNameOffset() const
bool GetDNP() const
Set or clear the 'Do Not Populate' flaga.
virtual bool GetShowPinNames() const
virtual bool GetShowPinNumbers() const
bool GetExcludedFromSim() const override
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject)
#define DANGLING_SYMBOL_SIZE
< The size of the rectangle indicating an unconnected wire or label
#define DEFAULT_LINE_WIDTH_MILS
The default wire width in mils. (can be changed in preference menu)
#define UNSELECTED_END_SIZE
The size of the rectangle indicating the anchor of a text object (including fields)
#define TEXT_ANCHOR_SIZE
The default pin len value when creating pins(can be changed in preference menu)
static constexpr EDA_ANGLE ANGLE_0
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
static constexpr EDA_ANGLE ANGLE_270
static constexpr EDA_ANGLE ANGLE_180
#define IS_SHOWN_AS_BITMAP
#define ENDPOINT
ends. (Used to support dragging.)
#define IS_DANGLING
indicates a pin is dangling
#define STARTPOINT
When a line is selected, these flags indicate which.
@ ARC
use RECTANGLE instead of RECT to avoid collision in a Windows header
@ FILLED_WITH_BG_BODYCOLOR
int GetPenSizeForDemiBold(int aTextSize)
int Clamp_Text_PenSize(int aPenSize, int aSize, bool aStrict)
Pen width should not allow characters to become cluttered up in their own fatness.
@ LAYER_DRAW_BITMAPS
to handle and draw images bitmaps
SCH_LAYER_ID
Eeschema drawing layers.
@ LAYER_EXCLUDED_FROM_SIM
@ LAYER_NET_COLOR_HIGHLIGHT
@ LAYER_DEVICE_BACKGROUND
@ LAYER_SELECTION_SHADOWS
@ LAYER_SCHEMATIC_BACKGROUND
#define UNIMPLEMENTED_FOR(type)
VECTOR2I GetPoint(const SHAPE_RECT &aRect, DIRECTION_45::Directions aDir, int aOutset=0)
Get the point on a rectangle that corresponds to a given direction.
The Cairo implementation of the graphics abstraction layer.
static LIB_SYMBOL * dummy()
Used when a LIB_SYMBOL is not found in library to draw a dummy shape.
static void boxText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
static void bitmapText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs)
EESCHEMA_SETTINGS * eeconfig()
static void strokeText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
static void knockoutText(KIGFX::GAL &aGal, const wxString &aText, const VECTOR2D &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
static void drawAltPinModesIcon(GAL &aGal, const VECTOR2D &aPos, double aSize, bool aBaseSelected, bool aRotate, int aExtraLineWidth, const COLOR4D &aColor)
Draw an alternate pin mode indicator icon.
static bool isFieldsLayer(int aLayer)
static BOX2I GetTextExtents(const wxString &aText, const VECTOR2D &aPosition, KIFONT::FONT &aFont, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ 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
static int externalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'external' pin decorators (as a radius)
static int internalPinDecoSize(const RENDER_SETTINGS *aSettings, const SCH_PIN &aPin)
Utility for getting the size of the 'internal' pin decorators (as a radius)
#define TARGET_PIN_RADIUS
Utility functions for working with shapes.
std::vector< FAB_LAYER_COLOR > dummy
LINE_STYLE
Dashed line types.
constexpr int MilsToIU(int mils) const
constexpr int mmToIU(double mm) const
int highlight_netclass_colors_thickness
bool highlight_netclass_colors
double highlight_netclass_colors_alpha
const bool ShouldDraw() const
GR_TEXT_H_ALIGN_T IconSide
std::vector< VECTOR2I > IconPos
@ GR_TEXT_H_ALIGN_INDETERMINATE
@ GR_TEXT_V_ALIGN_INDETERMINATE
constexpr GR_TEXT_H_ALIGN_T GetFlippedAlignment(GR_TEXT_H_ALIGN_T aAlign)
Get the reverse alignment: left-right are swapped, others are unchanged.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
const VECTOR2I CalcArcCenter(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Determine the center of an arc or circle given three points on its circumference.
constexpr int sign(T val)
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D