155 const COLOR4D lightLabel( 1.0, 1.0, 1.0, 0.7 );
194 int originalLayer = aLayer;
204 const PAD*
pad =
dynamic_cast<const PAD*
>( item );
206 int holeLayer = aLayer;
267 netColor = ii->second;
274 netColor = jj->second;
310 switch( originalLayer )
314 const PAD*
pad =
static_cast<const PAD*
>( item );
316 if( !
pad->FlashLayer( primary ) )
336 if(
via->GetLayerSet().test( primary ) == 0 )
349 if( !
via->FlashLayer( primary ) )
378 if(
via->GetLayerSet().test( primary ) == 0 )
417 const BOARD* board =
via->GetBoard();
421 if( (
via->GetLayerSet() & visibleLayers ).none() )
450 m_frameType( aFrameType ),
452 m_holePlatingThickness( 0 ),
453 m_lockedShadowMargin( 0 )
463 if( aActualThickness == 0 )
466 return aActualThickness;
534 switch( item->
Type() )
541 draw(
static_cast<const PCB_ARC*
>( item ), aLayer );
545 draw(
static_cast<const PCB_VIA*
>( item ), aLayer );
549 draw(
static_cast<const PAD*
>( item ), aLayer );
570 draw(
static_cast<const FP_TEXT*
>( item ), aLayer );
587 draw(
static_cast<const ZONE*
>( item ), aLayer );
663 int track_width = aTrack->
GetWidth();
684 SEG visibleSeg( start, end );
686 ClipLine( &clipBox, visibleSeg.
A.
x, visibleSeg.
A.
y, visibleSeg.
B.
x, visibleSeg.
B.
y );
689 size_t num_char = netName.size();
692 int seg_minlength = track_width * num_char;
694 if( visibleSeg.
Length() < seg_minlength )
697 double textSize = track_width;
698 double penWidth = textSize / 12.0;
702 if( end.
y == start.
y )
705 num_names = std::max( num_names,
708 else if( end.
x == start.
x )
711 num_names = std::max( num_names,
716 textOrientation = -
EDA_ANGLE( visibleSeg.
B - visibleSeg.
A );
720 num_names = std::max( num_names,
721 static_cast<int>( aTrack->
GetLength() / ( M_SQRT2 * min_size ) ) );
736 for(
int ii = 0; ii < num_names; ++ii )
739 VECTOR2D( start ) *
static_cast<double>( num_names - ii ) / ( num_names + 1 )
740 +
VECTOR2D( end ) *
static_cast<double>( ii + 1 ) / ( num_names + 1 );
742 if( clipBox.
Contains( textPosition ) )
854 for(
int idx = 1; idx < arcSpine.
PointCount(); idx++ )
879 if( !showNets && !showLayers )
911 int topLayer = aVia->
TopLayer() + 1;
915 layerIds.Printf( wxT(
"%d-%d" ), topLayer, bottomLayer );
920 int minCharCnt = showLayers ? 6 : 3;
924 tsize = std::min( tsize, size );
932 textpos.
y += tsize/5;
943 textpos.
y -= tsize * 1.3;
984 double radius = aVia->
GetWidth() / 2.0;
1005 radius -= annular_width / 2.0;
1014 double radius = aVia->
GetWidth() / 2.0;
1019 aVia->
LayerPair( &layerTop, &layerBottom );
1043 radius -= annular_width / 2.0;
1102 netname = wxT(
"x" );
1104 netname = wxT(
"*" );
1107 if( netname.IsEmpty() && padNumber.IsEmpty() )
1142 for(
const std::shared_ptr<PCB_SHAPE>& primitive : aPad->
GetPrimitives() )
1144 if( primitive->IsAnnotationProxy() )
1146 position = aPad->
GetPosition() + primitive->GetCenter();
1147 padsize.
x =
abs( primitive->GetBotRight().x - primitive->GetTopLeft().x );
1148 padsize.
y =
abs( primitive->GetBotRight().y - primitive->GetTopLeft().y );
1164 if( padsize.
x > limit && padsize.
y > limit )
1172 double size = padsize.
y;
1178 if( padsize.
x < ( padsize.
y * 0.95 ) )
1182 std::swap( padsize.
x, padsize.
y );
1186 if( size > maxSize )
1207 int Y_offset_numpad = 0;
1208 int Y_offset_netname = 0;
1210 if( !netname.IsEmpty() && !padNumber.IsEmpty() )
1214 Y_offset_netname = size / 1.4;
1216 Y_offset_numpad = size / 1.7;
1222 const double Xscale_for_stroked_font = 0.9;
1224 if( !netname.IsEmpty() )
1230 tsize = std::min( tsize, size );
1240 VECTOR2D namesize( tsize*Xscale_for_stroked_font, tsize );
1241 textpos.
y = std::min( tsize * 1.4,
double( Y_offset_netname ) );
1249 if( !padNumber.IsEmpty() )
1254 tsize = std::min( tsize, size );
1258 tsize = std::min( tsize, size );
1259 VECTOR2D numsize( tsize*Xscale_for_stroked_font, tsize );
1260 textpos.
y = -Y_offset_numpad;
1282 if( slot->GetSeg().A == slot->GetSeg().B )
1293 outline_mode =
true;
1311 bool drawShape =
false;
1333 outline_mode =
true;
1363 margin.
x = margin.
y = 0;
1367 std::unique_ptr<PAD> dummyPad;
1368 std::shared_ptr<SHAPE_COMPOUND> shapes;
1371 bool simpleShapes = !outline_mode;
1384 if( pad_size.
x + 2 * margin.
x <= 0 || pad_size.
y + 2 * margin.
y <= 0 )
1387 dummyPad.reset(
static_cast<PAD*
>( aPad->
Duplicate() ) );
1389 if( dummyPad->GetParentGroup() )
1390 dummyPad->GetParentGroup()->RemoveItem( dummyPad.get() );
1392 int initial_radius = dummyPad->GetRoundRectCornerRadius();
1394 dummyPad->SetSize( pad_size + margin + margin );
1400 int radius_margin = std::max( margin.
x, margin.
y );
1401 dummyPad->SetRoundRectCornerRadius( std::max( initial_radius + radius_margin, 0 ) );
1404 shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( dummyPad->GetEffectiveShape() );
1405 margin.
x = margin.
y = 0;
1409 shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->
GetEffectiveShape() );
1416 simpleShapes =
false;
1419 for(
const SHAPE* shape : shapes->Shapes() )
1424 switch( shape->Type() )
1435 simpleShapes =
false;
1443 for(
const SHAPE* shape : shapes->Shapes() )
1445 switch( shape->Type() )
1450 int effectiveWidth = seg->
GetWidth() + 2 * margin.
x;
1452 if( effectiveWidth > 0 )
1461 int effectiveRadius = circle->
GetRadius() + margin.
x;
1463 if( effectiveRadius > 0 )
1475 if( effectiveMargin.
x < 0 )
1480 if( effectiveSize.
x > 0 && effectiveSize.
y > 0 )
1483 else if( effectiveMargin.
x > 0 )
1491 effectiveMargin.
x * 2 );
1494 effectiveMargin.
x * 2 );
1497 effectiveMargin.
x * 2 );
1500 effectiveMargin.
x * 2 );
1523 for(
int ii = 0; ii < poly->
PointCount(); ++ii )
1526 outline.
Deflate( -margin.
x, numSegs );
1577 bool flashActiveLayer =
true;
1580 flashActiveLayer = aPad->
FlashLayer( activeLayer );
1583 flashActiveLayer =
false;
1597 if( flashActiveLayer && clearance > 0 )
1599 auto shape = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->
GetEffectiveShape() );
1601 if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() ==
SH_SEGMENT )
1607 else if( shape && shape->Size() == 1 && shape->Shapes()[0]->Type() ==
SH_CIRCLE )
1630 slot->GetWidth() + 2 * clearance );
1692 else if( outline_mode )
1773 if( parentFootprint )
1809 if( parentFootprint )
1818 std::vector<VECTOR2D> output;
1819 std::vector<VECTOR2D> pointCtrl;
1821 pointCtrl.push_back( aShape->
GetStart() );
1824 pointCtrl.push_back( aShape->
GetEnd() );
1827 converter.
GetPoly( output, thickness );
1861 for(
SHAPE* shape : shapes )
1870 for(
SHAPE* shape : shapes )
1887 font->
Draw(
m_gal, aText, aPosition, aAttrs );
1900 if( img_scale != 1.0 )
1916 bm_size.
x /= img_scale;
1917 bm_size.
y /= img_scale;
1918 VECTOR2D origin( -bm_size.
x / 2.0, -bm_size.
y / 2.0 );
1942 if( resolvedText.Length() == 0 )
1990 callback_gal.SetIsFill( font->
IsOutline() );
1991 callback_gal.SetIsStroke( font->
IsStroke() );
1993 font->
Draw( &callback_gal, resolvedText, aText->
GetDrawPos(), attrs );
2020 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2059 std::vector<VECTOR2I> pts = aTextBox->
GetCorners();
2062 for(
size_t ii = 0; ii < pts.size(); ++ii )
2063 m_gal->
DrawSegment( pts[ ii ], pts[ (ii + 1) % pts.size() ], line_thickness );
2075 std::vector<VECTOR2I> pts = aTextBox->
GetCorners();
2077 for(
size_t ii = 0; ii < pts.size(); ++ii )
2085 for(
SHAPE* shape : shapes )
2094 for(
SHAPE* shape : shapes )
2098 if( resolvedText.Length() == 0 )
2118 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2134 if( resolvedText.Length() == 0 )
2167 callback_gal.SetIsFill( font->
IsOutline() );
2168 callback_gal.SetIsStroke( font->
IsStroke() );
2170 font->
Draw( &callback_gal, resolvedText, aText->
GetDrawPos(), attrs );
2197 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2233 std::vector<VECTOR2I> pts = aTextBox->
GetCorners();
2235 for(
size_t ii = 0; ii < pts.size(); ++ii )
2242 for(
SHAPE* shape : shapes )
2251 for(
SHAPE* shape : shapes )
2258 if( resolvedText.Length() == 0 )
2271 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2381 m_gal->
DrawLine( topLeft + width, topLeft + width + height );
2382 m_gal->
DrawLine( topLeft + width + height, topLeft + height );
2387 if(
name.IsEmpty() )
2395 int textSize = ( scaledSize + ( unscaledSize * 2 ) ) / 3;
2402 m_gal->
DrawLine( topLeft - titleHeight, topLeft + width - titleHeight );
2403 m_gal->
DrawLine( topLeft + width - titleHeight, topLeft + width );
2449 std::deque<VECTOR2D> corners;
2478 int holes_count = outline->
HoleCount( ii );
2480 for(
int jj = 0; jj < holes_count; ++jj )
2498 if( polySet->OutlineCount() == 0 )
2539 for(
const std::shared_ptr<SHAPE>& shape : aDimension->
GetShapes() )
2541 switch( shape->Type() )
2545 const SEG& seg =
static_cast<const SHAPE_SEGMENT*
>( shape.get() )->GetSeg();
2552 int radius =
static_cast<const SHAPE_CIRCLE*
>( shape.get() )->GetRadius();
2574 std::vector<std::unique_ptr<KIFONT::GLYPH>>* cache =
nullptr;
2581 for(
const std::unique_ptr<KIFONT::GLYPH>& glyph : *cache )
2595 double size, radius;
2609 size = 2.0 * aTarget->
GetSize() / 3.0;
2610 radius = aTarget->
GetSize() / 2.0;
2615 size = aTarget->
GetSize() / 2.0;
2616 radius = aTarget->
GetSize() / 3.0;
2633 if( isShadow && aMarker->
GetBoard()
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.
Bezier curves to polygon converter.
void GetPoly(std::vector< VECTOR2I > &aOutput, int aMinSegLen=0, int aMaxSegCount=32)
Convert a Bezier curve to a polygon.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
wxString GetNetname() const
wxString GetNetClassName() const
Returns the name of the effective netclass.
virtual int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const
Return an item's "own" clearance in internal units.
wxString GetUnescapedShortNetname() const
Container for design settings for a BOARD object.
int GetHolePlatingThickness() const
Pad & via drills are finish size.
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 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.
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
BOARD_ITEM_CONTAINER * GetParentFootprint() const
BOARD_ITEM_CONTAINER * GetParent() 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
void SetOrigin(const Vec &pos)
BOX2< Vec > & Normalize()
Ensure that the height and width are positive.
const Vec & GetPosition() const
const Vec & GetOrigin() const
coord_type GetHeight() const
coord_type GetWidth() const
bool Contains(const Vec &aPoint) const
const Vec & GetSize() const
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
A base class for most all the KiCad significant classes used in schematics and boards.
virtual VECTOR2I GetPosition() 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
EDA_ITEM_FLAGS GetFlags() 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 VECTOR2I & GetBezierC1() const
bool IsAnnotationProxy() const
void TransformBoundingBoxToPolygon(SHAPE_POLY_SET *aBuffer, int aClearance) const
Convert the text bounding box to a rectangular polygon depending on the text orientation,...
const VECTOR2I & GetTextPos() const
KIFONT::FONT * GetFont() const
std::vector< std::unique_ptr< KIFONT::GLYPH > > * GetRenderCache(const KIFONT::FONT *aFont, const wxString &forResolvedText, const VECTOR2I &aOffset={ 0, 0 }) const
virtual VECTOR2I GetDrawPos() const
const TEXT_ATTRIBUTES & GetAttributes() const
int GetEffectiveTextPenWidth(int aDefaultPenWidth=0) const
The EffectiveTextPenWidth uses the text thickness if > 1 or aDefaultPenWidth.
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
VECTOR2I GetDrawPos() const override
virtual EDA_ANGLE GetDrawRotation() const override
std::vector< VECTOR2I > GetCorners() const override
Return 4 corners for a rectangle or rotated rectangle (stored as a poly).
virtual EDA_ANGLE GetDrawRotation() const override
virtual wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
APP_SETTINGS_BASE * KifaceSettings() const
FONT is an abstract base class for both outline and stroke fonts.
static FONT * GetFont(const wxString &aFontName=wxEmptyString, bool aBold=false, bool aItalic=false)
void Draw(KIGFX::GAL *aGal, const wxString &aText, const VECTOR2I &aPosition, const VECTOR2I &aCursor, const TEXT_ATTRIBUTES &aAttrs) const
Draw a string.
virtual bool IsStroke() const
virtual bool IsOutline() const
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 UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
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 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.
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.
virtual void DrawArcSegment(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, double aWidth, double aMaxError)
Draw an arc segment.
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle)
Draw an arc.
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.
PCB_VIEWERS_SETTINGS_BASE * viewer_settings()
void draw(const PCB_TRACK *aTrack, int aLayer)
void strokeText(const wxString &aText, const VECTOR2I &aPosition, const TEXT_ATTRIBUTES &aAttrs)
int m_holePlatingThickness
virtual int getDrillShape(const PAD *aPad) const
Return drill shape of a pad.
PCB_RENDER_SETTINGS m_pcbSettings
virtual int getViaDrillSize(const PCB_VIA *aVia) const
Return drill diameter for a via (internal units).
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)
std::map< wxString, KIGFX::COLOR4D > m_netclassColors
Overrides for specific net colors, stored as netcodes for the ratsnest to access easily.
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
COLOR4D m_layerColorsDark[LAYER_ID_COUNT]
COLOR4D m_layerColorsSel[LAYER_ID_COUNT]
COLOR4D m_layerColorsHi[LAYER_ID_COUNT]
virtual void update()
Precalculates extra colors for layers (e.g.
LSET GetPrintLayers() const
void SetDashLengthRatio(double aRatio)
COLOR4D m_layerColors[LAYER_ID_COUNT]
std::set< int > m_highlightNetcodes
std::set< int > m_highContrastLayers
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.
LSEQ is a sequence (and therefore also a set) of PCB_LAYER_IDs.
LSET is a set of PCB_LAYER_IDs.
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
static LSET SideSpecificMask()
static 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...
VECTOR2< T > GetScale() const
Get the scale components of the matrix.
static const int UNCONNECTED
Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED (typically -1) whe...
int GetOwnClearance(PCB_LAYER_ID aLayer, wxString *aSource=nullptr) const override
Return an item's "own" clearance in internal units.
PAD_DRILL_SHAPE_T GetDrillShape() const
bool FlashLayer(int aLayer, bool aOnlyCheckIfPermitted=false) const
Check to see whether the pad should be flashed on the specific layer.
const BOX2I GetBoundingBox() const override
The bounding box is cached, so this will be efficient most of the time.
int GetSolderMaskExpansion() const
const VECTOR2I & GetDrillSize() const
PAD_ATTRIB GetAttribute() const
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aMaxError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the pad shape to a closed polygon.
const wxString & GetNumber() const
VECTOR2I GetPosition() const override
const std::vector< std::shared_ptr< PCB_SHAPE > > & GetPrimitives() const
Accessor to the basic shape list for custom-shaped pads.
bool IsNoConnectPad() const
PAD_SHAPE GetShape() const
VECTOR2I GetSolderPasteMargin() const
Usually < 0 (mask shape smaller than pad)because the margin can be dependent on the pad size,...
virtual std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING flashPTHPads=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Return a SHAPE_SEGMENT object representing the pad's hole.
const VECTOR2I & GetSize() 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.
Object to handle a bitmap image that can be inserted in a PCB.
VECTOR2I GetPosition() const override
double GetImageScale() const
const VECTOR2I GetSize() const
const BITMAP_BASE * GetImage() const
int GetLineThickness() const
const std::vector< std::shared_ptr< SHAPE > > & GetShapes() const
double m_TrackOpacity
Opacity override for all tracks.
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.
GAL_LAYER_ID GetColorLayer() const
VECTOR2I GetPosition() const override
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
FOOTPRINT * GetParentFootprint() const
Return the parent footprint or NULL if PCB_SHAPE does not belong to a footprint.
virtual std::vector< VECTOR2I > GetCorners() const
Return 4 corners for a rectangle or rotated rectangle (stored as a poly).
STROKE_PARAMS GetStroke() const override
VECTOR2I GetPosition() const override
VECTOR2I GetDrawPos() const override
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool aIgnoreLineWidth=false) const override
Convert the item shape to a closed polygon.
wxString GetShownText(int aDepth=0, bool aAllowExtraText=true) const override
Return the string actually shown after processing of the base text.
virtual double GetLength() const
Function GetLength returns the length of the track using the hypotenuse calculation.
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
PCB_LAYER_ID BottomLayer() const
bool FlashLayer(int aLayer) const
Checks to see whether the via should have a pad on the specific layer.
PCB_LAYER_ID TopLayer() const
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
VIATYPE GetViaType() const
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Function LayerPair Return the 2 layers used by the via (the via actually uses all layers between thes...
VIEWERS_DISPLAY_OPTIONS m_ViewersDisplay
int Length() const
Return the length (this).
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 BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Perform boolean polyset intersection For aFastMode meaning, see function booleanOp.
void Fracture(POLYGON_MODE aFastMode)
Convert a single outline slitted ("fractured") polygon into a set ouf outlines with holes.
bool IsTriangulationUpToDate() const
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new hole to the given outline (default: last) and returns its index.
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 Deflate(int aAmount, int aCircleSegmentsCount, CORNER_STRATEGY aCornerStrategy=CHAMFER_ALL_CORNERS)
int HoleCount(int aOutline) const
Return the reference to aIndex-th outline in the set.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Add a new vertex to the contour indexed by aOutline and aHole (defaults to the outline of the last po...
SHAPE_LINE_CHAIN & Outline(int aIndex)
int NewOutline()
Creates a new hole in a given outline.
const SHAPE_LINE_CHAIN & CHole(int aOutline, int aHole) const
int OutlineCount() const
Return the number of vertices in a given outline/hole.
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
const int GetHeight() const
const int GetWidth() 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.
static void Stroke(const SHAPE *aShape, PLOT_DASH_TYPE aLineStyle, int aWidth, const KIGFX::RENDER_SETTINGS *aRenderSettings, std::function< void(const VECTOR2I &a, const VECTOR2I &b)> aStroker)
PLOT_DASH_TYPE GetPlotStyle() const
GR_TEXT_H_ALIGN_T m_Halign
GR_TEXT_V_ALIGN_T m_Valign
Handle a list of polygons defining a copper zone.
const std::vector< SEG > & GetHatchLines() const
virtual bool IsOnLayer(PCB_LAYER_ID, bool aIncludeCourtyards=false) const override
Test to see if this object is on the given layer.
const std::shared_ptr< SHAPE_POLY_SET > & GetFilledPolysList(PCB_LAYER_ID aLayer) const
SHAPE_POLY_SET * Outline()
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.
PGM_BASE * PgmOrNull()
similar to PGM_BASE& Pgm(), but return a reference that can be nullptr when running a shared lib from...
static constexpr EDA_ANGLE & ANGLE_HORIZONTAL
static constexpr EDA_ANGLE & ANGLE_VERTICAL
static constexpr EDA_ANGLE & FULL_CIRCLE
static constexpr EDA_ANGLE & ANGLE_90
#define ENTERED
indicates a group has been entered
@ LAST
marker for list end
FRAME_T
The set of EDA_BASE_FRAME derivatives, typically stored in EDA_BASE_FRAME::m_Ident.
@ FRAME_FOOTPRINT_VIEWER_MODAL
@ FRAME_FOOTPRINT_PREVIEW
a few functions useful in geometry calculations.
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
bool ClipLine(const BOX2I *aClipBox, int &x1, int &y1, int &x2, int &y2)
Test if any part of a line falls within the bounds of a rectangle.
int GetArcToSegmentCount(int aRadius, int aErrorMax, const EDA_ANGLE &aArcAngle)
int GetPenSizeForNormal(int aTextSize)
int GetKnockoutTextMargin(const VECTOR2I &aSize, int aThickness)
Returns the margin for knocking out text.
@ LAYER_PAD_FR_NETNAMES
Additional netnames layers (not associated with a PCB layer)
bool IsPcbLayer(int aLayer)
Test whether a layer is a valid layer for Pcbnew.
bool IsNetCopperLayer(int aLayer)
Checks if the given layer is "net copper", meaning it is eligible for net coloring.
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_NON_PLATEDHOLES
handle color for not plated holes (holes, not pads)
@ LAYER_PAD_FR
smd pads, front layer
@ LAYER_PCB_BACKGROUND
PCB background color.
@ LAYER_PAD_PLATEDHOLES
to draw pad holes (plated)
@ 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_PAD_BK
smd pads, back layer
@ LAYER_PADS_TH
multilayer pads, usually with holes
@ 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_VIA_BBLIND
to draw blind/buried vias
bool IsNetnameLayer(int aLayer)
Test whether a layer is a netname layer.
bool IsHoleLayer(int aLayer)
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.
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
@ NPTH
like PAD_PTH, but not plated
@ PTH
Plated through hole pad.
PCBNEW_SETTINGS * pcbconfig()
@ SH_RECT
axis-aligned rectangle
@ SH_SIMPLE
simple polygon
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
wxString UnescapeString(const wxString &aSource)
int PrintableCharCount(const wxString &aString)
Return the number of printable (ie: non-formatting) chars.
PLOT_DASH_TYPE
Dashed line types.
constexpr int MilsToIU(int mils) const
constexpr int mmToIU(double mm) const
bool m_DisplayPcbTrackFill
TRACK_CLEARANCE_MODE m_TrackClearance
bool m_DisplayGraphicsFill
@ PCB_FP_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ 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_FP_SHAPE_T
class FP_SHAPE, a footprint edge
@ 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_FP_TEXTBOX_T
class FP_TEXTBOX, wrapped text in a footprint
@ 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_FP_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
@ PCB_FP_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_FP_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_FP_ZONE_T
class ZONE, managed by a footprint
@ PCB_BITMAP_T
class PCB_BITMAP, bitmap on a layer
@ PCB_FP_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_FP_TEXT_T
class FP_TEXT, text in a footprint
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
@ 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
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
VECTOR2< double > VECTOR2D