public abstract class AbstractFlagEncoder extends Object implements FlagEncoder, TurnCostEncoder
EncodingManager
TurnCostEncoder.NoTurnCostsEncoder
Modifier and Type | Field and Description |
---|---|
protected Set<String> |
absoluteBarriers |
protected long |
acceptBit |
protected long |
backwardBit |
protected long |
directionBitMask |
protected EdgeExplorer |
edgeInExplorer |
protected EdgeExplorer |
edgeOutExplorer |
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, wait
getVersion
protected 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 EdgeExplorer edgeOutExplorer
protected EdgeExplorer edgeInExplorer
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 FlagEncoder
public 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 FlagEncoder
public long reverseFlags(long flags)
public long flagsDefault(boolean forward, boolean backward)
public long setAccess(long flags, boolean forward, boolean backward)
FlagEncoder
setAccess
in interface FlagEncoder
public long setSpeed(long flags, double speed)
FlagEncoder
setSpeed
in interface FlagEncoder
protected long setLowSpeed(long flags, double speed, boolean reverse)
public double getSpeed(long flags)
getSpeed
in interface FlagEncoder
public long setReverseSpeed(long flags, double speed)
FlagEncoder
setReverseSpeed
in interface FlagEncoder
public double getReverseSpeed(long flags)
getReverseSpeed
in interface FlagEncoder
public long setProperties(double speed, boolean forward, boolean backward)
FlagEncoder
setProperties
in interface FlagEncoder
public double getMaxSpeed()
getMaxSpeed
in interface FlagEncoder
protected 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 TurnCostEncoder
public double getTurnCost(long flags)
getTurnCost
in interface TurnCostEncoder
public long getTurnFlags(boolean restricted, double costs)
getTurnFlags
in interface TurnCostEncoder
restricted
- 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)
FlagEncoder
isBackward
in interface FlagEncoder
public boolean isForward(long flags)
FlagEncoder
isForward
in interface FlagEncoder
public long setBool(long flags, int key, boolean value)
setBool
in interface FlagEncoder
public boolean isBool(long flags, int key)
FlagEncoder
isBool
in interface FlagEncoder
public long setLong(long flags, int key, long value)
setLong
in interface FlagEncoder
public long getLong(long flags, int key)
FlagEncoder
getLong
in interface FlagEncoder
public long setDouble(long flags, int key, double value)
setDouble
in interface FlagEncoder
public double getDouble(long flags, int key)
FlagEncoder
getDouble
in interface FlagEncoder
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 boolean supports(Class<?> feature)
FlagEncoder
supports
in interface FlagEncoder
Copyright © 2012–2018. All rights reserved.