Browse Source

Add Zone when dragging component

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14629
newinvert
Lucas Dumont 3 years ago
committed by Jeff Young
parent
commit
a22e6db982
  1. 13
      pcbnew/router/pns_node.cpp
  2. 3
      pcbnew/router/pns_node.h
  3. 19
      pcbnew/router/router_tool.cpp

13
pcbnew/router/pns_node.cpp

@ -28,6 +28,7 @@
#include <geometry/seg.h> #include <geometry/seg.h>
#include <geometry/shape_line_chain.h> #include <geometry/shape_line_chain.h>
#include <zone.h>
#include <wx/log.h> #include <wx/log.h>
@ -1588,4 +1589,16 @@ ITEM *NODE::FindItemByParent( const BOARD_ITEM* aParent )
return nullptr; return nullptr;
} }
std::vector<ITEM*> NODE::FindItemsByZone( const ZONE* aParent )
{
std::vector<ITEM*> ret;
for( ITEM* item : *m_index )
{
if( item->Parent() == aParent )
ret.push_back( item );
}
return ret;
}
} }

3
pcbnew/router/pns_node.h

@ -35,6 +35,7 @@
#include "pns_joint.h" #include "pns_joint.h"
#include "pns_itemset.h" #include "pns_itemset.h"
class ZONE;
namespace PNS { namespace PNS {
class ARC; class ARC;
@ -430,6 +431,8 @@ public:
ITEM* FindItemByParent( const BOARD_ITEM* aParent ); ITEM* FindItemByParent( const BOARD_ITEM* aParent );
std::vector<ITEM*> FindItemsByZone( const ZONE* aParent );
bool HasChildren() const bool HasChildren() const
{ {
return !m_children.empty(); return !m_children.empty();

19
pcbnew/router/router_tool.cpp

@ -2095,6 +2095,14 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
} }
} }
for( ZONE* zone : footprint->Zones() )
{
std::vector<PNS::ITEM*> solids = m_router->GetWorld()->FindItemsByZone( zone );
for( PNS::ITEM* solid : solids )
itemsToDrag.Add( solid );
}
if( showCourtyardConflicts ) if( showCourtyardConflicts )
{ {
courtyardClearanceDRC.Init( board() ); courtyardClearanceDRC.Init( board() );
@ -2249,14 +2257,6 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
view()->AddToPreview( previewItem ); view()->AddToPreview( previewItem );
view()->Hide( &footprint->Value() ); view()->Hide( &footprint->Value() );
for( ZONE* zone : footprint->Zones() )
{
previewItem = static_cast<BOARD_ITEM*>( zone->Clone() );
previewItem->Move( offset );
view()->AddToPreview( previewItem );
view()->Hide( zone, true );
}
if( showCourtyardConflicts ) if( showCourtyardConflicts )
{ {
footprint->Move( offset ); footprint->Move( offset );
@ -2324,9 +2324,6 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
view()->Hide( &footprint->Reference(), false ); view()->Hide( &footprint->Reference(), false );
view()->Hide( &footprint->Value(), false ); view()->Hide( &footprint->Value(), false );
for( ZONE* zone : footprint->Zones() )
view()->Hide( zone, false );
for( PAD* pad : footprint->Pads() ) for( PAD* pad : footprint->Pads() )
view()->Hide( pad, false ); view()->Hide( pad, false );

Loading…
Cancel
Save