Skip to content
Permalink
Browse files

Merge pull request #954 from gioman/grassnvizcolor

[processing] add COLOR parameter to nviz to allow draping rasters over the digital elevation model
  • Loading branch information
volaya committed Oct 20, 2013
2 parents 26702ab + 4c80a07 commit f0c9efbf018799f1e714bed0ed8dad8650bc7b69
Showing with 13 additions and 2 deletions.
  1. +13 −2 python/plugins/processing/grass/nviz.py
@@ -43,6 +43,7 @@ class nviz(GeoAlgorithm):

ELEVATION = 'ELEVATION'
VECTOR = 'VECTOR'
COLOR = 'COLOR'
GRASS_REGION_EXTENT_PARAMETER = 'GRASS_REGION_PARAMETER'
GRASS_REGION_CELLSIZE_PARAMETER = 'GRASS_REGION_CELLSIZE_PARAMETER'

@@ -53,10 +54,12 @@ def defineCharacteristics(self):
self.name = 'nviz'
self.group = 'Visualization(NVIZ)'
self.addParameter(ParameterMultipleInput(nviz.ELEVATION,
'Elevation layers',
'Raster file(s) for elevation',
ParameterMultipleInput.TYPE_RASTER, True))
self.addParameter(ParameterMultipleInput(nviz.VECTOR, 'Vector layers',
self.addParameter(ParameterMultipleInput(nviz.VECTOR, 'Vector lines/areas overlay file(s)',
ParameterMultipleInput.TYPE_VECTOR_ANY, True))
self.addParameter(ParameterMultipleInput(nviz.COLOR, 'Raster file(s) for color',
ParameterMultipleInput.TYPE_RASTER, True)
self.addParameter(ParameterExtent(nviz.GRASS_REGION_EXTENT_PARAMETER,
'GRASS region extent'))
self.addParameter(ParameterNumber(self.GRASS_REGION_CELLSIZE_PARAMETER,
@@ -67,6 +70,7 @@ 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))
@@ -91,6 +95,13 @@ def processAlgorithm(self, progress):
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:

0 comments on commit f0c9efb

Please sign in to comment.
You can’t perform that action at this time.