use of com.vividsolutions.jts.index.strtree.STRtree in project onebusaway-application-modules by camsys.
the class RoutesBeanServiceImpl method setup.
@Refreshable(dependsOn = { RefreshableResources.NARRATIVE_DATA })
@PostConstruct
public void setup() {
_stopTreesByRouteId.clear();
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();
}
Aggregations