32 #ifndef _OGR_GEOMETRY_H_INCLUDED
33 #define _OGR_GEOMETRY_H_INCLUDED
58 typedef struct GEOSGeom_t *GEOSGeom;
59 typedef struct GEOSContextHandle_HS *GEOSContextHandle_t;
86 int getIsoGeometryType()
const;
93 virtual int getDimension()
const = 0;
94 virtual int getCoordinateDimension()
const;
95 virtual OGRBoolean IsEmpty()
const = 0;
96 virtual OGRBoolean IsValid()
const;
97 virtual OGRBoolean IsSimple()
const;
98 virtual OGRBoolean IsRing()
const;
99 virtual void empty() = 0;
101 virtual void getEnvelope(
OGREnvelope * psEnvelope )
const = 0;
102 virtual void getEnvelope(
OGREnvelope3D * psEnvelope )
const = 0;
105 virtual int WkbSize()
const = 0;
106 virtual OGRErr importFromWkb(
unsigned char *,
int=-1 )=0;
108 virtual OGRErr importFromWkt(
char ** ppszInput ) = 0;
109 virtual OGRErr exportToWkt(
char ** ppszDstText )
const = 0;
113 virtual const char *getGeometryName()
const = 0;
114 virtual void dumpReadable( FILE *,
const char * = NULL,
char** papszOptions = NULL )
const;
115 virtual void flattenTo2D() = 0;
116 virtual char * exportToGML(
const char*
const * papszOptions = NULL )
const;
117 virtual char * exportToKML()
const;
118 virtual char * exportToJson()
const;
120 static GEOSContextHandle_t createGEOSContext();
121 static void freeGEOSContext(GEOSContextHandle_t hGEOSCtxt);
122 virtual GEOSGeom exportToGEOS(GEOSContextHandle_t hGEOSCtxt)
const;
124 virtual void closeRings();
126 virtual void setCoordinateDimension(
int nDimension );
134 virtual void segmentize(
double dfMaxLength);
137 virtual OGRBoolean Intersects(
OGRGeometry * )
const;
138 virtual OGRBoolean Equals(
OGRGeometry * )
const = 0;
139 virtual OGRBoolean Disjoint(
const OGRGeometry * )
const;
140 virtual OGRBoolean Touches(
const OGRGeometry * )
const;
141 virtual OGRBoolean Crosses(
const OGRGeometry * )
const;
142 virtual OGRBoolean Within(
const OGRGeometry * )
const;
143 virtual OGRBoolean Contains(
const OGRGeometry * )
const;
144 virtual OGRBoolean Overlaps(
const OGRGeometry * )
const;
148 virtual double Distance(
const OGRGeometry * )
const;
150 virtual OGRGeometry *Buffer(
double dfDist,
int nQuadSegs = 30 )
const;
156 virtual OGRErr Centroid(
OGRPoint * poPoint )
const;
157 virtual OGRGeometry *Simplify(
double dTolerance)
const;
158 OGRGeometry *SimplifyPreserveTopology(
double dTolerance)
const;
163 OGRBoolean Intersect(
OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use Intersects() instead");
164 OGRBoolean Equal(
OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use Equals() instead");
165 virtual
OGRGeometry *SymmetricDifference( const
OGRGeometry * ) const CPL_WARN_DEPRECATED("Non standard method. Use SymDifference() instead");
166 virtual
OGRGeometry *getBoundary() const CPL_WARN_DEPRECATED("Non standard method. Use Boundary() instead");
169 static
int bGenerate_DB2_V72_BYTE_ORDER;
171 virtual
void swapXY();
193 OGRPoint(
double x,
double y,
double z );
197 virtual int WkbSize()
const;
198 virtual OGRErr importFromWkb(
unsigned char *,
int=-1 );
200 virtual OGRErr importFromWkt(
char ** );
201 virtual OGRErr exportToWkt(
char ** ppszDstText )
const;
204 virtual int getDimension()
const;
205 virtual OGRGeometry *clone()
const;
206 virtual void empty();
207 virtual void getEnvelope(
OGREnvelope * psEnvelope )
const;
208 virtual void getEnvelope(
OGREnvelope3D * psEnvelope )
const;
209 virtual OGRBoolean IsEmpty()
const;
212 double getX()
const {
return x; }
213 double getY()
const {
return y; }
214 double getZ()
const {
return z; }
217 virtual void setCoordinateDimension(
int nDimension );
218 void setX(
double xIn ) { x = xIn;
if (nCoordDimension == 0) nCoordDimension = 2; }
219 void setY(
double yIn ) { y = yIn;
if (nCoordDimension == 0) nCoordDimension = 2; }
220 void setZ(
double zIn ) { z = zIn; nCoordDimension=3; }
223 virtual OGRBoolean Equals( OGRGeometry * )
const;
226 virtual const char *getGeometryName()
const;
229 virtual void flattenTo2D();
231 virtual void swapXY();
248 virtual double get_Length()
const = 0;
249 virtual void StartPoint(
OGRPoint *)
const = 0;
250 virtual void EndPoint(
OGRPoint *)
const = 0;
251 virtual int get_IsClosed()
const;
252 virtual void Value(
double,
OGRPoint * )
const = 0;
283 virtual OGRErr
exportToWkt(
char ** ppszDstText )
const;
288 virtual void empty();
291 virtual OGRBoolean
IsEmpty()
const;
298 virtual double Project(
const OGRPoint *)
const;
299 virtual OGRLineString* getSubLine(
double,
double,
int)
const;
303 void getPoint(
int,
OGRPoint * )
const;
304 double getX(
int i )
const {
return paoPoints[i].x; }
305 double getY(
int i )
const {
return paoPoints[i].y; }
306 double getZ(
int i )
const;
313 void setNumPoints(
int nNewPointCount,
int bZeroizeNewContent = TRUE );
315 void setPoint(
int,
double,
double );
316 void setZ(
int,
double );
317 void setPoint(
int,
double,
double,
double );
318 void setPoints(
int,
OGRRawPoint *,
double * = NULL );
319 void setPoints(
int,
double * padfX,
double * padfY,
320 double *padfZ = NULL );
322 void addPoint(
double,
double );
323 void addPoint(
double,
double,
double );
325 void getPoints(
OGRRawPoint *,
double * = NULL )
const;
326 void getPoints(
void* pabyX,
int nXStride,
327 void* pabyY,
int nYStride,
328 void* pabyZ = NULL,
int nZStride = 0 )
const;
331 int nStartVertex = 0,
int nEndVertex = -1 );
332 void reversePoints(
void );
372 virtual int _WkbSize(
int b3D )
const;
373 virtual OGRErr _importFromWkb( OGRwkbByteOrder,
int b3D,
374 unsigned char *,
int=-1 );
375 virtual OGRErr _exportToWkb( OGRwkbByteOrder,
int b3D,
376 unsigned char * )
const;
386 virtual int isClockwise()
const;
387 virtual void reverseWindingOrder();
390 OGRBoolean isPointInRing(
const OGRPoint* pt,
int bTestEnvelope = TRUE)
const;
391 OGRBoolean isPointOnRingBoundary(
const OGRPoint* pt,
int bTestEnvelope = TRUE)
const;
412 virtual double get_Area()
const = 0;
413 virtual OGRErr PointOnSurface(
OGRPoint * poPoint )
const = 0;
442 virtual void empty();
445 virtual OGRBoolean
IsEmpty()
const;
457 virtual OGRErr
exportToWkt(
char ** ppszDstText )
const;
475 int getNumInteriorRings()
const;
482 OGRBoolean IsPointOnSurface(
const OGRPoint * )
const;
505 OGRErr importFromWkbInternal(
unsigned char * pabyData,
int nSize,
int nRecLevel );
506 OGRErr importFromWktInternal(
char **ppszInput,
int nRecLevel );
516 virtual void empty();
519 virtual OGRBoolean
IsEmpty()
const;
527 virtual OGRErr
exportToWkt(
char ** ppszDstText )
const;
529 virtual double get_Length()
const;
530 virtual double get_Area()
const;
538 int getNumGeometries()
const;
548 virtual OGRErr addGeometryDirectly(
OGRGeometry * );
549 virtual OGRErr removeGeometry(
int iIndex,
int bDelete = TRUE );
598 OGRErr importFromWkt_Bracketed(
char **,
int bHasM,
int bHasZ );
654 static OGRErr createFromFgfInternal(
unsigned char *pabyData,
658 int *pnBytesConsumed,
668 static OGRGeometry *createFromGEOS( GEOSContextHandle_t hGEOSCtxt, GEOSGeom );
681 int *pbResultValidGeometry,
682 const char **papszOptions = NULL);
683 static int haveGEOS();
687 char** papszOptions );
690 approximateArcAngles(
double dfX,
double dfY,
double dfZ,
691 double dfPrimaryRadius,
double dfSecondaryAxis,
693 double dfStartAngle,
double dfEndAngle,
694 double dfMaxAngleStepSizeDegrees );
701 typedef struct _OGRPreparedGeometry OGRPreparedGeometry;
702 int OGRHasPreparedGeometrySupport();
703 OGRPreparedGeometry* OGRCreatePreparedGeometry(
const OGRGeometry* poGeom );
704 void OGRDestroyPreparedGeometry( OGRPreparedGeometry* poPreparedGeom );
705 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:3464
virtual OGRwkbGeometryType getGeometryType() const =0
Fetch geometry type.
virtual void setCoordinateDimension(int nDimension)
Set the coordinate dimension.
Definition: ogrgeometry.cpp:718
virtual OGRErr importFromWkb(unsigned char *, int=-1)
Assign geometry from well known binary data.
Definition: ogrlinestring.cpp:833
Definition: ogr_geometry.h:264
virtual OGRErr importFromWkt(char **ppszInput)=0
Assign geometry from well known text data.
double getY() const
Fetch Y coordinate.
Definition: ogr_geometry.h:213
virtual OGRGeometry * clone() const =0
Make a copy of this object.
virtual void swapXY()
Swap x and y coordinates.
Definition: ogrgeometry.cpp:4041
Definition: ogr_geometry.h:652
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:777
int getNumPoints() const
Fetch vertex count.
Definition: ogr_geometry.h:302
virtual void EndPoint(OGRPoint *) const =0
Return the curve end point.
Definition: ogr_geometry.h:567
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:242
Definition: ogr_geometry.h:500
Definition: ogr_geometry.h:366
virtual OGRGeometry * clone() const
Make a copy of this object.
Definition: ogrgeometrycollection.cpp:87
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOgc) const =0
Convert a geometry into well known binary format.
virtual int getDimension() const
Get the dimension of this object.
Definition: ogrgeometrycollection.cpp:120
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:47
OGRwkbGeometryType
Definition: ogr_core.h:308
virtual OGRwkbGeometryType getGeometryType() const
Fetch geometry type.
Definition: ogrgeometrycollection.cpp:107
virtual OGRErr PointOnSurface(OGRPoint *poPoint) const =0
This method relates to the SFCOM ISurface::get_PointOnSurface() method.
Definition: ogr_geometry.h:409
Definition: ogr_geometry.h:624
Definition: ogr_geometry.h:79
double getY(int i) const
Get Y at vertex.
Definition: ogr_geometry.h:305
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:595
double getZ() const
Fetch Z coordinate.
Definition: ogr_geometry.h:214
void setX(double xIn)
Assign point X coordinate.
Definition: ogr_geometry.h:218
virtual OGRErr importFromWkt(char **)
Assign geometry from well known text data.
Definition: ogrgeometrycollection.cpp:764
virtual OGRErr addGeometryDirectly(OGRGeometry *)
Add a geometry directly to the container.
Definition: ogrgeometrycollection.cpp:282
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:220
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:95
Definition: ogr_core.h:342
virtual OGRErr exportToWkb(OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOgc) const
Convert a geometry into well known binary format.
Definition: ogrlinestring.cpp:943
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:219
Definition: ogr_spatialref.h:129
Definition: ogr_core.h:162
Definition: ogr_geometry.h:184
OGRwkbVariant
Definition: ogr_core.h:340
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:212
virtual double get_Area() const
Compute area of polygon.
Definition: ogrpolygon.cpp:1085
virtual int WkbSize() const
Returns size of related binary representation.
Definition: ogrlinestring.cpp:160
Definition: ogr_geometry.h:429
Definition: ogr_core.h:48
OGRSpatialReference * getSpatialReference(void) const
Returns spatial reference system for object.
Definition: ogr_geometry.h:129
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:105
virtual const char * getGeometryName() const
Fetch WKT name for geometry type.
Definition: ogrgeometrycollection.cpp:156
virtual double get_Area() const
Compute area of geometry collection.
Definition: ogrgeometrycollection.cpp:1092
Definition: ogr_geometry.h:595
double getX(int i) const
Get X at vertex.
Definition: ogr_geometry.h:304
virtual OGRBoolean IsEmpty() const =0
Returns TRUE (non-zero) if the object has no points.