public abstract class AbstractFlagEncoder extends Object implements FlagEncoder, TurnCostEncoder
EncodingManagerTurnCostEncoder.NoTurnCostsEncoder| Modifier and Type | Field and Description |
|---|---|
protected Set<String> |
absoluteBarriers |
protected long |
acceptBit |
protected long |
backwardBit |
protected long |
directionBitMask |
protected Set<String> |
ferries |
protected long |
ferryBit |
protected long |
forwardBit |
protected Set<String> |
intendedValues |
protected static int |
K_BACKWARD |
protected static int |
K_FORWARD |
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 long |
roundaboutBit |
protected static double |
SHORT_TRIP_FERRY_SPEED |
protected int |
speedBits |
protected EncodedDoubleValue |
speedEncoder |
protected double |
speedFactor |
protected static double |
UNKNOWN_DURATION_FERRY_SPEED |
K_ROUNDABOUT| Modifier | Constructor and Description |
|---|---|
protected |
AbstractFlagEncoder(int speedBits,
double speedFactor,
int maxTurnCosts) |
|
AbstractFlagEncoder(PMap properties) |
|
AbstractFlagEncoder(String propertiesStr) |
| Modifier and Type | Method and Description |
|---|---|
abstract long |
acceptWay(ReaderWay way)
Decide whether a way is routable for a given mode of travel.
|
protected double |
applyMaxSpeed(ReaderWay way,
double speed) |
void |
applyWayTags(ReaderWay way,
EdgeIteratorState edge)
Second parsing step.
|
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
|
int |
defineWayBits(int index,
int shift)
Defines bits used for edge flags used for access, speed etc.
|
boolean |
equals(Object obj) |
long |
flagsDefault(boolean forward,
boolean backward)
Sets default flags with specified access.
|
InstructionAnnotation |
getAnnotation(long flags,
Translation tr) |
ConditionalTagInspector |
getConditionalTagInspector() |
double |
getDouble(long flags,
int key)
Returns arbitrary double value identified by the specified key.
|
protected double |
getFerrySpeed(ReaderWay way)
Special handling for ferry ways.
|
long |
getLong(long flags,
int key)
Returns arbitrary long value identified by the specified key.
|
double |
getMaxSpeed() |
protected double |
getMaxSpeed(ReaderWay way) |
protected String |
getPropertiesString() |
double |
getReverseSpeed(long flags) |
double |
getSpeed(long flags) |
double |
getTurnCost(long flags) |
long |
getTurnFlags(boolean restricted,
double costs) |
long |
handleNodeTags(ReaderNode node)
Parse tags on nodes.
|
abstract long |
handleRelationTags(ReaderRelation relation,
long oldRelationFlags)
Analyze the properties of a relation and create the routing flags for the second read step.
|
abstract long |
handleWayTags(ReaderWay way,
long allowed,
long relationFlags)
Analyze properties of a way and create the routing flags.
|
int |
hashCode() |
protected void |
init() |
protected boolean |
isAccept(long internalFlags) |
boolean |
isBackward(long flags)
Reports whether the edge is available in backward direction (i.e.
|
boolean |
isBlockFords() |
boolean |
isBool(long flags,
int key)
Returns arbitrary boolean value identified by the specified key.
|
protected boolean |
isFerry(long internalFlags) |
boolean |
isForward(long flags)
Reports whether the edge is available in forward direction (i.e.
|
boolean |
isRegistered() |
boolean |
isTurnRestricted(long flags) |
protected double |
parseSpeed(String str) |
long |
reverseFlags(long flags)
Swapping directions means swapping bits which are dependent on the direction of an edge like
the access bits.
|
long |
setAccess(long flags,
boolean forward,
boolean backward)
Sets the access of the edge.
|
void |
setBlockByDefault(boolean blockByDefault)
Should potential barriers block when no access limits are given?
|
void |
setBlockFords(boolean blockFords) |
long |
setBool(long flags,
int key,
boolean value) |
protected void |
setConditionalTagInspector(ConditionalTagInspector conditionalTagInspector) |
long |
setDouble(long flags,
int key,
double value) |
long |
setLong(long flags,
int key,
long value) |
protected long |
setLowSpeed(long flags,
double speed,
boolean reverse) |
long |
setProperties(double speed,
boolean forward,
boolean backward)
Sets speed and access properties.
|
void |
setRegistered(boolean registered) |
long |
setReverseSpeed(long flags,
double speed)
Sets the reverse speed in the flags.
|
long |
setSpeed(long flags,
double speed)
Sets the speed in km/h.
|
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 static final int K_FORWARD
protected static final int K_BACKWARD
protected final int speedBits
protected final double speedFactor
protected long forwardBit
protected long backwardBit
protected long directionBitMask
protected long roundaboutBit
protected EncodedDoubleValue speedEncoder
protected long acceptBit
protected long ferryBit
protected PMap properties
protected int maxPossibleSpeed
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 int defineWayBits(int index,
int shift)
shift - bit offset for the first bit used by this encoderpublic int defineRelationBits(int index,
int shift)
public abstract long handleRelationTags(ReaderRelation relation, long oldRelationFlags)
public abstract long acceptWay(ReaderWay way)
public abstract long handleWayTags(ReaderWay way, long allowed, long relationFlags)
public long handleNodeTags(ReaderNode node)
public InstructionAnnotation getAnnotation(long flags, Translation tr)
getAnnotation in interface FlagEncoderpublic long reverseFlags(long flags)
public long flagsDefault(boolean forward,
boolean backward)
public long setAccess(long flags,
boolean forward,
boolean backward)
FlagEncodersetAccess in interface FlagEncoderpublic long setSpeed(long flags,
double speed)
FlagEncodersetSpeed in interface FlagEncoderprotected long setLowSpeed(long flags,
double speed,
boolean reverse)
public double getSpeed(long flags)
getSpeed in interface FlagEncoderpublic long setReverseSpeed(long flags,
double speed)
FlagEncodersetReverseSpeed in interface FlagEncoderpublic double getReverseSpeed(long flags)
getReverseSpeed in interface FlagEncoderpublic long setProperties(double speed,
boolean forward,
boolean backward)
FlagEncodersetProperties in interface FlagEncoderpublic double getMaxSpeed()
getMaxSpeed in interface FlagEncoderprotected double getMaxSpeed(ReaderWay way)
protected 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 of costs
Double.POSITIVE_INFINITYcosts - the turn costs, specify 0 or Double.POSITIVE_INFINITY if restricted == true.
Only used if restricted == false.protected boolean isFerry(long internalFlags)
protected boolean isAccept(long internalFlags)
public boolean isBackward(long flags)
FlagEncoderisBackward in interface FlagEncoderpublic boolean isForward(long flags)
FlagEncoderisForward in interface FlagEncoderpublic long setBool(long flags,
int key,
boolean value)
setBool in interface FlagEncoderpublic boolean isBool(long flags,
int key)
FlagEncoderisBool in interface FlagEncoderpublic long setLong(long flags,
int key,
long value)
setLong in interface FlagEncoderpublic long getLong(long flags,
int key)
FlagEncodergetLong in interface FlagEncoderpublic long setDouble(long flags,
int key,
double value)
setDouble in interface FlagEncoderpublic double getDouble(long flags,
int key)
FlagEncodergetDouble in interface FlagEncoderprotected 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 boolean supports(Class<?> feature)
FlagEncodersupports in interface FlagEncoderCopyright © 2012–2018. All rights reserved.