@Override public int compare(StopBean o1, StopBean o2) { double d1 = SphericalGeometryLibrary.distanceFaster(this.lat, this.lon, o1.getLat(), o1.getLon()); double d2 = SphericalGeometryLibrary.distanceFaster(this.lat, this.lon, o2.getLat(), o2.getLon()); if (d1 < d2) { return -1; } else if (d1 > d2) { return +1; } else { return 0; } } }
@Cacheable public List<AgencyAndId> getNearbyStops( @CacheableArgument(keyProperty = "id") StopBean stopBean, double radius) { CoordinateBounds bounds = SphericalGeometryLibrary.bounds( stopBean.getLat(), stopBean.getLon(), radius); List<AgencyAndId> ids = _geospatialBeanService.getStopsByBounds(bounds); List<AgencyAndId> excludingSource = new ArrayList<AgencyAndId>(); for (AgencyAndId id : ids) { if (!ApplicationBeanLibrary.getId(id).equals(stopBean.getId())) excludingSource.add(id); } return excludingSource; } }
@Cacheable public List<AgencyAndId> getNearbyStops( @CacheableArgument(keyProperty = "id") StopBean stopBean, double radius) { CoordinateBounds bounds = SphericalGeometryLibrary.bounds( stopBean.getLat(), stopBean.getLon(), radius); List<AgencyAndId> ids = _geospatialBeanService.getStopsByBounds(bounds); List<AgencyAndId> excludingSource = new ArrayList<AgencyAndId>(); for (AgencyAndId id : ids) { if (!ApplicationBeanLibrary.getId(id).equals(stopBean.getId())) excludingSource.add(id); } return excludingSource; } }
private void updateCurrentUser() { // Save the last selected stop id _currentUserService.setLastSelectedStopIds(_stopIds); _user = _currentUserService.getCurrentUser(); if (_user == null || !_user.hasDefaultLocation()) { List<StopBean> stops = _result.getStops(); StopBean stop = stops.get(0); _defaultSearchLocationService.setDefaultLocationForCurrentUser( stop.getName(), stop.getLat(), stop.getLon()); } }
private void updateCurrentUser() { // Save the last selected stop id _currentUserService.setLastSelectedStopIds(_stopIds); _user = _currentUserService.getCurrentUser(); if (_user == null || !_user.hasDefaultLocation()) { List<StopBean> stops = _result.getStops(); StopBean stop = stops.get(0); _defaultSearchLocationService.setDefaultLocationForCurrentUser( stop.getName(), stop.getLat(), stop.getLon()); } }
private Double getDistanceToNearestStopOnRoute(RouteBean route) { StopsForRouteBean stopsBean = _transitDataService .getStopsForRoute(route.getId()); Double minDistanceToRoute = null; for (StopBean stop : stopsBean.getStops()) { Double distance = SphericalGeometryLibrary.distanceFaster( stop.getLat(), stop.getLon(), lat, lon); if (minDistanceToRoute == null) { minDistanceToRoute = distance; continue; } if (distance < minDistanceToRoute) minDistanceToRoute = distance; } return minDistanceToRoute; } }
String stopName = stopBean.getName(); String stopDirection = stopBean.getDirection(); List<Double> latLng = Arrays.asList(new Double[] {stopBean.getLat(), stopBean.getLon()});
public StopV2Bean getStop(StopBean stop) { StopV2Bean bean = new StopV2Bean(); bean.setCode(stop.getCode()); bean.setDirection(stop.getDirection()); bean.setId(stop.getId()); bean.setLat(stop.getLat()); bean.setLon(stop.getLon()); bean.setLocationType(stop.getLocationType()); bean.setName(stop.getName()); bean.setWheelchairBoarding(stop.getWheelchairBoarding()); List<String> routeIds = new ArrayList<String>(); for (RouteBean route : stop.getRoutes()) { routeIds.add(route.getId()); addToReferences(route); } bean.setRouteIds(routeIds); return bean; }
public StopV2Bean getStop(StopBean stop) { StopV2Bean bean = new StopV2Bean(); bean.setCode(stop.getCode()); bean.setDirection(stop.getDirection()); bean.setId(stop.getId()); bean.setLat(stop.getLat()); bean.setLon(stop.getLon()); bean.setLocationType(stop.getLocationType()); bean.setName(stop.getName()); bean.setWheelchairBoarding(stop.getWheelchairBoarding()); List<String> routeIds = new ArrayList<String>(); for (RouteBean route : stop.getRoutes()) { routeIds.add(route.getId()); addToReferences(route); } bean.setRouteIds(routeIds); return bean; }