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

operation.h

00001 /**********************************************************************
00002  * $Id: operation.h,v 1.3 2004/11/17 08:13:16 strk Exp $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************/
00015 
00016 #ifndef GEOS_OPERATION_H
00017 #define GEOS_OPERATION_H
00018 
00019 #include <memory>
00020 //#include <iostream>
00021 //#include <string>
00022 #include <vector>
00023 #include <map>
00024 //#include <algorithm>
00025 //#include "math.h"
00026 #include <geos/platform.h>
00027 #include <geos/geomgraph.h>
00028 #include <geos/geom.h>
00029 #include <geos/geosAlgorithm.h>
00030 
00031 using namespace std;
00032 
00033 namespace geos {
00034 
00035 /*
00036  * \brief
00037  * The base class for operations that require GeometryGraph
00038  */
00039 class GeometryGraphOperation {
00040 friend class Unload;
00041 public:
00042         GeometryGraphOperation(const Geometry *g0,const Geometry *g1);
00043         GeometryGraphOperation(const Geometry *g0);
00044         virtual ~GeometryGraphOperation();
00045         const Geometry* getArgGeometry(int i) const;
00046 protected:
00047         static CGAlgorithms *cga;
00048         static LineIntersector *li;
00049         const PrecisionModel* resultPrecisionModel;
00050         /*
00051          * The operation args into an array so they can be accessed by index
00052          */
00053         vector<GeometryGraph*> *arg;  // the arg(s) of the operation
00054         void setComputationPrecision(const PrecisionModel* pm);
00055 };
00056 
00057 class EndpointInfo{
00058 public:
00059         Coordinate pt;
00060         bool isClosed;
00061         int degree;
00062         EndpointInfo(const Coordinate& newPt);
00063         void addEndpoint(bool newIsClosed);
00064 };
00065 
00066 /*
00067  * Tests whether a {@link Geometry} is simple.
00068  * Only {@link Geometry}s whose definition allows them
00069  * to be simple or non-simple are tested.  (E.g. Polygons must be simple
00070  * by definition, so no test is provided.  To test whether a given Polygon is valid,
00071  * use <code>Geometry#isValid</code>)
00072  *
00073  */
00074 class IsSimpleOp {
00075 public:
00076         IsSimpleOp();
00077         bool isSimple(const LineString *geom);
00078         bool isSimple(const MultiLineString *geom);
00079         bool isSimple(const MultiPoint *mp);
00080         bool isSimpleLinearGeometry(const Geometry *geom);
00081 private:
00082         bool hasNonEndpointIntersection(GeometryGraph *graph);
00083         bool hasClosedEndpointIntersection(GeometryGraph *graph);
00084         void addEndpoint(map<Coordinate,EndpointInfo*,CoordLT> *endPoints, const Coordinate& p,bool isClosed);
00085 };
00086 
00087 } // namespace geos
00088 
00089 #endif
00090 
00091 /**********************************************************************
00092  * $Log: operation.h,v $
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 Apr 19 07:10:19 2005 for GEOS by  doxygen 1.4.2