21 #include "qgis_core.h" 50 void CORE_EXPORT
operator()( GEOSGeometry *geom );
56 void CORE_EXPORT
operator()(
const GEOSPreparedGeometry *geom );
62 void CORE_EXPORT
operator()( GEOSBufferParams *params );
68 void CORE_EXPORT
operator()( GEOSCoordSequence *sequence );
74 using unique_ptr = std::unique_ptr< GEOSGeometry, GeosDeleter>;
109 void geometryChanged()
override;
110 void prepareGeometry()
override;
119 std::unique_ptr< QgsAbstractGeometry > clip(
const QgsRectangle &rectangle, QString *errorMsg =
nullptr )
const;
135 std::unique_ptr< QgsAbstractGeometry > subdivide(
int maxNodes, QString *errorMsg =
nullptr )
const;
138 QgsAbstractGeometry *combine(
const QVector<QgsAbstractGeometry *> &geomList, QString *errorMsg )
const override;
139 QgsAbstractGeometry *combine(
const QVector< QgsGeometry > &, QString *errorMsg =
nullptr )
const override;
141 QgsAbstractGeometry *buffer(
double distance,
int segments, QString *errorMsg =
nullptr )
const override;
142 QgsAbstractGeometry *buffer(
double distance,
int segments,
int endCapStyle,
int joinStyle,
double miterLimit, QString *errorMsg =
nullptr )
const override;
143 QgsAbstractGeometry *simplify(
double tolerance, QString *errorMsg =
nullptr )
const override;
144 QgsAbstractGeometry *interpolate(
double distance, QString *errorMsg =
nullptr )
const override;
146 QgsPoint *centroid( QString *errorMsg =
nullptr )
const override;
147 QgsPoint *pointOnSurface( QString *errorMsg =
nullptr )
const override;
149 double distance(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const override;
166 double hausdorffDistance(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const;
184 double hausdorffDistanceDensify(
const QgsAbstractGeometry *geom,
double densifyFraction, QString *errorMsg =
nullptr )
const;
186 bool intersects(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const override;
187 bool touches(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const override;
188 bool crosses(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const override;
189 bool within(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const override;
190 bool overlaps(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const override;
191 bool contains(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const override;
192 bool disjoint(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const override;
193 QString relate(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const override;
194 bool relatePattern(
const QgsAbstractGeometry *geom,
const QString &pattern, QString *errorMsg =
nullptr )
const override;
195 double area( QString *errorMsg =
nullptr )
const override;
196 double length( QString *errorMsg =
nullptr )
const override;
197 bool isValid( QString *errorMsg =
nullptr )
const override;
198 bool isEqual(
const QgsAbstractGeometry *geom, QString *errorMsg =
nullptr )
const override;
199 bool isEmpty( QString *errorMsg =
nullptr )
const override;
200 bool isSimple( QString *errorMsg =
nullptr )
const override;
203 QVector<QgsGeometry> &newGeometries,
206 QString *errorMsg =
nullptr )
const override;
208 QgsAbstractGeometry *offsetCurve(
double distance,
int segments,
int joinStyle,
double miterLimit, QString *errorMsg =
nullptr )
const override;
223 std::unique_ptr< QgsAbstractGeometry > singleSidedBuffer(
double distance,
int segments,
int side,
224 int joinStyle,
double miterLimit,
225 QString *errorMsg =
nullptr )
const;
245 QgsGeometry mergeLines( QString *errorMsg =
nullptr )
const;
271 double lineLocatePoint(
const QgsPoint &point, QString *errorMsg =
nullptr )
const;
282 static QgsGeometry polygonize(
const QVector<const QgsAbstractGeometry *> &geometries, QString *errorMsg =
nullptr );
299 QgsGeometry voronoiDiagram(
const QgsAbstractGeometry *extent =
nullptr,
double tolerance = 0.0,
bool edgesOnly =
false, QString *errorMsg =
nullptr )
const;
310 QgsGeometry delaunayTriangulation(
double tolerance = 0.0,
bool edgesOnly =
false, QString *errorMsg =
nullptr )
const;
316 static std::unique_ptr< QgsAbstractGeometry > fromGeos(
const GEOSGeometry *
geos );
317 static std::unique_ptr< QgsPolygon > fromGeosPolygon(
const GEOSGeometry *geos );
319 static QgsPoint coordSeqPoint(
const GEOSCoordSequence *cs,
int i,
bool hasZ,
bool hasM );
321 static GEOSContextHandle_t getGEOSHandler();
327 double mPrecision = 0.0;
349 void cacheGeos()
const;
350 std::unique_ptr< QgsAbstractGeometry > overlay(
const QgsAbstractGeometry *geom, Overlay op, QString *errorMsg =
nullptr )
const;
351 bool relation(
const QgsAbstractGeometry *geom, Relation r, QString *errorMsg =
nullptr )
const;
352 static GEOSCoordSequence *createCoordinateSequence(
const QgsCurve *curve,
double precision,
bool forceClose =
false );
353 static std::unique_ptr< QgsLineString > sequenceToLinestring(
const GEOSGeometry *geos,
bool hasZ,
bool hasM );
354 static int numberOfGeometries( GEOSGeometry *g );
355 static geos::unique_ptr nodeGeometries(
const GEOSGeometry *splitLine,
const GEOSGeometry *geom );
356 int mergeGeometriesMultiTypeSplit( QVector<GEOSGeometry *> &splitResult )
const;
361 static geos::unique_ptr createGeosCollection(
int typeId,
const QVector<GEOSGeometry *> &geoms );
363 static geos::unique_ptr createGeosPointXY(
double x,
double y,
bool hasZ,
double z,
bool hasM,
double m,
int coordDims,
double precision );
369 bool topologicalTestPointsSplit(
const GEOSGeometry *splitLine,
QgsPointSequence &testPoints, QString *errorMsg =
nullptr )
const;
371 EngineOperationResult splitLinearGeometry( GEOSGeometry *splitLine, QVector<QgsGeometry > &newGeometries )
const;
372 EngineOperationResult splitPolygonGeometry( GEOSGeometry *splitLine, QVector<QgsGeometry > &newGeometries )
const;
375 static geos::unique_ptr reshapeLine(
const GEOSGeometry *line,
const GEOSGeometry *reshapeLineGeos,
double precision );
376 static geos::unique_ptr reshapePolygon(
const GEOSGeometry *polygon,
const GEOSGeometry *reshapeLineGeos,
double precision );
377 static int lineContainedInLine(
const GEOSGeometry *line1,
const GEOSGeometry *line2 );
378 static int pointContainedInLine(
const GEOSGeometry *point,
const GEOSGeometry *line );
379 static int geomDigits(
const GEOSGeometry *geom );
386 class GEOSException :
public std::runtime_error
389 explicit GEOSException(
const QString &message )
390 : std::runtime_error( message.toUtf8().constData() )
A rectangle specified with double values.
std::unique_ptr< const GEOSPreparedGeometry, GeosDeleter > prepared_unique_ptr
Scoped GEOS prepared geometry pointer.
A geometry is the spatial representation of a feature.
void CORE_EXPORT operator()(GEOSGeometry *geom)
Destroys the GEOS geometry geom, using the static QGIS geos context.
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
Abstract base class for curved geometry type.
Abstract base class for all geometries.
Does vector analysis using the geos library and handles import, export, exception handling*...
std::unique_ptr< GEOSBufferParams, GeosDeleter > buffer_params_unique_ptr
Scoped GEOS buffer params pointer.
Point geometry type, with support for z-dimension and m-values.
Contains geos related utilities and functions.
QVector< QgsPoint > QgsPointSequence
Line string geometry type, with support for z-dimension and m-values.
Contains geometry relation and modification algorithms.
std::unique_ptr< GEOSCoordSequence, GeosDeleter > coord_sequence_unique_ptr
Scoped GEOS coordinate sequence pointer.
EngineOperationResult
Success or failure of a geometry operation.
Destroys the GEOS geometry geom, using the static QGIS geos context.