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 SetStartX( int aX ) { m_Start.x = aX; }
125 void SetStartY( int aY ) { m_Start.y = aY; }
126
127 int GetStartX() const { return m_Start.x; }
128 int GetStartY() const { return m_Start.y; }
129
130 void SetEndX( int aX ) { m_End.x = aX; }
131 void SetEndY( int aY ) { m_End.y = aY; }
132
133 int GetEndX() const { return m_End.x; }
134 int GetEndY() const { return m_End.y; }
135
137 const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
138 {
139 if( aEndPoint == ENDPOINT_START )
140 return m_Start;
141 else
142 return m_End;
143 }
144
145 void SetHasSolderMask( bool aVal ) { m_hasSolderMask = aVal; }
146 bool HasSolderMask() const { return m_hasSolderMask; }
147
148 void SetLocalSolderMaskMargin( std::optional<int> aMargin ) { m_solderMaskMargin = aMargin; }
149 std::optional<int> GetLocalSolderMaskMargin() const { return m_solderMaskMargin; }
150
151 int GetSolderMaskExpansion() const;
152
153 // Virtual function
154 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
155
156 virtual LSET GetLayerSet() const override;
157 virtual void SetLayerSet( const LSET& aLayers ) override;
158
159 const BOX2I GetBoundingBox() const override;
160
166 virtual double GetLength() const;
167
179 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
180 int aError, ERROR_LOC aErrorLoc,
181 bool ignoreLineWidth = false ) const override;
182
183 // @copydoc BOARD_ITEM::GetEffectiveShape
184 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
185 FLASHING aFlash = FLASHING::DEFAULT ) const override;
186
194 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
195
199 bool IsNull() const
200 {
201 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
202 }
203
204 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
205 wxString GetFriendlyName() const override;
206
207 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
208 const std::vector<KICAD_T>& aScanTypes ) override;
209
210 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
211 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
212
213 bool ApproxCollinear( const PCB_TRACK& aTrack );
214
215 wxString GetClass() const override
216 {
217 return wxT( "PCB_TRACK" );
218 }
219
220 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
221
222 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
223
224 BITMAPS GetMenuImage() const override;
225
226 virtual EDA_ITEM* Clone() const override;
227
228 virtual std::vector<int> ViewGetLayers() const override;
229
230 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
231
232 const BOX2I ViewBBox() const override;
233
237 bool IsOnCopperLayer() const override
238 {
239 return true;
240 }
241
242 virtual double Similarity( const BOARD_ITEM& aOther ) const override;
243
244 virtual bool operator==( const BOARD_ITEM& aOther ) const override;
245 virtual bool operator==( const PCB_TRACK& aOther ) const;
246
248 {
249 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
250 };
251
252 void Serialize( google::protobuf::Any &aContainer ) const override;
253 bool Deserialize( const google::protobuf::Any &aContainer ) override;
254
255#if defined (DEBUG)
256 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
257#endif
258
259protected:
260 virtual void swapData( BOARD_ITEM* aImage ) override;
261
263 std::vector<MSG_PANEL_ITEM>& aList ) const;
264
265protected:
268
270 std::optional<int> m_solderMaskMargin;
271
272private:
274};
275
276
277class PCB_ARC : public PCB_TRACK
278{
279public:
280 PCB_ARC( BOARD_ITEM* aParent ) :
281 PCB_TRACK( aParent, PCB_ARC_T )
282 { }
283
284 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
285
286 static inline bool ClassOf( const EDA_ITEM *aItem )
287 {
288 return aItem && PCB_ARC_T == aItem->Type();
289 }
290
291 virtual void Move( const VECTOR2I& aMoveVector ) override
292 {
293 m_Start += aMoveVector;
294 m_Mid += aMoveVector;
295 m_End += aMoveVector;
296 }
297
298 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
299
300 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
301
302 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
303
304 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
305 const VECTOR2I& GetMid() const { return m_Mid; }
306
307 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
308
309 virtual VECTOR2I GetPosition() const override;
310 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
311
312 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
313
314 double GetRadius() const;
315 EDA_ANGLE GetAngle() const;
317 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
318 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
319
320 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
321 int aAccuracy = 0 ) const override;
322
323 bool IsCCW() const;
324
325 wxString GetClass() const override
326 {
327 return wxT( "PCB_ARC" );
328 }
329
330 // @copydoc BOARD_ITEM::GetEffectiveShape
331 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
332 FLASHING aFlash = FLASHING::DEFAULT ) const override;
333
339 virtual double GetLength() const override
340 {
341 return GetRadius() * std::abs( GetAngle().AsRadians() );
342 }
343
344 EDA_ITEM* Clone() const override;
345
352 bool IsDegenerated( int aThreshold = 5 ) const;
353
354 double Similarity( const BOARD_ITEM& aOther ) const override;
355
356 bool operator==( const PCB_ARC& aOther ) const;
357 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
358
359 void Serialize( google::protobuf::Any &aContainer ) const override;
360 bool Deserialize( const google::protobuf::Any &aContainer ) override;
361
362protected:
363 virtual void swapData( BOARD_ITEM* aImage ) override;
364
365private:
366 // Silence GCC warning about overriding the base class method
367 bool operator==( const PCB_TRACK& aOther ) const override;
368
370};
371
372
373class PCB_VIA : public PCB_TRACK
374{
375public:
376 PCB_VIA( BOARD_ITEM* aParent );
377
378 static inline bool ClassOf( const EDA_ITEM *aItem )
379 {
380 return aItem && PCB_VIA_T == aItem->Type();
381 }
382
383 PCB_VIA( const PCB_VIA& aOther );
384 PCB_VIA& operator=( const PCB_VIA &aOther );
385
386 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
387 {
388 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
389 return true;
390
391 for( KICAD_T scanType : aScanTypes )
392 {
393 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
394 return true;
395 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
396 return true;
397 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
398 return true;
399 }
400
401 return false;
402 }
403
407 bool HasValidLayerPair( int aCopperLayerCount );
408
409 VIATYPE GetViaType() const { return m_viaType; }
410 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
411
412 const PADSTACK& Padstack() const { return m_padStack; }
414 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
415
416 const BOX2I GetBoundingBox() const override;
417
418 void SetWidth( int aWidth ) override;
419 int GetWidth() const override;
420
421 void SetWidth( PCB_LAYER_ID aLayer, int aWidth );
422 int GetWidth( PCB_LAYER_ID aLayer ) const;
423
424 // For properties panel
425 void SetFrontWidth( int aWidth ) { SetWidth( F_Cu, aWidth ); }
426 int GetFrontWidth() const { return GetWidth( F_Cu ); }
427
428 bool HasHole() const override
429 {
430 return true;
431 }
432
433 bool HasDrilledHole() const override
434 {
435 return m_viaType == VIATYPE::THROUGH || m_viaType == VIATYPE::BLIND_BURIED;
436 }
437
438 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
439
440 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
441 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
442
443 void SetFrontTentingMode( TENTING_MODE aMode );
445 void SetBackTentingMode( TENTING_MODE aMode );
447
448 bool IsTented( PCB_LAYER_ID aLayer ) const override;
449 int GetSolderMaskExpansion() const;
450
451 PCB_LAYER_ID GetLayer() const override;
452 void SetLayer( PCB_LAYER_ID aLayer ) override;
453
454 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
455
456 virtual LSET GetLayerSet() const override;
457
462 virtual void SetLayerSet( const LSET& aLayers ) override;
463
470 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
471
472 void SetBottomLayer( PCB_LAYER_ID aLayer );
473 void SetTopLayer( PCB_LAYER_ID aLayer );
474
482 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
483
484 PCB_LAYER_ID TopLayer() const;
486
491 void SanitizeLayers();
492
493 VECTOR2I GetPosition() const override { return m_Start; }
494 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
495
496 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
497
498 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
499 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
500
501 wxString GetClass() const override
502 {
503 return wxT( "PCB_VIA" );
504 }
505
506 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
507
508 BITMAPS GetMenuImage() const override;
509
510 EDA_ITEM* Clone() const override;
511
512 std::vector<int> ViewGetLayers() const override;
513
514 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
515
516 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
517
518#if defined (DEBUG)
519 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
520#endif
521
522 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
523
529 void SetRemoveUnconnected( bool aSet )
530 {
534 }
535
537 {
539 }
540
545 void SetKeepStartEnd( bool aSet )
546 {
550 }
551
552 bool GetKeepStartEnd() const
553 {
556 }
557
559 {
561 {
563 return false;
564
566 return true;
567
569 {
570 if( aLayer == m_padStack.Drill().start || aLayer == m_padStack.Drill().end )
571 return false;
572 }
573 }
574
575 return true;
576 }
577
584 bool FlashLayer( int aLayer ) const;
585
593 bool FlashLayer( LSET aLayers ) const;
594
601 PCB_LAYER_ID* aBottommost ) const;
602
608 void SetDrill( int aDrill )
609 {
610 m_padStack.Drill().size = { aDrill, aDrill };
611 }
612
618 int GetDrill() const { return m_padStack.Drill().size.x; }
619
625 int GetDrillValue() const;
626
631 {
633 }
634
642 bool GetIsFree() const { return m_isFree; }
643 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
644
645 // @copydoc BOARD_ITEM::GetEffectiveShape
646 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
647 FLASHING aFlash = FLASHING::DEFAULT ) const override;
648
650
652
653 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
654
655 double Similarity( const BOARD_ITEM& aOther ) const override;
656
657 bool operator==( const PCB_VIA& aOther ) const;
658 bool operator==( const BOARD_ITEM& aOther ) const override;
659
660 void Serialize( google::protobuf::Any &aContainer ) const override;
661 bool Deserialize( const google::protobuf::Any &aContainer ) override;
662
663protected:
664 void swapData( BOARD_ITEM* aImage ) override;
665
666 wxString layerMaskDescribe() const override;
667
668private:
669 // Silence GCC warning about hiding the PCB_TRACK base method
670 bool operator==( const PCB_TRACK& aOther ) const override;
671
673
675
676 bool m_isFree;
677
679 std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE> m_zoneLayerOverrides;
680};
681
682
683#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:1848
bool IsDegenerated(int aThreshold=5) const
Definition: pcb_track.cpp:1890
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1833
bool IsCCW() const
Definition: pcb_track.cpp:802
virtual double GetLength() const override
Return the length of the arc track.
Definition: pcb_track.h:339
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:1872
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:1696
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:1882
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:310
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:307
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:291
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:325
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:304
double GetRadius() const
Definition: pcb_track.cpp:1855
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:1862
const VECTOR2I & GetMid() const
Definition: pcb_track.h:305
PCB_ARC(BOARD_ITEM *aParent)
Definition: pcb_track.h:280
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:369
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:286
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:1963
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:312
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:1046
virtual void SetLayerSet(const LSET &aLayers) override
Definition: pcb_track.cpp:1033
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:937
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:131
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:237
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:215
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1348
void SetHasSolderMask(bool aVal)
Definition: pcb_track.h:145
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
Definition: pcb_track.cpp:730
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1826
void SetEnd(const VECTOR2I &aEnd)
Definition: pcb_track.h:118
bool HasSolderMask() const
Definition: pcb_track.h:146
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:1409
int GetStartY() const
Definition: pcb_track.h:128
int GetEndX() const
Definition: pcb_track.h:133
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:1811
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:267
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition: pcb_track.h:148
std::optional< int > m_solderMaskMargin
Definition: pcb_track.h:270
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:111
std::optional< int > GetLocalSolderMaskMargin() const
Definition: pcb_track.h:149
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:1554
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:1974
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:266
int GetEndY() const
Definition: pcb_track.h:134
wxString GetFriendlyName() const override
Definition: pcb_track.cpp:1542
VECTOR2I GetPosition() const override
Definition: pcb_track.h:112
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1326
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:1821
const VECTOR2I & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: pcb_track.h:137
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
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:766
bool IsNull() const
Return true if segment length is zero.
Definition: pcb_track.h:199
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:269
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:1920
void SetStartX(int aX)
Definition: pcb_track.h:124
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:119
void SetStartY(int aY)
Definition: pcb_track.h:125
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:958
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:528
void SetEndX(int aX)
Definition: pcb_track.h:130
int GetStartX() const
Definition: pcb_track.h:127
int m_width
Thickness of track (or arc) – no longer the width of a via.
Definition: pcb_track.h:273
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: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:1651
void SetRemoveUnconnected(bool aSet)
Definition: pcb_track.h:529
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:642
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:1189
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:493
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:905
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:1931
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:492
bool GetRemoveUnconnected() const
Definition: pcb_track.h:536
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:1225
void SetKeepStartEnd(bool aSet)
Definition: pcb_track.h:545
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:630
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
Definition: pcb_track.h:679
void ClearZoneLayerOverrides()
Definition: pcb_track.cpp:1272
const PADSTACK & Padstack() const
Definition: pcb_track.h:412
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:618
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:676
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:1731
TENTING_MODE GetFrontTentingMode() const
Definition: pcb_track.cpp:870
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1155
PADSTACK & Padstack()
Definition: pcb_track.h:413
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:928
void SetDrill(int aDrill)
Set the drill value for vias.
Definition: pcb_track.h:608
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:643
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:1614
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:1021
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1457
std::mutex m_zoneLayerOverridesMutex
Definition: pcb_track.h:678
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:1149
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:494
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:853
int GetFrontWidth() const
Definition: pcb_track.h:426
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:1140
bool HasDrilledHole() const override
Definition: pcb_track.h:433
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:386
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:1027
bool GetKeepStartEnd() const
Definition: pcb_track.h:552
virtual void SetLayerSet(const LSET &aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
Definition: pcb_track.cpp:1098
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
Definition: pcb_track.cpp:1296
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:378
bool HasHole() const override
Definition: pcb_track.h:428
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:1195
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:1840
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:501
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:558
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:1678
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition: pcb_track.cpp:1422
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:410
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:976
TENTING_MODE GetBackTentingMode() const
Definition: pcb_track.cpp:893
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:1183
VIATYPE m_viaType
through, blind/buried or micro
Definition: pcb_track.h:672
PADSTACK m_padStack
Definition: pcb_track.h:674
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:1289
void SetFrontWidth(int aWidth)
Definition: pcb_track.h:425
VIATYPE GetViaType() const
Definition: pcb_track.h:409
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
Definition: pcb_track.cpp:546
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:1062
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition: pcb_track.cpp:1281
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:1161
bool HasValidLayerPair(int aCopperLayerCount)
Definition: pcb_track.cpp:999
void SetPadstack(const PADSTACK &aPadstack)
Definition: pcb_track.h:414
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
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:1902
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