KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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, jaen-pierre.charras@gipsa-lab.inpg.com
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
209 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
210 int aError, ERROR_LOC aErrorLoc,
211 bool ignoreLineWidth = false ) const override;
212
213 // @copydoc BOARD_ITEM::GetEffectiveShape
214 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
215 FLASHING aFlash = FLASHING::DEFAULT ) const override;
216
224 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
225
229 bool IsNull() const
230 {
231 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
232 }
233
234 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
235 wxString GetFriendlyName() const override;
236
237 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
238 const std::vector<KICAD_T>& aScanTypes ) override;
239
240 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
241 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
242
243 bool ApproxCollinear( const PCB_TRACK& aTrack );
244
245 wxString GetClass() const override
246 {
247 return wxT( "PCB_TRACK" );
248 }
249
250 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
251
252 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
253
254 BITMAPS GetMenuImage() const override;
255
256 virtual EDA_ITEM* Clone() const override;
257
258 virtual std::vector<int> ViewGetLayers() const override;
259
260 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
261
262 const BOX2I ViewBBox() const override;
263
267 bool IsOnCopperLayer() const override
268 {
269 return true;
270 }
271
272 virtual double Similarity( const BOARD_ITEM& aOther ) const override;
273
274 virtual bool operator==( const BOARD_ITEM& aOther ) const override;
275 virtual bool operator==( const PCB_TRACK& aOther ) const;
276
278 {
279 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
280 };
281
282 void Serialize( google::protobuf::Any &aContainer ) const override;
283 bool Deserialize( const google::protobuf::Any &aContainer ) override;
284
285#if defined (DEBUG)
286 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
287#endif
288
289protected:
290 virtual void swapData( BOARD_ITEM* aImage ) override;
291
293 std::vector<MSG_PANEL_ITEM>& aList ) const;
294
295protected:
298
300 std::optional<int> m_solderMaskMargin;
301
302private:
304};
305
306
307class PCB_ARC : public PCB_TRACK
308{
309public:
310 PCB_ARC( BOARD_ITEM* aParent ) :
311 PCB_TRACK( aParent, PCB_ARC_T )
312 { }
313
314 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
315
316 void CopyFrom( const BOARD_ITEM* aOther ) override;
317
318 static inline bool ClassOf( const EDA_ITEM *aItem )
319 {
320 return aItem && PCB_ARC_T == aItem->Type();
321 }
322
323 virtual void Move( const VECTOR2I& aMoveVector ) override
324 {
325 m_Start += aMoveVector;
326 m_Mid += aMoveVector;
327 m_End += aMoveVector;
328 }
329
330 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
331
332 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
333
334 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
335
336 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
337 const VECTOR2I& GetMid() const { return m_Mid; }
338
339 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
340
341 virtual VECTOR2I GetPosition() const override;
342 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
343
344 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
345
346 double GetRadius() const;
347 EDA_ANGLE GetAngle() const;
349 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
350 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
351
352 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
353 int aAccuracy = 0 ) const override;
354
355 bool IsCCW() const;
356
357 wxString GetClass() const override
358 {
359 return wxT( "PCB_ARC" );
360 }
361
362 // @copydoc BOARD_ITEM::GetEffectiveShape
363 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
364 FLASHING aFlash = FLASHING::DEFAULT ) const override;
365
371 virtual double GetLength() const override
372 {
373 return GetRadius() * std::abs( GetAngle().AsRadians() );
374 }
375
376 EDA_ITEM* Clone() const override;
377
384 bool IsDegenerated( int aThreshold = 5 ) const;
385
386 double Similarity( const BOARD_ITEM& aOther ) const override;
387
388 bool operator==( const PCB_ARC& aOther ) const;
389 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
390
391 void Serialize( google::protobuf::Any &aContainer ) const override;
392 bool Deserialize( const google::protobuf::Any &aContainer ) override;
393
394protected:
395 virtual void swapData( BOARD_ITEM* aImage ) override;
396
397private:
398 // Silence GCC warning about overriding the base class method
399 bool operator==( const PCB_TRACK& aOther ) const override;
400
402};
403
404
405class PCB_VIA : public PCB_TRACK
406{
407public:
408 PCB_VIA( BOARD_ITEM* aParent );
409
410 static inline bool ClassOf( const EDA_ITEM *aItem )
411 {
412 return aItem && PCB_VIA_T == aItem->Type();
413 }
414
415 PCB_VIA( const PCB_VIA& aOther );
416 PCB_VIA& operator=( const PCB_VIA &aOther );
417
418 void CopyFrom( const BOARD_ITEM* aOther ) override;
419
420 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
421 {
422 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
423 return true;
424
425 for( KICAD_T scanType : aScanTypes )
426 {
427 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
428 return true;
429 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
430 return true;
431 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
432 return true;
433 }
434
435 return false;
436 }
437
441 bool HasValidLayerPair( int aCopperLayerCount );
442
443 VIATYPE GetViaType() const { return m_viaType; }
444 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
445
446 const PADSTACK& Padstack() const { return m_padStack; }
448 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
449
450 const BOX2I GetBoundingBox() const override;
451
452 void SetWidth( int aWidth ) override;
453 int GetWidth() const override;
454
455 void SetWidth( PCB_LAYER_ID aLayer, int aWidth );
456 int GetWidth( PCB_LAYER_ID aLayer ) const;
457
458 // For properties panel
459 void SetFrontWidth( int aWidth ) { SetWidth( F_Cu, aWidth ); }
460 int GetFrontWidth() const { return GetWidth( F_Cu ); }
461
462 bool HasHole() const override
463 {
464 return true;
465 }
466
467 bool HasDrilledHole() const override
468 {
469 return m_viaType == VIATYPE::THROUGH || m_viaType == VIATYPE::BLIND_BURIED;
470 }
471
472 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
473
474 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
475 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
476
477 void SetFrontTentingMode( TENTING_MODE aMode );
479 void SetBackTentingMode( TENTING_MODE aMode );
481
486
491
492 void SetCappingMode( CAPPING_MODE aMode );
494
495 void SetFillingMode( FILLING_MODE aMode );
497
498 bool IsTented( PCB_LAYER_ID aLayer ) const override;
499 int GetSolderMaskExpansion() const;
500
501 PCB_LAYER_ID GetLayer() const override;
502 void SetLayer( PCB_LAYER_ID aLayer ) override;
503
504 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
505
506 virtual LSET GetLayerSet() const override;
507
512 virtual void SetLayerSet( const LSET& aLayers ) override;
513
520 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
521
522 void SetBottomLayer( PCB_LAYER_ID aLayer );
523 void SetTopLayer( PCB_LAYER_ID aLayer );
524
532 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
533
534 PCB_LAYER_ID TopLayer() const;
536
541 void SanitizeLayers();
542
543 VECTOR2I GetPosition() const override { return m_Start; }
544 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
545
546 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
547
548 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
549 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
550
551 wxString GetClass() const override
552 {
553 return wxT( "PCB_VIA" );
554 }
555
556 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
557
558 BITMAPS GetMenuImage() const override;
559
560 EDA_ITEM* Clone() const override;
561
562 std::vector<int> ViewGetLayers() const override;
563
564 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
565
566 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
567
568#if defined (DEBUG)
569 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
570#endif
571
572 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
573
579 void SetRemoveUnconnected( bool aSet )
580 {
584 }
585
587 {
589 }
590
595 void SetKeepStartEnd( bool aSet )
596 {
600 }
601
602 bool GetKeepStartEnd() const
603 {
606 }
607
609 {
611 {
613 return false;
614
616 return true;
617
619 {
620 if( aLayer == m_padStack.Drill().start || aLayer == m_padStack.Drill().end )
621 return false;
622 }
623 }
624
625 return true;
626 }
627
634 bool FlashLayer( int aLayer ) const;
635
643 bool FlashLayer( const LSET& aLayers ) const;
644
651 PCB_LAYER_ID* aBottommost ) const;
652
658 void SetDrill( int aDrill )
659 {
660 m_padStack.Drill().size = { aDrill, aDrill };
661 }
662
668 int GetDrill() const { return m_padStack.Drill().size.x; }
669
675 int GetDrillValue() const;
676
681 {
683 }
684
692 bool GetIsFree() const { return m_isFree; }
693 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
694
695 // @copydoc BOARD_ITEM::GetEffectiveShape
696 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
697 FLASHING aFlash = FLASHING::DEFAULT ) const override;
698
700
702
703 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
704
705 double Similarity( const BOARD_ITEM& aOther ) const override;
706
707 bool operator==( const PCB_VIA& aOther ) const;
708 bool operator==( const BOARD_ITEM& aOther ) const override;
709
710 void Serialize( google::protobuf::Any &aContainer ) const override;
711 bool Deserialize( const google::protobuf::Any &aContainer ) override;
712
713protected:
714 void swapData( BOARD_ITEM* aImage ) override;
715
716 wxString layerMaskDescribe() const override;
717
718private:
719 // Silence GCC warning about hiding the PCB_TRACK base method
720 bool operator==( const PCB_TRACK& aOther ) const override;
721
723
725
726 bool m_isFree;
727
729 std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE> m_zoneLayerOverrides;
730};
731
732
733#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:66
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:78
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:95
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:107
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:180
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
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:124
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
Definition: padstack.h:313
UNCONNECTED_LAYER_MODE UnconnectedLayerMode() const
Definition: padstack.h:312
DRILL_PROPS & Drill()
Definition: padstack.h:306
Definition: pad.h:54
virtual VECTOR2I GetPosition() const override
Definition: pcb_track.cpp:2026
bool IsDegenerated(int aThreshold=5) const
Definition: pcb_track.cpp:2068
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:2011
bool IsCCW() const
Definition: pcb_track.cpp:823
virtual double GetLength() const override
Return the length of the arc track.
Definition: pcb_track.h:371
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:441
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:90
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_track.cpp:804
EDA_ANGLE GetArcAngleStart() const
Definition: pcb_track.cpp:2050
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:779
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:1874
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:2060
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:342
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:339
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:323
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:357
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:464
void SetMid(const VECTOR2I &aMid)
Definition: pcb_track.h:336
double GetRadius() const
Definition: pcb_track.cpp:2033
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:2040
const VECTOR2I & GetMid() const
Definition: pcb_track.h:337
PCB_ARC(BOARD_ITEM *aParent)
Definition: pcb_track.h:310
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:274
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition: pcb_track.h:401
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:318
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:764
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:2141
bool operator==(const PCB_ARC &aOther) const
Definition: pcb_track.cpp:262
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_track.h:344
void CopyFrom(const BOARD_ITEM *aOther) override
Definition: pcb_track.cpp:96
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:1206
virtual void SetLayerSet(const LSET &aLayers) override
Definition: pcb_track.cpp:1193
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:1097
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:757
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:400
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:267
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:245
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:751
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1522
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:2004
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:1581
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:1989
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:772
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:421
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:858
bool ApproxCollinear(const PCB_TRACK &aTrack)
Definition: pcb_track.cpp:541
VECTOR2I m_End
Line end point.
Definition: pcb_track.h:297
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: pcb_track.h:178
std::optional< int > m_solderMaskMargin
Definition: pcb_track.h:300
void CopyFrom(const BOARD_ITEM *aOther) override
Definition: pcb_track.cpp:74
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:141
std::optional< int > GetLocalSolderMaskMargin() const
Definition: pcb_track.h:179
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:1731
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:68
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:681
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:2157
const VECTOR2I & GetStart() const
Definition: pcb_track.h:152
virtual bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:187
VECTOR2I m_Start
Line start point.
Definition: pcb_track.h:296
int GetEndY() const
Definition: pcb_track.h:164
wxString GetFriendlyName() const override
Definition: pcb_track.cpp:1719
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:1495
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:1999
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:1868
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:787
bool IsNull() const
Return true if segment length is zero.
Definition: pcb_track.h:229
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:209
bool m_hasSolderMask
Definition: pcb_track.h:299
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:2098
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:1118
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:549
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:303
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:649
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:1833
void SetRemoveUnconnected(bool aSet)
Definition: pcb_track.h:579
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:692
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:1349
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:181
PLUGGING_MODE GetFrontPluggingMode() const
Definition: pcb_track.cpp:983
VECTOR2I GetPosition() const override
Definition: pcb_track.h:543
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:1065
void CopyFrom(const BOARD_ITEM *aOther) override
Definition: pcb_track.cpp:153
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:2109
void SetCappingMode(CAPPING_MODE aMode)
Definition: pcb_track.cpp:1018
void SetFrontCoveringMode(COVERING_MODE aMode)
Definition: pcb_track.cpp:926
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:513
COVERING_MODE GetBackCoveringMode() const
Definition: pcb_track.cpp:960
bool GetRemoveUnconnected() const
Definition: pcb_track.h:586
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:1385
void SetKeepStartEnd(bool aSet)
Definition: pcb_track.h:595
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:680
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
Definition: pcb_track.h:729
void ClearZoneLayerOverrides()
Definition: pcb_track.cpp:1437
CAPPING_MODE GetCappingMode() const
Definition: pcb_track.cpp:1029
const PADSTACK & Padstack() const
Definition: pcb_track.h:446
void SetFrontTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:880
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition: pcb_track.h:668
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:726
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:1909
TENTING_MODE GetFrontTentingMode() const
Definition: pcb_track.cpp:891
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1315
PADSTACK & Padstack()
Definition: pcb_track.h:447
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:1088
void SetDrill(int aDrill)
Set the drill value for vias.
Definition: pcb_track.h:658
PLUGGING_MODE GetBackPluggingMode() const
Definition: pcb_track.cpp:1006
void SetBackPluggingMode(PLUGGING_MODE aMode)
Definition: pcb_track.cpp:995
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:585
void SetBackTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:903
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:693
void SetFrontPluggingMode(PLUGGING_MODE aMode)
Definition: pcb_track.cpp:972
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_track.cpp:833
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:1796
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:160
bool operator==(const PCB_VIA &aOther) const
Definition: pcb_track.cpp:330
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_track.cpp:1181
std::mutex m_zoneLayerOverridesMutex
Definition: pcb_track.h:728
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1309
FILLING_MODE GetFillingMode() const
Definition: pcb_track.cpp:1052
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:544
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:874
int GetFrontWidth() const
Definition: pcb_track.h:460
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:1300
bool HasDrilledHole() const override
Definition: pcb_track.h:467
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:166
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pcb_track.h:420
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:341
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_track.cpp:1187
bool GetKeepStartEnd() const
Definition: pcb_track.h:602
virtual void SetLayerSet(const LSET &aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
Definition: pcb_track.cpp:1258
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
Definition: pcb_track.cpp:1461
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:410
bool HasHole() const override
Definition: pcb_track.h:462
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:1355
int GetWidth() const override
Definition: pcb_track.cpp:380
PCB_VIA & operator=(const PCB_VIA &aOther)
Definition: pcb_track.cpp:138
void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:2018
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:551
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:485
void SetFillingMode(FILLING_MODE aMode)
Definition: pcb_track.cpp:1041
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:608
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:1856
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1594
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:444
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
Definition: pcb_track.cpp:603
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:1136
TENTING_MODE GetBackTentingMode() const
Definition: pcb_track.cpp:914
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:1343
VIATYPE m_viaType
through, blind/buried or micro
Definition: pcb_track.h:722
PADSTACK m_padStack
Definition: pcb_track.h:724
COVERING_MODE GetFrontCoveringMode() const
Definition: pcb_track.cpp:937
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
Definition: pcb_track.cpp:634
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition: pcb_track.cpp:1454
void SetFrontWidth(int aWidth)
Definition: pcb_track.h:459
VIATYPE GetViaType() const
Definition: pcb_track.h:443
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1639
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
Definition: pcb_track.cpp:567
void SetWidth(int aWidth) override
Definition: pcb_track.cpp:372
void SetBackCoveringMode(COVERING_MODE aMode)
Definition: pcb_track.cpp:949
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:1222
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition: pcb_track.cpp:1446
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:1321
bool HasValidLayerPair(int aCopperLayerCount)
Definition: pcb_track.cpp:1159
void SetPadstack(const PADSTACK &aPadstack)
Definition: pcb_track.h:448
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:726
Represent a set of closed polygons.
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition: eda_item.h:88
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:390
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:245
PCB_LAYER_ID end
Definition: padstack.h:246
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
Definition: padstack.h:243
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
Definition: pcb_track.cpp:2080
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