GDAL
ogr_geometry.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: ogr_geometry.h 37113 2017-01-12 11:47:03Z 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 )
262  const CPL_WARN_UNUSED_RESULT;
263  virtual OGRGeometry *Intersection( const OGRGeometry *)
264  const CPL_WARN_UNUSED_RESULT;
265  virtual OGRGeometry *Union( const OGRGeometry * )
266  const CPL_WARN_UNUSED_RESULT;
267  virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
268  virtual OGRGeometry *Difference( const OGRGeometry * )
269  const CPL_WARN_UNUSED_RESULT;
270  virtual OGRGeometry *SymDifference( const OGRGeometry * )
271  const CPL_WARN_UNUSED_RESULT;
272  virtual OGRErr Centroid( OGRPoint * poPoint ) const;
273  virtual OGRGeometry *Simplify(double dTolerance)
274  const CPL_WARN_UNUSED_RESULT;
275  OGRGeometry *SimplifyPreserveTopology(double dTolerance)
276  const CPL_WARN_UNUSED_RESULT;
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;
357  virtual OGRBoolean IsEmpty() 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 );
602  virtual OGRPointIterator* getPointIterator() const CPL_OVERRIDE;
603 
604  // non-standard from OGRGeometry
605  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
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 
639  static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
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 /************************************************************************/
739 /* OGRCircularString */
740 /************************************************************************/
741 
754 class CPL_DLL OGRCircularString : public OGRSimpleCurve
755 {
756  private:
757  void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
758  OGRBoolean IsValidFast() const;
759  int IsFullCircle( double& cx, double& cy, double& square_R ) const;
760 
761  protected:
763  virtual OGRCurveCasterToLineString GetCasterToLineString()
764  const CPL_OVERRIDE;
765  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
766  const CPL_OVERRIDE;
767  virtual int ContainsPoint( const OGRPoint* p ) const CPL_OVERRIDE;
768  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
770 
771  public:
773  OGRCircularString(const OGRCircularString& other);
774  virtual ~OGRCircularString();
775 
777 
778  // IWks Interface.
779  virtual OGRErr importFromWkb( unsigned char *, int = -1,
781  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
783  const CPL_OVERRIDE;
784  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
785  virtual OGRErr exportToWkt( char ** ppszDstText,
787  const CPL_OVERRIDE;
788 
789  // IGeometry interface.
790  virtual OGRBoolean IsValid() const CPL_OVERRIDE;
791  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
792  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
793 
794  // ICurve methods.
795  virtual double get_Length() const CPL_OVERRIDE;
796  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
797  const char* const* papszOptions = NULL )
798  const CPL_OVERRIDE;
799  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
800  virtual double get_Area() const CPL_OVERRIDE;
801 
802  // Non-standard from OGRGeometry.
804  virtual const char *getGeometryName() const CPL_OVERRIDE;
805  virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
806  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
807  const CPL_OVERRIDE;
809  double dfMaxAngleStepSizeDegrees = 0,
810  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
811 };
812 
813 /************************************************************************/
814 /* OGRCurveCollection */
815 /************************************************************************/
816 
827 class CPL_DLL OGRCurveCollection
829 {
830  protected:
831  friend class OGRCompoundCurve;
832  friend class OGRCurvePolygon;
833  friend class OGRPolygon;
834  friend class OGRTriangle;
835 
836  int nCurveCount;
837  OGRCurve **papoCurves;
838 
839  public:
840  OGRCurveCollection();
841  OGRCurveCollection(const OGRCurveCollection& other);
842  ~OGRCurveCollection();
843 
844  OGRCurveCollection& operator=(const OGRCurveCollection& other);
845 
846  void empty(OGRGeometry* poGeom);
847  OGRBoolean IsEmpty() const;
848  void getEnvelope( OGREnvelope * psEnvelope ) const;
849  void getEnvelope( OGREnvelope3D * psEnvelope ) const;
850 
851  OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
852  int bNeedRealloc );
853  int WkbSize() const;
854  OGRErr importPreambuleFromWkb( OGRGeometry* poGeom,
855  unsigned char * pabyData,
856  int& nSize,
857  int& nDataOffset,
858  OGRwkbByteOrder& eByteOrder,
859  int nMinSubGeomSize,
860  OGRwkbVariant eWkVariant );
861  OGRErr importBodyFromWkb(
862  OGRGeometry* poGeom,
863  unsigned char * pabyData,
864  int nSize,
865  int nDataOffset,
866  int bAcceptCompoundCurve,
867  OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
868  OGRCurve* poCurve ),
869  OGRwkbVariant eWkVariant );
870  OGRErr exportToWkt( const OGRGeometry* poGeom,
871  char ** ppszDstText ) const;
873  unsigned char *,
874  OGRwkbVariant eWkbVariant ) const;
875  OGRBoolean Equals(OGRCurveCollection *poOCC) const;
876  void setCoordinateDimension( OGRGeometry* poGeom,
877  int nNewDimension );
878  void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
879  void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
880  int getNumCurves() const;
881  OGRCurve *getCurve( int );
882  const OGRCurve *getCurve( int ) const;
883  OGRCurve *stealCurve( int );
884  OGRErr transform( OGRGeometry* poGeom,
886  void flattenTo2D( OGRGeometry* poGeom );
887  void segmentize( double dfMaxLength );
888  void swapXY();
889  OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
890 };
892 
893 /************************************************************************/
894 /* OGRCompoundCurve */
895 /************************************************************************/
896 
907 class CPL_DLL OGRCompoundCurve : public OGRCurve
908 {
909  private:
910  OGRCurveCollection oCC;
911 
912  OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
913  double dfToleranceEps,
914  int bNeedRealloc );
915  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
916  OGRCurve* poCurve );
917  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
918  OGRCurve* poCurve );
919  OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
920  const char* const* papszOptions,
921  int bIsLinearRing ) const;
922 
923  protected:
927 
928  virtual OGRCurveCasterToLineString GetCasterToLineString()
929  const CPL_OVERRIDE;
930  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
931  const CPL_OVERRIDE;
933 
934  public:
936  OGRCompoundCurve( const OGRCompoundCurve& other );
937  virtual ~OGRCompoundCurve();
938 
940 
941  // IWks Interface
942  virtual int WkbSize() const CPL_OVERRIDE;
943  virtual OGRErr importFromWkb( unsigned char *, int = -1,
945  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
947  const CPL_OVERRIDE;
948  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
949  virtual OGRErr exportToWkt( char ** ppszDstText,
951  const CPL_OVERRIDE;
952 
953  // IGeometry interface.
954  virtual OGRGeometry *clone() const CPL_OVERRIDE;
955  virtual void empty() CPL_OVERRIDE;
956  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
957  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
958  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
959 
960  // ICurve methods.
961  virtual double get_Length() const CPL_OVERRIDE;
962  virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
963  virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
964  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
965  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
966  const char* const* papszOptions = NULL )
967  const CPL_OVERRIDE;
968 
969  virtual int getNumPoints() const CPL_OVERRIDE;
970  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
971  virtual double get_Area() const CPL_OVERRIDE;
972 
973  // ISpatialRelation.
974  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
975 
976  // ICompoundCurve method.
977  int getNumCurves() const;
978  OGRCurve *getCurve( int );
979  const OGRCurve *getCurve( int ) const;
980 
981  // Non-standard.
982  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
983  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
984  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
985 
986  OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
987  OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
988  OGRCurve *stealCurve( int );
990 
991  // Non-standard from OGRGeometry.
993  virtual const char *getGeometryName() const CPL_OVERRIDE;
995  virtual void flattenTo2D() CPL_OVERRIDE;
996  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
997  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
998  const CPL_OVERRIDE;
1000  double dfMaxAngleStepSizeDegrees = 0,
1001  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
1002 
1003  virtual void swapXY() CPL_OVERRIDE;
1004 };
1005 
1006 /************************************************************************/
1007 /* OGRSurface */
1008 /************************************************************************/
1009 
1015 class CPL_DLL OGRSurface : public OGRGeometry
1016 {
1017  protected:
1019  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1020  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1022 
1023  public:
1024  virtual double get_Area() const = 0;
1025  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const = 0;
1027  static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1028  static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1030 };
1031 
1032 /************************************************************************/
1033 /* OGRCurvePolygon */
1034 /************************************************************************/
1035 
1049 class CPL_DLL OGRCurvePolygon : public OGRSurface
1050 {
1051  private:
1052  OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1053  virtual int checkRing( OGRCurve * poNewRing ) const;
1054  OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1055  int bNeedRealloc );
1056  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1057  OGRCurve* poCurve );
1058  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1059  OGRCurve* poCurve );
1060 
1061  protected:
1063  friend class OGRPolygon;
1064  friend class OGRTriangle;
1065  OGRCurveCollection oCC;
1066 
1067  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1068  const CPL_OVERRIDE;
1069  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1070  const CPL_OVERRIDE;
1072 
1073  static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
1074 
1075  public:
1076  OGRCurvePolygon();
1077  OGRCurvePolygon( const OGRCurvePolygon& );
1078  virtual ~OGRCurvePolygon();
1079 
1080  OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
1081 
1082  // Non standard (OGRGeometry).
1083  virtual const char *getGeometryName() const CPL_OVERRIDE;
1085  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1086  virtual void empty() CPL_OVERRIDE;
1088  virtual void flattenTo2D() CPL_OVERRIDE;
1089  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1090  virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
1091  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1092  const CPL_OVERRIDE;
1093  virtual OGRGeometry* getLinearGeometry(
1094  double dfMaxAngleStepSizeDegrees = 0,
1095  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1096 
1097  // ISurface Interface
1098  virtual double get_Area() const CPL_OVERRIDE;
1099  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
1100 
1101  // IWks Interface
1102  virtual int WkbSize() const CPL_OVERRIDE;
1103  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1105  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1107  const CPL_OVERRIDE;
1108  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1109  virtual OGRErr exportToWkt( char ** ppszDstText,
1110  OGRwkbVariant eWkbVariant = wkbVariantOldOgc )
1111  const CPL_OVERRIDE;
1112 
1113  // IGeometry
1114  virtual int getDimension() const CPL_OVERRIDE;
1115  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1116  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1117 
1118  // ICurvePolygon
1119  virtual OGRPolygon* CurvePolyToPoly(
1120  double dfMaxAngleStepSizeDegrees = 0,
1121  const char* const* papszOptions = NULL ) const;
1122 
1123  // ISpatialRelation
1124  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
1125  virtual OGRBoolean Intersects( const OGRGeometry * ) const CPL_OVERRIDE;
1126  virtual OGRBoolean Contains( const OGRGeometry * ) const CPL_OVERRIDE;
1127 
1128  // Non standard
1129  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1130  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1131  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1132 
1133  virtual OGRErr addRing( OGRCurve * );
1134  virtual OGRErr addRingDirectly( OGRCurve * );
1135 
1137  const OGRCurve *getExteriorRingCurve() const;
1138  int getNumInteriorRings() const;
1140  const OGRCurve *getInteriorRingCurve( int ) const;
1141 
1143 
1144  virtual void swapXY() CPL_OVERRIDE;
1145 };
1146 
1147 /************************************************************************/
1148 /* OGRPolygon */
1149 /************************************************************************/
1150 
1160 class CPL_DLL OGRPolygon : public OGRCurvePolygon
1161 {
1162  protected:
1164  friend class OGRMultiSurface;
1165  friend class OGRPolyhedralSurface;
1166  friend class OGRTriangulatedSurface;
1167 
1168  virtual int checkRing( OGRCurve * poNewRing ) const CPL_OVERRIDE;
1169  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1170  int bHasZ, int bHasM,
1171  OGRRawPoint*& paoPoints,
1172  int& nMaxPoints,
1173  double*& padfZ );
1174 
1175  static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
1176 
1177  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1178  const CPL_OVERRIDE;
1179  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1180  const CPL_OVERRIDE;
1182 
1183  public:
1184  OGRPolygon();
1185  OGRPolygon(const OGRPolygon& other);
1186  virtual ~OGRPolygon();
1187 
1188  OGRPolygon& operator=(const OGRPolygon& other);
1189 
1190  // Non-standard (OGRGeometry).
1191  virtual const char *getGeometryName() const CPL_OVERRIDE;
1193  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1194  const CPL_OVERRIDE;
1195  virtual OGRGeometry* getCurveGeometry(
1196  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1197  virtual OGRGeometry* getLinearGeometry(
1198  double dfMaxAngleStepSizeDegrees = 0,
1199  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
1200 
1201  // ISurface Interface.
1202  virtual OGRErr PointOnSurface( OGRPoint * poPoint )
1203  const CPL_OVERRIDE;
1204 
1205  // IWks Interface.
1206  virtual int WkbSize() const CPL_OVERRIDE;
1207  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1209  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1211  const CPL_OVERRIDE;
1212  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1213  virtual OGRErr exportToWkt( char ** ppszDstText,
1215  const CPL_OVERRIDE;
1216 
1217  // ICurvePolygon.
1218  virtual OGRPolygon* CurvePolyToPoly(
1219  double dfMaxAngleStepSizeDegrees = 0,
1220  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1221 
1222  OGRLinearRing *getExteriorRing();
1223  const OGRLinearRing *getExteriorRing() const;
1224  virtual OGRLinearRing *getInteriorRing( int );
1225  virtual const OGRLinearRing *getInteriorRing( int ) const;
1226 
1227  OGRLinearRing *stealExteriorRing();
1228  virtual OGRLinearRing *stealInteriorRing(int);
1229 
1230  OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
1231 
1232  virtual void closeRings() CPL_OVERRIDE;
1233 };
1234 
1235 /************************************************************************/
1236 /* OGRTriangle */
1237 /************************************************************************/
1238 
1245 class CPL_DLL OGRTriangle : public OGRPolygon
1246 {
1247  private:
1248  bool quickValidityCheck() const;
1249 
1250  protected:
1252  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const CPL_OVERRIDE;
1253  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1254  int bHasZ, int bHasM,
1255  OGRRawPoint*& paoPoints,
1256  int& nMaxPoints,
1257  double*& padfZ ) CPL_OVERRIDE;
1259 
1260  public:
1261  OGRTriangle();
1262  OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
1263  OGRTriangle( const OGRTriangle &other );
1264  OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
1265  OGRTriangle& operator=( const OGRTriangle& other );
1266  virtual ~OGRTriangle();
1267  virtual const char *getGeometryName() const CPL_OVERRIDE;
1269 
1270  // IWks Interface.
1271  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1273 
1274  // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
1275  virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) CPL_OVERRIDE;
1276 
1278  static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
1280 };
1281 
1282 /************************************************************************/
1283 /* OGRGeometryCollection */
1284 /************************************************************************/
1285 
1293 class CPL_DLL OGRGeometryCollection : public OGRGeometry
1294 {
1295  OGRErr importFromWkbInternal( unsigned char * pabyData, int nSize,
1296  int nRecLevel,
1297  OGRwkbVariant );
1298  OGRErr importFromWktInternal( char **ppszInput, int nRecLevel );
1299 
1300  protected:
1302  int nGeomCount;
1303  OGRGeometry **papoGeoms;
1304 
1305  OGRErr exportToWktInternal( char ** ppszDstText,
1306  OGRwkbVariant eWkbVariant,
1307  const char* pszSkipPrefix ) const;
1308  static OGRGeometryCollection* TransferMembersAndDestroy(
1309  OGRGeometryCollection* poSrc,
1310  OGRGeometryCollection* poDst );
1312  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1313 
1314  public:
1317  virtual ~OGRGeometryCollection();
1318 
1320 
1321  // Non standard (OGRGeometry).
1322  virtual const char *getGeometryName() const CPL_OVERRIDE;
1324  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1325  virtual void empty() CPL_OVERRIDE;
1327  virtual void flattenTo2D() CPL_OVERRIDE;
1328  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1329  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
1330  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1331  const CPL_OVERRIDE;
1332  virtual OGRGeometry* getCurveGeometry(
1333  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1334  virtual OGRGeometry* getLinearGeometry(
1335  double dfMaxAngleStepSizeDegrees = 0,
1336  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1337 
1338  // IWks Interface
1339  virtual int WkbSize() const CPL_OVERRIDE;
1340  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1342  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1344  const CPL_OVERRIDE;
1345  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1346  virtual OGRErr exportToWkt( char ** ppszDstText,
1348  const CPL_OVERRIDE;
1349 
1350  virtual double get_Length() const;
1351  virtual double get_Area() const;
1352 
1353  // IGeometry methods
1354  virtual int getDimension() const CPL_OVERRIDE;
1355  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1356  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1357 
1358  // IGeometryCollection
1359  int getNumGeometries() const;
1360  OGRGeometry *getGeometryRef( int );
1361  const OGRGeometry *getGeometryRef( int ) const;
1362 
1363  // ISpatialRelation
1364  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
1365 
1366  // Non standard
1367  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1368  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1369  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1370  virtual OGRErr addGeometry( const OGRGeometry * );
1371  virtual OGRErr addGeometryDirectly( OGRGeometry * );
1372  virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1373 
1374  void closeRings() CPL_OVERRIDE;
1375 
1376  virtual void swapXY() CPL_OVERRIDE;
1377 
1378  static OGRGeometryCollection* CastToGeometryCollection(
1379  OGRGeometryCollection* poSrc );
1380 };
1381 
1382 /************************************************************************/
1383 /* OGRMultiSurface */
1384 /************************************************************************/
1385 
1393 {
1394  protected:
1396  const CPL_OVERRIDE;
1397 
1398  public:
1399  OGRMultiSurface();
1400  OGRMultiSurface( const OGRMultiSurface& other );
1401  virtual ~OGRMultiSurface();
1402 
1403  OGRMultiSurface& operator=( const OGRMultiSurface& other );
1404 
1405  // Non standard (OGRGeometry).
1406  virtual const char *getGeometryName() const CPL_OVERRIDE;
1408  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1409  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1410  const CPL_OVERRIDE;
1411 
1412  // IMultiSurface methods
1413  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
1414 
1415  // IGeometry methods
1416  virtual int getDimension() const CPL_OVERRIDE;
1417 
1418  // Non standard
1419  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1420  const CPL_OVERRIDE;
1421 
1422  static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
1423 };
1424 
1425 /************************************************************************/
1426 /* OGRMultiPolygon */
1427 /************************************************************************/
1428 
1433 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
1434 {
1435  protected:
1437  const CPL_OVERRIDE;
1438  friend class OGRPolyhedralSurface;
1439  friend class OGRTriangulatedSurface;
1440 
1441  private:
1443  OGRErr _addGeometryWithExpectedSubGeometryType(
1444  const OGRGeometry * poNewGeom,
1445  OGRwkbGeometryType eSubGeometryType );
1446  OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
1447  OGRGeometry * poNewGeom,
1448  OGRwkbGeometryType eSubGeometryType );
1450 
1451 
1452  public:
1453  OGRMultiPolygon();
1454  OGRMultiPolygon(const OGRMultiPolygon& other);
1455  virtual ~OGRMultiPolygon();
1456 
1457  OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
1458 
1459  // Non-standard (OGRGeometry).
1460  virtual const char *getGeometryName() const CPL_OVERRIDE;
1462  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1463  const CPL_OVERRIDE;
1464 
1465  // IMultiSurface methods
1466  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
1467 
1468  // Non standard
1469  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1470  const CPL_OVERRIDE;
1471 
1472  static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
1473 };
1474 
1475 /************************************************************************/
1476 /* OGRPolyhedralSurface */
1477 /************************************************************************/
1478 
1485 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
1486 {
1487  protected:
1489  friend class OGRTriangulatedSurface;
1490  OGRMultiPolygon oMP;
1491  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1492  const CPL_OVERRIDE;
1493  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1494  const CPL_OVERRIDE;
1495  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1496  virtual const char* getSubGeometryName() const;
1497  virtual OGRwkbGeometryType getSubGeometryType() const;
1498  OGRErr exportToWktInternal (char ** ppszDstText, OGRwkbVariant eWkbVariant,
1499  const char* pszSkipPrefix ) const;
1500 
1501  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1502  const;
1503  static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
1505 
1506  public:
1509  virtual ~OGRPolyhedralSurface();
1511 
1512  // IWks Interface.
1513  virtual int WkbSize() const CPL_OVERRIDE;
1514  virtual const char *getGeometryName() const CPL_OVERRIDE;
1516  virtual OGRErr importFromWkb( unsigned char *, int=-1,
1518  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1520  const CPL_OVERRIDE;
1521  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1522  virtual OGRErr exportToWkt( char ** ppszDstText,
1524  const CPL_OVERRIDE;
1525 
1526  // IGeometry methods.
1527  virtual int getDimension() const CPL_OVERRIDE;
1528 
1529  virtual void empty() CPL_OVERRIDE;
1530 
1531  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1532  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1533  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1534 
1535  virtual void flattenTo2D() CPL_OVERRIDE;
1537  virtual OGRBoolean Equals( OGRGeometry* ) const CPL_OVERRIDE;
1538  virtual double get_Area() const CPL_OVERRIDE;
1539  virtual OGRErr PointOnSurface( OGRPoint* ) const CPL_OVERRIDE;
1540 
1542  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1543  const CPL_OVERRIDE;
1544  virtual OGRErr addGeometry( const OGRGeometry * );
1545  OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
1546  int getNumGeometries() const;
1547  OGRGeometry* getGeometryRef(int i);
1548  const OGRGeometry* getGeometryRef(int i) const;
1549 
1550  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1551  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1552  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1553  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1554  virtual void swapXY() CPL_OVERRIDE;
1555  OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1556 };
1557 
1558 /************************************************************************/
1559 /* OGRTriangulatedSurface */
1560 /************************************************************************/
1561 
1569 {
1570  protected:
1572  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
1573  const CPL_OVERRIDE;
1574  virtual const char* getSubGeometryName() const CPL_OVERRIDE;
1575  virtual OGRwkbGeometryType getSubGeometryType() const CPL_OVERRIDE;
1576 
1577  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1578  const CPL_OVERRIDE;
1579  static OGRMultiPolygon *
1580  CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
1582 
1583  public:
1587 
1589  virtual const char *getGeometryName() const CPL_OVERRIDE;
1591 
1592  // IWks Interface.
1593  virtual OGRErr addGeometry( const OGRGeometry * ) CPL_OVERRIDE;
1594 
1595  static OGRPolyhedralSurface *
1596  CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
1597 };
1598 
1599 /************************************************************************/
1600 /* OGRMultiPoint */
1601 /************************************************************************/
1602 
1607 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
1608 {
1609  private:
1610  OGRErr importFromWkt_Bracketed( char **, int bHasM, int bHasZ );
1611 
1612  protected:
1614  const CPL_OVERRIDE;
1615 
1616  public:
1617  OGRMultiPoint();
1618  OGRMultiPoint(const OGRMultiPoint& other);
1619  virtual ~OGRMultiPoint();
1620 
1621  OGRMultiPoint& operator=(const OGRMultiPoint& other);
1622 
1623  // Non-standard (OGRGeometry).
1624  virtual const char *getGeometryName() const CPL_OVERRIDE;
1626  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1627  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1628  const CPL_OVERRIDE;
1629 
1630  // IGeometry methods.
1631  virtual int getDimension() const CPL_OVERRIDE;
1632 
1633  // Non-standard.
1634  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1635  const CPL_OVERRIDE;
1636 };
1637 
1638 /************************************************************************/
1639 /* OGRMultiCurve */
1640 /************************************************************************/
1641 
1648 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
1649 {
1650  protected:
1652  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1653  OGRCurve* poCurve );
1656  const CPL_OVERRIDE;
1657 
1658  public:
1659  OGRMultiCurve();
1660  OGRMultiCurve( const OGRMultiCurve& other );
1661  virtual ~OGRMultiCurve();
1662 
1663  OGRMultiCurve& operator=( const OGRMultiCurve& other );
1664 
1665  // Non standard (OGRGeometry).
1666  virtual const char *getGeometryName() const CPL_OVERRIDE;
1668  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1669  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1670  const CPL_OVERRIDE;
1671 
1672  // IGeometry methods.
1673  virtual int getDimension() const CPL_OVERRIDE;
1674 
1675  // Non-standard.
1676  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1677  const CPL_OVERRIDE;
1678 
1679  static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
1680 };
1681 
1682 /************************************************************************/
1683 /* OGRMultiLineString */
1684 /************************************************************************/
1685 
1690 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
1691 {
1692  protected:
1694  const CPL_OVERRIDE;
1695 
1696  public:
1698  OGRMultiLineString( const OGRMultiLineString& other );
1699  virtual ~OGRMultiLineString();
1700 
1702 
1703  // Non standard (OGRGeometry).
1704  virtual const char *getGeometryName() const CPL_OVERRIDE;
1706  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1707  const CPL_OVERRIDE;
1708 
1709  // Non standard
1710  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1711  const CPL_OVERRIDE;
1712 
1713  static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
1714 };
1715 
1716 /************************************************************************/
1717 /* OGRGeometryFactory */
1718 /************************************************************************/
1719 
1724 class CPL_DLL OGRGeometryFactory
1725 {
1726  static OGRErr createFromFgfInternal( unsigned char *pabyData,
1727  OGRSpatialReference * poSR,
1728  OGRGeometry **ppoReturn,
1729  int nBytes,
1730  int *pnBytesConsumed,
1731  int nRecLevel );
1732  public:
1733  static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
1734  OGRGeometry **, int = -1,
1736  static OGRErr createFromWkt( char **, OGRSpatialReference *,
1737  OGRGeometry ** );
1738  static OGRErr createFromFgf( unsigned char *, OGRSpatialReference *,
1739  OGRGeometry **, int = -1, int * = NULL );
1740  static OGRGeometry *createFromGML( const char * );
1741  static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
1742  GEOSGeom );
1743 
1744  static void destroyGeometry( OGRGeometry * );
1745  static OGRGeometry *createGeometry( OGRwkbGeometryType );
1746 
1747  static OGRGeometry * forceToPolygon( OGRGeometry * );
1748  static OGRGeometry * forceToLineString( OGRGeometry *,
1749  bool bOnlyInOrder = true );
1750  static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
1751  static OGRGeometry * forceToMultiPoint( OGRGeometry * );
1752  static OGRGeometry * forceToMultiLineString( OGRGeometry * );
1753 
1754  static OGRGeometry * forceTo( OGRGeometry* poGeom,
1755  OGRwkbGeometryType eTargetType,
1756  const char*const* papszOptions = NULL );
1757 
1758  static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
1759  int nPolygonCount,
1760  int *pbResultValidGeometry,
1761  const char **papszOptions = NULL);
1762  static bool haveGEOS();
1763 
1764  static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
1766  char** papszOptions );
1767 
1768  static OGRGeometry*
1769  approximateArcAngles( double dfX, double dfY, double dfZ,
1770  double dfPrimaryRadius, double dfSecondaryAxis,
1771  double dfRotation,
1772  double dfStartAngle, double dfEndAngle,
1773  double dfMaxAngleStepSizeDegrees );
1774 
1775  static int GetCurveParmeters( double x0, double y0,
1776  double x1, double y1,
1777  double x2, double y2,
1778  double& R, double& cx, double& cy,
1779  double& alpha0, double& alpha1,
1780  double& alpha2 );
1781  static OGRLineString* curveToLineString(
1782  double x0, double y0, double z0,
1783  double x1, double y1, double z1,
1784  double x2, double y2, double z2,
1785  int bHasZ,
1786  double dfMaxAngleStepSizeDegrees,
1787  const char* const * papszOptions = NULL );
1788  static OGRCurve* curveFromLineString(
1789  const OGRLineString* poLS,
1790  const char* const * papszOptions = NULL);
1791 };
1792 
1793 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
1794 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
1795 
1797 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
1800 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
1801 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
1802  const OGRGeometry* poOtherGeom );
1803 int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
1804  const OGRGeometry* poOtherGeom );
1805 
1806 #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:1936
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
OGRBoolean Is3D() const
Definition: ogr_geometry.h:185
virtual void set3D(OGRBoolean bIs3D)
Add or remove the Z coordinate dimension.
Definition: ogrgeometry.cpp:1045
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
y
Definition: ogr_geometry.h:59
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:623
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:3048
#define CPL_OVERRIDE
To be used in public headers only.
Definition: cpl_port.h:1048
double getY() const
Return y.
Definition: ogr_geometry.h:364
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:5706
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:1894
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:1724
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: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
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:327
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:813
Coordinate systems services.
double getM() const
Return m.
Definition: ogr_geometry.h:368
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:2683
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 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:1304
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:1433
int OGRHasPreparedGeometrySupport()
Returns if GEOS has prepared geometry support.
Definition: ogrgeometry.cpp:5736
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
Enumeration to describe byte order.
Definition: ogr_core.h:505
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:754
virtual void flattenTo2D()=0
Convert geometry to strictly 2D.
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:433
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:1293
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:242
Concrete representation of a closed ring.
Definition: ogr_geometry.h:684
void setM(double mIn)
Set m.
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:613
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 OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM IMultiSurface::get_PointOnSurface() method.
Definition: ogrmultisurface.cpp:298
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:1674
virtual int get_IsClosed() const
Return TRUE if curve is closed.
Definition: ogrcurve.cpp:95
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=NULL) const CPL_WARN_UNUSED_RESULT
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3116
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const
Returns whether a geometry of the specified geometry type can be a member of this collection...
Definition: ogrgeometrycollection.cpp:1293
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:1392
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:2257
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:277
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
Utility class to store a collection of curves.
Definition: ogr_geometry.h:907
Simple container for a position.
Definition: ogr_geometry.h:47
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:338
virtual void swapXY() CPL_OVERRIDE
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:726
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 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
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:429
Interface for a point iterator.
Definition: ogr_geometry.h:415
TriangulatedSurface class.
Definition: ogr_geometry.h:1568
A collection of OGRCurve.
Definition: ogr_geometry.h:1648
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:1015
A collection of OGRLineString.
Definition: ogr_geometry.h:1690
virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE
Return area of curve segments.
Definition: ogrcompoundcurve.cpp:870
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:804
double getZ() const
Return z.
Definition: ogr_geometry.h:366
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:375
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:2028
static OGRLinearRing * CastToLinearRing(OGRCurve *poCurve)
Cast to linear ring.
Definition: ogrcurve.cpp:408
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:5792
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:2340
OGRLineString & operator=(const OGRLineString &other)
Assignment operator.
Definition: ogrlinestring.cpp:2653
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)
Set z.
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:830
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:5814
Concrete class representing curve polygons.
Definition: ogr_geometry.h:1049
virtual OGRErr transform(OGRCoordinateTransformation *poCT) CPL_OVERRIDE
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:653
PolyhedralSurface class.
Definition: ogr_geometry.h:1485
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known binary format.
Definition: ogrlinestring.cpp:1580
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_OVERRIDE
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:801
virtual OGRErr importFromWkt(char **) CPL_OVERRIDE
Assign geometry from well known text data.
Definition: ogrgeometrycollection.cpp:788
void setY(double yIn)
Set y.
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
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:1797
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:446
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:5756
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:2237
virtual OGRErr addRingDirectly(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:397
Point class.
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
Output variants of WKB we support.
Definition: ogr_core.h:444
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:1470
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
double getX() const
Return x.
Definition: ogr_geometry.h:362
Concrete class representing polygons.
Definition: ogr_geometry.h:1160
Abstract curve base class for OGRLineString and OGRCircularString.
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
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:2461
virtual OGRBoolean Contains(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:4812
virtual OGRBoolean Equals(OGRGeometry *) const CPL_OVERRIDE
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:627
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:554
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:591
virtual int getNumPoints() const CPL_OVERRIDE
Return the number of points of a curve geometry.
Definition: ogrcompoundcurve.cpp:668
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:355
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:914
int OGRPreparedGeometryContains(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry contains a geometry.
Definition: ogrgeometry.cpp:5844
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const
Return a polygon from a curve polygon.
Definition: ogrcurvepolygon.cpp:553
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:1245
OGRPolygon & operator=(const OGRPolygon &other)
Assignment operator.
Definition: ogrpolygon.cpp:93
static OGRLineString * CastToLineString(OGRCurve *poCurve)
Cast to linestring.
Definition: ogrcurve.cpp:386
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:726
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrlinestring.cpp:1796
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:311
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 void setMeasured(OGRBoolean bIsMeasured) CPL_OVERRIDE
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:694
virtual OGRErr exportToWkt(char **, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrmultisurface.cpp:266
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition: ogrgeometry.cpp:2330
A collection of OGRPoint.
Definition: ogr_geometry.h:1607
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:812
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
virtual OGRBoolean IsConvex() const
Returns if a (closed) curve forms a convex shape.
Definition: ogrcurve.cpp:309
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
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:992
virtual void empty() CPL_OVERRIDE
Clear geometry information.
Definition: ogrcurvepolygon.cpp:132
OGRGeometry * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:936
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:555

Generated for GDAL by doxygen 1.8.8.