Code

Updated cases for attributes added in <color-profile> support
[inkscape.git] / src / libavoid / router.h
1 /*
2  * vim: ts=4 sw=4 et tw=0 wm=0
3  *
4  * libavoid - Fast, Incremental, Object-avoiding Line Router
5  * Copyright (C) 2004-2006  Michael Wybrow <mjwybrow@users.sourceforge.net>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  * 
21 */
24 #ifndef AVOID_ROUTER_H
25 #define AVOID_ROUTER_H
27 //#define LINEDEBUG
29 #include "libavoid/shape.h"
30 #include "libavoid/graph.h"
31 #include "libavoid/timer.h"
32 #include <list>
33 #include <utility>
34 #ifdef LINEDEBUG       
35     #include <SDL.h>
36 #endif
39 namespace Avoid {
41 class ConnRef;
42 typedef std::list<ConnRef *> ConnRefList;
43 typedef std::list<unsigned int> IntList;
44 typedef std::pair<ShapeRef *, Polygn *> MoveInfo;
47 static const unsigned int runningTo = 1;
48 static const unsigned int runningFrom = 2;
49 static const unsigned int runningToAndFrom = runningTo | runningFrom;
52 class Router {
53     public:
54         Router();
56         ShapeRefList shapeRefs;
57         ConnRefList connRefs;
58         EdgeList visGraph;
59         EdgeList invisGraph;
60         ContainsMap contains;
61         VertInfList vertices;
62         
63         bool PartialTime;
64         double segmt_penalty;
65         double angle_penalty;
67         bool UseAStarSearch;
68         bool IgnoreRegions;
69         bool SelectiveReroute;
70         bool IncludeEndpoints;
71         bool UseLeesAlgorithm;
72         bool InvisibilityGrph;
73         bool ConsolidateMoves;
74         bool PartialFeedback;
76         // Instrumentation:
77         Timer timers;
78         int st_checked_edges;
79 #ifdef LINEDEBUG
80         SDL_Surface *avoid_screen;
81 #endif
83         void addShape(ShapeRef *shape);
84         void delShape(ShapeRef *shape);
85         void moveShape(ShapeRef *shape, Polygn *newPoly,
86                 const bool first_move = false);
87         
88         void attachedConns(IntList &conns, const unsigned int shapeId,
89                 const unsigned int type);
90         void attachedShapes(IntList &shapes, const unsigned int shapeId,
91                 const unsigned int type);
92         
93         void markConnectors(ShapeRef *shape);
94         void generateContains(VertInf *pt);
95         void printInfo(void);
96     private:
97         void newBlockingShape(Polygn *poly, int pid);
98         void checkAllBlockedEdges(int pid);
99         void checkAllMissingEdges(void);
100         void adjustContainsWithAdd(const Polygn& poly, const int p_shape);
101         void adjustContainsWithDel(const int p_shape);
102         void callbackAllInvalidConnectors(void);
103 };
109 #endif