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

ogr_geometry.h

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

Generated on Mon Aug 29 04:05:42 2005 for OGR by doxygen 1.3.6