Skip to content
Permalink
Browse files
improved r and saga behaviour, specially on linux; changed some grass…
… descriptions

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@54 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed Mar 27, 2012
1 parent 9dbfabc commit 4dbb90e7c355deba25b756d0c902334d9beb491a
Showing with 2,207 additions and 1,912 deletions.
  1. +1 −4 build.xml
  2. +339 −0 license.txt
  3. +3 −2 src/sextante/about/about.htm
  4. +3 −1 src/sextante/core/AlgorithmProvider.py
  5. +20 −12 src/sextante/core/GeoAlgorithm.py
  6. +2 −0 src/sextante/core/QGisLayers.py
  7. +21 −13 src/sextante/core/Sextante.py
  8. +1 −1 src/sextante/ftools/copyright.txt
  9. +32 −23 src/sextante/grass/GrassAlgorithm.py
  10. +18 −5 src/sextante/grass/GrassAlgorithmProvider.py
  11. +28 −4 src/sextante/grass/GrassUtils.py
  12. +1 −1 src/sextante/grass/description/alg_0.txt
  13. +1 −1 src/sextante/grass/description/alg_1.txt
  14. +13 −4 src/sextante/grass/description/alg_10.txt
  15. +18 −6 src/sextante/grass/description/alg_100.txt
  16. +25 −8 src/sextante/grass/description/alg_101.txt
  17. +4 −14 src/sextante/grass/description/alg_102.txt
  18. +9 −5 src/sextante/grass/description/alg_103.txt
  19. +6 −13 src/sextante/grass/description/alg_104.txt
  20. +9 −10 src/sextante/grass/description/alg_105.txt
  21. +5 −3 src/sextante/grass/description/alg_106.txt
  22. +5 −10 src/sextante/grass/description/alg_107.txt
  23. +16 −10 src/sextante/grass/description/alg_108.txt
  24. +4 −3 src/sextante/grass/description/alg_109.txt
  25. +9 −8 src/sextante/grass/description/alg_11.txt
  26. +8 −5 src/sextante/grass/description/alg_110.txt
  27. +11 −6 src/sextante/grass/description/alg_111.txt
  28. +5 −8 src/sextante/grass/description/alg_112.txt
  29. +8 −10 src/sextante/grass/description/alg_113.txt
  30. +6 −6 src/sextante/grass/description/alg_114.txt
  31. +6 −21 src/sextante/grass/description/alg_115.txt
  32. +11 −8 src/sextante/grass/description/alg_116.txt
  33. +6 −14 src/sextante/grass/description/alg_117.txt
  34. +4 −6 src/sextante/grass/description/alg_118.txt
  35. +22 −6 src/sextante/grass/description/alg_119.txt
  36. +10 −14 src/sextante/grass/description/alg_12.txt
  37. +8 −9 src/sextante/grass/description/alg_120.txt
  38. +3 −5 src/sextante/grass/description/alg_121.txt
  39. +5 −30 src/sextante/grass/description/alg_122.txt
  40. +19 −17 src/sextante/grass/description/alg_123.txt
  41. +15 −25 src/sextante/grass/description/alg_124.txt
  42. +8 −9 src/sextante/grass/description/alg_125.txt
  43. +6 −7 src/sextante/grass/description/alg_126.txt
  44. +7 −10 src/sextante/grass/description/alg_127.txt
  45. +4 −5 src/sextante/grass/description/alg_128.txt
  46. +11 −7 src/sextante/grass/description/alg_129.txt
  47. +10 −16 src/sextante/grass/description/alg_13.txt
  48. +7 −5 src/sextante/grass/description/alg_130.txt
  49. +12 −9 src/sextante/grass/description/alg_131.txt
  50. +8 −11 src/sextante/grass/description/alg_132.txt
  51. +19 −5 src/sextante/grass/description/alg_133.txt
  52. +8 −5 src/sextante/grass/description/alg_134.txt
  53. +5 −6 src/sextante/grass/description/alg_135.txt
  54. +8 −9 src/sextante/grass/description/alg_136.txt
  55. +8 −6 src/sextante/grass/description/alg_137.txt
  56. +5 −6 src/sextante/grass/description/alg_138.txt
  57. +3 −22 src/sextante/grass/description/alg_139.txt
  58. +3 −7 src/sextante/grass/description/alg_14.txt
  59. +8 −5 src/sextante/grass/description/alg_140.txt
  60. +13 −5 src/sextante/grass/description/alg_141.txt
  61. +16 −19 src/sextante/grass/description/alg_142.txt
  62. +18 −6 src/sextante/grass/description/alg_143.txt
  63. +5 −6 src/sextante/grass/description/alg_144.txt
  64. +15 −4 src/sextante/grass/description/alg_145.txt
  65. +13 −4 src/sextante/grass/description/alg_146.txt
  66. +6 −11 src/sextante/grass/description/alg_147.txt
  67. +6 −7 src/sextante/grass/description/alg_148.txt
  68. +4 −10 src/sextante/grass/description/alg_149.txt
  69. +10 −8 src/sextante/grass/description/alg_15.txt
  70. +8 −20 src/sextante/grass/description/alg_150.txt
  71. +10 −9 src/sextante/grass/description/alg_151.txt
  72. +14 −11 src/sextante/grass/description/alg_152.txt
  73. +5 −8 src/sextante/grass/description/alg_153.txt
  74. +2 −3 src/sextante/grass/description/alg_154.txt
  75. +6 −3 src/sextante/grass/description/alg_155.txt
  76. +11 −8 src/sextante/grass/description/alg_156.txt
  77. +10 −12 src/sextante/grass/description/alg_157.txt
  78. +9 −16 src/sextante/grass/description/alg_158.txt
  79. +20 −21 src/sextante/grass/description/alg_159.txt
  80. +11 −5 src/sextante/grass/description/alg_16.txt
  81. +6 −16 src/sextante/grass/description/alg_160.txt
  82. +9 −5 src/sextante/grass/description/alg_161.txt
  83. +9 −6 src/sextante/grass/description/alg_162.txt
  84. +11 −6 src/sextante/grass/description/alg_163.txt
  85. +11 −5 src/sextante/grass/description/alg_164.txt
  86. +11 −10 src/sextante/grass/description/alg_165.txt
  87. +6 −12 src/sextante/grass/description/alg_166.txt
  88. +4 −5 src/sextante/grass/description/alg_167.txt
  89. +4 −4 src/sextante/grass/description/alg_168.txt
  90. +19 −7 src/sextante/grass/description/alg_169.txt
  91. +5 −9 src/sextante/grass/description/alg_17.txt
  92. +6 −10 src/sextante/grass/description/alg_170.txt
  93. +7 −19 src/sextante/grass/description/alg_171.txt
  94. +6 −8 src/sextante/grass/description/alg_172.txt
  95. +8 −8 src/sextante/grass/description/alg_173.txt
  96. +5 −9 src/sextante/grass/description/alg_174.txt
  97. +5 −11 src/sextante/grass/description/alg_175.txt
  98. +4 −12 src/sextante/grass/description/alg_176.txt
  99. +6 −11 src/sextante/grass/description/alg_177.txt
  100. +7 −6 src/sextante/grass/description/alg_178.txt
  101. +21 −4 src/sextante/grass/description/alg_18.txt
  102. +11 −19 src/sextante/grass/description/alg_19.txt
  103. +13 −4 src/sextante/grass/description/alg_2.txt
  104. +4 −7 src/sextante/grass/description/alg_20.txt
  105. +5 −4 src/sextante/grass/description/alg_21.txt
  106. +18 −10 src/sextante/grass/description/alg_22.txt
  107. +5 −5 src/sextante/grass/description/alg_23.txt
  108. +5 −5 src/sextante/grass/description/alg_24.txt
  109. +33 −6 src/sextante/grass/description/alg_25.txt
  110. +7 −6 src/sextante/grass/description/alg_26.txt
  111. +11 −8 src/sextante/grass/description/alg_27.txt
  112. +8 −9 src/sextante/grass/description/alg_28.txt
  113. +11 −8 src/sextante/grass/description/alg_29.txt
  114. +10 −7 src/sextante/grass/description/alg_3.txt
  115. +2 −19 src/sextante/grass/description/alg_30.txt
  116. +5 −7 src/sextante/grass/description/alg_31.txt
  117. +3 −7 src/sextante/grass/description/alg_32.txt
  118. +7 −3 src/sextante/grass/description/alg_33.txt
  119. +12 −15 src/sextante/grass/description/alg_34.txt
  120. +8 −10 src/sextante/grass/description/alg_35.txt
  121. +4 −10 src/sextante/grass/description/alg_36.txt
  122. +6 −3 src/sextante/grass/description/alg_37.txt
  123. +5 −10 src/sextante/grass/description/alg_38.txt
  124. +4 −11 src/sextante/grass/description/alg_39.txt
  125. +7 −5 src/sextante/grass/description/alg_4.txt
  126. +4 −20 src/sextante/grass/description/alg_40.txt
  127. +5 −10 src/sextante/grass/description/alg_41.txt
  128. +18 −4 src/sextante/grass/description/alg_42.txt
  129. +22 −7 src/sextante/grass/description/alg_43.txt
  130. +3 −16 src/sextante/grass/description/alg_44.txt
  131. +5 −0 src/sextante/grass/description/alg_44b.txt
  132. +11 −4 src/sextante/grass/description/alg_45.txt
  133. +5 −32 src/sextante/grass/description/alg_46.txt
  134. +9 −12 src/sextante/grass/description/alg_47.txt
  135. +4 −12 src/sextante/grass/description/alg_48.txt
  136. +4 −7 src/sextante/grass/description/alg_49.txt
  137. +6 −11 src/sextante/grass/description/alg_5.txt
  138. +9 −2 src/sextante/grass/description/alg_50.txt
  139. +5 −8 src/sextante/grass/description/alg_51.txt
  140. +8 −5 src/sextante/grass/description/alg_52.txt
  141. +11 −8 src/sextante/grass/description/alg_53.txt
  142. +7 −10 src/sextante/grass/description/alg_54.txt
  143. +12 −5 src/sextante/grass/description/alg_55.txt
  144. +5 −11 src/sextante/grass/description/alg_56.txt
  145. +5 −4 src/sextante/grass/description/alg_57.txt
  146. +6 −3 src/sextante/grass/description/alg_58.txt
  147. +9 −4 src/sextante/grass/description/alg_59.txt
  148. +8 −5 src/sextante/grass/description/alg_6.txt
  149. +4 −18 src/sextante/grass/description/alg_60.txt
  150. +12 −22 src/sextante/grass/description/alg_61.txt
  151. +3 −4 src/sextante/grass/description/alg_62.txt
  152. +8 −13 src/sextante/grass/description/alg_63.txt
  153. +16 −8 src/sextante/grass/description/alg_64.txt
  154. +7 −2 src/sextante/grass/description/alg_65.txt
  155. +10 −5 src/sextante/grass/description/alg_66.txt
  156. +29 −6 src/sextante/grass/description/alg_67.txt
  157. +8 −4 src/sextante/grass/description/alg_68.txt
  158. +6 −7 src/sextante/grass/description/alg_69.txt
  159. +8 −10 src/sextante/grass/description/alg_7.txt
  160. +16 −6 src/sextante/grass/description/alg_70.txt
  161. +5 −12 src/sextante/grass/description/alg_71.txt
  162. +6 −4 src/sextante/grass/description/alg_72.txt
  163. +7 −5 src/sextante/grass/description/alg_73.txt
  164. +5 −8 src/sextante/grass/description/alg_74.txt
  165. +14 −5 src/sextante/grass/description/alg_75.txt
  166. +18 −12 src/sextante/grass/description/alg_76.txt
  167. +5 −4 src/sextante/grass/description/alg_77.txt
  168. +11 −11 src/sextante/grass/description/alg_78.txt
  169. +11 −17 src/sextante/grass/description/alg_79.txt
  170. +9 −9 src/sextante/grass/description/alg_8.txt
  171. +23 −10 src/sextante/grass/description/alg_80.txt
  172. +5 −32 src/sextante/grass/description/alg_81.txt
  173. +18 −7 src/sextante/grass/description/alg_82.txt
  174. +3 −16 src/sextante/grass/description/alg_83.txt
  175. +15 −4 src/sextante/grass/description/alg_84.txt
  176. +7 −6 src/sextante/grass/description/alg_85.txt
  177. +8 −9 src/sextante/grass/description/alg_86.txt
  178. +11 −6 src/sextante/grass/description/alg_87.txt
  179. +20 −14 src/sextante/grass/description/alg_88.txt
  180. +5 −18 src/sextante/grass/description/alg_89.txt
  181. +4 −5 src/sextante/grass/description/alg_9.txt
  182. +21 −10 src/sextante/grass/description/alg_90.txt
  183. +6 −24 src/sextante/grass/description/alg_91.txt
  184. +9 −6 src/sextante/grass/description/alg_92.txt
  185. +14 −18 src/sextante/grass/description/alg_93.txt
  186. +8 −6 src/sextante/grass/description/alg_94.txt
  187. +6 −15 src/sextante/grass/description/alg_95.txt
  188. +14 −8 src/sextante/grass/description/alg_96.txt
  189. +9 −8 src/sextante/grass/description/alg_97.txt
  190. +6 −11 src/sextante/grass/description/alg_98.txt
  191. +29 −19 src/sextante/grass/description/alg_99.txt
  192. +14 −17 src/sextante/gui/EditRenderingStylesDialog.py
  193. +5 −2 src/sextante/gui/HTMLViewerDialog.py
  194. +7 −12 src/sextante/gui/ParametersDialog.py
  195. +4 −4 src/sextante/gui/SextantePostprocessing.py
  196. +9 −0 src/sextante/mmqgis/copyright.txt
  197. +3 −0 src/sextante/modeler/ModelerAlgorithm.py
  198. +22 −21 src/sextante/modeler/ModelerParametersDialog.py
  199. +1 −0 src/sextante/outputs/Output.py
  200. +2 −1 src/sextante/outputs/OutputFactory.py
  201. +9 −0 src/sextante/outputs/OutputNumber.py
  202. +2 −2 src/sextante/r/RAlgorithm.py
  203. +5 −3 src/sextante/r/RUtils.py
  204. +7 −119 src/sextante/saga/SagaAlgorithm.py
  205. +3 −7 src/sextante/saga/SagaAlgorithmProvider.py
  206. +3 −2 src/sextante/saga/SagaUtils.py
  207. +1 −0 src/sextante/saga/description/alg_120.txt
  208. +4 −0 src/sextante/script/ScriptAlgorithm.py
@@ -2,14 +2,11 @@
<description>
SEXTANTE
</description>
<property name="version.number" value="0.1"/>

<property name="version.number" value="1.0"/>
<target name="copy"
description="copy files">

<copy todir="C:/Users/volaya/.qgis/python/plugins/sextante">
<fileset dir="src/sextante" includes="**"/>
</copy>

</target>
</project>

Large diffs are not rendered by default.

@@ -1,13 +1,14 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<title>SEXTANTE Spatial Data Analysis Library</title>
<title>SEXTANTE</title>
</head>
<body>
<img src="sextante_logo.png" />
<h2>SEXTANTE for QGIS</h2>
<p>SEXTANTE, a geoprocessing platform for QGIS</p>
<p>A development by Victor Olaya (volayaf@gmail.com)</p>
<p>A development by Victor Olaya (volayaf@gmail.com). Portions of this software by Michael Nimm and Carson Farmer</p>
<p>You are currently using SEXTANTE v1.0</p>
<p>This software is distributed under the terms of the GNU GPL License v2.
<p>For more information, please visit our website at <a href="http://sextantegis.com">http://sextantegis.com</a></p>
</body>
</html>
@@ -22,7 +22,9 @@ def loadAlgorithms(self):
#methods to be overridden.
#==============================

#Algorithm loading should take place here
#Algorithm loading should take place here, filling sefl.algs
#Since algorithms should have a reference to the provider they come
#from, this is also the place to set the 'provider' variable of each algorithm
def _loadAlgorithms(self):
pass

@@ -11,24 +11,30 @@
class GeoAlgorithm:

def __init__(self):
#parameters needed by the algorithm
self.parameters = list()
#outputs generated by the algorithm
self.outputs = list()
self.name = ""
self.group = ""
self.defineCharacteristics()
self.providerName = ""
#the crs taken from input layers (if possible), and used when loading output layers
self.crs = None
self.helpfile = None

#methods to overwrite when creating a custom geoalgorithm
#=========================================================
def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/alg.png")

def helpFile(self):
return None

def processAlgorithm(self):
'''here goes the algorithm itself'''
pass

def defineCharacteristics(self):
'''here is where the parameters and outputs should be filled'''
pass

#=========================================================
@@ -39,6 +45,7 @@ def execute(self, progress):
self.processAlgorithm(progress)

def resolveTemporaryOutputs(self):
'''sets temporary outputs (output.value = None) with a temporary file instead)'''
for out in self.outputs:
if out.value == None:
SextanteUtils.setTempOutput(out, self)
@@ -77,21 +84,28 @@ def setOutputValue(self, outputName, value):
if out.name == outputName:
out.value = value

def getVisibleOutputsCount(self):
'''returns the number of non-hidden outputs'''
i = 0;
for out in self.outputs:
if not out.hidden:
i+=1
return i;

def getOutputValuesAsDictionary(self):
d = {}
for out in self.outputs:
d[out.name] = out.value
return d

def canBeExecuted(self, layersCount):
return True

def __str__(self):
s = "ALGORITHM: " + self.name + "\n"
for param in self.parameters:
s+=("\t" + str(param) + "\n")
for out in self.outputs:
s+=("\t" + str(out) + "\n")
if not out.hidden:
s+=("\t" + str(out) + "\n")
s+=("\n")
return s

@@ -113,13 +127,6 @@ def getParameterFromName(self, name):
def getParameterValue(self, name):
for param in self.parameters:
if param.name == name:
#===============================================================
# if isinstance(param, ParameterNumber):
# return float(param.value)
# elif isinstance(param, ParameterBoolean):
# return param.value == str(True)
# else:
#===============================================================
return param.value
return None

@@ -131,6 +138,7 @@ def getOutputValue(self, name):


def getAsCommand(self):
'''Returns the command that would run this same algorithm from the console'''
s="Sextante.runalg(\"" + self.commandLineName() + "\","
for param in self.parameters:
s+=param.getValueAsCommandLineParameter() + ","
@@ -7,6 +7,8 @@
import os.path

class QGisLayers:
'''This class contains method to communicate SEXTANTE with the QGIS interface,
mostly for retrieving layers and adding new ones to the QGIS canvas'''

ALL_TYPES = -1
iface = None;
@@ -23,7 +23,7 @@ class Sextante:
iface = None
providers = [SagaAlgorithmProvider(), ScriptAlgorithmProvider(),
MMQGISAlgorithmProvider(), FToolsAlgorithmProvider(),
RAlgorithmProvider()]##, GrassAlgorithmProvider()]
RAlgorithmProvider()]#, GrassAlgorithmProvider()]
algs = {}
actions = {}
contextMenuActions = []
@@ -134,8 +134,10 @@ def getAlgorithm(name):
return provider[name]
return None


##This methods are here to be used from the python console,
##making it easy to use SEXTANTE from there
##==========================================================

@staticmethod
def alglist(text=None):
@@ -179,7 +181,7 @@ def runalg(name, *args):
if alg == None:
print("Error: Algorithm not found\n")
return
if len(args) != len(alg.parameters) + len(alg.outputs):
if len(args) != len(alg.parameters) + len(alg.getVisibleOutputsCount()):
print ("Error: Wrong number of parameters")
Sextante.alghelp(name)
return
@@ -193,10 +195,11 @@ def runalg(name, *args):
i = i +1

for output in alg.outputs:
if not output.setValue(args[i]):
print ("Error: Wrong output value: " + args[i])
return
i = i +1
if not output.hidden:
if not output.setValue(args[i]):
print ("Error: Wrong output value: " + args[i])
return
i = i +1

SextanteLog.addToLog(SextanteLog.LOG_ALGORITHM, alg.getAsCommand())

@@ -211,15 +214,19 @@ def runalg(name, *args):

@staticmethod
def load(layer):
'''loads a layer into QGIS'''
QGisLayers.load(layer)

@staticmethod
def loadFromAlg(layersdict):
'''load all layer resulting from a given algorithm.
Layers are passed as a dictionary, obtained from alg.getOutputValuesAsDictionary()'''
QGisLayers.loadFromDict(layersdict)

@staticmethod
def getObject(string):
QGisLayers.getObjectFromUri(string)
def getObject(uri):
'''Returns the QGIS object identified the given URI'''
QGisLayers.getObjectFromUri(uri)

@staticmethod
def runandload(name, *args):
@@ -229,7 +236,7 @@ def runandload(name, *args):
#in theory, this could not happen. Maybe we should show a message box?
QMessageBox.critical(None,"Error", "Error: Algorithm not found\n")
return
if len(args) != len(alg.parameters) + len(alg.outputs):
if len(args) != len(alg.parameters) + len(alg.getVisibleOutputsCount()):
QMessageBox.critical(None,"Error", "Error: Wrong number of parameters")
Sextante.alghelp(name)
return
@@ -243,10 +250,11 @@ def runandload(name, *args):
i = i +1

for output in alg.outputs:
if not output.setValue(args[i]):
QMessageBox.critical(None, "Error", "Error: Wrong output value: " + args[i])
return
i = i +1
if not output.hidden:
if not output.setValue(args[i]):
QMessageBox.critical(None, "Error", "Error: Wrong output value: " + args[i])
return
i = i +1

try:
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
@@ -1,7 +1,7 @@
Copyright notice
-------------------

Algorithms in this folder have been adapted from the original ftools QGis plugin
Algorithms in this folder have been adapted from the original fTools QGis plugin
source code, by Carson Farmer, licensed under the terms of GNU GPL 2

For more info, please check http://www.ftools.ca/fTools.html
@@ -28,7 +28,10 @@ def __init__(self, descriptionfile):
self.descriptionFile = descriptionfile
self.defineCharacteristicsFromFile()
self.numExportedLayers = 0
self.needsregion = False
#=======================================================================
# #true if the algorithms uses a region
# self.needsregion = False
#=======================================================================

def __deepcopy__(self,memo):
newone = GrassAlgorithm(self.descriptionFile)
@@ -38,6 +41,12 @@ def __deepcopy__(self,memo):
def getIcon(self):
return QIcon(os.path.dirname(__file__) + "/../images/grass.png")

def helpFile(self):
folder = SextanteConfig.getSetting(GrassUtils.GRASS_HELP_FOLDER)
if str(folder).strip() != "":
helpfile = str(folder) + os.sep + self.name + ".html"
return helpfile
return None
def defineCharacteristicsFromFile(self):
lines = open(self.descriptionFile)
line = lines.readline().strip("\n").strip()
@@ -49,8 +58,10 @@ def defineCharacteristicsFromFile(self):
line = line.strip("\n").strip()
if line.startswith("Parameter"):
self.addParameter(ParameterFactory.getFromString(line))
elif line.startswith("Region"):
self.needsregion = True
#===============================================================
# elif line.startswith("Region"):
# self.needsregion = True
#===============================================================
else:
self.addOutput(OutputFactory.getFromString(line))
line = lines.readline().strip("\n").strip()
@@ -64,8 +75,8 @@ def calculateResamplingExtent(self):
if auto:
first = True;
for param in self.parameters:
if isinstance(param, ParameterRaster):
if isinstance(param.value, QgsRasterLayer):
if isinstance(param, (ParameterRaster, ParameterVector)):
if isinstance(param.value, (QgsRasterLayer, QgsVectorLayer)):
value = param.value
else:
value = QGisLayers.getObjectFromUri(param.value)
@@ -83,35 +94,34 @@ def calculateResamplingExtent(self):
self.ymax = max(self.ymax, value.extent().yMaximum())
self.cellsize = max(self.cellsize, (value.extent().xMaximum() - value.extent().xMinimum())/value.getRasterXDim())
else:
self.xmin = SextanteConfig.getSetting(SagaUtils.SAGA_RESAMPLING_REGION_XMIN)
self.xmax = SextanteConfig.getSetting(SagaUtils.SAGA_RESAMPLING_REGION_XMAX)
self.ymin = SextanteConfig.getSetting(SagaUtils.SAGA_RESAMPLING_REGION_YMIN)
self.ymax = SextanteConfig.getSetting(SagaUtils.SAGA_RESAMPLING_REGION_YMAX)
self.cellsize = SextanteConfig.getSetting(SagaUtils.SAGA_RESAMPLING_REGION_CELLSIZE)
self.xmin = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_XMIN)
self.xmax = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_XMAX)
self.ymin = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_YMIN)
self.ymax = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_YMAX)
self.cellsize = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_CELLSIZE)


def processAlgorithm(self, progress):
path = GrassUtils.grassPath()
if path == "":
raise GeoAlgorithmExecutionException("GRASS folder is not configured.\nPlease configure it before running GRASS algorithms.")
useSelection = SextanteConfig.getSetting(SagaUtils.SAGA_USE_SELECTED)

commands = []
self.exportedLayers = {}
self.numExportedLayers = 0;

if self.needsregion:
self.calculateResamplingExtent()
##if self.needsregion:
self.calculateResamplingExtent()
GrassUtils.createTempMapset();

if self.needsregion:
command = "g.region"
command += " n=" + str(self.ymax)
command +=" s=" + str(self.ymin)
command +=" e=" + str(self.xmax)
command +=" w=" + str(self.xmin)
command +=" res=" + str(self.cellsize);
commands.append(command)
##if self.needsregion:
command = "g.region"
command += " n=" + str(self.ymax)
command +=" s=" + str(self.ymin)
command +=" e=" + str(self.xmax)
command +=" w=" + str(self.xmin)
command +=" res=" + str(self.cellsize);
commands.append(command)

#1: Export layer to grass mapset
for param in self.parameters:
@@ -138,8 +148,7 @@ def processAlgorithm(self, progress):
commands.append(self.exportRasterLayer(layer))
elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
for layer in layers:
if (not value.endswith("shp")) or useSelection:
commands.append(self.exportRasterLayer(layer))
commands.append(self.exportVectorLayer(layer))

#2: set parameters and outputs
command = self.name

0 comments on commit 4dbb90e

Please sign in to comment.