Examples of StopBean


Examples of org.onebusaway.transit_data.model.StopBean

      stBean.setArrivalTime(stopTime.getArrivalTime());
      stBean.setDepartureTime(stopTime.getDepartureTime());

      StopEntry stopEntry = stopTime.getStop();
      StopBean stopBean = _stopBeanService.getStopForId(stopEntry.getId());
      stBean.setStop(stopBean);
      stBean.setDistanceAlongTrip(stopTime.getShapeDistTraveled());
      bean.addStopTime(stBean);
    }
View Full Code Here

Examples of org.onebusaway.transit_data.model.StopBean

    if (stop == null)
      throw new NoSuchStopServiceException(
          AgencyAndIdLibrary.convertToString(id));

    StopBean sb = new StopBean();
    fillStopBean(stop, narrative, sb);
    fillRoutesForStopBean(stop, sb);
    return sb;
  }
View Full Code Here

Examples of org.onebusaway.transit_data.model.StopBean

    boolean limitExceeded = BeanServiceSupport.checkLimitExceeded(stopIds,
        queryBean.getMaxCount());
    List<StopBean> stopBeans = new ArrayList<StopBean>();

    for (AgencyAndId stopId : stopIds) {
      StopBean stopBean = _stopBeanService.getStopForId(stopId);
      if (stopBean == null)
        throw new ServiceException();

      /**
       * If the stop doesn't have any routes actively serving it, don't include
       * it in the results
       */
      if (stopBean.getRoutes().isEmpty())
        continue;

      stopBeans.add(stopBean);
    }

View Full Code Here

Examples of org.onebusaway.transit_data.model.StopBean

    Min<StopBean> closest = new Min<StopBean>();
    List<StopBean> stopBeans = new ArrayList<StopBean>();

    for (AgencyAndId aid : stops.getResults()) {
      StopBean stopBean = _stopBeanService.getStopForId(aid);
      if (bounds.contains(stopBean.getLat(), stopBean.getLon()))
        stopBeans.add(stopBean);
      double distance = SphericalGeometryLibrary.distance(center.getLat(),
          center.getLon(), stopBean.getLat(), stopBean.getLon());
      closest.add(distance, stopBean);
    }

    boolean limitExceeded = BeanServiceSupport.checkLimitExceeded(stopBeans,
        maxCount);
View Full Code Here

Examples of org.onebusaway.transit_data.model.StopBean

  public void test() {

    AgencyAndId stopIdA = new AgencyAndId("1", "stopA");
    AgencyAndId stopIdB = new AgencyAndId("1", "stopB");

    StopBean stop = new StopBean();
    stop.setId(AgencyAndIdLibrary.convertToString(stopIdA));
    stop.setLat(47.0);
    stop.setLon(-122.0);

    List<AgencyAndId> stopIds = new ArrayList<AgencyAndId>();
    stopIds.add(stopIdA);
    stopIds.add(stopIdB);

    CoordinateBounds bounds = SphericalGeometryLibrary.bounds(stop.getLat(),
        stop.getLon(), 400);
    Mockito.when(_geoBeanService.getStopsByBounds(bounds)).thenReturn(stopIds);

    List<AgencyAndId> nearby = _service.getNearbyStops(stop, 400);
    assertEquals(1, nearby.size());
    assertTrue(nearby.contains(stopIdB));
View Full Code Here

Examples of org.onebusaway.transit_data.model.StopBean

    RouteBean.Builder routeBuilder = RouteBean.builder();
    routeBuilder.setId(AgencyAndIdLibrary.convertToString(routeId));
    RouteBean route = routeBuilder.create();
    Mockito.when(_routeBeanService.getRouteForId(routeId)).thenReturn(route);

    StopBean stopBean = _service.getStopForId(stopId);

    assertNotNull(stopBean);
    assertEquals(stopId.toString(), stopBean.getId());
    assertEquals(stop.getName(), stopBean.getName());
    assertEquals(stopEntry.getStopLat(), stopBean.getLat(), 0.0);
    assertEquals(stopEntry.getStopLon(), stopBean.getLon(), 0.0);
    assertEquals(stop.getCode(), stopBean.getCode());
    assertEquals(stop.getLocationType(), stopBean.getLocationType());

    List<RouteBean> routes = stopBean.getRoutes();
    assertEquals(1, routes.size());

    assertSame(route, routes.get(0));
  }
View Full Code Here

Examples of org.onebusaway.transit_data.model.StopBean

    }

    BlockStopTimeEntry closestStop = blockLocation.getClosestStop();
    if (closestStop != null) {
      StopTimeEntry stopTime = closestStop.getStopTime();
      StopBean stopBean = _stopBeanService.getStopForId(stopTime.getStop().getId());
      bean.setClosestStop(stopBean);
      bean.setClosestStopTimeOffset(blockLocation.getClosestStopTimeOffset());
    }

    BlockStopTimeEntry nextStop = blockLocation.getNextStop();
    if (nextStop != null) {
      StopTimeEntry stopTime = nextStop.getStopTime();
      StopBean stopBean = _stopBeanService.getStopForId(stopTime.getStop().getId());
      bean.setNextStop(stopBean);
      bean.setNextStopTimeOffset(blockLocation.getNextStopTimeOffset());
      bean.setNextStopDistanceFromVehicle(blockLocation.getNextStop().getDistanceAlongBlock()
          - blockLocation.getDistanceAlongBlock());
    }
   
    BlockStopTimeEntry previousStop = blockLocation.getPreviousStop();
    if (previousStop != null) {
      StopTimeEntry stopTime = previousStop.getStopTime();
      StopBean stopBean = _stopBeanService.getStopForId(stopTime.getStop().getId());
      bean.setPreviousStop(stopBean);
      bean.setPreviousStopTimeOffset(blockLocation.getPreviousStopTimeOffset());
      bean.setPreviousStopDistanceFromVehicle(blockLocation.getPreviousStop().getDistanceAlongBlock()
          - blockLocation.getDistanceAlongBlock());
    }
View Full Code Here

Examples of org.onebusaway.transit_data.model.StopBean

    StopTimeNarrative stopTimeNarrative = _narrativeService.getStopTimeForEntry(fromStopTime);
    transitLeg.setRouteShortName(stopTimeNarrative.getRouteShortName());
    transitLeg.setTripHeadsign(stopTimeNarrative.getStopHeadsign());

    StopEntry fromStop = fromStopTimeInstance.getStop();
    StopBean fromStopBean = _stopBeanService.getStopForId(fromStop.getId());
    transitLeg.setFromStop(fromStopBean);

    transitLeg.setFromStopSequence(fromStopTime.getSequence());

    leg.setFrom(fromStop.getStopLocation());
View Full Code Here

Examples of org.onebusaway.transit_data.model.StopBean

    if (toStopTimeInstance == null)
      return;

    StopEntry toStop = toStopTimeInstance.getStop();
    StopBean toStopBean = _stopBeanService.getStopForId(toStop.getId());
    transitLeg.setToStop(toStopBean);

    BlockStopTimeEntry blockStopTime = toStopTimeInstance.getBlockStopTime();
    StopTimeEntry stopTime = blockStopTime.getStopTime();
    transitLeg.setToStopSequence(stopTime.getSequence());
View Full Code Here

Examples of org.onebusaway.transit_data.model.StopBean

        if (perms != null)
          tags.put("access", perms.toString().toLowerCase());
      } else if (vertex instanceof AbstractStopVertex) {
        AbstractStopVertex stopVertex = (AbstractStopVertex) vertex;
        StopEntry stop = stopVertex.getStop();
        StopBean stopBean = _stopBeanService.getStopForId(stop.getId());
        tags.put("stop", stopBean);
      }

      bean.setTags(tags);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.