diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index 6c7aed939f..6a8e62549b 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -28,6 +28,7 @@ #include #include +#include #include @@ -676,7 +677,7 @@ void NODE::doRemove( ITEM* aItem ) if( aItem->BelongsTo( m_root ) && !isRoot() ) { m_override.insert( aItem ); - + if( aItem->HasHole() ) m_override.insert( aItem->Hole() ); } @@ -1588,4 +1589,16 @@ ITEM *NODE::FindItemByParent( const BOARD_ITEM* aParent ) return nullptr; } +std::vector NODE::FindItemsByZone( const ZONE* aParent ) +{ + std::vector ret; + + for( ITEM* item : *m_index ) + { + if( item->Parent() == aParent ) + ret.push_back( item ); + } + + return ret; +} } diff --git a/pcbnew/router/pns_node.h b/pcbnew/router/pns_node.h index 1f88f9cbf7..1f0d91341a 100644 --- a/pcbnew/router/pns_node.h +++ b/pcbnew/router/pns_node.h @@ -35,6 +35,7 @@ #include "pns_joint.h" #include "pns_itemset.h" +class ZONE; namespace PNS { class ARC; @@ -430,6 +431,8 @@ public: ITEM* FindItemByParent( const BOARD_ITEM* aParent ); + std::vector FindItemsByZone( const ZONE* aParent ); + bool HasChildren() const { return !m_children.empty(); diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index e59e700772..e2ad536ae2 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -2095,6 +2095,14 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) } } + for( ZONE* zone : footprint->Zones() ) + { + std::vector solids = m_router->GetWorld()->FindItemsByZone( zone ); + + for( PNS::ITEM* solid : solids ) + itemsToDrag.Add( solid ); + } + if( showCourtyardConflicts ) { courtyardClearanceDRC.Init( board() ); @@ -2249,14 +2257,6 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) view()->AddToPreview( previewItem ); view()->Hide( &footprint->Value() ); - for( ZONE* zone : footprint->Zones() ) - { - previewItem = static_cast( zone->Clone() ); - previewItem->Move( offset ); - view()->AddToPreview( previewItem ); - view()->Hide( zone, true ); - } - if( showCourtyardConflicts ) { footprint->Move( offset ); @@ -2324,9 +2324,6 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent ) view()->Hide( &footprint->Reference(), false ); view()->Hide( &footprint->Value(), false ); - for( ZONE* zone : footprint->Zones() ) - view()->Hide( zone, false ); - for( PAD* pad : footprint->Pads() ) view()->Hide( pad, false );