Skip to content

Commit

Permalink
[processing] improve rasterize dialog UI, add help (#5008)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Aug 11, 2017
1 parent 5336a0d commit 1053823
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 24 deletions.
11 changes: 11 additions & 0 deletions python/plugins/processing/algs/help/qgis.yaml
Expand Up @@ -473,6 +473,17 @@ qgis:rasterlayerhistogram: >
qgis:rasterlayerstatistics: >
This algorithm computes basic statistics from the values in a given band of the raster layer.

qgis:rasterize: >
This algorithm rasterizes map canvas content.

A map theme can be selected to render a predetermined set of layers with a defined style for each layer.

Alternatively, a single layer can be selected if not map theme is set.

This comment has been minimized.

Copy link
@DelazJ

DelazJ Aug 11, 2017

Contributor

@nirvn typo: if no map theme is set, right?


If neither map theme nor the layer is set, the current map content will be rendered.

The minimum extent entered will internally be extended to be a multiple of the tile size.

qgis:refactorfields: >
This algorithm allows editing the structure of the attributes table of a vector layer. Fields can be modified in their type and name, using a fields mapping.

Expand Down
46 changes: 22 additions & 24 deletions python/plugins/processing/algs/qgis/Rasterize.py
Expand Up @@ -84,31 +84,10 @@ def initAlgorithm(self, config=None):
with some other properties.
"""
# The parameters
map_theme_param = QgsProcessingParameterString(
self.MAP_THEME,
description=self.tr(
'Map theme to render.'),
defaultValue=None, optional=True)

map_theme_param.setMetadata(
{'widget_wrapper': {
'class':
'processing.gui.wrappers_map_theme.MapThemeWrapper'}})
self.addParameter(map_theme_param)

self.addParameter(
QgsProcessingParameterMapLayer(
self.LAYER,
description=self.tr(
'Layer to render. Will only be used if the map theme '
'is not set. '
'If both, map theme and layer are not '
'set, the current map content will be rendered.'),
optional=True))
self.addParameter(
QgsProcessingParameterExtent(self.EXTENT, description=self.tr(
'The minimum extent to render. Will internally be extended to '
'be a multiple of the tile sizes.')))
'Minimum extent to render')))

self.addParameter(
QgsProcessingParameterNumber(
self.TILE_SIZE,
Expand All @@ -125,6 +104,25 @@ def initAlgorithm(self, config=None):
type=QgsProcessingParameterNumber.Double
))

map_theme_param = QgsProcessingParameterString(
self.MAP_THEME,
description=self.tr(
'Map theme to render'),
defaultValue=None, optional=True)

map_theme_param.setMetadata(
{'widget_wrapper': {
'class':
'processing.gui.wrappers_map_theme.MapThemeWrapper'}})
self.addParameter(map_theme_param)

self.addParameter(
QgsProcessingParameterMapLayer(
self.LAYER,
description=self.tr(
'Single layer to render'),
optional=True))

# We add a raster layer as output
self.addParameter(QgsProcessingParameterRasterDestination(
self.OUTPUT,
Expand All @@ -133,7 +131,7 @@ def initAlgorithm(self, config=None):

def name(self):
# Unique (non-user visible) name of algorithm
return 'Rasterize'
return 'rasterize'

def displayName(self):
# The name that the user will see in the toolbox
Expand Down

3 comments on commit 1053823

@nyalldawson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nirvn @m-kuhn do you mind if we rename this alg from "rasterize" to "render"? To me "Rasterize" is a specific operation which takes a vector layer and converts to raster (i.e. taking the raster values directly from an attribute in the vector layer). It'd be nice to keep the "rasterize" name free for a future algorithm which does this operation.

@m-kuhn
Copy link
Member

@m-kuhn m-kuhn commented on 1053823 Aug 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objections, CC @marioba

@nirvn
Copy link
Contributor Author

@nirvn nirvn commented on 1053823 Aug 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No objections.

Please sign in to comment.