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_geomcoordinateprecision.h"
39#include "ogr_spatialref.h"
40
41#include <climits>
42#include <cmath>
43#include <memory>
44
52#ifndef DEFINEH_OGRGeometryH
53#define DEFINEH_OGRGeometryH
54#ifdef DEBUG
55typedef struct OGRGeometryHS *OGRGeometryH;
56#else
57typedef void *OGRGeometryH;
58#endif
59#endif /* DEFINEH_OGRGeometryH */
63enum class OGRWktFormat
64{
65 F,
66 G,
67 Default
68};
69
71struct CPL_DLL OGRWktOptions
72{
73 public:
83 bool round = getDefaultRound();
85 OGRWktFormat format = OGRWktFormat::Default;
86
89 : xyPrecision(getDefaultPrecision()), zPrecision(xyPrecision),
90 mPrecision(zPrecision)
91 {
92 }
93
95 OGRWktOptions(const OGRWktOptions &) = default;
96
97 private:
98 static int getDefaultPrecision();
99 static bool getDefaultRound();
100};
101
106{
107 public:
109 OGRRawPoint() : x(0.0), y(0.0)
110 {
111 }
112
114 OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn)
115 {
116 }
117
119 double x;
121 double y;
122};
123
125typedef struct GEOSGeom_t *GEOSGeom;
127typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
129typedef void sfcgal_geometry_t;
130
131class OGRPoint;
132class OGRCurve;
133class OGRCompoundCurve;
134class OGRSimpleCurve;
135class OGRLinearRing;
136class OGRLineString;
138class OGRSurface;
139class OGRCurvePolygon;
140class OGRPolygon;
141class OGRMultiPoint;
142class OGRMultiSurface;
143class OGRMultiPolygon;
144class OGRMultiCurve;
147class OGRTriangle;
150
152typedef OGRLineString *(*OGRCurveCasterToLineString)(OGRCurve *);
153typedef OGRLinearRing *(*OGRCurveCasterToLinearRing)(OGRCurve *);
154
155typedef OGRPolygon *(*OGRSurfaceCasterToPolygon)(OGRSurface *);
156typedef OGRCurvePolygon *(*OGRSurfaceCasterToCurvePolygon)(OGRSurface *);
157typedef OGRMultiPolygon *(*OGRPolyhedralSurfaceCastToMultiPolygon)(
159
161
166{
167 public:
169 virtual ~IOGRGeometryVisitor() = default;
170
172 virtual void visit(OGRPoint *) = 0;
174 virtual void visit(OGRLineString *) = 0;
176 virtual void visit(OGRLinearRing *) = 0;
178 virtual void visit(OGRPolygon *) = 0;
180 virtual void visit(OGRMultiPoint *) = 0;
182 virtual void visit(OGRMultiLineString *) = 0;
184 virtual void visit(OGRMultiPolygon *) = 0;
186 virtual void visit(OGRGeometryCollection *) = 0;
188 virtual void visit(OGRCircularString *) = 0;
190 virtual void visit(OGRCompoundCurve *) = 0;
192 virtual void visit(OGRCurvePolygon *) = 0;
194 virtual void visit(OGRMultiCurve *) = 0;
196 virtual void visit(OGRMultiSurface *) = 0;
198 virtual void visit(OGRTriangle *) = 0;
200 virtual void visit(OGRPolyhedralSurface *) = 0;
202 virtual void visit(OGRTriangulatedSurface *) = 0;
203};
204
213{
214 void _visit(OGRSimpleCurve *poGeom);
215
216 public:
217 void visit(OGRPoint *) override
218 {
219 }
220
221 void visit(OGRLineString *) override;
222 void visit(OGRLinearRing *) override;
223 void visit(OGRPolygon *) override;
224 void visit(OGRMultiPoint *) override;
225 void visit(OGRMultiLineString *) override;
226 void visit(OGRMultiPolygon *) override;
227 void visit(OGRGeometryCollection *) override;
228 void visit(OGRCircularString *) override;
229 void visit(OGRCompoundCurve *) override;
230 void visit(OGRCurvePolygon *) override;
231 void visit(OGRMultiCurve *) override;
232 void visit(OGRMultiSurface *) override;
233 void visit(OGRTriangle *) override;
234 void visit(OGRPolyhedralSurface *) override;
235 void visit(OGRTriangulatedSurface *) override;
236};
237
242{
243 public:
245 virtual ~IOGRConstGeometryVisitor() = default;
246
248 virtual void visit(const OGRPoint *) = 0;
250 virtual void visit(const OGRLineString *) = 0;
252 virtual void visit(const OGRLinearRing *) = 0;
254 virtual void visit(const OGRPolygon *) = 0;
256 virtual void visit(const OGRMultiPoint *) = 0;
258 virtual void visit(const OGRMultiLineString *) = 0;
260 virtual void visit(const OGRMultiPolygon *) = 0;
262 virtual void visit(const OGRGeometryCollection *) = 0;
264 virtual void visit(const OGRCircularString *) = 0;
266 virtual void visit(const OGRCompoundCurve *) = 0;
268 virtual void visit(const OGRCurvePolygon *) = 0;
270 virtual void visit(const OGRMultiCurve *) = 0;
272 virtual void visit(const OGRMultiSurface *) = 0;
274 virtual void visit(const OGRTriangle *) = 0;
276 virtual void visit(const OGRPolyhedralSurface *) = 0;
278 virtual void visit(const OGRTriangulatedSurface *) = 0;
279};
280
289{
290 void _visit(const OGRSimpleCurve *poGeom);
291
292 public:
293 void visit(const OGRPoint *) override
294 {
295 }
296
297 void visit(const OGRLineString *) override;
298 void visit(const OGRLinearRing *) override;
299 void visit(const OGRPolygon *) override;
300 void visit(const OGRMultiPoint *) override;
301 void visit(const OGRMultiLineString *) override;
302 void visit(const OGRMultiPolygon *) override;
303 void visit(const OGRGeometryCollection *) override;
304 void visit(const OGRCircularString *) override;
305 void visit(const OGRCompoundCurve *) override;
306 void visit(const OGRCurvePolygon *) override;
307 void visit(const OGRMultiCurve *) override;
308 void visit(const OGRMultiSurface *) override;
309 void visit(const OGRTriangle *) override;
310 void visit(const OGRPolyhedralSurface *) override;
311 void visit(const OGRTriangulatedSurface *) override;
312};
313
314/************************************************************************/
315/* OGRGeomCoordinateBinaryPrecision */
316/************************************************************************/
317
323{
324 int nXYBitPrecision =
325 INT_MIN;
327 int nZBitPrecision =
328 INT_MIN;
330 int nMBitPrecision =
331 INT_MIN;
334 void SetFrom(const OGRGeomCoordinatePrecision &);
335};
336
337/************************************************************************/
338/* OGRwkbExportOptions */
339/************************************************************************/
340
346{
347 OGRwkbByteOrder eByteOrder = wkbNDR;
350};
351
352/************************************************************************/
353/* OGRGeometry */
354/************************************************************************/
355
376class CPL_DLL OGRGeometry
377{
378 private:
379 const OGRSpatialReference *poSRS = nullptr; // may be NULL
380
381 protected:
383 friend class OGRCurveCollection;
384
385 unsigned int flags = 0;
386
387 OGRErr importPreambleFromWkt(const char **ppszInput, int *pbHasZ,
388 int *pbHasM, bool *pbIsEmpty);
389 OGRErr importCurveCollectionFromWkt(
390 const char **ppszInput, int bAllowEmptyComponent, int bAllowLineString,
391 int bAllowCurve, int bAllowCompoundCurve,
392 OGRErr (*pfnAddCurveDirectly)(OGRGeometry *poSelf, OGRCurve *poCurve));
393 OGRErr importPreambleFromWkb(const unsigned char *pabyData, size_t nSize,
394 OGRwkbByteOrder &eByteOrder,
395 OGRwkbVariant eWkbVariant);
396 OGRErr importPreambleOfCollectionFromWkb(const unsigned char *pabyData,
397 size_t &nSize, size_t &nDataOffset,
398 OGRwkbByteOrder &eByteOrder,
399 size_t nMinSubGeomSize,
400 int &nGeomCount,
401 OGRwkbVariant eWkbVariant);
402 OGRErr PointOnSurfaceInternal(OGRPoint *poPoint) const;
403 OGRBoolean IsSFCGALCompatible() const;
404
405 void HomogenizeDimensionalityWith(OGRGeometry *poOtherGeom);
406 std::string wktTypeString(OGRwkbVariant variant) const;
407
409
410 public:
411 /************************************************************************/
412 /* Bit flags for OGRGeometry */
413 /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
414 /* Do not use these outside of the core. */
415 /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
416 /************************************************************************/
417
419 static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
420 static const unsigned int OGR_G_3D = 0x2;
421 static const unsigned int OGR_G_MEASURED = 0x4;
423
424 OGRGeometry();
425 OGRGeometry(const OGRGeometry &other);
426 virtual ~OGRGeometry();
427
428 OGRGeometry &operator=(const OGRGeometry &other);
429
431 bool operator==(const OGRGeometry &other) const
432 {
433 return CPL_TO_BOOL(Equals(&other));
434 }
435
437 bool operator!=(const OGRGeometry &other) const
438 {
439 return !CPL_TO_BOOL(Equals(&other));
440 }
441
442 // Standard IGeometry.
443 virtual int getDimension() const = 0;
444 virtual int getCoordinateDimension() const;
445 int CoordinateDimension() const;
446 virtual OGRBoolean IsEmpty() const = 0;
447 virtual OGRBoolean IsValid() const;
448 virtual OGRGeometry *MakeValid(CSLConstList papszOptions = nullptr) const;
449 virtual OGRGeometry *Normalize() const;
450 virtual OGRBoolean IsSimple() const;
451
454 {
455 return (flags & OGR_G_3D) != 0;
456 }
457
460 {
461 return (flags & OGR_G_MEASURED) != 0;
462 }
463
464 virtual OGRBoolean IsRing() const;
465 virtual void empty() = 0;
467 virtual void getEnvelope(OGREnvelope *psEnvelope) const = 0;
468 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const = 0;
469
470 // IWks Interface.
471 virtual size_t WkbSize() const = 0;
472 OGRErr importFromWkb(const GByte *, size_t = static_cast<size_t>(-1),
474 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
475 size_t &nBytesConsumedOut) = 0;
476 OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *,
478 virtual OGRErr exportToWkb(unsigned char *,
479 const OGRwkbExportOptions * = nullptr) const = 0;
480 virtual OGRErr importFromWkt(const char **ppszInput) = 0;
481
482#ifndef DOXYGEN_XML
486 OGRErr importFromWkt(char **ppszInput)
488 CPL_WARN_DEPRECATED("Use importFromWkt(const char**) instead")
490 {
491 return importFromWkt(const_cast<const char **>(ppszInput));
492 }
493#endif
494
495 OGRErr exportToWkt(char **ppszDstText,
497
502 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
503 OGRErr *err = nullptr) const = 0;
504
505 // Non-standard.
507 OGRwkbGeometryType getIsoGeometryType() const;
508 virtual const char *getGeometryName() const = 0;
509 void dumpReadable(FILE *, const char * = nullptr,
510 CSLConstList papszOptions = nullptr) const;
511 std::string dumpReadable(const char * = nullptr,
512 CSLConstList papszOptions = nullptr) const;
513 virtual void flattenTo2D() = 0;
514 virtual char *exportToGML(const char *const *papszOptions = nullptr) const;
515 virtual char *exportToKML() const;
516 virtual char *exportToJson(CSLConstList papszOptions = nullptr) const;
517
519 virtual void accept(IOGRGeometryVisitor *visitor) = 0;
520
522 virtual void accept(IOGRConstGeometryVisitor *visitor) const = 0;
523
524 static GEOSContextHandle_t createGEOSContext();
525 static void freeGEOSContext(GEOSContextHandle_t hGEOSCtxt);
526 virtual GEOSGeom
527 exportToGEOS(GEOSContextHandle_t hGEOSCtxt) const CPL_WARN_UNUSED_RESULT;
528 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
529 virtual OGRGeometry *getCurveGeometry(
530 const char *const *papszOptions = nullptr) const CPL_WARN_UNUSED_RESULT;
531 virtual OGRGeometry *getLinearGeometry(
532 double dfMaxAngleStepSizeDegrees = 0,
533 const char *const *papszOptions = nullptr) const CPL_WARN_UNUSED_RESULT;
534
535 void roundCoordinates(const OGRGeomCoordinatePrecision &sPrecision);
536 void
537 roundCoordinatesIEEE754(const OGRGeomCoordinateBinaryPrecision &options);
538
539 // SFCGAL interfacing methods.
541 static sfcgal_geometry_t *OGRexportToSFCGAL(const OGRGeometry *poGeom);
542 static OGRGeometry *SFCGALexportToOGR(const sfcgal_geometry_t *_geometry);
544 virtual void closeRings();
545
546 virtual void setCoordinateDimension(int nDimension);
547 virtual void set3D(OGRBoolean bIs3D);
548 virtual void setMeasured(OGRBoolean bIsMeasured);
549
550 virtual void assignSpatialReference(const OGRSpatialReference *poSR);
551
552 const OGRSpatialReference *getSpatialReference(void) const
553 {
554 return poSRS;
555 }
556
558 OGRErr transformTo(const OGRSpatialReference *poSR);
559
560 virtual void segmentize(double dfMaxLength);
561
562 // ISpatialRelation
563 virtual OGRBoolean Intersects(const OGRGeometry *) const;
564 virtual OGRBoolean Equals(const OGRGeometry *) const = 0;
565 virtual OGRBoolean Disjoint(const OGRGeometry *) const;
566 virtual OGRBoolean Touches(const OGRGeometry *) const;
567 virtual OGRBoolean Crosses(const OGRGeometry *) const;
568 virtual OGRBoolean Within(const OGRGeometry *) const;
569 virtual OGRBoolean Contains(const OGRGeometry *) const;
570 virtual OGRBoolean Overlaps(const OGRGeometry *) const;
571 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
572 // virtual OGRGeometry *LocateAlong( double mValue ) const;
573 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd )
574 // const;
575
576 virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
577 virtual double Distance(const OGRGeometry *) const;
578 virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
579 virtual OGRGeometry *
580 ConcaveHull(double dfRatio, bool bAllowHoles) const CPL_WARN_UNUSED_RESULT;
581 virtual OGRGeometry *
582 Buffer(double dfDist, int nQuadSegs = 30) const CPL_WARN_UNUSED_RESULT;
583 virtual OGRGeometry *
584 Intersection(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
585 virtual OGRGeometry *
586 Union(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
587 virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
588 OGRGeometry *UnaryUnion() const CPL_WARN_UNUSED_RESULT;
589 virtual OGRGeometry *
590 Difference(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
591 virtual OGRGeometry *
592 SymDifference(const OGRGeometry *) const CPL_WARN_UNUSED_RESULT;
593 virtual OGRErr Centroid(OGRPoint *poPoint) const;
594 virtual OGRGeometry *
595 Simplify(double dTolerance) const CPL_WARN_UNUSED_RESULT;
597 SimplifyPreserveTopology(double dTolerance) const CPL_WARN_UNUSED_RESULT;
598 virtual OGRGeometry *
599 DelaunayTriangulation(double dfTolerance,
600 int bOnlyEdges) const CPL_WARN_UNUSED_RESULT;
601
602 virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
603
604 virtual double Distance3D(const OGRGeometry *poOtherGeom) const;
605
606 OGRGeometry *SetPrecision(double dfGridSize, int nFlags) const;
607
609 // backward compatibility to non-standard method names.
610 OGRBoolean Intersect(OGRGeometry *) const
611 CPL_WARN_DEPRECATED("Non standard method. "
612 "Use Intersects() instead");
613 OGRBoolean Equal(OGRGeometry *) const
614 CPL_WARN_DEPRECATED("Non standard method. "
615 "Use Equals() instead");
616 OGRGeometry *SymmetricDifference(const OGRGeometry *) const
617 CPL_WARN_DEPRECATED("Non standard method. "
618 "Use SymDifference() instead");
619 OGRGeometry *getBoundary() const
620 CPL_WARN_DEPRECATED("Non standard method. "
621 "Use Boundary() instead");
623
625 // Special HACK for DB2 7.2 support
626 static int bGenerate_DB2_V72_BYTE_ORDER;
628
629 virtual void swapXY();
630
632 static OGRGeometry *CastToIdentity(OGRGeometry *poGeom)
633 {
634 return poGeom;
635 }
636
637 static OGRGeometry *CastToError(OGRGeometry *poGeom);
638
640
644 static inline OGRGeometryH ToHandle(OGRGeometry *poGeom)
645 {
646 return reinterpret_cast<OGRGeometryH>(poGeom);
647 }
648
652 static inline OGRGeometry *FromHandle(OGRGeometryH hGeom)
653 {
654 return reinterpret_cast<OGRGeometry *>(hGeom);
655 }
656
662 {
663 return cpl::down_cast<OGRPoint *>(this);
664 }
665
670 inline const OGRPoint *toPoint() const
671 {
672 return cpl::down_cast<const OGRPoint *>(this);
673 }
674
681 {
682 return cpl::down_cast<OGRCurve *>(this);
683 }
684
690 inline const OGRCurve *toCurve() const
691 {
692 return cpl::down_cast<const OGRCurve *>(this);
693 }
694
701 {
702 return cpl::down_cast<OGRSimpleCurve *>(this);
703 }
704
710 inline const OGRSimpleCurve *toSimpleCurve() const
711 {
712 return cpl::down_cast<const OGRSimpleCurve *>(this);
713 }
714
721 {
722 return cpl::down_cast<OGRLineString *>(this);
723 }
724
730 inline const OGRLineString *toLineString() const
731 {
732 return cpl::down_cast<const OGRLineString *>(this);
733 }
734
740 {
741 return cpl::down_cast<OGRLinearRing *>(this);
742 }
743
748 inline const OGRLinearRing *toLinearRing() const
749 {
750 return cpl::down_cast<const OGRLinearRing *>(this);
751 }
752
759 {
760 return cpl::down_cast<OGRCircularString *>(this);
761 }
762
769 {
770 return cpl::down_cast<const OGRCircularString *>(this);
771 }
772
779 {
780 return cpl::down_cast<OGRCompoundCurve *>(this);
781 }
782
788 inline const OGRCompoundCurve *toCompoundCurve() const
789 {
790 return cpl::down_cast<const OGRCompoundCurve *>(this);
791 }
792
799 {
800 return cpl::down_cast<OGRSurface *>(this);
801 }
802
808 inline const OGRSurface *toSurface() const
809 {
810 return cpl::down_cast<const OGRSurface *>(this);
811 }
812
819 {
820 return cpl::down_cast<OGRPolygon *>(this);
821 }
822
828 inline const OGRPolygon *toPolygon() const
829 {
830 return cpl::down_cast<const OGRPolygon *>(this);
831 }
832
838 {
839 return cpl::down_cast<OGRTriangle *>(this);
840 }
841
846 inline const OGRTriangle *toTriangle() const
847 {
848 return cpl::down_cast<const OGRTriangle *>(this);
849 }
850
857 {
858 return cpl::down_cast<OGRCurvePolygon *>(this);
859 }
860
866 inline const OGRCurvePolygon *toCurvePolygon() const
867 {
868 return cpl::down_cast<const OGRCurvePolygon *>(this);
869 }
870
877 {
878 return cpl::down_cast<OGRGeometryCollection *>(this);
879 }
880
887 {
888 return cpl::down_cast<const OGRGeometryCollection *>(this);
889 }
890
897 {
898 return cpl::down_cast<OGRMultiPoint *>(this);
899 }
900
906 inline const OGRMultiPoint *toMultiPoint() const
907 {
908 return cpl::down_cast<const OGRMultiPoint *>(this);
909 }
910
917 {
918 return cpl::down_cast<OGRMultiLineString *>(this);
919 }
920
927 {
928 return cpl::down_cast<const OGRMultiLineString *>(this);
929 }
930
937 {
938 return cpl::down_cast<OGRMultiPolygon *>(this);
939 }
940
946 inline const OGRMultiPolygon *toMultiPolygon() const
947 {
948 return cpl::down_cast<const OGRMultiPolygon *>(this);
949 }
950
957 {
958 return cpl::down_cast<OGRMultiCurve *>(this);
959 }
960
966 inline const OGRMultiCurve *toMultiCurve() const
967 {
968 return cpl::down_cast<const OGRMultiCurve *>(this);
969 }
970
977 {
978 return cpl::down_cast<OGRMultiSurface *>(this);
979 }
980
986 inline const OGRMultiSurface *toMultiSurface() const
987 {
988 return cpl::down_cast<const OGRMultiSurface *>(this);
989 }
990
997 {
998 return cpl::down_cast<OGRPolyhedralSurface *>(this);
999 }
1000
1007 {
1008 return cpl::down_cast<const OGRPolyhedralSurface *>(this);
1009 }
1010
1016 {
1017 return cpl::down_cast<OGRTriangulatedSurface *>(this);
1018 }
1019
1025 {
1026 return cpl::down_cast<const OGRTriangulatedSurface *>(this);
1027 }
1028};
1029
1031struct CPL_DLL OGRGeometryUniquePtrDeleter
1032{
1033 void operator()(OGRGeometry *) const;
1034};
1035
1037
1041typedef std::unique_ptr<OGRGeometry, OGRGeometryUniquePtrDeleter>
1043
1045#define OGR_FORBID_DOWNCAST_TO(name) \
1046 inline OGR##name *to##name() = delete; \
1047 inline const OGR##name *to##name() const = delete;
1048
1049#define OGR_FORBID_DOWNCAST_TO_POINT OGR_FORBID_DOWNCAST_TO(Point)
1050#define OGR_FORBID_DOWNCAST_TO_CURVE OGR_FORBID_DOWNCAST_TO(Curve)
1051#define OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE OGR_FORBID_DOWNCAST_TO(SimpleCurve)
1052#define OGR_FORBID_DOWNCAST_TO_LINESTRING OGR_FORBID_DOWNCAST_TO(LineString)
1053#define OGR_FORBID_DOWNCAST_TO_LINEARRING OGR_FORBID_DOWNCAST_TO(LinearRing)
1054#define OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING \
1055 OGR_FORBID_DOWNCAST_TO(CircularString)
1056#define OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE \
1057 OGR_FORBID_DOWNCAST_TO(CompoundCurve)
1058#define OGR_FORBID_DOWNCAST_TO_SURFACE OGR_FORBID_DOWNCAST_TO(Surface)
1059#define OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON OGR_FORBID_DOWNCAST_TO(CurvePolygon)
1060#define OGR_FORBID_DOWNCAST_TO_POLYGON OGR_FORBID_DOWNCAST_TO(Polygon)
1061#define OGR_FORBID_DOWNCAST_TO_TRIANGLE OGR_FORBID_DOWNCAST_TO(Triangle)
1062#define OGR_FORBID_DOWNCAST_TO_MULTIPOINT OGR_FORBID_DOWNCAST_TO(MultiPoint)
1063#define OGR_FORBID_DOWNCAST_TO_MULTICURVE OGR_FORBID_DOWNCAST_TO(MultiCurve)
1064#define OGR_FORBID_DOWNCAST_TO_MULTILINESTRING \
1065 OGR_FORBID_DOWNCAST_TO(MultiLineString)
1066#define OGR_FORBID_DOWNCAST_TO_MULTISURFACE OGR_FORBID_DOWNCAST_TO(MultiSurface)
1067#define OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON OGR_FORBID_DOWNCAST_TO(MultiPolygon)
1068#define OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION \
1069 OGR_FORBID_DOWNCAST_TO(GeometryCollection)
1070#define OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE \
1071 OGR_FORBID_DOWNCAST_TO(PolyhedralSurface)
1072#define OGR_FORBID_DOWNCAST_TO_TIN OGR_FORBID_DOWNCAST_TO(TriangulatedSurface)
1073
1074#define OGR_ALLOW_UPCAST_TO(name) \
1075 inline OGR##name *to##name() \
1076 { \
1077 return this; \
1078 } \
1079 inline const OGR##name *to##name() const \
1080 { \
1081 return this; \
1082 }
1083
1084#ifndef SUPPRESS_OGR_ALLOW_CAST_TO_THIS_WARNING
1085#define CAST_TO_THIS_WARNING CPL_WARN_DEPRECATED("Casting to this is useless")
1086#else
1087#define CAST_TO_THIS_WARNING
1088#endif
1089
1090#define OGR_ALLOW_CAST_TO_THIS(name) \
1091 inline OGR##name *to##name() CAST_TO_THIS_WARNING \
1092 { \
1093 return this; \
1094 } \
1095 inline const OGR##name *to##name() const CAST_TO_THIS_WARNING \
1096 { \
1097 return this; \
1098 }
1099
1100#define OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
1101 OGR_FORBID_DOWNCAST_TO_CURVE \
1102 OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE \
1103 OGR_FORBID_DOWNCAST_TO_LINESTRING \
1104 OGR_FORBID_DOWNCAST_TO_LINEARRING \
1105 OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING \
1106 OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE
1107
1108#define OGR_FORBID_DOWNCAST_TO_ALL_SURFACES \
1109 OGR_FORBID_DOWNCAST_TO_SURFACE \
1110 OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON \
1111 OGR_FORBID_DOWNCAST_TO_POLYGON \
1112 OGR_FORBID_DOWNCAST_TO_TRIANGLE \
1113 OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE \
1114 OGR_FORBID_DOWNCAST_TO_TIN
1115
1116#define OGR_FORBID_DOWNCAST_TO_ALL_SINGLES \
1117 OGR_FORBID_DOWNCAST_TO_POINT \
1118 OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
1119 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1120
1121#define OGR_FORBID_DOWNCAST_TO_ALL_MULTI \
1122 OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION \
1123 OGR_FORBID_DOWNCAST_TO_MULTIPOINT \
1124 OGR_FORBID_DOWNCAST_TO_MULTICURVE \
1125 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING \
1126 OGR_FORBID_DOWNCAST_TO_MULTISURFACE \
1127 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
1128
1130
1131/************************************************************************/
1132/* OGRPoint */
1133/************************************************************************/
1134
1141class CPL_DLL OGRPoint : public OGRGeometry
1142{
1143 double x;
1144 double y;
1145 double z;
1146 double m;
1147
1148 public:
1149 OGRPoint();
1150 OGRPoint(double x, double y);
1151 OGRPoint(double x, double y, double z);
1152 OGRPoint(double x, double y, double z, double m);
1153 OGRPoint(const OGRPoint &other);
1154 static OGRPoint *createXYM(double x, double y, double m);
1155 ~OGRPoint() override;
1156
1157 OGRPoint &operator=(const OGRPoint &other);
1158
1159 // IWks Interface
1160 size_t WkbSize() const override;
1161 OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1162 size_t &nBytesConsumedOut) override;
1163 OGRErr exportToWkb(unsigned char *,
1164 const OGRwkbExportOptions * = nullptr) const override;
1165
1166#ifndef DOXYGEN_XML
1168#endif
1169
1170 OGRErr importFromWkt(const char **) override;
1171
1172#ifndef DOXYGEN_XML
1174#endif
1175
1180 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1181 OGRErr *err = nullptr) const override;
1182
1183 // IGeometry
1184 virtual int getDimension() const override;
1185 virtual OGRPoint *clone() const override;
1186 virtual void empty() override;
1187 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
1188 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1189
1190 virtual OGRBoolean IsEmpty() const override
1191 {
1192 return !(flags & OGR_G_NOT_EMPTY_POINT);
1193 }
1194
1195 // IPoint
1197 double getX() const
1198 {
1199 return x;
1200 }
1201
1203 double getY() const
1204 {
1205 return y;
1206 }
1207
1209 double getZ() const
1210 {
1211 return z;
1212 }
1213
1215 double getM() const
1216 {
1217 return m;
1218 }
1219
1220 // Non standard
1221 virtual void setCoordinateDimension(int nDimension) override;
1222
1226 void setX(double xIn)
1227 {
1228 x = xIn;
1229 if (std::isnan(x) || std::isnan(y))
1230 flags &= ~OGR_G_NOT_EMPTY_POINT;
1231 else
1232 flags |= OGR_G_NOT_EMPTY_POINT;
1233 }
1234
1238 void setY(double yIn)
1239 {
1240 y = yIn;
1241 if (std::isnan(x) || std::isnan(y))
1242 flags &= ~OGR_G_NOT_EMPTY_POINT;
1243 else
1244 flags |= OGR_G_NOT_EMPTY_POINT;
1245 }
1246
1250 void setZ(double zIn)
1251 {
1252 z = zIn;
1253 flags |= OGR_G_3D;
1254 }
1255
1259 void setM(double mIn)
1260 {
1261 m = mIn;
1262 flags |= OGR_G_MEASURED;
1263 }
1264
1265 // ISpatialRelation
1266 virtual OGRBoolean Equals(const OGRGeometry *) const override;
1267 virtual OGRBoolean Intersects(const OGRGeometry *) const override;
1268 virtual OGRBoolean Within(const OGRGeometry *) const override;
1269
1270 // Non standard from OGRGeometry
1271 virtual const char *getGeometryName() const override;
1272 virtual OGRwkbGeometryType getGeometryType() const override;
1273 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
1274 virtual void flattenTo2D() override;
1275
1276 virtual void accept(IOGRGeometryVisitor *visitor) override
1277 {
1278 visitor->visit(this);
1279 }
1280
1281 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
1282 {
1283 visitor->visit(this);
1284 }
1285
1286 virtual void swapXY() override;
1287
1288 OGR_ALLOW_CAST_TO_THIS(Point)
1289 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
1290 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1291 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1292};
1293
1294/************************************************************************/
1295/* OGRPointIterator */
1296/************************************************************************/
1297
1304class CPL_DLL OGRPointIterator
1305{
1306 public:
1307 virtual ~OGRPointIterator();
1309
1310 static void destroy(OGRPointIterator *);
1311};
1312
1313/************************************************************************/
1314/* OGRCurve */
1315/************************************************************************/
1316
1322class CPL_DLL OGRCurve : public OGRGeometry
1323{
1324 protected:
1326 OGRCurve();
1327 OGRCurve(const OGRCurve &other);
1328
1329 virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
1330 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
1331
1332 friend class OGRCurvePolygon;
1333 friend class OGRCompoundCurve;
1335 virtual int ContainsPoint(const OGRPoint *p) const;
1336 virtual int IntersectsPoint(const OGRPoint *p) const;
1337 virtual double get_AreaOfCurveSegments() const = 0;
1338
1339 private:
1340 class CPL_DLL ConstIterator
1341 {
1342 struct Private;
1343 std::unique_ptr<Private> m_poPrivate;
1344
1345 public:
1346 ConstIterator(const OGRCurve *poSelf, bool bStart);
1347 ConstIterator(ConstIterator &&oOther) noexcept;
1348 ConstIterator &operator=(ConstIterator &&oOther);
1349 ~ConstIterator();
1350 const OGRPoint &operator*() const;
1351 ConstIterator &operator++();
1352 bool operator!=(const ConstIterator &it) const;
1353 };
1354
1355 friend inline ConstIterator begin(const OGRCurve *);
1356 friend inline ConstIterator end(const OGRCurve *);
1357
1358 public:
1359 ~OGRCurve() override;
1360
1362 OGRCurve &operator=(const OGRCurve &other);
1364
1367
1376 ConstIterator begin() const;
1378 ConstIterator end() const;
1379
1380 // IGeometry
1381 virtual OGRCurve *clone() const override = 0;
1382
1383 // ICurve methods
1384 virtual double get_Length() const = 0;
1385 virtual void StartPoint(OGRPoint *) const = 0;
1386 virtual void EndPoint(OGRPoint *) const = 0;
1387 virtual int get_IsClosed() const;
1388 virtual void Value(double, OGRPoint *) const = 0;
1389 virtual OGRLineString *
1390 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
1391 const char *const *papszOptions = nullptr) const = 0;
1392 virtual int getDimension() const override;
1393
1394 // non standard
1395 virtual int getNumPoints() const = 0;
1397 virtual OGRBoolean IsConvex() const;
1398 virtual double get_Area() const = 0;
1399 virtual double get_GeodesicArea(
1400 const OGRSpatialReference *poSRSOverride = nullptr) const = 0;
1401 virtual int isClockwise() const;
1402
1407 {
1408 return cpl::down_cast<OGRSimpleCurve *>(this);
1409 }
1410
1414 inline const OGRSimpleCurve *toSimpleCurve() const
1415 {
1416 return cpl::down_cast<const OGRSimpleCurve *>(this);
1417 }
1418
1419 static OGRCompoundCurve *CastToCompoundCurve(OGRCurve *puCurve);
1420 static OGRLineString *CastToLineString(OGRCurve *poCurve);
1421 static OGRLinearRing *CastToLinearRing(OGRCurve *poCurve);
1422
1423 OGR_FORBID_DOWNCAST_TO_POINT
1424 OGR_ALLOW_CAST_TO_THIS(Curve)
1425 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1426 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1427};
1428
1430
1431inline OGRCurve::ConstIterator begin(const OGRCurve *poCurve)
1432{
1433 return poCurve->begin();
1434}
1435
1437inline OGRCurve::ConstIterator end(const OGRCurve *poCurve)
1438{
1439 return poCurve->end();
1440}
1441
1443
1444/************************************************************************/
1445/* OGRIteratedPoint */
1446/************************************************************************/
1447
1469class CPL_DLL OGRIteratedPoint : public OGRPoint
1470{
1471 private:
1472 friend class OGRSimpleCurve;
1473
1474 OGRSimpleCurve *m_poCurve = nullptr;
1475 int m_nPos = 0;
1476
1477 OGRIteratedPoint() = default;
1478
1480
1481 public:
1485 void setX(double xIn);
1489 void setY(double yIn);
1493 void setZ(double zIn);
1497 void setM(double mIn);
1498};
1499
1500/************************************************************************/
1501/* OGRSimpleCurve */
1502/************************************************************************/
1503
1513class CPL_DLL OGRSimpleCurve : public OGRCurve
1514{
1515 protected:
1517 friend class OGRGeometry;
1518
1519 int nPointCount;
1520 int m_nPointCapacity = 0;
1521 OGRRawPoint *paoPoints;
1522 double *padfZ;
1523 double *padfM;
1524
1525 void Make3D();
1526 void Make2D();
1527 void RemoveM();
1528 void AddM();
1529
1530 OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ, int bHasM,
1531 OGRRawPoint *&paoPointsIn, int &nMaxPoints,
1532 double *&padfZIn);
1534
1535 virtual double get_LinearArea() const;
1536
1538 OGRSimpleCurve(const OGRSimpleCurve &other);
1539
1540 private:
1541 class CPL_DLL Iterator
1542 {
1543 struct Private;
1544 std::unique_ptr<Private> m_poPrivate;
1545 void update();
1546
1547 public:
1548 Iterator(OGRSimpleCurve *poSelf, int nPos);
1549 Iterator(Iterator &&oOther) noexcept; // declared but not defined.
1550 // Needed for gcc 5.4 at least
1551 ~Iterator();
1552 OGRIteratedPoint &operator*();
1553 Iterator &operator++();
1554 bool operator!=(const Iterator &it) const;
1555 };
1556
1557 friend inline Iterator begin(OGRSimpleCurve *);
1558 friend inline Iterator end(OGRSimpleCurve *);
1559
1560 class CPL_DLL ConstIterator
1561 {
1562 struct Private;
1563 std::unique_ptr<Private> m_poPrivate;
1564
1565 public:
1566 ConstIterator(const OGRSimpleCurve *poSelf, int nPos);
1567 ConstIterator(
1568 ConstIterator &&oOther) noexcept; // declared but not defined.
1569 // Needed for gcc 5.4 at least
1570 ~ConstIterator();
1571 const OGRPoint &operator*() const;
1572 ConstIterator &operator++();
1573 bool operator!=(const ConstIterator &it) const;
1574 };
1575
1576 friend inline ConstIterator begin(const OGRSimpleCurve *);
1577 friend inline ConstIterator end(const OGRSimpleCurve *);
1578
1579 public:
1580 ~OGRSimpleCurve() override;
1581
1582 OGRSimpleCurve &operator=(const OGRSimpleCurve &other);
1583
1586
1595 Iterator begin();
1597 Iterator end();
1606 ConstIterator begin() const;
1608 ConstIterator end() const;
1609
1610 // IWks Interface.
1611 virtual size_t WkbSize() const override;
1612 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1613 size_t &nBytesConsumedOut) override;
1614 virtual OGRErr
1615 exportToWkb(unsigned char *,
1616 const OGRwkbExportOptions * = nullptr) const override;
1617
1618#ifndef DOXYGEN_XML
1620#endif
1621
1622 OGRErr importFromWkt(const char **) override;
1623
1624#ifndef DOXYGEN_XML
1626#endif
1627
1632 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1633 OGRErr *err = nullptr) const override;
1634
1635 // IGeometry interface.
1636 virtual void empty() override;
1637 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
1638 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1639 virtual OGRBoolean IsEmpty() const override;
1640 virtual OGRSimpleCurve *clone() const override = 0;
1641
1642 // ICurve methods.
1643 virtual double get_Length() const override;
1644 virtual void StartPoint(OGRPoint *) const override;
1645 virtual void EndPoint(OGRPoint *) const override;
1646 virtual void Value(double, OGRPoint *) const override;
1647 virtual double Project(const OGRPoint *) const;
1648 virtual OGRLineString *getSubLine(double, double, int) const;
1649
1650 // ILineString methods.
1651 virtual int getNumPoints() const override
1652 {
1653 return nPointCount;
1654 }
1655
1656 void getPoint(int, OGRPoint *) const;
1657
1658 double getX(int i) const
1659 {
1660 return paoPoints[i].x;
1661 }
1662
1663 double getY(int i) const
1664 {
1665 return paoPoints[i].y;
1666 }
1667
1668 double getZ(int i) const;
1669 double getM(int i) const;
1670
1671 // ISpatialRelation
1672 virtual OGRBoolean Equals(const OGRGeometry *) const override;
1673
1674 // non standard.
1675 virtual void setCoordinateDimension(int nDimension) override;
1676 virtual void set3D(OGRBoolean bIs3D) override;
1677 virtual void setMeasured(OGRBoolean bIsMeasured) override;
1678 void setNumPoints(int nNewPointCount, int bZeroizeNewContent = TRUE);
1679 void setPoint(int, OGRPoint *);
1680 void setPoint(int, double, double);
1681 void setZ(int, double);
1682 void setM(int, double);
1683 void setPoint(int, double, double, double);
1684 void setPointM(int, double, double, double);
1685 void setPoint(int, double, double, double, double);
1686 void setPoints(int, const OGRRawPoint *, const double * = nullptr);
1687 void setPointsM(int, const OGRRawPoint *, const double *);
1688 void setPoints(int, const OGRRawPoint *, const double *, const double *);
1689 void setPoints(int, const double *padfX, const double *padfY,
1690 const double *padfZIn = nullptr);
1691 void setPointsM(int, const double *padfX, const double *padfY,
1692 const double *padfMIn = nullptr);
1693 void setPoints(int, const double *padfX, const double *padfY,
1694 const double *padfZIn, const double *padfMIn);
1695 void addPoint(const OGRPoint *);
1696 void addPoint(double, double);
1697 void addPoint(double, double, double);
1698 void addPointM(double, double, double);
1699 void addPoint(double, double, double, double);
1700
1701 bool removePoint(int);
1702
1703 void getPoints(OGRRawPoint *, double * = nullptr) const;
1704 void getPoints(void *pabyX, int nXStride, void *pabyY, int nYStride,
1705 void *pabyZ = nullptr, int nZStride = 0,
1706 void *pabyM = nullptr, int nMStride = 0) const;
1707
1708 void addSubLineString(const OGRLineString *, int nStartVertex = 0,
1709 int nEndVertex = -1);
1710 void reversePoints(void);
1711 virtual OGRPointIterator *getPointIterator() const override;
1712
1713 // non-standard from OGRGeometry
1714 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
1715 virtual void flattenTo2D() override;
1716 virtual void segmentize(double dfMaxLength) override;
1717
1718 virtual void swapXY() override;
1719
1720 OGR_ALLOW_UPCAST_TO(Curve)
1721 OGR_ALLOW_CAST_TO_THIS(SimpleCurve)
1722};
1723
1725
1726inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve *poCurve)
1727{
1728 return poCurve->begin();
1729}
1730
1732inline OGRSimpleCurve::Iterator end(OGRSimpleCurve *poCurve)
1733{
1734 return poCurve->end();
1735}
1736
1738inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve *poCurve)
1739{
1740 return poCurve->begin();
1741}
1742
1744inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve *poCurve)
1745{
1746 return poCurve->end();
1747}
1748
1750
1751/************************************************************************/
1752/* OGRLineString */
1753/************************************************************************/
1754
1762class CPL_DLL OGRLineString : public OGRSimpleCurve
1763{
1764 // cppcheck-suppress unusedPrivateFunction
1765 static OGRLinearRing *CasterToLinearRing(OGRCurve *poCurve);
1766
1767 protected:
1769 static OGRLineString *TransferMembersAndDestroy(OGRLineString *poSrc,
1770 OGRLineString *poDst);
1771
1772 virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
1773 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1774
1775 virtual double get_AreaOfCurveSegments() const override;
1777
1778 static OGRLinearRing *CastToLinearRing(OGRLineString *poLS);
1779
1780 public:
1783 ~OGRLineString() override;
1784
1785 OGRLineString &operator=(const OGRLineString &other);
1786
1787 virtual OGRLineString *clone() const override;
1788 virtual OGRLineString *
1789 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
1790 const char *const *papszOptions = nullptr) const override;
1791 virtual OGRGeometry *
1792 getCurveGeometry(const char *const *papszOptions = nullptr) const override;
1793 virtual double get_Area() const override;
1794 virtual double get_GeodesicArea(
1795 const OGRSpatialReference *poSRSOverride = nullptr) const override;
1796
1797 // Non-standard from OGRGeometry.
1798 virtual OGRwkbGeometryType getGeometryType() const override;
1799 virtual const char *getGeometryName() const override;
1800 virtual int isClockwise() const override;
1801
1804 {
1805 return this;
1806 }
1807
1809 inline const OGRSimpleCurve *toUpperClass() const
1810 {
1811 return this;
1812 }
1813
1814 virtual void accept(IOGRGeometryVisitor *visitor) override
1815 {
1816 visitor->visit(this);
1817 }
1818
1819 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
1820 {
1821 visitor->visit(this);
1822 }
1823
1824 OGR_ALLOW_UPCAST_TO(SimpleCurve)
1825 OGR_ALLOW_CAST_TO_THIS(LineString)
1826};
1827
1828/************************************************************************/
1829/* OGRLinearRing */
1830/************************************************************************/
1831
1852class CPL_DLL OGRLinearRing : public OGRLineString
1853{
1854 static OGRLineString *CasterToLineString(OGRCurve *poCurve);
1855
1856 // IWks Interface - Note this isn't really a first class object
1857 // for the purposes of WKB form. These methods always fail since this
1858 // object can't be serialized on its own.
1859 virtual size_t WkbSize() const override;
1860 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1861 size_t &nBytesConsumedOut) override;
1862 OGRErr exportToWkb(unsigned char *,
1863 const OGRwkbExportOptions * = nullptr) const override;
1864
1865 protected:
1867 friend class OGRPolygon;
1868 friend class OGRTriangle;
1869
1870 // These are not IWks compatible ... just a convenience for OGRPolygon.
1871 virtual size_t _WkbSize(int _flags) const;
1872 virtual OGRErr _importFromWkb(OGRwkbByteOrder, int _flags,
1873 const unsigned char *, size_t,
1874 size_t &nBytesConsumedOut);
1875 virtual OGRErr _exportToWkb(int _flags, unsigned char *,
1876 const OGRwkbExportOptions *) const;
1877
1878 virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
1879 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1881
1882 static OGRLineString *CastToLineString(OGRLinearRing *poLR);
1883
1884 public:
1887 explicit OGRLinearRing(OGRLinearRing *);
1888 ~OGRLinearRing() override;
1889
1890 OGRLinearRing &operator=(const OGRLinearRing &other);
1891
1892 // Non standard.
1893 virtual const char *getGeometryName() const override;
1894 virtual OGRLinearRing *clone() const override;
1895 virtual void reverseWindingOrder();
1896 virtual void closeRings() override;
1897 OGRBoolean isPointInRing(const OGRPoint *pt,
1898 int bTestEnvelope = TRUE) const;
1899 OGRBoolean isPointOnRingBoundary(const OGRPoint *pt,
1900 int bTestEnvelope = TRUE) const;
1901 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
1902
1905 {
1906 return this;
1907 }
1908
1910 inline const OGRLineString *toUpperClass() const
1911 {
1912 return this;
1913 }
1914
1915 virtual void accept(IOGRGeometryVisitor *visitor) override
1916 {
1917 visitor->visit(this);
1918 }
1919
1920 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
1921 {
1922 visitor->visit(this);
1923 }
1924
1925 OGR_ALLOW_UPCAST_TO(LineString)
1926 OGR_ALLOW_CAST_TO_THIS(LinearRing)
1927};
1928
1929/************************************************************************/
1930/* OGRCircularString */
1931/************************************************************************/
1932
1945class CPL_DLL OGRCircularString : public OGRSimpleCurve
1946{
1947 private:
1948 void ExtendEnvelopeWithCircular(OGREnvelope *psEnvelope) const;
1949 OGRBoolean IsValidFast() const;
1950 int IsFullCircle(double &cx, double &cy, double &square_R) const;
1951
1952 protected:
1954 virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
1955 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
1956 virtual int IntersectsPoint(const OGRPoint *p) const override;
1957 virtual int ContainsPoint(const OGRPoint *p) const override;
1958 virtual double get_AreaOfCurveSegments() const override;
1960
1961 public:
1964 ~OGRCircularString() override;
1965
1966 OGRCircularString &operator=(const OGRCircularString &other);
1967
1968 // IWks Interface.
1969 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
1970 size_t &nBytesConsumedOut) override;
1971 OGRErr exportToWkb(unsigned char *,
1972 const OGRwkbExportOptions * = nullptr) const override;
1973
1974#ifndef DOXYGEN_XML
1976#endif
1977
1978 OGRErr importFromWkt(const char **) override;
1979
1980#ifndef DOXYGEN_XML
1982#endif
1983
1988 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
1989 OGRErr *err = nullptr) const override;
1990
1991 // IGeometry interface.
1992 virtual OGRBoolean IsValid() const override;
1993 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
1994 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
1995 virtual OGRCircularString *clone() const override;
1996
1997 // ICurve methods.
1998 virtual double get_Length() const override;
1999 virtual OGRLineString *
2000 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
2001 const char *const *papszOptions = nullptr) const override;
2002 virtual void Value(double, OGRPoint *) const override;
2003 virtual double get_Area() const override;
2004 virtual double get_GeodesicArea(
2005 const OGRSpatialReference *poSRSOverride = nullptr) const override;
2006
2007 // Non-standard from OGRGeometry.
2008 virtual OGRwkbGeometryType getGeometryType() const override;
2009 virtual const char *getGeometryName() const override;
2010 virtual void segmentize(double dfMaxLength) override;
2011 virtual OGRBoolean
2012 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2013 virtual OGRGeometry *
2014 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2015 const char *const *papszOptions = nullptr) const override;
2016
2019 {
2020 return this;
2021 }
2022
2024 inline const OGRSimpleCurve *toUpperClass() const
2025 {
2026 return this;
2027 }
2028
2029 virtual void accept(IOGRGeometryVisitor *visitor) override
2030 {
2031 visitor->visit(this);
2032 }
2033
2034 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2035 {
2036 visitor->visit(this);
2037 }
2038
2039 OGR_ALLOW_UPCAST_TO(SimpleCurve)
2040 OGR_ALLOW_CAST_TO_THIS(CircularString)
2041};
2042
2043/************************************************************************/
2044/* OGRCurveCollection */
2045/************************************************************************/
2046
2058class CPL_DLL OGRCurveCollection
2059{
2060 protected:
2061 friend class OGRCompoundCurve;
2062 friend class OGRCurvePolygon;
2063 friend class OGRPolygon;
2064 friend class OGRTriangle;
2065
2066 int nCurveCount = 0;
2067 OGRCurve **papoCurves = nullptr;
2068
2069 public:
2070 OGRCurveCollection();
2071 OGRCurveCollection(const OGRCurveCollection &other);
2072 ~OGRCurveCollection();
2073
2074 OGRCurveCollection &operator=(const OGRCurveCollection &other);
2075
2077 typedef OGRCurve ChildType;
2078
2082 OGRCurve **begin()
2083 {
2084 return papoCurves;
2085 }
2086
2088 OGRCurve **end()
2089 {
2090 return papoCurves + nCurveCount;
2091 }
2092
2096 const OGRCurve *const *begin() const
2097 {
2098 return papoCurves;
2099 }
2100
2102 const OGRCurve *const *end() const
2103 {
2104 return papoCurves + nCurveCount;
2105 }
2106
2107 void empty(OGRGeometry *poGeom);
2108 OGRBoolean IsEmpty() const;
2109 void getEnvelope(OGREnvelope *psEnvelope) const;
2110 void getEnvelope(OGREnvelope3D *psEnvelope) const;
2111
2112 OGRErr addCurveDirectly(OGRGeometry *poGeom, OGRCurve *poCurve,
2113 int bNeedRealloc);
2114 size_t WkbSize() const;
2115 OGRErr importPreambleFromWkb(OGRGeometry *poGeom,
2116 const unsigned char *pabyData, size_t &nSize,
2117 size_t &nDataOffset,
2118 OGRwkbByteOrder &eByteOrder,
2119 size_t nMinSubGeomSize,
2120 OGRwkbVariant eWkbVariant);
2121 OGRErr
2122 importBodyFromWkb(OGRGeometry *poGeom, const unsigned char *pabyData,
2123 size_t nSize, bool bAcceptCompoundCurve,
2124 OGRErr (*pfnAddCurveDirectlyFromWkb)(OGRGeometry *poGeom,
2125 OGRCurve *poCurve),
2126 OGRwkbVariant eWkbVariant, size_t &nBytesConsumedOut);
2127 std::string exportToWkt(const OGRGeometry *geom, const OGRWktOptions &opts,
2128 OGRErr *err) const;
2129 OGRErr exportToWkb(const OGRGeometry *poGeom, unsigned char *,
2130 const OGRwkbExportOptions * = nullptr) const;
2131 OGRBoolean Equals(const OGRCurveCollection *poOCC) const;
2132 void setCoordinateDimension(OGRGeometry *poGeom, int nNewDimension);
2133 void set3D(OGRGeometry *poGeom, OGRBoolean bIs3D);
2134 void setMeasured(OGRGeometry *poGeom, OGRBoolean bIsMeasured);
2135 void assignSpatialReference(OGRGeometry *poGeom,
2136 const OGRSpatialReference *poSR);
2137 int getNumCurves() const;
2138 OGRCurve *getCurve(int);
2139 const OGRCurve *getCurve(int) const;
2140 OGRCurve *stealCurve(int);
2141
2142 OGRErr removeCurve(int iIndex, bool bDelete = true);
2143
2144 OGRErr transform(OGRGeometry *poGeom, OGRCoordinateTransformation *poCT);
2145 void flattenTo2D(OGRGeometry *poGeom);
2146 void segmentize(double dfMaxLength);
2147 void swapXY();
2148 OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
2149};
2150
2152
2153/************************************************************************/
2154/* OGRCompoundCurve */
2155/************************************************************************/
2156
2167class CPL_DLL OGRCompoundCurve : public OGRCurve
2168{
2169 private:
2170 OGRCurveCollection oCC{};
2171
2172 OGRErr addCurveDirectlyInternal(OGRCurve *poCurve, double dfToleranceEps,
2173 int bNeedRealloc);
2174 static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
2175 OGRCurve *poCurve);
2176 static OGRErr addCurveDirectlyFromWkb(OGRGeometry *poSelf,
2177 OGRCurve *poCurve);
2178 OGRLineString *CurveToLineInternal(double dfMaxAngleStepSizeDegrees,
2179 const char *const *papszOptions,
2180 int bIsLinearRing) const;
2181 // cppcheck-suppress unusedPrivateFunction
2182 static OGRLineString *CasterToLineString(OGRCurve *poCurve);
2183 // cppcheck-suppress unusedPrivateFunction
2184 static OGRLinearRing *CasterToLinearRing(OGRCurve *poCurve);
2185
2186 protected:
2188 static OGRLineString *CastToLineString(OGRCompoundCurve *poCC);
2189 static OGRLinearRing *CastToLinearRing(OGRCompoundCurve *poCC);
2190
2191 virtual OGRCurveCasterToLineString GetCasterToLineString() const override;
2192 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const override;
2194
2195 public:
2198 ~OGRCompoundCurve() override;
2199
2200 OGRCompoundCurve &operator=(const OGRCompoundCurve &other);
2201
2204
2209 {
2210 return oCC.begin();
2211 }
2212
2215 {
2216 return oCC.end();
2217 }
2218
2222 const ChildType *const *begin() const
2223 {
2224 return oCC.begin();
2225 }
2226
2228 const ChildType *const *end() const
2229 {
2230 return oCC.end();
2231 }
2232
2233 // IWks Interface
2234 virtual size_t WkbSize() const override;
2235 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2236 size_t &nBytesConsumedOut) override;
2237 OGRErr exportToWkb(unsigned char *,
2238 const OGRwkbExportOptions * = nullptr) const override;
2239
2240#ifndef DOXYGEN_XML
2242#endif
2243
2244 OGRErr importFromWkt(const char **) override;
2245
2246#ifndef DOXYGEN_XML
2248#endif
2249
2254 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2255 OGRErr *err = nullptr) const override;
2256
2257 // IGeometry interface.
2258 virtual OGRCompoundCurve *clone() const override;
2259 virtual void empty() override;
2260 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
2261 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
2262 virtual OGRBoolean IsEmpty() const override;
2263
2264 // ICurve methods.
2265 virtual double get_Length() const override;
2266 virtual void StartPoint(OGRPoint *) const override;
2267 virtual void EndPoint(OGRPoint *) const override;
2268 virtual void Value(double, OGRPoint *) const override;
2269 virtual OGRLineString *
2270 CurveToLine(double dfMaxAngleStepSizeDegrees = 0,
2271 const char *const *papszOptions = nullptr) const override;
2272
2273 virtual int getNumPoints() const override;
2274 virtual double get_AreaOfCurveSegments() const override;
2275 virtual double get_Area() const override;
2276 virtual double get_GeodesicArea(
2277 const OGRSpatialReference *poSRSOverride = nullptr) const override;
2278
2279 // ISpatialRelation.
2280 virtual OGRBoolean Equals(const OGRGeometry *) const override;
2281
2282 // ICompoundCurve method.
2283 int getNumCurves() const;
2284 OGRCurve *getCurve(int);
2285 const OGRCurve *getCurve(int) const;
2286
2287 // Non-standard.
2288 virtual void setCoordinateDimension(int nDimension) override;
2289 virtual void set3D(OGRBoolean bIs3D) override;
2290 virtual void setMeasured(OGRBoolean bIsMeasured) override;
2291
2292 virtual void
2293 assignSpatialReference(const OGRSpatialReference *poSR) override;
2294
2298 static constexpr double DEFAULT_TOLERANCE_EPSILON = 1e-14;
2299
2300 OGRErr addCurve(const OGRCurve *,
2301 double dfToleranceEps = DEFAULT_TOLERANCE_EPSILON);
2302 OGRErr addCurveDirectly(OGRCurve *,
2303 double dfToleranceEps = DEFAULT_TOLERANCE_EPSILON);
2304 OGRErr addCurve(std::unique_ptr<OGRCurve>,
2305 double dfToleranceEps = DEFAULT_TOLERANCE_EPSILON);
2306 OGRCurve *stealCurve(int);
2307 virtual OGRPointIterator *getPointIterator() const override;
2308
2309 // Non-standard from OGRGeometry.
2310 virtual OGRwkbGeometryType getGeometryType() const override;
2311 virtual const char *getGeometryName() const override;
2312 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
2313 virtual void flattenTo2D() override;
2314 virtual void segmentize(double dfMaxLength) override;
2315 virtual OGRBoolean
2316 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2317 virtual OGRGeometry *
2318 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2319 const char *const *papszOptions = nullptr) const override;
2320
2321 virtual void accept(IOGRGeometryVisitor *visitor) override
2322 {
2323 visitor->visit(this);
2324 }
2325
2326 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2327 {
2328 visitor->visit(this);
2329 }
2330
2331 virtual void swapXY() override;
2332
2333 OGR_ALLOW_UPCAST_TO(Curve)
2334 OGR_ALLOW_CAST_TO_THIS(CompoundCurve)
2335};
2336
2338
2339inline const OGRCompoundCurve::ChildType *const *
2340begin(const OGRCompoundCurve *poCurve)
2341{
2342 return poCurve->begin();
2343}
2344
2346inline const OGRCompoundCurve::ChildType *const *
2347end(const OGRCompoundCurve *poCurve)
2348{
2349 return poCurve->end();
2350}
2351
2354{
2355 return poCurve->begin();
2356}
2357
2360{
2361 return poCurve->end();
2362}
2363
2365
2366/************************************************************************/
2367/* OGRSurface */
2368/************************************************************************/
2369
2375class CPL_DLL OGRSurface : public OGRGeometry
2376{
2377 protected:
2379 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
2380 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
2382
2383 public:
2384 virtual double get_Area() const = 0;
2385 virtual double get_GeodesicArea(
2386 const OGRSpatialReference *poSRSOverride = nullptr) const = 0;
2387
2388 virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
2389 {
2390 return PointOnSurfaceInternal(poPoint);
2391 }
2392
2393 virtual OGRSurface *clone() const override = 0;
2394
2396 static OGRPolygon *CastToPolygon(OGRSurface *poSurface);
2397 static OGRCurvePolygon *CastToCurvePolygon(OGRSurface *poSurface);
2399
2400 OGR_FORBID_DOWNCAST_TO_POINT
2401 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
2402 OGR_ALLOW_CAST_TO_THIS(Surface)
2403 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
2404};
2405
2406/************************************************************************/
2407/* OGRCurvePolygon */
2408/************************************************************************/
2409
2423class CPL_DLL OGRCurvePolygon : public OGRSurface
2424{
2425 static OGRPolygon *CasterToPolygon(OGRSurface *poSurface);
2426
2427 private:
2428 OGRBoolean IntersectsPoint(const OGRPoint *p) const;
2429 OGRBoolean ContainsPoint(const OGRPoint *p) const;
2430 virtual int checkRing(OGRCurve *poNewRing) const;
2431 OGRErr addRingDirectlyInternal(OGRCurve *poCurve, int bNeedRealloc);
2432 static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
2433 OGRCurve *poCurve);
2434 static OGRErr addCurveDirectlyFromWkb(OGRGeometry *poSelf,
2435 OGRCurve *poCurve);
2436
2437 protected:
2439 friend class OGRPolygon;
2440 friend class OGRTriangle;
2441 OGRCurveCollection oCC{};
2442
2443 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2444 virtual OGRSurfaceCasterToCurvePolygon
2445 GetCasterToCurvePolygon() const override;
2446
2448
2449 static OGRPolygon *CastToPolygon(OGRCurvePolygon *poCP);
2450
2451 public:
2454 ~OGRCurvePolygon() override;
2455
2456 OGRCurvePolygon &operator=(const OGRCurvePolygon &other);
2457
2460
2465 {
2466 return oCC.begin();
2467 }
2468
2471 {
2472 return oCC.end();
2473 }
2474
2478 const ChildType *const *begin() const
2479 {
2480 return oCC.begin();
2481 }
2482
2484 const ChildType *const *end() const
2485 {
2486 return oCC.end();
2487 }
2488
2489 // Non standard (OGRGeometry).
2490 virtual const char *getGeometryName() const override;
2491 virtual OGRwkbGeometryType getGeometryType() const override;
2492 virtual OGRCurvePolygon *clone() const override;
2493 virtual void empty() override;
2494 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
2495 virtual void flattenTo2D() override;
2496 virtual OGRBoolean IsEmpty() const override;
2497 virtual void segmentize(double dfMaxLength) override;
2498 virtual OGRBoolean
2499 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2500 virtual OGRGeometry *
2501 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2502 const char *const *papszOptions = nullptr) const override;
2503 virtual double get_GeodesicArea(
2504 const OGRSpatialReference *poSRSOverride = nullptr) const override;
2505
2506 // ISurface Interface
2507 virtual double get_Area() const override;
2508
2509 // IWks Interface
2510 virtual size_t WkbSize() const override;
2511 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2512 size_t &nBytesConsumedOut) override;
2513 OGRErr exportToWkb(unsigned char *,
2514 const OGRwkbExportOptions * = nullptr) const override;
2515
2516#ifndef DOXYGEN_XML
2518#endif
2519
2520 OGRErr importFromWkt(const char **) override;
2521
2522#ifndef DOXYGEN_XML
2524#endif
2525
2530 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2531 OGRErr *err = nullptr) const override;
2532
2533 // IGeometry
2534 virtual int getDimension() const override;
2535 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
2536 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
2537
2538 // ICurvePolygon
2539 virtual OGRPolygon *
2540 CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
2541 const char *const *papszOptions = nullptr) const;
2542
2543 // ISpatialRelation
2544 virtual OGRBoolean Equals(const OGRGeometry *) const override;
2545 virtual OGRBoolean Intersects(const OGRGeometry *) const override;
2546 virtual OGRBoolean Contains(const OGRGeometry *) const override;
2547
2548 // Non standard
2549 virtual void setCoordinateDimension(int nDimension) override;
2550 virtual void set3D(OGRBoolean bIs3D) override;
2551 virtual void setMeasured(OGRBoolean bIsMeasured) override;
2552
2553 virtual void
2554 assignSpatialReference(const OGRSpatialReference *poSR) override;
2555
2556 virtual OGRErr addRing(OGRCurve *);
2557 virtual OGRErr addRingDirectly(OGRCurve *);
2558 OGRErr addRing(std::unique_ptr<OGRCurve>);
2559
2560 OGRCurve *getExteriorRingCurve();
2561 const OGRCurve *getExteriorRingCurve() const;
2562 int getNumInteriorRings() const;
2563 OGRCurve *getInteriorRingCurve(int);
2564 const OGRCurve *getInteriorRingCurve(int) const;
2565
2566 OGRCurve *stealExteriorRingCurve();
2567
2568 OGRErr removeRing(int iIndex, bool bDelete = true);
2569
2570 virtual void accept(IOGRGeometryVisitor *visitor) override
2571 {
2572 visitor->visit(this);
2573 }
2574
2575 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2576 {
2577 visitor->visit(this);
2578 }
2579
2580 virtual void swapXY() override;
2581
2582 OGR_ALLOW_UPCAST_TO(Surface)
2583 OGR_ALLOW_CAST_TO_THIS(CurvePolygon)
2584};
2585
2587
2588inline const OGRCurvePolygon::ChildType *const *
2589begin(const OGRCurvePolygon *poGeom)
2590{
2591 return poGeom->begin();
2592}
2593
2595inline const OGRCurvePolygon::ChildType *const *
2596end(const OGRCurvePolygon *poGeom)
2597{
2598 return poGeom->end();
2599}
2600
2603{
2604 return poGeom->begin();
2605}
2606
2609{
2610 return poGeom->end();
2611}
2612
2614
2615/************************************************************************/
2616/* OGRPolygon */
2617/************************************************************************/
2618
2628class CPL_DLL OGRPolygon : public OGRCurvePolygon
2629{
2630 static OGRCurvePolygon *CasterToCurvePolygon(OGRSurface *poSurface);
2631
2632 protected:
2634 friend class OGRMultiSurface;
2635 friend class OGRPolyhedralSurface;
2636 friend class OGRTriangulatedSurface;
2637
2638 virtual int checkRing(OGRCurve *poNewRing) const override;
2639 virtual OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ,
2640 int bHasM, OGRRawPoint *&paoPoints,
2641 int &nMaxPoints, double *&padfZ);
2642
2643 static OGRCurvePolygon *CastToCurvePolygon(OGRPolygon *poPoly);
2644
2645 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2646 virtual OGRSurfaceCasterToCurvePolygon
2647 GetCasterToCurvePolygon() const override;
2649
2650 public:
2652 OGRPolygon(const OGRPolygon &other);
2653 ~OGRPolygon() override;
2654
2655 OGRPolygon &operator=(const OGRPolygon &other);
2656
2659
2664 {
2665 return reinterpret_cast<ChildType **>(oCC.begin());
2666 }
2667
2670 {
2671 return reinterpret_cast<ChildType **>(oCC.end());
2672 }
2673
2677 const ChildType *const *begin() const
2678 {
2679 return reinterpret_cast<const ChildType *const *>(oCC.begin());
2680 }
2681
2683 const ChildType *const *end() const
2684 {
2685 return reinterpret_cast<const ChildType *const *>(oCC.end());
2686 }
2687
2688 // Non-standard (OGRGeometry).
2689 virtual const char *getGeometryName() const override;
2690 virtual OGRwkbGeometryType getGeometryType() const override;
2691 virtual OGRPolygon *clone() const override;
2692 virtual OGRBoolean
2693 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2694 virtual OGRGeometry *
2695 getCurveGeometry(const char *const *papszOptions = nullptr) const override;
2696 virtual OGRGeometry *
2697 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2698 const char *const *papszOptions = nullptr) const override;
2699
2700 // IWks Interface.
2701 virtual size_t WkbSize() const override;
2702 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2703 size_t &nBytesConsumedOut) override;
2704 OGRErr exportToWkb(unsigned char *,
2705 const OGRwkbExportOptions * = nullptr) const override;
2706
2707#ifndef DOXYGEN_XML
2709#endif
2710
2711 OGRErr importFromWkt(const char **) override;
2712
2713#ifndef DOXYGEN_XML
2715#endif
2716
2721 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2722 OGRErr *err = nullptr) const override;
2723
2724 // ICurvePolygon.
2725 virtual OGRPolygon *
2726 CurvePolyToPoly(double dfMaxAngleStepSizeDegrees = 0,
2727 const char *const *papszOptions = nullptr) const override;
2728
2729 OGRLinearRing *getExteriorRing();
2730 const OGRLinearRing *getExteriorRing() const;
2731 virtual OGRLinearRing *getInteriorRing(int);
2732 virtual const OGRLinearRing *getInteriorRing(int) const;
2733
2734 OGRLinearRing *stealExteriorRing();
2735 virtual OGRLinearRing *stealInteriorRing(int);
2736
2737 OGRBoolean IsPointOnSurface(const OGRPoint *) const;
2738
2741 {
2742 return this;
2743 }
2744
2746 inline const OGRCurvePolygon *toUpperClass() const
2747 {
2748 return this;
2749 }
2750
2751 virtual void accept(IOGRGeometryVisitor *visitor) override
2752 {
2753 visitor->visit(this);
2754 }
2755
2756 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2757 {
2758 visitor->visit(this);
2759 }
2760
2761 virtual void closeRings() override;
2762
2763 OGR_ALLOW_UPCAST_TO(CurvePolygon)
2764 OGR_ALLOW_CAST_TO_THIS(Polygon)
2765};
2766
2768
2769inline const OGRPolygon::ChildType *const *begin(const OGRPolygon *poGeom)
2770{
2771 return poGeom->begin();
2772}
2773
2775inline const OGRPolygon::ChildType *const *end(const OGRPolygon *poGeom)
2776{
2777 return poGeom->end();
2778}
2779
2781inline OGRPolygon::ChildType **begin(OGRPolygon *poGeom)
2782{
2783 return poGeom->begin();
2784}
2785
2787inline OGRPolygon::ChildType **end(OGRPolygon *poGeom)
2788{
2789 return poGeom->end();
2790}
2791
2793
2794/************************************************************************/
2795/* OGRTriangle */
2796/************************************************************************/
2797
2804class CPL_DLL OGRTriangle : public OGRPolygon
2805{
2806 private:
2807 // cppcheck-suppress unusedPrivateFunction
2808 static OGRPolygon *CasterToPolygon(OGRSurface *poSurface);
2809 bool quickValidityCheck() const;
2810
2811 protected:
2813 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2814 virtual OGRErr importFromWKTListOnly(const char **ppszInput, int bHasZ,
2815 int bHasM, OGRRawPoint *&paoPoints,
2816 int &nMaxPoints,
2817 double *&padfZ) override;
2819
2820 public:
2822 OGRTriangle(const OGRPoint &p, const OGRPoint &q, const OGRPoint &r);
2824 OGRTriangle(const OGRPolygon &other, OGRErr &eErr);
2825 OGRTriangle &operator=(const OGRTriangle &other);
2826 ~OGRTriangle() override;
2827 virtual const char *getGeometryName() const override;
2828 virtual OGRwkbGeometryType getGeometryType() const override;
2829 virtual OGRTriangle *clone() const override;
2830
2831 // IWks Interface.
2832 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2833 size_t &nBytesConsumedOut) override;
2834
2835 // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
2836 virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override;
2837
2840 {
2841 return this;
2842 }
2843
2845 inline const OGRPolygon *toUpperClass() const
2846 {
2847 return this;
2848 }
2849
2850 virtual void accept(IOGRGeometryVisitor *visitor) override
2851 {
2852 visitor->visit(this);
2853 }
2854
2855 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
2856 {
2857 visitor->visit(this);
2858 }
2859
2861 static OGRGeometry *CastToPolygon(OGRGeometry *poGeom);
2863
2864 OGR_ALLOW_UPCAST_TO(Polygon)
2865 OGR_ALLOW_CAST_TO_THIS(Triangle)
2866};
2867
2868/************************************************************************/
2869/* OGRGeometryCollection */
2870/************************************************************************/
2871
2880{
2881 OGRErr importFromWktInternal(const char **ppszInput, int nRecLevel);
2882
2883 protected:
2885 int nGeomCount = 0;
2886 OGRGeometry **papoGeoms = nullptr;
2887
2888 std::string
2889 exportToWktInternal(const OGRWktOptions &opts, OGRErr *err,
2890 const std::string &exclude = std::string()) const;
2891 static OGRGeometryCollection *
2892 TransferMembersAndDestroy(OGRGeometryCollection *poSrc,
2893 OGRGeometryCollection *poDst);
2894
2895 OGRErr importFromWkbInternal(const unsigned char *pabyData, size_t nSize,
2896 int nRecLevel, OGRwkbVariant,
2897 size_t &nBytesConsumedOut);
2899 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const;
2900
2901 public:
2904 ~OGRGeometryCollection() override;
2905
2906 OGRGeometryCollection &operator=(const OGRGeometryCollection &other);
2907
2910
2915 {
2916 return papoGeoms;
2917 }
2918
2921 {
2922 return papoGeoms + nGeomCount;
2923 }
2924
2928 const ChildType *const *begin() const
2929 {
2930 return papoGeoms;
2931 }
2932
2934 const ChildType *const *end() const
2935 {
2936 return papoGeoms + nGeomCount;
2937 }
2938
2939 // Non standard (OGRGeometry).
2940 virtual const char *getGeometryName() const override;
2941 virtual OGRwkbGeometryType getGeometryType() const override;
2942 virtual OGRGeometryCollection *clone() const override;
2943 virtual void empty() override;
2944 virtual OGRErr transform(OGRCoordinateTransformation *poCT) override;
2945 virtual void flattenTo2D() override;
2946 virtual OGRBoolean IsEmpty() const override;
2947 virtual void segmentize(double dfMaxLength) override;
2948 virtual OGRBoolean
2949 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
2950 virtual OGRGeometry *
2951 getCurveGeometry(const char *const *papszOptions = nullptr) const override;
2952 virtual OGRGeometry *
2953 getLinearGeometry(double dfMaxAngleStepSizeDegrees = 0,
2954 const char *const *papszOptions = nullptr) const override;
2955 virtual double
2956 get_GeodesicArea(const OGRSpatialReference *poSRSOverride = nullptr) const;
2957
2958 // IWks Interface
2959 virtual size_t WkbSize() const override;
2960 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
2961 size_t &nBytesConsumedOut) override;
2962 OGRErr exportToWkb(unsigned char *,
2963 const OGRwkbExportOptions * = nullptr) const override;
2964
2965#ifndef DOXYGEN_XML
2967#endif
2968
2969 OGRErr importFromWkt(const char **) override;
2970
2971#ifndef DOXYGEN_XML
2973#endif
2974
2979 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
2980 OGRErr *err = nullptr) const override;
2981
2982 virtual double get_Length() const;
2983 virtual double get_Area() const;
2984
2985 // IGeometry methods
2986 virtual int getDimension() const override;
2987 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
2988 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
2989
2990 // IGeometryCollection
2991 int getNumGeometries() const;
2992 OGRGeometry *getGeometryRef(int);
2993 const OGRGeometry *getGeometryRef(int) const;
2994
2995 // ISpatialRelation
2996 virtual OGRBoolean Equals(const OGRGeometry *) const override;
2997
2998 // Non standard
2999 virtual void setCoordinateDimension(int nDimension) override;
3000 virtual void set3D(OGRBoolean bIs3D) override;
3001 virtual void setMeasured(OGRBoolean bIsMeasured) override;
3002 virtual OGRErr addGeometry(const OGRGeometry *);
3003 virtual OGRErr addGeometryDirectly(OGRGeometry *);
3004 OGRErr addGeometry(std::unique_ptr<OGRGeometry> geom);
3005 virtual OGRErr removeGeometry(int iIndex, int bDelete = TRUE);
3006
3007 virtual void
3008 assignSpatialReference(const OGRSpatialReference *poSR) override;
3009
3010 void closeRings() override;
3011
3012 virtual void swapXY() override;
3013
3014 virtual void accept(IOGRGeometryVisitor *visitor) override
3015 {
3016 visitor->visit(this);
3017 }
3018
3019 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3020 {
3021 visitor->visit(this);
3022 }
3023
3024 static OGRGeometryCollection *
3025 CastToGeometryCollection(OGRGeometryCollection *poSrc);
3026
3027 OGR_FORBID_DOWNCAST_TO_POINT
3028 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
3029 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
3030 OGR_ALLOW_CAST_TO_THIS(GeometryCollection)
3031};
3032
3034
3035inline const OGRGeometryCollection::ChildType *const *
3036begin(const OGRGeometryCollection *poGeom)
3037{
3038 return poGeom->begin();
3039}
3040
3042inline const OGRGeometryCollection::ChildType *const *
3043end(const OGRGeometryCollection *poGeom)
3044{
3045 return poGeom->end();
3046}
3047
3050{
3051 return poGeom->begin();
3052}
3053
3056{
3057 return poGeom->end();
3058}
3059
3061
3062/************************************************************************/
3063/* OGRMultiSurface */
3064/************************************************************************/
3065
3073{
3074 protected:
3075 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3076
3077 public:
3080 ~OGRMultiSurface() override;
3081
3082 OGRMultiSurface &operator=(const OGRMultiSurface &other);
3083
3086
3091 {
3092 return reinterpret_cast<ChildType **>(papoGeoms);
3093 }
3094
3097 {
3098 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3099 }
3100
3104 const ChildType *const *begin() const
3105 {
3106 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3107 }
3108
3110 const ChildType *const *end() const
3111 {
3112 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3113 nGeomCount);
3114 }
3115
3116 // Non standard (OGRGeometry).
3117 virtual const char *getGeometryName() const override;
3118 virtual OGRwkbGeometryType getGeometryType() const override;
3119 virtual OGRMultiSurface *clone() const override;
3120
3121#ifndef DOXYGEN_XML
3123#endif
3124
3125 OGRErr importFromWkt(const char **) override;
3126
3127#ifndef DOXYGEN_XML
3129#endif
3130
3135 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3136 OGRErr *err = nullptr) const override;
3137
3138 // IMultiSurface methods
3139 virtual OGRErr PointOnSurface(OGRPoint *poPoint) const;
3140
3141 // IGeometry methods
3142 virtual int getDimension() const override;
3143
3144 // IGeometryCollection
3147 {
3149 }
3150
3152 const OGRSurface *getGeometryRef(int i) const
3153 {
3155 }
3156
3157 // Non standard
3158 virtual OGRBoolean
3159 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3160
3163 {
3164 return this;
3165 }
3166
3169 {
3170 return this;
3171 }
3172
3173 virtual void accept(IOGRGeometryVisitor *visitor) override
3174 {
3175 visitor->visit(this);
3176 }
3177
3178 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3179 {
3180 visitor->visit(this);
3181 }
3182
3183 static OGRMultiPolygon *CastToMultiPolygon(OGRMultiSurface *poMS);
3184
3185 OGR_ALLOW_CAST_TO_THIS(MultiSurface)
3186 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3187 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3188 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
3189 OGR_FORBID_DOWNCAST_TO_MULTICURVE
3190};
3191
3193
3194inline const OGRMultiSurface::ChildType *const *
3195begin(const OGRMultiSurface *poGeom)
3196{
3197 return poGeom->begin();
3198}
3199
3201inline const OGRMultiSurface::ChildType *const *
3202end(const OGRMultiSurface *poGeom)
3203{
3204 return poGeom->end();
3205}
3206
3209{
3210 return poGeom->begin();
3211}
3212
3215{
3216 return poGeom->end();
3217}
3218
3220
3221/************************************************************************/
3222/* OGRMultiPolygon */
3223/************************************************************************/
3224
3229class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
3230{
3231 protected:
3232 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3233 friend class OGRPolyhedralSurface;
3234 friend class OGRTriangulatedSurface;
3235
3236 private:
3238 OGRErr _addGeometryWithExpectedSubGeometryType(
3239 const OGRGeometry *poNewGeom, OGRwkbGeometryType eSubGeometryType);
3240 OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
3241 OGRGeometry *poNewGeom, OGRwkbGeometryType eSubGeometryType);
3243
3244 public:
3247 ~OGRMultiPolygon() override;
3248
3249 OGRMultiPolygon &operator=(const OGRMultiPolygon &other);
3250
3253
3258 {
3259 return reinterpret_cast<ChildType **>(papoGeoms);
3260 }
3261
3264 {
3265 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3266 }
3267
3271 const ChildType *const *begin() const
3272 {
3273 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3274 }
3275
3277 const ChildType *const *end() const
3278 {
3279 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3280 nGeomCount);
3281 }
3282
3283 // IGeometryCollection
3286 {
3288 }
3289
3291 const OGRPolygon *getGeometryRef(int i) const
3292 {
3294 }
3295
3296 // Non-standard (OGRGeometry).
3297 virtual const char *getGeometryName() const override;
3298 virtual OGRwkbGeometryType getGeometryType() const override;
3299 virtual OGRMultiPolygon *clone() const override;
3300
3301#ifndef DOXYGEN_XML
3303#endif
3304
3305 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
3306 size_t &nBytesConsumedOut) override;
3307
3312 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3313 OGRErr *err = nullptr) const override;
3314
3315 // Non standard
3316 virtual OGRBoolean
3317 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3318
3321 {
3322 return this;
3323 }
3324
3327 {
3328 return this;
3329 }
3330
3331 virtual void accept(IOGRGeometryVisitor *visitor) override
3332 {
3333 visitor->visit(this);
3334 }
3335
3336 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3337 {
3338 visitor->visit(this);
3339 }
3340
3341 static OGRMultiSurface *CastToMultiSurface(OGRMultiPolygon *poMP);
3342
3343 OGR_ALLOW_CAST_TO_THIS(MultiPolygon)
3344 OGR_ALLOW_UPCAST_TO(MultiSurface)
3345};
3346
3348
3349inline const OGRMultiPolygon::ChildType *const *
3350begin(const OGRMultiPolygon *poGeom)
3351{
3352 return poGeom->begin();
3353}
3354
3356inline const OGRMultiPolygon::ChildType *const *
3357end(const OGRMultiPolygon *poGeom)
3358{
3359 return poGeom->end();
3360}
3361
3364{
3365 return poGeom->begin();
3366}
3367
3370{
3371 return poGeom->end();
3372}
3373
3375
3376/************************************************************************/
3377/* OGRPolyhedralSurface */
3378/************************************************************************/
3379
3386class CPL_DLL OGRPolyhedralSurface : public OGRSurface
3387{
3388 protected:
3390 friend class OGRTriangulatedSurface;
3391 OGRMultiPolygon oMP{};
3392 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
3393 virtual OGRSurfaceCasterToCurvePolygon
3394 GetCasterToCurvePolygon() const override;
3395 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const;
3396 virtual const char *getSubGeometryName() const;
3397 virtual OGRwkbGeometryType getSubGeometryType() const;
3398 std::string exportToWktInternal(const OGRWktOptions &opts,
3399 OGRErr *err) const;
3400
3401 virtual OGRPolyhedralSurfaceCastToMultiPolygon
3402 GetCasterToMultiPolygon() const;
3403 static OGRMultiPolygon *CastToMultiPolygonImpl(OGRPolyhedralSurface *poPS);
3405
3406 public:
3410 OGRPolyhedralSurface &operator=(const OGRPolyhedralSurface &other);
3411
3414
3419 {
3420 return oMP.begin();
3421 }
3422
3425 {
3426 return oMP.end();
3427 }
3428
3432 const ChildType *const *begin() const
3433 {
3434 return oMP.begin();
3435 }
3436
3438 const ChildType *const *end() const
3439 {
3440 return oMP.end();
3441 }
3442
3443 // IWks Interface.
3444 virtual size_t WkbSize() const override;
3445 virtual const char *getGeometryName() const override;
3446 virtual OGRwkbGeometryType getGeometryType() const override;
3447 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
3448 size_t &nBytesConsumedOut) override;
3449 OGRErr exportToWkb(unsigned char *,
3450 const OGRwkbExportOptions * = nullptr) const override;
3451
3452#ifndef DOXYGEN_XML
3454#endif
3455
3456 OGRErr importFromWkt(const char **) override;
3457
3458#ifndef DOXYGEN_XML
3460#endif
3461
3466 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3467 OGRErr *err = nullptr) const override;
3468
3469 // IGeometry methods.
3470 virtual int getDimension() const override;
3471
3472 virtual void empty() override;
3473
3474 virtual OGRPolyhedralSurface *clone() const override;
3475 virtual void getEnvelope(OGREnvelope *psEnvelope) const override;
3476 virtual void getEnvelope(OGREnvelope3D *psEnvelope) const override;
3477
3478 virtual void flattenTo2D() override;
3479 virtual OGRErr transform(OGRCoordinateTransformation *) override;
3480 virtual OGRBoolean Equals(const OGRGeometry *) const override;
3481 virtual double get_Area() const override;
3482 virtual double get_GeodesicArea(
3483 const OGRSpatialReference *poSRSOverride = nullptr) const override;
3484 virtual OGRErr PointOnSurface(OGRPoint *) const override;
3485
3486 static OGRMultiPolygon *CastToMultiPolygon(OGRPolyhedralSurface *poPS);
3487 virtual OGRBoolean
3488 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3489 virtual OGRErr addGeometry(const OGRGeometry *);
3490 OGRErr addGeometryDirectly(OGRGeometry *poNewGeom);
3491 OGRErr addGeometry(std::unique_ptr<OGRGeometry> poNewGeom);
3492
3493 int getNumGeometries() const;
3494 OGRPolygon *getGeometryRef(int i);
3495 const OGRPolygon *getGeometryRef(int i) const;
3496
3497 virtual OGRBoolean IsEmpty() const override;
3498 virtual void setCoordinateDimension(int nDimension) override;
3499 virtual void set3D(OGRBoolean bIs3D) override;
3500 virtual void setMeasured(OGRBoolean bIsMeasured) override;
3501 virtual void swapXY() override;
3502 OGRErr removeGeometry(int iIndex, int bDelete = TRUE);
3503
3504 virtual void accept(IOGRGeometryVisitor *visitor) override
3505 {
3506 visitor->visit(this);
3507 }
3508
3509 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3510 {
3511 visitor->visit(this);
3512 }
3513
3514 virtual void
3515 assignSpatialReference(const OGRSpatialReference *poSR) override;
3516
3517 OGR_ALLOW_CAST_TO_THIS(PolyhedralSurface)
3518 OGR_ALLOW_UPCAST_TO(Surface)
3519};
3520
3522
3523inline const OGRPolyhedralSurface::ChildType *const *
3524begin(const OGRPolyhedralSurface *poGeom)
3525{
3526 return poGeom->begin();
3527}
3528
3530inline const OGRPolyhedralSurface::ChildType *const *
3531end(const OGRPolyhedralSurface *poGeom)
3532{
3533 return poGeom->end();
3534}
3535
3538{
3539 return poGeom->begin();
3540}
3541
3544{
3545 return poGeom->end();
3546}
3547
3549
3550/************************************************************************/
3551/* OGRTriangulatedSurface */
3552/************************************************************************/
3553
3561{
3562 protected:
3564 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3565 virtual const char *getSubGeometryName() const override;
3566 virtual OGRwkbGeometryType getSubGeometryType() const override;
3567
3568 virtual OGRPolyhedralSurfaceCastToMultiPolygon
3569 GetCasterToMultiPolygon() const override;
3570 static OGRMultiPolygon *CastToMultiPolygonImpl(OGRPolyhedralSurface *poPS);
3572
3573 public:
3577
3580
3585 {
3586 return reinterpret_cast<ChildType **>(oMP.begin());
3587 }
3588
3591 {
3592 return reinterpret_cast<ChildType **>(oMP.end());
3593 }
3594
3598 const ChildType *const *begin() const
3599 {
3600 return reinterpret_cast<const ChildType *const *>(oMP.begin());
3601 }
3602
3604 const ChildType *const *end() const
3605 {
3606 return reinterpret_cast<const ChildType *const *>(oMP.end());
3607 }
3608
3609 OGRTriangulatedSurface &operator=(const OGRTriangulatedSurface &other);
3610 virtual const char *getGeometryName() const override;
3611 virtual OGRwkbGeometryType getGeometryType() const override;
3612 virtual OGRTriangulatedSurface *clone() const override;
3613
3616 {
3618 }
3619
3621 const OGRTriangle *getGeometryRef(int i) const
3622 {
3624 }
3625
3626 // IWks Interface.
3627 virtual OGRErr addGeometry(const OGRGeometry *) override;
3628
3629#ifndef DOXYGEN_XML
3631#endif
3632
3635 {
3636 return this;
3637 }
3638
3641 {
3642 return this;
3643 }
3644
3645 virtual void accept(IOGRGeometryVisitor *visitor) override
3646 {
3647 visitor->visit(this);
3648 }
3649
3650 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3651 {
3652 visitor->visit(this);
3653 }
3654
3655 static OGRPolyhedralSurface *
3656 CastToPolyhedralSurface(OGRTriangulatedSurface *poTS);
3657
3658 OGR_ALLOW_CAST_TO_THIS(TriangulatedSurface)
3659 OGR_ALLOW_UPCAST_TO(PolyhedralSurface)
3660};
3661
3663
3664inline const OGRTriangulatedSurface::ChildType *const *
3665begin(const OGRTriangulatedSurface *poGeom)
3666{
3667 return poGeom->begin();
3668}
3669
3671inline const OGRTriangulatedSurface::ChildType *const *
3672end(const OGRTriangulatedSurface *poGeom)
3673{
3674 return poGeom->end();
3675}
3676
3679{
3680 return poGeom->begin();
3681}
3682
3685{
3686 return poGeom->end();
3687}
3688
3690
3691/************************************************************************/
3692/* OGRMultiPoint */
3693/************************************************************************/
3694
3700{
3701 private:
3702 OGRErr importFromWkt_Bracketed(const char **, int bHasM, int bHasZ);
3703
3704 protected:
3705 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3706
3707 public:
3710 ~OGRMultiPoint() override;
3711
3712 OGRMultiPoint &operator=(const OGRMultiPoint &other);
3713
3716
3721 {
3722 return reinterpret_cast<ChildType **>(papoGeoms);
3723 }
3724
3727 {
3728 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3729 }
3730
3734 const ChildType *const *begin() const
3735 {
3736 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3737 }
3738
3740 const ChildType *const *end() const
3741 {
3742 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3743 nGeomCount);
3744 }
3745
3746 // IGeometryCollection
3749 {
3751 }
3752
3754 const OGRPoint *getGeometryRef(int i) const
3755 {
3757 }
3758
3759 // Non-standard (OGRGeometry).
3760 virtual const char *getGeometryName() const override;
3761 virtual OGRwkbGeometryType getGeometryType() const override;
3762 virtual OGRMultiPoint *clone() const override;
3763
3764#ifndef DOXYGEN_XML
3766#endif
3767
3768 OGRErr importFromWkt(const char **) override;
3769
3770#ifndef DOXYGEN_XML
3772#endif
3773
3778 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3779 OGRErr *err = nullptr) const override;
3780
3781 // IGeometry methods.
3782 virtual int getDimension() const override;
3783
3786 {
3787 return this;
3788 }
3789
3792 {
3793 return this;
3794 }
3795
3796 virtual void accept(IOGRGeometryVisitor *visitor) override
3797 {
3798 visitor->visit(this);
3799 }
3800
3801 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3802 {
3803 visitor->visit(this);
3804 }
3805
3806 // Non-standard.
3807 virtual OGRBoolean
3808 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3809
3810 OGR_ALLOW_CAST_TO_THIS(MultiPoint)
3811 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3812 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
3813 OGR_FORBID_DOWNCAST_TO_MULTICURVE
3814 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3815 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3816};
3817
3819
3820inline const OGRMultiPoint::ChildType *const *begin(const OGRMultiPoint *poGeom)
3821{
3822 return poGeom->begin();
3823}
3824
3826inline const OGRMultiPoint::ChildType *const *end(const OGRMultiPoint *poGeom)
3827{
3828 return poGeom->end();
3829}
3830
3833{
3834 return poGeom->begin();
3835}
3836
3839{
3840 return poGeom->end();
3841}
3842
3844
3845/************************************************************************/
3846/* OGRMultiCurve */
3847/************************************************************************/
3848
3856{
3857 protected:
3859 static OGRErr addCurveDirectlyFromWkt(OGRGeometry *poSelf,
3860 OGRCurve *poCurve);
3862 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
3863
3864 public:
3867 ~OGRMultiCurve() override;
3868
3869 OGRMultiCurve &operator=(const OGRMultiCurve &other);
3870
3873
3878 {
3879 return reinterpret_cast<ChildType **>(papoGeoms);
3880 }
3881
3884 {
3885 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
3886 }
3887
3891 const ChildType *const *begin() const
3892 {
3893 return reinterpret_cast<const ChildType *const *>(papoGeoms);
3894 }
3895
3897 const ChildType *const *end() const
3898 {
3899 return reinterpret_cast<const ChildType *const *>(papoGeoms +
3900 nGeomCount);
3901 }
3902
3903 // IGeometryCollection
3906 {
3908 }
3909
3911 const OGRCurve *getGeometryRef(int i) const
3912 {
3914 }
3915
3916 // Non standard (OGRGeometry).
3917 virtual const char *getGeometryName() const override;
3918 virtual OGRwkbGeometryType getGeometryType() const override;
3919 virtual OGRMultiCurve *clone() const override;
3920
3921#ifndef DOXYGEN_XML
3923#endif
3924
3925 OGRErr importFromWkt(const char **) override;
3926
3927#ifndef DOXYGEN_XML
3929#endif
3930
3935 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
3936 OGRErr *err = nullptr) const override;
3937
3938 // IGeometry methods.
3939 virtual int getDimension() const override;
3940
3941 // Non-standard.
3942 virtual OGRBoolean
3943 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
3944
3947 {
3948 return this;
3949 }
3950
3953 {
3954 return this;
3955 }
3956
3957 virtual void accept(IOGRGeometryVisitor *visitor) override
3958 {
3959 visitor->visit(this);
3960 }
3961
3962 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
3963 {
3964 visitor->visit(this);
3965 }
3966
3967 static OGRMultiLineString *CastToMultiLineString(OGRMultiCurve *poMC);
3968
3969 OGR_ALLOW_CAST_TO_THIS(MultiCurve)
3970 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3971 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3972 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3973 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3974};
3975
3977
3978inline const OGRMultiCurve::ChildType *const *begin(const OGRMultiCurve *poGeom)
3979{
3980 return poGeom->begin();
3981}
3982
3984inline const OGRMultiCurve::ChildType *const *end(const OGRMultiCurve *poGeom)
3985{
3986 return poGeom->end();
3987}
3988
3991{
3992 return poGeom->begin();
3993}
3994
3997{
3998 return poGeom->end();
3999}
4000
4002
4003/************************************************************************/
4004/* OGRMultiLineString */
4005/************************************************************************/
4006
4011class CPL_DLL OGRMultiLineString : public OGRMultiCurve
4012{
4013 protected:
4014 virtual OGRBoolean isCompatibleSubType(OGRwkbGeometryType) const override;
4015
4016 public:
4019 ~OGRMultiLineString() override;
4020
4021 OGRMultiLineString &operator=(const OGRMultiLineString &other);
4022
4025
4030 {
4031 return reinterpret_cast<ChildType **>(papoGeoms);
4032 }
4033
4036 {
4037 return reinterpret_cast<ChildType **>(papoGeoms + nGeomCount);
4038 }
4039
4043 const ChildType *const *begin() const
4044 {
4045 return reinterpret_cast<const ChildType *const *>(papoGeoms);
4046 }
4047
4049 const ChildType *const *end() const
4050 {
4051 return reinterpret_cast<const ChildType *const *>(papoGeoms +
4052 nGeomCount);
4053 }
4054
4055 // IGeometryCollection
4058 {
4060 }
4061
4063 const OGRLineString *getGeometryRef(int i) const
4064 {
4066 }
4067
4068 // Non standard (OGRGeometry).
4069 virtual const char *getGeometryName() const override;
4070 virtual OGRwkbGeometryType getGeometryType() const override;
4071 virtual OGRMultiLineString *clone() const override;
4072
4073#ifndef DOXYGEN_XML
4075#endif
4076
4077 virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant,
4078 size_t &nBytesConsumedOut) override;
4079
4084 virtual std::string exportToWkt(const OGRWktOptions &opts = OGRWktOptions(),
4085 OGRErr *err = nullptr) const override;
4086
4087 // Non standard
4088 virtual OGRBoolean
4089 hasCurveGeometry(int bLookForNonLinear = FALSE) const override;
4090
4093 {
4094 return this;
4095 }
4096
4099 {
4100 return this;
4101 }
4102
4103 virtual void accept(IOGRGeometryVisitor *visitor) override
4104 {
4105 visitor->visit(this);
4106 }
4107
4108 virtual void accept(IOGRConstGeometryVisitor *visitor) const override
4109 {
4110 visitor->visit(this);
4111 }
4112
4113 static OGRMultiCurve *CastToMultiCurve(OGRMultiLineString *poMLS);
4114
4115 OGR_ALLOW_CAST_TO_THIS(MultiLineString)
4116 OGR_ALLOW_UPCAST_TO(MultiCurve)
4117 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
4118 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
4119 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
4120};
4121
4123
4124inline const OGRMultiLineString::ChildType *const *
4125begin(const OGRMultiLineString *poGeom)
4126{
4127 return poGeom->begin();
4128}
4129
4131inline const OGRMultiLineString::ChildType *const *
4132end(const OGRMultiLineString *poGeom)
4133{
4134 return poGeom->end();
4135}
4136
4139{
4140 return poGeom->begin();
4141}
4142
4145{
4146 return poGeom->end();
4147}
4148
4150
4151/************************************************************************/
4152/* OGRGeometryFactory */
4153/************************************************************************/
4154
4160{
4161 static OGRErr createFromFgfInternal(const unsigned char *pabyData,
4162 OGRSpatialReference *poSR,
4163 OGRGeometry **ppoReturn, int nBytes,
4164 int *pnBytesConsumed, int nRecLevel);
4165
4166 public:
4167 static OGRErr createFromWkb(const void *, const OGRSpatialReference *,
4168 OGRGeometry **,
4169 size_t = static_cast<size_t>(-1),
4171 static OGRErr createFromWkb(const void *pabyData,
4172 const OGRSpatialReference *, OGRGeometry **,
4173 size_t nSize, OGRwkbVariant eVariant,
4174 size_t &nBytesConsumedOut);
4175 static OGRErr createFromWkt(const char *, const OGRSpatialReference *,
4176 OGRGeometry **);
4177 static OGRErr createFromWkt(const char **, const OGRSpatialReference *,
4178 OGRGeometry **);
4179
4183 static OGRErr createFromWkt(char **ppszInput,
4184 const OGRSpatialReference *poSRS,
4185 OGRGeometry **ppoGeom)
4186 CPL_WARN_DEPRECATED("Use createFromWkt(const char**, ...) instead")
4187 {
4188 return createFromWkt(const_cast<const char **>(ppszInput), poSRS,
4189 ppoGeom);
4190 }
4191
4192 static OGRErr createFromFgf(const void *, OGRSpatialReference *,
4193 OGRGeometry **, int = -1, int * = nullptr);
4194 static OGRGeometry *createFromGML(const char *);
4195 static OGRGeometry *createFromGEOS(GEOSContextHandle_t hGEOSCtxt, GEOSGeom);
4196 static OGRGeometry *createFromGeoJson(const char *, int = -1);
4197 static OGRGeometry *createFromGeoJson(const CPLJSONObject &oJSONObject);
4198
4199 static void destroyGeometry(OGRGeometry *);
4200 static OGRGeometry *createGeometry(OGRwkbGeometryType);
4201
4202 static OGRGeometry *forceToPolygon(OGRGeometry *);
4203 static OGRGeometry *forceToLineString(OGRGeometry *,
4204 bool bOnlyInOrder = true);
4205 static OGRGeometry *forceToMultiPolygon(OGRGeometry *);
4206 static OGRGeometry *forceToMultiPoint(OGRGeometry *);
4207 static OGRGeometry *forceToMultiLineString(OGRGeometry *);
4208
4209 static OGRGeometry *forceTo(OGRGeometry *poGeom,
4210 OGRwkbGeometryType eTargetType,
4211 const char *const *papszOptions = nullptr);
4212
4213 static OGRGeometry *removeLowerDimensionSubGeoms(const OGRGeometry *poGeom);
4214
4215 static OGRGeometry *organizePolygons(OGRGeometry **papoPolygons,
4216 int nPolygonCount,
4217 int *pbResultValidGeometry,
4218 const char **papszOptions = nullptr);
4219 static bool haveGEOS();
4220
4223 {
4224 friend class OGRGeometryFactory;
4225 struct Private;
4226 std::unique_ptr<Private> d;
4227
4228 public:
4231 };
4232
4233 static OGRGeometry *transformWithOptions(
4234 const OGRGeometry *poSrcGeom, OGRCoordinateTransformation *poCT,
4235 char **papszOptions,
4237
4238 static OGRGeometry *
4239 approximateArcAngles(double dfX, double dfY, double dfZ,
4240 double dfPrimaryRadius, double dfSecondaryAxis,
4241 double dfRotation, double dfStartAngle,
4242 double dfEndAngle, double dfMaxAngleStepSizeDegrees,
4243 const bool bUseMaxGap = false);
4244
4245 static int GetCurveParameters(double x0, double y0, double x1, double y1,
4246 double x2, double y2, double &R, double &cx,
4247 double &cy, double &alpha0, double &alpha1,
4248 double &alpha2);
4249 static OGRLineString *
4250 curveToLineString(double x0, double y0, double z0, double x1, double y1,
4251 double z1, double x2, double y2, double z2, int bHasZ,
4252 double dfMaxAngleStepSizeDegrees,
4253 const char *const *papszOptions = nullptr);
4254 static OGRCurve *
4255 curveFromLineString(const OGRLineString *poLS,
4256 const char *const *papszOptions = nullptr);
4257};
4258
4259OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType(const char *pszGeomType);
4260const char CPL_DLL *OGRToOGCGeomType(OGRwkbGeometryType eGeomType,
4261 bool bCamelCase = false,
4262 bool bAddZM = false,
4263 bool bSpaceBeforeZM = false);
4264
4266typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
4267
4268struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
4269{
4270 void operator()(OGRPreparedGeometry *) const;
4271};
4272
4274
4278typedef std::unique_ptr<OGRPreparedGeometry,
4279 OGRPreparedGeometryUniquePtrDeleter>
4281
4282#endif /* ndef OGR_GEOMETRY_H_INCLUDED */
The CPLJSONArray class holds JSON object from CPLJSONDocument.
Definition: cpl_json.h:57
OGRGeometry visitor interface.
Definition: ogr_geometry.h:242
virtual void visit(const OGRCurvePolygon *)=0
Visit OGRCurvePolygon.
virtual void visit(const OGRPolyhedralSurface *)=0
Visit OGRPolyhedralSurface.
virtual void visit(const OGRCompoundCurve *)=0
Visit OGRCompoundCurve.
virtual void visit(const OGRMultiLineString *)=0
Visit OGRMultiLineString.
virtual void visit(const OGRTriangulatedSurface *)=0
Visit OGRTriangulatedSurface.
virtual void visit(const OGRPolygon *)=0
Visit OGRPolygon.
virtual void visit(const OGRMultiPolygon *)=0
Visit OGRMultiPolygon.
virtual void visit(const OGRTriangle *)=0
Visit OGRTriangle.
virtual void visit(const OGRLineString *)=0
Visit OGRLineString.
virtual void visit(const OGRMultiPoint *)=0
Visit OGRMultiPoint.
virtual void visit(const OGRMultiCurve *)=0
Visit OGRMultiCurve.
virtual void visit(const OGRGeometryCollection *)=0
Visit OGRGeometryCollection.
virtual void visit(const OGRPoint *)=0
Visit OGRPoint.
virtual ~IOGRConstGeometryVisitor()=default
Destructor/.
virtual void visit(const OGRMultiSurface *)=0
Visit OGRMultiSurface.
virtual void visit(const OGRLinearRing *)=0
Visit OGRLinearRing.
virtual void visit(const OGRCircularString *)=0
Visit OGRCircularString.
OGRGeometry visitor interface.
Definition: ogr_geometry.h:166
virtual void visit(OGRMultiSurface *)=0
Visit OGRMultiSurface.
virtual void visit(OGRLinearRing *)=0
Visit OGRLinearRing.
virtual void visit(OGRTriangle *)=0
Visit OGRTriangle.
virtual void visit(OGRCircularString *)=0
Visit OGRCircularString.
virtual void visit(OGRPolygon *)=0
Visit OGRPolygon.
virtual void visit(OGRLineString *)=0
Visit OGRLineString.
virtual void visit(OGRCompoundCurve *)=0
Visit OGRCompoundCurve.
virtual void visit(OGRTriangulatedSurface *)=0
Visit OGRTriangulatedSurface.
virtual void visit(OGRPoint *)=0
Visit OGRPoint.
virtual void visit(OGRCurvePolygon *)=0
Visit OGRCurvePolygon.
virtual void visit(OGRGeometryCollection *)=0
Visit OGRGeometryCollection.
virtual void visit(OGRPolyhedralSurface *)=0
Visit OGRPolyhedralSurface.
virtual void visit(OGRMultiPolygon *)=0
Visit OGRMultiPolygon.
virtual ~IOGRGeometryVisitor()=default
Destructor/.
virtual void visit(OGRMultiLineString *)=0
Visit OGRMultiLineString.
virtual void visit(OGRMultiPoint *)=0
Visit OGRMultiPoint.
virtual void visit(OGRMultiCurve *)=0
Visit OGRMultiCurve.
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:1946
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2029
OGRCircularString()
Create an empty circular string.
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2024
OGRCircularString(const OGRCircularString &other)
Copy constructor.
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2018
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2034
Utility class to store a collection of curves.
Definition: ogr_geometry.h:2168
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2326
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:2228
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:2222
OGRCompoundCurve(const OGRCompoundCurve &other)
Copy constructor.
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2203
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:2214
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:2208
OGRCompoundCurve()
Create an empty compound curve.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2321
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:787
Concrete class representing curve polygons.
Definition: ogr_geometry.h:2424
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2570
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2459
OGRCurvePolygon()
Create an empty curve polygon.
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:2484
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:2478
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:2464
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:2470
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2575
OGRCurvePolygon(const OGRCurvePolygon &)
Copy constructor.
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:1323
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const =0
Return a linestring from a curve geometry.
virtual double get_Length() const =0
Returns the length of the curve.
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1414
virtual void StartPoint(OGRPoint *) const =0
Return the curve start point.
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
virtual int getNumPoints() const =0
Return the number of points of a curve geometry.
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1366
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1406
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
virtual OGRPointIterator * getPointIterator() const =0
Returns a point iterator over the curve.
virtual double get_GeodesicArea(const OGRSpatialReference *poSRSOverride=nullptr) const =0
Get the area of the (closed) curve, considered as a surface on the underlying ellipsoid of the SRS at...
virtual double get_AreaOfCurveSegments() const =0
Get the area of the purely curve portions of a (closed) curve.
virtual double get_Area() const =0
Get the area of the (closed) curve.
virtual OGRCurve * clone() const override=0
Make a copy of this object.
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:289
void visit(const OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:293
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:213
void visit(OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:217
Simple container for a bounding region in 3D.
Definition: ogr_core.h:216
Simple container for a bounding region (rectangle)
Definition: ogr_core.h:61
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:2880
ChildType ** end()
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2920
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3014
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3019
const ChildType *const * begin() const
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2928
const ChildType *const * end() const
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2934
ChildType ** begin()
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2914
OGRGeometry * getGeometryRef(int)
Fetch geometry from container.
Definition: ogrgeometrycollection.cpp:259
OGRGeometryCollection()
Create an empty geometry collection.
OGRGeometry ChildType
Type of child elements.
Definition: ogr_geometry.h:2909
Opaque class used as argument to transformWithOptions()
Definition: ogr_geometry.h:4223
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:4160
static OGRErr createFromWkt(char **ppszInput, const OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
Definition: ogr_geometry.h:4183
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:377
const OGRSurface * toSurface() const
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:808
const OGRCurvePolygon * toCurvePolygon() const
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:866
const OGRMultiCurve * toMultiCurve() const
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:966
const OGRPolyhedralSurface * toPolyhedralSurface() const
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:1006
const OGRMultiPoint * toMultiPoint() const
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:906
virtual void empty()=0
Clear geometry information.
const OGRMultiPolygon * toMultiPolygon() const
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:946
virtual OGRBoolean Equals(const OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
OGRPolyhedralSurface * toPolyhedralSurface()
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:996
const OGRMultiSurface * toMultiSurface() const
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:986
OGRPoint * toPoint()
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:661
bool operator!=(const OGRGeometry &other) const
Returns if two geometries are different.
Definition: ogr_geometry.h:437
OGRTriangle * toTriangle()
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:837
OGRLineString * toLineString()
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:720
const OGRLinearRing * toLinearRing() const
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:748
const OGRPoint * toPoint() const
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:670
OGRMultiLineString * toMultiLineString()
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:916
OGRMultiSurface * toMultiSurface()
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:976
static OGRGeometry * FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
Definition: ogr_geometry.h:652
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
virtual void accept(IOGRConstGeometryVisitor *visitor) const =0
Accept a visitor.
const OGRGeometryCollection * toGeometryCollection() const
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:886
const OGRMultiLineString * toMultiLineString() const
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:926
const OGRCircularString * toCircularString() const
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:768
OGRPolygon * toPolygon()
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:818
bool operator==(const OGRGeometry &other) const
Returns if two geometries are equal.
Definition: ogr_geometry.h:431
OGRLinearRing * toLinearRing()
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:739
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:459
virtual void accept(IOGRGeometryVisitor *visitor)=0
Accept a visitor.
OGRMultiCurve * toMultiCurve()
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:956
const OGRCompoundCurve * toCompoundCurve() const
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:788
virtual OGRErr transform(OGRCoordinateTransformation *poCT)=0
Apply arbitrary coordinate transformation to geometry.
virtual void flattenTo2D()=0
Convert geometry to strictly 2D.
virtual int getDimension() const =0
Get the dimension of this object.
OGRGeometryCollection * toGeometryCollection()
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:876
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
OGRMultiPolygon * toMultiPolygon()
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:936
const OGRPolygon * toPolygon() const
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:828
OGRCompoundCurve * toCompoundCurve()
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:778
OGRErr importFromWkt(char **ppszInput)
Deprecated.
Definition: ogr_geometry.h:486
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.
const OGRLineString * toLineString() const
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:730
OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const
Convert a geometry into well known text format.
Definition: ogrgeometry.cpp:1949
OGRCircularString * toCircularString()
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:758
const OGRCurve * toCurve() const
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:690
OGRCurvePolygon * toCurvePolygon()
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:856
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:710
static OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
Definition: ogr_geometry.h:644
OGRBoolean Is3D() const
Definition: ogr_geometry.h:453
OGRMultiPoint * toMultiPoint()
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:896
const OGRTriangulatedSurface * toTriangulatedSurface() const
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:1024
const OGRTriangle * toTriangle() const
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:846
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
virtual OGRGeometry * clone() const =0
Make a copy of this object.
OGRSurface * toSurface()
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:798
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:700
OGRTriangulatedSurface * toTriangulatedSurface()
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:1015
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const =0
Export a WKT geometry.
OGRCurve * toCurve()
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:680
Definition: ogr_geometry.h:1470
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1763
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1803
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1819
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1814
OGRLineString(const OGRLineString &other)
Copy constructor.
virtual double get_GeodesicArea(const OGRSpatialReference *poSRSOverride=nullptr) const override
Get the area of the (closed) curve, considered as a surface on the underlying ellipsoid of the SRS at...
virtual int isClockwise() const override
Returns TRUE if the ring has clockwise winding (or less than 2 points)
OGRLineString()
Create an empty line string.
virtual double get_Area() const override
Get the area of the (closed) curve.
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1809
Concrete representation of a closed ring.
Definition: ogr_geometry.h:1853
OGRLineString * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1904
const OGRLineString * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1910
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1920
OGRLinearRing(const OGRLinearRing &other)
Copy constructor.
OGRLinearRing()
Constructor.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1915
A collection of OGRCurve.
Definition: ogr_geometry.h:3856
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3891
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3897
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3962
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3883
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3952
const OGRCurve * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3911
OGRCurve * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3905
OGRMultiCurve()
Create an empty multi curve collection.
OGRMultiCurve(const OGRMultiCurve &other)
Copy constructor.
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:3872
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3877
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3946
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3957
A collection of OGRLineString.
Definition: ogr_geometry.h:4012
OGRLineString ChildType
Type of child elements.
Definition: ogr_geometry.h:4024
OGRLineString * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:4057
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:4092
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:4035
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:4049
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:4108
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:4043
OGRMultiLineString()
Create an empty multi line string collection.
const OGRLineString * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:4063
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:4103
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:4029
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:4098
OGRMultiLineString(const OGRMultiLineString &other)
Copy constructor.
A collection of OGRPoint.
Definition: ogr_geometry.h:3700
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3785
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3796
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3740
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3720
OGRMultiPoint()
Create an empty multi point collection.
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3801
OGRMultiPoint(const OGRMultiPoint &other)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3734
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3791
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:3715
const OGRPoint * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3754
OGRPoint * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3748
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3726
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:3230
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:3252
OGRMultiPolygon(const OGRMultiPolygon &other)
Copy constructor.
OGRPolygon * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3285
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3336
const OGRPolygon * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3291
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3277
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3263
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3331
OGRMultiPolygon()
Create an empty multi polygon collection.
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3257
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3320
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3271
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3326
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:3073
OGRMultiSurface()
Create an empty multi surface collection.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3173
const OGRSurface * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3152
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3090
OGRSurface ChildType
Type of child elements.
Definition: ogr_geometry.h:3085
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3168
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3104
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3110
OGRMultiSurface(const OGRMultiSurface &other)
Copy constructor.
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3096
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3178
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3162
OGRSurface * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3146
Interface for a point iterator.
Definition: ogr_geometry.h:1305
virtual OGRBoolean getNextPoint(OGRPoint *p)=0
Returns the next point followed by the iterator.
Point class.
Definition: ogr_geometry.h:1142
double getM() const
Return m.
Definition: ogr_geometry.h:1215
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1276
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:1226
OGRPoint(const OGRPoint &other)
Copy constructor.
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:1250
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:1259
double getX() const
Return x.
Definition: ogr_geometry.h:1197
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1281
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:1238
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:1190
double getZ() const
Return z.
Definition: ogr_geometry.h:1209
double getY() const
Return y.
Definition: ogr_geometry.h:1203
Concrete class representing polygons.
Definition: ogr_geometry.h:2629
OGRLinearRing ChildType
Type of child elements.
Definition: ogr_geometry.h:2658
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2663
const OGRCurvePolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2746
OGRPolygon()
Create an empty polygon.
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2669
OGRPolygon(const OGRPolygon &other)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2677
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2756
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2683
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2751
OGRCurvePolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2740
PolyhedralSurface class.
Definition: ogr_geometry.h:3387
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3424
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3438
OGRPolygon * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:871
OGRPolyhedralSurface(const OGRPolyhedralSurface &poGeom)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3432
~OGRPolyhedralSurface() override
Destructor.
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3418
virtual OGRErr addGeometry(const OGRGeometry *)
Add a new geometry to a collection.
Definition: ogrpolyhedralsurface.cpp:753
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3504
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:3413
OGRPolyhedralSurface()
Create an empty PolyhedralSurface.
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3509
Simple container for a position.
Definition: ogr_geometry.h:106
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:114
double x
x
Definition: ogr_geometry.h:119
double y
y
Definition: ogr_geometry.h:121
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:109
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:1514
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:1663
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:1658
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1585
virtual OGRSimpleCurve * clone() const override=0
Make a copy of this object.
virtual int getNumPoints() const override
Fetch vertex count.
Definition: ogr_geometry.h:1651
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:169
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:2376
virtual double get_Area() const =0
Get the area of the surface object.
virtual double get_GeodesicArea(const OGRSpatialReference *poSRSOverride=nullptr) const =0
Get the area of the surface object, considered as a surface on the underlying ellipsoid of the SRS at...
virtual OGRSurface * clone() const override=0
Make a copy of this object.
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:2388
Triangle class.
Definition: ogr_geometry.h:2805
const OGRPolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2845
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2850
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2855
OGRTriangle()
Constructor.
~OGRTriangle() override
Destructor.
OGRPolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2839
OGRTriangle(const OGRTriangle &other)
Copy constructor.
TriangulatedSurface class.
Definition: ogr_geometry.h:3561
const OGRTriangle * getGeometryRef(int i) const
See OGRPolyhedralSurface::getGeometryRef()
Definition: ogr_geometry.h:3621
~OGRTriangulatedSurface()
Destructor.
OGRTriangle * getGeometryRef(int i)
See OGRPolyhedralSurface::getGeometryRef()
Definition: ogr_geometry.h:3615
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3604
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3598
OGRPolyhedralSurface * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3634
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3645
const OGRPolyhedralSurface * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3640
OGRTriangle ChildType
Type of child elements.
Definition: ogr_geometry.h:3579
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3650
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3584
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3590
OGRTriangulatedSurface()
Constructor.
Various convenience functions for CPL.
Interface for read and write JSON documents.
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1042
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1183
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:976
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:185
void * OGRGeometryH
Opaque type for a geometry.
Definition: ogr_api.h:66
Core portability services for cross-platform OGR code.
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:404
OGRwkbByteOrder
Enumeration to describe byte order.
Definition: ogr_core.h:620
@ wkbNDR
LSB/Intel/Vax: Least Significant Byte First
Definition: ogr_core.h:622
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:550
@ wkbVariantOldOgc
Old-style 99-402 extended dimension (Z) WKB types.
Definition: ogr_core.h:551
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:416
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:387
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:2592
OGRWktFormat
WKT Output formatting options.
Definition: ogr_geometry.h:64
@ Default
Format as F when abs(value) < 1, otherwise as G.
@ F
F-type formatting.
@ G
G-type formatting.
std::unique_ptr< OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter > OGRPreparedGeometryUniquePtr
Unique pointer type for OGRPreparedGeometry.
Definition: ogr_geometry.h:4280
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
Definition: ogr_geometry.h:127
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGCgeometry format type to corresponding OGR constants.
Definition: ogrgeometry.cpp:2513
std::unique_ptr< OGRGeometry, OGRGeometryUniquePtrDeleter > OGRGeometryUniquePtr
Unique pointer type for OGRGeometry.
Definition: ogr_geometry.h:1042
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:125
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:129
Coordinate systems services.
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:426
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:434
Geometry coordinate precision for a binary representation.
Definition: ogr_geometry.h:323
Geometry coordinate precision.
Definition: ogr_geomcoordinateprecision.h:50
Options for formatting WKT output.
Definition: ogr_geometry.h:72
int mPrecision
Precision of output for M coordinates. Interpretation depends on format.
Definition: ogr_geometry.h:81
int zPrecision
Precision of output for Z coordinates. Interpretation depends on format.
Definition: ogr_geometry.h:79
OGRWktOptions()
Constructor.
Definition: ogr_geometry.h:88
OGRWktOptions(const OGRWktOptions &)=default
Copy constructor.
int xyPrecision
Precision of output for X,Y coordinates. Interpretation depends on format.
Definition: ogr_geometry.h:77
WKB export options.
Definition: ogr_geometry.h:346