GDAL

ogr_geometry.h
Go to the documentation of this file.
1 /******************************************************************************
2 * $Id$
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 spatialys.com>
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 <cmath>
41 #include <memory>
42
50 #ifndef DEFINEH_OGRGeometryH
51 #define DEFINEH_OGRGeometryH
52 #ifdef DEBUG
53 typedef struct OGRGeometryHS *OGRGeometryH;
54 #else
55 typedef void *OGRGeometryH;
56 #endif
57 #endif /* DEFINEH_OGRGeometryH */
58
60 enum class OGRWktFormat
62 {
63 F,
64 G,
65 Default
66 };
67
69 struct CPL_DLL OGRWktOptions
70 {
71 public:
73 OGRwkbVariant variant;
75 int precision;
77 bool round;
79 OGRWktFormat format;
80
82 OGRWktOptions() : variant(wkbVariantOldOgc), precision(15), round(true),
83 format(OGRWktFormat::Default)
84 {
85 static int defPrecision = getDefaultPrecision();
86 static bool defRound = getDefaultRound();
87
88 precision = defPrecision;
89 round = defRound;
90 }
91
93 OGRWktOptions(const OGRWktOptions&) = default;
94
95 private:
96 static int getDefaultPrecision();
97 static bool getDefaultRound();
98 };
99
103 class OGRRawPoint
104 {
105 public:
107 OGRRawPoint() : x(0.0), y(0.0) {}
108
110 OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn) {}
111
113 double x;
115 double y;
116 };
117
119 typedef struct GEOSGeom_t *GEOSGeom;
121 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
123 typedef void sfcgal_geometry_t;
124
125 class OGRPoint;
126 class OGRCurve;
127 class OGRCompoundCurve;
128 class OGRSimpleCurve;
129 class OGRLinearRing;
130 class OGRLineString;
131 class OGRCircularString;
132 class OGRSurface;
133 class OGRCurvePolygon;
134 class OGRPolygon;
135 class OGRMultiPoint;
136 class OGRMultiSurface;
137 class OGRMultiPolygon;
138 class OGRMultiCurve;
139 class OGRMultiLineString;
140 class OGRGeometryCollection;
141 class OGRTriangle;
142 class OGRPolyhedralSurface;
143 class OGRTriangulatedSurface;
144
146 typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
147 typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
148
149 typedef OGRPolygon* (*OGRSurfaceCasterToPolygon)(OGRSurface*);
150 typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
151 typedef OGRMultiPolygon* (*OGRPolyhedralSurfaceCastToMultiPolygon)(OGRPolyhedralSurface*);
153
157 class CPL_DLL IOGRGeometryVisitor
158 {
159 public:
161 virtual ~IOGRGeometryVisitor() = default;
162
164 virtual void visit(OGRPoint*) = 0;
166 virtual void visit(OGRLineString*) = 0;
168 virtual void visit(OGRLinearRing*) = 0;
170 virtual void visit(OGRPolygon*) = 0;
172 virtual void visit(OGRMultiPoint*) = 0;
174 virtual void visit(OGRMultiLineString*) = 0;
176 virtual void visit(OGRMultiPolygon*) = 0;
178 virtual void visit(OGRGeometryCollection*) = 0;
180 virtual void visit(OGRCircularString*) = 0;
182 virtual void visit(OGRCompoundCurve*) = 0;
184 virtual void visit(OGRCurvePolygon*) = 0;
186 virtual void visit(OGRMultiCurve*) = 0;
188 virtual void visit(OGRMultiSurface*) = 0;
190 virtual void visit(OGRTriangle*) = 0;
192 virtual void visit(OGRPolyhedralSurface*) = 0;
194 virtual void visit(OGRTriangulatedSurface*) = 0;
195 };
196
204 class CPL_DLL OGRDefaultGeometryVisitor: public IOGRGeometryVisitor
205 {
206 void _visit(OGRSimpleCurve* poGeom);
207
208 public:
209
210 void visit(OGRPoint*) override {}
211 void visit(OGRLineString*) override;
212 void visit(OGRLinearRing*) override;
213 void visit(OGRPolygon*) override;
214 void visit(OGRMultiPoint*) override;
215 void visit(OGRMultiLineString*) override;
216 void visit(OGRMultiPolygon*) override;
217 void visit(OGRGeometryCollection*) override;
218 void visit(OGRCircularString*) override;
219 void visit(OGRCompoundCurve*) override;
220 void visit(OGRCurvePolygon*) override;
221 void visit(OGRMultiCurve*) override;
222 void visit(OGRMultiSurface*) override;
223 void visit(OGRTriangle*) override;
224 void visit(OGRPolyhedralSurface*) override;
225 void visit(OGRTriangulatedSurface*) override;
226 };
227
231 class CPL_DLL IOGRConstGeometryVisitor
232 {
233 public:
235 virtual ~IOGRConstGeometryVisitor() = default;
236
238 virtual void visit(const OGRPoint*) = 0;
240 virtual void visit(const OGRLineString*) = 0;
242 virtual void visit(const OGRLinearRing*) = 0;
244 virtual void visit(const OGRPolygon*) = 0;
246 virtual void visit(const OGRMultiPoint*) = 0;
248 virtual void visit(const OGRMultiLineString*) = 0;
250 virtual void visit(const OGRMultiPolygon*) = 0;
252 virtual void visit(const OGRGeometryCollection*) = 0;
254 virtual void visit(const OGRCircularString*) = 0;
256 virtual void visit(const OGRCompoundCurve*) = 0;
258 virtual void visit(const OGRCurvePolygon*) = 0;
260 virtual void visit(const OGRMultiCurve*) = 0;
262 virtual void visit(const OGRMultiSurface*) = 0;
264 virtual void visit(const OGRTriangle*) = 0;
266 virtual void visit(const OGRPolyhedralSurface*) = 0;
268 virtual void visit(const OGRTriangulatedSurface*) = 0;
269 };
270
278 class CPL_DLL OGRDefaultConstGeometryVisitor: public IOGRConstGeometryVisitor
279 {
280 void _visit(const OGRSimpleCurve* poGeom);
281
282 public:
283
284 void visit(const OGRPoint*) override {}
285 void visit(const OGRLineString*) override;
286 void visit(const OGRLinearRing*) override;
287 void visit(const OGRPolygon*) override;
288 void visit(const OGRMultiPoint*) override;
289 void visit(const OGRMultiLineString*) override;
290 void visit(const OGRMultiPolygon*) override;
291 void visit(const OGRGeometryCollection*) override;
292 void visit(const OGRCircularString*) override;
293 void visit(const OGRCompoundCurve*) override;
294 void visit(const OGRCurvePolygon*) override;
295 void visit(const OGRMultiCurve*) override;
296 void visit(const OGRMultiSurface*) override;
297 void visit(const OGRTriangle*) override;
298 void visit(const OGRPolyhedralSurface*) override;
299 void visit(const OGRTriangulatedSurface*) override;
300 };
301
302 /************************************************************************/
303 /* OGRGeometry */
304 /************************************************************************/
305
326 class CPL_DLL OGRGeometry
327 {
328 private:
329 OGRSpatialReference * poSRS = nullptr; // may be NULL
330
331 protected:
333 friend class OGRCurveCollection;
334
335 unsigned int flags = 0;
336
337 OGRErr importPreambleFromWkt( const char ** ppszInput,
338 int* pbHasZ, int* pbHasM,
339 bool* pbIsEmpty );
340 OGRErr importCurveCollectionFromWkt(
341 const char ** ppszInput,
342 int bAllowEmptyComponent,
343 int bAllowLineString,
344 int bAllowCurve,
345 int bAllowCompoundCurve,
346 OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf,
347 OGRCurve* poCurve) );
348 OGRErr importPreambleFromWkb( const unsigned char * pabyData,
349 size_t nSize,
350 OGRwkbByteOrder& eByteOrder,
351 OGRwkbVariant eWkbVariant );
352 OGRErr importPreambleOfCollectionFromWkb(
353 const unsigned char * pabyData,
354 size_t& nSize,
355 size_t& nDataOffset,
356 OGRwkbByteOrder& eByteOrder,
357 size_t nMinSubGeomSize,
358 int& nGeomCount,
359 OGRwkbVariant eWkbVariant );
360 OGRErr PointOnSurfaceInternal( OGRPoint * poPoint ) const;
361 OGRBoolean IsSFCGALCompatible() const;
362
363 void HomogenizeDimensionalityWith( OGRGeometry* poOtherGeom );
364 std::string wktTypeString(OGRwkbVariant variant) const;
365
367
368 public:
369
370 /************************************************************************/
371 /* Bit flags for OGRGeometry */
372 /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
373 /* Do not use these outside of the core. */
374 /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
375 /************************************************************************/
376
378 static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
379 static const unsigned int OGR_G_3D = 0x2;
380 static const unsigned int OGR_G_MEASURED = 0x4;
382
383 OGRGeometry();
384 OGRGeometry( const OGRGeometry& other );
385 virtual ~OGRGeometry();
386
387 OGRGeometry& operator=( const OGRGeometry& other );
388
390 bool operator==( const OGRGeometry& other ) const { return CPL_TO_BOOL(Equals(&other)); }
391
393 bool operator!=( const OGRGeometry& other ) const { return !CPL_TO_BOOL(Equals(&other)); }
394
395 // Standard IGeometry.
396 virtual int getDimension() const = 0;
397 virtual int getCoordinateDimension() const;
398 int CoordinateDimension() const;
399 virtual OGRBoolean IsEmpty() const = 0;
400 virtual OGRBoolean IsValid() const;
401 virtual OGRGeometry* MakeValid(CSLConstList papszOptions = nullptr) const;
402 virtual OGRGeometry* Normalize() const;
403 virtual OGRBoolean IsSimple() const;
405 OGRBoolean Is3D() const { return (flags & OGR_G_3D) != 0; }
407 OGRBoolean IsMeasured() const { return (flags & OGR_G_MEASURED) != 0; }
408 virtual OGRBoolean IsRing() const;
409 virtual void empty() = 0;
410 virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
411 virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
412 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
413
414 // IWks Interface.
415 virtual size_t WkbSize() const = 0;
416 OGRErr importFromWkb( const GByte*, size_t=static_cast<size_t>(-1),
417 OGRwkbVariant=wkbVariantOldOgc );
418 virtual OGRErr importFromWkb( const unsigned char *,
419 size_t,
420 OGRwkbVariant,
421 size_t& nBytesConsumedOut ) = 0;
422 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
423 OGRwkbVariant=wkbVariantOldOgc ) const = 0;
424 virtual OGRErr importFromWkt( const char ** ppszInput ) = 0;
425
426 #ifndef DOXYGEN_XML
427
430 OGRErr importFromWkt( char ** ppszInput )
432 CPL_WARN_DEPRECATED("Use importFromWkt(const char**) instead")
434 {
435 return importFromWkt( const_cast<const char**>(ppszInput) );
436 }
437 #endif
438
439 OGRErr exportToWkt( char ** ppszDstText,
440 OGRwkbVariant=wkbVariantOldOgc ) const;
441
446 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
447 OGRErr *err = nullptr) const = 0;
448
449 // Non-standard.
450 virtual OGRwkbGeometryType getGeometryType() const = 0;
451 OGRwkbGeometryType getIsoGeometryType() const;
452 virtual const char *getGeometryName() const = 0;
453 virtual void dumpReadable( FILE *, const char * = nullptr
454 , char** papszOptions = nullptr ) const;
455 virtual void flattenTo2D() = 0;
456 virtual char * exportToGML( const char* const * papszOptions = nullptr ) const;
457 virtual char * exportToKML() const;
458 virtual char * exportToJson() const;
459
461 virtual void accept(IOGRGeometryVisitor* visitor) = 0;
462
464 virtual void accept(IOGRConstGeometryVisitor* visitor) const = 0;
465
466 static GEOSContextHandle_t createGEOSContext();
467 static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
468 virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
469 const CPL_WARN_UNUSED_RESULT;
470 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
471 virtual OGRGeometry* getCurveGeometry(
472 const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
473 virtual OGRGeometry* getLinearGeometry(
474 double dfMaxAngleStepSizeDegrees = 0,
475 const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
476
477 // SFCGAL interfacing methods.
479 static sfcgal_geometry_t* OGRexportToSFCGAL( const OGRGeometry *poGeom );
480 static OGRGeometry* SFCGALexportToOGR( const sfcgal_geometry_t* _geometry );
482 virtual void closeRings();
483
484 virtual void setCoordinateDimension( int nDimension );
485 virtual void set3D( OGRBoolean bIs3D );
486 virtual void setMeasured( OGRBoolean bIsMeasured );
487
488 virtual void assignSpatialReference( OGRSpatialReference * poSR );
489 OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
490
491 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) = 0;
492 OGRErr transformTo( OGRSpatialReference *poSR );
493
494 virtual void segmentize(double dfMaxLength);
495
496 // ISpatialRelation
497 virtual OGRBoolean Intersects( const OGRGeometry * ) const;
498 virtual OGRBoolean Equals( const OGRGeometry * ) const = 0;
499 virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
500 virtual OGRBoolean Touches( const OGRGeometry * ) const;
501 virtual OGRBoolean Crosses( const OGRGeometry * ) const;
502 virtual OGRBoolean Within( const OGRGeometry * ) const;
503 virtual OGRBoolean Contains( const OGRGeometry * ) const;
504 virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
505 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
506 // virtual OGRGeometry *LocateAlong( double mValue ) const;
507 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
508
509 virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
510 virtual double Distance( const OGRGeometry * ) const ;
511 virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
512 virtual OGRGeometry *ConcaveHull(double dfRatio, bool bAllowHoles) const CPL_WARN_UNUSED_RESULT;
513 virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
514 const CPL_WARN_UNUSED_RESULT;
515 virtual OGRGeometry *Intersection( const OGRGeometry *)
516 const CPL_WARN_UNUSED_RESULT;
517 virtual OGRGeometry *Union( const OGRGeometry * )
518 const CPL_WARN_UNUSED_RESULT;
519 virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
520 virtual OGRGeometry *Difference( const OGRGeometry * )
521 const CPL_WARN_UNUSED_RESULT;
522 virtual OGRGeometry *SymDifference( const OGRGeometry * )
523 const CPL_WARN_UNUSED_RESULT;
524 virtual OGRErr Centroid( OGRPoint * poPoint ) const;
525 virtual OGRGeometry *Simplify(double dTolerance)
526 const CPL_WARN_UNUSED_RESULT;
527 OGRGeometry *SimplifyPreserveTopology(double dTolerance)
528 const CPL_WARN_UNUSED_RESULT;
529 virtual OGRGeometry *DelaunayTriangulation(
530 double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
531
532 virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
533
534 virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
535
537 // backward compatibility to non-standard method names.
538 OGRBoolean Intersect( OGRGeometry * )
539 const CPL_WARN_DEPRECATED("Non standard method. "
540 "Use Intersects() instead");
541 OGRBoolean Equal( OGRGeometry * )
542 const CPL_WARN_DEPRECATED("Non standard method. "
543 "Use Equals() instead");
544 OGRGeometry *SymmetricDifference( const OGRGeometry * )
545 const CPL_WARN_DEPRECATED("Non standard method. "
546 "Use SymDifference() instead");
547 OGRGeometry *getBoundary()
548 const CPL_WARN_DEPRECATED("Non standard method. "
549 "Use Boundary() instead");
551
553 // Special HACK for DB2 7.2 support
554 static int bGenerate_DB2_V72_BYTE_ORDER;
556
557 virtual void swapXY();
559 static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
560 static OGRGeometry* CastToError( OGRGeometry* poGeom );
562
566 static inline OGRGeometryH ToHandle(OGRGeometry* poGeom)
567 { return reinterpret_cast<OGRGeometryH>(poGeom); }
568
572 static inline OGRGeometry* FromHandle(OGRGeometryH hGeom)
573 { return reinterpret_cast<OGRGeometry*>(hGeom); }
574
579 inline OGRPoint* toPoint()
580 { return cpl::down_cast<OGRPoint*>(this); }
581
586 inline const OGRPoint* toPoint() const
587 { return cpl::down_cast<const OGRPoint*>(this); }
588
593 inline OGRCurve* toCurve()
594 { return cpl::down_cast<OGRCurve*>(this); }
595
600 inline const OGRCurve* toCurve() const
601 { return cpl::down_cast<const OGRCurve*>(this); }
602
607 inline OGRSimpleCurve* toSimpleCurve()
608 { return cpl::down_cast<OGRSimpleCurve*>(this); }
609
614 inline const OGRSimpleCurve* toSimpleCurve() const
615 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
616
621 inline OGRLineString* toLineString()
622 { return cpl::down_cast<OGRLineString*>(this); }
623
628 inline const OGRLineString* toLineString() const
629 { return cpl::down_cast<const OGRLineString*>(this); }
630
635 inline OGRLinearRing* toLinearRing()
636 { return cpl::down_cast<OGRLinearRing*>(this); }
637
642 inline const OGRLinearRing* toLinearRing() const
643 { return cpl::down_cast<const OGRLinearRing*>(this); }
644
649 inline OGRCircularString* toCircularString()
650 { return cpl::down_cast<OGRCircularString*>(this); }
651
656 inline const OGRCircularString* toCircularString() const
657 { return cpl::down_cast<const OGRCircularString*>(this); }
658
663 inline OGRCompoundCurve* toCompoundCurve()
664 { return cpl::down_cast<OGRCompoundCurve*>(this); }
665
670 inline const OGRCompoundCurve* toCompoundCurve() const
671 { return cpl::down_cast<const OGRCompoundCurve*>(this); }
672
677 inline OGRSurface* toSurface()
678 { return cpl::down_cast<OGRSurface*>(this); }
679
684 inline const OGRSurface* toSurface() const
685 { return cpl::down_cast<const OGRSurface*>(this); }
686
691 inline OGRPolygon* toPolygon()
692 { return cpl::down_cast<OGRPolygon*>(this); }
693
698 inline const OGRPolygon* toPolygon() const
699 { return cpl::down_cast<const OGRPolygon*>(this); }
700
705 inline OGRTriangle* toTriangle()
706 { return cpl::down_cast<OGRTriangle*>(this); }
707
712 inline const OGRTriangle* toTriangle() const
713 { return cpl::down_cast<const OGRTriangle*>(this); }
714
719 inline OGRCurvePolygon* toCurvePolygon()
720 { return cpl::down_cast<OGRCurvePolygon*>(this); }
721
726 inline const OGRCurvePolygon* toCurvePolygon() const
727 { return cpl::down_cast<const OGRCurvePolygon*>(this); }
728
733 inline OGRGeometryCollection* toGeometryCollection()
734 { return cpl::down_cast<OGRGeometryCollection*>(this); }
735
740 inline const OGRGeometryCollection* toGeometryCollection() const
741 { return cpl::down_cast<const OGRGeometryCollection*>(this); }
742
747 inline OGRMultiPoint* toMultiPoint()
748 { return cpl::down_cast<OGRMultiPoint*>(this); }
749
754 inline const OGRMultiPoint* toMultiPoint() const
755 { return cpl::down_cast<const OGRMultiPoint*>(this); }
756
761 inline OGRMultiLineString* toMultiLineString()
762 { return cpl::down_cast<OGRMultiLineString*>(this); }
763
768 inline const OGRMultiLineString* toMultiLineString() const
769 { return cpl::down_cast<const OGRMultiLineString*>(this); }
770
775 inline OGRMultiPolygon* toMultiPolygon()
776 { return cpl::down_cast<OGRMultiPolygon*>(this); }
777
782 inline const OGRMultiPolygon* toMultiPolygon() const
783 { return cpl::down_cast<const OGRMultiPolygon*>(this); }
784
789 inline OGRMultiCurve* toMultiCurve()
790 { return cpl::down_cast<OGRMultiCurve*>(this); }
791
796 inline const OGRMultiCurve* toMultiCurve() const
797 { return cpl::down_cast<const OGRMultiCurve*>(this); }
798
803 inline OGRMultiSurface* toMultiSurface()
804 { return cpl::down_cast<OGRMultiSurface*>(this); }
805
810 inline const OGRMultiSurface* toMultiSurface() const
811 { return cpl::down_cast<const OGRMultiSurface*>(this); }
812
817 inline OGRPolyhedralSurface* toPolyhedralSurface()
818 { return cpl::down_cast<OGRPolyhedralSurface*>(this); }
819
824 inline const OGRPolyhedralSurface* toPolyhedralSurface() const
825 { return cpl::down_cast<const OGRPolyhedralSurface*>(this); }
826
831 inline OGRTriangulatedSurface* toTriangulatedSurface()
832 { return cpl::down_cast<OGRTriangulatedSurface*>(this); }
833
838 inline const OGRTriangulatedSurface* toTriangulatedSurface() const
839 { return cpl::down_cast<const OGRTriangulatedSurface*>(this); }
840
841 };
842
844 struct CPL_DLL OGRGeometryUniquePtrDeleter
845 {
846 void operator()(OGRGeometry*) const;
847 };
849
853 typedef std::unique_ptr<OGRGeometry, OGRGeometryUniquePtrDeleter> OGRGeometryUniquePtr;
854
855
857 #define OGR_FORBID_DOWNCAST_TO(name) \
858 inline OGR ## name * to ## name() = delete; \
859 inline const OGR ## name * to ## name() const = delete;
860
861 #define OGR_FORBID_DOWNCAST_TO_POINT OGR_FORBID_DOWNCAST_TO(Point)
862 #define OGR_FORBID_DOWNCAST_TO_CURVE OGR_FORBID_DOWNCAST_TO(Curve)
863 #define OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE OGR_FORBID_DOWNCAST_TO(SimpleCurve)
864 #define OGR_FORBID_DOWNCAST_TO_LINESTRING OGR_FORBID_DOWNCAST_TO(LineString)
865 #define OGR_FORBID_DOWNCAST_TO_LINEARRING OGR_FORBID_DOWNCAST_TO(LinearRing)
866 #define OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING OGR_FORBID_DOWNCAST_TO(CircularString)
867 #define OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE OGR_FORBID_DOWNCAST_TO(CompoundCurve)
868 #define OGR_FORBID_DOWNCAST_TO_SURFACE OGR_FORBID_DOWNCAST_TO(Surface)
869 #define OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON OGR_FORBID_DOWNCAST_TO(CurvePolygon)
870 #define OGR_FORBID_DOWNCAST_TO_POLYGON OGR_FORBID_DOWNCAST_TO(Polygon)
871 #define OGR_FORBID_DOWNCAST_TO_TRIANGLE OGR_FORBID_DOWNCAST_TO(Triangle)
872 #define OGR_FORBID_DOWNCAST_TO_MULTIPOINT OGR_FORBID_DOWNCAST_TO(MultiPoint)
873 #define OGR_FORBID_DOWNCAST_TO_MULTICURVE OGR_FORBID_DOWNCAST_TO(MultiCurve)
874 #define OGR_FORBID_DOWNCAST_TO_MULTILINESTRING OGR_FORBID_DOWNCAST_TO(MultiLineString)
875 #define OGR_FORBID_DOWNCAST_TO_MULTISURFACE OGR_FORBID_DOWNCAST_TO(MultiSurface)
876 #define OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON OGR_FORBID_DOWNCAST_TO(MultiPolygon)
877 #define OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION OGR_FORBID_DOWNCAST_TO(GeometryCollection)
878 #define OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE OGR_FORBID_DOWNCAST_TO(PolyhedralSurface)
879 #define OGR_FORBID_DOWNCAST_TO_TIN OGR_FORBID_DOWNCAST_TO(TriangulatedSurface)
880
881 #define OGR_ALLOW_UPCAST_TO(name) \
882 inline OGR ## name * to ## name() { return this; } \
883 inline const OGR ## name * to ## name() const { return this; }
884
885 #ifndef SUPPRESS_OGR_ALLOW_CAST_TO_THIS_WARNING
886 #define CAST_TO_THIS_WARNING CPL_WARN_DEPRECATED("Casting to this is useless")
887 #else
888 #define CAST_TO_THIS_WARNING
889 #endif
890
891 #define OGR_ALLOW_CAST_TO_THIS(name) \
892 inline OGR ## name * to ## name() CAST_TO_THIS_WARNING { return this; } \
893 inline const OGR ## name * to ## name() const CAST_TO_THIS_WARNING { return this; }
894
895 #define OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
896 OGR_FORBID_DOWNCAST_TO_CURVE \
897 OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE \
898 OGR_FORBID_DOWNCAST_TO_LINESTRING \
899 OGR_FORBID_DOWNCAST_TO_LINEARRING \
900 OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING \
901 OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE
902
903 #define OGR_FORBID_DOWNCAST_TO_ALL_SURFACES \
904 OGR_FORBID_DOWNCAST_TO_SURFACE \
905 OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON \
906 OGR_FORBID_DOWNCAST_TO_POLYGON \
907 OGR_FORBID_DOWNCAST_TO_TRIANGLE \
908 OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE \
909 OGR_FORBID_DOWNCAST_TO_TIN
910
911 #define OGR_FORBID_DOWNCAST_TO_ALL_SINGLES \
912 OGR_FORBID_DOWNCAST_TO_POINT \
913 OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
914 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
915
916 #define OGR_FORBID_DOWNCAST_TO_ALL_MULTI \
917 OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION \
918 OGR_FORBID_DOWNCAST_TO_MULTIPOINT \
919 OGR_FORBID_DOWNCAST_TO_MULTICURVE \
920 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING \
921 OGR_FORBID_DOWNCAST_TO_MULTISURFACE \
922 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
923
925
926 /************************************************************************/
927 /* OGRPoint */
928 /************************************************************************/
929
936 class CPL_DLL OGRPoint : public OGRGeometry
937 {
938 double x;
939 double y;
940 double z;
941 double m;
942
943 public:
944 OGRPoint();
945 OGRPoint( double x, double y );
946 OGRPoint( double x, double y, double z );
947 OGRPoint( double x, double y, double z, double m );
948 OGRPoint( const OGRPoint& other );
949 static OGRPoint* createXYM( double x, double y, double m );
950 ~OGRPoint() override;
951
952 OGRPoint& operator=( const OGRPoint& other );
953
954 // IWks Interface
955 size_t WkbSize() const override;
956 OGRErr importFromWkb( const unsigned char *,
957 size_t,
958 OGRwkbVariant,
959 size_t& nBytesConsumedOut ) override;
960 OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
961 OGRwkbVariant=wkbVariantOldOgc )
962 const override;
963
964 #ifndef DOXYGEN_XML
965 using OGRGeometry::importFromWkt;
966 #endif
967
968 OGRErr importFromWkt( const char ** ) override;
969
970 #ifndef DOXYGEN_XML
971 using OGRGeometry::exportToWkt;
972 #endif
973
978 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
979 OGRErr *err = nullptr) const override;
980
981 // IGeometry
982 virtual int getDimension() const override;
983 virtual OGRPoint *clone() const override;
984 virtual void empty() override;
985 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
986 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
987 virtual OGRBoolean IsEmpty() const override
988 { return !(flags & OGR_G_NOT_EMPTY_POINT); }
989
990 // IPoint
992 double getX() const { return x; }
994 double getY() const { return y; }
996 double getZ() const { return z; }
998 double getM() const { return m; }
999
1000 // Non standard
1001 virtual void setCoordinateDimension( int nDimension ) override;
1005 void setX( double xIn ) { x = xIn; if( std::isnan(x) || std::isnan(y) ) flags &= ~OGR_G_NOT_EMPTY_POINT; else flags |= OGR_G_NOT_EMPTY_POINT; }
1009 void setY( double yIn ) { y = yIn; if( std::isnan(x) || std::isnan(y) ) flags &= ~OGR_G_NOT_EMPTY_POINT; else flags |= OGR_G_NOT_EMPTY_POINT; }
1013 void setZ( double zIn )
1014 { z = zIn; flags |= OGR_G_3D; }
1018 void setM( double mIn )
1019 { m = mIn; flags |= OGR_G_MEASURED; }
1020
1021 // ISpatialRelation
1022 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1023 virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
1024 virtual OGRBoolean Within( const OGRGeometry * ) const override;
1025
1026 // Non standard from OGRGeometry
1027 virtual const char *getGeometryName() const override;
1028 virtual OGRwkbGeometryType getGeometryType() const override;
1029 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1030 virtual void flattenTo2D() override;
1031 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1032 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1033
1034 virtual void swapXY() override;
1035
1036 OGR_ALLOW_CAST_TO_THIS(Point)
1037 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
1038 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1039 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1040 };
1041
1042 /************************************************************************/
1043 /* OGRPointIterator */
1044 /************************************************************************/
1045
1052 class CPL_DLL OGRPointIterator
1053 {
1054 public:
1055 virtual ~OGRPointIterator();
1056 virtual OGRBoolean getNextPoint( OGRPoint* p ) = 0;
1057
1058 static void destroy( OGRPointIterator* );
1059 };
1060
1061 /************************************************************************/
1062 /* OGRCurve */
1063 /************************************************************************/
1064
1070 class CPL_DLL OGRCurve : public OGRGeometry
1071 {
1072 protected:
1074 OGRCurve();
1075 OGRCurve( const OGRCurve& other );
1076
1077 virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
1078 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
1079
1080 friend class OGRCurvePolygon;
1081 friend class OGRCompoundCurve;
1083 virtual int ContainsPoint( const OGRPoint* p ) const;
1084 virtual int IntersectsPoint( const OGRPoint* p ) const;
1085 virtual double get_AreaOfCurveSegments() const = 0;
1086
1087 private:
1088
1089 class CPL_DLL ConstIterator
1090 {
1091 struct Private;
1092 std::unique_ptr<Private> m_poPrivate;
1093 public:
1094 ConstIterator(const OGRCurve* poSelf, bool bStart);
1095 ConstIterator(ConstIterator&& oOther) noexcept;
1096 ConstIterator& operator=(ConstIterator&& oOther);
1097 ~ConstIterator();
1098 const OGRPoint& operator*() const;
1099 ConstIterator& operator++();
1100 bool operator!=(const ConstIterator& it) const;
1101 };
1102
1103 friend inline ConstIterator begin(const OGRCurve*);
1104 friend inline ConstIterator end(const OGRCurve*);
1105
1106 public:
1107 ~OGRCurve() override;
1108
1110 OGRCurve& operator=( const OGRCurve& other );
1112
1114 typedef OGRPoint ChildType;
1115
1124 ConstIterator begin() const;
1126 ConstIterator end() const;
1127
1128 // IGeometry
1129 virtual OGRCurve *clone() const override = 0;
1130
1131 // ICurve methods
1132 virtual double get_Length() const = 0;
1133 virtual void StartPoint( OGRPoint * ) const = 0;
1134 virtual void EndPoint( OGRPoint * ) const = 0;
1135 virtual int get_IsClosed() const;
1136 virtual void Value( double, OGRPoint * ) const = 0;
1137 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1138 const char* const* papszOptions = nullptr)
1139 const = 0;
1140 virtual int getDimension() const override;
1141
1142 // non standard
1143 virtual int getNumPoints() const = 0;
1144 virtual OGRPointIterator* getPointIterator() const = 0;
1145 virtual OGRBoolean IsConvex() const;
1146 virtual double get_Area() const = 0;
1147 virtual int isClockwise() const;
1148
1151 inline OGRSimpleCurve* toSimpleCurve()
1152 { return cpl::down_cast<OGRSimpleCurve*>(this); }
1153
1156 inline const OGRSimpleCurve* toSimpleCurve() const
1157 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
1158
1159 static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
1160 static OGRLineString* CastToLineString( OGRCurve* poCurve );
1161 static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
1162
1163 OGR_FORBID_DOWNCAST_TO_POINT
1164 OGR_ALLOW_CAST_TO_THIS(Curve)
1165 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1166 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1167 };
1168
1170
1171 inline OGRCurve::ConstIterator begin(const OGRCurve* poCurve) { return poCurve->begin(); }
1173 inline OGRCurve::ConstIterator end(const OGRCurve* poCurve) { return poCurve->end(); }
1175
1176
1177 /************************************************************************/
1178 /* OGRIteratedPoint */
1179 /************************************************************************/
1180
1202 class CPL_DLL OGRIteratedPoint: public OGRPoint
1203 {
1204 private:
1205 friend class OGRSimpleCurve;
1206
1207 OGRSimpleCurve* m_poCurve = nullptr;
1208 int m_nPos = 0;
1209
1210 OGRIteratedPoint() = default;
1211
1212 CPL_DISALLOW_COPY_ASSIGN(OGRIteratedPoint)
1213
1214 public:
1218 void setX( double xIn );
1222 void setY( double yIn );
1226 void setZ( double zIn );
1230 void setM( double mIn );
1231 };
1232
1233
1234 /************************************************************************/
1235 /* OGRSimpleCurve */
1236 /************************************************************************/
1237
1247 class CPL_DLL OGRSimpleCurve: public OGRCurve
1248 {
1249 protected:
1251 friend class OGRGeometry;
1252
1253 int nPointCount;
1254 OGRRawPoint *paoPoints;
1255 double *padfZ;
1256 double *padfM;
1257
1258 void Make3D();
1259 void Make2D();
1260 void RemoveM();
1261 void AddM();
1262
1263 OGRErr importFromWKTListOnly( const char ** ppszInput, int bHasZ, int bHasM,
1264 OGRRawPoint*& paoPointsIn,
1265 int& nMaxPoints,
1266 double*& padfZIn );
1268
1269 virtual double get_LinearArea() const;
1270
1271 OGRSimpleCurve();
1272 OGRSimpleCurve( const OGRSimpleCurve& other );
1273
1274 private:
1275 class CPL_DLL Iterator
1276 {
1277 struct Private;
1278 std::unique_ptr<Private> m_poPrivate;
1279 void update();
1280 public:
1281 Iterator(OGRSimpleCurve* poSelf, int nPos);
1282 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1283 ~Iterator();
1284 OGRIteratedPoint& operator*();
1285 Iterator& operator++();
1286 bool operator!=(const Iterator& it) const;
1287 };
1288
1289 friend inline Iterator begin(OGRSimpleCurve*);
1290 friend inline Iterator end(OGRSimpleCurve*);
1291
1292 class CPL_DLL ConstIterator
1293 {
1294 struct Private;
1295 std::unique_ptr<Private> m_poPrivate;
1296 public:
1297 ConstIterator(const OGRSimpleCurve* poSelf, int nPos);
1298 ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1299 ~ConstIterator();
1300 const OGRPoint& operator*() const;
1301 ConstIterator& operator++();
1302 bool operator!=(const ConstIterator& it) const;
1303 };
1304
1305 friend inline ConstIterator begin(const OGRSimpleCurve*);
1306 friend inline ConstIterator end(const OGRSimpleCurve*);
1307
1308 public:
1309 ~OGRSimpleCurve() override;
1310
1311 OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
1312
1314 typedef OGRPoint ChildType;
1315
1324 Iterator begin();
1326 Iterator end();
1335 ConstIterator begin() const;
1337 ConstIterator end() const;
1338
1339 // IWks Interface.
1340 virtual size_t WkbSize() const override;
1341 virtual OGRErr importFromWkb( const unsigned char *,
1342 size_t,
1343 OGRwkbVariant,
1344 size_t& nBytesConsumedOut ) override;
1345 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1346 OGRwkbVariant=wkbVariantOldOgc )
1347 const override;
1348
1349 #ifndef DOXYGEN_XML
1350 using OGRGeometry::importFromWkt;
1351 #endif
1352
1353 OGRErr importFromWkt( const char ** ) override;
1354
1355 #ifndef DOXYGEN_XML
1356 using OGRGeometry::exportToWkt;
1357 #endif
1358
1363 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
1364 OGRErr *err = nullptr) const override;
1365
1366 // IGeometry interface.
1367 virtual void empty() override;
1368 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1369 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1370 virtual OGRBoolean IsEmpty() const override;
1371 virtual OGRSimpleCurve *clone() const override = 0;
1372
1373 // ICurve methods.
1374 virtual double get_Length() const override;
1375 virtual void StartPoint( OGRPoint * ) const override;
1376 virtual void EndPoint( OGRPoint * ) const override;
1377 virtual void Value( double, OGRPoint * ) const override;
1378 virtual double Project( const OGRPoint * ) const;
1379 virtual OGRLineString* getSubLine( double, double, int ) const;
1380
1381 // ILineString methods.
1382 virtual int getNumPoints() const override { return nPointCount; }
1383 void getPoint( int, OGRPoint * ) const;
1384 double getX( int i ) const { return paoPoints[i].x; }
1385 double getY( int i ) const { return paoPoints[i].y; }
1386 double getZ( int i ) const;
1387 double getM( int i ) const;
1388
1389 // ISpatialRelation
1390 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1391
1392 // non standard.
1393 virtual void setCoordinateDimension( int nDimension ) override;
1394 virtual void set3D( OGRBoolean bIs3D ) override;
1395 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1396 void setNumPoints( int nNewPointCount,
1397 int bZeroizeNewContent = TRUE );
1398 void setPoint( int, OGRPoint * );
1399 void setPoint( int, double, double );
1400 void setZ( int, double );
1401 void setM( int, double );
1402 void setPoint( int, double, double, double );
1403 void setPointM( int, double, double, double );
1404 void setPoint( int, double, double, double, double );
1405 void setPoints( int, const OGRRawPoint *, const double * = nullptr );
1406 void setPointsM( int, const OGRRawPoint *, const double * );
1407 void setPoints( int, const OGRRawPoint *, const double *, const double * );
1408 void setPoints( int, const double * padfX, const double * padfY,
1409 const double *padfZIn = nullptr );
1410 void setPointsM( int, const double * padfX, const double * padfY,
1411 const double *padfMIn = nullptr );
1412 void setPoints( int, const double * padfX, const double * padfY,
1413 const double *padfZIn, const double *padfMIn );
1414 void addPoint( const OGRPoint * );
1415 void addPoint( double, double );
1416 void addPoint( double, double, double );
1417 void addPointM( double, double, double );
1418 void addPoint( double, double, double, double );
1419
1420 bool removePoint( int );
1421
1422 void getPoints( OGRRawPoint *, double * = nullptr ) const;
1423 void getPoints( void* pabyX, int nXStride,
1424 void* pabyY, int nYStride,
1425 void* pabyZ = nullptr, int nZStride = 0,
1426 void* pabyM = nullptr, int nMStride = 0 ) const;
1427
1428 void addSubLineString( const OGRLineString *,
1429 int nStartVertex = 0, int nEndVertex = -1 );
1430 void reversePoints( void );
1431 virtual OGRPointIterator* getPointIterator() const override;
1432
1433 // non-standard from OGRGeometry
1434 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1435 virtual void flattenTo2D() override;
1436 virtual void segmentize(double dfMaxLength) override;
1437
1438 virtual void swapXY() override;
1439
1440 OGR_ALLOW_UPCAST_TO(Curve)
1441 OGR_ALLOW_CAST_TO_THIS(SimpleCurve)
1442 };
1443
1445
1446 inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1448 inline OGRSimpleCurve::Iterator end(OGRSimpleCurve* poCurve) { return poCurve->end(); }
1449
1451 inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1453 inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve* poCurve) { return poCurve->end(); }
1455
1456 /************************************************************************/
1457 /* OGRLineString */
1458 /************************************************************************/
1459
1467 class CPL_DLL OGRLineString : public OGRSimpleCurve
1468 {
1469 // cppcheck-suppress unusedPrivateFunction
1470 static OGRLinearRing* CasterToLinearRing(OGRCurve* poCurve);
1471
1472 protected:
1474 static OGRLineString* TransferMembersAndDestroy(
1475 OGRLineString* poSrc,
1476 OGRLineString* poDst);
1477
1478 virtual OGRCurveCasterToLineString GetCasterToLineString()
1479 const override;
1480 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1481 const override;
1482
1483 virtual double get_AreaOfCurveSegments() const override;
1485
1486 static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
1487
1488 public:
1489 OGRLineString();
1490 OGRLineString( const OGRLineString& other );
1491 ~OGRLineString() override;
1492
1493 OGRLineString& operator=(const OGRLineString& other);
1494
1495 virtual OGRLineString *clone() const override;
1496 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1497 const char* const* papszOptions = nullptr )
1498 const override;
1499 virtual OGRGeometry* getCurveGeometry(
1500 const char* const* papszOptions = nullptr ) const override;
1501 virtual double get_Area() const override;
1502
1503 // Non-standard from OGRGeometry.
1504 virtual OGRwkbGeometryType getGeometryType() const override;
1505 virtual const char *getGeometryName() const override;
1506 virtual int isClockwise() const override;
1507
1509 inline OGRSimpleCurve* toUpperClass() { return this; }
1511 inline const OGRSimpleCurve* toUpperClass() const { return this; }
1512
1513 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1514 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1515
1516 OGR_ALLOW_UPCAST_TO(SimpleCurve)
1517 OGR_ALLOW_CAST_TO_THIS(LineString)
1518 };
1519
1520 /************************************************************************/
1521 /* OGRLinearRing */
1522 /************************************************************************/
1523
1544 class CPL_DLL OGRLinearRing : public OGRLineString
1545 {
1546 static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1547
1548 // IWks Interface - Note this isn't really a first class object
1549 // for the purposes of WKB form. These methods always fail since this
1550 // object can't be serialized on its own.
1551 virtual size_t WkbSize() const override;
1552 virtual OGRErr importFromWkb( const unsigned char *,
1553 size_t,
1554 OGRwkbVariant,
1555 size_t& nBytesConsumedOut ) override;
1556 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1557 OGRwkbVariant=wkbVariantOldOgc )
1558 const override;
1559
1560 protected:
1562 friend class OGRPolygon;
1563 friend class OGRTriangle;
1564
1565 // These are not IWks compatible ... just a convenience for OGRPolygon.
1566 virtual size_t _WkbSize( int _flags ) const;
1567 virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
1568 const unsigned char *, size_t,
1569 size_t& nBytesConsumedOut );
1570 virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
1571 unsigned char * ) const;
1572
1573 virtual OGRCurveCasterToLineString GetCasterToLineString()
1574 const override;
1575 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1576 const override;
1578
1579 static OGRLineString* CastToLineString( OGRLinearRing* poLR );
1580
1581 public:
1582 OGRLinearRing();
1583 OGRLinearRing( const OGRLinearRing& other );
1584 explicit OGRLinearRing( OGRLinearRing * );
1585 ~OGRLinearRing() override;
1586
1587 OGRLinearRing& operator=( const OGRLinearRing& other );
1588
1589 // Non standard.
1590 virtual const char *getGeometryName() const override;
1591 virtual OGRLinearRing *clone() const override;
1592 virtual void reverseWindingOrder();
1593 virtual void closeRings() override;
1594 OGRBoolean isPointInRing( const OGRPoint* pt,
1595 int bTestEnvelope = TRUE ) const;
1596 OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
1597 int bTestEnvelope = TRUE ) const;
1598 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1599
1601 inline OGRLineString* toUpperClass() { return this; }
1603 inline const OGRLineString* toUpperClass() const { return this; }
1604
1605 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1606 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1607
1608 OGR_ALLOW_UPCAST_TO(LineString)
1609 OGR_ALLOW_CAST_TO_THIS(LinearRing)
1610 };
1611
1612 /************************************************************************/
1613 /* OGRCircularString */
1614 /************************************************************************/
1615
1628 class CPL_DLL OGRCircularString : public OGRSimpleCurve
1629 {
1630 private:
1631 void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
1632 OGRBoolean IsValidFast() const;
1633 int IsFullCircle( double& cx, double& cy, double& square_R ) const;
1634
1635 protected:
1637 virtual OGRCurveCasterToLineString GetCasterToLineString()
1638 const override;
1639 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1640 const override;
1641 virtual int IntersectsPoint( const OGRPoint* p ) const override;
1642 virtual int ContainsPoint( const OGRPoint* p ) const override;
1643 virtual double get_AreaOfCurveSegments() const override;
1645
1646 public:
1647 OGRCircularString();
1648 OGRCircularString( const OGRCircularString& other );
1649 ~OGRCircularString() override;
1650
1651 OGRCircularString& operator=(const OGRCircularString& other);
1652
1653 // IWks Interface.
1654 virtual OGRErr importFromWkb( const unsigned char *,
1655 size_t,
1656 OGRwkbVariant,
1657 size_t& nBytesConsumedOut ) override;
1658 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1659 OGRwkbVariant=wkbVariantOldOgc )
1660 const override;
1661
1662 #ifndef DOXYGEN_XML
1663 using OGRGeometry::importFromWkt;
1664 #endif
1665
1666 OGRErr importFromWkt( const char ** ) override;
1667
1668 #ifndef DOXYGEN_XML
1669 using OGRGeometry::exportToWkt;
1670 #endif
1671
1676 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
1677 OGRErr *err = nullptr) const override;
1678
1679 // IGeometry interface.
1680 virtual OGRBoolean IsValid() const override;
1681 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1682 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1683 virtual OGRCircularString *clone() const override;
1684
1685 // ICurve methods.
1686 virtual double get_Length() const override;
1687 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1688 const char* const* papszOptions = nullptr )
1689 const override;
1690 virtual void Value( double, OGRPoint * ) const override;
1691 virtual double get_Area() const override;
1692
1693 // Non-standard from OGRGeometry.
1694 virtual OGRwkbGeometryType getGeometryType() const override;
1695 virtual const char *getGeometryName() const override;
1696 virtual void segmentize( double dfMaxLength ) override;
1697 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1698 const override;
1699 virtual OGRGeometry* getLinearGeometry(
1700 double dfMaxAngleStepSizeDegrees = 0,
1701 const char* const* papszOptions = nullptr) const override;
1702
1704 inline OGRSimpleCurve* toUpperClass() { return this; }
1706 inline const OGRSimpleCurve* toUpperClass() const { return this; }
1707
1708 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1709 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1710
1711 OGR_ALLOW_UPCAST_TO(SimpleCurve)
1712 OGR_ALLOW_CAST_TO_THIS(CircularString)
1713 };
1714
1715 /************************************************************************/
1716 /* OGRCurveCollection */
1717 /************************************************************************/
1718
1729 class CPL_DLL OGRCurveCollection
1731 {
1732 protected:
1733 friend class OGRCompoundCurve;
1734 friend class OGRCurvePolygon;
1735 friend class OGRPolygon;
1736 friend class OGRTriangle;
1737
1738 int nCurveCount = 0;
1739 OGRCurve **papoCurves = nullptr;
1740
1741 public:
1742 OGRCurveCollection();
1743 OGRCurveCollection(const OGRCurveCollection& other);
1744 ~OGRCurveCollection();
1745
1746 OGRCurveCollection& operator=(const OGRCurveCollection& other);
1747
1749 typedef OGRCurve ChildType;
1750
1754 OGRCurve** begin() { return papoCurves; }
1756 OGRCurve** end() { return papoCurves + nCurveCount; }
1760 const OGRCurve* const* begin() const { return papoCurves; }
1762 const OGRCurve* const* end() const { return papoCurves + nCurveCount; }
1763
1764 void empty(OGRGeometry* poGeom);
1765 OGRBoolean IsEmpty() const;
1766 void getEnvelope( OGREnvelope * psEnvelope ) const;
1767 void getEnvelope( OGREnvelope3D * psEnvelope ) const;
1768
1769 OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
1770 int bNeedRealloc );
1771 size_t WkbSize() const;
1772 OGRErr importPreambleFromWkb( OGRGeometry* poGeom,
1773 const unsigned char * pabyData,
1774 size_t& nSize,
1775 size_t& nDataOffset,
1776 OGRwkbByteOrder& eByteOrder,
1777 size_t nMinSubGeomSize,
1778 OGRwkbVariant eWkbVariant );
1779 OGRErr importBodyFromWkb(
1780 OGRGeometry* poGeom,
1781 const unsigned char * pabyData,
1782 size_t nSize,
1783 bool bAcceptCompoundCurve,
1784 OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
1785 OGRCurve* poCurve ),
1786 OGRwkbVariant eWkbVariant,
1787 size_t& nBytesConsumedOut );
1788 std::string exportToWkt(const OGRGeometry *geom, const OGRWktOptions& opts,
1789 OGRErr *err) const;
1790 OGRErr exportToWkb( const OGRGeometry* poGeom, OGRwkbByteOrder,
1791 unsigned char *,
1792 OGRwkbVariant eWkbVariant ) const;
1793 OGRBoolean Equals(const OGRCurveCollection *poOCC) const;
1794 void setCoordinateDimension( OGRGeometry* poGeom,
1795 int nNewDimension );
1796 void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
1797 void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
1798 void assignSpatialReference( OGRGeometry* poGeom, OGRSpatialReference * poSR );
1799 int getNumCurves() const;
1800 OGRCurve *getCurve( int );
1801 const OGRCurve *getCurve( int ) const;
1802 OGRCurve *stealCurve( int );
1803
1804 OGRErr removeCurve( int iIndex, bool bDelete = true );
1805
1806 OGRErr transform( OGRGeometry* poGeom,
1807 OGRCoordinateTransformation *poCT );
1808 void flattenTo2D( OGRGeometry* poGeom );
1809 void segmentize( double dfMaxLength );
1810 void swapXY();
1811 OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
1812 };
1814
1815 /************************************************************************/
1816 /* OGRCompoundCurve */
1817 /************************************************************************/
1818
1829 class CPL_DLL OGRCompoundCurve : public OGRCurve
1830 {
1831 private:
1832 OGRCurveCollection oCC{};
1833
1834 OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
1835 double dfToleranceEps,
1836 int bNeedRealloc );
1837 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1838 OGRCurve* poCurve );
1839 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1840 OGRCurve* poCurve );
1841 OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
1842 const char* const* papszOptions,
1843 int bIsLinearRing ) const;
1844 // cppcheck-suppress unusedPrivateFunction
1845 static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1846 // cppcheck-suppress unusedPrivateFunction
1847 static OGRLinearRing* CasterToLinearRing( OGRCurve* poCurve );
1848
1849 protected:
1851 static OGRLineString* CastToLineString( OGRCompoundCurve* poCC );
1852 static OGRLinearRing* CastToLinearRing( OGRCompoundCurve* poCC );
1853
1854 virtual OGRCurveCasterToLineString GetCasterToLineString()
1855 const override;
1856 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1857 const override;
1859
1860 public:
1861 OGRCompoundCurve();
1862 OGRCompoundCurve( const OGRCompoundCurve& other );
1863 ~OGRCompoundCurve() override;
1864
1865 OGRCompoundCurve& operator=( const OGRCompoundCurve& other );
1866
1868 typedef OGRCurve ChildType;
1869
1873 ChildType** begin() { return oCC.begin(); }
1875 ChildType** end() { return oCC.end(); }
1879 const ChildType* const * begin() const { return oCC.begin(); }
1881 const ChildType* const * end() const { return oCC.end(); }
1882
1883 // IWks Interface
1884 virtual size_t WkbSize() const override;
1885 virtual OGRErr importFromWkb( const unsigned char *,
1886 size_t,
1887 OGRwkbVariant,
1888 size_t& nBytesConsumedOut ) override;
1889 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1890 OGRwkbVariant=wkbVariantOldOgc )
1891 const override;
1892
1893 #ifndef DOXYGEN_XML
1894 using OGRGeometry::importFromWkt;
1895 #endif
1896
1897 OGRErr importFromWkt( const char ** ) override;
1898
1899 #ifndef DOXYGEN_XML
1900 using OGRGeometry::exportToWkt;
1901 #endif
1902
1907 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
1908 OGRErr *err = nullptr) const override;
1909
1910 // IGeometry interface.
1911 virtual OGRCompoundCurve *clone() const override;
1912 virtual void empty() override;
1913 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1914 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1915 virtual OGRBoolean IsEmpty() const override;
1916
1917 // ICurve methods.
1918 virtual double get_Length() const override;
1919 virtual void StartPoint( OGRPoint * ) const override;
1920 virtual void EndPoint( OGRPoint * ) const override;
1921 virtual void Value( double, OGRPoint * ) const override;
1922 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1923 const char* const* papszOptions = nullptr )
1924 const override;
1925
1926 virtual int getNumPoints() const override;
1927 virtual double get_AreaOfCurveSegments() const override;
1928 virtual double get_Area() const override;
1929
1930 // ISpatialRelation.
1931 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1932
1933 // ICompoundCurve method.
1934 int getNumCurves() const;
1935 OGRCurve *getCurve( int );
1936 const OGRCurve *getCurve( int ) const;
1937
1938 // Non-standard.
1939 virtual void setCoordinateDimension( int nDimension ) override;
1940 virtual void set3D( OGRBoolean bIs3D ) override;
1941 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1942
1943 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1944
1945 OGRErr addCurve( const OGRCurve*, double dfToleranceEps = 1e-14 );
1946 OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
1947 OGRCurve *stealCurve( int );
1948 virtual OGRPointIterator* getPointIterator() const override;
1949
1950 // Non-standard from OGRGeometry.
1951 virtual OGRwkbGeometryType getGeometryType() const override;
1952 virtual const char *getGeometryName() const override;
1953 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1954 virtual void flattenTo2D() override;
1955 virtual void segmentize(double dfMaxLength) override;
1956 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
1957 const override;
1958 virtual OGRGeometry* getLinearGeometry(
1959 double dfMaxAngleStepSizeDegrees = 0,
1960 const char* const* papszOptions = nullptr) const override;
1961 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1962 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1963
1964 virtual void swapXY() override;
1965
1966 OGR_ALLOW_UPCAST_TO(Curve)
1967 OGR_ALLOW_CAST_TO_THIS(CompoundCurve)
1968 };
1969
1971
1972 inline const OGRCompoundCurve::ChildType* const * begin(const OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1974 inline const OGRCompoundCurve::ChildType* const * end(const OGRCompoundCurve* poCurve) { return poCurve->end(); }
1975
1977 inline OGRCompoundCurve::ChildType** begin(OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1979 inline OGRCompoundCurve::ChildType** end(OGRCompoundCurve* poCurve) { return poCurve->end(); }
1981
1982 /************************************************************************/
1983 /* OGRSurface */
1984 /************************************************************************/
1985
1991 class CPL_DLL OGRSurface : public OGRGeometry
1992 {
1993 protected:
1995 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1996 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1998
1999 public:
2000 virtual double get_Area() const = 0;
2001 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const
2002 { return PointOnSurfaceInternal(poPoint); }
2003 virtual OGRSurface *clone() const override = 0;
2004
2006 static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
2007 static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
2009
2010 OGR_FORBID_DOWNCAST_TO_POINT
2011 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
2012 OGR_ALLOW_CAST_TO_THIS(Surface)
2013 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
2014 };
2015
2016 /************************************************************************/
2017 /* OGRCurvePolygon */
2018 /************************************************************************/
2019
2033 class CPL_DLL OGRCurvePolygon : public OGRSurface
2034 {
2035 static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
2036
2037 private:
2038 OGRBoolean IntersectsPoint( const OGRPoint* p ) const;
2039 OGRBoolean ContainsPoint( const OGRPoint* p ) const;
2040 virtual int checkRing( OGRCurve * poNewRing ) const;
2041 OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
2042 int bNeedRealloc );
2043 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
2044 OGRCurve* poCurve );
2045 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
2046 OGRCurve* poCurve );
2047
2048 protected:
2050 friend class OGRPolygon;
2051 friend class OGRTriangle;
2052 OGRCurveCollection oCC{};
2053
2054 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
2055 const override;
2056 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
2057 const override;
2058
2060
2061 static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
2062
2063 public:
2064 OGRCurvePolygon();
2065 OGRCurvePolygon( const OGRCurvePolygon& );
2066 ~OGRCurvePolygon() override;
2067
2068 OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
2069
2071 typedef OGRCurve ChildType;
2072
2076 ChildType** begin() { return oCC.begin(); }
2078 ChildType** end() { return oCC.end(); }
2082 const ChildType* const * begin() const { return oCC.begin(); }
2084 const ChildType* const * end() const { return oCC.end(); }
2085
2086 // Non standard (OGRGeometry).
2087 virtual const char *getGeometryName() const override;
2088 virtual OGRwkbGeometryType getGeometryType() const override;
2089 virtual OGRCurvePolygon *clone() const override;
2090 virtual void empty() override;
2091 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
2092 virtual void flattenTo2D() override;
2093 virtual OGRBoolean IsEmpty() const override;
2094 virtual void segmentize( double dfMaxLength ) override;
2095 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2096 const override;
2097 virtual OGRGeometry* getLinearGeometry(
2098 double dfMaxAngleStepSizeDegrees = 0,
2099 const char* const* papszOptions = nullptr ) const override;
2100
2101 // ISurface Interface
2102 virtual double get_Area() const override;
2103
2104 // IWks Interface
2105 virtual size_t WkbSize() const override;
2106 virtual OGRErr importFromWkb( const unsigned char *,
2107 size_t,
2108 OGRwkbVariant,
2109 size_t& nBytesConsumedOut ) override;
2110 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2111 OGRwkbVariant=wkbVariantOldOgc )
2112 const override;
2113
2114 #ifndef DOXYGEN_XML
2115 using OGRGeometry::importFromWkt;
2116 #endif
2117
2118 OGRErr importFromWkt( const char ** ) override;
2119
2120 #ifndef DOXYGEN_XML
2121 using OGRGeometry::exportToWkt;
2122 #endif
2123
2128 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2129 OGRErr *err = nullptr) const override;
2130
2131 // IGeometry
2132 virtual int getDimension() const override;
2133 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2134 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2135
2136 // ICurvePolygon
2137 virtual OGRPolygon* CurvePolyToPoly(
2138 double dfMaxAngleStepSizeDegrees = 0,
2139 const char* const* papszOptions = nullptr ) const;
2140
2141 // ISpatialRelation
2142 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
2143 virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
2144 virtual OGRBoolean Contains( const OGRGeometry * ) const override;
2145
2146 // Non standard
2147 virtual void setCoordinateDimension( int nDimension ) override;
2148 virtual void set3D( OGRBoolean bIs3D ) override;
2149 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2150
2151 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2152
2153 virtual OGRErr addRing( OGRCurve * );
2154 virtual OGRErr addRingDirectly( OGRCurve * );
2155
2156 OGRCurve *getExteriorRingCurve();
2157 const OGRCurve *getExteriorRingCurve() const;
2158 int getNumInteriorRings() const;
2159 OGRCurve *getInteriorRingCurve( int );
2160 const OGRCurve *getInteriorRingCurve( int ) const;
2161
2162 OGRCurve *stealExteriorRingCurve();
2163
2164 OGRErr removeRing( int iIndex, bool bDelete = true );
2165 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2166 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2167
2168 virtual void swapXY() override;
2169
2170 OGR_ALLOW_UPCAST_TO(Surface)
2171 OGR_ALLOW_CAST_TO_THIS(CurvePolygon)
2172 };
2173
2175
2176 inline const OGRCurvePolygon::ChildType* const * begin(const OGRCurvePolygon* poGeom) { return poGeom->begin(); }
2178 inline const OGRCurvePolygon::ChildType* const * end(const OGRCurvePolygon* poGeom) { return poGeom->end(); }
2179
2181 inline OGRCurvePolygon::ChildType** begin(OGRCurvePolygon* poGeom) { return poGeom->begin(); }
2183 inline OGRCurvePolygon::ChildType** end(OGRCurvePolygon* poGeom) { return poGeom->end(); }
2185
2186 /************************************************************************/
2187 /* OGRPolygon */
2188 /************************************************************************/
2189
2199 class CPL_DLL OGRPolygon : public OGRCurvePolygon
2200 {
2201 static OGRCurvePolygon* CasterToCurvePolygon(OGRSurface* poSurface);
2202
2203 protected:
2205 friend class OGRMultiSurface;
2206 friend class OGRPolyhedralSurface;
2207 friend class OGRTriangulatedSurface;
2208
2209 virtual int checkRing( OGRCurve * poNewRing ) const override;
2210 virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
2211 int bHasZ, int bHasM,
2212 OGRRawPoint*& paoPoints,
2213 int& nMaxPoints,
2214 double*& padfZ );
2215
2216 static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
2217
2218 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
2219 const override;
2220 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
2221 const override;
2223
2224 public:
2225 OGRPolygon();
2226 OGRPolygon(const OGRPolygon& other);
2227 ~OGRPolygon() override;
2228
2229 OGRPolygon& operator=(const OGRPolygon& other);
2230
2232 typedef OGRLinearRing ChildType;
2233
2237 ChildType** begin() { return reinterpret_cast<ChildType**>(oCC.begin()); }
2239 ChildType** end() { return reinterpret_cast<ChildType**>(oCC.end()); }
2243 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oCC.begin()); }
2245 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oCC.end()); }
2246
2247 // Non-standard (OGRGeometry).
2248 virtual const char *getGeometryName() const override;
2249 virtual OGRwkbGeometryType getGeometryType() const override;
2250 virtual OGRPolygon *clone() const override;
2251 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2252 const override;
2253 virtual OGRGeometry* getCurveGeometry(
2254 const char* const* papszOptions = nullptr ) const override;
2255 virtual OGRGeometry* getLinearGeometry(
2256 double dfMaxAngleStepSizeDegrees = 0,
2257 const char* const* papszOptions = nullptr) const override;
2258
2259 // IWks Interface.
2260 virtual size_t WkbSize() const override;
2261 virtual OGRErr importFromWkb( const unsigned char *,
2262 size_t,
2263 OGRwkbVariant,
2264 size_t& nBytesConsumedOut ) override;
2265 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2266 OGRwkbVariant=wkbVariantOldOgc )
2267 const override;
2268
2269 #ifndef DOXYGEN_XML
2270 using OGRGeometry::importFromWkt;
2271 #endif
2272
2273 OGRErr importFromWkt( const char ** ) override;
2274
2275 #ifndef DOXYGEN_XML
2276 using OGRGeometry::exportToWkt;
2277 #endif
2278
2283 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2284 OGRErr *err = nullptr) const override;
2285
2286 // ICurvePolygon.
2287 virtual OGRPolygon* CurvePolyToPoly(
2288 double dfMaxAngleStepSizeDegrees = 0,
2289 const char* const* papszOptions = nullptr ) const override;
2290
2291 OGRLinearRing *getExteriorRing();
2292 const OGRLinearRing *getExteriorRing() const;
2293 virtual OGRLinearRing *getInteriorRing( int );
2294 virtual const OGRLinearRing *getInteriorRing( int ) const;
2295
2296 OGRLinearRing *stealExteriorRing();
2297 virtual OGRLinearRing *stealInteriorRing(int);
2298
2299 OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
2300
2302 inline OGRCurvePolygon* toUpperClass() { return this; }
2304 inline const OGRCurvePolygon* toUpperClass() const { return this; }
2305
2306 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2307 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2308
2309 virtual void closeRings() override;
2310
2311 OGR_ALLOW_UPCAST_TO(CurvePolygon)
2312 OGR_ALLOW_CAST_TO_THIS(Polygon)
2313 };
2314
2316
2317 inline const OGRPolygon::ChildType* const * begin(const OGRPolygon* poGeom) { return poGeom->begin(); }
2319 inline const OGRPolygon::ChildType* const * end(const OGRPolygon* poGeom) { return poGeom->end(); }
2320
2322 inline OGRPolygon::ChildType** begin(OGRPolygon* poGeom) { return poGeom->begin(); }
2324 inline OGRPolygon::ChildType** end(OGRPolygon* poGeom) { return poGeom->end(); }
2326
2327 /************************************************************************/
2328 /* OGRTriangle */
2329 /************************************************************************/
2330
2337 class CPL_DLL OGRTriangle : public OGRPolygon
2338 {
2339 private:
2340 // cppcheck-suppress unusedPrivateFunction
2341 static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
2342 bool quickValidityCheck() const;
2343
2344 protected:
2346 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2347 virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
2348 int bHasZ, int bHasM,
2349 OGRRawPoint*& paoPoints,
2350 int& nMaxPoints,
2351 double*& padfZ ) override;
2353
2354 public:
2355 OGRTriangle();
2356 OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
2357 OGRTriangle( const OGRTriangle &other );
2358 OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
2359 OGRTriangle& operator=( const OGRTriangle& other );
2360 ~OGRTriangle() override;
2361 virtual const char *getGeometryName() const override;
2362 virtual OGRwkbGeometryType getGeometryType() const override;
2363 virtual OGRTriangle *clone() const override;
2364
2365 // IWks Interface.
2366 virtual OGRErr importFromWkb( const unsigned char *,
2367 size_t,
2368 OGRwkbVariant,
2369 size_t& nBytesConsumedOut ) override;
2370
2371 // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
2372 virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) override;
2373
2375 inline OGRPolygon* toUpperClass() { return this; }
2377 inline const OGRPolygon* toUpperClass() const { return this; }
2378
2379 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2380 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2381
2383 static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
2385
2386 OGR_ALLOW_UPCAST_TO(Polygon)
2387 OGR_ALLOW_CAST_TO_THIS(Triangle)
2388 };
2389
2390 /************************************************************************/
2391 /* OGRGeometryCollection */
2392 /************************************************************************/
2393
2401 class CPL_DLL OGRGeometryCollection : public OGRGeometry
2402 {
2403 OGRErr importFromWkbInternal( const unsigned char * pabyData,
2404 size_t nSize,
2405 int nRecLevel,
2406 OGRwkbVariant, size_t& nBytesConsumedOut );
2407 OGRErr importFromWktInternal( const char **ppszInput, int nRecLevel );
2408
2409 protected:
2411 int nGeomCount = 0;
2412 OGRGeometry **papoGeoms = nullptr;
2413
2414 std::string exportToWktInternal(const OGRWktOptions& opts, OGRErr *err,
2415 const std::string& exclude = std::string()) const;
2416 static OGRGeometryCollection* TransferMembersAndDestroy(
2417 OGRGeometryCollection* poSrc,
2418 OGRGeometryCollection* poDst );
2420 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2421
2422 public:
2423 OGRGeometryCollection();
2424 OGRGeometryCollection( const OGRGeometryCollection& other );
2425 ~OGRGeometryCollection() override;
2426
2427 OGRGeometryCollection& operator=( const OGRGeometryCollection& other );
2428
2430 typedef OGRGeometry ChildType;
2431
2435 ChildType** begin() { return papoGeoms; }
2437 ChildType** end() { return papoGeoms + nGeomCount; }
2441 const ChildType* const* begin() const { return papoGeoms; }
2443 const ChildType* const* end() const { return papoGeoms + nGeomCount; }
2444
2445 // Non standard (OGRGeometry).
2446 virtual const char *getGeometryName() const override;
2447 virtual OGRwkbGeometryType getGeometryType() const override;
2448 virtual OGRGeometryCollection *clone() const override;
2449 virtual void empty() override;
2450 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
2451 virtual void flattenTo2D() override;
2452 virtual OGRBoolean IsEmpty() const override;
2453 virtual void segmentize(double dfMaxLength) override;
2454 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2455 const override;
2456 virtual OGRGeometry* getCurveGeometry(
2457 const char* const* papszOptions = nullptr ) const override;
2458 virtual OGRGeometry* getLinearGeometry(
2459 double dfMaxAngleStepSizeDegrees = 0,
2460 const char* const* papszOptions = nullptr ) const override;
2461
2462 // IWks Interface
2463 virtual size_t WkbSize() const override;
2464 virtual OGRErr importFromWkb( const unsigned char *,
2465 size_t,
2466 OGRwkbVariant,
2467 size_t& nBytesConsumedOut ) override;
2468 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2469 OGRwkbVariant=wkbVariantOldOgc )
2470 const override;
2471
2472 #ifndef DOXYGEN_XML
2473 using OGRGeometry::importFromWkt;
2474 #endif
2475
2476 OGRErr importFromWkt( const char ** ) override;
2477
2478 #ifndef DOXYGEN_XML
2479 using OGRGeometry::exportToWkt;
2480 #endif
2481
2486 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2487 OGRErr *err = nullptr) const override;
2488
2489 virtual double get_Length() const;
2490 virtual double get_Area() const;
2491
2492 // IGeometry methods
2493 virtual int getDimension() const override;
2494 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2495 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2496
2497 // IGeometryCollection
2498 int getNumGeometries() const;
2499 OGRGeometry *getGeometryRef( int );
2500 const OGRGeometry *getGeometryRef( int ) const;
2501
2502 // ISpatialRelation
2503 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
2504
2505 // Non standard
2506 virtual void setCoordinateDimension( int nDimension ) override;
2507 virtual void set3D( OGRBoolean bIs3D ) override;
2508 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2509 virtual OGRErr addGeometry( const OGRGeometry * );
2510 virtual OGRErr addGeometryDirectly( OGRGeometry * );
2511 virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2512
2513 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2514
2515 void closeRings() override;
2516
2517 virtual void swapXY() override;
2518
2519 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2520 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2521
2522 static OGRGeometryCollection* CastToGeometryCollection(
2523 OGRGeometryCollection* poSrc );
2524
2525 OGR_FORBID_DOWNCAST_TO_POINT
2526 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
2527 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
2528 OGR_ALLOW_CAST_TO_THIS(GeometryCollection)
2529 };
2530
2532
2533 inline const OGRGeometryCollection::ChildType* const * begin(const OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2535 inline const OGRGeometryCollection::ChildType* const * end(const OGRGeometryCollection* poGeom) { return poGeom->end(); }
2536
2538 inline OGRGeometryCollection::ChildType** begin(OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2540 inline OGRGeometryCollection::ChildType** end(OGRGeometryCollection* poGeom) { return poGeom->end(); }
2542
2543 /************************************************************************/
2544 /* OGRMultiSurface */
2545 /************************************************************************/
2546
2553 class CPL_DLL OGRMultiSurface : public OGRGeometryCollection
2554 {
2555 protected:
2556 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2557 const override;
2558
2559 public:
2560 OGRMultiSurface();
2561 OGRMultiSurface( const OGRMultiSurface& other );
2562 ~OGRMultiSurface() override;
2563
2564 OGRMultiSurface& operator=( const OGRMultiSurface& other );
2565
2567 typedef OGRSurface ChildType;
2568
2572 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2574 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2578 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2580 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2581
2582 // Non standard (OGRGeometry).
2583 virtual const char *getGeometryName() const override;
2584 virtual OGRwkbGeometryType getGeometryType() const override;
2585 virtual OGRMultiSurface *clone() const override;
2586
2587 #ifndef DOXYGEN_XML
2588 using OGRGeometry::importFromWkt;
2589 #endif
2590
2591 OGRErr importFromWkt( const char ** ) override;
2592
2593 #ifndef DOXYGEN_XML
2594 using OGRGeometry::exportToWkt;
2595 #endif
2596
2601 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2602 OGRErr *err = nullptr) const override;
2603
2604 // IMultiSurface methods
2605 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
2606
2607 // IGeometry methods
2608 virtual int getDimension() const override;
2609
2610 // IGeometryCollection
2612 OGRSurface *getGeometryRef( int i) { return OGRGeometryCollection::getGeometryRef(i)->toSurface(); }
2614 const OGRSurface *getGeometryRef( int i ) const { return OGRGeometryCollection::getGeometryRef(i)->toSurface(); }
2615
2616 // Non standard
2617 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2618 const override;
2619
2621 inline OGRGeometryCollection* toUpperClass() { return this; }
2623 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2624
2625 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2626 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2627
2628 static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
2629
2630 OGR_ALLOW_CAST_TO_THIS(MultiSurface)
2631 OGR_ALLOW_UPCAST_TO(GeometryCollection)
2632 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
2633 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
2634 OGR_FORBID_DOWNCAST_TO_MULTICURVE
2635 };
2636
2638
2639 inline const OGRMultiSurface::ChildType* const * begin(const OGRMultiSurface* poGeom) { return poGeom->begin(); }
2641 inline const OGRMultiSurface::ChildType* const * end(const OGRMultiSurface* poGeom) { return poGeom->end(); }
2642
2644 inline OGRMultiSurface::ChildType** begin(OGRMultiSurface* poGeom) { return poGeom->begin(); }
2646 inline OGRMultiSurface::ChildType** end(OGRMultiSurface* poGeom) { return poGeom->end(); }
2648
2649 /************************************************************************/
2650 /* OGRMultiPolygon */
2651 /************************************************************************/
2652
2657 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
2658 {
2659 protected:
2660 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2661 const override;
2662 friend class OGRPolyhedralSurface;
2663 friend class OGRTriangulatedSurface;
2664
2665 private:
2667 OGRErr _addGeometryWithExpectedSubGeometryType(
2668 const OGRGeometry * poNewGeom,
2669 OGRwkbGeometryType eSubGeometryType );
2670 OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
2671 OGRGeometry * poNewGeom,
2672 OGRwkbGeometryType eSubGeometryType );
2674
2675
2676 public:
2677 OGRMultiPolygon();
2678 OGRMultiPolygon( const OGRMultiPolygon& other );
2679 ~OGRMultiPolygon() override;
2680
2681 OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
2682
2684 typedef OGRPolygon ChildType;
2685
2689 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2691 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2695 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2697 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2698
2699 // IGeometryCollection
2701 OGRPolygon *getGeometryRef( int i) { return OGRGeometryCollection::getGeometryRef(i)->toPolygon(); }
2703 const OGRPolygon *getGeometryRef( int i ) const { return OGRGeometryCollection::getGeometryRef(i)->toPolygon(); }
2704
2705 // Non-standard (OGRGeometry).
2706 virtual const char *getGeometryName() const override;
2707 virtual OGRwkbGeometryType getGeometryType() const override;
2708 virtual OGRMultiPolygon *clone() const override;
2709
2710 #ifndef DOXYGEN_XML
2711 using OGRGeometry::exportToWkt;
2712 #endif
2713
2718 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2719 OGRErr *err = nullptr) const override;
2720
2721 // Non standard
2722 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2723 const override;
2724
2726 inline OGRGeometryCollection* toUpperClass() { return this; }
2728 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2729
2730 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2731 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2732
2733 static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
2734
2735 OGR_ALLOW_CAST_TO_THIS(MultiPolygon)
2736 OGR_ALLOW_UPCAST_TO(MultiSurface)
2737 };
2738
2740
2741 inline const OGRMultiPolygon::ChildType* const * begin(const OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2743 inline const OGRMultiPolygon::ChildType* const * end(const OGRMultiPolygon* poGeom) { return poGeom->end(); }
2744
2746 inline OGRMultiPolygon::ChildType** begin(OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2748 inline OGRMultiPolygon::ChildType** end(OGRMultiPolygon* poGeom) { return poGeom->end(); }
2750
2751 /************************************************************************/
2752 /* OGRPolyhedralSurface */
2753 /************************************************************************/
2754
2761 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
2762 {
2763 protected:
2765 friend class OGRTriangulatedSurface;
2766 OGRMultiPolygon oMP{};
2767 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
2768 const override;
2769 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
2770 const override;
2771 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2772 virtual const char* getSubGeometryName() const;
2773 virtual OGRwkbGeometryType getSubGeometryType() const;
2774 std::string exportToWktInternal (const OGRWktOptions& opts, OGRErr *err) const;
2775
2776 virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2777 const;
2778 static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
2780
2781 public:
2782 OGRPolyhedralSurface();
2783 OGRPolyhedralSurface( const OGRPolyhedralSurface &poGeom );
2784 ~OGRPolyhedralSurface() override;
2785 OGRPolyhedralSurface& operator=(const OGRPolyhedralSurface& other);
2786
2788 typedef OGRPolygon ChildType;
2789
2793 ChildType** begin() { return oMP.begin(); }
2795 ChildType** end() { return oMP.end(); }
2799 const ChildType* const* begin() const { return oMP.begin(); }
2801 const ChildType* const* end() const { return oMP.end(); }
2802
2803 // IWks Interface.
2804 virtual size_t WkbSize() const override;
2805 virtual const char *getGeometryName() const override;
2806 virtual OGRwkbGeometryType getGeometryType() const override;
2807 virtual OGRErr importFromWkb( const unsigned char *,
2808 size_t,
2809 OGRwkbVariant,
2810 size_t& nBytesConsumedOut ) override;
2811 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2812 OGRwkbVariant=wkbVariantOldOgc )
2813 const override;
2814
2815 #ifndef DOXYGEN_XML
2816 using OGRGeometry::importFromWkt;
2817 #endif
2818
2819 OGRErr importFromWkt( const char ** ) override;
2820
2821 #ifndef DOXYGEN_XML
2822 using OGRGeometry::exportToWkt;
2823 #endif
2824
2829 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2830 OGRErr *err = nullptr) const override;
2831
2832 // IGeometry methods.
2833 virtual int getDimension() const override;
2834
2835 virtual void empty() override;
2836
2837 virtual OGRPolyhedralSurface *clone() const override;
2838 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2839 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2840
2841 virtual void flattenTo2D() override;
2842 virtual OGRErr transform( OGRCoordinateTransformation* ) override;
2843 virtual OGRBoolean Equals( const OGRGeometry* ) const override;
2844 virtual double get_Area() const override;
2845 virtual OGRErr PointOnSurface( OGRPoint* ) const override;
2846
2847 static OGRMultiPolygon* CastToMultiPolygon( OGRPolyhedralSurface* poPS );
2848 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2849 const override;
2850 virtual OGRErr addGeometry( const OGRGeometry * );
2851 OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
2852 int getNumGeometries() const;
2853 OGRPolygon* getGeometryRef(int i);
2854 const OGRPolygon* getGeometryRef(int i) const;
2855
2856 virtual OGRBoolean IsEmpty() const override;
2857 virtual void setCoordinateDimension( int nDimension ) override;
2858 virtual void set3D( OGRBoolean bIs3D ) override;
2859 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2860 virtual void swapXY() override;
2861 OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2862
2863 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2864 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2865
2866 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2867
2868 OGR_ALLOW_CAST_TO_THIS(PolyhedralSurface)
2869 OGR_ALLOW_UPCAST_TO(Surface)
2870 };
2871
2873
2874 inline const OGRPolyhedralSurface::ChildType* const * begin(const OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2876 inline const OGRPolyhedralSurface::ChildType* const * end(const OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2877
2879 inline OGRPolyhedralSurface::ChildType** begin(OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2881 inline OGRPolyhedralSurface::ChildType** end(OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2883
2884 /************************************************************************/
2885 /* OGRTriangulatedSurface */
2886 /************************************************************************/
2887
2894 class CPL_DLL OGRTriangulatedSurface : public OGRPolyhedralSurface
2895 {
2896 protected:
2898 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2899 const override;
2900 virtual const char* getSubGeometryName() const override;
2901 virtual OGRwkbGeometryType getSubGeometryType() const override;
2902
2903 virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2904 const override;
2905 static OGRMultiPolygon *
2906 CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
2908
2909 public:
2910 OGRTriangulatedSurface();
2911 OGRTriangulatedSurface( const OGRTriangulatedSurface &other );
2912 ~OGRTriangulatedSurface();
2913
2915 typedef OGRTriangle ChildType;
2916
2920 ChildType** begin() { return reinterpret_cast<ChildType**>(oMP.begin()); }
2922 ChildType** end() { return reinterpret_cast<ChildType**>(oMP.end()); }
2926 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oMP.begin()); }
2928 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oMP.end()); }
2929
2930 OGRTriangulatedSurface& operator=( const OGRTriangulatedSurface& other );
2931 virtual const char *getGeometryName() const override;
2932 virtual OGRwkbGeometryType getGeometryType() const override;
2933 virtual OGRTriangulatedSurface *clone() const override;
2934
2936 OGRTriangle* getGeometryRef(int i) { return OGRPolyhedralSurface::getGeometryRef(i)->toTriangle(); }
2938 const OGRTriangle* getGeometryRef(int i) const { return OGRPolyhedralSurface::getGeometryRef(i)->toTriangle(); }
2939
2940 // IWks Interface.
2941 virtual OGRErr addGeometry( const OGRGeometry * ) override;
2942
2944 inline OGRPolyhedralSurface* toUpperClass() { return this; }
2946 inline const OGRPolyhedralSurface* toUpperClass() const { return this; }
2947
2948 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2949 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2950
2951 static OGRPolyhedralSurface *
2952 CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
2953
2954 OGR_ALLOW_CAST_TO_THIS(TriangulatedSurface)
2955 OGR_ALLOW_UPCAST_TO(PolyhedralSurface)
2956 };
2957
2959
2960 inline const OGRTriangulatedSurface::ChildType* const * begin(const OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2962 inline const OGRTriangulatedSurface::ChildType* const * end(const OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2963
2965 inline OGRTriangulatedSurface::ChildType** begin(OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2967 inline OGRTriangulatedSurface::ChildType** end(OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2969
2970 /************************************************************************/
2971 /* OGRMultiPoint */
2972 /************************************************************************/
2973
2978 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
2979 {
2980 private:
2981 OGRErr importFromWkt_Bracketed( const char **, int bHasM, int bHasZ );
2982
2983 protected:
2984 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2985 const override;
2986
2987 public:
2988 OGRMultiPoint();
2989 OGRMultiPoint(const OGRMultiPoint& other);
2990 ~OGRMultiPoint() override;
2991
2992 OGRMultiPoint& operator=(const OGRMultiPoint& other);
2993
2995 typedef OGRPoint ChildType;
2996
3000 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
3002 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
3006 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
3008 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
3009
3010 // IGeometryCollection
3012 OGRPoint *getGeometryRef( int i) { return OGRGeometryCollection::getGeometryRef(i)->toPoint(); }
3014 const OGRPoint *getGeometryRef( int i ) const { return OGRGeometryCollection::getGeometryRef(i)->toPoint(); }
3015
3016 // Non-standard (OGRGeometry).
3017 virtual const char *getGeometryName() const override;
3018 virtual OGRwkbGeometryType getGeometryType() const override;
3019 virtual OGRMultiPoint *clone() const override;
3020
3021 #ifndef DOXYGEN_XML
3022 using OGRGeometry::importFromWkt;
3023 #endif
3024
3025 OGRErr importFromWkt( const char ** ) override;
3026
3027 #ifndef DOXYGEN_XML
3028 using OGRGeometry::exportToWkt;
3029 #endif
3030
3035 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
3036 OGRErr *err = nullptr) const override;
3037
3038 // IGeometry methods.
3039 virtual int getDimension() const override;
3040
3042 inline OGRGeometryCollection* toUpperClass() { return this; }
3044 inline const OGRGeometryCollection* toUpperClass() const { return this; }
3045
3046 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
3047 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
3048
3049 // Non-standard.
3050 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
3051 const override;
3052
3053 OGR_ALLOW_CAST_TO_THIS(MultiPoint)
3054 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3055 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
3056 OGR_FORBID_DOWNCAST_TO_MULTICURVE
3057 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3058 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3059 };
3060
3062
3063 inline const OGRMultiPoint::ChildType* const * begin(const OGRMultiPoint* poGeom) { return poGeom->begin(); }
3065 inline const OGRMultiPoint::ChildType* const * end(const OGRMultiPoint* poGeom) { return poGeom->end(); }
3066
3068 inline OGRMultiPoint::ChildType** begin(OGRMultiPoint* poGeom) { return poGeom->begin(); }
3070 inline OGRMultiPoint::ChildType** end(OGRMultiPoint* poGeom) { return poGeom->end(); }
3072
3073 /************************************************************************/
3074 /* OGRMultiCurve */
3075 /************************************************************************/
3076
3083 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
3084 {
3085 protected:
3087 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
3088 OGRCurve* poCurve );
3090 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
3091 const override;
3092
3093 public:
3094 OGRMultiCurve();
3095 OGRMultiCurve( const OGRMultiCurve& other );
3096 ~OGRMultiCurve() override;
3097
3098 OGRMultiCurve& operator=( const OGRMultiCurve& other );
3099
3101 typedef OGRCurve ChildType;
3102
3106 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
3108 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
3112 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
3114 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
3115
3116 // IGeometryCollection
3118 OGRCurve *getGeometryRef( int i) { return OGRGeometryCollection::getGeometryRef(i)->toCurve(); }
3120 const OGRCurve *getGeometryRef( int i ) const { return OGRGeometryCollection::getGeometryRef(i)->toCurve(); }
3121
3122 // Non standard (OGRGeometry).
3123 virtual const char *getGeometryName() const override;
3124 virtual OGRwkbGeometryType getGeometryType() const override;
3125 virtual OGRMultiCurve *clone() const override;
3126
3127 #ifndef DOXYGEN_XML
3128 using OGRGeometry::importFromWkt;
3129 #endif
3130
3131 OGRErr importFromWkt( const char ** ) override;
3132
3133 #ifndef DOXYGEN_XML
3134 using OGRGeometry::exportToWkt;
3135 #endif
3136
3141 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
3142 OGRErr *err = nullptr) const override;
3143
3144 // IGeometry methods.
3145 virtual int getDimension() const override;
3146
3147 // Non-standard.
3148 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
3149 const override;
3150
3152 inline OGRGeometryCollection* toUpperClass() { return this; }
3154 inline const OGRGeometryCollection* toUpperClass() const { return this; }
3155
3156 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
3157 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
3158
3159 static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
3160
3161 OGR_ALLOW_CAST_TO_THIS(MultiCurve)
3162 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3163 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3164 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3165 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3166 };
3167
3169
3170 inline const OGRMultiCurve::ChildType* const * begin(const OGRMultiCurve* poGeom) { return poGeom->begin(); }
3172 inline const OGRMultiCurve::ChildType* const * end(const OGRMultiCurve* poGeom) { return poGeom->end(); }
3173
3175 inline OGRMultiCurve::ChildType** begin(OGRMultiCurve* poGeom) { return poGeom->begin(); }
3177 inline OGRMultiCurve::ChildType** end(OGRMultiCurve* poGeom) { return poGeom->end(); }
3179
3180 /************************************************************************/
3181 /* OGRMultiLineString */
3182 /************************************************************************/
3183
3188 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
3189 {
3190 protected:
3191 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
3192 const override;
3193
3194 public:
3195 OGRMultiLineString();
3196 OGRMultiLineString( const OGRMultiLineString& other );
3197 ~OGRMultiLineString() override;
3198
3199 OGRMultiLineString& operator=( const OGRMultiLineString& other );
3200
3202 typedef OGRLineString ChildType;
3203
3207 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
3209 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
3213 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
3215 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
3216
3217 // IGeometryCollection
3219 OGRLineString *getGeometryRef( int i) { return OGRGeometryCollection::getGeometryRef(i)->toLineString(); }
3221 const OGRLineString *getGeometryRef( int i ) const { return OGRGeometryCollection::getGeometryRef(i)->toLineString(); }
3222
3223 // Non standard (OGRGeometry).
3224 virtual const char *getGeometryName() const override;
3225 virtual OGRwkbGeometryType getGeometryType() const override;
3226 virtual OGRMultiLineString *clone() const override;
3227
3228 #ifndef DOXYGEN_XML
3229 using OGRGeometry::exportToWkt;
3230 #endif
3231
3236 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
3237 OGRErr *err = nullptr) const override;
3238
3239 // Non standard
3240 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
3241 const override;
3242
3244 inline OGRGeometryCollection* toUpperClass() { return this; }
3246 inline const OGRGeometryCollection* toUpperClass() const { return this; }
3247
3248 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
3249 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
3250
3251 static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
3252
3253 OGR_ALLOW_CAST_TO_THIS(MultiLineString)
3254 OGR_ALLOW_UPCAST_TO(MultiCurve)
3255 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3256 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3257 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3258 };
3259
3261
3262 inline const OGRMultiLineString::ChildType* const * begin(const OGRMultiLineString* poGeom) { return poGeom->begin(); }
3264 inline const OGRMultiLineString::ChildType* const * end(const OGRMultiLineString* poGeom) { return poGeom->end(); }
3265
3267 inline OGRMultiLineString::ChildType** begin(OGRMultiLineString* poGeom) { return poGeom->begin(); }
3269 inline OGRMultiLineString::ChildType** end(OGRMultiLineString* poGeom) { return poGeom->end(); }
3271
3272 /************************************************************************/
3273 /* OGRGeometryFactory */
3274 /************************************************************************/
3275
3280 class CPL_DLL OGRGeometryFactory
3281 {
3282 static OGRErr createFromFgfInternal( const unsigned char *pabyData,
3283 OGRSpatialReference * poSR,
3284 OGRGeometry **ppoReturn,
3285 int nBytes,
3286 int *pnBytesConsumed,
3287 int nRecLevel );
3288 public:
3289 static OGRErr createFromWkb( const void *, OGRSpatialReference *,
3290 OGRGeometry **, size_t = static_cast<size_t>(-1),
3291 OGRwkbVariant=wkbVariantOldOgc );
3292 static OGRErr createFromWkb( const void * pabyData,
3293 OGRSpatialReference *,
3294 OGRGeometry **,
3295 size_t nSize,
3296 OGRwkbVariant eVariant,
3297 size_t& nBytesConsumedOut );
3298 static OGRErr createFromWkt( const char* , OGRSpatialReference *,
3299 OGRGeometry ** );
3300 static OGRErr createFromWkt( const char **, OGRSpatialReference *,
3301 OGRGeometry ** );
3305 static OGRErr createFromWkt( char ** ppszInput, OGRSpatialReference * poSRS,
3306 OGRGeometry ** ppoGeom )
3307 CPL_WARN_DEPRECATED("Use createFromWkt(const char**, ...) instead")
3308 {
3309 return createFromWkt( const_cast<const char**>(ppszInput), poSRS, ppoGeom);
3310 }
3311
3312 static OGRErr createFromFgf( const void*, OGRSpatialReference *,
3313 OGRGeometry **, int = -1, int * = nullptr );
3314 static OGRGeometry *createFromGML( const char * );
3315 static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
3316 GEOSGeom );
3317 static OGRGeometry *createFromGeoJson( const char *, int = -1 );
3318 static OGRGeometry *createFromGeoJson( const CPLJSONObject &oJSONObject );
3319
3320 static void destroyGeometry( OGRGeometry * );
3321 static OGRGeometry *createGeometry( OGRwkbGeometryType );
3322
3323 static OGRGeometry * forceToPolygon( OGRGeometry * );
3324 static OGRGeometry * forceToLineString( OGRGeometry *,
3325 bool bOnlyInOrder = true );
3326 static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
3327 static OGRGeometry * forceToMultiPoint( OGRGeometry * );
3328 static OGRGeometry * forceToMultiLineString( OGRGeometry * );
3329
3330 static OGRGeometry * forceTo( OGRGeometry* poGeom,
3331 OGRwkbGeometryType eTargetType,
3332 const char*const* papszOptions = nullptr );
3333
3334 static OGRGeometry * removeLowerDimensionSubGeoms( const OGRGeometry* poGeom );
3335
3336 static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
3337 int nPolygonCount,
3338 int *pbResultValidGeometry,
3339 const char **papszOptions = nullptr);
3340 static bool haveGEOS();
3341
3343 class CPL_DLL TransformWithOptionsCache
3344 {
3345 friend class OGRGeometryFactory;
3346 struct Private;
3347 std::unique_ptr<Private> d;
3348
3349 public:
3350 TransformWithOptionsCache();
3351 ~TransformWithOptionsCache();
3352 };
3353
3354 static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
3355 OGRCoordinateTransformation *poCT,
3356 char** papszOptions,
3357 const TransformWithOptionsCache& cache = TransformWithOptionsCache() );
3358
3359 static OGRGeometry*
3360 approximateArcAngles( double dfX, double dfY, double dfZ,
3361 double dfPrimaryRadius, double dfSecondaryAxis,
3362 double dfRotation,
3363 double dfStartAngle, double dfEndAngle,
3364 double dfMaxAngleStepSizeDegrees,
3365 const bool bUseMaxGap = false );
3366
3367 static int GetCurveParameters( double x0, double y0,
3368 double x1, double y1,
3369 double x2, double y2,
3370 double& R, double& cx, double& cy,
3371 double& alpha0, double& alpha1,
3372 double& alpha2 );
3373 static OGRLineString* curveToLineString(
3374 double x0, double y0, double z0,
3375 double x1, double y1, double z1,
3376 double x2, double y2, double z2,
3377 int bHasZ,
3378 double dfMaxAngleStepSizeDegrees,
3379 const char* const * papszOptions = nullptr );
3380 static OGRCurve* curveFromLineString(
3381 const OGRLineString* poLS,
3382 const char* const * papszOptions = nullptr);
3383 };
3384
3385 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
3386 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
3387
3389 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
3390
3391 struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
3392 {
3393 void operator()(OGRPreparedGeometry*) const;
3394 };
3396
3400 typedef std::unique_ptr<OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter> OGRPreparedGeometryUniquePtr;
3401
3402 #endif /* ndef OGR_GEOMETRY_H_INCLUDED */
IOGRGeometryVisitor::visit
virtual void visit(OGRPoint *)=0
Visit OGRPoint.
OGRSimpleCurve::getEnvelope
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition: ogrlinestring.cpp:2249
OGRCurvePolygon::getEnvelope
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition: ogrcurvepolygon.cpp:615
OGRGeometry::importFromWkt
OGRErr importFromWkt(char **ppszInput)
Deprecated.
Definition: ogr_geometry.h:430
OGRGeometry::Is3D
OGRBoolean Is3D() const
Definition: ogr_geometry.h:405
OGRGeometry::IsEmpty
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.
OGRGeometry::toMultiPolygon
OGRMultiPolygon * toMultiPolygon()
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:775
OGRMultiPolygon::ChildType
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2684
OGRMultiLineString::ChildType
OGRLineString ChildType
Type of child elements.
Definition: ogr_geometry.h:3202
OGRMultiPolygon::getGeometryRef
OGRPolygon * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2701
OGRGeometry::setCoordinateDimension
virtual void setCoordinateDimension(int nDimension)
Set the coordinate dimension.
Definition: ogrgeometry.cpp:1024
OGRCurvePolygon::addRingDirectly
virtual OGRErr addRingDirectly(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:416
OGRMultiLineString::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3244
OGRMultiLineString::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3207
OGRMultiCurve
A collection of OGRCurve.
Definition: ogr_geometry.h:3083
OGRCurve::CastToLineString
static OGRLineString * CastToLineString(OGRCurve *poCurve)
Cast to linestring.
Definition: ogrcurve.cpp:352
OGRRawPoint::OGRRawPoint
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:107
OGRGeometryCollection::isCompatibleSubType
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition: ogrgeometrycollection.cpp:1181
ogr_spatialref.h
OGRWktFormat::F
@ F
F-type formatting.
OGRSimpleCurve::getX
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:1384
OGRPolyhedralSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2795
OGRSurface::get_Area
virtual double get_Area() const =0
Get the area of the surface object.
OGRCurve::get_AreaOfCurveSegments
virtual double get_AreaOfCurveSegments() const =0
Get the area of the purely curve portions of a (closed) curve.
OGRGeometry::operator==
bool operator==(const OGRGeometry &other) const
Returns if two geometries are equal.
Definition: ogr_geometry.h:390
OGRLineString
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1467
OGRPolyhedralSurface::getNumGeometries
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:797
OGRPolyhedralSurface::getGeometryRef
OGRPolygon * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:819
OGRGeometry::Contains
virtual OGRBoolean Contains(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:5296
OGRMultiPolygon
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:2657
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:203
OGRPolyhedralSurface::CastToMultiPolygon
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:708
OGRPolyhedralSurface::addGeometryDirectly
OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
Definition: ogrpolyhedralsurface.cpp:765
OGRMultiPoint::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3042
OGRGeometryFactory::TransformWithOptionsCache
Opaque class used as argument to transformWithOptions()
Definition: ogr_geometry.h:3343
OGRSimpleCurve::clone
virtual OGRSimpleCurve * clone() const override=0
Make a copy of this object.
OGRPolyhedralSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2801
OGRPointIterator
Interface for a point iterator.
Definition: ogr_geometry.h:1052
OGRMultiSurface::ChildType
OGRSurface ChildType
Type of child elements.
Definition: ogr_geometry.h:2567
OGRMultiSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2572
OGRCurvePolygon::flattenTo2D
virtual void flattenTo2D() override
Convert geometry to strictly 2D. In a sense this converts all Z coordinates to 0.0.
Definition: ogrcurvepolygon.cpp:149
OGRGeometry::closeRings
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:5432
OGRMultiSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2626
OGRCompoundCurve
Utility class to store a collection of curves.
Definition: ogr_geometry.h:1829
OGRPolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2306
OGRGeometry::clone
virtual OGRGeometry * clone() const =0
Make a copy of this object.
OGRSimpleCurve::getNumPoints
virtual int getNumPoints() const override
Fetch vertex count.
Definition: ogr_geometry.h:1382
OGRGeometry::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
OGRGeometry::swapXY
virtual void swapXY()
Swap x and y coordinates.
Definition: ogrgeometry.cpp:6122
OGRSimpleCurve::importFromWkt
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrlinestring.cpp:1731
OGRPolyhedralSurface::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Returns the WKB Type of PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:120
OGRLineString::toUpperClass
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1509
OGRGeometryCollection::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrgeometrycollection.cpp:1192
OGRGeometry::toCurve
OGRCurve * toCurve()
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:593
OGRWktOptions::format
OGRWktFormat format
Formatting type.
Definition: ogr_geometry.h:79
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:325
OGRCurvePolygon::IsEmpty
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:713
OGRMultiSurface::getGeometryRef
OGRSurface * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2612
IOGRConstGeometryVisitor
OGRGeometry visitor interface.
Definition: ogr_geometry.h:231
OGRWktOptions::OGRWktOptions
OGRWktOptions()
Constructor.
Definition: ogr_geometry.h:82
OGRSimpleCurve::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrlinestring.cpp:1632
OGRPoint::setM
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:1018
OGRTriangulatedSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2922
OGRSimpleCurve::WkbSize
virtual size_t WkbSize() const override
Returns size of related binary representation.
Definition: ogrlinestring.cpp:188
OGRLinearRing::toUpperClass
const OGRLineString * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1603
OGRCurvePolygon::CurvePolyToPoly
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const
Return a polygon from a curve polygon.
Definition: ogrcurvepolygon.cpp:565
OGRCompoundCurve::begin
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1873
OGRGeometry::set3D
virtual void set3D(OGRBoolean bIs3D)
Add or remove the Z coordinate dimension.
Definition: ogrgeometry.cpp:1047
OGRGeometry::toCompoundCurve
const OGRCompoundCurve * toCompoundCurve() const
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:670
OGRGeometryFactory
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:3280
OGRMultiPolygon::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2695
OGRGeometry::toMultiSurface
OGRMultiSurface * toMultiSurface()
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:803
OGRMultiPolygon::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2728
OGRPolyhedralSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2864
OGRMultiCurve::isCompatibleSubType
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition: ogrmulticurve.cpp:144
OGRTriangle::toUpperClass
const OGRPolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2377
OGRMultiPoint::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3002
OGRGeometry::FromHandle
static OGRGeometry * FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
Definition: ogr_geometry.h:572
OGRMultiSurface::getGeometryRef
const OGRSurface * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2614
OGRMultiCurve::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3112
OGRPolygon::ChildType
OGRLinearRing ChildType
Type of child elements.
Definition: ogr_geometry.h:2232
OGRCurvePolygon::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrcurvepolygon.cpp:590
OGRGeometryCollection
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:2401
OGRGeometry::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const
Returns if this geometry is or has curve geometry.
Definition: ogrgeometry.cpp:3201
wkbVariantOldOgc
@ wkbVariantOldOgc
Old-style 99-402 extended dimension (Z) WKB types.
Definition: ogr_core.h:486
OGRMultiPoint::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3008
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:157
OGRPolyhedralSurface::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrpolyhedralsurface.cpp:106
OGRGeometryCollection::getGeometryRef
OGRGeometry * getGeometryRef(int)
Fetch geometry from container.
Definition: ogrgeometrycollection.cpp:261
OGRGeometry::toCircularString
OGRCircularString * toCircularString()
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:649
OGRPolyhedralSurface
PolyhedralSurface class.
Definition: ogr_geometry.h:2761
OGRCurve::isClockwise
virtual int isClockwise() const
Returns TRUE if the ring has clockwise winding (or less than 2 points)
Definition: ogrcurve.cpp:673
OGRGeometry::toCircularString
const OGRCircularString * toCircularString() const
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:656
OGRMultiPolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2730
OGRCompoundCurve::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1961
OGRCurve::Value
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
OGRGeometryCollection::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrgeometrycollection.cpp:217
OGRGeometry::toTriangulatedSurface
OGRTriangulatedSurface * toTriangulatedSurface()
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:831
OGRGeometry::toTriangle
const OGRTriangle * toTriangle() const
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:712
OGRGeometry::toPolygon
const OGRPolygon * toPolygon() const
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:698
OGRGeometry::getLinearGeometry
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrgeometry.cpp:3234
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:326
OGRMultiPoint
A collection of OGRPoint.
Definition: ogr_geometry.h:2978
OGRGeometry::IsValid
virtual OGRBoolean IsValid() const
Test if the geometry is valid.
Definition: ogrgeometry.cpp:2145
OGRMultiLineString::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3215
OGRGeometry::getGeometryName
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
OGRPolygon::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrpolygon.cpp:131
OGRPolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2307
OGRIteratedPoint
Definition: ogr_geometry.h:1202
OGRCurve::toSimpleCurve
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1156
OGRCurvePolygon::clone
virtual OGRCurvePolygon * clone() const override
Make a copy of this object.
Definition: ogrcurvepolygon.cpp:102
OGRPolyhedralSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2793
OGRMultiSurface
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:2553
OGRGeometry::importFromWkb
OGRErr importFromWkb(const GByte *, size_t=static_cast< size_t >(-1), OGRwkbVariant=wkbVariantOldOgc)
Assign geometry from well known binary data.
Definition: ogrgeometry.cpp:1427
OGRPoint
Point class.
Definition: ogr_geometry.h:936
OGRWktOptions::round
bool round
Whether GDAL-special rounding should be applied.
Definition: ogr_geometry.h:77
OGRPolygon::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolygon.cpp:401
OGRMultiCurve::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3156
OGRTriangulatedSurface::addGeometry
virtual OGRErr addGeometry(const OGRGeometry *) override
Add a new geometry to a collection.
Definition: ogrtriangulatedsurface.cpp:189
OGRSimpleCurve::getY
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:1385
OGRGeometry::exportToWkt
OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const
Convert a geometry into well known text format.
Definition: ogrgeometry.cpp:1829
OGRMultiCurve::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3154
OGRCurvePolygon::empty
virtual void empty() override
Clear geometry information. This restores the geometry to its initial state after construction,...
Definition: ogrcurvepolygon.cpp:112
OGRCurvePolygon::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a curve polygon to WKT.
Definition: ogrcurvepolygon.cpp:537
OGRMultiPolygon::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2697
OGRGeometry::operator=
OGRGeometry & operator=(const OGRGeometry &other)
Assignment operator.
Definition: ogrgeometry.cpp:151
OGRMultiPolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2731
OGRGeometry::importFromWkt
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
OGRMultiCurve::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a multicurve to WKT.
Definition: ogrmulticurve.cpp:184
OGRWktOptions::variant
OGRwkbVariant variant
Type of WKT output to produce.
Definition: ogr_geometry.h:73
OGRPolygon::operator=
OGRPolygon & operator=(const OGRPolygon &other)
Assignment operator.
Definition: ogrpolygon.cpp:91
OGRWktFormat::Default
@ Default
Format as F when abs(value) < 1, otherwise as G.
OGRBoolean
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:357
OGRRawPoint::x
double x
x
Definition: ogr_geometry.h:113
OGRMultiCurve::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3108
OGRPoint::setX
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:1005
OGRLineString::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrlinestring.cpp:2763
OGRWktOptions::precision
int precision
Precision of output. Interpretation depends on format.
Definition: ogr_geometry.h:75
OGRGeometry::toLinearRing
const OGRLinearRing * toLinearRing() const
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:642
OGRGeometryCollection::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2519
OGRSurface::PointOnSurface
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:2001
OGRPolygon::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a polygon to WKT.
Definition: ogrpolygon.cpp:650
OGRLinearRing::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1605
OGRGeometry::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const =0
Convert a geometry into well known binary format.
OGRMultiPolygon::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2689
OGRMultiSurface::clone
virtual OGRMultiSurface * clone() const override
Make a copy of this object.
Definition: ogrmultisurface.cpp:98
OGRRawPoint
Simple container for a position.
Definition: ogr_geometry.h:103
OGRMultiLineString
A collection of OGRLineString.
Definition: ogr_geometry.h:3188
OGRCurvePolygon::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2071
OGRGeometry::flattenTo2D
virtual void flattenTo2D()=0
Convert geometry to strictly 2D. In a sense this converts all Z coordinates to 0.0.
OGRCurve::StartPoint
virtual void StartPoint(OGRPoint *) const =0
Return the curve start point.
OGRMultiSurface::isCompatibleSubType
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition: ogrmultisurface.cpp:146
OGRGeometry::toMultiCurve
OGRMultiCurve * toMultiCurve()
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:789
OGRMultiPoint::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:2995
OGRPolyhedralSurface::addGeometry
virtual OGRErr addGeometry(const OGRGeometry *)
Add a new geometry to a collection.
Definition: ogrpolyhedralsurface.cpp:729
OGRMultiLineString::getGeometryRef
OGRLineString * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3219
OGRSurface
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:1991
OGRSimpleCurve::operator=
OGRSimpleCurve & operator=(const OGRSimpleCurve &other)
Assignment operator.
Definition: ogrlinestring.cpp:115
OGRMultiSurface::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrmultisurface.cpp:286
OGRCurve::getNumPoints
virtual int getNumPoints() const =0
Return the number of points of a curve geometry.
OGRPolygon::WkbSize
virtual size_t WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolygon.cpp:327
OGRwkbByteOrder
OGRwkbByteOrder
Enumeration to describe byte order.
Definition: ogr_core.h:550
OGRTriangulatedSurface::toUpperClass
OGRPolyhedralSurface * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2944
OGRCircularString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1709
OGRTriangle::operator=
OGRTriangle & operator=(const OGRTriangle &other)
Assignment operator.
Definition: ogrtriangle.cpp:137
OGRTriangulatedSurface::ChildType
OGRTriangle ChildType
Type of child elements.
Definition: ogr_geometry.h:2915
OGRCircularString
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:1628
OGRCurvePolygon::OGRCurvePolygon
OGRCurvePolygon()
Create an empty curve polygon.
OGRSurface::clone
virtual OGRSurface * clone() const override=0
Make a copy of this object.
OGRMultiCurve::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrmulticurve.cpp:107
OGRGeometry::Intersects
virtual OGRBoolean Intersects(const OGRGeometry *) const
Do these features intersect?
Definition: ogrgeometry.cpp:504
OGRPolygon::CurvePolyToPoly
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:765
OGRGeometry::toLineString
const OGRLineString * toLineString() const
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:628
OGRGeometry::toTriangle
OGRTriangle * toTriangle()
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:705
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1056
CPLJSONObject
The CPLJSONArray class holds JSON object from CPLJSONDocument.
Definition: cpl_json.h:53
OGRGeometryCollection::operator=
OGRGeometryCollection & operator=(const OGRGeometryCollection &other)
Assignment operator.
Definition: ogrgeometrycollection.cpp:110
OGRSimpleCurve::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a simple curve to WKT.
Definition: ogrlinestring.cpp:1850
OGRTriangulatedSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2948
OGRGeometry::toPoint
OGRPoint * toPoint()
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:579
OGRMultiSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2578
OGRLineString::clone
virtual OGRLineString * clone() const override
Make a copy of this object.
Definition: ogrlinestring.cpp:2888
OGRCurvePolygon::set3D
virtual void set3D(OGRBoolean bIs3D) override
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:690
OGRGeometryCollection::begin
const ChildType *const * begin() const
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2441
OGRGeometry::toSurface
OGRSurface * toSurface()
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:677
OGRMultiPoint::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3006
OGRMultiCurve::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3106
OGRMultiSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2625
OGRCompoundCurve::begin
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:1879
OGRGeometryCollection::ChildType
OGRGeometry ChildType
Type of child elements.
Definition: ogr_geometry.h:2430
OGRMultiCurve::getGeometryRef
OGRCurve * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3118
OGRMultiSurface::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2623
OGRMultiCurve::clone
virtual OGRMultiCurve * clone() const override
Make a copy of this object.
Definition: ogrmulticurve.cpp:97
OGRGeometry::toPolyhedralSurface
OGRPolyhedralSurface * toPolyhedralSurface()
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:817
OGRCurvePolygon::importFromWkb
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrcurvepolygon.cpp:463
sfcgal_geometry_t
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:123
OGRCurvePolygon::transform
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:654
OGRCurve::CurveToLine
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const =0
Return a linestring from a curve geometry.
OGRPolyhedralSurface::~OGRPolyhedralSurface
~OGRPolyhedralSurface() override
Destructor.
OGRTriangle::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2380
OGRMultiLineString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3248
OGRTriangulatedSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2928
OGRGeometryFactory::createFromWkt
static OGRErr createFromWkt(char **ppszInput, OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
Definition: ogr_geometry.h:3305
OGRGeometryCollection::importFromWkt
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrgeometrycollection.cpp:777
OGRLineString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1514
OGRCurve::ContainsPoint
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:395
OGRCurvePolygon::setCoordinateDimension
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrcurvepolygon.cpp:684
OGRCurvePolygon::end
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:2078
OGRMultiSurface::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2621
OGRSimpleCurve::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1314
OGRPoint::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1032
OGRGeometry::toPoint
const OGRPoint * toPoint() const
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:586
OGRRawPoint::OGRRawPoint
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:110
OGRPolyhedralSurface::removeGeometry
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:956
OGRGeometry::assignSpatialReference
virtual void assignSpatialReference(OGRSpatialReference *poSR)
Assign spatial reference to this object.
Definition: ogrgeometry.cpp:433
OGRCurvePolygon::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrcurvepolygon.cpp:122
OGRMultiCurve::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3152
OGRCurve::toSimpleCurve
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1151
cpl_conv.h
OGRPolygon::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2245
OGRCurvePolygon::CastToPolygon
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:826
OGRTriangulatedSurface::toUpperClass
const OGRPolyhedralSurface * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2946
OGRPolygon::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrpolygon.cpp:114
OGRGeometryCollection::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2520
OGRGeometry::toLineString
OGRLineString * toLineString()
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:621
OGRCurve::EndPoint
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
OGRGeometry::toSimpleCurve
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:607
cpl_json.h
OGRCurvePolygon::end
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:2084
OGRGeometry::empty
virtual void empty()=0
Clear geometry information. This restores the geometry to its initial state after construction,...
OGRTriangle::toUpperClass
OGRPolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2375
OGRGeometry::toCurvePolygon
const OGRCurvePolygon * toCurvePolygon() const
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:726
OGRGeometry::toTriangulatedSurface
const OGRTriangulatedSurface * toTriangulatedSurface() const
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:838
OGRMultiCurve::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:3101
OGRGeometry::toSimpleCurve
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:614
OGRSimpleCurve
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:1247
OGRFromOGCGeomType
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGCgeometry format type to corresponding OGR constants.
Definition: ogrgeometry.cpp:2400
OGRGeometryH
void * OGRGeometryH
Opaque type for a geometry.
Definition: ogr_api.h:66
OGRMultiCurve::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrmulticurve.cpp:134
OGRMultiLineString::getGeometryRef
const OGRLineString * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3221
OGRMultiPolygon::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2691
OGRTriangulatedSurface::getGeometryRef
OGRTriangle * getGeometryRef(int i)
See OGRPolyhedralSurface::getGeometryRef()
Definition: ogr_geometry.h:2936
OGRMultiSurface::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrmultisurface.cpp:108
OGRMultiCurve::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3114
OGRMultiPolygon::getGeometryRef
const OGRPolygon * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2703
OGRTriangle::addRingDirectly
virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override
Add a ring to a polygon.
Definition: ogrtriangle.cpp:255
OGRCurvePolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2166
GEOSGeom
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:119
OGRPoint::IsEmpty
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:987
OGRSimpleCurve::importFromWkb
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrlinestring.cpp:1515
OGRCoordinateTransformation
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:760
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:330
OGRMultiPoint::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3047
OGRCurve::getPointIterator
virtual OGRPointIterator * getPointIterator() const =0
Returns a point iterator over the curve.
OGRCurvePolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2165
IOGRGeometryVisitor
OGRGeometry visitor interface.
Definition: ogr_geometry.h:157
OGRTriangulatedSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2949
OGRCompoundCurve::end
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:1875
OGRCircularString::toUpperClass
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1706
OGRPoint::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1031
OGRMultiLineString::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3213
OGRCircularString::toUpperClass
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1704
OGRGeometry::getDimension
virtual int getDimension() const =0
Get the dimension of this object.
OGRCurve::clone
virtual OGRCurve * clone() const override=0
Make a copy of this object.
OGRGeometry::toLinearRing
OGRLinearRing * toLinearRing()
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:635
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:341
OGRSimpleCurve::segmentize
virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrlinestring.cpp:2473
OGRPolygon::importFromWkb
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrpolygon.cpp:347
OGRGeometry::toCurvePolygon
OGRCurvePolygon * toCurvePolygon()
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:719
OGRGeometry::segmentize
virtual void segmentize(double dfMaxLength)
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrgeometry.cpp:806
OGRMultiLineString::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3246
OGRCompoundCurve::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1962
OGRMultiPoint::getGeometryRef
OGRPoint * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3012
OGRMultiSurface::operator=
OGRMultiSurface & operator=(const OGRMultiSurface &other)
Assignment operator.
Definition: ogrmultisurface.cpp:85
OGRGeometry::toPolygon
OGRPolygon * toPolygon()
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:691
OGRWktFormat
OGRWktFormat
WKT Output formatting options.
Definition: ogr_geometry.h:61
OGRMultiSurface::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a geometry collection to WKT.
Definition: ogrmultisurface.cpp:275
OGRGeometry::toGeometryCollection
OGRGeometryCollection * toGeometryCollection()
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:733
OGRCurvePolygon::getExteriorRingCurve
OGRCurve * getExteriorRingCurve()
Fetch reference to external polygon ring.
Definition: ogrcurvepolygon.cpp:185
OGRGeometry::toMultiCurve
const OGRMultiCurve * toMultiCurve() const
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:796
OGRCurvePolygon::getNumInteriorRings
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:222
OGRMultiPoint::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3046
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:368
OGRMultiSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2574
OGRCurvePolygon::Equals
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:635
OGRMultiCurve::operator=
OGRMultiCurve & operator=(const OGRMultiCurve &other)
Assignment operator.
Definition: ogrmulticurve.cpp:84
OGRTriangulatedSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2920
CPL_WARN_UNUSED_RESULT
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:869
OGRTriangle
Triangle class.
Definition: ogr_geometry.h:2337
OGRMultiLineString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3249
OGRPolyhedralSurface::clone
virtual OGRPolyhedralSurface * clone() const override
Make a copy of this object.
Definition: ogrpolyhedralsurface.cpp:96
OGRMultiSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2580
OGRPolygon::clone
virtual OGRPolygon * clone() const override
Make a copy of this object.
Definition: ogrpolygon.cpp:104
OGRGeometry::toMultiPoint
const OGRMultiPoint * toMultiPoint() const
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:754
OGRCurvePolygon::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrcurvepolygon.cpp:159
OGRPoint::setY
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:1009
OGRPolygon::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2237
OGRDefaultConstGeometryVisitor
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:278
OGRCurvePolygon::removeRing
OGRErr removeRing(int iIndex, bool bDelete=true)
Remove a geometry from the container.
Definition: ogrcurvepolygon.cpp:323
OGRCompoundCurve::get_AreaOfCurveSegments
virtual double get_AreaOfCurveSegments() const override
Return area of curve segments.
Definition: ogrcompoundcurve.cpp:893
OGRGeometryCollection::end
ChildType ** end()
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2437
OGRPolygon::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2243
OGRCurvePolygon::WkbSize
virtual size_t WkbSize() const override
Returns size of related binary representation.
Definition: ogrcurvepolygon.cpp:439
OGRGeometry::toMultiSurface
const OGRMultiSurface * toMultiSurface() const
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:810
OGRGeometryCollection::begin
ChildType ** begin()
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2435
OGRPoint::getZ
double getZ() const
Return z.
Definition: ogr_geometry.h:996
OGRPoint::setZ
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:1013
OGRGeometry::toSurface
const OGRSurface * toSurface() const
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:684
OGRCurvePolygon::addRing
virtual OGRErr addRing(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:346
OGRPolygon::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:776
OGREnvelope3D
Simple container for a bounding region in 3D.
Definition: ogr_core.h:198
OGRGeometry::WkbSize
virtual size_t WkbSize() const =0
Returns size of related binary representation.
OGRCompoundCurve::end
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:1881
OGRGeometry::IsMeasured
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:407
OGRCurvePolygon::operator=
OGRCurvePolygon & operator=(const OGRCurvePolygon &other)
Assignment operator.
Definition: ogrcurvepolygon.cpp:87
OGRPreparedGeometryUniquePtr
std::unique_ptr< OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter > OGRPreparedGeometryUniquePtr
Unique pointer type for OGRPreparedGeometry.
Definition: ogr_geometry.h:3400
OGRMultiCurve::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrmulticurve.cpp:195
OGRTriangulatedSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2926
OGRGeometry::getCurveGeometry
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=nullptr) const
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3269
OGRCurve
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:1070
OGRSimpleCurve::transform
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrlinestring.cpp:2352
OGRCurvePolygon::assignSpatialReference
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrcurvepolygon.cpp:704
OGRSimpleCurve::get_Length
virtual double get_Length() const override
Returns the length of the curve.
Definition: ogrlinestring.cpp:1906
OGRPoint::getY
double getY() const
Return y.
Definition: ogr_geometry.h:994
OGRDefaultGeometryVisitor::visit
void visit(OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:210
OGRMultiPoint::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3044
OGRCurvePolygon::segmentize
virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:722
GEOSContextHandle_t
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
Definition: ogr_geometry.h:121
OGRPolygon::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2239
OGRGeometryCollection::getDimension
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrgeometrycollection.cpp:178
OGRGeometry::transform
virtual OGRErr transform(OGRCoordinateTransformation *poCT)=0
Apply arbitrary coordinate transformation to geometry.
OGRPolyhedralSurface::operator=
OGRPolyhedralSurface & operator=(const OGRPolyhedralSurface &other)
Assignment operator.
Definition: ogrpolyhedralsurface.cpp:81
OGRWktFormat::G
@ G
G-type formatting.
OGRPolyhedralSurface::OGRPolyhedralSurface
OGRPolyhedralSurface()
Create an empty PolyhedralSurface.
OGRMultiPolygon::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2726
OGRLinearRing
Concrete representation of a closed ring.
Definition: ogr_geometry.h:1544
OGRGeometryUniquePtr
std::unique_ptr< OGRGeometry, OGRGeometryUniquePtrDeleter > OGRGeometryUniquePtr
Unique pointer type for OGRGeometry.
Definition: ogr_geometry.h:853
OGREnvelope
Simple container for a bounding region (rectangle)
Definition: ogr_core.h:57
OGRTriangle::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2379
OGRGeometry::toGeometryCollection
const OGRGeometryCollection * toGeometryCollection() const
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:740
OGRSimpleCurve::Value
virtual void Value(double, OGRPoint *) const override
Fetch point at given distance along curve.
Definition: ogrlinestring.cpp:1948
OGRCurvePolygon::begin
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:2076
OGRGeometry::toMultiPolygon
const OGRMultiPolygon * toMultiPolygon() const
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:782
OGRMultiCurve::getGeometryRef
const OGRCurve * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3120
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRPoint *)=0
Visit OGRPoint.
OGRCurve::CastToLinearRing
static OGRLinearRing * CastToLinearRing(OGRCurve *poCurve)
Cast to linear ring.
Definition: ogrcurve.cpp:374
OGRMultiCurve::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3157
OGRPolyhedralSurface::ChildType
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2788
OGRMultiPoint::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3000
OGRGeometry::toMultiPoint
OGRMultiPoint * toMultiPoint()
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:747
OGRToOGCGeomType
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition: ogrgeometry.cpp:2473
OGRRawPoint::y
double y
y
Definition: ogr_geometry.h:115
OGRGeometry::toCurve
const OGRCurve * toCurve() const
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:600
OGRWktOptions
Options for formatting WKT output.
Definition: ogr_geometry.h:69
OGRCurvePolygon::importFromWkt
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrcurvepolygon.cpp:522
OGRGeometry::toMultiLineString
const OGRMultiLineString * toMultiLineString() const
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:768
OGRTriangulatedSurface::getGeometryRef
const OGRTriangle * getGeometryRef(int i) const
See OGRPolyhedralSurface::getGeometryRef()
Definition: ogr_geometry.h:2938
OGRLineString::toUpperClass
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1511
OGRCurvePolygon::setMeasured
virtual void setMeasured(OGRBoolean bIsMeasured) override
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:695
OGRCurve::IntersectsPoint
virtual int IntersectsPoint(const OGRPoint *p) const
Returns if a point intersects a (closed) curve.
Definition: ogrcurve.cpp:415
OGRPolygon::toUpperClass
const OGRCurvePolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2304
OGRLineString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1513
OGRPolygon
Concrete class representing polygons.
Definition: ogr_geometry.h:2199
OGRTriangulatedSurface
TriangulatedSurface class.
Definition: ogr_geometry.h:2894
OGRCurvePolygon
Concrete class representing curve polygons.
Definition: ogr_geometry.h:2033
OGRPoint::getM
double getM() const
Return m.
Definition: ogr_geometry.h:998
OGRGeometry::getEnvelope
virtual void getEnvelope(OGREnvelope *psEnvelope) const =0
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
OGRPolyhedralSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2863
OGRCurvePolygon::getInteriorRingCurve
OGRCurve * getInteriorRingCurve(int)
Fetch reference to indicated internal ring.
Definition: ogrcurvepolygon.cpp:250
OGRGeometry::Equals
virtual OGRBoolean Equals(const OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
OGRCurvePolygon::begin
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:2082
OGRCurve::get_Length
virtual double get_Length() const =0
Returns the length of the curve.
ogr_core.h
OGRMultiPoint::getGeometryRef
const OGRPoint * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3014
OGRMultiSurface::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrmultisurface.cpp:135
OGRGeometry::toPolyhedralSurface
const OGRPolyhedralSurface * toPolyhedralSurface() const
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:824
OGRGeometry::toMultiLineString
OGRMultiLineString * toMultiLineString()
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:761
OGRLineString::operator=
OGRLineString & operator=(const OGRLineString &other)
Assignment operator.
Definition: ogrlinestring.cpp:2733
OGRCurvePolygon::getLinearGeometry
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrcurvepolygon.cpp:605
OGRGeometry::Within
virtual OGRBoolean Within(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:5222
OGRGeometryCollection::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrgeometrycollection.cpp:161
OGRCircularString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1708
OGRGeometry::setMeasured
virtual void setMeasured(OGRBoolean bIsMeasured)
Add or remove the M coordinate dimension.
Definition: ogrgeometry.cpp:1070
OGRPolygon::toUpperClass
OGRCurvePolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2302
OGRCurvePolygon::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrcurvepolygon.cpp:494
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:930
OGRGeometry::operator!=
bool operator!=(const OGRGeometry &other) const
Returns if two geometries are different.
Definition: ogr_geometry.h:393
OGRPolyhedralSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2799
OGRDefaultConstGeometryVisitor::visit
void visit(const OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:284
OGRwkbVariant
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:484
OGRGeometryCollection::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a geometry collection to WKT.
Definition: ogrgeometrycollection.cpp:790
OGRCurvePolygon::stealExteriorRingCurve
OGRCurve * stealExteriorRingCurve()
"Steal" reference to external ring.
Definition: ogrcurvepolygon.cpp:291
OGRCurve::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1114
OGRCompoundCurve::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:1868
OGRLinearRing::toUpperClass
OGRLineString * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1601
OGRGeometryCollection::end
const ChildType *const * end() const
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2443
OGRGeometryCollection::clone
virtual OGRGeometryCollection * clone() const override
Make a copy of this object.
Definition: ogrgeometrycollection.cpp:151
OGRGeometry::toCompoundCurve
OGRCompoundCurve * toCompoundCurve()
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:663
OGRCurvePolygon::swapXY
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:736
OGRPoint::getX
double getX() const
Return x.
Definition: ogr_geometry.h:992
OGRCurve::get_Area
virtual double get_Area() const =0
Get the area of the (closed) curve.
OGRGeometry::ToHandle
static OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
Definition: ogr_geometry.h:566
OGRMultiLineString::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3209
OGRDefaultGeometryVisitor
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:204
OGRLinearRing::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1606