From 14272afa44beb2c298099b3e8da7b4d45ec57b02 Mon Sep 17 00:00:00 2001 From: cepprice Date: Wed, 7 Apr 2021 11:55:59 +0500 Subject: [PATCH] Fix line visibility on high zoom --- .../views/layers/geometry/GeometryWay.java | 11 +++----- .../geometry/MultiProfileGeometryWay.java | 25 +++++++++++-------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWay.java b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWay.java index ab98990d36..aed7a2f315 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWay.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWay.java @@ -4,15 +4,10 @@ import android.graphics.Canvas; import android.graphics.Path; import android.util.Pair; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - import net.osmand.Location; import net.osmand.data.RotatedTileBox; import net.osmand.util.MapAlgorithms; import net.osmand.util.MapUtils; -import net.osmand.plus.views.layers.geometry.MultiProfileGeometryWay.GeometryMultiProfileWayStyle; - import java.util.ArrayList; import java.util.Collections; @@ -20,6 +15,8 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import gnu.trove.list.array.TByteArrayList; public abstract class GeometryWay> { @@ -176,7 +173,7 @@ public abstract class GeometryWay { @@ -148,19 +149,23 @@ public class MultiProfileGeometryWay extends GeometryWay= provider.getSize()) { - return false; + double currLat = provider.getLatitude(currLocationIdx); + double currLon = provider.getLongitude(currLocationIdx); + + int nextIdx = currLocationIdx; + for (int i = nextIdx + 1; i < simplification.size(); i++) { + if (simplification.getQuick(i) == 1) { + nextIdx = i; + } } - float nextX = tileBox.getPixXFromLatLon(provider.getLatitude(currLocationIdx + 1), provider.getLongitude(currLocationIdx + 1)); - float nextY = tileBox.getPixXFromLatLon(provider.getLatitude(currLocationIdx + 1), provider.getLongitude(currLocationIdx + 1)); - return tileBox.containsPoint(nextX, nextY, getContext().circleSize); + + double nextLat = provider.getLatitude(nextIdx); + double nextLon = provider.getLongitude(nextIdx); + return Math.min(currLon, nextLon) < rightLon && Math.max(currLon, nextLon) > leftLon + && Math.min(currLat, nextLat) < topLat && Math.max(currLat, nextLat) > bottomLat; } private boolean segmentDataChanged(Map, RoadSegmentData> other) {