Don't try to keep track of a HOLE's net.

Keep track of it's parentPadVia instead.

Fixes https://gitlab.com/kicad/code/kicad/issues/14603

(cherry picked from commit 676a15df65)
This commit is contained in:
Jeff Young 2023-04-24 18:32:03 +01:00
parent 999cd8cd11
commit 89d1d36e79
3 changed files with 24 additions and 15 deletions

View File

@ -49,6 +49,14 @@ public:
*/ */
virtual HOLE* Clone() const override; virtual HOLE* Clone() const override;
virtual int Net() const override
{
if( m_parentPadVia )
return m_parentPadVia->Net();
return m_net;
}
virtual const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0, virtual const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0,
int aLayer = -1 ) const override; int aLayer = -1 ) const override;
@ -59,6 +67,7 @@ public:
const SHAPE* Shape() const override { return m_holeShape; } const SHAPE* Shape() const override { return m_holeShape; }
void SetParentPadVia( ITEM* aParent ) { m_parentPadVia = aParent; }
ITEM* ParentPadVia() const { return m_parentPadVia; } ITEM* ParentPadVia() const { return m_parentPadVia; }
BOARD_ITEM* BoardItem() const override BOARD_ITEM* BoardItem() const override

View File

@ -186,7 +186,7 @@ public:
virtual BOARD_ITEM* BoardItem() const { return m_parent; } virtual BOARD_ITEM* BoardItem() const { return m_parent; }
void SetNet( int aNet ) { m_net = aNet; } void SetNet( int aNet ) { m_net = aNet; }
int Net() const { return m_net; } virtual int Net() const { return m_net; }
const LAYER_RANGE& Layers() const { return m_layers; } const LAYER_RANGE& Layers() const { return m_layers; }
void SetLayers( const LAYER_RANGE& aLayers ) { m_layers = aLayers; } void SetLayers( const LAYER_RANGE& aLayers ) { m_layers = aLayers; }

View File

@ -51,19 +51,21 @@ class VIA : public LINKED_ITEM
{ {
public: public:
VIA() : VIA() :
LINKED_ITEM( VIA_T ) LINKED_ITEM( VIA_T ),
m_hole( nullptr )
{ {
m_diameter = 2; // Dummy value m_diameter = 2; // Dummy value
m_drill = 0; m_drill = 0;
m_viaType = VIATYPE::THROUGH; m_viaType = VIATYPE::THROUGH;
m_isFree = false; m_isFree = false;
m_isVirtual = false; m_isVirtual = false;
m_hole = HOLE::MakeCircularHole( m_pos, m_diameter / 2 ); SetHole( HOLE::MakeCircularHole( m_pos, m_diameter / 2 ) );
} }
VIA( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aDiameter, int aDrill, VIA( const VECTOR2I& aPos, const LAYER_RANGE& aLayers, int aDiameter, int aDrill,
int aNet = -1, VIATYPE aViaType = VIATYPE::THROUGH ) : int aNet = -1, VIATYPE aViaType = VIATYPE::THROUGH ) :
LINKED_ITEM( VIA_T ) LINKED_ITEM( VIA_T ),
m_hole( nullptr )
{ {
SetNet( aNet ); SetNet( aNet );
SetLayers( aLayers ); SetLayers( aLayers );
@ -71,24 +73,22 @@ public:
m_diameter = aDiameter; m_diameter = aDiameter;
m_drill = aDrill; m_drill = aDrill;
m_shape = SHAPE_CIRCLE( aPos, aDiameter / 2 ); m_shape = SHAPE_CIRCLE( aPos, aDiameter / 2 );
m_hole = HOLE::MakeCircularHole( m_pos, aDrill / 2 ); SetHole( HOLE::MakeCircularHole( m_pos, aDrill / 2 ) );
m_hole->SetNet( aNet );
m_hole->SetOwner( this );
m_viaType = aViaType; m_viaType = aViaType;
m_isFree = false; m_isFree = false;
m_isVirtual = false; m_isVirtual = false;
} }
VIA( const VIA& aB ) : VIA( const VIA& aB ) :
LINKED_ITEM( aB ) LINKED_ITEM( aB ),
m_hole( nullptr )
{ {
SetNet( aB.Net() ); SetNet( aB.Net() );
SetLayers( aB.Layers() ); SetLayers( aB.Layers() );
m_pos = aB.m_pos; m_pos = aB.m_pos;
m_diameter = aB.m_diameter; m_diameter = aB.m_diameter;
m_shape = SHAPE_CIRCLE( m_pos, m_diameter / 2 ); m_shape = SHAPE_CIRCLE( m_pos, m_diameter / 2 );
m_hole = aB.m_hole->Clone(); SetHole( aB.m_hole->Clone() );
m_hole->SetOwner( this );
m_marker = aB.m_marker; m_marker = aB.m_marker;
m_rank = aB.m_rank; m_rank = aB.m_rank;
m_drill = aB.m_drill; m_drill = aB.m_drill;
@ -177,7 +177,7 @@ public:
} }
m_hole = aHole; m_hole = aHole;
m_hole->SetNet( Net() ); m_hole->SetParentPadVia( this );
m_hole->SetOwner( this ); m_hole->SetOwner( this );
if( m_hole ) if( m_hole )