Browse Source

pcbnew: Check all layers for routing snaps

Flipped footprint pads may report their "primary" layer as not the front
layer in high contrast.  We need to check whether the board item for
snaps is visible on the active layers.

Fixes: lp:1847877
* https://bugs.launchpad.net/kicad/+bug/1847877
pull/15/head
Seth Hillbrand 6 years ago
parent
commit
07c8596084
  1. 28
      pcbnew/router/pns_kicad_iface.cpp

28
pcbnew/router/pns_kicad_iface.cpp

@ -1071,15 +1071,33 @@ bool PNS_KICAD_IFACE::IsAnyLayerVisible( const LAYER_RANGE& aLayer )
bool PNS_KICAD_IFACE::IsItemVisible( const PNS::ITEM* aItem )
{
if( !m_view )
if( !m_view || !aItem->Parent() )
return false;
auto item = aItem->Parent();
auto activeLayers = m_view->GetPainter()->GetSettings()->GetActiveLayers();
bool isHighContrast = m_view->GetPainter()->GetSettings()->GetHighContrast();
bool isOnVisibleLayer = true;
if( m_view->GetPainter()->GetSettings()->GetHighContrast() )
{
int layers[KIGFX::VIEW::VIEW_MAX_LAYERS];
int layers_count;
auto activeLayers = m_view->GetPainter()->GetSettings()->GetActiveLayers();
isOnVisibleLayer = false;
item->ViewGetLayers( layers, layers_count );
for( int i = 0; i < layers_count; ++i )
{
// Item is on at least one of the active layers
if( activeLayers.count( layers[i] ) > 0 )
{
isOnVisibleLayer = true;
break;
}
}
}
if( item && m_view->IsVisible( item )
&& ( !isHighContrast || activeLayers.count( item->GetLayer() ) )
if( m_view->IsVisible( item ) && isOnVisibleLayer
&& item->ViewGetLOD( item->GetLayer(), m_view ) < m_view->GetScale() )
return true;

Loading…
Cancel
Save