GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

IsSimpleOp.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
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 auto_ptr (compos)
26
27 #include <map>
28 #include <memory> // for auto_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 MultiLineString;
43 class MultiPoint;
44 class Geometry;
45 struct CoordinateLessThen;
46 }
47 namespace geomgraph {
48 class GeometryGraph;
49 }
50 namespace operation {
51 class EndpointInfo;
52 }
53 }
54
55
56 namespace geos {
57 namespace operation { // geos.operation
58
93 class GEOS_DLL IsSimpleOp
94 {
95
96 public:
97
104 IsSimpleOp();
105
113 IsSimpleOp(const geom::Geometry& geom);
114
122 IsSimpleOp(const geom::Geometry& geom,
123 const algorithm::BoundaryNodeRule& boundaryNodeRule);
124
130 bool isSimple();
131
142 const geom::Coordinate* getNonSimpleLocation() const
143 {
144 return nonSimpleLocation.get();
145 }
146
155 bool isSimple(const geom::LineString *geom);
156
165 bool isSimple(const geom::MultiLineString *geom);
166
172 bool isSimple(const geom::MultiPoint *mp);
173
174 bool isSimpleLinearGeometry(const geom::Geometry *geom);
175
176 private:
177
184 bool hasNonEndpointIntersection(geomgraph::GeometryGraph &graph);
185
194 bool hasClosedEndpointIntersection(geomgraph::GeometryGraph &graph);
195
199 void addEndpoint(std::map<const geom::Coordinate*, EndpointInfo*,
200 geom::CoordinateLessThen>&endPoints,
201 const geom::Coordinate *p, bool isClosed);
202
203 bool isClosedEndpointsInInterior;
204
205 bool isSimpleMultiPoint(const geom::MultiPoint& mp);
206
207 const geom::Geometry* geom;
208
209 std::auto_ptr<geom::Coordinate> nonSimpleLocation;
210 };
211
212 } // namespace geos.operation
213 } // namespace geos
214
215 #ifdef _MSC_VER
216 #pragma warning(pop)
217 #endif
218
219 #endif