Package org.opentripplanner.routing.core

Examples of org.opentripplanner.routing.core.EdgeNarrative


  }

  @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


        VertexBean from = getVertexAsBean(beansByVertex, vertex);
        List<EdgeNarrativeBean> edgeNarratives = new ArrayList<EdgeNarrativeBean>();

        for (Edge edge : edges) {
          if (edge instanceof EdgeNarrative) {
            EdgeNarrative narrative = (EdgeNarrative) edge;
            EdgeNarrativeBean narrativeBean = new EdgeNarrativeBean();
            narrativeBean.setName(narrative.getName());

            Geometry geom = narrative.getGeometry();
            if (geom != null) {
              List<CoordinatePoint> path = new ArrayList<CoordinatePoint>();
              appendGeometryToPath(geom, path, true);
              EncodedPolylineBean polyline = PolylineEncoder.createEncodings(path);
              narrativeBean.setPath(polyline.getPoints());
            }

            narrativeBean.setFrom(from);
            narrativeBean.setTo(getVertexAsBean(beansByVertex,
                narrative.getToVertex()));

            Map<String, Object> tags = new HashMap<String, Object>();
            if (edge instanceof StreetEdge) {
              StreetEdge streetEdge = (StreetEdge) edge;
              StreetTraversalPermission permission = streetEdge.getPermission();
View Full Code Here

    OBATraverseOptions obaOpts = (OBATraverseOptions) s0.getOptions();
    if (obaOpts.extraSpecialMode)
      return null;

    EdgeNarrative narrative = createNarrative(s0);
    return s0.edit(this, narrative).makeState();
  }
View Full Code Here

    return s0.edit(this, narrative).makeState();
  }

  private State traverseReverse(State s0) {

    EdgeNarrative narrative = createNarrative(s0);
    return s0.edit(this, narrative).makeState();
  }
View Full Code Here

    int currentIndex = 1;

    while (currentIndex < states.size()) {

      State state = states.get(currentIndex);
      EdgeNarrative edgeNarrative = state.getBackEdgeNarrative();

      TraverseMode mode = edgeNarrative.getMode();

      if (mode.isTransit()) {
        currentIndex = extendTransitLeg(states, currentIndex, options, legs);
      } else {
        currentIndex = extendStreetLeg(states, currentIndex, mode, legs);
View Full Code Here

    while (currentIndex < states.size()) {

      State state = states.get(currentIndex);
      Edge edge = state.getBackEdge();
      EdgeNarrative narrative = state.getBackEdgeNarrative();
      TraverseMode mode = narrative.getMode();

      if (!mode.isTransit())
        break;

      Vertex vFrom = narrative.getFromVertex();
      Vertex vTo = narrative.getToVertex();

      if (vFrom instanceof BlockDepartureVertex) {

        builder = extendTransitLegWithDepartureAndArrival(legs, builder,
            (BlockDepartureVertex) vFrom, (BlockArrivalVertex) vTo);
View Full Code Here

    List<State> streetStates = new ArrayList<State>();

    while (currentIndex < states.size()) {

      State state = states.get(currentIndex);
      EdgeNarrative narrative = state.getBackEdgeNarrative();
      TraverseMode edgeMode = narrative.getMode();

      if (mode != edgeMode)
        break;

      streetStates.add(state);
View Full Code Here

    CoordinatePoint from = null;
    CoordinatePoint to = null;

    for (State state : streetStates) {

      EdgeNarrative edgeResult = state.getBackEdgeNarrative();

      Geometry geom = edgeResult.getGeometry();
      if (geom == null) {
        continue;
      }

      String streetName = edgeResult.getName();

      if (streetLeg == null
          || !ObjectUtils.equals(streetLeg.getStreetName(), streetName)) {

        addPathToStreetLegIfApplicable(streetLeg, path, distance);

        streetLeg = createStreetLeg(state);
        streetLegs.add(streetLeg);
        path = new ArrayList<CoordinatePoint>();

        appendGeometryToPath(geom, path, true);
        distance = edgeResult.getDistance();

      } else {

        appendGeometryToPath(geom, path, false);
        distance += edgeResult.getDistance();
      }

      totalDistance += edgeResult.getDistance();

      if (startTime == 0)
        startTime = state.getBackState().getTime();
      endTime = state.getTime();
View Full Code Here

      return traverseForward(s0);
  }

  private State traverseForward(State s0) {

    EdgeNarrative narrative = createNarrative(s0, s0.getTime());
    StateEditor edit = s0.edit(this, narrative);

    TraverseOptions options = s0.getOptions();
    int transferTime = computeTransferTime(options);
    edit.setTime(_instance.getBestArrivalTime());
View Full Code Here

    if (s0.getNumBoardings() >= options.maxTransfers)
      return null;

    int transferTime = computeTransferTime(options);
    long t = s0.getTime() - ((transferTime + options.minTransferTime) * 1000);
    EdgeNarrative narrative = createNarrative(s0, t);
    StateEditor edit = s0.edit(this, narrative);
    edit.setTime(t);

    double weight = computeWeightForTransferTime(options, transferTime);
    edit.incrementWeight(weight);
View Full Code Here

TOP

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

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.