31 #ifndef _OGR_GEOMETRY_H_INCLUDED
32 #define _OGR_GEOMETRY_H_INCLUDED
57 typedef struct GEOSGeom_t *GEOSGeom;
90 virtual int getDimension()
const = 0;
91 virtual int getCoordinateDimension()
const;
92 virtual OGRBoolean IsEmpty()
const = 0;
93 virtual OGRBoolean IsValid()
const;
94 virtual OGRBoolean IsSimple()
const;
95 virtual OGRBoolean IsRing()
const;
96 virtual void empty() = 0;
98 virtual void getEnvelope(
OGREnvelope * psEnvelope )
const = 0;
99 virtual void getEnvelope(
OGREnvelope3D * psEnvelope )
const = 0;
102 virtual int WkbSize()
const = 0;
103 virtual OGRErr importFromWkb(
unsigned char *,
int=-1 )=0;
104 virtual OGRErr exportToWkb( OGRwkbByteOrder,
unsigned char * )
const = 0;
105 virtual OGRErr importFromWkt(
char ** ppszInput ) = 0;
106 virtual OGRErr exportToWkt(
char ** ppszDstText )
const = 0;
110 virtual const char *getGeometryName()
const = 0;
111 virtual void dumpReadable( FILE *,
const char * = NULL,
char** papszOptions = NULL )
const;
112 virtual void flattenTo2D() = 0;
113 virtual char * exportToGML(
const char*
const * papszOptions = NULL )
const;
114 virtual char * exportToKML()
const;
115 virtual char * exportToJson()
const;
116 virtual GEOSGeom exportToGEOS()
const;
117 virtual void closeRings();
119 virtual void setCoordinateDimension(
int nDimension );
127 virtual void segmentize(
double dfMaxLength);
130 virtual OGRBoolean Intersects(
OGRGeometry * )
const;
131 virtual OGRBoolean Equals(
OGRGeometry * )
const = 0;
132 virtual OGRBoolean Disjoint(
const OGRGeometry * )
const;
133 virtual OGRBoolean Touches(
const OGRGeometry * )
const;
134 virtual OGRBoolean Crosses(
const OGRGeometry * )
const;
135 virtual OGRBoolean Within(
const OGRGeometry * )
const;
136 virtual OGRBoolean Contains(
const OGRGeometry * )
const;
137 virtual OGRBoolean Overlaps(
const OGRGeometry * )
const;
141 virtual double Distance(
const OGRGeometry * )
const;
143 virtual OGRGeometry *Buffer(
double dfDist,
int nQuadSegs = 30 )
const;
149 virtual OGRErr Centroid(
OGRPoint * poPoint )
const;
150 virtual OGRGeometry *Simplify(
double dTolerance)
const;
151 OGRGeometry *SimplifyPreserveTopology(
double dTolerance)
const;
156 OGRBoolean Intersect(
OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use Intersects() instead");
157 OGRBoolean Equal(
OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use Equals() instead");
158 virtual
OGRGeometry *SymmetricDifference( const
OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use SymDifference() instead");
159 virtual
OGRGeometry *getBoundary() const CPL_WARN_DEPRECATED("Non standard method. Use Boundary() instead");
162 static
int bGenerate_DB2_V72_BYTE_ORDER;
164 virtual
void swapXY();
186 OGRPoint(
double x,
double y,
double z );
190 virtual int WkbSize()
const;
191 virtual OGRErr importFromWkb(
unsigned char *,
int=-1 );
192 virtual OGRErr exportToWkb( OGRwkbByteOrder,
unsigned char * )
const;
193 virtual OGRErr importFromWkt(
char ** );
194 virtual OGRErr exportToWkt(
char ** ppszDstText )
const;
197 virtual int getDimension()
const;
198 virtual OGRGeometry *clone()
const;
199 virtual void empty();
200 virtual void getEnvelope(
OGREnvelope * psEnvelope )
const;
201 virtual void getEnvelope(
OGREnvelope3D * psEnvelope )
const;
202 virtual OGRBoolean IsEmpty()
const;
205 double getX()
const {
return x; }
206 double getY()
const {
return y; }
207 double getZ()
const {
return z; }
210 virtual void setCoordinateDimension(
int nDimension );
211 void setX(
double xIn ) { x = xIn;
if (nCoordDimension == 0) nCoordDimension = 2; }
212 void setY(
double yIn ) { y = yIn;
if (nCoordDimension == 0) nCoordDimension = 2; }
213 void setZ(
double zIn ) { z = zIn; nCoordDimension=3; }
216 virtual OGRBoolean Equals( OGRGeometry * )
const;
219 virtual const char *getGeometryName()
const;
222 virtual void flattenTo2D();
224 virtual void swapXY();
241 virtual double get_Length()
const = 0;
242 virtual void StartPoint(
OGRPoint *)
const = 0;
243 virtual void EndPoint(
OGRPoint *)
const = 0;
244 virtual int get_IsClosed()
const;
245 virtual void Value(
double,
OGRPoint * )
const = 0;
274 virtual OGRErr
exportToWkb( OGRwkbByteOrder,
unsigned char * )
const;
276 virtual OGRErr
exportToWkt(
char ** ppszDstText )
const;
281 virtual void empty();
284 virtual OGRBoolean
IsEmpty()
const;
294 void getPoint(
int,
OGRPoint * )
const;
295 double getX(
int i )
const {
return paoPoints[i].x; }
296 double getY(
int i )
const {
return paoPoints[i].y; }
297 double getZ(
int i )
const;
304 void setNumPoints(
int );
306 void setPoint(
int,
double,
double );
307 void setPoint(
int,
double,
double,
double );
308 void setPoints(
int,
OGRRawPoint *,
double * = NULL );
309 void setPoints(
int,
double * padfX,
double * padfY,
310 double *padfZ = NULL );
312 void addPoint(
double,
double );
313 void addPoint(
double,
double,
double );
315 void getPoints(
OGRRawPoint *,
double * = NULL )
const;
316 void getPoints(
void* pabyX,
int nXStride,
317 void* pabyY,
int nYStride,
318 void* pabyZ = NULL,
int nZStride = 0 )
const;
321 int nStartVertex = 0,
int nEndVertex = -1 );
322 void reversePoints(
void );
362 virtual int _WkbSize(
int b3D )
const;
363 virtual OGRErr _importFromWkb( OGRwkbByteOrder,
int b3D,
364 unsigned char *,
int=-1 );
365 virtual OGRErr _exportToWkb( OGRwkbByteOrder,
int b3D,
366 unsigned char * )
const;
376 virtual int isClockwise()
const;
377 virtual void reverseWindingOrder();
380 OGRBoolean isPointInRing(
const OGRPoint* pt,
int bTestEnvelope = TRUE)
const;
381 OGRBoolean isPointOnRingBoundary(
const OGRPoint* pt,
int bTestEnvelope = TRUE)
const;
388 virtual OGRErr
exportToWkb( OGRwkbByteOrder,
unsigned char * )
const;
402 virtual double get_Area()
const = 0;
403 virtual OGRErr PointOnSurface(
OGRPoint * poPoint )
const = 0;
432 virtual void empty();
435 virtual OGRBoolean
IsEmpty()
const;
445 virtual OGRErr
exportToWkb( OGRwkbByteOrder,
unsigned char * )
const;
447 virtual OGRErr
exportToWkt(
char ** ppszDstText )
const;
465 int getNumInteriorRings()
const;
469 OGRBoolean IsPointOnSurface(
const OGRPoint * )
const;
492 OGRErr importFromWkbInternal(
unsigned char * pabyData,
int nSize,
int nRecLevel );
493 OGRErr importFromWktInternal(
char **ppszInput,
int nRecLevel );
503 virtual void empty();
506 virtual OGRBoolean
IsEmpty()
const;
512 virtual OGRErr
exportToWkb( OGRwkbByteOrder,
unsigned char * )
const;
514 virtual OGRErr
exportToWkt(
char ** ppszDstText )
const;
516 virtual double get_Length()
const;
517 virtual double get_Area()
const;
525 int getNumGeometries()
const;
535 virtual OGRErr addGeometryDirectly(
OGRGeometry * );
536 virtual OGRErr removeGeometry(
int iIndex,
int bDelete = TRUE );
585 OGRErr importFromWkt_Bracketed(
char **,
int bHasM,
int bHasZ );
641 static OGRErr createFromFgfInternal(
unsigned char *pabyData,
645 int *pnBytesConsumed,
668 int *pbResultValidGeometry,
669 const char **papszOptions = NULL);
671 static void *getGEOSGeometryFactory();
673 static int haveGEOS();
677 char** papszOptions );
680 approximateArcAngles(
double dfX,
double dfY,
double dfZ,
681 double dfPrimaryRadius,
double dfSecondaryAxis,
683 double dfStartAngle,
double dfEndAngle,
684 double dfMaxAngleStepSizeDegrees );
691 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
692 int OGRHasPreparedGeometrySupport();
693 OGRPreparedGeometry* OGRCreatePreparedGeometry(
const OGRGeometry* poGeom );
694 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
695 int OGRPreparedGeometryIntersects(
const OGRPreparedGeometry* poPreparedGeom,
virtual void Value(double, OGRPoint *) const =0
Fetch point at given distance along curve.
virtual void closeRings()
Force rings to be closed.
Definition: ogrgeometry.cpp:3383
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
virtual void setCoordinateDimension(int nDimension)
Set the coordinate dimension.
Definition: ogrgeometry.cpp:706
virtual OGRErr importFromWkb(unsigned char *, int=-1)
Assign geometry from well known binary data.
Definition: ogrlinestring.cpp:808
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *) const
Convert a geometry into well known binary format.
Definition: ogrlinestring.cpp:928
Definition: ogr_geometry.h:257
virtual OGRErr importFromWkt(char **ppszInput)=0
Assign geometry from well known text data.
double getY() const
Fetch Y coordinate.
Definition: ogr_geometry.h:206
virtual OGRGeometry * clone() const =0
Make a copy of this object.
virtual void swapXY()
Swap x and y coordinates.
Definition: ogrgeometry.cpp:3945
Definition: ogr_geometry.h:639
virtual const char * getGeometryName() const =0
Fetch WKT name for geometry type.
virtual OGRErr exportToWkt(char **ppszDstText) const
Convert a geometry into well known text format.
Definition: ogrgeometrycollection.cpp:779
int getNumPoints() const
Fetch vertex count.
Definition: ogr_geometry.h:293
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
Definition: ogr_geometry.h:554
virtual OGRBoolean Equals(OGRGeometry *) const =0
Returns TRUE if two geometries are equivalent.
virtual void flattenTo2D()=0
Convert geometry to strictly 2D. In a sense this converts all Z coordinates to 0.0.
Definition: ogr_geometry.h:235
Definition: ogr_geometry.h:487
Definition: ogr_geometry.h:356
virtual OGRGeometry * clone() const
Make a copy of this object.
Definition: ogrgeometrycollection.cpp:86
virtual int getDimension() const
Get the dimension of this object.
Definition: ogrgeometrycollection.cpp:119
virtual double get_Length() const =0
Returns the length of the curve.
virtual void StartPoint(OGRPoint *) const =0
Return the curve start point.
Definition: ogr_geometry.h:46
OGRwkbGeometryType
Definition: ogr_core.h:297
virtual OGRwkbGeometryType getGeometryType() const
Fetch geometry type.
Definition: ogrgeometrycollection.cpp:106
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const =0
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:399
Definition: ogr_geometry.h:611
Definition: ogr_geometry.h:77
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:296
virtual void empty()=0
Clear geometry information. This restores the geometry to it's initial state after construction...
virtual void segmentize(double dfMaxLength)
Modify the geometry such it has no segment longer then the given distance.
Definition: ogrgeometry.cpp:583
double getZ() const
Fetch Z coordinate.
Definition: ogr_geometry.h:207
void setX(double xIn)
Assign point X coordinate.
Definition: ogr_geometry.h:211
virtual OGRErr importFromWkt(char **)
Assign geometry from well known text data.
Definition: ogrgeometrycollection.cpp:766
virtual OGRErr addGeometryDirectly(OGRGeometry *)
Add a geometry directly to the container.
Definition: ogrgeometrycollection.cpp:281
virtual double get_Area() const =0
Get the area of the surface object.
void setZ(double zIn)
Assign point Z coordinate. Calling this method will force the geometry coordinate dimension to 3D (wk...
Definition: ogr_geometry.h:213
virtual int getDimension() const =0
Get the dimension of this object.
virtual OGRErr exportToWkt(char **ppszDstText) const =0
Convert a geometry into well known text format.
virtual const char * getGeometryName() const
Fetch WKT name for geometry type.
Definition: ogrlinestring.cpp:92
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *) const =0
Convert a geometry into well known binary format.
virtual OGRErr importFromWkb(unsigned char *, int=-1)=0
Assign geometry from well known binary data.
void setY(double yIn)
Assign point Y coordinate.
Definition: ogr_geometry.h:212
Definition: ogr_spatialref.h:128
Definition: ogr_core.h:151
Definition: ogr_geometry.h:177
virtual int WkbSize() const =0
Returns size of related binary representation.
virtual void getEnvelope(OGREnvelope *psEnvelope) const =0
Computes and returns the bounding envelope for this geometry in the passed psEnvelope structure...
double getX() const
Fetch X coordinate.
Definition: ogr_geometry.h:205
virtual double get_Area() const
Compute area of polygon.
Definition: ogrpolygon.cpp:1039
virtual int WkbSize() const
Returns size of related binary representation.
Definition: ogrlinestring.cpp:157
Definition: ogr_geometry.h:419
Definition: ogr_core.h:47
OGRSpatialReference * getSpatialReference(void) const
Returns spatial reference system for object.
Definition: ogr_geometry.h:122
virtual OGRErr transform(OGRCoordinateTransformation *poCT)=0
Apply arbitrary coordinate transformation to geometry.
virtual OGRGeometry * clone() const
Make a copy of this object.
Definition: ogrlinestring.cpp:102
virtual const char * getGeometryName() const
Fetch WKT name for geometry type.
Definition: ogrgeometrycollection.cpp:155
virtual double get_Area() const
Compute area of geometry collection.
Definition: ogrgeometrycollection.cpp:1091
Definition: ogr_geometry.h:582
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:295
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.