Package com.graphhopper.storage
Class BaseGraph.AllEdgeIterator
java.lang.Object
com.graphhopper.storage.BaseGraph.AllEdgeIterator
- All Implemented Interfaces:
AllEdgesIterator,EdgeIterator,EdgeIteratorState
- Enclosing class:
BaseGraph
Include all edges of this storage in the iterator.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.graphhopper.util.EdgeIterator
EdgeIterator.Edge -
Field Summary
Fields inherited from interface com.graphhopper.util.EdgeIterator
ANY_EDGE, NO_EDGEFields inherited from interface com.graphhopper.util.EdgeIteratorState
REVERSE_STATE, UNFAVORED_EDGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal EdgeIteratorStateCopies the properties of the specified edge into this edge.final EdgeIteratorStatedetach(boolean reverseArg) Clones this EdgeIteratorState.fetchWayGeometry(FetchMode mode) For road network data like OSM a way is often not just a straight line.booleanget(BooleanEncodedValue property) doubleget(DecimalEncodedValue property) <T extends Enum<?>>
Tget(EnumEncodedValue<T> property) intget(IntEncodedValue property) get(StringEncodedValue property) final intfinal intReturns the node used to instantiate the EdgeIterator.doubleintgetEdge()intReturns the edge key of the current edge.getFlags()Returns edge properties stored in direction of the raw database layout.This method returns KeyValue pairs for both directions in contrast toEdgeIteratorState.getValue(String).getName()Identical to calling getKeyValues().get("name") if name is stored for both directions.booleangetReverse(BooleanEncodedValue property) doublegetReverse(DecimalEncodedValue property) <T extends Enum<?>>
TgetReverse(EnumEncodedValue<T> property) intgetReverse(IntEncodedValue property) getReverse(StringEncodedValue property) intLike #getEdgeKey, but returns the reverse key.This method returns the *first* value for the specified key and only if stored for the direction of this EdgeIteratorState.intlength()booleannext()To be called to go to the next edge state.set(BooleanEncodedValue property, boolean value) set(BooleanEncodedValue property, boolean fwd, boolean bwd) set(DecimalEncodedValue property, double value) set(DecimalEncodedValue property, double fwd, double bwd) <T extends Enum<?>>
EdgeIteratorStateset(EnumEncodedValue<T> property, T value) <T extends Enum<?>>
EdgeIteratorStateset(EnumEncodedValue<T> property, T fwd, T bwd) set(IntEncodedValue property, int value) set(IntEncodedValue property, int fwd, int bwd) set(StringEncodedValue property, String value) set(StringEncodedValue property, String fwd, String bwd) setDistance(double dist) final EdgeIteratorStateStores the specified edgeFlags down to the DataAccesssetKeyValues(Map<String, KVStorage.KValue> entries) This stores the specified key-value pairs in the storage of this EdgeIteratorState.setReverse(BooleanEncodedValue property, boolean value) setReverse(DecimalEncodedValue property, double value) <T extends Enum<?>>
EdgeIteratorStatesetReverse(EnumEncodedValue<T> property, T value) setReverse(IntEncodedValue property, int value) setReverse(StringEncodedValue property, String value) setWayGeometry(PointList pillarNodes) final StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.graphhopper.util.EdgeIteratorState
copyPropertiesFrom, fetchWayGeometry, get, get, get, get, get, getAdjNode, getBaseNode, getDistance, getEdge, getEdgeKey, getFlags, getKeyValues, getName, getReverse, getReverse, getReverse, getReverse, getReverse, getReverseEdgeKey, getValue, set, set, set, set, set, set, set, set, set, set, setDistance, setFlags, setKeyValues, setReverse, setReverse, setReverse, setReverse, setReverse, setWayGeometry
-
Constructor Details
-
AllEdgeIterator
-
-
Method Details
-
length
public int length()- Specified by:
lengthin interfaceAllEdgesIterator- Returns:
- the maximum edgeId in the graph plus 1
-
next
public boolean next()Description copied from interface:EdgeIteratorTo be called to go to the next edge state.- Specified by:
nextin interfaceEdgeIterator- Returns:
- true if an edge state is available
-
detach
Description copied from interface:EdgeIteratorStateClones this EdgeIteratorState.- Specified by:
detachin interfaceEdgeIteratorState- Parameters:
reverseArg- if true a detached edgeState with reversed properties is created where base and adjacent nodes, flags and wayGeometry are in reversed order. See #162 for more details about why we need the reverse parameter.
-
getBaseNode
public final int getBaseNode()Description copied from interface:EdgeIteratorStateReturns the node used to instantiate the EdgeIterator. Often only used for convenience reasons. Do not confuse this with a source node of a directed edge.- Specified by:
getBaseNodein interfaceEdgeIteratorState- Returns:
- the requested node itself
- See Also:
-
getAdjNode
public final int getAdjNode()- Specified by:
getAdjNodein interfaceEdgeIteratorState- Returns:
- the adjacent node of baseNode for the current edge.
- See Also:
-
getDistance
public double getDistance()- Specified by:
getDistancein interfaceEdgeIteratorState- Returns:
- the distance of the current edge in meter
-
setDistance
- Specified by:
setDistancein interfaceEdgeIteratorState
-
getFlags
Description copied from interface:EdgeIteratorStateReturns edge properties stored in direction of the raw database layout. So do not use it directly, instead use the appropriate set/get methods with its EncodedValue object.- Specified by:
getFlagsin interfaceEdgeIteratorState
-
setFlags
Description copied from interface:EdgeIteratorStateStores the specified edgeFlags down to the DataAccess- Specified by:
setFlagsin interfaceEdgeIteratorState
-
get
- Specified by:
getin interfaceEdgeIteratorState
-
set
- Specified by:
setin interfaceEdgeIteratorState
-
getReverse
- Specified by:
getReversein interfaceEdgeIteratorState
-
setReverse
- Specified by:
setReversein interfaceEdgeIteratorState
-
set
- Specified by:
setin interfaceEdgeIteratorState
-
get
- Specified by:
getin interfaceEdgeIteratorState
-
set
- Specified by:
setin interfaceEdgeIteratorState
-
getReverse
- Specified by:
getReversein interfaceEdgeIteratorState
-
setReverse
- Specified by:
setReversein interfaceEdgeIteratorState
-
set
- Specified by:
setin interfaceEdgeIteratorState
-
get
- Specified by:
getin interfaceEdgeIteratorState
-
set
- Specified by:
setin interfaceEdgeIteratorState
-
getReverse
- Specified by:
getReversein interfaceEdgeIteratorState
-
setReverse
- Specified by:
setReversein interfaceEdgeIteratorState
-
set
- Specified by:
setin interfaceEdgeIteratorState
-
get
- Specified by:
getin interfaceEdgeIteratorState
-
set
- Specified by:
setin interfaceEdgeIteratorState
-
getReverse
- Specified by:
getReversein interfaceEdgeIteratorState
-
setReverse
- Specified by:
setReversein interfaceEdgeIteratorState
-
set
- Specified by:
setin interfaceEdgeIteratorState
-
get
- Specified by:
getin interfaceEdgeIteratorState
-
set
- Specified by:
setin interfaceEdgeIteratorState
-
getReverse
- Specified by:
getReversein interfaceEdgeIteratorState
-
setReverse
- Specified by:
setReversein interfaceEdgeIteratorState
-
set
- Specified by:
setin interfaceEdgeIteratorState
-
copyPropertiesFrom
Description copied from interface:EdgeIteratorStateCopies the properties of the specified edge into this edge. Does not change nodes!- Specified by:
copyPropertiesFromin interfaceEdgeIteratorState- Returns:
- the specified edge e
-
setWayGeometry
- Specified by:
setWayGeometryin interfaceEdgeIteratorState- Parameters:
pillarNodes- is a sorted collection of coordinates between the base node and the current adjacent node. Specify the list without the adjacent and base node. This method can be called multiple times, unless the given point list is longer than the first time the method was called. Also keep in mind that if the distance changes the setDistance method is not called automatically.
-
fetchWayGeometry
Description copied from interface:EdgeIteratorStateFor road network data like OSM a way is often not just a straight line. The nodes between the junction nodes are called pillar nodes. The junction nodes are called tower nodes and used for routing. The pillar nodes are necessary to have an exact geometry. See the docs for more information (docs/core/low-level-api.md#what-are-pillar-and-tower-nodes). Updates to the returned list are not reflected in the graph, for that you've to use setWayGeometry.- Specified by:
fetchWayGeometryin interfaceEdgeIteratorState- Parameters:
mode-FetchMode- Returns:
- the pillar and/or tower nodes depending on the mode.
-
getEdge
public int getEdge()- Specified by:
getEdgein interfaceEdgeIteratorState- Returns:
- the edge id of the current edge. Do not make any assumptions about the concrete values, except that for an implementation it is recommended that they'll be contiguous.
-
getEdgeKey
public int getEdgeKey()Description copied from interface:EdgeIteratorStateReturns the edge key of the current edge. The edge id can be derived from the edge key by callingGHUtility.getEdgeFromEdgeKey(int), but the edge key also contains information about the direction of the edge. The edge key is even when the edge is oriented in storage direction and odd otherwise. You can use the edge key to retrieve an edge state in the associated direction usingGraph.getEdgeIteratorStateForKey(int).- Specified by:
getEdgeKeyin interfaceEdgeIteratorState
-
getReverseEdgeKey
public int getReverseEdgeKey()Description copied from interface:EdgeIteratorStateLike #getEdgeKey, but returns the reverse key.- Specified by:
getReverseEdgeKeyin interfaceEdgeIteratorState
-
setKeyValues
Description copied from interface:EdgeIteratorStateThis stores the specified key-value pairs in the storage of this EdgeIteratorState. This is more flexible compared to the mechanism of flags and EncodedValue and allows storing sparse key value pairs more efficient. But it might be slow and more inefficient on retrieval. Call this setKeyValues method only once per EdgeIteratorState as it allocates new space everytime this method is called.- Specified by:
setKeyValuesin interfaceEdgeIteratorState
-
getKeyValues
Description copied from interface:EdgeIteratorStateThis method returns KeyValue pairs for both directions in contrast toEdgeIteratorState.getValue(String).- Specified by:
getKeyValuesin interfaceEdgeIteratorState- See Also:
-
getValue
Description copied from interface:EdgeIteratorStateThis method returns the *first* value for the specified key and only if stored for the direction of this EdgeIteratorState. If you need more than one value see alsoEdgeIteratorState.getKeyValues(). Avoid storing KeyPairs with duplicate keys as only the first will be reachable with this method. Currently, there is no support to use this method in a custom_model, and you should use EncodedValues instead.- Specified by:
getValuein interfaceEdgeIteratorState
-
getName
Description copied from interface:EdgeIteratorStateIdentical to calling getKeyValues().get("name") if name is stored for both directions. Note that for backward compatibility this method returns an empty String instead of null if there was no KeyPair with key==name stored.- Specified by:
getNamein interfaceEdgeIteratorState- Returns:
- the stored value for the key "name" in the KeyValue list of this EdgeIteratorState.
-
toString
-