Skip to content
Permalink
Browse files

[processing] Swap more QGIS and GDAL algorithm parameters to distance…

… params
  • Loading branch information
nyalldawson committed Apr 20, 2018
1 parent 1173506 commit 91c127703505193737355c740f59b78469e9f25d
@@ -26,6 +26,7 @@
__revision__ = '$Format:%H$'

from qgis.core import (QgsProcessing,
QgsProcessingParameterDistance,
QgsProcessingParameterDefinition,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
@@ -57,11 +58,11 @@ def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterString(self.GEOMETRY,
self.tr('Geometry column name'),
defaultValue='geometry'))
self.addParameter(QgsProcessingParameterNumber(self.DISTANCE,
self.tr('Buffer distance'),
type=QgsProcessingParameterNumber.Double,
minValue=0.0,
defaultValue=10.0))
self.addParameter(QgsProcessingParameterDistance(self.DISTANCE,
self.tr('Buffer distance'),
parentParameterName=self.INPUT,
minValue=0.0,
defaultValue=10.0))
self.addParameter(QgsProcessingParameterField(self.FIELD,
self.tr('Dissolve by attribute'),
None,
@@ -27,6 +27,7 @@

from qgis.core import (QgsProcessing,
QgsProcessingParameterDefinition,
QgsProcessingParameterDistance,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterString,
QgsProcessingParameterNumber,
@@ -53,10 +54,10 @@ def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterString(self.GEOMETRY,
self.tr('Geometry column name'),
defaultValue='geometry'))
self.addParameter(QgsProcessingParameterNumber(self.DISTANCE,
self.tr('Offset distance (left-sided: positive, right-sided: negative)'),
type=QgsProcessingParameterNumber.Double,
defaultValue=10))
self.addParameter(QgsProcessingParameterDistance(self.DISTANCE,
self.tr('Offset distance (left-sided: positive, right-sided: negative)'),
parentParameterName=self.INPUT,
defaultValue=10))

options_param = QgsProcessingParameterString(self.OPTIONS,
self.tr('Additional creation options'),
@@ -27,6 +27,7 @@

from qgis.core import (QgsProcessing,
QgsProcessingParameterDefinition,
QgsProcessingParameterDistance,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterEnum,
QgsProcessingParameterField,
@@ -62,10 +63,10 @@ def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterString(self.GEOMETRY,
self.tr('Geometry column name'),
defaultValue='geometry'))
self.addParameter(QgsProcessingParameterNumber(self.DISTANCE,
self.tr('Buffer distance'),
type=QgsProcessingParameterNumber.Double,
defaultValue=10))
self.addParameter(QgsProcessingParameterDistance(self.DISTANCE,
self.tr('Buffer distance'),
defaultValue=10,
parentParameterName=self.INPUT))
self.addParameter(QgsProcessingParameterEnum(self.BUFFER_SIDE,
self.tr('Buffer side'),
options=self.bufferSides,
@@ -31,6 +31,7 @@
QgsProcessingParameterEnum,
QgsProcessingParameterNumber,
QgsProcessingParameterFeatureSink,
QgsProcessingParameterDistance,
QgsFeature,
QgsFeatureSink,
QgsGeometry,
@@ -68,10 +69,10 @@ def initAlgorithm(self, config=None):
[QgsProcessing.TypeVectorPoint]))
self.addParameter(QgsProcessingParameterEnum(self.SHAPE,
self.tr('Buffer shape'), options=self.shapes))
self.addParameter(QgsProcessingParameterNumber(self.WIDTH, self.tr('Width'), type=QgsProcessingParameterNumber.Double,
minValue=0.0000001, maxValue=999999999.0, defaultValue=1.0))
self.addParameter(QgsProcessingParameterNumber(self.HEIGHT, self.tr('Height'), type=QgsProcessingParameterNumber.Double,
minValue=0.0000001, maxValue=999999999.0, defaultValue=1.0))
self.addParameter(QgsProcessingParameterDistance(self.WIDTH, self.tr('Width'), parentParameterName=self.INPUT,
minValue=0.0000001, maxValue=999999999.0, defaultValue=1.0))
self.addParameter(QgsProcessingParameterDistance(self.HEIGHT, self.tr('Height'), parentParameterName=self.INPUT,
minValue=0.0000001, maxValue=999999999.0, defaultValue=1.0))
self.addParameter(QgsProcessingParameterNumber(self.ROTATION, self.tr('Rotation'), type=QgsProcessingParameterNumber.Double,
minValue=0.0, maxValue=360.0, optional=True))
self.addParameter(QgsProcessingParameterNumber(self.SEGMENTS,
@@ -43,6 +43,7 @@
QgsField,
QgsProcessing,
QgsProcessingParameterBoolean,
QgsProcessingParameterDistance,
QgsProcessingParameterEnum,
QgsProcessingParameterPoint,
QgsProcessingParameterField,
@@ -146,10 +147,9 @@ def initAlgorithm(self, config=None):
self.tr('Default speed (km/h)'),
QgsProcessingParameterNumber.Double,
5.0, False, 0, 99999999.99))
params.append(QgsProcessingParameterNumber(self.TOLERANCE,
self.tr('Topology tolerance'),
QgsProcessingParameterNumber.Double,
0.0, False, 0, 99999999.99))
params.append(QgsProcessingParameterDistance(self.TOLERANCE,
self.tr('Topology tolerance'),
0.0, self.INPUT, False, 0, 99999999.99))
params.append(QgsProcessingParameterBoolean(self.INCLUDE_BOUNDS,
self.tr('Include upper/lower bound points'),
defaultValue=False))
@@ -41,6 +41,7 @@
QgsField,
QgsProcessing,
QgsProcessingParameterBoolean,
QgsProcessingParameterDistance,
QgsProcessingParameterEnum,
QgsProcessingParameterPoint,
QgsProcessingParameterField,
@@ -143,10 +144,9 @@ def initAlgorithm(self, config=None):
self.tr('Default speed (km/h)'),
QgsProcessingParameterNumber.Double,
5.0, False, 0, 99999999.99))
params.append(QgsProcessingParameterNumber(self.TOLERANCE,
self.tr('Topology tolerance'),
QgsProcessingParameterNumber.Double,
0.0, False, 0, 99999999.99))
params.append(QgsProcessingParameterDistance(self.TOLERANCE,
self.tr('Topology tolerance'),
0.0, self.INPUT, False, 0, 99999999.99))
params.append(QgsProcessingParameterBoolean(self.INCLUDE_BOUNDS,
self.tr('Include upper/lower bound points'),
defaultValue=False))
@@ -44,6 +44,7 @@
QgsProcessingParameterPoint,
QgsProcessingParameterField,
QgsProcessingParameterNumber,
QgsProcessingParameterDistance,
QgsProcessingParameterString,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterFeatureSink,
@@ -139,10 +140,9 @@ def initAlgorithm(self, config=None):
self.tr('Default speed (km/h)'),
QgsProcessingParameterNumber.Double,
5.0, False, 0, 99999999.99))
params.append(QgsProcessingParameterNumber(self.TOLERANCE,
self.tr('Topology tolerance'),
QgsProcessingParameterNumber.Double,
0.0, False, 0, 99999999.99))
params.append(QgsProcessingParameterDistance(self.TOLERANCE,
self.tr('Topology tolerance'),
0.0, self.INPUT, False, 0, 99999999.99))

for p in params:
p.setFlags(p.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
@@ -42,6 +42,7 @@
QgsPointXY,
QgsProcessing,
QgsProcessingParameterEnum,
QgsProcessingParameterDistance,
QgsProcessingParameterPoint,
QgsProcessingParameterField,
QgsProcessingParameterNumber,
@@ -140,10 +141,9 @@ def initAlgorithm(self, config=None):
self.tr('Default speed (km/h)'),
QgsProcessingParameterNumber.Double,
5.0, False, 0, 99999999.99))
params.append(QgsProcessingParameterNumber(self.TOLERANCE,
self.tr('Topology tolerance'),
QgsProcessingParameterNumber.Double,
0.0, False, 0, 99999999.99))
params.append(QgsProcessingParameterDistance(self.TOLERANCE,
self.tr('Topology tolerance'),
0.0, self.INPUT, False, 0, 99999999.99))

for p in params:
p.setFlags(p.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
@@ -41,6 +41,7 @@
QgsProcessing,
QgsProcessingException,
QgsProcessingOutputNumber,
QgsProcessingParameterDistance,
QgsProcessingParameterEnum,
QgsProcessingParameterPoint,
QgsProcessingParameterField,
@@ -140,10 +141,9 @@ def initAlgorithm(self, config=None):
self.tr('Default speed (km/h)'),
QgsProcessingParameterNumber.Double,
5.0, False, 0, 99999999.99))
params.append(QgsProcessingParameterNumber(self.TOLERANCE,
self.tr('Topology tolerance'),
QgsProcessingParameterNumber.Double,
0.0, False, 0, 99999999.99))
params.append(QgsProcessingParameterDistance(self.TOLERANCE,
self.tr('Topology tolerance'),
0.0, self.INPUT, False, 0, 99999999.99))

for p in params:
p.setFlags(p.flags() | QgsProcessingParameterDefinition.FlagAdvanced)

0 comments on commit 91c1277

Please sign in to comment.
You can’t perform that action at this time.