KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_track.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
35#ifndef CLASS_TRACK_H
36#define CLASS_TRACK_H
37
38
39#include <mutex>
40#include <array>
42#include <base_units.h>
44#include <core/minoptmax.h>
45#include <core/arraydim.h>
46#include <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
81#define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter.
82
83// Used for tracks and vias for algorithmic safety, not to enforce constraints
84#define GEOMETRY_MIN_SIZE (int) ( 0.001 * pcbIUScale.IU_PER_MM )
85
86
88{
89public:
90 static inline bool ClassOf( const EDA_ITEM* aItem )
91 {
92 return aItem && PCB_TRACE_T == aItem->Type();
93 }
94
95 PCB_TRACK( BOARD_ITEM* aParent, KICAD_T idtype = PCB_TRACE_T );
96
97 // Do not create a copy constructor. The one generated by the compiler is adequate.
98
99 void Move( const VECTOR2I& aMoveVector ) override
100 {
101 m_Start += aMoveVector;
102 m_End += aMoveVector;
103 }
104
105 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
106
107 virtual void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
108
109 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
110
111 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
112 VECTOR2I GetPosition() const override { return m_Start; }
113 const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; }
114
115 virtual void SetWidth( int aWidth ) { m_width = aWidth; }
116 virtual int GetWidth() const { return m_width; }
117
118 void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; }
119 const VECTOR2I& GetEnd() const { return m_End; }
120
121 void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; }
122 const VECTOR2I& GetStart() const { return m_Start; }
123
124 void SetEndX( int aX ) { m_End.x = aX; }
125 void SetEndY( int aY ) { m_End.y = aY; }
126
127 int GetEndX() const { return m_End.x; }
128 int GetEndY() const { return m_End.y; }
129
131 const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
132 {
133 if( aEndPoint == ENDPOINT_START )
134 return m_Start;
135 else
136 return m_End;
137 }
138
139 void SetHasSolderMask( bool aVal ) { m_hasSolderMask = aVal; }
140 bool HasSolderMask() const { return m_hasSolderMask; }
141
142 void SetLocalSolderMaskMargin( std::optional<int> aMargin ) { m_solderMaskMargin = aMargin; }
143 std::optional<int> GetLocalSolderMaskMargin() const { return m_solderMaskMargin; }
144
145 int GetSolderMaskExpansion() const;
146
147 // Virtual function
148 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
149
150 virtual LSET GetLayerSet() const override;
151 virtual void SetLayerSet( const LSET& aLayers ) override;
152
153 const BOX2I GetBoundingBox() const override;
154
160 virtual double GetLength() const;
161
173 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
174 int aError, ERROR_LOC aErrorLoc,
175 bool ignoreLineWidth = false ) const override;
176
177 // @copydoc BOARD_ITEM::GetEffectiveShape
178 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
179 FLASHING aFlash = FLASHING::DEFAULT ) const override;
180
188 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
189
193 bool IsNull() const
194 {
195 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
196 }
197
198 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
199 wxString GetFriendlyName() const override;
200
201 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
202 const std::vector<KICAD_T>& aScanTypes ) override;
203
204 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
205 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
206
207 bool ApproxCollinear( const PCB_TRACK& aTrack );
208
209 wxString GetClass() const override
210 {
211 return wxT( "PCB_TRACK" );
212 }
213
214 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
215
216 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
217
218 BITMAPS GetMenuImage() const override;
219
220 virtual EDA_ITEM* Clone() const override;
221
222 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
223
224 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
225
226 const BOX2I ViewBBox() const override;
227
231 bool IsOnCopperLayer() const override
232 {
233 return true;
234 }
235
236 virtual double Similarity( const BOARD_ITEM& aOther ) const override;
237
238 virtual bool operator==( const BOARD_ITEM& aOther ) const override;
239 virtual bool operator==( const PCB_TRACK& aOther ) const;
240
242 {
243 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
244 };
245
246 void Serialize( google::protobuf::Any &aContainer ) const override;
247 bool Deserialize( const google::protobuf::Any &aContainer ) override;
248
249#if defined (DEBUG)
250 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
251#endif
252
253protected:
254 virtual void swapData( BOARD_ITEM* aImage ) override;
255
257 std::vector<MSG_PANEL_ITEM>& aList ) const;
258
259protected:
262
264 std::optional<int> m_solderMaskMargin;
265
266private:
268};
269
270
271class PCB_ARC : public PCB_TRACK
272{
273public:
274 PCB_ARC( BOARD_ITEM* aParent ) :
275 PCB_TRACK( aParent, PCB_ARC_T )
276 { }
277
278 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
279
280 static inline bool ClassOf( const EDA_ITEM *aItem )
281 {
282 return aItem && PCB_ARC_T == aItem->Type();
283 }
284
285 virtual void Move( const VECTOR2I& aMoveVector ) override
286 {
287 m_Start += aMoveVector;
288 m_Mid += aMoveVector;
289 m_End += aMoveVector;
290 }
291
292 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
293
294 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
295
296 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
297
298 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
299 const VECTOR2I& GetMid() const { return m_Mid; }
300
301 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
302
303 virtual VECTOR2I GetPosition() const override;
304 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
305
306 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
307
308 double GetRadius() const;
309 EDA_ANGLE GetAngle() const;
311 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
312 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
313
314 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
315 int aAccuracy = 0 ) const override;
316
317 bool IsCCW() const;
318
319 wxString GetClass() const override
320 {
321 return wxT( "PCB_ARC" );
322 }
323
324 // @copydoc BOARD_ITEM::GetEffectiveShape
325 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
326 FLASHING aFlash = FLASHING::DEFAULT ) const override;
327
333 virtual double GetLength() const override
334 {
335 return GetRadius() * std::abs( GetAngle().AsRadians() );
336 }
337
338 EDA_ITEM* Clone() const override;
339
346 bool IsDegenerated( int aThreshold = 5 ) const;
347
348 double Similarity( const BOARD_ITEM& aOther ) const override;
349
350 bool operator==( const PCB_ARC& aOther ) const;
351 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
352
353 void Serialize( google::protobuf::Any &aContainer ) const override;
354 bool Deserialize( const google::protobuf::Any &aContainer ) override;
355
356protected:
357 virtual void swapData( BOARD_ITEM* aImage ) override;
358
359private:
360 // Silence GCC warning about overriding the base class method
361 bool operator==( const PCB_TRACK& aOther ) const override;
362
364};
365
366
367class PCB_VIA : public PCB_TRACK
368{
369public:
370 PCB_VIA( BOARD_ITEM* aParent );
371
372 static inline bool ClassOf( const EDA_ITEM *aItem )
373 {
374 return aItem && PCB_VIA_T == aItem->Type();
375 }
376
377 PCB_VIA( const PCB_VIA& aOther );
378 PCB_VIA& operator=( const PCB_VIA &aOther );
379
380 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
381 {
382 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
383 return true;
384
385 for( KICAD_T scanType : aScanTypes )
386 {
387 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
388 return true;
389 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
390 return true;
391 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
392 return true;
393 }
394
395 return false;
396 }
397
401 bool HasValidLayerPair( int aCopperLayerCount );
402
403 VIATYPE GetViaType() const { return m_viaType; }
404 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
405
406 const PADSTACK& Padstack() const { return m_padStack; }
408 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
409
410 const BOX2I GetBoundingBox() const override;
411
412 void SetWidth( int aWidth ) override;
413 int GetWidth() const override;
414
415 void SetWidth( PCB_LAYER_ID aLayer, int aWidth );
416 int GetWidth( PCB_LAYER_ID aLayer ) const;
417
418 // For properties panel
419 void SetFrontWidth( int aWidth ) { SetWidth( F_Cu, aWidth ); }
420 int GetFrontWidth() const { return GetWidth( F_Cu ); }
421
422 bool HasHole() const override
423 {
424 return true;
425 }
426
427 bool HasDrilledHole() const override
428 {
429 return m_viaType == VIATYPE::THROUGH || m_viaType == VIATYPE::BLIND_BURIED;
430 }
431
432 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
433
434 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
435 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
436
437 void SetFrontTentingMode( TENTING_MODE aMode );
439 void SetBackTentingMode( TENTING_MODE aMode );
441
442 bool IsTented( PCB_LAYER_ID aLayer ) const override;
443 int GetSolderMaskExpansion() const;
444
445 PCB_LAYER_ID GetLayer() const override;
446 void SetLayer( PCB_LAYER_ID aLayer ) override;
447
448 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
449
450 virtual LSET GetLayerSet() const override;
451
456 virtual void SetLayerSet( const LSET& aLayers ) override;
457
464 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
465
466 void SetBottomLayer( PCB_LAYER_ID aLayer );
467 void SetTopLayer( PCB_LAYER_ID aLayer );
468
476 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
477
478 PCB_LAYER_ID TopLayer() const;
480
485 void SanitizeLayers();
486
487 VECTOR2I GetPosition() const override { return m_Start; }
488 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
489
490 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
491
492 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
493 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
494
495 wxString GetClass() const override
496 {
497 return wxT( "PCB_VIA" );
498 }
499
500 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
501
502 BITMAPS GetMenuImage() const override;
503
504 EDA_ITEM* Clone() const override;
505
506 void ViewGetLayers( int aLayers[], int& aCount ) const override;
507
508 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
509
510 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
511
512#if defined (DEBUG)
513 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
514#endif
515
516 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
517
523 void SetRemoveUnconnected( bool aSet )
524 {
528 }
529
531 {
533 }
534
539 void SetKeepStartEnd( bool aSet )
540 {
544 }
545
546 bool GetKeepStartEnd() const
547 {
550 }
551
553 {
555 {
557 return false;
558
560 return true;
561
563 {
564 if( aLayer == m_padStack.Drill().start || aLayer == m_padStack.Drill().end )
565 return false;
566 }
567 }
568
569 return true;
570 }
571
578 bool FlashLayer( int aLayer ) const;
579
587 bool FlashLayer( LSET aLayers ) const;
588
595 PCB_LAYER_ID* aBottommost ) const;
596
602 void SetDrill( int aDrill )
603 {
604 m_padStack.Drill().size = { aDrill, aDrill };
605 }
606
612 int GetDrill() const { return m_padStack.Drill().size.x; }
613
619 int GetDrillValue() const;
620
625 {
627 }
628
636 bool GetIsFree() const { return m_isFree; }
637 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
638
639 // @copydoc BOARD_ITEM::GetEffectiveShape
640 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
641 FLASHING aFlash = FLASHING::DEFAULT ) const override;
642
644
646
647 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
648
649 double Similarity( const BOARD_ITEM& aOther ) const override;
650
651 bool operator==( const PCB_VIA& aOther ) const;
652 bool operator==( const BOARD_ITEM& aOther ) const override;
653
654 void Serialize( google::protobuf::Any &aContainer ) const override;
655 bool Deserialize( const google::protobuf::Any &aContainer ) override;
656
657protected:
658 void swapData( BOARD_ITEM* aImage ) override;
659
660 wxString layerMaskDescribe() const override;
661
662private:
663 // Silence GCC warning about hiding the PCB_TRACK base method
664 bool operator==( const PCB_TRACK& aOther ) const override;
665
667
669
670 bool m_isFree;
671
673 std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE> m_zoneLayerOverrides;
674};
675
676
677#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:176
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:36
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:307
UNCONNECTED_LAYER_MODE UnconnectedLayerMode() const
Definition: padstack.h:306
DRILL_PROPS & Drill()
Definition: padstack.h:300
Definition: pad.h:54
virtual VECTOR2I GetPosition() const override
Definition: pcb_track.cpp:1842
bool IsDegenerated(int aThreshold=5) const
Definition: pcb_track.cpp:1884
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1827
bool IsCCW() const
Definition: pcb_track.cpp:797
virtual double GetLength() const override
Return the length of the arc track.
Definition: pcb_track.h:333
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:778
EDA_ANGLE GetArcAngleStart() const
Definition: pcb_track.cpp:1866
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:753
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:1690
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:1876
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:304
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:301
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:285
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:319
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:298
double GetRadius() const
Definition: pcb_track.cpp:1849
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:1856
const VECTOR2I & GetMid() const
Definition: pcb_track.h:299
PCB_ARC(BOARD_ITEM *aParent)
Definition: pcb_track.h:274
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:363
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:280
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:738
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:1957
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:306
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:1041
virtual void SetLayerSet(const LSET &aLayers) override
Definition: pcb_track.cpp:1028
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:932
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:731
virtual void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1321
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:125
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:113
bool IsOnCopperLayer() const override
Definition: pcb_track.h:231
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:99
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:209
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1341
void SetHasSolderMask(bool aVal)
Definition: pcb_track.h:139
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
Definition: pcb_track.cpp:725
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1820
void SetEnd(const VECTOR2I &aEnd)
Definition: pcb_track.h:118
bool HasSolderMask() const
Definition: pcb_track.h:140
void SetStart(const VECTOR2I &aStart)
Definition: pcb_track.h:121
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pcb_track.cpp:1402
int GetEndX() const
Definition: pcb_track.h:127
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:1805
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:746
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:832
bool ApproxCollinear(const PCB_TRACK &aTrack)
Definition: pcb_track.cpp:515
VECTOR2I m_End
Line end point.
Definition: pcb_track.h:261
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: pcb_track.h:142
std::optional< int > m_solderMaskMargin
Definition: pcb_track.h:264
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:111
std::optional< int > GetLocalSolderMaskMargin() const
Definition: pcb_track.h:143
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:1548
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:655
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:1968
const VECTOR2I & GetStart() const
Definition: pcb_track.h:122
virtual bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:166
VECTOR2I m_Start
Line start point.
Definition: pcb_track.h:260
int GetEndY() const
Definition: pcb_track.h:128
wxString GetFriendlyName() const override
Definition: pcb_track.cpp:1536
VECTOR2I GetPosition() const override
Definition: pcb_track.h:112
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:1815
const VECTOR2I & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: pcb_track.h:131
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:1684
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:90
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_track.cpp:761
bool IsNull() const
Return true if segment length is zero.
Definition: pcb_track.h:193
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:263
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:1914
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:119
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:953
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:523
void SetEndX(int aX)
Definition: pcb_track.h:124
int m_width
Thickness of track (or arc) – no longer the width of a via.
Definition: pcb_track.h:267
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:623
virtual void SetWidth(int aWidth)
Definition: pcb_track.h:115
virtual int GetWidth() const
Definition: pcb_track.h:116
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
Definition: pcb_track.cpp:1645
void SetRemoveUnconnected(bool aSet)
Definition: pcb_track.h:523
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:636
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:1184
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:160
VECTOR2I GetPosition() const override
Definition: pcb_track.h:487
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:900
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:1925
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:488
bool GetRemoveUnconnected() const
Definition: pcb_track.h:530
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:1220
void SetKeepStartEnd(bool aSet)
Definition: pcb_track.h:539
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:624
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
Definition: pcb_track.h:673
void ClearZoneLayerOverrides()
Definition: pcb_track.cpp:1267
const PADSTACK & Padstack() const
Definition: pcb_track.h:406
void SetFrontTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:854
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition: pcb_track.h:612
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:670
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:1725
TENTING_MODE GetFrontTentingMode() const
Definition: pcb_track.cpp:865
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1150
PADSTACK & Padstack()
Definition: pcb_track.h:407
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:923
void SetDrill(int aDrill)
Set the drill value for vias.
Definition: pcb_track.h:602
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:559
void SetBackTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:877
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:637
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_track.cpp:807
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:1608
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:1016
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1451
std::mutex m_zoneLayerOverridesMutex
Definition: pcb_track.h:672
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1144
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:488
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:848
int GetFrontWidth() const
Definition: pcb_track.h:420
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:1135
bool HasDrilledHole() const override
Definition: pcb_track.h:427
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:380
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:1022
bool GetKeepStartEnd() const
Definition: pcb_track.h:546
virtual void SetLayerSet(const LSET &aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
Definition: pcb_track.cpp:1093
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
Definition: pcb_track.cpp:1291
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:372
void ViewGetLayers(int aLayers[], int &aCount) const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1415
bool HasHole() const override
Definition: pcb_track.h:422
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:1190
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:1834
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:495
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:464
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:552
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:1672
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:404
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
Definition: pcb_track.cpp:577
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:971
TENTING_MODE GetBackTentingMode() const
Definition: pcb_track.cpp:888
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:1178
VIATYPE m_viaType
through, blind/buried or micro
Definition: pcb_track.h:666
PADSTACK m_padStack
Definition: pcb_track.h:668
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
Definition: pcb_track.cpp:608
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition: pcb_track.cpp:1284
void SetFrontWidth(int aWidth)
Definition: pcb_track.h:419
VIATYPE GetViaType() const
Definition: pcb_track.h:403
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
Definition: pcb_track.cpp:541
void SetWidth(int aWidth) override
Definition: pcb_track.cpp:351
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:1057
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition: pcb_track.cpp:1276
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:1156
bool HasValidLayerPair(int aCopperLayerCount)
Definition: pcb_track.cpp:994
void SetPadstack(const PADSTACK &aPadstack)
Definition: pcb_track.h:408
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:700
Represent a set of closed polygons.
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
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:147
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
VIATYPE
Definition: pcb_track.h:66
@ BLIND_BURIED
TENTING_MODE
Definition: pcb_track.h:75
ENDPOINT_T
Definition: pcb_track.h:59
@ ENDPOINT_END
Definition: pcb_track.h:61
@ ENDPOINT_START
Definition: pcb_track.h:60
#define UNDEFINED_DRILL_DIAMETER
Definition: pcb_track.h:81
PCB_LAYER_ID start
Definition: padstack.h:242
PCB_LAYER_ID end
Definition: padstack.h:243
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
Definition: padstack.h:240
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
Definition: pcb_track.cpp:1896
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