Dead code removal

This commit is contained in:
Maciej Suminski 2017-06-23 14:08:22 +02:00
parent f3fbce9560
commit 3dd4429ef6
8 changed files with 2 additions and 406 deletions

View File

@ -167,7 +167,6 @@ void PCB_EDIT_FRAME::Clean_Pcb()
m_canvas->Refresh( true );
}
extern void RebuildTrackChain ( BOARD *brd);
void TRACKS_CLEANER::buildTrackConnectionInfo()
{
@ -175,8 +174,6 @@ void TRACKS_CLEANER::buildTrackConnectionInfo()
connectivity->Build(m_brd);
//RebuildTrackChain ( m_brd );
// clear flags and variables used in cleanup
for( auto track : m_brd->Tracks() )
{
@ -199,17 +196,6 @@ void TRACKS_CLEANER::buildTrackConnectionInfo()
}
}
}
#if 0
printf("bci\n");
for( TRACK* segment = m_brd->m_Track; segment; segment = segment->Next() )
{
if( segment->Type() == PCB_TRACE_T )
{
printf("s %d %d %d %d %d %x\n", segment->GetStart().x, segment->GetStart().y, segment->GetEnd().x, segment->GetEnd().y, segment->GetLayer(), segment->GetStatus() );
}
}
#endif
}
@ -668,46 +654,6 @@ TRACK* TRACKS_CLEANER::mergeCollinearSegmentIfPossible( TRACK* aTrackRef, TRACK*
aCandidate->GetEnd().y - aCandidate->GetStart().y ) )
return NULL;
/* Here we have 2 aligned segments:
* We must change the pt_ref common point only if not on a pad
* (this function) is called when there is only 2 connected segments,
* and if this point is not on a pad, it can be removed and the 2 segments will be merged
*/
#if 0
if(aTrackRef->GetNetCode() == 47)
{
auto pads = m_brd->GetConnectivity()->GetConnectedPads( aTrackRef );
printf("eps ref %d %d-%d %d pads-con %d eop %d sop %d\n",
aTrackRef->GetStart().x,
aTrackRef->GetStart().y,
aTrackRef->GetEnd().x,
aTrackRef->GetEnd().y,
pads.size(),
!!aTrackRef->GetState(END_ON_PAD),
!!aTrackRef->GetState(START_ON_PAD)
);
pads = m_brd->GetConnectivity()->GetConnectedPads( aCandidate );
printf("eps cand %d %d-%d %d pads-con %d eop %d sop %d\n",
aCandidate->GetStart().x,
aCandidate->GetStart().y,
aCandidate->GetEnd().x,
aCandidate->GetEnd().y,
pads.size(),
!!aCandidate->GetState(END_ON_PAD),
!!aCandidate->GetState(START_ON_PAD)
);
}
#endif
auto connectivity = m_brd->GetConnectivity();
updateConn( aTrackRef, connectivity );

View File

@ -440,13 +440,6 @@ unsigned int CONNECTIVITY_DATA::GetLinksCount() const
}
unsigned int CONNECTIVITY_DATA::GetConnectedCount() const
{
return 0;
assert( false );
}
unsigned int CONNECTIVITY_DATA::GetNodeCount( int aNet ) const
{
return 0;

View File

@ -157,9 +157,6 @@ public:
unsigned int GetLinksCount() const;
unsigned int GetConnectedCount() const;
unsigned int GetNodeCount( int aNet = -1 ) const;
unsigned int GetPadCount( int aNet = -1 ) const;

View File

@ -888,23 +888,6 @@ const VECTOR2I CN_ZONE::GetAnchor( int n ) const
}
/*const std::vector<VECTOR2I> CN_CLUSTER::GetAnchors()
{
std::vector<VECTOR2I> anchors;
for( auto item : m_items )
{
int cnt = item->AnchorCount();
for(int i = 0 ; i < cnt; i++)
{
anchors.push_back( item->GetAnchor(i) );
}
}
return anchors;
}*/
int CN_ITEM::Net() const
{
if( !m_parent )

View File

@ -61,32 +61,6 @@ static bool sortWeight( const CN_EDGE& aEdge1, const CN_EDGE& aEdge2 )
}
/*bool operator==( const RN_NODE_PTR& aFirst, const RN_NODE_PTR& aSecond )
* {
* return aFirst->GetX() == aSecond->GetX() && aFirst->GetY() == aSecond->GetY();
* }
*
* bool operator!=( const RN_NODE_PTR& aFirst, const RN_NODE_PTR& aSecond )
* {
* return aFirst->GetX() != aSecond->GetX() || aFirst->GetY() != aSecond->GetY();
* }
*
* RN_NODE_AND_FILTER operator&&( const RN_NODE_FILTER& aFilter1, const RN_NODE_FILTER& aFilter2 )
* {
* return RN_NODE_AND_FILTER( aFilter1, aFilter2 );
* }
*
* RN_NODE_OR_FILTER operator||( const RN_NODE_FILTER& aFilter1, const RN_NODE_FILTER& aFilter2 )
* {
* return RN_NODE_OR_FILTER( aFilter1, aFilter2 );
* }
*
* static bool isEdgeConnectingNode( const RN_EDGE_PTR& aEdge, const RN_NODE_PTR& aNode )
* {
* return aEdge->GetSourceNode() == aNode || aEdge->GetTargetNode() == aNode;
* }
*/
static const std::vector<CN_EDGE> kruskalMST( std::list<CN_EDGE>& aEdges,
std::vector<CN_ANCHOR_PTR>& aNodes )
{
@ -385,257 +359,6 @@ void RN_NET::Clear()
m_dirty = true;
}
#if 0
const RN_NODE_PTR RN_NET::GetClosestNode( const RN_NODE_PTR& aNode ) const
{
/*const RN_LINKS::RN_NODE_SET& nodes = m_links.GetNodes();
* RN_LINKS::RN_NODE_LISt::const_iterator it, itEnd;
*
* unsigned int minDistance = std::numeric_limits<unsigned int>::max();
* RN_NODE_PTR closest;
*
* for( it = nodes.begin(), itEnd = nodes.end(); it != itEnd; ++it )
* {
* RN_NODE_PTR node = *it;
*
* // Obviously the distance between node and itself is the shortest,
* // that's why we have to skip it
* if( node != aNode )
* {
* unsigned int distance = getDistance( node, aNode );
* if( distance < minDistance )
* {
* minDistance = distance;
* closest = node;
* }
* }
* }
*
* return closest;*/
}
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;
*
* unsigned int minDistance = std::numeric_limits<unsigned int>::max();
* RN_NODE_PTR closest;
*
* for( it = nodes.begin(), itEnd = nodes.end(); it != itEnd; ++it )
* {
* RN_NODE_PTR node = *it;
*
* // Obviously the distance between node and itself is the shortest,
* // that's why we have to skip it
* if( node != aNode && aFilter( node ) )
* {
* unsigned int distance = getDistance( node, aNode );
*
* if( distance < minDistance )
* {
* minDistance = distance;
* closest = node;
* }
* }
* }
*
* return closest;*/
}
std::list<RN_NODE_PTR> RN_NET::GetClosestNodes( const RN_NODE_PTR& aNode, int aNumber ) const
{
/*std::list<RN_NODE_PTR> closest;
* const RN_LINKS::RN_NODE_SET& nodes = m_links.GetNodes();
*
* // Copy nodes
* std::copy( nodes.begin(), nodes.end(), std::back_inserter( closest ) );
*
* // Sort by the distance from aNode
* closest.sort( std::bind( sortDistance, std::cref( aNode ), _1, _2 ) );
*
* // aNode should not be returned in the results
* closest.remove( aNode );
*
* // Trim the result to the asked size
* if( aNumber > 0 )
* closest.resize( std::min( (size_t)aNumber, nodes.size() ) );
* return closest;*/
}
std::list<RN_NODE_PTR> RN_NET::GetClosestNodes( const RN_NODE_PTR& aNode,
const RN_NODE_FILTER& aFilter, int aNumber ) const
{
/*std::list<RN_NODE_PTR> closest;
* const RN_LINKS::RN_NODE_SET& nodes = m_links.GetNodes();
*
* // Copy filtered nodes
* std::copy_if( nodes.begin(), nodes.end(), std::back_inserter( closest ), std::cref( aFilter ) );
*
* // Sort by the distance from aNode
* closest.sort( std::bind( sortDistance, std::cref( aNode ), _1, _2 ) );
*
* // aNode should not be returned in the results
* closest.remove( aNode );
*
* // Trim the result to the asked size
* if( aNumber > 0 )
* closest.resize( std::min( static_cast<size_t>( aNumber ), nodes.size() ) );
* return closest;*/
}
std::list<RN_NODE_PTR> RN_NET::GetNodes( const BOARD_CONNECTED_ITEM* aItem ) const
{
/*std::list<RN_NODE_PTR> nodes;
*
* switch( aItem->Type() )
* {
* case PCB_PAD_T:
* {
* PAD_NODE_MAP::const_iterator it = m_pads.find( static_cast<const D_PAD*>( aItem ) );
*
* if( it != m_pads.end() )
* nodes.push_back( it->second.m_Node );
* }
* break;
*
* case PCB_VIA_T:
* {
* VIA_NODE_MAP::const_iterator it = m_vias.find( static_cast<const VIA*>( aItem ) );
*
* if( it != m_vias.end() )
* nodes.push_back( it->second );
* }
* break;
*
* case PCB_TRACE_T:
* {
* TRACK_EDGE_MAP::const_iterator it = m_tracks.find( static_cast<const TRACK*>( aItem ) );
*
* if( it != m_tracks.end() )
* {
* nodes.push_back( it->second->GetSourceNode() );
* nodes.push_back( it->second->GetTargetNode() );
* }
* }
* break;
*
* case PCB_ZONE_AREA_T:
* {
* ZONE_DATA_MAP::const_iterator itz = m_zones.find( static_cast<const ZONE_CONTAINER*>( aItem ) );
*
* if( itz != m_zones.end() )
* {
* const std::deque<RN_POLY>& polys = itz->second.m_Polygons;
*
* for( std::deque<RN_POLY>::const_iterator it = polys.begin(); it != polys.end(); ++it )
* nodes.push_back( it->GetNode() );
* }
* }
* break;
*
* default:
* break;
* }
*
* return nodes;*/
}
void RN_NET::GetAllItems( std::list<BOARD_CONNECTED_ITEM*>& aOutput, const KICAD_T aTypes[] ) const
{
/* if( aType & RN_PADS )
* {
* for( auto it : m_pads )
* aOutput.push_back( const_cast<D_PAD*>( it.first ) );
* }
*
* if( aType & RN_VIAS )
* {
* for( auto it : m_vias )
* aOutput.push_back( const_cast<VIA*>( it.first ) );
* }
*
* if( aType & RN_TRACKS )
* {
* for( auto it : m_tracks )
* aOutput.push_back( const_cast<TRACK*>( it.first ) );
* }
*
* if( aType & RN_ZONES )
* {
* for( auto it : m_zones )
* aOutput.push_back( const_cast<ZONE_CONTAINER*>( it.first ) );
* }*/
}
void RN_NET::GetConnectedItems( const BOARD_CONNECTED_ITEM* aItem,
std::list<BOARD_CONNECTED_ITEM*>& aOutput,
const KICAD_T aTypes[] ) const
{
/* std::list<RN_NODE_PTR> nodes = GetNodes( aItem );
* assert( !nodes.empty() );
*
* int tag = nodes.front()->GetTag();
* assert( tag >= 0 );
*
* if( aTypes & RN_PADS )
* {
* for( PAD_NODE_MAP::const_iterator it = m_pads.begin(); it != m_pads.end(); ++it )
* {
* if( it->second.m_Node->GetTag() == tag )
* aOutput.push_back( const_cast<D_PAD*>( it->first ) );
* }
* }
*
* if( aTypes & RN_VIAS )
* {
* for( VIA_NODE_MAP::const_iterator it = m_vias.begin(); it != m_vias.end(); ++it )
* {
* if( it->second->GetTag() == tag )
* aOutput.push_back( const_cast<VIA*>( it->first ) );
* }
* }
*
* if( aTypes & RN_TRACKS )
* {
* for( TRACK_EDGE_MAP::const_iterator it = m_tracks.begin(); it != m_tracks.end(); ++it )
* {
* if( it->second->GetTag() == tag )
* aOutput.push_back( const_cast<TRACK*>( it->first ) );
* }
* }
*
* if( aTypes & RN_ZONES )
* {
* for( ZONE_DATA_MAP::const_iterator it = m_zones.begin(); it != m_zones.end(); ++it )
* {
* for( const RN_EDGE_MST_PTR& edge : it->second.m_Edges )
* {
* if( edge->GetTag() == tag )
* {
* aOutput.push_back( const_cast<ZONE_CONTAINER*>( it->first ) );
* break;
* }
* }
* }
* }*/
}
// const RN_NODE_PTR& RN_NET::AddNode( int aX, int aY )
// {
// return m_links.AddNode( aX, aY );
// }
#endif
void RN_NET::AddCluster( CN_CLUSTER_PTR aCluster )
{

View File

@ -141,39 +141,6 @@ public:
bool NearestBicoloredPair( const RN_NET& aOtherNet, CN_ANCHOR_PTR& aNode1, CN_ANCHOR_PTR& aNode2 ) const;
/**
* Function GetClosestNode()
* Returns a single node that lies in the shortest distance from a specific node and meets
* selected filter criterion.
* @param aNode is the node for which the closest node is searched.
* @param aFilter is a functor that filters nodes.
*/
/*const CN_ANCHOR_PTR GetClosestNode( const RN_NODE_PTR& aNode,
const RN_NODE_FILTER& aFilter ) const;*/
/**
* Function GetClosestNodes()
* Returns list of nodes sorted by the distance from a specific node.
* @param aNode is the node for which the closest nodes are searched.
* @param aNumber is asked number of returned nodes. If it is negative then all nodes that
* belong to the same net are returned. If asked number is greater than number of possible
* nodes then the size of list is limited to number of possible nodes.
*/
//std::list<RN_NODE_PTR> GetClosestNodes( const RN_NODE_PTR& aNode, int aNumber = -1 ) const;
/**
* Function GetClosestNodes()
* Returns filtered list of nodes sorted by the distance from a specific node.
* @param aNode is the node for which the closest nodes are searched.
* @param aFilter is a functor that filters nodes.
* @param aNumber is asked number of returned nodes. If it is negative then all nodes that
* belong to the same net are returned. If asked number is greater than number of possible
* nodes then the size of list is limited to number of possible nodes.
*/
//std::list<RN_NODE_PTR> GetClosestNodes( const RN_NODE_PTR& aNode,
// const RN_NODE_FILTER& aFilter, int aNumber = -1 ) const;
protected:
///> Recomputes ratsnest from scratch.
void compute();

View File

@ -1136,20 +1136,6 @@ int PCB_EDITOR_CONTROL::ShowLocalRatsnest( const TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::UpdateSelectionRatsnest( const TOOL_EVENT& aEvent )
{
return 0;
/* SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
RN_DATA* ratsnest = getModel<BOARD>()->GetRatsnest();
// Update "simple" ratsnest, computed for currently modified items
ratsnest->ClearSimple();
for( auto item : selection )
{
ratsnest->Update( static_cast<BOARD_ITEM*>( item ) );
ratsnest->AddSimple( static_cast<BOARD_ITEM*>( item ) );
}
return 0;*/
}

View File

@ -797,6 +797,7 @@ int SELECTION_TOOL::selectCopper( const TOOL_EVENT& aEvent )
for( auto i : selection )
{
auto item = static_cast<BOARD_ITEM*>( i );
// only connected items can be traversed in the ratsnest
if( item->IsConnected() )
{
@ -862,6 +863,7 @@ int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
for( auto i : selection )
{
auto item = static_cast<BOARD_ITEM*>( i );
// only connected items get a net code
if( item->IsConnected() )
{
@ -1000,7 +1002,6 @@ int SELECTION_TOOL::selectOnSheetFromEeschema( const TOOL_EVENT& aEvent )
if( m_selection.Size() > 0 )
m_toolMgr->ProcessEvent( SelectedEvent );
return 0;
}