GEOS 3.6.2
SweeplineNestedRingTester.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************
15 *
16 * Last port: operation/valid/SweeplineNestedRingTester.java rev. 1.12 (JTS-1.10)
17 *
18 **********************************************************************/
19
20#ifndef GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
21#define GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
22
23#include <geos/export.h>
24#include <geos/geom/Envelope.h> // for inline
25//#include <geos/indexSweepline.h> // for inline and inheritance
26#include <geos/index/sweepline/SweepLineOverlapAction.h> // for inheritance
27#include <geos/index/sweepline/SweepLineIndex.h> // for inlines
28
29#include <vector>
30
31#ifdef _MSC_VER
32#pragma warning(push)
33#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
34#endif
35
36// Forward declarations
37namespace geos {
38 namespace geom {
39 class LinearRing;
40 class Envelope;
41 class Coordinate;
42 }
43 namespace index {
44 namespace sweepline {
45 class SweepLineIndex;
46 }
47 }
48 namespace geomgraph {
49 class GeometryGraph;
50 }
51}
52
53namespace geos {
54namespace operation { // geos::operation
55namespace valid { // geos::operation::valid
56
62class GEOS_DLL SweeplineNestedRingTester {
63
64private:
65 geomgraph::GeometryGraph *graph; // used to find non-node vertices
66 std::vector<geom::LinearRing*> rings;
68 geom::Coordinate *nestedPt;
69 void buildIndex();
70
71public:
72
73 SweeplineNestedRingTester(geomgraph::GeometryGraph *newGraph)
74 :
75 graph(newGraph),
76 rings(),
77 sweepLine(new index::sweepline::SweepLineIndex()),
78 nestedPt(NULL)
79 {}
80
81 ~SweeplineNestedRingTester()
82 {
83 delete sweepLine;
84 }
85
86 /*
87 * Be aware that the returned Coordinate (if != NULL)
88 * will point to storage owned by one of the LinearRing
89 * previously added. If you destroy them, this
90 * will point to an invalid memory address.
91 */
92 geom::Coordinate *getNestedPoint() { return nestedPt; }
93
94 void add(geom::LinearRing* ring) {
95 rings.push_back(ring);
96 }
97
98 bool isNonNested();
99 bool isInside(geom::LinearRing *innerRing, geom::LinearRing *searchRing);
100 class OverlapAction: public index::sweepline::SweepLineOverlapAction {
101 public:
102 bool isNonNested;
103 OverlapAction(SweeplineNestedRingTester *p);
104 void overlap(index::sweepline::SweepLineInterval *s0,
105 index::sweepline::SweepLineInterval *s1);
106 private:
107 SweeplineNestedRingTester *parent;
108 };
109};
110
111} // namespace geos::operation::valid
112} // namespace geos::operation
113} // namespace geos
114
115#ifdef _MSC_VER
116#pragma warning(pop)
117#endif
118
119#endif // GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition Envelope.h:53
Models an OGC SFS LinearRing.
Definition LinearRing.h:57
Definition GeometryGraph.h:74
A sweepline implements a sorted index on a set of intervals.
Definition SweepLineIndex.h:47
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Contains classes that implement topology graphs.
Definition IndexedNestedRingTester.h:34
Contains classes which implement a sweepline algorithm for scanning geometric data structures.
Definition index/sweepline/SweepLineEvent.h:23
Provides classes for various kinds of spatial indexes.
Definition IndexedNestedRingTester.h:31
Provides classes for testing the validity of geometries.
Definition IndexedNestedRingTester.h:41
Provides classes for implementing operations on geometries.
Definition IndexedNestedRingTester.h:40
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25