OGR
ogr_geometry.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: ogr_geometry.h 40454 2017-10-16 19:14:13Z rouault $
3  *
4  * Project: OpenGIS Simple Features Reference Implementation
5  * Purpose: Classes for manipulating simple features that is not specific
6  * to a particular interface technology.
7  * Author: Frank Warmerdam, warmerdam@pobox.com
8  *
9  ******************************************************************************
10  * Copyright (c) 1999, Frank Warmerdam
11  * Copyright (c) 2008-2014, Even Rouault <even dot rouault at mines-paris dot org>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  ****************************************************************************/
31 
32 #ifndef OGR_GEOMETRY_H_INCLUDED
33 #define OGR_GEOMETRY_H_INCLUDED
34 
35 #include "ogr_core.h"
36 #include "ogr_spatialref.h"
37 
48 {
49  public:
51  OGRRawPoint() : x(0.0), y(0.0) {}
52 
54  OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn) {}
55 
57  double x;
59  double y;
60 };
61 
63 typedef struct GEOSGeom_t *GEOSGeom;
65 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
67 typedef void sfcgal_geometry_t;
68 
69 class OGRPoint;
70 class OGRCurve;
71 class OGRCompoundCurve;
72 class OGRLinearRing;
73 class OGRLineString;
74 class OGRSurface;
75 class OGRCurvePolygon;
76 class OGRPolygon;
77 class OGRMultiSurface;
78 class OGRMultiPolygon;
79 class OGRMultiCurve;
80 class OGRMultiLineString;
81 class OGRTriangle;
84 
86 typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
87 typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
88 
89 typedef OGRPolygon* (*OGRSurfaceCasterToPolygon)(OGRSurface*);
90 typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
91 typedef OGRMultiPolygon* (*OGRPolyhedralSurfaceCastToMultiPolygon)(OGRPolyhedralSurface*);
93 
94 /************************************************************************/
95 /* OGRGeometry */
96 /************************************************************************/
97 
118 class CPL_DLL OGRGeometry
119 {
120  private:
121  OGRSpatialReference * poSRS; // may be NULL
122 
123  protected:
125  friend class OGRCurveCollection;
126 
127  unsigned int flags;
128 
129  OGRErr importPreambuleFromWkt( char ** ppszInput,
130  int* pbHasZ, int* pbHasM,
131  bool* pbIsEmpty );
132  OGRErr importCurveCollectionFromWkt(
133  char ** ppszInput,
134  int bAllowEmptyComponent,
135  int bAllowLineString,
136  int bAllowCurve,
137  int bAllowCompoundCurve,
138  OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf,
139  OGRCurve* poCurve) );
140  OGRErr importPreambuleFromWkb( unsigned char * pabyData,
141  int nSize,
142  OGRwkbByteOrder& eByteOrder,
143  OGRwkbVariant eWkbVariant );
144  OGRErr importPreambuleOfCollectionFromWkb(
145  unsigned char * pabyData,
146  int& nSize,
147  int& nDataOffset,
148  OGRwkbByteOrder& eByteOrder,
149  int nMinSubGeomSize,
150  int& nGeomCount,
151  OGRwkbVariant eWkbVariant );
152  OGRErr PointOnSurfaceInternal( OGRPoint * poPoint ) const;
153  OGRBoolean IsSFCGALCompatible() const;
155 
156  public:
157 
158 /************************************************************************/
159 /* Bit flags for OGRGeometry */
160 /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
161 /* Do not use these outside of the core. */
162 /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
163 /************************************************************************/
164 
166  static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
167  static const unsigned int OGR_G_3D = 0x2;
168  static const unsigned int OGR_G_MEASURED = 0x4;
170 
171  OGRGeometry();
172  OGRGeometry( const OGRGeometry& other );
173  virtual ~OGRGeometry();
174 
175  OGRGeometry& operator=( const OGRGeometry& other );
176 
177  // Standard IGeometry.
178  virtual int getDimension() const = 0;
179  virtual int getCoordinateDimension() const;
180  int CoordinateDimension() const;
181  virtual OGRBoolean IsEmpty() const = 0;
182  virtual OGRBoolean IsValid() const;
183  virtual OGRBoolean IsSimple() const;
185  OGRBoolean Is3D() const { return flags & OGR_G_3D; }
187  OGRBoolean IsMeasured() const { return flags & OGR_G_MEASURED; }
188  virtual OGRBoolean IsRing() const;
189  virtual void empty() = 0;
190  virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
191  virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
192  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
193 
194  // IWks Interface.
195  virtual int WkbSize() const = 0;
196  virtual OGRErr importFromWkb( unsigned char *, int=-1,
198  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
199  OGRwkbVariant=wkbVariantOldOgc ) const = 0;
200  virtual OGRErr importFromWkt( char ** ppszInput ) = 0;
201  virtual OGRErr exportToWkt( char ** ppszDstText,
202  OGRwkbVariant=wkbVariantOldOgc ) const = 0;
203 
204  // Non-standard.
205  virtual OGRwkbGeometryType getGeometryType() const = 0;
206  OGRwkbGeometryType getIsoGeometryType() const;
207  virtual const char *getGeometryName() const = 0;
208  virtual void dumpReadable( FILE *, const char * = NULL
209  , char** papszOptions = NULL ) const;
210  virtual void flattenTo2D() = 0;
211  virtual char * exportToGML( const char* const * papszOptions = NULL ) const;
212  virtual char * exportToKML() const;
213  virtual char * exportToJson() const;
214 
215  static GEOSContextHandle_t createGEOSContext();
216  static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
217  virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
219  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
220  virtual OGRGeometry* getCurveGeometry(
221  const char* const* papszOptions = NULL ) const CPL_WARN_UNUSED_RESULT;
222  virtual OGRGeometry* getLinearGeometry(
223  double dfMaxAngleStepSizeDegrees = 0,
224  const char* const* papszOptions = NULL ) const CPL_WARN_UNUSED_RESULT;
225 
226  // SFCGAL interfacing methods.
228  static sfcgal_geometry_t* OGRexportToSFCGAL( OGRGeometry *poGeom );
229  static OGRGeometry* SFCGALexportToOGR( sfcgal_geometry_t* _geometry );
231  virtual void closeRings();
232 
233  virtual void setCoordinateDimension( int nDimension );
234  virtual void set3D( OGRBoolean bIs3D );
235  virtual void setMeasured( OGRBoolean bIsMeasured );
236 
237  void assignSpatialReference( OGRSpatialReference * poSR );
238  OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
239 
240  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) = 0;
241  OGRErr transformTo( OGRSpatialReference *poSR );
242 
243  virtual void segmentize(double dfMaxLength);
244 
245  // ISpatialRelation
246  virtual OGRBoolean Intersects( const OGRGeometry * ) const;
247  virtual OGRBoolean Equals( OGRGeometry * ) const = 0;
248  virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
249  virtual OGRBoolean Touches( const OGRGeometry * ) const;
250  virtual OGRBoolean Crosses( const OGRGeometry * ) const;
251  virtual OGRBoolean Within( const OGRGeometry * ) const;
252  virtual OGRBoolean Contains( const OGRGeometry * ) const;
253  virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
254 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
255 // virtual OGRGeometry *LocateAlong( double mValue ) const;
256 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
257 
258  virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
259  virtual double Distance( const OGRGeometry * ) const ;
260  virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
261  virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
263  virtual OGRGeometry *Intersection( const OGRGeometry *)
265  virtual OGRGeometry *Union( const OGRGeometry * )
267  virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
268  virtual OGRGeometry *Difference( const OGRGeometry * )
270  virtual OGRGeometry *SymDifference( const OGRGeometry * )
272  virtual OGRErr Centroid( OGRPoint * poPoint ) const;
273  virtual OGRGeometry *Simplify(double dTolerance)
275  OGRGeometry *SimplifyPreserveTopology(double dTolerance)
277  virtual OGRGeometry *DelaunayTriangulation(
278  double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
279 
280  virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
281 
282  virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
283 
285  // backward compatibility to non-standard method names.
286  OGRBoolean Intersect( OGRGeometry * )
287  const CPL_WARN_DEPRECATED("Non standard method. "
288  "Use Intersects() instead");
289  OGRBoolean Equal( OGRGeometry * )
290  const CPL_WARN_DEPRECATED("Non standard method. "
291  "Use Equals() instead");
292  OGRGeometry *SymmetricDifference( const OGRGeometry * )
293  const CPL_WARN_DEPRECATED("Non standard method. "
294  "Use SymDifference() instead");
295  OGRGeometry *getBoundary()
296  const CPL_WARN_DEPRECATED("Non standard method. "
297  "Use Boundary() instead");
299 
301  // Special HACK for DB2 7.2 support
302  static int bGenerate_DB2_V72_BYTE_ORDER;
304 
305  virtual void swapXY();
307  static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
308  static OGRGeometry* CastToError( OGRGeometry* poGeom );
310 };
311 
312 /************************************************************************/
313 /* OGRPoint */
314 /************************************************************************/
315 
322 class CPL_DLL OGRPoint : public OGRGeometry
323 {
324  double x;
325  double y;
326  double z;
327  double m;
328 
329  public:
330  OGRPoint();
331  OGRPoint( double x, double y );
332  OGRPoint( double x, double y, double z );
333  OGRPoint( double x, double y, double z, double m );
334  OGRPoint( const OGRPoint& other );
335  virtual ~OGRPoint();
336 
337  OGRPoint& operator=( const OGRPoint& other );
338 
339  // IWks Interface
340  virtual int WkbSize() const CPL_OVERRIDE;
341  virtual OGRErr importFromWkb( unsigned char *, int=-1,
343  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
345  const CPL_OVERRIDE;
346  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
347  virtual OGRErr exportToWkt( char ** ppszDstText,
349  const CPL_OVERRIDE;
350 
351  // IGeometry
352  virtual int getDimension() const CPL_OVERRIDE;
353  virtual OGRGeometry *clone() const CPL_OVERRIDE;
354  virtual void empty() CPL_OVERRIDE;
355  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
356  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
358  { return !(flags & OGR_G_NOT_EMPTY_POINT); }
359 
360  // IPoint
362  double getX() const { return x; }
364  double getY() const { return y; }
366  double getZ() const { return z; }
368  double getM() const { return m; }
369 
370  // Non standard
371  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
375  void setX( double xIn ) { x = xIn; flags |= OGR_G_NOT_EMPTY_POINT; }
379  void setY( double yIn ) { y = yIn; flags |= OGR_G_NOT_EMPTY_POINT; }
383  void setZ( double zIn )
384  { z = zIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_3D); }
388  void setM( double mIn )
389  { m = mIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_MEASURED); }
390 
391  // ISpatialRelation
392  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
393  virtual OGRBoolean Intersects( const OGRGeometry * ) const CPL_OVERRIDE;
394  virtual OGRBoolean Within( const OGRGeometry * ) const CPL_OVERRIDE;
395 
396  // Non standard from OGRGeometry
397  virtual const char *getGeometryName() const CPL_OVERRIDE;
398  virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
399  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
400  virtual void flattenTo2D() CPL_OVERRIDE;
401 
402  virtual void swapXY() CPL_OVERRIDE;
403 };
404 
405 /************************************************************************/
406 /* OGRPointIterator */
407 /************************************************************************/
408 
415 class CPL_DLL OGRPointIterator
416 {
417  public:
418  virtual ~OGRPointIterator();
419  virtual OGRBoolean getNextPoint( OGRPoint* p ) = 0;
420 
421  static void destroy( OGRPointIterator* );
422 };
423 
424 /************************************************************************/
425 /* OGRCurve */
426 /************************************************************************/
427 
433 class CPL_DLL OGRCurve : public OGRGeometry
434 {
435  protected:
437  OGRCurve();
438  OGRCurve( const OGRCurve& other );
439 
440  virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
441  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
442 
443  friend class OGRCurvePolygon;
444  friend class OGRCompoundCurve;
446  virtual int ContainsPoint( const OGRPoint* p ) const;
447  virtual double get_AreaOfCurveSegments() const = 0;
448 
449  public:
450  virtual ~OGRCurve();
451 
453  OGRCurve& operator=( const OGRCurve& other );
455 
456  // ICurve methods
457  virtual double get_Length() const = 0;
458  virtual void StartPoint( OGRPoint * ) const = 0;
459  virtual void EndPoint( OGRPoint * ) const = 0;
460  virtual int get_IsClosed() const;
461  virtual void Value( double, OGRPoint * ) const = 0;
462  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
463  const char* const* papszOptions = NULL)
464  const = 0;
465  virtual int getDimension() const CPL_OVERRIDE;
466 
467  // non standard
468  virtual int getNumPoints() const = 0;
469  virtual OGRPointIterator* getPointIterator() const = 0;
470  virtual OGRBoolean IsConvex() const;
471  virtual double get_Area() const = 0;
472 
473  static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
474  static OGRLineString* CastToLineString( OGRCurve* poCurve );
475  static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
476 };
477 
478 /************************************************************************/
479 /* OGRSimpleCurve */
480 /************************************************************************/
481 
491 class CPL_DLL OGRSimpleCurve: public OGRCurve
492 {
493  protected:
495  friend class OGRGeometry;
496 
497  int nPointCount;
498  OGRRawPoint *paoPoints;
499  double *padfZ;
500  double *padfM;
501 
502  void Make3D();
503  void Make2D();
504  void RemoveM();
505  void AddM();
506 
507  OGRErr importFromWKTListOnly( char ** ppszInput, int bHasZ, int bHasM,
508  OGRRawPoint*& paoPointsIn,
509  int& nMaxPoints,
510  double*& padfZIn );
511 
513 
514  virtual double get_LinearArea() const;
515 
516  OGRSimpleCurve();
517  OGRSimpleCurve( const OGRSimpleCurve& other );
518 
519  public:
520  virtual ~OGRSimpleCurve();
521 
522  OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
523 
524  // IWks Interface.
525  virtual int WkbSize() const CPL_OVERRIDE;
526  virtual OGRErr importFromWkb( unsigned char *, int = -1,
528  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
530  const CPL_OVERRIDE;
531  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
532  virtual OGRErr exportToWkt( char ** ppszDstText,
534  const CPL_OVERRIDE;
535 
536  // IGeometry interface.
537  virtual OGRGeometry *clone() const CPL_OVERRIDE;
538  virtual void empty() CPL_OVERRIDE;
539  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
540  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
541  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
542 
543  // ICurve methods.
544  virtual double get_Length() const CPL_OVERRIDE;
545  virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
546  virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
547  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
548  virtual double Project( const OGRPoint * ) const;
549  virtual OGRLineString* getSubLine( double, double, int ) const;
550 
551  // ILineString methods.
552  virtual int getNumPoints() const CPL_OVERRIDE { return nPointCount; }
553  void getPoint( int, OGRPoint * ) const;
554  double getX( int i ) const { return paoPoints[i].x; }
555  double getY( int i ) const { return paoPoints[i].y; }
556  double getZ( int i ) const;
557  double getM( int i ) const;
558 
559  // ISpatialRelation
560  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
561 
562  // non standard.
563  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
564  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
565  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
566  void setNumPoints( int nNewPointCount,
567  int bZeroizeNewContent = TRUE );
568  void setPoint( int, OGRPoint * );
569  void setPoint( int, double, double );
570  void setZ( int, double );
571  void setM( int, double );
572  void setPoint( int, double, double, double );
573  void setPointM( int, double, double, double );
574  void setPoint( int, double, double, double, double );
575  void setPoints( int, OGRRawPoint *, double * = NULL );
576  void setPointsM( int, OGRRawPoint *, double * );
577  void setPoints( int, OGRRawPoint *, double *, double * );
578  void setPoints( int, double * padfX, double * padfY,
579  double *padfZIn = NULL );
580  void setPointsM( int, double * padfX, double * padfY,
581  double *padfMIn = NULL );
582  void setPoints( int, double * padfX, double * padfY,
583  double *padfZIn, double *padfMIn );
584  void addPoint( const OGRPoint * );
585  void addPoint( double, double );
586  void addPoint( double, double, double );
587  void addPointM( double, double, double );
588  void addPoint( double, double, double, double );
589 
590  void getPoints( OGRRawPoint *, double * = NULL ) const;
591  void getPoints( void* pabyX, int nXStride,
592  void* pabyY, int nYStride,
593  void* pabyZ = NULL, int nZStride = 0 ) const;
594  void getPoints( void* pabyX, int nXStride,
595  void* pabyY, int nYStride,
596  void* pabyZ, int nZStride,
597  void* pabyM, int nMStride ) const;
598 
599  void addSubLineString( const OGRLineString *,
600  int nStartVertex = 0, int nEndVertex = -1 );
601  void reversePoints( void );
603 
604  // non-standard from OGRGeometry
606  virtual void flattenTo2D() CPL_OVERRIDE;
607  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
608 
609  virtual void swapXY() CPL_OVERRIDE;
610 };
611 
612 /************************************************************************/
613 /* OGRLineString */
614 /************************************************************************/
615 
623 class CPL_DLL OGRLineString : public OGRSimpleCurve
624 {
625  protected:
627  static OGRLineString* TransferMembersAndDestroy(
628  OGRLineString* poSrc,
629  OGRLineString* poDst);
630 
631  virtual OGRCurveCasterToLineString GetCasterToLineString()
632  const CPL_OVERRIDE;
633  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
634  const CPL_OVERRIDE;
635 
636  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
638 
640 
641  public:
642  OGRLineString();
643  OGRLineString( const OGRLineString& other );
644  virtual ~OGRLineString();
645 
646  OGRLineString& operator=(const OGRLineString& other);
647 
648  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
649  const char* const* papszOptions = NULL )
650  const CPL_OVERRIDE;
651  virtual OGRGeometry* getCurveGeometry(
652  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
653  virtual double get_Area() const CPL_OVERRIDE;
654 
655  // Non-standard from OGRGeometry.
657  virtual const char *getGeometryName() const CPL_OVERRIDE;
658 };
659 
660 /************************************************************************/
661 /* OGRLinearRing */
662 /************************************************************************/
663 
684 class CPL_DLL OGRLinearRing : public OGRLineString
685 {
686  protected:
688  friend class OGRPolygon;
689  friend class OGRTriangle;
690 
691  // These are not IWks compatible ... just a convenience for OGRPolygon.
692  virtual int _WkbSize( int _flags ) const;
693  virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
694  unsigned char *, int=-1 );
695  virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
696  unsigned char * ) const;
697 
698  virtual OGRCurveCasterToLineString GetCasterToLineString()
699  const CPL_OVERRIDE;
700  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
701  const CPL_OVERRIDE;
703 
705 
706  public:
707  OGRLinearRing();
708  OGRLinearRing( const OGRLinearRing& other );
709  explicit OGRLinearRing( OGRLinearRing * );
710  virtual ~OGRLinearRing();
711 
712  OGRLinearRing& operator=( const OGRLinearRing& other );
713 
714  // Non standard.
715  virtual const char *getGeometryName() const CPL_OVERRIDE;
716  virtual OGRGeometry *clone() const CPL_OVERRIDE;
717  virtual int isClockwise() const;
718  virtual void reverseWindingOrder();
719  virtual void closeRings() CPL_OVERRIDE;
720  OGRBoolean isPointInRing( const OGRPoint* pt,
721  int bTestEnvelope = TRUE ) const;
722  OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
723  int bTestEnvelope = TRUE ) const;
725 
726  // IWks Interface - Note this isn't really a first class object
727  // for the purposes of WKB form. These methods always fail since this
728  // object can't be serialized on its own.
729  virtual int WkbSize() const CPL_OVERRIDE;
730  virtual OGRErr importFromWkb( unsigned char *, int=-1,
732  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
734  const CPL_OVERRIDE;
735 };
736 
737 /************************************************************************/
738 /* OGRCircularString */
739 /************************************************************************/
740 
753 class CPL_DLL OGRCircularString : public OGRSimpleCurve
754 {
755  private:
756  void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
757  OGRBoolean IsValidFast() const;
758  int IsFullCircle( double& cx, double& cy, double& square_R ) const;
759 
760  protected:
762  virtual OGRCurveCasterToLineString GetCasterToLineString()
763  const CPL_OVERRIDE;
764  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
765  const CPL_OVERRIDE;
766  virtual int ContainsPoint( const OGRPoint* p ) const CPL_OVERRIDE;
767  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
768 
769  friend class OGRCurvePolygon;
770  int IntersectsPoint( const OGRPoint* p ) const;
772 
773  public:
775  OGRCircularString(const OGRCircularString& other);
776  virtual ~OGRCircularString();
777 
779 
780  // IWks Interface.
781  virtual OGRErr importFromWkb( unsigned char *, int = -1,
783  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
785  const CPL_OVERRIDE;
786  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
787  virtual OGRErr exportToWkt( char ** ppszDstText,
789  const CPL_OVERRIDE;
790 
791  // IGeometry interface.
792  virtual OGRBoolean IsValid() const CPL_OVERRIDE;
793  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
794  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
795 
796  // ICurve methods.
797  virtual double get_Length() const CPL_OVERRIDE;
798  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
799  const char* const* papszOptions = NULL )
800  const CPL_OVERRIDE;
801  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
802  virtual double get_Area() const CPL_OVERRIDE;
803 
804  // Non-standard from OGRGeometry.
806  virtual const char *getGeometryName() const CPL_OVERRIDE;
807  virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
808  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
809  const CPL_OVERRIDE;
811  double dfMaxAngleStepSizeDegrees = 0,
812  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
813 };
814 
815 /************************************************************************/
816 /* OGRCurveCollection */
817 /************************************************************************/
818 
829 class CPL_DLL OGRCurveCollection
831 {
832  protected:
833  friend class OGRCompoundCurve;
834  friend class OGRCurvePolygon;
835  friend class OGRPolygon;
836  friend class OGRTriangle;
837 
838  int nCurveCount;
839  OGRCurve **papoCurves;
840 
841  public:
842  OGRCurveCollection();
843  OGRCurveCollection(const OGRCurveCollection& other);
844  ~OGRCurveCollection();
845 
846  OGRCurveCollection& operator=(const OGRCurveCollection& other);
847 
848  void empty(OGRGeometry* poGeom);
849  OGRBoolean IsEmpty() const;
850  void getEnvelope( OGREnvelope * psEnvelope ) const;
851  void getEnvelope( OGREnvelope3D * psEnvelope ) const;
852 
853  OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
854  int bNeedRealloc );
855  int WkbSize() const;
856  OGRErr importPreambuleFromWkb( OGRGeometry* poGeom,
857  unsigned char * pabyData,
858  int& nSize,
859  int& nDataOffset,
860  OGRwkbByteOrder& eByteOrder,
861  int nMinSubGeomSize,
862  OGRwkbVariant eWkVariant );
863  OGRErr importBodyFromWkb(
864  OGRGeometry* poGeom,
865  unsigned char * pabyData,
866  int nSize,
867  int nDataOffset,
868  int bAcceptCompoundCurve,
869  OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
870  OGRCurve* poCurve ),
871  OGRwkbVariant eWkVariant );
872  OGRErr exportToWkt( const OGRGeometry* poGeom,
873  char ** ppszDstText ) const;
875  unsigned char *,
876  OGRwkbVariant eWkbVariant ) const;
877  OGRBoolean Equals(OGRCurveCollection *poOCC) const;
878  void setCoordinateDimension( OGRGeometry* poGeom,
879  int nNewDimension );
880  void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
881  void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
882  int getNumCurves() const;
883  OGRCurve *getCurve( int );
884  const OGRCurve *getCurve( int ) const;
885  OGRCurve *stealCurve( int );
886  OGRErr transform( OGRGeometry* poGeom,
888  void flattenTo2D( OGRGeometry* poGeom );
889  void segmentize( double dfMaxLength );
890  void swapXY();
891  OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
892 };
894 
895 /************************************************************************/
896 /* OGRCompoundCurve */
897 /************************************************************************/
898 
909 class CPL_DLL OGRCompoundCurve : public OGRCurve
910 {
911  private:
912  OGRCurveCollection oCC;
913 
914  OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
915  double dfToleranceEps,
916  int bNeedRealloc );
917  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
918  OGRCurve* poCurve );
919  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
920  OGRCurve* poCurve );
921  OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
922  const char* const* papszOptions,
923  int bIsLinearRing ) const;
924 
925  protected:
929 
930  virtual OGRCurveCasterToLineString GetCasterToLineString()
931  const CPL_OVERRIDE;
932  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
933  const CPL_OVERRIDE;
935 
936  public:
938  OGRCompoundCurve( const OGRCompoundCurve& other );
939  virtual ~OGRCompoundCurve();
940 
942 
943  // IWks Interface
944  virtual int WkbSize() const CPL_OVERRIDE;
945  virtual OGRErr importFromWkb( unsigned char *, int = -1,
947  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
949  const CPL_OVERRIDE;
950  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
951  virtual OGRErr exportToWkt( char ** ppszDstText,
953  const CPL_OVERRIDE;
954 
955  // IGeometry interface.
956  virtual OGRGeometry *clone() const CPL_OVERRIDE;
957  virtual void empty() CPL_OVERRIDE;
958  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
959  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
960  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
961 
962  // ICurve methods.
963  virtual double get_Length() const CPL_OVERRIDE;
964  virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
965  virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
966  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
967  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
968  const char* const* papszOptions = NULL )
969  const CPL_OVERRIDE;
970 
971  virtual int getNumPoints() const CPL_OVERRIDE;
972  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
973  virtual double get_Area() const CPL_OVERRIDE;
974 
975  // ISpatialRelation.
976  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
977 
978  // ICompoundCurve method.
979  int getNumCurves() const;
980  OGRCurve *getCurve( int );
981  const OGRCurve *getCurve( int ) const;
982 
983  // Non-standard.
984  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
985  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
986  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
987 
988  OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
989  OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
990  OGRCurve *stealCurve( int );
992 
993  // Non-standard from OGRGeometry.
995  virtual const char *getGeometryName() const CPL_OVERRIDE;
997  virtual void flattenTo2D() CPL_OVERRIDE;
998  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
999  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
1000  const CPL_OVERRIDE;
1001  virtual OGRGeometry* getLinearGeometry(
1002  double dfMaxAngleStepSizeDegrees = 0,
1003  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
1004 
1005  virtual void swapXY() CPL_OVERRIDE;
1006 };
1007 
1008 /************************************************************************/
1009 /* OGRSurface */
1010 /************************************************************************/
1011 
1017 class CPL_DLL OGRSurface : public OGRGeometry
1018 {
1019  protected:
1021  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1022  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1024 
1025  public:
1026  virtual double get_Area() const = 0;
1027  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const = 0;
1029  static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1030  static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1032 };
1033 
1034 /************************************************************************/
1035 /* OGRCurvePolygon */
1036 /************************************************************************/
1037 
1051 class CPL_DLL OGRCurvePolygon : public OGRSurface
1052 {
1053  private:
1054  OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1055  virtual int checkRing( OGRCurve * poNewRing ) const;
1056  OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1057  int bNeedRealloc );
1058  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1059  OGRCurve* poCurve );
1060  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1061  OGRCurve* poCurve );
1062 
1063  protected:
1065  friend class OGRPolygon;
1066  friend class OGRTriangle;
1067  OGRCurveCollection oCC;
1068 
1069  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1070  const CPL_OVERRIDE;
1071  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1072  const CPL_OVERRIDE;
1074 
1075  static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
1076 
1077  public:
1078  OGRCurvePolygon();
1079  OGRCurvePolygon( const OGRCurvePolygon& );
1080  virtual ~OGRCurvePolygon();
1081 
1082  OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
1083 
1084  // Non standard (OGRGeometry).
1085  virtual const char *getGeometryName() const CPL_OVERRIDE;
1087  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1088  virtual void empty() CPL_OVERRIDE;
1090  virtual void flattenTo2D() CPL_OVERRIDE;
1091  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1092  virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
1093  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1094  const CPL_OVERRIDE;
1095  virtual OGRGeometry* getLinearGeometry(
1096  double dfMaxAngleStepSizeDegrees = 0,
1097  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1098 
1099  // ISurface Interface
1100  virtual double get_Area() const CPL_OVERRIDE;
1101  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
1102 
1103  // IWks Interface
1104  virtual int WkbSize() const CPL_OVERRIDE;
1105  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1107  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1109  const CPL_OVERRIDE;
1110  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1111  virtual OGRErr exportToWkt( char ** ppszDstText,
1112  OGRwkbVariant eWkbVariant = wkbVariantOldOgc )
1113  const CPL_OVERRIDE;
1114 
1115  // IGeometry
1116  virtual int getDimension() const CPL_OVERRIDE;
1117  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1118  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1119 
1120  // ICurvePolygon
1121  virtual OGRPolygon* CurvePolyToPoly(
1122  double dfMaxAngleStepSizeDegrees = 0,
1123  const char* const* papszOptions = NULL ) const;
1124 
1125  // ISpatialRelation
1126  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
1127  virtual OGRBoolean Intersects( const OGRGeometry * ) const CPL_OVERRIDE;
1128  virtual OGRBoolean Contains( const OGRGeometry * ) const CPL_OVERRIDE;
1129 
1130  // Non standard
1131  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1132  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1133  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1134 
1135  virtual OGRErr addRing( OGRCurve * );
1136  virtual OGRErr addRingDirectly( OGRCurve * );
1137 
1139  const OGRCurve *getExteriorRingCurve() const;
1140  int getNumInteriorRings() const;
1142  const OGRCurve *getInteriorRingCurve( int ) const;
1143 
1145 
1146  virtual void swapXY() CPL_OVERRIDE;
1147 };
1148 
1149 /************************************************************************/
1150 /* OGRPolygon */
1151 /************************************************************************/
1152 
1162 class CPL_DLL OGRPolygon : public OGRCurvePolygon
1163 {
1164  protected:
1166  friend class OGRMultiSurface;
1167  friend class OGRPolyhedralSurface;
1168  friend class OGRTriangulatedSurface;
1169 
1170  virtual int checkRing( OGRCurve * poNewRing ) const CPL_OVERRIDE;
1171  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1172  int bHasZ, int bHasM,
1173  OGRRawPoint*& paoPoints,
1174  int& nMaxPoints,
1175  double*& padfZ );
1176 
1177  static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
1178 
1179  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1180  const CPL_OVERRIDE;
1181  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1182  const CPL_OVERRIDE;
1184 
1185  public:
1186  OGRPolygon();
1187  OGRPolygon(const OGRPolygon& other);
1188  virtual ~OGRPolygon();
1189 
1190  OGRPolygon& operator=(const OGRPolygon& other);
1191 
1192  // Non-standard (OGRGeometry).
1193  virtual const char *getGeometryName() const CPL_OVERRIDE;
1195  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1196  const CPL_OVERRIDE;
1197  virtual OGRGeometry* getCurveGeometry(
1198  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1199  virtual OGRGeometry* getLinearGeometry(
1200  double dfMaxAngleStepSizeDegrees = 0,
1201  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
1202 
1203  // ISurface Interface.
1204  virtual OGRErr PointOnSurface( OGRPoint * poPoint )
1205  const CPL_OVERRIDE;
1206 
1207  // IWks Interface.
1208  virtual int WkbSize() const CPL_OVERRIDE;
1209  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1211  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1213  const CPL_OVERRIDE;
1214  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1215  virtual OGRErr exportToWkt( char ** ppszDstText,
1217  const CPL_OVERRIDE;
1218 
1219  // ICurvePolygon.
1220  virtual OGRPolygon* CurvePolyToPoly(
1221  double dfMaxAngleStepSizeDegrees = 0,
1222  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1223 
1224  OGRLinearRing *getExteriorRing();
1225  const OGRLinearRing *getExteriorRing() const;
1226  virtual OGRLinearRing *getInteriorRing( int );
1227  virtual const OGRLinearRing *getInteriorRing( int ) const;
1228 
1229  OGRLinearRing *stealExteriorRing();
1230  virtual OGRLinearRing *stealInteriorRing(int);
1231 
1232  OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
1233 
1234  virtual void closeRings() CPL_OVERRIDE;
1235 };
1236 
1237 /************************************************************************/
1238 /* OGRTriangle */
1239 /************************************************************************/
1240 
1247 class CPL_DLL OGRTriangle : public OGRPolygon
1248 {
1249  private:
1250  bool quickValidityCheck() const;
1251 
1252  protected:
1254  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const CPL_OVERRIDE;
1255  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1256  int bHasZ, int bHasM,
1257  OGRRawPoint*& paoPoints,
1258  int& nMaxPoints,
1259  double*& padfZ ) CPL_OVERRIDE;
1261 
1262  public:
1263  OGRTriangle();
1264  OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
1265  OGRTriangle( const OGRTriangle &other );
1266  OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
1267  OGRTriangle& operator=( const OGRTriangle& other );
1268  virtual ~OGRTriangle();
1269  virtual const char *getGeometryName() const CPL_OVERRIDE;
1271 
1272  // IWks Interface.
1273  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1275 
1276  // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
1277  virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) CPL_OVERRIDE;
1278 
1280  static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
1282 };
1283 
1284 /************************************************************************/
1285 /* OGRGeometryCollection */
1286 /************************************************************************/
1287 
1295 class CPL_DLL OGRGeometryCollection : public OGRGeometry
1296 {
1297  OGRErr importFromWkbInternal( unsigned char * pabyData, int nSize,
1298  int nRecLevel,
1299  OGRwkbVariant );
1300  OGRErr importFromWktInternal( char **ppszInput, int nRecLevel );
1301 
1302  protected:
1304  int nGeomCount;
1305  OGRGeometry **papoGeoms;
1306 
1307  OGRErr exportToWktInternal( char ** ppszDstText,
1308  OGRwkbVariant eWkbVariant,
1309  const char* pszSkipPrefix ) const;
1310  static OGRGeometryCollection* TransferMembersAndDestroy(
1311  OGRGeometryCollection* poSrc,
1312  OGRGeometryCollection* poDst );
1314  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1315 
1316  public:
1319  virtual ~OGRGeometryCollection();
1320 
1322 
1323  // Non standard (OGRGeometry).
1324  virtual const char *getGeometryName() const CPL_OVERRIDE;
1326  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1327  virtual void empty() CPL_OVERRIDE;
1329  virtual void flattenTo2D() CPL_OVERRIDE;
1330  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1331  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
1332  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1333  const CPL_OVERRIDE;
1334  virtual OGRGeometry* getCurveGeometry(
1335  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1336  virtual OGRGeometry* getLinearGeometry(
1337  double dfMaxAngleStepSizeDegrees = 0,
1338  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1339 
1340  // IWks Interface
1341  virtual int WkbSize() const CPL_OVERRIDE;
1342  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1344  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1346  const CPL_OVERRIDE;
1347  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1348  virtual OGRErr exportToWkt( char ** ppszDstText,
1350  const CPL_OVERRIDE;
1351 
1352  virtual double get_Length() const;
1353  virtual double get_Area() const;
1354 
1355  // IGeometry methods
1356  virtual int getDimension() const CPL_OVERRIDE;
1357  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1358  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1359 
1360  // IGeometryCollection
1361  int getNumGeometries() const;
1362  OGRGeometry *getGeometryRef( int );
1363  const OGRGeometry *getGeometryRef( int ) const;
1364 
1365  // ISpatialRelation
1366  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
1367 
1368  // Non standard
1369  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1370  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1371  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1372  virtual OGRErr addGeometry( const OGRGeometry * );
1373  virtual OGRErr addGeometryDirectly( OGRGeometry * );
1374  virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1375 
1376  void closeRings() CPL_OVERRIDE;
1377 
1378  virtual void swapXY() CPL_OVERRIDE;
1379 
1380  static OGRGeometryCollection* CastToGeometryCollection(
1381  OGRGeometryCollection* poSrc );
1382 };
1383 
1384 /************************************************************************/
1385 /* OGRMultiSurface */
1386 /************************************************************************/
1387 
1395 {
1396  protected:
1398  const CPL_OVERRIDE;
1399 
1400  public:
1401  OGRMultiSurface();
1402  OGRMultiSurface( const OGRMultiSurface& other );
1403  virtual ~OGRMultiSurface();
1404 
1405  OGRMultiSurface& operator=( const OGRMultiSurface& other );
1406 
1407  // Non standard (OGRGeometry).
1408  virtual const char *getGeometryName() const CPL_OVERRIDE;
1410  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1411  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1412  const CPL_OVERRIDE;
1413 
1414  // IMultiSurface methods
1415  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
1416 
1417  // IGeometry methods
1418  virtual int getDimension() const CPL_OVERRIDE;
1419 
1420  // Non standard
1421  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1422  const CPL_OVERRIDE;
1423 
1424  static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
1425 };
1426 
1427 /************************************************************************/
1428 /* OGRMultiPolygon */
1429 /************************************************************************/
1430 
1435 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
1436 {
1437  protected:
1439  const CPL_OVERRIDE;
1440  friend class OGRPolyhedralSurface;
1441  friend class OGRTriangulatedSurface;
1442 
1443  private:
1445  OGRErr _addGeometryWithExpectedSubGeometryType(
1446  const OGRGeometry * poNewGeom,
1447  OGRwkbGeometryType eSubGeometryType );
1448  OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
1449  OGRGeometry * poNewGeom,
1450  OGRwkbGeometryType eSubGeometryType );
1452 
1453 
1454  public:
1455  OGRMultiPolygon();
1456  OGRMultiPolygon(const OGRMultiPolygon& other);
1457  virtual ~OGRMultiPolygon();
1458 
1459  OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
1460 
1461  // Non-standard (OGRGeometry).
1462  virtual const char *getGeometryName() const CPL_OVERRIDE;
1464  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1465  const CPL_OVERRIDE;
1466 
1467  // IMultiSurface methods
1468  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
1469 
1470  // Non standard
1471  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1472  const CPL_OVERRIDE;
1473 
1474  static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
1475 };
1476 
1477 /************************************************************************/
1478 /* OGRPolyhedralSurface */
1479 /************************************************************************/
1480 
1487 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
1488 {
1489  protected:
1491  friend class OGRTriangulatedSurface;
1492  OGRMultiPolygon oMP;
1493  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1494  const CPL_OVERRIDE;
1495  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1496  const CPL_OVERRIDE;
1497  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1498  virtual const char* getSubGeometryName() const;
1499  virtual OGRwkbGeometryType getSubGeometryType() const;
1500  OGRErr exportToWktInternal (char ** ppszDstText, OGRwkbVariant eWkbVariant,
1501  const char* pszSkipPrefix ) const;
1502 
1503  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1504  const;
1505  static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
1507 
1508  public:
1511  virtual ~OGRPolyhedralSurface();
1513 
1514  // IWks Interface.
1515  virtual int WkbSize() const CPL_OVERRIDE;
1516  virtual const char *getGeometryName() const CPL_OVERRIDE;
1518  virtual OGRErr importFromWkb( unsigned char *, int=-1,
1520  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1522  const CPL_OVERRIDE;
1523  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1524  virtual OGRErr exportToWkt( char ** ppszDstText,
1526  const CPL_OVERRIDE;
1527 
1528  // IGeometry methods.
1529  virtual int getDimension() const CPL_OVERRIDE;
1530 
1531  virtual void empty() CPL_OVERRIDE;
1532 
1533  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1534  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1535  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1536 
1537  virtual void flattenTo2D() CPL_OVERRIDE;
1539  virtual OGRBoolean Equals( OGRGeometry* ) const CPL_OVERRIDE;
1540  virtual double get_Area() const CPL_OVERRIDE;
1541  virtual OGRErr PointOnSurface( OGRPoint* ) const CPL_OVERRIDE;
1542 
1544  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1545  const CPL_OVERRIDE;
1546  virtual OGRErr addGeometry( const OGRGeometry * );
1547  OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
1548  int getNumGeometries() const;
1549  OGRGeometry* getGeometryRef(int i);
1550  const OGRGeometry* getGeometryRef(int i) const;
1551 
1552  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1553  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1554  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1555  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1556  virtual void swapXY() CPL_OVERRIDE;
1557  OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1558 };
1559 
1560 /************************************************************************/
1561 /* OGRTriangulatedSurface */
1562 /************************************************************************/
1563 
1571 {
1572  protected:
1574  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
1575  const CPL_OVERRIDE;
1576  virtual const char* getSubGeometryName() const CPL_OVERRIDE;
1577  virtual OGRwkbGeometryType getSubGeometryType() const CPL_OVERRIDE;
1578 
1579  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1580  const CPL_OVERRIDE;
1581  static OGRMultiPolygon *
1582  CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
1584 
1585  public:
1589 
1591  virtual const char *getGeometryName() const CPL_OVERRIDE;
1593 
1594  // IWks Interface.
1595  virtual OGRErr addGeometry( const OGRGeometry * ) CPL_OVERRIDE;
1596 
1597  static OGRPolyhedralSurface *
1598  CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
1599 };
1600 
1601 /************************************************************************/
1602 /* OGRMultiPoint */
1603 /************************************************************************/
1604 
1609 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
1610 {
1611  private:
1612  OGRErr importFromWkt_Bracketed( char **, int bHasM, int bHasZ );
1613 
1614  protected:
1616  const CPL_OVERRIDE;
1617 
1618  public:
1619  OGRMultiPoint();
1620  OGRMultiPoint(const OGRMultiPoint& other);
1621  virtual ~OGRMultiPoint();
1622 
1623  OGRMultiPoint& operator=(const OGRMultiPoint& other);
1624 
1625  // Non-standard (OGRGeometry).
1626  virtual const char *getGeometryName() const CPL_OVERRIDE;
1628  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1629  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1630  const CPL_OVERRIDE;
1631 
1632  // IGeometry methods.
1633  virtual int getDimension() const CPL_OVERRIDE;
1634 
1635  // Non-standard.
1636  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1637  const CPL_OVERRIDE;
1638 };
1639 
1640 /************************************************************************/
1641 /* OGRMultiCurve */
1642 /************************************************************************/
1643 
1650 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
1651 {
1652  protected:
1654  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1655  OGRCurve* poCurve );
1658  const CPL_OVERRIDE;
1659 
1660  public:
1661  OGRMultiCurve();
1662  OGRMultiCurve( const OGRMultiCurve& other );
1663  virtual ~OGRMultiCurve();
1664 
1665  OGRMultiCurve& operator=( const OGRMultiCurve& other );
1666 
1667  // Non standard (OGRGeometry).
1668  virtual const char *getGeometryName() const CPL_OVERRIDE;
1670  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1671  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1672  const CPL_OVERRIDE;
1673 
1674  // IGeometry methods.
1675  virtual int getDimension() const CPL_OVERRIDE;
1676 
1677  // Non-standard.
1678  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1679  const CPL_OVERRIDE;
1680 
1681  static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
1682 };
1683 
1684 /************************************************************************/
1685 /* OGRMultiLineString */
1686 /************************************************************************/
1687 
1692 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
1693 {
1694  protected:
1696  const CPL_OVERRIDE;
1697 
1698  public:
1700  OGRMultiLineString( const OGRMultiLineString& other );
1701  virtual ~OGRMultiLineString();
1702 
1704 
1705  // Non standard (OGRGeometry).
1706  virtual const char *getGeometryName() const CPL_OVERRIDE;
1708  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1709  const CPL_OVERRIDE;
1710 
1711  // Non standard
1712  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1713  const CPL_OVERRIDE;
1714 
1715  static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
1716 };
1717 
1718 /************************************************************************/
1719 /* OGRGeometryFactory */
1720 /************************************************************************/
1721 
1726 class CPL_DLL OGRGeometryFactory
1727 {
1728  static OGRErr createFromFgfInternal( unsigned char *pabyData,
1729  OGRSpatialReference * poSR,
1730  OGRGeometry **ppoReturn,
1731  int nBytes,
1732  int *pnBytesConsumed,
1733  int nRecLevel );
1734  public:
1735  static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
1736  OGRGeometry **, int = -1,
1738  static OGRErr createFromWkt( char **, OGRSpatialReference *,
1739  OGRGeometry ** );
1740  static OGRErr createFromFgf( unsigned char *, OGRSpatialReference *,
1741  OGRGeometry **, int = -1, int * = NULL );
1742  static OGRGeometry *createFromGML( const char * );
1743  static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
1744  GEOSGeom );
1745 
1746  static void destroyGeometry( OGRGeometry * );
1747  static OGRGeometry *createGeometry( OGRwkbGeometryType );
1748 
1749  static OGRGeometry * forceToPolygon( OGRGeometry * );
1750  static OGRGeometry * forceToLineString( OGRGeometry *,
1751  bool bOnlyInOrder = true );
1752  static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
1753  static OGRGeometry * forceToMultiPoint( OGRGeometry * );
1754  static OGRGeometry * forceToMultiLineString( OGRGeometry * );
1755 
1756  static OGRGeometry * forceTo( OGRGeometry* poGeom,
1757  OGRwkbGeometryType eTargetType,
1758  const char*const* papszOptions = NULL );
1759 
1760  static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
1761  int nPolygonCount,
1762  int *pbResultValidGeometry,
1763  const char **papszOptions = NULL);
1764  static bool haveGEOS();
1765 
1766  static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
1768  char** papszOptions );
1769 
1770  static OGRGeometry*
1771  approximateArcAngles( double dfX, double dfY, double dfZ,
1772  double dfPrimaryRadius, double dfSecondaryAxis,
1773  double dfRotation,
1774  double dfStartAngle, double dfEndAngle,
1775  double dfMaxAngleStepSizeDegrees );
1776 
1777  static int GetCurveParmeters( double x0, double y0,
1778  double x1, double y1,
1779  double x2, double y2,
1780  double& R, double& cx, double& cy,
1781  double& alpha0, double& alpha1,
1782  double& alpha2 );
1783  static OGRLineString* curveToLineString(
1784  double x0, double y0, double z0,
1785  double x1, double y1, double z1,
1786  double x2, double y2, double z2,
1787  int bHasZ,
1788  double dfMaxAngleStepSizeDegrees,
1789  const char* const * papszOptions = NULL );
1790  static OGRCurve* curveFromLineString(
1791  const OGRLineString* poLS,
1792  const char* const * papszOptions = NULL);
1793 };
1794 
1795 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
1796 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
1797 
1799 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
1801 OGRPreparedGeometry* OGRCreatePreparedGeometry( const OGRGeometry* poGeom );
1802 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
1803 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
1804  const OGRGeometry* poOtherGeom );
1805 int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
1806  const OGRGeometry* poOtherGeom );
1807 
1808 #endif /* ndef OGR_GEOMETRY_H_INCLUDED */
virtual OGRErr importFromWkt(char **) CPL_OVERRIDE
Assign geometry from well known text data.
Definition: ogrcurvepolygon.cpp:507
virtual void Value(double, OGRPoint *) const CPL_OVERRIDE
Fetch point at given distance along curve.
Definition: ogrlinestring.cpp:1937
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known binary format.
Definition: ogrpolygon.cpp:364
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:4970
virtual int WkbSize() const CPL_OVERRIDE
Returns size of related binary representation.
Definition: ogrcurvepolygon.cpp:418
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Fetch geometry type.
Definition: ogrmulticurve.cpp:100
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
virtual OGRErr importFromWkb(unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc) CPL_OVERRIDE
Assign geometry from well known binary data.
Definition: ogrpolygon.cpp:319
virtual void setCoordinateDimension(int nDimension)
Set the coordinate dimension.
Definition: ogrgeometry.cpp:1022
virtual OGRBoolean IsValid() const
Test if the geometry is valid.
Definition: ogrgeometry.cpp:2028
virtual void set3D(OGRBoolean bIs3D)
Add or remove the Z coordinate dimension.
Definition: ogrgeometry.cpp:1045
virtual OGRBoolean Within(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:4729
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Fetch geometry type.
Definition: ogrmultisurface.cpp:101
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrmulticurve.cpp:193
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrgeometrycollection.cpp:801
virtual void setMeasured(OGRBoolean bIsMeasured)
Add or remove the M coordinate dimension.
Definition: ogrgeometry.cpp:1068
double y
Definition: ogr_geometry.h:59
Definition: ogr_geometry.h:623
virtual OGRErr importFromWkt(char **ppszInput)=0
Assign geometry from well known text data.
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const
Definition: ogrgeometrycollection.cpp:1288
#define CPL_OVERRIDE
Definition: cpl_port.h:1055
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known binary format.
Definition: ogrcurvepolygon.cpp:473
virtual void swapXY()
Swap x and y coordinates.
Definition: ogrgeometry.cpp:5708
double getX() const
Fetch X coordinate.
Definition: ogr_geometry.h:362
virtual void StartPoint(OGRPoint *) const CPL_OVERRIDE
Return the curve start point.
Definition: ogrcompoundcurve.cpp:288
virtual double get_Length() const CPL_OVERRIDE
Returns the length of the curve.
Definition: ogrlinestring.cpp:1895
Definition: ogr_geometry.h:1726
double x
Definition: ogr_geometry.h:57
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant eWkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrcurvepolygon.cpp:523
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
virtual double get_Length() const CPL_OVERRIDE
Returns the length of the curve.
Definition: ogrcompoundcurve.cpp:276
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const CPL_OVERRIDE
Definition: ogrmultisurface.cpp:139
OGRPolyhedralSurface()
Create an empty PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:47
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const =0
Convert a geometry into well known binary format.
OGRMultiCurve & operator=(const OGRMultiCurve &other)
Assignment operator.
Definition: ogrmulticurve.cpp:87
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrgeometrycollection.cpp:231
virtual OGRGeometry * clone() const CPL_WARN_UNUSED_RESULT=0
Make a copy of this object.
OGRCurve * stealExteriorRingCurve()
"Steal" reference to external ring.
Definition: ogrcurvepolygon.cpp:311
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const
Returns if this geometry is or has curve geometry.
Definition: ogrgeometry.cpp:3048
int OGRBoolean
Definition: ogr_core.h:301
virtual void Value(double, OGRPoint *) const CPL_OVERRIDE
Fetch point at given distance along curve.
Definition: ogrcompoundcurve.cpp:308
OGRCurve * getExteriorRingCurve()
Fetch reference to external polygon ring.
Definition: ogrcurvepolygon.cpp:205
virtual OGRErr addRingDirectly(OGRCurve *poNewRing) CPL_OVERRIDE
Add a ring to a polygon.
Definition: ogrtriangle.cpp:249
virtual OGRBoolean IsEmpty() const CPL_OVERRIDE
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:357
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:821
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Fetch geometry type.
Definition: ogrgeometrycollection.cpp:177
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrlinestring.cpp:2684
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrpolygon.cpp:123
OGRRawPoint()
Definition: ogr_geometry.h:51
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrgeometrycollection.cpp:1299
Definition: ogr_geometry.h:1435
int OGRHasPreparedGeometrySupport()
Definition: ogrgeometry.cpp:5738
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrcurvepolygon.cpp:179
virtual OGRBoolean Equals(OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
virtual OGRErr importFromWkb(unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc)=0
Assign geometry from well known binary data.
OGRwkbByteOrder
Definition: ogr_core.h:479
Definition: ogr_geometry.h:753
virtual void flattenTo2D()=0
Convert geometry to strictly 2D. In a sense this converts all Z coordinates to 0.0.
Definition: ogr_geometry.h:433
Definition: ogr_geometry.h:1295
Definition: ogr_geometry.h:684
void setM(double mIn)
Definition: ogr_geometry.h:388
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrpolygon.cpp:614
OGRGeometry & operator=(const OGRGeometry &other)
Assignment operator.
Definition: ogrgeometry.cpp:141
virtual int getNumPoints() const CPL_OVERRIDE
Fetch vertex count.
Definition: ogr_geometry.h:552
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const CPL_OVERRIDE
Definition: ogrmulticurve.cpp:137
virtual OGRErr importFromWkt(char **) CPL_OVERRIDE
Assign geometry from well known text data.
Definition: ogrlinestring.cpp:1678
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=NULL) const CPL_WARN_UNUSED_RESULT
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3116
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrmulticurve.cpp:127
Definition: ogr_geometry.h:1394
virtual double get_Length() const =0
Returns the length of the curve.
virtual int WkbSize() const CPL_OVERRIDE
Returns size of related binary representation.
Definition: ogrlinestring.cpp:195
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const
Return a polygon from a curve polygon.
Definition: ogrcurvepolygon.cpp:553
virtual void StartPoint(OGRPoint *) const =0
Return the curve start point.
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Definition: ogrgeometry.cpp:2257
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:554
OGRSimpleCurve & operator=(const OGRSimpleCurve &other)
Assignment operator.
Definition: ogrlinestring.cpp:99
virtual void segmentize(double dfMaxLength) CPL_OVERRIDE
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:712
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrmultisurface.cpp:278
virtual double get_Area() const =0
Get the area of the (closed) curve.
OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
Definition: ogrpolyhedralsurface.cpp:872
Definition: ogr_geometry.h:909
Definition: ogr_geometry.h:47
OGRwkbGeometryType
Definition: ogr_core.h:312
virtual void swapXY() CPL_OVERRIDE
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:726
virtual int get_IsClosed() const
Return TRUE if curve is closed.
Definition: ogrcurve.cpp:97
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Fetch geometry type.
Definition: ogrcurvepolygon.cpp:142
virtual OGRErr addGeometry(const OGRGeometry *) CPL_OVERRIDE
Add a new geometry to a collection.
Definition: ogrtriangulatedsurface.cpp:184
virtual OGRBoolean Intersects(const OGRGeometry *) const
Do these features intersect?
Definition: ogrgeometry.cpp:515
virtual OGRErr importFromWkb(unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc) CPL_OVERRIDE
Assign geometry from well known binary data.
Definition: ogrcurvepolygon.cpp:448
virtual ~OGRPolyhedralSurface()
Destructor.
Definition: ogrpolyhedralsurface.cpp:74
OGRMultiSurface & operator=(const OGRMultiSurface &other)
Assignment operator.
Definition: ogrmultisurface.cpp:88
Definition: ogr_geometry.h:415
Definition: ogr_geometry.h:1570
Definition: ogr_geometry.h:1650
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const =0
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:1017
Definition: ogr_geometry.h:1692
virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE
Definition: ogrcompoundcurve.cpp:879
Definition: ogr_geometry.h:118
virtual void empty()=0
Clear geometry information. This restores the geometry to it&#39;s initial state after construction...
virtual void segmentize(double dfMaxLength)
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrgeometry.cpp:804
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM IMultiSurface::get_PointOnSurface() method.
Definition: ogrmultisurface.cpp:299
void setX(double xIn)
Assign point X coordinate.
Definition: ogr_geometry.h:375
void sfcgal_geometry_t
Definition: ogr_geometry.h:67
static OGRLinearRing * CastToLinearRing(OGRCurve *poCurve)
Cast to linear ring.
Definition: ogrcurve.cpp:377
virtual double get_Area() const =0
Get the area of the surface object.
OGRTriangle & operator=(const OGRTriangle &other)
Assignment operator.
Definition: ogrtriangle.cpp:143
double getM() const
Definition: ogr_geometry.h:368
OGRPolyhedralSurface & operator=(const OGRPolyhedralSurface &other)
Assignment operator.
Definition: ogrpolyhedralsurface.cpp:87
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:398
virtual OGRBoolean IsConvex() const
Returns if a (closed) curve forms a convex shape.
Definition: ogrcurve.cpp:278
struct GEOSGeom_t * GEOSGeom
Definition: ogr_geometry.h:63
virtual OGRErr transform(OGRCoordinateTransformation *poCT) CPL_OVERRIDE
Apply arbitrary coordinate transformation to geometry.
Definition: ogrlinestring.cpp:2341
OGRLineString & operator=(const OGRLineString &other)
Assignment operator.
Definition: ogrlinestring.cpp:2654
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Fetch geometry type.
Definition: ogrpolygon.cpp:106
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_OVERRIDE
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrcurvepolygon.cpp:587
void setZ(double zIn)
Assign point Z coordinate. Calling this method will force the geometry coordinate dimension to 3D (wk...
Definition: ogr_geometry.h:383
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:1073
virtual OGRErr exportToWkt(char **, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrmulticurve.cpp:182
virtual OGRGeometry * clone() const CPL_OVERRIDE
Make a copy of this object.
Definition: ogrlinestring.cpp:126
virtual double get_Area() const CPL_OVERRIDE
Get the area of the (closed) curve.
Definition: ogrcompoundcurve.cpp:839
double getY() const
Fetch Y coordinate.
Definition: ogr_geometry.h:364
virtual int getDimension() const =0
Get the dimension of this object.
Definition: ogr_geometry.h:1051
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:187
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:242
virtual OGRErr transform(OGRCoordinateTransformation *poCT) CPL_OVERRIDE
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:653
Definition: ogr_geometry.h:1487
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known binary format.
Definition: ogrlinestring.cpp:1584
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_OVERRIDE
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:802
virtual OGRErr importFromWkt(char **) CPL_OVERRIDE
Assign geometry from well known text data.
Definition: ogrgeometrycollection.cpp:788
void setY(double yIn)
Assign point Y coordinate.
Definition: ogr_geometry.h:379
virtual OGRBoolean IsEmpty() const CPL_OVERRIDE
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:703
Definition: ogr_spatialref.h:132
virtual double get_AreaOfCurveSegments() const =0
Get the area of the purely curve portions of a (closed) curve.
struct _OGRPreparedGeometry OGRPreparedGeometry
Definition: ogr_geometry.h:1799
virtual int getDimension() const CPL_OVERRIDE
Get the dimension of this object.
Definition: ogrgeometrycollection.cpp:194
Definition: ogr_core.h:420
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:555
OGRCurvePolygon()
Create an empty curve polygon.
Definition: ogrcurvepolygon.cpp:52
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const =0
Return a linestring from a curve geometry.
virtual OGRErr addGeometry(const OGRGeometry *)
Add a new geometry to a collection.
Definition: ogrpolyhedralsurface.cpp:836
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrcurvepolygon.cpp:572
virtual void getEnvelope(OGREnvelope *psEnvelope) const CPL_OVERRIDE
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
Definition: ogrlinestring.cpp:2238
virtual OGRErr addRingDirectly(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:397
Definition: ogr_geometry.h:322
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const CPL_OVERRIDE
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogrcurvepolygon.cpp:597
OGRwkbVariant
Definition: ogr_core.h:418
virtual int WkbSize() const =0
Returns size of related binary representation.
virtual void getEnvelope(OGREnvelope *psEnvelope) const =0
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
OGRGeometryCollection & operator=(const OGRGeometryCollection &other)
Assignment operator.
Definition: ogrgeometrycollection.cpp:110
virtual void setCoordinateDimension(int nDimension) CPL_OVERRIDE
Set the coordinate dimension.
Definition: ogrcurvepolygon.cpp:683
virtual OGRErr importFromWkb(unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc) CPL_OVERRIDE
Assign geometry from well known binary data.
Definition: ogrlinestring.cpp:1474
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_WARN_UNUSED_RESULT
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrgeometry.cpp:3081
Definition: ogr_geometry.h:1162
Definition: ogr_geometry.h:491
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const =0
Convert a geometry into well known text format.
struct GEOSContextHandle_HS * GEOSContextHandle_t
Definition: ogr_geometry.h:65
virtual int getNumPoints() const =0
Return the number of points of a curve geometry.
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrpolyhedralsurface.cpp:102
virtual void segmentize(double dfMaxLength) CPL_OVERRIDE
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrlinestring.cpp:2462
virtual OGRBoolean Equals(OGRGeometry *) const CPL_OVERRIDE
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:627
OGRRawPoint(double xIn, double yIn)
Definition: ogr_geometry.h:54
virtual void flattenTo2D() CPL_OVERRIDE
Convert geometry to strictly 2D. In a sense this converts all Z coordinates to 0.0.
Definition: ogrcurvepolygon.cpp:169
Definition: ogr_spatialref.h:591
virtual int getNumPoints() const CPL_OVERRIDE
Return the number of points of a curve geometry.
Definition: ogrcompoundcurve.cpp:677
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:815
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Returns the WKB Type of PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:116
static OGRCompoundCurve * CastToCompoundCurve(OGRCurve *puCurve)
Cast to compound curve.
Definition: ogrcurve.cpp:324
virtual OGRErr addRing(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:338
virtual OGRPointIterator * getPointIterator() const =0
Returns a point iterator over the curve.
OGRCurvePolygon & operator=(const OGRCurvePolygon &other)
Assignment operator.
Definition: ogrcurvepolygon.cpp:91
Definition: ogr_geometry.h:1247
OGRPolygon & operator=(const OGRPolygon &other)
Assignment operator.
Definition: ogrpolygon.cpp:93
static OGRLineString * CastToLineString(OGRCurve *poCurve)
Cast to linestring.
Definition: ogrcurve.cpp:355
virtual OGRErr transform(OGRCoordinateTransformation *poCT)=0
Apply arbitrary coordinate transformation to geometry.
virtual OGRPointIterator * getPointIterator() const CPL_OVERRIDE
Returns a point iterator over the curve.
Definition: ogrcompoundcurve.cpp:735
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrlinestring.cpp:1797
int OGRErr
Definition: ogr_core.h:285
virtual int WkbSize() const CPL_OVERRIDE
Returns size of related binary representation.
Definition: ogrpolygon.cpp:299
virtual void set3D(OGRBoolean bIs3D) CPL_OVERRIDE
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:689
virtual void getEnvelope(OGREnvelope *psEnvelope) const CPL_OVERRIDE
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
Definition: ogrcurvepolygon.cpp:607
virtual OGRBoolean Contains(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:4812
virtual void setMeasured(OGRBoolean bIsMeasured) CPL_OVERRIDE
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:694
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:914
virtual OGRErr exportToWkt(char **, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrmultisurface.cpp:267
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType)
Definition: ogrgeometry.cpp:2330
Definition: ogr_geometry.h:1609
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:813
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrmultisurface.cpp:128
virtual void EndPoint(OGRPoint *) const CPL_OVERRIDE
Return the curve end point.
Definition: ogrcompoundcurve.cpp:298
double getZ() const
Fetch Z coordinate.
Definition: ogr_geometry.h:366
OGRBoolean Is3D() const
Definition: ogr_geometry.h:185
OGRCurve * getInteriorRingCurve(int)
Fetch reference to indicated internal ring.
Definition: ogrcurvepolygon.cpp:270
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_OVERRIDE
Return a linestring from a curve geometry.
Definition: ogrcompoundcurve.cpp:367
#define CPL_WARN_UNUSED_RESULT
Definition: cpl_port.h:999
virtual void empty() CPL_OVERRIDE
Clear geometry information. This restores the geometry to it&#39;s initial state after construction...
Definition: ogrcurvepolygon.cpp:132
OGRGeometry * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:936

Generated for GDAL by doxygen 1.8.14.