diff --git a/pcbnew/router/pns_component_dragger.h b/pcbnew/router/pns_component_dragger.h index f20f25a1a8..0be7e3de3f 100644 --- a/pcbnew/router/pns_component_dragger.h +++ b/pcbnew/router/pns_component_dragger.h @@ -79,11 +79,28 @@ public: */ NODE* CurrentNode() const override; + /** + * Function CurrentNets() + * + * Returns the net code(s) of currently dragged item(s). + * Currently unused for component dragging. + */ const std::vector CurrentNets() const override { return std::vector(); } + /** + * Function CurrentLayer() + * + * Returns the layer of currently dragged item(s). + * Currently unused for component dragging. + */ + virtual int CurrentLayer() const override + { + return UNDEFINED_LAYER; + } + /** * Function Traces() * diff --git a/pcbnew/router/pns_drag_algo.h b/pcbnew/router/pns_drag_algo.h index 466a87d07b..58dce603d7 100644 --- a/pcbnew/router/pns_drag_algo.h +++ b/pcbnew/router/pns_drag_algo.h @@ -95,8 +95,20 @@ public: */ virtual NODE* CurrentNode() const = 0; + /** + * Function CurrentNets() + * + * Returns the net code(s) of currently dragged item(s). + */ virtual const std::vector CurrentNets() const = 0; + /** + * Function CurrentLayer() + * + * Returns the layer of currently dragged item(s). + */ + virtual int CurrentLayer() const = 0; + /** * Function Traces() * diff --git a/pcbnew/router/pns_dragger.h b/pcbnew/router/pns_dragger.h index b865a2ff41..8dc33a4de5 100644 --- a/pcbnew/router/pns_dragger.h +++ b/pcbnew/router/pns_dragger.h @@ -83,11 +83,26 @@ public: */ NODE* CurrentNode() const override; + /** + * Function CurrentNets() + * + * Returns the net code(s) of currently routed track(s). + */ const std::vector CurrentNets() const override { return std::vector( 1, m_draggedLine.Net() ); } + /** + * Function CurrentLayer() + * + * Returns the layer of currently routed track. + */ + int CurrentLayer() const override + { + return m_draggedLine.Layer(); + } + /** * Function Traces() * diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index db68e01bd2..2fb29d9a78 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1129,32 +1129,18 @@ bool PNS_KICAD_IFACE::IsItemVisible( const PNS::ITEM* aItem ) const if( !m_view || !aItem->Parent() ) return true; - BOARD_ITEM* item = aItem->Parent(); - bool isOnVisibleLayer = true; + BOARD_ITEM* item = aItem->Parent(); + bool isOnVisibleLayer = true; + RENDER_SETTINGS* settings = m_view->GetPainter()->GetSettings(); - if( m_view->GetPainter()->GetSettings()->GetHighContrast() ) - { - int layers[KIGFX::VIEW::VIEW_MAX_LAYERS]; - int layers_count; - auto activeLayers = m_view->GetPainter()->GetSettings()->GetHighContrastLayers(); - - 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( settings->GetHighContrast() ) + isOnVisibleLayer = item->IsOnLayer( settings->GetPrimaryHighContrastLayer() ); if( m_view->IsVisible( item ) && isOnVisibleLayer && item->ViewGetLOD( item->GetLayer(), m_view ) < m_view->GetScale() ) + { return true; + } // Items hidden in the router are not hidden on the board if( m_hiddenItems.find( item ) != m_hiddenItems.end() ) diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index ef56ab1087..15a625593e 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -521,6 +521,9 @@ int ROUTER::GetCurrentLayer() const { if( m_placer ) return m_placer->CurrentLayer(); + else if( m_dragger ) + return m_dragger->CurrentLayer(); + return -1; }