Code

PNG output for Cairo renderer
[inkscape.git] / src / libavoid / connector.h
index 6abb01d497e67fdd070b0753b2dd37a18a66cd2d..a313e3bb497b4ccfd690b8cb582bdd1b85d2149c 100644 (file)
@@ -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>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,7 @@
 #ifndef AVOID_CONNECTOR_H
 #define AVOID_CONNECTOR_H
 
+#include "libavoid/router.h"
 #include "libavoid/geometry.h"
 #include "libavoid/shape.h"
 #include <list>
 
 namespace Avoid {
 
-typedef unsigned int uint;
-    
-class ConnRef;
 
-typedef std::list<ConnRef *> ConnRefList;
+static const int ConnType_PolyLine   = 1;
+static const int ConnType_Orthogonal = 2;
 
 
 class ConnRef
 {
     public:
-        ConnRef(const uint id);
-        ConnRef(const uint id, const Point& src, const Point& dst);
+        ConnRef(Router *router, const unsigned int id);
+        ConnRef(Router *router, const unsigned int id,
+                const Point& src, const Point& dst);
         ~ConnRef();
         
+        void setType(unsigned int type);
         PolyLine& route(void);
         bool needsReroute(void);
-        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 setEndPointId(const unsigned int type, const unsigned int id);
+        unsigned int getSrcShapeId(void);
+        unsigned int getDstShapeId(void);
         void makeActive(void);
         void makeInactive(void);
         void lateSetup(const Point& src, const Point& dst);
+        unsigned int id(void);
         VertInf *src(void);
         VertInf *dst(void);
         void removeFromGraph(void);
@@ -62,11 +66,21 @@ class ConnRef
         void handleInvalid(void);
         int generatePath(Point p0, Point p1);
         void makePathInvalid(void);
+        Router *router(void);
+        void setHateCrossings(bool value);
+        bool doesHateCrossings(void);
+        
+        friend void Router::attachedShapes(IntList &shapes,
+                const unsigned int shapeId, const unsigned int type);
+        friend void Router::attachedConns(IntList &conns,
+                const unsigned int shapeId, const unsigned int type);
+        friend void Router::markConnectors(ShapeRef *shape);
         
-        friend void markConnectors(ShapeRef *shape);
-
     private:
-        uint _id;
+        Router *_router;
+        unsigned int _id;
+        unsigned int _type;
+        unsigned int _srcId, _dstId;
         bool _needs_reroute_flag;
         bool _false_path;
         bool _active;
@@ -78,13 +92,10 @@ class ConnRef
         bool _initialised;
         void (*_callback)(void *);
         void *_connector;
+        bool _hateCrossings;
 };
 
 
-extern ConnRefList connRefs;
-
-extern void callbackAllInvalidConnectors(void);
-
 }