Continue From End: support other placement algos
This commit is contained in:
parent
e7555aa45f
commit
8d3e1eb52a
|
@ -486,18 +486,22 @@ bool ROUTER::getNearestRatnestAnchor( VECTOR2I& aOtherEnd, LAYER_RANGE& aOtherEn
|
||||||
if( GetCurrentNets().empty() )
|
if( GetCurrentNets().empty() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PNS::LINE_PLACER* placer = dynamic_cast<PNS::LINE_PLACER*>( Placer() );
|
PLACEMENT_ALGO* placer = Placer();
|
||||||
|
|
||||||
if( placer == nullptr )
|
if( placer == nullptr || placer->Traces().Size() == 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
LINE* trace = dynamic_cast<LINE*>( placer->Traces()[0] );
|
||||||
|
|
||||||
|
if( trace == nullptr )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PNS::LINE trace = placer->Trace();
|
|
||||||
PNS::NODE* lastNode = placer->CurrentNode( true );
|
PNS::NODE* lastNode = placer->CurrentNode( true );
|
||||||
PNS::TOPOLOGY topo( lastNode );
|
PNS::TOPOLOGY topo( lastNode );
|
||||||
|
|
||||||
// If the user has drawn a line, get the anchor nearest to the line end
|
// If the user has drawn a line, get the anchor nearest to the line end
|
||||||
if( trace.SegmentCount() > 0 )
|
if( trace->SegmentCount() > 0 )
|
||||||
return topo.NearestUnconnectedAnchorPoint( &trace, aOtherEnd, aOtherEndLayers );
|
return topo.NearestUnconnectedAnchorPoint( trace, aOtherEnd, aOtherEndLayers );
|
||||||
|
|
||||||
// Otherwise, find the closest anchor to our start point
|
// Otherwise, find the closest anchor to our start point
|
||||||
|
|
||||||
|
@ -565,12 +569,16 @@ bool ROUTER::Finish()
|
||||||
|
|
||||||
bool ROUTER::ContinueFromEnd()
|
bool ROUTER::ContinueFromEnd()
|
||||||
{
|
{
|
||||||
LINE_PLACER* placer = dynamic_cast<LINE_PLACER*>( Placer() );
|
PLACEMENT_ALGO* placer = Placer();
|
||||||
|
|
||||||
if( placer == nullptr )
|
if( placer == nullptr || placer->Traces().Size() == 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
LINE* current = dynamic_cast<LINE*>( placer->Traces()[0] );
|
||||||
|
|
||||||
|
if( current == nullptr )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
LINE current = placer->Trace();
|
|
||||||
int currentLayer = GetCurrentLayer();
|
int currentLayer = GetCurrentLayer();
|
||||||
VECTOR2I currentEnd = placer->CurrentEnd();
|
VECTOR2I currentEnd = placer->CurrentEnd();
|
||||||
VECTOR2I otherEnd;
|
VECTOR2I otherEnd;
|
||||||
|
@ -585,11 +593,11 @@ bool ROUTER::ContinueFromEnd()
|
||||||
// Commit whatever we've fixed and restart routing from the other end
|
// Commit whatever we've fixed and restart routing from the other end
|
||||||
int nextLayer = otherEndLayers.Overlaps( currentLayer ) ? currentLayer : otherEndLayers.Start();
|
int nextLayer = otherEndLayers.Overlaps( currentLayer ) ? currentLayer : otherEndLayers.Start();
|
||||||
|
|
||||||
if( !StartRouting( otherEnd, ¤t, nextLayer ) )
|
if( !StartRouting( otherEnd, current, nextLayer ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Attempt to route to our current position
|
// Attempt to route to our current position
|
||||||
Move( currentEnd, ¤t );
|
Move( currentEnd, current );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue