From be06d96141d1516bc953dc75e5a4591f56c45e34 Mon Sep 17 00:00:00 2001 From: vshcherb Date: Thu, 6 Feb 2014 00:35:08 +0100 Subject: [PATCH] Update warnings & settings with new routing --- .../src/net/osmand/binary/BinaryMapIndexReader.java | 1 + OsmAnd-java/src/net/osmand/router/RoutingContext.java | 8 +++++++- OsmAnd/res/values/no_translate.xml | 2 +- OsmAnd/src/net/osmand/plus/routing/RouteProvider.java | 11 ++++++++--- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java index 903c31e957..5c3a277efa 100644 --- a/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/OsmAnd-java/src/net/osmand/binary/BinaryMapIndexReader.java @@ -107,6 +107,7 @@ public class BinaryMapIndexReader { codedIS = CodedInputStream.newInstance(raf); codedIS.setSizeLimit(Integer.MAX_VALUE); // 2048 MB version = referenceToSameFile.version; + dateCreated = referenceToSameFile.dateCreated; transportAdapter = new BinaryMapTransportReaderAdapter(this); addressAdapter = new BinaryMapAddressReaderAdapter(this); poiAdapter = new BinaryMapPoiReaderAdapter(this); diff --git a/OsmAnd-java/src/net/osmand/router/RoutingContext.java b/OsmAnd-java/src/net/osmand/router/RoutingContext.java index 3dd77876e0..44fd114699 100644 --- a/OsmAnd-java/src/net/osmand/router/RoutingContext.java +++ b/OsmAnd-java/src/net/osmand/router/RoutingContext.java @@ -11,6 +11,7 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.Date; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; @@ -366,7 +367,12 @@ public class RoutingContext { public void checkOldRoutingFiles(BinaryMapIndexReader key) { if(calculationMode == RouteCalculationMode.BASE && key.getDateCreated() < 1390431600000l) { // new SimpleDateFormat("dd-MM-yyyy").parse("23-01-2014").getTime() - throw new RuntimeException("Update map '"+key.getRegionNames()+ "' !"); + System.out.println(key.getDateCreated() + " " + new Date(key.getDateCreated())); + String map = ""; + for (RouteRegion r : key.getRoutingIndexes()) { + map = r.getName(); + } + throw new RuntimeException("Update map '"+map+ "' !"); } } diff --git a/OsmAnd/res/values/no_translate.xml b/OsmAnd/res/values/no_translate.xml index ad07922420..96a91fcac9 100644 --- a/OsmAnd/res/values/no_translate.xml +++ b/OsmAnd/res/values/no_translate.xml @@ -18,7 +18,7 @@ \n\tHardy Mueller - main parts of the project, mostly rendering, UI interaction design \n\nCredits to all major Contributors/Developers : - \n\tV.S. - project lead + \n\tVictor Shcherb - project lead \n\tPavol Zibrita - first contributor and developer of some utilities \n\tDusan Kazik - one of the first contributors \n\tAndre Van Atten - project supporter, active forum participant, one of the first users. diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index 259686b41e..9246dfaadd 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -366,7 +366,7 @@ public class RouteProvider { return new RouteCalculationResult(res, null, params, null); } - protected RouteCalculationResult findVectorMapsRoute(RouteCalculationParams params) throws IOException { + protected RouteCalculationResult findVectorMapsRoute(final RouteCalculationParams params) throws IOException { BinaryMapIndexReader[] files = params.ctx.getTodoAPI().getRoutingMapFiles(); RoutePlannerFrontEnd router = new RoutePlannerFrontEnd(false); OsmandSettings settings = params.ctx.getSettings(); @@ -446,8 +446,13 @@ public class RouteProvider { result = router.searchRoute(complexCtx, st, en, inters); // discard ctx and replace with calculated ctx = complexCtx; - } catch(RuntimeException e) { - params.ctx.showToastMessage(R.string.complex_route_calculation_failed, e.getMessage()); + } catch(final RuntimeException e) { + params.ctx.runInUIThread(new Runnable() { + @Override + public void run() { + params.ctx.showToastMessage(R.string.complex_route_calculation_failed, e.getMessage()); + } + }); result = router.searchRoute(ctx, st, en, inters); } } else {