From 8be7fcfe661b53ca708cec9d2f74b5c7e4397829 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Tue, 19 Jun 2012 19:59:12 +0200 Subject: [PATCH] Fix routing and map viewing simultaneously. Fix default speed for bicycle --- .../net/osmand/router/BinaryRoutePlanner.java | 10 +++-- .../src/net/osmand/router/routing.xml | 40 ++++++++++--------- Osmand-kernel/osmand/src/binaryRead.cpp | 4 +- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java index 1c8c183079..c4b20a1245 100644 --- a/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java +++ b/DataExtractionOSM/src/net/osmand/router/BinaryRoutePlanner.java @@ -822,6 +822,7 @@ public class BinaryRoutePlanner { Collections.reverse(result); // calculate time float completeTime = 0; + float completeDistance = 0; for (int i = 0; i < result.size(); i++) { RouteSegmentResult rr = result.get(i); RouteDataObject road = rr.getObject(); @@ -846,6 +847,7 @@ public class BinaryRoutePlanner { rr.setSegmentSpeed((float) speed); rr.setDistance((float) distance); completeTime += distOnRoadToPass; + completeDistance += distance; } if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) { @@ -855,8 +857,8 @@ public class BinaryRoutePlanner { double endLat = MapUtils.get31LatitudeY(end.road.getPoint31YTile(end.segmentStart)); double endLon = MapUtils.get31LongitudeX(end.road.getPoint31XTile(end.segmentStart)); println(MessageFormat.format("", - startLat + "", startLon + "", endLat + "", endLon + "", completeTime + "", ctx.config.routerName)); + + " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" complete_time=\"{4}\" complete_distance=\"{6}\">", + startLat + "", startLon + "", endLat + "", endLon + "", completeTime + "", ctx.config.routerName, completeDistance+"")); for (RouteSegmentResult res : result) { String name = "Unknown";// res.object.getName(); String ref = "";// res.object.getNameByType(res.object.getMapIndex().refEncodingType); @@ -864,9 +866,9 @@ public class BinaryRoutePlanner { name += " " + ref; } println(MessageFormat.format( - "\t", + "\t", (res.getObject().getId()) + "", res.getStartPointIndex() + "", res.getEndPointIndex() + "", name, - res.getSegmentTime(), res.getBearingBegin() + "", res.getBearingEnd() + "")); + res.getSegmentTime(),res.getDistance(), res.getBearingBegin() + "", res.getBearingEnd() + "")); } println(""); } diff --git a/DataExtractionOSM/src/net/osmand/router/routing.xml b/DataExtractionOSM/src/net/osmand/router/routing.xml index 4017a3f757..a722090e5e 100644 --- a/DataExtractionOSM/src/net/osmand/router/routing.xml +++ b/DataExtractionOSM/src/net/osmand/router/routing.xml @@ -76,32 +76,34 @@ - - - + + - - - - - - - - - - - + + - - + + + + + + + + + + + + + + - + - + diff --git a/Osmand-kernel/osmand/src/binaryRead.cpp b/Osmand-kernel/osmand/src/binaryRead.cpp index cf4bbfec14..ae9d00923f 100644 --- a/Osmand-kernel/osmand/src/binaryRead.cpp +++ b/Osmand-kernel/osmand/src/binaryRead.cpp @@ -879,8 +879,8 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates, bool basemapExists = false; for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) { BinaryMapFile* file = i->second; - lseek(file->fd, 0, SEEK_SET); - FileInputStream input(file->fd); + lseek(file->routefd, 0, SEEK_SET); + FileInputStream input(file->routefd); input.SetCloseOnDelete(false); CodedInputStream cis(&input); cis.SetTotalBytesLimit(INT_MAX, INT_MAX >> 2);