Commit 5fe20bbc authored by Maciej Suminski's avatar Maciej Suminski

Fixed broken search filters.

parent fe5c5953
......@@ -172,7 +172,6 @@ void RN_NET::validateEdge( RN_EDGE_PTR& aEdge )
{
valid = false;
WITHOUT_FLAG without_flag;
std::list<RN_NODE_PTR> closest = GetClosestNodes( target, WITHOUT_FLAG() );
BOOST_FOREACH( RN_NODE_PTR& node, closest )
{
......@@ -220,12 +219,6 @@ const RN_EDGE_PTR& RN_LINKS::AddConnection( const RN_NODE_PTR& aNode1, const RN_
}
void RN_LINKS::RemoveConnection( const RN_EDGE_PTR& aEdge )
{
m_edges.remove( aEdge );
}
void RN_NET::compute()
{
const RN_LINKS::RN_NODE_SET& boardNodes = m_links.GetNodes();
......@@ -536,7 +529,8 @@ const RN_NODE_PTR RN_NET::GetClosestNode( const RN_NODE_PTR& aNode ) const
}
const RN_NODE_PTR RN_NET::GetClosestNode( const RN_NODE_PTR& aNode, RN_NODE_FILTER aFilter ) const
const RN_NODE_PTR RN_NET::GetClosestNode( const RN_NODE_PTR& aNode,
const RN_NODE_FILTER& aFilter ) const
{
const RN_LINKS::RN_NODE_SET& nodes = m_links.GetNodes();
RN_LINKS::RN_NODE_SET::const_iterator it, itEnd;
......@@ -589,7 +583,7 @@ std::list<RN_NODE_PTR> RN_NET::GetClosestNodes( const RN_NODE_PTR& aNode, int aN
std::list<RN_NODE_PTR> RN_NET::GetClosestNodes( const RN_NODE_PTR& aNode,
RN_NODE_FILTER aFilter, int aNumber ) const
const RN_NODE_FILTER& aFilter, int aNumber ) const
{
std::list<RN_NODE_PTR> closest;
const RN_LINKS::RN_NODE_SET& nodes = m_links.GetNodes();
......
......@@ -61,7 +61,8 @@ typedef hed::Triangulation TRIANGULATOR;
struct RN_NODE_FILTER : public std::unary_function<const RN_NODE_PTR&, bool>
{
virtual ~RN_NODE_FILTER() {}
virtual bool operator()( const RN_NODE_PTR& aNode )
virtual bool operator()( const RN_NODE_PTR& aNode ) const
{
return true; // By default everything passes
}
......@@ -70,7 +71,7 @@ struct RN_NODE_FILTER : public std::unary_function<const RN_NODE_PTR&, bool>
///> Filters out nodes that have the flag set.
struct WITHOUT_FLAG : public RN_NODE_FILTER
{
bool operator()( const RN_NODE_PTR& aNode )
bool operator()( const RN_NODE_PTR& aNode ) const
{
return !aNode->GetFlag();
}
......@@ -159,7 +160,10 @@ public:
* Removes a connection described by a given edge pointer.
* @param aEdge is a pointer to edge to be removed.
*/
void RemoveConnection( const RN_EDGE_PTR& aEdge );
void RemoveConnection( const RN_EDGE_PTR& aEdge )
{
m_edges.remove( aEdge );
}
/**
* Function GetConnections()
......@@ -395,7 +399,8 @@ public:
* @param aNode is the node for which the closest node is searched.
* @param aFilter is a functor that filters nodes.
*/
const RN_NODE_PTR GetClosestNode( const RN_NODE_PTR& aNode, RN_NODE_FILTER aFilter ) const;
const RN_NODE_PTR GetClosestNode( const RN_NODE_PTR& aNode,
const RN_NODE_FILTER& aFilter ) const;
/**
* Function GetClosestNodes()
......@@ -417,7 +422,7 @@ public:
* nodes then the size of list is limited to number of possible nodes.
*/
std::list<RN_NODE_PTR> GetClosestNodes( const RN_NODE_PTR& aNode,
RN_NODE_FILTER aFilter, int aNumber = -1 ) const;
const RN_NODE_FILTER& aFilter, int aNumber = -1 ) const;
/**
* Function GetEdges()
......
......@@ -59,8 +59,6 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const
aGal->SetLineWidth( 1.0 );
aGal->SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 0.4 ) );
WITHOUT_FLAG without_flag;
// Draw the temporary ratsnest
BOOST_FOREACH( const RN_NET& net, m_data->GetNets() )
{
......@@ -73,7 +71,7 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const
// Draw the "dynamic" ratsnest (ie. for objects that may be currently being moved)
BOOST_FOREACH( const RN_NODE_PTR& node, net.GetSimpleNodes() )
{
RN_NODE_PTR dest = net.GetClosestNode( node, without_flag );
RN_NODE_PTR dest = net.GetClosestNode( node, WITHOUT_FLAG() );
if( dest && usedDestinations.find( dest ) == usedDestinations.end() )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment