diff --git a/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_geos.gml b/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_geos.gml
deleted file mode 100644
index 70d0ea51626a..000000000000
--- a/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_geos.gml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- -5 03 8
-
-
-
- -5 03 8
- -5 0 -1 0 1 1 2 2 3 3 2 5 -1 8 -1 7 1 4 -5 0
-
-
-
diff --git a/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_geos.xsd b/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_geos.xsd
deleted file mode 100644
index d1c4e19f5cca..000000000000
--- a/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_geos.xsd
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_qgis.gml b/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_qgis.gml
deleted file mode 100644
index 483f2353a34b..000000000000
--- a/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_qgis.gml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- 1 23 5
-
-
-
- 1 23 5
- 2 2 3 3 2 5 1 4 2 2
-
-
-
diff --git a/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_qgis.xsd b/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_qgis.xsd
deleted file mode 100644
index 037808e0bb9a..000000000000
--- a/python/plugins/processing/tests/testdata/expected/concave_hull_points_03_qgis.xsd
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_geos.gml b/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_geos.gml
deleted file mode 100644
index 868cb02e392f..000000000000
--- a/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_geos.gml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- -5 03 8
-
-
-
- -5 03 8
- -5 0 -1 0 1 1 2 2 3 3 2 5 -1 8 -1 7 1 4 -5 0
-
-
-
diff --git a/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_geos.xsd b/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_geos.xsd
deleted file mode 100644
index b94b03f2d93c..000000000000
--- a/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_geos.xsd
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_qgis.gml b/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_qgis.gml
deleted file mode 100644
index 6990a79a11b4..000000000000
--- a/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_qgis.gml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
- -1 03 8
-
-
-
- -1 03 8
- 1 1 2 2 3 3 2 5 -1 8 -1 7 1 4 -1 0 1 1
-
-
-
diff --git a/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_qgis.xsd b/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_qgis.xsd
deleted file mode 100644
index 8e295bd30072..000000000000
--- a/python/plugins/processing/tests/testdata/expected/concave_hull_points_07_qgis.xsd
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
- 0
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/python/plugins/processing/tests/testdata/qgis_algorithm_tests4.yaml b/python/plugins/processing/tests/testdata/qgis_algorithm_tests4.yaml
index e7e3c0b48e70..6615fe3732fd 100644
--- a/python/plugins/processing/tests/testdata/qgis_algorithm_tests4.yaml
+++ b/python/plugins/processing/tests/testdata/qgis_algorithm_tests4.yaml
@@ -268,40 +268,6 @@ tests:
cast: str
fid: skip
- - algorithm: native:concavehull
- name: Concave Hull - Points (0.3) (GEOS <= 3.10)
- condition:
- geos:
- less_than: 31100
- params:
- ALPHA: 0.3
- HOLES: true
- INPUT:
- name: points.gml
- type: vector
- NO_MULTIGEOMETRY: false
- results:
- OUTPUT:
- name: expected/concave_hull_points_03_qgis.gml
- type: vector
-
- - algorithm: native:concavehull
- name: Concave Hull - Points (0.7) (GEOS <= 3.10)
- condition:
- geos:
- less_than: 31100
- params:
- ALPHA: 0.7
- HOLES: true
- INPUT:
- name: points.gml
- type: vector
- NO_MULTIGEOMETRY: false
- results:
- OUTPUT:
- name: expected/concave_hull_points_07_qgis.gml
- type: vector
-
- algorithm: native:concavehull
name: Concave Hull - Points (0.3) (GEOS > 3.11)
condition:
@@ -316,16 +282,16 @@ tests:
NO_MULTIGEOMETRY: false
results:
OUTPUT:
- name: expected/concave_hull_points_03_geos.gml
+ name: expected/concave_hull_points_03.gml
type: vector
- algorithm: native:concavehull
- name: Concave Hull - Points (0.7) (GEOS > 3.11)
+ name: Concave Hull - Points (0.9) (GEOS > 3.11)
condition:
geos:
at_least: 31100
params:
- ALPHA: 0.7
+ ALPHA: 0.9
HOLES: true
INPUT:
name: points.gml
@@ -333,7 +299,7 @@ tests:
NO_MULTIGEOMETRY: false
results:
OUTPUT:
- name: expected/concave_hull_points_07_geos.gml
+ name: expected/concave_hull_points_09.gml
type: vector
- algorithm: qgis:knearestconcavehull
diff --git a/src/analysis/processing/qgsalgorithmconcavehull.cpp b/src/analysis/processing/qgsalgorithmconcavehull.cpp
index ff06667f7191..386126665646 100644
--- a/src/analysis/processing/qgsalgorithmconcavehull.cpp
+++ b/src/analysis/processing/qgsalgorithmconcavehull.cpp
@@ -76,6 +76,8 @@ bool QgsConcaveHullAlgorithm::prepareAlgorithm( const QVariantMap ¶meters, Q
if ( mSource->featureCount() < 3 )
throw QgsProcessingException( QObject::tr( "Input layer should contain at least 3 points." ) );
+ mStep = mSource->featureCount() > 0 ? 50.0 / mSource->featureCount() : 1;
+
mPercentage = parameterAsDouble( parameters, QStringLiteral( "ALPHA" ), context );
mAllowHoles = parameterAsBool( parameters, QStringLiteral( "HOLES" ), context );
mSplitMultipart = parameterAsBool( parameters, QStringLiteral( "NO_MULTIGEOMETRY" ), context );
@@ -104,7 +106,6 @@ QVariantMap QgsConcaveHullAlgorithm::processAlgorithm( const QVariantMap ¶me
void QgsConcaveHullAlgorithm::concaveHullGeos( std::unique_ptr< QgsFeatureSink > &sink, const QVariantMap ¶meters, QgsProcessingFeedback *feedback )
{
long long i = 0;
- double step = mSource->featureCount() > 0 ? 50.0 / mSource->featureCount() : 1;
QgsFeatureIterator it = mSource->getFeatures( QgsFeatureRequest().setNoAttributes(), QgsProcessingFeatureSource::FlagSkipGeometryValidityChecks );
QgsFeature f;
@@ -115,7 +116,7 @@ void QgsConcaveHullAlgorithm::concaveHullGeos( std::unique_ptr< QgsFeatureSink >
if ( feedback->isCanceled() )
return;
- feedback->setProgress( i * step );
+ feedback->setProgress( i * mStep );
if ( !f.hasGeometry() )
continue;
@@ -139,7 +140,7 @@ void QgsConcaveHullAlgorithm::concaveHullGeos( std::unique_ptr< QgsFeatureSink >
if ( mSplitMultipart && concaveHull.isMultipart() )
{
QVector< QgsGeometry > collection = concaveHull.asGeometryCollection();
- step = collection.length() > 0 ? 50.0 / collection.length() : 1;
+ mStep = collection.length() > 0 ? 50.0 / collection.length() : 1;
for ( int i = 0; i < collection.length(); i++ )
{
if ( feedback->isCanceled() )
@@ -157,7 +158,7 @@ void QgsConcaveHullAlgorithm::concaveHullGeos( std::unique_ptr< QgsFeatureSink >
if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
throw QgsProcessingException( writeFeatureError( sink.get(), parameters, QStringLiteral( "OUTPUT" ) ) );
- feedback->setProgress( 50 + i * step );
+ feedback->setProgress( 50 + i * mStep );
}
}
else
@@ -194,8 +195,7 @@ void QgsConcaveHullAlgorithm::concaveHullQgis( std::unique_ptr< QgsFeatureSink >
}
std::unique_ptr< QgsProcessingAlgorithm > algorithm;
algorithm.reset( delaunayAlg->create() );
- algorithm->prepare( params, context, &multiStepFeedback );
- QVariantMap results = algorithm->runPrepared( params, context, &multiStepFeedback );
+ QVariantMap results = algorithm->run( params, context, &multiStepFeedback );
QgsVectorLayer *layer = qobject_cast( QgsProcessingUtils::mapLayerFromString( results["OUTPUT"].toString(), context ) );
if ( !layer )
@@ -271,8 +271,7 @@ void QgsConcaveHullAlgorithm::concaveHullQgis( std::unique_ptr< QgsFeatureSink >
feedback->reportError( QObject::tr( "Failed to compute concave hull: Dissolve algorithm not found!" ), true );
}
algorithm.reset( dissolveAlg->create() );
- algorithm->prepare( params, context, &multiStepFeedback );
- results = algorithm->runPrepared( params, context, &multiStepFeedback );
+ results = algorithm->run( params, context, &multiStepFeedback );
layer = qobject_cast( QgsProcessingUtils::mapLayerFromString( results["OUTPUT"].toString(), context ) );
if ( !layer )
{
diff --git a/src/analysis/processing/qgsalgorithmconcavehull.h b/src/analysis/processing/qgsalgorithmconcavehull.h
index ba414c595c52..0a8b57bbcada 100644
--- a/src/analysis/processing/qgsalgorithmconcavehull.h
+++ b/src/analysis/processing/qgsalgorithmconcavehull.h
@@ -59,6 +59,7 @@ class QgsConcaveHullAlgorithm : public QgsProcessingAlgorithm
double mPercentage;
bool mAllowHoles;
bool mSplitMultipart;
+ double mStep;
};
///@endcond PRIVATE