Skip to content
Permalink
Browse files
Update SAGA ParameterVector params
  • Loading branch information
nyalldawson authored and alexbruy committed Nov 9, 2017
1 parent 6ef4557 commit 4ac6847bc70d2680b47c4fdd221c9f737901ef61
Show file tree
Hide file tree
Showing 141 changed files with 178 additions and 179 deletions.
@@ -32,13 +32,13 @@
QgsProcessingException,
QgsMessageLog,
QgsProcessingParameterRasterLayer,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterBoolean,
QgsProcessingParameterNumber,
QgsProcessingParameterEnum)
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.parameters import (getParameterFromString,
ParameterExtent,
ParameterVector,
ParameterTable,
ParameterMultipleInput,
ParameterFixedTable)
@@ -154,17 +154,16 @@ def processAlgorithm(self, parameters, context, feedback):
exportCommand = self.exportRasterLayer(parameters[param.name()], context)
if exportCommand is not None:
commands.append(exportCommand)
if isinstance(param, ParameterVector):
elif isinstance(param, QgsProcessingParameterFeatureSource):
if param.name() not in parameters or parameters[param.name()] is None:
continue
layer = QgsProcessingUtils.mapLayerFromString(parameters[param.name()], context, False)
if layer:
filename = dataobjects.exportVectorLayer(layer)
self.exportedLayers[param.value] = filename
elif not parameters[param.name()].endswith('shp'):
layer_path = self.parameterAsCompatibleSourceLayerPath(parameters, param.name(), context, 'shp', feedback=feedback)
if layer_path:
self.exportedLayers[parameters[param.name()]] = layer_path
else:
raise QgsProcessingException(
self.tr('Unsupported file format'))
if isinstance(param, ParameterTable):
elif isinstance(param, ParameterTable):
if param.name() not in parameters or parameters[param.name()] is None:
continue
table = QgsProcessingUtils.mapLayerFromString(parameters[param.name()], context, False)
@@ -174,7 +173,7 @@ def processAlgorithm(self, parameters, context, feedback):
elif not parameters[param.name()].endswith('shp'):
raise QgsProcessingException(
self.tr('Unsupported file format'))
if isinstance(param, ParameterMultipleInput):
elif isinstance(param, ParameterMultipleInput):
if param.name() not in parameters or parameters[param.name()] is None:
continue
layers = param.value.split(';')
@@ -214,7 +213,7 @@ def processAlgorithm(self, parameters, context, feedback):
for param in self.parameterDefinitions():
if not param.name() in parameters or parameters[param.name()] is None:
continue
if isinstance(param, (QgsProcessingParameterRasterLayer, ParameterVector, ParameterTable)):
if isinstance(param, (QgsProcessingParameterRasterLayer, QgsProcessingParameterFeatureSource, ParameterTable)):
value = parameters[param.name()]
if value in list(self.exportedLayers.keys()):
command += ' -' + param.name() + ' "' \
@@ -1,7 +1,7 @@
Accumulated Cost
grid_analysis
QgsProcessingParameterEnum|DEST_TYPE|Input Type of Destinations|[0] Point;[1] Grid|False|0
ParameterVector|DEST_POINTS|Destinations|-1|False
QgsProcessingParameterFeatureSource|DEST_POINTS|Destinations|-1|None|False
QgsProcessingParameterRasterLayer|DEST_GRID|Destinations|None|False
QgsProcessingParameterRasterLayer|COST|Local Cost|None|False
QgsProcessingParameterRasterLayer|DIR_MAXCOST|Direction of Maximum Cost|None|True
@@ -1,4 +1,4 @@
Add Coordinates to points
shapes_points
ParameterVector|INPUT|Points|0|False
QgsProcessingParameterFeatureSource|INPUT|Points|0|None|False
OutputVector|OUTPUT|Points with coordinates
@@ -1,6 +1,6 @@
Add Grid Values to Points
shapes_grid
ParameterVector|SHAPES|Points|0|False
QgsProcessingParameterFeatureSource|SHAPES|Points|0|None|False
ParameterMultipleInput|GRIDS|Grids|3|False
QgsProcessingParameterEnum|INTERPOL|Interpolation|[0] Nearest Neighbor;[1] Bilinear Interpolation;[2] Inverse Distance Interpolation;[3] Bicubic Spline Interpolation;[4] B-Spline Interpolation
OutputVector|RESULT|Result
@@ -1,6 +1,6 @@
Add Grid Values to Shapes
shapes_grid
ParameterVector|SHAPES|Shapes|-1|False
QgsProcessingParameterFeatureSource|SHAPES|Shapes|-1|None|False
ParameterMultipleInput|GRIDS|Grids|3|False
QgsProcessingParameterEnum|INTERPOL|Interpolation|[0] Nearest Neighbor;[1] Bilinear Interpolation;[2] Inverse Distance Interpolation;[3] Bicubic Spline Interpolation;[4] B-Spline Interpolation
OutputVector|RESULT|Result
@@ -1,7 +1,7 @@
Add Point Attributes to Polygons
shapes_polygons
ParameterVector|INPUT|Polygons|2|False
ParameterVector|POINTS|Points|0|False
QgsProcessingParameterFeatureSource|INPUT|Polygons|2|None|False
QgsProcessingParameterFeatureSource|POINTS|Points|0|None|False
ParameterTableField|FIELDS|Attributes|POINTS|-1|False
QgsProcessingParameterBoolean|ADD_LOCATION_INFO|Add location info|False
OutputVector|OUTPUT|Result
@@ -1,6 +1,6 @@
Add Polygon Attributes to Points
shapes_points
ParameterVector|INPUT|Points|0|False
ParameterVector|POLYGONS|Polygons|2|False
QgsProcessingParameterFeatureSource|INPUT|Points|0|None|False
QgsProcessingParameterFeatureSource|POLYGONS|Polygons|2|None|False
ParameterTableField|FIELDS|Attribute|POLYGONS|-1|False
OutputVector|OUTPUT|Result
@@ -1,6 +1,6 @@
Aggregate Point Observations
shapes_points
ParameterVector|REFERENCE|Reference Points|-1|False
QgsProcessingParameterFeatureSource|REFERENCE|Reference Points|-1|None|False
ParameterTableField|REFERENCE_ID|ID|REFERENCE|-1|False
ParameterTable|OBSERVATIONS|Observations|False
ParameterTableField|X|X|OBSERVATIONS|-1|False
@@ -1,6 +1,6 @@
Angular Distance Weighted
grid_gridding
ParameterVector|SHAPES|Points|-1|False
QgsProcessingParameterFeatureSource|SHAPES|Points|-1|None|False
ParameterTable|FIELD|Attribute|False
QgsProcessingParameterEnum|TARGET_DEFINITION|Target Grid System|[0] user defined;[1] grid or grid system|False|0
QgsProcessingParameterNumber|TARGET_USER_SIZE|Cellsize|QgsProcessingParameterNumber.Double|1.000000|False| 0.000000|None
@@ -2,7 +2,7 @@ Artificial Neural Network Classification (OpenCV)
imagery_opencv
ParameterMultipleInput|FEATURES|Features|3|False
QgsProcessingParameterBoolean|NORMALIZE|Normalize|False
ParameterVector|TRAIN_AREAS|Training Areas|2|False
QgsProcessingParameterFeatureSource|TRAIN_AREAS|Training Areas|2|None|False
ParameterTable|TRAIN_CLASS|Class Identifier|False
QgsProcessingParameterRasterDestination|CLASSES|Classification
QgsProcessingParameterNumber|ANN_LAYERS|Number of Layers|QgsProcessingParameterNumber.Integer|3|False|1|None
@@ -1,6 +1,6 @@
B-Spline Approximation
grid_spline
ParameterVector|SHAPES|Points|0|False
QgsProcessingParameterFeatureSource|SHAPES|Points|0|None|False
ParameterTableField|FIELD|Attribute|SHAPES|-1|False
Hardcoded|-TARGET_DEFINITION 0
QgsProcessingParameterNumber|LEVEL|Resolution|QgsProcessingParameterNumber.Double|1.0|False|0.001|None
@@ -2,7 +2,7 @@ Boosting Classification (OpenCV)
imagery_opencv
ParameterMultipleInput|FEATURES|Features|3|False
QgsProcessingParameterBoolean|NORMALIZE|Normalize|False
ParameterVector|TRAIN_AREAS|Training Areas|-1|False
QgsProcessingParameterFeatureSource|TRAIN_AREAS|Training Areas|-1|None|False
ParameterTable|TRAIN_CLASS|Class Identifier|False
QgsProcessingParameterRasterDestination|CLASSES|Classification
QgsProcessingParameterNumber|MAX_DEPTH|Maximum Tree Depth|QgsProcessingParameterNumber.Integer|10|False| 1|None
@@ -1,5 +1,5 @@
Clip Grid with Polygon
shapes_grid
QgsProcessingParameterRasterLayer|INPUT|Input|None|False
ParameterVector|POLYGONS|Polygons|2|False
QgsProcessingParameterFeatureSource|POLYGONS|Polygons|2|None|False
QgsProcessingParameterRasterDestination|OUTPUT|Clipped
@@ -1,7 +1,7 @@
Clip Points with Polygons
shapes_points
ParameterVector|POINTS|Points|0|False
ParameterVector|POLYGONS|Polygons|2|False
QgsProcessingParameterFeatureSource|POINTS|Points|0|None|False
QgsProcessingParameterFeatureSource|POLYGONS|Polygons|2|None|False
ParameterTableField|FIELD|Add Attribute to Clipped Points|POLYGONS|-1|False
QgsProcessingParameterEnum|METHOD|Clipping Options|[0] one layer for all points;[1] separate layer for each polygon
OutputVector|CLIPS|Clipped Points
@@ -1,6 +1,6 @@
Cluster Analysis (Shapes)
table_calculus
ParameterVector|INPUT|Shapes|-1|False
QgsProcessingParameterFeatureSource|INPUT|Shapes|-1|None|False
OutputVector|RESULT|Result
ParameterTable|FIELDS|Attributes|False
ParameterTable|CLUSTER|Cluster|False
@@ -5,7 +5,7 @@ ParameterTable|GRID_LUT|Look-up Table|True
ParameterTableField|GRID_LUT_MIN|Value|GRID_LUT|-1|True
ParameterTableField|GRID_LUT_MAX|Value (Maximum)|GRID_LUT|-1|True
ParameterTableField|GRID_LUT_NAM|Name|GRID_LUT|-1|True
ParameterVector|POLYGONS|Polygons|2|False
QgsProcessingParameterFeatureSource|POLYGONS|Polygons|2|None|False
ParameterTableField|FIELD|Classes|POLYGONS|-1|False
OutputTable|CONFUSION|Confusion Matrix
OutputTable|CLASSES|Class Values
@@ -5,7 +5,7 @@ ParameterTable|GRID_LUT|Look-up Table|True
ParameterTable|GRID_LUT_MIN|Value|False
ParameterTable|GRID_LUT_MAX|Value (Maximum)|False
ParameterTable|GRID_LUT_NAM|Name|False
ParameterVector|POLYGONS|Polygons|-1|False
QgsProcessingParameterFeatureSource|POLYGONS|Polygons|-1|None|False
ParameterTable|FIELD|Classes|False
ParameterTable|CONFUSION|Confusion Matrix|False
ParameterTable|CLASSES|Class Values|False
@@ -1,6 +1,6 @@
Convert Lines to Points
shapes_points
ParameterVector|LINES|Lines|1|False
QgsProcessingParameterFeatureSource|LINES|Lines|1|None|False
QgsProcessingParameterBoolean|ADD |Insert Additional Points|True
QgsProcessingParameterNumber|DIST|Insert Distance|QgsProcessingParameterNumber.Double|1.0|False|0.0|None
OutputVector|POINTS|Points
@@ -1,4 +1,4 @@
Convert Lines to Polygons
shapes_polygons
ParameterVector|LINES|Lines|1|False
QgsProcessingParameterFeatureSource|LINES|Lines|1|None|False
OutputVector|POLYGONS|Polygons
@@ -1,4 +1,4 @@
Convert Multipoints to Points
shapes_points
ParameterVector|MULTIPOINTS|Multipoints|0|False
QgsProcessingParameterFeatureSource|MULTIPOINTS|Multipoints|0|None|False
OutputVector|POINTS|Points
@@ -1,6 +1,6 @@
Convert Points to Line(s)
shapes_lines
ParameterVector|POINTS|Points|0|False
QgsProcessingParameterFeatureSource|POINTS|Points|0|None|False
ParameterTableField|ORDER|Order by...|POINTS|-1|False
ParameterTableField|SEPARATE|Separate by...|POINTS|-1|False
OutputVector|LINES|Lines
@@ -1,4 +1,4 @@
Convert Polygon/Line Vertices to Points
shapes_polygons
ParameterVector|SHAPES|Shapes|-1|False
QgsProcessingParameterFeatureSource|SHAPES|Shapes|-1|None|False
OutputVector|POINTS|Points
@@ -1,4 +1,4 @@
Convert Polygons to Lines
shapes_lines
ParameterVector|POLYGONS|Polygons|2|False
QgsProcessingParameterFeatureSource|POLYGONS|Polygons|2|None|False
OutputVector|LINES|Lines
@@ -1,6 +1,6 @@
Convex Hull
shapes_points
ParameterVector|SHAPES|Points|0|False
QgsProcessingParameterFeatureSource|SHAPES|Points|0|None|False
QgsProcessingParameterEnum|POLYPOINTS|Hull Construction|[0] one hull for all shapes;[1] one hull per shape;[2] one hull per shape part
OutputVector|HULLS|Convex Hull
OutputVector|BOXES|Minimum Bounding Box
@@ -1,7 +1,7 @@
Create Lines Graticule|Create Graticule
shapes_tools
Hardcoded|-TYPE 0
ParameterVector|EXTENT|Extent|-1|True
QgsProcessingParameterFeatureSource|EXTENT|Extent|-1|None|True
Extent EXTENT_X_MIN EXTENT_X_MAX EXTENT_Y_MIN EXTENT_Y_MAX
QgsProcessingParameterNumber|DIVISION_X|Division Width|QgsProcessingParameterNumber.Double|1.0|False|None|None
QgsProcessingParameterNumber|DIVISION_Y|Division Height|QgsProcessingParameterNumber.Double|1.0|False|None|None
@@ -1,7 +1,7 @@
Create Polygons Graticule|Create Graticule
shapes_tools
Hardcoded|-TYPE 1
ParameterVector|EXTENT|Extent|-1|True
QgsProcessingParameterFeatureSource|EXTENT|Extent|-1|None|True
Extent EXTENT_X_MIN EXTENT_X_MAX EXTENT_Y_MIN EXTENT_Y_MAX
QgsProcessingParameterNumber|DIVISION_X|Division Width|QgsProcessingParameterNumber.Double|1.0|False|None|None
QgsProcessingParameterNumber|DIVISION_Y|Division Height|QgsProcessingParameterNumber.Double|1.0|False|None|None
@@ -1,7 +1,7 @@
Cross Profiles
ta_profiles
QgsProcessingParameterRasterLayer|DEM|DEM|None|False
ParameterVector|LINES|Lines|1|False
QgsProcessingParameterFeatureSource|LINES|Lines|1|None|False
QgsProcessingParameterNumber|DIST_LINE|Profile Distance|QgsProcessingParameterNumber.Double|10.0|False|0.0|None
QgsProcessingParameterNumber|DIST_PROFILE|Profile Length|QgsProcessingParameterNumber.Double|10.0|False|0.0|None
QgsProcessingParameterNumber|NUM_PROFILE|Profile Samples|QgsProcessingParameterNumber.Double|10.0|False|1.0|None
@@ -1,6 +1,6 @@
Cubic Spline Approximation
grid_spline
ParameterVector|SHAPES|Points|0|False
QgsProcessingParameterFeatureSource|SHAPES|Points|0|None|False
ParameterTableField|FIELD|Attribute|SHAPES|-1|False
Hardcoded|-TARGET_DEFINITION 0
QgsProcessingParameterNumber|NPMIN|Minimal Number of Points|QgsProcessingParameterNumber.Integer|3|False|0|None
@@ -1,7 +1,7 @@
Cut Shapes Layer
shapes_tools
ParameterVector|SHAPES|Vector layer to cut|-1|False
QgsProcessingParameterFeatureSource|SHAPES|Vector layer to cut|-1|None|False
QgsProcessingParameterEnum|METHOD|Method|[0] completely contained;[1] intersects;[2] center
Hardcoded|-TARGET 3
ParameterVector|POLYGONS_POLYGONS|Cutting polygons|2|False
QgsProcessingParameterFeatureSource|POLYGONS_POLYGONS|Cutting polygons|2|None|False
OutputVector|CUT|Result
@@ -2,7 +2,7 @@ Decision Tree Classification (OpenCV)
imagery_opencv
ParameterMultipleInput|FEATURES|Features|3|False
QgsProcessingParameterBoolean|NORMALIZE|Normalize|False
ParameterVector|TRAIN_AREAS|Training Areas|-1|False
QgsProcessingParameterFeatureSource|TRAIN_AREAS|Training Areas|-1|None|False
ParameterTable|TRAIN_CLASS|Class Identifier|False
QgsProcessingParameterRasterDestination|CLASSES|Classification
QgsProcessingParameterNumber|MAX_DEPTH|Maximum Tree Depth|QgsProcessingParameterNumber.Integer|10|False| 1|None
@@ -1,6 +1,6 @@
Difference
shapes_polygons
ParameterVector|A|Layer A|-1|False
ParameterVector|B|Layer B|-1|False
QgsProcessingParameterFeatureSource|A|Layer A|-1|None|False
QgsProcessingParameterFeatureSource|B|Layer B|-1|None|False
OutputVector|RESULT|Difference
QgsProcessingParameterBoolean|SPLIT|Split Parts|True
@@ -1,7 +1,7 @@
Directional Statistics for Single Grid
statistics_grid
QgsProcessingParameterRasterLayer|GRID|Grid|None|False
ParameterVector|POINTS|Points|-1|True
QgsProcessingParameterFeatureSource|POINTS|Points|-1|None|True
QgsProcessingParameterNumber|DIRECTION|Direction [Degree]|QgsProcessingParameterNumber.Double|0.0|False|None|None
QgsProcessingParameterNumber|TOLERANCE|Tolerance [Degree]|QgsProcessingParameterNumber.Double|0.0|False|None|None
QgsProcessingParameterNumber|MAXDISTANCE|Maximum Distance [Cells]|QgsProcessingParameterNumber.Integer|0|False|None|None