201 int originalLayer = aLayer;
217 const PAD*
pad =
dynamic_cast<const PAD*
>( aItem );
219 int holeLayer = aLayer;
224 if(
pad &&
pad->GetAttribute() == PAD_ATTRIB::PTH )
225 annularRingLayer =
F_Cu;
227 annularRingLayer =
F_Cu;
266 if( visibleLayers.any() )
267 aLayer = visibleLayers.
Seq().back();
312 netColor = ii->second;
363 switch( originalLayer )
368 const PAD*
pad =
static_cast<const PAD*
>( aItem );
370 if(
pad->IsOnLayer( primary ) && !
pad->FlashLayer( primary ) )
390 if(
via->GetLayerSet().test( primary ) == 0 )
403 if( !
via->FlashLayer( primary ) )
428 if(
via->GetViaType() == VIATYPE::THROUGH )
437 if(
via->GetLayerSet().test( primary ) == 0 )
472 color =
color.Mix( it->second, dim_factor_Edge_Cuts );
485 color =
color.Mix( backgroundColor, dim_factor_Edge_Cuts );
499 const BOARD* board =
via->GetBoard();
503 if( (
via->GetLayerSet() & visibleLayers ).none() )
514 else if( aItem->
Type() ==
PCB_ZONE_T &&
static_cast<const ZONE*
>( aItem )->IsTeardropArea() )
541 m_frameType( aFrameType ),
543 m_holePlatingThickness( 0 ),
544 m_lockedShadowMargin( 0 )
554 if( aActualThickness == 0 )
557 return aActualThickness;
627 switch( item->
Type() )
634 draw(
static_cast<const PCB_ARC*
>( item ), aLayer );
638 draw(
static_cast<const PCB_VIA*
>( item ), aLayer );
642 draw(
static_cast<const PAD*
>( item ), aLayer );
675 draw(
static_cast<const ZONE*
>( item ), aLayer );
746 int track_width = aTrack->
GetWidth();
811 const wxString& aNetName )
const
822 int num_char = aNetName.size();
825 int seg_minlength = aSeg.
GetWidth() * num_char;
832 double penWidth = textSize / 12.0;
840 if( end.
y == start.
y )
845 else if( end.
x == start.
x )
856 num_names = std::max( num_names,
KiROUND( aSeg.
GetSeg().
Length() / ( M_SQRT2 * min_size ) ) );
871 int divisions = num_names + 1;
873 for(
int ii = 1; ii < divisions; ++ii )
875 VECTOR2I textPosition = start + segV * ( (double) ii / divisions );
877 if( viewport.
Contains( textPosition ) )
951 ERROR_LOC errorloc = aLayer ==
F_Cu ? ERROR_LOC::ERROR_INSIDE : ERROR_LOC::ERROR_OUTSIDE;
971 for(
int idx = 1; idx < arcSpine.
PointCount(); idx++ )
988 aVia->
LayerPair( &layerTop, &layerBottom );
991 bool isBlindBuried = aVia->
GetViaType() == VIATYPE::BLIND_BURIED
993 && ( layerTop !=
F_Cu || layerBottom !=
B_Cu ) );
1003 bool showLayers = aVia->
GetViaType() != VIATYPE::THROUGH;
1005 if( !showNets && !showLayers )
1009 double size = aVia->
GetWidth( currentLayer );
1012 if( size > maxSize )
1042 switch( topLayerId )
1044 case F_Cu: topLayer = 1;
break;
1046 default: topLayer = (topLayerId -
B_Cu)/2 + 1;
break;
1049 switch( bottomLayerId )
1051 case F_Cu: bottomLayer = 1;
break;
1053 default: bottomLayer = (bottomLayerId -
B_Cu)/2 + 1;
break;
1057#if wxUSE_UNICODE_WCHAR
1058 layerIds << std::to_wstring( topLayer ) << L
'-' << std::to_wstring( bottomLayer );
1060 layerIds << std::to_string( topLayer ) <<
'-' << std::to_string( bottomLayer );
1066 int minCharCnt = showLayers ? 6 : 3;
1070 tsize = std::min( tsize, size );
1077 if( showLayers && showNets )
1078 textpos.
y += ( tsize * 1.3 )/ 2;
1089 textpos.
y -= tsize * 1.3;
1163 double radius = aVia->
GetWidth( currentLayer ) / 2.0;
1185 radius -= annular_width / 2.0;
1218 radius = aVia->
GetWidth( activeLayer ) / 2.0;
1258 netname = wxT(
"x" );
1260 netname = wxT(
"*" );
1263 if( netname.IsEmpty() && padNumber.IsEmpty() )
1295 else if( aPad->
GetShape( pcbLayer ) == PAD_SHAPE::CUSTOM )
1298 for(
const std::shared_ptr<PCB_SHAPE>& primitive : aPad->
GetPrimitives( pcbLayer ) )
1300 if( primitive->IsProxyItem() && primitive->GetShape() == SHAPE_T::RECTANGLE )
1302 position = primitive->GetCenter();
1304 position += aPad->
ShapePos( pcbLayer );
1306 padsize.
x = abs( primitive->GetBotRight().x - primitive->GetTopLeft().x );
1307 padsize.
y = abs( primitive->GetBotRight().y - primitive->GetTopLeft().y );
1318 if( aPad->
GetShape( pcbLayer ) != PAD_SHAPE::CUSTOM )
1321 double limit = std::min( aPad->
GetSize( pcbLayer ).
x,
1322 aPad->
GetSize( pcbLayer ).
y ) * 1.1;
1324 if( padsize.
x > limit && padsize.
y > limit )
1332 double size = padsize.
y;
1338 if( padsize.
x < ( padsize.
y * 0.95 ) )
1342 std::swap( padsize.
x, padsize.
y );
1346 if( size > maxSize )
1367 int Y_offset_numpad = 0;
1368 int Y_offset_netname = 0;
1370 if( !netname.IsEmpty() && !padNumber.IsEmpty() )
1374 Y_offset_netname = size / 1.4;
1376 Y_offset_numpad = size / 1.7;
1382 const double Xscale_for_stroked_font = 0.9;
1384 if( !netname.IsEmpty() )
1390 tsize = std::min( tsize, size );
1397 if( aPad->
GetShape( pcbLayer ) == PAD_SHAPE::CIRCLE
1398 || aPad->
GetShape( pcbLayer ) == PAD_SHAPE::OVAL )
1403 VECTOR2D namesize( tsize*Xscale_for_stroked_font, tsize );
1404 textpos.
y = std::min( tsize * 1.4,
double( Y_offset_netname ) );
1412 if( !padNumber.IsEmpty() )
1417 tsize = std::min( tsize, size );
1421 tsize = std::min( tsize, size );
1422 VECTOR2D numsize( tsize*Xscale_for_stroked_font, tsize );
1423 textpos.
y = -Y_offset_numpad;
1445 if( slot->GetSeg().A == slot->GetSeg().B )
1456 outline_mode =
true;
1474 bool drawShape =
false;
1496 outline_mode =
true;
1526 margin.
x = margin.
y = 0;
1530 std::unique_ptr<PAD> dummyPad;
1531 std::shared_ptr<SHAPE_COMPOUND> shapes;
1534 bool simpleShapes = !outline_mode;
1538 if( ( margin.
x != margin.
y && aPad->
GetShape( pcbLayer ) != PAD_SHAPE::CUSTOM )
1539 || ( aPad->
GetShape( pcbLayer ) == PAD_SHAPE::ROUNDRECT
1540 && ( margin.
x < 0 || margin.
y < 0 ) ) )
1548 if( pad_size.
x + 2 * margin.
x <= 0 || pad_size.
y + 2 * margin.
y <= 0 )
1551 dummyPad.reset(
static_cast<PAD*
>( aPad->
Duplicate() ) );
1553 if( dummyPad->GetParentGroup() )
1554 dummyPad->GetParentGroup()->RemoveItem( dummyPad.get() );
1556 int initial_radius = dummyPad->GetRoundRectCornerRadius( pcbLayer );
1558 dummyPad->SetSize( pcbLayer, pad_size + margin + margin );
1560 if( dummyPad->GetShape( pcbLayer ) == PAD_SHAPE::ROUNDRECT )
1564 int radius_margin = std::max( margin.
x, margin.
y );
1565 dummyPad->SetRoundRectCornerRadius(
1566 pcbLayer, std::max( initial_radius + radius_margin, 0 ) );
1569 shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>(
1570 dummyPad->GetEffectiveShape( pcbLayer ) );
1571 margin.
x = margin.
y = 0;
1575 shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>(
1585 if( aPad->
GetShape( pcbLayer ) == PAD_SHAPE::CUSTOM && ( margin.
x || margin.
y ) )
1589 simpleShapes =
false;
1592 for(
const SHAPE* shape : shapes->Shapes() )
1597 switch( shape->Type() )
1608 simpleShapes =
false;
1616 for(
const SHAPE* shape : shapes->Shapes() )
1618 switch( shape->Type() )
1623 int effectiveWidth = seg->
GetWidth() + 2 * margin.
x;
1625 if( effectiveWidth > 0 )
1634 int effectiveRadius = circle->
GetRadius() + margin.
x;
1636 if( effectiveRadius > 0 )
1648 if( effectiveMargin.
x < 0 )
1653 if( effectiveSize.
x > 0 && effectiveSize.
y > 0 )
1656 else if( effectiveMargin.
x > 0 )
1664 effectiveMargin.
x * 2 );
1667 effectiveMargin.
x * 2 );
1670 effectiveMargin.
x * 2 );
1673 effectiveMargin.
x * 2 );
1695 for(
int ii = 0; ii < poly->
PointCount(); ++ii )
1698 outline.
Deflate( -margin.
x, CORNER_STRATEGY::CHAMFER_ALL_CORNERS,
1761 if( aPad->
FlashLayer( activeLayer ) && clearance > 0 )
1763 auto shape = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->
GetEffectiveShape( pcbLayer ) );
1765 if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() ==
SH_SEGMENT )
1771 else if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() ==
SH_CIRCLE )
1792 slot->GetWidth() + 2 * clearance );
1827 if( netname.IsEmpty() )
1830 if( aShape->
GetShape() == SHAPE_T::SEGMENT )
1864 case SHAPE_T::SEGMENT:
1867 std::vector<VECTOR2I> pts;
1869 offset = offset.
Resize( thickness / 2 );
1871 pts.push_back( aShape->
GetStart() + offset );
1872 pts.push_back( aShape->
GetStart() - offset );
1873 pts.push_back( aShape->
GetEnd() - offset );
1874 pts.push_back( aShape->
GetEnd() + offset );
1881 m_gal->
DrawLine( ( pts[0] + pts[1] ) / 2, ( pts[1] + pts[2] ) / 2 );
1882 m_gal->
DrawLine( ( pts[1] + pts[2] ) / 2, ( pts[2] + pts[3] ) / 2 );
1883 m_gal->
DrawLine( ( pts[2] + pts[3] ) / 2, ( pts[3] + pts[0] ) / 2 );
1884 m_gal->
DrawLine( ( pts[3] + pts[0] ) / 2, ( pts[0] + pts[1] ) / 2 );
1886 else if( outline_mode )
1900 case SHAPE_T::RECTANGLE:
1914 else if( outline_mode )
1944 poly.
Inflate( thickness / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS,
1964 endAngle - startAngle, thickness,
m_maxError );
1972 endAngle - startAngle, thickness,
m_maxError );
1977 case SHAPE_T::CIRCLE:
1993 radius += thickness / 2;
1994 radius = std::max( radius, 0 );
2034 if( thickness >= 0 )
2041 deflated_shape.
Inflate( thickness / 2, CORNER_STRATEGY::ROUND_ALL_CORNERS,
2051 case SHAPE_T::BEZIER:
2054 std::vector<VECTOR2D> output;
2055 std::vector<VECTOR2D> pointCtrl;
2057 pointCtrl.push_back( aShape->
GetStart() );
2060 pointCtrl.push_back( aShape->
GetEnd() );
2088 case SHAPE_T::UNDEFINED:
2102 for(
SHAPE* shape : shapes )
2108 m_gal->DrawSegment( a, b, thickness );
2112 for(
SHAPE* shape : shapes )
2145 font->
Draw(
m_gal, aText, pos, aAttrs, aFontMetrics );
2160 if( img_scale != 1.0 )
2176 bm_size.
x /= img_scale;
2177 bm_size.
y /= img_scale;
2178 VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
2261 textPos -= textWidth;
2263 textPos += textWidth;
2266 strokeText( resolvedText, textPos, attrs, metrics );
2270 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2311 wxString resolvedText( aTextBox->
GetShownText(
true ) );
2332 std::vector<VECTOR2I> pts = aTextBox->
GetCorners();
2335 std::deque<VECTOR2D> dpts;
2340 dpts.push_back(
VECTOR2D( pts[0] ) );
2361 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
2365 std::vector<VECTOR2I> pts = aTextBox->
GetCorners();
2367 for(
size_t ii = 0; ii < pts.size(); ++ii )
2375 for(
SHAPE* shape : shapes )
2384 for(
SHAPE* shape : shapes )
2405 if( resolvedText.Length() == 0 )
2419 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2457 lineStyle = stroke.GetLineStyle();
2466 [&](
const SHAPE& shape )
2482 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
2496 if( lineStyle <= LINE_STYLE::FIRST_TYPE )
2503 strokeShape( rect );
2513 for(
int col = 0; col < aTable->
GetColCount() - 1; ++col )
2515 for(
int row = 0; row < aTable->
GetRowCount(); ++row )
2524 strokeLine( topRight, cell->
GetEnd() );
2531 for(
int row = 0; row < aTable->
GetRowCount() - 1; ++row )
2533 for(
int col = 0; col < aTable->
GetColCount(); ++col )
2542 strokeLine( botLeft, cell->
GetEnd() );
2567 strokeRect( pos, end );
2574 if( aTable->
IsSelected() || cell->IsSelected() )
2576 std::vector<VECTOR2I> corners = cell->GetCorners();
2577 std::deque<VECTOR2D> pts;
2579 pts.insert( pts.end(), corners.begin(), corners.end() );
2688 m_gal->
DrawLine( topLeft + width, topLeft + width + height );
2689 m_gal->
DrawLine( topLeft + width + height, topLeft + height );
2694 if(
name.IsEmpty() )
2702 int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
2709 m_gal->
DrawLine( topLeft - titleHeight, topLeft + width - titleHeight );
2710 m_gal->
DrawLine( topLeft + width - titleHeight, topLeft + width );
2757 std::deque<VECTOR2D> corners;
2764 bool allowDrawOutline = aZone->
GetHatchStyle() != ZONE_BORDER_DISPLAY_STYLE::INVISIBLE_BORDER;
2787 int holes_count = outline->
HoleCount( ii );
2789 for(
int jj = 0; jj < holes_count; ++jj )
2801 && ( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED
2802 || displayMode == ZONE_DISPLAY_MODE::SHOW_FRACTURE_BORDERS
2803 || displayMode == ZONE_DISPLAY_MODE::SHOW_TRIANGULATION ) )
2807 if( polySet->OutlineCount() == 0 )
2814 if( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED )
2830 polySet->CacheTriangulation(
true,
true );
2832 m_gal->
DrawPolygon( *polySet, displayMode == ZONE_DISPLAY_MODE::SHOW_TRIANGULATION );
2855 for(
const std::shared_ptr<SHAPE>& shape : aDimension->
GetShapes() )
2857 switch( shape->Type() )
2861 const SEG& seg =
static_cast<const SHAPE_SEGMENT*
>( shape.get() )->GetSeg();
2868 int radius =
static_cast<const SHAPE_CIRCLE*
>( shape.get() )->GetRadius();
2879 wxString resolvedText = aDimension->
GetShownText(
true );
2890 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2897 for(
const std::unique_ptr<KIFONT::GLYPH>& glyph : *cache )
2911 double size, radius;
2925 size = 2.0 * aTarget->
GetSize() / 3.0;
2926 radius = aTarget->
GetSize() / 2.0;
2931 size = aTarget->
GetSize() / 2.0;
2932 radius = aTarget->
GetSize() / 3.0;
3003 switch( shape.GetShape() )
3005 case SHAPE_T::SEGMENT:
3011 shape.CalcArcAngles( startAngle, endAngle );
3013 shape.GetArcAngle(), shape.GetWidth(), arc_to_seg_error );
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
constexpr EDA_IU_SCALE gerbIUScale
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
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 bool IsConnected() const
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
virtual bool IsKnockout() const
virtual BOARD_ITEM * Duplicate() const
Create a copy of this BOARD_ITEM.
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.
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.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
LSET GetVisibleLayers() const
A proxy function that calls the correspondent function in m_BoardSettings.
bool IsElementVisible(GAL_LAYER_ID aLayer) const
Test whether a given element category is visible.
int GetCopperLayerCount() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
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
bool IsHorizontal() 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
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 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
const VECTOR2I & GetTextPos() const
const EDA_ANGLE & GetTextAngle() 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
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) 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 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
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
static const COLOR4D BLACK
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 DrawGlyph(const KIFONT::GLYPH &aGlyph, int aNth=0, int aTotal=1)
Draw a polygon representing a font glyph.
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 SetFontBold(const bool aBold)
void SetFontUnderlined(bool aUnderlined)
void SetHorizontalJustify(const GR_TEXT_H_ALIGN_T aHorizontalJustify)
double GetZoomFactor() const
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 DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
virtual void Restore()
Restore the context.
virtual bool IsOpenGlEngine()
Return true if the GAL engine is a OpenGL based type.
void ResetTextAttributes()
Reset text attributes to default styling.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
void SetTextMirrored(const bool aMirrored)
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void DrawArcSegment(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle, double aWidth, double aMaxError)
Draw an arc segment.
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 DrawGlyphs(const std::vector< std::unique_ptr< KIFONT::GLYPH > > &aGlyphs)
Draw polygons representing font glyphs.
virtual void Scale(const VECTOR2D &aScale)
Scale the context.
virtual void DrawCurve(const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint, double aFilterValue=0.0)
Draw a cubic bezier spline.
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
Draw an arc.
void SetFontItalic(bool aItalic)
virtual void DrawBitmap(const BITMAP_BASE &aBitmap, double alphaBlend=1.0)
Draw a bitmap image.
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
virtual void BitmapText(const wxString &aText, const VECTOR2I &aPosition, const EDA_ANGLE &aAngle)
Draw a text using a bitmap font.
const VECTOR2I & GetScreenPixelSize() const
Return GAL canvas size in pixels.
virtual void Save()
Save the context.
virtual void DrawSegmentChain(const std::vector< VECTOR2D > &aPointList, double aWidth)
Draw a chain of rounded segments.
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.
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)
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)
const wxString & GetDefaultFont() const
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
PCB_LAYER_ID GetActiveLayer() const
std::map< int, COLOR4D > m_layerColorsHi
virtual void update()
Precalculates extra colors for layers (e.g.
LSET GetPrintLayers() const
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.
bool GetDrawBoundingBoxes() const
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.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static LSET PhysicalLayersMask()
Return a mask holding all layers which are physically realized.
LSEQ Seq(const LSEQ &aSequence) const
Return an LSEQ from the union of this LSET and a desired sequence.
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...
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
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 ...
int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const override
Return the pad's "own" clearance in internal units.
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
bool IsNoConnectPad() 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
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,...
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.
const VECTOR2I & GetSize(PCB_LAYER_ID aLayer) const
DISPLAY_OPTIONS m_Display
EDA_ANGLE GetArcAngleStart() const
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.
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.
std::vector< PCB_SHAPE > GetShapes1() const
GAL_LAYER_ID GetColorLayer() const
VECTOR2I GetPosition() const override
std::vector< PCB_SHAPE > GetShapes2() const
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
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
bool StrokeColumns() const
bool StrokeExternal() const
bool StrokeHeader() const
PCB_TABLECELL * GetCell(int aRow, int aCol) const
std::vector< PCB_TABLECELL * > GetCells() const
const STROKE_PARAMS & GetSeparatorsStroke() const
const STROKE_PARAMS & GetBorderStroke() const
VECTOR2I GetPosition() const override
VECTOR2I GetPosition() const override
bool IsBorderEnabled() const
Disables the border, this is done by changing the stroke internally.
VECTOR2I GetDrawPos() const override
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
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.
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...
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
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
int GetWidth() const override
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
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
VECTOR2I::extended_type ecoord
int Length() const
Return the length (this).
ecoord SquaredLength() const
T * GetAppSettings(const wxString &aFilename)
Returns a handle to the a given settings by type If the settings have already been loaded,...
const SHAPE_LINE_CHAIN ConvertToPolyline(double aAccuracy=DefaultAccuracyForPCB(), double *aEffectiveAccuracy=nullptr) const
Construct a SHAPE_LINE_CHAIN of segments from a given arc.
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.
void Fracture(POLYGON_MODE aFastMode)
Convert a set of polygons with holes to a single outline with "slits"/"fractures" connecting the oute...
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.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
const VECTOR2I & GetPosition() const
const VECTOR2I GetSize() const
const SEG & GetSeg() const
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
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.
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.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_VERTICAL
static constexpr EDA_ANGLE ANGLE_HORIZONTAL
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)
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.
int GetNetnameLayer(int aLayer)
Returns a netname layer corresponding to the given layer.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
@ LAYER_LOCKED_ITEM_SHADOW
shadow layer for locked items
@ LAYER_CONFLICTS_SHADOW
shadow layer for items flagged conficting
@ LAYER_DRC_SHAPE1
Custom shape for DRC marker.
@ LAYER_NON_PLATEDHOLES
handle color for not plated holes (holes, not pads)
@ LAYER_DRC_EXCLUSION
layer for drc markers which have been individually excluded
@ LAYER_PCB_BACKGROUND
PCB background color.
@ 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_DRC_SHAPE2
Custom shape for DRC marker.
@ 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_MARKER_SHADOWS
shadows for drc markers
@ LAYER_VIA_HOLES
to draw via holes (pad holes do not use this layer)
@ LAYER_VIA_MICROVIA
to draw micro vias
@ LAYER_VIA_THROUGH
to draw usual through hole vias
@ LAYER_DRC_ERROR
layer for drc markers with SEVERITY_ERROR
@ LAYER_VIA_BBLIND
to draw blind/buried vias
bool IsNetnameLayer(int aLayer)
Test whether a layer is a netname layer.
bool IsHoleLayer(int aLayer)
bool IsExternalCopperLayer(int aLayerId)
Tests 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)
The Cairo implementation of the graphics abstraction layer.
PAD_DRILL_SHAPE
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Class to handle a set of BOARD_ITEMs.
PCBNEW_SETTINGS * pcbconfig()
PGM_BASE & Pgm()
The global Program "get" accessor.
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
@ 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
constexpr int MilsToIU(int mils) const
constexpr int mmToIU(double mm) const
bool m_DisplayPcbTrackFill
TRACK_CLEARANCE_MODE m_TrackClearance
bool m_DisplayGraphicsFill
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_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_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
@ 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