Skip to content

Commit

Permalink
fixed #6295
Browse files Browse the repository at this point in the history
did some cleaning in GrassAlgorithm.py
  • Loading branch information
volaya committed Sep 22, 2012
1 parent 73fcb66 commit d80d3cf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 74 deletions.
73 changes: 0 additions & 73 deletions python/plugins/sextante/grass/GrassAlgorithm.py
Expand Up @@ -103,67 +103,9 @@ def defineCharacteristicsFromFile(self):
raise e
lines.close()

#=======================================================================
# 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)
# extentString = str(self.xmin) + "," + str(self.xmax) + str(self.xmin) + "," + str(self.xmax)
# self.cellsize = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_CELLSIZE)
#=======================================================================
self.addParameter(ParameterExtent(self.GRASS_REGION_EXTENT_PARAMETER, "GRASS region extent"))
self.addParameter(ParameterNumber(self.GRASS_REGION_CELLSIZE_PARAMETER, "GRASS region cellsize", 0, None, 1))

#===============================================================================
# def calculateRegion(self):
# auto = SextanteConfig.getSetting(GrassUtils.GRASS_AUTO_REGION)
# if auto:
# try:
# self.cellsize = SextanteConfig.getSetting(GrassUtils.GRASS_REGION_CELLSIZE)
# except Exception:
# self.cellsize = 0;
# first = True;
# for param in self.parameters:
# if param.value:
# if isinstance(param, (ParameterRaster, ParameterVector)):
# if isinstance(param.value, (QgsRasterLayer, QgsVectorLayer)):
# layer = param.value
# else:
# layer = QGisLayers.getObjectFromUri(param.value)
# self.addToRegion(layer, first)
# first = False
# elif isinstance(param, ParameterMultipleInput):
# layers = param.value.split(";")
# for layername in layers:
# layer = QGisLayers.getObjectFromUri(layername, first)
# self.addToRegion(layer, first)
# first = False
# if self.cellsize == 0:
# self.cellsize = 1
# else:
# 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 addToRegion(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()
# if isinstance(layer, QgsRasterLayer):
# 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())
# if isinstance(layer, QgsRasterLayer):
# self.cellsize = max(self.cellsize, (layer.extent().xMaximum() - layer.extent().xMinimum())/layer.width())
#===============================================================================

def processAlgorithm(self, progress):
if SextanteUtils.isWindows():
Expand Down Expand Up @@ -327,18 +269,3 @@ def getTempFilename(self):

def commandLineName(self):
return "grass:" + self.name[:self.name.find(" ")]

#===============================================================================
# def checkBeforeOpeningParametersDialog(self):
# for param in self.parameters:
# if isinstance(param, (ParameterRaster, ParameterVector)):
# return None
# if isinstance(param, ParameterMultipleInput):
# if not param.optional:
# return None
#
# if SextanteConfig.getSetting(GrassUtils.GRASS_AUTO_REGION):
# return "This algorithm cannot be run with the 'auto-region' setting\nPlease set a GRASS region before running it"
# else:
# return None
#===============================================================================
2 changes: 1 addition & 1 deletion python/plugins/sextante/r/RAlgorithm.py
Expand Up @@ -230,7 +230,7 @@ def getImportCommands(self):
# if rgdal is not available, try to install it
# just use US mirror
commands.append('options("repos"="http://cran.us.r-project.org")')
rLibDir = "%s/rlibs" % SextanteUtils.userFolder()
rLibDir = "%s/rlibs" % SextanteUtils.userFolder().replace("\\","/")
if not os.path.isdir(rLibDir): os.mkdir(rLibDir)
commands.append(
'tryCatch(find.package("rgdal"), error=function(e) install.packages("rgdal", lib="%s"))' % rLibDir)
Expand Down

0 comments on commit d80d3cf

Please sign in to comment.