GEOS 3.9.1
IndexedNestedRingTester.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009 Sandro Santilli <strk@kbt.io>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 **********************************************************************
14 *
15 * Last port: operation/valid/IndexedNestedRingTester.java r399 (JTS-1.12)
16 *
17 **********************************************************************/
18
19#ifndef GEOS_OP_VALID_OFFSETCURVEVERTEXLIST_H
20#define GEOS_OP_VALID_OFFSETCURVEVERTEXLIST_H
21
22#include <cstddef>
23#include <vector> // for composition
24
25// Forward declarations
26namespace geos {
27namespace geom {
28//class Envelope;
29class Coordinate;
30class LinearRing;
31}
32namespace index {
33class SpatialIndex;
34}
35namespace geomgraph {
36class GeometryGraph;
37}
38}
39
40namespace geos {
41namespace operation { // geos.operation
42namespace valid { // geos.operation.valid
43
51public:
52 // @param newGraph : ownership retained by caller
53 IndexedNestedRingTester(geomgraph::GeometryGraph* newGraph, size_t initialCapacity)
54 :
55 graph(newGraph),
56 index(nullptr),
57 nestedPt(nullptr)
58 {
59 rings.reserve(initialCapacity);
60 }
61
63
64 /*
65 * Be aware that the returned Coordinate (if != NULL)
66 * will point to storage owned by one of the LinearRing
67 * previously added. If you destroy them, this
68 * will point to an invalid memory address.
69 */
70 const geom::Coordinate*
71 getNestedPoint() const
72 {
73 return nestedPt;
74 }
75
77 void
78 add(const geom::LinearRing* ring)
79 {
80 rings.push_back(ring);
81 }
82
83 bool isNonNested();
84
85private:
86
89
91 std::vector<const geom::LinearRing*> rings;
92
93 // Owned by us (use unique_ptr ?)
94 geos::index::SpatialIndex* index; // 'index' in JTS
95
96 // Externally owned, if not null
97 const geom::Coordinate* nestedPt;
98
99 void buildIndex();
100};
101
102} // namespace geos.operation.valid
103} // namespace geos.operation
104} // namespace geos
105
106#endif // GEOS_OP_VALID_OFFSETCURVEVERTEXLIST_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
Abstract class defines basic insertion and query operations supported by classes implementing spatial...
Definition: SpatialIndex.h:47
Tests whether any of a set of LinearRings are nested inside another ring in the set,...
Definition: IndexedNestedRingTester.h:50
void add(const geom::LinearRing *ring)
Definition: IndexedNestedRingTester.h:78
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26