Don't allow collisions with self.
The previous test didn't handle is-self-tests between a hole and
its override in a different NODE. When calculating the pushout
force we don't remove the via (and its hole) from the current
node until after the calculation, so we end up checking for
collisions between the new (cloned) via's hole and the original
hole in the root node.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14795
(cherry picked from commit b442d769fd
)
This commit is contained in:
parent
fa56b17c88
commit
882e48b457
|
@ -72,7 +72,7 @@ public:
|
|||
const SHAPE* Shape() const override { return m_holeShape; }
|
||||
|
||||
void SetParentPadVia( ITEM* aParent ) { m_parentPadVia = aParent; }
|
||||
ITEM* ParentPadVia() const { return m_parentPadVia; }
|
||||
ITEM* ParentPadVia() const override { return m_parentPadVia; }
|
||||
|
||||
BOARD_ITEM* BoardItem() const override
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
|
|||
|
||||
//printf( "h %p n %p t %p ctx %p\n", aHead, aNode, this, aCtx );
|
||||
|
||||
if( this == aHead || this == holeH ) // we cannot be self-colliding
|
||||
if( this == aHead ) // we cannot be self-colliding
|
||||
return false;
|
||||
|
||||
// Special cases for "head" lines with vias attached at the end. Note that this does not
|
||||
|
@ -86,7 +86,7 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
|
|||
|
||||
// And a special case for the "head" via's hole.
|
||||
|
||||
if( holeH )
|
||||
if( holeH && !HasSameParentPadVia( holeH ) )
|
||||
collisionsFound |= collideSimple( holeH, aNode, aCtx );
|
||||
|
||||
// Sadly collision routines ignore SHAPE_POLY_LINE widths so we have to pass them in as part
|
||||
|
|
|
@ -250,6 +250,13 @@ public:
|
|||
void SetIsFreePad( bool aIsFreePad = true ) { m_isFreePad = aIsFreePad; }
|
||||
bool IsFreePad() const { return m_isFreePad; }
|
||||
|
||||
virtual ITEM* ParentPadVia() const { return nullptr; }
|
||||
virtual bool HasSameParentPadVia( const ITEM* aOther ) const
|
||||
{
|
||||
return ParentPadVia() && aOther->ParentPadVia()
|
||||
&& ParentPadVia()->Parent() == aOther->ParentPadVia()->Parent();
|
||||
}
|
||||
|
||||
bool IsVirtual() const
|
||||
{
|
||||
return m_isVirtual;
|
||||
|
|
Loading…
Reference in New Issue