GDAL
ogr_geometry.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: ogr_geometry.h 41245 2018-01-11 09:11:21Z bishop $
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 "cpl_json.h"
36 #include "ogr_core.h"
37 #include "ogr_spatialref.h"
38 
49 {
50  public:
52  OGRRawPoint() : x(0.0), y(0.0) {}
53 
55  OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn) {}
56 
58  double x;
60  double y;
61 };
62 
64 typedef struct GEOSGeom_t *GEOSGeom;
66 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
68 typedef void sfcgal_geometry_t;
69 
70 class OGRPoint;
71 class OGRCurve;
72 class OGRCompoundCurve;
73 class OGRLinearRing;
74 class OGRLineString;
75 class OGRSurface;
76 class OGRCurvePolygon;
77 class OGRPolygon;
78 class OGRMultiSurface;
79 class OGRMultiPolygon;
80 class OGRMultiCurve;
81 class OGRMultiLineString;
82 class OGRTriangle;
85 
87 typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
88 typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
89 
90 typedef OGRPolygon* (*OGRSurfaceCasterToPolygon)(OGRSurface*);
91 typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
92 typedef OGRMultiPolygon* (*OGRPolyhedralSurfaceCastToMultiPolygon)(OGRPolyhedralSurface*);
94 
95 /************************************************************************/
96 /* OGRGeometry */
97 /************************************************************************/
98 
119 class CPL_DLL OGRGeometry
120 {
121  private:
122  OGRSpatialReference * poSRS; // may be NULL
123 
124  protected:
126  friend class OGRCurveCollection;
127 
128  unsigned int flags;
129 
130  OGRErr importPreambuleFromWkt( char ** ppszInput,
131  int* pbHasZ, int* pbHasM,
132  bool* pbIsEmpty );
133  OGRErr importCurveCollectionFromWkt(
134  char ** ppszInput,
135  int bAllowEmptyComponent,
136  int bAllowLineString,
137  int bAllowCurve,
138  int bAllowCompoundCurve,
139  OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf,
140  OGRCurve* poCurve) );
141  OGRErr importPreambuleFromWkb( const unsigned char * pabyData,
142  int nSize,
143  OGRwkbByteOrder& eByteOrder,
144  OGRwkbVariant eWkbVariant );
145  OGRErr importPreambuleOfCollectionFromWkb(
146  const unsigned char * pabyData,
147  int& nSize,
148  int& nDataOffset,
149  OGRwkbByteOrder& eByteOrder,
150  int nMinSubGeomSize,
151  int& nGeomCount,
152  OGRwkbVariant eWkbVariant );
153  OGRErr PointOnSurfaceInternal( OGRPoint * poPoint ) const;
154  OGRBoolean IsSFCGALCompatible() const;
156 
157  public:
158 
159 /************************************************************************/
160 /* Bit flags for OGRGeometry */
161 /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
162 /* Do not use these outside of the core. */
163 /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
164 /************************************************************************/
165 
167  static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
168  static const unsigned int OGR_G_3D = 0x2;
169  static const unsigned int OGR_G_MEASURED = 0x4;
171 
172  OGRGeometry();
173  OGRGeometry( const OGRGeometry& other );
174  virtual ~OGRGeometry();
175 
176  OGRGeometry& operator=( const OGRGeometry& other );
177 
178  // Standard IGeometry.
179  virtual int getDimension() const = 0;
180  virtual int getCoordinateDimension() const;
181  int CoordinateDimension() const;
182  virtual OGRBoolean IsEmpty() const = 0;
183  virtual OGRBoolean IsValid() const;
184  virtual OGRBoolean IsSimple() const;
186  OGRBoolean Is3D() const { return flags & OGR_G_3D; }
188  OGRBoolean IsMeasured() const { return flags & OGR_G_MEASURED; }
189  virtual OGRBoolean IsRing() const;
190  virtual void empty() = 0;
191  virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
192  virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
193  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
194 
195  // IWks Interface.
196  virtual int WkbSize() const = 0;
197  OGRErr importFromWkb( unsigned char *, int=-1,
199  virtual OGRErr importFromWkb( const unsigned char *,
200  int,
202  int& nBytesConsumedOut ) = 0;
203  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
204  OGRwkbVariant=wkbVariantOldOgc ) const = 0;
205  virtual OGRErr importFromWkt( char ** ppszInput ) = 0;
206  virtual OGRErr exportToWkt( char ** ppszDstText,
207  OGRwkbVariant=wkbVariantOldOgc ) const = 0;
208 
209  // Non-standard.
210  virtual OGRwkbGeometryType getGeometryType() const = 0;
211  OGRwkbGeometryType getIsoGeometryType() const;
212  virtual const char *getGeometryName() const = 0;
213  virtual void dumpReadable( FILE *, const char * = nullptr
214  , char** papszOptions = nullptr ) const;
215  virtual void flattenTo2D() = 0;
216  virtual char * exportToGML( const char* const * papszOptions = nullptr ) const;
217  virtual char * exportToKML() const;
218  virtual char * exportToJson() const;
219 
220  static GEOSContextHandle_t createGEOSContext();
221  static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
222  virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
224  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
225  virtual OGRGeometry* getCurveGeometry(
226  const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
227  virtual OGRGeometry* getLinearGeometry(
228  double dfMaxAngleStepSizeDegrees = 0,
229  const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
230 
231  // SFCGAL interfacing methods.
233  static sfcgal_geometry_t* OGRexportToSFCGAL( OGRGeometry *poGeom );
234  static OGRGeometry* SFCGALexportToOGR( sfcgal_geometry_t* _geometry );
236  virtual void closeRings();
237 
238  virtual void setCoordinateDimension( int nDimension );
239  virtual void set3D( OGRBoolean bIs3D );
240  virtual void setMeasured( OGRBoolean bIsMeasured );
241 
242  virtual void assignSpatialReference( OGRSpatialReference * poSR );
243  OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
244 
245  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) = 0;
246  OGRErr transformTo( OGRSpatialReference *poSR );
247 
248  virtual void segmentize(double dfMaxLength);
249 
250  // ISpatialRelation
251  virtual OGRBoolean Intersects( const OGRGeometry * ) const;
252  virtual OGRBoolean Equals( OGRGeometry * ) const = 0;
253  virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
254  virtual OGRBoolean Touches( const OGRGeometry * ) const;
255  virtual OGRBoolean Crosses( const OGRGeometry * ) const;
256  virtual OGRBoolean Within( const OGRGeometry * ) const;
257  virtual OGRBoolean Contains( const OGRGeometry * ) const;
258  virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
259 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
260 // virtual OGRGeometry *LocateAlong( double mValue ) const;
261 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
262 
263  virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
264  virtual double Distance( const OGRGeometry * ) const ;
265  virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
266  virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
267  const CPL_WARN_UNUSED_RESULT;
268  virtual OGRGeometry *Intersection( const OGRGeometry *)
269  const CPL_WARN_UNUSED_RESULT;
270  virtual OGRGeometry *Union( const OGRGeometry * )
271  const CPL_WARN_UNUSED_RESULT;
272  virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
273  virtual OGRGeometry *Difference( const OGRGeometry * )
274  const CPL_WARN_UNUSED_RESULT;
275  virtual OGRGeometry *SymDifference( const OGRGeometry * )
276  const CPL_WARN_UNUSED_RESULT;
277  virtual OGRErr Centroid( OGRPoint * poPoint ) const;
278  virtual OGRGeometry *Simplify(double dTolerance)
279  const CPL_WARN_UNUSED_RESULT;
280  OGRGeometry *SimplifyPreserveTopology(double dTolerance)
281  const CPL_WARN_UNUSED_RESULT;
282  virtual OGRGeometry *DelaunayTriangulation(
283  double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
284 
285  virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
286 
287  virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
288 
290  // backward compatibility to non-standard method names.
291  OGRBoolean Intersect( OGRGeometry * )
292  const CPL_WARN_DEPRECATED("Non standard method. "
293  "Use Intersects() instead");
294  OGRBoolean Equal( OGRGeometry * )
295  const CPL_WARN_DEPRECATED("Non standard method. "
296  "Use Equals() instead");
297  OGRGeometry *SymmetricDifference( const OGRGeometry * )
298  const CPL_WARN_DEPRECATED("Non standard method. "
299  "Use SymDifference() instead");
300  OGRGeometry *getBoundary()
301  const CPL_WARN_DEPRECATED("Non standard method. "
302  "Use Boundary() instead");
304 
306  // Special HACK for DB2 7.2 support
307  static int bGenerate_DB2_V72_BYTE_ORDER;
309 
310  virtual void swapXY();
312  static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
313  static OGRGeometry* CastToError( OGRGeometry* poGeom );
315 };
316 
317 /************************************************************************/
318 /* OGRPoint */
319 /************************************************************************/
320 
327 class CPL_DLL OGRPoint : public OGRGeometry
328 {
329  double x;
330  double y;
331  double z;
332  double m;
333 
334  public:
335  OGRPoint();
336  OGRPoint( double x, double y );
337  OGRPoint( double x, double y, double z );
338  OGRPoint( double x, double y, double z, double m );
339  OGRPoint( const OGRPoint& other );
340  ~OGRPoint() override;
341 
342  OGRPoint& operator=( const OGRPoint& other );
343 
344  // IWks Interface
345  int WkbSize() const override;
346  OGRErr importFromWkb( const unsigned char *,
347  int,
349  int& nBytesConsumedOut ) override;
350  OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
352  const override;
353  OGRErr importFromWkt( char ** ) override;
354  OGRErr exportToWkt( char ** ppszDstText,
356  const override;
357 
358  // IGeometry
359  virtual int getDimension() const override;
360  virtual OGRGeometry *clone() const override;
361  virtual void empty() override;
362  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
363  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
364  virtual OGRBoolean IsEmpty() const override
365  { return !(flags & OGR_G_NOT_EMPTY_POINT); }
366 
367  // IPoint
369  double getX() const { return x; }
371  double getY() const { return y; }
373  double getZ() const { return z; }
375  double getM() const { return m; }
376 
377  // Non standard
378  virtual void setCoordinateDimension( int nDimension ) override;
382  void setX( double xIn ) { x = xIn; flags |= OGR_G_NOT_EMPTY_POINT; }
386  void setY( double yIn ) { y = yIn; flags |= OGR_G_NOT_EMPTY_POINT; }
390  void setZ( double zIn )
391  { z = zIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_3D); }
395  void setM( double mIn )
396  { m = mIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_MEASURED); }
397 
398  // ISpatialRelation
399  virtual OGRBoolean Equals( OGRGeometry * ) const override;
400  virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
401  virtual OGRBoolean Within( const OGRGeometry * ) const override;
402 
403  // Non standard from OGRGeometry
404  virtual const char *getGeometryName() const override;
405  virtual OGRwkbGeometryType getGeometryType() const override;
406  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
407  virtual void flattenTo2D() override;
408 
409  virtual void swapXY() override;
410 };
411 
412 /************************************************************************/
413 /* OGRPointIterator */
414 /************************************************************************/
415 
422 class CPL_DLL OGRPointIterator
423 {
424  public:
425  virtual ~OGRPointIterator();
426  virtual OGRBoolean getNextPoint( OGRPoint* p ) = 0;
427 
428  static void destroy( OGRPointIterator* );
429 };
430 
431 /************************************************************************/
432 /* OGRCurve */
433 /************************************************************************/
434 
440 class CPL_DLL OGRCurve : public OGRGeometry
441 {
442  protected:
444  OGRCurve();
445  OGRCurve( const OGRCurve& other );
446 
447  virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
448  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
449 
450  friend class OGRCurvePolygon;
451  friend class OGRCompoundCurve;
453  virtual int ContainsPoint( const OGRPoint* p ) const;
454  virtual int IntersectsPoint( const OGRPoint* p ) const;
455  virtual double get_AreaOfCurveSegments() const = 0;
456 
457  public:
458  ~OGRCurve() override;
459 
461  OGRCurve& operator=( const OGRCurve& other );
463 
464  // ICurve methods
465  virtual double get_Length() const = 0;
466  virtual void StartPoint( OGRPoint * ) const = 0;
467  virtual void EndPoint( OGRPoint * ) const = 0;
468  virtual int get_IsClosed() const;
469  virtual void Value( double, OGRPoint * ) const = 0;
470  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
471  const char* const* papszOptions = nullptr)
472  const = 0;
473  virtual int getDimension() const override;
474 
475  // non standard
476  virtual int getNumPoints() const = 0;
477  virtual OGRPointIterator* getPointIterator() const = 0;
478  virtual OGRBoolean IsConvex() const;
479  virtual double get_Area() const = 0;
480 
481  static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
482  static OGRLineString* CastToLineString( OGRCurve* poCurve );
483  static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
484 };
485 
486 /************************************************************************/
487 /* OGRSimpleCurve */
488 /************************************************************************/
489 
499 class CPL_DLL OGRSimpleCurve: public OGRCurve
500 {
501  protected:
503  friend class OGRGeometry;
504 
505  int nPointCount;
506  OGRRawPoint *paoPoints;
507  double *padfZ;
508  double *padfM;
509 
510  void Make3D();
511  void Make2D();
512  void RemoveM();
513  void AddM();
514 
515  OGRErr importFromWKTListOnly( char ** ppszInput, int bHasZ, int bHasM,
516  OGRRawPoint*& paoPointsIn,
517  int& nMaxPoints,
518  double*& padfZIn );
519 
521 
522  virtual double get_LinearArea() const;
523 
524  OGRSimpleCurve();
525  OGRSimpleCurve( const OGRSimpleCurve& other );
526 
527  public:
528  ~OGRSimpleCurve() override;
529 
530  OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
531 
532  // IWks Interface.
533  virtual int WkbSize() const override;
534  virtual OGRErr importFromWkb( const unsigned char *,
535  int,
537  int& nBytesConsumedOut ) override;
538  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
540  const override;
541  virtual OGRErr importFromWkt( char ** ) override;
542  virtual OGRErr exportToWkt( char ** ppszDstText,
544  const override;
545 
546  // IGeometry interface.
547  virtual OGRGeometry *clone() const override;
548  virtual void empty() override;
549  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
550  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
551  virtual OGRBoolean IsEmpty() const override;
552 
553  // ICurve methods.
554  virtual double get_Length() const override;
555  virtual void StartPoint( OGRPoint * ) const override;
556  virtual void EndPoint( OGRPoint * ) const override;
557  virtual void Value( double, OGRPoint * ) const override;
558  virtual double Project( const OGRPoint * ) const;
559  virtual OGRLineString* getSubLine( double, double, int ) const;
560 
561  // ILineString methods.
562  virtual int getNumPoints() const override { return nPointCount; }
563  void getPoint( int, OGRPoint * ) const;
564  double getX( int i ) const { return paoPoints[i].x; }
565  double getY( int i ) const { return paoPoints[i].y; }
566  double getZ( int i ) const;
567  double getM( int i ) const;
568 
569  // ISpatialRelation
570  virtual OGRBoolean Equals( OGRGeometry * ) const override;
571 
572  // non standard.
573  virtual void setCoordinateDimension( int nDimension ) override;
574  virtual void set3D( OGRBoolean bIs3D ) override;
575  virtual void setMeasured( OGRBoolean bIsMeasured ) override;
576  void setNumPoints( int nNewPointCount,
577  int bZeroizeNewContent = TRUE );
578  void setPoint( int, OGRPoint * );
579  void setPoint( int, double, double );
580  void setZ( int, double );
581  void setM( int, double );
582  void setPoint( int, double, double, double );
583  void setPointM( int, double, double, double );
584  void setPoint( int, double, double, double, double );
585  void setPoints( int, OGRRawPoint *, double * = nullptr );
586  void setPointsM( int, OGRRawPoint *, double * );
587  void setPoints( int, OGRRawPoint *, double *, double * );
588  void setPoints( int, double * padfX, double * padfY,
589  double *padfZIn = nullptr );
590  void setPointsM( int, double * padfX, double * padfY,
591  double *padfMIn = nullptr );
592  void setPoints( int, double * padfX, double * padfY,
593  double *padfZIn, double *padfMIn );
594  void addPoint( const OGRPoint * );
595  void addPoint( double, double );
596  void addPoint( double, double, double );
597  void addPointM( double, double, double );
598  void addPoint( double, double, double, double );
599 
600  void getPoints( OGRRawPoint *, double * = nullptr ) const;
601  void getPoints( void* pabyX, int nXStride,
602  void* pabyY, int nYStride,
603  void* pabyZ = nullptr, int nZStride = 0 ) const;
604  void getPoints( void* pabyX, int nXStride,
605  void* pabyY, int nYStride,
606  void* pabyZ, int nZStride,
607  void* pabyM, int nMStride ) const;
608 
609  void addSubLineString( const OGRLineString *,
610  int nStartVertex = 0, int nEndVertex = -1 );
611  void reversePoints( void );
612  virtual OGRPointIterator* getPointIterator() const override;
613 
614  // non-standard from OGRGeometry
615  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
616  virtual void flattenTo2D() override;
617  virtual void segmentize(double dfMaxLength) override;
618 
619  virtual void swapXY() override;
620 };
621 
622 /************************************************************************/
623 /* OGRLineString */
624 /************************************************************************/
625 
633 class CPL_DLL OGRLineString : public OGRSimpleCurve
634 {
635  static OGRLinearRing* CasterToLinearRing(OGRCurve* poCurve);
636 
637  protected:
639  static OGRLineString* TransferMembersAndDestroy(
640  OGRLineString* poSrc,
641  OGRLineString* poDst);
642 
643  virtual OGRCurveCasterToLineString GetCasterToLineString()
644  const override;
645  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
646  const override;
647 
648  virtual double get_AreaOfCurveSegments() const override;
650 
652 
653  public:
654  OGRLineString();
655  OGRLineString( const OGRLineString& other );
656  ~OGRLineString() override;
657 
658  OGRLineString& operator=(const OGRLineString& other);
659 
660  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
661  const char* const* papszOptions = nullptr )
662  const override;
663  virtual OGRGeometry* getCurveGeometry(
664  const char* const* papszOptions = nullptr ) const override;
665  virtual double get_Area() const override;
666 
667  // Non-standard from OGRGeometry.
668  virtual OGRwkbGeometryType getGeometryType() const override;
669  virtual const char *getGeometryName() const override;
670 };
671 
672 /************************************************************************/
673 /* OGRLinearRing */
674 /************************************************************************/
675 
696 class CPL_DLL OGRLinearRing : public OGRLineString
697 {
698  static OGRLineString* CasterToLineString( OGRCurve* poCurve );
699 
700  protected:
702  friend class OGRPolygon;
703  friend class OGRTriangle;
704 
705  // These are not IWks compatible ... just a convenience for OGRPolygon.
706  virtual int _WkbSize( int _flags ) const;
707  virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
708  const unsigned char *, int,
709  int& nBytesConsumedOut );
710  virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
711  unsigned char * ) const;
712 
713  virtual OGRCurveCasterToLineString GetCasterToLineString()
714  const override;
715  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
716  const override;
718 
720 
721  public:
722  OGRLinearRing();
723  OGRLinearRing( const OGRLinearRing& other );
724  explicit OGRLinearRing( OGRLinearRing * );
725  ~OGRLinearRing() override;
726 
727  OGRLinearRing& operator=( const OGRLinearRing& other );
728 
729  // Non standard.
730  virtual const char *getGeometryName() const override;
731  virtual OGRGeometry *clone() const override;
732  virtual int isClockwise() const;
733  virtual void reverseWindingOrder();
734  virtual void closeRings() override;
735  OGRBoolean isPointInRing( const OGRPoint* pt,
736  int bTestEnvelope = TRUE ) const;
737  OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
738  int bTestEnvelope = TRUE ) const;
739  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
740 
741  // IWks Interface - Note this isn't really a first class object
742  // for the purposes of WKB form. These methods always fail since this
743  // object can't be serialized on its own.
744  virtual int WkbSize() const override;
745  virtual OGRErr importFromWkb( const unsigned char *,
746  int,
748  int& nBytesConsumedOut ) override;
749  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
751  const override;
752 };
753 
754 /************************************************************************/
755 /* OGRCircularString */
756 /************************************************************************/
757 
770 class CPL_DLL OGRCircularString : public OGRSimpleCurve
771 {
772  private:
773  void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
774  OGRBoolean IsValidFast() const;
775  int IsFullCircle( double& cx, double& cy, double& square_R ) const;
776 
777  protected:
779  virtual OGRCurveCasterToLineString GetCasterToLineString()
780  const override;
781  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
782  const override;
783  virtual int IntersectsPoint( const OGRPoint* p ) const override;
784  virtual int ContainsPoint( const OGRPoint* p ) const override;
785  virtual double get_AreaOfCurveSegments() const override;
787 
788  public:
790  OGRCircularString( const OGRCircularString& other );
791  ~OGRCircularString() override;
792 
794 
795  // IWks Interface.
796  virtual OGRErr importFromWkb( const unsigned char *,
797  int,
799  int& nBytesConsumedOut ) override;
800  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
802  const override;
803  virtual OGRErr importFromWkt( char ** ) override;
804  virtual OGRErr exportToWkt( char ** ppszDstText,
806  const override;
807 
808  // IGeometry interface.
809  virtual OGRBoolean IsValid() const override;
810  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
811  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
812 
813  // ICurve methods.
814  virtual double get_Length() const override;
815  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
816  const char* const* papszOptions = nullptr )
817  const override;
818  virtual void Value( double, OGRPoint * ) const override;
819  virtual double get_Area() const override;
820 
821  // Non-standard from OGRGeometry.
822  virtual OGRwkbGeometryType getGeometryType() const override;
823  virtual const char *getGeometryName() const override;
824  virtual void segmentize( double dfMaxLength ) override;
825  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
826  const override;
828  double dfMaxAngleStepSizeDegrees = 0,
829  const char* const* papszOptions = nullptr) const override;
830 };
831 
832 /************************************************************************/
833 /* OGRCurveCollection */
834 /************************************************************************/
835 
846 class CPL_DLL OGRCurveCollection
848 {
849  protected:
850  friend class OGRCompoundCurve;
851  friend class OGRCurvePolygon;
852  friend class OGRPolygon;
853  friend class OGRTriangle;
854 
855  int nCurveCount;
856  OGRCurve **papoCurves;
857 
858  public:
859  OGRCurveCollection();
860  OGRCurveCollection(const OGRCurveCollection& other);
861  ~OGRCurveCollection();
862 
863  OGRCurveCollection& operator=(const OGRCurveCollection& other);
864 
865  void empty(OGRGeometry* poGeom);
866  OGRBoolean IsEmpty() const;
867  void getEnvelope( OGREnvelope * psEnvelope ) const;
868  void getEnvelope( OGREnvelope3D * psEnvelope ) const;
869 
870  OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
871  int bNeedRealloc );
872  int WkbSize() const;
873  OGRErr importPreambuleFromWkb( OGRGeometry* poGeom,
874  const unsigned char * pabyData,
875  int& nSize,
876  int& nDataOffset,
877  OGRwkbByteOrder& eByteOrder,
878  int nMinSubGeomSize,
879  OGRwkbVariant eWkVariant );
880  OGRErr importBodyFromWkb(
881  OGRGeometry* poGeom,
882  const unsigned char * pabyData,
883  int nSize,
884  int bAcceptCompoundCurve,
885  OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
886  OGRCurve* poCurve ),
887  OGRwkbVariant eWkVariant,
888  int& nBytesConsumedOut );
889  OGRErr exportToWkt( const OGRGeometry* poGeom,
890  char ** ppszDstText ) const;
892  unsigned char *,
893  OGRwkbVariant eWkbVariant ) const;
894  OGRBoolean Equals(OGRCurveCollection *poOCC) const;
895  void setCoordinateDimension( OGRGeometry* poGeom,
896  int nNewDimension );
897  void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
898  void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
900  int getNumCurves() const;
901  OGRCurve *getCurve( int );
902  const OGRCurve *getCurve( int ) const;
903  OGRCurve *stealCurve( int );
904  OGRErr transform( OGRGeometry* poGeom,
906  void flattenTo2D( OGRGeometry* poGeom );
907  void segmentize( double dfMaxLength );
908  void swapXY();
909  OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
910 };
912 
913 /************************************************************************/
914 /* OGRCompoundCurve */
915 /************************************************************************/
916 
927 class CPL_DLL OGRCompoundCurve : public OGRCurve
928 {
929  private:
930  OGRCurveCollection oCC;
931 
932  OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
933  double dfToleranceEps,
934  int bNeedRealloc );
935  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
936  OGRCurve* poCurve );
937  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
938  OGRCurve* poCurve );
939  OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
940  const char* const* papszOptions,
941  int bIsLinearRing ) const;
942  static OGRLineString* CasterToLineString( OGRCurve* poCurve );
943  static OGRLinearRing* CasterToLinearRing( OGRCurve* poCurve );
944 
945  protected:
949 
950  virtual OGRCurveCasterToLineString GetCasterToLineString()
951  const override;
952  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
953  const override;
955 
956  public:
958  OGRCompoundCurve( const OGRCompoundCurve& other );
959  ~OGRCompoundCurve() override;
960 
962 
963  // IWks Interface
964  virtual int WkbSize() const override;
965  virtual OGRErr importFromWkb( const unsigned char *,
966  int,
968  int& nBytesConsumedOut ) override;
969  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
971  const override;
972  virtual OGRErr importFromWkt( char ** ) override;
973  virtual OGRErr exportToWkt( char ** ppszDstText,
975  const override;
976 
977  // IGeometry interface.
978  virtual OGRGeometry *clone() const override;
979  virtual void empty() override;
980  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
981  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
982  virtual OGRBoolean IsEmpty() const override;
983 
984  // ICurve methods.
985  virtual double get_Length() const override;
986  virtual void StartPoint( OGRPoint * ) const override;
987  virtual void EndPoint( OGRPoint * ) const override;
988  virtual void Value( double, OGRPoint * ) const override;
989  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
990  const char* const* papszOptions = nullptr )
991  const override;
992 
993  virtual int getNumPoints() const override;
994  virtual double get_AreaOfCurveSegments() const override;
995  virtual double get_Area() const override;
996 
997  // ISpatialRelation.
998  virtual OGRBoolean Equals( OGRGeometry * ) const override;
999 
1000  // ICompoundCurve method.
1001  int getNumCurves() const;
1002  OGRCurve *getCurve( int );
1003  const OGRCurve *getCurve( int ) const;
1004 
1005  // Non-standard.
1006  virtual void setCoordinateDimension( int nDimension ) override;
1007  virtual void set3D( OGRBoolean bIs3D ) override;
1008  virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1009 
1010  virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1011 
1012  OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
1013  OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
1014  OGRCurve *stealCurve( int );
1015  virtual OGRPointIterator* getPointIterator() const override;
1016 
1017  // Non-standard from OGRGeometry.
1018  virtual OGRwkbGeometryType getGeometryType() const override;
1019  virtual const char *getGeometryName() const override;
1020  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1021  virtual void flattenTo2D() override;
1022  virtual void segmentize(double dfMaxLength) override;
1023  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
1024  const override;
1025  virtual OGRGeometry* getLinearGeometry(
1026  double dfMaxAngleStepSizeDegrees = 0,
1027  const char* const* papszOptions = nullptr) const override;
1028 
1029  virtual void swapXY() override;
1030 };
1031 
1032 /************************************************************************/
1033 /* OGRSurface */
1034 /************************************************************************/
1035 
1041 class CPL_DLL OGRSurface : public OGRGeometry
1042 {
1043  protected:
1045  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1046  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1048 
1049  public:
1050  virtual double get_Area() const = 0;
1051  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const = 0;
1053  static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1054  static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1056 };
1057 
1058 /************************************************************************/
1059 /* OGRCurvePolygon */
1060 /************************************************************************/
1061 
1075 class CPL_DLL OGRCurvePolygon : public OGRSurface
1076 {
1077  static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1078 
1079  private:
1080  OGRBoolean IntersectsPoint( const OGRPoint* p ) const;
1081  OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1082  virtual int checkRing( OGRCurve * poNewRing ) const;
1083  OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1084  int bNeedRealloc );
1085  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1086  OGRCurve* poCurve );
1087  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1088  OGRCurve* poCurve );
1089 
1090  protected:
1092  friend class OGRPolygon;
1093  friend class OGRTriangle;
1094  OGRCurveCollection oCC;
1095 
1096  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1097  const override;
1098  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1099  const override;
1101 
1102  static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
1103 
1104  public:
1105  OGRCurvePolygon();
1106  OGRCurvePolygon( const OGRCurvePolygon& );
1107  ~OGRCurvePolygon() override;
1108 
1109  OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
1110 
1111  // Non standard (OGRGeometry).
1112  virtual const char *getGeometryName() const override;
1113  virtual OGRwkbGeometryType getGeometryType() const override;
1114  virtual OGRGeometry *clone() const override;
1115  virtual void empty() override;
1116  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1117  virtual void flattenTo2D() override;
1118  virtual OGRBoolean IsEmpty() const override;
1119  virtual void segmentize( double dfMaxLength ) override;
1120  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1121  const override;
1122  virtual OGRGeometry* getLinearGeometry(
1123  double dfMaxAngleStepSizeDegrees = 0,
1124  const char* const* papszOptions = nullptr ) const override;
1125 
1126  // ISurface Interface
1127  virtual double get_Area() const override;
1128  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const override;
1129 
1130  // IWks Interface
1131  virtual int WkbSize() const override;
1132  virtual OGRErr importFromWkb( const unsigned char *,
1133  int,
1134  OGRwkbVariant,
1135  int& nBytesConsumedOut ) override;
1136  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1138  const override;
1139  virtual OGRErr importFromWkt( char ** ) override;
1140  virtual OGRErr exportToWkt( char ** ppszDstText,
1141  OGRwkbVariant eWkbVariant = wkbVariantOldOgc )
1142  const override;
1143 
1144  // IGeometry
1145  virtual int getDimension() const override;
1146  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1147  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1148 
1149  // ICurvePolygon
1150  virtual OGRPolygon* CurvePolyToPoly(
1151  double dfMaxAngleStepSizeDegrees = 0,
1152  const char* const* papszOptions = nullptr ) const;
1153 
1154  // ISpatialRelation
1155  virtual OGRBoolean Equals( OGRGeometry * ) const override;
1156  virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
1157  virtual OGRBoolean Contains( const OGRGeometry * ) const override;
1158 
1159  // Non standard
1160  virtual void setCoordinateDimension( int nDimension ) override;
1161  virtual void set3D( OGRBoolean bIs3D ) override;
1162  virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1163 
1164  virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1165 
1166  virtual OGRErr addRing( OGRCurve * );
1167  virtual OGRErr addRingDirectly( OGRCurve * );
1168 
1170  const OGRCurve *getExteriorRingCurve() const;
1171  int getNumInteriorRings() const;
1173  const OGRCurve *getInteriorRingCurve( int ) const;
1174 
1176 
1177  virtual void swapXY() override;
1178 };
1179 
1180 /************************************************************************/
1181 /* OGRPolygon */
1182 /************************************************************************/
1183 
1193 class CPL_DLL OGRPolygon : public OGRCurvePolygon
1194 {
1195  static OGRCurvePolygon* CasterToCurvePolygon(OGRSurface* poSurface);
1196 
1197  protected:
1199  friend class OGRMultiSurface;
1200  friend class OGRPolyhedralSurface;
1201  friend class OGRTriangulatedSurface;
1202 
1203  virtual int checkRing( OGRCurve * poNewRing ) const override;
1204  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1205  int bHasZ, int bHasM,
1206  OGRRawPoint*& paoPoints,
1207  int& nMaxPoints,
1208  double*& padfZ );
1209 
1210  static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
1211 
1212  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1213  const override;
1214  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1215  const override;
1217 
1218  public:
1219  OGRPolygon();
1220  OGRPolygon(const OGRPolygon& other);
1221  ~OGRPolygon() override;
1222 
1223  OGRPolygon& operator=(const OGRPolygon& other);
1224 
1225  // Non-standard (OGRGeometry).
1226  virtual const char *getGeometryName() const override;
1227  virtual OGRwkbGeometryType getGeometryType() const override;
1228  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1229  const override;
1230  virtual OGRGeometry* getCurveGeometry(
1231  const char* const* papszOptions = nullptr ) const override;
1232  virtual OGRGeometry* getLinearGeometry(
1233  double dfMaxAngleStepSizeDegrees = 0,
1234  const char* const* papszOptions = nullptr) const override;
1235 
1236  // ISurface Interface.
1237  virtual OGRErr PointOnSurface( OGRPoint * poPoint )
1238  const override;
1239 
1240  // IWks Interface.
1241  virtual int WkbSize() const override;
1242  virtual OGRErr importFromWkb( const unsigned char *,
1243  int,
1244  OGRwkbVariant,
1245  int& nBytesConsumedOut ) override;
1246  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1248  const override;
1249  virtual OGRErr importFromWkt( char ** ) override;
1250  virtual OGRErr exportToWkt( char ** ppszDstText,
1252  const override;
1253 
1254  // ICurvePolygon.
1255  virtual OGRPolygon* CurvePolyToPoly(
1256  double dfMaxAngleStepSizeDegrees = 0,
1257  const char* const* papszOptions = nullptr ) const override;
1258 
1259  OGRLinearRing *getExteriorRing();
1260  const OGRLinearRing *getExteriorRing() const;
1261  virtual OGRLinearRing *getInteriorRing( int );
1262  virtual const OGRLinearRing *getInteriorRing( int ) const;
1263 
1264  OGRLinearRing *stealExteriorRing();
1265  virtual OGRLinearRing *stealInteriorRing(int);
1266 
1267  OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
1268 
1269  virtual void closeRings() override;
1270 };
1271 
1272 /************************************************************************/
1273 /* OGRTriangle */
1274 /************************************************************************/
1275 
1282 class CPL_DLL OGRTriangle : public OGRPolygon
1283 {
1284  private:
1285  static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1286  bool quickValidityCheck() const;
1287 
1288  protected:
1290  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
1291  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1292  int bHasZ, int bHasM,
1293  OGRRawPoint*& paoPoints,
1294  int& nMaxPoints,
1295  double*& padfZ ) override;
1297 
1298  public:
1299  OGRTriangle();
1300  OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
1301  OGRTriangle( const OGRTriangle &other );
1302  OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
1303  OGRTriangle& operator=( const OGRTriangle& other );
1304  ~OGRTriangle() override;
1305  virtual const char *getGeometryName() const override;
1306  virtual OGRwkbGeometryType getGeometryType() const override;
1307 
1308  // IWks Interface.
1309  virtual OGRErr importFromWkb( const unsigned char *,
1310  int,
1311  OGRwkbVariant,
1312  int& nBytesConsumedOut ) override;
1313 
1314  // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
1315  virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) override;
1316 
1318  static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
1320 };
1321 
1322 /************************************************************************/
1323 /* OGRGeometryCollection */
1324 /************************************************************************/
1325 
1333 class CPL_DLL OGRGeometryCollection : public OGRGeometry
1334 {
1335  OGRErr importFromWkbInternal( const unsigned char * pabyData,
1336  int nSize,
1337  int nRecLevel,
1338  OGRwkbVariant, int& nBytesConsumedOut );
1339  OGRErr importFromWktInternal( char **ppszInput, int nRecLevel );
1340 
1341  protected:
1343  int nGeomCount;
1344  OGRGeometry **papoGeoms;
1345 
1346  OGRErr exportToWktInternal( char ** ppszDstText,
1347  OGRwkbVariant eWkbVariant,
1348  const char* pszSkipPrefix ) const;
1349  static OGRGeometryCollection* TransferMembersAndDestroy(
1350  OGRGeometryCollection* poSrc,
1351  OGRGeometryCollection* poDst );
1353  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1354 
1355  public:
1358  ~OGRGeometryCollection() override;
1359 
1361 
1362  // Non standard (OGRGeometry).
1363  virtual const char *getGeometryName() const override;
1364  virtual OGRwkbGeometryType getGeometryType() const override;
1365  virtual OGRGeometry *clone() const override;
1366  virtual void empty() override;
1367  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1368  virtual void flattenTo2D() override;
1369  virtual OGRBoolean IsEmpty() const override;
1370  virtual void segmentize(double dfMaxLength) override;
1371  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1372  const override;
1373  virtual OGRGeometry* getCurveGeometry(
1374  const char* const* papszOptions = nullptr ) const override;
1375  virtual OGRGeometry* getLinearGeometry(
1376  double dfMaxAngleStepSizeDegrees = 0,
1377  const char* const* papszOptions = nullptr ) const override;
1378 
1379  // IWks Interface
1380  virtual int WkbSize() const override;
1381  virtual OGRErr importFromWkb( const unsigned char *,
1382  int,
1383  OGRwkbVariant,
1384  int& nBytesConsumedOut ) override;
1385  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1387  const override;
1388  virtual OGRErr importFromWkt( char ** ) override;
1389  virtual OGRErr exportToWkt( char ** ppszDstText,
1391  const override;
1392 
1393  virtual double get_Length() const;
1394  virtual double get_Area() const;
1395 
1396  // IGeometry methods
1397  virtual int getDimension() const override;
1398  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1399  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1400 
1401  // IGeometryCollection
1402  int getNumGeometries() const;
1403  OGRGeometry *getGeometryRef( int );
1404  const OGRGeometry *getGeometryRef( int ) const;
1405 
1406  // ISpatialRelation
1407  virtual OGRBoolean Equals( OGRGeometry * ) const override;
1408 
1409  // Non standard
1410  virtual void setCoordinateDimension( int nDimension ) override;
1411  virtual void set3D( OGRBoolean bIs3D ) override;
1412  virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1413  virtual OGRErr addGeometry( const OGRGeometry * );
1414  virtual OGRErr addGeometryDirectly( OGRGeometry * );
1415  virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1416 
1417  virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1418 
1419  void closeRings() override;
1420 
1421  virtual void swapXY() override;
1422 
1423  static OGRGeometryCollection* CastToGeometryCollection(
1424  OGRGeometryCollection* poSrc );
1425 };
1426 
1427 /************************************************************************/
1428 /* OGRMultiSurface */
1429 /************************************************************************/
1430 
1438 {
1439  protected:
1441  const override;
1442 
1443  public:
1444  OGRMultiSurface();
1445  OGRMultiSurface( const OGRMultiSurface& other );
1446  ~OGRMultiSurface() override;
1447 
1448  OGRMultiSurface& operator=( const OGRMultiSurface& other );
1449 
1450  // Non standard (OGRGeometry).
1451  virtual const char *getGeometryName() const override;
1452  virtual OGRwkbGeometryType getGeometryType() const override;
1453  virtual OGRErr importFromWkt( char ** ) override;
1454  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1455  const override;
1456 
1457  // IMultiSurface methods
1458  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
1459 
1460  // IGeometry methods
1461  virtual int getDimension() const override;
1462 
1463  // Non standard
1464  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1465  const override;
1466 
1467  static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
1468 };
1469 
1470 /************************************************************************/
1471 /* OGRMultiPolygon */
1472 /************************************************************************/
1473 
1478 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
1479 {
1480  protected:
1482  const override;
1483  friend class OGRPolyhedralSurface;
1484  friend class OGRTriangulatedSurface;
1485 
1486  private:
1488  OGRErr _addGeometryWithExpectedSubGeometryType(
1489  const OGRGeometry * poNewGeom,
1490  OGRwkbGeometryType eSubGeometryType );
1491  OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
1492  OGRGeometry * poNewGeom,
1493  OGRwkbGeometryType eSubGeometryType );
1495 
1496 
1497  public:
1498  OGRMultiPolygon();
1499  OGRMultiPolygon( const OGRMultiPolygon& other );
1500  ~OGRMultiPolygon() override;
1501 
1502  OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
1503 
1504  // Non-standard (OGRGeometry).
1505  virtual const char *getGeometryName() const override;
1506  virtual OGRwkbGeometryType getGeometryType() const override;
1507  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1508  const override;
1509 
1510  // IMultiSurface methods
1511  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const override;
1512 
1513  // Non standard
1514  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1515  const override;
1516 
1517  static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
1518 };
1519 
1520 /************************************************************************/
1521 /* OGRPolyhedralSurface */
1522 /************************************************************************/
1523 
1530 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
1531 {
1532  protected:
1534  friend class OGRTriangulatedSurface;
1535  OGRMultiPolygon oMP;
1536  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1537  const override;
1538  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1539  const override;
1540  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1541  virtual const char* getSubGeometryName() const;
1542  virtual OGRwkbGeometryType getSubGeometryType() const;
1543  OGRErr exportToWktInternal (char ** ppszDstText, OGRwkbVariant eWkbVariant,
1544  const char* pszSkipPrefix ) const;
1545 
1546  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1547  const;
1548  static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
1550 
1551  public:
1553  OGRPolyhedralSurface( const OGRPolyhedralSurface &poGeom );
1554  ~OGRPolyhedralSurface() override;
1556 
1557  // IWks Interface.
1558  virtual int WkbSize() const override;
1559  virtual const char *getGeometryName() const override;
1560  virtual OGRwkbGeometryType getGeometryType() const override;
1561  virtual OGRErr importFromWkb( const unsigned char *,
1562  int,
1563  OGRwkbVariant,
1564  int& nBytesConsumedOut ) override;
1565  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1567  const override;
1568  virtual OGRErr importFromWkt( char ** ) override;
1569  virtual OGRErr exportToWkt( char ** ppszDstText,
1571  const override;
1572 
1573  // IGeometry methods.
1574  virtual int getDimension() const override;
1575 
1576  virtual void empty() override;
1577 
1578  virtual OGRGeometry *clone() const override;
1579  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1580  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1581 
1582  virtual void flattenTo2D() override;
1583  virtual OGRErr transform( OGRCoordinateTransformation* ) override;
1584  virtual OGRBoolean Equals( OGRGeometry* ) const override;
1585  virtual double get_Area() const override;
1586  virtual OGRErr PointOnSurface( OGRPoint* ) const override;
1587 
1589  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1590  const override;
1591  virtual OGRErr addGeometry( const OGRGeometry * );
1592  OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
1593  int getNumGeometries() const;
1594  OGRGeometry* getGeometryRef(int i);
1595  const OGRGeometry* getGeometryRef(int i) const;
1596 
1597  virtual OGRBoolean IsEmpty() const override;
1598  virtual void setCoordinateDimension( int nDimension ) override;
1599  virtual void set3D( OGRBoolean bIs3D ) override;
1600  virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1601  virtual void swapXY() override;
1602  OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1603 
1604  virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1605 };
1606 
1607 /************************************************************************/
1608 /* OGRTriangulatedSurface */
1609 /************************************************************************/
1610 
1618 {
1619  protected:
1621  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
1622  const override;
1623  virtual const char* getSubGeometryName() const override;
1624  virtual OGRwkbGeometryType getSubGeometryType() const override;
1625 
1626  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1627  const override;
1628  static OGRMultiPolygon *
1629  CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
1631 
1632  public:
1636 
1638  virtual const char *getGeometryName() const override;
1639  virtual OGRwkbGeometryType getGeometryType() const override;
1640 
1641  // IWks Interface.
1642  virtual OGRErr addGeometry( const OGRGeometry * ) override;
1643 
1644  static OGRPolyhedralSurface *
1645  CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
1646 };
1647 
1648 /************************************************************************/
1649 /* OGRMultiPoint */
1650 /************************************************************************/
1651 
1656 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
1657 {
1658  private:
1659  OGRErr importFromWkt_Bracketed( char **, int bHasM, int bHasZ );
1660 
1661  protected:
1663  const override;
1664 
1665  public:
1666  OGRMultiPoint();
1667  OGRMultiPoint(const OGRMultiPoint& other);
1668  ~OGRMultiPoint() override;
1669 
1670  OGRMultiPoint& operator=(const OGRMultiPoint& other);
1671 
1672  // Non-standard (OGRGeometry).
1673  virtual const char *getGeometryName() const override;
1674  virtual OGRwkbGeometryType getGeometryType() const override;
1675  virtual OGRErr importFromWkt( char ** ) override;
1676  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1677  const override;
1678 
1679  // IGeometry methods.
1680  virtual int getDimension() const override;
1681 
1682  // Non-standard.
1683  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1684  const override;
1685 };
1686 
1687 /************************************************************************/
1688 /* OGRMultiCurve */
1689 /************************************************************************/
1690 
1697 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
1698 {
1699  protected:
1701  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1702  OGRCurve* poCurve );
1705  const override;
1706 
1707  public:
1708  OGRMultiCurve();
1709  OGRMultiCurve( const OGRMultiCurve& other );
1710  ~OGRMultiCurve() override;
1711 
1712  OGRMultiCurve& operator=( const OGRMultiCurve& other );
1713 
1714  // Non standard (OGRGeometry).
1715  virtual const char *getGeometryName() const override;
1716  virtual OGRwkbGeometryType getGeometryType() const override;
1717  virtual OGRErr importFromWkt( char ** ) override;
1718  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1719  const override;
1720 
1721  // IGeometry methods.
1722  virtual int getDimension() const override;
1723 
1724  // Non-standard.
1725  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1726  const override;
1727 
1728  static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
1729 };
1730 
1731 /************************************************************************/
1732 /* OGRMultiLineString */
1733 /************************************************************************/
1734 
1739 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
1740 {
1741  protected:
1743  const override;
1744 
1745  public:
1747  OGRMultiLineString( const OGRMultiLineString& other );
1748  ~OGRMultiLineString() override;
1749 
1751 
1752  // Non standard (OGRGeometry).
1753  virtual const char *getGeometryName() const override;
1754  virtual OGRwkbGeometryType getGeometryType() const override;
1755  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1756  const override;
1757 
1758  // Non standard
1759  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1760  const override;
1761 
1762  static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
1763 };
1764 
1765 /************************************************************************/
1766 /* OGRGeometryFactory */
1767 /************************************************************************/
1768 
1773 class CPL_DLL OGRGeometryFactory
1774 {
1775  static OGRErr createFromFgfInternal( unsigned char *pabyData,
1776  OGRSpatialReference * poSR,
1777  OGRGeometry **ppoReturn,
1778  int nBytes,
1779  int *pnBytesConsumed,
1780  int nRecLevel );
1781  public:
1782  static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
1783  OGRGeometry **, int = -1,
1785  static OGRErr createFromWkb( const unsigned char * pabyData,
1787  OGRGeometry **,
1788  int nSize,
1789  OGRwkbVariant eVariant,
1790  int& nBytesConsumedOut );
1791 
1792  static OGRErr createFromWkt( char **, OGRSpatialReference *,
1793  OGRGeometry ** );
1794  static OGRErr createFromFgf( unsigned char *, OGRSpatialReference *,
1795  OGRGeometry **, int = -1, int * = nullptr );
1796  static OGRGeometry *createFromGML( const char * );
1797  static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
1798  GEOSGeom );
1799  static OGRGeometry *createFromGeoJson( const char *);
1800  static OGRGeometry *createFromGeoJson( const CPLJSONObject &oJSONObject );
1801 
1802  static void destroyGeometry( OGRGeometry * );
1803  static OGRGeometry *createGeometry( OGRwkbGeometryType );
1804 
1805  static OGRGeometry * forceToPolygon( OGRGeometry * );
1806  static OGRGeometry * forceToLineString( OGRGeometry *,
1807  bool bOnlyInOrder = true );
1808  static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
1809  static OGRGeometry * forceToMultiPoint( OGRGeometry * );
1810  static OGRGeometry * forceToMultiLineString( OGRGeometry * );
1811 
1812  static OGRGeometry * forceTo( OGRGeometry* poGeom,
1813  OGRwkbGeometryType eTargetType,
1814  const char*const* papszOptions = nullptr );
1815 
1816  static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
1817  int nPolygonCount,
1818  int *pbResultValidGeometry,
1819  const char **papszOptions = nullptr);
1820  static bool haveGEOS();
1821 
1822  static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
1824  char** papszOptions );
1825 
1826  static OGRGeometry*
1827  approximateArcAngles( double dfX, double dfY, double dfZ,
1828  double dfPrimaryRadius, double dfSecondaryAxis,
1829  double dfRotation,
1830  double dfStartAngle, double dfEndAngle,
1831  double dfMaxAngleStepSizeDegrees );
1832 
1833  static int GetCurveParmeters( double x0, double y0,
1834  double x1, double y1,
1835  double x2, double y2,
1836  double& R, double& cx, double& cy,
1837  double& alpha0, double& alpha1,
1838  double& alpha2 );
1839  static OGRLineString* curveToLineString(
1840  double x0, double y0, double z0,
1841  double x1, double y1, double z1,
1842  double x2, double y2, double z2,
1843  int bHasZ,
1844  double dfMaxAngleStepSizeDegrees,
1845  const char* const * papszOptions = nullptr );
1846  static OGRCurve* curveFromLineString(
1847  const OGRLineString* poLS,
1848  const char* const * papszOptions = nullptr);
1849 };
1850 
1851 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
1852 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
1853 
1855 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
1858 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
1859 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
1860  const OGRGeometry* poOtherGeom );
1861 int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
1862  const OGRGeometry* poOtherGeom );
1863 
1864 #endif /* ndef OGR_GEOMETRY_H_INCLUDED */
virtual void Value(double, OGRPoint *) const override
Fetch point at given distance along curve.
Definition: ogrcompoundcurve.cpp:313
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
~OGRPolyhedralSurface() override
Destructor.
Definition: ogrpolyhedralsurface.cpp:74
virtual void EndPoint(OGRPoint *) const override
Return the curve end point.
Definition: ogrcompoundcurve.cpp:303
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:5007
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
virtual OGRPointIterator * getPointIterator() const override
Returns a point iterator over the curve.
Definition: ogrcompoundcurve.cpp:749
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:1041
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrlinestring.cpp:1829
OGRBoolean Is3D() const
Definition: ogr_geometry.h:186
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
Definition: ogrcurvepolygon.cpp:619
virtual void set3D(OGRBoolean bIs3D)
Add or remove the Z coordinate dimension.
Definition: ogrgeometry.cpp:1064
virtual void setMeasured(OGRBoolean bIsMeasured)
Add or remove the M coordinate dimension.
Definition: ogrgeometry.cpp:1087
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrpolygon.cpp:106
double y
y
Definition: ogr_geometry.h:60
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const =0
Return a linestring from a curve geometry.
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrpolygon.cpp:624
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:633
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:3108
double getY() const
Return y.
Definition: ogr_geometry.h:371
virtual void swapXY()
Swap x and y coordinates.
Definition: ogrgeometry.cpp:5740
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrlinestring.cpp:2373
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:1773
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrmulticurve.cpp:100
double x
x
Definition: ogr_geometry.h:58
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrlinestring.cpp:1612
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:665
virtual void set3D(OGRBoolean bIs3D) override
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:701
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=nullptr) const CPL_WARN_UNUSED_RESULT
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3176
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 void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrcurvepolygon.cpp:695
virtual OGRGeometry * clone() const CPL_WARN_UNUSED_RESULT=0
Make a copy of this object.
OGRCurve * stealExteriorRingCurve()
"Steal" reference to external ring.
Definition: ogrcurvepolygon.cpp:311
virtual OGRBoolean Equals(OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:639
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const CPL_WARN_UNUSED_RESULT
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrgeometry.cpp:3141
virtual OGRBoolean Within(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:4772
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:303
OGRCurve * getExteriorRingCurve()
Fetch reference to external polygon ring.
Definition: ogrcurvepolygon.cpp:205
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrcurvepolygon.cpp:584
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:840
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:851
Coordinate systems services.
double getM() const
Return m.
Definition: ogr_geometry.h:375
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrcurvepolygon.cpp:448
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrgeometrycollection.cpp:1321
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:52
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrcurvepolygon.cpp:715
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:1478
virtual void StartPoint(OGRPoint *) const override
Return the curve start point.
Definition: ogrcompoundcurve.cpp:293
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant eWkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrcurvepolygon.cpp:529
virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:733
int OGRHasPreparedGeometrySupport()
Returns if GEOS has prepared geometry support.
Definition: ogrgeometry.cpp:5788
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 OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const
Return a polygon from a curve polygon.
Definition: ogrcurvepolygon.cpp:559
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:770
virtual void flattenTo2D()=0
Convert geometry to strictly 2D.
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:440
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:1333
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:242
virtual int getNumPoints() const override
Return the number of points of a curve geometry.
Definition: ogrcompoundcurve.cpp:691
Concrete representation of a closed ring.
Definition: ogr_geometry.h:696
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:395
OGRGeometry & operator=(const OGRGeometry &other)
Assignment operator.
Definition: ogrgeometry.cpp:141
virtual double get_Length() const override
Returns the length of the curve.
Definition: ogrlinestring.cpp:1927
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrpolyhedralsurface.cpp:102
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM IMultiSurface::get_PointOnSurface() method.
Definition: ogrmultisurface.cpp:299
virtual void setMeasured(OGRBoolean bIsMeasured) override
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:706
virtual double get_Area() const override
Get the area of the (closed) curve.
Definition: ogrcompoundcurve.cpp:867
virtual OGRGeometry * clone() const override
Make a copy of this object.
Definition: ogrlinestring.cpp:140
The CPLJSONArray class holds JSON object from CPLJSONDocument.
Definition: cpl_json.h:53
virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override
Add a ring to a polygon.
Definition: ogrtriangle.cpp:251
virtual int get_IsClosed() const
Return TRUE if curve is closed.
Definition: ogrcurve.cpp:97
virtual int WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolygon.cpp:300
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const
Returns whether a geometry of the specified geometry type can be a member of this collection...
Definition: ogrgeometrycollection.cpp:1310
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:1437
virtual double get_Length() const =0
Returns the length of the curve.
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrlinestring.cpp:2733
virtual OGRErr addGeometry(const OGRGeometry *) override
Add a new geometry to a collection.
Definition: ogrtriangulatedsurface.cpp:184
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrcurvepolygon.cpp:599
virtual OGRwkbGeometryType getGeometryType() const override
Returns the WKB Type of PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:116
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:2317
OGRSimpleCurve & operator=(const OGRSimpleCurve &other)
Assignment operator.
Definition: ogrlinestring.cpp:113
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrcurvepolygon.cpp:479
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:927
Simple container for a position.
Definition: ogr_geometry.h:48
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:314
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrmultisurface.cpp:278
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrcurvepolygon.cpp:179
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrmulticurve.cpp:193
OGRMultiSurface & operator=(const OGRMultiSurface &other)
Assignment operator.
Definition: ogrmultisurface.cpp:88
virtual void assignSpatialReference(OGRSpatialReference *poSR)
Assign spatial reference to this object.
Definition: ogrgeometry.cpp:455
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:398
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrmultisurface.cpp:101
virtual OGRErr exportToWkt(char **, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrmultisurface.cpp:267
virtual OGRErr exportToWkt(char **, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrmulticurve.cpp:182
Interface for a point iterator.
Definition: ogr_geometry.h:422
TriangulatedSurface class.
Definition: ogr_geometry.h:1617
A collection of OGRCurve.
Definition: ogr_geometry.h:1697
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const =0
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
virtual double get_AreaOfCurveSegments() const override
Return area of curve segments.
Definition: ogrcompoundcurve.cpp:907
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:1041
A collection of OGRLineString.
Definition: ogr_geometry.h:1739
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrgeometrycollection.cpp:194
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:119
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:823
double getZ() const
Return z.
Definition: ogr_geometry.h:373
virtual OGRErr importFromWkt(char **) override
Assign geometry from well known text data.
Definition: ogrcurvepolygon.cpp:513
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:382
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:188
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:68
virtual OGRBoolean IsValid() const
Test if the geometry is valid.
Definition: ogrgeometry.cpp:2085
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:525
OGRPolyhedralSurface & operator=(const OGRPolyhedralSurface &other)
Assignment operator.
Definition: ogrpolyhedralsurface.cpp:87
void OGRDestroyPreparedGeometry(OGRPreparedGeometry *poPreparedGeom)
Destroys a prepared geometry.
Definition: ogrgeometry.cpp:5844
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:64
virtual int getNumPoints() const override
Fetch vertex count.
Definition: ogr_geometry.h:562
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrcurvepolygon.cpp:169
OGRLineString & operator=(const OGRLineString &other)
Assignment operator.
Definition: ogrlinestring.cpp:2703
virtual void empty() override
Clear geometry information.
Definition: ogrcurvepolygon.cpp:132
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:390
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:1097
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:5866
Concrete class representing curve polygons.
Definition: ogr_geometry.h:1075
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return a linestring from a curve geometry.
Definition: ogrcompoundcurve.cpp:372
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection...
Definition: ogrmulticurve.cpp:137
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
Definition: ogrlinestring.cpp:2270
PolyhedralSurface class.
Definition: ogr_geometry.h:1530
virtual int WkbSize() const override
Returns size of related binary representation.
Definition: ogrcurvepolygon.cpp:418
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:386
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:136
virtual double get_AreaOfCurveSegments() const =0
Get the area of the purely curve portions of a (closed) curve.
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrpolygon.cpp:123
struct _OGRPreparedGeometry OGRPreparedGeometry
Prepared geometry API (needs GEOS >= 3.1.0)
Definition: ogr_geometry.h:1855
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 OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrpolygon.cpp:320
Interface for read and write JSON documents.
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:747
OGRPreparedGeometry * OGRCreatePreparedGeometry(const OGRGeometry *poGeom)
Creates a prepared geometry.
Definition: ogrgeometry.cpp:5808
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolygon.cpp:374
virtual OGRErr addGeometry(const OGRGeometry *)
Add a new geometry to a collection.
Definition: ogrpolyhedralsurface.cpp:860
virtual OGRErr addRingDirectly(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:397
Point class.
Definition: ogr_geometry.h:327
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrmultisurface.cpp:128
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:420
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:364
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 segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrlinestring.cpp:2494
virtual double get_Length() const override
Returns the length of the curve.
Definition: ogrcompoundcurve.cpp:281
double getX() const
Return x.
Definition: ogr_geometry.h:369
Concrete class representing polygons.
Definition: ogr_geometry.h:1193
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:499
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:66
virtual int getNumPoints() const =0
Return the number of points of a curve geometry.
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection...
Definition: ogrmultisurface.cpp:139
virtual OGRBoolean Contains(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:4853
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrgeometrycollection.cpp:177
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:55
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:564
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:619
virtual int WkbSize() const override
Returns size of related binary representation.
Definition: ogrlinestring.cpp:209
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrcurvepolygon.cpp:142
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:839
OGRErr importFromWkb(unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc)
Assign geometry from well known binary data.
Definition: ogrgeometry.cpp:1407
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
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:724
int OGRPreparedGeometryContains(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry contains a geometry.
Definition: ogrgeometry.cpp:5896
virtual OGRErr importFromWkt(char **) override
Assign geometry from well known text data.
Definition: ogrgeometrycollection.cpp:799
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:1282
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 const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrmulticurve.cpp:127
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:287
virtual void Value(double, OGRPoint *) const override
Fetch point at given distance along curve.
Definition: ogrlinestring.cpp:1969
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition: ogrgeometry.cpp:2390
A collection of OGRPoint.
Definition: ogr_geometry.h:1656
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrgeometrycollection.cpp:231
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 OGRErr importFromWkt(char **) override
Assign geometry from well known text data.
Definition: ogrlinestring.cpp:1710
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrlinestring.cpp:1496
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:829
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrgeometrycollection.cpp:812
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:925
OGRGeometry * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:960
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const override
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogrcurvepolygon.cpp:609
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:565

Generated for GDAL by doxygen 1.8.8.