GEOS 3.9.1
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 {
38namespace geom {
39class LinearRing;
40class Envelope;
41class Coordinate;
42}
43namespace index {
44namespace sweepline {
45class SweepLineIndex;
46}
47}
48namespace geomgraph {
49class GeometryGraph;
50}
51}
52
53namespace geos {
54namespace operation { // geos::operation
55namespace valid { // geos::operation::valid
56
64
65private:
66 geomgraph::GeometryGraph* graph; // used to find non-node vertices
67 std::vector<geom::LinearRing*> rings;
69 geom::Coordinate* nestedPt;
70 void buildIndex();
71
73 SweeplineNestedRingTester& operator=(const SweeplineNestedRingTester&) = delete;
74
75public:
76
78 :
79 graph(newGraph),
80 rings(),
81 sweepLine(new index::sweepline::SweepLineIndex()),
82 nestedPt(nullptr)
83 {}
84
86 {
87 delete sweepLine;
88 }
89
90 /*
91 * Be aware that the returned Coordinate (if != NULL)
92 * will point to storage owned by one of the LinearRing
93 * previously added. If you destroy them, this
94 * will point to an invalid memory address.
95 */
97 getNestedPoint()
98 {
99 return nestedPt;
100 }
101
102 void
103 add(geom::LinearRing* ring)
104 {
105 rings.push_back(ring);
106 }
107
108 bool isNonNested();
109 bool isInside(geom::LinearRing* innerRing, geom::LinearRing* searchRing);
110 class OverlapAction: public index::sweepline::SweepLineOverlapAction {
111 public:
112 bool isNonNested;
113 OverlapAction(SweeplineNestedRingTester* p);
114 void overlap(index::sweepline::SweepLineInterval* s0,
115 index::sweepline::SweepLineInterval* s1) override;
116 private:
118 };
119};
120
121} // namespace geos::operation::valid
122} // namespace geos::operation
123} // namespace geos
124
125#ifdef _MSC_VER
126#pragma warning(pop)
127#endif
128
129#endif // GEOS_OP_SWEEPLINENESTEDRINGTESTER_H
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
Models an OGC SFS LinearRing. A LinearRing is a LineString which is both closed and simple.
Definition LinearRing.h:54
A GeometryGraph is a graph that models a given Geometry.
Definition GeometryGraph.h:74
A sweepline implements a sorted index on a set of intervals.
Definition SweepLineIndex.h:47
Tests whether any of a set of LinearRings are nested inside another ring in the set,...
Definition SweeplineNestedRingTester.h:63
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:26