KiCad PCB EDA Suite
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-2022 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>
41#include <base_units.h>
43#include <core/minoptmax.h>
44#include <core/arraydim.h>
45
46class PCB_TRACK;
47class PCB_VIA;
48class PAD;
49class MSG_PANEL_ITEM;
50class SHAPE_POLY_SET;
51class SHAPE_ARC;
52
53
54// Flag used in locate routines (from which endpoint work)
55enum ENDPOINT_T : int
56{
58 ENDPOINT_END = 1
59};
60
61// Via types
62// Note that this enum must be synchronized to GAL_LAYER_ID
63enum class VIATYPE : int
64{
65 THROUGH = 3, /* Always a through hole via */
66 BLIND_BURIED = 2, /* this via can be on internal layers */
67 MICROVIA = 1, /* this via which connect from an external layer
68 * to the near neighbor internal layer */
69 NOT_DEFINED = 0 /* not yet used */
70};
71
72#define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter.
73
74// Used for tracks and vias for algorithmic safety, not to enforce constraints
75#define GEOMETRY_MIN_SIZE (int) ( 0.001 * pcbIUScale.IU_PER_MM )
76
77
79{
80public:
81 static inline bool ClassOf( const EDA_ITEM* aItem )
82 {
83 return aItem && PCB_TRACE_T == aItem->Type();
84 }
85
86 PCB_TRACK( BOARD_ITEM* aParent, KICAD_T idtype = PCB_TRACE_T );
87
88 // Do not create a copy constructor. The one generated by the compiler is adequate.
89
90 void Move( const VECTOR2I& aMoveVector ) override
91 {
92 m_Start += aMoveVector;
93 m_End += aMoveVector;
94 }
95
96 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
97
98 virtual void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis );
99
100 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
101
102 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
103 VECTOR2I GetPosition() const override { return m_Start; }
104 const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; }
105
106 void SetWidth( int aWidth ) { m_Width = aWidth; }
107 int GetWidth() const { return m_Width; }
108
109 void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; }
110 const VECTOR2I& GetEnd() const { return m_End; }
111
112 void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; }
113 const VECTOR2I& GetStart() const { return m_Start; }
114
115 void SetEndX( int aX ) { m_End.x = aX; }
116 void SetEndY( int aY ) { m_End.y = aY; }
117
118 int GetEndX() const { return m_End.x; }
119 int GetEndY() const { return m_End.y; }
120
122 const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
123 {
124 if( aEndPoint == ENDPOINT_START )
125 return m_Start;
126 else
127 return m_End;
128 }
129
130 // Virtual function
131 const BOX2I GetBoundingBox() const override;
132
138 virtual double GetLength() const;
139
151 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
152 int aError, ERROR_LOC aErrorLoc,
153 bool ignoreLineWidth = false ) const override;
154
155 // @copydoc BOARD_ITEM::GetEffectiveShape
156 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
157 FLASHING aFlash = FLASHING::DEFAULT ) const override;
158
166 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
167
172 bool IsNull() const
173 {
174 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
175 }
176
177 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
178 wxString GetFriendlyName() const override;
179
180 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
181 const std::vector<KICAD_T>& aScanTypes ) override;
182
183 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
184 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
185
186 bool ApproxCollinear( const PCB_TRACK& aTrack );
187
188 wxString GetClass() const override
189 {
190 return wxT( "PCB_TRACK" );
191 }
192
199 int GetLocalClearance( wxString* aSource ) const override;
200
201 MINOPTMAX<int> GetWidthConstraint( wxString* aSource ) const;
202
203 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
204
205 BITMAPS GetMenuImage() const override;
206
207 virtual EDA_ITEM* Clone() const override;
208
209 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
210
211 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
212
213 const BOX2I ViewBBox() const override;
214
218 bool IsOnCopperLayer() const override
219 {
220 return true;
221 }
222
228 {
229 return m_CachedLOD;
230 }
231
236 void SetCachedLOD( double aLOD )
237 {
238 m_CachedLOD = aLOD;
239 }
240
246 {
247 return m_CachedScale;
248 }
249
254 void SetCachedScale( double aScale )
255 {
256 m_CachedScale = aScale;
257 }
258
260 {
261 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
262 };
263
264#if defined (DEBUG)
265 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
266#endif
267
268protected:
269 virtual void swapData( BOARD_ITEM* aImage ) override;
270
271 void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) const;
272
273protected:
277
278 double m_CachedLOD;
280};
281
282
283class PCB_ARC : public PCB_TRACK
284{
285public:
286 PCB_ARC( BOARD_ITEM* aParent ) :
287 PCB_TRACK( aParent, PCB_ARC_T )
288 {
289 };
290
291 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
292
293 static inline bool ClassOf( const EDA_ITEM *aItem )
294 {
295 return aItem && PCB_ARC_T == aItem->Type();
296 }
297
298 virtual void Move( const VECTOR2I& aMoveVector ) override
299 {
300 m_Start += aMoveVector;
301 m_Mid += aMoveVector;
302 m_End += aMoveVector;
303 }
304
305 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
306
307 void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ) override;
308
309 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
310
311 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
312 const VECTOR2I& GetMid() const { return m_Mid; }
313
314 void SetPosition( const VECTOR2I& aPos ) override
315 {
316 m_Start = aPos;
317 }
318
319 virtual VECTOR2I GetPosition() const override;
320
321 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
322
323 double GetRadius() const;
324 EDA_ANGLE GetAngle() const;
327 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
328
329 virtual bool HitTest( const BOX2I& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
330
331 bool IsCCW() const;
332
333 wxString GetClass() const override
334 {
335 return wxT( "PCB_ARC" );
336 }
337
338 // @copydoc BOARD_ITEM::GetEffectiveShape
339 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
340 FLASHING aFlash = FLASHING::DEFAULT ) const override;
341
347 virtual double GetLength() const override
348 {
349 return GetRadius() * std::abs( GetAngle().AsRadians() );
350 }
351
352 EDA_ITEM* Clone() const override;
353
354protected:
355 virtual void swapData( BOARD_ITEM* aImage ) override;
356
357private:
359};
360
361
362class PCB_VIA : public PCB_TRACK
363{
364public:
365 PCB_VIA( BOARD_ITEM* aParent );
366
367 static inline bool ClassOf( const EDA_ITEM *aItem )
368 {
369 return aItem && PCB_VIA_T == aItem->Type();
370 }
371
372 PCB_VIA( const PCB_VIA& aOther );
373 PCB_VIA& operator=( const PCB_VIA &aOther );
374
375 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
376 {
377 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
378 return true;
379
380 for( KICAD_T scanType : aScanTypes )
381 {
382 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
383 return true;
384 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
385 return true;
386 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
387 return true;
388 }
389
390 return false;
391 }
392
393 VIATYPE GetViaType() const { return m_viaType; }
394 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
395
396 bool HasHole() const override
397 {
398 return true;
399 }
400
401 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
402
403 bool IsTented() const override;
404 int GetSolderMaskExpansion() const;
405
406 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
407
408 virtual LSET GetLayerSet() const override;
409 virtual void SetLayerSet( LSET aLayers ) override;
410
417 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
418
419 void SetBottomLayer( PCB_LAYER_ID aLayer );
420 void SetTopLayer( PCB_LAYER_ID aLayer );
421
429 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
430
431 PCB_LAYER_ID TopLayer() const;
433
439 void SanitizeLayers();
440
441 VECTOR2I GetPosition() const override { return m_Start; }
442 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
443
444 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
445
446 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
447 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
448
449 wxString GetClass() const override
450 {
451 return wxT( "PCB_VIA" );
452 }
453
454 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
455
456 BITMAPS GetMenuImage() const override;
457
458 EDA_ITEM* Clone() const override;
459
460 void ViewGetLayers( int aLayers[], int& aCount ) const override;
461
462 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
463
464 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
465
466#if defined (DEBUG)
467 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
468#endif
469
470 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
471
476 void SetRemoveUnconnected( bool aSet ) { m_removeUnconnectedLayer = aSet; }
478
482 void SetKeepStartEnd( bool aSet ) { m_keepStartEndLayer = aSet; }
483 bool GetKeepStartEnd() const { return m_keepStartEndLayer; }
484
486 {
488 return false;
489
490 if( m_keepStartEndLayer && ( aLayer == m_layer || aLayer == m_bottomLayer ) )
491 return false;
492
493 return true;
494 }
495
501 bool FlashLayer( int aLayer ) const;
502
508 bool FlashLayer( LSET aLayers ) const;
509
515 void SetDrill( int aDrill ) { m_drill = aDrill; }
516
522 int GetDrill() const { return m_drill; }
523
530 int GetDrillValue() const;
531
537
543 bool GetIsFree() const { return m_isFree; }
544 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
545
550 bool IsDrillDefault() const { return m_drill <= 0; }
551
552 // @copydoc BOARD_ITEM::GetEffectiveShape
553 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
554 FLASHING aFlash = FLASHING::DEFAULT ) const override;
555
557 {
558 for( size_t ii = 0; ii < arrayDim( m_zoneLayerConnections ); ++ii )
560 }
561
563 {
564 return m_zoneLayerConnections[ aLayer ];
565 }
566
568 {
569 std::unique_lock<std::mutex> cacheLock( m_zoneLayerConnectionsMutex );
570 m_zoneLayerConnections[ aLayer ] = aConnection;
571 }
572
573protected:
574 void swapData( BOARD_ITEM* aImage ) override;
575
576 wxString layerMaskDescribe() const override;
577
578private:
581
583
585
588 bool m_isFree;
589
592};
593
594
595#endif // CLASS_TRACK_H
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
Definition: arraydim.h:31
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
ZONE_LAYER_CONNECTION
Definition: board_item.h:45
@ ZLC_UNRESOLVED
Definition: board_item.h:46
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:58
PCB_LAYER_ID m_layer
Definition: board_item.h:329
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:85
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:181
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:69
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:530
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
Definition: pad.h:59
virtual VECTOR2I GetPosition() const override
Definition: pcb_track.cpp:1140
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1125
bool IsCCW() const
Definition: pcb_track.cpp:406
virtual double GetLength() const override
Function GetLength returns the length of the arc track.
Definition: pcb_track.h:347
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:76
EDA_ANGLE GetArcAngleStart() const
Definition: pcb_track.cpp:1161
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:1011
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:1167
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:314
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:298
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:333
void SetMid(const VECTOR2I &aMid)
Definition: pcb_track.h:311
double GetRadius() const
Definition: pcb_track.cpp:1146
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:1152
const VECTOR2I & GetMid() const
Definition: pcb_track.h:312
PCB_ARC(BOARD_ITEM *aParent)
Definition: pcb_track.h:286
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:386
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition: pcb_track.h:358
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:293
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:328
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:1212
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_track.h:321
void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis) override
Definition: pcb_track.cpp:351
double m_CachedScale
Last zoom scale used to draw this track's net (we want to redraw when changing zoom)
Definition: pcb_track.h:279
double m_CachedLOD
Last LOD used to draw this track's net.
Definition: pcb_track.h:278
double GetCachedScale()
Get last used zoom scale for the track net name.
Definition: pcb_track.h:245
double GetCachedLOD()
Get last used LOD for the track net name.
Definition: pcb_track.h:227
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:321
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:669
int GetLocalClearance(wxString *aSource) const override
Function GetLocalClearance returns any local clearance overrides set in the "classic" (ie: pre-rule) ...
Definition: pcb_track.cpp:166
void SetCachedScale(double aScale)
Set the cached scale.
Definition: pcb_track.h:254
void SetEndY(int aY)
Definition: pcb_track.h:116
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:104
bool IsOnCopperLayer() const override
Definition: pcb_track.h:218
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:90
void SetWidth(int aWidth)
Definition: pcb_track.h:106
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:188
MINOPTMAX< int > GetWidthConstraint(wxString *aSource) const
Definition: pcb_track.cpp:173
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:681
virtual double GetLength() const
Function GetLength returns the length of the track using the hypotenuse calculation.
Definition: pcb_track.cpp:315
int GetWidth() const
Definition: pcb_track.h:107
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1118
void SetEnd(const VECTOR2I &aEnd)
Definition: pcb_track.h:109
void SetStart(const VECTOR2I &aStart)
Definition: pcb_track.h:112
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:1103
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pcb_track.cpp:746
int GetEndX() const
Definition: pcb_track.h:118
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:442
bool ApproxCollinear(const PCB_TRACK &aTrack)
Definition: pcb_track.cpp:158
VECTOR2I m_End
Line end point.
Definition: pcb_track.h:276
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:102
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:864
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:61
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:269
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Function TransformShapeToPolygon Convert the track shape to a closed polygon Used in filling zones ca...
Definition: pcb_track.cpp:1218
const VECTOR2I & GetStart() const
Definition: pcb_track.h:113
VECTOR2I m_Start
Line start point.
Definition: pcb_track.h:275
int GetEndY() const
Definition: pcb_track.h:119
wxString GetFriendlyName() const override
Definition: pcb_track.cpp:852
VECTOR2I GetPosition() const override
Definition: pcb_track.h:103
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:1113
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:368
void SetCachedLOD(double aLOD)
Set the cached LOD.
Definition: pcb_track.h:236
const VECTOR2I & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: pcb_track.h:122
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:1005
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:81
bool IsNull() const
Function IsNull returns true if segment length is zero.
Definition: pcb_track.h:172
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:1192
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:110
PCB_TRACK(BOARD_ITEM *aParent, KICAD_T idtype=PCB_TRACE_T)
Definition: pcb_track.cpp:52
int m_Width
Thickness of track, or via diameter.
Definition: pcb_track.h:274
void SetEndX(int aX)
Definition: pcb_track.h:115
virtual void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis)
Definition: pcb_track.cpp:336
EDA_ITEM_FLAGS IsPointOnEnds(const VECTOR2I &point, int min_dist=0) const
Function IsPointOnEnds returns STARTPOINT if point if near (dist = min_dist) start point,...
Definition: pcb_track.cpp:237
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
Definition: pcb_track.cpp:966
void SetRemoveUnconnected(bool aSet)
Sets the unconnected removal property.
Definition: pcb_track.h:476
bool IsTented() const override
Definition: pcb_track.cpp:464
bool GetIsFree() const
Checks if the via is a free via (as opposed to one created on a track by the router).
Definition: pcb_track.h:543
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:600
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:152
VECTOR2I GetPosition() const override
Definition: pcb_track.h:441
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:1198
bool GetRemoveUnconnected() const
Definition: pcb_track.h:477
bool FlashLayer(int aLayer) const
Checks to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:631
void SetKeepStartEnd(bool aSet)
Sets whether we keep the start and end annular rings even if they are not connected.
Definition: pcb_track.h:482
void SetDrillDefault()
Function SetDrillDefault sets the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:536
PCB_LAYER_ID m_bottomLayer
The bottom layer of the via (the top layer is in m_layer)
Definition: pcb_track.h:580
int GetDrill() const
Function GetDrill returns the local drill setting for this PCB_VIA.
Definition: pcb_track.h:522
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:588
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:1047
virtual void SetLayerSet(LSET aLayers) override
Definition: pcb_track.cpp:534
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:566
const ZONE_LAYER_CONNECTION & ZoneConnectionCache(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:562
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:475
void SetDrill(int aDrill)
Function SetDrill sets the drill value for vias.
Definition: pcb_track.h:515
ZONE_LAYER_CONNECTION m_zoneLayerConnections[B_Cu+1]
Definition: pcb_track.h:591
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:544
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:931
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:129
int m_drill
for vias: via drill (- 1 for default value)
Definition: pcb_track.h:584
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:782
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:560
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:442
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:458
void SetLayerPair(PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer)
Function SetLayerPair For a via m_layer contains the top layer, the other layer is in m_bottomLayer.
Definition: pcb_track.cpp:551
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pcb_track.h:375
void SetZoneConnectionCache(PCB_LAYER_ID aLayer, ZONE_LAYER_CONNECTION aConnection)
Definition: pcb_track.h:567
bool m_removeUnconnectedLayer
Remove annular rings on unconnected layers.
Definition: pcb_track.h:586
bool GetKeepStartEnd() const
Definition: pcb_track.h:483
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:367
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:760
bool HasHole() const override
Definition: pcb_track.h:396
void SanitizeLayers()
Function SanitizeLayers Check so that the layers are correct dependin on the type of via,...
Definition: pcb_track.cpp:606
PCB_VIA & operator=(const PCB_VIA &aOther)
Definition: pcb_track.cpp:108
void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1132
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:449
PCB_VIA(BOARD_ITEM *aParent)
Definition: pcb_track.cpp:82
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:485
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:993
std::mutex m_zoneLayerConnectionsMutex
Definition: pcb_track.h:590
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:394
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
Definition: pcb_track.cpp:191
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:486
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:594
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:135
VIATYPE m_viaType
through, blind/buried or micro
Definition: pcb_track.h:582
bool m_keepStartEndLayer
Keep the start and end annular rings.
Definition: pcb_track.h:587
int GetDrillValue() const
Function GetDrillValue "calculates" the drill value for vias (m-Drill if > 0, or default drill value ...
Definition: pcb_track.cpp:222
void ClearZoneConnectionCache()
Definition: pcb_track.h:556
VIATYPE GetViaType() const
Definition: pcb_track.h:393
bool IsDrillDefault() const
Function IsDrillDefault.
Definition: pcb_track.h:550
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:508
void LayerPair(PCB_LAYER_ID *top_layer, PCB_LAYER_ID *bottom_layer) const
Function LayerPair Return the 2 layers used by the via (the via actually uses all layers between thes...
Definition: pcb_track.cpp:572
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:415
Represent a set of closed polygons.
INSPECT_RESULT
Definition: eda_item.h:42
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:78
std::uint32_t EDA_ITEM_FLAGS
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
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:59
@ B_Cu
Definition: layer_ids.h:95
@ UNDEFINED_LAYER
Definition: layer_ids.h:60
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:412
VIATYPE
Definition: pcb_track.h:64
@ BLIND_BURIED
ENDPOINT_T
Definition: pcb_track.h:56
@ ENDPOINT_END
Definition: pcb_track.h:58
@ ENDPOINT_START
Definition: pcb_track.h:57
#define UNDEFINED_DRILL_DIAMETER
Definition: pcb_track.h:72
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
Definition: pcb_track.cpp:1174
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:102
@ PCB_LOCATE_BBVIA_T
Definition: typeinfo.h:122
@ PCB_LOCATE_STDVIA_T
Definition: typeinfo.h:120
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:103
@ PCB_LOCATE_UVIA_T
Definition: typeinfo.h:121
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:101