More Eagle importer fixes.
1) Don't process wires more than once when looking for bus entries. 2) Don't allow processing a wire to mess up iteration over the RTree.
This commit is contained in:
parent
16047b7419
commit
bdeeace2ab
|
@ -2253,13 +2253,26 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
||||||
// for each wire segment, compare each end with all busses.
|
// for each wire segment, compare each end with all busses.
|
||||||
// If the wire end is found to end on a bus segment, place a bus entry symbol.
|
// If the wire end is found to end on a bus segment, place a bus entry symbol.
|
||||||
|
|
||||||
|
std::vector<SCH_LINE*> buses;
|
||||||
|
std::vector<SCH_LINE*> wires;
|
||||||
|
|
||||||
for( SCH_ITEM* ii : m_currentSheet->GetScreen()->Items().OfType( SCH_LINE_T ) )
|
for( SCH_ITEM* ii : m_currentSheet->GetScreen()->Items().OfType( SCH_LINE_T ) )
|
||||||
{
|
{
|
||||||
SCH_LINE* bus = static_cast<SCH_LINE*>( ii );
|
SCH_LINE* line = static_cast<SCH_LINE*>( ii );
|
||||||
|
|
||||||
if( !bus->IsBus() )
|
if( line->IsBus() )
|
||||||
continue;
|
buses.push_back( line );
|
||||||
|
else if( line->IsWire() )
|
||||||
|
wires.push_back( line );
|
||||||
|
}
|
||||||
|
|
||||||
|
for( SCH_LINE* wire : wires )
|
||||||
|
{
|
||||||
|
wxPoint wireStart = wire->GetStartPoint();
|
||||||
|
wxPoint wireEnd = wire->GetEndPoint();
|
||||||
|
|
||||||
|
for( SCH_LINE* bus : buses )
|
||||||
|
{
|
||||||
wxPoint busStart = bus->GetStartPoint();
|
wxPoint busStart = bus->GetStartPoint();
|
||||||
wxPoint busEnd = bus->GetEndPoint();
|
wxPoint busEnd = bus->GetEndPoint();
|
||||||
|
|
||||||
|
@ -2276,19 +2289,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
||||||
return TestSegmentHit( aPt, busStart, busEnd, 0 );
|
return TestSegmentHit( aPt, busStart, busEnd, 0 );
|
||||||
};
|
};
|
||||||
|
|
||||||
for( SCH_ITEM* jj : m_currentSheet->GetScreen()->Items().OfType( SCH_LINE_T ) )
|
|
||||||
{
|
|
||||||
SCH_LINE* wire = static_cast<SCH_LINE*>( jj );
|
|
||||||
|
|
||||||
if( !wire->IsWire() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
wxPoint wireStart = wire->GetStartPoint();
|
|
||||||
wxPoint wireEnd = wire->GetEndPoint();
|
|
||||||
|
|
||||||
// Test for horizontal wire and vertical bus
|
|
||||||
if( wireStart.y == wireEnd.y && busStart.x == busEnd.x )
|
if( wireStart.y == wireEnd.y && busStart.x == busEnd.x )
|
||||||
{
|
{
|
||||||
|
// Horizontal wire and vertical bus
|
||||||
|
|
||||||
if( testBusHit( wireStart ) )
|
if( testBusHit( wireStart ) )
|
||||||
{
|
{
|
||||||
// Wire start is on the vertical bus
|
// Wire start is on the vertical bus
|
||||||
|
@ -2371,10 +2375,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
||||||
m_currentSheet->GetScreen()->Append( marker );
|
m_currentSheet->GetScreen()->Append( marker );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Same thing but test end of the wire instead.
|
break;
|
||||||
if( testBusHit( wireEnd ) )
|
}
|
||||||
|
else if( testBusHit( wireEnd ) )
|
||||||
{
|
{
|
||||||
// Wire end is on the vertical bus
|
// Wire end is on the vertical bus
|
||||||
|
|
||||||
|
@ -2456,12 +2460,14 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
||||||
m_currentSheet->GetScreen()->Append( marker );
|
m_currentSheet->GetScreen()->Append( marker );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} // if( wireStart.y == wireEnd.y && busStart.x == busEnd.x)
|
|
||||||
|
|
||||||
// Test for vertical wire and horizontal bus
|
break;
|
||||||
if( wireStart.x == wireEnd.x && busStart.y == busEnd.y )
|
}
|
||||||
|
}
|
||||||
|
else if( wireStart.x == wireEnd.x && busStart.y == busEnd.y )
|
||||||
{
|
{
|
||||||
|
// Vertical wire and horizontal bus
|
||||||
|
|
||||||
if( testBusHit( wireStart ) )
|
if( testBusHit( wireStart ) )
|
||||||
{
|
{
|
||||||
// Wire start is on the bus
|
// Wire start is on the bus
|
||||||
|
@ -2548,9 +2554,10 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
||||||
m_currentSheet->GetScreen()->Append( marker );
|
m_currentSheet->GetScreen()->Append( marker );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if( testBusHit( wireEnd ) )
|
break;
|
||||||
|
}
|
||||||
|
else if( testBusHit( wireEnd ) )
|
||||||
{
|
{
|
||||||
// Wire end is on the bus
|
// Wire end is on the bus
|
||||||
|
|
||||||
|
@ -2636,15 +2643,14 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
||||||
m_currentSheet->GetScreen()->Append( marker );
|
m_currentSheet->GetScreen()->Append( marker );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Wire isn't horizontal or vertical
|
||||||
|
|
||||||
wireStart = wire->GetStartPoint();
|
|
||||||
wireEnd = wire->GetEndPoint();
|
|
||||||
busStart = bus->GetStartPoint();
|
|
||||||
busEnd = bus->GetEndPoint();
|
|
||||||
|
|
||||||
// bus entry wire isn't horizontal or vertical
|
|
||||||
if( testBusHit( wireStart ) )
|
if( testBusHit( wireStart ) )
|
||||||
{
|
{
|
||||||
wxPoint wirevector = wireStart - wireEnd;
|
wxPoint wirevector = wireStart - wireEnd;
|
||||||
|
@ -2695,6 +2701,8 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
||||||
wire->SetStartPoint( p );
|
wire->SetStartPoint( p );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if( testBusHit( wireEnd ) )
|
else if( testBusHit( wireEnd ) )
|
||||||
{
|
{
|
||||||
|
@ -2746,6 +2754,9 @@ void SCH_EAGLE_PLUGIN::addBusEntries()
|
||||||
wire->SetEndPoint( p );
|
wire->SetEndPoint( p );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue