ogr_geometry.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: ogr_geometry.h,v 1.61 2006/03/31 17:57:32 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, warmerdam@pobox.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.61  2006/03/31 17:57:32  fwarmerdam
00033  * header updates
00034  *
00035  * Revision 1.60  2005/12/02 11:06:51  osemykin
00036  * added const for OGRLineString::getPoints(...)
00037  *
00038  * Revision 1.59  2005/10/21 15:58:00  fwarmerdam
00039  * getGEOSGeometryFactory now returns void *
00040  *
00041  * Revision 1.58  2005/10/21 14:58:53  fwarmerdam
00042  * don't use geos::Geometry typedef for GEOSGeom
00043  *
00044  * Revision 1.57  2005/10/20 19:55:29  fwarmerdam
00045  * added GEOS C API support
00046  *
00047  * Revision 1.56  2005/09/17 12:11:30  osemykin
00048  * added OGRLineString::getPoints
00049  *
00050  * Revision 1.55  2005/08/04 17:18:59  fwarmerdam
00051  * now have separate 2D and 3D OGRPoint constructors
00052  *
00053  * Revision 1.54  2005/07/20 01:43:51  fwarmerdam
00054  * upgraded OGR geometry dimension handling
00055  *
00056  * Revision 1.53  2005/03/25 06:31:12  fwarmerdam
00057  * added addSubLineString
00058  *
00059  * Revision 1.52  2005/02/22 12:48:09  fwarmerdam
00060  * added OGRGeometryFactory::haveGEOS()
00061  *
00062  * Revision 1.51  2005/02/22 12:37:26  fwarmerdam
00063  * rename Equal/Intersect to Equals/Intersects
00064  *
00065  * Revision 1.50  2004/09/17 15:05:36  fwarmerdam
00066  * added get_Area() support
00067  *
00068  * Revision 1.49  2004/08/20 21:21:28  warmerda
00069  * added support for managing a persistent geos::GeometryFactory
00070  *
00071  * Revision 1.48  2004/07/10 04:54:23  warmerda
00072  * added GEOS methods, and closeRings
00073  *
00074  * Revision 1.47  2004/02/21 15:36:14  warmerda
00075  * const correctness updates for geometry: bug 289
00076  *
00077  * Revision 1.46  2003/09/11 22:47:54  aamici
00078  * add class constructors and destructors where needed in order to
00079  * let the mingw/cygwin binutils produce sensible partially linked objet files
00080  * with 'ld -r'.
00081  *
00082  * Revision 1.45  2003/08/27 15:40:37  warmerda
00083  * added support for generating DB2 V7.2 compatible WKB
00084  *
00085  * Revision 1.44  2003/05/28 19:16:42  warmerda
00086  * fixed up argument names and stuff for docs
00087  *
00088  * Revision 1.43  2003/04/28 15:39:33  warmerda
00089  * ryan added forceToMultiPolyline and forceToMultiPoint
00090  *
00091  * Revision 1.42  2003/03/06 20:29:27  warmerda
00092  * added GML import/export entry points
00093  *
00094  * Revision 1.41  2003/01/14 22:13:35  warmerda
00095  * added isClockwise() method on OGRLinearRing
00096  *
00097  * Revision 1.40  2003/01/08 22:04:11  warmerda
00098  * added forceToPolygon and forceToMultiPolygon methods
00099  *
00100  * Revision 1.39  2003/01/07 16:44:27  warmerda
00101  * added removeGeometry
00102  *
00103  * Revision 1.38  2003/01/02 21:45:23  warmerda
00104  * move OGRBuildPolygonsFromEdges into C API
00105  *
00106  * Revision 1.37  2002/10/25 15:20:50  warmerda
00107  * fixed MULTIPOINT WKT format
00108  *
00109  * Revision 1.36  2002/10/24 20:53:02  warmerda
00110  * expand tabs
00111  *
00112  * Revision 1.35  2002/09/26 18:13:17  warmerda
00113  * moved some defs to ogr_core.h for sharing with ogr_api.h
00114  *
00115  * Revision 1.34  2002/09/11 13:47:17  warmerda
00116  * preliminary set of fixes for 3D WKB enum
00117  *
00118  * Revision 1.33  2002/08/12 15:02:18  warmerda
00119  * added OGRRawPoint and OGREnvelope initializes
00120  *
00121  * Revision 1.32  2002/05/02 19:45:36  warmerda
00122  * added flattenTo2D() method
00123  *
00124  * Revision 1.31  2002/02/22 22:23:38  warmerda
00125  * added tolerances when assembling polygons
00126  *
00127  * Revision 1.30  2002/02/18 21:12:23  warmerda
00128  * added OGRBuildPolygonFromEdges
00129  *
00130  * Revision 1.29  2001/11/01 16:56:08  warmerda
00131  * added createGeometry and destroyGeometry methods
00132  *
00133  * Revision 1.28  2001/09/21 16:24:20  warmerda
00134  * added transform() and transformTo() methods
00135  *
00136  * Revision 1.27  2001/09/04 14:48:34  warmerda
00137  * added some more 2.5D geometry types
00138  *
00139  * Revision 1.26  2001/05/24 18:05:18  warmerda
00140  * substantial fixes to WKT support for MULTIPOINT/LINE/POLYGON
00141  *
00142  * Revision 1.25  2001/02/06 17:10:28  warmerda
00143  * export entry points from DLL
00144  *
00145  * Revision 1.24  2001/01/19 21:10:47  warmerda
00146  * replaced tabs
00147  *
00148  * Revision 1.23  2000/10/17 17:55:26  warmerda
00149  * added comments for byte orders
00150  *
00151  * Revision 1.22  2000/04/26 18:25:55  warmerda
00152  * added missing CPL_DLL attributes
00153  *
00154  * Revision 1.21  2000/03/14 21:38:17  warmerda
00155  * added method to translate geometrytype to name
00156  *
00157  * Revision 1.20  1999/11/18 19:02:20  warmerda
00158  * expanded tabs
00159  *
00160  * Revision 1.19  1999/11/04 16:26:12  warmerda
00161  * Added the addGeometryDirectly() method for containers.
00162  *
00163  * Revision 1.18  1999/09/22 13:19:09  warmerda
00164  * Added the addRingDirectly() method on OGRPolygon.
00165  *
00166  * Revision 1.17  1999/09/13 14:34:07  warmerda
00167  * updated to use wkbZ of 0x8000 instead of 0x80000000
00168  *
00169  * Revision 1.16  1999/09/13 02:27:32  warmerda
00170  * incorporated limited 2.5d support
00171  *
00172  * Revision 1.15  1999/08/29 17:14:29  warmerda
00173  * Added wkbNone.
00174  *
00175  * Revision 1.14  1999/07/27 00:48:11  warmerda
00176  * Added Equal() support
00177  *
00178  * Revision 1.13  1999/07/08 20:26:03  warmerda
00179  * No longer override getGeometryType() on OGRLinearRing.
00180  *
00181  * Revision 1.12  1999/07/07 04:23:07  danmo
00182  * Fixed typo in  #define _OGR_..._H_INCLUDED  line
00183  *
00184  * Revision 1.11  1999/07/06 21:36:46  warmerda
00185  * tenatively added getEnvelope() and Intersect()
00186  *
00187  * Revision 1.10  1999/06/25 20:44:42  warmerda
00188  * implemented assignSpatialReference, carry properly
00189  *
00190  * Revision 1.9  1999/05/31 20:44:11  warmerda
00191  * ogr_geometry.h
00192  *
00193  * Revision 1.8  1999/05/31 15:01:59  warmerda
00194  * OGRCurve now an abstract base class with essentially no implementation.
00195  * Everything moved down to OGRLineString where it belongs.  Also documented
00196  * classes.
00197  *
00198  * Revision 1.7  1999/05/31 11:05:08  warmerda
00199  * added some documentation
00200  *
00201  * Revision 1.6  1999/05/23 05:34:40  warmerda
00202  * added support for clone(), multipolygons and geometry collections
00203  *
00204  * Revision 1.5  1999/05/20 14:35:44  warmerda
00205  * added support for well known text format
00206  *
00207  * Revision 1.4  1999/05/17 14:39:13  warmerda
00208  * Added ICurve, and some other IGeometry and related methods.
00209  *
00210  * Revision 1.3  1999/05/14 13:30:59  warmerda
00211  * added IsEmpty() and IsSimple()
00212  *
00213  * Revision 1.2  1999/03/30 21:21:43  warmerda
00214  * added linearring/polygon support
00215  *
00216  * Revision 1.1  1999/03/29 21:21:10  warmerda
00217  * New
00218  *
00219  */
00220 
00221 #ifndef _OGR_GEOMETRY_H_INCLUDED
00222 #define _OGR_GEOMETRY_H_INCLUDED
00223 
00224 #include "ogr_core.h"
00225 #include "ogr_spatialref.h"
00226 
00236 class OGRRawPoint
00237 {
00238   public:
00239           OGRRawPoint()
00240           {
00241                   x = y = 0.0;
00242           }
00243     double      x;
00244     double      y;
00245 };
00246 
00247 typedef struct GEOSGeom_t *GEOSGeom;
00248 
00249 /************************************************************************/
00250 /*                             OGRGeometry                              */
00251 /************************************************************************/
00252 
00262 class CPL_DLL OGRGeometry
00263 {
00264   private:
00265     OGRSpatialReference * poSRS;                // may be NULL
00266 
00267   protected:
00268     int                   nCoordDimension;
00269     
00270   public:
00271                 OGRGeometry();
00272     virtual     ~OGRGeometry();
00273                         
00274     // standard IGeometry
00275     virtual int getDimension() const = 0;
00276     virtual int getCoordinateDimension() const;
00277     virtual OGRBoolean  IsEmpty() const { return 0; } 
00278     virtual OGRBoolean  IsSimple() const { return 1; }
00279     virtual void        empty() = 0;
00280     virtual OGRGeometry *clone() const = 0;
00281     virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
00282 
00283     // IWks Interface
00284     virtual int WkbSize() const = 0;
00285     virtual OGRErr importFromWkb( unsigned char *, int=-1 )=0;
00286     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const = 0;
00287     virtual OGRErr importFromWkt( char ** ppszInput ) = 0;
00288     virtual OGRErr exportToWkt( char ** ppszDstText ) const = 0;
00289     
00290     // non-standard
00291     virtual OGRwkbGeometryType getGeometryType() const = 0;
00292     virtual const char *getGeometryName() const = 0;
00293     virtual void   dumpReadable( FILE *, const char * = NULL );
00294     virtual void   flattenTo2D() = 0;
00295     virtual char * exportToGML() const;
00296     virtual GEOSGeom exportToGEOS() const;
00297     virtual void closeRings();
00298 
00299     virtual void setCoordinateDimension( int nDimension ); 
00300 
00301     void    assignSpatialReference( OGRSpatialReference * poSR );
00302     OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
00303 
00304     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) = 0;
00305     OGRErr  transformTo( OGRSpatialReference *poSR );
00306 
00307     // ISpatialRelation
00308     virtual OGRBoolean  Intersects( OGRGeometry * ) const;
00309     virtual OGRBoolean  Equals( OGRGeometry * ) const = 0;
00310     virtual OGRBoolean  Disjoint( const OGRGeometry * ) const;
00311     virtual OGRBoolean  Touches( const OGRGeometry * ) const;
00312     virtual OGRBoolean  Crosses( const OGRGeometry * ) const;
00313     virtual OGRBoolean  Within( const OGRGeometry * ) const;
00314     virtual OGRBoolean  Contains( const OGRGeometry * ) const;
00315     virtual OGRBoolean  Overlaps( const OGRGeometry * ) const;
00316 //    virtual OGRBoolean  Relate( const OGRGeometry *, const char * ) const;
00317 
00318     virtual OGRGeometry *getBoundary() const;
00319     virtual double  Distance( const OGRGeometry * ) const;
00320     virtual OGRGeometry *ConvexHull() const;
00321     virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 ) const;
00322     virtual OGRGeometry *Intersection( const OGRGeometry *) const;
00323     virtual OGRGeometry *Union( const OGRGeometry * ) const;
00324     virtual OGRGeometry *Difference( const OGRGeometry * ) const;
00325     virtual OGRGeometry *SymmetricDifference( const OGRGeometry * ) const;
00326 
00327     // backward compatibility methods. 
00328     OGRBoolean  Intersect( OGRGeometry * ) const;
00329     OGRBoolean  Equal( OGRGeometry * ) const;
00330 
00331     // Special HACK for DB2 7.2 support
00332     static int bGenerate_DB2_V72_BYTE_ORDER;
00333 };
00334 
00335 /************************************************************************/
00336 /*                               OGRPoint                               */
00337 /************************************************************************/
00338 
00345 class CPL_DLL OGRPoint : public OGRGeometry
00346 {
00347     double      x;
00348     double      y;
00349     double      z;
00350 
00351   public:
00352                 OGRPoint();
00353                 OGRPoint( double x, double y );
00354                 OGRPoint( double x, double y, double z );
00355     virtual     ~OGRPoint();
00356 
00357     // IWks Interface
00358     virtual int WkbSize() const;
00359     virtual OGRErr importFromWkb( unsigned char *, int=-1 );
00360     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
00361     virtual OGRErr importFromWkt( char ** );
00362     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
00363     
00364     // IGeometry
00365     virtual int getDimension() const;
00366     virtual OGRGeometry *clone() const;
00367     virtual void empty();
00368     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00369 
00370     // IPoint
00371     double      getX() const { return x; } 
00372     double      getY() const { return y; }
00373     double      getZ() const { return z; }
00374 
00375     // Non standard
00376     void        setX( double xIn ) { x = xIn; }
00377     void        setY( double yIn ) { y = yIn; }
00378     void        setZ( double zIn ) { z = zIn; nCoordDimension=3; }
00379 
00380     // ISpatialRelation
00381     virtual OGRBoolean  Equals( OGRGeometry * ) const;
00382     
00383     // Non standard from OGRGeometry
00384     virtual const char *getGeometryName() const;
00385     virtual OGRwkbGeometryType getGeometryType() const;
00386     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
00387     virtual void flattenTo2D();
00388 
00389 };
00390 
00391 /************************************************************************/
00392 /*                               OGRCurve                               */
00393 /************************************************************************/
00394 
00399 class CPL_DLL OGRCurve : public OGRGeometry
00400 {
00401   public:
00402             OGRCurve();
00403     virtual ~OGRCurve();
00404     // ICurve methods
00405     virtual double get_Length() const = 0;
00406     virtual void StartPoint(OGRPoint *) const = 0;
00407     virtual void EndPoint(OGRPoint *) const = 0;
00408     virtual int  get_IsClosed() const;
00409     virtual void Value( double, OGRPoint * ) const = 0;
00410 
00411 };
00412 
00413 /************************************************************************/
00414 /*                            OGRLineString                             */
00415 /************************************************************************/
00416 
00421 class CPL_DLL OGRLineString : public OGRCurve
00422 {
00423   protected:
00424     int         nPointCount;
00425     OGRRawPoint *paoPoints;
00426     double      *padfZ;
00427 
00428     void        Make3D();
00429     void        Make2D();
00430 
00431   public:
00432                 OGRLineString();
00433     virtual     ~OGRLineString();
00434 
00435     // IWks Interface
00436     virtual int WkbSize() const;
00437     virtual OGRErr importFromWkb( unsigned char *, int = -1 );
00438     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
00439     virtual OGRErr importFromWkt( char ** );
00440     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
00441 
00442     // IGeometry interface
00443     virtual int getDimension() const;
00444     virtual OGRGeometry *clone() const;
00445     virtual void empty();
00446     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00447 
00448     // ICurve methods
00449     virtual double get_Length() const;
00450     virtual void StartPoint(OGRPoint *) const;
00451     virtual void EndPoint(OGRPoint *) const;
00452     virtual void Value( double, OGRPoint * ) const;
00453     
00454     // ILineString methods
00455     int         getNumPoints() const { return nPointCount; }
00456     void        getPoint( int, OGRPoint * ) const;
00457     double      getX( int i ) const { return paoPoints[i].x; }
00458     double      getY( int i ) const { return paoPoints[i].y; }
00459     double      getZ( int i ) const;
00460 
00461     // ISpatialRelation
00462     virtual OGRBoolean  Equals( OGRGeometry * ) const;
00463     
00464     // non standard.
00465     virtual void setCoordinateDimension( int nDimension ); 
00466     void        setNumPoints( int );
00467     void        setPoint( int, OGRPoint * );
00468     void        setPoint( int, double, double );
00469     void        setPoint( int, double, double, double );
00470     void        setPoints( int, OGRRawPoint *, double * = NULL );
00471     void        setPoints( int, double * padfX, double * padfY,
00472                            double *padfZ = NULL );
00473     void        addPoint( OGRPoint * );
00474     void        addPoint( double, double );
00475     void        addPoint( double, double, double );
00476 
00477     void        getPoints( OGRRawPoint *, double * = NULL ) const;
00478 
00479     void        addSubLineString( const OGRLineString *, 
00480                                   int nStartVertex = 0, int nEndVertex = -1 );
00481 
00482     // non-standard from OGRGeometry
00483     virtual OGRwkbGeometryType getGeometryType() const;
00484     virtual const char *getGeometryName() const;
00485     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
00486     virtual void flattenTo2D();
00487 
00488 };
00489 
00490 /************************************************************************/
00491 /*                            OGRLinearRing                             */
00492 /*                                                                      */
00493 /*      This is an alias for OGRLineString for now.                     */
00494 /************************************************************************/
00495 
00504 class CPL_DLL OGRLinearRing : public OGRLineString
00505 {
00506   private:
00507     friend class OGRPolygon; 
00508     
00509     // These are not IWks compatible ... just a convenience for OGRPolygon.
00510     virtual int _WkbSize( int b3D ) const;
00511     virtual OGRErr _importFromWkb( OGRwkbByteOrder, int b3D,
00512                                    unsigned char *, int=-1 );
00513     virtual OGRErr _exportToWkb( OGRwkbByteOrder, int b3D, 
00514                                  unsigned char * ) const;
00515     
00516   public:
00517                         OGRLinearRing();
00518                         OGRLinearRing( OGRLinearRing * );
00519                         ~OGRLinearRing();
00520 
00521     // Non standard.
00522     virtual const char *getGeometryName() const;
00523     virtual OGRGeometry *clone() const;
00524     virtual int isClockwise() const;
00525     virtual void closeRings();
00526     virtual double get_Area() const;
00527     
00528     // IWks Interface - Note this isnt really a first class object
00529     // for the purposes of WKB form.  These methods always fail since this
00530     // object cant be serialized on its own. 
00531     virtual int WkbSize() const;
00532     virtual OGRErr importFromWkb( unsigned char *, int=-1 );
00533     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
00534 };
00535 
00536 /************************************************************************/
00537 /*                              OGRSurface                              */
00538 /************************************************************************/
00539 
00544 class CPL_DLL OGRSurface : public OGRGeometry
00545 {
00546   public:
00547     virtual double      get_Area() const = 0;
00548     virtual OGRErr      Centroid( OGRPoint * poPoint ) const = 0;
00549     virtual OGRErr      PointOnSurface( OGRPoint * poPoint ) const = 0;
00550 };
00551 
00552 /************************************************************************/
00553 /*                              OGRPolygon                              */
00554 /************************************************************************/
00555 
00565 class CPL_DLL OGRPolygon : public OGRSurface
00566 {
00567     int         nRingCount;
00568     OGRLinearRing **papoRings;
00569     
00570   public:
00571                 OGRPolygon();
00572     virtual     ~OGRPolygon();
00573 
00574     // Non standard (OGRGeometry).
00575     virtual const char *getGeometryName() const;
00576     virtual OGRwkbGeometryType getGeometryType() const;
00577     virtual OGRGeometry *clone() const;
00578     virtual void empty();
00579     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
00580     virtual void flattenTo2D();
00581     
00582     // ISurface Interface
00583     virtual double      get_Area() const;
00584     virtual int         Centroid( OGRPoint * poPoint ) const;
00585     virtual int         PointOnSurface( OGRPoint * poPoint ) const;
00586     
00587     // IWks Interface
00588     virtual int WkbSize() const;
00589     virtual OGRErr importFromWkb( unsigned char *, int = -1 );
00590     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
00591     virtual OGRErr importFromWkt( char ** );
00592     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
00593 
00594     // IGeometry
00595     virtual int getDimension() const;
00596     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00597 
00598     // ISpatialRelation
00599     virtual OGRBoolean  Equals( OGRGeometry * ) const;
00600     
00601     // Non standard
00602     virtual void setCoordinateDimension( int nDimension ); 
00603 
00604     void        addRing( OGRLinearRing * );
00605     void        addRingDirectly( OGRLinearRing * );
00606 
00607     OGRLinearRing *getExteriorRing();
00608     const OGRLinearRing *getExteriorRing() const;
00609     int         getNumInteriorRings() const;
00610     OGRLinearRing *getInteriorRing( int );
00611     const OGRLinearRing *getInteriorRing( int ) const;
00612 
00613     virtual void closeRings();
00614 };
00615 
00616 /************************************************************************/
00617 /*                        OGRGeometryCollection                         */
00618 /************************************************************************/
00619 
00627 class CPL_DLL OGRGeometryCollection : public OGRGeometry
00628 {
00629     int         nGeomCount;
00630     OGRGeometry **papoGeoms;
00631 
00632     int         nCoordinateDimension;
00633     
00634   public:
00635                 OGRGeometryCollection();
00636     virtual     ~OGRGeometryCollection();
00637 
00638     // Non standard (OGRGeometry).
00639     virtual const char *getGeometryName() const;
00640     virtual OGRwkbGeometryType getGeometryType() const;
00641     virtual OGRGeometry *clone() const;
00642     virtual void empty();
00643     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
00644     virtual void flattenTo2D();
00645     
00646     // IWks Interface
00647     virtual int WkbSize() const;
00648     virtual OGRErr importFromWkb( unsigned char *, int = -1 );
00649     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char * ) const;
00650     virtual OGRErr importFromWkt( char ** );
00651     virtual OGRErr exportToWkt( char ** ppszDstText ) const;
00652 
00653     // IGeometry methods
00654     virtual int getDimension() const;
00655     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00656 
00657     // IGeometryCollection
00658     int         getNumGeometries() const;
00659     OGRGeometry *getGeometryRef( int );
00660     const OGRGeometry *getGeometryRef( int ) const;
00661 
00662     // ISpatialRelation
00663     virtual OGRBoolean  Equals( OGRGeometry * ) const;
00664     
00665     // Non standard
00666     virtual void setCoordinateDimension( int nDimension ); 
00667     virtual OGRErr addGeometry( const OGRGeometry * );
00668     virtual OGRErr addGeometryDirectly( OGRGeometry * );
00669     virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
00670 
00671     void closeRings();
00672 };
00673 
00674 /************************************************************************/
00675 /*                           OGRMultiPolygon                            */
00676 /************************************************************************/
00677 
00685 class CPL_DLL OGRMultiPolygon : public OGRGeometryCollection
00686 {
00687   public:
00688             OGRMultiPolygon();
00689     // Non standard (OGRGeometry).
00690     virtual const char *getGeometryName() const;
00691     virtual OGRwkbGeometryType getGeometryType() const;
00692     virtual OGRGeometry *clone() const;
00693     virtual OGRErr importFromWkt( char ** );
00694     virtual OGRErr exportToWkt( char ** ) const;
00695     
00696     // Non standard
00697     virtual OGRErr addGeometryDirectly( OGRGeometry * );
00698 
00699     double  get_Area() const;
00700 };
00701 
00702 /************************************************************************/
00703 /*                            OGRMultiPoint                             */
00704 /************************************************************************/
00705 
00710 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
00711 {
00712   private:
00713     OGRErr  importFromWkt_Bracketed( char ** );
00714 
00715   public:
00716             OGRMultiPoint();
00717     // Non standard (OGRGeometry).
00718     virtual const char *getGeometryName() const;
00719     virtual OGRwkbGeometryType getGeometryType() const;
00720     virtual OGRGeometry *clone() const;
00721     virtual OGRErr importFromWkt( char ** );
00722     virtual OGRErr exportToWkt( char ** ) const;
00723     
00724     // Non standard
00725     virtual OGRErr addGeometryDirectly( OGRGeometry * );
00726 };
00727 
00728 /************************************************************************/
00729 /*                          OGRMultiLineString                          */
00730 /************************************************************************/
00731 
00736 class CPL_DLL OGRMultiLineString : public OGRGeometryCollection
00737 {
00738   public:
00739             OGRMultiLineString();
00740             ~OGRMultiLineString();
00741     // Non standard (OGRGeometry).
00742     virtual const char *getGeometryName() const;
00743     virtual OGRwkbGeometryType getGeometryType() const;
00744     virtual OGRGeometry *clone() const;
00745     virtual OGRErr importFromWkt( char ** );
00746     virtual OGRErr exportToWkt( char ** ) const;
00747     
00748     // Non standard
00749     virtual OGRErr addGeometryDirectly( OGRGeometry * );
00750 };
00751 
00752 
00753 /************************************************************************/
00754 /*                          OGRGeometryFactory                          */
00755 /************************************************************************/
00756 
00761 class CPL_DLL OGRGeometryFactory
00762 {
00763   public:
00764     static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
00765                                  OGRGeometry **, int = -1 );
00766     static OGRErr createFromWkt( char **, OGRSpatialReference *,
00767                                  OGRGeometry ** );
00768     static OGRGeometry *createFromGML( const char * );
00769     static OGRGeometry *createFromGEOS( GEOSGeom );
00770 
00771     static void   destroyGeometry( OGRGeometry * );
00772     static OGRGeometry *createGeometry( OGRwkbGeometryType );
00773 
00774     static OGRGeometry * forceToPolygon( OGRGeometry * );
00775     static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
00776     static OGRGeometry * forceToMultiPoint( OGRGeometry * );
00777     static OGRGeometry * forceToMultiLineString( OGRGeometry * );
00778 
00779     static void *getGEOSGeometryFactory();
00780 
00781     static int haveGEOS();
00782 
00783 };
00784 
00785 #endif /* ndef _OGR_GEOMETRY_H_INCLUDED */

Generated for GDAL by doxygen 1.5.1.