Skip to content

Commit

Permalink
Export pointOnSurface instead of centroid for gaps, overlaps and area
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros authored and nyalldawson committed Oct 6, 2021
1 parent da5c657 commit e4b0c0f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Expand Up @@ -35,7 +35,8 @@ void QgsGeometryAreaCheck::collectErrors( const QMap<QString, QgsFeaturePool *>
const QgsAbstractGeometry *part = QgsGeometryCheckerUtils::getGeomPart( geom, iPart );
if ( checkThreshold( layerToMapUnits, part, value ) )
{
errors.append( new QgsGeometryCheckError( this, layerFeature, part->centroid(), QgsVertexId( iPart ), value * layerToMapUnits * layerToMapUnits, QgsGeometryCheckError::ValueArea ) );
QgsGeometry partGeometry = QgsGeometry( part->clone() );
errors.append( new QgsGeometryCheckError( this, layerFeature, partGeometry.pointOnSurface().asPoint(), QgsVertexId( iPart ), value * layerToMapUnits * layerToMapUnits, QgsGeometryCheckError::ValueArea ) );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/vector/geometry_checker/qgsgeometrygapcheck.h
Expand Up @@ -45,7 +45,7 @@ class ANALYSIS_EXPORT QgsGeometryGapCheckError : public QgsGeometryCheckError
double area,
const QgsRectangle &gapAreaBBox,
const QgsRectangle &contextArea )
: QgsGeometryCheckError( check, layerId, FID_NULL, geometry, geometry.constGet()->centroid(), QgsVertexId(), area, ValueArea )
: QgsGeometryCheckError( check, layerId, FID_NULL, geometry, geometry.pointOnSurface().asPoint(), QgsVertexId(), area, ValueArea )
, mNeighbors( neighbors )
, mGapAreaBBox( gapAreaBBox )
, mContextBoundingBox( contextArea )
Expand Down
Expand Up @@ -79,7 +79,8 @@ void QgsGeometryOverlapCheck::collectErrors( const QMap<QString, QgsFeaturePool
const double area = interPart->area();
if ( area > mContext->reducedTolerance && ( area < mOverlapThresholdMapUnits || mOverlapThresholdMapUnits == 0.0 ) )
{
errors.append( new QgsGeometryOverlapCheckError( this, layerFeatureA, QgsGeometry( interPart->clone() ), interPart->centroid(), area, layerFeatureB ) );
QgsGeometry interPartGeometry = QgsGeometry( interPart->clone() );
errors.append( new QgsGeometryOverlapCheckError( this, layerFeatureA, interPartGeometry, interPartGeometry.pointOnSurface().asPoint(), area, layerFeatureB ) );
}
}
}
Expand Down

0 comments on commit e4b0c0f

Please sign in to comment.