Use Net() accessor uniformly; init hole parent in VIA::Clone()

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

(cherry picked from commit 16e000f2b0)
This commit is contained in:
Jeff Young 2023-04-28 18:16:41 +01:00
parent 8ffba3a52f
commit 2acc0a6844
3 changed files with 7 additions and 5 deletions

View File

@ -111,7 +111,7 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
if( Kind() == HOLE_T && aHead->Kind() == HOLE_T )
differentNetsOnly = false;
if( differentNetsOnly && Net() == aHead->m_net && aHead->m_net >= 0 )
if( differentNetsOnly && Net() == aHead->Net() && aHead->Net() >= 0 )
{
// same nets? no clearance!
clearance = -1;
@ -242,7 +242,7 @@ const std::string ITEM::Format() const
{
std::stringstream ss;
ss << KindStr() << " ";
ss << "net " << m_net << " ";
ss << "net " << Net() << " ";
ss << "layers " << m_layers.Start() << " " << m_layers.End();
return ss.str();
}

View File

@ -537,6 +537,9 @@ void NODE::add( ITEM* aItem, bool aAllowRedundant )
case ITEM::SOLID_T:
addSolid( static_cast<SOLID*>( aItem ) );
break;
case ITEM::HOLE_T:
// added by parent VIA_T or SOLID_T (pad)
break;
default:
assert( false );
}

View File

@ -160,8 +160,7 @@ VIA* VIA::Clone() const
v->m_diameter = m_diameter;
v->m_drill = m_drill;
v->m_shape = SHAPE_CIRCLE( m_pos, m_diameter / 2 );
delete v->m_hole;
v->m_hole = m_hole->Clone();
v->SetHole( HOLE::MakeCircularHole( m_pos, m_drill / 2 ) );
v->m_rank = m_rank;
v->m_marker = m_marker;
v->m_viaType = m_viaType;