|
|
|
@ -146,21 +146,6 @@ void BOARD::SetPosition( const wxPoint& aPos ) |
|
|
|
|
|
|
|
void BOARD::Move( const wxPoint& aMoveVector ) // overload
|
|
|
|
{ |
|
|
|
// Implement 'interface INSPECTOR' which is only INSPECTOR::Inspect(),
|
|
|
|
// here it does the moving.
|
|
|
|
struct MOVER : public INSPECTOR |
|
|
|
{ |
|
|
|
SEARCH_RESULT Inspect( EDA_ITEM* item, const void* data ) |
|
|
|
{ |
|
|
|
BOARD_ITEM* brd_item = (BOARD_ITEM*) item; |
|
|
|
const wxPoint* vector = (const wxPoint*) data; |
|
|
|
|
|
|
|
brd_item->Move( *vector ); |
|
|
|
|
|
|
|
return SEARCH_CONTINUE; |
|
|
|
} |
|
|
|
} inspector; |
|
|
|
|
|
|
|
// @todo : anything like this elsewhere? maybe put into GENERAL_COLLECTOR class.
|
|
|
|
static const KICAD_T top_level_board_stuff[] = { |
|
|
|
PCB_MARKER_T, |
|
|
|
@ -177,20 +162,25 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload |
|
|
|
EOT |
|
|
|
}; |
|
|
|
|
|
|
|
// visit this BOARD with the above inspector, which moves all items.
|
|
|
|
Visit( &inspector, &aMoveVector, top_level_board_stuff ); |
|
|
|
INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData ) |
|
|
|
{ |
|
|
|
BOARD_ITEM* brd_item = (BOARD_ITEM*) item; |
|
|
|
|
|
|
|
// aMoveVector was snapshotted, don't need "data".
|
|
|
|
brd_item->Move( aMoveVector ); |
|
|
|
|
|
|
|
return SEARCH_CONTINUE; |
|
|
|
}; |
|
|
|
|
|
|
|
Visit( inspector, NULL, top_level_board_stuff ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BOARD::chainMarkedSegments( wxPoint aPosition, const LSET& aLayerMask, TRACK_PTRS* aList ) |
|
|
|
void BOARD::chainMarkedSegments( wxPoint aPosition, const LSET& aLayerSet, TRACK_PTRS* aList ) |
|
|
|
{ |
|
|
|
TRACK* segment; // The current segment being analyzed.
|
|
|
|
TRACK* via; // The via identified, eventually destroy
|
|
|
|
TRACK* candidate; // The end segment to destroy (or NULL = segment)
|
|
|
|
int NbSegm; |
|
|
|
LSET layer_set = aLayerMask; |
|
|
|
LSET layer_set = aLayerSet; |
|
|
|
|
|
|
|
if( !m_Track ) |
|
|
|
if( !m_Track ) // no tracks at all in board
|
|
|
|
return; |
|
|
|
|
|
|
|
/* Set the BUSY flag of all connected segments, first search starting at
|
|
|
|
@ -218,7 +208,7 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, const LSET& aLayerMask, TRAC |
|
|
|
* is found we do not know at this time the number of connected items |
|
|
|
* and we do not know if this via is on the track or finish the track |
|
|
|
*/ |
|
|
|
via = m_Track->GetVia( NULL, aPosition, layer_set ); |
|
|
|
TRACK* via = m_Track->GetVia( NULL, aPosition, layer_set ); |
|
|
|
|
|
|
|
if( via ) |
|
|
|
{ |
|
|
|
@ -227,14 +217,15 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, const LSET& aLayerMask, TRAC |
|
|
|
aList->push_back( via ); |
|
|
|
} |
|
|
|
|
|
|
|
/* Now we search all segments connected to point aPosition
|
|
|
|
* if only 1 segment: this segment is candidate |
|
|
|
int seg_count = 0; |
|
|
|
TRACK* candidate = NULL; |
|
|
|
|
|
|
|
/* Search all segments connected to point aPosition.
|
|
|
|
* if only 1 segment at aPosition: then this segment is "candidate" |
|
|
|
* if > 1 segment: |
|
|
|
* end of track (more than 2 segment connected at this location) |
|
|
|
* then end of "track" (because more than 2 segments are connected at aPosition) |
|
|
|
*/ |
|
|
|
segment = m_Track; |
|
|
|
candidate = NULL; |
|
|
|
NbSegm = 0; |
|
|
|
TRACK* segment = m_Track; |
|
|
|
|
|
|
|
while( ( segment = ::GetTrack( segment, NULL, aPosition, layer_set ) ) != NULL ) |
|
|
|
{ |
|
|
|
@ -244,20 +235,18 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, const LSET& aLayerMask, TRAC |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
if( segment == via ) // just previously found: skip it
|
|
|
|
if( segment == via ) // just previously found: skip it
|
|
|
|
{ |
|
|
|
segment = segment->Next(); |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
NbSegm++; |
|
|
|
|
|
|
|
if( NbSegm == 1 ) // First time we found a connected item: segment is candidate
|
|
|
|
if( ++seg_count == 1 ) // if first connected item: then segment is candidate
|
|
|
|
{ |
|
|
|
candidate = segment; |
|
|
|
segment = segment->Next(); |
|
|
|
} |
|
|
|
else // More than 1 segment connected -> this location is an end of the track
|
|
|
|
else // More than 1 segment connected -> location is end of track
|
|
|
|
{ |
|
|
|
return; |
|
|
|
} |
|
|
|
@ -502,15 +491,15 @@ LSET BOARD::GetVisibleLayers() const |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BOARD::SetEnabledLayers( LSET aLayerMask ) |
|
|
|
void BOARD::SetEnabledLayers( LSET aLayerSet ) |
|
|
|
{ |
|
|
|
m_designSettings.SetEnabledLayers( aLayerMask ); |
|
|
|
m_designSettings.SetEnabledLayers( aLayerSet ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void BOARD::SetVisibleLayers( LSET aLayerMask ) |
|
|
|
void BOARD::SetVisibleLayers( LSET aLayerSet ) |
|
|
|
{ |
|
|
|
m_designSettings.SetVisibleLayers( aLayerMask ); |
|
|
|
m_designSettings.SetVisibleLayers( aLayerSet ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -793,7 +782,6 @@ BOARD_ITEM* BOARD::Remove( BOARD_ITEM* aBoardItem ) |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case PCB_MODULE_T: |
|
|
|
@ -990,8 +978,7 @@ void BOARD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) |
|
|
|
|
|
|
|
|
|
|
|
// virtual, see pcbstruct.h
|
|
|
|
SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, |
|
|
|
const KICAD_T scanTypes[] ) |
|
|
|
SEARCH_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) |
|
|
|
{ |
|
|
|
KICAD_T stype; |
|
|
|
SEARCH_RESULT result = SEARCH_CONTINUE; |
|
|
|
@ -1009,7 +996,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, |
|
|
|
switch( stype ) |
|
|
|
{ |
|
|
|
case PCB_T: |
|
|
|
result = inspector->Inspect( this, testData ); // inspect me
|
|
|
|
result = inspector( this, testData ); // inspect me
|
|
|
|
// skip over any types handled in the above call.
|
|
|
|
++p; |
|
|
|
break; |
|
|
|
@ -1173,86 +1160,6 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* now using PcbGeneralLocateAndDisplay(), but this remains a useful example
|
|
|
|
* of how the INSPECTOR can be used in a lightweight way. |
|
|
|
* // see pcbstruct.h
|
|
|
|
* BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, LAYER_NUM layer ) |
|
|
|
* { |
|
|
|
* class PadOrModule : public INSPECTOR |
|
|
|
* { |
|
|
|
* public: |
|
|
|
* BOARD_ITEM* found; |
|
|
|
* LAYER_NUM layer; |
|
|
|
* int layer_mask; |
|
|
|
* |
|
|
|
* PadOrModule( LAYER_NUM alayer ) : |
|
|
|
* found(0), layer(alayer), layer_mask( g_TabOneLayerMask[alayer] ) |
|
|
|
* {} |
|
|
|
* |
|
|
|
* SEARCH_RESULT Inspect( EDA_ITEM* testItem, const void* testData |
|
|
|
* ) |
|
|
|
* { |
|
|
|
* BOARD_ITEM* item = (BOARD_ITEM*) testItem; |
|
|
|
* const wxPoint& refPos = *(const wxPoint*) testData; |
|
|
|
* |
|
|
|
* if( item->Type() == PCB_PAD_T ) |
|
|
|
* { |
|
|
|
* D_PAD* pad = (D_PAD*) item; |
|
|
|
* if( pad->HitTest( refPos ) ) |
|
|
|
* { |
|
|
|
* if( layer_mask & pad->GetLayerSet() ) |
|
|
|
* { |
|
|
|
* found = item; |
|
|
|
* return SEARCH_QUIT; |
|
|
|
* } |
|
|
|
* else if( !found ) |
|
|
|
* { |
|
|
|
* MODULE* parent = (MODULE*) pad->m_Parent; |
|
|
|
* if( IsModuleLayerVisible( parent->GetLayer() ) ) |
|
|
|
* found = item; |
|
|
|
* } |
|
|
|
* } |
|
|
|
* } |
|
|
|
* |
|
|
|
* else if( item->Type() == PCB_MODULE_T ) |
|
|
|
* { |
|
|
|
* MODULE* module = (MODULE*) item; |
|
|
|
* |
|
|
|
* // consider only visible modules
|
|
|
|
* if( IsModuleLayerVisible( module->GetLayer() ) ) |
|
|
|
* { |
|
|
|
* if( module->HitTest( refPos ) ) |
|
|
|
* { |
|
|
|
* if( layer == module->GetLayer() ) |
|
|
|
* { |
|
|
|
* found = item; |
|
|
|
* return SEARCH_QUIT; |
|
|
|
* } |
|
|
|
* |
|
|
|
* // layer mismatch, save in case we don't find a
|
|
|
|
* // future layer match hit.
|
|
|
|
* if( !found ) |
|
|
|
* found = item; |
|
|
|
* } |
|
|
|
* } |
|
|
|
* } |
|
|
|
* return SEARCH_CONTINUE; |
|
|
|
* } |
|
|
|
* }; |
|
|
|
* |
|
|
|
* PadOrModule inspector( layer ); |
|
|
|
* |
|
|
|
* // search only for PADs first, then MODULES, and preferably a layer match
|
|
|
|
* static const KICAD_T scanTypes[] = { PCB_PAD_T, PCB_MODULE_T, EOT }; |
|
|
|
* |
|
|
|
* // visit this BOARD with the above inspector
|
|
|
|
* Visit( &inspector, &refPos, scanTypes ); |
|
|
|
* |
|
|
|
* return inspector.found; |
|
|
|
* } |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const |
|
|
|
{ |
|
|
|
// the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
|
|
|
|
@ -1276,36 +1183,29 @@ NETINFO_ITEM* BOARD::FindNet( const wxString& aNetname ) const |
|
|
|
|
|
|
|
MODULE* BOARD::FindModuleByReference( const wxString& aReference ) const |
|
|
|
{ |
|
|
|
struct FINDER : public INSPECTOR |
|
|
|
{ |
|
|
|
MODULE* found; |
|
|
|
MODULE* found = nullptr; |
|
|
|
|
|
|
|
FINDER() : found( 0 ) {} |
|
|
|
|
|
|
|
// implement interface INSPECTOR
|
|
|
|
SEARCH_RESULT Inspect( EDA_ITEM* item, const void* data ) |
|
|
|
{ |
|
|
|
MODULE* module = (MODULE*) item; |
|
|
|
const wxString& ref = *(const wxString*) data; |
|
|
|
// search only for MODULES
|
|
|
|
static const KICAD_T scanTypes[] = { PCB_MODULE_T, EOT }; |
|
|
|
|
|
|
|
if( ref == module->GetReference() ) |
|
|
|
{ |
|
|
|
found = module; |
|
|
|
return SEARCH_QUIT; |
|
|
|
} |
|
|
|
INSPECTOR_FUNC inspector = [&] ( EDA_ITEM* item, void* testData ) |
|
|
|
{ |
|
|
|
MODULE* module = (MODULE*) item; |
|
|
|
|
|
|
|
return SEARCH_CONTINUE; |
|
|
|
if( aReference == module->GetReference() ) |
|
|
|
{ |
|
|
|
found = module; |
|
|
|
return SEARCH_QUIT; |
|
|
|
} |
|
|
|
} inspector; |
|
|
|
|
|
|
|
// search only for MODULES
|
|
|
|
static const KICAD_T scanTypes[] = { PCB_MODULE_T, EOT }; |
|
|
|
return SEARCH_CONTINUE; |
|
|
|
}; |
|
|
|
|
|
|
|
// visit this BOARD with the above inspector
|
|
|
|
BOARD* nonconstMe = (BOARD*) this; |
|
|
|
nonconstMe->Visit( &inspector, &aReference, scanTypes ); |
|
|
|
nonconstMe->Visit( inspector, NULL, scanTypes ); |
|
|
|
|
|
|
|
return inspector.found; |
|
|
|
return found; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1321,17 +1221,7 @@ MODULE* BOARD::FindModule( const wxString& aRefOrTimeStamp, bool aSearchByTimeSt |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
|
|
|
|
#if 0 // case independent compare, why?
|
|
|
|
for( MODULE* module = m_Modules; module; module = module->Next() ) |
|
|
|
{ |
|
|
|
if( aRefOrTimeStamp.CmpNoCase( module->GetReference() ) == 0 ) |
|
|
|
return module; |
|
|
|
} |
|
|
|
#else
|
|
|
|
return FindModuleByReference( aRefOrTimeStamp ); |
|
|
|
#endif
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return NULL; |
|
|
|
@ -1495,14 +1385,14 @@ VIA* BOARD::GetViaByPosition( const wxPoint& aPosition, LAYER_ID aLayer) const |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
D_PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerMask ) |
|
|
|
D_PAD* BOARD::GetPad( const wxPoint& aPosition, LSET aLayerSet ) |
|
|
|
{ |
|
|
|
if( !aLayerMask.any() ) |
|
|
|
aLayerMask = LSET::AllCuMask(); |
|
|
|
if( !aLayerSet.any() ) |
|
|
|
aLayerSet = LSET::AllCuMask(); |
|
|
|
|
|
|
|
for( MODULE* module = m_Modules; module; module = module->Next() ) |
|
|
|
{ |
|
|
|
D_PAD* pad = module->GetPad( aPosition, aLayerMask ); |
|
|
|
D_PAD* pad = module->GetPad( aPosition, aLayerSet ); |
|
|
|
|
|
|
|
if( pad ) |
|
|
|
return pad; |
|
|
|
@ -1516,11 +1406,11 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint ) |
|
|
|
{ |
|
|
|
const wxPoint& aPosition = aTrace->GetEndPoint( aEndPoint ); |
|
|
|
|
|
|
|
LSET aLayerMask( aTrace->GetLayer() ); |
|
|
|
LSET lset( aTrace->GetLayer() ); |
|
|
|
|
|
|
|
for( MODULE* module = m_Modules; module; module = module->Next() ) |
|
|
|
{ |
|
|
|
D_PAD* pad = module->GetPad( aPosition, aLayerMask ); |
|
|
|
D_PAD* pad = module->GetPad( aPosition, lset ); |
|
|
|
|
|
|
|
if( pad ) |
|
|
|
return pad; |
|
|
|
@ -1530,7 +1420,7 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, ENDPOINT_T aEndPoint ) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerMask ) |
|
|
|
D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerSet ) |
|
|
|
{ |
|
|
|
for( unsigned i=0; i<GetPadCount(); ++i ) |
|
|
|
{ |
|
|
|
@ -1540,7 +1430,7 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerMask ) |
|
|
|
continue; |
|
|
|
|
|
|
|
// Pad found, it must be on the correct layer
|
|
|
|
if( ( pad->GetLayerSet() & aLayerMask ).any() ) |
|
|
|
if( ( pad->GetLayerSet() & aLayerSet ).any() ) |
|
|
|
return pad; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1548,9 +1438,9 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LSET aLayerMask ) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, LSET aLayerMask ) |
|
|
|
D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, LSET aLayerSet ) |
|
|
|
{ |
|
|
|
// Search the aPoint coordinates in aPadList
|
|
|
|
// Search aPadList for aPosition
|
|
|
|
// aPadList is sorted by X then Y values, and a fast binary search is used
|
|
|
|
int idxmax = aPadList.size()-1; |
|
|
|
|
|
|
|
@ -1572,7 +1462,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, L |
|
|
|
if( pad->GetPosition() == aPosition ) // candidate found
|
|
|
|
{ |
|
|
|
// The pad must match the layer mask:
|
|
|
|
if( ( aLayerMask & pad->GetLayerSet() ).any() ) |
|
|
|
if( ( aLayerSet & pad->GetLayerSet() ).any() ) |
|
|
|
return pad; |
|
|
|
|
|
|
|
// More than one pad can be at aPosition
|
|
|
|
@ -1586,7 +1476,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, L |
|
|
|
if( pad->GetPosition() != aPosition ) |
|
|
|
break; |
|
|
|
|
|
|
|
if( (aLayerMask & pad->GetLayerSet()) != 0 ) |
|
|
|
if( ( aLayerSet & pad->GetLayerSet() ).any() ) |
|
|
|
return pad; |
|
|
|
} |
|
|
|
// search previous
|
|
|
|
@ -1597,7 +1487,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, L |
|
|
|
if( pad->GetPosition() != aPosition ) |
|
|
|
break; |
|
|
|
|
|
|
|
if( (aLayerMask & pad->GetLayerSet()) != 0 ) |
|
|
|
if( ( aLayerSet & pad->GetLayerSet() ).any() ) |
|
|
|
return pad; |
|
|
|
} |
|
|
|
|
|
|
|
@ -1605,9 +1495,9 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, L |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
|
|
|
|
if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
|
|
|
|
{ |
|
|
|
if(pad->GetPosition().y < aPosition.y) // Must search after this item
|
|
|
|
if( pad->GetPosition().y < aPosition.y ) // Must search after this item
|
|
|
|
{ |
|
|
|
idx += delta; |
|
|
|
|
|
|
|
@ -1684,16 +1574,17 @@ void BOARD::PadDelete( D_PAD* aPad ) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TRACK* BOARD::GetTrack( TRACK* aTrace, const wxPoint& aPosition, |
|
|
|
LSET aLayerMask ) const |
|
|
|
TRACK* BOARD::GetVisibleTrack( TRACK* aStartingTrace, const wxPoint& aPosition, |
|
|
|
LSET aLayerSet ) const |
|
|
|
{ |
|
|
|
for( TRACK* track = aTrace; track; track = track->Next() ) |
|
|
|
for( TRACK* track = aStartingTrace; track; track = track->Next() ) |
|
|
|
{ |
|
|
|
LAYER_ID layer = track->GetLayer(); |
|
|
|
|
|
|
|
if( track->GetState( BUSY | IS_DELETED ) ) |
|
|
|
continue; |
|
|
|
|
|
|
|
// track's layer is not visible
|
|
|
|
if( m_designSettings.IsLayerVisible( layer ) == false ) |
|
|
|
continue; |
|
|
|
|
|
|
|
@ -1704,8 +1595,8 @@ TRACK* BOARD::GetTrack( TRACK* aTrace, const wxPoint& aPosition, |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if( !aLayerMask[layer] ) |
|
|
|
continue; // Segments on different layers.
|
|
|
|
if( !aLayerSet[layer] ) |
|
|
|
continue; // track's layer is not in aLayerSet
|
|
|
|
|
|
|
|
if( track->HitTest( aPosition ) ) |
|
|
|
return track; |
|
|
|
@ -1737,11 +1628,12 @@ static void dump_tracks( const char* aName, const TRACK_PTRS& aList ) |
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, |
|
|
|
double* aTraceLength, double* aPadToDieLength, |
|
|
|
bool aReorder ) |
|
|
|
{ |
|
|
|
int NbSegmBusy; |
|
|
|
TRACK_PTRS trackList; |
|
|
|
|
|
|
|
if( aCount ) |
|
|
|
@ -1894,15 +1786,15 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, |
|
|
|
* the NbSegmBusy-1 next items (NbSegmBusy when including firstTrack) |
|
|
|
* are the flagged segments |
|
|
|
*/ |
|
|
|
NbSegmBusy = 0; |
|
|
|
TRACK* firstTrack; |
|
|
|
int busy_count = 0; |
|
|
|
TRACK* firstTrack; |
|
|
|
|
|
|
|
for( firstTrack = m_Track; firstTrack; firstTrack = firstTrack->Next() ) |
|
|
|
{ |
|
|
|
// Search for the first flagged BUSY segments
|
|
|
|
if( firstTrack->GetState( BUSY ) ) |
|
|
|
{ |
|
|
|
NbSegmBusy = 1; |
|
|
|
busy_count = 1; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1919,7 +1811,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, |
|
|
|
wxASSERT( list ); |
|
|
|
|
|
|
|
/* Rearrange the chain starting at firstTrack
|
|
|
|
* All others flagged items are moved from their position to the end |
|
|
|
* All other BUSY flagged items are moved from their position to the end |
|
|
|
* of the flagged list |
|
|
|
*/ |
|
|
|
TRACK* next; |
|
|
|
@ -1930,7 +1822,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, |
|
|
|
|
|
|
|
if( track->GetState( BUSY ) ) // move it!
|
|
|
|
{ |
|
|
|
NbSegmBusy++; |
|
|
|
busy_count++; |
|
|
|
track->UnLink(); |
|
|
|
list->Insert( track, firstTrack->Next() ); |
|
|
|
|
|
|
|
@ -1943,13 +1835,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, |
|
|
|
// that are on each end of the track, if any
|
|
|
|
if( track->GetState( BEGIN_ONPAD ) ) |
|
|
|
{ |
|
|
|
D_PAD * pad = (D_PAD *) track->start; |
|
|
|
D_PAD* pad = (D_PAD *) track->start; |
|
|
|
lenPadToDie += (double) pad->GetPadToDieLength(); |
|
|
|
} |
|
|
|
|
|
|
|
if( track->GetState( END_ONPAD ) ) |
|
|
|
{ |
|
|
|
D_PAD * pad = (D_PAD *) track->end; |
|
|
|
D_PAD* pad = (D_PAD *) track->end; |
|
|
|
lenPadToDie += (double) pad->GetPadToDieLength(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -1958,13 +1850,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, |
|
|
|
} |
|
|
|
else if( aTraceLength ) |
|
|
|
{ |
|
|
|
NbSegmBusy = 0; |
|
|
|
busy_count = 0; |
|
|
|
|
|
|
|
for( TRACK* track = firstTrack; track; track = track->Next() ) |
|
|
|
{ |
|
|
|
if( track->GetState( BUSY ) ) |
|
|
|
{ |
|
|
|
NbSegmBusy++; |
|
|
|
busy_count++; |
|
|
|
track->SetState( BUSY, false ); |
|
|
|
full_len += track->GetLength(); |
|
|
|
|
|
|
|
@ -1973,19 +1865,19 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, |
|
|
|
// that are on each end of the track, if any
|
|
|
|
if( track->GetState( BEGIN_ONPAD ) ) |
|
|
|
{ |
|
|
|
D_PAD * pad = (D_PAD *) track->start; |
|
|
|
D_PAD* pad = (D_PAD *) track->start; |
|
|
|
lenPadToDie += (double) pad->GetPadToDieLength(); |
|
|
|
} |
|
|
|
|
|
|
|
if( track->GetState( END_ONPAD ) ) |
|
|
|
{ |
|
|
|
D_PAD * pad = (D_PAD *) track->end; |
|
|
|
D_PAD* pad = (D_PAD *) track->end; |
|
|
|
lenPadToDie += (double) pad->GetPadToDieLength(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
DBG( printf( "%s: NbSegmBusy:%d\n", __func__, NbSegmBusy ); ) |
|
|
|
DBG( printf( "%s: busy_count:%d\n", __func__, busy_count ); ) |
|
|
|
} |
|
|
|
|
|
|
|
if( aTraceLength ) |
|
|
|
@ -1995,7 +1887,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, |
|
|
|
*aPadToDieLength = lenPadToDie; |
|
|
|
|
|
|
|
if( aCount ) |
|
|
|
*aCount = NbSegmBusy; |
|
|
|
*aCount = busy_count; |
|
|
|
|
|
|
|
return firstTrack; |
|
|
|
} |
|
|
|
@ -2070,21 +1962,21 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_ID aActiveLayer, |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, LSET aLayerMask ) |
|
|
|
BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, LSET aLayerSet ) |
|
|
|
{ |
|
|
|
for( MODULE* module = m_Modules; module; module = module->Next() ) |
|
|
|
{ |
|
|
|
D_PAD* pad = module->GetPad( aPosition, aLayerMask ); |
|
|
|
D_PAD* pad = module->GetPad( aPosition, aLayerSet ); |
|
|
|
|
|
|
|
if( pad ) |
|
|
|
return pad; |
|
|
|
} |
|
|
|
|
|
|
|
// No pad has been located so check for a segment of the trace.
|
|
|
|
TRACK* segment = ::GetTrack( m_Track, NULL, aPosition, aLayerMask ); |
|
|
|
TRACK* segment = ::GetTrack( m_Track, NULL, aPosition, aLayerSet ); |
|
|
|
|
|
|
|
if( segment == NULL ) |
|
|
|
segment = GetTrack( m_Track, aPosition, aLayerMask ); |
|
|
|
if( !segment ) |
|
|
|
segment = GetVisibleTrack( m_Track, aPosition, aLayerSet ); |
|
|
|
|
|
|
|
return segment; |
|
|
|
} |
|
|
|
|