Skip to content
Permalink
Browse files
Move tag handling to QgsProcessingAlgorithm
  • Loading branch information
nyalldawson committed Apr 3, 2017
1 parent 52cc002 commit 28e75731e19bcf0ced91004e91b1c33e1ca0136f
Showing with 104 additions and 39 deletions.
  1. +1 −1 python/core/processing/qgsprocessingalgorithm.sip
  2. +3 −2 python/plugins/processing/algs/gdal/warp.py
  3. +4 −2 python/plugins/processing/algs/qgis/BasicStatistics.py
  4. +3 −1 python/plugins/processing/algs/qgis/BasicStatisticsNumbers.py
  5. +3 −1 python/plugins/processing/algs/qgis/BasicStatisticsStrings.py
  6. +3 −1 python/plugins/processing/algs/qgis/DeleteColumn.py
  7. +3 −1 python/plugins/processing/algs/qgis/DeleteHoles.py
  8. +3 −1 python/plugins/processing/algs/qgis/DensifyGeometries.py
  9. +3 −1 python/plugins/processing/algs/qgis/DropGeometry.py
  10. +3 −1 python/plugins/processing/algs/qgis/ExportGeometryInfo.py
  11. +3 −1 python/plugins/processing/algs/qgis/ExtentFromLayer.py
  12. +3 −1 python/plugins/processing/algs/qgis/ExtractByAttribute.py
  13. +3 −1 python/plugins/processing/algs/qgis/ExtractByExpression.py
  14. +3 −1 python/plugins/processing/algs/qgis/ExtractByLocation.py
  15. +3 −1 python/plugins/processing/algs/qgis/FindProjection.py
  16. +3 −1 python/plugins/processing/algs/qgis/FixGeometry.py
  17. +3 −1 python/plugins/processing/algs/qgis/GridLine.py
  18. +3 −1 python/plugins/processing/algs/qgis/GridPolygon.py
  19. +3 −1 python/plugins/processing/algs/qgis/Heatmap.py
  20. +3 −1 python/plugins/processing/algs/qgis/LinesToPolygons.py
  21. +3 −1 python/plugins/processing/algs/qgis/MergeLines.py
  22. +3 −1 python/plugins/processing/algs/qgis/Orthogonalize.py
  23. +3 −1 python/plugins/processing/algs/qgis/PointsAlongGeometry.py
  24. +3 −1 python/plugins/processing/algs/qgis/PointsLayerFromTable.py
  25. +3 −1 python/plugins/processing/algs/qgis/PoleOfInaccessibility.py
  26. +3 −1 python/plugins/processing/algs/qgis/Polygonize.py
  27. +3 −1 python/plugins/processing/algs/qgis/PolygonsToLines.py
  28. +3 −1 python/plugins/processing/algs/qgis/RemoveNullGeometry.py
  29. +3 −1 python/plugins/processing/algs/qgis/ReprojectLayer.py
  30. +3 −1 python/plugins/processing/algs/qgis/SelectByAttribute.py
  31. +3 −1 python/plugins/processing/algs/qgis/TopoColors.py
  32. +3 −1 python/plugins/processing/algs/qgis/TruncateTable.py
  33. +1 −3 python/plugins/processing/core/GeoAlgorithm.py
  34. +1 −1 python/plugins/processing/gui/ProcessingToolbox.py
  35. +1 −1 python/plugins/processing/modeler/ModelerDialog.py
  36. +6 −0 src/core/processing/qgsprocessingalgorithm.h
@@ -8,6 +8,6 @@ class QgsProcessingAlgorithm

QgsProcessingAlgorithm();
virtual ~QgsProcessingAlgorithm();

virtual QStringList tags() const;
};

@@ -63,11 +63,12 @@ class warp(GdalAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdaltools', 'warp.png'))

def tags(self):
return self.tr('transform,reproject,crs,srs').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Warp (reproject)')
self.group, self.i18n_group = self.trAlgorithm('Raster projections')

self.tags = self.tr('transform,reproject,crs,srs')
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'), False))
self.addParameter(ParameterCrs(self.SOURCE_SRS,
self.tr('Source SRS'),
@@ -77,11 +77,13 @@ class BasicStatisticsForField(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'basic_statistics.png'))

def tags(self):
return self.tr('stats,statistics,date,time,datetime,string,number,text,table,layer,maximum,minimum,mean,average,standard,deviation,'
'count,distinct,unique,variance,median,quartile,range,majority,minority').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Basic statistics for fields')
self.group, self.i18n_group = self.trAlgorithm('Vector table tools')
self.tags = self.tr('stats,statistics,date,time,datetime,string,number,text,table,layer,maximum,minimum,mean,average,standard,deviation,'
'count,distinct,unique,variance,median,quartile,range,majority,minority')

self.addParameter(ParameterTable(self.INPUT_LAYER,
self.tr('Input table')))
@@ -76,10 +76,12 @@ def __init__(self):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'basic_statistics.png'))

def tags(self):
return self.tr('stats,statistics,number,table,layer').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Basic statistics for numeric fields')
self.group, self.i18n_group = self.trAlgorithm('Vector table tools')
self.tags = self.tr('stats,statistics,number,table,layer')

self.addParameter(ParameterTable(self.INPUT_LAYER,
self.tr('Input vector layer')))
@@ -68,10 +68,12 @@ def __init__(self):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'basic_statistics.png'))

def tags(self):
return self.tr('stats,statistics,string,table,layer').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Basic statistics for text fields')
self.group, self.i18n_group = self.trAlgorithm('Vector table tools')
self.tags = self.tr('stats,statistics,string,table,layer')

self.addParameter(ParameterTable(self.INPUT_LAYER,
self.tr('Input vector layer')))
@@ -38,10 +38,12 @@ class DeleteColumn(GeoAlgorithm):
COLUMNS = 'COLUMN'
OUTPUT = 'OUTPUT'

def tags(self):
return self.tr('drop,delete,remove,fields,columns,attributes').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Delete column')
self.group, self.i18n_group = self.trAlgorithm('Vector table tools')
self.tags = self.tr('drop,delete,remove,fields,columns,attributes')

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer')))
@@ -37,10 +37,12 @@ class DeleteHoles(GeoAlgorithm):
MIN_AREA = 'MIN_AREA'
OUTPUT = 'OUTPUT'

def tags(self):
return self.tr('remove,delete,drop,holes,rings,fill').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Delete holes')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.tags = self.tr('remove,delete,drop,holes,rings,fill')

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POLYGON]))
@@ -45,10 +45,12 @@ class DensifyGeometries(GeoAlgorithm):
VERTICES = 'VERTICES'
OUTPUT = 'OUTPUT'

def tags(self):
return self.tr('add,vertices,points').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Densify geometries')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.tags = self.tr('add,vertices,points')

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'),
@@ -37,10 +37,12 @@ class DropGeometry(GeoAlgorithm):
INPUT_LAYER = 'INPUT_LAYER'
OUTPUT_TABLE = 'OUTPUT_TABLE'

def tags(self):
return self.tr('remove,drop,delete,geometry,objects').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Drop geometries')
self.group, self.i18n_group = self.trAlgorithm('Vector general tools')
self.tags = self.tr('remove,drop,delete,geometry,objects')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POINT,
@@ -51,9 +51,11 @@ class ExportGeometryInfo(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'export_geometry.png'))

def tags(self):
return self.tr('export,measurements,areas,lengths,perimeters,latitudes,longitudes,x,y,z,extract,points,lines,polygons').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Export/Add geometry columns')
self.tags = self.tr('export,measurements,areas,lengths,perimeters,latitudes,longitudes,x,y,z,extract,points,lines,polygons')
self.group, self.i18n_group = self.trAlgorithm('Vector table tools')

self.calc_methods = [self.tr('Layer CRS'),
@@ -51,10 +51,12 @@ class ExtentFromLayer(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'layer_extent.png'))

def tags(self):
return self.tr('extent,envelope,bounds,bounding,boundary,layer').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Polygon from layer extent')
self.group, self.i18n_group = self.trAlgorithm('Vector general tools')
self.tags = self.tr('extent,envelope,bounds,bounding,boundary,layer')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer')))
@@ -60,10 +60,12 @@ class ExtractByAttribute(GeoAlgorithm):
'contains',
'does not contain']

def tags(self):
return self.tr('extract,filter,attribute,value,contains,null,field').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Extract by attribute')
self.group, self.i18n_group = self.trAlgorithm('Vector selection tools')
self.tags = self.tr('extract,filter,attribute,value,contains,null,field')

self.i18n_operators = ['=',
'!=',
@@ -40,10 +40,12 @@ class ExtractByExpression(GeoAlgorithm):
EXPRESSION = 'EXPRESSION'
OUTPUT = 'OUTPUT'

def tags(self):
return self.tr('extract,filter,expression,field').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Extract by expression')
self.group, self.i18n_group = self.trAlgorithm('Vector selection tools')
self.tags = self.tr('extract,filter,expression,field')

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input Layer')))
@@ -42,10 +42,12 @@ class ExtractByLocation(GeoAlgorithm):
PRECISION = 'PRECISION'
OUTPUT = 'OUTPUT'

def tags(self):
return self.tr('extract,filter,location,intersects,contains,within').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Extract by location')
self.group, self.i18n_group = self.trAlgorithm('Vector selection tools')
self.tags = self.tr('extract,filter,location,intersects,contains,within')

self.predicates = (
('intersects', self.tr('intersects')),
@@ -51,10 +51,12 @@ class FindProjection(GeoAlgorithm):
TARGET_AREA_CRS = 'TARGET_AREA_CRS'
OUTPUT_HTML_FILE = 'OUTPUT_HTML_FILE'

def tags(self):
return self.tr('crs,srs,coordinate,reference,system,guess,estimate,finder,determine').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Find projection')
self.group, self.i18n_group = self.trAlgorithm('Vector general tools')
self.tags = self.tr('crs,srs,coordinate,reference,system,guess,estimate,finder,determine')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer')))
@@ -40,10 +40,12 @@ class FixGeometry(GeoAlgorithm):
INPUT = 'INPUT'
OUTPUT = 'OUTPUT'

def tags(self):
return self.tr('repair,invalid,geometry').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Fix geometries')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.tags = self.tr('repair,invalid,geometry')

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input Layer'),
@@ -61,10 +61,12 @@ class GridLine(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'vector_grid.png'))

def tags(self):
return self.tr('grid,lines,vector,create,fishnet').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Create grid (lines)')
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')
self.tags = self.tr('grid,lines,vector,create,fishnet')

self.addParameter(ParameterExtent(self.EXTENT,
self.tr('Grid extent'), optional=False))
@@ -57,10 +57,12 @@ class GridPolygon(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'vector_grid.png'))

def tags(self):
return self.tr('grid,lines,vector,create,fishnet').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Create grid (polygon)')
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')
self.tags = self.tr('grid,polygons,vector,create,fishnet')

self.types = [self.tr('Rectangle (polygon)'),
self.tr('Diamond (polygon)'),
@@ -71,10 +71,12 @@ class Heatmap(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'heatmap.png'))

def tags(self):
return self.tr('heatmap,kde,hotspot').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Heatmap (Kernel Density Estimation)')
self.group, self.i18n_group = self.trAlgorithm('Interpolation')
self.tags = self.tr('heatmap,kde,hotspot')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Point layer'), [dataobjects.TYPE_VECTOR_POINT]))
@@ -47,10 +47,12 @@ class LinesToPolygons(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'to_lines.png'))

def tags(self):
return self.tr('line,polygon,convert').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Lines to polygons')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.tags = self.tr('line,polygon,convert')

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'),
@@ -48,10 +48,12 @@ class MergeLines(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'to_lines.png'))

def tags(self):
return self.tr('line,merge,join,parts').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Merge lines')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.tags = self.tr('line,merge,join,parts')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_LINE]))
@@ -41,10 +41,12 @@ class Orthogonalize(GeoAlgorithm):
DISTANCE_THRESHOLD = 'DISTANCE_THRESHOLD'
ANGLE_TOLERANCE = 'ANGLE_TOLERANCE'

def tags(self):
return self.tr('rectangle,perpendicular,right,angles,square,quadrilateralise').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Orthogonalize')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.tags = self.tr('rectangle,perpendicular,right,angles,square,quadrilateralise')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_LINE,
@@ -52,10 +52,12 @@ class PointsAlongGeometry(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'extract_nodes.png'))

def tags(self):
return self.tr('create,interpolate,points,lines').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Points along lines')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.tags = self.tr('create,interpolate,points,lines')

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'),
@@ -44,10 +44,12 @@ class PointsLayerFromTable(GeoAlgorithm):
OUTPUT = 'OUTPUT'
TARGET_CRS = 'TARGET_CRS'

def tags(self):
return self.tr('points,create,values,attributes').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Create points layer from table')
self.group, self.i18n_group = self.trAlgorithm('Vector creation tools')
self.tags = self.tr('points,create,values,attributes')
self.addParameter(ParameterTable(self.INPUT,
self.tr('Input layer')))
self.addParameter(ParameterTableField(self.XFIELD,
@@ -50,10 +50,12 @@ class PoleOfInaccessibility(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'centroids.png'))

def tags(self):
return self.tr('furthest,point,distant,extreme,maximum,centroid,center,centre').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Pole of Inaccessibility')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.tags = self.tr('furthest,point,distant,extreme,maximum,centroid,center,centre')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'),
@@ -47,10 +47,12 @@ class Polygonize(GeoAlgorithm):
FIELDS = 'FIELDS'
GEOMETRY = 'GEOMETRY'

def tags(self):
return self.tr('create,lines,polygons,convert').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Polygonize')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.tags = self.tr('create,lines,polygons,convert')
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_LINE]))
self.addParameter(ParameterBoolean(self.FIELDS,
@@ -47,10 +47,12 @@ class PolygonsToLines(GeoAlgorithm):
def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'ftools', 'to_lines.png'))

def tags(self):
return self.tr('line,polygon,convert').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Polygons to lines')
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.tags = self.tr('line,polygon,convert')

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POLYGON]))
@@ -36,10 +36,12 @@ class RemoveNullGeometry(GeoAlgorithm):
INPUT_LAYER = 'INPUT_LAYER'
OUTPUT_LAYER = 'OUTPUT_LAYER'

def tags(self):
return self.tr('remove,drop,delete,empty,geometry').split(',')

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Remove null geometries')
self.group, self.i18n_group = self.trAlgorithm('Vector selection tools')
self.tags = self.tr('remove,drop,delete,empty,geometry')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_ANY]))
Loading

0 comments on commit 28e7573

Please sign in to comment.