Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb4d5320

Browse files
committed
avoid ferry in custom model
1 parentb9bd23b commitb4d5320

File tree

13 files changed

+41
-32
lines changed

13 files changed

+41
-32
lines changed

‎core/src/main/java/com/graphhopper/routing/util/parsers/BikeCommonPriorityParser.java‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
packagecom.graphhopper.routing.util.parsers;
22

33
importcom.graphhopper.reader.ReaderWay;
4-
importcom.graphhopper.routing.ev.*;
4+
importcom.graphhopper.routing.ev.DecimalEncodedValue;
5+
importcom.graphhopper.routing.ev.EdgeIntAccess;
6+
importcom.graphhopper.routing.ev.MaxSpeed;
57
importcom.graphhopper.routing.util.FerrySpeedCalculator;
68
importcom.graphhopper.routing.util.PriorityCode;
79
importcom.graphhopper.storage.IntsRef;
@@ -74,17 +76,10 @@ protected BikeCommonPriorityParser(DecimalEncodedValue priorityEnc, DecimalEncod
7476
@Override
7577
publicvoidhandleWayTags(intedgeId,EdgeIntAccessedgeIntAccess,ReaderWayway,IntsRefrelationFlags) {
7678
StringhighwayValue =way.getTag("highway");
77-
TreeMap<Double,PriorityCode>weightToPrioMap =newTreeMap<>();
78-
if (highwayValue !=null) {
79-
weightToPrioMap.put(0d,UNCHANGED);
80-
}else {
81-
if (FerrySpeedCalculator.isFerry(way)) {
82-
weightToPrioMap.put(110d,SLIGHT_AVOID);
83-
}else {
84-
return;
85-
}
86-
}
79+
if (highwayValue ==null && !FerrySpeedCalculator.isFerry(way))return;
8780

81+
TreeMap<Double,PriorityCode>weightToPrioMap =newTreeMap<>();
82+
weightToPrioMap.put(0d,UNCHANGED);
8883
doublemaxSpeed =Math.max(avgSpeedEnc.getDecimal(false,edgeId,edgeIntAccess),
8984
avgSpeedEnc.getDecimal(true,edgeId,edgeIntAccess));
9085
collect(way,maxSpeed,isBikeDesignated(way),weightToPrioMap);

‎core/src/main/resources/com/graphhopper/custom_models/bike.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
{"if":"true","multiply_by":"bike_priority" },
1919
{"if":"bike_network == INTERNATIONAL || bike_network == NATIONAL","multiply_by":"1.8" },
2020
{"else_if":"bike_network == REGIONAL || bike_network == LOCAL","multiply_by":"1.5" },
21+
{"if":"road_environment == FERRY","multiply_by":"0.5" },
2122
{"if":"mtb_rating > 2","multiply_by":"0" },
2223
{"if":"hike_rating > 1","multiply_by":"0" },
2324
{"if":"country == DEU && road_class == BRIDLEWAY && bike_road_access != YES","multiply_by":"0" },

‎core/src/main/resources/com/graphhopper/custom_models/bike_tc.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
{
1717
"priority": [
1818
{"if":"true","multiply_by":"bike_priority" },
19+
{"if":"bike_network == INTERNATIONAL || bike_network == NATIONAL","multiply_by":"1.8" },
20+
{"else_if":"bike_network == REGIONAL || bike_network == LOCAL","multiply_by":"1.5" },
21+
{"if":"road_environment == FERRY","multiply_by":"0.5" },
22+
{"if":"mtb_rating > 2","multiply_by":"0" },
23+
{"if":"hike_rating > 1","multiply_by":"0" },
24+
{"if":"country == DEU && road_class == BRIDLEWAY && bike_road_access != YES","multiply_by":"0" },
1925
{"if":"!bike_access && (!backward_bike_access || roundabout)","multiply_by":"0" },
2026
{"else_if":"!bike_access && backward_bike_access","multiply_by":"0.2" }
2127
],

‎core/src/main/resources/com/graphhopper/custom_models/foot.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
{"else":"","multiply_by":"foot_priority"},
1212
{"if":"country == DEU && road_class == BRIDLEWAY && foot_road_access != YES","multiply_by":"0" },
1313
// note that mtb_rating=0 is the default and mtb_rating=1 corresponds to mtb:scale=0 and so on
14-
{"if":"mtb_rating > 3","multiply_by":"0.7" }
14+
{"if":"mtb_rating > 3","multiply_by":"0.7" },
15+
{"if":"road_environment == FERRY","multiply_by":"0.5" }
1516
],
1617
"speed": [
1718
{"if":"true","limit_to":"foot_average_speed" }

‎core/src/main/resources/com/graphhopper/custom_models/hike.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
{"if":"!foot_access || hike_rating >= 6","multiply_by":"0"},
1111
{"else":"","multiply_by":"foot_priority"},
1212
{"if":"foot_network == INTERNATIONAL || foot_network == NATIONAL","multiply_by":"1.7"},
13-
{"else_if":"foot_network == REGIONAL || foot_network == LOCAL","multiply_by":"1.5"}
13+
{"else_if":"foot_network == REGIONAL || foot_network == LOCAL","multiply_by":"1.5"},
14+
{"if":"road_environment == FERRY","multiply_by":"0.5" }
1415
],
1516
"speed": [
1617
{"if":"hike_rating < 1","limit_to":"foot_average_speed" },

‎core/src/main/resources/com/graphhopper/custom_models/mtb.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
{"if":"true","multiply_by":"mtb_priority" },
1111
{"if":"bike_network == INTERNATIONAL || bike_network == NATIONAL","multiply_by":"1.8" },
1212
{"else_if":"bike_network == REGIONAL || bike_network == LOCAL","multiply_by":"1.5" },
13+
{"if":"road_environment == FERRY","multiply_by":"0.5" },
1314
{"if":"mtb_rating > 6","multiply_by":"0" },
1415
{"else_if":"mtb_rating > 3","multiply_by":"0.5" },
1516
{"if":"hike_rating > 4","multiply_by":"0" },

‎core/src/main/resources/com/graphhopper/custom_models/racingbike.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
{"if":"true","multiply_by":"racingbike_priority" },
1111
{"if":"bike_network == INTERNATIONAL || bike_network == NATIONAL","multiply_by":"1.8" },
1212
{"else_if":"bike_network == REGIONAL || bike_network == LOCAL","multiply_by":"1.5" },
13+
{"if":"road_environment == FERRY","multiply_by":"0.5" },
1314
{"if":"mtb_rating > 2","multiply_by":"0" },
1415
{"else_if":"mtb_rating == 2","multiply_by":"0.5" },
1516
{"if":"hike_rating > 1","multiply_by":"0" },

‎core/src/test/java/com/graphhopper/GraphHopperTest.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2470,7 +2470,8 @@ public void testBarriers() {
24702470
GraphHopperhopper =newGraphHopper().
24712471
setGraphHopperLocation(GH_LOCATION).
24722472
setOSMFile("../map-matching/files/leipzig_germany.osm.pbf").
2473-
setEncodedValuesString("car_access|block_private=false,road_access,car_average_speed, bike_access, bike_priority, bike_average_speed, foot_access, foot_priority, foot_average_speed").
2473+
setEncodedValuesString("car_access|block_private=false,road_access,road_environment," +
2474+
"car_average_speed, bike_access, bike_priority, bike_average_speed, foot_access, foot_priority, foot_average_speed").
24742475
setProfiles(
24752476
TestProfiles.accessAndSpeed("car"),
24762477
TestProfiles.accessSpeedAndPriority("bike"),

‎core/src/test/java/com/graphhopper/reader/osm/OSMReaderTest.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,8 +1003,9 @@ public GraphHopperFacade(String osmFile, String prefLang) {
10031003
setStoreOnFlush(false);
10041004
setOSMFile(osmFile);
10051005
setGraphHopperLocation(dir);
1006-
Stringstr ="max_width,max_height,max_weight,foot_access, foot_priority, foot_average_speed, car_access, car_average_speed, bike_access, bike_priority, bike_average_speed";
1007-
setEncodedValuesString(str);
1006+
setEncodedValuesString("max_width,max_height,max_weight,road_environment," +
1007+
"foot_access, foot_priority, foot_average_speed, " +
1008+
"car_access, car_average_speed, bike_access, bike_priority, bike_average_speed");
10081009
setProfiles(
10091010
TestProfiles.accessSpeedAndPriority("foot"),
10101011
TestProfiles.accessAndSpeed("car").setTurnCostsConfig(newTurnCostsConfig(List.of("motorcar","motor_vehicle"))),

‎core/src/test/java/com/graphhopper/routing/RoutingAlgorithmWithOSMTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ private GraphHopper createHopper(String osmFile, Profile... profiles) {
710710
"bike_access, bike_priority, bike_average_speed, bike_network, roundabout, " +
711711
"mtb_access, mtb_priority, mtb_average_speed, mtb_rating, " +
712712
"racingbike_access, racingbike_priority, racingbike_average_speed, " +
713-
"foot_road_access, bike_road_access, country, road_class").
713+
"foot_road_access, bike_road_access, country, road_class, road_environment").
714714
setGraphHopperLocation(GH_LOCATION);
715715
hopper.getRouterConfig().setSimplifyResponse(false);
716716
hopper.setMinNetworkSize(0);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp