Skip to content
Permalink
Browse files

[sextante] more testing stuff and a couple of minor fixes

  • Loading branch information
volaya committed Mar 25, 2013
1 parent 2d76dbf commit 4189f459b7e18362535a4cbb7bc3e1da9484a106
@@ -50,7 +50,7 @@ def processAlgorithm(self, progress):
outFeat = QgsFeature()
inGeom = QgsGeometry()
nElement = 0
features = QGisLayers.features(layer)
features = QGisLayers.features(vlayer)
nFeat = len(features)
for feature in features:
nElement += 1
@@ -83,9 +83,9 @@ def processAlgorithm(self, progress):
nElement += 1
inGeom = inFeat.geometry()
outFeat.setGeometry(inGeom)
atMap = inFeat.attributeMap()
atMap.append(QVariant(result))
outFeat.setAttributeMap(atMap)
attrs = inFeat.attributes()
attrs.append(QVariant(result))
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
del writer

@@ -0,0 +1,23 @@
NAME:Model using field input and autoextent
GROUP:[Test models]
PARAMETER:ParameterVector|VECTORLAYER_VECTOR|vector|2|False
120.0,60.0
PARAMETER:ParameterTableField|TABLEFIELD_FIELD|field|VECTORLAYER_VECTOR|-1
340.0,60.0
VALUE:HARDCODEDPARAMVALUE_LINE_TYPE_0===0
VALUE:HARDCODEDPARAMVALUE_GRID_TYPE_0===3
VALUE:HARDCODEDPARAMVALUE_MULTIPLE_0===0
VALUE:HARDCODEDPARAMVALUE_USER_SIZE_0===10
VALUE:HARDCODEDPARAMVALUE_TARGET_0===0
ALGORITHM:saga:shapestogrid
207.0,202.0
None
-1|VECTORLAYER_VECTOR
-1|TABLEFIELD_FIELD
-1|HARDCODEDPARAMVALUE_MULTIPLE_0
-1|HARDCODEDPARAMVALUE_LINE_TYPE_0
-1|HARDCODEDPARAMVALUE_GRID_TYPE_0
-1|HARDCODEDPARAMVALUE_TARGET_0
None
-1|HARDCODEDPARAMVALUE_USER_SIZE_0
grid
@@ -0,0 +1,25 @@
NAME:Model using field input and extent input
GROUP:[Test models]
PARAMETER:ParameterVector|VECTORLAYER_LAYER|layer|-1|False
120.0,60.0
PARAMETER:ParameterExtent|EXTENT_EXTENT|extent|0,1,0,1
340.0,60.0
PARAMETER:ParameterTableField|TABLEFIELD_FIELD|field|VECTORLAYER_LAYER|-1
560.0,60.0
VALUE:HARDCODEDPARAMVALUE_LINE_TYPE_0===0
VALUE:HARDCODEDPARAMVALUE_GRID_TYPE_0===3
VALUE:HARDCODEDPARAMVALUE_MULTIPLE_0===0
VALUE:HARDCODEDPARAMVALUE_USER_SIZE_0===25
VALUE:HARDCODEDPARAMVALUE_TARGET_0===0
ALGORITHM:saga:shapestogrid
338.0,247.0
None
-1|VECTORLAYER_LAYER
-1|TABLEFIELD_FIELD
-1|HARDCODEDPARAMVALUE_MULTIPLE_0
-1|HARDCODEDPARAMVALUE_LINE_TYPE_0
-1|HARDCODEDPARAMVALUE_GRID_TYPE_0
-1|HARDCODEDPARAMVALUE_TARGET_0
-1|EXTENT_EXTENT
-1|HARDCODEDPARAMVALUE_USER_SIZE_0
rasterized
@@ -0,0 +1,32 @@
NAME:Model using numerical output
GROUP:[Test models]
PARAMETER:ParameterVector|VECTORLAYER_LAYER|layer|-1|False
120.0,60.0
PARAMETER:ParameterTableField|TABLEFIELD_FIELD|field|VECTORLAYER_LAYER|-1
340.0,60.0
VALUE:HARDCODEDPARAMVALUE_SEGMENTS_1===5
VALUE:HARDCODEDPARAMVALUE_DISSOLVE_1===True
ALGORITHM:qgis:basicstatisticsfornumericfields
343.0,220.0
None
-1|VECTORLAYER_LAYER
-1|TABLEFIELD_FIELD
None
None
None
None
None
None
None
None
None
None
None
ALGORITHM:qgis:fixeddistancebuffer
120.0,327.0
None
-1|VECTORLAYER_LAYER
0|MEAN
-1|HARDCODEDPARAMVALUE_SEGMENTS_1
-1|HARDCODEDPARAMVALUE_DISSOLVE_1
buffer
@@ -0,0 +1,29 @@
NAME:A SAGA and GRASS model
GROUP:[Test models]
PARAMETER:ParameterVector|VECTORLAYER_VECTOR|vector|-1|False
120.0,60.0
VALUE:HARDCODEDPARAMVALUE_GRASS_MIN_AREA_PARAMETER_0===0.0001
VALUE:HARDCODEDPARAMVALUE_GRASS_SNAP_TOLERANCE_PARAMETER_0===-1.0
VALUE:HARDCODEDPARAMVALUE_METHOD _1===False
VALUE:HARDCODEDPARAMVALUE_-c_0===True
VALUE:HARDCODEDPARAMVALUE_tolerance_0===0.01
VALUE:HARDCODEDPARAMVALUE_-s_0===True
VALUE:HARDCODEDPARAMVALUE_distance_0===2
ALGORITHM:grass:v.buffer.distance
120.0,160.0
None
-1|VECTORLAYER_VECTOR
-1|HARDCODEDPARAMVALUE_distance_0
-1|HARDCODEDPARAMVALUE_tolerance_0
-1|HARDCODEDPARAMVALUE_-s_0
-1|HARDCODEDPARAMVALUE_-c_0
None
-1|HARDCODEDPARAMVALUE_GRASS_SNAP_TOLERANCE_PARAMETER_0
-1|HARDCODEDPARAMVALUE_GRASS_MIN_AREA_PARAMETER_0
None
ALGORITHM:saga:polygoncentroids
340.0,260.0
None
0|output
-1|HARDCODEDPARAMVALUE_METHOD _1
output
@@ -0,0 +1,15 @@
NAME:A basic model
GROUP:[Test models]
PARAMETER:ParameterRaster|RASTERLAYER_RASTER|raster|False
120.0,60.0
VALUE:HARDCODEDPARAMVALUE_METHOD_0===5
ALGORITHM:saga:slopeaspectcurvature
120.0,160.0
None
-1|RASTERLAYER_RASTER
-1|HARDCODEDPARAMVALUE_METHOD_0
slope
None
None
None
None
@@ -54,7 +54,7 @@
#First we create the output layer.
#To do so, we create a SextanteVectorWriter, that we can later use to add features.
provider = vectorLayer.dataProvider()
writer = SextanteVectorWriter(output, None, provider.fields(), provider.geometryType(), layer.crs() )
writer = SextanteVectorWriter(output, None, provider.fields(), provider.geometryType(), vectorLayer.crs() )

#Now we take the selected features and add them to the output layer
selection = vectorLayer.selectedFeatures()

0 comments on commit 4189f45

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