MAPG-119 add more area categories

This commit is contained in:
Bence Pőcze 2020-06-10 23:51:09 +02:00
parent 805d91c0c0
commit ff201c2e8e

View File

@ -53,10 +53,18 @@ class MapsController
private function formatMapAreaForHuman(float $area): array private function formatMapAreaForHuman(float $area): array
{ {
if ($area < 100000.0) { if ($area < 100.0) {
$digits = 0; $digits = 0;
$rounded = round($area, 0); $rounded = round($area, 0);
$unit = 'm'; $unit = 'm';
} elseif ($area < 100000.0) {
$digits = 0;
$rounded = round($area, -2);
$unit = 'm';
} elseif ($area < 1000000.0) {
$digits = 2;
$rounded = round($area / 1000000.0, 2);
$unit = 'km';
} elseif ($area < 100000000.0) { } elseif ($area < 100000000.0) {
$digits = 0; $digits = 0;
$rounded = round($area / 1000000.0, 0); $rounded = round($area / 1000000.0, 0);