- Main Page
- Classes
- Files
- Directories
- Related Pages

- File List
- File Members

# ogr_geometry.h

Go to the documentation of this file.

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

Generated for GDAL by 1.5.1.