diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 079bf0d3f8..e61d63a9a0 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -487,9 +487,8 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const m_effectiveHoleShape = std::make_shared( m_pos - half_len, m_pos + half_len, half_width * 2 ); bbox = m_effectiveHoleShape->BBox(); - m_effectiveBoundingBox.Merge( - EDA_RECT( (wxPoint) bbox.GetPosition(), - wxSize( bbox.GetWidth(), bbox.GetHeight() ) ) ); + m_effectiveBoundingBox.Merge( EDA_RECT( (wxPoint) bbox.GetPosition(), + wxSize( bbox.GetWidth(), bbox.GetHeight() ) ) ); // All done m_shapesDirty = false; diff --git a/pcbnew/router/pns_item.h b/pcbnew/router/pns_item.h index a2cbe52b55..d02a081f9a 100644 --- a/pcbnew/router/pns_item.h +++ b/pcbnew/router/pns_item.h @@ -81,6 +81,7 @@ public: m_rank = -1; m_routable = true; m_isVirtual = false; + m_isCompoundShapePrimitive = false; } ITEM( const ITEM& aOther ) @@ -95,6 +96,7 @@ public: m_rank = aOther.m_rank; m_routable = aOther.m_routable; m_isVirtual = aOther.m_isVirtual; + m_isCompoundShapePrimitive = aOther.m_isCompoundShapePrimitive; } virtual ~ITEM(); @@ -235,6 +237,9 @@ public: return m_isVirtual; } + void SetIsCompoundShapePrimitive() { m_isCompoundShapePrimitive = true; } + bool IsCompoundShapePrimitive() const { return m_isCompoundShapePrimitive; } + private: bool collideSimple( const ITEM* aOther, const NODE* aNode, bool aDifferentNetsOnly ) const; @@ -251,6 +256,7 @@ protected: int m_rank; bool m_routable; bool m_isVirtual; + bool m_isCompoundShapePrimitive; }; template diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 7bbb04c041..a4a0ba7a84 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1109,6 +1109,7 @@ bool PNS_KICAD_IFACE_BASE::syncZone( PNS::NODE* aWorld, ZONE* aZone, SHAPE_POLY_ solid->SetNet( -1 ); solid->SetParent( aZone ); solid->SetShape( triShape ); + solid->SetIsCompoundShapePrimitive(); solid->SetRoutable( false ); aWorld->Add( std::move( solid ) ); @@ -1141,6 +1142,7 @@ bool PNS_KICAD_IFACE_BASE::syncTextItem( PNS::NODE* aWorld, EDA_TEXT* aText, PCB solid->SetNet( -1 ); solid->SetParent( dynamic_cast( aText ) ); solid->SetShape( new SHAPE_SEGMENT( start, end, textWidth ) ); + solid->SetIsCompoundShapePrimitive(); solid->SetRoutable( false ); aWorld->Add( std::move( solid ) ); @@ -1180,7 +1182,9 @@ bool PNS_KICAD_IFACE_BASE::syncGraphicalItem( PNS::NODE* aWorld, PCB_SHAPE* aIte if( aItem->GetShape() == SHAPE_T::POLY && aItem->IsFilled() ) return false; - for( SHAPE* shape : aItem->MakeEffectiveShapes() ) + std::vector shapes = aItem->MakeEffectiveShapes(); + + for( SHAPE* shape : shapes ) { std::unique_ptr solid = std::make_unique(); @@ -1202,7 +1206,11 @@ bool PNS_KICAD_IFACE_BASE::syncGraphicalItem( PNS::NODE* aWorld, PCB_SHAPE* aIte solid->SetNet( -1 ); solid->SetParent( aItem ); - solid->SetShape( shape ); + solid->SetShape( shape ); // takes ownership + + if( shapes.size() > 1 ) + solid->SetIsCompoundShapePrimitive(); + solid->SetRoutable( false ); aWorld->Add( std::move( solid ) ); diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 3e1d7fcc43..8980626a55 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -490,6 +490,13 @@ void ROUTER::markViolations( NODE* aNode, ITEM_SET& aCurrent, NODE::ITEM_VECTOR& removeOriginal = false; } } + + if( itemToMark->IsCompoundShapePrimitive() ) + { + // We're only highlighting one (or more) of several primitives so we + // don't want all the other parts of the object to disappear + removeOriginal = false; + } } m_iface->DisplayItem( tmp.get(), clearance );