From 88a9a9ee7f0ab5f625f3565661e8b32671f1c018 Mon Sep 17 00:00:00 2001 From: Emux Date: Fri, 4 Oct 2019 18:24:14 +0300 Subject: [PATCH] Polygon labels: use centroid position if available #734 --- .../layers/tile/vector/labeling/LabelTileLoaderHook.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vtm/src/org/oscim/layers/tile/vector/labeling/LabelTileLoaderHook.java b/vtm/src/org/oscim/layers/tile/vector/labeling/LabelTileLoaderHook.java index 3ba91ec7..1d94bec3 100644 --- a/vtm/src/org/oscim/layers/tile/vector/labeling/LabelTileLoaderHook.java +++ b/vtm/src/org/oscim/layers/tile/vector/labeling/LabelTileLoaderHook.java @@ -1,6 +1,6 @@ /* * Copyright 2013 Hannes Janetzek - * Copyright 2016-2018 devemux86 + * Copyright 2016-2019 devemux86 * Copyright 2016 Andrey Novikov * Copyright 2019 marq24 * @@ -75,6 +75,8 @@ public class LabelTileLoaderHook implements TileLoaderThemeHook { } } else if (element.type == POLY) { PointF label = element.labelPosition; + if (label == null) + label = element.centroidPosition; // skip unnecessary calculations if label is outside of visible area if (label != null && (label.x < 0 || label.x > Tile.SIZE || label.y < 0 || label.y > Tile.SIZE)) return false;