48 void emitPolyline(
const SHAPE_LINE_CHAIN& aChain,
int aWidth,
const KIGFX::COLOR4D& aColor,
const LSET& aLayers,
51 for(
int i = 0; i + 1 < aChain.
PointCount(); ++i )
55 seg.end = aChain.
CPoint( i + 1 );
59 aOut.segments.push_back( seg );
64 void addShapeAsGeometry(
const PCB_SHAPE& aShape,
const KIGFX::COLOR4D& aColor,
DOCUMENT_GEOMETRY& aOut )
68 const LSET layers( { aShape.
GetLayer() } );
80 aOut.segments.push_back( seg );
89 poly.
outline = { a, { b.
x, a.
y }, b, { a.
x, b.
y } };
91 poly.lineWidth = width;
94 aOut.polygons.push_back( poly );
107 aOut.circles.push_back( c );
115 for(
int outline = 0; outline < set.
OutlineCount(); ++outline )
121 poly.lineWidth = width;
123 poly.layers = layers;
129 aOut.polygons.push_back( std::move( poly ) );
134 for(
int hole = 0; hole < set.
HoleCount( outline ); ++hole )
136 const SHAPE_LINE_CHAIN& holeChain = set.
CHole( outline, hole );
140 holePoly.lineWidth = width;
141 holePoly.color = aColor;
142 holePoly.layers = layers;
143 holePoly.outline.reserve( holeChain.
PointCount() );
145 for(
int i = 0; i < holeChain.
PointCount(); ++i )
146 holePoly.outline.push_back( holeChain.
CPoint( i ) );
148 aOut.polygons.push_back( std::move( holePoly ) );
158 emitPolyline( arc.ConvertToPolyline(), width, aColor, layers, aOut );
166 if( pts.size() >= 2 )
168 SHAPE_LINE_CHAIN
chain;
173 emitPolyline(
chain, width, aColor, layers, aOut );
181 seg.end = aShape.
GetEnd();
185 aOut.segments.push_back( seg );
196 void addTrackAsGeometry(
const PCB_TRACK& aTrack,
const KIGFX::COLOR4D& aColor,
DOCUMENT_GEOMETRY& aOut )
200 const PCB_VIA&
via =
static_cast<const PCB_VIA&
>( aTrack );
208 c.layers =
via.GetLayerSet();
209 aOut.circles.push_back( c );
215 seg.end = aTrack.
GetEnd();
219 aOut.segments.push_back( seg );
223 void addBBoxAsGeometry(
const BOARD_ITEM& aItem,
const KIGFX::COLOR4D& aColor,
DOCUMENT_GEOMETRY& aOut )
227 if( poly.outline.empty() )
231 aOut.polygons.push_back( std::move( poly ) );
254 const bool isOutline = ( layer ==
Edge_Cuts );
258 if( !isOutline && !isDoc )
261 addShapeAsGeometry( *shape, aColor, out );
269 addTrackAsGeometry( *track, aColor, out );
278 addBBoxAsGeometry( *
pad, aColor, out );
284 addBBoxAsGeometry( *zone, aColor, out );
299 out.
polygons.push_back( std::move( poly ) );
313 addBBoxAsGeometry( *
pad, aColor, out );
322 addShapeAsGeometry( *shape, aColor, out );
324 addBBoxAsGeometry( *item, aColor, out );
327 for(
const ZONE* zone : aFootprint.
Zones() )
330 addBBoxAsGeometry( *zone, aColor, out );
338 out.
polygons.push_back( std::move( poly ) );
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Information pertinent to a Pcbnew printed circuit board.
const ZONES & Zones() const
const std::vector< PAD * > GetPads() const
Return a reference to a list of all the pads.
const FOOTPRINTS & Footprints() const
const TRACKS & Tracks() const
const DRAWINGS & Drawings() 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.
SHAPE_POLY_SET & GetPolyShape()
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
const std::vector< VECTOR2I > & GetBezierPoints() const
VECTOR2I GetArcMid() const
A color representation with 4 components: red, green, blue, alpha.
LSET is a set of PCB_LAYER_IDs.
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
int GetWidth() const override
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
const VECTOR2I & GetStart() const
const VECTOR2I & GetEnd() const
virtual int GetWidth() const
int PointCount() const
Return the number of points (vertices) in this line chain.
void Append(int aX, int aY, bool aAllowDuplication=false)
Append a new point at the end of the line chain.
const VECTOR2I & CPoint(int aIndex) const
Return a reference to a given point in the line chain.
int HoleCount(int aOutline) const
Returns the number of holes in a given outline.
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
Handle a list of polygons defining a copper zone.
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
PCB_LAYER_ID
A quick note on layer IDs:
DOCUMENT_POLYGON MakeBBoxOutline(const BOX2I &aBBox, const KIGFX::COLOR4D &aColor, int aLineWidth)
Build a DOCUMENT_POLYGON outlining a bounding box.
DOCUMENT_GEOMETRY ExtractFootprintGeometry(const FOOTPRINT &aFootprint, const KIGFX::COLOR4D &aColor)
Extract drawable context geometry from a single FOOTPRINT.
DOCUMENT_GEOMETRY ExtractBoardGeometry(const BOARD &aBoard, const KIGFX::COLOR4D &aColor)
Extract a coarse outline of a BOARD into a DOCUMENT_GEOMETRY for use as background context in DIFF_SC...
Filled or stroked circle.
Aggregate of background geometry extracted from one source document.
std::vector< DOCUMENT_POLYGON > polygons
Closed polygon outline from a source document.
std::vector< VECTOR2I > outline
Stroked line segment from one of the source documents.
const SHAPE_LINE_CHAIN chain
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
VECTOR2< int32_t > VECTOR2I