public abstract class AbstractFlagEncoder extends Object implements FlagEncoder
EncodingManagerTurnCostEncoder.NoTurnCostsEncoder| Modifier and Type | Field and Description |
|---|---|
protected Set<String> |
absoluteBarriers |
protected BooleanEncodedValue |
accessEnc |
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 PMap |
properties |
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 DecimalEncodedValue |
speedEncoder |
protected double |
speedFactor |
protected static double |
UNKNOWN_DURATION_FERRY_SPEED |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFlagEncoder(int speedBits,
double speedFactor,
int maxTurnCosts) |
|
AbstractFlagEncoder(PMap properties) |
|
AbstractFlagEncoder(String propertiesStr) |
| Modifier and Type | Method and Description |
|---|---|
protected double |
applyMaxSpeed(ReaderWay way,
double speed) |
void |
applyWayTags(ReaderWay way,
EdgeIteratorState edge)
Second parsing step.
|
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.
|
int |
defineRelationBits(int index,
int shift)
Defines the bits which are used for relation flags.
|
int |
defineTurnBits(int index,
int shift)
Defines the bits reserved for storing turn restriction and turn cost
|
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.
|
InstructionAnnotation |
getAnnotation(IntsRef edgeFlags,
Translation tr) |
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) |
protected String |
getPropertiesString() |
double |
getTurnCost(long flags) |
long |
getTurnFlags(boolean restricted,
double costs) |
long |
handleNodeTags(ReaderNode node)
Parse tags on nodes.
|
abstract long |
handleRelationTags(long oldRelation,
ReaderRelation relation)
Analyze the properties of a relation and create the routing flags for the second read step.
|
abstract IntsRef |
handleWayTags(IntsRef edgeFlags,
ReaderWay way,
EncodingManager.Access access,
long relationFlags)
Analyze properties of a way and create the edge flags.
|
boolean |
hasEncodedValue(String key) |
int |
hashCode() |
protected void |
init() |
boolean |
isBlockFords() |
boolean |
isRegistered() |
boolean |
isTurnRestricted(long flags) |
static double |
parseSpeed(String str) |
void |
setBlockByDefault(boolean blockByDefault)
Should potential barriers block when no access limits are given?
|
void |
setBlockFords(boolean blockFords) |
protected void |
setConditionalTagInspector(ConditionalTagInspector conditionalTagInspector) |
void |
setEncodedValueLookup(EncodedValueLookup encodedValueLookup) |
void |
setRegistered(boolean registered) |
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.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetVersionprotected final int speedBits
protected final double speedFactor
protected double speedDefault
protected BooleanEncodedValue accessEnc
protected BooleanEncodedValue roundaboutEnc
protected DecimalEncodedValue speedEncoder
protected PMap properties
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
public AbstractFlagEncoder(PMap properties)
public AbstractFlagEncoder(String propertiesStr)
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()
public boolean isRegistered()
isRegistered in interface FlagEncoderpublic void setRegistered(boolean registered)
public void setBlockByDefault(boolean blockByDefault)
public boolean isBlockFords()
public void setBlockFords(boolean blockFords)
public ConditionalTagInspector getConditionalTagInspector()
protected void setConditionalTagInspector(ConditionalTagInspector conditionalTagInspector)
public int defineNodeBits(int index,
int shift)
public void createEncodedValues(List<EncodedValue> registerNewEncodedValue, String prefix, int index)
public int defineRelationBits(int index,
int shift)
public abstract long handleRelationTags(long oldRelation,
ReaderRelation relation)
public abstract EncodingManager.Access getAccess(ReaderWay way)
public abstract IntsRef handleWayTags(IntsRef edgeFlags, ReaderWay way, EncodingManager.Access access, long relationFlags)
public long handleNodeTags(ReaderNode node)
public InstructionAnnotation getAnnotation(IntsRef edgeFlags, Translation tr)
getAnnotation in interface FlagEncoderprotected void flagsDefault(IntsRef edgeFlags, boolean forward, boolean backward)
public double getMaxSpeed()
getMaxSpeed in interface FlagEncoderprotected double getMaxSpeed(ReaderWay way)
public static double parseSpeed(String str)
public void applyWayTags(ReaderWay way, EdgeIteratorState edge)
protected double getFerrySpeed(ReaderWay way)
public int defineTurnBits(int index,
int shift)
shift - bit offset for the first bit used by this encoderpublic boolean isTurnRestricted(long flags)
isTurnRestricted in interface TurnCostEncoderpublic double getTurnCost(long flags)
getTurnCost in interface TurnCostEncoderpublic long getTurnFlags(boolean restricted,
double costs)
getTurnFlags in interface TurnCostEncoderrestricted - true if restricted turn, equivalent to specifying costs = Double.POSITIVE_INFINITYcosts - the turn costs, specify 0 or Double.POSITIVE_INFINITY if restricted == true.
Only used if restricted == false.public final DecimalEncodedValue getAverageSpeedEnc()
FlagEncodergetAverageSpeedEnc in interface FlagEncoderpublic final BooleanEncodedValue getAccessEnc()
FlagEncodergetAccessEnc in interface FlagEncoderprotected 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 <T extends EncodedValue> T getEncodedValue(String key, Class<T> encodedValueType)
getEncodedValue in interface EncodedValueLookuppublic BooleanEncodedValue getBooleanEncodedValue(String key)
getBooleanEncodedValue in interface EncodedValueLookuppublic IntEncodedValue getIntEncodedValue(String key)
getIntEncodedValue in interface EncodedValueLookuppublic DecimalEncodedValue getDecimalEncodedValue(String key)
getDecimalEncodedValue in interface EncodedValueLookuppublic <T extends Enum> EnumEncodedValue<T> getEnumEncodedValue(String key, Class<T> enumType)
getEnumEncodedValue in interface EncodedValueLookuppublic void setEncodedValueLookup(EncodedValueLookup encodedValueLookup)
public boolean supports(Class<?> feature)
FlagEncodersupports in interface FlagEncoderpublic boolean hasEncodedValue(String key)
hasEncodedValue in interface EncodedValueLookupCopyright © 2012–2019. All rights reserved.