GDAL
ogr_geometry.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: ogr_geometry.h 40559 2017-10-26 20:10:58Z goatbar $
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 int IntersectsPoint( const OGRPoint* p ) const;
454  virtual double get_AreaOfCurveSegments() const = 0;
455 
456  public:
457  virtual ~OGRCurve();
458 
460  OGRCurve& operator=( const OGRCurve& other );
462 
463  // ICurve methods
464  virtual double get_Length() const = 0;
465  virtual void StartPoint( OGRPoint * ) const = 0;
466  virtual void EndPoint( OGRPoint * ) const = 0;
467  virtual int get_IsClosed() const;
468  virtual void Value( double, OGRPoint * ) const = 0;
469  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
470  const char* const* papszOptions = NULL)
471  const = 0;
472  virtual int getDimension() const CPL_OVERRIDE;
473 
474  // non standard
475  virtual int getNumPoints() const = 0;
476  virtual OGRPointIterator* getPointIterator() const = 0;
477  virtual OGRBoolean IsConvex() const;
478  virtual double get_Area() const = 0;
479 
480  static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
481  static OGRLineString* CastToLineString( OGRCurve* poCurve );
482  static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
483 };
484 
485 /************************************************************************/
486 /* OGRSimpleCurve */
487 /************************************************************************/
488 
498 class CPL_DLL OGRSimpleCurve: public OGRCurve
499 {
500  protected:
502  friend class OGRGeometry;
503 
504  int nPointCount;
505  OGRRawPoint *paoPoints;
506  double *padfZ;
507  double *padfM;
508 
509  void Make3D();
510  void Make2D();
511  void RemoveM();
512  void AddM();
513 
514  OGRErr importFromWKTListOnly( char ** ppszInput, int bHasZ, int bHasM,
515  OGRRawPoint*& paoPointsIn,
516  int& nMaxPoints,
517  double*& padfZIn );
518 
520 
521  virtual double get_LinearArea() const;
522 
523  OGRSimpleCurve();
524  OGRSimpleCurve( const OGRSimpleCurve& other );
525 
526  public:
527  virtual ~OGRSimpleCurve();
528 
529  OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
530 
531  // IWks Interface.
532  virtual int WkbSize() const CPL_OVERRIDE;
533  virtual OGRErr importFromWkb( const unsigned char *,
534  int,
536  int& nBytesConsumedOut ) CPL_OVERRIDE;
537  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
539  const CPL_OVERRIDE;
540  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
541  virtual OGRErr exportToWkt( char ** ppszDstText,
543  const CPL_OVERRIDE;
544 
545  // IGeometry interface.
546  virtual OGRGeometry *clone() const CPL_OVERRIDE;
547  virtual void empty() CPL_OVERRIDE;
548  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
549  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
550  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
551 
552  // ICurve methods.
553  virtual double get_Length() const CPL_OVERRIDE;
554  virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
555  virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
556  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
557  virtual double Project( const OGRPoint * ) const;
558  virtual OGRLineString* getSubLine( double, double, int ) const;
559 
560  // ILineString methods.
561  virtual int getNumPoints() const CPL_OVERRIDE { return nPointCount; }
562  void getPoint( int, OGRPoint * ) const;
563  double getX( int i ) const { return paoPoints[i].x; }
564  double getY( int i ) const { return paoPoints[i].y; }
565  double getZ( int i ) const;
566  double getM( int i ) const;
567 
568  // ISpatialRelation
569  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
570 
571  // non standard.
572  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
573  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
574  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
575  void setNumPoints( int nNewPointCount,
576  int bZeroizeNewContent = TRUE );
577  void setPoint( int, OGRPoint * );
578  void setPoint( int, double, double );
579  void setZ( int, double );
580  void setM( int, double );
581  void setPoint( int, double, double, double );
582  void setPointM( int, double, double, double );
583  void setPoint( int, double, double, double, double );
584  void setPoints( int, OGRRawPoint *, double * = NULL );
585  void setPointsM( int, OGRRawPoint *, double * );
586  void setPoints( int, OGRRawPoint *, double *, double * );
587  void setPoints( int, double * padfX, double * padfY,
588  double *padfZIn = NULL );
589  void setPointsM( int, double * padfX, double * padfY,
590  double *padfMIn = NULL );
591  void setPoints( int, double * padfX, double * padfY,
592  double *padfZIn, double *padfMIn );
593  void addPoint( const OGRPoint * );
594  void addPoint( double, double );
595  void addPoint( double, double, double );
596  void addPointM( double, double, double );
597  void addPoint( double, double, double, double );
598 
599  void getPoints( OGRRawPoint *, double * = NULL ) const;
600  void getPoints( void* pabyX, int nXStride,
601  void* pabyY, int nYStride,
602  void* pabyZ = NULL, int nZStride = 0 ) const;
603  void getPoints( void* pabyX, int nXStride,
604  void* pabyY, int nYStride,
605  void* pabyZ, int nZStride,
606  void* pabyM, int nMStride ) const;
607 
608  void addSubLineString( const OGRLineString *,
609  int nStartVertex = 0, int nEndVertex = -1 );
610  void reversePoints( void );
611  virtual OGRPointIterator* getPointIterator() const CPL_OVERRIDE;
612 
613  // non-standard from OGRGeometry
614  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
615  virtual void flattenTo2D() CPL_OVERRIDE;
616  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
617 
618  virtual void swapXY() CPL_OVERRIDE;
619 };
620 
621 /************************************************************************/
622 /* OGRLineString */
623 /************************************************************************/
624 
632 class CPL_DLL OGRLineString : public OGRSimpleCurve
633 {
634  static OGRLinearRing* CasterToLinearRing(OGRCurve* poCurve);
635 
636  protected:
638  static OGRLineString* TransferMembersAndDestroy(
639  OGRLineString* poSrc,
640  OGRLineString* poDst);
641 
642  virtual OGRCurveCasterToLineString GetCasterToLineString()
643  const CPL_OVERRIDE;
644  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
645  const CPL_OVERRIDE;
646 
647  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
649 
650  static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
651 
652  public:
653  OGRLineString();
654  OGRLineString( const OGRLineString& other );
655  virtual ~OGRLineString();
656 
657  OGRLineString& operator=(const OGRLineString& other);
658 
659  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
660  const char* const* papszOptions = NULL )
661  const CPL_OVERRIDE;
662  virtual OGRGeometry* getCurveGeometry(
663  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
664  virtual double get_Area() const CPL_OVERRIDE;
665 
666  // Non-standard from OGRGeometry.
668  virtual const char *getGeometryName() const CPL_OVERRIDE;
669 };
670 
671 /************************************************************************/
672 /* OGRLinearRing */
673 /************************************************************************/
674 
695 class CPL_DLL OGRLinearRing : public OGRLineString
696 {
697  static OGRLineString* CasterToLineString( OGRCurve* poCurve );
698 
699  protected:
701  friend class OGRPolygon;
702  friend class OGRTriangle;
703 
704  // These are not IWks compatible ... just a convenience for OGRPolygon.
705  virtual int _WkbSize( int _flags ) const;
706  virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
707  const unsigned char *, int,
708  int& nBytesConsumedOut );
709  virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
710  unsigned char * ) const;
711 
712  virtual OGRCurveCasterToLineString GetCasterToLineString()
713  const CPL_OVERRIDE;
714  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
715  const CPL_OVERRIDE;
717 
719 
720  public:
721  OGRLinearRing();
722  OGRLinearRing( const OGRLinearRing& other );
723  explicit OGRLinearRing( OGRLinearRing * );
724  virtual ~OGRLinearRing();
725 
726  OGRLinearRing& operator=( const OGRLinearRing& other );
727 
728  // Non standard.
729  virtual const char *getGeometryName() const CPL_OVERRIDE;
730  virtual OGRGeometry *clone() const CPL_OVERRIDE;
731  virtual int isClockwise() const;
732  virtual void reverseWindingOrder();
733  virtual void closeRings() CPL_OVERRIDE;
734  OGRBoolean isPointInRing( const OGRPoint* pt,
735  int bTestEnvelope = TRUE ) const;
736  OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
737  int bTestEnvelope = TRUE ) const;
739 
740  // IWks Interface - Note this isn't really a first class object
741  // for the purposes of WKB form. These methods always fail since this
742  // object can't be serialized on its own.
743  virtual int WkbSize() const CPL_OVERRIDE;
744  virtual OGRErr importFromWkb( const unsigned char *,
745  int,
747  int& nBytesConsumedOut ) CPL_OVERRIDE;
748  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
750  const CPL_OVERRIDE;
751 };
752 
753 /************************************************************************/
754 /* OGRCircularString */
755 /************************************************************************/
756 
769 class CPL_DLL OGRCircularString : public OGRSimpleCurve
770 {
771  private:
772  void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
773  OGRBoolean IsValidFast() const;
774  int IsFullCircle( double& cx, double& cy, double& square_R ) const;
775 
776  protected:
778  virtual OGRCurveCasterToLineString GetCasterToLineString()
779  const CPL_OVERRIDE;
780  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
781  const CPL_OVERRIDE;
782  virtual int IntersectsPoint( const OGRPoint* p ) const CPL_OVERRIDE;
783  virtual int ContainsPoint( const OGRPoint* p ) const CPL_OVERRIDE;
784  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
786 
787  public:
789  OGRCircularString(const OGRCircularString& other);
790  virtual ~OGRCircularString();
791 
793 
794  // IWks Interface.
795  virtual OGRErr importFromWkb( const unsigned char *,
796  int,
798  int& nBytesConsumedOut ) CPL_OVERRIDE;
799  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
801  const CPL_OVERRIDE;
802  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
803  virtual OGRErr exportToWkt( char ** ppszDstText,
805  const CPL_OVERRIDE;
806 
807  // IGeometry interface.
808  virtual OGRBoolean IsValid() const CPL_OVERRIDE;
809  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
810  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
811 
812  // ICurve methods.
813  virtual double get_Length() const CPL_OVERRIDE;
814  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
815  const char* const* papszOptions = NULL )
816  const CPL_OVERRIDE;
817  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
818  virtual double get_Area() const CPL_OVERRIDE;
819 
820  // Non-standard from OGRGeometry.
822  virtual const char *getGeometryName() const CPL_OVERRIDE;
823  virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
824  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
825  const CPL_OVERRIDE;
827  double dfMaxAngleStepSizeDegrees = 0,
828  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
829 };
830 
831 /************************************************************************/
832 /* OGRCurveCollection */
833 /************************************************************************/
834 
845 class CPL_DLL OGRCurveCollection
847 {
848  protected:
849  friend class OGRCompoundCurve;
850  friend class OGRCurvePolygon;
851  friend class OGRPolygon;
852  friend class OGRTriangle;
853 
854  int nCurveCount;
855  OGRCurve **papoCurves;
856 
857  public:
858  OGRCurveCollection();
859  OGRCurveCollection(const OGRCurveCollection& other);
860  ~OGRCurveCollection();
861 
862  OGRCurveCollection& operator=(const OGRCurveCollection& other);
863 
864  void empty(OGRGeometry* poGeom);
865  OGRBoolean IsEmpty() const;
866  void getEnvelope( OGREnvelope * psEnvelope ) const;
867  void getEnvelope( OGREnvelope3D * psEnvelope ) const;
868 
869  OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
870  int bNeedRealloc );
871  int WkbSize() const;
872  OGRErr importPreambuleFromWkb( OGRGeometry* poGeom,
873  const unsigned char * pabyData,
874  int& nSize,
875  int& nDataOffset,
876  OGRwkbByteOrder& eByteOrder,
877  int nMinSubGeomSize,
878  OGRwkbVariant eWkVariant );
879  OGRErr importBodyFromWkb(
880  OGRGeometry* poGeom,
881  const unsigned char * pabyData,
882  int nSize,
883  int bAcceptCompoundCurve,
884  OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
885  OGRCurve* poCurve ),
886  OGRwkbVariant eWkVariant,
887  int& nBytesConsumedOut );
888  OGRErr exportToWkt( const OGRGeometry* poGeom,
889  char ** ppszDstText ) const;
891  unsigned char *,
892  OGRwkbVariant eWkbVariant ) const;
893  OGRBoolean Equals(OGRCurveCollection *poOCC) const;
894  void setCoordinateDimension( OGRGeometry* poGeom,
895  int nNewDimension );
896  void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
897  void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
898  int getNumCurves() const;
899  OGRCurve *getCurve( int );
900  const OGRCurve *getCurve( int ) const;
901  OGRCurve *stealCurve( int );
902  OGRErr transform( OGRGeometry* poGeom,
904  void flattenTo2D( OGRGeometry* poGeom );
905  void segmentize( double dfMaxLength );
906  void swapXY();
907  OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
908 };
910 
911 /************************************************************************/
912 /* OGRCompoundCurve */
913 /************************************************************************/
914 
925 class CPL_DLL OGRCompoundCurve : public OGRCurve
926 {
927  private:
928  OGRCurveCollection oCC;
929 
930  OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
931  double dfToleranceEps,
932  int bNeedRealloc );
933  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
934  OGRCurve* poCurve );
935  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
936  OGRCurve* poCurve );
937  OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
938  const char* const* papszOptions,
939  int bIsLinearRing ) const;
940  static OGRLineString* CasterToLineString( OGRCurve* poCurve );
941  static OGRLinearRing* CasterToLinearRing( OGRCurve* poCurve );
942 
943  protected:
947 
948  virtual OGRCurveCasterToLineString GetCasterToLineString()
949  const CPL_OVERRIDE;
950  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
951  const CPL_OVERRIDE;
953 
954  public:
956  OGRCompoundCurve( const OGRCompoundCurve& other );
957  virtual ~OGRCompoundCurve();
958 
960 
961  // IWks Interface
962  virtual int WkbSize() const CPL_OVERRIDE;
963  virtual OGRErr importFromWkb( const unsigned char *,
964  int,
966  int& nBytesConsumedOut ) CPL_OVERRIDE;
967  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
969  const CPL_OVERRIDE;
970  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
971  virtual OGRErr exportToWkt( char ** ppszDstText,
973  const CPL_OVERRIDE;
974 
975  // IGeometry interface.
976  virtual OGRGeometry *clone() const CPL_OVERRIDE;
977  virtual void empty() CPL_OVERRIDE;
978  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
979  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
980  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
981 
982  // ICurve methods.
983  virtual double get_Length() const CPL_OVERRIDE;
984  virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
985  virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
986  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
987  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
988  const char* const* papszOptions = NULL )
989  const CPL_OVERRIDE;
990 
991  virtual int getNumPoints() const CPL_OVERRIDE;
992  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
993  virtual double get_Area() const CPL_OVERRIDE;
994 
995  // ISpatialRelation.
996  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
997 
998  // ICompoundCurve method.
999  int getNumCurves() const;
1000  OGRCurve *getCurve( int );
1001  const OGRCurve *getCurve( int ) const;
1002 
1003  // Non-standard.
1004  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1005  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1006  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1007 
1008  OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
1009  OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
1010  OGRCurve *stealCurve( int );
1012 
1013  // Non-standard from OGRGeometry.
1015  virtual const char *getGeometryName() const CPL_OVERRIDE;
1017  virtual void flattenTo2D() CPL_OVERRIDE;
1018  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
1019  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
1020  const CPL_OVERRIDE;
1021  virtual OGRGeometry* getLinearGeometry(
1022  double dfMaxAngleStepSizeDegrees = 0,
1023  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
1024 
1025  virtual void swapXY() CPL_OVERRIDE;
1026 };
1027 
1028 /************************************************************************/
1029 /* OGRSurface */
1030 /************************************************************************/
1031 
1037 class CPL_DLL OGRSurface : public OGRGeometry
1038 {
1039  protected:
1041  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1042  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1044 
1045  public:
1046  virtual double get_Area() const = 0;
1047  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const = 0;
1049  static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1050  static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1052 };
1053 
1054 /************************************************************************/
1055 /* OGRCurvePolygon */
1056 /************************************************************************/
1057 
1071 class CPL_DLL OGRCurvePolygon : public OGRSurface
1072 {
1073  static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1074 
1075  private:
1076  OGRBoolean IntersectsPoint( const OGRPoint* p ) const;
1077  OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1078  virtual int checkRing( OGRCurve * poNewRing ) const;
1079  OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1080  int bNeedRealloc );
1081  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1082  OGRCurve* poCurve );
1083  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1084  OGRCurve* poCurve );
1085 
1086  protected:
1088  friend class OGRPolygon;
1089  friend class OGRTriangle;
1090  OGRCurveCollection oCC;
1091 
1092  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1093  const CPL_OVERRIDE;
1094  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1095  const CPL_OVERRIDE;
1097 
1098  static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
1099 
1100  public:
1101  OGRCurvePolygon();
1102  OGRCurvePolygon( const OGRCurvePolygon& );
1103  virtual ~OGRCurvePolygon();
1104 
1105  OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
1106 
1107  // Non standard (OGRGeometry).
1108  virtual const char *getGeometryName() const CPL_OVERRIDE;
1110  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1111  virtual void empty() CPL_OVERRIDE;
1113  virtual void flattenTo2D() CPL_OVERRIDE;
1114  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1115  virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
1116  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1117  const CPL_OVERRIDE;
1118  virtual OGRGeometry* getLinearGeometry(
1119  double dfMaxAngleStepSizeDegrees = 0,
1120  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1121 
1122  // ISurface Interface
1123  virtual double get_Area() const CPL_OVERRIDE;
1124  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
1125 
1126  // IWks Interface
1127  virtual int WkbSize() const CPL_OVERRIDE;
1128  virtual OGRErr importFromWkb( const unsigned char *,
1129  int,
1130  OGRwkbVariant,
1131  int& nBytesConsumedOut ) CPL_OVERRIDE;
1132  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1134  const CPL_OVERRIDE;
1135  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1136  virtual OGRErr exportToWkt( char ** ppszDstText,
1137  OGRwkbVariant eWkbVariant = wkbVariantOldOgc )
1138  const CPL_OVERRIDE;
1139 
1140  // IGeometry
1141  virtual int getDimension() const CPL_OVERRIDE;
1142  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1143  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1144 
1145  // ICurvePolygon
1146  virtual OGRPolygon* CurvePolyToPoly(
1147  double dfMaxAngleStepSizeDegrees = 0,
1148  const char* const* papszOptions = NULL ) const;
1149 
1150  // ISpatialRelation
1151  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
1152  virtual OGRBoolean Intersects( const OGRGeometry * ) const CPL_OVERRIDE;
1153  virtual OGRBoolean Contains( const OGRGeometry * ) const CPL_OVERRIDE;
1154 
1155  // Non standard
1156  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1157  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1158  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1159 
1160  virtual OGRErr addRing( OGRCurve * );
1161  virtual OGRErr addRingDirectly( OGRCurve * );
1162 
1164  const OGRCurve *getExteriorRingCurve() const;
1165  int getNumInteriorRings() const;
1167  const OGRCurve *getInteriorRingCurve( int ) const;
1168 
1170 
1171  virtual void swapXY() CPL_OVERRIDE;
1172 };
1173 
1174 /************************************************************************/
1175 /* OGRPolygon */
1176 /************************************************************************/
1177 
1187 class CPL_DLL OGRPolygon : public OGRCurvePolygon
1188 {
1189  static OGRCurvePolygon* CasterToCurvePolygon(OGRSurface* poSurface);
1190 
1191  protected:
1193  friend class OGRMultiSurface;
1194  friend class OGRPolyhedralSurface;
1195  friend class OGRTriangulatedSurface;
1196 
1197  virtual int checkRing( OGRCurve * poNewRing ) const CPL_OVERRIDE;
1198  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1199  int bHasZ, int bHasM,
1200  OGRRawPoint*& paoPoints,
1201  int& nMaxPoints,
1202  double*& padfZ );
1203 
1204  static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
1205 
1206  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1207  const CPL_OVERRIDE;
1208  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1209  const CPL_OVERRIDE;
1211 
1212  public:
1213  OGRPolygon();
1214  OGRPolygon(const OGRPolygon& other);
1215  virtual ~OGRPolygon();
1216 
1217  OGRPolygon& operator=(const OGRPolygon& other);
1218 
1219  // Non-standard (OGRGeometry).
1220  virtual const char *getGeometryName() const CPL_OVERRIDE;
1222  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1223  const CPL_OVERRIDE;
1224  virtual OGRGeometry* getCurveGeometry(
1225  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1226  virtual OGRGeometry* getLinearGeometry(
1227  double dfMaxAngleStepSizeDegrees = 0,
1228  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
1229 
1230  // ISurface Interface.
1231  virtual OGRErr PointOnSurface( OGRPoint * poPoint )
1232  const CPL_OVERRIDE;
1233 
1234  // IWks Interface.
1235  virtual int WkbSize() const CPL_OVERRIDE;
1236  virtual OGRErr importFromWkb( const unsigned char *,
1237  int,
1238  OGRwkbVariant,
1239  int& nBytesConsumedOut ) CPL_OVERRIDE;
1240  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1242  const CPL_OVERRIDE;
1243  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1244  virtual OGRErr exportToWkt( char ** ppszDstText,
1246  const CPL_OVERRIDE;
1247 
1248  // ICurvePolygon.
1249  virtual OGRPolygon* CurvePolyToPoly(
1250  double dfMaxAngleStepSizeDegrees = 0,
1251  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1252 
1253  OGRLinearRing *getExteriorRing();
1254  const OGRLinearRing *getExteriorRing() const;
1255  virtual OGRLinearRing *getInteriorRing( int );
1256  virtual const OGRLinearRing *getInteriorRing( int ) const;
1257 
1258  OGRLinearRing *stealExteriorRing();
1259  virtual OGRLinearRing *stealInteriorRing(int);
1260 
1261  OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
1262 
1263  virtual void closeRings() CPL_OVERRIDE;
1264 };
1265 
1266 /************************************************************************/
1267 /* OGRTriangle */
1268 /************************************************************************/
1269 
1276 class CPL_DLL OGRTriangle : public OGRPolygon
1277 {
1278  private:
1279  static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1280  bool quickValidityCheck() const;
1281 
1282  protected:
1284  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const CPL_OVERRIDE;
1285  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1286  int bHasZ, int bHasM,
1287  OGRRawPoint*& paoPoints,
1288  int& nMaxPoints,
1289  double*& padfZ ) CPL_OVERRIDE;
1291 
1292  public:
1293  OGRTriangle();
1294  OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
1295  OGRTriangle( const OGRTriangle &other );
1296  OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
1297  OGRTriangle& operator=( const OGRTriangle& other );
1298  virtual ~OGRTriangle();
1299  virtual const char *getGeometryName() const CPL_OVERRIDE;
1301 
1302  // IWks Interface.
1303  virtual OGRErr importFromWkb( const unsigned char *,
1304  int,
1305  OGRwkbVariant,
1306  int& nBytesConsumedOut ) CPL_OVERRIDE;
1307 
1308  // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
1309  virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) CPL_OVERRIDE;
1310 
1312  static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
1314 };
1315 
1316 /************************************************************************/
1317 /* OGRGeometryCollection */
1318 /************************************************************************/
1319 
1327 class CPL_DLL OGRGeometryCollection : public OGRGeometry
1328 {
1329  OGRErr importFromWkbInternal( const unsigned char * pabyData,
1330  int nSize,
1331  int nRecLevel,
1332  OGRwkbVariant, int& nBytesConsumedOut );
1333  OGRErr importFromWktInternal( char **ppszInput, int nRecLevel );
1334 
1335  protected:
1337  int nGeomCount;
1338  OGRGeometry **papoGeoms;
1339 
1340  OGRErr exportToWktInternal( char ** ppszDstText,
1341  OGRwkbVariant eWkbVariant,
1342  const char* pszSkipPrefix ) const;
1343  static OGRGeometryCollection* TransferMembersAndDestroy(
1344  OGRGeometryCollection* poSrc,
1345  OGRGeometryCollection* poDst );
1347  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1348 
1349  public:
1352  virtual ~OGRGeometryCollection();
1353 
1355 
1356  // Non standard (OGRGeometry).
1357  virtual const char *getGeometryName() const CPL_OVERRIDE;
1359  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1360  virtual void empty() CPL_OVERRIDE;
1362  virtual void flattenTo2D() CPL_OVERRIDE;
1363  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1364  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
1365  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1366  const CPL_OVERRIDE;
1367  virtual OGRGeometry* getCurveGeometry(
1368  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1369  virtual OGRGeometry* getLinearGeometry(
1370  double dfMaxAngleStepSizeDegrees = 0,
1371  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1372 
1373  // IWks Interface
1374  virtual int WkbSize() const CPL_OVERRIDE;
1375  virtual OGRErr importFromWkb( const unsigned char *,
1376  int,
1377  OGRwkbVariant,
1378  int& nBytesConsumedOut ) CPL_OVERRIDE;
1379  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1381  const CPL_OVERRIDE;
1382  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1383  virtual OGRErr exportToWkt( char ** ppszDstText,
1385  const CPL_OVERRIDE;
1386 
1387  virtual double get_Length() const;
1388  virtual double get_Area() const;
1389 
1390  // IGeometry methods
1391  virtual int getDimension() const CPL_OVERRIDE;
1392  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1393  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1394 
1395  // IGeometryCollection
1396  int getNumGeometries() const;
1397  OGRGeometry *getGeometryRef( int );
1398  const OGRGeometry *getGeometryRef( int ) const;
1399 
1400  // ISpatialRelation
1401  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
1402 
1403  // Non standard
1404  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1405  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1406  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1407  virtual OGRErr addGeometry( const OGRGeometry * );
1408  virtual OGRErr addGeometryDirectly( OGRGeometry * );
1409  virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1410 
1411  void closeRings() CPL_OVERRIDE;
1412 
1413  virtual void swapXY() CPL_OVERRIDE;
1414 
1415  static OGRGeometryCollection* CastToGeometryCollection(
1416  OGRGeometryCollection* poSrc );
1417 };
1418 
1419 /************************************************************************/
1420 /* OGRMultiSurface */
1421 /************************************************************************/
1422 
1430 {
1431  protected:
1433  const CPL_OVERRIDE;
1434 
1435  public:
1436  OGRMultiSurface();
1437  OGRMultiSurface( const OGRMultiSurface& other );
1438  virtual ~OGRMultiSurface();
1439 
1440  OGRMultiSurface& operator=( const OGRMultiSurface& other );
1441 
1442  // Non standard (OGRGeometry).
1443  virtual const char *getGeometryName() const CPL_OVERRIDE;
1445  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1446  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1447  const CPL_OVERRIDE;
1448 
1449  // IMultiSurface methods
1450  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
1451 
1452  // IGeometry methods
1453  virtual int getDimension() const CPL_OVERRIDE;
1454 
1455  // Non standard
1456  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1457  const CPL_OVERRIDE;
1458 
1459  static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
1460 };
1461 
1462 /************************************************************************/
1463 /* OGRMultiPolygon */
1464 /************************************************************************/
1465 
1470 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
1471 {
1472  protected:
1474  const CPL_OVERRIDE;
1475  friend class OGRPolyhedralSurface;
1476  friend class OGRTriangulatedSurface;
1477 
1478  private:
1480  OGRErr _addGeometryWithExpectedSubGeometryType(
1481  const OGRGeometry * poNewGeom,
1482  OGRwkbGeometryType eSubGeometryType );
1483  OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
1484  OGRGeometry * poNewGeom,
1485  OGRwkbGeometryType eSubGeometryType );
1487 
1488 
1489  public:
1490  OGRMultiPolygon();
1491  OGRMultiPolygon(const OGRMultiPolygon& other);
1492  virtual ~OGRMultiPolygon();
1493 
1494  OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
1495 
1496  // Non-standard (OGRGeometry).
1497  virtual const char *getGeometryName() const CPL_OVERRIDE;
1499  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1500  const CPL_OVERRIDE;
1501 
1502  // IMultiSurface methods
1503  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
1504 
1505  // Non standard
1506  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1507  const CPL_OVERRIDE;
1508 
1509  static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
1510 };
1511 
1512 /************************************************************************/
1513 /* OGRPolyhedralSurface */
1514 /************************************************************************/
1515 
1522 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
1523 {
1524  protected:
1526  friend class OGRTriangulatedSurface;
1527  OGRMultiPolygon oMP;
1528  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1529  const CPL_OVERRIDE;
1530  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1531  const CPL_OVERRIDE;
1532  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1533  virtual const char* getSubGeometryName() const;
1534  virtual OGRwkbGeometryType getSubGeometryType() const;
1535  OGRErr exportToWktInternal (char ** ppszDstText, OGRwkbVariant eWkbVariant,
1536  const char* pszSkipPrefix ) const;
1537 
1538  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1539  const;
1540  static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
1542 
1543  public:
1546  virtual ~OGRPolyhedralSurface();
1548 
1549  // IWks Interface.
1550  virtual int WkbSize() const CPL_OVERRIDE;
1551  virtual const char *getGeometryName() const CPL_OVERRIDE;
1553  virtual OGRErr importFromWkb( const unsigned char *,
1554  int,
1555  OGRwkbVariant,
1556  int& nBytesConsumedOut ) CPL_OVERRIDE;
1557  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1559  const CPL_OVERRIDE;
1560  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1561  virtual OGRErr exportToWkt( char ** ppszDstText,
1563  const CPL_OVERRIDE;
1564 
1565  // IGeometry methods.
1566  virtual int getDimension() const CPL_OVERRIDE;
1567 
1568  virtual void empty() CPL_OVERRIDE;
1569 
1570  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1571  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1572  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1573 
1574  virtual void flattenTo2D() CPL_OVERRIDE;
1576  virtual OGRBoolean Equals( OGRGeometry* ) const CPL_OVERRIDE;
1577  virtual double get_Area() const CPL_OVERRIDE;
1578  virtual OGRErr PointOnSurface( OGRPoint* ) const CPL_OVERRIDE;
1579 
1581  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1582  const CPL_OVERRIDE;
1583  virtual OGRErr addGeometry( const OGRGeometry * );
1584  OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
1585  int getNumGeometries() const;
1586  OGRGeometry* getGeometryRef(int i);
1587  const OGRGeometry* getGeometryRef(int i) const;
1588 
1589  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1590  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1591  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1592  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1593  virtual void swapXY() CPL_OVERRIDE;
1594  OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1595 };
1596 
1597 /************************************************************************/
1598 /* OGRTriangulatedSurface */
1599 /************************************************************************/
1600 
1608 {
1609  protected:
1611  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
1612  const CPL_OVERRIDE;
1613  virtual const char* getSubGeometryName() const CPL_OVERRIDE;
1614  virtual OGRwkbGeometryType getSubGeometryType() const CPL_OVERRIDE;
1615 
1616  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1617  const CPL_OVERRIDE;
1618  static OGRMultiPolygon *
1619  CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
1621 
1622  public:
1626 
1628  virtual const char *getGeometryName() const CPL_OVERRIDE;
1630 
1631  // IWks Interface.
1632  virtual OGRErr addGeometry( const OGRGeometry * ) CPL_OVERRIDE;
1633 
1634  static OGRPolyhedralSurface *
1635  CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
1636 };
1637 
1638 /************************************************************************/
1639 /* OGRMultiPoint */
1640 /************************************************************************/
1641 
1646 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
1647 {
1648  private:
1649  OGRErr importFromWkt_Bracketed( char **, int bHasM, int bHasZ );
1650 
1651  protected:
1653  const CPL_OVERRIDE;
1654 
1655  public:
1656  OGRMultiPoint();
1657  OGRMultiPoint(const OGRMultiPoint& other);
1658  virtual ~OGRMultiPoint();
1659 
1660  OGRMultiPoint& operator=(const OGRMultiPoint& other);
1661 
1662  // Non-standard (OGRGeometry).
1663  virtual const char *getGeometryName() const CPL_OVERRIDE;
1665  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1666  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1667  const CPL_OVERRIDE;
1668 
1669  // IGeometry methods.
1670  virtual int getDimension() const CPL_OVERRIDE;
1671 
1672  // Non-standard.
1673  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1674  const CPL_OVERRIDE;
1675 };
1676 
1677 /************************************************************************/
1678 /* OGRMultiCurve */
1679 /************************************************************************/
1680 
1687 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
1688 {
1689  protected:
1691  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1692  OGRCurve* poCurve );
1695  const CPL_OVERRIDE;
1696 
1697  public:
1698  OGRMultiCurve();
1699  OGRMultiCurve( const OGRMultiCurve& other );
1700  virtual ~OGRMultiCurve();
1701 
1702  OGRMultiCurve& operator=( const OGRMultiCurve& other );
1703 
1704  // Non standard (OGRGeometry).
1705  virtual const char *getGeometryName() const CPL_OVERRIDE;
1707  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1708  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1709  const CPL_OVERRIDE;
1710 
1711  // IGeometry methods.
1712  virtual int getDimension() const CPL_OVERRIDE;
1713 
1714  // Non-standard.
1715  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1716  const CPL_OVERRIDE;
1717 
1718  static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
1719 };
1720 
1721 /************************************************************************/
1722 /* OGRMultiLineString */
1723 /************************************************************************/
1724 
1729 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
1730 {
1731  protected:
1733  const CPL_OVERRIDE;
1734 
1735  public:
1737  OGRMultiLineString( const OGRMultiLineString& other );
1738  virtual ~OGRMultiLineString();
1739 
1741 
1742  // Non standard (OGRGeometry).
1743  virtual const char *getGeometryName() const CPL_OVERRIDE;
1745  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1746  const CPL_OVERRIDE;
1747 
1748  // Non standard
1749  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1750  const CPL_OVERRIDE;
1751 
1752  static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
1753 };
1754 
1755 /************************************************************************/
1756 /* OGRGeometryFactory */
1757 /************************************************************************/
1758 
1763 class CPL_DLL OGRGeometryFactory
1764 {
1765  static OGRErr createFromFgfInternal( unsigned char *pabyData,
1766  OGRSpatialReference * poSR,
1767  OGRGeometry **ppoReturn,
1768  int nBytes,
1769  int *pnBytesConsumed,
1770  int nRecLevel );
1771  public:
1772  static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
1773  OGRGeometry **, int = -1,
1775  static OGRErr createFromWkb( const unsigned char * pabyData,
1777  OGRGeometry **,
1778  int nSize,
1779  OGRwkbVariant eVariant,
1780  int& nBytesConsumedOut );
1781 
1782  static OGRErr createFromWkt( char **, OGRSpatialReference *,
1783  OGRGeometry ** );
1784  static OGRErr createFromFgf( unsigned char *, OGRSpatialReference *,
1785  OGRGeometry **, int = -1, int * = NULL );
1786  static OGRGeometry *createFromGML( const char * );
1787  static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
1788  GEOSGeom );
1789 
1790  static void destroyGeometry( OGRGeometry * );
1791  static OGRGeometry *createGeometry( OGRwkbGeometryType );
1792 
1793  static OGRGeometry * forceToPolygon( OGRGeometry * );
1794  static OGRGeometry * forceToLineString( OGRGeometry *,
1795  bool bOnlyInOrder = true );
1796  static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
1797  static OGRGeometry * forceToMultiPoint( OGRGeometry * );
1798  static OGRGeometry * forceToMultiLineString( OGRGeometry * );
1799 
1800  static OGRGeometry * forceTo( OGRGeometry* poGeom,
1801  OGRwkbGeometryType eTargetType,
1802  const char*const* papszOptions = NULL );
1803 
1804  static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
1805  int nPolygonCount,
1806  int *pbResultValidGeometry,
1807  const char **papszOptions = NULL);
1808  static bool haveGEOS();
1809 
1810  static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
1812  char** papszOptions );
1813 
1814  static OGRGeometry*
1815  approximateArcAngles( double dfX, double dfY, double dfZ,
1816  double dfPrimaryRadius, double dfSecondaryAxis,
1817  double dfRotation,
1818  double dfStartAngle, double dfEndAngle,
1819  double dfMaxAngleStepSizeDegrees );
1820 
1821  static int GetCurveParmeters( double x0, double y0,
1822  double x1, double y1,
1823  double x2, double y2,
1824  double& R, double& cx, double& cy,
1825  double& alpha0, double& alpha1,
1826  double& alpha2 );
1827  static OGRLineString* curveToLineString(
1828  double x0, double y0, double z0,
1829  double x1, double y1, double z1,
1830  double x2, double y2, double z2,
1831  int bHasZ,
1832  double dfMaxAngleStepSizeDegrees,
1833  const char* const * papszOptions = NULL );
1834  static OGRCurve* curveFromLineString(
1835  const OGRLineString* poLS,
1836  const char* const * papszOptions = NULL);
1837 };
1838 
1839 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
1840 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
1841 
1843 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
1846 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
1847 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
1848  const OGRGeometry* poOtherGeom );
1849 int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
1850  const OGRGeometry* poOtherGeom );
1851 
1852 #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:320
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:1965
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:374
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:5020
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 int IntersectsPoint(const OGRPoint *p) const
Returns if a point intersects a (closed) curve.
Definition: ogrcurve.cpp:418
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:632
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:3098
#define CPL_OVERRIDE
To be used in public headers only.
Definition: cpl_port.h:1035
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:5756
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:1923
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:1763
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:842
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:2729
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:1470
int OGRHasPreparedGeometrySupport()
Returns if GEOS has prepared geometry support.
Definition: ogrgeometry.cpp:5786
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:1496
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:769
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:1327
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:242
Concrete representation of a closed ring.
Definition: ogr_geometry.h:695
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:624
OGRGeometry & operator=(const OGRGeometry &other)
Assignment operator.
Definition: ogrgeometry.cpp:141
virtual int getNumPoints() const CPL_OVERRIDE
Fetch vertex count.
Definition: ogr_geometry.h:561
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:1706
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:3166
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:1429
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:209
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:2307
OGRSimpleCurve & operator=(const OGRSimpleCurve &other)
Assignment operator.
Definition: ogrlinestring.cpp:113
virtual void segmentize(double dfMaxLength) CPL_OVERRIDE
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:724
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:925
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:738
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:1607
A collection of OGRCurve.
Definition: ogr_geometry.h:1687
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:1037
A collection of OGRLineString.
Definition: ogr_geometry.h:1729
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:5842
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:2369
OGRLineString & operator=(const OGRLineString &other)
Assignment operator.
Definition: ogrlinestring.cpp:2699
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:599
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:140
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:5864
Concrete class representing curve polygons.
Definition: ogr_geometry.h:1071
virtual OGRErr transform(OGRCoordinateTransformation *poCT) CPL_OVERRIDE
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:665
PolyhedralSurface class.
Definition: ogr_geometry.h:1522
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known binary format.
Definition: ogrlinestring.cpp:1612
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_OVERRIDE
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:813
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:715
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:134
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:1843
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:5806
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:584
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:2266
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:609
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:695
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:3131
double getX() const
Return x.
Definition: ogr_geometry.h:368
Concrete class representing polygons.
Definition: ogr_geometry.h:1187
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:498
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:2490
virtual OGRBoolean Contains(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:4862
virtual OGRBoolean Equals(OGRGeometry *) const CPL_OVERRIDE
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:639
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:563
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:610
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:5894
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:1276
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:1825
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:300
virtual void set3D(OGRBoolean bIs3D) CPL_OVERRIDE
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:701
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:619
virtual void setMeasured(OGRBoolean bIsMeasured) CPL_OVERRIDE
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:706
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:2380
A collection of OGRPoint.
Definition: ogr_geometry.h:1646
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:824
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:979
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:564

Generated for GDAL by doxygen 1.8.8.