00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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 xIn, double yIn) : x(xIn), y(yIn) {}
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
00084
00085
00104 class CPL_DLL OGRGeometry
00105 {
00106 private:
00107 OGRSpatialReference * poSRS;
00108
00109 protected:
00110 friend class OGRCurveCollection;
00111
00112 unsigned int flags;
00113
00114 OGRErr importPreambuleFromWkt( char ** ppszInput,
00115 int* pbHasZ, int* pbHasM,
00116 bool* pbIsEmpty );
00117 OGRErr importCurveCollectionFromWkt( char ** ppszInput,
00118 int bAllowEmptyComponent,
00119 int bAllowLineString,
00120 int bAllowCurve,
00121 int bAllowCompoundCurve,
00122 OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf, OGRCurve* poCurve) );
00123 OGRErr importPreambuleFromWkb( unsigned char * pabyData,
00124 int nSize,
00125 OGRwkbByteOrder& eByteOrder,
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 OGRErr PointOnSurfaceInternal( OGRPoint * poPoint ) const;
00136
00137 public:
00138
00139
00140
00141
00142
00143
00144
00145
00146 static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
00147 static const unsigned int OGR_G_3D = 0x2;
00148 static const unsigned int OGR_G_MEASURED = 0x4;
00149
00150 OGRGeometry();
00151 OGRGeometry( const OGRGeometry& other );
00152 virtual ~OGRGeometry();
00153
00154 OGRGeometry& operator=( const OGRGeometry& other );
00155
00156
00157 virtual int getDimension() const = 0;
00158 virtual int getCoordinateDimension() const;
00159 int CoordinateDimension() const;
00160 virtual OGRBoolean IsEmpty() const;
00161 virtual OGRBoolean IsValid() const;
00162 virtual OGRBoolean IsSimple() const;
00163 OGRBoolean Is3D() const { return flags & OGR_G_3D; }
00164 OGRBoolean IsMeasured() const { return flags & OGR_G_MEASURED; }
00165 virtual OGRBoolean IsRing() const;
00166 virtual void empty() = 0;
00167 virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
00168 virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
00169 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
00170
00171
00172 virtual int WkbSize() const = 0;
00173 virtual OGRErr importFromWkb( unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc )=0;
00174 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const = 0;
00175 virtual OGRErr importFromWkt( char ** ppszInput ) = 0;
00176 virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const = 0;
00177
00178
00179 virtual OGRwkbGeometryType getGeometryType() const = 0;
00180 OGRwkbGeometryType getIsoGeometryType() const;
00181 virtual const char *getGeometryName() const = 0;
00182 virtual void dumpReadable( FILE *, const char * = NULL, char** papszOptions = NULL ) const;
00183 virtual void flattenTo2D() = 0;
00184 virtual char * exportToGML( const char* const * papszOptions = NULL ) const;
00185 virtual char * exportToKML() const;
00186 virtual char * exportToJson() const;
00187
00188 static GEOSContextHandle_t createGEOSContext();
00189 static void freeGEOSContext(GEOSContextHandle_t hGEOSCtxt);
00190 virtual GEOSGeom exportToGEOS(GEOSContextHandle_t hGEOSCtxt) const CPL_WARN_UNUSED_RESULT;
00191 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
00192 virtual OGRGeometry* getCurveGeometry(const char* const* papszOptions = NULL) const CPL_WARN_UNUSED_RESULT;
00193 virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
00194 const char* const* papszOptions = NULL) const CPL_WARN_UNUSED_RESULT;
00195
00196 virtual void closeRings();
00197
00198 virtual void setCoordinateDimension( int nDimension );
00199 virtual void set3D( OGRBoolean bIs3D );
00200 virtual void setMeasured( OGRBoolean bIsMeasured );
00201
00202 void assignSpatialReference( OGRSpatialReference * poSR );
00203 OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
00204
00205 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) = 0;
00206 OGRErr transformTo( OGRSpatialReference *poSR );
00207
00208 virtual void segmentize(double dfMaxLength);
00209
00210
00211 virtual OGRBoolean Intersects( const OGRGeometry * ) const;
00212 virtual OGRBoolean Equals( OGRGeometry * ) const = 0;
00213 virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
00214 virtual OGRBoolean Touches( const OGRGeometry * ) const;
00215 virtual OGRBoolean Crosses( const OGRGeometry * ) const;
00216 virtual OGRBoolean Within( const OGRGeometry * ) const;
00217 virtual OGRBoolean Contains( const OGRGeometry * ) const;
00218 virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
00219
00220
00221
00222
00223 virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
00224 virtual double Distance( const OGRGeometry * ) const ;
00225 virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
00226 virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 ) const CPL_WARN_UNUSED_RESULT;
00227 virtual OGRGeometry *Intersection( const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
00228 virtual OGRGeometry *Union( const OGRGeometry * ) const CPL_WARN_UNUSED_RESULT;
00229 virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
00230 virtual OGRGeometry *Difference( const OGRGeometry * ) const CPL_WARN_UNUSED_RESULT;
00231 virtual OGRGeometry *SymDifference( const OGRGeometry * ) const CPL_WARN_UNUSED_RESULT;
00232 virtual OGRErr Centroid( OGRPoint * poPoint ) const;
00233 virtual OGRGeometry *Simplify(double dTolerance) const CPL_WARN_UNUSED_RESULT;
00234 OGRGeometry *SimplifyPreserveTopology(double dTolerance) const CPL_WARN_UNUSED_RESULT;
00235 virtual OGRGeometry *DelaunayTriangulation(double dfTolerance, int bOnlyEdges) const CPL_WARN_UNUSED_RESULT;
00236
00237 virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
00238
00239
00240 OGRBoolean Intersect( OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use Intersects() instead");
00241 OGRBoolean Equal( OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use Equals() instead");
00242 OGRGeometry *SymmetricDifference( const OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use SymDifference() instead");
00243 OGRGeometry *getBoundary() const CPL_WARN_DEPRECATED("Non standard method. Use Boundary() instead");
00244
00245
00246 static int bGenerate_DB2_V72_BYTE_ORDER;
00247
00248 virtual void swapXY();
00249
00250 static OGRGeometry* CastToIdentity(OGRGeometry* poGeom) { return poGeom; }
00251 static OGRGeometry* CastToError(OGRGeometry* poGeom);
00252 };
00253
00254
00255
00256
00257
00264 class CPL_DLL OGRPoint : public OGRGeometry
00265 {
00266 double x;
00267 double y;
00268 double z;
00269 double m;
00270
00271 public:
00272 OGRPoint();
00273 OGRPoint( double x, double y );
00274 OGRPoint( double x, double y, double z );
00275 OGRPoint( double x, double y, double z, double m );
00276 OGRPoint( const OGRPoint& other );
00277 virtual ~OGRPoint();
00278
00279 OGRPoint& operator=( const OGRPoint& other );
00280
00281
00282 virtual int WkbSize() const;
00283 virtual OGRErr importFromWkb( unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc );
00284 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
00285 virtual OGRErr importFromWkt( char ** );
00286 virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
00287
00288
00289 virtual int getDimension() const;
00290 virtual OGRGeometry *clone() const;
00291 virtual void empty();
00292 virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00293 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
00294 virtual OGRBoolean IsEmpty() const { return !(flags & OGR_G_NOT_EMPTY_POINT); }
00295
00296
00297 double getX() const { return x; }
00298 double getY() const { return y; }
00299 double getZ() const { return z; }
00300 double getM() const { return m; }
00301
00302
00303 virtual void setCoordinateDimension( int nDimension );
00304 void setX( double xIn ) { x = xIn; flags |= OGR_G_NOT_EMPTY_POINT; }
00305 void setY( double yIn ) { y = yIn; flags |= OGR_G_NOT_EMPTY_POINT; }
00306 void setZ( double zIn ) { z = zIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_3D); }
00307 void setM( double mIn ) { m = mIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_MEASURED); }
00308
00309
00310 virtual OGRBoolean Equals( OGRGeometry * ) const;
00311 virtual OGRBoolean Intersects( const OGRGeometry * ) const;
00312 virtual OGRBoolean Within( const OGRGeometry * ) const;
00313
00314
00315 virtual const char *getGeometryName() const;
00316 virtual OGRwkbGeometryType getGeometryType() const;
00317 virtual OGRErr transform( OGRCoordinateTransformation *poCT );
00318 virtual void flattenTo2D();
00319
00320 virtual void swapXY();
00321 };
00322
00323
00324
00325
00326
00333 class CPL_DLL OGRPointIterator
00334 {
00335 public:
00336 virtual ~OGRPointIterator();
00337 virtual OGRBoolean getNextPoint(OGRPoint* p) = 0;
00338
00339 static void destroy(OGRPointIterator*);
00340 };
00341
00342
00343
00344
00345
00351 class CPL_DLL OGRCurve : public OGRGeometry
00352 {
00353 protected:
00354 OGRCurve();
00355 OGRCurve( const OGRCurve& other );
00356
00357 virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
00358 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
00359
00360 friend class OGRCurvePolygon;
00361 friend class OGRCompoundCurve;
00362 virtual int ContainsPoint( const OGRPoint* p ) const;
00363 virtual double get_AreaOfCurveSegments() const = 0;
00364
00365 public:
00366 virtual ~OGRCurve();
00367
00368 OGRCurve& operator=( const OGRCurve& other );
00369
00370
00371 virtual double get_Length() const = 0;
00372 virtual void StartPoint(OGRPoint *) const = 0;
00373 virtual void EndPoint(OGRPoint *) const = 0;
00374 virtual int get_IsClosed() const;
00375 virtual void Value( double, OGRPoint * ) const = 0;
00376 virtual OGRLineString* CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
00377 const char* const* papszOptions = NULL) const = 0;
00378 virtual int getDimension() const;
00379
00380
00381 virtual int getNumPoints() const = 0;
00382 virtual OGRPointIterator* getPointIterator() const = 0;
00383 virtual OGRBoolean IsConvex() const;
00384 virtual double get_Area() const = 0;
00385
00386 static OGRCompoundCurve* CastToCompoundCurve(OGRCurve* puCurve);
00387 static OGRLineString* CastToLineString(OGRCurve* poCurve);
00388 static OGRLinearRing* CastToLinearRing(OGRCurve* poCurve);
00389 };
00390
00391
00392
00393
00394
00404 class CPL_DLL OGRSimpleCurve: public OGRCurve
00405 {
00406 protected:
00407 friend class OGRGeometry;
00408
00409 int nPointCount;
00410 OGRRawPoint *paoPoints;
00411 double *padfZ;
00412 double *padfM;
00413
00414 void Make3D();
00415 void Make2D();
00416 void RemoveM();
00417 void AddM();
00418
00419 OGRErr importFromWKTListOnly( char ** ppszInput, int bHasZ, int bHasM,
00420 OGRRawPoint*& paoPointsIn, int& nMaxPoints,
00421 double*& padfZIn );
00422
00423 virtual double get_LinearArea() const;
00424
00425 OGRSimpleCurve();
00426 OGRSimpleCurve( const OGRSimpleCurve& other );
00427
00428 public:
00429 virtual ~OGRSimpleCurve();
00430
00431 OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
00432
00433
00434 virtual int WkbSize() const;
00435 virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
00436 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
00437 virtual OGRErr importFromWkt( char ** );
00438 virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
00439
00440
00441 virtual OGRGeometry *clone() const;
00442 virtual void empty();
00443 virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00444 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
00445 virtual OGRBoolean IsEmpty() const;
00446
00447
00448 virtual double get_Length() const;
00449 virtual void StartPoint(OGRPoint *) const;
00450 virtual void EndPoint(OGRPoint *) const;
00451 virtual void Value( double, OGRPoint * ) const;
00452 virtual double Project(const OGRPoint *) const;
00453 virtual OGRLineString* getSubLine(double, double, int) const;
00454
00455
00456 virtual int getNumPoints() const { return nPointCount; }
00457 void getPoint( int, OGRPoint * ) const;
00458 double getX( int i ) const { return paoPoints[i].x; }
00459 double getY( int i ) const { return paoPoints[i].y; }
00460 double getZ( int i ) const;
00461 double getM( int i ) const;
00462
00463
00464 virtual OGRBoolean Equals( OGRGeometry * ) const;
00465
00466
00467 virtual void setCoordinateDimension( int nDimension );
00468 virtual void set3D( OGRBoolean bIs3D );
00469 virtual void setMeasured( OGRBoolean bIsMeasured );
00470 void setNumPoints( int nNewPointCount, int bZeroizeNewContent = TRUE );
00471 void setPoint( int, OGRPoint * );
00472 void setPoint( int, double, double );
00473 void setZ( int, double );
00474 void setM( int, double );
00475 void setPoint( int, double, double, double );
00476 void setPointM( int, double, double, double );
00477 void setPoint( int, double, double, double, double );
00478 void setPoints( int, OGRRawPoint *, double * = NULL );
00479 void setPointsM( int, OGRRawPoint *, double * );
00480 void setPoints( int, OGRRawPoint *, double *, double * );
00481 void setPoints( int, double * padfX, double * padfY,
00482 double *padfZIn = NULL );
00483 void setPointsM( int, double * padfX, double * padfY,
00484 double *padfMIn = NULL );
00485 void setPoints( int, double * padfX, double * padfY,
00486 double *padfZIn, double *padfMIn );
00487 void addPoint( OGRPoint * );
00488 void addPoint( double, double );
00489 void addPoint( double, double, double );
00490 void addPointM( double, double, double );
00491 void addPoint( double, double, double, double );
00492
00493 void getPoints( OGRRawPoint *, double * = NULL ) const;
00494 void getPoints( OGRRawPoint *, double *, double * ) const;
00495 void getPoints( void* pabyX, int nXStride,
00496 void* pabyY, int nYStride,
00497 void* pabyZ = NULL, int nZStride = 0 ) const;
00498 void getPoints( void* pabyX, int nXStride,
00499 void* pabyY, int nYStride,
00500 void* pabyZ, int nZStride,
00501 void* pabyM, int nMStride ) const;
00502
00503 void addSubLineString( const OGRLineString *,
00504 int nStartVertex = 0, int nEndVertex = -1 );
00505 void reversePoints( void );
00506 virtual OGRPointIterator* getPointIterator() const;
00507
00508
00509 virtual OGRErr transform( OGRCoordinateTransformation *poCT );
00510 virtual void flattenTo2D();
00511 virtual void segmentize(double dfMaxLength);
00512
00513 virtual void swapXY();
00514 };
00515
00516
00517
00518
00519
00527 class CPL_DLL OGRLineString : public OGRSimpleCurve
00528 {
00529 protected:
00530 static OGRLineString* TransferMembersAndDestroy(
00531 OGRLineString* poSrc,
00532 OGRLineString* poDst);
00533
00534 static OGRLinearRing* CastToLinearRing(OGRLineString* poLS);
00535
00536 virtual OGRCurveCasterToLineString GetCasterToLineString() const;
00537 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const;
00538
00539 virtual double get_AreaOfCurveSegments() const;
00540
00541 public:
00542 OGRLineString();
00543 OGRLineString(const OGRLineString& other);
00544 virtual ~OGRLineString();
00545
00546 OGRLineString& operator=(const OGRLineString& other);
00547
00548 virtual OGRLineString* CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
00549 const char* const* papszOptions = NULL) const;
00550 virtual OGRGeometry* getCurveGeometry(const char* const* papszOptions = NULL) const;
00551 virtual double get_Area() const;
00552
00553
00554 virtual OGRwkbGeometryType getGeometryType() const;
00555 virtual const char *getGeometryName() const;
00556 };
00557
00558
00559
00560
00561
00582 class CPL_DLL OGRLinearRing : public OGRLineString
00583 {
00584 protected:
00585 friend class OGRPolygon;
00586
00587
00588 virtual int _WkbSize( int _flags ) const;
00589 virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
00590 unsigned char *, int=-1 );
00591 virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
00592 unsigned char * ) const;
00593
00594 static OGRLineString* CastToLineString(OGRLinearRing* poLR);
00595
00596 virtual OGRCurveCasterToLineString GetCasterToLineString() const;
00597 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const;
00598
00599 public:
00600 OGRLinearRing();
00601 OGRLinearRing(const OGRLinearRing& other);
00602 OGRLinearRing( OGRLinearRing * );
00603 virtual ~OGRLinearRing();
00604
00605 OGRLinearRing& operator=(const OGRLinearRing& other);
00606
00607
00608 virtual const char *getGeometryName() const;
00609 virtual OGRGeometry *clone() const;
00610 virtual int isClockwise() const;
00611 virtual void reverseWindingOrder();
00612 virtual void closeRings();
00613 OGRBoolean isPointInRing(const OGRPoint* pt, int bTestEnvelope = TRUE) const;
00614 OGRBoolean isPointOnRingBoundary(const OGRPoint* pt, int bTestEnvelope = TRUE) const;
00615
00616
00617
00618
00619 virtual int WkbSize() const;
00620 virtual OGRErr importFromWkb( unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc );
00621 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
00622 };
00623
00624
00625
00626
00627
00640 class CPL_DLL OGRCircularString : public OGRSimpleCurve
00641 {
00642 private:
00643 void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
00644 OGRBoolean IsValidFast() const;
00645 int IsFullCircle( double& cx, double& cy, double& square_R ) const;
00646
00647 protected:
00648 virtual OGRCurveCasterToLineString GetCasterToLineString() const;
00649 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const;
00650 virtual int ContainsPoint( const OGRPoint* p ) const;
00651 virtual double get_AreaOfCurveSegments() const;
00652
00653 public:
00654 OGRCircularString();
00655 OGRCircularString(const OGRCircularString& other);
00656 virtual ~OGRCircularString();
00657
00658 OGRCircularString& operator=(const OGRCircularString& other);
00659
00660
00661 virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
00662 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
00663 virtual OGRErr importFromWkt( char ** );
00664 virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
00665
00666
00667 virtual OGRBoolean IsValid() const;
00668 virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00669 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
00670
00671
00672 virtual double get_Length() const;
00673 virtual OGRLineString* CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
00674 const char* const* papszOptions = NULL) const;
00675 virtual void Value( double, OGRPoint * ) const;
00676 virtual double get_Area() const;
00677
00678
00679 virtual OGRwkbGeometryType getGeometryType() const;
00680 virtual const char *getGeometryName() const;
00681 virtual void segmentize(double dfMaxLength);
00682 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
00683 virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
00684 const char* const* papszOptions = NULL) const;
00685 };
00686
00687
00688
00689
00690
00701 class CPL_DLL OGRCurveCollection
00702 {
00703 protected:
00704 friend class OGRCompoundCurve;
00705 friend class OGRCurvePolygon;
00706 friend class OGRPolygon;
00707
00708 int nCurveCount;
00709 OGRCurve **papoCurves;
00710
00711 public:
00712 OGRCurveCollection();
00713 OGRCurveCollection(const OGRCurveCollection& other);
00714 ~OGRCurveCollection();
00715
00716 OGRCurveCollection& operator=(const OGRCurveCollection& other);
00717
00718 void empty(OGRGeometry* poGeom);
00719 OGRBoolean IsEmpty() const;
00720 void getEnvelope( OGREnvelope * psEnvelope ) const;
00721 void getEnvelope( OGREnvelope3D * psEnvelope ) const;
00722
00723 OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
00724 int bNeedRealloc );
00725 int WkbSize() const;
00726 OGRErr importPreambuleFromWkb( OGRGeometry* poGeom,
00727 unsigned char * pabyData,
00728 int& nSize,
00729 int& nDataOffset,
00730 OGRwkbByteOrder& eByteOrder,
00731 int nMinSubGeomSize,
00732 OGRwkbVariant eWkVariant );
00733 OGRErr importBodyFromWkb( OGRGeometry* poGeom,
00734 unsigned char * pabyData,
00735 int nSize,
00736 int nDataOffset,
00737 int bAcceptCompoundCurve,
00738 OGRErr (*pfnAddCurveDirectlyFromWkb)(OGRGeometry* poGeom, OGRCurve* poCurve),
00739 OGRwkbVariant eWkVariant );
00740 OGRErr exportToWkt( const OGRGeometry* poGeom, char ** ppszDstText ) const;
00741 OGRErr exportToWkb( const OGRGeometry* poGeom, OGRwkbByteOrder,
00742 unsigned char *, OGRwkbVariant eWkbVariant ) const;
00743 OGRBoolean Equals(OGRCurveCollection *poOCC) const;
00744 void setCoordinateDimension( OGRGeometry* poGeom, int nNewDimension );
00745 void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
00746 void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
00747 int getNumCurves() const;
00748 OGRCurve *getCurve( int );
00749 const OGRCurve *getCurve( int ) const;
00750 OGRCurve *stealCurve( int );
00751 OGRErr transform( OGRGeometry* poGeom,
00752 OGRCoordinateTransformation *poCT );
00753 void flattenTo2D(OGRGeometry* poGeom);
00754 void segmentize(double dfMaxLength);
00755 void swapXY();
00756 OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
00757 };
00758
00759
00760
00761
00762
00773 class CPL_DLL OGRCompoundCurve : public OGRCurve
00774 {
00775 private:
00776 OGRCurveCollection oCC;
00777
00778 OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
00779 double dfToleranceEps,
00780 int bNeedRealloc );
00781 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf, OGRCurve* poCurve );
00782 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf, OGRCurve* poCurve );
00783 OGRLineString* CurveToLineInternal(double dfMaxAngleStepSizeDegrees,
00784 const char* const* papszOptions,
00785 int bIsLinearRing) const;
00786
00787 protected:
00788 static OGRLineString* CastToLineString(OGRCompoundCurve* poCC);
00789 static OGRLinearRing* CastToLinearRing(OGRCompoundCurve* poCC);
00790
00791 virtual OGRCurveCasterToLineString GetCasterToLineString() const;
00792 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const;
00793
00794 public:
00795 OGRCompoundCurve();
00796 OGRCompoundCurve(const OGRCompoundCurve& other);
00797 virtual ~OGRCompoundCurve();
00798
00799 OGRCompoundCurve& operator=(const OGRCompoundCurve& other);
00800
00801
00802 virtual int WkbSize() const;
00803 virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
00804 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
00805 virtual OGRErr importFromWkt( char ** );
00806 virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
00807
00808
00809 virtual OGRGeometry *clone() const;
00810 virtual void empty();
00811 virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00812 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
00813 virtual OGRBoolean IsEmpty() const;
00814
00815
00816 virtual double get_Length() const;
00817 virtual void StartPoint(OGRPoint *) const;
00818 virtual void EndPoint(OGRPoint *) const;
00819 virtual void Value( double, OGRPoint * ) const;
00820 virtual OGRLineString* CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
00821 const char* const* papszOptions = NULL) const;
00822
00823 virtual int getNumPoints() const;
00824 virtual double get_AreaOfCurveSegments() const;
00825 virtual double get_Area() const;
00826
00827
00828 virtual OGRBoolean Equals( OGRGeometry * ) const;
00829
00830
00831 int getNumCurves() const;
00832 OGRCurve *getCurve( int );
00833 const OGRCurve *getCurve( int ) const;
00834
00835
00836 virtual void setCoordinateDimension( int nDimension );
00837 virtual void set3D( OGRBoolean bIs3D );
00838 virtual void setMeasured( OGRBoolean bIsMeasured );
00839
00840 OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
00841 OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
00842 OGRCurve *stealCurve( int );
00843 virtual OGRPointIterator* getPointIterator() const;
00844
00845
00846 virtual OGRwkbGeometryType getGeometryType() const;
00847 virtual const char *getGeometryName() const;
00848 virtual OGRErr transform( OGRCoordinateTransformation *poCT );
00849 virtual void flattenTo2D();
00850 virtual void segmentize(double dfMaxLength);
00851 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
00852 virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
00853 const char* const* papszOptions = NULL) const;
00854
00855 virtual void swapXY();
00856 };
00857
00858
00859
00860
00861
00866 class CPL_DLL OGRSurface : public OGRGeometry
00867 {
00868 protected:
00869
00870 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
00871 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
00872
00873 public:
00874 virtual double get_Area() const = 0;
00875 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const = 0;
00876
00877 static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
00878 static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
00879 };
00880
00881
00882
00883
00884
00885
00899 class CPL_DLL OGRCurvePolygon : public OGRSurface
00900 {
00901 private:
00902 OGRBoolean ContainsPoint( const OGRPoint* p ) const;
00903 virtual int checkRing( OGRCurve * poNewRing ) const;
00904 OGRErr addRingDirectlyInternal( OGRCurve* poCurve, int bNeedRealloc );
00905 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf, OGRCurve* poCurve );
00906 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf, OGRCurve* poCurve );
00907
00908 protected:
00909 friend class OGRPolygon;
00910 OGRCurveCollection oCC;
00911
00912 static OGRPolygon* CastToPolygon(OGRCurvePolygon* poCP);
00913
00914 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const;
00915 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const;
00916
00917 public:
00918 OGRCurvePolygon();
00919 OGRCurvePolygon(const OGRCurvePolygon&);
00920 virtual ~OGRCurvePolygon();
00921
00922 OGRCurvePolygon& operator=(const OGRCurvePolygon& other);
00923
00924
00925 virtual const char *getGeometryName() const;
00926 virtual OGRwkbGeometryType getGeometryType() const;
00927 virtual OGRGeometry *clone() const;
00928 virtual void empty();
00929 virtual OGRErr transform( OGRCoordinateTransformation *poCT );
00930 virtual void flattenTo2D();
00931 virtual OGRBoolean IsEmpty() const;
00932 virtual void segmentize(double dfMaxLength);
00933 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
00934 virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
00935 const char* const* papszOptions = NULL) const;
00936
00937
00938 virtual double get_Area() const;
00939 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
00940
00941
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 eWkbVariant = wkbVariantOldOgc ) const;
00947
00948
00949 virtual int getDimension() const;
00950 virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
00951 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
00952
00953
00954 virtual OGRPolygon* CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
00955 const char* const* papszOptions = NULL) const;
00956
00957
00958 virtual OGRBoolean Equals( OGRGeometry * ) const;
00959 virtual OGRBoolean Intersects( const OGRGeometry * ) const;
00960 virtual OGRBoolean Contains( const OGRGeometry * ) const;
00961
00962
00963 virtual void setCoordinateDimension( int nDimension );
00964 virtual void set3D( OGRBoolean bIs3D );
00965 virtual void setMeasured( OGRBoolean bIsMeasured );
00966
00967 OGRErr addRing( OGRCurve * );
00968 OGRErr addRingDirectly( OGRCurve * );
00969
00970 OGRCurve *getExteriorRingCurve();
00971 const OGRCurve *getExteriorRingCurve() const;
00972 int getNumInteriorRings() const;
00973 OGRCurve *getInteriorRingCurve( int );
00974 const OGRCurve *getInteriorRingCurve( int ) const;
00975
00976 OGRCurve *stealExteriorRingCurve();
00977
00978 virtual void swapXY();
00979 };
00980
00981
00982
00983
00984
00994 class CPL_DLL OGRPolygon : public OGRCurvePolygon
00995 {
00996 protected:
00997 friend class OGRMultiSurface;
00998
00999 virtual int checkRing( OGRCurve * poNewRing ) const;
01000 OGRErr importFromWKTListOnly( char ** ppszInput, int bHasZ, int bHasM,
01001 OGRRawPoint*& paoPoints, int& nMaxPoints,
01002 double*& padfZ );
01003
01004 static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
01005
01006 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const;
01007 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const;
01008
01009 public:
01010 OGRPolygon();
01011 OGRPolygon(const OGRPolygon& other);
01012 virtual ~OGRPolygon();
01013
01014 OGRPolygon& operator=(const OGRPolygon& other);
01015
01016
01017 virtual const char *getGeometryName() const;
01018 virtual OGRwkbGeometryType getGeometryType() const;
01019 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
01020 virtual OGRGeometry* getCurveGeometry(const char* const* papszOptions = NULL) const;
01021 virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
01022 const char* const* papszOptions = NULL) const;
01023
01024
01025 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
01026
01027
01028 virtual int WkbSize() const;
01029 virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
01030 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
01031 virtual OGRErr importFromWkt( char ** );
01032 virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
01033
01034
01035 virtual OGRPolygon* CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
01036 const char* const* papszOptions = NULL) const;
01037
01038 OGRLinearRing *getExteriorRing();
01039 const OGRLinearRing *getExteriorRing() const;
01040 OGRLinearRing *getInteriorRing( int );
01041 const OGRLinearRing *getInteriorRing( int ) const;
01042
01043 OGRLinearRing *stealExteriorRing();
01044 OGRLinearRing *stealInteriorRing(int);
01045
01046 OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
01047
01048 virtual void closeRings();
01049 };
01050
01051
01052
01053
01054
01062 class CPL_DLL OGRGeometryCollection : public OGRGeometry
01063 {
01064 OGRErr importFromWkbInternal( unsigned char * pabyData, int nSize, int nRecLevel,
01065 OGRwkbVariant );
01066 OGRErr importFromWktInternal( char **ppszInput, int nRecLevel );
01067
01068 protected:
01069 int nGeomCount;
01070 OGRGeometry **papoGeoms;
01071
01072 OGRErr exportToWktInternal( char ** ppszDstText,
01073 OGRwkbVariant eWkbVariant,
01074 const char* pszSkipPrefix ) const;
01075 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
01076
01077 static OGRGeometryCollection* TransferMembersAndDestroy(OGRGeometryCollection* poSrc,
01078 OGRGeometryCollection* poDst);
01079
01080 public:
01081 OGRGeometryCollection();
01082 OGRGeometryCollection(const OGRGeometryCollection& other);
01083 virtual ~OGRGeometryCollection();
01084
01085 OGRGeometryCollection& operator=(const OGRGeometryCollection& other);
01086
01087
01088 virtual const char *getGeometryName() const;
01089 virtual OGRwkbGeometryType getGeometryType() const;
01090 virtual OGRGeometry *clone() const;
01091 virtual void empty();
01092 virtual OGRErr transform( OGRCoordinateTransformation *poCT );
01093 virtual void flattenTo2D();
01094 virtual OGRBoolean IsEmpty() const;
01095 virtual void segmentize(double dfMaxLength);
01096 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
01097 virtual OGRGeometry* getCurveGeometry(const char* const* papszOptions = NULL) const;
01098 virtual OGRGeometry* getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0, const char* const* papszOptions = NULL) const;
01099
01100
01101 virtual int WkbSize() const;
01102 virtual OGRErr importFromWkb( unsigned char *, int = -1, OGRwkbVariant=wkbVariantOldOgc );
01103 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc ) const;
01104 virtual OGRErr importFromWkt( char ** );
01105 virtual OGRErr exportToWkt( char ** ppszDstText, OGRwkbVariant=wkbVariantOldOgc ) const;
01106
01107 virtual double get_Length() const;
01108 virtual double get_Area() const;
01109
01110
01111 virtual int getDimension() const;
01112 virtual void getEnvelope( OGREnvelope * psEnvelope ) const;
01113 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const;
01114
01115
01116 int getNumGeometries() const;
01117 OGRGeometry *getGeometryRef( int );
01118 const OGRGeometry *getGeometryRef( int ) const;
01119
01120
01121 virtual OGRBoolean Equals( OGRGeometry * ) const;
01122
01123
01124 virtual void setCoordinateDimension( int nDimension );
01125 virtual void set3D( OGRBoolean bIs3D );
01126 virtual void setMeasured( OGRBoolean bIsMeasured );
01127 virtual OGRErr addGeometry( const OGRGeometry * );
01128 virtual OGRErr addGeometryDirectly( OGRGeometry * );
01129 virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
01130
01131 void closeRings();
01132
01133 virtual void swapXY();
01134 };
01135
01136
01137
01138
01139
01146 class CPL_DLL OGRMultiSurface : public OGRGeometryCollection
01147 {
01148 protected:
01149 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
01150
01151 public:
01152 OGRMultiSurface();
01153 OGRMultiSurface(const OGRMultiSurface& other);
01154 virtual ~OGRMultiSurface();
01155
01156 OGRMultiSurface& operator=(const OGRMultiSurface& other);
01157
01158
01159 virtual const char *getGeometryName() const;
01160 virtual OGRwkbGeometryType getGeometryType() const;
01161 virtual OGRErr importFromWkt( char ** );
01162 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc ) const;
01163
01164
01165 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
01166
01167
01168 virtual int getDimension() const;
01169
01170
01171 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
01172
01173 static OGRMultiPolygon* CastToMultiPolygon(OGRMultiSurface* poMS);
01174 };
01175
01176
01177
01178
01179
01184 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
01185 {
01186 protected:
01187 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
01188
01189 public:
01190 OGRMultiPolygon();
01191 OGRMultiPolygon(const OGRMultiPolygon& other);
01192 virtual ~OGRMultiPolygon();
01193
01194 OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
01195
01196
01197 virtual const char *getGeometryName() const;
01198 virtual OGRwkbGeometryType getGeometryType() const;
01199 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc ) const;
01200
01201
01202 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
01203
01204
01205 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
01206
01207 static OGRMultiSurface* CastToMultiSurface(OGRMultiPolygon* poMP);
01208 };
01209
01210
01211
01212
01213
01218 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
01219 {
01220 private:
01221 OGRErr importFromWkt_Bracketed( char **, int bHasM, int bHasZ );
01222
01223 protected:
01224 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
01225
01226 public:
01227 OGRMultiPoint();
01228 OGRMultiPoint(const OGRMultiPoint& other);
01229 virtual ~OGRMultiPoint();
01230
01231 OGRMultiPoint& operator=(const OGRMultiPoint& other);
01232
01233
01234 virtual const char *getGeometryName() const;
01235 virtual OGRwkbGeometryType getGeometryType() const;
01236 virtual OGRErr importFromWkt( char ** );
01237 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc ) const;
01238
01239
01240 virtual int getDimension() const;
01241
01242
01243 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
01244 };
01245
01246
01247
01248
01249
01256 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
01257 {
01258 protected:
01259 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf, OGRCurve* poCurve );
01260 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
01261
01262 public:
01263 OGRMultiCurve();
01264 OGRMultiCurve(const OGRMultiCurve& other);
01265 virtual ~OGRMultiCurve();
01266
01267 OGRMultiCurve& operator=(const OGRMultiCurve& other);
01268
01269
01270 virtual const char *getGeometryName() const;
01271 virtual OGRwkbGeometryType getGeometryType() const;
01272 virtual OGRErr importFromWkt( char ** );
01273 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc ) const;
01274
01275
01276 virtual int getDimension() const;
01277
01278
01279 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
01280
01281 static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
01282 };
01283
01284
01285
01286
01287
01292 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
01293 {
01294 protected:
01295 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
01296
01297 public:
01298 OGRMultiLineString();
01299 OGRMultiLineString(const OGRMultiLineString& other);
01300 virtual ~OGRMultiLineString();
01301
01302 OGRMultiLineString& operator=(const OGRMultiLineString& other);
01303
01304
01305 virtual const char *getGeometryName() const;
01306 virtual OGRwkbGeometryType getGeometryType() const;
01307 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc ) const;
01308
01309
01310 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
01311
01312 static OGRMultiCurve* CastToMultiCurve(OGRMultiLineString* poMLS);
01313 };
01314
01315
01316
01317
01318
01319
01324 class CPL_DLL OGRGeometryFactory
01325 {
01326 static OGRErr createFromFgfInternal( unsigned char *pabyData,
01327 OGRSpatialReference * poSR,
01328 OGRGeometry **ppoReturn,
01329 int nBytes,
01330 int *pnBytesConsumed,
01331 int nRecLevel );
01332 public:
01333 static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
01334 OGRGeometry **, int = -1, OGRwkbVariant=wkbVariantOldOgc );
01335 static OGRErr createFromWkt( char **, OGRSpatialReference *,
01336 OGRGeometry ** );
01337 static OGRErr createFromFgf( unsigned char *, OGRSpatialReference *,
01338 OGRGeometry **, int = -1, int * = NULL );
01339 static OGRGeometry *createFromGML( const char * );
01340 static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt, GEOSGeom );
01341
01342 static void destroyGeometry( OGRGeometry * );
01343 static OGRGeometry *createGeometry( OGRwkbGeometryType );
01344
01345 static OGRGeometry * forceToPolygon( OGRGeometry * );
01346 static OGRGeometry * forceToLineString( OGRGeometry *, bool bOnlyInOrder = true );
01347 static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
01348 static OGRGeometry * forceToMultiPoint( OGRGeometry * );
01349 static OGRGeometry * forceToMultiLineString( OGRGeometry * );
01350
01351 static OGRGeometry * forceTo( OGRGeometry* poGeom,
01352 OGRwkbGeometryType eTargetType,
01353 const char*const* papszOptions = NULL );
01354
01355 static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
01356 int nPolygonCount,
01357 int *pbResultValidGeometry,
01358 const char **papszOptions = NULL);
01359 static int haveGEOS();
01360
01361 static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
01362 OGRCoordinateTransformation *poCT,
01363 char** papszOptions );
01364
01365 static OGRGeometry*
01366 approximateArcAngles( double dfX, double dfY, double dfZ,
01367 double dfPrimaryRadius, double dfSecondaryAxis,
01368 double dfRotation,
01369 double dfStartAngle, double dfEndAngle,
01370 double dfMaxAngleStepSizeDegrees );
01371
01372 static int GetCurveParmeters(double x0, double y0,
01373 double x1, double y1,
01374 double x2, double y2,
01375 double& R, double& cx, double& cy,
01376 double& alpha0, double& alpha1, double& alpha2 );
01377 static OGRLineString* curveToLineString( double x0, double y0, double z0,
01378 double x1, double y1, double z1,
01379 double x2, double y2, double z2,
01380 int bHasZ,
01381 double dfMaxAngleStepSizeDegrees,
01382 const char*const* papszOptions = NULL );
01383 static OGRCurve* curveFromLineString(const OGRLineString* poLS,
01384 const char*const* papszOptions = NULL);
01385 };
01386
01387 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
01388 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
01389
01390
01391 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
01392 int OGRHasPreparedGeometrySupport();
01393 OGRPreparedGeometry* OGRCreatePreparedGeometry( const OGRGeometry* poGeom );
01394 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
01395 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
01396 const OGRGeometry* poOtherGeom );
01397 int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
01398 const OGRGeometry* poOtherGeom );
01399
01400 #endif