Skip to content

Commit 1959f23

Browse files
committed
Merge branch 'main' into feature/141-format-and-lint
clean up issues from 774a6dd
2 parents 9824eca + 774a6dd commit 1959f23

File tree

6 files changed

+65
-22
lines changed

6 files changed

+65
-22
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ RELEASING:
4242
## Unreleased
4343

4444
### Added
45+
- Additional parameter for the "smoothing factor" to isochrones processing algorithms ([#172](https://github.com/GIScience/orstools-qgis-plugin/issues/172))
4546
- Mention omission of configuration options when using traveling salesman
4647

4748
## [1.6.0] - 2023-07-25
@@ -50,7 +51,6 @@ RELEASING:
5051
- translation mechanism ([#183](https://github.com/GIScience/orstools-qgis-plugin/pull/183))
5152
- german translation ([#183](https://github.com/GIScience/orstools-qgis-plugin/pull/183))
5253

53-
5454
## [1.5.3] - 2023-03-30
5555

5656
### Fixed

ORStools/common/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,5 @@
5454
"INPUT_AVOID_BORDERS",
5555
"INPUT_AVOID_COUNTRIES",
5656
"INPUT_AVOID_POLYGONS",
57+
"INPUT_SMOOTHING",
5758
]

ORStools/i18n/orstools_de.qm

484 Bytes
Binary file not shown.

ORStools/i18n/orstools_de.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,53 +165,63 @@
165165
<context>
166166
<name>ORSIsochronesLayerAlgo</name>
167167
<message>
168-
<location filename="../proc/isochrones_layer_proc.py" line="60"/>
168+
<location filename="../proc/isochrones_layer_proc.py" line="64"/>
169169
<source>Input Point layer</source>
170170
<translation>Eingabelayer (Punkte)</translation>
171171
</message>
172172
<message>
173-
<location filename="../proc/isochrones_layer_proc.py" line="69"/>
173+
<location filename="../proc/isochrones_layer_proc.py" line="73"/>
174174
<source>Input layer ID Field (mutually exclusive with Point option)</source>
175175
<translation>ID-Attribut (schließt Punkt-Option aus)</translation>
176176
</message>
177177
<message>
178-
<location filename="../proc/isochrones_layer_proc.py" line="75"/>
178+
<location filename="../proc/isochrones_layer_proc.py" line="79"/>
179179
<source>Dimension</source>
180180
<translation>Dimension</translation>
181181
</message>
182182
<message>
183-
<location filename="../proc/isochrones_layer_proc.py" line="81"/>
183+
<location filename="../proc/isochrones_layer_proc.py" line="85"/>
184184
<source>Comma-separated ranges [min or m]</source>
185185
<translation>Komma-getrennte Reichweiten [min oder m]</translation>
186186
</message>
187187
<message>
188-
<location filename="../proc/isochrones_layer_proc.py" line="203"/>
188+
<location filename="../proc/isochrones_layer_proc.py" line="225"/>
189189
<source>Isochrones from Point-Layer</source>
190190
<translation>Isochronen aus Punkt-Layer</translation>
191191
</message>
192+
<message>
193+
<location filename="../proc/isochrones_layer_proc.py" line="90"/>
194+
<source>Smoothing factor between 0 [detailed] and 100 [generalized]</source>
195+
<translation>Glättungsfaktor zwischen 0 [detailliert] und 100 [verallgemeinert]</translation>
196+
</message>
192197
</context>
193198
<context>
194199
<name>ORSIsochronesPointAlgo</name>
195200
<message>
196-
<location filename="../proc/isochrones_point_proc.py" line="55"/>
201+
<location filename="../proc/isochrones_point_proc.py" line="58"/>
197202
<source>Input Point from map canvas (mutually exclusive with layer option)</source>
198203
<translation>Eingabepunkt aus Kartenansicht (schließt Ebenen-Option aus)</translation>
199204
</message>
200205
<message>
201-
<location filename="../proc/isochrones_point_proc.py" line="60"/>
206+
<location filename="../proc/isochrones_point_proc.py" line="63"/>
202207
<source>Dimension</source>
203208
<translation>Dimension</translation>
204209
</message>
205210
<message>
206-
<location filename="../proc/isochrones_point_proc.py" line="66"/>
211+
<location filename="../proc/isochrones_point_proc.py" line="69"/>
207212
<source>Comma-separated ranges [min or m]</source>
208213
<translation>Komma-getrennte Reichweiten [min oder m]</translation>
209214
</message>
210215
<message>
211-
<location filename="../proc/isochrones_point_proc.py" line="144"/>
216+
<location filename="../proc/isochrones_point_proc.py" line="163"/>
212217
<source>Isochrones from Point</source>
213218
<translation>Isochronen von einzelnem Punkt</translation>
214219
</message>
220+
<message>
221+
<location filename="../proc/isochrones_point_proc.py" line="74"/>
222+
<source>Smoothing factor between 0 [detailed] and 100 [generalized]</source>
223+
<translation>Glättungsfaktor zwischen 0 [detailliert] und 100 [verallgemeinert]</translation>
224+
</message>
215225
</context>
216226
<context>
217227
<name>ORSMatrixAlgo</name>
@@ -244,12 +254,12 @@
244254
<context>
245255
<name>ORStoolsDialog</name>
246256
<message>
247-
<location filename="../gui/ORStoolsDialog.py" line="385"/>
257+
<location filename="../gui/ORStoolsDialog.py" line="392"/>
248258
<source>Apply</source>
249259
<translation>Anwenden</translation>
250260
</message>
251261
<message>
252-
<location filename="../gui/ORStoolsDialog.py" line="386"/>
262+
<location filename="../gui/ORStoolsDialog.py" line="393"/>
253263
<source>Close</source>
254264
<translation>Schließen</translation>
255265
</message>

ORStools/proc/isochrones_layer_proc.py

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
QgsProcessingParameterFeatureSource,
3838
QgsProcessingParameterString,
3939
QgsProcessingParameterEnum,
40+
QgsProcessingParameterNumber,
41+
QgsProcessingParameterDefinition,
4042
)
4143

4244
from ORStools.common import isochrones_core, PROFILES, DIMENSIONS
@@ -57,6 +59,7 @@ def __init__(self):
5759
self.IN_RANGES = "INPUT_RANGES"
5860
self.IN_KEY = "INPUT_APIKEY"
5961
self.IN_DIFFERENCE = "INPUT_DIFFERENCE"
62+
self.IN_SMOOTHING = "INPUT_SMOOTHING"
6063
self.PARAMETERS = [
6164
QgsProcessingParameterFeatureSource(
6265
name=self.IN_POINTS,
@@ -84,6 +87,14 @@ def __init__(self):
8487
description=self.tr("Comma-separated ranges [min or m]"),
8588
defaultValue="5, 10",
8689
),
90+
QgsProcessingParameterNumber(
91+
name=self.IN_SMOOTHING,
92+
description=self.tr("Smoothing factor between 0 [detailed] and 100 [generalized]"),
93+
defaultValue=None,
94+
minValue=0,
95+
maxValue=100,
96+
optional=True,
97+
),
8798
]
8899

89100
# Save some important references
@@ -104,10 +115,12 @@ def processAlgorithm(self, parameters, context, feedback):
104115
factor = 60 if dimension == "time" else 1
105116
ranges_raw = parameters[self.IN_RANGES]
106117
ranges_proc = [x * factor for x in map(int, ranges_raw.split(","))]
118+
smoothing = parameters[self.IN_SMOOTHING]
107119

108120
# self.difference = self.parameterAsBool(parameters, self.IN_DIFFERENCE, context)
109121
source = self.parameterAsSource(parameters, self.IN_POINTS, context)
110122

123+
# get smoothness parameter value
111124
options = self.parseOptions(parameters, context)
112125

113126
# Make the actual requests
@@ -131,16 +144,20 @@ def processAlgorithm(self, parameters, context, feedback):
131144
if feedback.isCanceled():
132145
break
133146

134-
requests.append(
135-
{
136-
"locations": locations,
137-
"range_type": dimension,
138-
"range": ranges_proc,
139-
"attributes": ["total_pop"],
140-
"id": id_value,
141-
"options": options,
142-
}
143-
)
147+
params = {
148+
"locations": locations,
149+
"range_type": dimension,
150+
"range": ranges_proc,
151+
"attributes": ["total_pop"],
152+
"id": id_value,
153+
"options": options,
154+
}
155+
156+
# only include smoothing if set
157+
if smoothing is not None:
158+
params["smoothing"] = smoothing
159+
160+
requests.append(params)
144161

145162
(sink, self.dest_id) = self.parameterAsSink(
146163
parameters,

ORStools/proc/isochrones_point_proc.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
QgsProcessingParameterString,
3535
QgsProcessingParameterEnum,
3636
QgsProcessingParameterPoint,
37+
QgsProcessingParameterNumber,
38+
QgsProcessingParameterDefinition,
3739
)
3840

3941
from ORStools.common import isochrones_core, PROFILES, DIMENSIONS
@@ -52,6 +54,7 @@ def __init__(self):
5254
self.IN_RANGES = "INPUT_RANGES"
5355
self.IN_KEY = "INPUT_APIKEY"
5456
self.IN_DIFFERENCE = "INPUT_DIFFERENCE"
57+
self.IN_SMOOTHING = "INPUT_SMOOTHING"
5558
self.PARAMETERS = [
5659
QgsProcessingParameterPoint(
5760
name=self.IN_POINT,
@@ -71,6 +74,14 @@ def __init__(self):
7174
description=self.tr("Comma-separated ranges [min or m]"),
7275
defaultValue="5, 10",
7376
),
77+
QgsProcessingParameterNumber(
78+
name=self.IN_SMOOTHING,
79+
description=self.tr("Smoothing factor between 0 [detailed] and 100 [generalized]"),
80+
defaultValue=None,
81+
minValue=0,
82+
maxValue=100,
83+
optional=True,
84+
),
7485
]
7586

7687
# Save some important references
@@ -91,6 +102,7 @@ def processAlgorithm(self, parameters, context, feedback):
91102
factor = 60 if dimension == "time" else 1
92103
ranges_raw = parameters[self.IN_RANGES]
93104
ranges_proc = [x * factor for x in map(int, ranges_raw.split(","))]
105+
smoothing = parameters[self.IN_SMOOTHING]
94106

95107
options = self.parseOptions(parameters, context)
96108

@@ -108,6 +120,9 @@ def processAlgorithm(self, parameters, context, feedback):
108120
"options": options,
109121
}
110122

123+
if smoothing is not None:
124+
params["smoothing"] = smoothing
125+
111126
(sink, self.dest_id) = self.parameterAsSink(
112127
parameters,
113128
self.OUT,

0 commit comments

Comments
 (0)