KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pcb_track.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
30
31#pragma once
32
33#include <array>
34#include <atomic>
35#include <optional>
36
38#include <base_units.h>
40#include <core/minoptmax.h>
41#include <core/arraydim.h>
42#include <lset.h>
43#include <padstack.h>
44#include <pcb_track_types.h>
45
46class PAD;
47class MSG_PANEL_ITEM;
48class SHAPE_POLY_SET;
49class SHAPE_ARC;
50
51namespace kiapi::board::types
52{
53class Via;
54}
55
56
57// Used for tracks and vias for algorithmic safety, not to enforce constraints
58#define GEOMETRY_MIN_SIZE (int) ( 0.001 * pcbIUScale.IU_PER_MM )
59
60
62{
63public:
64 static inline bool ClassOf( const EDA_ITEM* aItem )
65 {
66 return aItem && PCB_TRACE_T == aItem->Type();
67 }
68
69 PCB_TRACK( BOARD_ITEM* aParent, KICAD_T idtype = PCB_TRACE_T );
70
71 // Do not create a copy constructor. The one generated by the compiler is adequate.
72
73 void CopyFrom( const BOARD_ITEM* aOther ) override;
74
75 void Move( const VECTOR2I& aMoveVector ) override
76 {
77 m_Start += aMoveVector;
78 m_End += aMoveVector;
79 }
80
81 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
82
83 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
84
85 void Mirror( const SEG& aAxis ) override;
86
87 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
88
89 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
90 VECTOR2I GetPosition() const override { return m_Start; }
91 const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; }
92
93 virtual void SetWidth( int aWidth ) { m_width = aWidth; }
94 virtual int GetWidth() const { return m_width; }
95
96 void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; }
97 const VECTOR2I& GetEnd() const { return m_End; }
98
99 void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; }
100 const VECTOR2I& GetStart() const { return m_Start; }
101
102 void SetStartX( int aX ) { m_Start.x = aX; }
103 void SetStartY( int aY ) { m_Start.y = aY; }
104
105 int GetStartX() const { return m_Start.x; }
106 int GetStartY() const { return m_Start.y; }
107
108 void SetEndX( int aX ) { m_End.x = aX; }
109 void SetEndY( int aY ) { m_End.y = aY; }
110
111 int GetEndX() const { return m_End.x; }
112 int GetEndY() const { return m_End.y; }
113
115 const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
116 {
117 if( aEndPoint == ENDPOINT_START )
118 return m_Start;
119 else
120 return m_End;
121 }
122
123 void SetHasSolderMask( bool aVal ) { m_hasSolderMask = aVal; }
124 bool HasSolderMask() const { return m_hasSolderMask; }
125
126 void SetLocalSolderMaskMargin( std::optional<int> aMargin ) { m_solderMaskMargin = aMargin; }
127 std::optional<int> GetLocalSolderMaskMargin() const { return m_solderMaskMargin; }
128
129 int GetSolderMaskExpansion() const;
130
131 // Virtual function
132 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
133
134 virtual LSET GetLayerSet() const override;
135 virtual void SetLayerSet( const LSET& aLayers ) override;
136
137 const BOX2I GetBoundingBox() const override;
138
144 virtual double GetLength() const;
145
151 virtual double GetDelay() const;
152
153 double GetCoverageArea( int aTextMargin ) const override;
154
167 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
168 int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth = false ) const override;
169
170 // @copydoc BOARD_ITEM::GetEffectiveShape
171 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
173 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
174
182 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
183
187 bool IsNull() const
188 {
189 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
190 }
191
192 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
193 wxString GetFriendlyName() const override;
194
195 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
196 const std::vector<KICAD_T>& aScanTypes ) override;
197
198 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
199 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
200 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
201
202 bool ApproxCollinear( const PCB_TRACK& aTrack );
203
204 wxString GetClass() const override
205 {
206 return wxT( "PCB_TRACK" );
207 }
208
209 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
210
211 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
212
213 BITMAPS GetMenuImage() const override;
214
215 EDA_ITEM* Clone() const override;
216
217 std::vector<int> ViewGetLayers() const override;
218
219 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
220
221 const BOX2I ViewBBox() const override;
222
226 bool IsOnCopperLayer() const override
227 {
228 return true;
229 }
230
231 double Similarity( const BOARD_ITEM& aOther ) const override;
232
233 bool operator==( const BOARD_ITEM& aOther ) const override;
234 virtual bool operator==( const PCB_TRACK& aOther ) const;
235
237 {
238 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
239 };
240
241 void Serialize( google::protobuf::Any &aContainer ) const override;
242 bool Deserialize( const google::protobuf::Any &aContainer ) override;
243
244#if defined (DEBUG)
245 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
246#endif
247
248protected:
249 void swapData( BOARD_ITEM* aImage ) override;
250
251 void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) const;
252
253protected:
256
258 std::optional<int> m_solderMaskMargin;
259
260private:
262};
263
264
265class PCB_ARC : public PCB_TRACK
266{
267public:
268 PCB_ARC( BOARD_ITEM* aParent ) :
269 PCB_TRACK( aParent, PCB_ARC_T )
270 { }
271
272 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
273
278 static std::unique_ptr<PCB_TRACK> CreateFromThreePoints( BOARD_ITEM* aParent, const VECTOR2I& aStart,
279 const VECTOR2I& aMid, const VECTOR2I& aEnd );
280
281 void CopyFrom( const BOARD_ITEM* aOther ) override;
282
283 static inline bool ClassOf( const EDA_ITEM *aItem )
284 {
285 return aItem && PCB_ARC_T == aItem->Type();
286 }
287
288 void Move( const VECTOR2I& aMoveVector ) override
289 {
290 m_Start += aMoveVector;
291 m_Mid += aMoveVector;
292 m_End += aMoveVector;
293 }
294
295 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
296
297 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
298
299 void Mirror( const SEG& aAxis ) override;
300
301 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
302
303 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
304 const VECTOR2I& GetMid() const { return m_Mid; }
305
306 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
307
308 VECTOR2I GetPosition() const override;
309 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
310
311 VECTOR2I GetCenter() const override { return GetPosition(); }
312
313 double GetRadius() const;
314 EDA_ANGLE GetAngle() const;
316 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
317 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
318
319 bool HitTest( const BOX2I& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
320
321 bool IsCCW() const;
322
323 wxString GetClass() const override
324 {
325 return wxT( "PCB_ARC" );
326 }
327
328 // @copydoc BOARD_ITEM::GetEffectiveShape
329 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
331 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
332
338 virtual double GetLength() const override
339 {
340 return GetRadius() * std::abs( GetAngle().AsRadians() );
341 }
342
343 EDA_ITEM* Clone() const override;
344
351 bool IsDegenerated( int aThreshold = 5 ) const;
352
353 double Similarity( const BOARD_ITEM& aOther ) const override;
354
355 bool operator==( const PCB_ARC& aOther ) const;
356 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
357
358 void Serialize( google::protobuf::Any &aContainer ) const override;
359 bool Deserialize( const google::protobuf::Any &aContainer ) override;
360
361protected:
362 virtual void swapData( BOARD_ITEM* aImage ) override;
363
364private:
365 // Silence GCC warning about overriding the base class method
366 bool operator==( const PCB_TRACK& aOther ) const override;
367
369};
370
371
372class PCB_VIA : public PCB_TRACK
373{
374public:
375 PCB_VIA( BOARD_ITEM* aParent );
376
377 static inline bool ClassOf( const EDA_ITEM *aItem )
378 {
379 return aItem && PCB_VIA_T == aItem->Type();
380 }
381
382 PCB_VIA( const PCB_VIA& aOther );
383 PCB_VIA& operator=( const PCB_VIA &aOther );
384
389 static std::vector<std::vector<PCB_VIA*>> CollectMicroviaColumns( BOARD* aBoard );
390
391 void CopyFrom( const BOARD_ITEM* aOther ) override;
392
393 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
394 {
395 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
396 return true;
397
398 for( KICAD_T scanType : aScanTypes )
399 {
400 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
401 return true;
402 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
403 return true;
404 else if( scanType == PCB_LOCATE_BLINDVIA_T && m_viaType == VIATYPE::BLIND )
405 return true;
406 else if( scanType == PCB_LOCATE_BURIEDVIA_T && m_viaType == VIATYPE::BURIED )
407 return true;
408 }
409
410 return false;
411 }
412
416 bool HasValidLayerPair( int aCopperLayerCount ) const;
417
420 bool FitsEnabledLayers( const LSET& aEnabledLayers, int aCopperLayerCount ) const override
421 {
422 return BOARD_ITEM::FitsEnabledLayers( aEnabledLayers, aCopperLayerCount )
423 && HasValidLayerPair( aCopperLayerCount );
424 }
425
426 VIATYPE GetViaType() const { return m_viaType; }
427 void SetViaType( VIATYPE aViaType )
428 {
429 m_viaType = aViaType;
430
431 // If someone updates a VIA to TH, we want to kick out any non-outer layers
433 }
434
435 const PADSTACK& Padstack() const { return m_padStack; }
437 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
438
439 // A micro, blind, or buried via with a Front/Inner/Back padstack definition is an odd beast as it might
440 // not exist on F_Cu or B_Cu.
441 bool IsGhostLayer( PCB_LAYER_ID aLayer ) const;
442
443 BACKDRILL_MODE GetBackdrillMode() const { return m_padStack.GetBackdrillMode(); }
444 void SetBackdrillMode( BACKDRILL_MODE aMode ) { m_padStack.SetBackdrillMode( aMode ); }
445
446 std::optional<int> GetBottomBackdrillSize() const { return m_padStack.GetBackdrillSize( false ); }
447 void SetBottomBackdrillSize( std::optional<int> aSize ) { m_padStack.SetBackdrillSize( false, aSize ); }
448
449 PCB_LAYER_ID GetBottomBackdrillLayer() const { return m_padStack.GetBackdrillEndLayer( false ); }
450 void SetBottomBackdrillLayer( PCB_LAYER_ID aLayer ) { m_padStack.SetBackdrillEndLayer( false, aLayer ); }
451
452 std::optional<int> GetTopBackdrillSize() const { return m_padStack.GetBackdrillSize( true ); }
453 void SetTopBackdrillSize( std::optional<int> aSize ) { m_padStack.SetBackdrillSize( true, aSize ); }
454
455 PCB_LAYER_ID GetTopBackdrillLayer() const { return m_padStack.GetBackdrillEndLayer( true ); }
456 void SetTopBackdrillLayer( PCB_LAYER_ID aLayer ) { m_padStack.SetBackdrillEndLayer( true, aLayer ); }
457
458 bool IsMicroVia() const;
459 bool IsBlindVia() const;
460 bool IsBuriedVia() const;
461
482
483 static std::optional<VIA_PARAMETER_ERROR>
484 ValidateViaParameters( std::optional<int> aDiameter,
485 std::optional<int> aPrimaryDrill,
486 std::optional<PCB_LAYER_ID> aPrimaryStartLayer = std::nullopt,
487 std::optional<PCB_LAYER_ID> aPrimaryEndLayer = std::nullopt,
488 std::optional<int> aSecondaryDrill = std::nullopt,
489 std::optional<PCB_LAYER_ID> aSecondaryStartLayer = std::nullopt,
490 std::optional<PCB_LAYER_ID> aSecondaryEndLayer = std::nullopt,
491 std::optional<int> aTertiaryDrill = std::nullopt,
492 std::optional<PCB_LAYER_ID> aTertiaryStartLayer = std::nullopt,
493 std::optional<PCB_LAYER_ID> aTertiaryEndLayer = std::nullopt,
494 int aCopperLayerCount = 0 );
495
496 const BOX2I GetBoundingBox() const override;
497 const BOX2I GetBoundingBox( PCB_LAYER_ID aLayer ) const;
498
499 void SetPadstackMode( PADSTACK::MODE aMode ) { m_padStack.SetMode( aMode ); }
500
501 void SetWidth( int aWidth ) override;
502 int GetWidth() const override;
503
504 void SetWidth( PCB_LAYER_ID aLayer, int aWidth );
505 int GetWidth( PCB_LAYER_ID aLayer ) const;
506
507 // For properties panel
508 void SetFrontWidth( int aWidth ) { SetWidth( F_Cu, aWidth ); }
509 int GetFrontWidth() const { return GetWidth( F_Cu ); }
510
511 bool HasHole() const override
512 {
513 return true;
514 }
515
516 bool HasDrilledHole() const override
517 {
519 }
520
521 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
522 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
523
524 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
525 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
526
535 void SetSizeFromRules( int aDiameter, int aDrill );
536
537 void SetFrontTentingMode( TENTING_MODE aMode );
540 void SetBackTentingMode( TENTING_MODE aMode );
543
550
557
558 void SetCappingMode( CAPPING_MODE aMode );
561
562 void SetFillingMode( FILLING_MODE aMode );
565
566 bool IsTented( PCB_LAYER_ID aLayer ) const override;
567 int GetSolderMaskExpansion() const;
568
570
571 PCB_LAYER_ID GetLayer() const override;
572 void SetLayer( PCB_LAYER_ID aLayer ) override;
573
574 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
575
576 bool IsOnCopperLayer() const override;
577
578 virtual LSET GetLayerSet() const override;
579
584 virtual void SetLayerSet( const LSET& aLayers ) override;
585
592 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
593
594 void SetBottomLayer( PCB_LAYER_ID aLayer );
595 void SetTopLayer( PCB_LAYER_ID aLayer );
596
604 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
605
606 PCB_LAYER_ID TopLayer() const;
608
613 void SanitizeLayers();
614
615 VECTOR2I GetPosition() const override { return m_Start; }
616 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
617
618 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
619
620 double GetCoverageArea( int aTextMargin ) const override;
621
622 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
623 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
624
625 wxString GetClass() const override
626 {
627 return wxT( "PCB_VIA" );
628 }
629
630 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
631
632 BITMAPS GetMenuImage() const override;
633
634 EDA_ITEM* Clone() const override;
635
636 std::vector<int> ViewGetLayers() const override;
637
638 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
639
640 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
641
642#if defined (DEBUG)
643 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
644#endif
645
646 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
647
653 void SetRemoveUnconnected( bool aSet )
654 {
655 m_padStack.SetUnconnectedLayerMode( aSet ? UNCONNECTED_LAYER_MODE::REMOVE_ALL
657 }
658
660 {
661 return m_padStack.UnconnectedLayerMode() != UNCONNECTED_LAYER_MODE::KEEP_ALL;
662 }
663
668 void SetKeepStartEnd( bool aSet )
669 {
672 }
673
674 bool GetKeepStartEnd() const
675 {
677 }
678
680 {
681 switch( m_padStack.UnconnectedLayerMode() )
682 {
684 return false;
685
687 return true;
688
691 return aLayer != m_padStack.Drill().start && aLayer != m_padStack.Drill().end;
692 }
693
694 return true;
695 }
696
703 bool FlashLayer( int aLayer ) const;
704
712 bool FlashLayer( const LSET& aLayers ) const;
713
719 void GetOutermostConnectedLayers( PCB_LAYER_ID* aTopmost, PCB_LAYER_ID* aBottommost ) const;
720
726 void SetPrimaryDrillSize( const VECTOR2I& aSize );
727 const VECTOR2I& GetPrimaryDrillSize() const { return m_padStack.Drill().size; }
728
730 PAD_DRILL_SHAPE GetPrimaryDrillShape() const { return m_padStack.Drill().shape; }
731
733 PCB_LAYER_ID GetPrimaryDrillStartLayer() const { return m_padStack.Drill().start; }
734
736 PCB_LAYER_ID GetPrimaryDrillEndLayer() const { return m_padStack.Drill().end; }
737
738 void SetFrontPostMachining( const std::optional<PAD_DRILL_POST_MACHINING_MODE>& aMode );
739 std::optional<PAD_DRILL_POST_MACHINING_MODE> GetFrontPostMachining() const
740 {
741 return m_padStack.FrontPostMachining().mode;
742 }
743
745 {
746 m_padStack.FrontPostMachining().mode = aMode;
747 }
748
753
754 void SetFrontPostMachiningSize( int aSize ) { m_padStack.FrontPostMachining().size = aSize; }
755 int GetFrontPostMachiningSize() const { return m_padStack.FrontPostMachining().size; }
756 void SetFrontPostMachiningDepth( int aDepth ) { m_padStack.FrontPostMachining().depth = aDepth; }
757 int GetFrontPostMachiningDepth() const { return m_padStack.FrontPostMachining().depth; }
758 void SetFrontPostMachiningAngle( int aAngle ) { m_padStack.FrontPostMachining().angle = aAngle; }
759 int GetFrontPostMachiningAngle() const { return m_padStack.FrontPostMachining().angle; }
760
761 void SetBackPostMachining( const std::optional<PAD_DRILL_POST_MACHINING_MODE>& aMode );
762 std::optional<PAD_DRILL_POST_MACHINING_MODE> GetBackPostMachining() const
763 {
764 return m_padStack.BackPostMachining().mode;
765 }
766
768 {
769 m_padStack.BackPostMachining().mode = aMode;
770 }
771
776
777 void SetBackPostMachiningSize( int aSize ) { m_padStack.BackPostMachining().size = aSize; }
778 int GetBackPostMachiningSize() const { return m_padStack.BackPostMachining().size; }
779 void SetBackPostMachiningDepth( int aDepth ) { m_padStack.BackPostMachining().depth = aDepth; }
780 int GetBackPostMachiningDepth() const { return m_padStack.BackPostMachining().depth; }
781 void SetBackPostMachiningAngle( int aAngle ) { m_padStack.BackPostMachining().angle = aAngle; }
782 int GetBackPostMachiningAngle() const { return m_padStack.BackPostMachining().angle; }
783
793 bool IsBackdrilledOrPostMachined( PCB_LAYER_ID aLayer ) const;
794
801 int GetPostMachiningKnockout( PCB_LAYER_ID aLayer ) const;
802
809
819 bool HasCopperRemoved( PCB_LAYER_ID aLayer ) const;
820
821 void SetPrimaryDrillFilled( const std::optional<bool>& aFilled );
822 void SetPrimaryDrillFilledFlag( bool aFilled );
823 std::optional<bool> GetPrimaryDrillFilled() const { return m_padStack.Drill().is_filled; }
824 bool GetPrimaryDrillFilledFlag() const { return m_padStack.Drill().is_filled.value_or( false ); }
825
826 void SetPrimaryDrillCapped( const std::optional<bool>& aCapped );
827 void SetPrimaryDrillCappedFlag( bool aCapped );
828 std::optional<bool> GetPrimaryDrillCapped() const { return m_padStack.Drill().is_capped; }
829 bool GetPrimaryDrillCappedFlag() const { return m_padStack.Drill().is_capped.value_or( false ); }
830
831 void SetDrill( int aDrill ) { SetPrimaryDrillSize( { aDrill, aDrill } ); }
832
838 int GetDrill() const { return GetPrimaryDrillSize().x; }
839
845 int GetDrillValue() const;
846
854
855 void SetSecondaryDrillSize( const VECTOR2I& aSize );
857 void SetSecondaryDrillSize( const std::optional<int>& aDrill );
858 std::optional<int> GetSecondaryDrillSize() const;
859
861 PCB_LAYER_ID GetSecondaryDrillStartLayer() const { return m_padStack.SecondaryDrill().start; }
862
864 PCB_LAYER_ID GetSecondaryDrillEndLayer() const { return m_padStack.SecondaryDrill().end; }
865
867 PAD_DRILL_SHAPE GetSecondaryDrillShape() const { return m_padStack.SecondaryDrill().shape; }
868
869 void SetTertiaryDrillSize( const VECTOR2I& aSize );
871 void SetTertiaryDrillSize( const std::optional<int>& aDrill );
872 std::optional<int> GetTertiaryDrillSize() const;
873
875 PCB_LAYER_ID GetTertiaryDrillStartLayer() const { return m_padStack.TertiaryDrill().start; }
876
878 PCB_LAYER_ID GetTertiaryDrillEndLayer() const { return m_padStack.TertiaryDrill().end; }
879
881 PAD_DRILL_SHAPE GetTertiaryDrillShape() const { return m_padStack.TertiaryDrill().shape; }
882
890 bool GetIsFree() const { return m_isFree; }
891 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
892
893 // For property manager:
894 bool GetIsNotFree() const { return !m_isFree; }
895 void SetIsNotFree( bool aNotFree ) { m_isFree = !aNotFree; }
896
898 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
900 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
901
903
908
909 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
910
911 double Similarity( const BOARD_ITEM& aOther ) const override;
912
913 bool operator==( const PCB_VIA& aOther ) const;
914 bool operator==( const BOARD_ITEM& aOther ) const override;
915
916 void Serialize( google::protobuf::Any &aContainer ) const override;
917 bool Deserialize( const google::protobuf::Any &aContainer ) override;
918
919 void Serialize( kiapi::board::types::Via& aVia ) const;
920 bool Deserialize( const kiapi::board::types::Via& aVia );
921
922 wxString LayerMaskDescribe() const override;
923
924protected:
925 void swapData( BOARD_ITEM* aImage ) override;
926
927private:
928 // Silence GCC warning about hiding the PCB_TRACK base method
929 bool operator==( const PCB_TRACK& aOther ) const override;
930
931 bool sameZoneLayerOverrides( const PCB_VIA& aOther ) const;
932
933private:
935
937
938 bool m_isFree;
939
940 // These are used in zone filling, so use a fixed size to avoid undefined behavior
941 std::array<std::atomic<ZONE_LAYER_OVERRIDE>, MAX_CU_LAYERS> m_zoneLayerOverrides;
942};
ERROR_LOC
When approximating an arc or circle, should the error be placed on the outside or inside of the curve...
BITMAPS
A list of all bitmap identifiers.
ZONE_LAYER_OVERRIDE
Conditionally flashed vias and pads that interact with zones of different priority can be very squirr...
Definition board_item.h:75
BOX2< VECTOR2I > BOX2I
Definition box2.h:917
BOARD_CONNECTED_ITEM(BOARD_ITEM *aParent, KICAD_T idtype)
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:99
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:101
virtual bool FitsEnabledLayers(const LSET &aEnabledLayers, int aCopperLayerCount) const
Check if a board offering aEnabledLayers can hold this item.
Information pertinent to a Pcbnew printed circuit board.
Definition board.h:411
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition eda_item.h:98
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:110
virtual bool IsType(const std::vector< KICAD_T > &aScanTypes) const
Check whether the item is one of the listed types.
Definition eda_item.h:214
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:84
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:37
EDA_MSG_PANEL items for displaying messages.
Definition msgpanel.h:50
A PADSTACK defines the characteristics of a single or multi-layer pad, in the IPC sense of the word.
Definition padstack.h:161
MODE
! Copper geometry mode: controls how many unique copper layer shapes this padstack has
Definition padstack.h:174
Definition pad.h:61
VECTOR2I GetPosition() const override
static std::unique_ptr< PCB_TRACK > CreateFromThreePoints(BOARD_ITEM *aParent, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Create a PCB_ARC through the three points, or a PCB_TRACK segment when they are straight.
Definition pcb_track.cpp:95
bool IsDegenerated(int aThreshold=5) const
virtual void swapData(BOARD_ITEM *aImage) override
bool IsCCW() const
virtual double GetLength() const override
Return the length of the arc track.
Definition pcb_track.h:338
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
EDA_ANGLE GetArcAngleStart() const
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition pcb_track.h:311
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
EDA_ANGLE GetArcAngleEnd() const
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition pcb_track.h:309
void SetPosition(const VECTOR2I &aPos) override
Definition pcb_track.h:306
wxString GetClass() const override
Return the class name.
Definition pcb_track.h:323
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void SetMid(const VECTOR2I &aMid)
Definition pcb_track.h:303
double GetRadius() const
EDA_ANGLE GetAngle() const
const VECTOR2I & GetMid() const
Definition pcb_track.h:304
PCB_ARC(BOARD_ITEM *aParent)
Definition pcb_track.h:268
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
VECTOR2I m_Mid
Arc mid point, halfway between start and end.
Definition pcb_track.h:368
static bool ClassOf(const EDA_ITEM *aItem)
Definition pcb_track.h:283
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
bool operator==(const PCB_ARC &aOther) const
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition pcb_track.h:288
void CopyFrom(const BOARD_ITEM *aOther) override
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
virtual void SetLayerSet(const LSET &aLayers) override
int GetSolderMaskExpansion() const
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void SetEndY(int aY)
Definition pcb_track.h:109
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition pcb_track.h:91
bool IsOnCopperLayer() const override
Definition pcb_track.h:226
void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition pcb_track.h:75
wxString GetClass() const override
Return the class name.
Definition pcb_track.h:204
void SetHasSolderMask(bool aVal)
Definition pcb_track.h:123
virtual double GetLength() const
Get the length of the track using the hypotenuse calculation.
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
void swapData(BOARD_ITEM *aImage) override
void SetEnd(const VECTOR2I &aEnd)
Definition pcb_track.h:96
bool HasSolderMask() const
Definition pcb_track.h:124
void SetStart(const VECTOR2I &aStart)
Definition pcb_track.h:99
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
int GetStartY() const
Definition pcb_track.h:106
int GetEndX() const
Definition pcb_track.h:111
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
void Mirror(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Mirror this object relative to a given horizontal axis the layer is not changed.
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
INSPECT_RESULT Visit(INSPECTOR inspector, void *testData, const std::vector< KICAD_T > &aScanTypes) override
May be re-implemented for each derived class in order to handle all the types given by its member dat...
bool ApproxCollinear(const PCB_TRACK &aTrack)
VECTOR2I m_End
Line end point.
Definition pcb_track.h:255
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition pcb_track.h:126
std::optional< int > m_solderMaskMargin
Definition pcb_track.h:258
void CopyFrom(const BOARD_ITEM *aOther) override
Definition pcb_track.cpp:79
void SetPosition(const VECTOR2I &aPos) override
Definition pcb_track.h:89
std::optional< int > GetLocalSolderMaskMargin() const
Definition pcb_track.h:127
virtual double GetDelay() const
Get the time delay of the track.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition pcb_track.cpp:73
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
void TransformShapeToPolygon(SHAPE_POLY_SET &aBuffer, PCB_LAYER_ID aLayer, int aClearance, int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth=false) const override
Convert the track shape to a closed polygon.
const VECTOR2I & GetStart() const
Definition pcb_track.h:100
bool operator==(const BOARD_ITEM &aOther) const override
VECTOR2I m_Start
Line start point.
Definition pcb_track.h:254
int GetEndY() const
Definition pcb_track.h:112
wxString GetFriendlyName() const override
VECTOR2I GetPosition() const override
Definition pcb_track.h:90
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
const VECTOR2I & GetEndPoint(ENDPOINT_T aEndPoint) const
Return the selected endpoint (start or end)
Definition pcb_track.h:115
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
static bool ClassOf(const EDA_ITEM *aItem)
Definition pcb_track.h:64
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
bool IsNull() const
Return true if segment length is zero.
Definition pcb_track.h:187
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
bool m_hasSolderMask
Definition pcb_track.h:257
void SetStartX(int aX)
Definition pcb_track.h:102
const VECTOR2I & GetEnd() const
Definition pcb_track.h:97
PCB_TRACK(BOARD_ITEM *aParent, KICAD_T idtype=PCB_TRACE_T)
Definition pcb_track.cpp:65
void SetStartY(int aY)
Definition pcb_track.h:103
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
virtual MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const
double GetCoverageArea(int aTextMargin) const override
Return the board area this item covers, used to rank candidates under the cursor so a click on a smal...
void SetEndX(int aX)
Definition pcb_track.h:108
int GetStartX() const
Definition pcb_track.h:105
int m_width
Thickness of track (or arc) – no longer the width of a via.
Definition pcb_track.h:261
EDA_ITEM_FLAGS IsPointOnEnds(const VECTOR2I &point, int min_dist=0) const
Return STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if point if near (dist = m...
virtual void SetWidth(int aWidth)
Definition pcb_track.h:93
virtual int GetWidth() const
Definition pcb_track.h:94
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
void SetRemoveUnconnected(bool aSet)
Definition pcb_track.h:653
FILLING_MODE ResolveFillingMode() const
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:890
int GetFrontPostMachiningSize() const
Definition pcb_track.h:755
PCB_LAYER_ID BottomLayer() const
BITMAPS GetMenuImage() const override
Return a pointer to an image to be used in menus.
std::shared_ptr< SHAPE > GetEffectiveShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, FLASHING aFlash=FLASHING::DEFAULT, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
Some pad shapes can be complex (rounded/chamfered rectangle), even without considering custom shapes.
PLUGGING_MODE GetFrontPluggingMode() const
VECTOR2I GetPosition() const override
Definition pcb_track.h:615
bool IsTented(PCB_LAYER_ID aLayer) const override
Checks if the given object is tented (its copper shape is covered by solder mask) on a given side of ...
void CopyFrom(const BOARD_ITEM *aOther) override
bool FitsEnabledLayers(const LSET &aEnabledLayers, int aCopperLayerCount) const override
Check if a board offering aEnabledLayers can hold this item.
Definition pcb_track.h:420
double GetCoverageArea(int aTextMargin) const override
Return the board area this item covers, used to rank candidates under the cursor so a click on a smal...
PCB_LAYER_ID GetTopBackdrillLayer() const
Definition pcb_track.h:455
bool IsGhostLayer(PCB_LAYER_ID aLayer) const
bool GetPrimaryDrillFilledFlag() const
Definition pcb_track.h:824
PCB_LAYER_ID GetPrincipalLayer() const
void SetFrontPostMachiningDepth(int aDepth)
Definition pcb_track.h:756
void SetCappingMode(CAPPING_MODE aMode)
void SetFrontCoveringMode(COVERING_MODE aMode)
wxString LayerMaskDescribe() const override
Return a string (to be shown to the user) describing a layer mask.
CAPPING_MODE ResolveCappingMode() const
int GetBackPostMachiningDepth() const
Definition pcb_track.h:780
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void SetBackPostMachiningAngle(int aAngle)
Definition pcb_track.h:781
int GetBackPostMachiningAngle() const
Definition pcb_track.h:782
PCB_LAYER_ID GetTertiaryDrillEndLayer() const
Definition pcb_track.h:878
COVERING_MODE GetBackCoveringMode() const
std::optional< int > GetTertiaryDrillSize() const
PLUGGING_MODE ResolveFrontPluggingMode() const
bool GetRemoveUnconnected() const
Definition pcb_track.h:659
void SetTopBackdrillSize(std::optional< int > aSize)
Definition pcb_track.h:453
bool FlashLayer(int aLayer) const
Check to see whether the via should have a pad on the specific layer.
ZONE_LAYER_OVERRIDE GetZoneLayerOverride(PCB_LAYER_ID aLayer) const
void SetKeepStartEnd(bool aSet)
Definition pcb_track.h:668
void SetBackPostMachiningMode(PAD_DRILL_POST_MACHINING_MODE aMode)
Definition pcb_track.h:767
std::optional< int > GetTopBackdrillSize() const
Definition pcb_track.h:452
void SetBackdrillMode(BACKDRILL_MODE aMode)
Definition pcb_track.h:444
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition pcb_track.h:850
void SetBottomBackdrillSize(std::optional< int > aSize)
Definition pcb_track.h:447
void ClearZoneLayerOverrides()
CAPPING_MODE GetCappingMode() const
const PADSTACK & Padstack() const
Definition pcb_track.h:435
void SetFrontTentingMode(TENTING_MODE aMode)
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition pcb_track.h:838
PAD_DRILL_SHAPE GetTertiaryDrillShape() const
Definition pcb_track.h:881
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition pcb_track.h:938
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
bool HasCopperRemoved(PCB_LAYER_ID aLayer) const
Check whether backdrilling or post-machining left no copper at all on a layer.
int GetFrontPostMachiningDepth() const
Definition pcb_track.h:757
bool IsBlindVia() const
static std::vector< std::vector< PCB_VIA * > > CollectMicroviaColumns(BOARD *aBoard)
Runs of microvias that land on one another, each ordered from its outermost hop down.
PAD_DRILL_SHAPE GetPrimaryDrillShape() const
Definition pcb_track.h:730
TENTING_MODE GetFrontTentingMode() const
std::optional< bool > GetPrimaryDrillCapped() const
Definition pcb_track.h:828
int GetPostMachiningKnockout(PCB_LAYER_ID aLayer) const
Get the knockout diameter for a layer affected by post-machining.
void SetBottomLayer(PCB_LAYER_ID aLayer)
void SetPrimaryDrillSize(const VECTOR2I &aSize)
Set the drill value for vias.
bool IsBackdrilledOrPostMachined(PCB_LAYER_ID aLayer) const
Check if a layer is affected by backdrilling or post-machining operations.
std::optional< int > GetSecondaryDrillSize() const
PLUGGING_MODE ResolveBackPluggingMode() const
void SetPrimaryDrillCappedFlag(bool aCapped)
PADSTACK & Padstack()
Definition pcb_track.h:436
int GetSolderMaskExpansion() const
void SetSecondaryDrillStartLayer(PCB_LAYER_ID aLayer)
void SetTertiaryDrillEndLayer(PCB_LAYER_ID aLayer)
bool HasValidLayerPair(int aCopperLayerCount) const
std::optional< PAD_DRILL_POST_MACHINING_MODE > GetFrontPostMachining() const
Definition pcb_track.h:739
void ClearSecondaryDrillSize()
void SetBackPostMachiningDepth(int aDepth)
Definition pcb_track.h:779
void SetDrill(int aDrill)
Definition pcb_track.h:831
PLUGGING_MODE GetBackPluggingMode() const
void SetBackPluggingMode(PLUGGING_MODE aMode)
PCB_LAYER_ID GetSecondaryDrillEndLayer() const
Definition pcb_track.h:864
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
void SetPadstackMode(PADSTACK::MODE aMode)
Definition pcb_track.h:499
void SetBackTentingMode(TENTING_MODE aMode)
PAD_DRILL_SHAPE GetSecondaryDrillShape() const
Definition pcb_track.h:867
void SetIsFree(bool aFree=true)
Definition pcb_track.h:891
std::optional< bool > GetPrimaryDrillFilled() const
Definition pcb_track.h:823
COVERING_MODE ResolveBackCoveringMode() const
void SetFrontPluggingMode(PLUGGING_MODE aMode)
PCB_LAYER_ID GetPrimaryDrillStartLayer() const
Definition pcb_track.h:733
void Flip(const VECTOR2I &aCentre, FLIP_DIRECTION aFlipDirection) override
Flip this object, i.e.
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Populate aList of MSG_PANEL_ITEM objects with it's internal state for display purposes.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void SetFrontPostMachining(const std::optional< PAD_DRILL_POST_MACHINING_MODE > &aMode)
bool operator==(const PCB_VIA &aOther) const
PCB_LAYER_ID GetLayer() const override
Return the primary layer this item is on.
void SetSecondaryDrillEndLayer(PCB_LAYER_ID aLayer)
int GetFrontPostMachiningAngle() const
Definition pcb_track.h:759
std::shared_ptr< SHAPE_SEGMENT > GetEffectiveHoleShape(PCB_LAYER_ID aLayer=UNDEFINED_LAYER, DRC_CONSTRAINT_T aUsage=NULL_CONSTRAINT) const override
PCB_LAYER_ID GetPrimaryDrillEndLayer() const
Definition pcb_track.h:736
void SetFrontPostMachiningAngle(int aAngle)
Definition pcb_track.h:758
void SetTopLayer(PCB_LAYER_ID aLayer)
FILLING_MODE GetFillingMode() const
void SetPosition(const VECTOR2I &aPoint) override
Definition pcb_track.h:616
int GetBackdrillOrPostMachiningKnockout(PCB_LAYER_ID aLayer) const
bool IsBuriedVia() const
int GetFrontWidth() const
Definition pcb_track.h:509
void SetSizeFromRules(int aDiameter, int aDrill)
Give the via a uniform padstack sized from its diameter and hole rules.
std::array< std::atomic< ZONE_LAYER_OVERRIDE >, MAX_CU_LAYERS > m_zoneLayerOverrides
Definition pcb_track.h:941
void SetLayerPair(PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer)
For a via m_layer contains the top layer, the other layer is in m_bottomLayer/.
bool HasDrilledHole() const override
Definition pcb_track.h:516
PAD_DRILL_POST_MACHINING_MODE GetFrontPostMachiningMode() const
Definition pcb_track.h:749
bool IsOnCopperLayer() const override
void SetFrontPostMachiningSize(int aSize)
Definition pcb_track.h:754
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
bool IsType(const std::vector< KICAD_T > &aScanTypes) const override
Check whether the item is one of the listed types.
Definition pcb_track.h:393
double Similarity(const BOARD_ITEM &aOther) const override
Return a measure of how likely the other object is to represent the same object.
void SetLayer(PCB_LAYER_ID aLayer) override
Set the layer this item is on.
void SetTertiaryDrillStartLayer(PCB_LAYER_ID aLayer)
PCB_LAYER_ID GetBottomBackdrillLayer() const
Definition pcb_track.h:449
void SetPrimaryDrillShape(PAD_DRILL_SHAPE aShape)
static std::optional< VIA_PARAMETER_ERROR > ValidateViaParameters(std::optional< int > aDiameter, std::optional< int > aPrimaryDrill, std::optional< PCB_LAYER_ID > aPrimaryStartLayer=std::nullopt, std::optional< PCB_LAYER_ID > aPrimaryEndLayer=std::nullopt, std::optional< int > aSecondaryDrill=std::nullopt, std::optional< PCB_LAYER_ID > aSecondaryStartLayer=std::nullopt, std::optional< PCB_LAYER_ID > aSecondaryEndLayer=std::nullopt, std::optional< int > aTertiaryDrill=std::nullopt, std::optional< PCB_LAYER_ID > aTertiaryStartLayer=std::nullopt, std::optional< PCB_LAYER_ID > aTertiaryEndLayer=std::nullopt, int aCopperLayerCount=0)
bool IsMicroVia() const
void SetTertiaryDrillShape(PAD_DRILL_SHAPE aShape)
bool GetKeepStartEnd() const
Definition pcb_track.h:674
virtual void SetLayerSet(const LSET &aLayers) override
Note SetLayerSet() initialize the first and last copper layers connected by the via.
void GetOutermostConnectedLayers(PCB_LAYER_ID *aTopmost, PCB_LAYER_ID *aBottommost) const
Return the top-most and bottom-most connected layers.
static bool ClassOf(const EDA_ITEM *aItem)
Definition pcb_track.h:377
void SetSecondaryDrillShape(PAD_DRILL_SHAPE aShape)
bool HasHole() const override
Definition pcb_track.h:511
void SanitizeLayers()
Check so that the layers are correct depending on the type of via, and so that the top actually is on...
int GetWidth() const override
void SetBackPostMachining(const std::optional< PAD_DRILL_POST_MACHINING_MODE > &aMode)
PCB_LAYER_ID GetTertiaryDrillStartLayer() const
Definition pcb_track.h:875
PCB_VIA & operator=(const PCB_VIA &aOther)
void swapData(BOARD_ITEM *aImage) override
wxString GetClass() const override
Return the class name.
Definition pcb_track.h:625
const VECTOR2I & GetPrimaryDrillSize() const
Definition pcb_track.h:727
void Serialize(google::protobuf::Any &aContainer) const override
Serializes this object to the given Any message.
void SetFillingMode(FILLING_MODE aMode)
bool GetIsNotFree() const
Definition pcb_track.h:894
PCB_VIA(BOARD_ITEM *aParent)
void SetPrimaryDrillFilledFlag(bool aFilled)
std::optional< int > GetBottomBackdrillSize() const
Definition pcb_track.h:446
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition pcb_track.h:679
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
void SetViaType(VIATYPE aViaType)
Definition pcb_track.h:427
int GetMinAnnulus(PCB_LAYER_ID aLayer, wxString *aSource) const
bool IsOnLayer(PCB_LAYER_ID aLayer) const override
Test to see if this object is on the given layer.
TENTING_MODE GetBackTentingMode() const
PCB_LAYER_ID TopLayer() const
void ClearTertiaryDrillSize()
VIATYPE m_viaType
through, blind/buried or micro
Definition pcb_track.h:934
void SetBottomBackdrillLayer(PCB_LAYER_ID aLayer)
Definition pcb_track.h:450
int GetBackPostMachiningSize() const
Definition pcb_track.h:778
TENTING_MODE ResolveBackTentingMode() const
void SetTertiaryDrillSize(const VECTOR2I &aSize)
void SetIsNotFree(bool aNotFree)
Definition pcb_track.h:895
PADSTACK m_padStack
Definition pcb_track.h:936
void SetSecondaryDrillSize(const VECTOR2I &aSize)
COVERING_MODE GetFrontCoveringMode() const
int GetDrillValue() const
Calculate the drill value for vias (m_drill if > 0, or default drill value for the board).
void SetZoneLayerOverride(PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride)
bool sameZoneLayerOverrides(const PCB_VIA &aOther) const
PAD_DRILL_POST_MACHINING_MODE GetBackPostMachiningMode() const
Definition pcb_track.h:772
void SetFrontWidth(int aWidth)
Definition pcb_track.h:508
VIATYPE GetViaType() const
Definition pcb_track.h:426
PCB_LAYER_ID GetSecondaryDrillStartLayer() const
Definition pcb_track.h:861
double ViewGetLOD(int aLayer, const KIGFX::VIEW *aView) const override
Return the level of detail (LOD) of the item.
void SetPrimaryDrillCapped(const std::optional< bool > &aCapped)
COVERING_MODE ResolveFrontCoveringMode() const
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
BACKDRILL_MODE GetBackdrillMode() const
Definition pcb_track.h:443
void SetWidth(int aWidth) override
std::optional< PAD_DRILL_POST_MACHINING_MODE > GetBackPostMachining() const
Definition pcb_track.h:762
void SetBackCoveringMode(COVERING_MODE aMode)
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
void SetPrimaryDrillFilled(const std::optional< bool > &aFilled)
void SetTopBackdrillLayer(PCB_LAYER_ID aLayer)
Definition pcb_track.h:456
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)
void SetPadstack(const PADSTACK &aPadstack)
Definition pcb_track.h:437
void SetFrontPostMachiningMode(PAD_DRILL_POST_MACHINING_MODE aMode)
Definition pcb_track.h:744
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool GetPrimaryDrillCappedFlag() const
Definition pcb_track.h:829
TENTING_MODE ResolveFrontTentingMode() const
void SetBackPostMachiningSize(int aSize)
Definition pcb_track.h:777
void SetPrimaryDrillEndLayer(PCB_LAYER_ID aLayer)
void SetPrimaryDrillStartLayer(PCB_LAYER_ID aLayer)
Definition seg.h:38
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
Represent a set of closed polygons.
@ NULL_CONSTRAINT
INSPECT_RESULT
Definition eda_item.h:44
const INSPECTOR_FUNC & INSPECTOR
std::function passed to nested users by ref, avoids copying std::function.
Definition eda_item.h:91
std::uint32_t EDA_ITEM_FLAGS
FLASHING
Enum used during connectivity building to ensure we do not query connectivity while building the data...
Definition layer_ids.h:180
@ DEFAULT
Flashing follows connectivity.
Definition layer_ids.h:181
#define MAX_CU_LAYERS
Definition layer_ids.h:172
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
@ UNDEFINED_LAYER
Definition layer_ids.h:57
@ F_Cu
Definition layer_ids.h:60
FLIP_DIRECTION
Definition mirror.h:26
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition eda_angle.h:461
PAD_DRILL_POST_MACHINING_MODE
Definition padstack.h:77
PAD_DRILL_SHAPE
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Definition padstack.h:70
BACKDRILL_MODE
Definition padstack.h:85
Declarations of types for tracks and vias.
FILLING_MODE
VIATYPE
TENTING_MODE
COVERING_MODE
ENDPOINT_T
@ ENDPOINT_START
PLUGGING_MODE
#define UNDEFINED_DRILL_DIAMETER
CAPPING_MODE
bool operator()(const PCB_TRACK *aFirst, const PCB_TRACK *aSecond) const
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:70
@ PCB_VIA_T
class PCB_VIA, a via (like a track segment on a copper layer)
Definition typeinfo.h:89
@ PCB_LOCATE_BLINDVIA_T
Definition typeinfo.h:120
@ PCB_LOCATE_STDVIA_T
Definition typeinfo.h:118
@ PCB_LOCATE_BURIEDVIA_T
Definition typeinfo.h:121
@ PCB_ARC_T
class PCB_ARC, an arc track segment on a copper layer
Definition typeinfo.h:90
@ PCB_LOCATE_UVIA_T
Definition typeinfo.h:119
@ PCB_TRACE_T
class PCB_TRACK, a track segment (segment on a copper layer)
Definition typeinfo.h:88
VECTOR2< int32_t > VECTOR2I
Definition vector2d.h:708