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 virtual void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
84
85 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
86
87 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
88 VECTOR2I GetPosition() const override { return m_Start; }
89 const VECTOR2I GetFocusPosition() const override { return ( m_Start + m_End ) / 2; }
90
91 virtual void SetWidth( int aWidth ) { m_width = aWidth; }
92 virtual int GetWidth() const { return m_width; }
93
94 void SetEnd( const VECTOR2I& aEnd ) { m_End = aEnd; }
95 const VECTOR2I& GetEnd() const { return m_End; }
96
97 void SetStart( const VECTOR2I& aStart ) { m_Start = aStart; }
98 const VECTOR2I& GetStart() const { return m_Start; }
99
100 void SetStartX( int aX ) { m_Start.x = aX; }
101 void SetStartY( int aY ) { m_Start.y = aY; }
102
103 int GetStartX() const { return m_Start.x; }
104 int GetStartY() const { return m_Start.y; }
105
106 void SetEndX( int aX ) { m_End.x = aX; }
107 void SetEndY( int aY ) { m_End.y = aY; }
108
109 int GetEndX() const { return m_End.x; }
110 int GetEndY() const { return m_End.y; }
111
113 const VECTOR2I& GetEndPoint( ENDPOINT_T aEndPoint ) const
114 {
115 if( aEndPoint == ENDPOINT_START )
116 return m_Start;
117 else
118 return m_End;
119 }
120
121 void SetHasSolderMask( bool aVal ) { m_hasSolderMask = aVal; }
122 bool HasSolderMask() const { return m_hasSolderMask; }
123
124 void SetLocalSolderMaskMargin( std::optional<int> aMargin ) { m_solderMaskMargin = aMargin; }
125 std::optional<int> GetLocalSolderMaskMargin() const { return m_solderMaskMargin; }
126
127 int GetSolderMaskExpansion() const;
128
129 // Virtual function
130 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
131
132 virtual LSET GetLayerSet() const override;
133 virtual void SetLayerSet( const LSET& aLayers ) override;
134
135 const BOX2I GetBoundingBox() const override;
136
142 virtual double GetLength() const;
143
149 virtual double GetDelay() const;
150
151 double GetCoverageArea( int aTextMargin ) const override;
152
165 void TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, PCB_LAYER_ID aLayer, int aClearance,
166 int aError, ERROR_LOC aErrorLoc, bool ignoreLineWidth = false ) const override;
167
168 // @copydoc BOARD_ITEM::GetEffectiveShape
169 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
171 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
172
180 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
181
185 bool IsNull() const
186 {
187 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
188 }
189
190 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
191 wxString GetFriendlyName() const override;
192
193 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
194 const std::vector<KICAD_T>& aScanTypes ) override;
195
196 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
197 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
198 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
199
200 bool ApproxCollinear( const PCB_TRACK& aTrack );
201
202 wxString GetClass() const override
203 {
204 return wxT( "PCB_TRACK" );
205 }
206
207 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
208
209 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
210
211 BITMAPS GetMenuImage() const override;
212
213 EDA_ITEM* Clone() const override;
214
215 std::vector<int> ViewGetLayers() const override;
216
217 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
218
219 const BOX2I ViewBBox() const override;
220
224 bool IsOnCopperLayer() const override
225 {
226 return true;
227 }
228
229 double Similarity( const BOARD_ITEM& aOther ) const override;
230
231 bool operator==( const BOARD_ITEM& aOther ) const override;
232 virtual bool operator==( const PCB_TRACK& aOther ) const;
233
235 {
236 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
237 };
238
239 void Serialize( google::protobuf::Any &aContainer ) const override;
240 bool Deserialize( const google::protobuf::Any &aContainer ) override;
241
242#if defined (DEBUG)
243 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
244#endif
245
246protected:
247 void swapData( BOARD_ITEM* aImage ) override;
248
249 void GetMsgPanelInfoBase_Common( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) const;
250
251protected:
254
256 std::optional<int> m_solderMaskMargin;
257
258private:
260};
261
262
263class PCB_ARC : public PCB_TRACK
264{
265public:
266 PCB_ARC( BOARD_ITEM* aParent ) :
267 PCB_TRACK( aParent, PCB_ARC_T )
268 { }
269
270 PCB_ARC( BOARD_ITEM* aParent, const SHAPE_ARC* aArc );
271
276 static std::unique_ptr<PCB_TRACK> CreateFromThreePoints( BOARD_ITEM* aParent, const VECTOR2I& aStart,
277 const VECTOR2I& aMid, const VECTOR2I& aEnd );
278
279 void CopyFrom( const BOARD_ITEM* aOther ) override;
280
281 static inline bool ClassOf( const EDA_ITEM *aItem )
282 {
283 return aItem && PCB_ARC_T == aItem->Type();
284 }
285
286 void Move( const VECTOR2I& aMoveVector ) override
287 {
288 m_Start += aMoveVector;
289 m_Mid += aMoveVector;
290 m_End += aMoveVector;
291 }
292
293 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
294
295 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
296
297 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
298
299 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
300 const VECTOR2I& GetMid() const { return m_Mid; }
301
302 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
303
304 VECTOR2I GetPosition() const override;
305 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
306
307 VECTOR2I GetCenter() const override { return GetPosition(); }
308
309 double GetRadius() const;
310 EDA_ANGLE GetAngle() const;
312 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
313 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
314
315 bool HitTest( const BOX2I& aRect, bool aContained = true, int aAccuracy = 0 ) const override;
316
317 bool IsCCW() const;
318
319 wxString GetClass() const override
320 {
321 return wxT( "PCB_ARC" );
322 }
323
324 // @copydoc BOARD_ITEM::GetEffectiveShape
325 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
327 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
328
334 virtual double GetLength() const override
335 {
336 return GetRadius() * std::abs( GetAngle().AsRadians() );
337 }
338
339 EDA_ITEM* Clone() const override;
340
347 bool IsDegenerated( int aThreshold = 5 ) const;
348
349 double Similarity( const BOARD_ITEM& aOther ) const override;
350
351 bool operator==( const PCB_ARC& aOther ) const;
352 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
353
354 void Serialize( google::protobuf::Any &aContainer ) const override;
355 bool Deserialize( const google::protobuf::Any &aContainer ) override;
356
357protected:
358 virtual void swapData( BOARD_ITEM* aImage ) override;
359
360private:
361 // Silence GCC warning about overriding the base class method
362 bool operator==( const PCB_TRACK& aOther ) const override;
363
365};
366
367
368class PCB_VIA : public PCB_TRACK
369{
370public:
371 PCB_VIA( BOARD_ITEM* aParent );
372
373 static inline bool ClassOf( const EDA_ITEM *aItem )
374 {
375 return aItem && PCB_VIA_T == aItem->Type();
376 }
377
378 PCB_VIA( const PCB_VIA& aOther );
379 PCB_VIA& operator=( const PCB_VIA &aOther );
380
385 static std::vector<std::vector<PCB_VIA*>> CollectMicroviaColumns( BOARD* aBoard );
386
387 void CopyFrom( const BOARD_ITEM* aOther ) override;
388
389 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
390 {
391 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
392 return true;
393
394 for( KICAD_T scanType : aScanTypes )
395 {
396 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
397 return true;
398 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
399 return true;
400 else if( scanType == PCB_LOCATE_BLINDVIA_T && m_viaType == VIATYPE::BLIND )
401 return true;
402 else if( scanType == PCB_LOCATE_BURIEDVIA_T && m_viaType == VIATYPE::BURIED )
403 return true;
404 }
405
406 return false;
407 }
408
412 bool HasValidLayerPair( int aCopperLayerCount ) const;
413
416 bool FitsEnabledLayers( const LSET& aEnabledLayers, int aCopperLayerCount ) const override
417 {
418 return BOARD_ITEM::FitsEnabledLayers( aEnabledLayers, aCopperLayerCount )
419 && HasValidLayerPair( aCopperLayerCount );
420 }
421
422 VIATYPE GetViaType() const { return m_viaType; }
423 void SetViaType( VIATYPE aViaType )
424 {
425 m_viaType = aViaType;
426
427 // If someone updates a VIA to TH, we want to kick out any non-outer layers
429 }
430
431 const PADSTACK& Padstack() const { return m_padStack; }
433 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
434
435 // A micro, blind, or buried via with a Front/Inner/Back padstack definition is an odd beast as it might
436 // not exist on F_Cu or B_Cu.
437 bool IsGhostLayer( PCB_LAYER_ID aLayer ) const;
438
439 BACKDRILL_MODE GetBackdrillMode() const { return m_padStack.GetBackdrillMode(); }
440 void SetBackdrillMode( BACKDRILL_MODE aMode ) { m_padStack.SetBackdrillMode( aMode ); }
441
442 std::optional<int> GetBottomBackdrillSize() const { return m_padStack.GetBackdrillSize( false ); }
443 void SetBottomBackdrillSize( std::optional<int> aSize ) { m_padStack.SetBackdrillSize( false, aSize ); }
444
445 PCB_LAYER_ID GetBottomBackdrillLayer() const { return m_padStack.GetBackdrillEndLayer( false ); }
446 void SetBottomBackdrillLayer( PCB_LAYER_ID aLayer ) { m_padStack.SetBackdrillEndLayer( false, aLayer ); }
447
448 std::optional<int> GetTopBackdrillSize() const { return m_padStack.GetBackdrillSize( true ); }
449 void SetTopBackdrillSize( std::optional<int> aSize ) { m_padStack.SetBackdrillSize( true, aSize ); }
450
451 PCB_LAYER_ID GetTopBackdrillLayer() const { return m_padStack.GetBackdrillEndLayer( true ); }
452 void SetTopBackdrillLayer( PCB_LAYER_ID aLayer ) { m_padStack.SetBackdrillEndLayer( true, aLayer ); }
453
454 bool IsMicroVia() const;
455 bool IsBlindVia() const;
456 bool IsBuriedVia() const;
457
478
479 static std::optional<VIA_PARAMETER_ERROR>
480 ValidateViaParameters( std::optional<int> aDiameter,
481 std::optional<int> aPrimaryDrill,
482 std::optional<PCB_LAYER_ID> aPrimaryStartLayer = std::nullopt,
483 std::optional<PCB_LAYER_ID> aPrimaryEndLayer = std::nullopt,
484 std::optional<int> aSecondaryDrill = std::nullopt,
485 std::optional<PCB_LAYER_ID> aSecondaryStartLayer = std::nullopt,
486 std::optional<PCB_LAYER_ID> aSecondaryEndLayer = std::nullopt,
487 std::optional<int> aTertiaryDrill = std::nullopt,
488 std::optional<PCB_LAYER_ID> aTertiaryStartLayer = std::nullopt,
489 std::optional<PCB_LAYER_ID> aTertiaryEndLayer = std::nullopt,
490 int aCopperLayerCount = 0 );
491
492 const BOX2I GetBoundingBox() const override;
493 const BOX2I GetBoundingBox( PCB_LAYER_ID aLayer ) const;
494
495 void SetPadstackMode( PADSTACK::MODE aMode ) { m_padStack.SetMode( aMode ); }
496
497 void SetWidth( int aWidth ) override;
498 int GetWidth() const override;
499
500 void SetWidth( PCB_LAYER_ID aLayer, int aWidth );
501 int GetWidth( PCB_LAYER_ID aLayer ) const;
502
503 // For properties panel
504 void SetFrontWidth( int aWidth ) { SetWidth( F_Cu, aWidth ); }
505 int GetFrontWidth() const { return GetWidth( F_Cu ); }
506
507 bool HasHole() const override
508 {
509 return true;
510 }
511
512 bool HasDrilledHole() const override
513 {
515 }
516
517 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
518 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
519
520 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
521 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
522
531 void SetSizeFromRules( int aDiameter, int aDrill );
532
533 void SetFrontTentingMode( TENTING_MODE aMode );
535 void SetBackTentingMode( TENTING_MODE aMode );
537
542
547
548 void SetCappingMode( CAPPING_MODE aMode );
550
551 void SetFillingMode( FILLING_MODE aMode );
553
554 bool IsTented( PCB_LAYER_ID aLayer ) const override;
555 int GetSolderMaskExpansion() const;
556
558
559 PCB_LAYER_ID GetLayer() const override;
560 void SetLayer( PCB_LAYER_ID aLayer ) override;
561
562 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
563
564 bool IsOnCopperLayer() const override;
565
566 virtual LSET GetLayerSet() const override;
567
572 virtual void SetLayerSet( const LSET& aLayers ) override;
573
580 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
581
582 void SetBottomLayer( PCB_LAYER_ID aLayer );
583 void SetTopLayer( PCB_LAYER_ID aLayer );
584
592 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
593
594 PCB_LAYER_ID TopLayer() const;
596
601 void SanitizeLayers();
602
603 VECTOR2I GetPosition() const override { return m_Start; }
604 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
605
606 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
607
608 double GetCoverageArea( int aTextMargin ) const override;
609
610 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
611 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
612
613 wxString GetClass() const override
614 {
615 return wxT( "PCB_VIA" );
616 }
617
618 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
619
620 BITMAPS GetMenuImage() const override;
621
622 EDA_ITEM* Clone() const override;
623
624 std::vector<int> ViewGetLayers() const override;
625
626 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
627
628 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
629
630#if defined (DEBUG)
631 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
632#endif
633
634 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
635
641 void SetRemoveUnconnected( bool aSet )
642 {
643 m_padStack.SetUnconnectedLayerMode( aSet ? UNCONNECTED_LAYER_MODE::REMOVE_ALL
645 }
646
648 {
649 return m_padStack.UnconnectedLayerMode() != UNCONNECTED_LAYER_MODE::KEEP_ALL;
650 }
651
656 void SetKeepStartEnd( bool aSet )
657 {
660 }
661
662 bool GetKeepStartEnd() const
663 {
665 }
666
668 {
669 switch( m_padStack.UnconnectedLayerMode() )
670 {
672 return false;
673
675 return true;
676
679 return aLayer != m_padStack.Drill().start && aLayer != m_padStack.Drill().end;
680 }
681
682 return true;
683 }
684
691 bool FlashLayer( int aLayer ) const;
692
700 bool FlashLayer( const LSET& aLayers ) const;
701
707 void GetOutermostConnectedLayers( PCB_LAYER_ID* aTopmost, PCB_LAYER_ID* aBottommost ) const;
708
714 void SetPrimaryDrillSize( const VECTOR2I& aSize );
715 const VECTOR2I& GetPrimaryDrillSize() const { return m_padStack.Drill().size; }
716
718 PAD_DRILL_SHAPE GetPrimaryDrillShape() const { return m_padStack.Drill().shape; }
719
721 PCB_LAYER_ID GetPrimaryDrillStartLayer() const { return m_padStack.Drill().start; }
722
724 PCB_LAYER_ID GetPrimaryDrillEndLayer() const { return m_padStack.Drill().end; }
725
726 void SetFrontPostMachining( const std::optional<PAD_DRILL_POST_MACHINING_MODE>& aMode );
727 std::optional<PAD_DRILL_POST_MACHINING_MODE> GetFrontPostMachining() const
728 {
729 return m_padStack.FrontPostMachining().mode;
730 }
731
733 {
734 m_padStack.FrontPostMachining().mode = aMode;
735 }
736
741
742 void SetFrontPostMachiningSize( int aSize ) { m_padStack.FrontPostMachining().size = aSize; }
743 int GetFrontPostMachiningSize() const { return m_padStack.FrontPostMachining().size; }
744 void SetFrontPostMachiningDepth( int aDepth ) { m_padStack.FrontPostMachining().depth = aDepth; }
745 int GetFrontPostMachiningDepth() const { return m_padStack.FrontPostMachining().depth; }
746 void SetFrontPostMachiningAngle( int aAngle ) { m_padStack.FrontPostMachining().angle = aAngle; }
747 int GetFrontPostMachiningAngle() const { return m_padStack.FrontPostMachining().angle; }
748
749 void SetBackPostMachining( const std::optional<PAD_DRILL_POST_MACHINING_MODE>& aMode );
750 std::optional<PAD_DRILL_POST_MACHINING_MODE> GetBackPostMachining() const
751 {
752 return m_padStack.BackPostMachining().mode;
753 }
754
756 {
757 m_padStack.BackPostMachining().mode = aMode;
758 }
759
764
765 void SetBackPostMachiningSize( int aSize ) { m_padStack.BackPostMachining().size = aSize; }
766 int GetBackPostMachiningSize() const { return m_padStack.BackPostMachining().size; }
767 void SetBackPostMachiningDepth( int aDepth ) { m_padStack.BackPostMachining().depth = aDepth; }
768 int GetBackPostMachiningDepth() const { return m_padStack.BackPostMachining().depth; }
769 void SetBackPostMachiningAngle( int aAngle ) { m_padStack.BackPostMachining().angle = aAngle; }
770 int GetBackPostMachiningAngle() const { return m_padStack.BackPostMachining().angle; }
771
781 bool IsBackdrilledOrPostMachined( PCB_LAYER_ID aLayer ) const;
782
789 int GetPostMachiningKnockout( PCB_LAYER_ID aLayer ) const;
790
791 void SetPrimaryDrillFilled( const std::optional<bool>& aFilled );
792 void SetPrimaryDrillFilledFlag( bool aFilled );
793 std::optional<bool> GetPrimaryDrillFilled() const { return m_padStack.Drill().is_filled; }
794 bool GetPrimaryDrillFilledFlag() const { return m_padStack.Drill().is_filled.value_or( false ); }
795
796 void SetPrimaryDrillCapped( const std::optional<bool>& aCapped );
797 void SetPrimaryDrillCappedFlag( bool aCapped );
798 std::optional<bool> GetPrimaryDrillCapped() const { return m_padStack.Drill().is_capped; }
799 bool GetPrimaryDrillCappedFlag() const { return m_padStack.Drill().is_capped.value_or( false ); }
800
801 void SetDrill( int aDrill ) { SetPrimaryDrillSize( { aDrill, aDrill } ); }
802
808 int GetDrill() const { return GetPrimaryDrillSize().x; }
809
815 int GetDrillValue() const;
816
824
825 void SetSecondaryDrillSize( const VECTOR2I& aSize );
827 void SetSecondaryDrillSize( const std::optional<int>& aDrill );
828 std::optional<int> GetSecondaryDrillSize() const;
829
831 PCB_LAYER_ID GetSecondaryDrillStartLayer() const { return m_padStack.SecondaryDrill().start; }
832
834 PCB_LAYER_ID GetSecondaryDrillEndLayer() const { return m_padStack.SecondaryDrill().end; }
835
837 PAD_DRILL_SHAPE GetSecondaryDrillShape() const { return m_padStack.SecondaryDrill().shape; }
838
839 void SetTertiaryDrillSize( const VECTOR2I& aSize );
841 void SetTertiaryDrillSize( const std::optional<int>& aDrill );
842 std::optional<int> GetTertiaryDrillSize() const;
843
845 PCB_LAYER_ID GetTertiaryDrillStartLayer() const { return m_padStack.TertiaryDrill().start; }
846
848 PCB_LAYER_ID GetTertiaryDrillEndLayer() const { return m_padStack.TertiaryDrill().end; }
849
851 PAD_DRILL_SHAPE GetTertiaryDrillShape() const { return m_padStack.TertiaryDrill().shape; }
852
860 bool GetIsFree() const { return m_isFree; }
861 void SetIsFree( bool aFree = true ) { m_isFree = aFree; }
862
863 // For property manager:
864 bool GetIsNotFree() const { return !m_isFree; }
865 void SetIsNotFree( bool aNotFree ) { m_isFree = !aNotFree; }
866
868 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
870 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
871
873
878
879 void SetZoneLayerOverride( PCB_LAYER_ID aLayer, ZONE_LAYER_OVERRIDE aOverride );
880
881 double Similarity( const BOARD_ITEM& aOther ) const override;
882
883 bool operator==( const PCB_VIA& aOther ) const;
884 bool operator==( const BOARD_ITEM& aOther ) const override;
885
886 void Serialize( google::protobuf::Any &aContainer ) const override;
887 bool Deserialize( const google::protobuf::Any &aContainer ) override;
888
889 void Serialize( kiapi::board::types::Via& aVia ) const;
890 bool Deserialize( const kiapi::board::types::Via& aVia );
891
892 wxString LayerMaskDescribe() const override;
893
894protected:
895 void swapData( BOARD_ITEM* aImage ) override;
896
897private:
898 // Silence GCC warning about hiding the PCB_TRACK base method
899 bool operator==( const PCB_TRACK& aOther ) const override;
900
901 bool sameZoneLayerOverrides( const PCB_VIA& aOther ) const;
902
903private:
905
907
908 bool m_isFree;
909
910 // These are used in zone filling, so use a fixed size to avoid undefined behavior
911 std::array<std::atomic<ZONE_LAYER_OVERRIDE>, MAX_CU_LAYERS> m_zoneLayerOverrides;
912};
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:73
BOX2< VECTOR2I > BOX2I
Definition box2.h:914
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:85
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:87
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:156
MODE
! Copper geometry mode: controls how many unique copper layer shapes this padstack has
Definition padstack.h:169
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:334
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:307
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:305
void SetPosition(const VECTOR2I &aPos) override
Definition pcb_track.h:302
wxString GetClass() const override
Return the class name.
Definition pcb_track.h:319
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:299
double GetRadius() const
EDA_ANGLE GetAngle() const
const VECTOR2I & GetMid() const
Definition pcb_track.h:300
PCB_ARC(BOARD_ITEM *aParent)
Definition pcb_track.h:266
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:364
static bool ClassOf(const EDA_ITEM *aItem)
Definition pcb_track.h:281
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:286
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:107
const VECTOR2I GetFocusPosition() const override
Similar to GetPosition() but allows items to return their visual center rather than their anchor.
Definition pcb_track.h:89
bool IsOnCopperLayer() const override
Definition pcb_track.h:224
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:202
void SetHasSolderMask(bool aVal)
Definition pcb_track.h:121
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:94
bool HasSolderMask() const
Definition pcb_track.h:122
void SetStart(const VECTOR2I &aStart)
Definition pcb_track.h:97
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
int GetStartY() const
Definition pcb_track.h:104
int GetEndX() const
Definition pcb_track.h:109
wxString GetItemDescription(UNITS_PROVIDER *aUnitsProvider, bool aFull) const override
Return a user-visible description string of this item.
virtual 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:253
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition pcb_track.h:124
std::optional< int > m_solderMaskMargin
Definition pcb_track.h:256
void CopyFrom(const BOARD_ITEM *aOther) override
Definition pcb_track.cpp:79
void SetPosition(const VECTOR2I &aPos) override
Definition pcb_track.h:87
std::optional< int > GetLocalSolderMaskMargin() const
Definition pcb_track.h:125
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:98
bool operator==(const BOARD_ITEM &aOther) const override
VECTOR2I m_Start
Line start point.
Definition pcb_track.h:252
int GetEndY() const
Definition pcb_track.h:110
wxString GetFriendlyName() const override
VECTOR2I GetPosition() const override
Definition pcb_track.h:88
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:113
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:185
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:255
void SetStartX(int aX)
Definition pcb_track.h:100
const VECTOR2I & GetEnd() const
Definition pcb_track.h:95
PCB_TRACK(BOARD_ITEM *aParent, KICAD_T idtype=PCB_TRACE_T)
Definition pcb_track.cpp:65
void SetStartY(int aY)
Definition pcb_track.h:101
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:106
int GetStartX() const
Definition pcb_track.h:103
int m_width
Thickness of track (or arc) – no longer the width of a via.
Definition pcb_track.h:259
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:91
virtual int GetWidth() const
Definition pcb_track.h:92
void GetMsgPanelInfoBase_Common(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) const
void SetRemoveUnconnected(bool aSet)
Definition pcb_track.h:641
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:860
int GetFrontPostMachiningSize() const
Definition pcb_track.h:743
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:603
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:416
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:451
bool IsGhostLayer(PCB_LAYER_ID aLayer) const
bool GetPrimaryDrillFilledFlag() const
Definition pcb_track.h:794
PCB_LAYER_ID GetPrincipalLayer() const
void SetFrontPostMachiningDepth(int aDepth)
Definition pcb_track.h:744
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.
int GetBackPostMachiningDepth() const
Definition pcb_track.h:768
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void SetBackPostMachiningAngle(int aAngle)
Definition pcb_track.h:769
int GetBackPostMachiningAngle() const
Definition pcb_track.h:770
PCB_LAYER_ID GetTertiaryDrillEndLayer() const
Definition pcb_track.h:848
COVERING_MODE GetBackCoveringMode() const
std::optional< int > GetTertiaryDrillSize() const
bool GetRemoveUnconnected() const
Definition pcb_track.h:647
void SetTopBackdrillSize(std::optional< int > aSize)
Definition pcb_track.h:449
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:656
void SetBackPostMachiningMode(PAD_DRILL_POST_MACHINING_MODE aMode)
Definition pcb_track.h:755
std::optional< int > GetTopBackdrillSize() const
Definition pcb_track.h:448
void SetBackdrillMode(BACKDRILL_MODE aMode)
Definition pcb_track.h:440
void SetDrillDefault()
Set the drill value for vias to the default value UNDEFINED_DRILL_DIAMETER.
Definition pcb_track.h:820
void SetBottomBackdrillSize(std::optional< int > aSize)
Definition pcb_track.h:443
void ClearZoneLayerOverrides()
CAPPING_MODE GetCappingMode() const
const PADSTACK & Padstack() const
Definition pcb_track.h:431
void SetFrontTentingMode(TENTING_MODE aMode)
int GetDrill() const
Return the local drill setting for this PCB_VIA.
Definition pcb_track.h:808
PAD_DRILL_SHAPE GetTertiaryDrillShape() const
Definition pcb_track.h:851
bool m_isFree
"Free" vias don't get their nets auto-updated
Definition pcb_track.h:908
bool HitTest(const VECTOR2I &aPosition, int aAccuracy=0) const override
Test if aPosition is inside or on the boundary of this item.
int GetFrontPostMachiningDepth() const
Definition pcb_track.h:745
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:718
TENTING_MODE GetFrontTentingMode() const
std::optional< bool > GetPrimaryDrillCapped() const
Definition pcb_track.h:798
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
void SetPrimaryDrillCappedFlag(bool aCapped)
PADSTACK & Padstack()
Definition pcb_track.h:432
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:727
void ClearSecondaryDrillSize()
void SetBackPostMachiningDepth(int aDepth)
Definition pcb_track.h:767
void SetDrill(int aDrill)
Definition pcb_track.h:801
PLUGGING_MODE GetBackPluggingMode() const
void SetBackPluggingMode(PLUGGING_MODE aMode)
PCB_LAYER_ID GetSecondaryDrillEndLayer() const
Definition pcb_track.h:834
MINOPTMAX< int > GetDrillConstraint(wxString *aSource=nullptr) const
void SetPadstackMode(PADSTACK::MODE aMode)
Definition pcb_track.h:495
void SetBackTentingMode(TENTING_MODE aMode)
PAD_DRILL_SHAPE GetSecondaryDrillShape() const
Definition pcb_track.h:837
void SetIsFree(bool aFree=true)
Definition pcb_track.h:861
std::optional< bool > GetPrimaryDrillFilled() const
Definition pcb_track.h:793
void SetFrontPluggingMode(PLUGGING_MODE aMode)
PCB_LAYER_ID GetPrimaryDrillStartLayer() const
Definition pcb_track.h:721
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:747
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:724
void SetFrontPostMachiningAngle(int aAngle)
Definition pcb_track.h:746
void SetTopLayer(PCB_LAYER_ID aLayer)
FILLING_MODE GetFillingMode() const
void SetPosition(const VECTOR2I &aPoint) override
Definition pcb_track.h:604
bool IsBuriedVia() const
int GetFrontWidth() const
Definition pcb_track.h:505
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:911
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:512
PAD_DRILL_POST_MACHINING_MODE GetFrontPostMachiningMode() const
Definition pcb_track.h:737
bool IsOnCopperLayer() const override
void SetFrontPostMachiningSize(int aSize)
Definition pcb_track.h:742
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:389
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:445
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:662
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:373
void SetSecondaryDrillShape(PAD_DRILL_SHAPE aShape)
bool HasHole() const override
Definition pcb_track.h:507
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:845
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:613
const VECTOR2I & GetPrimaryDrillSize() const
Definition pcb_track.h:715
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:864
PCB_VIA(BOARD_ITEM *aParent)
void SetPrimaryDrillFilledFlag(bool aFilled)
std::optional< int > GetBottomBackdrillSize() const
Definition pcb_track.h:442
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition pcb_track.h:667
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:423
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:904
void SetBottomBackdrillLayer(PCB_LAYER_ID aLayer)
Definition pcb_track.h:446
int GetBackPostMachiningSize() const
Definition pcb_track.h:766
void SetTertiaryDrillSize(const VECTOR2I &aSize)
void SetIsNotFree(bool aNotFree)
Definition pcb_track.h:865
PADSTACK m_padStack
Definition pcb_track.h:906
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:760
void SetFrontWidth(int aWidth)
Definition pcb_track.h:504
VIATYPE GetViaType() const
Definition pcb_track.h:422
PCB_LAYER_ID GetSecondaryDrillStartLayer() const
Definition pcb_track.h:831
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)
MINOPTMAX< int > GetWidthConstraint(wxString *aSource=nullptr) const override
BACKDRILL_MODE GetBackdrillMode() const
Definition pcb_track.h:439
void SetWidth(int aWidth) override
std::optional< PAD_DRILL_POST_MACHINING_MODE > GetBackPostMachining() const
Definition pcb_track.h:750
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:452
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:433
void SetFrontPostMachiningMode(PAD_DRILL_POST_MACHINING_MODE aMode)
Definition pcb_track.h:732
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool GetPrimaryDrillCappedFlag() const
Definition pcb_track.h:799
void SetBackPostMachiningSize(int aSize)
Definition pcb_track.h:765
void SetPrimaryDrillEndLayer(PCB_LAYER_ID aLayer)
void SetPrimaryDrillStartLayer(PCB_LAYER_ID aLayer)
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:23
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition eda_angle.h:437
PAD_DRILL_POST_MACHINING_MODE
Definition padstack.h:75
PAD_DRILL_SHAPE
The set of pad drill shapes, used with PAD::{Set,Get}DrillShape()
Definition padstack.h:68
BACKDRILL_MODE
Definition padstack.h:83
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