partially fixed #6374
This commit is contained in:
Victor Olaya 2012-10-02 09:14:23 +02:00
parent 9d8b9fcb38
commit 1549f09eb2
4 changed files with 13 additions and 10 deletions

View File

@ -22,6 +22,7 @@ import time
class ModelerAlgorithm(GeoAlgorithm):
CANVAS_SIZE = 4000
LINE_BREAK_STRING="%%%"
def getCopy(self):
newone = ModelerAlgorithm()
@ -89,8 +90,9 @@ class ModelerAlgorithm(GeoAlgorithm):
self.paramPos.append(QtCore.QPointF(float(tokens[0]), float(tokens[1])))
elif line.startswith("VALUE:"):
valueLine = line[len("VALUE:"):]
tokens = valueLine.split("=")
self.paramValues[tokens[0]] = tokens[1]
tokens = valueLine.split("===")
self.paramValues[tokens[0]] = tokens[1].replace(ModelerAlgorithm.LINE_BREAK_STRING, '\n')
elif line.startswith("NAME:"):
self.name = line[len("NAME:"):]
elif line.startswith("GROUP:"):
@ -289,7 +291,7 @@ class ModelerAlgorithm(GeoAlgorithm):
s += str(pt.x()) + "," + str(pt.y()) + "\n"
i+=1
for key in self.paramValues.keys():
s += "VALUE:" + key + "=" + str(self.paramValues[key]) + "\n"
s += "VALUE:" + key + "===" + str(self.paramValues[key]).replace('\n', ModelerAlgorithm.LINE_BREAK_STRING) + "\n"
for i in range(len(self.algs)):
alg = self.algs[i]
s+="ALGORITHM:" + alg.commandLineName()+"\n"

View File

@ -9,9 +9,9 @@ class ParameterFixedTable(Parameter):
self.fixedNumOfRows = fixedNumOfRows
self.value = None
def setValue(self, obj):
##TODO: check that it contains a correct number of elements
if isinstance(obj, str):
def setValue(self, obj):
##TODO: check that it contains a correct number of elements
if isinstance(obj, (str,unicode)):
self.value = obj
else:
self.value = ParameterFixedTable.tableToString(obj)
@ -21,7 +21,7 @@ class ParameterFixedTable(Parameter):
return "\"" + str(self.value) + "\""
@staticmethod
def tableToString(table):
def tableToString(table):
tablestring = ""
for i in range(len(table)):
for j in range(len(table[0])):

View File

@ -19,6 +19,7 @@ from sextante.core.SextanteLog import SextanteLog
from sextante.parameters.ParameterFactory import ParameterFactory
from sextante.outputs.OutputFactory import OutputFactory
from sextante.core.SextanteConfig import SextanteConfig
from sextante.core.SextanteLog import SextanteLog
from sextante.core.QGisLayers import QGisLayers
from sextante.parameters.ParameterNumber import ParameterNumber
from sextante.parameters.ParameterSelection import ParameterSelection
@ -195,7 +196,7 @@ class SagaAlgorithm(GeoAlgorithm):
if layer:
filename = LayerExporter.exportVectorLayer(layer)
self.exportedLayers[layerfile]=filename
elif (not value.endswith("shp")):
elif (not layerfile.endswith("shp")):
raise GeoAlgorithmExecutionException("Unsupported file format")
#2: set parameters and outputs
@ -225,7 +226,7 @@ class SagaAlgorithm(GeoAlgorithm):
tempTableFile = SextanteUtils.getTempFilename("txt")
f = open(tempTableFile, "w")
f.write('\t'.join([col for col in param.cols]) + "\n")
values = param.value.split(",")
values = param.value.split(",")
for i in range(0, len(values), 3):
s = values[i] + "\t" + values[i+1] + "\t" + values[i+2] + "\n"
f.write(s)

View File

@ -36,7 +36,7 @@ References:<br/>
<dt>Time Span [h] <div class='type'>Value range</div></dt><dd>Time span used for the calculation of daily radiation sums. <div class='constraints'>Minimum: 1.39579710889e-316; Maximum: 1.395734659e-316</div></dd>
<dt>Time Resolution [h]: Day <div class='type'>Floating point</div></dt><dd>Time step size for a day's calculation given in hours. <div class='constraints'>Maximum: 24.0</div></dd>
<dt>Time Resolution [d]: Range of Days <div class='type'>Integer</div></dt><dd>Time step size for a range of days calculation given in days. <div class='constraints'>Minimum: 1.0</div></dd>
<dt>Update <div class='type'>Choice</div></dt><dd>show direct insolation for each time step. <div class='constraints'>Available choices: do not update, update, color stretch for each time step, update, fixed color stretch</div></dd>
<dt>Update <div class='type'>Choice</div></dt><dd>show direct insolation for each time step. <div class='constraints'>Available choices: do not update, update, colour stretch for each time step, update, fixed colour stretch</div></dd>
<dt>Day of Year <div class='type'>Node</div></dt><dd> <div class='constraints'></div></dd>
<dt>Day of Month <div class='type'>Choice</div></dt><dd> <div class='constraints'>Available choices: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31</div></dd>
<dt>Month <div class='type'>Choice</div></dt><dd> <div class='constraints'>Available choices: January, February, March, April, May, June, July, August, September, October, November, December</div></dd>