Skip to content
Permalink
Browse files

Fix indendation problems (as usual)...

  • Loading branch information
Médéric RIBREUX
Médéric RIBREUX committed Jan 2, 2016
1 parent af01652 commit d6fbe93f0a11b673dbb176a6e66b347cd05d6997
@@ -222,7 +222,7 @@ def processAlgorithm(self, progress):
raise GeoAlgorithmExecutionException(
self.tr('GRASS GIS 7 folder is not configured. Please '
'configure it before running GRASS GIS 7 algorithms.'))

# Create brand new commands lists
self.commands = []
self.outputCommands = []
@@ -244,13 +244,13 @@ def processAlgorithm(self, progress):
func(self)
else:
self.processInputs()

if hasattr(self.module, 'processCommand'):
func = getattr(self.module, 'processCommand')
func(self)
else:
self.processCommand()

if hasattr(self.module, 'processOutputs'):
func = getattr(self.module, 'processOutputs')
func(self)
@@ -389,7 +389,7 @@ def processCommand(self):
command += ' ' + param.name + '="' + unicode(param.value) + '"'
else:
command += ' ' + param.name + '="' + unicode(param.value) + '"'

for out in self.outputs:
if isinstance(out, OutputFile):
command += ' > ' + out.value
@@ -405,7 +405,7 @@ def processCommand(self):

command += ' --overwrite'
self.commands.append(command)

def processOutputs(self):
"""Prepare the GRASS v.out.ogr commands"""
for out in self.outputs:
@@ -416,7 +416,7 @@ def processOutputs(self):
# exporting
self.commands.append('g.region raster=' + out.name + self.uniqueSufix)
self.outputCommands.append('g.region raster=' + out.name
+ self.uniqueSufix)
+ self.uniqueSufix)

if self.grass7Name == 'r.statistics':
# r.statistics saves its results in a non-qgis compatible
@@ -477,7 +477,7 @@ def processOutputs(self):
command += ' output_layer=' + os.path.basename(out.value)[:-4]
self.commands.append(command)
self.outputCommands.append(command)

def exportVectorLayer(self, orgFilename):

# TODO: improve this. We are now exporting if it is not a shapefile,
@@ -27,5 +27,6 @@

from v_net import incorporatePoints


def processCommand(alg):
incorporatePoints(alg)
@@ -27,5 +27,6 @@

from v_net import incorporatePoints


def processCommand(alg):
incorporatePoints(alg)
@@ -27,7 +27,7 @@

from v_net import variableOutput


def processOutputs(alg):
outputParameter = { u"output": { u"method" : { 0: u"line", 1: u"point" } } }
outputParameter = {u"output": {u"method": {0: u"line", 1: u"point"}}}
variableOutput(alg, outputParameter)

@@ -27,6 +27,7 @@

from v_net import variableOutput


def processCommand(alg):
# remove the output for point
outPoint = alg.getOutputFromName(u'output_point')
@@ -39,8 +40,8 @@ def processCommand(alg):
# Re-add output for point
alg.addOutput(outPoint)


def processOutputs(alg):
outputParameter = { u"output": u"line",
u"output_point": u"point" }
outputParameter = {u"output": u"line",
u"output_point": u"point"}
variableOutput(alg, outputParameter)

@@ -27,23 +27,25 @@

from v_net import incorporatePoints, variableOutput


def checkParameterValuesBeforeExecuting(alg):
""" Verify if we have the right parameters """
params = [u'where', u'cats']
values = []
for param in params:
for i in range(1,3):
values.append(alg.getParameterValue(u'set{}_{}'.format(i,param)))
for i in range(1, 3):
values.append(alg.getParameterValue(u'set{}_{}'.format(i, param)))

if (values[0] or values[2]) and (values[1] or values[3]):
return None

return alg.tr("You need to set at least setX_where or setX_cats parameters for each set !")


def processCommand(alg):
incorporatePoints(alg)



def processOutputs(alg):
outputParameter = { u"output": u"point" }
outputParameter = {u"output": u"point"}
variableOutput(alg, outputParameter)

@@ -28,6 +28,7 @@

from processing.core.parameters import getParameterFromString, ParameterVector, ParameterNumber, ParameterBoolean, ParameterString


def processCommand(alg):
""" Handle data preparation for v.net.distance:
* Integrate point layers into network vector map.
@@ -51,15 +52,15 @@ def processCommand(alg):
for i, layer in enumerate([u'from', u'to']):
# Get a temp layer name
intLayer = alg.getTempFilename()

# Grab the from point layer and delete this parameter (not used by v.net.distance)
point_layer = alg.getParameterValue(layer + u'_points')
if point_layer:
point_layer = alg.exportedLayers[point_layer]
paramsToDelete.append(alg.getParameterFromName(layer + u'_points'))

# Create the v.net connect command for point layer integration
command = u"v.net -s input={} points={} out={} op=connect threshold={} arc_layer=1 node_layer={}".format( line_layer, point_layer, intLayer, threshold, i+2 )
command = u"v.net -s input={} points={} out={} op=connect threshold={} arc_layer=1 node_layer={}".format(line_layer, point_layer, intLayer, threshold, i + 2)
alg.commands.append(command)
line_layer = intLayer

@@ -68,20 +69,20 @@ def processCommand(alg):
if not parameter:
parameter = getParameterFromString(u'ParameterNumber|{0}_layer|{0} layer number|1|3|2|False'.format(layer))
alg.addParameter(parameter)
parameter.setValue(i+2)
parameter.setValue(i + 2)

# Make the connection with attribute table
command = u"v.db.connect -o map={} table={} layer={}".format(line_layer, point_layer, i+2)
command = u"v.db.connect -o map={} table={} layer={}".format(line_layer, point_layer, i + 2)
alg.commands.append(command)

alg.setParameterValue(u'input', line_layer)

# Delete some unnecessary parameters
for param in paramsToDelete:
alg.parameters.remove(param)

alg.processCommand()

# Bring back the parameters:
for param in paramsToDelete:
alg.parameters.append(param)
@@ -28,23 +28,26 @@

from v_net import incorporatePoints, processOutputs


def checkParameterValuesBeforeExecuting(alg):
""" Verify if we have the right parameters """
params = [u'where', u'cats']
values = []
for param in params:
for i in [u'source', u'sink']:
values.append(alg.getParameterValue(u'{}_{}'.format(i,param)))
values.append(alg.getParameterValue(u'{}_{}'.format(i, param)))

if (values[0] or values[2]) and (values[1] or values[3]):
return None

return alg.tr("You need to set at least source/sink_where or source/sink_cats parameters for each set !")


def processCommand(alg):
incorporatePoints(alg)


def processOutputs(alg):
outputParameter = { u"output": u"line",
u"cut": u"line" }
outputParameter = {u"output": u"line",
u"cut": u"line"}
variableOutput(alg, outputParameter)
@@ -27,5 +27,6 @@

from v_net import incorporatePoints


def processCommand(alg):
incorporatePoints(alg)
@@ -27,5 +27,6 @@

from v_net import incorporatePoints


def processCommand(alg):
incorporatePoints(alg)
@@ -28,6 +28,7 @@
from processing.core.parameters import getParameterFromString
from v_net import incorporatePoints


def processCommand(alg):
# We temporary remove the output 'sequence'
sequence = alg.getOutputFromName(u'sequence')
@@ -46,4 +47,3 @@ def processCommand(alg):
# then we delete the input parameter and add the old output
alg.parameters.remove(param)
alg.addOutput(sequence)

@@ -27,5 +27,6 @@

from v_net import incorporatePoints


def processCommand(alg):
incorporatePoints(alg)
@@ -27,6 +27,7 @@

from v_net import variableOutput


def processOutputs(alg):
outputParameter = { u"output": u"line" }
outputParameter = {u"output": u"line"}
variableOutput(alg, outputParameter, False)

0 comments on commit d6fbe93

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