IsSimpleOp.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2009      Sandro Santilli <strk@keybit.net>
00007  * Copyright (C) 2005-2006 Refractions Research Inc.
00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00009  *
00010  * This is free software; you can redistribute and/or modify it under
00011  * the terms of the GNU Lesser General Public Licence as published
00012  * by the Free Software Foundation. 
00013  * See the COPYING file for more information.
00014  *
00015  **********************************************************************
00016  *
00017  * Last port: operation/IsSimpleOp.java rev. 1.22 (JTS-1.10)
00018  *
00019  **********************************************************************/
00020 
00021 #ifndef GEOS_OPERATION_ISSIMPLEOP_H
00022 #define GEOS_OPERATION_ISSIMPLEOP_H
00023 
00024 #include <geos/export.h>
00025 #include <geos/geom/Coordinate.h> // for dtor visibility by auto_ptr (compos)
00026 
00027 #include <map>
00028 #include <memory> // for auto_ptr
00029 
00030 #ifdef _MSC_VER
00031 #pragma warning(push)
00032 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00033 #endif
00034 
00035 // Forward declarations
00036 namespace geos {
00037         namespace algorithm {
00038                 class BoundaryNodeRule;
00039         }
00040         namespace geom {
00041                 class LineString;
00042                 class MultiLineString;
00043                 class MultiPoint;
00044                 class Geometry;
00045                 struct CoordinateLessThen;
00046         }
00047         namespace geomgraph {
00048                 class GeometryGraph;
00049         }
00050         namespace operation {
00051                 class EndpointInfo;
00052         }
00053 }
00054 
00055 
00056 namespace geos {
00057 namespace operation { // geos.operation
00058 
00093 class GEOS_DLL IsSimpleOp
00094 {
00095 
00096 public:
00097 
00104         IsSimpleOp();
00105 
00113         IsSimpleOp(const geom::Geometry& geom);
00114 
00122         IsSimpleOp(const geom::Geometry& geom,
00123                    const algorithm::BoundaryNodeRule& boundaryNodeRule);
00124 
00130         bool isSimple();
00131 
00142         const geom::Coordinate* getNonSimpleLocation() const
00143         {
00144                 return nonSimpleLocation.get();
00145         }
00146 
00155         bool isSimple(const geom::LineString *geom);
00156 
00165         bool isSimple(const geom::MultiLineString *geom);
00166 
00172         bool isSimple(const geom::MultiPoint *mp);
00173 
00174         bool isSimpleLinearGeometry(const geom::Geometry *geom);
00175 
00176 private:
00177 
00184         bool hasNonEndpointIntersection(geomgraph::GeometryGraph &graph);
00185 
00194         bool hasClosedEndpointIntersection(geomgraph::GeometryGraph &graph);
00195 
00199         void addEndpoint(std::map<const geom::Coordinate*, EndpointInfo*,
00200                         geom::CoordinateLessThen>&endPoints,
00201                         const geom::Coordinate *p, bool isClosed);
00202 
00203         bool isClosedEndpointsInInterior; 
00204 
00205         bool isSimpleMultiPoint(const geom::MultiPoint& mp);
00206 
00207         const geom::Geometry* geom;
00208 
00209         std::auto_ptr<geom::Coordinate> nonSimpleLocation;
00210 };
00211 
00212 } // namespace geos.operation
00213 } // namespace geos
00214 
00215 #ifdef _MSC_VER
00216 #pragma warning(pop)
00217 #endif
00218 
00219 #endif

Generated on 10 Sep 2013 for GEOS by  doxygen 1.4.7