Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] use full precision for elevation values
remove unused file
  • Loading branch information
alexbruy committed Dec 19, 2016
1 parent c3e3ba6 commit f4f86ca
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 95 deletions.
14 changes: 9 additions & 5 deletions python/plugins/processing/algs/qgis/Relief.py
Expand Up @@ -75,6 +75,10 @@ def setValue(self, value):
self.value = None
return True

if value == '':
if not self.optional:
return False

if isinstance(value, str):
self.value = value if value != '' else None
else:
Expand All @@ -100,11 +104,11 @@ def fromScriptCode(self, line):
def colorsToString(colors):
s = ''
for c in colors:
s += '{:.2f}, {:.2f}, {:d}, {:d}, {:d};'.format(c[0],
c[1],
c[2],
c[3],
c[4])
s += '{:f}, {:f}, {:d}, {:d}, {:d};'.format(c[0],
c[1],
c[2],
c[3],
c[4])
return s[:-1]

self.addParameter(ParameterRaster(self.INPUT_LAYER,
Expand Down
80 changes: 0 additions & 80 deletions python/plugins/processing/algs/qgis/ReliefAuto.py

This file was deleted.

10 changes: 5 additions & 5 deletions python/plugins/processing/algs/qgis/ui/ReliefColorsWidget.py
Expand Up @@ -239,11 +239,11 @@ def value(self):
rColors = self.reliefColors()
colors = ''
for c in rColors:
colors += '{:.2f}, {:.2f}, {:d}, {:d}, {:d};'.format(c.minElevation,
c.maxElevation,
c.color.red(),
c.color.green(),
c.color.blue())
colors += '{:f}, {:f}, {:d}, {:d}, {:d};'.format(c.minElevation,
c.maxElevation,
c.color.red(),
c.color.green(),
c.color.blue())
return colors[:-1]


Expand Down
Expand Up @@ -1153,17 +1153,18 @@ tests:
name: Relief (custom colors)
params:
AUTO_COLORS: false
COLORS: 85.00, 104.44, 7, 165, 144;104.44, 104.44, 12, 221, 162;104.44, 104.44,
33, 252, 183;104.44, 104.44, 247, 252, 152;104.44, 104.44, 252, 196, 8;104.44,
190.33, 252, 166, 15;190.33, 226.70, 175, 101, 15;226.70, 226.70, 255, 133,
92;226.70, 243.00, 204, 204, 204
COLORS: 85.000000, 104.436508, 7, 165, 144;104.436508, 104.436508, 12, 221, 162;104.436508,
104.436508, 33, 252, 183;104.436508, 104.436508, 247, 252, 152;104.436508, 104.436508,
252, 196, 8;104.436508, 190.333333, 252, 166, 15;190.333333, 226.698413, 175,
101, 15;226.698413, 226.698413, 255, 133, 92;226.698413, 243.000000, 204, 204,
204
INPUT_LAYER:
name: dem.tif
type: raster
Z_FACTOR: 1.0
results:
OUTPUT_LAYER:
hash: 6c79ec9b948c8e878aa490670e8a26a0b6efc5f9d162a0fff1042d80
hash: 7fe0e0174185fd743e23760f33615adf10f771b4275f320db6f7f4f8
type: rasterhash

# Case 1: Keep all fields
Expand Down

0 comments on commit f4f86ca

Please sign in to comment.