diff options
| author | mjwybrow <mjwybrow@users.sourceforge.net> | 2006-02-15 13:25:54 +0000 |
|---|---|---|
| committer | mjwybrow <mjwybrow@users.sourceforge.net> | 2006-02-15 13:25:54 +0000 |
| commit | 618fe74db3717f5c37f7a51d0d6df95776efbfe1 (patch) | |
| tree | 4c9afdc2bb436cd52cef7609d1960291433bf3c9 /src/libavoid/makepath.cpp | |
| parent | fix svg to dxf scaling factor (diff) | |
| download | inkscape-618fe74db3717f5c37f7a51d0d6df95776efbfe1.tar.gz inkscape-618fe74db3717f5c37f7a51d0d6df95776efbfe1.zip | |
* src/document.cpp, src/document.h, src/sp-conn-end-pair.cpp,
src/connector-context.cpp, src/conn-avoid-ref.cpp:
Keep a seperate connector router for each document.
* src/libavoid/Makefile_insert, src/libavoid/connector.cpp,
src/libavoid/connector.h, src/libavoid/debug.h,
src/libavoid/geometry.cpp, src/libavoid/geometry.h,
src/libavoid/geomtypes.h, src/libavoid/graph.cpp,
src/libavoid/graph.h, src/libavoid/incremental.cpp,
src/libavoid/incremental.h, src/libavoid/libavoid.h,
src/libavoid/makepath.cpp, src/libavoid/makepath.h,
src/libavoid/polyutil.cpp, src/libavoid/polyutil.h,
src/libavoid/router.cpp, src/libavoid/router.h,
src/libavoid/shape.cpp, src/libavoid/shape.h,
src/libavoid/static.cpp, src/libavoid/static.h,
src/libavoid/timer.cpp, src/libavoid/timer.h,
src/libavoid/vertices.cpp, src/libavoid/vertices.h,
src/libavoid/visibility.cpp, src/libavoid/visibility.h:
Upstream changes to libavoid that allow multiple connector
router instances, as well a few other minor bugfixes.
(bzr r144)
Diffstat (limited to 'src/libavoid/makepath.cpp')
| -rw-r--r-- | src/libavoid/makepath.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/libavoid/makepath.cpp b/src/libavoid/makepath.cpp index 37b4f1801..5f3ef3ac6 100644 --- a/src/libavoid/makepath.cpp +++ b/src/libavoid/makepath.cpp @@ -2,7 +2,7 @@ * vim: ts=4 sw=4 et tw=0 wm=0 * * libavoid - Fast, Incremental, Object-avoiding Line Router - * Copyright (C) 2004-2005 Michael Wybrow <mjwybrow@users.sourceforge.net> + * Copyright (C) 2004-2006 Michael Wybrow <mjwybrow@users.sourceforge.net> * * -------------------------------------------------------------------- * The dijkstraPath function is based on code published and described @@ -25,8 +25,12 @@ * */ +#include "libavoid/vertices.h" +#include "libavoid/makepath.h" +#include "libavoid/geometry.h" #include "libavoid/connector.h" #include "libavoid/graph.h" +#include "libavoid/router.h" #include <vector> #include <math.h> @@ -108,11 +112,13 @@ double cost(const double dist, VertInf *inf1, // static void dijkstraPath(VertInf *src, VertInf *tar) { + Router *router = src->_router; + double unseen = (double) INT_MAX; // initialize arrays - VertInf *finish = vertices.end(); - for (VertInf *t = vertices.connsBegin(); t != finish; t = t->lstNext) + VertInf *finish = router->vertices.end(); + for (VertInf *t = router->vertices.connsBegin(); t != finish; t = t->lstNext) { t->pathNext = NULL; t->pathDist = -unseen; @@ -399,12 +405,13 @@ static void aStarPath(VertInf *src, VertInf *tar) // void makePath(ConnRef *lineRef, bool *flag) { + Router *router = lineRef->router(); VertInf *src = lineRef->src(); VertInf *tar = lineRef->dst(); // TODO: Could be more efficient here. EdgeInf *directEdge = EdgeInf::existingEdge(src, tar); - if (!IncludeEndpoints && directVis(src, tar)) + if (!(router->IncludeEndpoints) && directVis(src, tar)) { Point p = src->point; Point q = tar->point; @@ -418,7 +425,8 @@ void makePath(ConnRef *lineRef, bool *flag) return; } - else if (IncludeEndpoints && directEdge && (directEdge->getDist() > 0)) + else if (router->IncludeEndpoints && directEdge && + (directEdge->getDist() > 0)) { tar->pathNext = src; directEdge->addConn(flag); @@ -427,7 +435,7 @@ void makePath(ConnRef *lineRef, bool *flag) { // Mark the path endpoints as not being able to see // each other. This is true if we are here. - if (!IncludeEndpoints && InvisibilityGrph) + if (!(router->IncludeEndpoints) && router->InvisibilityGrph) { if (!directEdge) { @@ -436,7 +444,7 @@ void makePath(ConnRef *lineRef, bool *flag) directEdge->addBlocker(0); } - if (UseAStarSearch) + if (router->UseAStarSearch) { aStarPath(src, tar); } |
