From 0604374475cfa396da680cb60bc601eb55910c92 Mon Sep 17 00:00:00 2001 From: cepprice Date: Mon, 5 Apr 2021 14:21:00 +0500 Subject: [PATCH] Remove out margin --- .../views/layers/geometry/GeometryWay.java | 18 +++++------------- .../geometry/MultiProfileGeometryWay.java | 5 ----- 2 files changed, 5 insertions(+), 18 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 d5f206ec90..2538103ec0 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWay.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/geometry/GeometryWay.java @@ -265,20 +265,16 @@ public abstract class GeometryWay= lx && x <= rx && y >= ty && y <= by; } - public static boolean isIn(float x, float y, int lx, int ty, int rx, int by, float outMargin) { - return x >= lx - outMargin && x <= rx + outMargin && y >= ty - outMargin && y <= by + outMargin; - } - public static int calculatePath(RotatedTileBox tb, List xs, List ys, Path path) { List>> paths = new ArrayList<>(); - int res = calculatePath(tb, xs, ys, 0, null, paths); + int res = calculatePath(tb, xs, ys, null, paths); if (paths.size() > 0) { path.addPath(paths.get(0).first); } return res; } - public static int calculatePath(RotatedTileBox tb, List xs, List ys, float outMargin, List> styles, List>> paths) { + public static int calculatePath(RotatedTileBox tb, List xs, List ys, List> styles, List>> paths) { boolean segmentStarted = false; float prevX = xs.get(0); float prevY = ys.get(0); @@ -288,11 +284,11 @@ public abstract class GeometryWay style = hasStyles ? styles.get(0) : null; Path path = new Path(); - boolean prevIn = isIn(prevX, prevY, 0, 0, width, height, outMargin); + boolean prevIn = isIn(prevX, prevY, 0, 0, width, height); for (int i = 1; i < xs.size(); i++) { float currX = xs.get(i); float currY = ys.get(i); - boolean currIn = isIn(currX, currY, 0, 0, width, height, outMargin); + boolean currIn = isIn(currX, currY, 0, 0, width, height); boolean draw = false; if (prevIn && currIn) { draw = true; @@ -364,7 +360,7 @@ public abstract class GeometryWay>> paths = new ArrayList<>(); canvas.rotate(-tb.getRotate(), tb.getCenterPixelX(), tb.getCenterPixelY()); - calculatePath(tb, tx, ty, getOutMargin(), styles, paths); + calculatePath(tb, tx, ty, styles, paths); for (Pair> pc : paths) { GeometryWayStyle style = pc.second; if (style.hasPathLine()) { @@ -381,10 +377,6 @@ public abstract class GeometryWay(mode.getProfileColor(night), mode.getIconRes()); } - @Override - protected float getOutMargin() { - return getContext().getAttrs().paint.getStrokeWidth() * 2; - } - @NonNull @Override public GeometryWayStyle getDefaultWayStyle() {