GDAL
ogr_geometry.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: ogr_geometry.h 62c2ef9b70dfd1a0e087c7a27df0bfd375997093 2018-04-10 15:25:06 +0200 Even Rouault $
3  *
4  * Project: OpenGIS Simple Features Reference Implementation
5  * Purpose: Classes for manipulating simple features that is not specific
6  * to a particular interface technology.
7  * Author: Frank Warmerdam, warmerdam@pobox.com
8  *
9  ******************************************************************************
10  * Copyright (c) 1999, Frank Warmerdam
11  * Copyright (c) 2008-2014, Even Rouault <even dot rouault at mines-paris dot org>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  ****************************************************************************/
31 
32 #ifndef OGR_GEOMETRY_H_INCLUDED
33 #define OGR_GEOMETRY_H_INCLUDED
34 
35 #include "cpl_conv.h"
36 #include "cpl_json.h"
37 #include "ogr_core.h"
38 #include "ogr_spatialref.h"
39 
40 #include <memory>
41 
49 #ifndef DEFINEH_OGRGeometryH
50 #define DEFINEH_OGRGeometryH
51 #ifdef DEBUG
52 typedef struct OGRGeometryHS *OGRGeometryH;
53 #else
54 typedef void *OGRGeometryH;
55 #endif
56 #endif /* DEFINEH_OGRGeometryH */
57 
64 {
65  public:
67  OGRRawPoint() : x(0.0), y(0.0) {}
68 
70  OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn) {}
71 
73  double x;
75  double y;
76 };
77 
79 typedef struct GEOSGeom_t *GEOSGeom;
81 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
83 typedef void sfcgal_geometry_t;
84 
85 class OGRPoint;
86 class OGRCurve;
87 class OGRCompoundCurve;
88 class OGRSimpleCurve;
89 class OGRLinearRing;
90 class OGRLineString;
91 class OGRCircularString;
92 class OGRSurface;
93 class OGRCurvePolygon;
94 class OGRPolygon;
95 class OGRMultiPoint;
96 class OGRMultiSurface;
97 class OGRMultiPolygon;
98 class OGRMultiCurve;
99 class OGRMultiLineString;
101 class OGRTriangle;
104 
106 typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
107 typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
108 
109 typedef OGRPolygon* (*OGRSurfaceCasterToPolygon)(OGRSurface*);
110 typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
111 typedef OGRMultiPolygon* (*OGRPolyhedralSurfaceCastToMultiPolygon)(OGRPolyhedralSurface*);
113 
117 class CPL_DLL IOGRGeometryVisitor
118 {
119  public:
121  virtual ~IOGRGeometryVisitor() = default;
122 
124  virtual void visit(OGRPoint*) = 0;
126  virtual void visit(OGRLineString*) = 0;
128  virtual void visit(OGRLinearRing*) = 0;
130  virtual void visit(OGRPolygon*) = 0;
132  virtual void visit(OGRMultiPoint*) = 0;
134  virtual void visit(OGRMultiLineString*) = 0;
136  virtual void visit(OGRMultiPolygon*) = 0;
138  virtual void visit(OGRGeometryCollection*) = 0;
140  virtual void visit(OGRCircularString*) = 0;
142  virtual void visit(OGRCompoundCurve*) = 0;
144  virtual void visit(OGRCurvePolygon*) = 0;
146  virtual void visit(OGRMultiCurve*) = 0;
148  virtual void visit(OGRMultiSurface*) = 0;
150  virtual void visit(OGRTriangle*) = 0;
152  virtual void visit(OGRPolyhedralSurface*) = 0;
154  virtual void visit(OGRTriangulatedSurface*) = 0;
155 };
156 
165 {
166  void _visit(OGRSimpleCurve* poGeom);
167 
168  public:
169 
170  void visit(OGRPoint*) override {}
171  void visit(OGRLineString*) override;
172  void visit(OGRLinearRing*) override;
173  void visit(OGRPolygon*) override;
174  void visit(OGRMultiPoint*) override;
175  void visit(OGRMultiLineString*) override;
176  void visit(OGRMultiPolygon*) override;
177  void visit(OGRGeometryCollection*) override;
178  void visit(OGRCircularString*) override;
179  void visit(OGRCompoundCurve*) override;
180  void visit(OGRCurvePolygon*) override;
181  void visit(OGRMultiCurve*) override;
182  void visit(OGRMultiSurface*) override;
183  void visit(OGRTriangle*) override;
184  void visit(OGRPolyhedralSurface*) override;
185  void visit(OGRTriangulatedSurface*) override;
186 };
187 
192 {
193  public:
195  virtual ~IOGRConstGeometryVisitor() = default;
196 
198  virtual void visit(const OGRPoint*) = 0;
200  virtual void visit(const OGRLineString*) = 0;
202  virtual void visit(const OGRLinearRing*) = 0;
204  virtual void visit(const OGRPolygon*) = 0;
206  virtual void visit(const OGRMultiPoint*) = 0;
208  virtual void visit(const OGRMultiLineString*) = 0;
210  virtual void visit(const OGRMultiPolygon*) = 0;
212  virtual void visit(const OGRGeometryCollection*) = 0;
214  virtual void visit(const OGRCircularString*) = 0;
216  virtual void visit(const OGRCompoundCurve*) = 0;
218  virtual void visit(const OGRCurvePolygon*) = 0;
220  virtual void visit(const OGRMultiCurve*) = 0;
222  virtual void visit(const OGRMultiSurface*) = 0;
224  virtual void visit(const OGRTriangle*) = 0;
226  virtual void visit(const OGRPolyhedralSurface*) = 0;
228  virtual void visit(const OGRTriangulatedSurface*) = 0;
229 };
230 
239 {
240  void _visit(const OGRSimpleCurve* poGeom);
241 
242  public:
243 
244  void visit(const OGRPoint*) override {}
245  void visit(const OGRLineString*) override;
246  void visit(const OGRLinearRing*) override;
247  void visit(const OGRPolygon*) override;
248  void visit(const OGRMultiPoint*) override;
249  void visit(const OGRMultiLineString*) override;
250  void visit(const OGRMultiPolygon*) override;
251  void visit(const OGRGeometryCollection*) override;
252  void visit(const OGRCircularString*) override;
253  void visit(const OGRCompoundCurve*) override;
254  void visit(const OGRCurvePolygon*) override;
255  void visit(const OGRMultiCurve*) override;
256  void visit(const OGRMultiSurface*) override;
257  void visit(const OGRTriangle*) override;
258  void visit(const OGRPolyhedralSurface*) override;
259  void visit(const OGRTriangulatedSurface*) override;
260 };
261 
262 /************************************************************************/
263 /* OGRGeometry */
264 /************************************************************************/
265 
286 class CPL_DLL OGRGeometry
287 {
288  private:
289  OGRSpatialReference * poSRS; // may be NULL
290 
291  protected:
293  friend class OGRCurveCollection;
294 
295  unsigned int flags;
296 
297  OGRErr importPreambleFromWkt( const char ** ppszInput,
298  int* pbHasZ, int* pbHasM,
299  bool* pbIsEmpty );
300  OGRErr importCurveCollectionFromWkt(
301  const char ** ppszInput,
302  int bAllowEmptyComponent,
303  int bAllowLineString,
304  int bAllowCurve,
305  int bAllowCompoundCurve,
306  OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf,
307  OGRCurve* poCurve) );
308  OGRErr importPreambleFromWkb( const unsigned char * pabyData,
309  int nSize,
310  OGRwkbByteOrder& eByteOrder,
311  OGRwkbVariant eWkbVariant );
312  OGRErr importPreambleOfCollectionFromWkb(
313  const unsigned char * pabyData,
314  int& nSize,
315  int& nDataOffset,
316  OGRwkbByteOrder& eByteOrder,
317  int nMinSubGeomSize,
318  int& nGeomCount,
319  OGRwkbVariant eWkbVariant );
320  OGRErr PointOnSurfaceInternal( OGRPoint * poPoint ) const;
321  OGRBoolean IsSFCGALCompatible() const;
322 
323  void HomogenizeDimensionalityWith( OGRGeometry* poOtherGeom );
324 
326 
327  public:
328 
329 /************************************************************************/
330 /* Bit flags for OGRGeometry */
331 /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
332 /* Do not use these outside of the core. */
333 /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
334 /************************************************************************/
335 
337  static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
338  static const unsigned int OGR_G_3D = 0x2;
339  static const unsigned int OGR_G_MEASURED = 0x4;
341 
342  OGRGeometry();
343  OGRGeometry( const OGRGeometry& other );
344  virtual ~OGRGeometry();
345 
346  OGRGeometry& operator=( const OGRGeometry& other );
347 
349  bool operator==( const OGRGeometry& other ) const { return CPL_TO_BOOL(Equals(&other)); }
350 
352  bool operator!=( const OGRGeometry& other ) const { return !CPL_TO_BOOL(Equals(&other)); }
353 
354  // Standard IGeometry.
355  virtual int getDimension() const = 0;
356  virtual int getCoordinateDimension() const;
357  int CoordinateDimension() const;
358  virtual OGRBoolean IsEmpty() const = 0;
359  virtual OGRBoolean IsValid() const;
360  virtual OGRBoolean IsSimple() const;
362  OGRBoolean Is3D() const { return flags & OGR_G_3D; }
364  OGRBoolean IsMeasured() const { return flags & OGR_G_MEASURED; }
365  virtual OGRBoolean IsRing() const;
366  virtual void empty() = 0;
367  virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
368  virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
369  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
370 
371  // IWks Interface.
372  virtual int WkbSize() const = 0;
373  OGRErr importFromWkb( const GByte*, int=-1,
375  virtual OGRErr importFromWkb( const unsigned char *,
376  int,
378  int& nBytesConsumedOut ) = 0;
379  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
380  OGRwkbVariant=wkbVariantOldOgc ) const = 0;
381  virtual OGRErr importFromWkt( const char ** ppszInput ) = 0;
382 
386  OGRErr importFromWkt( char ** ppszInput ) CPL_WARN_DEPRECATED("Use importFromWkt(const char**) instead")
387  {
388  return importFromWkt( const_cast<const char**>(ppszInput) );
389  }
390 
391  virtual OGRErr exportToWkt( char ** ppszDstText,
392  OGRwkbVariant=wkbVariantOldOgc ) const = 0;
393 
394  // Non-standard.
395  virtual OGRwkbGeometryType getGeometryType() const = 0;
396  OGRwkbGeometryType getIsoGeometryType() const;
397  virtual const char *getGeometryName() const = 0;
398  virtual void dumpReadable( FILE *, const char * = nullptr
399  , char** papszOptions = nullptr ) const;
400  virtual void flattenTo2D() = 0;
401  virtual char * exportToGML( const char* const * papszOptions = nullptr ) const;
402  virtual char * exportToKML() const;
403  virtual char * exportToJson() const;
404 
406  virtual void accept(IOGRGeometryVisitor* visitor) = 0;
407 
409  virtual void accept(IOGRConstGeometryVisitor* visitor) const = 0;
410 
411  static GEOSContextHandle_t createGEOSContext();
412  static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
413  virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
415  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
416  virtual OGRGeometry* getCurveGeometry(
417  const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
418  virtual OGRGeometry* getLinearGeometry(
419  double dfMaxAngleStepSizeDegrees = 0,
420  const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
421 
422  // SFCGAL interfacing methods.
424  static sfcgal_geometry_t* OGRexportToSFCGAL( const OGRGeometry *poGeom );
425  static OGRGeometry* SFCGALexportToOGR( const sfcgal_geometry_t* _geometry );
427  virtual void closeRings();
428 
429  virtual void setCoordinateDimension( int nDimension );
430  virtual void set3D( OGRBoolean bIs3D );
431  virtual void setMeasured( OGRBoolean bIsMeasured );
432 
433  virtual void assignSpatialReference( OGRSpatialReference * poSR );
434  OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
435 
436  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) = 0;
437  OGRErr transformTo( OGRSpatialReference *poSR );
438 
439  virtual void segmentize(double dfMaxLength);
440 
441  // ISpatialRelation
442  virtual OGRBoolean Intersects( const OGRGeometry * ) const;
443  virtual OGRBoolean Equals( const OGRGeometry * ) const = 0;
444  virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
445  virtual OGRBoolean Touches( const OGRGeometry * ) const;
446  virtual OGRBoolean Crosses( const OGRGeometry * ) const;
447  virtual OGRBoolean Within( const OGRGeometry * ) const;
448  virtual OGRBoolean Contains( const OGRGeometry * ) const;
449  virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
450 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
451 // virtual OGRGeometry *LocateAlong( double mValue ) const;
452 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
453 
454  virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
455  virtual double Distance( const OGRGeometry * ) const ;
456  virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
457  virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
459  virtual OGRGeometry *Intersection( const OGRGeometry *)
461  virtual OGRGeometry *Union( const OGRGeometry * )
463  virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
464  virtual OGRGeometry *Difference( const OGRGeometry * )
466  virtual OGRGeometry *SymDifference( const OGRGeometry * )
468  virtual OGRErr Centroid( OGRPoint * poPoint ) const;
469  virtual OGRGeometry *Simplify(double dTolerance)
471  OGRGeometry *SimplifyPreserveTopology(double dTolerance)
473  virtual OGRGeometry *DelaunayTriangulation(
474  double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
475 
476  virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
477 
478  virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
479 
481  // backward compatibility to non-standard method names.
482  OGRBoolean Intersect( OGRGeometry * )
483  const CPL_WARN_DEPRECATED("Non standard method. "
484  "Use Intersects() instead");
485  OGRBoolean Equal( OGRGeometry * )
486  const CPL_WARN_DEPRECATED("Non standard method. "
487  "Use Equals() instead");
488  OGRGeometry *SymmetricDifference( const OGRGeometry * )
489  const CPL_WARN_DEPRECATED("Non standard method. "
490  "Use SymDifference() instead");
491  OGRGeometry *getBoundary()
492  const CPL_WARN_DEPRECATED("Non standard method. "
493  "Use Boundary() instead");
495 
497  // Special HACK for DB2 7.2 support
498  static int bGenerate_DB2_V72_BYTE_ORDER;
500 
501  virtual void swapXY();
503  static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
504  static OGRGeometry* CastToError( OGRGeometry* poGeom );
506 
510  static inline OGRGeometryH ToHandle(OGRGeometry* poGeom)
511  { return reinterpret_cast<OGRGeometryH>(poGeom); }
512 
516  static inline OGRGeometry* FromHandle(OGRGeometryH hGeom)
517  { return reinterpret_cast<OGRGeometry*>(hGeom); }
518 
523  inline OGRPoint* toPoint()
524  { return cpl::down_cast<OGRPoint*>(this); }
525 
530  inline const OGRPoint* toPoint() const
531  { return cpl::down_cast<const OGRPoint*>(this); }
532 
537  inline OGRCurve* toCurve()
538  { return cpl::down_cast<OGRCurve*>(this); }
539 
544  inline const OGRCurve* toCurve() const
545  { return cpl::down_cast<const OGRCurve*>(this); }
546 
552  { return cpl::down_cast<OGRSimpleCurve*>(this); }
553 
558  inline const OGRSimpleCurve* toSimpleCurve() const
559  { return cpl::down_cast<const OGRSimpleCurve*>(this); }
560 
566  { return cpl::down_cast<OGRLineString*>(this); }
567 
572  inline const OGRLineString* toLineString() const
573  { return cpl::down_cast<const OGRLineString*>(this); }
574 
580  { return cpl::down_cast<OGRLinearRing*>(this); }
581 
586  inline const OGRLinearRing* toLinearRing() const
587  { return cpl::down_cast<const OGRLinearRing*>(this); }
588 
594  { return cpl::down_cast<OGRCircularString*>(this); }
595 
600  inline const OGRCircularString* toCircularString() const
601  { return cpl::down_cast<const OGRCircularString*>(this); }
602 
608  { return cpl::down_cast<OGRCompoundCurve*>(this); }
609 
614  inline const OGRCompoundCurve* toCompoundCurve() const
615  { return cpl::down_cast<const OGRCompoundCurve*>(this); }
616 
622  { return cpl::down_cast<OGRSurface*>(this); }
623 
628  inline const OGRSurface* toSurface() const
629  { return cpl::down_cast<const OGRSurface*>(this); }
630 
636  { return cpl::down_cast<OGRPolygon*>(this); }
637 
642  inline const OGRPolygon* toPolygon() const
643  { return cpl::down_cast<const OGRPolygon*>(this); }
644 
650  { return cpl::down_cast<OGRTriangle*>(this); }
651 
656  inline const OGRTriangle* toTriangle() const
657  { return cpl::down_cast<const OGRTriangle*>(this); }
658 
664  { return cpl::down_cast<OGRCurvePolygon*>(this); }
665 
670  inline const OGRCurvePolygon* toCurvePolygon() const
671  { return cpl::down_cast<const OGRCurvePolygon*>(this); }
672 
678  { return cpl::down_cast<OGRGeometryCollection*>(this); }
679 
685  { return cpl::down_cast<const OGRGeometryCollection*>(this); }
686 
692  { return cpl::down_cast<OGRMultiPoint*>(this); }
693 
698  inline const OGRMultiPoint* toMultiPoint() const
699  { return cpl::down_cast<const OGRMultiPoint*>(this); }
700 
706  { return cpl::down_cast<OGRMultiLineString*>(this); }
707 
712  inline const OGRMultiLineString* toMultiLineString() const
713  { return cpl::down_cast<const OGRMultiLineString*>(this); }
714 
720  { return cpl::down_cast<OGRMultiPolygon*>(this); }
721 
726  inline const OGRMultiPolygon* toMultiPolygon() const
727  { return cpl::down_cast<const OGRMultiPolygon*>(this); }
728 
734  { return cpl::down_cast<OGRMultiCurve*>(this); }
735 
740  inline const OGRMultiCurve* toMultiCurve() const
741  { return cpl::down_cast<const OGRMultiCurve*>(this); }
742 
748  { return cpl::down_cast<OGRMultiSurface*>(this); }
749 
754  inline const OGRMultiSurface* toMultiSurface() const
755  { return cpl::down_cast<const OGRMultiSurface*>(this); }
756 
762  { return cpl::down_cast<OGRPolyhedralSurface*>(this); }
763 
769  { return cpl::down_cast<const OGRPolyhedralSurface*>(this); }
770 
776  { return cpl::down_cast<OGRTriangulatedSurface*>(this); }
777 
783  { return cpl::down_cast<const OGRTriangulatedSurface*>(this); }
784 
785 };
786 
788 struct CPL_DLL OGRGeometryUniquePtrDeleter
789 {
790  void operator()(OGRGeometry*) const;
791 };
793 
797 typedef std::unique_ptr<OGRGeometry, OGRGeometryUniquePtrDeleter> OGRGeometryUniquePtr;
798 
799 /************************************************************************/
800 /* OGRPoint */
801 /************************************************************************/
802 
809 class CPL_DLL OGRPoint : public OGRGeometry
810 {
811  double x;
812  double y;
813  double z;
814  double m;
815 
816  public:
817  OGRPoint();
818  OGRPoint( double x, double y );
819  OGRPoint( double x, double y, double z );
820  OGRPoint( double x, double y, double z, double m );
821  OGRPoint( const OGRPoint& other );
822  ~OGRPoint() override;
823 
824  OGRPoint& operator=( const OGRPoint& other );
825 
826  // IWks Interface
827  int WkbSize() const override;
828  OGRErr importFromWkb( const unsigned char *,
829  int,
831  int& nBytesConsumedOut ) override;
832  OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
834  const override;
836  OGRErr importFromWkt( const char ** ) override;
837  OGRErr exportToWkt( char ** ppszDstText,
839  const override;
840 
841  // IGeometry
842  virtual int getDimension() const override;
843  virtual OGRGeometry *clone() const override;
844  virtual void empty() override;
845  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
846  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
847  virtual OGRBoolean IsEmpty() const override
848  { return !(flags & OGR_G_NOT_EMPTY_POINT); }
849 
850  // IPoint
852  double getX() const { return x; }
854  double getY() const { return y; }
856  double getZ() const { return z; }
858  double getM() const { return m; }
859 
860  // Non standard
861  virtual void setCoordinateDimension( int nDimension ) override;
865  void setX( double xIn ) { x = xIn; flags |= OGR_G_NOT_EMPTY_POINT; }
869  void setY( double yIn ) { y = yIn; flags |= OGR_G_NOT_EMPTY_POINT; }
873  void setZ( double zIn )
874  { z = zIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_3D); }
878  void setM( double mIn )
879  { m = mIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_MEASURED); }
880 
881  // ISpatialRelation
882  virtual OGRBoolean Equals( const OGRGeometry * ) const override;
883  virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
884  virtual OGRBoolean Within( const OGRGeometry * ) const override;
885 
886  // Non standard from OGRGeometry
887  virtual const char *getGeometryName() const override;
888  virtual OGRwkbGeometryType getGeometryType() const override;
889  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
890  virtual void flattenTo2D() override;
891  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
892  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
893 
894  virtual void swapXY() override;
895 };
896 
897 /************************************************************************/
898 /* OGRPointIterator */
899 /************************************************************************/
900 
907 class CPL_DLL OGRPointIterator
908 {
909  public:
910  virtual ~OGRPointIterator();
911  virtual OGRBoolean getNextPoint( OGRPoint* p ) = 0;
912 
913  static void destroy( OGRPointIterator* );
914 };
915 
916 /************************************************************************/
917 /* OGRCurve */
918 /************************************************************************/
919 
925 class CPL_DLL OGRCurve : public OGRGeometry
926 {
927  protected:
929  OGRCurve();
930  OGRCurve( const OGRCurve& other );
931 
932  virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
933  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
934 
935  friend class OGRCurvePolygon;
936  friend class OGRCompoundCurve;
938  virtual int ContainsPoint( const OGRPoint* p ) const;
939  virtual int IntersectsPoint( const OGRPoint* p ) const;
940  virtual double get_AreaOfCurveSegments() const = 0;
941 
942  private:
943 
944  class CPL_DLL ConstIterator
945  {
946  struct Private;
947  std::unique_ptr<Private> m_poPrivate;
948  public:
949  ConstIterator(const OGRCurve* poSelf, bool bStart);
950  ConstIterator(ConstIterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least
951  ~ConstIterator();
952  const OGRPoint& operator*() const;
953  ConstIterator& operator++();
954  bool operator!=(const ConstIterator& it) const;
955  };
956 
957  friend inline ConstIterator begin(const OGRCurve*);
958  friend inline ConstIterator end(const OGRCurve*);
959 
960  public:
961  ~OGRCurve() override;
962 
964  OGRCurve& operator=( const OGRCurve& other );
966 
969 
978  ConstIterator begin() const;
980  ConstIterator end() const;
981 
982  // ICurve methods
983  virtual double get_Length() const = 0;
984  virtual void StartPoint( OGRPoint * ) const = 0;
985  virtual void EndPoint( OGRPoint * ) const = 0;
986  virtual int get_IsClosed() const;
987  virtual void Value( double, OGRPoint * ) const = 0;
988  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
989  const char* const* papszOptions = nullptr)
990  const = 0;
991  virtual int getDimension() const override;
992 
993  // non standard
994  virtual int getNumPoints() const = 0;
995  virtual OGRPointIterator* getPointIterator() const = 0;
996  virtual OGRBoolean IsConvex() const;
997  virtual double get_Area() const = 0;
998 
1002  { return cpl::down_cast<OGRSimpleCurve*>(this); }
1003 
1006  inline const OGRSimpleCurve* toSimpleCurve() const
1007  { return cpl::down_cast<const OGRSimpleCurve*>(this); }
1008 
1009  static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
1010  static OGRLineString* CastToLineString( OGRCurve* poCurve );
1011  static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
1012 };
1013 
1015 
1016 inline OGRCurve::ConstIterator begin(const OGRCurve* poCurve) { return poCurve->begin(); }
1018 inline OGRCurve::ConstIterator end(const OGRCurve* poCurve) { return poCurve->end(); }
1020 
1021 /************************************************************************/
1022 /* OGRSimpleCurve */
1023 /************************************************************************/
1024 
1034 class CPL_DLL OGRSimpleCurve: public OGRCurve
1035 {
1036  protected:
1038  friend class OGRGeometry;
1039 
1040  int nPointCount;
1041  OGRRawPoint *paoPoints;
1042  double *padfZ;
1043  double *padfM;
1044 
1045  void Make3D();
1046  void Make2D();
1047  void RemoveM();
1048  void AddM();
1049 
1050  OGRErr importFromWKTListOnly( const char ** ppszInput, int bHasZ, int bHasM,
1051  OGRRawPoint*& paoPointsIn,
1052  int& nMaxPoints,
1053  double*& padfZIn );
1054 
1056 
1057  virtual double get_LinearArea() const;
1058 
1059  OGRSimpleCurve();
1060  OGRSimpleCurve( const OGRSimpleCurve& other );
1061 
1062  private:
1063  class CPL_DLL Iterator
1064  {
1065  struct Private;
1066  std::unique_ptr<Private> m_poPrivate;
1067  void update();
1068  public:
1069  Iterator(OGRSimpleCurve* poSelf, int nPos);
1070  Iterator(Iterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least
1071  ~Iterator();
1072  OGRPoint& operator*();
1073  Iterator& operator++();
1074  bool operator!=(const Iterator& it) const;
1075  };
1076 
1077  friend inline Iterator begin(OGRSimpleCurve*);
1078  friend inline Iterator end(OGRSimpleCurve*);
1079 
1080  class CPL_DLL ConstIterator
1081  {
1082  struct Private;
1083  std::unique_ptr<Private> m_poPrivate;
1084  public:
1085  ConstIterator(const OGRSimpleCurve* poSelf, int nPos);
1086  ConstIterator(ConstIterator&& oOther); // declared but not defined. Needed for gcc 5.4 at least
1087  ~ConstIterator();
1088  const OGRPoint& operator*() const;
1089  ConstIterator& operator++();
1090  bool operator!=(const ConstIterator& it) const;
1091  };
1092 
1093  friend inline ConstIterator begin(const OGRSimpleCurve*);
1094  friend inline ConstIterator end(const OGRSimpleCurve*);
1095 
1096  public:
1097  ~OGRSimpleCurve() override;
1098 
1099  OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
1100 
1103 
1112  Iterator begin();
1114  Iterator end();
1123  ConstIterator begin() const;
1125  ConstIterator end() const;
1126 
1127  // IWks Interface.
1128  virtual int WkbSize() const override;
1129  virtual OGRErr importFromWkb( const unsigned char *,
1130  int,
1131  OGRwkbVariant,
1132  int& nBytesConsumedOut ) override;
1133  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1135  const override;
1137  OGRErr importFromWkt( const char ** ) override;
1138  virtual OGRErr exportToWkt( char ** ppszDstText,
1140  const override;
1141 
1142  // IGeometry interface.
1143  virtual OGRGeometry *clone() const override;
1144  virtual void empty() override;
1145  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1146  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1147  virtual OGRBoolean IsEmpty() const override;
1148 
1149  // ICurve methods.
1150  virtual double get_Length() const override;
1151  virtual void StartPoint( OGRPoint * ) const override;
1152  virtual void EndPoint( OGRPoint * ) const override;
1153  virtual void Value( double, OGRPoint * ) const override;
1154  virtual double Project( const OGRPoint * ) const;
1155  virtual OGRLineString* getSubLine( double, double, int ) const;
1156 
1157  // ILineString methods.
1158  virtual int getNumPoints() const override { return nPointCount; }
1159  void getPoint( int, OGRPoint * ) const;
1160  double getX( int i ) const { return paoPoints[i].x; }
1161  double getY( int i ) const { return paoPoints[i].y; }
1162  double getZ( int i ) const;
1163  double getM( int i ) const;
1164 
1165  // ISpatialRelation
1166  virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1167 
1168  // non standard.
1169  virtual void setCoordinateDimension( int nDimension ) override;
1170  virtual void set3D( OGRBoolean bIs3D ) override;
1171  virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1172  void setNumPoints( int nNewPointCount,
1173  int bZeroizeNewContent = TRUE );
1174  void setPoint( int, OGRPoint * );
1175  void setPoint( int, double, double );
1176  void setZ( int, double );
1177  void setM( int, double );
1178  void setPoint( int, double, double, double );
1179  void setPointM( int, double, double, double );
1180  void setPoint( int, double, double, double, double );
1181  void setPoints( int, const OGRRawPoint *, const double * = nullptr );
1182  void setPointsM( int, const OGRRawPoint *, const double * );
1183  void setPoints( int, const OGRRawPoint *, const double *, const double * );
1184  void setPoints( int, const double * padfX, const double * padfY,
1185  const double *padfZIn = nullptr );
1186  void setPointsM( int, const double * padfX, const double * padfY,
1187  const double *padfMIn = nullptr );
1188  void setPoints( int, const double * padfX, const double * padfY,
1189  const double *padfZIn, const double *padfMIn );
1190  void addPoint( const OGRPoint * );
1191  void addPoint( double, double );
1192  void addPoint( double, double, double );
1193  void addPointM( double, double, double );
1194  void addPoint( double, double, double, double );
1195 
1196  void getPoints( OGRRawPoint *, double * = nullptr ) const;
1197  void getPoints( void* pabyX, int nXStride,
1198  void* pabyY, int nYStride,
1199  void* pabyZ = nullptr, int nZStride = 0 ) const;
1200  void getPoints( void* pabyX, int nXStride,
1201  void* pabyY, int nYStride,
1202  void* pabyZ, int nZStride,
1203  void* pabyM, int nMStride ) const;
1204 
1205  void addSubLineString( const OGRLineString *,
1206  int nStartVertex = 0, int nEndVertex = -1 );
1207  void reversePoints( void );
1208  virtual OGRPointIterator* getPointIterator() const override;
1209 
1210  // non-standard from OGRGeometry
1211  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1212  virtual void flattenTo2D() override;
1213  virtual void segmentize(double dfMaxLength) override;
1214 
1215  virtual void swapXY() override;
1216 };
1217 
1219 
1220 inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1222 inline OGRSimpleCurve::Iterator end(OGRSimpleCurve* poCurve) { return poCurve->end(); }
1223 
1225 inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1227 inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve* poCurve) { return poCurve->end(); }
1229 
1230 /************************************************************************/
1231 /* OGRLineString */
1232 /************************************************************************/
1233 
1241 class CPL_DLL OGRLineString : public OGRSimpleCurve
1242 {
1243  static OGRLinearRing* CasterToLinearRing(OGRCurve* poCurve);
1244 
1245  protected:
1247  static OGRLineString* TransferMembersAndDestroy(
1248  OGRLineString* poSrc,
1249  OGRLineString* poDst);
1250 
1251  virtual OGRCurveCasterToLineString GetCasterToLineString()
1252  const override;
1253  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1254  const override;
1255 
1256  virtual double get_AreaOfCurveSegments() const override;
1258 
1259  static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
1260 
1261  public:
1262  OGRLineString();
1263  OGRLineString( const OGRLineString& other );
1264  ~OGRLineString() override;
1265 
1266  OGRLineString& operator=(const OGRLineString& other);
1267 
1268  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1269  const char* const* papszOptions = nullptr )
1270  const override;
1271  virtual OGRGeometry* getCurveGeometry(
1272  const char* const* papszOptions = nullptr ) const override;
1273  virtual double get_Area() const override;
1274 
1275  // Non-standard from OGRGeometry.
1276  virtual OGRwkbGeometryType getGeometryType() const override;
1277  virtual const char *getGeometryName() const override;
1278 
1280  inline OGRSimpleCurve* toUpperClass() { return this; }
1282  inline const OGRSimpleCurve* toUpperClass() const { return this; }
1283 
1284  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1285  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1286 };
1287 
1288 /************************************************************************/
1289 /* OGRLinearRing */
1290 /************************************************************************/
1291 
1312 class CPL_DLL OGRLinearRing : public OGRLineString
1313 {
1314  static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1315 
1316  protected:
1318  friend class OGRPolygon;
1319  friend class OGRTriangle;
1320 
1321  // These are not IWks compatible ... just a convenience for OGRPolygon.
1322  virtual int _WkbSize( int _flags ) const;
1323  virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
1324  const unsigned char *, int,
1325  int& nBytesConsumedOut );
1326  virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
1327  unsigned char * ) const;
1328 
1329  virtual OGRCurveCasterToLineString GetCasterToLineString()
1330  const override;
1331  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1332  const override;
1334 
1335  static OGRLineString* CastToLineString( OGRLinearRing* poLR );
1336 
1337  public:
1338  OGRLinearRing();
1339  OGRLinearRing( const OGRLinearRing& other );
1340  explicit OGRLinearRing( OGRLinearRing * );
1341  ~OGRLinearRing() override;
1342 
1343  OGRLinearRing& operator=( const OGRLinearRing& other );
1344 
1345  // Non standard.
1346  virtual const char *getGeometryName() const override;
1347  virtual OGRGeometry *clone() const override;
1348  virtual int isClockwise() const;
1349  virtual void reverseWindingOrder();
1350  virtual void closeRings() override;
1351  OGRBoolean isPointInRing( const OGRPoint* pt,
1352  int bTestEnvelope = TRUE ) const;
1353  OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
1354  int bTestEnvelope = TRUE ) const;
1355  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1356 
1358  inline OGRLineString* toUpperClass() { return this; }
1360  inline const OGRLineString* toUpperClass() const { return this; }
1361 
1362  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1363  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1364 
1365  // IWks Interface - Note this isn't really a first class object
1366  // for the purposes of WKB form. These methods always fail since this
1367  // object can't be serialized on its own.
1368  virtual int WkbSize() const override;
1369  virtual OGRErr importFromWkb( const unsigned char *,
1370  int,
1371  OGRwkbVariant,
1372  int& nBytesConsumedOut ) override;
1373  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1375  const override;
1376 };
1377 
1378 /************************************************************************/
1379 /* OGRCircularString */
1380 /************************************************************************/
1381 
1394 class CPL_DLL OGRCircularString : public OGRSimpleCurve
1395 {
1396  private:
1397  void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
1398  OGRBoolean IsValidFast() const;
1399  int IsFullCircle( double& cx, double& cy, double& square_R ) const;
1400 
1401  protected:
1403  virtual OGRCurveCasterToLineString GetCasterToLineString()
1404  const override;
1405  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1406  const override;
1407  virtual int IntersectsPoint( const OGRPoint* p ) const override;
1408  virtual int ContainsPoint( const OGRPoint* p ) const override;
1409  virtual double get_AreaOfCurveSegments() const override;
1411 
1412  public:
1414  OGRCircularString( const OGRCircularString& other );
1415  ~OGRCircularString() override;
1416 
1417  OGRCircularString& operator=(const OGRCircularString& other);
1418 
1419  // IWks Interface.
1420  virtual OGRErr importFromWkb( const unsigned char *,
1421  int,
1422  OGRwkbVariant,
1423  int& nBytesConsumedOut ) override;
1424  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1426  const override;
1428  OGRErr importFromWkt( const char ** ) override;
1429  virtual OGRErr exportToWkt( char ** ppszDstText,
1431  const override;
1432 
1433  // IGeometry interface.
1434  virtual OGRBoolean IsValid() const override;
1435  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1436  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1437 
1438  // ICurve methods.
1439  virtual double get_Length() const override;
1440  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1441  const char* const* papszOptions = nullptr )
1442  const override;
1443  virtual void Value( double, OGRPoint * ) const override;
1444  virtual double get_Area() const override;
1445 
1446  // Non-standard from OGRGeometry.
1447  virtual OGRwkbGeometryType getGeometryType() const override;
1448  virtual const char *getGeometryName() const override;
1449  virtual void segmentize( double dfMaxLength ) override;
1450  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1451  const override;
1452  virtual OGRGeometry* getLinearGeometry(
1453  double dfMaxAngleStepSizeDegrees = 0,
1454  const char* const* papszOptions = nullptr) const override;
1455 
1457  inline OGRSimpleCurve* toUpperClass() { return this; }
1459  inline const OGRSimpleCurve* toUpperClass() const { return this; }
1460 
1461  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1462  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1463 };
1464 
1465 /************************************************************************/
1466 /* OGRCurveCollection */
1467 /************************************************************************/
1468 
1479 class CPL_DLL OGRCurveCollection
1481 {
1482  protected:
1483  friend class OGRCompoundCurve;
1484  friend class OGRCurvePolygon;
1485  friend class OGRPolygon;
1486  friend class OGRTriangle;
1487 
1488  int nCurveCount;
1489  OGRCurve **papoCurves;
1490 
1491  public:
1492  OGRCurveCollection();
1493  OGRCurveCollection(const OGRCurveCollection& other);
1494  ~OGRCurveCollection();
1495 
1496  OGRCurveCollection& operator=(const OGRCurveCollection& other);
1497 
1499  typedef OGRCurve ChildType;
1500 
1504  OGRCurve** begin() { return papoCurves; }
1506  OGRCurve** end() { return papoCurves + nCurveCount; }
1510  const OGRCurve* const* begin() const { return papoCurves; }
1512  const OGRCurve* const* end() const { return papoCurves + nCurveCount; }
1513 
1514  void empty(OGRGeometry* poGeom);
1515  OGRBoolean IsEmpty() const;
1516  void getEnvelope( OGREnvelope * psEnvelope ) const;
1517  void getEnvelope( OGREnvelope3D * psEnvelope ) const;
1518 
1519  OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
1520  int bNeedRealloc );
1521  int WkbSize() const;
1522  OGRErr importPreambleFromWkb( OGRGeometry* poGeom,
1523  const unsigned char * pabyData,
1524  int& nSize,
1525  int& nDataOffset,
1526  OGRwkbByteOrder& eByteOrder,
1527  int nMinSubGeomSize,
1528  OGRwkbVariant eWkbVariant );
1529  OGRErr importBodyFromWkb(
1530  OGRGeometry* poGeom,
1531  const unsigned char * pabyData,
1532  int nSize,
1533  int bAcceptCompoundCurve,
1534  OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
1535  OGRCurve* poCurve ),
1536  OGRwkbVariant eWkbVariant,
1537  int& nBytesConsumedOut );
1538  OGRErr exportToWkt( const OGRGeometry* poGeom,
1539  char ** ppszDstText ) const;
1541  unsigned char *,
1542  OGRwkbVariant eWkbVariant ) const;
1543  OGRBoolean Equals(const OGRCurveCollection *poOCC) const;
1544  void setCoordinateDimension( OGRGeometry* poGeom,
1545  int nNewDimension );
1546  void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
1547  void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
1548  void assignSpatialReference( OGRGeometry* poGeom, OGRSpatialReference * poSR );
1549  int getNumCurves() const;
1550  OGRCurve *getCurve( int );
1551  const OGRCurve *getCurve( int ) const;
1552  OGRCurve *stealCurve( int );
1553 
1554  OGRErr removeCurve( int iIndex, bool bDelete = true );
1555 
1556  OGRErr transform( OGRGeometry* poGeom,
1558  void flattenTo2D( OGRGeometry* poGeom );
1559  void segmentize( double dfMaxLength );
1560  void swapXY();
1561  OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
1562 };
1564 
1565 /************************************************************************/
1566 /* OGRCompoundCurve */
1567 /************************************************************************/
1568 
1579 class CPL_DLL OGRCompoundCurve : public OGRCurve
1580 {
1581  private:
1582  OGRCurveCollection oCC;
1583 
1584  OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
1585  double dfToleranceEps,
1586  int bNeedRealloc );
1587  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1588  OGRCurve* poCurve );
1589  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1590  OGRCurve* poCurve );
1591  OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
1592  const char* const* papszOptions,
1593  int bIsLinearRing ) const;
1594  static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1595  static OGRLinearRing* CasterToLinearRing( OGRCurve* poCurve );
1596 
1597  protected:
1599  static OGRLineString* CastToLineString( OGRCompoundCurve* poCC );
1600  static OGRLinearRing* CastToLinearRing( OGRCompoundCurve* poCC );
1601 
1602  virtual OGRCurveCasterToLineString GetCasterToLineString()
1603  const override;
1604  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1605  const override;
1607 
1608  public:
1609  OGRCompoundCurve();
1610  OGRCompoundCurve( const OGRCompoundCurve& other );
1611  ~OGRCompoundCurve() override;
1612 
1613  OGRCompoundCurve& operator=( const OGRCompoundCurve& other );
1614 
1617 
1621  ChildType** begin() { return oCC.begin(); }
1623  ChildType** end() { return oCC.end(); }
1627  const ChildType* const * begin() const { return oCC.begin(); }
1629  const ChildType* const * end() const { return oCC.end(); }
1630 
1631  // IWks Interface
1632  virtual int WkbSize() const override;
1633  virtual OGRErr importFromWkb( const unsigned char *,
1634  int,
1635  OGRwkbVariant,
1636  int& nBytesConsumedOut ) override;
1637  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1639  const override;
1641  OGRErr importFromWkt( const char ** ) override;
1642  virtual OGRErr exportToWkt( char ** ppszDstText,
1644  const override;
1645 
1646  // IGeometry interface.
1647  virtual OGRGeometry *clone() const override;
1648  virtual void empty() override;
1649  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1650  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1651  virtual OGRBoolean IsEmpty() const override;
1652 
1653  // ICurve methods.
1654  virtual double get_Length() const override;
1655  virtual void StartPoint( OGRPoint * ) const override;
1656  virtual void EndPoint( OGRPoint * ) const override;
1657  virtual void Value( double, OGRPoint * ) const override;
1658  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1659  const char* const* papszOptions = nullptr )
1660  const override;
1661 
1662  virtual int getNumPoints() const override;
1663  virtual double get_AreaOfCurveSegments() const override;
1664  virtual double get_Area() const override;
1665 
1666  // ISpatialRelation.
1667  virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1668 
1669  // ICompoundCurve method.
1670  int getNumCurves() const;
1671  OGRCurve *getCurve( int );
1672  const OGRCurve *getCurve( int ) const;
1673 
1674  // Non-standard.
1675  virtual void setCoordinateDimension( int nDimension ) override;
1676  virtual void set3D( OGRBoolean bIs3D ) override;
1677  virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1678 
1679  virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1680 
1681  OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
1682  OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
1683  OGRCurve *stealCurve( int );
1684  virtual OGRPointIterator* getPointIterator() const override;
1685 
1686  // Non-standard from OGRGeometry.
1687  virtual OGRwkbGeometryType getGeometryType() const override;
1688  virtual const char *getGeometryName() const override;
1689  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1690  virtual void flattenTo2D() override;
1691  virtual void segmentize(double dfMaxLength) override;
1692  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
1693  const override;
1694  virtual OGRGeometry* getLinearGeometry(
1695  double dfMaxAngleStepSizeDegrees = 0,
1696  const char* const* papszOptions = nullptr) const override;
1697  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1698  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1699 
1700  virtual void swapXY() override;
1701 };
1702 
1704 
1705 inline const OGRCompoundCurve::ChildType* const * begin(const OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1707 inline const OGRCompoundCurve::ChildType* const * end(const OGRCompoundCurve* poCurve) { return poCurve->end(); }
1708 
1710 inline OGRCompoundCurve::ChildType** begin(OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1712 inline OGRCompoundCurve::ChildType** end(OGRCompoundCurve* poCurve) { return poCurve->end(); }
1714 
1715 /************************************************************************/
1716 /* OGRSurface */
1717 /************************************************************************/
1718 
1724 class CPL_DLL OGRSurface : public OGRGeometry
1725 {
1726  protected:
1728  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1729  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1731 
1732  public:
1733  virtual double get_Area() const = 0;
1734  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const
1735  { return PointOnSurfaceInternal(poPoint); }
1737  static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1738  static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1740 };
1741 
1742 /************************************************************************/
1743 /* OGRCurvePolygon */
1744 /************************************************************************/
1745 
1759 class CPL_DLL OGRCurvePolygon : public OGRSurface
1760 {
1761  static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1762 
1763  private:
1764  OGRBoolean IntersectsPoint( const OGRPoint* p ) const;
1765  OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1766  virtual int checkRing( OGRCurve * poNewRing ) const;
1767  OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1768  int bNeedRealloc );
1769  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1770  OGRCurve* poCurve );
1771  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1772  OGRCurve* poCurve );
1773 
1774  protected:
1776  friend class OGRPolygon;
1777  friend class OGRTriangle;
1778  OGRCurveCollection oCC;
1779 
1780  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1781  const override;
1782  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1783  const override;
1785 
1786  static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
1787 
1788  public:
1789  OGRCurvePolygon();
1790  OGRCurvePolygon( const OGRCurvePolygon& );
1791  ~OGRCurvePolygon() override;
1792 
1793  OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
1794 
1797 
1801  ChildType** begin() { return oCC.begin(); }
1803  ChildType** end() { return oCC.end(); }
1807  const ChildType* const * begin() const { return oCC.begin(); }
1809  const ChildType* const * end() const { return oCC.end(); }
1810 
1811  // Non standard (OGRGeometry).
1812  virtual const char *getGeometryName() const override;
1813  virtual OGRwkbGeometryType getGeometryType() const override;
1814  virtual OGRGeometry *clone() const override;
1815  virtual void empty() override;
1816  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1817  virtual void flattenTo2D() override;
1818  virtual OGRBoolean IsEmpty() const override;
1819  virtual void segmentize( double dfMaxLength ) override;
1820  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1821  const override;
1822  virtual OGRGeometry* getLinearGeometry(
1823  double dfMaxAngleStepSizeDegrees = 0,
1824  const char* const* papszOptions = nullptr ) const override;
1825 
1826  // ISurface Interface
1827  virtual double get_Area() const override;
1828 
1829  // IWks Interface
1830  virtual int WkbSize() const override;
1831  virtual OGRErr importFromWkb( const unsigned char *,
1832  int,
1833  OGRwkbVariant,
1834  int& nBytesConsumedOut ) override;
1835  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1837  const override;
1839  OGRErr importFromWkt( const char ** ) override;
1840  virtual OGRErr exportToWkt( char ** ppszDstText,
1841  OGRwkbVariant eWkbVariant = wkbVariantOldOgc )
1842  const override;
1843 
1844  // IGeometry
1845  virtual int getDimension() const override;
1846  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1847  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1848 
1849  // ICurvePolygon
1850  virtual OGRPolygon* CurvePolyToPoly(
1851  double dfMaxAngleStepSizeDegrees = 0,
1852  const char* const* papszOptions = nullptr ) const;
1853 
1854  // ISpatialRelation
1855  virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1856  virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
1857  virtual OGRBoolean Contains( const OGRGeometry * ) const override;
1858 
1859  // Non standard
1860  virtual void setCoordinateDimension( int nDimension ) override;
1861  virtual void set3D( OGRBoolean bIs3D ) override;
1862  virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1863 
1864  virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1865 
1866  virtual OGRErr addRing( OGRCurve * );
1867  virtual OGRErr addRingDirectly( OGRCurve * );
1868 
1870  const OGRCurve *getExteriorRingCurve() const;
1871  int getNumInteriorRings() const;
1873  const OGRCurve *getInteriorRingCurve( int ) const;
1874 
1876 
1877  OGRErr removeRing( int iIndex, bool bDelete = true );
1878  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1879  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1880 
1881  virtual void swapXY() override;
1882 };
1883 
1885 
1886 inline const OGRCurvePolygon::ChildType* const * begin(const OGRCurvePolygon* poGeom) { return poGeom->begin(); }
1888 inline const OGRCurvePolygon::ChildType* const * end(const OGRCurvePolygon* poGeom) { return poGeom->end(); }
1889 
1891 inline OGRCurvePolygon::ChildType** begin(OGRCurvePolygon* poGeom) { return poGeom->begin(); }
1893 inline OGRCurvePolygon::ChildType** end(OGRCurvePolygon* poGeom) { return poGeom->end(); }
1895 
1896 /************************************************************************/
1897 /* OGRPolygon */
1898 /************************************************************************/
1899 
1909 class CPL_DLL OGRPolygon : public OGRCurvePolygon
1910 {
1911  static OGRCurvePolygon* CasterToCurvePolygon(OGRSurface* poSurface);
1912 
1913  protected:
1915  friend class OGRMultiSurface;
1916  friend class OGRPolyhedralSurface;
1917  friend class OGRTriangulatedSurface;
1918 
1919  virtual int checkRing( OGRCurve * poNewRing ) const override;
1920  virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
1921  int bHasZ, int bHasM,
1922  OGRRawPoint*& paoPoints,
1923  int& nMaxPoints,
1924  double*& padfZ );
1925 
1926  static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
1927 
1928  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1929  const override;
1930  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1931  const override;
1933 
1934  public:
1935  OGRPolygon();
1936  OGRPolygon(const OGRPolygon& other);
1937  ~OGRPolygon() override;
1938 
1939  OGRPolygon& operator=(const OGRPolygon& other);
1940 
1943 
1947  ChildType** begin() { return reinterpret_cast<ChildType**>(oCC.begin()); }
1949  ChildType** end() { return reinterpret_cast<ChildType**>(oCC.end()); }
1953  const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oCC.begin()); }
1955  const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oCC.end()); }
1956 
1957  // Non-standard (OGRGeometry).
1958  virtual const char *getGeometryName() const override;
1959  virtual OGRwkbGeometryType getGeometryType() const override;
1960  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1961  const override;
1962  virtual OGRGeometry* getCurveGeometry(
1963  const char* const* papszOptions = nullptr ) const override;
1964  virtual OGRGeometry* getLinearGeometry(
1965  double dfMaxAngleStepSizeDegrees = 0,
1966  const char* const* papszOptions = nullptr) const override;
1967 
1968  // IWks Interface.
1969  virtual int WkbSize() const override;
1970  virtual OGRErr importFromWkb( const unsigned char *,
1971  int,
1972  OGRwkbVariant,
1973  int& nBytesConsumedOut ) override;
1974  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1976  const override;
1978  OGRErr importFromWkt( const char ** ) override;
1979 
1980  virtual OGRErr exportToWkt( char ** ppszDstText,
1982  const override;
1983 
1984  // ICurvePolygon.
1985  virtual OGRPolygon* CurvePolyToPoly(
1986  double dfMaxAngleStepSizeDegrees = 0,
1987  const char* const* papszOptions = nullptr ) const override;
1988 
1989  OGRLinearRing *getExteriorRing();
1990  const OGRLinearRing *getExteriorRing() const;
1991  virtual OGRLinearRing *getInteriorRing( int );
1992  virtual const OGRLinearRing *getInteriorRing( int ) const;
1993 
1994  OGRLinearRing *stealExteriorRing();
1995  virtual OGRLinearRing *stealInteriorRing(int);
1996 
1997  OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
1998 
2000  inline OGRCurvePolygon* toUpperClass() { return this; }
2002  inline const OGRCurvePolygon* toUpperClass() const { return this; }
2003 
2004  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2005  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2006 
2007  virtual void closeRings() override;
2008 };
2009 
2011 
2012 inline const OGRPolygon::ChildType* const * begin(const OGRPolygon* poGeom) { return poGeom->begin(); }
2014 inline const OGRPolygon::ChildType* const * end(const OGRPolygon* poGeom) { return poGeom->end(); }
2015 
2017 inline OGRPolygon::ChildType** begin(OGRPolygon* poGeom) { return poGeom->begin(); }
2019 inline OGRPolygon::ChildType** end(OGRPolygon* poGeom) { return poGeom->end(); }
2021 
2022 /************************************************************************/
2023 /* OGRTriangle */
2024 /************************************************************************/
2025 
2032 class CPL_DLL OGRTriangle : public OGRPolygon
2033 {
2034  private:
2035  static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
2036  bool quickValidityCheck() const;
2037 
2038  protected:
2040  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2041  virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
2042  int bHasZ, int bHasM,
2043  OGRRawPoint*& paoPoints,
2044  int& nMaxPoints,
2045  double*& padfZ ) override;
2047 
2048  public:
2049  OGRTriangle();
2050  OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
2051  OGRTriangle( const OGRTriangle &other );
2052  OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
2053  OGRTriangle& operator=( const OGRTriangle& other );
2054  ~OGRTriangle() override;
2055  virtual const char *getGeometryName() const override;
2056  virtual OGRwkbGeometryType getGeometryType() const override;
2057 
2058  // IWks Interface.
2059  virtual OGRErr importFromWkb( const unsigned char *,
2060  int,
2061  OGRwkbVariant,
2062  int& nBytesConsumedOut ) override;
2063 
2064  // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
2065  virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) override;
2066 
2068  inline OGRPolygon* toUpperClass() { return this; }
2070  inline const OGRPolygon* toUpperClass() const { return this; }
2071 
2072  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2073  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2074 
2076  static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
2078 };
2079 
2080 /************************************************************************/
2081 /* OGRGeometryCollection */
2082 /************************************************************************/
2083 
2091 class CPL_DLL OGRGeometryCollection : public OGRGeometry
2092 {
2093  OGRErr importFromWkbInternal( const unsigned char * pabyData,
2094  int nSize,
2095  int nRecLevel,
2096  OGRwkbVariant, int& nBytesConsumedOut );
2097  OGRErr importFromWktInternal( const char **ppszInput, int nRecLevel );
2098 
2099  protected:
2101  int nGeomCount;
2102  OGRGeometry **papoGeoms;
2103 
2104  OGRErr exportToWktInternal( char ** ppszDstText,
2105  OGRwkbVariant eWkbVariant,
2106  const char* pszSkipPrefix ) const;
2107  static OGRGeometryCollection* TransferMembersAndDestroy(
2108  OGRGeometryCollection* poSrc,
2109  OGRGeometryCollection* poDst );
2111  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2112 
2113  public:
2116  ~OGRGeometryCollection() override;
2117 
2118  OGRGeometryCollection& operator=( const OGRGeometryCollection& other );
2119 
2122 
2126  ChildType** begin() { return papoGeoms; }
2128  ChildType** end() { return papoGeoms + nGeomCount; }
2132  const ChildType* const* begin() const { return papoGeoms; }
2134  const ChildType* const* end() const { return papoGeoms + nGeomCount; }
2135 
2136  // Non standard (OGRGeometry).
2137  virtual const char *getGeometryName() const override;
2138  virtual OGRwkbGeometryType getGeometryType() const override;
2139  virtual OGRGeometry *clone() const override;
2140  virtual void empty() override;
2141  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
2142  virtual void flattenTo2D() override;
2143  virtual OGRBoolean IsEmpty() const override;
2144  virtual void segmentize(double dfMaxLength) override;
2145  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2146  const override;
2147  virtual OGRGeometry* getCurveGeometry(
2148  const char* const* papszOptions = nullptr ) const override;
2149  virtual OGRGeometry* getLinearGeometry(
2150  double dfMaxAngleStepSizeDegrees = 0,
2151  const char* const* papszOptions = nullptr ) const override;
2152 
2153  // IWks Interface
2154  virtual int WkbSize() const override;
2155  virtual OGRErr importFromWkb( const unsigned char *,
2156  int,
2157  OGRwkbVariant,
2158  int& nBytesConsumedOut ) override;
2159  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2161  const override;
2163  OGRErr importFromWkt( const char ** ) override;
2164 
2165  virtual OGRErr exportToWkt( char ** ppszDstText,
2167  const override;
2168 
2169  virtual double get_Length() const;
2170  virtual double get_Area() const;
2171 
2172  // IGeometry methods
2173  virtual int getDimension() const override;
2174  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2175  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2176 
2177  // IGeometryCollection
2178  int getNumGeometries() const;
2179  OGRGeometry *getGeometryRef( int );
2180  const OGRGeometry *getGeometryRef( int ) const;
2181 
2182  // ISpatialRelation
2183  virtual OGRBoolean Equals( const OGRGeometry * ) const override;
2184 
2185  // Non standard
2186  virtual void setCoordinateDimension( int nDimension ) override;
2187  virtual void set3D( OGRBoolean bIs3D ) override;
2188  virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2189  virtual OGRErr addGeometry( const OGRGeometry * );
2190  virtual OGRErr addGeometryDirectly( OGRGeometry * );
2191  virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2192 
2193  virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2194 
2195  void closeRings() override;
2196 
2197  virtual void swapXY() override;
2198 
2199  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2200  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2201 
2202  static OGRGeometryCollection* CastToGeometryCollection(
2203  OGRGeometryCollection* poSrc );
2204 };
2205 
2207 
2208 inline const OGRGeometryCollection::ChildType* const * begin(const OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2210 inline const OGRGeometryCollection::ChildType* const * end(const OGRGeometryCollection* poGeom) { return poGeom->end(); }
2211 
2213 inline OGRGeometryCollection::ChildType** begin(OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2215 inline OGRGeometryCollection::ChildType** end(OGRGeometryCollection* poGeom) { return poGeom->end(); }
2217 
2218 /************************************************************************/
2219 /* OGRMultiSurface */
2220 /************************************************************************/
2221 
2229 {
2230  protected:
2231  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2232  const override;
2233 
2234  public:
2235  OGRMultiSurface();
2236  OGRMultiSurface( const OGRMultiSurface& other );
2237  ~OGRMultiSurface() override;
2238 
2239  OGRMultiSurface& operator=( const OGRMultiSurface& other );
2240 
2243 
2247  ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2249  ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2253  const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2255  const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2256 
2257  // Non standard (OGRGeometry).
2258  virtual const char *getGeometryName() const override;
2259  virtual OGRwkbGeometryType getGeometryType() const override;
2261  OGRErr importFromWkt( const char ** ) override;
2262 
2263  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2264  const override;
2265 
2266  // IMultiSurface methods
2267  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
2268 
2269  // IGeometry methods
2270  virtual int getDimension() const override;
2271 
2272  // Non standard
2273  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2274  const override;
2275 
2277  inline OGRGeometryCollection* toUpperClass() { return this; }
2279  inline const OGRGeometryCollection* toUpperClass() const { return this; }
2280 
2281  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2282  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2283 
2284  static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
2285 };
2286 
2288 
2289 inline const OGRMultiSurface::ChildType* const * begin(const OGRMultiSurface* poGeom) { return poGeom->begin(); }
2291 inline const OGRMultiSurface::ChildType* const * end(const OGRMultiSurface* poGeom) { return poGeom->end(); }
2292 
2294 inline OGRMultiSurface::ChildType** begin(OGRMultiSurface* poGeom) { return poGeom->begin(); }
2296 inline OGRMultiSurface::ChildType** end(OGRMultiSurface* poGeom) { return poGeom->end(); }
2298 
2299 /************************************************************************/
2300 /* OGRMultiPolygon */
2301 /************************************************************************/
2302 
2307 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
2308 {
2309  protected:
2310  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2311  const override;
2312  friend class OGRPolyhedralSurface;
2313  friend class OGRTriangulatedSurface;
2314 
2315  private:
2317  OGRErr _addGeometryWithExpectedSubGeometryType(
2318  const OGRGeometry * poNewGeom,
2319  OGRwkbGeometryType eSubGeometryType );
2320  OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
2321  OGRGeometry * poNewGeom,
2322  OGRwkbGeometryType eSubGeometryType );
2324 
2325 
2326  public:
2327  OGRMultiPolygon();
2328  OGRMultiPolygon( const OGRMultiPolygon& other );
2329  ~OGRMultiPolygon() override;
2330 
2331  OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
2332 
2335 
2339  ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2341  ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2345  const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2347  const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2348 
2349  // Non-standard (OGRGeometry).
2350  virtual const char *getGeometryName() const override;
2351  virtual OGRwkbGeometryType getGeometryType() const override;
2352  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2353  const override;
2354 
2355  // Non standard
2356  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2357  const override;
2358 
2360  inline OGRGeometryCollection* toUpperClass() { return this; }
2362  inline const OGRGeometryCollection* toUpperClass() const { return this; }
2363 
2364  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2365  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2366 
2367  static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
2368 };
2369 
2371 
2372 inline const OGRMultiPolygon::ChildType* const * begin(const OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2374 inline const OGRMultiPolygon::ChildType* const * end(const OGRMultiPolygon* poGeom) { return poGeom->end(); }
2375 
2377 inline OGRMultiPolygon::ChildType** begin(OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2379 inline OGRMultiPolygon::ChildType** end(OGRMultiPolygon* poGeom) { return poGeom->end(); }
2381 
2382 /************************************************************************/
2383 /* OGRPolyhedralSurface */
2384 /************************************************************************/
2385 
2392 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
2393 {
2394  protected:
2396  friend class OGRTriangulatedSurface;
2397  OGRMultiPolygon oMP;
2398  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
2399  const override;
2400  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
2401  const override;
2402  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2403  virtual const char* getSubGeometryName() const;
2404  virtual OGRwkbGeometryType getSubGeometryType() const;
2405  OGRErr exportToWktInternal (char ** ppszDstText, OGRwkbVariant eWkbVariant,
2406  const char* pszSkipPrefix ) const;
2407 
2408  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2409  const;
2410  static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
2412 
2413  public:
2415  OGRPolyhedralSurface( const OGRPolyhedralSurface &poGeom );
2416  ~OGRPolyhedralSurface() override;
2418 
2421 
2425  ChildType** begin() { return oMP.begin(); }
2427  ChildType** end() { return oMP.end(); }
2431  const ChildType* const* begin() const { return oMP.begin(); }
2433  const ChildType* const* end() const { return oMP.end(); }
2434 
2435  // IWks Interface.
2436  virtual int WkbSize() const override;
2437  virtual const char *getGeometryName() const override;
2438  virtual OGRwkbGeometryType getGeometryType() const override;
2439  virtual OGRErr importFromWkb( const unsigned char *,
2440  int,
2441  OGRwkbVariant,
2442  int& nBytesConsumedOut ) override;
2443  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2445  const override;
2447  OGRErr importFromWkt( const char ** ) override;
2448  virtual OGRErr exportToWkt( char ** ppszDstText,
2450  const override;
2451 
2452  // IGeometry methods.
2453  virtual int getDimension() const override;
2454 
2455  virtual void empty() override;
2456 
2457  virtual OGRGeometry *clone() const override;
2458  virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2459  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2460 
2461  virtual void flattenTo2D() override;
2462  virtual OGRErr transform( OGRCoordinateTransformation* ) override;
2463  virtual OGRBoolean Equals( const OGRGeometry* ) const override;
2464  virtual double get_Area() const override;
2465  virtual OGRErr PointOnSurface( OGRPoint* ) const override;
2466 
2468  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2469  const override;
2470  virtual OGRErr addGeometry( const OGRGeometry * );
2471  OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
2472  int getNumGeometries() const;
2473  OGRGeometry* getGeometryRef(int i);
2474  const OGRGeometry* getGeometryRef(int i) const;
2475 
2476  virtual OGRBoolean IsEmpty() const override;
2477  virtual void setCoordinateDimension( int nDimension ) override;
2478  virtual void set3D( OGRBoolean bIs3D ) override;
2479  virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2480  virtual void swapXY() override;
2481  OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2482 
2483  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2484  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2485 
2486  virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2487 };
2488 
2490 
2491 inline const OGRPolyhedralSurface::ChildType* const * begin(const OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2493 inline const OGRPolyhedralSurface::ChildType* const * end(const OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2494 
2496 inline OGRPolyhedralSurface::ChildType** begin(OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2498 inline OGRPolyhedralSurface::ChildType** end(OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2500 
2501 /************************************************************************/
2502 /* OGRTriangulatedSurface */
2503 /************************************************************************/
2504 
2512 {
2513  protected:
2515  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2516  const override;
2517  virtual const char* getSubGeometryName() const override;
2518  virtual OGRwkbGeometryType getSubGeometryType() const override;
2519 
2520  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2521  const override;
2522  static OGRMultiPolygon *
2523  CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
2525 
2526  public:
2530 
2533 
2537  ChildType** begin() { return reinterpret_cast<ChildType**>(oMP.begin()); }
2539  ChildType** end() { return reinterpret_cast<ChildType**>(oMP.end()); }
2543  const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oMP.begin()); }
2545  const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oMP.end()); }
2546 
2547  OGRTriangulatedSurface& operator=( const OGRTriangulatedSurface& other );
2548  virtual const char *getGeometryName() const override;
2549  virtual OGRwkbGeometryType getGeometryType() const override;
2550 
2551  // IWks Interface.
2552  virtual OGRErr addGeometry( const OGRGeometry * ) override;
2553 
2555  inline OGRPolyhedralSurface* toUpperClass() { return this; }
2557  inline const OGRPolyhedralSurface* toUpperClass() const { return this; }
2558 
2559  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2560  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2561 
2562  static OGRPolyhedralSurface *
2563  CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
2564 };
2565 
2567 
2568 inline const OGRTriangulatedSurface::ChildType* const * begin(const OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2570 inline const OGRTriangulatedSurface::ChildType* const * end(const OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2571 
2573 inline OGRTriangulatedSurface::ChildType** begin(OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2575 inline OGRTriangulatedSurface::ChildType** end(OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2577 
2578 /************************************************************************/
2579 /* OGRMultiPoint */
2580 /************************************************************************/
2581 
2586 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
2587 {
2588  private:
2589  OGRErr importFromWkt_Bracketed( const char **, int bHasM, int bHasZ );
2590 
2591  protected:
2592  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2593  const override;
2594 
2595  public:
2596  OGRMultiPoint();
2597  OGRMultiPoint(const OGRMultiPoint& other);
2598  ~OGRMultiPoint() override;
2599 
2600  OGRMultiPoint& operator=(const OGRMultiPoint& other);
2601 
2604 
2608  ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2610  ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2614  const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2616  const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2617 
2618  // Non-standard (OGRGeometry).
2619  virtual const char *getGeometryName() const override;
2620  virtual OGRwkbGeometryType getGeometryType() const override;
2622  OGRErr importFromWkt( const char ** ) override;
2623  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2624  const override;
2625 
2626  // IGeometry methods.
2627  virtual int getDimension() const override;
2628 
2630  inline OGRGeometryCollection* toUpperClass() { return this; }
2632  inline const OGRGeometryCollection* toUpperClass() const { return this; }
2633 
2634  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2635  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2636 
2637  // Non-standard.
2638  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2639  const override;
2640 };
2641 
2643 
2644 inline const OGRMultiPoint::ChildType* const * begin(const OGRMultiPoint* poGeom) { return poGeom->begin(); }
2646 inline const OGRMultiPoint::ChildType* const * end(const OGRMultiPoint* poGeom) { return poGeom->end(); }
2647 
2649 inline OGRMultiPoint::ChildType** begin(OGRMultiPoint* poGeom) { return poGeom->begin(); }
2651 inline OGRMultiPoint::ChildType** end(OGRMultiPoint* poGeom) { return poGeom->end(); }
2653 
2654 /************************************************************************/
2655 /* OGRMultiCurve */
2656 /************************************************************************/
2657 
2664 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
2665 {
2666  protected:
2668  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
2669  OGRCurve* poCurve );
2671  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2672  const override;
2673 
2674  public:
2675  OGRMultiCurve();
2676  OGRMultiCurve( const OGRMultiCurve& other );
2677  ~OGRMultiCurve() override;
2678 
2679  OGRMultiCurve& operator=( const OGRMultiCurve& other );
2680 
2683 
2687  ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2689  ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2693  const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2695  const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2696 
2697  // Non standard (OGRGeometry).
2698  virtual const char *getGeometryName() const override;
2699  virtual OGRwkbGeometryType getGeometryType() const override;
2701  OGRErr importFromWkt( const char ** ) override;
2702  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2703  const override;
2704 
2705  // IGeometry methods.
2706  virtual int getDimension() const override;
2707 
2708  // Non-standard.
2709  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2710  const override;
2711 
2713  inline OGRGeometryCollection* toUpperClass() { return this; }
2715  inline const OGRGeometryCollection* toUpperClass() const { return this; }
2716 
2717  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2718  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2719 
2720  static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
2721 };
2722 
2724 
2725 inline const OGRMultiCurve::ChildType* const * begin(const OGRMultiCurve* poGeom) { return poGeom->begin(); }
2727 inline const OGRMultiCurve::ChildType* const * end(const OGRMultiCurve* poGeom) { return poGeom->end(); }
2728 
2730 inline OGRMultiCurve::ChildType** begin(OGRMultiCurve* poGeom) { return poGeom->begin(); }
2732 inline OGRMultiCurve::ChildType** end(OGRMultiCurve* poGeom) { return poGeom->end(); }
2734 
2735 /************************************************************************/
2736 /* OGRMultiLineString */
2737 /************************************************************************/
2738 
2743 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
2744 {
2745  protected:
2746  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2747  const override;
2748 
2749  public:
2751  OGRMultiLineString( const OGRMultiLineString& other );
2752  ~OGRMultiLineString() override;
2753 
2754  OGRMultiLineString& operator=( const OGRMultiLineString& other );
2755 
2758 
2762  ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2764  ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2768  const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2770  const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2771 
2772  // Non standard (OGRGeometry).
2773  virtual const char *getGeometryName() const override;
2774  virtual OGRwkbGeometryType getGeometryType() const override;
2775  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2776  const override;
2777 
2778  // Non standard
2779  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2780  const override;
2781 
2783  inline OGRGeometryCollection* toUpperClass() { return this; }
2785  inline const OGRGeometryCollection* toUpperClass() const { return this; }
2786 
2787  virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2788  virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2789 
2790  static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
2791 };
2792 
2794 
2795 inline const OGRMultiLineString::ChildType* const * begin(const OGRMultiLineString* poGeom) { return poGeom->begin(); }
2797 inline const OGRMultiLineString::ChildType* const * end(const OGRMultiLineString* poGeom) { return poGeom->end(); }
2798 
2800 inline OGRMultiLineString::ChildType** begin(OGRMultiLineString* poGeom) { return poGeom->begin(); }
2802 inline OGRMultiLineString::ChildType** end(OGRMultiLineString* poGeom) { return poGeom->end(); }
2804 
2805 /************************************************************************/
2806 /* OGRGeometryFactory */
2807 /************************************************************************/
2808 
2813 class CPL_DLL OGRGeometryFactory
2814 {
2815  static OGRErr createFromFgfInternal( const unsigned char *pabyData,
2816  OGRSpatialReference * poSR,
2817  OGRGeometry **ppoReturn,
2818  int nBytes,
2819  int *pnBytesConsumed,
2820  int nRecLevel );
2821  public:
2822  static OGRErr createFromWkb( const void *, OGRSpatialReference *,
2823  OGRGeometry **, int = -1,
2825  static OGRErr createFromWkb( const void * pabyData,
2827  OGRGeometry **,
2828  int nSize,
2829  OGRwkbVariant eVariant,
2830  int& nBytesConsumedOut );
2831  static OGRErr createFromWkt( const char* , OGRSpatialReference *,
2832  OGRGeometry ** );
2833  static OGRErr createFromWkt( const char **, OGRSpatialReference *,
2834  OGRGeometry ** );
2838  static OGRErr createFromWkt( char ** ppszInput, OGRSpatialReference * poSRS,
2839  OGRGeometry ** ppoGeom )
2840  CPL_WARN_DEPRECATED("Use createFromWkt(const char**, ...) instead")
2841  {
2842  return createFromWkt( const_cast<const char**>(ppszInput), poSRS, ppoGeom);
2843  }
2844 
2845  static OGRErr createFromFgf( const void*, OGRSpatialReference *,
2846  OGRGeometry **, int = -1, int * = nullptr );
2847  static OGRGeometry *createFromGML( const char * );
2848  static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
2849  GEOSGeom );
2850  static OGRGeometry *createFromGeoJson( const char *);
2851  static OGRGeometry *createFromGeoJson( const CPLJSONObject &oJSONObject );
2852 
2853  static void destroyGeometry( OGRGeometry * );
2854  static OGRGeometry *createGeometry( OGRwkbGeometryType );
2855 
2856  static OGRGeometry * forceToPolygon( OGRGeometry * );
2857  static OGRGeometry * forceToLineString( OGRGeometry *,
2858  bool bOnlyInOrder = true );
2859  static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
2860  static OGRGeometry * forceToMultiPoint( OGRGeometry * );
2861  static OGRGeometry * forceToMultiLineString( OGRGeometry * );
2862 
2863  static OGRGeometry * forceTo( OGRGeometry* poGeom,
2864  OGRwkbGeometryType eTargetType,
2865  const char*const* papszOptions = nullptr );
2866 
2867  static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
2868  int nPolygonCount,
2869  int *pbResultValidGeometry,
2870  const char **papszOptions = nullptr);
2871  static bool haveGEOS();
2872 
2873  static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
2875  char** papszOptions );
2876 
2877  static OGRGeometry*
2878  approximateArcAngles( double dfX, double dfY, double dfZ,
2879  double dfPrimaryRadius, double dfSecondaryAxis,
2880  double dfRotation,
2881  double dfStartAngle, double dfEndAngle,
2882  double dfMaxAngleStepSizeDegrees );
2883 
2884  static int GetCurveParmeters( double x0, double y0,
2885  double x1, double y1,
2886  double x2, double y2,
2887  double& R, double& cx, double& cy,
2888  double& alpha0, double& alpha1,
2889  double& alpha2 );
2890  static OGRLineString* curveToLineString(
2891  double x0, double y0, double z0,
2892  double x1, double y1, double z1,
2893  double x2, double y2, double z2,
2894  int bHasZ,
2895  double dfMaxAngleStepSizeDegrees,
2896  const char* const * papszOptions = nullptr );
2897  static OGRCurve* curveFromLineString(
2898  const OGRLineString* poLS,
2899  const char* const * papszOptions = nullptr);
2900 };
2901 
2902 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
2903 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
2904 
2906 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
2909 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
2910 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
2911  const OGRGeometry* poOtherGeom );
2912 int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
2913  const OGRGeometry* poOtherGeom );
2914 
2916 struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
2917 {
2918  void operator()(OGRPreparedGeometry*) const;
2919 };
2921 
2925 typedef std::unique_ptr<OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter> OGRPreparedGeometryUniquePtr;
2926 
2927 #endif /* ndef OGR_GEOMETRY_H_INCLUDED */
const OGRPolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2070
OGRMultiPoint * toMultiPoint()
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:691
virtual const char * getGeometryName() const override
Returns the geometry name of the TriangulatedSurface.
Definition: ogrtriangulatedsurface.cpp:120
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:1734
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrpolyhedralsurface.cpp:360
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:1955
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1102
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrtriangle.cpp:193
~OGRPolyhedralSurface() override
Destructor.
Definition: ogrpolyhedralsurface.cpp:74
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:4821
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2632
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2608
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2693
const OGRPolyhedralSurface * toPolyhedralSurface() const
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:768
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrpolygon.cpp:840
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
Definition: ogrcurvepolygon.cpp:622
OGRMultiLineString * toMultiLineString()
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:705
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2484
double y
y
Definition: ogr_geometry.h:75
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrtriangle.cpp:156
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:1796
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrpolygon.cpp:623
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1241
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:2603
OGRCompoundCurve * toCompoundCurve()
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:607
static OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
Definition: ogr_geometry.h:510
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1284
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1879
double getX() const
Return x.
Definition: ogr_geometry.h:852
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1285
OGRCurve * toCurve()
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:537
const OGRPolygon * toPolygon() const
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:642
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrpolyhedralsurface.cpp:621
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2255
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:2813
OGRMultiPolygon * toMultiPolygon()
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:719
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrpolyhedralsurface.cpp:146
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1363
double x
x
Definition: ogr_geometry.h:73
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2762
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2768
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:661
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2764
virtual void set3D(OGRBoolean bIs3D) override
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:697
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1461
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=nullptr) const CPL_WARN_UNUSED_RESULT
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3141
const OGRLinearRing * toLinearRing() const
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:586
OGRPolyhedralSurface()
Create an empty PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:47
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2483
OGRMultiSurface * toMultiSurface()
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:747
virtual void set3D(OGRBoolean bIs3D) override
Set the type as 3D geometry.
Definition: ogrpolyhedralsurface.cpp:986
static OGRGeometry * FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
Definition: ogr_geometry.h:516
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrcurvepolygon.cpp:691
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:1803
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2281
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
Definition: ogrpolyhedralsurface.cpp:200
OGRCurve * stealExteriorRingCurve()
"Steal" reference to external ring.
Definition: ogrcurvepolygon.cpp:310
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:3106
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2364
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:1953
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:306
OGRCurve * getExteriorRingCurve()
Fetch reference to external polygon ring.
Definition: ogrcurvepolygon.cpp:204
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:831
const OGRCircularString * toCircularString() const
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:600
OGRErr removeRing(int iIndex, bool bDelete=true)
Remove a geometry from the container.
Definition: ogrcurvepolygon.cpp:342
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:833
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:213
Coordinate systems services.
virtual OGRBoolean IsEmpty() const override
Checks if the PolyhedralSurface is empty.
Definition: ogrpolyhedralsurface.cpp:973
OGRTriangulatedSurface * toTriangulatedSurface()
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:775
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1462
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:67
OGRSurface ChildType
Type of child elements.
Definition: ogr_geometry.h:2242
const OGRLineString * toLineString() const
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:572
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:1947
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrcurvepolygon.cpp:711
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:2307
const OGRCompoundCurve * toCompoundCurve() const
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:614
OGRPoint * toPoint()
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:523
virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:729
int OGRHasPreparedGeometrySupport()
Returns if GEOS has prepared geometry support.
Definition: ogrgeometry.cpp:5559
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2614
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:1629
virtual OGRGeometry * clone() const override
Make a copy of this object.
Definition: ogrcurvepolygon.cpp:106
OGRwkbByteOrder
Enumeration to describe byte order.
Definition: ogr_core.h:489
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:1394
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2682
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:925
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:2091
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2718
OGRLineString * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1358
Concrete representation of a closed ring.
Definition: ogr_geometry.h:1312
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:878
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1801
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrpolyhedralsurface.cpp:1022
OGRTriangle ChildType
Type of child elements.
Definition: ogr_geometry.h:2532
OGRCircularString * toCircularString()
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:593
static OGRErr createFromWkt(char **ppszInput, OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
Definition: ogr_geometry.h:2838
virtual void setMeasured(OGRBoolean bIsMeasured) override
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:702
const OGRTriangle * toTriangle() const
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:656
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2249
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:1949
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2559
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 void visit(const OGRPoint *)=0
Visit OGRPoint.
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2770
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2689
virtual int WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolygon.cpp:300
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrpolyhedralsurface.cpp:714
OGRGeometry visitor interface.
Definition: ogr_geometry.h:117
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2687
const OGRCurvePolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2002
OGRSurface * toSurface()
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:621
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:2228
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:551
virtual OGRErr addGeometry(const OGRGeometry *) override
Add a new geometry to a collection.
Definition: ogrtriangulatedsurface.cpp:184
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2545
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:1623
const ChildType *const * begin() const
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2132
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGCgeometry format type to corresponding OGR constants.
Definition: ogrgeometry.cpp:2284
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:1160
void visit(OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:170
OGRLineString ChildType
Type of child elements.
Definition: ogr_geometry.h:2757
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
Definition: ogrpolyhedralsurface.cpp:882
Utility class to store a collection of curves.
Definition: ogr_geometry.h:1579
Simple container for a position.
Definition: ogr_geometry.h:63
OGRPolyhedralSurface * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2555
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:317
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:1809
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2560
OGRCurvePolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2000
const OGRPoint * toPoint() const
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:530
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2785
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2199
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1621
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1006
Interface for a point iterator.
Definition: ogr_geometry.h:907
TriangulatedSurface class.
Definition: ogr_geometry.h:2511
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2634
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1459
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrpolyhedralsurface.cpp:1037
A collection of OGRCurve.
Definition: ogr_geometry.h:2664
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2362
virtual double get_AreaOfCurveSegments() const override
Return area of curve segments.
Definition: ogrcompoundcurve.cpp:904
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2200
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:1724
OGRGeometry visitor interface.
Definition: ogr_geometry.h:191
A collection of OGRLineString.
Definition: ogr_geometry.h:2743
OGRCurvePolygon * toCurvePolygon()
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:663
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:286
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2282
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2783
OGRMultiCurve * toMultiCurve()
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:733
OGRPolyhedralSurface * toPolyhedralSurface()
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:761
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2635
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:865
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2279
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:83
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2537
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2004
OGRTriangle & operator=(const OGRTriangle &other)
Assignment operator.
Definition: ogrtriangle.cpp:143
double getM() const
Return m.
Definition: ogr_geometry.h:858
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:1807
void OGRDestroyPreparedGeometry(OGRPreparedGeometry *poPreparedGeom)
Destroys a prepared geometry.
Definition: ogrgeometry.cpp:5615
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:398
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:79
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:164
virtual int getNumPoints() const override
Fetch vertex count.
Definition: ogr_geometry.h:1158
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrcurvepolygon.cpp:168
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrpolyhedralsurface.cpp:218
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2339
virtual void empty() override
Clear geometry information.
Definition: ogrcurvepolygon.cpp:131
OGRTriangle * toTriangle()
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:649
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:873
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:1073
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:968
virtual double get_Area() const override
Get the area of the surface object.
Definition: ogrcurvepolygon.cpp:671
double getY() const
Return y.
Definition: ogr_geometry.h:854
Core portability services for cross-platform OGR code.
virtual int IntersectsPoint(const OGRPoint *p) const
Returns if a point intersects a (closed) curve.
Definition: ogrcurve.cpp:418
ChildType ** end()
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2128
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1362
virtual void setMeasured(OGRBoolean bIsMeasured) override
Set the type as Measured.
Definition: ogrpolyhedralsurface.cpp:1001
OGRLineString * toLineString()
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:565
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrpolygon.cpp:447
int OGRPreparedGeometryIntersects(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry intersects with a geometry.
Definition: ogrgeometry.cpp:5637
Concrete class representing curve polygons.
Definition: ogr_geometry.h:1759
OGRLinearRing * toLinearRing()
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:579
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:364
const OGRTriangulatedSurface * toTriangulatedSurface() const
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:782
virtual OGRGeometry * clone() const override
Make a copy of this object.
Definition: ogrpolyhedralsurface.cpp:173
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:241
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:558
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolyhedralsurface.cpp:1047
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2073
PolyhedralSurface class.
Definition: ogr_geometry.h:2392
const OGRMultiCurve * toMultiCurve() const
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:740
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2431
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2713
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrcurvepolygon.cpp:158
Various convenience functions for CPL.
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:869
virtual void visit(OGRPoint *)=0
Visit OGRPoint.
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:145
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2630
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:1616
struct _OGRPreparedGeometry OGRPreparedGeometry
Prepared geometry API (needs GEOS >= 3.1.0)
Definition: ogr_geometry.h:2906
Old-style 99-402 extended dimension (Z) WKB types.
Definition: ogr_core.h:425
virtual OGRErr transform(OGRCoordinateTransformation *) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrpolyhedralsurface.cpp:633
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2247
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2433
const OGRGeometryCollection * toGeometryCollection() const
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:684
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:1161
OGRCurvePolygon()
Create an empty curve polygon.
Definition: ogrcurvepolygon.cpp:52
const OGRMultiPoint * toMultiPoint() const
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:698
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2277
std::unique_ptr< OGRGeometry, OGRGeometryUniquePtrDeleter > OGRGeometryUniquePtr
Unique pointer type for OGRGeometry.
Definition: ogr_geometry.h:797
Interface for read and write JSON documents.
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:743
OGRPreparedGeometry * OGRCreatePreparedGeometry(const OGRGeometry *poGeom)
Creates a prepared geometry.
Definition: ogrgeometry.cpp:5579
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2005
const OGRPolyhedralSurface * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2557
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:892
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolygon.cpp:374
virtual void empty() override
Clear geometry information.
Definition: ogrpolyhedralsurface.cpp:155
virtual OGRBoolean Intersects(const OGRGeometry *) const override
Do these features intersect?
Definition: ogrcurvepolygon.cpp:802
Point class.
Definition: ogr_geometry.h:809
void * OGRGeometryH
Opaque type for a geometry.
Definition: ogr_api.h:60
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2787
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2616
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:423
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:847
OGRErr importFromWkt(char **ppszInput) CPL_WARN_DEPRECATED("Use importFromWkt( const char**) instead")
Deprecated.
Definition: ogr_geometry.h:386
const OGRSurface * toSurface() const
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:628
OGRSpatialReference * getSpatialReference(void) const
Returns spatial reference system for object.
Definition: ogr_geometry.h:434
OGRLinearRing ChildType
Type of child elements.
Definition: ogr_geometry.h:1942
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2695
virtual OGRwkbGeometryType getGeometryType() const override
Returns the WKB Type of TriangulatedSurface.
Definition: ogrtriangulatedsurface.cpp:134
const OGRCurvePolygon * toCurvePolygon() const
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:670
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2360
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1001
OGRPolygon * toPolygon()
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:635
Concrete class representing polygons.
Definition: ogr_geometry.h:1909
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:1034
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2715
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
Definition: ogr_geometry.h:81
OGRGeometryCollection * toGeometryCollection()
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:677
OGRGeometry ChildType
Type of child elements.
Definition: ogr_geometry.h:2121
virtual double get_Area() const override
Returns the area enclosed.
Definition: ogrpolyhedralsurface.cpp:754
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:238
OGRTriangulatedSurface & operator=(const OGRTriangulatedSurface &other)
Assignment operator.
Definition: ogrtriangulatedsurface.cpp:88
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolyhedralsurface.cpp:310
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:70
virtual void closeRings() override
Force rings to be closed.
Definition: ogrpolygon.cpp:809
void visit(const OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:244
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:673
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1280
const OGRCurve * toCurve() const
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:544
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2334
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2427
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:825
const OGRMultiSurface * toMultiSurface() const
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:754
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2341
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2253
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1457
std::unique_ptr< OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter > OGRPreparedGeometryUniquePtr
Unique pointer type for OGRPreparedGeometry.
Definition: ogr_geometry.h:2925
OGRPolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2068
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:285
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:720
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2347
int OGRPreparedGeometryContains(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry contains a geometry.
Definition: ogrgeometry.cpp:5667
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:891
virtual OGRErr addRing(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:365
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrpolyhedralsurface.cpp:456
virtual int WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolyhedralsurface.cpp:132
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1697
Triangle class.
Definition: ogr_geometry.h:2032
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2425
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2420
const ChildType *const * end() const
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2134
const OGRLineString * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1360
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:290
bool operator==(const OGRGeometry &other) const
Returns if two geometries are equal.
Definition: ogr_geometry.h:349
virtual OGRBoolean Contains(const OGRGeometry *) const override
Test for containment.
Definition: ogrcurvepolygon.cpp:786
virtual OGRErr PointOnSurface(OGRPoint *) const override
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogrpolyhedralsurface.cpp:781
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2610
const OGRMultiPolygon * toMultiPolygon() const
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:726
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2788
bool operator!=(const OGRGeometry &other) const
Returns if two geometries are different.
Definition: ogr_geometry.h:352
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:914
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:1627
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition: ogrgeometry.cpp:2357
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:290
const OGRMultiLineString * toMultiLineString() const
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:712
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrtriangle.cpp:165
A collection of OGRPoint.
Definition: ogr_geometry.h:2586
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1878
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrpolyhedralsurface.cpp:1082
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2543
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2345
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2365
double getZ() const
Return z.
Definition: ogr_geometry.h:856
OGRBoolean Is3D() const
Definition: ogr_geometry.h:362
OGRCurve * getInteriorRingCurve(int)
Fetch reference to indicated internal ring.
Definition: ogrcurvepolygon.cpp:269
ChildType ** begin()
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2126
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1282
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1698
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2539
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:820
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2717
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:929
OGRGeometry * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:936
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2072
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:642

Generated for GDAL by doxygen 1.8.13.