Make sure TH pads get collision layer highlighted.
Also cleans it up to centralise all the decision-making. Fixes https://gitlab.com/kicad/code/kicad/issues/6925
This commit is contained in:
parent
d31b0a5e0d
commit
71215bcab3
|
@ -1337,15 +1337,12 @@ void PNS_KICAD_IFACE_BASE::SetDebugDecorator( PNS::DEBUG_DECORATOR *aDec )
|
|||
m_debugDecorator = aDec;
|
||||
}
|
||||
|
||||
void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aColor, int aClearance, bool aEdit )
|
||||
void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit )
|
||||
{
|
||||
wxLogTrace( "PNS", "DisplayItem %p", aItem );
|
||||
|
||||
ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( aItem, m_view );
|
||||
|
||||
if( aColor >= 0 )
|
||||
pitem->SetColor( KIGFX::COLOR4D( aColor ) );
|
||||
|
||||
if( aClearance >= 0 )
|
||||
{
|
||||
pitem->SetClearance( aClearance );
|
||||
|
|
|
@ -59,8 +59,7 @@ public:
|
|||
bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const override { return true; };
|
||||
bool IsItemVisible( const PNS::ITEM* aItem ) const override { return true; }
|
||||
void HideItem( PNS::ITEM* aItem ) override {}
|
||||
void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0,
|
||||
bool aEdit = false ) override {}
|
||||
void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false ) override {}
|
||||
void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aColor = -1 ) override {}
|
||||
void AddItem( PNS::ITEM* aItem ) override;
|
||||
void RemoveItem( PNS::ITEM* aItem ) override;
|
||||
|
@ -117,8 +116,7 @@ public:
|
|||
bool IsItemVisible( const PNS::ITEM* aItem ) const override;
|
||||
bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const override;
|
||||
void HideItem( PNS::ITEM* aItem ) override;
|
||||
void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0,
|
||||
bool aEdit = false ) override;
|
||||
void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false ) override;
|
||||
void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aColor = -1 ) override;
|
||||
void Commit() override;
|
||||
void AddItem( PNS::ITEM* aItem ) override;
|
||||
|
|
|
@ -294,16 +294,32 @@ void ROUTER::markViolations( NODE* aNode, ITEM_SET& aCurrent, NODE::ITEM_VECTOR&
|
|||
{
|
||||
std::unique_ptr<ITEM> tmp( itemToMark->Clone() );
|
||||
int clearance;
|
||||
bool removeOriginal = true;
|
||||
|
||||
if( itemToMark->Marker() & MK_HOLE )
|
||||
clearance = aNode->GetHoleClearance( currentItem, itemToMark );
|
||||
else
|
||||
clearance = aNode->GetClearance( currentItem, itemToMark );
|
||||
|
||||
m_iface->DisplayItem( tmp.get(), -1, clearance );
|
||||
if( itemToMark->Layers().IsMultilayer() && !currentItem->Layers().IsMultilayer() )
|
||||
itemToMark->SetLayer( currentItem->Layer() );
|
||||
|
||||
// Remove the obstacle itself from the view unless we're just marking its hole
|
||||
if( !(itemToMark->Marker() & MK_HOLE ) )
|
||||
if( itemToMark->Kind() == ITEM::SOLID_T )
|
||||
{
|
||||
if( ( itemToMark->Marker() & PNS::MK_HOLE )
|
||||
|| !m_iface->IsFlashedOnLayer( itemToMark, itemToMark->Layer() ) )
|
||||
{
|
||||
SOLID* solid = static_cast<SOLID*>( tmp.get() );
|
||||
solid->SetShape( solid->Hole()->Clone() );
|
||||
|
||||
// Leave the pad flashing around the highlighted hole
|
||||
removeOriginal = false;
|
||||
}
|
||||
}
|
||||
|
||||
m_iface->DisplayItem( tmp.get(), clearance );
|
||||
|
||||
if( removeOriginal )
|
||||
aRemoved.push_back( itemToMark );
|
||||
};
|
||||
|
||||
|
@ -358,7 +374,7 @@ void ROUTER::updateView( NODE* aNode, ITEM_SET& aCurrent, bool aDragging )
|
|||
for( ITEM* item : added )
|
||||
{
|
||||
int clearance = GetRuleResolver()->Clearance( item, nullptr );
|
||||
m_iface->DisplayItem( item, -1, clearance, aDragging );
|
||||
m_iface->DisplayItem( item, clearance, aDragging );
|
||||
}
|
||||
|
||||
for( ITEM* item : removed )
|
||||
|
@ -391,7 +407,7 @@ void ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem )
|
|||
const LINE* l = static_cast<const LINE*>( item );
|
||||
int clearance = GetRuleResolver()->Clearance( item, nullptr );
|
||||
|
||||
m_iface->DisplayItem( l, -1, clearance );
|
||||
m_iface->DisplayItem( l, clearance );
|
||||
|
||||
if( l->EndsWithVia() )
|
||||
{
|
||||
|
@ -402,7 +418,7 @@ void ROUTER::movePlacing( const VECTOR2I& aP, ITEM* aEndItem )
|
|||
if( holeClearance + via.Drill() / 2 > viaClearance + via.Diameter() / 2 )
|
||||
viaClearance = holeClearance + via.Drill() / 2 - via.Diameter() / 2;
|
||||
|
||||
m_iface->DisplayItem( &l->Via(), -1, viaClearance );
|
||||
m_iface->DisplayItem( &l->Via(), viaClearance );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -101,8 +101,7 @@ enum DRAG_MODE
|
|||
virtual bool IsAnyLayerVisible( const LAYER_RANGE& aLayer ) const = 0;
|
||||
virtual bool IsItemVisible( const PNS::ITEM* aItem ) const = 0;
|
||||
virtual bool IsFlashedOnLayer( const PNS::ITEM* aItem, int aLayer ) const = 0;
|
||||
virtual void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1,
|
||||
bool aEdit = false ) = 0;
|
||||
virtual void DisplayItem( const ITEM* aItem, int aClearance, bool aEdit = false ) = 0;
|
||||
virtual void DisplayRatline( const SHAPE_LINE_CHAIN& aRatline, int aColor = -1 ) = 0;
|
||||
virtual void HideItem( ITEM* aItem ) = 0;
|
||||
virtual void Commit() = 0;
|
||||
|
|
|
@ -42,7 +42,8 @@ ROUTER_PREVIEW_ITEM::ROUTER_PREVIEW_ITEM( const PNS::ITEM* aItem, KIGFX::VIEW* a
|
|||
{
|
||||
m_view = aView;
|
||||
|
||||
m_shape = NULL;
|
||||
m_shape = aItem ? aItem->Shape()->Clone() : nullptr;
|
||||
|
||||
m_clearance = -1;
|
||||
m_originLayer = m_layer = LAYER_SELECT_OVERLAY ;
|
||||
|
||||
|
@ -86,11 +87,6 @@ void ROUTER_PREVIEW_ITEM::Update( const PNS::ITEM* aItem )
|
|||
m_color.a = 0.8;
|
||||
m_depth = BaseOverlayDepth - aItem->Layers().Start();
|
||||
|
||||
if( ( aItem->Marker() & PNS::MK_HOLE ) && aItem->Kind() == PNS::ITEM::SOLID_T && aItem->Hole() )
|
||||
m_shape = aItem->Hole()->Clone();
|
||||
else
|
||||
m_shape = aItem->Shape()->Clone();
|
||||
|
||||
switch( aItem->Kind() )
|
||||
{
|
||||
case PNS::ITEM::LINE_T:
|
||||
|
|
|
@ -61,8 +61,6 @@ public:
|
|||
|
||||
void Update( const PNS::ITEM* aItem );
|
||||
|
||||
void StuckMarker( VECTOR2I& aPosition );
|
||||
|
||||
void Line( const SHAPE_LINE_CHAIN& aLine, int aWidth = 0, int aStyle = 0 );
|
||||
void Box( const BOX2I& aBox, int aStyle = 0 );
|
||||
void Point ( const VECTOR2I& aPos, int aStyle = 0);
|
||||
|
|
Loading…
Reference in New Issue