Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] move some constants to the dataobjects module
  • Loading branch information
alexbruy committed Sep 2, 2016
1 parent 80653c7 commit 65db336
Show file tree
Hide file tree
Showing 149 changed files with 392 additions and 371 deletions.
Expand Up @@ -69,7 +69,7 @@ def defineCharacteristics(self):
# We add the input vector layer. It can have any kind of geometry
# It is a mandatory (not optional) one, hence the False argument
self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY], False))
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_ANY], False))

# We add a vector layer as output
self.addOutput(OutputVector(self.OUTPUT_LAYER,
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ClipByMask.py
Expand Up @@ -79,7 +79,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Extraction')
self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'), False))
self.addParameter(ParameterVector(self.MASK, self.tr('Mask layer'),
[ParameterVector.VECTOR_TYPE_POLYGON]))
[dataobjects.TYPE_VECTOR_POLYGON]))
self.addParameter(ParameterString(self.NO_DATA,
self.tr("Nodata value, leave blank to take the nodata value from input"),
'', optional=True))
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/gdal/GridAverage.py
Expand Up @@ -35,6 +35,7 @@
from processing.core.parameters import ParameterNumber
from processing.core.parameters import ParameterSelection
from processing.core.outputs import OutputRaster
from processing.tools import dataobjects
from processing.algs.gdal.GdalUtils import GdalUtils

pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
Expand Down Expand Up @@ -64,7 +65,7 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Moving average)')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Analysis')
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_POINT]))
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POINT]))
self.addParameter(ParameterTableField(self.Z_FIELD,
self.tr('Z field'), self.INPUT,
ParameterTableField.DATA_TYPE_NUMBER, True))
Expand Down
4 changes: 3 additions & 1 deletion python/plugins/processing/algs/gdal/GridDataMetrics.py
Expand Up @@ -35,8 +35,10 @@
from processing.core.parameters import ParameterSelection
from processing.core.parameters import ParameterNumber
from processing.core.outputs import OutputRaster
from processing.tools import dataobjects
from processing.algs.gdal.GdalUtils import GdalUtils


pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]


Expand Down Expand Up @@ -68,7 +70,7 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Data metrics)')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Analysis')
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_POINT]))
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POINT]))
self.addParameter(ParameterTableField(self.Z_FIELD,
self.tr('Z field'), self.INPUT,
ParameterTableField.DATA_TYPE_NUMBER, True))
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/gdal/GridInvDist.py
Expand Up @@ -37,6 +37,7 @@
from processing.core.parameters import ParameterSelection
from processing.core.outputs import OutputRaster
from processing.algs.gdal.GdalUtils import GdalUtils
from processing.tools import dataobjects

pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]

Expand Down Expand Up @@ -68,7 +69,7 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Inverse distance to a power)')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Analysis')
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_POINT]))
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POINT]))
self.addParameter(ParameterTableField(self.Z_FIELD,
self.tr('Z field'), self.INPUT,
ParameterTableField.DATA_TYPE_NUMBER, True))
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/gdal/GridNearest.py
Expand Up @@ -36,6 +36,7 @@
from processing.core.parameters import ParameterNumber
from processing.core.parameters import ParameterSelection
from processing.core.outputs import OutputRaster
from processing.tools import dataobjects
from processing.algs.gdal.GdalUtils import GdalUtils

pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
Expand Down Expand Up @@ -64,7 +65,7 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Grid (Nearest neighbor)')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Analysis')
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_POINT]))
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POINT]))
self.addParameter(ParameterTableField(self.Z_FIELD,
self.tr('Z field'), self.INPUT,
ParameterTableField.DATA_TYPE_NUMBER, True))
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/gdal/buildvrt.py
Expand Up @@ -36,6 +36,7 @@
from processing.core.parameters import ParameterSelection
from processing.algs.gdal.GdalUtils import GdalUtils
from processing.tools.system import tempFolder
from processing.tools import dataobjects

pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]

Expand All @@ -57,7 +58,7 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Build Virtual Raster')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Miscellaneous')
self.addParameter(ParameterMultipleInput(self.INPUT,
self.tr('Input layers'), ParameterMultipleInput.TYPE_RASTER))
self.tr('Input layers'), dataobjects.TYPE_RASTER))
self.addParameter(ParameterSelection(self.RESOLUTION,
self.tr('Resolution'), self.RESOLUTION_OPTIONS, 0))
self.addParameter(ParameterBoolean(self.SEPARATE,
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/gdal/gdaltindex.py
Expand Up @@ -34,6 +34,7 @@
from processing.core.parameters import ParameterBoolean
from processing.core.parameters import ParameterMultipleInput
from processing.core.parameters import ParameterString
from processing.tools import dataobjects
from processing.algs.gdal.GdalUtils import GdalUtils

pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
Expand All @@ -53,7 +54,7 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Tile Index')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Miscellaneous')
self.addParameter(ParameterMultipleInput(self.INPUT,
self.tr('Input layers'), ParameterMultipleInput.TYPE_RASTER))
self.tr('Input layers'), dataobjects.TYPE_RASTER))
self.addParameter(ParameterString(self.FIELD_NAME,
self.tr('Tile index field'),
'location', optional=True))
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/gdal/merge.py
Expand Up @@ -35,6 +35,7 @@
from processing.core.parameters import ParameterMultipleInput
from processing.core.parameters import ParameterSelection
from processing.tools.system import isWindows
from processing.tools import dataobjects
from processing.algs.gdal.GdalUtils import GdalUtils

pluginPath = os.path.split(os.path.split(os.path.dirname(__file__))[0])[0]
Expand All @@ -57,7 +58,7 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Merge')
self.group, self.i18n_group = self.trAlgorithm('[GDAL] Miscellaneous')
self.addParameter(ParameterMultipleInput(merge.INPUT,
self.tr('Input layers'), ParameterMultipleInput.TYPE_RASTER))
self.tr('Input layers'), dataobjects.TYPE_RASTER))
self.addParameter(ParameterBoolean(merge.PCT,
self.tr('Grab pseudocolor table from first layer'), False))
self.addParameter(ParameterBoolean(merge.SEPARATE,
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ogr2ogr.py
Expand Up @@ -102,7 +102,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[OGR] Conversion')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY], False))
self.tr('Input layer')))
self.addParameter(ParameterSelection(self.FORMAT,
self.tr('Destination Format'), FORMATS))
self.addParameter(ParameterString(self.OPTIONS,
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/gdal/ogr2ogrbuffer.py
Expand Up @@ -34,6 +34,7 @@
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils

from processing.tools import dataobjects
from processing.tools.system import isWindows
from processing.tools.vector import ogrConnectionString, ogrLayerName

Expand All @@ -54,7 +55,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[OGR] Geoprocessing')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY], False))
self.tr('Input layer')))
self.addParameter(ParameterString(self.GEOMETRY,
self.tr('Geometry column name ("geometry" for Shapefiles, may be different for other formats)'),
'geometry', optional=False))
Expand All @@ -70,7 +71,7 @@ def defineCharacteristics(self):
self.tr('Additional creation options (see ogr2ogr manual)'),
'', optional=True))

self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Buffer')))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Buffer'), datatype=[dataobjects.TYPE_VECTOR_POLYGON]))

def getConsoleCommands(self):
inLayer = self.getParameterValue(self.INPUT_LAYER)
Expand Down
7 changes: 4 additions & 3 deletions python/plugins/processing/algs/gdal/ogr2ogrclip.py
Expand Up @@ -32,6 +32,7 @@
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils

from processing.tools import dataobjects
from processing.tools.system import isWindows
from processing.tools.vector import ogrConnectionString, ogrLayerName

Expand All @@ -48,13 +49,13 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[OGR] Geoprocessing')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY], False))
self.tr('Input layer')))
self.addParameter(ParameterVector(self.CLIP_LAYER,
self.tr('Clip layer'), [ParameterVector.VECTOR_TYPE_POLYGON], False))
self.tr('Clip layer'), [dataobjects.TYPE_VECTOR_POLYGON]))
self.addParameter(ParameterString(self.OPTIONS,
self.tr('Additional creation options'), '', optional=True))

self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Clipped (polygon)')))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Clipped (polygon)'), datatype=[dataobjects.TYPE_VECTOR_POLYGON]))

def getConsoleCommands(self):
inLayer = self.getParameterValue(self.INPUT_LAYER)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ogr2ogrclipextent.py
Expand Up @@ -49,7 +49,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[OGR] Geoprocessing')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY], False))
self.tr('Input layer')))
self.addParameter(ParameterExtent(self.CLIP_EXTENT,
self.tr('Clip extent')))
self.addParameter(ParameterString(self.OPTIONS,
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/gdal/ogr2ogrdissolve.py
Expand Up @@ -34,6 +34,7 @@
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils

from processing.tools import dataobjects
from processing.tools.system import isWindows
from processing.tools.vector import ogrConnectionString, ogrLayerName

Expand All @@ -57,7 +58,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[OGR] Geoprocessing')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_POLYGON], False))
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_POLYGON]))
self.addParameter(ParameterString(self.GEOMETRY,
self.tr('Geometry column name ("geometry" for Shapefiles, may be different for other formats)'),
'geometry', optional=False))
Expand All @@ -79,7 +80,7 @@ def defineCharacteristics(self):
self.tr('Additional creation options (see ogr2ogr manual)'),
'', optional=True))

self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Dissolved')))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Dissolved'), datatype=[dataobjects.TYPE_VECTOR_POLYGON]))

def getConsoleCommands(self):
inLayer = self.getParameterValue(self.INPUT_LAYER)
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/gdal/ogr2ogronesidebuffer.py
Expand Up @@ -35,6 +35,7 @@
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils

from processing.tools import dataobjects
from processing.tools.system import isWindows
from processing.tools.vector import ogrConnectionString, ogrLayerName

Expand All @@ -59,7 +60,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[OGR] Geoprocessing')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_LINE], False))
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_LINE], False))
self.addParameter(ParameterSelection(self.OPERATION,
self.tr('Operation'), self.OPERATIONLIST, 0))
self.addParameter(ParameterString(self.GEOMETRY,
Expand Down
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/gdal/ogr2ogrpointsonlines.py
Expand Up @@ -33,6 +33,7 @@
from processing.algs.gdal.GdalAlgorithm import GdalAlgorithm
from processing.algs.gdal.GdalUtils import GdalUtils

from processing.tools import dataobjects
from processing.tools.system import isWindows
from processing.tools.vector import ogrConnectionString, ogrLayerName

Expand All @@ -50,7 +51,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('[OGR] Geoprocessing')

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_LINE], False))
self.tr('Input layer'), [dataobjects.TYPE_VECTOR_LINE], False))
self.addParameter(ParameterString(self.GEOMETRY,
self.tr('Geometry column name ("geometry" for Shapefiles, may be different for other formats)'),
'geometry', optional=False))
Expand All @@ -60,7 +61,7 @@ def defineCharacteristics(self):
self.tr('Additional creation options (see ogr2ogr manual)'),
'', optional=True))

self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Points along lines')))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Points along lines'), datatype=[dataobjects.TYPE_VECTOR_POINT]))

def getConsoleCommands(self):
inLayer = self.getParameterValue(self.INPUT_LAYER)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/ogr2ogrtopostgis.py
Expand Up @@ -81,7 +81,7 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Import Vector into PostGIS database (new connection)')
self.group, self.i18n_group = self.trAlgorithm('[OGR] Miscellaneous')
self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY], False))
self.tr('Input layer')))
self.addParameter(ParameterString(self.SHAPE_ENCODING,
self.tr('Shape encoding'), "", optional=True))
self.addParameter(ParameterSelection(self.GTYPE,
Expand Down
Expand Up @@ -98,7 +98,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterSelection(self.DATABASE,
self.tr('Database (connection name)'), self.DB_CONNECTIONS))
self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY], False))
self.tr('Input layer')))
self.addParameter(ParameterString(self.SHAPE_ENCODING,
self.tr('Shape encoding'), "", optional=True))
self.addParameter(ParameterSelection(self.GTYPE,
Expand Down
3 changes: 1 addition & 2 deletions python/plugins/processing/algs/gdal/ogrinfo.py
Expand Up @@ -47,8 +47,7 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Information')
self.group, self.i18n_group = self.trAlgorithm('[OGR] Miscellaneous')

self.addParameter(ParameterVector(self.INPUT, self.tr('Input layer'),
[ParameterVector.VECTOR_TYPE_ANY], False))
self.addParameter(ParameterVector(self.INPUT, self.tr('Input layer')))
self.addParameter(ParameterBoolean(self.SUMMARY_ONLY,
self.tr('Summary output only'),
True))
Expand Down
3 changes: 1 addition & 2 deletions python/plugins/processing/algs/gdal/ogrsql.py
Expand Up @@ -51,8 +51,7 @@ def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Execute SQL')
self.group, self.i18n_group = self.trAlgorithm('[OGR] Miscellaneous')

self.addParameter(ParameterVector(self.INPUT, self.tr('Input layer'),
[ParameterVector.VECTOR_TYPE_ANY], False))
self.addParameter(ParameterVector(self.INPUT, self.tr('Input layer')))
self.addParameter(ParameterString(self.SQL, self.tr('SQL'), ''))

self.addParameter(ParameterSelection(
Expand Down
3 changes: 2 additions & 1 deletion python/plugins/processing/algs/gdal/retile.py
Expand Up @@ -34,6 +34,7 @@
from processing.core.parameters import ParameterBoolean
from processing.core.outputs import OutputDirectory
from processing.tools.system import isWindows
from processing.tools import dataobjects
from processing.algs.gdal.GdalUtils import GdalUtils
import re

Expand Down Expand Up @@ -71,7 +72,7 @@ def defineCharacteristics(self):
# Required parameters
self.addParameter(ParameterMultipleInput(self.INPUT,
self.tr('Input layers'),
ParameterMultipleInput.TYPE_RASTER))
dataobjects.TYPE_RASTER))
# Advanced parameters
params = []
params.append(ParameterString(self.PIXELSIZE,
Expand Down

0 comments on commit 65db336

Please sign in to comment.