Skip to content

Commit 34f0232

Browse files
committedMay 20, 2019
do suggestions
1 parent 17000a4 commit 34f0232

File tree

1 file changed

+4
-7
lines changed
  • python/plugins/processing/algs/qgis

1 file changed

+4
-7
lines changed
 

‎python/plugins/processing/algs/qgis/Climb.py‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
__date__ = '2019-03-01'
2323
__copyright__ = '(C) 2019 by Håvard Tveite'
2424

25-
# This will get replaced with a git SHA1 when you do a git archive
26-
27-
__revision__ = '$Format:%H$'
2825

2926
import os
3027
import math
@@ -80,7 +77,7 @@ def initAlgorithm(self, config=None):
8077
self.addParameter(
8178
QgsProcessingParameterFeatureSource(
8279
self.INPUT,
83-
self.tr('Input (line) layer'),
80+
self.tr('Line layer'),
8481
[QgsProcessing.TypeVectorLine]
8582
)
8683
)
@@ -135,7 +132,6 @@ def processAlgorithm(self, parameters, context, feedback):
135132

136133
if not hasZ:
137134
raise QgsProcessingException(self.tr('The layer does not have Z values. If you have a DEM, use the Drape algorithm to extract Z values.'))
138-
return {}
139135

140136
thefields = QgsFields()
141137
climbindex = -1
@@ -151,7 +147,7 @@ def processAlgorithm(self, parameters, context, feedback):
151147
thefields.append(QgsField(self.MAXELEVATTRIBUTE, QVariant.Double))
152148

153149
# combine all the vector fields
154-
out_fields = QgsProcessingUtils.combineFields(source_fields, thefields)
150+
out_fields = QgsProcessingUtils.combineFields(thefields, source_fields)
155151

156152
layerwithz = source
157153

@@ -223,12 +219,13 @@ def processAlgorithm(self, parameters, context, feedback):
223219
totaldescent = totaldescent + descent
224220
partnumber += 1
225221
# Set the attribute values
226-
attrs = feature.attributes()
222+
attrs = []
227223
# Append the attributes to the end of the existing ones
228224
attrs.append(climb)
229225
attrs.append(descent)
230226
attrs.append(minelev)
231227
attrs.append(maxelev)
228+
attrs.extend(feature.attributes())
232229

233230
# Set the final attribute list
234231
feature.setAttributes(attrs)

0 commit comments

Comments
 (0)
Please sign in to comment.