- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

# ogr_geometry.h

Go to the documentation of this file.

    00001 /******************************************************************************
    00002  * $Id: ogr_geometry.h 28123 2014-12-10 19:27:55Z rouault $
    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  * Copyright (c) 2008-2014, Even Rouault <even dot rouault at mines-paris dot org>
    00012  *
    00013  * Permission is hereby granted, free of charge, to any person obtaining a
    00014  * copy of this software and associated documentation files (the "Software"),
    00015  * to deal in the Software without restriction, including without limitation
    00016  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00017  * and/or sell copies of the Software, and to permit persons to whom the
    00018  * Software is furnished to do so, subject to the following conditions:
    00019  *
    00020  * The above copyright notice and this permission notice shall be included
    00021  * in all copies or substantial portions of the Software.
    00022  *
    00023  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00024  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00025  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    00026  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00027  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00028  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00029  * DEALINGS IN THE SOFTWARE.
    00030  ****************************************************************************/
    00031
    00032 #ifndef _OGR_GEOMETRY_H_INCLUDED
    00033 #define _OGR_GEOMETRY_H_INCLUDED
    00034
    00035 #include "ogr_core.h"
    00036 #include "ogr_spatialref.h"
    00037
    00047 class OGRRawPoint
    00048 {
    00049   public:
    00050           OGRRawPoint()
    00051           {
    00052                   x = y = 0.0;
    00053           }
    00054
    00055           OGRRawPoint(double x, double y) : x(x), y(y) {}
    00056     double      x;
    00057     double      y;
    00058 };
    00059
    00060 typedef struct GEOSGeom_t *GEOSGeom;
    00061 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
    00062
    00063 class OGRPoint;
    00064 class OGRCurve;
    00065 class OGRCompoundCurve;
    00066 class OGRLinearRing;
    00067 class OGRLineString;
    00068 class OGRSurface;
    00069 class OGRCurvePolygon;
    00070 class OGRPolygon;
    00071 class OGRMultiSurface;
    00072 class OGRMultiPolygon;
    00073 class OGRMultiCurve;
    00074 class OGRMultiLineString;
    00075
    00076 typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
    00077 typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
    00078
    00079 typedef OGRPolygon*      (*OGRSurfaceCasterToPolygon)(OGRSurface*);
    00080 typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
    00081
    00082 /************************************************************************/
    00083 /*                             OGRGeometry                              */
    00084 /************************************************************************/
    00085
    00104 class CPL_DLL OGRGeometry
    00105 {
    00106   private:
    00107     OGRSpatialReference * poSRS;                // may be NULL
    00108
    00109   protected:
    00110     friend class OGRCurveCollection;
    00111
    00112     int                   nCoordDimension;
    00113
    00114     OGRErr                importPreambuleFromWkt( char ** ppszInput,
    00115                                                   int* pbHasZ, int* pbHasM );
    00116     OGRErr                importCurveCollectionFromWkt( char ** ppszInput,
    00117                                                   int bAllowEmptyComponent,
    00118                                                   int bAllowLineString,
    00119                                                   int bAllowCurve,
    00120                                                   int bAllowCompoundCurve,
    00121                                                   OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf, OGRCurve* poCurve) );
    00122     OGRErr                importPreambuleFromWkb( unsigned char * pabyData,
    00123                                                   int nSize,
    00124                                                   OGRwkbByteOrder& eByteOrder,
    00125                                                   OGRBoolean& b3D,
    00126                                                   OGRwkbVariant eWkbVariant );
    00127     OGRErr                importPreambuleOfCollectionFromWkb(
    00128                                                         unsigned char * pabyData,
    00129                                                         int& nSize,
    00130                                                         int& nDataOffset,
    00131                                                         OGRwkbByteOrder& eByteOrder,
    00132                                                         int nMinSubGeomSize,
    00133                                                         int& nGeomCount,
    00134                                                         OGRwkbVariant eWkbVariant );
    00135   public:
    00136                 OGRGeometry();
    00137     virtual     ~OGRGeometry();
    00138
    00139     // standard IGeometry
    00140     virtual int getDimension() const = 0;
    00141     virtual int getCoordinateDimension() const;
    00142     virtual OGRBoolean  IsEmpty() const = 0;
    00143     virtual OGRBoolean  IsValid() const;
    00144     virtual OGRBoolean  IsSimple() const;
    00145     virtual OGRBoolean  IsRing() const;
    00146     virtual void        empty() = 0;
    00147     virtual OGRGeometry *clone() const = 0;
    00148     virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
    00149     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
    00150
    00151     // IWks Interface
    00152     virtual int WkbSize() const = 0;
    00153     virtual OGRErr importFromWkb( unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc )=0;
    00154     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const = 0;
    00155     virtual OGRErr importFromWkt( char ** ppszInput ) = 0;
    00156     virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const = 0;
    00157
    00158     // non-standard
    00159     virtual OGRwkbGeometryType getGeometryType() const = 0;
    00160     OGRwkbGeometryType    getIsoGeometryType() const;
    00161     virtual const char *getGeometryName() const = 0;
    00162     virtual void   dumpReadable( FILE *, const char * = NULL, char** papszOptions = NULL ) const;
    00163     virtual void   flattenTo2D() = 0;
    00164     virtual char * exportToGML( const char* const * papszOptions = NULL ) const;
    00165         virtual char * exportToKML() const;
    00166     virtual char * exportToJson() const;
    00167
    00168     static GEOSContextHandle_t createGEOSContext();
    00169     static void freeGEOSContext(GEOSContextHandle_t hGEOSCtxt);
    00170     virtual GEOSGeom exportToGEOS(GEOSContextHandle_t hGEOSCtxt) const;
    00171     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    00172     virtual OGRGeometry* getCurveGeometry(const char* const* papszOptions = NULL) const;
    00173     virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
    00174                                              const char* const* papszOptions = NULL) const;
    00175
    00176     virtual void closeRings();
    00177
    00178     virtual void setCoordinateDimension( int nDimension );
    00179
    00180     void    assignSpatialReference( OGRSpatialReference * poSR );
    00181     OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
    00182
    00183     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) = 0;
    00184     OGRErr  transformTo( OGRSpatialReference *poSR );
    00185
    00186     virtual void segmentize(double dfMaxLength);
    00187
    00188     // ISpatialRelation
    00189     virtual OGRBoolean  Intersects( const OGRGeometry * ) const;
    00190     virtual OGRBoolean  Equals( OGRGeometry * ) const = 0;
    00191     virtual OGRBoolean  Disjoint( const OGRGeometry * ) const;
    00192     virtual OGRBoolean  Touches( const OGRGeometry * ) const;
    00193     virtual OGRBoolean  Crosses( const OGRGeometry * ) const;
    00194     virtual OGRBoolean  Within( const OGRGeometry * ) const;
    00195     virtual OGRBoolean  Contains( const OGRGeometry * ) const;
    00196     virtual OGRBoolean  Overlaps( const OGRGeometry * ) const;
    00197 //    virtual OGRBoolean  Relate( const OGRGeometry *, const char * ) const;
    00198
    00199     virtual OGRGeometry *Boundary() const;
    00200     virtual double  Distance( const OGRGeometry * ) const;
    00201     virtual OGRGeometry *ConvexHull() const;
    00202     virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 ) const;
    00203     virtual OGRGeometry *Intersection( const OGRGeometry *) const;
    00204     virtual OGRGeometry *Union( const OGRGeometry * ) const;
    00205     virtual OGRGeometry *UnionCascaded() const;
    00206     virtual OGRGeometry *Difference( const OGRGeometry * ) const;
    00207     virtual OGRGeometry *SymDifference( const OGRGeometry * ) const;
    00208     virtual OGRErr       Centroid( OGRPoint * poPoint ) const;
    00209     virtual OGRGeometry *Simplify(double dTolerance) const;
    00210     OGRGeometry *SimplifyPreserveTopology(double dTolerance) const;
    00211
    00212     virtual OGRGeometry *Polygonize() const;
    00213
    00214     // backward compatibility to non-standard method names.
    00215     OGRBoolean  Intersect( OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use Intersects() instead");
    00216     OGRBoolean  Equal( OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use Equals() instead");
    00217     virtual OGRGeometry *SymmetricDifference( const OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use SymDifference() instead");
    00218     virtual OGRGeometry *getBoundary() const CPL_WARN_DEPRECATED("Non standard method. Use Boundary() instead");
    00219
    00220     // Special HACK for DB2 7.2 support
    00221     static int bGenerate_DB2_V72_BYTE_ORDER;
    00222
    00223     virtual void        swapXY();
    00224
    00225     static OGRGeometry* CastToIdentity(OGRGeometry* poGeom) { return poGeom; }
    00226     static OGRGeometry* CastToError(OGRGeometry* poGeom);
    00227 };
    00228
    00229 /************************************************************************/
    00230 /*                               OGRPoint                               */
    00231 /************************************************************************/
    00232
    00239 class CPL_DLL OGRPoint : public OGRGeometry
    00240 {
    00241     double      x;
    00242     double      y;
    00243     double      z;
    00244
    00245   public:
    00246                 OGRPoint();
    00247                 OGRPoint( double x, double y );
    00248                 OGRPoint( double x, double y, double z );
    00249     virtual     ~OGRPoint();
    00250
    00251     // IWks Interface
    00252     virtual int WkbSize() const;
    00253     virtual OGRErr importFromWkb( unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc );
    00254     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
    00255     virtual OGRErr importFromWkt( char ** );
    00256     virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
    00257
    00258     // IGeometry
    00259     virtual int getDimension() const;
    00260     virtual int getCoordinateDimension() const;
    00261     virtual OGRGeometry *clone() const;
    00262     virtual void empty();
    00263     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
    00264     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
    00265     virtual OGRBoolean  IsEmpty() const;
    00266
    00267     // IPoint
    00268     double      getX() const { return x; }
    00269     double      getY() const { return y; }
    00270     double      getZ() const { return z; }
    00271
    00272     // Non standard
    00273     virtual void setCoordinateDimension( int nDimension );
    00274     void        setX( double xIn ) { x = xIn; if (nCoordDimension <= 0) nCoordDimension = 2; }
    00275     void        setY( double yIn ) { y = yIn; if (nCoordDimension <= 0) nCoordDimension = 2; }
    00276     void        setZ( double zIn ) { z = zIn; nCoordDimension=3; }
    00277
    00278     // ISpatialRelation
    00279     virtual OGRBoolean  Equals( OGRGeometry * ) const;
    00280     virtual OGRBoolean  Intersects( const OGRGeometry * ) const;
    00281     virtual OGRBoolean  Within( const OGRGeometry * ) const;
    00282
    00283     // Non standard from OGRGeometry
    00284     virtual const char *getGeometryName() const;
    00285     virtual OGRwkbGeometryType getGeometryType() const;
    00286     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
    00287     virtual void flattenTo2D();
    00288
    00289     virtual void        swapXY();
    00290 };
    00291
    00292 /************************************************************************/
    00293 /*                            OGRPointIterator                          */
    00294 /************************************************************************/
    00295
    00302 class CPL_DLL OGRPointIterator
    00303 {
    00304     public:
    00305         virtual ~OGRPointIterator();
    00306         virtual OGRBoolean getNextPoint(OGRPoint* p) = 0;
    00307
    00308         static void destroy(OGRPointIterator*);
    00309 };
    00310
    00311 /************************************************************************/
    00312 /*                               OGRCurve                               */
    00313 /************************************************************************/
    00314
    00320 class CPL_DLL OGRCurve : public OGRGeometry
    00321 {
    00322   protected:
    00323             OGRCurve();
    00324
    00325     virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
    00326     virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
    00327
    00328     friend class OGRCurvePolygon;
    00329     friend class OGRCompoundCurve;
    00330     virtual int    ContainsPoint( const OGRPoint* p ) const;
    00331     virtual double get_AreaOfCurveSegments() const = 0;
    00332
    00333   public:
    00334     virtual ~OGRCurve();
    00335
    00336     // ICurve methods
    00337     virtual double get_Length() const = 0;
    00338     virtual void StartPoint(OGRPoint *) const = 0;
    00339     virtual void EndPoint(OGRPoint *) const = 0;
    00340     virtual int  get_IsClosed() const;
    00341     virtual void Value( double, OGRPoint * ) const = 0;
    00342     virtual OGRLineString* CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
    00343                                        const char* const* papszOptions = NULL) const = 0;
    00344     virtual int getDimension() const;
    00345
    00346     // non standard
    00347     virtual int getNumPoints() const = 0;
    00348     virtual OGRPointIterator* getPointIterator() const = 0;
    00349     virtual OGRBoolean IsConvex() const;
    00350     virtual double get_Area() const = 0;
    00351
    00352     static OGRCompoundCurve* CastToCompoundCurve(OGRCurve* puCurve);
    00353     static OGRLineString*    CastToLineString(OGRCurve* poCurve);
    00354     static OGRLinearRing*    CastToLinearRing(OGRCurve* poCurve);
    00355 };
    00356
    00357 /************************************************************************/
    00358 /*                             OGRSimpleCurve                           */
    00359 /************************************************************************/
    00360
    00370 class CPL_DLL OGRSimpleCurve: public OGRCurve
    00371 {
    00372   protected:
    00373     friend class OGRGeometry;
    00374
    00375     int         nPointCount;
    00376     OGRRawPoint *paoPoints;
    00377     double      *padfZ;
    00378
    00379     void        Make3D();
    00380     void        Make2D();
    00381
    00382     OGRErr      importFromWKTListOnly( char ** ppszInput, int bHasZ, int bHasM,
    00383                                        OGRRawPoint*& paoPointsIn, int& nMaxPoints,
    00384                                        double*& padfZIn );
    00385
    00386     virtual double get_LinearArea() const;
    00387
    00388                 OGRSimpleCurve();
    00389
    00390   public:
    00391     virtual     ~OGRSimpleCurve();
    00392
    00393     // IWks Interface
    00394     virtual int WkbSize() const;
    00395     virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
    00396     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
    00397     virtual OGRErr importFromWkt( char ** );
    00398     virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
    00399
    00400     // IGeometry interface
    00401     virtual OGRGeometry *clone() const;
    00402     virtual void empty();
    00403     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
    00404     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
    00405     virtual OGRBoolean  IsEmpty() const;
    00406
    00407     // ICurve methods
    00408     virtual double get_Length() const;
    00409     virtual void StartPoint(OGRPoint *) const;
    00410     virtual void EndPoint(OGRPoint *) const;
    00411     virtual void Value( double, OGRPoint * ) const;
    00412     virtual double Project(const OGRPoint *) const;
    00413     virtual OGRLineString* getSubLine(double, double, int) const;
    00414
    00415     // ILineString methods
    00416     virtual int getNumPoints() const { return nPointCount; }
    00417     void        getPoint( int, OGRPoint * ) const;
    00418     double      getX( int i ) const { return paoPoints[i].x; }
    00419     double      getY( int i ) const { return paoPoints[i].y; }
    00420     double      getZ( int i ) const;
    00421
    00422     // ISpatialRelation
    00423     virtual OGRBoolean  Equals( OGRGeometry * ) const;
    00424
    00425     // non standard.
    00426     virtual void setCoordinateDimension( int nDimension );
    00427     void        setNumPoints( int nNewPointCount, int bZeroizeNewContent = TRUE );
    00428     void        setPoint( int, OGRPoint * );
    00429     void        setPoint( int, double, double );
    00430     void        setZ( int, double );
    00431     void        setPoint( int, double, double, double );
    00432     void        setPoints( int, OGRRawPoint *, double * = NULL );
    00433     void        setPoints( int, double * padfX, double * padfY,
    00434                            double *padfZIn = NULL );
    00435     void        addPoint( OGRPoint * );
    00436     void        addPoint( double, double );
    00437     void        addPoint( double, double, double );
    00438
    00439     void        getPoints( OGRRawPoint *, double * = NULL ) const;
    00440     void        getPoints( void* pabyX, int nXStride,
    00441                            void* pabyY, int nYStride,
    00442                            void* pabyZ = NULL, int nZStride = 0 ) const;
    00443
    00444     void        addSubLineString( const OGRLineString *,
    00445                                   int nStartVertex = 0, int nEndVertex = -1 );
    00446     void        reversePoints( void );
    00447     virtual OGRPointIterator* getPointIterator() const;
    00448
    00449     // non-standard from OGRGeometry
    00450     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
    00451     virtual void flattenTo2D();
    00452     virtual void segmentize(double dfMaxLength);
    00453
    00454     virtual void        swapXY();
    00455 };
    00456
    00457 /************************************************************************/
    00458 /*                            OGRLineString                             */
    00459 /************************************************************************/
    00460
    00468 class CPL_DLL OGRLineString : public OGRSimpleCurve
    00469 {
    00470   protected:
    00471     static OGRLineString* TransferMembersAndDestroy(
    00472                                             OGRLineString* poSrc,
    00473                                             OGRLineString* poDst);
    00474
    00475     static OGRLinearRing* CastToLinearRing(OGRLineString* poLS);
    00476
    00477     virtual OGRCurveCasterToLineString GetCasterToLineString() const;
    00478     virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const;
    00479
    00480     virtual double get_AreaOfCurveSegments() const;
    00481
    00482   public:
    00483                 OGRLineString();
    00484     virtual    ~OGRLineString();
    00485
    00486     virtual OGRLineString* CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
    00487                                        const char* const* papszOptions = NULL) const;
    00488     virtual OGRGeometry* getCurveGeometry(const char* const* papszOptions = NULL) const;
    00489     virtual double get_Area() const;
    00490
    00491     // non-standard from OGRGeometry
    00492     virtual OGRwkbGeometryType getGeometryType() const;
    00493     virtual const char *getGeometryName() const;
    00494 };
    00495
    00496 /************************************************************************/
    00497 /*                            OGRLinearRing                             */
    00498 /************************************************************************/
    00499
    00520 class CPL_DLL OGRLinearRing : public OGRLineString
    00521 {
    00522   protected:
    00523     friend class OGRPolygon;
    00524
    00525     // These are not IWks compatible ... just a convenience for OGRPolygon.
    00526     virtual int _WkbSize( int b3D ) const;
    00527     virtual OGRErr _importFromWkb( OGRwkbByteOrder, int b3D,
    00528                                    unsigned char *, int=-1 );
    00529     virtual OGRErr _exportToWkb( OGRwkbByteOrder, int b3D,
    00530                                  unsigned char * ) const;
    00531
    00532     static OGRLineString* CastToLineString(OGRLinearRing* poLR);
    00533
    00534     virtual OGRCurveCasterToLineString GetCasterToLineString() const;
    00535     virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const;
    00536
    00537   public:
    00538                         OGRLinearRing();
    00539                         OGRLinearRing( OGRLinearRing * );
    00540     virtual            ~OGRLinearRing();
    00541
    00542     // Non standard.
    00543     virtual const char *getGeometryName() const;
    00544     virtual OGRGeometry *clone() const;
    00545     virtual int isClockwise() const;
    00546     virtual void reverseWindingOrder();
    00547     virtual void closeRings();
    00548     OGRBoolean isPointInRing(const OGRPoint* pt, int bTestEnvelope = TRUE) const;
    00549     OGRBoolean isPointOnRingBoundary(const OGRPoint* pt, int bTestEnvelope = TRUE) const;
    00550
    00551     // IWks Interface - Note this isnt really a first class object
    00552     // for the purposes of WKB form.  These methods always fail since this
    00553     // object cant be serialized on its own.
    00554     virtual int WkbSize() const;
    00555     virtual OGRErr importFromWkb( unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc );
    00556     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
    00557 };
    00558
    00559 /************************************************************************/
    00560 /*                         OGRCircularString                            */
    00561 /************************************************************************/
    00562
    00575 class CPL_DLL OGRCircularString : public OGRSimpleCurve
    00576 {
    00577   private:
    00578     void        ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
    00579     OGRBoolean  IsValidFast() const;
    00580     int         IsFullCircle( double& cx, double& cy, double& square_R ) const;
    00581
    00582   protected:
    00583     virtual OGRCurveCasterToLineString GetCasterToLineString() const;
    00584     virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const;
    00585     virtual int    ContainsPoint( const OGRPoint* p ) const;
    00586     virtual double get_AreaOfCurveSegments() const;
    00587
    00588   public:
    00589                 OGRCircularString();
    00590     virtual    ~OGRCircularString();
    00591
    00592     // IWks Interface
    00593     virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
    00594     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
    00595     virtual OGRErr importFromWkt( char ** );
    00596     virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
    00597
    00598     // IGeometry interface
    00599     virtual OGRBoolean  IsValid() const;
    00600     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
    00601     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
    00602
    00603     // ICurve methods
    00604     virtual double get_Length() const;
    00605     virtual OGRLineString* CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
    00606                                        const char* const* papszOptions = NULL) const;
    00607     virtual void Value( double, OGRPoint * ) const;
    00608     virtual double get_Area() const;
    00609
    00610     // non-standard from OGRGeometry
    00611     virtual OGRwkbGeometryType getGeometryType() const;
    00612     virtual const char *getGeometryName() const;
    00613     virtual void segmentize(double dfMaxLength);
    00614     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    00615     virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
    00616                                              const char* const* papszOptions = NULL) const;
    00617 };
    00618
    00619 /************************************************************************/
    00620 /*                           OGRCurveCollection                         */
    00621 /************************************************************************/
    00622
    00633 class CPL_DLL OGRCurveCollection
    00634 {
    00635   protected:
    00636     friend class OGRCompoundCurve;
    00637     friend class OGRCurvePolygon;
    00638     friend class OGRPolygon;
    00639
    00640     int         nCurveCount;
    00641     OGRCurve  **papoCurves;
    00642
    00643   public:
    00644                 OGRCurveCollection();
    00645                ~OGRCurveCollection();
    00646
    00647     void            empty(OGRGeometry* poGeom);
    00648     OGRBoolean      IsEmpty() const;
    00649     void            getEnvelope( OGREnvelope * psEnvelope ) const;
    00650     void            getEnvelope( OGREnvelope3D * psEnvelope ) const;
    00651
    00652     OGRErr          addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
    00653                                       int bNeedRealloc );
    00654     int             WkbSize() const;
    00655     OGRErr          importPreambuleFromWkb( OGRGeometry* poGeom,
    00656                                             unsigned char * pabyData,
    00657                                             int& nSize,
    00658                                             int& nDataOffset,
    00659                                             OGRwkbByteOrder& eByteOrder,
    00660                                             int nMinSubGeomSize,
    00661                                             OGRwkbVariant eWkVariant );
    00662     OGRErr          importBodyFromWkb( OGRGeometry* poGeom,
    00663                                        unsigned char * pabyData,
    00664                                        int nSize,
    00665                                        int nDataOffset,
    00666                                        int bAcceptCompoundCurve,
    00667                                        OGRErr (*pfnAddCurveDirectlyFromWkb)(OGRGeometry* poGeom, OGRCurve* poCurve),
    00668                                        OGRwkbVariant eWkVariant );
    00669     OGRErr          exportToWkt( const OGRGeometry* poGeom, char ** ppszDstText ) const;
    00670     OGRErr          exportToWkb( const OGRGeometry* poGeom, OGRwkbByteOrder,
    00671                                  unsigned char *, OGRwkbVariant eWkbVariant ) const;
    00672     OGRBoolean      Equals(OGRCurveCollection *poOCC) const;
    00673     void            setCoordinateDimension( OGRGeometry* poGeom, int nNewDimension );
    00674     int             getNumCurves() const;
    00675     OGRCurve       *getCurve( int );
    00676     const OGRCurve *getCurve( int ) const;
    00677     OGRCurve       *stealCurve( int );
    00678     OGRErr          transform( OGRGeometry* poGeom,
    00679                                OGRCoordinateTransformation *poCT );
    00680     void            flattenTo2D(OGRGeometry* poGeom);
    00681     void            segmentize(double dfMaxLength);
    00682     void            swapXY();
    00683     OGRBoolean      hasCurveGeometry(int bLookForNonLinear) const;
    00684 };
    00685
    00686 /************************************************************************/
    00687 /*                            OGRCompoundCurve                          */
    00688 /************************************************************************/
    00689
    00700 class CPL_DLL OGRCompoundCurve : public OGRCurve
    00701 {
    00702   private:
    00703     OGRCurveCollection oCC;
    00704
    00705     OGRErr      addCurveDirectlyInternal( OGRCurve* poCurve,
    00706                                           double dfToleranceEps,
    00707                                           int bNeedRealloc );
    00708     static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf, OGRCurve* poCurve );
    00709     static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf, OGRCurve* poCurve );
    00710     OGRLineString* CurveToLineInternal(double dfMaxAngleStepSizeDegrees,
    00711                                        const char* const* papszOptions,
    00712                                        int bIsLinearRing) const;
    00713
    00714   protected:
    00715     static OGRLineString* CastToLineString(OGRCompoundCurve* poCC);
    00716     static OGRLinearRing* CastToLinearRing(OGRCompoundCurve* poCC);
    00717
    00718     virtual OGRCurveCasterToLineString GetCasterToLineString() const;
    00719     virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const;
    00720
    00721   public:
    00722                 OGRCompoundCurve();
    00723     virtual     ~OGRCompoundCurve();
    00724
    00725     // IWks Interface
    00726     virtual int WkbSize() const;
    00727     virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
    00728     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
    00729     virtual OGRErr importFromWkt( char ** );
    00730     virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
    00731
    00732     // IGeometry interface
    00733     virtual OGRGeometry *clone() const;
    00734     virtual void empty();
    00735     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
    00736     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
    00737     virtual OGRBoolean  IsEmpty() const;
    00738
    00739     // ICurve methods
    00740     virtual double get_Length() const;
    00741     virtual void StartPoint(OGRPoint *) const;
    00742     virtual void EndPoint(OGRPoint *) const;
    00743     virtual void Value( double, OGRPoint * ) const;
    00744     virtual OGRLineString* CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
    00745                                        const char* const* papszOptions = NULL) const;
    00746
    00747     virtual int getNumPoints() const;
    00748     virtual double get_AreaOfCurveSegments() const;
    00749     virtual double get_Area() const;
    00750
    00751     // ISpatialRelation
    00752     virtual OGRBoolean  Equals( OGRGeometry * ) const;
    00753
    00754     // ICompoundCurve method
    00755     int             getNumCurves() const;
    00756     OGRCurve       *getCurve( int );
    00757     const OGRCurve *getCurve( int ) const;
    00758
    00759     // non standard.
    00760     virtual void setCoordinateDimension( int nDimension );
    00761
    00762     OGRErr         addCurve( OGRCurve*, double dfToleranceEps = 1e-14  );
    00763     OGRErr         addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
    00764     OGRCurve      *stealCurve( int );
    00765     virtual OGRPointIterator* getPointIterator() const;
    00766
    00767     // non-standard from OGRGeometry
    00768     virtual OGRwkbGeometryType getGeometryType() const;
    00769     virtual const char *getGeometryName() const;
    00770     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
    00771     virtual void flattenTo2D();
    00772     virtual void segmentize(double dfMaxLength);
    00773     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    00774     virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
    00775                                              const char* const* papszOptions = NULL) const;
    00776
    00777     virtual void        swapXY();
    00778 };
    00779
    00780 /************************************************************************/
    00781 /*                              OGRSurface                              */
    00782 /************************************************************************/
    00783
    00788 class CPL_DLL OGRSurface : public OGRGeometry
    00789 {
    00790   protected:
    00791
    00792     virtual OGRSurfaceCasterToPolygon      GetCasterToPolygon() const = 0;
    00793     virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
    00794
    00795   public:
    00796     virtual double      get_Area() const = 0;
    00797     virtual OGRErr      PointOnSurface( OGRPoint * poPoint ) const = 0;
    00798
    00799     static OGRPolygon*      CastToPolygon(OGRSurface* poSurface);
    00800     static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
    00801 };
    00802
    00803
    00804 /************************************************************************/
    00805 /*                          OGRCurvePolygon                             */
    00806 /************************************************************************/
    00807
    00821 class CPL_DLL OGRCurvePolygon : public OGRSurface
    00822 {
    00823   private:
    00824     OGRBoolean      ContainsPoint( const OGRPoint* p ) const;
    00825     virtual int   checkRing( OGRCurve * poNewRing ) const;
    00826     OGRErr        addRingDirectlyInternal( OGRCurve* poCurve, int bNeedRealloc );
    00827     static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf, OGRCurve* poCurve );
    00828     static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf, OGRCurve* poCurve );
    00829
    00830   protected:
    00831     friend class OGRPolygon;
    00832     OGRCurveCollection oCC;
    00833
    00834     static OGRPolygon* CastToPolygon(OGRCurvePolygon* poCP);
    00835
    00836     virtual OGRSurfaceCasterToPolygon      GetCasterToPolygon() const;
    00837     virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const;
    00838
    00839   public:
    00840                 OGRCurvePolygon();
    00841     virtual    ~OGRCurvePolygon();
    00842
    00843     // Non standard (OGRGeometry).
    00844     virtual const char *getGeometryName() const;
    00845     virtual OGRwkbGeometryType getGeometryType() const;
    00846     virtual OGRGeometry *clone() const;
    00847     virtual void empty();
    00848     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
    00849     virtual void flattenTo2D();
    00850     virtual OGRBoolean  IsEmpty() const;
    00851     virtual void segmentize(double dfMaxLength);
    00852     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    00853     virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
    00854                                              const char* const* papszOptions = NULL) const;
    00855
    00856     // ISurface Interface
    00857     virtual double      get_Area() const;
    00858     virtual int         PointOnSurface( OGRPoint * poPoint ) const;
    00859
    00860     // IWks Interface
    00861     virtual int WkbSize() const;
    00862     virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
    00863     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
    00864     virtual OGRErr importFromWkt( char ** );
    00865     virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant eWkbVariant = wkbVariantOldOgc ) const;
    00866
    00867     // IGeometry
    00868     virtual int getDimension() const;
    00869     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
    00870     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
    00871
    00872     // ICurvePolygon
    00873     virtual OGRPolygon* CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
    00874                                         const char* const* papszOptions = NULL) const;
    00875
    00876     // ISpatialRelation
    00877     virtual OGRBoolean  Equals( OGRGeometry * ) const;
    00878     virtual OGRBoolean  Intersects( const OGRGeometry * ) const;
    00879     virtual OGRBoolean  Contains( const OGRGeometry * ) const;
    00880
    00881     // Non standard
    00882     virtual void setCoordinateDimension( int nDimension );
    00883
    00884     OGRErr        addRing( OGRCurve * );
    00885     OGRErr        addRingDirectly( OGRCurve * );
    00886
    00887     OGRCurve *getExteriorRingCurve();
    00888     const OGRCurve *getExteriorRingCurve() const;
    00889     int         getNumInteriorRings() const;
    00890     OGRCurve *getInteriorRingCurve( int );
    00891     const OGRCurve *getInteriorRingCurve( int ) const;
    00892
    00893     OGRCurve *stealExteriorRingCurve();
    00894
    00895     virtual void        swapXY();
    00896 };
    00897
    00898 /************************************************************************/
    00899 /*                              OGRPolygon                              */
    00900 /************************************************************************/
    00901
    00911 class CPL_DLL OGRPolygon : public OGRCurvePolygon
    00912 {
    00913   protected:
    00914     friend class OGRMultiSurface;
    00915
    00916     virtual int checkRing( OGRCurve * poNewRing ) const;
    00917     OGRErr      importFromWKTListOnly( char ** ppszInput, int bHasZ, int bHasM,
    00918                                        OGRRawPoint*& paoPoints, int& nMaxPoints,
    00919                                        double*& padfZ );
    00920
    00921     static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
    00922
    00923     virtual OGRSurfaceCasterToPolygon      GetCasterToPolygon() const;
    00924     virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const;
    00925
    00926   public:
    00927                 OGRPolygon();
    00928     virtual    ~OGRPolygon();
    00929
    00930     // Non standard (OGRGeometry).
    00931     virtual const char *getGeometryName() const;
    00932     virtual OGRwkbGeometryType getGeometryType() const;
    00933     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    00934     virtual OGRGeometry* getCurveGeometry(const char* const* papszOptions = NULL) const;
    00935     virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
    00936                                              const char* const* papszOptions = NULL) const;
    00937
    00938     // ISurface Interface
    00939     virtual int         PointOnSurface( OGRPoint * poPoint ) const;
    00940
    00941     // IWks Interface
    00942     virtual int WkbSize() const;
    00943     virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
    00944     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
    00945     virtual OGRErr importFromWkt( char ** );
    00946     virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
    00947
    00948     // ICurvePolygon
    00949     virtual OGRPolygon* CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
    00950                                         const char* const* papszOptions = NULL) const;
    00951
    00952     OGRLinearRing *getExteriorRing();
    00953     const OGRLinearRing *getExteriorRing() const;
    00954     OGRLinearRing *getInteriorRing( int );
    00955     const OGRLinearRing *getInteriorRing( int ) const;
    00956
    00957     OGRLinearRing *stealExteriorRing();
    00958     OGRLinearRing *stealInteriorRing(int);
    00959
    00960     OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
    00961
    00962     virtual void closeRings();
    00963 };
    00964
    00965 /************************************************************************/
    00966 /*                        OGRGeometryCollection                         */
    00967 /************************************************************************/
    00968
    00976 class CPL_DLL OGRGeometryCollection : public OGRGeometry
    00977 {
    00978     OGRErr      importFromWkbInternal( unsigned char * pabyData, int nSize, int nRecLevel,
    00979                                        OGRwkbVariant );
    00980     OGRErr      importFromWktInternal( char **ppszInput, int nRecLevel );
    00981
    00982   protected:
    00983     int         nGeomCount;
    00984     OGRGeometry **papoGeoms;
    00985
    00986     OGRErr                      exportToWktInternal( char ** ppszDstText,
    00987                                                      OGRwkbVariant eWkbVariant,
    00988                                                      const char* pszSkipPrefix ) const;
    00989     virtual OGRBoolean         isCompatibleSubType( OGRwkbGeometryType ) const;
    00990
    00991     static OGRGeometryCollection* TransferMembersAndDestroy(OGRGeometryCollection* poSrc,
    00992                                                   OGRGeometryCollection* poDst);
    00993
    00994   public:
    00995                 OGRGeometryCollection();
    00996     virtual     ~OGRGeometryCollection();
    00997
    00998     // Non standard (OGRGeometry).
    00999     virtual const char *getGeometryName() const;
    01000     virtual OGRwkbGeometryType getGeometryType() const;
    01001     virtual OGRGeometry *clone() const;
    01002     virtual void empty();
    01003     virtual OGRErr  transform( OGRCoordinateTransformation *poCT );
    01004     virtual void flattenTo2D();
    01005     virtual OGRBoolean  IsEmpty() const;
    01006     virtual void segmentize(double dfMaxLength);
    01007     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    01008     virtual OGRGeometry* getCurveGeometry(const char* const* papszOptions = NULL) const;
    01009     virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0, const char* const* papszOptions = NULL) const;
    01010
    01011     // IWks Interface
    01012     virtual int WkbSize() const;
    01013     virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
    01014     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
    01015     virtual OGRErr importFromWkt( char ** );
    01016     virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
    01017
    01018     virtual double get_Length() const;
    01019     virtual double get_Area() const;
    01020
    01021     // IGeometry methods
    01022     virtual int getDimension() const;
    01023     virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
    01024     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
    01025
    01026     // IGeometryCollection
    01027     int         getNumGeometries() const;
    01028     OGRGeometry *getGeometryRef( int );
    01029     const OGRGeometry *getGeometryRef( int ) const;
    01030
    01031     // ISpatialRelation
    01032     virtual OGRBoolean  Equals( OGRGeometry * ) const;
    01033
    01034     // Non standard
    01035     virtual void setCoordinateDimension( int nDimension );
    01036     virtual OGRErr addGeometry( const OGRGeometry * );
    01037     virtual OGRErr addGeometryDirectly( OGRGeometry * );
    01038     virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
    01039
    01040     void closeRings();
    01041
    01042     virtual void        swapXY();
    01043 };
    01044
    01045 /************************************************************************/
    01046 /*                          OGRMultiSurface                             */
    01047 /************************************************************************/
    01048
    01055 class CPL_DLL OGRMultiSurface : public OGRGeometryCollection
    01056 {
    01057   protected:
    01058     virtual OGRBoolean  isCompatibleSubType( OGRwkbGeometryType ) const;
    01059
    01060   public:
    01061             OGRMultiSurface();
    01062     virtual ~OGRMultiSurface();
    01063
    01064     // Non standard (OGRGeometry).
    01065     virtual const char *getGeometryName() const;
    01066     virtual OGRwkbGeometryType getGeometryType() const;
    01067     virtual OGRErr importFromWkt( char ** );
    01068     virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc ) const;
    01069
    01070     // IMultiSurface methods
    01071     virtual OGRErr      PointOnSurface( OGRPoint * poPoint ) const;
    01072
    01073     // IGeometry methods
    01074     virtual int getDimension() const;
    01075
    01076     // Non standard
    01077     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    01078
    01079     static OGRMultiPolygon* CastToMultiPolygon(OGRMultiSurface* poMS);
    01080 };
    01081
    01082 /************************************************************************/
    01083 /*                           OGRMultiPolygon                            */
    01084 /************************************************************************/
    01085
    01090 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
    01091 {
    01092   protected:
    01093     virtual OGRBoolean  isCompatibleSubType( OGRwkbGeometryType ) const;
    01094
    01095   public:
    01096             OGRMultiPolygon();
    01097     virtual ~OGRMultiPolygon();
    01098
    01099     // Non standard (OGRGeometry).
    01100     virtual const char *getGeometryName() const;
    01101     virtual OGRwkbGeometryType getGeometryType() const;
    01102     virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc ) const;
    01103
    01104     // IMultiSurface methods
    01105     virtual OGRErr      PointOnSurface( OGRPoint * poPoint ) const;
    01106
    01107     // Non standard
    01108     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    01109
    01110     static OGRMultiSurface* CastToMultiSurface(OGRMultiPolygon* poMP);
    01111 };
    01112
    01113 /************************************************************************/
    01114 /*                            OGRMultiPoint                             */
    01115 /************************************************************************/
    01116
    01121 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
    01122 {
    01123   private:
    01124     OGRErr  importFromWkt_Bracketed( char **, int bHasM, int bHasZ );
    01125
    01126   protected:
    01127     virtual OGRBoolean  isCompatibleSubType( OGRwkbGeometryType ) const;
    01128
    01129   public:
    01130             OGRMultiPoint();
    01131     virtual ~OGRMultiPoint();
    01132
    01133     // Non standard (OGRGeometry).
    01134     virtual const char *getGeometryName() const;
    01135     virtual OGRwkbGeometryType getGeometryType() const;
    01136     virtual OGRErr importFromWkt( char ** );
    01137     virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc ) const;
    01138
    01139     // IGeometry methods
    01140     virtual int getDimension() const;
    01141
    01142     // Non standard
    01143     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    01144 };
    01145
    01146 /************************************************************************/
    01147 /*                          OGRMultiCurve                               */
    01148 /************************************************************************/
    01149
    01156 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
    01157 {
    01158   protected:
    01159     static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf, OGRCurve* poCurve );
    01160     virtual OGRBoolean  isCompatibleSubType( OGRwkbGeometryType ) const;
    01161
    01162   public:
    01163             OGRMultiCurve();
    01164     virtual ~OGRMultiCurve();
    01165
    01166     // Non standard (OGRGeometry).
    01167     virtual const char *getGeometryName() const;
    01168     virtual OGRwkbGeometryType getGeometryType() const;
    01169     virtual OGRErr importFromWkt( char ** );
    01170     virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc ) const;
    01171
    01172     // IGeometry methods
    01173     virtual int getDimension() const;
    01174
    01175     // Non standard
    01176     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    01177
    01178     static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
    01179 };
    01180
    01181 /************************************************************************/
    01182 /*                          OGRMultiLineString                          */
    01183 /************************************************************************/
    01184
    01189 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
    01190 {
    01191   protected:
    01192     virtual OGRBoolean  isCompatibleSubType( OGRwkbGeometryType ) const;
    01193
    01194   public:
    01195             OGRMultiLineString();
    01196     virtual ~OGRMultiLineString();
    01197
    01198     // Non standard (OGRGeometry).
    01199     virtual const char *getGeometryName() const;
    01200     virtual OGRwkbGeometryType getGeometryType() const;
    01201     virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc ) const;
    01202
    01203     // Non standard
    01204     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
    01205
    01206     static OGRMultiCurve* CastToMultiCurve(OGRMultiLineString* poMLS);
    01207 };
    01208
    01209
    01210 /************************************************************************/
    01211 /*                          OGRGeometryFactory                          */
    01212 /************************************************************************/
    01213
    01218 class CPL_DLL OGRGeometryFactory
    01219 {
    01220     static OGRErr createFromFgfInternal( unsigned char *pabyData,
    01221                                          OGRSpatialReference * poSR,
    01222                                          OGRGeometry **ppoReturn,
    01223                                          int nBytes,
    01224                                          int *pnBytesConsumed,
    01225                                          int nRecLevel );
    01226   public:
    01227     static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
    01228                                  OGRGeometry **, int = -1, OGRwkbVariant=wkbVariantOldOgc );
    01229     static OGRErr createFromWkt( char **, OGRSpatialReference *,
    01230                                  OGRGeometry ** );
    01231     static OGRErr createFromFgf( unsigned char *, OGRSpatialReference *,
    01232                                  OGRGeometry **, int = -1, int * = NULL );
    01233     static OGRGeometry *createFromGML( const char * );
    01234     static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt, GEOSGeom );
    01235
    01236     static void   destroyGeometry( OGRGeometry * );
    01237     static OGRGeometry *createGeometry( OGRwkbGeometryType );
    01238
    01239     static OGRGeometry * forceToPolygon( OGRGeometry * );
    01240     static OGRGeometry * forceToLineString( OGRGeometry *, bool bOnlyInOrder = true );
    01241     static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
    01242     static OGRGeometry * forceToMultiPoint( OGRGeometry * );
    01243     static OGRGeometry * forceToMultiLineString( OGRGeometry * );
    01244
    01245     static OGRGeometry * forceTo( OGRGeometry* poGeom,
    01246                                   OGRwkbGeometryType eTargetType,
    01247                                   const char*const* papszOptions = NULL );
    01248
    01249     static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
    01250                                            int nPolygonCount,
    01251                                            int *pbResultValidGeometry,
    01252                                            const char **papszOptions = NULL);
    01253     static int haveGEOS();
    01254
    01255     static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
    01256                                               OGRCoordinateTransformation *poCT,
    01257                                               char** papszOptions );
    01258
    01259     static OGRGeometry*
    01260         approximateArcAngles( double dfX, double dfY, double dfZ,
    01261                               double dfPrimaryRadius, double dfSecondaryAxis,
    01262                               double dfRotation,
    01263                               double dfStartAngle, double dfEndAngle,
    01264                               double dfMaxAngleStepSizeDegrees );
    01265
    01266     static int GetCurveParmeters(double x0, double y0,
    01267                                  double x1, double y1,
    01268                                  double x2, double y2,
    01269                                  double& R, double& cx, double& cy,
    01270                                  double& alpha0, double& alpha1, double& alpha2 );
    01271     static OGRLineString* curveToLineString( double x0, double y0, double z0,
    01272                                              double x1, double y1, double z1,
    01273                                              double x2, double y2, double z2,
    01274                                              int bHasZ,
    01275                                              double dfMaxAngleStepSizeDegrees,
    01276                                              const char*const* papszOptions = NULL );
    01277     static OGRCurve* curveFromLineString(const OGRLineString* poLS,
    01278                                          const char*const* papszOptions = NULL);
    01279 };
    01280
    01281 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
    01282 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
    01283
    01284 /* Prepared geometry API (needs GEOS >= 3.1.0) */
    01285 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
    01286 int OGRHasPreparedGeometrySupport();
    01287 OGRPreparedGeometry* OGRCreatePreparedGeometry( const OGRGeometry* poGeom );
    01288 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
    01289 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
    01290                                    const OGRGeometry* poOtherGeom );
    01291
    01292 #endif /* ndef _OGR_GEOMETRY_H_INCLUDED */

Generated for GDAL by 1.7.1.