TRACK::GetBoundingBox() revised for when track clearance is displayed
This commit is contained in:
parent
1bb2da51cb
commit
6153dadc07
|
@ -26,6 +26,7 @@ email address.
|
|||
PostDirtyRect().
|
||||
* void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* Track ) now redraws
|
||||
the screen after a net deletion.
|
||||
* eeschema/dialog_find.cpp: set the initial keyboard focus to the text control
|
||||
|
||||
|
||||
2008-Mar-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
|
|
|
@ -42,6 +42,20 @@ void DbgDisplayTrackInfos( TRACK* track )
|
|||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Function ShowClearance
|
||||
* tests to see if the clearance border is drawn on the given track.
|
||||
* @return bool - true if should draw clearance, else false.
|
||||
*/
|
||||
static bool ShowClearance( const TRACK* aTrack )
|
||||
{
|
||||
// maybe return true for (for tracks and vias, not for zone segments
|
||||
return ( DisplayOpt.DisplayTrackIsol && ( aTrack->GetLayer() <= LAST_COPPER_LAYER )
|
||||
&& ( aTrack->Type() == TYPETRACK || aTrack->Type() == TYPEVIA) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
TRACK::TRACK( BOARD_ITEM* StructFather, KICAD_T idtype ) :
|
||||
BOARD_ITEM( StructFather, idtype )
|
||||
|
@ -242,6 +256,12 @@ EDA_Rect TRACK::GetBoundingBox() const
|
|||
xmin = MIN( m_Start.x, m_End.x );
|
||||
}
|
||||
|
||||
if( ShowClearance( this ) )
|
||||
{
|
||||
// + 1 is for the clearance line itself.
|
||||
radius += g_DesignSettings.m_TrackClearence + 1;
|
||||
}
|
||||
|
||||
ymax += radius;
|
||||
xmax += radius;
|
||||
|
||||
|
@ -249,7 +269,9 @@ EDA_Rect TRACK::GetBoundingBox() const
|
|||
xmin -= radius;
|
||||
|
||||
// return a rectangle which is [pos,dim) in nature. therefore the +1
|
||||
return EDA_Rect( wxPoint( xmin, ymin ), wxSize( xmax-xmin+1, ymax-ymin+1 ) );
|
||||
EDA_Rect ret( wxPoint( xmin, ymin ), wxSize( xmax-xmin+1, ymax-ymin+1 ) );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -783,8 +805,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
|
|||
}
|
||||
|
||||
/* Shows clearance (for tracks and vias, not for zone segments */
|
||||
if( DisplayOpt.DisplayTrackIsol && ( m_Layer <= LAST_COPPER_LAYER )
|
||||
&& ( Type() == TYPETRACK || Type() == TYPEVIA) )
|
||||
if( ShowClearance( this ) )
|
||||
{
|
||||
GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
|
||||
m_End.x, m_End.y,
|
||||
|
|
|
@ -168,14 +168,9 @@ void WinEDA_PcbFrame::Delete_net( wxDC* DC, TRACK* Track )
|
|||
if( segm->GetNet() != net_code_delete )
|
||||
break;
|
||||
|
||||
// This works ok, but sometimes leaves stuff on screen. I think
|
||||
// the erase rectangle is not large enough always.
|
||||
// DrawPanel->PostDirtyRect( segm->GetBoundingBox() );
|
||||
DrawPanel->PostDirtyRect( segm->GetBoundingBox() );
|
||||
}
|
||||
|
||||
// Do this instead of PostDirtyRect() for now
|
||||
DrawPanel->Refresh( TRUE );
|
||||
|
||||
SaveItemEfface( trackList, ii );
|
||||
GetScreen()->SetModify();
|
||||
test_1_net_connexion( DC, net_code_delete );
|
||||
|
|
|
@ -274,8 +274,9 @@ void WinEDA_DrawPanel::PostDirtyRect( EDA_Rect aRect )
|
|||
// Ensure the rectangle is large enough after truncations.
|
||||
// The pcb units have finer granularity than the pixels, so it can happen
|
||||
// that the rectangle is not large enough for the erase portion.
|
||||
aRect.m_Size.x += 1;
|
||||
aRect.m_Size.y += 1;
|
||||
|
||||
aRect.m_Size.x += 2; // += 1 is not enough!
|
||||
aRect.m_Size.y += 2;
|
||||
|
||||
// pass wxRect() via EDA_Rect::operator wxRect() overload
|
||||
RefreshRect( aRect, TRUE );
|
||||
|
|
Loading…
Reference in New Issue