Commit 3668f4cc authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: cleanup functions: now, cleanup uses same algorithm as connectivity...

Pcbnew: cleanup functions: now, cleanup uses same algorithm as connectivity calculations to detect pads connections, and is faster.
therefore tracks which have a end point inside a pad, but not necessaryexactly  to the pad position are seen as connected, and are no more removed.
Side effect: reconnect to pads option is removed, because it is useless.
TODO: use this algorithm in drag functions.
Minor other fixes
parent 5aec4604
...@@ -55,6 +55,13 @@ ...@@ -55,6 +55,13 @@
double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR; double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR;
/* Helper function for texts with over bar
*/
int OverbarPositionY( int size_v, int thickness )
{
return KiROUND( ( (double) size_v * 1.1 ) + ( (double) thickness * 1.5 ) );
}
/** /**
* Function GetPensizeForBold * Function GetPensizeForBold
* @return the "best" value for a pen size to draw/plot a bold text * @return the "best" value for a pen size to draw/plot a bold text
...@@ -68,7 +75,7 @@ int GetPenSizeForBold( int aTextSize ) ...@@ -68,7 +75,7 @@ int GetPenSizeForBold( int aTextSize )
/** /**
* Function Clamp_Text_PenSize * Function Clamp_Text_PenSize
*As a rule, pen width should not be >1/4em, otherwise the character * As a rule, pen width should not be >1/4em, otherwise the character
* will be cluttered up in its own fatness * will be cluttered up in its own fatness
* so pen width max is aSize/4 for bold text, and aSize/6 for normal text * so pen width max is aSize/4 for bold text, and aSize/6 for normal text
* The "best" pen width is aSize/5 for bold texts, * The "best" pen width is aSize/5 for bold texts,
...@@ -219,14 +226,6 @@ static void DrawGraphicTextPline( ...@@ -219,14 +226,6 @@ static void DrawGraphicTextPline(
} }
/* Helper function for texts with over bar
*/
static int overbar_position( int size_v, int thickness )
{
return KiROUND( ( (double) size_v * 26 * s_HerscheyScaleFactor ) + ( (double) thickness * 1.5 ) );
}
/** /**
* Function DrawGraphicText * Function DrawGraphicText
* Draw a graphic text (like module texts) * Draw a graphic text (like module texts)
...@@ -271,7 +270,6 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -271,7 +270,6 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
int dx, dy; // Draw coordinate for segments to draw. also used in some other calculation int dx, dy; // Draw coordinate for segments to draw. also used in some other calculation
wxPoint current_char_pos; // Draw coordinates for the current char wxPoint current_char_pos; // Draw coordinates for the current char
wxPoint overbar_pos; // Start point for the current overbar wxPoint overbar_pos; // Start point for the current overbar
int overbars; // Number of ~ seen
int overbar_italic_comp; // Italic compensation for overbar int overbar_italic_comp; // Italic compensation for overbar
EDA_RECT* clipBox; // Clip box used in basic draw functions EDA_RECT* clipBox; // Clip box used in basic draw functions
...@@ -400,7 +398,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -400,7 +398,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
if( aItalic ) if( aItalic )
{ {
overbar_italic_comp = overbar_position( size_v, aWidth ) / 8; overbar_italic_comp = OverbarPositionY( size_v, aWidth ) / 8;
if( italic_reverse ) if( italic_reverse )
{ {
overbar_italic_comp = -overbar_italic_comp; overbar_italic_comp = -overbar_italic_comp;
...@@ -411,7 +409,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -411,7 +409,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
overbar_italic_comp = 0; overbar_italic_comp = 0;
}; };
overbars = 0; int overbars = 0; // Number of ~ seen
ptr = 0; /* ptr = text index */ ptr = 0; /* ptr = text index */
while( ptr < char_count ) while( ptr < char_count )
{ {
...@@ -420,12 +418,12 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -420,12 +418,12 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
/* Found an overbar, adjust the pointers */ /* Found an overbar, adjust the pointers */
overbars++; overbars++;
if( overbars % 2 ) if( overbars & 1 ) // odd overbars count
{ {
/* Starting the overbar */ /* Starting the overbar */
overbar_pos = current_char_pos; overbar_pos = current_char_pos;
overbar_pos.x += overbar_italic_comp; overbar_pos.x += overbar_italic_comp;
overbar_pos.y -= overbar_position( size_v, aWidth ); overbar_pos.y -= OverbarPositionY( size_v, aWidth );
RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient );
} }
else else
...@@ -434,7 +432,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -434,7 +432,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
coord[0] = overbar_pos; coord[0] = overbar_pos;
overbar_pos = current_char_pos; overbar_pos = current_char_pos;
overbar_pos.x += overbar_italic_comp; overbar_pos.x += overbar_italic_comp;
overbar_pos.y -= overbar_position( size_v, aWidth ); overbar_pos.y -= OverbarPositionY( size_v, aWidth );
RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient );
coord[1] = overbar_pos; coord[1] = overbar_pos;
/* Plot the overbar segment */ /* Plot the overbar segment */
...@@ -516,7 +514,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -516,7 +514,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
/* Close the last overbar */ /* Close the last overbar */
coord[0] = overbar_pos; coord[0] = overbar_pos;
overbar_pos = current_char_pos; overbar_pos = current_char_pos;
overbar_pos.y -= overbar_position( size_v, aWidth ); overbar_pos.y -= OverbarPositionY( size_v, aWidth );
RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient );
coord[1] = overbar_pos; coord[1] = overbar_pos;
/* Plot the overbar segment */ /* Plot the overbar segment */
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
extern void IncrementLabelMember( wxString& name ); extern void IncrementLabelMember( wxString& name );
extern int OverbarPositionY( int size_v, int thickness );
/* Names of sheet label types. */ /* Names of sheet label types. */
...@@ -273,19 +274,19 @@ void SCH_TEXT::Rotate( wxPoint aPosition ) ...@@ -273,19 +274,19 @@ void SCH_TEXT::Rotate( wxPoint aPosition )
switch( GetOrientation() ) switch( GetOrientation() )
{ {
case 0: /* horizontal text */ case 0: // horizontal text
dy = m_Size.y; dy = m_Size.y;
break; break;
case 1: /* Vert Orientation UP */ case 1: // Vert Orientation UP
dy = 0; dy = 0;
break; break;
case 2: /* invert horizontal text*/ case 2: // invert horizontal text
dy = m_Size.y; dy = m_Size.y;
break; break;
case 3: /* Vert Orientation BOTTOM */ case 3: // Vert Orientation BOTTOM
dy = 0; dy = 0;
break; break;
...@@ -1241,8 +1242,14 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const ...@@ -1241,8 +1242,14 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
// Create outline shape : 6 points // Create outline shape : 6 points
int x = symb_len + linewidth + 3; int x = symb_len + linewidth + 3;
// 50% more for negation bar // Use negation bar Y position to calculate full vertical size
int y = KiROUND( (double) HalfSize * 1.5 + (double) linewidth + 3.0 ); #define Y_CORRECTION 1.22
// Note: this factor is due to the fact the negation bar Y position
// does not give exactly the full Y size of text
// and is experimentally set to this value
int y = KiROUND( OverbarPositionY( HalfSize, linewidth ) * Y_CORRECTION );
// add room for line thickness and space between top of text and graphic shape
y += linewidth;
// Starting point(anchor) // Starting point(anchor)
aPoints.push_back( wxPoint( 0, 0 ) ); aPoints.push_back( wxPoint( 0, 0 ) );
......
...@@ -36,37 +36,98 @@ ...@@ -36,37 +36,98 @@
#include <pcbnew.h> #include <pcbnew.h>
#include <class_board.h> #include <class_board.h>
#include <class_track.h> #include <class_track.h>
#include <connect.h>
#include <dialog_cleaning_options.h>
// local functions : // Helper class used to clean tracks and vias
static void clean_segments( PCB_EDIT_FRAME* aFrame ); class TRACKS_CLEANER: CONNECTIONS
static void clean_vias( BOARD* aPcb ); {
static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame ); private:
static TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, BOARD * m_Brd;
TRACK* aCandidate, int aEndType ); bool m_deleteUnconnectedTracks;
static void CleanupTracks( PCB_EDIT_FRAME* aFrame, bool m_mergeSegments;
bool aCleanVias, bool aMergeSegments, bool m_cleanVias;
bool aDeleteUnconnectedSegm, bool aConnectToPads );
public:
TRACKS_CLEANER( BOARD * aPcb );
/**
* the cleanup function.
* return true if some item was modified
*/
bool CleanupBoard();
#include <dialog_cleaning_options.h> void SetdeleteUnconnectedTracksOpt( bool aDelete )
{
m_deleteUnconnectedTracks = aDelete;
}
void SetMergeSegmentsOpt( bool aMerge )
{
m_mergeSegments = aMerge;
}
#define CONN2PAD_ENBL void SetCleanViasOpt( bool aClean )
{
m_cleanVias = aClean;
}
#ifdef CONN2PAD_ENBL private:
static void ConnectDanglingEndToPad( PCB_EDIT_FRAME* frame );
static void ConnectDanglingEndToVia( BOARD* pcb );
#endif
/**
* Removes redundant vias like vias at same location
* or on pad through
*/
bool clean_vias();
/**
* Removes dangling tracks
*/
bool deleteUnconnectedTracks();
/**
* Merge colinear segments and remove null len segments
*/
bool clean_segments();
/**
* helper function
* Rebuild list of tracks, and connected tracks
* this info must be rebuilt when tracks are erased
*/
void buildTrackConnectionInfo();
/**
* helper function
* merge aTrackRef and aCandidate, when possible,
* i.e. when they are colinear, same width, and obviously same layer
*/
TRACK* mergeColinearSegmentIfPossible( TRACK* aTrackRef,
TRACK* aCandidate, int aEndType );
};
/* Install the track operation dialog frame /* Install the track operation dialog frame
*/ */
void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC ) void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC )
{ {
DIALOG_CLEANING_OPTIONS::connectToPads = false;
DIALOG_CLEANING_OPTIONS dlg( this ); DIALOG_CLEANING_OPTIONS dlg( this );
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
CleanupTracks( this, dlg.cleanVias, dlg.mergeSegments, {
dlg.deleteUnconnectedSegm, dlg.connectToPads ); wxBusyCursor( dummy );
TRACKS_CLEANER cleaner( GetBoard() );
cleaner.SetdeleteUnconnectedTracksOpt( dlg.deleteUnconnectedSegm );
cleaner.SetMergeSegmentsOpt( dlg.mergeSegments );
cleaner.SetCleanViasOpt( dlg.cleanVias );
if( cleaner.CleanupBoard() )
{
// Clear undo and redo lists to avoid inconsistencies between lists
GetScreen()->ClearUndoRedoList();
SetCurItem( NULL );
Compile_Ratsnest( NULL, true );
OnModify();
}
}
m_canvas->Refresh( true ); m_canvas->Refresh( true );
} }
...@@ -80,73 +141,87 @@ void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC ) ...@@ -80,73 +141,87 @@ void PCB_EDIT_FRAME::Clean_Pcb( wxDC* DC )
* Create segments when track ends are incorrectly connected: * Create segments when track ends are incorrectly connected:
* i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center * i.e. when a track end covers a pad or a via but is not exactly on the pad or the via center
*/ */
void CleanupTracks( PCB_EDIT_FRAME* aFrame, bool TRACKS_CLEANER::CleanupBoard()
bool aCleanVias, bool aMergeSegments,
bool aDeleteUnconnectedSegm, bool aConnectToPads )
{ {
wxBusyCursor( dummy ); bool modified = false;
aFrame->ClearMsgPanel(); // delete redundant vias
aFrame->GetBoard()->GetNumSegmTrack(); // update the count if( m_cleanVias && clean_vias() )
modified = true;
// Clear undo and redo lists to avoid inconsistencies between lists // Remove null segments and intermediate points on aligned segments
aFrame->GetScreen()->ClearUndoRedoList(); if( m_mergeSegments && clean_segments() )
aFrame->SetCurItem( NULL ); modified = true;
// Rebuild the pad infos (pad list and netcodes) to ensure an up to date info // Delete dangling tracks
aFrame->GetBoard()->m_Status_Pcb = 0; if( m_deleteUnconnectedTracks && deleteUnconnectedTracks() )
aFrame->GetBoard()->BuildListOfNets(); modified = true;
if( aCleanVias ) // delete redundant vias return modified;
{ }
aFrame->SetStatusText( _( "Clean vias" ) );
clean_vias( aFrame->GetBoard() );
}
#ifdef CONN2PAD_ENBL TRACKS_CLEANER::TRACKS_CLEANER( BOARD * aPcb ): CONNECTIONS( aPcb )
/* Create missing segments when a track end covers a pad or a via, {
* but is not on the pad or the via center */ m_Brd = aPcb;
if( aConnectToPads ) m_deleteUnconnectedTracks = false;
{ m_mergeSegments = false;
aFrame->SetStatusText( _( "Reconnect pads" ) );
// Create missing segments when a track end covers a pad, but is not on the pad center // Build connections info
ConnectDanglingEndToPad( aFrame ); BuildPadsList();
buildTrackConnectionInfo();
}
// Create missing segments when a track end covers a via, but is not on the via center void TRACKS_CLEANER::buildTrackConnectionInfo()
ConnectDanglingEndToVia( aFrame->GetBoard() ); {
} BuildTracksCandidatesList( m_Brd->m_Track, NULL);
#endif
// Remove null segments and intermediate points on aligned segments // clear flags and variables used in cleanup
if( aMergeSegments ) for( TRACK * track = m_Brd->m_Track; track; track = track->Next() )
{ {
aFrame->SetStatusText( _( "Merge track segments" ) ); track->start = NULL;
clean_segments( aFrame ); track->end = NULL;
track->m_PadsConnected.clear();
track->SetState( START_ON_PAD|END_ON_PAD|BUSY, OFF );
} }
// Delete dangling tracks // Build connections info tracks to pads
if( aDeleteUnconnectedSegm ) SearchTracksConnectedToPads();
for( TRACK * track = m_Brd->m_Track; track; track = track->Next() )
{ {
aFrame->SetStatusText( _( "Delete unconnected tracks" ) ); // Mark track if connected to pads
DeleteUnconnectedTracks( aFrame ); for( unsigned jj = 0; jj < track->m_PadsConnected.size(); jj++ )
} {
D_PAD * pad = track->m_PadsConnected[jj];
aFrame->SetStatusText( _( "Cleanup finished" ) );
aFrame->Compile_Ratsnest( NULL, true ); if( pad->HitTest( track->GetStart() ) )
{
track->start = pad;
track->SetState( START_ON_PAD, ON );
}
aFrame->OnModify(); if( pad->HitTest( track->GetEnd() ) )
{
track->end = pad;
track->SetState( END_ON_PAD, ON );
}
}
}
} }
bool TRACKS_CLEANER::clean_vias()
void clean_vias( BOARD * aPcb )
{ {
TRACK* track;
TRACK* next_track; TRACK* next_track;
bool modified = false;
for( track = aPcb->m_Track; track; track = track->Next() ) for( TRACK* track = m_Brd->m_Track; track; track = track->Next() )
{ {
// Correct via m_End defects (if any)
if( track->Type() == PCB_VIA_T )
{
if( track->m_Start != track->m_End )
track->m_End = track->m_Start;
}
if( track->GetShape() != VIA_THROUGH ) if( track->GetShape() != VIA_THROUGH )
continue; continue;
...@@ -166,26 +241,36 @@ void clean_vias( BOARD * aPcb ) ...@@ -166,26 +241,36 @@ void clean_vias( BOARD * aPcb )
// delete via // delete via
alt_track->UnLink(); alt_track->UnLink();
delete alt_track; delete alt_track;
modified = true;
} }
} }
// Delete Via on pads at same location // Delete Via on pads at same location
for( track = aPcb->m_Track; track != NULL; track = next_track ) for( TRACK* track = m_Brd->m_Track; track != NULL; track = next_track )
{ {
next_track = track->Next(); next_track = track->Next();
if( track->m_Shape != VIA_THROUGH ) if( track->m_Shape != VIA_THROUGH )
continue; continue;
D_PAD* pad = aPcb->GetPadFast( track->m_Start, ALL_CU_LAYERS ); // Examine the list of connected pads:
// if one pad through is found, the via can be removed
if( pad && (pad->GetLayerMask() & EXTERNAL_LAYERS) == EXTERNAL_LAYERS ) // redundant Via for( unsigned ii = 0; ii < track->m_PadsConnected.size(); ii++ )
{ {
// delete via D_PAD * pad = track->m_PadsConnected[ii];
track->UnLink();
delete track; if( (pad->GetLayerMask() & ALL_CU_LAYERS) == ALL_CU_LAYERS )
{
// redundant: via delete it
track->UnLink();
delete track;
modified = true;
break;
}
} }
} }
return modified;
} }
...@@ -194,245 +279,189 @@ void clean_vias( BOARD * aPcb ) ...@@ -194,245 +279,189 @@ void clean_vias( BOARD * aPcb )
* Vias: * Vias:
* If a via is only connected to a dangling track, it also will be removed * If a via is only connected to a dangling track, it also will be removed
*/ */
static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame ) bool TRACKS_CLEANER::deleteUnconnectedTracks()
{ {
TRACK* segment; if( m_Brd->m_Track == NULL )
TRACK* other; return false;
TRACK* startNetcode;
TRACK* next;
ZONE_CONTAINER* zone;
int masklayer, oldnetcode;
int type_end, flag_erase;
if( aFrame->GetBoard()->m_Track == NULL )
return;
aFrame->GetCanvas()->SetAbortRequest( false ); bool modified = false;
bool item_erased = true;
// correct via m_End defects while( item_erased ) // Iterate when at least one track is deleted
for( segment = aFrame->GetBoard()->m_Track; segment; segment = next )
{ {
next = segment->Next(); item_erased = false;
TRACK* next_track;
if( segment->Type() == PCB_VIA_T ) for( TRACK * track = m_Brd->m_Track; track ; track = next_track )
{ {
if( segment->m_Start != segment->m_End ) next_track = track->Next();
segment->m_End = segment->m_Start;
continue; int flag_erase = 0; //Not connected indicator
} int type_end = 0;
}
// removal of unconnected tracks if( track->GetState( START_ON_PAD ) )
segment = startNetcode = aFrame->GetBoard()->m_Track; type_end |= START_ON_PAD;
oldnetcode = segment->GetNet();
for( int ii = 0; segment ; segment = next, ii++ ) if( track->GetState( END_ON_PAD ) )
{ type_end |= END_ON_PAD;
next = segment->Next();
if( aFrame->GetCanvas()->GetAbortRequest() ) // if the track start point is not connected to a pad,
break; // test if this track start point is connected to another track
// For via test, an enhancement could be to test if connected
// to 2 items on different layers.
// Currently a via must be connected to 2 items, that can be on the same layer
int top_layer, bottom_layer;
ZONE_CONTAINER* zone;
if( segment->GetNet() != oldnetcode ) if( (type_end & START_ON_PAD ) == 0 )
{ {
startNetcode = segment; TRACK* other = track->GetTrace( m_Brd->m_Track, NULL, FLG_START );
oldnetcode = segment->GetNet();
}
flag_erase = 0; //Not connected indicator
type_end = 0;
// Is a pad found on a track end ?
masklayer = segment->ReturnMaskLayer();
D_PAD* pad;
pad = aFrame->GetBoard()->GetPadFast( segment->m_Start, masklayer ); if( other == NULL ) // Test a connection to zones
{
if( track->Type() != PCB_VIA_T )
{
zone = m_Brd->HitTestForAnyFilledArea( track->m_Start,
track->GetLayer() );
}
else
{
((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->m_Start,
top_layer, bottom_layer );
}
}
if( pad != NULL ) if( (other == NULL) && (zone == NULL) )
{ {
segment->start = pad; flag_erase |= 1;
type_end |= START_ON_PAD; }
} else // segment, via or zone connected to this end
{
track->start = other;
// If a via is connected to this end,
// test if this via has a second item connected.
// If no, remove it with the current segment
pad = aFrame->GetBoard()->GetPadFast( segment->m_End, masklayer ); if( other && other->Type() == PCB_VIA_T )
{
// search for another segment following the via
track->SetState( BUSY, ON );
if( pad != NULL ) SEGVIA* via = (SEGVIA*) other;
{ other = via->GetTrace( m_Brd->m_Track, NULL, FLG_START );
segment->end = pad;
type_end |= END_ON_PAD;
}
// if not connected to a pad, test if segment's START is connected to another track if( other == NULL )
// For via tests, an enhancement could to test if connected to 2 items on different layers. {
// Currently a via must be connected to 2 items, that can be on the same layer via->ReturnLayerPair( &top_layer, &bottom_layer );
int top_layer, bottom_layer; zone = m_Brd->HitTestForAnyFilledArea( via->m_Start,
bottom_layer, top_layer );
}
if( (type_end & START_ON_PAD ) == 0 ) if( (other == NULL) && (zone == NULL) )
{ flag_erase |= 2;
other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, FLG_START );
if( other == NULL ) // Test a connection to zones track->SetState( BUSY, OFF );
{ }
if( segment->Type() != PCB_VIA_T )
{
zone = aFrame->GetBoard()->HitTestForAnyFilledArea( segment->m_Start,
segment->GetLayer() );
}
else
{
((SEGVIA*)segment)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = aFrame->GetBoard()->HitTestForAnyFilledArea( segment->m_Start,
top_layer, bottom_layer );
} }
} }
if( (other == NULL) && (zone == NULL) ) // if track end point is not connected to a pad,
{ // test if this track end point is connected to an other track
flag_erase |= 1; if( (type_end & END_ON_PAD ) == 0 )
}
else // segment, via or zone connected to this end
{ {
segment->start = other; TRACK* other = track->GetTrace( m_Brd->m_Track, NULL, FLG_END );
// If a via is connected to this end, test if this via has a second item connected
// if no, remove it with the current segment
if( other && other->Type() == PCB_VIA_T ) if( other == NULL ) // Test a connection to zones
{ {
// search for another segment following the via if( track->Type() != PCB_VIA_T )
segment->SetState( BUSY, ON );
SEGVIA* via = (SEGVIA*) other;
other = via->GetTrace( aFrame->GetBoard()->m_Track, NULL, FLG_START );
if( other == NULL )
{ {
via->ReturnLayerPair( &top_layer, &bottom_layer ); zone = m_Brd->HitTestForAnyFilledArea( track->m_End,
zone = aFrame->GetBoard()->HitTestForAnyFilledArea( via->m_Start, track->GetLayer() );
bottom_layer, }
top_layer ); else
{
((SEGVIA*)track)->ReturnLayerPair( &top_layer, &bottom_layer );
zone = m_Brd->HitTestForAnyFilledArea( track->m_End,
top_layer, bottom_layer );
} }
if( (other == NULL) && (zone == NULL) )
flag_erase |= 2;
segment->SetState( BUSY, OFF );
} }
}
}
// if not connected to a pad, test if segment's END is connected to another track if ( (other == NULL) && (zone == NULL) )
if( (type_end & END_ON_PAD ) == 0 )
{
other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, FLG_END );
if( other == NULL ) // Test a connection to zones
{
if( segment->Type() != PCB_VIA_T )
{ {
zone = aFrame->GetBoard()->HitTestForAnyFilledArea( segment->m_End, flag_erase |= 0x10;
segment->GetLayer() );
} }
else else // segment, via or zone connected to this end
{ {
((SEGVIA*)segment)->ReturnLayerPair( &top_layer, &bottom_layer ); track->end = other;
zone = aFrame->GetBoard()->HitTestForAnyFilledArea( segment->m_End,
top_layer, bottom_layer );
}
}
if ( (other == NULL) && (zone == NULL) )
{
flag_erase |= 0x10;
}
else // segment, via or zone connected to this end
{
segment->end = other;
// If a via is connected to this end, test if this via has a second item connected // If a via is connected to this end, test if this via has a second item connected
// if no, remove it with the current segment // if no, remove it with the current segment
if( other && other->Type() == PCB_VIA_T ) if( other && other->Type() == PCB_VIA_T )
{ {
// search for another segment following the via // search for another segment following the via
segment->SetState( BUSY, ON ); track->SetState( BUSY, ON );
SEGVIA* via = (SEGVIA*) other; SEGVIA* via = (SEGVIA*) other;
other = via->GetTrace( aFrame->GetBoard()->m_Track, NULL, FLG_END ); other = via->GetTrace( m_Brd->m_Track, NULL, FLG_END );
if( other == NULL ) if( other == NULL )
{ {
via->ReturnLayerPair( &top_layer, &bottom_layer ); via->ReturnLayerPair( &top_layer, &bottom_layer );
zone = aFrame->GetBoard()->HitTestForAnyFilledArea( via->m_End, zone = m_Brd->HitTestForAnyFilledArea( via->m_End,
bottom_layer, bottom_layer, top_layer );
top_layer ); }
}
if( (other == NULL) && (zone == NULL) ) if( (other == NULL) && (zone == NULL) )
flag_erase |= 0x20; flag_erase |= 0x20;
segment->SetState( BUSY, OFF ); track->SetState( BUSY, OFF );
}
} }
} }
}
if( flag_erase ) if( flag_erase )
{
// update the pointer to start of the contiguous netcode group
if( segment == startNetcode )
{
next = segment->Next();
startNetcode = next;
}
else
{ {
next = startNetcode; // remove segment from board
track->DeleteStructure();
// iterate, because a track connected to the deleted track
// is now perhaps now not connected and should be deleted
item_erased = true;
modified = true;
} }
// remove segment from board
segment->DeleteStructure();
if( next == NULL )
break;
} }
} }
return modified;
} }
// Delete null length segments, and intermediate points .. // Delete null length segments, and intermediate points ..
static void clean_segments( PCB_EDIT_FRAME* aFrame ) bool TRACKS_CLEANER::clean_segments()
{ {
bool modified = false;
TRACK* segment, * nextsegment; TRACK* segment, * nextsegment;
TRACK* other; TRACK* other;
int ii;
int flag, no_inc; int flag, no_inc;
wxString msg;
aFrame->GetCanvas()->SetAbortRequest( false );
// Delete null segments // Delete null segments
for( segment = aFrame->GetBoard()->m_Track; segment; segment = nextsegment ) for( segment = m_Brd->m_Track; segment; segment = nextsegment )
{ {
nextsegment = segment->Next(); nextsegment = segment->Next();
if( !segment->IsNull() ) if( segment->IsNull() ) // Length segment = 0; delete it
continue; segment->DeleteStructure();
// Length segment = 0; delete it
segment->DeleteStructure();
} }
// Delete redundant segments // Delete redundant segments, i.e. segments having the same end points
for( segment = aFrame->GetBoard()->m_Track, ii = 0; segment; segment = segment->Next(), ii++ ) // and layers
for( segment = m_Brd->m_Track; segment; segment = segment->Next() )
{ {
for( other = segment->Next(); other; other = nextsegment ) for( other = segment->Next(); other; other = nextsegment )
{ {
nextsegment = other->Next(); nextsegment = other->Next();
int erase = 0; bool erase = false;
if( segment->Type() != other->Type() ) if( segment->Type() != other->Type() )
continue; continue;
...@@ -443,31 +472,25 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -443,31 +472,25 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if( segment->GetNet() != other->GetNet() ) if( segment->GetNet() != other->GetNet() )
break; break;
if( segment->m_Start == other->m_Start ) if( ( segment->m_Start == other->m_Start ) &&
{ ( segment->m_End == other->m_End ) )
if( segment->m_End == other->m_End ) erase = true;
erase = 1;
}
if( segment->m_Start == other->m_End ) if( ( segment->m_Start == other->m_End ) &&
{ ( segment->m_End == other->m_Start ) )
if( segment->m_End == other->m_Start ) erase = true;
erase = 1;
}
// Delete redundant point // Delete redundant point
if( erase ) if( erase )
{ {
ii--;
other->DeleteStructure(); other->DeleteStructure();
modified = true;
} }
} }
} }
// delete intermediate points // delete intermediate points (merging colinear segments)
ii = 0; for( segment = m_Brd->m_Track; segment; segment = nextsegment )
for( segment = aFrame->GetBoard()->m_Track; segment; segment = nextsegment )
{ {
TRACK* segStart; TRACK* segStart;
TRACK* segEnd; TRACK* segEnd;
...@@ -475,15 +498,12 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -475,15 +498,12 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
nextsegment = segment->Next(); nextsegment = segment->Next();
if( aFrame->GetCanvas()->GetAbortRequest() )
return;
if( segment->Type() != PCB_TRACE_T ) if( segment->Type() != PCB_TRACE_T )
continue; continue;
flag = no_inc = 0; flag = no_inc = 0;
// search for a possible point that connects on the START point of the segment // search for a possible point connected to the START point of the current segment
for( segStart = segment->Next(); ; ) for( segStart = segment->Next(); ; )
{ {
segStart = segment->GetTrace( segStart, NULL, FLG_START ); segStart = segment->GetTrace( segStart, NULL, FLG_START );
...@@ -500,7 +520,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -500,7 +520,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
// We must have only one segment connected // We must have only one segment connected
segStart->SetState( BUSY, ON ); segStart->SetState( BUSY, ON );
other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, FLG_START ); other = segment->GetTrace( m_Brd->m_Track, NULL, FLG_START );
segStart->SetState( BUSY, OFF ); segStart->SetState( BUSY, OFF );
if( other == NULL ) if( other == NULL )
...@@ -513,17 +533,17 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -513,17 +533,17 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if( flag ) // We have the starting point of the segment is connected to an other segment if( flag ) // We have the starting point of the segment is connected to an other segment
{ {
segDelete = MergeColinearSegmentIfPossible( aFrame->GetBoard(), segment, segStart, segDelete = mergeColinearSegmentIfPossible( segment, segStart, FLG_START );
FLG_START );
if( segDelete ) if( segDelete )
{ {
no_inc = 1; no_inc = 1;
segDelete->DeleteStructure(); segDelete->DeleteStructure();
modified = true;
} }
} }
// search for a possible point that connects on the END point of the segment: // search for a possible point connected to the END point of the current segment:
for( segEnd = segment->Next(); ; ) for( segEnd = segment->Next(); ; )
{ {
segEnd = segment->GetTrace( segEnd, NULL, FLG_END ); segEnd = segment->GetTrace( segEnd, NULL, FLG_END );
...@@ -538,7 +558,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -538,7 +558,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
// We must have only one segment connected // We must have only one segment connected
segEnd->SetState( BUSY, ON ); segEnd->SetState( BUSY, ON );
other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, FLG_END ); other = segment->GetTrace( m_Brd->m_Track, NULL, FLG_END );
segEnd->SetState( BUSY, OFF ); segEnd->SetState( BUSY, OFF );
if( other == NULL ) if( other == NULL )
...@@ -554,13 +574,13 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -554,13 +574,13 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if( flag & 2 ) // We have the ending point of the segment is connected to an other segment if( flag & 2 ) // We have the ending point of the segment is connected to an other segment
{ {
segDelete = MergeColinearSegmentIfPossible( aFrame->GetBoard(), segDelete = mergeColinearSegmentIfPossible( segment, segEnd, FLG_END );
segment, segEnd, FLG_END );
if( segDelete ) if( segDelete )
{ {
no_inc = 1; no_inc = 1;
segDelete->DeleteStructure(); segDelete->DeleteStructure();
modified = true;
} }
} }
...@@ -568,7 +588,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -568,7 +588,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
nextsegment = segment->Next(); nextsegment = segment->Next();
} }
return; return modified;
} }
...@@ -577,13 +597,14 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame ) ...@@ -577,13 +597,14 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
* and see if the common point is not on a pad (i.e. if this common point can be removed). * and see if the common point is not on a pad (i.e. if this common point can be removed).
* the ending point of pt_ref is the start point (aEndType == START) * the ending point of pt_ref is the start point (aEndType == START)
* or the end point (aEndType != START) * or the end point (aEndType != START)
* flags START_ON_PAD and END_ON_PAD must be set before calling this function
* if the common point can be deleted, this function * if the common point can be deleted, this function
* change the common point coordinate of the aTrackRef segm * change the common point coordinate of the aTrackRef segm
* (and therefore connect the 2 other ending points) * (and therefore connect the 2 other ending points)
* and return aCandidate (which can be deleted). * and return aCandidate (which can be deleted).
* else return NULL * else return NULL
*/ */
TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCandidate, TRACK* TRACKS_CLEANER::mergeColinearSegmentIfPossible( TRACK* aTrackRef, TRACK* aCandidate,
int aEndType ) int aEndType )
{ {
if( aTrackRef->m_Width != aCandidate->m_Width ) if( aTrackRef->m_Width != aCandidate->m_Width )
...@@ -594,13 +615,13 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCa ...@@ -594,13 +615,13 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCa
// Trivial case: superimposed tracks ( tracks, not vias ): // Trivial case: superimposed tracks ( tracks, not vias ):
if( aTrackRef->Type() == PCB_TRACE_T && aCandidate->Type() == PCB_TRACE_T ) if( aTrackRef->Type() == PCB_TRACE_T && aCandidate->Type() == PCB_TRACE_T )
{ {
if( aTrackRef->m_Start == aCandidate->m_Start ) if( ( aTrackRef->m_Start == aCandidate->m_Start ) &&
if( aTrackRef->m_End == aCandidate->m_End ) ( aTrackRef->m_End == aCandidate->m_End ) )
return aCandidate; return aCandidate;
if( aTrackRef->m_Start == aCandidate->m_End ) if( ( aTrackRef->m_Start == aCandidate->m_End ) &&
if( aTrackRef->m_End == aCandidate->m_Start ) ( aTrackRef->m_End == aCandidate->m_Start ) )
return aCandidate; return aCandidate;
} }
int refdx = aTrackRef->m_End.x - aTrackRef->m_Start.x; int refdx = aTrackRef->m_End.x - aTrackRef->m_Start.x;
...@@ -646,8 +667,8 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCa ...@@ -646,8 +667,8 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCa
*/ */
if( aEndType == FLG_START ) if( aEndType == FLG_START )
{ {
// We must not have a pad, which is a always terminal point for a track // We do not have a pad, which is a always terminal point for a track
if( aPcb->GetPadFast( aTrackRef->m_Start, aTrackRef->ReturnMaskLayer() ) ) if( aTrackRef->GetState( START_ON_PAD) )
return NULL; return NULL;
/* change the common point coordinate of pt_segm to use the other point /* change the common point coordinate of pt_segm to use the other point
...@@ -655,18 +676,22 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCa ...@@ -655,18 +676,22 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCa
if( aTrackRef->m_Start == aCandidate->m_Start ) if( aTrackRef->m_Start == aCandidate->m_Start )
{ {
aTrackRef->m_Start = aCandidate->m_End; aTrackRef->m_Start = aCandidate->m_End;
aTrackRef->start = aCandidate->end;
aTrackRef->SetState( START_ON_PAD, aCandidate->GetState( END_ON_PAD) );
return aCandidate; return aCandidate;
} }
else else
{ {
aTrackRef->m_Start = aCandidate->m_Start; aTrackRef->m_Start = aCandidate->m_Start;
aTrackRef->start = aCandidate->start;
aTrackRef->SetState( START_ON_PAD, aCandidate->GetState( START_ON_PAD) );
return aCandidate; return aCandidate;
} }
} }
else // aEndType == END else // aEndType == END
{ {
// We must not have a pad, which is a always terminal point for a track // We do not have a pad, which is a always terminal point for a track
if( aPcb->GetPadFast( aTrackRef->m_End, aTrackRef->ReturnMaskLayer() ) ) if( aTrackRef->GetState( END_ON_PAD) )
return NULL; return NULL;
/* change the common point coordinate of pt_segm to use the other point /* change the common point coordinate of pt_segm to use the other point
...@@ -674,11 +699,15 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCa ...@@ -674,11 +699,15 @@ TRACK* MergeColinearSegmentIfPossible( BOARD* aPcb, TRACK* aTrackRef, TRACK* aCa
if( aTrackRef->m_End == aCandidate->m_Start ) if( aTrackRef->m_End == aCandidate->m_Start )
{ {
aTrackRef->m_End = aCandidate->m_End; aTrackRef->m_End = aCandidate->m_End;
aTrackRef->end = aCandidate->end;
aTrackRef->SetState( END_ON_PAD, aCandidate->GetState( END_ON_PAD) );
return aCandidate; return aCandidate;
} }
else else
{ {
aTrackRef->m_End = aCandidate->m_Start; aTrackRef->m_End = aCandidate->m_Start;
aTrackRef->end = aCandidate->start;
aTrackRef->SetState( END_ON_PAD, aCandidate->GetState( START_ON_PAD) );
return aCandidate; return aCandidate;
} }
} }
...@@ -706,7 +735,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks() ...@@ -706,7 +735,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
// find the netcode for segment using anything connected to the "start" of "segment" // find the netcode for segment using anything connected to the "start" of "segment"
net_code_s = -1; net_code_s = -1;
if( segment->start && segment->start->Type()==PCB_PAD_T ) if( segment->start && segment->start->Type()==PCB_PAD_T )
{ {
// get the netcode of the pad to propagate. // get the netcode of the pad to propagate.
net_code_s = ((D_PAD*)(segment->start))->GetNet(); net_code_s = ((D_PAD*)(segment->start))->GetNet();
...@@ -725,7 +754,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks() ...@@ -725,7 +754,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
// find the netcode for segment using anything connected to the "end" of "segment" // find the netcode for segment using anything connected to the "end" of "segment"
net_code_e = -1; net_code_e = -1;
if( segment->end && segment->end->Type()==PCB_PAD_T ) if( segment->end && segment->end->Type()==PCB_PAD_T )
{ {
net_code_e = ((D_PAD*)(segment->end))->GetNet(); net_code_e = ((D_PAD*)(segment->end))->GetNet();
} }
...@@ -748,7 +777,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks() ...@@ -748,7 +777,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
} }
// Remove tracks having a flagged segment // Remove tracks having a flagged segment
for( segment = GetBoard()->m_Track; segment; segment = next ) for( segment = GetBoard()->m_Track; segment; segment = next )
{ {
next = (TRACK*) segment->Next(); next = (TRACK*) segment->Next();
...@@ -768,154 +797,3 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks() ...@@ -768,154 +797,3 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks()
return isModified; return isModified;
} }
#if defined(CONN2PAD_ENBL)
/**
* Function ConnectDanglingEndToPad
* looks for vias which have no netcode and which are in electrical contact
* with a track to the degree that the track's end point falls on the via.
* Note that this is not a rigorous electrical check, but is better than
* testing for the track endpoint equaling the via center. When such a via
* is found, then add a small track to bridge from the overlapping track to
* the via and change the via's netcode so that subsequent continuity checks
* can be done with the faster equality algorithm.
*/
static void ConnectDanglingEndToVia( BOARD* pcb )
{
for( TRACK* track = pcb->m_Track; track; track = track->Next() )
{
SEGVIA* via;
if( track->Type()!=PCB_VIA_T || (via = (SEGVIA*)track)->GetNet()!=0 )
continue;
for( TRACK* other = pcb->m_Track; other; other = other->Next() )
{
if( other == track )
continue;
if( !via->IsOnLayer( other->GetLayer() ) )
continue;
// if the other track's m_End does not match the via position, and the track's
// m_Start is within the bounds of the via, and the other track has no start
if( other->m_End != via->GetPosition() && via->HitTest( other->m_Start )
&& !other->start )
{
TRACK* newTrack = (TRACK*)other->Clone();
pcb->m_Track.Insert( newTrack, other->Next() );
newTrack->m_End = via->GetPosition();
newTrack->start = other;
newTrack->end = via;
other->start = newTrack;
via->SetNet( other->GetNet() );
if( !via->start )
via->start = other;
if( !via->end )
via->end = other;
}
// if the other track's m_Start does not match the via position, and the track's
// m_End is within the bounds of the via, and the other track has no end
else if( other->m_Start != via->GetPosition() && via->HitTest( other->m_End )
&& !other->end )
{
TRACK* newTrack = (TRACK*)other->Clone();
pcb->m_Track.Insert( newTrack, other->Next() );
newTrack->m_Start = via->GetPosition();
newTrack->start = via;
newTrack->end = other;
other->end = newTrack;
via->SetNet( other->GetNet() );
if( !via->start )
via->start = other;
if( !via->end )
via->end = other;
}
}
}
}
/**
* Function ConnectDanglingEndToPad
* possibly adds a segment to the end of any and all tracks if their end is not exactly
* connected into the center of the pad. This allows faster control of
* connections.
*/
void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
{
TRACK* segment;
int nb_new_trace = 0;
wxString msg;
aFrame->GetCanvas()->SetAbortRequest( false );
for( segment = aFrame->GetBoard()->m_Track; segment; segment = segment->Next() )
{
D_PAD* pad;
if( aFrame->GetCanvas()->GetAbortRequest() )
return;
pad = aFrame->GetBoard()->GetPad( segment, FLG_START );
if( pad )
{
// test if the track start point is not exactly starting on the pad
if( segment->m_Start != pad->GetPosition() )
{
if( segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, FLG_START ) == NULL )
{
TRACK* newTrack = (TRACK*) segment->Clone();
aFrame->GetBoard()->m_Track.Insert( newTrack, segment->Next() );
newTrack->m_End = pad->GetPosition();
newTrack->start = segment;
newTrack->end = pad;
nb_new_trace++;
}
}
}
pad = aFrame->GetBoard()->GetPad( segment, FLG_END );
if( pad )
{
// test if the track end point is not exactly on the pad
if( segment->m_End != pad->GetPosition() )
{
if( segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, FLG_END ) == NULL )
{
TRACK* newTrack = (TRACK*)segment->Clone();
aFrame->GetBoard()->m_Track.Insert( newTrack, segment->Next() );
newTrack->m_Start = pad->GetPosition();
newTrack->start = pad;
newTrack->end = segment;
nb_new_trace++;
}
}
}
}
}
#endif
...@@ -34,11 +34,10 @@ ...@@ -34,11 +34,10 @@
#include <macros.h> #include <macros.h>
#include <wxBasePcbFrame.h> #include <wxBasePcbFrame.h>
#include <class_track.h>
#include <class_board.h>
#include <pcbnew.h> #include <pcbnew.h>
// Helper classes to handle connection points
#include <connect.h>
extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb ); extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb );
extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ); extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
...@@ -47,204 +46,6 @@ extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ); ...@@ -47,204 +46,6 @@ extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
static void RebuildTrackChain( BOARD* pcb ); static void RebuildTrackChain( BOARD* pcb );
// A helper class to handle connection points (i.e. candidates) for tracks
class CONNECTED_POINT
{
private:
BOARD_CONNECTED_ITEM * m_item; // a link to the parent item (track, via or pad)
wxPoint m_point; // the connection point
public:
CONNECTED_POINT( TRACK * aTrack, const wxPoint & aPoint)
{
m_item = aTrack;
m_point = aPoint;
}
CONNECTED_POINT( D_PAD * aPad, const wxPoint & aPoint)
{
m_item = aPad;
m_point = aPoint;
}
TRACK * GetTrack() const
{
return m_item->Type() != PCB_PAD_T ? (TRACK*) m_item : NULL ;
}
D_PAD * GetPad() const
{
return m_item->Type() == PCB_PAD_T ? (D_PAD*) m_item : NULL;
}
const wxPoint & GetPoint() const { return m_point; }
};
// A helper class to handle connections calculations:
class CONNECTIONS
{
private:
std::vector <TRACK*> m_connected; // List of connected tracks/vias
// to a given track or via
std::vector <CONNECTED_POINT> m_candidates; // List of points to test
// (end points of tracks or vias location )
BOARD * m_brd; // the master board.
const TRACK * m_firstTrack; // The first track used to build m_Candidates
const TRACK * m_lastTrack; // The last track used to build m_Candidates
std::vector<D_PAD*> m_sortedPads; // list of sorted pads by X (then Y) coordinate
public:
CONNECTIONS( BOARD * aBrd );
~CONNECTIONS() {};
/** Function BuildPadsList
* Fills m_sortedPads with all pads that be connected to tracks
* pads are sorted by > then Y coordinates to allow fast binary search in list
* @param aNetcode = net code to use to filter pads
* if aNetcode < 0, all pads will be put in list (default)
*/
void BuildPadsList( int aNetcode = -1 );
/**
* @return the pads list used in connections calculations
*/
std::vector<D_PAD*>& GetPadsList() { return m_sortedPads; }
/**
* Function Build_CurrNet_SubNets_Connections
* should be called after a track change (delete or add a track):
* Connections to pads and to tracks are recalculated
* If a track is deleted, the other pointers to pads do not change.
* When a new track is added in track list, its pointers to pads are already initialized
* Builds the subnets inside a net (tracks from aFirstTrack to aFirstTrack).
* subnets are clusters of pads and tracks that are connected together.
* When all tracks are created relative to the net, there is only a cluster
* when not tracks there are a cluster per pad
* @param aFirstTrack = first track of the given net
* @param aLastTrack = last track of the given net
* @param aNetcode = the netcode of the given net
*/
void Build_CurrNet_SubNets_Connections( TRACK* aFirstTrack, TRACK* aLastTrack, int aNetcode );
/**
* Function BuildTracksCandidatesList
* Fills m_Candidates with all connecting points (track ends or via location)
* with tracks from aBegin to aEnd.
* if aEnd == NULL, uses all tracks from aBegin
*/
void BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd = NULL);
/**
* Function BuildPadsCandidatesList
* Fills m_Candidates with all pads connecting points (pads position)
* m_sortedPads must be built
*/
void BuildPadsCandidatesList();
/**
* function SearchConnectedTracks
* Fills m_Connected with tracks/vias connected to aTrack
* @param aTrack = track or via to use as reference
*/
int SearchConnectedTracks( const TRACK * aTrack );
/**
* Function GetConnectedTracks
* Copy m_Connected that contains the list of tracks connected
* calculated by SearchConnectedTracks
* in aTrack->m_TracksConnected
* @param aTrack = track or via to fill with connected tracks
*/
void GetConnectedTracks(TRACK * aTrack)
{
aTrack->m_TracksConnected = m_connected;
}
/**
* function SearchConnectionsPadsToIntersectingPads
* Explores the list of pads and adds to m_PadsConnected member
* of each pad pads connected to
* Here, connections are due to intersecting pads, not tracks
* m_sortedPads must be initialized
*/
void SearchConnectionsPadsToIntersectingPads();
/**
* function SearchTracksConnectedToPads
* Explores the list of pads.
* Adds to m_PadsConnected member of each track the pad(s) connected to
* Adds to m_TracksConnected member of each pad the track(s) connected to
* D_PAD::m_TracksConnected is cleared before adding items
* TRACK::m_PadsConnected is not cleared
*/
void SearchTracksConnectedToPads();
/**
* function CollectItemsNearTo
* Used by SearchTracksConnectedToPads
* Fills aList with pads near to aPosition
* near means aPosition to pad position <= aDistMax
* @param aList = list to fill
* @param aPosition = aPosition to use as reference
* @param aDistMax = dist max from aPosition to a candidate to select it
*/
void CollectItemsNearTo( std::vector<CONNECTED_POINT*>& aList,
const wxPoint& aPosition, int aDistMax );
/**
* Function Propagate_SubNets
* Test a list of tracks, to create or propagate a sub netcode to pads and
* segments connected together.
* The track list must be sorted by nets, and all segments
* from m_firstTrack to m_lastTrack have the same net.
* When 2 items are connected (a track to a pad, or a track to an other track),
* they are grouped in a cluster.
* For pads, this is the .m_physical_connexion member which is a cluster identifier
* For tracks, this is the .m_Subnet member which is a cluster identifier
* For a given net, if all tracks are created, there is only one cluster.
* but if not all tracks are created, there are more than one cluster,
* and some ratsnests will be left active.
*/
void Propagate_SubNets();
private:
/**
* function searchEntryPointInCandidatesList
* Search an item in m_Connected connected to aPoint
* note m_Connected containts usually more than one candidate
* and searchEntryPointInCandidatesList returns an index to one of these candidates
* Others are neightbor of the indexed item.
* @param aPoint is the reference coordinates
* @return the index of item found or -1 if no candidate
*/
int searchEntryPointInCandidatesList( const wxPoint & aPoint);
/**
* Function Merge_SubNets
* Change a subnet old value to a new value, for tracks and pads which are connected to
* tracks from m_firstTrack to m_lastTrack and their connected pads.
* and modify the subnet parameter (change the old value to the new value).
* After that, 2 cluster (or subnets) are merged into only one.
* Note: the resulting sub net value is the smallest between aOldSubNet and aNewSubNet
* @return modification count
* @param aOldSubNet = subnet value to modify
* @param aNewSubNet = new subnet value for each item which have old_val as subnet value
*/
int Merge_SubNets( int aOldSubNet, int aNewSubNet );
/**
* Function Merge_PadsSubNets
* Change a subnet value to a new value, in m_sortedPads pad list
* After that, 2 cluster (or subnets) are merged into only one.
* Note: the resulting subnet value is the smallest between aOldSubNet et aNewSubNet
* @return modification count
* @param aOldSubNet = subnet value to modify
* @param aNewSubNet = new subnet value for each item which have old_val as subnet value
*/
int Merge_PadsSubNets( int aOldSubNet, int aNewSubNet );
};
CONNECTIONS::CONNECTIONS( BOARD * aBrd ) CONNECTIONS::CONNECTIONS( BOARD * aBrd )
{ {
m_brd = aBrd; m_brd = aBrd;
...@@ -441,10 +242,6 @@ static bool sortConnectedPointByXthenYCoordinates( const CONNECTED_POINT & aRef, ...@@ -441,10 +242,6 @@ static bool sortConnectedPointByXthenYCoordinates( const CONNECTED_POINT & aRef,
void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd) void CONNECTIONS::BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd)
{ {
m_candidates.clear(); m_candidates.clear();
// if( aBegin == NULL )
// aBegin = m_brd->m_Track;
m_firstTrack = m_lastTrack = aBegin; m_firstTrack = m_lastTrack = aBegin;
unsigned ii = 0; unsigned ii = 0;
......
/**
* @file connect.h
* @brief helper classes to find track to track and track to pad connections.
*/
#ifndef CONNECT_H
#define CONNECT_H
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <class_track.h>
#include <class_board.h>
// Helper classes to handle connection points (i.e. candidates) for tracks
/* class CONNECTED_POINT describes a coordinate having a track or pad parent.
* when a pad is the parent, the coordinate is (obviously) the connection point
* when a track is the parent, the coordinate is the staring point
* or the ending point.
* therefore when building a list of CONNECTED_POINT, a pad or via generates one item,
* and a track generates 2 items.
*/
class CONNECTED_POINT
{
private:
BOARD_CONNECTED_ITEM * m_item; // a link to the parent item (track, via or pad)
wxPoint m_point; // the connection point (coordinate of this point)
public:
// ctor to build a CONNECTED_POINT instance, when the parent is a track or via
CONNECTED_POINT( TRACK * aTrack, const wxPoint & aPoint)
{
m_item = aTrack;
m_point = aPoint;
}
// ctor to build a CONNECTED_POINT instance, when the parent is a pad
CONNECTED_POINT( D_PAD * aPad, const wxPoint & aPoint)
{
m_item = aPad;
m_point = aPoint;
}
/**
* Function GetTrack
* @return the parent track or via of this connected point,
* or null if the parent is a pad
*/
TRACK * GetTrack() const
{
return m_item->Type() != PCB_PAD_T ? (TRACK*) m_item : NULL ;
}
/**
* Function GetPad
* @return the parent pad of this connected point,
* or null if the parent is a track or via
*/
D_PAD * GetPad() const
{
return m_item->Type() == PCB_PAD_T ? (D_PAD*) m_item : NULL;
}
const wxPoint & GetPoint() const { return m_point; }
};
// A helper class to handle connections calculations:
class CONNECTIONS
{
private:
std::vector <TRACK*> m_connected; // List of connected tracks/vias
// to a given track or via
std::vector <CONNECTED_POINT> m_candidates; // List of points to test
// (end points of tracks or vias location )
BOARD * m_brd; // the master board.
const TRACK * m_firstTrack; // The first track used to build m_Candidates
const TRACK * m_lastTrack; // The last track used to build m_Candidates
std::vector<D_PAD*> m_sortedPads; // list of sorted pads by X (then Y) coordinate
public:
CONNECTIONS( BOARD * aBrd );
~CONNECTIONS() {};
/**
* Function BuildPadsList
* Fills m_sortedPads with all pads that be connected to tracks
* pads are sorted by > then Y coordinates to allow fast binary search in list
* @param aNetcode = net code to use to filter pads
* if aNetcode < 0, all pads will be put in list (default)
*/
void BuildPadsList( int aNetcode = -1 );
/**
* Function GetPadsList
* @return the pads list used in connections calculations
*/
std::vector<D_PAD*>& GetPadsList() { return m_sortedPads; }
/**
* Function Build_CurrNet_SubNets_Connections
* should be called after a track change (delete or add a track):
* Connections to pads and to tracks are recalculated
* If a track is deleted, the other pointers to pads do not change.
* When a new track is added in track list, its pointers to pads are already initialized
* Builds the subnets inside a net (tracks from aFirstTrack to aFirstTrack).
* subnets are clusters of pads and tracks that are connected together.
* When all tracks are created relative to the net, there is only a cluster
* when not tracks there are a cluster per pad
* @param aFirstTrack = first track of the given net
* @param aLastTrack = last track of the given net
* @param aNetcode = the netcode of the given net
*/
void Build_CurrNet_SubNets_Connections( TRACK* aFirstTrack, TRACK* aLastTrack, int aNetcode );
/**
* Function BuildTracksCandidatesList
* Fills m_Candidates with all connecting points (track ends or via location)
* with tracks from aBegin to aEnd.
* @param aBegin = first track to store in list (should not be NULL)
* @param aEnd = last track to store in list
* if aEnd == NULL, uses all tracks from aBegin
*/
void BuildTracksCandidatesList( TRACK * aBegin, TRACK * aEnd = NULL);
/**
* Function BuildPadsCandidatesList
* Fills m_Candidates with all pads connecting points (pads position)
* m_sortedPads must be built
*/
void BuildPadsCandidatesList();
/**
* function SearchConnectedTracks
* Fills m_Connected with tracks/vias connected to aTrack
* @param aTrack = track or via to use as reference
*/
int SearchConnectedTracks( const TRACK * aTrack );
/**
* Function GetConnectedTracks
* Copy m_Connected that contains the list of tracks connected
* calculated by SearchConnectedTracks
* in aTrack->m_TracksConnected
* @param aTrack = track or via to fill with connected tracks
*/
void GetConnectedTracks(TRACK * aTrack)
{
aTrack->m_TracksConnected = m_connected;
}
/**
* function SearchConnectionsPadsToIntersectingPads
* Explores the list of pads and adds to m_PadsConnected member
* of each pad pads connected to
* Here, connections are due to intersecting pads, not tracks
* m_sortedPads must be initialized
*/
void SearchConnectionsPadsToIntersectingPads();
/**
* function SearchTracksConnectedToPads
* Explores the list of pads.
* Adds to m_PadsConnected member of each track the pad(s) connected to
* Adds to m_TracksConnected member of each pad the track(s) connected to
* D_PAD::m_TracksConnected is cleared before adding items
* TRACK::m_PadsConnected is not cleared
*/
void SearchTracksConnectedToPads();
/**
* function CollectItemsNearTo
* Used by SearchTracksConnectedToPads
* Fills aList with pads near to aPosition
* near means aPosition to pad position <= aDistMax
* @param aList = list to fill
* @param aPosition = aPosition to use as reference
* @param aDistMax = dist max from aPosition to a candidate to select it
*/
void CollectItemsNearTo( std::vector<CONNECTED_POINT*>& aList,
const wxPoint& aPosition, int aDistMax );
/**
* Function Propagate_SubNets
* Test a list of tracks, to create or propagate a sub netcode to pads and
* segments connected together.
* The track list must be sorted by nets, and all segments
* from m_firstTrack to m_lastTrack have the same net.
* When 2 items are connected (a track to a pad, or a track to an other track),
* they are grouped in a cluster.
* For pads, this is the .m_physical_connexion member which is a cluster identifier
* For tracks, this is the .m_Subnet member which is a cluster identifier
* For a given net, if all tracks are created, there is only one cluster.
* but if not all tracks are created, there are more than one cluster,
* and some ratsnests will be left active.
*/
void Propagate_SubNets();
private:
/**
* function searchEntryPointInCandidatesList
* Search an item in m_Connected connected to aPoint
* note m_Connected containts usually more than one candidate
* and searchEntryPointInCandidatesList returns an index to one of these candidates
* Others are neightbor of the indexed item.
* @param aPoint is the reference coordinates
* @return the index of item found or -1 if no candidate
*/
int searchEntryPointInCandidatesList( const wxPoint & aPoint);
/**
* Function Merge_SubNets
* Change a subnet old value to a new value, for tracks and pads which are connected to
* tracks from m_firstTrack to m_lastTrack and their connected pads.
* and modify the subnet parameter (change the old value to the new value).
* After that, 2 cluster (or subnets) are merged into only one.
* Note: the resulting sub net value is the smallest between aOldSubNet and aNewSubNet
* @return modification count
* @param aOldSubNet = subnet value to modify
* @param aNewSubNet = new subnet value for each item which have old_val as subnet value
*/
int Merge_SubNets( int aOldSubNet, int aNewSubNet );
/**
* Function Merge_PadsSubNets
* Change a subnet value to a new value, in m_sortedPads pad list
* After that, 2 cluster (or subnets) are merged into only one.
* Note: the resulting subnet value is the smallest between aOldSubNet et aNewSubNet
* @return modification count
* @param aOldSubNet = subnet value to modify
* @param aNewSubNet = new subnet value for each item which have old_val as subnet value
*/
int Merge_PadsSubNets( int aOldSubNet, int aNewSubNet );
};
#endif // ifndef CONNECT_H
///////////////////////////////////////////////////////////////////////////// /**
// Name: dialog_cleaning_options.cpp * @file dialog_cleaning_options.cpp
// Author: jean-pierre Charras */
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-20112 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/wx.h> #include <wx/wx.h>
#include <dialog_cleaning_options.h> #include <dialog_cleaning_options.h>
...@@ -14,7 +35,6 @@ DIALOG_CLEANING_OPTIONS::DIALOG_CLEANING_OPTIONS( wxWindow* parent ): ...@@ -14,7 +35,6 @@ DIALOG_CLEANING_OPTIONS::DIALOG_CLEANING_OPTIONS( wxWindow* parent ):
m_cleanViasOpt->SetValue( cleanVias ); m_cleanViasOpt->SetValue( cleanVias );
m_mergeSegmOpt->SetValue( mergeSegments ); m_mergeSegmOpt->SetValue( mergeSegments );
m_deleteUnconnectedOpt->SetValue( deleteUnconnectedSegm ); m_deleteUnconnectedOpt->SetValue( deleteUnconnectedSegm );
m_reconnectToPadsOpt->SetValue( connectToPads );
m_sdbSizerOK->SetDefault(); m_sdbSizerOK->SetDefault();
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints(this);
...@@ -25,5 +45,4 @@ DIALOG_CLEANING_OPTIONS::DIALOG_CLEANING_OPTIONS( wxWindow* parent ): ...@@ -25,5 +45,4 @@ DIALOG_CLEANING_OPTIONS::DIALOG_CLEANING_OPTIONS( wxWindow* parent ):
bool DIALOG_CLEANING_OPTIONS::cleanVias = true; bool DIALOG_CLEANING_OPTIONS::cleanVias = true;
bool DIALOG_CLEANING_OPTIONS::mergeSegments = true; bool DIALOG_CLEANING_OPTIONS::mergeSegments = true;
bool DIALOG_CLEANING_OPTIONS::deleteUnconnectedSegm = true; bool DIALOG_CLEANING_OPTIONS::deleteUnconnectedSegm = true;
bool DIALOG_CLEANING_OPTIONS::connectToPads = false;
...@@ -14,7 +14,6 @@ public: ...@@ -14,7 +14,6 @@ public:
static bool cleanVias; static bool cleanVias;
static bool mergeSegments; static bool mergeSegments;
static bool deleteUnconnectedSegm; static bool deleteUnconnectedSegm;
static bool connectToPads;
public: public:
DIALOG_CLEANING_OPTIONS( wxWindow* parent ); DIALOG_CLEANING_OPTIONS( wxWindow* parent );
...@@ -44,7 +43,6 @@ private: ...@@ -44,7 +43,6 @@ private:
cleanVias = m_cleanViasOpt->GetValue( ); cleanVias = m_cleanViasOpt->GetValue( );
mergeSegments = m_mergeSegmOpt->GetValue( ); mergeSegments = m_mergeSegmOpt->GetValue( );
deleteUnconnectedSegm = m_deleteUnconnectedOpt->GetValue( ); deleteUnconnectedSegm = m_deleteUnconnectedOpt->GetValue( );
connectToPads = m_reconnectToPadsOpt->GetValue( );
} }
}; };
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -24,7 +24,7 @@ DIALOG_CLEANING_OPTIONS_BASE::DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wx ...@@ -24,7 +24,7 @@ DIALOG_CLEANING_OPTIONS_BASE::DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wx
bSizerUpper->Add( m_cleanViasOpt, 0, wxALL, 5 ); bSizerUpper->Add( m_cleanViasOpt, 0, wxALL, 5 );
m_mergeSegmOpt = new wxCheckBox( this, wxID_ANY, _("Merge segments"), wxDefaultPosition, wxDefaultSize, 0 ); m_mergeSegmOpt = new wxCheckBox( this, wxID_ANY, _("Merge colinear segments"), wxDefaultPosition, wxDefaultSize, 0 );
m_mergeSegmOpt->SetToolTip( _("merge aligned track segments, and remove null segments") ); m_mergeSegmOpt->SetToolTip( _("merge aligned track segments, and remove null segments") );
bSizerUpper->Add( m_mergeSegmOpt, 0, wxALL, 5 ); bSizerUpper->Add( m_mergeSegmOpt, 0, wxALL, 5 );
...@@ -34,10 +34,6 @@ DIALOG_CLEANING_OPTIONS_BASE::DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wx ...@@ -34,10 +34,6 @@ DIALOG_CLEANING_OPTIONS_BASE::DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wx
bSizerUpper->Add( m_deleteUnconnectedOpt, 0, wxALL, 5 ); bSizerUpper->Add( m_deleteUnconnectedOpt, 0, wxALL, 5 );
m_reconnectToPadsOpt = new wxCheckBox( this, wxID_ANY, _("Connect to pads"), wxDefaultPosition, wxDefaultSize, 0 );
m_reconnectToPadsOpt->SetToolTip( _("Extend dangling tracks which partially cover a pad or via, all the way to pad or via center") );
bSizerUpper->Add( m_reconnectToPadsOpt, 0, wxALL, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND|wxALL, 5 ); bSizerMain->Add( bSizerUpper, 1, wxEXPAND|wxALL, 5 );
...@@ -50,8 +46,10 @@ DIALOG_CLEANING_OPTIONS_BASE::DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wx ...@@ -50,8 +46,10 @@ DIALOG_CLEANING_OPTIONS_BASE::DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wx
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize(); m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 ); bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );
this->Layout(); this->Layout();
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project> <wxFormBuilder_Project>
<FileVersion major="1" minor="10" /> <FileVersion major="1" minor="11" />
<object class="Project" expanded="1"> <object class="Project" expanded="1">
<property name="class_decoration"></property> <property name="class_decoration"></property>
<property name="code_generation">C++</property> <property name="code_generation">C++</property>
<property name="disconnect_events">1</property> <property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property> <property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property> <property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property> <property name="encoding">UTF-8</property>
<property name="event_generation">connect</property> <property name="event_generation">connect</property>
<property name="file">dialog_cleaning_options_base</property> <property name="file">dialog_cleaning_options_base</property>
...@@ -18,10 +20,13 @@ ...@@ -18,10 +20,13 @@
<property name="path">.</property> <property name="path">.</property>
<property name="precompiled_header"></property> <property name="precompiled_header"></property>
<property name="relative_path">1</property> <property name="relative_path">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property> <property name="skip_python_events">1</property>
<property name="use_enum">0</property> <property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property> <property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1"> <object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property> <property name="bg"></property>
<property name="center">wxBOTH</property> <property name="center">wxBOTH</property>
<property name="context_help"></property> <property name="context_help"></property>
...@@ -37,20 +42,22 @@ ...@@ -37,20 +42,22 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DIALOG_CLEANING_OPTIONS_BASE</property> <property name="name">DIALOG_CLEANING_OPTIONS_BASE</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">243,181</property> <property name="size">243,146</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Cleaning options</property> <property name="title">Cleaning options</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnActivate"></event> <event name="OnActivate"></event>
<event name="OnActivateApp"></event> <event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnClose">OnCloseWindow</event> <event name="OnClose">OnCloseWindow</event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
...@@ -98,24 +105,55 @@ ...@@ -98,24 +105,55 @@
<property name="flag">wxALL</property> <property name="flag">wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property> <property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Delete redundant vias</property> <property name="label">Delete redundant vias</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_cleanViasOpt</property> <property name="name">m_cleanViasOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">remove vias on pads with a through hole</property> <property name="tooltip">remove vias on pads with a through hole</property>
<property name="validator_data_type">bool</property> <property name="validator_data_type">bool</property>
<property name="validator_style">wxFILTER_NUMERIC</property> <property name="validator_style">wxFILTER_NUMERIC</property>
...@@ -155,24 +193,55 @@ ...@@ -155,24 +193,55 @@
<property name="flag">wxALL</property> <property name="flag">wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property> <property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Merge segments</property> <property name="label">Merge colinear segments</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_mergeSegmOpt</property> <property name="name">m_mergeSegmOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">merge aligned track segments, and remove null segments</property> <property name="tooltip">merge aligned track segments, and remove null segments</property>
<property name="validator_data_type">bool</property> <property name="validator_data_type">bool</property>
<property name="validator_style">wxFILTER_NUMERIC</property> <property name="validator_style">wxFILTER_NUMERIC</property>
...@@ -212,24 +281,55 @@ ...@@ -212,24 +281,55 @@
<property name="flag">wxALL</property> <property name="flag">wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxCheckBox" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property> <property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property> <property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Delete unconnected tracks</property> <property name="label">Delete unconnected tracks</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_deleteUnconnectedOpt</property> <property name="name">m_deleteUnconnectedOpt</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">delete track segment having a dangling end</property> <property name="tooltip">delete track segment having a dangling end</property>
<property name="validator_data_type">bool</property> <property name="validator_data_type">bool</property>
<property name="validator_style">wxFILTER_NUMERIC</property> <property name="validator_style">wxFILTER_NUMERIC</property>
...@@ -264,63 +364,6 @@ ...@@ -264,63 +364,6 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="bg"></property>
<property name="checked">0</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Connect to pads</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_reconnectToPadsOpt</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip">Extend dangling tracks which partially cover a pad or via, all the way to pad or via center</property>
<property name="validator_data_type">bool</property>
<property name="validator_style">wxFILTER_NUMERIC</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable">connectToPads</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
...@@ -328,27 +371,54 @@ ...@@ -328,27 +371,54 @@
<property name="flag">wxEXPAND | wxALL</property> <property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticLine" expanded="1"> <object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property> <property name="context_help"></property>
<property name="context_menu">1</property> <property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property> <property name="enabled">1</property>
<property name="fg"></property> <property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property> <property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline</property> <property name="name">m_staticline</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property> <property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property> <property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property> <property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_cleaning_options_base__ #ifndef __DIALOG_CLEANING_OPTIONS_BASE_H__
#define __dialog_cleaning_options_base__ #define __DIALOG_CLEANING_OPTIONS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -35,7 +36,6 @@ class DIALOG_CLEANING_OPTIONS_BASE : public wxDialog ...@@ -35,7 +36,6 @@ class DIALOG_CLEANING_OPTIONS_BASE : public wxDialog
wxCheckBox* m_cleanViasOpt; wxCheckBox* m_cleanViasOpt;
wxCheckBox* m_mergeSegmOpt; wxCheckBox* m_mergeSegmOpt;
wxCheckBox* m_deleteUnconnectedOpt; wxCheckBox* m_deleteUnconnectedOpt;
wxCheckBox* m_reconnectToPadsOpt;
wxStaticLine* m_staticline; wxStaticLine* m_staticline;
wxStdDialogButtonSizer* m_sdbSizer; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK; wxButton* m_sdbSizerOK;
...@@ -51,11 +51,10 @@ class DIALOG_CLEANING_OPTIONS_BASE : public wxDialog ...@@ -51,11 +51,10 @@ class DIALOG_CLEANING_OPTIONS_BASE : public wxDialog
bool cleanVias; bool cleanVias;
bool mergeSegments; bool mergeSegments;
bool deleteUnconnectedSegm; bool deleteUnconnectedSegm;
bool connectToPads;
DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Cleaning options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 243,181 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_CLEANING_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Cleaning options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 243,146 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_CLEANING_OPTIONS_BASE(); ~DIALOG_CLEANING_OPTIONS_BASE();
}; };
#endif //__dialog_cleaning_options_base__ #endif //__DIALOG_CLEANING_OPTIONS_BASE_H__
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment