GDAL
ogr_geometry.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Project: OpenGIS Simple Features Reference Implementation
4 * Purpose: Classes for manipulating simple features that is not specific
5 * to a particular interface technology.
6 * Author: Frank Warmerdam, warmerdam@pobox.com
7 *
8 ******************************************************************************
9 * Copyright (c) 1999, Frank Warmerdam
10 * Copyright (c) 2008-2014, Even Rouault <even dot rouault at spatialys.com>
11 *
12 * SPDX-License-Identifier: MIT
13 ****************************************************************************/
14
15#ifndef OGR_GEOMETRY_H_INCLUDED
16#define OGR_GEOMETRY_H_INCLUDED
17
18#include "cpl_conv.h"
19#include "cpl_json.h"
20#include "gdal_fwd.h"
21#include "ogr_core.h"
23#include "ogr_spatialref.h"
24
25#include <climits>
26#include <cmath>
27#include <memory>
28#include <utility>
29
35
37enum class OGRWktFormat
38{
39 F,
40 G,
42};
43
45class CPL_DLL OGRWktOptions
46{
47 public:
57 bool round;
60
67
69 OGRWktOptions(int xyPrecisionIn, bool roundIn)
70 : xyPrecision(xyPrecisionIn), zPrecision(xyPrecision),
71 mPrecision(zPrecision), round(roundIn)
72 {
73 }
74
76 OGRWktOptions(const OGRWktOptions &) = default;
77
79 static int getDefaultPrecision();
80
82 static bool getDefaultRound();
83};
84
89{
90 public:
92 OGRRawPoint() : x(0.0), y(0.0)
93 {
94 }
95
97 OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn)
98 {
99 }
100
102 double x;
104 double y;
105};
106
108typedef struct GEOSGeom_t *GEOSGeom;
110typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
112typedef void sfcgal_geometry_t;
113
114class OGRPoint;
115class OGRCurve;
116class OGRCompoundCurve;
117class OGRSimpleCurve;
118class OGRLinearRing;
119class OGRLineString;
121class OGRSurface;
122class OGRCurvePolygon;
123class OGRPolygon;
124class OGRMultiPoint;
125class OGRMultiSurface;
126class OGRMultiPolygon;
127class OGRMultiCurve;
130class OGRTriangle;
133
135typedef OGRLineString *(*OGRCurveCasterToLineString)(OGRCurve *);
136typedef OGRLinearRing *(*OGRCurveCasterToLinearRing)(OGRCurve *);
137
138typedef OGRPolygon *(*OGRSurfaceCasterToPolygon)(OGRSurface *);
139typedef OGRCurvePolygon *(*OGRSurfaceCasterToCurvePolygon)(OGRSurface *);
140typedef OGRMultiPolygon *(*OGRPolyhedralSurfaceCastToMultiPolygon)(
142
144
148{
149 public:
152
154 virtual void visit(OGRPoint *) = 0;
156 virtual void visit(OGRLineString *) = 0;
158 virtual void visit(OGRLinearRing *) = 0;
160 virtual void visit(OGRPolygon *) = 0;
162 virtual void visit(OGRMultiPoint *) = 0;
164 virtual void visit(OGRMultiLineString *) = 0;
166 virtual void visit(OGRMultiPolygon *) = 0;
168 virtual void visit(OGRGeometryCollection *) = 0;
170 virtual void visit(OGRCircularString *) = 0;
172 virtual void visit(OGRCompoundCurve *) = 0;
174 virtual void visit(OGRCurvePolygon *) = 0;
176 virtual void visit(OGRMultiCurve *) = 0;
178 virtual void visit(OGRMultiSurface *) = 0;
180 virtual void visit(OGRTriangle *) = 0;
182 virtual void visit(OGRPolyhedralSurface *) = 0;
184 virtual void visit(OGRTriangulatedSurface *) = 0;
185};
186
194{
195 void _visit(OGRSimpleCurve *poGeom);
196
197 public:
198 void visit(OGRPoint *) override
199 {
200 }
201
202 void visit(OGRLineString *) override;
203 void visit(OGRLinearRing *) override;
204 void visit(OGRPolygon *) override;
205 void visit(OGRMultiPoint *) override;
206 void visit(OGRMultiLineString *) override;
207 void visit(OGRMultiPolygon *) override;
208 void visit(OGRGeometryCollection *) override;
209 void visit(OGRCircularString *) override;
210 void visit(OGRCompoundCurve *) override;
211 void visit(OGRCurvePolygon *) override;
212 void visit(OGRMultiCurve *) override;
213 void visit(OGRMultiSurface *) override;
214 void visit(OGRTriangle *) override;
215 void visit(OGRPolyhedralSurface *) override;
216 void visit(OGRTriangulatedSurface *) override;
217};
218
222{
223 public:
226
228 virtual void visit(const OGRPoint *) = 0;
230 virtual void visit(const OGRLineString *) = 0;
232 virtual void visit(const OGRLinearRing *) = 0;
234 virtual void visit(const OGRPolygon *) = 0;
236 virtual void visit(const OGRMultiPoint *) = 0;
238 virtual void visit(const OGRMultiLineString *) = 0;
240 virtual void visit(const OGRMultiPolygon *) = 0;
242 virtual void visit(const OGRGeometryCollection *) = 0;
244 virtual void visit(const OGRCircularString *) = 0;
246 virtual void visit(const OGRCompoundCurve *) = 0;
248 virtual void visit(const OGRCurvePolygon *) = 0;
250 virtual void visit(const OGRMultiCurve *) = 0;
252 virtual void visit(const OGRMultiSurface *) = 0;
254 virtual void visit(const OGRTriangle *) = 0;
256 virtual void visit(const OGRPolyhedralSurface *) = 0;
258 virtual void visit(const OGRTriangulatedSurface *) = 0;
259};
260
268{
269 void _visit(const OGRSimpleCurve *poGeom);
270
271 public:
272 void visit(const OGRPoint *) override
273 {
274 }
275
276 void visit(const OGRLineString *) override;
277 void visit(const OGRLinearRing *) override;
278 void visit(const OGRPolygon *) override;
279 void visit(const OGRMultiPoint *) override;
280 void visit(const OGRMultiLineString *) override;
281 void visit(const OGRMultiPolygon *) override;
282 void visit(const OGRGeometryCollection *) override;
283 void visit(const OGRCircularString *) override;
284 void visit(const OGRCompoundCurve *) override;
285 void visit(const OGRCurvePolygon *) override;
286 void visit(const OGRMultiCurve *) override;
287 void visit(const OGRMultiSurface *) override;
288 void visit(const OGRTriangle *) override;
289 void visit(const OGRPolyhedralSurface *) override;
290 void visit(const OGRTriangulatedSurface *) override;
291};
292
293/************************************************************************/
294/* OGRGeomCoordinateBinaryPrecision */
295/************************************************************************/
296
302{
303 public:
305 INT_MIN;
308 INT_MIN;
311 INT_MIN;
313
315};
316
317/************************************************************************/
318/* OGRwkbExportOptions */
319/************************************************************************/
320
331
332/************************************************************************/
333/* OGRGeometry */
334/************************************************************************/
335
355
356class CPL_DLL OGRGeometry
357{
358 private:
359 const OGRSpatialReference *poSRS = nullptr; // may be NULL
360
361 protected:
363 friend class OGRCurveCollection;
364
365 unsigned int flags = 0;
366
367 OGRErr importPreambleFromWkt(const char **ppszInput, int *pbHasZ,
368 int *pbHasM, bool *pbIsEmpty);
369 OGRErr importCurveCollectionFromWkt(
370 const char **ppszInput, int bAllowEmptyComponent, int bAllowLineString,
371 int bAllowCurve, int bAllowCompoundCurve,
372 OGRErr (*pfnAddCurveDirectly)(OGRGeometry *poSelf, OGRCurve *poCurve));
373 OGRErr importPreambleFromWkb(const unsigned char *pabyData, size_t nSize,
374 OGRwkbByteOrder &eByteOrder,
375 OGRwkbVariant eWkbVariant);
376 OGRErr importPreambleOfCollectionFromWkb(const unsigned char *pabyData,
377 size_t &nSize, size_t &nDataOffset,
378 OGRwkbByteOrder &eByteOrder,
379 size_t nMinSubGeomSize,
380 int &nGeomCount,
381 OGRwkbVariant eWkbVariant);
382 OGRErr PointOnSurfaceInternal(OGRPoint *poPoint) const;
383 OGRBoolean IsSFCGALCompatible() const;
384
385 void HomogenizeDimensionalityWith(OGRGeometry *poOtherGeom);
386 std::string wktTypeString(OGRwkbVariant variant) const;
387
389
390 public:
391 /************************************************************************/
392 /* Bit flags for OGRGeometry */
393 /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
394 /* Do not use these outside of the core. */
395 /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
396 /************************************************************************/
397
399 static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
400 static const unsigned int OGR_G_3D = 0x2;
401 static const unsigned int OGR_G_MEASURED = 0x4;
403
404 OGRGeometry();
405 OGRGeometry(const OGRGeometry &other);
406 OGRGeometry(OGRGeometry &&other);
407 virtual ~OGRGeometry();
408
409 OGRGeometry &operator=(const OGRGeometry &other);
410 OGRGeometry &operator=(OGRGeometry &&other);
411
413 bool operator==(const OGRGeometry &other) const
414 {
415 return CPL_TO_BOOL(Equals(&other));
416 }
417
419 bool operator!=(const OGRGeometry &other) const
420 {
421 return !CPL_TO_BOOL(Equals(&other));
422 }
423
424 // Standard IGeometry.
425 virtual int getDimension() const = 0;
426 virtual int getCoordinateDimension() const;
427 int CoordinateDimension() const;
428 virtual OGRBoolean IsEmpty() const = 0;
429 virtual OGRBoolean IsValid() const;
430 virtual OGRGeometry *MakeValid(CSLConstList papszOptions = nullptr) const;
431 virtual OGRGeometry *Normalize() const;
432 virtual OGRBoolean IsSimple() const;
433
436 {
437 return (flags & OGR_G_3D) != 0;
438 }
439
442 {
443 return (flags & OGR_G_MEASURED) != 0;
444 }
445
446 virtual OGRBoolean IsRing() const;
447 virtual void empty() = 0;
448 virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
449 virtual void getEnvelope(OGREnvelope *psEnvelope) const = 0;
450 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const = 0;
451
452 // IWks Interface.
453 virtual size_t WkbSize() const = 0;
454 OGRErr importFromWkb(const GByte *, size_t = static_cast<size_t>(-1),
456 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
457 size_t &nBytesConsumedOut) = 0;
458 OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
460 virtual OGRErr exportToWkb(unsigned char *,
461 const OGRwkbExportOptions * = nullptr) const = 0;
462 virtual OGRErr importFromWkt(const char **ppszInput) = 0;
463
464#ifndef DOXYGEN_XML
468 OGRErr importFromWkt(char **ppszInput)
470 CPL_WARN_DEPRECATED("Use importFromWkt(const char**) instead")
472 {
473 return importFromWkt(const_cast<const char **>(ppszInput));
474 }
475#endif
476
477 OGRErr exportToWkt(char **ppszDstText,
479
484 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
485 OGRErr *err = nullptr) const = 0;
486
487 // Non-standard.
490 virtual const char *getGeometryName() const = 0;
491 void dumpReadable(FILE *, const char * = nullptr,
492 CSLConstList papszOptions = nullptr) const;
493 std::string dumpReadable(const char * = nullptr,
494 CSLConstList papszOptions = nullptr) const;
495 virtual void flattenTo2D() = 0;
496 virtual char *exportToGML(const char *const *papszOptions = nullptr) const;
497 virtual char *exportToKML() const;
498 virtual char *exportToJson(CSLConstList papszOptions = nullptr) const;
499
501 virtual void accept(IOGRGeometryVisitor *visitor) = 0;
502
504 virtual void accept(IOGRConstGeometryVisitor *visitor) const = 0;
505
507 static void freeGEOSContext(GEOSContextHandle_t hGEOSCtxt);
510 bool bRemoveEmptyParts = false) const CPL_WARN_UNUSED_RESULT;
511 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
512 virtual OGRGeometry *getCurveGeometry(
513 const char *const *papszOptions = nullptr) const CPL_WARN_UNUSED_RESULT;
514 virtual OGRGeometry *getLinearGeometry(
515 double dfMaxAngleStepSizeDegrees = 0,
516 const char *const *papszOptions = nullptr) const CPL_WARN_UNUSED_RESULT;
517
518 void roundCoordinates(const OGRGeomCoordinatePrecision &sPrecision);
519 void
521
522 // SFCGAL interfacing methods.
524 static sfcgal_geometry_t *OGRexportToSFCGAL(const OGRGeometry *poGeom);
525 static OGRGeometry *SFCGALexportToOGR(const sfcgal_geometry_t *_geometry);
527 virtual void closeRings();
528
529 virtual bool setCoordinateDimension(int nDimension);
530 virtual bool set3D(OGRBoolean bIs3D);
531 virtual bool setMeasured(OGRBoolean bIsMeasured);
532
533 virtual void assignSpatialReference(const OGRSpatialReference *poSR);
534
536 {
537 return poSRS;
538 }
539
542
543 virtual bool segmentize(double dfMaxLength);
544
545 // ISpatialRelation
546 virtual OGRBoolean Intersects(const OGRGeometry *) const;
547 virtual OGRBoolean Equals(const OGRGeometry *) const = 0;
548 virtual OGRBoolean Disjoint(const OGRGeometry *) const;
549 virtual OGRBoolean Touches(const OGRGeometry *) const;
550 virtual OGRBoolean Crosses(const OGRGeometry *) const;
551 virtual OGRBoolean Within(const OGRGeometry *) const;
552 virtual OGRBoolean Contains(const OGRGeometry *) const;
553 virtual OGRBoolean Overlaps(const OGRGeometry *) const;
554 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
555 // virtual OGRGeometry *LocateAlong( double mValue ) const;
556 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd )
557 // const;
558
559 virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
560 virtual double Distance(const OGRGeometry *) const;
561 virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
562 virtual OGRGeometry *
563 ConcaveHull(double dfRatio, bool bAllowHoles) const CPL_WARN_UNUSED_RESULT;
564 virtual OGRGeometry *
565 Buffer(double dfDist, int nQuadSegs = 30) const CPL_WARN_UNUSED_RESULT;
566 virtual OGRGeometry *
567 BufferEx(double dfDist,
568 CSLConstList papszOptions) const CPL_WARN_UNUSED_RESULT;
569 virtual OGRGeometry *
570 Intersection(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
571 virtual OGRGeometry *
572 Union(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
573 virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
574 OGRGeometry *UnaryUnion() const CPL_WARN_UNUSED_RESULT;
575 virtual OGRGeometry *
576 Difference(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
577 virtual OGRGeometry *
578 SymDifference(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
579 virtual OGRErr Centroid(OGRPoint *poPoint) const;
580 virtual OGRGeometry *
581 Simplify(double dTolerance) const CPL_WARN_UNUSED_RESULT;
582 OGRGeometry *
583 SimplifyPreserveTopology(double dTolerance) const CPL_WARN_UNUSED_RESULT;
584 virtual OGRGeometry *
585 DelaunayTriangulation(double dfTolerance,
586 int bOnlyEdges) const CPL_WARN_UNUSED_RESULT;
587 virtual OGRGeometry *
589
590 virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
591 virtual OGRGeometry *BuildArea() const CPL_WARN_UNUSED_RESULT;
592
593 virtual double Distance3D(const OGRGeometry *poOtherGeom) const;
594
595 OGRGeometry *SetPrecision(double dfGridSize, int nFlags) const;
596
597 virtual bool hasEmptyParts() const;
598 virtual void removeEmptyParts();
599
601 // backward compatibility to non-standard method names.
602 OGRBoolean Intersect(OGRGeometry *) const
603 CPL_WARN_DEPRECATED("Non standard method. "
604 "Use Intersects() instead");
605 OGRBoolean Equal(OGRGeometry *) const
606 CPL_WARN_DEPRECATED("Non standard method. "
607 "Use Equals() instead");
608 OGRGeometry *SymmetricDifference(const OGRGeometry *) const
609 CPL_WARN_DEPRECATED("Non standard method. "
610 "Use SymDifference() instead");
611 OGRGeometry *getBoundary() const
612 CPL_WARN_DEPRECATED("Non standard method. "
613 "Use Boundary() instead");
615
617 // Special HACK for DB2 7.2 support
618 static int bGenerate_DB2_V72_BYTE_ORDER;
620
621 virtual void swapXY();
622
623 bool IsRectangle() const;
624
626 static OGRGeometry *CastToIdentity(OGRGeometry *poGeom)
627 {
628 return poGeom;
629 }
630
631 static OGRGeometry *CastToError(OGRGeometry *poGeom);
632
634
637 static inline OGRGeometryH ToHandle(OGRGeometry *poGeom)
638 {
639 return reinterpret_cast<OGRGeometryH>(poGeom);
640 }
641
644 static inline OGRGeometry *FromHandle(OGRGeometryH hGeom)
645 {
646 return reinterpret_cast<OGRGeometry *>(hGeom);
647 }
648
653 {
654 return cpl::down_cast<OGRPoint *>(this);
655 }
656
660 inline const OGRPoint *toPoint() const
661 {
663 }
664
670 {
671 return cpl::down_cast<OGRCurve *>(this);
672 }
673
678 inline const OGRCurve *toCurve() const
679 {
681 }
682
688 {
690 }
691
696 inline const OGRSimpleCurve *toSimpleCurve() const
697 {
699 }
700
706 {
708 }
709
714 inline const OGRLineString *toLineString() const
715 {
717 }
718
723 {
725 }
726
730 inline const OGRLinearRing *toLinearRing() const
731 {
733 }
734
743
749 {
751 }
752
761
766 inline const OGRCompoundCurve *toCompoundCurve() const
767 {
769 }
770
776 {
777 return cpl::down_cast<OGRSurface *>(this);
778 }
779
784 inline const OGRSurface *toSurface() const
785 {
787 }
788
794 {
795 return cpl::down_cast<OGRPolygon *>(this);
796 }
797
802 inline const OGRPolygon *toPolygon() const
803 {
805 }
806
811 {
813 }
814
818 inline const OGRTriangle *toTriangle() const
819 {
821 }
822
828 {
830 }
831
836 inline const OGRCurvePolygon *toCurvePolygon() const
837 {
839 }
840
849
858
864 {
866 }
867
872 inline const OGRMultiPoint *toMultiPoint() const
873 {
875 }
876
885
891 {
893 }
894
900 {
902 }
903
908 inline const OGRMultiPolygon *toMultiPolygon() const
909 {
911 }
912
918 {
920 }
921
926 inline const OGRMultiCurve *toMultiCurve() const
927 {
929 }
930
936 {
938 }
939
944 inline const OGRMultiSurface *toMultiSurface() const
945 {
947 }
948
957
966
974
982};
983
985struct CPL_DLL OGRGeometryUniquePtrDeleter
986{
987 void operator()(OGRGeometry *) const;
988};
989
991
994typedef std::unique_ptr<OGRGeometry, OGRGeometryUniquePtrDeleter>
996
998#define OGR_FORBID_DOWNCAST_TO(name) \
999 inline OGR##name *to##name() = delete; \
1000 inline const OGR##name *to##name() const = delete;
1001
1002#define OGR_FORBID_DOWNCAST_TO_POINT OGR_FORBID_DOWNCAST_TO(Point)
1003#define OGR_FORBID_DOWNCAST_TO_CURVE OGR_FORBID_DOWNCAST_TO(Curve)
1004#define OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE OGR_FORBID_DOWNCAST_TO(SimpleCurve)
1005#define OGR_FORBID_DOWNCAST_TO_LINESTRING OGR_FORBID_DOWNCAST_TO(LineString)
1006#define OGR_FORBID_DOWNCAST_TO_LINEARRING OGR_FORBID_DOWNCAST_TO(LinearRing)
1007#define OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING \
1008 OGR_FORBID_DOWNCAST_TO(CircularString)
1009#define OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE \
1010 OGR_FORBID_DOWNCAST_TO(CompoundCurve)
1011#define OGR_FORBID_DOWNCAST_TO_SURFACE OGR_FORBID_DOWNCAST_TO(Surface)
1012#define OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON OGR_FORBID_DOWNCAST_TO(CurvePolygon)
1013#define OGR_FORBID_DOWNCAST_TO_POLYGON OGR_FORBID_DOWNCAST_TO(Polygon)
1014#define OGR_FORBID_DOWNCAST_TO_TRIANGLE OGR_FORBID_DOWNCAST_TO(Triangle)
1015#define OGR_FORBID_DOWNCAST_TO_MULTIPOINT OGR_FORBID_DOWNCAST_TO(MultiPoint)
1016#define OGR_FORBID_DOWNCAST_TO_MULTICURVE OGR_FORBID_DOWNCAST_TO(MultiCurve)
1017#define OGR_FORBID_DOWNCAST_TO_MULTILINESTRING \
1018 OGR_FORBID_DOWNCAST_TO(MultiLineString)
1019#define OGR_FORBID_DOWNCAST_TO_MULTISURFACE OGR_FORBID_DOWNCAST_TO(MultiSurface)
1020#define OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON OGR_FORBID_DOWNCAST_TO(MultiPolygon)
1021#define OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION \
1022 OGR_FORBID_DOWNCAST_TO(GeometryCollection)
1023#define OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE \
1024 OGR_FORBID_DOWNCAST_TO(PolyhedralSurface)
1025#define OGR_FORBID_DOWNCAST_TO_TIN OGR_FORBID_DOWNCAST_TO(TriangulatedSurface)
1026
1027#define OGR_ALLOW_UPCAST_TO(name) \
1028 inline OGR##name *to##name() \
1029 { \
1030 return this; \
1031 } \
1032 inline const OGR##name *to##name() const \
1033 { \
1034 return this; \
1035 }
1036
1037#ifndef SUPPRESS_OGR_ALLOW_CAST_TO_THIS_WARNING
1038#define CAST_TO_THIS_WARNING CPL_WARN_DEPRECATED("Casting to this is useless")
1039#else
1040#define CAST_TO_THIS_WARNING
1041#endif
1042
1043#define OGR_ALLOW_CAST_TO_THIS(name) \
1044 inline OGR##name *to##name() CAST_TO_THIS_WARNING \
1045 { \
1046 return this; \
1047 } \
1048 inline const OGR##name *to##name() const CAST_TO_THIS_WARNING \
1049 { \
1050 return this; \
1051 }
1052
1053#define OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
1054 OGR_FORBID_DOWNCAST_TO_CURVE \
1055 OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE \
1056 OGR_FORBID_DOWNCAST_TO_LINESTRING \
1057 OGR_FORBID_DOWNCAST_TO_LINEARRING \
1058 OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING \
1059 OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE
1060
1061#define OGR_FORBID_DOWNCAST_TO_ALL_SURFACES \
1062 OGR_FORBID_DOWNCAST_TO_SURFACE \
1063 OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON \
1064 OGR_FORBID_DOWNCAST_TO_POLYGON \
1065 OGR_FORBID_DOWNCAST_TO_TRIANGLE \
1066 OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE \
1067 OGR_FORBID_DOWNCAST_TO_TIN
1068
1069#define OGR_FORBID_DOWNCAST_TO_ALL_SINGLES \
1070 OGR_FORBID_DOWNCAST_TO_POINT \
1071 OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
1072 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1073
1074#define OGR_FORBID_DOWNCAST_TO_ALL_MULTI \
1075 OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION \
1076 OGR_FORBID_DOWNCAST_TO_MULTIPOINT \
1077 OGR_FORBID_DOWNCAST_TO_MULTICURVE \
1078 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING \
1079 OGR_FORBID_DOWNCAST_TO_MULTISURFACE \
1080 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
1081
1083
1084/************************************************************************/
1085/* OGRPoint */
1086/************************************************************************/
1087
1093
1094class CPL_DLL OGRPoint : public OGRGeometry
1095{
1096 double x;
1097 double y;
1098 double z;
1099 double m;
1100
1101 public:
1102 OGRPoint();
1103 OGRPoint(double x, double y);
1104 OGRPoint(double x, double y, double z);
1105 OGRPoint(double x, double y, double z, double m);
1106 OGRPoint(const OGRPoint &other);
1108 OGRPoint(OGRPoint &&other) = default;
1109 static OGRPoint *createXYM(double x, double y, double m);
1110
1111 OGRPoint &operator=(const OGRPoint &other);
1113 OGRPoint &operator=(OGRPoint &&other) = default;
1114
1115 // IWks Interface
1116 size_t WkbSize() const override;
1117 OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1118 size_t &nBytesConsumedOut) override;
1119 OGRErr exportToWkb(unsigned char *,
1120 const OGRwkbExportOptions * = nullptr) const override;
1121
1122#ifndef DOXYGEN_XML
1124#endif
1125
1126 OGRErr importFromWkt(const char **) override;
1127
1128#ifndef DOXYGEN_XML
1130#endif
1131
1136 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1137 OGRErr *err = nullptr) const override;
1138
1139 // IGeometry
1140 int getDimension() const override;
1141 OGRPoint *clone() const override;
1142 void empty() override;
1143 void getEnvelope(OGREnvelope *psEnvelope) const override;
1144 void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1145
1146 OGRBoolean IsEmpty() const override
1147 {
1148 return !(flags & OGR_G_NOT_EMPTY_POINT);
1149 }
1150
1151 // IPoint
1153 double getX() const
1154 {
1155 return x;
1156 }
1157
1159 double getY() const
1160 {
1161 return y;
1162 }
1163
1165 double getZ() const
1166 {
1167 return z;
1168 }
1169
1171 double getM() const
1172 {
1173 return m;
1174 }
1175
1176 // Non standard
1177 bool setCoordinateDimension(int nDimension) override;
1178
1182 void setX(double xIn)
1183 {
1184 x = xIn;
1185 if (std::isnan(x) || std::isnan(y))
1186 flags &= ~OGR_G_NOT_EMPTY_POINT;
1187 else
1188 flags |= OGR_G_NOT_EMPTY_POINT;
1189 }
1190
1194 void setY(double yIn)
1195 {
1196 y = yIn;
1197 if (std::isnan(x) || std::isnan(y))
1198 flags &= ~OGR_G_NOT_EMPTY_POINT;
1199 else
1200 flags |= OGR_G_NOT_EMPTY_POINT;
1201 }
1202
1206 void setZ(double zIn)
1207 {
1208 z = zIn;
1209 flags |= OGR_G_3D;
1210 }
1211
1215 void setM(double mIn)
1216 {
1217 m = mIn;
1218 flags |= OGR_G_MEASURED;
1219 }
1220
1221 // ISpatialRelation
1222 OGRBoolean Equals(const OGRGeometry *) const override;
1223 OGRBoolean Intersects(const OGRGeometry *) const override;
1224 OGRBoolean Within(const OGRGeometry *) const override;
1225
1226 // Non standard from OGRGeometry
1227 const char *getGeometryName() const override;
1228 OGRwkbGeometryType getGeometryType() const override;
1229 OGRErr transform(OGRCoordinateTransformation *poCT) override;
1230 void flattenTo2D() override;
1231
1232 void accept(IOGRGeometryVisitor *visitor) override
1233 {
1234 visitor->visit(this);
1235 }
1236
1237 void accept(IOGRConstGeometryVisitor *visitor) const override
1238 {
1239 visitor->visit(this);
1240 }
1241
1242 void swapXY() override;
1243
1244 OGR_ALLOW_CAST_TO_THIS(Point)
1245 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
1246 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1247 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1248};
1249
1250/************************************************************************/
1251/* OGRPointIterator */
1252/************************************************************************/
1253
1258
1259class CPL_DLL OGRPointIterator
1260{
1261 public:
1262 virtual ~OGRPointIterator();
1264
1265 static void destroy(OGRPointIterator *);
1266};
1267
1268/************************************************************************/
1269/* OGRCurve */
1270/************************************************************************/
1271
1276
1277class CPL_DLL OGRCurve : public OGRGeometry
1278{
1279 protected:
1281 OGRCurve() = default;
1282 OGRCurve(const OGRCurve &other) = default;
1283 OGRCurve(OGRCurve &&other) = default;
1284
1285 virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
1286 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
1287
1288 friend class OGRCurvePolygon;
1289 friend class OGRCompoundCurve;
1291 virtual int ContainsPoint(const OGRPoint *p) const;
1292 virtual int IntersectsPoint(const OGRPoint *p) const;
1293 virtual double get_AreaOfCurveSegments() const = 0;
1294
1295 private:
1296 class CPL_DLL ConstIterator
1297 {
1298 struct Private;
1299 std::unique_ptr<Private> m_poPrivate;
1300
1301 public:
1302 ConstIterator(const OGRCurve *poSelf, bool bStart);
1303 ConstIterator(ConstIterator &&oOther) noexcept;
1304 ConstIterator &operator=(ConstIterator &&oOther);
1305 ~ConstIterator();
1306 const OGRPoint &operator*() const;
1307 ConstIterator &operator++();
1308 bool operator!=(const ConstIterator &it) const;
1309 };
1310
1311 friend inline ConstIterator begin(const OGRCurve *);
1312 friend inline ConstIterator end(const OGRCurve *);
1313
1314 public:
1316 OGRCurve &operator=(const OGRCurve &other);
1317 OGRCurve &operator=(OGRCurve &&other) = default;
1319
1322
1330 ConstIterator begin() const;
1332 ConstIterator end() const;
1333
1334 // IGeometry
1335 OGRCurve *clone() const override = 0;
1336
1337 // ICurve methods
1338 virtual double get_Length() const = 0;
1339 virtual void StartPoint(OGRPoint *) const = 0;
1340 virtual void EndPoint(OGRPoint *) const = 0;
1341 virtual int get_IsClosed() const;
1342 virtual void Value(double, OGRPoint *) const = 0;
1343 virtual OGRLineString *
1344 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
1345 const char *const *papszOptions = nullptr) const = 0;
1346 int getDimension() const override;
1347
1348 // non standard
1349 virtual int getNumPoints() const = 0;
1351 virtual OGRBoolean IsConvex() const;
1352 virtual double get_Area() const = 0;
1353 virtual double get_GeodesicArea(
1354 const OGRSpatialReference *poSRSOverride = nullptr) const = 0;
1355 virtual double get_GeodesicLength(
1356 const OGRSpatialReference *poSRSOverride = nullptr) const = 0;
1357 virtual int isClockwise() const;
1358 virtual void reversePoints() = 0;
1359
1364 {
1366 }
1367
1371 inline const OGRSimpleCurve *toSimpleCurve() const
1372 {
1374 }
1375
1376 static OGRCompoundCurve *CastToCompoundCurve(OGRCurve *puCurve);
1377 static OGRLineString *CastToLineString(OGRCurve *poCurve);
1378 static OGRLinearRing *CastToLinearRing(OGRCurve *poCurve);
1379
1380 OGR_FORBID_DOWNCAST_TO_POINT
1381 OGR_ALLOW_CAST_TO_THIS(Curve)
1382 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1383 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1384};
1385
1387
1388inline OGRCurve::ConstIterator begin(const OGRCurve *poCurve)
1389{
1390 return poCurve->begin();
1391}
1392
1394inline OGRCurve::ConstIterator end(const OGRCurve *poCurve)
1395{
1396 return poCurve->end();
1397}
1398
1400
1401/************************************************************************/
1402/* OGRIteratedPoint */
1403/************************************************************************/
1404
1426class CPL_DLL OGRIteratedPoint : public OGRPoint
1427{
1428 private:
1429 friend class OGRSimpleCurve;
1430
1431 OGRSimpleCurve *m_poCurve = nullptr;
1432 int m_nPos = 0;
1433
1434 OGRIteratedPoint() = default;
1435
1436 CPL_DISALLOW_COPY_ASSIGN(OGRIteratedPoint)
1437
1438 public:
1442 void setX(double xIn);
1446 void setY(double yIn);
1450 void setZ(double zIn);
1454 void setM(double mIn);
1455
1458};
1459
1460/************************************************************************/
1461/* OGRSimpleCurve */
1462/************************************************************************/
1463
1471
1472class CPL_DLL OGRSimpleCurve : public OGRCurve
1473{
1474 protected:
1476 friend class OGRGeometry;
1477
1478 int nPointCount = 0;
1479 int m_nPointCapacity = 0;
1480 OGRRawPoint *paoPoints = nullptr;
1481 double *padfZ = nullptr;
1482 double *padfM = nullptr;
1483
1484 bool Make3D();
1485 void Make2D();
1486 void RemoveM();
1487 bool AddM();
1488
1489 OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ, int bHasM,
1490 OGRRawPoint *&paoPointsIn, int &nMaxPoints,
1491 double *&padfZIn);
1493
1494 virtual double get_LinearArea() const;
1495
1497 OGRSimpleCurve() = default;
1498
1499 OGRSimpleCurve(const OGRSimpleCurve &other);
1500
1502
1503 private:
1504 class CPL_DLL Iterator
1505 {
1506 struct Private;
1507 std::unique_ptr<Private> m_poPrivate;
1508 void update();
1509
1510 public:
1511 Iterator(OGRSimpleCurve *poSelf, int nPos);
1512 Iterator(Iterator &&oOther) noexcept; // declared but not defined.
1513 // Needed for gcc 5.4 at least
1514 ~Iterator();
1515 OGRIteratedPoint &operator*();
1516 Iterator &operator++();
1517 bool operator!=(const Iterator &it) const;
1518 };
1519
1520 friend inline Iterator begin(OGRSimpleCurve *);
1521 friend inline Iterator end(OGRSimpleCurve *);
1522
1523 class CPL_DLL ConstIterator
1524 {
1525 struct Private;
1526 std::unique_ptr<Private> m_poPrivate;
1527
1528 public:
1529 ConstIterator(const OGRSimpleCurve *poSelf, int nPos);
1530 ConstIterator(
1531 ConstIterator &&oOther) noexcept; // declared but not defined.
1532 // Needed for gcc 5.4 at least
1533 ~ConstIterator();
1534 const OGRPoint &operator*() const;
1535 ConstIterator &operator++();
1536 bool operator!=(const ConstIterator &it) const;
1537 };
1538
1539 friend inline ConstIterator begin(const OGRSimpleCurve *);
1540 friend inline ConstIterator end(const OGRSimpleCurve *);
1541
1542 public:
1543 ~OGRSimpleCurve() override;
1544
1545 OGRSimpleCurve &operator=(const OGRSimpleCurve &other);
1546
1547 OGRSimpleCurve &operator=(OGRSimpleCurve &&other);
1548
1551
1559 Iterator begin();
1561 Iterator end();
1569 ConstIterator begin() const;
1571 ConstIterator end() const;
1572
1573 // IWks Interface.
1574 size_t WkbSize() const override;
1575 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1576 size_t &nBytesConsumedOut) override;
1577 virtual OGRErr
1578 exportToWkb(unsigned char *,
1579 const OGRwkbExportOptions * = nullptr) const override;
1580
1581#ifndef DOXYGEN_XML
1583#endif
1584
1585 OGRErr importFromWkt(const char **) override;
1586
1587#ifndef DOXYGEN_XML
1589#endif
1590
1595 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1596 OGRErr *err = nullptr) const override;
1597
1598 // IGeometry interface.
1599 void empty() override;
1600 void getEnvelope(OGREnvelope *psEnvelope) const override;
1601 void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1602 OGRBoolean IsEmpty() const override;
1603 OGRSimpleCurve *clone() const override = 0;
1604
1605 // ICurve methods.
1606 double get_Length() const override;
1607 void StartPoint(OGRPoint *) const override;
1608 void EndPoint(OGRPoint *) const override;
1609 void Value(double, OGRPoint *) const override;
1610 virtual double Project(const OGRPoint *) const;
1611 virtual OGRLineString *getSubLine(double, double, int) const;
1612
1613 // ILineString methods.
1614 int getNumPoints() const override
1615 {
1616 return nPointCount;
1617 }
1618
1619 void getPoint(int, OGRPoint *) const;
1620
1621 double getX(int i) const
1622 {
1623 return paoPoints[i].x;
1624 }
1625
1626 double getY(int i) const
1627 {
1628 return paoPoints[i].y;
1629 }
1630
1631 double getZ(int i) const;
1632 double getM(int i) const;
1633
1634 // ISpatialRelation
1635 OGRBoolean Equals(const OGRGeometry *) const override;
1636
1637 // non standard.
1638 bool setCoordinateDimension(int nDimension) override;
1639 bool set3D(OGRBoolean bIs3D) override;
1640 bool setMeasured(OGRBoolean bIsMeasured) override;
1641 bool setNumPoints(int nNewPointCount, int bZeroizeNewContent = TRUE);
1642 bool setPoint(int, OGRPoint *);
1643 bool setPoint(int, double, double);
1644 bool setZ(int, double);
1645 bool setM(int, double);
1646 bool setPoint(int, double, double, double);
1647 bool setPointM(int, double, double, double);
1648 bool setPoint(int, double, double, double, double);
1649 bool setPoints(int, const OGRRawPoint *, const double * = nullptr);
1650 bool setPointsM(int, const OGRRawPoint *, const double *);
1651 bool setPoints(int, const OGRRawPoint *, const double *, const double *);
1652 bool setPoints(int, const double *padfX, const double *padfY,
1653 const double *padfZIn = nullptr);
1654 bool setPointsM(int, const double *padfX, const double *padfY,
1655 const double *padfMIn = nullptr);
1656 bool setPoints(int, const double *padfX, const double *padfY,
1657 const double *padfZIn, const double *padfMIn);
1658 bool addPoint(const OGRPoint *);
1659 bool addPoint(double, double);
1660 bool addPoint(double, double, double);
1661 bool addPointM(double, double, double);
1662 bool addPoint(double, double, double, double);
1663
1664 bool removePoint(int);
1665
1666 void getPoints(OGRRawPoint *, double * = nullptr) const;
1667 void getPoints(void *pabyX, int nXStride, void *pabyY, int nYStride,
1668 void *pabyZ = nullptr, int nZStride = 0,
1669 void *pabyM = nullptr, int nMStride = 0) const;
1670
1671 void addSubLineString(const OGRLineString *, int nStartVertex = 0,
1672 int nEndVertex = -1);
1673 void reversePoints() override;
1674 OGRPointIterator *getPointIterator() const override;
1675
1676 // non-standard from OGRGeometry
1677 OGRErr transform(OGRCoordinateTransformation *poCT) override;
1678 void flattenTo2D() override;
1679 bool segmentize(double dfMaxLength) override;
1680
1681 void swapXY() override;
1682
1683 OGR_ALLOW_UPCAST_TO(Curve)
1684 OGR_ALLOW_CAST_TO_THIS(SimpleCurve)
1685};
1686
1688
1689inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve *poCurve)
1690{
1691 return poCurve->begin();
1692}
1693
1695inline OGRSimpleCurve::Iterator end(OGRSimpleCurve *poCurve)
1696{
1697 return poCurve->end();
1698}
1699
1701inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve *poCurve)
1702{
1703 return poCurve->begin();
1704}
1705
1707inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve *poCurve)
1708{
1709 return poCurve->end();
1710}
1711
1713
1714/************************************************************************/
1715/* OGRLineString */
1716/************************************************************************/
1717
1724
1725class CPL_DLL OGRLineString : public OGRSimpleCurve
1726{
1727 // cppcheck-suppress unusedPrivateFunction
1728 static OGRLinearRing *CasterToLinearRing(OGRCurve *poCurve);
1729
1730 protected:
1732 static OGRLineString *TransferMembersAndDestroy(OGRLineString *poSrc,
1733 OGRLineString *poDst);
1734
1735 OGRCurveCasterToLineString GetCasterToLineString() const override;
1736 OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1737
1738 double get_AreaOfCurveSegments() const override;
1740
1742
1743 public:
1745 OGRLineString() = default;
1748
1749 OGRLineString &operator=(const OGRLineString &other);
1751
1752 OGRLineString *clone() const override;
1753 virtual OGRLineString *
1754 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
1755 const char *const *papszOptions = nullptr) const override;
1756 virtual OGRGeometry *
1757 getCurveGeometry(const char *const *papszOptions = nullptr) const override;
1758 double get_Area() const override;
1759 virtual double get_GeodesicArea(
1760 const OGRSpatialReference *poSRSOverride = nullptr) const override;
1761 virtual double get_GeodesicLength(
1762 const OGRSpatialReference *poSRSOverride = nullptr) const override;
1763
1764 // Non-standard from OGRGeometry.
1765 OGRwkbGeometryType getGeometryType() const override;
1766 const char *getGeometryName() const override;
1767 int isClockwise() const override;
1768
1771 {
1772 return this;
1773 }
1774
1776 inline const OGRSimpleCurve *toUpperClass() const
1777 {
1778 return this;
1779 }
1780
1781 void accept(IOGRGeometryVisitor *visitor) override
1782 {
1783 visitor->visit(this);
1784 }
1785
1786 void accept(IOGRConstGeometryVisitor *visitor) const override
1787 {
1788 visitor->visit(this);
1789 }
1790
1791 OGR_ALLOW_UPCAST_TO(SimpleCurve)
1792 OGR_ALLOW_CAST_TO_THIS(LineString)
1793};
1794
1795/************************************************************************/
1796/* OGRLinearRing */
1797/************************************************************************/
1798
1818
1819class CPL_DLL OGRLinearRing : public OGRLineString
1820{
1821 static OGRLineString *CasterToLineString(OGRCurve *poCurve);
1822
1823 // IWks Interface - Note this isn't really a first class object
1824 // for the purposes of WKB form. These methods always fail since this
1825 // object can't be serialized on its own.
1826 size_t WkbSize() const override;
1827 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1828 size_t &nBytesConsumedOut) override;
1829 OGRErr exportToWkb(unsigned char *,
1830 const OGRwkbExportOptions * = nullptr) const override;
1831
1832 protected:
1834 friend class OGRPolygon;
1835 friend class OGRTriangle;
1836
1837 // These are not IWks compatible ... just a convenience for OGRPolygon.
1838 virtual size_t _WkbSize(int _flags) const;
1839 virtual OGRErr _importFromWkb(OGRwkbByteOrder, int _flags,
1840 const unsigned char *, size_t,
1841 size_t &nBytesConsumedOut);
1842 virtual OGRErr _exportToWkb(int _flags, unsigned char *,
1843 const OGRwkbExportOptions *) const;
1844
1845 OGRCurveCasterToLineString GetCasterToLineString() const override;
1846 OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1848
1850
1851 public:
1853 OGRLinearRing() = default;
1856 OGRLinearRing(OGRLinearRing &&other) = default;
1857 explicit OGRLinearRing(const OGRLinearRing *);
1858
1859 OGRLinearRing &operator=(const OGRLinearRing &other);
1862
1863 // Non standard.
1864 const char *getGeometryName() const override;
1865 OGRLinearRing *clone() const override;
1866
1868 void reverseWindingOrder()
1869 CPL_WARN_DEPRECATED("Use reversePoints() instead");
1871
1872 void closeRings() override;
1874 int bTestEnvelope = TRUE) const;
1876 int bTestEnvelope = TRUE) const;
1878
1881 {
1882 return this;
1883 }
1884
1886 inline const OGRLineString *toUpperClass() const
1887 {
1888 return this;
1889 }
1890
1891 void accept(IOGRGeometryVisitor *visitor) override
1892 {
1893 visitor->visit(this);
1894 }
1895
1896 void accept(IOGRConstGeometryVisitor *visitor) const override
1897 {
1898 visitor->visit(this);
1899 }
1900
1901 OGR_ALLOW_UPCAST_TO(LineString)
1902 OGR_ALLOW_CAST_TO_THIS(LinearRing)
1903};
1904
1905/************************************************************************/
1906/* OGRCircularString */
1907/************************************************************************/
1908
1919
1920class CPL_DLL OGRCircularString : public OGRSimpleCurve
1921{
1922 private:
1923 void ExtendEnvelopeWithCircular(OGREnvelope *psEnvelope) const;
1924 OGRBoolean IsValidFast() const;
1925 int IsFullCircle(double &cx, double &cy, double &square_R) const;
1926
1927 protected:
1929 OGRCurveCasterToLineString GetCasterToLineString() const override;
1930 OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1931 int IntersectsPoint(const OGRPoint *p) const override;
1932 int ContainsPoint(const OGRPoint *p) const override;
1933 double get_AreaOfCurveSegments() const override;
1935
1936 public:
1939
1943
1947
1948 // IWks Interface.
1949 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1950 size_t &nBytesConsumedOut) override;
1951 OGRErr exportToWkb(unsigned char *,
1952 const OGRwkbExportOptions * = nullptr) const override;
1953
1954#ifndef DOXYGEN_XML
1956#endif
1957
1958 OGRErr importFromWkt(const char **) override;
1959
1960#ifndef DOXYGEN_XML
1962#endif
1963
1968 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1969 OGRErr *err = nullptr) const override;
1970
1971 // IGeometry interface.
1972 OGRBoolean IsValid() const override;
1973 void getEnvelope(OGREnvelope *psEnvelope) const override;
1974 void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1975 OGRCircularString *clone() const override;
1976
1977 // ICurve methods.
1978 double get_Length() const override;
1979 virtual OGRLineString *
1980 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
1981 const char *const *papszOptions = nullptr) const override;
1982 void Value(double, OGRPoint *) const override;
1983 double get_Area() const override;
1984 virtual double get_GeodesicArea(
1985 const OGRSpatialReference *poSRSOverride = nullptr) const override;
1986 virtual double get_GeodesicLength(
1987 const OGRSpatialReference *poSRSOverride = nullptr) const override;
1988
1989 // Non-standard from OGRGeometry.
1990 OGRwkbGeometryType getGeometryType() const override;
1991 const char *getGeometryName() const override;
1992 bool segmentize(double dfMaxLength) override;
1993 virtual OGRBoolean
1994 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
1995 virtual OGRGeometry *
1996 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
1997 const char *const *papszOptions = nullptr) const override;
1998
2001 {
2002 return this;
2003 }
2004
2006 inline const OGRSimpleCurve *toUpperClass() const
2007 {
2008 return this;
2009 }
2010
2011 void accept(IOGRGeometryVisitor *visitor) override
2012 {
2013 visitor->visit(this);
2014 }
2015
2016 void accept(IOGRConstGeometryVisitor *visitor) const override
2017 {
2018 visitor->visit(this);
2019 }
2020
2021 OGR_ALLOW_UPCAST_TO(SimpleCurve)
2022 OGR_ALLOW_CAST_TO_THIS(CircularString)
2023};
2024
2025/************************************************************************/
2026/* OGRCurveCollection */
2027/************************************************************************/
2028
2037
2039class CPL_DLL OGRCurveCollection
2040{
2041 protected:
2042 friend class OGRCompoundCurve;
2043 friend class OGRCurvePolygon;
2044 friend class OGRPolygon;
2045 friend class OGRTriangle;
2046
2047 int nCurveCount = 0;
2048 OGRCurve **papoCurves = nullptr;
2049
2050 public:
2051 OGRCurveCollection() = default;
2052 OGRCurveCollection(const OGRCurveCollection &other);
2053 OGRCurveCollection(OGRCurveCollection &&other);
2054 ~OGRCurveCollection();
2055
2056 OGRCurveCollection &operator=(const OGRCurveCollection &other);
2057 OGRCurveCollection &operator=(OGRCurveCollection &&other);
2058
2060 typedef OGRCurve ChildType;
2061
2064 OGRCurve **begin()
2065 {
2066 return papoCurves;
2067 }
2068
2070 OGRCurve **end()
2071 {
2072 return papoCurves + nCurveCount;
2073 }
2074
2077 const OGRCurve *const *begin() const
2078 {
2079 return papoCurves;
2080 }
2081
2083 const OGRCurve *const *end() const
2084 {
2085 return papoCurves + nCurveCount;
2086 }
2087
2088 void empty(OGRGeometry *poGeom);
2089 OGRBoolean IsEmpty() const;
2090 void getEnvelope(OGREnvelope *psEnvelope) const;
2091 void getEnvelope(OGREnvelope3D *psEnvelope) const;
2092
2093 OGRErr addCurveDirectly(OGRGeometry *poGeom, OGRCurve *poCurve,
2094 int bNeedRealloc);
2095 size_t WkbSize() const;
2096 OGRErr importPreambleFromWkb(OGRGeometry *poGeom,
2097 const unsigned char *pabyData, size_t &nSize,
2098 size_t &nDataOffset,
2099 OGRwkbByteOrder &eByteOrder,
2100 size_t nMinSubGeomSize,
2101 OGRwkbVariant eWkbVariant);
2102 OGRErr
2103 importBodyFromWkb(OGRGeometry *poGeom, const unsigned char *pabyData,
2104 size_t nSize, bool bAcceptCompoundCurve,
2105 OGRErr (*pfnAddCurveDirectlyFromWkb)(OGRGeometry *poGeom,
2106 OGRCurve *poCurve),
2107 OGRwkbVariant eWkbVariant, size_t &nBytesConsumedOut);
2108 std::string exportToWkt(const OGRGeometry *geom, const OGRWktOptions &opts,
2109 OGRErr *err) const;
2110 OGRErr exportToWkb(const OGRGeometry *poGeom, unsigned char *,
2111 const OGRwkbExportOptions * = nullptr) const;
2112 OGRBoolean Equals(const OGRCurveCollection *poOCC) const;
2113 bool setCoordinateDimension(OGRGeometry *poGeom, int nNewDimension);
2114 bool set3D(OGRGeometry *poGeom, OGRBoolean bIs3D);
2115 bool setMeasured(OGRGeometry *poGeom, OGRBoolean bIsMeasured);
2116 void assignSpatialReference(OGRGeometry *poGeom,
2117 const OGRSpatialReference *poSR);
2118 int getNumCurves() const;
2119 OGRCurve *getCurve(int);
2120 const OGRCurve *getCurve(int) const;
2121 OGRCurve *stealCurve(int);
2122
2123 OGRErr removeCurve(int iIndex, bool bDelete = true);
2124
2125 bool hasEmptyParts() const;
2126 void removeEmptyParts();
2127
2128 void reversePoints();
2129
2130 OGRErr transform(OGRGeometry *poGeom, OGRCoordinateTransformation *poCT);
2131 void flattenTo2D(OGRGeometry *poGeom);
2132 bool segmentize(double dfMaxLength);
2133 void swapXY();
2134 OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
2135};
2136
2138
2139/************************************************************************/
2140/* OGRCompoundCurve */
2141/************************************************************************/
2142
2151
2152class CPL_DLL OGRCompoundCurve : public OGRCurve
2153{
2154 private:
2155 OGRCurveCollection oCC{};
2156
2157 OGRErr addCurveDirectlyInternal(OGRCurve *poCurve, double dfToleranceEps,
2158 int bNeedRealloc);
2159 static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
2160 OGRCurve *poCurve);
2161 static OGRErr addCurveDirectlyFromWkb(OGRGeometry *poSelf,
2162 OGRCurve *poCurve);
2163 OGRLineString *CurveToLineInternal(double dfMaxAngleStepSizeDegrees,
2164 const char *const *papszOptions,
2165 int bIsLinearRing) const;
2166 // cppcheck-suppress unusedPrivateFunction
2167 static OGRLineString *CasterToLineString(OGRCurve *poCurve);
2168 // cppcheck-suppress unusedPrivateFunction
2169 static OGRLinearRing *CasterToLinearRing(OGRCurve *poCurve);
2170
2171 protected:
2175
2176 OGRCurveCasterToLineString GetCasterToLineString() const override;
2177 OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
2179
2180 public:
2182 OGRCompoundCurve() = default;
2183
2187
2191
2194
2198 {
2199 return oCC.begin();
2200 }
2201
2204 {
2205 return oCC.end();
2206 }
2207
2210 const ChildType *const *begin() const
2211 {
2212 return oCC.begin();
2213 }
2214
2216 const ChildType *const *end() const
2217 {
2218 return oCC.end();
2219 }
2220
2221 // IWks Interface
2222 size_t WkbSize() const override;
2223 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2224 size_t &nBytesConsumedOut) override;
2225 OGRErr exportToWkb(unsigned char *,
2226 const OGRwkbExportOptions * = nullptr) const override;
2227
2228#ifndef DOXYGEN_XML
2230#endif
2231
2232 OGRErr importFromWkt(const char **) override;
2233
2234#ifndef DOXYGEN_XML
2236#endif
2237
2242 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2243 OGRErr *err = nullptr) const override;
2244
2245 // IGeometry interface.
2246 OGRCompoundCurve *clone() const override;
2247 void empty() override;
2248 void getEnvelope(OGREnvelope *psEnvelope) const override;
2249 void getEnvelope(OGREnvelope3D *psEnvelope) const override;
2250 OGRBoolean IsEmpty() const override;
2251
2252 // ICurve methods.
2253 double get_Length() const override;
2254 void StartPoint(OGRPoint *) const override;
2255 void EndPoint(OGRPoint *) const override;
2256 void Value(double, OGRPoint *) const override;
2257 virtual OGRLineString *
2258 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
2259 const char *const *papszOptions = nullptr) const override;
2260
2261 int getNumPoints() const override;
2262 double get_AreaOfCurveSegments() const override;
2263 double get_Area() const override;
2264 virtual double get_GeodesicArea(
2265 const OGRSpatialReference *poSRSOverride = nullptr) const override;
2266 virtual double get_GeodesicLength(
2267 const OGRSpatialReference *poSRSOverride = nullptr) const override;
2268
2269 // ISpatialRelation.
2270 OGRBoolean Equals(const OGRGeometry *) const override;
2271
2272 // ICompoundCurve method.
2273 int getNumCurves() const;
2274 OGRCurve *getCurve(int);
2275 const OGRCurve *getCurve(int) const;
2276
2277 // Non-standard.
2278 bool setCoordinateDimension(int nDimension) override;
2279 bool set3D(OGRBoolean bIs3D) override;
2280 bool setMeasured(OGRBoolean bIsMeasured) override;
2281
2282 virtual void
2283 assignSpatialReference(const OGRSpatialReference *poSR) override;
2284
2288 static constexpr double DEFAULT_TOLERANCE_EPSILON = 1e-14;
2289
2290 OGRErr addCurve(const OGRCurve *,
2291 double dfToleranceEps = DEFAULT_TOLERANCE_EPSILON);
2293 double dfToleranceEps = DEFAULT_TOLERANCE_EPSILON);
2294 OGRErr addCurve(std::unique_ptr<OGRCurve>,
2295 double dfToleranceEps = DEFAULT_TOLERANCE_EPSILON);
2296 OGRCurve *stealCurve(int);
2297 OGRPointIterator *getPointIterator() const override;
2298 void reversePoints() override;
2299
2300 // Non-standard from OGRGeometry.
2301 OGRwkbGeometryType getGeometryType() const override;
2302 const char *getGeometryName() const override;
2304 void flattenTo2D() override;
2305 bool segmentize(double dfMaxLength) override;
2306 virtual OGRBoolean
2307 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2308 virtual OGRGeometry *
2309 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2310 const char *const *papszOptions = nullptr) const override;
2311
2312 void accept(IOGRGeometryVisitor *visitor) override
2313 {
2314 visitor->visit(this);
2315 }
2316
2317 void accept(IOGRConstGeometryVisitor *visitor) const override
2318 {
2319 visitor->visit(this);
2320 }
2321
2322 void swapXY() override;
2323
2324 bool hasEmptyParts() const override;
2325 void removeEmptyParts() override;
2326
2327 OGR_ALLOW_UPCAST_TO(Curve)
2328 OGR_ALLOW_CAST_TO_THIS(CompoundCurve)
2329};
2330
2332
2333inline const OGRCompoundCurve::ChildType *const *
2334begin(const OGRCompoundCurve *poCurve)
2335{
2336 return poCurve->begin();
2337}
2338
2340inline const OGRCompoundCurve::ChildType *const *
2341end(const OGRCompoundCurve *poCurve)
2342{
2343 return poCurve->end();
2344}
2345
2348{
2349 return poCurve->begin();
2350}
2351
2354{
2355 return poCurve->end();
2356}
2357
2359
2360/************************************************************************/
2361/* OGRSurface */
2362/************************************************************************/
2363
2368
2369class CPL_DLL OGRSurface : public OGRGeometry
2370{
2371 protected:
2373 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
2374 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
2376
2377 public:
2378 virtual double get_Area() const = 0;
2379 virtual double get_GeodesicArea(
2380 const OGRSpatialReference *poSRSOverride = nullptr) const = 0;
2381 virtual double get_Length() const = 0;
2382 virtual double get_GeodesicLength(
2383 const OGRSpatialReference *poSRSOverride = nullptr) const = 0;
2384
2385 virtual OGRErr PointOnSurface(OGRPoint *poPoint) const;
2386
2387 OGRSurface *clone() const override = 0;
2388
2390 static OGRPolygon *CastToPolygon(OGRSurface *poSurface);
2391 static OGRCurvePolygon *CastToCurvePolygon(OGRSurface *poSurface);
2393
2394 OGR_FORBID_DOWNCAST_TO_POINT
2395 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
2396 OGR_ALLOW_CAST_TO_THIS(Surface)
2397 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
2398};
2399
2400/************************************************************************/
2401/* OGRCurvePolygon */
2402/************************************************************************/
2403
2415
2416class CPL_DLL OGRCurvePolygon : public OGRSurface
2417{
2418 static OGRPolygon *CasterToPolygon(OGRSurface *poSurface);
2419
2420 private:
2421 OGRBoolean IntersectsPoint(const OGRPoint *p) const;
2422 OGRBoolean ContainsPoint(const OGRPoint *p) const;
2423
2424 virtual bool isRingCorrectType(const OGRCurve *poRing) const;
2425
2426 virtual bool checkRing(const OGRCurve *poNewRing) const;
2427 OGRErr addRingDirectlyInternal(OGRCurve *poCurve, int bNeedRealloc);
2428 static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
2429 OGRCurve *poCurve);
2430 static OGRErr addCurveDirectlyFromWkb(OGRGeometry *poSelf,
2431 OGRCurve *poCurve);
2432
2433 protected:
2435 friend class OGRPolygon;
2436 friend class OGRTriangle;
2437 OGRCurveCollection oCC{};
2438
2439 OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2440 virtual OGRSurfaceCasterToCurvePolygon
2441 GetCasterToCurvePolygon() const override;
2442
2444
2446
2447 public:
2449 OGRCurvePolygon() = default;
2450
2454
2458
2461
2465 {
2466 return oCC.begin();
2467 }
2468
2471 {
2472 return oCC.end();
2473 }
2474
2477 const ChildType *const *begin() const
2478 {
2479 return oCC.begin();
2480 }
2481
2483 const ChildType *const *end() const
2484 {
2485 return oCC.end();
2486 }
2487
2488 // Non standard (OGRGeometry).
2489 const char *getGeometryName() const override;
2490 OGRwkbGeometryType getGeometryType() const override;
2491 OGRCurvePolygon *clone() const override;
2492 void empty() override;
2493 OGRErr transform(OGRCoordinateTransformation *poCT) override;
2494 void flattenTo2D() override;
2495 OGRBoolean IsEmpty() const override;
2496 bool segmentize(double dfMaxLength) override;
2497 virtual OGRBoolean
2498 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2499 virtual OGRGeometry *
2500 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2501 const char *const *papszOptions = nullptr) const override;
2502 virtual double get_GeodesicArea(
2503 const OGRSpatialReference *poSRSOverride = nullptr) const override;
2504 virtual double get_GeodesicLength(
2505 const OGRSpatialReference *poSRSOverride = nullptr) const override;
2506
2507 // ISurface Interface
2508 double get_Area() const override;
2509
2510 double get_Length() const override;
2511
2512 // IWks Interface
2513 size_t WkbSize() const override;
2514 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2515 size_t &nBytesConsumedOut) override;
2516 OGRErr exportToWkb(unsigned char *,
2517 const OGRwkbExportOptions * = nullptr) const override;
2518
2519#ifndef DOXYGEN_XML
2521#endif
2522
2523 OGRErr importFromWkt(const char **) override;
2524
2525#ifndef DOXYGEN_XML
2527#endif
2528
2533 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2534 OGRErr *err = nullptr) const override;
2535
2536 // IGeometry
2537 int getDimension() const override;
2538 void getEnvelope(OGREnvelope *psEnvelope) const override;
2539 void getEnvelope(OGREnvelope3D *psEnvelope) const override;
2540
2541 // ICurvePolygon
2542 virtual OGRPolygon *
2543 CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
2544 const char *const *papszOptions = nullptr) const;
2545
2546 // ISpatialRelation
2547 OGRBoolean Equals(const OGRGeometry *) const override;
2548 OGRBoolean Intersects(const OGRGeometry *) const override;
2549 OGRBoolean Contains(const OGRGeometry *) const override;
2550
2551 // Non standard
2552 bool setCoordinateDimension(int nDimension) override;
2553 bool set3D(OGRBoolean bIs3D) override;
2554 bool setMeasured(OGRBoolean bIsMeasured) override;
2555
2556 virtual void
2557 assignSpatialReference(const OGRSpatialReference *poSR) override;
2558
2559 virtual OGRErr addRing(const OGRCurve *);
2560 virtual OGRErr addRingDirectly(OGRCurve *);
2561 OGRErr addRing(std::unique_ptr<OGRCurve>);
2562
2563 OGRCurve *getExteriorRingCurve();
2564 const OGRCurve *getExteriorRingCurve() const;
2565 int getNumInteriorRings() const;
2566 OGRCurve *getInteriorRingCurve(int);
2567 const OGRCurve *getInteriorRingCurve(int) const;
2568
2569 OGRCurve *stealExteriorRingCurve();
2570
2571 OGRErr removeRing(int iIndex, bool bDelete = true);
2572
2573 void accept(IOGRGeometryVisitor *visitor) override
2574 {
2575 visitor->visit(this);
2576 }
2577
2578 void accept(IOGRConstGeometryVisitor *visitor) const override
2579 {
2580 visitor->visit(this);
2581 }
2582
2583 void swapXY() override;
2584
2585 bool hasEmptyParts() const override;
2586 void removeEmptyParts() override;
2587
2588 OGR_ALLOW_UPCAST_TO(Surface)
2589 OGR_ALLOW_CAST_TO_THIS(CurvePolygon)
2590};
2591
2593
2594inline const OGRCurvePolygon::ChildType *const *
2595begin(const OGRCurvePolygon *poGeom)
2596{
2597 return poGeom->begin();
2598}
2599
2601inline const OGRCurvePolygon::ChildType *const *
2602end(const OGRCurvePolygon *poGeom)
2603{
2604 return poGeom->end();
2605}
2606
2609{
2610 return poGeom->begin();
2611}
2612
2615{
2616 return poGeom->end();
2617}
2618
2620
2621/************************************************************************/
2622/* OGRPolygon */
2623/************************************************************************/
2624
2633
2634class CPL_DLL OGRPolygon : public OGRCurvePolygon
2635{
2636 static OGRCurvePolygon *CasterToCurvePolygon(OGRSurface *poSurface);
2637
2638 protected:
2640 friend class OGRMultiSurface;
2641 friend class OGRPolyhedralSurface;
2642 friend class OGRTriangulatedSurface;
2643
2644 bool isRingCorrectType(const OGRCurve *poRing) const override;
2645
2646 bool checkRing(const OGRCurve *poNewRing) const override;
2647 virtual OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ,
2648 int bHasM, OGRRawPoint *&paoPoints,
2649 int &nMaxPoints, double *&padfZ);
2650
2651 static OGRCurvePolygon *CastToCurvePolygon(OGRPolygon *poPoly);
2652
2653 OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2654 virtual OGRSurfaceCasterToCurvePolygon
2655 GetCasterToCurvePolygon() const override;
2657
2658 public:
2660 OGRPolygon() = default;
2661
2662 OGRPolygon(double x1, double y1, double x2, double y2);
2663
2664 explicit OGRPolygon(const OGREnvelope &envelope);
2665
2666 OGRPolygon(const OGRPolygon &other);
2668 OGRPolygon(OGRPolygon &&other) = default;
2669
2670 OGRPolygon &operator=(const OGRPolygon &other);
2672 OGRPolygon &operator=(OGRPolygon &&other) = default;
2673
2676
2680 {
2681 return reinterpret_cast<ChildType **>(oCC.begin());
2682 }
2683
2686 {
2687 return reinterpret_cast<ChildType **>(oCC.end());
2688 }
2689
2692 const ChildType *const *begin() const
2693 {
2694 return reinterpret_cast<const ChildType *const *>(oCC.begin());
2695 }
2696
2698 const ChildType *const *end() const
2699 {
2700 return reinterpret_cast<const ChildType *const *>(oCC.end());
2701 }
2702
2703 // Non-standard (OGRGeometry).
2704 const char *getGeometryName() const override;
2705 OGRwkbGeometryType getGeometryType() const override;
2706 OGRPolygon *clone() const override;
2707 virtual OGRBoolean
2708 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2709 virtual OGRGeometry *
2710 getCurveGeometry(const char *const *papszOptions = nullptr) const override;
2711 virtual OGRGeometry *
2712 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2713 const char *const *papszOptions = nullptr) const override;
2714
2715 // IWks Interface.
2716 size_t WkbSize() const override;
2717 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2718 size_t &nBytesConsumedOut) override;
2719 OGRErr exportToWkb(unsigned char *,
2720 const OGRwkbExportOptions * = nullptr) const override;
2721
2722#ifndef DOXYGEN_XML
2724#endif
2725
2726 OGRErr importFromWkt(const char **) override;
2727
2728#ifndef DOXYGEN_XML
2730#endif
2731
2736 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2737 OGRErr *err = nullptr) const override;
2738
2739 // ICurvePolygon.
2740 virtual OGRPolygon *
2741 CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
2742 const char *const *papszOptions = nullptr) const override;
2743
2744 OGRLinearRing *getExteriorRing();
2745 const OGRLinearRing *getExteriorRing() const;
2746 virtual OGRLinearRing *getInteriorRing(int);
2747 virtual const OGRLinearRing *getInteriorRing(int) const;
2748
2749 OGRLinearRing *stealExteriorRing();
2750 virtual OGRLinearRing *stealInteriorRing(int);
2751
2752 OGRBoolean IsPointOnSurface(const OGRPoint *) const;
2753
2756 {
2757 return this;
2758 }
2759
2761 inline const OGRCurvePolygon *toUpperClass() const
2762 {
2763 return this;
2764 }
2765
2766 void accept(IOGRGeometryVisitor *visitor) override
2767 {
2768 visitor->visit(this);
2769 }
2770
2771 void accept(IOGRConstGeometryVisitor *visitor) const override
2772 {
2773 visitor->visit(this);
2774 }
2775
2776 void closeRings() override;
2777
2778 OGR_ALLOW_UPCAST_TO(CurvePolygon)
2779 OGR_ALLOW_CAST_TO_THIS(Polygon)
2780};
2781
2783
2784inline const OGRPolygon::ChildType *const *begin(const OGRPolygon *poGeom)
2785{
2786 return poGeom->begin();
2787}
2788
2790inline const OGRPolygon::ChildType *const *end(const OGRPolygon *poGeom)
2791{
2792 return poGeom->end();
2793}
2794
2796inline OGRPolygon::ChildType **begin(OGRPolygon *poGeom)
2797{
2798 return poGeom->begin();
2799}
2800
2802inline OGRPolygon::ChildType **end(OGRPolygon *poGeom)
2803{
2804 return poGeom->end();
2805}
2806
2808
2809/************************************************************************/
2810/* OGRTriangle */
2811/************************************************************************/
2812
2817
2818class CPL_DLL OGRTriangle : public OGRPolygon
2819{
2820 private:
2821 // cppcheck-suppress unusedPrivateFunction
2822 static OGRPolygon *CasterToPolygon(OGRSurface *poSurface);
2823 bool quickValidityCheck() const;
2824
2825 protected:
2827 OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2828 virtual OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ,
2829 int bHasM, OGRRawPoint *&paoPoints,
2830 int &nMaxPoints,
2831 double *&padfZ) override;
2833
2834 public:
2836 OGRTriangle() = default;
2837 OGRTriangle(const OGRPoint &p, const OGRPoint &q, const OGRPoint &r);
2840 OGRTriangle(OGRTriangle &&other) = default;
2841 OGRTriangle(const OGRPolygon &other, OGRErr &eErr);
2842 OGRTriangle &operator=(const OGRTriangle &other);
2844 OGRTriangle &operator=(OGRTriangle &&other) = default;
2845
2846 const char *getGeometryName() const override;
2847 OGRwkbGeometryType getGeometryType() const override;
2848 OGRTriangle *clone() const override;
2849
2850 // IWks Interface.
2851 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2852 size_t &nBytesConsumedOut) override;
2853
2854 // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
2855 OGRErr addRingDirectly(OGRCurve *poNewRing) override;
2856
2859 {
2860 return this;
2861 }
2862
2864 inline const OGRPolygon *toUpperClass() const
2865 {
2866 return this;
2867 }
2868
2869 void accept(IOGRGeometryVisitor *visitor) override
2870 {
2871 visitor->visit(this);
2872 }
2873
2874 void accept(IOGRConstGeometryVisitor *visitor) const override
2875 {
2876 visitor->visit(this);
2877 }
2878
2880 static OGRGeometry *CastToPolygon(OGRGeometry *poGeom);
2882
2883 OGR_ALLOW_UPCAST_TO(Polygon)
2884 OGR_ALLOW_CAST_TO_THIS(Triangle)
2885};
2886
2887/************************************************************************/
2888/* OGRGeometryCollection */
2889/************************************************************************/
2890
2897
2898class CPL_DLL OGRGeometryCollection : public OGRGeometry
2899{
2900 OGRErr importFromWktInternal(const char **ppszInput, int nRecLevel);
2901
2902 protected:
2904 int nGeomCount = 0;
2905 OGRGeometry **papoGeoms = nullptr;
2906
2907 std::string
2908 exportToWktInternal(const OGRWktOptions &opts, OGRErr *err,
2909 const std::string &exclude = std::string()) const;
2910 static OGRGeometryCollection *
2911 TransferMembersAndDestroy(OGRGeometryCollection *poSrc,
2912 OGRGeometryCollection *poDst);
2913
2914 OGRErr importFromWkbInternal(const unsigned char *pabyData, size_t nSize,
2915 int nRecLevel, OGRwkbVariant,
2916 size_t &nBytesConsumedOut);
2919
2920 public:
2923
2926 ~OGRGeometryCollection() override;
2927
2930
2932 typedef OGRGeometry ChildType;
2933
2937 {
2938 return papoGeoms;
2939 }
2940
2943 {
2944 return papoGeoms + nGeomCount;
2945 }
2946
2949 const ChildType *const *begin() const
2950 {
2951 return papoGeoms;
2952 }
2953
2955 const ChildType *const *end() const
2956 {
2957 return papoGeoms + nGeomCount;
2958 }
2959
2960 // Non standard (OGRGeometry).
2961 const char *getGeometryName() const override;
2962 OGRwkbGeometryType getGeometryType() const override;
2963 OGRGeometryCollection *clone() const override;
2964 void empty() override;
2965 OGRErr transform(OGRCoordinateTransformation *poCT) override;
2966 void flattenTo2D() override;
2967 OGRBoolean IsEmpty() const override;
2968 bool segmentize(double dfMaxLength) override;
2969 virtual OGRBoolean
2970 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2971 virtual OGRGeometry *
2972 getCurveGeometry(const char *const *papszOptions = nullptr) const override;
2973 virtual OGRGeometry *
2974 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2975 const char *const *papszOptions = nullptr) const override;
2976 virtual double
2977 get_GeodesicArea(const OGRSpatialReference *poSRSOverride = nullptr) const;
2978 virtual double get_GeodesicLength(
2979 const OGRSpatialReference *poSRSOverride = nullptr) const;
2980
2981 // IWks Interface
2982 size_t WkbSize() const override;
2983 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2984 size_t &nBytesConsumedOut) override;
2985 OGRErr exportToWkb(unsigned char *,
2986 const OGRwkbExportOptions * = nullptr) const override;
2987
2988#ifndef DOXYGEN_XML
2990#endif
2991
2992 OGRErr importFromWkt(const char **) override;
2993
2994#ifndef DOXYGEN_XML
2996#endif
2997
3002 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3003 OGRErr *err = nullptr) const override;
3004
3005 virtual double get_Length() const;
3006 virtual double get_Area() const;
3007
3008 // IGeometry methods
3009 int getDimension() const override;
3010 void getEnvelope(OGREnvelope *psEnvelope) const override;
3011 void getEnvelope(OGREnvelope3D *psEnvelope) const override;
3012
3013 // IGeometryCollection
3014 int getNumGeometries() const;
3015 OGRGeometry *getGeometryRef(int);
3016 const OGRGeometry *getGeometryRef(int) const;
3017
3018 // ISpatialRelation
3019 OGRBoolean Equals(const OGRGeometry *) const override;
3020
3021 // Non standard
3022 bool setCoordinateDimension(int nDimension) override;
3023 bool set3D(OGRBoolean bIs3D) override;
3024 bool setMeasured(OGRBoolean bIsMeasured) override;
3025 virtual OGRErr addGeometry(const OGRGeometry *);
3026 virtual OGRErr addGeometryDirectly(OGRGeometry *);
3027 OGRErr addGeometry(std::unique_ptr<OGRGeometry> geom);
3028 virtual OGRErr removeGeometry(int iIndex, int bDelete = TRUE);
3029 std::unique_ptr<OGRGeometry> stealGeometry(int iIndex);
3030
3031 bool hasEmptyParts() const override;
3032 void removeEmptyParts() override;
3033
3034 virtual void
3035 assignSpatialReference(const OGRSpatialReference *poSR) override;
3036
3037 void closeRings() override;
3038
3039 void swapXY() override;
3040
3041 void accept(IOGRGeometryVisitor *visitor) override
3042 {
3043 visitor->visit(this);
3044 }
3045
3046 void accept(IOGRConstGeometryVisitor *visitor) const override
3047 {
3048 visitor->visit(this);
3049 }
3050
3051 static OGRGeometryCollection *
3052 CastToGeometryCollection(OGRGeometryCollection *poSrc);
3053
3054 OGR_FORBID_DOWNCAST_TO_POINT
3055 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
3056 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
3057 OGR_ALLOW_CAST_TO_THIS(GeometryCollection)
3058};
3059
3061
3062inline const OGRGeometryCollection::ChildType *const *
3063begin(const OGRGeometryCollection *poGeom)
3064{
3065 return poGeom->begin();
3066}
3067
3069inline const OGRGeometryCollection::ChildType *const *
3070end(const OGRGeometryCollection *poGeom)
3071{
3072 return poGeom->end();
3073}
3074
3077{
3078 return poGeom->begin();
3079}
3080
3083{
3084 return poGeom->end();
3085}
3086
3088
3089/************************************************************************/
3090/* OGRMultiSurface */
3091/************************************************************************/
3092
3097
3099{
3100 protected:
3102
3103 public:
3105 OGRMultiSurface() = default;
3106
3110
3114
3117
3121 {
3122 return reinterpret_cast<ChildType **>(papoGeoms);
3123 }
3124
3127 {
3128 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3129 }
3130
3133 const ChildType *const *begin() const
3134 {
3135 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3136 }
3137
3139 const ChildType *const *end() const
3140 {
3141 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3142 nGeomCount);
3143 }
3144
3145 // Non standard (OGRGeometry).
3146 const char *getGeometryName() const override;
3147 OGRwkbGeometryType getGeometryType() const override;
3148 OGRMultiSurface *clone() const override;
3149
3150#ifndef DOXYGEN_XML
3152#endif
3153
3154 OGRErr importFromWkt(const char **) override;
3155
3156#ifndef DOXYGEN_XML
3158#endif
3159
3164 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3165 OGRErr *err = nullptr) const override;
3166
3167 // IMultiSurface methods
3168 virtual OGRErr PointOnSurface(OGRPoint *poPoint) const;
3169
3170 // IGeometry methods
3171 int getDimension() const override;
3172
3173 // IGeometryCollection
3179
3181 const OGRSurface *getGeometryRef(int i) const
3182 {
3184 }
3185
3186 // Non standard
3187 virtual OGRBoolean
3188 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3189
3192 {
3193 return this;
3194 }
3195
3198 {
3199 return this;
3200 }
3201
3202 void accept(IOGRGeometryVisitor *visitor) override
3203 {
3204 visitor->visit(this);
3205 }
3206
3207 void accept(IOGRConstGeometryVisitor *visitor) const override
3208 {
3209 visitor->visit(this);
3210 }
3211
3212 static OGRMultiPolygon *CastToMultiPolygon(OGRMultiSurface *poMS);
3213
3214 OGR_ALLOW_CAST_TO_THIS(MultiSurface)
3215 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3216 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3217 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
3218 OGR_FORBID_DOWNCAST_TO_MULTICURVE
3219};
3220
3222
3223inline const OGRMultiSurface::ChildType *const *
3224begin(const OGRMultiSurface *poGeom)
3225{
3226 return poGeom->begin();
3227}
3228
3230inline const OGRMultiSurface::ChildType *const *
3231end(const OGRMultiSurface *poGeom)
3232{
3233 return poGeom->end();
3234}
3235
3238{
3239 return poGeom->begin();
3240}
3241
3244{
3245 return poGeom->end();
3246}
3247
3249
3250/************************************************************************/
3251/* OGRMultiPolygon */
3252/************************************************************************/
3253
3257
3258class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
3259{
3260 protected:
3262 friend class OGRPolyhedralSurface;
3263 friend class OGRTriangulatedSurface;
3264
3265 private:
3267 OGRErr _addGeometryWithExpectedSubGeometryType(
3268 const OGRGeometry *poNewGeom, OGRwkbGeometryType eSubGeometryType);
3269 OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
3270 OGRGeometry *poNewGeom, OGRwkbGeometryType eSubGeometryType);
3272
3273 public:
3275 OGRMultiPolygon() = default;
3276
3280
3284
3287
3291 {
3292 return reinterpret_cast<ChildType **>(papoGeoms);
3293 }
3294
3297 {
3298 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3299 }
3300
3303 const ChildType *const *begin() const
3304 {
3305 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3306 }
3307
3309 const ChildType *const *end() const
3310 {
3311 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3312 nGeomCount);
3313 }
3314
3315 // IGeometryCollection
3321
3323 const OGRPolygon *getGeometryRef(int i) const
3324 {
3326 }
3327
3328 // Non-standard (OGRGeometry).
3329 const char *getGeometryName() const override;
3330 OGRwkbGeometryType getGeometryType() const override;
3331 OGRMultiPolygon *clone() const override;
3332
3333#ifndef DOXYGEN_XML
3335#endif
3336
3337 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
3338 size_t &nBytesConsumedOut) override;
3339
3344 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3345 OGRErr *err = nullptr) const override;
3346
3347 // Non standard
3348 virtual OGRBoolean
3349 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3350
3353 {
3354 return this;
3355 }
3356
3359 {
3360 return this;
3361 }
3362
3363 void accept(IOGRGeometryVisitor *visitor) override
3364 {
3365 visitor->visit(this);
3366 }
3367
3368 void accept(IOGRConstGeometryVisitor *visitor) const override
3369 {
3370 visitor->visit(this);
3371 }
3372
3373 static OGRMultiSurface *CastToMultiSurface(OGRMultiPolygon *poMP);
3374
3375 OGR_ALLOW_CAST_TO_THIS(MultiPolygon)
3376 OGR_ALLOW_UPCAST_TO(MultiSurface)
3377};
3378
3380
3381inline const OGRMultiPolygon::ChildType *const *
3382begin(const OGRMultiPolygon *poGeom)
3383{
3384 return poGeom->begin();
3385}
3386
3388inline const OGRMultiPolygon::ChildType *const *
3389end(const OGRMultiPolygon *poGeom)
3390{
3391 return poGeom->end();
3392}
3393
3396{
3397 return poGeom->begin();
3398}
3399
3402{
3403 return poGeom->end();
3404}
3405
3407
3408/************************************************************************/
3409/* OGRPolyhedralSurface */
3410/************************************************************************/
3411
3416
3417class CPL_DLL OGRPolyhedralSurface : public OGRSurface
3418{
3419 protected:
3421 friend class OGRTriangulatedSurface;
3422 OGRMultiPolygon oMP{};
3423 OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
3424 virtual OGRSurfaceCasterToCurvePolygon
3425 GetCasterToCurvePolygon() const override;
3426 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const;
3427 virtual const char *getSubGeometryName() const;
3428 virtual OGRwkbGeometryType getSubGeometryType() const;
3429 std::string exportToWktInternal(const OGRWktOptions &opts,
3430 OGRErr *err) const;
3431
3432 virtual OGRPolyhedralSurfaceCastToMultiPolygon
3433 GetCasterToMultiPolygon() const;
3434 static OGRMultiPolygon *CastToMultiPolygonImpl(OGRPolyhedralSurface *poPS);
3436
3437 public:
3440
3444
3448
3451
3455 {
3456 return oMP.begin();
3457 }
3458
3461 {
3462 return oMP.end();
3463 }
3464
3467 const ChildType *const *begin() const
3468 {
3469 return oMP.begin();
3470 }
3471
3473 const ChildType *const *end() const
3474 {
3475 return oMP.end();
3476 }
3477
3478 // IWks Interface.
3479 size_t WkbSize() const override;
3480 const char *getGeometryName() const override;
3481 OGRwkbGeometryType getGeometryType() const override;
3482 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
3483 size_t &nBytesConsumedOut) override;
3484 OGRErr exportToWkb(unsigned char *,
3485 const OGRwkbExportOptions * = nullptr) const override;
3486
3487#ifndef DOXYGEN_XML
3489#endif
3490
3491 OGRErr importFromWkt(const char **) override;
3492
3493#ifndef DOXYGEN_XML
3495#endif
3496
3501 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3502 OGRErr *err = nullptr) const override;
3503
3504 // IGeometry methods.
3505 int getDimension() const override;
3506
3507 void empty() override;
3508
3509 OGRPolyhedralSurface *clone() const override;
3510 void getEnvelope(OGREnvelope *psEnvelope) const override;
3511 void getEnvelope(OGREnvelope3D *psEnvelope) const override;
3512
3513 void flattenTo2D() override;
3514 OGRErr transform(OGRCoordinateTransformation *) override;
3515 OGRBoolean Equals(const OGRGeometry *) const override;
3516 double get_Area() const override;
3517 virtual double get_GeodesicArea(
3518 const OGRSpatialReference *poSRSOverride = nullptr) const override;
3519 double get_Length() const override;
3520 virtual double get_GeodesicLength(
3521 const OGRSpatialReference *poSRSOverride = nullptr) const override;
3522
3523 OGRErr PointOnSurface(OGRPoint *) const override;
3524
3525 static OGRMultiPolygon *CastToMultiPolygon(OGRPolyhedralSurface *poPS);
3526 virtual OGRBoolean
3527 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3528 virtual OGRErr addGeometry(const OGRGeometry *);
3529 OGRErr addGeometryDirectly(OGRGeometry *poNewGeom);
3530 OGRErr addGeometry(std::unique_ptr<OGRGeometry> poNewGeom);
3531
3532 int getNumGeometries() const;
3533 OGRPolygon *getGeometryRef(int i);
3534 const OGRPolygon *getGeometryRef(int i) const;
3535
3536 OGRBoolean IsEmpty() const override;
3537 bool setCoordinateDimension(int nDimension) override;
3538 bool set3D(OGRBoolean bIs3D) override;
3539 bool setMeasured(OGRBoolean bIsMeasured) override;
3540 void swapXY() override;
3541 OGRErr removeGeometry(int iIndex, int bDelete = TRUE);
3542
3543 bool hasEmptyParts() const override;
3544 void removeEmptyParts() override;
3545
3546 void accept(IOGRGeometryVisitor *visitor) override
3547 {
3548 visitor->visit(this);
3549 }
3550
3551 void accept(IOGRConstGeometryVisitor *visitor) const override
3552 {
3553 visitor->visit(this);
3554 }
3555
3556 virtual void
3557 assignSpatialReference(const OGRSpatialReference *poSR) override;
3558
3559 OGR_ALLOW_CAST_TO_THIS(PolyhedralSurface)
3560 OGR_ALLOW_UPCAST_TO(Surface)
3561};
3562
3564
3565inline const OGRPolyhedralSurface::ChildType *const *
3566begin(const OGRPolyhedralSurface *poGeom)
3567{
3568 return poGeom->begin();
3569}
3570
3572inline const OGRPolyhedralSurface::ChildType *const *
3573end(const OGRPolyhedralSurface *poGeom)
3574{
3575 return poGeom->end();
3576}
3577
3580{
3581 return poGeom->begin();
3582}
3583
3586{
3587 return poGeom->end();
3588}
3589
3591
3592/************************************************************************/
3593/* OGRTriangulatedSurface */
3594/************************************************************************/
3595
3600
3602{
3603 protected:
3605 OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3606 const char *getSubGeometryName() const override;
3607 OGRwkbGeometryType getSubGeometryType() const override;
3608
3609 virtual OGRPolyhedralSurfaceCastToMultiPolygon
3610 GetCasterToMultiPolygon() const override;
3611 static OGRMultiPolygon *CastToMultiPolygonImpl(OGRPolyhedralSurface *poPS);
3613
3614 public:
3617
3621
3625
3628
3632 {
3633 return reinterpret_cast<ChildType **>(oMP.begin());
3634 }
3635
3638 {
3639 return reinterpret_cast<ChildType **>(oMP.end());
3640 }
3641
3644 const ChildType *const *begin() const
3645 {
3646 return reinterpret_cast<const ChildType *const *>(oMP.begin());
3647 }
3648
3650 const ChildType *const *end() const
3651 {
3652 return reinterpret_cast<const ChildType *const *>(oMP.end());
3653 }
3654
3655 const char *getGeometryName() const override;
3656 OGRwkbGeometryType getGeometryType() const override;
3657 OGRTriangulatedSurface *clone() const override;
3658
3664
3666 const OGRTriangle *getGeometryRef(int i) const
3667 {
3669 }
3670
3671 // IWks Interface.
3672 OGRErr addGeometry(const OGRGeometry *) override;
3673
3674#ifndef DOXYGEN_XML
3676#endif
3677
3680 {
3681 return this;
3682 }
3683
3686 {
3687 return this;
3688 }
3689
3690 void accept(IOGRGeometryVisitor *visitor) override
3691 {
3692 visitor->visit(this);
3693 }
3694
3695 void accept(IOGRConstGeometryVisitor *visitor) const override
3696 {
3697 visitor->visit(this);
3698 }
3699
3700 static OGRPolyhedralSurface *
3701 CastToPolyhedralSurface(OGRTriangulatedSurface *poTS);
3702
3703 OGR_ALLOW_CAST_TO_THIS(TriangulatedSurface)
3704 OGR_ALLOW_UPCAST_TO(PolyhedralSurface)
3705};
3706
3708
3709inline const OGRTriangulatedSurface::ChildType *const *
3710begin(const OGRTriangulatedSurface *poGeom)
3711{
3712 return poGeom->begin();
3713}
3714
3716inline const OGRTriangulatedSurface::ChildType *const *
3717end(const OGRTriangulatedSurface *poGeom)
3718{
3719 return poGeom->end();
3720}
3721
3724{
3725 return poGeom->begin();
3726}
3727
3730{
3731 return poGeom->end();
3732}
3733
3735
3736/************************************************************************/
3737/* OGRMultiPoint */
3738/************************************************************************/
3739
3743
3745{
3746 private:
3747 OGRErr importFromWkt_Bracketed(const char **, int bHasM, int bHasZ);
3748
3749 protected:
3751
3752 public:
3754 OGRMultiPoint() = default;
3755
3758 OGRMultiPoint(OGRMultiPoint &&other) = default;
3759
3760 OGRMultiPoint &operator=(const OGRMultiPoint &other);
3763
3766
3770 {
3771 return reinterpret_cast<ChildType **>(papoGeoms);
3772 }
3773
3776 {
3777 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3778 }
3779
3782 const ChildType *const *begin() const
3783 {
3784 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3785 }
3786
3788 const ChildType *const *end() const
3789 {
3790 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3791 nGeomCount);
3792 }
3793
3794 // IGeometryCollection
3800
3802 const OGRPoint *getGeometryRef(int i) const
3803 {
3805 }
3806
3807 // Non-standard (OGRGeometry).
3808 const char *getGeometryName() const override;
3809 OGRwkbGeometryType getGeometryType() const override;
3810 OGRMultiPoint *clone() const override;
3811
3812#ifndef DOXYGEN_XML
3814#endif
3815
3816 OGRErr importFromWkt(const char **) override;
3817
3818#ifndef DOXYGEN_XML
3820#endif
3821
3826 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3827 OGRErr *err = nullptr) const override;
3828
3829 // IGeometry methods.
3830 int getDimension() const override;
3831
3834 {
3835 return this;
3836 }
3837
3840 {
3841 return this;
3842 }
3843
3844 void accept(IOGRGeometryVisitor *visitor) override
3845 {
3846 visitor->visit(this);
3847 }
3848
3849 void accept(IOGRConstGeometryVisitor *visitor) const override
3850 {
3851 visitor->visit(this);
3852 }
3853
3854 // Non-standard.
3855 virtual OGRBoolean
3856 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3857
3858 OGR_ALLOW_CAST_TO_THIS(MultiPoint)
3859 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3860 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
3861 OGR_FORBID_DOWNCAST_TO_MULTICURVE
3862 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3863 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3864};
3865
3867
3868inline const OGRMultiPoint::ChildType *const *begin(const OGRMultiPoint *poGeom)
3869{
3870 return poGeom->begin();
3871}
3872
3874inline const OGRMultiPoint::ChildType *const *end(const OGRMultiPoint *poGeom)
3875{
3876 return poGeom->end();
3877}
3878
3881{
3882 return poGeom->begin();
3883}
3884
3887{
3888 return poGeom->end();
3889}
3890
3892
3893/************************************************************************/
3894/* OGRMultiCurve */
3895/************************************************************************/
3896
3901
3903{
3904 protected:
3906 static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
3907 OGRCurve *poCurve);
3910
3911 public:
3913 OGRMultiCurve() = default;
3914
3917 OGRMultiCurve(OGRMultiCurve &&other) = default;
3918
3919 OGRMultiCurve &operator=(const OGRMultiCurve &other);
3922
3925
3929 {
3930 return reinterpret_cast<ChildType **>(papoGeoms);
3931 }
3932
3935 {
3936 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3937 }
3938
3941 const ChildType *const *begin() const
3942 {
3943 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3944 }
3945
3947 const ChildType *const *end() const
3948 {
3949 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3950 nGeomCount);
3951 }
3952
3953 // IGeometryCollection
3959
3961 const OGRCurve *getGeometryRef(int i) const
3962 {
3964 }
3965
3966 // Non standard (OGRGeometry).
3967 const char *getGeometryName() const override;
3968 OGRwkbGeometryType getGeometryType() const override;
3969 OGRMultiCurve *clone() const override;
3970
3971#ifndef DOXYGEN_XML
3973#endif
3974
3975 OGRErr importFromWkt(const char **) override;
3976
3977#ifndef DOXYGEN_XML
3979#endif
3980
3985 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3986 OGRErr *err = nullptr) const override;
3987
3988 // IGeometry methods.
3989 int getDimension() const override;
3990
3991 // Non-standard.
3992 virtual OGRBoolean
3993 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3994
3997 {
3998 return this;
3999 }
4000
4003 {
4004 return this;
4005 }
4006
4007 void accept(IOGRGeometryVisitor *visitor) override
4008 {
4009 visitor->visit(this);
4010 }
4011
4012 void accept(IOGRConstGeometryVisitor *visitor) const override
4013 {
4014 visitor->visit(this);
4015 }
4016
4017 static OGRMultiLineString *CastToMultiLineString(OGRMultiCurve *poMC);
4018
4019 OGR_ALLOW_CAST_TO_THIS(MultiCurve)
4020 OGR_ALLOW_UPCAST_TO(GeometryCollection)
4021 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
4022 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
4023 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
4024};
4025
4027
4028inline const OGRMultiCurve::ChildType *const *begin(const OGRMultiCurve *poGeom)
4029{
4030 return poGeom->begin();
4031}
4032
4034inline const OGRMultiCurve::ChildType *const *end(const OGRMultiCurve *poGeom)
4035{
4036 return poGeom->end();
4037}
4038
4041{
4042 return poGeom->begin();
4043}
4044
4047{
4048 return poGeom->end();
4049}
4050
4052
4053/************************************************************************/
4054/* OGRMultiLineString */
4055/************************************************************************/
4056
4060
4061class CPL_DLL OGRMultiLineString : public OGRMultiCurve
4062{
4063 protected:
4065
4066 public:
4069
4073
4077
4080
4084 {
4085 return reinterpret_cast<ChildType **>(papoGeoms);
4086 }
4087
4090 {
4091 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
4092 }
4093
4096 const ChildType *const *begin() const
4097 {
4098 return reinterpret_cast<const ChildType *const *>(papoGeoms);
4099 }
4100
4102 const ChildType *const *end() const
4103 {
4104 return reinterpret_cast<const ChildType *const *>(papoGeoms +
4105 nGeomCount);
4106 }
4107
4108 // IGeometryCollection
4114
4116 const OGRLineString *getGeometryRef(int i) const
4117 {
4119 }
4120
4121 // Non standard (OGRGeometry).
4122 const char *getGeometryName() const override;
4123 OGRwkbGeometryType getGeometryType() const override;
4124 OGRMultiLineString *clone() const override;
4125
4126#ifndef DOXYGEN_XML
4128#endif
4129
4130 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
4131 size_t &nBytesConsumedOut) override;
4132
4137 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
4138 OGRErr *err = nullptr) const override;
4139
4140 // Non standard
4141 virtual OGRBoolean
4142 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
4143
4146 {
4147 return this;
4148 }
4149
4152 {
4153 return this;
4154 }
4155
4156 void accept(IOGRGeometryVisitor *visitor) override
4157 {
4158 visitor->visit(this);
4159 }
4160
4161 void accept(IOGRConstGeometryVisitor *visitor) const override
4162 {
4163 visitor->visit(this);
4164 }
4165
4166 static OGRMultiCurve *CastToMultiCurve(OGRMultiLineString *poMLS);
4167
4168 OGR_ALLOW_CAST_TO_THIS(MultiLineString)
4169 OGR_ALLOW_UPCAST_TO(MultiCurve)
4170 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
4171 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
4172 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
4173};
4174
4176
4177inline const OGRMultiLineString::ChildType *const *
4178begin(const OGRMultiLineString *poGeom)
4179{
4180 return poGeom->begin();
4181}
4182
4184inline const OGRMultiLineString::ChildType *const *
4185end(const OGRMultiLineString *poGeom)
4186{
4187 return poGeom->end();
4188}
4189
4192{
4193 return poGeom->begin();
4194}
4195
4198{
4199 return poGeom->end();
4200}
4201
4203
4204/************************************************************************/
4205/* OGRGeometryFactory */
4206/************************************************************************/
4207
4211
4213{
4214 static OGRErr createFromFgfInternal(const unsigned char *pabyData,
4215 OGRSpatialReference *poSR,
4216 OGRGeometry **ppoReturn, int nBytes,
4217 int *pnBytesConsumed, int nRecLevel);
4218
4219 public:
4220 static OGRErr createFromWkb(const void *, const OGRSpatialReference *,
4221 OGRGeometry **,
4222 size_t = static_cast<size_t>(-1),
4224 static OGRErr createFromWkb(const void *pabyData,
4225 const OGRSpatialReference *, OGRGeometry **,
4226 size_t nSize, OGRwkbVariant eVariant,
4227 size_t &nBytesConsumedOut);
4228 static OGRErr createFromWkt(const char *, const OGRSpatialReference *,
4229 OGRGeometry **);
4230 static OGRErr createFromWkt(const char **, const OGRSpatialReference *,
4231 OGRGeometry **);
4232 static std::pair<std::unique_ptr<OGRGeometry>, OGRErr>
4233 createFromWkt(const char *, const OGRSpatialReference * = nullptr);
4234
4238 static OGRErr createFromWkt(char **ppszInput,
4239 const OGRSpatialReference *poSRS,
4240 OGRGeometry **ppoGeom)
4241 CPL_WARN_DEPRECATED("Use createFromWkt(const char**, ...) instead")
4242 {
4243 return createFromWkt(const_cast<const char **>(ppszInput), poSRS,
4244 ppoGeom);
4245 }
4246
4247 static OGRErr createFromFgf(const void *, OGRSpatialReference *,
4248 OGRGeometry **, int = -1, int * = nullptr);
4249 static OGRGeometry *createFromGML(const char *);
4250 static OGRGeometry *createFromGEOS(GEOSContextHandle_t hGEOSCtxt, GEOSGeom);
4251 static OGRGeometry *createFromGeoJson(const char *, int = -1);
4252 static OGRGeometry *createFromGeoJson(const CPLJSONObject &oJSONObject);
4253
4254 static void destroyGeometry(OGRGeometry *);
4255 static OGRGeometry *createGeometry(OGRwkbGeometryType);
4256
4257 static OGRGeometry *forceToPolygon(OGRGeometry *);
4258 static OGRGeometry *forceToLineString(OGRGeometry *,
4259 bool bOnlyInOrder = true);
4260 static OGRGeometry *forceToMultiPolygon(OGRGeometry *);
4261 static OGRGeometry *forceToMultiPoint(OGRGeometry *);
4262 static OGRGeometry *forceToMultiLineString(OGRGeometry *);
4263
4264 static OGRGeometry *forceTo(OGRGeometry *poGeom,
4265 OGRwkbGeometryType eTargetType,
4266 const char *const *papszOptions = nullptr);
4267
4268 static std::unique_ptr<OGRGeometry>
4269 makeCompatibleWith(std::unique_ptr<OGRGeometry>,
4270 OGRwkbGeometryType eTargetType);
4271
4272 static OGRGeometry *removeLowerDimensionSubGeoms(const OGRGeometry *poGeom);
4273
4274 static OGRGeometry *organizePolygons(OGRGeometry **papoPolygons,
4275 int nPolygonCount,
4276 int *pbResultValidGeometry,
4277 const char **papszOptions = nullptr);
4278 static bool haveGEOS();
4279
4281 class CPL_DLL TransformWithOptionsCache
4282 {
4283 friend class OGRGeometryFactory;
4284 struct Private;
4285 std::unique_ptr<Private> d;
4286
4287 public:
4288 TransformWithOptionsCache();
4289 ~TransformWithOptionsCache();
4290 };
4291
4293 static bool isTransformWithOptionsRegularTransform(
4294 const OGRSpatialReference *poSourceCRS,
4295 const OGRSpatialReference *poTargetCRS, CSLConstList papszOptions);
4297
4299 const OGRGeometry *poSrcGeom, OGRCoordinateTransformation *poCT,
4300 char **papszOptions,
4302
4303 static double GetDefaultArcStepSize();
4304
4305 static OGRGeometry *
4306 approximateArcAngles(double dfX, double dfY, double dfZ,
4307 double dfPrimaryRadius, double dfSecondaryAxis,
4308 double dfRotation, double dfStartAngle,
4309 double dfEndAngle, double dfMaxAngleStepSizeDegrees,
4310 const bool bUseMaxGap = false);
4311
4312 static int GetCurveParameters(double x0, double y0, double x1, double y1,
4313 double x2, double y2, double &R, double &cx,
4314 double &cy, double &alpha0, double &alpha1,
4315 double &alpha2);
4316 static OGRLineString *
4317 curveToLineString(double x0, double y0, double z0, double x1, double y1,
4318 double z1, double x2, double y2, double z2, int bHasZ,
4319 double dfMaxAngleStepSizeDegrees,
4320 const char *const *papszOptions = nullptr);
4321 static OGRCurve *
4323 const char *const *papszOptions = nullptr);
4324};
4325
4326OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType(const char *pszGeomType);
4327const char CPL_DLL *OGRToOGCGeomType(OGRwkbGeometryType eGeomType,
4328 bool bCamelCase = false,
4329 bool bAddZM = false,
4330 bool bSpaceBeforeZM = false);
4331
4333typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
4334
4335struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
4336{
4337 void operator()(OGRPreparedGeometry *) const;
4338};
4339
4341
4344typedef std::unique_ptr<OGRPreparedGeometry,
4345 OGRPreparedGeometryUniquePtrDeleter>
4347
4348#endif /* ndef OGR_GEOMETRY_H_INCLUDED */
The CPLJSONArray class holds JSON object from CPLJSONDocument.
Definition cpl_json.h:56
OGRGeometry visitor interface.
Definition ogr_geometry.h:222
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 ~IOGRConstGeometryVisitor()
Destructor/.
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 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:148
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()
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:1921
OGRCircularString()=default
Create an empty circular string.
OGRCircularString & operator=(const OGRCircularString &other)
Assignment operator.
Definition ogrcircularstring.cpp:52
OGRErr exportToWkb(unsigned char *, const OGRwkbExportOptions *=nullptr) const override
Convert a geometry into well known binary format.
Definition ogrcircularstring.cpp:130
virtual double get_GeodesicLength(const OGRSpatialReference *poSRSOverride=nullptr) const override
Get the length of the curve, considered as a geodesic line on the underlying ellipsoid of the SRS att...
Definition ogrcircularstring.cpp:925
bool segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition ogrcircularstring.cpp:320
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition ogrcircularstring.cpp:105
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:2016
virtual double get_GeodesicArea(const OGRSpatialReference *poSRSOverride=nullptr) const override
Get the area of the (closed) curve, considered as a surface on the underlying ellipsoid of the SRS at...
Definition ogrcircularstring.cpp:902
OGRCircularString * clone() const override
Make a copy of this object.
Definition ogrcircularstring.cpp:92
void Value(double, OGRPoint *) const override
Fetch point at given distance along curve.
Definition ogrcircularstring.cpp:568
OGRBoolean IsValid() const override
Test if the geometry is valid.
Definition ogrcircularstring.cpp:706
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:2006
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a circular string to WKT.
Definition ogrcircularstring.cpp:174
OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition ogrcircularstring.cpp:65
void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition ogrcircularstring.cpp:298
double get_Length() const override
Returns the length of the curve.
Definition ogrcircularstring.cpp:195
OGRCircularString(const OGRCircularString &other)
Copy constructor.
double get_Area() const override
Get the area of the (closed) curve.
Definition ogrcircularstring.cpp:865
const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition ogrcircularstring.cpp:82
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:2000
OGRErr importFromWkt(const char **) override
deprecated
Definition ogrcircularstring.cpp:155
OGRCircularString & operator=(OGRCircularString &&other)=default
Move assignment operator.
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return, possibly approximate, non-curve version of this geometry.
Definition ogrcircularstring.cpp:727
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return a linestring from a curve geometry.
Definition ogrcircularstring.cpp:665
OGRCircularString(OGRCircularString &&other)=default
Move constructor.
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:2011
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition ogrcircularstring.cpp:717
Utility class to store a collection of curves.
Definition ogr_geometry.h:2153
const ChildType *const * end() const
Return end of curve iterator.
Definition ogr_geometry.h:2216
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return, possibly approximate, non-curve version of this geometry.
Definition ogrcompoundcurve.cpp:670
OGRCompoundCurve()=default
Create an empty compound curve.
const ChildType *const * begin() const
Return begin of curve iterator.
Definition ogr_geometry.h:2210
OGRCompoundCurve & operator=(const OGRCompoundCurve &other)
Assignment operator.
Definition ogrcompoundcurve.cpp:43
OGRCompoundCurve(const OGRCompoundCurve &other)
Copy constructor.
bool segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition ogrcompoundcurve.cpp:637
OGRPointIterator * getPointIterator() const override
Returns a point iterator over the curve.
Definition ogrcompoundcurve.cpp:745
OGRCurve ChildType
Type of child elements.
Definition ogr_geometry.h:2193
OGRCompoundCurve(OGRCompoundCurve &&other)=default
Move constructor.
OGRCurve * stealCurve(int)
"Steal" reference to curve.
Definition ogrcompoundcurve.cpp:453
void flattenTo2D() override
Convert geometry to strictly 2D.
Definition ogrcompoundcurve.cpp:628
ChildType ** end()
Return end of curve iterator.
Definition ogr_geometry.h:2203
OGRCompoundCurve & operator=(OGRCompoundCurve &&other)=default
Move assignment operator.
static constexpr double DEFAULT_TOLERANCE_EPSILON
Default relative tolerance to assume that the end of the previous curve is equal to the start of the ...
Definition ogr_geometry.h:2288
void reversePoints() override
Reverse point order.
Definition ogrcompoundcurve.cpp:985
ChildType ** begin()
Return begin of curve iterator.
Definition ogr_geometry.h:2197
OGRErr addCurveDirectly(OGRCurve *, double dfToleranceEps=DEFAULT_TOLERANCE_EPSILON)
Add a curve directly to the container.
Definition ogrcompoundcurve.cpp:513
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition ogrcompoundcurve.cpp:655
OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition ogrcompoundcurve.cpp:619
OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition ogrcompoundcurve.cpp:77
const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition ogrcompoundcurve.cpp:94
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:2317
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:2312
OGRErr addCurve(const OGRCurve *, double dfToleranceEps=DEFAULT_TOLERANCE_EPSILON)
Add a curve to the container.
Definition ogrcompoundcurve.cpp:480
Interface for transforming between coordinate systems.
Definition ogr_spatialref.h:772
Concrete class representing curve polygons.
Definition ogr_geometry.h:2417
OGRCurvePolygon()=default
Create an empty curve polygon.
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:2573
OGRCurvePolygon & operator=(OGRCurvePolygon &&other)=default
Move assignment operator.
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition ogrcurvepolygon.cpp:892
OGRCurve ChildType
Type of child elements.
Definition ogr_geometry.h:2460
OGRCurvePolygon(OGRCurvePolygon &&)=default
Move constructor.
const ChildType *const * end() const
Return end of curve iterator.
Definition ogr_geometry.h:2483
const ChildType *const * begin() const
Return begin of curve iterator.
Definition ogr_geometry.h:2477
OGRCurvePolygon & operator=(const OGRCurvePolygon &other)
Assignment operator.
Definition ogrcurvepolygon.cpp:44
ChildType ** begin()
Return begin of curve iterator.
Definition ogr_geometry.h:2464
ChildType ** end()
Return end of curve iterator.
Definition ogr_geometry.h:2470
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:2578
OGRCurvePolygon(const OGRCurvePolygon &)
Copy constructor.
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition ogr_geometry.h:1278
virtual OGRPointIterator * getPointIterator() const =0
Returns a point iterator over the curve.
int getDimension() const override
Get the dimension of this object.
Definition ogrcurve.cpp:37
OGRCurve * clone() const override=0
Make a copy of this object.
virtual double get_GeodesicArea(const OGRSpatialReference *poSRSOverride=nullptr) const =0
Get the area of the (closed) curve, considered as a surface on the underlying ellipsoid of the SRS at...
virtual int IntersectsPoint(const OGRPoint *p) const
Returns if a point intersects a (closed) curve.
Definition ogrcurve.cpp:439
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition ogr_geometry.h:1371
virtual double get_Length() const =0
Returns the length of the curve.
OGRPoint ChildType
Type of child elements.
Definition ogr_geometry.h:1321
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition ogr_geometry.h:1363
virtual double get_AreaOfCurveSegments() const =0
Get the area of the purely curve portions of a (closed) curve.
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition ogrcurve.cpp:420
virtual int get_IsClosed() const
Return TRUE if curve is closed.
Definition ogrcurve.cpp:60
virtual double get_Area() const =0
Get the area of the (closed) curve.
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
static OGRLineString * CastToLineString(OGRCurve *poCurve)
Cast to linestring.
Definition ogrcurve.cpp:379
virtual int getNumPoints() const =0
Return the number of points of a curve geometry.
virtual double get_GeodesicLength(const OGRSpatialReference *poSRSOverride=nullptr) const =0
Get the length of the curve, considered as a geodesic line on the underlying ellipsoid of the SRS att...
virtual void StartPoint(OGRPoint *) const =0
Return the curve start point.
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
virtual int isClockwise() const
Returns TRUE if the ring has clockwise winding (or less than 2 points).
Definition ogrcurve.cpp:723
virtual OGRBoolean IsConvex() const
Returns if a (closed) curve forms a convex shape.
Definition ogrcurve.cpp:305
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const =0
Return a linestring from a curve geometry.
virtual void reversePoints()=0
Reverse point order.
static OGRLinearRing * CastToLinearRing(OGRCurve *poCurve)
Cast to linear ring.
Definition ogrcurve.cpp:400
OGRGeometry visitor default implementation.
Definition ogr_geometry.h:268
void visit(const OGRPoint *) override
Visit OGRPoint.
Definition ogr_geometry.h:272
OGRGeometry visitor default implementation.
Definition ogr_geometry.h:194
void visit(OGRPoint *) override
Visit OGRPoint.
Definition ogr_geometry.h:198
Simple container for a bounding region in 3D.
Definition ogr_core.h:199
Simple container for a bounding region (rectangle).
Definition ogr_core.h:44
Geometry coordinate precision for a binary representation.
Definition ogr_geometry.h:302
int nXYBitPrecision
Number of bits needed to achieved XY precision.
Definition ogr_geometry.h:304
void SetFrom(const OGRGeomCoordinatePrecision &)
Set binary precision options from resolution.
Definition ogrgeometry.cpp:8731
int nMBitPrecision
Number of bits needed to achieved M precision.
Definition ogr_geometry.h:310
int nZBitPrecision
Number of bits needed to achieved Z precision.
Definition ogr_geometry.h:307
A collection of 1 or more geometry objects.
Definition ogr_geometry.h:2899
ChildType ** end()
Return end of sub-geometry iterator.
Definition ogr_geometry.h:2942
OGRGeometryCollection()=default
Create an empty geometry collection.
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition ogrgeometrycollection.cpp:1498
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:3041
const ChildType *const * begin() const
Return begin of sub-geometry iterator.
Definition ogr_geometry.h:2949
const ChildType *const * end() const
Return end of sub-geometry iterator.
Definition ogr_geometry.h:2955
ChildType ** begin()
Return begin of sub-geometry iterator.
Definition ogr_geometry.h:2936
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:3046
OGRGeometryCollection & operator=(const OGRGeometryCollection &other)
Assignment operator.
Definition ogrgeometrycollection.cpp:95
OGRGeometry * getGeometryRef(int)
Fetch geometry from container.
Definition ogrgeometrycollection.cpp:293
OGRGeometry ChildType
Type of child elements.
Definition ogr_geometry.h:2932
Opaque class used as argument to transformWithOptions().
Definition ogr_geometry.h:4282
Create geometry objects from well known text/binary.
Definition ogr_geometry.h:4213
static OGRGeometry * transformWithOptions(const OGRGeometry *poSrcGeom, OGRCoordinateTransformation *poCT, char **papszOptions, const TransformWithOptionsCache &cache=TransformWithOptionsCache())
Transform a geometry.
Definition ogrgeometryfactory.cpp:4127
static OGRErr createFromWkt(const char *, const OGRSpatialReference *, OGRGeometry **)
Create a geometry object of the appropriate type from its well known text representation.
Definition ogrgeometryfactory.cpp:475
static OGRCurve * curveFromLineString(const OGRLineString *poLS, const char *const *papszOptions=nullptr)
Try to convert a linestring approximating curves into a curve.
Definition ogrgeometryfactory.cpp:6448
static OGRLineString * curveToLineString(double x0, double y0, double z0, double x1, double y1, double z1, double x2, double y2, double z2, int bHasZ, double dfMaxAngleStepSizeDegrees, const char *const *papszOptions=nullptr)
Converts an arc circle into an approximate line string.
Definition ogrgeometryfactory.cpp:5674
static OGRErr createFromWkb(const void *, const OGRSpatialReference *, OGRGeometry **, size_t=static_cast< size_t >(-1), OGRwkbVariant=wkbVariantOldOgc)
Create a geometry object of the appropriate type from its well known binary representation.
Definition ogrgeometryfactory.cpp:90
static OGRGeometry * approximateArcAngles(double dfX, double dfY, double dfZ, double dfPrimaryRadius, double dfSecondaryAxis, double dfRotation, double dfStartAngle, double dfEndAngle, double dfMaxAngleStepSizeDegrees, const bool bUseMaxGap=false)
Stroke arc to linestring.
Definition ogrgeometryfactory.cpp:4446
static int GetCurveParameters(double x0, double y0, double x1, double y1, double x2, double y2, double &R, double &cx, double &cy, double &alpha0, double &alpha1, double &alpha2)
Returns the parameter of an arc circle.
Definition ogrgeometryfactory.cpp:5412
static OGRErr createFromWkt(char **ppszInput, const OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
Definition ogr_geometry.h:4238
static double GetDefaultArcStepSize()
Return the default value of the angular step used when stroking curves as lines.
Definition ogrgeometryfactory.cpp:4378
Abstract base class for all geometry classes.
Definition ogr_geometry.h:357
const OGRSurface * toSurface() const
Down-cast to OGRSurface*.
Definition ogr_geometry.h:784
static void freeGEOSContext(GEOSContextHandle_t hGEOSCtxt)
Destroy a GEOS context.
Definition ogrgeometry.cpp:3238
const OGRCurvePolygon * toCurvePolygon() const
Down-cast to OGRCurvePolygon*.
Definition ogr_geometry.h:836
GEOSGeom exportToGEOS(GEOSContextHandle_t hGEOSCtxt, bool bRemoveEmptyParts=false) const
Returns a GEOSGeom object corresponding to the geometry.
Definition ogrgeometry.cpp:3287
virtual void getEnvelope(OGREnvelope *psEnvelope) const =0
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
bool IsRectangle() const
Returns whether the geometry is a polygon with 4 corners forming a rectangle.
Definition ogrgeometry.cpp:8851
void roundCoordinates(const OGRGeomCoordinatePrecision &sPrecision)
Round coordinates of the geometry to the specified precision.
Definition ogrgeometry.cpp:6484
const OGRMultiCurve * toMultiCurve() const
Down-cast to OGRMultiCurve*.
Definition ogr_geometry.h:926
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=nullptr) const
Return curve version of this geometry.
Definition ogrgeometry.cpp:3511
virtual OGRGeometry * ConstrainedDelaunayTriangulation() const
Return a constrained Delaunay triangulation of the vertices of the given polygon(s).
Definition ogrgeometry.cpp:6744
const OGRPolyhedralSurface * toPolyhedralSurface() const
Down-cast to OGRPolyhedralSurface*.
Definition ogr_geometry.h:962
virtual OGRBoolean Intersects(const OGRGeometry *) const
Do these features intersect?
Definition ogrgeometry.cpp:569
const OGRMultiPoint * toMultiPoint() const
Down-cast to OGRMultiPoint*.
Definition ogr_geometry.h:872
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const
Returns if this geometry is or has curve geometry.
Definition ogrgeometry.cpp:3445
const OGRMultiPolygon * toMultiPolygon() const
Down-cast to OGRMultiPolygon*.
Definition ogr_geometry.h:908
OGRPolyhedralSurface * toPolyhedralSurface()
Down-cast to OGRPolyhedralSurface*.
Definition ogr_geometry.h:953
const OGRMultiSurface * toMultiSurface() const
Down-cast to OGRMultiSurface*.
Definition ogr_geometry.h:944
OGRPoint * toPoint()
Down-cast to OGRPoint*.
Definition ogr_geometry.h:652
virtual OGRGeometry * clone() const =0
Make a copy of this object.
virtual OGRErr transform(OGRCoordinateTransformation *poCT)=0
Apply arbitrary coordinate transformation to geometry.
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
virtual bool setCoordinateDimension(int nDimension)
Set the coordinate dimension.
Definition ogrgeometry.cpp:1096
bool operator!=(const OGRGeometry &other) const
Returns if two geometries are different.
Definition ogr_geometry.h:419
OGRTriangle * toTriangle()
Down-cast to OGRTriangle*.
Definition ogr_geometry.h:810
OGRLineString * toLineString()
Down-cast to OGRLineString*.
Definition ogr_geometry.h:705
int CoordinateDimension() const
Get the dimension of the coordinates in this object.
Definition ogrgeometry.cpp:974
const OGRLinearRing * toLinearRing() const
Down-cast to OGRLinearRing*.
Definition ogr_geometry.h:730
OGRGeometry * SetPrecision(double dfGridSize, int nFlags) const
Set the geometry's precision, rounding all its coordinates to the precision grid, and making sure the...
Definition ogrgeometry.cpp:6574
OGRGeometry * SimplifyPreserveTopology(double dTolerance) const
Simplify the geometry while preserving topology.
Definition ogrgeometry.cpp:6406
const OGRPoint * toPoint() const
Down-cast to OGRPoint*.
Definition ogr_geometry.h:660
virtual void swapXY()
Swap x and y coordinates.
Definition ogrgeometry.cpp:7035
virtual void empty()=0
Clear geometry information.
virtual OGRGeometry * Simplify(double dTolerance) const
Simplify the geometry.
Definition ogrgeometry.cpp:6328
virtual OGRBoolean Overlaps(const OGRGeometry *) const
Test for overlap.
Definition ogrgeometry.cpp:5959
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.
virtual OGRGeometry * DelaunayTriangulation(double dfTolerance, int bOnlyEdges) const
Return a Delaunay triangulation of the vertices of the geometry.
Definition ogrgeometry.cpp:6662
virtual int getCoordinateDimension() const
Get the dimension of the coordinates in this object.
Definition ogrgeometry.cpp:956
virtual OGRGeometry * ConcaveHull(double dfRatio, bool bAllowHoles) const
Compute "concave hull" of a geometry.
Definition ogrgeometry.cpp:4279
OGRMultiLineString * toMultiLineString()
Down-cast to OGRMultiLineString*.
Definition ogr_geometry.h:881
OGRMultiSurface * toMultiSurface()
Down-cast to OGRMultiSurface*.
Definition ogr_geometry.h:935
static OGRGeometry * FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
Definition ogr_geometry.h:644
virtual void flattenTo2D()=0
Convert geometry to strictly 2D.
virtual void accept(IOGRConstGeometryVisitor *visitor) const =0
Accept a visitor.
const OGRGeometryCollection * toGeometryCollection() const
Down-cast to OGRGeometryCollection*.
Definition ogr_geometry.h:854
virtual OGRBoolean IsValid() const
Test if the geometry is valid.
Definition ogrgeometry.cpp:2274
const OGRMultiLineString * toMultiLineString() const
Down-cast to OGRMultiLineString*.
Definition ogr_geometry.h:890
virtual OGRGeometry * Difference(const OGRGeometry *) const
Compute difference.
Definition ogrgeometry.cpp:5304
virtual OGRGeometry * MakeValid(CSLConstList papszOptions=nullptr) const
Attempts to make an invalid geometry valid without losing vertices.
Definition ogrgeometry.cpp:3896
virtual double Distance(const OGRGeometry *) const
Compute distance between two geometries.
Definition ogrgeometry.cpp:3538
virtual bool set3D(OGRBoolean bIs3D)
Add or remove the Z coordinate dimension.
Definition ogrgeometry.cpp:1119
OGRGeometry * UnaryUnion() const
Returns the union of all components of a single geometry.
Definition ogrgeometry.cpp:5200
virtual OGRBoolean Equals(const OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
virtual bool setMeasured(OGRBoolean bIsMeasured)
Add or remove the M coordinate dimension.
Definition ogrgeometry.cpp:1143
virtual int getDimension() const =0
Get the dimension of this object.
virtual OGRGeometry * ConvexHull() const
Compute convex hull.
Definition ogrgeometry.cpp:4160
const OGRCircularString * toCircularString() const
Down-cast to OGRCircularString*.
Definition ogr_geometry.h:748
virtual OGRGeometry * Buffer(double dfDist, int nQuadSegs=30) const
Compute buffer of geometry.
Definition ogrgeometry.cpp:4498
const OGRSpatialReference * getSpatialReference(void) const
Returns spatial reference system for object.
Definition ogr_geometry.h:535
virtual OGRGeometry * BuildArea() const
Polygonize a linework assuming inner polygons are holes.
Definition ogrgeometry.cpp:6960
OGRPolygon * toPolygon()
Down-cast to OGRPolygon*.
Definition ogr_geometry.h:793
bool operator==(const OGRGeometry &other) const
Returns if two geometries are equal.
Definition ogr_geometry.h:413
virtual OGRErr Centroid(OGRPoint *poPoint) const
Compute the geometry centroid.
Definition ogrgeometry.cpp:6076
OGRLinearRing * toLinearRing()
Down-cast to OGRLinearRing*.
Definition ogr_geometry.h:722
virtual OGRGeometry * UnionCascaded() const
Compute union using cascading.
Definition ogrgeometry.cpp:5102
OGRBoolean IsMeasured() const
Definition ogr_geometry.h:441
virtual OGRBoolean Within(const OGRGeometry *) const
Test for containment.
Definition ogrgeometry.cpp:5812
OGRGeometry & operator=(const OGRGeometry &other)
Assignment operator.
Definition ogrgeometry.cpp:142
virtual OGRGeometry * Union(const OGRGeometry *) const
Compute union.
Definition ogrgeometry.cpp:4986
virtual OGRGeometry * Polygonize() const
Polygonizes a set of sparse edges.
Definition ogrgeometry.cpp:6834
virtual void accept(IOGRGeometryVisitor *visitor)=0
Accept a visitor.
virtual double Distance3D(const OGRGeometry *poOtherGeom) const
Returns the 3D distance between two geometries.
Definition ogrgeometry.cpp:3668
virtual OGRGeometry * Normalize() const
Attempts to bring geometry into normalized/canonical form.
Definition ogrgeometry.cpp:4080
OGRMultiCurve * toMultiCurve()
Down-cast to OGRMultiCurve*.
Definition ogr_geometry.h:917
const OGRCompoundCurve * toCompoundCurve() const
Down-cast to OGRCompoundCurve*.
Definition ogr_geometry.h:766
virtual bool hasEmptyParts() const
Returns whether a geometry has empty parts/rings.
Definition ogrgeometry.cpp:8903
virtual OGRBoolean Disjoint(const OGRGeometry *) const
Test for disjointness.
Definition ogrgeometry.cpp:5558
virtual OGRGeometry * SymDifference(const OGRGeometry *) const
Compute symmetric difference.
Definition ogrgeometry.cpp:5423
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
OGRGeometryCollection * toGeometryCollection()
Down-cast to OGRGeometryCollection*.
Definition ogr_geometry.h:845
virtual char * exportToKML() const
Convert a geometry into KML format.
Definition ogrgeometry.cpp:3139
virtual OGRGeometry * Boundary() const
Compute boundary.
Definition ogrgeometry.cpp:4374
virtual char * exportToGML(const char *const *papszOptions=nullptr) const
Convert a geometry into GML format.
Definition ogrgeometry.cpp:3116
OGRErr transformTo(const OGRSpatialReference *poSR)
Transform geometry to new spatial reference system.
Definition ogrgeometry.cpp:692
virtual OGRBoolean Touches(const OGRGeometry *) const
Test for touching.
Definition ogrgeometry.cpp:5631
OGRMultiPolygon * toMultiPolygon()
Down-cast to OGRMultiPolygon*.
Definition ogr_geometry.h:899
const OGRPolygon * toPolygon() const
Down-cast to OGRPolygon*.
Definition ogr_geometry.h:802
OGRCompoundCurve * toCompoundCurve()
Down-cast to OGRCompoundCurve*.
Definition ogr_geometry.h:757
OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const
Convert a geometry into well known binary format.
Definition ogrgeometry.cpp:1589
OGRwkbGeometryType getIsoGeometryType() const
Get the geometry type that conforms with ISO SQL/MM Part3.
Definition ogrgeometry.cpp:847
OGRErr importFromWkt(char **ppszInput)
Deprecated.
Definition ogr_geometry.h:468
const OGRLineString * toLineString() const
Down-cast to OGRLineString*.
Definition ogr_geometry.h:714
OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const
Convert a geometry into well known text format.
Definition ogrgeometry.cpp:1961
virtual bool segmentize(double dfMaxLength)
Modify the geometry such it has no segment longer then the given distance.
Definition ogrgeometry.cpp:880
void roundCoordinatesIEEE754(const OGRGeomCoordinateBinaryPrecision &options)
Round coordinates of a geometry, exploiting characteristics of the IEEE-754 double-precision binary r...
Definition ogrgeometry.cpp:8440
virtual size_t WkbSize() const =0
Returns size of related binary representation.
OGRCircularString * toCircularString()
Down-cast to OGRCircularString*.
Definition ogr_geometry.h:739
virtual void removeEmptyParts()
Remove empty parts/rings from this geometry.
Definition ogrgeometry.cpp:8917
const OGRCurve * toCurve() const
Down-cast to OGRCurve*.
Definition ogr_geometry.h:678
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const
Return, possibly approximate, non-curve version of this geometry.
Definition ogrgeometry.cpp:3477
OGRCurvePolygon * toCurvePolygon()
Down-cast to OGRCurvePolygon*.
Definition ogr_geometry.h:827
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition ogr_geometry.h:696
static GEOSContextHandle_t createGEOSContext()
Create a new GEOS context.
Definition ogrgeometry.cpp:3221
virtual OGRBoolean Crosses(const OGRGeometry *) const
Test for crossing.
Definition ogrgeometry.cpp:5705
OGRErr importFromWkb(const GByte *, size_t=static_cast< size_t >(-1), OGRwkbVariant=wkbVariantOldOgc)
Assign geometry from well known binary data.
Definition ogrgeometry.cpp:1495
virtual OGRGeometry * Intersection(const OGRGeometry *) const
Compute intersection.
Definition ogrgeometry.cpp:4867
static OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
Definition ogr_geometry.h:637
virtual OGRBoolean Contains(const OGRGeometry *) const
Test for containment.
Definition ogrgeometry.cpp:5885
void dumpReadable(FILE *, const char *=nullptr, CSLConstList papszOptions=nullptr) const
Dump geometry in well known text format to indicated output file.
Definition ogrgeometry.cpp:195
OGRBoolean Is3D() const
Definition ogr_geometry.h:435
OGRMultiPoint * toMultiPoint()
Down-cast to OGRMultiPoint*.
Definition ogr_geometry.h:863
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
virtual void closeRings()
Force rings to be closed.
Definition ogrgeometry.cpp:6020
const OGRTriangulatedSurface * toTriangulatedSurface() const
Down-cast to OGRTriangulatedSurface*.
Definition ogr_geometry.h:978
const OGRTriangle * toTriangle() const
Down-cast to OGRTriangle*.
Definition ogr_geometry.h:818
virtual char * exportToJson(CSLConstList papszOptions=nullptr) const
Convert a geometry into GeoJSON format.
Definition ogrgeometry.cpp:3170
OGRSurface * toSurface()
Down-cast to OGRSurface*.
Definition ogr_geometry.h:775
virtual void assignSpatialReference(const OGRSpatialReference *poSR)
Assign spatial reference to this object.
Definition ogrgeometry.cpp:499
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition ogr_geometry.h:687
OGRTriangulatedSurface * toTriangulatedSurface()
Down-cast to OGRTriangulatedSurface*.
Definition ogr_geometry.h:970
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:669
virtual OGRGeometry * BufferEx(double dfDist, CSLConstList papszOptions) const
Compute buffer of geometry.
Definition ogrgeometry.cpp:4609
virtual OGRBoolean IsSimple() const
Test if the geometry is simple.
Definition ogrgeometry.cpp:2393
Definition ogr_geometry.h:1427
void setZ(double zIn)
Set z.
Definition ogrcurve.cpp:492
void setY(double yIn)
Set y.
Definition ogrcurve.cpp:486
void setM(double mIn)
Set m.
Definition ogrcurve.cpp:498
~OGRIteratedPoint() override
Destructor.
void setX(double xIn)
Set x.
Definition ogrcurve.cpp:480
Concrete representation of a multi-vertex line.
Definition ogr_geometry.h:1726
virtual double get_GeodesicLength(const OGRSpatialReference *poSRSOverride=nullptr) const override
Get the length of the curve, considered as a geodesic line on the underlying ellipsoid of the SRS att...
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:1770
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:1786
const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition ogrlinestring.cpp:2957
OGRLineString & operator=(const OGRLineString &other)
Assignment operator.
Definition ogrlinestring.cpp:2908
OGRLineString(const OGRLineString &other)
Copy constructor.
double get_Area() const override
Get the area of the (closed) curve.
OGRLineString(OGRLineString &&other)
Move constructor.
virtual double get_GeodesicArea(const OGRSpatialReference *poSRSOverride=nullptr) const override
Get the area of the (closed) curve, considered as a surface on the underlying ellipsoid of the SRS at...
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return a linestring from a curve geometry.
Definition ogrlinestring.cpp:2967
int isClockwise() const override
Returns TRUE if the ring has clockwise winding (or less than 2 points).
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:1781
OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition ogrlinestring.cpp:2940
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=nullptr) const override
Return curve version of this geometry.
Definition ogrlinestring.cpp:3019
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:1776
OGRLineString()=default
Create an empty line string.
static OGRLinearRing * CastToLinearRing(OGRLineString *poLS)
Cast to linear ring.
Definition ogrlinestring.cpp:3065
OGRLineString * clone() const override
Make a copy of this object.
Definition ogrlinestring.cpp:3083
Concrete representation of a closed ring.
Definition ogr_geometry.h:1820
OGRLineString * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:1880
static OGRLineString * CastToLineString(OGRLinearRing *poLR)
Cast to line string.
Definition ogrlinearring.cpp:648
OGRLinearRing()=default
Constructor.
OGRLinearRing * clone() const override
Make a copy of this object.
Definition ogrlinearring.cpp:396
OGRLinearRing & operator=(OGRLinearRing &&other)=default
Move assignment operator.
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:1896
const OGRLineString * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:1886
const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition ogrlinearring.cpp:88
OGRLinearRing(const OGRLinearRing &other)
Copy constructor.
OGRLinearRing & operator=(const OGRLinearRing &other)
Assignment operator.
Definition ogrlinearring.cpp:75
OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition ogrlinearring.cpp:612
void closeRings() override
Force rings to be closed.
Definition ogrlinearring.cpp:427
OGRLinearRing(OGRLinearRing &&other)=default
Move constructor.
OGRBoolean isPointOnRingBoundary(const OGRPoint *pt, int bTestEnvelope=TRUE) const
Returns whether the point is on the ring boundary.
Definition ogrlinearring.cpp:533
OGRBoolean isPointInRing(const OGRPoint *pt, int bTestEnvelope=TRUE) const
Returns whether the point is inside the ring.
Definition ogrlinearring.cpp:452
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:1891
A collection of OGRCurve.
Definition ogr_geometry.h:3903
const ChildType *const * begin() const
Return begin of iterator.
Definition ogr_geometry.h:3941
OGRMultiCurve()=default
Create an empty multi curve collection.
const ChildType *const * end() const
Return end of iterator.
Definition ogr_geometry.h:3947
ChildType ** end()
Return end of iterator.
Definition ogr_geometry.h:3934
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:4012
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:4002
OGRMultiCurve & operator=(OGRMultiCurve &&other)=default
Move assignment operator.
const OGRCurve * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef().
Definition ogr_geometry.h:3961
OGRCurve * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef().
Definition ogr_geometry.h:3955
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:4007
OGRMultiCurve(const OGRMultiCurve &other)
Copy constructor.
OGRMultiCurve & operator=(const OGRMultiCurve &other)
Assignment operator.
Definition ogrmulticurve.cpp:41
OGRCurve ChildType
Type of child elements.
Definition ogr_geometry.h:3924
ChildType ** begin()
Return begin of iterator.
Definition ogr_geometry.h:3928
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:3996
OGRMultiCurve(OGRMultiCurve &&other)=default
Move constructor.
OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition ogrmulticurve.cpp:111
A collection of OGRLineString.
Definition ogr_geometry.h:4062
OGRMultiLineString & operator=(const OGRMultiLineString &other)
Assignment operator.
Definition ogrmultilinestring.cpp:42
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:4161
OGRLineString ChildType
Type of child elements.
Definition ogr_geometry.h:4079
OGRLineString * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef().
Definition ogr_geometry.h:4110
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:4145
ChildType ** end()
Return end of iterator.
Definition ogr_geometry.h:4089
OGRMultiLineString()=default
Create an empty multi line string collection.
OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition ogrmultilinestring.cpp:102
const ChildType *const * end() const
Return end of iterator.
Definition ogr_geometry.h:4102
const ChildType *const * begin() const
Return begin of iterator.
Definition ogr_geometry.h:4096
OGRMultiLineString(OGRMultiLineString &&other)=default
Move constructor.
const OGRLineString * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef().
Definition ogr_geometry.h:4116
ChildType ** begin()
Return begin of iterator.
Definition ogr_geometry.h:4083
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:4151
OGRMultiLineString & operator=(OGRMultiLineString &&other)=default
Move assignment operator.
OGRMultiLineString(const OGRMultiLineString &other)
Copy constructor.
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:4156
A collection of OGRPoint.
Definition ogr_geometry.h:3745
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:3833
OGRMultiPoint & operator=(OGRMultiPoint &&other)=default
Move assignment operator.
OGRMultiPoint()=default
Create an empty multi point collection.
const ChildType *const * end() const
Return end of iterator.
Definition ogr_geometry.h:3788
ChildType ** begin()
Return begin of iterator.
Definition ogr_geometry.h:3769
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:3849
OGRMultiPoint(const OGRMultiPoint &other)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition ogr_geometry.h:3782
OGRMultiPoint(OGRMultiPoint &&other)=default
Move constructor.
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:3839
OGRPoint ChildType
Type of child elements.
Definition ogr_geometry.h:3765
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:3844
const OGRPoint * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef().
Definition ogr_geometry.h:3802
OGRMultiPoint & operator=(const OGRMultiPoint &other)
Assignment operator.
Definition ogrmultipoint.cpp:46
OGRPoint * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef().
Definition ogr_geometry.h:3796
ChildType ** end()
Return end of iterator.
Definition ogr_geometry.h:3775
OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition ogrmultipoint.cpp:107
A collection of non-overlapping OGRPolygon.
Definition ogr_geometry.h:3259
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:3363
OGRPolygon ChildType
Type of child elements.
Definition ogr_geometry.h:3286
OGRMultiPolygon(const OGRMultiPolygon &other)
Copy constructor.
OGRMultiPolygon & operator=(OGRMultiPolygon &&other)=default
Move assignment operator.
OGRPolygon * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef().
Definition ogr_geometry.h:3317
OGRMultiPolygon()=default
Create an empty multi polygon collection.
const OGRPolygon * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef().
Definition ogr_geometry.h:3323
const ChildType *const * end() const
Return end of iterator.
Definition ogr_geometry.h:3309
OGRMultiPolygon & operator=(const OGRMultiPolygon &other)
Assignment operator.
Definition ogrmultipolygon.cpp:39
OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition ogrmultipolygon.cpp:99
ChildType ** end()
Return end of iterator.
Definition ogr_geometry.h:3296
OGRMultiPolygon(OGRMultiPolygon &&other)=default
Move constructor.
ChildType ** begin()
Return begin of iterator.
Definition ogr_geometry.h:3290
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:3352
const ChildType *const * begin() const
Return begin of iterator.
Definition ogr_geometry.h:3303
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:3368
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:3358
A collection of non-overlapping OGRSurface.
Definition ogr_geometry.h:3099
const OGRSurface * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef().
Definition ogr_geometry.h:3181
OGRMultiSurface & operator=(OGRMultiSurface &&other)=default
Move assignment operator.
ChildType ** begin()
Return begin of iterator.
Definition ogr_geometry.h:3120
OGRSurface ChildType
Type of child elements.
Definition ogr_geometry.h:3116
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:3197
const ChildType *const * begin() const
Return begin of iterator.
Definition ogr_geometry.h:3133
const ChildType *const * end() const
Return end of iterator.
Definition ogr_geometry.h:3139
OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition ogrmultisurface.cpp:112
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:3207
OGRMultiSurface(const OGRMultiSurface &other)
Copy constructor.
OGRMultiSurface & operator=(const OGRMultiSurface &other)
Assignment operator.
Definition ogrmultisurface.cpp:42
OGRMultiSurface()=default
Create an empty multi surface collection.
OGRMultiSurface(OGRMultiSurface &&other)=default
Move constructor.
ChildType ** end()
Return end of iterator.
Definition ogr_geometry.h:3126
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:3202
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:3191
OGRSurface * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef().
Definition ogr_geometry.h:3175
Interface for a point iterator.
Definition ogr_geometry.h:1260
virtual OGRBoolean getNextPoint(OGRPoint *p)=0
Returns the next point followed by the iterator.
static void destroy(OGRPointIterator *)
Destroys a point iterator.
Definition ogrcurve.cpp:469
Point class.
Definition ogr_geometry.h:1095
double getM() const
Return m.
Definition ogr_geometry.h:1171
void setX(double xIn)
Set x.
Definition ogr_geometry.h:1182
OGRPoint & operator=(const OGRPoint &other)
Assignment operator.
Definition ogrpoint.cpp:141
OGRErr importFromWkt(const char **) override
deprecated
Definition ogrpoint.cpp:475
static OGRPoint * createXYM(double x, double y, double m)
Create a XYM point.
Definition ogrpoint.cpp:116
OGRPoint(const OGRPoint &other)
Copy constructor.
OGRPoint & operator=(OGRPoint &&other)=default
Move assignment operator.
void setZ(double zIn)
Set z.
Definition ogr_geometry.h:1206
void setM(double mIn)
Set m.
Definition ogr_geometry.h:1215
int getDimension() const override
Get the dimension of this object.
Definition ogrpoint.cpp:187
double getX() const
Return x.
Definition ogr_geometry.h:1153
void empty() override
Clear geometry information.
Definition ogrpoint.cpp:173
OGRErr exportToWkb(unsigned char *, const OGRwkbExportOptions *=nullptr) const override
Convert a geometry into well known binary format.
Definition ogrpoint.cpp:355
OGRPoint * clone() const override
Make a copy of this object.
Definition ogrpoint.cpp:164
OGRPoint()
Create an empty point.
Definition ogrpoint.cpp:48
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:1232
OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition ogr_geometry.h:1146
size_t WkbSize() const override
Returns size of related binary representation.
Definition ogrpoint.cpp:256
void setY(double yIn)
Set y.
Definition ogr_geometry.h:1194
double getZ() const
Return z.
Definition ogr_geometry.h:1165
void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition ogrpoint.cpp:587
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:1237
double getY() const
Return y.
Definition ogr_geometry.h:1159
OGRPoint(OGRPoint &&other)=default
Move constructor.
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a point to WKT.
Definition ogrpoint.cpp:561
OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition ogrpoint.cpp:274
Concrete class representing polygons.
Definition ogr_geometry.h:2635
OGRPolygon & operator=(OGRPolygon &&other)=default
Move assignment operator.
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:2771
OGRLinearRing ChildType
Type of child elements.
Definition ogr_geometry.h:2675
ChildType ** begin()
Return begin of iterator.
Definition ogr_geometry.h:2679
OGRPolygon(OGRPolygon &&other)=default
Move constructor.
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:2766
const OGRCurvePolygon * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:2761
ChildType ** end()
Return end of iterator.
Definition ogr_geometry.h:2685
OGRPolygon(const OGRPolygon &other)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition ogr_geometry.h:2692
OGRPolygon & operator=(const OGRPolygon &other)
Assignment operator.
Definition ogrpolygon.cpp:85
OGRPolygon()=default
Create an empty polygon.
const ChildType *const * end() const
Return end of iterator.
Definition ogr_geometry.h:2698
OGRCurvePolygon * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:2755
PolyhedralSurface class.
Definition ogr_geometry.h:3418
ChildType ** end()
Return end of iterator.
Definition ogr_geometry.h:3460
const ChildType *const * end() const
Return end of iterator.
Definition ogr_geometry.h:3473
OGRPolyhedralSurface(const OGRPolyhedralSurface &other)
Copy constructor.
OGRPolygon * getGeometryRef(int i)
Fetch geometry from container.
Definition ogrpolyhedralsurface.cpp:862
OGRPolyhedralSurface & operator=(const OGRPolyhedralSurface &other)
Assignment operator.
Definition ogrpolyhedralsurface.cpp:44
const ChildType *const * begin() const
Return begin of iterator.
Definition ogr_geometry.h:3467
OGRPolyhedralSurface(OGRPolyhedralSurface &&other)=default
Move constructor.
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:3546
ChildType ** begin()
Return begin of iterator.
Definition ogr_geometry.h:3454
OGRPolyhedralSurface()=default
Create an empty PolyhedralSurface.
virtual OGRErr addGeometry(const OGRGeometry *)
Add a new geometry to a collection.
Definition ogrpolyhedralsurface.cpp:744
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:3551
OGRPolygon ChildType
Type of child elements.
Definition ogr_geometry.h:3450
OGRPolyhedralSurface & operator=(OGRPolyhedralSurface &&other)=default
Move assignment operator.
Simple container for a position.
Definition ogr_geometry.h:89
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition ogr_geometry.h:97
double x
x
Definition ogr_geometry.h:102
double y
y
Definition ogr_geometry.h:104
OGRRawPoint()
Constructor.
Definition ogr_geometry.h:92
Abstract curve base class for OGRLineString and OGRCircularString.
Definition ogr_geometry.h:1473
double getY(int i) const
Get Y at vertex.
Definition ogr_geometry.h:1626
double getX(int i) const
Get X at vertex.
Definition ogr_geometry.h:1621
size_t WkbSize() const override
Returns size of related binary representation.
Definition ogrlinestring.cpp:216
virtual double get_LinearArea() const
Compute area of ring / closed linestring.
Definition ogrlinestring.cpp:2989
virtual double Project(const OGRPoint *) const
Project point on linestring.
Definition ogrlinestring.cpp:2184
virtual OGRLineString * getSubLine(double, double, int) const
Get the portion of linestring.
Definition ogrlinestring.cpp:2237
OGRSimpleCurve()=default
Constructor.
OGRErr importFromWkt(const char **) override
deprecated
Definition ogrlinestring.cpp:1897
void Value(double, OGRPoint *) const override
Fetch point at given distance along curve.
Definition ogrlinestring.cpp:2119
virtual OGRErr exportToWkb(unsigned char *, const OGRwkbExportOptions *=nullptr) const override
Convert a geometry into well known binary format.
Definition ogrlinestring.cpp:1768
OGRSimpleCurve * clone() const override=0
Make a copy of this object.
OGRPoint ChildType
Type of child elements.
Definition ogr_geometry.h:1550
void EndPoint(OGRPoint *) const override
Return the curve end point.
Definition ogrlinestring.cpp:2107
void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition ogrlinestring.cpp:2424
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition ogrlinestring.cpp:1656
double get_Length() const override
Returns the length of the curve.
Definition ogrlinestring.cpp:2077
void StartPoint(OGRPoint *) const override
Return the curve start point.
Definition ogrlinestring.cpp:2097
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a simple curve to WKT.
Definition ogrlinestring.cpp:2020
void empty() override
Clear geometry information.
Definition ogrlinestring.cpp:168
int getNumPoints() const override
Fetch vertex count.
Definition ogr_geometry.h:1614
OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition ogrlinestring.cpp:2639
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:152
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition ogr_geometry.h:2370
virtual double get_GeodesicLength(const OGRSpatialReference *poSRSOverride=nullptr) const =0
Get the length of the surface, where curve edges are geodesic lines on the underlying ellipsoid of th...
virtual double get_GeodesicArea(const OGRSpatialReference *poSRSOverride=nullptr) const =0
Get the area of the surface object, considered as a surface on the underlying ellipsoid of the SRS at...
virtual double get_Area() const =0
Get the area of the surface object.
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition ogrsurface.cpp:81
OGRSurface * clone() const override=0
Make a copy of this object.
virtual double get_Length() const =0
Get the length of the surface.
Triangle class.
Definition ogr_geometry.h:2819
OGRTriangle()=default
Constructor.
OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition ogrtriangle.cpp:128
const OGRPolygon * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:2864
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition ogrtriangle.cpp:155
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:2874
OGRErr addRingDirectly(OGRCurve *poNewRing) override
Add a ring to a polygon.
Definition ogrtriangle.cpp:208
OGRTriangle(OGRTriangle &&other)=default
Move constructor.
OGRPolygon * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:2858
OGRTriangle & operator=(OGRTriangle &&other)=default
Move assignment operator.
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:2869
OGRTriangle(const OGRTriangle &other)
Copy constructor.
OGRTriangle * clone() const override
Make a copy of this object.
Definition ogrtriangle.cpp:109
OGRTriangle & operator=(const OGRTriangle &other)
Assignment operator.
Definition ogrtriangle.cpp:96
const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition ogrtriangle.cpp:119
TriangulatedSurface class.
Definition ogr_geometry.h:3602
const OGRTriangle * getGeometryRef(int i) const
See OGRPolyhedralSurface::getGeometryRef().
Definition ogr_geometry.h:3666
OGRTriangle * getGeometryRef(int i)
See OGRPolyhedralSurface::getGeometryRef().
Definition ogr_geometry.h:3660
OGRTriangulatedSurface & operator=(const OGRTriangulatedSurface &other)
Assignment operator.
Definition ogrtriangulatedsurface.cpp:44
OGRTriangulatedSurface(OGRTriangulatedSurface &&other)=default
Move constructor.
const ChildType *const * end() const
Return end of iterator.
Definition ogr_geometry.h:3650
const ChildType *const * begin() const
Return begin of iterator.
Definition ogr_geometry.h:3644
OGRPolyhedralSurface * toUpperClass()
Return pointer of this in upper class.
Definition ogr_geometry.h:3679
const OGRPolyhedralSurface * toUpperClass() const
Return pointer of this in upper class.
Definition ogr_geometry.h:3685
void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition ogr_geometry.h:3695
OGRTriangulatedSurface & operator=(OGRTriangulatedSurface &&other)=default
Move assignment operator.
OGRTriangle ChildType
Type of child elements.
Definition ogr_geometry.h:3627
OGRTriangulatedSurface()=default
Constructor.
ChildType ** begin()
Return begin of iterator.
Definition ogr_geometry.h:3631
ChildType ** end()
Return end of iterator.
Definition ogr_geometry.h:3637
void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition ogr_geometry.h:3690
Options for formatting WKT output.
Definition ogr_geometry.h:46
int mPrecision
Precision of output for M coordinates. Interpretation depends on format.
Definition ogr_geometry.h:55
OGRwkbVariant variant
Type of WKT output to produce.
Definition ogr_geometry.h:49
int zPrecision
Precision of output for Z coordinates. Interpretation depends on format.
Definition ogr_geometry.h:53
OGRWktOptions()
Constructor.
Definition ogr_geometry.h:62
static bool getDefaultRound()
Return default rounding mode.
Definition ogrgeometry.cpp:81
OGRWktOptions(const OGRWktOptions &)=default
Copy constructor.
int xyPrecision
Precision of output for X,Y coordinates. Interpretation depends on format.
Definition ogr_geometry.h:51
static int getDefaultPrecision()
Return default precision.
Definition ogrgeometry.cpp:76
bool round
Whether GDAL-special rounding should be applied.
Definition ogr_geometry.h:57
OGRWktOptions(int xyPrecisionIn, bool roundIn)
Constructor.
Definition ogr_geometry.h:69
OGRWktFormat format
Formatting type.
Definition ogr_geometry.h:59
Various convenience functions for CPL.
To down_cast(From *f)
Use cpl::down_cast<Derived*>(pointer_to_base) as equivalent of static_cast<Derived*>(pointer_to_base)...
Definition cpl_conv.h:496
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:936
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1087
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition cpl_port.h:870
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:175
Forward definitions of GDAL/OGR/OSR C handle types.
void * OGRGeometryH
Opaque type for a geometry.
Definition gdal_fwd.h:96
struct OGRwkbExportOptions OGRwkbExportOptions
Opaque type for WKB export options.
Definition gdal_fwd.h:106
Core portability services for cross-platform OGR code.
int OGRBoolean
Type for a OGR boolean.
Definition ogr_core.h:386
OGRwkbByteOrder
Enumeration to describe byte order.
Definition ogr_core.h:607
@ wkbNDR
LSB/Intel/Vax: Least Significant Byte First.
Definition ogr_core.h:609
OGRwkbVariant
Output variants of WKB we support.
Definition ogr_core.h:540
@ wkbVariantOldOgc
Old-style 99-402 extended dimension (Z) WKB types.
Definition ogr_core.h:541
OGRwkbGeometryType
List of well known binary geometry types.
Definition ogr_core.h:405
int OGRErr
Type for a OGR error.
Definition ogr_core.h:370
Geometry coordinate precision class.
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType, bool bCamelCase=false, bool bAddZM=false, bool bSpaceBeforeZM=false)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition ogrgeometry.cpp:2605
OGRWktFormat
WKT Output formatting options.
Definition ogr_geometry.h:38
@ Default
Format as F when abs(value) < 1, otherwise as G.
Definition ogr_geometry.h:41
@ F
F-type formatting.
Definition ogr_geometry.h:39
@ G
G-type formatting.
Definition ogr_geometry.h:40
std::unique_ptr< OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter > OGRPreparedGeometryUniquePtr
Unique pointer type for OGRPreparedGeometry.
Definition ogr_geometry.h:4346
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
Definition ogr_geometry.h:110
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGC geometry format type to corresponding OGR constants.
Definition ogrgeometry.cpp:2526
std::unique_ptr< OGRGeometry, OGRGeometryUniquePtrDeleter > OGRGeometryUniquePtr
Unique pointer type for OGRGeometry.
Definition ogr_geometry.h:995
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition ogr_geometry.h:108
void sfcgal_geometry_t
SFCGAL geometry type.
Definition ogr_geometry.h:112
Coordinate systems services.
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition ogrsf_frmts.h:470
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition ogrsf_frmts.h:478
Geometry coordinate precision.
Definition ogr_geomcoordinateprecision.h:40
WKB export options.
Definition ogr_geometry.h:326
OGRwkbByteOrder eByteOrder
Byte order.
Definition ogr_geometry.h:327
OGRwkbVariant eWkbVariant
WKB variant.
Definition ogr_geometry.h:328
OGRGeomCoordinateBinaryPrecision sPrecision
Binary precision.
Definition ogr_geometry.h:329