Skip to content

Commit 5b8affc

Browse files
committedJun 5, 2017
Rename QgsProcessingParameterOutputVectorLayer to QgsProcessingParameterFeatureSink
1 parent 770c45d commit 5b8affc

File tree

8 files changed

+38
-38
lines changed

8 files changed

+38
-38
lines changed
 

‎python/core/processing/qgsprocessingparameters.sip

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ class QgsProcessingParameterDefinition
6464
sipType = sipType_QgsProcessingParameterTableField;
6565
else if ( sipCpp->type() == "source" )
6666
sipType = sipType_QgsProcessingParameterFeatureSource;
67-
else if ( sipCpp->type() == "vectorOut" )
68-
sipType = sipType_QgsProcessingParameterOutputVectorLayer;
67+
else if ( sipCpp->type() == "sink" )
68+
sipType = sipType_QgsProcessingParameterFeatureSink;
6969
%End
7070
public:
7171

@@ -1058,12 +1058,12 @@ class QgsProcessingParameterFeatureSource : QgsProcessingParameterDefinition
10581058
};
10591059

10601060

1061-
class QgsProcessingParameterOutputVectorLayer : QgsProcessingParameterDefinition
1061+
class QgsProcessingParameterFeatureSink : QgsProcessingParameterDefinition
10621062
{
10631063
%Docstring
1064-
A vector layer output for processing algorithms.
1064+
A feature sink output for processing algorithms.
10651065

1066-
A parameter which represents the destination for a vector layer created by an algorithm.
1066+
A parameter which represents the destination feature sink for features created by an algorithm.
10671067
.. versionadded:: 3.0
10681068
%End
10691069

@@ -1072,10 +1072,10 @@ class QgsProcessingParameterOutputVectorLayer : QgsProcessingParameterDefinition
10721072
%End
10731073
public:
10741074

1075-
QgsProcessingParameterOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessingParameterDefinition::LayerType type = QgsProcessingParameterDefinition::TypeVectorAny, const QVariant &defaultValue = QVariant(),
1076-
bool optional = false );
1075+
QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessingParameterDefinition::LayerType type = QgsProcessingParameterDefinition::TypeVectorAny, const QVariant &defaultValue = QVariant(),
1076+
bool optional = false );
10771077
%Docstring
1078-
Constructor for QgsProcessingParameterOutputVectorLayer.
1078+
Constructor for QgsProcessingParameterFeatureSink.
10791079
%End
10801080

10811081
virtual QString type() const;
@@ -1085,14 +1085,14 @@ class QgsProcessingParameterOutputVectorLayer : QgsProcessingParameterDefinition
10851085

10861086
QgsProcessingParameterDefinition::LayerType dataType() const;
10871087
%Docstring
1088-
Returns the layer type for the output layer associated with the parameter.
1088+
Returns the layer type for sinks associated with the parameter.
10891089
.. seealso:: setDataType()
10901090
:rtype: QgsProcessingParameterDefinition.LayerType
10911091
%End
10921092

10931093
void setDataType( QgsProcessingParameterDefinition::LayerType type );
10941094
%Docstring
1095-
Sets the layer ``type`` for the output layer associated with the parameter.
1095+
Sets the layer ``type`` for the sinks associated with the parameter.
10961096
.. seealso:: dataType()
10971097
%End
10981098

‎python/plugins/processing/algs/qgis/Boundary.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
QgsProcessingUtils,
3333
QgsProcessingParameterDefinition,
3434
QgsProcessingParameterFeatureSource,
35-
QgsProcessingParameterOutputVectorLayer,
35+
QgsProcessingParameterFeatureSink,
3636
QgsProcessingOutputVectorLayer)
3737

3838
from qgis.PyQt.QtGui import QIcon
@@ -54,7 +54,7 @@ class Boundary(QgisAlgorithm):
5454
def __init__(self):
5555
super().__init__()
5656
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT_LAYER, self.tr('Input layer'), [QgsProcessingParameterDefinition.TypeVectorLine, QgsProcessingParameterDefinition.TypeVectorPolygon]))
57-
self.addParameter(QgsProcessingParameterOutputVectorLayer(self.OUTPUT_LAYER, self.tr('Boundary')))
57+
self.addParameter(QgsProcessingParameterFeatureSink(self.OUTPUT_LAYER, self.tr('Boundary')))
5858
self.addOutput(QgsProcessingOutputVectorLayer(self.OUTPUT_LAYER, self.tr("Boundaries")))
5959

6060
def icon(self):

‎python/plugins/processing/gui/AlgorithmDialog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
QgsMessageLog,
3636
QgsProcessingParameterDefinition,
3737
QgsProcessingOutputVectorLayer,
38-
QgsProcessingParameterOutputVectorLayer)
38+
QgsProcessingParameterFeatureSink)
3939
from qgis.gui import QgsMessageBar
4040
from qgis.utils import iface
4141

@@ -118,7 +118,7 @@ def getLayersToOpen(self):
118118
for param in self.alg.destinationParameterDefinitions():
119119
if param.flags() & QgsProcessingParameterDefinition.FlagHidden:
120120
continue
121-
if isinstance(param, (OutputRaster, QgsProcessingParameterOutputVectorLayer, OutputTable)):
121+
if isinstance(param, (OutputRaster, QgsProcessingParameterFeatureSink, OutputTable)):
122122
if self.mainWidget.checkBoxes[param.name()].isChecked():
123123
layer_outputs.append(param.name())
124124

‎python/plugins/processing/gui/ParametersPanel.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
QgsProcessingParameterPoint,
3737
QgsProcessingParameterFeatureSource,
3838
QgsProcessingOutputVectorLayer,
39-
QgsProcessingParameterOutputVectorLayer)
39+
QgsProcessingParameterFeatureSink)
4040
from qgis.PyQt import uic
4141
from qgis.PyQt.QtCore import QCoreApplication
4242
from qgis.PyQt.QtWidgets import (QWidget, QHBoxLayout, QToolButton,
@@ -157,7 +157,7 @@ def initWidgets(self):
157157
widget = DestinationSelectionPanel(output, self.alg)
158158
self.layoutMain.insertWidget(self.layoutMain.count() - 1, label)
159159
self.layoutMain.insertWidget(self.layoutMain.count() - 1, widget)
160-
if isinstance(output, (OutputRaster, QgsProcessingParameterOutputVectorLayer, OutputTable)):
160+
if isinstance(output, (OutputRaster, QgsProcessingParameterFeatureSink, OutputTable)):
161161
check = QCheckBox()
162162
check.setText(self.tr('Open output file after running algorithm'))
163163
check.setChecked(True)

‎src/core/processing/qgsnativealgorithms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void QgsNativeAlgorithms::loadAlgorithms()
6666
QgsCentroidAlgorithm::QgsCentroidAlgorithm()
6767
{
6868
addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
69-
addParameter( new QgsProcessingParameterOutputVectorLayer( QStringLiteral( "OUTPUT_LAYER" ), QObject::tr( "Centroids" ), QgsProcessingParameterDefinition::TypeVectorPoint ) );
69+
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT_LAYER" ), QObject::tr( "Centroids" ), QgsProcessingParameterDefinition::TypeVectorPoint ) );
7070
addOutput( new QgsProcessingOutputVectorLayer( QStringLiteral( "OUTPUT_LAYER" ), QObject::tr( "Centroids" ), QgsProcessingParameterDefinition::TypeVectorPoint ) );
7171
}
7272

@@ -136,7 +136,7 @@ QgsBufferAlgorithm::QgsBufferAlgorithm()
136136
addParameter( new QgsProcessingParameterNumber( QStringLiteral( "MITRE_LIMIT" ), QObject::tr( "Miter limit" ), QgsProcessingParameterNumber::Double, 2, false, 1 ) );
137137

138138
addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "DISSOLVE" ), QObject::tr( "Dissolve result" ), false ) );
139-
addParameter( new QgsProcessingParameterOutputVectorLayer( QStringLiteral( "OUTPUT_LAYER" ), QObject::tr( "Buffered" ), QgsProcessingParameterDefinition::TypeVectorPolygon ) );
139+
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT_LAYER" ), QObject::tr( "Buffered" ), QgsProcessingParameterDefinition::TypeVectorPolygon ) );
140140
addOutput( new QgsProcessingOutputVectorLayer( QStringLiteral( "OUTPUT_LAYER" ), QObject::tr( "Buffered" ), QgsProcessingParameterDefinition::TypeVectorPoint ) );
141141
}
142142

‎src/core/processing/qgsprocessingparameters.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,14 +1220,14 @@ void QgsProcessingParameterFeatureSource::setDataTypes( const QList<int> &types
12201220
}
12211221

12221222

1223-
QgsProcessingParameterOutputVectorLayer::QgsProcessingParameterOutputVectorLayer( const QString &name, const QString &description, QgsProcessingParameterDefinition::LayerType type, const QVariant &defaultValue, bool optional )
1223+
QgsProcessingParameterFeatureSink::QgsProcessingParameterFeatureSink( const QString &name, const QString &description, QgsProcessingParameterDefinition::LayerType type, const QVariant &defaultValue, bool optional )
12241224
: QgsProcessingParameterDefinition( name, description, defaultValue, optional )
12251225
, mDataType( type )
12261226
{
12271227

12281228
}
12291229

1230-
bool QgsProcessingParameterOutputVectorLayer::checkValueIsAcceptable( const QVariant &input, QgsProcessingContext * ) const
1230+
bool QgsProcessingParameterFeatureSink::checkValueIsAcceptable( const QVariant &input, QgsProcessingContext * ) const
12311231
{
12321232
if ( !input.isValid() )
12331233
return mFlags & FlagOptional;
@@ -1246,12 +1246,12 @@ bool QgsProcessingParameterOutputVectorLayer::checkValueIsAcceptable( const QVar
12461246
return true;
12471247
}
12481248

1249-
QgsProcessingParameterDefinition::LayerType QgsProcessingParameterOutputVectorLayer::dataType() const
1249+
QgsProcessingParameterDefinition::LayerType QgsProcessingParameterFeatureSink::dataType() const
12501250
{
12511251
return mDataType;
12521252
}
12531253

1254-
void QgsProcessingParameterOutputVectorLayer::setDataType( QgsProcessingParameterDefinition::LayerType type )
1254+
void QgsProcessingParameterFeatureSink::setDataType( QgsProcessingParameterDefinition::LayerType type )
12551255
{
12561256
mDataType = type;
12571257
}

‎src/core/processing/qgsprocessingparameters.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ class CORE_EXPORT QgsProcessingParameterDefinition
8686
sipType = sipType_QgsProcessingParameterTableField;
8787
else if ( sipCpp->type() == "source" )
8888
sipType = sipType_QgsProcessingParameterFeatureSource;
89-
else if ( sipCpp->type() == "vectorOut" )
90-
sipType = sipType_QgsProcessingParameterOutputVectorLayer;
89+
else if ( sipCpp->type() == "sink" )
90+
sipType = sipType_QgsProcessingParameterFeatureSink;
9191
SIP_END
9292
#endif
9393

@@ -1047,35 +1047,35 @@ class CORE_EXPORT QgsProcessingParameterFeatureSource : public QgsProcessingPara
10471047

10481048

10491049
/**
1050-
* \class QgsProcessingParameterOutputVectorLayer
1050+
* \class QgsProcessingParameterFeatureSink
10511051
* \ingroup core
1052-
* A vector layer output for processing algorithms.
1052+
* A feature sink output for processing algorithms.
10531053
*
1054-
* A parameter which represents the destination for a vector layer created by an algorithm.
1054+
* A parameter which represents the destination feature sink for features created by an algorithm.
10551055
* \since QGIS 3.0
10561056
*/
1057-
class CORE_EXPORT QgsProcessingParameterOutputVectorLayer : public QgsProcessingParameterDefinition
1057+
class CORE_EXPORT QgsProcessingParameterFeatureSink : public QgsProcessingParameterDefinition
10581058
{
10591059
public:
10601060

10611061
/**
1062-
* Constructor for QgsProcessingParameterOutputVectorLayer.
1062+
* Constructor for QgsProcessingParameterFeatureSink.
10631063
*/
1064-
QgsProcessingParameterOutputVectorLayer( const QString &name, const QString &description = QString(), QgsProcessingParameterDefinition::LayerType type = QgsProcessingParameterDefinition::TypeVectorAny, const QVariant &defaultValue = QVariant(),
1065-
bool optional = false );
1064+
QgsProcessingParameterFeatureSink( const QString &name, const QString &description = QString(), QgsProcessingParameterDefinition::LayerType type = QgsProcessingParameterDefinition::TypeVectorAny, const QVariant &defaultValue = QVariant(),
1065+
bool optional = false );
10661066

1067-
QString type() const override { return QStringLiteral( "vectorOut" ); }
1067+
QString type() const override { return QStringLiteral( "sink" ); }
10681068
bool isDestination() const override { return true; }
10691069
bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = nullptr ) const override;
10701070

10711071
/**
1072-
* Returns the layer type for the output layer associated with the parameter.
1072+
* Returns the layer type for sinks associated with the parameter.
10731073
* \see setDataType()
10741074
*/
10751075
QgsProcessingParameterDefinition::LayerType dataType() const;
10761076

10771077
/**
1078-
* Sets the layer \a type for the output layer associated with the parameter.
1078+
* Sets the layer \a type for the sinks associated with the parameter.
10791079
* \see dataType()
10801080
*/
10811081
void setDataType( QgsProcessingParameterDefinition::LayerType type );

‎tests/src/core/testqgsprocessing.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ class DummyAlgorithm : public QgsProcessingAlgorithm
9191

9292
//destination styleparameters
9393
QVERIFY( destinationParameterDefinitions().isEmpty() );
94-
QgsProcessingParameterOutputVectorLayer *p5 = new QgsProcessingParameterOutputVectorLayer( "p5" );
94+
QgsProcessingParameterFeatureSink *p5 = new QgsProcessingParameterFeatureSink( "p5" );
9595
QVERIFY( addParameter( p5 ) );
9696
QCOMPARE( destinationParameterDefinitions(), QgsProcessingParameterDefinitions() << p5 );
97-
QgsProcessingParameterOutputVectorLayer *p6 = new QgsProcessingParameterOutputVectorLayer( "p6" );
97+
QgsProcessingParameterFeatureSink *p6 = new QgsProcessingParameterFeatureSink( "p6" );
9898
QVERIFY( addParameter( p6 ) );
9999
QCOMPARE( destinationParameterDefinitions(), QgsProcessingParameterDefinitions() << p5 << p6 );
100100
}
@@ -2186,7 +2186,7 @@ void TestQgsProcessing::parameterOutputVectorLayer()
21862186
context.setProject( &p );
21872187

21882188
// not optional!
2189-
std::unique_ptr< QgsProcessingParameterOutputVectorLayer > def( new QgsProcessingParameterOutputVectorLayer( "non_optional", QString(), QgsProcessingParameterDefinition::TypeVectorAny, QString( "EPSG:3113" ), false ) );
2189+
std::unique_ptr< QgsProcessingParameterFeatureSink > def( new QgsProcessingParameterFeatureSink( "non_optional", QString(), QgsProcessingParameterDefinition::TypeVectorAny, QString( "EPSG:3113" ), false ) );
21902190
QVERIFY( !def->checkValueIsAcceptable( false ) );
21912191
QVERIFY( !def->checkValueIsAcceptable( true ) );
21922192
QVERIFY( !def->checkValueIsAcceptable( 5 ) );
@@ -2199,7 +2199,7 @@ void TestQgsProcessing::parameterOutputVectorLayer()
21992199
QVERIFY( def->checkValueIsAcceptable( "c:/Users/admin/Desktop/roads_clipped_transformed_v1_reprojected_final_clipped_aAAA.shp", &context ) );
22002200

22012201
// optional
2202-
def.reset( new QgsProcessingParameterOutputVectorLayer( "optional", QString(), QgsProcessingParameterDefinition::TypeVectorAny, QString(), true ) );
2202+
def.reset( new QgsProcessingParameterFeatureSink( "optional", QString(), QgsProcessingParameterDefinition::TypeVectorAny, QString(), true ) );
22032203
QVERIFY( !def->checkValueIsAcceptable( false ) );
22042204
QVERIFY( !def->checkValueIsAcceptable( true ) );
22052205
QVERIFY( !def->checkValueIsAcceptable( 5 ) );

0 commit comments

Comments
 (0)
Please sign in to comment.