Skip to content

Commit

Permalink
add COLOR parameter to nviz to allow draping rasters over the digital…
Browse files Browse the repository at this point in the history
… elevation model
  • Loading branch information
gioman committed Oct 16, 2013
1 parent bad4b77 commit 4c80a07
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions python/plugins/processing/grass/nviz.py
Expand Up @@ -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'

Expand All @@ -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,
Expand All @@ -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))
Expand All @@ -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:
Expand Down

0 comments on commit 4c80a07

Please sign in to comment.