209 int originalLayer = aLayer;
227 const PAD*
pad =
dynamic_cast<const PAD*
>( aItem );
229 int holeLayer = aLayer;
236 if( !copperLayers.empty() )
237 annularRingLayer = copperLayers.
Seq().front();
241 annularRingLayer =
F_Cu;
270 const PAD*
pad =
static_cast<const PAD*
>( aItem );
273 if(
pcbconfig()->m_Display.m_UseViaColorForNormalTHPadstacks
317 if( visibleLayers.any() )
318 aLayer = visibleLayers.
Seq().back();
368 netColor = ii->second;
419 switch( originalLayer )
423 const PAD*
pad =
static_cast<const PAD*
>( aItem );
425 if(
pad->IsOnLayer( primary ) && !
pad->FlashLayer( primary ) )
446 if(
via->GetLayerSet().test( primary ) == 0 )
459 if( !
via->FlashLayer( primary ) )
493 if(
via->GetLayerSet().test( primary ) == 0 )
529 color = color.
Mix( it->second, dim_factor_Edge_Cuts );
542 color = color.
Mix( backgroundColor, dim_factor_Edge_Cuts );
558 const BOARD* board =
via->GetBoard();
562 if( (
via->GetLayerSet() & visibleLayers ).none() )
613 if( aActualThickness == 0 )
616 return aActualThickness;
686 switch( item->
Type() )
693 draw(
static_cast<const PCB_ARC*
>( item ), aLayer );
697 draw(
static_cast<const PCB_VIA*
>( item ), aLayer );
701 draw(
static_cast<const PAD*
>( item ), aLayer );
737 draw(
static_cast<const ZONE*
>( item ), aLayer );
779 m_gal->SetIsFill(
false );
780 m_gal->SetIsStroke(
true );
793 m_gal->SetLineWidth( 1 );
820 int track_width = aTrack->
GetWidth();
842 m_gal->SetStrokeColor( color );
843 m_gal->SetFillColor( color );
844 m_gal->SetIsStroke( outline_mode );
845 m_gal->SetIsFill( not outline_mode );
854 m_gal->DrawSegment( start,
end, track_width );
867 m_gal->SetIsFill(
false );
868 m_gal->SetIsStroke(
true );
869 m_gal->SetStrokeColor( color );
876 const wxString& aNetName )
const
887 int num_char = aNetName.size();
890 int seg_minlength = aSeg.
GetWidth() * num_char;
897 double penWidth = textSize / 12.0;
905 if(
end.y == start.
y )
910 else if(
end.x == start.
x )
921 num_names = std::max( num_names,
KiROUND( aSeg.
GetSeg().
Length() / ( M_SQRT2 * min_size ) ) );
924 m_gal->SetIsStroke(
true );
925 m_gal->SetIsFill(
false );
926 m_gal->SetStrokeColor( aColor );
927 m_gal->SetLineWidth( penWidth );
928 m_gal->SetFontBold(
false );
929 m_gal->SetFontItalic(
false );
930 m_gal->SetFontUnderlined(
false );
931 m_gal->SetTextMirrored(
false );
932 m_gal->SetGlyphSize(
VECTOR2D( textSize * 0.55, textSize * 0.55 ) );
936 int divisions = num_names + 1;
938 for(
int ii = 1; ii < divisions; ++ii )
940 VECTOR2I textPosition = start + segV * ( (double) ii / divisions );
942 if( viewport.
Contains( textPosition ) )
943 m_gal->BitmapText( aNetName, textPosition, textOrientation );
968 m_gal->SetStrokeColor( color );
969 m_gal->SetFillColor( color );
970 m_gal->SetIsStroke( outline_mode );
971 m_gal->SetIsFill( not outline_mode );
1001 m_gal->SetIsFill(
false );
1002 m_gal->SetIsStroke(
true );
1003 m_gal->SetStrokeColor( color );
1018 m_gal->SetIsFill(
false );
1019 m_gal->SetIsStroke(
true );
1021 m_gal->DrawPolygon( cornerBuffer );
1028 m_gal->SetIsFill(
false );
1029 m_gal->SetIsStroke(
true );
1042 m_gal->SetIsFill(
false );
1043 m_gal->SetIsStroke(
true );
1044 m_gal->SetStrokeColor(
COLOR4D( 0.3, 0.2, 0.5, 1.0 ) );
1046 for(
int idx = 1; idx < arcSpine.
PointCount(); idx++ )
1065 aVia->
LayerPair( &layerTop, &layerBottom );
1071 && ( layerTop !=
F_Cu || layerBottom !=
B_Cu ) );
1083 if( !showNets && !showLayers )
1087 double size = aVia->
GetWidth( currentLayer );
1090 if( size > maxSize )
1094 m_gal->Translate( position );
1097 m_gal->ResetTextAttributes();
1100 m_gal->SetFontBold(
false );
1101 m_gal->SetFontItalic(
false );
1102 m_gal->SetFontUnderlined(
false );
1103 m_gal->SetTextMirrored(
false );
1105 m_gal->SetIsStroke(
true );
1106 m_gal->SetIsFill(
false );
1120 switch( topLayerId )
1122 case F_Cu: topLayer = 1;
break;
1124 default: topLayer = (topLayerId -
B_Cu)/2 + 1;
break;
1127 switch( bottomLayerId )
1129 case F_Cu: bottomLayer = 1;
break;
1131 default: bottomLayer = (bottomLayerId -
B_Cu)/2 + 1;
break;
1135#if wxUSE_UNICODE_WCHAR
1136 layerIds << std::to_wstring( topLayer ) <<
L'-' << std::to_wstring( bottomLayer );
1138 layerIds << std::to_string( topLayer ) <<
'-' << std::to_string( bottomLayer );
1144 int minCharCnt = showLayers ? 6 : 3;
1148 tsize = std::min( tsize, size );
1155 if( showLayers && showNets )
1156 textpos.
y += ( tsize * 1.3 )/ 2;
1158 m_gal->SetGlyphSize( namesize );
1159 m_gal->SetLineWidth( namesize.
x / 10.0 );
1167 textpos.
y -= tsize * 1.3;
1179 m_gal->SetStrokeColor( color );
1180 m_gal->SetFillColor( color );
1181 m_gal->SetIsStroke(
true );
1182 m_gal->SetIsFill(
false );
1192 double maxRadius = aVia->
GetWidth( layerTop ) / 2.0;
1193 double radius = drillRadius + thickness;
1199 thickness =
radius - drillRadius;
1202 if( thickness <= 0 )
1207 m_gal->SetLineWidth( thickness );
1208 radius -= thickness / 2.0;
1212 m_gal->SetIsFill(
true );
1220 m_gal->SetIsStroke(
false );
1221 m_gal->SetIsFill(
true );
1225 m_gal->SetIsStroke(
false );
1226 m_gal->SetIsFill(
true );
1247 m_gal->SetIsFill(
true );
1248 m_gal->SetIsStroke(
false );
1250 m_gal->SetLineWidth( margin );
1277 m_gal->SetLineWidth( annular_width );
1278 radius -= annular_width / 2.0;
1291 if( secDrill.value_or( 0 ) > 0 )
1298 if( terDrill.value_or( 0 ) > 0 )
1328 if( aVia->
FlashLayer( copperLayerForClearance ) )
1334 m_gal->SetIsFill(
false );
1335 m_gal->SetIsStroke(
true );
1336 m_gal->SetStrokeColor( color );
1368 netname = wxT(
"x" );
1370 netname = wxT(
"*" );
1373 if( netname.IsEmpty() && padNumber.IsEmpty() )
1408 for(
const std::shared_ptr<PCB_SHAPE>& primitive : aPad->
GetPrimitives( pcbLayer ) )
1412 position = primitive->GetCenter();
1414 position += aPad->
ShapePos( pcbLayer );
1416 padsize.
x = abs( primitive->GetBotRight().x - primitive->GetTopLeft().x );
1417 padsize.
y = abs( primitive->GetBotRight().y - primitive->GetTopLeft().y );
1431 double limit = std::min( aPad->
GetSize( pcbLayer ).
x,
1432 aPad->
GetSize( pcbLayer ).
y ) * 1.1;
1434 if( padsize.
x > limit && padsize.
y > limit )
1442 double size = padsize.
y;
1445 m_gal->Translate( position );
1448 if( padsize.
x < ( padsize.
y * 0.95 ) )
1452 std::swap( padsize.
x, padsize.
y );
1456 if( size > maxSize )
1460 m_gal->ResetTextAttributes();
1463 m_gal->SetFontBold(
false );
1464 m_gal->SetFontItalic(
false );
1465 m_gal->SetFontUnderlined(
false );
1466 m_gal->SetTextMirrored(
false );
1468 m_gal->SetIsStroke(
true );
1469 m_gal->SetIsFill(
false );
1477 int Y_offset_numpad = 0;
1478 int Y_offset_netname = 0;
1480 if( !netname.IsEmpty() && !padNumber.IsEmpty() )
1484 Y_offset_netname = size / 1.4;
1486 Y_offset_numpad = size / 1.7;
1492 const double Xscale_for_stroked_font = 0.9;
1494 if( !netname.IsEmpty() )
1500 tsize = std::min( tsize, size );
1513 VECTOR2D namesize( tsize*Xscale_for_stroked_font, tsize );
1514 textpos.
y = std::min( tsize * 1.4,
double( Y_offset_netname ) );
1516 m_gal->SetGlyphSize( namesize );
1517 m_gal->SetLineWidth( namesize.
x / 6.0 );
1518 m_gal->SetFontBold(
true );
1522 if( !padNumber.IsEmpty() )
1527 tsize = std::min( tsize, size );
1531 tsize = std::min( tsize, size );
1532 VECTOR2D numsize( tsize*Xscale_for_stroked_font, tsize );
1533 textpos.
y = -Y_offset_numpad;
1535 m_gal->SetGlyphSize( numsize );
1536 m_gal->SetLineWidth( numsize.
x / 6.0 );
1537 m_gal->SetFontBold(
true );
1547 m_gal->SetIsFill(
true );
1548 m_gal->SetIsStroke(
false );
1551 lineWidth = std::min( lineWidth, aPad->
GetSizeX() / 2.0 );
1552 lineWidth = std::min( lineWidth, aPad->
GetSizeY() / 2.0 );
1554 m_gal->SetFillColor( color );
1555 m_gal->SetMinLineWidth( lineWidth );
1559 if( slot->GetSeg().A == slot->GetSeg().B )
1561 double holeRadius = slot->GetWidth() / 2.0;
1562 m_gal->DrawHoleWall( slot->GetSeg().A, holeRadius, lineWidth );
1566 int holeSize = slot->GetWidth() + ( 2 * lineWidth );
1567 m_gal->DrawSegment( slot->GetSeg().A, slot->GetSeg().B, holeSize );
1570 m_gal->SetMinLineWidth( 1.0 );
1578 outline_mode =
true;
1580 bool drawShape =
false;
1594 outline_mode =
true;
1599 outline_mode =
false;
1607 m_gal->SetIsFill(
false );
1608 m_gal->SetIsStroke(
true );
1610 m_gal->SetStrokeColor( color );
1615 m_gal->SetIsFill(
true );
1616 m_gal->SetIsStroke(
false );
1617 m_gal->SetFillColor( color );
1630 else if( drawShape )
1653 expansion.
x = expansion.
y = 0;
1667 margin = std::max( margin, getExpansion( layer ) );
1674 margin = getExpansion( pcbLayer );
1677 std::unique_ptr<PAD> dummyPad;
1678 std::shared_ptr<SHAPE_COMPOUND> shapes;
1681 bool simpleShapes = !outline_mode;
1687 && ( margin.
x < 0 || margin.
y < 0 ) ) )
1695 if( pad_size.
x + 2 * margin.
x <= 0 || pad_size.
y + 2 * margin.
y <= 0 )
1700 int initial_radius = dummyPad->GetRoundRectCornerRadius( pcbLayer );
1702 dummyPad->SetSize( pcbLayer, pad_size + margin + margin );
1708 int radius_margin = std::max( margin.
x, margin.
y );
1709 dummyPad->SetRoundRectCornerRadius(
1710 pcbLayer, std::max( initial_radius + radius_margin, 0 ) );
1713 shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>(
1714 dummyPad->GetEffectiveShape( pcbLayer ) );
1715 margin.
x = margin.
y = 0;
1719 shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>(
1733 simpleShapes =
false;
1736 for(
const SHAPE* shape : shapes->Shapes() )
1741 switch( shape->Type() )
1752 simpleShapes =
false;
1758 const auto drawOneSimpleShape =
1759 [&](
const SHAPE& aShape )
1761 switch( aShape.Type() )
1766 int effectiveWidth = seg.
GetWidth() + 2 * margin.
x;
1768 if( effectiveWidth > 0 )
1777 int effectiveRadius =
circle.GetRadius() + margin.
x;
1779 if( effectiveRadius > 0 )
1780 m_gal->DrawCircle(
circle.GetCenter(), effectiveRadius );
1791 if( effectiveMargin.
x < 0 )
1796 if( effectiveSize.
x > 0 && effectiveSize.
y > 0 )
1797 m_gal->DrawRectangle( pos - effectiveMargin, pos + effectiveSize );
1799 else if( effectiveMargin.
x > 0 )
1805 m_gal->DrawSegment( pos,
1807 effectiveMargin.
x * 2 );
1810 effectiveMargin.
x * 2 );
1813 effectiveMargin.
x * 2 );
1816 effectiveMargin.
x * 2 );
1838 for(
int ii = 0; ii < poly.
PointCount(); ++ii )
1843 m_gal->DrawPolygon( outline );
1856 m_gal->DrawSegment( seg.
A, seg.
B, margin.
x * 2 );
1871 for(
const SHAPE* shape : shapes->Shapes() )
1872 drawOneSimpleShape( *shape );
1879 m_gal->DrawPolygon( polySet );
1892 if( secDrill.
x > 0 )
1899 if( terDrill.
x > 0 )
1920 m_gal->SetIsStroke(
true );
1921 m_gal->SetIsFill(
false );
1922 m_gal->SetStrokeColor( color );
1928 auto shape = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->
GetEffectiveShape( pcbLayer ) );
1930 if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() ==
SH_SEGMENT )
1936 else if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() ==
SH_CIRCLE )
1950 m_gal->DrawPolygon( polySet );
1956 m_gal->DrawSegment( slot->GetSeg().A, slot->GetSeg().B,
1985 isHatchedFill =
false;
2003 if( netname.IsEmpty() )
2030 m_gal->SetIsFill(
false );
2031 m_gal->SetIsStroke(
true );
2035 m_gal->SetFillColor( color );
2036 m_gal->SetStrokeColor( color );
2045 std::vector<VECTOR2I> pts;
2047 offset = offset.
Resize( thickness / 2 );
2049 pts.push_back( aShape->
GetStart() + offset );
2050 pts.push_back( aShape->
GetStart() - offset );
2051 pts.push_back( aShape->
GetEnd() - offset );
2052 pts.push_back( aShape->
GetEnd() + offset );
2055 m_gal->DrawLine( pts[0], pts[1] );
2056 m_gal->DrawLine( pts[1], pts[2] );
2057 m_gal->DrawLine( pts[2], pts[3] );
2058 m_gal->DrawLine( pts[3], pts[0] );
2059 m_gal->DrawLine( ( pts[0] + pts[1] ) / 2, ( pts[1] + pts[2] ) / 2 );
2060 m_gal->DrawLine( ( pts[1] + pts[2] ) / 2, ( pts[2] + pts[3] ) / 2 );
2061 m_gal->DrawLine( ( pts[2] + pts[3] ) / 2, ( pts[3] + pts[0] ) / 2 );
2062 m_gal->DrawLine( ( pts[3] + pts[0] ) / 2, ( pts[0] + pts[1] ) / 2 );
2064 else if( outline_mode )
2070 m_gal->SetIsFill(
true );
2071 m_gal->SetIsStroke(
false );
2094 m_gal->DrawPolygon( outline );
2096 else if( outline_mode )
2098 m_gal->DrawSegmentChain( outline, thickness );
2102 m_gal->SetIsFill(
true );
2103 m_gal->SetIsStroke(
false );
2107 m_gal->DrawSegmentChain( outline, thickness );
2116 m_gal->DrawPolygon( deflated_shape );
2120 m_gal->DrawPolygon( outline );
2132 m_gal->DrawLine( pts[0], pts[1] );
2133 m_gal->DrawLine( pts[1], pts[2] );
2134 m_gal->DrawLine( pts[2], pts[3] );
2135 m_gal->DrawLine( pts[3], pts[0] );
2136 m_gal->DrawLine( pts[0], pts[2] );
2137 m_gal->DrawLine( pts[1], pts[3] );
2139 else if( outline_mode )
2141 m_gal->DrawSegment( pts[0], pts[1], thickness );
2142 m_gal->DrawSegment( pts[1], pts[2], thickness );
2143 m_gal->DrawSegment( pts[2], pts[3], thickness );
2144 m_gal->DrawSegment( pts[3], pts[0], thickness );
2148 m_gal->SetIsFill(
true );
2149 m_gal->SetIsStroke(
false );
2153 m_gal->DrawSegment( pts[0], pts[1], thickness );
2154 m_gal->DrawSegment( pts[1], pts[2], thickness );
2155 m_gal->DrawSegment( pts[2], pts[3], thickness );
2156 m_gal->DrawSegment( pts[3], pts[0], thickness );
2171 m_gal->DrawPolygon( poly );
2188 endAngle - startAngle, thickness,
m_maxError );
2192 m_gal->SetIsFill(
true );
2193 m_gal->SetIsStroke(
false );
2196 endAngle - startAngle, thickness,
m_maxError );
2211 m_gal->SetLineWidth( thickness );
2219 else if( isSolidFill )
2242 m_gal->DrawSegmentChain( shape.
Outline( ii ), thickness );
2246 m_gal->SetIsFill(
true );
2247 m_gal->SetIsStroke(
false );
2252 m_gal->DrawSegmentChain( shape.
Outline( ii ), thickness );
2262 m_gal->DrawPolygon( deflated_shape );
2273 m_gal->DrawPolygon( shape );
2284 std::vector<VECTOR2D> output;
2285 std::vector<VECTOR2D> pointCtrl;
2287 pointCtrl.push_back( aShape->
GetStart() );
2290 pointCtrl.push_back( aShape->
GetEnd() );
2301 m_gal->SetLineWidth( thickness );
2327 m_gal->SetIsFill(
true );
2328 m_gal->SetIsStroke(
false );
2333 for(
SHAPE* shape : shapes )
2339 m_gal->DrawSegment( a, b, thickness );
2343 for(
SHAPE* shape : shapes )
2350 m_gal->SetIsFill(
false );
2351 m_gal->SetIsStroke(
true );
2355 m_gal->DrawLine( seg.A, seg.B );
2387 font->
Draw(
m_gal, aText, pos, aAttrs, aFontMetrics );
2402 if( img_scale != 1.0 )
2410 m_gal->SetIsStroke(
true );
2411 m_gal->SetStrokeColor( color );
2413 m_gal->SetIsFill(
false );
2420 bm_size.
x /= img_scale;
2421 bm_size.
y /= img_scale;
2422 VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
2425 m_gal->DrawRectangle( origin,
end );
2442 draw(
static_cast<const PCB_TEXT*
>( aField ), aLayer );
2450 if( resolvedText.Length() == 0 )
2457 m_gal->SetIsFill(
true );
2458 m_gal->SetIsStroke(
true );
2459 m_gal->SetFillColor( color );
2460 m_gal->SetStrokeColor( color );
2465 m_gal->DrawPolygon( poly );
2477 m_gal->SetStrokeColor( color );
2478 m_gal->SetFillColor( color );
2485 m_gal->SetIsStroke(
false );
2486 m_gal->SetIsFill(
true );
2487 m_gal->DrawPolygon( finalPoly );
2507 textWidth.
x = -textWidth.
x;
2514 textPos -= textWidth;
2516 textPos += textWidth;
2519 strokeText( resolvedText, textPos, attrs, metrics );
2523 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2531 m_gal->DrawGlyphs( *cache );
2564 wxString resolvedText( aTextBox->
GetShownText(
true ) );
2571 m_gal->SetIsFill(
true );
2572 m_gal->SetIsStroke(
false );
2573 m_gal->SetFillColor( sh_color );
2574 m_gal->SetStrokeColor( sh_color );
2578 std::vector<VECTOR2I> pts = aTextBox->
GetCorners();
2579 int line_thickness = std::max( thickness*3,
pcbIUScale.mmToIU( 0.2 ) );
2581 std::deque<VECTOR2D> dpts;
2586 dpts.push_back(
VECTOR2D( pts[0] ) );
2588 m_gal->SetIsStroke(
true );
2589 m_gal->SetLineWidth( line_thickness );
2590 m_gal->DrawPolygon( dpts );
2593 m_gal->SetFillColor( color );
2594 m_gal->SetStrokeColor( color );
2595 m_gal->SetIsFill(
true );
2596 m_gal->SetIsStroke(
false );
2604 std::vector<VECTOR2I> pts = aTextBox->
GetCorners();
2606 for(
size_t ii = 0; ii < pts.size(); ++ii )
2607 m_gal->DrawSegment( pts[ii], pts[( ii + 1 ) % pts.size()], thickness );
2614 for(
SHAPE* shape : shapes )
2619 m_gal->DrawSegment( a, b, thickness );
2623 for(
SHAPE* shape : shapes )
2636 m_canvas->SetFillColor( sh_color );
2637 m_canvas->SetStrokeColor( sh_color );
2650 m_gal->SetIsStroke(
false );
2651 m_gal->SetIsFill(
true );
2652 m_gal->DrawPolygon( finalPoly );
2656 if( resolvedText.Length() == 0 )
2670 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2678 m_gal->DrawGlyphs( *cache );
2694 if( cell->GetColSpan() > 0 || cell->GetRowSpan() > 0 )
2706 m_gal->SetIsFill(
false );
2707 m_gal->SetIsStroke(
true );
2708 m_gal->SetStrokeColor( color );
2709 m_gal->SetLineWidth( lineWidth );
2713 m_gal->DrawLine( ptA, ptB );
2724 m_gal->DrawLine( a+1, b );
2726 m_gal->DrawLine( a, b );
2734 if( aTable->
IsSelected() || cell->IsSelected() )
2736 std::vector<VECTOR2I> corners = cell->GetCorners();
2737 std::deque<VECTOR2D> pts;
2739 pts.insert( pts.end(), corners.begin(), corners.end() );
2742 m_gal->SetIsFill(
true );
2743 m_gal->SetIsStroke(
false );
2744 m_gal->DrawPolygon( pts );
2758 double anchorSize = 5.0 /
m_gal->GetWorldScale();
2759 double anchorThickness = 1.0 /
m_gal->GetWorldScale();
2762 m_gal->SetIsFill(
false );
2763 m_gal->SetIsStroke(
true );
2764 m_gal->SetStrokeColor( color );
2765 m_gal->SetLineWidth( anchorThickness );
2776 m_gal->SetIsFill(
true );
2777 m_gal->SetIsStroke(
false );
2778 m_gal->SetFillColor( color );
2782 m_canvas->DrawPolygon( poly );
2788 m_gal->DrawRectangle( topLeft, botRight );
2805 m_gal->SetIsFill(
true );
2806 m_gal->SetIsStroke(
false );
2807 m_gal->SetFillColor( color );
2810 m_gal->DrawPolygon( frontpoly );
2813 m_gal->DrawPolygon( backpoly );
2839 m_gal->SetStrokeColor( color );
2847 m_gal->DrawLine( topLeft, topLeft + width );
2848 m_gal->DrawLine( topLeft + width, topLeft + width + height );
2849 m_gal->DrawLine( topLeft + width + height, topLeft + height );
2850 m_gal->DrawLine( topLeft + height, topLeft );
2854 if(
name.IsEmpty() )
2858 int scaledSize = abs(
KiROUND(
m_gal->GetScreenWorldMatrix().GetScale().x * ptSize ) );
2859 int unscaledSize =
pcbIUScale.MilsToIU( ptSize );
2862 int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
2868 m_gal->DrawLine( topLeft, topLeft - titleHeight );
2869 m_gal->DrawLine( topLeft - titleHeight, topLeft + width - titleHeight );
2870 m_gal->DrawLine( topLeft + width - titleHeight, topLeft + width );
2892 m_gal->SetIsFill(
true );
2893 m_gal->SetIsStroke(
false );
2894 m_gal->SetFillColor( color );
2917 std::deque<VECTOR2D> corners;
2931 m_gal->SetStrokeColor( color.
a > 0.0 ? color.
WithAlpha( 1.0 ) : color );
2932 m_gal->SetIsFill(
false );
2933 m_gal->SetIsStroke(
true );
2950 int holes_count = outline->
HoleCount( ii );
2952 for(
int jj = 0; jj < holes_count; ++jj )
2953 m_gal->DrawPolyline( outline->
CHole( ii, jj ) );
2958 m_gal->DrawLine( hatchLine.A, hatchLine.B );
2970 if( polySet->OutlineCount() == 0 )
2973 m_gal->SetStrokeColor( color );
2974 m_gal->SetFillColor( color );
2975 m_gal->SetLineWidth( 0 );
2979 m_gal->SetIsFill(
true );
2980 m_gal->SetIsStroke(
false );
2984 m_gal->SetIsFill(
false );
2985 m_gal->SetIsStroke(
true );
2992 if(
m_gal->IsOpenGlEngine() && !polySet->IsTriangulationUpToDate() )
2993 polySet->CacheTriangulation(
true,
true );
3004 m_gal->SetIsFill(
true );
3005 m_gal->SetIsStroke(
false );
3006 m_gal->SetFillColor( color );
3017 m_gal->DrawPolygon( shape );
3025 m_gal->SetStrokeColor( color );
3026 m_gal->SetFillColor( color );
3027 m_gal->SetIsFill(
false );
3028 m_gal->SetIsStroke(
true );
3039 for(
const std::shared_ptr<SHAPE>& shape : aDimension->
GetShapes() )
3041 switch( shape->Type() )
3046 m_gal->DrawLine( seg.
A, seg.
B );
3063 wxString resolvedText = aDimension->
GetShownText(
true );
3074 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
3081 for(
const std::unique_ptr<KIFONT::GLYPH>& glyph : *cache )
3082 m_gal->DrawGlyph( *glyph.get() );
3098 m_gal->SetStrokeColor( strokeColor );
3099 m_gal->SetIsFill(
false );
3100 m_gal->SetIsStroke(
true );
3103 m_gal->Translate( position );
3109 size = 2.0 * aTarget->
GetSize() / 3.0;
3115 size = aTarget->
GetSize() / 2.0;
3134 double size = (double)aPoint->
GetSize() / 2;
3154 m_gal->SetLineWidth( thickness );
3155 m_gal->SetStrokeColor( crossColor );
3156 m_gal->SetIsFill(
false );
3157 m_gal->SetIsStroke(
true );
3160 m_gal->Translate( position );
3167 m_gal->SetStrokeColor( ringColor );
3183 aMarker->
SetZoom( 1.0 / sqrt(
m_gal->GetZoomFactor() ) );
3202 m_gal->SetIsStroke(
true );
3207 m_gal->SetFillColor( color );
3208 m_gal->SetIsFill(
true );
3211 m_gal->DrawPolygon( polygon );
3222 if( shape.GetStroke().GetWidth() == 1.0 )
3224 m_gal->SetIsFill(
false );
3225 m_gal->SetIsStroke(
true );
3231 m_gal->DrawLine( shape.GetStart(), shape.GetEnd() );
3236 shape.CalcArcAngles( startAngle, endAngle );
3238 m_gal->DrawArc( shape.GetCenter(), shape.GetRadius(), startAngle, shape.GetArcAngle() );
3243 m_gal->SetIsFill(
true );
3244 m_gal->SetIsStroke(
false );
3249 m_gal->DrawSegment( shape.GetStart(), shape.GetEnd(), shape.GetWidth() );
3254 shape.CalcArcAngles( startAngle, endAngle );
3256 m_gal->DrawArcSegment( shape.GetCenter(), shape.GetRadius(), startAngle, shape.GetArcAngle(),
3283 m_gal->SetFillColor( outlineColor );
3284 m_gal->AdvanceDepth();
3285 m_gal->SetLineWidth( 0 );
3286 m_gal->SetIsFill(
true );
3287 m_gal->SetIsStroke(
false );
3298 double backdrillRadius = aDrillSize / 2.0;
3299 double lineWidth = std::max( backdrillRadius / 4.0,
m_pcbSettings.m_outlineWidth * 2.0 );
3302 m_gal->AdvanceDepth();
3303 m_gal->SetIsFill(
false );
3304 m_gal->SetIsStroke(
true );
3305 m_gal->SetLineWidth( lineWidth );
3324 if(
const PAD*
pad =
dynamic_cast<const PAD*
>( aItem ) )
3326 size =
pad->GetPostMachiningKnockout( aLayer );
3330 size =
via->GetPostMachiningKnockout( aLayer );
3337 m_gal->AdvanceDepth();
3339 double pmRadius = size / 2.0;
3341 double lineWidth = std::max( pmRadius / 8.0,
m_pcbSettings.m_outlineWidth * 2.0 );
3345 m_gal->SetIsFill(
false );
3346 m_gal->SetIsStroke(
true );
3347 m_gal->SetStrokeColor( layerColor );
3348 m_gal->SetLineWidth( lineWidth );
3351 constexpr int NUM_DASHES = 12;
3354 for(
int i = 0; i < NUM_DASHES; ++i )
3356 EDA_ANGLE startAngle = dashAngle * ( i * 2 );
3357 m_gal->DrawArc( aCenter, pmRadius, startAngle, dashAngle );
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
constexpr int ARC_HIGH_DEF
constexpr EDA_IU_SCALE pcbIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
@ HIDDEN
Inactive layers are hidden.
@ RATSNEST
Net/netclass colors are shown on ratsnest lines only.
@ ALL
Net/netclass colors are shown on all net copper.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
Bezier curves to polygon converter.
void GetPoly(std::vector< VECTOR2I > &aOutput, int aMaxError=10)
Convert a Bezier curve to a polygon.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
virtual NETCLASS * GetEffectiveNetClass() const
Return the NETCLASS for this item.
wxString GetNetname() const
const wxString & GetDisplayNetname() const
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
Container for design settings for a BOARD object.
int GetHolePlatingThickness() const
Pad & via drills are finish size.
int m_SolderMaskExpansion
int GetLineThickness(PCB_LAYER_ID aLayer) const
Return the default graphic segment thickness from the layer class for the given layer.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual BOARD_ITEM * Duplicate(bool addToParentGroup, BOARD_COMMIT *aCommit=nullptr) const
Create a copy of this BOARD_ITEM.
virtual bool IsConnected() const
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
virtual bool IsKnockout() const
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
FOOTPRINT * GetParentFootprint() const
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual void TransformShapeToPolySet(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, KIGFX::RENDER_SETTINGS *aRenderSettings=nullptr) const
Convert the item shape to a polyset.
const KIFONT::METRICS & GetFontMetrics() const
BOARD_ITEM_CONTAINER * GetParent() const
bool IsSideSpecific() const
virtual bool IsOnCopperLayer() const
Information pertinent to a Pcbnew printed circuit board.
BOARD_USE GetBoardUse() const
Get what the board use is.
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
const LSET & GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
int GetCopperLayerCount() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
const LSET & GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
constexpr const Vec & GetPosition() const
constexpr const Vec GetEnd() const
constexpr void SetOrigin(const Vec &pos)
constexpr BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
constexpr size_type GetWidth() const
constexpr Vec Centre() const
constexpr size_type GetHeight() const
constexpr bool Contains(const Vec &aPoint) const
constexpr const Vec & GetOrigin() const
constexpr const SizeVec & GetSize() const
constexpr void SetEnd(coord_type x, coord_type y)
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
virtual const BOX2I GetBoundingBox() const
Return the orthogonal bounding box of this object for display purposes.
KICAD_T Type() const
Returns the type of object.
bool IsBrightened() const
const VECTOR2I & GetBezierC2() const
virtual VECTOR2I GetTopLeft() const
int GetRectangleWidth() 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.
virtual VECTOR2I GetBotRight() const
const std::vector< SEG > & GetHatchLines() const
bool IsHatchedFill() const
virtual int GetHatchLineWidth() const
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
std::vector< VECTOR2I > GetRectCorners() const
const std::vector< VECTOR2I > & GetBezierPoints() const
const VECTOR2I & GetBezierC1() const
int GetRectangleHeight() const
int GetCornerRadius() const
const VECTOR2I & GetTextPos() const
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
BOX2I GetTextBox(const RENDER_SETTINGS *aSettings, int aLine=-1) const
Useful in multiline texts to calculate the full text or a line area (for zones filling,...
GR_TEXT_H_ALIGN_T GetHorizJustify() const
virtual KIFONT::FONT * GetDrawFont(const RENDER_SETTINGS *aSettings) const
const TEXT_ATTRIBUTES & GetAttributes() const
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
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, std::optional< VECTOR2I > aMousePos=std::nullopt, wxString *aActiveUrl=nullptr) const
Draw a string.
virtual bool IsOutline() const
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.
static const COLOR4D CLEAR
COLOR4D & Darken(double aFactor)
Makes the color darker by a given factor.
COLOR4D Darkened(double aFactor) const
Return a color that is darker by a given factor, without modifying object.
COLOR4D Inverted() const
Returns an inverted color, alpha remains the same.
COLOR4D & Brighten(double aFactor)
Makes the color brighter by a given factor.
static const COLOR4D WHITE
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.
static const COLOR4D BLACK
COLOR4D Mix(const COLOR4D &aColor, double aFactor) const
Return a color that is mixed with the input by a factor.
Attribute save/restore for GAL attributes.
Abstract interface for drawing on a 2D-surface.
GAL * m_gal
Instance of graphic abstraction layer that gives an interface to call commands used to draw (eg.
PAINTER(GAL *aGal)
Initialize this object for painting on any of the polymorphic GRAPHICS_ABSTRACTION_LAYER* derivatives...
void drawPostMachiningIndicator(const BOARD_ITEM *aItem, const VECTOR2D &aCenter, PCB_LAYER_ID aLayer)
Draw post-machining indicator (dashed circle) at the given center point.
virtual SHAPE_SEGMENT getPadHoleShape(const PAD *aPad) const
Return hole shape for a pad (internal units).
PCB_PAINTER(GAL *aGal, FRAME_T aFrameType)
int getLineThickness(int aActualThickness) const
Get the thickness to draw for a line (e.g.
void renderNetNameForSegment(const SHAPE_SEGMENT &aSeg, const COLOR4D &aColor, const wxString &aNetName) const
PCB_VIEWERS_SETTINGS_BASE * viewer_settings()
void draw(const PCB_TRACK *aTrack, int aLayer)
virtual PAD_DRILL_SHAPE getDrillShape(const PAD *aPad) const
Return drill shape of a pad.
int m_holePlatingThickness
PCB_RENDER_SETTINGS m_pcbSettings
virtual int getViaDrillSize(const PCB_VIA *aVia) const
Return drill diameter for a via (internal units).
void strokeText(const wxString &aText, const VECTOR2I &aPosition, const TEXT_ATTRIBUTES &aAttrs, const KIFONT::METRICS &aFontMetrics)
void drawBackdrillIndicator(const BOARD_ITEM *aItem, const VECTOR2D &aCenter, int aDrillSize, PCB_LAYER_ID aStartLayer, PCB_LAYER_ID aEndLayer)
Draw backdrill indicator (two semi-circles) at the given center point.
virtual bool Draw(const VIEW_ITEM *aItem, int aLayer) override
Takes an instance of VIEW_ITEM and passes it to a function that knows how to draw the item.
double m_zoneOpacity
Opacity override for filled zones.
double m_trackOpacity
Opacity override for all tracks.
double m_imageOpacity
Opacity override for user images.
double m_viaOpacity
Opacity override for all types of via.
ZONE_DISPLAY_MODE m_ZoneDisplayMode
void LoadColors(const COLOR_SETTINGS *aSettings) override
double m_padOpacity
Opacity override for SMD pads and PTHs.
void SetBackgroundColor(const COLOR4D &aColor) override
Set the background color.
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...
HIGH_CONTRAST_MODE m_ContrastModeDisplay
std::map< int, KIGFX::COLOR4D > m_netColors
Set of net codes that should not have their ratsnest displayed.
NET_COLOR_MODE m_netColorMode
Overrides for specific netclass colors.
static const double MAX_FONT_SIZE
< Maximum font size for netnames (and other dynamically shown strings)
double m_filledShapeOpacity
Opacity override for graphic shapes.
bool m_ForceShowFieldsWhenFPSelected
bool GetShowPageLimits() const override
void LoadDisplayOptions(const PCB_DISPLAY_OPTIONS &aOptions)
Load settings related to display options (high-contrast mode, full or outline modes for vias/pads/tra...
bool m_ForcePadSketchModeOn
COLOR4D m_backgroundColor
PCB_LAYER_ID GetPrimaryHighContrastLayer() const
Return the board layer which is in high-contrast mode.
void SetGapLengthRatio(double aRatio)
PCB_LAYER_ID GetActiveLayer() const
std::map< int, COLOR4D > m_layerColorsHi
virtual void update()
Precalculates extra colors for layers (e.g.
void SetDashLengthRatio(double aRatio)
std::set< int > m_highlightNetcodes
std::map< int, COLOR4D > m_layerColorsDark
std::map< int, COLOR4D > m_layerColorsSel
std::set< int > m_highContrastLayers
std::map< int, COLOR4D > m_layerColors
bool m_hiContrastEnabled
Parameters for display modes.
An abstract base class for deriving all objects that can be added to a VIEW.
bool IsBOARD_ITEM() const
double GetForcedTransparency() const
LSET is a set of PCB_LAYER_IDs.
PCB_LAYER_ID ExtractLayer() const
Find the first set PCB_LAYER_ID.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllCuMask(int aCuLayerCount)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
static const LSET & PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
int MarkerScale() const
The scaling factor to convert polygonal shape coordinates to internal units.
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...
A collection of nets and the parameters used to route or test these nets.
COLOR4D GetPcbColor(bool aIsForSave=false) const
static const int UNCONNECTED
Constant that holds the "unconnected net" number (typically 0) all items "connected" to this net are ...
@ NORMAL
Shape is the same on all layers.
int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const override
Return the pad's "own" clearance in internal units.
LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives(PCB_LAYER_ID aLayer) const
Accessor to the basic shape list for custom-shaped pads.
bool FlashLayer(int aLayer, bool aOnlyCheckIfPermitted=false) const
Check to see whether the pad should be flashed on the specific layer.
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer, FLASHING flashPTHPads=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
PAD_ATTRIB GetAttribute() const
const wxString & GetPinFunction() const
const wxString & GetNumber() const
VECTOR2I GetPosition() const override
PCB_LAYER_ID GetTertiaryDrillEndLayer() const
PCB_LAYER_ID GetTertiaryDrillStartLayer() const
bool IsNoConnectPad() const
int GetDrillSizeX() const
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc=ERROR_INSIDE, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
int GetSolderMaskExpansion(PCB_LAYER_ID aLayer) const
const VECTOR2I & GetOffset(PCB_LAYER_ID aLayer) const
const VECTOR2I & GetSecondaryDrillSize() const
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
PAD_DRILL_SHAPE GetDrillShape() const
VECTOR2I GetSolderPasteMargin(PCB_LAYER_ID aLayer) const
Usually < 0 (mask shape smaller than pad)because the margin can be dependent on the pad size,...
PCB_LAYER_ID GetSecondaryDrillStartLayer() const
const VECTOR2I & GetTertiaryDrillSize() const
VECTOR2I ShapePos(PCB_LAYER_ID aLayer) const
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Return a SHAPE_SEGMENT object representing the pad's hole.
PCB_LAYER_ID GetSecondaryDrillEndLayer() const
const VECTOR2I & GetSize(PCB_LAYER_ID aLayer) const
DISPLAY_OPTIONS m_Display
EDA_ANGLE GetArcAngleStart() const
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
EDA_ANGLE GetAngle() const
const VECTOR2I & GetMid() const
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
void GetBoundingHull(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc=ERROR_INSIDE) const
const SHAPE_POLY_SET & GetOutline() const
int GetLineThickness() const
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
double m_TrackOpacity
Opacity override for all tracks.
double m_FilledShapeOpacity
Opacity override for graphic shapes.
double m_ZoneOpacity
Opacity override for filled zone areas.
double m_ImageOpacity
Opacity override for user images.
double m_PadOpacity
Opacity override for SMD pads and PTHs.
double m_ViaOpacity
Opacity override for all types of via.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
NET_COLOR_MODE m_NetColorMode
How to use color overrides on specific nets and netclasses.
ZONE_DISPLAY_MODE m_ZoneDisplayMode
A set of BOARD_ITEMs (i.e., without duplicates).
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void SetZoom(double aZoomFactor) const
std::vector< PCB_SHAPE > GetShapes() const
GAL_LAYER_ID GetColorLayer() const
VECTOR2I GetPosition() const override
PCB_VIEWERS_SETTINGS_BASE * viewer_settings()
A PCB_POINT is a 0-dimensional point that is used to mark a position on a PCB, or more usually a foot...
VECTOR2I GetPosition() const override
Object to handle a bitmap image that can be inserted in a PCB.
REFERENCE_IMAGE & GetReferenceImage()
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
int GetWidth() const override
bool HasSolderMask() const
int GetSolderMaskExpansion() const
virtual std::vector< VECTOR2I > GetCorners() const
Return 4 corners for a rectangle or rotated rectangle (stored as a poly).
bool IsProxyItem() const override
STROKE_PARAMS GetStroke() const override
void UpdateHatching() const override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
std::vector< PCB_TABLECELL * > GetCells() const
void DrawBorders(const std::function< void(const VECTOR2I &aPt1, const VECTOR2I &aPt2, const STROKE_PARAMS &aStroke)> &aCallback) const
VECTOR2I GetPosition() const override
bool IsBorderEnabled() const
Disables the border, this is done by changing the stroke internally.
void TransformTextToPolySet(SHAPE_POLY_SET &aBuffer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc) const
Function TransformTextToPolySet Convert the text to a polygonSet describing the actual character stro...
VECTOR2I GetDrawPos() const override
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
SHAPE_POLY_SET GetKnockoutCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, int aMaxError) const
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth=false) const override
Convert the item shape to a closed polygon.
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
EDA_ANGLE GetDrawRotation() const override
int GetSolderMaskExpansion() const
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
virtual int GetWidth() const
PCB_LAYER_ID BottomLayer() const
PCB_LAYER_ID GetTertiaryDrillEndLayer() const
std::optional< int > GetTertiaryDrillSize() const
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
std::optional< int > GetSecondaryDrillSize() const
PCB_LAYER_ID GetSecondaryDrillEndLayer() const
int GetWidth() const override
PCB_LAYER_ID GetTertiaryDrillStartLayer() const
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
PCB_LAYER_ID TopLayer() const
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
VIATYPE GetViaType() const
PCB_LAYER_ID GetSecondaryDrillStartLayer() const
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Return the 2 layers used by the via (the via actually uses all layers between these 2 layers)
VIEWERS_DISPLAY_OPTIONS m_ViewersDisplay
virtual COMMON_SETTINGS * GetCommonSettings() const
virtual SETTINGS_MANAGER & GetSettingsManager() const
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
VECTOR2I GetPosition() const
const BITMAP_BASE & GetImage() const
Get the underlying image.
double GetImageScale() const
A round rectangle shape, based on a rectangle and a radius.
void TransformToPolygon(SHAPE_POLY_SET &aBuffer, int aMaxError) const
Get the polygonal representation of the roundrect.
VECTOR2I::extended_type ecoord
int Length() const
Return the length (this).
ecoord SquaredLength() const
T * GetAppSettings(const char *aFilename)
Return a handle to the a given settings by type.
VECTOR2I GetEnd() const override
const SHAPE_LINE_CHAIN ConvertToPolyline(int aMaxError=DefaultAccuracyForPCB(), int *aActualError=nullptr) const
Construct a SHAPE_LINE_CHAIN of segments from a given arc.
VECTOR2I GetStart() const override
const VECTOR2I & GetCenter() const
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
int PointCount() const
Return the number of points (vertices) in this line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
Represent a set of closed polygons.
bool IsTriangulationUpToDate() const
virtual void CacheTriangulation(bool aPartition=true, bool aSimplify=false)
Build a polygon triangulation, needed to draw a polygon on OpenGL and in some other calculations.
void Inflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError, bool aSimplify=false)
Perform outline inflation/deflation.
int HoleCount(int aOutline) const
Returns the number of holes in a given outline.
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)
SHAPE_LINE_CHAIN & Outline(int aIndex)
Return the reference to aIndex-th outline in the set.
int NewOutline()
Creates a new empty polygon in the set and returns its index.
void Deflate(int aAmount, CORNER_STRATEGY aCornerStrategy, int aMaxError)
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
int OutlineCount() const
Return the number of outlines in the set.
void Fracture(bool aSimplify=true)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
int GetWidth() const override
const VECTOR2I & GetPosition() const
const VECTOR2I GetSize() const
const SEG & GetSeg() const
int GetWidth() const override
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
const SHAPE_LINE_CHAIN & Vertices() const
Return the list of vertices defining this simple polygon.
virtual const SEG GetSegment(int aIndex) const override
const VECTOR2I & CPoint(int aIndex) const
Return a const reference to a given point in the polygon.
int PointCount() const
Return the number of points (vertices) in this polygon.
virtual size_t GetSegmentCount() const override
An abstract shape on 2D plane.
Simple container to manage line stroke parameters.
LINE_STYLE GetLineStyle() 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)
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
Handle a list of polygons defining a copper zone.
const std::vector< SEG > & GetHatchLines() const
std::shared_ptr< SHAPE_POLY_SET > GetFilledPolysList(PCB_LAYER_ID aLayer) const
SHAPE_POLY_SET * Outline()
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Test to see if this object is on the given layer.
bool IsTeardropArea() const
ZONE_BORDER_DISPLAY_STYLE GetHatchStyle() const
void TransformArcToPolygon(SHAPE_POLY_SET &aBuffer, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, int aWidth, int aError, ERROR_LOC aErrorLoc)
Convert arc to multiple straight segments.
@ CHAMFER_ALL_CORNERS
All angles are chamfered.
@ ROUND_ALL_CORNERS
All angles are rounded.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
static constexpr EDA_ANGLE ANGLE_360
#define IGNORE_PARENT_GROUP
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
@ FRAME_FOOTPRINT_PREVIEW
@ FRAME_FOOTPRINT_CHOOSER
a few functions useful in geometry calculations.
int GetPenSizeForNormal(int aTextSize)
double m_HoleWallPaintingMultiplier
What factor to use when painting via and PTH pad hole walls, so that the painted hole wall can be ove...
bool IsSolderMaskLayer(int aLayer)
@ LAYER_PAD_FR_NETNAMES
Additional netnames layers (not associated with a PCB layer).
@ NETNAMES_LAYER_ID_START
bool IsPcbLayer(int aLayer)
Test whether a layer is a valid layer for Pcbnew.
bool IsPadCopperLayer(int aLayer)
bool IsPointsLayer(int aLayer)
int GetNetnameLayer(int aLayer)
Return a netname layer corresponding to the given layer.
bool IsClearanceLayer(int aLayer)
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
@ LAYER_POINTS
PCB reference/manual snap points visibility.
@ LAYER_LOCKED_ITEM_SHADOW
Shadow layer for locked items.
@ LAYER_PAD_COPPER_START
Virtual layers for pad copper on a given copper layer.
@ LAYER_CONFLICTS_SHADOW
Shadow layer for items flagged conflicting.
@ LAYER_NON_PLATEDHOLES
Draw usual through hole vias.
@ LAYER_DRC_EXCLUSION
Layer for DRC markers which have been individually excluded.
@ LAYER_PCB_BACKGROUND
PCB background color.
@ LAYER_DRC_SHAPES
Custom shapes for DRC markers.
@ LAYER_PADS
Meta control for all pads opacity/visibility (color ignored).
@ LAYER_DRC_WARNING
Layer for DRC markers with #SEVERITY_WARNING.
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
@ LAYER_VIA_COPPER_START
Virtual layers for via copper on a given copper layer.
@ LAYER_CLEARANCE_START
Virtual layers for pad/via/track clearance outlines for a given copper layer.
@ LAYER_ZONE_START
Virtual layers for stacking zones and tracks on a given copper layer.
@ LAYER_ANCHOR
Anchor of items having an anchor point (texts, footprints).
@ LAYER_VIA_BURIED
Draw blind vias.
@ LAYER_MARKER_SHADOWS
Shadows for DRC markers.
@ LAYER_VIA_HOLES
Draw via holes (pad holes do not use this layer).
@ LAYER_VIA_BLIND
Draw micro vias.
@ LAYER_VIA_THROUGH
Draw buried vias.
@ LAYER_DRC_ERROR
Layer for DRC markers with #SEVERITY_ERROR.
bool IsViaCopperLayer(int aLayer)
bool IsNetnameLayer(int aLayer)
Test whether a layer is a netname layer.
bool IsHoleLayer(int aLayer)
bool IsExternalCopperLayer(int aLayerId)
Test whether a layer is an external (F_Cu or B_Cu) copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
bool IsZoneFillLayer(int aLayer)
PCB_LAYER_ID ToLAYER_ID(int aLayer)
MATRIX3x3< double > MATRIX3x3D
The Cairo implementation of the graphics abstraction layer.
PAD_DRILL_SHAPE
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
@ PTH
Plated through hole pad.
BARCODE class definition.
Class to handle a set of BOARD_ITEMs.
PCBNEW_SETTINGS * pcbconfig()
PGM_BASE & Pgm()
The global program "get" accessor.
PGM_BASE * PgmOrNull()
Return a reference that can be nullptr when running a shared lib from a script, not from a kicad app.
@ SH_RECT
axis-aligned rectangle
@ SH_SIMPLE
simple polygon
wxString UnescapeString(const wxString &aSource)
int PrintableCharCount(const wxString &aString)
Return the number of printable (ie: non-formatting) chars.
LINE_STYLE
Dashed line types.
double hicontrast_dimming_factor
bool m_DisplayPcbTrackFill
bool m_DisplayGraphicsFill
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
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.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_BOARD_OUTLINE_T
class PCB_BOARD_OUTLINE_T, a pcb board outline item
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D