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>
33#include <pcb_painter.h>
34#include <trigo.h>
35
36#include "pns_arc.h"
37#include "pns_line.h"
38#include "pns_segment.h"
39#include "pns_via.h"
40#include "pns_kicad_iface.h"
41
42#include <pcb_painter.h>
43#include <netinfo.h>
44#include <layer_ids.h>
45
46using namespace KIGFX;
47
48
50 KIGFX::VIEW* aView, int aFlags ) :
52 m_view( aView ),
53 m_iface( aIface ),
54 m_shape( nullptr ),
55 m_hole( nullptr ),
56 m_flags( aFlags )
57{
58 BOARD_ITEM* boardItem = aItem ? aItem->BoardItem() : nullptr;
59
60 // A PNS::SOLID for an edge-cut item must have 0 width for collision calculations, but when
61 // highlighting an edge we want to show it with its true width
62 if( boardItem && boardItem->IsOnLayer( Edge_Cuts ) )
63 {
64 m_shape = aItem->Shape( -1 )->Clone();
65
66 switch( m_shape->Type() )
67 {
68 case SH_SEGMENT: static_cast<SHAPE_SEGMENT*>( m_shape )->SetWidth( 0 ); break;
69 case SH_ARC: static_cast<SHAPE_ARC*>( m_shape )->SetWidth( 0 ); break;
70 case SH_LINE_CHAIN: static_cast<SHAPE_LINE_CHAIN*>( m_shape )->SetWidth( 0 ); break;
71 default: /* remaining shapes don't have width */ break;
72 }
73 }
74 else if( aItem )
75 {
76 // TODO(JE) padstacks -- need to know the layer here
77 m_shape = aItem->Shape( -1 )->Clone();
78
79 if( aItem->HasHole() )
80 m_hole = aItem->Hole()->Shape( -1 )->Clone();
81 }
82
83 m_clearance = -1;
84 m_originLayer = m_layer = LAYER_SELECT_OVERLAY ;
85
86 m_showClearance = false;
87
88 // initialize variables, overwritten by Update( aItem ), if aItem != NULL
89 m_type = PR_SHAPE;
90 m_width = ( aFlags & PNS_SEMI_SOLID ) ? 1 : 0;
91 m_depth = m_originDepth = aView->GetLayerOrder( m_originLayer );
92
93 if( aItem )
94 Update( aItem );
95}
96
97
99 KIGFX::VIEW* aView ) :
101 m_view( aView ),
102 m_iface( aIface ),
103 m_flags( 0 )
104{
105 m_shape = aShape.Clone();
106 m_hole = nullptr;
107
108 m_clearance = -1;
110
111 m_showClearance = false;
112
113 // initialize variables, overwritten by Update( aItem ), if aItem != NULL
115 m_width = 0;
117}
118
119
121{
122 delete m_shape;
123 delete m_hole;
124}
125
126
128{
129 m_originLayer = m_iface->GetBoardLayerFromPNSLayer( aItem->Layers().Start() );
130
131 if( const PNS::LINE* l = dyn_cast<const PNS::LINE*>( aItem ) )
132 {
133 if( !l->SegmentCount() )
134 return;
135 }
136 else if( const PNS::VIA* v = dyn_cast<const PNS::VIA*>( aItem ) )
137 {
138 if( v->IsVirtual() )
139 return;
140 }
141
142 if( m_originLayer < 0 )
143 m_originLayer = 0;
144
147 m_color.a = 0.8;
148 m_depth = m_originDepth - ( ( aItem->Layers().Start() + 1 ) * LayerDepthFactor );
149
150 switch( aItem->Kind() )
151 {
154 m_width = static_cast<const PNS::LINE*>( aItem )->Width();
155 break;
156
157 case PNS::ITEM::ARC_T:
159 m_width = static_cast<const PNS::ARC*>( aItem )->Width();
160 break;
161
164 m_width = static_cast<const PNS::SEGMENT*>( aItem )->Width();
165 break;
166
167 case PNS::ITEM::VIA_T:
168 {
171 m_width = 0;
172 m_color = COLOR4D( 0.7, 0.7, 0.7, 0.8 );
173 m_depth = m_originDepth - ( static_cast<double>( PCB_LAYER_ID_COUNT ) * LayerDepthFactor );
174
175 delete m_shape;
176 m_shape = nullptr;
177
178 auto via = static_cast<const PNS::VIA*>( aItem );
179 int shapeLayer = -1;
180 int largestDiameter = 0;
181
182 for( int layer : via->UniqueShapeLayers() )
183 {
184 if( via->Diameter( layer ) > largestDiameter )
185 {
186 largestDiameter = via->Diameter( layer );
187 shapeLayer = layer;
188 }
189 }
190
191 if( aItem->Shape( shapeLayer ) )
192 m_shape = aItem->Shape( shapeLayer )->Clone();
193
194 delete m_hole;
195 m_hole = nullptr;
196
197 if( aItem->HasHole() )
198 m_hole = aItem->Hole()->Shape( -1 )->Clone();
199
200 break;
201 }
202
205 break;
206
207 default:
208 break;
209 }
210
211 if( aItem->Marker() & PNS::MK_VIOLATION )
213
214 if( m_flags & PNS_COLLISION )
215 m_color = COLOR4D( 0, 1, 0, 1 );
216
217 if( m_flags & PNS_HOVER_ITEM )
218 m_color = m_color.WithAlpha( 1.0 );
219}
220
221
223{
224 BOX2I bbox;
225
226 switch( m_type )
227 {
228 case PR_SHAPE:
229 if( m_shape )
230 {
231 bbox = m_shape->BBox();
232 bbox.Inflate( m_width / 2 );
233 }
234
235 if( m_hole )
236 bbox.Merge( m_hole->BBox() );
237
238 return bbox;
239
240 case PR_POINT:
241 bbox = BOX2I ( m_pos - VECTOR2I( 100000, 100000 ), VECTOR2I( 200000, 200000 ) );
242 return bbox;
243
244 default:
245 break;
246 }
247
248 return bbox;
249}
250
251
253{
254 wxCHECK( aL, /* void */ );
255
256 gal->SetIsFill( false );
257
258 for( int s = 0; s < (int) aL->GetSegmentCount(); s++ )
259 {
260 SEG seg = aL->GetSegment( s );
261
262 if( seg.A == seg.B )
263 {
264 gal->SetIsFill( true );
265 gal->SetIsStroke( false );
266 gal->DrawCircle( seg.A, gal->GetLineWidth() / 2 );
267 gal->SetIsFill( false );
268 gal->SetIsStroke( true );
269 }
270 else
271 {
272 gal->DrawLine( seg.A, seg.B );
273 }
274 }
275
276 const SHAPE_LINE_CHAIN* lineChain = dynamic_cast<const SHAPE_LINE_CHAIN*>( aL );
277
278 for( size_t s = 0; lineChain && s < lineChain->ArcCount(); s++ )
279 {
280 const SHAPE_ARC& arc = lineChain->CArcs()[s];
281 EDA_ANGLE start_angle = arc.GetStartAngle();
282 EDA_ANGLE angle = arc.GetCentralAngle();
283
284 gal->DrawArc( arc.GetCenter(), arc.GetRadius(), start_angle, angle);
285 }
286
287 if( aL->IsClosed() )
288 gal->DrawLine( aL->GetSegment( -1 ).B, aL->GetSegment( 0 ).A );
289}
290
291
292void ROUTER_PREVIEW_ITEM::drawShape( const SHAPE* aShape, KIGFX::GAL* gal ) const
293{
294 bool holeDrawn = false;
295 bool showClearance = m_showClearance;
296
297 // Always show clearance when we're in collision, even if the preference is off
298 if( ( m_flags & PNS_COLLISION ) > 0 )
299 showClearance = true;
300
301 switch( aShape->Type() )
302 {
304 {
305 const SHAPE_LINE_CHAIN_BASE* l = (const SHAPE_LINE_CHAIN_BASE*) aShape;
306
307 if( showClearance && m_clearance > 0 )
308 {
309 gal->SetLineWidth( m_width + 2 * m_clearance );
310 drawLineChain( l, gal );
311 }
312
313 gal->SetLayerDepth( m_depth );
314 gal->SetLineWidth( m_width );
315 gal->SetStrokeColor( m_color );
316 gal->SetFillColor( m_color );
317 drawLineChain( l, gal );
318 break;
319 }
320
321 case SH_LINE_CHAIN:
322 {
323 const SHAPE_LINE_CHAIN* l = (const SHAPE_LINE_CHAIN*) aShape;
324 const int w = m_width;
325
326 if( showClearance && m_clearance > 0 )
327 {
328 gal->SetLineWidth( w + 2 * m_clearance );
329 drawLineChain( l, gal );
330 }
331
332 gal->SetLayerDepth( m_depth );
333 gal->SetLineWidth( w );
334 gal->SetStrokeColor( m_color );
335 gal->SetFillColor( m_color );
336 drawLineChain( l, gal );
337 break;
338 }
339
340 case SH_SEGMENT:
341 {
342 const SHAPE_SEGMENT* s = (const SHAPE_SEGMENT*) aShape;
343 const int w = s->GetWidth();
344
345 gal->SetIsStroke( false );
346
347 if( showClearance && m_clearance > 0 )
348 {
349 gal->SetLineWidth( w + 2 * m_clearance );
350 gal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() + 2 * m_clearance );
351 }
352
353 gal->SetLayerDepth( m_depth );
354 gal->SetLineWidth( w );
355 gal->SetFillColor( m_color );
356 gal->DrawSegment( s->GetSeg().A, s->GetSeg().B, s->GetWidth() );
357 break;
358 }
359
360 case SH_CIRCLE:
361 {
362 const SHAPE_CIRCLE* c = static_cast<const SHAPE_CIRCLE*>( aShape );
363 gal->SetStrokeColor( m_color );
364
365 if( showClearance && m_clearance > 0 )
366 {
367 gal->SetIsStroke( false );
368 gal->DrawCircle( c->GetCenter(), c->GetRadius() + m_clearance );
369 }
370
371 gal->SetLayerDepth( m_depth );
372
373 if( m_hole && dynamic_cast<SHAPE_CIRCLE*>( m_hole ) )
374 {
375 const SHAPE_CIRCLE* h = static_cast<const SHAPE_CIRCLE*>( m_hole );
376 int halfWidth = m_width / 2;
377
378 gal->SetIsStroke( true );
379 gal->SetIsFill( false );
380 gal->SetLineWidth( halfWidth + c->GetRadius() - h->GetRadius() );
381 gal->DrawCircle( c->GetCenter(), ( halfWidth + c->GetRadius() + h->GetRadius() ) / 2 );
382
383 holeDrawn = true;
384 }
385 else
386 {
387 gal->SetIsStroke( m_width ? true : false );
388 gal->SetLineWidth( m_width );
389 gal->SetFillColor( m_color );
390 gal->DrawCircle( c->GetCenter(), c->GetRadius() );
391 }
392
393 break;
394 }
395
396 case SH_RECT:
397 {
398 const SHAPE_RECT* r = (const SHAPE_RECT*) aShape;
399 gal->SetFillColor( m_color );
400
401 if( showClearance && m_clearance > 0 )
402 {
403 VECTOR2I p0( r->GetPosition() ), s( r->GetSize() );
404 gal->SetIsStroke( true );
405 gal->SetLineWidth( 2 * m_clearance );
406 gal->DrawLine( p0, VECTOR2I( p0.x + s.x, p0.y ) );
407 gal->DrawLine( p0, VECTOR2I( p0.x, p0.y + s.y ) );
408 gal->DrawLine( p0 + s , VECTOR2I( p0.x + s.x, p0.y ) );
409 gal->DrawLine( p0 + s, VECTOR2I( p0.x, p0.y + s.y ) );
410 }
411
412 gal->SetLayerDepth( m_depth );
413 gal->SetIsStroke( m_width ? true : false );
414 gal->SetLineWidth( m_width);
415 gal->SetStrokeColor( m_color );
416 gal->DrawRectangle( r->GetPosition(), r->GetPosition() + r->GetSize() );
417
418 break;
419 }
420
421 case SH_SIMPLE:
422 {
423 const SHAPE_SIMPLE* c = (const SHAPE_SIMPLE*) aShape;
424 std::deque<VECTOR2D> polygon = std::deque<VECTOR2D>();
425
426 for( int i = 0; i < c->PointCount(); i++ )
427 {
428 polygon.push_back( c->CDPoint( i ) );
429 }
430
431 gal->SetFillColor( m_color );
432
433 if( showClearance && m_clearance > 0 )
434 {
435 gal->SetIsStroke( true );
436 gal->SetLineWidth( 2 * m_clearance );
437
438 // need the implicit last segment to be explicit for DrawPolyline
439 polygon.push_back( c->CDPoint( 0 ) );
440 gal->DrawPolyline( polygon );
441 }
442
443 gal->SetLayerDepth( m_depth );
444 gal->SetIsStroke( m_width ? true : false );
445 gal->SetLineWidth( m_width );
446 gal->SetStrokeColor( m_color );
447 gal->DrawPolygon( polygon );
448 break;
449 }
450
451 case SH_ARC:
452 {
453 const SHAPE_ARC* arc = static_cast<const SHAPE_ARC*>( aShape );
454 const int w = arc->GetWidth();
455 EDA_ANGLE start_angle = arc->GetStartAngle();
456 EDA_ANGLE angle = arc->GetCentralAngle();
457
458 gal->SetIsFill( false );
459 gal->SetIsStroke( true );
460
461 if( showClearance && m_clearance > 0 )
462 {
463 gal->SetLineWidth( w + 2 * m_clearance );
464 gal->DrawArc( arc->GetCenter(), arc->GetRadius(), start_angle, angle );
465 }
466
467 gal->SetLayerDepth( m_depth );
468 gal->SetStrokeColor( m_color );
469 gal->SetFillColor( m_color );
470 gal->SetLineWidth( w );
471 gal->DrawArc( arc->GetCenter(), arc->GetRadius(), start_angle, angle );
472 break;
473 }
474
475 case SH_ELLIPSE:
476 {
477 const SHAPE_ELLIPSE* ellipse = static_cast<const SHAPE_ELLIPSE*>( aShape );
478 const VECTOR2I center = ellipse->GetCenter();
479 const int major = ellipse->GetMajorRadius();
480 const int minor = ellipse->GetMinorRadius();
481 const EDA_ANGLE rotation = ellipse->GetRotation();
482 const bool isArc = ellipse->IsArc();
483 const int w = std::max( 1, ellipse->GetWidth() );
484
485 gal->SetIsFill( false );
486 gal->SetIsStroke( true );
487
488 if( showClearance && m_clearance > 0 )
489 {
490 gal->SetLineWidth( w + 2 * m_clearance );
491
492 if( isArc )
493 gal->DrawEllipseArc( center, major, minor, rotation, ellipse->GetStartAngle(), ellipse->GetEndAngle() );
494 else
495 gal->DrawEllipse( center, major, minor, rotation );
496 }
497
498 gal->SetLayerDepth( m_depth );
499 gal->SetStrokeColor( m_color );
500 gal->SetFillColor( m_color );
501 gal->SetLineWidth( w );
502
503 if( isArc )
504 gal->DrawEllipseArc( center, major, minor, rotation, ellipse->GetStartAngle(), ellipse->GetEndAngle() );
505 else
506 gal->DrawEllipse( center, major, minor, rotation );
507
508 break;
509 }
510
511 case SH_COMPOUND:
512 wxFAIL_MSG( wxT( "Router preview item: nested compound shapes not supported" ) );
513 break;
514
515 case SH_POLY_SET:
516 wxFAIL_MSG( wxT( "Router preview item: SHAPE_POLY_SET not supported" ) );
517 break;
518
519 case SH_NULL:
520 break;
521 }
522
523 if( m_hole && !holeDrawn )
524 {
525 gal->SetLayerDepth( m_depth );
526 gal->SetIsStroke( true );
527 gal->SetIsFill( false );
528 gal->SetStrokeColor( m_color );
529 gal->SetLineWidth( 1 );
530
531 SHAPE_CIRCLE* circle = dynamic_cast<SHAPE_CIRCLE*>( m_hole );
532 SHAPE_SEGMENT* slot = dynamic_cast<SHAPE_SEGMENT*>( m_hole );
533
534 if( circle )
535 gal->DrawCircle( circle->GetCenter(), circle->GetRadius() );
536 else if( slot )
537 gal->DrawSegment( slot->GetSeg().A, slot->GetSeg().B, slot->GetWidth() );
538 }
539}
540
541
542void ROUTER_PREVIEW_ITEM::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
543{
544 GAL* gal = aView->GetGAL();
545 //col.Brighten(0.7);
546
547 if( m_type == PR_SHAPE )
548 {
549 if( !m_shape )
550 return;
551
552 // N.B. The order of draw here is important
553 // Cairo doesn't current support z-ordering, so we need
554 // to draw the clearance first to ensure it is in the background
556
557 //TODO(snh) Add configuration option for the color/alpha here
558 gal->SetStrokeColor( COLOR4D( DARKDARKGRAY ).WithAlpha( 0.9 ) );
559 gal->SetFillColor( COLOR4D( DARKDARKGRAY ).WithAlpha( 0.7 ) );
560 gal->SetIsStroke( m_width ? true : false );
561 gal->SetIsFill( true );
562
563 // Semi-solids (ie: rule areas) which are not in collision are sketched (ie: outline only)
564 if( ( m_flags & PNS_SEMI_SOLID ) > 0 && ( m_flags & PNS_COLLISION ) == 0 )
565 gal->SetIsFill( false );
566
567 if( m_shape->HasIndexableSubshapes() )
568 {
569 std::vector<const SHAPE*> subshapes;
570 m_shape->GetIndexableSubshapes( subshapes );
571
572 for( const SHAPE* shape : subshapes )
573 drawShape( shape, gal );
574 }
575 else
576 {
577 drawShape( m_shape, gal );
578 }
579 }
580}
581
582
583const COLOR4D ROUTER_PREVIEW_ITEM::getLayerColor( int aLayer, const PNS::ITEM* aItem ) const
584{
585 auto settings = static_cast<PCB_RENDER_SETTINGS*>( m_view->GetPainter()->GetSettings() );
586
587 COLOR4D color = settings->GetLayerColor( aLayer );
588
589 if( aItem && aItem->Net() && settings->GetNetColorMode() == NET_COLOR_MODE::ALL && IsCopperLayer( aLayer ) )
590 {
591 NETINFO_ITEM* ni = static_cast<NETINFO_ITEM*>( aItem->Net() );
592
593 auto ii = settings->GetNetColorMap().find( ni->GetNetCode() );
594
595 if( ii != settings->GetNetColorMap().end() && ii->second != COLOR4D::UNSPECIFIED )
596 {
597 color = ii->second;
598 }
599 else
600 {
601 NETCLASS* nc = ni->GetNetClass();
602
603 if( nc && nc->HasPcbColor() )
604 color = nc->GetPcbColor();
605 }
606 }
607
608 if( m_flags & PNS_HEAD_TRACE )
609 return color.Saturate( 1.0 );
610 else if( m_flags & PNS_HOVER_ITEM )
611 return color.Brightened( 0.7 );
612
613 return color;
614}
@ 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
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:402
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 DrawEllipseArc(const VECTOR2D &aCenterPoint, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle)
Draw an elliptical arc in world coordinates.
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 DrawEllipse(const VECTOR2D &aCenterPoint, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation)
Draw a closed ellipse.
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:736
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
int GetNetCode() const
Definition netinfo.h:97
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:100
int GetRadius() const
const VECTOR2I GetCenter() const
int GetMajorRadius() const
const VECTOR2I & GetCenter() const
const EDA_ANGLE & GetStartAngle() const
const EDA_ANGLE & GetEndAngle() const
const EDA_ANGLE & GetRotation() const
bool IsArc() const
int GetMinorRadius() 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:128
virtual int GetWidth() const
Definition shape.h:291
virtual SHAPE * Clone() const
Return a dynamically allocated copy of the shape.
Definition shape.h:150
@ 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_ELLIPSE
ellipse or elliptical arc
Definition shape.h:57
@ 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
VECTOR2I center
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