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:
361};
362
363
364class PCB_VIA : public PCB_TRACK
365{
366public:
367 PCB_VIA( BOARD_ITEM* aParent );
368
369 static inline bool ClassOf( const EDA_ITEM *aItem )
370 {
371 return aItem && PCB_VIA_T == aItem->Type();
372 }
373
374 PCB_VIA( const PCB_VIA& aOther );
375 PCB_VIA& operator=( const PCB_VIA &aOther );
376
377 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
378 {
379 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
380 return true;
381
382 for( KICAD_T scanType : aScanTypes )
383 {
384 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
385 return true;
386 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
387 return true;
388 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
389 return true;
390 }
391
392 return false;
393 }
394
398 bool HasValidLayerPair( int aCopperLayerCount );
399
400 VIATYPE GetViaType() const { return m_viaType; }
401 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
402
403 const PADSTACK& Padstack() const { return m_padStack; }
405 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
406
407 const BOX2I GetBoundingBox() const override;
408
409 void SetWidth( int aWidth ) override;
410 int GetWidth() const override;
411
412 void SetWidth( PCB_LAYER_ID aLayer, int aWidth );
413 int GetWidth( PCB_LAYER_ID aLayer ) const;
414
415 // For properties panel
416 void SetFrontWidth( int aWidth ) { SetWidth( F_Cu, aWidth ); }
417 int GetFrontWidth() const { return GetWidth( F_Cu ); }
418
419 bool HasHole() const override
420 {
421 return true;
422 }
423
424 bool HasDrilledHole() const override
425 {
426 return m_viaType == VIATYPE::THROUGH || m_viaType == VIATYPE::BLIND_BURIED;
427 }
428
429 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
430
431 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
432 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
433
434 void SetFrontTentingMode( TENTING_MODE aMode );
436 void SetBackTentingMode( TENTING_MODE aMode );
438
439 bool IsTented( PCB_LAYER_ID aLayer ) const override;
440 int GetSolderMaskExpansion() const;
441
442 PCB_LAYER_ID GetLayer() const override;
443 void SetLayer( PCB_LAYER_ID aLayer ) override;
444
445 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
446
447 virtual LSET GetLayerSet() const override;
448
453 virtual void SetLayerSet( const LSET& aLayers ) override;
454
461 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
462
463 void SetBottomLayer( PCB_LAYER_ID aLayer );
464 void SetTopLayer( PCB_LAYER_ID aLayer );
465
473 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
474
475 PCB_LAYER_ID TopLayer() const;
477
482 void SanitizeLayers();
483
484 VECTOR2I GetPosition() const override { return m_Start; }
485 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
486
487 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
488
489 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
490 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
491
492 wxString GetClass() const override
493 {
494 return wxT( "PCB_VIA" );
495 }
496
497 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
498
499 BITMAPS GetMenuImage() const override;
500
501 EDA_ITEM* Clone() const override;
502
503 void ViewGetLayers( int aLayers[], int& aCount ) const override;
504
505 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
506
507 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
508
509#if defined (DEBUG)
510 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
511#endif
512
513 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
514
520 void SetRemoveUnconnected( bool aSet )
521 {
525 }
526
528 {
530 }
531
536 void SetKeepStartEnd( bool aSet )
537 {
541 }
542
543 bool GetKeepStartEnd() const
544 {
547 }
548
550 {
552 {
554 return false;
555
557 return true;
558
560 {
561 if( aLayer == m_padStack.Drill().start || aLayer == m_padStack.Drill().end )
562 return false;
563 }
564 }
565
566 return true;
567 }
568
575 bool FlashLayer( int aLayer ) const;
576
584 bool FlashLayer( LSET aLayers ) const;
585
592 PCB_LAYER_ID* aBottommost ) const;
593
599 void SetDrill( int aDrill )
600 {
601 m_padStack.Drill().size = { aDrill, aDrill };
602 }
603
609 int GetDrill() const { return m_padStack.Drill().size.x; }
610
616 int GetDrillValue() const;
617
622 {
624 }
625
633 bool GetIsFree() const { return m_isFree; }
634 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
635
636 // @copydoc BOARD_ITEM::GetEffectiveShape
637 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
638 FLASHING aFlash = FLASHING::DEFAULT ) const override;
639
641
643
644 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
645
646 double Similarity( const BOARD_ITEM& aOther ) const override;
647
648 bool operator==( const PCB_VIA& aOther ) const;
649 bool operator==( const BOARD_ITEM& aOther ) const override;
650
651 void Serialize( google::protobuf::Any &aContainer ) const override;
652 bool Deserialize( const google::protobuf::Any &aContainer ) override;
653
654protected:
655 void swapData( BOARD_ITEM* aImage ) override;
656
657 wxString layerMaskDescribe() const override;
658
659private:
661
663
664 bool m_isFree;
665
667 std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE> m_zoneLayerOverrides;
668};
669
670
671#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:118
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
Definition: padstack.h:301
UNCONNECTED_LAYER_MODE UnconnectedLayerMode() const
Definition: padstack.h:300
DRILL_PROPS & Drill()
Definition: padstack.h:294
Definition: pad.h:54
virtual VECTOR2I GetPosition() const override
Definition: pcb_track.cpp:1823
bool IsDegenerated(int aThreshold=5) const
Definition: pcb_track.cpp:1865
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1808
bool IsCCW() const
Definition: pcb_track.cpp:778
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:398
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:759
EDA_ANGLE GetArcAngleStart() const
Definition: pcb_track.cpp:1847
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:734
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:1671
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:1857
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:421
void SetMid(const VECTOR2I &aMid)
Definition: pcb_track.h:298
double GetRadius() const
Definition: pcb_track.cpp:1830
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:1837
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:242
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition: pcb_track.h:360
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:719
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:1938
bool operator==(const PCB_ARC &aOther) const
Definition: pcb_track.cpp:230
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:1022
virtual void SetLayerSet(const LSET &aLayers) override
Definition: pcb_track.cpp:1009
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:913
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:712
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:1302
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:357
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:1322
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:706
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1801
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:1383
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:1786
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:727
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:378
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:813
bool ApproxCollinear(const PCB_TRACK &aTrack)
Definition: pcb_track.cpp:496
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:1529
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:636
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:1949
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:1517
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:1796
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:1665
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:742
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:1895
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:934
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:504
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:604
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:1626
void SetRemoveUnconnected(bool aSet)
Definition: pcb_track.h:520
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:633
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:1165
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:484
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:881
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:1906
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:468
bool GetRemoveUnconnected() const
Definition: pcb_track.h:527
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:1201
void SetKeepStartEnd(bool aSet)
Definition: pcb_track.h:536
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:621
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
Definition: pcb_track.h:667
void ClearZoneLayerOverrides()
Definition: pcb_track.cpp:1248
const PADSTACK & Padstack() const
Definition: pcb_track.h:403
void SetFrontTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:835
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition: pcb_track.h:609
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:664
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:1706
TENTING_MODE GetFrontTentingMode() const
Definition: pcb_track.cpp:846
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1131
PADSTACK & Padstack()
Definition: pcb_track.h:404
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:904
void SetDrill(int aDrill)
Set the drill value for vias.
Definition: pcb_track.h:599
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:540
void SetBackTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:858
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:634
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
Definition: pcb_track.cpp:788
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:1589
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:287
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_track.cpp:997
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1432
std::mutex m_zoneLayerOverridesMutex
Definition: pcb_track.h:666
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1125
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:485
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:829
int GetFrontWidth() const
Definition: pcb_track.h:417
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:1116
bool HasDrilledHole() const override
Definition: pcb_track.h:424
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:377
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:298
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_track.cpp:1003
bool GetKeepStartEnd() const
Definition: pcb_track.h:543
virtual void SetLayerSet(const LSET &aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
Definition: pcb_track.cpp:1074
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
Definition: pcb_track.cpp:1272
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:369
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:1396
bool HasHole() const override
Definition: pcb_track.h:419
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:1171
int GetWidth() const override
Definition: pcb_track.cpp:337
PCB_VIA & operator=(const PCB_VIA &aOther)
Definition: pcb_track.cpp:124
void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1815
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:492
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:442
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:549
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:1653
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:401
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
Definition: pcb_track.cpp:558
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:952
TENTING_MODE GetBackTentingMode() const
Definition: pcb_track.cpp:869
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:1159
VIATYPE m_viaType
through, blind/buried or micro
Definition: pcb_track.h:660
PADSTACK m_padStack
Definition: pcb_track.h:662
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
Definition: pcb_track.cpp:589
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition: pcb_track.cpp:1265
void SetFrontWidth(int aWidth)
Definition: pcb_track.h:416
VIATYPE GetViaType() const
Definition: pcb_track.h:400
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
Definition: pcb_track.cpp:522
void SetWidth(int aWidth) override
Definition: pcb_track.cpp:329
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:1038
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition: pcb_track.cpp:1257
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:1137
bool HasValidLayerPair(int aCopperLayerCount)
Definition: pcb_track.cpp:975
void SetPadstack(const PADSTACK &aPadstack)
Definition: pcb_track.h:405
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:681
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:236
PCB_LAYER_ID end
Definition: padstack.h:237
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
Definition: padstack.h:234
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
Definition: pcb_track.cpp:1877
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