Skip to content

Commit 583b602

Browse files
committedDec 3, 2018
[processing] Fix hasGeometry() method when output is a geometry-less vector table
From the dox for QgsProcessing.TypeVector: "When used for a sink this indicates the sink has no geometry.". If an algorithm is using this value to indicate "maybe has geometry" for an output, then that algorithm is incorrect and should be using TypeVectorAnyGeometry instead.
1 parent e1b3524 commit 583b602

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎src/core/processing/qgsprocessingparameters.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3754,11 +3754,11 @@ bool QgsProcessingParameterFeatureSink::hasGeometry() const
37543754
case QgsProcessing::TypeVectorPoint:
37553755
case QgsProcessing::TypeVectorLine:
37563756
case QgsProcessing::TypeVectorPolygon:
3757-
case QgsProcessing::TypeVector:
37583757
return true;
37593758

37603759
case QgsProcessing::TypeRaster:
37613760
case QgsProcessing::TypeFile:
3761+
case QgsProcessing::TypeVector:
37623762
return false;
37633763
}
37643764
return true;
@@ -4314,11 +4314,11 @@ bool QgsProcessingParameterVectorDestination::hasGeometry() const
43144314
case QgsProcessing::TypeVectorPoint:
43154315
case QgsProcessing::TypeVectorLine:
43164316
case QgsProcessing::TypeVectorPolygon:
4317-
case QgsProcessing::TypeVector:
43184317
return true;
43194318

43204319
case QgsProcessing::TypeRaster:
43214320
case QgsProcessing::TypeFile:
4321+
case QgsProcessing::TypeVector:
43224322
return false;
43234323
}
43244324
return true;

‎tests/src/analysis/testqgsprocessing.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4665,7 +4665,7 @@ void TestQgsProcessing::parameterFeatureSink()
46654665
QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVectorPolygon ).hasGeometry() );
46664666
QVERIFY( !QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeRaster ).hasGeometry() );
46674667
QVERIFY( !QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeFile ).hasGeometry() );
4668-
QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVector ).hasGeometry() );
4668+
QVERIFY( !QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVector ).hasGeometry() );
46694669

46704670
// invalidSinkError
46714671
QVariantMap params;
@@ -4783,7 +4783,7 @@ void TestQgsProcessing::parameterVectorOut()
47834783
QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVectorPolygon ).hasGeometry() );
47844784
QVERIFY( !QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeRaster ).hasGeometry() );
47854785
QVERIFY( !QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeFile ).hasGeometry() );
4786-
QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVector ).hasGeometry() );
4786+
QVERIFY( !QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVector ).hasGeometry() );
47874787

47884788
// test layers to load on completion
47894789
def.reset( new QgsProcessingParameterVectorDestination( "x", QStringLiteral( "desc" ), QgsProcessing::TypeVectorAnyGeometry, QString(), true ) );

0 commit comments

Comments
 (0)
Please sign in to comment.