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 Move( const VECTOR2I& aMoveVector ) override
128 {
129 m_Start += aMoveVector;
130 m_End += aMoveVector;
131 }
132
133 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
134
135 virtual void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
136
137 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
138
139 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
140 VECTOR2I GetPosition() const override { return m_Start; }
141 const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; }
142
143 virtual void SetWidth( int aWidth ) { m_width = aWidth; }
144 virtual int GetWidth() const { return m_width; }
145
146 void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; }
147 const VECTOR2I& GetEnd() const { return m_End; }
148
149 void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; }
150 const VECTOR2I& GetStart() const { return m_Start; }
151
152 void SetStartX( int aX ) { m_Start.x = aX; }
153 void SetStartY( int aY ) { m_Start.y = aY; }
154
155 int GetStartX() const { return m_Start.x; }
156 int GetStartY() const { return m_Start.y; }
157
158 void SetEndX( int aX ) { m_End.x = aX; }
159 void SetEndY( int aY ) { m_End.y = aY; }
160
161 int GetEndX() const { return m_End.x; }
162 int GetEndY() const { return m_End.y; }
163
165 const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
166 {
167 if( aEndPoint == ENDPOINT_START )
168 return m_Start;
169 else
170 return m_End;
171 }
172
173 void SetHasSolderMask( bool aVal ) { m_hasSolderMask = aVal; }
174 bool HasSolderMask() const { return m_hasSolderMask; }
175
176 void SetLocalSolderMaskMargin( std::optional<int> aMargin ) { m_solderMaskMargin = aMargin; }
177 std::optional<int> GetLocalSolderMaskMargin() const { return m_solderMaskMargin; }
178
179 int GetSolderMaskExpansion() const;
180
181 // Virtual function
182 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
183
184 virtual LSET GetLayerSet() const override;
185 virtual void SetLayerSet( const LSET& aLayers ) override;
186
187 const BOX2I GetBoundingBox() const override;
188
194 virtual double GetLength() const;
195
207 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
208 int aError, ERROR_LOC aErrorLoc,
209 bool ignoreLineWidth = false ) const override;
210
211 // @copydoc BOARD_ITEM::GetEffectiveShape
212 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
213 FLASHING aFlash = FLASHING::DEFAULT ) const override;
214
222 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
223
227 bool IsNull() const
228 {
229 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
230 }
231
232 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
233 wxString GetFriendlyName() const override;
234
235 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
236 const std::vector<KICAD_T>& aScanTypes ) override;
237
238 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
239 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
240
241 bool ApproxCollinear( const PCB_TRACK& aTrack );
242
243 wxString GetClass() const override
244 {
245 return wxT( "PCB_TRACK" );
246 }
247
248 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
249
250 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
251
252 BITMAPS GetMenuImage() const override;
253
254 virtual EDA_ITEM* Clone() const override;
255
256 virtual std::vector<int> ViewGetLayers() const override;
257
258 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
259
260 const BOX2I ViewBBox() const override;
261
265 bool IsOnCopperLayer() const override
266 {
267 return true;
268 }
269
270 virtual double Similarity( const BOARD_ITEM& aOther ) const override;
271
272 virtual bool operator==( const BOARD_ITEM& aOther ) const override;
273 virtual bool operator==( const PCB_TRACK& aOther ) const;
274
276 {
277 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
278 };
279
280 void Serialize( google::protobuf::Any &aContainer ) const override;
281 bool Deserialize( const google::protobuf::Any &aContainer ) override;
282
283#if defined (DEBUG)
284 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
285#endif
286
287protected:
288 virtual void swapData( BOARD_ITEM* aImage ) override;
289
291 std::vector<MSG_PANEL_ITEM>& aList ) const;
292
293protected:
296
298 std::optional<int> m_solderMaskMargin;
299
300private:
302};
303
304
305class PCB_ARC : public PCB_TRACK
306{
307public:
308 PCB_ARC( BOARD_ITEM* aParent ) :
309 PCB_TRACK( aParent, PCB_ARC_T )
310 { }
311
312 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
313
314 static inline bool ClassOf( const EDA_ITEM *aItem )
315 {
316 return aItem && PCB_ARC_T == aItem->Type();
317 }
318
319 virtual void Move( const VECTOR2I& aMoveVector ) override
320 {
321 m_Start += aMoveVector;
322 m_Mid += aMoveVector;
323 m_End += aMoveVector;
324 }
325
326 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
327
328 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
329
330 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
331
332 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
333 const VECTOR2I& GetMid() const { return m_Mid; }
334
335 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
336
337 virtual VECTOR2I GetPosition() const override;
338 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
339
340 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
341
342 double GetRadius() const;
343 EDA_ANGLE GetAngle() const;
345 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
346 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
347
348 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
349 int aAccuracy = 0 ) const override;
350
351 bool IsCCW() const;
352
353 wxString GetClass() const override
354 {
355 return wxT( "PCB_ARC" );
356 }
357
358 // @copydoc BOARD_ITEM::GetEffectiveShape
359 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
360 FLASHING aFlash = FLASHING::DEFAULT ) const override;
361
367 virtual double GetLength() const override
368 {
369 return GetRadius() * std::abs( GetAngle().AsRadians() );
370 }
371
372 EDA_ITEM* Clone() const override;
373
380 bool IsDegenerated( int aThreshold = 5 ) const;
381
382 double Similarity( const BOARD_ITEM& aOther ) const override;
383
384 bool operator==( const PCB_ARC& aOther ) const;
385 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
386
387 void Serialize( google::protobuf::Any &aContainer ) const override;
388 bool Deserialize( const google::protobuf::Any &aContainer ) override;
389
390protected:
391 virtual void swapData( BOARD_ITEM* aImage ) override;
392
393private:
394 // Silence GCC warning about overriding the base class method
395 bool operator==( const PCB_TRACK& aOther ) const override;
396
398};
399
400
401class PCB_VIA : public PCB_TRACK
402{
403public:
404 PCB_VIA( BOARD_ITEM* aParent );
405
406 static inline bool ClassOf( const EDA_ITEM *aItem )
407 {
408 return aItem && PCB_VIA_T == aItem->Type();
409 }
410
411 PCB_VIA( const PCB_VIA& aOther );
412 PCB_VIA& operator=( const PCB_VIA &aOther );
413
414 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
415 {
416 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
417 return true;
418
419 for( KICAD_T scanType : aScanTypes )
420 {
421 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
422 return true;
423 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
424 return true;
425 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
426 return true;
427 }
428
429 return false;
430 }
431
435 bool HasValidLayerPair( int aCopperLayerCount );
436
437 VIATYPE GetViaType() const { return m_viaType; }
438 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
439
440 const PADSTACK& Padstack() const { return m_padStack; }
442 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
443
444 const BOX2I GetBoundingBox() const override;
445
446 void SetWidth( int aWidth ) override;
447 int GetWidth() const override;
448
449 void SetWidth( PCB_LAYER_ID aLayer, int aWidth );
450 int GetWidth( PCB_LAYER_ID aLayer ) const;
451
452 // For properties panel
453 void SetFrontWidth( int aWidth ) { SetWidth( F_Cu, aWidth ); }
454 int GetFrontWidth() const { return GetWidth( F_Cu ); }
455
456 bool HasHole() const override
457 {
458 return true;
459 }
460
461 bool HasDrilledHole() const override
462 {
463 return m_viaType == VIATYPE::THROUGH || m_viaType == VIATYPE::BLIND_BURIED;
464 }
465
466 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
467
468 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
469 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
470
471 void SetFrontTentingMode( TENTING_MODE aMode );
473 void SetBackTentingMode( TENTING_MODE aMode );
475
480
485
486 void SetCappingMode( CAPPING_MODE aMode );
488
489 void SetFillingMode( FILLING_MODE aMode );
491
492 bool IsTented( PCB_LAYER_ID aLayer ) const override;
493 int GetSolderMaskExpansion() const;
494
495 PCB_LAYER_ID GetLayer() const override;
496 void SetLayer( PCB_LAYER_ID aLayer ) override;
497
498 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
499
500 virtual LSET GetLayerSet() const override;
501
506 virtual void SetLayerSet( const LSET& aLayers ) override;
507
514 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
515
516 void SetBottomLayer( PCB_LAYER_ID aLayer );
517 void SetTopLayer( PCB_LAYER_ID aLayer );
518
526 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
527
528 PCB_LAYER_ID TopLayer() const;
530
535 void SanitizeLayers();
536
537 VECTOR2I GetPosition() const override { return m_Start; }
538 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
539
540 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
541
542 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
543 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
544
545 wxString GetClass() const override
546 {
547 return wxT( "PCB_VIA" );
548 }
549
550 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
551
552 BITMAPS GetMenuImage() const override;
553
554 EDA_ITEM* Clone() const override;
555
556 std::vector<int> ViewGetLayers() const override;
557
558 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
559
560 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
561
562#if defined (DEBUG)
563 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
564#endif
565
566 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
567
573 void SetRemoveUnconnected( bool aSet )
574 {
578 }
579
581 {
583 }
584
589 void SetKeepStartEnd( bool aSet )
590 {
594 }
595
596 bool GetKeepStartEnd() const
597 {
600 }
601
603 {
605 {
607 return false;
608
610 return true;
611
613 {
614 if( aLayer == m_padStack.Drill().start || aLayer == m_padStack.Drill().end )
615 return false;
616 }
617 }
618
619 return true;
620 }
621
628 bool FlashLayer( int aLayer ) const;
629
637 bool FlashLayer( LSET aLayers ) const;
638
645 PCB_LAYER_ID* aBottommost ) const;
646
652 void SetDrill( int aDrill )
653 {
654 m_padStack.Drill().size = { aDrill, aDrill };
655 }
656
662 int GetDrill() const { return m_padStack.Drill().size.x; }
663
669 int GetDrillValue() const;
670
675 {
677 }
678
686 bool GetIsFree() const { return m_isFree; }
687 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
688
689 // @copydoc BOARD_ITEM::GetEffectiveShape
690 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
691 FLASHING aFlash = FLASHING::DEFAULT ) const override;
692
694
696
697 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
698
699 double Similarity( const BOARD_ITEM& aOther ) const override;
700
701 bool operator==( const PCB_VIA& aOther ) const;
702 bool operator==( const BOARD_ITEM& aOther ) const override;
703
704 void Serialize( google::protobuf::Any &aContainer ) const override;
705 bool Deserialize( const google::protobuf::Any &aContainer ) override;
706
707protected:
708 void swapData( BOARD_ITEM* aImage ) override;
709
710 wxString layerMaskDescribe() const override;
711
712private:
713 // Silence GCC warning about hiding the PCB_TRACK base method
714 bool operator==( const PCB_TRACK& aOther ) const override;
715
717
719
720 bool m_isFree;
721
723 std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE> m_zoneLayerOverrides;
724};
725
726
727#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: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:89
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:174
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:2000
bool IsDegenerated(int aThreshold=5) const
Definition: pcb_track.cpp:2042
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1985
bool IsCCW() const
Definition: pcb_track.cpp:802
virtual double GetLength() const override
Return the length of the arc track.
Definition: pcb_track.h:367
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:420
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:83
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_track.cpp:783
EDA_ANGLE GetArcAngleStart() const
Definition: pcb_track.cpp:2024
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:758
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:1848
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:2034
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:338
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:335
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:319
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:353
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:443
void SetMid(const VECTOR2I &aMid)
Definition: pcb_track.h:332
double GetRadius() const
Definition: pcb_track.cpp:2007
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:2014
const VECTOR2I & GetMid() const
Definition: pcb_track.h:333
PCB_ARC(BOARD_ITEM *aParent)
Definition: pcb_track.h:308
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:253
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition: pcb_track.h:397
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:314
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:743
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:2115
bool operator==(const PCB_ARC &aOther) const
Definition: pcb_track.cpp:241
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_track.h:340
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:1185
virtual void SetLayerSet(const LSET &aLayers) override
Definition: pcb_track.cpp:1172
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:1076
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:736
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:379
void SetEndY(int aY)
Definition: pcb_track.h:159
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:141
bool IsOnCopperLayer() const override
Definition: pcb_track.h:265
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:127
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:243
void SetHasSolderMask(bool aVal)
Definition: pcb_track.h:173
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
Definition: pcb_track.cpp:730
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1501
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1978
void SetEnd(const VECTOR2I &aEnd)
Definition: pcb_track.h:146
bool HasSolderMask() const
Definition: pcb_track.h:174
void SetStart(const VECTOR2I &aStart)
Definition: pcb_track.h:149
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pcb_track.cpp:1560
int GetStartY() const
Definition: pcb_track.h:156
int GetEndX() const
Definition: pcb_track.h:161
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:1963
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:751
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:400
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:837
bool ApproxCollinear(const PCB_TRACK &aTrack)
Definition: pcb_track.cpp:520
VECTOR2I m_End
Line end point.
Definition: pcb_track.h:295
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: pcb_track.h:176
std::optional< int > m_solderMaskMargin
Definition: pcb_track.h:298
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:139
std::optional< int > GetLocalSolderMaskMargin() const
Definition: pcb_track.h:177
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:1710
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:660
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:2131
const VECTOR2I & GetStart() const
Definition: pcb_track.h:150
virtual bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:166
VECTOR2I m_Start
Line start point.
Definition: pcb_track.h:294
int GetEndY() const
Definition: pcb_track.h:162
wxString GetFriendlyName() const override
Definition: pcb_track.cpp:1698
VECTOR2I GetPosition() const override
Definition: pcb_track.h:140
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1474
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:1973
const VECTOR2I & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: pcb_track.h:165
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:1842
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:766
bool IsNull() const
Return true if segment length is zero.
Definition: pcb_track.h:227
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:188
bool m_hasSolderMask
Definition: pcb_track.h:297
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:2072
void SetStartX(int aX)
Definition: pcb_track.h:152
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:147
void SetStartY(int aY)
Definition: pcb_track.h:153
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:1097
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:528
void SetEndX(int aX)
Definition: pcb_track.h:158
int GetStartX() const
Definition: pcb_track.h:155
int m_width
Thickness of track (or arc) – no longer the width of a via.
Definition: pcb_track.h:301
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:628
virtual void SetWidth(int aWidth)
Definition: pcb_track.h:143
virtual int GetWidth() const
Definition: pcb_track.h:144
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
Definition: pcb_track.cpp:1807
void SetRemoveUnconnected(bool aSet)
Definition: pcb_track.h:573
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:686
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:1328
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:160
PLUGGING_MODE GetFrontPluggingMode() const
Definition: pcb_track.cpp:962
VECTOR2I GetPosition() const override
Definition: pcb_track.h:537
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:1044
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:2083
void SetCappingMode(CAPPING_MODE aMode)
Definition: pcb_track.cpp:997
void SetFrontCoveringMode(COVERING_MODE aMode)
Definition: pcb_track.cpp:905
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:492
COVERING_MODE GetBackCoveringMode() const
Definition: pcb_track.cpp:939
bool GetRemoveUnconnected() const
Definition: pcb_track.h:580
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:1364
void SetKeepStartEnd(bool aSet)
Definition: pcb_track.h:589
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:674
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
Definition: pcb_track.h:723
void ClearZoneLayerOverrides()
Definition: pcb_track.cpp:1416
CAPPING_MODE GetCappingMode() const
Definition: pcb_track.cpp:1008
const PADSTACK & Padstack() const
Definition: pcb_track.h:440
void SetFrontTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:859
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition: pcb_track.h:662
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:720
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:1883
TENTING_MODE GetFrontTentingMode() const
Definition: pcb_track.cpp:870
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1294
PADSTACK & Padstack()
Definition: pcb_track.h:441
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:1067
void SetDrill(int aDrill)
Set the drill value for vias.
Definition: pcb_track.h:652
PLUGGING_MODE GetBackPluggingMode() const
Definition: pcb_track.cpp:985
void SetBackPluggingMode(PLUGGING_MODE aMode)
Definition: pcb_track.cpp:974
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:564
void SetBackTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:882
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:687
void SetFrontPluggingMode(PLUGGING_MODE aMode)
Definition: pcb_track.cpp:951
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_track.cpp:812
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:1770
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:139
bool operator==(const PCB_VIA &aOther) const
Definition: pcb_track.cpp:309
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_track.cpp:1160
std::mutex m_zoneLayerOverridesMutex
Definition: pcb_track.h:722
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1288
FILLING_MODE GetFillingMode() const
Definition: pcb_track.cpp:1031
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:538
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:853
int GetFrontWidth() const
Definition: pcb_track.h:454
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:1279
bool HasDrilledHole() const override
Definition: pcb_track.h:461
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:145
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pcb_track.h:414
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:320
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_track.cpp:1166
bool GetKeepStartEnd() const
Definition: pcb_track.h:596
virtual void SetLayerSet(const LSET &aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
Definition: pcb_track.cpp:1237
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
Definition: pcb_track.cpp:1440
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:406
bool HasHole() const override
Definition: pcb_track.h:456
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:1334
int GetWidth() const override
Definition: pcb_track.cpp:359
PCB_VIA & operator=(const PCB_VIA &aOther)
Definition: pcb_track.cpp:124
void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1992
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:545
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:464
void SetFillingMode(FILLING_MODE aMode)
Definition: pcb_track.cpp:1020
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:602
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:1830
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1573
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:438
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
Definition: pcb_track.cpp:582
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:1115
TENTING_MODE GetBackTentingMode() const
Definition: pcb_track.cpp:893
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:1322
VIATYPE m_viaType
through, blind/buried or micro
Definition: pcb_track.h:716
PADSTACK m_padStack
Definition: pcb_track.h:718
COVERING_MODE GetFrontCoveringMode() const
Definition: pcb_track.cpp:916
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
Definition: pcb_track.cpp:613
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition: pcb_track.cpp:1433
void SetFrontWidth(int aWidth)
Definition: pcb_track.h:453
VIATYPE GetViaType() const
Definition: pcb_track.h:437
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1618
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
Definition: pcb_track.cpp:546
void SetWidth(int aWidth) override
Definition: pcb_track.cpp:351
void SetBackCoveringMode(COVERING_MODE aMode)
Definition: pcb_track.cpp:928
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:1201
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition: pcb_track.cpp:1425
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:1300
bool HasValidLayerPair(int aCopperLayerCount)
Definition: pcb_track.cpp:1138
void SetPadstack(const PADSTACK &aPadstack)
Definition: pcb_track.h:442
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:705
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:82
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:2054
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