PNS: Don't allow routing on hidden layers

If the layer is not shown, we should not be allowing it's items to be
selected and chosen as the start/end items in the router.
This commit is contained in:
Seth Hillbrand 2019-08-15 00:21:48 -07:00
parent dc91d4eca8
commit fc1fb7a590
4 changed files with 20 additions and 0 deletions

View File

@ -985,6 +985,7 @@ bool PNS_KICAD_IFACE::syncGraphicalItem( PNS::NODE* aWorld, DRAWSEGMENT* aItem )
return true;
}
void PNS_KICAD_IFACE::SetBoard( BOARD* aBoard )
{
m_board = aBoard;
@ -992,6 +993,19 @@ void PNS_KICAD_IFACE::SetBoard( BOARD* aBoard )
}
bool PNS_KICAD_IFACE::IsAnyLayerVisible( const LAYER_RANGE& aLayer )
{
if( !m_view )
return false;
for( int i = aLayer.Start(); i <= aLayer.End(); i++ )
if( m_view->IsLayerVisible( i ) )
return true;
return false;
}
void PNS_KICAD_IFACE::SyncWorld( PNS::NODE *aWorld )
{
int worstPadClearance = 0;

View File

@ -52,6 +52,7 @@ public:
void SetView( KIGFX::VIEW* aView );
void SyncWorld( PNS::NODE* aWorld ) override;
void EraseView() override;
bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) override;
void HideItem( PNS::ITEM* aItem ) override;
void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0, bool aEdit = false ) override;
void AddItem( PNS::ITEM* aItem ) override;

View File

@ -28,6 +28,7 @@
#include <core/optional.h>
#include <boost/unordered_set.hpp>
#include <layers_id_colors_and_visibility.h>
#include <geometry/shape_line_chain.h>
#include "pns_routing_settings.h"
@ -93,6 +94,7 @@ enum DRAG_MODE
virtual void SyncWorld( NODE* aNode ) = 0;
virtual void AddItem( ITEM* aItem ) = 0;
virtual void RemoveItem( ITEM* aItem ) = 0;
virtual bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) = 0;
virtual void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1, bool aEdit = false ) = 0;
virtual void HideItem( ITEM* aItem ) = 0;
virtual void Commit() = 0;

View File

@ -137,6 +137,9 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer, b
if( !IsCopperLayer( item->Layers().Start() ) )
continue;
if( !m_iface->IsAnyLayerVisible( item->Layers() ) )
continue;
// fixme: this causes flicker with live loop removal...
//if( item->Parent() && !item->Parent()->ViewIsVisible() )
// continue;