if (from == -1 || to == -1 || via == -1) {
LOG.warn(addBuilderAnnotation(new TurnRestrictionBad(relation.getId())));
return;
}
TraverseModeSet modes = new TraverseModeSet(TraverseMode.BICYCLE, TraverseMode.CAR,
TraverseMode.CUSTOM_MOTOR_VEHICLE);
String exceptModes = relation.getTag("except");
if (exceptModes != null) {
for (String m : exceptModes.split(";")) {
if (m.equals("motorcar")) {
modes.setDriving(false);
} else if (m.equals("bicycle")) {
modes.setBicycle(false);
LOG.debug(addBuilderAnnotation(new TurnRestrictionException(via, from)));
}
}
}
TurnRestrictionTag tag;
if (relation.isTag("restriction", "no_right_turn")) {
tag = new TurnRestrictionTag(via, TurnRestrictionType.NO_TURN, Direction.RIGHT);
} else if (relation.isTag("restriction", "no_left_turn")) {
tag = new TurnRestrictionTag(via, TurnRestrictionType.NO_TURN, Direction.LEFT);
} else if (relation.isTag("restriction", "no_straight_on")) {
tag = new TurnRestrictionTag(via, TurnRestrictionType.NO_TURN, Direction.STRAIGHT);
} else if (relation.isTag("restriction", "no_u_turn")) {
tag = new TurnRestrictionTag(via, TurnRestrictionType.NO_TURN, Direction.U);
} else if (relation.isTag("restriction", "only_straight_on")) {
tag = new TurnRestrictionTag(via, TurnRestrictionType.ONLY_TURN, Direction.STRAIGHT);
} else if (relation.isTag("restriction", "only_right_turn")) {
tag = new TurnRestrictionTag(via, TurnRestrictionType.ONLY_TURN, Direction.RIGHT);
} else if (relation.isTag("restriction", "only_left_turn")) {
tag = new TurnRestrictionTag(via, TurnRestrictionType.ONLY_TURN, Direction.LEFT);
} else if (relation.isTag("restriction", "only_u_turn")) {
tag = new TurnRestrictionTag(via, TurnRestrictionType.ONLY_TURN, Direction.U);
} else {
LOG.warn(addBuilderAnnotation(new TurnRestrictionUnknown(relation.getTag("restriction"))));
return;
}
tag.modes = modes.clone();
// set the time periods for this restriction, if applicable
if (relation.hasTag("day_on") && relation.hasTag("day_off") && relation.hasTag("hour_on")
&& relation.hasTag("hour_off")) {