17 #ifndef QGS_GEOMETRYCHECKERUTILS_H 18 #define QGS_GEOMETRYCHECKERUTILS_H 20 #include "qgis_analysis.h" 72 QPointer<QgsVectorLayer> layer()
const SIP_SKIP;
77 QString layerId()
const;
96 bool useMapCrs()
const;
120 LayerFeatures(
const QMap<QString, QgsFeaturePool *> &featurePools,
121 const QMap<QString, QgsFeatureIds> &featureIds,
122 const QList<QgsWkbTypes::GeometryType> &geometryTypes,
125 bool useMapCrs =
false );
130 LayerFeatures(
const QMap<QString, QgsFeaturePool *> &featurePools,
131 const QList<QString> &layerIds,
const QgsRectangle &extent,
132 const QList<QgsWkbTypes::GeometryType> &geometryTypes,
176 bool nextLayerFeature(
bool begin );
177 bool nextLayer(
bool begin );
178 bool nextFeature(
bool begin );
179 QList<QString>::const_iterator mLayerIt;
180 QgsFeatureIds::const_iterator mFeatureIt;
182 std::unique_ptr<QgsGeometryCheckerUtils::LayerFeature> mCurrentFeature;
201 QMap<QString, QgsFeaturePool *> mFeaturePools;
202 QMap<QString, QgsFeatureIds> mFeatureIds;
203 QList<QString> mLayerIds;
205 QList<QgsWkbTypes::GeometryType> mGeometryTypes;
208 bool mUseMapCrs =
true;
213 static std::unique_ptr<QgsGeometryEngine> createGeomEngine(
const QgsAbstractGeometry *geometry,
double tolerance );
218 static QList <const QgsLineString *> polygonRings(
const QgsPolygon *polygon );
233 bool closed = back == front;
236 return closed ? nVerts - 1 : nVerts;
246 static bool pointOnLine(
const QgsPoint &p,
const QgsLineString *line,
double tol,
bool excludeExtremities =
false );
261 double dx = p1.
x() - p2.
x(), dy = p1.
y() - p2.
y();
262 return ( dx * dx + dy * dy ) < tol * tol;
270 bool closed = back == front;
271 return closed ? nVerts > 4 : nVerts > 2;
278 #endif // QGS_GEOMETRYCHECKERUTILS_H A rectangle specified with double values.
static bool pointsFuzzyEqual(const QgsPointXY &p1, const QgsPointXY &p2, double tol)
Determine whether two points are equal up to the specified tolerance.
virtual bool isEmpty() const
Returns true if the geometry is empty.
Contains utilities required for geometry checks.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
A class to represent a 2D point.
Base configuration for geometry checks.
Contains a set of layers and feature ids in those layers to pass to a geometry check.
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 is the spatial representation of a feature.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Base class for feedback objects to be used for cancellation of something running in a worker thread...
Utility class for identifying a unique vertex within a geometry.
An iterator over all features in a QgsGeometryCheckerUtils::LayerFeatures.
A layer feature combination to uniquely identify and access a feature in a set of layers...
Abstract base class for all geometries.
Point geometry type, with support for z-dimension and m-values.
static bool canDeleteVertex(const QgsAbstractGeometry *geom, int iPart, int iRing)
A feature pool is based on a vector layer and caches features.
Line string geometry type, with support for z-dimension and m-values.
virtual int vertexCount(int part=0, int ring=0) const =0
Returns the number of vertices of which this geometry is built.
Contains geometry relation and modification algorithms.
QgsMargins operator*(const QgsMargins &margins, double factor)
Returns a QgsMargins object that is formed by multiplying each component of the given margins by fact...
virtual QgsPoint vertexAt(QgsVertexId id) const =0
Returns the point corresponding to a specified vertex id.