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

operation.h

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

Generated on Fri Nov 26 21:30:45 2004 for GEOS by  doxygen 1.3.9.1