Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.Vertex


  @Override
  public double computeForwardWeight(State s, Vertex target) {

    EdgeNarrative narrative = s.getBackEdgeNarrative();
    Vertex v = narrative.getToVertex();

    return computeWeight(s, target, v);
  }
View Full Code Here


  @Override
  public double computeReverseWeight(State s, Vertex target) {

    EdgeNarrative narrative = s.getBackEdgeNarrative();
    Vertex v = narrative.getFromVertex();

    return computeWeight(s, target, v);
  }
View Full Code Here

    while (!queue.empty()) {

      State state = queue.extract_min();

      Vertex fromVertex = state.getVertex();

      closed.add(fromVertex);

      if (_vertexSkipStrategy.isVertexSkippedInFowardSearch(origin,
          originState, state, options))
        continue;

      Iterable<Edge> outgoing = GraphLibrary.getOutgoingEdges(graph,
          fromVertex, extraEdges);

      for (Edge edge : outgoing) {

        for (State wr = edge.traverse(state); wr != null; wr = wr.getNextResult()) {

          EdgeNarrative er = wr.getBackEdgeNarrative();
          Vertex toVertex = er.getToVertex();

          if (!closed.contains(toVertex)) {

            if (spt.add(wr))
              queue.insert(wr, wr.getWeight());
View Full Code Here

  }

  private State traverseBackTransferPatterns(State s0, TraverseOptions options) {

    if (!_isReverseEdge) {
      Vertex fromVertex = null;
      Vertex toVertex = new WalkFromStopVertex(_context, _stop);
      EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);
      return s0.edit(this, narrative).makeState();
    }

    TransferPatternService tpService = _context.getTransferPatternService();

    TPQueryData queryData = options.getExtension(TPQueryData.class);

    List<StopEntry> sourceStops = queryData.getSourceStops();

    State results = null;

    Collection<TransferNode> trees = tpService.getReverseTransferPatternsForStops(
        queryData.getTransferPatternData(), sourceStops, _stop);

    for (TransferNode tree : trees) {

      TPState pathState = TPState.end(queryData, tree);

      Vertex fromVertex = new TPArrivalVertex(_context, pathState);
      Vertex toVertex = new WalkFromStopVertex(_context, _stop);

      EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);
      State r = s0.edit(this, narrative).makeState();
      results = r.addToExistingResultChain(results);
    }
View Full Code Here

  public List<GraphPath> getItinerariesBetween(TransitLocationBean from,
      TransitLocationBean to, long targetTime, OBATraverseOptions options)
      throws ServiceException {

    Vertex fromVertex = getTransitLocationAsVertex(from, options);
    Vertex toVertex = getTransitLocationAsVertex(to, options);

    if (fromVertex == null || toVertex == null)
      throw new OutOfServiceAreaServiceException();

    Vertex v = options.isArriveBy() ? toVertex : fromVertex;
    Vertex target = options.isArriveBy() ? fromVertex : toVertex;

    State state = new OBAState(targetTime, v, options);

    if (_transferPathService.isEnabled()) {
      return getTransferPatternItinerariesBetween(fromVertex, toVertex,
View Full Code Here

      CoordinatePoint to, Date time, TraverseOptions options) {

    Coordinate a = new Coordinate(from.getLon(), from.getLat());
    Coordinate b = new Coordinate(to.getLon(), to.getLat());

    Vertex v1 = _streetVertexIndexService.getClosestVertex(a, options);
    Vertex v2 = _streetVertexIndexService.getClosestVertex(b, options);

    if (v1 == null || v2 == null)
      return null;

    return getWalkingItineraryBetweenVertices(v1, v2, time, options);
View Full Code Here

     * Set walk only
     */
    TraverseModeSet modes = new TraverseModeSet(TraverseMode.WALK);
    options.setModes(modes);

    Vertex origin = options.isArriveBy() ? to : from;
    Vertex target = options.isArriveBy() ? from : to;
    State state = new OBAState(time.getTime(), origin, options);

    List<GraphPath> paths = _pathService.plan(state, target, 1);

    if (CollectionsLibrary.isEmpty(paths))
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();
    search.setSkipTraverseResultStrategy(new SkipVertexImpl());
    search.setSearchTerminationStrategy(new SearchTerminationStrategyImpl());
View Full Code Here

        long departure = _from.getBestDepartureTime();
        long arrival = nextTransferStop.getBestArrivalTime();
        int runningTime = (int) ((arrival - departure) / 1000);

        Vertex fromVertex = new BlockDepartureVertex(_context, _from);
        Vertex toVertex = new BlockArrivalVertex(_context, nextTransferStop);
        EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

        StateEditor edit = s0.edit(this, narrative);
        edit.incrementTimeInSeconds(runningTime);
        edit.incrementWeight(runningTime);

        State result = edit.makeState();
        results = result.addToExistingResultChain(results);

        maxBlockSequence = nextTransferStop.getBlockStopTime().getBlockSequence();
      } else {
        maxBlockSequence = Integer.MAX_VALUE;
      }
    }

    ArrivalAndDepartureInstance nextStop = service.getNextStopArrivalAndDeparture(_from);

    if (nextStop != null
        && nextStop.getBlockStopTime().getBlockSequence() < maxBlockSequence) {

      long departure = _from.getBestDepartureTime();
      long arrival = nextStop.getBestArrivalTime();
      int runningTime = (int) ((arrival - departure) / 1000);

      Vertex fromVertex = new BlockDepartureVertex(_context, _from);
      Vertex toVertex = new BlockArrivalVertex(_context, nextStop);
      EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

      OBAStateEditor edit = (OBAStateEditor) s0.edit(this, narrative);
      edit.incrementTimeInSeconds(runningTime);
      edit.incrementWeight(runningTime);
View Full Code Here

    ArrivalAndDepartureInstance nextStop = service.getNextStopArrivalAndDeparture(_from);

    if (nextStop == null)
      return null;

    Vertex fromVertex = new BlockDepartureVertex(_context, _from);
    Vertex toVertex = new BlockArrivalVertex(_context, nextStop);
    EdgeNarrative narrative = narrative(s0, fromVertex, toVertex);

    StateEditor edit = s0.edit(this, narrative);

    long departure = _from.getBestDepartureTime();
View Full Code Here

TOP

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

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.