QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
21 #include "qgis_core.h"
26 #if defined(GEOS_VERSION_MAJOR) && (GEOS_VERSION_MAJOR<3)
27 #define GEOSGeometry struct GEOSGeom_t
28 #define GEOSCoordSequence struct GEOSCoordSeq_t
55 void CORE_EXPORT
operator()( GEOSGeometry *geom );
61 void CORE_EXPORT
operator()(
const GEOSPreparedGeometry *geom );
67 void CORE_EXPORT
operator()( GEOSBufferParams *params );
73 void CORE_EXPORT
operator()( GEOSCoordSequence *sequence );
79 using unique_ptr = std::unique_ptr< GEOSGeometry, GeosDeleter>;
143 std::unique_ptr< QgsAbstractGeometry > clip(
const QgsRectangle &rectangle, QString *errorMsg =
nullptr )
const;
159 std::unique_ptr< QgsAbstractGeometry > subdivide(
int maxNodes, QString *errorMsg =
nullptr )
const;
166 QgsAbstractGeometry *
buffer(
double distance,
int segments,
int endCapStyle,
int joinStyle,
double miterLimit, QString *errorMsg =
nullptr )
const override;
190 double hausdorffDistance(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const;
208 double hausdorffDistanceDensify(
const QgsAbstractGeometry *geom,
double densifyFraction, QString *errorMsg =
nullptr )
const;
219 double area( QString *errorMsg =
nullptr )
const override;
220 double length( QString *errorMsg =
nullptr )
const override;
221 bool isValid( QString *errorMsg =
nullptr,
bool allowSelfTouchingHoles =
false,
QgsGeometry *errorLoc =
nullptr )
const override;
223 bool isEmpty( QString *errorMsg =
nullptr )
const override;
224 bool isSimple( QString *errorMsg =
nullptr )
const override;
227 QVector<QgsGeometry> &newGeometries,
230 QString *errorMsg =
nullptr )
const override;
247 std::unique_ptr< QgsAbstractGeometry > singleSidedBuffer(
double distance,
int segments,
int side,
248 int joinStyle,
double miterLimit,
249 QString *errorMsg =
nullptr )
const;
269 QgsGeometry mergeLines( QString *errorMsg =
nullptr )
const;
295 double lineLocatePoint(
const QgsPoint &point, QString *errorMsg =
nullptr )
const;
306 static QgsGeometry polygonize(
const QVector<const QgsAbstractGeometry *> &geometries, QString *errorMsg =
nullptr );
323 QgsGeometry voronoiDiagram(
const QgsAbstractGeometry *extent =
nullptr,
double tolerance = 0.0,
bool edgesOnly =
false, QString *errorMsg =
nullptr )
const;
334 QgsGeometry delaunayTriangulation(
double tolerance = 0.0,
bool edgesOnly =
false, QString *errorMsg =
nullptr )
const;
340 static std::unique_ptr< QgsAbstractGeometry > fromGeos(
const GEOSGeometry *
geos );
341 static std::unique_ptr< QgsPolygon > fromGeosPolygon(
const GEOSGeometry *
geos );
357 static QgsPoint coordSeqPoint(
const GEOSCoordSequence *cs,
int i,
bool hasZ,
bool hasM );
359 static GEOSContextHandle_t getGEOSHandler();
365 double mPrecision = 0.0;
387 void cacheGeos()
const;
388 std::unique_ptr< QgsAbstractGeometry > overlay(
const QgsAbstractGeometry *geom, Overlay op, QString *errorMsg =
nullptr )
const;
389 bool relation(
const QgsAbstractGeometry *geom, Relation r, QString *errorMsg =
nullptr )
const;
390 static GEOSCoordSequence *createCoordinateSequence(
const QgsCurve *curve,
double precision,
bool forceClose =
false );
391 static std::unique_ptr< QgsLineString > sequenceToLinestring(
const GEOSGeometry *
geos,
bool hasZ,
bool hasM );
392 static int numberOfGeometries( GEOSGeometry *g );
393 static geos::unique_ptr nodeGeometries(
const GEOSGeometry *splitLine,
const GEOSGeometry *geom );
394 int mergeGeometriesMultiTypeSplit( QVector<GEOSGeometry *> &splitResult )
const;
399 static geos::unique_ptr createGeosCollection(
int typeId,
const QVector<GEOSGeometry *> &geoms );
401 static geos::unique_ptr createGeosPointXY(
double x,
double y,
bool hasZ,
double z,
bool hasM,
double m,
int coordDims,
double precision );
407 bool topologicalTestPointsSplit(
const GEOSGeometry *splitLine,
QgsPointSequence &testPoints, QString *errorMsg =
nullptr )
const;
409 EngineOperationResult splitLinearGeometry( GEOSGeometry *splitLine, QVector<QgsGeometry > &newGeometries )
const;
410 EngineOperationResult splitPolygonGeometry( GEOSGeometry *splitLine, QVector<QgsGeometry > &newGeometries )
const;
414 static geos::unique_ptr reshapePolygon(
const GEOSGeometry *polygon,
const GEOSGeometry *reshapeLineGeos,
double precision );
415 static int lineContainedInLine(
const GEOSGeometry *line1,
const GEOSGeometry *line2 );
416 static int pointContainedInLine(
const GEOSGeometry *point,
const GEOSGeometry *line );
417 static int geomDigits(
const GEOSGeometry *geom );
424 class GEOSException :
public std::runtime_error
427 explicit GEOSException(
const QString &message )
428 : std::runtime_error( message.toUtf8().constData() )
Abstract base class for curved geometry type.
virtual bool isValid(QString *errorMsg=nullptr, bool allowSelfTouchingHoles=false, QgsGeometry *errorLoc=nullptr) const =0
Returns true if the geometry is valid.
virtual bool touches(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom touches this.
std::unique_ptr< GEOSBufferParams, GeosDeleter > buffer_params_unique_ptr
Scoped GEOS buffer params pointer.
virtual QgsAbstractGeometry * interpolate(double distance, QString *errorMsg=nullptr) const =0
Point geometry type, with support for z-dimension and m-values.
Destroys the GEOS geometry geom, using the static QGIS geos context.
virtual bool relatePattern(const QgsAbstractGeometry *geom, const QString &pattern, QString *errorMsg=nullptr) const =0
Tests whether two geometries are related by a specified Dimensional Extended 9 Intersection Model (DE...
Contains geos related utilities and functions.
virtual QgsAbstractGeometry * convexHull(QString *errorMsg=nullptr) const =0
Calculate the convex hull of this.
virtual double length(QString *errorMsg=nullptr) const =0
OperationResult
Success or failure of a geometry operation.
virtual QgsAbstractGeometry * intersection(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Calculate the intersection of this and geom.
virtual QString relate(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Returns the Dimensional Extended 9 Intersection Model (DE-9IM) representation of the relationship bet...
Line string geometry type, with support for z-dimension and m-values.
virtual QgsAbstractGeometry * buffer(double distance, int segments, QString *errorMsg=nullptr) const =0
virtual bool crosses(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom crosses this.
virtual bool disjoint(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom is disjoint from this.
virtual QgsPoint * pointOnSurface(QString *errorMsg=nullptr) const =0
Calculate a point that is guaranteed to be on the surface of this.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
virtual bool isEmpty(QString *errorMsg) const =0
virtual void geometryChanged()=0
Should be called whenever the geometry associated with the engine has been modified and the engine mu...
virtual QgsGeometryEngine::EngineOperationResult splitGeometry(const QgsLineString &splitLine, QVector< QgsGeometry > &newGeometries, bool topological, QgsPointSequence &topologyTestPoints, QString *errorMsg=nullptr) const
Splits this geometry according to a given line.
virtual bool intersects(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom intersects this.
virtual QgsAbstractGeometry * envelope(QString *errorMsg=nullptr) const =0
virtual QgsAbstractGeometry * combine(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Calculate the combination of this and geom.
Abstract base class for all geometries.
virtual QgsAbstractGeometry * symDifference(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Calculate the symmetric difference of this and geom.
virtual bool isSimple(QString *errorMsg=nullptr) const =0
Determines whether the geometry is simple (according to OGC definition).
virtual double distance(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Calculates the distance between this and geom.
virtual bool isEqual(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if this is equal to geom.
virtual QgsAbstractGeometry * simplify(double tolerance, QString *errorMsg=nullptr) const =0
virtual QgsAbstractGeometry * offsetCurve(double distance, int segments, int joinStyle, double miterLimit, QString *errorMsg=nullptr) const =0
virtual double area(QString *errorMsg=nullptr) const =0
virtual void prepareGeometry()=0
Prepares the geometry, so that subsequent calls to spatial relation methods are much faster.
QVector< QgsPoint > QgsPointSequence
virtual bool within(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom is within this.
std::unique_ptr< GEOSCoordSequence, GeosDeleter > coord_sequence_unique_ptr
Scoped GEOS coordinate sequence pointer.
std::unique_ptr< const GEOSPreparedGeometry, GeosDeleter > prepared_unique_ptr
Scoped GEOS prepared geometry pointer.
EngineOperationResult
Success or failure of a geometry operation.
void CORE_EXPORT operator()(GEOSGeometry *geom)
Destroys the GEOS geometry geom, using the static QGIS geos context.
virtual QgsAbstractGeometry * difference(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Calculate the difference of this and geom.
virtual bool overlaps(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom overlaps this.
virtual QgsPoint * centroid(QString *errorMsg=nullptr) const =0
Calculates the centroid of this.
Contains geometry relation and modification algorithms.
virtual bool contains(const QgsAbstractGeometry *geom, QString *errorMsg=nullptr) const =0
Checks if geom contains this.