37 using namespace KIGFX;
76 if(
const PNS::LINE* l = dyn_cast<const PNS::LINE*>( aItem ) )
78 if( !l->SegmentCount() )
81 else if(
const PNS::VIA* v = dyn_cast<const PNS::VIA*>( aItem ) )
94 switch( aItem->
Kind() )
98 m_width = static_cast<const PNS::LINE*>( aItem )->Width();
103 m_width = static_cast<const PNS::ARC*>( aItem )->Width();
108 m_width = static_cast<const PNS::SEGMENT*>( aItem )->Width();
183 const SHAPE_LINE_CHAIN* lineChain = dynamic_cast<const SHAPE_LINE_CHAIN*>( aL );
185 for(
size_t s = 0; lineChain && s < lineChain->
ArcCount(); s++ )
202 bool holeDrawn =
false;
204 switch( aShape->
Type() )
265 const SHAPE_CIRCLE* c = static_cast<const SHAPE_CIRCLE*>( aShape );
306 VECTOR2I p0(
r->GetPosition() ), s(
r->GetSize() );
327 std::deque<VECTOR2D> polygon = std::deque<VECTOR2D>();
331 polygon.push_back( c->
CDPoint( i ) );
342 polygon.push_back( c->
CDPoint( 0 ) );
356 const SHAPE_ARC* arc = static_cast<const SHAPE_ARC*>( aShape );
380 wxFAIL_MSG( wxT(
"Router preview item: nested compound shapes not supported" ) );
384 wxFAIL_MSG( wxT(
"Router preview item: SHAPE_POLY_SET not supported" ) );
391 if(
m_hole && !holeDrawn )
433 std::vector<SHAPE*> subshapes;
436 for(
SHAPE* shape : subshapes )
477 return settings->GetLayerColor( aLayer );
compound shape, consisting of multiple simple shapes
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
Base class for PNS router board items.
virtual void DrawPolyline(const std::deque< VECTOR2D > &aPointList)
Draw a polyline.
void drawShape(const SHAPE *aShape, KIGFX::GAL *aGal) const
static const int ClearanceOverlayDepth
virtual const SHAPE * Hole() const
currently selected items overlay
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
void drawLineChain(const SHAPE_LINE_CHAIN_BASE *aL, KIGFX::GAL *aGal) const
The Cairo implementation of the graphics abstraction layer.
static const int BaseOverlayDepth
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, double aStartAngle, double aEndAngle)
Draw an arc.
virtual bool IsClosed() const =0
the 3d code uses this value
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
double GetStartAngle() const
const VECTOR2I GetCenter() const
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
virtual size_t GetSegmentCount() const =0
const std::vector< SHAPE_ARC > & CArcs() const
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
virtual const BOX2I BBox(int aClearance=0) const =0
Compute a bounding box of the shape, with a margin of aClearance a collision.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
const KIGFX::COLOR4D getLayerColor(int aLayer) const
const SEG & GetSeg() const
virtual void SetLineWidth(float aLineWidth)
Set the line width.
void SetWidth(int aWidth)
Set the width of all segments in the chain.
const VECTOR2D CDPoint(int aIndex) const
Return a given point as a vector with elements of type double.
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
Meta control for all vias opacity/visibility.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual const SHAPE * Shape() const
Return the geometrical shape of the item.
void Update(const PNS::ITEM *aItem)
void Line(const SHAPE_LINE_CHAIN &aLine, int aWidth=0, int aStyle=-1)
const KIGFX::COLOR4D assignColor(int aStyle) const
virtual SHAPE * Clone() const
Return a dynamically allocated copy of the shape.
An abstract shape on 2D plane.
BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
virtual void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
void Point(const VECTOR2I &aPos, int aStyle=0)
virtual const SEG GetSegment(int aIndex) const =0
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
set of polygons (with holes, etc.)
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
a single triangle belonging to a POLY_SET triangulation
virtual void GetIndexableSubshapes(std::vector< SHAPE * > &aSubshapes)
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
double DEG2RAD(double deg)
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
int PointCount() const
Return the number of points (vertices) in this polygon.
double GetCentralAngle() const
empty shape (no shape...),
A base class for most all the KiCad significant classes used in schematics and boards.
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
PnsKind Kind() const
Return the type (kind) of the item.
SHAPE * Clone() const override
Return a dynamically allocated copy of the shape.
virtual bool HasIndexableSubshapes() const
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
static const int ViaOverlayDepth
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
SHAPE_TYPE Type() const
Return the type of the shape.
void Box(const BOX2I &aBox, int aStyle=0)
VECTOR2I GetCenter() const
const LAYER_RANGE & Layers() const
virtual int Marker() const
ROUTER_PREVIEW_ITEM(const PNS::ITEM *aItem=nullptr, KIGFX::VIEW *aView=nullptr)
Abstract interface for drawing on a 2D-surface.
A color representation with 4 components: red, green, blue, alpha.