GEOS 3.9.1
IsSimpleOp.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 * 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/IsSimpleOp.java rev. 1.22 (JTS-1.10)
18 *
19 **********************************************************************/
20
21#ifndef GEOS_OPERATION_ISSIMPLEOP_H
22#define GEOS_OPERATION_ISSIMPLEOP_H
23
24#include <geos/export.h>
25#include <geos/geom/Coordinate.h> // for dtor visibility by unique_ptr (compos)
26
27#include <map>
28#include <memory> // for unique_ptr
29
30#ifdef _MSC_VER
31#pragma warning(push)
32#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
33#endif
34
35// Forward declarations
36namespace geos {
37namespace algorithm {
38class BoundaryNodeRule;
39}
40namespace geom {
41class LineString;
42class LinearRing;
43class MultiLineString;
44class MultiPoint;
45class Geometry;
46class Polygon;
47class GeometryCollection;
48struct CoordinateLessThen;
49}
50namespace geomgraph {
51class GeometryGraph;
52}
53namespace operation {
54class EndpointInfo;
55}
56}
57
58
59namespace geos {
60namespace operation { // geos.operation
61
96class GEOS_DLL IsSimpleOp {
97
98public:
99
107
116
125 const algorithm::BoundaryNodeRule& boundaryNodeRule);
126
132 bool isSimple();
133
144 const geom::Coordinate*
146 {
147 return nonSimpleLocation.get();
148 }
149
158 bool isSimple(const geom::LineString* geom);
159
169
175 bool isSimple(const geom::MultiPoint* mp);
176
177 bool isSimpleLinearGeometry(const geom::Geometry* geom);
178
179private:
180
187 bool hasNonEndpointIntersection(geomgraph::GeometryGraph& graph);
188
197 bool hasClosedEndpointIntersection(geomgraph::GeometryGraph& graph);
198
199 bool computeSimple(const geom::Geometry* geom);
200 bool isSimplePolygonal(const geom::Geometry* geom);
201 bool isSimpleGeometryCollection(const geom::GeometryCollection* col);
202
206 void addEndpoint(std::map<const geom::Coordinate*, EndpointInfo*,
207 geom::CoordinateLessThen>& endPoints,
208 const geom::Coordinate* p, bool isClosed);
209
210 bool isClosedEndpointsInInterior;
211
212 bool isSimpleMultiPoint(const geom::MultiPoint& mp);
213
214 const geom::Geometry* geom;
215
216 std::unique_ptr<geom::Coordinate> nonSimpleLocation;
217};
218
219} // namespace geos.operation
220} // namespace geos
221
222#ifdef _MSC_VER
223#pragma warning(pop)
224#endif
225
226#endif
An interface for rules which determine whether node points which are in boundaries of lineal geometry...
Definition BoundaryNodeRule.h:51
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
Represents a collection of heterogeneous Geometry objects.
Definition GeometryCollection.h:55
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:188
Definition LineString.h:68
Models a collection of LineStrings.
Definition MultiLineString.h:51
Definition MultiPoint.h:54
A GeometryGraph is a graph that models a given Geometry.
Definition GeometryGraph.h:74
Tests whether a Geometry is simple.
Definition IsSimpleOp.h:96
IsSimpleOp(const geom::Geometry &geom)
Creates a simplicity checker using the default SFS Mod-2 Boundary Node Rule.
bool isSimple(const geom::MultiLineString *geom)
Reports whether a geom::MultiLineString is simple.
IsSimpleOp()
Creates a simplicity checker using the default SFS Mod-2 Boundary Node Rule.
IsSimpleOp(const geom::Geometry &geom, const algorithm::BoundaryNodeRule &boundaryNodeRule)
Creates a simplicity checker using a given algorithm::BoundaryNodeRule.
const geom::Coordinate * getNonSimpleLocation() const
Gets a coordinate for the location where the geometry fails to be simple (i.e. where it has a non-bou...
Definition IsSimpleOp.h:145
bool isSimple()
Tests whether the geometry is simple.
bool isSimple(const geom::MultiPoint *mp)
A MultiPoint is simple iff it has no repeated points.
bool isSimple(const geom::LineString *geom)
Reports whether a geom::LineString is simple.
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:26
Strict weak ordering Functor for Coordinate.
Definition Coordinate.h:125