Class GraphPath<S>

java.lang.Object
org.opentrafficsim.draw.graphs.AbstractGraphSpace<S>
org.opentrafficsim.draw.graphs.GraphPath<S>
Type Parameters:
S - underlying type of path sections
All Implemented Interfaces:
Iterable<S>

public class GraphPath<S> extends AbstractGraphSpace<S>
A GraphPath defines the spatial dimension of graphs. It has a number of sections, each of which may have one or more source objects depending on the number of series. For example, a 3-lane road may result in a few sections each having 3 series. Graphs can aggregate the series, or show multiple series.

Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.

Author:
Alexander Verbraeck, Peter Knoppers, Wouter Schakel
  • Constructor Details

    • GraphPath

      public GraphPath(String name, List<GraphPath.Section<S>> sections)
      Constructor for a one-series path.
      Parameters:
      name - String; name
      sections - List<Section<S>>; sections
    • GraphPath

      public GraphPath(List<String> seriesNames, List<GraphPath.Section<S>> sections)
      Constructor.
      Parameters:
      seriesNames - List<String>; names of series
      sections - List<Section<S>>; sections
  • Method Details

    • getStartDistance

      public org.djunits.value.vdouble.scalar.Length getStartDistance(GraphPath.Section<?> section)
      Returns the start distance of the section.
      Parameters:
      section - Section<?> section
      Returns:
      Length; start distance of the section
    • getTotalLength

      public org.djunits.value.vdouble.scalar.Length getTotalLength()
      Returns the total path length.
      Returns:
      Length; total path length
    • getSpeedLimit

      public org.djunits.value.vdouble.scalar.Speed getSpeedLimit()
      Returns the mean speed over the entire section.
      Returns:
      Speed; mean speed over the entire section
    • get

      public GraphPath.Section<S> get(int index)
      Returns a section.
      Parameters:
      index - int; index of section
      Returns:
      Section<S>; section
    • iterator

      public Iterator<S> iterator()
    • iterator

      public Iterator<S> iterator(int series)
      Returns an iterator over the sources on the given series.
      Specified by:
      iterator in class AbstractGraphSpace<S>
      Parameters:
      series - int; number of the series
      Returns:
      Iterator<S>; iterator over the sources on the given series
    • getSections

      public org.djutils.immutablecollections.ImmutableList<GraphPath.Section<S>> getSections()
      Returns an immutable list of the sections.
      Returns:
      ImmutableList<Section<S>>; sections
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • initRecording

      public static <L extends LaneData<L>> void initRecording(Sampler<?,L> sampler, GraphPath<L> path)
      Start recording along path.
      Type Parameters:
      L - lane data type
      Parameters:
      sampler - Sampler<?, L>; sampler
      path - GraphPath<L>; path