Fix routing and map viewing simultaneously. Fix default speed for bicycle
This commit is contained in:
parent
45909a52c3
commit
8be7fcfe66
3 changed files with 29 additions and 25 deletions
|
@ -822,6 +822,7 @@ public class BinaryRoutePlanner {
|
||||||
Collections.reverse(result);
|
Collections.reverse(result);
|
||||||
// calculate time
|
// calculate time
|
||||||
float completeTime = 0;
|
float completeTime = 0;
|
||||||
|
float completeDistance = 0;
|
||||||
for (int i = 0; i < result.size(); i++) {
|
for (int i = 0; i < result.size(); i++) {
|
||||||
RouteSegmentResult rr = result.get(i);
|
RouteSegmentResult rr = result.get(i);
|
||||||
RouteDataObject road = rr.getObject();
|
RouteDataObject road = rr.getObject();
|
||||||
|
@ -846,6 +847,7 @@ public class BinaryRoutePlanner {
|
||||||
rr.setSegmentSpeed((float) speed);
|
rr.setSegmentSpeed((float) speed);
|
||||||
rr.setDistance((float) distance);
|
rr.setDistance((float) distance);
|
||||||
completeTime += distOnRoadToPass;
|
completeTime += distOnRoadToPass;
|
||||||
|
completeDistance += distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) {
|
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 endLat = MapUtils.get31LatitudeY(end.road.getPoint31YTile(end.segmentStart));
|
||||||
double endLon = MapUtils.get31LongitudeX(end.road.getPoint31XTile(end.segmentStart));
|
double endLon = MapUtils.get31LongitudeX(end.road.getPoint31XTile(end.segmentStart));
|
||||||
println(MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{5}\" \n"
|
println(MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{5}\" \n"
|
||||||
+ " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" complete_time=\"{4}\">",
|
+ " 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));
|
startLat + "", startLon + "", endLat + "", endLon + "", completeTime + "", ctx.config.routerName, completeDistance+""));
|
||||||
for (RouteSegmentResult res : result) {
|
for (RouteSegmentResult res : result) {
|
||||||
String name = "Unknown";// res.object.getName();
|
String name = "Unknown";// res.object.getName();
|
||||||
String ref = "";// res.object.getNameByType(res.object.getMapIndex().refEncodingType);
|
String ref = "";// res.object.getNameByType(res.object.getMapIndex().refEncodingType);
|
||||||
|
@ -864,9 +866,9 @@ public class BinaryRoutePlanner {
|
||||||
name += " " + ref;
|
name += " " + ref;
|
||||||
}
|
}
|
||||||
println(MessageFormat.format(
|
println(MessageFormat.format(
|
||||||
"\t<segment id=\"{0}\" start=\"{1}\" end=\"{2}\" time=\"{4}\" name=\"{3}\" start_bearing=\"{5}\" end_bearing=\"{5}\" />",
|
"\t<segment id=\"{0}\" start=\"{1}\" end=\"{2}\" time=\"{4}\" name=\"{3}\" distance=\"{5}\" start_bearing=\"{6}\" end_bearing=\"{7}\" />",
|
||||||
(res.getObject().getId()) + "", res.getStartPointIndex() + "", res.getEndPointIndex() + "", name,
|
(res.getObject().getId()) + "", res.getStartPointIndex() + "", res.getEndPointIndex() + "", name,
|
||||||
res.getSegmentTime(), res.getBearingBegin() + "", res.getBearingEnd() + ""));
|
res.getSegmentTime(),res.getDistance(), res.getBearingBegin() + "", res.getBearingEnd() + ""));
|
||||||
}
|
}
|
||||||
println("</test>");
|
println("</test>");
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,32 +76,34 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<routingProfile name="bicycle" baseProfile="bicycle" restrictionsAware="true" minDefaultSpeed="7" maxDefaultSpeed="21"
|
<routingProfile name="bicycle" baseProfile="bicycle" restrictionsAware="true" minDefaultSpeed="7" maxDefaultSpeed="16"
|
||||||
leftTurn="15" rightTurn="0" followSpeedLimitations="false" onewayAware="true">
|
leftTurn="0" rightTurn="0" followSpeedLimitations="false" onewayAware="true">
|
||||||
<highway value="motorway" speed="21" priority="0.7" dynamicPriority="0.7"/>
|
<attribute name="relaxNodesIfStartDistSmallCoeff" value="2.5"/>
|
||||||
<highway value="motorway_link" speed="21" priority="0.7" dynamicPriority="0.7"/>
|
|
||||||
|
|
||||||
<highway value="trunk" speed="21" priority="0.7" dynamicPriority="0.7"/>
|
<highway value="motorway" speed="16" priority="0.7" dynamicPriority="0.7"/>
|
||||||
<highway value="trunk_link" speed="21" priority="0.7" dynamicPriority="0.7"/>
|
<highway value="motorway_link" speed="16" priority="0.7" dynamicPriority="0.7"/>
|
||||||
<highway value="primary" speed="21" priority="0.9" dynamicPriority="0.9"/>
|
|
||||||
<highway value="primary_link" speed="21" priority="0.9" dynamicPriority="0.9"/>
|
|
||||||
<highway value="secondary" speed="21" priority="1" dynamicPriority="1"/>
|
|
||||||
<highway value="secondary_link" speed="21" priority="1" dynamicPriority="1"/>
|
|
||||||
<highway value="tertiary" speed="21" priority="1" dynamicPriority="1"/>
|
|
||||||
<highway value="tertiary_link" speed="21" priority="1" dynamicPriority="1"/>
|
|
||||||
<highway value="road" speed="21" priority="1" dynamicPriority="1"/>
|
|
||||||
<highway value="residential" speed="21" priority="1" dynamicPriority="1"/>
|
|
||||||
<highway value="cycleway" speed="21" priority="1.5" dynamicPriority="1.5"/>
|
|
||||||
|
|
||||||
<highway value="unclassified" speed="15" priority="1" dynamicPriority="1"/>
|
<highway value="trunk" speed="16" priority="0.7" dynamicPriority="0.7"/>
|
||||||
<highway value="service" speed="15" priority="1" dynamicPriority="1"/>
|
<highway value="trunk_link" speed="16" priority="0.7" dynamicPriority="0.7"/>
|
||||||
|
<highway value="primary" speed="16" priority="0.9" dynamicPriority="0.9"/>
|
||||||
|
<highway value="primary_link" speed="16" priority="0.9" dynamicPriority="0.9"/>
|
||||||
|
<highway value="secondary" speed="16" priority="1" dynamicPriority="1"/>
|
||||||
|
<highway value="secondary_link" speed="16" priority="1" dynamicPriority="1"/>
|
||||||
|
<highway value="tertiary" speed="16" priority="1" dynamicPriority="1"/>
|
||||||
|
<highway value="tertiary_link" speed="16" priority="1" dynamicPriority="1"/>
|
||||||
|
<highway value="road" speed="16" priority="1" dynamicPriority="1"/>
|
||||||
|
<highway value="residential" speed="16" priority="1" dynamicPriority="1"/>
|
||||||
|
<highway value="cycleway" speed="16" priority="1.5" dynamicPriority="1"/>
|
||||||
|
|
||||||
|
<highway value="unclassified" speed="13" priority="1" dynamicPriority="1"/>
|
||||||
|
<highway value="service" speed="13" priority="1" dynamicPriority="1"/>
|
||||||
<highway value="track" speed="10" priority="0.9" dynamicPriority="0.9"/>
|
<highway value="track" speed="10" priority="0.9" dynamicPriority="0.9"/>
|
||||||
<highway value="path" speed="10" priority="0.9" dynamicPriority="0.9"/>
|
<highway value="path" speed="10" priority="0.9" dynamicPriority="0.9"/>
|
||||||
<highway value="living_street" speed="15" priority="1" dynamicPriority="1"/>
|
<highway value="living_street" speed="13" priority="1" dynamicPriority="1"/>
|
||||||
<highway value="pedestrian" speed="10" priority="0.9" dynamicPriority="0.9"/>
|
<highway value="pedestrian" speed="10" priority="0.9" dynamicPriority="0.9"/>
|
||||||
<highway value="footway" speed="8" priority="0.9" dynamicPriority="0.9"/>
|
<highway value="footway" speed="8" priority="0.9" dynamicPriority="0.9"/>
|
||||||
<highway value="byway" speed="8" priority="1" dynamicPriority="1"/>
|
<highway value="byway" speed="8" priority="1" dynamicPriority="1"/>
|
||||||
<highway value="services" speed="15" priority="1" dynamicPriority="1"/>
|
<highway value="services" speed="13" priority="1" dynamicPriority="1"/>
|
||||||
<highway value="bridleway" speed="8" priority="0.8" dynamicPriority="0.8"/>
|
<highway value="bridleway" speed="8" priority="0.8" dynamicPriority="0.8"/>
|
||||||
<highway value="steps" speed="3" priority="0.5" dynamicPriority="0.5"/>
|
<highway value="steps" speed="3" priority="0.5" dynamicPriority="0.5"/>
|
||||||
|
|
||||||
|
|
|
@ -879,8 +879,8 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
|
||||||
bool basemapExists = false;
|
bool basemapExists = false;
|
||||||
for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) {
|
for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) {
|
||||||
BinaryMapFile* file = i->second;
|
BinaryMapFile* file = i->second;
|
||||||
lseek(file->fd, 0, SEEK_SET);
|
lseek(file->routefd, 0, SEEK_SET);
|
||||||
FileInputStream input(file->fd);
|
FileInputStream input(file->routefd);
|
||||||
input.SetCloseOnDelete(false);
|
input.SetCloseOnDelete(false);
|
||||||
CodedInputStream cis(&input);
|
CodedInputStream cis(&input);
|
||||||
cis.SetTotalBytesLimit(INT_MAX, INT_MAX >> 2);
|
cis.SetTotalBytesLimit(INT_MAX, INT_MAX >> 2);
|
||||||
|
|
Loading…
Reference in a new issue