Skip to content
Permalink
Browse files
Polished some GRASS descriptions
Fixed small bug when handling selection parameters
added statistical values to numerical value selector

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@58 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf committed Apr 3, 2012
1 parent c9b2d62 commit b74ae41dd6b570eed184dad16f5f4a0dc4d89490
Showing with 172 additions and 292 deletions.
  1. +1 −1 src/sextante/ftools/ConvexHull.py
  2. +33 −20 src/sextante/grass/GrassAlgorithm.py
  3. +6 −4 src/sextante/grass/GrassUtils.py
  4. +0 −18 src/sextante/grass/description/alg_100.txt
  5. +1 −1 src/sextante/grass/description/alg_3.txt
  6. +0 −5 src/sextante/grass/description/alg_44.txt
  7. +1 −1 src/sextante/grass/description/alg_44b.txt
  8. +1 −1 src/sextante/grass/description/alg_50.txt
  9. +1 −1 src/sextante/grass/description/alg_52.txt
  10. +0 −12 src/sextante/grass/description/alg_53.txt
  11. +2 −2 src/sextante/grass/description/alg_54.txt
  12. +0 −12 src/sextante/grass/description/alg_55.txt
  13. +1 −1 src/sextante/grass/description/alg_56.txt
  14. +0 −6 src/sextante/grass/description/alg_57.txt
  15. +0 −5 src/sextante/grass/description/alg_60.txt
  16. +0 −13 src/sextante/grass/description/alg_61.txt
  17. +0 −5 src/sextante/grass/description/alg_62.txt
  18. +3 −4 src/sextante/grass/description/alg_63.txt
  19. +2 −3 src/sextante/grass/description/alg_65.txt
  20. +0 −11 src/sextante/grass/description/alg_66.txt
  21. +11 −12 src/sextante/grass/description/alg_67.txt
  22. +0 −9 src/sextante/grass/description/alg_68.txt
  23. +2 −2 src/sextante/grass/description/alg_69.txt
  24. +7 −15 src/sextante/grass/description/alg_70.txt
  25. +0 −5 src/sextante/grass/description/alg_71.txt
  26. +1 −3 src/sextante/grass/description/alg_73.txt
  27. +5 −5 src/sextante/grass/description/alg_75.txt
  28. +7 −7 src/sextante/grass/description/alg_76.txt
  29. +5 −5 src/sextante/grass/description/alg_78.txt
  30. +0 −24 src/sextante/grass/description/alg_80.txt
  31. +2 −2 src/sextante/grass/description/alg_82.txt
  32. +1 −2 src/sextante/grass/description/alg_83.txt
  33. +3 −11 src/sextante/grass/description/alg_84.txt
  34. +3 −3 src/sextante/grass/description/alg_85.txt
  35. +0 −1 src/sextante/grass/description/alg_86.txt
  36. +2 −2 src/sextante/grass/description/alg_89.txt
  37. +11 −15 src/sextante/grass/description/alg_90.txt
  38. +2 −2 src/sextante/grass/description/alg_91.txt
  39. +4 −4 src/sextante/grass/description/alg_92.txt
  40. +0 −8 src/sextante/grass/description/alg_93.txt
  41. +4 −4 src/sextante/grass/description/alg_94.txt
  42. +1 −1 src/sextante/grass/description/alg_96.txt
  43. +1 −1 src/sextante/grass/description/alg_98.txt
  44. +10 −13 src/sextante/grass/description/alg_99.txt
  45. +17 −2 src/sextante/gui/NumberInputDialog.py
  46. +2 −1 src/sextante/gui/OutputSelectionPanel.py
  47. +2 −1 src/sextante/modeler/CalculatorModelerParametersDialog.py
  48. +4 −2 src/sextante/modeler/ModelerDialog.py
  49. +2 −1 src/sextante/modeler/ModelerParametersDialog.py
  50. +8 −1 src/sextante/parameters/ParameterSelection.py
  51. +1 −1 src/sextante/r/RAlgorithm.py
  52. +2 −1 src/sextante/saga/SagaAlgorithm.py
@@ -31,7 +31,7 @@ def processAlgorithm(self, progress):
systemEncoding = settings.value( "/UI/encoding", "System" ).toString()
output = self.getOutputValue(ConvexHull.OUTPUT)
useSelection = self.getParameterValue(ConvexHull.USE_SELECTED)
useField = (self.getParameterValue(ConvexHull.METHOD) == ConvexHull.METHODS[1])
useField = (self.getParameterValue(ConvexHull.METHOD) == 1)
field = self.getParameterValue(ConvexHull.FIELD)
vlayerA = QGisLayers.getObjectFromUri(self.getParameterValue(ConvexHull.INPUT))
GEOS_EXCEPT = True
@@ -19,6 +19,7 @@
from sextante.grass.GrassUtils import GrassUtils
import time
from sextante.core.SextanteUtils import SextanteUtils
from sextante.parameters.ParameterSelection import ParameterSelection

class GrassAlgorithm(GeoAlgorithm):

@@ -75,24 +76,20 @@ def calculateResamplingExtent(self):
if auto:
first = True;
for param in self.parameters:
if isinstance(param, (ParameterRaster, ParameterVector)):
if isinstance(param.value, (QgsRasterLayer, QgsVectorLayer)):
value = param.value
if isinstance(param, ParameterRaster):
if isinstance(param.value, QgsRasterLayer):
layer = param.value
else:
value = QGisLayers.getObjectFromUri(param.value)
if first:
self.xmin = value.extent().xMinimum()
self.xmax = value.extent().xMaximum()
self.ymin = value.extent().yMinimum()
self.ymax = value.extent().yMaximum()
self.cellsize = (value.extent().xMaximum() - value.extent().xMinimum())/value.getRasterXDim()
first = False
else:
self.xmin = min(self.xmin, value.extent().xMinimum())
self.xmax = max(self.xmax, value.extent().xMaximum())
self.ymin = min(self.ymin, value.extent().yMinimum())
self.ymax = max(self.ymax, value.extent().yMaximum())
self.cellsize = max(self.cellsize, (value.extent().xMaximum() - value.extent().xMinimum())/value.getRasterXDim())
layer = QGisLayers.getObjectFromUri(param.value)
self.addToResamplingExtent(layer, first)
first = False
if isinstance(param, ParameterMultipleInput):
if param.datatype == ParameterMultipleInput.TYPE_RASTER:
layers = param.value.split(";")
for layername in layers:
layer = QGisLayers.getObjectFromUri(layername, first)
self.addToResamplingExtent(layer, first)
first = False
else:
self.xmin = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_XMIN)
self.xmax = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_XMAX)
@@ -101,6 +98,21 @@ def calculateResamplingExtent(self):
self.cellsize = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_CELLSIZE)


def addToResamplingExtent(self, layer, first):
if first:
self.xmin = layer.extent().xMinimum()
self.xmax = layer.extent().xMaximum()
self.ymin = layer.extent().yMinimum()
self.ymax = layer.extent().yMaximum()
self.cellsize = (layer.extent().xMaximum() - layer.extent().xMinimum())/layer.width()
else:
self.xmin = min(self.xmin, layer.extent().xMinimum())
self.xmax = max(self.xmax, layer.extent().xMaximum())
self.ymin = min(self.ymin, layer.extent().yMinimum())
self.ymax = max(self.ymax, layer.extent().yMaximum())
self.cellsize = max(self.cellsize, (layer.extent().xMaximum() - layer.extent().xMinimum())/layer.width())


def processAlgorithm(self, progress):
path = GrassUtils.grassPath()
if path == "":
@@ -110,11 +122,9 @@ def processAlgorithm(self, progress):
self.exportedLayers = {}
self.numExportedLayers = 0;

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

##if self.needsregion:
command = "g.region"
command += " n=" + str(self.ymax)
command +=" s=" + str(self.ymin)
@@ -169,7 +179,10 @@ def processAlgorithm(self, progress):
command+=(" " + param.name + "=" + s);
elif isinstance(param, ParameterBoolean):
if param.value:
command += param.name
command += (" " + param.name)
elif isinstance(param, ParameterSelection):
idx = int(param.value)
command+=(" " + param.name + "=" + str(param.options[idx]));
else:
command+=(" " + param.name + "=" + str(param.value));

@@ -4,6 +4,7 @@
from sextante.core.SextanteConfig import SextanteConfig
from sextante.core.SextanteLog import SextanteLog
import stat
import shutil

class GrassUtils:

@@ -161,14 +162,14 @@ def createTempMapset():
GrassUtils.writeGrassWindow(os.path.join(folder, "PERMANENT", "WIND"));
mkdir(os.path.join(folder, "user", "dbf"))
mkdir(os.path.join(folder, "user", ".tmp"))
outfile = open(mkdir(os.path.join(folder, "user", "VAR"), "w"))
outfile = open(os.path.join(folder, "user", "VAR"), "w")
outfile.write("DB_DRIVER: dbf\n");
outfile.write("DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n");
outfile.close()
GrassUtils.writeGrassWindow(os.path.join(folder, "user", "WIND"));

@staticmethod
def writeGRASSWindow(filename):
def writeGrassWindow(filename):
out = open(filename, "w")
latlon = SextanteConfig.getSetting(GrassUtils.GRASS_LATLON)
if not latlon:
@@ -232,9 +233,10 @@ def executeGrass(commands, progress):
pass
loglines.append(line)
SextanteLog.addToLog(SextanteLog.LOG_INFO, loglines)
shutil.rmtree(GrassUtils.grassMapsetFolder(), True)


def getGrassVersion(self):
@staticmethod
def getGrassVersion():
#I do not know if this should be removed or let the user enter it
#or something like that... This is just a temporary thing
return "6.4.0"

This file was deleted.

@@ -1,6 +1,6 @@
v.random
Vector (v.*)
ParameterString|n|n|None|None|0.0
ParameterNumber|n|n|None|None|0.0
ParameterNumber|zmin|zmin|None|None|0.0
ParameterString|zmax|zmax|None|None|0.0
ParameterTableField|column|column|z

This file was deleted.

@@ -1,4 +1,4 @@
r.reclass.area.greater
r.reclass.area
Raster (r.*)
ParameterRaster|input|input|False
ParameterNumber|greater|greater|None|None|0.0
@@ -1,7 +1,7 @@
r.prominence
Raster (r.*)
ParameterRaster|input|input|False
ParameterString|radius|radius|1
ParameterNumber|radius|radius|1|None|1
ParameterBoolean|-a|-a|True
ParameterBoolean|-l|-l|True
ParameterBoolean|-g|-g|True
@@ -2,7 +2,7 @@ v.out.pov
Vector (v.*)
ParameterVector|input|input|-1|False
ParameterString|type|type|point,line,area,face
ParameterString|output|output|
ParameterString|output|output|/file
ParameterString|size|size|10
ParameterString|zmod|zmod|
ParameterString|objmod|objmod|

This file was deleted.

@@ -3,7 +3,7 @@ Vector (v.*)
ParameterVector|input|input|-1|False
ParameterSelection|distribution|distribution|uniform;normal
ParameterString|parameters|parameters|
ParameterString|minimum|minimum|0.0
ParameterString|seed|seed|0
ParameterNumber|minimum|minimum|None|None|0.0
ParameterNumber|seed|seed|None|None|0
ParameterBoolean|-q|-q|True
OutputVector|output|output

This file was deleted.

@@ -1,6 +1,6 @@
r.cross
Raster (r.*)
ParameterMultipleInput|input|input|1.0|False
ParameterMultipleInput|input|input|3|False
ParameterBoolean|-z|-z|True
ParameterBoolean|-q|-q|True
OutputRaster|output|output

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,11 +1,10 @@
v.extrude
Vector (v.*)
ParameterVector|input|input|-1|False
ParameterString|zshift|zshift|0
ParameterNumber|zshift|zshift|None|None|0
ParameterRaster|elevation|elevation|False
ParameterString|height|height|
ParameterString|hcolumn|hcolumn|
ParameterNumber|height|height|None|None|0
ParameterNumber|hcolumn|hcolumn|None|None|0
ParameterString|type|type|point,line,boundary,area
ParameterString|layer|layer|1
ParameterBoolean|-t|-t|True
OutputVector|output|output
@@ -1,9 +1,8 @@
v.clean
Vector (v.*)
ParameterVector|input|input|-1|False
ParameterString|type|type|point,line,boundary,centroid,area
ParameterString|tool|tool|
ParameterString|thresh|thresh|
ParameterSelection|tool|tool|break;snap;rmdangle;chdangle;rmbridge;chbridge;rmdupl;rmdac;bpol;prune;rmarea;rmline;rmsa
ParameterNumber|thresh|thresh|None|None|0
ParameterBoolean|-b|-b|True
OutputVector|output|output
OutputVector|error|error

This file was deleted.

@@ -3,24 +3,23 @@ Raster (r.*)
ParameterRaster|input|input|False
ParameterRaster|target_mask|target_mask|False
ParameterRaster|viewpt_mask|viewpt_mask|False
ParameterVector|sites|sites|-1|False
ParameterString|layer|layer|1
ParameterString|obs_elev|obs_elev|1.75
ParameterString|target_elev|target_elev|0.0
ParameterString|max_dist|max_dist|2000
ParameterString|seed|seed|1
ParameterString|sample|sample|10.0
ParameterVector|sites|sites|0|False
ParameterNumber|obs_elev|obs_elev|None|None|1.75
ParameterNumber|target_elev|target_elev|None|None|0.0
ParameterNumber|max_dist|max_dist|None|None|2000
ParameterNumber|seed|seed|None|None|1
ParameterNumber|sample|sample|None|None|10.0
ParameterSelection|type|type|sites;systematic;random;all
ParameterString|spot|spot|
ParameterString|offseta|offseta|
ParameterString|offsetb|offsetb|
ParameterString|azimuth1|azimuth1|
ParameterString|azimuth2|azimuth2|
ParameterString|vert1|vert1|
ParameterString|vert2|vert2|
ParameterString|radius1|radius1|
ParameterString|radius2|radius2|
ParameterString|curvc|curvc|0.0
ParameterString|vert1|vert1|None|None|0
ParameterString|vert2|vert2|None|None|0
ParameterNumber|radius1|radius1|None|None|1
ParameterNumber|radius2|radius2|None|None|1
ParameterNumber|curvc|curvc|None|None|0.0
ParameterBoolean|-f|-f|True
ParameterBoolean|-m|-m|True
ParameterBoolean|-a|-a|True

This file was deleted.

@@ -2,6 +2,6 @@ v.lidar.growing
Vector (v.*)
ParameterVector|input|input|-1|False
ParameterVector|first|first|-1|False
ParameterString|tj|tj|0.2
ParameterString|td|td|0.6
ParameterNumber|tj|tj|None|None|0.2
ParameterNumber|td|td|None|None|0.6
OutputVector|output|output
@@ -1,19 +1,11 @@
v.transform
Vector (v.*)
ParameterVector|input|input|-1|False
ParameterString|pointsfile|pointsfile|/file
ParameterString|xshift|xshift|0.0
ParameterString|yshift|yshift|0.0
ParameterString|zshift|zshift|0.0
ParameterString|xscale|xscale|1.0
ParameterString|yscale|yscale|1.0
ParameterString|zscale|zscale|1.0
ParameterString|zrot|zrot|0.0
ParameterString|table|table|
ParameterString|columns|columns|
ParameterString|layer|layer|1
ParameterBoolean|-q|-q|True
ParameterBoolean|-t|-t|True
ParameterBoolean|-m|-m|True
ParameterBoolean|-s|-s|True
ParameterString|xshift|xshift|None|None|0.0
ParameterString|yshift|yshift|None|None|0.0
ParameterString|zshift|zshift|None|None|0.0
ParameterString|xscale|xscale|None|None|1.0
ParameterString|yscale|yscale|None|None|1.0
ParameterString|zscale|zscale|None|None|1.0
ParameterString|zrot|zrot|None|None|0.0
OutputVector|output|output

This file was deleted.

0 comments on commit b74ae41

Please sign in to comment.