More descriptive method names for RN_NODE
This commit is contained in:
parent
02cfab4266
commit
03f4a89521
|
@ -43,7 +43,7 @@
|
|||
#define _HE_TRIANG_H_
|
||||
|
||||
//#define TTL_USE_NODE_ID // Each node gets it's own unique id
|
||||
#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 <unordered_set>
|
||||
|
@ -106,6 +106,9 @@ protected:
|
|||
/// Tag for quick connection resolution
|
||||
int m_tag;
|
||||
|
||||
/// Whether it the node can be a target for ratsnest lines
|
||||
bool m_noline;
|
||||
|
||||
/// List of board items that share this node
|
||||
std::unordered_set<const BOARD_CONNECTED_ITEM*> m_parents;
|
||||
|
||||
|
@ -124,7 +127,7 @@ public:
|
|||
#ifdef TTL_USE_NODE_ID
|
||||
m_id( id_count++ ),
|
||||
#endif
|
||||
m_x( aX ), m_y( aY ), m_tag( -1 )
|
||||
m_x( aX ), m_y( aY ), m_tag( -1 ), m_noline( false )
|
||||
{
|
||||
m_layers.reset();
|
||||
}
|
||||
|
@ -156,6 +159,18 @@ public:
|
|||
m_tag = aTag;
|
||||
}
|
||||
|
||||
/// Decides whether this node can be a ratsnest line target
|
||||
inline void SetNoLine( bool aEnable )
|
||||
{
|
||||
m_noline = aEnable;
|
||||
}
|
||||
|
||||
/// Returns true if this node can be a target for ratsnest lines
|
||||
inline const bool& GetNoLine() const
|
||||
{
|
||||
return m_noline;
|
||||
}
|
||||
|
||||
#ifdef TTL_USE_NODE_ID
|
||||
/// Returns the id (TTL_USE_NODE_ID must be defined)
|
||||
inline int Id() const
|
||||
|
|
|
@ -215,11 +215,11 @@ void RN_NET::validateEdge( RN_EDGE_MST_PTR& aEdge )
|
|||
|
||||
// If any of nodes belonging to the edge has the flag set,
|
||||
// change it to the closest node that has flag cleared
|
||||
if( source->GetFlag() )
|
||||
if( source->GetNoLine() )
|
||||
{
|
||||
valid = false;
|
||||
std::list<RN_NODE_PTR> closest = GetClosestNodes( source, LINE_TARGET() );
|
||||
|
||||
std::list<RN_NODE_PTR> closest = GetClosestNodes( source, WITHOUT_FLAG() );
|
||||
for( RN_NODE_PTR& node : closest )
|
||||
{
|
||||
if( node && node != target )
|
||||
|
@ -230,11 +230,11 @@ void RN_NET::validateEdge( RN_EDGE_MST_PTR& aEdge )
|
|||
}
|
||||
}
|
||||
|
||||
if( target->GetFlag() )
|
||||
if( target->GetNoLine() )
|
||||
{
|
||||
valid = false;
|
||||
std::list<RN_NODE_PTR> closest = GetClosestNodes( target, LINE_TARGET() );
|
||||
|
||||
std::list<RN_NODE_PTR> closest = GetClosestNodes( target, WITHOUT_FLAG() );
|
||||
for( RN_NODE_PTR& node : closest )
|
||||
{
|
||||
if( node && node != source )
|
||||
|
@ -398,7 +398,7 @@ RN_POLY::RN_POLY( const SHAPE_POLY_SET* aParent,
|
|||
|
||||
// Mark it as not appropriate as a destination of ratsnest edges
|
||||
// (edges coming out from a polygon vertex look weird)
|
||||
m_node->SetFlag( true );
|
||||
m_node->SetNoLine( true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -761,7 +761,7 @@ void RN_NET::GetAllItems( std::list<BOARD_CONNECTED_ITEM*>& aOutput, RN_ITEM_TYP
|
|||
void RN_NET::ClearSimple()
|
||||
{
|
||||
for( const RN_NODE_PTR& node : m_blockedNodes )
|
||||
node->SetFlag( false );
|
||||
node->SetNoLine( false );
|
||||
|
||||
m_blockedNodes.clear();
|
||||
m_simpleNodes.clear();
|
||||
|
|
|
@ -92,19 +92,19 @@ struct RN_NODE_FILTER : public std::unary_function<const RN_NODE_PTR&, bool>
|
|||
RN_NODE_AND_FILTER operator&&( const RN_NODE_FILTER& aFilter1, const RN_NODE_FILTER& aFilter2 );
|
||||
RN_NODE_OR_FILTER operator||( const RN_NODE_FILTER& aFilter1, const RN_NODE_FILTER& aFilter2 );
|
||||
|
||||
///> Filters out nodes that have the flag set.
|
||||
struct WITHOUT_FLAG : public RN_NODE_FILTER
|
||||
///> Filters out nodes that cannot be a ratsnest line target
|
||||
struct LINE_TARGET : public RN_NODE_FILTER
|
||||
{
|
||||
bool operator()( const RN_NODE_PTR& aNode ) const
|
||||
{
|
||||
return !aNode->GetFlag();
|
||||
return !aNode->GetNoLine();
|
||||
}
|
||||
};
|
||||
|
||||
///> Filters out nodes with a specific tag
|
||||
struct DIFFERENT_TAG : public RN_NODE_FILTER
|
||||
struct DIFF_TAG : public RN_NODE_FILTER
|
||||
{
|
||||
DIFFERENT_TAG( int aTag ) :
|
||||
DIFF_TAG( int aTag ) :
|
||||
m_tag( aTag )
|
||||
{}
|
||||
|
||||
|
@ -515,7 +515,7 @@ public:
|
|||
inline void AddBlockedNode( RN_NODE_PTR& aNode )
|
||||
{
|
||||
m_blockedNodes.insert( aNode );
|
||||
aNode->SetFlag( true );
|
||||
aNode->SetNoLine( true );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -79,7 +79,7 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const
|
|||
if( node->GetRefCount() > 1 )
|
||||
continue;
|
||||
|
||||
RN_NODE_PTR dest = net.GetClosestNode( node, WITHOUT_FLAG() );
|
||||
RN_NODE_PTR dest = net.GetClosestNode( node, LINE_TARGET() );
|
||||
|
||||
if( dest )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue