Code

Node tool: special case node duplication for endnodes - select new endnode
[inkscape.git] / src / libavoid / graph.h
index d30f394cfe8ad748b0abea56c18a1ae346640d82..db776b80b139c98286725538652590d36d38a9ca 100644 (file)
@@ -2,24 +2,27 @@
  * 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-2009  Monash University
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
+ * See the file LICENSE.LGPL distributed with the library.
+ *
+ * Licensees holding a valid commercial license may use this file in
+ * accordance with the commercial license agreement provided with the 
+ * library.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  *
+ * Author(s):   Michael Wybrow <mjwybrow@users.sourceforge.net>
 */
 
+
 #ifndef AVOID_GRAPH_H
 #define AVOID_GRAPH_H
 
 #include <cassert>
 #include <list>
 #include <utility>
-using std::pair;
-
 #include "libavoid/vertices.h"
 
-
 namespace Avoid {
 
 
-extern bool UseAStarSearch;
-extern bool IgnoreRegions;
-extern bool SelectiveReroute;
-extern bool IncludeEndpoints;
-extern bool UseLeesAlgorithm;
-extern bool InvisibilityGrph;
-extern bool PartialFeedback;
+class ConnRef;
+class Router;
 
 
 typedef std::list<int> ShapeList;
@@ -51,17 +46,23 @@ typedef std::list<bool *> FlagList;
 class EdgeInf
 {
     public:
-        EdgeInf(VertInf *v1, VertInf *v2);
+        EdgeInf(VertInf *v1, VertInf *v2, const bool orthogonal = false);
         ~EdgeInf();
-        double getDist(void);
+        inline double getDist(void)
+        {
+            return _dist;
+        }
         void setDist(double dist);
         void alertConns(void);
         void addConn(bool *flag);
         void addCycleBlocker(void);
         void addBlocker(int b);
-        bool hasBlocker(int b);
-        pair<VertID, VertID> ids(void);
-        pair<Point, Point> points(void);
+        bool added(void);
+        bool isOrthogonal(void) const;
+        bool rotationLessThan(const VertInf* last, const EdgeInf *rhs) const;
+
+        std::pair<VertID, VertID> ids(void);
+        std::pair<Point, Point> points(void);
         void db_print(void);
         void checkVis(void);
         VertInf *otherVert(VertInf *vert);
@@ -71,14 +72,16 @@ class EdgeInf
 
         EdgeInf *lstPrev;
         EdgeInf *lstNext;
+        int _blocker;
     private:
+        Router *_router;
         bool _added;
         bool _visible;
+        bool _orthogonal;
         VertInf *_v1;
         VertInf *_v2;
         EdgeInfList::iterator _pos1;
         EdgeInfList::iterator _pos2;
-        ShapeList _blockers;
         FlagList  _conns;
         double  _dist;
 
@@ -92,33 +95,23 @@ class EdgeInf
 class EdgeList
 {
     public:
-        EdgeList();
-        void addEdge(EdgeInf *edge);
-        void removeEdge(EdgeInf *edge);
+        friend class EdgeInf;
+        EdgeList(bool orthogonal = false);
+        ~EdgeList();
+        void clear(void);
         EdgeInf *begin(void);
         EdgeInf *end(void);
+        int size(void) const;
     private:
+        void addEdge(EdgeInf *edge);
+        void removeEdge(EdgeInf *edge);
+        bool _orthogonal;
         EdgeInf *_firstEdge;
         EdgeInf *_lastEdge;
         unsigned int _count;
 };
 
 
-extern EdgeList visGraph;
-extern EdgeList invisGraph;
-
-class ShapeRef;
-
-extern void newBlockingShape(Polygn *poly, int pid);
-extern void checkAllBlockedEdges(int pid);
-extern void checkAllMissingEdges(void);
-extern void generateContains(VertInf *pt);
-extern void adjustContainsWithAdd(const Polygn& poly, const int p_shape);
-extern void adjustContainsWithDel(const int p_shape);
-extern void markConnectors(ShapeRef *shape);
-extern void printInfo(void);
-
-
 }