Ratsnest NODE stores its parents in a set instead of a list
It happens that the same parent is assigned multiple times, but then removed once, causing ratsnest artifacts.
This commit is contained in:
parent
5f2099f0d2
commit
630d5e04fe
|
@ -46,6 +46,7 @@
|
||||||
#define TTL_USE_NODE_FLAG // Each node gets a flag (can be set to true or false)
|
#define TTL_USE_NODE_FLAG // Each node gets a flag (can be set to true or false)
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -106,7 +107,7 @@ protected:
|
||||||
int m_tag;
|
int m_tag;
|
||||||
|
|
||||||
/// List of board items that share this node
|
/// List of board items that share this node
|
||||||
std::list<const BOARD_CONNECTED_ITEM*> m_parents;
|
std::unordered_set<const BOARD_CONNECTED_ITEM*> m_parents;
|
||||||
|
|
||||||
/// Layers that are occupied by this node
|
/// Layers that are occupied by this node
|
||||||
LSET m_layers;
|
LSET m_layers;
|
||||||
|
@ -184,14 +185,19 @@ public:
|
||||||
|
|
||||||
inline void AddParent( const BOARD_CONNECTED_ITEM* aParent )
|
inline void AddParent( const BOARD_CONNECTED_ITEM* aParent )
|
||||||
{
|
{
|
||||||
m_parents.push_back( aParent );
|
m_parents.insert( aParent );
|
||||||
m_layers.reset(); // mark as needs updating
|
m_layers.reset(); // mark as needs updating
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void RemoveParent( const BOARD_CONNECTED_ITEM* aParent )
|
inline void RemoveParent( const BOARD_CONNECTED_ITEM* aParent )
|
||||||
{
|
{
|
||||||
m_parents.remove( aParent );
|
auto it = m_parents.find( aParent );
|
||||||
m_layers.reset(); // mark as needs updating
|
|
||||||
|
if( it != m_parents.end() )
|
||||||
|
{
|
||||||
|
m_parents.erase( it );
|
||||||
|
m_layers.reset(); // mark as needs updating
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const LSET& GetLayers()
|
const LSET& GetLayers()
|
||||||
|
|
Loading…
Reference in New Issue