cleaning
This commit is contained in:
parent
2c4402631e
commit
a128455d7e
7 changed files with 9 additions and 23 deletions
|
@ -25,7 +25,7 @@ import net.osmand.data.MapObject;
|
||||||
import net.osmand.data.QuadRect;
|
import net.osmand.data.QuadRect;
|
||||||
import net.osmand.render.RenderingRuleSearchRequest;
|
import net.osmand.render.RenderingRuleSearchRequest;
|
||||||
import net.osmand.render.RenderingRulesStorage;
|
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.PrecalculatedRouteDirection;
|
||||||
import net.osmand.router.RouteCalculationProgress;
|
import net.osmand.router.RouteCalculationProgress;
|
||||||
import net.osmand.router.RouteSegmentResult;
|
import net.osmand.router.RouteSegmentResult;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.router.ptresult;
|
package net.osmand.router;
|
||||||
|
|
||||||
public class NativeTransportRoute {
|
public class NativeTransportRoute {
|
||||||
//MapObject part:
|
//MapObject part:
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.router.ptresult;
|
package net.osmand.router;
|
||||||
|
|
||||||
public class NativeTransportRouteResultSegment {
|
public class NativeTransportRouteResultSegment {
|
||||||
public NativeTransportRoute route;
|
public NativeTransportRoute route;
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.router.ptresult;
|
package net.osmand.router;
|
||||||
|
|
||||||
public class NativeTransportRoutingResult {
|
public class NativeTransportRoutingResult {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package net.osmand.router.ptresult;
|
package net.osmand.router;
|
||||||
|
|
||||||
public class NativeTransportStop {
|
public class NativeTransportStop {
|
||||||
//MapObject part:
|
//MapObject part:
|
|
@ -27,10 +27,6 @@ import net.osmand.data.TransportStop;
|
||||||
import net.osmand.data.TransportStopExit;
|
import net.osmand.data.TransportStopExit;
|
||||||
import net.osmand.osm.edit.Node;
|
import net.osmand.osm.edit.Node;
|
||||||
import net.osmand.osm.edit.Way;
|
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;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
public class TransportRoutePlanner {
|
public class TransportRoutePlanner {
|
||||||
|
@ -40,12 +36,10 @@ public class TransportRoutePlanner {
|
||||||
public static final long STOPS_WAY_ID = -2;
|
public static final long STOPS_WAY_ID = -2;
|
||||||
|
|
||||||
public List<TransportRouteResult> buildRoute(TransportRoutingContext ctx, LatLon start, LatLon end) throws IOException, InterruptedException {
|
public List<TransportRouteResult> buildRoute(TransportRoutingContext ctx, LatLon start, LatLon end) throws IOException, InterruptedException {
|
||||||
/**delete*/ int cnt = 0;
|
|
||||||
ctx.startCalcTime = System.currentTimeMillis();
|
ctx.startCalcTime = System.currentTimeMillis();
|
||||||
List<TransportRouteSegment> startStops = ctx.getTransportStops(start);
|
List<TransportRouteSegment> startStops = ctx.getTransportStops(start);
|
||||||
List<TransportRouteSegment> endStops = ctx.getTransportStops(end);
|
List<TransportRouteSegment> endStops = ctx.getTransportStops(end);
|
||||||
/** delete */ cnt = 2;
|
|
||||||
/** delete */System.out.println(String.format("startStops/endStops: %d / %d", startStops.size(), endStops.size()));
|
|
||||||
TLongObjectHashMap<TransportRouteSegment> endSegments = new TLongObjectHashMap<TransportRouteSegment>();
|
TLongObjectHashMap<TransportRouteSegment> endSegments = new TLongObjectHashMap<TransportRouteSegment>();
|
||||||
for(TransportRouteSegment s : endStops) {
|
for(TransportRouteSegment s : endStops) {
|
||||||
endSegments.put(s.getId(), s);
|
endSegments.put(s.getId(), s);
|
||||||
|
@ -120,7 +114,6 @@ public class TransportRoutePlanner {
|
||||||
}
|
}
|
||||||
sgms.clear();
|
sgms.clear();
|
||||||
sgms = ctx.getTransportStops(stop.x31, stop.y31, true, sgms);
|
sgms = ctx.getTransportStops(stop.x31, stop.y31, true, sgms);
|
||||||
/**delete*/cnt++;
|
|
||||||
ctx.visitedStops++;
|
ctx.visitedStops++;
|
||||||
for (TransportRouteSegment sgm : sgms) {
|
for (TransportRouteSegment sgm : sgms) {
|
||||||
if (ctx.calculationProgress != null && ctx.calculationProgress.isCancelled) {
|
if (ctx.calculationProgress != null && ctx.calculationProgress.isCancelled) {
|
||||||
|
@ -190,7 +183,6 @@ public class TransportRoutePlanner {
|
||||||
updateCalculationProgress(ctx, queue);
|
updateCalculationProgress(ctx, queue);
|
||||||
|
|
||||||
}
|
}
|
||||||
System.out.println(String.format("Count calls getTransportStop %d", cnt));
|
|
||||||
return prepareResults(ctx, results);
|
return prepareResults(ctx, results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -981,7 +973,7 @@ public class TransportRoutePlanner {
|
||||||
public static List<TransportRouteResult> convertToTransportRoutingResult(NativeTransportRoutingResult[] res,
|
public static List<TransportRouteResult> convertToTransportRoutingResult(NativeTransportRoutingResult[] res,
|
||||||
TransportRoutingConfiguration cfg) {
|
TransportRoutingConfiguration cfg) {
|
||||||
List<TransportRouteResult> convertedRes = new ArrayList<TransportRouteResult>();
|
List<TransportRouteResult> convertedRes = new ArrayList<TransportRouteResult>();
|
||||||
for (net.osmand.router.ptresult.NativeTransportRoutingResult ntrr : res) {
|
for (NativeTransportRoutingResult ntrr : res) {
|
||||||
TransportRouteResult trr = new TransportRouteResult(cfg);
|
TransportRouteResult trr = new TransportRouteResult(cfg);
|
||||||
trr.setFinishWalkDist(ntrr.finishWalkDist);
|
trr.setFinishWalkDist(ntrr.finishWalkDist);
|
||||||
trr.setRouteTime(ntrr.routeTime);
|
trr.setRouteTime(ntrr.routeTime);
|
||||||
|
|
|
@ -31,7 +31,7 @@ import net.osmand.router.TransportRoutePlanner.TransportRouteResult;
|
||||||
import net.osmand.router.TransportRoutePlanner.TransportRouteResultSegment;
|
import net.osmand.router.TransportRoutePlanner.TransportRouteResultSegment;
|
||||||
import net.osmand.router.TransportRoutePlanner.TransportRoutingContext;
|
import net.osmand.router.TransportRoutePlanner.TransportRoutingContext;
|
||||||
import net.osmand.router.TransportRoutingConfiguration;
|
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.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
|
@ -502,13 +502,7 @@ public class TransportRoutingHelper {
|
||||||
MapUtils.get31TileNumberY(params.end.getLatitude()),
|
MapUtils.get31TileNumberY(params.end.getLatitude()),
|
||||||
cfg, ctx.calculationProgress);
|
cfg, ctx.calculationProgress);
|
||||||
List<TransportRouteResult> res = TransportRoutePlanner.convertToTransportRoutingResult(nativeRes, cfg);
|
List<TransportRouteResult> res = TransportRoutePlanner.convertToTransportRoutingResult(nativeRes, cfg);
|
||||||
if (!Algorithms.isEmpty(res)) {
|
return res;
|
||||||
return res;
|
|
||||||
} else {
|
|
||||||
app.showToastMessage("Can't find route with NativeLib, switching to Java");
|
|
||||||
return planner.buildRoute(ctx, params.start, params.end);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
return planner.buildRoute(ctx, params.start, params.end);
|
return planner.buildRoute(ctx, params.start, params.end);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue