17#ifndef QGS_GEOMETRYCHECKERUTILS_H
18#define QGS_GEOMETRYCHECKERUTILS_H
20#include "qgis_analysis.h"
124 LayerFeatures(
const QMap<QString, QgsFeaturePool *> &featurePools,
const QMap<QString, QgsFeatureIds> &featureIds,
const QList<Qgis::GeometryType> &geometryTypes,
QgsFeedback *feedback,
const QgsGeometryCheckContext *context,
bool useMapCrs =
false );
168 bool nextLayerFeature(
bool begin );
169 bool nextLayer(
bool begin );
170 bool nextFeature(
bool begin );
171 QList<QString>::const_iterator mLayerIt;
172 QgsFeatureIds::const_iterator mFeatureIt;
174 std::unique_ptr<QgsGeometryCheckerUtils::LayerFeature> mCurrentFeature;
195 QMap<QString, QgsFeaturePool *> mFeaturePools;
196 QMap<QString, QgsFeatureIds> mFeatureIds;
197 QList<QString> mLayerIds;
199 QList<Qgis::GeometryType> mGeometryTypes;
202 bool mUseMapCrs =
true;
222 const int nVerts = geom->
vertexCount( iPart, iRing );
225 const bool closed = back == front;
228 return closed ? nVerts - 1 : nVerts;
238 static bool pointOnLine(
const QgsPoint &p,
const QgsLineString *line,
double tol,
bool excludeExtremities =
false );
246 const int nVerts = geom->
vertexCount( iPart, iRing );
249 const bool closed = back == front;
250 return closed ? nVerts > 4 : nVerts > 2;
Abstract base class for all geometries.
virtual int vertexCount(int part=0, int ring=0) const =0
Returns the number of vertices of which this geometry is built.
virtual QgsPoint vertexAt(QgsVertexId id) const =0
Returns the point corresponding to a specified vertex id.
virtual bool isEmpty() const
Returns true if the geometry is empty.
Represents a coordinate reference system (CRS).
A feature pool is based on a vector layer and caches features.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Base configuration for geometry checks.
A layer feature combination to uniquely identify and access a feature in a set of layers.
LayerFeature(const QgsFeaturePool *pool, const QgsFeature &feature, const QgsGeometryCheckContext *context, bool useMapCrs)
Create a new layer/feature combination.
QString layerId() const
The layer id.
QgsGeometry geometry() const
Returns the geometry of this feature.
QString id() const
Returns a combination of the layerId and the feature id.
QgsFeature feature() const
Returns the feature.
QPointer< QgsVectorLayer > layer() const
The layer.
bool useMapCrs() const
Returns if the geometry is reprojected to the map CRS or not.
QgsCoordinateReferenceSystem layerCrs() const
The layer CRS.
An iterator over all features in a QgsGeometryCheckerUtils::LayerFeatures.
const iterator & operator++()
Increments the item the iterator currently points to by one and returns the new iterator.
iterator(const QStringList::const_iterator &layerIt, const LayerFeatures *parent)
Creates a new iterator.
iterator end() const
One after the last feature to stop iterating.
LayerFeatures(const QMap< QString, QgsFeaturePool * > &featurePools, const QMap< QString, QgsFeatureIds > &featureIds, const QList< Qgis::GeometryType > &geometryTypes, QgsFeedback *feedback, const QgsGeometryCheckContext *context, bool useMapCrs=false)
Creates a new set of layer and features.
iterator begin() const
The first feature to start iterating.
Contains utilities required for geometry checks.
static void filter1DTypes(QgsAbstractGeometry *geom)
static QList< const QgsLineString * > polygonRings(const QgsPolygon *polygon)
static bool canDeleteVertex(const QgsAbstractGeometry *geom, int iPart, int iRing)
static QgsAbstractGeometry * getGeomPart(QgsAbstractGeometry *geom, int partIdx)
static int polyLineSize(const QgsAbstractGeometry *geom, int iPart, int iRing, bool *isClosed=nullptr)
Returns the number of points in a polyline, accounting for duplicate start and end point if the polyl...
A geometry engine is a low-level representation of a QgsAbstractGeometry object, optimised for use wi...
A geometry is the spatial representation of a feature.
Line string geometry type, with support for z-dimension and m-values.
Point geometry type, with support for z-dimension and m-values.
A rectangle specified with double values.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
QgsMargins operator*(const QgsMargins &margins, double factor)
Returns a QgsMargins object that is formed by multiplying each component of the given margins by fact...
Utility class for identifying a unique vertex within a geometry.