GEOS  3.9.1dev
IsSimpleOp.h
Go to the documentation of this file.
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
36 namespace geos {
37 namespace algorithm {
38 class BoundaryNodeRule;
39 }
40 namespace geom {
41 class LineString;
42 class LinearRing;
43 class MultiLineString;
44 class MultiPoint;
45 class Geometry;
46 class Polygon;
47 class GeometryCollection;
48 struct CoordinateLessThen;
49 }
50 namespace geomgraph {
51 class GeometryGraph;
52 }
53 namespace operation {
54 class EndpointInfo;
55 }
56 }
57 
58 
59 namespace geos {
60 namespace operation { // geos.operation
61 
97 
98 public:
99 
106  IsSimpleOp();
107 
115  IsSimpleOp(const geom::Geometry& geom);
116 
124  IsSimpleOp(const geom::Geometry& geom,
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 
168  bool isSimple(const geom::MultiLineString* geom);
169 
175  bool isSimple(const geom::MultiPoint* mp);
176 
177  bool isSimpleLinearGeometry(const geom::Geometry* geom);
178 
179 private:
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 
211 
212  bool isSimpleMultiPoint(const geom::MultiPoint& mp);
213 
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
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Strict weak ordering Functor for Coordinate.
Definition: Coordinate.h:125
A GeometryGraph is a graph that models a given Geometry.
Definition: GeometryGraph.h:74
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
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
std::unique_ptr< geom::Coordinate > nonSimpleLocation
Definition: IsSimpleOp.h:216
An interface for rules which determine whether node points which are in boundaries of lineal geometry...
Represents a collection of heterogeneous Geometry objects.
Basic namespace for all GEOS functionalities.
const geom::Geometry * geom
Definition: IsSimpleOp.h:214
Models a collection of LineStrings.
Tests whether a Geometry is simple.
Definition: IsSimpleOp.h:96