Update ratsnest conn to multiset
This commit is contained in:
parent
a2ad84f84d
commit
214a9d53b0
|
@ -111,8 +111,10 @@ void RN_NET::kruskalMST( std::priority_queue<CN_EDGE> &aEdges )
|
|||
|
||||
m_rnEdges.clear();
|
||||
|
||||
for( size_t i = 0; i < m_nodes.size(); i++ )
|
||||
m_nodes[i]->SetTag( i );
|
||||
int i = 0;
|
||||
|
||||
for( auto& node : m_nodes )
|
||||
node->SetTag( i++ );
|
||||
|
||||
while( !aEdges.empty() )
|
||||
{
|
||||
|
@ -316,7 +318,7 @@ void RN_NET::compute()
|
|||
auto last = ++m_nodes.begin();
|
||||
|
||||
// There can be only one possible connection, but it is missing
|
||||
CN_EDGE edge (*m_nodes.begin(), *last );
|
||||
CN_EDGE edge ( *m_nodes.begin(), *last );
|
||||
edge.GetSourceNode()->SetTag( 0 );
|
||||
edge.GetTargetNode()->SetTag( 1 );
|
||||
|
||||
|
@ -397,7 +399,7 @@ void RN_NET::AddCluster( CN_CLUSTER_PTR aCluster )
|
|||
for( unsigned int i = 0; i < nAnchors; i++ )
|
||||
{
|
||||
anchors[i]->SetCluster( aCluster );
|
||||
m_nodes.push_back(anchors[i]);
|
||||
m_nodes.insert( anchors[i] );
|
||||
|
||||
if( firstAnchor )
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <math/box2.h>
|
||||
|
||||
#include <deque>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
|
||||
|
@ -51,6 +52,16 @@ class CN_CONNECTIVITY_ALGO;
|
|||
struct RN_NODE_OR_FILTER;
|
||||
struct RN_NODE_AND_FILTER;
|
||||
|
||||
struct CN_PTR_CMP
|
||||
{
|
||||
bool operator()( const CN_ANCHOR_PTR& aItem, const CN_ANCHOR_PTR& bItem ) const
|
||||
{
|
||||
if( aItem->Pos().x == bItem->Pos().x )
|
||||
return aItem->Pos().y < bItem->Pos().y;
|
||||
else
|
||||
return aItem->Pos().x < bItem->Pos().x;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* RN_NET
|
||||
|
@ -74,10 +85,10 @@ public:
|
|||
* Function MarkDirty()
|
||||
* Marks ratsnest for given net as 'dirty', i.e. requiring recomputation.
|
||||
*/
|
||||
void MarkDirty()
|
||||
{
|
||||
m_dirty = true;
|
||||
}
|
||||
// void MarkDirty()
|
||||
// {
|
||||
// m_dirty = true;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Function IsDirty()
|
||||
|
@ -152,7 +163,7 @@ protected:
|
|||
void kruskalMST( std::priority_queue<CN_EDGE> &aEdges );
|
||||
|
||||
///> Vector of nodes
|
||||
std::vector<CN_ANCHOR_PTR> m_nodes;
|
||||
std::multiset<CN_ANCHOR_PTR, CN_PTR_CMP> m_nodes;
|
||||
|
||||
///> Vector of edges that make pre-defined connections
|
||||
std::vector<CN_EDGE> m_boardEdges;
|
||||
|
|
Loading…
Reference in New Issue