GDAL
ogr_geometry.h
Go to the documentation of this file.
1/******************************************************************************
2 * $Id: ogr_geometry.h 967fd78f12996d9faa39a977a2b93547b10db65b 2018-10-14 20:02:24 +0200 Even Rouault $
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 mines-paris dot org>
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
52typedef struct OGRGeometryHS *OGRGeometryH;
53#else
54typedef void *OGRGeometryH;
55#endif
56#endif /* DEFINEH_OGRGeometryH */
64{
65 public:
67 OGRRawPoint() : x(0.0), y(0.0) {}
68
70 OGRRawPoint(double xIn, double yIn) : x(xIn), y(yIn) {}
71
73 double x;
75 double y;
76};
77
79typedef struct GEOSGeom_t *GEOSGeom;
81typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
83typedef void sfcgal_geometry_t;
84
85class OGRPoint;
86class OGRCurve;
88class OGRSimpleCurve;
89class OGRLinearRing;
90class OGRLineString;
92class OGRSurface;
93class OGRCurvePolygon;
94class OGRPolygon;
95class OGRMultiPoint;
96class OGRMultiSurface;
97class OGRMultiPolygon;
98class OGRMultiCurve;
101class OGRTriangle;
104
106typedef OGRLineString* (*OGRCurveCasterToLineString)(OGRCurve*);
107typedef OGRLinearRing* (*OGRCurveCasterToLinearRing)(OGRCurve*);
108
109typedef OGRPolygon* (*OGRSurfaceCasterToPolygon)(OGRSurface*);
110typedef OGRCurvePolygon* (*OGRSurfaceCasterToCurvePolygon)(OGRSurface*);
111typedef OGRMultiPolygon* (*OGRPolyhedralSurfaceCastToMultiPolygon)(OGRPolyhedralSurface*);
113
118{
119 public:
121 virtual ~IOGRGeometryVisitor() = default;
122
124 virtual void visit(OGRPoint*) = 0;
126 virtual void visit(OGRLineString*) = 0;
128 virtual void visit(OGRLinearRing*) = 0;
130 virtual void visit(OGRPolygon*) = 0;
132 virtual void visit(OGRMultiPoint*) = 0;
134 virtual void visit(OGRMultiLineString*) = 0;
136 virtual void visit(OGRMultiPolygon*) = 0;
138 virtual void visit(OGRGeometryCollection*) = 0;
140 virtual void visit(OGRCircularString*) = 0;
142 virtual void visit(OGRCompoundCurve*) = 0;
144 virtual void visit(OGRCurvePolygon*) = 0;
146 virtual void visit(OGRMultiCurve*) = 0;
148 virtual void visit(OGRMultiSurface*) = 0;
150 virtual void visit(OGRTriangle*) = 0;
152 virtual void visit(OGRPolyhedralSurface*) = 0;
154 virtual void visit(OGRTriangulatedSurface*) = 0;
155};
156
165{
166 void _visit(OGRSimpleCurve* poGeom);
167
168 public:
169
170 void visit(OGRPoint*) override {}
171 void visit(OGRLineString*) override;
172 void visit(OGRLinearRing*) override;
173 void visit(OGRPolygon*) override;
174 void visit(OGRMultiPoint*) override;
175 void visit(OGRMultiLineString*) override;
176 void visit(OGRMultiPolygon*) override;
177 void visit(OGRGeometryCollection*) override;
178 void visit(OGRCircularString*) override;
179 void visit(OGRCompoundCurve*) override;
180 void visit(OGRCurvePolygon*) override;
181 void visit(OGRMultiCurve*) override;
182 void visit(OGRMultiSurface*) override;
183 void visit(OGRTriangle*) override;
184 void visit(OGRPolyhedralSurface*) override;
185 void visit(OGRTriangulatedSurface*) override;
186};
187
192{
193 public:
195 virtual ~IOGRConstGeometryVisitor() = default;
196
198 virtual void visit(const OGRPoint*) = 0;
200 virtual void visit(const OGRLineString*) = 0;
202 virtual void visit(const OGRLinearRing*) = 0;
204 virtual void visit(const OGRPolygon*) = 0;
206 virtual void visit(const OGRMultiPoint*) = 0;
208 virtual void visit(const OGRMultiLineString*) = 0;
210 virtual void visit(const OGRMultiPolygon*) = 0;
212 virtual void visit(const OGRGeometryCollection*) = 0;
214 virtual void visit(const OGRCircularString*) = 0;
216 virtual void visit(const OGRCompoundCurve*) = 0;
218 virtual void visit(const OGRCurvePolygon*) = 0;
220 virtual void visit(const OGRMultiCurve*) = 0;
222 virtual void visit(const OGRMultiSurface*) = 0;
224 virtual void visit(const OGRTriangle*) = 0;
226 virtual void visit(const OGRPolyhedralSurface*) = 0;
228 virtual void visit(const OGRTriangulatedSurface*) = 0;
229};
230
239{
240 void _visit(const OGRSimpleCurve* poGeom);
241
242 public:
243
244 void visit(const OGRPoint*) override {}
245 void visit(const OGRLineString*) override;
246 void visit(const OGRLinearRing*) override;
247 void visit(const OGRPolygon*) override;
248 void visit(const OGRMultiPoint*) override;
249 void visit(const OGRMultiLineString*) override;
250 void visit(const OGRMultiPolygon*) override;
251 void visit(const OGRGeometryCollection*) override;
252 void visit(const OGRCircularString*) override;
253 void visit(const OGRCompoundCurve*) override;
254 void visit(const OGRCurvePolygon*) override;
255 void visit(const OGRMultiCurve*) override;
256 void visit(const OGRMultiSurface*) override;
257 void visit(const OGRTriangle*) override;
258 void visit(const OGRPolyhedralSurface*) override;
259 void visit(const OGRTriangulatedSurface*) override;
260};
261
262/************************************************************************/
263/* OGRGeometry */
264/************************************************************************/
265
286class CPL_DLL OGRGeometry
287{
288 private:
289 OGRSpatialReference * poSRS = nullptr; // may be NULL
290
291 protected:
293 friend class OGRCurveCollection;
294
295 unsigned int flags = 0;
296
297 OGRErr importPreambleFromWkt( const char ** ppszInput,
298 int* pbHasZ, int* pbHasM,
299 bool* pbIsEmpty );
300 OGRErr importCurveCollectionFromWkt(
301 const char ** ppszInput,
302 int bAllowEmptyComponent,
303 int bAllowLineString,
304 int bAllowCurve,
305 int bAllowCompoundCurve,
306 OGRErr (*pfnAddCurveDirectly)(OGRGeometry* poSelf,
307 OGRCurve* poCurve) );
308 OGRErr importPreambleFromWkb( const unsigned char * pabyData,
309 int nSize,
310 OGRwkbByteOrder& eByteOrder,
311 OGRwkbVariant eWkbVariant );
312 OGRErr importPreambleOfCollectionFromWkb(
313 const unsigned char * pabyData,
314 int& nSize,
315 int& nDataOffset,
316 OGRwkbByteOrder& eByteOrder,
317 int nMinSubGeomSize,
318 int& nGeomCount,
319 OGRwkbVariant eWkbVariant );
320 OGRErr PointOnSurfaceInternal( OGRPoint * poPoint ) const;
321 OGRBoolean IsSFCGALCompatible() const;
322
323 void HomogenizeDimensionalityWith( OGRGeometry* poOtherGeom );
324
326
327 public:
328
329/************************************************************************/
330/* Bit flags for OGRGeometry */
331/* The OGR_G_NOT_EMPTY_POINT is used *only* for points. */
332/* Do not use these outside of the core. */
333/* Use Is3D, IsMeasured, set3D, and setMeasured instead */
334/************************************************************************/
335
337 static const unsigned int OGR_G_NOT_EMPTY_POINT = 0x1;
338 static const unsigned int OGR_G_3D = 0x2;
339 static const unsigned int OGR_G_MEASURED = 0x4;
341
342 OGRGeometry();
343 OGRGeometry( const OGRGeometry& other );
344 virtual ~OGRGeometry();
345
346 OGRGeometry& operator=( const OGRGeometry& other );
347
349 bool operator==( const OGRGeometry& other ) const { return CPL_TO_BOOL(Equals(&other)); }
350
352 bool operator!=( const OGRGeometry& other ) const { return !CPL_TO_BOOL(Equals(&other)); }
353
354 // Standard IGeometry.
355 virtual int getDimension() const = 0;
356 virtual int getCoordinateDimension() const;
357 int CoordinateDimension() const;
358 virtual OGRBoolean IsEmpty() const = 0;
359 virtual OGRBoolean IsValid() const;
360 virtual OGRBoolean IsSimple() const;
362 OGRBoolean Is3D() const { return flags & OGR_G_3D; }
364 OGRBoolean IsMeasured() const { return flags & OGR_G_MEASURED; }
365 virtual OGRBoolean IsRing() const;
366 virtual void empty() = 0;
368 virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
369 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
370
371 // IWks Interface.
372 virtual int WkbSize() const = 0;
373 OGRErr importFromWkb( const GByte*, int=-1,
375 virtual OGRErr importFromWkb( const unsigned char *,
376 int,
378 int& nBytesConsumedOut ) = 0;
379 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
381 virtual OGRErr importFromWkt( const char ** ppszInput ) = 0;
382
386 OGRErr importFromWkt( char ** ppszInput ) CPL_WARN_DEPRECATED("Use importFromWkt(const char**) instead")
387 {
388 return importFromWkt( const_cast<const char**>(ppszInput) );
389 }
390
391 virtual OGRErr exportToWkt( char ** ppszDstText,
393
394 // Non-standard.
396 OGRwkbGeometryType getIsoGeometryType() const;
397 virtual const char *getGeometryName() const = 0;
398 virtual void dumpReadable( FILE *, const char * = nullptr
399 , char** papszOptions = nullptr ) const;
400 virtual void flattenTo2D() = 0;
401 virtual char * exportToGML( const char* const * papszOptions = nullptr ) const;
402 virtual char * exportToKML() const;
403 virtual char * exportToJson() const;
404
406 virtual void accept(IOGRGeometryVisitor* visitor) = 0;
407
409 virtual void accept(IOGRConstGeometryVisitor* visitor) const = 0;
410
411 static GEOSContextHandle_t createGEOSContext();
412 static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
413 virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
415 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
416 virtual OGRGeometry* getCurveGeometry(
417 const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
418 virtual OGRGeometry* getLinearGeometry(
419 double dfMaxAngleStepSizeDegrees = 0,
420 const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
421
422 // SFCGAL interfacing methods.
424 static sfcgal_geometry_t* OGRexportToSFCGAL( const OGRGeometry *poGeom );
425 static OGRGeometry* SFCGALexportToOGR( const sfcgal_geometry_t* _geometry );
427 virtual void closeRings();
428
429 virtual void setCoordinateDimension( int nDimension );
430 virtual void set3D( OGRBoolean bIs3D );
431 virtual void setMeasured( OGRBoolean bIsMeasured );
432
433 virtual void assignSpatialReference( OGRSpatialReference * poSR );
434 OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
435
437 OGRErr transformTo( OGRSpatialReference *poSR );
438
439 virtual void segmentize(double dfMaxLength);
440
441 // ISpatialRelation
442 virtual OGRBoolean Intersects( const OGRGeometry * ) const;
443 virtual OGRBoolean Equals( const OGRGeometry * ) const = 0;
444 virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
445 virtual OGRBoolean Touches( const OGRGeometry * ) const;
446 virtual OGRBoolean Crosses( const OGRGeometry * ) const;
447 virtual OGRBoolean Within( const OGRGeometry * ) const;
448 virtual OGRBoolean Contains( const OGRGeometry * ) const;
449 virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
450// virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
451// virtual OGRGeometry *LocateAlong( double mValue ) const;
452// virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
453
454 virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
455 virtual double Distance( const OGRGeometry * ) const ;
456 virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
457 virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
459 virtual OGRGeometry *Intersection( const OGRGeometry *)
461 virtual OGRGeometry *Union( const OGRGeometry * )
463 virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
464 virtual OGRGeometry *Difference( const OGRGeometry * )
466 virtual OGRGeometry *SymDifference( const OGRGeometry * )
468 virtual OGRErr Centroid( OGRPoint * poPoint ) const;
469 virtual OGRGeometry *Simplify(double dTolerance)
471 OGRGeometry *SimplifyPreserveTopology(double dTolerance)
473 virtual OGRGeometry *DelaunayTriangulation(
474 double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
475
476 virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
477
478 virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
479
481 // backward compatibility to non-standard method names.
482 OGRBoolean Intersect( OGRGeometry * )
483 const CPL_WARN_DEPRECATED("Non standard method. "
484 "Use Intersects() instead");
485 OGRBoolean Equal( OGRGeometry * )
486 const CPL_WARN_DEPRECATED("Non standard method. "
487 "Use Equals() instead");
488 OGRGeometry *SymmetricDifference( const OGRGeometry * )
489 const CPL_WARN_DEPRECATED("Non standard method. "
490 "Use SymDifference() instead");
491 OGRGeometry *getBoundary()
492 const CPL_WARN_DEPRECATED("Non standard method. "
493 "Use Boundary() instead");
495
497 // Special HACK for DB2 7.2 support
498 static int bGenerate_DB2_V72_BYTE_ORDER;
500
501 virtual void swapXY();
503 static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
504 static OGRGeometry* CastToError( OGRGeometry* poGeom );
506
510 static inline OGRGeometryH ToHandle(OGRGeometry* poGeom)
511 { return reinterpret_cast<OGRGeometryH>(poGeom); }
512
516 static inline OGRGeometry* FromHandle(OGRGeometryH hGeom)
517 { return reinterpret_cast<OGRGeometry*>(hGeom); }
518
524 { return cpl::down_cast<OGRPoint*>(this); }
525
530 inline const OGRPoint* toPoint() const
531 { return cpl::down_cast<const OGRPoint*>(this); }
532
538 { return cpl::down_cast<OGRCurve*>(this); }
539
544 inline const OGRCurve* toCurve() const
545 { return cpl::down_cast<const OGRCurve*>(this); }
546
552 { return cpl::down_cast<OGRSimpleCurve*>(this); }
553
558 inline const OGRSimpleCurve* toSimpleCurve() const
559 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
560
566 { return cpl::down_cast<OGRLineString*>(this); }
567
572 inline const OGRLineString* toLineString() const
573 { return cpl::down_cast<const OGRLineString*>(this); }
574
580 { return cpl::down_cast<OGRLinearRing*>(this); }
581
586 inline const OGRLinearRing* toLinearRing() const
587 { return cpl::down_cast<const OGRLinearRing*>(this); }
588
594 { return cpl::down_cast<OGRCircularString*>(this); }
595
601 { return cpl::down_cast<const OGRCircularString*>(this); }
602
608 { return cpl::down_cast<OGRCompoundCurve*>(this); }
609
614 inline const OGRCompoundCurve* toCompoundCurve() const
615 { return cpl::down_cast<const OGRCompoundCurve*>(this); }
616
622 { return cpl::down_cast<OGRSurface*>(this); }
623
628 inline const OGRSurface* toSurface() const
629 { return cpl::down_cast<const OGRSurface*>(this); }
630
636 { return cpl::down_cast<OGRPolygon*>(this); }
637
642 inline const OGRPolygon* toPolygon() const
643 { return cpl::down_cast<const OGRPolygon*>(this); }
644
650 { return cpl::down_cast<OGRTriangle*>(this); }
651
656 inline const OGRTriangle* toTriangle() const
657 { return cpl::down_cast<const OGRTriangle*>(this); }
658
664 { return cpl::down_cast<OGRCurvePolygon*>(this); }
665
670 inline const OGRCurvePolygon* toCurvePolygon() const
671 { return cpl::down_cast<const OGRCurvePolygon*>(this); }
672
678 { return cpl::down_cast<OGRGeometryCollection*>(this); }
679
685 { return cpl::down_cast<const OGRGeometryCollection*>(this); }
686
692 { return cpl::down_cast<OGRMultiPoint*>(this); }
693
698 inline const OGRMultiPoint* toMultiPoint() const
699 { return cpl::down_cast<const OGRMultiPoint*>(this); }
700
706 { return cpl::down_cast<OGRMultiLineString*>(this); }
707
713 { return cpl::down_cast<const OGRMultiLineString*>(this); }
714
720 { return cpl::down_cast<OGRMultiPolygon*>(this); }
721
726 inline const OGRMultiPolygon* toMultiPolygon() const
727 { return cpl::down_cast<const OGRMultiPolygon*>(this); }
728
734 { return cpl::down_cast<OGRMultiCurve*>(this); }
735
740 inline const OGRMultiCurve* toMultiCurve() const
741 { return cpl::down_cast<const OGRMultiCurve*>(this); }
742
748 { return cpl::down_cast<OGRMultiSurface*>(this); }
749
754 inline const OGRMultiSurface* toMultiSurface() const
755 { return cpl::down_cast<const OGRMultiSurface*>(this); }
756
762 { return cpl::down_cast<OGRPolyhedralSurface*>(this); }
763
769 { return cpl::down_cast<const OGRPolyhedralSurface*>(this); }
770
776 { return cpl::down_cast<OGRTriangulatedSurface*>(this); }
777
783 { return cpl::down_cast<const OGRTriangulatedSurface*>(this); }
784
785};
786
788struct CPL_DLL OGRGeometryUniquePtrDeleter
789{
790 void operator()(OGRGeometry*) const;
791};
793
797typedef std::unique_ptr<OGRGeometry, OGRGeometryUniquePtrDeleter> OGRGeometryUniquePtr;
798
799/************************************************************************/
800/* OGRPoint */
801/************************************************************************/
802
809class CPL_DLL OGRPoint : public OGRGeometry
810{
811 double x;
812 double y;
813 double z;
814 double m;
815
816 public:
817 OGRPoint();
818 OGRPoint( double x, double y );
819 OGRPoint( double x, double y, double z );
820 OGRPoint( double x, double y, double z, double m );
821 OGRPoint( const OGRPoint& other );
822 ~OGRPoint() override;
823
824 OGRPoint& operator=( const OGRPoint& other );
825
826 // IWks Interface
827 int WkbSize() const override;
828 OGRErr importFromWkb( const unsigned char *,
829 int,
831 int& nBytesConsumedOut ) override;
832 OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
834 const override;
836 OGRErr importFromWkt( const char ** ) override;
837 OGRErr exportToWkt( char ** ppszDstText,
839 const override;
840
841 // IGeometry
842 virtual int getDimension() const override;
843 virtual OGRGeometry *clone() const override;
844 virtual void empty() override;
845 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
846 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
847 virtual OGRBoolean IsEmpty() const override
848 { return !(flags & OGR_G_NOT_EMPTY_POINT); }
849
850 // IPoint
852 double getX() const { return x; }
854 double getY() const { return y; }
856 double getZ() const { return z; }
858 double getM() const { return m; }
859
860 // Non standard
861 virtual void setCoordinateDimension( int nDimension ) override;
865 void setX( double xIn ) { x = xIn; flags |= OGR_G_NOT_EMPTY_POINT; }
869 void setY( double yIn ) { y = yIn; flags |= OGR_G_NOT_EMPTY_POINT; }
873 void setZ( double zIn )
874 { z = zIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_3D); }
878 void setM( double mIn )
879 { m = mIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_MEASURED); }
880
881 // ISpatialRelation
882 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
883 virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
884 virtual OGRBoolean Within( const OGRGeometry * ) const override;
885
886 // Non standard from OGRGeometry
887 virtual const char *getGeometryName() const override;
888 virtual OGRwkbGeometryType getGeometryType() const override;
889 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
890 virtual void flattenTo2D() override;
891 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
892 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
893
894 virtual void swapXY() override;
895};
896
897/************************************************************************/
898/* OGRPointIterator */
899/************************************************************************/
900
907class CPL_DLL OGRPointIterator
908{
909 public:
910 virtual ~OGRPointIterator();
912
913 static void destroy( OGRPointIterator* );
914};
915
916/************************************************************************/
917/* OGRCurve */
918/************************************************************************/
919
925class CPL_DLL OGRCurve : public OGRGeometry
926{
927 protected:
929 OGRCurve();
930 OGRCurve( const OGRCurve& other );
931
932 virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
933 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
934
935 friend class OGRCurvePolygon;
936 friend class OGRCompoundCurve;
938 virtual int ContainsPoint( const OGRPoint* p ) const;
939 virtual int IntersectsPoint( const OGRPoint* p ) const;
940 virtual double get_AreaOfCurveSegments() const = 0;
941
942 private:
943
944 class CPL_DLL ConstIterator
945 {
946 struct Private;
947 std::unique_ptr<Private> m_poPrivate;
948 public:
949 ConstIterator(const OGRCurve* poSelf, bool bStart);
950 ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
951 ~ConstIterator();
952 const OGRPoint& operator*() const;
953 ConstIterator& operator++();
954 bool operator!=(const ConstIterator& it) const;
955 };
956
957 friend inline ConstIterator begin(const OGRCurve*);
958 friend inline ConstIterator end(const OGRCurve*);
959
960 public:
961 ~OGRCurve() override;
962
964 OGRCurve& operator=( const OGRCurve& other );
966
969
978 ConstIterator begin() const;
980 ConstIterator end() const;
981
982 // ICurve methods
983 virtual double get_Length() const = 0;
984 virtual void StartPoint( OGRPoint * ) const = 0;
985 virtual void EndPoint( OGRPoint * ) const = 0;
986 virtual int get_IsClosed() const;
987 virtual void Value( double, OGRPoint * ) const = 0;
988 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
989 const char* const* papszOptions = nullptr)
990 const = 0;
991 virtual int getDimension() const override;
992
993 // non standard
994 virtual int getNumPoints() const = 0;
995 virtual OGRPointIterator* getPointIterator() const = 0;
996 virtual OGRBoolean IsConvex() const;
997 virtual double get_Area() const = 0;
998
1002 { return cpl::down_cast<OGRSimpleCurve*>(this); }
1003
1006 inline const OGRSimpleCurve* toSimpleCurve() const
1007 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
1008
1009 static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
1010 static OGRLineString* CastToLineString( OGRCurve* poCurve );
1011 static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
1012};
1013
1015
1016inline OGRCurve::ConstIterator begin(const OGRCurve* poCurve) { return poCurve->begin(); }
1018inline OGRCurve::ConstIterator end(const OGRCurve* poCurve) { return poCurve->end(); }
1020
1021/************************************************************************/
1022/* OGRSimpleCurve */
1023/************************************************************************/
1024
1034class CPL_DLL OGRSimpleCurve: public OGRCurve
1035{
1036 protected:
1038 friend class OGRGeometry;
1039
1040 int nPointCount;
1041 OGRRawPoint *paoPoints;
1042 double *padfZ;
1043 double *padfM;
1044
1045 void Make3D();
1046 void Make2D();
1047 void RemoveM();
1048 void AddM();
1049
1050 OGRErr importFromWKTListOnly( const char ** ppszInput, int bHasZ, int bHasM,
1051 OGRRawPoint*& paoPointsIn,
1052 int& nMaxPoints,
1053 double*& padfZIn );
1054
1056
1057 virtual double get_LinearArea() const;
1058
1060 OGRSimpleCurve( const OGRSimpleCurve& other );
1061
1062 private:
1063 class CPL_DLL Iterator
1064 {
1065 struct Private;
1066 std::unique_ptr<Private> m_poPrivate;
1067 void update();
1068 public:
1069 Iterator(OGRSimpleCurve* poSelf, int nPos);
1070 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1071 ~Iterator();
1072 OGRPoint& operator*();
1073 Iterator& operator++();
1074 bool operator!=(const Iterator& it) const;
1075 };
1076
1077 friend inline Iterator begin(OGRSimpleCurve*);
1078 friend inline Iterator end(OGRSimpleCurve*);
1079
1080 class CPL_DLL ConstIterator
1081 {
1082 struct Private;
1083 std::unique_ptr<Private> m_poPrivate;
1084 public:
1085 ConstIterator(const OGRSimpleCurve* poSelf, int nPos);
1086 ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1087 ~ConstIterator();
1088 const OGRPoint& operator*() const;
1089 ConstIterator& operator++();
1090 bool operator!=(const ConstIterator& it) const;
1091 };
1092
1093 friend inline ConstIterator begin(const OGRSimpleCurve*);
1094 friend inline ConstIterator end(const OGRSimpleCurve*);
1095
1096 public:
1097 ~OGRSimpleCurve() override;
1098
1099 OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
1100
1103
1112 Iterator begin();
1114 Iterator end();
1123 ConstIterator begin() const;
1125 ConstIterator end() const;
1126
1127 // IWks Interface.
1128 virtual int WkbSize() const override;
1129 virtual OGRErr importFromWkb( const unsigned char *,
1130 int,
1132 int& nBytesConsumedOut ) override;
1133 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1135 const override;
1137 OGRErr importFromWkt( const char ** ) override;
1138 virtual OGRErr exportToWkt( char ** ppszDstText,
1140 const override;
1141
1142 // IGeometry interface.
1143 virtual OGRGeometry *clone() const override;
1144 virtual void empty() override;
1145 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1146 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1147 virtual OGRBoolean IsEmpty() const override;
1148
1149 // ICurve methods.
1150 virtual double get_Length() const override;
1151 virtual void StartPoint( OGRPoint * ) const override;
1152 virtual void EndPoint( OGRPoint * ) const override;
1153 virtual void Value( double, OGRPoint * ) const override;
1154 virtual double Project( const OGRPoint * ) const;
1155 virtual OGRLineString* getSubLine( double, double, int ) const;
1156
1157 // ILineString methods.
1158 virtual int getNumPoints() const override { return nPointCount; }
1159 void getPoint( int, OGRPoint * ) const;
1160 double getX( int i ) const { return paoPoints[i].x; }
1161 double getY( int i ) const { return paoPoints[i].y; }
1162 double getZ( int i ) const;
1163 double getM( int i ) const;
1164
1165 // ISpatialRelation
1166 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1167
1168 // non standard.
1169 virtual void setCoordinateDimension( int nDimension ) override;
1170 virtual void set3D( OGRBoolean bIs3D ) override;
1171 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1172 void setNumPoints( int nNewPointCount,
1173 int bZeroizeNewContent = TRUE );
1174 void setPoint( int, OGRPoint * );
1175 void setPoint( int, double, double );
1176 void setZ( int, double );
1177 void setM( int, double );
1178 void setPoint( int, double, double, double );
1179 void setPointM( int, double, double, double );
1180 void setPoint( int, double, double, double, double );
1181 void setPoints( int, const OGRRawPoint *, const double * = nullptr );
1182 void setPointsM( int, const OGRRawPoint *, const double * );
1183 void setPoints( int, const OGRRawPoint *, const double *, const double * );
1184 void setPoints( int, const double * padfX, const double * padfY,
1185 const double *padfZIn = nullptr );
1186 void setPointsM( int, const double * padfX, const double * padfY,
1187 const double *padfMIn = nullptr );
1188 void setPoints( int, const double * padfX, const double * padfY,
1189 const double *padfZIn, const double *padfMIn );
1190 void addPoint( const OGRPoint * );
1191 void addPoint( double, double );
1192 void addPoint( double, double, double );
1193 void addPointM( double, double, double );
1194 void addPoint( double, double, double, double );
1195
1196 void getPoints( OGRRawPoint *, double * = nullptr ) const;
1197 void getPoints( void* pabyX, int nXStride,
1198 void* pabyY, int nYStride,
1199 void* pabyZ = nullptr, int nZStride = 0 ) const;
1200 void getPoints( void* pabyX, int nXStride,
1201 void* pabyY, int nYStride,
1202 void* pabyZ, int nZStride,
1203 void* pabyM, int nMStride ) const;
1204
1205 void addSubLineString( const OGRLineString *,
1206 int nStartVertex = 0, int nEndVertex = -1 );
1207 void reversePoints( void );
1208 virtual OGRPointIterator* getPointIterator() const override;
1209
1210 // non-standard from OGRGeometry
1211 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1212 virtual void flattenTo2D() override;
1213 virtual void segmentize(double dfMaxLength) override;
1214
1215 virtual void swapXY() override;
1216};
1217
1219
1220inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1222inline OGRSimpleCurve::Iterator end(OGRSimpleCurve* poCurve) { return poCurve->end(); }
1223
1225inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1227inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve* poCurve) { return poCurve->end(); }
1229
1230/************************************************************************/
1231/* OGRLineString */
1232/************************************************************************/
1233
1241class CPL_DLL OGRLineString : public OGRSimpleCurve
1242{
1243 // cppcheck-suppress unusedPrivateFunction
1244 static OGRLinearRing* CasterToLinearRing(OGRCurve* poCurve);
1245
1246 protected:
1248 static OGRLineString* TransferMembersAndDestroy(
1249 OGRLineString* poSrc,
1250 OGRLineString* poDst);
1251
1252 virtual OGRCurveCasterToLineString GetCasterToLineString()
1253 const override;
1254 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1255 const override;
1256
1257 virtual double get_AreaOfCurveSegments() const override;
1259
1260 static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
1261
1262 public:
1265 ~OGRLineString() override;
1266
1267 OGRLineString& operator=(const OGRLineString& other);
1268
1269 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1270 const char* const* papszOptions = nullptr )
1271 const override;
1272 virtual OGRGeometry* getCurveGeometry(
1273 const char* const* papszOptions = nullptr ) const override;
1274 virtual double get_Area() const override;
1275
1276 // Non-standard from OGRGeometry.
1277 virtual OGRwkbGeometryType getGeometryType() const override;
1278 virtual const char *getGeometryName() const override;
1279
1281 inline OGRSimpleCurve* toUpperClass() { return this; }
1283 inline const OGRSimpleCurve* toUpperClass() const { return this; }
1284
1285 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1286 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1287};
1288
1289/************************************************************************/
1290/* OGRLinearRing */
1291/************************************************************************/
1292
1313class CPL_DLL OGRLinearRing : public OGRLineString
1314{
1315 static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1316
1317 protected:
1319 friend class OGRPolygon;
1320 friend class OGRTriangle;
1321
1322 // These are not IWks compatible ... just a convenience for OGRPolygon.
1323 virtual int _WkbSize( int _flags ) const;
1324 virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
1325 const unsigned char *, int,
1326 int& nBytesConsumedOut );
1327 virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
1328 unsigned char * ) const;
1329
1330 virtual OGRCurveCasterToLineString GetCasterToLineString()
1331 const override;
1332 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1333 const override;
1335
1336 static OGRLineString* CastToLineString( OGRLinearRing* poLR );
1337
1338 public:
1341 explicit OGRLinearRing( OGRLinearRing * );
1342 ~OGRLinearRing() override;
1343
1344 OGRLinearRing& operator=( const OGRLinearRing& other );
1345
1346 // Non standard.
1347 virtual const char *getGeometryName() const override;
1348 virtual OGRGeometry *clone() const override;
1349 virtual int isClockwise() const;
1350 virtual void reverseWindingOrder();
1351 virtual void closeRings() override;
1352 OGRBoolean isPointInRing( const OGRPoint* pt,
1353 int bTestEnvelope = TRUE ) const;
1354 OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
1355 int bTestEnvelope = TRUE ) const;
1356 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1357
1359 inline OGRLineString* toUpperClass() { return this; }
1361 inline const OGRLineString* toUpperClass() const { return this; }
1362
1363 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1364 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1365
1366 // IWks Interface - Note this isn't really a first class object
1367 // for the purposes of WKB form. These methods always fail since this
1368 // object can't be serialized on its own.
1369 virtual int WkbSize() const override;
1370 virtual OGRErr importFromWkb( const unsigned char *,
1371 int,
1373 int& nBytesConsumedOut ) override;
1374 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1376 const override;
1377};
1378
1379/************************************************************************/
1380/* OGRCircularString */
1381/************************************************************************/
1382
1395class CPL_DLL OGRCircularString : public OGRSimpleCurve
1396{
1397 private:
1398 void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
1399 OGRBoolean IsValidFast() const;
1400 int IsFullCircle( double& cx, double& cy, double& square_R ) const;
1401
1402 protected:
1404 virtual OGRCurveCasterToLineString GetCasterToLineString()
1405 const override;
1406 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1407 const override;
1408 virtual int IntersectsPoint( const OGRPoint* p ) const override;
1409 virtual int ContainsPoint( const OGRPoint* p ) const override;
1410 virtual double get_AreaOfCurveSegments() const override;
1412
1413 public:
1416 ~OGRCircularString() override;
1417
1418 OGRCircularString& operator=(const OGRCircularString& other);
1419
1420 // IWks Interface.
1421 virtual OGRErr importFromWkb( const unsigned char *,
1422 int,
1424 int& nBytesConsumedOut ) override;
1425 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1427 const override;
1429 OGRErr importFromWkt( const char ** ) override;
1430 virtual OGRErr exportToWkt( char ** ppszDstText,
1432 const override;
1433
1434 // IGeometry interface.
1435 virtual OGRBoolean IsValid() const override;
1436 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1437 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1438
1439 // ICurve methods.
1440 virtual double get_Length() const override;
1441 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1442 const char* const* papszOptions = nullptr )
1443 const override;
1444 virtual void Value( double, OGRPoint * ) const override;
1445 virtual double get_Area() const override;
1446
1447 // Non-standard from OGRGeometry.
1448 virtual OGRwkbGeometryType getGeometryType() const override;
1449 virtual const char *getGeometryName() const override;
1450 virtual void segmentize( double dfMaxLength ) override;
1451 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1452 const override;
1453 virtual OGRGeometry* getLinearGeometry(
1454 double dfMaxAngleStepSizeDegrees = 0,
1455 const char* const* papszOptions = nullptr) const override;
1456
1458 inline OGRSimpleCurve* toUpperClass() { return this; }
1460 inline const OGRSimpleCurve* toUpperClass() const { return this; }
1461
1462 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1463 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1464};
1465
1466/************************************************************************/
1467/* OGRCurveCollection */
1468/************************************************************************/
1469
1481class CPL_DLL OGRCurveCollection
1482{
1483 protected:
1484 friend class OGRCompoundCurve;
1485 friend class OGRCurvePolygon;
1486 friend class OGRPolygon;
1487 friend class OGRTriangle;
1488
1489 int nCurveCount = 0;
1490 OGRCurve **papoCurves = nullptr;
1491
1492 public:
1493 OGRCurveCollection();
1494 OGRCurveCollection(const OGRCurveCollection& other);
1495 ~OGRCurveCollection();
1496
1497 OGRCurveCollection& operator=(const OGRCurveCollection& other);
1498
1500 typedef OGRCurve ChildType;
1501
1505 OGRCurve** begin() { return papoCurves; }
1507 OGRCurve** end() { return papoCurves + nCurveCount; }
1511 const OGRCurve* const* begin() const { return papoCurves; }
1513 const OGRCurve* const* end() const { return papoCurves + nCurveCount; }
1514
1515 void empty(OGRGeometry* poGeom);
1516 OGRBoolean IsEmpty() const;
1517 void getEnvelope( OGREnvelope * psEnvelope ) const;
1518 void getEnvelope( OGREnvelope3D * psEnvelope ) const;
1519
1520 OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
1521 int bNeedRealloc );
1522 int WkbSize() const;
1523 OGRErr importPreambleFromWkb( OGRGeometry* poGeom,
1524 const unsigned char * pabyData,
1525 int& nSize,
1526 int& nDataOffset,
1527 OGRwkbByteOrder& eByteOrder,
1528 int nMinSubGeomSize,
1529 OGRwkbVariant eWkbVariant );
1530 OGRErr importBodyFromWkb(
1531 OGRGeometry* poGeom,
1532 const unsigned char * pabyData,
1533 int nSize,
1534 int bAcceptCompoundCurve,
1535 OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
1536 OGRCurve* poCurve ),
1537 OGRwkbVariant eWkbVariant,
1538 int& nBytesConsumedOut );
1539 OGRErr exportToWkt( const OGRGeometry* poGeom,
1540 char ** ppszDstText ) const;
1542 unsigned char *,
1543 OGRwkbVariant eWkbVariant ) const;
1544 OGRBoolean Equals(const OGRCurveCollection *poOCC) const;
1545 void setCoordinateDimension( OGRGeometry* poGeom,
1546 int nNewDimension );
1547 void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
1548 void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
1550 int getNumCurves() const;
1551 OGRCurve *getCurve( int );
1552 const OGRCurve *getCurve( int ) const;
1553 OGRCurve *stealCurve( int );
1554
1555 OGRErr removeCurve( int iIndex, bool bDelete = true );
1556
1557 OGRErr transform( OGRGeometry* poGeom,
1559 void flattenTo2D( OGRGeometry* poGeom );
1560 void segmentize( double dfMaxLength );
1561 void swapXY();
1562 OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
1563};
1565
1566/************************************************************************/
1567/* OGRCompoundCurve */
1568/************************************************************************/
1569
1580class CPL_DLL OGRCompoundCurve : public OGRCurve
1581{
1582 private:
1583 OGRCurveCollection oCC{};
1584
1585 OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
1586 double dfToleranceEps,
1587 int bNeedRealloc );
1588 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1589 OGRCurve* poCurve );
1590 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1591 OGRCurve* poCurve );
1592 OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
1593 const char* const* papszOptions,
1594 int bIsLinearRing ) const;
1595 // cppcheck-suppress unusedPrivateFunction
1596 static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1597 // cppcheck-suppress unusedPrivateFunction
1598 static OGRLinearRing* CasterToLinearRing( OGRCurve* poCurve );
1599
1600 protected:
1602 static OGRLineString* CastToLineString( OGRCompoundCurve* poCC );
1603 static OGRLinearRing* CastToLinearRing( OGRCompoundCurve* poCC );
1604
1605 virtual OGRCurveCasterToLineString GetCasterToLineString()
1606 const override;
1607 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1608 const override;
1610
1611 public:
1614 ~OGRCompoundCurve() override;
1615
1616 OGRCompoundCurve& operator=( const OGRCompoundCurve& other );
1617
1620
1624 ChildType** begin() { return oCC.begin(); }
1626 ChildType** end() { return oCC.end(); }
1630 const ChildType* const * begin() const { return oCC.begin(); }
1632 const ChildType* const * end() const { return oCC.end(); }
1633
1634 // IWks Interface
1635 virtual int WkbSize() const override;
1636 virtual OGRErr importFromWkb( const unsigned char *,
1637 int,
1639 int& nBytesConsumedOut ) override;
1640 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1642 const override;
1644 OGRErr importFromWkt( const char ** ) override;
1645 virtual OGRErr exportToWkt( char ** ppszDstText,
1647 const override;
1648
1649 // IGeometry interface.
1650 virtual OGRGeometry *clone() const override;
1651 virtual void empty() override;
1652 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1653 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1654 virtual OGRBoolean IsEmpty() const override;
1655
1656 // ICurve methods.
1657 virtual double get_Length() const override;
1658 virtual void StartPoint( OGRPoint * ) const override;
1659 virtual void EndPoint( OGRPoint * ) const override;
1660 virtual void Value( double, OGRPoint * ) const override;
1661 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1662 const char* const* papszOptions = nullptr )
1663 const override;
1664
1665 virtual int getNumPoints() const override;
1666 virtual double get_AreaOfCurveSegments() const override;
1667 virtual double get_Area() const override;
1668
1669 // ISpatialRelation.
1670 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1671
1672 // ICompoundCurve method.
1673 int getNumCurves() const;
1674 OGRCurve *getCurve( int );
1675 const OGRCurve *getCurve( int ) const;
1676
1677 // Non-standard.
1678 virtual void setCoordinateDimension( int nDimension ) override;
1679 virtual void set3D( OGRBoolean bIs3D ) override;
1680 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1681
1682 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1683
1684 OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
1685 OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
1686 OGRCurve *stealCurve( int );
1687 virtual OGRPointIterator* getPointIterator() const override;
1688
1689 // Non-standard from OGRGeometry.
1690 virtual OGRwkbGeometryType getGeometryType() const override;
1691 virtual const char *getGeometryName() const override;
1692 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1693 virtual void flattenTo2D() override;
1694 virtual void segmentize(double dfMaxLength) override;
1695 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
1696 const override;
1697 virtual OGRGeometry* getLinearGeometry(
1698 double dfMaxAngleStepSizeDegrees = 0,
1699 const char* const* papszOptions = nullptr) const override;
1700 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1701 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1702
1703 virtual void swapXY() override;
1704};
1705
1707
1708inline const OGRCompoundCurve::ChildType* const * begin(const OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1710inline const OGRCompoundCurve::ChildType* const * end(const OGRCompoundCurve* poCurve) { return poCurve->end(); }
1711
1713inline OGRCompoundCurve::ChildType** begin(OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1715inline OGRCompoundCurve::ChildType** end(OGRCompoundCurve* poCurve) { return poCurve->end(); }
1717
1718/************************************************************************/
1719/* OGRSurface */
1720/************************************************************************/
1721
1727class CPL_DLL OGRSurface : public OGRGeometry
1728{
1729 protected:
1731 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1732 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1734
1735 public:
1736 virtual double get_Area() const = 0;
1737 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const
1738 { return PointOnSurfaceInternal(poPoint); }
1740 static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1741 static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1743};
1744
1745/************************************************************************/
1746/* OGRCurvePolygon */
1747/************************************************************************/
1748
1762class CPL_DLL OGRCurvePolygon : public OGRSurface
1763{
1764 static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1765
1766 private:
1767 OGRBoolean IntersectsPoint( const OGRPoint* p ) const;
1768 OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1769 virtual int checkRing( OGRCurve * poNewRing ) const;
1770 OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1771 int bNeedRealloc );
1772 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1773 OGRCurve* poCurve );
1774 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1775 OGRCurve* poCurve );
1776
1777 protected:
1779 friend class OGRPolygon;
1780 friend class OGRTriangle;
1781 OGRCurveCollection oCC{};
1782
1783 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1784 const override;
1785 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1786 const override;
1788
1789 static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
1790
1791 public:
1794 ~OGRCurvePolygon() override;
1795
1796 OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
1797
1800
1804 ChildType** begin() { return oCC.begin(); }
1806 ChildType** end() { return oCC.end(); }
1810 const ChildType* const * begin() const { return oCC.begin(); }
1812 const ChildType* const * end() const { return oCC.end(); }
1813
1814 // Non standard (OGRGeometry).
1815 virtual const char *getGeometryName() const override;
1816 virtual OGRwkbGeometryType getGeometryType() const override;
1817 virtual OGRGeometry *clone() const override;
1818 virtual void empty() override;
1819 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1820 virtual void flattenTo2D() override;
1821 virtual OGRBoolean IsEmpty() const override;
1822 virtual void segmentize( double dfMaxLength ) override;
1823 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1824 const override;
1826 double dfMaxAngleStepSizeDegrees = 0,
1827 const char* const* papszOptions = nullptr ) const override;
1828
1829 // ISurface Interface
1830 virtual double get_Area() const override;
1831
1832 // IWks Interface
1833 virtual int WkbSize() const override;
1834 virtual OGRErr importFromWkb( const unsigned char *,
1835 int,
1837 int& nBytesConsumedOut ) override;
1838 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1840 const override;
1842 OGRErr importFromWkt( const char ** ) override;
1843 virtual OGRErr exportToWkt( char ** ppszDstText,
1844 OGRwkbVariant eWkbVariant = wkbVariantOldOgc )
1845 const override;
1846
1847 // IGeometry
1848 virtual int getDimension() const override;
1849 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1850 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1851
1852 // ICurvePolygon
1853 virtual OGRPolygon* CurvePolyToPoly(
1854 double dfMaxAngleStepSizeDegrees = 0,
1855 const char* const* papszOptions = nullptr ) const;
1856
1857 // ISpatialRelation
1858 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1859 virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
1860 virtual OGRBoolean Contains( const OGRGeometry * ) const override;
1861
1862 // Non standard
1863 virtual void setCoordinateDimension( int nDimension ) override;
1864 virtual void set3D( OGRBoolean bIs3D ) override;
1865 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1866
1867 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1868
1869 virtual OGRErr addRing( OGRCurve * );
1870 virtual OGRErr addRingDirectly( OGRCurve * );
1871
1873 const OGRCurve *getExteriorRingCurve() const;
1874 int getNumInteriorRings() const;
1876 const OGRCurve *getInteriorRingCurve( int ) const;
1877
1879
1880 OGRErr removeRing( int iIndex, bool bDelete = true );
1881 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1882 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1883
1884 virtual void swapXY() override;
1885};
1886
1888
1889inline const OGRCurvePolygon::ChildType* const * begin(const OGRCurvePolygon* poGeom) { return poGeom->begin(); }
1891inline const OGRCurvePolygon::ChildType* const * end(const OGRCurvePolygon* poGeom) { return poGeom->end(); }
1892
1894inline OGRCurvePolygon::ChildType** begin(OGRCurvePolygon* poGeom) { return poGeom->begin(); }
1896inline OGRCurvePolygon::ChildType** end(OGRCurvePolygon* poGeom) { return poGeom->end(); }
1898
1899/************************************************************************/
1900/* OGRPolygon */
1901/************************************************************************/
1902
1912class CPL_DLL OGRPolygon : public OGRCurvePolygon
1913{
1914 static OGRCurvePolygon* CasterToCurvePolygon(OGRSurface* poSurface);
1915
1916 protected:
1918 friend class OGRMultiSurface;
1919 friend class OGRPolyhedralSurface;
1920 friend class OGRTriangulatedSurface;
1921
1922 virtual int checkRing( OGRCurve * poNewRing ) const override;
1923 virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
1924 int bHasZ, int bHasM,
1925 OGRRawPoint*& paoPoints,
1926 int& nMaxPoints,
1927 double*& padfZ );
1928
1929 static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
1930
1931 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1932 const override;
1933 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1934 const override;
1936
1937 public:
1939 OGRPolygon(const OGRPolygon& other);
1940 ~OGRPolygon() override;
1941
1942 OGRPolygon& operator=(const OGRPolygon& other);
1943
1946
1950 ChildType** begin() { return reinterpret_cast<ChildType**>(oCC.begin()); }
1952 ChildType** end() { return reinterpret_cast<ChildType**>(oCC.end()); }
1956 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oCC.begin()); }
1958 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oCC.end()); }
1959
1960 // Non-standard (OGRGeometry).
1961 virtual const char *getGeometryName() const override;
1962 virtual OGRwkbGeometryType getGeometryType() const override;
1963 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1964 const override;
1966 const char* const* papszOptions = nullptr ) const override;
1968 double dfMaxAngleStepSizeDegrees = 0,
1969 const char* const* papszOptions = nullptr) const override;
1970
1971 // IWks Interface.
1972 virtual int WkbSize() const override;
1973 virtual OGRErr importFromWkb( const unsigned char *,
1974 int,
1976 int& nBytesConsumedOut ) override;
1977 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1979 const override;
1981 OGRErr importFromWkt( const char ** ) override;
1982
1983 virtual OGRErr exportToWkt( char ** ppszDstText,
1985 const override;
1986
1987 // ICurvePolygon.
1988 virtual OGRPolygon* CurvePolyToPoly(
1989 double dfMaxAngleStepSizeDegrees = 0,
1990 const char* const* papszOptions = nullptr ) const override;
1991
1992 OGRLinearRing *getExteriorRing();
1993 const OGRLinearRing *getExteriorRing() const;
1994 virtual OGRLinearRing *getInteriorRing( int );
1995 virtual const OGRLinearRing *getInteriorRing( int ) const;
1996
1997 OGRLinearRing *stealExteriorRing();
1998 virtual OGRLinearRing *stealInteriorRing(int);
1999
2000 OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
2001
2003 inline OGRCurvePolygon* toUpperClass() { return this; }
2005 inline const OGRCurvePolygon* toUpperClass() const { return this; }
2006
2007 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2008 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2009
2010 virtual void closeRings() override;
2011};
2012
2014
2015inline const OGRPolygon::ChildType* const * begin(const OGRPolygon* poGeom) { return poGeom->begin(); }
2017inline const OGRPolygon::ChildType* const * end(const OGRPolygon* poGeom) { return poGeom->end(); }
2018
2020inline OGRPolygon::ChildType** begin(OGRPolygon* poGeom) { return poGeom->begin(); }
2022inline OGRPolygon::ChildType** end(OGRPolygon* poGeom) { return poGeom->end(); }
2024
2025/************************************************************************/
2026/* OGRTriangle */
2027/************************************************************************/
2028
2035class CPL_DLL OGRTriangle : public OGRPolygon
2036{
2037 private:
2038 // cppcheck-suppress unusedPrivateFunction
2039 static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
2040 bool quickValidityCheck() const;
2041
2042 protected:
2044 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2045 virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
2046 int bHasZ, int bHasM,
2047 OGRRawPoint*& paoPoints,
2048 int& nMaxPoints,
2049 double*& padfZ ) override;
2051
2052 public:
2054 OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
2055 OGRTriangle( const OGRTriangle &other );
2056 OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
2057 OGRTriangle& operator=( const OGRTriangle& other );
2058 ~OGRTriangle() override;
2059 virtual const char *getGeometryName() const override;
2060 virtual OGRwkbGeometryType getGeometryType() const override;
2061
2062 // IWks Interface.
2063 virtual OGRErr importFromWkb( const unsigned char *,
2064 int,
2066 int& nBytesConsumedOut ) override;
2067
2068 // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
2069 virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) override;
2070
2072 inline OGRPolygon* toUpperClass() { return this; }
2074 inline const OGRPolygon* toUpperClass() const { return this; }
2075
2076 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2077 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2078
2080 static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
2082};
2083
2084/************************************************************************/
2085/* OGRGeometryCollection */
2086/************************************************************************/
2087
2096{
2097 OGRErr importFromWkbInternal( const unsigned char * pabyData,
2098 int nSize,
2099 int nRecLevel,
2100 OGRwkbVariant, int& nBytesConsumedOut );
2101 OGRErr importFromWktInternal( const char **ppszInput, int nRecLevel );
2102
2103 protected:
2105 int nGeomCount = 0;
2106 OGRGeometry **papoGeoms = nullptr;
2107
2108 OGRErr exportToWktInternal( char ** ppszDstText,
2109 OGRwkbVariant eWkbVariant,
2110 const char* pszSkipPrefix ) const;
2111 static OGRGeometryCollection* TransferMembersAndDestroy(
2112 OGRGeometryCollection* poSrc,
2113 OGRGeometryCollection* poDst );
2115 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2116
2117 public:
2120 ~OGRGeometryCollection() override;
2121
2122 OGRGeometryCollection& operator=( const OGRGeometryCollection& other );
2123
2126
2130 ChildType** begin() { return papoGeoms; }
2132 ChildType** end() { return papoGeoms + nGeomCount; }
2136 const ChildType* const* begin() const { return papoGeoms; }
2138 const ChildType* const* end() const { return papoGeoms + nGeomCount; }
2139
2140 // Non standard (OGRGeometry).
2141 virtual const char *getGeometryName() const override;
2142 virtual OGRwkbGeometryType getGeometryType() const override;
2143 virtual OGRGeometry *clone() const override;
2144 virtual void empty() override;
2145 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
2146 virtual void flattenTo2D() override;
2147 virtual OGRBoolean IsEmpty() const override;
2148 virtual void segmentize(double dfMaxLength) override;
2149 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2150 const override;
2151 virtual OGRGeometry* getCurveGeometry(
2152 const char* const* papszOptions = nullptr ) const override;
2153 virtual OGRGeometry* getLinearGeometry(
2154 double dfMaxAngleStepSizeDegrees = 0,
2155 const char* const* papszOptions = nullptr ) const override;
2156
2157 // IWks Interface
2158 virtual int WkbSize() const override;
2159 virtual OGRErr importFromWkb( const unsigned char *,
2160 int,
2162 int& nBytesConsumedOut ) override;
2163 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2165 const override;
2167 OGRErr importFromWkt( const char ** ) override;
2168
2169 virtual OGRErr exportToWkt( char ** ppszDstText,
2171 const override;
2172
2173 virtual double get_Length() const;
2174 virtual double get_Area() const;
2175
2176 // IGeometry methods
2177 virtual int getDimension() const override;
2178 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2179 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2180
2181 // IGeometryCollection
2182 int getNumGeometries() const;
2183 OGRGeometry *getGeometryRef( int );
2184 const OGRGeometry *getGeometryRef( int ) const;
2185
2186 // ISpatialRelation
2187 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
2188
2189 // Non standard
2190 virtual void setCoordinateDimension( int nDimension ) override;
2191 virtual void set3D( OGRBoolean bIs3D ) override;
2192 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2193 virtual OGRErr addGeometry( const OGRGeometry * );
2194 virtual OGRErr addGeometryDirectly( OGRGeometry * );
2195 virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2196
2197 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2198
2199 void closeRings() override;
2200
2201 virtual void swapXY() override;
2202
2203 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2204 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2205
2206 static OGRGeometryCollection* CastToGeometryCollection(
2207 OGRGeometryCollection* poSrc );
2208};
2209
2211
2212inline const OGRGeometryCollection::ChildType* const * begin(const OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2214inline const OGRGeometryCollection::ChildType* const * end(const OGRGeometryCollection* poGeom) { return poGeom->end(); }
2215
2217inline OGRGeometryCollection::ChildType** begin(OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2219inline OGRGeometryCollection::ChildType** end(OGRGeometryCollection* poGeom) { return poGeom->end(); }
2221
2222/************************************************************************/
2223/* OGRMultiSurface */
2224/************************************************************************/
2225
2233{
2234 protected:
2235 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2236 const override;
2237
2238 public:
2241 ~OGRMultiSurface() override;
2242
2243 OGRMultiSurface& operator=( const OGRMultiSurface& other );
2244
2247
2251 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2253 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2257 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2259 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2260
2261 // Non standard (OGRGeometry).
2262 virtual const char *getGeometryName() const override;
2263 virtual OGRwkbGeometryType getGeometryType() const override;
2265 OGRErr importFromWkt( const char ** ) override;
2266
2267 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2268 const override;
2269
2270 // IMultiSurface methods
2271 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
2272
2273 // IGeometry methods
2274 virtual int getDimension() const override;
2275
2276 // Non standard
2277 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2278 const override;
2279
2281 inline OGRGeometryCollection* toUpperClass() { return this; }
2283 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2284
2285 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2286 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2287
2288 static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
2289};
2290
2292
2293inline const OGRMultiSurface::ChildType* const * begin(const OGRMultiSurface* poGeom) { return poGeom->begin(); }
2295inline const OGRMultiSurface::ChildType* const * end(const OGRMultiSurface* poGeom) { return poGeom->end(); }
2296
2298inline OGRMultiSurface::ChildType** begin(OGRMultiSurface* poGeom) { return poGeom->begin(); }
2300inline OGRMultiSurface::ChildType** end(OGRMultiSurface* poGeom) { return poGeom->end(); }
2302
2303/************************************************************************/
2304/* OGRMultiPolygon */
2305/************************************************************************/
2306
2311class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
2312{
2313 protected:
2314 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2315 const override;
2316 friend class OGRPolyhedralSurface;
2317 friend class OGRTriangulatedSurface;
2318
2319 private:
2321 OGRErr _addGeometryWithExpectedSubGeometryType(
2322 const OGRGeometry * poNewGeom,
2323 OGRwkbGeometryType eSubGeometryType );
2324 OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
2325 OGRGeometry * poNewGeom,
2326 OGRwkbGeometryType eSubGeometryType );
2328
2329
2330 public:
2333 ~OGRMultiPolygon() override;
2334
2336
2339
2343 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2345 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2349 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2351 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2352
2353 // Non-standard (OGRGeometry).
2354 virtual const char *getGeometryName() const override;
2355 virtual OGRwkbGeometryType getGeometryType() const override;
2357 const override;
2358
2359 // Non standard
2360 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2361 const override;
2362
2364 inline OGRGeometryCollection* toUpperClass() { return this; }
2366 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2367
2368 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2369 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2370
2371 static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
2372};
2373
2375
2376inline const OGRMultiPolygon::ChildType* const * begin(const OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2378inline const OGRMultiPolygon::ChildType* const * end(const OGRMultiPolygon* poGeom) { return poGeom->end(); }
2379
2381inline OGRMultiPolygon::ChildType** begin(OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2383inline OGRMultiPolygon::ChildType** end(OGRMultiPolygon* poGeom) { return poGeom->end(); }
2385
2386/************************************************************************/
2387/* OGRPolyhedralSurface */
2388/************************************************************************/
2389
2396class CPL_DLL OGRPolyhedralSurface : public OGRSurface
2397{
2398 protected:
2400 friend class OGRTriangulatedSurface;
2401 OGRMultiPolygon oMP{};
2402 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
2403 const override;
2404 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
2405 const override;
2406 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2407 virtual const char* getSubGeometryName() const;
2408 virtual OGRwkbGeometryType getSubGeometryType() const;
2409 OGRErr exportToWktInternal (char ** ppszDstText, OGRwkbVariant eWkbVariant,
2410 const char* pszSkipPrefix ) const;
2411
2412 virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2413 const;
2414 static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
2416
2417 public:
2422
2425
2429 ChildType** begin() { return oMP.begin(); }
2431 ChildType** end() { return oMP.end(); }
2435 const ChildType* const* begin() const { return oMP.begin(); }
2437 const ChildType* const* end() const { return oMP.end(); }
2438
2439 // IWks Interface.
2440 virtual int WkbSize() const override;
2441 virtual const char *getGeometryName() const override;
2442 virtual OGRwkbGeometryType getGeometryType() const override;
2443 virtual OGRErr importFromWkb( const unsigned char *,
2444 int,
2446 int& nBytesConsumedOut ) override;
2447 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2449 const override;
2451 OGRErr importFromWkt( const char ** ) override;
2452 virtual OGRErr exportToWkt( char ** ppszDstText,
2454 const override;
2455
2456 // IGeometry methods.
2457 virtual int getDimension() const override;
2458
2459 virtual void empty() override;
2460
2461 virtual OGRGeometry *clone() const override;
2462 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2463 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2464
2465 virtual void flattenTo2D() override;
2466 virtual OGRErr transform( OGRCoordinateTransformation* ) override;
2467 virtual OGRBoolean Equals( const OGRGeometry* ) const override;
2468 virtual double get_Area() const override;
2469 virtual OGRErr PointOnSurface( OGRPoint* ) const override;
2470
2472 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2473 const override;
2474 virtual OGRErr addGeometry( const OGRGeometry * );
2476 int getNumGeometries() const;
2478 const OGRGeometry* getGeometryRef(int i) const;
2479
2480 virtual OGRBoolean IsEmpty() const override;
2481 virtual void setCoordinateDimension( int nDimension ) override;
2482 virtual void set3D( OGRBoolean bIs3D ) override;
2483 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2484 virtual void swapXY() override;
2485 OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2486
2487 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2488 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2489
2490 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2491};
2492
2494
2495inline const OGRPolyhedralSurface::ChildType* const * begin(const OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2497inline const OGRPolyhedralSurface::ChildType* const * end(const OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2498
2500inline OGRPolyhedralSurface::ChildType** begin(OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2502inline OGRPolyhedralSurface::ChildType** end(OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2504
2505/************************************************************************/
2506/* OGRTriangulatedSurface */
2507/************************************************************************/
2508
2516{
2517 protected:
2519 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2520 const override;
2521 virtual const char* getSubGeometryName() const override;
2522 virtual OGRwkbGeometryType getSubGeometryType() const override;
2523
2524 virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2525 const override;
2526 static OGRMultiPolygon *
2527 CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
2529
2530 public:
2534
2537
2541 ChildType** begin() { return reinterpret_cast<ChildType**>(oMP.begin()); }
2543 ChildType** end() { return reinterpret_cast<ChildType**>(oMP.end()); }
2547 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oMP.begin()); }
2549 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oMP.end()); }
2550
2551 OGRTriangulatedSurface& operator=( const OGRTriangulatedSurface& other );
2552 virtual const char *getGeometryName() const override;
2553 virtual OGRwkbGeometryType getGeometryType() const override;
2554
2555 // IWks Interface.
2556 virtual OGRErr addGeometry( const OGRGeometry * ) override;
2557
2559 inline OGRPolyhedralSurface* toUpperClass() { return this; }
2561 inline const OGRPolyhedralSurface* toUpperClass() const { return this; }
2562
2563 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2564 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2565
2566 static OGRPolyhedralSurface *
2567 CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
2568};
2569
2571
2572inline const OGRTriangulatedSurface::ChildType* const * begin(const OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2574inline const OGRTriangulatedSurface::ChildType* const * end(const OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2575
2577inline OGRTriangulatedSurface::ChildType** begin(OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2579inline OGRTriangulatedSurface::ChildType** end(OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2581
2582/************************************************************************/
2583/* OGRMultiPoint */
2584/************************************************************************/
2585
2591{
2592 private:
2593 OGRErr importFromWkt_Bracketed( const char **, int bHasM, int bHasZ );
2594
2595 protected:
2596 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2597 const override;
2598
2599 public:
2602 ~OGRMultiPoint() override;
2603
2604 OGRMultiPoint& operator=(const OGRMultiPoint& other);
2605
2608
2612 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2614 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2618 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2620 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2621
2622 // Non-standard (OGRGeometry).
2623 virtual const char *getGeometryName() const override;
2624 virtual OGRwkbGeometryType getGeometryType() const override;
2626 OGRErr importFromWkt( const char ** ) override;
2627 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2628 const override;
2629
2630 // IGeometry methods.
2631 virtual int getDimension() const override;
2632
2634 inline OGRGeometryCollection* toUpperClass() { return this; }
2636 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2637
2638 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2639 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2640
2641 // Non-standard.
2642 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2643 const override;
2644};
2645
2647
2648inline const OGRMultiPoint::ChildType* const * begin(const OGRMultiPoint* poGeom) { return poGeom->begin(); }
2650inline const OGRMultiPoint::ChildType* const * end(const OGRMultiPoint* poGeom) { return poGeom->end(); }
2651
2653inline OGRMultiPoint::ChildType** begin(OGRMultiPoint* poGeom) { return poGeom->begin(); }
2655inline OGRMultiPoint::ChildType** end(OGRMultiPoint* poGeom) { return poGeom->end(); }
2657
2658/************************************************************************/
2659/* OGRMultiCurve */
2660/************************************************************************/
2661
2669{
2670 protected:
2672 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
2673 OGRCurve* poCurve );
2675 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2676 const override;
2677
2678 public:
2681 ~OGRMultiCurve() override;
2682
2683 OGRMultiCurve& operator=( const OGRMultiCurve& other );
2684
2687
2691 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2693 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2697 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2699 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2700
2701 // Non standard (OGRGeometry).
2702 virtual const char *getGeometryName() const override;
2703 virtual OGRwkbGeometryType getGeometryType() const override;
2705 OGRErr importFromWkt( const char ** ) override;
2706 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2707 const override;
2708
2709 // IGeometry methods.
2710 virtual int getDimension() const override;
2711
2712 // Non-standard.
2713 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2714 const override;
2715
2717 inline OGRGeometryCollection* toUpperClass() { return this; }
2719 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2720
2721 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2722 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2723
2724 static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
2725};
2726
2728
2729inline const OGRMultiCurve::ChildType* const * begin(const OGRMultiCurve* poGeom) { return poGeom->begin(); }
2731inline const OGRMultiCurve::ChildType* const * end(const OGRMultiCurve* poGeom) { return poGeom->end(); }
2732
2734inline OGRMultiCurve::ChildType** begin(OGRMultiCurve* poGeom) { return poGeom->begin(); }
2736inline OGRMultiCurve::ChildType** end(OGRMultiCurve* poGeom) { return poGeom->end(); }
2738
2739/************************************************************************/
2740/* OGRMultiLineString */
2741/************************************************************************/
2742
2747class CPL_DLL OGRMultiLineString : public OGRMultiCurve
2748{
2749 protected:
2750 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2751 const override;
2752
2753 public:
2756 ~OGRMultiLineString() override;
2757
2758 OGRMultiLineString& operator=( const OGRMultiLineString& other );
2759
2762
2766 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2768 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2772 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2774 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2775
2776 // Non standard (OGRGeometry).
2777 virtual const char *getGeometryName() const override;
2778 virtual OGRwkbGeometryType getGeometryType() const override;
2779 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2780 const override;
2781
2782 // Non standard
2783 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2784 const override;
2785
2787 inline OGRGeometryCollection* toUpperClass() { return this; }
2789 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2790
2791 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2792 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2793
2794 static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
2795};
2796
2798
2799inline const OGRMultiLineString::ChildType* const * begin(const OGRMultiLineString* poGeom) { return poGeom->begin(); }
2801inline const OGRMultiLineString::ChildType* const * end(const OGRMultiLineString* poGeom) { return poGeom->end(); }
2802
2804inline OGRMultiLineString::ChildType** begin(OGRMultiLineString* poGeom) { return poGeom->begin(); }
2806inline OGRMultiLineString::ChildType** end(OGRMultiLineString* poGeom) { return poGeom->end(); }
2808
2809/************************************************************************/
2810/* OGRGeometryFactory */
2811/************************************************************************/
2812
2818{
2819 static OGRErr createFromFgfInternal( const unsigned char *pabyData,
2820 OGRSpatialReference * poSR,
2821 OGRGeometry **ppoReturn,
2822 int nBytes,
2823 int *pnBytesConsumed,
2824 int nRecLevel );
2825 public:
2826 static OGRErr createFromWkb( const void *, OGRSpatialReference *,
2827 OGRGeometry **, int = -1,
2829 static OGRErr createFromWkb( const void * pabyData,
2831 OGRGeometry **,
2832 int nSize,
2833 OGRwkbVariant eVariant,
2834 int& nBytesConsumedOut );
2835 static OGRErr createFromWkt( const char* , OGRSpatialReference *,
2836 OGRGeometry ** );
2837 static OGRErr createFromWkt( const char **, OGRSpatialReference *,
2838 OGRGeometry ** );
2842 static OGRErr createFromWkt( char ** ppszInput, OGRSpatialReference * poSRS,
2843 OGRGeometry ** ppoGeom )
2844 CPL_WARN_DEPRECATED("Use createFromWkt(const char**, ...) instead")
2845 {
2846 return createFromWkt( const_cast<const char**>(ppszInput), poSRS, ppoGeom);
2847 }
2848
2849 static OGRErr createFromFgf( const void*, OGRSpatialReference *,
2850 OGRGeometry **, int = -1, int * = nullptr );
2851 static OGRGeometry *createFromGML( const char * );
2852 static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
2853 GEOSGeom );
2854 static OGRGeometry *createFromGeoJson( const char *);
2855 static OGRGeometry *createFromGeoJson( const CPLJSONObject &oJSONObject );
2856
2857 static void destroyGeometry( OGRGeometry * );
2858 static OGRGeometry *createGeometry( OGRwkbGeometryType );
2859
2860 static OGRGeometry * forceToPolygon( OGRGeometry * );
2861 static OGRGeometry * forceToLineString( OGRGeometry *,
2862 bool bOnlyInOrder = true );
2863 static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
2864 static OGRGeometry * forceToMultiPoint( OGRGeometry * );
2865 static OGRGeometry * forceToMultiLineString( OGRGeometry * );
2866
2867 static OGRGeometry * forceTo( OGRGeometry* poGeom,
2868 OGRwkbGeometryType eTargetType,
2869 const char*const* papszOptions = nullptr );
2870
2871 static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
2872 int nPolygonCount,
2873 int *pbResultValidGeometry,
2874 const char **papszOptions = nullptr);
2875 static bool haveGEOS();
2876
2877 static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
2879 char** papszOptions );
2880
2881 static OGRGeometry*
2882 approximateArcAngles( double dfX, double dfY, double dfZ,
2883 double dfPrimaryRadius, double dfSecondaryAxis,
2884 double dfRotation,
2885 double dfStartAngle, double dfEndAngle,
2886 double dfMaxAngleStepSizeDegrees );
2887
2888 static int GetCurveParmeters( double x0, double y0,
2889 double x1, double y1,
2890 double x2, double y2,
2891 double& R, double& cx, double& cy,
2892 double& alpha0, double& alpha1,
2893 double& alpha2 );
2894 static OGRLineString* curveToLineString(
2895 double x0, double y0, double z0,
2896 double x1, double y1, double z1,
2897 double x2, double y2, double z2,
2898 int bHasZ,
2899 double dfMaxAngleStepSizeDegrees,
2900 const char* const * papszOptions = nullptr );
2901 static OGRCurve* curveFromLineString(
2902 const OGRLineString* poLS,
2903 const char* const * papszOptions = nullptr);
2904};
2905
2906OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
2907const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
2908
2910typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
2913void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
2914int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
2915 const OGRGeometry* poOtherGeom );
2916int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
2917 const OGRGeometry* poOtherGeom );
2918
2920struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
2921{
2922 void operator()(OGRPreparedGeometry*) const;
2923};
2925
2929typedef std::unique_ptr<OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter> OGRPreparedGeometryUniquePtr;
2930
2931#endif /* ndef OGR_GEOMETRY_H_INCLUDED */
The CPLJSONArray class holds JSON object from CPLJSONDocument.
Definition: cpl_json.h:54
OGRGeometry visitor interface.
Definition: ogr_geometry.h:192
virtual void visit(const OGRCurvePolygon *)=0
Visit OGRCurvePolygon.
virtual void visit(const OGRPolyhedralSurface *)=0
Visit OGRPolyhedralSurface.
virtual void visit(const OGRCompoundCurve *)=0
Visit OGRCompoundCurve.
virtual void visit(const OGRMultiLineString *)=0
Visit OGRMultiLineString.
virtual void visit(const OGRTriangulatedSurface *)=0
Visit OGRTriangulatedSurface.
virtual void visit(const OGRPolygon *)=0
Visit OGRPolygon.
virtual void visit(const OGRMultiPolygon *)=0
Visit OGRMultiPolygon.
virtual void visit(const OGRTriangle *)=0
Visit OGRTriangle.
virtual void visit(const OGRLineString *)=0
Visit OGRLineString.
virtual void visit(const OGRMultiPoint *)=0
Visit OGRMultiPoint.
virtual void visit(const OGRMultiCurve *)=0
Visit OGRMultiCurve.
virtual void visit(const OGRGeometryCollection *)=0
Visit OGRGeometryCollection.
virtual void visit(const OGRPoint *)=0
Visit OGRPoint.
virtual ~IOGRConstGeometryVisitor()=default
Destructor/.
virtual void visit(const OGRMultiSurface *)=0
Visit OGRMultiSurface.
virtual void visit(const OGRLinearRing *)=0
Visit OGRLinearRing.
virtual void visit(const OGRCircularString *)=0
Visit OGRCircularString.
OGRGeometry visitor interface.
Definition: ogr_geometry.h:118
virtual void visit(OGRMultiSurface *)=0
Visit OGRMultiSurface.
virtual void visit(OGRLinearRing *)=0
Visit OGRLinearRing.
virtual void visit(OGRTriangle *)=0
Visit OGRTriangle.
virtual void visit(OGRCircularString *)=0
Visit OGRCircularString.
virtual void visit(OGRPolygon *)=0
Visit OGRPolygon.
virtual void visit(OGRLineString *)=0
Visit OGRLineString.
virtual void visit(OGRCompoundCurve *)=0
Visit OGRCompoundCurve.
virtual void visit(OGRTriangulatedSurface *)=0
Visit OGRTriangulatedSurface.
virtual void visit(OGRPoint *)=0
Visit OGRPoint.
virtual void visit(OGRCurvePolygon *)=0
Visit OGRCurvePolygon.
virtual void visit(OGRGeometryCollection *)=0
Visit OGRGeometryCollection.
virtual void visit(OGRPolyhedralSurface *)=0
Visit OGRPolyhedralSurface.
virtual void visit(OGRMultiPolygon *)=0
Visit OGRMultiPolygon.
virtual ~IOGRGeometryVisitor()=default
Destructor/.
virtual void visit(OGRMultiLineString *)=0
Visit OGRMultiLineString.
virtual void visit(OGRMultiPoint *)=0
Visit OGRMultiPoint.
virtual void visit(OGRMultiCurve *)=0
Visit OGRMultiCurve.
Concrete representation of a circular string, that is to say a curve made of one or several arc circl...
Definition: ogr_geometry.h:1396
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1462
OGRCircularString()
Create an empty circular string.
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1460
OGRCircularString(const OGRCircularString &other)
Copy constructor.
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1458
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1463
Utility class to store a collection of curves.
Definition: ogr_geometry.h:1581
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1701
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:1632
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:1630
OGRCompoundCurve(const OGRCompoundCurve &other)
Copy constructor.
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:1619
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:1626
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1624
OGRCompoundCurve()
Create an empty compound curve.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1700
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:676
Concrete class representing curve polygons.
Definition: ogr_geometry.h:1763
OGRCurve * stealExteriorRingCurve()
"Steal" reference to external ring.
Definition: ogrcurvepolygon.cpp:307
OGRCurve * getExteriorRingCurve()
Fetch reference to external polygon ring.
Definition: ogrcurvepolygon.cpp:201
OGRCurve * getInteriorRingCurve(int)
Fetch reference to indicated internal ring.
Definition: ogrcurvepolygon.cpp:266
virtual OGRBoolean Contains(const OGRGeometry *) const override
Test for containment.
Definition: ogrcurvepolygon.cpp:783
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrcurvepolygon.cpp:165
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1881
virtual void empty() override
Clear geometry information.
Definition: ogrcurvepolygon.cpp:128
virtual void getEnvelope(OGREnvelope *psEnvelope) const override
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure.
Definition: ogrcurvepolygon.cpp:619
static OGRPolygon * CastToPolygon(OGRCurvePolygon *poCP)
Convert to polygon.
Definition: ogrcurvepolygon.cpp:830
virtual double get_Area() const override
Get the area of the surface object.
Definition: ogrcurvepolygon.cpp:668
virtual OGRErr transform(OGRCoordinateTransformation *poCT) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrcurvepolygon.cpp:658
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrcurvepolygon.cpp:155
virtual OGRBoolean Intersects(const OGRGeometry *) const override
Do these features intersect?
Definition: ogrcurvepolygon.cpp:799
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrcurvepolygon.cpp:740
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrcurvepolygon.cpp:639
virtual void segmentize(double dfMaxLength) override
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrcurvepolygon.cpp:726
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:1799
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogrcurvepolygon.cpp:717
OGRCurvePolygon()
Create an empty curve polygon.
virtual OGRGeometry * clone() const override
Make a copy of this object.
Definition: ogrcurvepolygon.cpp:103
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrcurvepolygon.cpp:708
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:1812
virtual OGRErr addRing(OGRCurve *)
Add a ring to a polygon.
Definition: ogrcurvepolygon.cpp:362
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:1810
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1804
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrcurvepolygon.cpp:688
virtual void setMeasured(OGRBoolean bIsMeasured) override
Add or remove the M coordinate dimension.
Definition: ogrcurvepolygon.cpp:699
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:1806
int getNumInteriorRings() const
Fetch the number of internal rings.
Definition: ogrcurvepolygon.cpp:238
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1882
OGRErr removeRing(int iIndex, bool bDelete=true)
Remove a geometry from the container.
Definition: ogrcurvepolygon.cpp:339
OGRCurvePolygon(const OGRCurvePolygon &)
Copy constructor.
virtual void set3D(OGRBoolean bIs3D) override
Add or remove the Z coordinate dimension.
Definition: ogrcurvepolygon.cpp:694
Abstract curve base class for OGRLineString, OGRCircularString and OGRCompoundCurve.
Definition: ogr_geometry.h:926
virtual OGRLineString * CurveToLine(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const =0
Return a linestring from a curve geometry.
virtual double get_Length() const =0
Returns the length of the curve.
virtual int IntersectsPoint(const OGRPoint *p) const
Returns if a point intersects a (closed) curve.
Definition: ogrcurve.cpp:416
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1006
virtual void StartPoint(OGRPoint *) const =0
Return the curve start point.
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
virtual int getNumPoints() const =0
Return the number of points of a curve geometry.
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:968
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1001
virtual int ContainsPoint(const OGRPoint *p) const
Returns if a point is contained in a (closed) curve.
Definition: ogrcurve.cpp:396
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
virtual OGRPointIterator * getPointIterator() const =0
Returns a point iterator over the curve.
virtual double get_AreaOfCurveSegments() const =0
Get the area of the purely curve portions of a (closed) curve.
virtual double get_Area() const =0
Get the area of the (closed) curve.
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:239
void visit(const OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:244
OGRGeometry visitor default implementation.
Definition: ogr_geometry.h:165
void visit(OGRPoint *) override
Visit OGRPoint.
Definition: ogr_geometry.h:170
A collection of 1 or more geometry objects.
Definition: ogr_geometry.h:2096
ChildType ** end()
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2132
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2203
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2204
const ChildType *const * begin() const
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2136
const ChildType *const * end() const
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2138
ChildType ** begin()
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2130
OGRGeometryCollection()
Create an empty geometry collection.
OGRGeometry ChildType
Type of child elements.
Definition: ogr_geometry.h:2125
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:2818
static OGRErr createFromWkt(char **ppszInput, OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
Definition: ogr_geometry.h:2842
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:287
const OGRSurface * toSurface() const
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:628
const OGRCurvePolygon * toCurvePolygon() const
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:670
const OGRMultiCurve * toMultiCurve() const
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:740
const OGRPolyhedralSurface * toPolyhedralSurface() const
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:768
const OGRMultiPoint * toMultiPoint() const
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:698
virtual void empty()=0
Clear geometry information.
const OGRMultiPolygon * toMultiPolygon() const
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:726
virtual OGRBoolean Equals(const OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
OGRPolyhedralSurface * toPolyhedralSurface()
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:761
const OGRMultiSurface * toMultiSurface() const
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:754
OGRPoint * toPoint()
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:523
bool operator!=(const OGRGeometry &other) const
Returns if two geometries are different.
Definition: ogr_geometry.h:352
OGRTriangle * toTriangle()
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:649
OGRLineString * toLineString()
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:565
const OGRLinearRing * toLinearRing() const
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:586
const OGRPoint * toPoint() const
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:530
virtual OGRGeometry * getCurveGeometry(const char *const *papszOptions=nullptr) const CPL_WARN_UNUSED_RESULT
Return curve version of this geometry.
Definition: ogrgeometry.cpp:3157
OGRMultiLineString * toMultiLineString()
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:705
OGRMultiSurface * toMultiSurface()
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:747
static OGRGeometry * FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
Definition: ogr_geometry.h:516
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
virtual void accept(IOGRConstGeometryVisitor *visitor) const =0
Accept a visitor.
const OGRGeometryCollection * toGeometryCollection() const
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:684
virtual OGRGeometry * clone() const CPL_WARN_UNUSED_RESULT=0
Make a copy of this object.
const OGRMultiLineString * toMultiLineString() const
Down-cast to OGRMultiLineString*.
Definition: ogr_geometry.h:712
const OGRCircularString * toCircularString() const
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:600
OGRPolygon * toPolygon()
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:635
bool operator==(const OGRGeometry &other) const
Returns if two geometries are equal.
Definition: ogr_geometry.h:349
OGRLinearRing * toLinearRing()
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:579
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:364
virtual void accept(IOGRGeometryVisitor *visitor)=0
Accept a visitor.
OGRMultiCurve * toMultiCurve()
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:733
const OGRCompoundCurve * toCompoundCurve() const
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:614
virtual OGRErr transform(OGRCoordinateTransformation *poCT)=0
Apply arbitrary coordinate transformation to geometry.
virtual void flattenTo2D()=0
Convert geometry to strictly 2D.
virtual int getDimension() const =0
Get the dimension of this object.
OGRGeometryCollection * toGeometryCollection()
Down-cast to OGRGeometryCollection*.
Definition: ogr_geometry.h:677
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
OGRMultiPolygon * toMultiPolygon()
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:719
const OGRPolygon * toPolygon() const
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:642
OGRCompoundCurve * toCompoundCurve()
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:607
virtual OGRGeometry * getLinearGeometry(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const CPL_WARN_UNUSED_RESULT
Return, possibly approximate, non-curve version of this geometry.
Definition: ogrgeometry.cpp:3122
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.
const OGRLineString * toLineString() const
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:572
OGRCircularString * toCircularString()
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:593
const OGRCurve * toCurve() const
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:544
OGRCurvePolygon * toCurvePolygon()
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:663
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:558
static OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
Definition: ogr_geometry.h:510
OGRBoolean Is3D() const
Definition: ogr_geometry.h:362
OGRMultiPoint * toMultiPoint()
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:691
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:4925
const OGRTriangulatedSurface * toTriangulatedSurface() const
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:782
const OGRTriangle * toTriangle() const
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:656
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
OGRSurface * toSurface()
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:621
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:551
OGRTriangulatedSurface * toTriangulatedSurface()
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:775
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const =0
Convert a geometry into well known text format.
OGRCurve * toCurve()
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:537
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1242
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1281
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1286
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1285
OGRLineString(const OGRLineString &other)
Copy constructor.
OGRLineString()
Create an empty line string.
virtual double get_Area() const override
Get the area of the (closed) curve.
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1283
Concrete representation of a closed ring.
Definition: ogr_geometry.h:1314
OGRLineString * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1359
const OGRLineString * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1361
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1364
OGRLinearRing(const OGRLinearRing &other)
Copy constructor.
OGRLinearRing()
Constructor.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1363
A collection of OGRCurve.
Definition: ogr_geometry.h:2669
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2697
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2699
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2722
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2693
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2719
OGRMultiCurve()
Create an empty multi curve collection.
OGRMultiCurve(const OGRMultiCurve &other)
Copy constructor.
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2686
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2691
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2717
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2721
A collection of OGRLineString.
Definition: ogr_geometry.h:2748
OGRLineString ChildType
Type of child elements.
Definition: ogr_geometry.h:2761
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2787
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2768
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2774
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2792
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2772
OGRMultiLineString()
Create an empty multi line string collection.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2791
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2766
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2789
OGRMultiLineString(const OGRMultiLineString &other)
Copy constructor.
A collection of OGRPoint.
Definition: ogr_geometry.h:2591
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2634
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2638
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2620
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2612
OGRMultiPoint()
Create an empty multi point collection.
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2639
OGRMultiPoint(const OGRMultiPoint &other)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2618
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2636
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:2607
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2614
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:2312
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2338
OGRMultiPolygon(const OGRMultiPolygon &other)
Copy constructor.
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2369
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2351
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2345
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2368
OGRMultiPolygon()
Create an empty multi polygon collection.
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2343
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2364
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2349
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2366
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:2233
OGRMultiSurface()
Create an empty multi surface collection.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2285
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2251
OGRSurface ChildType
Type of child elements.
Definition: ogr_geometry.h:2246
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2283
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2257
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2259
OGRMultiSurface(const OGRMultiSurface &other)
Copy constructor.
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2253
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2286
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2281
Interface for a point iterator.
Definition: ogr_geometry.h:908
virtual OGRBoolean getNextPoint(OGRPoint *p)=0
Returns the next point followed by the iterator.
Point class.
Definition: ogr_geometry.h:810
double getM() const
Return m.
Definition: ogr_geometry.h:858
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:891
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:865
OGRPoint(const OGRPoint &other)
Copy constructor.
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:873
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:878
double getX() const
Return x.
Definition: ogr_geometry.h:852
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:892
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:869
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:847
double getZ() const
Return z.
Definition: ogr_geometry.h:856
double getY() const
Return y.
Definition: ogr_geometry.h:854
Concrete class representing polygons.
Definition: ogr_geometry.h:1913
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:838
OGRLinearRing ChildType
Type of child elements.
Definition: ogr_geometry.h:1945
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:1950
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrpolygon.cpp:621
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolygon.cpp:829
const OGRCurvePolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2005
OGRPolygon()
Create an empty polygon.
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:1952
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrpolygon.cpp:445
virtual OGRPolygon * CurvePolyToPoly(double dfMaxAngleStepSizeDegrees=0, const char *const *papszOptions=nullptr) const override
Return a polygon from a curve polygon.
Definition: ogrpolygon.cpp:818
virtual int WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolygon.cpp:298
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolygon.cpp:372
OGRPolygon(const OGRPolygon &other)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:1956
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2008
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:1958
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2007
OGRCurvePolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2003
virtual void closeRings() override
Force rings to be closed.
Definition: ogrpolygon.cpp:807
PolyhedralSurface class.
Definition: ogr_geometry.h:2397
virtual OGRGeometry * clone() const override
Make a copy of this object.
Definition: ogrpolyhedralsurface.cpp:166
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known binary format.
Definition: ogrpolyhedralsurface.cpp:303
virtual OGRBoolean IsEmpty() const override
Checks if the PolyhedralSurface is empty.
Definition: ogrpolyhedralsurface.cpp:965
virtual void setMeasured(OGRBoolean bIsMeasured) override
Set the type as Measured.
Definition: ogrpolyhedralsurface.cpp:993
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrpolyhedralsurface.cpp:1014
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:906
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrpolyhedralsurface.cpp:1074
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrpolyhedralsurface.cpp:448
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2431
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:817
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2437
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrpolyhedralsurface.cpp:1029
virtual int WkbSize() const override
Returns size of related binary representation.
Definition: ogrpolyhedralsurface.cpp:125
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
virtual void flattenTo2D() override
Convert geometry to strictly 2D.
Definition: ogrpolyhedralsurface.cpp:613
OGRPolyhedralSurface(const OGRPolyhedralSurface &poGeom)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2435
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolyhedralsurface.cpp:1039
~OGRPolyhedralSurface() override
Destructor.
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2429
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrpolyhedralsurface.cpp:211
virtual void set3D(OGRBoolean bIs3D) override
Set the type as 3D geometry.
Definition: ogrpolyhedralsurface.cpp:978
OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
Definition: ogrpolyhedralsurface.cpp:874
OGRErr importFromWkt(const char **) override
deprecated
Definition: ogrpolyhedralsurface.cpp:353
virtual OGRBoolean Equals(const OGRGeometry *) const override
Returns TRUE if two geometries are equivalent.
Definition: ogrpolyhedralsurface.cpp:706
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2487
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2424
virtual double get_Area() const override
Returns the area enclosed.
Definition: ogrpolyhedralsurface.cpp:746
virtual OGRErr transform(OGRCoordinateTransformation *) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrpolyhedralsurface.cpp:625
OGRGeometry * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:928
virtual OGRErr PointOnSurface(OGRPoint *) const override
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogrpolyhedralsurface.cpp:773
OGRPolyhedralSurface()
Create an empty PolyhedralSurface.
virtual int getDimension() const override
Get the dimension of this object.
Definition: ogrpolyhedralsurface.cpp:139
virtual void empty() override
Clear geometry information.
Definition: ogrpolyhedralsurface.cpp:148
OGRErr removeGeometry(int iIndex, int bDelete=TRUE)
Remove a geometry from the container.
Definition: ogrpolyhedralsurface.cpp:1065
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2488
Simple container for a position.
Definition: ogr_geometry.h:64
OGRRawPoint(double xIn, double yIn)
Constructor.
Definition: ogr_geometry.h:70
double x
x
Definition: ogr_geometry.h:73
double y
y
Definition: ogr_geometry.h:75
OGRRawPoint()
Constructor.
Definition: ogr_geometry.h:67
Abstract curve base class for OGRLineString and OGRCircularString.
Definition: ogr_geometry.h:1035
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:1161
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:1160
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1102
virtual int getNumPoints() const override
Fetch vertex count.
Definition: ogr_geometry.h:1158
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:148
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:1728
virtual double get_Area() const =0
Get the area of the surface object.
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:1737
Triangle class.
Definition: ogr_geometry.h:2036
virtual OGRErr importFromWkb(const unsigned char *, int, OGRwkbVariant, int &nBytesConsumedOut) override
Assign geometry from well known binary data.
Definition: ogrtriangle.cpp:188
virtual OGRwkbGeometryType getGeometryType() const override
Fetch geometry type.
Definition: ogrtriangle.cpp:160
const OGRPolygon * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2074
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2076
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2077
OGRTriangle()
Constructor.
~OGRTriangle() override
Destructor.
virtual OGRErr addRingDirectly(OGRCurve *poNewRing) override
Add a ring to a polygon.
Definition: ogrtriangle.cpp:246
OGRPolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2072
OGRTriangle(const OGRTriangle &other)
Copy constructor.
OGRTriangle & operator=(const OGRTriangle &other)
Assignment operator.
Definition: ogrtriangle.cpp:138
virtual const char * getGeometryName() const override
Fetch WKT name for geometry type.
Definition: ogrtriangle.cpp:151
TriangulatedSurface class.
Definition: ogr_geometry.h:2516
~OGRTriangulatedSurface()
Destructor.
OGRTriangulatedSurface & operator=(const OGRTriangulatedSurface &other)
Assignment operator.
Definition: ogrtriangulatedsurface.cpp:84
virtual const char * getGeometryName() const override
Returns the geometry name of the TriangulatedSurface.
Definition: ogrtriangulatedsurface.cpp:116
virtual OGRwkbGeometryType getGeometryType() const override
Returns the WKB Type of TriangulatedSurface.
Definition: ogrtriangulatedsurface.cpp:130
virtual OGRErr addGeometry(const OGRGeometry *) override
Add a new geometry to a collection.
Definition: ogrtriangulatedsurface.cpp:180
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2549
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2547
OGRPolyhedralSurface * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2559
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2563
const OGRPolyhedralSurface * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2561
OGRTriangle ChildType
Type of child elements.
Definition: ogr_geometry.h:2536
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2564
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2541
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2543
OGRTriangulatedSurface()
Constructor.
Various convenience functions for CPL.
Interface for read and write JSON documents.
#define CPL_WARN_UNUSED_RESULT
Qualifier to warn when the return value of a function is not used.
Definition: cpl_port.h:931
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:215
void * OGRGeometryH
Opaque type for a geometry.
Definition: ogr_api.h:60
Core portability services for cross-platform OGR code.
int OGRBoolean
Type for a OGR boolean.
Definition: ogr_core.h:306
OGRwkbByteOrder
Enumeration to describe byte order.
Definition: ogr_core.h:490
OGRwkbVariant
Output variants of WKB we support.
Definition: ogr_core.h:424
@ wkbVariantOldOgc
Old-style 99-402 extended dimension (Z) WKB types.
Definition: ogr_core.h:425
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:318
int OGRErr
Simple container for a bounding region.
Definition: ogr_core.h:290
std::unique_ptr< OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter > OGRPreparedGeometryUniquePtr
Unique pointer type for OGRPreparedGeometry.
Definition: ogr_geometry.h:2929
int OGRPreparedGeometryIntersects(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry intersects with a geometry.
Definition: ogrgeometry.cpp:5741
struct GEOSContextHandle_HS * GEOSContextHandle_t
GEOS context handle type.
Definition: ogr_geometry.h:81
struct _OGRPreparedGeometry OGRPreparedGeometry
Prepared geometry API (needs GEOS >= 3.1.0)
Definition: ogr_geometry.h:2910
OGRwkbGeometryType OGRFromOGCGeomType(const char *pszGeomType)
Map OGCgeometry format type to corresponding OGR constants.
Definition: ogrgeometry.cpp:2288
const char * OGRToOGCGeomType(OGRwkbGeometryType eGeomType)
Map OGR geometry format constants to corresponding OGC geometry type.
Definition: ogrgeometry.cpp:2361
std::unique_ptr< OGRGeometry, OGRGeometryUniquePtrDeleter > OGRGeometryUniquePtr
Unique pointer type for OGRGeometry.
Definition: ogr_geometry.h:797
OGRPreparedGeometry * OGRCreatePreparedGeometry(const OGRGeometry *poGeom)
Creates a prepared geometry.
Definition: ogrgeometry.cpp:5683
int OGRPreparedGeometryContains(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry contains a geometry.
Definition: ogrgeometry.cpp:5771
void OGRDestroyPreparedGeometry(OGRPreparedGeometry *poPreparedGeom)
Destroys a prepared geometry.
Definition: ogrgeometry.cpp:5719
struct GEOSGeom_t * GEOSGeom
GEOS geometry type.
Definition: ogr_geometry.h:79
void sfcgal_geometry_t
SFCGAL geometry type.
Definition: ogr_geometry.h:83
int OGRHasPreparedGeometrySupport()
Returns if GEOS has prepared geometry support.
Definition: ogrgeometry.cpp:5663
Coordinate systems services.
OGRLayer::FeatureIterator begin(OGRLayer *poLayer)
Return begin of feature iterator.
Definition: ogrsf_frmts.h:287
OGRLayer::FeatureIterator end(OGRLayer *poLayer)
Return end of feature iterator.
Definition: ogrsf_frmts.h:292

Generated for GDAL by doxygen 1.9.4.