I’ve replaced my hacky copy-paste job with an overridden class. Here is the complete code for my bus encoder; I’m not a Java developer so please pardon any bad code. I still don’t know why it doesn’t work in the above example:
// vim: set expandtab:
package com.graphhopper.routing.util;
import com.graphhopper.reader.OSMRelation;
import com.graphhopper.reader.OSMWay;
import com.graphhopper.reader.osm.conditional.ConditionalTagsInspector;
import com.graphhopper.reader.osm.conditional.DateRangeParser;
import com.graphhopper.util.Helper;
import com.graphhopper.util.PMap;
import java.util.*;
public class BusFlagEncoder extends CarFlagEncoder
{
public BusFlagEncoder()
{
super();
}
public BusFlagEncoder(PMap properties)
{
super(properties);
}
public BusFlagEncoder(String propertiesStr)
{
super(propertiesStr);
}
public BusFlagEncoder(int speedBits, double speedFactor, int maxTurnCosts)
{
super(speedBits, speedFactor, maxTurnCosts);
restrictions.remove("motorcar");
restrictions.add("psv");
restrictions.add("bus");
restrictedValues.remove("private");
intendedValues.add("private");
absoluteBarriers.remove("bus_trap");
absoluteBarriers.remove("sump_buster");
}
@Override
public String toString()
{
return "bus";
}
}