@Override public State traverse(State s0) { EdgeNarrative en = new FixedModeEdge(this, s0.getNonTransitMode(s0.getOptions())); RoutingRequest options = s0.getOptions(); if (options.wheelchairAccessible && !wheelchairAccessible) { return null; } TraverseMode mode = s0.getNonTransitMode(options); if (mode == TraverseMode.WALK && !permission.allows(StreetTraversalPermission.PEDESTRIAN)) { return null; } if (mode == TraverseMode.BICYCLE && !permission.allows(StreetTraversalPermission.BICYCLE)) { return null; } // there are elevators which allow cars if (mode == TraverseMode.CAR && !permission.allows(StreetTraversalPermission.CAR)) { return null; } StateEditor s1 = s0.edit(this, en); s1.incrementWeight(options.elevatorHopCost); s1.incrementTimeInSeconds(options.elevatorHopTime); return s1.makeState(); }
/** * This checks if start or end vertex is bollard If it is it creates intersection of street edge * permissions and from/to barriers. Then it checks if mode is allowed to traverse the edge. * * <p>By default CAR isn't allowed to traverse barrier but foot and bicycle are. This can be * changed with different tags * * <p>If start/end isn't bollard it just checks the street permissions. * * <p>It is used in {@link #canTraverse(RoutingRequest, TraverseMode)} * * @param mode * @return */ public boolean canTraverseIncludingBarrier(TraverseMode mode) { StreetTraversalPermission permission = getPermission(); if (fromv instanceof BarrierVertex) { permission = permission.intersection(((BarrierVertex) fromv).getBarrierPermissions()); } if (tov instanceof BarrierVertex) { permission = permission.intersection(((BarrierVertex) tov).getBarrierPermissions()); } return permission.allows(mode); }