public class Graph extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Graph.LoadLevel |
Modifier and Type | Field and Description |
---|---|
Map<TraverseMode,Integer> |
alightTimes
Has information how much time alighting a vehicle takes.
|
Map<TraverseMode,Integer> |
boardTimes
Has information how much time boarding a vehicle takes.
|
String |
builderConfig
The config JSON used to build this graph.
|
Date |
buildTime |
org.joda.time.DateTime |
buildTimeJoda |
Deduplicator |
deduplicator |
Double |
ellipsoidToGeoidDifference
The difference in meters between the WGS84 ellipsoid height and geoid height at the graph's center
|
boolean |
hasBikeRide |
boolean |
hasBikeSharing |
boolean |
hasDirectTransfers
True if direct single-edge transfers were generated between transit stops in this Graph.
|
boolean |
hasFrequencyService
True if frequency-based services exist in this Graph (GTFS frequencies with exact_times = 0).
|
boolean |
hasParkRide |
boolean |
hasScheduledService
True if schedule-based services exist in this Graph (including GTFS frequencies with exact_times = 1).
|
boolean |
hasStreets
True if OSM data was loaded into this Graph.
|
boolean |
hasTransit
True if GTFS data was loaded into this Graph.
|
GraphIndex |
index |
Map<org.onebusaway.gtfs.model.AgencyAndId,org.onebusaway.gtfs.model.Stop> |
parentStopById
Parent stops
|
Preferences |
preferences |
String |
routerConfig
Embed a router configuration inside the graph, for starting up with a single file.
|
String |
routerId |
Map<org.onebusaway.gtfs.model.AgencyAndId,Integer> |
serviceCodes
Map from GTFS ServiceIds to integers close to 0.
|
StopClusterMode |
stopClusterMode
How should we cluster stops? By 'proximity' or 'ParentStation'
|
StreetVertexIndexService |
streetIndex |
StreetNotesService |
streetNotesService |
StreetSpeedSnapshotSource |
streetSpeedSource
A speed source for traffic data
|
TimetableSnapshotSource |
timetableSnapshotSource |
GraphUpdaterManager |
updaterManager
Manages all updaters of this graph.
|
Modifier and Type | Method and Description |
---|---|
void |
addAgency(String feedId,
org.onebusaway.gtfs.model.Agency agency) |
void |
addAlertPatch(Edge edge,
AlertPatch alertPatch)
|
String |
addBuilderAnnotation(GraphBuilderAnnotation gba)
Add a graph builder annotation to this graph's list of graph builder annotations.
|
void |
addFeedInfo(org.onebusaway.gtfs.model.FeedInfo info) |
void |
addTransitMode(TraverseMode mode)
Adds mode of transport to transit modes in graph
|
void |
addTurnRestriction(Edge edge,
TurnRestriction turnRestriction)
|
void |
addVertex(Vertex v)
Add the given vertex to the graph.
|
void |
calculateConvexHull()
Calculates convexHull of all the vertices during build time
|
void |
calculateEnvelope()
Calculates envelope out of all OSM coordinates
Transit stops are added to the envelope as they are added to the graph
|
void |
calculateTransitCenter()
Calculates Transit center from median of coordinates of all transitStops if graph
has transit.
|
void |
clearTimeZone()
The timezone is cached by the graph.
|
boolean |
containsVertex(Vertex v) |
int |
countEdges()
Find the total number of edges in this Graph.
|
int |
countVertices() |
void |
expandToInclude(double x,
double y)
Expands envelope to include given point
If envelope is empty it creates it (This can happen with a graph without OSM data)
Used when adding stops to OSM envelope
|
Collection<org.onebusaway.gtfs.model.Agency> |
getAgencies(String feedId) |
AlertPatch[] |
getAlertPatches(Edge edge)
|
List<GraphBuilderAnnotation> |
getBuilderAnnotations() |
GraphBundle |
getBundle() |
org.onebusaway.gtfs.services.calendar.CalendarService |
getCalendarService() |
Optional<com.vividsolutions.jts.geom.Coordinate> |
getCenter() |
com.vividsolutions.jts.geom.Geometry |
getConvexHull() |
Edge |
getEdgeById(int id)
Returns the edge with the given ID or null if none is present.
|
Collection<Edge> |
getEdges()
Return all the edges in the graph.
|
WorldEnvelope |
getEnvelope() |
com.vividsolutions.jts.geom.Envelope |
getExtent() |
Collection<String> |
getFeedIds() |
org.onebusaway.gtfs.model.FeedInfo |
getFeedInfo(String feedId) |
GeometryIndex |
getGeomIndex() |
Integer |
getIdForEdge(Edge edge) |
SampleFactory |
getSampleFactory() |
<T> T |
getService(Class<T> serviceType) |
<T> T |
getService(Class<T> serviceType,
boolean autoCreate) |
Collection<StreetEdge> |
getStreetEdges()
Return only the StreetEdges in the graph.
|
TimeZone |
getTimeZone()
Returns the time zone for the first agency in this graph.
|
TransferTable |
getTransferTable() |
HashSet<TraverseMode> |
getTransitModes() |
long |
getTransitServiceEnds() |
long |
getTransitServiceStarts() |
List<TurnRestriction> |
getTurnRestrictions(Edge edge)
|
Vertex |
getVertex(String label) |
Vertex |
getVertexById(int id)
Returns the vertex with the given ID or null if none is present.
|
Collection<Vertex> |
getVertices()
Get all the vertices in the graph.
|
boolean |
hasService(Class<?> serviceType) |
void |
index(StreetVertexIndexFactory indexFactory)
Perform indexing on vertices, edges, and timetables, and create transient data structures.
|
static Graph |
load(ClassLoader classLoader,
File file,
Graph.LoadLevel level) |
static Graph |
load(File file,
Graph.LoadLevel level) |
static Graph |
load(InputStream is,
Graph.LoadLevel level) |
static Graph |
load(ObjectInputStream in,
Graph.LoadLevel level)
Default load.
|
static Graph |
load(ObjectInputStream in,
Graph.LoadLevel level,
StreetVertexIndexFactory indexFactory)
Loading which allows you to specify StreetVertexIndexFactory and inject other implementation.
|
<T> T |
putService(Class<T> serviceType,
T service) |
void |
rebuildVertexAndEdgeIndices()
Rebuilds any indices on the basis of current vertex and edge IDs.
|
void |
remove(Vertex vertex) |
void |
removeAlertPatch(Edge edge,
AlertPatch alertPatch)
|
void |
removeEdge(Edge e)
Removes an edge from the graph.
|
int |
removeEdgelessVertices() |
void |
removeTurnRestriction(Edge edge,
TurnRestriction turnRestriction)
|
void |
removeVertex(Vertex v)
Removes a vertex from the graph.
|
void |
removeVertexAndEdges(Vertex vertex) |
void |
save(File file) |
void |
save(ObjectOutputStream out) |
void |
setBundle(GraphBundle bundle) |
void |
summarizeBuilderAnnotations() |
boolean |
transitFeedCovers(long t) |
void |
updateTransitFeedValidity(org.onebusaway.gtfs.model.calendar.CalendarServiceData data) |
public String routerId
public final StreetNotesService streetNotesService
public transient StreetVertexIndexService streetIndex
public transient GraphIndex index
public final Deduplicator deduplicator
public final Map<org.onebusaway.gtfs.model.AgencyAndId,Integer> serviceCodes
public transient TimetableSnapshotSource timetableSnapshotSource
public String builderConfig
public String routerConfig
public Preferences preferences
public org.joda.time.DateTime buildTimeJoda
public boolean hasBikeSharing
public boolean hasParkRide
public boolean hasBikeRide
public transient GraphUpdaterManager updaterManager
GraphUpdaterConfigurator
public final Date buildTime
public boolean hasStreets
public boolean hasTransit
public boolean hasDirectTransfers
public boolean hasFrequencyService
public boolean hasScheduledService
public Map<TraverseMode,Integer> boardTimes
public Map<TraverseMode,Integer> alightTimes
public transient StreetSpeedSnapshotSource streetSpeedSource
public StopClusterMode stopClusterMode
public Double ellipsoidToGeoidDifference
public Map<org.onebusaway.gtfs.model.AgencyAndId,org.onebusaway.gtfs.model.Stop> parentStopById
public Graph(Graph basedOn)
public Graph()
public void addVertex(Vertex v)
public void removeVertex(Vertex v)
v
- public void removeEdge(Edge e)
e
- The edge to be removedpublic Vertex getVertexById(int id)
id
- public Collection<Vertex> getVertices()
public Edge getEdgeById(int id)
id
- public Collection<Edge> getEdges()
public void addAlertPatch(Edge edge, AlertPatch alertPatch)
edge
- alertPatch
- public void removeAlertPatch(Edge edge, AlertPatch alertPatch)
edge
- alertPatch
- public AlertPatch[] getAlertPatches(Edge edge)
edge
- AlertPatch
array that belongs to the Edge
public void addTurnRestriction(Edge edge, TurnRestriction turnRestriction)
TurnRestriction
to the TurnRestriction
List
belonging to an
Edge
. This method is not thread-safe.edge
- turnRestriction
- public void removeTurnRestriction(Edge edge, TurnRestriction turnRestriction)
TurnRestriction
from the TurnRestriction
List
belonging to
an Edge
. This method is not thread-safe.edge
- turnRestriction
- public List<TurnRestriction> getTurnRestrictions(Edge edge)
TurnRestriction
List
that belongs to an Edge
and return an
immutable copy. This method is thread-safe when used by itself, but not if addTurnRestriction
or removeTurnRestriction is called concurrently.edge
- TurnRestriction
List
that belongs to the Edge
public Collection<StreetEdge> getStreetEdges()
public boolean containsVertex(Vertex v)
public <T> T putService(Class<T> serviceType, T service)
public boolean hasService(Class<?> serviceType)
public <T> T getService(Class<T> serviceType)
public <T> T getService(Class<T> serviceType, boolean autoCreate)
public void remove(Vertex vertex)
public void removeVertexAndEdges(Vertex vertex)
public com.vividsolutions.jts.geom.Envelope getExtent()
public TransferTable getTransferTable()
public void updateTransitFeedValidity(org.onebusaway.gtfs.model.calendar.CalendarServiceData data)
public boolean transitFeedCovers(long t)
public GraphBundle getBundle()
public void setBundle(GraphBundle bundle)
public int countVertices()
public int countEdges()
public void rebuildVertexAndEdgeIndices()
public String addBuilderAnnotation(GraphBuilderAnnotation gba)
public List<GraphBuilderAnnotation> getBuilderAnnotations()
public void addTransitMode(TraverseMode mode)
mode
- public HashSet<TraverseMode> getTransitModes()
public static Graph load(File file, Graph.LoadLevel level) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static Graph load(ClassLoader classLoader, File file, Graph.LoadLevel level) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static Graph load(InputStream is, Graph.LoadLevel level) throws ClassNotFoundException, IOException
ClassNotFoundException
IOException
public static Graph load(ObjectInputStream in, Graph.LoadLevel level) throws IOException, ClassNotFoundException
in
- level
- IOException
ClassNotFoundException
public void index(StreetVertexIndexFactory indexFactory)
public static Graph load(ObjectInputStream in, Graph.LoadLevel level, StreetVertexIndexFactory indexFactory) throws IOException, ClassNotFoundException
in
- level
- indexFactory
- IOException
ClassNotFoundException
public void save(File file) throws IOException
IOException
public void save(ObjectOutputStream out) throws IOException
IOException
public org.onebusaway.gtfs.services.calendar.CalendarService getCalendarService()
public int removeEdgelessVertices()
public Collection<String> getFeedIds()
public Collection<org.onebusaway.gtfs.model.Agency> getAgencies(String feedId)
public org.onebusaway.gtfs.model.FeedInfo getFeedInfo(String feedId)
public void addAgency(String feedId, org.onebusaway.gtfs.model.Agency agency)
public void addFeedInfo(org.onebusaway.gtfs.model.FeedInfo info)
public TimeZone getTimeZone()
public void clearTimeZone()
public void summarizeBuilderAnnotations()
public void calculateEnvelope()
public void calculateConvexHull()
public com.vividsolutions.jts.geom.Geometry getConvexHull()
public void expandToInclude(double x, double y)
x
- the value to lower the minimum x to or to raise the maximum x toy
- the value to lower the minimum y to or to raise the maximum y topublic WorldEnvelope getEnvelope()
public GeometryIndex getGeomIndex()
public SampleFactory getSampleFactory()
public void calculateTransitCenter()
GraphEnvelope
public Optional<com.vividsolutions.jts.geom.Coordinate> getCenter()
public long getTransitServiceStarts()
public long getTransitServiceEnds()
Copyright © 2018. All rights reserved.