public abstract class AbstractFlagEncoder extends Object implements FlagEncoder
EncodingManager
Modifier and Type | Field and Description |
---|---|
protected Set<String> |
absoluteBarriers |
protected BooleanEncodedValue |
accessEnc |
protected DecimalEncodedValue |
avgSpeedEnc |
protected EncodedValueLookup |
encodedValueLookup |
protected Set<String> |
ferries |
protected Set<String> |
intendedValues |
protected static double |
LONG_TRIP_FERRY_SPEED |
protected int |
maxPossibleSpeed |
protected Set<String> |
oneways |
protected Set<String> |
potentialBarriers |
protected Set<String> |
restrictedValues |
protected List<String> |
restrictions |
protected BooleanEncodedValue |
roundaboutEnc |
protected static double |
SHORT_TRIP_FERRY_SPEED |
protected int |
speedBits |
protected double |
speedDefault |
protected double |
speedFactor |
protected static double |
UNKNOWN_DURATION_FERRY_SPEED |
Modifier | Constructor and Description |
---|---|
protected |
AbstractFlagEncoder(int speedBits,
double speedFactor,
int maxTurnCosts) |
Modifier and Type | Method and Description |
---|---|
protected double |
applyMaxSpeed(ReaderWay way,
double speed) |
void |
applyWayTags(ReaderWay way,
EdgeIteratorState edge)
Second parsing step.
|
protected void |
blockBarriersByDefault(boolean blockByDefault)
Should potential barriers block when no access limits are given?
|
protected void |
blockFords(boolean blockFords) |
protected void |
blockPrivate(boolean blockPrivate) |
void |
createEncodedValues(List<EncodedValue> registerNewEncodedValue,
String prefix,
int index)
Defines bits used for edge flags used for access, speed etc.
|
int |
defineNodeBits(int index,
int shift)
Defines the bits for the node flags, which are currently used for barriers only.
|
boolean |
equals(Object obj) |
protected void |
flagsDefault(IntsRef edgeFlags,
boolean forward,
boolean backward)
Sets default flags with specified access.
|
abstract EncodingManager.Access |
getAccess(ReaderWay way)
Decide whether a way is routable for a given mode of travel.
|
BooleanEncodedValue |
getAccessEnc()
This method returns the EncodedValue used for the direction-dependent access properties of this encoder.
|
List<EncodedValue> |
getAllShared() |
DecimalEncodedValue |
getAverageSpeedEnc()
This method returns the EncodedValue used for the average speed of this encoder.
|
BooleanEncodedValue |
getBooleanEncodedValue(String key) |
ConditionalTagInspector |
getConditionalTagInspector() |
DecimalEncodedValue |
getDecimalEncodedValue(String key) |
<T extends EncodedValue> |
getEncodedValue(String key,
Class<T> encodedValueType) |
<T extends Enum> |
getEnumEncodedValue(String key,
Class<T> enumType) |
protected double |
getFerrySpeed(ReaderWay way)
Special handling for ferry ways.
|
IntEncodedValue |
getIntEncodedValue(String key) |
double |
getMaxSpeed() |
protected double |
getMaxSpeed(ReaderWay way) |
int |
getMaxTurnCosts() |
protected String |
getPropertiesString() |
long |
handleNodeTags(ReaderNode node)
Parse tags on nodes.
|
abstract IntsRef |
handleWayTags(IntsRef edgeFlags,
ReaderWay way,
EncodingManager.Access access)
Analyze properties of a way and create the edge flags.
|
boolean |
hasEncodedValue(String key) |
int |
hashCode() |
protected void |
init(DateRangeParser dateRangeParser) |
boolean |
isBlockFords() |
boolean |
isRegistered() |
static double |
parseSpeed(String str) |
protected void |
setConditionalTagInspector(ConditionalTagInspector inspector) |
void |
setEncodedValueLookup(EncodedValueLookup encodedValueLookup) |
protected void |
setSpeed(boolean reverse,
IntsRef edgeFlags,
double speed)
Most use cases do not require this method.
|
boolean |
supports(Class<?> feature)
Returns true if the feature class is supported like TurnWeighting or PriorityWeighting.
|
boolean |
supportsTurnCosts() |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getTransportationMode, getVersion
protected final int speedBits
protected final double speedFactor
protected double speedDefault
protected BooleanEncodedValue accessEnc
protected BooleanEncodedValue roundaboutEnc
protected DecimalEncodedValue avgSpeedEnc
protected int maxPossibleSpeed
protected EncodedValueLookup encodedValueLookup
protected static final double UNKNOWN_DURATION_FERRY_SPEED
protected static final double SHORT_TRIP_FERRY_SPEED
protected static final double LONG_TRIP_FERRY_SPEED
protected AbstractFlagEncoder(int speedBits, double speedFactor, int maxTurnCosts)
speedBits
- specify the number of bits used for speedspeedFactor
- specify the factor to multiple the stored value (can be used to increase
or decrease accuracy of speed value)maxTurnCosts
- specify the maximum value used for turn costs, if this value is reached a
turn is forbidden and results in costs of positive infinity.protected void init(DateRangeParser dateRangeParser)
protected void setConditionalTagInspector(ConditionalTagInspector inspector)
public boolean isRegistered()
isRegistered
in interface FlagEncoder
protected void blockBarriersByDefault(boolean blockByDefault)
public boolean isBlockFords()
protected void blockFords(boolean blockFords)
protected void blockPrivate(boolean blockPrivate)
public ConditionalTagInspector getConditionalTagInspector()
public int defineNodeBits(int index, int shift)
public void createEncodedValues(List<EncodedValue> registerNewEncodedValue, String prefix, int index)
public abstract IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay way, EncodingManager.Access access)
public int getMaxTurnCosts()
public abstract EncodingManager.Access getAccess(ReaderWay way)
public long handleNodeTags(ReaderNode node)
protected void flagsDefault(IntsRef edgeFlags, boolean forward, boolean backward)
public double getMaxSpeed()
getMaxSpeed
in interface FlagEncoder
protected double getMaxSpeed(ReaderWay way)
public static double parseSpeed(String str)
public void applyWayTags(ReaderWay way, EdgeIteratorState edge)
protected double getFerrySpeed(ReaderWay way)
public final DecimalEncodedValue getAverageSpeedEnc()
FlagEncoder
getAverageSpeedEnc
in interface FlagEncoder
public final BooleanEncodedValue getAccessEnc()
FlagEncoder
getAccessEnc
in interface FlagEncoder
protected void setSpeed(boolean reverse, IntsRef edgeFlags, double speed)
protected double applyMaxSpeed(ReaderWay way, double speed)
way
- needed to retrieve tagsspeed
- speed guessed e.g. from the road type or other tagsprotected String getPropertiesString()
public List<EncodedValue> getAllShared()
getAllShared
in interface EncodedValueLookup
public <T extends EncodedValue> T getEncodedValue(String key, Class<T> encodedValueType)
getEncodedValue
in interface EncodedValueLookup
public BooleanEncodedValue getBooleanEncodedValue(String key)
getBooleanEncodedValue
in interface EncodedValueLookup
public IntEncodedValue getIntEncodedValue(String key)
getIntEncodedValue
in interface EncodedValueLookup
public DecimalEncodedValue getDecimalEncodedValue(String key)
getDecimalEncodedValue
in interface EncodedValueLookup
public <T extends Enum> EnumEncodedValue<T> getEnumEncodedValue(String key, Class<T> enumType)
getEnumEncodedValue
in interface EncodedValueLookup
public void setEncodedValueLookup(EncodedValueLookup encodedValueLookup)
public boolean supportsTurnCosts()
supportsTurnCosts
in interface FlagEncoder
public boolean supports(Class<?> feature)
FlagEncoder
supports
in interface FlagEncoder
public boolean hasEncodedValue(String key)
hasEncodedValue
in interface EncodedValueLookup
Copyright © 2012–2020. All rights reserved.