Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.Graph


    List<StopEntry> hubStops = loadHubStops();
    List<StopEntry> stops = loadSourceStops(hubStops);

    Set<StopEntry> hubStopsAsSet = new HashSet<StopEntry>(hubStops);

    Graph graph = _graphService.getGraph();
    GraphContext context = _otpConfigurationService.createGraphContext();

    Map<AgencyAndId, MutableTransferPattern> patternsByStopId = new HashMap<AgencyAndId, MutableTransferPattern>();

    for (StopEntry stop : stops) {
View Full Code Here


  public BasicShortestPathTree getTransitShed(Vertex origin, State originState,
      TraverseOptions options) {

    BasicShortestPathTree spt = new BasicShortestPathTree();

    Graph graph = _graphService.getGraph();

    FibHeap<State> queue = new FibHeap<State>(graph.getVertices().size());

    spt.add(originState);
    queue.insert(originState, originState.getWeight());

    HashSet<Vertex> closed = new HashSet<Vertex>();
View Full Code Here

    }

    TPQueryData queryData = new TPQueryData(sourceStops, destStops);
    options.putExtension(TPQueryData.class, queryData);

    Graph graph = _graphService.getGraph();
    Vertex origin = options.isArriveBy() ? toVertex : fromVertex;
    Vertex target = options.isArriveBy() ? fromVertex : toVertex;
    State init = new OBAState(time.getTime(), origin, options);
    options.remainingWeightHeuristic = new TPRemainingWeightHeuristicImpl();
    GenericAStar search = new GenericAStar();
View Full Code Here

    return Collections.emptyList();
  }

  private WalkFromStopVertex getWalkFromStopVertexForStop(StopEntry stop) {
    Graph graph = _graphService.getGraph();
    String label = WalkFromStopVertex.getVertexLabelForStop(stop);
    return (WalkFromStopVertex) graph.getVertex(label);
  }
View Full Code Here

    String label = WalkFromStopVertex.getVertexLabelForStop(stop);
    return (WalkFromStopVertex) graph.getVertex(label);
  }

  private WalkToStopVertex getWalkToStopVertexForStop(StopEntry stop) {
    Graph graph = _graphService.getGraph();
    String label = WalkToStopVertex.getVertexLabelForStop(stop);
    return (WalkToStopVertex) graph.getVertex(label);
  }
View Full Code Here

  }

  @Override
  public void handleGraphRefresh(GraphService graphService) {

    Graph graph = _graphService.getGraph();
    GraphContext context = _otpConfigurationService.createGraphContext();

    if (graph.getVertices().isEmpty()) {
      _log.info("OTP graph is empty, so skipping street-to-stop linking step");
      return;
    }

    NetworkLinkerLibrary linker = new NetworkLinkerLibrary(graph);

    int index = 0;

    for (StopEntry stop : _transitGraphDao.getAllStops()) {

      if (index % 100 == 0)
        _log.info("linked stops: " + index);
      index++;

      /***
       * Add street-to-stop edges
       ****/

      WalkToStopVertex walkToStopVertex = new WalkToStopVertex(context, stop);

      if (linker.determineIncomingEdgesForVertex(walkToStopVertex, true)) {
        GraphVertex gv = graph.getGraphVertex(walkToStopVertex.getLabel());
        WaitingBeginsAtStopEdge edge = new WaitingBeginsAtStopEdge(context,
            stop, false);
        edge.setFromVertex(walkToStopVertex);
        gv.addOutgoing(edge);
      } else {
        _log.warn("error linking stop: " + stop.getId() + " to street network");
      }

      /****
       * Add stop-to-street edges
       ****/

      WalkFromStopVertex walkFromStopVertex = new WalkFromStopVertex(context,
          stop);

      if (linker.determineOutgoingEdgesForVertex(walkFromStopVertex, true)) {
        GraphVertex gv = graph.getGraphVertex(walkFromStopVertex.getLabel());
        WaitingEndsAtStopEdge edge = new WaitingEndsAtStopEdge(context, stop,
            true);
        edge.setToVertex(walkFromStopVertex);
        gv.addIncoming(edge);
      } else {
View Full Code Here

      if (vertex instanceof HasEdges) {
        HasEdges hasEdges = (HasEdges) vertex;
        edges = hasEdges.getOutgoing();
      } else {
        Graph graph = _graphService.getGraph();
        GraphVertex gv = graph.getGraphVertex(vertex.getLabel());
        if (gv != null)
          edges = gv.getOutgoing();
      }

      if (edges != null) {
View Full Code Here

TOP

Related Classes of org.opentripplanner.routing.core.Graph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.