KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_track.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
35#ifndef CLASS_TRACK_H
36#define CLASS_TRACK_H
37
38
39#include <mutex>
40#include <array>
42#include <base_units.h>
44#include <core/minoptmax.h>
45#include <core/arraydim.h>
46#include <padstack.h>
47
48class PCB_TRACK;
49class PCB_VIA;
50class PAD;
51class MSG_PANEL_ITEM;
52class SHAPE_POLY_SET;
53class SHAPE_ARC;
54
55
56// Flag used in locate routines (from which endpoint work)
57enum ENDPOINT_T : int
58{
60 ENDPOINT_END = 1
61};
62
63// Note that this enum must be synchronized to GAL_LAYER_ID
64enum class VIATYPE : int
65{
66 THROUGH = 3, /* Always a through hole via */
67 BLIND_BURIED = 2, /* this via can be on internal layers */
68 MICROVIA = 1, /* this via which connect from an external layer
69 * to the near neighbor internal layer */
70 NOT_DEFINED = 0 /* not yet used */
71};
72
73#define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter.
74
75// Used for tracks and vias for algorithmic safety, not to enforce constraints
76#define GEOMETRY_MIN_SIZE (int) ( 0.001 * pcbIUScale.IU_PER_MM )
77
78
80{
81public:
82 static inline bool ClassOf( const EDA_ITEM* aItem )
83 {
84 return aItem && PCB_TRACE_T == aItem->Type();
85 }
86
87 PCB_TRACK( BOARD_ITEM* aParent, KICAD_T idtype = PCB_TRACE_T );
88
89 // Do not create a copy constructor. The one generated by the compiler is adequate.
90
91 void Move( const VECTOR2I& aMoveVector ) override
92 {
93 m_Start += aMoveVector;
94 m_End += aMoveVector;
95 }
96
97 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
98
99 virtual void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis );
100
101 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
102
103 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
104 VECTOR2I GetPosition() const override { return m_Start; }
105 const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; }
106
107 void SetWidth( int aWidth ) { m_Width = aWidth; }
108 int GetWidth() const { return m_Width; }
109
110 void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; }
111 const VECTOR2I& GetEnd() const { return m_End; }
112
113 void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; }
114 const VECTOR2I& GetStart() const { return m_Start; }
115
116 void SetEndX( int aX ) { m_End.x = aX; }
117 void SetEndY( int aY ) { m_End.y = aY; }
118
119 int GetEndX() const { return m_End.x; }
120 int GetEndY() const { return m_End.y; }
121
123 const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
124 {
125 if( aEndPoint == ENDPOINT_START )
126 return m_Start;
127 else
128 return m_End;
129 }
130
131 // Virtual function
132 const BOX2I GetBoundingBox() const override;
133
139 virtual double GetLength() const;
140
152 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
153 int aError, ERROR_LOC aErrorLoc,
154 bool ignoreLineWidth = false ) const override;
155
156 // @copydoc BOARD_ITEM::GetEffectiveShape
157 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
158 FLASHING aFlash = FLASHING::DEFAULT ) const override;
159
167 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
168
172 bool IsNull() const
173 {
174 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
175 }
176
177 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
178 wxString GetFriendlyName() const override;
179
180 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
181 const std::vector<KICAD_T>& aScanTypes ) override;
182
183 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
184 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
185
186 bool ApproxCollinear( const PCB_TRACK& aTrack );
187
188 wxString GetClass() const override
189 {
190 return wxT( "PCB_TRACK" );
191 }
192
193 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
194
195 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
196
197 BITMAPS GetMenuImage() const override;
198
199 virtual EDA_ITEM* Clone() const override;
200
201 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
202
203 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
204
205 const BOX2I ViewBBox() const override;
206
210 bool IsOnCopperLayer() const override
211 {
212 return true;
213 }
214
221 {
222 return m_CachedLOD;
223 }
224
230 void SetCachedLOD( double aLOD )
231 {
232 m_CachedLOD = aLOD;
233 }
234
241 {
242 return m_CachedScale;
243 }
244
245 virtual double Similarity( const BOARD_ITEM& aOther ) const override;
246
247 virtual bool operator==( const BOARD_ITEM& aOther ) const override;
248 virtual bool operator==( const PCB_TRACK& aOther ) const;
249
255 void SetCachedScale( double aScale )
256 {
257 m_CachedScale = aScale;
258 }
259
261 {
262 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
263 };
264
265 void Serialize( google::protobuf::Any &aContainer ) const override;
266 bool Deserialize( const google::protobuf::Any &aContainer ) override;
267
268#if defined (DEBUG)
269 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
270#endif
271
272protected:
273 virtual void swapData( BOARD_ITEM* aImage ) override;
274
276 std::vector<MSG_PANEL_ITEM>& aList ) const;
277
278protected:
282
283 double m_CachedLOD;
285};
286
287
288class PCB_ARC : public PCB_TRACK
289{
290public:
291 PCB_ARC( BOARD_ITEM* aParent ) :
292 PCB_TRACK( aParent, PCB_ARC_T )
293 { }
294
295 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
296
297 static inline bool ClassOf( const EDA_ITEM *aItem )
298 {
299 return aItem && PCB_ARC_T == aItem->Type();
300 }
301
302 virtual void Move( const VECTOR2I& aMoveVector ) override
303 {
304 m_Start += aMoveVector;
305 m_Mid += aMoveVector;
306 m_End += aMoveVector;
307 }
308
309 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
310
311 void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ) override;
312
313 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
314
315 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
316 const VECTOR2I& GetMid() const { return m_Mid; }
317
318 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
319
320 virtual VECTOR2I GetPosition() const override;
321 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
322
323 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
324
325 double GetRadius() const;
326 EDA_ANGLE GetAngle() const;
328 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
329 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
330
331 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
332 int aAccuracy = 0 ) const override;
333
334 bool IsCCW() const;
335
336 wxString GetClass() const override
337 {
338 return wxT( "PCB_ARC" );
339 }
340
341 // @copydoc BOARD_ITEM::GetEffectiveShape
342 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
343 FLASHING aFlash = FLASHING::DEFAULT ) const override;
344
350 virtual double GetLength() const override
351 {
352 return GetRadius() * std::abs( GetAngle().AsRadians() );
353 }
354
355 EDA_ITEM* Clone() const override;
356
363 bool IsDegenerated( int aThreshold = 5 ) const;
364
365 double Similarity( const BOARD_ITEM& aOther ) const override;
366
367 bool operator==( const BOARD_ITEM& aOther ) const override;
368
369 void Serialize( google::protobuf::Any &aContainer ) const override;
370 bool Deserialize( const google::protobuf::Any &aContainer ) override;
371
372protected:
373 virtual void swapData( BOARD_ITEM* aImage ) override;
374
375private:
377};
378
379
380class PCB_VIA : public PCB_TRACK
381{
382public:
383 PCB_VIA( BOARD_ITEM* aParent );
384
385 static inline bool ClassOf( const EDA_ITEM *aItem )
386 {
387 return aItem && PCB_VIA_T == aItem->Type();
388 }
389
390 PCB_VIA( const PCB_VIA& aOther );
391 PCB_VIA& operator=( const PCB_VIA &aOther );
392
393 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
394 {
395 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
396 return true;
397
398 for( KICAD_T scanType : aScanTypes )
399 {
400 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
401 return true;
402 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
403 return true;
404 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
405 return true;
406 }
407
408 return false;
409 }
410
411 VIATYPE GetViaType() const { return m_viaType; }
412 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
413
414 const PADSTACK& Padstack() const { return m_padStack; }
416 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
417
418 bool HasHole() const override
419 {
420 return true;
421 }
422
423 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
424
425 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
426 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
427
428 bool IsTented() const override;
429 int GetSolderMaskExpansion() const;
430
431 PCB_LAYER_ID GetLayer() const override;
432 void SetLayer( PCB_LAYER_ID aLayer ) override;
433
434 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
435
436 virtual LSET GetLayerSet() const override;
437
442 virtual void SetLayerSet( LSET aLayers ) override;
443
450 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
451
452 void SetBottomLayer( PCB_LAYER_ID aLayer );
453 void SetTopLayer( PCB_LAYER_ID aLayer );
454
462 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
463
464 PCB_LAYER_ID TopLayer() const;
466
471 void SanitizeLayers();
472
473 VECTOR2I GetPosition() const override { return m_Start; }
474 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
475
476 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
477
478 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
479 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
480
481 wxString GetClass() const override
482 {
483 return wxT( "PCB_VIA" );
484 }
485
486 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
487
488 BITMAPS GetMenuImage() const override;
489
490 EDA_ITEM* Clone() const override;
491
492 void ViewGetLayers( int aLayers[], int& aCount ) const override;
493
494 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
495
496 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
497
498#if defined (DEBUG)
499 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
500#endif
501
502 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
503
509 void SetRemoveUnconnected( bool aSet )
510 {
514 }
515
517 {
519 }
520
525 void SetKeepStartEnd( bool aSet )
526 {
530 }
531
532 bool GetKeepStartEnd() const
533 {
536 }
537
539 {
541 {
543 return false;
544
546 return true;
547
549 {
550 if( aLayer == m_padStack.Drill().start || aLayer == m_padStack.Drill().end )
551 return false;
552 }
553 }
554
555 return true;
556 }
557
564 bool FlashLayer( int aLayer ) const;
565
573 bool FlashLayer( LSET aLayers ) const;
574
581 PCB_LAYER_ID* aBottommost ) const;
582
588 void SetDrill( int aDrill )
589 {
590 m_padStack.Drill().size = { aDrill, aDrill };
591 }
592
598 int GetDrill() const { return m_padStack.Drill().size.x; }
599
605 int GetDrillValue() const;
606
611 {
613 }
614
622 bool GetIsFree() const { return m_isFree; }
623 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
624
625 // @copydoc BOARD_ITEM::GetEffectiveShape
626 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
627 FLASHING aFlash = FLASHING::DEFAULT ) const override;
628
630 {
632 }
633
635 {
636 return m_zoneLayerOverrides.at( aLayer );
637 }
638
640 {
641 std::unique_lock<std::mutex> cacheLock( m_zoneLayerOverridesMutex );
642 m_zoneLayerOverrides.at( aLayer ) = aOverride;
643 }
644
645 double Similarity( const BOARD_ITEM& aOther ) const override;
646
647 bool operator==( const BOARD_ITEM& aOther ) const override;
648
649 void Serialize( google::protobuf::Any &aContainer ) const override;
650 bool Deserialize( const google::protobuf::Any &aContainer ) override;
651
652protected:
653 void swapData( BOARD_ITEM* aImage ) override;
654
655 wxString layerMaskDescribe() const override;
656
657private:
659
661
662 bool m_isFree;
663
665 std::array<ZONE_LAYER_OVERRIDE, MAX_CU_LAYERS> m_zoneLayerOverrides;
666};
667
668
669#endif // CLASS_TRACK_H
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
ZONE_LAYER_OVERRIDE
Conditionally flashed vias and pads that interact with zones of different priority can be very squirr...
Definition: board_item.h:64
@ ZLO_NONE
Definition: board_item.h:65
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:77
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:88
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:175
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:575
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
Definition: padstack.h:115
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
Definition: padstack.h:254
UNCONNECTED_LAYER_MODE UnconnectedLayerMode() const
Definition: padstack.h:253
DRILL_PROPS & Drill()
Definition: padstack.h:247
Definition: pad.h:53
bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:201
virtual VECTOR2I GetPosition() const override
Definition: pcb_track.cpp:1529
bool IsDegenerated(int aThreshold=5) const
Definition: pcb_track.cpp:1573
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1514
bool IsCCW() const
Definition: pcb_track.cpp:743
virtual double GetLength() const override
Return the length of the arc track.
Definition: pcb_track.h:350
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:328
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:79
EDA_ANGLE GetArcAngleStart() const
Definition: pcb_track.cpp:1553
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: pcb_track.cpp:1400
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:1564
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:321
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:318
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:302
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:336
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:350
void SetMid(const VECTOR2I &aMid)
Definition: pcb_track.h:315
double GetRadius() const
Definition: pcb_track.cpp:1536
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:1543
const VECTOR2I & GetMid() const
Definition: pcb_track.h:316
PCB_ARC(BOARD_ITEM *aParent)
Definition: pcb_track.h:291
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:723
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: pcb_track.cpp:213
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition: pcb_track.h:376
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:297
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:665
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: pcb_track.cpp:1623
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_track.h:323
void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis) override
Definition: pcb_track.cpp:688
double m_CachedScale
Last zoom scale used to draw this track's net.
Definition: pcb_track.h:284
double m_CachedLOD
Last LOD used to draw this track's net.
Definition: pcb_track.h:283
double GetCachedScale()
Get last used zoom scale for the track net name.
Definition: pcb_track.h:240
double GetCachedLOD()
Get last used LOD for the track net name.
Definition: pcb_track.h:220
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:658
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1059
void SetCachedScale(double aScale)
Set the cached scale.
Definition: pcb_track.h:255
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:289
void SetEndY(int aY)
Definition: pcb_track.h:117
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:105
bool IsOnCopperLayer() const override
Definition: pcb_track.h:210
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:91
void SetWidth(int aWidth)
Definition: pcb_track.h:107
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:188
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1071
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
Definition: pcb_track.cpp:652
int GetWidth() const
Definition: pcb_track.h:108
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1507
void SetEnd(const VECTOR2I &aEnd)
Definition: pcb_track.h:110
void SetStart(const VECTOR2I &aStart)
Definition: pcb_track.h:113
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:1492
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pcb_track.cpp:1136
int GetEndX() const
Definition: pcb_track.h:119
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:309
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
Definition: pcb_track.cpp:778
bool ApproxCollinear(const PCB_TRACK &aTrack)
Definition: pcb_track.cpp:467
VECTOR2I m_End
Line end point.
Definition: pcb_track.h:281
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:103
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: pcb_track.cpp:1260
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:64
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:607
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the track shape to a closed polygon.
Definition: pcb_track.cpp:1629
const VECTOR2I & GetStart() const
Definition: pcb_track.h:114
virtual bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:156
VECTOR2I m_Start
Line start point.
Definition: pcb_track.h:280
int GetEndY() const
Definition: pcb_track.h:120
wxString GetFriendlyName() const override
Definition: pcb_track.cpp:1248
VECTOR2I GetPosition() const override
Definition: pcb_track.h:104
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:1502
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:705
void SetCachedLOD(double aLOD)
Set the cached LOD.
Definition: pcb_track.h:230
const VECTOR2I & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: pcb_track.h:123
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: pcb_track.cpp:1394
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:82
bool IsNull() const
Return true if segment length is zero.
Definition: pcb_track.h:172
virtual double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: pcb_track.cpp:176
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: pcb_track.cpp:1603
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:111
int m_Width
Thickness of track, or via diameter.
Definition: pcb_track.h:279
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:475
void SetEndX(int aX)
Definition: pcb_track.h:116
virtual void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis)
Definition: pcb_track.cpp:673
EDA_ITEM_FLAGS IsPointOnEnds(const VECTOR2I &point, int min_dist=0) const
Return STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if point if near (dist = m...
Definition: pcb_track.cpp:575
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
Definition: pcb_track.cpp:1355
void SetRemoveUnconnected(bool aSet)
Definition: pcb_track.h:509
bool IsTented() const override
Definition: pcb_track.cpp:800
bool GetIsFree() const
Check if the via is a free via (as opposed to one created on a track by the router).
Definition: pcb_track.h:622
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:951
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:150
VECTOR2I GetPosition() const override
Definition: pcb_track.h:473
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
Definition: pcb_track.cpp:1609
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:412
bool GetRemoveUnconnected() const
Definition: pcb_track.h:516
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:982
void SetKeepStartEnd(bool aSet)
Definition: pcb_track.h:525
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:610
void ClearZoneLayerOverrides()
Definition: pcb_track.h:629
const PADSTACK & Padstack() const
Definition: pcb_track.h:414
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition: pcb_track.h:598
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:662
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
Definition: pcb_track.cpp:1436
virtual void SetLayerSet(LSET aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
Definition: pcb_track.cpp:881
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:917
std::array< ZONE_LAYER_OVERRIDE, MAX_CU_LAYERS > m_zoneLayerOverrides
Definition: pcb_track.h:665
PADSTACK & Padstack()
Definition: pcb_track.h:415
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:809
void SetDrill(int aDrill)
Set the drill value for vias.
Definition: pcb_track.h:588
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:511
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:623
bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:241
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
Definition: pcb_track.cpp:1320
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:129
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_track.cpp:840
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1179
std::mutex m_zoneLayerOverridesMutex
Definition: pcb_track.h:664
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:911
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:474
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:794
void SetLayerPair(PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer)
For a via m_layer contains the top layer, the other layer is in m_bottomLayer/.
Definition: pcb_track.cpp:902
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pcb_track.h:393
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: pcb_track.cpp:255
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_track.cpp:846
bool GetKeepStartEnd() const
Definition: pcb_track.h:532
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
Definition: pcb_track.cpp:1029
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:385
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1149
bool HasHole() const override
Definition: pcb_track.h:418
void SanitizeLayers()
Check so that the layers are correct depending on the type of via, and so that the top actually is on...
Definition: pcb_track.cpp:957
PCB_VIA & operator=(const PCB_VIA &aOther)
Definition: pcb_track.cpp:111
void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1521
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:481
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:370
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:538
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:1382
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:412
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
Definition: pcb_track.cpp:529
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:818
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:945
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:135
VIATYPE m_viaType
through, blind/buried or micro
Definition: pcb_track.h:658
PADSTACK m_padStack
Definition: pcb_track.h:660
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
Definition: pcb_track.cpp:560
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition: pcb_track.h:639
VIATYPE GetViaType() const
Definition: pcb_track.h:411
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
Definition: pcb_track.cpp:493
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:852
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:634
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Return the 2 layers used by the via (the via actually uses all layers between these 2 layers)
Definition: pcb_track.cpp:923
void SetPadstack(const PADSTACK &aPadstack)
Definition: pcb_track.h:416
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:752
Represent a set of closed polygons.
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:81
std::uint32_t EDA_ITEM_FLAGS
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:149
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:424
VIATYPE
Definition: pcb_track.h:65
@ BLIND_BURIED
ENDPOINT_T
Definition: pcb_track.h:58
@ ENDPOINT_END
Definition: pcb_track.h:60
@ ENDPOINT_START
Definition: pcb_track.h:59
#define UNDEFINED_DRILL_DIAMETER
Definition: pcb_track.h:73
PCB_LAYER_ID start
Definition: padstack.h:222
PCB_LAYER_ID end
Definition: padstack.h:223
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
Definition: padstack.h:220
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
Definition: pcb_track.cpp:1585
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
@ PCB_LOCATE_BBVIA_T
Definition: typeinfo.h:125
@ PCB_LOCATE_STDVIA_T
Definition: typeinfo.h:123
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
@ PCB_LOCATE_UVIA_T
Definition: typeinfo.h:124
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96