GDAL
ogr_geometry.h
Go to the documentation of this file.
00001 /******************************************************************************
00002  * $Id: ogr_geometry.h 40454 2017-10-16 19:14:13Z 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:
00051           OGRRawPoint() : x(0.0), y(0.0) {}
00052 
00054           OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn) {}
00055 
00057     double      x;
00059     double      y;
00060 };
00061 
00063 typedef struct GEOSGeom_t *GEOSGeom;
00065 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
00067 typedef void sfcgal_geometry_t;
00068 
00069 class OGRPoint;
00070 class OGRCurve;
00071 class OGRCompoundCurve;
00072 class OGRLinearRing;
00073 class OGRLineString;
00074 class OGRSurface;
00075 class OGRCurvePolygon;
00076 class OGRPolygon;
00077 class OGRMultiSurface;
00078 class OGRMultiPolygon;
00079 class OGRMultiCurve;
00080 class OGRMultiLineString;
00081 class OGRTriangle;
00082 class OGRPolyhedralSurface;
00083 class OGRTriangulatedSurface;
00084 
00086 typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
00087 typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
00088 
00089 typedef OGRPolygon*      (*OGRSurfaceCasterToPolygon)(OGRSurface*);
00090 typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
00091 typedef OGRMultiPolygon* (*OGRPolyhedralSurfaceCastToMultiPolygon)(OGRPolyhedralSurface*);
00093 
00094 /************************************************************************/
00095 /*                             OGRGeometry                              */
00096 /************************************************************************/
00097 
00118 class CPL_DLL OGRGeometry
00119 {
00120   private:
00121     OGRSpatialReference * poSRS;                // may be NULL
00122 
00123   protected:
00125     friend class OGRCurveCollection;
00126 
00127     unsigned int flags;
00128 
00129     OGRErr       importPreambuleFromWkt( char ** ppszInput,
00130                                          int* pbHasZ, int* pbHasM,
00131                                          bool* pbIsEmpty );
00132     OGRErr       importCurveCollectionFromWkt(
00133                      char ** ppszInput,
00134                      int bAllowEmptyComponent,
00135                      int bAllowLineString,
00136                      int bAllowCurve,
00137                      int bAllowCompoundCurve,
00138                      OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf,
00139                                                    OGRCurve* poCurve) );
00140     OGRErr       importPreambuleFromWkb( unsigned char * pabyData,
00141                                          int nSize,
00142                                          OGRwkbByteOrder& eByteOrder,
00143                                          OGRwkbVariant eWkbVariant );
00144     OGRErr       importPreambuleOfCollectionFromWkb(
00145                      unsigned char * pabyData,
00146                      int& nSize,
00147                      int& nDataOffset,
00148                      OGRwkbByteOrder& eByteOrder,
00149                      int nMinSubGeomSize,
00150                      int& nGeomCount,
00151                      OGRwkbVariant eWkbVariant );
00152     OGRErr       PointOnSurfaceInternal( OGRPoint * poPoint ) const;
00153     OGRBoolean   IsSFCGALCompatible() const;
00155 
00156   public:
00157 
00158 /************************************************************************/
00159 /*                   Bit flags for OGRGeometry                          */
00160 /*          The OGR_G_NOT_EMPTY_POINT is used *only* for points.        */
00161 /*          Do not use these outside of the core.                       */
00162 /*          Use Is3D, IsMeasured, set3D, and setMeasured instead        */
00163 /************************************************************************/
00164 
00166     static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
00167     static const unsigned int OGR_G_3D = 0x2;
00168     static const unsigned int OGR_G_MEASURED = 0x4;
00170 
00171                 OGRGeometry();
00172                 OGRGeometry( const OGRGeometry& other );
00173     virtual     ~OGRGeometry();
00174 
00175     OGRGeometry& operator=( const OGRGeometry& other );
00176 
00177     // Standard IGeometry.
00178     virtual int getDimension() const = 0;
00179     virtual int getCoordinateDimension() const;
00180     int CoordinateDimension() const;
00181     virtual OGRBoolean  IsEmpty() const = 0;
00182     virtual OGRBoolean  IsValid() const;
00183     virtual OGRBoolean  IsSimple() const;
00185     OGRBoolean  Is3D() const { return flags & OGR_G_3D; }
00187     OGRBoolean  IsMeasured() const { return flags & OGR_G_MEASURED; }
00188     virtual OGRBoolean  IsRing() const;
00189     virtual void        empty() = 0;
00190     virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
00191     virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
00192     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
00193 
00194     // IWks Interface.
00195     virtual int WkbSize() const = 0;
00196     virtual OGRErr importFromWkb( unsigned char *, int=-1,
00197                                   OGRwkbVariant=wkbVariantOldOgc ) = 0;
00198     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
00199                                 OGRwkbVariant=wkbVariantOldOgc ) const = 0;
00200     virtual OGRErr importFromWkt( char ** ppszInput ) = 0;
00201     virtual OGRErr exportToWkt( char ** ppszDstText,
00202                                 OGRwkbVariant=wkbVariantOldOgc ) const = 0;
00203 
00204     // Non-standard.
00205     virtual OGRwkbGeometryType getGeometryType() const = 0;
00206     OGRwkbGeometryType    getIsoGeometryType() const;
00207     virtual const char *getGeometryName() const = 0;
00208     virtual void   dumpReadable( FILE *, const char * = NULL
00209                                  , char** papszOptions = NULL ) const;
00210     virtual void   flattenTo2D() = 0;
00211     virtual char * exportToGML( const char* const * papszOptions = NULL ) const;
00212     virtual char * exportToKML() const;
00213     virtual char * exportToJson() const;
00214 
00215     static GEOSContextHandle_t createGEOSContext();
00216     static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
00217     virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
00218         const CPL_WARN_UNUSED_RESULT;
00219     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
00220     virtual OGRGeometry* getCurveGeometry(
00221         const char* const* papszOptions = NULL ) const CPL_WARN_UNUSED_RESULT;
00222     virtual OGRGeometry* getLinearGeometry(
00223         double dfMaxAngleStepSizeDegrees = 0,
00224         const char* const* papszOptions = NULL ) const CPL_WARN_UNUSED_RESULT;
00225 
00226     // SFCGAL interfacing methods.
00228     static sfcgal_geometry_t* OGRexportToSFCGAL( OGRGeometry *poGeom );
00229     static OGRGeometry* SFCGALexportToOGR( sfcgal_geometry_t* _geometry );
00231     virtual void closeRings();
00232 
00233     virtual void setCoordinateDimension( int nDimension );
00234     virtual void set3D( OGRBoolean bIs3D );
00235     virtual void setMeasured( OGRBoolean bIsMeasured );
00236 
00237     void    assignSpatialReference( OGRSpatialReference * poSR );
00238     OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
00239 
00240     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) = 0;
00241     OGRErr  transformTo( OGRSpatialReference *poSR );
00242 
00243     virtual void segmentize(double dfMaxLength);
00244 
00245     // ISpatialRelation
00246     virtual OGRBoolean  Intersects( const OGRGeometry * ) const;
00247     virtual OGRBoolean  Equals( OGRGeometry * ) const = 0;
00248     virtual OGRBoolean  Disjoint( const OGRGeometry * ) const;
00249     virtual OGRBoolean  Touches( const OGRGeometry * ) const;
00250     virtual OGRBoolean  Crosses( const OGRGeometry * ) const;
00251     virtual OGRBoolean  Within( const OGRGeometry * ) const;
00252     virtual OGRBoolean  Contains( const OGRGeometry * ) const;
00253     virtual OGRBoolean  Overlaps( const OGRGeometry * ) const;
00254 //    virtual OGRBoolean  Relate( const OGRGeometry *, const char * ) const;
00255 //    virtual OGRGeometry *LocateAlong( double mValue ) const;
00256 //    virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
00257 
00258     virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
00259     virtual double  Distance( const OGRGeometry * ) const ;
00260     virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
00261     virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
00262         const CPL_WARN_UNUSED_RESULT;
00263     virtual OGRGeometry *Intersection( const OGRGeometry *)
00264         const CPL_WARN_UNUSED_RESULT;
00265     virtual OGRGeometry *Union( const OGRGeometry * )
00266         const CPL_WARN_UNUSED_RESULT;
00267     virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
00268     virtual OGRGeometry *Difference( const OGRGeometry * )
00269         const CPL_WARN_UNUSED_RESULT;
00270     virtual OGRGeometry *SymDifference( const OGRGeometry * )
00271         const CPL_WARN_UNUSED_RESULT;
00272     virtual OGRErr       Centroid( OGRPoint * poPoint ) const;
00273     virtual OGRGeometry *Simplify(double dTolerance)
00274         const CPL_WARN_UNUSED_RESULT;
00275     OGRGeometry *SimplifyPreserveTopology(double dTolerance)
00276         const CPL_WARN_UNUSED_RESULT;
00277     virtual OGRGeometry *DelaunayTriangulation(
00278         double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
00279 
00280     virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
00281 
00282     virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
00283 
00285     // backward compatibility to non-standard method names.
00286     OGRBoolean  Intersect( OGRGeometry * )
00287         const CPL_WARN_DEPRECATED("Non standard method. "
00288                                   "Use Intersects() instead");
00289     OGRBoolean  Equal( OGRGeometry * )
00290         const CPL_WARN_DEPRECATED("Non standard method. "
00291                                   "Use Equals() instead");
00292     OGRGeometry *SymmetricDifference( const OGRGeometry * )
00293         const CPL_WARN_DEPRECATED("Non standard method. "
00294                                   "Use SymDifference() instead");
00295     OGRGeometry *getBoundary()
00296         const CPL_WARN_DEPRECATED("Non standard method. "
00297                                   "Use Boundary() instead");
00299 
00301     // Special HACK for DB2 7.2 support
00302     static int bGenerate_DB2_V72_BYTE_ORDER;
00304 
00305     virtual void        swapXY();
00307     static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
00308     static OGRGeometry* CastToError( OGRGeometry* poGeom );
00310 };
00311 
00312 /************************************************************************/
00313 /*                               OGRPoint                               */
00314 /************************************************************************/
00315 
00322 class CPL_DLL OGRPoint : public OGRGeometry
00323 {
00324     double      x;
00325     double      y;
00326     double      z;
00327     double      m;
00328 
00329   public:
00330                 OGRPoint();
00331                 OGRPoint( double x, double y );
00332                 OGRPoint( double x, double y, double z );
00333                 OGRPoint( double x, double y, double z, double m );
00334                 OGRPoint( const OGRPoint& other );
00335     virtual     ~OGRPoint();
00336 
00337     OGRPoint& operator=( const OGRPoint& other );
00338 
00339     // IWks Interface
00340     virtual int WkbSize() const CPL_OVERRIDE;
00341     virtual OGRErr importFromWkb( unsigned char *, int=-1,
00342                                   OGRwkbVariant=wkbVariantOldOgc ) CPL_OVERRIDE;
00343     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
00344                                 OGRwkbVariant=wkbVariantOldOgc )
00345         const CPL_OVERRIDE;
00346     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
00347     virtual OGRErr exportToWkt( char ** ppszDstText,
00348                                 OGRwkbVariant=wkbVariantOldOgc )
00349         const CPL_OVERRIDE;
00350 
00351     // IGeometry
00352     virtual int getDimension() const CPL_OVERRIDE;
00353     virtual OGRGeometry *clone() const CPL_OVERRIDE;
00354     virtual void empty() CPL_OVERRIDE;
00355     virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
00356     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
00357     virtual OGRBoolean  IsEmpty() const CPL_OVERRIDE
00358         { return !(flags & OGR_G_NOT_EMPTY_POINT); }
00359 
00360     // IPoint
00362     double      getX() const { return x; }
00364     double      getY() const { return y; }
00366     double      getZ() const { return z; }
00368     double      getM() const { return m; }
00369 
00370     // Non standard
00371     virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
00375     void        setX( double xIn ) { x = xIn; flags |= OGR_G_NOT_EMPTY_POINT; }
00379     void        setY( double yIn ) { y = yIn; flags |= OGR_G_NOT_EMPTY_POINT; }
00383     void        setZ( double zIn )
00384         { z = zIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_3D); }
00388     void        setM( double mIn )
00389         { m = mIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_MEASURED); }
00390 
00391     // ISpatialRelation
00392     virtual OGRBoolean  Equals( OGRGeometry * ) const CPL_OVERRIDE;
00393     virtual OGRBoolean  Intersects( const OGRGeometry * ) const CPL_OVERRIDE;
00394     virtual OGRBoolean  Within( const OGRGeometry * ) const CPL_OVERRIDE;
00395 
00396     // Non standard from OGRGeometry
00397     virtual const char *getGeometryName() const CPL_OVERRIDE;
00398     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
00399     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
00400     virtual void flattenTo2D() CPL_OVERRIDE;
00401 
00402     virtual void        swapXY() CPL_OVERRIDE;
00403 };
00404 
00405 /************************************************************************/
00406 /*                            OGRPointIterator                          */
00407 /************************************************************************/
00408 
00415 class CPL_DLL OGRPointIterator
00416 {
00417     public:
00418         virtual ~OGRPointIterator();
00419         virtual OGRBoolean getNextPoint( OGRPoint* p ) = 0;
00420 
00421         static void destroy( OGRPointIterator* );
00422 };
00423 
00424 /************************************************************************/
00425 /*                               OGRCurve                               */
00426 /************************************************************************/
00427 
00433 class CPL_DLL OGRCurve : public OGRGeometry
00434 {
00435   protected:
00437             OGRCurve();
00438             OGRCurve( const OGRCurve& other );
00439 
00440     virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
00441     virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
00442 
00443     friend class OGRCurvePolygon;
00444     friend class OGRCompoundCurve;
00446     virtual int    ContainsPoint( const OGRPoint* p ) const;
00447     virtual double get_AreaOfCurveSegments() const = 0;
00448 
00449   public:
00450     virtual ~OGRCurve();
00451 
00453     OGRCurve& operator=( const OGRCurve& other );
00455 
00456     // ICurve methods
00457     virtual double get_Length() const = 0;
00458     virtual void StartPoint( OGRPoint * ) const = 0;
00459     virtual void EndPoint( OGRPoint * ) const = 0;
00460     virtual int  get_IsClosed() const;
00461     virtual void Value( double, OGRPoint * ) const = 0;
00462     virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
00463                                         const char* const* papszOptions = NULL)
00464         const = 0;
00465     virtual int getDimension() const CPL_OVERRIDE;
00466 
00467     // non standard
00468     virtual int getNumPoints() const = 0;
00469     virtual OGRPointIterator* getPointIterator() const = 0;
00470     virtual OGRBoolean IsConvex() const;
00471     virtual double get_Area() const = 0;
00472 
00473     static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
00474     static OGRLineString*    CastToLineString( OGRCurve* poCurve );
00475     static OGRLinearRing*    CastToLinearRing( OGRCurve* poCurve );
00476 };
00477 
00478 /************************************************************************/
00479 /*                             OGRSimpleCurve                           */
00480 /************************************************************************/
00481 
00491 class CPL_DLL OGRSimpleCurve: public OGRCurve
00492 {
00493   protected:
00495     friend class OGRGeometry;
00496 
00497     int         nPointCount;
00498     OGRRawPoint *paoPoints;
00499     double      *padfZ;
00500     double      *padfM;
00501 
00502     void        Make3D();
00503     void        Make2D();
00504     void        RemoveM();
00505     void        AddM();
00506 
00507     OGRErr      importFromWKTListOnly( char ** ppszInput, int bHasZ, int bHasM,
00508                                        OGRRawPoint*& paoPointsIn,
00509                                        int& nMaxPoints,
00510                                        double*& padfZIn );
00511 
00513 
00514     virtual double get_LinearArea() const;
00515 
00516                 OGRSimpleCurve();
00517                 OGRSimpleCurve( const OGRSimpleCurve& other );
00518 
00519   public:
00520     virtual     ~OGRSimpleCurve();
00521 
00522     OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
00523 
00524     // IWks Interface.
00525     virtual int WkbSize() const CPL_OVERRIDE;
00526     virtual OGRErr importFromWkb( unsigned char *, int = -1,
00527                                   OGRwkbVariant=wkbVariantOldOgc ) CPL_OVERRIDE;
00528     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
00529                                 OGRwkbVariant=wkbVariantOldOgc )
00530         const CPL_OVERRIDE;
00531     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
00532     virtual OGRErr exportToWkt( char ** ppszDstText,
00533                                 OGRwkbVariant=wkbVariantOldOgc )
00534         const CPL_OVERRIDE;
00535 
00536     // IGeometry interface.
00537     virtual OGRGeometry *clone() const CPL_OVERRIDE;
00538     virtual void empty() CPL_OVERRIDE;
00539     virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
00540     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
00541     virtual OGRBoolean  IsEmpty() const CPL_OVERRIDE;
00542 
00543     // ICurve methods.
00544     virtual double get_Length() const CPL_OVERRIDE;
00545     virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
00546     virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
00547     virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
00548     virtual double Project( const OGRPoint * ) const;
00549     virtual OGRLineString* getSubLine( double, double, int ) const;
00550 
00551     // ILineString methods.
00552     virtual int getNumPoints() const CPL_OVERRIDE { return nPointCount; }
00553     void        getPoint( int, OGRPoint * ) const;
00554     double      getX( int i ) const { return paoPoints[i].x; }
00555     double      getY( int i ) const { return paoPoints[i].y; }
00556     double      getZ( int i ) const;
00557     double      getM( int i ) const;
00558 
00559     // ISpatialRelation
00560     virtual OGRBoolean  Equals( OGRGeometry * ) const CPL_OVERRIDE;
00561 
00562     // non standard.
00563     virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
00564     virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
00565     virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
00566     void        setNumPoints( int nNewPointCount,
00567                               int bZeroizeNewContent = TRUE );
00568     void        setPoint( int, OGRPoint * );
00569     void        setPoint( int, double, double );
00570     void        setZ( int, double );
00571     void        setM( int, double );
00572     void        setPoint( int, double, double, double );
00573     void        setPointM( int, double, double, double );
00574     void        setPoint( int, double, double, double, double );
00575     void        setPoints( int, OGRRawPoint *, double * = NULL );
00576     void        setPointsM( int, OGRRawPoint *, double * );
00577     void        setPoints( int, OGRRawPoint *, double *, double * );
00578     void        setPoints( int, double * padfX, double * padfY,
00579                            double *padfZIn = NULL );
00580     void        setPointsM( int, double * padfX, double * padfY,
00581                             double *padfMIn = NULL );
00582     void        setPoints( int, double * padfX, double * padfY,
00583                            double *padfZIn, double *padfMIn );
00584     void        addPoint( const OGRPoint * );
00585     void        addPoint( double, double );
00586     void        addPoint( double, double, double );
00587     void        addPointM( double, double, double );
00588     void        addPoint( double, double, double, double );
00589 
00590     void        getPoints( OGRRawPoint *, double * = NULL ) const;
00591     void        getPoints( void* pabyX, int nXStride,
00592                            void* pabyY, int nYStride,
00593                            void* pabyZ = NULL, int nZStride = 0 ) const;
00594     void        getPoints( void* pabyX, int nXStride,
00595                            void* pabyY, int nYStride,
00596                            void* pabyZ, int nZStride,
00597                            void* pabyM, int nMStride ) const;
00598 
00599     void        addSubLineString( const OGRLineString *,
00600                                   int nStartVertex = 0, int nEndVertex = -1 );
00601     void        reversePoints( void );
00602     virtual OGRPointIterator* getPointIterator() const CPL_OVERRIDE;
00603 
00604     // non-standard from OGRGeometry
00605     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
00606     virtual void flattenTo2D() CPL_OVERRIDE;
00607     virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
00608 
00609     virtual void        swapXY() CPL_OVERRIDE;
00610 };
00611 
00612 /************************************************************************/
00613 /*                            OGRLineString                             */
00614 /************************************************************************/
00615 
00623 class CPL_DLL OGRLineString : public OGRSimpleCurve
00624 {
00625   protected:
00627     static OGRLineString* TransferMembersAndDestroy(
00628                                             OGRLineString* poSrc,
00629                                             OGRLineString* poDst);
00630 
00631     virtual OGRCurveCasterToLineString GetCasterToLineString()
00632         const CPL_OVERRIDE;
00633     virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
00634         const CPL_OVERRIDE;
00635 
00636     virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
00638 
00639     static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
00640 
00641   public:
00642                 OGRLineString();
00643                 OGRLineString( const OGRLineString& other );
00644     virtual    ~OGRLineString();
00645 
00646     OGRLineString& operator=(const OGRLineString& other);
00647 
00648     virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
00649                                         const char* const* papszOptions = NULL )
00650         const CPL_OVERRIDE;
00651     virtual OGRGeometry* getCurveGeometry(
00652         const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
00653     virtual double get_Area() const CPL_OVERRIDE;
00654 
00655     // Non-standard from OGRGeometry.
00656     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
00657     virtual const char *getGeometryName() const CPL_OVERRIDE;
00658 };
00659 
00660 /************************************************************************/
00661 /*                            OGRLinearRing                             */
00662 /************************************************************************/
00663 
00684 class CPL_DLL OGRLinearRing : public OGRLineString
00685 {
00686   protected:
00688     friend class OGRPolygon;
00689     friend class OGRTriangle;
00690 
00691     // These are not IWks compatible ... just a convenience for OGRPolygon.
00692     virtual int _WkbSize( int _flags ) const;
00693     virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
00694                                    unsigned char *, int=-1 );
00695     virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
00696                                  unsigned char * ) const;
00697 
00698     virtual OGRCurveCasterToLineString GetCasterToLineString()
00699         const CPL_OVERRIDE;
00700     virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
00701         const CPL_OVERRIDE;
00703 
00704     static OGRLineString* CastToLineString( OGRLinearRing* poLR );
00705 
00706   public:
00707                         OGRLinearRing();
00708                         OGRLinearRing( const OGRLinearRing& other );
00709                explicit OGRLinearRing( OGRLinearRing * );
00710     virtual            ~OGRLinearRing();
00711 
00712     OGRLinearRing& operator=( const OGRLinearRing& other );
00713 
00714     // Non standard.
00715     virtual const char *getGeometryName() const CPL_OVERRIDE;
00716     virtual OGRGeometry *clone() const CPL_OVERRIDE;
00717     virtual int isClockwise() const;
00718     virtual void reverseWindingOrder();
00719     virtual void closeRings() CPL_OVERRIDE;
00720     OGRBoolean isPointInRing( const OGRPoint* pt,
00721                               int bTestEnvelope = TRUE ) const;
00722     OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
00723                                       int bTestEnvelope = TRUE ) const;
00724     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
00725 
00726     // IWks Interface - Note this isn't really a first class object
00727     // for the purposes of WKB form.  These methods always fail since this
00728     // object can't be serialized on its own.
00729     virtual int WkbSize() const CPL_OVERRIDE;
00730     virtual OGRErr importFromWkb( unsigned char *, int=-1,
00731                                   OGRwkbVariant=wkbVariantOldOgc ) CPL_OVERRIDE;
00732     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
00733                                 OGRwkbVariant=wkbVariantOldOgc )
00734         const CPL_OVERRIDE;
00735 };
00736 
00737 /************************************************************************/
00738 /*                         OGRCircularString                            */
00739 /************************************************************************/
00740 
00753 class CPL_DLL OGRCircularString : public OGRSimpleCurve
00754 {
00755   private:
00756     void        ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
00757     OGRBoolean  IsValidFast() const;
00758     int         IsFullCircle( double& cx, double& cy, double& square_R ) const;
00759 
00760   protected:
00762     virtual OGRCurveCasterToLineString GetCasterToLineString()
00763         const CPL_OVERRIDE;
00764     virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
00765         const CPL_OVERRIDE;
00766     virtual int    ContainsPoint( const OGRPoint* p ) const CPL_OVERRIDE;
00767     virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
00768 
00769     friend class OGRCurvePolygon;
00770     int IntersectsPoint( const OGRPoint* p ) const;
00772 
00773   public:
00774                 OGRCircularString();
00775                 OGRCircularString(const OGRCircularString& other);
00776     virtual    ~OGRCircularString();
00777 
00778     OGRCircularString& operator=(const OGRCircularString& other);
00779 
00780     // IWks Interface.
00781     virtual OGRErr importFromWkb( unsigned char *, int = -1,
00782                                   OGRwkbVariant=wkbVariantOldOgc ) CPL_OVERRIDE;
00783     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
00784                                 OGRwkbVariant=wkbVariantOldOgc )
00785         const CPL_OVERRIDE;
00786     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
00787     virtual OGRErr exportToWkt( char ** ppszDstText,
00788                                 OGRwkbVariant=wkbVariantOldOgc )
00789         const CPL_OVERRIDE;
00790 
00791     // IGeometry interface.
00792     virtual OGRBoolean  IsValid() const CPL_OVERRIDE;
00793     virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
00794     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
00795 
00796     // ICurve methods.
00797     virtual double get_Length() const CPL_OVERRIDE;
00798     virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
00799                                         const char* const* papszOptions = NULL )
00800         const CPL_OVERRIDE;
00801     virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
00802     virtual double get_Area() const CPL_OVERRIDE;
00803 
00804     // Non-standard from OGRGeometry.
00805     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
00806     virtual const char *getGeometryName() const CPL_OVERRIDE;
00807     virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
00808     virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
00809         const CPL_OVERRIDE;
00810     virtual OGRGeometry* getLinearGeometry(
00811         double dfMaxAngleStepSizeDegrees = 0,
00812         const char* const* papszOptions = NULL) const CPL_OVERRIDE;
00813 };
00814 
00815 /************************************************************************/
00816 /*                           OGRCurveCollection                         */
00817 /************************************************************************/
00818 
00829 
00830 class CPL_DLL OGRCurveCollection
00831 {
00832   protected:
00833     friend class OGRCompoundCurve;
00834     friend class OGRCurvePolygon;
00835     friend class OGRPolygon;
00836     friend class OGRTriangle;
00837 
00838     int         nCurveCount;
00839     OGRCurve  **papoCurves;
00840 
00841   public:
00842                 OGRCurveCollection();
00843                 OGRCurveCollection(const OGRCurveCollection& other);
00844                ~OGRCurveCollection();
00845 
00846     OGRCurveCollection& operator=(const OGRCurveCollection& other);
00847 
00848     void            empty(OGRGeometry* poGeom);
00849     OGRBoolean      IsEmpty() const;
00850     void            getEnvelope( OGREnvelope * psEnvelope ) const;
00851     void            getEnvelope( OGREnvelope3D * psEnvelope ) const;
00852 
00853     OGRErr          addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
00854                                       int bNeedRealloc );
00855     int             WkbSize() const;
00856     OGRErr          importPreambuleFromWkb( OGRGeometry* poGeom,
00857                                             unsigned char * pabyData,
00858                                             int& nSize,
00859                                             int& nDataOffset,
00860                                             OGRwkbByteOrder& eByteOrder,
00861                                             int nMinSubGeomSize,
00862                                             OGRwkbVariant eWkVariant );
00863     OGRErr      importBodyFromWkb(
00864                     OGRGeometry* poGeom,
00865                     unsigned char * pabyData,
00866                     int nSize,
00867                     int nDataOffset,
00868                     int bAcceptCompoundCurve,
00869                     OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
00870                                                           OGRCurve* poCurve ),
00871                                        OGRwkbVariant eWkVariant );
00872     OGRErr          exportToWkt( const OGRGeometry* poGeom,
00873                                  char ** ppszDstText ) const;
00874     OGRErr          exportToWkb( const OGRGeometry* poGeom, OGRwkbByteOrder,
00875                                  unsigned char *,
00876                                  OGRwkbVariant eWkbVariant ) const;
00877     OGRBoolean      Equals(OGRCurveCollection *poOCC) const;
00878     void            setCoordinateDimension( OGRGeometry* poGeom,
00879                                             int nNewDimension );
00880     void            set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
00881     void            setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
00882     int             getNumCurves() const;
00883     OGRCurve       *getCurve( int );
00884     const OGRCurve *getCurve( int ) const;
00885     OGRCurve       *stealCurve( int );
00886     OGRErr          transform( OGRGeometry* poGeom,
00887                                OGRCoordinateTransformation *poCT );
00888     void            flattenTo2D( OGRGeometry* poGeom );
00889     void            segmentize( double dfMaxLength );
00890     void            swapXY();
00891     OGRBoolean      hasCurveGeometry(int bLookForNonLinear) const;
00892 };
00894 
00895 /************************************************************************/
00896 /*                            OGRCompoundCurve                          */
00897 /************************************************************************/
00898 
00909 class CPL_DLL OGRCompoundCurve : public OGRCurve
00910 {
00911   private:
00912     OGRCurveCollection oCC;
00913 
00914     OGRErr      addCurveDirectlyInternal( OGRCurve* poCurve,
00915                                           double dfToleranceEps,
00916                                           int bNeedRealloc );
00917     static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
00918                                            OGRCurve* poCurve );
00919     static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
00920                                            OGRCurve* poCurve );
00921     OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
00922                                         const char* const* papszOptions,
00923                                         int bIsLinearRing ) const;
00924 
00925   protected:
00927     static OGRLineString* CastToLineString( OGRCompoundCurve* poCC );
00928     static OGRLinearRing* CastToLinearRing( OGRCompoundCurve* poCC );
00929 
00930     virtual OGRCurveCasterToLineString GetCasterToLineString()
00931         const CPL_OVERRIDE;
00932     virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
00933         const CPL_OVERRIDE;
00935 
00936   public:
00937                 OGRCompoundCurve();
00938                 OGRCompoundCurve( const OGRCompoundCurve& other );
00939     virtual     ~OGRCompoundCurve();
00940 
00941     OGRCompoundCurve& operator=( const OGRCompoundCurve& other );
00942 
00943     // IWks Interface
00944     virtual int WkbSize() const CPL_OVERRIDE;
00945     virtual OGRErr importFromWkb( unsigned char *, int = -1,
00946                                   OGRwkbVariant=wkbVariantOldOgc ) CPL_OVERRIDE;
00947     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
00948                                 OGRwkbVariant=wkbVariantOldOgc )
00949         const CPL_OVERRIDE;
00950     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
00951     virtual OGRErr exportToWkt( char ** ppszDstText,
00952                                 OGRwkbVariant=wkbVariantOldOgc )
00953         const CPL_OVERRIDE;
00954 
00955     // IGeometry interface.
00956     virtual OGRGeometry *clone() const CPL_OVERRIDE;
00957     virtual void empty() CPL_OVERRIDE;
00958     virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
00959     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
00960     virtual OGRBoolean  IsEmpty() const CPL_OVERRIDE;
00961 
00962     // ICurve methods.
00963     virtual double get_Length() const CPL_OVERRIDE;
00964     virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
00965     virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
00966     virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
00967     virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
00968                                         const char* const* papszOptions = NULL )
00969         const CPL_OVERRIDE;
00970 
00971     virtual int getNumPoints() const CPL_OVERRIDE;
00972     virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
00973     virtual double get_Area() const CPL_OVERRIDE;
00974 
00975     // ISpatialRelation.
00976     virtual OGRBoolean  Equals( OGRGeometry * ) const CPL_OVERRIDE;
00977 
00978     // ICompoundCurve method.
00979     int             getNumCurves() const;
00980     OGRCurve       *getCurve( int );
00981     const OGRCurve *getCurve( int ) const;
00982 
00983     // Non-standard.
00984     virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
00985     virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
00986     virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
00987 
00988     OGRErr         addCurve( OGRCurve*, double dfToleranceEps = 1e-14  );
00989     OGRErr         addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
00990     OGRCurve      *stealCurve( int );
00991     virtual OGRPointIterator* getPointIterator() const CPL_OVERRIDE;
00992 
00993     // Non-standard from OGRGeometry.
00994     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
00995     virtual const char *getGeometryName() const CPL_OVERRIDE;
00996     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
00997     virtual void flattenTo2D() CPL_OVERRIDE;
00998     virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
00999     virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
01000         const CPL_OVERRIDE;
01001     virtual OGRGeometry* getLinearGeometry(
01002         double dfMaxAngleStepSizeDegrees = 0,
01003         const char* const* papszOptions = NULL) const CPL_OVERRIDE;
01004 
01005     virtual void        swapXY() CPL_OVERRIDE;
01006 };
01007 
01008 /************************************************************************/
01009 /*                              OGRSurface                              */
01010 /************************************************************************/
01011 
01017 class CPL_DLL OGRSurface : public OGRGeometry
01018 {
01019   protected:
01021     virtual OGRSurfaceCasterToPolygon      GetCasterToPolygon() const = 0;
01022     virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
01024 
01025   public:
01026     virtual double      get_Area() const = 0;
01027     virtual OGRErr      PointOnSurface( OGRPoint * poPoint ) const = 0;
01029     static OGRPolygon*      CastToPolygon(OGRSurface* poSurface);
01030     static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
01032 };
01033 
01034 /************************************************************************/
01035 /*                          OGRCurvePolygon                             */
01036 /************************************************************************/
01037 
01051 class CPL_DLL OGRCurvePolygon : public OGRSurface
01052 {
01053   private:
01054     OGRBoolean      ContainsPoint( const OGRPoint* p ) const;
01055     virtual int   checkRing( OGRCurve * poNewRing ) const;
01056     OGRErr        addRingDirectlyInternal( OGRCurve* poCurve,
01057                                            int bNeedRealloc );
01058     static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
01059                                            OGRCurve* poCurve );
01060     static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
01061                                            OGRCurve* poCurve );
01062 
01063   protected:
01065     friend class OGRPolygon;
01066     friend class OGRTriangle;
01067     OGRCurveCollection oCC;
01068 
01069     virtual OGRSurfaceCasterToPolygon      GetCasterToPolygon()
01070         const CPL_OVERRIDE;
01071     virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
01072         const CPL_OVERRIDE;
01074 
01075     static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
01076 
01077   public:
01078                 OGRCurvePolygon();
01079                 OGRCurvePolygon( const OGRCurvePolygon& );
01080     virtual    ~OGRCurvePolygon();
01081 
01082     OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
01083 
01084     // Non standard (OGRGeometry).
01085     virtual const char *getGeometryName() const CPL_OVERRIDE;
01086     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
01087     virtual OGRGeometry *clone() const CPL_OVERRIDE;
01088     virtual void empty() CPL_OVERRIDE;
01089     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
01090     virtual void flattenTo2D() CPL_OVERRIDE;
01091     virtual OGRBoolean  IsEmpty() const CPL_OVERRIDE;
01092     virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
01093     virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
01094         const CPL_OVERRIDE;
01095     virtual OGRGeometry* getLinearGeometry(
01096         double dfMaxAngleStepSizeDegrees = 0,
01097         const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
01098 
01099     // ISurface Interface
01100     virtual double      get_Area() const CPL_OVERRIDE;
01101     virtual OGRErr      PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
01102 
01103     // IWks Interface
01104     virtual int WkbSize() const CPL_OVERRIDE;
01105     virtual OGRErr importFromWkb( unsigned char *, int = -1,
01106                                   OGRwkbVariant=wkbVariantOldOgc ) CPL_OVERRIDE;
01107     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
01108                                 OGRwkbVariant=wkbVariantOldOgc )
01109         const CPL_OVERRIDE;
01110     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
01111     virtual OGRErr exportToWkt( char ** ppszDstText,
01112                                 OGRwkbVariant eWkbVariant = wkbVariantOldOgc )
01113         const CPL_OVERRIDE;
01114 
01115     // IGeometry
01116     virtual int getDimension() const CPL_OVERRIDE;
01117     virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
01118     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
01119 
01120     // ICurvePolygon
01121     virtual OGRPolygon* CurvePolyToPoly(
01122         double dfMaxAngleStepSizeDegrees = 0,
01123         const char* const* papszOptions = NULL ) const;
01124 
01125     // ISpatialRelation
01126     virtual OGRBoolean  Equals( OGRGeometry * ) const CPL_OVERRIDE;
01127     virtual OGRBoolean  Intersects( const OGRGeometry * ) const CPL_OVERRIDE;
01128     virtual OGRBoolean  Contains( const OGRGeometry * ) const CPL_OVERRIDE;
01129 
01130     // Non standard
01131     virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
01132     virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
01133     virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
01134 
01135     virtual OGRErr addRing( OGRCurve * );
01136     virtual OGRErr addRingDirectly( OGRCurve * );
01137 
01138     OGRCurve *getExteriorRingCurve();
01139     const OGRCurve *getExteriorRingCurve() const;
01140     int         getNumInteriorRings() const;
01141     OGRCurve *getInteriorRingCurve( int );
01142     const OGRCurve *getInteriorRingCurve( int ) const;
01143 
01144     OGRCurve *stealExteriorRingCurve();
01145 
01146     virtual void        swapXY() CPL_OVERRIDE;
01147 };
01148 
01149 /************************************************************************/
01150 /*                              OGRPolygon                              */
01151 /************************************************************************/
01152 
01162 class CPL_DLL OGRPolygon : public OGRCurvePolygon
01163 {
01164   protected:
01166     friend class OGRMultiSurface;
01167     friend class OGRPolyhedralSurface;
01168     friend class OGRTriangulatedSurface;
01169 
01170     virtual int checkRing( OGRCurve * poNewRing ) const CPL_OVERRIDE;
01171     virtual OGRErr importFromWKTListOnly( char ** ppszInput,
01172                                           int bHasZ, int bHasM,
01173                                           OGRRawPoint*& paoPoints,
01174                                           int& nMaxPoints,
01175                                           double*& padfZ );
01176 
01177     static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
01178 
01179     virtual OGRSurfaceCasterToPolygon      GetCasterToPolygon()
01180         const CPL_OVERRIDE;
01181     virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
01182         const CPL_OVERRIDE;
01184 
01185   public:
01186                 OGRPolygon();
01187                 OGRPolygon(const OGRPolygon& other);
01188     virtual    ~OGRPolygon();
01189 
01190     OGRPolygon& operator=(const OGRPolygon& other);
01191 
01192     // Non-standard (OGRGeometry).
01193     virtual const char *getGeometryName() const CPL_OVERRIDE;
01194     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
01195     virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
01196         const CPL_OVERRIDE;
01197     virtual OGRGeometry* getCurveGeometry(
01198     const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
01199     virtual OGRGeometry* getLinearGeometry(
01200         double dfMaxAngleStepSizeDegrees = 0,
01201         const char* const* papszOptions = NULL) const CPL_OVERRIDE;
01202 
01203     // ISurface Interface.
01204     virtual OGRErr        PointOnSurface( OGRPoint * poPoint )
01205         const CPL_OVERRIDE;
01206 
01207     // IWks Interface.
01208     virtual int WkbSize() const CPL_OVERRIDE;
01209     virtual OGRErr importFromWkb( unsigned char *, int = -1,
01210                                   OGRwkbVariant=wkbVariantOldOgc ) CPL_OVERRIDE;
01211     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
01212                                 OGRwkbVariant=wkbVariantOldOgc )
01213         const CPL_OVERRIDE;
01214     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
01215     virtual OGRErr exportToWkt( char ** ppszDstText,
01216                                 OGRwkbVariant=wkbVariantOldOgc )
01217         const CPL_OVERRIDE;
01218 
01219     // ICurvePolygon.
01220     virtual OGRPolygon* CurvePolyToPoly(
01221         double dfMaxAngleStepSizeDegrees = 0,
01222         const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
01223 
01224     OGRLinearRing *getExteriorRing();
01225     const OGRLinearRing *getExteriorRing() const;
01226     virtual OGRLinearRing *getInteriorRing( int );
01227     virtual const OGRLinearRing *getInteriorRing( int ) const;
01228 
01229     OGRLinearRing *stealExteriorRing();
01230     virtual OGRLinearRing *stealInteriorRing(int);
01231 
01232     OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
01233 
01234     virtual void closeRings() CPL_OVERRIDE;
01235 };
01236 
01237 /************************************************************************/
01238 /*                              OGRTriangle                             */
01239 /************************************************************************/
01240 
01247 class CPL_DLL OGRTriangle : public OGRPolygon
01248 {
01249   private:
01250     bool quickValidityCheck() const;
01251 
01252   protected:
01254     virtual OGRSurfaceCasterToPolygon   GetCasterToPolygon() const CPL_OVERRIDE;
01255     virtual OGRErr importFromWKTListOnly( char ** ppszInput,
01256                                           int bHasZ, int bHasM,
01257                                           OGRRawPoint*& paoPoints,
01258                                           int& nMaxPoints,
01259                                           double*& padfZ ) CPL_OVERRIDE;
01261 
01262   public:
01263     OGRTriangle();
01264     OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
01265     OGRTriangle( const OGRTriangle &other );
01266     OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
01267     OGRTriangle& operator=( const OGRTriangle& other );
01268     virtual ~OGRTriangle();
01269     virtual const char *getGeometryName() const CPL_OVERRIDE;
01270     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
01271 
01272     // IWks Interface.
01273     virtual OGRErr importFromWkb( unsigned char *, int = -1,
01274                                   OGRwkbVariant=wkbVariantOldOgc ) CPL_OVERRIDE;
01275 
01276     // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
01277     virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) CPL_OVERRIDE;
01278 
01280     static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
01282 };
01283 
01284 /************************************************************************/
01285 /*                        OGRGeometryCollection                         */
01286 /************************************************************************/
01287 
01295 class CPL_DLL OGRGeometryCollection : public OGRGeometry
01296 {
01297     OGRErr      importFromWkbInternal( unsigned char * pabyData, int nSize,
01298                                        int nRecLevel,
01299                                        OGRwkbVariant );
01300     OGRErr      importFromWktInternal( char **ppszInput, int nRecLevel );
01301 
01302   protected:
01304     int         nGeomCount;
01305     OGRGeometry **papoGeoms;
01306 
01307     OGRErr              exportToWktInternal( char ** ppszDstText,
01308                                              OGRwkbVariant eWkbVariant,
01309                                              const char* pszSkipPrefix ) const;
01310     static OGRGeometryCollection* TransferMembersAndDestroy(
01311         OGRGeometryCollection* poSrc,
01312         OGRGeometryCollection* poDst );
01314     virtual OGRBoolean         isCompatibleSubType( OGRwkbGeometryType ) const;
01315 
01316   public:
01317                 OGRGeometryCollection();
01318                 OGRGeometryCollection( const OGRGeometryCollection& other );
01319     virtual     ~OGRGeometryCollection();
01320 
01321     OGRGeometryCollection& operator=( const OGRGeometryCollection& other );
01322 
01323     // Non standard (OGRGeometry).
01324     virtual const char *getGeometryName() const CPL_OVERRIDE;
01325     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
01326     virtual OGRGeometry *clone() const CPL_OVERRIDE;
01327     virtual void empty() CPL_OVERRIDE;
01328     virtual OGRErr  transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
01329     virtual void flattenTo2D() CPL_OVERRIDE;
01330     virtual OGRBoolean  IsEmpty() const CPL_OVERRIDE;
01331     virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
01332     virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
01333         const CPL_OVERRIDE;
01334     virtual OGRGeometry* getCurveGeometry(
01335         const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
01336     virtual OGRGeometry* getLinearGeometry(
01337         double dfMaxAngleStepSizeDegrees = 0,
01338         const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
01339 
01340     // IWks Interface
01341     virtual int WkbSize() const CPL_OVERRIDE;
01342     virtual OGRErr importFromWkb( unsigned char *, int = -1,
01343                                   OGRwkbVariant=wkbVariantOldOgc ) CPL_OVERRIDE;
01344     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
01345                                 OGRwkbVariant=wkbVariantOldOgc )
01346         const CPL_OVERRIDE;
01347     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
01348     virtual OGRErr exportToWkt( char ** ppszDstText,
01349                                 OGRwkbVariant=wkbVariantOldOgc )
01350         const CPL_OVERRIDE;
01351 
01352     virtual double get_Length() const;
01353     virtual double get_Area() const;
01354 
01355     // IGeometry methods
01356     virtual int getDimension() const CPL_OVERRIDE;
01357     virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
01358     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
01359 
01360     // IGeometryCollection
01361     int         getNumGeometries() const;
01362     OGRGeometry *getGeometryRef( int );
01363     const OGRGeometry *getGeometryRef( int ) const;
01364 
01365     // ISpatialRelation
01366     virtual OGRBoolean  Equals( OGRGeometry * ) const CPL_OVERRIDE;
01367 
01368     // Non standard
01369     virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
01370     virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
01371     virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
01372     virtual OGRErr addGeometry( const OGRGeometry * );
01373     virtual OGRErr addGeometryDirectly( OGRGeometry * );
01374     virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
01375 
01376     void closeRings() CPL_OVERRIDE;
01377 
01378     virtual void swapXY() CPL_OVERRIDE;
01379 
01380     static OGRGeometryCollection* CastToGeometryCollection(
01381         OGRGeometryCollection* poSrc );
01382 };
01383 
01384 /************************************************************************/
01385 /*                          OGRMultiSurface                             */
01386 /************************************************************************/
01387 
01394 class CPL_DLL OGRMultiSurface : public OGRGeometryCollection
01395 {
01396   protected:
01397     virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
01398         const CPL_OVERRIDE;
01399 
01400   public:
01401             OGRMultiSurface();
01402             OGRMultiSurface( const OGRMultiSurface& other );
01403     virtual ~OGRMultiSurface();
01404 
01405     OGRMultiSurface& operator=( const OGRMultiSurface& other );
01406 
01407     // Non standard (OGRGeometry).
01408     virtual const char *getGeometryName() const CPL_OVERRIDE;
01409     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
01410     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
01411     virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
01412         const CPL_OVERRIDE;
01413 
01414     // IMultiSurface methods
01415     virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
01416 
01417     // IGeometry methods
01418     virtual int getDimension() const CPL_OVERRIDE;
01419 
01420     // Non standard
01421     virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
01422         const CPL_OVERRIDE;
01423 
01424     static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
01425 };
01426 
01427 /************************************************************************/
01428 /*                           OGRMultiPolygon                            */
01429 /************************************************************************/
01430 
01435 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
01436 {
01437   protected:
01438     virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
01439         const CPL_OVERRIDE;
01440     friend class OGRPolyhedralSurface;
01441     friend class OGRTriangulatedSurface;
01442 
01443   private:
01445             OGRErr _addGeometryWithExpectedSubGeometryType(
01446                 const OGRGeometry * poNewGeom,
01447                 OGRwkbGeometryType eSubGeometryType );
01448             OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
01449                 OGRGeometry * poNewGeom,
01450                 OGRwkbGeometryType eSubGeometryType );
01452 
01453 
01454   public:
01455             OGRMultiPolygon();
01456             OGRMultiPolygon(const OGRMultiPolygon& other);
01457     virtual ~OGRMultiPolygon();
01458 
01459     OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
01460 
01461     // Non-standard (OGRGeometry).
01462     virtual const char *getGeometryName() const CPL_OVERRIDE;
01463     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
01464     virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
01465         const CPL_OVERRIDE;
01466 
01467     // IMultiSurface methods
01468     virtual OGRErr      PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
01469 
01470     // Non standard
01471     virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
01472         const CPL_OVERRIDE;
01473 
01474     static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
01475 };
01476 
01477 /************************************************************************/
01478 /*                         OGRPolyhedralSurface                         */
01479 /************************************************************************/
01480 
01487 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
01488 {
01489   protected:
01491     friend class OGRTriangulatedSurface;
01492     OGRMultiPolygon oMP;
01493     virtual OGRSurfaceCasterToPolygon      GetCasterToPolygon()
01494         const CPL_OVERRIDE;
01495     virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
01496       const CPL_OVERRIDE;
01497     virtual OGRBoolean         isCompatibleSubType( OGRwkbGeometryType ) const;
01498     virtual const char*        getSubGeometryName() const;
01499     virtual OGRwkbGeometryType getSubGeometryType() const;
01500     OGRErr exportToWktInternal (char ** ppszDstText, OGRwkbVariant eWkbVariant,
01501                                 const char* pszSkipPrefix ) const;
01502 
01503     virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
01504         const;
01505     static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
01507 
01508   public:
01509     OGRPolyhedralSurface();
01510     OGRPolyhedralSurface(const OGRPolyhedralSurface &poGeom);
01511     virtual ~OGRPolyhedralSurface();
01512     OGRPolyhedralSurface& operator=(const OGRPolyhedralSurface& other);
01513 
01514     // IWks Interface.
01515     virtual int WkbSize() const CPL_OVERRIDE;
01516     virtual const char *getGeometryName() const CPL_OVERRIDE;
01517     virtual OGRwkbGeometryType getGeometryType() const  CPL_OVERRIDE;
01518     virtual OGRErr importFromWkb( unsigned char *, int=-1,
01519                                   OGRwkbVariant=wkbVariantOldOgc ) CPL_OVERRIDE;
01520     virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
01521                                 OGRwkbVariant=wkbVariantOldOgc )
01522         const CPL_OVERRIDE;
01523     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
01524     virtual OGRErr exportToWkt( char ** ppszDstText,
01525                                 OGRwkbVariant=wkbVariantOldOgc )
01526         const CPL_OVERRIDE;
01527 
01528     // IGeometry methods.
01529     virtual int getDimension() const CPL_OVERRIDE;
01530 
01531     virtual void empty() CPL_OVERRIDE;
01532 
01533     virtual OGRGeometry *clone() const CPL_OVERRIDE;
01534     virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
01535     virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
01536 
01537     virtual void flattenTo2D() CPL_OVERRIDE;
01538     virtual OGRErr transform( OGRCoordinateTransformation* ) CPL_OVERRIDE;
01539     virtual OGRBoolean Equals( OGRGeometry* ) const CPL_OVERRIDE;
01540     virtual double get_Area() const CPL_OVERRIDE;
01541     virtual OGRErr PointOnSurface( OGRPoint* ) const CPL_OVERRIDE;
01542 
01543     static OGRMultiPolygon* CastToMultiPolygon( OGRPolyhedralSurface* poPS );
01544     virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
01545         const CPL_OVERRIDE;
01546     virtual OGRErr addGeometry( const OGRGeometry * );
01547     OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
01548     int getNumGeometries() const;
01549     OGRGeometry* getGeometryRef(int i);
01550     const OGRGeometry* getGeometryRef(int i) const;
01551 
01552     virtual OGRBoolean  IsEmpty() const CPL_OVERRIDE;
01553     virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
01554     virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
01555     virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
01556     virtual void swapXY() CPL_OVERRIDE;
01557     OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
01558 };
01559 
01560 /************************************************************************/
01561 /*                        OGRTriangulatedSurface                        */
01562 /************************************************************************/
01563 
01570 class CPL_DLL OGRTriangulatedSurface : public OGRPolyhedralSurface
01571 {
01572   protected:
01574     virtual OGRBoolean         isCompatibleSubType( OGRwkbGeometryType )
01575         const CPL_OVERRIDE;
01576     virtual const char*        getSubGeometryName() const CPL_OVERRIDE;
01577     virtual OGRwkbGeometryType getSubGeometryType() const CPL_OVERRIDE;
01578 
01579     virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
01580         const CPL_OVERRIDE;
01581     static OGRMultiPolygon *
01582         CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
01584 
01585   public:
01586     OGRTriangulatedSurface();
01587     OGRTriangulatedSurface( const OGRTriangulatedSurface &other );
01588     ~OGRTriangulatedSurface();
01589 
01590     OGRTriangulatedSurface& operator=( const OGRTriangulatedSurface& other );
01591     virtual const char *getGeometryName() const CPL_OVERRIDE;
01592     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
01593 
01594     // IWks Interface.
01595     virtual OGRErr addGeometry( const OGRGeometry * ) CPL_OVERRIDE;
01596 
01597     static OGRPolyhedralSurface *
01598         CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
01599 };
01600 
01601 /************************************************************************/
01602 /*                            OGRMultiPoint                             */
01603 /************************************************************************/
01604 
01609 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
01610 {
01611   private:
01612     OGRErr  importFromWkt_Bracketed( char **, int bHasM, int bHasZ );
01613 
01614   protected:
01615     virtual OGRBoolean  isCompatibleSubType( OGRwkbGeometryType )
01616         const CPL_OVERRIDE;
01617 
01618   public:
01619             OGRMultiPoint();
01620             OGRMultiPoint(const OGRMultiPoint& other);
01621     virtual ~OGRMultiPoint();
01622 
01623     OGRMultiPoint& operator=(const OGRMultiPoint& other);
01624 
01625     // Non-standard (OGRGeometry).
01626     virtual const char *getGeometryName() const CPL_OVERRIDE;
01627     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
01628     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
01629     virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
01630         const CPL_OVERRIDE;
01631 
01632     // IGeometry methods.
01633     virtual int getDimension() const CPL_OVERRIDE;
01634 
01635     // Non-standard.
01636     virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
01637         const CPL_OVERRIDE;
01638 };
01639 
01640 /************************************************************************/
01641 /*                          OGRMultiCurve                               */
01642 /************************************************************************/
01643 
01650 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
01651 {
01652   protected:
01654     static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
01655                                            OGRCurve* poCurve );
01657     virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
01658         const CPL_OVERRIDE;
01659 
01660   public:
01661             OGRMultiCurve();
01662             OGRMultiCurve( const OGRMultiCurve& other );
01663     virtual ~OGRMultiCurve();
01664 
01665     OGRMultiCurve& operator=( const OGRMultiCurve& other );
01666 
01667     // Non standard (OGRGeometry).
01668     virtual const char *getGeometryName() const CPL_OVERRIDE;
01669     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
01670     virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
01671     virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
01672         const CPL_OVERRIDE;
01673 
01674     // IGeometry methods.
01675     virtual int getDimension() const CPL_OVERRIDE;
01676 
01677     // Non-standard.
01678     virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
01679         const CPL_OVERRIDE;
01680 
01681     static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
01682 };
01683 
01684 /************************************************************************/
01685 /*                          OGRMultiLineString                          */
01686 /************************************************************************/
01687 
01692 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
01693 {
01694   protected:
01695     virtual OGRBoolean  isCompatibleSubType( OGRwkbGeometryType )
01696         const CPL_OVERRIDE;
01697 
01698   public:
01699             OGRMultiLineString();
01700             OGRMultiLineString( const OGRMultiLineString& other );
01701     virtual ~OGRMultiLineString();
01702 
01703     OGRMultiLineString& operator=( const OGRMultiLineString& other );
01704 
01705     // Non standard (OGRGeometry).
01706     virtual const char *getGeometryName() const CPL_OVERRIDE;
01707     virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
01708     virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
01709         const CPL_OVERRIDE;
01710 
01711     // Non standard
01712     virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
01713         const CPL_OVERRIDE;
01714 
01715     static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
01716 };
01717 
01718 /************************************************************************/
01719 /*                          OGRGeometryFactory                          */
01720 /************************************************************************/
01721 
01726 class CPL_DLL OGRGeometryFactory
01727 {
01728     static OGRErr createFromFgfInternal( unsigned char *pabyData,
01729                                          OGRSpatialReference * poSR,
01730                                          OGRGeometry **ppoReturn,
01731                                          int nBytes,
01732                                          int *pnBytesConsumed,
01733                                          int nRecLevel );
01734   public:
01735     static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
01736                                  OGRGeometry **, int = -1,
01737                                  OGRwkbVariant=wkbVariantOldOgc );
01738     static OGRErr createFromWkt( char **, OGRSpatialReference *,
01739                                  OGRGeometry ** );
01740     static OGRErr createFromFgf( unsigned char *, OGRSpatialReference *,
01741                                  OGRGeometry **, int = -1, int * = NULL );
01742     static OGRGeometry *createFromGML( const char * );
01743     static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
01744                                         GEOSGeom );
01745 
01746     static void   destroyGeometry( OGRGeometry * );
01747     static OGRGeometry *createGeometry( OGRwkbGeometryType );
01748 
01749     static OGRGeometry * forceToPolygon( OGRGeometry * );
01750     static OGRGeometry * forceToLineString( OGRGeometry *,
01751                                             bool bOnlyInOrder = true );
01752     static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
01753     static OGRGeometry * forceToMultiPoint( OGRGeometry * );
01754     static OGRGeometry * forceToMultiLineString( OGRGeometry * );
01755 
01756     static OGRGeometry * forceTo( OGRGeometry* poGeom,
01757                                   OGRwkbGeometryType eTargetType,
01758                                   const char*const* papszOptions = NULL );
01759 
01760     static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
01761                                            int nPolygonCount,
01762                                            int *pbResultValidGeometry,
01763                                            const char **papszOptions = NULL);
01764     static bool haveGEOS();
01765 
01766     static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
01767                                               OGRCoordinateTransformation *poCT,
01768                                               char** papszOptions );
01769 
01770     static OGRGeometry*
01771         approximateArcAngles( double dfX, double dfY, double dfZ,
01772                               double dfPrimaryRadius, double dfSecondaryAxis,
01773                               double dfRotation,
01774                               double dfStartAngle, double dfEndAngle,
01775                               double dfMaxAngleStepSizeDegrees );
01776 
01777     static int GetCurveParmeters( double x0, double y0,
01778                                   double x1, double y1,
01779                                   double x2, double y2,
01780                                   double& R, double& cx, double& cy,
01781                                   double& alpha0, double& alpha1,
01782                                   double& alpha2 );
01783     static OGRLineString* curveToLineString(
01784         double x0, double y0, double z0,
01785         double x1, double y1, double z1,
01786         double x2, double y2, double z2,
01787         int bHasZ,
01788         double dfMaxAngleStepSizeDegrees,
01789         const char* const * papszOptions = NULL );
01790     static OGRCurve* curveFromLineString(
01791         const OGRLineString* poLS,
01792         const char* const * papszOptions = NULL);
01793 };
01794 
01795 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
01796 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
01797 
01799 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
01800 int OGRHasPreparedGeometrySupport();
01801 OGRPreparedGeometry* OGRCreatePreparedGeometry( const OGRGeometry* poGeom );
01802 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
01803 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
01804                                    const OGRGeometry* poOtherGeom );
01805 int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
01806                                  const OGRGeometry* poOtherGeom );
01807 
01808 #endif /* ndef OGR_GEOMETRY_H_INCLUDED */

Generated for GDAL by doxygen 1.7.6.1.