KiCad PCB EDA Suite
Loading...
Searching...
No Matches
router_preview_item.cpp
Go to the documentation of this file.
1/*
2 * KiRouter - a push-and-(sometimes-)shove PCB router
3 *
4 * Copyright (C) 2013-2014 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#include "router_preview_item.h"
23
24#include <deque>
25
26#include <board_item.h>
28#include <gal/color4d.h>
30#include <geometry/shape_rect.h>
32#include <pcb_painter.h>
33#include <trigo.h>
34
35#include "pns_arc.h"
36#include "pns_line.h"
37#include "pns_segment.h"
38#include "pns_via.h"
39#include "pns_kicad_iface.h"
40
41#include <pcb_painter.h>
42#include <netinfo.h>
43#include <layer_ids.h>
44
45using namespace KIGFX;
46
47
49 KIGFX::VIEW* aView, int aFlags ) :
51 m_view( aView ),
52 m_iface( aIface ),
53 m_shape( nullptr ),
54 m_hole( nullptr ),
55 m_flags( aFlags )
56{
57 BOARD_ITEM* boardItem = aItem ? aItem->BoardItem() : nullptr;
58
59 // A PNS::SOLID for an edge-cut item must have 0 width for collision calculations, but when
60 // highlighting an edge we want to show it with its true width
61 if( boardItem && boardItem->IsOnLayer( Edge_Cuts ) )
62 {
63 m_shape = aItem->Shape( -1 )->Clone();
64
65 switch( m_shape->Type() )
66 {
67 case SH_SEGMENT: static_cast<SHAPE_SEGMENT*>( m_shape )->SetWidth( 0 ); break;
68 case SH_ARC: static_cast<SHAPE_ARC*>( m_shape )->SetWidth( 0 ); break;
69 case SH_LINE_CHAIN: static_cast<SHAPE_LINE_CHAIN*>( m_shape )->SetWidth( 0 ); break;
70 default: /* remaining shapes don't have width */ break;
71 }
72 }
73 else if( aItem )
74 {
75 // TODO(JE) padstacks -- need to know the layer here
76 m_shape = aItem->Shape( -1 )->Clone();
77
78 if( aItem->HasHole() )
79 m_hole = aItem->Hole()->Shape( -1 )->Clone();
80 }
81
82 m_clearance = -1;
83 m_originLayer = m_layer = LAYER_SELECT_OVERLAY ;
84
85 m_showClearance = false;
86
87 // initialize variables, overwritten by Update( aItem ), if aItem != NULL
88 m_type = PR_SHAPE;
89 m_width = ( aFlags & PNS_SEMI_SOLID ) ? 1 : 0;
90 m_depth = m_originDepth = aView->GetLayerOrder( m_originLayer );
91
92 if( aItem )
93 Update( aItem );
94}
95
96
98 KIGFX::VIEW* aView ) :
100 m_view( aView ),
101 m_iface( aIface ),
102 m_flags( 0 )
103{
104 m_shape = aShape.Clone();
105 m_hole = nullptr;
106
107 m_clearance = -1;
109
110 m_showClearance = false;
111
112 // initialize variables, overwritten by Update( aItem ), if aItem != NULL
114 m_width = 0;
116}
117
118
120{
121 delete m_shape;
122 delete m_hole;
123}
124
125
127{
128 m_originLayer = m_iface->GetBoardLayerFromPNSLayer( aItem->Layers().Start() );
129
130 if( const PNS::LINE* l = dyn_cast<const PNS::LINE*>( aItem ) )
131 {
132 if( !l->SegmentCount() )
133 return;
134 }
135 else if( const PNS::VIA* v = dyn_cast<const PNS::VIA*>( aItem ) )
136 {
137 if( v->IsVirtual() )
138 return;
139 }
140
141 if( m_originLayer < 0 )
142 m_originLayer = 0;
143
146 m_color.a = 0.8;
147 m_depth = m_originDepth - ( ( aItem->Layers().Start() + 1 ) * LayerDepthFactor );
148
149 switch( aItem->Kind() )
150 {
153 m_width = static_cast<const PNS::LINE*>( aItem )->Width();
154 break;
155
156 case PNS::ITEM::ARC_T:
158 m_width = static_cast<const PNS::ARC*>( aItem )->Width();
159 break;
160
163 m_width = static_cast<const PNS::SEGMENT*>( aItem )->Width();
164 break;
165
166 case PNS::ITEM::VIA_T:
167 {
170 m_width = 0;
171 m_color = COLOR4D( 0.7, 0.7, 0.7, 0.8 );
172 m_depth = m_originDepth - ( static_cast<double>( PCB_LAYER_ID_COUNT ) * LayerDepthFactor );
173
174 delete m_shape;
175 m_shape = nullptr;
176
177 auto via = static_cast<const PNS::VIA*>( aItem );
178 int shapeLayer = -1;
179 int largestDiameter = 0;
180
181 for( int layer : via->UniqueShapeLayers() )
182 {
183 if( via->Diameter( layer ) > largestDiameter )
184 {
185 largestDiameter = via->Diameter( layer );
186 shapeLayer = layer;
187 }
188 }
189
190 if( aItem->Shape( shapeLayer ) )
191 m_shape = aItem->Shape( shapeLayer )->Clone();
192
193 delete m_hole;
194 m_hole = nullptr;
195
196 if( aItem->HasHole() )
197 m_hole = aItem->Hole()->Shape( -1 )->Clone();
198
199 break;
200 }
201
204 break;
205
206 default:
207 break;
208 }
209
210 if( aItem->Marker() & PNS::MK_VIOLATION )
212
213 if( m_flags & PNS_COLLISION )
214 m_color = COLOR4D( 0, 1, 0, 1 );
215
216 if( m_flags & PNS_HOVER_ITEM )
217 m_color = m_color.WithAlpha( 1.0 );
218}
219
220
222{
223 BOX2I bbox;
224
225 switch( m_type )
226 {
227 case PR_SHAPE:
228 if( m_shape )
229 {
230 bbox = m_shape->BBox();
231 bbox.Inflate( m_width / 2 );
232 }
233
234 if( m_hole )
235 bbox.Merge( m_hole->BBox() );
236
237 return bbox;
238
239 case PR_POINT:
240 bbox = BOX2I ( m_pos - VECTOR2I( 100000, 100000 ), VECTOR2I( 200000, 200000 ) );
241 return bbox;
242
243 default:
244 break;
245 }
246
247 return bbox;
248}
249
250
252{
253 wxCHECK( aL, /* void */ );
254
255 gal->SetIsFill( false );
256
257 for( int s = 0; s < (int) aL->GetSegmentCount(); s++ )
258 {
259 SEG seg = aL->GetSegment( s );
260
261 if( seg.A == seg.B )
262 {
263 gal->SetIsFill( true );
264 gal->SetIsStroke( false );
265 gal->DrawCircle( seg.A, gal->GetLineWidth() / 2 );
266 gal->SetIsFill( false );
267 gal->SetIsStroke( true );
268 }
269 else
270 {
271 gal->DrawLine( seg.A, seg.B );
272 }
273 }
274
275 const SHAPE_LINE_CHAIN* lineChain = dynamic_cast<const SHAPE_LINE_CHAIN*>( aL );
276
277 for( size_t s = 0; lineChain && s < lineChain->ArcCount(); s++ )
278 {
279 const SHAPE_ARC& arc = lineChain->CArcs()[s];
280 EDA_ANGLE start_angle = arc.GetStartAngle();
281 EDA_ANGLE angle = arc.GetCentralAngle();
282
283 gal->DrawArc( arc.GetCenter(), arc.GetRadius(), start_angle, angle);
284 }
285
286 if( aL->IsClosed() )
287 gal->DrawLine( aL->GetSegment( -1 ).B, aL->GetSegment( 0 ).A );
288}
289
290
291void ROUTER_PREVIEW_ITEM::drawShape( const SHAPE* aShape, KIGFX::GAL* gal ) const
292{
293 bool holeDrawn = false;
294 bool showClearance = m_showClearance;
295
296 // Always show clearance when we're in collision, even if the preference is off
297 if( ( m_flags & PNS_COLLISION ) > 0 )
298 showClearance = true;
299
300 switch( aShape->Type() )
301 {
303 {
304 const SHAPE_LINE_CHAIN_BASE* l = (const SHAPE_LINE_CHAIN_BASE*) aShape;
305
306 if( showClearance && m_clearance > 0 )
307 {
308 gal->SetLineWidth( m_width + 2 * m_clearance );
309 drawLineChain( l, gal );
310 }
311
312 gal->SetLayerDepth( m_depth );
313 gal->SetLineWidth( m_width );
314 gal->SetStrokeColor( m_color );
315 gal->SetFillColor( m_color );
316 drawLineChain( l, gal );
317 break;
318 }
319
320 case SH_LINE_CHAIN:
321 {
322 const SHAPE_LINE_CHAIN* l = (const SHAPE_LINE_CHAIN*) aShape;
323 const int w = m_width;
324
325 if( showClearance && m_clearance > 0 )
326 {
327 gal->SetLineWidth( w + 2 * m_clearance );
328 drawLineChain( l, gal );
329 }
330
331 gal->SetLayerDepth( m_depth );
332 gal->SetLineWidth( w );
333 gal->SetStrokeColor( m_color );
334 gal->SetFillColor( m_color );
335 drawLineChain( l, gal );
336 break;
337 }
338
339 case SH_SEGMENT:
340 {
341 const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) aShape;
342 const int w = s->GetWidth();
343
344 gal->SetIsStroke( false );
345
346 if( showClearance && m_clearance > 0 )
347 {
348 gal->SetLineWidth( w + 2 * m_clearance );
349 gal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() + 2 * m_clearance );
350 }
351
352 gal->SetLayerDepth( m_depth );
353 gal->SetLineWidth( w );
354 gal->SetFillColor( m_color );
355 gal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() );
356 break;
357 }
358
359 case SH_CIRCLE:
360 {
361 const SHAPE_CIRCLE* c = static_cast<const SHAPE_CIRCLE*>( aShape );
362 gal->SetStrokeColor( m_color );
363
364 if( showClearance && m_clearance > 0 )
365 {
366 gal->SetIsStroke( false );
367 gal->DrawCircle( c->GetCenter(), c->GetRadius() + m_clearance );
368 }
369
370 gal->SetLayerDepth( m_depth );
371
372 if( m_hole && dynamic_cast<SHAPE_CIRCLE*>( m_hole ) )
373 {
374 const SHAPE_CIRCLE* h = static_cast<const SHAPE_CIRCLE*>( m_hole );
375 int halfWidth = m_width / 2;
376
377 gal->SetIsStroke( true );
378 gal->SetIsFill( false );
379 gal->SetLineWidth( halfWidth + c->GetRadius() - h->GetRadius() );
380 gal->DrawCircle( c->GetCenter(), ( halfWidth + c->GetRadius() + h->GetRadius() ) / 2 );
381
382 holeDrawn = true;
383 }
384 else
385 {
386 gal->SetIsStroke( m_width ? true : false );
387 gal->SetLineWidth( m_width );
388 gal->SetFillColor( m_color );
389 gal->DrawCircle( c->GetCenter(), c->GetRadius() );
390 }
391
392 break;
393 }
394
395 case SH_RECT:
396 {
397 const SHAPE_RECT* r = (const SHAPE_RECT*) aShape;
398 gal->SetFillColor( m_color );
399
400 if( showClearance && m_clearance > 0 )
401 {
402 VECTOR2I p0( r->GetPosition() ), s( r->GetSize() );
403 gal->SetIsStroke( true );
404 gal->SetLineWidth( 2 * m_clearance );
405 gal->DrawLine( p0, VECTOR2I( p0.x + s.x, p0.y ) );
406 gal->DrawLine( p0, VECTOR2I( p0.x, p0.y + s.y ) );
407 gal->DrawLine( p0 + s , VECTOR2I( p0.x + s.x, p0.y ) );
408 gal->DrawLine( p0 + s, VECTOR2I( p0.x, p0.y + s.y ) );
409 }
410
411 gal->SetLayerDepth( m_depth );
412 gal->SetIsStroke( m_width ? true : false );
413 gal->SetLineWidth( m_width);
414 gal->SetStrokeColor( m_color );
415 gal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
416
417 break;
418 }
419
420 case SH_SIMPLE:
421 {
422 const SHAPE_SIMPLE* c = (const SHAPE_SIMPLE*) aShape;
423 std::deque<VECTOR2D> polygon = std::deque<VECTOR2D>();
424
425 for( int i = 0; i < c->PointCount(); i++ )
426 {
427 polygon.push_back( c->CDPoint( i ) );
428 }
429
430 gal->SetFillColor( m_color );
431
432 if( showClearance && m_clearance > 0 )
433 {
434 gal->SetIsStroke( true );
435 gal->SetLineWidth( 2 * m_clearance );
436
437 // need the implicit last segment to be explicit for DrawPolyline
438 polygon.push_back( c->CDPoint( 0 ) );
439 gal->DrawPolyline( polygon );
440 }
441
442 gal->SetLayerDepth( m_depth );
443 gal->SetIsStroke( m_width ? true : false );
444 gal->SetLineWidth( m_width );
445 gal->SetStrokeColor( m_color );
446 gal->DrawPolygon( polygon );
447 break;
448 }
449
450 case SH_ARC:
451 {
452 const SHAPE_ARC* arc = static_cast<const SHAPE_ARC*>( aShape );
453 const int w = arc->GetWidth();
454 EDA_ANGLE start_angle = arc->GetStartAngle();
455 EDA_ANGLE angle = arc->GetCentralAngle();
456
457 gal->SetIsFill( false );
458 gal->SetIsStroke( true );
459
460 if( showClearance && m_clearance > 0 )
461 {
462 gal->SetLineWidth( w + 2 * m_clearance );
463 gal->DrawArc( arc->GetCenter(), arc->GetRadius(), start_angle, angle );
464 }
465
466 gal->SetLayerDepth( m_depth );
467 gal->SetStrokeColor( m_color );
468 gal->SetFillColor( m_color );
469 gal->SetLineWidth( w );
470 gal->DrawArc( arc->GetCenter(), arc->GetRadius(), start_angle, angle );
471 break;
472 }
473
474 case SH_COMPOUND:
475 wxFAIL_MSG( wxT( "Router preview item: nested compound shapes not supported" ) );
476 break;
477
478 case SH_POLY_SET:
479 wxFAIL_MSG( wxT( "Router preview item: SHAPE_POLY_SET not supported" ) );
480 break;
481
482 case SH_NULL:
483 break;
484 }
485
486 if( m_hole && !holeDrawn )
487 {
488 gal->SetLayerDepth( m_depth );
489 gal->SetIsStroke( true );
490 gal->SetIsFill( false );
491 gal->SetStrokeColor( m_color );
492 gal->SetLineWidth( 1 );
493
494 SHAPE_CIRCLE* circle = dynamic_cast<SHAPE_CIRCLE*>( m_hole );
495 SHAPE_SEGMENT* slot = dynamic_cast<SHAPE_SEGMENT*>( m_hole );
496
497 if( circle )
498 gal->DrawCircle( circle->GetCenter(), circle->GetRadius() );
499 else if( slot )
500 gal->DrawSegment( slot->GetSeg().A, slot->GetSeg().B, slot->GetWidth() );
501 }
502}
503
504
505void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
506{
507 GAL* gal = aView->GetGAL();
508 //col.Brighten(0.7);
509
510 if( m_type == PR_SHAPE )
511 {
512 if( !m_shape )
513 return;
514
515 // N.B. The order of draw here is important
516 // Cairo doesn't current support z-ordering, so we need
517 // to draw the clearance first to ensure it is in the background
519
520 //TODO(snh) Add configuration option for the color/alpha here
521 gal->SetStrokeColor( COLOR4D( DARKDARKGRAY ).WithAlpha( 0.9 ) );
522 gal->SetFillColor( COLOR4D( DARKDARKGRAY ).WithAlpha( 0.7 ) );
523 gal->SetIsStroke( m_width ? true : false );
524 gal->SetIsFill( true );
525
526 // Semi-solids (ie: rule areas) which are not in collision are sketched (ie: outline only)
527 if( ( m_flags & PNS_SEMI_SOLID ) > 0 && ( m_flags & PNS_COLLISION ) == 0 )
528 gal->SetIsFill( false );
529
530 if( m_shape->HasIndexableSubshapes() )
531 {
532 std::vector<const SHAPE*> subshapes;
533 m_shape->GetIndexableSubshapes( subshapes );
534
535 for( const SHAPE* shape : subshapes )
536 drawShape( shape, gal );
537 }
538 else
539 {
540 drawShape( m_shape, gal );
541 }
542 }
543}
544
545
546const COLOR4D ROUTER_PREVIEW_ITEM::getLayerColor( int aLayer, const PNS::ITEM* aItem ) const
547{
548 auto settings = static_cast<PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() );
549
550 COLOR4D color = settings->GetLayerColor( aLayer );
551
552 if( aItem && aItem->Net() && settings->GetNetColorMode() == NET_COLOR_MODE::ALL && IsCopperLayer( aLayer ) )
553 {
554 NETINFO_ITEM* ni = static_cast<NETINFO_ITEM*>( aItem->Net() );
555 NETCLASS* nc = ni->GetNetClass();
556
557 if( nc && nc->HasPcbColor() )
558 color = nc->GetPcbColor();
559 }
560
561 if( m_flags & PNS_HEAD_TRACE )
562 return color.Saturate( 1.0 );
563 else if( m_flags & PNS_HOVER_ITEM )
564 return color.Brightened( 0.7 );
565
566 return color;
567}
@ ALL
Net/netclass colors are shown on all net copper.
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:84
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
Definition board_item.h:350
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
Definition box2.h:558
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
Definition box2.h:658
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:41
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:105
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
Definition color4d.h:269
COLOR4D & Saturate(double aFactor)
Saturates the color to a given factor (in HSV model)
Definition color4d.cpp:517
Abstract interface for drawing on a 2D-surface.
virtual void DrawPolygon(const std::deque< VECTOR2D > &aPointList)
Draw a polygon.
virtual void SetLayerDepth(double aLayerDepth)
Set the depth of the layer (position on the z-axis)
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual void DrawRectangle(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a rectangle.
virtual void SetFillColor(const COLOR4D &aColor)
Set the fill color.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.
virtual void SetLineWidth(float aLineWidth)
Set the line width.
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.
virtual void DrawArc(const VECTOR2D &aCenterPoint, double aRadius, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aAngle)
Draw an arc.
virtual void DrawSegment(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint, double aWidth)
Draw a rounded segment.
float GetLineWidth() const
Get the line width.
PCB specific render settings.
Definition pcb_painter.h:82
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:67
int GetLayerOrder(int aLayer) const
Return rendering order of a particular layer.
Definition view.cpp:733
GAL * GetGAL() const
Return the GAL this view is using to draw graphical primitives.
Definition view.h:211
A collection of nets and the parameters used to route or test these nets.
Definition netclass.h:42
COLOR4D GetPcbColor(bool aIsForSave=false) const
Definition netclass.h:186
bool HasPcbColor() const
Definition netclass.h:185
Handle the data for a net.
Definition netinfo.h:50
NETCLASS * GetNetClass()
Definition netinfo.h:95
const SHAPE * Shape(int aLayer) const override
Return the geometrical shape of the item.
Definition pns_hole.h:69
Base class for PNS router board items.
Definition pns_item.h:98
virtual const SHAPE * Shape(int aLayer) const
Return the geometrical shape of the item.
Definition pns_item.h:242
const PNS_LAYER_RANGE & Layers() const
Definition pns_item.h:212
virtual NET_HANDLE Net() const
Definition pns_item.h:210
PnsKind Kind() const
Return the type (kind) of the item.
Definition pns_item.h:173
virtual HOLE * Hole() const
Definition pns_item.h:304
virtual bool HasHole() const
Definition pns_item.h:303
virtual BOARD_ITEM * BoardItem() const
Definition pns_item.h:207
virtual int Marker() const
Definition pns_item.h:263
Represents a track on a PCB, connecting two non-trivial joints (that is, vias, pads,...
Definition pns_line.h:62
int Start() const
ROUTER_PREVIEW_ITEM(const SHAPE &aShape, PNS::ROUTER_IFACE *aIface, KIGFX::VIEW *aView)
static constexpr double LayerDepthFactor
We draw this item on a single layer, but we stack up all the layers from the various components that ...
void Update(const PNS::ITEM *aItem)
virtual void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
const KIGFX::COLOR4D getLayerColor(int aLayer, const PNS::ITEM *aItem=nullptr) const
void drawLineChain(const SHAPE_LINE_CHAIN_BASE *aL, KIGFX::GAL *aGal) const
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
void drawShape(const SHAPE *aShape, KIGFX::GAL *aGal) const
PNS::ROUTER_IFACE * m_iface
Definition seg.h:42
VECTOR2I A
Definition seg.h:49
VECTOR2I B
Definition seg.h:50
EDA_ANGLE GetCentralAngle() const
Get the "central angle" of the arc - this is the angle at the point of the "pie slice".
int GetWidth() const override
Definition shape_arc.h:215
double GetRadius() const
EDA_ANGLE GetStartAngle() const
const VECTOR2I & GetCenter() const
SHAPE_TYPE Type() const
Return the type of the shape.
Definition shape.h:98
int GetRadius() const
const VECTOR2I GetCenter() const
virtual size_t GetSegmentCount() const =0
virtual bool IsClosed() const =0
virtual const SEG GetSegment(int aIndex) const =0
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
const std::vector< SHAPE_ARC > & CArcs() const
size_t ArcCount() const
const VECTOR2I & GetPosition() const
Definition shape_rect.h:169
const VECTOR2I GetSize() const
Definition shape_rect.h:177
const SEG & GetSeg() const
int GetWidth() const override
Represent a simple polygon consisting of a zero-thickness closed chain of connected line segments.
int PointCount() const
Return the number of points (vertices) in this polygon.
const VECTOR2D CDPoint(int aIndex) const
Return a given point as a vector with elements of type double.
An abstract shape on 2D plane.
Definition shape.h:126
virtual SHAPE * Clone() const
Return a dynamically allocated copy of the shape.
Definition shape.h:148
@ DARKDARKGRAY
Definition color4d.h:45
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition layer_ids.h:679
@ LAYER_SELECT_OVERLAY
Selected items overlay.
Definition layer_ids.h:280
@ LAYER_VIAS
Meta control for all vias opacity/visibility.
Definition layer_ids.h:232
@ Edge_Cuts
Definition layer_ids.h:112
@ PCB_LAYER_ID_COUNT
Definition layer_ids.h:171
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:33
@ MK_VIOLATION
Definition pns_item.h:44
#define PNS_HEAD_TRACE
#define PNS_SEMI_SOLID
#define PNS_HOVER_ITEM
#define PNS_COLLISION
@ SH_POLY_SET
set of polygons (with holes, etc.)
Definition shape.h:52
@ SH_RECT
axis-aligned rectangle
Definition shape.h:47
@ SH_CIRCLE
circle
Definition shape.h:50
@ SH_SIMPLE
simple polygon
Definition shape.h:51
@ SH_NULL
empty shape (no shape...),
Definition shape.h:55
@ SH_SEGMENT
line segment
Definition shape.h:48
@ SH_ARC
circular arc
Definition shape.h:54
@ SH_POLY_SET_TRIANGLE
a single triangle belonging to a POLY_SET triangulation
Definition shape.h:56
@ SH_LINE_CHAIN
line chain (polyline)
Definition shape.h:49
@ SH_COMPOUND
compound shape, consisting of multiple simple shapes
Definition shape.h:53
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
@ NOT_USED
the 3d code uses this value
Definition typeinfo.h:76
Casted dyn_cast(From aObject)
A lightweight dynamic downcast.
Definition typeinfo.h:60
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:687