Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

operation.h

00001 /**********************************************************************
00002  * $Id: operation.h,v 1.3.2.1 2005/05/23 18:16:40 strk Exp $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00008  * Copyright (C) 2005 Refractions Research 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 #ifndef GEOS_OPERATION_H
00018 #define GEOS_OPERATION_H
00019 
00020 #include <memory>
00021 #include <vector>
00022 #include <map>
00023 #include <geos/platform.h>
00024 #include <geos/geomgraph.h>
00025 #include <geos/geom.h>
00026 #include <geos/geosAlgorithm.h>
00027 
00028 using namespace std;
00029 
00030 namespace geos {
00031 
00032 /*
00033  * \brief
00034  * The base class for operations that require GeometryGraph
00035  */
00036 class GeometryGraphOperation {
00037 friend class Unload;
00038 public:
00039         GeometryGraphOperation(const Geometry *g0,const Geometry *g1);
00040         GeometryGraphOperation(const Geometry *g0);
00041         virtual ~GeometryGraphOperation();
00042         const Geometry* getArgGeometry(int i) const;
00043 protected:
00044         static CGAlgorithms *cga;
00045         static LineIntersector *li;
00046         const PrecisionModel* resultPrecisionModel;
00047         /*
00048          * The operation args into an array so they can be accessed by index
00049          */
00050         vector<GeometryGraph*> *arg;  // the arg(s) of the operation
00051         void setComputationPrecision(const PrecisionModel* pm);
00052 };
00053 
00054 class EndpointInfo{
00055 public:
00056         Coordinate pt;
00057         bool isClosed;
00058         int degree;
00059         EndpointInfo(const Coordinate& newPt);
00060         void addEndpoint(bool newIsClosed);
00061 };
00062 
00063 /*
00064  * Tests whether a {@link Geometry} is simple.
00065  * Only {@link Geometry}s whose definition allows them
00066  * to be simple or non-simple are tested.  (E.g. Polygons must be simple
00067  * by definition, so no test is provided.  To test whether a given Polygon is valid,
00068  * use <code>Geometry#isValid</code>)
00069  *
00070  */
00071 class IsSimpleOp {
00072 public:
00073         IsSimpleOp();
00074         bool isSimple(const LineString *geom);
00075         bool isSimple(const MultiLineString *geom);
00076         bool isSimple(const MultiPoint *mp);
00077         bool isSimpleLinearGeometry(const Geometry *geom);
00078 private:
00079         bool hasNonEndpointIntersection(GeometryGraph *graph);
00080         bool hasClosedEndpointIntersection(GeometryGraph *graph);
00081         void addEndpoint(map<Coordinate,EndpointInfo*,CoordLT> *endPoints, const Coordinate& p,bool isClosed);
00082 };
00083 
00084 } // namespace geos
00085 
00086 #endif
00087 
00088 /**********************************************************************
00089  * $Log: operation.h,v $
00090  * Revision 1.3.2.1  2005/05/23 18:16:40  strk
00091  * more math.h to cmath conversions
00092  *
00093  * Revision 1.3  2004/11/17 08:13:16  strk
00094  * Indentation changes.
00095  * Some Z_COMPUTATION activated by default.
00096  *
00097  * Revision 1.2  2004/07/19 13:19:31  strk
00098  * Documentation fixes
00099  *
00100  * Revision 1.1  2004/07/02 13:20:42  strk
00101  * Header files moved under geos/ dir.
00102  *
00103  * Revision 1.15  2004/03/29 06:59:25  ybychkov
00104  * "noding/snapround" package ported (JTS 1.4);
00105  * "operation", "operation/valid", "operation/relate" and "operation/overlay" upgraded to JTS 1.4;
00106  * "geom" partially upgraded.
00107  *
00108  * Revision 1.14  2004/03/19 09:48:46  ybychkov
00109  * "geomgraph" and "geomgraph/indexl" upgraded to JTS 1.4
00110  *
00111  * Revision 1.13  2003/11/07 01:23:42  pramsey
00112  * Add standard CVS headers licence notices and copyrights to all cpp and h
00113  * files.
00114  *
00115  *
00116  **********************************************************************/
00117 

Generated on Tue Jan 10 01:34:44 2006 for GEOS by  doxygen 1.4.4