Ratsnest does not take into account non-copper pads (GAL).

This commit is contained in:
Maciej Suminski 2016-02-03 11:01:00 +01:00
parent 0ef1eee2c6
commit c16b66ce0c
1 changed files with 42 additions and 36 deletions

View File

@ -427,6 +427,10 @@ void RN_NET::Update()
void RN_NET::AddItem( const D_PAD* aPad ) void RN_NET::AddItem( const D_PAD* aPad )
{ {
// Ratsnest is not computed for non-copper pads
if( ( aPad->GetLayerSet() & LSET::AllCuMask() ).none() )
return;
RN_NODE_PTR node = m_links.AddNode( aPad->GetPosition().x, aPad->GetPosition().y ); RN_NODE_PTR node = m_links.AddNode( aPad->GetPosition().x, aPad->GetPosition().y );
node->AddParent( aPad ); node->AddParent( aPad );
m_pads[aPad].m_Node = node; m_pads[aPad].m_Node = node;
@ -672,52 +676,54 @@ std::list<RN_NODE_PTR> RN_NET::GetNodes( const BOARD_CONNECTED_ITEM* aItem ) con
{ {
std::list<RN_NODE_PTR> nodes; std::list<RN_NODE_PTR> nodes;
try
{
switch( aItem->Type() ) switch( aItem->Type() )
{ {
case PCB_PAD_T: case PCB_PAD_T:
{ {
const D_PAD* pad = static_cast<const D_PAD*>( aItem ); PAD_NODE_MAP::const_iterator it = m_pads.find( static_cast<const D_PAD*>( aItem ) );
nodes.push_back( m_pads.at( pad ).m_Node );
if( it != m_pads.end() )
nodes.push_back( it->second.m_Node );
} }
break; break;
case PCB_VIA_T: case PCB_VIA_T:
{ {
const VIA* via = static_cast<const VIA*>( aItem ); VIA_NODE_MAP::const_iterator it = m_vias.find( static_cast<const VIA*>( aItem ) );
nodes.push_back( m_vias.at( via ) );
if( it != m_vias.end() )
nodes.push_back( it->second );
} }
break; break;
case PCB_TRACE_T: case PCB_TRACE_T:
{ {
const TRACK* track = static_cast<const TRACK*>( aItem ); TRACK_EDGE_MAP::const_iterator it = m_tracks.find( static_cast<const TRACK*>( aItem ) );
const RN_EDGE_MST_PTR& edge = m_tracks.at( track );
nodes.push_back( edge->GetSourceNode() ); if( it != m_tracks.end() )
nodes.push_back( edge->GetTargetNode() ); {
nodes.push_back( it->second->GetSourceNode() );
nodes.push_back( it->second->GetTargetNode() );
}
} }
break; break;
case PCB_ZONE_AREA_T: case PCB_ZONE_AREA_T:
{ {
const ZONE_CONTAINER* zone = static_cast<const ZONE_CONTAINER*>( aItem ); ZONE_DATA_MAP::const_iterator it = m_zones.find( static_cast<const ZONE_CONTAINER*>( aItem ) );
const std::deque<RN_POLY>& polys = m_zones.at( zone ).m_Polygons;
if( it != m_zones.end() )
{
const std::deque<RN_POLY>& polys = it->second.m_Polygons;
for( std::deque<RN_POLY>::const_iterator it = polys.begin(); it != polys.end(); ++it ) for( std::deque<RN_POLY>::const_iterator it = polys.begin(); it != polys.end(); ++it )
nodes.push_back( it->GetNode() ); nodes.push_back( it->GetNode() );
} }
}
break; break;
default: default:
break; break;
} }
}
catch( ... )
{
// It is fine, just return empty list of nodes
}
return nodes; return nodes;
} }