def processAlgorithm(self, progress): commands = [] vector = self.getParameterValue(self.VECTOR) elevation = self.getParameterValue(self.ELEVATION) color = self.getParameterValue(self.COLOR) region = \ str(self.getParameterValue(self.GRASS_REGION_EXTENT_PARAMETER)) regionCoords = region.split(',') command = 'g.region ' command += 'n=' + str(regionCoords[3]) command += ' s=' + str(regionCoords[2]) command += ' e=' + str(regionCoords[1]) command += ' w=' + str(regionCoords[0]) cellsize = self.getParameterValue(self.GRASS_REGION_CELLSIZE_PARAMETER) if cellsize: command += ' res=' + str(cellsize) else: command += ' res=' + str(self.getDefaultCellsize()) commands.append(command) command = 'nviz' if vector: layers = vector.split(';') for layer in layers: (cmd, newfilename) = self.exportVectorLayer(layer) commands.append(cmd) vector = vector.replace(layer, newfilename) command += ' vector=' + vector.replace(';', ',') if color: layers = color.split(';') for layer in layers: (cmd, newfilename) = self.exportRasterLayer(layer) commands.append(cmd) color = color.replace(layer, newfilename) command += ' color=' + color.replace(';', ',') if elevation: layers = elevation.split(';') for layer in layers: (cmd, newfilename) = self.exportRasterLayer(layer) commands.append(cmd) elevation = elevation.replace(layer, newfilename) command += ' elevation=' + elevation.replace(';', ',') if elevation is None and vector is None: command += ' -q' commands.append(command) GrassUtils.createTempMapset() GrassUtils.executeGrass(commands, progress)
def processAlgorithm(self, progress): commands = [] vector = self.getParameterValue(self.VECTOR) elevation = self.getParameterValue(self.ELEVATION) region = \ str(self.getParameterValue(self.GRASS_REGION_EXTENT_PARAMETER)) regionCoords = region.split(',') command = 'g.region ' command += 'n=' + str(regionCoords[3]) command += ' s=' + str(regionCoords[2]) command += ' e=' + str(regionCoords[1]) command += ' w=' + str(regionCoords[0]) cellsize = self.getParameterValue(self.GRASS_REGION_CELLSIZE_PARAMETER) if cellsize: command += ' res=' + str(cellsize) else: command += ' res=' + str(self.getDefaultCellsize()) commands.append(command) command = 'nviz' if vector: layers = vector.split(';') for layer in layers: (cmd, newfilename) = self.exportVectorLayer(layer) commands.append(cmd) vector = vector.replace(layer, newfilename) command += ' vector=' + vector.replace(';', ',') if elevation: layers = elevation.split(';') for layer in layers: (cmd, newfilename) = self.exportRasterLayer(layer) commands.append(cmd) elevation = elevation.replace(layer, newfilename) command += ' elevation=' + elevation.replace(';', ',') if elevation is None and vector is None: command += ' -q' commands.append(command) GrassUtils.createTempMapset() GrassUtils.executeGrass(commands, progress)
def processAlgorithm(self, progress): commands = [] vector = self.getParameterValue(self.VECTOR) elevation = self.getParameterValue(self.ELEVATION) region = str(self.getParameterValue( self.GRASS_REGION_EXTENT_PARAMETER)) regionCoords = region.split(",") command = "g.region " command += "n=" + str(regionCoords[3]) command += " s=" + str(regionCoords[2]) command += " e=" + str(regionCoords[1]) command += " w=" + str(regionCoords[0]) cellsize = self.getParameterValue(self.GRASS_REGION_CELLSIZE_PARAMETER) if cellsize: command += " res=" + str(cellsize) else: command += " res=" + str(self.getDefaultCellsize()) commands.append(command) command = "nviz" if vector: layers = vector.split(";") for layer in layers: cmd, newfilename = self.exportVectorLayer(layer) commands.append(cmd) vector = vector.replace(layer, newfilename) command += (" vector=" + vector.replace(";", ",")) if elevation: layers = elevation.split(";") for layer in layers: cmd, newfilename = self.exportRasterLayer(layer) commands.append(cmd) elevation = elevation.replace(layer, newfilename) command += (" elevation=" + elevation.replace(";", ",")) if elevation is None and vector is None: command += " -q" commands.append(command) GrassUtils.createTempMapset() GrassUtils.executeGrass(commands, progress)
def processAlgorithm(self, progress): commands = [] vector = self.getParameterValue(self.VECTOR); elevation = self.getParameterValue(self.ELEVATION); region = str(self.getParameterValue(self.GRASS_REGION_EXTENT_PARAMETER)) regionCoords = region.split(",") command = "g.region " command += "n=" + str(regionCoords[3]) command +=" s=" + str(regionCoords[2]) command +=" e=" + str(regionCoords[1]) command +=" w=" + str(regionCoords[0]) cellsize = self.getParameterValue(self.GRASS_REGION_CELLSIZE_PARAMETER) if cellsize: command +=" res=" + str(cellsize); else: command +=" res=" + str(self.getDefaultCellsize()) commands.append(command) command = "nviz" if vector: layers = vector.split(";") for layer in layers: cmd, newfilename = self.exportVectorLayer(layer) commands.append(cmd) vector = vector.replace(layer, newfilename) command += (" vector=" + vector.replace(";", ",")) if elevation: layers = elevation.split(";") for layer in layers: cmd, newfilename = self.exportRasterLayer(layer) commands.append(cmd) elevation = elevation.replace(layer, newfilename) command += (" elevation=" + elevation.replace(";", ",")) if elevation is None and vector is None: command += " -q" commands.append(command) GrassUtils.createTempMapset(); GrassUtils.executeGrass(commands, progress)