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-2023 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
47class PCB_TRACK;
48class PCB_VIA;
49class PAD;
50class MSG_PANEL_ITEM;
51class SHAPE_POLY_SET;
52class SHAPE_ARC;
53
54
55// Flag used in locate routines (from which endpoint work)
56enum ENDPOINT_T : int
57{
59 ENDPOINT_END = 1
60};
61
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
171 bool IsNull() const
172 {
173 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
174 }
175
176 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
177 wxString GetFriendlyName() const override;
178
179 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
180 const std::vector<KICAD_T>& aScanTypes ) override;
181
182 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
183 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
184
185 bool ApproxCollinear( const PCB_TRACK& aTrack );
186
187 wxString GetClass() const override
188 {
189 return wxT( "PCB_TRACK" );
190 }
191
198 int GetLocalClearance( wxString* aSource ) const override;
199
200 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
201
202 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
203
204 BITMAPS GetMenuImage() const override;
205
206 virtual EDA_ITEM* Clone() const override;
207
208 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
209
210 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
211
212 const BOX2I ViewBBox() const override;
213
217 bool IsOnCopperLayer() const override
218 {
219 return true;
220 }
221
228 {
229 return m_CachedLOD;
230 }
231
237 void SetCachedLOD( double aLOD )
238 {
239 m_CachedLOD = aLOD;
240 }
241
248 {
249 return m_CachedScale;
250 }
251
257 void SetCachedScale( double aScale )
258 {
259 m_CachedScale = aScale;
260 }
261
263 {
264 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
265 };
266
267#if defined (DEBUG)
268 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
269#endif
270
271protected:
272 virtual void swapData( BOARD_ITEM* aImage ) override;
273
275 std::vector<MSG_PANEL_ITEM>& aList ) const;
276
277protected:
281
282 double m_CachedLOD;
284};
285
286
287class PCB_ARC : public PCB_TRACK
288{
289public:
290 PCB_ARC( BOARD_ITEM* aParent ) :
291 PCB_TRACK( aParent, PCB_ARC_T )
292 { }
293
294 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
295
296 static inline bool ClassOf( const EDA_ITEM *aItem )
297 {
298 return aItem && PCB_ARC_T == aItem->Type();
299 }
300
301 virtual void Move( const VECTOR2I& aMoveVector ) override
302 {
303 m_Start += aMoveVector;
304 m_Mid += aMoveVector;
305 m_End += aMoveVector;
306 }
307
308 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
309
310 void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ) override;
311
312 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
313
314 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
315 const VECTOR2I& GetMid() const { return m_Mid; }
316
317 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
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;
326 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
327 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
328
329 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
330 int aAccuracy = 0 ) const override;
331
332 bool IsCCW() const;
333
334 wxString GetClass() const override
335 {
336 return wxT( "PCB_ARC" );
337 }
338
339 // @copydoc BOARD_ITEM::GetEffectiveShape
340 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
341 FLASHING aFlash = FLASHING::DEFAULT ) const override;
342
348 virtual double GetLength() const override
349 {
350 return GetRadius() * std::abs( GetAngle().AsRadians() );
351 }
352
353 EDA_ITEM* Clone() const override;
354
361 bool IsDegenerated( int aThreshold = 5 ) const;
362
363protected:
364 virtual void swapData( BOARD_ITEM* aImage ) override;
365
366private:
368};
369
370
371class PCB_VIA : public PCB_TRACK
372{
373public:
374 PCB_VIA( BOARD_ITEM* aParent );
375
376 static inline bool ClassOf( const EDA_ITEM *aItem )
377 {
378 return aItem && PCB_VIA_T == aItem->Type();
379 }
380
381 PCB_VIA( const PCB_VIA& aOther );
382 PCB_VIA& operator=( const PCB_VIA &aOther );
383
384 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
385 {
386 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
387 return true;
388
389 for( KICAD_T scanType : aScanTypes )
390 {
391 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
392 return true;
393 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
394 return true;
395 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
396 return true;
397 }
398
399 return false;
400 }
401
402 VIATYPE GetViaType() const { return m_viaType; }
403 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
404
405 bool HasHole() const override
406 {
407 return true;
408 }
409
410 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
411
412 bool IsTented() const override;
413 int GetSolderMaskExpansion() const;
414
415 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
416
417 virtual LSET GetLayerSet() const override;
418
423 virtual void SetLayerSet( LSET aLayers ) override;
424
431 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
432
433 void SetBottomLayer( PCB_LAYER_ID aLayer );
434 void SetTopLayer( PCB_LAYER_ID aLayer );
435
443 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
444
445 PCB_LAYER_ID TopLayer() const;
447
452 void SanitizeLayers();
453
454 VECTOR2I GetPosition() const override { return m_Start; }
455 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
456
457 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
458
459 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
460 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
461
462 wxString GetClass() const override
463 {
464 return wxT( "PCB_VIA" );
465 }
466
467 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
468
469 BITMAPS GetMenuImage() const override;
470
471 EDA_ITEM* Clone() const override;
472
473 void ViewGetLayers( int aLayers[], int& aCount ) const override;
474
475 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
476
477 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
478
479#if defined (DEBUG)
480 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
481#endif
482
483 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
484
489 void SetRemoveUnconnected( bool aSet ) { m_removeUnconnectedLayer = aSet; }
491
495 void SetKeepStartEnd( bool aSet ) { m_keepStartEndLayer = aSet; }
496 bool GetKeepStartEnd() const { return m_keepStartEndLayer; }
497
499 {
501 return false;
502
503 if( m_keepStartEndLayer && ( aLayer == m_layer || aLayer == m_bottomLayer ) )
504 return false;
505
506 return true;
507 }
508
515 bool FlashLayer( int aLayer ) const;
516
524 bool FlashLayer( LSET aLayers ) const;
525
531 void SetDrill( int aDrill ) { m_drill = aDrill; }
532
538 int GetDrill() const { return m_drill; }
539
545 int GetDrillValue() const;
546
551
559 bool GetIsFree() const { return m_isFree; }
560 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
561
562 // @copydoc BOARD_ITEM::GetEffectiveShape
563 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
564 FLASHING aFlash = FLASHING::DEFAULT ) const override;
565
567 {
569 }
570
572 {
573 return m_zoneLayerOverrides.at( aLayer );
574 }
575
577 {
578 std::unique_lock<std::mutex> cacheLock( m_zoneLayerOverridesMutex );
579 m_zoneLayerOverrides.at( aLayer ) = aOverride;
580 }
581
582protected:
583 void swapData( BOARD_ITEM* aImage ) override;
584
585 wxString layerMaskDescribe() const override;
586
587private:
590
592
594
597 bool m_isFree;
598
600 std::array<ZONE_LAYER_OVERRIDE, MAX_CU_LAYERS> m_zoneLayerOverrides;
601};
602
603
604#endif // CLASS_TRACK_H
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:64
@ ZLO_NONE
Definition: board_item.h:65
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:77
PCB_LAYER_ID m_layer
Definition: board_item.h:361
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:172
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: layer_ids.h:552
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
Definition: pad.h:58
virtual VECTOR2I GetPosition() const override
Definition: pcb_track.cpp:1136
bool IsDegenerated(int aThreshold=5) const
Definition: pcb_track.cpp:1174
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1121
bool IsCCW() const
Definition: pcb_track.cpp:404
virtual double GetLength() const override
Return the length of the arc track.
Definition: pcb_track.h:348
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:1160
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:1007
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:1168
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:317
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:301
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:334
void SetMid(const VECTOR2I &aMid)
Definition: pcb_track.h:314
double GetRadius() const
Definition: pcb_track.cpp:1143
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:1150
const VECTOR2I & GetMid() const
Definition: pcb_track.h:315
PCB_ARC(BOARD_ITEM *aParent)
Definition: pcb_track.h:290
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:384
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition: pcb_track.h:367
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:296
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:326
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:1224
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:349
double m_CachedScale
Last zoom scale used to draw this track's net.
Definition: pcb_track.h:283
double m_CachedLOD
Last LOD used to draw this track's net.
Definition: pcb_track.h:282
double GetCachedScale()
Get last used zoom scale for the track net name.
Definition: pcb_track.h:247
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:319
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:659
int GetLocalClearance(wxString *aSource) const override
Return any local clearance overrides set in the "classic" (ie: pre-rule) system.
Definition: pcb_track.cpp:164
void SetCachedScale(double aScale)
Set the cached scale.
Definition: pcb_track.h:257
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:217
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:187
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:671
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
Definition: pcb_track.cpp:313
int GetWidth() const
Definition: pcb_track.h:107
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1114
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:1099
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pcb_track.cpp:736
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:439
bool ApproxCollinear(const PCB_TRACK &aTrack)
Definition: pcb_track.cpp:156
VECTOR2I m_End
Line end point.
Definition: pcb_track.h:280
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:860
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:267
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:1230
const VECTOR2I & GetStart() const
Definition: pcb_track.h:113
VECTOR2I m_Start
Line start point.
Definition: pcb_track.h:279
int GetEndY() const
Definition: pcb_track.h:119
wxString GetFriendlyName() const override
Definition: pcb_track.cpp:848
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:1109
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:366
void SetCachedLOD(double aLOD)
Set the cached LOD.
Definition: pcb_track.h:237
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:1001
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:81
bool IsNull() const
Return true if segment length is zero.
Definition: pcb_track.h:171
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:1204
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:110
int m_Width
Thickness of track, or via diameter.
Definition: pcb_track.h:278
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:171
void SetEndX(int aX)
Definition: pcb_track.h:115
virtual void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis)
Definition: pcb_track.cpp:334
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:235
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
Definition: pcb_track.cpp:962
void SetRemoveUnconnected(bool aSet)
Sets the unconnected removal property.
Definition: pcb_track.h:489
bool IsTented() const override
Definition: pcb_track.cpp:461
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:559
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:597
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:150
VECTOR2I GetPosition() const override
Definition: pcb_track.h:454
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:1210
bool GetRemoveUnconnected() const
Definition: pcb_track.h:490
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:628
void SetKeepStartEnd(bool aSet)
Sets whether we keep the start and end annular rings even if they are not connected.
Definition: pcb_track.h:495
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:550
void ClearZoneLayerOverrides()
Definition: pcb_track.h:566
PCB_LAYER_ID m_bottomLayer
The bottom layer of the via (the top layer is in m_layer)
Definition: pcb_track.h:589
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition: pcb_track.h:538
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:597
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:1043
virtual void SetLayerSet(LSET aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
Definition: pcb_track.cpp:527
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:563
std::array< ZONE_LAYER_OVERRIDE, MAX_CU_LAYERS > m_zoneLayerOverrides
Definition: pcb_track.h:600
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:470
void SetDrill(int aDrill)
Set the drill value for vias.
Definition: pcb_track.h:531
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:560
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:927
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:593
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:779
std::mutex m_zoneLayerOverridesMutex
Definition: pcb_track.h:599
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:557
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:455
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:455
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:548
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pcb_track.h:384
bool m_removeUnconnectedLayer
Remove annular rings on unconnected layers.
Definition: pcb_track.h:595
bool GetKeepStartEnd() const
Definition: pcb_track.h:496
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:376
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:749
bool HasHole() const override
Definition: pcb_track.h:405
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:603
PCB_VIA & operator=(const PCB_VIA &aOther)
Definition: pcb_track.cpp:108
void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1128
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:462
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:498
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:989
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:403
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
Definition: pcb_track.cpp:189
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:479
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:591
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:591
bool m_keepStartEndLayer
Keep the start and end annular rings.
Definition: pcb_track.h:596
int GetDrillValue() const
Calculate the drill value for vias (m-Drill if > 0, or default drill value for the board.
Definition: pcb_track.cpp:220
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition: pcb_track.h:576
VIATYPE GetViaType() const
Definition: pcb_track.h:402
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:501
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:571
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:569
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:413
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:148
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:60
@ UNDEFINED_LAYER
Definition: layer_ids.h:61
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:426
VIATYPE
Definition: pcb_track.h:64
@ BLIND_BURIED
ENDPOINT_T
Definition: pcb_track.h:57
@ ENDPOINT_END
Definition: pcb_track.h:59
@ ENDPOINT_START
Definition: pcb_track.h:58
#define UNDEFINED_DRILL_DIAMETER
Definition: pcb_track.h:72
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
Definition: pcb_track.cpp:1186
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:94
@ 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:95
@ 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:93