GDAL

- Main Page
- Related Pages
- Classes
- Files
- Download
- Issue Tracker

- File List
- File Members

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 <memory>
41
49 #ifndef DEFINEH_OGRGeometryH
50 #define DEFINEH_OGRGeometryH
51 #ifdef DEBUG
52 typedef struct OGRGeometryHS *OGRGeometryH;
53 #else
54 typedef void *OGRGeometryH;
55 #endif
56 #endif /* DEFINEH_OGRGeometryH */
57
59 enum class OGRWktFormat
61 {
62 F,
63 G,
64 Default
65 };
66
68 struct CPL_DLL OGRWktOptions
69 {
70 public:
72 OGRwkbVariant variant;
74 int precision;
76 bool round;
78 OGRWktFormat format;
79
81 OGRWktOptions() : variant(wkbVariantOldOgc), precision(15), round(true),
82 format(OGRWktFormat::Default)
83 {
84 static int defPrecision = getDefaultPrecision();
85 static bool defRound = getDefaultRound();
86
87 precision = defPrecision;
88 round = defRound;
89 }
90
92 OGRWktOptions(const OGRWktOptions&) = default;
93
94 private:
95 static int getDefaultPrecision();
96 static bool getDefaultRound();
97 };
98
102 class OGRRawPoint
103 {
104 public:
106 OGRRawPoint() : x(0.0), y(0.0) {}
107
109 OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn) {}
110
112 double x;
114 double y;
115 };
116
118 typedef struct GEOSGeom_t *GEOSGeom;
120 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
122 typedef void sfcgal_geometry_t;
123
124 class OGRPoint;
125 class OGRCurve;
126 class OGRCompoundCurve;
127 class OGRSimpleCurve;
128 class OGRLinearRing;
129 class OGRLineString;
130 class OGRCircularString;
131 class OGRSurface;
132 class OGRCurvePolygon;
133 class OGRPolygon;
134 class OGRMultiPoint;
135 class OGRMultiSurface;
136 class OGRMultiPolygon;
137 class OGRMultiCurve;
138 class OGRMultiLineString;
139 class OGRGeometryCollection;
140 class OGRTriangle;
141 class OGRPolyhedralSurface;
142 class OGRTriangulatedSurface;
143
145 typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
146 typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
147
148 typedef OGRPolygon* (*OGRSurfaceCasterToPolygon)(OGRSurface*);
149 typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
150 typedef OGRMultiPolygon* (*OGRPolyhedralSurfaceCastToMultiPolygon)(OGRPolyhedralSurface*);
152
156 class CPL_DLL IOGRGeometryVisitor
157 {
158 public:
160 virtual ~IOGRGeometryVisitor() = default;
161
163 virtual void visit(OGRPoint*) = 0;
165 virtual void visit(OGRLineString*) = 0;
167 virtual void visit(OGRLinearRing*) = 0;
169 virtual void visit(OGRPolygon*) = 0;
171 virtual void visit(OGRMultiPoint*) = 0;
173 virtual void visit(OGRMultiLineString*) = 0;
175 virtual void visit(OGRMultiPolygon*) = 0;
177 virtual void visit(OGRGeometryCollection*) = 0;
179 virtual void visit(OGRCircularString*) = 0;
181 virtual void visit(OGRCompoundCurve*) = 0;
183 virtual void visit(OGRCurvePolygon*) = 0;
185 virtual void visit(OGRMultiCurve*) = 0;
187 virtual void visit(OGRMultiSurface*) = 0;
189 virtual void visit(OGRTriangle*) = 0;
191 virtual void visit(OGRPolyhedralSurface*) = 0;
193 virtual void visit(OGRTriangulatedSurface*) = 0;
194 };
195
203 class CPL_DLL OGRDefaultGeometryVisitor: public IOGRGeometryVisitor
204 {
205 void _visit(OGRSimpleCurve* poGeom);
206
207 public:
208
209 void visit(OGRPoint*) override {}
210 void visit(OGRLineString*) override;
211 void visit(OGRLinearRing*) override;
212 void visit(OGRPolygon*) override;
213 void visit(OGRMultiPoint*) override;
214 void visit(OGRMultiLineString*) override;
215 void visit(OGRMultiPolygon*) override;
216 void visit(OGRGeometryCollection*) override;
217 void visit(OGRCircularString*) override;
218 void visit(OGRCompoundCurve*) override;
219 void visit(OGRCurvePolygon*) override;
220 void visit(OGRMultiCurve*) override;
221 void visit(OGRMultiSurface*) override;
222 void visit(OGRTriangle*) override;
223 void visit(OGRPolyhedralSurface*) override;
224 void visit(OGRTriangulatedSurface*) override;
225 };
226
230 class CPL_DLL IOGRConstGeometryVisitor
231 {
232 public:
234 virtual ~IOGRConstGeometryVisitor() = default;
235
237 virtual void visit(const OGRPoint*) = 0;
239 virtual void visit(const OGRLineString*) = 0;
241 virtual void visit(const OGRLinearRing*) = 0;
243 virtual void visit(const OGRPolygon*) = 0;
245 virtual void visit(const OGRMultiPoint*) = 0;
247 virtual void visit(const OGRMultiLineString*) = 0;
249 virtual void visit(const OGRMultiPolygon*) = 0;
251 virtual void visit(const OGRGeometryCollection*) = 0;
253 virtual void visit(const OGRCircularString*) = 0;
255 virtual void visit(const OGRCompoundCurve*) = 0;
257 virtual void visit(const OGRCurvePolygon*) = 0;
259 virtual void visit(const OGRMultiCurve*) = 0;
261 virtual void visit(const OGRMultiSurface*) = 0;
263 virtual void visit(const OGRTriangle*) = 0;
265 virtual void visit(const OGRPolyhedralSurface*) = 0;
267 virtual void visit(const OGRTriangulatedSurface*) = 0;
268 };
269
277 class CPL_DLL OGRDefaultConstGeometryVisitor: public IOGRConstGeometryVisitor
278 {
279 void _visit(const OGRSimpleCurve* poGeom);
280
281 public:
282
283 void visit(const OGRPoint*) override {}
284 void visit(const OGRLineString*) override;
285 void visit(const OGRLinearRing*) override;
286 void visit(const OGRPolygon*) override;
287 void visit(const OGRMultiPoint*) override;
288 void visit(const OGRMultiLineString*) override;
289 void visit(const OGRMultiPolygon*) override;
290 void visit(const OGRGeometryCollection*) override;
291 void visit(const OGRCircularString*) override;
292 void visit(const OGRCompoundCurve*) override;
293 void visit(const OGRCurvePolygon*) override;
294 void visit(const OGRMultiCurve*) override;
295 void visit(const OGRMultiSurface*) override;
296 void visit(const OGRTriangle*) override;
297 void visit(const OGRPolyhedralSurface*) override;
298 void visit(const OGRTriangulatedSurface*) override;
299 };
300
301 /************************************************************************/
302 /* OGRGeometry */
303 /************************************************************************/
304
325 class CPL_DLL OGRGeometry
326 {
327 private:
328 OGRSpatialReference * poSRS = nullptr; // may be NULL
329
330 protected:
332 friend class OGRCurveCollection;
333
334 unsigned int flags = 0;
335
336 OGRErr importPreambleFromWkt( const char ** ppszInput,
337 int* pbHasZ, int* pbHasM,
338 bool* pbIsEmpty );
339 OGRErr importCurveCollectionFromWkt(
340 const char ** ppszInput,
341 int bAllowEmptyComponent,
342 int bAllowLineString,
343 int bAllowCurve,
344 int bAllowCompoundCurve,
345 OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf,
346 OGRCurve* poCurve) );
347 OGRErr importPreambleFromWkb( const unsigned char * pabyData,
348 int nSize,
349 OGRwkbByteOrder& eByteOrder,
350 OGRwkbVariant eWkbVariant );
351 OGRErr importPreambleOfCollectionFromWkb(
352 const unsigned char * pabyData,
353 int& nSize,
354 int& nDataOffset,
355 OGRwkbByteOrder& eByteOrder,
356 int nMinSubGeomSize,
357 int& nGeomCount,
358 OGRwkbVariant eWkbVariant );
359 OGRErr PointOnSurfaceInternal( OGRPoint * poPoint ) const;
360 OGRBoolean IsSFCGALCompatible() const;
361
362 void HomogenizeDimensionalityWith( OGRGeometry* poOtherGeom );
363 std::string wktTypeString(OGRwkbVariant variant) const;
364
366
367 public:
368
369 /************************************************************************/
370 /* Bit flags for OGRGeometry */
371 /* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
372 /* Do not use these outside of the core. */
373 /* Use Is3D, IsMeasured, set3D, and setMeasured instead */
374 /************************************************************************/
375
377 static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
378 static const unsigned int OGR_G_3D = 0x2;
379 static const unsigned int OGR_G_MEASURED = 0x4;
381
382 OGRGeometry();
383 OGRGeometry( const OGRGeometry& other );
384 virtual ~OGRGeometry();
385
386 OGRGeometry& operator=( const OGRGeometry& other );
387
389 bool operator==( const OGRGeometry& other ) const { return CPL_TO_BOOL(Equals(&other)); }
390
392 bool operator!=( const OGRGeometry& other ) const { return !CPL_TO_BOOL(Equals(&other)); }
393
394 // Standard IGeometry.
395 virtual int getDimension() const = 0;
396 virtual int getCoordinateDimension() const;
397 int CoordinateDimension() const;
398 virtual OGRBoolean IsEmpty() const = 0;
399 virtual OGRBoolean IsValid() const;
400 virtual OGRGeometry* MakeValid() const;
401 virtual OGRBoolean IsSimple() const;
403 OGRBoolean Is3D() const { return flags & OGR_G_3D; }
405 OGRBoolean IsMeasured() const { return flags & OGR_G_MEASURED; }
406 virtual OGRBoolean IsRing() const;
407 virtual void empty() = 0;
408 virtual OGRGeometry *clone() const CPL_WARN_UNUSED_RESULT = 0;
409 virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
410 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
411
412 // IWks Interface.
413 virtual int WkbSize() const = 0;
414 OGRErr importFromWkb( const GByte*, int=-1,
415 OGRwkbVariant=wkbVariantOldOgc );
416 virtual OGRErr importFromWkb( const unsigned char *,
417 int,
418 OGRwkbVariant,
419 int& nBytesConsumedOut ) = 0;
420 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
421 OGRwkbVariant=wkbVariantOldOgc ) const = 0;
422 virtual OGRErr importFromWkt( const char ** ppszInput ) = 0;
423
424 #ifndef DOXYGEN_XML
425
428 OGRErr importFromWkt( char ** ppszInput )
430 CPL_WARN_DEPRECATED("Use importFromWkt(const char**) instead")
432 {
433 return importFromWkt( const_cast<const char**>(ppszInput) );
434 }
435 #endif
436
437 OGRErr exportToWkt( char ** ppszDstText,
438 OGRwkbVariant=wkbVariantOldOgc ) const;
439
444 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
445 OGRErr *err = nullptr) const = 0;
446
447 // Non-standard.
448 virtual OGRwkbGeometryType getGeometryType() const = 0;
449 OGRwkbGeometryType getIsoGeometryType() const;
450 virtual const char *getGeometryName() const = 0;
451 virtual void dumpReadable( FILE *, const char * = nullptr
452 , char** papszOptions = nullptr ) const;
453 virtual void flattenTo2D() = 0;
454 virtual char * exportToGML( const char* const * papszOptions = nullptr ) const;
455 virtual char * exportToKML() const;
456 virtual char * exportToJson() const;
457
459 virtual void accept(IOGRGeometryVisitor* visitor) = 0;
460
462 virtual void accept(IOGRConstGeometryVisitor* visitor) const = 0;
463
464 static GEOSContextHandle_t createGEOSContext();
465 static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
466 virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
467 const CPL_WARN_UNUSED_RESULT;
468 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
469 virtual OGRGeometry* getCurveGeometry(
470 const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
471 virtual OGRGeometry* getLinearGeometry(
472 double dfMaxAngleStepSizeDegrees = 0,
473 const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
474
475 // SFCGAL interfacing methods.
477 static sfcgal_geometry_t* OGRexportToSFCGAL( const OGRGeometry *poGeom );
478 static OGRGeometry* SFCGALexportToOGR( const sfcgal_geometry_t* _geometry );
480 virtual void closeRings();
481
482 virtual void setCoordinateDimension( int nDimension );
483 virtual void set3D( OGRBoolean bIs3D );
484 virtual void setMeasured( OGRBoolean bIsMeasured );
485
486 virtual void assignSpatialReference( OGRSpatialReference * poSR );
487 OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
488
489 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) = 0;
490 OGRErr transformTo( OGRSpatialReference *poSR );
491
492 virtual void segmentize(double dfMaxLength);
493
494 // ISpatialRelation
495 virtual OGRBoolean Intersects( const OGRGeometry * ) const;
496 virtual OGRBoolean Equals( const OGRGeometry * ) const = 0;
497 virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
498 virtual OGRBoolean Touches( const OGRGeometry * ) const;
499 virtual OGRBoolean Crosses( const OGRGeometry * ) const;
500 virtual OGRBoolean Within( const OGRGeometry * ) const;
501 virtual OGRBoolean Contains( const OGRGeometry * ) const;
502 virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
503 // virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
504 // virtual OGRGeometry *LocateAlong( double mValue ) const;
505 // virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
506
507 virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
508 virtual double Distance( const OGRGeometry * ) const ;
509 virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
510 virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
511 const CPL_WARN_UNUSED_RESULT;
512 virtual OGRGeometry *Intersection( const OGRGeometry *)
513 const CPL_WARN_UNUSED_RESULT;
514 virtual OGRGeometry *Union( const OGRGeometry * )
515 const CPL_WARN_UNUSED_RESULT;
516 virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
517 virtual OGRGeometry *Difference( const OGRGeometry * )
518 const CPL_WARN_UNUSED_RESULT;
519 virtual OGRGeometry *SymDifference( const OGRGeometry * )
520 const CPL_WARN_UNUSED_RESULT;
521 virtual OGRErr Centroid( OGRPoint * poPoint ) const;
522 virtual OGRGeometry *Simplify(double dTolerance)
523 const CPL_WARN_UNUSED_RESULT;
524 OGRGeometry *SimplifyPreserveTopology(double dTolerance)
525 const CPL_WARN_UNUSED_RESULT;
526 virtual OGRGeometry *DelaunayTriangulation(
527 double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
528
529 virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
530
531 virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
532
534 // backward compatibility to non-standard method names.
535 OGRBoolean Intersect( OGRGeometry * )
536 const CPL_WARN_DEPRECATED("Non standard method. "
537 "Use Intersects() instead");
538 OGRBoolean Equal( OGRGeometry * )
539 const CPL_WARN_DEPRECATED("Non standard method. "
540 "Use Equals() instead");
541 OGRGeometry *SymmetricDifference( const OGRGeometry * )
542 const CPL_WARN_DEPRECATED("Non standard method. "
543 "Use SymDifference() instead");
544 OGRGeometry *getBoundary()
545 const CPL_WARN_DEPRECATED("Non standard method. "
546 "Use Boundary() instead");
548
550 // Special HACK for DB2 7.2 support
551 static int bGenerate_DB2_V72_BYTE_ORDER;
553
554 virtual void swapXY();
556 static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
557 static OGRGeometry* CastToError( OGRGeometry* poGeom );
559
563 static inline OGRGeometryH ToHandle(OGRGeometry* poGeom)
564 { return reinterpret_cast<OGRGeometryH>(poGeom); }
565
569 static inline OGRGeometry* FromHandle(OGRGeometryH hGeom)
570 { return reinterpret_cast<OGRGeometry*>(hGeom); }
571
576 inline OGRPoint* toPoint()
577 { return cpl::down_cast<OGRPoint*>(this); }
578
583 inline const OGRPoint* toPoint() const
584 { return cpl::down_cast<const OGRPoint*>(this); }
585
590 inline OGRCurve* toCurve()
591 { return cpl::down_cast<OGRCurve*>(this); }
592
597 inline const OGRCurve* toCurve() const
598 { return cpl::down_cast<const OGRCurve*>(this); }
599
604 inline OGRSimpleCurve* toSimpleCurve()
605 { return cpl::down_cast<OGRSimpleCurve*>(this); }
606
611 inline const OGRSimpleCurve* toSimpleCurve() const
612 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
613
618 inline OGRLineString* toLineString()
619 { return cpl::down_cast<OGRLineString*>(this); }
620
625 inline const OGRLineString* toLineString() const
626 { return cpl::down_cast<const OGRLineString*>(this); }
627
632 inline OGRLinearRing* toLinearRing()
633 { return cpl::down_cast<OGRLinearRing*>(this); }
634
639 inline const OGRLinearRing* toLinearRing() const
640 { return cpl::down_cast<const OGRLinearRing*>(this); }
641
646 inline OGRCircularString* toCircularString()
647 { return cpl::down_cast<OGRCircularString*>(this); }
648
653 inline const OGRCircularString* toCircularString() const
654 { return cpl::down_cast<const OGRCircularString*>(this); }
655
660 inline OGRCompoundCurve* toCompoundCurve()
661 { return cpl::down_cast<OGRCompoundCurve*>(this); }
662
667 inline const OGRCompoundCurve* toCompoundCurve() const
668 { return cpl::down_cast<const OGRCompoundCurve*>(this); }
669
674 inline OGRSurface* toSurface()
675 { return cpl::down_cast<OGRSurface*>(this); }
676
681 inline const OGRSurface* toSurface() const
682 { return cpl::down_cast<const OGRSurface*>(this); }
683
688 inline OGRPolygon* toPolygon()
689 { return cpl::down_cast<OGRPolygon*>(this); }
690
695 inline const OGRPolygon* toPolygon() const
696 { return cpl::down_cast<const OGRPolygon*>(this); }
697
702 inline OGRTriangle* toTriangle()
703 { return cpl::down_cast<OGRTriangle*>(this); }
704
709 inline const OGRTriangle* toTriangle() const
710 { return cpl::down_cast<const OGRTriangle*>(this); }
711
716 inline OGRCurvePolygon* toCurvePolygon()
717 { return cpl::down_cast<OGRCurvePolygon*>(this); }
718
723 inline const OGRCurvePolygon* toCurvePolygon() const
724 { return cpl::down_cast<const OGRCurvePolygon*>(this); }
725
730 inline OGRGeometryCollection* toGeometryCollection()
731 { return cpl::down_cast<OGRGeometryCollection*>(this); }
732
737 inline const OGRGeometryCollection* toGeometryCollection() const
738 { return cpl::down_cast<const OGRGeometryCollection*>(this); }
739
744 inline OGRMultiPoint* toMultiPoint()
745 { return cpl::down_cast<OGRMultiPoint*>(this); }
746
751 inline const OGRMultiPoint* toMultiPoint() const
752 { return cpl::down_cast<const OGRMultiPoint*>(this); }
753
758 inline OGRMultiLineString* toMultiLineString()
759 { return cpl::down_cast<OGRMultiLineString*>(this); }
760
765 inline const OGRMultiLineString* toMultiLineString() const
766 { return cpl::down_cast<const OGRMultiLineString*>(this); }
767
772 inline OGRMultiPolygon* toMultiPolygon()
773 { return cpl::down_cast<OGRMultiPolygon*>(this); }
774
779 inline const OGRMultiPolygon* toMultiPolygon() const
780 { return cpl::down_cast<const OGRMultiPolygon*>(this); }
781
786 inline OGRMultiCurve* toMultiCurve()
787 { return cpl::down_cast<OGRMultiCurve*>(this); }
788
793 inline const OGRMultiCurve* toMultiCurve() const
794 { return cpl::down_cast<const OGRMultiCurve*>(this); }
795
800 inline OGRMultiSurface* toMultiSurface()
801 { return cpl::down_cast<OGRMultiSurface*>(this); }
802
807 inline const OGRMultiSurface* toMultiSurface() const
808 { return cpl::down_cast<const OGRMultiSurface*>(this); }
809
814 inline OGRPolyhedralSurface* toPolyhedralSurface()
815 { return cpl::down_cast<OGRPolyhedralSurface*>(this); }
816
821 inline const OGRPolyhedralSurface* toPolyhedralSurface() const
822 { return cpl::down_cast<const OGRPolyhedralSurface*>(this); }
823
828 inline OGRTriangulatedSurface* toTriangulatedSurface()
829 { return cpl::down_cast<OGRTriangulatedSurface*>(this); }
830
835 inline const OGRTriangulatedSurface* toTriangulatedSurface() const
836 { return cpl::down_cast<const OGRTriangulatedSurface*>(this); }
837
838 };
839
841 struct CPL_DLL OGRGeometryUniquePtrDeleter
842 {
843 void operator()(OGRGeometry*) const;
844 };
846
850 typedef std::unique_ptr<OGRGeometry, OGRGeometryUniquePtrDeleter> OGRGeometryUniquePtr;
851
852 /************************************************************************/
853 /* OGRPoint */
854 /************************************************************************/
855
862 class CPL_DLL OGRPoint : public OGRGeometry
863 {
864 double x;
865 double y;
866 double z;
867 double m;
868
869 public:
870 OGRPoint();
871 OGRPoint( double x, double y );
872 OGRPoint( double x, double y, double z );
873 OGRPoint( double x, double y, double z, double m );
874 OGRPoint( const OGRPoint& other );
875 static OGRPoint* createXYM( double x, double y, double m );
876 ~OGRPoint() override;
877
878 OGRPoint& operator=( const OGRPoint& other );
879
880 // IWks Interface
881 int WkbSize() const override;
882 OGRErr importFromWkb( const unsigned char *,
883 int,
884 OGRwkbVariant,
885 int& nBytesConsumedOut ) override;
886 OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
887 OGRwkbVariant=wkbVariantOldOgc )
888 const override;
889
890 #ifndef DOXYGEN_XML
891 using OGRGeometry::importFromWkt;
892 #endif
893
894 OGRErr importFromWkt( const char ** ) override;
895
896 #ifndef DOXYGEN_XML
897 using OGRGeometry::exportToWkt;
898 #endif
899
904 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
905 OGRErr *err = nullptr) const override;
906
907 // IGeometry
908 virtual int getDimension() const override;
909 virtual OGRGeometry *clone() const override;
910 virtual void empty() override;
911 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
912 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
913 virtual OGRBoolean IsEmpty() const override
914 { return !(flags & OGR_G_NOT_EMPTY_POINT); }
915
916 // IPoint
918 double getX() const { return x; }
920 double getY() const { return y; }
922 double getZ() const { return z; }
924 double getM() const { return m; }
925
926 // Non standard
927 virtual void setCoordinateDimension( int nDimension ) override;
931 void setX( double xIn ) { x = xIn; flags |= OGR_G_NOT_EMPTY_POINT; }
935 void setY( double yIn ) { y = yIn; flags |= OGR_G_NOT_EMPTY_POINT; }
939 void setZ( double zIn )
940 { z = zIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_3D); }
944 void setM( double mIn )
945 { m = mIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_MEASURED); }
946
947 // ISpatialRelation
948 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
949 virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
950 virtual OGRBoolean Within( const OGRGeometry * ) const override;
951
952 // Non standard from OGRGeometry
953 virtual const char *getGeometryName() const override;
954 virtual OGRwkbGeometryType getGeometryType() const override;
955 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
956 virtual void flattenTo2D() override;
957 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
958 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
959
960 virtual void swapXY() override;
961 };
962
963 /************************************************************************/
964 /* OGRPointIterator */
965 /************************************************************************/
966
973 class CPL_DLL OGRPointIterator
974 {
975 public:
976 virtual ~OGRPointIterator();
977 virtual OGRBoolean getNextPoint( OGRPoint* p ) = 0;
978
979 static void destroy( OGRPointIterator* );
980 };
981
982 /************************************************************************/
983 /* OGRCurve */
984 /************************************************************************/
985
991 class CPL_DLL OGRCurve : public OGRGeometry
992 {
993 protected:
995 OGRCurve();
996 OGRCurve( const OGRCurve& other );
997
998 virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
999 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
1000
1001 friend class OGRCurvePolygon;
1002 friend class OGRCompoundCurve;
1004 virtual int ContainsPoint( const OGRPoint* p ) const;
1005 virtual int IntersectsPoint( const OGRPoint* p ) const;
1006 virtual double get_AreaOfCurveSegments() const = 0;
1007
1008 private:
1009
1010 class CPL_DLL ConstIterator
1011 {
1012 struct Private;
1013 std::unique_ptr<Private> m_poPrivate;
1014 public:
1015 ConstIterator(const OGRCurve* poSelf, bool bStart);
1016 ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1017 ~ConstIterator();
1018 const OGRPoint& operator*() const;
1019 ConstIterator& operator++();
1020 bool operator!=(const ConstIterator& it) const;
1021 };
1022
1023 friend inline ConstIterator begin(const OGRCurve*);
1024 friend inline ConstIterator end(const OGRCurve*);
1025
1026 public:
1027 ~OGRCurve() override;
1028
1030 OGRCurve& operator=( const OGRCurve& other );
1032
1034 typedef OGRPoint ChildType;
1035
1044 ConstIterator begin() const;
1046 ConstIterator end() const;
1047
1048 // ICurve methods
1049 virtual double get_Length() const = 0;
1050 virtual void StartPoint( OGRPoint * ) const = 0;
1051 virtual void EndPoint( OGRPoint * ) const = 0;
1052 virtual int get_IsClosed() const;
1053 virtual void Value( double, OGRPoint * ) const = 0;
1054 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1055 const char* const* papszOptions = nullptr)
1056 const = 0;
1057 virtual int getDimension() const override;
1058
1059 // non standard
1060 virtual int getNumPoints() const = 0;
1061 virtual OGRPointIterator* getPointIterator() const = 0;
1062 virtual OGRBoolean IsConvex() const;
1063 virtual double get_Area() const = 0;
1064
1067 inline OGRSimpleCurve* toSimpleCurve()
1068 { return cpl::down_cast<OGRSimpleCurve*>(this); }
1069
1072 inline const OGRSimpleCurve* toSimpleCurve() const
1073 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
1074
1075 static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
1076 static OGRLineString* CastToLineString( OGRCurve* poCurve );
1077 static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
1078 };
1079
1081
1082 inline OGRCurve::ConstIterator begin(const OGRCurve* poCurve) { return poCurve->begin(); }
1084 inline OGRCurve::ConstIterator end(const OGRCurve* poCurve) { return poCurve->end(); }
1086
1087 /************************************************************************/
1088 /* OGRSimpleCurve */
1089 /************************************************************************/
1090
1100 class CPL_DLL OGRSimpleCurve: public OGRCurve
1101 {
1102 protected:
1104 friend class OGRGeometry;
1105
1106 int nPointCount;
1107 OGRRawPoint *paoPoints;
1108 double *padfZ;
1109 double *padfM;
1110
1111 void Make3D();
1112 void Make2D();
1113 void RemoveM();
1114 void AddM();
1115
1116 OGRErr importFromWKTListOnly( const char ** ppszInput, int bHasZ, int bHasM,
1117 OGRRawPoint*& paoPointsIn,
1118 int& nMaxPoints,
1119 double*& padfZIn );
1120
1122
1123 virtual double get_LinearArea() const;
1124
1125 OGRSimpleCurve();
1126 OGRSimpleCurve( const OGRSimpleCurve& other );
1127
1128 private:
1129 class CPL_DLL Iterator
1130 {
1131 struct Private;
1132 std::unique_ptr<Private> m_poPrivate;
1133 void update();
1134 public:
1135 Iterator(OGRSimpleCurve* poSelf, int nPos);
1136 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1137 ~Iterator();
1138 OGRPoint& operator*();
1139 Iterator& operator++();
1140 bool operator!=(const Iterator& it) const;
1141 };
1142
1143 friend inline Iterator begin(OGRSimpleCurve*);
1144 friend inline Iterator end(OGRSimpleCurve*);
1145
1146 class CPL_DLL ConstIterator
1147 {
1148 struct Private;
1149 std::unique_ptr<Private> m_poPrivate;
1150 public:
1151 ConstIterator(const OGRSimpleCurve* poSelf, int nPos);
1152 ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1153 ~ConstIterator();
1154 const OGRPoint& operator*() const;
1155 ConstIterator& operator++();
1156 bool operator!=(const ConstIterator& it) const;
1157 };
1158
1159 friend inline ConstIterator begin(const OGRSimpleCurve*);
1160 friend inline ConstIterator end(const OGRSimpleCurve*);
1161
1162 public:
1163 ~OGRSimpleCurve() override;
1164
1165 OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
1166
1168 typedef OGRPoint ChildType;
1169
1178 Iterator begin();
1180 Iterator end();
1189 ConstIterator begin() const;
1191 ConstIterator end() const;
1192
1193 // IWks Interface.
1194 virtual int WkbSize() const override;
1195 virtual OGRErr importFromWkb( const unsigned char *,
1196 int,
1197 OGRwkbVariant,
1198 int& nBytesConsumedOut ) override;
1199 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1200 OGRwkbVariant=wkbVariantOldOgc )
1201 const override;
1202
1203 #ifndef DOXYGEN_XML
1204 using OGRGeometry::importFromWkt;
1205 #endif
1206
1207 OGRErr importFromWkt( const char ** ) override;
1208
1209 #ifndef DOXYGEN_XML
1210 using OGRGeometry::exportToWkt;
1211 #endif
1212
1217 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
1218 OGRErr *err = nullptr) const override;
1219
1220 // IGeometry interface.
1221 virtual OGRGeometry *clone() const override;
1222 virtual void empty() override;
1223 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1224 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1225 virtual OGRBoolean IsEmpty() const override;
1226
1227 // ICurve methods.
1228 virtual double get_Length() const override;
1229 virtual void StartPoint( OGRPoint * ) const override;
1230 virtual void EndPoint( OGRPoint * ) const override;
1231 virtual void Value( double, OGRPoint * ) const override;
1232 virtual double Project( const OGRPoint * ) const;
1233 virtual OGRLineString* getSubLine( double, double, int ) const;
1234
1235 // ILineString methods.
1236 virtual int getNumPoints() const override { return nPointCount; }
1237 void getPoint( int, OGRPoint * ) const;
1238 double getX( int i ) const { return paoPoints[i].x; }
1239 double getY( int i ) const { return paoPoints[i].y; }
1240 double getZ( int i ) const;
1241 double getM( int i ) const;
1242
1243 // ISpatialRelation
1244 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1245
1246 // non standard.
1247 virtual void setCoordinateDimension( int nDimension ) override;
1248 virtual void set3D( OGRBoolean bIs3D ) override;
1249 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1250 void setNumPoints( int nNewPointCount,
1251 int bZeroizeNewContent = TRUE );
1252 void setPoint( int, OGRPoint * );
1253 void setPoint( int, double, double );
1254 void setZ( int, double );
1255 void setM( int, double );
1256 void setPoint( int, double, double, double );
1257 void setPointM( int, double, double, double );
1258 void setPoint( int, double, double, double, double );
1259 void setPoints( int, const OGRRawPoint *, const double * = nullptr );
1260 void setPointsM( int, const OGRRawPoint *, const double * );
1261 void setPoints( int, const OGRRawPoint *, const double *, const double * );
1262 void setPoints( int, const double * padfX, const double * padfY,
1263 const double *padfZIn = nullptr );
1264 void setPointsM( int, const double * padfX, const double * padfY,
1265 const double *padfMIn = nullptr );
1266 void setPoints( int, const double * padfX, const double * padfY,
1267 const double *padfZIn, const double *padfMIn );
1268 void addPoint( const OGRPoint * );
1269 void addPoint( double, double );
1270 void addPoint( double, double, double );
1271 void addPointM( double, double, double );
1272 void addPoint( double, double, double, double );
1273
1274 void getPoints( OGRRawPoint *, double * = nullptr ) const;
1275 void getPoints( void* pabyX, int nXStride,
1276 void* pabyY, int nYStride,
1277 void* pabyZ = nullptr, int nZStride = 0,
1278 void* pabyM = nullptr, int nMStride = 0 ) const;
1279
1280 void addSubLineString( const OGRLineString *,
1281 int nStartVertex = 0, int nEndVertex = -1 );
1282 void reversePoints( void );
1283 virtual OGRPointIterator* getPointIterator() const override;
1284
1285 // non-standard from OGRGeometry
1286 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1287 virtual void flattenTo2D() override;
1288 virtual void segmentize(double dfMaxLength) override;
1289
1290 virtual void swapXY() override;
1291 };
1292
1294
1295 inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1297 inline OGRSimpleCurve::Iterator end(OGRSimpleCurve* poCurve) { return poCurve->end(); }
1298
1300 inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1302 inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve* poCurve) { return poCurve->end(); }
1304
1305 /************************************************************************/
1306 /* OGRLineString */
1307 /************************************************************************/
1308
1316 class CPL_DLL OGRLineString : public OGRSimpleCurve
1317 {
1318 // cppcheck-suppress unusedPrivateFunction
1319 static OGRLinearRing* CasterToLinearRing(OGRCurve* poCurve);
1320
1321 protected:
1323 static OGRLineString* TransferMembersAndDestroy(
1324 OGRLineString* poSrc,
1325 OGRLineString* poDst);
1326
1327 virtual OGRCurveCasterToLineString GetCasterToLineString()
1328 const override;
1329 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1330 const override;
1331
1332 virtual double get_AreaOfCurveSegments() const override;
1334
1335 static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
1336
1337 public:
1338 OGRLineString();
1339 OGRLineString( const OGRLineString& other );
1340 ~OGRLineString() override;
1341
1342 OGRLineString& operator=(const OGRLineString& other);
1343
1344 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1345 const char* const* papszOptions = nullptr )
1346 const override;
1347 virtual OGRGeometry* getCurveGeometry(
1348 const char* const* papszOptions = nullptr ) const override;
1349 virtual double get_Area() const override;
1350
1351 // Non-standard from OGRGeometry.
1352 virtual OGRwkbGeometryType getGeometryType() const override;
1353 virtual const char *getGeometryName() const override;
1354
1356 inline OGRSimpleCurve* toUpperClass() { return this; }
1358 inline const OGRSimpleCurve* toUpperClass() const { return this; }
1359
1360 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1361 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1362 };
1363
1364 /************************************************************************/
1365 /* OGRLinearRing */
1366 /************************************************************************/
1367
1388 class CPL_DLL OGRLinearRing : public OGRLineString
1389 {
1390 static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1391
1392 protected:
1394 friend class OGRPolygon;
1395 friend class OGRTriangle;
1396
1397 // These are not IWks compatible ... just a convenience for OGRPolygon.
1398 virtual int _WkbSize( int _flags ) const;
1399 virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
1400 const unsigned char *, int,
1401 int& nBytesConsumedOut );
1402 virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
1403 unsigned char * ) const;
1404
1405 virtual OGRCurveCasterToLineString GetCasterToLineString()
1406 const override;
1407 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1408 const override;
1410
1411 static OGRLineString* CastToLineString( OGRLinearRing* poLR );
1412
1413 public:
1414 OGRLinearRing();
1415 OGRLinearRing( const OGRLinearRing& other );
1416 explicit OGRLinearRing( OGRLinearRing * );
1417 ~OGRLinearRing() override;
1418
1419 OGRLinearRing& operator=( const OGRLinearRing& other );
1420
1421 // Non standard.
1422 virtual const char *getGeometryName() const override;
1423 virtual OGRGeometry *clone() const override;
1424 virtual int isClockwise() const;
1425 virtual void reverseWindingOrder();
1426 virtual void closeRings() override;
1427 OGRBoolean isPointInRing( const OGRPoint* pt,
1428 int bTestEnvelope = TRUE ) const;
1429 OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
1430 int bTestEnvelope = TRUE ) const;
1431 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1432
1434 inline OGRLineString* toUpperClass() { return this; }
1436 inline const OGRLineString* toUpperClass() const { return this; }
1437
1438 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1439 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1440
1441 // IWks Interface - Note this isn't really a first class object
1442 // for the purposes of WKB form. These methods always fail since this
1443 // object can't be serialized on its own.
1444 virtual int WkbSize() const override;
1445 virtual OGRErr importFromWkb( const unsigned char *,
1446 int,
1447 OGRwkbVariant,
1448 int& nBytesConsumedOut ) override;
1449 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1450 OGRwkbVariant=wkbVariantOldOgc )
1451 const override;
1452 };
1453
1454 /************************************************************************/
1455 /* OGRCircularString */
1456 /************************************************************************/
1457
1470 class CPL_DLL OGRCircularString : public OGRSimpleCurve
1471 {
1472 private:
1473 void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
1474 OGRBoolean IsValidFast() const;
1475 int IsFullCircle( double& cx, double& cy, double& square_R ) const;
1476
1477 protected:
1479 virtual OGRCurveCasterToLineString GetCasterToLineString()
1480 const override;
1481 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1482 const override;
1483 virtual int IntersectsPoint( const OGRPoint* p ) const override;
1484 virtual int ContainsPoint( const OGRPoint* p ) const override;
1485 virtual double get_AreaOfCurveSegments() const override;
1487
1488 public:
1489 OGRCircularString();
1490 OGRCircularString( const OGRCircularString& other );
1491 ~OGRCircularString() override;
1492
1493 OGRCircularString& operator=(const OGRCircularString& other);
1494
1495 // IWks Interface.
1496 virtual OGRErr importFromWkb( const unsigned char *,
1497 int,
1498 OGRwkbVariant,
1499 int& nBytesConsumedOut ) override;
1500 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1501 OGRwkbVariant=wkbVariantOldOgc )
1502 const override;
1503
1504 #ifndef DOXYGEN_XML
1505 using OGRGeometry::importFromWkt;
1506 #endif
1507
1508 OGRErr importFromWkt( const char ** ) override;
1509
1510 #ifndef DOXYGEN_XML
1511 using OGRGeometry::exportToWkt;
1512 #endif
1513
1518 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
1519 OGRErr *err = nullptr) const override;
1520
1521 // IGeometry interface.
1522 virtual OGRBoolean IsValid() const override;
1523 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1524 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1525
1526 // ICurve methods.
1527 virtual double get_Length() const override;
1528 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1529 const char* const* papszOptions = nullptr )
1530 const override;
1531 virtual void Value( double, OGRPoint * ) const override;
1532 virtual double get_Area() const override;
1533
1534 // Non-standard from OGRGeometry.
1535 virtual OGRwkbGeometryType getGeometryType() const override;
1536 virtual const char *getGeometryName() const override;
1537 virtual void segmentize( double dfMaxLength ) override;
1538 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1539 const override;
1540 virtual OGRGeometry* getLinearGeometry(
1541 double dfMaxAngleStepSizeDegrees = 0,
1542 const char* const* papszOptions = nullptr) const override;
1543
1545 inline OGRSimpleCurve* toUpperClass() { return this; }
1547 inline const OGRSimpleCurve* toUpperClass() const { return this; }
1548
1549 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1550 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1551 };
1552
1553 /************************************************************************/
1554 /* OGRCurveCollection */
1555 /************************************************************************/
1556
1567 class CPL_DLL OGRCurveCollection
1569 {
1570 protected:
1571 friend class OGRCompoundCurve;
1572 friend class OGRCurvePolygon;
1573 friend class OGRPolygon;
1574 friend class OGRTriangle;
1575
1576 int nCurveCount = 0;
1577 OGRCurve **papoCurves = nullptr;
1578
1579 public:
1580 OGRCurveCollection();
1581 OGRCurveCollection(const OGRCurveCollection& other);
1582 ~OGRCurveCollection();
1583
1584 OGRCurveCollection& operator=(const OGRCurveCollection& other);
1585
1587 typedef OGRCurve ChildType;
1588
1592 OGRCurve** begin() { return papoCurves; }
1594 OGRCurve** end() { return papoCurves + nCurveCount; }
1598 const OGRCurve* const* begin() const { return papoCurves; }
1600 const OGRCurve* const* end() const { return papoCurves + nCurveCount; }
1601
1602 void empty(OGRGeometry* poGeom);
1603 OGRBoolean IsEmpty() const;
1604 void getEnvelope( OGREnvelope * psEnvelope ) const;
1605 void getEnvelope( OGREnvelope3D * psEnvelope ) const;
1606
1607 OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
1608 int bNeedRealloc );
1609 int WkbSize() const;
1610 OGRErr importPreambleFromWkb( OGRGeometry* poGeom,
1611 const unsigned char * pabyData,
1612 int& nSize,
1613 int& nDataOffset,
1614 OGRwkbByteOrder& eByteOrder,
1615 int nMinSubGeomSize,
1616 OGRwkbVariant eWkbVariant );
1617 OGRErr importBodyFromWkb(
1618 OGRGeometry* poGeom,
1619 const unsigned char * pabyData,
1620 int nSize,
1621 int bAcceptCompoundCurve,
1622 OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
1623 OGRCurve* poCurve ),
1624 OGRwkbVariant eWkbVariant,
1625 int& nBytesConsumedOut );
1626 std::string exportToWkt(const OGRGeometry *geom, const OGRWktOptions& opts,
1627 OGRErr *err) const;
1628 OGRErr exportToWkb( const OGRGeometry* poGeom, OGRwkbByteOrder,
1629 unsigned char *,
1630 OGRwkbVariant eWkbVariant ) const;
1631 OGRBoolean Equals(const OGRCurveCollection *poOCC) const;
1632 void setCoordinateDimension( OGRGeometry* poGeom,
1633 int nNewDimension );
1634 void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
1635 void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
1636 void assignSpatialReference( OGRGeometry* poGeom, OGRSpatialReference * poSR );
1637 int getNumCurves() const;
1638 OGRCurve *getCurve( int );
1639 const OGRCurve *getCurve( int ) const;
1640 OGRCurve *stealCurve( int );
1641
1642 OGRErr removeCurve( int iIndex, bool bDelete = true );
1643
1644 OGRErr transform( OGRGeometry* poGeom,
1645 OGRCoordinateTransformation *poCT );
1646 void flattenTo2D( OGRGeometry* poGeom );
1647 void segmentize( double dfMaxLength );
1648 void swapXY();
1649 OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
1650 };
1652
1653 /************************************************************************/
1654 /* OGRCompoundCurve */
1655 /************************************************************************/
1656
1667 class CPL_DLL OGRCompoundCurve : public OGRCurve
1668 {
1669 private:
1670 OGRCurveCollection oCC{};
1671
1672 OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
1673 double dfToleranceEps,
1674 int bNeedRealloc );
1675 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1676 OGRCurve* poCurve );
1677 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1678 OGRCurve* poCurve );
1679 OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
1680 const char* const* papszOptions,
1681 int bIsLinearRing ) const;
1682 // cppcheck-suppress unusedPrivateFunction
1683 static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1684 // cppcheck-suppress unusedPrivateFunction
1685 static OGRLinearRing* CasterToLinearRing( OGRCurve* poCurve );
1686
1687 protected:
1689 static OGRLineString* CastToLineString( OGRCompoundCurve* poCC );
1690 static OGRLinearRing* CastToLinearRing( OGRCompoundCurve* poCC );
1691
1692 virtual OGRCurveCasterToLineString GetCasterToLineString()
1693 const override;
1694 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1695 const override;
1697
1698 public:
1699 OGRCompoundCurve();
1700 OGRCompoundCurve( const OGRCompoundCurve& other );
1701 ~OGRCompoundCurve() override;
1702
1703 OGRCompoundCurve& operator=( const OGRCompoundCurve& other );
1704
1706 typedef OGRCurve ChildType;
1707
1711 ChildType** begin() { return oCC.begin(); }
1713 ChildType** end() { return oCC.end(); }
1717 const ChildType* const * begin() const { return oCC.begin(); }
1719 const ChildType* const * end() const { return oCC.end(); }
1720
1721 // IWks Interface
1722 virtual int WkbSize() const override;
1723 virtual OGRErr importFromWkb( const unsigned char *,
1724 int,
1725 OGRwkbVariant,
1726 int& nBytesConsumedOut ) override;
1727 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1728 OGRwkbVariant=wkbVariantOldOgc )
1729 const override;
1730
1731 #ifndef DOXYGEN_XML
1732 using OGRGeometry::importFromWkt;
1733 #endif
1734
1735 OGRErr importFromWkt( const char ** ) override;
1736
1737 #ifndef DOXYGEN_XML
1738 using OGRGeometry::exportToWkt;
1739 #endif
1740
1745 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
1746 OGRErr *err = nullptr) const override;
1747
1748 // IGeometry interface.
1749 virtual OGRGeometry *clone() const override;
1750 virtual void empty() override;
1751 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1752 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1753 virtual OGRBoolean IsEmpty() const override;
1754
1755 // ICurve methods.
1756 virtual double get_Length() const override;
1757 virtual void StartPoint( OGRPoint * ) const override;
1758 virtual void EndPoint( OGRPoint * ) const override;
1759 virtual void Value( double, OGRPoint * ) const override;
1760 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1761 const char* const* papszOptions = nullptr )
1762 const override;
1763
1764 virtual int getNumPoints() const override;
1765 virtual double get_AreaOfCurveSegments() const override;
1766 virtual double get_Area() const override;
1767
1768 // ISpatialRelation.
1769 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1770
1771 // ICompoundCurve method.
1772 int getNumCurves() const;
1773 OGRCurve *getCurve( int );
1774 const OGRCurve *getCurve( int ) const;
1775
1776 // Non-standard.
1777 virtual void setCoordinateDimension( int nDimension ) override;
1778 virtual void set3D( OGRBoolean bIs3D ) override;
1779 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1780
1781 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1782
1783 OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
1784 OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
1785 OGRCurve *stealCurve( int );
1786 virtual OGRPointIterator* getPointIterator() const override;
1787
1788 // Non-standard from OGRGeometry.
1789 virtual OGRwkbGeometryType getGeometryType() const override;
1790 virtual const char *getGeometryName() const override;
1791 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1792 virtual void flattenTo2D() override;
1793 virtual void segmentize(double dfMaxLength) override;
1794 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
1795 const override;
1796 virtual OGRGeometry* getLinearGeometry(
1797 double dfMaxAngleStepSizeDegrees = 0,
1798 const char* const* papszOptions = nullptr) const override;
1799 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1800 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1801
1802 virtual void swapXY() override;
1803 };
1804
1806
1807 inline const OGRCompoundCurve::ChildType* const * begin(const OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1809 inline const OGRCompoundCurve::ChildType* const * end(const OGRCompoundCurve* poCurve) { return poCurve->end(); }
1810
1812 inline OGRCompoundCurve::ChildType** begin(OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1814 inline OGRCompoundCurve::ChildType** end(OGRCompoundCurve* poCurve) { return poCurve->end(); }
1816
1817 /************************************************************************/
1818 /* OGRSurface */
1819 /************************************************************************/
1820
1826 class CPL_DLL OGRSurface : public OGRGeometry
1827 {
1828 protected:
1830 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1831 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1833
1834 public:
1835 virtual double get_Area() const = 0;
1836 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const
1837 { return PointOnSurfaceInternal(poPoint); }
1839 static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1840 static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1842 };
1843
1844 /************************************************************************/
1845 /* OGRCurvePolygon */
1846 /************************************************************************/
1847
1861 class CPL_DLL OGRCurvePolygon : public OGRSurface
1862 {
1863 static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1864
1865 private:
1866 OGRBoolean IntersectsPoint( const OGRPoint* p ) const;
1867 OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1868 virtual int checkRing( OGRCurve * poNewRing ) const;
1869 OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1870 int bNeedRealloc );
1871 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1872 OGRCurve* poCurve );
1873 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1874 OGRCurve* poCurve );
1875
1876 protected:
1878 friend class OGRPolygon;
1879 friend class OGRTriangle;
1880 OGRCurveCollection oCC{};
1881
1882 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1883 const override;
1884 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1885 const override;
1887
1888 static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
1889
1890 public:
1891 OGRCurvePolygon();
1892 OGRCurvePolygon( const OGRCurvePolygon& );
1893 ~OGRCurvePolygon() override;
1894
1895 OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
1896
1898 typedef OGRCurve ChildType;
1899
1903 ChildType** begin() { return oCC.begin(); }
1905 ChildType** end() { return oCC.end(); }
1909 const ChildType* const * begin() const { return oCC.begin(); }
1911 const ChildType* const * end() const { return oCC.end(); }
1912
1913 // Non standard (OGRGeometry).
1914 virtual const char *getGeometryName() const override;
1915 virtual OGRwkbGeometryType getGeometryType() const override;
1916 virtual OGRGeometry *clone() const override;
1917 virtual void empty() override;
1918 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1919 virtual void flattenTo2D() override;
1920 virtual OGRBoolean IsEmpty() const override;
1921 virtual void segmentize( double dfMaxLength ) override;
1922 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1923 const override;
1924 virtual OGRGeometry* getLinearGeometry(
1925 double dfMaxAngleStepSizeDegrees = 0,
1926 const char* const* papszOptions = nullptr ) const override;
1927
1928 // ISurface Interface
1929 virtual double get_Area() const override;
1930
1931 // IWks Interface
1932 virtual int WkbSize() const override;
1933 virtual OGRErr importFromWkb( const unsigned char *,
1934 int,
1935 OGRwkbVariant,
1936 int& nBytesConsumedOut ) override;
1937 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1938 OGRwkbVariant=wkbVariantOldOgc )
1939 const override;
1940
1941 #ifndef DOXYGEN_XML
1942 using OGRGeometry::importFromWkt;
1943 #endif
1944
1945 OGRErr importFromWkt( const char ** ) override;
1946
1947 #ifndef DOXYGEN_XML
1948 using OGRGeometry::exportToWkt;
1949 #endif
1950
1955 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
1956 OGRErr *err = nullptr) const override;
1957
1958 // IGeometry
1959 virtual int getDimension() const override;
1960 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1961 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1962
1963 // ICurvePolygon
1964 virtual OGRPolygon* CurvePolyToPoly(
1965 double dfMaxAngleStepSizeDegrees = 0,
1966 const char* const* papszOptions = nullptr ) const;
1967
1968 // ISpatialRelation
1969 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1970 virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
1971 virtual OGRBoolean Contains( const OGRGeometry * ) const override;
1972
1973 // Non standard
1974 virtual void setCoordinateDimension( int nDimension ) override;
1975 virtual void set3D( OGRBoolean bIs3D ) override;
1976 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1977
1978 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1979
1980 virtual OGRErr addRing( OGRCurve * );
1981 virtual OGRErr addRingDirectly( OGRCurve * );
1982
1983 OGRCurve *getExteriorRingCurve();
1984 const OGRCurve *getExteriorRingCurve() const;
1985 int getNumInteriorRings() const;
1986 OGRCurve *getInteriorRingCurve( int );
1987 const OGRCurve *getInteriorRingCurve( int ) const;
1988
1989 OGRCurve *stealExteriorRingCurve();
1990
1991 OGRErr removeRing( int iIndex, bool bDelete = true );
1992 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1993 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1994
1995 virtual void swapXY() override;
1996 };
1997
1999
2000 inline const OGRCurvePolygon::ChildType* const * begin(const OGRCurvePolygon* poGeom) { return poGeom->begin(); }
2002 inline const OGRCurvePolygon::ChildType* const * end(const OGRCurvePolygon* poGeom) { return poGeom->end(); }
2003
2005 inline OGRCurvePolygon::ChildType** begin(OGRCurvePolygon* poGeom) { return poGeom->begin(); }
2007 inline OGRCurvePolygon::ChildType** end(OGRCurvePolygon* poGeom) { return poGeom->end(); }
2009
2010 /************************************************************************/
2011 /* OGRPolygon */
2012 /************************************************************************/
2013
2023 class CPL_DLL OGRPolygon : public OGRCurvePolygon
2024 {
2025 static OGRCurvePolygon* CasterToCurvePolygon(OGRSurface* poSurface);
2026
2027 protected:
2029 friend class OGRMultiSurface;
2030 friend class OGRPolyhedralSurface;
2031 friend class OGRTriangulatedSurface;
2032
2033 virtual int checkRing( OGRCurve * poNewRing ) const override;
2034 virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
2035 int bHasZ, int bHasM,
2036 OGRRawPoint*& paoPoints,
2037 int& nMaxPoints,
2038 double*& padfZ );
2039
2040 static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
2041
2042 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
2043 const override;
2044 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
2045 const override;
2047
2048 public:
2049 OGRPolygon();
2050 OGRPolygon(const OGRPolygon& other);
2051 ~OGRPolygon() override;
2052
2053 OGRPolygon& operator=(const OGRPolygon& other);
2054
2056 typedef OGRLinearRing ChildType;
2057
2061 ChildType** begin() { return reinterpret_cast<ChildType**>(oCC.begin()); }
2063 ChildType** end() { return reinterpret_cast<ChildType**>(oCC.end()); }
2067 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oCC.begin()); }
2069 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oCC.end()); }
2070
2071 // Non-standard (OGRGeometry).
2072 virtual const char *getGeometryName() const override;
2073 virtual OGRwkbGeometryType getGeometryType() const override;
2074 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2075 const override;
2076 virtual OGRGeometry* getCurveGeometry(
2077 const char* const* papszOptions = nullptr ) const override;
2078 virtual OGRGeometry* getLinearGeometry(
2079 double dfMaxAngleStepSizeDegrees = 0,
2080 const char* const* papszOptions = nullptr) const override;
2081
2082 // IWks Interface.
2083 virtual int WkbSize() const override;
2084 virtual OGRErr importFromWkb( const unsigned char *,
2085 int,
2086 OGRwkbVariant,
2087 int& nBytesConsumedOut ) override;
2088 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2089 OGRwkbVariant=wkbVariantOldOgc )
2090 const override;
2091
2092 #ifndef DOXYGEN_XML
2093 using OGRGeometry::importFromWkt;
2094 #endif
2095
2096 OGRErr importFromWkt( const char ** ) override;
2097
2098 #ifndef DOXYGEN_XML
2099 using OGRGeometry::exportToWkt;
2100 #endif
2101
2106 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2107 OGRErr *err = nullptr) const override;
2108
2109 // ICurvePolygon.
2110 virtual OGRPolygon* CurvePolyToPoly(
2111 double dfMaxAngleStepSizeDegrees = 0,
2112 const char* const* papszOptions = nullptr ) const override;
2113
2114 OGRLinearRing *getExteriorRing();
2115 const OGRLinearRing *getExteriorRing() const;
2116 virtual OGRLinearRing *getInteriorRing( int );
2117 virtual const OGRLinearRing *getInteriorRing( int ) const;
2118
2119 OGRLinearRing *stealExteriorRing();
2120 virtual OGRLinearRing *stealInteriorRing(int);
2121
2122 OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
2123
2125 inline OGRCurvePolygon* toUpperClass() { return this; }
2127 inline const OGRCurvePolygon* toUpperClass() const { return this; }
2128
2129 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2130 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2131
2132 virtual void closeRings() override;
2133 };
2134
2136
2137 inline const OGRPolygon::ChildType* const * begin(const OGRPolygon* poGeom) { return poGeom->begin(); }
2139 inline const OGRPolygon::ChildType* const * end(const OGRPolygon* poGeom) { return poGeom->end(); }
2140
2142 inline OGRPolygon::ChildType** begin(OGRPolygon* poGeom) { return poGeom->begin(); }
2144 inline OGRPolygon::ChildType** end(OGRPolygon* poGeom) { return poGeom->end(); }
2146
2147 /************************************************************************/
2148 /* OGRTriangle */
2149 /************************************************************************/
2150
2157 class CPL_DLL OGRTriangle : public OGRPolygon
2158 {
2159 private:
2160 // cppcheck-suppress unusedPrivateFunction
2161 static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
2162 bool quickValidityCheck() const;
2163
2164 protected:
2166 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2167 virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
2168 int bHasZ, int bHasM,
2169 OGRRawPoint*& paoPoints,
2170 int& nMaxPoints,
2171 double*& padfZ ) override;
2173
2174 public:
2175 OGRTriangle();
2176 OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
2177 OGRTriangle( const OGRTriangle &other );
2178 OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
2179 OGRTriangle& operator=( const OGRTriangle& other );
2180 ~OGRTriangle() override;
2181 virtual const char *getGeometryName() const override;
2182 virtual OGRwkbGeometryType getGeometryType() const override;
2183
2184 // IWks Interface.
2185 virtual OGRErr importFromWkb( const unsigned char *,
2186 int,
2187 OGRwkbVariant,
2188 int& nBytesConsumedOut ) override;
2189
2190 // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
2191 virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) override;
2192
2194 inline OGRPolygon* toUpperClass() { return this; }
2196 inline const OGRPolygon* toUpperClass() const { return this; }
2197
2198 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2199 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2200
2202 static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
2204 };
2205
2206 /************************************************************************/
2207 /* OGRGeometryCollection */
2208 /************************************************************************/
2209
2217 class CPL_DLL OGRGeometryCollection : public OGRGeometry
2218 {
2219 OGRErr importFromWkbInternal( const unsigned char * pabyData,
2220 int nSize,
2221 int nRecLevel,
2222 OGRwkbVariant, int& nBytesConsumedOut );
2223 OGRErr importFromWktInternal( const char **ppszInput, int nRecLevel );
2224
2225 protected:
2227 int nGeomCount = 0;
2228 OGRGeometry **papoGeoms = nullptr;
2229
2230 std::string exportToWktInternal(const OGRWktOptions& opts, OGRErr *err,
2231 std::string exclude = std::string()) const;
2232 static OGRGeometryCollection* TransferMembersAndDestroy(
2233 OGRGeometryCollection* poSrc,
2234 OGRGeometryCollection* poDst );
2236 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2237
2238 public:
2239 OGRGeometryCollection();
2240 OGRGeometryCollection( const OGRGeometryCollection& other );
2241 ~OGRGeometryCollection() override;
2242
2243 OGRGeometryCollection& operator=( const OGRGeometryCollection& other );
2244
2246 typedef OGRGeometry ChildType;
2247
2251 ChildType** begin() { return papoGeoms; }
2253 ChildType** end() { return papoGeoms + nGeomCount; }
2257 const ChildType* const* begin() const { return papoGeoms; }
2259 const ChildType* const* end() const { return papoGeoms + nGeomCount; }
2260
2261 // Non standard (OGRGeometry).
2262 virtual const char *getGeometryName() const override;
2263 virtual OGRwkbGeometryType getGeometryType() const override;
2264 virtual OGRGeometry *clone() const override;
2265 virtual void empty() override;
2266 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
2267 virtual void flattenTo2D() override;
2268 virtual OGRBoolean IsEmpty() const override;
2269 virtual void segmentize(double dfMaxLength) override;
2270 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2271 const override;
2272 virtual OGRGeometry* getCurveGeometry(
2273 const char* const* papszOptions = nullptr ) const override;
2274 virtual OGRGeometry* getLinearGeometry(
2275 double dfMaxAngleStepSizeDegrees = 0,
2276 const char* const* papszOptions = nullptr ) const override;
2277
2278 // IWks Interface
2279 virtual int WkbSize() const override;
2280 virtual OGRErr importFromWkb( const unsigned char *,
2281 int,
2282 OGRwkbVariant,
2283 int& nBytesConsumedOut ) override;
2284 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2285 OGRwkbVariant=wkbVariantOldOgc )
2286 const override;
2287
2288 #ifndef DOXYGEN_XML
2289 using OGRGeometry::importFromWkt;
2290 #endif
2291
2292 OGRErr importFromWkt( const char ** ) override;
2293
2294 #ifndef DOXYGEN_XML
2295 using OGRGeometry::exportToWkt;
2296 #endif
2297
2302 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2303 OGRErr *err = nullptr) const override;
2304
2305 virtual double get_Length() const;
2306 virtual double get_Area() const;
2307
2308 // IGeometry methods
2309 virtual int getDimension() const override;
2310 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2311 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2312
2313 // IGeometryCollection
2314 int getNumGeometries() const;
2315 OGRGeometry *getGeometryRef( int );
2316 const OGRGeometry *getGeometryRef( int ) const;
2317
2318 // ISpatialRelation
2319 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
2320
2321 // Non standard
2322 virtual void setCoordinateDimension( int nDimension ) override;
2323 virtual void set3D( OGRBoolean bIs3D ) override;
2324 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2325 virtual OGRErr addGeometry( const OGRGeometry * );
2326 virtual OGRErr addGeometryDirectly( OGRGeometry * );
2327 virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2328
2329 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2330
2331 void closeRings() override;
2332
2333 virtual void swapXY() override;
2334
2335 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2336 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2337
2338 static OGRGeometryCollection* CastToGeometryCollection(
2339 OGRGeometryCollection* poSrc );
2340 };
2341
2343
2344 inline const OGRGeometryCollection::ChildType* const * begin(const OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2346 inline const OGRGeometryCollection::ChildType* const * end(const OGRGeometryCollection* poGeom) { return poGeom->end(); }
2347
2349 inline OGRGeometryCollection::ChildType** begin(OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2351 inline OGRGeometryCollection::ChildType** end(OGRGeometryCollection* poGeom) { return poGeom->end(); }
2353
2354 /************************************************************************/
2355 /* OGRMultiSurface */
2356 /************************************************************************/
2357
2364 class CPL_DLL OGRMultiSurface : public OGRGeometryCollection
2365 {
2366 protected:
2367 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2368 const override;
2369
2370 public:
2371 OGRMultiSurface();
2372 OGRMultiSurface( const OGRMultiSurface& other );
2373 ~OGRMultiSurface() override;
2374
2375 OGRMultiSurface& operator=( const OGRMultiSurface& other );
2376
2378 typedef OGRSurface ChildType;
2379
2383 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2385 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2389 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2391 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2392
2393 // Non standard (OGRGeometry).
2394 virtual const char *getGeometryName() const override;
2395 virtual OGRwkbGeometryType getGeometryType() const override;
2396
2397 #ifndef DOXYGEN_XML
2398 using OGRGeometry::importFromWkt;
2399 #endif
2400
2401 OGRErr importFromWkt( const char ** ) override;
2402
2403 #ifndef DOXYGEN_XML
2404 using OGRGeometry::exportToWkt;
2405 #endif
2406
2411 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2412 OGRErr *err = nullptr) const override;
2413
2414 // IMultiSurface methods
2415 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
2416
2417 // IGeometry methods
2418 virtual int getDimension() const override;
2419
2420 // Non standard
2421 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2422 const override;
2423
2425 inline OGRGeometryCollection* toUpperClass() { return this; }
2427 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2428
2429 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2430 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2431
2432 static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
2433 };
2434
2436
2437 inline const OGRMultiSurface::ChildType* const * begin(const OGRMultiSurface* poGeom) { return poGeom->begin(); }
2439 inline const OGRMultiSurface::ChildType* const * end(const OGRMultiSurface* poGeom) { return poGeom->end(); }
2440
2442 inline OGRMultiSurface::ChildType** begin(OGRMultiSurface* poGeom) { return poGeom->begin(); }
2444 inline OGRMultiSurface::ChildType** end(OGRMultiSurface* poGeom) { return poGeom->end(); }
2446
2447 /************************************************************************/
2448 /* OGRMultiPolygon */
2449 /************************************************************************/
2450
2455 class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
2456 {
2457 protected:
2458 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2459 const override;
2460 friend class OGRPolyhedralSurface;
2461 friend class OGRTriangulatedSurface;
2462
2463 private:
2465 OGRErr _addGeometryWithExpectedSubGeometryType(
2466 const OGRGeometry * poNewGeom,
2467 OGRwkbGeometryType eSubGeometryType );
2468 OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
2469 OGRGeometry * poNewGeom,
2470 OGRwkbGeometryType eSubGeometryType );
2472
2473
2474 public:
2475 OGRMultiPolygon();
2476 OGRMultiPolygon( const OGRMultiPolygon& other );
2477 ~OGRMultiPolygon() override;
2478
2479 OGRMultiPolygon& operator=(const OGRMultiPolygon& other);
2480
2482 typedef OGRPolygon ChildType;
2483
2487 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2489 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2493 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2495 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2496
2497 // Non-standard (OGRGeometry).
2498 virtual const char *getGeometryName() const override;
2499 virtual OGRwkbGeometryType getGeometryType() const override;
2500
2501 #ifndef DOXYGEN_XML
2502 using OGRGeometry::exportToWkt;
2503 #endif
2504
2509 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2510 OGRErr *err = nullptr) const override;
2511
2512 // Non standard
2513 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2514 const override;
2515
2517 inline OGRGeometryCollection* toUpperClass() { return this; }
2519 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2520
2521 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2522 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2523
2524 static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
2525 };
2526
2528
2529 inline const OGRMultiPolygon::ChildType* const * begin(const OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2531 inline const OGRMultiPolygon::ChildType* const * end(const OGRMultiPolygon* poGeom) { return poGeom->end(); }
2532
2534 inline OGRMultiPolygon::ChildType** begin(OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2536 inline OGRMultiPolygon::ChildType** end(OGRMultiPolygon* poGeom) { return poGeom->end(); }
2538
2539 /************************************************************************/
2540 /* OGRPolyhedralSurface */
2541 /************************************************************************/
2542
2549 class CPL_DLL OGRPolyhedralSurface : public OGRSurface
2550 {
2551 protected:
2553 friend class OGRTriangulatedSurface;
2554 OGRMultiPolygon oMP{};
2555 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
2556 const override;
2557 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
2558 const override;
2559 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2560 virtual const char* getSubGeometryName() const;
2561 virtual OGRwkbGeometryType getSubGeometryType() const;
2562 std::string exportToWktInternal (const OGRWktOptions& opts, OGRErr *err) const;
2563
2564 virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2565 const;
2566 static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
2568
2569 public:
2570 OGRPolyhedralSurface();
2571 OGRPolyhedralSurface( const OGRPolyhedralSurface &poGeom );
2572 ~OGRPolyhedralSurface() override;
2573 OGRPolyhedralSurface& operator=(const OGRPolyhedralSurface& other);
2574
2576 typedef OGRPolygon ChildType;
2577
2581 ChildType** begin() { return oMP.begin(); }
2583 ChildType** end() { return oMP.end(); }
2587 const ChildType* const* begin() const { return oMP.begin(); }
2589 const ChildType* const* end() const { return oMP.end(); }
2590
2591 // IWks Interface.
2592 virtual int WkbSize() const override;
2593 virtual const char *getGeometryName() const override;
2594 virtual OGRwkbGeometryType getGeometryType() const override;
2595 virtual OGRErr importFromWkb( const unsigned char *,
2596 int,
2597 OGRwkbVariant,
2598 int& nBytesConsumedOut ) override;
2599 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2600 OGRwkbVariant=wkbVariantOldOgc )
2601 const override;
2602
2603 #ifndef DOXYGEN_XML
2604 using OGRGeometry::importFromWkt;
2605 #endif
2606
2607 OGRErr importFromWkt( const char ** ) override;
2608
2609 #ifndef DOXYGEN_XML
2610 using OGRGeometry::exportToWkt;
2611 #endif
2612
2617 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2618 OGRErr *err = nullptr) const override;
2619
2620 // IGeometry methods.
2621 virtual int getDimension() const override;
2622
2623 virtual void empty() override;
2624
2625 virtual OGRGeometry *clone() const override;
2626 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2627 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2628
2629 virtual void flattenTo2D() override;
2630 virtual OGRErr transform( OGRCoordinateTransformation* ) override;
2631 virtual OGRBoolean Equals( const OGRGeometry* ) const override;
2632 virtual double get_Area() const override;
2633 virtual OGRErr PointOnSurface( OGRPoint* ) const override;
2634
2635 static OGRMultiPolygon* CastToMultiPolygon( OGRPolyhedralSurface* poPS );
2636 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2637 const override;
2638 virtual OGRErr addGeometry( const OGRGeometry * );
2639 OGRErr addGeometryDirectly( OGRGeometry *poNewGeom );
2640 int getNumGeometries() const;
2641 OGRGeometry* getGeometryRef(int i);
2642 const OGRGeometry* getGeometryRef(int i) const;
2643
2644 virtual OGRBoolean IsEmpty() const override;
2645 virtual void setCoordinateDimension( int nDimension ) override;
2646 virtual void set3D( OGRBoolean bIs3D ) override;
2647 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2648 virtual void swapXY() override;
2649 OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2650
2651 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2652 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2653
2654 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2655 };
2656
2658
2659 inline const OGRPolyhedralSurface::ChildType* const * begin(const OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2661 inline const OGRPolyhedralSurface::ChildType* const * end(const OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2662
2664 inline OGRPolyhedralSurface::ChildType** begin(OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2666 inline OGRPolyhedralSurface::ChildType** end(OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2668
2669 /************************************************************************/
2670 /* OGRTriangulatedSurface */
2671 /************************************************************************/
2672
2679 class CPL_DLL OGRTriangulatedSurface : public OGRPolyhedralSurface
2680 {
2681 protected:
2683 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2684 const override;
2685 virtual const char* getSubGeometryName() const override;
2686 virtual OGRwkbGeometryType getSubGeometryType() const override;
2687
2688 virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2689 const override;
2690 static OGRMultiPolygon *
2691 CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
2693
2694 public:
2695 OGRTriangulatedSurface();
2696 OGRTriangulatedSurface( const OGRTriangulatedSurface &other );
2697 ~OGRTriangulatedSurface();
2698
2700 typedef OGRTriangle ChildType;
2701
2705 ChildType** begin() { return reinterpret_cast<ChildType**>(oMP.begin()); }
2707 ChildType** end() { return reinterpret_cast<ChildType**>(oMP.end()); }
2711 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oMP.begin()); }
2713 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oMP.end()); }
2714
2715 OGRTriangulatedSurface& operator=( const OGRTriangulatedSurface& other );
2716 virtual const char *getGeometryName() const override;
2717 virtual OGRwkbGeometryType getGeometryType() const override;
2718
2719 // IWks Interface.
2720 virtual OGRErr addGeometry( const OGRGeometry * ) override;
2721
2723 inline OGRPolyhedralSurface* toUpperClass() { return this; }
2725 inline const OGRPolyhedralSurface* toUpperClass() const { return this; }
2726
2727 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2728 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2729
2730 static OGRPolyhedralSurface *
2731 CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
2732 };
2733
2735
2736 inline const OGRTriangulatedSurface::ChildType* const * begin(const OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2738 inline const OGRTriangulatedSurface::ChildType* const * end(const OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2739
2741 inline OGRTriangulatedSurface::ChildType** begin(OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2743 inline OGRTriangulatedSurface::ChildType** end(OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2745
2746 /************************************************************************/
2747 /* OGRMultiPoint */
2748 /************************************************************************/
2749
2754 class CPL_DLL OGRMultiPoint : public OGRGeometryCollection
2755 {
2756 private:
2757 OGRErr importFromWkt_Bracketed( const char **, int bHasM, int bHasZ );
2758
2759 protected:
2760 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2761 const override;
2762
2763 public:
2764 OGRMultiPoint();
2765 OGRMultiPoint(const OGRMultiPoint& other);
2766 ~OGRMultiPoint() override;
2767
2768 OGRMultiPoint& operator=(const OGRMultiPoint& other);
2769
2771 typedef OGRPoint ChildType;
2772
2776 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2778 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2782 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2784 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2785
2786 // Non-standard (OGRGeometry).
2787 virtual const char *getGeometryName() const override;
2788 virtual OGRwkbGeometryType getGeometryType() const override;
2789
2790 #ifndef DOXYGEN_XML
2791 using OGRGeometry::importFromWkt;
2792 #endif
2793
2794 OGRErr importFromWkt( const char ** ) override;
2795
2796 #ifndef DOXYGEN_XML
2797 using OGRGeometry::exportToWkt;
2798 #endif
2799
2804 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2805 OGRErr *err = nullptr) const override;
2806
2807 // IGeometry methods.
2808 virtual int getDimension() const override;
2809
2811 inline OGRGeometryCollection* toUpperClass() { return this; }
2813 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2814
2815 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2816 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2817
2818 // Non-standard.
2819 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2820 const override;
2821 };
2822
2824
2825 inline const OGRMultiPoint::ChildType* const * begin(const OGRMultiPoint* poGeom) { return poGeom->begin(); }
2827 inline const OGRMultiPoint::ChildType* const * end(const OGRMultiPoint* poGeom) { return poGeom->end(); }
2828
2830 inline OGRMultiPoint::ChildType** begin(OGRMultiPoint* poGeom) { return poGeom->begin(); }
2832 inline OGRMultiPoint::ChildType** end(OGRMultiPoint* poGeom) { return poGeom->end(); }
2834
2835 /************************************************************************/
2836 /* OGRMultiCurve */
2837 /************************************************************************/
2838
2845 class CPL_DLL OGRMultiCurve : public OGRGeometryCollection
2846 {
2847 protected:
2849 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
2850 OGRCurve* poCurve );
2852 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2853 const override;
2854
2855 public:
2856 OGRMultiCurve();
2857 OGRMultiCurve( const OGRMultiCurve& other );
2858 ~OGRMultiCurve() override;
2859
2860 OGRMultiCurve& operator=( const OGRMultiCurve& other );
2861
2863 typedef OGRCurve ChildType;
2864
2868 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2870 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2874 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2876 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2877
2878 // Non standard (OGRGeometry).
2879 virtual const char *getGeometryName() const override;
2880 virtual OGRwkbGeometryType getGeometryType() const override;
2881
2882 #ifndef DOXYGEN_XML
2883 using OGRGeometry::importFromWkt;
2884 #endif
2885
2886 OGRErr importFromWkt( const char ** ) override;
2887
2888 #ifndef DOXYGEN_XML
2889 using OGRGeometry::exportToWkt;
2890 #endif
2891
2896 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2897 OGRErr *err = nullptr) const override;
2898
2899 // IGeometry methods.
2900 virtual int getDimension() const override;
2901
2902 // Non-standard.
2903 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2904 const override;
2905
2907 inline OGRGeometryCollection* toUpperClass() { return this; }
2909 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2910
2911 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2912 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2913
2914 static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
2915 };
2916
2918
2919 inline const OGRMultiCurve::ChildType* const * begin(const OGRMultiCurve* poGeom) { return poGeom->begin(); }
2921 inline const OGRMultiCurve::ChildType* const * end(const OGRMultiCurve* poGeom) { return poGeom->end(); }
2922
2924 inline OGRMultiCurve::ChildType** begin(OGRMultiCurve* poGeom) { return poGeom->begin(); }
2926 inline OGRMultiCurve::ChildType** end(OGRMultiCurve* poGeom) { return poGeom->end(); }
2928
2929 /************************************************************************/
2930 /* OGRMultiLineString */
2931 /************************************************************************/
2932
2937 class CPL_DLL OGRMultiLineString : public OGRMultiCurve
2938 {
2939 protected:
2940 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2941 const override;
2942
2943 public:
2944 OGRMultiLineString();
2945 OGRMultiLineString( const OGRMultiLineString& other );
2946 ~OGRMultiLineString() override;
2947
2948 OGRMultiLineString& operator=( const OGRMultiLineString& other );
2949
2951 typedef OGRLineString ChildType;
2952
2956 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2958 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2962 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2964 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2965
2966 // Non standard (OGRGeometry).
2967 virtual const char *getGeometryName() const override;
2968 virtual OGRwkbGeometryType getGeometryType() const override;
2969
2970 #ifndef DOXYGEN_XML
2971 using OGRGeometry::exportToWkt;
2972 #endif
2973
2978 virtual std::string exportToWkt(const OGRWktOptions& opts = OGRWktOptions(),
2979 OGRErr *err = nullptr) const override;
2980
2981 // Non standard
2982 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2983 const override;
2984
2986 inline OGRGeometryCollection* toUpperClass() { return this; }
2988 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2989
2990 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2991 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2992
2993 static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
2994 };
2995
2997
2998 inline const OGRMultiLineString::ChildType* const * begin(const OGRMultiLineString* poGeom) { return poGeom->begin(); }
3000 inline const OGRMultiLineString::ChildType* const * end(const OGRMultiLineString* poGeom) { return poGeom->end(); }
3001
3003 inline OGRMultiLineString::ChildType** begin(OGRMultiLineString* poGeom) { return poGeom->begin(); }
3005 inline OGRMultiLineString::ChildType** end(OGRMultiLineString* poGeom) { return poGeom->end(); }
3007
3008 /************************************************************************/
3009 /* OGRGeometryFactory */
3010 /************************************************************************/
3011
3016 class CPL_DLL OGRGeometryFactory
3017 {
3018 static OGRErr createFromFgfInternal( const unsigned char *pabyData,
3019 OGRSpatialReference * poSR,
3020 OGRGeometry **ppoReturn,
3021 int nBytes,
3022 int *pnBytesConsumed,
3023 int nRecLevel );
3024 public:
3025 static OGRErr createFromWkb( const void *, OGRSpatialReference *,
3026 OGRGeometry **, int = -1,
3027 OGRwkbVariant=wkbVariantOldOgc );
3028 static OGRErr createFromWkb( const void * pabyData,
3029 OGRSpatialReference *,
3030 OGRGeometry **,
3031 int nSize,
3032 OGRwkbVariant eVariant,
3033 int& nBytesConsumedOut );
3034 static OGRErr createFromWkt( const char* , OGRSpatialReference *,
3035 OGRGeometry ** );
3036 static OGRErr createFromWkt( const char **, OGRSpatialReference *,
3037 OGRGeometry ** );
3041 static OGRErr createFromWkt( char ** ppszInput, OGRSpatialReference * poSRS,
3042 OGRGeometry ** ppoGeom )
3043 CPL_WARN_DEPRECATED("Use createFromWkt(const char**, ...) instead")
3044 {
3045 return createFromWkt( const_cast<const char**>(ppszInput), poSRS, ppoGeom);
3046 }
3047
3048 static OGRErr createFromFgf( const void*, OGRSpatialReference *,
3049 OGRGeometry **, int = -1, int * = nullptr );
3050 static OGRGeometry *createFromGML( const char * );
3051 static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
3052 GEOSGeom );
3053 static OGRGeometry *createFromGeoJson( const char *);
3054 static OGRGeometry *createFromGeoJson( const CPLJSONObject &oJSONObject );
3055
3056 static void destroyGeometry( OGRGeometry * );
3057 static OGRGeometry *createGeometry( OGRwkbGeometryType );
3058
3059 static OGRGeometry * forceToPolygon( OGRGeometry * );
3060 static OGRGeometry * forceToLineString( OGRGeometry *,
3061 bool bOnlyInOrder = true );
3062 static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
3063 static OGRGeometry * forceToMultiPoint( OGRGeometry * );
3064 static OGRGeometry * forceToMultiLineString( OGRGeometry * );
3065
3066 static OGRGeometry * forceTo( OGRGeometry* poGeom,
3067 OGRwkbGeometryType eTargetType,
3068 const char*const* papszOptions = nullptr );
3069
3070 static OGRGeometry * removeLowerDimensionSubGeoms( const OGRGeometry* poGeom );
3071
3072 static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
3073 int nPolygonCount,
3074 int *pbResultValidGeometry,
3075 const char **papszOptions = nullptr);
3076 static bool haveGEOS();
3077
3079 class CPL_DLL TransformWithOptionsCache
3080 {
3081 friend class OGRGeometryFactory;
3082 struct Private;
3083 std::unique_ptr<Private> d;
3084
3085 public:
3086 TransformWithOptionsCache();
3087 ~TransformWithOptionsCache();
3088 };
3089
3090 static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
3091 OGRCoordinateTransformation *poCT,
3092 char** papszOptions,
3093 const TransformWithOptionsCache& cache = TransformWithOptionsCache() );
3094
3095 static OGRGeometry*
3096 approximateArcAngles( double dfX, double dfY, double dfZ,
3097 double dfPrimaryRadius, double dfSecondaryAxis,
3098 double dfRotation,
3099 double dfStartAngle, double dfEndAngle,
3100 double dfMaxAngleStepSizeDegrees,
3101 const bool bUseMaxGap = false );
3102
3103 static int GetCurveParmeters( double x0, double y0,
3104 double x1, double y1,
3105 double x2, double y2,
3106 double& R, double& cx, double& cy,
3107 double& alpha0, double& alpha1,
3108 double& alpha2 );
3109 static OGRLineString* curveToLineString(
3110 double x0, double y0, double z0,
3111 double x1, double y1, double z1,
3112 double x2, double y2, double z2,
3113 int bHasZ,
3114 double dfMaxAngleStepSizeDegrees,
3115 const char* const * papszOptions = nullptr );
3116 static OGRCurve* curveFromLineString(
3117 const OGRLineString* poLS,
3118 const char* const * papszOptions = nullptr);
3119 };
3120
3121 OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
3122 const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
3123
3125 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
3126 int OGRHasPreparedGeometrySupport();
3127 OGRPreparedGeometry* OGRCreatePreparedGeometry( const OGRGeometry* poGeom );
3128 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
3129 int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
3130 const OGRGeometry* poOtherGeom );
3131 int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
3132 const OGRGeometry* poOtherGeom );
3133
3135 struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
3136 {
3137 void operator()(OGRPreparedGeometry*) const;
3138 };
3140
3144 typedef std::unique_ptr<OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter> OGRPreparedGeometryUniquePtr;
3145
3146 #endif /* ndef OGR_GEOMETRY_H_INCLUDED */
OGRCurve::toSimpleCurve
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1072
OGRCompoundCurve::begin
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:1717
OGRGeometry::toMultiPoint
OGRMultiPoint * toMultiPoint()
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:744
OGRTriangulatedSurface::getGeometryName
virtual const char * getGeometryName() const override
Returns the geometry name of the TriangulatedSurface.
Definition: ogrtriangulatedsurface.cpp:116
OGRPolyhedralSurface::importFromWkt
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrpolyhedralsurface.cpp:353
OGRSimpleCurve::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1168
OGRTriangle::importFromWkb
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrtriangle.cpp:188
OGRPolyhedralSurface::~OGRPolyhedralSurface
~OGRPolyhedralSurface() override
Destructor.
OGRGeometry::closeRings
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:5111
OGRGeometry::toPolygon
const OGRPolygon * toPolygon() const
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:695
OGRGeometry::toTriangle
const OGRTriangle * toTriangle() const
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:709
OGRMultiPoint::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2776
OGRCurve::IntersectsPoint
virtual int IntersectsPoint(const OGRPoint *p) const
Returns if a point intersects a (closed) curve.
Definition: ogrcurve.cpp:416
OGRGeometryCollection::end
const ChildType *const * end() const
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2259
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:740
OGRGeometry::Is3D
OGRBoolean Is3D() const
Definition: ogr_geometry.h:403
OGRCurvePolygon::getEnvelope
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
Definition: ogrcurvepolygon.cpp:616
OGRMultiCurve::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2909
OGRGeometry::toMultiLineString
OGRMultiLineString * toMultiLineString()
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:758
OGRGeometry::toLineString
const OGRLineString * toLineString() const
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:625
OGRWktOptions::format
OGRWktFormat format
Formatting type.
Definition: ogr_geometry.h:78
OGRCircularString::toUpperClass
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1547
OGRPolyhedralSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2652
OGRRawPoint::y
double y
y
Definition: ogr_geometry.h:114
OGRTriangle::getGeometryName
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrtriangle.cpp:151
OGRCurvePolygon::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:1898
OGRLineString
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1316
OGRMultiPoint::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:2771
OGRGeometry::toCompoundCurve
OGRCompoundCurve * toCompoundCurve()
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:660
OGRGeometry::toMultiPolygon
const OGRMultiPolygon * toMultiPolygon() const
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:779
OGRGeometry::ToHandle
static OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
Definition: ogr_geometry.h:563
OGRLineString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1360
OGRPoint::getY
double getY() const
Return y.
Definition: ogr_geometry.h:920
OGRCurvePolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1993
OGRWktFormat::Default
Format as F when abs(value) < 1, otherwise as G.
OGRLineString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1361
OGRGeometry::toCurve
OGRCurve * toCurve()
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:590
OGRPolyhedralSurface::flattenTo2D
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrpolyhedralsurface.cpp:499
OGRGeometryFactory
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:3016
OGRPolyhedralSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2589
OGRGeometry::toMultiPolygon
OGRMultiPolygon * toMultiPolygon()
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:772
OGRMultiLineString::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2988
OGRPolyhedralSurface::getDimension
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrpolyhedralsurface.cpp:139
OGRLinearRing::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1439
OGRRawPoint::x
double x
x
Definition: ogr_geometry.h:112
OGRMultiLineString::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2956
OGRCurvePolygon::transform
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:655
OGRGeometry::toSurface
const OGRSurface * toSurface() const
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:681
OGRMultiLineString::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2958
OGRCurvePolygon::set3D
virtual void set3D(OGRBoolean bIs3D) override
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:691
OGRCircularString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1549
OGRPolyhedralSurface::OGRPolyhedralSurface
OGRPolyhedralSurface()
Create an empty PolyhedralSurface.
OGRPolyhedralSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2651
OGRGeometry::toMultiSurface
OGRMultiSurface * toMultiSurface()
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:800
OGRPolyhedralSurface::set3D
virtual void set3D(OGRBoolean bIs3D) override
Set the type as 3D geometry.
Definition: ogrpolyhedralsurface.cpp:864
OGRGeometryFactory::TransformWithOptionsCache
Opaque class used as argument to transformWithOptions()
Definition: ogr_geometry.h:3079
OGRGeometry::FromHandle
static OGRGeometry * FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
Definition: ogr_geometry.h:569
OGRCurvePolygon::setCoordinateDimension
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrcurvepolygon.cpp:685
OGRCurvePolygon::end
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:1905
OGRWktOptions
Options for formatting WKT output.
Definition: ogr_geometry.h:68
OGRMultiSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2429
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:193
OGRCurvePolygon::stealExteriorRingCurve
OGRCurve * stealExteriorRingCurve()
"Steal" reference to external ring.
Definition: ogrcurvepolygon.cpp:307
OGRMultiPolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2521
OGRGeometry::operator!=
bool operator!=(const OGRGeometry &other) const
Returns if two geometries are different.
Definition: ogr_geometry.h:392
OGRBoolean
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:334
OGRPolygon::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2067
OGRCurvePolygon::getExteriorRingCurve
OGRCurve * getExteriorRingCurve()
Fetch reference to external polygon ring.
Definition: ogrcurvepolygon.cpp:201
OGRCurvePolygon::end
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:1911
OGRPolygon::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:731
OGRCurvePolygon::removeRing
OGRErr removeRing(int iIndex, bool bDelete=true)
Remove a geometry from the container.
Definition: ogrcurvepolygon.cpp:339
OGRCurvePolygon::CastToPolygon
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:827
GByte
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
ogr_spatialref.h
Coordinate systems services.
OGRPolyhedralSurface::IsEmpty
virtual OGRBoolean IsEmpty() const override
Checks if the PolyhedralSurface is empty.
Definition: ogrpolyhedralsurface.cpp:851
OGRGeometry::toTriangulatedSurface
OGRTriangulatedSurface * toTriangulatedSurface()
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:828
OGRPoint::getM
double getM() const
Return m.
Definition: ogr_geometry.h:924
OGRCircularString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1550
OGRTriangle::toUpperClass
const OGRPolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2196
OGRGeometryCollection::begin
const ChildType *const * begin() const
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2257
OGRMultiSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2389
OGRRawPoint::OGRRawPoint
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:106
OGRGeometry::toTriangulatedSurface
const OGRTriangulatedSurface * toTriangulatedSurface() const
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:835
OGRMultiSurface::ChildType
OGRSurface ChildType
Type of child elements.
Definition: ogr_geometry.h:2378
OGRWktOptions::precision
int precision
Precision of output. Interpretation depends on format.
Definition: ogr_geometry.h:74
OGRPolygon::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2061
OGRCurvePolygon::assignSpatialReference
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrcurvepolygon.cpp:705
OGRMultiPolygon
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:2455
OGRGeometry::toPoint
OGRPoint * toPoint()
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:576
OGRCurvePolygon::segmentize
virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:723
OGRHasPreparedGeometrySupport
int OGRHasPreparedGeometrySupport()
Returns if GEOS has prepared geometry support.
Definition: ogrgeometry.cpp:5849
OGRCurvePolygon::clone
virtual OGRGeometry * clone() const override
Make a copy of this object.
Definition: ogrcurvepolygon.cpp:103
OGRwkbByteOrder
OGRwkbByteOrder
Enumeration to describe byte order.
Definition: ogr_core.h:527
OGRLinearRing::toUpperClass
const OGRLineString * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1436
OGRMultiLineString::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2962
OGRCircularString
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:1470
OGRMultiCurve::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2863
OGRCurve
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:991
OGRGeometryCollection
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:2217
OGRMultiCurve::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2912
OGRCurvePolygon::getNumInteriorRings
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:238
OGRLinearRing::toUpperClass
OGRLineString * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1434
OGRLinearRing
Concrete representation of a closed ring.
Definition: ogr_geometry.h:1388
OGRPoint::setM
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:944
OGRCurvePolygon::begin
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1903
OGRPolyhedralSurface::setCoordinateDimension
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrpolyhedralsurface.cpp:900
OGRTriangulatedSurface::ChildType
OGRTriangle ChildType
Type of child elements.
Definition: ogr_geometry.h:2700
OGRGeometry::toCircularString
OGRCircularString * toCircularString()
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:646
OGRPolyhedralSurface::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a polyhedral surface to WKT.
Definition: ogrpolyhedralsurface.cpp:451
OGRGeometryFactory::createFromWkt
static OGRErr createFromWkt(char **ppszInput, OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
Definition: ogr_geometry.h:3041
OGRPolygon::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2069
OGRCurvePolygon::setMeasured
virtual void setMeasured(OGRBoolean bIsMeasured) override
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:696
OGRMultiSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2385
OGRPolygon::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2063
OGRTriangulatedSurface::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2727
CPLJSONObject
The CPLJSONArray class holds JSON object from CPLJSONDocument.
Definition: cpl_json.h:53
OGRGeometry::exportToWkt
OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const
Convert a geometry into well known text format.
Definition: ogrgeometry.cpp:1791
OGRTriangle::addRingDirectly
virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override
Add a ring to a polygon.
Definition: ogrtriangle.cpp:246
IOGRConstGeometryVisitor::visit
virtual void visit(const OGRPoint *)=0
Visit OGRPoint.
OGRMultiPoint::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2813
OGRMultiCurve::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2870
OGRPolygon::WkbSize
virtual int WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolygon.cpp:298
OGRPolyhedralSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2587
OGRPolyhedralSurface::Equals
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrpolyhedralsurface.cpp:592
IOGRGeometryVisitor
OGRGeometry visitor interface.
Definition: ogr_geometry.h:156
OGRGeometry::toMultiSurface
const OGRMultiSurface * toMultiSurface() const
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:807
OGRMultiLineString::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2964
OGRMultiCurve::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2868
OGRGeometry::toSurface
OGRSurface * toSurface()
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:674
OGRMultiSurface
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:2364
OGRGeometry::toSimpleCurve
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:604
OGRTriangulatedSurface::addGeometry
virtual OGRErr addGeometry(const OGRGeometry *) override
Add a new geometry to a collection.
Definition: ogrtriangulatedsurface.cpp:180
OGRCompoundCurve::end
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:1713
OGRMultiCurve::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2874
OGRTriangulatedSurface::toUpperClass
const OGRPolyhedralSurface * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2725
OGRFromOGCGeomType
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGCgeometry format type to corresponding OGR constants.
Definition: ogrgeometry.cpp:2348
OGRDefaultGeometryVisitor::visit
void visit(OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:209
OGRMultiLineString::ChildType
OGRLineString ChildType
Type of child elements.
Definition: ogr_geometry.h:2951
OGRGeometry::importFromWkt
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
OGRTriangulatedSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2713
OGRPolyhedralSurface::addGeometryDirectly
OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
Definition: ogrpolyhedralsurface.cpp:760
OGRCompoundCurve
Utility class to store a collection of curves.
Definition: ogr_geometry.h:1667
OGRRawPoint
Simple container for a position.
Definition: ogr_geometry.h:102
OGRTriangulatedSurface::toUpperClass
OGRPolyhedralSurface * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2723
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:345
OGRTriangulatedSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2728
OGRPolygon::toUpperClass
OGRCurvePolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2125
OGRWktOptions::OGRWktOptions
OGRWktOptions()
Constructor.
Definition: ogr_geometry.h:81
OGRCurve::ContainsPoint
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:396
OGRGeometryCollection::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2335
OGRCompoundCurve::begin
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1711
OGRGeometry::operator==
bool operator==(const OGRGeometry &other) const
Returns if two geometries are equal.
Definition: ogr_geometry.h:389
OGRWktOptions::round
bool round
Whether GDAL-special rounding should be applied.
Definition: ogr_geometry.h:76
OGRPointIterator
Interface for a point iterator.
Definition: ogr_geometry.h:973
OGRTriangulatedSurface
TriangulatedSurface class.
Definition: ogr_geometry.h:2679
OGRMultiPoint::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2815
OGRPolyhedralSurface::swapXY
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrpolyhedralsurface.cpp:915
OGRMultiCurve
A collection of OGRCurve.
Definition: ogr_geometry.h:2845
OGRCompoundCurve::get_AreaOfCurveSegments
virtual double get_AreaOfCurveSegments() const override
Return area of curve segments.
Definition: ogrcompoundcurve.cpp:902
OGRGeometryCollection::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2336
OGRSurface
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:1826
IOGRConstGeometryVisitor
OGRGeometry visitor interface.
Definition: ogr_geometry.h:230
OGRMultiLineString
A collection of OGRLineString.
Definition: ogr_geometry.h:2937
OGRGeometry::toCurvePolygon
OGRCurvePolygon * toCurvePolygon()
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:716
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:325
OGRMultiSurface::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2430
OGRMultiLineString::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2986
OGRPoint::getZ
double getZ() const
Return z.
Definition: ogr_geometry.h:922
OGRGeometry::toMultiCurve
OGRMultiCurve * toMultiCurve()
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:786
OGRGeometry::toPolyhedralSurface
OGRPolyhedralSurface * toPolyhedralSurface()
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:814
OGRMultiPoint::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2816
OGRPoint::setX
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:931
OGRGeometry::IsMeasured
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:405
sfcgal_geometry_t
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:122
OGRTriangulatedSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2705
OGRPolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2129
OGRCurvePolygon::begin
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:1909
OGRTriangle::operator=
OGRTriangle & operator=(const OGRTriangle &other)
Assignment operator.
Definition: ogrtriangle.cpp:138
OGRGeometry::toLinearRing
const OGRLinearRing * toLinearRing() const
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:639
OGRDestroyPreparedGeometry
void OGRDestroyPreparedGeometry(OGRPreparedGeometry *poPreparedGeom)
Destroys a prepared geometry.
Definition: ogrgeometry.cpp:5905
GEOSGeom
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:118
OGRDefaultGeometryVisitor
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:203
OGRSimpleCurve::getNumPoints
virtual int getNumPoints() const override
Fetch vertex count.
Definition: ogr_geometry.h:1236
OGRCurvePolygon::flattenTo2D
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrcurvepolygon.cpp:165
OGRPolyhedralSurface::importFromWkb
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrpolyhedralsurface.cpp:211
OGRMultiPolygon::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2487
OGRCurvePolygon::empty
virtual void empty() override
Clear geometry information.
Definition: ogrcurvepolygon.cpp:128
OGRGeometry::toTriangle
OGRTriangle * toTriangle()
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:702
OGRPoint::setZ
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:939
OGRPolyhedralSurface::removeGeometry
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:951
OGRCurve::ChildType
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1034
OGRCurvePolygon::get_Area
virtual double get_Area() const override
Get the area of the surface object.
Definition: ogrcurvepolygon.cpp:665
OGRSurface::PointOnSurface
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:1836
ogr_core.h
Core portability services for cross-platform OGR code.
OGRGeometryCollection::end
ChildType ** end()
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2253
OGRLinearRing::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1438
OGRPolyhedralSurface::setMeasured
virtual void setMeasured(OGRBoolean bIsMeasured) override
Set the type as Measured.
Definition: ogrpolyhedralsurface.cpp:879
OGRGeometry::toLineString
OGRLineString * toLineString()
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:618
OGRPolygon::importFromWkt
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrpolygon.cpp:445
OGRPreparedGeometryIntersects
int OGRPreparedGeometryIntersects(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry intersects with a geometry.
Definition: ogrgeometry.cpp:5927
OGRCurvePolygon
Concrete class representing curve polygons.
Definition: ogr_geometry.h:1861
OGRGeometry::toLinearRing
OGRLinearRing * toLinearRing()
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:632
OGRMultiPoint::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2782
OGRPolyhedralSurface::clone
virtual OGRGeometry * clone() const override
Make a copy of this object.
Definition: ogrpolyhedralsurface.cpp:166
OGRPolyhedralSurface::hasCurveGeometry
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolyhedralsurface.cpp:925
OGRTriangle::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2199
OGRPolyhedralSurface
PolyhedralSurface class.
Definition: ogr_geometry.h:2549
OGRMultiCurve::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2907
OGRCurvePolygon::getDimension
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrcurvepolygon.cpp:155
cpl_conv.h
Various convenience functions for CPL.
OGRPoint::setY
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:935
OGRWktFormat::F
F-type formatting.
IOGRGeometryVisitor::visit
virtual void visit(OGRPoint *)=0
Visit OGRPoint.
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:157
OGRMultiPoint::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2811
OGRGeometry::toCurve
const OGRCurve * toCurve() const
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:597
OGRCompoundCurve::ChildType
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:1706
OGRPreparedGeometry
struct _OGRPreparedGeometry OGRPreparedGeometry
Prepared geometry API (needs GEOS >= 3.1.0)
Definition: ogr_geometry.h:3125
OGREnvelope3D
Simple container for a bounding region in 3D.
Definition: ogr_core.h:175
wkbVariantOldOgc
Old-style 99-402 extended dimension (Z) WKB types.
Definition: ogr_core.h:463
OGRPolyhedralSurface::transform
virtual OGRErr transform(OGRCoordinateTransformation *) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrpolyhedralsurface.cpp:511
OGRLineString::toUpperClass
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1358
OGRMultiSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2383
OGRCurvePolygon::OGRCurvePolygon
OGRCurvePolygon()
Create an empty curve polygon.
OGRMultiSurface::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2427
OGRMultiSurface::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2425
OGRGeometryUniquePtr
std::unique_ptr< OGRGeometry, OGRGeometryUniquePtrDeleter > OGRGeometryUniquePtr
Unique pointer type for OGRGeometry.
Definition: ogr_geometry.h:850
cpl_json.h
Interface for read and write JSON documents.
OGRCurvePolygon::swapXY
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:737
OGRCreatePreparedGeometry
OGRPreparedGeometry * OGRCreatePreparedGeometry(const OGRGeometry *poGeom)
Creates a prepared geometry.
Definition: ogrgeometry.cpp:5869
OGRMultiPolygon::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2495
OGRPolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2130
OGRPoint::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:958
OGRPolygon::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolygon.cpp:372
OGRPolyhedralSurface::empty
virtual void empty() override
Clear geometry information.
Definition: ogrpolyhedralsurface.cpp:148
OGRGeometry::toPoint
const OGRPoint * toPoint() const
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:583
OGRCurvePolygon::Intersects
virtual OGRBoolean Intersects(const OGRGeometry *) const override
Do these features intersect?
Definition: ogrcurvepolygon.cpp:796
OGRPoint
Point class.
Definition: ogr_geometry.h:862
OGRGeometryH
void * OGRGeometryH
Opaque type for a geometry.
Definition: ogr_api.h:60
OGRMultiLineString::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2990
OGRTriangulatedSurface::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2711
OGRGeometry::getCurveGeometry
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=nullptr) const
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3217
OGRwkbVariant
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:461
OGRPoint::IsEmpty
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:913
OGRPolygon::ChildType
OGRLinearRing ChildType
Type of child elements.
Definition: ogr_geometry.h:2056
OGRTriangulatedSurface::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Returns the WKB Type of TriangulatedSurface.
Definition: ogrtriangulatedsurface.cpp:130
OGRGeometry::toMultiCurve
const OGRMultiCurve * toMultiCurve() const
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:793
OGRMultiPolygon::toUpperClass
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2517
OGRMultiPolygon::toUpperClass
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2519
OGRCurve::toSimpleCurve
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1067
OGRPoint::getX
double getX() const
Return x.
Definition: ogr_geometry.h:918
OGRGeometry::toPolygon
OGRPolygon * toPolygon()
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:688
OGRPolygon
Concrete class representing polygons.
Definition: ogr_geometry.h:2023
OGREnvelope
Simple container for a bounding region (rectangle)
Definition: ogr_core.h:57
OGRSimpleCurve
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:1100
GEOSContextHandle_t
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
Definition: ogr_geometry.h:120
OGRGeometry::toGeometryCollection
OGRGeometryCollection * toGeometryCollection()
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:730
OGRGeometryCollection::ChildType
OGRGeometry ChildType
Type of child elements.
Definition: ogr_geometry.h:2246
OGRGeometry::toCurvePolygon
const OGRCurvePolygon * toCurvePolygon() const
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:723
OGRWktOptions::variant
OGRwkbVariant variant
Type of WKT output to produce.
Definition: ogr_geometry.h:72
OGRWktFormat
OGRWktFormat
WKT Output formatting options.
Definition: ogr_geometry.h:60
OGRPolyhedralSurface::get_Area
virtual double get_Area() const override
Returns the area enclosed.
Definition: ogrpolyhedralsurface.cpp:632
OGRDefaultConstGeometryVisitor
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:277
OGRTriangulatedSurface::operator=
OGRTriangulatedSurface & operator=(const OGRTriangulatedSurface &other)
Assignment operator.
Definition: ogrtriangulatedsurface.cpp:84
OGRPolyhedralSurface::exportToWkb
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolyhedralsurface.cpp:303
OGRGeometry::toMultiLineString
const OGRMultiLineString * toMultiLineString() const
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:765
OGRRawPoint::OGRRawPoint
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:109
OGRPolygon::closeRings
virtual void closeRings() override
Force rings to be closed.
Definition: ogrpolygon.cpp:709
OGRDefaultConstGeometryVisitor::visit
void visit(const OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:283
OGRSimpleCurve::getX
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:1238
OGRCoordinateTransformation
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:732
OGRLineString::toUpperClass
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1356
OGRMultiPolygon::ChildType
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2482
OGRPolyhedralSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2583
OGRGeometry::getSpatialReference
OGRSpatialReference * getSpatialReference(void) const
Returns spatial reference system for object.
Definition: ogr_geometry.h:487
OGRPolyhedralSurface::CastToMultiPolygon
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:703
OGRMultiPolygon::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2489
OGRCircularString::toUpperClass
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1545
OGRPreparedGeometryUniquePtr
std::unique_ptr< OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter > OGRPreparedGeometryUniquePtr
Unique pointer type for OGRPreparedGeometry.
Definition: ogr_geometry.h:3144
OGRPolyhedralSurface::getNumGeometries
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:792
OGRTriangle::toUpperClass
OGRPolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2194
begin
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:287
OGRCurvePolygon::IsEmpty
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:714
OGRPreparedGeometryContains
int OGRPreparedGeometryContains(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry contains a geometry.
Definition: ogrgeometry.cpp:5957
OGRPoint::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:957
OGRCurvePolygon::addRing
virtual OGRErr addRing(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:362
OGRGeometry::importFromWkt
OGRErr importFromWkt(char **ppszInput)
Deprecated.
Definition: ogr_geometry.h:428
OGRGeometry::toMultiPoint
const OGRMultiPoint * toMultiPoint() const
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:751
OGRPolyhedralSurface::WkbSize
virtual int WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolyhedralsurface.cpp:125
OGRCompoundCurve::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1799
OGRTriangle
Triangle class.
Definition: ogr_geometry.h:2157
OGRMultiCurve::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2876
OGRPolyhedralSurface::begin
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2581
OGRPolyhedralSurface::ChildType
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2576
OGRErr
int OGRErr
Type for a OGR error.
Definition: ogr_core.h:318
OGRPolygon::toUpperClass
const OGRCurvePolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2127
OGRCurvePolygon::Contains
virtual OGRBoolean Contains(const OGRGeometry *) const override
Test for containment.
Definition: ogrcurvepolygon.cpp:780
OGRPolyhedralSurface::PointOnSurface
virtual OGRErr PointOnSurface(OGRPoint *) const override
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogrpolyhedralsurface.cpp:659
OGRMultiPoint::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2778
OGRWktFormat::G
G-type formatting.
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:3182
OGRGeometry::toSimpleCurve
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:611
OGRMultiLineString::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2991
OGRGeometry::toGeometryCollection
const OGRGeometryCollection * toGeometryCollection() const
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:737
OGRToOGCGeomType
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition: ogrgeometry.cpp:2421
OGRGeometry::toPolyhedralSurface
const OGRPolyhedralSurface * toPolyhedralSurface() const
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:821
end
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:292
OGRMultiSurface::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2391
OGRTriangle::getGeometryType
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrtriangle.cpp:160
OGRPolygon::exportToWkt
virtual std::string exportToWkt(const OGRWktOptions &opts=OGRWktOptions(), OGRErr *err=nullptr) const override
Export a polygon to WKT.
Definition: ogrpolygon.cpp:621
OGRMultiPoint
A collection of OGRPoint.
Definition: ogr_geometry.h:2754
OGRGeometry::toCompoundCurve
const OGRCompoundCurve * toCompoundCurve() const
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:667
OGRCurvePolygon::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1992
OGRCompoundCurve::end
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:1719
OGRMultiPolygon::begin
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2493
OGRPolyhedralSurface::assignSpatialReference
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrpolyhedralsurface.cpp:960
OGRMultiPolygon::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2522
OGRCurvePolygon::getInteriorRingCurve
OGRCurve * getInteriorRingCurve(int)
Fetch reference to indicated internal ring.
Definition: ogrcurvepolygon.cpp:266
OGRGeometryCollection::begin
ChildType ** begin()
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2251
OGRGeometry::toCircularString
const OGRCircularString * toCircularString() const
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:653
OGRCompoundCurve::accept
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1800
OGRTriangulatedSurface::end
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2707
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:720
OGRMultiCurve::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2911
OGRMultiPoint::end
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2784
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
OGRPolyhedralSurface::getGeometryRef
OGRGeometry * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:814
OGRTriangle::accept
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2198
OGRSimpleCurve::getY
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:1239
OGRCurvePolygon::Equals
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:636