Skip to content
Permalink
Browse files
Port more processing dataobjects methods to c++
Also
- simplify and add tests
- remove large memory leak (persistant store of all non-project layers)
- remove broken support for direct loading postgres/virtual layers
by string (Python version was very broken and would never match
a postgres/virtual layer)
  • Loading branch information
nyalldawson committed Apr 5, 2017
1 parent ee29fa6 commit 377b181c4eb9804af1d557bf7f57001b25842dc1
Showing with 428 additions and 275 deletions.
  1. +28 −0 python/core/processing/qgsprocessingutils.sip
  2. +3 −3 python/plugins/processing/algs/exampleprovider/ExampleAlgorithm.py
  3. +1 −1 python/plugins/processing/algs/gdal/ClipByMask.py
  4. +2 −2 python/plugins/processing/algs/gdal/rasterize_over.py
  5. +5 −5 python/plugins/processing/algs/grass7/Grass7Algorithm.py
  6. +2 −2 python/plugins/processing/algs/grass7/nviz7.py
  7. +1 −1 python/plugins/processing/algs/qgis/AddTableField.py
  8. +1 −1 python/plugins/processing/algs/qgis/AutoincrementalField.py
  9. +1 −1 python/plugins/processing/algs/qgis/BarPlot.py
  10. +1 −1 python/plugins/processing/algs/qgis/BasicStatistics.py
  11. +1 −1 python/plugins/processing/algs/qgis/BasicStatisticsNumbers.py
  12. +1 −1 python/plugins/processing/algs/qgis/BasicStatisticsStrings.py
  13. +1 −1 python/plugins/processing/algs/qgis/Boundary.py
  14. +1 −1 python/plugins/processing/algs/qgis/BoundingBox.py
  15. +1 −1 python/plugins/processing/algs/qgis/Centroids.py
  16. +1 −1 python/plugins/processing/algs/qgis/CheckValidity.py
  17. +2 −2 python/plugins/processing/algs/qgis/Clip.py
  18. +3 −3 python/plugins/processing/algs/qgis/ConcaveHull.py
  19. +1 −1 python/plugins/processing/algs/qgis/ConvexHull.py
  20. +1 −1 python/plugins/processing/algs/qgis/CreateAttributeIndex.py
  21. +1 −1 python/plugins/processing/algs/qgis/CreateConstantRaster.py
  22. +1 −1 python/plugins/processing/algs/qgis/DefineProjection.py
  23. +1 −1 python/plugins/processing/algs/qgis/Delaunay.py
  24. +1 −1 python/plugins/processing/algs/qgis/DeleteColumn.py
  25. +1 −1 python/plugins/processing/algs/qgis/DeleteDuplicateGeometries.py
  26. +1 −1 python/plugins/processing/algs/qgis/DeleteHoles.py
  27. +1 −1 python/plugins/processing/algs/qgis/DensifyGeometries.py
  28. +1 −1 python/plugins/processing/algs/qgis/DensifyGeometriesInterval.py
  29. +2 −2 python/plugins/processing/algs/qgis/Difference.py
  30. +1 −1 python/plugins/processing/algs/qgis/Dissolve.py
  31. +1 −1 python/plugins/processing/algs/qgis/DropGeometry.py
  32. +1 −1 python/plugins/processing/algs/qgis/EliminateSelection.py
  33. +1 −1 python/plugins/processing/algs/qgis/EquivalentNumField.py
  34. +1 −1 python/plugins/processing/algs/qgis/ExecuteSQL.py
  35. +1 −1 python/plugins/processing/algs/qgis/Explode.py
  36. +1 −1 python/plugins/processing/algs/qgis/ExportGeometryInfo.py
  37. +1 −1 python/plugins/processing/algs/qgis/ExtendLines.py
  38. +1 −1 python/plugins/processing/algs/qgis/ExtentFromLayer.py
  39. +1 −1 python/plugins/processing/algs/qgis/ExtractByAttribute.py
  40. +1 −1 python/plugins/processing/algs/qgis/ExtractByExpression.py
  41. +2 −2 python/plugins/processing/algs/qgis/ExtractByLocation.py
  42. +1 −1 python/plugins/processing/algs/qgis/ExtractNodes.py
  43. +1 −1 python/plugins/processing/algs/qgis/ExtractSpecificNodes.py
  44. +1 −1 python/plugins/processing/algs/qgis/FieldPyculator.py
  45. +1 −1 python/plugins/processing/algs/qgis/FieldsCalculator.py
  46. +1 −1 python/plugins/processing/algs/qgis/FieldsMapper.py
  47. +1 −1 python/plugins/processing/algs/qgis/FindProjection.py
  48. +1 −1 python/plugins/processing/algs/qgis/FixGeometry.py
  49. +1 −1 python/plugins/processing/algs/qgis/FixedDistanceBuffer.py
  50. +1 −1 python/plugins/processing/algs/qgis/GeometryByExpression.py
  51. +1 −1 python/plugins/processing/algs/qgis/GeometryConvert.py
  52. +1 −1 python/plugins/processing/algs/qgis/Gridify.py
  53. +1 −1 python/plugins/processing/algs/qgis/Heatmap.py
  54. +2 −2 python/plugins/processing/algs/qgis/HubDistanceLines.py
  55. +2 −2 python/plugins/processing/algs/qgis/HubDistancePoints.py
  56. +2 −2 python/plugins/processing/algs/qgis/HubLines.py
  57. +1 −1 python/plugins/processing/algs/qgis/HypsometricCurves.py
  58. +7 −1 python/plugins/processing/algs/qgis/IdwInterpolation.py
  59. +1 −1 python/plugins/processing/algs/qgis/ImportIntoPostGIS.py
  60. +1 −1 python/plugins/processing/algs/qgis/ImportIntoSpatialite.py
  61. +2 −2 python/plugins/processing/algs/qgis/Intersection.py
  62. +2 −2 python/plugins/processing/algs/qgis/JoinAttributes.py
  63. +2 −2 python/plugins/processing/algs/qgis/LinesIntersection.py
  64. +1 −1 python/plugins/processing/algs/qgis/LinesToPolygons.py
  65. +1 −1 python/plugins/processing/algs/qgis/MeanAndStdDevPlot.py
  66. +1 −1 python/plugins/processing/algs/qgis/MeanCoords.py
  67. +1 −1 python/plugins/processing/algs/qgis/Merge.py
  68. +1 −1 python/plugins/processing/algs/qgis/MergeLines.py
  69. +1 −1 python/plugins/processing/algs/qgis/MultipartToSingleparts.py
  70. +1 −1 python/plugins/processing/algs/qgis/NearestNeighbourAnalysis.py
  71. +1 −1 python/plugins/processing/algs/qgis/OffsetLine.py
  72. +1 −1 python/plugins/processing/algs/qgis/OrientedMinimumBoundingBox.py
  73. +1 −1 python/plugins/processing/algs/qgis/Orthogonalize.py
  74. +2 −2 python/plugins/processing/algs/qgis/PointDistance.py
  75. +1 −1 python/plugins/processing/algs/qgis/PointOnSurface.py
  76. +1 −1 python/plugins/processing/algs/qgis/PointsAlongGeometry.py
  77. +1 −1 python/plugins/processing/algs/qgis/PointsDisplacement.py
  78. +1 −1 python/plugins/processing/algs/qgis/PointsFromLines.py
  79. +1 −1 python/plugins/processing/algs/qgis/PointsFromPolygons.py
  80. +2 −2 python/plugins/processing/algs/qgis/PointsInPolygon.py
  81. +2 −2 python/plugins/processing/algs/qgis/PointsInPolygonUnique.py
  82. +2 −2 python/plugins/processing/algs/qgis/PointsInPolygonWeighted.py
  83. +1 −1 python/plugins/processing/algs/qgis/PointsLayerFromTable.py
  84. +1 −1 python/plugins/processing/algs/qgis/PointsToPaths.py
  85. +1 −1 python/plugins/processing/algs/qgis/PolarPlot.py
  86. +1 −1 python/plugins/processing/algs/qgis/PoleOfInaccessibility.py
  87. +1 −1 python/plugins/processing/algs/qgis/PolygonCentroids.py
  88. +1 −1 python/plugins/processing/algs/qgis/Polygonize.py
  89. +1 −1 python/plugins/processing/algs/qgis/PolygonsToLines.py
  90. +1 −1 python/plugins/processing/algs/qgis/RandomExtract.py
  91. +1 −1 python/plugins/processing/algs/qgis/RandomExtractWithinSubsets.py
  92. +1 −1 python/plugins/processing/algs/qgis/RandomPointsAlongLines.py
  93. +1 −1 python/plugins/processing/algs/qgis/RandomPointsLayer.py
  94. +1 −1 python/plugins/processing/algs/qgis/RandomPointsPolygonsFixed.py
  95. +1 −1 python/plugins/processing/algs/qgis/RandomPointsPolygonsVariable.py
  96. +1 −1 python/plugins/processing/algs/qgis/RandomSelection.py
  97. +1 −1 python/plugins/processing/algs/qgis/RandomSelectionWithinSubsets.py
  98. +1 −1 python/plugins/processing/algs/qgis/RasterCalculator.py
  99. +1 −1 python/plugins/processing/algs/qgis/RasterLayerHistogram.py
  100. +1 −1 python/plugins/processing/algs/qgis/RasterLayerStatistics.py
  101. +1 −1 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py
  102. +1 −1 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py
  103. +1 −1 python/plugins/processing/algs/qgis/RemoveNullGeometry.py
  104. +1 −1 python/plugins/processing/algs/qgis/ReprojectLayer.py
  105. +1 −1 python/plugins/processing/algs/qgis/ReverseLineDirection.py
  106. +1 −1 python/plugins/processing/algs/qgis/SaveSelectedFeatures.py
  107. +1 −1 python/plugins/processing/algs/qgis/SelectByAttribute.py
  108. +1 −1 python/plugins/processing/algs/qgis/SelectByAttributeSum.py
  109. +1 −1 python/plugins/processing/algs/qgis/SelectByExpression.py
  110. +2 −2 python/plugins/processing/algs/qgis/SelectByLocation.py
  111. +2 −2 python/plugins/processing/algs/qgis/ServiceAreaFromLayer.py
  112. +1 −1 python/plugins/processing/algs/qgis/ServiceAreaFromPoint.py
  113. +1 −1 python/plugins/processing/algs/qgis/SetRasterStyle.py
  114. +1 −1 python/plugins/processing/algs/qgis/SetVectorStyle.py
  115. +2 −2 python/plugins/processing/algs/qgis/ShortestPathLayerToPoint.py
  116. +2 −2 python/plugins/processing/algs/qgis/ShortestPathPointToLayer.py
  117. +1 −1 python/plugins/processing/algs/qgis/ShortestPathPointToPoint.py
  118. +1 −1 python/plugins/processing/algs/qgis/SimplifyGeometries.py
  119. +1 −1 python/plugins/processing/algs/qgis/SinglePartsToMultiparts.py
  120. +1 −1 python/plugins/processing/algs/qgis/SingleSidedBuffer.py
  121. +1 −1 python/plugins/processing/algs/qgis/Smooth.py
  122. +2 −2 python/plugins/processing/algs/qgis/SnapGeometries.py
  123. +1 −1 python/plugins/processing/algs/qgis/SpatialIndex.py
  124. +2 −2 python/plugins/processing/algs/qgis/SpatialJoin.py
  125. +2 −2 python/plugins/processing/algs/qgis/SplitLinesWithLines.py
  126. +2 −2 python/plugins/processing/algs/qgis/SplitWithLines.py
  127. +1 −1 python/plugins/processing/algs/qgis/StatisticsByCategories.py
  128. +2 −2 python/plugins/processing/algs/qgis/SumLines.py
  129. +2 −2 python/plugins/processing/algs/qgis/SymmetricalDifference.py
  130. +1 −1 python/plugins/processing/algs/qgis/TextToFloat.py
  131. +7 −1 python/plugins/processing/algs/qgis/TinInterpolation.py
  132. +1 −1 python/plugins/processing/algs/qgis/TopoColors.py
  133. +1 −1 python/plugins/processing/algs/qgis/Translate.py
  134. +1 −1 python/plugins/processing/algs/qgis/TruncateTable.py
  135. +2 −2 python/plugins/processing/algs/qgis/Union.py
  136. +1 −1 python/plugins/processing/algs/qgis/UniqueValues.py
  137. +1 −1 python/plugins/processing/algs/qgis/VariableDistanceBuffer.py
  138. +1 −1 python/plugins/processing/algs/qgis/VectorLayerHistogram.py
  139. +1 −1 python/plugins/processing/algs/qgis/VectorLayerScatterplot.py
  140. +1 −1 python/plugins/processing/algs/qgis/VectorSplit.py
  141. +1 −1 python/plugins/processing/algs/qgis/VoronoiPolygons.py
  142. +1 −1 python/plugins/processing/algs/qgis/ZonalStatistics.py
  143. +2 −2 python/plugins/processing/algs/qgis/ZonalStatisticsQgis.py
  144. +2 −1 python/plugins/processing/algs/qgis/scripts/Frequency_analysis.py
  145. +2 −1 python/plugins/processing/algs/qgis/scripts/Keep_n_biggest_parts.py
  146. +2 −1 python/plugins/processing/algs/qgis/scripts/Number_of_unique_values_in_classes.py
  147. +1 −1 python/plugins/processing/algs/qgis/ui/HeatmapWidgets.py
  148. +4 −2 python/plugins/processing/algs/qgis/ui/InterpolationDataWidget.py
  149. +5 −5 python/plugins/processing/algs/saga/SagaAlgorithm.py
  150. +6 −6 python/plugins/processing/core/GeoAlgorithm.py
  151. +0 −5 python/plugins/processing/core/Processing.py
  152. +10 −11 python/plugins/processing/core/parameters.py
  153. +1 −1 python/plugins/processing/gui/AlgorithmDialog.py
  154. +1 −1 python/plugins/processing/gui/AlgorithmExecutor.py
  155. +2 −2 python/plugins/processing/gui/wrappers.py
  156. +2 −1 python/plugins/processing/tests/testdata/scripts/centroids.py
  157. +11 −59 python/plugins/processing/tools/dataobjects.py
  158. +1 −1 python/plugins/processing/tools/vector.py
  159. +77 −0 src/core/processing/qgsprocessingutils.cpp
  160. +28 −0 src/core/processing/qgsprocessingutils.h
  161. +56 −0 tests/src/core/testqgsprocessing.cpp
@@ -64,6 +64,34 @@ class QgsProcessingUtils
\see compatibleVectorLayers()
%End


static QgsMapLayer *mapLayerFromProject( const QString &string, QgsProject *project );
%Docstring
Interprets a string as a map layer from a project.

This method attempts to match a string to a project map layer, using
first the layer ID, then layer names, and finally layer source.
If the string matches a normalized version of any layer source
for layers in the specified project, then those matching layers will be
returned.
\see mapLayerFromString()
%End

static QgsMapLayer *mapLayerFromString( const QString &string ) /Factory/;
%Docstring
Interprets a string as a map layer. The method will attempt to
load a layer matching the passed string. E.g. if the string is a file path,
then the layer at this file path will be loaded.
The caller takes responsibility for deleting the returned map layer.
\see mapLayerFromProject()
%End

static QString normalizeLayerSource( const QString &source );
%Docstring
Normalizes a layer source string for safe comparison across different
operating system environments.
%End

};


@@ -88,10 +88,10 @@ def processAlgorithm(self, feedback):
output = self.getOutputValue(self.OUTPUT_LAYER)

# Input layers vales are always a string with its location.
# That string can be converted into a QGIS object (a
# That string can be converted into a QGIS layer (a
# QgsVectorLayer in this case) using the
# processing.getObjectFromUri() method.
vectorLayer = dataobjects.getObjectFromUri(inputFilename)
# dataobjects.getLayerFromString() method.
vectorLayer = dataobjects.getLayerFromString(inputFilename)

# And now we can process

@@ -103,7 +103,7 @@ def defineCharacteristics(self):
def getConsoleCommands(self):
out = self.getOutputValue(self.OUTPUT)
mask = self.getParameterValue(self.MASK)
maskLayer = dataobjects.getObjectFromUri(
maskLayer = dataobjects.getLayerFromString(
self.getParameterValue(self.MASK))
ogrMask = ogrConnectionString(mask)[1:-1]
noData = self.getParameterValue(self.NO_DATA)
@@ -69,8 +69,8 @@ def defineCharacteristics(self):
self.tr('Existing raster layer'), False))

def getConsoleCommands(self):
inLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
inRasterLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_RASTER))
inLayer = dataobjects.getLayerFromString(self.getParameterValue(self.INPUT))
inRasterLayer = dataobjects.getLayerFromString(self.getParameterValue(self.INPUT_RASTER))

ogrLayer = ogrConnectionString(inLayer)[1:-1]
ogrRasterLayer = ogrConnectionString(inRasterLayer)[1:-1]
@@ -229,15 +229,15 @@ def getDefaultCellsize(self):
if isinstance(param.value, QgsRasterLayer):
layer = param.value
else:
layer = dataobjects.getObjectFromUri(param.value)
layer = dataobjects.getLayerFromString(param.value)
cellsize = max(cellsize, (layer.extent().xMaximum() -
layer.extent().xMinimum()) /
layer.width())
elif isinstance(param, ParameterMultipleInput):

layers = param.value.split(';')
for layername in layers:
layer = dataobjects.getObjectFromUri(layername)
layer = dataobjects.getLayerFromString(layername)
if isinstance(layer, QgsRasterLayer):
cellsize = max(cellsize, (
layer.extent().xMaximum() -
@@ -515,11 +515,11 @@ def exportVectorLayer(self, orgFilename):
# but the functionality of v.in.ogr could be used for this.
# We also export if there is a selection
if not os.path.exists(orgFilename) or not orgFilename.endswith('shp'):
layer = dataobjects.getObjectFromUri(orgFilename, False)
layer = dataobjects.getLayerFromString(orgFilename, False)
if layer:
filename = dataobjects.exportVectorLayer(layer)
else:
layer = dataobjects.getObjectFromUri(orgFilename, False)
layer = dataobjects.getLayerFromString(orgFilename, False)
if layer:
useSelection = \
ProcessingConfig.getSetting(ProcessingConfig.USE_SELECTED)
@@ -553,7 +553,7 @@ def setSessionProjectionFromProject(self, commands):

def setSessionProjectionFromLayer(self, layer, commands):
if not Grass7Utils.projectionSet:
qGisLayer = dataobjects.getObjectFromUri(layer)
qGisLayer = dataobjects.getLayerFromString(layer)
if qGisLayer:
proj4 = str(qGisLayer.crs().toProj4())
command = 'g.proj'
@@ -173,15 +173,15 @@ def getDefaultCellsize(self):
if isinstance(param.value, QgsRasterLayer):
layer = param.value
else:
layer = dataobjects.getObjectFromUri(param.value)
layer = dataobjects.getLayerFromString(param.value)
cellsize = max(cellsize, (layer.extent().xMaximum() -
layer.extent().xMinimum()) /
layer.width())
elif isinstance(param, ParameterMultipleInput):

layers = param.value.split(';')
for layername in layers:
layer = dataobjects.getObjectFromUri(layername)
layer = dataobjects.getLayerFromString(layername)
if isinstance(layer, QgsRasterLayer):
cellsize = max(cellsize, (
layer.extent().xMaximum() -
@@ -90,7 +90,7 @@ def processAlgorithm(self, feedback):
fieldPrecision = self.getParameterValue(self.FIELD_PRECISION)
output = self.getOutputFromName(self.OUTPUT_LAYER)

layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT_LAYER))

fields = layer.fields()
@@ -63,7 +63,7 @@ def defineCharacteristics(self):
def processAlgorithm(self, feedback):
output = self.getOutputFromName(self.OUTPUT)
vlayer = \
dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
dataobjects.getLayerFromString(self.getParameterValue(self.INPUT))
fields = vlayer.fields()
fields.append(QgsField('AUTO', QVariant.Int))
writer = output.getVectorWriter(fields, vlayer.wkbType(),
@@ -74,7 +74,7 @@ def defineCharacteristics(self):
self.addOutput(OutputHTML(self.OUTPUT, self.tr('Bar plot')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT))
namefieldname = self.getParameterValue(self.NAME_FIELD)
valuefieldname = self.getParameterValue(self.VALUE_FIELD)
@@ -121,7 +121,7 @@ def defineCharacteristics(self):
self.addOutput(OutputNumber(self.IQR, self.tr('Interquartile Range (IQR)')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT_LAYER))
field_name = self.getParameterValue(self.FIELD_NAME)
field = layer.fields().at(layer.fields().lookupField(field_name))
@@ -115,7 +115,7 @@ def defineCharacteristics(self):
self.addOutput(OutputNumber(self.IQR, self.tr('Interquartile Range (IQR)')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT_LAYER))
fieldName = self.getParameterValue(self.FIELD_NAME)

@@ -101,7 +101,7 @@ def defineCharacteristics(self):
self.addOutput(OutputNumber(self.MAX_VALUE, self.tr('Maximum string value')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT_LAYER))
fieldName = self.getParameterValue(self.FIELD_NAME)

@@ -64,7 +64,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Boundary')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT_LAYER))

input_wkb = layer.wkbType()
@@ -63,7 +63,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Bounds'), datatype=[dataobjects.TYPE_VECTOR_POLYGON]))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT_LAYER))

writer = self.getOutputFromName(
@@ -64,7 +64,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Centroids'), datatype=[dataobjects.TYPE_VECTOR_POINT]))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT_LAYER))

writer = self.getOutputFromName(
@@ -100,7 +100,7 @@ def processAlgorithm(self, feedback):
settings.setValue(settings_method_key, initial_method_setting)

def doCheck(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT_LAYER))

settings = QgsSettings()
@@ -66,9 +66,9 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(Clip.OUTPUT, self.tr('Clipped')))

def processAlgorithm(self, feedback):
source_layer = dataobjects.getObjectFromUri(
source_layer = dataobjects.getLayerFromString(
self.getParameterValue(Clip.INPUT))
mask_layer = dataobjects.getObjectFromUri(
mask_layer = dataobjects.getLayerFromString(
self.getParameterValue(Clip.OVERLAY))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
@@ -79,15 +79,15 @@ def defineCharacteristics(self):
OutputVector(ConcaveHull.OUTPUT, self.tr('Concave hull'), datatype=[dataobjects.TYPE_VECTOR_POLYGON]))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(self.getParameterValue(ConcaveHull.INPUT))
layer = dataobjects.getLayerFromString(self.getParameterValue(ConcaveHull.INPUT))
alpha = self.getParameterValue(self.ALPHA)
holes = self.getParameterValue(self.HOLES)
no_multigeom = self.getParameterValue(self.NO_MULTIGEOMETRY)

# Delaunay triangulation from input point layer
feedback.setProgressText(self.tr('Creating Delaunay triangles...'))
delone_triangles = processing.run("qgis:delaunaytriangulation", layer, None)['OUTPUT']
delaunay_layer = processing.getObject(delone_triangles)
delaunay_layer = dataobjects.getLayerFromString(delone_triangles)

# Get max edge length from Delaunay triangles
feedback.setProgressText(self.tr('Computing edges max length...'))
@@ -127,7 +127,7 @@ def processAlgorithm(self, feedback):
feedback.setProgressText(self.tr('Dissolving Delaunay triangles...'))
dissolved = processing.run("qgis:dissolve", delaunay_layer,
True, None, None)['OUTPUT']
dissolved_layer = processing.getObject(dissolved)
dissolved_layer = dataobjects.getLayerFromString(dissolved)

# Save result
feedback.setProgressText(self.tr('Saving data...'))
@@ -77,7 +77,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, self.tr('Convex hull'), datatype=[dataobjects.TYPE_VECTOR_POLYGON]))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT))
useField = self.getParameterValue(self.METHOD) == 1
fieldName = self.getParameterValue(self.FIELD)
@@ -68,7 +68,7 @@ def defineCharacteristics(self):

def processAlgorithm(self, feedback):
file_name = self.getParameterValue(self.INPUT)
layer = dataobjects.getObjectFromUri(file_name)
layer = dataobjects.getLayerFromString(file_name)
field = self.getParameterValue(self.FIELD)
provider = layer.dataProvider()

@@ -68,7 +68,7 @@ def defineCharacteristics(self):
self.tr('Constant')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT))
value = self.getParameterValue(self.NUMBER)

@@ -75,7 +75,7 @@ def defineCharacteristics(self):

def processAlgorithm(self, feedback):
fileName = self.getParameterValue(self.INPUT)
layer = dataobjects.getObjectFromUri(fileName)
layer = dataobjects.getLayerFromString(fileName)
crs = QgsCoordinateReferenceSystem(self.getParameterValue(self.CRS))

provider = layer.dataProvider()
@@ -70,7 +70,7 @@ def defineCharacteristics(self):
datatype=[dataobjects.TYPE_VECTOR_POLYGON]))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT))

fields = [QgsField('POINTA', QVariant.Double, '', 24, 15),
@@ -65,7 +65,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, self.tr('Output layer')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getLayerFromString(self.getParameterValue(self.INPUT))

fields_to_delete = self.getParameterValue(self.COLUMNS).split(';')
fields = layer.fields()
@@ -59,7 +59,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, self.tr('Cleaned')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT))

fields = layer.fields()
@@ -65,7 +65,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, self.tr('Cleaned'), datatype=[dataobjects.TYPE_VECTOR_POLYGON]))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT))
min_area = self.getParameterValue(self.MIN_AREA)
if min_area is not None:
@@ -77,7 +77,7 @@ def defineCharacteristics(self):
self.tr('Densified')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT))
vertices = self.getParameterValue(self.VERTICES)

@@ -72,7 +72,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, self.tr('Densified')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
layer = dataobjects.getLayerFromString(self.getParameterValue(self.INPUT))
interval = self.getParameterValue(self.INTERVAL)

isPolygon = layer.geometryType() == QgsWkbTypes.PolygonGeometry
@@ -66,9 +66,9 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(Difference.OUTPUT, self.tr('Difference')))

def processAlgorithm(self, feedback):
layerA = dataobjects.getObjectFromUri(
layerA = dataobjects.getLayerFromString(
self.getParameterValue(Difference.INPUT))
layerB = dataobjects.getObjectFromUri(
layerB = dataobjects.getLayerFromString(
self.getParameterValue(Difference.OVERLAY))

geomType = QgsWkbTypes.multiType(layerA.wkbType())
@@ -76,7 +76,7 @@ def defineCharacteristics(self):
def processAlgorithm(self, feedback):
useField = not self.getParameterValue(Dissolve.DISSOLVE_ALL)
field_names = self.getParameterValue(Dissolve.FIELD)
vlayerA = dataobjects.getObjectFromUri(
vlayerA = dataobjects.getLayerFromString(
self.getParameterValue(Dissolve.INPUT))

writer = self.getOutputFromName(
@@ -66,7 +66,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT_TABLE, self.tr('Dropped geometry')))

def processAlgorithm(self, feedback):
layer = dataobjects.getObjectFromUri(
layer = dataobjects.getLayerFromString(
self.getParameterValue(self.INPUT_LAYER))
writer = self.getOutputFromName(
self.OUTPUT_TABLE).getVectorWriter(
@@ -78,7 +78,7 @@ def defineCharacteristics(self):
self.addOutput(OutputVector(self.OUTPUT, self.tr('Eliminated'), datatype=[dataobjects.TYPE_VECTOR_POLYGON]))