From 3797ffae4132916a056045acefc7378d97abbb0c Mon Sep 17 00:00:00 2001 From: Alexander Bruy Date: Mon, 24 Mar 2014 19:44:39 +0200 Subject: [PATCH] [processing] fix wrong tools description (fix #9852) --- python/plugins/processing/algs/PointsFromLines.py | 2 +- python/plugins/processing/algs/PointsFromPolygons.py | 10 +++++----- .../processing/script/scripts/Points_from_vector.py | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/python/plugins/processing/algs/PointsFromLines.py b/python/plugins/processing/algs/PointsFromLines.py index 0f2a1ece3c1..dc6dda01c44 100644 --- a/python/plugins/processing/algs/PointsFromLines.py +++ b/python/plugins/processing/algs/PointsFromLines.py @@ -43,7 +43,7 @@ class PointsFromLines(GeoAlgorithm): OUTPUT_LAYER = 'OUTPUT_LAYER' def defineCharacteristics(self): - self.name = 'Get raster values at line nodes' + self.name = 'Generate points (pixel centroids) along line' self.group = 'Vector analysis tools' self.addParameter(ParameterRaster(self.INPUT_RASTER, 'Raster layer')) diff --git a/python/plugins/processing/algs/PointsFromPolygons.py b/python/plugins/processing/algs/PointsFromPolygons.py index 2b4bb506f38..43015c653c7 100644 --- a/python/plugins/processing/algs/PointsFromPolygons.py +++ b/python/plugins/processing/algs/PointsFromPolygons.py @@ -32,7 +32,7 @@ from processing.core.GeoAlgorithm import GeoAlgorithm from processing.parameters.ParameterRaster import ParameterRaster from processing.parameters.ParameterVector import ParameterVector from processing.outputs.OutputVector import OutputVector -from processing.tools import dataobjects, vector +from processing.tools import dataobjects, vector, raster from processing.tools.general import * @@ -44,7 +44,7 @@ class PointsFromPolygons(GeoAlgorithm): OUTPUT_LAYER = 'OUTPUT_LAYER' def defineCharacteristics(self): - self.name = 'Get raster values at polygon nodes' + self.name = 'Generate points (pixel centroids) inside polygons' self.group = 'Vector analysis tools' self.addParameter(ParameterRaster(self.INPUT_RASTER, 'Raster layer')) @@ -92,12 +92,12 @@ class PointsFromPolygons(GeoAlgorithm): yMin = bbox.yMinimum() yMax = bbox.yMaximum() - (startRow, startColumn) = mapToPixel(xMin, yMax, geoTransform) - (endRow, endColumn) = mapToPixel(xMax, yMin, geoTransform) + (startRow, startColumn) = raster.mapToPixel(xMin, yMax, geoTransform) + (endRow, endColumn) = raster.mapToPixel(xMax, yMin, geoTransform) for row in xrange(startRow, endRow + 1): for col in xrange(startColumn, endColumn + 1): - (x, y) = pixelToMap(row, col, geoTransform) + (x, y) = raster.pixelToMap(row, col, geoTransform) point.setX(x) point.setY(y) diff --git a/python/plugins/processing/script/scripts/Points_from_vector.py b/python/plugins/processing/script/scripts/Points_from_vector.py index 7bb007f3ab8..98fcf4722cf 100644 --- a/python/plugins/processing/script/scripts/Points_from_vector.py +++ b/python/plugins/processing/script/scripts/Points_from_vector.py @@ -5,13 +5,13 @@ from qgis.core import * -vector = processing.getobject(Input_vector) -raster = processing.getobject(Input_raster) +vector = processing.getObject(Input_vector) +raster = processing.getObject(Input_raster) geometryType = vector.geometryType() if geometryType == QGis.Point: processing.runalg('qgis:saveselectedfeatures', vector, Output_layer) elif geometryType == QGis.Line: - processing.runalg('qgis:pointsfromlines', raster, vector, Output_layer) + processing.runalg('qgis:generatepointspixelcentroidsalongline', raster, vector, Output_layer) elif geometryType == QGis.Polygon: - processing.runalg('qgis:pointsfrompolygons', raster, vector, Output_layer) + processing.runalg('qgis:generatepointspixelcentroidsinsidepolygons', raster, vector, Output_layer)