ogr_geometry.h

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

Generated on Sun Jul 2 22:18:21 2006 for OGR by  doxygen 1.4.6