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 The 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 <lset.h>
47#include <padstack.h>
48
49class PCB_TRACK;
50class PCB_VIA;
51class PAD;
52class MSG_PANEL_ITEM;
53class SHAPE_POLY_SET;
54class SHAPE_ARC;
55
56
57// Flag used in locate routines (from which endpoint work)
58enum ENDPOINT_T : int
59{
61 ENDPOINT_END = 1
62};
63
64// Note that this enum must be synchronized to GAL_LAYER_ID
65enum class VIATYPE : int
66{
67 THROUGH = 3, /* Always a through hole via */
68 BLIND_BURIED = 2, /* this via can be on internal layers */
69 MICROVIA = 1, /* this via which connect from an external layer
70 * to the near neighbor internal layer */
71 NOT_DEFINED = 0 /* not yet used */
72};
73
74enum class TENTING_MODE
75{
76 FROM_RULES = 0,
77 TENTED = 1,
78 NOT_TENTED = 2
79};
80
81enum class COVERING_MODE
82{
83 FROM_RULES = 0,
84 COVERED = 1,
85 NOT_COVERED = 2
86};
87
88enum class PLUGGING_MODE
89{
90 FROM_RULES = 0,
91 PLUGGED = 1,
92 NOT_PLUGGED = 2
93};
94
95enum class CAPPING_MODE
96{
97 FROM_RULES = 0,
98 CAPPED = 1,
99 NOT_CAPPED = 2
100};
101
102enum class FILLING_MODE
103{
104 FROM_RULES = 0,
105 FILLED = 1,
106 NOT_FILLED = 2
107};
108
109#define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter.
110
111// Used for tracks and vias for algorithmic safety, not to enforce constraints
112#define GEOMETRY_MIN_SIZE (int) ( 0.001 * pcbIUScale.IU_PER_MM )
113
114
116{
117public:
118 static inline bool ClassOf( const EDA_ITEM* aItem )
119 {
120 return aItem && PCB_TRACE_T == aItem->Type();
121 }
122
123 PCB_TRACK( BOARD_ITEM* aParent, KICAD_T idtype = PCB_TRACE_T );
124
125 // Do not create a copy constructor. The one generated by the compiler is adequate.
126
127 void CopyFrom( const BOARD_ITEM* aOther ) override;
128
129 void Move( const VECTOR2I& aMoveVector ) override
130 {
131 m_Start += aMoveVector;
132 m_End += aMoveVector;
133 }
134
135 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
136
137 virtual void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
138
139 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
140
141 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
142 VECTOR2I GetPosition() const override { return m_Start; }
143 const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; }
144
145 virtual void SetWidth( int aWidth ) { m_width = aWidth; }
146 virtual int GetWidth() const { return m_width; }
147
148 void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; }
149 const VECTOR2I& GetEnd() const { return m_End; }
150
151 void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; }
152 const VECTOR2I& GetStart() const { return m_Start; }
153
154 void SetStartX( int aX ) { m_Start.x = aX; }
155 void SetStartY( int aY ) { m_Start.y = aY; }
156
157 int GetStartX() const { return m_Start.x; }
158 int GetStartY() const { return m_Start.y; }
159
160 void SetEndX( int aX ) { m_End.x = aX; }
161 void SetEndY( int aY ) { m_End.y = aY; }
162
163 int GetEndX() const { return m_End.x; }
164 int GetEndY() const { return m_End.y; }
165
167 const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
168 {
169 if( aEndPoint == ENDPOINT_START )
170 return m_Start;
171 else
172 return m_End;
173 }
174
175 void SetHasSolderMask( bool aVal ) { m_hasSolderMask = aVal; }
176 bool HasSolderMask() const { return m_hasSolderMask; }
177
178 void SetLocalSolderMaskMargin( std::optional<int> aMargin ) { m_solderMaskMargin = aMargin; }
179 std::optional<int> GetLocalSolderMaskMargin() const { return m_solderMaskMargin; }
180
181 int GetSolderMaskExpansion() const;
182
183 // Virtual function
184 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
185
186 virtual LSET GetLayerSet() const override;
187 virtual void SetLayerSet( const LSET& aLayers ) override;
188
189 const BOX2I GetBoundingBox() const override;
190
196 virtual double GetLength() const;
197
203 virtual double GetDelay() const;
204
216 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
217 int aError, ERROR_LOC aErrorLoc,
218 bool ignoreLineWidth = false ) const override;
219
220 // @copydoc BOARD_ITEM::GetEffectiveShape
221 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
222 FLASHING aFlash = FLASHING::DEFAULT ) const override;
223
231 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
232
236 bool IsNull() const
237 {
238 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
239 }
240
241 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
242 wxString GetFriendlyName() const override;
243
244 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
245 const std::vector<KICAD_T>& aScanTypes ) override;
246
247 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
248 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
249 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
250
251 bool ApproxCollinear( const PCB_TRACK& aTrack );
252
253 wxString GetClass() const override
254 {
255 return wxT( "PCB_TRACK" );
256 }
257
258 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
259
260 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
261
262 BITMAPS GetMenuImage() const override;
263
264 virtual EDA_ITEM* Clone() const override;
265
266 virtual std::vector<int> ViewGetLayers() const override;
267
268 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
269
270 const BOX2I ViewBBox() const override;
271
275 bool IsOnCopperLayer() const override
276 {
277 return true;
278 }
279
280 virtual double Similarity( const BOARD_ITEM& aOther ) const override;
281
282 virtual bool operator==( const BOARD_ITEM& aOther ) const override;
283 virtual bool operator==( const PCB_TRACK& aOther ) const;
284
286 {
287 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
288 };
289
290 void Serialize( google::protobuf::Any &aContainer ) const override;
291 bool Deserialize( const google::protobuf::Any &aContainer ) override;
292
293#if defined (DEBUG)
294 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
295#endif
296
297protected:
298 virtual void swapData( BOARD_ITEM* aImage ) override;
299
301 std::vector<MSG_PANEL_ITEM>& aList ) const;
302
303protected:
306
308 std::optional<int> m_solderMaskMargin;
309
310private:
312};
313
314
315class PCB_ARC : public PCB_TRACK
316{
317public:
318 PCB_ARC( BOARD_ITEM* aParent ) :
319 PCB_TRACK( aParent, PCB_ARC_T )
320 { }
321
322 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
323
324 void CopyFrom( const BOARD_ITEM* aOther ) override;
325
326 static inline bool ClassOf( const EDA_ITEM *aItem )
327 {
328 return aItem && PCB_ARC_T == aItem->Type();
329 }
330
331 virtual void Move( const VECTOR2I& aMoveVector ) override
332 {
333 m_Start += aMoveVector;
334 m_Mid += aMoveVector;
335 m_End += aMoveVector;
336 }
337
338 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
339
340 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
341
342 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
343
344 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
345 const VECTOR2I& GetMid() const { return m_Mid; }
346
347 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
348
349 virtual VECTOR2I GetPosition() const override;
350 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
351
352 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
353
354 double GetRadius() const;
355 EDA_ANGLE GetAngle() const;
357 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
358 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
359
360 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
361 int aAccuracy = 0 ) const override;
362
363 bool IsCCW() const;
364
365 wxString GetClass() const override
366 {
367 return wxT( "PCB_ARC" );
368 }
369
370 // @copydoc BOARD_ITEM::GetEffectiveShape
371 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
372 FLASHING aFlash = FLASHING::DEFAULT ) const override;
373
379 virtual double GetLength() const override
380 {
381 return GetRadius() * std::abs( GetAngle().AsRadians() );
382 }
383
384 EDA_ITEM* Clone() const override;
385
392 bool IsDegenerated( int aThreshold = 5 ) const;
393
394 double Similarity( const BOARD_ITEM& aOther ) const override;
395
396 bool operator==( const PCB_ARC& aOther ) const;
397 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
398
399 void Serialize( google::protobuf::Any &aContainer ) const override;
400 bool Deserialize( const google::protobuf::Any &aContainer ) override;
401
402protected:
403 virtual void swapData( BOARD_ITEM* aImage ) override;
404
405private:
406 // Silence GCC warning about overriding the base class method
407 bool operator==( const PCB_TRACK& aOther ) const override;
408
410};
411
412
413class PCB_VIA : public PCB_TRACK
414{
415public:
416 PCB_VIA( BOARD_ITEM* aParent );
417
418 static inline bool ClassOf( const EDA_ITEM *aItem )
419 {
420 return aItem && PCB_VIA_T == aItem->Type();
421 }
422
423 PCB_VIA( const PCB_VIA& aOther );
424 PCB_VIA& operator=( const PCB_VIA &aOther );
425
426 void CopyFrom( const BOARD_ITEM* aOther ) override;
427
428 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
429 {
430 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
431 return true;
432
433 for( KICAD_T scanType : aScanTypes )
434 {
435 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
436 return true;
437 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
438 return true;
439 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
440 return true;
441 }
442
443 return false;
444 }
445
449 bool HasValidLayerPair( int aCopperLayerCount );
450
451 VIATYPE GetViaType() const { return m_viaType; }
452 void SetViaType( VIATYPE aViaType )
453 {
454 m_viaType = aViaType;
455 // If someone updates a VIA to TH, we want to kick out any non-outer layers
457 }
458
459 const PADSTACK& Padstack() const { return m_padStack; }
461 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
462
463 const BOX2I GetBoundingBox() const override;
464 const BOX2I GetBoundingBox( PCB_LAYER_ID aLayer ) const;
465
466 void SetWidth( int aWidth ) override;
467 int GetWidth() const override;
468
469 void SetWidth( PCB_LAYER_ID aLayer, int aWidth );
470 int GetWidth( PCB_LAYER_ID aLayer ) const;
471
472 // For properties panel
473 void SetFrontWidth( int aWidth ) { SetWidth( F_Cu, aWidth ); }
474 int GetFrontWidth() const { return GetWidth( F_Cu ); }
475
476 bool HasHole() const override
477 {
478 return true;
479 }
480
481 bool HasDrilledHole() const override
482 {
483 return m_viaType == VIATYPE::THROUGH || m_viaType == VIATYPE::BLIND_BURIED;
484 }
485
486 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
487
488 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
489 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
490
491 void SetFrontTentingMode( TENTING_MODE aMode );
493 void SetBackTentingMode( TENTING_MODE aMode );
495
500
505
506 void SetCappingMode( CAPPING_MODE aMode );
508
509 void SetFillingMode( FILLING_MODE aMode );
511
512 bool IsTented( PCB_LAYER_ID aLayer ) const override;
513 int GetSolderMaskExpansion() const;
514
515 PCB_LAYER_ID GetLayer() const override;
516 void SetLayer( PCB_LAYER_ID aLayer ) override;
517
518 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
519
520 virtual LSET GetLayerSet() const override;
521
526 virtual void SetLayerSet( const LSET& aLayers ) override;
527
534 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
535
536 void SetBottomLayer( PCB_LAYER_ID aLayer );
537 void SetTopLayer( PCB_LAYER_ID aLayer );
538
546 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
547
548 PCB_LAYER_ID TopLayer() const;
550
555 void SanitizeLayers();
556
557 VECTOR2I GetPosition() const override { return m_Start; }
558 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
559
560 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
561
562 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
563 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
564
565 wxString GetClass() const override
566 {
567 return wxT( "PCB_VIA" );
568 }
569
570 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
571
572 BITMAPS GetMenuImage() const override;
573
574 EDA_ITEM* Clone() const override;
575
576 std::vector<int> ViewGetLayers() const override;
577
578 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
579
580 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
581
582#if defined (DEBUG)
583 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
584#endif
585
586 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
587
593 void SetRemoveUnconnected( bool aSet )
594 {
598 }
599
601 {
603 }
604
609 void SetKeepStartEnd( bool aSet )
610 {
614 }
615
616 bool GetKeepStartEnd() const
617 {
620 }
621
623 {
625 {
627 return false;
628
630 return true;
631
634 return aLayer != m_padStack.Drill().start && aLayer != m_padStack.Drill().end;
635 }
636
637 return true;
638 }
639
646 bool FlashLayer( int aLayer ) const;
647
655 bool FlashLayer( const LSET& aLayers ) const;
656
663 PCB_LAYER_ID* aBottommost ) const;
664
670 void SetDrill( int aDrill )
671 {
672 m_padStack.Drill().size = { aDrill, aDrill };
673 }
674
680 int GetDrill() const { return m_padStack.Drill().size.x; }
681
687 int GetDrillValue() const;
688
693 {
695 }
696
704 bool GetIsFree() const { return m_isFree; }
705 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
706
707 // @copydoc BOARD_ITEM::GetEffectiveShape
708 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
709 FLASHING aFlash = FLASHING::DEFAULT ) const override;
710
712
714
715 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
716
717 double Similarity( const BOARD_ITEM& aOther ) const override;
718
719 bool operator==( const PCB_VIA& aOther ) const;
720 bool operator==( const BOARD_ITEM& aOther ) const override;
721
722 void Serialize( google::protobuf::Any &aContainer ) const override;
723 bool Deserialize( const google::protobuf::Any &aContainer ) override;
724
725protected:
726 void swapData( BOARD_ITEM* aImage ) override;
727
728 wxString layerMaskDescribe() const override;
729
730private:
731 // Silence GCC warning about hiding the PCB_TRACK base method
732 bool operator==( const PCB_TRACK& aOther ) const override;
733
735
737
738 bool m_isFree;
739
741 std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE> m_zoneLayerOverrides;
742};
743
744
745#endif // CLASS_TRACK_H
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
Definition: approximation.h:32
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:67
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:79
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:98
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:110
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:192
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:66
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:37
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:125
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
Definition: padstack.h:315
UNCONNECTED_LAYER_MODE UnconnectedLayerMode() const
Definition: padstack.h:314
DRILL_PROPS & Drill()
Definition: padstack.h:308
Definition: pad.h:54
virtual VECTOR2I GetPosition() const override
Definition: pcb_track.cpp:2134
bool IsDegenerated(int aThreshold=5) const
Definition: pcb_track.cpp:2176
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:2119
bool IsCCW() const
Definition: pcb_track.cpp:855
virtual double GetLength() const override
Return the length of the arc track.
Definition: pcb_track.h:379
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:437
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:91
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_track.cpp:836
EDA_ANGLE GetArcAngleStart() const
Definition: pcb_track.cpp:2158
void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
Definition: pcb_track.cpp:811
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:1976
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:2168
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:350
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:347
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:331
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:365
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:459
void SetMid(const VECTOR2I &aMid)
Definition: pcb_track.h:344
double GetRadius() const
Definition: pcb_track.cpp:2141
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:2148
const VECTOR2I & GetMid() const
Definition: pcb_track.h:345
PCB_ARC(BOARD_ITEM *aParent)
Definition: pcb_track.h:318
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:275
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition: pcb_track.h:409
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:326
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:796
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:2253
bool operator==(const PCB_ARC &aOther) const
Definition: pcb_track.cpp:263
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_track.h:352
void CopyFrom(const BOARD_ITEM *aOther) override
Definition: pcb_track.cpp:97
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:1243
virtual void SetLayerSet(const LSET &aLayers) override
Definition: pcb_track.cpp:1230
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:1129
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:789
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:397
void SetEndY(int aY)
Definition: pcb_track.h:161
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:143
bool IsOnCopperLayer() const override
Definition: pcb_track.h:275
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:129
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:253
void SetHasSolderMask(bool aVal)
Definition: pcb_track.h:175
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
Definition: pcb_track.cpp:764
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1566
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:2112
void SetEnd(const VECTOR2I &aEnd)
Definition: pcb_track.h:148
bool HasSolderMask() const
Definition: pcb_track.h:176
void SetStart(const VECTOR2I &aStart)
Definition: pcb_track.h:151
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pcb_track.cpp:1625
int GetStartY() const
Definition: pcb_track.h:158
int GetEndX() const
Definition: pcb_track.h:163
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:2097
virtual void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
Definition: pcb_track.cpp:804
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:417
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:890
bool ApproxCollinear(const PCB_TRACK &aTrack)
Definition: pcb_track.cpp:535
VECTOR2I m_End
Line end point.
Definition: pcb_track.h:305
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: pcb_track.h:178
std::optional< int > m_solderMaskMargin
Definition: pcb_track.h:308
void CopyFrom(const BOARD_ITEM *aOther) override
Definition: pcb_track.cpp:75
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:141
std::optional< int > GetLocalSolderMaskMargin() const
Definition: pcb_track.h:179
virtual double GetDelay() const
Get the time delay of the track.
Definition: pcb_track.cpp:770
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:1803
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:69
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:675
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:2269
const VECTOR2I & GetStart() const
Definition: pcb_track.h:152
virtual bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:188
VECTOR2I m_Start
Line start point.
Definition: pcb_track.h:304
int GetEndY() const
Definition: pcb_track.h:164
wxString GetFriendlyName() const override
Definition: pcb_track.cpp:1791
VECTOR2I GetPosition() const override
Definition: pcb_track.h:142
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1539
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:2107
const VECTOR2I & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: pcb_track.h:167
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:1970
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:118
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_track.cpp:819
bool IsNull() const
Return true if segment length is zero.
Definition: pcb_track.h:236
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:210
bool m_hasSolderMask
Definition: pcb_track.h:307
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:2210
void SetStartX(int aX)
Definition: pcb_track.h:154
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:149
void SetStartY(int aY)
Definition: pcb_track.h:155
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:1156
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:543
void SetEndX(int aX)
Definition: pcb_track.h:160
int GetStartX() const
Definition: pcb_track.h:157
int m_width
Thickness of track (or arc) – no longer the width of a via.
Definition: pcb_track.h:311
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:643
virtual void SetWidth(int aWidth)
Definition: pcb_track.h:145
virtual int GetWidth() const
Definition: pcb_track.h:146
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
Definition: pcb_track.cpp:1935
void SetRemoveUnconnected(bool aSet)
Definition: pcb_track.h:593
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:704
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:1395
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:182
PLUGGING_MODE GetFrontPluggingMode() const
Definition: pcb_track.cpp:1015
VECTOR2I GetPosition() const override
Definition: pcb_track.h:557
bool IsTented(PCB_LAYER_ID aLayer) const override
Checks if the given object is tented (its copper shape is covered by solder mask) on a given side of ...
Definition: pcb_track.cpp:1097
void CopyFrom(const BOARD_ITEM *aOther) override
Definition: pcb_track.cpp:154
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:2221
void SetCappingMode(CAPPING_MODE aMode)
Definition: pcb_track.cpp:1050
void SetFrontCoveringMode(COVERING_MODE aMode)
Definition: pcb_track.cpp:958
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:507
COVERING_MODE GetBackCoveringMode() const
Definition: pcb_track.cpp:992
bool GetRemoveUnconnected() const
Definition: pcb_track.h:600
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:1426
void SetKeepStartEnd(bool aSet)
Definition: pcb_track.h:609
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:692
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
Definition: pcb_track.h:741
void ClearZoneLayerOverrides()
Definition: pcb_track.cpp:1481
CAPPING_MODE GetCappingMode() const
Definition: pcb_track.cpp:1061
const PADSTACK & Padstack() const
Definition: pcb_track.h:459
void SetFrontTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:912
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition: pcb_track.h:680
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:738
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:2011
TENTING_MODE GetFrontTentingMode() const
Definition: pcb_track.cpp:923
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1356
PADSTACK & Padstack()
Definition: pcb_track.h:460
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:1120
void SetDrill(int aDrill)
Set the drill value for vias.
Definition: pcb_track.h:670
PLUGGING_MODE GetBackPluggingMode() const
Definition: pcb_track.cpp:1038
void SetBackPluggingMode(PLUGGING_MODE aMode)
Definition: pcb_track.cpp:1027
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:579
void SetBackTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:935
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:705
void SetFrontPluggingMode(PLUGGING_MODE aMode)
Definition: pcb_track.cpp:1004
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_track.cpp:865
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:1898
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:161
bool operator==(const PCB_VIA &aOther) const
Definition: pcb_track.cpp:331
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_track.cpp:1218
std::mutex m_zoneLayerOverridesMutex
Definition: pcb_track.h:740
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1345
FILLING_MODE GetFillingMode() const
Definition: pcb_track.cpp:1084
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:558
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:906
int GetFrontWidth() const
Definition: pcb_track.h:474
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:1337
bool HasDrilledHole() const override
Definition: pcb_track.h:481
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:167
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pcb_track.h:428
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:342
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_track.cpp:1224
bool GetKeepStartEnd() const
Definition: pcb_track.h:616
virtual void SetLayerSet(const LSET &aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
Definition: pcb_track.cpp:1295
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
Definition: pcb_track.cpp:1505
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:418
bool HasHole() const override
Definition: pcb_track.h:476
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:1401
int GetWidth() const override
Definition: pcb_track.cpp:379
PCB_VIA & operator=(const PCB_VIA &aOther)
Definition: pcb_track.cpp:139
void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:2126
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:565
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:480
void SetFillingMode(FILLING_MODE aMode)
Definition: pcb_track.cpp:1073
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:622
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:1958
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1638
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:452
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
Definition: pcb_track.cpp:597
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:1173
TENTING_MODE GetBackTentingMode() const
Definition: pcb_track.cpp:946
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:1389
VIATYPE m_viaType
through, blind/buried or micro
Definition: pcb_track.h:734
PADSTACK m_padStack
Definition: pcb_track.h:736
COVERING_MODE GetFrontCoveringMode() const
Definition: pcb_track.cpp:969
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
Definition: pcb_track.cpp:628
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition: pcb_track.cpp:1498
void SetFrontWidth(int aWidth)
Definition: pcb_track.h:473
VIATYPE GetViaType() const
Definition: pcb_track.h:451
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1683
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
Definition: pcb_track.cpp:561
void SetWidth(int aWidth) override
Definition: pcb_track.cpp:373
void SetBackCoveringMode(COVERING_MODE aMode)
Definition: pcb_track.cpp:981
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:1259
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition: pcb_track.cpp:1490
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:1367
bool HasValidLayerPair(int aCopperLayerCount)
Definition: pcb_track.cpp:1196
void SetPadstack(const PADSTACK &aPadstack)
Definition: pcb_track.h:461
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:720
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
INSPECT_RESULT
Definition: eda_item.h:44
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition: eda_item.h:91
std::uint32_t EDA_ITEM_FLAGS
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition: layer_ids.h:184
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
@ F_Cu
Definition: layer_ids.h:64
FLIP_DIRECTION
Definition: mirror.h:27
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:400
FILLING_MODE
Definition: pcb_track.h:103
VIATYPE
Definition: pcb_track.h:66
@ BLIND_BURIED
TENTING_MODE
Definition: pcb_track.h:75
COVERING_MODE
Definition: pcb_track.h:82
ENDPOINT_T
Definition: pcb_track.h:59
@ ENDPOINT_END
Definition: pcb_track.h:61
@ ENDPOINT_START
Definition: pcb_track.h:60
PLUGGING_MODE
Definition: pcb_track.h:89
#define UNDEFINED_DRILL_DIAMETER
Definition: pcb_track.h:109
CAPPING_MODE
Definition: pcb_track.h:96
PCB_LAYER_ID start
Definition: padstack.h:247
PCB_LAYER_ID end
Definition: padstack.h:248
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
Definition: padstack.h:245
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
Definition: pcb_track.cpp:2192
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:126
@ PCB_LOCATE_STDVIA_T
Definition: typeinfo.h:124
@ 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:125
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96