KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_track.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
34
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#include <optional>
49
50class PCB_TRACK;
51class PCB_VIA;
52class PAD;
53class MSG_PANEL_ITEM;
54class SHAPE_POLY_SET;
55class SHAPE_ARC;
56
57
58// Flag used in locate routines (from which endpoint work)
59enum ENDPOINT_T : int
60{
63};
64
65// Note that this enum must be synchronized to GAL_LAYER_ID
66enum class VIATYPE : int
67{
68 THROUGH = 4, /* Always a through hole via */
69 BURIED = 3, /* this via can be on internal layers */
70 BLIND = 2, /* this via can be on internal layers */
71 MICROVIA = 1, /* this via which connect from an external layer
72 * to the near neighbor internal layer */
73 NOT_DEFINED = 0 /* not yet used */
74};
75
76enum class TENTING_MODE
77{
79 TENTED = 1,
81};
82
83enum class COVERING_MODE
84{
88};
89
90enum class PLUGGING_MODE
91{
95};
96
97enum class CAPPING_MODE
98{
102};
103
104enum class FILLING_MODE
105{
109};
110
111#define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter.
112
113// Used for tracks and vias for algorithmic safety, not to enforce constraints
114#define GEOMETRY_MIN_SIZE (int) ( 0.001 * pcbIUScale.IU_PER_MM )
115
116
118{
119public:
120 static inline bool ClassOf( const EDA_ITEM* aItem )
121 {
122 return aItem && PCB_TRACE_T == aItem->Type();
123 }
124
125 PCB_TRACK( BOARD_ITEM* aParent, KICAD_T idtype = PCB_TRACE_T );
126
127 // Do not create a copy constructor. The one generated by the compiler is adequate.
128
129 void CopyFrom( const BOARD_ITEM* aOther ) override;
130
131 void Move( const VECTOR2I& aMoveVector ) override
132 {
133 m_Start += aMoveVector;
134 m_End += aMoveVector;
135 }
136
137 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
138
139 virtual void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
140
141 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
142
143 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
144 VECTOR2I GetPosition() const override { return m_Start; }
145 const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; }
146
147 virtual void SetWidth( int aWidth ) { m_width = aWidth; }
148 virtual int GetWidth() const { return m_width; }
149
150 void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; }
151 const VECTOR2I& GetEnd() const { return m_End; }
152
153 void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; }
154 const VECTOR2I& GetStart() const { return m_Start; }
155
156 void SetStartX( int aX ) { m_Start.x = aX; }
157 void SetStartY( int aY ) { m_Start.y = aY; }
158
159 int GetStartX() const { return m_Start.x; }
160 int GetStartY() const { return m_Start.y; }
161
162 void SetEndX( int aX ) { m_End.x = aX; }
163 void SetEndY( int aY ) { m_End.y = aY; }
164
165 int GetEndX() const { return m_End.x; }
166 int GetEndY() const { return m_End.y; }
167
169 const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
170 {
171 if( aEndPoint == ENDPOINT_START )
172 return m_Start;
173 else
174 return m_End;
175 }
176
177 void SetHasSolderMask( bool aVal ) { m_hasSolderMask = aVal; }
178 bool HasSolderMask() const { return m_hasSolderMask; }
179
180 void SetLocalSolderMaskMargin( std::optional<int> aMargin ) { m_solderMaskMargin = aMargin; }
181 std::optional<int> GetLocalSolderMaskMargin() const { return m_solderMaskMargin; }
182
183 int GetSolderMaskExpansion() const;
184
185 // Virtual function
186 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
187
188 virtual LSET GetLayerSet() const override;
189 virtual void SetLayerSet( const LSET& aLayers ) override;
190
191 const BOX2I GetBoundingBox() const override;
192
198 virtual double GetLength() const;
199
205 virtual double GetDelay() const;
206
218 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
219 int aError, ERROR_LOC aErrorLoc,
220 bool ignoreLineWidth = false ) const override;
221
222 // @copydoc BOARD_ITEM::GetEffectiveShape
223 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
224 FLASHING aFlash = FLASHING::DEFAULT ) const override;
225
233 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
234
238 bool IsNull() const
239 {
240 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
241 }
242
243 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
244 wxString GetFriendlyName() const override;
245
246 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
247 const std::vector<KICAD_T>& aScanTypes ) override;
248
249 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
250 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
251 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
252
253 bool ApproxCollinear( const PCB_TRACK& aTrack );
254
255 wxString GetClass() const override
256 {
257 return wxT( "PCB_TRACK" );
258 }
259
260 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
261
262 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
263
264 BITMAPS GetMenuImage() const override;
265
266 virtual EDA_ITEM* Clone() const override;
267
268 virtual std::vector<int> ViewGetLayers() const override;
269
270 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
271
272 const BOX2I ViewBBox() const override;
273
277 bool IsOnCopperLayer() const override
278 {
279 return true;
280 }
281
282 virtual double Similarity( const BOARD_ITEM& aOther ) const override;
283
284 virtual bool operator==( const BOARD_ITEM& aOther ) const override;
285 virtual bool operator==( const PCB_TRACK& aOther ) const;
286
288 {
289 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
290 };
291
292 void Serialize( google::protobuf::Any &aContainer ) const override;
293 bool Deserialize( const google::protobuf::Any &aContainer ) override;
294
295#if defined (DEBUG)
296 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
297#endif
298
299protected:
300 virtual void swapData( BOARD_ITEM* aImage ) override;
301
303 std::vector<MSG_PANEL_ITEM>& aList ) const;
304
305protected:
308
310 std::optional<int> m_solderMaskMargin;
311
312private:
314};
315
316
317class PCB_ARC : public PCB_TRACK
318{
319public:
320 PCB_ARC( BOARD_ITEM* aParent ) :
321 PCB_TRACK( aParent, PCB_ARC_T )
322 { }
323
324 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
325
326 void CopyFrom( const BOARD_ITEM* aOther ) override;
327
328 static inline bool ClassOf( const EDA_ITEM *aItem )
329 {
330 return aItem && PCB_ARC_T == aItem->Type();
331 }
332
333 virtual void Move( const VECTOR2I& aMoveVector ) override
334 {
335 m_Start += aMoveVector;
336 m_Mid += aMoveVector;
337 m_End += aMoveVector;
338 }
339
340 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
341
342 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
343
344 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
345
346 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
347 const VECTOR2I& GetMid() const { return m_Mid; }
348
349 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
350
351 virtual VECTOR2I GetPosition() const override;
352 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
353
354 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
355
356 double GetRadius() const;
357 EDA_ANGLE GetAngle() const;
359 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
360 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
361
362 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
363 int aAccuracy = 0 ) const override;
364
365 bool IsCCW() const;
366
367 wxString GetClass() const override
368 {
369 return wxT( "PCB_ARC" );
370 }
371
372 // @copydoc BOARD_ITEM::GetEffectiveShape
373 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
374 FLASHING aFlash = FLASHING::DEFAULT ) const override;
375
381 virtual double GetLength() const override
382 {
383 return GetRadius() * std::abs( GetAngle().AsRadians() );
384 }
385
386 EDA_ITEM* Clone() const override;
387
394 bool IsDegenerated( int aThreshold = 5 ) const;
395
396 double Similarity( const BOARD_ITEM& aOther ) const override;
397
398 bool operator==( const PCB_ARC& aOther ) const;
399 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
400
401 void Serialize( google::protobuf::Any &aContainer ) const override;
402 bool Deserialize( const google::protobuf::Any &aContainer ) override;
403
404protected:
405 virtual void swapData( BOARD_ITEM* aImage ) override;
406
407private:
408 // Silence GCC warning about overriding the base class method
409 bool operator==( const PCB_TRACK& aOther ) const override;
410
412};
413
414
415class PCB_VIA : public PCB_TRACK
416{
417public:
418 PCB_VIA( BOARD_ITEM* aParent );
419
420 static inline bool ClassOf( const EDA_ITEM *aItem )
421 {
422 return aItem && PCB_VIA_T == aItem->Type();
423 }
424
425 PCB_VIA( const PCB_VIA& aOther );
426 PCB_VIA& operator=( const PCB_VIA &aOther );
427
428 void CopyFrom( const BOARD_ITEM* aOther ) override;
429
430 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
431 {
432 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
433 return true;
434
435 for( KICAD_T scanType : aScanTypes )
436 {
437 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
438 return true;
439 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
440 return true;
441 else if( scanType == PCB_LOCATE_BLINDVIA_T && m_viaType == VIATYPE::BLIND )
442 return true;
443 else if( scanType == PCB_LOCATE_BURIEDVIA_T && m_viaType == VIATYPE::BURIED )
444 return true;
445 }
446
447 return false;
448 }
449
453 bool HasValidLayerPair( int aCopperLayerCount );
454
455 VIATYPE GetViaType() const { return m_viaType; }
456 void SetViaType( VIATYPE aViaType )
457 {
458 m_viaType = aViaType;
459 // If someone updates a VIA to TH, we want to kick out any non-outer layers
461 }
462
463 const PADSTACK& Padstack() const { return m_padStack; }
465 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
466
467 bool IsMicroVia() const;
468 bool IsBlindVia() const;
469 bool IsBuriedVia() const;
470
485
486 static std::optional<VIA_PARAMETER_ERROR>
487 ValidateViaParameters( std::optional<int> aDiameter,
488 std::optional<int> aDrill,
489 std::optional<PCB_LAYER_ID> aStartLayer = std::nullopt,
490 std::optional<PCB_LAYER_ID> aEndLayer = std::nullopt );
491
492 const BOX2I GetBoundingBox() const override;
493 const BOX2I GetBoundingBox( PCB_LAYER_ID aLayer ) const;
494
495 void SetWidth( int aWidth ) override;
496 int GetWidth() const override;
497
498 void SetWidth( PCB_LAYER_ID aLayer, int aWidth );
499 int GetWidth( PCB_LAYER_ID aLayer ) const;
500
501 // For properties panel
502 void SetFrontWidth( int aWidth ) { SetWidth( F_Cu, aWidth ); }
503 int GetFrontWidth() const { return GetWidth( F_Cu ); }
504
505 bool HasHole() const override
506 {
507 return true;
508 }
509
510 bool HasDrilledHole() const override
511 {
513 }
514
515 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
516
517 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
518 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
519
520 void SetFrontTentingMode( TENTING_MODE aMode );
522 void SetBackTentingMode( TENTING_MODE aMode );
524
529
534
535 void SetCappingMode( CAPPING_MODE aMode );
537
538 void SetFillingMode( FILLING_MODE aMode );
540
541 bool IsTented( PCB_LAYER_ID aLayer ) const override;
542 int GetSolderMaskExpansion() const;
543
544 PCB_LAYER_ID GetLayer() const override;
545 void SetLayer( PCB_LAYER_ID aLayer ) override;
546
547 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
548
549 virtual LSET GetLayerSet() const override;
550
555 virtual void SetLayerSet( const LSET& aLayers ) override;
556
563 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
564
565 void SetBottomLayer( PCB_LAYER_ID aLayer );
566 void SetTopLayer( PCB_LAYER_ID aLayer );
567
575 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
576
577 PCB_LAYER_ID TopLayer() const;
579
584 void SanitizeLayers();
585
586 VECTOR2I GetPosition() const override { return m_Start; }
587 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
588
589 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
590
591 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
592 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
593
594 wxString GetClass() const override
595 {
596 return wxT( "PCB_VIA" );
597 }
598
599 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
600
601 BITMAPS GetMenuImage() const override;
602
603 EDA_ITEM* Clone() const override;
604
605 std::vector<int> ViewGetLayers() const override;
606
607 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
608
609 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
610
611#if defined (DEBUG)
612 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
613#endif
614
615 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
616
622 void SetRemoveUnconnected( bool aSet )
623 {
624 m_padStack.SetUnconnectedLayerMode( aSet
627 }
628
630 {
631 return m_padStack.UnconnectedLayerMode() != PADSTACK::UNCONNECTED_LAYER_MODE::KEEP_ALL;
632 }
633
644
645 bool GetKeepStartEnd() const
646 {
647 return m_padStack.UnconnectedLayerMode()
649 }
650
652 {
653 switch( m_padStack.UnconnectedLayerMode() )
654 {
656 return false;
657
659 return true;
660
663 return aLayer != m_padStack.Drill().start && aLayer != m_padStack.Drill().end;
664 }
665
666 return true;
667 }
668
675 bool FlashLayer( int aLayer ) const;
676
684 bool FlashLayer( const LSET& aLayers ) const;
685
692 PCB_LAYER_ID* aBottommost ) const;
693
699 void SetDrill( int aDrill )
700 {
701 m_padStack.Drill().size = { aDrill, aDrill };
702 }
703
709 int GetDrill() const { return m_padStack.Drill().size.x; }
710
716 int GetDrillValue() const;
717
725
733 bool GetIsFree() const { return m_isFree; }
734 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
735
736 // @copydoc BOARD_ITEM::GetEffectiveShape
737 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
738 FLASHING aFlash = FLASHING::DEFAULT ) const override;
739
741
743
744 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
745
746 double Similarity( const BOARD_ITEM& aOther ) const override;
747
748 bool operator==( const PCB_VIA& aOther ) const;
749 bool operator==( const BOARD_ITEM& aOther ) const override;
750
751 void Serialize( google::protobuf::Any &aContainer ) const override;
752 bool Deserialize( const google::protobuf::Any &aContainer ) override;
753
754protected:
755 void swapData( BOARD_ITEM* aImage ) override;
756
757 wxString layerMaskDescribe() const override;
758
759private:
760 // Silence GCC warning about hiding the PCB_TRACK base method
761 bool operator==( const PCB_TRACK& aOther ) const override;
762
764
766
767 bool m_isFree;
768
770 std::map<PCB_LAYER_ID, ZONE_LAYER_OVERRIDE> m_zoneLayerOverrides;
771};
772
773
774#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...
BITMAPS
A list of all bitmap identifiers.
ZONE_LAYER_OVERRIDE
Conditionally flashed vias and pads that interact with zones of different priority can be very squirr...
Definition board_item.h:67
BOX2< VECTOR2I > BOX2I
Definition box2.h:922
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:79
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:81
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:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition eda_item.h:192
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:39
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:66
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
EDA_MSG_PANEL items for displaying messages.
Definition msgpanel.h:54
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
Definition padstack.h:125
Definition pad.h:54
virtual VECTOR2I GetPosition() const override
bool IsDegenerated(int aThreshold=5) const
virtual void swapData(BOARD_ITEM *aImage) override
bool IsCCW() const
virtual double GetLength() const override
Return the length of the arc track.
Definition pcb_track.h:381
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition pcb_track.cpp:93
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
EDA_ANGLE GetArcAngleStart() const
void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
virtual bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
EDA_ANGLE GetArcAngleEnd() const
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition pcb_track.h:352
void SetPosition(const VECTOR2I &aPos) override
Definition pcb_track.h:349
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition pcb_track.h:333
wxString GetClass() const override
Return the class name.
Definition pcb_track.h:367
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void SetMid(const VECTOR2I &aMid)
Definition pcb_track.h:346
double GetRadius() const
EDA_ANGLE GetAngle() const
const VECTOR2I & GetMid() const
Definition pcb_track.h:347
PCB_ARC(BOARD_ITEM *aParent)
Definition pcb_track.h:320
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition pcb_track.h:411
static bool ClassOf(const EDA_ITEM *aItem)
Definition pcb_track.h:328
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
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.
bool operator==(const PCB_ARC &aOther) const
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition pcb_track.h:354
void CopyFrom(const BOARD_ITEM *aOther) override
Definition pcb_track.cpp:99
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
virtual void SetLayerSet(const LSET &aLayers) override
int GetSolderMaskExpansion() const
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void SetEndY(int aY)
Definition pcb_track.h:163
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition pcb_track.h:145
bool IsOnCopperLayer() const override
Definition pcb_track.h:277
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition pcb_track.h:131
wxString GetClass() const override
Return the class name.
Definition pcb_track.h:255
void SetHasSolderMask(bool aVal)
Definition pcb_track.h:177
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
virtual void swapData(BOARD_ITEM *aImage) override
void SetEnd(const VECTOR2I &aEnd)
Definition pcb_track.h:150
bool HasSolderMask() const
Definition pcb_track.h:178
void SetStart(const VECTOR2I &aStart)
Definition pcb_track.h:153
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
int GetStartY() const
Definition pcb_track.h:160
int GetEndX() const
Definition pcb_track.h:165
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
virtual void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
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...
bool ApproxCollinear(const PCB_TRACK &aTrack)
VECTOR2I m_End
Line end point.
Definition pcb_track.h:307
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition pcb_track.h:180
std::optional< int > m_solderMaskMargin
Definition pcb_track.h:310
void CopyFrom(const BOARD_ITEM *aOther) override
Definition pcb_track.cpp:77
void SetPosition(const VECTOR2I &aPos) override
Definition pcb_track.h:143
std::optional< int > GetLocalSolderMaskMargin() const
Definition pcb_track.h:181
virtual double GetDelay() const
Get the time delay of the track.
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.
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition pcb_track.cpp:71
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
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.
const VECTOR2I & GetStart() const
Definition pcb_track.h:154
virtual bool operator==(const BOARD_ITEM &aOther) const override
VECTOR2I m_Start
Line start point.
Definition pcb_track.h:306
int GetEndY() const
Definition pcb_track.h:166
wxString GetFriendlyName() const override
VECTOR2I GetPosition() const override
Definition pcb_track.h:144
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
const VECTOR2I & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition pcb_track.h:169
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
static bool ClassOf(const EDA_ITEM *aItem)
Definition pcb_track.h:120
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
bool IsNull() const
Return true if segment length is zero.
Definition pcb_track.h:238
virtual double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
bool m_hasSolderMask
Definition pcb_track.h:309
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.
void SetStartX(int aX)
Definition pcb_track.h:156
const VECTOR2I & GetEnd() const
Definition pcb_track.h:151
PCB_TRACK(BOARD_ITEM *aParent, KICAD_T idtype=PCB_TRACE_T)
Definition pcb_track.cpp:63
void SetStartY(int aY)
Definition pcb_track.h:157
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
void SetEndX(int aX)
Definition pcb_track.h:162
int GetStartX() const
Definition pcb_track.h:159
int m_width
Thickness of track (or arc) – no longer the width of a via.
Definition pcb_track.h:313
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...
virtual void SetWidth(int aWidth)
Definition pcb_track.h:147
virtual int GetWidth() const
Definition pcb_track.h:148
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
void SetRemoveUnconnected(bool aSet)
Definition pcb_track.h:622
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:733
PCB_LAYER_ID BottomLayer() const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
PLUGGING_MODE GetFrontPluggingMode() const
VECTOR2I GetPosition() const override
Definition pcb_track.h:586
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 ...
void CopyFrom(const BOARD_ITEM *aOther) override
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.
void SetCappingMode(CAPPING_MODE aMode)
void SetFrontCoveringMode(COVERING_MODE aMode)
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
COVERING_MODE GetBackCoveringMode() const
bool GetRemoveUnconnected() const
Definition pcb_track.h:629
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
void SetKeepStartEnd(bool aSet)
Definition pcb_track.h:638
static std::optional< VIA_PARAMETER_ERROR > ValidateViaParameters(std::optional< int > aDiameter, std::optional< int > aDrill, std::optional< PCB_LAYER_ID > aStartLayer=std::nullopt, std::optional< PCB_LAYER_ID > aEndLayer=std::nullopt)
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition pcb_track.h:721
std::map< PCB_LAYER_ID, ZONE_LAYER_OVERRIDE > m_zoneLayerOverrides
Definition pcb_track.h:770
void ClearZoneLayerOverrides()
CAPPING_MODE GetCappingMode() const
const PADSTACK & Padstack() const
Definition pcb_track.h:463
void SetFrontTentingMode(TENTING_MODE aMode)
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition pcb_track.h:709
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition pcb_track.h:767
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
bool IsBlindVia() const
TENTING_MODE GetFrontTentingMode() const
void SetBottomLayer(PCB_LAYER_ID aLayer)
PADSTACK & Padstack()
Definition pcb_track.h:464
int GetSolderMaskExpansion() const
void SetDrill(int aDrill)
Set the drill value for vias.
Definition pcb_track.h:699
PLUGGING_MODE GetBackPluggingMode() const
void SetBackPluggingMode(PLUGGING_MODE aMode)
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
void SetBackTentingMode(TENTING_MODE aMode)
void SetIsFree(bool aFree=true)
Definition pcb_track.h:734
void SetFrontPluggingMode(PLUGGING_MODE aMode)
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
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.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
bool operator==(const PCB_VIA &aOther) const
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
std::mutex m_zoneLayerOverridesMutex
Definition pcb_track.h:769
void SetTopLayer(PCB_LAYER_ID aLayer)
FILLING_MODE GetFillingMode() const
void SetPosition(const VECTOR2I &aPoint) override
Definition pcb_track.h:587
bool IsBuriedVia() const
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
int GetFrontWidth() const
Definition pcb_track.h:503
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/.
bool HasDrilledHole() const override
Definition pcb_track.h:510
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition pcb_track.h:430
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
bool IsMicroVia() const
bool GetKeepStartEnd() const
Definition pcb_track.h:645
virtual void SetLayerSet(const LSET &aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
static bool ClassOf(const EDA_ITEM *aItem)
Definition pcb_track.h:420
bool HasHole() const override
Definition pcb_track.h:505
void SanitizeLayers()
Check so that the layers are correct depending on the type of via, and so that the top actually is on...
int GetWidth() const override
PCB_VIA & operator=(const PCB_VIA &aOther)
void swapData(BOARD_ITEM *aImage) override
wxString GetClass() const override
Return the class name.
Definition pcb_track.h:594
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void SetFillingMode(FILLING_MODE aMode)
PCB_VIA(BOARD_ITEM *aParent)
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition pcb_track.h:651
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
void SetViaType(VIATYPE aViaType)
Definition pcb_track.h:456
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
TENTING_MODE GetBackTentingMode() const
PCB_LAYER_ID TopLayer() const
VIATYPE m_viaType
through, blind/buried or micro
Definition pcb_track.h:763
PADSTACK m_padStack
Definition pcb_track.h:765
COVERING_MODE GetFrontCoveringMode() const
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
void SetFrontWidth(int aWidth)
Definition pcb_track.h:502
VIATYPE GetViaType() const
Definition pcb_track.h:455
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
void SetWidth(int aWidth) override
void SetBackCoveringMode(COVERING_MODE aMode)
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
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)
bool HasValidLayerPair(int aCopperLayerCount)
void SetPadstack(const PADSTACK &aPadstack)
Definition pcb_track.h:465
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
INSPECT_RESULT
Definition eda_item.h:44
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition eda_item.h:91
std::uint32_t EDA_ITEM_FLAGS
static const bool NOT_FILLED
Definition gr_basic.cpp:31
static const bool FILLED
Definition gr_basic.cpp:30
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition layer_ids.h:184
@ DEFAULT
Flashing follows connectivity.
Definition layer_ids.h:185
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:400
FILLING_MODE
Definition pcb_track.h:105
VIATYPE
Definition pcb_track.h:67
@ THROUGH
Definition pcb_track.h:68
@ NOT_DEFINED
Definition pcb_track.h:73
@ MICROVIA
Definition pcb_track.h:71
TENTING_MODE
Definition pcb_track.h:77
COVERING_MODE
Definition pcb_track.h:84
ENDPOINT_T
Definition pcb_track.h:60
@ ENDPOINT_END
Definition pcb_track.h:62
@ ENDPOINT_START
Definition pcb_track.h:61
PLUGGING_MODE
Definition pcb_track.h:91
#define UNDEFINED_DRILL_DIAMETER
Definition pcb_track.h:111
CAPPING_MODE
Definition pcb_track.h:98
@ MICROVIA
Microvia.
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
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_BLINDVIA_T
Definition typeinfo.h:128
@ PCB_LOCATE_STDVIA_T
Definition typeinfo.h:126
@ PCB_LOCATE_BURIEDVIA_T
Definition typeinfo.h:129
@ 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:127
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition typeinfo.h:96
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:695