22
22
__date__ = '2019-03-01'
23
23
__copyright__ = '(C) 2019 by Håvard Tveite'
24
24
25
- # This will get replaced with a git SHA1 when you do a git archive
26
-
27
- __revision__ = '$Format:%H$'
28
25
29
26
import os
30
27
import math
@@ -80,7 +77,7 @@ def initAlgorithm(self, config=None):
80
77
self .addParameter (
81
78
QgsProcessingParameterFeatureSource (
82
79
self .INPUT ,
83
- self .tr ('Input (line) layer' ),
80
+ self .tr ('Line layer' ),
84
81
[QgsProcessing .TypeVectorLine ]
85
82
)
86
83
)
@@ -135,7 +132,6 @@ def processAlgorithm(self, parameters, context, feedback):
135
132
136
133
if not hasZ :
137
134
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 {}
139
135
140
136
thefields = QgsFields ()
141
137
climbindex = - 1
@@ -151,7 +147,7 @@ def processAlgorithm(self, parameters, context, feedback):
151
147
thefields .append (QgsField (self .MAXELEVATTRIBUTE , QVariant .Double ))
152
148
153
149
# combine all the vector fields
154
- out_fields = QgsProcessingUtils .combineFields (source_fields , thefields )
150
+ out_fields = QgsProcessingUtils .combineFields (thefields , source_fields )
155
151
156
152
layerwithz = source
157
153
@@ -223,12 +219,13 @@ def processAlgorithm(self, parameters, context, feedback):
223
219
totaldescent = totaldescent + descent
224
220
partnumber += 1
225
221
# Set the attribute values
226
- attrs = feature . attributes ()
222
+ attrs = []
227
223
# Append the attributes to the end of the existing ones
228
224
attrs .append (climb )
229
225
attrs .append (descent )
230
226
attrs .append (minelev )
231
227
attrs .append (maxelev )
228
+ attrs .extend (feature .attributes ())
232
229
233
230
# Set the final attribute list
234
231
feature .setAttributes (attrs )
0 commit comments