KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_track.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
35#ifndef CLASS_TRACK_H
36#define CLASS_TRACK_H
37
38
39#include <mutex>
40#include <array>
42#include <base_units.h>
44#include <core/minoptmax.h>
45#include <core/arraydim.h>
46
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
192 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
193
194 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
195
196 BITMAPS GetMenuImage() const override;
197
198 virtual EDA_ITEM* Clone() const override;
199
200 virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
201
202 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
203
204 const BOX2I ViewBBox() const override;
205
209 bool IsOnCopperLayer() const override
210 {
211 return true;
212 }
213
220 {
221 return m_CachedLOD;
222 }
223
229 void SetCachedLOD( double aLOD )
230 {
231 m_CachedLOD = aLOD;
232 }
233
240 {
241 return m_CachedScale;
242 }
243
244 virtual double Similarity( const BOARD_ITEM& aOther ) const override;
245
246 virtual bool operator==( const BOARD_ITEM& aOther ) const override;
247 virtual bool operator==( const PCB_TRACK& aOther ) const;
248
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 void Serialize( google::protobuf::Any &aContainer ) const override;
265 bool Deserialize( const google::protobuf::Any &aContainer ) override;
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 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
321
322 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
323
324 double GetRadius() const;
325 EDA_ANGLE GetAngle() const;
327 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
328 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
329
330 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
331 int aAccuracy = 0 ) const override;
332
333 bool IsCCW() const;
334
335 wxString GetClass() const override
336 {
337 return wxT( "PCB_ARC" );
338 }
339
340 // @copydoc BOARD_ITEM::GetEffectiveShape
341 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
342 FLASHING aFlash = FLASHING::DEFAULT ) const override;
343
349 virtual double GetLength() const override
350 {
351 return GetRadius() * std::abs( GetAngle().AsRadians() );
352 }
353
354 EDA_ITEM* Clone() const override;
355
362 bool IsDegenerated( int aThreshold = 5 ) const;
363
364 double Similarity( const BOARD_ITEM& aOther ) const override;
365
366 bool operator==( const BOARD_ITEM& aOther ) const override;
367
368 void Serialize( google::protobuf::Any &aContainer ) const override;
369 bool Deserialize( const google::protobuf::Any &aContainer ) override;
370
371protected:
372 virtual void swapData( BOARD_ITEM* aImage ) override;
373
374private:
376};
377
378
379class PCB_VIA : public PCB_TRACK
380{
381public:
382 PCB_VIA( BOARD_ITEM* aParent );
383
384 static inline bool ClassOf( const EDA_ITEM *aItem )
385 {
386 return aItem && PCB_VIA_T == aItem->Type();
387 }
388
389 PCB_VIA( const PCB_VIA& aOther );
390 PCB_VIA& operator=( const PCB_VIA &aOther );
391
392 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
393 {
394 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
395 return true;
396
397 for( KICAD_T scanType : aScanTypes )
398 {
399 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
400 return true;
401 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
402 return true;
403 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
404 return true;
405 }
406
407 return false;
408 }
409
410 VIATYPE GetViaType() const { return m_viaType; }
411 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
412
413 bool HasHole() const override
414 {
415 return true;
416 }
417
418 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
419
420 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
421 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
422
423 bool IsTented() const override;
424 int GetSolderMaskExpansion() const;
425
426 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
427
428 virtual LSET GetLayerSet() const override;
429
434 virtual void SetLayerSet( LSET aLayers ) override;
435
442 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
443
444 void SetBottomLayer( PCB_LAYER_ID aLayer );
445 void SetTopLayer( PCB_LAYER_ID aLayer );
446
454 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
455
456 PCB_LAYER_ID TopLayer() const;
458
463 void SanitizeLayers();
464
465 VECTOR2I GetPosition() const override { return m_Start; }
466 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
467
468 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
469
470 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
471 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
472
473 wxString GetClass() const override
474 {
475 return wxT( "PCB_VIA" );
476 }
477
478 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
479
480 BITMAPS GetMenuImage() const override;
481
482 EDA_ITEM* Clone() const override;
483
484 void ViewGetLayers( int aLayers[], int& aCount ) const override;
485
486 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
487
488 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
489
490#if defined (DEBUG)
491 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
492#endif
493
494 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
495
500 void SetRemoveUnconnected( bool aSet ) { m_removeUnconnectedLayer = aSet; }
502
506 void SetKeepStartEnd( bool aSet ) { m_keepStartEndLayer = aSet; }
507 bool GetKeepStartEnd() const { return m_keepStartEndLayer; }
508
510 {
512 return false;
513
514 if( m_keepStartEndLayer && ( aLayer == m_layer || aLayer == m_bottomLayer ) )
515 return false;
516
517 return true;
518 }
519
526 bool FlashLayer( int aLayer ) const;
527
535 bool FlashLayer( LSET aLayers ) const;
536
543 PCB_LAYER_ID* aBottommost ) const;
544
550 void SetDrill( int aDrill ) { m_drill = aDrill; }
551
557 int GetDrill() const { return m_drill; }
558
564 int GetDrillValue() const;
565
570
578 bool GetIsFree() const { return m_isFree; }
579 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
580
581 // @copydoc BOARD_ITEM::GetEffectiveShape
582 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
583 FLASHING aFlash = FLASHING::DEFAULT ) const override;
584
586 {
588 }
589
591 {
592 return m_zoneLayerOverrides.at( aLayer );
593 }
594
596 {
597 std::unique_lock<std::mutex> cacheLock( m_zoneLayerOverridesMutex );
598 m_zoneLayerOverrides.at( aLayer ) = aOverride;
599 }
600
601 double Similarity( const BOARD_ITEM& aOther ) const override;
602
603 bool operator==( const BOARD_ITEM& aOther ) const override;
604
605 void Serialize( google::protobuf::Any &aContainer ) const override;
606 bool Deserialize( const google::protobuf::Any &aContainer ) override;
607
608protected:
609 void swapData( BOARD_ITEM* aImage ) override;
610
611 wxString layerMaskDescribe() const override;
612
613private:
616
618
620
623 bool m_isFree;
624
626 std::array<ZONE_LAYER_OVERRIDE, MAX_CU_LAYERS> m_zoneLayerOverrides;
627};
628
629
630#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:388
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:88
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:100
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:175
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:575
EDA_MSG_PANEL items for displaying messages.
Definition: msgpanel.h:54
Definition: pad.h:59
bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:204
virtual VECTOR2I GetPosition() const override
Definition: pcb_track.cpp:1541
bool IsDegenerated(int aThreshold=5) const
Definition: pcb_track.cpp:1585
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1526
bool IsCCW() const
Definition: pcb_track.cpp:783
virtual double GetLength() const override
Return the length of the arc track.
Definition: pcb_track.h:349
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:342
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:79
EDA_ANGLE GetArcAngleStart() const
Definition: pcb_track.cpp:1565
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:1412
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:1576
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:320
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:335
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:364
void SetMid(const VECTOR2I &aMid)
Definition: pcb_track.h:314
double GetRadius() const
Definition: pcb_track.cpp:1548
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:1555
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:763
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: pcb_track.cpp:216
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition: pcb_track.h:375
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:705
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:1635
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_track.h:322
void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis) override
Definition: pcb_track.cpp:728
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:239
double GetCachedLOD()
Get last used LOD for the track net name.
Definition: pcb_track.h:219
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:698
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:1071
void SetCachedScale(double aScale)
Set the cached scale.
Definition: pcb_track.h:254
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:303
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:209
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:1083
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
Definition: pcb_track.cpp:692
int GetWidth() const
Definition: pcb_track.h:107
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1519
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:1504
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pcb_track.cpp:1148
int GetEndX() const
Definition: pcb_track.h:118
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:323
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:818
bool ApproxCollinear(const PCB_TRACK &aTrack)
Definition: pcb_track.cpp:507
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:1272
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:64
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:647
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:1641
const VECTOR2I & GetStart() const
Definition: pcb_track.h:113
virtual bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:159
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:1260
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:1514
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:745
void SetCachedLOD(double aLOD)
Set the cached LOD.
Definition: pcb_track.h:229
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:1406
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
virtual double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: pcb_track.cpp:179
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:1615
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:110
int m_Width
Thickness of track, or via diameter.
Definition: pcb_track.h:278
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:515
void SetEndX(int aX)
Definition: pcb_track.h:115
virtual void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis)
Definition: pcb_track.cpp:713
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:615
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
Definition: pcb_track.cpp:1367
void SetRemoveUnconnected(bool aSet)
Sets the unconnected removal property.
Definition: pcb_track.h:500
bool IsTented() const override
Definition: pcb_track.cpp:840
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:578
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:979
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:153
VECTOR2I GetPosition() const override
Definition: pcb_track.h:465
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:1621
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:435
bool GetRemoveUnconnected() const
Definition: pcb_track.h:501
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:1010
void SetKeepStartEnd(bool aSet)
Sets whether we keep the start and end annular rings even if they are not connected.
Definition: pcb_track.h:506
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:569
void ClearZoneLayerOverrides()
Definition: pcb_track.h:585
PCB_LAYER_ID m_bottomLayer
The bottom layer of the via (the top layer is in m_layer)
Definition: pcb_track.h:615
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition: pcb_track.h:557
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:623
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:1448
virtual void SetLayerSet(LSET aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
Definition: pcb_track.cpp:909
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:945
std::array< ZONE_LAYER_OVERRIDE, MAX_CU_LAYERS > m_zoneLayerOverrides
Definition: pcb_track.h:626
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:849
void SetDrill(int aDrill)
Set the drill value for vias.
Definition: pcb_track.h:550
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:551
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:579
bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:244
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:1332
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:132
int m_drill
for vias: via drill (- 1 for default value)
Definition: pcb_track.h:619
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1191
std::mutex m_zoneLayerOverridesMutex
Definition: pcb_track.h:625
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:939
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:466
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:834
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:930
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pcb_track.h:392
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
Definition: pcb_track.cpp:260
bool m_removeUnconnectedLayer
Remove annular rings on unconnected layers.
Definition: pcb_track.h:621
bool GetKeepStartEnd() const
Definition: pcb_track.h:507
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
Definition: pcb_track.cpp:1041
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:384
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:1161
bool HasHole() const override
Definition: pcb_track.h:413
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:985
PCB_VIA & operator=(const PCB_VIA &aOther)
Definition: pcb_track.cpp:111
void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1533
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:473
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:384
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:509
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:1394
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:411
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
Definition: pcb_track.cpp:569
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:858
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:973
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:138
VIATYPE m_viaType
through, blind/buried or micro
Definition: pcb_track.h:617
bool m_keepStartEndLayer
Keep the start and end annular rings.
Definition: pcb_track.h:622
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
Definition: pcb_track.cpp:600
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition: pcb_track.h:595
VIATYPE GetViaType() const
Definition: pcb_track.h:410
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
Definition: pcb_track.cpp:533
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:880
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:590
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:951
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:792
Represent a set of closed polygons.
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:81
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:149
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:424
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:1597
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:78
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
@ PCB_LOCATE_BBVIA_T
Definition: typeinfo.h:125
@ PCB_LOCATE_STDVIA_T
Definition: typeinfo.h:123
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
@ PCB_LOCATE_UVIA_T
Definition: typeinfo.h:124
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96