GDAL
ogr_geometry.h
Go to the documentation of this file.
1 /******************************************************************************
2  * $Id: ogr_geometry.h 37472 2017-02-26 02:47:45Z goatbar $
3  *
4  * Project: OpenGIS Simple Features Reference Implementation
5  * Purpose: Classes for manipulating simple features that is not specific
6  * to a particular interface technology.
7  * Author: Frank Warmerdam, warmerdam@pobox.com
8  *
9  ******************************************************************************
10  * Copyright (c) 1999, Frank Warmerdam
11  * Copyright (c) 2008-2014, Even Rouault <even dot rouault at mines-paris dot org>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  ****************************************************************************/
31 
32 #ifndef OGR_GEOMETRY_H_INCLUDED
33 #define OGR_GEOMETRY_H_INCLUDED
34 
35 #include "ogr_core.h"
36 #include "ogr_spatialref.h"
37 
48 {
49  public:
51  OGRRawPoint() : x(0.0), y(0.0) {}
52 
54  OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn) {}
55 
57  double x;
59  double y;
60 };
61 
63 typedef struct GEOSGeom_t *GEOSGeom;
65 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
67 typedef void sfcgal_geometry_t;
68 
69 class OGRPoint;
70 class OGRCurve;
71 class OGRCompoundCurve;
72 class OGRLinearRing;
73 class OGRLineString;
74 class OGRSurface;
75 class OGRCurvePolygon;
76 class OGRPolygon;
77 class OGRMultiSurface;
78 class OGRMultiPolygon;
79 class OGRMultiCurve;
80 class OGRMultiLineString;
81 class OGRTriangle;
84 
86 typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
87 typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
88 
89 typedef OGRPolygon* (*OGRSurfaceCasterToPolygon)(OGRSurface*);
90 typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
91 typedef OGRMultiPolygon* (*OGRPolyhedralSurfaceCastToMultiPolygon)(OGRPolyhedralSurface*);
93 
94 /************************************************************************/
95 /* OGRGeometry */
96 /************************************************************************/
97 
118 class CPL_DLL OGRGeometry
119 {
120  private:
121  OGRSpatialReference * poSRS; // may be NULL
122 
123  protected:
125  friend class OGRCurveCollection;
126 
127  unsigned int flags;
128 
129  OGRErr importPreambuleFromWkt( char ** ppszInput,
130  int* pbHasZ, int* pbHasM,
131  bool* pbIsEmpty );
132  OGRErr importCurveCollectionFromWkt(
133  char ** ppszInput,
134  int bAllowEmptyComponent,
135  int bAllowLineString,
136  int bAllowCurve,
137  int bAllowCompoundCurve,
138  OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf,
139  OGRCurve* poCurve) );
140  OGRErr importPreambuleFromWkb( unsigned char * pabyData,
141  int nSize,
142  OGRwkbByteOrder& eByteOrder,
143  OGRwkbVariant eWkbVariant );
144  OGRErr importPreambuleOfCollectionFromWkb(
145  unsigned char * pabyData,
146  int& nSize,
147  int& nDataOffset,
148  OGRwkbByteOrder& eByteOrder,
149  int nMinSubGeomSize,
150  int& nGeomCount,
151  OGRwkbVariant eWkbVariant );
152  OGRErr PointOnSurfaceInternal( OGRPoint * poPoint ) const;
153  OGRBoolean IsSFCGALCompatible() const;
155 
156  public:
157 
158 /************************************************************************/
159 /* Bit flags for OGRGeometry */
160 /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
161 /* Do not use these outside of the core. */
162 /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
163 /************************************************************************/
164 
166  static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
167  static const unsigned int OGR_G_3D = 0x2;
168  static const unsigned int OGR_G_MEASURED = 0x4;
170 
171  OGRGeometry();
172  OGRGeometry( const OGRGeometry& other );
173  virtual ~OGRGeometry();
174 
175  OGRGeometry& operator=( const OGRGeometry& other );
176 
177  // Standard IGeometry.
178  virtual int getDimension() const = 0;
179  virtual int getCoordinateDimension() const;
180  int CoordinateDimension() const;
181  virtual OGRBoolean IsEmpty() const = 0;
182  virtual OGRBoolean IsValid() const;
183  virtual OGRBoolean IsSimple() const;
185  OGRBoolean Is3D() const { return flags & OGR_G_3D; }
187  OGRBoolean IsMeasured() const { return flags & OGR_G_MEASURED; }
188  virtual OGRBoolean IsRing() const;
189  virtual void empty() = 0;
190  virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
191  virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
192  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
193 
194  // IWks Interface.
195  virtual int WkbSize() const = 0;
196  virtual OGRErr importFromWkb( unsigned char *, int=-1,
198  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
199  OGRwkbVariant=wkbVariantOldOgc ) const = 0;
200  virtual OGRErr importFromWkt( char ** ppszInput ) = 0;
201  virtual OGRErr exportToWkt( char ** ppszDstText,
202  OGRwkbVariant=wkbVariantOldOgc ) const = 0;
203 
204  // Non-standard.
205  virtual OGRwkbGeometryType getGeometryType() const = 0;
206  OGRwkbGeometryType getIsoGeometryType() const;
207  virtual const char *getGeometryName() const = 0;
208  virtual void dumpReadable( FILE *, const char * = NULL
209  , char** papszOptions = NULL ) const;
210  virtual void flattenTo2D() = 0;
211  virtual char * exportToGML( const char* const * papszOptions = NULL ) const;
212  virtual char * exportToKML() const;
213  virtual char * exportToJson() const;
214 
215  static GEOSContextHandle_t createGEOSContext();
216  static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
217  virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
219  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
220  virtual OGRGeometry* getCurveGeometry(
221  const char* const* papszOptions = NULL ) const CPL_WARN_UNUSED_RESULT;
222  virtual OGRGeometry* getLinearGeometry(
223  double dfMaxAngleStepSizeDegrees = 0,
224  const char* const* papszOptions = NULL ) const CPL_WARN_UNUSED_RESULT;
225 
226  // SFCGAL interfacing methods.
228  static sfcgal_geometry_t* OGRexportToSFCGAL( OGRGeometry *poGeom );
229  static OGRGeometry* SFCGALexportToOGR( sfcgal_geometry_t* _geometry );
231  virtual void closeRings();
232 
233  virtual void setCoordinateDimension( int nDimension );
234  virtual void set3D( OGRBoolean bIs3D );
235  virtual void setMeasured( OGRBoolean bIsMeasured );
236 
237  void assignSpatialReference( OGRSpatialReference * poSR );
238  OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
239 
240  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) = 0;
241  OGRErr transformTo( OGRSpatialReference *poSR );
242 
243  virtual void segmentize(double dfMaxLength);
244 
245  // ISpatialRelation
246  virtual OGRBoolean Intersects( const OGRGeometry * ) const;
247  virtual OGRBoolean Equals( OGRGeometry * ) const = 0;
248  virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
249  virtual OGRBoolean Touches( const OGRGeometry * ) const;
250  virtual OGRBoolean Crosses( const OGRGeometry * ) const;
251  virtual OGRBoolean Within( const OGRGeometry * ) const;
252  virtual OGRBoolean Contains( const OGRGeometry * ) const;
253  virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
254 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
255 // virtual OGRGeometry *LocateAlong( double mValue ) const;
256 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
257 
258  virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
259  virtual double Distance( const OGRGeometry * ) const ;
260  virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
261  virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
262  const CPL_WARN_UNUSED_RESULT;
263  virtual OGRGeometry *Intersection( const OGRGeometry *)
264  const CPL_WARN_UNUSED_RESULT;
265  virtual OGRGeometry *Union( const OGRGeometry * )
266  const CPL_WARN_UNUSED_RESULT;
267  virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
268  virtual OGRGeometry *Difference( const OGRGeometry * )
269  const CPL_WARN_UNUSED_RESULT;
270  virtual OGRGeometry *SymDifference( const OGRGeometry * )
271  const CPL_WARN_UNUSED_RESULT;
272  virtual OGRErr Centroid( OGRPoint * poPoint ) const;
273  virtual OGRGeometry *Simplify(double dTolerance)
274  const CPL_WARN_UNUSED_RESULT;
275  OGRGeometry *SimplifyPreserveTopology(double dTolerance)
276  const CPL_WARN_UNUSED_RESULT;
277  virtual OGRGeometry *DelaunayTriangulation(
278  double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
279 
280  virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
281 
282  virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
283 
285  // backward compatibility to non-standard method names.
286  OGRBoolean Intersect( OGRGeometry * )
287  const CPL_WARN_DEPRECATED("Non standard method. "
288  "Use Intersects() instead");
289  OGRBoolean Equal( OGRGeometry * )
290  const CPL_WARN_DEPRECATED("Non standard method. "
291  "Use Equals() instead");
292  OGRGeometry *SymmetricDifference( const OGRGeometry * )
293  const CPL_WARN_DEPRECATED("Non standard method. "
294  "Use SymDifference() instead");
295  OGRGeometry *getBoundary()
296  const CPL_WARN_DEPRECATED("Non standard method. "
297  "Use Boundary() instead");
299 
301  // Special HACK for DB2 7.2 support
302  static int bGenerate_DB2_V72_BYTE_ORDER;
304 
305  virtual void swapXY();
307  static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
308  static OGRGeometry* CastToError( OGRGeometry* poGeom );
310 };
311 
312 /************************************************************************/
313 /* OGRPoint */
314 /************************************************************************/
315 
322 class CPL_DLL OGRPoint : public OGRGeometry
323 {
324  double x;
325  double y;
326  double z;
327  double m;
328 
329  public:
330  OGRPoint();
331  OGRPoint( double x, double y );
332  OGRPoint( double x, double y, double z );
333  OGRPoint( double x, double y, double z, double m );
334  OGRPoint( const OGRPoint& other );
335  virtual ~OGRPoint();
336 
337  OGRPoint& operator=( const OGRPoint& other );
338 
339  // IWks Interface
340  virtual int WkbSize() const CPL_OVERRIDE;
341  virtual OGRErr importFromWkb( unsigned char *, int=-1,
343  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
345  const CPL_OVERRIDE;
346  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
347  virtual OGRErr exportToWkt( char ** ppszDstText,
349  const CPL_OVERRIDE;
350 
351  // IGeometry
352  virtual int getDimension() const CPL_OVERRIDE;
353  virtual OGRGeometry *clone() const CPL_OVERRIDE;
354  virtual void empty() CPL_OVERRIDE;
355  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
356  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
357  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE
358  { return !(flags & OGR_G_NOT_EMPTY_POINT); }
359 
360  // IPoint
362  double getX() const { return x; }
364  double getY() const { return y; }
366  double getZ() const { return z; }
368  double getM() const { return m; }
369 
370  // Non standard
371  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
375  void setX( double xIn ) { x = xIn; flags |= OGR_G_NOT_EMPTY_POINT; }
379  void setY( double yIn ) { y = yIn; flags |= OGR_G_NOT_EMPTY_POINT; }
383  void setZ( double zIn )
384  { z = zIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_3D); }
388  void setM( double mIn )
389  { m = mIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_MEASURED); }
390 
391  // ISpatialRelation
392  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
393  virtual OGRBoolean Intersects( const OGRGeometry * ) const CPL_OVERRIDE;
394  virtual OGRBoolean Within( const OGRGeometry * ) const CPL_OVERRIDE;
395 
396  // Non standard from OGRGeometry
397  virtual const char *getGeometryName() const CPL_OVERRIDE;
398  virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE;
399  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
400  virtual void flattenTo2D() CPL_OVERRIDE;
401 
402  virtual void swapXY() CPL_OVERRIDE;
403 };
404 
405 /************************************************************************/
406 /* OGRPointIterator */
407 /************************************************************************/
408 
415 class CPL_DLL OGRPointIterator
416 {
417  public:
418  virtual ~OGRPointIterator();
419  virtual OGRBoolean getNextPoint( OGRPoint* p ) = 0;
420 
421  static void destroy( OGRPointIterator* );
422 };
423 
424 /************************************************************************/
425 /* OGRCurve */
426 /************************************************************************/
427 
433 class CPL_DLL OGRCurve : public OGRGeometry
434 {
435  protected:
437  OGRCurve();
438  OGRCurve( const OGRCurve& other );
439 
440  virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
441  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
442 
443  friend class OGRCurvePolygon;
444  friend class OGRCompoundCurve;
446  virtual int ContainsPoint( const OGRPoint* p ) const;
447  virtual double get_AreaOfCurveSegments() const = 0;
448 
449  public:
450  virtual ~OGRCurve();
451 
453  OGRCurve& operator=( const OGRCurve& other );
455 
456  // ICurve methods
457  virtual double get_Length() const = 0;
458  virtual void StartPoint( OGRPoint * ) const = 0;
459  virtual void EndPoint( OGRPoint * ) const = 0;
460  virtual int get_IsClosed() const;
461  virtual void Value( double, OGRPoint * ) const = 0;
462  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
463  const char* const* papszOptions = NULL)
464  const = 0;
465  virtual int getDimension() const CPL_OVERRIDE;
466 
467  // non standard
468  virtual int getNumPoints() const = 0;
469  virtual OGRPointIterator* getPointIterator() const = 0;
470  virtual OGRBoolean IsConvex() const;
471  virtual double get_Area() const = 0;
472 
473  static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
474  static OGRLineString* CastToLineString( OGRCurve* poCurve );
475  static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
476 };
477 
478 /************************************************************************/
479 /* OGRSimpleCurve */
480 /************************************************************************/
481 
491 class CPL_DLL OGRSimpleCurve: public OGRCurve
492 {
493  protected:
495  friend class OGRGeometry;
496 
497  int nPointCount;
498  OGRRawPoint *paoPoints;
499  double *padfZ;
500  double *padfM;
501 
502  void Make3D();
503  void Make2D();
504  void RemoveM();
505  void AddM();
506 
507  OGRErr importFromWKTListOnly( char ** ppszInput, int bHasZ, int bHasM,
508  OGRRawPoint*& paoPointsIn,
509  int& nMaxPoints,
510  double*& padfZIn );
511 
513 
514  virtual double get_LinearArea() const;
515 
516  OGRSimpleCurve();
517  OGRSimpleCurve( const OGRSimpleCurve& other );
518 
519  public:
520  virtual ~OGRSimpleCurve();
521 
522  OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
523 
524  // IWks Interface.
525  virtual int WkbSize() const CPL_OVERRIDE;
526  virtual OGRErr importFromWkb( unsigned char *, int = -1,
528  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
530  const CPL_OVERRIDE;
531  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
532  virtual OGRErr exportToWkt( char ** ppszDstText,
534  const CPL_OVERRIDE;
535 
536  // IGeometry interface.
537  virtual OGRGeometry *clone() const CPL_OVERRIDE;
538  virtual void empty() CPL_OVERRIDE;
539  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
540  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
541  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
542 
543  // ICurve methods.
544  virtual double get_Length() const CPL_OVERRIDE;
545  virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
546  virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
547  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
548  virtual double Project( const OGRPoint * ) const;
549  virtual OGRLineString* getSubLine( double, double, int ) const;
550 
551  // ILineString methods.
552  virtual int getNumPoints() const CPL_OVERRIDE { return nPointCount; }
553  void getPoint( int, OGRPoint * ) const;
554  double getX( int i ) const { return paoPoints[i].x; }
555  double getY( int i ) const { return paoPoints[i].y; }
556  double getZ( int i ) const;
557  double getM( int i ) const;
558 
559  // ISpatialRelation
560  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
561 
562  // non standard.
563  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
564  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
565  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
566  void setNumPoints( int nNewPointCount,
567  int bZeroizeNewContent = TRUE );
568  void setPoint( int, OGRPoint * );
569  void setPoint( int, double, double );
570  void setZ( int, double );
571  void setM( int, double );
572  void setPoint( int, double, double, double );
573  void setPointM( int, double, double, double );
574  void setPoint( int, double, double, double, double );
575  void setPoints( int, OGRRawPoint *, double * = NULL );
576  void setPointsM( int, OGRRawPoint *, double * );
577  void setPoints( int, OGRRawPoint *, double *, double * );
578  void setPoints( int, double * padfX, double * padfY,
579  double *padfZIn = NULL );
580  void setPointsM( int, double * padfX, double * padfY,
581  double *padfMIn = NULL );
582  void setPoints( int, double * padfX, double * padfY,
583  double *padfZIn, double *padfMIn );
584  void addPoint( const OGRPoint * );
585  void addPoint( double, double );
586  void addPoint( double, double, double );
587  void addPointM( double, double, double );
588  void addPoint( double, double, double, double );
589 
590  void getPoints( OGRRawPoint *, double * = NULL ) const;
591  void getPoints( void* pabyX, int nXStride,
592  void* pabyY, int nYStride,
593  void* pabyZ = NULL, int nZStride = 0 ) const;
594  void getPoints( void* pabyX, int nXStride,
595  void* pabyY, int nYStride,
596  void* pabyZ, int nZStride,
597  void* pabyM, int nMStride ) const;
598 
599  void addSubLineString( const OGRLineString *,
600  int nStartVertex = 0, int nEndVertex = -1 );
601  void reversePoints( void );
602  virtual OGRPointIterator* getPointIterator() const CPL_OVERRIDE;
603 
604  // non-standard from OGRGeometry
605  virtual OGRErr transform( OGRCoordinateTransformation *poCT ) CPL_OVERRIDE;
606  virtual void flattenTo2D() CPL_OVERRIDE;
607  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
608 
609  virtual void swapXY() CPL_OVERRIDE;
610 };
611 
612 /************************************************************************/
613 /* OGRLineString */
614 /************************************************************************/
615 
623 class CPL_DLL OGRLineString : public OGRSimpleCurve
624 {
625  protected:
627  static OGRLineString* TransferMembersAndDestroy(
628  OGRLineString* poSrc,
629  OGRLineString* poDst);
630 
631  virtual OGRCurveCasterToLineString GetCasterToLineString()
632  const CPL_OVERRIDE;
633  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
634  const CPL_OVERRIDE;
635 
636  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
638 
639  static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
640 
641  public:
642  OGRLineString();
643  OGRLineString( const OGRLineString& other );
644  virtual ~OGRLineString();
645 
646  OGRLineString& operator=(const OGRLineString& other);
647 
648  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
649  const char* const* papszOptions = NULL )
650  const CPL_OVERRIDE;
651  virtual OGRGeometry* getCurveGeometry(
652  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
653  virtual double get_Area() const CPL_OVERRIDE;
654 
655  // Non-standard from OGRGeometry.
657  virtual const char *getGeometryName() const CPL_OVERRIDE;
658 };
659 
660 /************************************************************************/
661 /* OGRLinearRing */
662 /************************************************************************/
663 
684 class CPL_DLL OGRLinearRing : public OGRLineString
685 {
686  protected:
688  friend class OGRPolygon;
689  friend class OGRTriangle;
690 
691  // These are not IWks compatible ... just a convenience for OGRPolygon.
692  virtual int _WkbSize( int _flags ) const;
693  virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
694  unsigned char *, int=-1 );
695  virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
696  unsigned char * ) const;
697 
698  virtual OGRCurveCasterToLineString GetCasterToLineString()
699  const CPL_OVERRIDE;
700  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
701  const CPL_OVERRIDE;
703 
705 
706  public:
707  OGRLinearRing();
708  OGRLinearRing( const OGRLinearRing& other );
709  explicit OGRLinearRing( OGRLinearRing * );
710  virtual ~OGRLinearRing();
711 
712  OGRLinearRing& operator=( const OGRLinearRing& other );
713 
714  // Non standard.
715  virtual const char *getGeometryName() const CPL_OVERRIDE;
716  virtual OGRGeometry *clone() const CPL_OVERRIDE;
717  virtual int isClockwise() const;
718  virtual void reverseWindingOrder();
719  virtual void closeRings() CPL_OVERRIDE;
720  OGRBoolean isPointInRing( const OGRPoint* pt,
721  int bTestEnvelope = TRUE ) const;
722  OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
723  int bTestEnvelope = TRUE ) const;
725 
726  // IWks Interface - Note this isn't really a first class object
727  // for the purposes of WKB form. These methods always fail since this
728  // object can't be serialized on its own.
729  virtual int WkbSize() const CPL_OVERRIDE;
730  virtual OGRErr importFromWkb( unsigned char *, int=-1,
732  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
734  const CPL_OVERRIDE;
735 };
736 
737 /************************************************************************/
738 /* OGRCircularString */
739 /************************************************************************/
740 
753 class CPL_DLL OGRCircularString : public OGRSimpleCurve
754 {
755  private:
756  void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
757  OGRBoolean IsValidFast() const;
758  int IsFullCircle( double& cx, double& cy, double& square_R ) const;
759 
760  protected:
762  virtual OGRCurveCasterToLineString GetCasterToLineString()
763  const CPL_OVERRIDE;
764  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
765  const CPL_OVERRIDE;
766  virtual int ContainsPoint( const OGRPoint* p ) const CPL_OVERRIDE;
767  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
769 
770  public:
772  OGRCircularString(const OGRCircularString& other);
773  virtual ~OGRCircularString();
774 
776 
777  // IWks Interface.
778  virtual OGRErr importFromWkb( unsigned char *, int = -1,
780  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
782  const CPL_OVERRIDE;
783  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
784  virtual OGRErr exportToWkt( char ** ppszDstText,
786  const CPL_OVERRIDE;
787 
788  // IGeometry interface.
789  virtual OGRBoolean IsValid() const CPL_OVERRIDE;
790  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
791  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
792 
793  // ICurve methods.
794  virtual double get_Length() const CPL_OVERRIDE;
795  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
796  const char* const* papszOptions = NULL )
797  const CPL_OVERRIDE;
798  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
799  virtual double get_Area() const CPL_OVERRIDE;
800 
801  // Non-standard from OGRGeometry.
803  virtual const char *getGeometryName() const CPL_OVERRIDE;
804  virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
805  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
806  const CPL_OVERRIDE;
808  double dfMaxAngleStepSizeDegrees = 0,
809  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
810 };
811 
812 /************************************************************************/
813 /* OGRCurveCollection */
814 /************************************************************************/
815 
826 class CPL_DLL OGRCurveCollection
828 {
829  protected:
830  friend class OGRCompoundCurve;
831  friend class OGRCurvePolygon;
832  friend class OGRPolygon;
833  friend class OGRTriangle;
834 
835  int nCurveCount;
836  OGRCurve **papoCurves;
837 
838  public:
839  OGRCurveCollection();
840  OGRCurveCollection(const OGRCurveCollection& other);
841  ~OGRCurveCollection();
842 
843  OGRCurveCollection& operator=(const OGRCurveCollection& other);
844 
845  void empty(OGRGeometry* poGeom);
846  OGRBoolean IsEmpty() const;
847  void getEnvelope( OGREnvelope * psEnvelope ) const;
848  void getEnvelope( OGREnvelope3D * psEnvelope ) const;
849 
850  OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
851  int bNeedRealloc );
852  int WkbSize() const;
853  OGRErr importPreambuleFromWkb( OGRGeometry* poGeom,
854  unsigned char * pabyData,
855  int& nSize,
856  int& nDataOffset,
857  OGRwkbByteOrder& eByteOrder,
858  int nMinSubGeomSize,
859  OGRwkbVariant eWkVariant );
860  OGRErr importBodyFromWkb(
861  OGRGeometry* poGeom,
862  unsigned char * pabyData,
863  int nSize,
864  int nDataOffset,
865  int bAcceptCompoundCurve,
866  OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
867  OGRCurve* poCurve ),
868  OGRwkbVariant eWkVariant );
869  OGRErr exportToWkt( const OGRGeometry* poGeom,
870  char ** ppszDstText ) const;
872  unsigned char *,
873  OGRwkbVariant eWkbVariant ) const;
874  OGRBoolean Equals(OGRCurveCollection *poOCC) const;
875  void setCoordinateDimension( OGRGeometry* poGeom,
876  int nNewDimension );
877  void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
878  void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
879  int getNumCurves() const;
880  OGRCurve *getCurve( int );
881  const OGRCurve *getCurve( int ) const;
882  OGRCurve *stealCurve( int );
883  OGRErr transform( OGRGeometry* poGeom,
885  void flattenTo2D( OGRGeometry* poGeom );
886  void segmentize( double dfMaxLength );
887  void swapXY();
888  OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
889 };
891 
892 /************************************************************************/
893 /* OGRCompoundCurve */
894 /************************************************************************/
895 
906 class CPL_DLL OGRCompoundCurve : public OGRCurve
907 {
908  private:
909  OGRCurveCollection oCC;
910 
911  OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
912  double dfToleranceEps,
913  int bNeedRealloc );
914  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
915  OGRCurve* poCurve );
916  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
917  OGRCurve* poCurve );
918  OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
919  const char* const* papszOptions,
920  int bIsLinearRing ) const;
921 
922  protected:
926 
927  virtual OGRCurveCasterToLineString GetCasterToLineString()
928  const CPL_OVERRIDE;
929  virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
930  const CPL_OVERRIDE;
932 
933  public:
935  OGRCompoundCurve( const OGRCompoundCurve& other );
936  virtual ~OGRCompoundCurve();
937 
939 
940  // IWks Interface
941  virtual int WkbSize() const CPL_OVERRIDE;
942  virtual OGRErr importFromWkb( unsigned char *, int = -1,
944  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
946  const CPL_OVERRIDE;
947  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
948  virtual OGRErr exportToWkt( char ** ppszDstText,
950  const CPL_OVERRIDE;
951 
952  // IGeometry interface.
953  virtual OGRGeometry *clone() const CPL_OVERRIDE;
954  virtual void empty() CPL_OVERRIDE;
955  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
956  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
957  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
958 
959  // ICurve methods.
960  virtual double get_Length() const CPL_OVERRIDE;
961  virtual void StartPoint( OGRPoint * ) const CPL_OVERRIDE;
962  virtual void EndPoint( OGRPoint * ) const CPL_OVERRIDE;
963  virtual void Value( double, OGRPoint * ) const CPL_OVERRIDE;
964  virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
965  const char* const* papszOptions = NULL )
966  const CPL_OVERRIDE;
967 
968  virtual int getNumPoints() const CPL_OVERRIDE;
969  virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE;
970  virtual double get_Area() const CPL_OVERRIDE;
971 
972  // ISpatialRelation.
973  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
974 
975  // ICompoundCurve method.
976  int getNumCurves() const;
977  OGRCurve *getCurve( int );
978  const OGRCurve *getCurve( int ) const;
979 
980  // Non-standard.
981  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
982  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
983  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
984 
985  OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
986  OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
987  OGRCurve *stealCurve( int );
989 
990  // Non-standard from OGRGeometry.
992  virtual const char *getGeometryName() const CPL_OVERRIDE;
994  virtual void flattenTo2D() CPL_OVERRIDE;
995  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
996  virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
997  const CPL_OVERRIDE;
999  double dfMaxAngleStepSizeDegrees = 0,
1000  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
1001 
1002  virtual void swapXY() CPL_OVERRIDE;
1003 };
1004 
1005 /************************************************************************/
1006 /* OGRSurface */
1007 /************************************************************************/
1008 
1014 class CPL_DLL OGRSurface : public OGRGeometry
1015 {
1016  protected:
1018  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1019  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1021 
1022  public:
1023  virtual double get_Area() const = 0;
1024  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const = 0;
1026  static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1027  static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1029 };
1030 
1031 /************************************************************************/
1032 /* OGRCurvePolygon */
1033 /************************************************************************/
1034 
1048 class CPL_DLL OGRCurvePolygon : public OGRSurface
1049 {
1050  private:
1051  OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1052  virtual int checkRing( OGRCurve * poNewRing ) const;
1053  OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1054  int bNeedRealloc );
1055  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1056  OGRCurve* poCurve );
1057  static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1058  OGRCurve* poCurve );
1059 
1060  protected:
1062  friend class OGRPolygon;
1063  friend class OGRTriangle;
1064  OGRCurveCollection oCC;
1065 
1066  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1067  const CPL_OVERRIDE;
1068  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1069  const CPL_OVERRIDE;
1071 
1072  static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
1073 
1074  public:
1075  OGRCurvePolygon();
1076  OGRCurvePolygon( const OGRCurvePolygon& );
1077  virtual ~OGRCurvePolygon();
1078 
1079  OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
1080 
1081  // Non standard (OGRGeometry).
1082  virtual const char *getGeometryName() const CPL_OVERRIDE;
1084  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1085  virtual void empty() CPL_OVERRIDE;
1087  virtual void flattenTo2D() CPL_OVERRIDE;
1088  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1089  virtual void segmentize( double dfMaxLength ) CPL_OVERRIDE;
1090  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1091  const CPL_OVERRIDE;
1092  virtual OGRGeometry* getLinearGeometry(
1093  double dfMaxAngleStepSizeDegrees = 0,
1094  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1095 
1096  // ISurface Interface
1097  virtual double get_Area() const CPL_OVERRIDE;
1098  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
1099 
1100  // IWks Interface
1101  virtual int WkbSize() const CPL_OVERRIDE;
1102  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1104  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1106  const CPL_OVERRIDE;
1107  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1108  virtual OGRErr exportToWkt( char ** ppszDstText,
1109  OGRwkbVariant eWkbVariant = wkbVariantOldOgc )
1110  const CPL_OVERRIDE;
1111 
1112  // IGeometry
1113  virtual int getDimension() const CPL_OVERRIDE;
1114  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1115  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1116 
1117  // ICurvePolygon
1118  virtual OGRPolygon* CurvePolyToPoly(
1119  double dfMaxAngleStepSizeDegrees = 0,
1120  const char* const* papszOptions = NULL ) const;
1121 
1122  // ISpatialRelation
1123  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
1124  virtual OGRBoolean Intersects( const OGRGeometry * ) const CPL_OVERRIDE;
1125  virtual OGRBoolean Contains( const OGRGeometry * ) const CPL_OVERRIDE;
1126 
1127  // Non standard
1128  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1129  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1130  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1131 
1132  virtual OGRErr addRing( OGRCurve * );
1133  virtual OGRErr addRingDirectly( OGRCurve * );
1134 
1136  const OGRCurve *getExteriorRingCurve() const;
1137  int getNumInteriorRings() const;
1139  const OGRCurve *getInteriorRingCurve( int ) const;
1140 
1142 
1143  virtual void swapXY() CPL_OVERRIDE;
1144 };
1145 
1146 /************************************************************************/
1147 /* OGRPolygon */
1148 /************************************************************************/
1149 
1159 class CPL_DLL OGRPolygon : public OGRCurvePolygon
1160 {
1161  protected:
1163  friend class OGRMultiSurface;
1164  friend class OGRPolyhedralSurface;
1165  friend class OGRTriangulatedSurface;
1166 
1167  virtual int checkRing( OGRCurve * poNewRing ) const CPL_OVERRIDE;
1168  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1169  int bHasZ, int bHasM,
1170  OGRRawPoint*& paoPoints,
1171  int& nMaxPoints,
1172  double*& padfZ );
1173 
1174  static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
1175 
1176  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1177  const CPL_OVERRIDE;
1178  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1179  const CPL_OVERRIDE;
1181 
1182  public:
1183  OGRPolygon();
1184  OGRPolygon(const OGRPolygon& other);
1185  virtual ~OGRPolygon();
1186 
1187  OGRPolygon& operator=(const OGRPolygon& other);
1188 
1189  // Non-standard (OGRGeometry).
1190  virtual const char *getGeometryName() const CPL_OVERRIDE;
1192  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1193  const CPL_OVERRIDE;
1194  virtual OGRGeometry* getCurveGeometry(
1195  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1196  virtual OGRGeometry* getLinearGeometry(
1197  double dfMaxAngleStepSizeDegrees = 0,
1198  const char* const* papszOptions = NULL) const CPL_OVERRIDE;
1199 
1200  // ISurface Interface.
1201  virtual OGRErr PointOnSurface( OGRPoint * poPoint )
1202  const CPL_OVERRIDE;
1203 
1204  // IWks Interface.
1205  virtual int WkbSize() const CPL_OVERRIDE;
1206  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1208  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1210  const CPL_OVERRIDE;
1211  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1212  virtual OGRErr exportToWkt( char ** ppszDstText,
1214  const CPL_OVERRIDE;
1215 
1216  // ICurvePolygon.
1217  virtual OGRPolygon* CurvePolyToPoly(
1218  double dfMaxAngleStepSizeDegrees = 0,
1219  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1220 
1221  OGRLinearRing *getExteriorRing();
1222  const OGRLinearRing *getExteriorRing() const;
1223  virtual OGRLinearRing *getInteriorRing( int );
1224  virtual const OGRLinearRing *getInteriorRing( int ) const;
1225 
1226  OGRLinearRing *stealExteriorRing();
1227  virtual OGRLinearRing *stealInteriorRing(int);
1228 
1229  OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
1230 
1231  virtual void closeRings() CPL_OVERRIDE;
1232 };
1233 
1234 /************************************************************************/
1235 /* OGRTriangle */
1236 /************************************************************************/
1237 
1244 class CPL_DLL OGRTriangle : public OGRPolygon
1245 {
1246  private:
1247  bool quickValidityCheck() const;
1248 
1249  protected:
1251  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const CPL_OVERRIDE;
1252  virtual OGRErr importFromWKTListOnly( char ** ppszInput,
1253  int bHasZ, int bHasM,
1254  OGRRawPoint*& paoPoints,
1255  int& nMaxPoints,
1256  double*& padfZ ) CPL_OVERRIDE;
1258 
1259  public:
1260  OGRTriangle();
1261  OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
1262  OGRTriangle( const OGRTriangle &other );
1263  OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
1264  OGRTriangle& operator=( const OGRTriangle& other );
1265  virtual ~OGRTriangle();
1266  virtual const char *getGeometryName() const CPL_OVERRIDE;
1268 
1269  // IWks Interface.
1270  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1272 
1273  // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
1274  virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) CPL_OVERRIDE;
1275 
1277  static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
1279 };
1280 
1281 /************************************************************************/
1282 /* OGRGeometryCollection */
1283 /************************************************************************/
1284 
1292 class CPL_DLL OGRGeometryCollection : public OGRGeometry
1293 {
1294  OGRErr importFromWkbInternal( unsigned char * pabyData, int nSize,
1295  int nRecLevel,
1296  OGRwkbVariant );
1297  OGRErr importFromWktInternal( char **ppszInput, int nRecLevel );
1298 
1299  protected:
1301  int nGeomCount;
1302  OGRGeometry **papoGeoms;
1303 
1304  OGRErr exportToWktInternal( char ** ppszDstText,
1305  OGRwkbVariant eWkbVariant,
1306  const char* pszSkipPrefix ) const;
1307  static OGRGeometryCollection* TransferMembersAndDestroy(
1308  OGRGeometryCollection* poSrc,
1309  OGRGeometryCollection* poDst );
1311  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1312 
1313  public:
1316  virtual ~OGRGeometryCollection();
1317 
1319 
1320  // Non standard (OGRGeometry).
1321  virtual const char *getGeometryName() const CPL_OVERRIDE;
1323  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1324  virtual void empty() CPL_OVERRIDE;
1326  virtual void flattenTo2D() CPL_OVERRIDE;
1327  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1328  virtual void segmentize(double dfMaxLength) CPL_OVERRIDE;
1329  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1330  const CPL_OVERRIDE;
1331  virtual OGRGeometry* getCurveGeometry(
1332  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1333  virtual OGRGeometry* getLinearGeometry(
1334  double dfMaxAngleStepSizeDegrees = 0,
1335  const char* const* papszOptions = NULL ) const CPL_OVERRIDE;
1336 
1337  // IWks Interface
1338  virtual int WkbSize() const CPL_OVERRIDE;
1339  virtual OGRErr importFromWkb( unsigned char *, int = -1,
1341  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1343  const CPL_OVERRIDE;
1344  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1345  virtual OGRErr exportToWkt( char ** ppszDstText,
1347  const CPL_OVERRIDE;
1348 
1349  virtual double get_Length() const;
1350  virtual double get_Area() const;
1351 
1352  // IGeometry methods
1353  virtual int getDimension() const CPL_OVERRIDE;
1354  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1355  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1356 
1357  // IGeometryCollection
1358  int getNumGeometries() const;
1359  OGRGeometry *getGeometryRef( int );
1360  const OGRGeometry *getGeometryRef( int ) const;
1361 
1362  // ISpatialRelation
1363  virtual OGRBoolean Equals( OGRGeometry * ) const CPL_OVERRIDE;
1364 
1365  // Non standard
1366  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1367  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1368  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1369  virtual OGRErr addGeometry( const OGRGeometry * );
1370  virtual OGRErr addGeometryDirectly( OGRGeometry * );
1371  virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1372 
1373  void closeRings() CPL_OVERRIDE;
1374 
1375  virtual void swapXY() CPL_OVERRIDE;
1376 
1377  static OGRGeometryCollection* CastToGeometryCollection(
1378  OGRGeometryCollection* poSrc );
1379 };
1380 
1381 /************************************************************************/
1382 /* OGRMultiSurface */
1383 /************************************************************************/
1384 
1392 {
1393  protected:
1395  const CPL_OVERRIDE;
1396 
1397  public:
1398  OGRMultiSurface();
1399  OGRMultiSurface( const OGRMultiSurface& other );
1400  virtual ~OGRMultiSurface();
1401 
1402  OGRMultiSurface& operator=( const OGRMultiSurface& other );
1403 
1404  // Non standard (OGRGeometry).
1405  virtual const char *getGeometryName() const CPL_OVERRIDE;
1407  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1408  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1409  const CPL_OVERRIDE;
1410 
1411  // IMultiSurface methods
1412  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
1413 
1414  // IGeometry methods
1415  virtual int getDimension() const CPL_OVERRIDE;
1416 
1417  // Non standard
1418  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1419  const CPL_OVERRIDE;
1420 
1421  static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
1422 };
1423 
1424 /************************************************************************/
1425 /* OGRMultiPolygon */
1426 /************************************************************************/
1427 
1432 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
1433 {
1434  protected:
1436  const CPL_OVERRIDE;
1437  friend class OGRPolyhedralSurface;
1438  friend class OGRTriangulatedSurface;
1439 
1440  private:
1442  OGRErr _addGeometryWithExpectedSubGeometryType(
1443  const OGRGeometry * poNewGeom,
1444  OGRwkbGeometryType eSubGeometryType );
1445  OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
1446  OGRGeometry * poNewGeom,
1447  OGRwkbGeometryType eSubGeometryType );
1449 
1450 
1451  public:
1452  OGRMultiPolygon();
1453  OGRMultiPolygon(const OGRMultiPolygon& other);
1454  virtual ~OGRMultiPolygon();
1455 
1456  OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
1457 
1458  // Non-standard (OGRGeometry).
1459  virtual const char *getGeometryName() const CPL_OVERRIDE;
1461  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1462  const CPL_OVERRIDE;
1463 
1464  // IMultiSurface methods
1465  virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const CPL_OVERRIDE;
1466 
1467  // Non standard
1468  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1469  const CPL_OVERRIDE;
1470 
1471  static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
1472 };
1473 
1474 /************************************************************************/
1475 /* OGRPolyhedralSurface */
1476 /************************************************************************/
1477 
1484 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
1485 {
1486  protected:
1488  friend class OGRTriangulatedSurface;
1489  OGRMultiPolygon oMP;
1490  virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1491  const CPL_OVERRIDE;
1492  virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1493  const CPL_OVERRIDE;
1494  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
1495  virtual const char* getSubGeometryName() const;
1496  virtual OGRwkbGeometryType getSubGeometryType() const;
1497  OGRErr exportToWktInternal (char ** ppszDstText, OGRwkbVariant eWkbVariant,
1498  const char* pszSkipPrefix ) const;
1499 
1500  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1501  const;
1502  static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
1504 
1505  public:
1508  virtual ~OGRPolyhedralSurface();
1510 
1511  // IWks Interface.
1512  virtual int WkbSize() const CPL_OVERRIDE;
1513  virtual const char *getGeometryName() const CPL_OVERRIDE;
1515  virtual OGRErr importFromWkb( unsigned char *, int=-1,
1517  virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1519  const CPL_OVERRIDE;
1520  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1521  virtual OGRErr exportToWkt( char ** ppszDstText,
1523  const CPL_OVERRIDE;
1524 
1525  // IGeometry methods.
1526  virtual int getDimension() const CPL_OVERRIDE;
1527 
1528  virtual void empty() CPL_OVERRIDE;
1529 
1530  virtual OGRGeometry *clone() const CPL_OVERRIDE;
1531  virtual void getEnvelope( OGREnvelope * psEnvelope ) const CPL_OVERRIDE;
1532  virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const CPL_OVERRIDE;
1533 
1534  virtual void flattenTo2D() CPL_OVERRIDE;
1536  virtual OGRBoolean Equals( OGRGeometry* ) const CPL_OVERRIDE;
1537  virtual double get_Area() const CPL_OVERRIDE;
1538  virtual OGRErr PointOnSurface( OGRPoint* ) const CPL_OVERRIDE;
1539 
1541  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1542  const CPL_OVERRIDE;
1543  virtual OGRErr addGeometry( const OGRGeometry * );
1544  OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
1545  int getNumGeometries() const;
1546  OGRGeometry* getGeometryRef(int i);
1547  const OGRGeometry* getGeometryRef(int i) const;
1548 
1549  virtual OGRBoolean IsEmpty() const CPL_OVERRIDE;
1550  virtual void setCoordinateDimension( int nDimension ) CPL_OVERRIDE;
1551  virtual void set3D( OGRBoolean bIs3D ) CPL_OVERRIDE;
1552  virtual void setMeasured( OGRBoolean bIsMeasured ) CPL_OVERRIDE;
1553  virtual void swapXY() CPL_OVERRIDE;
1554  OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
1555 };
1556 
1557 /************************************************************************/
1558 /* OGRTriangulatedSurface */
1559 /************************************************************************/
1560 
1568 {
1569  protected:
1571  virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
1572  const CPL_OVERRIDE;
1573  virtual const char* getSubGeometryName() const CPL_OVERRIDE;
1574  virtual OGRwkbGeometryType getSubGeometryType() const CPL_OVERRIDE;
1575 
1576  virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
1577  const CPL_OVERRIDE;
1578  static OGRMultiPolygon *
1579  CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
1581 
1582  public:
1586 
1588  virtual const char *getGeometryName() const CPL_OVERRIDE;
1590 
1591  // IWks Interface.
1592  virtual OGRErr addGeometry( const OGRGeometry * ) CPL_OVERRIDE;
1593 
1594  static OGRPolyhedralSurface *
1595  CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
1596 };
1597 
1598 /************************************************************************/
1599 /* OGRMultiPoint */
1600 /************************************************************************/
1601 
1606 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
1607 {
1608  private:
1609  OGRErr importFromWkt_Bracketed( char **, int bHasM, int bHasZ );
1610 
1611  protected:
1613  const CPL_OVERRIDE;
1614 
1615  public:
1616  OGRMultiPoint();
1617  OGRMultiPoint(const OGRMultiPoint& other);
1618  virtual ~OGRMultiPoint();
1619 
1620  OGRMultiPoint& operator=(const OGRMultiPoint& other);
1621 
1622  // Non-standard (OGRGeometry).
1623  virtual const char *getGeometryName() const CPL_OVERRIDE;
1625  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1626  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1627  const CPL_OVERRIDE;
1628 
1629  // IGeometry methods.
1630  virtual int getDimension() const CPL_OVERRIDE;
1631 
1632  // Non-standard.
1633  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1634  const CPL_OVERRIDE;
1635 };
1636 
1637 /************************************************************************/
1638 /* OGRMultiCurve */
1639 /************************************************************************/
1640 
1647 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
1648 {
1649  protected:
1651  static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1652  OGRCurve* poCurve );
1655  const CPL_OVERRIDE;
1656 
1657  public:
1658  OGRMultiCurve();
1659  OGRMultiCurve( const OGRMultiCurve& other );
1660  virtual ~OGRMultiCurve();
1661 
1662  OGRMultiCurve& operator=( const OGRMultiCurve& other );
1663 
1664  // Non standard (OGRGeometry).
1665  virtual const char *getGeometryName() const CPL_OVERRIDE;
1667  virtual OGRErr importFromWkt( char ** ) CPL_OVERRIDE;
1668  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1669  const CPL_OVERRIDE;
1670 
1671  // IGeometry methods.
1672  virtual int getDimension() const CPL_OVERRIDE;
1673 
1674  // Non-standard.
1675  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1676  const CPL_OVERRIDE;
1677 
1678  static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
1679 };
1680 
1681 /************************************************************************/
1682 /* OGRMultiLineString */
1683 /************************************************************************/
1684 
1689 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
1690 {
1691  protected:
1693  const CPL_OVERRIDE;
1694 
1695  public:
1697  OGRMultiLineString( const OGRMultiLineString& other );
1698  virtual ~OGRMultiLineString();
1699 
1701 
1702  // Non standard (OGRGeometry).
1703  virtual const char *getGeometryName() const CPL_OVERRIDE;
1705  virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
1706  const CPL_OVERRIDE;
1707 
1708  // Non standard
1709  virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1710  const CPL_OVERRIDE;
1711 
1712  static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
1713 };
1714 
1715 /************************************************************************/
1716 /* OGRGeometryFactory */
1717 /************************************************************************/
1718 
1723 class CPL_DLL OGRGeometryFactory
1724 {
1725  static OGRErr createFromFgfInternal( unsigned char *pabyData,
1726  OGRSpatialReference * poSR,
1727  OGRGeometry **ppoReturn,
1728  int nBytes,
1729  int *pnBytesConsumed,
1730  int nRecLevel );
1731  public:
1732  static OGRErr createFromWkb( unsigned char *, OGRSpatialReference *,
1733  OGRGeometry **, int = -1,
1735  static OGRErr createFromWkt( char **, OGRSpatialReference *,
1736  OGRGeometry ** );
1737  static OGRErr createFromFgf( unsigned char *, OGRSpatialReference *,
1738  OGRGeometry **, int = -1, int * = NULL );
1739  static OGRGeometry *createFromGML( const char * );
1740  static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
1741  GEOSGeom );
1742 
1743  static void destroyGeometry( OGRGeometry * );
1744  static OGRGeometry *createGeometry( OGRwkbGeometryType );
1745 
1746  static OGRGeometry * forceToPolygon( OGRGeometry * );
1747  static OGRGeometry * forceToLineString( OGRGeometry *,
1748  bool bOnlyInOrder = true );
1749  static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
1750  static OGRGeometry * forceToMultiPoint( OGRGeometry * );
1751  static OGRGeometry * forceToMultiLineString( OGRGeometry * );
1752 
1753  static OGRGeometry * forceTo( OGRGeometry* poGeom,
1754  OGRwkbGeometryType eTargetType,
1755  const char*const* papszOptions = NULL );
1756 
1757  static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
1758  int nPolygonCount,
1759  int *pbResultValidGeometry,
1760  const char **papszOptions = NULL);
1761  static bool haveGEOS();
1762 
1763  static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
1765  char** papszOptions );
1766 
1767  static OGRGeometry*
1768  approximateArcAngles( double dfX, double dfY, double dfZ,
1769  double dfPrimaryRadius, double dfSecondaryAxis,
1770  double dfRotation,
1771  double dfStartAngle, double dfEndAngle,
1772  double dfMaxAngleStepSizeDegrees );
1773 
1774  static int GetCurveParmeters( double x0, double y0,
1775  double x1, double y1,
1776  double x2, double y2,
1777  double& R, double& cx, double& cy,
1778  double& alpha0, double& alpha1,
1779  double& alpha2 );
1780  static OGRLineString* curveToLineString(
1781  double x0, double y0, double z0,
1782  double x1, double y1, double z1,
1783  double x2, double y2, double z2,
1784  int bHasZ,
1785  double dfMaxAngleStepSizeDegrees,
1786  const char* const * papszOptions = NULL );
1787  static OGRCurve* curveFromLineString(
1788  const OGRLineString* poLS,
1789  const char* const * papszOptions = NULL);
1790 };
1791 
1792 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
1793 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
1794 
1796 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
1799 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
1800 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
1801  const OGRGeometry* poOtherGeom );
1802 int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
1803  const OGRGeometry* poOtherGeom );
1804 
1805 #endif /* ndef OGR_GEOMETRY_H_INCLUDED */
virtual OGRErr importFromWkt(char **) CPL_OVERRIDE
Assign geometry from well known text data.
Definition: ogrcurvepolygon.cpp:507
virtual void Value(double, OGRPoint *) const CPL_OVERRIDE
Fetch point at given distance along curve.
Definition: ogrlinestring.cpp:1936
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known binary format.
Definition: ogrpolygon.cpp:364
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:4970
virtual int WkbSize() const CPL_OVERRIDE
Returns size of related binary representation.
Definition: ogrcurvepolygon.cpp:418
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Fetch geometry type.
Definition: ogrmulticurve.cpp:100
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
virtual OGRErr importFromWkb(unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc) CPL_OVERRIDE
Assign geometry from well known binary data.
Definition: ogrpolygon.cpp:319
virtual void setCoordinateDimension(int nDimension)
Set the coordinate dimension.
Definition: ogrgeometry.cpp:1022
OGRBoolean Is3D() const
Definition: ogr_geometry.h:185
virtual void set3D(OGRBoolean bIs3D)
Add or remove the Z coordinate dimension.
Definition: ogrgeometry.cpp:1045
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Fetch geometry type.
Definition: ogrmultisurface.cpp:101
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrmulticurve.cpp:193
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrgeometrycollection.cpp:801
virtual void setMeasured(OGRBoolean bIsMeasured)
Add or remove the M coordinate dimension.
Definition: ogrgeometry.cpp:1068
double y
y
Definition: ogr_geometry.h:59
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:623
virtual OGRErr importFromWkt(char **ppszInput)=0
Assign geometry from well known text data.
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const
Returns if this geometry is or has curve geometry.
Definition: ogrgeometry.cpp:3048
#define CPL_OVERRIDE
To be used in public headers only.
Definition: cpl_port.h:1054
double getY() const
Return y.
Definition: ogr_geometry.h:364
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known binary format.
Definition: ogrcurvepolygon.cpp:473
virtual void swapXY()
Swap x and y coordinates.
Definition: ogrgeometry.cpp:5706
virtual void StartPoint(OGRPoint *) const CPL_OVERRIDE
Return the curve start point.
Definition: ogrcompoundcurve.cpp:288
virtual double get_Length() const CPL_OVERRIDE
Returns the length of the curve.
Definition: ogrlinestring.cpp:1894
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:1723
double x
x
Definition: ogr_geometry.h:57
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant eWkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrcurvepolygon.cpp:523
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
virtual double get_Length() const CPL_OVERRIDE
Returns the length of the curve.
Definition: ogrcompoundcurve.cpp:276
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const CPL_OVERRIDE
Returns whether a geometry of the specified geometry type can be a member of this collection...
Definition: ogrmultisurface.cpp:139
OGRPolyhedralSurface()
Create an empty PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:47
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const =0
Convert a geometry into well known binary format.
OGRMultiCurve & operator=(const OGRMultiCurve &other)
Assignment operator.
Definition: ogrmulticurve.cpp:87
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrgeometrycollection.cpp:231
virtual OGRGeometry * clone() const CPL_WARN_UNUSED_RESULT=0
Make a copy of this object.
OGRCurve * stealExteriorRingCurve()
"Steal" reference to external ring.
Definition: ogrcurvepolygon.cpp:311
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:290
virtual void Value(double, OGRPoint *) const CPL_OVERRIDE
Fetch point at given distance along curve.
Definition: ogrcompoundcurve.cpp:308
OGRCurve * getExteriorRingCurve()
Fetch reference to external polygon ring.
Definition: ogrcurvepolygon.cpp:205
virtual OGRErr addRingDirectly(OGRCurve *poNewRing) CPL_OVERRIDE
Add a ring to a polygon.
Definition: ogrtriangle.cpp:249
virtual OGRBoolean IsEmpty() const CPL_OVERRIDE
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:357
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:813
Coordinate systems services.
double getM() const
Return m.
Definition: ogr_geometry.h:368
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Fetch geometry type.
Definition: ogrgeometrycollection.cpp:177
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrlinestring.cpp:2683
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrpolygon.cpp:123
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:51
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrgeometrycollection.cpp:1299
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:1432
int OGRHasPreparedGeometrySupport()
Returns if GEOS has prepared geometry support.
Definition: ogrgeometry.cpp:5736
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrcurvepolygon.cpp:179
virtual OGRBoolean Equals(OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
virtual OGRErr importFromWkb(unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc)=0
Assign geometry from well known binary data.
OGRwkbByteOrder
Enumeration to describe byte order.
Definition: ogr_core.h:468
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:753
virtual void flattenTo2D()=0
Convert geometry to strictly 2D.
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:433
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:1292
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:242
Concrete representation of a closed ring.
Definition: ogr_geometry.h:684
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:388
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrpolygon.cpp:613
OGRGeometry & operator=(const OGRGeometry &other)
Assignment operator.
Definition: ogrgeometry.cpp:141
virtual int getNumPoints() const CPL_OVERRIDE
Fetch vertex count.
Definition: ogr_geometry.h:552
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM IMultiSurface::get_PointOnSurface() method.
Definition: ogrmultisurface.cpp:298
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const CPL_OVERRIDE
Returns whether a geometry of the specified geometry type can be a member of this collection...
Definition: ogrmulticurve.cpp:137
virtual OGRErr importFromWkt(char **) CPL_OVERRIDE
Assign geometry from well known text data.
Definition: ogrlinestring.cpp:1674
virtual int get_IsClosed() const
Return TRUE if curve is closed.
Definition: ogrcurve.cpp:95
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=NULL) const CPL_WARN_UNUSED_RESULT
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3116
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const
Returns whether a geometry of the specified geometry type can be a member of this collection...
Definition: ogrgeometrycollection.cpp:1288
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrmulticurve.cpp:127
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:1391
virtual double get_Length() const =0
Returns the length of the curve.
virtual int WkbSize() const CPL_OVERRIDE
Returns size of related binary representation.
Definition: ogrlinestring.cpp:195
virtual void StartPoint(OGRPoint *) const =0
Return the curve start point.
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGCgeometry format type to corresponding OGR constants.
Definition: ogrgeometry.cpp:2257
OGRSimpleCurve & operator=(const OGRSimpleCurve &other)
Assignment operator.
Definition: ogrlinestring.cpp:99
virtual void segmentize(double dfMaxLength) CPL_OVERRIDE
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:712
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrmultisurface.cpp:277
virtual double get_Area() const =0
Get the area of the (closed) curve.
OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
Definition: ogrpolyhedralsurface.cpp:872
Utility class to store a collection of curves.
Definition: ogr_geometry.h:906
Simple container for a position.
Definition: ogr_geometry.h:47
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:301
virtual void swapXY() CPL_OVERRIDE
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:726
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Fetch geometry type.
Definition: ogrcurvepolygon.cpp:142
virtual OGRErr addGeometry(const OGRGeometry *) CPL_OVERRIDE
Add a new geometry to a collection.
Definition: ogrtriangulatedsurface.cpp:184
virtual OGRErr importFromWkb(unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc) CPL_OVERRIDE
Assign geometry from well known binary data.
Definition: ogrcurvepolygon.cpp:448
virtual ~OGRPolyhedralSurface()
Destructor.
Definition: ogrpolyhedralsurface.cpp:74
OGRMultiSurface & operator=(const OGRMultiSurface &other)
Assignment operator.
Definition: ogrmultisurface.cpp:88
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:429
Interface for a point iterator.
Definition: ogr_geometry.h:415
TriangulatedSurface class.
Definition: ogr_geometry.h:1567
A collection of OGRCurve.
Definition: ogr_geometry.h:1647
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const =0
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:1014
A collection of OGRLineString.
Definition: ogr_geometry.h:1689
virtual double get_AreaOfCurveSegments() const CPL_OVERRIDE
Return area of curve segments.
Definition: ogrcompoundcurve.cpp:870
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:118
virtual void empty()=0
Clear geometry information.
virtual void segmentize(double dfMaxLength)
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrgeometry.cpp:804
double getZ() const
Return z.
Definition: ogr_geometry.h:366
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:375
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:187
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:67
virtual OGRBoolean IsValid() const
Test if the geometry is valid.
Definition: ogrgeometry.cpp:2028
static OGRLinearRing * CastToLinearRing(OGRCurve *poCurve)
Cast to linear ring.
Definition: ogrcurve.cpp:408
virtual double get_Area() const =0
Get the area of the surface object.
OGRTriangle & operator=(const OGRTriangle &other)
Assignment operator.
Definition: ogrtriangle.cpp:143
virtual OGRBoolean Intersects(const OGRGeometry *) const
Do these features intersect?
Definition: ogrgeometry.cpp:515
OGRPolyhedralSurface & operator=(const OGRPolyhedralSurface &other)
Assignment operator.
Definition: ogrpolyhedralsurface.cpp:87
void OGRDestroyPreparedGeometry(OGRPreparedGeometry *poPreparedGeom)
Destroys a prepared geometry.
Definition: ogrgeometry.cpp:5792
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:63
virtual OGRErr transform(OGRCoordinateTransformation *poCT) CPL_OVERRIDE
Apply arbitrary coordinate transformation to geometry.
Definition: ogrlinestring.cpp:2340
OGRLineString & operator=(const OGRLineString &other)
Assignment operator.
Definition: ogrlinestring.cpp:2653
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Fetch geometry type.
Definition: ogrpolygon.cpp:106
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_OVERRIDE
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrcurvepolygon.cpp:587
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:383
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:1073
virtual OGRErr exportToWkt(char **, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrmulticurve.cpp:182
virtual OGRGeometry * clone() const CPL_OVERRIDE
Make a copy of this object.
Definition: ogrlinestring.cpp:126
virtual double get_Area() const CPL_OVERRIDE
Get the area of the (closed) curve.
Definition: ogrcompoundcurve.cpp:830
Core portability services for cross-platform OGR code.
virtual int getDimension() const =0
Get the dimension of this object.
int OGRPreparedGeometryIntersects(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry intersects with a geometry.
Definition: ogrgeometry.cpp:5814
Concrete class representing curve polygons.
Definition: ogr_geometry.h:1048
virtual OGRErr transform(OGRCoordinateTransformation *poCT) CPL_OVERRIDE
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:653
PolyhedralSurface class.
Definition: ogr_geometry.h:1484
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known binary format.
Definition: ogrlinestring.cpp:1580
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_OVERRIDE
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:801
virtual OGRErr importFromWkt(char **) CPL_OVERRIDE
Assign geometry from well known text data.
Definition: ogrgeometrycollection.cpp:788
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:379
virtual OGRBoolean IsEmpty() const CPL_OVERRIDE
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:703
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:132
virtual double get_AreaOfCurveSegments() const =0
Get the area of the purely curve portions of a (closed) curve.
struct _OGRPreparedGeometry OGRPreparedGeometry
Prepared geometry API (needs GEOS >= 3.1.0)
Definition: ogr_geometry.h:1796
virtual int getDimension() const CPL_OVERRIDE
Get the dimension of this object.
Definition: ogrgeometrycollection.cpp:194
Old-style 99-402 extended dimension (Z) WKB types.
Definition: ogr_core.h:409
OGRCurvePolygon()
Create an empty curve polygon.
Definition: ogrcurvepolygon.cpp:52
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const =0
Return a linestring from a curve geometry.
OGRPreparedGeometry * OGRCreatePreparedGeometry(const OGRGeometry *poGeom)
Creates a prepared geometry.
Definition: ogrgeometry.cpp:5756
virtual OGRErr addGeometry(const OGRGeometry *)
Add a new geometry to a collection.
Definition: ogrpolyhedralsurface.cpp:836
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrcurvepolygon.cpp:572
virtual void getEnvelope(OGREnvelope *psEnvelope) const CPL_OVERRIDE
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
Definition: ogrlinestring.cpp:2237
virtual OGRErr addRingDirectly(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:397
Point class.
Definition: ogr_geometry.h:322
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const CPL_OVERRIDE
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogrcurvepolygon.cpp:597
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:407
virtual int WkbSize() const =0
Returns size of related binary representation.
virtual void getEnvelope(OGREnvelope *psEnvelope) const =0
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
OGRGeometryCollection & operator=(const OGRGeometryCollection &other)
Assignment operator.
Definition: ogrgeometrycollection.cpp:110
virtual void setCoordinateDimension(int nDimension) CPL_OVERRIDE
Set the coordinate dimension.
Definition: ogrcurvepolygon.cpp:683
virtual OGRErr importFromWkb(unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc) CPL_OVERRIDE
Assign geometry from well known binary data.
Definition: ogrlinestring.cpp:1470
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_WARN_UNUSED_RESULT
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrgeometry.cpp:3081
double getX() const
Return x.
Definition: ogr_geometry.h:362
Concrete class representing polygons.
Definition: ogr_geometry.h:1159
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:491
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const =0
Convert a geometry into well known text format.
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
Definition: ogr_geometry.h:65
virtual int getNumPoints() const =0
Return the number of points of a curve geometry.
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrpolyhedralsurface.cpp:102
virtual void segmentize(double dfMaxLength) CPL_OVERRIDE
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrlinestring.cpp:2461
virtual OGRBoolean Contains(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:4812
virtual OGRBoolean Equals(OGRGeometry *) const CPL_OVERRIDE
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:627
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:54
virtual void flattenTo2D() CPL_OVERRIDE
Convert geometry to strictly 2D.
Definition: ogrcurvepolygon.cpp:169
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:554
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:591
virtual int getNumPoints() const CPL_OVERRIDE
Return the number of points of a curve geometry.
Definition: ogrcompoundcurve.cpp:668
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:815
virtual OGRwkbGeometryType getGeometryType() const CPL_OVERRIDE
Returns the WKB Type of PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:116
static OGRCompoundCurve * CastToCompoundCurve(OGRCurve *puCurve)
Cast to compound curve.
Definition: ogrcurve.cpp:355
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:914
int OGRPreparedGeometryContains(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry contains a geometry.
Definition: ogrgeometry.cpp:5844
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const
Return a polygon from a curve polygon.
Definition: ogrcurvepolygon.cpp:553
virtual OGRErr addRing(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:338
virtual OGRPointIterator * getPointIterator() const =0
Returns a point iterator over the curve.
OGRCurvePolygon & operator=(const OGRCurvePolygon &other)
Assignment operator.
Definition: ogrcurvepolygon.cpp:91
Triangle class.
Definition: ogr_geometry.h:1244
OGRPolygon & operator=(const OGRPolygon &other)
Assignment operator.
Definition: ogrpolygon.cpp:93
static OGRLineString * CastToLineString(OGRCurve *poCurve)
Cast to linestring.
Definition: ogrcurve.cpp:386
virtual OGRErr transform(OGRCoordinateTransformation *poCT)=0
Apply arbitrary coordinate transformation to geometry.
virtual OGRPointIterator * getPointIterator() const CPL_OVERRIDE
Returns a point iterator over the curve.
Definition: ogrcompoundcurve.cpp:726
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrlinestring.cpp:1796
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:274
virtual int WkbSize() const CPL_OVERRIDE
Returns size of related binary representation.
Definition: ogrpolygon.cpp:299
virtual void set3D(OGRBoolean bIs3D) CPL_OVERRIDE
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:689
virtual void getEnvelope(OGREnvelope *psEnvelope) const CPL_OVERRIDE
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
Definition: ogrcurvepolygon.cpp:607
virtual void setMeasured(OGRBoolean bIsMeasured) CPL_OVERRIDE
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:694
virtual OGRErr exportToWkt(char **, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
Convert a geometry into well known text format.
Definition: ogrmultisurface.cpp:266
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition: ogrgeometry.cpp:2330
A collection of OGRPoint.
Definition: ogr_geometry.h:1606
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const CPL_OVERRIDE
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:812
virtual const char * getGeometryName() const CPL_OVERRIDE
Fetch WKT name for geometry type.
Definition: ogrmultisurface.cpp:128
virtual void EndPoint(OGRPoint *) const CPL_OVERRIDE
Return the curve end point.
Definition: ogrcompoundcurve.cpp:298
virtual OGRBoolean IsConvex() const
Returns if a (closed) curve forms a convex shape.
Definition: ogrcurve.cpp:309
OGRCurve * getInteriorRingCurve(int)
Fetch reference to indicated internal ring.
Definition: ogrcurvepolygon.cpp:270
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=NULL) const CPL_OVERRIDE
Return a linestring from a curve geometry.
Definition: ogrcompoundcurve.cpp:367
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:998
virtual void empty() CPL_OVERRIDE
Clear geometry information.
Definition: ogrcurvepolygon.cpp:132
OGRGeometry * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:936
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:555

Generated for GDAL by doxygen 1.8.8.