Skip to content
Permalink
Browse files

Include parameterselection dropdown contents in processing translations

  • Loading branch information
arnaud-morvan committed Sep 17, 2015
1 parent 5ac5217 commit ea0dc6e2d47dbebc56990e80442df13cf2371b4a
Showing with 140 additions and 95 deletions.
  1. +5 −2 python/plugins/processing/algs/qgis/AddTableField.py
  2. +5 −5 python/plugins/processing/algs/qgis/CheckValidity.py
  3. +5 −3 python/plugins/processing/algs/qgis/ConvexHull.py
  4. +6 −2 python/plugins/processing/algs/qgis/Eliminate.py
  5. +5 −3 python/plugins/processing/algs/qgis/ExportGeometryInfo.py
  6. +10 −1 python/plugins/processing/algs/qgis/ExtractByAttribute.py
  7. +6 −2 python/plugins/processing/algs/qgis/FieldPyculator.py
  8. +7 −2 python/plugins/processing/algs/qgis/FieldsCalculator.py
  9. +7 −8 python/plugins/processing/algs/qgis/GeometryConvert.py
  10. +6 −7 python/plugins/processing/algs/qgis/Grid.py
  11. +7 −1 python/plugins/processing/algs/qgis/HubDistance.py
  12. +6 −6 python/plugins/processing/algs/qgis/PointDistance.py
  13. +4 −4 python/plugins/processing/algs/qgis/RandomExtract.py
  14. +4 −4 python/plugins/processing/algs/qgis/RandomExtractWithinSubsets.py
  15. +5 −5 python/plugins/processing/algs/qgis/RandomPointsPolygonsFixed.py
  16. +5 −5 python/plugins/processing/algs/qgis/RandomPointsPolygonsVariable.py
  17. +4 −4 python/plugins/processing/algs/qgis/RandomSelection.py
  18. +4 −4 python/plugins/processing/algs/qgis/RandomSelectionWithinSubsets.py
  19. +10 −1 python/plugins/processing/algs/qgis/SelectByAttribute.py
  20. +6 −4 python/plugins/processing/algs/qgis/SelectByExpression.py
  21. +6 −5 python/plugins/processing/algs/qgis/SelectByLocation.py
  22. +12 −12 python/plugins/processing/algs/qgis/SpatialJoin.py
  23. +5 −5 python/plugins/processing/algs/qgis/VectorGrid.py
@@ -45,19 +45,22 @@ class AddTableField(GeoAlgorithm):
FIELD_LENGTH = 'FIELD_LENGTH'
FIELD_PRECISION = 'FIELD_PRECISION'

TYPE_NAMES = ['Integer', 'Float', 'String']
TYPES = [QVariant.Int, QVariant.Double, QVariant.String]

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Add field to attributes table')
self.group, self.i18n_group = self.trAlgorithm('Vector table tools')

self.type_names = [self.tr('Integer'),
self.tr('Float'),
self.tr('String')]

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY], False))
self.addParameter(ParameterString(self.FIELD_NAME,
self.tr('Field name')))
self.addParameter(ParameterSelection(self.FIELD_TYPE,
self.tr('Field type'), self.TYPE_NAMES))
self.tr('Field type'), self.type_names))
self.addParameter(ParameterNumber(self.FIELD_LENGTH,
self.tr('Field length'), 1, 255, 10))
self.addParameter(ParameterNumber(self.FIELD_PRECISION,
@@ -44,14 +44,14 @@ class CheckValidity(GeoAlgorithm):
INVALID_OUTPUT = 'INVALID_OUTPUT'
ERROR_OUTPUT = 'ERROR_OUTPUT'

METHODS = ['The one selected in digitizing settings',
'QGIS',
'GEOS']

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Check validity')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')

self.methods = [self.tr('The one selected in digitizing settings'),
'QGIS',
'GEOS']

self.addParameter(ParameterVector(
self.INPUT_LAYER,
self.tr('Input layer'),
@@ -60,7 +60,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterSelection(
self.METHOD,
self.tr('Method'),
self.METHODS))
self.methods))

self.addOutput(OutputVector(
self.VALID_OUTPUT,
@@ -43,19 +43,21 @@ class ConvexHull(GeoAlgorithm):
OUTPUT = 'OUTPUT'
FIELD = 'FIELD'
METHOD = 'METHOD'
METHODS = ['Create single minimum convex hull',
'Create convex hulls based on field']

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Convex hull')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')

self.methods = [self.tr('Create single minimum convex hull'),
self.tr('Create convex hulls based on field')]

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY]))
self.addParameter(ParameterTableField(self.FIELD,
self.tr('Field (optional, only used if creating convex hulls by classes)'),
self.INPUT, optional=True))
self.addParameter(ParameterSelection(self.METHOD,
self.tr('Method'), self.METHODS))
self.tr('Method'), self.methods))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Convex hull')))

def processAlgorithm(self, progress):
@@ -49,14 +49,18 @@ class Eliminate(GeoAlgorithm):
COMPARISONVALUE = 'COMPARISONVALUE'
COMPARISON = 'COMPARISON'

MODES = ['Largest area', 'Smallest Area', 'Largest common boundary']
MODE_LARGEST_AREA = 0
MODE_SMALLEST_AREA = 1
MODE_BOUNDARY = 2

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Eliminate sliver polygons')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')

self.modes = [self.tr('Largest area'),
self.tr('Smallest Area'),
self.tr('Largest common boundary')]

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_POLYGON]))
self.addParameter(ParameterBoolean(self.KEEPSELECTION,
@@ -79,7 +83,7 @@ def defineCharacteristics(self):
self.tr('Value'), default='0'))
self.addParameter(ParameterSelection(self.MODE,
self.tr('Merge selection with the neighbouring polygon with the'),
self.MODES))
self.modes))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Cleaned')))

def processAlgorithm(self, progress):
@@ -41,16 +41,18 @@ class ExportGeometryInfo(GeoAlgorithm):
METHOD = 'CALC_METHOD'
OUTPUT = 'OUTPUT'

CALC_METHODS = ['Layer CRS', 'Project CRS', 'Ellipsoidal']

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Export/Add geometry columns')
self.group, self.i18n_group = self.trAlgorithm('Vector table tools')

self.calc_methods = [self.tr('Layer CRS'),
self.tr('Project CRS'),
self.tr('Ellipsoidal')]

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY]))
self.addParameter(ParameterSelection(self.METHOD,
self.tr('Calculate using'), self.CALC_METHODS, 0))
self.tr('Calculate using'), self.calc_methods, 0))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Added geom info')))

@@ -58,12 +58,21 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Extract by attribute')
self.group, self.i18n_group = self.trAlgorithm('Vector selection tools')

self.i18n_operators = ['=',
'!=',
'>',
'>=',
'<',
'<=',
self.tr('begins with'),
self.tr('contains')]

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input Layer'), [ParameterVector.VECTOR_TYPE_ANY]))
self.addParameter(ParameterTableField(self.FIELD,
self.tr('Selection attribute'), self.INPUT))
self.addParameter(ParameterSelection(self.OPERATOR,
self.tr('Operator'), self.OPERATORS))
self.tr('Operator'), self.i18n_operators))
self.addParameter(ParameterString(self.VALUE, self.tr('Value')))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Extracted (attribute)')))
@@ -51,18 +51,22 @@ class FieldsPyculator(GeoAlgorithm):
OUTPUT_LAYER = 'OUTPUT_LAYER'
RESULT_VAR_NAME = 'value'

TYPE_NAMES = ['Integer', 'Float', 'String']
TYPES = [QVariant.Int, QVariant.Double, QVariant.String]

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Advanced Python field calculator')
self.group, self.i18n_group = self.trAlgorithm('Vector table tools')

self.type_names = [self.tr('Integer'),
self.tr('Float'),
self.tr('String')]

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY], False))
self.addParameter(ParameterString(self.FIELD_NAME,
self.tr('Result field name'), 'NewField'))
self.addParameter(ParameterSelection(self.FIELD_TYPE,
self.tr('Field type'), self.TYPE_NAMES))
self.tr('Field type'), self.type_names))
self.addParameter(ParameterNumber(self.FIELD_LENGTH,
self.tr('Field length'), 1, 255, 10))
self.addParameter(ParameterNumber(self.FIELD_PRECISION,
@@ -52,18 +52,23 @@ class FieldsCalculator(GeoAlgorithm):
FORMULA = 'FORMULA'
OUTPUT_LAYER = 'OUTPUT_LAYER'

TYPE_NAMES = ['Float', 'Integer', 'String', 'Date']
TYPES = [QVariant.Double, QVariant.Int, QVariant.String, QVariant.Date]

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Field calculator')
self.group, self.i18n_group = self.trAlgorithm('Vector table tools')

self.type_names = [self.tr('Float'),
self.tr('Integer'),
self.tr('String'),
self.tr('Date')]

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY], False))
self.addParameter(ParameterString(self.FIELD_NAME,
self.tr('Result field name')))
self.addParameter(ParameterSelection(self.FIELD_TYPE,
self.tr('Field type'), self.TYPE_NAMES))
self.tr('Field type'), self.type_names))
self.addParameter(ParameterNumber(self.FIELD_LENGTH,
self.tr('Field length'), 1, 255, 10))
self.addParameter(ParameterNumber(self.FIELD_PRECISION,
@@ -40,21 +40,20 @@ class GeometryConvert(GeoAlgorithm):
TYPE = 'TYPE'
OUTPUT = 'OUTPUT'

TYPES = ['Centroids',
'Nodes',
'Linestrings',
'Multilinestrings',
'Polygons'
]

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Convert geometry type')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')

self.types = [self.tr('Centroids'),
self.tr('Nodes'),
self.tr('Linestrings'),
self.tr('Multilinestrings'),
self.tr('Polygons')]

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY]))
self.addParameter(ParameterSelection(self.TYPE,
self.tr('New geometry type'), self.TYPES))
self.tr('New geometry type'), self.types))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Converted')))

@@ -46,18 +46,17 @@ class Grid(GeoAlgorithm):
CRS = 'CRS'
OUTPUT = 'OUTPUT'

TYPES = ['Rectangle (line)',
'Rectangle (polygon)',
'Diamond (polygon)',
'Hexagon (polygon)'
]

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Create grid')
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')

self.types = [self.tr('Rectangle (line)'),
self.tr('Rectangle (polygon)'),
self.tr('Diamond (polygon)'),
self.tr('Hexagon (polygon)')]

self.addParameter(ParameterSelection(self.TYPE,
self.tr('Grid type'), self.TYPES))
self.tr('Grid type'), self.types))
self.addParameter(ParameterExtent(self.EXTENT,
self.tr('Grid extent')))
self.addParameter(ParameterNumber(self.HSPACING,
@@ -62,6 +62,12 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Distance to nearest hub')
self.group, self.i18n_group = self.trAlgorithm('Vector analysis tools')

self.units = [self.tr('Meters'),
self.tr('Feet'),
self.tr('Miles'),
self.tr('Kilometers'),
self.tr('Layer units')]

self.addParameter(ParameterVector(self.POINTS,
self.tr('Source points layer'), [ParameterVector.VECTOR_TYPE_ANY]))
self.addParameter(ParameterVector(self.HUBS,
@@ -71,7 +77,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterSelection(self.GEOMETRY,
self.tr('Output shape type'), self.GEOMETRIES))
self.addParameter(ParameterSelection(self.UNIT,
self.tr('Measurement unit'), self.UNITS))
self.tr('Measurement unit'), self.units))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Hub distance')))

@@ -46,14 +46,14 @@ class PointDistance(GeoAlgorithm):
NEAREST_POINTS = 'NEAREST_POINTS'
DISTANCE_MATRIX = 'DISTANCE_MATRIX'

MAT_TYPES = ['Linear (N*k x 3) distance matrix',
'Standard (N x T) distance matrix',
'Summary distance matrix (mean, std. dev., min, max)']

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Distance matrix')
self.group, self.i18n_group = self.trAlgorithm('Vector analysis tools')

self.mat_types = [self.tr('Linear (N*k x 3) distance matrix'),
self.tr('Standard (N x T) distance matrix'),
self.tr('Summary distance matrix (mean, std. dev., min, max)')]

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input point layer'), [ParameterVector.VECTOR_TYPE_POINT]))
self.addParameter(ParameterTableField(self.INPUT_FIELD,
@@ -65,7 +65,7 @@ def defineCharacteristics(self):
self.tr('Target unique ID field'), self.TARGET_LAYER,
ParameterTableField.DATA_TYPE_ANY))
self.addParameter(ParameterSelection(self.MATRIX_TYPE,
self.tr('Output matrix type'), self.MAT_TYPES, 0))
self.tr('Output matrix type'), self.mat_types, 0))
self.addParameter(ParameterNumber(self.NEAREST_POINTS,
self.tr('Use only the nearest (k) target points'), 0, 9999, 0))

@@ -93,7 +93,7 @@ def processAlgorithm(self, progress):
self.linearMatrix(inLayer, inField, targetLayer, targetField,
matType, nPoints, progress)
elif matType == 1:
# Standard distance matrix
# Standard distance matrix
self.regularMatrix(inLayer, inField, targetLayer, targetField,
nPoints, progress)
elif matType == 2:
@@ -43,17 +43,17 @@ class RandomExtract(GeoAlgorithm):
METHOD = 'METHOD'
NUMBER = 'NUMBER'

METHODS = ['Number of selected features',
'Percentage of selected features']

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Random extract')
self.group, self.i18n_group = self.trAlgorithm('Vector selection tools')

self.methods = [self.tr('Number of selected features'),
self.tr('Percentage of selected features')]

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY]))
self.addParameter(ParameterSelection(self.METHOD,
self.tr('Method'), self.METHODS, 0))
self.tr('Method'), self.methods, 0))
self.addParameter(ParameterNumber(self.NUMBER,
self.tr('Number/percentage of selected features'), 0, None, 10))

@@ -45,19 +45,19 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
FIELD = 'FIELD'
OUTPUT = 'OUTPUT'

METHODS = ['Number of selected features',
'Percentage of selected features']

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Random extract within subsets')
self.group, self.i18n_group = self.trAlgorithm('Vector selection tools')

self.methods = [self.tr('Number of selected features'),
self.tr('Percentage of selected features')]

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY]))
self.addParameter(ParameterTableField(self.FIELD,
self.tr('ID field'), self.INPUT))
self.addParameter(ParameterSelection(self.METHOD,
self.tr('Method'), self.METHODS, 0))
self.tr('Method'), self.methods, 0))
self.addParameter(ParameterNumber(self.NUMBER,
self.tr('Number/percentage of selected features'), 1, None, 10))

@@ -47,17 +47,17 @@ class RandomPointsPolygonsFixed(GeoAlgorithm):
STRATEGY = 'STRATEGY'
OUTPUT = 'OUTPUT'

STRATEGIES = ['Points count',
'Points density'
]

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Random points inside polygons (fixed)')
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')

self.strategies = [self.tr('Points count'),
self.tr('Points density')]

self.addParameter(ParameterVector(self.VECTOR,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_POLYGON]))
self.addParameter(ParameterSelection(self.STRATEGY,
self.tr('Sampling strategy'), self.STRATEGIES, 0))
self.tr('Sampling strategy'), self.strategies, 0))
self.addParameter(ParameterNumber(self.VALUE,
self.tr('Number or density of points'), 0.0001, 9999999.0, 1.0))
self.addParameter(ParameterNumber(self.MIN_DISTANCE,

0 comments on commit ea0dc6e

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