Skip to content
Permalink
Browse files
[processing] adopt native algs to use output geomerty
  • Loading branch information
alexbruy committed Sep 2, 2016
1 parent 13cd4c9 commit 80653c7
Show file tree
Hide file tree
Showing 47 changed files with 51 additions and 48 deletions.
@@ -55,7 +55,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY]))

self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Centroids')))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Centroids'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -56,7 +56,7 @@ def defineCharacteristics(self):
self.tr('Allow holes'), True))
self.addParameter(ParameterBoolean(self.NO_MULTIGEOMETRY,
self.tr('Split multipart geometry into singleparts geometries'), False))
self.addOutput(OutputVector(ConcaveHull.OUTPUT, self.tr('Concave hull')))
self.addOutput(OutputVector(ConcaveHull.OUTPUT, self.tr('Concave hull'),datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(self.getParameterValue(ConcaveHull.INPUT))
@@ -67,7 +67,7 @@ def defineCharacteristics(self):
self.INPUT, optional=True))
self.addParameter(ParameterSelection(self.METHOD,
self.tr('Method'), self.methods))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Convex hull')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Convex hull'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -58,7 +58,8 @@ def defineCharacteristics(self):
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_POINT]))

self.addOutput(OutputVector(self.OUTPUT,
self.tr('Delaunay triangulation')))
self.tr('Delaunay triangulation'),
datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -42,7 +42,7 @@ def defineCharacteristics(self):

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_POLYGON]))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Cleaned')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Cleaned'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -94,7 +94,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterSelection(self.MODE,
self.tr('Merge selection with the neighbouring polygon with the'),
self.modes))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Cleaned')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Cleaned'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
inLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
@@ -42,7 +42,7 @@ def defineCharacteristics(self):
self.group, self.i18n_group = self.trAlgorithm('Vector geometry tools')
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_LINE]))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Exploded')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Exploded'), datatype=[OutputVector.VECTOR_TYPE_LINE]))

def processAlgorithm(self, progress):
vlayer = dataobjects.getObjectFromUri(
@@ -60,7 +60,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterBoolean(self.BY_FEATURE,
self.tr('Calculate extent for each feature separately'), False))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Extent')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Extent'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -57,7 +57,7 @@ def defineCharacteristics(self):
self.tr('Input layer'),
[ParameterVector.VECTOR_TYPE_POLYGON, ParameterVector.VECTOR_TYPE_LINE]))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Nodes')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Nodes'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -87,7 +87,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterNumber(self.MITRE_LIMIT,
self.tr('Mitre limit'), 1, default=2))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Buffer')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Buffer'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
@@ -62,7 +62,7 @@ def defineCharacteristics(self):
self.tr('Vertical spacing'), default=10.0))
self.addParameter(ParameterCrs(self.CRS, 'Grid CRS'))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Grid')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Grid'), datatype=[OutputVector.VECTOR_TYPE_LINE]))

def processAlgorithm(self, progress):
extent = self.getParameterValue(self.EXTENT).split(',')
@@ -70,7 +70,7 @@ def defineCharacteristics(self):
self.tr('Vertical spacing'), default=10.0))
self.addParameter(ParameterCrs(self.CRS, 'Grid CRS'))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Grid')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Grid'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
idx = self.getParameterValue(self.TYPE)
@@ -72,7 +72,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterSelection(self.UNIT,
self.tr('Measurement unit'), self.units))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Hub distance')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Hub distance'), datatype=[OutputVector.VECTOR_TYPE_LINE]))

def processAlgorithm(self, progress):
layerPoints = dataobjects.getObjectFromUri(
@@ -72,7 +72,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterSelection(self.UNIT,
self.tr('Measurement unit'), self.units))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Hub distance')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Hub distance'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layerPoints = dataobjects.getObjectFromUri(
@@ -55,7 +55,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterTableField(self.SPOKE_FIELD,
self.tr('Spoke ID field'), self.SPOKES))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Hub lines')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Hub lines'), datatype=[OutputVector.VECTOR_TYPE_LINE]))

def processAlgorithm(self, progress):
layerHub = dataobjects.getObjectFromUri(
@@ -71,7 +71,7 @@ def defineCharacteristics(self):
self.INPUT_B,
optional=True))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Intersections')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Intersections'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layerA = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_A))
@@ -53,7 +53,7 @@ def defineCharacteristics(self):

self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_LINE]))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Polygons from lines')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Polygons from lines'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
@@ -65,7 +65,7 @@ def defineCharacteristics(self):
self.tr('Unique ID field'), MeanCoords.POINTS,
ParameterTableField.DATA_TYPE_NUMBER, optional=True))

self.addOutput(OutputVector(MeanCoords.OUTPUT, self.tr('Mean coordinates')))
self.addOutput(OutputVector(MeanCoords.OUTPUT, self.tr('Mean coordinates'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.POINTS))
@@ -54,7 +54,7 @@ def defineCharacteristics(self):

self.addParameter(ParameterVector(self.INPUT_LAYER,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_LINE]))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Merged')))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Merged'), datatype=[OutputVector.VECTOR_TYPE_LINE]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -52,7 +52,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterBoolean(self.BY_FEATURE,
self.tr('Calculate OMBB for each feature separately'), True))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Oriented_MBBox')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Oriented_MBBox'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -53,7 +53,7 @@ def defineCharacteristics(self):
0.00001, 999999999.999990, 0.00015))
self.addParameter(ParameterBoolean(self.HORIZONTAL,
self.tr('Horizontal distribution for two point case')))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Displaced')))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Displaced'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
radius = self.getParameterValue(self.DISTANCE)
@@ -50,7 +50,7 @@ def defineCharacteristics(self):
self.tr('Raster layer')))
self.addParameter(ParameterVector(self.INPUT_VECTOR,
self.tr('Vector layer'), [ParameterVector.VECTOR_TYPE_LINE]))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Points along line')))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Points along line'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_VECTOR))
@@ -50,7 +50,7 @@ def defineCharacteristics(self):
self.tr('Raster layer')))
self.addParameter(ParameterVector(self.INPUT_VECTOR,
self.tr('Vector layer'), [ParameterVector.VECTOR_TYPE_POLYGON]))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Points from polygons')))
self.addOutput(OutputVector(self.OUTPUT_LAYER, self.tr('Points from polygons'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_VECTOR))
@@ -61,7 +61,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterString(self.FIELD,
self.tr('Count field name'), 'NUMPOINTS'))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Count')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Count'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
polyLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POLYGONS))
@@ -54,7 +54,7 @@ def defineCharacteristics(self):
self.tr('Class field'), self.POINTS))
self.addParameter(ParameterString(self.FIELD,
self.tr('Count field name'), 'NUMPOINTS'))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Unique count')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Unique count'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
polyLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POLYGONS))
@@ -61,7 +61,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterString(self.FIELD,
self.tr('Count field name'), 'NUMPOINTS'))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Weighted count')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Weighted count'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
polyLayer = dataobjects.getObjectFromUri(self.getParameterValue(self.POLYGONS))
@@ -57,7 +57,7 @@ def defineCharacteristics(self):
self.tr('Y field'), self.INPUT, ParameterTableField.DATA_TYPE_ANY))
self.addParameter(ParameterCrs(self.TARGET_CRS,
self.tr('Target CRS'), 'EPSG:4326'))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Points from table')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Points from table'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
source = self.getParameterValue(self.INPUT)
@@ -64,7 +64,7 @@ def defineCharacteristics(self):
#self.addParameter(ParameterNumber(
# self.GAP_PERIOD,
# 'Gap period (if order field is DateTime)', 0, 60, 0))
self.addOutput(OutputVector(self.OUTPUT_LINES, self.tr('Paths')))
self.addOutput(OutputVector(self.OUTPUT_LINES, self.tr('Paths'), datatype=[OutputVector.VECTOR_TYPE_LINE]))
self.addOutput(OutputDirectory(self.OUTPUT_TEXT, self.tr('Directory')))

def processAlgorithm(self, progress):
@@ -55,7 +55,7 @@ def defineCharacteristics(self):
self.tr('Keep table structure of line layer'), False))
self.addParameter(ParameterBoolean(self.GEOMETRY,
self.tr('Create geometry columns'), True))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Polygons from lines')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Polygons from lines'), datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
vlayer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
@@ -54,7 +54,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_POLYGON]))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Lines from polygons')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Lines from polygons'), datatype=[OutputVector.VECTOR_TYPE_LINE]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
@@ -57,7 +57,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterNumber(self.MIN_DISTANCE,
self.tr('Minimum distance'), 0.0, None, 0.0))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Random points')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Random points'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -64,7 +64,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterNumber(self.MIN_DISTANCE,
self.tr('Minimum distance'), 0.0, None, 0.0))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Random points')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Random points'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
pointCount = int(self.getParameterValue(self.POINT_NUMBER))
@@ -63,7 +63,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterNumber(self.MIN_DISTANCE,
self.tr('Minimum distance'), 0.0, None, 0.0))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Random points')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Random points'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -71,7 +71,7 @@ def defineCharacteristics(self):
self.addParameter(ParameterNumber(self.MIN_DISTANCE,
self.tr('Minimum distance'), 0.0, None, 0.0))

self.addOutput(OutputVector(self.OUTPUT, self.tr('Random points')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Random points'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -72,7 +72,7 @@ def defineCharacteristics(self):
self.VECTOR, ParameterTableField.DATA_TYPE_NUMBER))
self.addParameter(ParameterNumber(self.MIN_DISTANCE,
self.tr('Minimum distance'), 0.0, None, 0.0))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Random points')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Random points'), datatype=[OutputVector.VECTOR_TYPE_POINT]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -76,7 +76,8 @@ def defineCharacteristics(self):
36))

self.addOutput(OutputVector(self.OUTPUT_LAYER,
self.tr('Output')))
self.tr('Output'),
datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -84,7 +84,8 @@ def defineCharacteristics(self):
36))

self.addOutput(OutputVector(self.OUTPUT_LAYER,
self.tr('Output')))
self.tr('Output'),
datatype=[OutputVector.VECTOR_TYPE_POLYGON]))

def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
@@ -70,7 +70,7 @@ def defineCharacteristics(self):
self.tr('Apply random offset to point spacing'), False))
self.addParameter(ParameterBoolean(self.IS_SPACING,
self.tr('Use point spacing'), True))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Regular points')))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Regular points'), datatype=[OutputVector.VECTOR_TYPE_POINT]))