Package com.vividsolutions.jts.index.strtree

Examples of com.vividsolutions.jts.index.strtree.STRtree


    if (shapeIdsByGridCell.isEmpty()) {
      _tree = null;
      return;
    }

    _tree = new STRtree(shapeIdsByGridCell.size());

    for (Map.Entry<CoordinateBounds, List<AgencyAndId>> entry : shapeIdsByGridCell.entrySet()) {
      CoordinateBounds b = entry.getKey();
      Envelope env = new Envelope(b.getMinLon(), b.getMaxLon(), b.getMinLat(),
          b.getMaxLat());
View Full Code Here


    if (stops.size() == 0) {
      _tree = null;
      return;
    }
   
    _tree = new STRtree(stops.size());

    for (StopEntry stop : stops) {
      float x = (float) stop.getStopLon();
      float y = (float) stop.getStopLat();
      Envelope env = new Envelope(x, x, y, y);
View Full Code Here

        _log.warn("no stops found for graph");

      } else {

        _stopLocationTree = new STRtree(_stops.size());

        for (int i = 0; i < _stops.size(); i++) {
          StopEntry stop = _stops.get(i);
          double x = stop.getStopLon();
          double y = stop.getStopLat();
View Full Code Here

    }
   
    for (StopEntry stop : _graphDao.getAllStops()) {
      Set<AgencyAndId> routeIds = _routeService.getRouteCollectionIdsForStop(stop.getId());
      for (AgencyAndId routeId : routeIds) {
        STRtree tree = _stopTreesByRouteId.get(routeId);
        if (tree == null) {
          tree = new STRtree();
          _stopTreesByRouteId.put(routeId, tree);
        }
        double x = stop.getStopLon();
        double y = stop.getStopLat();
        Envelope env = new Envelope(x, x, y, y);
        tree.insert(env, routeId);
      }
    }
   
    for (STRtree tree : _stopTreesByRouteId.values())
      tree.build();
  }
View Full Code Here

    List<RouteBean> routeBeans = new ArrayList<RouteBean>();
    CoordinateBounds bounds = query.getBounds();

    for (AgencyAndId id : result.getResults()) {
      STRtree tree = _stopTreesByRouteId.get(id);
      if (tree == null) {
        _log.warn("stop tree not found for routeId=" + id);
        continue;
      }
      Envelope env = new Envelope(bounds.getMinLon(), bounds.getMaxLon(),
          bounds.getMinLat(), bounds.getMaxLat());
      HasItemsVisitor v = new HasItemsVisitor();
      tree.query(env, v);

      if (v.hasItems()) {
        RouteBean routeBean = _routeBeanService.getRouteForId(id);
        routeBeans.add(routeBean);
      }
View Full Code Here

    _lonStep = b.getMaxLon() - b.getMinLon();
  }

  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);
    }

    Envelope env = new Envelope(lon, lon, lat, lat);
    tree.insert(env, element);
  }
View Full Code Here

    tree.insert(env, element);
  }

  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();

    return new HierarchicalSTRtree<T>(parentTree);
View Full Code Here

  public FederatedServiceCollectionImpl(
      Map<FederatedService, Map<String, List<CoordinateBounds>>> services) {

    _services = Collections.unmodifiableSet(services.keySet());

    _tree = new STRtree();

    for (Map.Entry<FederatedService, Map<String, List<CoordinateBounds>>> entry : services.entrySet()) {
      FederatedService service = entry.getKey();
      Map<String, List<CoordinateBounds>> agencyIdsAndCoverage = entry.getValue();
      for (Map.Entry<String, List<CoordinateBounds>> acEntry : agencyIdsAndCoverage.entrySet()) {
View Full Code Here

    /** Listeners */
    protected List<CollectionListener> listeners = null;

    public SpatialIndexFeatureCollection() {
        this.index = new STRtree();
    }
View Full Code Here

    public SpatialIndexFeatureCollection() {
        this.index = new STRtree();
    }
   
    public SpatialIndexFeatureCollection(SimpleFeatureType schema) {
        this.index = new STRtree();
        this.schema = schema;
    }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.index.strtree.STRtree

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.