@@ -172,7 +172,7 @@ void Heatmap::run()
172
172
rField = d.radiusField ();
173
173
myAttrList.append ( rField );
174
174
QgsDebugMsg ( QString ( " Radius Field index received: %1" ).arg ( rField ) );
175
-
175
+
176
176
// If not using map units, then calculate a conversion factor to convert the radii to map units
177
177
if ( d.radiusUnit () == HeatmapGui::Meters )
178
178
{
@@ -184,13 +184,13 @@ void Heatmap::run()
184
184
radius = d.radius (); // radius returned by d.radius() is already in map units
185
185
myBuffer = bufferSize ( radius, cellsize );
186
186
}
187
-
187
+
188
188
if ( d.weighted () )
189
189
{
190
190
wField = d.weightField ();
191
191
myAttrList.append ( wField );
192
192
}
193
-
193
+
194
194
// This might have attributes or mightnot have attibutes at all
195
195
// based on the variableRadius() and weighted()
196
196
QgsFeatureIterator fit = inputLayer->getFeatures ( QgsFeatureRequest ().setSubsetOfAttributes ( myAttrList ) );
@@ -222,14 +222,14 @@ void Heatmap::run()
222
222
{
223
223
continue ;
224
224
}
225
-
225
+
226
226
// If radius is variable then fetch it and calculate new pixel buffer size
227
227
if ( d.variableRadius () )
228
228
{
229
229
radius = myFeature.attribute ( rField ).toFloat () * radiusToMapUnits;
230
230
myBuffer = bufferSize ( radius, cellsize );
231
231
}
232
-
232
+
233
233
int blockSize = 2 * myBuffer + 1 ; // Block SIDE would be more appropriate
234
234
// calculate the pixel position
235
235
unsigned int xPosition, yPosition;
@@ -252,13 +252,13 @@ void Heatmap::run()
252
252
for ( int yp = 0 ; yp <= myBuffer; yp++ )
253
253
{
254
254
float distance = sqrt ( pow ( xp, 2.0 ) + pow ( yp, 2.0 ) );
255
-
255
+
256
256
// is pixel outside search bandwidth of feature?
257
257
if ( distance > myBuffer )
258
258
{
259
259
continue ;
260
260
}
261
-
261
+
262
262
float pixelValue = weight * ( 1 - (( 1 - myDecay ) * distance / myBuffer ) );
263
263
264
264
// clearing anamolies along the axes
@@ -304,7 +304,7 @@ void Heatmap::run()
304
304
* Local functions
305
305
*
306
306
*/
307
-
307
+
308
308
float Heatmap::mapUnitsOf ( float meters, QgsCoordinateReferenceSystem layerCrs )
309
309
{
310
310
// Worker to transform metres input to mapunits
@@ -328,8 +328,8 @@ int Heatmap::bufferSize( float radius, float cellsize )
328
328
++buffer;
329
329
}
330
330
return buffer;
331
- }
332
-
331
+ }
332
+
333
333
334
334
// Unload the plugin by cleaning up the GUI
335
335
void Heatmap::unload ()
0 commit comments