Rename some enum values for clarity

This commit is contained in:
Nyall Dawson 2017-08-19 02:46:22 +10:00
parent 076fdc9449
commit ebda2fd212
23 changed files with 127 additions and 127 deletions

View File

@ -26,16 +26,16 @@ class QgsProcessing
%End %End
public: public:
enum LayerType enum SourceType
{ {
TypeAny, TypeMapLayer,
TypeVectorAny, TypeVectorAnyGeometry,
TypeVectorPoint, TypeVectorPoint,
TypeVectorLine, TypeVectorLine,
TypeVectorPolygon, TypeVectorPolygon,
TypeRaster, TypeRaster,
TypeFile, TypeFile,
TypeTable, TypeVector,
}; };

View File

@ -760,11 +760,11 @@ class QgsProcessingFeatureBasedAlgorithm : QgsProcessingAlgorithm
:rtype: str :rtype: str
%End %End
virtual QgsProcessing::LayerType outputLayerType() const; virtual QgsProcessing::SourceType outputLayerType() const;
%Docstring %Docstring
Returns the layer type for layers generated by this algorithm, if Returns the layer type for layers generated by this algorithm, if
this is possible to determine in advance. this is possible to determine in advance.
:rtype: QgsProcessing.LayerType :rtype: QgsProcessing.SourceType
%End %End
virtual QgsWkbTypes::Type outputWkbType( QgsWkbTypes::Type inputWkbType ) const; virtual QgsWkbTypes::Type outputWkbType( QgsWkbTypes::Type inputWkbType ) const;

View File

@ -108,7 +108,7 @@ class QgsProcessingOutputVectorLayer : QgsProcessingOutputDefinition
%End %End
public: public:
QgsProcessingOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny ); QgsProcessingOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry );
%Docstring %Docstring
Constructor for QgsProcessingOutputVectorLayer. Constructor for QgsProcessingOutputVectorLayer.
%End %End
@ -120,14 +120,14 @@ class QgsProcessingOutputVectorLayer : QgsProcessingOutputDefinition
%End %End
virtual QString type() const; virtual QString type() const;
QgsProcessing::LayerType dataType() const; QgsProcessing::SourceType dataType() const;
%Docstring %Docstring
Returns the layer type for the output layer. Returns the layer type for the output layer.
.. seealso:: setDataType() .. seealso:: setDataType()
:rtype: QgsProcessing.LayerType :rtype: QgsProcessing.SourceType
%End %End
void setDataType( QgsProcessing::LayerType type ); void setDataType( QgsProcessing::SourceType type );
%Docstring %Docstring
Sets the layer ``type`` for the output layer. Sets the layer ``type`` for the output layer.
.. seealso:: dataType() .. seealso:: dataType()

View File

@ -975,7 +975,7 @@ class QgsProcessingParameterMultipleLayers : QgsProcessingParameterDefinition
%End %End
public: public:
QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), QgsProcessing::LayerType layerType = QgsProcessing::TypeVectorAny, QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), QgsProcessing::SourceType layerType = QgsProcessing::TypeVectorAnyGeometry,
const QVariant &defaultValue = QVariant(), const QVariant &defaultValue = QVariant(),
bool optional = false ); bool optional = false );
%Docstring %Docstring
@ -997,14 +997,14 @@ class QgsProcessingParameterMultipleLayers : QgsProcessingParameterDefinition
virtual QString asScriptCode() const; virtual QString asScriptCode() const;
QgsProcessing::LayerType layerType() const; QgsProcessing::SourceType layerType() const;
%Docstring %Docstring
Returns the layer type for layers acceptable by the parameter. Returns the layer type for layers acceptable by the parameter.
.. seealso:: setLayerType() .. seealso:: setLayerType()
:rtype: QgsProcessing.LayerType :rtype: QgsProcessing.SourceType
%End %End
void setLayerType( QgsProcessing::LayerType type ); void setLayerType( QgsProcessing::SourceType type );
%Docstring %Docstring
Sets the layer ``type`` for layers acceptable by the parameter. Sets the layer ``type`` for layers acceptable by the parameter.
.. seealso:: layerType() .. seealso:: layerType()
@ -1733,7 +1733,7 @@ class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
%End %End
public: public:
QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny, const QVariant &defaultValue = QVariant(), QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
bool optional = false ); bool optional = false );
%Docstring %Docstring
Constructor for QgsProcessingParameterFeatureSink. Constructor for QgsProcessingParameterFeatureSink.
@ -1758,11 +1758,11 @@ class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
virtual QString defaultFileExtension() const; virtual QString defaultFileExtension() const;
QgsProcessing::LayerType dataType() const; QgsProcessing::SourceType dataType() const;
%Docstring %Docstring
Returns the layer type for sinks associated with the parameter. Returns the layer type for sinks associated with the parameter.
.. seealso:: setDataType() .. seealso:: setDataType()
:rtype: QgsProcessing.LayerType :rtype: QgsProcessing.SourceType
%End %End
bool hasGeometry() const; bool hasGeometry() const;
@ -1772,7 +1772,7 @@ class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
:rtype: bool :rtype: bool
%End %End
void setDataType( QgsProcessing::LayerType type ); void setDataType( QgsProcessing::SourceType type );
%Docstring %Docstring
Sets the layer ``type`` for the sinks associated with the parameter. Sets the layer ``type`` for the sinks associated with the parameter.
.. seealso:: dataType() .. seealso:: dataType()
@ -1812,7 +1812,7 @@ class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParamete
%End %End
public: public:
QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny, const QVariant &defaultValue = QVariant(), QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
bool optional = false ); bool optional = false );
%Docstring %Docstring
Constructor for QgsProcessingParameterVectorDestination. Constructor for QgsProcessingParameterVectorDestination.
@ -1837,11 +1837,11 @@ class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParamete
virtual QString defaultFileExtension() const; virtual QString defaultFileExtension() const;
QgsProcessing::LayerType dataType() const; QgsProcessing::SourceType dataType() const;
%Docstring %Docstring
Returns the layer type for this created vector layer. Returns the layer type for this created vector layer.
.. seealso:: setDataType() .. seealso:: setDataType()
:rtype: QgsProcessing.LayerType :rtype: QgsProcessing.SourceType
%End %End
bool hasGeometry() const; bool hasGeometry() const;
@ -1851,7 +1851,7 @@ class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParamete
:rtype: bool :rtype: bool
%End %End
void setDataType( QgsProcessing::LayerType type ); void setDataType( QgsProcessing::SourceType type );
%Docstring %Docstring
Sets the layer ``type`` for the created vector layer. Sets the layer ``type`` for the created vector layer.
.. seealso:: dataType() .. seealso:: dataType()

View File

@ -81,13 +81,13 @@ class CheckValidity(QgisAlgorithm):
self.addParameter(QgsProcessingParameterEnum(self.METHOD, self.addParameter(QgsProcessingParameterEnum(self.METHOD,
self.tr('Method'), self.methods)) self.tr('Method'), self.methods))
self.addParameter(QgsProcessingParameterFeatureSink(self.VALID_OUTPUT, self.tr('Valid output'), QgsProcessing.TypeVectorAny, '', True)) self.addParameter(QgsProcessingParameterFeatureSink(self.VALID_OUTPUT, self.tr('Valid output'), QgsProcessing.TypeVectorAnyGeometry, '', True))
self.addOutput(QgsProcessingOutputNumber(self.VALID_COUNT, self.tr('Count of valid features'))) self.addOutput(QgsProcessingOutputNumber(self.VALID_COUNT, self.tr('Count of valid features')))
self.addParameter(QgsProcessingParameterFeatureSink(self.INVALID_OUTPUT, self.tr('Invalid output'), QgsProcessing.TypeVectorAny, '', True)) self.addParameter(QgsProcessingParameterFeatureSink(self.INVALID_OUTPUT, self.tr('Invalid output'), QgsProcessing.TypeVectorAnyGeometry, '', True))
self.addOutput(QgsProcessingOutputNumber(self.INVALID_COUNT, self.tr('Count of invalid features'))) self.addOutput(QgsProcessingOutputNumber(self.INVALID_COUNT, self.tr('Count of invalid features')))
self.addParameter(QgsProcessingParameterFeatureSink(self.ERROR_OUTPUT, self.tr('Error output'), QgsProcessing.TypeVectorAny, '', True)) self.addParameter(QgsProcessingParameterFeatureSink(self.ERROR_OUTPUT, self.tr('Error output'), QgsProcessing.TypeVectorAnyGeometry, '', True))
self.addOutput(QgsProcessingOutputNumber(self.ERROR_COUNT, self.tr('Count of errors'))) self.addOutput(QgsProcessingOutputNumber(self.ERROR_COUNT, self.tr('Count of errors')))
def name(self): def name(self):

View File

@ -56,7 +56,7 @@ class Datasources2Vrt(QgisAlgorithm):
def initAlgorithm(self, config=None): def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterMultipleLayers(self.INPUT, self.addParameter(QgsProcessingParameterMultipleLayers(self.INPUT,
self.tr('Input datasources'), self.tr('Input datasources'),
QgsProcessing.TypeTable)) QgsProcessing.TypeVector))
self.addParameter(QgsProcessingParameterBoolean(self.UNIONED, self.addParameter(QgsProcessingParameterBoolean(self.UNIONED,
self.tr('Create "unioned" VRT'), self.tr('Create "unioned" VRT'),
defaultValue=False)) defaultValue=False))

View File

@ -54,7 +54,7 @@ class ExtractSpecificNodes(QgisAlgorithm):
def initAlgorithm(self, config=None): def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT, self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer'), [QgsProcessing.TypeVectorAny])) self.tr('Input layer'), [QgsProcessing.TypeVectorAnyGeometry]))
self.addParameter(QgsProcessingParameterString(self.NODES, self.addParameter(QgsProcessingParameterString(self.NODES,
self.tr('Node indices'), defaultValue='0')) self.tr('Node indices'), defaultValue='0'))

View File

@ -60,7 +60,7 @@ class Merge(QgisAlgorithm):
def initAlgorithm(self, config=None): def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterMultipleLayers(self.LAYERS, self.addParameter(QgsProcessingParameterMultipleLayers(self.LAYERS,
self.tr('Layers to merge'), self.tr('Layers to merge'),
QgsProcessing.TypeVectorAny)) QgsProcessing.TypeVectorAnyGeometry))
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Merged'))) self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Merged')))

View File

@ -56,7 +56,7 @@ class OrientedMinimumBoundingBox(QgisAlgorithm):
def initAlgorithm(self, config=None): def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT, self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer'), [QgsProcessing.TypeVectorAny])) self.tr('Input layer'), [QgsProcessing.TypeVectorAnyGeometry]))
self.addParameter(QgsProcessingParameterBoolean(self.BY_FEATURE, self.addParameter(QgsProcessingParameterBoolean(self.BY_FEATURE,
self.tr('Calculate bounds for each feature separately'), defaultValue=True)) self.tr('Calculate bounds for each feature separately'), defaultValue=True))

View File

@ -64,7 +64,7 @@ class PointsLayerFromTable(QgisAlgorithm):
super().__init__() super().__init__()
def initAlgorithm(self, config=None): def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT, self.tr('Input layer'), types=[QgsProcessing.TypeTable])) self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT, self.tr('Input layer'), types=[QgsProcessing.TypeVector]))
self.addParameter(QgsProcessingParameterField(self.XFIELD, self.addParameter(QgsProcessingParameterField(self.XFIELD,
self.tr('X field'), parentLayerParameterName=self.INPUT, type=QgsProcessingParameterField.Any)) self.tr('X field'), parentLayerParameterName=self.INPUT, type=QgsProcessingParameterField.Any))

View File

@ -109,13 +109,13 @@ class BatchInputSelectionPanel(QWidget):
elif isinstance(self.param, QgsProcessingParameterVectorLayer): elif isinstance(self.param, QgsProcessingParameterVectorLayer):
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance()) layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance())
else: else:
datatypes = [QgsProcessing.TypeVectorAny] datatypes = [QgsProcessing.TypeVectorAnyGeometry]
if isinstance(self.param, QgsProcessingParameterFeatureSource): if isinstance(self.param, QgsProcessingParameterFeatureSource):
datatypes = self.param.dataTypes() datatypes = self.param.dataTypes()
elif isinstance(self.param, QgsProcessingParameterMultipleLayers): elif isinstance(self.param, QgsProcessingParameterMultipleLayers):
datatypes = [self.param.layerType()] datatypes = [self.param.layerType()]
if QgsProcessing.TypeVectorAny not in datatypes: if QgsProcessing.TypeVectorAnyGeometry not in datatypes:
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), datatypes) layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), datatypes)
else: else:
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance()) layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance())

View File

@ -184,7 +184,7 @@ def createTest(text):
# Handle datatype detection # Handle datatype detection
dataType = param.layerType() dataType = param.layerType()
if dataType in [QgsProcessing.TypeVectorAny, QgsProcessing.TypeVectorPoint, QgsProcessing.TypeVectorLine, QgsProcessing.TypeVectorPolygon, QgsProcessing.TypeTable]: if dataType in [QgsProcessing.TypeVectorAnyGeometry, QgsProcessing.TypeVectorPoint, QgsProcessing.TypeVectorLine, QgsProcessing.TypeVectorPolygon, QgsProcessing.TypeVector]:
dataType = 'vector' dataType = 'vector'
else: else:
dataType = 'raster' dataType = 'raster'

View File

@ -524,20 +524,20 @@ class FixedTableWidgetWrapper(WidgetWrapper):
class MultipleInputWidgetWrapper(WidgetWrapper): class MultipleInputWidgetWrapper(WidgetWrapper):
def _getOptions(self): def _getOptions(self):
if self.param.layerType() == QgsProcessing.TypeVectorAny: if self.param.layerType() == QgsProcessing.TypeVectorAnyGeometry:
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer) options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer)
elif self.param.layerType() == QgsProcessing.TypeVectorPoint: elif self.param.layerType() == QgsProcessing.TypeVectorPoint:
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer, options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
[QgsProcessing.TypeVectorPoint, QgsProcessing.TypeVectorAny]) [QgsProcessing.TypeVectorPoint, QgsProcessing.TypeVectorAnyGeometry])
elif self.param.layerType() == QgsProcessing.TypeVectorLine: elif self.param.layerType() == QgsProcessing.TypeVectorLine:
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer, options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
[QgsProcessing.TypeVectorLine, QgsProcessing.TypeVectorAny]) [QgsProcessing.TypeVectorLine, QgsProcessing.TypeVectorAnyGeometry])
elif self.param.layerType() == QgsProcessing.TypeVectorPolygon: elif self.param.layerType() == QgsProcessing.TypeVectorPolygon:
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer, options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
[QgsProcessing.TypeVectorPolygon, QgsProcessing.TypeVectorAny]) [QgsProcessing.TypeVectorPolygon, QgsProcessing.TypeVectorAnyGeometry])
elif self.param.layerType() == QgsProcessing.TypeRaster: elif self.param.layerType() == QgsProcessing.TypeRaster:
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterRasterLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputRasterLayer) options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterRasterLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputRasterLayer)
elif self.param.layerType() == QgsProcessing.TypeTable: elif self.param.layerType() == QgsProcessing.TypeVector:
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), OutputTable) options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), OutputTable)
else: else:
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFile, OutputFile) options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFile, OutputFile)
@ -551,7 +551,7 @@ class MultipleInputWidgetWrapper(WidgetWrapper):
else: else:
if self.param.layerType() == QgsProcessing.TypeRaster: if self.param.layerType() == QgsProcessing.TypeRaster:
options = QgsProcessingUtils.compatibleRasterLayers(QgsProject.instance(), False) options = QgsProcessingUtils.compatibleRasterLayers(QgsProject.instance(), False)
elif self.param.layerType() in (QgsProcessing.TypeVectorAny, QgsProcessing.TypeTable): elif self.param.layerType() in (QgsProcessing.TypeVectorAnyGeometry, QgsProcessing.TypeVector):
options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [], False) options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [], False)
else: else:
options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [self.param.layerType()], False) options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [self.param.layerType()], False)
@ -569,7 +569,7 @@ class MultipleInputWidgetWrapper(WidgetWrapper):
if self.param.layerType() != QgsProcessing.TypeFile: if self.param.layerType() != QgsProcessing.TypeFile:
if self.param.layerType() == QgsProcessing.TypeRaster: if self.param.layerType() == QgsProcessing.TypeRaster:
options = QgsProcessingUtils.compatibleRasterLayers(QgsProject.instance(), False) options = QgsProcessingUtils.compatibleRasterLayers(QgsProject.instance(), False)
elif self.param.layerType() in (QgsProcessing.TypeVectorAny, QgsProcessing.TypeTable): elif self.param.layerType() in (QgsProcessing.TypeVectorAnyGeometry, QgsProcessing.TypeVector):
options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [], False) options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [], False)
else: else:
options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [self.param.layerType()], False) options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [self.param.layerType()], False)
@ -605,7 +605,7 @@ class MultipleInputWidgetWrapper(WidgetWrapper):
else: else:
if self.param.layerType() == QgsProcessing.TypeRaster: if self.param.layerType() == QgsProcessing.TypeRaster:
options = QgsProcessingUtils.compatibleRasterLayers(QgsProject.instance(), False) options = QgsProcessingUtils.compatibleRasterLayers(QgsProject.instance(), False)
elif self.param.layerType() in (QgsProcessing.TypeVectorAny, QgsProcessing.TypeTable): elif self.param.layerType() in (QgsProcessing.TypeVectorAnyGeometry, QgsProcessing.TypeVector):
options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [], False) options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [], False)
else: else:
options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [self.param.layerType()], False) options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [self.param.layerType()], False)
@ -827,7 +827,7 @@ class VectorWidgetWrapper(WidgetWrapper):
widget.setLayout(vl) widget.setLayout(vl)
filters = QgsMapLayerProxyModel.Filters() filters = QgsMapLayerProxyModel.Filters()
if QgsProcessing.TypeVectorAny in self.param.dataTypes() or len(self.param.dataTypes()) == 0: if QgsProcessing.TypeVectorAnyGeometry in self.param.dataTypes() or len(self.param.dataTypes()) == 0:
filters = QgsMapLayerProxyModel.HasGeometry filters = QgsMapLayerProxyModel.HasGeometry
if QgsProcessing.TypeVectorPoint in self.param.dataTypes(): if QgsProcessing.TypeVectorPoint in self.param.dataTypes():
filters |= QgsMapLayerProxyModel.PointLayer filters |= QgsMapLayerProxyModel.PointLayer
@ -1107,7 +1107,7 @@ class TableWidgetWrapper(WidgetWrapper):
self.combo.setAllowEmptyLayer(True) self.combo.setAllowEmptyLayer(True)
filters = QgsMapLayerProxyModel.Filters() filters = QgsMapLayerProxyModel.Filters()
if QgsProcessing.TypeVectorAny in self.param.dataTypes() or len(self.param.dataTypes()) == 0: if QgsProcessing.TypeVectorAnyGeometry in self.param.dataTypes() or len(self.param.dataTypes()) == 0:
filters = QgsMapLayerProxyModel.VectorLayer filters = QgsMapLayerProxyModel.VectorLayer
if QgsProcessing.TypeVectorPoint in self.param.dataTypes(): if QgsProcessing.TypeVectorPoint in self.param.dataTypes():
filters |= QgsMapLayerProxyModel.PointLayer filters |= QgsMapLayerProxyModel.PointLayer

View File

@ -596,7 +596,7 @@ QgsProcessingModelChildParameterSources QgsProcessingModelAlgorithm::availableSo
bool ok = !sourceDef->dataTypes().isEmpty(); bool ok = !sourceDef->dataTypes().isEmpty();
Q_FOREACH ( int type, sourceDef->dataTypes() ) Q_FOREACH ( int type, sourceDef->dataTypes() )
{ {
if ( dataTypes.contains( type ) || type == QgsProcessing::TypeAny ) if ( dataTypes.contains( type ) || type == QgsProcessing::TypeMapLayer )
{ {
ok = true; ok = true;
break; break;
@ -636,7 +636,7 @@ QgsProcessingModelChildParameterSources QgsProcessingModelAlgorithm::availableSo
if ( out->type() == QgsProcessingOutputVectorLayer::typeName() ) if ( out->type() == QgsProcessingOutputVectorLayer::typeName() )
{ {
const QgsProcessingOutputVectorLayer *vectorOut = static_cast< const QgsProcessingOutputVectorLayer *>( out ); const QgsProcessingOutputVectorLayer *vectorOut = static_cast< const QgsProcessingOutputVectorLayer *>( out );
if ( !( dataTypes.contains( vectorOut->dataType() ) || vectorOut->dataType() == QgsProcessing::TypeAny ) ) if ( !( dataTypes.contains( vectorOut->dataType() ) || vectorOut->dataType() == QgsProcessing::TypeMapLayer ) )
{ {
continue; continue;
} }

View File

@ -708,7 +708,7 @@ void QgsExtractByExpressionAlgorithm::initAlgorithm( const QVariantMap & )
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Matching features" ) ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Matching features" ) ) );
QgsProcessingParameterFeatureSink *failOutput = new QgsProcessingParameterFeatureSink( QStringLiteral( "FAIL_OUTPUT" ), QObject::tr( "Non-matching" ), QgsProcessingParameterFeatureSink *failOutput = new QgsProcessingParameterFeatureSink( QStringLiteral( "FAIL_OUTPUT" ), QObject::tr( "Non-matching" ),
QgsProcessing::TypeVectorAny, QVariant(), true ); QgsProcessing::TypeVectorAnyGeometry, QVariant(), true );
failOutput->setCreateByDefault( false ); failOutput->setCreateByDefault( false );
addParameter( failOutput ); addParameter( failOutput );
} }
@ -837,7 +837,7 @@ void QgsExtractByAttributeAlgorithm::initAlgorithm( const QVariantMap & )
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Extracted (attribute)" ) ) ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Extracted (attribute)" ) ) );
QgsProcessingParameterFeatureSink *failOutput = new QgsProcessingParameterFeatureSink( QStringLiteral( "FAIL_OUTPUT" ), QObject::tr( "Extracted (non-matching)" ), QgsProcessingParameterFeatureSink *failOutput = new QgsProcessingParameterFeatureSink( QStringLiteral( "FAIL_OUTPUT" ), QObject::tr( "Extracted (non-matching)" ),
QgsProcessing::TypeVectorAny, QVariant(), true ); QgsProcessing::TypeVectorAnyGeometry, QVariant(), true );
failOutput->setCreateByDefault( false ); failOutput->setCreateByDefault( false );
addParameter( failOutput ); addParameter( failOutput );
} }
@ -1019,9 +1019,9 @@ void QgsRemoveNullGeometryAlgorithm::initAlgorithm( const QVariantMap & )
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) ); addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Non null geometries" ), addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Non null geometries" ),
QgsProcessing::TypeVectorAny, QVariant(), true ) ); QgsProcessing::TypeVectorAnyGeometry, QVariant(), true ) );
QgsProcessingParameterFeatureSink *nullOutput = new QgsProcessingParameterFeatureSink( QStringLiteral( "NULL_OUTPUT" ), QObject::tr( "Null geometries" ), QgsProcessingParameterFeatureSink *nullOutput = new QgsProcessingParameterFeatureSink( QStringLiteral( "NULL_OUTPUT" ), QObject::tr( "Null geometries" ),
QgsProcessing::TypeTable, QVariant(), true ); QgsProcessing::TypeVector, QVariant(), true );
nullOutput->setCreateByDefault( false ); nullOutput->setCreateByDefault( false );
addParameter( nullOutput ); addParameter( nullOutput );
} }

View File

@ -65,7 +65,7 @@ class QgsCentroidAlgorithm : public QgsProcessingFeatureBasedAlgorithm
protected: protected:
QString outputName() const override { return QObject::tr( "Centroids" ); } QString outputName() const override { return QObject::tr( "Centroids" ); }
QgsProcessing::LayerType outputLayerType() const override { return QgsProcessing::TypeVectorPoint; } QgsProcessing::SourceType outputLayerType() const override { return QgsProcessing::TypeVectorPoint; }
QgsWkbTypes::Type outputWkbType( QgsWkbTypes::Type inputWkbType ) const override { Q_UNUSED( inputWkbType ); return QgsWkbTypes::Point; } QgsWkbTypes::Type outputWkbType( QgsWkbTypes::Type inputWkbType ) const override { Q_UNUSED( inputWkbType ); return QgsWkbTypes::Point; }
QgsFeature processFeature( const QgsFeature &feature, QgsProcessingFeedback *feedback ) override; QgsFeature processFeature( const QgsFeature &feature, QgsProcessingFeedback *feedback ) override;

View File

@ -41,17 +41,17 @@ class CORE_EXPORT QgsProcessing
public: public:
//! Layer types enum //! Data source types enum
enum LayerType enum SourceType
{ {
TypeAny = -2, //!< Any layer TypeMapLayer = -2, //!< Any map layer type (raster or vector)
TypeVectorAny = -1, //!< Any vector layer with geometry TypeVectorAnyGeometry = -1, //!< Any vector layer with geometry
TypeVectorPoint = 0, //!< Vector point layers TypeVectorPoint = 0, //!< Vector point layers
TypeVectorLine = 1, //!< Vector line layers TypeVectorLine = 1, //!< Vector line layers
TypeVectorPolygon = 2, //!< Vector polygon layers TypeVectorPolygon = 2, //!< Vector polygon layers
TypeRaster = 3, //!< Raster layers TypeRaster = 3, //!< Raster layers
TypeFile = 4, //!< Files TypeFile = 4, //!< Files (i.e. non map layer sources, such as text files)
TypeTable = 5, //!< Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink has no geometry. TypeVector = 5, //!< Tables (i.e. vector layers with or without geometry). When used for a sink this indicates the sink has no geometry.
}; };

View File

@ -754,7 +754,7 @@ class CORE_EXPORT QgsProcessingFeatureBasedAlgorithm : public QgsProcessingAlgor
* Returns the layer type for layers generated by this algorithm, if * Returns the layer type for layers generated by this algorithm, if
* this is possible to determine in advance. * this is possible to determine in advance.
*/ */
virtual QgsProcessing::LayerType outputLayerType() const { return QgsProcessing::TypeVectorAny; } virtual QgsProcessing::SourceType outputLayerType() const { return QgsProcessing::TypeVectorAnyGeometry; }
/** /**
* Maps the input WKB geometry type (\a inputWkbType) to the corresponding * Maps the input WKB geometry type (\a inputWkbType) to the corresponding

View File

@ -24,17 +24,17 @@ QgsProcessingOutputDefinition::QgsProcessingOutputDefinition( const QString &nam
} }
QgsProcessingOutputVectorLayer::QgsProcessingOutputVectorLayer( const QString &name, const QString &description, QgsProcessing::LayerType type ) QgsProcessingOutputVectorLayer::QgsProcessingOutputVectorLayer( const QString &name, const QString &description, QgsProcessing::SourceType type )
: QgsProcessingOutputDefinition( name, description ) : QgsProcessingOutputDefinition( name, description )
, mDataType( type ) , mDataType( type )
{} {}
QgsProcessing::LayerType QgsProcessingOutputVectorLayer::dataType() const QgsProcessing::SourceType QgsProcessingOutputVectorLayer::dataType() const
{ {
return mDataType; return mDataType;
} }
void QgsProcessingOutputVectorLayer::setDataType( QgsProcessing::LayerType type ) void QgsProcessingOutputVectorLayer::setDataType( QgsProcessing::SourceType type )
{ {
mDataType = type; mDataType = type;
} }

View File

@ -128,7 +128,7 @@ class CORE_EXPORT QgsProcessingOutputVectorLayer : public QgsProcessingOutputDef
/** /**
* Constructor for QgsProcessingOutputVectorLayer. * Constructor for QgsProcessingOutputVectorLayer.
*/ */
QgsProcessingOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny ); QgsProcessingOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry );
/** /**
* Returns the type name for the output class. * Returns the type name for the output class.
@ -140,17 +140,17 @@ class CORE_EXPORT QgsProcessingOutputVectorLayer : public QgsProcessingOutputDef
* Returns the layer type for the output layer. * Returns the layer type for the output layer.
* \see setDataType() * \see setDataType()
*/ */
QgsProcessing::LayerType dataType() const; QgsProcessing::SourceType dataType() const;
/** /**
* Sets the layer \a type for the output layer. * Sets the layer \a type for the output layer.
* \see dataType() * \see dataType()
*/ */
void setDataType( QgsProcessing::LayerType type ); void setDataType( QgsProcessing::SourceType type );
private: private:
QgsProcessing::LayerType mDataType = QgsProcessing::TypeVectorAny; QgsProcessing::SourceType mDataType = QgsProcessing::TypeVectorAnyGeometry;
}; };
/** /**

View File

@ -1424,7 +1424,7 @@ QgsProcessingParameterMatrix *QgsProcessingParameterMatrix::fromScriptCode( cons
return new QgsProcessingParameterMatrix( name, description, 0, false, QStringList(), definition.isEmpty() ? QVariant() : definition, isOptional ); return new QgsProcessingParameterMatrix( name, description, 0, false, QStringList(), definition.isEmpty() ? QVariant() : definition, isOptional );
} }
QgsProcessingParameterMultipleLayers::QgsProcessingParameterMultipleLayers( const QString &name, const QString &description, QgsProcessing::LayerType layerType, const QVariant &defaultValue, bool optional ) QgsProcessingParameterMultipleLayers::QgsProcessingParameterMultipleLayers( const QString &name, const QString &description, QgsProcessing::SourceType layerType, const QVariant &defaultValue, bool optional )
: QgsProcessingParameterDefinition( name, description, defaultValue, optional ) : QgsProcessingParameterDefinition( name, description, defaultValue, optional )
, mLayerType( layerType ) , mLayerType( layerType )
{ {
@ -1562,12 +1562,12 @@ QString QgsProcessingParameterMultipleLayers::asScriptCode() const
return code.trimmed(); return code.trimmed();
} }
QgsProcessing::LayerType QgsProcessingParameterMultipleLayers::layerType() const QgsProcessing::SourceType QgsProcessingParameterMultipleLayers::layerType() const
{ {
return mLayerType; return mLayerType;
} }
void QgsProcessingParameterMultipleLayers::setLayerType( QgsProcessing::LayerType type ) void QgsProcessingParameterMultipleLayers::setLayerType( QgsProcessing::SourceType type )
{ {
mLayerType = type; mLayerType = type;
} }
@ -1594,7 +1594,7 @@ QVariantMap QgsProcessingParameterMultipleLayers::toVariantMap() const
bool QgsProcessingParameterMultipleLayers::fromVariantMap( const QVariantMap &map ) bool QgsProcessingParameterMultipleLayers::fromVariantMap( const QVariantMap &map )
{ {
QgsProcessingParameterDefinition::fromVariantMap( map ); QgsProcessingParameterDefinition::fromVariantMap( map );
mLayerType = static_cast< QgsProcessing::LayerType >( map.value( QStringLiteral( "layer_type" ) ).toInt() ); mLayerType = static_cast< QgsProcessing::SourceType >( map.value( QStringLiteral( "layer_type" ) ).toInt() );
mMinimumNumberInputs = map.value( QStringLiteral( "min_inputs" ) ).toInt(); mMinimumNumberInputs = map.value( QStringLiteral( "min_inputs" ) ).toInt();
return true; return true;
} }
@ -1610,9 +1610,9 @@ QgsProcessingParameterMultipleLayers *QgsProcessingParameterMultipleLayers::from
type = m.captured( 1 ).toLower().trimmed(); type = m.captured( 1 ).toLower().trimmed();
defaultVal = m.captured( 2 ); defaultVal = m.captured( 2 );
} }
QgsProcessing::LayerType layerType = QgsProcessing::TypeVectorAny; QgsProcessing::SourceType layerType = QgsProcessing::TypeVectorAnyGeometry;
if ( type == QStringLiteral( "vector" ) ) if ( type == QStringLiteral( "vector" ) )
layerType = QgsProcessing::TypeVectorAny; layerType = QgsProcessing::TypeVectorAnyGeometry;
else if ( type == QStringLiteral( "raster" ) ) else if ( type == QStringLiteral( "raster" ) )
layerType = QgsProcessing::TypeRaster; layerType = QgsProcessing::TypeRaster;
else if ( type == QStringLiteral( "file" ) ) else if ( type == QStringLiteral( "file" ) )
@ -2663,7 +2663,7 @@ QgsProcessingParameterFeatureSource *QgsProcessingParameterFeatureSource::fromSc
return new QgsProcessingParameterFeatureSource( name, description, types, def, isOptional ); return new QgsProcessingParameterFeatureSource( name, description, types, def, isOptional );
} }
QgsProcessingParameterFeatureSink::QgsProcessingParameterFeatureSink( const QString &name, const QString &description, QgsProcessing::LayerType type, const QVariant &defaultValue, bool optional ) QgsProcessingParameterFeatureSink::QgsProcessingParameterFeatureSink( const QString &name, const QString &description, QgsProcessing::SourceType type, const QVariant &defaultValue, bool optional )
: QgsProcessingDestinationParameter( name, description, defaultValue, optional ) : QgsProcessingDestinationParameter( name, description, defaultValue, optional )
, mDataType( type ) , mDataType( type )
{ {
@ -2743,7 +2743,7 @@ QString QgsProcessingParameterFeatureSink::asScriptCode() const
code += QStringLiteral( "polygon " ); code += QStringLiteral( "polygon " );
break; break;
case QgsProcessing::TypeTable: case QgsProcessing::TypeVector:
code += QStringLiteral( "table " ); code += QStringLiteral( "table " );
break; break;
@ -2773,7 +2773,7 @@ QString QgsProcessingParameterFeatureSink::defaultFileExtension() const
} }
} }
QgsProcessing::LayerType QgsProcessingParameterFeatureSink::dataType() const QgsProcessing::SourceType QgsProcessingParameterFeatureSink::dataType() const
{ {
return mDataType; return mDataType;
} }
@ -2782,12 +2782,12 @@ bool QgsProcessingParameterFeatureSink::hasGeometry() const
{ {
switch ( mDataType ) switch ( mDataType )
{ {
case QgsProcessing::TypeAny: case QgsProcessing::TypeMapLayer:
case QgsProcessing::TypeVectorAny: case QgsProcessing::TypeVectorAnyGeometry:
case QgsProcessing::TypeVectorPoint: case QgsProcessing::TypeVectorPoint:
case QgsProcessing::TypeVectorLine: case QgsProcessing::TypeVectorLine:
case QgsProcessing::TypeVectorPolygon: case QgsProcessing::TypeVectorPolygon:
case QgsProcessing::TypeTable: case QgsProcessing::TypeVector:
return true; return true;
case QgsProcessing::TypeRaster: case QgsProcessing::TypeRaster:
@ -2797,7 +2797,7 @@ bool QgsProcessingParameterFeatureSink::hasGeometry() const
return true; return true;
} }
void QgsProcessingParameterFeatureSink::setDataType( QgsProcessing::LayerType type ) void QgsProcessingParameterFeatureSink::setDataType( QgsProcessing::SourceType type )
{ {
mDataType = type; mDataType = type;
} }
@ -2812,7 +2812,7 @@ QVariantMap QgsProcessingParameterFeatureSink::toVariantMap() const
bool QgsProcessingParameterFeatureSink::fromVariantMap( const QVariantMap &map ) bool QgsProcessingParameterFeatureSink::fromVariantMap( const QVariantMap &map )
{ {
QgsProcessingDestinationParameter::fromVariantMap( map ); QgsProcessingDestinationParameter::fromVariantMap( map );
mDataType = static_cast< QgsProcessing::LayerType >( map.value( QStringLiteral( "data_type" ) ).toInt() ); mDataType = static_cast< QgsProcessing::SourceType >( map.value( QStringLiteral( "data_type" ) ).toInt() );
return true; return true;
} }
@ -2826,7 +2826,7 @@ QString QgsProcessingParameterFeatureSink::generateTemporaryDestination() const
QgsProcessingParameterFeatureSink *QgsProcessingParameterFeatureSink::fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) QgsProcessingParameterFeatureSink *QgsProcessingParameterFeatureSink::fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition )
{ {
QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny; QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry;
QString def = definition; QString def = definition;
if ( def.startsWith( QStringLiteral( "point" ), Qt::CaseInsensitive ) ) if ( def.startsWith( QStringLiteral( "point" ), Qt::CaseInsensitive ) )
{ {
@ -2845,7 +2845,7 @@ QgsProcessingParameterFeatureSink *QgsProcessingParameterFeatureSink::fromScript
} }
else if ( def.startsWith( QStringLiteral( "table" ), Qt::CaseInsensitive ) ) else if ( def.startsWith( QStringLiteral( "table" ), Qt::CaseInsensitive ) )
{ {
type = QgsProcessing::TypeTable; type = QgsProcessing::TypeVector;
def = def.mid( 6 ); def = def.mid( 6 );
} }
@ -3116,7 +3116,7 @@ void QgsProcessingDestinationParameter::setCreateByDefault( bool createByDefault
mCreateByDefault = createByDefault; mCreateByDefault = createByDefault;
} }
QgsProcessingParameterVectorDestination::QgsProcessingParameterVectorDestination( const QString &name, const QString &description, QgsProcessing::LayerType type, const QVariant &defaultValue, bool optional ) QgsProcessingParameterVectorDestination::QgsProcessingParameterVectorDestination( const QString &name, const QString &description, QgsProcessing::SourceType type, const QVariant &defaultValue, bool optional )
: QgsProcessingDestinationParameter( name, description, defaultValue, optional ) : QgsProcessingDestinationParameter( name, description, defaultValue, optional )
, mDataType( type ) , mDataType( type )
{ {
@ -3222,7 +3222,7 @@ QString QgsProcessingParameterVectorDestination::defaultFileExtension() const
} }
} }
QgsProcessing::LayerType QgsProcessingParameterVectorDestination::dataType() const QgsProcessing::SourceType QgsProcessingParameterVectorDestination::dataType() const
{ {
return mDataType; return mDataType;
} }
@ -3231,12 +3231,12 @@ bool QgsProcessingParameterVectorDestination::hasGeometry() const
{ {
switch ( mDataType ) switch ( mDataType )
{ {
case QgsProcessing::TypeAny: case QgsProcessing::TypeMapLayer:
case QgsProcessing::TypeVectorAny: case QgsProcessing::TypeVectorAnyGeometry:
case QgsProcessing::TypeVectorPoint: case QgsProcessing::TypeVectorPoint:
case QgsProcessing::TypeVectorLine: case QgsProcessing::TypeVectorLine:
case QgsProcessing::TypeVectorPolygon: case QgsProcessing::TypeVectorPolygon:
case QgsProcessing::TypeTable: case QgsProcessing::TypeVector:
return true; return true;
case QgsProcessing::TypeRaster: case QgsProcessing::TypeRaster:
@ -3246,7 +3246,7 @@ bool QgsProcessingParameterVectorDestination::hasGeometry() const
return true; return true;
} }
void QgsProcessingParameterVectorDestination::setDataType( QgsProcessing::LayerType type ) void QgsProcessingParameterVectorDestination::setDataType( QgsProcessing::SourceType type )
{ {
mDataType = type; mDataType = type;
} }
@ -3261,13 +3261,13 @@ QVariantMap QgsProcessingParameterVectorDestination::toVariantMap() const
bool QgsProcessingParameterVectorDestination::fromVariantMap( const QVariantMap &map ) bool QgsProcessingParameterVectorDestination::fromVariantMap( const QVariantMap &map )
{ {
QgsProcessingDestinationParameter::fromVariantMap( map ); QgsProcessingDestinationParameter::fromVariantMap( map );
mDataType = static_cast< QgsProcessing::LayerType >( map.value( QStringLiteral( "data_type" ) ).toInt() ); mDataType = static_cast< QgsProcessing::SourceType >( map.value( QStringLiteral( "data_type" ) ).toInt() );
return true; return true;
} }
QgsProcessingParameterVectorDestination *QgsProcessingParameterVectorDestination::fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition ) QgsProcessingParameterVectorDestination *QgsProcessingParameterVectorDestination::fromScriptCode( const QString &name, const QString &description, bool isOptional, const QString &definition )
{ {
QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny; QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry;
QString def = definition; QString def = definition;
if ( def.startsWith( QStringLiteral( "point" ), Qt::CaseInsensitive ) ) if ( def.startsWith( QStringLiteral( "point" ), Qt::CaseInsensitive ) )
{ {

View File

@ -952,7 +952,7 @@ class CORE_EXPORT QgsProcessingParameterMultipleLayers : public QgsProcessingPar
/** /**
* Constructor for QgsProcessingParameterMultipleLayers. * Constructor for QgsProcessingParameterMultipleLayers.
*/ */
QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), QgsProcessing::LayerType layerType = QgsProcessing::TypeVectorAny, QgsProcessingParameterMultipleLayers( const QString &name, const QString &description = QString(), QgsProcessing::SourceType layerType = QgsProcessing::TypeVectorAnyGeometry,
const QVariant &defaultValue = QVariant(), const QVariant &defaultValue = QVariant(),
bool optional = false ); bool optional = false );
@ -970,13 +970,13 @@ class CORE_EXPORT QgsProcessingParameterMultipleLayers : public QgsProcessingPar
* Returns the layer type for layers acceptable by the parameter. * Returns the layer type for layers acceptable by the parameter.
* \see setLayerType() * \see setLayerType()
*/ */
QgsProcessing::LayerType layerType() const; QgsProcessing::SourceType layerType() const;
/** /**
* Sets the layer \a type for layers acceptable by the parameter. * Sets the layer \a type for layers acceptable by the parameter.
* \see layerType() * \see layerType()
*/ */
void setLayerType( QgsProcessing::LayerType type ); void setLayerType( QgsProcessing::SourceType type );
/** /**
* Returns the minimum number of layers required for the parameter. If the return value is < 1 * Returns the minimum number of layers required for the parameter. If the return value is < 1
@ -1002,7 +1002,7 @@ class CORE_EXPORT QgsProcessingParameterMultipleLayers : public QgsProcessingPar
private: private:
QgsProcessing::LayerType mLayerType = QgsProcessing::TypeVectorAny; QgsProcessing::SourceType mLayerType = QgsProcessing::TypeVectorAnyGeometry;
int mMinimumNumberInputs = 0; int mMinimumNumberInputs = 0;
}; };
@ -1401,7 +1401,7 @@ class CORE_EXPORT QgsProcessingParameterVectorLayer : public QgsProcessingParame
private: private:
QList< int > mDataTypes = QList< int >() << QgsProcessing::TypeVectorAny; QList< int > mDataTypes = QList< int >() << QgsProcessing::TypeVectorAnyGeometry;
}; };
@ -1546,7 +1546,7 @@ class CORE_EXPORT QgsProcessingParameterFeatureSource : public QgsProcessingPara
private: private:
QList< int > mDataTypes = QList< int >() << QgsProcessing::TypeVectorAny; QList< int > mDataTypes = QList< int >() << QgsProcessing::TypeVectorAnyGeometry;
}; };
@ -1641,7 +1641,7 @@ class CORE_EXPORT QgsProcessingParameterFeatureSink : public QgsProcessingDestin
/** /**
* Constructor for QgsProcessingParameterFeatureSink. * Constructor for QgsProcessingParameterFeatureSink.
*/ */
QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny, const QVariant &defaultValue = QVariant(), QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
bool optional = false ); bool optional = false );
/** /**
@ -1660,7 +1660,7 @@ class CORE_EXPORT QgsProcessingParameterFeatureSink : public QgsProcessingDestin
* Returns the layer type for sinks associated with the parameter. * Returns the layer type for sinks associated with the parameter.
* \see setDataType() * \see setDataType()
*/ */
QgsProcessing::LayerType dataType() const; QgsProcessing::SourceType dataType() const;
/** /**
* Returns true if sink is likely to include geometries. In cases were presence of geometry * Returns true if sink is likely to include geometries. In cases were presence of geometry
@ -1672,7 +1672,7 @@ class CORE_EXPORT QgsProcessingParameterFeatureSink : public QgsProcessingDestin
* Sets the layer \a type for the sinks associated with the parameter. * Sets the layer \a type for the sinks associated with the parameter.
* \see dataType() * \see dataType()
*/ */
void setDataType( QgsProcessing::LayerType type ); void setDataType( QgsProcessing::SourceType type );
QVariantMap toVariantMap() const override; QVariantMap toVariantMap() const override;
bool fromVariantMap( const QVariantMap &map ) override; bool fromVariantMap( const QVariantMap &map ) override;
@ -1685,7 +1685,7 @@ class CORE_EXPORT QgsProcessingParameterFeatureSink : public QgsProcessingDestin
private: private:
QgsProcessing::LayerType mDataType = QgsProcessing::TypeVectorAny; QgsProcessing::SourceType mDataType = QgsProcessing::TypeVectorAnyGeometry;
}; };
@ -1706,7 +1706,7 @@ class CORE_EXPORT QgsProcessingParameterVectorDestination : public QgsProcessing
/** /**
* Constructor for QgsProcessingParameterVectorDestination. * Constructor for QgsProcessingParameterVectorDestination.
*/ */
QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), QgsProcessing::LayerType type = QgsProcessing::TypeVectorAny, const QVariant &defaultValue = QVariant(), QgsProcessingParameterVectorDestination( const QString &name, const QString &description = QString(), QgsProcessing::SourceType type = QgsProcessing::TypeVectorAnyGeometry, const QVariant &defaultValue = QVariant(),
bool optional = false ); bool optional = false );
/** /**
@ -1725,7 +1725,7 @@ class CORE_EXPORT QgsProcessingParameterVectorDestination : public QgsProcessing
* Returns the layer type for this created vector layer. * Returns the layer type for this created vector layer.
* \see setDataType() * \see setDataType()
*/ */
QgsProcessing::LayerType dataType() const; QgsProcessing::SourceType dataType() const;
/** /**
* Returns true if the created layer is likely to include geometries. In cases were presence of geometry * Returns true if the created layer is likely to include geometries. In cases were presence of geometry
@ -1737,7 +1737,7 @@ class CORE_EXPORT QgsProcessingParameterVectorDestination : public QgsProcessing
* Sets the layer \a type for the created vector layer. * Sets the layer \a type for the created vector layer.
* \see dataType() * \see dataType()
*/ */
void setDataType( QgsProcessing::LayerType type ); void setDataType( QgsProcessing::SourceType type );
QVariantMap toVariantMap() const override; QVariantMap toVariantMap() const override;
bool fromVariantMap( const QVariantMap &map ) override; bool fromVariantMap( const QVariantMap &map ) override;
@ -1750,7 +1750,7 @@ class CORE_EXPORT QgsProcessingParameterVectorDestination : public QgsProcessing
private: private:
QgsProcessing::LayerType mDataType = QgsProcessing::TypeVectorAny; QgsProcessing::SourceType mDataType = QgsProcessing::TypeVectorAnyGeometry;
}; };
/** /**

View File

@ -2194,7 +2194,7 @@ void TestQgsProcessing::parameterLayerList()
context.setProject( &p ); context.setProject( &p );
// not optional! // not optional!
std::unique_ptr< QgsProcessingParameterMultipleLayers > def( new QgsProcessingParameterMultipleLayers( "non_optional", QString(), QgsProcessing::TypeAny, QString(), false ) ); std::unique_ptr< QgsProcessingParameterMultipleLayers > def( new QgsProcessingParameterMultipleLayers( "non_optional", QString(), QgsProcessing::TypeMapLayer, QString(), false ) );
QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( false ) );
QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( true ) );
QVERIFY( !def->checkValueIsAcceptable( 5 ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) );
@ -2288,7 +2288,7 @@ void TestQgsProcessing::parameterLayerList()
QCOMPARE( fromCode->description(), QStringLiteral( "non optional" ) ); QCOMPARE( fromCode->description(), QStringLiteral( "non optional" ) );
QCOMPARE( fromCode->flags(), def->flags() ); QCOMPARE( fromCode->flags(), def->flags() );
QVERIFY( !fromCode->defaultValue().isValid() ); QVERIFY( !fromCode->defaultValue().isValid() );
QCOMPARE( fromCode->layerType(), QgsProcessing::TypeVectorAny ); QCOMPARE( fromCode->layerType(), QgsProcessing::TypeVectorAnyGeometry );
QVariantMap map = def->toVariantMap(); QVariantMap map = def->toVariantMap();
QgsProcessingParameterMultipleLayers fromMap( "x" ); QgsProcessingParameterMultipleLayers fromMap( "x" );
@ -2303,7 +2303,7 @@ void TestQgsProcessing::parameterLayerList()
QVERIFY( dynamic_cast< QgsProcessingParameterMultipleLayers *>( def.get() ) ); QVERIFY( dynamic_cast< QgsProcessingParameterMultipleLayers *>( def.get() ) );
// optional with one default layer // optional with one default layer
def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeAny, v1->id(), true ) ); def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeMapLayer, v1->id(), true ) );
QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( false ) );
QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( true ) );
QVERIFY( !def->checkValueIsAcceptable( 5 ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) );
@ -2335,10 +2335,10 @@ void TestQgsProcessing::parameterLayerList()
QCOMPARE( fromCode->description(), QStringLiteral( "optional" ) ); QCOMPARE( fromCode->description(), QStringLiteral( "optional" ) );
QCOMPARE( fromCode->flags(), def->flags() ); QCOMPARE( fromCode->flags(), def->flags() );
QCOMPARE( fromCode->defaultValue(), def->defaultValue() ); QCOMPARE( fromCode->defaultValue(), def->defaultValue() );
QCOMPARE( fromCode->layerType(), QgsProcessing::TypeVectorAny ); QCOMPARE( fromCode->layerType(), QgsProcessing::TypeVectorAnyGeometry );
// optional with two default layers // optional with two default layers
def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeAny, QVariantList() << v1->id() << r1->publicSource(), true ) ); def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeMapLayer, QVariantList() << v1->id() << r1->publicSource(), true ) );
params.insert( "optional", QVariant() ); params.insert( "optional", QVariant() );
QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() << v1 << r1 ); QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() << v1 << r1 );
@ -2350,14 +2350,14 @@ void TestQgsProcessing::parameterLayerList()
QCOMPARE( fromCode->description(), QStringLiteral( "optional" ) ); QCOMPARE( fromCode->description(), QStringLiteral( "optional" ) );
QCOMPARE( fromCode->flags(), def->flags() ); QCOMPARE( fromCode->flags(), def->flags() );
QCOMPARE( fromCode->defaultValue().toString(), v1->id() + "," + r1->publicSource() ); QCOMPARE( fromCode->defaultValue().toString(), v1->id() + "," + r1->publicSource() );
QCOMPARE( fromCode->layerType(), QgsProcessing::TypeVectorAny ); QCOMPARE( fromCode->layerType(), QgsProcessing::TypeVectorAnyGeometry );
// optional with one default direct layer // optional with one default direct layer
def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeAny, QVariant::fromValue( v1 ), true ) ); def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeMapLayer, QVariant::fromValue( v1 ), true ) );
QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() << v1 ); QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() << v1 );
// optional with two default direct layers // optional with two default direct layers
def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeAny, QVariantList() << QVariant::fromValue( v1 ) << QVariant::fromValue( r1 ), true ) ); def.reset( new QgsProcessingParameterMultipleLayers( "optional", QString(), QgsProcessing::TypeMapLayer, QVariantList() << QVariant::fromValue( v1 ) << QVariant::fromValue( r1 ), true ) );
QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() << v1 << r1 ); QCOMPARE( QgsProcessingParameters::parameterAsLayerList( def.get(), params, context ), QList< QgsMapLayer *>() << v1 << r1 );
def.reset( new QgsProcessingParameterMultipleLayers( "type", QString(), QgsProcessing::TypeRaster ) ); def.reset( new QgsProcessingParameterMultipleLayers( "type", QString(), QgsProcessing::TypeRaster ) );
@ -3395,7 +3395,7 @@ void TestQgsProcessing::parameterFeatureSource()
context.setProject( &p ); context.setProject( &p );
// not optional! // not optional!
std::unique_ptr< QgsProcessingParameterFeatureSource > def( new QgsProcessingParameterFeatureSource( "non_optional", QString(), QList< int >() << QgsProcessing::TypeVectorAny, QString(), false ) ); std::unique_ptr< QgsProcessingParameterFeatureSource > def( new QgsProcessingParameterFeatureSource( "non_optional", QString(), QList< int >() << QgsProcessing::TypeVectorAnyGeometry, QString(), false ) );
QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( false ) );
QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( true ) );
QVERIFY( !def->checkValueIsAcceptable( 5 ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) );
@ -3482,7 +3482,7 @@ void TestQgsProcessing::parameterFeatureSource()
// optional // optional
def.reset( new QgsProcessingParameterFeatureSource( "optional", QString(), QList< int >() << QgsProcessing::TypeVectorAny, v1->id(), true ) ); def.reset( new QgsProcessingParameterFeatureSource( "optional", QString(), QList< int >() << QgsProcessing::TypeVectorAnyGeometry, v1->id(), true ) );
params.insert( "optional", QVariant() ); params.insert( "optional", QVariant() );
QCOMPARE( QgsProcessingParameters::parameterAsVectorLayer( def.get(), params, context )->id(), v1->id() ); QCOMPARE( QgsProcessingParameters::parameterAsVectorLayer( def.get(), params, context )->id(), v1->id() );
QVERIFY( def->checkValueIsAcceptable( false ) ); QVERIFY( def->checkValueIsAcceptable( false ) );
@ -3505,7 +3505,7 @@ void TestQgsProcessing::parameterFeatureSource()
//optional with direct layer default //optional with direct layer default
def.reset( new QgsProcessingParameterFeatureSource( "optional", QString(), QList< int >() << QgsProcessing::TypeVectorAny, QVariant::fromValue( v1 ), true ) ); def.reset( new QgsProcessingParameterFeatureSource( "optional", QString(), QList< int >() << QgsProcessing::TypeVectorAnyGeometry, QVariant::fromValue( v1 ), true ) );
QCOMPARE( QgsProcessingParameters::parameterAsVectorLayer( def.get(), params, context )->id(), v1->id() ); QCOMPARE( QgsProcessingParameters::parameterAsVectorLayer( def.get(), params, context )->id(), v1->id() );
} }
@ -3518,7 +3518,7 @@ void TestQgsProcessing::parameterFeatureSink()
context.setProject( &p ); context.setProject( &p );
// not optional! // not optional!
std::unique_ptr< QgsProcessingParameterFeatureSink > def( new QgsProcessingParameterFeatureSink( "non_optional", QString(), QgsProcessing::TypeVectorAny, QString(), false ) ); std::unique_ptr< QgsProcessingParameterFeatureSink > def( new QgsProcessingParameterFeatureSink( "non_optional", QString(), QgsProcessing::TypeVectorAnyGeometry, QString(), false ) );
QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( false ) );
QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( true ) );
QVERIFY( !def->checkValueIsAcceptable( 5 ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) );
@ -3580,14 +3580,14 @@ void TestQgsProcessing::parameterFeatureSink()
QCOMPARE( code, QStringLiteral( "##non_optional=sink polygon" ) ); QCOMPARE( code, QStringLiteral( "##non_optional=sink polygon" ) );
fromCode.reset( dynamic_cast< QgsProcessingParameterFeatureSink * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) ); fromCode.reset( dynamic_cast< QgsProcessingParameterFeatureSink * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) );
QCOMPARE( fromCode->dataType(), def->dataType() ); QCOMPARE( fromCode->dataType(), def->dataType() );
def->setDataType( QgsProcessing::TypeTable ); def->setDataType( QgsProcessing::TypeVector );
code = def->asScriptCode(); code = def->asScriptCode();
QCOMPARE( code, QStringLiteral( "##non_optional=sink table" ) ); QCOMPARE( code, QStringLiteral( "##non_optional=sink table" ) );
fromCode.reset( dynamic_cast< QgsProcessingParameterFeatureSink * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) ); fromCode.reset( dynamic_cast< QgsProcessingParameterFeatureSink * >( QgsProcessingParameters::parameterFromScriptCode( code ) ) );
QCOMPARE( fromCode->dataType(), def->dataType() ); QCOMPARE( fromCode->dataType(), def->dataType() );
// optional // optional
def.reset( new QgsProcessingParameterFeatureSink( "optional", QString(), QgsProcessing::TypeVectorAny, QString(), true ) ); def.reset( new QgsProcessingParameterFeatureSink( "optional", QString(), QgsProcessing::TypeVectorAnyGeometry, QString(), true ) );
QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( false ) );
QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( true ) );
QVERIFY( !def->checkValueIsAcceptable( 5 ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) );
@ -3610,14 +3610,14 @@ void TestQgsProcessing::parameterFeatureSink()
QVERIFY( !def->createByDefault() ); QVERIFY( !def->createByDefault() );
// test hasGeometry // test hasGeometry
QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeAny ).hasGeometry() ); QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeMapLayer ).hasGeometry() );
QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVectorAny ).hasGeometry() ); QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVectorAnyGeometry ).hasGeometry() );
QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVectorPoint ).hasGeometry() ); QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVectorPoint ).hasGeometry() );
QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVectorLine ).hasGeometry() ); QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVectorLine ).hasGeometry() );
QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVectorPolygon ).hasGeometry() ); QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVectorPolygon ).hasGeometry() );
QVERIFY( !QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeRaster ).hasGeometry() ); QVERIFY( !QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeRaster ).hasGeometry() );
QVERIFY( !QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeFile ).hasGeometry() ); QVERIFY( !QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeFile ).hasGeometry() );
QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeTable ).hasGeometry() ); QVERIFY( QgsProcessingParameterFeatureSink( "test", QString(), QgsProcessing::TypeVector ).hasGeometry() );
} }
@ -3630,7 +3630,7 @@ void TestQgsProcessing::parameterVectorOut()
context.setProject( &p ); context.setProject( &p );
// not optional! // not optional!
std::unique_ptr< QgsProcessingParameterVectorDestination > def( new QgsProcessingParameterVectorDestination( "non_optional", QString(), QgsProcessing::TypeVectorAny, QString(), false ) ); std::unique_ptr< QgsProcessingParameterVectorDestination > def( new QgsProcessingParameterVectorDestination( "non_optional", QString(), QgsProcessing::TypeVectorAnyGeometry, QString(), false ) );
QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( false ) );
QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( true ) );
QVERIFY( !def->checkValueIsAcceptable( 5 ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) );
@ -3691,7 +3691,7 @@ void TestQgsProcessing::parameterVectorOut()
QCOMPARE( fromCode->dataType(), def->dataType() ); QCOMPARE( fromCode->dataType(), def->dataType() );
// optional // optional
def.reset( new QgsProcessingParameterVectorDestination( "optional", QString(), QgsProcessing::TypeVectorAny, QString(), true ) ); def.reset( new QgsProcessingParameterVectorDestination( "optional", QString(), QgsProcessing::TypeVectorAnyGeometry, QString(), true ) );
QVERIFY( !def->checkValueIsAcceptable( false ) ); QVERIFY( !def->checkValueIsAcceptable( false ) );
QVERIFY( !def->checkValueIsAcceptable( true ) ); QVERIFY( !def->checkValueIsAcceptable( true ) );
QVERIFY( !def->checkValueIsAcceptable( 5 ) ); QVERIFY( !def->checkValueIsAcceptable( 5 ) );
@ -3711,14 +3711,14 @@ void TestQgsProcessing::parameterVectorOut()
QCOMPARE( fromCode->dataType(), def->dataType() ); QCOMPARE( fromCode->dataType(), def->dataType() );
// test hasGeometry // test hasGeometry
QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeAny ).hasGeometry() ); QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeMapLayer ).hasGeometry() );
QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVectorAny ).hasGeometry() ); QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVectorAnyGeometry ).hasGeometry() );
QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVectorPoint ).hasGeometry() ); QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVectorPoint ).hasGeometry() );
QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVectorLine ).hasGeometry() ); QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVectorLine ).hasGeometry() );
QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVectorPolygon ).hasGeometry() ); QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVectorPolygon ).hasGeometry() );
QVERIFY( !QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeRaster ).hasGeometry() ); QVERIFY( !QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeRaster ).hasGeometry() );
QVERIFY( !QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeFile ).hasGeometry() ); QVERIFY( !QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeFile ).hasGeometry() );
QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeTable ).hasGeometry() ); QVERIFY( QgsProcessingParameterVectorDestination( "test", QString(), QgsProcessing::TypeVector ).hasGeometry() );
} }
@ -4200,7 +4200,7 @@ void TestQgsProcessing::processingFeatureSink()
// non optional sink // non optional sink
def.reset( new QgsProcessingParameterFeatureSink( QStringLiteral( "layer" ), QString(), QgsProcessing::TypeAny, QVariant(), false ) ); def.reset( new QgsProcessingParameterFeatureSink( QStringLiteral( "layer" ), QString(), QgsProcessing::TypeMapLayer, QVariant(), false ) );
QVERIFY( def->checkValueIsAcceptable( QStringLiteral( "memory:test" ) ) ); QVERIFY( def->checkValueIsAcceptable( QStringLiteral( "memory:test" ) ) );
QVERIFY( def->checkValueIsAcceptable( QgsProcessingOutputLayerDefinition( "memory:test" ) ) ); QVERIFY( def->checkValueIsAcceptable( QgsProcessingOutputLayerDefinition( "memory:test" ) ) );
QVERIFY( def->checkValueIsAcceptable( QgsProperty::fromValue( "memory:test" ) ) ); QVERIFY( def->checkValueIsAcceptable( QgsProperty::fromValue( "memory:test" ) ) );
@ -4212,7 +4212,7 @@ void TestQgsProcessing::processingFeatureSink()
QVERIFY( sink.get() ); QVERIFY( sink.get() );
// optional sink // optional sink
def.reset( new QgsProcessingParameterFeatureSink( QStringLiteral( "layer" ), QString(), QgsProcessing::TypeAny, QVariant(), true ) ); def.reset( new QgsProcessingParameterFeatureSink( QStringLiteral( "layer" ), QString(), QgsProcessing::TypeMapLayer, QVariant(), true ) );
QVERIFY( def->checkValueIsAcceptable( QStringLiteral( "memory:test" ) ) ); QVERIFY( def->checkValueIsAcceptable( QStringLiteral( "memory:test" ) ) );
QVERIFY( def->checkValueIsAcceptable( QgsProcessingOutputLayerDefinition( "memory:test" ) ) ); QVERIFY( def->checkValueIsAcceptable( QgsProcessingOutputLayerDefinition( "memory:test" ) ) );
QVERIFY( def->checkValueIsAcceptable( QgsProperty::fromValue( "memory:test" ) ) ); QVERIFY( def->checkValueIsAcceptable( QgsProperty::fromValue( "memory:test" ) ) );
@ -4228,7 +4228,7 @@ void TestQgsProcessing::processingFeatureSink()
QVERIFY( !sink.get() ); QVERIFY( !sink.get() );
//.... unless there's a default set //.... unless there's a default set
def.reset( new QgsProcessingParameterFeatureSink( QStringLiteral( "layer" ), QString(), QgsProcessing::TypeAny, QStringLiteral( "memory:defaultlayer" ), true ) ); def.reset( new QgsProcessingParameterFeatureSink( QStringLiteral( "layer" ), QString(), QgsProcessing::TypeMapLayer, QStringLiteral( "memory:defaultlayer" ), true ) );
params.insert( QStringLiteral( "layer" ), QVariant() ); params.insert( QStringLiteral( "layer" ), QVariant() );
sink.reset( QgsProcessingParameters::parameterAsSink( def.get(), params, QgsFields(), QgsWkbTypes::Point, QgsCoordinateReferenceSystem( "EPSG:3113" ), context, dest ) ); sink.reset( QgsProcessingParameters::parameterAsSink( def.get(), params, QgsFields(), QgsWkbTypes::Point, QgsCoordinateReferenceSystem( "EPSG:3113" ), context, dest ) );
QVERIFY( sink.get() ); QVERIFY( sink.get() );