ogr_geometry.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: ogr_geometry.h,v 1.52 2005/02/22 12:48:09 fwarmerdam Exp $
00003  *
00004  * Project:  OpenGIS Simple Features Reference Implementation
00005  * Purpose:  Classes for manipulating simple features that is not specific
00006  *           to a particular interface technology.
00007  * Author:   Frank Warmerdam, warmerda@home.com
00008  *
00009  ******************************************************************************
00010  * Copyright (c) 1999, Frank Warmerdam
00011  *
00012  * Permission is hereby granted, free of charge, to any person obtaining a
00013  * copy of this software and associated documentation files (the "Software"),
00014  * to deal in the Software without restriction, including without limitation
00015  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00016  * and/or sell copies of the Software, and to permit persons to whom the
00017  * Software is furnished to do so, subject to the following conditions:
00018  *
00019  * The above copyright notice and this permission notice shall be included
00020  * in all copies or substantial portions of the Software.
00021  *
00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00023  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00024  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00025  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00026  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00027  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00028  * DEALINGS IN THE SOFTWARE.
00029  ******************************************************************************
00030  *
00031  * $Log: ogr_geometry.h,v $
00032  * Revision 1.52  2005/02/22 12:48:09  fwarmerdam
00033  * added OGRGeometryFactory::haveGEOS()
00034  *
00035  * Revision 1.51  2005/02/22 12:37:26  fwarmerdam
00036  * rename Equal/Intersect to Equals/Intersects
00037  *
00038  * Revision 1.50  2004/09/17 15:05:36  fwarmerdam
00039  * added get_Area() support
00040  *
00041  * Revision 1.49  2004/08/20 21:21:28  warmerda
00042  * added support for managing a persistent geos::GeometryFactory
00043  *
00044  * Revision 1.48  2004/07/10 04:54:23  warmerda
00045  * added GEOS methods, and closeRings
00046  *
00047  * Revision 1.47  2004/02/21 15:36:14  warmerda
00048  * const correctness updates for geometry: bug 289
00049  *
00050  * Revision 1.46  2003/09/11 22:47:54  aamici
00051  * add class constructors and destructors where needed in order to
00052  * let the mingw/cygwin binutils produce sensible partially linked objet files
00053  * with 'ld -r'.
00054  *
00055  * Revision 1.45  2003/08/27 15:40:37  warmerda
00056  * added support for generating DB2 V7.2 compatible WKB
00057  *
00058  * Revision 1.44  2003/05/28 19:16:42  warmerda
00059  * fixed up argument names and stuff for docs
00060  *
00061  * Revision 1.43  2003/04/28 15:39:33  warmerda
00062  * ryan added forceToMultiPolyline and forceToMultiPoint
00063  *
00064  * Revision 1.42  2003/03/06 20:29:27  warmerda
00065  * added GML import/export entry points
00066  *
00067  * Revision 1.41  2003/01/14 22:13:35  warmerda
00068  * added isClockwise() method on OGRLinearRing
00069  *
00070  * Revision 1.40  2003/01/08 22:04:11  warmerda
00071  * added forceToPolygon and forceToMultiPolygon methods
00072  *
00073  * Revision 1.39  2003/01/07 16:44:27  warmerda
00074  * added removeGeometry
00075  *
00076  * Revision 1.38  2003/01/02 21:45:23  warmerda
00077  * move OGRBuildPolygonsFromEdges into C API
00078  *
00079  * Revision 1.37  2002/10/25 15:20:50  warmerda
00080  * fixed MULTIPOINT WKT format
00081  *
00082  * Revision 1.36  2002/10/24 20:53:02  warmerda
00083  * expand tabs
00084  *
00085  * Revision 1.35  2002/09/26 18:13:17  warmerda
00086  * moved some defs to ogr_core.h for sharing with ogr_api.h
00087  *
00088  * Revision 1.34  2002/09/11 13:47:17  warmerda
00089  * preliminary set of fixes for 3D WKB enum
00090  *
00091  * Revision 1.33  2002/08/12 15:02:18  warmerda
00092  * added OGRRawPoint and OGREnvelope initializes
00093  *
00094  * Revision 1.32  2002/05/02 19:45:36  warmerda
00095  * added flattenTo2D() method
00096  *
00097  * Revision 1.31  2002/02/22 22:23:38  warmerda
00098  * added tolerances when assembling polygons
00099  *
00100  * Revision 1.30  2002/02/18 21:12:23  warmerda
00101  * added OGRBuildPolygonFromEdges
00102  *
00103  * Revision 1.29  2001/11/01 16:56:08  warmerda
00104  * added createGeometry and destroyGeometry methods
00105  *
00106  * Revision 1.28  2001/09/21 16:24:20  warmerda
00107  * added transform() and transformTo() methods
00108  *
00109  * Revision 1.27  2001/09/04 14:48:34  warmerda
00110  * added some more 2.5D geometry types
00111  *
00112  * Revision 1.26  2001/05/24 18:05:18  warmerda
00113  * substantial fixes to WKT support for MULTIPOINT/LINE/POLYGON
00114  *
00115  * Revision 1.25  2001/02/06 17:10:28  warmerda
00116  * export entry points from DLL
00117  *
00118  * Revision 1.24  2001/01/19 21:10:47  warmerda
00119  * replaced tabs
00120  *
00121  * Revision 1.23  2000/10/17 17:55:26  warmerda
00122  * added comments for byte orders
00123  *
00124  * Revision 1.22  2000/04/26 18:25:55  warmerda
00125  * added missing CPL_DLL attributes
00126  *
00127  * Revision 1.21  2000/03/14 21:38:17  warmerda
00128  * added method to translate geometrytype to name
00129  *
00130  * Revision 1.20  1999/11/18 19:02:20  warmerda
00131  * expanded tabs
00132  *
00133  * Revision 1.19  1999/11/04 16:26:12  warmerda
00134  * Added the addGeometryDirectly() method for containers.
00135  *
00136  * Revision 1.18  1999/09/22 13:19:09  warmerda
00137  * Added the addRingDirectly() method on OGRPolygon.
00138  *
00139  * Revision 1.17  1999/09/13 14:34:07  warmerda
00140  * updated to use wkbZ of 0x8000 instead of 0x80000000
00141  *
00142  * Revision 1.16  1999/09/13 02:27:32  warmerda
00143  * incorporated limited 2.5d support
00144  *
00145  * Revision 1.15  1999/08/29 17:14:29  warmerda
00146  * Added wkbNone.
00147  *
00148  * Revision 1.14  1999/07/27 00:48:11  warmerda
00149  * Added Equal() support
00150  *
00151  * Revision 1.13  1999/07/08 20:26:03  warmerda
00152  * No longer override getGeometryType() on OGRLinearRing.
00153  *
00154  * Revision 1.12  1999/07/07 04:23:07  danmo
00155  * Fixed typo in  #define _OGR_..._H_INCLUDED  line
00156  *
00157  * Revision 1.11  1999/07/06 21:36:46  warmerda
00158  * tenatively added getEnvelope() and Intersect()
00159  *
00160  * Revision 1.10  1999/06/25 20:44:42  warmerda
00161  * implemented assignSpatialReference, carry properly
00162  *
00163  * Revision 1.9  1999/05/31 20:44:11  warmerda
00164  * ogr_geometry.h
00165  *
00166  * Revision 1.8  1999/05/31 15:01:59  warmerda
00167  * OGRCurve now an abstract base class with essentially no implementation.
00168  * Everything moved down to OGRLineString where it belongs.  Also documented
00169  * classes.
00170  *
00171  * Revision 1.7  1999/05/31 11:05:08  warmerda
00172  * added some documentation
00173  *
00174  * Revision 1.6  1999/05/23 05:34:40  warmerda
00175  * added support for clone(), multipolygons and geometry collections
00176  *
00177  * Revision 1.5  1999/05/20 14:35:44  warmerda
00178  * added support for well known text format
00179  *
00180  * Revision 1.4  1999/05/17 14:39:13  warmerda
00181  * Added ICurve, and some other IGeometry and related methods.
00182  *
00183  * Revision 1.3  1999/05/14 13:30:59  warmerda
00184  * added IsEmpty() and IsSimple()
00185  *
00186  * Revision 1.2  1999/03/30 21:21:43  warmerda
00187  * added linearring/polygon support
00188  *
00189  * Revision 1.1  1999/03/29 21:21:10  warmerda
00190  * New
00191  *
00192  */
00193 
00194 #ifndef _OGR_GEOMETRY_H_INCLUDED
00195 #define _OGR_GEOMETRY_H_INCLUDED
00196 
00197 #include "ogr_core.h"
00198 #include "ogr_spatialref.h"
00199 
00209 class OGRRawPoint
00210 {
00211   public:
00212           OGRRawPoint()
00213           {
00214                   x = y = 0.0;
00215           }
00216     double      x;
00217     double      y;
00218 };
00219 
00220 namespace geos { 
00221     class Geometry;
00222     class GeometryFactory;
00223 };
00224 
00225 /************************************************************************/
00226 /*                             OGRGeometry                              */
00227 /************************************************************************/
00228 
00238 class CPL_DLL OGRGeometry
00239 {
00240   private:
00241     OGRSpatialReference * poSRS;                // may be NULL
00242     
00243   public:
00244                 OGRGeometry();
00245     virtual     ~OGRGeometry();
00246                         
00247     // standard IGeometry
00248     virtual int getDimension() const = 0;
00249     virtual int getCoordinateDimension() const = 0;
00250     virtual OGRBoolean  IsEmpty() const { return 0; } 
00251     virtual OGRBoolean  IsSimple() const { return 1; }
00252     virtual void        empty() = 0;
00253     virtual OGRGeometry *clone() const = 0;
00254     virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
00255 
00256     // IWks Interface
00257     virtual int WkbSize() const = 0;
00258     virtual OGRErr importFromWkb( unsigned char *, int=-1 )=0;
00259     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const = 0;
00260     virtual OGRErr importFromWkt( char ** ppszInput ) = 0;
00261     virtual OGRErr exportToWkt( char ** ppszDstText ) const = 0;
00262     
00263     // non-standard
00264     virtual OGRwkbGeometryType getGeometryType() const = 0;
00265     virtual const char *getGeometryName() const = 0;
00266     virtual void   dumpReadable( FILE *, const char * = NULL );
00267     virtual void   flattenTo2D() = 0;
00268     virtual char * exportToGML() const;
00269     virtual geos::Geometry *exportToGEOS() const;
00270     virtual void closeRings();
00271 
00272     void    assignSpatialReference( OGRSpatialReference * poSR );
00273     OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
00274 
00275     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) = 0;
00276     OGRErr  transformTo( OGRSpatialReference *poSR );
00277 
00278     // ISpatialRelation
00279     virtual OGRBoolean  Intersects( OGRGeometry * ) const;
00280     virtual OGRBoolean  Equals( OGRGeometry * ) const = 0;
00281     virtual OGRBoolean  Disjoint( const OGRGeometry * ) const;
00282     virtual OGRBoolean  Touches( const OGRGeometry * ) const;
00283     virtual OGRBoolean  Crosses( const OGRGeometry * ) const;
00284     virtual OGRBoolean  Within( const OGRGeometry * ) const;
00285     virtual OGRBoolean  Contains( const OGRGeometry * ) const;
00286     virtual OGRBoolean  Overlaps( const OGRGeometry * ) const;
00287 //    virtual OGRBoolean  Relate( const OGRGeometry *, const char * ) const;
00288 
00289     virtual OGRGeometry *getBoundary() const;
00290     virtual double  Distance( const OGRGeometry * ) const;
00291     virtual OGRGeometry *ConvexHull() const;
00292     virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 ) const;
00293     virtual OGRGeometry *Intersection( const OGRGeometry *) const;
00294     virtual OGRGeometry *Union( const OGRGeometry * ) const;
00295     virtual OGRGeometry *Difference( const OGRGeometry * ) const;
00296     virtual OGRGeometry *SymmetricDifference( const OGRGeometry * ) const;
00297 
00298     // backward compatibility methods. 
00299     OGRBoolean  Intersect( OGRGeometry * ) const;
00300     OGRBoolean  Equal( OGRGeometry * ) const;
00301 
00302     // Special HACK for DB2 7.2 support
00303     static int bGenerate_DB2_V72_BYTE_ORDER;
00304 };
00305 
00306 /************************************************************************/
00307 /*                               OGRPoint                               */
00308 /************************************************************************/
00309 
00316 class CPL_DLL OGRPoint : public OGRGeometry
00317 {
00318     double      x;
00319     double      y;
00320     double      z;
00321 
00322   public:
00323                 OGRPoint();
00324                 OGRPoint( double x, double y, double z = 0.0 );
00325     virtual     ~OGRPoint();
00326 
00327     // IWks Interface
00328     virtual int WkbSize() const;
00329     virtual OGRErr importFromWkb( unsigned char *, int=-1 );
00330     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
00331     virtual OGRErr importFromWkt( char ** );
00332     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
00333     
00334     // IGeometry
00335     virtual int getDimension() const;
00336     virtual int getCoordinateDimension() const;
00337     virtual OGRGeometry *clone() const;
00338     virtual void empty();
00339     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00340 
00341     // IPoint
00342     double      getX() const { return x; } 
00343     double      getY() const { return y; }
00344     double      getZ() const { return z; }
00345 
00346     // Non standard
00347     void        setX( double xIn ) { x = xIn; }
00348     void        setY( double yIn ) { y = yIn; }
00349     void        setZ( double zIn ) { z = zIn; }
00350 
00351     // ISpatialRelation
00352     virtual OGRBoolean  Equals( OGRGeometry * ) const;
00353     
00354     // Non standard from OGRGeometry
00355     virtual const char *getGeometryName() const;
00356     virtual OGRwkbGeometryType getGeometryType() const;
00357     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
00358     virtual void flattenTo2D();
00359 
00360 };
00361 
00362 /************************************************************************/
00363 /*                               OGRCurve                               */
00364 /************************************************************************/
00365 
00370 class CPL_DLL OGRCurve : public OGRGeometry
00371 {
00372   public:
00373             OGRCurve();
00374     virtual ~OGRCurve();
00375     // ICurve methods
00376     virtual double get_Length() const = 0;
00377     virtual void StartPoint(OGRPoint *) const = 0;
00378     virtual void EndPoint(OGRPoint *) const = 0;
00379     virtual int  get_IsClosed() const;
00380     virtual void Value( double, OGRPoint * ) const = 0;
00381 
00382 };
00383 
00384 /************************************************************************/
00385 /*                            OGRLineString                             */
00386 /************************************************************************/
00387 
00392 class CPL_DLL OGRLineString : public OGRCurve
00393 {
00394   protected:
00395     int         nPointCount;
00396     OGRRawPoint *paoPoints;
00397     double      *padfZ;
00398 
00399     void        Make3D();
00400     void        Make2D();
00401 
00402   public:
00403                 OGRLineString();
00404     virtual     ~OGRLineString();
00405 
00406     // IWks Interface
00407     virtual int WkbSize() const;
00408     virtual OGRErr importFromWkb( unsigned char *, int = -1 );
00409     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
00410     virtual OGRErr importFromWkt( char ** );
00411     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
00412 
00413     // IGeometry interface
00414     virtual int getDimension() const;
00415     virtual int getCoordinateDimension() const;
00416     virtual OGRGeometry *clone() const;
00417     virtual void empty();
00418     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00419 
00420     // ICurve methods
00421     virtual double get_Length() const;
00422     virtual void StartPoint(OGRPoint *) const;
00423     virtual void EndPoint(OGRPoint *) const;
00424     virtual void Value( double, OGRPoint * ) const;
00425     
00426     // ILineString methods
00427     int         getNumPoints() const { return nPointCount; }
00428     void        getPoint( int, OGRPoint * ) const;
00429     double      getX( int i ) const { return paoPoints[i].x; }
00430     double      getY( int i ) const { return paoPoints[i].y; }
00431     double      getZ( int i ) const;
00432 
00433     // ISpatialRelation
00434     virtual OGRBoolean  Equals( OGRGeometry * ) const;
00435     
00436     // non standard.
00437     void        setNumPoints( int );
00438     void        setPoint( int, OGRPoint * );
00439     void        setPoint( int, double, double, double = 0.0 );
00440     void        setPoints( int, OGRRawPoint *, double * = NULL );
00441     void        setPoints( int, double * padfX, double * padfY,
00442                            double *padfZ = NULL );
00443     void        addPoint( OGRPoint * );
00444     void        addPoint( double, double, double = 0.0 );
00445 
00446     // non-standard from OGRGeometry
00447     virtual OGRwkbGeometryType getGeometryType() const;
00448     virtual const char *getGeometryName() const;
00449     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
00450     virtual void flattenTo2D();
00451 
00452 };
00453 
00454 /************************************************************************/
00455 /*                            OGRLinearRing                             */
00456 /*                                                                      */
00457 /*      This is an alias for OGRLineString for now.                     */
00458 /************************************************************************/
00459 
00468 class CPL_DLL OGRLinearRing : public OGRLineString
00469 {
00470   private:
00471     friend class OGRPolygon; 
00472     
00473     // These are not IWks compatible ... just a convenience for OGRPolygon.
00474     virtual int _WkbSize( int b3D ) const;
00475     virtual OGRErr _importFromWkb( OGRwkbByteOrder, int b3D,
00476                                    unsigned char *, int=-1 );
00477     virtual OGRErr _exportToWkb( OGRwkbByteOrder, int b3D, 
00478                                  unsigned char * ) const;
00479     
00480   public:
00481                         OGRLinearRing();
00482                         OGRLinearRing( OGRLinearRing * );
00483                         ~OGRLinearRing();
00484 
00485     // Non standard.
00486     virtual const char *getGeometryName() const;
00487     virtual OGRGeometry *clone() const;
00488     virtual int isClockwise() const;
00489     virtual void closeRings();
00490     virtual double get_Area() const;
00491     
00492     // IWks Interface - Note this isnt really a first class object
00493     // for the purposes of WKB form.  These methods always fail since this
00494     // object cant be serialized on its own. 
00495     virtual int WkbSize() const;
00496     virtual OGRErr importFromWkb( unsigned char *, int=-1 );
00497     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
00498 };
00499 
00500 /************************************************************************/
00501 /*                              OGRSurface                              */
00502 /************************************************************************/
00503 
00508 class CPL_DLL OGRSurface : public OGRGeometry
00509 {
00510   public:
00511     virtual double      get_Area() const = 0;
00512     virtual OGRErr      Centroid( OGRPoint * poPoint ) const = 0;
00513     virtual OGRErr      PointOnSurface( OGRPoint * poPoint ) const = 0;
00514 };
00515 
00516 /************************************************************************/
00517 /*                              OGRPolygon                              */
00518 /************************************************************************/
00519 
00529 class CPL_DLL OGRPolygon : public OGRSurface
00530 {
00531     int         nRingCount;
00532     OGRLinearRing **papoRings;
00533     
00534   public:
00535                 OGRPolygon();
00536     virtual     ~OGRPolygon();
00537 
00538     // Non standard (OGRGeometry).
00539     virtual const char *getGeometryName() const;
00540     virtual OGRwkbGeometryType getGeometryType() const;
00541     virtual OGRGeometry *clone() const;
00542     virtual void empty();
00543     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
00544     virtual void flattenTo2D();
00545     
00546     // ISurface Interface
00547     virtual double      get_Area() const;
00548     virtual int         Centroid( OGRPoint * poPoint ) const;
00549     virtual int         PointOnSurface( OGRPoint * poPoint ) const;
00550     
00551     // IWks Interface
00552     virtual int WkbSize() const;
00553     virtual OGRErr importFromWkb( unsigned char *, int = -1 );
00554     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
00555     virtual OGRErr importFromWkt( char ** );
00556     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
00557 
00558     // IGeometry
00559     virtual int getDimension() const;
00560     virtual int getCoordinateDimension() const;
00561     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00562 
00563     // ISpatialRelation
00564     virtual OGRBoolean  Equals( OGRGeometry * ) const;
00565     
00566     // Non standard
00567     void        addRing( OGRLinearRing * );
00568     void        addRingDirectly( OGRLinearRing * );
00569 
00570     OGRLinearRing *getExteriorRing();
00571     const OGRLinearRing *getExteriorRing() const;
00572     int         getNumInteriorRings() const;
00573     OGRLinearRing *getInteriorRing( int );
00574     const OGRLinearRing *getInteriorRing( int ) const;
00575 
00576     virtual void closeRings();
00577 };
00578 
00579 /************************************************************************/
00580 /*                        OGRGeometryCollection                         */
00581 /************************************************************************/
00582 
00590 class CPL_DLL OGRGeometryCollection : public OGRGeometry
00591 {
00592     int         nGeomCount;
00593     OGRGeometry **papoGeoms;
00594 
00595     int         nCoordinateDimension;
00596     
00597   public:
00598                 OGRGeometryCollection();
00599     virtual     ~OGRGeometryCollection();
00600 
00601     // Non standard (OGRGeometry).
00602     virtual const char *getGeometryName() const;
00603     virtual OGRwkbGeometryType getGeometryType() const;
00604     virtual OGRGeometry *clone() const;
00605     virtual void empty();
00606     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
00607     virtual void flattenTo2D();
00608     
00609     // IWks Interface
00610     virtual int WkbSize() const;
00611     virtual OGRErr importFromWkb( unsigned char *, int = -1 );
00612     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
00613     virtual OGRErr importFromWkt( char ** );
00614     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
00615 
00616     // IGeometry methods
00617     virtual int getDimension() const;
00618     virtual int getCoordinateDimension() const;
00619     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00620 
00621     // IGeometryCollection
00622     int         getNumGeometries() const;
00623     OGRGeometry *getGeometryRef( int );
00624     const OGRGeometry *getGeometryRef( int ) const;
00625 
00626     // ISpatialRelation
00627     virtual OGRBoolean  Equals( OGRGeometry * ) const;
00628     
00629     // Non standard
00630     virtual OGRErr addGeometry( const OGRGeometry * );
00631     virtual OGRErr addGeometryDirectly( OGRGeometry * );
00632     virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
00633 
00634     void closeRings();
00635 };
00636 
00637 /************************************************************************/
00638 /*                           OGRMultiPolygon                            */
00639 /************************************************************************/
00640 
00648 class CPL_DLL OGRMultiPolygon : public OGRGeometryCollection
00649 {
00650   public:
00651             OGRMultiPolygon();
00652     // Non standard (OGRGeometry).
00653     virtual const char *getGeometryName() const;
00654     virtual OGRwkbGeometryType getGeometryType() const;
00655     virtual OGRGeometry *clone() const;
00656     virtual OGRErr importFromWkt( char ** );
00657     virtual OGRErr exportToWkt( char ** ) const;
00658     
00659     // Non standard
00660     virtual OGRErr addGeometryDirectly( OGRGeometry * );
00661 
00662     double  get_Area() const;
00663 };
00664 
00665 /************************************************************************/
00666 /*                            OGRMultiPoint                             */
00667 /************************************************************************/
00668 
00673 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
00674 {
00675   private:
00676     OGRErr  importFromWkt_Bracketed( char ** );
00677 
00678   public:
00679             OGRMultiPoint();
00680     // Non standard (OGRGeometry).
00681     virtual const char *getGeometryName() const;
00682     virtual OGRwkbGeometryType getGeometryType() const;
00683     virtual OGRGeometry *clone() const;
00684     virtual OGRErr importFromWkt( char ** );
00685     virtual OGRErr exportToWkt( char ** ) const;
00686     
00687     // Non standard
00688     virtual OGRErr addGeometryDirectly( OGRGeometry * );
00689 };
00690 
00691 /************************************************************************/
00692 /*                          OGRMultiLineString                          */
00693 /************************************************************************/
00694 
00699 class CPL_DLL OGRMultiLineString : public OGRGeometryCollection
00700 {
00701   public:
00702             OGRMultiLineString();
00703             ~OGRMultiLineString();
00704     // Non standard (OGRGeometry).
00705     virtual const char *getGeometryName() const;
00706     virtual OGRwkbGeometryType getGeometryType() const;
00707     virtual OGRGeometry *clone() const;
00708     virtual OGRErr importFromWkt( char ** );
00709     virtual OGRErr exportToWkt( char ** ) const;
00710     
00711     // Non standard
00712     virtual OGRErr addGeometryDirectly( OGRGeometry * );
00713 };
00714 
00715 
00716 /************************************************************************/
00717 /*                          OGRGeometryFactory                          */
00718 /************************************************************************/
00719 
00724 class CPL_DLL OGRGeometryFactory
00725 {
00726   public:
00727     static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
00728                                  OGRGeometry **, int = -1 );
00729     static OGRErr createFromWkt( char **, OGRSpatialReference *,
00730                                  OGRGeometry ** );
00731     static OGRGeometry *createFromGML( const char * );
00732     static OGRGeometry *createFromGEOS( const geos::Geometry * );
00733 
00734     static void   destroyGeometry( OGRGeometry * );
00735     static OGRGeometry *createGeometry( OGRwkbGeometryType );
00736 
00737     static OGRGeometry * forceToPolygon( OGRGeometry * );
00738     static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
00739     static OGRGeometry * forceToMultiPoint( OGRGeometry * );
00740     static OGRGeometry * forceToMultiLineString( OGRGeometry * );
00741 
00742     static geos::GeometryFactory *getGEOSGeometryFactory();
00743 
00744     static int haveGEOS();
00745 
00746 };
00747 
00748 #endif /* ndef _OGR_GEOMETRY_H_INCLUDED */

Generated on Mon Jan 9 18:03:31 2006 for OGR by  doxygen 1.4.6