Examples of CoordinateBounds


Examples of org.onebusaway.geospatial.model.CoordinateBounds

    double lat1 = Double.parseDouble(args[1]);
    double lon1 = Double.parseDouble(args[2]);
    double lat2 = Double.parseDouble(args[3]);
    double lon2 = Double.parseDouble(args[4]);

    CoordinateBounds bounds = new CoordinateBounds(lat1, lon1, lat2, lon2);

    GtfsReader reader = new GtfsReader();
    reader.setDefaultAgencyId("1");
    reader.getEntityClasses().retainAll(Arrays.asList(Stop.class));
    reader.setInputLocation(new File(args[0]));
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

  }

  private CoordinatePoint applyNoiseToLocation(CoordinatePoint location,
      double noise) {

    CoordinateBounds b = SphericalGeometryLibrary.bounds(location, noise);
    double latSpan = b.getMaxLat() - b.getMinLat();
    double lonSpan = b.getMaxLon() - b.getMinLon();
    double lat = b.getMinLat() + Math.random() * latSpan;
    double lon = b.getMinLon() + Math.random() * lonSpan;
    return new CoordinatePoint(lat, lon);
  }
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

  public void setLonStep(double lonStep) {
    _lonStep = lonStep;
  }

  public void setLatAndLonStep(double lat, double lon, double gridSize) {
    CoordinateBounds b = SphericalGeometryLibrary.bounds(lat, lon, gridSize / 2);
    _latStep = b.getMaxLat() - b.getMinLat();
    _lonStep = b.getMaxLon() - b.getMinLon();
  }
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

  public void add(double lat, double lon, T element) {

    STRtree tree = null;

    for (Map.Entry<CoordinateBounds, STRtree> entry : _treesByBounds.entrySet()) {
      CoordinateBounds bounds = entry.getKey();
      if (bounds.contains(lat, lon)) {
        tree = entry.getValue();
        break;
      }
    }

    if (tree == null) {

      double gLat = Math.floor(lat / _latStep) * _latStep;
      double gLon = Math.floor(lon / _lonStep) * _lonStep;

      CoordinateBounds b = new CoordinateBounds(gLat, gLon, gLat + _latStep,
          gLon + _lonStep);
      tree = new STRtree();
      _treesByBounds.put(b, tree);
    }

View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

  public HierarchicalSTRtree<T> create() {

    STRtree parentTree = new STRtree();

    for (Map.Entry<CoordinateBounds, STRtree> entry : _treesByBounds.entrySet()) {
      CoordinateBounds b = entry.getKey();
      Envelope env = new Envelope(b.getMinLon(), b.getMaxLon(), b.getMinLat(),
          b.getMaxLat());
      STRtree tree = entry.getValue();
      tree.build();
      parentTree.insert(env, tree);
    }
    parentTree.build();
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

    _sourceLon = lon;
    _time = time;
    _timeRemaining = timeRemaining;

    double distanceRemaining = timeRemaining * _velocity;
    CoordinateBounds bounds = SphericalGeometryLibrary.bounds(lat, lon,
        distanceRemaining);
    _grid.addBounds(bounds);

    _sourceLat = Double.NaN;
    _sourceLon = Double.NaN;
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

    protected void addCell(GridIndex index, Object value) {

      if (Double.isNaN(_sourceLat) || Double.isNaN(_sourceLon))
        throw new IllegalStateException();

      CoordinateBounds bounds = getIndexAsBounds(index);

      double lat2 = (bounds.getMinLat() + bounds.getMaxLat()) / 2;
      double lon2 = (bounds.getMinLon() + bounds.getMaxLon()) / 2;

      double d = SphericalGeometryLibrary.distance(_sourceLat, _sourceLon,
          lat2, lon2);
      double t = d == 0 ? 0 : d / _velocity;
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

  }

  private CoordinatePoint applyNoiseToLocation(CoordinatePoint location,
      double noise) {

    CoordinateBounds b = SphericalGeometryLibrary.bounds(location, noise);
    double latSpan = b.getMaxLat() - b.getMinLat();
    double lonSpan = b.getMaxLon() - b.getMinLon();
    double lat = b.getMinLat() + Math.random() * latSpan;
    double lon = b.getMinLon() + Math.random() * lonSpan;
    return new CoordinatePoint(lat, lon);
  }
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

  public List<CoordinateBounds> getGrid() {
    List<CoordinateBounds> results = new ArrayList<CoordinateBounds>();
    for (Grid.Entry<Object> entry : _grid.getEntries()) {
      GridIndex index = entry.getIndex();
      CoordinateBounds bounds = getIndexAsBounds(index);
      results.add(bounds);
    }
    return results;
  }
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

  protected CoordinateBounds getIndexAsBounds(GridIndex index) {
    double minLat = index.getY() * _gridLatStep;
    double minLon = index.getX() * _gridLonStep;
    double maxLat = minLat + _gridLatStep;
    double maxLon = minLon + _gridLonStep;
    return new CoordinateBounds(minLat, minLon, maxLat, maxLon);
  }
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.