KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_track.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
35#ifndef CLASS_TRACK_H
36#define CLASS_TRACK_H
37
38
39#include <mutex>
40#include <array>
42#include <base_units.h>
44#include <core/minoptmax.h>
45#include <core/arraydim.h>
46#include <lset.h>
47#include <padstack.h>
48
49class PCB_TRACK;
50class PCB_VIA;
51class PAD;
52class MSG_PANEL_ITEM;
53class SHAPE_POLY_SET;
54class SHAPE_ARC;
55
56
57// Flag used in locate routines (from which endpoint work)
58enum ENDPOINT_T : int
59{
61 ENDPOINT_END = 1
62};
63
64// Note that this enum must be synchronized to GAL_LAYER_ID
65enum class VIATYPE : int
66{
67 THROUGH = 3, /* Always a through hole via */
68 BLIND_BURIED = 2, /* this via can be on internal layers */
69 MICROVIA = 1, /* this via which connect from an external layer
70 * to the near neighbor internal layer */
71 NOT_DEFINED = 0 /* not yet used */
72};
73
74enum class TENTING_MODE
75{
76 FROM_RULES = 0,
77 TENTED = 1,
78 NOT_TENTED = 2
79};
80
81#define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter.
82
83// Used for tracks and vias for algorithmic safety, not to enforce constraints
84#define GEOMETRY_MIN_SIZE (int) ( 0.001 * pcbIUScale.IU_PER_MM )
85
86
88{
89public:
90 static inline bool ClassOf( const EDA_ITEM* aItem )
91 {
92 return aItem && PCB_TRACE_T == aItem->Type();
93 }
94
95 PCB_TRACK( BOARD_ITEM* aParent, KICAD_T idtype = PCB_TRACE_T );
96
97 // Do not create a copy constructor. The one generated by the compiler is adequate.
98
99 void Move( const VECTOR2I& aMoveVector ) override
100 {
101 m_Start += aMoveVector;
102 m_End += aMoveVector;
103 }
104
105 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
106
107 virtual void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis );
108
109 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
110
111 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
112 VECTOR2I GetPosition() const override { return m_Start; }
113 const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; }
114
115 virtual void SetWidth( int aWidth ) { m_Width = aWidth; }
116 virtual int GetWidth() const { return m_Width; }
117
118 void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; }
119 const VECTOR2I& GetEnd() const { return m_End; }
120
121 void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; }
122 const VECTOR2I& GetStart() const { return m_Start; }
123
124 void SetEndX( int aX ) { m_End.x = aX; }
125 void SetEndY( int aY ) { m_End.y = aY; }
126
127 int GetEndX() const { return m_End.x; }
128 int GetEndY() const { return m_End.y; }
129
131 const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
132 {
133 if( aEndPoint == ENDPOINT_START )
134 return m_Start;
135 else
136 return m_End;
137 }
138
139 // Virtual function
140 const BOX2I GetBoundingBox() const override;
141
147 virtual double GetLength() const;
148
160 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
161 int aError, ERROR_LOC aErrorLoc,
162 bool ignoreLineWidth = false ) const override;
163
164 // @copydoc BOARD_ITEM::GetEffectiveShape
165 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
166 FLASHING aFlash = FLASHING::DEFAULT ) const override;
167
175 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
176
180 bool IsNull() const
181 {
182 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
183 }
184
185 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
186 wxString GetFriendlyName() const override;
187
188 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
189 const std::vector<KICAD_T>& aScanTypes ) override;
190
191 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
192 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
193
194 bool ApproxCollinear( const PCB_TRACK& aTrack );
195
196 wxString GetClass() const override
197 {
198 return wxT( "PCB_TRACK" );
199 }
200
201 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
202
203 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) 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
223 virtual double Similarity( const BOARD_ITEM& aOther ) const override;
224
225 virtual bool operator==( const BOARD_ITEM& aOther ) const override;
226 virtual bool operator==( const PCB_TRACK& aOther ) const;
227
229 {
230 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
231 };
232
233 void Serialize( google::protobuf::Any &aContainer ) const override;
234 bool Deserialize( const google::protobuf::Any &aContainer ) override;
235
236#if defined (DEBUG)
237 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
238#endif
239
240protected:
241 virtual void swapData( BOARD_ITEM* aImage ) override;
242
244 std::vector<MSG_PANEL_ITEM>& aList ) const;
245
246protected:
250};
251
252
253class PCB_ARC : public PCB_TRACK
254{
255public:
256 PCB_ARC( BOARD_ITEM* aParent ) :
257 PCB_TRACK( aParent, PCB_ARC_T )
258 { }
259
260 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
261
262 static inline bool ClassOf( const EDA_ITEM *aItem )
263 {
264 return aItem && PCB_ARC_T == aItem->Type();
265 }
266
267 virtual void Move( const VECTOR2I& aMoveVector ) override
268 {
269 m_Start += aMoveVector;
270 m_Mid += aMoveVector;
271 m_End += aMoveVector;
272 }
273
274 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
275
276 void Mirror( const VECTOR2I& aCentre, bool aMirrorAroundXAxis ) override;
277
278 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
279
280 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
281 const VECTOR2I& GetMid() const { return m_Mid; }
282
283 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
284
285 virtual VECTOR2I GetPosition() const override;
286 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
287
288 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
289
290 double GetRadius() const;
291 EDA_ANGLE GetAngle() const;
293 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
294 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
295
296 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
297 int aAccuracy = 0 ) const override;
298
299 bool IsCCW() const;
300
301 wxString GetClass() const override
302 {
303 return wxT( "PCB_ARC" );
304 }
305
306 // @copydoc BOARD_ITEM::GetEffectiveShape
307 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
308 FLASHING aFlash = FLASHING::DEFAULT ) const override;
309
315 virtual double GetLength() const override
316 {
317 return GetRadius() * std::abs( GetAngle().AsRadians() );
318 }
319
320 EDA_ITEM* Clone() const override;
321
328 bool IsDegenerated( int aThreshold = 5 ) const;
329
330 double Similarity( const BOARD_ITEM& aOther ) const override;
331
332 bool operator==( const PCB_ARC& aOther ) const;
333 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
334
335 void Serialize( google::protobuf::Any &aContainer ) const override;
336 bool Deserialize( const google::protobuf::Any &aContainer ) override;
337
338protected:
339 virtual void swapData( BOARD_ITEM* aImage ) override;
340
341private:
343};
344
345
346class PCB_VIA : public PCB_TRACK
347{
348public:
349 PCB_VIA( BOARD_ITEM* aParent );
350
351 static inline bool ClassOf( const EDA_ITEM *aItem )
352 {
353 return aItem && PCB_VIA_T == aItem->Type();
354 }
355
356 PCB_VIA( const PCB_VIA& aOther );
357 PCB_VIA& operator=( const PCB_VIA &aOther );
358
359 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
360 {
361 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
362 return true;
363
364 for( KICAD_T scanType : aScanTypes )
365 {
366 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
367 return true;
368 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
369 return true;
370 else if( scanType == PCB_LOCATE_BBVIA_T && m_viaType == VIATYPE::BLIND_BURIED )
371 return true;
372 }
373
374 return false;
375 }
376
377 VIATYPE GetViaType() const { return m_viaType; }
378 void SetViaType( VIATYPE aViaType ) { m_viaType = aViaType; }
379
380 const PADSTACK& Padstack() const { return m_padStack; }
382 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
383
384 void SetWidth( int aWidth ) override;
385 int GetWidth() const override;
386
387 bool HasHole() const override
388 {
389 return true;
390 }
391
392 bool HasDrilledHole() const override
393 {
394 return m_viaType == VIATYPE::THROUGH || m_viaType == VIATYPE::BLIND_BURIED;
395 }
396
397 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape() const override;
398
399 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
400 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
401
402 void SetFrontTentingMode( TENTING_MODE aMode );
404 void SetBackTentingMode( TENTING_MODE aMode );
406
407 bool IsTented( PCB_LAYER_ID aLayer ) const override;
408 int GetSolderMaskExpansion() const;
409
410 PCB_LAYER_ID GetLayer() const override;
411 void SetLayer( PCB_LAYER_ID aLayer ) override;
412
413 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
414
415 virtual LSET GetLayerSet() const override;
416
421 virtual void SetLayerSet( LSET aLayers ) override;
422
429 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
430
431 void SetBottomLayer( PCB_LAYER_ID aLayer );
432 void SetTopLayer( PCB_LAYER_ID aLayer );
433
441 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
442
443 PCB_LAYER_ID TopLayer() const;
445
450 void SanitizeLayers();
451
452 VECTOR2I GetPosition() const override { return m_Start; }
453 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
454
455 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
456
457 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
458 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
459
460 wxString GetClass() const override
461 {
462 return wxT( "PCB_VIA" );
463 }
464
465 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
466
467 BITMAPS GetMenuImage() const override;
468
469 EDA_ITEM* Clone() const override;
470
471 void ViewGetLayers( int aLayers[], int& aCount ) const override;
472
473 double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override;
474
475 void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override;
476
477#if defined (DEBUG)
478 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
479#endif
480
481 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
482
488 void SetRemoveUnconnected( bool aSet )
489 {
493 }
494
496 {
498 }
499
504 void SetKeepStartEnd( bool aSet )
505 {
509 }
510
511 bool GetKeepStartEnd() const
512 {
515 }
516
518 {
520 {
522 return false;
523
525 return true;
526
528 {
529 if( aLayer == m_padStack.Drill().start || aLayer == m_padStack.Drill().end )
530 return false;
531 }
532 }
533
534 return true;
535 }
536
543 bool FlashLayer( int aLayer ) const;
544
552 bool FlashLayer( LSET aLayers ) const;
553
560 PCB_LAYER_ID* aBottommost ) const;
561
567 void SetDrill( int aDrill )
568 {
569 m_padStack.Drill().size = { aDrill, aDrill };
570 }
571
577 int GetDrill() const { return m_padStack.Drill().size.x; }
578
584 int GetDrillValue() const;
585
590 {
592 }
593
601 bool GetIsFree() const { return m_isFree; }
602 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
603
604 // @copydoc BOARD_ITEM::GetEffectiveShape
605 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
606 FLASHING aFlash = FLASHING::DEFAULT ) const override;
607
609 {
611 }
612
614 {
615 return m_zoneLayerOverrides.at( aLayer );
616 }
617
619 {
620 std::unique_lock<std::mutex> cacheLock( m_zoneLayerOverridesMutex );
621 m_zoneLayerOverrides.at( aLayer ) = aOverride;
622 }
623
624 double Similarity( const BOARD_ITEM& aOther ) const override;
625
626 bool operator==( const PCB_VIA& aOther ) const;
627 bool operator==( const BOARD_ITEM& aOther ) const override;
628
629 void Serialize( google::protobuf::Any &aContainer ) const override;
630 bool Deserialize( const google::protobuf::Any &aContainer ) override;
631
632protected:
633 void swapData( BOARD_ITEM* aImage ) override;
634
635 wxString layerMaskDescribe() const override;
636
637private:
639
641
642 bool m_isFree;
643
645 std::array<ZONE_LAYER_OVERRIDE, MAX_CU_LAYERS> m_zoneLayerOverrides;
646};
647
648
649#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:66
@ ZLO_NONE
Definition: board_item.h:67
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:79
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:89
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:101
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition: eda_item.h:176
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:35
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:117
void SetUnconnectedLayerMode(UNCONNECTED_LAYER_MODE aMode)
Definition: padstack.h:273
UNCONNECTED_LAYER_MODE UnconnectedLayerMode() const
Definition: padstack.h:272
DRILL_PROPS & Drill()
Definition: padstack.h:266
Definition: pad.h:54
virtual VECTOR2I GetPosition() const override
Definition: pcb_track.cpp:1585
bool IsDegenerated(int aThreshold=5) const
Definition: pcb_track.cpp:1627
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1570
bool IsCCW() const
Definition: pcb_track.cpp:728
virtual double GetLength() const override
Return the length of the arc track.
Definition: pcb_track.h:315
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:358
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:78
EDA_ANGLE GetArcAngleStart() const
Definition: pcb_track.cpp:1609
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:1457
EDA_ANGLE GetArcAngleEnd() const
Definition: pcb_track.cpp:1619
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:286
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:283
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:267
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:301
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:380
void SetMid(const VECTOR2I &aMid)
Definition: pcb_track.h:280
double GetRadius() const
Definition: pcb_track.cpp:1592
EDA_ANGLE GetAngle() const
Definition: pcb_track.cpp:1599
const VECTOR2I & GetMid() const
Definition: pcb_track.h:281
PCB_ARC(BOARD_ITEM *aParent)
Definition: pcb_track.h:256
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:709
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:226
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition: pcb_track.h:342
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:262
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:652
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:1677
bool operator==(const PCB_ARC &aOther) const
Definition: pcb_track.cpp:216
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition: pcb_track.h:288
void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis) override
Definition: pcb_track.cpp:675
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
Definition: pcb_track.cpp:645
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:1104
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:319
void SetEndY(int aY)
Definition: pcb_track.h:125
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition, but allows items to return their visual center rather than their anchor.
Definition: pcb_track.h:113
bool IsOnCopperLayer() const override
Definition: pcb_track.h:218
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition: pcb_track.h:99
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:196
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1116
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
Definition: pcb_track.cpp:639
virtual void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1563
void SetEnd(const VECTOR2I &aEnd)
Definition: pcb_track.h:118
void SetStart(const VECTOR2I &aStart)
Definition: pcb_track.h:121
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
Definition: pcb_track.cpp:1177
int GetEndX() const
Definition: pcb_track.h:127
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:1548
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:339
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:763
bool ApproxCollinear(const PCB_TRACK &aTrack)
Definition: pcb_track.cpp:454
VECTOR2I m_End
Line end point.
Definition: pcb_track.h:249
void SetPosition(const VECTOR2I &aPos) override
Definition: pcb_track.h:111
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:1317
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:63
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
Definition: pcb_track.cpp:594
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:1683
const VECTOR2I & GetStart() const
Definition: pcb_track.h:122
virtual bool operator==(const BOARD_ITEM &aOther) const override
Definition: pcb_track.cpp:160
VECTOR2I m_Start
Line start point.
Definition: pcb_track.h:248
int GetEndY() const
Definition: pcb_track.h:128
wxString GetFriendlyName() const override
Definition: pcb_track.cpp:1305
VECTOR2I GetPosition() const override
Definition: pcb_track.h:112
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:1558
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:692
const VECTOR2I & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition: pcb_track.h:131
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:1451
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:90
bool IsNull() const
Return true if segment length is zero.
Definition: pcb_track.h:180
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:180
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:1657
const VECTOR2I & GetEnd() const
Definition: pcb_track.h:119
int m_Width
Thickness of track.
Definition: pcb_track.h:247
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:462
void SetEndX(int aX)
Definition: pcb_track.h:124
virtual void Mirror(const VECTOR2I &aCentre, bool aMirrorAroundXAxis)
Definition: pcb_track.cpp:660
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:562
virtual void SetWidth(int aWidth)
Definition: pcb_track.h:115
virtual int GetWidth() const
Definition: pcb_track.h:116
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
Definition: pcb_track.cpp:1412
void SetRemoveUnconnected(bool aSet)
Definition: pcb_track.h:488
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:601
PCB_LAYER_ID BottomLayer() const
Definition: pcb_track.cpp:991
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
Definition: pcb_track.cpp:154
VECTOR2I GetPosition() const override
Definition: pcb_track.h:452
bool IsTented(PCB_LAYER_ID aLayer) const override
Checks if the given object is tented (its copper shape is covered by solder mask) on a given side of ...
Definition: pcb_track.cpp:831
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:1663
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
Definition: pcb_track.cpp:426
bool GetRemoveUnconnected() const
Definition: pcb_track.h:495
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
Definition: pcb_track.cpp:1027
void SetKeepStartEnd(bool aSet)
Definition: pcb_track.h:504
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition: pcb_track.h:589
void ClearZoneLayerOverrides()
Definition: pcb_track.h:608
const PADSTACK & Padstack() const
Definition: pcb_track.h:380
void SetFrontTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:785
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition: pcb_track.h:577
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition: pcb_track.h:642
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:1492
TENTING_MODE GetFrontTentingMode() const
Definition: pcb_track.cpp:796
virtual void SetLayerSet(LSET aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
Definition: pcb_track.cpp:920
void SetBottomLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:957
std::array< ZONE_LAYER_OVERRIDE, MAX_CU_LAYERS > m_zoneLayerOverrides
Definition: pcb_track.h:645
PADSTACK & Padstack()
Definition: pcb_track.h:381
int GetSolderMaskExpansion() const
Definition: pcb_track.cpp:854
void SetDrill(int aDrill)
Set the drill value for vias.
Definition: pcb_track.h:567
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
Definition: pcb_track.cpp:498
void SetBackTentingMode(TENTING_MODE aMode)
Definition: pcb_track.cpp:808
void SetIsFree(bool aFree=true)
Definition: pcb_track.h:602
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:1377
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition: pcb_track.cpp:133
bool operator==(const PCB_VIA &aOther) const
Definition: pcb_track.cpp:265
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
Definition: pcb_track.cpp:882
double ViewGetLOD(int aLayer, KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
Definition: pcb_track.cpp:1220
std::mutex m_zoneLayerOverridesMutex
Definition: pcb_track.h:644
void SetTopLayer(PCB_LAYER_ID aLayer)
Definition: pcb_track.cpp:951
void SetPosition(const VECTOR2I &aPoint) override
Definition: pcb_track.h:453
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape() const override
Definition: pcb_track.cpp:779
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:942
bool HasDrilledHole() const override
Definition: pcb_track.h:392
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
Definition: pcb_track.cpp:139
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition: pcb_track.h:359
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:276
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
Definition: pcb_track.cpp:888
bool GetKeepStartEnd() const
Definition: pcb_track.h:511
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
Definition: pcb_track.cpp:1074
static bool ClassOf(const EDA_ITEM *aItem)
Definition: pcb_track.h:351
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:1190
bool HasHole() const override
Definition: pcb_track.h:387
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:997
int GetWidth() const override
Definition: pcb_track.cpp:313
PCB_VIA & operator=(const PCB_VIA &aOther)
Definition: pcb_track.cpp:118
void swapData(BOARD_ITEM *aImage) override
Definition: pcb_track.cpp:1577
wxString GetClass() const override
Return the class name.
Definition: pcb_track.h:460
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
Definition: pcb_track.cpp:400
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:517
wxString layerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
Definition: pcb_track.cpp:1439
void SetViaType(VIATYPE aViaType)
Definition: pcb_track.h:378
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
Definition: pcb_track.cpp:516
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
Definition: pcb_track.cpp:863
TENTING_MODE GetBackTentingMode() const
Definition: pcb_track.cpp:819
PCB_LAYER_ID TopLayer() const
Definition: pcb_track.cpp:985
VIATYPE m_viaType
through, blind/buried or micro
Definition: pcb_track.h:638
PADSTACK m_padStack
Definition: pcb_track.h:640
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
Definition: pcb_track.cpp:547
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
Definition: pcb_track.h:618
VIATYPE GetViaType() const
Definition: pcb_track.h:377
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
Definition: pcb_track.cpp:480
void SetWidth(int aWidth) override
Definition: pcb_track.cpp:307
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: pcb_track.cpp:894
const ZONE_LAYER_OVERRIDE & GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
Definition: pcb_track.h:613
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:963
void SetPadstack(const PADSTACK &aPadstack)
Definition: pcb_track.h:382
void Flip(const VECTOR2I &aCentre, bool aFlipLeftRight) override
Flip this object, i.e.
Definition: pcb_track.cpp:738
Represent a set of closed polygons.
INSPECT_RESULT
Definition: eda_item.h:43
const INSPECTOR_FUNC & INSPECTOR
Definition: eda_item.h:82
std::uint32_t EDA_ITEM_FLAGS
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:390
VIATYPE
Definition: pcb_track.h:66
@ BLIND_BURIED
TENTING_MODE
Definition: pcb_track.h:75
ENDPOINT_T
Definition: pcb_track.h:59
@ ENDPOINT_END
Definition: pcb_track.h:61
@ ENDPOINT_START
Definition: pcb_track.h:60
#define UNDEFINED_DRILL_DIAMETER
Definition: pcb_track.h:81
PCB_LAYER_ID start
Definition: padstack.h:228
PCB_LAYER_ID end
Definition: padstack.h:229
VECTOR2I size
Drill diameter (x == y) or slot dimensions (x != y)
Definition: padstack.h:226
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
Definition: pcb_track.cpp:1639
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