Skip to content

Commit 5f5fc58

Browse files
committedJul 15, 2017
[processing] homogenize input/output names in Heatmap algorithm
1 parent bbe466f commit 5f5fc58

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
 

‎python/plugins/processing/algs/qgis/Heatmap.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@
5050

5151
class Heatmap(QgisAlgorithm):
5252

53-
INPUT_LAYER = 'INPUT_LAYER'
53+
INPUT = 'INPUT'
5454
RADIUS = 'RADIUS'
5555
RADIUS_FIELD = 'RADIUS_FIELD'
5656
WEIGHT_FIELD = 'WEIGHT_FIELD'
5757
PIXEL_SIZE = 'PIXEL_SIZE'
5858
KERNEL = 'KERNEL'
5959
DECAY = 'DECAY'
6060
OUTPUT_VALUE = 'OUTPUT_VALUE'
61-
OUTPUT_LAYER = 'OUTPUT_LAYER'
61+
OUTPUT = 'OUTPUT'
6262

6363
def icon(self):
6464
return QIcon(os.path.join(pluginPath, 'images', 'heatmap.png'))
@@ -88,7 +88,7 @@ def initAlgorithm(self, config=None):
8888
self.OUTPUT_VALUES = OrderedDict([(self.tr('Raw'), QgsKernelDensityEstimation.OutputRaw),
8989
(self.tr('Scaled'), QgsKernelDensityEstimation.OutputScaled)])
9090

91-
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT_LAYER,
91+
self.addParameter(QgsProcessingParameterFeatureSource(self.INPUT,
9292
self.tr('Point layer'),
9393
[QgsProcessing.TypeVectorPoint]))
9494

@@ -100,7 +100,7 @@ def initAlgorithm(self, config=None):
100100
radius_field_param = QgsProcessingParameterField(self.RADIUS_FIELD,
101101
self.tr('Radius from field'),
102102
None,
103-
self.INPUT_LAYER,
103+
self.INPUT,
104104
QgsProcessingParameterField.Numeric,
105105
optional=True
106106
)
@@ -118,7 +118,7 @@ def __init__(self, name='', description='', parent_layer=None, radius_param=None
118118

119119
pixel_size_param = ParameterHeatmapPixelSize(self.PIXEL_SIZE,
120120
self.tr('Output raster size'),
121-
parent_layer=self.INPUT_LAYER,
121+
parent_layer=self.INPUT,
122122
radius_param=self.RADIUS,
123123
radius_field_param=self.RADIUS_FIELD,
124124
minValue=0.0,
@@ -132,7 +132,7 @@ def __init__(self, name='', description='', parent_layer=None, radius_param=None
132132
weight_field_param = QgsProcessingParameterField(self.WEIGHT_FIELD,
133133
self.tr('Weight from field'),
134134
None,
135-
self.INPUT_LAYER,
135+
self.INPUT,
136136
QgsProcessingParameterField.Numeric,
137137
optional=True
138138
)
@@ -164,17 +164,17 @@ def __init__(self, name='', description='', parent_layer=None, radius_param=None
164164
output_scaling.setFlags(output_scaling.flags() | QgsProcessingParameterDefinition.FlagAdvanced)
165165
self.addParameter(output_scaling)
166166

167-
self.addParameter(QgsProcessingParameterRasterDestination(self.OUTPUT_LAYER, self.tr('Heatmap')))
167+
self.addParameter(QgsProcessingParameterRasterDestination(self.OUTPUT, self.tr('Heatmap')))
168168

169169
def processAlgorithm(self, parameters, context, feedback):
170-
source = self.parameterAsSource(parameters, self.INPUT_LAYER, context)
170+
source = self.parameterAsSource(parameters, self.INPUT, context)
171171

172172
radius = self.parameterAsDouble(parameters, self.RADIUS, context)
173173
kernel_shape = self.parameterAsEnum(parameters, self.KERNEL, context)
174174
pixel_size = self.parameterAsDouble(parameters, self.PIXEL_SIZE, context)
175175
decay = self.parameterAsDouble(parameters, self.DECAY, context)
176176
output_values = self.parameterAsEnum(parameters, self.OUTPUT_VALUE, context)
177-
outputFile = self.parameterAsOutputLayer(parameters, self.OUTPUT_LAYER, context)
177+
outputFile = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
178178
output_format = raster.formatShortNameFromFileName(outputFile)
179179
weight_field = self.parameterAsString(parameters, self.WEIGHT_FIELD, context)
180180
radius_field = self.parameterAsString(parameters, self.RADIUS_FIELD, context)
@@ -221,4 +221,4 @@ def processAlgorithm(self, parameters, context, feedback):
221221
raise QgsProcessingException(
222222
self.tr('Could not save destination layer'))
223223

224-
return {self.OUTPUT_LAYER: outputFile}
224+
return {self.OUTPUT: outputFile}

0 commit comments

Comments
 (0)