7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 21:43:43 +00:00

Ratsnest: account for coincident anchors on different layers

When a net happens to have only coincident items on different
layers, the triangulator was not considering the item layers
when optimizing them away.  Add a special case to ensure that
the ratsnest edges will exist in this situation.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18982

(cherry picked from commit 724feccdb8)
This commit is contained in:
Jon Evans 2024-12-08 11:05:39 -05:00
parent 8f8c9e2605
commit 97185ca623

View File

@ -203,10 +203,28 @@ public:
anchorChains[anchors.size() - 1].push_back( n );
}
if( anchors.size() < 2 )
if( anchors.empty() )
{
return;
}
else if( anchors.size() == 1 )
{
// The anchors all have the same position, but may not have overlapping layers.
prev = nullptr;
for( const std::shared_ptr<CN_ANCHOR>& n : m_allNodes )
{
if( prev && !( prev->Parent()->GetLayerSet() & n->Parent()->GetLayerSet() ).any() )
{
// Use a minimal but non-zero distance or the edge will be ignored
mstEdges.emplace_back( prev, n, 1 );
}
prev = n;
}
return;
}
else if( areNodesColinear( anchors ) )
{
// special case: all nodes are on the same line - there's no