GDAL

ogr_geometry.h
Go to the documentation of this file.
1 /******************************************************************************
2 * $Id$
3 *
4 * Project: OpenGIS Simple Features Reference Implementation
5 * Purpose: Classes for manipulating simple features that is not specific
6 * to a particular interface technology.
7 * Author: Frank Warmerdam, warmerdam@pobox.com
8 *
9 ******************************************************************************
10 * Copyright (c) 1999, Frank Warmerdam
11 * Copyright (c) 2008-2014, Even Rouault <even dot rouault at spatialys.com>
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a
14 * copy of this software and associated documentation files (the "Software"),
15 * to deal in the Software without restriction, including without limitation
16 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 * and/or sell copies of the Software, and to permit persons to whom the
18 * Software is furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included
21 * in all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 ****************************************************************************/
31
32 #ifndef OGR_GEOMETRY_H_INCLUDED
33 #define OGR_GEOMETRY_H_INCLUDED
34
35 #include "cpl_conv.h"
36 #include "cpl_json.h"
37 #include "ogr_core.h"
38 #include "ogr_spatialref.h"
39
40 #include <cmath>
41 #include <memory>
42
50 #ifndef DEFINEH_OGRGeometryH
51 #define DEFINEH_OGRGeometryH
52 #ifdef DEBUG
53 typedef struct OGRGeometryHS *OGRGeometryH;
54 #else
55 typedef void *OGRGeometryH;
56 #endif
57 #endif /* DEFINEH_OGRGeometryH */
61 enum class OGRWktFormat
62 {
63 F,
64 G,
65 Default
66 };
67
69 struct CPL_DLL OGRWktOptions
70 {
71 public:
73 OGRwkbVariant variant;
75 int precision;
77 bool round;
79 OGRWktFormat format;
80
82 OGRWktOptions() : variant(wkbVariantOldOgc), precision(15), round(true),
83 format(OGRWktFormat::Default)
84 {
85 static int defPrecision = getDefaultPrecision();
86 static bool defRound = getDefaultRound();
87
88 precision = defPrecision;
89 round = defRound;
90 }
91
93 OGRWktOptions(const OGRWktOptions&) = default;
94
95 private:
96 static int getDefaultPrecision();
97 static bool getDefaultRound();
98 };
99
103 class OGRRawPoint
104 {
105 public:
107 OGRRawPoint() : x(0.0), y(0.0) {}
108
110 OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn) {}
111
113 double x;
115 double y;
116 };
117
119 typedef struct GEOSGeom_t *GEOSGeom;
121 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
123 typedef void sfcgal_geometry_t;
124
125 class OGRPoint;
126 class OGRCurve;
127 class OGRCompoundCurve;
128 class OGRSimpleCurve;
129 class OGRLinearRing;
130 class OGRLineString;
131 class OGRCircularString;
132 class OGRSurface;
133 class OGRCurvePolygon;
134 class OGRPolygon;
135 class OGRMultiPoint;
136 class OGRMultiSurface;
137 class OGRMultiPolygon;
138 class OGRMultiCurve;
139 class OGRMultiLineString;
140 class OGRGeometryCollection;
141 class OGRTriangle;
142 class OGRPolyhedralSurface;
143 class OGRTriangulatedSurface;
144
146 typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
147 typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
148
149 typedef OGRPolygon* (*OGRSurfaceCasterToPolygon)(OGRSurface*);
150 typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
151 typedef OGRMultiPolygon* (*OGRPolyhedralSurfaceCastToMultiPolygon)(OGRPolyhedralSurface*);
153
157 class CPL_DLL IOGRGeometryVisitor
158 {
159 public:
161 virtual ~IOGRGeometryVisitor() = default;
162
164 virtual void visit(OGRPoint*) = 0;
166 virtual void visit(OGRLineString*) = 0;
168 virtual void visit(OGRLinearRing*) = 0;
170 virtual void visit(OGRPolygon*) = 0;
172 virtual void visit(OGRMultiPoint*) = 0;
174 virtual void visit(OGRMultiLineString*) = 0;
176 virtual void visit(OGRMultiPolygon*) = 0;
178 virtual void visit(OGRGeometryCollection*) = 0;
180 virtual void visit(OGRCircularString*) = 0;
182 virtual void visit(OGRCompoundCurve*) = 0;
184 virtual void visit(OGRCurvePolygon*) = 0;
186 virtual void visit(OGRMultiCurve*) = 0;
188 virtual void visit(OGRMultiSurface*) = 0;
190 virtual void visit(OGRTriangle*) = 0;
192 virtual void visit(OGRPolyhedralSurface*) = 0;
194 virtual void visit(OGRTriangulatedSurface*) = 0;
195 };
196
204 class CPL_DLL OGRDefaultGeometryVisitor: public IOGRGeometryVisitor
205 {
206 void _visit(OGRSimpleCurve* poGeom);
207
208 public:
209
210 void visit(OGRPoint*) override {}
211 void visit(OGRLineString*) override;
212 void visit(OGRLinearRing*) override;
213 void visit(OGRPolygon*) override;
214 void visit(OGRMultiPoint*) override;
215 void visit(OGRMultiLineString*) override;
216 void visit(OGRMultiPolygon*) override;
217 void visit(OGRGeometryCollection*) override;
218 void visit(OGRCircularString*) override;
219 void visit(OGRCompoundCurve*) override;
220 void visit(OGRCurvePolygon*) override;
221 void visit(OGRMultiCurve*) override;
222 void visit(OGRMultiSurface*) override;
223 void visit(OGRTriangle*) override;
224 void visit(OGRPolyhedralSurface*) override;
225 void visit(OGRTriangulatedSurface*) override;
226 };
227
231 class CPL_DLL IOGRConstGeometryVisitor
232 {
233 public:
235 virtual ~IOGRConstGeometryVisitor() = default;
236
238 virtual void visit(const OGRPoint*) = 0;
240 virtual void visit(const OGRLineString*) = 0;
242 virtual void visit(const OGRLinearRing*) = 0;
244 virtual void visit(const OGRPolygon*) = 0;
246 virtual void visit(const OGRMultiPoint*) = 0;
248 virtual void visit(const OGRMultiLineString*) = 0;
250 virtual void visit(const OGRMultiPolygon*) = 0;
252 virtual void visit(const OGRGeometryCollection*) = 0;
254 virtual void visit(const OGRCircularString*) = 0;
256 virtual void visit(const OGRCompoundCurve*) = 0;
258 virtual void visit(const OGRCurvePolygon*) = 0;
260 virtual void visit(const OGRMultiCurve*) = 0;
262 virtual void visit(const OGRMultiSurface*) = 0;
264 virtual void visit(const OGRTriangle*) = 0;
266 virtual void visit(const OGRPolyhedralSurface*) = 0;
268 virtual void visit(const OGRTriangulatedSurface*) = 0;
269 };
270
278 class CPL_DLL OGRDefaultConstGeometryVisitor: public IOGRConstGeometryVisitor
279 {
280 void _visit(const OGRSimpleCurve* poGeom);
281
282 public:
283
284 void visit(const OGRPoint*) override {}
285 void visit(const OGRLineString*) override;
286 void visit(const OGRLinearRing*) override;
287 void visit(const OGRPolygon*) override;
288 void visit(const OGRMultiPoint*) override;
289 void visit(const OGRMultiLineString*) override;
290 void visit(const OGRMultiPolygon*) override;
291 void visit(const OGRGeometryCollection*) override;
292 void visit(const OGRCircularString*) override;
293 void visit(const OGRCompoundCurve*) override;
294 void visit(const OGRCurvePolygon*) override;
295 void visit(const OGRMultiCurve*) override;
296 void visit(const OGRMultiSurface*) override;
297 void visit(const OGRTriangle*) override;
298 void visit(const OGRPolyhedralSurface*) override;
299 void visit(const OGRTriangulatedSurface*) override;
300 };
301
302 /************************************************************************/
303 /* OGRGeometry */
304 /************************************************************************/
305
326 class CPL_DLL OGRGeometry
327 {
328 private:
329 OGRSpatialReference * poSRS = nullptr; // may be NULL
330
331 protected:
333 friend class OGRCurveCollection;
334
335 unsigned int flags = 0;
336
337 OGRErr importPreambleFromWkt( const char ** ppszInput,
338 int* pbHasZ, int* pbHasM,
339 bool* pbIsEmpty );
340 OGRErr importCurveCollectionFromWkt(
341 const char ** ppszInput,
342 int bAllowEmptyComponent,
343 int bAllowLineString,
344 int bAllowCurve,
345 int bAllowCompoundCurve,
346 OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf,
347 OGRCurve* poCurve) );
348 OGRErr importPreambleFromWkb( const unsigned char * pabyData,
349 size_t nSize,
350 OGRwkbByteOrder& eByteOrder,
351 OGRwkbVariant eWkbVariant );
352 OGRErr importPreambleOfCollectionFromWkb(
353 const unsigned char * pabyData,
354 size_t& nSize,
355 size_t& nDataOffset,
356 OGRwkbByteOrder& eByteOrder,
357 size_t nMinSubGeomSize,
358 int& nGeomCount,
359 OGRwkbVariant eWkbVariant );
360 OGRErr PointOnSurfaceInternal( OGRPoint * poPoint ) const;
361 OGRBoolean IsSFCGALCompatible() const;
362
363 void HomogenizeDimensionalityWith( OGRGeometry* poOtherGeom );
364 std::string wktTypeString(OGRwkbVariant variant) const;
365
367
368 public:
369
370 /************************************************************************/
371 /* Bit flags for OGRGeometry */
372 /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
373 /* Do not use these outside of the core. */
374 /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
375 /************************************************************************/
376
378 static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
379 static const unsigned int OGR_G_3D = 0x2;
380 static const unsigned int OGR_G_MEASURED = 0x4;
382
383 OGRGeometry();
384 OGRGeometry( const OGRGeometry& other );
385 virtual ~OGRGeometry();
386
387 OGRGeometry& operator=( const OGRGeometry& other );
388
390 bool operator==( const OGRGeometry& other ) const { return CPL_TO_BOOL(Equals(&other)); }
391
393 bool operator!=( const OGRGeometry& other ) const { return !CPL_TO_BOOL(Equals(&other)); }
394
395 // Standard IGeometry.
396 virtual int getDimension() const = 0;
397 virtual int getCoordinateDimension() const;
398 int CoordinateDimension() const;
399 virtual OGRBoolean IsEmpty() const = 0;
400 virtual OGRBoolean IsValid() const;
401 virtual OGRGeometry* MakeValid() const;
402 virtual OGRGeometry* Normalize() const;
403 virtual OGRBoolean IsSimple() const;
405 OGRBoolean Is3D() const { return flags & OGR_G_3D; }
407 OGRBoolean IsMeasured() const { return flags & OGR_G_MEASURED; }
408 virtual OGRBoolean IsRing() const;
409 virtual void empty() = 0;
410 virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
411 virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
412 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
413
414 // IWks Interface.
415 virtual size_t WkbSize() const = 0;
416 OGRErr importFromWkb( const GByte*, size_t=static_cast<size_t>(-1),
417 OGRwkbVariant=wkbVariantOldOgc );
418 virtual OGRErr importFromWkb( const unsigned char *,
419 size_t,
420 OGRwkbVariant,
421 size_t& nBytesConsumedOut ) = 0;
422 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
423 OGRwkbVariant=wkbVariantOldOgc ) const = 0;
424 virtual OGRErr importFromWkt( const char ** ppszInput ) = 0;
425
426 #ifndef DOXYGEN_XML
430 OGRErr importFromWkt( char ** ppszInput )
432 CPL_WARN_DEPRECATED("Use importFromWkt(const char**) instead")
434 {
435 return importFromWkt( const_cast<const char**>(ppszInput) );
436 }
437 #endif
438
439 OGRErr exportToWkt( char ** ppszDstText,
440 OGRwkbVariant=wkbVariantOldOgc ) const;
441
446 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
447 OGRErr *err = nullptr) const = 0;
448
449 // Non-standard.
450 virtual OGRwkbGeometryType getGeometryType() const = 0;
451 OGRwkbGeometryType getIsoGeometryType() const;
452 virtual const char *getGeometryName() const = 0;
453 virtual void dumpReadable( FILE *, const char * = nullptr
454 , char** papszOptions = nullptr ) const;
455 virtual void flattenTo2D() = 0;
456 virtual char * exportToGML( const char* const * papszOptions = nullptr ) const;
457 virtual char * exportToKML() const;
458 virtual char * exportToJson() const;
459
461 virtual void accept(IOGRGeometryVisitor* visitor) = 0;
462
464 virtual void accept(IOGRConstGeometryVisitor* visitor) const = 0;
465
466 static GEOSContextHandle_t createGEOSContext();
467 static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
468 virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
469 const CPL_WARN_UNUSED_RESULT;
470 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
471 virtual OGRGeometry* getCurveGeometry(
472 const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
473 virtual OGRGeometry* getLinearGeometry(
474 double dfMaxAngleStepSizeDegrees = 0,
475 const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
476
477 // SFCGAL interfacing methods.
479 static sfcgal_geometry_t* OGRexportToSFCGAL( const OGRGeometry *poGeom );
480 static OGRGeometry* SFCGALexportToOGR( const sfcgal_geometry_t* _geometry );
482 virtual void closeRings();
483
484 virtual void setCoordinateDimension( int nDimension );
485 virtual void set3D( OGRBoolean bIs3D );
486 virtual void setMeasured( OGRBoolean bIsMeasured );
487
488 virtual void assignSpatialReference( OGRSpatialReference * poSR );
489 OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
490
491 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) = 0;
492 OGRErr transformTo( OGRSpatialReference *poSR );
493
494 virtual void segmentize(double dfMaxLength);
495
496 // ISpatialRelation
497 virtual OGRBoolean Intersects( const OGRGeometry * ) const;
498 virtual OGRBoolean Equals( const OGRGeometry * ) const = 0;
499 virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
500 virtual OGRBoolean Touches( const OGRGeometry * ) const;
501 virtual OGRBoolean Crosses( const OGRGeometry * ) const;
502 virtual OGRBoolean Within( const OGRGeometry * ) const;
503 virtual OGRBoolean Contains( const OGRGeometry * ) const;
504 virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
505 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
506 // virtual OGRGeometry *LocateAlong( double mValue ) const;
507 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
508
509 virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
510 virtual double Distance( const OGRGeometry * ) const ;
511 virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
512 virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
513 const CPL_WARN_UNUSED_RESULT;
514 virtual OGRGeometry *Intersection( const OGRGeometry *)
515 const CPL_WARN_UNUSED_RESULT;
516 virtual OGRGeometry *Union( const OGRGeometry * )
517 const CPL_WARN_UNUSED_RESULT;
518 virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
519 virtual OGRGeometry *Difference( const OGRGeometry * )
520 const CPL_WARN_UNUSED_RESULT;
521 virtual OGRGeometry *SymDifference( const OGRGeometry * )
522 const CPL_WARN_UNUSED_RESULT;
523 virtual OGRErr Centroid( OGRPoint * poPoint ) const;
524 virtual OGRGeometry *Simplify(double dTolerance)
525 const CPL_WARN_UNUSED_RESULT;
526 OGRGeometry *SimplifyPreserveTopology(double dTolerance)
527 const CPL_WARN_UNUSED_RESULT;
528 virtual OGRGeometry *DelaunayTriangulation(
529 double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
530
531 virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
532
533 virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
534
536 // backward compatibility to non-standard method names.
537 OGRBoolean Intersect( OGRGeometry * )
538 const CPL_WARN_DEPRECATED("Non standard method. "
539 "Use Intersects() instead");
540 OGRBoolean Equal( OGRGeometry * )
541 const CPL_WARN_DEPRECATED("Non standard method. "
542 "Use Equals() instead");
543 OGRGeometry *SymmetricDifference( const OGRGeometry * )
544 const CPL_WARN_DEPRECATED("Non standard method. "
545 "Use SymDifference() instead");
546 OGRGeometry *getBoundary()
547 const CPL_WARN_DEPRECATED("Non standard method. "
548 "Use Boundary() instead");
550
552 // Special HACK for DB2 7.2 support
553 static int bGenerate_DB2_V72_BYTE_ORDER;
555
556 virtual void swapXY();
558 static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
559 static OGRGeometry* CastToError( OGRGeometry* poGeom );
561
565 static inline OGRGeometryH ToHandle(OGRGeometry* poGeom)
566 { return reinterpret_cast<OGRGeometryH>(poGeom); }
567
571 static inline OGRGeometry* FromHandle(OGRGeometryH hGeom)
572 { return reinterpret_cast<OGRGeometry*>(hGeom); }
573
578 inline OGRPoint* toPoint()
579 { return cpl::down_cast<OGRPoint*>(this); }
580
585 inline const OGRPoint* toPoint() const
586 { return cpl::down_cast<const OGRPoint*>(this); }
587
592 inline OGRCurve* toCurve()
593 { return cpl::down_cast<OGRCurve*>(this); }
594
599 inline const OGRCurve* toCurve() const
600 { return cpl::down_cast<const OGRCurve*>(this); }
601
606 inline OGRSimpleCurve* toSimpleCurve()
607 { return cpl::down_cast<OGRSimpleCurve*>(this); }
608
613 inline const OGRSimpleCurve* toSimpleCurve() const
614 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
615
620 inline OGRLineString* toLineString()
621 { return cpl::down_cast<OGRLineString*>(this); }
622
627 inline const OGRLineString* toLineString() const
628 { return cpl::down_cast<const OGRLineString*>(this); }
629
634 inline OGRLinearRing* toLinearRing()
635 { return cpl::down_cast<OGRLinearRing*>(this); }
636
641 inline const OGRLinearRing* toLinearRing() const
642 { return cpl::down_cast<const OGRLinearRing*>(this); }
643
648 inline OGRCircularString* toCircularString()
649 { return cpl::down_cast<OGRCircularString*>(this); }
650
655 inline const OGRCircularString* toCircularString() const
656 { return cpl::down_cast<const OGRCircularString*>(this); }
657
662 inline OGRCompoundCurve* toCompoundCurve()
663 { return cpl::down_cast<OGRCompoundCurve*>(this); }
664
669 inline const OGRCompoundCurve* toCompoundCurve() const
670 { return cpl::down_cast<const OGRCompoundCurve*>(this); }
671
676 inline OGRSurface* toSurface()
677 { return cpl::down_cast<OGRSurface*>(this); }
678
683 inline const OGRSurface* toSurface() const
684 { return cpl::down_cast<const OGRSurface*>(this); }
685
690 inline OGRPolygon* toPolygon()
691 { return cpl::down_cast<OGRPolygon*>(this); }
692
697 inline const OGRPolygon* toPolygon() const
698 { return cpl::down_cast<const OGRPolygon*>(this); }
699
704 inline OGRTriangle* toTriangle()
705 { return cpl::down_cast<OGRTriangle*>(this); }
706
711 inline const OGRTriangle* toTriangle() const
712 { return cpl::down_cast<const OGRTriangle*>(this); }
713
718 inline OGRCurvePolygon* toCurvePolygon()
719 { return cpl::down_cast<OGRCurvePolygon*>(this); }
720
725 inline const OGRCurvePolygon* toCurvePolygon() const
726 { return cpl::down_cast<const OGRCurvePolygon*>(this); }
727
732 inline OGRGeometryCollection* toGeometryCollection()
733 { return cpl::down_cast<OGRGeometryCollection*>(this); }
734
739 inline const OGRGeometryCollection* toGeometryCollection() const
740 { return cpl::down_cast<const OGRGeometryCollection*>(this); }
741
746 inline OGRMultiPoint* toMultiPoint()
747 { return cpl::down_cast<OGRMultiPoint*>(this); }
748
753 inline const OGRMultiPoint* toMultiPoint() const
754 { return cpl::down_cast<const OGRMultiPoint*>(this); }
755
760 inline OGRMultiLineString* toMultiLineString()
761 { return cpl::down_cast<OGRMultiLineString*>(this); }
762
767 inline const OGRMultiLineString* toMultiLineString() const
768 { return cpl::down_cast<const OGRMultiLineString*>(this); }
769
774 inline OGRMultiPolygon* toMultiPolygon()
775 { return cpl::down_cast<OGRMultiPolygon*>(this); }
776
781 inline const OGRMultiPolygon* toMultiPolygon() const
782 { return cpl::down_cast<const OGRMultiPolygon*>(this); }
783
788 inline OGRMultiCurve* toMultiCurve()
789 { return cpl::down_cast<OGRMultiCurve*>(this); }
790
795 inline const OGRMultiCurve* toMultiCurve() const
796 { return cpl::down_cast<const OGRMultiCurve*>(this); }
797
802 inline OGRMultiSurface* toMultiSurface()
803 { return cpl::down_cast<OGRMultiSurface*>(this); }
804
809 inline const OGRMultiSurface* toMultiSurface() const
810 { return cpl::down_cast<const OGRMultiSurface*>(this); }
811
816 inline OGRPolyhedralSurface* toPolyhedralSurface()
817 { return cpl::down_cast<OGRPolyhedralSurface*>(this); }
818
823 inline const OGRPolyhedralSurface* toPolyhedralSurface() const
824 { return cpl::down_cast<const OGRPolyhedralSurface*>(this); }
825
830 inline OGRTriangulatedSurface* toTriangulatedSurface()
831 { return cpl::down_cast<OGRTriangulatedSurface*>(this); }
832
837 inline const OGRTriangulatedSurface* toTriangulatedSurface() const
838 { return cpl::down_cast<const OGRTriangulatedSurface*>(this); }
839
840 };
841
843 struct CPL_DLL OGRGeometryUniquePtrDeleter
844 {
845 void operator()(OGRGeometry*) const;
846 };
848
852 typedef std::unique_ptr<OGRGeometry, OGRGeometryUniquePtrDeleter> OGRGeometryUniquePtr;
853
854
856 #define OGR_FORBID_DOWNCAST_TO(name) \
857 inline OGR ## name * to ## name() = delete; \
858 inline const OGR ## name * to ## name() const = delete;
859
860 #define OGR_FORBID_DOWNCAST_TO_POINT OGR_FORBID_DOWNCAST_TO(Point)
861 #define OGR_FORBID_DOWNCAST_TO_CURVE OGR_FORBID_DOWNCAST_TO(Curve)
862 #define OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE OGR_FORBID_DOWNCAST_TO(SimpleCurve)
863 #define OGR_FORBID_DOWNCAST_TO_LINESTRING OGR_FORBID_DOWNCAST_TO(LineString)
864 #define OGR_FORBID_DOWNCAST_TO_LINEARRING OGR_FORBID_DOWNCAST_TO(LinearRing)
865 #define OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING OGR_FORBID_DOWNCAST_TO(CircularString)
866 #define OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE OGR_FORBID_DOWNCAST_TO(CompoundCurve)
867 #define OGR_FORBID_DOWNCAST_TO_SURFACE OGR_FORBID_DOWNCAST_TO(Surface)
868 #define OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON OGR_FORBID_DOWNCAST_TO(CurvePolygon)
869 #define OGR_FORBID_DOWNCAST_TO_POLYGON OGR_FORBID_DOWNCAST_TO(Polygon)
870 #define OGR_FORBID_DOWNCAST_TO_TRIANGLE OGR_FORBID_DOWNCAST_TO(Triangle)
871 #define OGR_FORBID_DOWNCAST_TO_MULTIPOINT OGR_FORBID_DOWNCAST_TO(MultiPoint)
872 #define OGR_FORBID_DOWNCAST_TO_MULTICURVE OGR_FORBID_DOWNCAST_TO(MultiCurve)
873 #define OGR_FORBID_DOWNCAST_TO_MULTILINESTRING OGR_FORBID_DOWNCAST_TO(MultiLineString)
874 #define OGR_FORBID_DOWNCAST_TO_MULTISURFACE OGR_FORBID_DOWNCAST_TO(MultiSurface)
875 #define OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON OGR_FORBID_DOWNCAST_TO(MultiPolygon)
876 #define OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION OGR_FORBID_DOWNCAST_TO(GeometryCollection)
877 #define OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE OGR_FORBID_DOWNCAST_TO(PolyhedralSurface)
878 #define OGR_FORBID_DOWNCAST_TO_TIN OGR_FORBID_DOWNCAST_TO(TriangulatedSurface)
879
880 #define OGR_ALLOW_UPCAST_TO(name) \
881 inline OGR ## name * to ## name() { return this; } \
882 inline const OGR ## name * to ## name() const { return this; }
883
884 #ifndef SUPPRESS_OGR_ALLOW_CAST_TO_THIS_WARNING
885 #define CAST_TO_THIS_WARNING CPL_WARN_DEPRECATED("Casting to this is useless")
886 #else
887 #define CAST_TO_THIS_WARNING
888 #endif
889
890 #define OGR_ALLOW_CAST_TO_THIS(name) \
891 inline OGR ## name * to ## name() CAST_TO_THIS_WARNING { return this; } \
892 inline const OGR ## name * to ## name() const CAST_TO_THIS_WARNING { return this; }
893
894 #define OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
895 OGR_FORBID_DOWNCAST_TO_CURVE \
896 OGR_FORBID_DOWNCAST_TO_SIMPLE_CURVE \
897 OGR_FORBID_DOWNCAST_TO_LINESTRING \
898 OGR_FORBID_DOWNCAST_TO_LINEARRING \
899 OGR_FORBID_DOWNCAST_TO_CIRCULARSTRING \
900 OGR_FORBID_DOWNCAST_TO_COMPOUNDCURVE
901
902 #define OGR_FORBID_DOWNCAST_TO_ALL_SURFACES \
903 OGR_FORBID_DOWNCAST_TO_SURFACE \
904 OGR_FORBID_DOWNCAST_TO_CURVEPOLYGON \
905 OGR_FORBID_DOWNCAST_TO_POLYGON \
906 OGR_FORBID_DOWNCAST_TO_TRIANGLE \
907 OGR_FORBID_DOWNCAST_TO_POLYHEDRALSURFACE \
908 OGR_FORBID_DOWNCAST_TO_TIN
909
910 #define OGR_FORBID_DOWNCAST_TO_ALL_SINGLES \
911 OGR_FORBID_DOWNCAST_TO_POINT \
912 OGR_FORBID_DOWNCAST_TO_ALL_CURVES \
913 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
914
915 #define OGR_FORBID_DOWNCAST_TO_ALL_MULTI \
916 OGR_FORBID_DOWNCAST_TO_GEOMETRYCOLLECTION \
917 OGR_FORBID_DOWNCAST_TO_MULTIPOINT \
918 OGR_FORBID_DOWNCAST_TO_MULTICURVE \
919 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING \
920 OGR_FORBID_DOWNCAST_TO_MULTISURFACE \
921 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
922
924
925 /************************************************************************/
926 /* OGRPoint */
927 /************************************************************************/
928
935 class CPL_DLL OGRPoint : public OGRGeometry
936 {
937 double x;
938 double y;
939 double z;
940 double m;
941
942 public:
943 OGRPoint();
944 OGRPoint( double x, double y );
945 OGRPoint( double x, double y, double z );
946 OGRPoint( double x, double y, double z, double m );
947 OGRPoint( const OGRPoint& other );
948 static OGRPoint* createXYM( double x, double y, double m );
949 ~OGRPoint() override;
950
951 OGRPoint& operator=( const OGRPoint& other );
952
953 // IWks Interface
954 size_t WkbSize() const override;
955 OGRErr importFromWkb( const unsigned char *,
956 size_t,
957 OGRwkbVariant,
958 size_t& nBytesConsumedOut ) override;
959 OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
960 OGRwkbVariant=wkbVariantOldOgc )
961 const override;
962
963 #ifndef DOXYGEN_XML
964 using OGRGeometry::importFromWkt;
965 #endif
966
967 OGRErr importFromWkt( const char ** ) override;
968
969 #ifndef DOXYGEN_XML
970 using OGRGeometry::exportToWkt;
971 #endif
972
977 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
978 OGRErr *err = nullptr) const override;
979
980 // IGeometry
981 virtual int getDimension() const override;
982 virtual OGRPoint *clone() const override;
983 virtual void empty() override;
984 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
985 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
986 virtual OGRBoolean IsEmpty() const override
987 { return !(flags & OGR_G_NOT_EMPTY_POINT); }
988
989 // IPoint
991 double getX() const { return x; }
993 double getY() const { return y; }
995 double getZ() const { return z; }
997 double getM() const { return m; }
998
999 // Non standard
1000 virtual void setCoordinateDimension( int nDimension ) override;
1004 void setX( double xIn ) { x = xIn; if( std::isnan(x) || std::isnan(y) ) flags &= ~OGR_G_NOT_EMPTY_POINT; else flags |= OGR_G_NOT_EMPTY_POINT; }
1008 void setY( double yIn ) { y = yIn; if( std::isnan(x) || std::isnan(y) ) flags &= ~OGR_G_NOT_EMPTY_POINT; else flags |= OGR_G_NOT_EMPTY_POINT; }
1012 void setZ( double zIn )
1013 { z = zIn; flags |= OGR_G_3D; }
1017 void setM( double mIn )
1018 { m = mIn; flags |= OGR_G_MEASURED; }
1019
1020 // ISpatialRelation
1021 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1022 virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
1023 virtual OGRBoolean Within( const OGRGeometry * ) const override;
1024
1025 // Non standard from OGRGeometry
1026 virtual const char *getGeometryName() const override;
1027 virtual OGRwkbGeometryType getGeometryType() const override;
1028 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1029 virtual void flattenTo2D() override;
1030 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1031 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1032
1033 virtual void swapXY() override;
1034
1035 OGR_ALLOW_CAST_TO_THIS(Point)
1036 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
1037 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1038 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1039 };
1040
1041 /************************************************************************/
1042 /* OGRPointIterator */
1043 /************************************************************************/
1044
1051 class CPL_DLL OGRPointIterator
1052 {
1053 public:
1054 virtual ~OGRPointIterator();
1055 virtual OGRBoolean getNextPoint( OGRPoint* p ) = 0;
1056
1057 static void destroy( OGRPointIterator* );
1058 };
1059
1060 /************************************************************************/
1061 /* OGRCurve */
1062 /************************************************************************/
1063
1069 class CPL_DLL OGRCurve : public OGRGeometry
1070 {
1071 protected:
1073 OGRCurve();
1074 OGRCurve( const OGRCurve& other );
1075
1076 virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
1077 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
1078
1079 friend class OGRCurvePolygon;
1080 friend class OGRCompoundCurve;
1082 virtual int ContainsPoint( const OGRPoint* p ) const;
1083 virtual int IntersectsPoint( const OGRPoint* p ) const;
1084 virtual double get_AreaOfCurveSegments() const = 0;
1085
1086 private:
1087
1088 class CPL_DLL ConstIterator
1089 {
1090 struct Private;
1091 std::unique_ptr<Private> m_poPrivate;
1092 public:
1093 ConstIterator(const OGRCurve* poSelf, bool bStart);
1094 ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1095 ~ConstIterator();
1096 const OGRPoint& operator*() const;
1097 ConstIterator& operator++();
1098 bool operator!=(const ConstIterator& it) const;
1099 };
1100
1101 friend inline ConstIterator begin(const OGRCurve*);
1102 friend inline ConstIterator end(const OGRCurve*);
1103
1104 public:
1105 ~OGRCurve() override;
1106
1108 OGRCurve& operator=( const OGRCurve& other );
1110
1112 typedef OGRPoint ChildType;
1113
1122 ConstIterator begin() const;
1124 ConstIterator end() const;
1125
1126 // IGeometry
1127 virtual OGRCurve *clone() const override = 0;
1128
1129 // ICurve methods
1130 virtual double get_Length() const = 0;
1131 virtual void StartPoint( OGRPoint * ) const = 0;
1132 virtual void EndPoint( OGRPoint * ) const = 0;
1133 virtual int get_IsClosed() const;
1134 virtual void Value( double, OGRPoint * ) const = 0;
1135 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1136 const char* const* papszOptions = nullptr)
1137 const = 0;
1138 virtual int getDimension() const override;
1139
1140 // non standard
1141 virtual int getNumPoints() const = 0;
1142 virtual OGRPointIterator* getPointIterator() const = 0;
1143 virtual OGRBoolean IsConvex() const;
1144 virtual double get_Area() const = 0;
1145
1148 inline OGRSimpleCurve* toSimpleCurve()
1149 { return cpl::down_cast<OGRSimpleCurve*>(this); }
1150
1153 inline const OGRSimpleCurve* toSimpleCurve() const
1154 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
1155
1156 static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
1157 static OGRLineString* CastToLineString( OGRCurve* poCurve );
1158 static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
1159
1160 OGR_FORBID_DOWNCAST_TO_POINT
1161 OGR_ALLOW_CAST_TO_THIS(Curve)
1162 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
1163 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1164 };
1165
1167
1168 inline OGRCurve::ConstIterator begin(const OGRCurve* poCurve) { return poCurve->begin(); }
1170 inline OGRCurve::ConstIterator end(const OGRCurve* poCurve) { return poCurve->end(); }
1172
1173 /************************************************************************/
1174 /* OGRSimpleCurve */
1175 /************************************************************************/
1176
1186 class CPL_DLL OGRSimpleCurve: public OGRCurve
1187 {
1188 protected:
1190 friend class OGRGeometry;
1191
1192 int nPointCount;
1193 OGRRawPoint *paoPoints;
1194 double *padfZ;
1195 double *padfM;
1196
1197 void Make3D();
1198 void Make2D();
1199 void RemoveM();
1200 void AddM();
1201
1202 OGRErr importFromWKTListOnly( const char ** ppszInput, int bHasZ, int bHasM,
1203 OGRRawPoint*& paoPointsIn,
1204 int& nMaxPoints,
1205 double*& padfZIn );
1207
1208 virtual double get_LinearArea() const;
1209
1210 OGRSimpleCurve();
1211 OGRSimpleCurve( const OGRSimpleCurve& other );
1212
1213 private:
1214 class CPL_DLL Iterator
1215 {
1216 struct Private;
1217 std::unique_ptr<Private> m_poPrivate;
1218 void update();
1219 public:
1220 Iterator(OGRSimpleCurve* poSelf, int nPos);
1221 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1222 ~Iterator();
1223 OGRPoint& operator*();
1224 Iterator& operator++();
1225 bool operator!=(const Iterator& it) const;
1226 };
1227
1228 friend inline Iterator begin(OGRSimpleCurve*);
1229 friend inline Iterator end(OGRSimpleCurve*);
1230
1231 class CPL_DLL ConstIterator
1232 {
1233 struct Private;
1234 std::unique_ptr<Private> m_poPrivate;
1235 public:
1236 ConstIterator(const OGRSimpleCurve* poSelf, int nPos);
1237 ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1238 ~ConstIterator();
1239 const OGRPoint& operator*() const;
1240 ConstIterator& operator++();
1241 bool operator!=(const ConstIterator& it) const;
1242 };
1243
1244 friend inline ConstIterator begin(const OGRSimpleCurve*);
1245 friend inline ConstIterator end(const OGRSimpleCurve*);
1246
1247 public:
1248 ~OGRSimpleCurve() override;
1249
1250 OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
1251
1253 typedef OGRPoint ChildType;
1254
1263 Iterator begin();
1265 Iterator end();
1274 ConstIterator begin() const;
1276 ConstIterator end() const;
1277
1278 // IWks Interface.
1279 virtual size_t WkbSize() const override;
1280 virtual OGRErr importFromWkb( const unsigned char *,
1281 size_t,
1282 OGRwkbVariant,
1283 size_t& nBytesConsumedOut ) override;
1284 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1285 OGRwkbVariant=wkbVariantOldOgc )
1286 const override;
1287
1288 #ifndef DOXYGEN_XML
1289 using OGRGeometry::importFromWkt;
1290 #endif
1291
1292 OGRErr importFromWkt( const char ** ) override;
1293
1294 #ifndef DOXYGEN_XML
1295 using OGRGeometry::exportToWkt;
1296 #endif
1297
1302 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
1303 OGRErr *err = nullptr) const override;
1304
1305 // IGeometry interface.
1306 virtual void empty() override;
1307 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1308 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1309 virtual OGRBoolean IsEmpty() const override;
1310 virtual OGRSimpleCurve *clone() const override = 0;
1311
1312 // ICurve methods.
1313 virtual double get_Length() const override;
1314 virtual void StartPoint( OGRPoint * ) const override;
1315 virtual void EndPoint( OGRPoint * ) const override;
1316 virtual void Value( double, OGRPoint * ) const override;
1317 virtual double Project( const OGRPoint * ) const;
1318 virtual OGRLineString* getSubLine( double, double, int ) const;
1319
1320 // ILineString methods.
1321 virtual int getNumPoints() const override { return nPointCount; }
1322 void getPoint( int, OGRPoint * ) const;
1323 double getX( int i ) const { return paoPoints[i].x; }
1324 double getY( int i ) const { return paoPoints[i].y; }
1325 double getZ( int i ) const;
1326 double getM( int i ) const;
1327
1328 // ISpatialRelation
1329 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1330
1331 // non standard.
1332 virtual void setCoordinateDimension( int nDimension ) override;
1333 virtual void set3D( OGRBoolean bIs3D ) override;
1334 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1335 void setNumPoints( int nNewPointCount,
1336 int bZeroizeNewContent = TRUE );
1337 void setPoint( int, OGRPoint * );
1338 void setPoint( int, double, double );
1339 void setZ( int, double );
1340 void setM( int, double );
1341 void setPoint( int, double, double, double );
1342 void setPointM( int, double, double, double );
1343 void setPoint( int, double, double, double, double );
1344 void setPoints( int, const OGRRawPoint *, const double * = nullptr );
1345 void setPointsM( int, const OGRRawPoint *, const double * );
1346 void setPoints( int, const OGRRawPoint *, const double *, const double * );
1347 void setPoints( int, const double * padfX, const double * padfY,
1348 const double *padfZIn = nullptr );
1349 void setPointsM( int, const double * padfX, const double * padfY,
1350 const double *padfMIn = nullptr );
1351 void setPoints( int, const double * padfX, const double * padfY,
1352 const double *padfZIn, const double *padfMIn );
1353 void addPoint( const OGRPoint * );
1354 void addPoint( double, double );
1355 void addPoint( double, double, double );
1356 void addPointM( double, double, double );
1357 void addPoint( double, double, double, double );
1358
1359 bool removePoint( int );
1360
1361 void getPoints( OGRRawPoint *, double * = nullptr ) const;
1362 void getPoints( void* pabyX, int nXStride,
1363 void* pabyY, int nYStride,
1364 void* pabyZ = nullptr, int nZStride = 0,
1365 void* pabyM = nullptr, int nMStride = 0 ) const;
1366
1367 void addSubLineString( const OGRLineString *,
1368 int nStartVertex = 0, int nEndVertex = -1 );
1369 void reversePoints( void );
1370 virtual OGRPointIterator* getPointIterator() const override;
1371
1372 // non-standard from OGRGeometry
1373 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1374 virtual void flattenTo2D() override;
1375 virtual void segmentize(double dfMaxLength) override;
1376
1377 virtual void swapXY() override;
1378
1379 OGR_ALLOW_UPCAST_TO(Curve)
1380 OGR_ALLOW_CAST_TO_THIS(SimpleCurve)
1381 };
1382
1384
1385 inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1387 inline OGRSimpleCurve::Iterator end(OGRSimpleCurve* poCurve) { return poCurve->end(); }
1388
1390 inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1392 inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve* poCurve) { return poCurve->end(); }
1394
1395 /************************************************************************/
1396 /* OGRLineString */
1397 /************************************************************************/
1398
1406 class CPL_DLL OGRLineString : public OGRSimpleCurve
1407 {
1408 // cppcheck-suppress unusedPrivateFunction
1409 static OGRLinearRing* CasterToLinearRing(OGRCurve* poCurve);
1410
1411 protected:
1413 static OGRLineString* TransferMembersAndDestroy(
1414 OGRLineString* poSrc,
1415 OGRLineString* poDst);
1416
1417 virtual OGRCurveCasterToLineString GetCasterToLineString()
1418 const override;
1419 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1420 const override;
1421
1422 virtual double get_AreaOfCurveSegments() const override;
1424
1425 static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
1426
1427 public:
1428 OGRLineString();
1429 OGRLineString( const OGRLineString& other );
1430 ~OGRLineString() override;
1431
1432 OGRLineString& operator=(const OGRLineString& other);
1433
1434 virtual OGRLineString *clone() const override;
1435 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1436 const char* const* papszOptions = nullptr )
1437 const override;
1438 virtual OGRGeometry* getCurveGeometry(
1439 const char* const* papszOptions = nullptr ) const override;
1440 virtual double get_Area() const override;
1441
1442 // Non-standard from OGRGeometry.
1443 virtual OGRwkbGeometryType getGeometryType() const override;
1444 virtual const char *getGeometryName() const override;
1445
1447 inline OGRSimpleCurve* toUpperClass() { return this; }
1449 inline const OGRSimpleCurve* toUpperClass() const { return this; }
1450
1451 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1452 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1453
1454 OGR_ALLOW_UPCAST_TO(SimpleCurve)
1455 OGR_ALLOW_CAST_TO_THIS(LineString)
1456 };
1457
1458 /************************************************************************/
1459 /* OGRLinearRing */
1460 /************************************************************************/
1461
1482 class CPL_DLL OGRLinearRing : public OGRLineString
1483 {
1484 static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1485
1486 // IWks Interface - Note this isn't really a first class object
1487 // for the purposes of WKB form. These methods always fail since this
1488 // object can't be serialized on its own.
1489 virtual size_t WkbSize() const override;
1490 virtual OGRErr importFromWkb( const unsigned char *,
1491 size_t,
1492 OGRwkbVariant,
1493 size_t& nBytesConsumedOut ) override;
1494 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1495 OGRwkbVariant=wkbVariantOldOgc )
1496 const override;
1497
1498 protected:
1500 friend class OGRPolygon;
1501 friend class OGRTriangle;
1502
1503 // These are not IWks compatible ... just a convenience for OGRPolygon.
1504 virtual size_t _WkbSize( int _flags ) const;
1505 virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
1506 const unsigned char *, size_t,
1507 size_t& nBytesConsumedOut );
1508 virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
1509 unsigned char * ) const;
1510
1511 virtual OGRCurveCasterToLineString GetCasterToLineString()
1512 const override;
1513 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1514 const override;
1516
1517 static OGRLineString* CastToLineString( OGRLinearRing* poLR );
1518
1519 public:
1520 OGRLinearRing();
1521 OGRLinearRing( const OGRLinearRing& other );
1522 explicit OGRLinearRing( OGRLinearRing * );
1523 ~OGRLinearRing() override;
1524
1525 OGRLinearRing& operator=( const OGRLinearRing& other );
1526
1527 // Non standard.
1528 virtual const char *getGeometryName() const override;
1529 virtual OGRLinearRing *clone() const override;
1530 virtual int isClockwise() const;
1531 virtual void reverseWindingOrder();
1532 virtual void closeRings() override;
1533 OGRBoolean isPointInRing( const OGRPoint* pt,
1534 int bTestEnvelope = TRUE ) const;
1535 OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
1536 int bTestEnvelope = TRUE ) const;
1537 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1538
1540 inline OGRLineString* toUpperClass() { return this; }
1542 inline const OGRLineString* toUpperClass() const { return this; }
1543
1544 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1545 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1546
1547 OGR_ALLOW_UPCAST_TO(LineString)
1548 OGR_ALLOW_CAST_TO_THIS(LinearRing)
1549 };
1550
1551 /************************************************************************/
1552 /* OGRCircularString */
1553 /************************************************************************/
1554
1567 class CPL_DLL OGRCircularString : public OGRSimpleCurve
1568 {
1569 private:
1570 void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
1571 OGRBoolean IsValidFast() const;
1572 int IsFullCircle( double& cx, double& cy, double& square_R ) const;
1573
1574 protected:
1576 virtual OGRCurveCasterToLineString GetCasterToLineString()
1577 const override;
1578 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1579 const override;
1580 virtual int IntersectsPoint( const OGRPoint* p ) const override;
1581 virtual int ContainsPoint( const OGRPoint* p ) const override;
1582 virtual double get_AreaOfCurveSegments() const override;
1584
1585 public:
1586 OGRCircularString();
1587 OGRCircularString( const OGRCircularString& other );
1588 ~OGRCircularString() override;
1589
1590 OGRCircularString& operator=(const OGRCircularString& other);
1591
1592 // IWks Interface.
1593 virtual OGRErr importFromWkb( const unsigned char *,
1594 size_t,
1595 OGRwkbVariant,
1596 size_t& nBytesConsumedOut ) override;
1597 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1598 OGRwkbVariant=wkbVariantOldOgc )
1599 const override;
1600
1601 #ifndef DOXYGEN_XML
1602 using OGRGeometry::importFromWkt;
1603 #endif
1604
1605 OGRErr importFromWkt( const char ** ) override;
1606
1607 #ifndef DOXYGEN_XML
1608 using OGRGeometry::exportToWkt;
1609 #endif
1610
1615 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
1616 OGRErr *err = nullptr) const override;
1617
1618 // IGeometry interface.
1619 virtual OGRBoolean IsValid() const override;
1620 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1621 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1622 virtual OGRCircularString *clone() const override;
1623
1624 // ICurve methods.
1625 virtual double get_Length() const override;
1626 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1627 const char* const* papszOptions = nullptr )
1628 const override;
1629 virtual void Value( double, OGRPoint * ) const override;
1630 virtual double get_Area() const override;
1631
1632 // Non-standard from OGRGeometry.
1633 virtual OGRwkbGeometryType getGeometryType() const override;
1634 virtual const char *getGeometryName() const override;
1635 virtual void segmentize( double dfMaxLength ) override;
1636 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1637 const override;
1638 virtual OGRGeometry* getLinearGeometry(
1639 double dfMaxAngleStepSizeDegrees = 0,
1640 const char* const* papszOptions = nullptr) const override;
1641
1643 inline OGRSimpleCurve* toUpperClass() { return this; }
1645 inline const OGRSimpleCurve* toUpperClass() const { return this; }
1646
1647 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1648 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1649
1650 OGR_ALLOW_UPCAST_TO(SimpleCurve)
1651 OGR_ALLOW_CAST_TO_THIS(CircularString)
1652 };
1653
1654 /************************************************************************/
1655 /* OGRCurveCollection */
1656 /************************************************************************/
1657
1669 class CPL_DLL OGRCurveCollection
1670 {
1671 protected:
1672 friend class OGRCompoundCurve;
1673 friend class OGRCurvePolygon;
1674 friend class OGRPolygon;
1675 friend class OGRTriangle;
1676
1677 int nCurveCount = 0;
1678 OGRCurve **papoCurves = nullptr;
1679
1680 public:
1681 OGRCurveCollection();
1682 OGRCurveCollection(const OGRCurveCollection& other);
1683 ~OGRCurveCollection();
1684
1685 OGRCurveCollection& operator=(const OGRCurveCollection& other);
1686
1688 typedef OGRCurve ChildType;
1689
1693 OGRCurve** begin() { return papoCurves; }
1695 OGRCurve** end() { return papoCurves + nCurveCount; }
1699 const OGRCurve* const* begin() const { return papoCurves; }
1701 const OGRCurve* const* end() const { return papoCurves + nCurveCount; }
1702
1703 void empty(OGRGeometry* poGeom);
1704 OGRBoolean IsEmpty() const;
1705 void getEnvelope( OGREnvelope * psEnvelope ) const;
1706 void getEnvelope( OGREnvelope3D * psEnvelope ) const;
1707
1708 OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
1709 int bNeedRealloc );
1710 size_t WkbSize() const;
1711 OGRErr importPreambleFromWkb( OGRGeometry* poGeom,
1712 const unsigned char * pabyData,
1713 size_t& nSize,
1714 size_t& nDataOffset,
1715 OGRwkbByteOrder& eByteOrder,
1716 size_t nMinSubGeomSize,
1717 OGRwkbVariant eWkbVariant );
1718 OGRErr importBodyFromWkb(
1719 OGRGeometry* poGeom,
1720 const unsigned char * pabyData,
1721 size_t nSize,
1722 bool bAcceptCompoundCurve,
1723 OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
1724 OGRCurve* poCurve ),
1725 OGRwkbVariant eWkbVariant,
1726 size_t& nBytesConsumedOut );
1727 std::string exportToWkt(const OGRGeometry *geom, const OGRWktOptions& opts,
1728 OGRErr *err) const;
1729 OGRErr exportToWkb( const OGRGeometry* poGeom, OGRwkbByteOrder,
1730 unsigned char *,
1731 OGRwkbVariant eWkbVariant ) const;
1732 OGRBoolean Equals(const OGRCurveCollection *poOCC) const;
1733 void setCoordinateDimension( OGRGeometry* poGeom,
1734 int nNewDimension );
1735 void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
1736 void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
1737 void assignSpatialReference( OGRGeometry* poGeom, OGRSpatialReference * poSR );
1738 int getNumCurves() const;
1739 OGRCurve *getCurve( int );
1740 const OGRCurve *getCurve( int ) const;
1741 OGRCurve *stealCurve( int );
1742
1743 OGRErr removeCurve( int iIndex, bool bDelete = true );
1744
1745 OGRErr transform( OGRGeometry* poGeom,
1746 OGRCoordinateTransformation *poCT );
1747 void flattenTo2D( OGRGeometry* poGeom );
1748 void segmentize( double dfMaxLength );
1749 void swapXY();
1750 OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
1751 };
1753
1754 /************************************************************************/
1755 /* OGRCompoundCurve */
1756 /************************************************************************/
1757
1768 class CPL_DLL OGRCompoundCurve : public OGRCurve
1769 {
1770 private:
1771 OGRCurveCollection oCC{};
1772
1773 OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
1774 double dfToleranceEps,
1775 int bNeedRealloc );
1776 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1777 OGRCurve* poCurve );
1778 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1779 OGRCurve* poCurve );
1780 OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
1781 const char* const* papszOptions,
1782 int bIsLinearRing ) const;
1783 // cppcheck-suppress unusedPrivateFunction
1784 static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1785 // cppcheck-suppress unusedPrivateFunction
1786 static OGRLinearRing* CasterToLinearRing( OGRCurve* poCurve );
1787
1788 protected:
1790 static OGRLineString* CastToLineString( OGRCompoundCurve* poCC );
1791 static OGRLinearRing* CastToLinearRing( OGRCompoundCurve* poCC );
1792
1793 virtual OGRCurveCasterToLineString GetCasterToLineString()
1794 const override;
1795 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1796 const override;
1798
1799 public:
1800 OGRCompoundCurve();
1801 OGRCompoundCurve( const OGRCompoundCurve& other );
1802 ~OGRCompoundCurve() override;
1803
1804 OGRCompoundCurve& operator=( const OGRCompoundCurve& other );
1805
1807 typedef OGRCurve ChildType;
1808
1812 ChildType** begin() { return oCC.begin(); }
1814 ChildType** end() { return oCC.end(); }
1818 const ChildType* const * begin() const { return oCC.begin(); }
1820 const ChildType* const * end() const { return oCC.end(); }
1821
1822 // IWks Interface
1823 virtual size_t WkbSize() const override;
1824 virtual OGRErr importFromWkb( const unsigned char *,
1825 size_t,
1826 OGRwkbVariant,
1827 size_t& nBytesConsumedOut ) override;
1828 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1829 OGRwkbVariant=wkbVariantOldOgc )
1830 const override;
1831
1832 #ifndef DOXYGEN_XML
1833 using OGRGeometry::importFromWkt;
1834 #endif
1835
1836 OGRErr importFromWkt( const char ** ) override;
1837
1838 #ifndef DOXYGEN_XML
1839 using OGRGeometry::exportToWkt;
1840 #endif
1841
1846 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
1847 OGRErr *err = nullptr) const override;
1848
1849 // IGeometry interface.
1850 virtual OGRCompoundCurve *clone() const override;
1851 virtual void empty() override;
1852 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1853 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1854 virtual OGRBoolean IsEmpty() const override;
1855
1856 // ICurve methods.
1857 virtual double get_Length() const override;
1858 virtual void StartPoint( OGRPoint * ) const override;
1859 virtual void EndPoint( OGRPoint * ) const override;
1860 virtual void Value( double, OGRPoint * ) const override;
1861 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1862 const char* const* papszOptions = nullptr )
1863 const override;
1864
1865 virtual int getNumPoints() const override;
1866 virtual double get_AreaOfCurveSegments() const override;
1867 virtual double get_Area() const override;
1868
1869 // ISpatialRelation.
1870 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1871
1872 // ICompoundCurve method.
1873 int getNumCurves() const;
1874 OGRCurve *getCurve( int );
1875 const OGRCurve *getCurve( int ) const;
1876
1877 // Non-standard.
1878 virtual void setCoordinateDimension( int nDimension ) override;
1879 virtual void set3D( OGRBoolean bIs3D ) override;
1880 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1881
1882 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1883
1884 OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
1885 OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
1886 OGRCurve *stealCurve( int );
1887 virtual OGRPointIterator* getPointIterator() const override;
1888
1889 // Non-standard from OGRGeometry.
1890 virtual OGRwkbGeometryType getGeometryType() const override;
1891 virtual const char *getGeometryName() const override;
1892 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1893 virtual void flattenTo2D() override;
1894 virtual void segmentize(double dfMaxLength) override;
1895 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
1896 const override;
1897 virtual OGRGeometry* getLinearGeometry(
1898 double dfMaxAngleStepSizeDegrees = 0,
1899 const char* const* papszOptions = nullptr) const override;
1900 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1901 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1902
1903 virtual void swapXY() override;
1904
1905 OGR_ALLOW_UPCAST_TO(Curve)
1906 OGR_ALLOW_CAST_TO_THIS(CompoundCurve)
1907 };
1908
1910
1911 inline const OGRCompoundCurve::ChildType* const * begin(const OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1913 inline const OGRCompoundCurve::ChildType* const * end(const OGRCompoundCurve* poCurve) { return poCurve->end(); }
1914
1916 inline OGRCompoundCurve::ChildType** begin(OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1918 inline OGRCompoundCurve::ChildType** end(OGRCompoundCurve* poCurve) { return poCurve->end(); }
1920
1921 /************************************************************************/
1922 /* OGRSurface */
1923 /************************************************************************/
1924
1930 class CPL_DLL OGRSurface : public OGRGeometry
1931 {
1932 protected:
1934 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1935 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1937
1938 public:
1939 virtual double get_Area() const = 0;
1940 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const
1941 { return PointOnSurfaceInternal(poPoint); }
1942 virtual OGRSurface *clone() const override = 0;
1943
1945 static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1946 static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1948
1949 OGR_FORBID_DOWNCAST_TO_POINT
1950 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
1951 OGR_ALLOW_CAST_TO_THIS(Surface)
1952 OGR_FORBID_DOWNCAST_TO_ALL_MULTI
1953 };
1954
1955 /************************************************************************/
1956 /* OGRCurvePolygon */
1957 /************************************************************************/
1958
1972 class CPL_DLL OGRCurvePolygon : public OGRSurface
1973 {
1974 static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1975
1976 private:
1977 OGRBoolean IntersectsPoint( const OGRPoint* p ) const;
1978 OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1979 virtual int checkRing( OGRCurve * poNewRing ) const;
1980 OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1981 int bNeedRealloc );
1982 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1983 OGRCurve* poCurve );
1984 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1985 OGRCurve* poCurve );
1986
1987 protected:
1989 friend class OGRPolygon;
1990 friend class OGRTriangle;
1991 OGRCurveCollection oCC{};
1992
1993 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1994 const override;
1995 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1996 const override;
1997
1999
2000 static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
2001
2002 public:
2003 OGRCurvePolygon();
2004 OGRCurvePolygon( const OGRCurvePolygon& );
2005 ~OGRCurvePolygon() override;
2006
2007 OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
2008
2010 typedef OGRCurve ChildType;
2011
2015 ChildType** begin() { return oCC.begin(); }
2017 ChildType** end() { return oCC.end(); }
2021 const ChildType* const * begin() const { return oCC.begin(); }
2023 const ChildType* const * end() const { return oCC.end(); }
2024
2025 // Non standard (OGRGeometry).
2026 virtual const char *getGeometryName() const override;
2027 virtual OGRwkbGeometryType getGeometryType() const override;
2028 virtual OGRCurvePolygon *clone() const override;
2029 virtual void empty() override;
2030 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
2031 virtual void flattenTo2D() override;
2032 virtual OGRBoolean IsEmpty() const override;
2033 virtual void segmentize( double dfMaxLength ) override;
2034 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2035 const override;
2036 virtual OGRGeometry* getLinearGeometry(
2037 double dfMaxAngleStepSizeDegrees = 0,
2038 const char* const* papszOptions = nullptr ) const override;
2039
2040 // ISurface Interface
2041 virtual double get_Area() const override;
2042
2043 // IWks Interface
2044 virtual size_t WkbSize() const override;
2045 virtual OGRErr importFromWkb( const unsigned char *,
2046 size_t,
2047 OGRwkbVariant,
2048 size_t& nBytesConsumedOut ) override;
2049 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2050 OGRwkbVariant=wkbVariantOldOgc )
2051 const override;
2052
2053 #ifndef DOXYGEN_XML
2054 using OGRGeometry::importFromWkt;
2055 #endif
2056
2057 OGRErr importFromWkt( const char ** ) override;
2058
2059 #ifndef DOXYGEN_XML
2060 using OGRGeometry::exportToWkt;
2061 #endif
2062
2067 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2068 OGRErr *err = nullptr) const override;
2069
2070 // IGeometry
2071 virtual int getDimension() const override;
2072 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2073 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2074
2075 // ICurvePolygon
2076 virtual OGRPolygon* CurvePolyToPoly(
2077 double dfMaxAngleStepSizeDegrees = 0,
2078 const char* const* papszOptions = nullptr ) const;
2079
2080 // ISpatialRelation
2081 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
2082 virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
2083 virtual OGRBoolean Contains( const OGRGeometry * ) const override;
2084
2085 // Non standard
2086 virtual void setCoordinateDimension( int nDimension ) override;
2087 virtual void set3D( OGRBoolean bIs3D ) override;
2088 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2089
2090 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2091
2092 virtual OGRErr addRing( OGRCurve * );
2093 virtual OGRErr addRingDirectly( OGRCurve * );
2094
2095 OGRCurve *getExteriorRingCurve();
2096 const OGRCurve *getExteriorRingCurve() const;
2097 int getNumInteriorRings() const;
2098 OGRCurve *getInteriorRingCurve( int );
2099 const OGRCurve *getInteriorRingCurve( int ) const;
2100
2101 OGRCurve *stealExteriorRingCurve();
2102
2103 OGRErr removeRing( int iIndex, bool bDelete = true );
2104 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2105 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2106
2107 virtual void swapXY() override;
2108
2109 OGR_ALLOW_UPCAST_TO(Surface)
2110 OGR_ALLOW_CAST_TO_THIS(CurvePolygon)
2111 };
2112
2114
2115 inline const OGRCurvePolygon::ChildType* const * begin(const OGRCurvePolygon* poGeom) { return poGeom->begin(); }
2117 inline const OGRCurvePolygon::ChildType* const * end(const OGRCurvePolygon* poGeom) { return poGeom->end(); }
2118
2120 inline OGRCurvePolygon::ChildType** begin(OGRCurvePolygon* poGeom) { return poGeom->begin(); }
2122 inline OGRCurvePolygon::ChildType** end(OGRCurvePolygon* poGeom) { return poGeom->end(); }
2124
2125 /************************************************************************/
2126 /* OGRPolygon */
2127 /************************************************************************/
2128
2138 class CPL_DLL OGRPolygon : public OGRCurvePolygon
2139 {
2140 static OGRCurvePolygon* CasterToCurvePolygon(OGRSurface* poSurface);
2141
2142 protected:
2144 friend class OGRMultiSurface;
2145 friend class OGRPolyhedralSurface;
2146 friend class OGRTriangulatedSurface;
2147
2148 virtual int checkRing( OGRCurve * poNewRing ) const override;
2149 virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
2150 int bHasZ, int bHasM,
2151 OGRRawPoint*& paoPoints,
2152 int& nMaxPoints,
2153 double*& padfZ );
2154
2155 static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
2156
2157 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
2158 const override;
2159 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
2160 const override;
2162
2163 public:
2164 OGRPolygon();
2165 OGRPolygon(const OGRPolygon& other);
2166 ~OGRPolygon() override;
2167
2168 OGRPolygon& operator=(const OGRPolygon& other);
2169
2171 typedef OGRLinearRing ChildType;
2172
2176 ChildType** begin() { return reinterpret_cast<ChildType**>(oCC.begin()); }
2178 ChildType** end() { return reinterpret_cast<ChildType**>(oCC.end()); }
2182 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oCC.begin()); }
2184 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oCC.end()); }
2185
2186 // Non-standard (OGRGeometry).
2187 virtual const char *getGeometryName() const override;
2188 virtual OGRwkbGeometryType getGeometryType() const override;
2189 virtual OGRPolygon *clone() const override;
2190 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2191 const override;
2192 virtual OGRGeometry* getCurveGeometry(
2193 const char* const* papszOptions = nullptr ) const override;
2194 virtual OGRGeometry* getLinearGeometry(
2195 double dfMaxAngleStepSizeDegrees = 0,
2196 const char* const* papszOptions = nullptr) const override;
2197
2198 // IWks Interface.
2199 virtual size_t WkbSize() const override;
2200 virtual OGRErr importFromWkb( const unsigned char *,
2201 size_t,
2202 OGRwkbVariant,
2203 size_t& nBytesConsumedOut ) override;
2204 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2205 OGRwkbVariant=wkbVariantOldOgc )
2206 const override;
2207
2208 #ifndef DOXYGEN_XML
2209 using OGRGeometry::importFromWkt;
2210 #endif
2211
2212 OGRErr importFromWkt( const char ** ) override;
2213
2214 #ifndef DOXYGEN_XML
2215 using OGRGeometry::exportToWkt;
2216 #endif
2217
2222 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2223 OGRErr *err = nullptr) const override;
2224
2225 // ICurvePolygon.
2226 virtual OGRPolygon* CurvePolyToPoly(
2227 double dfMaxAngleStepSizeDegrees = 0,
2228 const char* const* papszOptions = nullptr ) const override;
2229
2230 OGRLinearRing *getExteriorRing();
2231 const OGRLinearRing *getExteriorRing() const;
2232 virtual OGRLinearRing *getInteriorRing( int );
2233 virtual const OGRLinearRing *getInteriorRing( int ) const;
2234
2235 OGRLinearRing *stealExteriorRing();
2236 virtual OGRLinearRing *stealInteriorRing(int);
2237
2238 OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
2239
2241 inline OGRCurvePolygon* toUpperClass() { return this; }
2243 inline const OGRCurvePolygon* toUpperClass() const { return this; }
2244
2245 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2246 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2247
2248 virtual void closeRings() override;
2249
2250 OGR_ALLOW_UPCAST_TO(CurvePolygon)
2251 OGR_ALLOW_CAST_TO_THIS(Polygon)
2252 };
2253
2255
2256 inline const OGRPolygon::ChildType* const * begin(const OGRPolygon* poGeom) { return poGeom->begin(); }
2258 inline const OGRPolygon::ChildType* const * end(const OGRPolygon* poGeom) { return poGeom->end(); }
2259
2261 inline OGRPolygon::ChildType** begin(OGRPolygon* poGeom) { return poGeom->begin(); }
2263 inline OGRPolygon::ChildType** end(OGRPolygon* poGeom) { return poGeom->end(); }
2265
2266 /************************************************************************/
2267 /* OGRTriangle */
2268 /************************************************************************/
2269
2276 class CPL_DLL OGRTriangle : public OGRPolygon
2277 {
2278 private:
2279 // cppcheck-suppress unusedPrivateFunction
2280 static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
2281 bool quickValidityCheck() const;
2282
2283 protected:
2285 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2286 virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
2287 int bHasZ, int bHasM,
2288 OGRRawPoint*& paoPoints,
2289 int& nMaxPoints,
2290 double*& padfZ ) override;
2292
2293 public:
2294 OGRTriangle();
2295 OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
2296 OGRTriangle( const OGRTriangle &other );
2297 OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
2298 OGRTriangle& operator=( const OGRTriangle& other );
2299 ~OGRTriangle() override;
2300 virtual const char *getGeometryName() const override;
2301 virtual OGRwkbGeometryType getGeometryType() const override;
2302 virtual OGRTriangle *clone() const override;
2303
2304 // IWks Interface.
2305 virtual OGRErr importFromWkb( const unsigned char *,
2306 size_t,
2307 OGRwkbVariant,
2308 size_t& nBytesConsumedOut ) override;
2309
2310 // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
2311 virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) override;
2312
2314 inline OGRPolygon* toUpperClass() { return this; }
2316 inline const OGRPolygon* toUpperClass() const { return this; }
2317
2318 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2319 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2320
2322 static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
2324
2325 OGR_ALLOW_UPCAST_TO(Polygon)
2326 OGR_ALLOW_CAST_TO_THIS(Triangle)
2327 };
2328
2329 /************************************************************************/
2330 /* OGRGeometryCollection */
2331 /************************************************************************/
2332
2340 class CPL_DLL OGRGeometryCollection : public OGRGeometry
2341 {
2342 OGRErr importFromWkbInternal( const unsigned char * pabyData,
2343 size_t nSize,
2344 int nRecLevel,
2345 OGRwkbVariant, size_t& nBytesConsumedOut );
2346 OGRErr importFromWktInternal( const char **ppszInput, int nRecLevel );
2347
2348 protected:
2350 int nGeomCount = 0;
2351 OGRGeometry **papoGeoms = nullptr;
2352
2353 std::string exportToWktInternal(const OGRWktOptions& opts, OGRErr *err,
2354 std::string exclude = std::string()) const;
2355 static OGRGeometryCollection* TransferMembersAndDestroy(
2356 OGRGeometryCollection* poSrc,
2357 OGRGeometryCollection* poDst );
2359 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2360
2361 public:
2362 OGRGeometryCollection();
2363 OGRGeometryCollection( const OGRGeometryCollection& other );
2364 ~OGRGeometryCollection() override;
2365
2366 OGRGeometryCollection& operator=( const OGRGeometryCollection& other );
2367
2369 typedef OGRGeometry ChildType;
2370
2374 ChildType** begin() { return papoGeoms; }
2376 ChildType** end() { return papoGeoms + nGeomCount; }
2380 const ChildType* const* begin() const { return papoGeoms; }
2382 const ChildType* const* end() const { return papoGeoms + nGeomCount; }
2383
2384 // Non standard (OGRGeometry).
2385 virtual const char *getGeometryName() const override;
2386 virtual OGRwkbGeometryType getGeometryType() const override;
2387 virtual OGRGeometryCollection *clone() const override;
2388 virtual void empty() override;
2389 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
2390 virtual void flattenTo2D() override;
2391 virtual OGRBoolean IsEmpty() const override;
2392 virtual void segmentize(double dfMaxLength) override;
2393 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2394 const override;
2395 virtual OGRGeometry* getCurveGeometry(
2396 const char* const* papszOptions = nullptr ) const override;
2397 virtual OGRGeometry* getLinearGeometry(
2398 double dfMaxAngleStepSizeDegrees = 0,
2399 const char* const* papszOptions = nullptr ) const override;
2400
2401 // IWks Interface
2402 virtual size_t WkbSize() const override;
2403 virtual OGRErr importFromWkb( const unsigned char *,
2404 size_t,
2405 OGRwkbVariant,
2406 size_t& nBytesConsumedOut ) override;
2407 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2408 OGRwkbVariant=wkbVariantOldOgc )
2409 const override;
2410
2411 #ifndef DOXYGEN_XML
2412 using OGRGeometry::importFromWkt;
2413 #endif
2414
2415 OGRErr importFromWkt( const char ** ) override;
2416
2417 #ifndef DOXYGEN_XML
2418 using OGRGeometry::exportToWkt;
2419 #endif
2420
2425 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2426 OGRErr *err = nullptr) const override;
2427
2428 virtual double get_Length() const;
2429 virtual double get_Area() const;
2430
2431 // IGeometry methods
2432 virtual int getDimension() const override;
2433 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2434 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2435
2436 // IGeometryCollection
2437 int getNumGeometries() const;
2438 OGRGeometry *getGeometryRef( int );
2439 const OGRGeometry *getGeometryRef( int ) const;
2440
2441 // ISpatialRelation
2442 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
2443
2444 // Non standard
2445 virtual void setCoordinateDimension( int nDimension ) override;
2446 virtual void set3D( OGRBoolean bIs3D ) override;
2447 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2448 virtual OGRErr addGeometry( const OGRGeometry * );
2449 virtual OGRErr addGeometryDirectly( OGRGeometry * );
2450 virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2451
2452 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2453
2454 void closeRings() override;
2455
2456 virtual void swapXY() override;
2457
2458 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2459 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2460
2461 static OGRGeometryCollection* CastToGeometryCollection(
2462 OGRGeometryCollection* poSrc );
2463
2464 OGR_FORBID_DOWNCAST_TO_POINT
2465 OGR_FORBID_DOWNCAST_TO_ALL_CURVES
2466 OGR_FORBID_DOWNCAST_TO_ALL_SURFACES
2467 OGR_ALLOW_CAST_TO_THIS(GeometryCollection)
2468 };
2469
2471
2472 inline const OGRGeometryCollection::ChildType* const * begin(const OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2474 inline const OGRGeometryCollection::ChildType* const * end(const OGRGeometryCollection* poGeom) { return poGeom->end(); }
2475
2477 inline OGRGeometryCollection::ChildType** begin(OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2479 inline OGRGeometryCollection::ChildType** end(OGRGeometryCollection* poGeom) { return poGeom->end(); }
2481
2482 /************************************************************************/
2483 /* OGRMultiSurface */
2484 /************************************************************************/
2485
2492 class CPL_DLL OGRMultiSurface : public OGRGeometryCollection
2493 {
2494 protected:
2495 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2496 const override;
2497
2498 public:
2499 OGRMultiSurface();
2500 OGRMultiSurface( const OGRMultiSurface& other );
2501 ~OGRMultiSurface() override;
2502
2503 OGRMultiSurface& operator=( const OGRMultiSurface& other );
2504
2506 typedef OGRSurface ChildType;
2507
2511 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2513 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2517 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2519 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2520
2521 // Non standard (OGRGeometry).
2522 virtual const char *getGeometryName() const override;
2523 virtual OGRwkbGeometryType getGeometryType() const override;
2524 virtual OGRMultiSurface *clone() const override;
2525
2526 #ifndef DOXYGEN_XML
2527 using OGRGeometry::importFromWkt;
2528 #endif
2529
2530 OGRErr importFromWkt( const char ** ) override;
2531
2532 #ifndef DOXYGEN_XML
2533 using OGRGeometry::exportToWkt;
2534 #endif
2535
2540 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2541 OGRErr *err = nullptr) const override;
2542
2543 // IMultiSurface methods
2544 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
2545
2546 // IGeometry methods
2547 virtual int getDimension() const override;
2548
2549 // IGeometryCollection
2551 OGRSurface *getGeometryRef( int i) { return OGRGeometryCollection::getGeometryRef(i)->toSurface(); }
2553 const OGRSurface *getGeometryRef( int i ) const { return OGRGeometryCollection::getGeometryRef(i)->toSurface(); }
2554
2555 // Non standard
2556 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2557 const override;
2558
2560 inline OGRGeometryCollection* toUpperClass() { return this; }
2562 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2563
2564 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2565 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2566
2567 static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
2568
2569 OGR_ALLOW_CAST_TO_THIS(MultiSurface)
2570 OGR_ALLOW_UPCAST_TO(GeometryCollection)
2571 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
2572 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
2573 OGR_FORBID_DOWNCAST_TO_MULTICURVE
2574 };
2575
2577
2578 inline const OGRMultiSurface::ChildType* const * begin(const OGRMultiSurface* poGeom) { return poGeom->begin(); }
2580 inline const OGRMultiSurface::ChildType* const * end(const OGRMultiSurface* poGeom) { return poGeom->end(); }
2581
2583 inline OGRMultiSurface::ChildType** begin(OGRMultiSurface* poGeom) { return poGeom->begin(); }
2585 inline OGRMultiSurface::ChildType** end(OGRMultiSurface* poGeom) { return poGeom->end(); }
2587
2588 /************************************************************************/
2589 /* OGRMultiPolygon */
2590 /************************************************************************/
2591
2596 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
2597 {
2598 protected:
2599 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2600 const override;
2601 friend class OGRPolyhedralSurface;
2602 friend class OGRTriangulatedSurface;
2603
2604 private:
2606 OGRErr _addGeometryWithExpectedSubGeometryType(
2607 const OGRGeometry * poNewGeom,
2608 OGRwkbGeometryType eSubGeometryType );
2609 OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
2610 OGRGeometry * poNewGeom,
2611 OGRwkbGeometryType eSubGeometryType );
2613
2614
2615 public:
2616 OGRMultiPolygon();
2617 OGRMultiPolygon( const OGRMultiPolygon& other );
2618 ~OGRMultiPolygon() override;
2619
2620 OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
2621
2623 typedef OGRPolygon ChildType;
2624
2628 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2630 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2634 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2636 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2637
2638 // IGeometryCollection
2640 OGRPolygon *getGeometryRef( int i) { return OGRGeometryCollection::getGeometryRef(i)->toPolygon(); }
2642 const OGRPolygon *getGeometryRef( int i ) const { return OGRGeometryCollection::getGeometryRef(i)->toPolygon(); }
2643
2644 // Non-standard (OGRGeometry).
2645 virtual const char *getGeometryName() const override;
2646 virtual OGRwkbGeometryType getGeometryType() const override;
2647 virtual OGRMultiPolygon *clone() const override;
2648
2649 #ifndef DOXYGEN_XML
2650 using OGRGeometry::exportToWkt;
2651 #endif
2652
2657 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2658 OGRErr *err = nullptr) const override;
2659
2660 // Non standard
2661 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2662 const override;
2663
2665 inline OGRGeometryCollection* toUpperClass() { return this; }
2667 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2668
2669 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2670 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2671
2672 static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
2673
2674 OGR_ALLOW_CAST_TO_THIS(MultiPolygon)
2675 OGR_ALLOW_UPCAST_TO(MultiSurface)
2676 };
2677
2679
2680 inline const OGRMultiPolygon::ChildType* const * begin(const OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2682 inline const OGRMultiPolygon::ChildType* const * end(const OGRMultiPolygon* poGeom) { return poGeom->end(); }
2683
2685 inline OGRMultiPolygon::ChildType** begin(OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2687 inline OGRMultiPolygon::ChildType** end(OGRMultiPolygon* poGeom) { return poGeom->end(); }
2689
2690 /************************************************************************/
2691 /* OGRPolyhedralSurface */
2692 /************************************************************************/
2693
2700 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
2701 {
2702 protected:
2704 friend class OGRTriangulatedSurface;
2705 OGRMultiPolygon oMP{};
2706 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
2707 const override;
2708 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
2709 const override;
2710 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2711 virtual const char* getSubGeometryName() const;
2712 virtual OGRwkbGeometryType getSubGeometryType() const;
2713 std::string exportToWktInternal (const OGRWktOptions& opts, OGRErr *err) const;
2714
2715 virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2716 const;
2717 static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
2719
2720 public:
2721 OGRPolyhedralSurface();
2722 OGRPolyhedralSurface( const OGRPolyhedralSurface &poGeom );
2723 ~OGRPolyhedralSurface() override;
2724 OGRPolyhedralSurface& operator=(const OGRPolyhedralSurface& other);
2725
2727 typedef OGRPolygon ChildType;
2728
2732 ChildType** begin() { return oMP.begin(); }
2734 ChildType** end() { return oMP.end(); }
2738 const ChildType* const* begin() const { return oMP.begin(); }
2740 const ChildType* const* end() const { return oMP.end(); }
2741
2742 // IWks Interface.
2743 virtual size_t WkbSize() const override;
2744 virtual const char *getGeometryName() const override;
2745 virtual OGRwkbGeometryType getGeometryType() const override;
2746 virtual OGRErr importFromWkb( const unsigned char *,
2747 size_t,
2748 OGRwkbVariant,
2749 size_t& nBytesConsumedOut ) override;
2750 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2751 OGRwkbVariant=wkbVariantOldOgc )
2752 const override;
2753
2754 #ifndef DOXYGEN_XML
2755 using OGRGeometry::importFromWkt;
2756 #endif
2757
2758 OGRErr importFromWkt( const char ** ) override;
2759
2760 #ifndef DOXYGEN_XML
2761 using OGRGeometry::exportToWkt;
2762 #endif
2763
2768 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2769 OGRErr *err = nullptr) const override;
2770
2771 // IGeometry methods.
2772 virtual int getDimension() const override;
2773
2774 virtual void empty() override;
2775
2776 virtual OGRPolyhedralSurface *clone() const override;
2777 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2778 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2779
2780 virtual void flattenTo2D() override;
2781 virtual OGRErr transform( OGRCoordinateTransformation* ) override;
2782 virtual OGRBoolean Equals( const OGRGeometry* ) const override;
2783 virtual double get_Area() const override;
2784 virtual OGRErr PointOnSurface( OGRPoint* ) const override;
2785
2786 static OGRMultiPolygon* CastToMultiPolygon( OGRPolyhedralSurface* poPS );
2787 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2788 const override;
2789 virtual OGRErr addGeometry( const OGRGeometry * );
2790 OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
2791 int getNumGeometries() const;
2792 OGRPolygon* getGeometryRef(int i);
2793 const OGRPolygon* getGeometryRef(int i) const;
2794
2795 virtual OGRBoolean IsEmpty() const override;
2796 virtual void setCoordinateDimension( int nDimension ) override;
2797 virtual void set3D( OGRBoolean bIs3D ) override;
2798 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2799 virtual void swapXY() override;
2800 OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2801
2802 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2803 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2804
2805 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2806
2807 OGR_ALLOW_CAST_TO_THIS(PolyhedralSurface)
2808 OGR_ALLOW_UPCAST_TO(Surface)
2809 };
2810
2812
2813 inline const OGRPolyhedralSurface::ChildType* const * begin(const OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2815 inline const OGRPolyhedralSurface::ChildType* const * end(const OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2816
2818 inline OGRPolyhedralSurface::ChildType** begin(OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2820 inline OGRPolyhedralSurface::ChildType** end(OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2822
2823 /************************************************************************/
2824 /* OGRTriangulatedSurface */
2825 /************************************************************************/
2826
2833 class CPL_DLL OGRTriangulatedSurface : public OGRPolyhedralSurface
2834 {
2835 protected:
2837 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2838 const override;
2839 virtual const char* getSubGeometryName() const override;
2840 virtual OGRwkbGeometryType getSubGeometryType() const override;
2841
2842 virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2843 const override;
2844 static OGRMultiPolygon *
2845 CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
2847
2848 public:
2849 OGRTriangulatedSurface();
2850 OGRTriangulatedSurface( const OGRTriangulatedSurface &other );
2851 ~OGRTriangulatedSurface();
2852
2854 typedef OGRTriangle ChildType;
2855
2859 ChildType** begin() { return reinterpret_cast<ChildType**>(oMP.begin()); }
2861 ChildType** end() { return reinterpret_cast<ChildType**>(oMP.end()); }
2865 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oMP.begin()); }
2867 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oMP.end()); }
2868
2869 OGRTriangulatedSurface& operator=( const OGRTriangulatedSurface& other );
2870 virtual const char *getGeometryName() const override;
2871 virtual OGRwkbGeometryType getGeometryType() const override;
2872 virtual OGRTriangulatedSurface *clone() const override;
2873
2875 OGRTriangle* getGeometryRef(int i) { return OGRPolyhedralSurface::getGeometryRef(i)->toTriangle(); }
2877 const OGRTriangle* getGeometryRef(int i) const { return OGRPolyhedralSurface::getGeometryRef(i)->toTriangle(); }
2878
2879 // IWks Interface.
2880 virtual OGRErr addGeometry( const OGRGeometry * ) override;
2881
2883 inline OGRPolyhedralSurface* toUpperClass() { return this; }
2885 inline const OGRPolyhedralSurface* toUpperClass() const { return this; }
2886
2887 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2888 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2889
2890 static OGRPolyhedralSurface *
2891 CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
2892
2893 OGR_ALLOW_CAST_TO_THIS(TriangulatedSurface)
2894 OGR_ALLOW_UPCAST_TO(PolyhedralSurface)
2895 };
2896
2898
2899 inline const OGRTriangulatedSurface::ChildType* const * begin(const OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2901 inline const OGRTriangulatedSurface::ChildType* const * end(const OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2902
2904 inline OGRTriangulatedSurface::ChildType** begin(OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2906 inline OGRTriangulatedSurface::ChildType** end(OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2908
2909 /************************************************************************/
2910 /* OGRMultiPoint */
2911 /************************************************************************/
2912
2917 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
2918 {
2919 private:
2920 OGRErr importFromWkt_Bracketed( const char **, int bHasM, int bHasZ );
2921
2922 protected:
2923 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2924 const override;
2925
2926 public:
2927 OGRMultiPoint();
2928 OGRMultiPoint(const OGRMultiPoint& other);
2929 ~OGRMultiPoint() override;
2930
2931 OGRMultiPoint& operator=(const OGRMultiPoint& other);
2932
2934 typedef OGRPoint ChildType;
2935
2939 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2941 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2945 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2947 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2948
2949 // IGeometryCollection
2951 OGRPoint *getGeometryRef( int i) { return OGRGeometryCollection::getGeometryRef(i)->toPoint(); }
2953 const OGRPoint *getGeometryRef( int i ) const { return OGRGeometryCollection::getGeometryRef(i)->toPoint(); }
2954
2955 // Non-standard (OGRGeometry).
2956 virtual const char *getGeometryName() const override;
2957 virtual OGRwkbGeometryType getGeometryType() const override;
2958 virtual OGRMultiPoint *clone() const override;
2959
2960 #ifndef DOXYGEN_XML
2961 using OGRGeometry::importFromWkt;
2962 #endif
2963
2964 OGRErr importFromWkt( const char ** ) override;
2965
2966 #ifndef DOXYGEN_XML
2967 using OGRGeometry::exportToWkt;
2968 #endif
2969
2974 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2975 OGRErr *err = nullptr) const override;
2976
2977 // IGeometry methods.
2978 virtual int getDimension() const override;
2979
2981 inline OGRGeometryCollection* toUpperClass() { return this; }
2983 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2984
2985 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2986 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2987
2988 // Non-standard.
2989 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2990 const override;
2991
2992 OGR_ALLOW_CAST_TO_THIS(MultiPoint)
2993 OGR_ALLOW_UPCAST_TO(GeometryCollection)
2994 OGR_FORBID_DOWNCAST_TO_MULTILINESTRING
2995 OGR_FORBID_DOWNCAST_TO_MULTICURVE
2996 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
2997 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
2998 };
2999
3001
3002 inline const OGRMultiPoint::ChildType* const * begin(const OGRMultiPoint* poGeom) { return poGeom->begin(); }
3004 inline const OGRMultiPoint::ChildType* const * end(const OGRMultiPoint* poGeom) { return poGeom->end(); }
3005
3007 inline OGRMultiPoint::ChildType** begin(OGRMultiPoint* poGeom) { return poGeom->begin(); }
3009 inline OGRMultiPoint::ChildType** end(OGRMultiPoint* poGeom) { return poGeom->end(); }
3011
3012 /************************************************************************/
3013 /* OGRMultiCurve */
3014 /************************************************************************/
3015
3022 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
3023 {
3024 protected:
3026 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
3027 OGRCurve* poCurve );
3029 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
3030 const override;
3031
3032 public:
3033 OGRMultiCurve();
3034 OGRMultiCurve( const OGRMultiCurve& other );
3035 ~OGRMultiCurve() override;
3036
3037 OGRMultiCurve& operator=( const OGRMultiCurve& other );
3038
3040 typedef OGRCurve ChildType;
3041
3045 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
3047 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
3051 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
3053 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
3054
3055 // IGeometryCollection
3057 OGRCurve *getGeometryRef( int i) { return OGRGeometryCollection::getGeometryRef(i)->toCurve(); }
3059 const OGRCurve *getGeometryRef( int i ) const { return OGRGeometryCollection::getGeometryRef(i)->toCurve(); }
3060
3061 // Non standard (OGRGeometry).
3062 virtual const char *getGeometryName() const override;
3063 virtual OGRwkbGeometryType getGeometryType() const override;
3064 virtual OGRMultiCurve *clone() const override;
3065
3066 #ifndef DOXYGEN_XML
3067 using OGRGeometry::importFromWkt;
3068 #endif
3069
3070 OGRErr importFromWkt( const char ** ) override;
3071
3072 #ifndef DOXYGEN_XML
3073 using OGRGeometry::exportToWkt;
3074 #endif
3075
3080 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
3081 OGRErr *err = nullptr) const override;
3082
3083 // IGeometry methods.
3084 virtual int getDimension() const override;
3085
3086 // Non-standard.
3087 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
3088 const override;
3089
3091 inline OGRGeometryCollection* toUpperClass() { return this; }
3093 inline const OGRGeometryCollection* toUpperClass() const { return this; }
3094
3095 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
3096 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
3097
3098 static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
3099
3100 OGR_ALLOW_CAST_TO_THIS(MultiCurve)
3101 OGR_ALLOW_UPCAST_TO(GeometryCollection)
3102 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3103 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3104 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3105 };
3106
3108
3109 inline const OGRMultiCurve::ChildType* const * begin(const OGRMultiCurve* poGeom) { return poGeom->begin(); }
3111 inline const OGRMultiCurve::ChildType* const * end(const OGRMultiCurve* poGeom) { return poGeom->end(); }
3112
3114 inline OGRMultiCurve::ChildType** begin(OGRMultiCurve* poGeom) { return poGeom->begin(); }
3116 inline OGRMultiCurve::ChildType** end(OGRMultiCurve* poGeom) { return poGeom->end(); }
3118
3119 /************************************************************************/
3120 /* OGRMultiLineString */
3121 /************************************************************************/
3122
3127 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
3128 {
3129 protected:
3130 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
3131 const override;
3132
3133 public:
3134 OGRMultiLineString();
3135 OGRMultiLineString( const OGRMultiLineString& other );
3136 ~OGRMultiLineString() override;
3137
3138 OGRMultiLineString& operator=( const OGRMultiLineString& other );
3139
3141 typedef OGRLineString ChildType;
3142
3146 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
3148 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
3152 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
3154 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
3155
3156 // IGeometryCollection
3158 OGRLineString *getGeometryRef( int i) { return OGRGeometryCollection::getGeometryRef(i)->toLineString(); }
3160 const OGRLineString *getGeometryRef( int i ) const { return OGRGeometryCollection::getGeometryRef(i)->toLineString(); }
3161
3162 // Non standard (OGRGeometry).
3163 virtual const char *getGeometryName() const override;
3164 virtual OGRwkbGeometryType getGeometryType() const override;
3165 virtual OGRMultiLineString *clone() const override;
3166
3167 #ifndef DOXYGEN_XML
3168 using OGRGeometry::exportToWkt;
3169 #endif
3170
3175 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
3176 OGRErr *err = nullptr) const override;
3177
3178 // Non standard
3179 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
3180 const override;
3181
3183 inline OGRGeometryCollection* toUpperClass() { return this; }
3185 inline const OGRGeometryCollection* toUpperClass() const { return this; }
3186
3187 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
3188 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
3189
3190 static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
3191
3192 OGR_ALLOW_CAST_TO_THIS(MultiLineString)
3193 OGR_ALLOW_UPCAST_TO(MultiCurve)
3194 OGR_FORBID_DOWNCAST_TO_MULTIPOINT
3195 OGR_FORBID_DOWNCAST_TO_MULTISURFACE
3196 OGR_FORBID_DOWNCAST_TO_MULTIPOLYGON
3197 };
3198
3200
3201 inline const OGRMultiLineString::ChildType* const * begin(const OGRMultiLineString* poGeom) { return poGeom->begin(); }
3203 inline const OGRMultiLineString::ChildType* const * end(const OGRMultiLineString* poGeom) { return poGeom->end(); }
3204
3206 inline OGRMultiLineString::ChildType** begin(OGRMultiLineString* poGeom) { return poGeom->begin(); }
3208 inline OGRMultiLineString::ChildType** end(OGRMultiLineString* poGeom) { return poGeom->end(); }
3210
3211 /************************************************************************/
3212 /* OGRGeometryFactory */
3213 /************************************************************************/
3214
3219 class CPL_DLL OGRGeometryFactory
3220 {
3221 static OGRErr createFromFgfInternal( const unsigned char *pabyData,
3222 OGRSpatialReference * poSR,
3223 OGRGeometry **ppoReturn,
3224 int nBytes,
3225 int *pnBytesConsumed,
3226 int nRecLevel );
3227 public:
3228 static OGRErr createFromWkb( const void *, OGRSpatialReference *,
3229 OGRGeometry **, size_t = static_cast<size_t>(-1),
3230 OGRwkbVariant=wkbVariantOldOgc );
3231 static OGRErr createFromWkb( const void * pabyData,
3232 OGRSpatialReference *,
3233 OGRGeometry **,
3234 size_t nSize,
3235 OGRwkbVariant eVariant,
3236 size_t& nBytesConsumedOut );
3237 static OGRErr createFromWkt( const char* , OGRSpatialReference *,
3238 OGRGeometry ** );
3239 static OGRErr createFromWkt( const char **, OGRSpatialReference *,
3240 OGRGeometry ** );
3244 static OGRErr createFromWkt( char ** ppszInput, OGRSpatialReference * poSRS,
3245 OGRGeometry ** ppoGeom )
3246 CPL_WARN_DEPRECATED("Use createFromWkt(const char**, ...) instead")
3247 {
3248 return createFromWkt( const_cast<const char**>(ppszInput), poSRS, ppoGeom);
3249 }
3250
3251 static OGRErr createFromFgf( const void*, OGRSpatialReference *,
3252 OGRGeometry **, int = -1, int * = nullptr );
3253 static OGRGeometry *createFromGML( const char * );
3254 static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
3255 GEOSGeom );
3256 static OGRGeometry *createFromGeoJson( const char *);
3257 static OGRGeometry *createFromGeoJson( const CPLJSONObject &oJSONObject );
3258
3259 static void destroyGeometry( OGRGeometry * );
3260 static OGRGeometry *createGeometry( OGRwkbGeometryType );
3261
3262 static OGRGeometry * forceToPolygon( OGRGeometry * );
3263 static OGRGeometry * forceToLineString( OGRGeometry *,
3264 bool bOnlyInOrder = true );
3265 static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
3266 static OGRGeometry * forceToMultiPoint( OGRGeometry * );
3267 static OGRGeometry * forceToMultiLineString( OGRGeometry * );
3268
3269 static OGRGeometry * forceTo( OGRGeometry* poGeom,
3270 OGRwkbGeometryType eTargetType,
3271 const char*const* papszOptions = nullptr );
3272
3273 static OGRGeometry * removeLowerDimensionSubGeoms( const OGRGeometry* poGeom );
3274
3275 static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
3276 int nPolygonCount,
3277 int *pbResultValidGeometry,
3278 const char **papszOptions = nullptr);
3279 static bool haveGEOS();
3280
3282 class CPL_DLL TransformWithOptionsCache
3283 {
3284 friend class OGRGeometryFactory;
3285 struct Private;
3286 std::unique_ptr<Private> d;
3287
3288 public:
3289 TransformWithOptionsCache();
3290 ~TransformWithOptionsCache();
3291 };
3292
3293 static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
3294 OGRCoordinateTransformation *poCT,
3295 char** papszOptions,
3296 const TransformWithOptionsCache& cache = TransformWithOptionsCache() );
3297
3298 static OGRGeometry*
3299 approximateArcAngles( double dfX, double dfY, double dfZ,
3300 double dfPrimaryRadius, double dfSecondaryAxis,
3301 double dfRotation,
3302 double dfStartAngle, double dfEndAngle,
3303 double dfMaxAngleStepSizeDegrees,
3304 const bool bUseMaxGap = false );
3305
3306 static int GetCurveParameters( double x0, double y0,
3307 double x1, double y1,
3308 double x2, double y2,
3309 double& R, double& cx, double& cy,
3310 double& alpha0, double& alpha1,
3311 double& alpha2 );
3312 static OGRLineString* curveToLineString(
3313 double x0, double y0, double z0,
3314 double x1, double y1, double z1,
3315 double x2, double y2, double z2,
3316 int bHasZ,
3317 double dfMaxAngleStepSizeDegrees,
3318 const char* const * papszOptions = nullptr );
3319 static OGRCurve* curveFromLineString(
3320 const OGRLineString* poLS,
3321 const char* const * papszOptions = nullptr);
3322 };
3323
3324 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
3325 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
3326
3328 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
3329
3330 struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
3331 {
3332 void operator()(OGRPreparedGeometry*) const;
3333 };
3335
3339 typedef std::unique_ptr<OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter> OGRPreparedGeometryUniquePtr;
3340
3341 #endif /* ndef OGR_GEOMETRY_H_INCLUDED */
CPLJSONObject
The CPLJSONArray class holds JSON object from CPLJSONDocument.
Definition: cpl_json.h:54
IOGRConstGeometryVisitor
OGRGeometry visitor interface.
Definition: ogr_geometry.h:232
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRCurvePolygon *)=0
Visit OGRCurvePolygon.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRPolyhedralSurface *)=0
Visit OGRPolyhedralSurface.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRCompoundCurve *)=0
Visit OGRCompoundCurve.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRMultiLineString *)=0
Visit OGRMultiLineString.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRTriangulatedSurface *)=0
Visit OGRTriangulatedSurface.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRPolygon *)=0
Visit OGRPolygon.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRMultiPolygon *)=0
Visit OGRMultiPolygon.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRTriangle *)=0
Visit OGRTriangle.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRLineString *)=0
Visit OGRLineString.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRMultiPoint *)=0
Visit OGRMultiPoint.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRMultiCurve *)=0
Visit OGRMultiCurve.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRGeometryCollection *)=0
Visit OGRGeometryCollection.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRPoint *)=0
Visit OGRPoint.
IOGRConstGeometryVisitor::~IOGRConstGeometryVisitor
virtual ~IOGRConstGeometryVisitor()=default
Destructor/.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRMultiSurface *)=0
Visit OGRMultiSurface.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRLinearRing *)=0
Visit OGRLinearRing.
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRCircularString *)=0
Visit OGRCircularString.
IOGRGeometryVisitor
OGRGeometry visitor interface.
Definition: ogr_geometry.h:158
IOGRGeometryVisitor::visit
virtual void visit(OGRMultiSurface *)=0
Visit OGRMultiSurface.
IOGRGeometryVisitor::visit
virtual void visit(OGRLinearRing *)=0
Visit OGRLinearRing.
IOGRGeometryVisitor::visit
virtual void visit(OGRTriangle *)=0
Visit OGRTriangle.
IOGRGeometryVisitor::visit
virtual void visit(OGRCircularString *)=0
Visit OGRCircularString.
IOGRGeometryVisitor::visit
virtual void visit(OGRPolygon *)=0
Visit OGRPolygon.
IOGRGeometryVisitor::visit
virtual void visit(OGRLineString *)=0
Visit OGRLineString.
IOGRGeometryVisitor::visit
virtual void visit(OGRCompoundCurve *)=0
Visit OGRCompoundCurve.
IOGRGeometryVisitor::visit
virtual void visit(OGRTriangulatedSurface *)=0
Visit OGRTriangulatedSurface.
IOGRGeometryVisitor::visit
virtual void visit(OGRPoint *)=0
Visit OGRPoint.
IOGRGeometryVisitor::visit
virtual void visit(OGRCurvePolygon *)=0
Visit OGRCurvePolygon.
IOGRGeometryVisitor::visit
virtual void visit(OGRGeometryCollection *)=0
Visit OGRGeometryCollection.
IOGRGeometryVisitor::visit
virtual void visit(OGRPolyhedralSurface *)=0
Visit OGRPolyhedralSurface.
IOGRGeometryVisitor::visit
virtual void visit(OGRMultiPolygon *)=0
Visit OGRMultiPolygon.
IOGRGeometryVisitor::~IOGRGeometryVisitor
virtual ~IOGRGeometryVisitor()=default
Destructor/.
IOGRGeometryVisitor::visit
virtual void visit(OGRMultiLineString *)=0
Visit OGRMultiLineString.
IOGRGeometryVisitor::visit
virtual void visit(OGRMultiPoint *)=0
Visit OGRMultiPoint.
IOGRGeometryVisitor::visit
virtual void visit(OGRMultiCurve *)=0
Visit OGRMultiCurve.
OGRCircularString
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:1568
OGRCircularString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1647
OGRCircularString::OGRCircularString
OGRCircularString()
Create an empty circular string.
OGRCircularString::toUpperClass
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1645
OGRCircularString::OGRCircularString
OGRCircularString(const OGRCircularString &other)
Copy constructor.
OGRCircularString::toUpperClass
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1643
OGRCircularString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1648
OGRCompoundCurve
Utility class to store a collection of curves.
Definition: ogr_geometry.h:1769
OGRCompoundCurve::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1901
OGRCompoundCurve::begin
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:1818
OGRCompoundCurve::end
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:1814
OGRCompoundCurve::OGRCompoundCurve
OGRCompoundCurve(const OGRCompoundCurve &other)
Copy constructor.
OGRCompoundCurve::begin
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1812
OGRCompoundCurve::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:1807
OGRCompoundCurve::end
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:1820
OGRCompoundCurve::OGRCompoundCurve
OGRCompoundCurve()
Create an empty compound curve.
OGRCompoundCurve::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1900
OGRCoordinateTransformation
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:734
OGRCurvePolygon
Concrete class representing curve polygons.
Definition: ogr_geometry.h:1973
OGRCurvePolygon::stealExteriorRingCurve
OGRCurve * stealExteriorRingCurve()
"Steal" reference to external ring.
Definition: ogrcurvepolygon.cpp:292
OGRCurvePolygon::getExteriorRingCurve
OGRCurve * getExteriorRingCurve()
Fetch reference to external polygon ring.
Definition: ogrcurvepolygon.cpp:186
OGRCurvePolygon::getInteriorRingCurve
OGRCurve * getInteriorRingCurve(int)
Fetch reference to indicated internal ring.
Definition: ogrcurvepolygon.cpp:251
OGRCurvePolygon::Contains
virtual OGRBoolean Contains(const OGRGeometry *) const override
Test for containment.
Definition: ogrcurvepolygon.cpp:765
OGRCurvePolygon::flattenTo2D
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrcurvepolygon.cpp:150
OGRCurvePolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2104
OGRCurvePolygon::empty
virtual void empty() override
Clear geometry information.
Definition: ogrcurvepolygon.cpp:113
OGRCurvePolygon::getEnvelope
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition: ogrcurvepolygon.cpp:601
OGRCurvePolygon::CastToPolygon
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:812
OGRCurvePolygon::get_Area
virtual double get_Area() const override
Get the area of the surface object.
Definition: ogrcurvepolygon.cpp:650
OGRCurvePolygon::transform
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:640
OGRCurvePolygon::getDimension
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrcurvepolygon.cpp:140
OGRCurvePolygon::Intersects
virtual OGRBoolean Intersects(const OGRGeometry *) const override
Do these features intersect?
Definition: ogrcurvepolygon.cpp:781
OGRCurvePolygon::swapXY
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:722
OGRCurvePolygon::Equals
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:621
OGRCurvePolygon::segmentize
virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:708
OGRCurvePolygon::end
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:2023
OGRCurvePolygon::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2010
OGRCurvePolygon::IsEmpty
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:699
OGRCurvePolygon::OGRCurvePolygon
OGRCurvePolygon()
Create an empty curve polygon.
OGRCurvePolygon::begin
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:2021
OGRCurvePolygon::assignSpatialReference
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrcurvepolygon.cpp:690
OGRCurvePolygon::end
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:2017
OGRCurvePolygon::addRing
virtual OGRErr addRing(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:347
OGRCurvePolygon::begin
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:2015
OGRCurvePolygon::setCoordinateDimension
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrcurvepolygon.cpp:670
OGRCurvePolygon::setMeasured
virtual void setMeasured(OGRBoolean bIsMeasured) override
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:681
OGRCurvePolygon::getNumInteriorRings
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:223
OGRCurvePolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2105
OGRCurvePolygon::removeRing
OGRErr removeRing(int iIndex, bool bDelete=true)
Remove a geometry from the container.
Definition: ogrcurvepolygon.cpp:324
OGRCurvePolygon::OGRCurvePolygon
OGRCurvePolygon(const OGRCurvePolygon &)
Copy constructor.
OGRCurvePolygon::set3D
virtual void set3D(OGRBoolean bIs3D) override
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:676
OGRCurve
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:1070
OGRCurve::CurveToLine
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const =0
Return a linestring from a curve geometry.
OGRCurve::get_Length
virtual double get_Length() const =0
Returns the length of the curve.
OGRCurve::IntersectsPoint
virtual int IntersectsPoint(const OGRPoint *p) const
Returns if a point intersects a (closed) curve.
Definition: ogrcurve.cpp:416
OGRCurve::toSimpleCurve
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1153
OGRCurve::StartPoint
virtual void StartPoint(OGRPoint *) const =0
Return the curve start point.
OGRCurve::EndPoint
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
OGRCurve::getNumPoints
virtual int getNumPoints() const =0
Return the number of points of a curve geometry.
OGRCurve::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1112
OGRCurve::ContainsPoint
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:396
OGRCurve::Value
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
OGRCurve::getPointIterator
virtual OGRPointIterator * getPointIterator() const =0
Returns a point iterator over the curve.
OGRCurve::get_AreaOfCurveSegments
virtual double get_AreaOfCurveSegments() const =0
Get the area of the purely curve portions of a (closed) curve.
OGRCurve::get_Area
virtual double get_Area() const =0
Get the area of the (closed) curve.
OGRCurve::toSimpleCurve
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1148
OGRCurve::clone
virtual OGRCurve * clone() const override=0
Make a copy of this object.
OGRDefaultConstGeometryVisitor
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:279
OGRDefaultConstGeometryVisitor::visit
void visit(const OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:284
OGRDefaultGeometryVisitor
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:205
OGRDefaultGeometryVisitor::visit
void visit(OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:210
OGREnvelope3D
Simple container for a bounding region in 3D.
Definition: ogr_core.h:176
OGREnvelope
Simple container for a bounding region (rectangle)
Definition: ogr_core.h:58
OGRGeometryCollection
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:2341
OGRGeometryCollection::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2458
OGRGeometryCollection::end
const ChildType *const * end() const
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2382
OGRGeometryCollection::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2459
OGRGeometryCollection::begin
ChildType ** begin()
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2374
OGRGeometryCollection::begin
const ChildType *const * begin() const
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2380
OGRGeometryCollection::end
ChildType ** end()
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2376
OGRGeometryCollection::getGeometryRef
OGRGeometry * getGeometryRef(int)
Fetch geometry from container.
Definition: ogrgeometrycollection.cpp:262
OGRGeometryCollection::OGRGeometryCollection
OGRGeometryCollection()
Create an empty geometry collection.
OGRGeometryCollection::ChildType
OGRGeometry ChildType
Type of child elements.
Definition: ogr_geometry.h:2369
OGRGeometryFactory::TransformWithOptionsCache
Opaque class used as argument to transformWithOptions()
Definition: ogr_geometry.h:3283
OGRGeometryFactory
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:3220
OGRGeometryFactory::createFromWkt
static OGRErr createFromWkt(char **ppszInput, OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
Definition: ogr_geometry.h:3244
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:327
OGRGeometry::toCircularString
OGRCircularString * toCircularString()
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:648
OGRGeometry::toMultiPolygon
OGRMultiPolygon * toMultiPolygon()
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:774
OGRGeometry::toLinearRing
OGRLinearRing * toLinearRing()
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:634
OGRGeometry::toLineString
OGRLineString * toLineString()
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:620
OGRGeometry::getCurveGeometry
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=nullptr) const
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3261
OGRGeometry::toCurvePolygon
const OGRCurvePolygon * toCurvePolygon() const
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:725
OGRGeometry::toSimpleCurve
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:606
OGRGeometry::empty
virtual void empty()=0
Clear geometry information.
OGRGeometry::Equals
virtual OGRBoolean Equals(const OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
OGRGeometry::toMultiPoint
const OGRMultiPoint * toMultiPoint() const
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:753
OGRGeometry::toCurvePolygon
OGRCurvePolygon * toCurvePolygon()
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:718
OGRGeometry::toMultiPolygon
const OGRMultiPolygon * toMultiPolygon() const
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:781
OGRGeometry::toPolygon
OGRPolygon * toPolygon()
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:690
OGRGeometry::operator!=
bool operator!=(const OGRGeometry &other) const
Returns if two geometries are different.
Definition: ogr_geometry.h:393
OGRGeometry::toGeometryCollection
const OGRGeometryCollection * toGeometryCollection() const
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:739
OGRGeometry::toTriangulatedSurface
const OGRTriangulatedSurface * toTriangulatedSurface() const
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:837
OGRGeometry::toTriangulatedSurface
OGRTriangulatedSurface * toTriangulatedSurface()
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:830
OGRGeometry::toCurve
const OGRCurve * toCurve() const
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:599
OGRGeometry::toMultiLineString
OGRMultiLineString * toMultiLineString()
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:760
OGRGeometry::toPolyhedralSurface
OGRPolyhedralSurface * toPolyhedralSurface()
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:816
OGRGeometry::toSimpleCurve
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:613
OGRGeometry::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
OGRGeometry::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const =0
Accept a visitor.
OGRGeometry::toCompoundCurve
OGRCompoundCurve * toCompoundCurve()
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:662
OGRGeometry::toCompoundCurve
const OGRCompoundCurve * toCompoundCurve() const
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:669
OGRGeometry::toSurface
const OGRSurface * toSurface() const
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:683
OGRGeometry::toMultiCurve
const OGRMultiCurve * toMultiCurve() const
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:795
OGRGeometry::toMultiCurve
OGRMultiCurve * toMultiCurve()
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:788
OGRGeometry::toCircularString
const OGRCircularString * toCircularString() const
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:655
OGRGeometry::toLineString
const OGRLineString * toLineString() const
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:627
OGRGeometry::operator==
bool operator==(const OGRGeometry &other) const
Returns if two geometries are equal.
Definition: ogr_geometry.h:390
OGRGeometry::toMultiSurface
OGRMultiSurface * toMultiSurface()
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:802
OGRGeometry::toPolygon
const OGRPolygon * toPolygon() const
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:697
OGRGeometry::IsMeasured
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:407
OGRGeometry::toGeometryCollection
OGRGeometryCollection * toGeometryCollection()
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:732
OGRGeometry::accept
virtual void accept(IOGRGeometryVisitor *visitor)=0
Accept a visitor.
OGRGeometry::toTriangle
OGRTriangle * toTriangle()
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:704
OGRGeometry::transform
virtual OGRErr transform(OGRCoordinateTransformation *poCT)=0
Apply arbitrary coordinate transformation to geometry.
OGRGeometry::flattenTo2D
virtual void flattenTo2D()=0
Convert geometry to strictly 2D.
OGRGeometry::getDimension
virtual int getDimension() const =0
Get the dimension of this object.
OGRGeometry::toMultiLineString
const OGRMultiLineString * toMultiLineString() const
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:767
OGRGeometry::toMultiPoint
OGRMultiPoint * toMultiPoint()
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:746
OGRGeometry::toSurface
OGRSurface * toSurface()
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:676
OGRGeometry::getGeometryName
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
OGRGeometry::toTriangle
const OGRTriangle * toTriangle() const
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:711
OGRGeometry::FromHandle
static OGRGeometry * FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
Definition: ogr_geometry.h:571
OGRGeometry::importFromWkt
OGRErr importFromWkt(char **ppszInput)
Deprecated.
Definition: ogr_geometry.h:430
OGRGeometry::toLinearRing
const OGRLinearRing * toLinearRing() const
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:641
OGRGeometry::IsEmpty
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.
OGRGeometry::toPoint
OGRPoint * toPoint()
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:578
OGRGeometry::toCurve
OGRCurve * toCurve()
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:592
OGRGeometry::exportToWkt
OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const
Convert a geometry into well known text format.
Definition: ogrgeometry.cpp:1829
OGRGeometry::toPoint
const OGRPoint * toPoint() const
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:585
OGRGeometry::getLinearGeometry
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrgeometry.cpp:3226
OGRGeometry::ToHandle
static OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
Definition: ogr_geometry.h:565
OGRGeometry::Is3D
OGRBoolean Is3D() const
Definition: ogr_geometry.h:405
OGRGeometry::closeRings
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:5236
OGRGeometry::toPolyhedralSurface
const OGRPolyhedralSurface * toPolyhedralSurface() const
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:823
OGRGeometry::importFromWkt
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
OGRGeometry::clone
virtual OGRGeometry * clone() const =0
Make a copy of this object.
OGRGeometry::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const =0
Export a WKT geometry.
OGRGeometry::toMultiSurface
const OGRMultiSurface * toMultiSurface() const
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:809
OGRLineString
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1407
OGRLineString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1452
OGRLineString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1451
OGRLineString::OGRLineString
OGRLineString(const OGRLineString &other)
Copy constructor.
OGRLineString::toUpperClass
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1449
OGRLineString::toUpperClass
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1447
OGRLineString::OGRLineString
OGRLineString()
Create an empty line string.
OGRLineString::get_Area
virtual double get_Area() const override
Get the area of the (closed) curve.
OGRLinearRing
Concrete representation of a closed ring.
Definition: ogr_geometry.h:1483
OGRLinearRing::toUpperClass
const OGRLineString * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1542
OGRLinearRing::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1545
OGRLinearRing::OGRLinearRing
OGRLinearRing(const OGRLinearRing &other)
Copy constructor.
OGRLinearRing::OGRLinearRing
OGRLinearRing()
Constructor.
OGRLinearRing::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1544
OGRLinearRing::toUpperClass
OGRLineString * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1540
OGRMultiCurve
A collection of OGRCurve.
Definition: ogr_geometry.h:3023
OGRMultiCurve::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3051
OGRMultiCurve::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3096
OGRMultiCurve::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3045
OGRMultiCurve::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3093
OGRMultiCurve::OGRMultiCurve
OGRMultiCurve()
Create an empty multi curve collection.
OGRMultiCurve::OGRMultiCurve
OGRMultiCurve(const OGRMultiCurve &other)
Copy constructor.
OGRMultiCurve::getGeometryRef
OGRCurve * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3057
OGRMultiCurve::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:3040
OGRMultiCurve::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3053
OGRMultiCurve::getGeometryRef
const OGRCurve * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3059
OGRMultiCurve::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3047
OGRMultiCurve::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3091
OGRMultiCurve::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3095
OGRMultiLineString
A collection of OGRLineString.
Definition: ogr_geometry.h:3128
OGRMultiLineString::getGeometryRef
OGRLineString * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3158
OGRMultiLineString::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:3146
OGRMultiLineString::getGeometryRef
const OGRLineString * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:3160
OGRMultiLineString::ChildType
OGRLineString ChildType
Type of child elements.
Definition: ogr_geometry.h:3141
OGRMultiLineString::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:3185
OGRMultiLineString::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:3154
OGRMultiLineString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:3188
OGRMultiLineString::OGRMultiLineString
OGRMultiLineString()
Create an empty multi line string collection.
OGRMultiLineString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:3187
OGRMultiLineString::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:3152
OGRMultiLineString::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:3148
OGRMultiLineString::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:3183
OGRMultiLineString::OGRMultiLineString
OGRMultiLineString(const OGRMultiLineString &other)
Copy constructor.
OGRMultiPoint
A collection of OGRPoint.
Definition: ogr_geometry.h:2918
OGRMultiPoint::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2939
OGRMultiPoint::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2981
OGRMultiPoint::getGeometryRef
OGRPoint * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2951
OGRMultiPoint::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2945
OGRMultiPoint::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2947
OGRMultiPoint::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2941
OGRMultiPoint::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2983
OGRMultiPoint::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2985
OGRMultiPoint::getGeometryRef
const OGRPoint * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2953
OGRMultiPoint::OGRMultiPoint
OGRMultiPoint()
Create an empty multi point collection.
OGRMultiPoint::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2986
OGRMultiPoint::OGRMultiPoint
OGRMultiPoint(const OGRMultiPoint &other)
Copy constructor.
OGRMultiPoint::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:2934
OGRMultiPolygon
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:2597
OGRMultiPolygon::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2665
OGRMultiPolygon::getGeometryRef
const OGRPolygon * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2642
OGRMultiPolygon::ChildType
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2623
OGRMultiPolygon::OGRMultiPolygon
OGRMultiPolygon(const OGRMultiPolygon &other)
Copy constructor.
OGRMultiPolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2670
OGRMultiPolygon::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2630
OGRMultiPolygon::getGeometryRef
OGRPolygon * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2640
OGRMultiPolygon::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2634
OGRMultiPolygon::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2636
OGRMultiPolygon::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2667
OGRMultiPolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2669
OGRMultiPolygon::OGRMultiPolygon
OGRMultiPolygon()
Create an empty multi polygon collection.
OGRMultiPolygon::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2628
OGRMultiSurface
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:2493
OGRMultiSurface::OGRMultiSurface
OGRMultiSurface()
Create an empty multi surface collection.
OGRMultiSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2564
OGRMultiSurface::getGeometryRef
OGRSurface * getGeometryRef(int i)
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2551
OGRMultiSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2517
OGRMultiSurface::ChildType
OGRSurface ChildType
Type of child elements.
Definition: ogr_geometry.h:2506
OGRMultiSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2519
OGRMultiSurface::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2560
OGRMultiSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2511
OGRMultiSurface::OGRMultiSurface
OGRMultiSurface(const OGRMultiSurface &other)
Copy constructor.
OGRMultiSurface::getGeometryRef
const OGRSurface * getGeometryRef(int i) const
See OGRGeometryCollection::getGeometryRef()
Definition: ogr_geometry.h:2553
OGRMultiSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2565
OGRMultiSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2513
OGRMultiSurface::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2562
OGRPointIterator
Interface for a point iterator.
Definition: ogr_geometry.h:1052
OGRPointIterator::getNextPoint
virtual OGRBoolean getNextPoint(OGRPoint *p)=0
Returns the next point followed by the iterator.
OGRPoint
Point class.
Definition: ogr_geometry.h:936
OGRPoint::getM
double getM() const
Return m.
Definition: ogr_geometry.h:997
OGRPoint::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1030
OGRPoint::setX
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:1004
OGRPoint::OGRPoint
OGRPoint(const OGRPoint &other)
Copy constructor.
OGRPoint::setZ
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:1012
OGRPoint::setM
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:1017
OGRPoint::getX
double getX() const
Return x.
Definition: ogr_geometry.h:991
OGRPoint::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1031
OGRPoint::setY
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:1008
OGRPoint::IsEmpty
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:986
OGRPoint::getZ
double getZ() const
Return z.
Definition: ogr_geometry.h:995
OGRPoint::getY
double getY() const
Return y.
Definition: ogr_geometry.h:993
OGRPolygon
Concrete class representing polygons.
Definition: ogr_geometry.h:2139
OGRPolygon::toUpperClass
const OGRCurvePolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2243
OGRPolygon::getLinearGeometry
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrpolygon.cpp:767
OGRPolygon::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2184
OGRPolygon::ChildType
OGRLinearRing ChildType
Type of child elements.
Definition: ogr_geometry.h:2171
OGRPolygon::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:758
OGRPolygon::OGRPolygon
OGRPolygon()
Create an empty polygon.
OGRPolygon::WkbSize
virtual size_t WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolygon.cpp:309
OGRPolygon::CurvePolyToPoly
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:747
OGRPolygon::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolygon.cpp:383
OGRPolygon::OGRPolygon
OGRPolygon(const OGRPolygon &other)
Copy constructor.
OGRPolygon::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2182
OGRPolygon::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2178
OGRPolygon::toUpperClass
OGRCurvePolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2241
OGRPolygon::exportToWkt
OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const
Convert a geometry into well known text format.
Definition: ogrgeometry.cpp:1829
OGRPolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2246
OGRPolygon::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2176
OGRPolygon::importFromWkt
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
OGRPolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2245
OGRPolygon::closeRings
virtual void closeRings() override
Force rings to be closed.
Definition: ogrpolygon.cpp:736
OGRPolyhedralSurface
PolyhedralSurface class.
Definition: ogr_geometry.h:2701
OGRPolyhedralSurface::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolyhedralsurface.cpp:289
OGRPolyhedralSurface::IsEmpty
virtual OGRBoolean IsEmpty() const override
Checks if the PolyhedralSurface is empty.
Definition: ogrpolyhedralsurface.cpp:857
OGRPolyhedralSurface::setMeasured
virtual void setMeasured(OGRBoolean bIsMeasured) override
Set the type as Measured.
Definition: ogrpolyhedralsurface.cpp:885
OGRPolyhedralSurface::setCoordinateDimension
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrpolyhedralsurface.cpp:906
OGRPolyhedralSurface::getNumGeometries
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:798
OGRPolyhedralSurface::assignSpatialReference
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrpolyhedralsurface.cpp:966
OGRPolyhedralSurface::importFromWkb
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrpolyhedralsurface.cpp:197
OGRPolyhedralSurface::CastToMultiPolygon
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:709
OGRPolyhedralSurface::getGeometryRef
OGRPolygon * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:820
OGRPolyhedralSurface::swapXY
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrpolyhedralsurface.cpp:921
OGRPolyhedralSurface::getEnvelope
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition: ogrpolyhedralsurface.cpp:179
OGRPolyhedralSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2732
OGRPolyhedralSurface::flattenTo2D
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrpolyhedralsurface.cpp:505
OGRPolyhedralSurface::OGRPolyhedralSurface
OGRPolyhedralSurface(const OGRPolyhedralSurface &poGeom)
Copy constructor.
OGRPolyhedralSurface::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolyhedralsurface.cpp:931
OGRPolyhedralSurface::~OGRPolyhedralSurface
~OGRPolyhedralSurface() override
Destructor.
OGRPolyhedralSurface::set3D
virtual void set3D(OGRBoolean bIs3D) override
Set the type as 3D geometry.
Definition: ogrpolyhedralsurface.cpp:870
OGRPolyhedralSurface::addGeometryDirectly
OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
Definition: ogrpolyhedralsurface.cpp:766
OGRPolyhedralSurface::Equals
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrpolyhedralsurface.cpp:598
OGRPolyhedralSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2802
OGRPolyhedralSurface::ChildType
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2727
OGRPolyhedralSurface::get_Area
virtual double get_Area() const override
Returns the area enclosed.
Definition: ogrpolyhedralsurface.cpp:638
OGRPolyhedralSurface::transform
virtual OGRErr transform(OGRCoordinateTransformation *) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrpolyhedralsurface.cpp:517
OGRPolyhedralSurface::exportToWkt
OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const
Convert a geometry into well known text format.
Definition: ogrgeometry.cpp:1829
OGRPolyhedralSurface::PointOnSurface
virtual OGRErr PointOnSurface(OGRPoint *) const override
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogrpolyhedralsurface.cpp:665
OGRPolyhedralSurface::OGRPolyhedralSurface
OGRPolyhedralSurface()
Create an empty PolyhedralSurface.
OGRPolyhedralSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2734
OGRPolyhedralSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2740
OGRPolyhedralSurface::importFromWkt
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
OGRPolyhedralSurface::WkbSize
virtual size_t WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolyhedralsurface.cpp:137
OGRPolyhedralSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2738
OGRPolyhedralSurface::getDimension
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrpolyhedralsurface.cpp:151
OGRPolyhedralSurface::empty
virtual void empty() override
Clear geometry information.
Definition: ogrpolyhedralsurface.cpp:160
OGRPolyhedralSurface::removeGeometry
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:957
OGRPolyhedralSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2803
OGRRawPoint
Simple container for a position.
Definition: ogr_geometry.h:104
OGRRawPoint::OGRRawPoint
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:110
OGRRawPoint::x
double x
x
Definition: ogr_geometry.h:113
OGRRawPoint::y
double y
y
Definition: ogr_geometry.h:115
OGRRawPoint::OGRRawPoint
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:107
OGRSimpleCurve
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:1187
OGRSimpleCurve::getY
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:1324
OGRSimpleCurve::getX
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:1323
OGRSimpleCurve::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1253
OGRSimpleCurve::clone
virtual OGRSimpleCurve * clone() const override=0
Make a copy of this object.
OGRSimpleCurve::getNumPoints
virtual int getNumPoints() const override
Fetch vertex count.
Definition: ogr_geometry.h:1321
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:158
OGRSurface
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:1931
OGRSurface::get_Area
virtual double get_Area() const =0
Get the area of the surface object.
OGRSurface::PointOnSurface
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:1940
OGRSurface::clone
virtual OGRSurface * clone() const override=0
Make a copy of this object.
OGRTriangle
Triangle class.
Definition: ogr_geometry.h:2277
OGRTriangle::toUpperClass
const OGRPolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2316
OGRTriangle::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrtriangle.cpp:170
OGRTriangle::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2318
OGRTriangle::importFromWkb
virtual OGRErr importFromWkb(const unsigned char *, size_t, OGRwkbVariant, size_t &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrtriangle.cpp:198
OGRTriangle::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2319
OGRTriangle::toUpperClass
OGRPolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2314
OGRTriangle::OGRTriangle
OGRTriangle()
Constructor.
OGRTriangle::~OGRTriangle
~OGRTriangle() override
Destructor.
OGRTriangle::addRingDirectly
virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override
Add a ring to a polygon.
Definition: ogrtriangle.cpp:256
OGRTriangle::OGRTriangle
OGRTriangle(const OGRTriangle &other)
Copy constructor.
OGRTriangle::clone
virtual OGRTriangle * clone() const override
Make a copy of this object.
Definition: ogrtriangle.cpp:151
OGRTriangle::operator=
OGRTriangle & operator=(const OGRTriangle &other)
Assignment operator.
Definition: ogrtriangle.cpp:138
OGRTriangle::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrtriangle.cpp:161
OGRTriangulatedSurface
TriangulatedSurface class.
Definition: ogr_geometry.h:2834
OGRTriangulatedSurface::~OGRTriangulatedSurface
~OGRTriangulatedSurface()
Destructor.
OGRTriangulatedSurface::operator=
OGRTriangulatedSurface & operator=(const OGRTriangulatedSurface &other)
Assignment operator.
Definition: ogrtriangulatedsurface.cpp:84
OGRTriangulatedSurface::getGeometryName
virtual const char * getGeometryName() const override
Returns the geometry name of the TriangulatedSurface.
Definition: ogrtriangulatedsurface.cpp:126
OGRTriangulatedSurface::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Returns the WKB Type of TriangulatedSurface.
Definition: ogrtriangulatedsurface.cpp:140
OGRTriangulatedSurface::addGeometry
virtual OGRErr addGeometry(const OGRGeometry *) override
Add a new geometry to a collection.
Definition: ogrtriangulatedsurface.cpp:190
OGRTriangulatedSurface::getGeometryRef
const OGRTriangle * getGeometryRef(int i) const
See OGRPolyhedralSurface::getGeometryRef()
Definition: ogr_geometry.h:2877
OGRTriangulatedSurface::toUpperClass
OGRPolyhedralSurface * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2883
OGRTriangulatedSurface::clone
virtual OGRTriangulatedSurface * clone() const override
Make a copy of this object.
Definition: ogrtriangulatedsurface.cpp:109
OGRTriangulatedSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2887
OGRTriangulatedSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2865
OGRTriangulatedSurface::toUpperClass
const OGRPolyhedralSurface * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2885
OGRTriangulatedSurface::ChildType
OGRTriangle ChildType
Type of child elements.
Definition: ogr_geometry.h:2854
OGRTriangulatedSurface::getGeometryRef
OGRTriangle * getGeometryRef(int i)
See OGRPolyhedralSurface::getGeometryRef()
Definition: ogr_geometry.h:2875
OGRTriangulatedSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2888
OGRTriangulatedSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2861
OGRTriangulatedSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2867
OGRTriangulatedSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2859
OGRTriangulatedSurface::OGRTriangulatedSurface
OGRTriangulatedSurface()
Constructor.
cpl_conv.h
Various convenience functions for CPL.
cpl_json.h
Interface for read and write JSON documents.
CPL_WARN_UNUSED_RESULT
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:946
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
OGRGeometryH
void * OGRGeometryH
Opaque type for a geometry.
Definition: ogr_api.h:63
ogr_core.h
Core portability services for cross-platform OGR code.
OGRBoolean
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:334
OGRwkbByteOrder
OGRwkbByteOrder
Enumeration to describe byte order.
Definition: ogr_core.h:528
OGRwkbVariant
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:462
wkbVariantOldOgc
@ wkbVariantOldOgc
Old-style 99-402 extended dimension (Z) WKB types.
Definition: ogr_core.h:463
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:346
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:318
OGRWktFormat
OGRWktFormat
WKT Output formatting options.
Definition: ogr_geometry.h:62
OGRWktFormat::Default
@ Default
Format as F when abs(value) < 1, otherwise as G.
OGRWktFormat::F
@ F
F-type formatting.
OGRWktFormat::G
@ G
G-type formatting.
OGRPreparedGeometryUniquePtr
std::unique_ptr< OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter > OGRPreparedGeometryUniquePtr
Unique pointer type for OGRPreparedGeometry.
Definition: ogr_geometry.h:3339
OGRToOGCGeomType
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition: ogrgeometry.cpp:2465
GEOSContextHandle_t
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
Definition: ogr_geometry.h:121
OGRFromOGCGeomType
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGCgeometry format type to corresponding OGR constants.
Definition: ogrgeometry.cpp:2392
OGRGeometryUniquePtr
std::unique_ptr< OGRGeometry, OGRGeometryUniquePtrDeleter > OGRGeometryUniquePtr
Unique pointer type for OGRGeometry.
Definition: ogr_geometry.h:852
GEOSGeom
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:119
sfcgal_geometry_t
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:123
ogr_spatialref.h
Coordinate systems services.
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:287
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:292
OGRWktOptions
Options for formatting WKT output.
Definition: ogr_geometry.h:70
OGRWktOptions::variant
OGRwkbVariant variant
Type of WKT output to produce.
Definition: ogr_geometry.h:73
OGRWktOptions::OGRWktOptions
OGRWktOptions()
Constructor.
Definition: ogr_geometry.h:82
OGRWktOptions::OGRWktOptions
OGRWktOptions(const OGRWktOptions &)=default
Copy constructor.
OGRWktOptions::round
bool round
Whether GDAL-special rounding should be applied.
Definition: ogr_geometry.h:77
OGRWktOptions::precision
int precision
Precision of output. Interpretation depends on format.
Definition: ogr_geometry.h:75
OGRWktOptions::format
OGRWktFormat format
Formatting type.
Definition: ogr_geometry.h:79