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,
167 bool ignoreLineWidth = false ) const override;
168
169 // @copydoc BOARD_ITEM::GetEffectiveShape
170 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
172 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
173
181 EDA_ITEM_FLAGS IsPointOnEnds( const VECTOR2I& point, int min_dist = 0 ) const;
182
186 bool IsNull() const
187 {
188 return ( Type() == PCB_VIA_T ) || ( m_Start == m_End );
189 }
190
191 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
192 wxString GetFriendlyName() const override;
193
194 INSPECT_RESULT Visit( INSPECTOR inspector, void* testData,
195 const std::vector<KICAD_T>& aScanTypes ) override;
196
197 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
198 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
199 bool HitTest( const SHAPE_LINE_CHAIN& aPoly, bool aContained ) const override;
200
201 bool ApproxCollinear( const PCB_TRACK& aTrack );
202
203 wxString GetClass() const override
204 {
205 return wxT( "PCB_TRACK" );
206 }
207
208 virtual MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const;
209
210 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
211
212 BITMAPS GetMenuImage() const override;
213
214 virtual EDA_ITEM* Clone() const override;
215
216 virtual std::vector<int> ViewGetLayers() const override;
217
218 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
219
220 const BOX2I ViewBBox() const override;
221
225 bool IsOnCopperLayer() const override
226 {
227 return true;
228 }
229
230 virtual double Similarity( const BOARD_ITEM& aOther ) const override;
231
232 virtual bool operator==( const BOARD_ITEM& aOther ) const override;
233 virtual bool operator==( const PCB_TRACK& aOther ) const;
234
236 {
237 bool operator()( const PCB_TRACK* aFirst, const PCB_TRACK* aSecond ) const;
238 };
239
240 void Serialize( google::protobuf::Any &aContainer ) const override;
241 bool Deserialize( const google::protobuf::Any &aContainer ) override;
242
243#if defined (DEBUG)
244 virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
245#endif
246
247protected:
248 virtual void swapData( BOARD_ITEM* aImage ) override;
249
251 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
274 void CopyFrom( const BOARD_ITEM* aOther ) override;
275
276 static inline bool ClassOf( const EDA_ITEM *aItem )
277 {
278 return aItem && PCB_ARC_T == aItem->Type();
279 }
280
281 virtual void Move( const VECTOR2I& aMoveVector ) override
282 {
283 m_Start += aMoveVector;
284 m_Mid += aMoveVector;
285 m_End += aMoveVector;
286 }
287
288 void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override;
289
290 void Mirror( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
291
292 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
293
294 void SetMid( const VECTOR2I& aMid ) { m_Mid = aMid; }
295 const VECTOR2I& GetMid() const { return m_Mid; }
296
297 void SetPosition( const VECTOR2I& aPos ) override { m_Start = aPos; }
298
299 virtual VECTOR2I GetPosition() const override;
300 const VECTOR2I GetFocusPosition() const override { return m_Mid; }
301
302 virtual VECTOR2I GetCenter() const override { return GetPosition(); }
303
304 double GetRadius() const;
305 EDA_ANGLE GetAngle() const;
307 EDA_ANGLE GetArcAngleEnd() const; // Called by Python; ignore CLion's claim that it's unused
308 virtual bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
309
310 virtual bool HitTest( const BOX2I& aRect, bool aContained = true,
311 int aAccuracy = 0 ) const override;
312
313 bool IsCCW() const;
314
315 wxString GetClass() const override
316 {
317 return wxT( "PCB_ARC" );
318 }
319
320 // @copydoc BOARD_ITEM::GetEffectiveShape
321 std::shared_ptr<SHAPE> GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
323 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
324
330 virtual double GetLength() const override
331 {
332 return GetRadius() * std::abs( GetAngle().AsRadians() );
333 }
334
335 EDA_ITEM* Clone() const override;
336
343 bool IsDegenerated( int aThreshold = 5 ) const;
344
345 double Similarity( const BOARD_ITEM& aOther ) const override;
346
347 bool operator==( const PCB_ARC& aOther ) const;
348 bool operator==( const BOARD_ITEM& aBoardItem ) const override;
349
350 void Serialize( google::protobuf::Any &aContainer ) const override;
351 bool Deserialize( const google::protobuf::Any &aContainer ) override;
352
353protected:
354 virtual void swapData( BOARD_ITEM* aImage ) override;
355
356private:
357 // Silence GCC warning about overriding the base class method
358 bool operator==( const PCB_TRACK& aOther ) const override;
359
361};
362
363
364class PCB_VIA : public PCB_TRACK
365{
366public:
367 PCB_VIA( BOARD_ITEM* aParent );
368
369 static inline bool ClassOf( const EDA_ITEM *aItem )
370 {
371 return aItem && PCB_VIA_T == aItem->Type();
372 }
373
374 PCB_VIA( const PCB_VIA& aOther );
375 PCB_VIA& operator=( const PCB_VIA &aOther );
376
381 static std::vector<std::vector<PCB_VIA*>> CollectMicroviaColumns( BOARD* aBoard );
382
383 void CopyFrom( const BOARD_ITEM* aOther ) override;
384
385 bool IsType( const std::vector<KICAD_T>& aScanTypes ) const override
386 {
387 if( BOARD_CONNECTED_ITEM::IsType( aScanTypes ) )
388 return true;
389
390 for( KICAD_T scanType : aScanTypes )
391 {
392 if( scanType == PCB_LOCATE_STDVIA_T && m_viaType == VIATYPE::THROUGH )
393 return true;
394 else if( scanType == PCB_LOCATE_UVIA_T && m_viaType == VIATYPE::MICROVIA )
395 return true;
396 else if( scanType == PCB_LOCATE_BLINDVIA_T && m_viaType == VIATYPE::BLIND )
397 return true;
398 else if( scanType == PCB_LOCATE_BURIEDVIA_T && m_viaType == VIATYPE::BURIED )
399 return true;
400 }
401
402 return false;
403 }
404
408 bool HasValidLayerPair( int aCopperLayerCount ) const;
409
412 bool FitsEnabledLayers( const LSET& aEnabledLayers, int aCopperLayerCount ) const override
413 {
414 return BOARD_ITEM::FitsEnabledLayers( aEnabledLayers, aCopperLayerCount )
415 && HasValidLayerPair( aCopperLayerCount );
416 }
417
418 VIATYPE GetViaType() const { return m_viaType; }
419 void SetViaType( VIATYPE aViaType )
420 {
421 m_viaType = aViaType;
422
423 // If someone updates a VIA to TH, we want to kick out any non-outer layers
425 }
426
427 const PADSTACK& Padstack() const { return m_padStack; }
429 void SetPadstack( const PADSTACK& aPadstack ) { m_padStack = aPadstack; }
430
431 // A micro, blind, or buried via with a Front/Inner/Back padstack definition is an odd beast as it might
432 // not exist on F_Cu or B_Cu.
433 bool IsGhostLayer( PCB_LAYER_ID aLayer ) const;
434
435 BACKDRILL_MODE GetBackdrillMode() const { return m_padStack.GetBackdrillMode(); }
436 void SetBackdrillMode( BACKDRILL_MODE aMode ) { m_padStack.SetBackdrillMode( aMode ); }
437
438 std::optional<int> GetBottomBackdrillSize() const { return m_padStack.GetBackdrillSize( false ); }
439 void SetBottomBackdrillSize( std::optional<int> aSize ) { m_padStack.SetBackdrillSize( false, aSize ); }
440
441 PCB_LAYER_ID GetBottomBackdrillLayer() const { return m_padStack.GetBackdrillEndLayer( false ); }
442 void SetBottomBackdrillLayer( PCB_LAYER_ID aLayer ) { m_padStack.SetBackdrillEndLayer( false, aLayer ); }
443
444 std::optional<int> GetTopBackdrillSize() const { return m_padStack.GetBackdrillSize( true ); }
445 void SetTopBackdrillSize( std::optional<int> aSize ) { m_padStack.SetBackdrillSize( true, aSize ); }
446
447 PCB_LAYER_ID GetTopBackdrillLayer() const { return m_padStack.GetBackdrillEndLayer( true ); }
448 void SetTopBackdrillLayer( PCB_LAYER_ID aLayer ) { m_padStack.SetBackdrillEndLayer( true, aLayer ); }
449
450 bool IsMicroVia() const;
451 bool IsBlindVia() const;
452 bool IsBuriedVia() const;
453
474
475 static std::optional<VIA_PARAMETER_ERROR>
476 ValidateViaParameters( std::optional<int> aDiameter,
477 std::optional<int> aPrimaryDrill,
478 std::optional<PCB_LAYER_ID> aPrimaryStartLayer = std::nullopt,
479 std::optional<PCB_LAYER_ID> aPrimaryEndLayer = std::nullopt,
480 std::optional<int> aSecondaryDrill = std::nullopt,
481 std::optional<PCB_LAYER_ID> aSecondaryStartLayer = std::nullopt,
482 std::optional<PCB_LAYER_ID> aSecondaryEndLayer = std::nullopt,
483 std::optional<int> aTertiaryDrill = std::nullopt,
484 std::optional<PCB_LAYER_ID> aTertiaryStartLayer = std::nullopt,
485 std::optional<PCB_LAYER_ID> aTertiaryEndLayer = std::nullopt,
486 int aCopperLayerCount = 0 );
487
488 const BOX2I GetBoundingBox() const override;
489 const BOX2I GetBoundingBox( PCB_LAYER_ID aLayer ) const;
490
491 void SetPadstackMode( PADSTACK::MODE aMode ) { m_padStack.SetMode( aMode ); }
492
493 void SetWidth( int aWidth ) override;
494 int GetWidth() const override;
495
496 void SetWidth( PCB_LAYER_ID aLayer, int aWidth );
497 int GetWidth( PCB_LAYER_ID aLayer ) const;
498
499 // For properties panel
500 void SetFrontWidth( int aWidth ) { SetWidth( F_Cu, aWidth ); }
501 int GetFrontWidth() const { return GetWidth( F_Cu ); }
502
503 bool HasHole() const override
504 {
505 return true;
506 }
507
508 bool HasDrilledHole() const override
509 {
511 }
512
513 std::shared_ptr<SHAPE_SEGMENT> GetEffectiveHoleShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER,
514 DRC_CONSTRAINT_T aUsage = NULL_CONSTRAINT ) const override;
515
516 MINOPTMAX<int> GetWidthConstraint( wxString* aSource = nullptr ) const override;
517 MINOPTMAX<int> GetDrillConstraint( wxString* aSource = nullptr ) const;
518
527 void SetSizeFromRules( int aDiameter, int aDrill );
528
529 void SetFrontTentingMode( TENTING_MODE aMode );
531 void SetBackTentingMode( TENTING_MODE aMode );
533
538
543
544 void SetCappingMode( CAPPING_MODE aMode );
546
547 void SetFillingMode( FILLING_MODE aMode );
549
550 bool IsTented( PCB_LAYER_ID aLayer ) const override;
551 int GetSolderMaskExpansion() const;
552
554
555 PCB_LAYER_ID GetLayer() const override;
556 void SetLayer( PCB_LAYER_ID aLayer ) override;
557
558 bool IsOnLayer( PCB_LAYER_ID aLayer ) const override;
559
560 bool IsOnCopperLayer() const override;
561
562 virtual LSET GetLayerSet() const override;
563
568 virtual void SetLayerSet( const LSET& aLayers ) override;
569
576 void SetLayerPair( PCB_LAYER_ID aTopLayer, PCB_LAYER_ID aBottomLayer );
577
578 void SetBottomLayer( PCB_LAYER_ID aLayer );
579 void SetTopLayer( PCB_LAYER_ID aLayer );
580
588 void LayerPair( PCB_LAYER_ID* top_layer, PCB_LAYER_ID* bottom_layer ) const;
589
590 PCB_LAYER_ID TopLayer() const;
592
597 void SanitizeLayers();
598
599 VECTOR2I GetPosition() const override { return m_Start; }
600 void SetPosition( const VECTOR2I& aPoint ) override { m_Start = aPoint; m_End = aPoint; }
601
602 void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
603
604 double GetCoverageArea( int aTextMargin ) const override;
605
606 bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override;
607 bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override;
608
609 wxString GetClass() const override
610 {
611 return wxT( "PCB_VIA" );
612 }
613
614 wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
615
616 BITMAPS GetMenuImage() const override;
617
618 EDA_ITEM* Clone() const override;
619
620 std::vector<int> ViewGetLayers() const override;
621
622 double ViewGetLOD( int aLayer, const KIGFX::VIEW* aView ) const override;
623
624 void Flip( const VECTOR2I& aCentre, FLIP_DIRECTION aFlipDirection ) override;
625
626#if defined (DEBUG)
627 void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
628#endif
629
630 int GetMinAnnulus( PCB_LAYER_ID aLayer, wxString* aSource ) const;
631
637 void SetRemoveUnconnected( bool aSet )
638 {
639 m_padStack.SetUnconnectedLayerMode( aSet ? UNCONNECTED_LAYER_MODE::REMOVE_ALL
641 }
642
644 {
645 return m_padStack.UnconnectedLayerMode() != UNCONNECTED_LAYER_MODE::KEEP_ALL;
646 }
647
652 void SetKeepStartEnd( bool aSet )
653 {
656 }
657
658 bool GetKeepStartEnd() const
659 {
661 }
662
664 {
665 switch( m_padStack.UnconnectedLayerMode() )
666 {
668 return false;
669
671 return true;
672
675 return aLayer != m_padStack.Drill().start && aLayer != m_padStack.Drill().end;
676 }
677
678 return true;
679 }
680
687 bool FlashLayer( int aLayer ) const;
688
696 bool FlashLayer( const LSET& aLayers ) const;
697
704 PCB_LAYER_ID* aBottommost ) const;
705
711 void SetPrimaryDrillSize( const VECTOR2I& aSize );
712 const VECTOR2I& GetPrimaryDrillSize() const { return m_padStack.Drill().size; }
713
715 PAD_DRILL_SHAPE GetPrimaryDrillShape() const { return m_padStack.Drill().shape; }
716
718 PCB_LAYER_ID GetPrimaryDrillStartLayer() const { return m_padStack.Drill().start; }
719
721 PCB_LAYER_ID GetPrimaryDrillEndLayer() const { return m_padStack.Drill().end; }
722
723 void SetFrontPostMachining( const std::optional<PAD_DRILL_POST_MACHINING_MODE>& aMode );
724 std::optional<PAD_DRILL_POST_MACHINING_MODE> GetFrontPostMachining() const
725 {
726 return m_padStack.FrontPostMachining().mode;
727 }
728
730 {
731 m_padStack.FrontPostMachining().mode = aMode;
732 }
733
738
739 void SetFrontPostMachiningSize( int aSize ) { m_padStack.FrontPostMachining().size = aSize; }
740 int GetFrontPostMachiningSize() const { return m_padStack.FrontPostMachining().size; }
741 void SetFrontPostMachiningDepth( int aDepth ) { m_padStack.FrontPostMachining().depth = aDepth; }
742 int GetFrontPostMachiningDepth() const { return m_padStack.FrontPostMachining().depth; }
743 void SetFrontPostMachiningAngle( int aAngle ) { m_padStack.FrontPostMachining().angle = aAngle; }
744 int GetFrontPostMachiningAngle() const { return m_padStack.FrontPostMachining().angle; }
745
746 void SetBackPostMachining( const std::optional<PAD_DRILL_POST_MACHINING_MODE>& aMode );
747 std::optional<PAD_DRILL_POST_MACHINING_MODE> GetBackPostMachining() const
748 {
749 return m_padStack.BackPostMachining().mode;
750 }
751
753 {
754 m_padStack.BackPostMachining().mode = aMode;
755 }
756
761
762 void SetBackPostMachiningSize( int aSize ) { m_padStack.BackPostMachining().size = aSize; }
763 int GetBackPostMachiningSize() const { return m_padStack.BackPostMachining().size; }
764 void SetBackPostMachiningDepth( int aDepth ) { m_padStack.BackPostMachining().depth = aDepth; }
765 int GetBackPostMachiningDepth() const { return m_padStack.BackPostMachining().depth; }
766 void SetBackPostMachiningAngle( int aAngle ) { m_padStack.BackPostMachining().angle = aAngle; }
767 int GetBackPostMachiningAngle() const { return m_padStack.BackPostMachining().angle; }
768
778 bool IsBackdrilledOrPostMachined( PCB_LAYER_ID aLayer ) const;
779
786 int GetPostMachiningKnockout( PCB_LAYER_ID aLayer ) const;
787
788 void SetPrimaryDrillFilled( const std::optional<bool>& aFilled );
789 void SetPrimaryDrillFilledFlag( bool aFilled );
790 std::optional<bool> GetPrimaryDrillFilled() const { return m_padStack.Drill().is_filled; }
791 bool GetPrimaryDrillFilledFlag() const { return m_padStack.Drill().is_filled.value_or( false ); }
792
793 void SetPrimaryDrillCapped( const std::optional<bool>& aCapped );
794 void SetPrimaryDrillCappedFlag( bool aCapped );
795 std::optional<bool> GetPrimaryDrillCapped() const { return m_padStack.Drill().is_capped; }
796 bool GetPrimaryDrillCappedFlag() const { return m_padStack.Drill().is_capped.value_or( false ); }
797
798 void SetDrill( int aDrill )
799 {
800 SetPrimaryDrillSize( { aDrill, aDrill } );
801 }
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:72
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:84
BOARD_ITEM(BOARD_ITEM *aParent, KICAD_T idtype, PCB_LAYER_ID aLayer=F_Cu)
Definition board_item.h:86
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:410
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:63
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
virtual VECTOR2I GetPosition() const override
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:330
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.
Definition pcb_track.cpp:93
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.
virtual 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:300
void SetPosition(const VECTOR2I &aPos) override
Definition pcb_track.h:297
virtual void Move(const VECTOR2I &aMoveVector) override
Move this object.
Definition pcb_track.h:281
wxString GetClass() const override
Return the class name.
Definition pcb_track.h:315
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:294
double GetRadius() const
EDA_ANGLE GetAngle() const
const VECTOR2I & GetMid() const
Definition pcb_track.h:295
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:360
static bool ClassOf(const EDA_ITEM *aItem)
Definition pcb_track.h:276
void Rotate(const VECTOR2I &aRotCentre, const EDA_ANGLE &aAngle) override
Rotate this object.
bool operator==(const PCB_ARC &aOther) const
virtual VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
Definition pcb_track.h:302
void CopyFrom(const BOARD_ITEM *aOther) override
Definition pcb_track.cpp:99
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:225
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:203
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.
virtual 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:255
void SetLocalSolderMaskMargin(std::optional< int > aMargin)
Definition pcb_track.h:124
std::optional< int > m_solderMaskMargin
Definition pcb_track.h:258
void CopyFrom(const BOARD_ITEM *aOther) override
Definition pcb_track.cpp:77
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.
virtual EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
Definition pcb_track.cpp:71
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
virtual 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:110
wxString GetFriendlyName() const override
VECTOR2I GetPosition() const override
Definition pcb_track.h:88
virtual 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:186
virtual 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: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:63
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: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: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:637
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:740
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:599
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:412
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:447
bool IsGhostLayer(PCB_LAYER_ID aLayer) const
bool GetPrimaryDrillFilledFlag() const
Definition pcb_track.h:791
PCB_LAYER_ID GetPrincipalLayer() const
void SetFrontPostMachiningDepth(int aDepth)
Definition pcb_track.h:741
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:765
bool Deserialize(const google::protobuf::Any &aContainer) override
Deserializes the given protobuf message into this object.
void SetBackPostMachiningAngle(int aAngle)
Definition pcb_track.h:766
int GetBackPostMachiningAngle() const
Definition pcb_track.h:767
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:643
void SetTopBackdrillSize(std::optional< int > aSize)
Definition pcb_track.h:445
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:652
void SetBackPostMachiningMode(PAD_DRILL_POST_MACHINING_MODE aMode)
Definition pcb_track.h:752
std::optional< int > GetTopBackdrillSize() const
Definition pcb_track.h:444
void SetBackdrillMode(BACKDRILL_MODE aMode)
Definition pcb_track.h:436
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:439
void ClearZoneLayerOverrides()
CAPPING_MODE GetCappingMode() const
const PADSTACK & Padstack() const
Definition pcb_track.h:427
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:742
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:715
TENTING_MODE GetFrontTentingMode() const
std::optional< bool > GetPrimaryDrillCapped() const
Definition pcb_track.h:795
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:428
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:724
void ClearSecondaryDrillSize()
void SetBackPostMachiningDepth(int aDepth)
Definition pcb_track.h:764
void SetDrill(int aDrill)
Definition pcb_track.h:798
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:491
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:790
void SetFrontPluggingMode(PLUGGING_MODE aMode)
PCB_LAYER_ID GetPrimaryDrillStartLayer() const
Definition pcb_track.h:718
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:744
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:721
void SetFrontPostMachiningAngle(int aAngle)
Definition pcb_track.h:743
void SetTopLayer(PCB_LAYER_ID aLayer)
FILLING_MODE GetFillingMode() const
void SetPosition(const VECTOR2I &aPoint) override
Definition pcb_track.h:600
bool IsBuriedVia() const
int GetFrontWidth() const
Definition pcb_track.h:501
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:508
PAD_DRILL_POST_MACHINING_MODE GetFrontPostMachiningMode() const
Definition pcb_track.h:734
bool IsOnCopperLayer() const override
void SetFrontPostMachiningSize(int aSize)
Definition pcb_track.h:739
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:385
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:441
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:658
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:369
void SetSecondaryDrillShape(PAD_DRILL_SHAPE aShape)
bool HasHole() const override
Definition pcb_track.h:503
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:609
const VECTOR2I & GetPrimaryDrillSize() const
Definition pcb_track.h:712
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:438
bool ConditionallyFlashed(PCB_LAYER_ID aLayer) const
Definition pcb_track.h:663
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:419
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:442
int GetBackPostMachiningSize() const
Definition pcb_track.h:763
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:757
void SetFrontWidth(int aWidth)
Definition pcb_track.h:500
VIATYPE GetViaType() const
Definition pcb_track.h:418
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:435
void SetWidth(int aWidth) override
std::optional< PAD_DRILL_POST_MACHINING_MODE > GetBackPostMachining() const
Definition pcb_track.h:747
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:448
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:429
void SetFrontPostMachiningMode(PAD_DRILL_POST_MACHINING_MODE aMode)
Definition pcb_track.h:729
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
bool GetPrimaryDrillCappedFlag() const
Definition pcb_track.h:796
void SetBackPostMachiningSize(int aSize)
Definition pcb_track.h:762
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.
DRC_CONSTRAINT_T
Definition drc_rule.h:49
@ NULL_CONSTRAINT
Definition drc_rule.h:50
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