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
53typedef struct OGRGeometryHS *OGRGeometryH;
54#else
55typedef void *OGRGeometryH;
56#endif
57#endif /* DEFINEH_OGRGeometryH */
61enum class OGRWktFormat
62{
63 F,
64 G,
65 Default
66};
67
69struct CPL_DLL OGRWktOptions
70{
71public:
77 bool round;
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
95private:
96 static int getDefaultPrecision();
97 static bool getDefaultRound();
98};
99
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
119typedef struct GEOSGeom_t *GEOSGeom;
121typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
123typedef void sfcgal_geometry_t;
124
125class OGRPoint;
126class OGRCurve;
127class OGRCompoundCurve;
128class OGRSimpleCurve;
129class OGRLinearRing;
130class OGRLineString;
132class OGRSurface;
133class OGRCurvePolygon;
134class OGRPolygon;
135class OGRMultiPoint;
136class OGRMultiSurface;
137class OGRMultiPolygon;
138class OGRMultiCurve;
141class OGRTriangle;
144
146typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
147typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
148
149typedef OGRPolygon* (*OGRSurfaceCasterToPolygon)(OGRSurface*);
150typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
151typedef OGRMultiPolygon* (*OGRPolyhedralSurfaceCastToMultiPolygon)(OGRPolyhedralSurface*);
153
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
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
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
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
326class 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;
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),
418 virtual OGRErr importFromWkb( const unsigned char *,
419 size_t,
421 size_t& nBytesConsumedOut ) = 0;
422 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
424 virtual OGRErr importFromWkt( const char ** ppszInput ) = 0;
425
426#ifndef DOXYGEN_XML
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,
441
446 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
447 OGRErr *err = nullptr) const = 0;
448
449 // Non-standard.
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 )
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
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 )
515 virtual OGRGeometry *Intersection( const OGRGeometry *)
517 virtual OGRGeometry *Union( const OGRGeometry * )
519 virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
520 virtual OGRGeometry *Difference( const OGRGeometry * )
522 virtual OGRGeometry *SymDifference( const OGRGeometry * )
524 virtual OGRErr Centroid( OGRPoint * poPoint ) const;
525 virtual OGRGeometry *Simplify(double dTolerance)
527 OGRGeometry *SimplifyPreserveTopology(double dTolerance)
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
580 { return cpl::down_cast<OGRPoint*>(this); }
581
586 inline const OGRPoint* toPoint() const
587 { return cpl::down_cast<const OGRPoint*>(this); }
588
594 { return cpl::down_cast<OGRCurve*>(this); }
595
600 inline const OGRCurve* toCurve() const
601 { return cpl::down_cast<const OGRCurve*>(this); }
602
608 { return cpl::down_cast<OGRSimpleCurve*>(this); }
609
614 inline const OGRSimpleCurve* toSimpleCurve() const
615 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
616
622 { return cpl::down_cast<OGRLineString*>(this); }
623
628 inline const OGRLineString* toLineString() const
629 { return cpl::down_cast<const OGRLineString*>(this); }
630
636 { return cpl::down_cast<OGRLinearRing*>(this); }
637
642 inline const OGRLinearRing* toLinearRing() const
643 { return cpl::down_cast<const OGRLinearRing*>(this); }
644
650 { return cpl::down_cast<OGRCircularString*>(this); }
651
657 { return cpl::down_cast<const OGRCircularString*>(this); }
658
664 { return cpl::down_cast<OGRCompoundCurve*>(this); }
665
670 inline const OGRCompoundCurve* toCompoundCurve() const
671 { return cpl::down_cast<const OGRCompoundCurve*>(this); }
672
678 { return cpl::down_cast<OGRSurface*>(this); }
679
684 inline const OGRSurface* toSurface() const
685 { return cpl::down_cast<const OGRSurface*>(this); }
686
692 { return cpl::down_cast<OGRPolygon*>(this); }
693
698 inline const OGRPolygon* toPolygon() const
699 { return cpl::down_cast<const OGRPolygon*>(this); }
700
706 { return cpl::down_cast<OGRTriangle*>(this); }
707
712 inline const OGRTriangle* toTriangle() const
713 { return cpl::down_cast<const OGRTriangle*>(this); }
714
720 { return cpl::down_cast<OGRCurvePolygon*>(this); }
721
726 inline const OGRCurvePolygon* toCurvePolygon() const
727 { return cpl::down_cast<const OGRCurvePolygon*>(this); }
728
734 { return cpl::down_cast<OGRGeometryCollection*>(this); }
735
741 { return cpl::down_cast<const OGRGeometryCollection*>(this); }
742
748 { return cpl::down_cast<OGRMultiPoint*>(this); }
749
754 inline const OGRMultiPoint* toMultiPoint() const
755 { return cpl::down_cast<const OGRMultiPoint*>(this); }
756
762 { return cpl::down_cast<OGRMultiLineString*>(this); }
763
769 { return cpl::down_cast<const OGRMultiLineString*>(this); }
770
776 { return cpl::down_cast<OGRMultiPolygon*>(this); }
777
782 inline const OGRMultiPolygon* toMultiPolygon() const
783 { return cpl::down_cast<const OGRMultiPolygon*>(this); }
784
790 { return cpl::down_cast<OGRMultiCurve*>(this); }
791
796 inline const OGRMultiCurve* toMultiCurve() const
797 { return cpl::down_cast<const OGRMultiCurve*>(this); }
798
804 { return cpl::down_cast<OGRMultiSurface*>(this); }
805
810 inline const OGRMultiSurface* toMultiSurface() const
811 { return cpl::down_cast<const OGRMultiSurface*>(this); }
812
818 { return cpl::down_cast<OGRPolyhedralSurface*>(this); }
819
825 { return cpl::down_cast<const OGRPolyhedralSurface*>(this); }
826
832 { return cpl::down_cast<OGRTriangulatedSurface*>(this); }
833
839 { return cpl::down_cast<const OGRTriangulatedSurface*>(this); }
840
841};
842
844struct CPL_DLL OGRGeometryUniquePtrDeleter
845{
846 void operator()(OGRGeometry*) const;
847};
849
853typedef 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
936class 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,
959 size_t& nBytesConsumedOut ) override;
960 OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
962 const override;
963
964#ifndef DOXYGEN_XML
966#endif
967
968 OGRErr importFromWkt( const char ** ) override;
969
970#ifndef DOXYGEN_XML
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
1052class CPL_DLL OGRPointIterator
1053{
1054 public:
1055 virtual ~OGRPointIterator();
1057
1058 static void destroy( OGRPointIterator* );
1059};
1060
1061/************************************************************************/
1062/* OGRCurve */
1063/************************************************************************/
1064
1070class 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
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;
1145 virtual OGRBoolean IsConvex() const;
1146 virtual double get_Area() const = 0;
1147 virtual int isClockwise() const;
1148
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
1171inline OGRCurve::ConstIterator begin(const OGRCurve* poCurve) { return poCurve->begin(); }
1173inline OGRCurve::ConstIterator end(const OGRCurve* poCurve) { return poCurve->end(); }
1175
1176
1177/************************************************************************/
1178/* OGRIteratedPoint */
1179/************************************************************************/
1180
1202class CPL_DLL OGRIteratedPoint: public OGRPoint
1203{
1204private:
1205 friend class OGRSimpleCurve;
1206
1207 OGRSimpleCurve* m_poCurve = nullptr;
1208 int m_nPos = 0;
1209
1210 OGRIteratedPoint() = default;
1211
1213
1214public:
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
1247class 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
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
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,
1344 size_t& nBytesConsumedOut ) override;
1345 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1347 const override;
1348
1349#ifndef DOXYGEN_XML
1351#endif
1352
1353 OGRErr importFromWkt( const char ** ) override;
1354
1355#ifndef DOXYGEN_XML
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
1446inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1448inline OGRSimpleCurve::Iterator end(OGRSimpleCurve* poCurve) { return poCurve->end(); }
1449
1451inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1453inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve* poCurve) { return poCurve->end(); }
1455
1456/************************************************************************/
1457/* OGRLineString */
1458/************************************************************************/
1459
1467class 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:
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
1544class 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,
1555 size_t& nBytesConsumedOut ) override;
1556 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
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:
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
1628class 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:
1649 ~OGRCircularString() override;
1650
1651 OGRCircularString& operator=(const OGRCircularString& other);
1652
1653 // IWks Interface.
1654 virtual OGRErr importFromWkb( const unsigned char *,
1655 size_t,
1657 size_t& nBytesConsumedOut ) override;
1658 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1660 const override;
1661
1662#ifndef DOXYGEN_XML
1664#endif
1665
1666 OGRErr importFromWkt( const char ** ) override;
1667
1668#ifndef DOXYGEN_XML
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
1730class 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;
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 );
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,
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
1829class 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:
1863 ~OGRCompoundCurve() override;
1864
1865 OGRCompoundCurve& operator=( const OGRCompoundCurve& other );
1866
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,
1888 size_t& nBytesConsumedOut ) override;
1889 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1891 const override;
1892
1893#ifndef DOXYGEN_XML
1895#endif
1896
1897 OGRErr importFromWkt( const char ** ) override;
1898
1899#ifndef DOXYGEN_XML
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
1972inline const OGRCompoundCurve::ChildType* const * begin(const OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1974inline const OGRCompoundCurve::ChildType* const * end(const OGRCompoundCurve* poCurve) { return poCurve->end(); }
1975
1977inline OGRCompoundCurve::ChildType** begin(OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1979inline OGRCompoundCurve::ChildType** end(OGRCompoundCurve* poCurve) { return poCurve->end(); }
1981
1982/************************************************************************/
1983/* OGRSurface */
1984/************************************************************************/
1985
1991class 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
2033class 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:
2066 ~OGRCurvePolygon() override;
2067
2068 OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
2069
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;
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,
2109 size_t& nBytesConsumedOut ) override;
2110 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2112 const override;
2113
2114#ifndef DOXYGEN_XML
2116#endif
2117
2118 OGRErr importFromWkt( const char ** ) override;
2119
2120#ifndef DOXYGEN_XML
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
2157 const OGRCurve *getExteriorRingCurve() const;
2158 int getNumInteriorRings() const;
2160 const OGRCurve *getInteriorRingCurve( int ) const;
2161
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
2176inline const OGRCurvePolygon::ChildType* const * begin(const OGRCurvePolygon* poGeom) { return poGeom->begin(); }
2178inline const OGRCurvePolygon::ChildType* const * end(const OGRCurvePolygon* poGeom) { return poGeom->end(); }
2179
2181inline OGRCurvePolygon::ChildType** begin(OGRCurvePolygon* poGeom) { return poGeom->begin(); }
2183inline OGRCurvePolygon::ChildType** end(OGRCurvePolygon* poGeom) { return poGeom->end(); }
2185
2186/************************************************************************/
2187/* OGRPolygon */
2188/************************************************************************/
2189
2199class 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:
2226 OGRPolygon(const OGRPolygon& other);
2227 ~OGRPolygon() override;
2228
2229 OGRPolygon& operator=(const OGRPolygon& other);
2230
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;
2254 const char* const* papszOptions = nullptr ) const override;
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,
2264 size_t& nBytesConsumedOut ) override;
2265 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2267 const override;
2268
2269#ifndef DOXYGEN_XML
2271#endif
2272
2273 OGRErr importFromWkt( const char ** ) override;
2274
2275#ifndef DOXYGEN_XML
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
2317inline const OGRPolygon::ChildType* const * begin(const OGRPolygon* poGeom) { return poGeom->begin(); }
2319inline const OGRPolygon::ChildType* const * end(const OGRPolygon* poGeom) { return poGeom->end(); }
2320
2322inline OGRPolygon::ChildType** begin(OGRPolygon* poGeom) { return poGeom->begin(); }
2324inline OGRPolygon::ChildType** end(OGRPolygon* poGeom) { return poGeom->end(); }
2326
2327/************************************************************************/
2328/* OGRTriangle */
2329/************************************************************************/
2330
2337class 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:
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,
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
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:
2425 ~OGRGeometryCollection() override;
2426
2427 OGRGeometryCollection& operator=( const OGRGeometryCollection& other );
2428
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,
2467 size_t& nBytesConsumedOut ) override;
2468 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2470 const override;
2471
2472#ifndef DOXYGEN_XML
2474#endif
2475
2476 OGRErr importFromWkt( const char ** ) override;
2477
2478#ifndef DOXYGEN_XML
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
2533inline const OGRGeometryCollection::ChildType* const * begin(const OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2535inline const OGRGeometryCollection::ChildType* const * end(const OGRGeometryCollection* poGeom) { return poGeom->end(); }
2536
2538inline OGRGeometryCollection::ChildType** begin(OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2540inline OGRGeometryCollection::ChildType** end(OGRGeometryCollection* poGeom) { return poGeom->end(); }
2542
2543/************************************************************************/
2544/* OGRMultiSurface */
2545/************************************************************************/
2546
2554{
2555 protected:
2556 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2557 const override;
2558
2559 public:
2562 ~OGRMultiSurface() override;
2563
2564 OGRMultiSurface& operator=( const OGRMultiSurface& other );
2565
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
2589#endif
2590
2591 OGRErr importFromWkt( const char ** ) override;
2592
2593#ifndef DOXYGEN_XML
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
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
2639inline const OGRMultiSurface::ChildType* const * begin(const OGRMultiSurface* poGeom) { return poGeom->begin(); }
2641inline const OGRMultiSurface::ChildType* const * end(const OGRMultiSurface* poGeom) { return poGeom->end(); }
2642
2644inline OGRMultiSurface::ChildType** begin(OGRMultiSurface* poGeom) { return poGeom->begin(); }
2646inline OGRMultiSurface::ChildType** end(OGRMultiSurface* poGeom) { return poGeom->end(); }
2648
2649/************************************************************************/
2650/* OGRMultiPolygon */
2651/************************************************************************/
2652
2657class 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:
2679 ~OGRMultiPolygon() override;
2680
2682
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
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
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
2741inline const OGRMultiPolygon::ChildType* const * begin(const OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2743inline const OGRMultiPolygon::ChildType* const * end(const OGRMultiPolygon* poGeom) { return poGeom->end(); }
2744
2746inline OGRMultiPolygon::ChildType** begin(OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2748inline OGRMultiPolygon::ChildType** end(OGRMultiPolygon* poGeom) { return poGeom->end(); }
2750
2751/************************************************************************/
2752/* OGRPolyhedralSurface */
2753/************************************************************************/
2754
2761class 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:
2786
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,
2810 size_t& nBytesConsumedOut ) override;
2811 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2813 const override;
2814
2815#ifndef DOXYGEN_XML
2817#endif
2818
2819 OGRErr importFromWkt( const char ** ) override;
2820
2821#ifndef DOXYGEN_XML
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
2848 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2849 const override;
2850 virtual OGRErr addGeometry( const OGRGeometry * );
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
2874inline const OGRPolyhedralSurface::ChildType* const * begin(const OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2876inline const OGRPolyhedralSurface::ChildType* const * end(const OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2877
2879inline OGRPolyhedralSurface::ChildType** begin(OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2881inline OGRPolyhedralSurface::ChildType** end(OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2883
2884/************************************************************************/
2885/* OGRTriangulatedSurface */
2886/************************************************************************/
2887
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:
2913
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
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
2960inline const OGRTriangulatedSurface::ChildType* const * begin(const OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2962inline const OGRTriangulatedSurface::ChildType* const * end(const OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2963
2965inline OGRTriangulatedSurface::ChildType** begin(OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2967inline OGRTriangulatedSurface::ChildType** end(OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2969
2970/************************************************************************/
2971/* OGRMultiPoint */
2972/************************************************************************/
2973
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:
2990 ~OGRMultiPoint() override;
2991
2992 OGRMultiPoint& operator=(const OGRMultiPoint& other);
2993
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
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
3023#endif
3024
3025 OGRErr importFromWkt( const char ** ) override;
3026
3027#ifndef DOXYGEN_XML
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
3063inline const OGRMultiPoint::ChildType* const * begin(const OGRMultiPoint* poGeom) { return poGeom->begin(); }
3065inline const OGRMultiPoint::ChildType* const * end(const OGRMultiPoint* poGeom) { return poGeom->end(); }
3066
3068inline OGRMultiPoint::ChildType** begin(OGRMultiPoint* poGeom) { return poGeom->begin(); }
3070inline OGRMultiPoint::ChildType** end(OGRMultiPoint* poGeom) { return poGeom->end(); }
3072
3073/************************************************************************/
3074/* OGRMultiCurve */
3075/************************************************************************/
3076
3084{
3085 protected:
3087 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
3088 OGRCurve* poCurve );
3090 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
3091 const override;
3092
3093 public:
3096 ~OGRMultiCurve() override;
3097
3098 OGRMultiCurve& operator=( const OGRMultiCurve& other );
3099
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
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
3129#endif
3130
3131 OGRErr importFromWkt( const char ** ) override;
3132
3133#ifndef DOXYGEN_XML
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
3170inline const OGRMultiCurve::ChildType* const * begin(const OGRMultiCurve* poGeom) { return poGeom->begin(); }
3172inline const OGRMultiCurve::ChildType* const * end(const OGRMultiCurve* poGeom) { return poGeom->end(); }
3173
3175inline OGRMultiCurve::ChildType** begin(OGRMultiCurve* poGeom) { return poGeom->begin(); }
3177inline OGRMultiCurve::ChildType** end(OGRMultiCurve* poGeom) { return poGeom->end(); }
3179
3180/************************************************************************/
3181/* OGRMultiLineString */
3182/************************************************************************/
3183
3188class CPL_DLL OGRMultiLineString : public OGRMultiCurve
3189{
3190 protected:
3191 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
3192 const override;
3193
3194 public:
3197 ~OGRMultiLineString() override;
3198
3199 OGRMultiLineString& operator=( const OGRMultiLineString& other );
3200
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
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
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
3262inline const OGRMultiLineString::ChildType* const * begin(const OGRMultiLineString* poGeom) { return poGeom->begin(); }
3264inline const OGRMultiLineString::ChildType* const * end(const OGRMultiLineString* poGeom) { return poGeom->end(); }
3265
3267inline OGRMultiLineString::ChildType** begin(OGRMultiLineString* poGeom) { return poGeom->begin(); }
3269inline OGRMultiLineString::ChildType** end(OGRMultiLineString* poGeom) { return poGeom->end(); }
3271
3272/************************************************************************/
3273/* OGRGeometryFactory */
3274/************************************************************************/
3275
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),
3292 static OGRErr createFromWkb( const void * pabyData,
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
3344 {
3345 friend class OGRGeometryFactory;
3346 struct Private;
3347 std::unique_ptr<Private> d;
3348
3349 public:
3352 };
3353
3354 static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
3356 char** papszOptions,
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
3385OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
3386const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
3387
3389typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
3390
3391struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
3392{
3393 void operator()(OGRPreparedGeometry*) const;
3394};
3396
3400typedef std::unique_ptr<OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter> OGRPreparedGeometryUniquePtr;
3401
3402#endif /* ndef OGR_GEOMETRY_H_INCLUDED */
The CPLJSONArray class holds JSON object from CPLJSONDocument.
Definition: cpl_json.h:54
OGRGeometry visitor interface.
Definition: ogr_geometry.h:232
virtual void visit(const OGRCurvePolygon *)=0
Visit OGRCurvePolygon.
virtual void visit(const OGRPolyhedralSurface *)=0
Visit OGRPolyhedralSurface.
virtual void visit(const OGRCompoundCurve *)=0
Visit OGRCompoundCurve.
virtual void visit(const OGRMultiLineString *)=0
Visit OGRMultiLineString.
virtual void visit(const OGRTriangulatedSurface *)=0
Visit OGRTriangulatedSurface.
virtual void visit(const OGRPolygon *)=0
Visit OGRPolygon.
virtual void visit(const OGRMultiPolygon *)=0
Visit OGRMultiPolygon.
virtual void visit(const OGRTriangle *)=0
Visit OGRTriangle.
virtual void visit(const OGRLineString *)=0
Visit OGRLineString.
virtual void visit(const OGRMultiPoint *)=0
Visit OGRMultiPoint.
virtual void visit(const OGRMultiCurve *)=0
Visit OGRMultiCurve.
virtual void visit(const OGRGeometryCollection *)=0
Visit OGRGeometryCollection.
virtual void visit(const OGRPoint *)=0
Visit OGRPoint.
virtual ~IOGRConstGeometryVisitor()=default
Destructor/.
virtual void visit(const OGRMultiSurface *)=0
Visit OGRMultiSurface.
virtual void visit(const OGRLinearRing *)=0
Visit OGRLinearRing.
virtual void visit(const OGRCircularString *)=0
Visit OGRCircularString.
OGRGeometry visitor interface.
Definition: ogr_geometry.h:158
virtual void visit(OGRMultiSurface *)=0
Visit OGRMultiSurface.
virtual void visit(OGRLinearRing *)=0
Visit OGRLinearRing.
virtual void visit(OGRTriangle *)=0
Visit OGRTriangle.
virtual void visit(OGRCircularString *)=0
Visit OGRCircularString.
virtual void visit(OGRPolygon *)=0
Visit OGRPolygon.
virtual void visit(OGRLineString *)=0
Visit OGRLineString.
virtual void visit(OGRCompoundCurve *)=0
Visit OGRCompoundCurve.
virtual void visit(OGRTriangulatedSurface *)=0
Visit OGRTriangulatedSurface.
virtual void visit(OGRPoint *)=0
Visit OGRPoint.
virtual void visit(OGRCurvePolygon *)=0
Visit OGRCurvePolygon.
virtual void visit(OGRGeometryCollection *)=0
Visit OGRGeometryCollection.
virtual void visit(OGRPolyhedralSurface *)=0
Visit OGRPolyhedralSurface.
virtual void visit(OGRMultiPolygon *)=0
Visit OGRMultiPolygon.
virtual ~IOGRGeometryVisitor()=default
Destructor/.
virtual void visit(OGRMultiLineString *)=0
Visit OGRMultiLineString.
virtual void visit(OGRMultiPoint *)=0
Visit OGRMultiPoint.
virtual void visit(OGRMultiCurve *)=0
Visit OGRMultiCurve.
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:1629
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1708
OGRCircularString()
Create an empty circular string.
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1706
OGRCircularString(const OGRCircularString &other)
Copy constructor.
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1704
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1709
Utility class to store a collection of curves.
Definition: ogr_geometry.h:1830
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1962
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:1881
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:1879
OGRCompoundCurve(const OGRCompoundCurve &other)
Copy constructor.
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:1868
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:1875
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1873
OGRCompoundCurve()
Create an empty compound curve.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1961
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:759
Concrete class representing curve polygons.
Definition: ogr_geometry.h:2034
OGRCurve * stealExteriorRingCurve()
"Steal" reference to external ring.
Definition: ogrcurvepolygon.cpp:292
OGRCurve * getExteriorRingCurve()
Fetch reference to external polygon ring.
Definition: ogrcurvepolygon.cpp:186
OGRCurve * getInteriorRingCurve(int)
Fetch reference to indicated internal ring.
Definition: ogrcurvepolygon.cpp:251
virtual OGRBoolean Contains(const OGRGeometry *) const override
Test for containment.
Definition: ogrcurvepolygon.cpp:780
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrcurvepolygon.cpp:150
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2165
virtual void empty() override
Clear geometry information.
Definition: ogrcurvepolygon.cpp:113
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition: ogrcurvepolygon.cpp:616
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:827
virtual double get_Area() const override
Get the area of the surface object.
Definition: ogrcurvepolygon.cpp:665
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:655
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrcurvepolygon.cpp:140
virtual OGRBoolean Intersects(const OGRGeometry *) const override
Do these features intersect?
Definition: ogrcurvepolygon.cpp:796
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:737
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:636
virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:723
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2071
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:714
OGRCurvePolygon()
Create an empty curve polygon.
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrcurvepolygon.cpp:705
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:2084
virtual OGRErr addRing(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:347
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:2082
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:2076
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrcurvepolygon.cpp:685
virtual void setMeasured(OGRBoolean bIsMeasured) override
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:696
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:2078
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:223
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2166
OGRErr removeRing(int iIndex, bool bDelete=true)
Remove a geometry from the container.
Definition: ogrcurvepolygon.cpp:324
OGRCurvePolygon(const OGRCurvePolygon &)
Copy constructor.
virtual void set3D(OGRBoolean bIs3D) override
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:691
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:1071
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const =0
Return a linestring from a curve geometry.
virtual double get_Length() const =0
Returns the length of the curve.
virtual int IntersectsPoint(const OGRPoint *p) const
Returns if a point intersects a (closed) curve.
Definition: ogrcurve.cpp:416
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1156
virtual void StartPoint(OGRPoint *) const =0
Return the curve start point.
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
virtual int getNumPoints() const =0
Return the number of points of a curve geometry.
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1114
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1151
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:396
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
virtual OGRPointIterator * getPointIterator() const =0
Returns a point iterator over the curve.
virtual double get_AreaOfCurveSegments() const =0
Get the area of the purely curve portions of a (closed) curve.
virtual double get_Area() const =0
Get the area of the (closed) curve.
virtual OGRCurve * clone() const override=0
Make a copy of this object.
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:279
void visit(const OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:284
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:205
void visit(OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:210
Simple container for a bounding region in 3D.
Definition: ogr_core.h:199
Simple container for a bounding region (rectangle)
Definition: ogr_core.h:58
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:2402
ChildType ** end()
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2437
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2519
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2520
const ChildType *const * begin() const
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2441
const ChildType *const * end() const
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2443
ChildType ** begin()
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2435
OGRGeometry * getGeometryRef(int)
Fetch geometry from container.
Definition: ogrgeometrycollection.cpp:262
OGRGeometryCollection()
Create an empty geometry collection.
OGRGeometry ChildType
Type of child elements.
Definition: ogr_geometry.h:2430
Opaque class used as argument to transformWithOptions()
Definition: ogr_geometry.h:3344
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:3281
static OGRErr createFromWkt(char **ppszInput, OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
Definition: ogr_geometry.h:3305
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:327
const OGRSurface * toSurface() const
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:684
const OGRCurvePolygon * toCurvePolygon() const
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:726
const OGRMultiCurve * toMultiCurve() const
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:796
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=nullptr) const
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3270
const OGRPolyhedralSurface * toPolyhedralSurface() const
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:824
const OGRMultiPoint * toMultiPoint() const
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:754
virtual void empty()=0
Clear geometry information.
const OGRMultiPolygon * toMultiPolygon() const
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:782
virtual OGRBoolean Equals(const OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
OGRPolyhedralSurface * toPolyhedralSurface()
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:817
const OGRMultiSurface * toMultiSurface() const
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:810
OGRPoint * toPoint()
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:579
bool operator!=(const OGRGeometry &other) const
Returns if two geometries are different.
Definition: ogr_geometry.h:393
OGRTriangle * toTriangle()
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:705
OGRLineString * toLineString()
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:621
const OGRLinearRing * toLinearRing() const
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:642
const OGRPoint * toPoint() const
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:586
OGRMultiLineString * toMultiLineString()
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:761
OGRMultiSurface * toMultiSurface()
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:803
static OGRGeometry * FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
Definition: ogr_geometry.h:572
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
virtual void accept(IOGRConstGeometryVisitor *visitor) const =0
Accept a visitor.
const OGRGeometryCollection * toGeometryCollection() const
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:740
const OGRMultiLineString * toMultiLineString() const
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:768
const OGRCircularString * toCircularString() const
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:656
OGRPolygon * toPolygon()
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:691
bool operator==(const OGRGeometry &other) const
Returns if two geometries are equal.
Definition: ogr_geometry.h:390
OGRLinearRing * toLinearRing()
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:635
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:407
virtual void accept(IOGRGeometryVisitor *visitor)=0
Accept a visitor.
OGRMultiCurve * toMultiCurve()
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:789
const OGRCompoundCurve * toCompoundCurve() const
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:670
virtual OGRErr transform(OGRCoordinateTransformation *poCT)=0
Apply arbitrary coordinate transformation to geometry.
virtual void flattenTo2D()=0
Convert geometry to strictly 2D.
virtual int getDimension() const =0
Get the dimension of this object.
OGRGeometryCollection * toGeometryCollection()
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:733
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
OGRMultiPolygon * toMultiPolygon()
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:775
const OGRPolygon * toPolygon() const
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:698
OGRCompoundCurve * toCompoundCurve()
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:663
OGRErr importFromWkt(char **ppszInput)
Deprecated.
Definition: ogr_geometry.h:430
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.
const OGRLineString * toLineString() const
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:628
OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const
Convert a geometry into well known text format.
Definition: ogrgeometry.cpp:1830
OGRCircularString * toCircularString()
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:649
const OGRCurve * toCurve() const
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:600
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrgeometry.cpp:3235
OGRCurvePolygon * toCurvePolygon()
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:719
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:614
static OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
Definition: ogr_geometry.h:566
OGRBoolean Is3D() const
Definition: ogr_geometry.h:405
OGRMultiPoint * toMultiPoint()
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:747
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:5433
const OGRTriangulatedSurface * toTriangulatedSurface() const
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:838
const OGRTriangle * toTriangle() const
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:712
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
virtual OGRGeometry * clone() const =0
Make a copy of this object.
OGRSurface * toSurface()
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:677
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:607
OGRTriangulatedSurface * toTriangulatedSurface()
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:831
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const =0
Export a WKT geometry.
OGRCurve * toCurve()
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:593
Definition: ogr_geometry.h:1203
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1468
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1509
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1514
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1513
OGRLineString(const OGRLineString &other)
Copy constructor.
virtual int isClockwise() const override
Returns TRUE if the ring has clockwise winding (or less than 2 points)
OGRLineString()
Create an empty line string.
virtual double get_Area() const override
Get the area of the (closed) curve.
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1511
Concrete representation of a closed ring.
Definition: ogr_geometry.h:1545
OGRLineString * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1601
const OGRLineString * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1603
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1606
OGRLinearRing(const OGRLinearRing &other)
Copy constructor.
OGRLinearRing()
Constructor.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1605
A collection of OGRCurve.
Definition: ogr_geometry.h:3084
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3112
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3114
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3157
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3108
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3154
const OGRCurve * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3120
OGRCurve * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3118
OGRMultiCurve()
Create an empty multi curve collection.
OGRMultiCurve(const OGRMultiCurve &other)
Copy constructor.
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:3101
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3106
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3152
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3156
A collection of OGRLineString.
Definition: ogr_geometry.h:3189
OGRLineString ChildType
Type of child elements.
Definition: ogr_geometry.h:3202
OGRLineString * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3219
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3244
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3209
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3215
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3249
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3213
OGRMultiLineString()
Create an empty multi line string collection.
const OGRLineString * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3221
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3248
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3207
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3246
OGRMultiLineString(const OGRMultiLineString &other)
Copy constructor.
A collection of OGRPoint.
Definition: ogr_geometry.h:2979
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3042
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3046
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3008
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3000
OGRMultiPoint()
Create an empty multi point collection.
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3047
OGRMultiPoint(const OGRMultiPoint &other)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3006
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3044
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:2995
const OGRPoint * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3014
OGRPoint * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3012
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3002
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:2658
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2684
OGRMultiPolygon(const OGRMultiPolygon &other)
Copy constructor.
OGRPolygon * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2701
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2731
const OGRPolygon * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2703
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2697
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2691
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2730
OGRMultiPolygon()
Create an empty multi polygon collection.
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2689
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2726
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2695
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2728
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:2554
OGRMultiSurface()
Create an empty multi surface collection.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2625
const OGRSurface * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2614
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2572
OGRSurface ChildType
Type of child elements.
Definition: ogr_geometry.h:2567
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2623
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2578
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2580
OGRMultiSurface(const OGRMultiSurface &other)
Copy constructor.
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2574
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2626
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2621
OGRSurface * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2612
Interface for a point iterator.
Definition: ogr_geometry.h:1053
virtual OGRBoolean getNextPoint(OGRPoint *p)=0
Returns the next point followed by the iterator.
Point class.
Definition: ogr_geometry.h:937
double getM() const
Return m.
Definition: ogr_geometry.h:998
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1031
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:1005
OGRPoint(const OGRPoint &other)
Copy constructor.
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:1013
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:1018
double getX() const
Return x.
Definition: ogr_geometry.h:992
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1032
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:1009
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:987
double getZ() const
Return z.
Definition: ogr_geometry.h:996
double getY() const
Return y.
Definition: ogr_geometry.h:994
Concrete class representing polygons.
Definition: ogr_geometry.h:2200
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a polygon to WKT.
Definition: ogrpolygon.cpp:651
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrpolygon.cpp:786
OGRLinearRing ChildType
Type of child elements.
Definition: ogr_geometry.h:2232
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2237
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:777
const OGRCurvePolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2304
OGRPolygon()
Create an empty polygon.
virtual size_t WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolygon.cpp:328
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2239
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrpolygon.cpp:475
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:766
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolygon.cpp:402
OGRPolygon(const OGRPolygon &other)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2243
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2307
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2245
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2306
OGRCurvePolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2302
virtual void closeRings() override
Force rings to be closed.
Definition: ogrpolygon.cpp:755
PolyhedralSurface class.
Definition: ogr_geometry.h:2762
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a polyhedral surface to WKT.
Definition: ogrpolyhedralsurface.cpp:437
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolyhedralsurface.cpp:289
virtual OGRBoolean IsEmpty() const override
Checks if the PolyhedralSurface is empty.
Definition: ogrpolyhedralsurface.cpp:857
virtual void setMeasured(OGRBoolean bIsMeasured) override
Set the type as Measured.
Definition: ogrpolyhedralsurface.cpp:885
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrpolyhedralsurface.cpp:906
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:798
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrpolyhedralsurface.cpp:966
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrpolyhedralsurface.cpp:197
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2795
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:709
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2801
OGRPolygon * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:820
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrpolyhedralsurface.cpp:921
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition: ogrpolyhedralsurface.cpp:179
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrpolyhedralsurface.cpp:505
OGRPolyhedralSurface(const OGRPolyhedralSurface &poGeom)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2799
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolyhedralsurface.cpp:931
~OGRPolyhedralSurface() override
Destructor.
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2793
virtual void set3D(OGRBoolean bIs3D) override
Set the type as 3D geometry.
Definition: ogrpolyhedralsurface.cpp:870
OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
Definition: ogrpolyhedralsurface.cpp:766
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrpolyhedralsurface.cpp:339
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrpolyhedralsurface.cpp:598
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2863
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2788
virtual double get_Area() const override
Returns the area enclosed.
Definition: ogrpolyhedralsurface.cpp:638
virtual OGRErr transform(OGRCoordinateTransformation *) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrpolyhedralsurface.cpp:517
virtual OGRErr PointOnSurface(OGRPoint *) const override
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogrpolyhedralsurface.cpp:665
OGRPolyhedralSurface()
Create an empty PolyhedralSurface.
virtual size_t WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolyhedralsurface.cpp:137
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrpolyhedralsurface.cpp:151
virtual void empty() override
Clear geometry information.
Definition: ogrpolyhedralsurface.cpp:160
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:957
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2864
Simple container for a position.
Definition: ogr_geometry.h:104
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:110
double x
x
Definition: ogr_geometry.h:113
double y
y
Definition: ogr_geometry.h:115
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:107
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:1248
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:1385
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:1384
void setZ(int, double)
Set the Z of a vertex in line string.
Definition: ogrlinestring.cpp:709
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1314
void setM(int, double)
Set the M of a vertex in line string.
Definition: ogrlinestring.cpp:742
virtual OGRSimpleCurve * clone() const override=0
Make a copy of this object.
virtual int getNumPoints() const override
Fetch vertex count.
Definition: ogr_geometry.h:1382
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:158
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:1992
virtual double get_Area() const =0
Get the area of the surface object.
virtual OGRSurface * clone() const override=0
Make a copy of this object.
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:2001
Triangle class.
Definition: ogr_geometry.h:2338
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrtriangle.cpp:170
const OGRPolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2377
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2379
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrtriangle.cpp:198
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2380
OGRTriangle()
Constructor.
~OGRTriangle() override
Destructor.
virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override
Add a ring to a polygon.
Definition: ogrtriangle.cpp:256
OGRPolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2375
OGRTriangle(const OGRTriangle &other)
Copy constructor.
virtual OGRTriangle * clone() const override
Make a copy of this object.
Definition: ogrtriangle.cpp:151
OGRTriangle & operator=(const OGRTriangle &other)
Assignment operator.
Definition: ogrtriangle.cpp:138
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrtriangle.cpp:161
TriangulatedSurface class.
Definition: ogr_geometry.h:2895
const OGRTriangle * getGeometryRef(int i) const
See OGRPolyhedralSurface::getGeometryRef()
Definition: ogr_geometry.h:2938
~OGRTriangulatedSurface()
Destructor.
OGRTriangle * getGeometryRef(int i)
See OGRPolyhedralSurface::getGeometryRef()
Definition: ogr_geometry.h:2936
OGRTriangulatedSurface & operator=(const OGRTriangulatedSurface &other)
Assignment operator.
Definition: ogrtriangulatedsurface.cpp:84
virtual const char * getGeometryName() const override
Returns the geometry name of the TriangulatedSurface.
Definition: ogrtriangulatedsurface.cpp:126
virtual OGRwkbGeometryType getGeometryType() const override
Returns the WKB Type of TriangulatedSurface.
Definition: ogrtriangulatedsurface.cpp:140
virtual OGRErr addGeometry(const OGRGeometry *) override
Add a new geometry to a collection.
Definition: ogrtriangulatedsurface.cpp:190
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2928
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2926
OGRPolyhedralSurface * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2944
virtual OGRTriangulatedSurface * clone() const override
Make a copy of this object.
Definition: ogrtriangulatedsurface.cpp:109
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2948
const OGRPolyhedralSurface * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2946
OGRTriangle ChildType
Type of child elements.
Definition: ogr_geometry.h:2915
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2949
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2920
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2922
OGRTriangulatedSurface()
Constructor.
Various convenience functions for CPL.
Interface for read and write JSON documents.
#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
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1056
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:869
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:203
void * OGRGeometryH
Opaque type for a geometry.
Definition: ogr_api.h:65
Core portability services for cross-platform OGR code.
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:357
OGRwkbByteOrder
Enumeration to describe byte order.
Definition: ogr_core.h:551
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:485
@ wkbVariantOldOgc
Old-style 99-402 extended dimension (Z) WKB types.
Definition: ogr_core.h:486
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:369
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:341
OGRWktFormat
WKT Output formatting options.
Definition: ogr_geometry.h:62
@ Default
Format as F when abs(value) < 1, otherwise as G.
@ F
F-type formatting.
@ G
G-type formatting.
std::unique_ptr< OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter > OGRPreparedGeometryUniquePtr
Unique pointer type for OGRPreparedGeometry.
Definition: ogr_geometry.h:3400
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
Definition: ogr_geometry.h:121
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGCgeometry format type to corresponding OGR constants.
Definition: ogrgeometry.cpp:2401
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition: ogrgeometry.cpp:2474
std::unique_ptr< OGRGeometry, OGRGeometryUniquePtrDeleter > OGRGeometryUniquePtr
Unique pointer type for OGRGeometry.
Definition: ogr_geometry.h:853
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:119
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:123
Coordinate systems services.
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:322
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:327
Options for formatting WKT output.
Definition: ogr_geometry.h:70
OGRwkbVariant variant
Type of WKT output to produce.
Definition: ogr_geometry.h:73
OGRWktOptions()
Constructor.
Definition: ogr_geometry.h:82
OGRWktOptions(const OGRWktOptions &)=default
Copy constructor.
bool round
Whether GDAL-special rounding should be applied.
Definition: ogr_geometry.h:77
int precision
Precision of output. Interpretation depends on format.
Definition: ogr_geometry.h:75
OGRWktFormat format
Formatting type.
Definition: ogr_geometry.h:79