Skip to content
Permalink
Browse files

do suggestions

  • Loading branch information
ghtmtt committed May 20, 2019
1 parent 17000a4 commit 34f02327d2d3aa71533532b09d01fc590565653b
Showing with 4 additions and 7 deletions.
  1. +4 −7 python/plugins/processing/algs/qgis/Climb.py
@@ -22,9 +22,6 @@
__date__ = '2019-03-01'
__copyright__ = '(C) 2019 by Håvard Tveite'

# This will get replaced with a git SHA1 when you do a git archive

__revision__ = '$Format:%H$'

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

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

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

# combine all the vector fields
out_fields = QgsProcessingUtils.combineFields(source_fields, thefields)
out_fields = QgsProcessingUtils.combineFields(thefields, source_fields)

layerwithz = source

@@ -223,12 +219,13 @@ def processAlgorithm(self, parameters, context, feedback):
totaldescent = totaldescent + descent
partnumber += 1
# Set the attribute values
attrs = feature.attributes()
attrs = []
# Append the attributes to the end of the existing ones
attrs.append(climb)
attrs.append(descent)
attrs.append(minelev)
attrs.append(maxelev)
attrs.extend(feature.attributes())

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

0 comments on commit 34f0232

Please sign in to comment.
You can’t perform that action at this time.