36   : mFeaturePool( pool )
    38   , mMapCrs( useMapCrs )
    42   if ( useMapCrs && context->
mapCrs.
isValid() && !transform.isShortCircuited() )
    50       QgsDebugMsg( QStringLiteral( 
"Shrug. What shall we do with a geometry that cannot be converted?" ) );
    77   return QStringLiteral( 
"%1:%2" ).arg( 
layer()->name() ).arg( mFeature.
id() );
    97   nextLayerFeature( 
true );
   102   mLayerIt = rh.mLayerIt;
   103   mFeatureIt = rh.mFeatureIt;
   104   mParent = rh.mParent;
   105   mCurrentFeature = qgis::make_unique<LayerFeature>( *rh.mCurrentFeature.get() );
   125   Q_ASSERT( mCurrentFeature );
   126   return *mCurrentFeature;
   131   return mLayerIt != other.mLayerIt || mFeatureIt != other.mFeatureIt;
   136   nextLayerFeature( 
false );
   139 bool QgsGeometryCheckerUtils::LayerFeatures::iterator::nextLayerFeature( 
bool begin )
   141   if ( !begin && nextFeature( 
false ) )
   145   while ( nextLayer( begin ) )
   148     if ( nextFeature( 
true ) )
   154   mFeatureIt = QgsFeatureIds::const_iterator();
   155   mCurrentFeature.reset();
   159 bool QgsGeometryCheckerUtils::LayerFeatures::iterator::nextLayer( 
bool begin )
   167     if ( mLayerIt == mParent->mLayerIds.end() )
   171     if ( mParent->mGeometryTypes.contains( mParent->mFeaturePools[*mLayerIt]->geometryType() ) )
   173       mFeatureIt = mParent->mFeatureIds[*mLayerIt].constBegin();
   181 bool QgsGeometryCheckerUtils::LayerFeatures::iterator::nextFeature( 
bool begin )
   184   const QgsFeatureIds &featureIds = mParent->mFeatureIds[*mLayerIt];
   191     if ( mFeatureIt == featureIds.end() )
   195     if ( mParent->mFeedback )
   200       mCurrentFeature.reset( 
new LayerFeature( mParent->mFeaturePools[*mLayerIt], feature, mParent->mContext, mParent->mUseMapCrs ) );
   211     const QMap<QString, QgsFeatureIds> &featureIds,
   212     const QList<QgsWkbTypes::GeometryType> &geometryTypes,
   216   : mFeaturePools( featurePools )
   217   , mFeatureIds( featureIds )
   218   , mLayerIds( featurePools.keys() )
   219   , mGeometryTypes( geometryTypes )
   220   , mFeedback( feedback )
   221   , mContext( context )
   222   , mUseMapCrs( useMapCrs )
   226     const QList<QString> &layerIds, 
const QgsRectangle &extent,
   227     const QList<QgsWkbTypes::GeometryType> &geometryTypes,
   229   : mFeaturePools( featurePools )
   230   , mLayerIds( layerIds )
   232   , mGeometryTypes( geometryTypes )
   233   , mContext( context )
   236   for ( 
const QString &layerId : layerIds )
   239     if ( geometryTypes.contains( featurePool->
geometryType() ) )
   253   return iterator( mLayerIds.constBegin(), this );
   258   return iterator( mLayerIds.end(), this );
   265   return qgis::make_unique<QgsGeos>( geometry, tolerance );
   270   if ( dynamic_cast<QgsGeometryCollection *>( geom ) )
   279   if ( dynamic_cast<const QgsGeometryCollection *>( geom ) )
   288   QList<const QgsLineString *> rings;
   291     rings.append( exterior );
   293   for ( 
int iInt = 0, nInt = polygon->
numInteriorRings(); iInt < nInt; ++iInt )
   297       rings.append( interior );
   305   if ( qgsgeometry_cast<QgsGeometryCollection *>( geom ) )
   308     for ( 
int nParts = geom->
partCount(), iPart = nParts - 1; iPart >= 0; --iPart )
   310       if ( !qgsgeometry_cast<QgsSurface *>( geomCollection->
geometryN( iPart ) ) )
   320   double nom = std::fabs( ( p2.
y() - p1.
y() ) * q.
x() - ( p2.
x() - p1.
x() ) * q.
y() + p2.
x() * p1.
y() - p2.
y() * p1.
x() );
   321   double dx = p2.
x() - p1.
x();
   322   double dy = p2.
y() - p1.
y();
   323   return nom / std::sqrt( dx * dx + dy * dy );
   329   for ( 
int i = 0 + excludeExtremities; i < nVerts - 1 - excludeExtremities; ++i )
   344   QList<QgsPoint> intersections;
   346   bool intersection = 
false;
   347   for ( 
int i = 0, n = line1->
vertexCount() - 1; i < n; ++i )
   349     for ( 
int j = 0, m = line2->
vertexCount() - 1; j < m; ++j )
   357         intersections.append( inter );
   361   return intersections;
   369   for ( 
int iPart1 = 0, nParts1 = geom1->
partCount(); iPart1 < nParts1; ++iPart1 )
   371     for ( 
int iRing1 = 0, nRings1 = geom1->
ringCount( iPart1 ); iRing1 < nRings1; ++iRing1 )
   373       for ( 
int iVert1 = 0, jVert1 = 1, nVerts1 = geom1->
vertexCount( iPart1, iRing1 ); jVert1 < nVerts1; iVert1 = jVert1++ )
   377         double lambdap1 = 0.;
   382           d = 
QgsVector( p2.
x() - p1.
x(), p2.
y() - p1.
y() ).normalized();
   390         for ( 
int iPart2 = 0, nParts2 = geom2->
partCount(); iPart2 < nParts2; ++iPart2 )
   392           for ( 
int iRing2 = 0, nRings2 = geom2->
ringCount( iPart2 ); iRing2 < nRings2; ++iRing2 )
   394             for ( 
int iVert2 = 0, jVert2 = 1, nVerts2 = geom2->
vertexCount( iPart2, iRing2 ); jVert2 < nVerts2; iVert2 = jVert2++ )
   403                 double lambdaq1 = 
QgsVector( q1.
x() - p1.
x(), q1.
y() - p1.
y() ) * d;
   404                 double lambdaq2 = 
QgsVector( q2.
x() - p1.
x(), q2.
y() - p1.
y() ) * d;
   405                 if ( lambdaq1 > lambdaq2 )
   407                   std::swap( lambdaq1, lambdaq2 );
   409                 double lambda1 = std::max( lambdaq1, lambdap1 );
   410                 double lambda2 = std::min( lambdaq2, lambdap2 );
   411                 len += std::max( 0., lambda2 - lambda1 );
 
virtual bool removeGeometry(int nr)
Removes a geometry from the collection. 
 
A rectangle specified with double values. 
 
QgsFeatureIds getIntersects(const QgsRectangle &rect) const
Gets all feature ids in the bounding box rect. 
 
QSet< QgsFeatureId > QgsFeatureIds
 
static bool segmentIntersection(const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q1, const QgsPoint &q2, QgsPoint &intersectionPoint, bool &isIntersection, double tolerance=1e-8, bool acceptImproperIntersection=false)
Compute the intersection between two segments. 
 
bool getFeature(QgsFeatureId id, QgsFeature &feature, QgsFeedback *feedback=nullptr)
Retrieves the feature with the specified id into feature. 
 
OperationResult transform(const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection direction=QgsCoordinateTransform::ForwardTransform, bool transformZ=false) SIP_THROW(QgsCsException)
Transforms this geometry as described by the coordinate transform ct. 
 
static QgsAbstractGeometry * getGeomPart(QgsAbstractGeometry *geom, int partIdx)
 
double progress() const
Returns the current progress reported by the feedback object. 
 
bool operator==(const QgsGeometryCheckerUtils::LayerFeature &other) const
 
const QgsCoordinateReferenceSystem mapCrs
The coordinate system in which calculations should be done. 
 
QString id() const
Returns a combination of the layerId and the feature id. 
 
QPointer< QgsVectorLayer > layerPtr() const
Gets a QPointer to the underlying layer. 
 
void setProgress(double progress)
Sets the current progress for the feedback object. 
 
const QgsCurve * interiorRing(int i) const
Retrieves an interior ring from the curve polygon. 
 
Contains a set of layers and feature ids in those layers to pass to a geometry check. 
 
bool operator!=(const QgsGeometryCheckerUtils::LayerFeature &other) const
 
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...
 
static bool pointOnLine(const QgsPoint &p, const QgsLineString *line, double tol, bool excludeExtremities=false)
 
LayerFeature(const QgsFeaturePool *pool, const QgsFeature &feature, const QgsGeometryCheckContext *context, bool useMapCrs)
Create a new layer/feature combination. 
 
Base class for feedback objects to be used for cancelation of something running in a worker thread...
 
Base configuration for geometry checks. 
 
int numInteriorRings() const
Returns the number of interior rings contained with the curve polygon. 
 
iterator(const QStringList::const_iterator &layerIt, const LayerFeatures *parent)
Creates a new iterator. 
 
static double sharedEdgeLength(const QgsAbstractGeometry *geom1, const QgsAbstractGeometry *geom2, double tol)
 
QPointer< QgsVectorLayer > layer() const
The layer. 
 
Utility class for identifying a unique vertex within a geometry. 
 
An iterator over all features in a QgsGeometryCheckerUtils::LayerFeatures. 
 
bool operator!=(const iterator &other)
 
iterator end() const
One after the last feature to stop iterating. 
 
A layer feature combination to uniquely identify and access a feature in a set of layers...
 
int vertexCount(int part=0, int ring=0) const override
Returns the number of vertices of which this geometry is built. 
 
const QgsFeature & feature() const
Returns the feature. 
 
static QList< QgsPoint > lineIntersections(const QgsLineString *line1, const QgsLineString *line2, double tol)
 
virtual int ringCount(int part=0) const =0
Returns the number of rings of which this geometry is built. 
 
Abstract base class for all geometries. 
 
QgsPoint vertexAt(QgsVertexId id) const override
Returns the point corresponding to a specified vertex id. 
 
Point geometry type, with support for z-dimension and m-values. 
 
A class to represent a vector. 
 
QString layerId() const
The layer id. 
 
static void filter1DTypes(QgsAbstractGeometry *geom)
 
static double sqrDistance2D(const QgsPoint &pt1, const QgsPoint &pt2)
Returns the squared 2D distance between two points. 
 
bool useMapCrs() const
Returns if the geometry is reprojected to the map CRS or not. 
 
A feature pool is based on a vector layer and caches features. 
 
LayerFeatures(const QMap< QString, QgsFeaturePool *> &featurePools, const QMap< QString, QgsFeatureIds > &featureIds, const QList< QgsWkbTypes::GeometryType > &geometryTypes, QgsFeedback *feedback, const QgsGeometryCheckContext *context, bool useMapCrs=false)
Creates a new set of layer and 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. 
 
const QgsAbstractGeometry * geometryN(int n) const
Returns a const reference to a geometry from within the collection. 
 
const iterator & operator++()
Increments the item the iterator currently points to by one and returns the new iterator. 
 
static QList< const QgsLineString * > polygonRings(const QgsPolygon *polygon)
 
const QgsCoordinateTransformContext transformContext
The coordinate transform context with which transformations will be done. 
 
QgsCoordinateReferenceSystem crs() const
The coordinate reference system of this layer. 
 
Custom exception class for Coordinate Reference System related exceptions. 
 
iterator begin() const
The first feature to start iterating. 
 
const QgsGeometryCheckerUtils::LayerFeature & operator*() const
Dereferences the item at the current iterator location. 
 
static std::unique_ptr< QgsGeometryEngine > createGeomEngine(const QgsAbstractGeometry *geometry, double tolerance)
 
const QgsCurve * exteriorRing() const
Returns the curve polygon's exterior ring. 
 
virtual QgsPoint vertexAt(QgsVertexId id) const =0
Returns the point corresponding to a specified vertex id. 
 
QgsWkbTypes::GeometryType geometryType() const
The geometry type of this layer. 
 
Defines a QGIS exception class. 
 
virtual int partCount() const =0
Returns count of parts contained in the geometry. 
 
double pointLineDist(const QgsPoint &p1, const QgsPoint &p2, const QgsPoint &q)
 
const QgsGeometry & geometry() const
Returns the geometry of this feature. 
 
QString layerId() const
The layer id of the layer. 
 
bool isValid() const
Returns whether this CRS is correctly initialized and usable.