Package org.onebusaway.geospatial.model

Examples of org.onebusaway.geospatial.model.CoordinatePoint


  private final CoordinatePoint point;

  private final double orientation;

  public PointAndOrientation(double lat, double lon, double orientation) {
    this.point = new CoordinatePoint(lat,lon);
    this.orientation = orientation;
  }
View Full Code Here


    double[] lats = shapePoints.getLats();
    double[] lons = shapePoints.getLons();
    int n = lats.length;

    for (int i = 0; i < n; i++)
      projectedShapePoints.add(projection.forward(new CoordinatePoint(lats[i],
          lons[i])));
    return projectedShapePoints;
  }
View Full Code Here

    return _lon;
  }

  @Override
  public CoordinatePoint getStopLocation() {
    return new CoordinatePoint(_lat, _lon);
  }
View Full Code Here

        bounds, timeFrom, timeTo);

    List<BlockLocation> locations = getAsLocations(instances, time);
    List<BlockLocation> inRange = new ArrayList<BlockLocation>();
    for (BlockLocation location : locations) {
      CoordinatePoint p = location.getLocation();
      if (p != null && bounds.contains(p))
        inRange.add(location);
    }

    return inRange;
View Full Code Here

        shapePointIndex + 1);
    if (po != null) {
      result.setLocation(po.getPoint());
      result.setOrientation(po.getOrientation());
    } else {
      CoordinatePoint location = new CoordinatePoint(stop.getStopLat(),
          stop.getStopLon());
      result.setLocation(location);
      result.setOrientation(0);
    }
View Full Code Here

    double latTo = afterStop.getStopLat();
    double lonTo = afterStop.getStopLon();
    double lat = (latTo - latFrom) * ratio + latFrom;
    double lon = (lonTo - lonFrom) * ratio + lonFrom;

    CoordinatePoint location = new CoordinatePoint(lat, lon);
    result.setLocation(location);

    double orientation = SphericalGeometryLibrary.getOrientation(latFrom,
        lonFrom, latTo, lonTo);
    result.setOrientation(orientation);
View Full Code Here

    for (int i = 0; i < _argumentIndices.length; i++) {
      Object value = args[_argumentIndices[i]];
      PropertyPathExpression expression = _expressions[i];
      if (expression != null)
        value = expression.invoke(value);
      CoordinatePoint point = (CoordinatePoint) value;
      points.add(point);
    }

    FederatedService service = collection.getServiceForLocations(points);
    return method.invoke(service, args);
View Full Code Here

      } catch (StopIsTooFarFromShapeException ex) {
        StopTimeEntry stopTime = ex.getStopTime();
        TripEntry trip = stopTime.getTrip();
        StopEntry stop = stopTime.getStop();
        AgencyAndId shapeId = trip.getShapeId();
        CoordinatePoint point = ex.getPoint();
        PointAndIndex pindex = ex.getPointAndIndex();

        _log.warn("Stop is too far from shape: trip=" + trip.getId() + " stop="
            + stop.getId() + " stopLat=" + stop.getStopLat() + " stopLon="
            + stop.getStopLon() + " shapeId=" + shapeId + " shapePoint="
            + point + " index=" + pindex.index + " distance="
            + pindex.distanceFromTarget);
      } catch (DistanceAlongShapeException ex) {
        _invalidStopToShapeMappingExceptionCount++;
      }
    }

    if (!distanceTraveledSet) {

      // Make do without
      double d = 0;
      StopTimeEntryImpl prev = null;
      for (StopTimeEntryImpl stopTime : stopTimes) {
        if (prev != null) {
          CoordinatePoint from = prev.getStop().getStopLocation();
          CoordinatePoint to = stopTime.getStop().getStopLocation();
          d += SphericalGeometryLibrary.distance(from, to);
        }
        stopTime.setShapeDistTraveled(d);
        prev = stopTime;
      }
View Full Code Here

      return setValidationErrorsResponse();

    if (_time == 0)
      _time = System.currentTimeMillis();

    CoordinatePoint location = new CoordinatePoint(_lat, _lon);

    MinTravelTimeToStopsBean result = _transitDataService.getMinTravelTimeToStopsFrom(
        location, _time, _constraints);

    BeanFactoryV2 factory = getBeanFactoryV2();
View Full Code Here

      TripBean trip = new TripBean();
      trip.setId("1_t0");
      trip.setRoute(route);
      tripStatus.setActiveTrip(trip);

      vehicle.setLocation(new CoordinatePoint(47.0, -122.0));
    }
    {
      VehicleStatusBean vehicle = new VehicleStatusBean();
      vehicles.add(vehicle);
      vehicle.setLastUpdateTime(5678 * 1000);
      vehicle.setVehicleId("1_v2");

      TripStatusBean tripStatus = new TripStatusBean();
      vehicle.setTripStatus(tripStatus);

      TripBean trip = new TripBean();
      trip.setId("1_t1");
      trip.setRoute(route);
      tripStatus.setActiveTrip(trip);

      vehicle.setLocation(new CoordinatePoint(47.1, -122.1));
    }

    ListBean<VehicleStatusBean> bean = new ListBean<VehicleStatusBean>();
    bean.setList(vehicles);
    Mockito.when(_service.getAllVehiclesForAgency("1", now)).thenReturn(bean);
View Full Code Here

TOP

Related Classes of org.onebusaway.geospatial.model.CoordinatePoint

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.