Interface EdgeIteratorState

All Known Subinterfaces:
AllEdgesIterator, EdgeIterator
All Known Implementing Classes:
BaseGraph.AllEdgeIterator, BaseGraph.EdgeIteratorImpl, VirtualEdgeIteratorState

public interface EdgeIteratorState
This interface represents an edge and is one possible state of an EdgeIterator. Example: EdgeExplorer expl = graph.createEdgeExplorer(); EdgeIterator iter = expl.setBaseNode(baseNode); while(iter.next()) { iter.getBaseBase() // equals to the specified baseNode }
Author:
Peter Karich
See Also:
  • Field Details

    • UNFAVORED_EDGE

      static final BooleanEncodedValue UNFAVORED_EDGE
    • REVERSE_STATE

      static final BooleanEncodedValue REVERSE_STATE
      This method can be used to fetch the internal reverse state of an edge.
  • Method Details

    • getEdge

      int getEdge()
      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

      int getEdgeKey()
      Returns the edge key of the current edge. The edge id can be derived from the edge key by calling GHUtility.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 using Graph.getEdgeIteratorStateForKey(int).
    • getReverseEdgeKey

      int getReverseEdgeKey()
      Like #getEdgeKey, but returns the reverse key.
    • getBaseNode

      int getBaseNode()
      Returns 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.
      Returns:
      the requested node itself
      See Also:
    • getAdjNode

      int getAdjNode()
      Returns:
      the adjacent node of baseNode for the current edge.
      See Also:
    • fetchWayGeometry

      PointList fetchWayGeometry(FetchMode mode)
      For 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.
      Parameters:
      mode - FetchMode
      Returns:
      the pillar and/or tower nodes depending on the mode.
    • setWayGeometry

      EdgeIteratorState setWayGeometry(PointList list)
      Parameters:
      list - 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, but if the distance changes, the setDistance method is not called automatically.
    • getDistance

      double getDistance()
      Returns:
      the distance of the current edge in meter
    • setDistance

      EdgeIteratorState setDistance(double dist)
    • getFlags

      IntsRef getFlags()
      Returns 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.
    • setFlags

      EdgeIteratorState setFlags(IntsRef edgeFlags)
      Stores the specified edgeFlags down to the DataAccess
    • get

      boolean get(BooleanEncodedValue property)
    • set

      EdgeIteratorState set(BooleanEncodedValue property, boolean value)
    • getReverse

      boolean getReverse(BooleanEncodedValue property)
    • setReverse

      EdgeIteratorState setReverse(BooleanEncodedValue property, boolean value)
    • set

      EdgeIteratorState set(BooleanEncodedValue property, boolean fwd, boolean bwd)
    • get

      int get(IntEncodedValue property)
    • set

      EdgeIteratorState set(IntEncodedValue property, int value)
    • getReverse

      int getReverse(IntEncodedValue property)
    • setReverse

      EdgeIteratorState setReverse(IntEncodedValue property, int value)
    • set

      EdgeIteratorState set(IntEncodedValue property, int fwd, int bwd)
    • get

      double get(DecimalEncodedValue property)
    • set

      EdgeIteratorState set(DecimalEncodedValue property, double value)
    • getReverse

      double getReverse(DecimalEncodedValue property)
    • setReverse

      EdgeIteratorState setReverse(DecimalEncodedValue property, double value)
    • set

      EdgeIteratorState set(DecimalEncodedValue property, double fwd, double bwd)
    • get

      <T extends Enum<?>> T get(EnumEncodedValue<T> property)
    • set

      <T extends Enum<?>> EdgeIteratorState set(EnumEncodedValue<T> property, T value)
    • getReverse

      <T extends Enum<?>> T getReverse(EnumEncodedValue<T> property)
    • setReverse

      <T extends Enum<?>> EdgeIteratorState setReverse(EnumEncodedValue<T> property, T value)
    • set

      <T extends Enum<?>> EdgeIteratorState set(EnumEncodedValue<T> property, T fwd, T bwd)
    • get

      String get(StringEncodedValue property)
    • set

    • getReverse

      String getReverse(StringEncodedValue property)
    • setReverse

      EdgeIteratorState setReverse(StringEncodedValue property, String value)
    • set

    • getName

      String getName()
      Identical 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.
      Returns:
      the stored value for the key "name" in the KeyValue list of this EdgeIteratorState.
    • setKeyValues

      This 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.
    • getKeyValues

      List<KVStorage.KeyValue> getKeyValues()
      This method returns KeyValue pairs for both directions in contrast to getValue(String).
      See Also:
    • getValue

      Object getValue(String key)
      This 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 also 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.
    • detach

      EdgeIteratorState detach(boolean reverse)
      Clones this EdgeIteratorState.
      Parameters:
      reverse - 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.
    • copyPropertiesFrom

      EdgeIteratorState copyPropertiesFrom(EdgeIteratorState e)
      Copies the properties of the specified edge into this edge. Does not change nodes!
      Returns:
      the specified edge e