Package org.onebusaway.transit_data_federation.services.realtime

Examples of org.onebusaway.transit_data_federation.services.realtime.BlockLocation


    return true;
  }

  private static final AgencyAndId getVehicleIdForInstance(
      ArrivalAndDepartureInstance instance) {
    BlockLocation location = instance.getBlockLocation();
    if (location == null)
      return null;
    return location.getVehicleId();
  }
View Full Code Here


  public VehicleLocationRecordBean getVehicleLocationRecordForVehicleId(
      AgencyAndId vehicleId, long targetTime) {

    TargetTime target = new TargetTime(targetTime, targetTime);

    BlockLocation blockLocation = _blockLocationService.getLocationForVehicleAndTime(
        vehicleId, target);
    if (blockLocation == null)
      return null;
    return getBlockLocationAsVehicleLocationRecord(blockLocation);
  }
View Full Code Here

      if (hasFrequency)
        bean.setScheduledDepartureTime(bean.getPredictedDepartureTime());
    }

    BlockStopTimeEntry stopTime = instance.getBlockStopTime();
    BlockLocation blockLocation = instance.getBlockLocation();

    if (blockLocation == null)
      return;

    bean.setPredicted(blockLocation.isPredicted());

    // Distance from stop
    if (blockLocation.isDistanceAlongBlockSet()) {
      double distanceFromStop = stopTime.getDistanceAlongBlock()
          - blockLocation.getDistanceAlongBlock();
      bean.setDistanceFromStop(distanceFromStop);
    } else {
      double distanceFromStop = stopTime.getDistanceAlongBlock()
          - blockLocation.getScheduledDistanceAlongBlock();
      bean.setDistanceFromStop(distanceFromStop);
    }

    // Number of stops away
    if (blockLocation.getNextStop() != null) {
      BlockStopTimeEntry nextStopTime = blockLocation.getNextStop();
      bean.setNumberOfStopsAway(stopTime.getBlockSequence()
          - nextStopTime.getBlockSequence());
    }

    if (blockLocation.getLastUpdateTime() > 0)
      bean.setLastUpdateTime(blockLocation.getLastUpdateTime());

    if (blockLocation.getVehicleId() != null)
      bean.setVehicleId(AgencyAndIdLibrary.convertToString(blockLocation.getVehicleId()));

    TripStatusBean tripStatusBean = _tripDetailsBeanService.getBlockLocationAsStatusBean(
        blockLocation, targetTime);
    bean.setTripStatus(tripStatusBean);
  }
View Full Code Here

      ArrivalAndDepartureInstance instance, ArrivalAndDepartureBean bean) {

    BlockInstance blockInstance = instance.getBlockInstance();

    AgencyAndId vehicleId = null;
    BlockLocation blockLocation = instance.getBlockLocation();
    if (blockLocation != null)
      vehicleId = blockLocation.getVehicleId();

    List<ServiceAlertBean> situations = _serviceAlertsBeanService.getServiceAlertsForStopCall(
        time, blockInstance, instance.getBlockStopTime(), vehicleId);

    if (!situations.isEmpty())
View Full Code Here

    } else {

      // If no real-time trips are available and no vehicle id was specified,
      // use scheduled trips
      if (vehicleId == null) {
        BlockLocation location = _blockLocationService.getScheduledLocationForBlockInstance(
            instance, time);

        if (location != null && location.isInService())
          results.add(location);
      }
    }
  }
View Full Code Here

    List<Record> records = new ArrayList<Record>();

    for (int i = 0; i < 5 * 60; i += 30) {

      TargetTime tt = new TargetTime(time - i * 1000);
      BlockLocation location = _blockLocationService.getLocationForVehicleAndTime(
          vid, tt);

      if (location != null) {

        CoordinatePoint p = applyNoiseToLocation(location.getLocation(), noise);

        Record r = new Record();
        r.setLocation(location.getLocation());
        r.setTimestamp(tt.getTargetTime());
        r.setLocation(p);
        r.setAccuracy(noise);
        records.add(r);
      }
View Full Code Here

TOP

Related Classes of org.onebusaway.transit_data_federation.services.realtime.BlockLocation

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.