Skip to content

Commit af63e4b

Browse files
author
jansoe
committed
Roundabout tags for foot and bike flag encoder
1 parent afb4203 commit af63e4b

File tree

5 files changed

+30
-3
lines changed

5 files changed

+30
-3
lines changed

core/src/main/java/com/graphhopper/routing/util/BikeCommonFlagEncoder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,12 @@ public long handleWayTags( OSMWay way, long allowed, long relationFlags )
313313
encoded = handleSpeed(way, speed, encoded);
314314
encoded = handleBikeRelated(way, encoded, relationFlags > UNCHANGED.getValue());
315315

316+
boolean isRoundabout = way.hasTag("junction", "roundabout");
317+
if (isRoundabout)
318+
{
319+
encoded = setBool(encoded, K_ROUNDABOUT, true);
320+
}
321+
316322
} else
317323
{
318324
encoded = handleFerryTags(way,

core/src/main/java/com/graphhopper/routing/util/FootFlagEncoder.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public long handleWayTags( OSMWay way, long allowed, long relationFlags )
262262

263263
long encoded;
264264
if (!isFerry(allowed))
265-
{
265+
{
266266
String sacScale = way.getTag("sac_scale");
267267
if (sacScale != null)
268268
{
@@ -282,6 +282,12 @@ public long handleWayTags( OSMWay way, long allowed, long relationFlags )
282282

283283
encoded = setLong(encoded, PriorityWeighting.KEY, handlePriority(way, priorityFromRelation));
284284

285+
boolean isRoundabout = way.hasTag("junction", "roundabout");
286+
if (isRoundabout)
287+
{
288+
encoded = setBool(encoded, K_ROUNDABOUT, true);
289+
}
290+
285291
} else
286292
{
287293
encoded = handleFerryTags(way, SLOW_SPEED, MEAN_SPEED, FERRY_SPEED);

core/src/main/java/com/graphhopper/util/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class Constants
5151
public static final String OS_VERSION = System.getProperty("os.version");
5252
public static final String JAVA_VENDOR = System.getProperty("java.vendor");
5353
public static final int VERSION_NODE = 4;
54-
public static final int VERSION_EDGE = 11;
54+
public static final int VERSION_EDGE = 12;
5555
public static final int VERSION_GEOMETRY = 3;
5656
public static final int VERSION_LOCATION_IDX = 2;
5757
public static final int VERSION_NAME_IDX = 2;

core/src/test/java/com/graphhopper/routing/util/BikeFlagEncoderTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ public void testHandleWayTags()
141141
way.setTag("tracktype", "grade2");
142142
wayType = getWayTypeFromFlags(way);
143143
assertEquals("get off the bike, unpaved", wayType);
144+
145+
way.clearTags();
146+
way.setTag("junction", "roundabout");
147+
way.setTag("highway", "tertiary");
148+
long flags = encoder.handleWayTags(way, encoder.acceptWay(way), 0);
149+
assertTrue(encoder.isBool(flags, FlagEncoder.K_ROUNDABOUT));
144150
}
145151

146152
@Test
@@ -199,7 +205,7 @@ public void testOneway()
199205
assertTrue(encoder.isBackward(flags));
200206
way.clearTags();
201207
}
202-
208+
203209
@Test
204210
public void testHandleWayTagsInfluencedByRelation()
205211
{

core/src/test/java/com/graphhopper/routing/util/FootFlagEncoderTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,13 @@ public void testBarrierAccess()
255255
// barrier!
256256
assertTrue(footEncoder.handleNodeTags(node) > 0);
257257
}
258+
259+
@Test
260+
public void handleWayTagsRoundabout() {
261+
OSMWay way = new OSMWay(1);
262+
way.setTag("junction", "roundabout");
263+
way.setTag("highway", "tertiary");
264+
long flags = footEncoder.handleWayTags(way, footEncoder.acceptWay(way), 0);
265+
assertTrue(footEncoder.isBool(flags, FlagEncoder.K_ROUNDABOUT));
266+
}
258267
}

0 commit comments

Comments
 (0)