From a128455d7ee6e1d916d888457f5a75c902e13ab9 Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Tue, 14 Apr 2020 14:59:33 +0300 Subject: [PATCH] cleaning --- .../src/main/java/net/osmand/NativeLibrary.java | 2 +- .../router/{ptresult => }/NativeTransportRoute.java | 2 +- .../NativeTransportRouteResultSegment.java | 2 +- .../{ptresult => }/NativeTransportRoutingResult.java | 2 +- .../router/{ptresult => }/NativeTransportStop.java | 2 +- .../net/osmand/router/TransportRoutePlanner.java | 12 ++---------- .../osmand/plus/routing/TransportRoutingHelper.java | 10 ++-------- 7 files changed, 9 insertions(+), 23 deletions(-) rename OsmAnd-java/src/main/java/net/osmand/router/{ptresult => }/NativeTransportRoute.java (95%) rename OsmAnd-java/src/main/java/net/osmand/router/{ptresult => }/NativeTransportRouteResultSegment.java (87%) rename OsmAnd-java/src/main/java/net/osmand/router/{ptresult => }/NativeTransportRoutingResult.java (81%) rename OsmAnd-java/src/main/java/net/osmand/router/{ptresult => }/NativeTransportStop.java (95%) diff --git a/OsmAnd-java/src/main/java/net/osmand/NativeLibrary.java b/OsmAnd-java/src/main/java/net/osmand/NativeLibrary.java index 83277dd9ac..8893c01286 100644 --- a/OsmAnd-java/src/main/java/net/osmand/NativeLibrary.java +++ b/OsmAnd-java/src/main/java/net/osmand/NativeLibrary.java @@ -25,7 +25,7 @@ import net.osmand.data.MapObject; import net.osmand.data.QuadRect; import net.osmand.render.RenderingRuleSearchRequest; import net.osmand.render.RenderingRulesStorage; -import net.osmand.router.ptresult.NativeTransportRoutingResult; +import net.osmand.router.NativeTransportRoutingResult; import net.osmand.router.PrecalculatedRouteDirection; import net.osmand.router.RouteCalculationProgress; import net.osmand.router.RouteSegmentResult; diff --git a/OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportRoute.java b/OsmAnd-java/src/main/java/net/osmand/router/NativeTransportRoute.java similarity index 95% rename from OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportRoute.java rename to OsmAnd-java/src/main/java/net/osmand/router/NativeTransportRoute.java index 438acc2314..71cb5596b8 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportRoute.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/NativeTransportRoute.java @@ -1,4 +1,4 @@ -package net.osmand.router.ptresult; +package net.osmand.router; public class NativeTransportRoute { //MapObject part: diff --git a/OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportRouteResultSegment.java b/OsmAnd-java/src/main/java/net/osmand/router/NativeTransportRouteResultSegment.java similarity index 87% rename from OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportRouteResultSegment.java rename to OsmAnd-java/src/main/java/net/osmand/router/NativeTransportRouteResultSegment.java index 5430b5e5b3..0edef7d9e8 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportRouteResultSegment.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/NativeTransportRouteResultSegment.java @@ -1,4 +1,4 @@ -package net.osmand.router.ptresult; +package net.osmand.router; public class NativeTransportRouteResultSegment { public NativeTransportRoute route; diff --git a/OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportRoutingResult.java b/OsmAnd-java/src/main/java/net/osmand/router/NativeTransportRoutingResult.java similarity index 81% rename from OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportRoutingResult.java rename to OsmAnd-java/src/main/java/net/osmand/router/NativeTransportRoutingResult.java index c6bba20647..23bbf337a1 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportRoutingResult.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/NativeTransportRoutingResult.java @@ -1,4 +1,4 @@ -package net.osmand.router.ptresult; +package net.osmand.router; public class NativeTransportRoutingResult { diff --git a/OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportStop.java b/OsmAnd-java/src/main/java/net/osmand/router/NativeTransportStop.java similarity index 95% rename from OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportStop.java rename to OsmAnd-java/src/main/java/net/osmand/router/NativeTransportStop.java index acd329668a..6a7c0883a8 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/ptresult/NativeTransportStop.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/NativeTransportStop.java @@ -1,4 +1,4 @@ -package net.osmand.router.ptresult; +package net.osmand.router; public class NativeTransportStop { //MapObject part: 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 2bd48506b2..0f709d166b 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/TransportRoutePlanner.java @@ -27,10 +27,6 @@ import net.osmand.data.TransportStop; import net.osmand.data.TransportStopExit; import net.osmand.osm.edit.Node; import net.osmand.osm.edit.Way; -import net.osmand.router.ptresult.NativeTransportRoute; -import net.osmand.router.ptresult.NativeTransportRouteResultSegment; -import net.osmand.router.ptresult.NativeTransportRoutingResult; -import net.osmand.router.ptresult.NativeTransportStop; import net.osmand.util.MapUtils; public class TransportRoutePlanner { @@ -40,12 +36,10 @@ public class TransportRoutePlanner { public static final long STOPS_WAY_ID = -2; public List buildRoute(TransportRoutingContext ctx, LatLon start, LatLon end) throws IOException, InterruptedException { - /**delete*/ int cnt = 0; ctx.startCalcTime = System.currentTimeMillis(); List startStops = ctx.getTransportStops(start); List endStops = ctx.getTransportStops(end); - /** delete */ cnt = 2; - /** delete */System.out.println(String.format("startStops/endStops: %d / %d", startStops.size(), endStops.size())); + TLongObjectHashMap endSegments = new TLongObjectHashMap(); for(TransportRouteSegment s : endStops) { endSegments.put(s.getId(), s); @@ -120,7 +114,6 @@ public class TransportRoutePlanner { } sgms.clear(); sgms = ctx.getTransportStops(stop.x31, stop.y31, true, sgms); - /**delete*/cnt++; ctx.visitedStops++; for (TransportRouteSegment sgm : sgms) { if (ctx.calculationProgress != null && ctx.calculationProgress.isCancelled) { @@ -190,7 +183,6 @@ public class TransportRoutePlanner { updateCalculationProgress(ctx, queue); } - System.out.println(String.format("Count calls getTransportStop %d", cnt)); return prepareResults(ctx, results); } @@ -981,7 +973,7 @@ public class TransportRoutePlanner { public static List convertToTransportRoutingResult(NativeTransportRoutingResult[] res, TransportRoutingConfiguration cfg) { List convertedRes = new ArrayList(); - for (net.osmand.router.ptresult.NativeTransportRoutingResult ntrr : res) { + for (NativeTransportRoutingResult ntrr : res) { TransportRouteResult trr = new TransportRouteResult(cfg); trr.setFinishWalkDist(ntrr.finishWalkDist); trr.setRouteTime(ntrr.routeTime); diff --git a/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java index 274ae39dcf..8a4ff015c8 100644 --- a/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java @@ -31,7 +31,7 @@ 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.router.ptresult.NativeTransportRoutingResult; +import net.osmand.router.NativeTransportRoutingResult; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; @@ -502,13 +502,7 @@ public class TransportRoutingHelper { MapUtils.get31TileNumberY(params.end.getLatitude()), cfg, ctx.calculationProgress); List res = TransportRoutePlanner.convertToTransportRoutingResult(nativeRes, cfg); - if (!Algorithms.isEmpty(res)) { - return res; - } else { - app.showToastMessage("Can't find route with NativeLib, switching to Java"); - return planner.buildRoute(ctx, params.start, params.end); - } - + return res; } else { return planner.buildRoute(ctx, params.start, params.end); }