GDAL
ogr_geometry.h
Go to the documentation of this file.
1/******************************************************************************
2 * $Id: ogr_geometry.h 0ca04053b3a7d0ebc1f0ecdc86e7084162945176 2019-06-13 10:53:23 +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 OGRGeometry* MakeValid() const;
361 virtual OGRBoolean IsSimple() const;
363 OGRBoolean Is3D() const { return flags & OGR_G_3D; }
365 OGRBoolean IsMeasured() const { return flags & OGR_G_MEASURED; }
366 virtual OGRBoolean IsRing() const;
367 virtual void empty() = 0;
369 virtual void getEnvelope( OGREnvelope * psEnvelope ) const = 0;
370 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const = 0;
371
372 // IWks Interface.
373 virtual int WkbSize() const = 0;
374 OGRErr importFromWkb( const GByte*, int=-1,
376 virtual OGRErr importFromWkb( const unsigned char *,
377 int,
379 int& nBytesConsumedOut ) = 0;
380 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
382 virtual OGRErr importFromWkt( const char ** ppszInput ) = 0;
383
387 OGRErr importFromWkt( char ** ppszInput ) CPL_WARN_DEPRECATED("Use importFromWkt(const char**) instead")
388 {
389 return importFromWkt( const_cast<const char**>(ppszInput) );
390 }
391
392 virtual OGRErr exportToWkt( char ** ppszDstText,
394
395 // Non-standard.
397 OGRwkbGeometryType getIsoGeometryType() const;
398 virtual const char *getGeometryName() const = 0;
399 virtual void dumpReadable( FILE *, const char * = nullptr
400 , char** papszOptions = nullptr ) const;
401 virtual void flattenTo2D() = 0;
402 virtual char * exportToGML( const char* const * papszOptions = nullptr ) const;
403 virtual char * exportToKML() const;
404 virtual char * exportToJson() const;
405
407 virtual void accept(IOGRGeometryVisitor* visitor) = 0;
408
410 virtual void accept(IOGRConstGeometryVisitor* visitor) const = 0;
411
412 static GEOSContextHandle_t createGEOSContext();
413 static void freeGEOSContext( GEOSContextHandle_t hGEOSCtxt );
414 virtual GEOSGeom exportToGEOS( GEOSContextHandle_t hGEOSCtxt )
416 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE) const;
417 virtual OGRGeometry* getCurveGeometry(
418 const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
419 virtual OGRGeometry* getLinearGeometry(
420 double dfMaxAngleStepSizeDegrees = 0,
421 const char* const* papszOptions = nullptr ) const CPL_WARN_UNUSED_RESULT;
422
423 // SFCGAL interfacing methods.
425 static sfcgal_geometry_t* OGRexportToSFCGAL( const OGRGeometry *poGeom );
426 static OGRGeometry* SFCGALexportToOGR( const sfcgal_geometry_t* _geometry );
428 virtual void closeRings();
429
430 virtual void setCoordinateDimension( int nDimension );
431 virtual void set3D( OGRBoolean bIs3D );
432 virtual void setMeasured( OGRBoolean bIsMeasured );
433
434 virtual void assignSpatialReference( OGRSpatialReference * poSR );
435 OGRSpatialReference *getSpatialReference( void ) const { return poSRS; }
436
438 OGRErr transformTo( OGRSpatialReference *poSR );
439
440 virtual void segmentize(double dfMaxLength);
441
442 // ISpatialRelation
443 virtual OGRBoolean Intersects( const OGRGeometry * ) const;
444 virtual OGRBoolean Equals( const OGRGeometry * ) const = 0;
445 virtual OGRBoolean Disjoint( const OGRGeometry * ) const;
446 virtual OGRBoolean Touches( const OGRGeometry * ) const;
447 virtual OGRBoolean Crosses( const OGRGeometry * ) const;
448 virtual OGRBoolean Within( const OGRGeometry * ) const;
449 virtual OGRBoolean Contains( const OGRGeometry * ) const;
450 virtual OGRBoolean Overlaps( const OGRGeometry * ) const;
451// virtual OGRBoolean Relate( const OGRGeometry *, const char * ) const;
452// virtual OGRGeometry *LocateAlong( double mValue ) const;
453// virtual OGRGeometry *LocateBetween( double mStart, double mEnd ) const;
454
455 virtual OGRGeometry *Boundary() const CPL_WARN_UNUSED_RESULT;
456 virtual double Distance( const OGRGeometry * ) const ;
457 virtual OGRGeometry *ConvexHull() const CPL_WARN_UNUSED_RESULT;
458 virtual OGRGeometry *Buffer( double dfDist, int nQuadSegs = 30 )
460 virtual OGRGeometry *Intersection( const OGRGeometry *)
462 virtual OGRGeometry *Union( const OGRGeometry * )
464 virtual OGRGeometry *UnionCascaded() const CPL_WARN_UNUSED_RESULT;
465 virtual OGRGeometry *Difference( const OGRGeometry * )
467 virtual OGRGeometry *SymDifference( const OGRGeometry * )
469 virtual OGRErr Centroid( OGRPoint * poPoint ) const;
470 virtual OGRGeometry *Simplify(double dTolerance)
472 OGRGeometry *SimplifyPreserveTopology(double dTolerance)
474 virtual OGRGeometry *DelaunayTriangulation(
475 double dfTolerance, int bOnlyEdges ) const CPL_WARN_UNUSED_RESULT;
476
477 virtual OGRGeometry *Polygonize() const CPL_WARN_UNUSED_RESULT;
478
479 virtual double Distance3D( const OGRGeometry *poOtherGeom ) const;
480
482 // backward compatibility to non-standard method names.
483 OGRBoolean Intersect( OGRGeometry * )
484 const CPL_WARN_DEPRECATED("Non standard method. "
485 "Use Intersects() instead");
486 OGRBoolean Equal( OGRGeometry * )
487 const CPL_WARN_DEPRECATED("Non standard method. "
488 "Use Equals() instead");
489 OGRGeometry *SymmetricDifference( const OGRGeometry * )
490 const CPL_WARN_DEPRECATED("Non standard method. "
491 "Use SymDifference() instead");
492 OGRGeometry *getBoundary()
493 const CPL_WARN_DEPRECATED("Non standard method. "
494 "Use Boundary() instead");
496
498 // Special HACK for DB2 7.2 support
499 static int bGenerate_DB2_V72_BYTE_ORDER;
501
502 virtual void swapXY();
504 static OGRGeometry* CastToIdentity( OGRGeometry* poGeom ) { return poGeom; }
505 static OGRGeometry* CastToError( OGRGeometry* poGeom );
507
511 static inline OGRGeometryH ToHandle(OGRGeometry* poGeom)
512 { return reinterpret_cast<OGRGeometryH>(poGeom); }
513
517 static inline OGRGeometry* FromHandle(OGRGeometryH hGeom)
518 { return reinterpret_cast<OGRGeometry*>(hGeom); }
519
525 { return cpl::down_cast<OGRPoint*>(this); }
526
531 inline const OGRPoint* toPoint() const
532 { return cpl::down_cast<const OGRPoint*>(this); }
533
539 { return cpl::down_cast<OGRCurve*>(this); }
540
545 inline const OGRCurve* toCurve() const
546 { return cpl::down_cast<const OGRCurve*>(this); }
547
553 { return cpl::down_cast<OGRSimpleCurve*>(this); }
554
559 inline const OGRSimpleCurve* toSimpleCurve() const
560 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
561
567 { return cpl::down_cast<OGRLineString*>(this); }
568
573 inline const OGRLineString* toLineString() const
574 { return cpl::down_cast<const OGRLineString*>(this); }
575
581 { return cpl::down_cast<OGRLinearRing*>(this); }
582
587 inline const OGRLinearRing* toLinearRing() const
588 { return cpl::down_cast<const OGRLinearRing*>(this); }
589
595 { return cpl::down_cast<OGRCircularString*>(this); }
596
602 { return cpl::down_cast<const OGRCircularString*>(this); }
603
609 { return cpl::down_cast<OGRCompoundCurve*>(this); }
610
615 inline const OGRCompoundCurve* toCompoundCurve() const
616 { return cpl::down_cast<const OGRCompoundCurve*>(this); }
617
623 { return cpl::down_cast<OGRSurface*>(this); }
624
629 inline const OGRSurface* toSurface() const
630 { return cpl::down_cast<const OGRSurface*>(this); }
631
637 { return cpl::down_cast<OGRPolygon*>(this); }
638
643 inline const OGRPolygon* toPolygon() const
644 { return cpl::down_cast<const OGRPolygon*>(this); }
645
651 { return cpl::down_cast<OGRTriangle*>(this); }
652
657 inline const OGRTriangle* toTriangle() const
658 { return cpl::down_cast<const OGRTriangle*>(this); }
659
665 { return cpl::down_cast<OGRCurvePolygon*>(this); }
666
671 inline const OGRCurvePolygon* toCurvePolygon() const
672 { return cpl::down_cast<const OGRCurvePolygon*>(this); }
673
679 { return cpl::down_cast<OGRGeometryCollection*>(this); }
680
686 { return cpl::down_cast<const OGRGeometryCollection*>(this); }
687
693 { return cpl::down_cast<OGRMultiPoint*>(this); }
694
699 inline const OGRMultiPoint* toMultiPoint() const
700 { return cpl::down_cast<const OGRMultiPoint*>(this); }
701
707 { return cpl::down_cast<OGRMultiLineString*>(this); }
708
714 { return cpl::down_cast<const OGRMultiLineString*>(this); }
715
721 { return cpl::down_cast<OGRMultiPolygon*>(this); }
722
727 inline const OGRMultiPolygon* toMultiPolygon() const
728 { return cpl::down_cast<const OGRMultiPolygon*>(this); }
729
735 { return cpl::down_cast<OGRMultiCurve*>(this); }
736
741 inline const OGRMultiCurve* toMultiCurve() const
742 { return cpl::down_cast<const OGRMultiCurve*>(this); }
743
749 { return cpl::down_cast<OGRMultiSurface*>(this); }
750
755 inline const OGRMultiSurface* toMultiSurface() const
756 { return cpl::down_cast<const OGRMultiSurface*>(this); }
757
763 { return cpl::down_cast<OGRPolyhedralSurface*>(this); }
764
770 { return cpl::down_cast<const OGRPolyhedralSurface*>(this); }
771
777 { return cpl::down_cast<OGRTriangulatedSurface*>(this); }
778
784 { return cpl::down_cast<const OGRTriangulatedSurface*>(this); }
785
786};
787
789struct CPL_DLL OGRGeometryUniquePtrDeleter
790{
791 void operator()(OGRGeometry*) const;
792};
794
798typedef std::unique_ptr<OGRGeometry, OGRGeometryUniquePtrDeleter> OGRGeometryUniquePtr;
799
800/************************************************************************/
801/* OGRPoint */
802/************************************************************************/
803
810class CPL_DLL OGRPoint : public OGRGeometry
811{
812 double x;
813 double y;
814 double z;
815 double m;
816
817 public:
818 OGRPoint();
819 OGRPoint( double x, double y );
820 OGRPoint( double x, double y, double z );
821 OGRPoint( double x, double y, double z, double m );
822 OGRPoint( const OGRPoint& other );
823 ~OGRPoint() override;
824
825 OGRPoint& operator=( const OGRPoint& other );
826
827 // IWks Interface
828 int WkbSize() const override;
829 OGRErr importFromWkb( const unsigned char *,
830 int,
832 int& nBytesConsumedOut ) override;
833 OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
835 const override;
837 OGRErr importFromWkt( const char ** ) override;
838 OGRErr exportToWkt( char ** ppszDstText,
840 const override;
841
842 // IGeometry
843 virtual int getDimension() const override;
844 virtual OGRGeometry *clone() const override;
845 virtual void empty() override;
846 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
847 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
848 virtual OGRBoolean IsEmpty() const override
849 { return !(flags & OGR_G_NOT_EMPTY_POINT); }
850
851 // IPoint
853 double getX() const { return x; }
855 double getY() const { return y; }
857 double getZ() const { return z; }
859 double getM() const { return m; }
860
861 // Non standard
862 virtual void setCoordinateDimension( int nDimension ) override;
866 void setX( double xIn ) { x = xIn; flags |= OGR_G_NOT_EMPTY_POINT; }
870 void setY( double yIn ) { y = yIn; flags |= OGR_G_NOT_EMPTY_POINT; }
874 void setZ( double zIn )
875 { z = zIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_3D); }
879 void setM( double mIn )
880 { m = mIn; flags |= (OGR_G_NOT_EMPTY_POINT | OGR_G_MEASURED); }
881
882 // ISpatialRelation
883 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
884 virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
885 virtual OGRBoolean Within( const OGRGeometry * ) const override;
886
887 // Non standard from OGRGeometry
888 virtual const char *getGeometryName() const override;
889 virtual OGRwkbGeometryType getGeometryType() const override;
890 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
891 virtual void flattenTo2D() override;
892 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
893 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
894
895 virtual void swapXY() override;
896};
897
898/************************************************************************/
899/* OGRPointIterator */
900/************************************************************************/
901
908class CPL_DLL OGRPointIterator
909{
910 public:
911 virtual ~OGRPointIterator();
913
914 static void destroy( OGRPointIterator* );
915};
916
917/************************************************************************/
918/* OGRCurve */
919/************************************************************************/
920
926class CPL_DLL OGRCurve : public OGRGeometry
927{
928 protected:
930 OGRCurve();
931 OGRCurve( const OGRCurve& other );
932
933 virtual OGRCurveCasterToLineString GetCasterToLineString() const = 0;
934 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing() const = 0;
935
936 friend class OGRCurvePolygon;
937 friend class OGRCompoundCurve;
939 virtual int ContainsPoint( const OGRPoint* p ) const;
940 virtual int IntersectsPoint( const OGRPoint* p ) const;
941 virtual double get_AreaOfCurveSegments() const = 0;
942
943 private:
944
945 class CPL_DLL ConstIterator
946 {
947 struct Private;
948 std::unique_ptr<Private> m_poPrivate;
949 public:
950 ConstIterator(const OGRCurve* poSelf, bool bStart);
951 ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
952 ~ConstIterator();
953 const OGRPoint& operator*() const;
954 ConstIterator& operator++();
955 bool operator!=(const ConstIterator& it) const;
956 };
957
958 friend inline ConstIterator begin(const OGRCurve*);
959 friend inline ConstIterator end(const OGRCurve*);
960
961 public:
962 ~OGRCurve() override;
963
965 OGRCurve& operator=( const OGRCurve& other );
967
970
979 ConstIterator begin() const;
981 ConstIterator end() const;
982
983 // ICurve methods
984 virtual double get_Length() const = 0;
985 virtual void StartPoint( OGRPoint * ) const = 0;
986 virtual void EndPoint( OGRPoint * ) const = 0;
987 virtual int get_IsClosed() const;
988 virtual void Value( double, OGRPoint * ) const = 0;
989 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
990 const char* const* papszOptions = nullptr)
991 const = 0;
992 virtual int getDimension() const override;
993
994 // non standard
995 virtual int getNumPoints() const = 0;
996 virtual OGRPointIterator* getPointIterator() const = 0;
997 virtual OGRBoolean IsConvex() const;
998 virtual double get_Area() const = 0;
999
1003 { return cpl::down_cast<OGRSimpleCurve*>(this); }
1004
1007 inline const OGRSimpleCurve* toSimpleCurve() const
1008 { return cpl::down_cast<const OGRSimpleCurve*>(this); }
1009
1010 static OGRCompoundCurve* CastToCompoundCurve( OGRCurve* puCurve );
1011 static OGRLineString* CastToLineString( OGRCurve* poCurve );
1012 static OGRLinearRing* CastToLinearRing( OGRCurve* poCurve );
1013};
1014
1016
1017inline OGRCurve::ConstIterator begin(const OGRCurve* poCurve) { return poCurve->begin(); }
1019inline OGRCurve::ConstIterator end(const OGRCurve* poCurve) { return poCurve->end(); }
1021
1022/************************************************************************/
1023/* OGRSimpleCurve */
1024/************************************************************************/
1025
1035class CPL_DLL OGRSimpleCurve: public OGRCurve
1036{
1037 protected:
1039 friend class OGRGeometry;
1040
1041 int nPointCount;
1042 OGRRawPoint *paoPoints;
1043 double *padfZ;
1044 double *padfM;
1045
1046 void Make3D();
1047 void Make2D();
1048 void RemoveM();
1049 void AddM();
1050
1051 OGRErr importFromWKTListOnly( const char ** ppszInput, int bHasZ, int bHasM,
1052 OGRRawPoint*& paoPointsIn,
1053 int& nMaxPoints,
1054 double*& padfZIn );
1055
1057
1058 virtual double get_LinearArea() const;
1059
1061 OGRSimpleCurve( const OGRSimpleCurve& other );
1062
1063 private:
1064 class CPL_DLL Iterator
1065 {
1066 struct Private;
1067 std::unique_ptr<Private> m_poPrivate;
1068 void update();
1069 public:
1070 Iterator(OGRSimpleCurve* poSelf, int nPos);
1071 Iterator(Iterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1072 ~Iterator();
1073 OGRPoint& operator*();
1074 Iterator& operator++();
1075 bool operator!=(const Iterator& it) const;
1076 };
1077
1078 friend inline Iterator begin(OGRSimpleCurve*);
1079 friend inline Iterator end(OGRSimpleCurve*);
1080
1081 class CPL_DLL ConstIterator
1082 {
1083 struct Private;
1084 std::unique_ptr<Private> m_poPrivate;
1085 public:
1086 ConstIterator(const OGRSimpleCurve* poSelf, int nPos);
1087 ConstIterator(ConstIterator&& oOther) noexcept; // declared but not defined. Needed for gcc 5.4 at least
1088 ~ConstIterator();
1089 const OGRPoint& operator*() const;
1090 ConstIterator& operator++();
1091 bool operator!=(const ConstIterator& it) const;
1092 };
1093
1094 friend inline ConstIterator begin(const OGRSimpleCurve*);
1095 friend inline ConstIterator end(const OGRSimpleCurve*);
1096
1097 public:
1098 ~OGRSimpleCurve() override;
1099
1100 OGRSimpleCurve& operator=( const OGRSimpleCurve& other );
1101
1104
1113 Iterator begin();
1115 Iterator end();
1124 ConstIterator begin() const;
1126 ConstIterator end() const;
1127
1128 // IWks Interface.
1129 virtual int WkbSize() const override;
1130 virtual OGRErr importFromWkb( const unsigned char *,
1131 int,
1133 int& nBytesConsumedOut ) override;
1134 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1136 const override;
1138 OGRErr importFromWkt( const char ** ) override;
1139 virtual OGRErr exportToWkt( char ** ppszDstText,
1141 const override;
1142
1143 // IGeometry interface.
1144 virtual OGRGeometry *clone() const override;
1145 virtual void empty() override;
1146 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1147 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1148 virtual OGRBoolean IsEmpty() const override;
1149
1150 // ICurve methods.
1151 virtual double get_Length() const override;
1152 virtual void StartPoint( OGRPoint * ) const override;
1153 virtual void EndPoint( OGRPoint * ) const override;
1154 virtual void Value( double, OGRPoint * ) const override;
1155 virtual double Project( const OGRPoint * ) const;
1156 virtual OGRLineString* getSubLine( double, double, int ) const;
1157
1158 // ILineString methods.
1159 virtual int getNumPoints() const override { return nPointCount; }
1160 void getPoint( int, OGRPoint * ) const;
1161 double getX( int i ) const { return paoPoints[i].x; }
1162 double getY( int i ) const { return paoPoints[i].y; }
1163 double getZ( int i ) const;
1164 double getM( int i ) const;
1165
1166 // ISpatialRelation
1167 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1168
1169 // non standard.
1170 virtual void setCoordinateDimension( int nDimension ) override;
1171 virtual void set3D( OGRBoolean bIs3D ) override;
1172 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1173 void setNumPoints( int nNewPointCount,
1174 int bZeroizeNewContent = TRUE );
1175 void setPoint( int, OGRPoint * );
1176 void setPoint( int, double, double );
1177 void setZ( int, double );
1178 void setM( int, double );
1179 void setPoint( int, double, double, double );
1180 void setPointM( int, double, double, double );
1181 void setPoint( int, double, double, double, double );
1182 void setPoints( int, const OGRRawPoint *, const double * = nullptr );
1183 void setPointsM( int, const OGRRawPoint *, const double * );
1184 void setPoints( int, const OGRRawPoint *, const double *, const double * );
1185 void setPoints( int, const double * padfX, const double * padfY,
1186 const double *padfZIn = nullptr );
1187 void setPointsM( int, const double * padfX, const double * padfY,
1188 const double *padfMIn = nullptr );
1189 void setPoints( int, const double * padfX, const double * padfY,
1190 const double *padfZIn, const double *padfMIn );
1191 void addPoint( const OGRPoint * );
1192 void addPoint( double, double );
1193 void addPoint( double, double, double );
1194 void addPointM( double, double, double );
1195 void addPoint( double, double, double, double );
1196
1197 void getPoints( OGRRawPoint *, double * = nullptr ) const;
1198 void getPoints( void* pabyX, int nXStride,
1199 void* pabyY, int nYStride,
1200 void* pabyZ = nullptr, int nZStride = 0 ) const;
1201 void getPoints( void* pabyX, int nXStride,
1202 void* pabyY, int nYStride,
1203 void* pabyZ, int nZStride,
1204 void* pabyM, int nMStride ) const;
1205
1206 void addSubLineString( const OGRLineString *,
1207 int nStartVertex = 0, int nEndVertex = -1 );
1208 void reversePoints( void );
1209 virtual OGRPointIterator* getPointIterator() const override;
1210
1211 // non-standard from OGRGeometry
1212 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1213 virtual void flattenTo2D() override;
1214 virtual void segmentize(double dfMaxLength) override;
1215
1216 virtual void swapXY() override;
1217};
1218
1220
1221inline OGRSimpleCurve::Iterator begin(OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1223inline OGRSimpleCurve::Iterator end(OGRSimpleCurve* poCurve) { return poCurve->end(); }
1224
1226inline OGRSimpleCurve::ConstIterator begin(const OGRSimpleCurve* poCurve) { return poCurve->begin(); }
1228inline OGRSimpleCurve::ConstIterator end(const OGRSimpleCurve* poCurve) { return poCurve->end(); }
1230
1231/************************************************************************/
1232/* OGRLineString */
1233/************************************************************************/
1234
1242class CPL_DLL OGRLineString : public OGRSimpleCurve
1243{
1244 // cppcheck-suppress unusedPrivateFunction
1245 static OGRLinearRing* CasterToLinearRing(OGRCurve* poCurve);
1246
1247 protected:
1249 static OGRLineString* TransferMembersAndDestroy(
1250 OGRLineString* poSrc,
1251 OGRLineString* poDst);
1252
1253 virtual OGRCurveCasterToLineString GetCasterToLineString()
1254 const override;
1255 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1256 const override;
1257
1258 virtual double get_AreaOfCurveSegments() const override;
1260
1261 static OGRLinearRing* CastToLinearRing( OGRLineString* poLS );
1262
1263 public:
1266 ~OGRLineString() override;
1267
1268 OGRLineString& operator=(const OGRLineString& other);
1269
1270 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1271 const char* const* papszOptions = nullptr )
1272 const override;
1273 virtual OGRGeometry* getCurveGeometry(
1274 const char* const* papszOptions = nullptr ) const override;
1275 virtual double get_Area() const override;
1276
1277 // Non-standard from OGRGeometry.
1278 virtual OGRwkbGeometryType getGeometryType() const override;
1279 virtual const char *getGeometryName() const override;
1280
1282 inline OGRSimpleCurve* toUpperClass() { return this; }
1284 inline const OGRSimpleCurve* toUpperClass() const { return this; }
1285
1286 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1287 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1288};
1289
1290/************************************************************************/
1291/* OGRLinearRing */
1292/************************************************************************/
1293
1314class CPL_DLL OGRLinearRing : public OGRLineString
1315{
1316 static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1317
1318 protected:
1320 friend class OGRPolygon;
1321 friend class OGRTriangle;
1322
1323 // These are not IWks compatible ... just a convenience for OGRPolygon.
1324 virtual int _WkbSize( int _flags ) const;
1325 virtual OGRErr _importFromWkb( OGRwkbByteOrder, int _flags,
1326 const unsigned char *, int,
1327 int& nBytesConsumedOut );
1328 virtual OGRErr _exportToWkb( OGRwkbByteOrder, int _flags,
1329 unsigned char * ) const;
1330
1331 virtual OGRCurveCasterToLineString GetCasterToLineString()
1332 const override;
1333 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1334 const override;
1336
1337 static OGRLineString* CastToLineString( OGRLinearRing* poLR );
1338
1339 public:
1342 explicit OGRLinearRing( OGRLinearRing * );
1343 ~OGRLinearRing() override;
1344
1345 OGRLinearRing& operator=( const OGRLinearRing& other );
1346
1347 // Non standard.
1348 virtual const char *getGeometryName() const override;
1349 virtual OGRGeometry *clone() const override;
1350 virtual int isClockwise() const;
1351 virtual void reverseWindingOrder();
1352 virtual void closeRings() override;
1353 OGRBoolean isPointInRing( const OGRPoint* pt,
1354 int bTestEnvelope = TRUE ) const;
1355 OGRBoolean isPointOnRingBoundary( const OGRPoint* pt,
1356 int bTestEnvelope = TRUE ) const;
1357 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1358
1360 inline OGRLineString* toUpperClass() { return this; }
1362 inline const OGRLineString* toUpperClass() const { return this; }
1363
1364 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1365 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1366
1367 // IWks Interface - Note this isn't really a first class object
1368 // for the purposes of WKB form. These methods always fail since this
1369 // object can't be serialized on its own.
1370 virtual int WkbSize() const override;
1371 virtual OGRErr importFromWkb( const unsigned char *,
1372 int,
1374 int& nBytesConsumedOut ) override;
1375 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1377 const override;
1378};
1379
1380/************************************************************************/
1381/* OGRCircularString */
1382/************************************************************************/
1383
1396class CPL_DLL OGRCircularString : public OGRSimpleCurve
1397{
1398 private:
1399 void ExtendEnvelopeWithCircular( OGREnvelope * psEnvelope ) const;
1400 OGRBoolean IsValidFast() const;
1401 int IsFullCircle( double& cx, double& cy, double& square_R ) const;
1402
1403 protected:
1405 virtual OGRCurveCasterToLineString GetCasterToLineString()
1406 const override;
1407 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1408 const override;
1409 virtual int IntersectsPoint( const OGRPoint* p ) const override;
1410 virtual int ContainsPoint( const OGRPoint* p ) const override;
1411 virtual double get_AreaOfCurveSegments() const override;
1413
1414 public:
1417 ~OGRCircularString() override;
1418
1419 OGRCircularString& operator=(const OGRCircularString& other);
1420
1421 // IWks Interface.
1422 virtual OGRErr importFromWkb( const unsigned char *,
1423 int,
1425 int& nBytesConsumedOut ) override;
1426 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1428 const override;
1430 OGRErr importFromWkt( const char ** ) override;
1431 virtual OGRErr exportToWkt( char ** ppszDstText,
1433 const override;
1434
1435 // IGeometry interface.
1436 virtual OGRBoolean IsValid() const override;
1437 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1438 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1439
1440 // ICurve methods.
1441 virtual double get_Length() const override;
1442 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1443 const char* const* papszOptions = nullptr )
1444 const override;
1445 virtual void Value( double, OGRPoint * ) const override;
1446 virtual double get_Area() const override;
1447
1448 // Non-standard from OGRGeometry.
1449 virtual OGRwkbGeometryType getGeometryType() const override;
1450 virtual const char *getGeometryName() const override;
1451 virtual void segmentize( double dfMaxLength ) override;
1452 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1453 const override;
1454 virtual OGRGeometry* getLinearGeometry(
1455 double dfMaxAngleStepSizeDegrees = 0,
1456 const char* const* papszOptions = nullptr) const override;
1457
1459 inline OGRSimpleCurve* toUpperClass() { return this; }
1461 inline const OGRSimpleCurve* toUpperClass() const { return this; }
1462
1463 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1464 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1465};
1466
1467/************************************************************************/
1468/* OGRCurveCollection */
1469/************************************************************************/
1470
1482class CPL_DLL OGRCurveCollection
1483{
1484 protected:
1485 friend class OGRCompoundCurve;
1486 friend class OGRCurvePolygon;
1487 friend class OGRPolygon;
1488 friend class OGRTriangle;
1489
1490 int nCurveCount = 0;
1491 OGRCurve **papoCurves = nullptr;
1492
1493 public:
1494 OGRCurveCollection();
1495 OGRCurveCollection(const OGRCurveCollection& other);
1496 ~OGRCurveCollection();
1497
1498 OGRCurveCollection& operator=(const OGRCurveCollection& other);
1499
1501 typedef OGRCurve ChildType;
1502
1506 OGRCurve** begin() { return papoCurves; }
1508 OGRCurve** end() { return papoCurves + nCurveCount; }
1512 const OGRCurve* const* begin() const { return papoCurves; }
1514 const OGRCurve* const* end() const { return papoCurves + nCurveCount; }
1515
1516 void empty(OGRGeometry* poGeom);
1517 OGRBoolean IsEmpty() const;
1518 void getEnvelope( OGREnvelope * psEnvelope ) const;
1519 void getEnvelope( OGREnvelope3D * psEnvelope ) const;
1520
1521 OGRErr addCurveDirectly( OGRGeometry* poGeom, OGRCurve* poCurve,
1522 int bNeedRealloc );
1523 int WkbSize() const;
1524 OGRErr importPreambleFromWkb( OGRGeometry* poGeom,
1525 const unsigned char * pabyData,
1526 int& nSize,
1527 int& nDataOffset,
1528 OGRwkbByteOrder& eByteOrder,
1529 int nMinSubGeomSize,
1530 OGRwkbVariant eWkbVariant );
1531 OGRErr importBodyFromWkb(
1532 OGRGeometry* poGeom,
1533 const unsigned char * pabyData,
1534 int nSize,
1535 int bAcceptCompoundCurve,
1536 OGRErr (*pfnAddCurveDirectlyFromWkb)( OGRGeometry* poGeom,
1537 OGRCurve* poCurve ),
1538 OGRwkbVariant eWkbVariant,
1539 int& nBytesConsumedOut );
1540 OGRErr exportToWkt( const OGRGeometry* poGeom,
1541 char ** ppszDstText ) const;
1543 unsigned char *,
1544 OGRwkbVariant eWkbVariant ) const;
1545 OGRBoolean Equals(const OGRCurveCollection *poOCC) const;
1546 void setCoordinateDimension( OGRGeometry* poGeom,
1547 int nNewDimension );
1548 void set3D( OGRGeometry* poGeom, OGRBoolean bIs3D );
1549 void setMeasured( OGRGeometry* poGeom, OGRBoolean bIsMeasured );
1551 int getNumCurves() const;
1552 OGRCurve *getCurve( int );
1553 const OGRCurve *getCurve( int ) const;
1554 OGRCurve *stealCurve( int );
1555
1556 OGRErr removeCurve( int iIndex, bool bDelete = true );
1557
1558 OGRErr transform( OGRGeometry* poGeom,
1560 void flattenTo2D( OGRGeometry* poGeom );
1561 void segmentize( double dfMaxLength );
1562 void swapXY();
1563 OGRBoolean hasCurveGeometry(int bLookForNonLinear) const;
1564};
1566
1567/************************************************************************/
1568/* OGRCompoundCurve */
1569/************************************************************************/
1570
1581class CPL_DLL OGRCompoundCurve : public OGRCurve
1582{
1583 private:
1584 OGRCurveCollection oCC{};
1585
1586 OGRErr addCurveDirectlyInternal( OGRCurve* poCurve,
1587 double dfToleranceEps,
1588 int bNeedRealloc );
1589 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1590 OGRCurve* poCurve );
1591 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1592 OGRCurve* poCurve );
1593 OGRLineString* CurveToLineInternal( double dfMaxAngleStepSizeDegrees,
1594 const char* const* papszOptions,
1595 int bIsLinearRing ) const;
1596 // cppcheck-suppress unusedPrivateFunction
1597 static OGRLineString* CasterToLineString( OGRCurve* poCurve );
1598 // cppcheck-suppress unusedPrivateFunction
1599 static OGRLinearRing* CasterToLinearRing( OGRCurve* poCurve );
1600
1601 protected:
1603 static OGRLineString* CastToLineString( OGRCompoundCurve* poCC );
1604 static OGRLinearRing* CastToLinearRing( OGRCompoundCurve* poCC );
1605
1606 virtual OGRCurveCasterToLineString GetCasterToLineString()
1607 const override;
1608 virtual OGRCurveCasterToLinearRing GetCasterToLinearRing()
1609 const override;
1611
1612 public:
1615 ~OGRCompoundCurve() override;
1616
1617 OGRCompoundCurve& operator=( const OGRCompoundCurve& other );
1618
1621
1625 ChildType** begin() { return oCC.begin(); }
1627 ChildType** end() { return oCC.end(); }
1631 const ChildType* const * begin() const { return oCC.begin(); }
1633 const ChildType* const * end() const { return oCC.end(); }
1634
1635 // IWks Interface
1636 virtual int WkbSize() const override;
1637 virtual OGRErr importFromWkb( const unsigned char *,
1638 int,
1640 int& nBytesConsumedOut ) override;
1641 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1643 const override;
1645 OGRErr importFromWkt( const char ** ) override;
1646 virtual OGRErr exportToWkt( char ** ppszDstText,
1648 const override;
1649
1650 // IGeometry interface.
1651 virtual OGRGeometry *clone() const override;
1652 virtual void empty() override;
1653 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1654 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1655 virtual OGRBoolean IsEmpty() const override;
1656
1657 // ICurve methods.
1658 virtual double get_Length() const override;
1659 virtual void StartPoint( OGRPoint * ) const override;
1660 virtual void EndPoint( OGRPoint * ) const override;
1661 virtual void Value( double, OGRPoint * ) const override;
1662 virtual OGRLineString* CurveToLine( double dfMaxAngleStepSizeDegrees = 0,
1663 const char* const* papszOptions = nullptr )
1664 const override;
1665
1666 virtual int getNumPoints() const override;
1667 virtual double get_AreaOfCurveSegments() const override;
1668 virtual double get_Area() const override;
1669
1670 // ISpatialRelation.
1671 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1672
1673 // ICompoundCurve method.
1674 int getNumCurves() const;
1675 OGRCurve *getCurve( int );
1676 const OGRCurve *getCurve( int ) const;
1677
1678 // Non-standard.
1679 virtual void setCoordinateDimension( int nDimension ) override;
1680 virtual void set3D( OGRBoolean bIs3D ) override;
1681 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1682
1683 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1684
1685 OGRErr addCurve( OGRCurve*, double dfToleranceEps = 1e-14 );
1686 OGRErr addCurveDirectly( OGRCurve*, double dfToleranceEps = 1e-14 );
1687 OGRCurve *stealCurve( int );
1688 virtual OGRPointIterator* getPointIterator() const override;
1689
1690 // Non-standard from OGRGeometry.
1691 virtual OGRwkbGeometryType getGeometryType() const override;
1692 virtual const char *getGeometryName() const override;
1693 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1694 virtual void flattenTo2D() override;
1695 virtual void segmentize(double dfMaxLength) override;
1696 virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear = FALSE)
1697 const override;
1698 virtual OGRGeometry* getLinearGeometry(
1699 double dfMaxAngleStepSizeDegrees = 0,
1700 const char* const* papszOptions = nullptr) const override;
1701 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1702 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1703
1704 virtual void swapXY() override;
1705};
1706
1708
1709inline const OGRCompoundCurve::ChildType* const * begin(const OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1711inline const OGRCompoundCurve::ChildType* const * end(const OGRCompoundCurve* poCurve) { return poCurve->end(); }
1712
1714inline OGRCompoundCurve::ChildType** begin(OGRCompoundCurve* poCurve) { return poCurve->begin(); }
1716inline OGRCompoundCurve::ChildType** end(OGRCompoundCurve* poCurve) { return poCurve->end(); }
1718
1719/************************************************************************/
1720/* OGRSurface */
1721/************************************************************************/
1722
1728class CPL_DLL OGRSurface : public OGRGeometry
1729{
1730 protected:
1732 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const = 0;
1733 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon() const = 0;
1735
1736 public:
1737 virtual double get_Area() const = 0;
1738 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const
1739 { return PointOnSurfaceInternal(poPoint); }
1741 static OGRPolygon* CastToPolygon(OGRSurface* poSurface);
1742 static OGRCurvePolygon* CastToCurvePolygon(OGRSurface* poSurface);
1744};
1745
1746/************************************************************************/
1747/* OGRCurvePolygon */
1748/************************************************************************/
1749
1763class CPL_DLL OGRCurvePolygon : public OGRSurface
1764{
1765 static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
1766
1767 private:
1768 OGRBoolean IntersectsPoint( const OGRPoint* p ) const;
1769 OGRBoolean ContainsPoint( const OGRPoint* p ) const;
1770 virtual int checkRing( OGRCurve * poNewRing ) const;
1771 OGRErr addRingDirectlyInternal( OGRCurve* poCurve,
1772 int bNeedRealloc );
1773 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
1774 OGRCurve* poCurve );
1775 static OGRErr addCurveDirectlyFromWkb( OGRGeometry* poSelf,
1776 OGRCurve* poCurve );
1777
1778 protected:
1780 friend class OGRPolygon;
1781 friend class OGRTriangle;
1782 OGRCurveCollection oCC{};
1783
1784 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1785 const override;
1786 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1787 const override;
1789
1790 static OGRPolygon* CastToPolygon( OGRCurvePolygon* poCP );
1791
1792 public:
1795 ~OGRCurvePolygon() override;
1796
1797 OGRCurvePolygon& operator=( const OGRCurvePolygon& other );
1798
1801
1805 ChildType** begin() { return oCC.begin(); }
1807 ChildType** end() { return oCC.end(); }
1811 const ChildType* const * begin() const { return oCC.begin(); }
1813 const ChildType* const * end() const { return oCC.end(); }
1814
1815 // Non standard (OGRGeometry).
1816 virtual const char *getGeometryName() const override;
1817 virtual OGRwkbGeometryType getGeometryType() const override;
1818 virtual OGRGeometry *clone() const override;
1819 virtual void empty() override;
1820 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
1821 virtual void flattenTo2D() override;
1822 virtual OGRBoolean IsEmpty() const override;
1823 virtual void segmentize( double dfMaxLength ) override;
1824 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1825 const override;
1827 double dfMaxAngleStepSizeDegrees = 0,
1828 const char* const* papszOptions = nullptr ) const override;
1829
1830 // ISurface Interface
1831 virtual double get_Area() const override;
1832
1833 // IWks Interface
1834 virtual int WkbSize() const override;
1835 virtual OGRErr importFromWkb( const unsigned char *,
1836 int,
1838 int& nBytesConsumedOut ) override;
1839 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1841 const override;
1843 OGRErr importFromWkt( const char ** ) override;
1844 virtual OGRErr exportToWkt( char ** ppszDstText,
1845 OGRwkbVariant eWkbVariant = wkbVariantOldOgc )
1846 const override;
1847
1848 // IGeometry
1849 virtual int getDimension() const override;
1850 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
1851 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
1852
1853 // ICurvePolygon
1854 virtual OGRPolygon* CurvePolyToPoly(
1855 double dfMaxAngleStepSizeDegrees = 0,
1856 const char* const* papszOptions = nullptr ) const;
1857
1858 // ISpatialRelation
1859 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
1860 virtual OGRBoolean Intersects( const OGRGeometry * ) const override;
1861 virtual OGRBoolean Contains( const OGRGeometry * ) const override;
1862
1863 // Non standard
1864 virtual void setCoordinateDimension( int nDimension ) override;
1865 virtual void set3D( OGRBoolean bIs3D ) override;
1866 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
1867
1868 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
1869
1870 virtual OGRErr addRing( OGRCurve * );
1871 virtual OGRErr addRingDirectly( OGRCurve * );
1872
1874 const OGRCurve *getExteriorRingCurve() const;
1875 int getNumInteriorRings() const;
1877 const OGRCurve *getInteriorRingCurve( int ) const;
1878
1880
1881 OGRErr removeRing( int iIndex, bool bDelete = true );
1882 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
1883 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
1884
1885 virtual void swapXY() override;
1886};
1887
1889
1890inline const OGRCurvePolygon::ChildType* const * begin(const OGRCurvePolygon* poGeom) { return poGeom->begin(); }
1892inline const OGRCurvePolygon::ChildType* const * end(const OGRCurvePolygon* poGeom) { return poGeom->end(); }
1893
1895inline OGRCurvePolygon::ChildType** begin(OGRCurvePolygon* poGeom) { return poGeom->begin(); }
1897inline OGRCurvePolygon::ChildType** end(OGRCurvePolygon* poGeom) { return poGeom->end(); }
1899
1900/************************************************************************/
1901/* OGRPolygon */
1902/************************************************************************/
1903
1913class CPL_DLL OGRPolygon : public OGRCurvePolygon
1914{
1915 static OGRCurvePolygon* CasterToCurvePolygon(OGRSurface* poSurface);
1916
1917 protected:
1919 friend class OGRMultiSurface;
1920 friend class OGRPolyhedralSurface;
1921 friend class OGRTriangulatedSurface;
1922
1923 virtual int checkRing( OGRCurve * poNewRing ) const override;
1924 virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
1925 int bHasZ, int bHasM,
1926 OGRRawPoint*& paoPoints,
1927 int& nMaxPoints,
1928 double*& padfZ );
1929
1930 static OGRCurvePolygon* CastToCurvePolygon(OGRPolygon* poPoly);
1931
1932 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
1933 const override;
1934 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
1935 const override;
1937
1938 public:
1940 OGRPolygon(const OGRPolygon& other);
1941 ~OGRPolygon() override;
1942
1943 OGRPolygon& operator=(const OGRPolygon& other);
1944
1947
1951 ChildType** begin() { return reinterpret_cast<ChildType**>(oCC.begin()); }
1953 ChildType** end() { return reinterpret_cast<ChildType**>(oCC.end()); }
1957 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oCC.begin()); }
1959 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oCC.end()); }
1960
1961 // Non-standard (OGRGeometry).
1962 virtual const char *getGeometryName() const override;
1963 virtual OGRwkbGeometryType getGeometryType() const override;
1964 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
1965 const override;
1967 const char* const* papszOptions = nullptr ) const override;
1969 double dfMaxAngleStepSizeDegrees = 0,
1970 const char* const* papszOptions = nullptr) const override;
1971
1972 // IWks Interface.
1973 virtual int WkbSize() const override;
1974 virtual OGRErr importFromWkb( const unsigned char *,
1975 int,
1977 int& nBytesConsumedOut ) override;
1978 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
1980 const override;
1982 OGRErr importFromWkt( const char ** ) override;
1983
1984 virtual OGRErr exportToWkt( char ** ppszDstText,
1986 const override;
1987
1988 // ICurvePolygon.
1989 virtual OGRPolygon* CurvePolyToPoly(
1990 double dfMaxAngleStepSizeDegrees = 0,
1991 const char* const* papszOptions = nullptr ) const override;
1992
1993 OGRLinearRing *getExteriorRing();
1994 const OGRLinearRing *getExteriorRing() const;
1995 virtual OGRLinearRing *getInteriorRing( int );
1996 virtual const OGRLinearRing *getInteriorRing( int ) const;
1997
1998 OGRLinearRing *stealExteriorRing();
1999 virtual OGRLinearRing *stealInteriorRing(int);
2000
2001 OGRBoolean IsPointOnSurface( const OGRPoint * ) const;
2002
2004 inline OGRCurvePolygon* toUpperClass() { return this; }
2006 inline const OGRCurvePolygon* toUpperClass() const { return this; }
2007
2008 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2009 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2010
2011 virtual void closeRings() override;
2012};
2013
2015
2016inline const OGRPolygon::ChildType* const * begin(const OGRPolygon* poGeom) { return poGeom->begin(); }
2018inline const OGRPolygon::ChildType* const * end(const OGRPolygon* poGeom) { return poGeom->end(); }
2019
2021inline OGRPolygon::ChildType** begin(OGRPolygon* poGeom) { return poGeom->begin(); }
2023inline OGRPolygon::ChildType** end(OGRPolygon* poGeom) { return poGeom->end(); }
2025
2026/************************************************************************/
2027/* OGRTriangle */
2028/************************************************************************/
2029
2036class CPL_DLL OGRTriangle : public OGRPolygon
2037{
2038 private:
2039 // cppcheck-suppress unusedPrivateFunction
2040 static OGRPolygon* CasterToPolygon(OGRSurface* poSurface);
2041 bool quickValidityCheck() const;
2042
2043 protected:
2045 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon() const override;
2046 virtual OGRErr importFromWKTListOnly( const char ** ppszInput,
2047 int bHasZ, int bHasM,
2048 OGRRawPoint*& paoPoints,
2049 int& nMaxPoints,
2050 double*& padfZ ) override;
2052
2053 public:
2055 OGRTriangle( const OGRPoint &p, const OGRPoint &q, const OGRPoint &r );
2056 OGRTriangle( const OGRTriangle &other );
2057 OGRTriangle( const OGRPolygon &other, OGRErr &eErr );
2058 OGRTriangle& operator=( const OGRTriangle& other );
2059 ~OGRTriangle() override;
2060 virtual const char *getGeometryName() const override;
2061 virtual OGRwkbGeometryType getGeometryType() const override;
2062
2063 // IWks Interface.
2064 virtual OGRErr importFromWkb( const unsigned char *,
2065 int,
2067 int& nBytesConsumedOut ) override;
2068
2069 // New methods rewritten from OGRPolygon/OGRCurvePolygon/OGRGeometry.
2070 virtual OGRErr addRingDirectly( OGRCurve * poNewRing ) override;
2071
2073 inline OGRPolygon* toUpperClass() { return this; }
2075 inline const OGRPolygon* toUpperClass() const { return this; }
2076
2077 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2078 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2079
2081 static OGRGeometry* CastToPolygon( OGRGeometry* poGeom );
2083};
2084
2085/************************************************************************/
2086/* OGRGeometryCollection */
2087/************************************************************************/
2088
2097{
2098 OGRErr importFromWkbInternal( const unsigned char * pabyData,
2099 int nSize,
2100 int nRecLevel,
2101 OGRwkbVariant, int& nBytesConsumedOut );
2102 OGRErr importFromWktInternal( const char **ppszInput, int nRecLevel );
2103
2104 protected:
2106 int nGeomCount = 0;
2107 OGRGeometry **papoGeoms = nullptr;
2108
2109 OGRErr exportToWktInternal( char ** ppszDstText,
2110 OGRwkbVariant eWkbVariant,
2111 const char* pszSkipPrefix ) const;
2112 static OGRGeometryCollection* TransferMembersAndDestroy(
2113 OGRGeometryCollection* poSrc,
2114 OGRGeometryCollection* poDst );
2116 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2117
2118 public:
2121 ~OGRGeometryCollection() override;
2122
2123 OGRGeometryCollection& operator=( const OGRGeometryCollection& other );
2124
2127
2131 ChildType** begin() { return papoGeoms; }
2133 ChildType** end() { return papoGeoms + nGeomCount; }
2137 const ChildType* const* begin() const { return papoGeoms; }
2139 const ChildType* const* end() const { return papoGeoms + nGeomCount; }
2140
2141 // Non standard (OGRGeometry).
2142 virtual const char *getGeometryName() const override;
2143 virtual OGRwkbGeometryType getGeometryType() const override;
2144 virtual OGRGeometry *clone() const override;
2145 virtual void empty() override;
2146 virtual OGRErr transform( OGRCoordinateTransformation *poCT ) override;
2147 virtual void flattenTo2D() override;
2148 virtual OGRBoolean IsEmpty() const override;
2149 virtual void segmentize(double dfMaxLength) override;
2150 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2151 const override;
2152 virtual OGRGeometry* getCurveGeometry(
2153 const char* const* papszOptions = nullptr ) const override;
2154 virtual OGRGeometry* getLinearGeometry(
2155 double dfMaxAngleStepSizeDegrees = 0,
2156 const char* const* papszOptions = nullptr ) const override;
2157
2158 // IWks Interface
2159 virtual int WkbSize() const override;
2160 virtual OGRErr importFromWkb( const unsigned char *,
2161 int,
2163 int& nBytesConsumedOut ) override;
2164 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2166 const override;
2168 OGRErr importFromWkt( const char ** ) override;
2169
2170 virtual OGRErr exportToWkt( char ** ppszDstText,
2172 const override;
2173
2174 virtual double get_Length() const;
2175 virtual double get_Area() const;
2176
2177 // IGeometry methods
2178 virtual int getDimension() const override;
2179 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2180 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2181
2182 // IGeometryCollection
2183 int getNumGeometries() const;
2184 OGRGeometry *getGeometryRef( int );
2185 const OGRGeometry *getGeometryRef( int ) const;
2186
2187 // ISpatialRelation
2188 virtual OGRBoolean Equals( const OGRGeometry * ) const override;
2189
2190 // Non standard
2191 virtual void setCoordinateDimension( int nDimension ) override;
2192 virtual void set3D( OGRBoolean bIs3D ) override;
2193 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2194 virtual OGRErr addGeometry( const OGRGeometry * );
2195 virtual OGRErr addGeometryDirectly( OGRGeometry * );
2196 virtual OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2197
2198 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2199
2200 void closeRings() override;
2201
2202 virtual void swapXY() override;
2203
2204 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2205 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2206
2207 static OGRGeometryCollection* CastToGeometryCollection(
2208 OGRGeometryCollection* poSrc );
2209};
2210
2212
2213inline const OGRGeometryCollection::ChildType* const * begin(const OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2215inline const OGRGeometryCollection::ChildType* const * end(const OGRGeometryCollection* poGeom) { return poGeom->end(); }
2216
2218inline OGRGeometryCollection::ChildType** begin(OGRGeometryCollection* poGeom) { return poGeom->begin(); }
2220inline OGRGeometryCollection::ChildType** end(OGRGeometryCollection* poGeom) { return poGeom->end(); }
2222
2223/************************************************************************/
2224/* OGRMultiSurface */
2225/************************************************************************/
2226
2234{
2235 protected:
2236 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2237 const override;
2238
2239 public:
2242 ~OGRMultiSurface() override;
2243
2244 OGRMultiSurface& operator=( const OGRMultiSurface& other );
2245
2248
2252 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2254 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2258 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2260 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2261
2262 // Non standard (OGRGeometry).
2263 virtual const char *getGeometryName() const override;
2264 virtual OGRwkbGeometryType getGeometryType() const override;
2266 OGRErr importFromWkt( const char ** ) override;
2267
2268 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2269 const override;
2270
2271 // IMultiSurface methods
2272 virtual OGRErr PointOnSurface( OGRPoint * poPoint ) const;
2273
2274 // IGeometry methods
2275 virtual int getDimension() const override;
2276
2277 // Non standard
2278 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2279 const override;
2280
2282 inline OGRGeometryCollection* toUpperClass() { return this; }
2284 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2285
2286 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2287 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2288
2289 static OGRMultiPolygon* CastToMultiPolygon( OGRMultiSurface* poMS );
2290};
2291
2293
2294inline const OGRMultiSurface::ChildType* const * begin(const OGRMultiSurface* poGeom) { return poGeom->begin(); }
2296inline const OGRMultiSurface::ChildType* const * end(const OGRMultiSurface* poGeom) { return poGeom->end(); }
2297
2299inline OGRMultiSurface::ChildType** begin(OGRMultiSurface* poGeom) { return poGeom->begin(); }
2301inline OGRMultiSurface::ChildType** end(OGRMultiSurface* poGeom) { return poGeom->end(); }
2303
2304/************************************************************************/
2305/* OGRMultiPolygon */
2306/************************************************************************/
2307
2312class CPL_DLL OGRMultiPolygon : public OGRMultiSurface
2313{
2314 protected:
2315 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2316 const override;
2317 friend class OGRPolyhedralSurface;
2318 friend class OGRTriangulatedSurface;
2319
2320 private:
2322 OGRErr _addGeometryWithExpectedSubGeometryType(
2323 const OGRGeometry * poNewGeom,
2324 OGRwkbGeometryType eSubGeometryType );
2325 OGRErr _addGeometryDirectlyWithExpectedSubGeometryType(
2326 OGRGeometry * poNewGeom,
2327 OGRwkbGeometryType eSubGeometryType );
2329
2330
2331 public:
2334 ~OGRMultiPolygon() override;
2335
2337
2340
2344 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2346 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2350 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2352 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2353
2354 // Non-standard (OGRGeometry).
2355 virtual const char *getGeometryName() const override;
2356 virtual OGRwkbGeometryType getGeometryType() const override;
2358 const override;
2359
2360 // Non standard
2361 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2362 const override;
2363
2365 inline OGRGeometryCollection* toUpperClass() { return this; }
2367 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2368
2369 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2370 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2371
2372 static OGRMultiSurface* CastToMultiSurface( OGRMultiPolygon* poMP );
2373};
2374
2376
2377inline const OGRMultiPolygon::ChildType* const * begin(const OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2379inline const OGRMultiPolygon::ChildType* const * end(const OGRMultiPolygon* poGeom) { return poGeom->end(); }
2380
2382inline OGRMultiPolygon::ChildType** begin(OGRMultiPolygon* poGeom) { return poGeom->begin(); }
2384inline OGRMultiPolygon::ChildType** end(OGRMultiPolygon* poGeom) { return poGeom->end(); }
2386
2387/************************************************************************/
2388/* OGRPolyhedralSurface */
2389/************************************************************************/
2390
2397class CPL_DLL OGRPolyhedralSurface : public OGRSurface
2398{
2399 protected:
2401 friend class OGRTriangulatedSurface;
2402 OGRMultiPolygon oMP{};
2403 virtual OGRSurfaceCasterToPolygon GetCasterToPolygon()
2404 const override;
2405 virtual OGRSurfaceCasterToCurvePolygon GetCasterToCurvePolygon()
2406 const override;
2407 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType ) const;
2408 virtual const char* getSubGeometryName() const;
2409 virtual OGRwkbGeometryType getSubGeometryType() const;
2410 OGRErr exportToWktInternal (char ** ppszDstText, OGRwkbVariant eWkbVariant,
2411 const char* pszSkipPrefix ) const;
2412
2413 virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2414 const;
2415 static OGRMultiPolygon* CastToMultiPolygonImpl(OGRPolyhedralSurface* poPS);
2417
2418 public:
2423
2426
2430 ChildType** begin() { return oMP.begin(); }
2432 ChildType** end() { return oMP.end(); }
2436 const ChildType* const* begin() const { return oMP.begin(); }
2438 const ChildType* const* end() const { return oMP.end(); }
2439
2440 // IWks Interface.
2441 virtual int WkbSize() const override;
2442 virtual const char *getGeometryName() const override;
2443 virtual OGRwkbGeometryType getGeometryType() const override;
2444 virtual OGRErr importFromWkb( const unsigned char *,
2445 int,
2447 int& nBytesConsumedOut ) override;
2448 virtual OGRErr exportToWkb( OGRwkbByteOrder, unsigned char *,
2450 const override;
2452 OGRErr importFromWkt( const char ** ) override;
2453 virtual OGRErr exportToWkt( char ** ppszDstText,
2455 const override;
2456
2457 // IGeometry methods.
2458 virtual int getDimension() const override;
2459
2460 virtual void empty() override;
2461
2462 virtual OGRGeometry *clone() const override;
2463 virtual void getEnvelope( OGREnvelope * psEnvelope ) const override;
2464 virtual void getEnvelope( OGREnvelope3D * psEnvelope ) const override;
2465
2466 virtual void flattenTo2D() override;
2467 virtual OGRErr transform( OGRCoordinateTransformation* ) override;
2468 virtual OGRBoolean Equals( const OGRGeometry* ) const override;
2469 virtual double get_Area() const override;
2470 virtual OGRErr PointOnSurface( OGRPoint* ) const override;
2471
2473 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2474 const override;
2475 virtual OGRErr addGeometry( const OGRGeometry * );
2477 int getNumGeometries() const;
2479 const OGRGeometry* getGeometryRef(int i) const;
2480
2481 virtual OGRBoolean IsEmpty() const override;
2482 virtual void setCoordinateDimension( int nDimension ) override;
2483 virtual void set3D( OGRBoolean bIs3D ) override;
2484 virtual void setMeasured( OGRBoolean bIsMeasured ) override;
2485 virtual void swapXY() override;
2486 OGRErr removeGeometry( int iIndex, int bDelete = TRUE );
2487
2488 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2489 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2490
2491 virtual void assignSpatialReference( OGRSpatialReference * poSR ) override;
2492};
2493
2495
2496inline const OGRPolyhedralSurface::ChildType* const * begin(const OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2498inline const OGRPolyhedralSurface::ChildType* const * end(const OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2499
2501inline OGRPolyhedralSurface::ChildType** begin(OGRPolyhedralSurface* poGeom) { return poGeom->begin(); }
2503inline OGRPolyhedralSurface::ChildType** end(OGRPolyhedralSurface* poGeom) { return poGeom->end(); }
2505
2506/************************************************************************/
2507/* OGRTriangulatedSurface */
2508/************************************************************************/
2509
2517{
2518 protected:
2520 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2521 const override;
2522 virtual const char* getSubGeometryName() const override;
2523 virtual OGRwkbGeometryType getSubGeometryType() const override;
2524
2525 virtual OGRPolyhedralSurfaceCastToMultiPolygon GetCasterToMultiPolygon()
2526 const override;
2527 static OGRMultiPolygon *
2528 CastToMultiPolygonImpl( OGRPolyhedralSurface* poPS );
2530
2531 public:
2535
2538
2542 ChildType** begin() { return reinterpret_cast<ChildType**>(oMP.begin()); }
2544 ChildType** end() { return reinterpret_cast<ChildType**>(oMP.end()); }
2548 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(oMP.begin()); }
2550 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(oMP.end()); }
2551
2552 OGRTriangulatedSurface& operator=( const OGRTriangulatedSurface& other );
2553 virtual const char *getGeometryName() const override;
2554 virtual OGRwkbGeometryType getGeometryType() const override;
2555
2556 // IWks Interface.
2557 virtual OGRErr addGeometry( const OGRGeometry * ) override;
2558
2560 inline OGRPolyhedralSurface* toUpperClass() { return this; }
2562 inline const OGRPolyhedralSurface* toUpperClass() const { return this; }
2563
2564 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2565 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2566
2567 static OGRPolyhedralSurface *
2568 CastToPolyhedralSurface( OGRTriangulatedSurface* poTS );
2569};
2570
2572
2573inline const OGRTriangulatedSurface::ChildType* const * begin(const OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2575inline const OGRTriangulatedSurface::ChildType* const * end(const OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2576
2578inline OGRTriangulatedSurface::ChildType** begin(OGRTriangulatedSurface* poGeom) { return poGeom->begin(); }
2580inline OGRTriangulatedSurface::ChildType** end(OGRTriangulatedSurface* poGeom) { return poGeom->end(); }
2582
2583/************************************************************************/
2584/* OGRMultiPoint */
2585/************************************************************************/
2586
2592{
2593 private:
2594 OGRErr importFromWkt_Bracketed( const char **, int bHasM, int bHasZ );
2595
2596 protected:
2597 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2598 const override;
2599
2600 public:
2603 ~OGRMultiPoint() override;
2604
2605 OGRMultiPoint& operator=(const OGRMultiPoint& other);
2606
2609
2613 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2615 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2619 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2621 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2622
2623 // Non-standard (OGRGeometry).
2624 virtual const char *getGeometryName() const override;
2625 virtual OGRwkbGeometryType getGeometryType() const override;
2627 OGRErr importFromWkt( const char ** ) override;
2628 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2629 const override;
2630
2631 // IGeometry methods.
2632 virtual int getDimension() const override;
2633
2635 inline OGRGeometryCollection* toUpperClass() { return this; }
2637 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2638
2639 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2640 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2641
2642 // Non-standard.
2643 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2644 const override;
2645};
2646
2648
2649inline const OGRMultiPoint::ChildType* const * begin(const OGRMultiPoint* poGeom) { return poGeom->begin(); }
2651inline const OGRMultiPoint::ChildType* const * end(const OGRMultiPoint* poGeom) { return poGeom->end(); }
2652
2654inline OGRMultiPoint::ChildType** begin(OGRMultiPoint* poGeom) { return poGeom->begin(); }
2656inline OGRMultiPoint::ChildType** end(OGRMultiPoint* poGeom) { return poGeom->end(); }
2658
2659/************************************************************************/
2660/* OGRMultiCurve */
2661/************************************************************************/
2662
2670{
2671 protected:
2673 static OGRErr addCurveDirectlyFromWkt( OGRGeometry* poSelf,
2674 OGRCurve* poCurve );
2676 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2677 const override;
2678
2679 public:
2682 ~OGRMultiCurve() override;
2683
2684 OGRMultiCurve& operator=( const OGRMultiCurve& other );
2685
2688
2692 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2694 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2698 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2700 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2701
2702 // Non standard (OGRGeometry).
2703 virtual const char *getGeometryName() const override;
2704 virtual OGRwkbGeometryType getGeometryType() const override;
2706 OGRErr importFromWkt( const char ** ) override;
2707 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2708 const override;
2709
2710 // IGeometry methods.
2711 virtual int getDimension() const override;
2712
2713 // Non-standard.
2714 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2715 const override;
2716
2718 inline OGRGeometryCollection* toUpperClass() { return this; }
2720 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2721
2722 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2723 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2724
2725 static OGRMultiLineString* CastToMultiLineString(OGRMultiCurve* poMC);
2726};
2727
2729
2730inline const OGRMultiCurve::ChildType* const * begin(const OGRMultiCurve* poGeom) { return poGeom->begin(); }
2732inline const OGRMultiCurve::ChildType* const * end(const OGRMultiCurve* poGeom) { return poGeom->end(); }
2733
2735inline OGRMultiCurve::ChildType** begin(OGRMultiCurve* poGeom) { return poGeom->begin(); }
2737inline OGRMultiCurve::ChildType** end(OGRMultiCurve* poGeom) { return poGeom->end(); }
2739
2740/************************************************************************/
2741/* OGRMultiLineString */
2742/************************************************************************/
2743
2748class CPL_DLL OGRMultiLineString : public OGRMultiCurve
2749{
2750 protected:
2751 virtual OGRBoolean isCompatibleSubType( OGRwkbGeometryType )
2752 const override;
2753
2754 public:
2757 ~OGRMultiLineString() override;
2758
2759 OGRMultiLineString& operator=( const OGRMultiLineString& other );
2760
2763
2767 ChildType** begin() { return reinterpret_cast<ChildType**>(papoGeoms); }
2769 ChildType** end() { return reinterpret_cast<ChildType**>(papoGeoms + nGeomCount); }
2773 const ChildType* const* begin() const { return reinterpret_cast<const ChildType* const*>(papoGeoms); }
2775 const ChildType* const* end() const { return reinterpret_cast<const ChildType* const*>(papoGeoms + nGeomCount); }
2776
2777 // Non standard (OGRGeometry).
2778 virtual const char *getGeometryName() const override;
2779 virtual OGRwkbGeometryType getGeometryType() const override;
2780 virtual OGRErr exportToWkt( char **, OGRwkbVariant=wkbVariantOldOgc )
2781 const override;
2782
2783 // Non standard
2784 virtual OGRBoolean hasCurveGeometry( int bLookForNonLinear = FALSE )
2785 const override;
2786
2788 inline OGRGeometryCollection* toUpperClass() { return this; }
2790 inline const OGRGeometryCollection* toUpperClass() const { return this; }
2791
2792 virtual void accept(IOGRGeometryVisitor* visitor) override { visitor->visit(this); }
2793 virtual void accept(IOGRConstGeometryVisitor* visitor) const override { visitor->visit(this); }
2794
2795 static OGRMultiCurve* CastToMultiCurve( OGRMultiLineString* poMLS );
2796};
2797
2799
2800inline const OGRMultiLineString::ChildType* const * begin(const OGRMultiLineString* poGeom) { return poGeom->begin(); }
2802inline const OGRMultiLineString::ChildType* const * end(const OGRMultiLineString* poGeom) { return poGeom->end(); }
2803
2805inline OGRMultiLineString::ChildType** begin(OGRMultiLineString* poGeom) { return poGeom->begin(); }
2807inline OGRMultiLineString::ChildType** end(OGRMultiLineString* poGeom) { return poGeom->end(); }
2809
2810/************************************************************************/
2811/* OGRGeometryFactory */
2812/************************************************************************/
2813
2819{
2820 static OGRErr createFromFgfInternal( const unsigned char *pabyData,
2821 OGRSpatialReference * poSR,
2822 OGRGeometry **ppoReturn,
2823 int nBytes,
2824 int *pnBytesConsumed,
2825 int nRecLevel );
2826 public:
2827 static OGRErr createFromWkb( const void *, OGRSpatialReference *,
2828 OGRGeometry **, int = -1,
2830 static OGRErr createFromWkb( const void * pabyData,
2832 OGRGeometry **,
2833 int nSize,
2834 OGRwkbVariant eVariant,
2835 int& nBytesConsumedOut );
2836 static OGRErr createFromWkt( const char* , OGRSpatialReference *,
2837 OGRGeometry ** );
2838 static OGRErr createFromWkt( const char **, OGRSpatialReference *,
2839 OGRGeometry ** );
2843 static OGRErr createFromWkt( char ** ppszInput, OGRSpatialReference * poSRS,
2844 OGRGeometry ** ppoGeom )
2845 CPL_WARN_DEPRECATED("Use createFromWkt(const char**, ...) instead")
2846 {
2847 return createFromWkt( const_cast<const char**>(ppszInput), poSRS, ppoGeom);
2848 }
2849
2850 static OGRErr createFromFgf( const void*, OGRSpatialReference *,
2851 OGRGeometry **, int = -1, int * = nullptr );
2852 static OGRGeometry *createFromGML( const char * );
2853 static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt,
2854 GEOSGeom );
2855 static OGRGeometry *createFromGeoJson( const char *);
2856 static OGRGeometry *createFromGeoJson( const CPLJSONObject &oJSONObject );
2857
2858 static void destroyGeometry( OGRGeometry * );
2859 static OGRGeometry *createGeometry( OGRwkbGeometryType );
2860
2861 static OGRGeometry * forceToPolygon( OGRGeometry * );
2862 static OGRGeometry * forceToLineString( OGRGeometry *,
2863 bool bOnlyInOrder = true );
2864 static OGRGeometry * forceToMultiPolygon( OGRGeometry * );
2865 static OGRGeometry * forceToMultiPoint( OGRGeometry * );
2866 static OGRGeometry * forceToMultiLineString( OGRGeometry * );
2867
2868 static OGRGeometry * forceTo( OGRGeometry* poGeom,
2869 OGRwkbGeometryType eTargetType,
2870 const char*const* papszOptions = nullptr );
2871
2872 static OGRGeometry * organizePolygons( OGRGeometry **papoPolygons,
2873 int nPolygonCount,
2874 int *pbResultValidGeometry,
2875 const char **papszOptions = nullptr);
2876 static bool haveGEOS();
2877
2880 {
2881 friend class OGRGeometryFactory;
2882 struct Private;
2883 std::unique_ptr<Private> d;
2884
2885 public:
2888 };
2889
2890 static OGRGeometry* transformWithOptions( const OGRGeometry* poSrcGeom,
2892 char** papszOptions,
2894
2895 static OGRGeometry*
2896 approximateArcAngles( double dfX, double dfY, double dfZ,
2897 double dfPrimaryRadius, double dfSecondaryAxis,
2898 double dfRotation,
2899 double dfStartAngle, double dfEndAngle,
2900 double dfMaxAngleStepSizeDegrees );
2901
2902 static int GetCurveParmeters( double x0, double y0,
2903 double x1, double y1,
2904 double x2, double y2,
2905 double& R, double& cx, double& cy,
2906 double& alpha0, double& alpha1,
2907 double& alpha2 );
2908 static OGRLineString* curveToLineString(
2909 double x0, double y0, double z0,
2910 double x1, double y1, double z1,
2911 double x2, double y2, double z2,
2912 int bHasZ,
2913 double dfMaxAngleStepSizeDegrees,
2914 const char* const * papszOptions = nullptr );
2915 static OGRCurve* curveFromLineString(
2916 const OGRLineString* poLS,
2917 const char* const * papszOptions = nullptr);
2918};
2919
2920OGRwkbGeometryType CPL_DLL OGRFromOGCGeomType( const char *pszGeomType );
2921const char CPL_DLL * OGRToOGCGeomType( OGRwkbGeometryType eGeomType );
2922
2924typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
2927void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
2928int OGRPreparedGeometryIntersects( const OGRPreparedGeometry* poPreparedGeom,
2929 const OGRGeometry* poOtherGeom );
2930int OGRPreparedGeometryContains( const OGRPreparedGeometry* poPreparedGeom,
2931 const OGRGeometry* poOtherGeom );
2932
2934struct CPL_DLL OGRPreparedGeometryUniquePtrDeleter
2935{
2936 void operator()(OGRPreparedGeometry*) const;
2937};
2939
2943typedef std::unique_ptr<OGRPreparedGeometry, OGRPreparedGeometryUniquePtrDeleter> OGRPreparedGeometryUniquePtr;
2944
2945#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:1397
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1463
OGRCircularString()
Create an empty circular string.
const OGRSimpleCurve * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1461
OGRCircularString(const OGRCircularString &other)
Copy constructor.
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1459
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1464
Utility class to store a collection of curves.
Definition: ogr_geometry.h:1582
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1702
const ChildType *const * end() const
Return end of curve iterator.
Definition: ogr_geometry.h:1633
const ChildType *const * begin() const
Return begin of curve iterator.
Definition: ogr_geometry.h:1631
OGRCompoundCurve(const OGRCompoundCurve &other)
Copy constructor.
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:1620
ChildType ** end()
Return end of curve iterator.
Definition: ogr_geometry.h:1627
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1625
OGRCompoundCurve()
Create an empty compound curve.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1701
Interface for transforming between coordinate systems.
Definition: ogr_spatialref.h:685
Concrete class representing curve polygons.
Definition: ogr_geometry.h:1764
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:1882
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:1800
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:1813
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:1811
ChildType ** begin()
Return begin of curve iterator.
Definition: ogr_geometry.h:1805
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:1807
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:1883
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:927
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:1007
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:969
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:1002
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:2097
ChildType ** end()
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2133
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2204
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2205
const ChildType *const * begin() const
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2137
const ChildType *const * end() const
Return end of sub-geometry iterator.
Definition: ogr_geometry.h:2139
ChildType ** begin()
Return begin of sub-geometry iterator.
Definition: ogr_geometry.h:2131
OGRGeometryCollection()
Create an empty geometry collection.
OGRGeometry ChildType
Type of child elements.
Definition: ogr_geometry.h:2126
Opaque class used as argument to transformWithOptions()
Definition: ogr_geometry.h:2880
Create geometry objects from well known text/binary.
Definition: ogr_geometry.h:2819
static OGRErr createFromWkt(char **ppszInput, OGRSpatialReference *poSRS, OGRGeometry **ppoGeom)
Deprecated.
Definition: ogr_geometry.h:2843
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:287
const OGRSurface * toSurface() const
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:629
const OGRCurvePolygon * toCurvePolygon() const
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:671
const OGRMultiCurve * toMultiCurve() const
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:741
const OGRPolyhedralSurface * toPolyhedralSurface() const
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:769
const OGRMultiPoint * toMultiPoint() const
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:699
virtual void empty()=0
Clear geometry information.
const OGRMultiPolygon * toMultiPolygon() const
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:727
virtual OGRBoolean Equals(const OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
OGRPolyhedralSurface * toPolyhedralSurface()
Down-cast to OGRPolyhedralSurface*.
Definition: ogr_geometry.h:762
const OGRMultiSurface * toMultiSurface() const
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:755
OGRPoint * toPoint()
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:524
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:650
OGRLineString * toLineString()
Down-cast to OGRLineString*.
Definition: ogr_geometry.h:566
const OGRLinearRing * toLinearRing() const
Down-cast to OGRLinearRing*.
Definition: ogr_geometry.h:587
const OGRPoint * toPoint() const
Down-cast to OGRPoint*.
Definition: ogr_geometry.h:531
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:706
OGRMultiSurface * toMultiSurface()
Down-cast to OGRMultiSurface*.
Definition: ogr_geometry.h:748
static OGRGeometry * FromHandle(OGRGeometryH hGeom)
Convert a OGRGeometryH to a OGRGeometry*.
Definition: ogr_geometry.h:517
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:685
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:713
const OGRCircularString * toCircularString() const
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:601
OGRPolygon * toPolygon()
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:636
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:580
OGRBoolean IsMeasured() const
Definition: ogr_geometry.h:365
virtual void accept(IOGRGeometryVisitor *visitor)=0
Accept a visitor.
OGRMultiCurve * toMultiCurve()
Down-cast to OGRMultiCurve*.
Definition: ogr_geometry.h:734
const OGRCompoundCurve * toCompoundCurve() const
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:615
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:678
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
OGRMultiPolygon * toMultiPolygon()
Down-cast to OGRMultiPolygon*.
Definition: ogr_geometry.h:720
const OGRPolygon * toPolygon() const
Down-cast to OGRPolygon*.
Definition: ogr_geometry.h:643
OGRCompoundCurve * toCompoundCurve()
Down-cast to OGRCompoundCurve*.
Definition: ogr_geometry.h:608
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:573
OGRCircularString * toCircularString()
Down-cast to OGRCircularString*.
Definition: ogr_geometry.h:594
const OGRCurve * toCurve() const
Down-cast to OGRCurve*.
Definition: ogr_geometry.h:545
OGRCurvePolygon * toCurvePolygon()
Down-cast to OGRCurvePolygon*.
Definition: ogr_geometry.h:664
const OGRSimpleCurve * toSimpleCurve() const
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:559
static OGRGeometryH ToHandle(OGRGeometry *poGeom)
Convert a OGRGeometry* to a OGRGeometryH.
Definition: ogr_geometry.h:511
OGRBoolean Is3D() const
Definition: ogr_geometry.h:363
OGRMultiPoint * toMultiPoint()
Down-cast to OGRMultiPoint*.
Definition: ogr_geometry.h:692
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:5045
const OGRTriangulatedSurface * toTriangulatedSurface() const
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:783
const OGRTriangle * toTriangle() const
Down-cast to OGRTriangle*.
Definition: ogr_geometry.h:657
virtual OGRErr importFromWkt(const char **ppszInput)=0
Assign geometry from well known text data.
OGRSurface * toSurface()
Down-cast to OGRSurface*.
Definition: ogr_geometry.h:622
OGRSimpleCurve * toSimpleCurve()
Down-cast to OGRSimpleCurve*.
Definition: ogr_geometry.h:552
OGRTriangulatedSurface * toTriangulatedSurface()
Down-cast to OGRTriangulatedSurface*.
Definition: ogr_geometry.h:776
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:538
Concrete representation of a multi-vertex line.
Definition: ogr_geometry.h:1243
OGRSimpleCurve * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1282
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1287
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1286
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:1284
Concrete representation of a closed ring.
Definition: ogr_geometry.h:1315
OGRLineString * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:1360
const OGRLineString * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:1362
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:1365
OGRLinearRing(const OGRLinearRing &other)
Copy constructor.
OGRLinearRing()
Constructor.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:1364
A collection of OGRCurve.
Definition: ogr_geometry.h:2670
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2698
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2700
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2723
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2694
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2720
OGRMultiCurve()
Create an empty multi curve collection.
OGRMultiCurve(const OGRMultiCurve &other)
Copy constructor.
OGRCurve ChildType
Type of child elements.
Definition: ogr_geometry.h:2687
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2692
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2718
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2722
A collection of OGRLineString.
Definition: ogr_geometry.h:2749
OGRLineString ChildType
Type of child elements.
Definition: ogr_geometry.h:2762
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2788
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2769
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2775
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2793
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2773
OGRMultiLineString()
Create an empty multi line string collection.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2792
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2767
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2790
OGRMultiLineString(const OGRMultiLineString &other)
Copy constructor.
A collection of OGRPoint.
Definition: ogr_geometry.h:2592
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2635
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2639
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2621
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2613
OGRMultiPoint()
Create an empty multi point collection.
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2640
OGRMultiPoint(const OGRMultiPoint &other)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2619
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2637
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:2608
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2615
A collection of non-overlapping OGRPolygon.
Definition: ogr_geometry.h:2313
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2339
OGRMultiPolygon(const OGRMultiPolygon &other)
Copy constructor.
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2370
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2352
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2346
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2369
OGRMultiPolygon()
Create an empty multi polygon collection.
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2344
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2365
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2350
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2367
A collection of non-overlapping OGRSurface.
Definition: ogr_geometry.h:2234
OGRMultiSurface()
Create an empty multi surface collection.
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2286
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2252
OGRSurface ChildType
Type of child elements.
Definition: ogr_geometry.h:2247
const OGRGeometryCollection * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2284
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2258
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2260
OGRMultiSurface(const OGRMultiSurface &other)
Copy constructor.
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2254
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2287
OGRGeometryCollection * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2282
Interface for a point iterator.
Definition: ogr_geometry.h:909
virtual OGRBoolean getNextPoint(OGRPoint *p)=0
Returns the next point followed by the iterator.
Point class.
Definition: ogr_geometry.h:811
double getM() const
Return m.
Definition: ogr_geometry.h:859
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:892
void setX(double xIn)
Set x.
Definition: ogr_geometry.h:866
OGRPoint(const OGRPoint &other)
Copy constructor.
void setZ(double zIn)
Set z.
Definition: ogr_geometry.h:874
void setM(double mIn)
Set m.
Definition: ogr_geometry.h:879
double getX() const
Return x.
Definition: ogr_geometry.h:853
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:893
void setY(double yIn)
Set y.
Definition: ogr_geometry.h:870
virtual OGRBoolean IsEmpty() const override
Returns TRUE (non-zero) if the object has no points.
Definition: ogr_geometry.h:848
double getZ() const
Return z.
Definition: ogr_geometry.h:857
double getY() const
Return y.
Definition: ogr_geometry.h:855
Concrete class representing polygons.
Definition: ogr_geometry.h:1914
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:1946
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:1951
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:2006
OGRPolygon()
Create an empty polygon.
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:1953
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:1957
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2009
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:1959
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2008
OGRCurvePolygon * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2004
virtual void closeRings() override
Force rings to be closed.
Definition: ogrpolygon.cpp:807
PolyhedralSurface class.
Definition: ogr_geometry.h:2398
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:968
virtual void setMeasured(OGRBoolean bIsMeasured) override
Set the type as Measured.
Definition: ogrpolyhedralsurface.cpp:996
virtual void setCoordinateDimension(int nDimension) override
Set the coordinate dimension.
Definition: ogrpolyhedralsurface.cpp:1017
int getNumGeometries() const
Fetch number of geometries in PolyhedralSurface.
Definition: ogrpolyhedralsurface.cpp:909
virtual void assignSpatialReference(OGRSpatialReference *poSR) override
Assign spatial reference to this object.
Definition: ogrpolyhedralsurface.cpp:1077
virtual OGRErr exportToWkt(char **ppszDstText, OGRwkbVariant=wkbVariantOldOgc) const override
Convert a geometry into well known text format.
Definition: ogrpolyhedralsurface.cpp:451
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2432
static OGRMultiPolygon * CastToMultiPolygon(OGRPolyhedralSurface *poPS)
Casts the OGRPolyhedralSurface to an OGRMultiPolygon.
Definition: ogrpolyhedralsurface.cpp:820
const ChildType *const * end() const
Return end of iterator.
Definition: ogr_geometry.h:2438
virtual void swapXY() override
Swap x and y coordinates.
Definition: ogrpolyhedralsurface.cpp:1032
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:616
OGRPolyhedralSurface(const OGRPolyhedralSurface &poGeom)
Copy constructor.
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2436
virtual OGRBoolean hasCurveGeometry(int bLookForNonLinear=FALSE) const override
Returns if this geometry is or has curve geometry.
Definition: ogrpolyhedralsurface.cpp:1042
~OGRPolyhedralSurface() override
Destructor.
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2430
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:981
OGRErr addGeometryDirectly(OGRGeometry *poNewGeom)
Add a geometry directly to the container.
Definition: ogrpolyhedralsurface.cpp:877
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:709
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2488
OGRPolygon ChildType
Type of child elements.
Definition: ogr_geometry.h:2425
virtual double get_Area() const override
Returns the area enclosed.
Definition: ogrpolyhedralsurface.cpp:749
virtual OGRErr transform(OGRCoordinateTransformation *) override
Apply arbitrary coordinate transformation to geometry.
Definition: ogrpolyhedralsurface.cpp:628
OGRGeometry * getGeometryRef(int i)
Fetch geometry from container.
Definition: ogrpolyhedralsurface.cpp:931
virtual OGRErr PointOnSurface(OGRPoint *) const override
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogrpolyhedralsurface.cpp:776
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:1068
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2489
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:1036
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:1162
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:1161
OGRPoint ChildType
Type of child elements.
Definition: ogr_geometry.h:1103
virtual int getNumPoints() const override
Fetch vertex count.
Definition: ogr_geometry.h:1159
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:157
Abstract base class for 2 dimensional objects like polygons or curve polygons.
Definition: ogr_geometry.h:1729
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:1738
Triangle class.
Definition: ogr_geometry.h:2037
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:2075
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2077
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2078
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:2073
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:2517
~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:2550
const ChildType *const * begin() const
Return begin of iterator.
Definition: ogr_geometry.h:2548
OGRPolyhedralSurface * toUpperClass()
Return pointer of this in upper class.
Definition: ogr_geometry.h:2560
virtual void accept(IOGRGeometryVisitor *visitor) override
Accept a visitor.
Definition: ogr_geometry.h:2564
const OGRPolyhedralSurface * toUpperClass() const
Return pointer of this in upper class.
Definition: ogr_geometry.h:2562
OGRTriangle ChildType
Type of child elements.
Definition: ogr_geometry.h:2537
virtual void accept(IOGRConstGeometryVisitor *visitor) const override
Accept a visitor.
Definition: ogr_geometry.h:2565
ChildType ** begin()
Return begin of iterator.
Definition: ogr_geometry.h:2542
ChildType ** end()
Return end of iterator.
Definition: ogr_geometry.h:2544
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:939
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:2943
int OGRPreparedGeometryIntersects(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry intersects with a geometry.
Definition: ogrgeometry.cpp:5861
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:2924
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:798
OGRPreparedGeometry * OGRCreatePreparedGeometry(const OGRGeometry *poGeom)
Creates a prepared geometry.
Definition: ogrgeometry.cpp:5803
int OGRPreparedGeometryContains(const OGRPreparedGeometry *poPreparedGeom, const OGRGeometry *poOtherGeom)
Returns whether a prepared geometry contains a geometry.
Definition: ogrgeometry.cpp:5891
void OGRDestroyPreparedGeometry(OGRPreparedGeometry *poPreparedGeom)
Destroys a prepared geometry.
Definition: ogrgeometry.cpp:5839
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:5783
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.