Skip to content
Permalink
Browse files

Update python code

  • Loading branch information
nyalldawson committed Nov 2, 2017
1 parent fd7ffad commit 73306f126667c029434f52515e95a2fc09eb66ca
@@ -155,18 +155,18 @@ def processAlgorithm(self, parameters, context, feedback):
data = QgsInterpolator.LayerData()

# need to keep a reference until interpolation is complete
layer = QgsProcessingUtils.mapLayerFromString(v[0], context)
data.vectorLayer = layer
layer = QgsProcessingUtils.variantToSource(v[0], context)
data.source = layer
layers.append(layer)

data.zCoordInterpolation = bool(v[1])
data.useZValue = bool(v[1])
data.interpolationAttribute = int(v[2])
if v[3] == '0':
data.mInputType = QgsInterpolator.POINTS
data.sourceType = QgsInterpolator.SourcePoints
elif v[3] == '1':
data.mInputType = QgsInterpolator.STRUCTURE_LINES
data.sourceType = QgsInterpolator.SourceStructureLines
else:
data.mInputType = QgsInterpolator.BREAK_LINES
data.sourceType = QgsInterpolator.SourceBreakLines
layerData.append(data)

interpolator = QgsIDWInterpolator(layerData)
@@ -175,20 +175,20 @@ def processAlgorithm(self, parameters, context, feedback):
data = QgsInterpolator.LayerData()

# need to keep a reference until interpolation is complete
layer = QgsProcessingUtils.mapLayerFromString(v[0], context)
data.vectorLayer = layer
layer = QgsProcessingUtils.variantToSource(v[0], context)
data.source = layer
layers.append(layer)
if not crs.isValid():
crs = layer.crs()
crs = layer.sourceCrs()

data.zCoordInterpolation = bool(v[1])
data.useZValue = bool(v[1])
data.interpolationAttribute = int(v[2])
if v[3] == '0':
data.mInputType = QgsInterpolator.POINTS
data.sourceType = QgsInterpolator.SourcePoints
elif v[3] == '1':
data.mInputType = QgsInterpolator.STRUCTURE_LINES
data.sourceType = QgsInterpolator.SourceStructureLines
else:
data.mInputType = QgsInterpolator.BREAK_LINES
data.sourceType = QgsInterpolator.SourceBreakLines
layerData.append(data)

if method == 0:
@@ -146,11 +146,11 @@ def value(self):
comboBox = self.layersTree.itemWidget(self.layersTree.topLevelItem(i), 2)
inputTypeName = comboBox.currentText()
if inputTypeName == self.tr('Points'):
inputType = QgsInterpolator.POINTS
inputType = QgsInterpolator.SourcePoints
elif inputTypeName == self.tr('Structure lines'):
inputType = QgsInterpolator.STRUCTURE_LINES
inputType = QgsInterpolator.SourceStructureLines
else:
inputType = QgsInterpolator.BREAK_LINES
inputType = QgsInterpolator.SourceBreakLines

layers += '{},{},{:d},{:d};'.format(layer.source(),
zCoord,

0 comments on commit 73306f1

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