Skip to content

Commit

Permalink
[processing] add support for ParameterPoint to major algorothm providers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Feb 29, 2016
1 parent 841de7e commit dd68c33
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 9 deletions.
20 changes: 18 additions & 2 deletions python/plugins/processing/algs/grass/GrassAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,22 @@
from processing.core.ProcessingLog import ProcessingLog
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException

from processing.core.parameters import getParameterFromString, ParameterVector, ParameterMultipleInput, ParameterExtent, ParameterNumber, ParameterSelection, ParameterRaster, ParameterTable, ParameterBoolean, ParameterString
from processing.core.outputs import getOutputFromString, OutputRaster, OutputVector, OutputFile, OutputHTML
from processing.core.parameters import (getParameterFromString,
ParameterVector,
ParameterMultipleInput,
ParameterExtent,
ParameterNumber,
ParameterSelection,
ParameterRaster,
ParameterTable,
ParameterBoolean,
ParameterString,
ParameterPoint)
from processing.core.outputs import (getOutputFromString,
OutputRaster,
OutputVector,
OutputFile,
OutputHTML)

from GrassUtils import GrassUtils

Expand Down Expand Up @@ -332,6 +346,8 @@ def processAlgorithm(self, progress):
command += ' ' + param.name + '=' + unicode(param.options[idx])
elif isinstance(param, ParameterString):
command += ' ' + param.name + '="' + unicode(param.value) + '"'
elif isinstance(param, ParameterPoint):
command += ' ' + param.name + '=' + unicode(param.value)
else:
command += ' ' + param.name + '="' + unicode(param.value) + '"'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ r.lake.coords - Fills lake at given point to given level.
Raster (r.*)
ParameterRaster|dem|Elevation|False
ParameterNumber|wl|Water level|None|None|1000.0
ParameterString|xy|Seed point coordinates|0,0
ParameterPoint|xy|Seed point coordinates|
ParameterBoolean|-n|Use negative depth values for lake raster layer|False
OutputRaster|lake|Lake
20 changes: 18 additions & 2 deletions python/plugins/processing/algs/grass7/Grass7Algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,22 @@
from processing.core.ProcessingLog import ProcessingLog
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException

from processing.core.parameters import getParameterFromString, ParameterVector, ParameterMultipleInput, ParameterExtent, ParameterNumber, ParameterSelection, ParameterRaster, ParameterTable, ParameterBoolean, ParameterString
from processing.core.outputs import getOutputFromString, OutputRaster, OutputVector, OutputFile, OutputHTML
from processing.core.parameters import (getParameterFromString,
ParameterVector,
ParameterMultipleInput,
ParameterExtent,
ParameterNumber,
ParameterSelection,
ParameterRaster,
ParameterTable,
ParameterBoolean,
ParameterString,
ParameterPoint)
from processing.core.outputs import (getOutputFromString,
OutputRaster,
OutputVector,
OutputFile,
OutputHTML)

from Grass7Utils import Grass7Utils

Expand Down Expand Up @@ -390,6 +404,8 @@ def processCommand(self):
command += ' ' + param.name + '=' + unicode(param.options[idx])
elif isinstance(param, ParameterString):
command += ' ' + param.name + '="' + unicode(param.value) + '"'
elif isinstance(param, ParameterPoint):
command += ' ' + param.name + '=' + unicode(param.value)
else:
command += ' ' + param.name + '="' + unicode(param.value) + '"'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ r.water.outlet
Watershed basin creation program.
Raster (r.*)
ParameterRaster|input|Name of input raster map|False
ParameterString|coordinates|Coordinates of outlet point|
ParameterPoint|coordinates|Coordinates of outlet point|
OutputRaster|output|Basin
3 changes: 3 additions & 0 deletions python/plugins/processing/algs/r/RAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from processing.core.parameters import ParameterTableField
from processing.core.parameters import ParameterExtent
from processing.core.parameters import ParameterFile
from processing.core.parameters import ParameterPoint
from processing.core.outputs import OutputTable
from processing.core.outputs import OutputVector
from processing.core.outputs import OutputRaster
Expand Down Expand Up @@ -199,6 +200,8 @@ def processParameterLine(self, line):
param = ParameterTableField(tokens[0], tokens[0], field)
elif tokens[1].lower().strip() == 'extent':
param = ParameterExtent(tokens[0], desc)
elif tokens[1].lower().strip() == 'point':
param = ParameterPoint(tokens[0], desc)
elif tokens[1].lower().strip() == 'file':
param = ParameterFile(tokens[0], desc, False)
elif tokens[1].lower().strip() == 'folder':
Expand Down
18 changes: 15 additions & 3 deletions python/plugins/processing/algs/saga/SagaAlgorithm212.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,24 @@
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.ProcessingLog import ProcessingLog
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.parameters import getParameterFromString, ParameterExtent, ParameterRaster, ParameterVector, ParameterTable, ParameterMultipleInput, ParameterBoolean, ParameterFixedTable, ParameterNumber, ParameterSelection
from processing.core.outputs import getOutputFromString, OutputTable, OutputVector, OutputRaster
import SagaUtils
from processing.core.parameters import (getParameterFromString,
ParameterExtent,
ParameterRaster,
ParameterVector,
ParameterTable,
ParameterMultipleInput,
ParameterBoolean,
ParameterFixedTable,
ParameterNumber,
ParameterSelection)
from processing.core.outputs import (getOutputFromString,
OutputTable,
OutputVector,
OutputRaster)
from processing.tools import dataobjects
from processing.tools.system import getTempFilename, getTempFilenameInTempFolder
from processing.algs.saga.SagaNameDecorator import *
import SagaUtils

pluginPath = os.path.normpath(os.path.join(
os.path.split(os.path.dirname(__file__))[0], os.pardir))
Expand Down
3 changes: 3 additions & 0 deletions python/plugins/processing/script/ScriptAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from processing.core.parameters import ParameterTableField
from processing.core.parameters import ParameterExtent
from processing.core.parameters import ParameterFile
from processing.core.parameters import ParameterPoint
from processing.core.parameters import getParameterFromString
from processing.core.outputs import OutputTable
from processing.core.outputs import OutputVector
Expand Down Expand Up @@ -223,6 +224,8 @@ def processInputParameterToken(self, token, name):
param = ParameterBoolean(name, descName)
elif token.lower().strip() == 'extent':
param = ParameterExtent(name, descName)
elif token.lower().strip() == 'point':
param = ParameterPoint(name, descName)
elif token.lower().strip() == 'file':
param = ParameterFile(name, descName, False)
elif token.lower().strip() == 'folder':
Expand Down

0 comments on commit dd68c33

Please sign in to comment.