Add Zone when dragging component

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14629
This commit is contained in:
Lucas Dumont 2023-04-30 13:37:16 +12:00 committed by Jeff Young
parent df35452a98
commit a22e6db982
3 changed files with 25 additions and 12 deletions

View File

@ -28,6 +28,7 @@
#include <geometry/seg.h>
#include <geometry/shape_line_chain.h>
#include <zone.h>
#include <wx/log.h>
@ -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<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;
}
}

View File

@ -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<ITEM*> FindItemsByZone( const ZONE* aParent );
bool HasChildren() const
{
return !m_children.empty();

View File

@ -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 )
{
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<BOARD_ITEM*>( 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 );