Skip to content

Commit f4f86ca

Browse files
committed
[processing] use full precision for elevation values
remove unused file
1 parent c3e3ba6 commit f4f86ca

File tree

4 files changed

+20
-95
lines changed

4 files changed

+20
-95
lines changed

python/plugins/processing/algs/qgis/Relief.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ def setValue(self, value):
7575
self.value = None
7676
return True
7777

78+
if value == '':
79+
if not self.optional:
80+
return False
81+
7882
if isinstance(value, str):
7983
self.value = value if value != '' else None
8084
else:
@@ -100,11 +104,11 @@ def fromScriptCode(self, line):
100104
def colorsToString(colors):
101105
s = ''
102106
for c in colors:
103-
s += '{:.2f}, {:.2f}, {:d}, {:d}, {:d};'.format(c[0],
104-
c[1],
105-
c[2],
106-
c[3],
107-
c[4])
107+
s += '{:f}, {:f}, {:d}, {:d}, {:d};'.format(c[0],
108+
c[1],
109+
c[2],
110+
c[3],
111+
c[4])
108112
return s[:-1]
109113

110114
self.addParameter(ParameterRaster(self.INPUT_LAYER,

python/plugins/processing/algs/qgis/ReliefAuto.py

Lines changed: 0 additions & 80 deletions
This file was deleted.

python/plugins/processing/algs/qgis/ui/ReliefColorsWidget.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,11 @@ def value(self):
239239
rColors = self.reliefColors()
240240
colors = ''
241241
for c in rColors:
242-
colors += '{:.2f}, {:.2f}, {:d}, {:d}, {:d};'.format(c.minElevation,
243-
c.maxElevation,
244-
c.color.red(),
245-
c.color.green(),
246-
c.color.blue())
242+
colors += '{:f}, {:f}, {:d}, {:d}, {:d};'.format(c.minElevation,
243+
c.maxElevation,
244+
c.color.red(),
245+
c.color.green(),
246+
c.color.blue())
247247
return colors[:-1]
248248

249249

python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,17 +1153,18 @@ tests:
11531153
name: Relief (custom colors)
11541154
params:
11551155
AUTO_COLORS: false
1156-
COLORS: 85.00, 104.44, 7, 165, 144;104.44, 104.44, 12, 221, 162;104.44, 104.44,
1157-
33, 252, 183;104.44, 104.44, 247, 252, 152;104.44, 104.44, 252, 196, 8;104.44,
1158-
190.33, 252, 166, 15;190.33, 226.70, 175, 101, 15;226.70, 226.70, 255, 133,
1159-
92;226.70, 243.00, 204, 204, 204
1156+
COLORS: 85.000000, 104.436508, 7, 165, 144;104.436508, 104.436508, 12, 221, 162;104.436508,
1157+
104.436508, 33, 252, 183;104.436508, 104.436508, 247, 252, 152;104.436508, 104.436508,
1158+
252, 196, 8;104.436508, 190.333333, 252, 166, 15;190.333333, 226.698413, 175,
1159+
101, 15;226.698413, 226.698413, 255, 133, 92;226.698413, 243.000000, 204, 204,
1160+
204
11601161
INPUT_LAYER:
11611162
name: dem.tif
11621163
type: raster
11631164
Z_FACTOR: 1.0
11641165
results:
11651166
OUTPUT_LAYER:
1166-
hash: 6c79ec9b948c8e878aa490670e8a26a0b6efc5f9d162a0fff1042d80
1167+
hash: 7fe0e0174185fd743e23760f33615adf10f771b4275f320db6f7f4f8
11671168
type: rasterhash
11681169

11691170
# Case 1: Keep all fields

0 commit comments

Comments
 (0)