Don't hide original object when highlight is only part of it.

Fixes https://gitlab.com/kicad/code/kicad/issues/9772
This commit is contained in:
Jeff Young 2021-11-25 23:41:47 +00:00
parent 78aa76d0e6
commit 99ec2b1801
4 changed files with 25 additions and 5 deletions

View File

@ -487,8 +487,7 @@ void PAD::BuildEffectiveShapes( PCB_LAYER_ID aLayer ) const
m_effectiveHoleShape = std::make_shared<SHAPE_SEGMENT>( m_pos - half_len, m_pos + half_len,
half_width * 2 );
bbox = m_effectiveHoleShape->BBox();
m_effectiveBoundingBox.Merge(
EDA_RECT( (wxPoint) bbox.GetPosition(),
m_effectiveBoundingBox.Merge( EDA_RECT( (wxPoint) bbox.GetPosition(),
wxSize( bbox.GetWidth(), bbox.GetHeight() ) ) );
// All done

View File

@ -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<typename T, typename S>

View File

@ -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<BOARD_ITEM*>( 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<SHAPE*> shapes = aItem->MakeEffectiveShapes();
for( SHAPE* shape : shapes )
{
std::unique_ptr<PNS::SOLID> solid = std::make_unique<PNS::SOLID>();
@ -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 ) );

View File

@ -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 );