pcbnew: Show clearance when editing tracks
When requested by display options, we should show the track clearance
when dragging tracks.
Fixes: lp:1818343
* https://bugs.launchpad.net/kicad/+bug/1818343
(cherry picked from commit cf63ae7ae2
)
This commit is contained in:
parent
f5a2eb1ab0
commit
577b9f478b
|
@ -1092,7 +1092,7 @@ void PNS_KICAD_IFACE::EraseView()
|
|||
}
|
||||
|
||||
|
||||
void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aColor, int aClearance )
|
||||
void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aColor, int aClearance, bool aEdit )
|
||||
{
|
||||
wxLogTrace( "PNS", "DisplayItem %p", aItem );
|
||||
|
||||
|
@ -1107,10 +1107,28 @@ void PNS_KICAD_IFACE::DisplayItem( const PNS::ITEM* aItem, int aColor, int aClea
|
|||
|
||||
if( m_dispOptions )
|
||||
{
|
||||
auto clearanceDisp = m_dispOptions->m_ShowTrackClearanceMode;
|
||||
pitem->ShowTrackClearance( clearanceDisp != PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE );
|
||||
pitem->ShowViaClearance( clearanceDisp != PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE
|
||||
&& clearanceDisp != PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS );
|
||||
switch( m_dispOptions->m_ShowTrackClearanceMode )
|
||||
{
|
||||
case PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE:
|
||||
pitem->ShowTrackClearance( false );
|
||||
pitem->ShowViaClearance( false );
|
||||
break;
|
||||
case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_ALWAYS:
|
||||
case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS:
|
||||
pitem->ShowTrackClearance( true );
|
||||
pitem->ShowViaClearance( true );
|
||||
break;
|
||||
|
||||
case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS:
|
||||
pitem->ShowTrackClearance( !aEdit );
|
||||
pitem->ShowViaClearance( !aEdit );
|
||||
break;
|
||||
|
||||
case PCB_DISPLAY_OPTIONS::SHOW_CLEARANCE_NEW_TRACKS:
|
||||
pitem->ShowTrackClearance( !aEdit );
|
||||
pitem->ShowViaClearance( false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
void SyncWorld( PNS::NODE* aWorld ) override;
|
||||
void EraseView() override;
|
||||
void HideItem( PNS::ITEM* aItem ) override;
|
||||
void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0 ) override;
|
||||
void DisplayItem( const PNS::ITEM* aItem, int aColor = 0, int aClearance = 0, bool aEdit = false ) override;
|
||||
void AddItem( PNS::ITEM* aItem ) override;
|
||||
void RemoveItem( PNS::ITEM* aItem ) override;
|
||||
void Commit() override;
|
||||
|
|
|
@ -255,7 +255,7 @@ void ROUTER::moveDragging( const VECTOR2I& aP, ITEM* aEndItem )
|
|||
m_dragger->Drag( aP );
|
||||
ITEM_SET dragged = m_dragger->Traces();
|
||||
|
||||
updateView( m_dragger->CurrentNode(), dragged );
|
||||
updateView( m_dragger->CurrentNode(), dragged, true );
|
||||
}
|
||||
|
||||
|
||||
|
@ -290,7 +290,7 @@ void ROUTER::markViolations( NODE* aNode, ITEM_SET& aCurrent, NODE::ITEM_VECTOR&
|
|||
}
|
||||
|
||||
|
||||
void ROUTER::updateView( NODE* aNode, ITEM_SET& aCurrent )
|
||||
void ROUTER::updateView( NODE* aNode, ITEM_SET& aCurrent, bool aDragging )
|
||||
{
|
||||
NODE::ITEM_VECTOR removed, added;
|
||||
NODE::OBSTACLES obstacles;
|
||||
|
@ -304,7 +304,11 @@ void ROUTER::updateView( NODE* aNode, ITEM_SET& aCurrent )
|
|||
aNode->GetUpdatedItems( removed, added );
|
||||
|
||||
for( auto item : added )
|
||||
m_iface->DisplayItem( item );
|
||||
{
|
||||
int clearance = GetRuleResolver()->Clearance( item->Net() );
|
||||
|
||||
m_iface->DisplayItem( item, -1, clearance, aDragging );
|
||||
}
|
||||
|
||||
for( auto item : removed )
|
||||
m_iface->HideItem( item );
|
||||
|
|
|
@ -93,7 +93,7 @@ enum DRAG_MODE
|
|||
virtual void SyncWorld( NODE* aNode ) = 0;
|
||||
virtual void AddItem( ITEM* aItem ) = 0;
|
||||
virtual void RemoveItem( ITEM* aItem ) = 0;
|
||||
virtual void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1 ) = 0;
|
||||
virtual void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1, bool aEdit = false ) = 0;
|
||||
virtual void HideItem( ITEM* aItem ) = 0;
|
||||
virtual void Commit() = 0;
|
||||
// virtual void Abort () = 0;
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
|
||||
void FlipPosture();
|
||||
|
||||
void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1 );
|
||||
void DisplayItem( const ITEM* aItem, int aColor = -1, int aClearance = -1, bool aEdit = false );
|
||||
void DisplayItems( const ITEM_SET& aItems );
|
||||
void DeleteTraces( ITEM* aStartItem, bool aWholeTrack );
|
||||
void SwitchLayer( int layer );
|
||||
|
@ -225,7 +225,7 @@ private:
|
|||
void moveDragging( const VECTOR2I& aP, ITEM* aItem );
|
||||
|
||||
void eraseView();
|
||||
void updateView( NODE* aNode, ITEM_SET& aCurrent );
|
||||
void updateView( NODE* aNode, ITEM_SET& aCurrent, bool aDragging = false );
|
||||
|
||||
void clearViewFlags();
|
||||
|
||||
|
|
Loading…
Reference in New Issue