GEOS 3.3.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

SweeplineNestedRingTester.h
1 /**********************************************************************
2 * $Id: SweeplineNestedRingTester.h 3255 2011-03-01 17:56:10Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2005-2006 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: operation/valid/SweeplineNestedRingTester.java rev. 1.12 (JTS-1.10)
18 *
19 **********************************************************************/
20
21 #ifndef GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
22 #define GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
23
24 #include <geos/export.h>
25 #include <geos/geom/Envelope.h> // for inline
26 //#include <geos/indexSweepline.h> // for inline and inheritance
27 #include <geos/index/sweepline/SweepLineOverlapAction.h> // for inheritance
28 #include <geos/index/sweepline/SweepLineIndex.h> // for inlines
29
30 #include <vector>
31
32 #ifdef _MSC_VER
33 #pragma warning(push)
34 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
35 #endif
36
37 // Forward declarations
38 namespace geos {
39 namespace geom {
40 class LinearRing;
41 class Envelope;
42 class Coordinate;
43 }
44 namespace index {
45 namespace sweepline {
46 class SweepLineIndex;
47 }
48 }
49 namespace geomgraph {
50 class GeometryGraph;
51 }
52 }
53
54 namespace geos {
55 namespace operation { // geos::operation
56 namespace valid { // geos::operation::valid
57
63 class GEOS_DLL SweeplineNestedRingTester {
64
65 private:
66 geomgraph::GeometryGraph *graph; // used to find non-node vertices
67 std::vector<geom::LinearRing*> rings;
68 index::sweepline::SweepLineIndex *sweepLine;
69 geom::Coordinate *nestedPt;
70 void buildIndex();
71
72 public:
73
74 SweeplineNestedRingTester(geomgraph::GeometryGraph *newGraph)
75 :
76 graph(newGraph),
77 rings(),
78 sweepLine(new index::sweepline::SweepLineIndex()),
79 nestedPt(NULL)
80 {}
81
82 ~SweeplineNestedRingTester()
83 {
84 delete sweepLine;
85 }
86
87 /*
88 * Be aware that the returned Coordinate (if != NULL)
89 * will point to storage owned by one of the LinearRing
90 * previously added. If you destroy them, this
91 * will point to an invalid memory address.
92 */
93 geom::Coordinate *getNestedPoint() { return nestedPt; }
94
95 void add(geom::LinearRing* ring) {
96 rings.push_back(ring);
97 }
98
99 bool isNonNested();
100 bool isInside(geom::LinearRing *innerRing, geom::LinearRing *searchRing);
101 class OverlapAction: public index::sweepline::SweepLineOverlapAction {
102 public:
103 bool isNonNested;
104 OverlapAction(SweeplineNestedRingTester *p);
105 void overlap(index::sweepline::SweepLineInterval *s0,
106 index::sweepline::SweepLineInterval *s1);
107 private:
108 SweeplineNestedRingTester *parent;
109 };
110 };
111
112 } // namespace geos::operation::valid
113 } // namespace geos::operation
114 } // namespace geos
115
116 #ifdef _MSC_VER
117 #pragma warning(pop)
118 #endif
119
120 #endif // GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
121
122 /**********************************************************************
123 * $Log$
124 * Revision 1.2 2006/06/01 10:28:47 strk
125 * Reduced number of installed headers for the geos::index namespace
126 *
127 * Revision 1.1 2006/03/20 16:57:44 strk
128 * spatialindex.h and opValid.h headers split
129 *
130 **********************************************************************/
131