Skip to content
Permalink
Browse files

[processing] Better error when 'Convex hull' algorithm is run on

single point feature layer

Which hints to users to use the 'Minimum bounding geometry' algorithm
instead.

Fixes #19348

(cherry-picked from f6ab5f9)
  • Loading branch information
nyalldawson committed Jul 7, 2018
1 parent 9e63678 commit c473ac004e11faba4b113eac97cd35fbe684920b
Showing with 13 additions and 4 deletions.
  1. +13 −4 src/analysis/processing/qgsalgorithmconvexhull.cpp
@@ -74,10 +74,19 @@ QgsFeatureList QgsConvexHullAlgorithm::processFeature( const QgsFeature &feature
QgsFeature f = feature;
if ( f.hasGeometry() )
{
QgsGeometry outputGeometry = f.geometry().convexHull();
if ( !outputGeometry )
feedback->reportError( outputGeometry.lastError() );
f.setGeometry( outputGeometry );
QgsGeometry outputGeometry;
if ( QgsWkbTypes::flatType( f.geometry().wkbType() ) == QgsWkbTypes::Point )
{
feedback->reportError( QObject::tr( "Cannot calculate convex hull for a single Point feature (try 'Minimum bounding geometry' algorithm instead)." ) );
f.clearGeometry();
}
else
{
outputGeometry = f.geometry().convexHull();
if ( !outputGeometry )
feedback->reportError( outputGeometry.lastError() );
f.setGeometry( outputGeometry );
}
if ( outputGeometry )
{
QgsAttributes attrs = f.attributes();

0 comments on commit c473ac0

Please sign in to comment.
You can’t perform that action at this time.