@@ -361,11 +361,11 @@ double HeatmapGui::estimateRadius()
361
361
362
362
double estimate = maxExtent / 30 ;
363
363
364
- if ( mBufferUnitCombo ->currentIndex () == HeatmapGui::Meters )
364
+ if ( mBufferUnitCombo ->currentIndex () == HeatmapGui::LayerUnits )
365
365
{
366
- // metres selected, so convert estimate from map units
366
+ // layer units selected, so convert estimate from map units
367
367
QgsCoordinateReferenceSystem layerCrs = inputLayer->crs ();
368
- estimate = estimate / mapUnitsOf ( 1 , layerCrs );
368
+ estimate /= mapUnitsOf ( 1 , layerCrs );
369
369
}
370
370
371
371
// Make estimate pretty by rounding off to first digit only (eg 356->300, 0.567->0.5)
@@ -447,7 +447,7 @@ void HeatmapGui::updateBBox()
447
447
int idx = inputLayer->pendingFields ().indexFromName ( mRadiusFieldCombo ->currentField () );
448
448
double maxInField = inputLayer->maximumValue ( idx ).toDouble ();
449
449
450
- if ( mRadiusFieldUnitCombo ->currentIndex () == HeatmapGui::Meters )
450
+ if ( mRadiusFieldUnitCombo ->currentIndex () == HeatmapGui::LayerUnits )
451
451
{
452
452
radiusInMapUnits = mapUnitsOf ( maxInField, layerCrs );
453
453
}
@@ -459,7 +459,7 @@ void HeatmapGui::updateBBox()
459
459
else
460
460
{
461
461
double radiusValue = mBufferSizeLineEdit ->text ().toDouble ();
462
- if ( mBufferUnitCombo ->currentIndex () == HeatmapGui::Meters )
462
+ if ( mBufferUnitCombo ->currentIndex () == HeatmapGui::LayerUnits )
463
463
{
464
464
radiusInMapUnits = mapUnitsOf ( radiusValue, layerCrs );
465
465
}
@@ -481,9 +481,9 @@ void HeatmapGui::updateBBox()
481
481
updateSize ();
482
482
}
483
483
484
- double HeatmapGui::mapUnitsOf ( double meters, QgsCoordinateReferenceSystem layerCrs ) const
484
+ double HeatmapGui::mapUnitsOf ( double dist, const QgsCoordinateReferenceSystem& layerCrs ) const
485
485
{
486
- // converter function to transform metres input to mapunits
486
+ // converter function to transform layer input to mapunits
487
487
// so that bounding box can be updated
488
488
QgsDistanceArea da;
489
489
da.setSourceCrs ( layerCrs.srsid () );
@@ -493,8 +493,8 @@ double HeatmapGui::mapUnitsOf( double meters, QgsCoordinateReferenceSystem layer
493
493
da.setEllipsoidalMode ( true );
494
494
}
495
495
double unitDistance = da.measureLine ( QgsPoint ( 0.0 , 0.0 ), QgsPoint ( 0.0 , 1.0 ) );
496
- QgsDebugMsg ( QString ( " Converted %1 meters to %2 mapunits " ).arg ( meters ).arg ( meters / unitDistance ) );
497
- return meters / unitDistance;
496
+ QgsDebugMsg ( QString ( " Converted %1 layer to %2 map units " ).arg ( dist ).arg ( dist / unitDistance ) );
497
+ return dist / unitDistance;
498
498
}
499
499
/*
500
500
*
@@ -515,7 +515,7 @@ bool HeatmapGui::variableRadius() const
515
515
double HeatmapGui::radius () const
516
516
{
517
517
double radius = mBufferSizeLineEdit ->text ().toDouble ();
518
- if ( mBufferUnitCombo ->currentIndex () == HeatmapGui::Meters )
518
+ if ( mBufferUnitCombo ->currentIndex () == HeatmapGui::LayerUnits )
519
519
{
520
520
radius = mapUnitsOf ( radius, inputVectorLayer ()->crs () );
521
521
}
0 commit comments