Code

Remove INKSCAPE_VERSION from menus-skeleton.h
[inkscape.git] / src / libavoid / region.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 */
23 #ifndef AVOID_REGION_H
24 #define AVOID_REGION_H
26 #include <list>
27 #include "libavoid/geomtypes.h"
29 namespace Avoid {
31 class ShapeRef;
33 typedef std::list<int> ShapeList;
36 class Region
37 {
38     public:
39         Region();
40         Region(double x1, double y1, double x2, double y2);
42         bool overlapCheck(BBox& bbox, unsigned int& p);
43         void getBBox(BBox& bb);
44         Region *up(void);
45         Region *down(void);
46         Region *left(void);
47         Region *right(void);
48         void initialSplit(BBox& bbox, unsigned int pos, unsigned int& shapeId);
49         bool isBlock(void);
50         
51         static void pairHor(Region *l, Region *r);
52         static void pairVer(Region *a, Region *b);
53         static void addShape(ShapeRef *shape);
54         static void removeShape(ShapeRef *shape);
55         static Region *getTopLeftRegion(void);
57     private:
58         BBox _bbox;
59         Region *_left;
60         Region *_right;
61         Region *_up;
62         Region *_down;
63         ShapeList _blocks;
64         
65         Region *split(double pos, unsigned int dir); 
66         void merge(unsigned int dir);
67         void mergeRegion(Region *src); 
68         Region *findRegion(double pos, unsigned int dir,
69                 const bool forMerge = false);
70         Region *splitDir(double pos, unsigned int dir, bool first = false); 
71         void mergeDir(unsigned int dir, bool first = false); 
72         void copyAttributes(Region *src);
73         void mergeAttributes(Region *src);
74         bool safeToMerge(unsigned int dir);
75         bool unsafeToMerge(unsigned int dir);
76 };
79 }
81 #endif