GDAL

ogr_geometry.h
Go to the documentation of this file.
1 /******************************************************************************
2 * $Id$
3 *
4 * Project: OpenGIS Simple Features Reference Implementation
5 * Purpose: Classes for manipulating simple features that is not specific
6 * to a particular interface technology.
7 * Author: Frank Warmerdam, warmerdam@pobox.com
8 *
9 ******************************************************************************
10 * Copyright (c) 1999, Frank Warmerdam
11 * Copyright (c) 2008-2014, Even Rouault <even dot rouault at spatialys.com>
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included
21 * in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 ****************************************************************************/
31
32 #ifndef OGR_GEOMETRY_H_INCLUDED
33 #define OGR_GEOMETRY_H_INCLUDED
34
35 #include "cpl_conv.h"
36 #include "cpl_json.h"
37 #include "ogr_core.h"
38 #include "ogr_spatialref.h"
39
40 #include <cmath>
41 #include <memory>
42
50 #ifndef DEFINEH_OGRGeometryH
51 #define DEFINEH_OGRGeometryH
52 #ifdef DEBUG
53 typedef struct OGRGeometryHS *OGRGeometryH;
54 #else
55 typedef void *OGRGeometryH;
56 #endif
57 #endif /* DEFINEH_OGRGeometryH */
58
60 enum class OGRWktFormat
62 {
63 F,
64 G,
65 Default
66 };
67
69 struct CPL_DLL OGRWktOptions
70 {
71 public:
73 OGRwkbVariant variant;
75 int precision;
77 bool round;
79 OGRWktFormat format;
80
82 OGRWktOptions()
83 : variant(wkbVariantOldOgc), precision(15), round(true),
84 format(OGRWktFormat::Default)
85 {
86 static int defPrecision = getDefaultPrecision();
87 static bool defRound = getDefaultRound();
88
89 precision = defPrecision;
90 round = defRound;
91 }
92
94 OGRWktOptions(const OGRWktOptions &) = default;
95
96 private:
97 static int getDefaultPrecision();
98 static bool getDefaultRound();
99 };
100
104 class OGRRawPoint
105 {
106 public:
108 OGRRawPoint() : x(0.0), y(0.0)
109 {
110 }
111
113 OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn)
114 {
115 }
116
118 double x;
120 double y;
121 };
122
124 typedef struct GEOSGeom_t *GEOSGeom;
126 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
128 typedef void sfcgal_geometry_t;
129
130 class OGRPoint;
131 class OGRCurve;
132 class OGRCompoundCurve;
133 class OGRSimpleCurve;
134 class OGRLinearRing;
135 class OGRLineString;
136 class OGRCircularString;
137 class OGRSurface;
138 class OGRCurvePolygon;
139 class OGRPolygon;
140 class OGRMultiPoint;
141 class OGRMultiSurface;
142 class OGRMultiPolygon;
143 class OGRMultiCurve;
144 class OGRMultiLineString;
145 class OGRGeometryCollection;
146 class OGRTriangle;
147 class OGRPolyhedralSurface;
148 class OGRTriangulatedSurface;
149
151 typedef OGRLineString *(*OGRCurveCasterToLineString)(OGRCurve *);
152 typedef OGRLinearRing *(*OGRCurveCasterToLinearRing)(OGRCurve *);
153
154 typedef OGRPolygon *(*OGRSurfaceCasterToPolygon)(OGRSurface *);
155 typedef OGRCurvePolygon *(*OGRSurfaceCasterToCurvePolygon)(OGRSurface *);
156 typedef OGRMultiPolygon *(*OGRPolyhedralSurfaceCastToMultiPolygon)(
157 OGRPolyhedralSurface *);
159
163 class CPL_DLL IOGRGeometryVisitor
164 {
165 public:
167 virtual ~IOGRGeometryVisitor() = default;
168
170 virtual void visit(OGRPoint *) = 0;
172 virtual void visit(OGRLineString *) = 0;
174 virtual void visit(OGRLinearRing *) = 0;
176 virtual void visit(OGRPolygon *) = 0;
178 virtual void visit(OGRMultiPoint *) = 0;
180 virtual void visit(OGRMultiLineString *) = 0;
182 virtual void visit(OGRMultiPolygon *) = 0;
184 virtual void visit(OGRGeometryCollection *) = 0;
186 virtual void visit(OGRCircularString *) = 0;
188 virtual void visit(OGRCompoundCurve *) = 0;
190 virtual void visit(OGRCurvePolygon *) = 0;
192 virtual void visit(OGRMultiCurve *) = 0;
194 virtual void visit(OGRMultiSurface *) = 0;
196 virtual void visit(OGRTriangle *) = 0;
198 virtual void visit(OGRPolyhedralSurface *) = 0;
200 virtual void visit(OGRTriangulatedSurface *) = 0;
201 };
202
210 class CPL_DLL OGRDefaultGeometryVisitor : public IOGRGeometryVisitor
211 {
212 void _visit(OGRSimpleCurve *poGeom);
213
214 public:
215 void visit(OGRPoint *) override
216 {
217 }
218 void visit(OGRLineString *) override;
219 void visit(OGRLinearRing *) override;
220 void visit(OGRPolygon *) override;
221 void visit(OGRMultiPoint *) override;
222 void visit(OGRMultiLineString *) override;
223 void visit(OGRMultiPolygon *) override;
224 void visit(OGRGeometryCollection *) override;
225 void visit(OGRCircularString *) override;
226 void visit(OGRCompoundCurve *) override;
227 void visit(OGRCurvePolygon *) override;
228 void visit(OGRMultiCurve *) override;
229 void visit(OGRMultiSurface *) override;
230 void visit(OGRTriangle *) override;
231 void visit(OGRPolyhedralSurface *) override;
232 void visit(OGRTriangulatedSurface *) override;
233 };
234
238 class CPL_DLL IOGRConstGeometryVisitor
239 {
240 public:
242 virtual ~IOGRConstGeometryVisitor() = default;
243
245 virtual void visit(const OGRPoint *) = 0;
247 virtual void visit(const OGRLineString *) = 0;
249 virtual void visit(const OGRLinearRing *) = 0;
251 virtual void visit(const OGRPolygon *) = 0;
253 virtual void visit(const OGRMultiPoint *) = 0;
255 virtual void visit(const OGRMultiLineString *) = 0;
257 virtual void visit(const OGRMultiPolygon *) = 0;
259 virtual void visit(const OGRGeometryCollection *) = 0;
261 virtual void visit(const OGRCircularString *) = 0;
263 virtual void visit(const OGRCompoundCurve *) = 0;
265 virtual void visit(const OGRCurvePolygon *) = 0;
267 virtual void visit(const OGRMultiCurve *) = 0;
269 virtual void visit(const OGRMultiSurface *) = 0;
271 virtual void visit(const OGRTriangle *) = 0;
273 virtual void visit(const OGRPolyhedralSurface *) = 0;
275 virtual void visit(const OGRTriangulatedSurface *) = 0;
276 };
277
285 class CPL_DLL OGRDefaultConstGeometryVisitor : public IOGRConstGeometryVisitor
286 {
287 void _visit(const OGRSimpleCurve *poGeom);
288
289 public:
290 void visit(const OGRPoint *) override
291 {
292 }
293 void visit(const OGRLineString *) override;
294 void visit(const OGRLinearRing *) override;
295 void visit(const OGRPolygon *) override;
296 void visit(const OGRMultiPoint *) override;
297 void visit(const OGRMultiLineString *) override;
298 void visit(const OGRMultiPolygon *) override;
299 void visit(const OGRGeometryCollection *) override;
300 void visit(const OGRCircularString *) override;
301 void visit(const OGRCompoundCurve *) override;
302 void visit(const OGRCurvePolygon *) override;
303 void visit(const OGRMultiCurve *) override;
304 void visit(const OGRMultiSurface *) override;
305 void visit(const OGRTriangle *) override;
306 void visit(const OGRPolyhedralSurface *) override;
307 void visit(const OGRTriangulatedSurface *) override;
308 };
309
310 /************************************************************************/
311 /* OGRGeometry */
312 /************************************************************************/
313
334 class CPL_DLL OGRGeometry
335 {
336 private:
337 const OGRSpatialReference *poSRS = nullptr; // may be NULL
338
339 protected:
341 friend class OGRCurveCollection;
342
343 unsigned int flags = 0;
344
345 OGRErr importPreambleFromWkt(const char **ppszInput, int *pbHasZ,
346 int *pbHasM, bool *pbIsEmpty);
347 OGRErr importCurveCollectionFromWkt(
348 const char **ppszInput, int bAllowEmptyComponent, int bAllowLineString,
349 int bAllowCurve, int bAllowCompoundCurve,
350 OGRErr (*pfnAddCurveDirectly)(OGRGeometry *poSelf, OGRCurve *poCurve));
351 OGRErr importPreambleFromWkb(const unsigned char *pabyData, size_t nSize,
352 OGRwkbByteOrder &eByteOrder,
353 OGRwkbVariant eWkbVariant);
354 OGRErr importPreambleOfCollectionFromWkb(const unsigned char *pabyData,
355 size_t &nSize, size_t &nDataOffset,
356 OGRwkbByteOrder &eByteOrder,
357 size_t nMinSubGeomSize,
358 int &nGeomCount,
359 OGRwkbVariant eWkbVariant);
360 OGRErr PointOnSurfaceInternal(OGRPoint *poPoint) const;
361 OGRBoolean IsSFCGALCompatible() const;
362
363 void HomogenizeDimensionalityWith(OGRGeometry *poOtherGeom);
364 std::string wktTypeString(OGRwkbVariant variant) const;
365
367
368 public:
369 /************************************************************************/
370 /* Bit flags for OGRGeometry */
371 /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
372 /* Do not use these outside of the core. */
373 /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
374 /************************************************************************/
375
377 static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
378 static const unsigned int OGR_G_3D = 0x2;
379 static const unsigned int OGR_G_MEASURED = 0x4;
381
382 OGRGeometry();
383 OGRGeometry(const OGRGeometry &other);
384 virtual ~OGRGeometry();
385
386 OGRGeometry &operator=(const OGRGeometry &other);
387
389 bool operator==(const OGRGeometry &other) const
390 {
391 return CPL_TO_BOOL(Equals(&other));
392 }
393
395 bool operator!=(const OGRGeometry &other) const
396 {
397 return !CPL_TO_BOOL(Equals(&other));
398 }
399
400 // Standard IGeometry.
401 virtual int getDimension() const = 0;
402 virtual int getCoordinateDimension() const;
403 int CoordinateDimension() const;
404 virtual OGRBoolean IsEmpty() const = 0;
405 virtual OGRBoolean IsValid() const;
406 virtual OGRGeometry *MakeValid(CSLConstList papszOptions = nullptr) const;
407 virtual OGRGeometry *Normalize() const;
408 virtual OGRBoolean IsSimple() const;
410 OGRBoolean Is3D() const
411 {
412 return (flags & OGR_G_3D) != 0;
413 }
415 OGRBoolean IsMeasured() const
416 {
417 return (flags & OGR_G_MEASURED) != 0;
418 }
419 virtual OGRBoolean IsRing() const;
420 virtual void empty() = 0;
421 virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
422 virtual void getEnvelope(OGREnvelope *psEnvelope) const = 0;
423 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const = 0;
424
425 // IWks Interface.
426 virtual size_t WkbSize() const = 0;
427 OGRErr importFromWkb(const GByte *, size_t = static_cast<size_t>(-1),
428 OGRwkbVariant = wkbVariantOldOgc);
429 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
430 size_t &nBytesConsumedOut) = 0;
431 virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
432 OGRwkbVariant = wkbVariantOldOgc) const = 0;
433 virtual OGRErr importFromWkt(const char **ppszInput) = 0;
434
435 #ifndef DOXYGEN_XML
436
439 OGRErr importFromWkt(char **ppszInput)
441 CPL_WARN_DEPRECATED("Use importFromWkt(const char**) instead")
443 {
444 return importFromWkt(const_cast<const char **>(ppszInput));
445 }
446 #endif
447
448 OGRErr exportToWkt(char **ppszDstText,
449 OGRwkbVariant = wkbVariantOldOgc) const;
450
455 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
456 OGRErr *err = nullptr) const = 0;
457
458 // Non-standard.
459 virtual OGRwkbGeometryType getGeometryType() const = 0;
460 OGRwkbGeometryType getIsoGeometryType() const;
461 virtual const char *getGeometryName() const = 0;
462 void dumpReadable(FILE *, const char * = nullptr,
463 CSLConstList papszOptions = nullptr) const;
464 std::string dumpReadable(const char * = nullptr,
465 CSLConstList papszOptions = nullptr) const;
466 virtual void flattenTo2D() = 0;
467 virtual char *exportToGML(const char *const *papszOptions = nullptr) const;
468 virtual char *exportToKML() const;
469 virtual char *exportToJson() const;
470
472 virtual void accept(IOGRGeometryVisitor *visitor) = 0;
473
475 virtual void accept(IOGRConstGeometryVisitor *visitor) const = 0;
476
477 static GEOSContextHandle_t createGEOSContext();
478 static void freeGEOSContext(GEOSContextHandle_t hGEOSCtxt);
479 virtual GEOSGeom
480 exportToGEOS(GEOSContextHandle_t hGEOSCtxt) const CPL_WARN_UNUSED_RESULT;
481 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
482 virtual OGRGeometry *getCurveGeometry(
483 const char *const *papszOptions = nullptr) const CPL_WARN_UNUSED_RESULT;
484 virtual OGRGeometry *getLinearGeometry(
485 double dfMaxAngleStepSizeDegrees = 0,
486 const char *const *papszOptions = nullptr) const CPL_WARN_UNUSED_RESULT;
487
488 // SFCGAL interfacing methods.
490 static sfcgal_geometry_t *OGRexportToSFCGAL(const OGRGeometry *poGeom);
491 static OGRGeometry *SFCGALexportToOGR(const sfcgal_geometry_t *_geometry);
493 virtual void closeRings();
494
495 virtual void setCoordinateDimension(int nDimension);
496 virtual void set3D(OGRBoolean bIs3D);
497 virtual void setMeasured(OGRBoolean bIsMeasured);
498
499 virtual void assignSpatialReference(const OGRSpatialReference *poSR);
500 const OGRSpatialReference *getSpatialReference(void) const
501 {
502 return poSRS;
503 }
504
505 virtual OGRErr transform(OGRCoordinateTransformation *poCT) = 0;
506 OGRErr transformTo(const OGRSpatialReference *poSR);
507
508 virtual void segmentize(double dfMaxLength);
509
510 // ISpatialRelation
511 virtual OGRBoolean Intersects(const OGRGeometry *) const;
512 virtual OGRBoolean Equals(const OGRGeometry *) const = 0;
513 virtual OGRBoolean Disjoint(const OGRGeometry *) const;
514 virtual OGRBoolean Touches(const OGRGeometry *) const;
515 virtual OGRBoolean Crosses(const OGRGeometry *) const;
516 virtual OGRBoolean Within(const OGRGeometry *) const;
517 virtual OGRBoolean Contains(const OGRGeometry *) const;
518 virtual OGRBoolean Overlaps(const OGRGeometry *) const;
519 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
520 // virtual OGRGeometry *LocateAlong( double mValue ) const;
521 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd )
522 // const;
523
524 virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
525 virtual double Distance(const OGRGeometry *) const;
526 virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
527 virtual OGRGeometry *
528 ConcaveHull(double dfRatio, bool bAllowHoles) const CPL_WARN_UNUSED_RESULT;
529 virtual OGRGeometry *
530 Buffer(double dfDist, int nQuadSegs = 30) const CPL_WARN_UNUSED_RESULT;
531 virtual OGRGeometry *
532 Intersection(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
533 virtual OGRGeometry *
534 Union(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
535 virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
536 OGRGeometry *UnaryUnion() const CPL_WARN_UNUSED_RESULT;
537 virtual OGRGeometry *
538 Difference(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
539 virtual OGRGeometry *
540 SymDifference(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
541 virtual OGRErr Centroid(OGRPoint *poPoint) const;
542 virtual OGRGeometry *
543 Simplify(double dTolerance) const CPL_WARN_UNUSED_RESULT;
544 OGRGeometry *
545 SimplifyPreserveTopology(double dTolerance) const CPL_WARN_UNUSED_RESULT;
546 virtual OGRGeometry *
547 DelaunayTriangulation(double dfTolerance,
548 int bOnlyEdges) const CPL_WARN_UNUSED_RESULT;
549
550 virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
551
552 virtual double Distance3D(const OGRGeometry *poOtherGeom) const;
553
555 // backward compatibility to non-standard method names.
556 OGRBoolean Intersect(OGRGeometry *) const
557 CPL_WARN_DEPRECATED("Non standard method. "
558 "Use Intersects() instead");
559 OGRBoolean Equal(OGRGeometry *) const
560 CPL_WARN_DEPRECATED("Non standard method. "
561 "Use Equals() instead");
562 OGRGeometry *SymmetricDifference(const OGRGeometry *) const
563 CPL_WARN_DEPRECATED("Non standard method. "
564 "Use SymDifference() instead");
565 OGRGeometry *getBoundary() const
566 CPL_WARN_DEPRECATED("Non standard method. "
567 "Use Boundary() instead");
569
571 // Special HACK for DB2 7.2 support
572 static int bGenerate_DB2_V72_BYTE_ORDER;
574
575 virtual void swapXY();
577 static OGRGeometry *CastToIdentity(OGRGeometry *poGeom)
578 {
579 return poGeom;
580 }
581 static OGRGeometry *CastToError(OGRGeometry *poGeom);
583
587 static inline OGRGeometryH ToHandle(OGRGeometry *poGeom)
588 {
589 return reinterpret_cast<OGRGeometryH>(poGeom);
590 }
591
595 static inline OGRGeometry *FromHandle(OGRGeometryH hGeom)
596 {
597 return reinterpret_cast<OGRGeometry *>(hGeom);
598 }
599
604 inline OGRPoint *toPoint()
605 {
606 return cpl::down_cast<OGRPoint *>(this);
607 }
608
613 inline const OGRPoint *toPoint() const
614 {
615 return cpl::down_cast<const OGRPoint *>(this);
616 }
617
623 inline OGRCurve *toCurve()
624 {
625 return cpl::down_cast<OGRCurve *>(this);
626 }
627
633 inline const OGRCurve *toCurve() const
634 {
635 return cpl::down_cast<const OGRCurve *>(this);
636 }
637
643 inline OGRSimpleCurve *toSimpleCurve()
644 {
645 return cpl::down_cast<OGRSimpleCurve *>(this);
646 }
647
653 inline const OGRSimpleCurve *toSimpleCurve() const
654 {
655 return cpl::down_cast<const OGRSimpleCurve *>(this);
656 }
657
663 inline OGRLineString *toLineString()
664 {
665 return cpl::down_cast<OGRLineString *>(this);
666 }
667
673 inline const OGRLineString *toLineString() const
674 {
675 return cpl::down_cast<const OGRLineString *>(this);
676 }
677
682 inline OGRLinearRing *toLinearRing()
683 {
684 return cpl::down_cast<OGRLinearRing *>(this);
685 }
686
691 inline const OGRLinearRing *toLinearRing() const
692 {
693 return cpl::down_cast<const OGRLinearRing *>(this);
694 }
695
701 inline OGRCircularString *toCircularString()
702 {
703 return cpl::down_cast<OGRCircularString *>(this);
704 }
705
711 inline const OGRCircularString *toCircularString() const
712 {
713 return cpl::down_cast<const OGRCircularString *>(this);
714 }
715
721 inline OGRCompoundCurve *toCompoundCurve()
722 {
723 return cpl::down_cast<OGRCompoundCurve *>(this);
724 }
725
731 inline const OGRCompoundCurve *toCompoundCurve() const
732 {
733 return cpl::down_cast<const OGRCompoundCurve *>(this);
734 }
735
741 inline OGRSurface *toSurface()
742 {
743 return cpl::down_cast<OGRSurface *>(this);
744 }
745
751 inline const OGRSurface *toSurface() const
752 {
753 return cpl::down_cast<const OGRSurface *>(this);
754 }
755
761 inline OGRPolygon *toPolygon()
762 {
763 return cpl::down_cast<OGRPolygon *>(this);
764 }
765
771 inline const OGRPolygon *toPolygon() const
772 {
773 return cpl::down_cast<const OGRPolygon *>(this);
774 }
775
780 inline OGRTriangle *toTriangle()
781 {
782 return cpl::down_cast<OGRTriangle *>(this);
783 }
784
789 inline const OGRTriangle *toTriangle() const
790 {
791 return cpl::down_cast<const OGRTriangle *>(this);
792 }
793
799 inline OGRCurvePolygon *toCurvePolygon()
800 {
801 return cpl::down_cast<OGRCurvePolygon *>(this);
802 }
803
809 inline const OGRCurvePolygon *toCurvePolygon() const
810 {
811 return cpl::down_cast<const OGRCurvePolygon *>(this);
812 }
813
819 inline OGRGeometryCollection *toGeometryCollection()
820 {
821 return cpl::down_cast<OGRGeometryCollection *>(this);
822 }
823
829 inline const OGRGeometryCollection *toGeometryCollection() const
830 {
831 return cpl::down_cast<const OGRGeometryCollection *>(this);
832 }
833
839 inline OGRMultiPoint *toMultiPoint()
840 {
841 return cpl::down_cast<OGRMultiPoint *>(this);
842 }
843
849 inline const OGRMultiPoint *toMultiPoint() const
850 {
851 return cpl::down_cast<const OGRMultiPoint *>(this);
852 }
853
859 inline OGRMultiLineString *toMultiLineString()
860 {
861 return cpl::down_cast<OGRMultiLineString *>(this);
862 }
863
869 inline const OGRMultiLineString *toMultiLineString() const
870 {
871 return cpl::down_cast<const OGRMultiLineString *>(this);
872 }
873
879 inline OGRMultiPolygon *toMultiPolygon()
880 {
881 return cpl::down_cast<OGRMultiPolygon *>(this);
882 }
883
889 inline const OGRMultiPolygon *toMultiPolygon() const
890 {
891 return cpl::down_cast<const OGRMultiPolygon *>(this);
892 }
893
899 inline OGRMultiCurve *toMultiCurve()
900 {
901 return cpl::down_cast<OGRMultiCurve *>(this);
902 }
903
909 inline const OGRMultiCurve *toMultiCurve() const
910 {
911 return cpl::down_cast<const OGRMultiCurve *>(this);
912 }
913
919 inline OGRMultiSurface *toMultiSurface()
920 {
921 return cpl::down_cast<OGRMultiSurface *>(this);
922 }
923
929 inline const OGRMultiSurface *toMultiSurface() const
930 {
931 return cpl::down_cast<const OGRMultiSurface *>(this);
932 }
933
939 inline OGRPolyhedralSurface *toPolyhedralSurface()
940 {
941 return cpl::down_cast<OGRPolyhedralSurface *>(this);
942 }
943
949 inline const OGRPolyhedralSurface *toPolyhedralSurface() const
950 {
951 return cpl::down_cast<const OGRPolyhedralSurface *>(this);
952 }
953
958 inline OGRTriangulatedSurface *toTriangulatedSurface()
959 {
960 return cpl::down_cast<OGRTriangulatedSurface *>(this);
961 }
962
967 inline const OGRTriangulatedSurface *toTriangulatedSurface() const
968 {
969 return cpl::down_cast<const OGRTriangulatedSurface *>(this);
970 }
971 };
972
974 struct CPL_DLL OGRGeometryUniquePtrDeleter
975 {
976 void operator()(OGRGeometry *) const;
977 };
979
983 typedef std::unique_ptr<OGRGeometry, OGRGeometryUniquePtrDeleter>
984 OGRGeometryUniquePtr;
985
987 #define OGR_FORBID_DOWNCAST_TO(name) \
988 inline OGR##name *to##name() = delete; \
989 inline const OGR##name *to##name() const = delete;
990
991 #define OGR_FORBID_DOWNCAST_TO_POINT OGR_FORBID_DOWNCAST_TO(Point)
992 #define OGR_FORBID_DOWNCAST_TO_CURVE OGR_FORBID_DOWNCAST_TO(Curve)
993 #define OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE OGR_FORBID_DOWNCAST_TO(SimpleCurve)
994 #define OGR_FORBID_DOWNCAST_TO_LINESTRING OGR_FORBID_DOWNCAST_TO(LineString)
995 #define OGR_FORBID_DOWNCAST_TO_LINEARRING OGR_FORBID_DOWNCAST_TO(LinearRing)
996 #define OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING \
997 OGR_FORBID_DOWNCAST_TO(CircularString)
998 #define OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE \
999 OGR_FORBID_DOWNCAST_TO(CompoundCurve)
1000 #define OGR_FORBID_DOWNCAST_TO_SURFACE OGR_FORBID_DOWNCAST_TO(Surface)
1001 #define OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON OGR_FORBID_DOWNCAST_TO(CurvePolygon)
1002 #define OGR_FORBID_DOWNCAST_TO_POLYGON OGR_FORBID_DOWNCAST_TO(Polygon)
1003 #define OGR_FORBID_DOWNCAST_TO_TRIANGLE OGR_FORBID_DOWNCAST_TO(Triangle)
1004 #define OGR_FORBID_DOWNCAST_TO_MULTIPOINT OGR_FORBID_DOWNCAST_TO(MultiPoint)
1005 #define OGR_FORBID_DOWNCAST_TO_MULTICURVE OGR_FORBID_DOWNCAST_TO(MultiCurve)
1006 #define OGR_FORBID_DOWNCAST_TO_MULTILINESTRING \
1007 OGR_FORBID_DOWNCAST_TO(MultiLineString)
1008 #define OGR_FORBID_DOWNCAST_TO_MULTISURFACE OGR_FORBID_DOWNCAST_TO(MultiSurface)
1009 #define OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON OGR_FORBID_DOWNCAST_TO(MultiPolygon)
1010 #define OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION \
1011 OGR_FORBID_DOWNCAST_TO(GeometryCollection)
1012 #define OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE \
1013 OGR_FORBID_DOWNCAST_TO(PolyhedralSurface)
1014 #define OGR_FORBID_DOWNCAST_TO_TIN OGR_FORBID_DOWNCAST_TO(TriangulatedSurface)
1015
1016 #define OGR_ALLOW_UPCAST_TO(name) \
1017 inline OGR##name *to##name() \
1018 { \
1019 return this; \
1020 } \
1021 inline const OGR##name *to##name() const \
1022 { \
1023 return this; \
1024 }
1025
1026 #ifndef SUPPRESS_OGR_ALLOW_CAST_TO_THIS_WARNING
1027 #define CAST_TO_THIS_WARNING CPL_WARN_DEPRECATED("Casting to this is useless")
1028 #else
1029 #define CAST_TO_THIS_WARNING
1030 #endif
1031
1032 #define OGR_ALLOW_CAST_TO_THIS(name) \
1033 inline OGR##name *to##name() CAST_TO_THIS_WARNING \
1034 { \
1035 return this; \
1036 } \
1037 inline const OGR##name *to##name() const CAST_TO_THIS_WARNING \
1038 { \
1039 return this; \
1040 }
1041
1042 #define OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
1043 OGR_FORBID_DOWNCAST_TO_CURVE \
1044 OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE \
1045 OGR_FORBID_DOWNCAST_TO_LINESTRING \
1046 OGR_FORBID_DOWNCAST_TO_LINEARRING \
1047 OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING \
1048 OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE
1049
1050 #define OGR_FORBID_DOWNCAST_TO_ALL_SURFACES \
1051 OGR_FORBID_DOWNCAST_TO_SURFACE \
1052 OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON \
1053 OGR_FORBID_DOWNCAST_TO_POLYGON \
1054 OGR_FORBID_DOWNCAST_TO_TRIANGLE \
1055 OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE \
1056 OGR_FORBID_DOWNCAST_TO_TIN
1057
1058 #define OGR_FORBID_DOWNCAST_TO_ALL_SINGLES \
1059 OGR_FORBID_DOWNCAST_TO_POINT \
1060 OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
1061 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1062
1063 #define OGR_FORBID_DOWNCAST_TO_ALL_MULTI \
1064 OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION \
1065 OGR_FORBID_DOWNCAST_TO_MULTIPOINT \
1066 OGR_FORBID_DOWNCAST_TO_MULTICURVE \
1067 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING \
1068 OGR_FORBID_DOWNCAST_TO_MULTISURFACE \
1069 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
1070
1072
1073 /************************************************************************/
1074 /* OGRPoint */
1075 /************************************************************************/
1076
1083 class CPL_DLL OGRPoint : public OGRGeometry
1084 {
1085 double x;
1086 double y;
1087 double z;
1088 double m;
1089
1090 public:
1091 OGRPoint();
1092 OGRPoint(double x, double y);
1093 OGRPoint(double x, double y, double z);
1094 OGRPoint(double x, double y, double z, double m);
1095 OGRPoint(const OGRPoint &other);
1096 static OGRPoint *createXYM(double x, double y, double m);
1097 ~OGRPoint() override;
1098
1099 OGRPoint &operator=(const OGRPoint &other);
1100
1101 // IWks Interface
1102 size_t WkbSize() const override;
1103 OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1104 size_t &nBytesConsumedOut) override;
1105 OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
1106 OGRwkbVariant = wkbVariantOldOgc) const override;
1107
1108 #ifndef DOXYGEN_XML
1109 using OGRGeometry::importFromWkt;
1110 #endif
1111
1112 OGRErr importFromWkt(const char **) override;
1113
1114 #ifndef DOXYGEN_XML
1115 using OGRGeometry::exportToWkt;
1116 #endif
1117
1122 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1123 OGRErr *err = nullptr) const override;
1124
1125 // IGeometry
1126 virtual int getDimension() const override;
1127 virtual OGRPoint *clone() const override;
1128 virtual void empty() override;
1129 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
1130 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1131 virtual OGRBoolean IsEmpty() const override
1132 {
1133 return !(flags & OGR_G_NOT_EMPTY_POINT);
1134 }
1135
1136 // IPoint
1138 double getX() const
1139 {
1140 return x;
1141 }
1143 double getY() const
1144 {
1145 return y;
1146 }
1148 double getZ() const
1149 {
1150 return z;
1151 }
1153 double getM() const
1154 {
1155 return m;
1156 }
1157
1158 // Non standard
1159 virtual void setCoordinateDimension(int nDimension) override;
1163 void setX(double xIn)
1164 {
1165 x = xIn;
1166 if (std::isnan(x) || std::isnan(y))
1167 flags &= ~OGR_G_NOT_EMPTY_POINT;
1168 else
1169 flags |= OGR_G_NOT_EMPTY_POINT;
1170 }
1174 void setY(double yIn)
1175 {
1176 y = yIn;
1177 if (std::isnan(x) || std::isnan(y))
1178 flags &= ~OGR_G_NOT_EMPTY_POINT;
1179 else
1180 flags |= OGR_G_NOT_EMPTY_POINT;
1181 }
1185 void setZ(double zIn)
1186 {
1187 z = zIn;
1188 flags |= OGR_G_3D;
1189 }
1193 void setM(double mIn)
1194 {
1195 m = mIn;
1196 flags |= OGR_G_MEASURED;
1197 }
1198
1199 // ISpatialRelation
1200 virtual OGRBoolean Equals(const OGRGeometry *) const override;
1201 virtual OGRBoolean Intersects(const OGRGeometry *) const override;
1202 virtual OGRBoolean Within(const OGRGeometry *) const override;
1203
1204 // Non standard from OGRGeometry
1205 virtual const char *getGeometryName() const override;
1206 virtual OGRwkbGeometryType getGeometryType() const override;
1207 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
1208 virtual void flattenTo2D() override;
1209 virtual void accept(IOGRGeometryVisitor *visitor) override
1210 {
1211 visitor->visit(this);
1212 }
1213 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
1214 {
1215 visitor->visit(this);
1216 }
1217
1218 virtual void swapXY() override;
1219
1220 OGR_ALLOW_CAST_TO_THIS(Point)
1221 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
1222 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1223 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1224 };
1225
1226 /************************************************************************/
1227 /* OGRPointIterator */
1228 /************************************************************************/
1229
1236 class CPL_DLL OGRPointIterator
1237 {
1238 public:
1239 virtual ~OGRPointIterator();
1240 virtual OGRBoolean getNextPoint(OGRPoint *p) = 0;
1241
1242 static void destroy(OGRPointIterator *);
1243 };
1244
1245 /************************************************************************/
1246 /* OGRCurve */
1247 /************************************************************************/
1248
1254 class CPL_DLL OGRCurve : public OGRGeometry
1255 {
1256 protected:
1258 OGRCurve();
1259 OGRCurve(const OGRCurve &other);
1260
1261 virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
1262 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
1263
1264 friend class OGRCurvePolygon;
1265 friend class OGRCompoundCurve;
1267 virtual int ContainsPoint(const OGRPoint *p) const;
1268 virtual int IntersectsPoint(const OGRPoint *p) const;
1269 virtual double get_AreaOfCurveSegments() const = 0;
1270
1271 private:
1272 class CPL_DLL ConstIterator
1273 {
1274 struct Private;
1275 std::unique_ptr<Private> m_poPrivate;
1276
1277 public:
1278 ConstIterator(const OGRCurve *poSelf, bool bStart);
1279 ConstIterator(ConstIterator &&oOther) noexcept;
1280 ConstIterator &operator=(ConstIterator &&oOther);
1281 ~ConstIterator();
1282 const OGRPoint &operator*() const;
1283 ConstIterator &operator++();
1284 bool operator!=(const ConstIterator &it) const;
1285 };
1286
1287 friend inline ConstIterator begin(const OGRCurve *);
1288 friend inline ConstIterator end(const OGRCurve *);
1289
1290 public:
1291 ~OGRCurve() override;
1292
1294 OGRCurve &operator=(const OGRCurve &other);
1296
1298 typedef OGRPoint ChildType;
1299
1308 ConstIterator begin() const;
1310 ConstIterator end() const;
1311
1312 // IGeometry
1313 virtual OGRCurve *clone() const override = 0;
1314
1315 // ICurve methods
1316 virtual double get_Length() const = 0;
1317 virtual void StartPoint(OGRPoint *) const = 0;
1318 virtual void EndPoint(OGRPoint *) const = 0;
1319 virtual int get_IsClosed() const;
1320 virtual void Value(double, OGRPoint *) const = 0;
1321 virtual OGRLineString *
1322 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
1323 const char *const *papszOptions = nullptr) const = 0;
1324 virtual int getDimension() const override;
1325
1326 // non standard
1327 virtual int getNumPoints() const = 0;
1328 virtual OGRPointIterator *getPointIterator() const = 0;
1329 virtual OGRBoolean IsConvex() const;
1330 virtual double get_Area() const = 0;
1331 virtual int isClockwise() const;
1332
1336 inline OGRSimpleCurve *toSimpleCurve()
1337 {
1338 return cpl::down_cast<OGRSimpleCurve *>(this);
1339 }
1340
1344 inline const OGRSimpleCurve *toSimpleCurve() const
1345 {
1346 return cpl::down_cast<const OGRSimpleCurve *>(this);
1347 }
1348
1349 static OGRCompoundCurve *CastToCompoundCurve(OGRCurve *puCurve);
1350 static OGRLineString *CastToLineString(OGRCurve *poCurve);
1351 static OGRLinearRing *CastToLinearRing(OGRCurve *poCurve);
1352
1353 OGR_FORBID_DOWNCAST_TO_POINT
1354 OGR_ALLOW_CAST_TO_THIS(Curve)
1355 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1356 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1357 };
1358
1360
1361 inline OGRCurve::ConstIterator begin(const OGRCurve *poCurve)
1362 {
1363 return poCurve->begin();
1364 }
1366 inline OGRCurve::ConstIterator end(const OGRCurve *poCurve)
1367 {
1368 return poCurve->end();
1369 }
1371
1372 /************************************************************************/
1373 /* OGRIteratedPoint */
1374 /************************************************************************/
1375
1397 class CPL_DLL OGRIteratedPoint : public OGRPoint
1398 {
1399 private:
1400 friend class OGRSimpleCurve;
1401
1402 OGRSimpleCurve *m_poCurve = nullptr;
1403 int m_nPos = 0;
1404
1405 OGRIteratedPoint() = default;
1406
1407 CPL_DISALLOW_COPY_ASSIGN(OGRIteratedPoint)
1408
1409 public:
1413 void setX(double xIn);
1417 void setY(double yIn);
1421 void setZ(double zIn);
1425 void setM(double mIn);
1426 };
1427
1428 /************************************************************************/
1429 /* OGRSimpleCurve */
1430 /************************************************************************/
1431
1441 class CPL_DLL OGRSimpleCurve : public OGRCurve
1442 {
1443 protected:
1445 friend class OGRGeometry;
1446
1447 int nPointCount;
1448 OGRRawPoint *paoPoints;
1449 double *padfZ;
1450 double *padfM;
1451
1452 void Make3D();
1453 void Make2D();
1454 void RemoveM();
1455 void AddM();
1456
1457 OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ, int bHasM,
1458 OGRRawPoint *&paoPointsIn, int &nMaxPoints,
1459 double *&padfZIn);
1461
1462 virtual double get_LinearArea() const;
1463
1464 OGRSimpleCurve();
1465 OGRSimpleCurve(const OGRSimpleCurve &other);
1466
1467 private:
1468 class CPL_DLL Iterator
1469 {
1470 struct Private;
1471 std::unique_ptr<Private> m_poPrivate;
1472 void update();
1473
1474 public:
1475 Iterator(OGRSimpleCurve *poSelf, int nPos);
1476 Iterator(Iterator &&oOther) noexcept; // declared but not defined.
1477 // Needed for gcc 5.4 at least
1478 ~Iterator();
1479 OGRIteratedPoint &operator*();
1480 Iterator &operator++();
1481 bool operator!=(const Iterator &it) const;
1482 };
1483
1484 friend inline Iterator begin(OGRSimpleCurve *);
1485 friend inline Iterator end(OGRSimpleCurve *);
1486
1487 class CPL_DLL ConstIterator
1488 {
1489 struct Private;
1490 std::unique_ptr<Private> m_poPrivate;
1491
1492 public:
1493 ConstIterator(const OGRSimpleCurve *poSelf, int nPos);
1494 ConstIterator(
1495 ConstIterator &&oOther) noexcept; // declared but not defined.
1496 // Needed for gcc 5.4 at least
1497 ~ConstIterator();
1498 const OGRPoint &operator*() const;
1499 ConstIterator &operator++();
1500 bool operator!=(const ConstIterator &it) const;
1501 };
1502
1503 friend inline ConstIterator begin(const OGRSimpleCurve *);
1504 friend inline ConstIterator end(const OGRSimpleCurve *);
1505
1506 public:
1507 ~OGRSimpleCurve() override;
1508
1509 OGRSimpleCurve &operator=(const OGRSimpleCurve &other);
1510
1512 typedef OGRPoint ChildType;
1513
1522 Iterator begin();
1524 Iterator end();
1533 ConstIterator begin() const;
1535 ConstIterator end() const;
1536
1537 // IWks Interface.
1538 virtual size_t WkbSize() const override;
1539 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1540 size_t &nBytesConsumedOut) override;
1541 virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
1542 OGRwkbVariant = wkbVariantOldOgc) const override;
1543
1544 #ifndef DOXYGEN_XML
1545 using OGRGeometry::importFromWkt;
1546 #endif
1547
1548 OGRErr importFromWkt(const char **) override;
1549
1550 #ifndef DOXYGEN_XML
1551 using OGRGeometry::exportToWkt;
1552 #endif
1553
1558 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1559 OGRErr *err = nullptr) const override;
1560
1561 // IGeometry interface.
1562 virtual void empty() override;
1563 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
1564 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1565 virtual OGRBoolean IsEmpty() const override;
1566 virtual OGRSimpleCurve *clone() const override = 0;
1567
1568 // ICurve methods.
1569 virtual double get_Length() const override;
1570 virtual void StartPoint(OGRPoint *) const override;
1571 virtual void EndPoint(OGRPoint *) const override;
1572 virtual void Value(double, OGRPoint *) const override;
1573 virtual double Project(const OGRPoint *) const;
1574 virtual OGRLineString *getSubLine(double, double, int) const;
1575
1576 // ILineString methods.
1577 virtual int getNumPoints() const override
1578 {
1579 return nPointCount;
1580 }
1581 void getPoint(int, OGRPoint *) const;
1582 double getX(int i) const
1583 {
1584 return paoPoints[i].x;
1585 }
1586 double getY(int i) const
1587 {
1588 return paoPoints[i].y;
1589 }
1590 double getZ(int i) const;
1591 double getM(int i) const;
1592
1593 // ISpatialRelation
1594 virtual OGRBoolean Equals(const OGRGeometry *) const override;
1595
1596 // non standard.
1597 virtual void setCoordinateDimension(int nDimension) override;
1598 virtual void set3D(OGRBoolean bIs3D) override;
1599 virtual void setMeasured(OGRBoolean bIsMeasured) override;
1600 void setNumPoints(int nNewPointCount, int bZeroizeNewContent = TRUE);
1601 void setPoint(int, OGRPoint *);
1602 void setPoint(int, double, double);
1603 void setZ(int, double);
1604 void setM(int, double);
1605 void setPoint(int, double, double, double);
1606 void setPointM(int, double, double, double);
1607 void setPoint(int, double, double, double, double);
1608 void setPoints(int, const OGRRawPoint *, const double * = nullptr);
1609 void setPointsM(int, const OGRRawPoint *, const double *);
1610 void setPoints(int, const OGRRawPoint *, const double *, const double *);
1611 void setPoints(int, const double *padfX, const double *padfY,
1612 const double *padfZIn = nullptr);
1613 void setPointsM(int, const double *padfX, const double *padfY,
1614 const double *padfMIn = nullptr);
1615 void setPoints(int, const double *padfX, const double *padfY,
1616 const double *padfZIn, const double *padfMIn);
1617 void addPoint(const OGRPoint *);
1618 void addPoint(double, double);
1619 void addPoint(double, double, double);
1620 void addPointM(double, double, double);
1621 void addPoint(double, double, double, double);
1622
1623 bool removePoint(int);
1624
1625 void getPoints(OGRRawPoint *, double * = nullptr) const;
1626 void getPoints(void *pabyX, int nXStride, void *pabyY, int nYStride,
1627 void *pabyZ = nullptr, int nZStride = 0,
1628 void *pabyM = nullptr, int nMStride = 0) const;
1629
1630 void addSubLineString(const OGRLineString *, int nStartVertex = 0,
1631 int nEndVertex = -1);
1632 void reversePoints(void);
1633 virtual OGRPointIterator *getPointIterator() const override;
1634
1635 // non-standard from OGRGeometry
1636 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
1637 virtual void flattenTo2D() override;
1638 virtual void segmentize(double dfMaxLength) override;
1639
1640 virtual void swapXY() override;
1641
1642 OGR_ALLOW_UPCAST_TO(Curve)
1643 OGR_ALLOW_CAST_TO_THIS(SimpleCurve)
1644 };
1645
1647
1648 inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve *poCurve)
1649 {
1650 return poCurve->begin();
1651 }
1653 inline OGRSimpleCurve::Iterator end(OGRSimpleCurve *poCurve)
1654 {
1655 return poCurve->end();
1656 }
1657
1659 inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve *poCurve)
1660 {
1661 return poCurve->begin();
1662 }
1664 inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve *poCurve)
1665 {
1666 return poCurve->end();
1667 }
1669
1670 /************************************************************************/
1671 /* OGRLineString */
1672 /************************************************************************/
1673
1681 class CPL_DLL OGRLineString : public OGRSimpleCurve
1682 {
1683 // cppcheck-suppress unusedPrivateFunction
1684 static OGRLinearRing *CasterToLinearRing(OGRCurve *poCurve);
1685
1686 protected:
1688 static OGRLineString *TransferMembersAndDestroy(OGRLineString *poSrc,
1689 OGRLineString *poDst);
1690
1691 virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
1692 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1693
1694 virtual double get_AreaOfCurveSegments() const override;
1696
1697 static OGRLinearRing *CastToLinearRing(OGRLineString *poLS);
1698
1699 public:
1700 OGRLineString();
1701 OGRLineString(const OGRLineString &other);
1702 ~OGRLineString() override;
1703
1704 OGRLineString &operator=(const OGRLineString &other);
1705
1706 virtual OGRLineString *clone() const override;
1707 virtual OGRLineString *
1708 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
1709 const char *const *papszOptions = nullptr) const override;
1710 virtual OGRGeometry *
1711 getCurveGeometry(const char *const *papszOptions = nullptr) const override;
1712 virtual double get_Area() const override;
1713
1714 // Non-standard from OGRGeometry.
1715 virtual OGRwkbGeometryType getGeometryType() const override;
1716 virtual const char *getGeometryName() const override;
1717 virtual int isClockwise() const override;
1718
1720 inline OGRSimpleCurve *toUpperClass()
1721 {
1722 return this;
1723 }
1725 inline const OGRSimpleCurve *toUpperClass() const
1726 {
1727 return this;
1728 }
1729
1730 virtual void accept(IOGRGeometryVisitor *visitor) override
1731 {
1732 visitor->visit(this);
1733 }
1734 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
1735 {
1736 visitor->visit(this);
1737 }
1738
1739 OGR_ALLOW_UPCAST_TO(SimpleCurve)
1740 OGR_ALLOW_CAST_TO_THIS(LineString)
1741 };
1742
1743 /************************************************************************/
1744 /* OGRLinearRing */
1745 /************************************************************************/
1746
1767 class CPL_DLL OGRLinearRing : public OGRLineString
1768 {
1769 static OGRLineString *CasterToLineString(OGRCurve *poCurve);
1770
1771 // IWks Interface - Note this isn't really a first class object
1772 // for the purposes of WKB form. These methods always fail since this
1773 // object can't be serialized on its own.
1774 virtual size_t WkbSize() const override;
1775 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1776 size_t &nBytesConsumedOut) override;
1777 virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
1778 OGRwkbVariant = wkbVariantOldOgc) const override;
1779
1780 protected:
1782 friend class OGRPolygon;
1783 friend class OGRTriangle;
1784
1785 // These are not IWks compatible ... just a convenience for OGRPolygon.
1786 virtual size_t _WkbSize(int _flags) const;
1787 virtual OGRErr _importFromWkb(OGRwkbByteOrder, int _flags,
1788 const unsigned char *, size_t,
1789 size_t &nBytesConsumedOut);
1790 virtual OGRErr _exportToWkb(OGRwkbByteOrder, int _flags,
1791 unsigned char *) const;
1792
1793 virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
1794 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1796
1797 static OGRLineString *CastToLineString(OGRLinearRing *poLR);
1798
1799 public:
1800 OGRLinearRing();
1801 OGRLinearRing(const OGRLinearRing &other);
1802 explicit OGRLinearRing(OGRLinearRing *);
1803 ~OGRLinearRing() override;
1804
1805 OGRLinearRing &operator=(const OGRLinearRing &other);
1806
1807 // Non standard.
1808 virtual const char *getGeometryName() const override;
1809 virtual OGRLinearRing *clone() const override;
1810 virtual void reverseWindingOrder();
1811 virtual void closeRings() override;
1812 OGRBoolean isPointInRing(const OGRPoint *pt,
1813 int bTestEnvelope = TRUE) const;
1814 OGRBoolean isPointOnRingBoundary(const OGRPoint *pt,
1815 int bTestEnvelope = TRUE) const;
1816 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
1817
1819 inline OGRLineString *toUpperClass()
1820 {
1821 return this;
1822 }
1824 inline const OGRLineString *toUpperClass() const
1825 {
1826 return this;
1827 }
1828
1829 virtual void accept(IOGRGeometryVisitor *visitor) override
1830 {
1831 visitor->visit(this);
1832 }
1833 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
1834 {
1835 visitor->visit(this);
1836 }
1837
1838 OGR_ALLOW_UPCAST_TO(LineString)
1839 OGR_ALLOW_CAST_TO_THIS(LinearRing)
1840 };
1841
1842 /************************************************************************/
1843 /* OGRCircularString */
1844 /************************************************************************/
1845
1858 class CPL_DLL OGRCircularString : public OGRSimpleCurve
1859 {
1860 private:
1861 void ExtendEnvelopeWithCircular(OGREnvelope *psEnvelope) const;
1862 OGRBoolean IsValidFast() const;
1863 int IsFullCircle(double &cx, double &cy, double &square_R) const;
1864
1865 protected:
1867 virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
1868 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1869 virtual int IntersectsPoint(const OGRPoint *p) const override;
1870 virtual int ContainsPoint(const OGRPoint *p) const override;
1871 virtual double get_AreaOfCurveSegments() const override;
1873
1874 public:
1875 OGRCircularString();
1876 OGRCircularString(const OGRCircularString &other);
1877 ~OGRCircularString() override;
1878
1879 OGRCircularString &operator=(const OGRCircularString &other);
1880
1881 // IWks Interface.
1882 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1883 size_t &nBytesConsumedOut) override;
1884 virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
1885 OGRwkbVariant = wkbVariantOldOgc) const override;
1886
1887 #ifndef DOXYGEN_XML
1888 using OGRGeometry::importFromWkt;
1889 #endif
1890
1891 OGRErr importFromWkt(const char **) override;
1892
1893 #ifndef DOXYGEN_XML
1894 using OGRGeometry::exportToWkt;
1895 #endif
1896
1901 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1902 OGRErr *err = nullptr) const override;
1903
1904 // IGeometry interface.
1905 virtual OGRBoolean IsValid() const override;
1906 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
1907 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1908 virtual OGRCircularString *clone() const override;
1909
1910 // ICurve methods.
1911 virtual double get_Length() const override;
1912 virtual OGRLineString *
1913 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
1914 const char *const *papszOptions = nullptr) const override;
1915 virtual void Value(double, OGRPoint *) const override;
1916 virtual double get_Area() const override;
1917
1918 // Non-standard from OGRGeometry.
1919 virtual OGRwkbGeometryType getGeometryType() const override;
1920 virtual const char *getGeometryName() const override;
1921 virtual void segmentize(double dfMaxLength) override;
1922 virtual OGRBoolean
1923 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
1924 virtual OGRGeometry *
1925 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
1926 const char *const *papszOptions = nullptr) const override;
1927
1929 inline OGRSimpleCurve *toUpperClass()
1930 {
1931 return this;
1932 }
1934 inline const OGRSimpleCurve *toUpperClass() const
1935 {
1936 return this;
1937 }
1938
1939 virtual void accept(IOGRGeometryVisitor *visitor) override
1940 {
1941 visitor->visit(this);
1942 }
1943 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
1944 {
1945 visitor->visit(this);
1946 }
1947
1948 OGR_ALLOW_UPCAST_TO(SimpleCurve)
1949 OGR_ALLOW_CAST_TO_THIS(CircularString)
1950 };
1951
1952 /************************************************************************/
1953 /* OGRCurveCollection */
1954 /************************************************************************/
1955
1966 class CPL_DLL OGRCurveCollection
1968 {
1969 protected:
1970 friend class OGRCompoundCurve;
1971 friend class OGRCurvePolygon;
1972 friend class OGRPolygon;
1973 friend class OGRTriangle;
1974
1975 int nCurveCount = 0;
1976 OGRCurve **papoCurves = nullptr;
1977
1978 public:
1979 OGRCurveCollection();
1980 OGRCurveCollection(const OGRCurveCollection &other);
1981 ~OGRCurveCollection();
1982
1983 OGRCurveCollection &operator=(const OGRCurveCollection &other);
1984
1986 typedef OGRCurve ChildType;
1987
1991 OGRCurve **begin()
1992 {
1993 return papoCurves;
1994 }
1996 OGRCurve **end()
1997 {
1998 return papoCurves + nCurveCount;
1999 }
2003 const OGRCurve *const *begin() const
2004 {
2005 return papoCurves;
2006 }
2008 const OGRCurve *const *end() const
2009 {
2010 return papoCurves + nCurveCount;
2011 }
2012
2013 void empty(OGRGeometry *poGeom);
2014 OGRBoolean IsEmpty() const;
2015 void getEnvelope(OGREnvelope *psEnvelope) const;
2016 void getEnvelope(OGREnvelope3D *psEnvelope) const;
2017
2018 OGRErr addCurveDirectly(OGRGeometry *poGeom, OGRCurve *poCurve,
2019 int bNeedRealloc);
2020 size_t WkbSize() const;
2021 OGRErr importPreambleFromWkb(OGRGeometry *poGeom,
2022 const unsigned char *pabyData, size_t &nSize,
2023 size_t &nDataOffset,
2024 OGRwkbByteOrder &eByteOrder,
2025 size_t nMinSubGeomSize,
2026 OGRwkbVariant eWkbVariant);
2027 OGRErr
2028 importBodyFromWkb(OGRGeometry *poGeom, const unsigned char *pabyData,
2029 size_t nSize, bool bAcceptCompoundCurve,
2030 OGRErr (*pfnAddCurveDirectlyFromWkb)(OGRGeometry *poGeom,
2031 OGRCurve *poCurve),
2032 OGRwkbVariant eWkbVariant, size_t &nBytesConsumedOut);
2033 std::string exportToWkt(const OGRGeometry *geom, const OGRWktOptions &opts,
2034 OGRErr *err) const;
2035 OGRErr exportToWkb(const OGRGeometry *poGeom, OGRwkbByteOrder,
2036 unsigned char *, OGRwkbVariant eWkbVariant) const;
2037 OGRBoolean Equals(const OGRCurveCollection *poOCC) const;
2038 void setCoordinateDimension(OGRGeometry *poGeom, int nNewDimension);
2039 void set3D(OGRGeometry *poGeom, OGRBoolean bIs3D);
2040 void setMeasured(OGRGeometry *poGeom, OGRBoolean bIsMeasured);
2041 void assignSpatialReference(OGRGeometry *poGeom,
2042 const OGRSpatialReference *poSR);
2043 int getNumCurves() const;
2044 OGRCurve *getCurve(int);
2045 const OGRCurve *getCurve(int) const;
2046 OGRCurve *stealCurve(int);
2047
2048 OGRErr removeCurve(int iIndex, bool bDelete = true);
2049
2050 OGRErr transform(OGRGeometry *poGeom, OGRCoordinateTransformation *poCT);
2051 void flattenTo2D(OGRGeometry *poGeom);
2052 void segmentize(double dfMaxLength);
2053 void swapXY();
2054 OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
2055 };
2057
2058 /************************************************************************/
2059 /* OGRCompoundCurve */
2060 /************************************************************************/
2061
2072 class CPL_DLL OGRCompoundCurve : public OGRCurve
2073 {
2074 private:
2075 OGRCurveCollection oCC{};
2076
2077 OGRErr addCurveDirectlyInternal(OGRCurve *poCurve, double dfToleranceEps,
2078 int bNeedRealloc);
2079 static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
2080 OGRCurve *poCurve);
2081 static OGRErr addCurveDirectlyFromWkb(OGRGeometry *poSelf,
2082 OGRCurve *poCurve);
2083 OGRLineString *CurveToLineInternal(double dfMaxAngleStepSizeDegrees,
2084 const char *const *papszOptions,
2085 int bIsLinearRing) const;
2086 // cppcheck-suppress unusedPrivateFunction
2087 static OGRLineString *CasterToLineString(OGRCurve *poCurve);
2088 // cppcheck-suppress unusedPrivateFunction
2089 static OGRLinearRing *CasterToLinearRing(OGRCurve *poCurve);
2090
2091 protected:
2093 static OGRLineString *CastToLineString(OGRCompoundCurve *poCC);
2094 static OGRLinearRing *CastToLinearRing(OGRCompoundCurve *poCC);
2095
2096 virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
2097 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
2099
2100 public:
2101 OGRCompoundCurve();
2102 OGRCompoundCurve(const OGRCompoundCurve &other);
2103 ~OGRCompoundCurve() override;
2104
2105 OGRCompoundCurve &operator=(const OGRCompoundCurve &other);
2106
2108 typedef OGRCurve ChildType;
2109
2113 ChildType **begin()
2114 {
2115 return oCC.begin();
2116 }
2118 ChildType **end()
2119 {
2120 return oCC.end();
2121 }
2125 const ChildType *const *begin() const
2126 {
2127 return oCC.begin();
2128 }
2130 const ChildType *const *end() const
2131 {
2132 return oCC.end();
2133 }
2134
2135 // IWks Interface
2136 virtual size_t WkbSize() const override;
2137 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2138 size_t &nBytesConsumedOut) override;
2139 virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
2140 OGRwkbVariant = wkbVariantOldOgc) const override;
2141
2142 #ifndef DOXYGEN_XML
2143 using OGRGeometry::importFromWkt;
2144 #endif
2145
2146 OGRErr importFromWkt(const char **) override;
2147
2148 #ifndef DOXYGEN_XML
2149 using OGRGeometry::exportToWkt;
2150 #endif
2151
2156 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2157 OGRErr *err = nullptr) const override;
2158
2159 // IGeometry interface.
2160 virtual OGRCompoundCurve *clone() const override;
2161 virtual void empty() override;
2162 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
2163 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
2164 virtual OGRBoolean IsEmpty() const override;
2165
2166 // ICurve methods.
2167 virtual double get_Length() const override;
2168 virtual void StartPoint(OGRPoint *) const override;
2169 virtual void EndPoint(OGRPoint *) const override;
2170 virtual void Value(double, OGRPoint *) const override;
2171 virtual OGRLineString *
2172 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
2173 const char *const *papszOptions = nullptr) const override;
2174
2175 virtual int getNumPoints() const override;
2176 virtual double get_AreaOfCurveSegments() const override;
2177 virtual double get_Area() const override;
2178
2179 // ISpatialRelation.
2180 virtual OGRBoolean Equals(const OGRGeometry *) const override;
2181
2182 // ICompoundCurve method.
2183 int getNumCurves() const;
2184 OGRCurve *getCurve(int);
2185 const OGRCurve *getCurve(int) const;
2186
2187 // Non-standard.
2188 virtual void setCoordinateDimension(int nDimension) override;
2189 virtual void set3D(OGRBoolean bIs3D) override;
2190 virtual void setMeasured(OGRBoolean bIsMeasured) override;
2191
2192 virtual void
2193 assignSpatialReference(const OGRSpatialReference *poSR) override;
2194
2195 OGRErr addCurve(const OGRCurve *, double dfToleranceEps = 1e-14);
2196 OGRErr addCurveDirectly(OGRCurve *, double dfToleranceEps = 1e-14);
2197 OGRCurve *stealCurve(int);
2198 virtual OGRPointIterator *getPointIterator() const override;
2199
2200 // Non-standard from OGRGeometry.
2201 virtual OGRwkbGeometryType getGeometryType() const override;
2202 virtual const char *getGeometryName() const override;
2203 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
2204 virtual void flattenTo2D() override;
2205 virtual void segmentize(double dfMaxLength) override;
2206 virtual OGRBoolean
2207 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2208 virtual OGRGeometry *
2209 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2210 const char *const *papszOptions = nullptr) const override;
2211 virtual void accept(IOGRGeometryVisitor *visitor) override
2212 {
2213 visitor->visit(this);
2214 }
2215 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2216 {
2217 visitor->visit(this);
2218 }
2219
2220 virtual void swapXY() override;
2221
2222 OGR_ALLOW_UPCAST_TO(Curve)
2223 OGR_ALLOW_CAST_TO_THIS(CompoundCurve)
2224 };
2225
2227
2228 inline const OGRCompoundCurve::ChildType *const *
2229 begin(const OGRCompoundCurve *poCurve)
2230 {
2231 return poCurve->begin();
2232 }
2234 inline const OGRCompoundCurve::ChildType *const *
2235 end(const OGRCompoundCurve *poCurve)
2236 {
2237 return poCurve->end();
2238 }
2239
2241 inline OGRCompoundCurve::ChildType **begin(OGRCompoundCurve *poCurve)
2242 {
2243 return poCurve->begin();
2244 }
2246 inline OGRCompoundCurve::ChildType **end(OGRCompoundCurve *poCurve)
2247 {
2248 return poCurve->end();
2249 }
2251
2252 /************************************************************************/
2253 /* OGRSurface */
2254 /************************************************************************/
2255
2261 class CPL_DLL OGRSurface : public OGRGeometry
2262 {
2263 protected:
2265 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
2266 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
2268
2269 public:
2270 virtual double get_Area() const = 0;
2271 virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
2272 {
2273 return PointOnSurfaceInternal(poPoint);
2274 }
2275 virtual OGRSurface *clone() const override = 0;
2276
2278 static OGRPolygon *CastToPolygon(OGRSurface *poSurface);
2279 static OGRCurvePolygon *CastToCurvePolygon(OGRSurface *poSurface);
2281
2282 OGR_FORBID_DOWNCAST_TO_POINT
2283 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
2284 OGR_ALLOW_CAST_TO_THIS(Surface)
2285 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
2286 };
2287
2288 /************************************************************************/
2289 /* OGRCurvePolygon */
2290 /************************************************************************/
2291
2305 class CPL_DLL OGRCurvePolygon : public OGRSurface
2306 {
2307 static OGRPolygon *CasterToPolygon(OGRSurface *poSurface);
2308
2309 private:
2310 OGRBoolean IntersectsPoint(const OGRPoint *p) const;
2311 OGRBoolean ContainsPoint(const OGRPoint *p) const;
2312 virtual int checkRing(OGRCurve *poNewRing) const;
2313 OGRErr addRingDirectlyInternal(OGRCurve *poCurve, int bNeedRealloc);
2314 static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
2315 OGRCurve *poCurve);
2316 static OGRErr addCurveDirectlyFromWkb(OGRGeometry *poSelf,
2317 OGRCurve *poCurve);
2318
2319 protected:
2321 friend class OGRPolygon;
2322 friend class OGRTriangle;
2323 OGRCurveCollection oCC{};
2324
2325 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2326 virtual OGRSurfaceCasterToCurvePolygon
2327 GetCasterToCurvePolygon() const override;
2328
2330
2331 static OGRPolygon *CastToPolygon(OGRCurvePolygon *poCP);
2332
2333 public:
2334 OGRCurvePolygon();
2335 OGRCurvePolygon(const OGRCurvePolygon &);
2336 ~OGRCurvePolygon() override;
2337
2338 OGRCurvePolygon &operator=(const OGRCurvePolygon &other);
2339
2341 typedef OGRCurve ChildType;
2342
2346 ChildType **begin()
2347 {
2348 return oCC.begin();
2349 }
2351 ChildType **end()
2352 {
2353 return oCC.end();
2354 }
2358 const ChildType *const *begin() const
2359 {
2360 return oCC.begin();
2361 }
2363 const ChildType *const *end() const
2364 {
2365 return oCC.end();
2366 }
2367
2368 // Non standard (OGRGeometry).
2369 virtual const char *getGeometryName() const override;
2370 virtual OGRwkbGeometryType getGeometryType() const override;
2371 virtual OGRCurvePolygon *clone() const override;
2372 virtual void empty() override;
2373 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
2374 virtual void flattenTo2D() override;
2375 virtual OGRBoolean IsEmpty() const override;
2376 virtual void segmentize(double dfMaxLength) override;
2377 virtual OGRBoolean
2378 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2379 virtual OGRGeometry *
2380 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2381 const char *const *papszOptions = nullptr) const override;
2382
2383 // ISurface Interface
2384 virtual double get_Area() const override;
2385
2386 // IWks Interface
2387 virtual size_t WkbSize() const override;
2388 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2389 size_t &nBytesConsumedOut) override;
2390 virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
2391 OGRwkbVariant = wkbVariantOldOgc) const override;
2392
2393 #ifndef DOXYGEN_XML
2394 using OGRGeometry::importFromWkt;
2395 #endif
2396
2397 OGRErr importFromWkt(const char **) override;
2398
2399 #ifndef DOXYGEN_XML
2400 using OGRGeometry::exportToWkt;
2401 #endif
2402
2407 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2408 OGRErr *err = nullptr) const override;
2409
2410 // IGeometry
2411 virtual int getDimension() const override;
2412 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
2413 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
2414
2415 // ICurvePolygon
2416 virtual OGRPolygon *
2417 CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
2418 const char *const *papszOptions = nullptr) const;
2419
2420 // ISpatialRelation
2421 virtual OGRBoolean Equals(const OGRGeometry *) const override;
2422 virtual OGRBoolean Intersects(const OGRGeometry *) const override;
2423 virtual OGRBoolean Contains(const OGRGeometry *) const override;
2424
2425 // Non standard
2426 virtual void setCoordinateDimension(int nDimension) override;
2427 virtual void set3D(OGRBoolean bIs3D) override;
2428 virtual void setMeasured(OGRBoolean bIsMeasured) override;
2429
2430 virtual void
2431 assignSpatialReference(const OGRSpatialReference *poSR) override;
2432
2433 virtual OGRErr addRing(OGRCurve *);
2434 virtual OGRErr addRingDirectly(OGRCurve *);
2435
2436 OGRCurve *getExteriorRingCurve();
2437 const OGRCurve *getExteriorRingCurve() const;
2438 int getNumInteriorRings() const;
2439 OGRCurve *getInteriorRingCurve(int);
2440 const OGRCurve *getInteriorRingCurve(int) const;
2441
2442 OGRCurve *stealExteriorRingCurve();
2443
2444 OGRErr removeRing(int iIndex, bool bDelete = true);
2445 virtual void accept(IOGRGeometryVisitor *visitor) override
2446 {
2447 visitor->visit(this);
2448 }
2449 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2450 {
2451 visitor->visit(this);
2452 }
2453
2454 virtual void swapXY() override;
2455
2456 OGR_ALLOW_UPCAST_TO(Surface)
2457 OGR_ALLOW_CAST_TO_THIS(CurvePolygon)
2458 };
2459
2461
2462 inline const OGRCurvePolygon::ChildType *const *
2463 begin(const OGRCurvePolygon *poGeom)
2464 {
2465 return poGeom->begin();
2466 }
2468 inline const OGRCurvePolygon::ChildType *const *
2469 end(const OGRCurvePolygon *poGeom)
2470 {
2471 return poGeom->end();
2472 }
2473
2475 inline OGRCurvePolygon::ChildType **begin(OGRCurvePolygon *poGeom)
2476 {
2477 return poGeom->begin();
2478 }
2480 inline OGRCurvePolygon::ChildType **end(OGRCurvePolygon *poGeom)
2481 {
2482 return poGeom->end();
2483 }
2485
2486 /************************************************************************/
2487 /* OGRPolygon */
2488 /************************************************************************/
2489
2499 class CPL_DLL OGRPolygon : public OGRCurvePolygon
2500 {
2501 static OGRCurvePolygon *CasterToCurvePolygon(OGRSurface *poSurface);
2502
2503 protected:
2505 friend class OGRMultiSurface;
2506 friend class OGRPolyhedralSurface;
2507 friend class OGRTriangulatedSurface;
2508
2509 virtual int checkRing(OGRCurve *poNewRing) const override;
2510 virtual OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ,
2511 int bHasM, OGRRawPoint *&paoPoints,
2512 int &nMaxPoints, double *&padfZ);
2513
2514 static OGRCurvePolygon *CastToCurvePolygon(OGRPolygon *poPoly);
2515
2516 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2517 virtual OGRSurfaceCasterToCurvePolygon
2518 GetCasterToCurvePolygon() const override;
2520
2521 public:
2522 OGRPolygon();
2523 OGRPolygon(const OGRPolygon &other);
2524 ~OGRPolygon() override;
2525
2526 OGRPolygon &operator=(const OGRPolygon &other);
2527
2529 typedef OGRLinearRing ChildType;
2530
2534 ChildType **begin()
2535 {
2536 return reinterpret_cast<ChildType **>(oCC.begin());
2537 }
2539 ChildType **end()
2540 {
2541 return reinterpret_cast<ChildType **>(oCC.end());
2542 }
2546 const ChildType *const *begin() const
2547 {
2548 return reinterpret_cast<const ChildType *const *>(oCC.begin());
2549 }
2551 const ChildType *const *end() const
2552 {
2553 return reinterpret_cast<const ChildType *const *>(oCC.end());
2554 }
2555
2556 // Non-standard (OGRGeometry).
2557 virtual const char *getGeometryName() const override;
2558 virtual OGRwkbGeometryType getGeometryType() const override;
2559 virtual OGRPolygon *clone() const override;
2560 virtual OGRBoolean
2561 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2562 virtual OGRGeometry *
2563 getCurveGeometry(const char *const *papszOptions = nullptr) const override;
2564 virtual OGRGeometry *
2565 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2566 const char *const *papszOptions = nullptr) const override;
2567
2568 // IWks Interface.
2569 virtual size_t WkbSize() const override;
2570 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2571 size_t &nBytesConsumedOut) override;
2572 virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
2573 OGRwkbVariant = wkbVariantOldOgc) const override;
2574
2575 #ifndef DOXYGEN_XML
2576 using OGRGeometry::importFromWkt;
2577 #endif
2578
2579 OGRErr importFromWkt(const char **) override;
2580
2581 #ifndef DOXYGEN_XML
2582 using OGRGeometry::exportToWkt;
2583 #endif
2584
2589 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2590 OGRErr *err = nullptr) const override;
2591
2592 // ICurvePolygon.
2593 virtual OGRPolygon *
2594 CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
2595 const char *const *papszOptions = nullptr) const override;
2596
2597 OGRLinearRing *getExteriorRing();
2598 const OGRLinearRing *getExteriorRing() const;
2599 virtual OGRLinearRing *getInteriorRing(int);
2600 virtual const OGRLinearRing *getInteriorRing(int) const;
2601
2602 OGRLinearRing *stealExteriorRing();
2603 virtual OGRLinearRing *stealInteriorRing(int);
2604
2605 OGRBoolean IsPointOnSurface(const OGRPoint *) const;
2606
2608 inline OGRCurvePolygon *toUpperClass()
2609 {
2610 return this;
2611 }
2613 inline const OGRCurvePolygon *toUpperClass() const
2614 {
2615 return this;
2616 }
2617
2618 virtual void accept(IOGRGeometryVisitor *visitor) override
2619 {
2620 visitor->visit(this);
2621 }
2622 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2623 {
2624 visitor->visit(this);
2625 }
2626
2627 virtual void closeRings() override;
2628
2629 OGR_ALLOW_UPCAST_TO(CurvePolygon)
2630 OGR_ALLOW_CAST_TO_THIS(Polygon)
2631 };
2632
2634
2635 inline const OGRPolygon::ChildType *const *begin(const OGRPolygon *poGeom)
2636 {
2637 return poGeom->begin();
2638 }
2640 inline const OGRPolygon::ChildType *const *end(const OGRPolygon *poGeom)
2641 {
2642 return poGeom->end();
2643 }
2644
2646 inline OGRPolygon::ChildType **begin(OGRPolygon *poGeom)
2647 {
2648 return poGeom->begin();
2649 }
2651 inline OGRPolygon::ChildType **end(OGRPolygon *poGeom)
2652 {
2653 return poGeom->end();
2654 }
2656
2657 /************************************************************************/
2658 /* OGRTriangle */
2659 /************************************************************************/
2660
2667 class CPL_DLL OGRTriangle : public OGRPolygon
2668 {
2669 private:
2670 // cppcheck-suppress unusedPrivateFunction
2671 static OGRPolygon *CasterToPolygon(OGRSurface *poSurface);
2672 bool quickValidityCheck() const;
2673
2674 protected:
2676 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2677 virtual OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ,
2678 int bHasM, OGRRawPoint *&paoPoints,
2679 int &nMaxPoints,
2680 double *&padfZ) override;
2682
2683 public:
2684 OGRTriangle();
2685 OGRTriangle(const OGRPoint &p, const OGRPoint &q, const OGRPoint &r);
2686 OGRTriangle(const OGRTriangle &other);
2687 OGRTriangle(const OGRPolygon &other, OGRErr &eErr);
2688 OGRTriangle &operator=(const OGRTriangle &other);
2689 ~OGRTriangle() override;
2690 virtual const char *getGeometryName() const override;
2691 virtual OGRwkbGeometryType getGeometryType() const override;
2692 virtual OGRTriangle *clone() const override;
2693
2694 // IWks Interface.
2695 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2696 size_t &nBytesConsumedOut) override;
2697
2698 // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
2699 virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override;
2700
2702 inline OGRPolygon *toUpperClass()
2703 {
2704 return this;
2705 }
2707 inline const OGRPolygon *toUpperClass() const
2708 {
2709 return this;
2710 }
2711
2712 virtual void accept(IOGRGeometryVisitor *visitor) override
2713 {
2714 visitor->visit(this);
2715 }
2716 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2717 {
2718 visitor->visit(this);
2719 }
2720
2722 static OGRGeometry *CastToPolygon(OGRGeometry *poGeom);
2724
2725 OGR_ALLOW_UPCAST_TO(Polygon)
2726 OGR_ALLOW_CAST_TO_THIS(Triangle)
2727 };
2728
2729 /************************************************************************/
2730 /* OGRGeometryCollection */
2731 /************************************************************************/
2732
2740 class CPL_DLL OGRGeometryCollection : public OGRGeometry
2741 {
2742 OGRErr importFromWkbInternal(const unsigned char *pabyData, size_t nSize,
2743 int nRecLevel, OGRwkbVariant,
2744 size_t &nBytesConsumedOut);
2745 OGRErr importFromWktInternal(const char **ppszInput, int nRecLevel);
2746
2747 protected:
2749 int nGeomCount = 0;
2750 OGRGeometry **papoGeoms = nullptr;
2751
2752 std::string
2753 exportToWktInternal(const OGRWktOptions &opts, OGRErr *err,
2754 const std::string &exclude = std::string()) const;
2755 static OGRGeometryCollection *
2756 TransferMembersAndDestroy(OGRGeometryCollection *poSrc,
2757 OGRGeometryCollection *poDst);
2759 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const;
2760
2761 public:
2762 OGRGeometryCollection();
2763 OGRGeometryCollection(const OGRGeometryCollection &other);
2764 ~OGRGeometryCollection() override;
2765
2766 OGRGeometryCollection &operator=(const OGRGeometryCollection &other);
2767
2769 typedef OGRGeometry ChildType;
2770
2774 ChildType **begin()
2775 {
2776 return papoGeoms;
2777 }
2779 ChildType **end()
2780 {
2781 return papoGeoms + nGeomCount;
2782 }
2786 const ChildType *const *begin() const
2787 {
2788 return papoGeoms;
2789 }
2791 const ChildType *const *end() const
2792 {
2793 return papoGeoms + nGeomCount;
2794 }
2795
2796 // Non standard (OGRGeometry).
2797 virtual const char *getGeometryName() const override;
2798 virtual OGRwkbGeometryType getGeometryType() const override;
2799 virtual OGRGeometryCollection *clone() const override;
2800 virtual void empty() override;
2801 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
2802 virtual void flattenTo2D() override;
2803 virtual OGRBoolean IsEmpty() const override;
2804 virtual void segmentize(double dfMaxLength) override;
2805 virtual OGRBoolean
2806 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2807 virtual OGRGeometry *
2808 getCurveGeometry(const char *const *papszOptions = nullptr) const override;
2809 virtual OGRGeometry *
2810 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2811 const char *const *papszOptions = nullptr) const override;
2812
2813 // IWks Interface
2814 virtual size_t WkbSize() const override;
2815 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2816 size_t &nBytesConsumedOut) override;
2817 virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
2818 OGRwkbVariant = wkbVariantOldOgc) const override;
2819
2820 #ifndef DOXYGEN_XML
2821 using OGRGeometry::importFromWkt;
2822 #endif
2823
2824 OGRErr importFromWkt(const char **) override;
2825
2826 #ifndef DOXYGEN_XML
2827 using OGRGeometry::exportToWkt;
2828 #endif
2829
2834 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2835 OGRErr *err = nullptr) const override;
2836
2837 virtual double get_Length() const;
2838 virtual double get_Area() const;
2839
2840 // IGeometry methods
2841 virtual int getDimension() const override;
2842 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
2843 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
2844
2845 // IGeometryCollection
2846 int getNumGeometries() const;
2847 OGRGeometry *getGeometryRef(int);
2848 const OGRGeometry *getGeometryRef(int) const;
2849
2850 // ISpatialRelation
2851 virtual OGRBoolean Equals(const OGRGeometry *) const override;
2852
2853 // Non standard
2854 virtual void setCoordinateDimension(int nDimension) override;
2855 virtual void set3D(OGRBoolean bIs3D) override;
2856 virtual void setMeasured(OGRBoolean bIsMeasured) override;
2857 virtual OGRErr addGeometry(const OGRGeometry *);
2858 virtual OGRErr addGeometryDirectly(OGRGeometry *);
2859 virtual OGRErr removeGeometry(int iIndex, int bDelete = TRUE);
2860
2861 virtual void
2862 assignSpatialReference(const OGRSpatialReference *poSR) override;
2863
2864 void closeRings() override;
2865
2866 virtual void swapXY() override;
2867
2868 virtual void accept(IOGRGeometryVisitor *visitor) override
2869 {
2870 visitor->visit(this);
2871 }
2872 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2873 {
2874 visitor->visit(this);
2875 }
2876
2877 static OGRGeometryCollection *
2878 CastToGeometryCollection(OGRGeometryCollection *poSrc);
2879
2880 OGR_FORBID_DOWNCAST_TO_POINT
2881 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
2882 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
2883 OGR_ALLOW_CAST_TO_THIS(GeometryCollection)
2884 };
2885
2887
2888 inline const OGRGeometryCollection::ChildType *const *
2889 begin(const OGRGeometryCollection *poGeom)
2890 {
2891 return poGeom->begin();
2892 }
2894 inline const OGRGeometryCollection::ChildType *const *
2895 end(const OGRGeometryCollection *poGeom)
2896 {
2897 return poGeom->end();
2898 }
2899
2901 inline OGRGeometryCollection::ChildType **begin(OGRGeometryCollection *poGeom)
2902 {
2903 return poGeom->begin();
2904 }
2906 inline OGRGeometryCollection::ChildType **end(OGRGeometryCollection *poGeom)
2907 {
2908 return poGeom->end();
2909 }
2911
2912 /************************************************************************/
2913 /* OGRMultiSurface */
2914 /************************************************************************/
2915
2922 class CPL_DLL OGRMultiSurface : public OGRGeometryCollection
2923 {
2924 protected:
2925 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
2926
2927 public:
2928 OGRMultiSurface();
2929 OGRMultiSurface(const OGRMultiSurface &other);
2930 ~OGRMultiSurface() override;
2931
2932 OGRMultiSurface &operator=(const OGRMultiSurface &other);
2933
2935 typedef OGRSurface ChildType;
2936
2940 ChildType **begin()
2941 {
2942 return reinterpret_cast<ChildType **>(papoGeoms);
2943 }
2945 ChildType **end()
2946 {
2947 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
2948 }
2952 const ChildType *const *begin() const
2953 {
2954 return reinterpret_cast<const ChildType *const *>(papoGeoms);
2955 }
2957 const ChildType *const *end() const
2958 {
2959 return reinterpret_cast<const ChildType *const *>(papoGeoms +
2960 nGeomCount);
2961 }
2962
2963 // Non standard (OGRGeometry).
2964 virtual const char *getGeometryName() const override;
2965 virtual OGRwkbGeometryType getGeometryType() const override;
2966 virtual OGRMultiSurface *clone() const override;
2967
2968 #ifndef DOXYGEN_XML
2969 using OGRGeometry::importFromWkt;
2970 #endif
2971
2972 OGRErr importFromWkt(const char **) override;
2973
2974 #ifndef DOXYGEN_XML
2975 using OGRGeometry::exportToWkt;
2976 #endif
2977
2982 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2983 OGRErr *err = nullptr) const override;
2984
2985 // IMultiSurface methods
2986 virtual OGRErr PointOnSurface(OGRPoint *poPoint) const;
2987
2988 // IGeometry methods
2989 virtual int getDimension() const override;
2990
2991 // IGeometryCollection
2993 OGRSurface *getGeometryRef(int i)
2994 {
2995 return OGRGeometryCollection::getGeometryRef(i)->toSurface();
2996 }
2998 const OGRSurface *getGeometryRef(int i) const
2999 {
3000 return OGRGeometryCollection::getGeometryRef(i)->toSurface();
3001 }
3002
3003 // Non standard
3004 virtual OGRBoolean
3005 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3006
3008 inline OGRGeometryCollection *toUpperClass()
3009 {
3010 return this;
3011 }
3013 inline const OGRGeometryCollection *toUpperClass() const
3014 {
3015 return this;
3016 }
3017
3018 virtual void accept(IOGRGeometryVisitor *visitor) override
3019 {
3020 visitor->visit(this);
3021 }
3022 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3023 {
3024 visitor->visit(this);
3025 }
3026
3027 static OGRMultiPolygon *CastToMultiPolygon(OGRMultiSurface *poMS);
3028
3029 OGR_ALLOW_CAST_TO_THIS(MultiSurface)
3030 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3031 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3032 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
3033 OGR_FORBID_DOWNCAST_TO_MULTICURVE
3034 };
3035
3037
3038 inline const OGRMultiSurface::ChildType *const *
3039 begin(const OGRMultiSurface *poGeom)
3040 {
3041 return poGeom->begin();
3042 }
3044 inline const OGRMultiSurface::ChildType *const *
3045 end(const OGRMultiSurface *poGeom)
3046 {
3047 return poGeom->end();
3048 }
3049
3051 inline OGRMultiSurface::ChildType **begin(OGRMultiSurface *poGeom)
3052 {
3053 return poGeom->begin();
3054 }
3056 inline OGRMultiSurface::ChildType **end(OGRMultiSurface *poGeom)
3057 {
3058 return poGeom->end();
3059 }
3061
3062 /************************************************************************/
3063 /* OGRMultiPolygon */
3064 /************************************************************************/
3065
3070 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
3071 {
3072 protected:
3073 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3074 friend class OGRPolyhedralSurface;
3075 friend class OGRTriangulatedSurface;
3076
3077 private:
3079 OGRErr _addGeometryWithExpectedSubGeometryType(
3080 const OGRGeometry *poNewGeom, OGRwkbGeometryType eSubGeometryType);
3081 OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
3082 OGRGeometry *poNewGeom, OGRwkbGeometryType eSubGeometryType);
3084
3085 public:
3086 OGRMultiPolygon();
3087 OGRMultiPolygon(const OGRMultiPolygon &other);
3088 ~OGRMultiPolygon() override;
3089
3090 OGRMultiPolygon &operator=(const OGRMultiPolygon &other);
3091
3093 typedef OGRPolygon ChildType;
3094
3098 ChildType **begin()
3099 {
3100 return reinterpret_cast<ChildType **>(papoGeoms);
3101 }
3103 ChildType **end()
3104 {
3105 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3106 }
3110 const ChildType *const *begin() const
3111 {
3112 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3113 }
3115 const ChildType *const *end() const
3116 {
3117 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3118 nGeomCount);
3119 }
3120
3121 // IGeometryCollection
3123 OGRPolygon *getGeometryRef(int i)
3124 {
3125 return OGRGeometryCollection::getGeometryRef(i)->toPolygon();
3126 }
3128 const OGRPolygon *getGeometryRef(int i) const
3129 {
3130 return OGRGeometryCollection::getGeometryRef(i)->toPolygon();
3131 }
3132
3133 // Non-standard (OGRGeometry).
3134 virtual const char *getGeometryName() const override;
3135 virtual OGRwkbGeometryType getGeometryType() const override;
3136 virtual OGRMultiPolygon *clone() const override;
3137
3138 #ifndef DOXYGEN_XML
3139 using OGRGeometry::exportToWkt;
3140 #endif
3141
3146 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3147 OGRErr *err = nullptr) const override;
3148
3149 // Non standard
3150 virtual OGRBoolean
3151 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3152
3154 inline OGRGeometryCollection *toUpperClass()
3155 {
3156 return this;
3157 }
3159 inline const OGRGeometryCollection *toUpperClass() const
3160 {
3161 return this;
3162 }
3163
3164 virtual void accept(IOGRGeometryVisitor *visitor) override
3165 {
3166 visitor->visit(this);
3167 }
3168 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3169 {
3170 visitor->visit(this);
3171 }
3172
3173 static OGRMultiSurface *CastToMultiSurface(OGRMultiPolygon *poMP);
3174
3175 OGR_ALLOW_CAST_TO_THIS(MultiPolygon)
3176 OGR_ALLOW_UPCAST_TO(MultiSurface)
3177 };
3178
3180
3181 inline const OGRMultiPolygon::ChildType *const *
3182 begin(const OGRMultiPolygon *poGeom)
3183 {
3184 return poGeom->begin();
3185 }
3187 inline const OGRMultiPolygon::ChildType *const *
3188 end(const OGRMultiPolygon *poGeom)
3189 {
3190 return poGeom->end();
3191 }
3192
3194 inline OGRMultiPolygon::ChildType **begin(OGRMultiPolygon *poGeom)
3195 {
3196 return poGeom->begin();
3197 }
3199 inline OGRMultiPolygon::ChildType **end(OGRMultiPolygon *poGeom)
3200 {
3201 return poGeom->end();
3202 }
3204
3205 /************************************************************************/
3206 /* OGRPolyhedralSurface */
3207 /************************************************************************/
3208
3215 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
3216 {
3217 protected:
3219 friend class OGRTriangulatedSurface;
3220 OGRMultiPolygon oMP{};
3221 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
3222 virtual OGRSurfaceCasterToCurvePolygon
3223 GetCasterToCurvePolygon() const override;
3224 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const;
3225 virtual const char *getSubGeometryName() const;
3226 virtual OGRwkbGeometryType getSubGeometryType() const;
3227 std::string exportToWktInternal(const OGRWktOptions &opts,
3228 OGRErr *err) const;
3229
3230 virtual OGRPolyhedralSurfaceCastToMultiPolygon
3231 GetCasterToMultiPolygon() const;
3232 static OGRMultiPolygon *CastToMultiPolygonImpl(OGRPolyhedralSurface *poPS);
3234
3235 public:
3236 OGRPolyhedralSurface();
3237 OGRPolyhedralSurface(const OGRPolyhedralSurface &poGeom);
3238 ~OGRPolyhedralSurface() override;
3239 OGRPolyhedralSurface &operator=(const OGRPolyhedralSurface &other);
3240
3242 typedef OGRPolygon ChildType;
3243
3247 ChildType **begin()
3248 {
3249 return oMP.begin();
3250 }
3252 ChildType **end()
3253 {
3254 return oMP.end();
3255 }
3259 const ChildType *const *begin() const
3260 {
3261 return oMP.begin();
3262 }
3264 const ChildType *const *end() const
3265 {
3266 return oMP.end();
3267 }
3268
3269 // IWks Interface.
3270 virtual size_t WkbSize() const override;
3271 virtual const char *getGeometryName() const override;
3272 virtual OGRwkbGeometryType getGeometryType() const override;
3273 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
3274 size_t &nBytesConsumedOut) override;
3275 virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
3276 OGRwkbVariant = wkbVariantOldOgc) const override;
3277
3278 #ifndef DOXYGEN_XML
3279 using OGRGeometry::importFromWkt;
3280 #endif
3281
3282 OGRErr importFromWkt(const char **) override;
3283
3284 #ifndef DOXYGEN_XML
3285 using OGRGeometry::exportToWkt;
3286 #endif
3287
3292 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3293 OGRErr *err = nullptr) const override;
3294
3295 // IGeometry methods.
3296 virtual int getDimension() const override;
3297
3298 virtual void empty() override;
3299
3300 virtual OGRPolyhedralSurface *clone() const override;
3301 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
3302 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
3303
3304 virtual void flattenTo2D() override;
3305 virtual OGRErr transform(OGRCoordinateTransformation *) override;
3306 virtual OGRBoolean Equals(const OGRGeometry *) const override;
3307 virtual double get_Area() const override;
3308 virtual OGRErr PointOnSurface(OGRPoint *) const override;
3309
3310 static OGRMultiPolygon *CastToMultiPolygon(OGRPolyhedralSurface *poPS);
3311 virtual OGRBoolean
3312 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3313 virtual OGRErr addGeometry(const OGRGeometry *);
3314 OGRErr addGeometryDirectly(OGRGeometry *poNewGeom);
3315 int getNumGeometries() const;
3316 OGRPolygon *getGeometryRef(int i);
3317 const OGRPolygon *getGeometryRef(int i) const;
3318
3319 virtual OGRBoolean IsEmpty() const override;
3320 virtual void setCoordinateDimension(int nDimension) override;
3321 virtual void set3D(OGRBoolean bIs3D) override;
3322 virtual void setMeasured(OGRBoolean bIsMeasured) override;
3323 virtual void swapXY() override;
3324 OGRErr removeGeometry(int iIndex, int bDelete = TRUE);
3325
3326 virtual void accept(IOGRGeometryVisitor *visitor) override
3327 {
3328 visitor->visit(this);
3329 }
3330 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3331 {
3332 visitor->visit(this);
3333 }
3334
3335 virtual void
3336 assignSpatialReference(const OGRSpatialReference *poSR) override;
3337
3338 OGR_ALLOW_CAST_TO_THIS(PolyhedralSurface)
3339 OGR_ALLOW_UPCAST_TO(Surface)
3340 };
3341
3343
3344 inline const OGRPolyhedralSurface::ChildType *const *
3345 begin(const OGRPolyhedralSurface *poGeom)
3346 {
3347 return poGeom->begin();
3348 }
3350 inline const OGRPolyhedralSurface::ChildType *const *
3351 end(const OGRPolyhedralSurface *poGeom)
3352 {
3353 return poGeom->end();
3354 }
3355
3357 inline OGRPolyhedralSurface::ChildType **begin(OGRPolyhedralSurface *poGeom)
3358 {
3359 return poGeom->begin();
3360 }
3362 inline OGRPolyhedralSurface::ChildType **end(OGRPolyhedralSurface *poGeom)
3363 {
3364 return poGeom->end();
3365 }
3367
3368 /************************************************************************/
3369 /* OGRTriangulatedSurface */
3370 /************************************************************************/
3371
3378 class CPL_DLL OGRTriangulatedSurface : public OGRPolyhedralSurface
3379 {
3380 protected:
3382 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3383 virtual const char *getSubGeometryName() const override;
3384 virtual OGRwkbGeometryType getSubGeometryType() const override;
3385
3386 virtual OGRPolyhedralSurfaceCastToMultiPolygon
3387 GetCasterToMultiPolygon() const override;
3388 static OGRMultiPolygon *CastToMultiPolygonImpl(OGRPolyhedralSurface *poPS);
3390
3391 public:
3392 OGRTriangulatedSurface();
3393 OGRTriangulatedSurface(const OGRTriangulatedSurface &other);
3394 ~OGRTriangulatedSurface();
3395
3397 typedef OGRTriangle ChildType;
3398
3402 ChildType **begin()
3403 {
3404 return reinterpret_cast<ChildType **>(oMP.begin());
3405 }
3407 ChildType **end()
3408 {
3409 return reinterpret_cast<ChildType **>(oMP.end());
3410 }
3414 const ChildType *const *begin() const
3415 {
3416 return reinterpret_cast<const ChildType *const *>(oMP.begin());
3417 }
3419 const ChildType *const *end() const
3420 {
3421 return reinterpret_cast<const ChildType *const *>(oMP.end());
3422 }
3423
3424 OGRTriangulatedSurface &operator=(const OGRTriangulatedSurface &other);
3425 virtual const char *getGeometryName() const override;
3426 virtual OGRwkbGeometryType getGeometryType() const override;
3427 virtual OGRTriangulatedSurface *clone() const override;
3428
3430 OGRTriangle *getGeometryRef(int i)
3431 {
3432 return OGRPolyhedralSurface::getGeometryRef(i)->toTriangle();
3433 }
3435 const OGRTriangle *getGeometryRef(int i) const
3436 {
3437 return OGRPolyhedralSurface::getGeometryRef(i)->toTriangle();
3438 }
3439
3440 // IWks Interface.
3441 virtual OGRErr addGeometry(const OGRGeometry *) override;
3442
3444 inline OGRPolyhedralSurface *toUpperClass()
3445 {
3446 return this;
3447 }
3449 inline const OGRPolyhedralSurface *toUpperClass() const
3450 {
3451 return this;
3452 }
3453
3454 virtual void accept(IOGRGeometryVisitor *visitor) override
3455 {
3456 visitor->visit(this);
3457 }
3458 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3459 {
3460 visitor->visit(this);
3461 }
3462
3463 static OGRPolyhedralSurface *
3464 CastToPolyhedralSurface(OGRTriangulatedSurface *poTS);
3465
3466 OGR_ALLOW_CAST_TO_THIS(TriangulatedSurface)
3467 OGR_ALLOW_UPCAST_TO(PolyhedralSurface)
3468 };
3469
3471
3472 inline const OGRTriangulatedSurface::ChildType *const *
3473 begin(const OGRTriangulatedSurface *poGeom)
3474 {
3475 return poGeom->begin();
3476 }
3478 inline const OGRTriangulatedSurface::ChildType *const *
3479 end(const OGRTriangulatedSurface *poGeom)
3480 {
3481 return poGeom->end();
3482 }
3483
3485 inline OGRTriangulatedSurface::ChildType **begin(OGRTriangulatedSurface *poGeom)
3486 {
3487 return poGeom->begin();
3488 }
3490 inline OGRTriangulatedSurface::ChildType **end(OGRTriangulatedSurface *poGeom)
3491 {
3492 return poGeom->end();
3493 }
3495
3496 /************************************************************************/
3497 /* OGRMultiPoint */
3498 /************************************************************************/
3499
3504 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
3505 {
3506 private:
3507 OGRErr importFromWkt_Bracketed(const char **, int bHasM, int bHasZ);
3508
3509 protected:
3510 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3511
3512 public:
3513 OGRMultiPoint();
3514 OGRMultiPoint(const OGRMultiPoint &other);
3515 ~OGRMultiPoint() override;
3516
3517 OGRMultiPoint &operator=(const OGRMultiPoint &other);
3518
3520 typedef OGRPoint ChildType;
3521
3525 ChildType **begin()
3526 {
3527 return reinterpret_cast<ChildType **>(papoGeoms);
3528 }
3530 ChildType **end()
3531 {
3532 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3533 }
3537 const ChildType *const *begin() const
3538 {
3539 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3540 }
3542 const ChildType *const *end() const
3543 {
3544 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3545 nGeomCount);
3546 }
3547
3548 // IGeometryCollection
3550 OGRPoint *getGeometryRef(int i)
3551 {
3552 return OGRGeometryCollection::getGeometryRef(i)->toPoint();
3553 }
3555 const OGRPoint *getGeometryRef(int i) const
3556 {
3557 return OGRGeometryCollection::getGeometryRef(i)->toPoint();
3558 }
3559
3560 // Non-standard (OGRGeometry).
3561 virtual const char *getGeometryName() const override;
3562 virtual OGRwkbGeometryType getGeometryType() const override;
3563 virtual OGRMultiPoint *clone() const override;
3564
3565 #ifndef DOXYGEN_XML
3566 using OGRGeometry::importFromWkt;
3567 #endif
3568
3569 OGRErr importFromWkt(const char **) override;
3570
3571 #ifndef DOXYGEN_XML
3572 using OGRGeometry::exportToWkt;
3573 #endif
3574
3579 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3580 OGRErr *err = nullptr) const override;
3581
3582 // IGeometry methods.
3583 virtual int getDimension() const override;
3584
3586 inline OGRGeometryCollection *toUpperClass()
3587 {
3588 return this;
3589 }
3591 inline const OGRGeometryCollection *toUpperClass() const
3592 {
3593 return this;
3594 }
3595
3596 virtual void accept(IOGRGeometryVisitor *visitor) override
3597 {
3598 visitor->visit(this);
3599 }
3600 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3601 {
3602 visitor->visit(this);
3603 }
3604
3605 // Non-standard.
3606 virtual OGRBoolean
3607 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3608
3609 OGR_ALLOW_CAST_TO_THIS(MultiPoint)
3610 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3611 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
3612 OGR_FORBID_DOWNCAST_TO_MULTICURVE
3613 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3614 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3615 };
3616
3618
3619 inline const OGRMultiPoint::ChildType *const *begin(const OGRMultiPoint *poGeom)
3620 {
3621 return poGeom->begin();
3622 }
3624 inline const OGRMultiPoint::ChildType *const *end(const OGRMultiPoint *poGeom)
3625 {
3626 return poGeom->end();
3627 }
3628
3630 inline OGRMultiPoint::ChildType **begin(OGRMultiPoint *poGeom)
3631 {
3632 return poGeom->begin();
3633 }
3635 inline OGRMultiPoint::ChildType **end(OGRMultiPoint *poGeom)
3636 {
3637 return poGeom->end();
3638 }
3640
3641 /************************************************************************/
3642 /* OGRMultiCurve */
3643 /************************************************************************/
3644
3651 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
3652 {
3653 protected:
3655 static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
3656 OGRCurve *poCurve);
3658 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3659
3660 public:
3661 OGRMultiCurve();
3662 OGRMultiCurve(const OGRMultiCurve &other);
3663 ~OGRMultiCurve() override;
3664
3665 OGRMultiCurve &operator=(const OGRMultiCurve &other);
3666
3668 typedef OGRCurve ChildType;
3669
3673 ChildType **begin()
3674 {
3675 return reinterpret_cast<ChildType **>(papoGeoms);
3676 }
3678 ChildType **end()
3679 {
3680 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3681 }
3685 const ChildType *const *begin() const
3686 {
3687 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3688 }
3690 const ChildType *const *end() const
3691 {
3692 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3693 nGeomCount);
3694 }
3695
3696 // IGeometryCollection
3698 OGRCurve *getGeometryRef(int i)
3699 {
3700 return OGRGeometryCollection::getGeometryRef(i)->toCurve();
3701 }
3703 const OGRCurve *getGeometryRef(int i) const
3704 {
3705 return OGRGeometryCollection::getGeometryRef(i)->toCurve();
3706 }
3707
3708 // Non standard (OGRGeometry).
3709 virtual const char *getGeometryName() const override;
3710 virtual OGRwkbGeometryType getGeometryType() const override;
3711 virtual OGRMultiCurve *clone() const override;
3712
3713 #ifndef DOXYGEN_XML
3714 using OGRGeometry::importFromWkt;
3715 #endif
3716
3717 OGRErr importFromWkt(const char **) override;
3718
3719 #ifndef DOXYGEN_XML
3720 using OGRGeometry::exportToWkt;
3721 #endif
3722
3727 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3728 OGRErr *err = nullptr) const override;
3729
3730 // IGeometry methods.
3731 virtual int getDimension() const override;
3732
3733 // Non-standard.
3734 virtual OGRBoolean
3735 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3736
3738 inline OGRGeometryCollection *toUpperClass()
3739 {
3740 return this;
3741 }
3743 inline const OGRGeometryCollection *toUpperClass() const
3744 {
3745 return this;
3746 }
3747
3748 virtual void accept(IOGRGeometryVisitor *visitor) override
3749 {
3750 visitor->visit(this);
3751 }
3752 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3753 {
3754 visitor->visit(this);
3755 }
3756
3757 static OGRMultiLineString *CastToMultiLineString(OGRMultiCurve *poMC);
3758
3759 OGR_ALLOW_CAST_TO_THIS(MultiCurve)
3760 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3761 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3762 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3763 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3764 };
3765
3767
3768 inline const OGRMultiCurve::ChildType *const *begin(const OGRMultiCurve *poGeom)
3769 {
3770 return poGeom->begin();
3771 }
3773 inline const OGRMultiCurve::ChildType *const *end(const OGRMultiCurve *poGeom)
3774 {
3775 return poGeom->end();
3776 }
3777
3779 inline OGRMultiCurve::ChildType **begin(OGRMultiCurve *poGeom)
3780 {
3781 return poGeom->begin();
3782 }
3784 inline OGRMultiCurve::ChildType **end(OGRMultiCurve *poGeom)
3785 {
3786 return poGeom->end();
3787 }
3789
3790 /************************************************************************/
3791 /* OGRMultiLineString */
3792 /************************************************************************/
3793
3798 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
3799 {
3800 protected:
3801 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3802
3803 public:
3804 OGRMultiLineString();
3805 OGRMultiLineString(const OGRMultiLineString &other);
3806 ~OGRMultiLineString() override;
3807
3808 OGRMultiLineString &operator=(const OGRMultiLineString &other);
3809
3811 typedef OGRLineString ChildType;
3812
3816 ChildType **begin()
3817 {
3818 return reinterpret_cast<ChildType **>(papoGeoms);
3819 }
3821 ChildType **end()
3822 {
3823 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3824 }
3828 const ChildType *const *begin() const
3829 {
3830 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3831 }
3833 const ChildType *const *end() const
3834 {
3835 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3836 nGeomCount);
3837 }
3838
3839 // IGeometryCollection
3841 OGRLineString *getGeometryRef(int i)
3842 {
3843 return OGRGeometryCollection::getGeometryRef(i)->toLineString();
3844 }
3846 const OGRLineString *getGeometryRef(int i) const
3847 {
3848 return OGRGeometryCollection::getGeometryRef(i)->toLineString();
3849 }
3850
3851 // Non standard (OGRGeometry).
3852 virtual const char *getGeometryName() const override;
3853 virtual OGRwkbGeometryType getGeometryType() const override;
3854 virtual OGRMultiLineString *clone() const override;
3855
3856 #ifndef DOXYGEN_XML
3857 using OGRGeometry::exportToWkt;
3858 #endif
3859
3864 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3865 OGRErr *err = nullptr) const override;
3866
3867 // Non standard
3868 virtual OGRBoolean
3869 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3870
3872 inline OGRGeometryCollection *toUpperClass()
3873 {
3874 return this;
3875 }
3877 inline const OGRGeometryCollection *toUpperClass() const
3878 {
3879 return this;
3880 }
3881
3882 virtual void accept(IOGRGeometryVisitor *visitor) override
3883 {
3884 visitor->visit(this);
3885 }
3886 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3887 {
3888 visitor->visit(this);
3889 }
3890
3891 static OGRMultiCurve *CastToMultiCurve(OGRMultiLineString *poMLS);
3892
3893 OGR_ALLOW_CAST_TO_THIS(MultiLineString)
3894 OGR_ALLOW_UPCAST_TO(MultiCurve)
3895 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3896 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3897 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3898 };
3899
3901
3902 inline const OGRMultiLineString::ChildType *const *
3903 begin(const OGRMultiLineString *poGeom)
3904 {
3905 return poGeom->begin();
3906 }
3908 inline const OGRMultiLineString::ChildType *const *
3909 end(const OGRMultiLineString *poGeom)
3910 {
3911 return poGeom->end();
3912 }
3913
3915 inline OGRMultiLineString::ChildType **begin(OGRMultiLineString *poGeom)
3916 {
3917 return poGeom->begin();
3918 }
3920 inline OGRMultiLineString::ChildType **end(OGRMultiLineString *poGeom)
3921 {
3922 return poGeom->end();
3923 }
3925
3926 /************************************************************************/
3927 /* OGRGeometryFactory */
3928 /************************************************************************/
3929
3934 class CPL_DLL OGRGeometryFactory
3935 {
3936 static OGRErr createFromFgfInternal(const unsigned char *pabyData,
3937 OGRSpatialReference *poSR,
3938 OGRGeometry **ppoReturn, int nBytes,
3939 int *pnBytesConsumed, int nRecLevel);
3940
3941 public:
3942 static OGRErr createFromWkb(const void *, const OGRSpatialReference *,
3943 OGRGeometry **,
3944 size_t = static_cast<size_t>(-1),
3945 OGRwkbVariant = wkbVariantOldOgc);
3946 static OGRErr createFromWkb(const void *pabyData,
3947 const OGRSpatialReference *, OGRGeometry **,
3948 size_t nSize, OGRwkbVariant eVariant,
3949 size_t &nBytesConsumedOut);
3950 static OGRErr createFromWkt(const char *, const OGRSpatialReference *,
3951 OGRGeometry **);
3952 static OGRErr createFromWkt(const char **, const OGRSpatialReference *,
3953 OGRGeometry **);
3957 static OGRErr createFromWkt(char **ppszInput,
3958 const OGRSpatialReference *poSRS,
3959 OGRGeometry **ppoGeom)
3960 CPL_WARN_DEPRECATED("Use createFromWkt(const char**, ...) instead")
3961 {
3962 return createFromWkt(const_cast<const char **>(ppszInput), poSRS,
3963 ppoGeom);
3964 }
3965
3966 static OGRErr createFromFgf(const void *, OGRSpatialReference *,
3967 OGRGeometry **, int = -1, int * = nullptr);
3968 static OGRGeometry *createFromGML(const char *);
3969 static OGRGeometry *createFromGEOS(GEOSContextHandle_t hGEOSCtxt, GEOSGeom);
3970 static OGRGeometry *createFromGeoJson(const char *, int = -1);
3971 static OGRGeometry *createFromGeoJson(const CPLJSONObject &oJSONObject);
3972
3973 static void destroyGeometry(OGRGeometry *);
3974 static OGRGeometry *createGeometry(OGRwkbGeometryType);
3975
3976 static OGRGeometry *forceToPolygon(OGRGeometry *);
3977 static OGRGeometry *forceToLineString(OGRGeometry *,
3978 bool bOnlyInOrder = true);
3979 static OGRGeometry *forceToMultiPolygon(OGRGeometry *);
3980 static OGRGeometry *forceToMultiPoint(OGRGeometry *);
3981 static OGRGeometry *forceToMultiLineString(OGRGeometry *);
3982
3983 static OGRGeometry *forceTo(OGRGeometry *poGeom,
3984 OGRwkbGeometryType eTargetType,
3985 const char *const *papszOptions = nullptr);
3986
3987 static OGRGeometry *removeLowerDimensionSubGeoms(const OGRGeometry *poGeom);
3988
3989 static OGRGeometry *organizePolygons(OGRGeometry **papoPolygons,
3990 int nPolygonCount,
3991 int *pbResultValidGeometry,
3992 const char **papszOptions = nullptr);
3993 static bool haveGEOS();
3994
3996 class CPL_DLL TransformWithOptionsCache
3997 {
3998 friend class OGRGeometryFactory;
3999 struct Private;
4000 std::unique_ptr<Private> d;
4001
4002 public:
4003 TransformWithOptionsCache();
4004 ~TransformWithOptionsCache();
4005 };
4006
4007 static OGRGeometry *transformWithOptions(
4008 const OGRGeometry *poSrcGeom, OGRCoordinateTransformation *poCT,
4009 char **papszOptions,
4010 const TransformWithOptionsCache &cache = TransformWithOptionsCache());
4011
4012 static OGRGeometry *
4013 approximateArcAngles(double dfX, double dfY, double dfZ,
4014 double dfPrimaryRadius, double dfSecondaryAxis,
4015 double dfRotation, double dfStartAngle,
4016 double dfEndAngle, double dfMaxAngleStepSizeDegrees,
4017 const bool bUseMaxGap = false);
4018
4019 static int GetCurveParameters(double x0, double y0, double x1, double y1,
4020 double x2, double y2, double &R, double &cx,
4021 double &cy, double &alpha0, double &alpha1,
4022 double &alpha2);
4023 static OGRLineString *
4024 curveToLineString(double x0, double y0, double z0, double x1, double y1,
4025 double z1, double x2, double y2, double z2, int bHasZ,
4026 double dfMaxAngleStepSizeDegrees,
4027 const char *const *papszOptions = nullptr);
4028 static OGRCurve *
4029 curveFromLineString(const OGRLineString *poLS,
4030 const char *const *papszOptions = nullptr);
4031 };
4032
4033 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType(const char *pszGeomType);
4034 const char CPL_DLL *OGRToOGCGeomType(OGRwkbGeometryType eGeomType,
4035 bool bCamelCase = false,
4036 bool bAddZM = false,
4037 bool bSpaceBeforeZM = false);
4038
4040 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
4041
4042 struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
4043 {
4044 void operator()(OGRPreparedGeometry *) const;
4045 };
4047
4051 typedef std::unique_ptr<OGRPreparedGeometry,
4052 OGRPreparedGeometryUniquePtrDeleter>
4053 OGRPreparedGeometryUniquePtr;
4054
4055 #endif /* ndef OGR_GEOMETRY_H_INCLUDED */
IOGRGeometryVisitor::visit
virtual void visit(OGRPoint *)=0
Visit OGRPoint.
OGRSimpleCurve::getEnvelope
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition: ogrlinestring.cpp:2257
OGRCurvePolygon::getEnvelope
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition: ogrcurvepolygon.cpp:616
OGRGeometry::importFromWkt
OGRErr importFromWkt(char **ppszInput)
Deprecated.
Definition: ogr_geometry.h:439
OGRGeometry::Is3D
OGRBoolean Is3D() const
Definition: ogr_geometry.h:410
OGRGeometry::IsEmpty
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.
OGRGeometry::toMultiPolygon
OGRMultiPolygon * toMultiPolygon()
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:879
OGRMultiPolygon::ChildType
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:3093
OGRMultiLineString::ChildType
OGRLineString ChildType
Type of child elements.
Definition: ogr_geometry.h:3811
OGRMultiPolygon::getGeometryRef
OGRPolygon * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3123
OGRGeometry::setCoordinateDimension
virtual void setCoordinateDimension(int nDimension)
Set the coordinate dimension.
Definition: ogrgeometry.cpp:1064
OGRCurvePolygon::addRingDirectly
virtual OGRErr addRingDirectly(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:418
OGRMultiLineString::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3872
OGRMultiLineString::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3816
OGRMultiCurve
A collection of OGRCurve.
Definition: ogr_geometry.h:3651
OGRCurve::CastToLineString
static OGRLineString * CastToLineString(OGRCurve *poCurve)
Cast to linestring.
Definition: ogrcurve.cpp:353
OGRRawPoint::OGRRawPoint
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:108
OGRGeometryCollection::isCompatibleSubType
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition: ogrgeometrycollection.cpp:1175
ogr_spatialref.h
OGRWktFormat::F
@ F
F-type formatting.
OGRSimpleCurve::getX
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:1582
OGRPolyhedralSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3252
OGRSurface::get_Area
virtual double get_Area() const =0
Get the area of the surface object.
OGRCurve::get_AreaOfCurveSegments
virtual double get_AreaOfCurveSegments() const =0
Get the area of the purely curve portions of a (closed) curve.
OGRGeometry::operator==
bool operator==(const OGRGeometry &other) const
Returns if two geometries are equal.
Definition: ogr_geometry.h:389
OGRTriangulatedSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3414
OGRLineString
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1681
OGRMultiLineString::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3828
OGRPolyhedralSurface::getNumGeometries
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:794
OGRPolyhedralSurface::getGeometryRef
OGRPolygon * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:816
OGRGeometry::Contains
virtual OGRBoolean Contains(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:5431
OGRMultiPolygon
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:3070
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:205
OGRPolyhedralSurface::CastToMultiPolygon
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:707
OGRPolyhedralSurface::addGeometryDirectly
OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
Definition: ogrpolyhedralsurface.cpp:762
OGRMultiPoint::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3586
OGRGeometryFactory::TransformWithOptionsCache
Opaque class used as argument to transformWithOptions()
Definition: ogr_geometry.h:3996
OGRSimpleCurve::clone
virtual OGRSimpleCurve * clone() const override=0
Make a copy of this object.
OGRPointIterator
Interface for a point iterator.
Definition: ogr_geometry.h:1236
OGRMultiSurface::ChildType
OGRSurface ChildType
Type of child elements.
Definition: ogr_geometry.h:2935
OGRMultiSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2940
OGRCurvePolygon::flattenTo2D
virtual void flattenTo2D() override
Convert geometry to strictly 2D. In a sense this converts all Z coordinates to 0.0.
Definition: ogrcurvepolygon.cpp:148
OGRGeometry::closeRings
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:5565
OGRMultiSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3022
OGRCompoundCurve
Utility class to store a collection of curves.
Definition: ogr_geometry.h:2072
OGRPolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2618
OGRGeometry::clone
virtual OGRGeometry * clone() const =0
Make a copy of this object.
OGRSimpleCurve::getNumPoints
virtual int getNumPoints() const override
Fetch vertex count.
Definition: ogr_geometry.h:1577
OGRGeometry::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
OGRGeometry::swapXY
virtual void swapXY()
Swap x and y coordinates.
Definition: ogrgeometry.cpp:6247
OGRSimpleCurve::importFromWkt
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrlinestring.cpp:1732
OGRPolyhedralSurface::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Returns the WKB Type of PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:120
OGRLineString::toUpperClass
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1720
OGRGeometryCollection::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrgeometrycollection.cpp:1186
OGRGeometry::toCurve
OGRCurve * toCurve()
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:623
OGRWktOptions::format
OGRWktFormat format
Formatting type.
Definition: ogr_geometry.h:79
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:364
OGRMultiLineString::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3833
OGRCurvePolygon::IsEmpty
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:714
OGRPolygon::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2551
OGRMultiSurface::getGeometryRef
OGRSurface * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2993
IOGRConstGeometryVisitor
OGRGeometry visitor interface.
Definition: ogr_geometry.h:238
OGRWktOptions::OGRWktOptions
OGRWktOptions()
Constructor.
Definition: ogr_geometry.h:82
OGRSimpleCurve::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrlinestring.cpp:1630
OGRPoint::setM
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:1193
OGRTriangulatedSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3407
OGRGeometry::assignSpatialReference
virtual void assignSpatialReference(const OGRSpatialReference *poSR)
Assign spatial reference to this object.
Definition: ogrgeometry.cpp:468
OGRSimpleCurve::WkbSize
virtual size_t WkbSize() const override
Returns size of related binary representation.
Definition: ogrlinestring.cpp:185
OGRLinearRing::toUpperClass
const OGRLineString * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1824
OGRCurvePolygon::CurvePolyToPoly
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const
Return a polygon from a curve polygon.
Definition: ogrcurvepolygon.cpp:566
OGRCompoundCurve::begin
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:2113
OGRGeometry::set3D
virtual void set3D(OGRBoolean bIs3D)
Add or remove the Z coordinate dimension.
Definition: ogrgeometry.cpp:1087
OGRGeometry::toCompoundCurve
const OGRCompoundCurve * toCompoundCurve() const
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:731
OGRGeometryFactory
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:3934
OGRGeometryCollection::end
const ChildType *const * end() const
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2791
OGRGeometry::toMultiSurface
OGRMultiSurface * toMultiSurface()
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:919
OGRMultiPolygon::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3159
OGRMultiCurve::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3690
OGRPolyhedralSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3330
OGRMultiCurve::isCompatibleSubType
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition: ogrmulticurve.cpp:144
OGRTriangle::toUpperClass
const OGRPolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2707
OGRMultiPoint::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3530
OGRGeometry::FromHandle
static OGRGeometry * FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
Definition: ogr_geometry.h:595
OGRMultiSurface::getGeometryRef
const OGRSurface * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2998
OGRPolygon::ChildType
OGRLinearRing ChildType
Type of child elements.
Definition: ogr_geometry.h:2529
OGRCurvePolygon::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrcurvepolygon.cpp:591
OGRGeometryCollection
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:2740
OGRGeometry::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const
Returns if this geometry is or has curve geometry.
Definition: ogrgeometry.cpp:3259
wkbVariantOldOgc
@ wkbVariantOldOgc
Old-style 99-402 extended dimension (Z) WKB types.
Definition: ogr_core.h:542
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:166
OGRPolyhedralSurface::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrpolyhedralsurface.cpp:106
OGRGeometryCollection::getGeometryRef
OGRGeometry * getGeometryRef(int)
Fetch geometry from container.
Definition: ogrgeometrycollection.cpp:259
OGRGeometry::toCircularString
OGRCircularString * toCircularString()
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:701
OGRPolyhedralSurface
PolyhedralSurface class.
Definition: ogr_geometry.h:3215
OGRCurve::isClockwise
virtual int isClockwise() const
Returns TRUE if the ring has clockwise winding (or less than 2 points)
Definition: ogrcurve.cpp:711
OGRGeometry::toCircularString
const OGRCircularString * toCircularString() const
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:711
OGRMultiPolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3164
OGRCompoundCurve::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2211
OGRCurve::Value
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
OGRGeometryCollection::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrgeometrycollection.cpp:215
OGRGeometry::toTriangulatedSurface
OGRTriangulatedSurface * toTriangulatedSurface()
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:958
OGRGeometry::toTriangle
const OGRTriangle * toTriangle() const
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:789
OGRGeometry::toPolygon
const OGRPolygon * toPolygon() const
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:771
OGRGeometry::getLinearGeometry
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrgeometry.cpp:3292
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:334
OGRMultiPoint
A collection of OGRPoint.
Definition: ogr_geometry.h:3504
OGRGeometry::IsValid
virtual OGRBoolean IsValid() const
Test if the geometry is valid.
Definition: ogrgeometry.cpp:2177
OGRGeometry::getGeometryName
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
OGRPolygon::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrpolygon.cpp:130
OGRPolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2622
OGRIteratedPoint
Definition: ogr_geometry.h:1397
OGRCurve::toSimpleCurve
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1344
OGRCurvePolygon::clone
virtual OGRCurvePolygon * clone() const override
Make a copy of this object.
Definition: ogrcurvepolygon.cpp:101
OGRPolyhedralSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3247
OGRMultiSurface
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:2922
OGRGeometry::importFromWkb
OGRErr importFromWkb(const GByte *, size_t=static_cast< size_t >(-1), OGRwkbVariant=wkbVariantOldOgc)
Assign geometry from well known binary data.
Definition: ogrgeometry.cpp:1463
OGRPoint
Point class.
Definition: ogr_geometry.h:1083
OGRGeometryFactory::createFromWkt
static OGRErr createFromWkt(char **ppszInput, const OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
Definition: ogr_geometry.h:3957
OGRWktOptions::round
bool round
Whether GDAL-special rounding should be applied.
Definition: ogr_geometry.h:77
OGRPolygon::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolygon.cpp:400
OGRMultiCurve::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3748
OGRTriangulatedSurface::addGeometry
virtual OGRErr addGeometry(const OGRGeometry *) override
Add a new geometry to a collection.
Definition: ogrtriangulatedsurface.cpp:188
OGRSimpleCurve::getY
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:1586
OGRGeometry::exportToWkt
OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const
Convert a geometry into well known text format.
Definition: ogrgeometry.cpp:1863
OGRMultiCurve::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3743
OGRCurvePolygon::empty
virtual void empty() override
Clear geometry information. This restores the geometry to its initial state after construction,...
Definition: ogrcurvepolygon.cpp:111
OGRCurvePolygon::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a curve polygon to WKT.
Definition: ogrcurvepolygon.cpp:537
OGRGeometry::operator=
OGRGeometry & operator=(const OGRGeometry &other)
Assignment operator.
Definition: ogrgeometry.cpp:150
OGRMultiPolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3168
OGRGeometry::importFromWkt
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
OGRMultiCurve::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a multicurve to WKT.
Definition: ogrmulticurve.cpp:183
OGRWktOptions::variant
OGRwkbVariant variant
Type of WKT output to produce.
Definition: ogr_geometry.h:73
OGRPolygon::operator=
OGRPolygon & operator=(const OGRPolygon &other)
Assignment operator.
Definition: ogrpolygon.cpp:90
OGRWktFormat::Default
@ Default
Format as F when abs(value) < 1, otherwise as G.
OGRBoolean
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:395
OGRMultiPoint::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3542
OGRRawPoint::x
double x
x
Definition: ogr_geometry.h:118
OGRMultiCurve::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3678
OGRPoint::setX
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:1163
OGRLineString::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrlinestring.cpp:2773
OGRWktOptions::precision
int precision
Precision of output. Interpretation depends on format.
Definition: ogr_geometry.h:75
OGRGeometry::toLinearRing
const OGRLinearRing * toLinearRing() const
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:691
OGRGeometryCollection::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2868
OGRSurface::PointOnSurface
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:2271
OGRPolygon::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a polygon to WKT.
Definition: ogrpolygon.cpp:656
OGRLinearRing::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1829
OGRGeometry::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const =0
Convert a geometry into well known binary format.
OGRMultiPolygon::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3098
OGRMultiSurface::clone
virtual OGRMultiSurface * clone() const override
Make a copy of this object.
Definition: ogrmultisurface.cpp:97
OGRRawPoint
Simple container for a position.
Definition: ogr_geometry.h:104
OGRMultiLineString
A collection of OGRLineString.
Definition: ogr_geometry.h:3798
OGRCurvePolygon::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2341
OGRGeometry::flattenTo2D
virtual void flattenTo2D()=0
Convert geometry to strictly 2D. In a sense this converts all Z coordinates to 0.0.
OGRCurve::StartPoint
virtual void StartPoint(OGRPoint *) const =0
Return the curve start point.
OGRMultiSurface::isCompatibleSubType
virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override
Returns whether a geometry of the specified geometry type can be a member of this collection.
Definition: ogrmultisurface.cpp:145
OGRGeometry::toMultiCurve
OGRMultiCurve * toMultiCurve()
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:899
OGRMultiPoint::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:3520
OGRPolyhedralSurface::addGeometry
virtual OGRErr addGeometry(const OGRGeometry *)
Add a new geometry to a collection.
Definition: ogrpolyhedralsurface.cpp:726
OGRMultiLineString::getGeometryRef
OGRLineString * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3841
OGRSurface
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:2261
OGRSimpleCurve::operator=
OGRSimpleCurve & operator=(const OGRSimpleCurve &other)
Assignment operator.
Definition: ogrlinestring.cpp:112
OGRMultiSurface::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrmultisurface.cpp:293
OGRCurve::getNumPoints
virtual int getNumPoints() const =0
Return the number of points of a curve geometry.
OGRPolygon::WkbSize
virtual size_t WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolygon.cpp:329
OGRwkbByteOrder
OGRwkbByteOrder
Enumeration to describe byte order.
Definition: ogr_core.h:610
OGRTriangulatedSurface::toUpperClass
OGRPolyhedralSurface * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3444
OGRCircularString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1943
OGRTriangle::operator=
OGRTriangle & operator=(const OGRTriangle &other)
Assignment operator.
Definition: ogrtriangle.cpp:135
OGRTriangulatedSurface::ChildType
OGRTriangle ChildType
Type of child elements.
Definition: ogr_geometry.h:3397
OGRCircularString
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:1858
OGRCurvePolygon::OGRCurvePolygon
OGRCurvePolygon()
Create an empty curve polygon.
OGRSurface::clone
virtual OGRSurface * clone() const override=0
Make a copy of this object.
OGRMultiCurve::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrmulticurve.cpp:106
OGRGeometry::Intersects
virtual OGRBoolean Intersects(const OGRGeometry *) const
Do these features intersect?
Definition: ogrgeometry.cpp:538
OGRPolygon::CurvePolyToPoly
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:772
OGRGeometry::toLineString
const OGRLineString * toLineString() const
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:673
OGRGeometry::toTriangle
OGRTriangle * toTriangle()
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:780
CSLConstList
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1195
CPLJSONObject
The CPLJSONArray class holds JSON object from CPLJSONDocument.
Definition: cpl_json.h:54
OGRGeometryCollection::operator=
OGRGeometryCollection & operator=(const OGRGeometryCollection &other)
Assignment operator.
Definition: ogrgeometrycollection.cpp:109
OGRSimpleCurve::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a simple curve to WKT.
Definition: ogrlinestring.cpp:1852
OGRTriangulatedSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3454
OGRGeometry::toPoint
OGRPoint * toPoint()
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:604
OGRLineString::clone
virtual OGRLineString * clone() const override
Make a copy of this object.
Definition: ogrlinestring.cpp:2896
OGRCurvePolygon::set3D
virtual void set3D(OGRBoolean bIs3D) override
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:691
OGRGeometry::toSurface
OGRSurface * toSurface()
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:741
OGRMultiCurve::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3673
OGRMultiSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3018
OGRCompoundCurve::begin
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:2125
OGRGeometryCollection::ChildType
OGRGeometry ChildType
Type of child elements.
Definition: ogr_geometry.h:2769
OGRCurvePolygon::assignSpatialReference
virtual void assignSpatialReference(const OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrcurvepolygon.cpp:705
OGRMultiCurve::getGeometryRef
OGRCurve * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3698
OGRMultiSurface::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3013
OGRMultiCurve::clone
virtual OGRMultiCurve * clone() const override
Make a copy of this object.
Definition: ogrmulticurve.cpp:96
OGRGeometry::toPolyhedralSurface
OGRPolyhedralSurface * toPolyhedralSurface()
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:939
OGRCurvePolygon::importFromWkb
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrcurvepolygon.cpp:465
sfcgal_geometry_t
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:128
OGRCurvePolygon::transform
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:655
OGRCurve::CurveToLine
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const =0
Return a linestring from a curve geometry.
OGRPolyhedralSurface::~OGRPolyhedralSurface
~OGRPolyhedralSurface() override
Destructor.
OGRTriangle::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2716
OGRMultiLineString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3882
OGRGeometryCollection::importFromWkt
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrgeometrycollection.cpp:772
OGRLineString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1734
OGRCurve::ContainsPoint
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:396
OGRCurvePolygon::setCoordinateDimension
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrcurvepolygon.cpp:685
OGRCurvePolygon::end
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:2351
OGRMultiSurface::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3008
OGRSimpleCurve::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1512
OGRPoint::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1213
OGRGeometry::toPoint
const OGRPoint * toPoint() const
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:613
OGRRawPoint::OGRRawPoint
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:113
OGRPolyhedralSurface::removeGeometry
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:952
OGRCurvePolygon::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrcurvepolygon.cpp:121
OGRMultiCurve::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3738
OGRCurve::toSimpleCurve
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1336
cpl_conv.h
OGRCurvePolygon::CastToPolygon
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:826
OGRTriangulatedSurface::toUpperClass
const OGRPolyhedralSurface * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3449
OGRPolygon::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrpolygon.cpp:113
OGRGeometryCollection::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2872
OGRMultiPoint::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3537
OGRGeometry::toLineString
OGRLineString * toLineString()
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:663
OGRCurve::EndPoint
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
OGRGeometry::toSimpleCurve
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:643
cpl_json.h
OGRCurvePolygon::end
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:2363
OGRGeometry::empty
virtual void empty()=0
Clear geometry information. This restores the geometry to its initial state after construction,...
OGRTriangle::toUpperClass
OGRPolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2702
OGRGeometry::toCurvePolygon
const OGRCurvePolygon * toCurvePolygon() const
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:809
OGRGeometry::toTriangulatedSurface
const OGRTriangulatedSurface * toTriangulatedSurface() const
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:967
OGRMultiCurve::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:3668
OGRGeometry::toSimpleCurve
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:653
OGRMultiSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2952
OGRSimpleCurve
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:1441
OGRFromOGCGeomType
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGCgeometry format type to corresponding OGR constants.
Definition: ogrgeometry.cpp:2427
OGRGeometryH
void * OGRGeometryH
Opaque type for a geometry.
Definition: ogr_api.h:66
OGRMultiCurve::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrmulticurve.cpp:133
OGRMultiLineString::getGeometryRef
const OGRLineString * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3846
OGRMultiPolygon::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3103
OGRMultiCurve::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3685
OGRTriangulatedSurface::getGeometryRef
OGRTriangle * getGeometryRef(int i)
See OGRPolyhedralSurface::getGeometryRef()
Definition: ogr_geometry.h:3430
OGRMultiSurface::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrmultisurface.cpp:107
OGRMultiPolygon::getGeometryRef
const OGRPolygon * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3128
OGRTriangle::addRingDirectly
virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override
Add a ring to a polygon.
Definition: ogrtriangle.cpp:246
OGRCurvePolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2449
GEOSGeom
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:124
OGRPoint::IsEmpty
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:1131
OGRSimpleCurve::importFromWkb
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrlinestring.cpp:1517
OGRCoordinateTransformation
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:765
OGRToOGCGeomType
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:2506
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:372
OGRMultiPoint::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3600
OGRCurve::getPointIterator
virtual OGRPointIterator * getPointIterator() const =0
Returns a point iterator over the curve.
OGRCurvePolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2445
IOGRGeometryVisitor
OGRGeometry visitor interface.
Definition: ogr_geometry.h:163
OGRTriangulatedSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3458
OGRCompoundCurve::end
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:2118
OGRCircularString::toUpperClass
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1934
OGRPoint::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1209
OGRCircularString::toUpperClass
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1929
OGRGeometry::getDimension
virtual int getDimension() const =0
Get the dimension of this object.
OGRCurve::clone
virtual OGRCurve * clone() const override=0
Make a copy of this object.
OGRGeometry::toLinearRing
OGRLinearRing * toLinearRing()
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:682
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:378
OGRSimpleCurve::segmentize
virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrlinestring.cpp:2481
OGRPolygon::importFromWkb
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrpolygon.cpp:349
OGRGeometry::toCurvePolygon
OGRCurvePolygon * toCurvePolygon()
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:799
OGRGeometry::segmentize
virtual void segmentize(double dfMaxLength)
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrgeometry.cpp:846
OGRMultiLineString::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3877
OGRCompoundCurve::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2215
OGRMultiPoint::getGeometryRef
OGRPoint * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3550
OGRMultiSurface::operator=
OGRMultiSurface & operator=(const OGRMultiSurface &other)
Assignment operator.
Definition: ogrmultisurface.cpp:84
OGRGeometry::toPolygon
OGRPolygon * toPolygon()
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:761
OGRWktFormat
OGRWktFormat
WKT Output formatting options.
Definition: ogr_geometry.h:61
OGRMultiSurface::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a geometry collection to WKT.
Definition: ogrmultisurface.cpp:281
OGRGeometry::toGeometryCollection
OGRGeometryCollection * toGeometryCollection()
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:819
OGRCurvePolygon::getExteriorRingCurve
OGRCurve * getExteriorRingCurve()
Fetch reference to external polygon ring.
Definition: ogrcurvepolygon.cpp:184
OGRGeometry::toMultiCurve
const OGRMultiCurve * toMultiCurve() const
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:909
OGRCurvePolygon::getNumInteriorRings
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:221
OGRMultiPoint::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3596
OGRPolyhedralSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3264
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:406
OGRMultiSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2945
OGRCurvePolygon::Equals
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:636
OGRMultiCurve::operator=
OGRMultiCurve & operator=(const OGRMultiCurve &other)
Assignment operator.
Definition: ogrmulticurve.cpp:83
OGRTriangulatedSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3402
OGRMultiPolygon::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3110
OGRPolygon::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2546
CPL_WARN_UNUSED_RESULT
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:985
OGRTriangle
Triangle class.
Definition: ogr_geometry.h:2667
OGRMultiLineString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3886
OGRPolyhedralSurface::clone
virtual OGRPolyhedralSurface * clone() const override
Make a copy of this object.
Definition: ogrpolyhedralsurface.cpp:96
OGRPolygon::clone
virtual OGRPolygon * clone() const override
Make a copy of this object.
Definition: ogrpolygon.cpp:103
OGRGeometry::toMultiPoint
const OGRMultiPoint * toMultiPoint() const
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:849
OGRPolyhedralSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3259
OGRCurvePolygon::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrcurvepolygon.cpp:158
OGRPoint::setY
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:1174
OGRTriangulatedSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3419
OGRPolygon::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2534
OGRDefaultConstGeometryVisitor
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:285
OGRCurvePolygon::removeRing
OGRErr removeRing(int iIndex, bool bDelete=true)
Remove a geometry from the container.
Definition: ogrcurvepolygon.cpp:322
OGRCompoundCurve::get_AreaOfCurveSegments
virtual double get_AreaOfCurveSegments() const override
Return area of curve segments.
Definition: ogrcompoundcurve.cpp:901
OGRGeometryCollection::end
ChildType ** end()
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2779
OGRCurvePolygon::WkbSize
virtual size_t WkbSize() const override
Returns size of related binary representation.
Definition: ogrcurvepolygon.cpp:441
OGRGeometry::toMultiSurface
const OGRMultiSurface * toMultiSurface() const
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:929
OGRGeometryCollection::begin
ChildType ** begin()
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2774
OGRPoint::getZ
double getZ() const
Return z.
Definition: ogr_geometry.h:1148
OGRPoint::setZ
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:1185
OGRGeometry::toSurface
const OGRSurface * toSurface() const
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:751
OGRCurvePolygon::addRing
virtual OGRErr addRing(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:345
OGRPolygon::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:782
OGREnvelope3D
Simple container for a bounding region in 3D.
Definition: ogr_core.h:212
OGRGeometry::WkbSize
virtual size_t WkbSize() const =0
Returns size of related binary representation.
OGRCompoundCurve::end
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:2130
OGRGeometry::IsMeasured
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:415
OGRCurvePolygon::operator=
OGRCurvePolygon & operator=(const OGRCurvePolygon &other)
Assignment operator.
Definition: ogrcurvepolygon.cpp:86
OGRPreparedGeometryUniquePtr
std::unique_ptr< OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter > OGRPreparedGeometryUniquePtr
Unique pointer type for OGRPreparedGeometry.
Definition: ogr_geometry.h:4053
OGRMultiCurve::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrmulticurve.cpp:195
OGRGeometry::getCurveGeometry
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=nullptr) const
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3327
OGRCurve
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:1254
OGRSimpleCurve::transform
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrlinestring.cpp:2360
OGRSimpleCurve::get_Length
virtual double get_Length() const override
Returns the length of the curve.
Definition: ogrlinestring.cpp:1908
OGRPoint::getY
double getY() const
Return y.
Definition: ogr_geometry.h:1143
OGRDefaultGeometryVisitor::visit
void visit(OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:215
OGRMultiPoint::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3591
OGRCurvePolygon::segmentize
virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:723
GEOSContextHandle_t
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
Definition: ogr_geometry.h:126
OGRPolygon::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2539
OGRGeometryCollection::getDimension
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrgeometrycollection.cpp:176
OGRGeometry::transform
virtual OGRErr transform(OGRCoordinateTransformation *poCT)=0
Apply arbitrary coordinate transformation to geometry.
OGRPolyhedralSurface::operator=
OGRPolyhedralSurface & operator=(const OGRPolyhedralSurface &other)
Assignment operator.
Definition: ogrpolyhedralsurface.cpp:82
OGRWktFormat::G
@ G
G-type formatting.
OGRPolyhedralSurface::OGRPolyhedralSurface
OGRPolyhedralSurface()
Create an empty PolyhedralSurface.
OGRMultiPolygon::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3154
OGRLinearRing
Concrete representation of a closed ring.
Definition: ogr_geometry.h:1767
OGRGeometryUniquePtr
std::unique_ptr< OGRGeometry, OGRGeometryUniquePtrDeleter > OGRGeometryUniquePtr
Unique pointer type for OGRGeometry.
Definition: ogr_geometry.h:984
OGREnvelope
Simple container for a bounding region (rectangle)
Definition: ogr_core.h:57
OGRTriangle::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2712
OGRGeometry::toGeometryCollection
const OGRGeometryCollection * toGeometryCollection() const
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:829
OGRSimpleCurve::Value
virtual void Value(double, OGRPoint *) const override
Fetch point at given distance along curve.
Definition: ogrlinestring.cpp:1950
OGRCurvePolygon::begin
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:2346
OGRGeometry::toMultiPolygon
const OGRMultiPolygon * toMultiPolygon() const
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:889
OGRMultiCurve::getGeometryRef
const OGRCurve * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3703
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRPoint *)=0
Visit OGRPoint.
OGRCurve::CastToLinearRing
static OGRLinearRing * CastToLinearRing(OGRCurve *poCurve)
Cast to linear ring.
Definition: ogrcurve.cpp:375
OGRMultiCurve::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3752
OGRPolyhedralSurface::ChildType
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:3242
OGRMultiPoint::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3525
OGRGeometry::toMultiPoint
OGRMultiPoint * toMultiPoint()
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:839
OGRRawPoint::y
double y
y
Definition: ogr_geometry.h:120
OGRGeometry::toCurve
const OGRCurve * toCurve() const
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:633
OGRWktOptions
Options for formatting WKT output.
Definition: ogr_geometry.h:69
OGRCurvePolygon::importFromWkt
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrcurvepolygon.cpp:522
OGRGeometry::toMultiLineString
const OGRMultiLineString * toMultiLineString() const
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:869
OGRTriangulatedSurface::getGeometryRef
const OGRTriangle * getGeometryRef(int i) const
See OGRPolyhedralSurface::getGeometryRef()
Definition: ogr_geometry.h:3435
OGRMultiSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2957
OGRLineString::toUpperClass
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1725
OGRCurvePolygon::setMeasured
virtual void setMeasured(OGRBoolean bIsMeasured) override
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:696
OGRCurve::IntersectsPoint
virtual int IntersectsPoint(const OGRPoint *p) const
Returns if a point intersects a (closed) curve.
Definition: ogrcurve.cpp:416
OGRPolygon::toUpperClass
const OGRCurvePolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2613
OGRLineString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1730
OGRPolygon
Concrete class representing polygons.
Definition: ogr_geometry.h:2499
OGRTriangulatedSurface
TriangulatedSurface class.
Definition: ogr_geometry.h:3378
OGRCurvePolygon
Concrete class representing curve polygons.
Definition: ogr_geometry.h:2305
OGRPoint::getM
double getM() const
Return m.
Definition: ogr_geometry.h:1153
OGRGeometry::getEnvelope
virtual void getEnvelope(OGREnvelope *psEnvelope) const =0
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
OGRPolyhedralSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3326
OGRCurvePolygon::getInteriorRingCurve
OGRCurve * getInteriorRingCurve(int)
Fetch reference to indicated internal ring.
Definition: ogrcurvepolygon.cpp:249
OGRGeometry::Equals
virtual OGRBoolean Equals(const OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
OGRCurvePolygon::begin
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:2358
OGRCurve::get_Length
virtual double get_Length() const =0
Returns the length of the curve.
ogr_core.h
OGRMultiPoint::getGeometryRef
const OGRPoint * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3555
OGRMultiSurface::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrmultisurface.cpp:134
OGRGeometry::toPolyhedralSurface
const OGRPolyhedralSurface * toPolyhedralSurface() const
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:949
OGRGeometryCollection::begin
const ChildType *const * begin() const
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2786
OGRGeometry::toMultiLineString
OGRMultiLineString * toMultiLineString()
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:859
OGRLineString::operator=
OGRLineString & operator=(const OGRLineString &other)
Assignment operator.
Definition: ogrlinestring.cpp:2743
OGRCurvePolygon::getLinearGeometry
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrcurvepolygon.cpp:606
OGRGeometry::Within
virtual OGRBoolean Within(const OGRGeometry *) const
Test for containment.
Definition: ogrgeometry.cpp:5358
OGRGeometryCollection::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrgeometrycollection.cpp:159
OGRCircularString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1939
OGRGeometry::setMeasured
virtual void setMeasured(OGRBoolean bIsMeasured)
Add or remove the M coordinate dimension.
Definition: ogrgeometry.cpp:1110
OGRPolygon::toUpperClass
OGRCurvePolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2608
OGRCurvePolygon::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrcurvepolygon.cpp:494
CPL_DISALLOW_COPY_ASSIGN
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1051
OGRGeometry::operator!=
bool operator!=(const OGRGeometry &other) const
Returns if two geometries are different.
Definition: ogr_geometry.h:395
OGRDefaultConstGeometryVisitor::visit
void visit(const OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:290
OGRwkbVariant
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:540
OGRGeometryCollection::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a geometry collection to WKT.
Definition: ogrgeometrycollection.cpp:785
OGRCurvePolygon::stealExteriorRingCurve
OGRCurve * stealExteriorRingCurve()
"Steal" reference to external ring.
Definition: ogrcurvepolygon.cpp:290
OGRCurve::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1298
OGRCompoundCurve::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2108
OGRLinearRing::toUpperClass
OGRLineString * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1819
OGRGeometryCollection::clone
virtual OGRGeometryCollection * clone() const override
Make a copy of this object.
Definition: ogrgeometrycollection.cpp:149
OGRGeometry::toCompoundCurve
OGRCompoundCurve * toCompoundCurve()
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:721
OGRCurvePolygon::swapXY
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:738
OGRPoint::getX
double getX() const
Return x.
Definition: ogr_geometry.h:1138
OGRCurve::get_Area
virtual double get_Area() const =0
Get the area of the (closed) curve.
OGRGeometry::ToHandle
static OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
Definition: ogr_geometry.h:587
OGRMultiLineString::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3821
OGRMultiPolygon::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3115
OGRDefaultGeometryVisitor
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:210
OGRLinearRing::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1833