From a1b4d7ba1ab4505cf5e648c7729d64b0c12e7063 Mon Sep 17 00:00:00 2001 From: Chumva Date: Fri, 14 Dec 2018 12:29:08 +0200 Subject: [PATCH] Revert "Merge remote-tracking branch 'origin/RoutePreparationMenu' into RoutePreparationMenu" This reverts commit 7a8e779046b18247185ee271366db26b83b44758, reversing changes made to bf1e436f2b072377dc1cc142fdd6807cb8cd33d4. --- .../net/osmand/binary/RouteDataObject.java | 16 +- .../osmand/router/RoutePlannerFrontEnd.java | 35 +--- .../osmand/router/RouteResultPreparation.java | 2 +- .../net/osmand/router/RoutingContext.java | 3 - .../osmand/router/TransportRoutePlanner.java | 2 +- .../net/osmand/search/SearchCoreUITest.java | 2 +- .../mapmarkers/MarkersPlanRouteContext.java | 4 +- .../MeasurementEditingContext.java | 4 +- .../plus/routing/RouteCalculationParams.java | 5 +- .../osmand/plus/routing/RouteProvider.java | 3 - .../osmand/plus/routing/RoutingHelper.java | 7 +- .../plus/routing/TransportRoutingHelper.java | 180 ------------------ .../src/net/osmand/plus/views/RouteLayer.java | 30 +-- 13 files changed, 24 insertions(+), 269 deletions(-) diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java b/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java index 5cbb1cd0cc..a1e10eae7a 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/RouteDataObject.java @@ -578,21 +578,7 @@ public class RouteDataObject { public boolean loop(){ return pointsX[0] == pointsX[pointsX.length - 1] && pointsY[0] == pointsY[pointsY.length - 1] ; } - - public boolean platform(){ - int sz = types.length; - for(int i=0; i list) throws IOException { - return findRouteSegment(lat, lon, ctx, list, false); - } - - public RouteSegmentPoint findRouteSegment(double lat, double lon, RoutingContext ctx, List list, boolean transportStop) throws IOException { int px = MapUtils.get31TileNumberX(lon); int py = MapUtils.get31TileNumberY(lat); ArrayList dataObjects = new ArrayList(); @@ -96,26 +92,7 @@ public class RoutePlannerFrontEnd { } }); if (list.size() > 0) { - RouteSegmentPoint ps = null; - if (ctx.publicTransport) { - for (RouteSegmentPoint p : list) { - if (transportStop && p.distSquare > 100) { - break; - } - boolean platform = p.road.platform(); - if (transportStop && platform) { - ps = p; - break; - } - if (!transportStop && !platform) { - ps = p; - break; - } - } - } - if (ps == null) { - ps = list.get(0); - } + RouteSegmentPoint ps = list.get(0); ps.others = list; return ps; } @@ -208,17 +185,17 @@ public class RoutePlannerFrontEnd { } int indexNotFound = 0; List points = new ArrayList(); - if (!addSegment(start, ctx, indexNotFound++, points, ctx.startTransportStop)) { + if (!addSegment(start, ctx, indexNotFound++, points)) { return null; } if (intermediates != null) { for (LatLon l : intermediates) { - if (!addSegment(l, ctx, indexNotFound++, points, false)) { + if (!addSegment(l, ctx, indexNotFound++, points)) { return null; } } } - if (!addSegment(end, ctx, indexNotFound++, points, ctx.targetTransportStop)) { + if (!addSegment(end, ctx, indexNotFound++, points)) { return null; } ctx.calculationProgress.nextIteration(); @@ -338,8 +315,8 @@ public class RoutePlannerFrontEnd { } - private boolean addSegment(LatLon s, RoutingContext ctx, int indexNotFound, List res, boolean transportStop) throws IOException { - RouteSegmentPoint f = findRouteSegment(s.getLatitude(), s.getLongitude(), ctx, null, transportStop); + private boolean addSegment(LatLon s, RoutingContext ctx, int indexNotFound, List res) throws IOException { + RouteSegmentPoint f = findRouteSegment(s.getLatitude(), s.getLongitude(), ctx, null); if (f == null) { ctx.calculationProgress.segmentNotFound = indexNotFound; return false; diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java index 3cc5de31f8..2c975ac500 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RouteResultPreparation.java @@ -41,6 +41,7 @@ public class RouteResultPreparation { */ List prepareResult(RoutingContext ctx, FinalRouteSegment finalSegment) throws IOException { List result = convertFinalSegmentToResults(ctx, finalSegment); + combineWayPointsForAreaRouting(ctx, result); prepareResult(ctx, result); return result; } @@ -157,7 +158,6 @@ public class RouteResultPreparation { } List prepareResult(RoutingContext ctx, List result) throws IOException { - combineWayPointsForAreaRouting(ctx, result); validateAllPointsConnected(result); splitRoadsAndAttachRoadSegments(ctx, result); calculateTimeSpeed(ctx, result); diff --git a/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java b/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java index 91a4fd0eff..ddd44e738c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/RoutingContext.java @@ -57,11 +57,8 @@ public class RoutingContext { // 1. Initial variables public int startX; public int startY; - public boolean startTransportStop; public int targetX; public int targetY; - public boolean targetTransportStop; - public boolean publicTransport; // deprecated public long firstRoadId; public int firstRoadDirection; diff --git a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java index 67581713e5..d3303124ab 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -327,7 +327,7 @@ public class TransportRoutePlanner { public List getSegments() { return segments; } - + public double getWalkDist() { double d = finishWalkDist; for (TransportRouteResultSegment s : segments) { diff --git a/OsmAnd-java/src/test/java/net/osmand/search/SearchCoreUITest.java b/OsmAnd-java/src/test/java/net/osmand/search/SearchCoreUITest.java index a130e8b65c..80d92b7bf1 100644 --- a/OsmAnd-java/src/test/java/net/osmand/search/SearchCoreUITest.java +++ b/OsmAnd-java/src/test/java/net/osmand/search/SearchCoreUITest.java @@ -222,7 +222,7 @@ public class SearchCoreUITest { }); if (files != null) { for (File f : files) { - //testSearchImpl(f); + testSearchImpl(f); } } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java index 1f920db387..361586f311 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MarkersPlanRouteContext.java @@ -10,7 +10,6 @@ import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.OsmandApplication; import net.osmand.plus.routing.RouteCalculationParams; -import net.osmand.plus.routing.RouteCalculationResult; import net.osmand.plus.routing.RoutingHelper; import net.osmand.router.RouteCalculationProgress; import net.osmand.util.MapUtils; @@ -247,8 +246,7 @@ public class MarkersPlanRouteContext { }; params.resultListener = new RouteCalculationParams.RouteCalculationResultListener() { @Override - public void onRouteCalculated(RouteCalculationResult route) { - List locations = route.getRouteLocations(); + public void onRouteCalculated(List locations) { ArrayList pts = new ArrayList<>(locations.size()); for (Location loc : locations) { WptPt pt = new WptPt(); diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index 2544c34a2d..fb61e0c3e2 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -10,7 +10,6 @@ import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.OsmandApplication; import net.osmand.plus.measurementtool.command.MeasurementCommandManager; import net.osmand.plus.routing.RouteCalculationParams; -import net.osmand.plus.routing.RouteCalculationResult; import net.osmand.plus.routing.RoutingHelper; import net.osmand.router.RouteCalculationProgress; @@ -313,8 +312,7 @@ public class MeasurementEditingContext { }; params.resultListener = new RouteCalculationParams.RouteCalculationResultListener() { @Override - public void onRouteCalculated(RouteCalculationResult route) { - List locations = route.getRouteLocations(); + public void onRouteCalculated(List locations) { ArrayList pts = new ArrayList<>(locations.size()); for (Location loc : locations) { if(!loc.hasAltitude()){ diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationParams.java b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationParams.java index 9f40b6dab8..b535d0fcfb 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationParams.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationParams.java @@ -29,14 +29,11 @@ public class RouteCalculationParams { public boolean fast; public boolean leftSide; public boolean inSnapToRoadMode; - public boolean inPublicTransportMode; - public boolean startTransportStop; - public boolean targetTransportStop; public RouteCalculationProgress calculationProgress; public RouteCalculationProgressCallback calculationProgressCallback; public RouteCalculationResultListener resultListener; public interface RouteCalculationResultListener { - void onRouteCalculated(RouteCalculationResult route); + void onRouteCalculated(List locations); } } diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index b5bc13b9bf..519caa12c9 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -648,9 +648,6 @@ public class RouteProvider { && precalculated == null; ctx.leftSideNavigation = params.leftSide; ctx.calculationProgress = params.calculationProgress; - ctx.publicTransport = params.inPublicTransportMode; - ctx.startTransportStop = params.startTransportStop; - ctx.targetTransportStop = params.targetTransportStop; if(params.previousToRecalculate != null && params.onlyStartPointChanged) { int currentRoute = params.previousToRecalculate.getCurrentRoute(); List originalRoute = params.previousToRecalculate.getOriginalRoute(); diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 585ba2717e..9a5f4abe91 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -91,7 +91,6 @@ public class RoutingHelper { voiceRouter = new VoiceRouter(this, settings); provider = new RouteProvider(); transportRoutingHelper = context.getTransportRoutingHelper(); - transportRoutingHelper.setRoutingHelper(this); setAppMode(settings.APPLICATION_MODE.get()); } @@ -895,11 +894,11 @@ public class RoutingHelper { RouteCalculationResult prev = route; synchronized (RoutingHelper.this) { if (res.isCalculated()) { - if (!params.inSnapToRoadMode && !params.inPublicTransportMode) { + if (!params.inSnapToRoadMode) { route = res; } if (params.resultListener != null) { - params.resultListener.onRouteCalculated(res); + params.resultListener.onRouteCalculated(res.getRouteLocations()); } } else { evalWaitInterval = Math.max(3000, evalWaitInterval * 3 / 2); // for Issue #3899 @@ -908,7 +907,7 @@ public class RoutingHelper { currentRunningJob = null; } if(res.isCalculated()){ - if (!params.inSnapToRoadMode && !params.inPublicTransportMode) { + if (!params.inSnapToRoadMode) { setNewRoute(prev, res, params.start); } } else if (onlineSourceWithoutInternet) { diff --git a/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java index 5f938b463b..47c73a0ca3 100644 --- a/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java @@ -1,39 +1,27 @@ package net.osmand.plus.routing; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.util.Pair; -import net.osmand.Location; import net.osmand.PlatformUtil; import net.osmand.ValueHolder; import net.osmand.binary.BinaryMapIndexReader; import net.osmand.data.LatLon; -import net.osmand.plus.ApplicationMode; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; -import net.osmand.plus.routing.RouteCalculationParams.RouteCalculationResultListener; import net.osmand.plus.routing.RouteProvider.RouteService; -import net.osmand.plus.routing.RoutingHelper.RouteCalculationProgressCallback; import net.osmand.router.RouteCalculationProgress; import net.osmand.router.RoutingConfiguration; import net.osmand.router.TransportRoutePlanner; import net.osmand.router.TransportRoutePlanner.TransportRouteResult; -import net.osmand.router.TransportRoutePlanner.TransportRouteResultSegment; import net.osmand.router.TransportRoutePlanner.TransportRoutingContext; import net.osmand.router.TransportRoutingConfiguration; -import net.osmand.util.MapUtils; import java.io.IOException; import java.lang.ref.WeakReference; -import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.Map; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; import static net.osmand.plus.notifications.OsmandNotification.NotificationType.NAVIGATION; @@ -44,10 +32,8 @@ public class TransportRoutingHelper { private List> listeners = new LinkedList<>(); private OsmandApplication app; - private RoutingHelper routingHelper; private List routes; - private Map, RouteCalculationResult> walkingRouteSegments; private int currentRoute; private LatLon startLocation; @@ -65,10 +51,6 @@ public class TransportRoutingHelper { this.app = app; } - public void setRoutingHelper(RoutingHelper routingHelper) { - this.routingHelper = routingHelper; - } - public LatLon getStartLocation() { return startLocation; } @@ -93,11 +75,6 @@ public class TransportRoutingHelper { return routes; } - @Nullable - public RouteCalculationResult getWalkingRouteSegment(TransportRouteResultSegment s1, TransportRouteResultSegment s2) { - return walkingRouteSegments.get(new Pair<>(s1, s2)); - } - public void setCurrentRoute(int currentRoute) { this.currentRoute = currentRoute; } @@ -136,9 +113,6 @@ public class TransportRoutingHelper { params.ctx = app; params.calculationProgress = new RouteCalculationProgress(); - float rd = (float) MapUtils.getDistance(start, end); - params.calculationProgress.totalEstimatedDistance = rd * 1.5f; - startRouteCalculationThread(params); } @@ -229,7 +203,6 @@ public class TransportRoutingHelper { public synchronized void clearCurrentRoute(LatLon newFinalLocation) { routes = null; - walkingRouteSegments = null; app.getWaypointHelper().setNewRoute(new RouteCalculationResult("")); app.runInUIThread(new Runnable() { @Override @@ -294,48 +267,11 @@ public class TransportRoutingHelper { } } - private class WalkingRouteSegment { - TransportRouteResultSegment s1; - TransportRouteResultSegment s2; - LatLon start; - boolean startTransportStop; - LatLon end; - boolean endTransportStop; - - WalkingRouteSegment(TransportRouteResultSegment s1, TransportRouteResultSegment s2) { - this.s1 = s1; - this.s2 = s2; - - start = s1.getEnd().getLocation(); - end = s2.getStart().getLocation(); - startTransportStop = true; - endTransportStop = true; - } - - WalkingRouteSegment(LatLon start, TransportRouteResultSegment s) { - this.start = start; - this.s2 = s; - end = s2.getStart().getLocation(); - endTransportStop = true; - } - - WalkingRouteSegment(TransportRouteResultSegment s, LatLon end) { - this.s1 = s; - this.end = end; - start = s1.getEnd().getLocation(); - startTransportStop = true; - } - } - private class RouteRecalculationThread extends Thread { private final TransportRouteCalculationParams params; private Thread prevRunningJob; - private final Queue walkingSegmentsToCalculate = new ConcurrentLinkedQueue<>(); - private Map, RouteCalculationResult> walkingRouteSegments = new HashMap<>(); - private boolean walkingSegmentsCalculated; - public RouteRecalculationThread(String name, TransportRouteCalculationParams params) { super(name); this.params = params; @@ -359,118 +295,6 @@ public class TransportRoutingHelper { return planner.buildRoute(ctx, params.start, params.end); } - @Nullable - private RouteCalculationParams getWalkingRouteParams() { - - ApplicationMode walkingMode = ApplicationMode.PEDESTRIAN; - - final WalkingRouteSegment walkingRouteSegment = walkingSegmentsToCalculate.poll(); - if (walkingRouteSegment == null) { - return null; - } - - Location start = new Location(""); - start.setLatitude(walkingRouteSegment.start.getLatitude()); - start.setLongitude(walkingRouteSegment.start.getLongitude()); - LatLon end = new LatLon(walkingRouteSegment.end.getLatitude(), walkingRouteSegment.end.getLongitude()); - - final float currentDistanceFromBegin = - RouteRecalculationThread.this.params.calculationProgress.distanceFromBegin + - (walkingRouteSegment.s1 != null ? (float) walkingRouteSegment.s1.getTravelDist() : 0); - - final RouteCalculationParams params = new RouteCalculationParams(); - params.inPublicTransportMode = true; - params.start = start; - params.end = end; - params.startTransportStop = walkingRouteSegment.startTransportStop; - params.targetTransportStop = walkingRouteSegment.endTransportStop; - RoutingHelper.applyApplicationSettings(params, app.getSettings(), walkingMode); - params.mode = walkingMode; - params.ctx = app; - params.calculationProgress = new RouteCalculationProgress(); - params.calculationProgressCallback = new RouteCalculationProgressCallback() { - - @Override - public void start() { - - } - - @Override - public void updateProgress(int progress) { - float p = Math.max(params.calculationProgress.distanceFromBegin, - params.calculationProgress.distanceFromEnd); - - RouteRecalculationThread.this.params.calculationProgress.distanceFromBegin = - Math.max(RouteRecalculationThread.this.params.calculationProgress.distanceFromBegin, currentDistanceFromBegin + p); - } - - @Override - public void requestPrivateAccessRouting() { - - } - - @Override - public void finish() { - if (walkingSegmentsToCalculate.isEmpty()) { - walkingSegmentsCalculated = true; - } else { - updateProgress(0); - } - } - }; - params.resultListener = new RouteCalculationResultListener() { - @Override - public void onRouteCalculated(RouteCalculationResult route) { - RouteRecalculationThread.this.walkingRouteSegments.put(new Pair<>(walkingRouteSegment.s1, walkingRouteSegment.s2), route); - if (!walkingSegmentsToCalculate.isEmpty()) { - RouteCalculationParams walkingRouteParams = getWalkingRouteParams(); - if (walkingRouteParams != null) { - routingHelper.startRouteCalculationThread(walkingRouteParams, true, true); - } - } - } - }; - - return params; - } - - private void calculateWalkingRoutes(List routes) { - walkingSegmentsCalculated = false; - walkingSegmentsToCalculate.clear(); - walkingRouteSegments.clear(); - if (routes != null && routes.size() > 0) { - for (TransportRouteResult r : routes) { - TransportRouteResultSegment prev = null; - for (TransportRouteResultSegment s : r.getSegments()) { - LatLon start = prev != null ? prev.getEnd().getLocation() : params.start; - LatLon end = s.getStart().getLocation(); - if (start != null && end != null) { - if (prev == null || MapUtils.getDistance(start, end) > 50) { - walkingSegmentsToCalculate.add(prev == null ? - new WalkingRouteSegment(start, s) : new WalkingRouteSegment(prev, s)); - } - } - prev = s; - } - if (prev != null) { - walkingSegmentsToCalculate.add(new WalkingRouteSegment(prev, params.end)); - } - } - RouteCalculationParams walkingRouteParams = getWalkingRouteParams(); - if (walkingRouteParams != null) { - routingHelper.startRouteCalculationThread(walkingRouteParams, true, true); - // wait until all segments calculated - while (!walkingSegmentsCalculated) { - try { - Thread.sleep(50); - } catch (InterruptedException e) { - // ignore - } - } - } - } - } - @Override public void run() { synchronized (TransportRoutingHelper.this) { @@ -493,9 +317,6 @@ public class TransportRoutingHelper { String error = null; try { res = calculateRouteImpl(params); - if (res != null) { - calculateWalkingRoutes(res); - } } catch (IOException e) { error = e.getMessage(); log.error(e); @@ -508,7 +329,6 @@ public class TransportRoutingHelper { } synchronized (TransportRoutingHelper.this) { routes = res; - TransportRoutingHelper.this.walkingRouteSegments = walkingRouteSegments; if (res != null) { if (params.resultListener != null) { params.resultListener.onRouteCalculated(res); diff --git a/OsmAnd/src/net/osmand/plus/views/RouteLayer.java b/OsmAnd/src/net/osmand/plus/views/RouteLayer.java index dfe1365cd6..3ce17b7be9 100644 --- a/OsmAnd/src/net/osmand/plus/views/RouteLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/RouteLayer.java @@ -41,7 +41,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; -import java.util.Locale; import java.util.TreeMap; import gnu.trove.list.array.TByteArrayList; @@ -805,38 +804,25 @@ public class RouteLayer extends OsmandMapLayer { private void calculateTransportResult(LatLon start, LatLon end, TransportRouteResult r, List res, List colors) { if (r != null) { LatLon p = start; - TransportRouteResultSegment prev = null; for (TransportRouteResultSegment s : r.getSegments()) { LatLon floc = s.getStart().getLocation(); - addRouteWalk(prev, s, p, floc, res, colors); + addRouteWalk(p, floc, res, colors); List geometry = s.getGeometry(); res.addAll(geometry); addColors(s.route, geometry.size(), colors); p = s.getEnd().getLocation(); - prev = s; } - addRouteWalk(prev, null, p, end, res, colors); + addRouteWalk(p, end, res, colors); } } - private void addRouteWalk(TransportRouteResultSegment s1, TransportRouteResultSegment s2, - LatLon start, LatLon end, List res, List colors) { - final RouteCalculationResult walkingRouteSegment = transportHelper.getWalkingRouteSegment(s1, s2); - if (walkingRouteSegment != null && walkingRouteSegment.getRouteLocations().size() > 0) { - final List routeLocations = walkingRouteSegment.getRouteLocations(); + private void addRouteWalk(LatLon s, LatLon e, List res, List colors) { + double dist = MapUtils.getDistance(s, e); + if (dist > 50) { Way way = new Way(-1); - way.putTag(OSMSettings.OSMTagKey.NAME.getValue(), String.format(Locale.US, "Walk %d m", walkingRouteSegment.getWholeDistance())); - for (Location l : routeLocations) { - way.addNode(new Node(l.getLatitude(), l.getLongitude(), -1)); - } - res.add(way); - addColors(null, 1, colors); - } else { - double dist = MapUtils.getDistance(start, end); - Way way = new Way(-1); - way.putTag(OSMSettings.OSMTagKey.NAME.getValue(), String.format(Locale.US, "Walk %.1f m", dist)); - way.addNode(new Node(start.getLatitude(), start.getLongitude(), -1)); - way.addNode(new Node(end.getLatitude(), end.getLongitude(), -1)); + way.putTag(OSMSettings.OSMTagKey.NAME.getValue(), String.format("Walk %.1f m", dist)); + way.addNode(new Node(s.getLatitude(), s.getLongitude(), -1)); + way.addNode(new Node(e.getLatitude(), e.getLongitude(), -1)); res.add(way); addColors(null, 1, colors); }