Navigation Menu

Skip to content

Commit

Permalink
Rename some enum values for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 18, 2017
1 parent 076fdc9 commit ebda2fd
Show file tree
Hide file tree
Showing 23 changed files with 127 additions and 127 deletions.
8 changes: 4 additions & 4 deletions python/core/processing/qgsprocessing.sip
Expand Up @@ -26,16 +26,16 @@ class QgsProcessing
%End
public:

enum LayerType
enum SourceType
{
TypeAny,
TypeVectorAny,
TypeMapLayer,
TypeVectorAnyGeometry,
TypeVectorPoint,
TypeVectorLine,
TypeVectorPolygon,
TypeRaster,
TypeFile,
TypeTable,
TypeVector,
};


Expand Down
4 changes: 2 additions & 2 deletions python/core/processing/qgsprocessingalgorithm.sip
Expand Up @@ -760,11 +760,11 @@ class QgsProcessingFeatureBasedAlgorithm : QgsProcessingAlgorithm
:rtype: str
%End

virtual QgsProcessing::LayerType outputLayerType() const;
virtual QgsProcessing::SourceType outputLayerType() const;
%Docstring
Returns the layer type for layers generated by this algorithm, if
this is possible to determine in advance.
:rtype: QgsProcessing.LayerType
:rtype: QgsProcessing.SourceType
%End

virtual QgsWkbTypes::Type outputWkbType( QgsWkbTypes::Type inputWkbType ) const;
Expand Down
8 changes: 4 additions & 4 deletions python/core/processing/qgsprocessingoutputs.sip
Expand Up @@ -108,7 +108,7 @@ class QgsProcessingOutputVectorLayer : QgsProcessingOutputDefinition
%End
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
Constructor for QgsProcessingOutputVectorLayer.
%End
Expand All @@ -120,14 +120,14 @@ class QgsProcessingOutputVectorLayer : QgsProcessingOutputDefinition
%End
virtual QString type() const;

QgsProcessing::LayerType dataType() const;
QgsProcessing::SourceType dataType() const;
%Docstring
Returns the layer type for the output layer.
.. seealso:: setDataType()
:rtype: QgsProcessing.LayerType
:rtype: QgsProcessing.SourceType
%End

void setDataType( QgsProcessing::LayerType type );
void setDataType( QgsProcessing::SourceType type );
%Docstring
Sets the layer ``type`` for the output layer.
.. seealso:: dataType()
Expand Down
24 changes: 12 additions & 12 deletions python/core/processing/qgsprocessingparameters.sip
Expand Up @@ -975,7 +975,7 @@ class QgsProcessingParameterMultipleLayers : QgsProcessingParameterDefinition
%End
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(),
bool optional = false );
%Docstring
Expand All @@ -997,14 +997,14 @@ class QgsProcessingParameterMultipleLayers : QgsProcessingParameterDefinition
virtual QString asScriptCode() const;


QgsProcessing::LayerType layerType() const;
QgsProcessing::SourceType layerType() const;
%Docstring
Returns the layer type for layers acceptable by the parameter.
.. seealso:: setLayerType()
:rtype: QgsProcessing.LayerType
:rtype: QgsProcessing.SourceType
%End

void setLayerType( QgsProcessing::LayerType type );
void setLayerType( QgsProcessing::SourceType type );
%Docstring
Sets the layer ``type`` for layers acceptable by the parameter.
.. seealso:: layerType()
Expand Down Expand Up @@ -1733,7 +1733,7 @@ class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
%End
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 );
%Docstring
Constructor for QgsProcessingParameterFeatureSink.
Expand All @@ -1758,11 +1758,11 @@ class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
virtual QString defaultFileExtension() const;


QgsProcessing::LayerType dataType() const;
QgsProcessing::SourceType dataType() const;
%Docstring
Returns the layer type for sinks associated with the parameter.
.. seealso:: setDataType()
:rtype: QgsProcessing.LayerType
:rtype: QgsProcessing.SourceType
%End

bool hasGeometry() const;
Expand All @@ -1772,7 +1772,7 @@ class QgsProcessingParameterFeatureSink : QgsProcessingDestinationParameter
:rtype: bool
%End

void setDataType( QgsProcessing::LayerType type );
void setDataType( QgsProcessing::SourceType type );
%Docstring
Sets the layer ``type`` for the sinks associated with the parameter.
.. seealso:: dataType()
Expand Down Expand Up @@ -1812,7 +1812,7 @@ class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParamete
%End
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 );
%Docstring
Constructor for QgsProcessingParameterVectorDestination.
Expand All @@ -1837,11 +1837,11 @@ class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParamete
virtual QString defaultFileExtension() const;


QgsProcessing::LayerType dataType() const;
QgsProcessing::SourceType dataType() const;
%Docstring
Returns the layer type for this created vector layer.
.. seealso:: setDataType()
:rtype: QgsProcessing.LayerType
:rtype: QgsProcessing.SourceType
%End

bool hasGeometry() const;
Expand All @@ -1851,7 +1851,7 @@ class QgsProcessingParameterVectorDestination : QgsProcessingDestinationParamete
:rtype: bool
%End

void setDataType( QgsProcessing::LayerType type );
void setDataType( QgsProcessing::SourceType type );
%Docstring
Sets the layer ``type`` for the created vector layer.
.. seealso:: dataType()
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/algs/qgis/CheckValidity.py
Expand Up @@ -81,13 +81,13 @@ def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterEnum(self.METHOD,
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.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.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')))

def name(self):
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/Datasources2Vrt.py
Expand Up @@ -56,7 +56,7 @@ def __init__(self):
def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterMultipleLayers(self.INPUT,
self.tr('Input datasources'),
QgsProcessing.TypeTable))
QgsProcessing.TypeVector))
self.addParameter(QgsProcessingParameterBoolean(self.UNIONED,
self.tr('Create "unioned" VRT'),
defaultValue=False))
Expand Down
Expand Up @@ -54,7 +54,7 @@ def __init__(self):

def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
self.tr('Input layer'), [QgsProcessing.TypeVectorAny]))
self.tr('Input layer'), [QgsProcessing.TypeVectorAnyGeometry]))
self.addParameter(QgsProcessingParameterString(self.NODES,
self.tr('Node indices'), defaultValue='0'))

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/Merge.py
Expand Up @@ -60,7 +60,7 @@ def __init__(self):
def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterMultipleLayers(self.LAYERS,
self.tr('Layers to merge'),
QgsProcessing.TypeVectorAny))
QgsProcessing.TypeVectorAnyGeometry))

self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT, self.tr('Merged')))

Expand Down
Expand Up @@ -56,7 +56,7 @@ def __init__(self):

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

Expand Down
Expand Up @@ -64,7 +64,7 @@ def __init__(self):
super().__init__()

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.tr('X field'), parentLayerParameterName=self.INPUT, type=QgsProcessingParameterField.Any))
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gui/BatchInputSelectionPanel.py
Expand Up @@ -109,13 +109,13 @@ def showLayerSelectionDialog(self):
elif isinstance(self.param, QgsProcessingParameterVectorLayer):
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance())
else:
datatypes = [QgsProcessing.TypeVectorAny]
datatypes = [QgsProcessing.TypeVectorAnyGeometry]
if isinstance(self.param, QgsProcessingParameterFeatureSource):
datatypes = self.param.dataTypes()
elif isinstance(self.param, QgsProcessingParameterMultipleLayers):
datatypes = [self.param.layerType()]

if QgsProcessing.TypeVectorAny not in datatypes:
if QgsProcessing.TypeVectorAnyGeometry not in datatypes:
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), datatypes)
else:
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance())
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/TestTools.py
Expand Up @@ -184,7 +184,7 @@ def createTest(text):

# Handle datatype detection
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'
else:
dataType = 'raster'
Expand Down
20 changes: 10 additions & 10 deletions python/plugins/processing/gui/wrappers.py
Expand Up @@ -524,20 +524,20 @@ def value(self):
class MultipleInputWidgetWrapper(WidgetWrapper):

def _getOptions(self):
if self.param.layerType() == QgsProcessing.TypeVectorAny:
if self.param.layerType() == QgsProcessing.TypeVectorAnyGeometry:
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer)
elif self.param.layerType() == QgsProcessing.TypeVectorPoint:
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
[QgsProcessing.TypeVectorPoint, QgsProcessing.TypeVectorAny])
[QgsProcessing.TypeVectorPoint, QgsProcessing.TypeVectorAnyGeometry])
elif self.param.layerType() == QgsProcessing.TypeVectorLine:
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
[QgsProcessing.TypeVectorLine, QgsProcessing.TypeVectorAny])
[QgsProcessing.TypeVectorLine, QgsProcessing.TypeVectorAnyGeometry])
elif self.param.layerType() == QgsProcessing.TypeVectorPolygon:
options = self.dialog.getAvailableValuesOfType((QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer, QgsProcessingParameterMultipleLayers), QgsProcessingOutputVectorLayer,
[QgsProcessing.TypeVectorPolygon, QgsProcessing.TypeVectorAny])
[QgsProcessing.TypeVectorPolygon, QgsProcessing.TypeVectorAnyGeometry])
elif self.param.layerType() == QgsProcessing.TypeRaster:
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)
else:
options = self.dialog.getAvailableValuesOfType(QgsProcessingParameterFile, OutputFile)
Expand All @@ -551,7 +551,7 @@ def createWidget(self):
else:
if self.param.layerType() == QgsProcessing.TypeRaster:
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)
else:
options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [self.param.layerType()], False)
Expand All @@ -569,7 +569,7 @@ def refresh(self):
if self.param.layerType() != QgsProcessing.TypeFile:
if self.param.layerType() == QgsProcessing.TypeRaster:
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)
else:
options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [self.param.layerType()], False)
Expand Down Expand Up @@ -605,7 +605,7 @@ def value(self):
else:
if self.param.layerType() == QgsProcessing.TypeRaster:
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)
else:
options = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), [self.param.layerType()], False)
Expand Down Expand Up @@ -827,7 +827,7 @@ def createWidget(self):
widget.setLayout(vl)

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
if QgsProcessing.TypeVectorPoint in self.param.dataTypes():
filters |= QgsMapLayerProxyModel.PointLayer
Expand Down Expand Up @@ -1107,7 +1107,7 @@ def createWidget(self):
self.combo.setAllowEmptyLayer(True)

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
if QgsProcessing.TypeVectorPoint in self.param.dataTypes():
filters |= QgsMapLayerProxyModel.PointLayer
Expand Down
4 changes: 2 additions & 2 deletions src/core/processing/models/qgsprocessingmodelalgorithm.cpp
Expand Up @@ -596,7 +596,7 @@ QgsProcessingModelChildParameterSources QgsProcessingModelAlgorithm::availableSo
bool ok = !sourceDef->dataTypes().isEmpty();
Q_FOREACH ( int type, sourceDef->dataTypes() )
{
if ( dataTypes.contains( type ) || type == QgsProcessing::TypeAny )
if ( dataTypes.contains( type ) || type == QgsProcessing::TypeMapLayer )
{
ok = true;
break;
Expand Down Expand Up @@ -636,7 +636,7 @@ QgsProcessingModelChildParameterSources QgsProcessingModelAlgorithm::availableSo
if ( out->type() == QgsProcessingOutputVectorLayer::typeName() )
{
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;
}
Expand Down

0 comments on commit ebda2fd

Please sign in to comment.