diff --git a/pcbnew/ratsnest_data.cpp b/pcbnew/ratsnest_data.cpp index 85ca642808..6d38406444 100644 --- a/pcbnew/ratsnest_data.cpp +++ b/pcbnew/ratsnest_data.cpp @@ -172,7 +172,6 @@ void RN_NET::validateEdge( RN_EDGE_PTR& aEdge ) { valid = false; - WITHOUT_FLAG without_flag; std::list 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_NET::GetClosestNodes( const RN_NODE_PTR& aNode, int aN std::list 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 closest; const RN_LINKS::RN_NODE_SET& nodes = m_links.GetNodes(); diff --git a/pcbnew/ratsnest_data.h b/pcbnew/ratsnest_data.h index dc5e4016b1..6d0e7ee896 100644 --- a/pcbnew/ratsnest_data.h +++ b/pcbnew/ratsnest_data.h @@ -61,7 +61,8 @@ typedef hed::Triangulation TRIANGULATOR; struct RN_NODE_FILTER : public std::unary_function { 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 ///> 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 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() diff --git a/pcbnew/ratsnest_viewitem.cpp b/pcbnew/ratsnest_viewitem.cpp index 8a511d08d4..282c0998a0 100644 --- a/pcbnew/ratsnest_viewitem.cpp +++ b/pcbnew/ratsnest_viewitem.cpp @@ -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() ) {