Commit 79eca85b authored by dickelbeck's avatar dickelbeck

Magnetism

parent c254c13e
This diff is collapsed.
...@@ -42,51 +42,47 @@ TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer ) ...@@ -42,51 +42,47 @@ TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer )
* (TRACK*) adresse de la via * (TRACK*) adresse de la via
*/ */
{ {
TRACK* Track; TRACK* track;
for( Track = Pcb->m_Track; Track != NULL; Track = Track->Next() ) for( track = Pcb->m_Track; track; track = track->Next() )
{ {
if( Track->Type() != TYPEVIA ) if( track->Type() != TYPEVIA )
continue; continue;
if( Track->m_Start != pos ) if( track->m_Start != pos )
continue; continue;
if( Track->GetState( BUSY | DELETED ) ) if( track->GetState( BUSY | DELETED ) )
continue; continue;
if( layer < 0 ) if( layer < 0 )
return Track; break;
if( Track->IsOnLayer( layer ) ) if( track->IsOnLayer( layer ) )
return Track; break;
} }
return NULL; return track;
} }
/*******************************************************************/ /*******************************************************************/
TRACK* Locate_Via_Area( BOARD* Pcb, const wxPoint& pos, int layer ) TRACK* Locate_Via_Area( TRACK* aStart, const wxPoint& pos, int layer )
/*******************************************************************/ /*******************************************************************/
/*
* Like Locate_Via, but finds any via covering the cursor position
*/
{ {
TRACK* Track; TRACK* track;
for( Track = Pcb->m_Track; Track != NULL; Track = Track->Next() ) for( track = aStart; track; track = track->Next() )
{ {
if( Track->Type() != TYPEVIA ) if( track->Type() != TYPEVIA )
continue; continue;
if(!Track->HitTest(pos)) if( !track->HitTest(pos) )
continue; continue;
if( Track->GetState( BUSY | DELETED ) ) if( track->GetState( BUSY | DELETED ) )
continue; continue;
if( layer < 0 ) if( layer < 0 )
return Track; break;
if( Track->IsOnLayer( layer ) ) if( track->IsOnLayer( layer ) )
return Track; break;
} }
return NULL; return track;
} }
......
...@@ -77,7 +77,15 @@ void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, int ox, ...@@ -77,7 +77,15 @@ void Trace_Pads_Only( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, int ox,
TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 ); TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 );
TRACK* Locate_Via_Area( BOARD* Pcb, const wxPoint& pos, int layer = -1 ); /**
* Function Locate_Via_Area
* finds the first SEGVIA which covers the given aPos with a matching layer.
* @param aStart The starting TRACK or SEGVIA in the BOARD's list.
* @param aPos The wxPoint to HitTest() against.
* @param aLayer The layer to match, pass -1 for a don't care.
* @return TRACK* - actually a SEGVIA* if found, else NULL.
*/
TRACK* Locate_Via_Area( TRACK* aStart, const wxPoint& aPos, int aLayer = -1 );
TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr,
const wxPoint& pos, int masquelayer ); const wxPoint& pos, int masquelayer );
......
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