From 5ccaf9e36e8931186a458f3ab7b57eb4a09d4630 Mon Sep 17 00:00:00 2001 From: mjwybrow Date: Tue, 24 Jan 2006 05:54:19 +0000 Subject: [PATCH] * src/libavoid/connector.cpp, src/libavoid/connector.h, src/libavoid/shape.cpp, src/libavoid/graph.cpp, src/libavoid/incremental.cpp, src/libavoid/incremental.h, src/libavoid/static.cpp, src/libavoid/visibility.cpp, src/libavoid/makepath.cpp: Some minor upstream libavoid fixes. --- ChangeLog | 16 +++++++++++++--- src/libavoid/connector.cpp | 23 +++++++++++++++-------- src/libavoid/connector.h | 10 ++++------ src/libavoid/graph.cpp | 4 ++-- src/libavoid/incremental.cpp | 10 +++++----- src/libavoid/incremental.h | 3 ++- src/libavoid/makepath.cpp | 4 ++++ src/libavoid/shape.cpp | 4 ++-- src/libavoid/static.cpp | 2 +- src/libavoid/visibility.cpp | 2 +- 10 files changed, 49 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18df22f3f..438f94fde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-01-24 Michael Wybrow + + * src/libavoid/connector.cpp, src/libavoid/connector.h, + src/libavoid/shape.cpp, src/libavoid/graph.cpp, + src/libavoid/incremental.cpp, src/libavoid/incremental.h, + src/libavoid/static.cpp, src/libavoid/visibility.cpp, + src/libavoid/makepath.cpp: + + Some minor upstream libavoid fixes. + 2006-01-23 Carl Hetherington * src/selection.cpp: fix a typo in one of my previous commits. @@ -13,9 +23,9 @@ src/sp-namedview.h, src/attributes.cpp, src/attributes.h, src/attributes-test.cpp: - Added a "Spacing" control to the connector toolbar which allows - the user to adjust the amount of space left around avoided shapes - for the purpose of determining auto-routing connector paths. + Added a "Spacing" control to the connector toolbar which allows + the user to adjust the amount of space left around avoided shapes + for the purpose of determining auto-routing connector paths. 2006-01-17 Marco Scholten diff --git a/src/libavoid/connector.cpp b/src/libavoid/connector.cpp index cde387c5b..870095415 100644 --- a/src/libavoid/connector.cpp +++ b/src/libavoid/connector.cpp @@ -32,7 +32,7 @@ namespace Avoid { ConnRefList connRefs; -ConnRef::ConnRef(const uint id) +ConnRef::ConnRef(const unsigned int id) : _id(id) , _needs_reroute_flag(true) , _false_path(false) @@ -50,7 +50,7 @@ ConnRef::ConnRef(const uint id) } -ConnRef::ConnRef(const uint id, const Point& src, const Point& dst) +ConnRef::ConnRef(const unsigned int id, const Point& src, const Point& dst) : _id(id) , _needs_reroute_flag(true) , _false_path(false) @@ -102,16 +102,23 @@ ConnRef::~ConnRef() } } -void ConnRef::updateEndPoint(const uint type, const Point& point) +void ConnRef::updateEndPoint(const unsigned int type, const Point& point) { - assert((type == (uint) VertID::src) || (type == (uint) VertID::tar)); + assert((type == (unsigned int) VertID::src) || + (type == (unsigned int) VertID::tar)); //assert(IncludeEndpoints); + if (!_initialised) + { + makeActive(); + _initialised = true; + } + VertInf *altered = NULL; VertInf *partner = NULL; bool isShape = false; - if (type == (uint) VertID::src) + if (type == (unsigned int) VertID::src) { if (_srcVert) { @@ -126,7 +133,7 @@ void ConnRef::updateEndPoint(const uint type, const Point& point) altered = _srcVert; partner = _dstVert; } - else // if (type == (uint) VertID::dst) + else // if (type == (unsigned int) VertID::dst) { if (_dstVert) { @@ -311,10 +318,10 @@ int ConnRef::generatePath(Point p0, Point p1) _false_path = false; _needs_reroute_flag = false; - + VertInf *src = _srcVert; VertInf *tar = _dstVert; - + if (!IncludeEndpoints) { lateSetup(p0, p1); diff --git a/src/libavoid/connector.h b/src/libavoid/connector.h index 6abb01d49..71713ae41 100644 --- a/src/libavoid/connector.h +++ b/src/libavoid/connector.h @@ -30,8 +30,6 @@ namespace Avoid { -typedef unsigned int uint; - class ConnRef; typedef std::list ConnRefList; @@ -40,8 +38,8 @@ typedef std::list ConnRefList; class ConnRef { public: - ConnRef(const uint id); - ConnRef(const uint id, const Point& src, const Point& dst); + ConnRef(const unsigned int id); + ConnRef(const unsigned int id, const Point& src, const Point& dst); ~ConnRef(); PolyLine& route(void); @@ -49,7 +47,7 @@ class ConnRef void moveRoute(const int& diff_x, const int& diff_y); void freeRoute(void); void calcRouteDist(void); - void updateEndPoint(const uint type, const Point& point); + void updateEndPoint(const unsigned int type, const Point& point); void makeActive(void); void makeInactive(void); void lateSetup(const Point& src, const Point& dst); @@ -66,7 +64,7 @@ class ConnRef friend void markConnectors(ShapeRef *shape); private: - uint _id; + unsigned int _id; bool _needs_reroute_flag; bool _false_path; bool _active; diff --git a/src/libavoid/graph.cpp b/src/libavoid/graph.cpp index 9b1d602be..05b59a79d 100644 --- a/src/libavoid/graph.cpp +++ b/src/libavoid/graph.cpp @@ -340,7 +340,7 @@ int EdgeInf::firstBlocker(void) VertID kID = k->id; if ((ss.find(kID.objID) != ss.end())) { - uint shapeID = kID.objID; + unsigned int shapeID = kID.objID; db_printf("Endpoint is inside shape %u so ignore shape edges.\n", kID.objID); // One of the endpoints is inside this shape so ignore it. @@ -914,7 +914,7 @@ void printInfo(void) fprintf(fp, "\nVisibility Graph info:\n"); fprintf(fp, "----------------------\n"); - uint currshape = 0; + unsigned int currshape = 0; int st_shapes = 0; int st_vertices = 0; int st_endpoints = 0; diff --git a/src/libavoid/incremental.cpp b/src/libavoid/incremental.cpp index 3830c70ee..f7d48ac70 100644 --- a/src/libavoid/incremental.cpp +++ b/src/libavoid/incremental.cpp @@ -29,7 +29,7 @@ namespace Avoid { void addShape(ShapeRef *shape) { - uint pid = shape->id(); + unsigned int pid = shape->id(); Polygn poly = shape->poly(); adjustContainsWithAdd(poly, pid); @@ -53,7 +53,7 @@ void addShape(ShapeRef *shape) void delShape(ShapeRef *shape) { - uint pid = shape->id(); + unsigned int pid = shape->id(); // o Remove entries related to this shape's vertices shape->removeFromGraph(); @@ -81,14 +81,14 @@ void delShape(ShapeRef *shape) } -ShapeRef *moveShape(ShapeRef *oldShape, Polygn *newPoly) +ShapeRef *moveShape(ShapeRef *oldShape, Polygn *newPoly, const bool first_move) { - uint pid = oldShape->id(); + unsigned int pid = oldShape->id(); // o Remove entries related to this shape's vertices oldShape->removeFromGraph(); - if (SelectiveReroute && !(PartialFeedback && PartialTime)) + if (SelectiveReroute && (!(PartialFeedback && PartialTime) || first_move)) { markConnectors(oldShape); } diff --git a/src/libavoid/incremental.h b/src/libavoid/incremental.h index 50ef8f7dc..6bc69a6a7 100644 --- a/src/libavoid/incremental.h +++ b/src/libavoid/incremental.h @@ -31,7 +31,8 @@ namespace Avoid { extern void addShape(ShapeRef *shape); extern void delShape(ShapeRef *shape); -extern ShapeRef *moveShape(ShapeRef *oldShape, Polygn *newPoly); +extern ShapeRef *moveShape(ShapeRef *oldShape, Polygn *newPoly, + const bool first_move = false); } diff --git a/src/libavoid/makepath.cpp b/src/libavoid/makepath.cpp index 776ffd307..37b4f1801 100644 --- a/src/libavoid/makepath.cpp +++ b/src/libavoid/makepath.cpp @@ -429,6 +429,10 @@ void makePath(ConnRef *lineRef, bool *flag) // each other. This is true if we are here. if (!IncludeEndpoints && InvisibilityGrph) { + if (!directEdge) + { + directEdge = new EdgeInf(src, tar); + } directEdge->addBlocker(0); } diff --git a/src/libavoid/shape.cpp b/src/libavoid/shape.cpp index b08e75f3e..431950801 100644 --- a/src/libavoid/shape.cpp +++ b/src/libavoid/shape.cpp @@ -31,7 +31,7 @@ namespace Avoid { ShapeRefList shapeRefs; -ShapeRef::ShapeRef(uint id, Polygn& ply) +ShapeRef::ShapeRef(unsigned int id, Polygn& ply) : _id(id) , _poly(copyPoly(ply)) , _active(false) @@ -130,7 +130,7 @@ VertInf *ShapeRef::lastVert(void) } -uint ShapeRef::id(void) +unsigned int ShapeRef::id(void) { return _id; } diff --git a/src/libavoid/static.cpp b/src/libavoid/static.cpp index d424a2e7f..72d3e3b07 100644 --- a/src/libavoid/static.cpp +++ b/src/libavoid/static.cpp @@ -36,7 +36,7 @@ void CreateVisGraph(Polygn **obs, int n_obs) { for (int poly_i = 0; poly_i < n_obs; poly_i++) { - uint id = obs[poly_i]->id; + unsigned int id = obs[poly_i]->id; new ShapeRef(id, *(obs[poly_i])); } diff --git a/src/libavoid/visibility.cpp b/src/libavoid/visibility.cpp index e13656f5f..84e38037d 100644 --- a/src/libavoid/visibility.cpp +++ b/src/libavoid/visibility.cpp @@ -448,7 +448,7 @@ void vertexSweep(VertInf *vert) VertID kID = k->id; if (!(centerID.isShape) && (ss.find(kID.objID) != ss.end())) { - uint shapeID = kID.objID; + unsigned int shapeID = kID.objID; db_printf("Center is inside shape %u so ignore shape edges.\n", shapeID); // One of the endpoints is inside this shape so ignore it. -- 2.30.2