Package org.onebusaway.geospatial.model

Examples of org.onebusaway.geospatial.model.CoordinateBounds


    return Math.floor(value / step) * step;
  }

  private static CoordinateBounds snapBounds(double latMin, double lonMin,
      double latMax, double lonMax) {
    return new CoordinateBounds(snap(latMin), snap(lonMin), snap(latMax),
        snap(lonMax));
  }
View Full Code Here


    ConstraintsBean c = constraints.getConstraints();

    double maxWalkDistance = c.getMaxWalkingDistance();
    double walkingVelocity = minTravelTimeToStops.getWalkingVelocity() / 1000;

    CoordinateBounds b = SphericalGeometryLibrary.bounds(location, 800);
    double latStep = b.getMaxLat() - b.getMinLat();
    double lonStep = b.getMaxLon() - b.getMinLon();
    GridFactory gridFactory = new GridFactory(latStep, lonStep);
    TimedGridFactory timedGridFactory = new TimedGridFactory(latStep / 4,
        lonStep / 4, walkingVelocity);

    long maxTripLength = c.getMaxTripDuration() * 1000;

    for (int i = 0; i < minTravelTimeToStops.getSize(); i++) {

      double stopLat = minTravelTimeToStops.getStopLat(i);
      double stopLon = minTravelTimeToStops.getStopLon(i);

      long duration = minTravelTimeToStops.getTravelTime(i);

      double remainingWalkingDistance = (maxTripLength - duration)
          * walkingVelocity;
      remainingWalkingDistance = Math.min(remainingWalkingDistance,
          maxWalkDistance);

      CoordinateBounds bounds = SphericalGeometryLibrary.bounds(stopLat,
          stopLon, remainingWalkingDistance);
      gridFactory.addBounds(bounds);

      long remainingWalkingTime = (long) (remainingWalkingDistance / walkingVelocity);
      if (remainingWalkingTime > 0)
View Full Code Here

      } else {

        Map<CoordinateBounds, List<StopBean>> stopsByRegion = getStopsByActualRegion(result);

        for (Map.Entry<CoordinateBounds, List<StopBean>> entry : stopsByRegion.entrySet()) {
          CoordinateBounds bounds = entry.getKey();
          List<StopBean> stops = entry.getValue();
          RegionCache cache = new RegionCache(stops, false);
          _cache.put(bounds, cache);
          handleRegion(bounds, cache);
        }
View Full Code Here

    _dialog.show();

    Context context = new ContextImpl();

    if (!_stopsById.isEmpty()) {
      CoordinateBounds b = new CoordinateBounds();
      for (StopBean stop : _stopsById.values())
        b.addPoint(stop.getLat(), stop.getLon());
      b = SphericalGeometryLibrary.bounds(b, 100);
      context = stopFinder.getCoordinateBoundsAsContext(b);
      System.out.println("context=" + context);
    }
View Full Code Here

    if( center == null) {
      MapWidget map = context.getMap();
      center = map.getCenter();
    }
   
    CoordinateBounds bounds = SphericalGeometryLibrary.bounds(
        center.getLatitude(), center.getLongitude(), 20000);

    SearchQueryBean query = new SearchQueryBean();
    query.setBounds(bounds);
    query.setMaxCount(10);
View Full Code Here

      @Override
      public void execute() {
     
        _map.checkResizeAndCenter();
       
        CoordinateBounds b = _config.getBounds();
       
        LatLng from = LatLng.newInstance(b.getMinLat(), b.getMinLon());
        LatLng to = LatLng.newInstance(b.getMaxLat(), b.getMaxLon());
        LatLngBounds bounds = LatLngBounds.newInstance(from, to);
       
        int zoom = _map.getBoundsZoomLevel(bounds);
       
        System.out.println(bounds + " => " + zoom);
View Full Code Here

    if (_map.getZoomLevel() < 16)
      return;
    LatLngBounds llBounds = _map.getBounds();
    LatLng a = llBounds.getNorthEast();
    LatLng b = llBounds.getSouthWest();
    CoordinateBounds bounds = new CoordinateBounds(a.getLatitude(),
        a.getLongitude(), b.getLatitude(), b.getLongitude());

    TripsForBoundsQueryBean query = new TripsForBoundsQueryBean();
    query.setBounds(bounds);
    query.setTime(System.currentTimeMillis());
View Full Code Here

      if (zoom < 17) {
        return;
      }

      final CoordinateBounds bounds = computeBounds();

      for (Iterator<Map.Entry<String, StopAndOverlays>> it = _visibleStopsById.entrySet().iterator(); it.hasNext();) {
        Entry<String, StopAndOverlays> entry = it.next();
        StopAndOverlays stopAndOverlays = entry.getValue();
        StopBean stop = stopAndOverlays.getStop();
        if (!bounds.contains(stop.getLat(), stop.getLon())) {
          it.remove();
          for (Overlay overlay : stopAndOverlays.getOverlays())
            _manager.removeOverlay(overlay);
        }
      }
View Full Code Here

    double latMin = sw.getLatitude();
    double lonMin = sw.getLongitude();
    double latMax = ne.getLatitude();
    double lonMax = ne.getLongitude();

    return new CoordinateBounds(latMin, lonMin, latMax, lonMax);
  }
View Full Code Here

TOP

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

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.