GEOS  3.3.6
IsSimpleOp.h
00001 /**********************************************************************
00002  * $Id: IsSimpleOp.h 3255 2011-03-01 17:56:10Z mloskot $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2009      Sandro Santilli <strk@keybit.net>
00008  * Copyright (C) 2005-2006 Refractions Research Inc.
00009  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00010  *
00011  * This is free software; you can redistribute and/or modify it under
00012  * the terms of the GNU Lesser General Public Licence as published
00013  * by the Free Software Foundation. 
00014  * See the COPYING file for more information.
00015  *
00016  **********************************************************************
00017  *
00018  * Last port: operation/IsSimpleOp.java rev. 1.22 (JTS-1.10)
00019  *
00020  **********************************************************************/
00021 
00022 #ifndef GEOS_OPERATION_ISSIMPLEOP_H
00023 #define GEOS_OPERATION_ISSIMPLEOP_H
00024 
00025 #include <geos/export.h>
00026 #include <geos/geom/Coordinate.h> // for dtor visibility by auto_ptr (compos)
00027 
00028 #include <map>
00029 #include <memory> // for auto_ptr
00030 
00031 #ifdef _MSC_VER
00032 #pragma warning(push)
00033 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00034 #endif
00035 
00036 // Forward declarations
00037 namespace geos {
00038         namespace algorithm {
00039                 class BoundaryNodeRule;
00040         }
00041         namespace geom {
00042                 class LineString;
00043                 class MultiLineString;
00044                 class MultiPoint;
00045                 class Geometry;
00046                 struct CoordinateLessThen;
00047         }
00048         namespace geomgraph {
00049                 class GeometryGraph;
00050         }
00051         namespace operation {
00052                 class EndpointInfo;
00053         }
00054 }
00055 
00056 
00057 namespace geos {
00058 namespace operation { // geos.operation
00059 
00094 class GEOS_DLL IsSimpleOp
00095 {
00096 
00097 public:
00098 
00105         IsSimpleOp();
00106 
00114         IsSimpleOp(const geom::Geometry& geom);
00115 
00123         IsSimpleOp(const geom::Geometry& geom,
00124                    const algorithm::BoundaryNodeRule& boundaryNodeRule);
00125 
00131         bool isSimple();
00132 
00143         const geom::Coordinate* getNonSimpleLocation() const
00144         {
00145                 return nonSimpleLocation.get();
00146         }
00147 
00156         bool isSimple(const geom::LineString *geom);
00157 
00166         bool isSimple(const geom::MultiLineString *geom);
00167 
00173         bool isSimple(const geom::MultiPoint *mp);
00174 
00175         bool isSimpleLinearGeometry(const geom::Geometry *geom);
00176 
00177 private:
00178 
00185         bool hasNonEndpointIntersection(geomgraph::GeometryGraph &graph);
00186 
00195         bool hasClosedEndpointIntersection(geomgraph::GeometryGraph &graph);
00196 
00200         void addEndpoint(std::map<const geom::Coordinate*, EndpointInfo*,
00201                         geom::CoordinateLessThen>&endPoints,
00202                         const geom::Coordinate *p, bool isClosed);
00203 
00204         bool isClosedEndpointsInInterior; 
00205 
00206         bool isSimpleMultiPoint(const geom::MultiPoint& mp);
00207 
00208         const geom::Geometry* geom;
00209 
00210         std::auto_ptr<geom::Coordinate> nonSimpleLocation;
00211 };
00212 
00213 } // namespace geos.operation
00214 } // namespace geos
00215 
00216 #ifdef _MSC_VER
00217 #pragma warning(pop)
00218 #endif
00219 
00220 #endif
00221 
00222 /**********************************************************************
00223  * $Log$
00224  * Revision 1.2  2006/03/15 18:59:33  strk
00225  * Bug #62: 'struct' CoordinateLessThen in forward declaration
00226  *
00227  * Revision 1.1  2006/03/09 16:46:49  strk
00228  * geos::geom namespace definition, first pass at headers split
00229  *
00230  **********************************************************************/
00231