GDAL
ogr_geometry.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: ogr_geometry.h 38367 2017-05-15 10:29:33Z 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( const unsigned char * pabyData,
141  int nSize,
142  OGRwkbByteOrder& eByteOrder,
143  OGRwkbVariant eWkbVariant );
144  OGRErr importPreambuleOfCollectionFromWkb(
145  const 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  OGRErr importFromWkb( unsigned char *, int=-1,
198  virtual OGRErr importFromWkb( const unsigned char *,
199  int,
201  int& nBytesConsumedOut ) = 0;
202  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
203  OGRwkbVariant=wkbVariantOldOgc ) const = 0;
204  virtual OGRErr importFromWkt( char ** ppszInput ) = 0;
205  virtual OGRErr exportToWkt( char ** ppszDstText,
206  OGRwkbVariant=wkbVariantOldOgc ) const = 0;
207 
208  // Non-standard.
209  virtual OGRwkbGeometryType getGeometryType() const = 0;
210  OGRwkbGeometryType getIsoGeometryType() const;
211  virtual const char *getGeometryName() const = 0;
212  virtual void dumpReadable( FILE *, const char * = NULL
213  , char** papszOptions = NULL ) const;
214  virtual void flattenTo2D() = 0;
215  virtual char * exportToGML( const char* const * papszOptions = NULL ) const;
216  virtual char * exportToKML() const;
217  virtual char * exportToJson() const;
218 
219  static GEOSContextHandle_t createGEOSContext();
220  static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
221  virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
223  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
224  virtual OGRGeometry* getCurveGeometry(
225  const char* const* papszOptions = NULL ) const CPL_WARN_UNUSED_RESULT;
226  virtual OGRGeometry* getLinearGeometry(
227  double dfMaxAngleStepSizeDegrees = 0,
228  const char* const* papszOptions = NULL ) const CPL_WARN_UNUSED_RESULT;
229 
230  // SFCGAL interfacing methods.
232  static sfcgal_geometry_t* OGRexportToSFCGAL( OGRGeometry *poGeom );
233  static OGRGeometry* SFCGALexportToOGR( sfcgal_geometry_t* _geometry );
235  virtual void closeRings();
236 
237  virtual void setCoordinateDimension( int nDimension );
238  virtual void set3D( OGRBoolean bIs3D );
239  virtual void setMeasured( OGRBoolean bIsMeasured );
240 
241  void assignSpatialReference( OGRSpatialReference * poSR );
242  OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
243 
244  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) = 0;
245  OGRErr transformTo( OGRSpatialReference *poSR );
246 
247  virtual void segmentize(double dfMaxLength);
248 
249  // ISpatialRelation
250  virtual OGRBoolean Intersects( const OGRGeometry * ) const;
251  virtual OGRBoolean Equals( OGRGeometry * ) const = 0;
252  virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
253  virtual OGRBoolean Touches( const OGRGeometry * ) const;
254  virtual OGRBoolean Crosses( const OGRGeometry * ) const;
255  virtual OGRBoolean Within( const OGRGeometry * ) const;
256  virtual OGRBoolean Contains( const OGRGeometry * ) const;
257  virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
258 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
259 // virtual OGRGeometry *LocateAlong( double mValue ) const;
260 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
261 
262  virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
263  virtual double Distance( const OGRGeometry * ) const ;
264  virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
265  virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
266  const CPL_WARN_UNUSED_RESULT;
267  virtual OGRGeometry *Intersection( const OGRGeometry *)
268  const CPL_WARN_UNUSED_RESULT;
269  virtual OGRGeometry *Union( const OGRGeometry * )
270  const CPL_WARN_UNUSED_RESULT;
271  virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
272  virtual OGRGeometry *Difference( const OGRGeometry * )
273  const CPL_WARN_UNUSED_RESULT;
274  virtual OGRGeometry *SymDifference( const OGRGeometry * )
275  const CPL_WARN_UNUSED_RESULT;
276  virtual OGRErr Centroid( OGRPoint * poPoint ) const;
277  virtual OGRGeometry *Simplify(double dTolerance)
278  const CPL_WARN_UNUSED_RESULT;
279  OGRGeometry *SimplifyPreserveTopology(double dTolerance)
280  const CPL_WARN_UNUSED_RESULT;
281  virtual OGRGeometry *DelaunayTriangulation(
282  double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
283 
284  virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
285 
286  virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
287 
289  // backward compatibility to non-standard method names.
290  OGRBoolean Intersect( OGRGeometry * )
291  const CPL_WARN_DEPRECATED("Non standard method. "
292  "Use Intersects() instead");
293  OGRBoolean Equal( OGRGeometry * )
294  const CPL_WARN_DEPRECATED("Non standard method. "
295  "Use Equals() instead");
296  OGRGeometry *SymmetricDifference( const OGRGeometry * )
297  const CPL_WARN_DEPRECATED("Non standard method. "
298  "Use SymDifference() instead");
299  OGRGeometry *getBoundary()
300  const CPL_WARN_DEPRECATED("Non standard method. "
301  "Use Boundary() instead");
303 
305  // Special HACK for DB2 7.2 support
306  static int bGenerate_DB2_V72_BYTE_ORDER;
308 
309  virtual void swapXY();
311  static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
312  static OGRGeometry* CastToError( OGRGeometry* poGeom );
314 };
315 
316 /************************************************************************/
317 /* OGRPoint */
318 /************************************************************************/
319 
326 class CPL_DLL OGRPoint : public OGRGeometry
327 {
328  double x;
329  double y;
330  double z;
331  double m;
332 
333  public:
334  OGRPoint();
335  OGRPoint( double x, double y );
336  OGRPoint( double x, double y, double z );
337  OGRPoint( double x, double y, double z, double m );
338  OGRPoint( const OGRPoint& other );
339  virtual ~OGRPoint();
340 
341  OGRPoint& operator=( const OGRPoint& other );
342 
343  // IWks Interface
344  virtual int WkbSize() const CPL_OVERRIDE;
345  virtual OGRErr importFromWkb( const unsigned char *,
346  int,
348  int& nBytesConsumedOut ) CPL_OVERRIDE;
349  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
351  const CPL_OVERRIDE;
352  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
353  virtual OGRErr exportToWkt( char ** ppszDstText,
355  const CPL_OVERRIDE;
356 
357  // IGeometry
358  virtual int getDimension() const CPL_OVERRIDE;
359  virtual OGRGeometry *clone() const CPL_OVERRIDE;
360  virtual void empty() CPL_OVERRIDE;
361  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
362  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
363  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE
364  { return !(flags & OGR_G_NOT_EMPTY_POINT); }
365 
366  // IPoint
368  double getX() const { return x; }
370  double getY() const { return y; }
372  double getZ() const { return z; }
374  double getM() const { return m; }
375 
376  // Non standard
377  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
381  void setX( double xIn ) { x = xIn; flags |= OGR_G_NOT_EMPTY_POINT; }
385  void setY( double yIn ) { y = yIn; flags |= OGR_G_NOT_EMPTY_POINT; }
389  void setZ( double zIn )
390  { z = zIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_3D); }
394  void setM( double mIn )
395  { m = mIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_MEASURED); }
396 
397  // ISpatialRelation
398  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
399  virtual OGRBoolean Intersects( const OGRGeometry * ) const CPL_OVERRIDE;
400  virtual OGRBoolean Within( const OGRGeometry * ) const CPL_OVERRIDE;
401 
402  // Non standard from OGRGeometry
403  virtual const char *getGeometryName() const CPL_OVERRIDE;
404  virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
405  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
406  virtual void flattenTo2D() CPL_OVERRIDE;
407 
408  virtual void swapXY() CPL_OVERRIDE;
409 };
410 
411 /************************************************************************/
412 /* OGRPointIterator */
413 /************************************************************************/
414 
421 class CPL_DLL OGRPointIterator
422 {
423  public:
424  virtual ~OGRPointIterator();
425  virtual OGRBoolean getNextPoint( OGRPoint* p ) = 0;
426 
427  static void destroy( OGRPointIterator* );
428 };
429 
430 /************************************************************************/
431 /* OGRCurve */
432 /************************************************************************/
433 
439 class CPL_DLL OGRCurve : public OGRGeometry
440 {
441  protected:
443  OGRCurve();
444  OGRCurve( const OGRCurve& other );
445 
446  virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
447  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
448 
449  friend class OGRCurvePolygon;
450  friend class OGRCompoundCurve;
452  virtual int ContainsPoint( const OGRPoint* p ) const;
453  virtual double get_AreaOfCurveSegments() const = 0;
454 
455  public:
456  virtual ~OGRCurve();
457 
459  OGRCurve& operator=( const OGRCurve& other );
461 
462  // ICurve methods
463  virtual double get_Length() const = 0;
464  virtual void StartPoint( OGRPoint * ) const = 0;
465  virtual void EndPoint( OGRPoint * ) const = 0;
466  virtual int get_IsClosed() const;
467  virtual void Value( double, OGRPoint * ) const = 0;
468  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
469  const char* const* papszOptions = NULL)
470  const = 0;
471  virtual int getDimension() const CPL_OVERRIDE;
472 
473  // non standard
474  virtual int getNumPoints() const = 0;
475  virtual OGRPointIterator* getPointIterator() const = 0;
476  virtual OGRBoolean IsConvex() const;
477  virtual double get_Area() const = 0;
478 
479  static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
480  static OGRLineString* CastToLineString( OGRCurve* poCurve );
481  static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
482 };
483 
484 /************************************************************************/
485 /* OGRSimpleCurve */
486 /************************************************************************/
487 
497 class CPL_DLL OGRSimpleCurve: public OGRCurve
498 {
499  protected:
501  friend class OGRGeometry;
502 
503  int nPointCount;
504  OGRRawPoint *paoPoints;
505  double *padfZ;
506  double *padfM;
507 
508  void Make3D();
509  void Make2D();
510  void RemoveM();
511  void AddM();
512 
513  OGRErr importFromWKTListOnly( char ** ppszInput, int bHasZ, int bHasM,
514  OGRRawPoint*& paoPointsIn,
515  int& nMaxPoints,
516  double*& padfZIn );
517 
519 
520  virtual double get_LinearArea() const;
521 
522  OGRSimpleCurve();
523  OGRSimpleCurve( const OGRSimpleCurve& other );
524 
525  public:
526  virtual ~OGRSimpleCurve();
527 
528  OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
529 
530  // IWks Interface.
531  virtual int WkbSize() const CPL_OVERRIDE;
532  virtual OGRErr importFromWkb( const unsigned char *,
533  int,
535  int& nBytesConsumedOut ) CPL_OVERRIDE;
536  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
538  const CPL_OVERRIDE;
539  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
540  virtual OGRErr exportToWkt( char ** ppszDstText,
542  const CPL_OVERRIDE;
543 
544  // IGeometry interface.
545  virtual OGRGeometry *clone() const CPL_OVERRIDE;
546  virtual void empty() CPL_OVERRIDE;
547  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
548  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
549  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
550 
551  // ICurve methods.
552  virtual double get_Length() const CPL_OVERRIDE;
553  virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
554  virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
555  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
556  virtual double Project( const OGRPoint * ) const;
557  virtual OGRLineString* getSubLine( double, double, int ) const;
558 
559  // ILineString methods.
560  virtual int getNumPoints() const CPL_OVERRIDE { return nPointCount; }
561  void getPoint( int, OGRPoint * ) const;
562  double getX( int i ) const { return paoPoints[i].x; }
563  double getY( int i ) const { return paoPoints[i].y; }
564  double getZ( int i ) const;
565  double getM( int i ) const;
566 
567  // ISpatialRelation
568  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
569 
570  // non standard.
571  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
572  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
573  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
574  void setNumPoints( int nNewPointCount,
575  int bZeroizeNewContent = TRUE );
576  void setPoint( int, OGRPoint * );
577  void setPoint( int, double, double );
578  void setZ( int, double );
579  void setM( int, double );
580  void setPoint( int, double, double, double );
581  void setPointM( int, double, double, double );
582  void setPoint( int, double, double, double, double );
583  void setPoints( int, OGRRawPoint *, double * = NULL );
584  void setPointsM( int, OGRRawPoint *, double * );
585  void setPoints( int, OGRRawPoint *, double *, double * );
586  void setPoints( int, double * padfX, double * padfY,
587  double *padfZIn = NULL );
588  void setPointsM( int, double * padfX, double * padfY,
589  double *padfMIn = NULL );
590  void setPoints( int, double * padfX, double * padfY,
591  double *padfZIn, double *padfMIn );
592  void addPoint( const OGRPoint * );
593  void addPoint( double, double );
594  void addPoint( double, double, double );
595  void addPointM( double, double, double );
596  void addPoint( double, double, double, double );
597 
598  void getPoints( OGRRawPoint *, double * = NULL ) const;
599  void getPoints( void* pabyX, int nXStride,
600  void* pabyY, int nYStride,
601  void* pabyZ = NULL, int nZStride = 0 ) const;
602  void getPoints( void* pabyX, int nXStride,
603  void* pabyY, int nYStride,
604  void* pabyZ, int nZStride,
605  void* pabyM, int nMStride ) const;
606 
607  void addSubLineString( const OGRLineString *,
608  int nStartVertex = 0, int nEndVertex = -1 );
609  void reversePoints( void );
610  virtual OGRPointIterator* getPointIterator() const CPL_OVERRIDE;
611 
612  // non-standard from OGRGeometry
613  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
614  virtual void flattenTo2D() CPL_OVERRIDE;
615  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
616 
617  virtual void swapXY() CPL_OVERRIDE;
618 };
619 
620 /************************************************************************/
621 /* OGRLineString */
622 /************************************************************************/
623 
631 class CPL_DLL OGRLineString : public OGRSimpleCurve
632 {
633  static OGRLinearRing* CasterToLinearRing(OGRCurve* poCurve);
634 
635  protected:
637  static OGRLineString* TransferMembersAndDestroy(
638  OGRLineString* poSrc,
639  OGRLineString* poDst);
640 
641  virtual OGRCurveCasterToLineString GetCasterToLineString()
642  const CPL_OVERRIDE;
643  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
644  const CPL_OVERRIDE;
645 
646  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
648 
649  static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
650 
651  public:
652  OGRLineString();
653  OGRLineString( const OGRLineString& other );
654  virtual ~OGRLineString();
655 
656  OGRLineString& operator=(const OGRLineString& other);
657 
658  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
659  const char* const* papszOptions = NULL )
660  const CPL_OVERRIDE;
661  virtual OGRGeometry* getCurveGeometry(
662  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
663  virtual double get_Area() const CPL_OVERRIDE;
664 
665  // Non-standard from OGRGeometry.
667  virtual const char *getGeometryName() const CPL_OVERRIDE;
668 };
669 
670 /************************************************************************/
671 /* OGRLinearRing */
672 /************************************************************************/
673 
694 class CPL_DLL OGRLinearRing : public OGRLineString
695 {
696  static OGRLineString* CasterToLineString( OGRCurve* poCurve );
697 
698  protected:
700  friend class OGRPolygon;
701  friend class OGRTriangle;
702 
703  // These are not IWks compatible ... just a convenience for OGRPolygon.
704  virtual int _WkbSize( int _flags ) const;
705  virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
706  const unsigned char *, int,
707  int& nBytesConsumedOut );
708  virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
709  unsigned char * ) const;
710 
711  virtual OGRCurveCasterToLineString GetCasterToLineString()
712  const CPL_OVERRIDE;
713  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
714  const CPL_OVERRIDE;
716 
718 
719  public:
720  OGRLinearRing();
721  OGRLinearRing( const OGRLinearRing& other );
722  explicit OGRLinearRing( OGRLinearRing * );
723  virtual ~OGRLinearRing();
724 
725  OGRLinearRing& operator=( const OGRLinearRing& other );
726 
727  // Non standard.
728  virtual const char *getGeometryName() const CPL_OVERRIDE;
729  virtual OGRGeometry *clone() const CPL_OVERRIDE;
730  virtual int isClockwise() const;
731  virtual void reverseWindingOrder();
732  virtual void closeRings() CPL_OVERRIDE;
733  OGRBoolean isPointInRing( const OGRPoint* pt,
734  int bTestEnvelope = TRUE ) const;
735  OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
736  int bTestEnvelope = TRUE ) const;
738 
739  // IWks Interface - Note this isn't really a first class object
740  // for the purposes of WKB form. These methods always fail since this
741  // object can't be serialized on its own.
742  virtual int WkbSize() const CPL_OVERRIDE;
743  virtual OGRErr importFromWkb( const unsigned char *,
744  int,
746  int& nBytesConsumedOut ) CPL_OVERRIDE;
747  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
749  const CPL_OVERRIDE;
750 };
751 
752 /************************************************************************/
753 /* OGRCircularString */
754 /************************************************************************/
755 
768 class CPL_DLL OGRCircularString : public OGRSimpleCurve
769 {
770  private:
771  void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
772  OGRBoolean IsValidFast() const;
773  int IsFullCircle( double& cx, double& cy, double& square_R ) const;
774 
775  protected:
777  virtual OGRCurveCasterToLineString GetCasterToLineString()
778  const CPL_OVERRIDE;
779  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
780  const CPL_OVERRIDE;
781  virtual int ContainsPoint( const OGRPoint* p ) const CPL_OVERRIDE;
782  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
784 
785  public:
787  OGRCircularString(const OGRCircularString& other);
788  virtual ~OGRCircularString();
789 
791 
792  // IWks Interface.
793  virtual OGRErr importFromWkb( const unsigned char *,
794  int,
796  int& nBytesConsumedOut ) CPL_OVERRIDE;
797  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
799  const CPL_OVERRIDE;
800  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
801  virtual OGRErr exportToWkt( char ** ppszDstText,
803  const CPL_OVERRIDE;
804 
805  // IGeometry interface.
806  virtual OGRBoolean IsValid() const CPL_OVERRIDE;
807  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
808  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
809 
810  // ICurve methods.
811  virtual double get_Length() const CPL_OVERRIDE;
812  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
813  const char* const* papszOptions = NULL )
814  const CPL_OVERRIDE;
815  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
816  virtual double get_Area() const CPL_OVERRIDE;
817 
818  // Non-standard from OGRGeometry.
820  virtual const char *getGeometryName() const CPL_OVERRIDE;
821  virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
822  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
823  const CPL_OVERRIDE;
825  double dfMaxAngleStepSizeDegrees = 0,
826  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
827 };
828 
829 /************************************************************************/
830 /* OGRCurveCollection */
831 /************************************************************************/
832 
843 class CPL_DLL OGRCurveCollection
845 {
846  protected:
847  friend class OGRCompoundCurve;
848  friend class OGRCurvePolygon;
849  friend class OGRPolygon;
850  friend class OGRTriangle;
851 
852  int nCurveCount;
853  OGRCurve **papoCurves;
854 
855  public:
856  OGRCurveCollection();
857  OGRCurveCollection(const OGRCurveCollection& other);
858  ~OGRCurveCollection();
859 
860  OGRCurveCollection& operator=(const OGRCurveCollection& other);
861 
862  void empty(OGRGeometry* poGeom);
863  OGRBoolean IsEmpty() const;
864  void getEnvelope( OGREnvelope * psEnvelope ) const;
865  void getEnvelope( OGREnvelope3D * psEnvelope ) const;
866 
867  OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
868  int bNeedRealloc );
869  int WkbSize() const;
870  OGRErr importPreambuleFromWkb( OGRGeometry* poGeom,
871  const unsigned char * pabyData,
872  int& nSize,
873  int& nDataOffset,
874  OGRwkbByteOrder& eByteOrder,
875  int nMinSubGeomSize,
876  OGRwkbVariant eWkVariant );
877  OGRErr importBodyFromWkb(
878  OGRGeometry* poGeom,
879  const unsigned char * pabyData,
880  int nSize,
881  int bAcceptCompoundCurve,
882  OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
883  OGRCurve* poCurve ),
884  OGRwkbVariant eWkVariant,
885  int& nBytesConsumedOut );
886  OGRErr exportToWkt( const OGRGeometry* poGeom,
887  char ** ppszDstText ) const;
889  unsigned char *,
890  OGRwkbVariant eWkbVariant ) const;
891  OGRBoolean Equals(OGRCurveCollection *poOCC) const;
892  void setCoordinateDimension( OGRGeometry* poGeom,
893  int nNewDimension );
894  void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
895  void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
896  int getNumCurves() const;
897  OGRCurve *getCurve( int );
898  const OGRCurve *getCurve( int ) const;
899  OGRCurve *stealCurve( int );
900  OGRErr transform( OGRGeometry* poGeom,
902  void flattenTo2D( OGRGeometry* poGeom );
903  void segmentize( double dfMaxLength );
904  void swapXY();
905  OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
906 };
908 
909 /************************************************************************/
910 /* OGRCompoundCurve */
911 /************************************************************************/
912 
923 class CPL_DLL OGRCompoundCurve : public OGRCurve
924 {
925  private:
926  OGRCurveCollection oCC;
927 
928  OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
929  double dfToleranceEps,
930  int bNeedRealloc );
931  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
932  OGRCurve* poCurve );
933  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
934  OGRCurve* poCurve );
935  OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
936  const char* const* papszOptions,
937  int bIsLinearRing ) const;
938  static OGRLineString* CasterToLineString( OGRCurve* poCurve );
939  static OGRLinearRing* CasterToLinearRing( OGRCurve* poCurve );
940 
941  protected:
945 
946  virtual OGRCurveCasterToLineString GetCasterToLineString()
947  const CPL_OVERRIDE;
948  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
949  const CPL_OVERRIDE;
951 
952  public:
954  OGRCompoundCurve( const OGRCompoundCurve& other );
955  virtual ~OGRCompoundCurve();
956 
958 
959  // IWks Interface
960  virtual int WkbSize() const CPL_OVERRIDE;
961  virtual OGRErr importFromWkb( const unsigned char *,
962  int,
964  int& nBytesConsumedOut ) CPL_OVERRIDE;
965  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
967  const CPL_OVERRIDE;
968  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
969  virtual OGRErr exportToWkt( char ** ppszDstText,
971  const CPL_OVERRIDE;
972 
973  // IGeometry interface.
974  virtual OGRGeometry *clone() const CPL_OVERRIDE;
975  virtual void empty() CPL_OVERRIDE;
976  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
977  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
978  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
979 
980  // ICurve methods.
981  virtual double get_Length() const CPL_OVERRIDE;
982  virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
983  virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
984  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
985  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
986  const char* const* papszOptions = NULL )
987  const CPL_OVERRIDE;
988 
989  virtual int getNumPoints() const CPL_OVERRIDE;
990  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
991  virtual double get_Area() const CPL_OVERRIDE;
992 
993  // ISpatialRelation.
994  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
995 
996  // ICompoundCurve method.
997  int getNumCurves() const;
998  OGRCurve *getCurve( int );
999  const OGRCurve *getCurve( int ) const;
1000 
1001  // Non-standard.
1002  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1003  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1004  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1005 
1006  OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
1007  OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
1008  OGRCurve *stealCurve( int );
1010 
1011  // Non-standard from OGRGeometry.
1013  virtual const char *getGeometryName() const CPL_OVERRIDE;
1015  virtual void flattenTo2D() CPL_OVERRIDE;
1016  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
1017  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
1018  const CPL_OVERRIDE;
1019  virtual OGRGeometry* getLinearGeometry(
1020  double dfMaxAngleStepSizeDegrees = 0,
1021  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
1022 
1023  virtual void swapXY() CPL_OVERRIDE;
1024 };
1025 
1026 /************************************************************************/
1027 /* OGRSurface */
1028 /************************************************************************/
1029 
1035 class CPL_DLL OGRSurface : public OGRGeometry
1036 {
1037  protected:
1039  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1040  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1042 
1043  public:
1044  virtual double get_Area() const = 0;
1045  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const = 0;
1047  static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1048  static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1050 };
1051 
1052 /************************************************************************/
1053 /* OGRCurvePolygon */
1054 /************************************************************************/
1055 
1069 class CPL_DLL OGRCurvePolygon : public OGRSurface
1070 {
1071  static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1072 
1073  private:
1074  OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1075  virtual int checkRing( OGRCurve * poNewRing ) const;
1076  OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1077  int bNeedRealloc );
1078  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1079  OGRCurve* poCurve );
1080  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1081  OGRCurve* poCurve );
1082 
1083  protected:
1085  friend class OGRPolygon;
1086  friend class OGRTriangle;
1087  OGRCurveCollection oCC;
1088 
1089  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1090  const CPL_OVERRIDE;
1091  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1092  const CPL_OVERRIDE;
1094 
1095  static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
1096 
1097  public:
1098  OGRCurvePolygon();
1099  OGRCurvePolygon( const OGRCurvePolygon& );
1100  virtual ~OGRCurvePolygon();
1101 
1102  OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
1103 
1104  // Non standard (OGRGeometry).
1105  virtual const char *getGeometryName() const CPL_OVERRIDE;
1107  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1108  virtual void empty() CPL_OVERRIDE;
1110  virtual void flattenTo2D() CPL_OVERRIDE;
1111  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1112  virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
1113  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1114  const CPL_OVERRIDE;
1115  virtual OGRGeometry* getLinearGeometry(
1116  double dfMaxAngleStepSizeDegrees = 0,
1117  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1118 
1119  // ISurface Interface
1120  virtual double get_Area() const CPL_OVERRIDE;
1121  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
1122 
1123  // IWks Interface
1124  virtual int WkbSize() const CPL_OVERRIDE;
1125  virtual OGRErr importFromWkb( const unsigned char *,
1126  int,
1127  OGRwkbVariant,
1128  int& nBytesConsumedOut ) CPL_OVERRIDE;
1129  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1131  const CPL_OVERRIDE;
1132  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1133  virtual OGRErr exportToWkt( char ** ppszDstText,
1134  OGRwkbVariant eWkbVariant = wkbVariantOldOgc )
1135  const CPL_OVERRIDE;
1136 
1137  // IGeometry
1138  virtual int getDimension() const CPL_OVERRIDE;
1139  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1140  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1141 
1142  // ICurvePolygon
1143  virtual OGRPolygon* CurvePolyToPoly(
1144  double dfMaxAngleStepSizeDegrees = 0,
1145  const char* const* papszOptions = NULL ) const;
1146 
1147  // ISpatialRelation
1148  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
1149  virtual OGRBoolean Intersects( const OGRGeometry * ) const CPL_OVERRIDE;
1150  virtual OGRBoolean Contains( const OGRGeometry * ) const CPL_OVERRIDE;
1151 
1152  // Non standard
1153  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1154  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1155  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1156 
1157  virtual OGRErr addRing( OGRCurve * );
1158  virtual OGRErr addRingDirectly( OGRCurve * );
1159 
1161  const OGRCurve *getExteriorRingCurve() const;
1162  int getNumInteriorRings() const;
1164  const OGRCurve *getInteriorRingCurve( int ) const;
1165 
1167 
1168  virtual void swapXY() CPL_OVERRIDE;
1169 };
1170 
1171 /************************************************************************/
1172 /* OGRPolygon */
1173 /************************************************************************/
1174 
1184 class CPL_DLL OGRPolygon : public OGRCurvePolygon
1185 {
1186  static OGRCurvePolygon* CasterToCurvePolygon(OGRSurface* poSurface);
1187 
1188  protected:
1190  friend class OGRMultiSurface;
1191  friend class OGRPolyhedralSurface;
1192  friend class OGRTriangulatedSurface;
1193 
1194  virtual int checkRing( OGRCurve * poNewRing ) const CPL_OVERRIDE;
1195  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1196  int bHasZ, int bHasM,
1197  OGRRawPoint*& paoPoints,
1198  int& nMaxPoints,
1199  double*& padfZ );
1200 
1201  static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
1202 
1203  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1204  const CPL_OVERRIDE;
1205  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1206  const CPL_OVERRIDE;
1208 
1209  public:
1210  OGRPolygon();
1211  OGRPolygon(const OGRPolygon& other);
1212  virtual ~OGRPolygon();
1213 
1214  OGRPolygon& operator=(const OGRPolygon& other);
1215 
1216  // Non-standard (OGRGeometry).
1217  virtual const char *getGeometryName() const CPL_OVERRIDE;
1219  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1220  const CPL_OVERRIDE;
1221  virtual OGRGeometry* getCurveGeometry(
1222  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1223  virtual OGRGeometry* getLinearGeometry(
1224  double dfMaxAngleStepSizeDegrees = 0,
1225  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
1226 
1227  // ISurface Interface.
1228  virtual OGRErr PointOnSurface( OGRPoint * poPoint )
1229  const CPL_OVERRIDE;
1230 
1231  // IWks Interface.
1232  virtual int WkbSize() const CPL_OVERRIDE;
1233  virtual OGRErr importFromWkb( const unsigned char *,
1234  int,
1235  OGRwkbVariant,
1236  int& nBytesConsumedOut ) CPL_OVERRIDE;
1237  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1239  const CPL_OVERRIDE;
1240  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1241  virtual OGRErr exportToWkt( char ** ppszDstText,
1243  const CPL_OVERRIDE;
1244 
1245  // ICurvePolygon.
1246  virtual OGRPolygon* CurvePolyToPoly(
1247  double dfMaxAngleStepSizeDegrees = 0,
1248  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1249 
1250  OGRLinearRing *getExteriorRing();
1251  const OGRLinearRing *getExteriorRing() const;
1252  virtual OGRLinearRing *getInteriorRing( int );
1253  virtual const OGRLinearRing *getInteriorRing( int ) const;
1254 
1255  OGRLinearRing *stealExteriorRing();
1256  virtual OGRLinearRing *stealInteriorRing(int);
1257 
1258  OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
1259 
1260  virtual void closeRings() CPL_OVERRIDE;
1261 };
1262 
1263 /************************************************************************/
1264 /* OGRTriangle */
1265 /************************************************************************/
1266 
1273 class CPL_DLL OGRTriangle : public OGRPolygon
1274 {
1275  private:
1276  static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1277  bool quickValidityCheck() const;
1278 
1279  protected:
1281  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const CPL_OVERRIDE;
1282  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1283  int bHasZ, int bHasM,
1284  OGRRawPoint*& paoPoints,
1285  int& nMaxPoints,
1286  double*& padfZ ) CPL_OVERRIDE;
1288 
1289  public:
1290  OGRTriangle();
1291  OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
1292  OGRTriangle( const OGRTriangle &other );
1293  OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
1294  OGRTriangle& operator=( const OGRTriangle& other );
1295  virtual ~OGRTriangle();
1296  virtual const char *getGeometryName() const CPL_OVERRIDE;
1298 
1299  // IWks Interface.
1300  virtual OGRErr importFromWkb( const unsigned char *,
1301  int,
1302  OGRwkbVariant,
1303  int& nBytesConsumedOut ) CPL_OVERRIDE;
1304 
1305  // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
1306  virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) CPL_OVERRIDE;
1307 
1309  static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
1311 };
1312 
1313 /************************************************************************/
1314 /* OGRGeometryCollection */
1315 /************************************************************************/
1316 
1324 class CPL_DLL OGRGeometryCollection : public OGRGeometry
1325 {
1326  OGRErr importFromWkbInternal( const unsigned char * pabyData,
1327  int nSize,
1328  int nRecLevel,
1329  OGRwkbVariant, int& nBytesConsumedOut );
1330  OGRErr importFromWktInternal( char **ppszInput, int nRecLevel );
1331 
1332  protected:
1334  int nGeomCount;
1335  OGRGeometry **papoGeoms;
1336 
1337  OGRErr exportToWktInternal( char ** ppszDstText,
1338  OGRwkbVariant eWkbVariant,
1339  const char* pszSkipPrefix ) const;
1340  static OGRGeometryCollection* TransferMembersAndDestroy(
1341  OGRGeometryCollection* poSrc,
1342  OGRGeometryCollection* poDst );
1344  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1345 
1346  public:
1349  virtual ~OGRGeometryCollection();
1350 
1352 
1353  // Non standard (OGRGeometry).
1354  virtual const char *getGeometryName() const CPL_OVERRIDE;
1356  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1357  virtual void empty() CPL_OVERRIDE;
1359  virtual void flattenTo2D() CPL_OVERRIDE;
1360  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1361  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
1362  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1363  const CPL_OVERRIDE;
1364  virtual OGRGeometry* getCurveGeometry(
1365  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1366  virtual OGRGeometry* getLinearGeometry(
1367  double dfMaxAngleStepSizeDegrees = 0,
1368  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1369 
1370  // IWks Interface
1371  virtual int WkbSize() const CPL_OVERRIDE;
1372  virtual OGRErr importFromWkb( const unsigned char *,
1373  int,
1374  OGRwkbVariant,
1375  int& nBytesConsumedOut ) CPL_OVERRIDE;
1376  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1378  const CPL_OVERRIDE;
1379  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1380  virtual OGRErr exportToWkt( char ** ppszDstText,
1382  const CPL_OVERRIDE;
1383 
1384  virtual double get_Length() const;
1385  virtual double get_Area() const;
1386 
1387  // IGeometry methods
1388  virtual int getDimension() const CPL_OVERRIDE;
1389  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1390  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1391 
1392  // IGeometryCollection
1393  int getNumGeometries() const;
1394  OGRGeometry *getGeometryRef( int );
1395  const OGRGeometry *getGeometryRef( int ) const;
1396 
1397  // ISpatialRelation
1398  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
1399 
1400  // Non standard
1401  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1402  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1403  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1404  virtual OGRErr addGeometry( const OGRGeometry * );
1405  virtual OGRErr addGeometryDirectly( OGRGeometry * );
1406  virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1407 
1408  void closeRings() CPL_OVERRIDE;
1409 
1410  virtual void swapXY() CPL_OVERRIDE;
1411 
1412  static OGRGeometryCollection* CastToGeometryCollection(
1413  OGRGeometryCollection* poSrc );
1414 };
1415 
1416 /************************************************************************/
1417 /* OGRMultiSurface */
1418 /************************************************************************/
1419 
1427 {
1428  protected:
1430  const CPL_OVERRIDE;
1431 
1432  public:
1433  OGRMultiSurface();
1434  OGRMultiSurface( const OGRMultiSurface& other );
1435  virtual ~OGRMultiSurface();
1436 
1437  OGRMultiSurface& operator=( const OGRMultiSurface& other );
1438 
1439  // Non standard (OGRGeometry).
1440  virtual const char *getGeometryName() const CPL_OVERRIDE;
1442  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1443  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1444  const CPL_OVERRIDE;
1445 
1446  // IMultiSurface methods
1447  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
1448 
1449  // IGeometry methods
1450  virtual int getDimension() const CPL_OVERRIDE;
1451 
1452  // Non standard
1453  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1454  const CPL_OVERRIDE;
1455 
1456  static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
1457 };
1458 
1459 /************************************************************************/
1460 /* OGRMultiPolygon */
1461 /************************************************************************/
1462 
1467 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
1468 {
1469  protected:
1471  const CPL_OVERRIDE;
1472  friend class OGRPolyhedralSurface;
1473  friend class OGRTriangulatedSurface;
1474 
1475  private:
1477  OGRErr _addGeometryWithExpectedSubGeometryType(
1478  const OGRGeometry * poNewGeom,
1479  OGRwkbGeometryType eSubGeometryType );
1480  OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
1481  OGRGeometry * poNewGeom,
1482  OGRwkbGeometryType eSubGeometryType );
1484 
1485 
1486  public:
1487  OGRMultiPolygon();
1488  OGRMultiPolygon(const OGRMultiPolygon& other);
1489  virtual ~OGRMultiPolygon();
1490 
1491  OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
1492 
1493  // Non-standard (OGRGeometry).
1494  virtual const char *getGeometryName() const CPL_OVERRIDE;
1496  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1497  const CPL_OVERRIDE;
1498 
1499  // IMultiSurface methods
1500  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
1501 
1502  // Non standard
1503  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1504  const CPL_OVERRIDE;
1505 
1506  static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
1507 };
1508 
1509 /************************************************************************/
1510 /* OGRPolyhedralSurface */
1511 /************************************************************************/
1512 
1519 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
1520 {
1521  protected:
1523  friend class OGRTriangulatedSurface;
1524  OGRMultiPolygon oMP;
1525  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1526  const CPL_OVERRIDE;
1527  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1528  const CPL_OVERRIDE;
1529  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1530  virtual const char* getSubGeometryName() const;
1531  virtual OGRwkbGeometryType getSubGeometryType() const;
1532  OGRErr exportToWktInternal (char ** ppszDstText, OGRwkbVariant eWkbVariant,
1533  const char* pszSkipPrefix ) const;
1534 
1535  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1536  const;
1537  static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
1539 
1540  public:
1543  virtual ~OGRPolyhedralSurface();
1545 
1546  // IWks Interface.
1547  virtual int WkbSize() const CPL_OVERRIDE;
1548  virtual const char *getGeometryName() const CPL_OVERRIDE;
1550  virtual OGRErr importFromWkb( const unsigned char *,
1551  int,
1552  OGRwkbVariant,
1553  int& nBytesConsumedOut ) CPL_OVERRIDE;
1554  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1556  const CPL_OVERRIDE;
1557  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1558  virtual OGRErr exportToWkt( char ** ppszDstText,
1560  const CPL_OVERRIDE;
1561 
1562  // IGeometry methods.
1563  virtual int getDimension() const CPL_OVERRIDE;
1564 
1565  virtual void empty() CPL_OVERRIDE;
1566 
1567  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1568  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1569  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1570 
1571  virtual void flattenTo2D() CPL_OVERRIDE;
1573  virtual OGRBoolean Equals( OGRGeometry* ) const CPL_OVERRIDE;
1574  virtual double get_Area() const CPL_OVERRIDE;
1575  virtual OGRErr PointOnSurface( OGRPoint* ) const CPL_OVERRIDE;
1576 
1578  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1579  const CPL_OVERRIDE;
1580  virtual OGRErr addGeometry( const OGRGeometry * );
1581  OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
1582  int getNumGeometries() const;
1583  OGRGeometry* getGeometryRef(int i);
1584  const OGRGeometry* getGeometryRef(int i) const;
1585 
1586  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1587  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1588  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1589  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1590  virtual void swapXY() CPL_OVERRIDE;
1591  OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1592 };
1593 
1594 /************************************************************************/
1595 /* OGRTriangulatedSurface */
1596 /************************************************************************/
1597 
1605 {
1606  protected:
1608  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
1609  const CPL_OVERRIDE;
1610  virtual const char* getSubGeometryName() const CPL_OVERRIDE;
1611  virtual OGRwkbGeometryType getSubGeometryType() const CPL_OVERRIDE;
1612 
1613  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1614  const CPL_OVERRIDE;
1615  static OGRMultiPolygon *
1616  CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
1618 
1619  public:
1623 
1625  virtual const char *getGeometryName() const CPL_OVERRIDE;
1627 
1628  // IWks Interface.
1629  virtual OGRErr addGeometry( const OGRGeometry * ) CPL_OVERRIDE;
1630 
1631  static OGRPolyhedralSurface *
1632  CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
1633 };
1634 
1635 /************************************************************************/
1636 /* OGRMultiPoint */
1637 /************************************************************************/
1638 
1643 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
1644 {
1645  private:
1646  OGRErr importFromWkt_Bracketed( char **, int bHasM, int bHasZ );
1647 
1648  protected:
1650  const CPL_OVERRIDE;
1651 
1652  public:
1653  OGRMultiPoint();
1654  OGRMultiPoint(const OGRMultiPoint& other);
1655  virtual ~OGRMultiPoint();
1656 
1657  OGRMultiPoint& operator=(const OGRMultiPoint& other);
1658 
1659  // Non-standard (OGRGeometry).
1660  virtual const char *getGeometryName() const CPL_OVERRIDE;
1662  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1663  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1664  const CPL_OVERRIDE;
1665 
1666  // IGeometry methods.
1667  virtual int getDimension() const CPL_OVERRIDE;
1668 
1669  // Non-standard.
1670  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1671  const CPL_OVERRIDE;
1672 };
1673 
1674 /************************************************************************/
1675 /* OGRMultiCurve */
1676 /************************************************************************/
1677 
1684 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
1685 {
1686  protected:
1688  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1689  OGRCurve* poCurve );
1692  const CPL_OVERRIDE;
1693 
1694  public:
1695  OGRMultiCurve();
1696  OGRMultiCurve( const OGRMultiCurve& other );
1697  virtual ~OGRMultiCurve();
1698 
1699  OGRMultiCurve& operator=( const OGRMultiCurve& other );
1700 
1701  // Non standard (OGRGeometry).
1702  virtual const char *getGeometryName() const CPL_OVERRIDE;
1704  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1705  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1706  const CPL_OVERRIDE;
1707 
1708  // IGeometry methods.
1709  virtual int getDimension() const CPL_OVERRIDE;
1710 
1711  // Non-standard.
1712  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1713  const CPL_OVERRIDE;
1714 
1715  static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
1716 };
1717 
1718 /************************************************************************/
1719 /* OGRMultiLineString */
1720 /************************************************************************/
1721 
1726 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
1727 {
1728  protected:
1730  const CPL_OVERRIDE;
1731 
1732  public:
1734  OGRMultiLineString( const OGRMultiLineString& other );
1735  virtual ~OGRMultiLineString();
1736 
1738 
1739  // Non standard (OGRGeometry).
1740  virtual const char *getGeometryName() const CPL_OVERRIDE;
1742  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1743  const CPL_OVERRIDE;
1744 
1745  // Non standard
1746  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1747  const CPL_OVERRIDE;
1748 
1749  static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
1750 };
1751 
1752 /************************************************************************/
1753 /* OGRGeometryFactory */
1754 /************************************************************************/
1755 
1760 class CPL_DLL OGRGeometryFactory
1761 {
1762  static OGRErr createFromFgfInternal( unsigned char *pabyData,
1763  OGRSpatialReference * poSR,
1764  OGRGeometry **ppoReturn,
1765  int nBytes,
1766  int *pnBytesConsumed,
1767  int nRecLevel );
1768  public:
1769  static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
1770  OGRGeometry **, int = -1,
1772  static OGRErr createFromWkb( const unsigned char * pabyData,
1774  OGRGeometry **,
1775  int nSize,
1776  OGRwkbVariant eVariant,
1777  int& nBytesConsumedOut );
1778 
1779  static OGRErr createFromWkt( char **, OGRSpatialReference *,
1780  OGRGeometry ** );
1781  static OGRErr createFromFgf( unsigned char *, OGRSpatialReference *,
1782  OGRGeometry **, int = -1, int * = NULL );
1783  static OGRGeometry *createFromGML( const char * );
1784  static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
1785  GEOSGeom );
1786 
1787  static void destroyGeometry( OGRGeometry * );
1788  static OGRGeometry *createGeometry( OGRwkbGeometryType );
1789 
1790  static OGRGeometry * forceToPolygon( OGRGeometry * );
1791  static OGRGeometry * forceToLineString( OGRGeometry *,
1792  bool bOnlyInOrder = true );
1793  static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
1794  static OGRGeometry * forceToMultiPoint( OGRGeometry * );
1795  static OGRGeometry * forceToMultiLineString( OGRGeometry * );
1796 
1797  static OGRGeometry * forceTo( OGRGeometry* poGeom,
1798  OGRwkbGeometryType eTargetType,
1799  const char*const* papszOptions = NULL );
1800 
1801  static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
1802  int nPolygonCount,
1803  int *pbResultValidGeometry,
1804  const char **papszOptions = NULL);
1805  static bool haveGEOS();
1806 
1807  static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
1809  char** papszOptions );
1810 
1811  static OGRGeometry*
1812  approximateArcAngles( double dfX, double dfY, double dfZ,
1813  double dfPrimaryRadius, double dfSecondaryAxis,
1814  double dfRotation,
1815  double dfStartAngle, double dfEndAngle,
1816  double dfMaxAngleStepSizeDegrees );
1817 
1818  static int GetCurveParmeters( double x0, double y0,
1819  double x1, double y1,
1820  double x2, double y2,
1821  double& R, double& cx, double& cy,
1822  double& alpha0, double& alpha1,
1823  double& alpha2 );
1824  static OGRLineString* curveToLineString(
1825  double x0, double y0, double z0,
1826  double x1, double y1, double z1,
1827  double x2, double y2, double z2,
1828  int bHasZ,
1829  double dfMaxAngleStepSizeDegrees,
1830  const char* const * papszOptions = NULL );
1831  static OGRCurve* curveFromLineString(
1832  const OGRLineString* poLS,
1833  const char* const * papszOptions = NULL);
1834 };
1835 
1836 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
1837 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
1838 
1840 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
1843 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
1844 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
1845  const OGRGeometry* poOtherGeom );
1846 int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
1847  const OGRGeometry* poOtherGeom );
1848 
1849 #endif /* ndef OGR_GEOMETRY_H_INCLUDED */
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) CPL_OVERRIDE
Assign geometry from well known binary data.
Definition: ogrpolygon.cpp:319
virtual OGRErr importFromWkt(char **) CPL_OVERRIDE
Assign geometry from well known text data.
Definition: ogrcurvepolygon.cpp:513
virtual void Value(double, OGRPoint *) const CPL_OVERRIDE
Fetch point at given distance along curve.
Definition: ogrlinestring.cpp:1954
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:373
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:5017
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 void setCoordinateDimension(int nDimension)
Set the coordinate dimension.
Definition: ogrgeometry.cpp:1031
OGRBoolean Is3D() const
Definition: ogr_geometry.h:185
virtual void set3D(OGRBoolean bIs3D)
Add or remove the Z coordinate dimension.
Definition: ogrgeometry.cpp:1054
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:812
virtual void setMeasured(OGRBoolean bIsMeasured)
Add or remove the M coordinate dimension.
Definition: ogrgeometry.cpp:1077
double y
y
Definition: ogr_geometry.h:59
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:631
virtual OGRErr importFromWkt(char **ppszInput)=0
Assign geometry from well known text data.
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const
Returns if this geometry is or has curve geometry.
Definition: ogrgeometry.cpp:3095
#define CPL_OVERRIDE
To be used in public headers only.
Definition: cpl_port.h:1055
double getY() const
Return y.
Definition: ogr_geometry.h:370
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known binary format.
Definition: ogrcurvepolygon.cpp:479
virtual void swapXY()
Swap x and y coordinates.
Definition: ogrgeometry.cpp:5753
virtual void StartPoint(OGRPoint *) const CPL_OVERRIDE
Return the curve start point.
Definition: ogrcompoundcurve.cpp:293
virtual double get_Length() const CPL_OVERRIDE
Returns the length of the curve.
Definition: ogrlinestring.cpp:1912
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:1760
double x
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:529
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:281
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const CPL_OVERRIDE
Returns whether a geometry of the specified geometry type can be a member of this collection...
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
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:303
virtual void Value(double, OGRPoint *) const CPL_OVERRIDE
Fetch point at given distance along curve.
Definition: ogrcompoundcurve.cpp:313
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:251
virtual OGRBoolean IsEmpty() const CPL_OVERRIDE
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:363
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:819
Coordinate systems services.
double getM() const
Return m.
Definition: ogr_geometry.h:374
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:2701
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrpolygon.cpp:123
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:51
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) CPL_OVERRIDE
Assign geometry from well known binary data.
Definition: ogrcurvepolygon.cpp:448
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:1310
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:1467
int OGRHasPreparedGeometrySupport()
Returns if GEOS has prepared geometry support.
Definition: ogrgeometry.cpp:5783
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.
OGRwkbByteOrder
Enumeration to describe byte order.
Definition: ogr_core.h:481
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) CPL_OVERRIDE
Assign geometry from well known binary data.
Definition: ogrlinestring.cpp:1482
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:768
virtual void flattenTo2D()=0
Convert geometry to strictly 2D.
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:439
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:1324
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:242
Concrete representation of a closed ring.
Definition: ogr_geometry.h:694
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:394
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrpolygon.cpp:623
OGRGeometry & operator=(const OGRGeometry &other)
Assignment operator.
Definition: ogrgeometry.cpp:141
virtual int getNumPoints() const CPL_OVERRIDE
Fetch vertex count.
Definition: ogr_geometry.h:560
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM IMultiSurface::get_PointOnSurface() method.
Definition: ogrmultisurface.cpp:299
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const CPL_OVERRIDE
Returns whether a geometry of the specified geometry type can be a member of this collection...
Definition: ogrmulticurve.cpp:137
virtual OGRErr importFromWkt(char **) CPL_OVERRIDE
Assign geometry from well known text data.
Definition: ogrlinestring.cpp:1692
virtual int get_IsClosed() const
Return TRUE if curve is closed.
Definition: ogrcurve.cpp:97
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=NULL) const CPL_WARN_UNUSED_RESULT
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3163
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const
Returns whether a geometry of the specified geometry type can be a member of this collection...
Definition: ogrgeometrycollection.cpp:1299
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrmulticurve.cpp:127
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:1426
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 void StartPoint(OGRPoint *) const =0
Return the curve start point.
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGCgeometry format type to corresponding OGR constants.
Definition: ogrgeometry.cpp:2304
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:718
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:896
Utility class to store a collection of curves.
Definition: ogr_geometry.h:923
Simple container for a position.
Definition: ogr_geometry.h:47
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:314
virtual void swapXY() CPL_OVERRIDE
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:732
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 ~OGRPolyhedralSurface()
Destructor.
Definition: ogrpolyhedralsurface.cpp:74
OGRMultiSurface & operator=(const OGRMultiSurface &other)
Assignment operator.
Definition: ogrmultisurface.cpp:88
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:398
Interface for a point iterator.
Definition: ogr_geometry.h:421
TriangulatedSurface class.
Definition: ogr_geometry.h:1604
A collection of OGRCurve.
Definition: ogr_geometry.h:1684
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const =0
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:1035
A collection of OGRLineString.
Definition: ogr_geometry.h:1726
virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE
Return area of curve segments.
Definition: ogrcompoundcurve.cpp:898
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:118
virtual void empty()=0
Clear geometry information.
virtual void segmentize(double dfMaxLength)
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrgeometry.cpp:813
double getZ() const
Return z.
Definition: ogr_geometry.h:372
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:381
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:187
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:67
virtual OGRBoolean IsValid() const
Test if the geometry is valid.
Definition: ogrgeometry.cpp:2075
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
virtual OGRBoolean Intersects(const OGRGeometry *) const
Do these features intersect?
Definition: ogrgeometry.cpp:515
OGRPolyhedralSurface & operator=(const OGRPolyhedralSurface &other)
Assignment operator.
Definition: ogrpolyhedralsurface.cpp:87
void OGRDestroyPreparedGeometry(OGRPreparedGeometry *poPreparedGeom)
Destroys a prepared geometry.
Definition: ogrgeometry.cpp:5839
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:63
virtual OGRErr transform(OGRCoordinateTransformation *poCT) CPL_OVERRIDE
Apply arbitrary coordinate transformation to geometry.
Definition: ogrlinestring.cpp:2358
OGRLineString & operator=(const OGRLineString &other)
Assignment operator.
Definition: ogrlinestring.cpp:2671
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:593
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:389
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:1097
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:858
Core portability services for cross-platform OGR code.
virtual int getDimension() const =0
Get the dimension of this object.
int OGRPreparedGeometryIntersects(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry intersects with a geometry.
Definition: ogrgeometry.cpp:5861
Concrete class representing curve polygons.
Definition: ogr_geometry.h:1069
virtual OGRErr transform(OGRCoordinateTransformation *poCT) CPL_OVERRIDE
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:659
PolyhedralSurface class.
Definition: ogr_geometry.h:1519
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known binary format.
Definition: ogrlinestring.cpp:1598
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_OVERRIDE
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:812
virtual OGRErr importFromWkt(char **) CPL_OVERRIDE
Assign geometry from well known text data.
Definition: ogrgeometrycollection.cpp:799
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:385
virtual OGRBoolean IsEmpty() const CPL_OVERRIDE
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:709
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
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
Prepared geometry API (needs GEOS >= 3.1.0)
Definition: ogr_geometry.h:1840
virtual int getDimension() const CPL_OVERRIDE
Get the dimension of this object.
Definition: ogrgeometrycollection.cpp:194
Old-style 99-402 extended dimension (Z) WKB types.
Definition: ogr_core.h:422
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.
OGRPreparedGeometry * OGRCreatePreparedGeometry(const OGRGeometry *poGeom)
Creates a prepared geometry.
Definition: ogrgeometry.cpp:5803
virtual OGRErr addGeometry(const OGRGeometry *)
Add a new geometry to a collection.
Definition: ogrpolyhedralsurface.cpp:860
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrcurvepolygon.cpp:578
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:2255
virtual OGRErr addRingDirectly(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:397
Point class.
Definition: ogr_geometry.h:326
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const CPL_OVERRIDE
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogrcurvepolygon.cpp:603
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:420
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:689
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:3128
double getX() const
Return x.
Definition: ogr_geometry.h:368
Concrete class representing polygons.
Definition: ogr_geometry.h:1184
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:497
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const =0
Convert a geometry into well known text format.
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
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:2479
virtual OGRBoolean Contains(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:4859
virtual OGRBoolean Equals(OGRGeometry *) const CPL_OVERRIDE
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:633
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:54
virtual void flattenTo2D() CPL_OVERRIDE
Convert geometry to strictly 2D.
Definition: ogrcurvepolygon.cpp:169
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:562
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:593
virtual int getNumPoints() const CPL_OVERRIDE
Return the number of points of a curve geometry.
Definition: ogrcompoundcurve.cpp:682
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:839
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Returns the WKB Type of PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:116
OGRErr importFromWkb(unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc)
Assign geometry from well known binary data.
Definition: ogrgeometry.cpp:1397
static OGRCompoundCurve * CastToCompoundCurve(OGRCurve *puCurve)
Cast to compound curve.
Definition: ogrcurve.cpp:324
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:938
int OGRPreparedGeometryContains(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry contains a geometry.
Definition: ogrgeometry.cpp:5891
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const
Return a polygon from a curve polygon.
Definition: ogrcurvepolygon.cpp:559
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
Triangle class.
Definition: ogr_geometry.h:1273
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:740
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrlinestring.cpp:1814
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:287
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:695
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:613
virtual void setMeasured(OGRBoolean bIsMeasured) CPL_OVERRIDE
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:700
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)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition: ogrgeometry.cpp:2377
A collection of OGRPoint.
Definition: ogr_geometry.h:1643
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:823
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:303
virtual OGRBoolean IsConvex() const
Returns if a (closed) curve forms a convex shape.
Definition: ogrcurve.cpp:278
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:372
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:999
virtual void empty() CPL_OVERRIDE
Clear geometry information.
Definition: ogrcurvepolygon.cpp:132
OGRGeometry * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:960
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:563

Generated for GDAL by doxygen 1.8.8.