Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update python code
  • Loading branch information
nyalldawson committed Nov 2, 2017
1 parent fd7ffad commit 73306f1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions python/plugins/processing/algs/qgis/IdwInterpolation.py
Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions python/plugins/processing/algs/qgis/TinInterpolation.py
Expand Up @@ -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:
Expand Down
Expand Up @@ -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,
Expand Down

0 comments on commit 73306f1

Please sign in to comment.