From 3ffd21aa6e7c4cf44633f3e1d583097007b3fb80 Mon Sep 17 00:00:00 2001 From: mjwybrow Date: Wed, 1 Mar 2006 01:48:07 +0000 Subject: * src/conn-avoid-ref.cpp, src/libavoid/connector.h, src/libavoid/shape.cpp, src/libavoid/graph.cpp, src/libavoid/shape.h, src/libavoid/graph.h, src/libavoid/router.cpp, src/libavoid/router.h, src/libavoid/connector.cpp, src/libavoid/debug.h: Some speed improvements and interface cleanups to libavoid. (bzr r192) --- src/libavoid/router.cpp | 51 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 16 deletions(-) (limited to 'src/libavoid/router.cpp') diff --git a/src/libavoid/router.cpp b/src/libavoid/router.cpp index 78bfa33db..c4dc8961f 100644 --- a/src/libavoid/router.cpp +++ b/src/libavoid/router.cpp @@ -28,6 +28,7 @@ #include "libavoid/debug.h" #include "math.h" +//#define ORTHOGONAL_ROUTING namespace Avoid { @@ -41,6 +42,7 @@ Router::Router() , IncludeEndpoints(true) , UseLeesAlgorithm(false) , InvisibilityGrph(true) + , ConsolidateMoves(false) , PartialFeedback(false) // Instrumentation: , st_checked_edges(0) @@ -63,6 +65,10 @@ void Router::addShape(ShapeRef *shape) // blocks them. newBlockingShape(&poly, pid); +#ifdef ORTHOGONAL_ROUTING + Region::addShape(shape); +#endif + // o Calculate visibility for the new vertices. if (UseLeesAlgorithm) { @@ -90,6 +96,10 @@ void Router::delShape(ShapeRef *shape) adjustContainsWithDel(pid); +#ifdef ORTHOGONAL_ROUTING + Region::removeShape(shape); +#endif + delete shape; // o Check all edges that were blocked by this shape. @@ -106,22 +116,26 @@ void Router::delShape(ShapeRef *shape) } -ShapeRef *Router::moveShape(ShapeRef *oldShape, Polygn *newPoly, const bool first_move) +void Router::moveShape(ShapeRef *shape, Polygn *newPoly, const bool first_move) { - unsigned int pid = oldShape->id(); - + unsigned int pid = shape->id(); + bool notPartialTime = !(PartialFeedback && PartialTime); + // o Remove entries related to this shape's vertices - oldShape->removeFromGraph(); + shape->removeFromGraph(); - if (SelectiveReroute && (!(PartialFeedback && PartialTime) || first_move)) + if (SelectiveReroute && (notPartialTime || first_move)) { - markConnectors(oldShape); + markConnectors(shape); } adjustContainsWithDel(pid); - delete oldShape; - oldShape = NULL; +#ifdef ORTHOGONAL_ROUTING + Region::removeShape(shape); +#endif + + shape->setNewPoly(*newPoly); adjustContainsWithAdd(*newPoly, pid); @@ -135,12 +149,14 @@ ShapeRef *Router::moveShape(ShapeRef *oldShape, Polygn *newPoly, const bool firs // check all edges not in graph checkAllMissingEdges(); } - - ShapeRef *newShape = new ShapeRef(this, pid, *newPoly); + +#ifdef ORTHOGONAL_ROUTING + Region::addShape(shape); +#endif // o Check all visibility edges to see if this one shape // blocks them. - if (!(PartialFeedback && PartialTime)) + if (notPartialTime) { newBlockingShape(newPoly, pid); } @@ -148,15 +164,13 @@ ShapeRef *Router::moveShape(ShapeRef *oldShape, Polygn *newPoly, const bool firs // o Calculate visibility for the new vertices. if (UseLeesAlgorithm) { - shapeVisSweep(newShape); + shapeVisSweep(shape); } else { - shapeVis(newShape); + shapeVis(shape); } callbackAllInvalidConnectors(); - - return newShape; } @@ -289,7 +303,12 @@ void Router::checkAllBlockedEdges(int pid) EdgeInf *tmp = iter; iter = iter->lstNext; - if (tmp->hasBlocker(pid)) + if (tmp->_blocker == -1) + { + tmp->alertConns(); + tmp->checkVis(); + } + else if (tmp->_blocker == pid) { tmp->checkVis(); } -- cgit v1.2.3