com.graphhopper.routing.util

Class AbstractFlagEncoder

    • Field Detail

      • forwardBit

        protected long forwardBit
      • backwardBit

        protected long backwardBit
      • directionBitMask

        protected long directionBitMask
      • roundaboutBit

        protected long roundaboutBit
      • acceptBit

        protected long acceptBit
      • ferryBit

        protected long ferryBit
      • properties

        protected PMap properties
      • maxPossibleSpeed

        protected int maxPossibleSpeed
      • restrictions

        protected final List<String> restrictions
      • intendedValues

        protected final Set<String> intendedValues
      • restrictedValues

        protected final Set<String> restrictedValues
      • absoluteBarriers

        protected final Set<String> absoluteBarriers
      • potentialBarriers

        protected final Set<String> potentialBarriers
      • speedBits

        protected final int speedBits
      • speedFactor

        protected final double speedFactor
    • Constructor Detail

      • AbstractFlagEncoder

        public AbstractFlagEncoder(PMap properties)
      • AbstractFlagEncoder

        public AbstractFlagEncoder(String propertiesStr)
      • AbstractFlagEncoder

        protected AbstractFlagEncoder(int speedBits,                              double speedFactor,                              int maxTurnCosts)
        Parameters:
        speedBits - specify the number of bits used for speed
        speedFactor - 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.
    • Method Detail

      • setRegistered

        public void setRegistered(boolean registered)
      • isRegistered

        public boolean isRegistered()
        Specified by:
        isRegistered in interface FlagEncoder
        Returns:
        true if already registered in an EncodingManager
      • setBlockByDefault

        public void setBlockByDefault(boolean blockByDefault)
        Should potential barriers block when no access limits are given?
      • setBlockFords

        public void setBlockFords(boolean blockFords)
      • isBlockFords

        public boolean isBlockFords()
      • defineNodeBits

        public int defineNodeBits(int index,                          int shift)
        Defines the bits for the node flags, which are currently used for barriers only.

        Returns:
        incremented shift value pointing behind the last used bit
      • defineWayBits

        public int defineWayBits(int index,                         int shift)
        Defines bits used for edge flags used for access, speed etc.

        Parameters:
        shift - bit offset for the first bit used by this encoder
        Returns:
        incremented shift value pointing behind the last used bit
      • defineRelationBits

        public int defineRelationBits(int index,                              int shift)
        Defines the bits which are used for relation flags.

        Returns:
        incremented shift value pointing behind the last used bit
      • handleRelationTags

        public abstract long handleRelationTags(OSMRelation relation,                                        long oldRelationFlags)
        Analyze the properties of a relation and create the routing flags for the second read step. In the pre-parsing step this method will be called to determine the useful relation tags.

      • acceptWay

        public abstract long acceptWay(OSMWay way)
        Decide whether a way is routable for a given mode of travel. This skips some ways before handleWayTags is called.

        Returns:
        the encoded value to indicate if this encoder allows travel or not.
      • handleWayTags

        public abstract long handleWayTags(OSMWay way,                                   long allowed,                                   long relationFlags)
        Analyze properties of a way and create the routing flags. This method is called in the second parsing step.
      • handleNodeTags

        public long handleNodeTags(OSMNode node)
        Parse tags on nodes. Node tags can add to speed (like traffic_signals) where the value is strict negative or blocks access (like a barrier), then the value is strict positive.This method is called in the second parsing step.
      • reverseFlags

        public long reverseFlags(long flags)
        Swapping directions means swapping bits which are dependent on the direction of an edge like the access bits. But also direction dependent speed values should be swapped too. Keep in mind that this method is performance critical!
      • flagsDefault

        public long flagsDefault(boolean forward,                         boolean backward)
        Sets default flags with specified access.
      • setAccess

        public long setAccess(long flags,                      boolean forward,                      boolean backward)
        Description copied from interface: FlagEncoder
        Sets the access of the edge.

        Specified by:
        setAccess in interface FlagEncoder
        Returns:
        modified flags
      • setSpeed

        public long setSpeed(long flags,                     double speed)
        Description copied from interface: FlagEncoder
        Sets the speed in km/h.

        Specified by:
        setSpeed in interface FlagEncoder
        Returns:
        modified setProperties
      • setLowSpeed

        protected long setLowSpeed(long flags,                           double speed,                           boolean reverse)
      • getSpeed

        public double getSpeed(long flags)
        Specified by:
        getSpeed in interface FlagEncoder
        Returns:
        the speed in km/h for this direction, for backward direction use getReverseSpeed
      • setReverseSpeed

        public long setReverseSpeed(long flags,                            double speed)
        Description copied from interface: FlagEncoder
        Sets the reverse speed in the flags.
        Specified by:
        setReverseSpeed in interface FlagEncoder
      • getReverseSpeed

        public double getReverseSpeed(long flags)
        Specified by:
        getReverseSpeed in interface FlagEncoder
        Returns:
        the speed of the reverse direction in km/h
      • setProperties

        public long setProperties(double speed,                          boolean forward,                          boolean backward)
        Description copied from interface: FlagEncoder
        Sets speed and access properties.

        Specified by:
        setProperties in interface FlagEncoder
        Returns:
        created flags
      • getMaxSpeed

        public double getMaxSpeed()
        Specified by:
        getMaxSpeed in interface FlagEncoder
        Returns:
        the maximum speed in km/h
      • getMaxSpeed

        protected double getMaxSpeed(OSMWay way)
        Returns:
        -1 if no maxspeed found
      • parseSpeed

        protected double parseSpeed(String str)
        Returns:
        the speed in km/h
      • applyWayTags

        public void applyWayTags(OSMWay way,                         EdgeIteratorState edge)
        Second parsing step. Invoked after splitting the edges. Currently used to offer a hook to calculate precise speed values based on elevation data stored in the specified edge.
      • getFerrySpeed

        protected double getFerrySpeed(OSMWay way,                               double unknownSpeed,                               double shortTripsSpeed,                               double longTripsSpeed)
        Special handling for ferry ways.
      • defineTurnBits

        public int defineTurnBits(int index,                          int shift)
        Defines the bits reserved for storing turn restriction and turn cost

        Parameters:
        shift - bit offset for the first bit used by this encoder
        Returns:
        incremented shift value pointing behind the last used bit
      • isTurnRestricted

        public boolean isTurnRestricted(long flags)
        Specified by:
        isTurnRestricted in interface TurnCostEncoder
        Returns:
        true, if the turn restriction is encoded in the specified flags
      • getTurnCost

        public double getTurnCost(long flags)
        Specified by:
        getTurnCost in interface TurnCostEncoder
        Returns:
        the costs encoded in the specified flag, if restricted it will be Double.POSITIVE_INFINITY
      • getTurnFlags

        public long getTurnFlags(boolean restricted,                         double costs)
        Specified by:
        getTurnFlags in interface TurnCostEncoder
        Parameters:
        restricted - true if restricted turn, equivalent to specifying of costs Double.POSITIVE_INFINITY
        costs - the turn costs, specify 0 or Double.POSITIVE_INFINITY if restricted == true. Only used if restricted == false.
        Returns:
        the encoded flags
      • isFerry

        protected boolean isFerry(long internalFlags)
      • isAccept

        protected boolean isAccept(long internalFlags)
      • isBackward

        public boolean isBackward(long flags)
        Description copied from interface: FlagEncoder
        Reports whether the edge is available in backward direction for a certain vehicle
        Specified by:
        isBackward in interface FlagEncoder
      • isForward

        public boolean isForward(long flags)
        Description copied from interface: FlagEncoder
        Reports whether the edge is available in forward direction for a certain vehicle
        Specified by:
        isForward in interface FlagEncoder
      • setBool

        public long setBool(long flags,                    int key,                    boolean value)
        Specified by:
        setBool in interface FlagEncoder
      • isBool

        public boolean isBool(long flags,                      int key)
        Description copied from interface: FlagEncoder
        Returns arbitrary boolean value identified by the specified key.
        Specified by:
        isBool in interface FlagEncoder
      • setLong

        public long setLong(long flags,                    int key,                    long value)
        Specified by:
        setLong in interface FlagEncoder
      • getLong

        public long getLong(long flags,                    int key)
        Description copied from interface: FlagEncoder
        Returns arbitrary long value identified by the specified key. E.g. can be used to return the way or surface type of an edge
        Specified by:
        getLong in interface FlagEncoder
      • setDouble

        public long setDouble(long flags,                      int key,                      double value)
        Specified by:
        setDouble in interface FlagEncoder
      • getDouble

        public double getDouble(long flags,                        int key)
        Description copied from interface: FlagEncoder
        Returns arbitrary double value identified by the specified key. E.g. can be used to return the maximum width or height allowed for an edge.
        Specified by:
        getDouble in interface FlagEncoder
      • applyMaxSpeed

        protected double applyMaxSpeed(OSMWay way,                               double speed)
        Parameters:
        way: - needed to retrieve OSM tags
        speed: - speed guessed e.g. from the road type or other tags
        Returns:
        The assumed speed.
      • getPropertiesString

        protected String getPropertiesString()
      • supports

        public boolean supports(Class<?> feature)
        Description copied from interface: FlagEncoder
        Returns true if the feature class is supported like TurnWeighting or PriorityWeighting.
        Specified by:
        supports in interface FlagEncoder

Copyright © 2012–2016. All rights reserved.



NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14