GEOS  3.3.3
IsSimpleOp.h
1 /**********************************************************************
2  * $Id: IsSimpleOp.h 3255 2011-03-01 17:56:10Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2009 Sandro Santilli <strk@keybit.net>
8  * Copyright (C) 2005-2006 Refractions Research Inc.
9  * Copyright (C) 2001-2002 Vivid Solutions Inc.
10  *
11  * This is free software; you can redistribute and/or modify it under
12  * the terms of the GNU Lesser General Public Licence as published
13  * by the Free Software Foundation.
14  * See the COPYING file for more information.
15  *
16  **********************************************************************
17  *
18  * Last port: operation/IsSimpleOp.java rev. 1.22 (JTS-1.10)
19  *
20  **********************************************************************/
21 
22 #ifndef GEOS_OPERATION_ISSIMPLEOP_H
23 #define GEOS_OPERATION_ISSIMPLEOP_H
24 
25 #include <geos/export.h>
26 #include <geos/geom/Coordinate.h> // for dtor visibility by auto_ptr (compos)
27 
28 #include <map>
29 #include <memory> // for auto_ptr
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
37 namespace geos {
38  namespace algorithm {
39  class BoundaryNodeRule;
40  }
41  namespace geom {
42  class LineString;
43  class MultiLineString;
44  class MultiPoint;
45  class Geometry;
46  struct CoordinateLessThen;
47  }
48  namespace geomgraph {
49  class GeometryGraph;
50  }
51  namespace operation {
52  class EndpointInfo;
53  }
54 }
55 
56 
57 namespace geos {
58 namespace operation { // geos.operation
59 
94 class GEOS_DLL IsSimpleOp
95 {
96 
97 public:
98 
105  IsSimpleOp();
106 
114  IsSimpleOp(const geom::Geometry& geom);
115 
123  IsSimpleOp(const geom::Geometry& geom,
124  const algorithm::BoundaryNodeRule& boundaryNodeRule);
125 
131  bool isSimple();
132 
143  const geom::Coordinate* getNonSimpleLocation() const
144  {
145  return nonSimpleLocation.get();
146  }
147 
156  bool isSimple(const geom::LineString *geom);
157 
166  bool isSimple(const geom::MultiLineString *geom);
167 
173  bool isSimple(const geom::MultiPoint *mp);
174 
175  bool isSimpleLinearGeometry(const geom::Geometry *geom);
176 
177 private:
178 
185  bool hasNonEndpointIntersection(geomgraph::GeometryGraph &graph);
186 
195  bool hasClosedEndpointIntersection(geomgraph::GeometryGraph &graph);
196 
200  void addEndpoint(std::map<const geom::Coordinate*, EndpointInfo*,
201  geom::CoordinateLessThen>&endPoints,
202  const geom::Coordinate *p, bool isClosed);
203 
204  bool isClosedEndpointsInInterior;
205 
206  bool isSimpleMultiPoint(const geom::MultiPoint& mp);
207 
208  const geom::Geometry* geom;
209 
210  std::auto_ptr<geom::Coordinate> nonSimpleLocation;
211 };
212 
213 } // namespace geos.operation
214 } // namespace geos
215 
216 #ifdef _MSC_VER
217 #pragma warning(pop)
218 #endif
219 
220 #endif
221 
222 /**********************************************************************
223  * $Log$
224  * Revision 1.2 2006/03/15 18:59:33 strk
225  * Bug #62: 'struct' CoordinateLessThen in forward declaration
226  *
227  * Revision 1.1 2006/03/09 16:46:49 strk
228  * geos::geom namespace definition, first pass at headers split
229  *
230  **********************************************************************/
231