~valavanisalex/ubuntu/precise/inkscape/fix-943984

« back to all changes in this revision

Viewing changes to inkscape-0.47pre1/src/libavoid/region.h

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2009-07-02 17:09:45 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20090702170945-nn6d6zswovbwju1t
Tags: 0.47~pre1-0ubuntu1
* New upstream release.
  - Don't constrain maximization on small resolution devices (pre0)
    (LP: #348842)
  - Fixes segfault on startup (pre0)
    (LP: #391149)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
*/
 
22
 
 
23
#ifndef AVOID_REGION_H
 
24
#define AVOID_REGION_H
 
25
 
 
26
#include <list>
 
27
#include "libavoid/geomtypes.h"
 
28
 
 
29
namespace Avoid {
 
30
 
 
31
class ShapeRef;
 
32
 
 
33
typedef std::list<int> ShapeList;
 
34
 
 
35
 
 
36
class Region
 
37
{
 
38
    public:
 
39
        Region();
 
40
        Region(double x1, double y1, double x2, double y2);
 
41
 
 
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);
 
56
 
 
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
};
 
77
 
 
78
 
 
79
}
 
80
 
 
81
#endif