public AgencyWithCoverageV2Bean getAgencyWithCoverage( AgencyWithCoverageBean awc) { AgencyWithCoverageV2Bean bean = new AgencyWithCoverageV2Bean(); bean.setAgencyId(awc.getAgency().getId()); bean.setLat(awc.getLat()); bean.setLon(awc.getLon()); bean.setLatSpan(awc.getLatSpan()); bean.setLonSpan(awc.getLonSpan()); addToReferences(awc.getAgency()); return bean; }
public List<AgencyWithCoverageBean> getAgenciesWithCoverage() throws ServiceException { Map<String, CoordinateBounds> agencyIdsAndCoverageAreas = _agencyService.getAgencyIdsAndCoverageAreas(); List<AgencyWithCoverageBean> beans = new ArrayList<AgencyWithCoverageBean>(); for (Map.Entry<String, CoordinateBounds> entry : agencyIdsAndCoverageAreas.entrySet()) { String agencyId = entry.getKey(); CoordinateBounds bounds = entry.getValue(); AgencyBean agencyBean = _agencyBeanService.getAgencyForId(agencyId); if (agencyBean == null) throw new ServiceException("agency not found: " + agencyId); AgencyWithCoverageBean bean = new AgencyWithCoverageBean(); bean.setAgency(agencyBean); bean.setLat((bounds.getMaxLat() + bounds.getMinLat()) / 2); bean.setLon((bounds.getMaxLon() + bounds.getMinLon()) / 2); bean.setLatSpan(bounds.getMaxLat() - bounds.getMinLat()); bean.setLonSpan(bounds.getMaxLon() - bounds.getMinLon()); beans.add(bean); } return beans; }
public AgencyWithCoverageV2Bean getAgencyWithCoverage( AgencyWithCoverageBean awc) { AgencyWithCoverageV2Bean bean = new AgencyWithCoverageV2Bean(); bean.setAgencyId(awc.getAgency().getId()); bean.setLat(awc.getLat()); bean.setLon(awc.getLon()); bean.setLatSpan(awc.getLatSpan()); bean.setLonSpan(awc.getLonSpan()); addToReferences(awc.getAgency()); return bean; }
private List<String> getAgencyIds() { if (_agencyIds == null) { List<String> agencyIds = new ArrayList<String>(); for(AgencyWithCoverageBean agenciesWithCoverage : _transitDataService.getAgenciesWithCoverage()) { agencyIds.add(agenciesWithCoverage.getAgency().getId()); } // see if another thread beat us to it if (_agencyIds == null) { _agencyIds = agencyIds; } } return _agencyIds; }
@Override public List<AgencyWithCoverageBean> getAgenciesWithCoverage() throws ServiceException { Map<String, CoordinateBounds> agencyIdsAndCoverageAreas = _agencyService.getAgencyIdsAndCoverageAreas(); List<AgencyWithCoverageBean> beans = new ArrayList<AgencyWithCoverageBean>(); for (Map.Entry<String, CoordinateBounds> entry : agencyIdsAndCoverageAreas.entrySet()) { String agencyId = entry.getKey(); CoordinateBounds bounds = entry.getValue(); AgencyBean agencyBean = _agencyBeanService.getAgencyForId(agencyId); if (agencyBean == null) throw new ServiceException("agency not found: " + agencyId); AgencyWithCoverageBean bean = new AgencyWithCoverageBean(); bean.setAgency(agencyBean); bean.setLat((bounds.getMaxLat() + bounds.getMinLat()) / 2); bean.setLon((bounds.getMaxLon() + bounds.getMinLon()) / 2); bean.setLatSpan(bounds.getMaxLat() - bounds.getMinLat()); bean.setLonSpan(bounds.getMaxLon() - bounds.getMinLon()); beans.add(bean); } return beans; }
public List<StopBean> getAllRevenueStops(AgencyWithCoverageBean agency) { SearchQueryBean query = new SearchQueryBean(); CoordinateBounds bounds = new CoordinateBounds(); double lat = agency.getLat(); double lon = agency.getLon(); double latSpan = agency.getLatSpan() / 2; double lonSpan = agency.getLonSpan() / 2; bounds.addPoint(lat - latSpan, lon - lonSpan); bounds.addPoint(lat + latSpan, lon + lonSpan); query.setBounds(bounds); query.setMaxCount(Integer.MAX_VALUE); return _scheduleHelperService.filterRevenueService(agency.getAgency(), getStops(query)); }
@Override public List<RouteBean> getRoutes() { List<RouteBean> allRoutes = new ArrayList<RouteBean>(); List<AgencyWithCoverageBean> agencies = _transitDataService.getAgenciesWithCoverage(); for (AgencyWithCoverageBean agency : agencies) { allRoutes.addAll(_transitDataService.getRoutesForAgencyId(agency.getAgency().getId()).getList()); } Collections.sort(allRoutes, (getShowAgencyNames() ? new AgencyAndRouteComparator() : new RouteComparator())); return allRoutes; } }
@Override public void run() { List<AgencyWithCoverageBean> agenciesWithCoverage = _tds.getAgenciesWithCoverage(); CoordinateBounds bounds = new CoordinateBounds(); for (AgencyWithCoverageBean bean : agenciesWithCoverage) { double lat = bean.getLat(); double lon = bean.getLon(); double latSpan = bean.getLatSpan() / 2; double lonSpan = bean.getLonSpan() / 2; bounds.addPoint(lat - latSpan, lon - lonSpan); bounds.addPoint(lat + latSpan, lon + lonSpan); } if (!bounds.isEmpty()) { _log.info("setting default agency bounds to " + bounds); _sas.setDefaultBounds(bounds); } }
.getAgenciesWithCoverage()) { for (RouteBean routeBean : _transitDataService .getRoutesForAgencyId(agency.getAgency().getId()).getList()) { if (routeBean.getShortName() != null) if (_routeShortNameToRouteBeanMap.containsKey(routeBean.getShortName().toUpperCase())) { _stopCodeToStopIdMap.put(agency.getAgency().getId() + "_" + stop.getCode().toUpperCase(), stop.getId());
if (awc.getLatSpan() <= 0 || awc.getLonSpan() <= 0) continue; bounds.addPoint(awc.getLat() + awc.getLatSpan() / 2, awc.getLon() + awc.getLonSpan() / 2); bounds.addPoint(awc.getLat() - awc.getLatSpan() / 2, awc.getLon() - awc.getLonSpan() / 2);
AgencyAndId potentialStopId = new AgencyAndId(agency.getAgency() .getId(), id);
@Override public Map<String, Object> getConfiguration() { Map<String, Object> config = new HashMap<String, Object>(); config.put("apiKey", "web"); String contextPath = ServletLibrary.getContextPath(_servletContext); config.put("baseUrl", contextPath); config.put("apiUrl", contextPath + "/api"); List<AgencyWithCoverageBean> agenciesWithCoverage = _transitDataService.getAgenciesWithCoverage(); CoordinateBounds bounds = new CoordinateBounds(); for (AgencyWithCoverageBean awc : agenciesWithCoverage) { bounds.addPoint(awc.getLat() + awc.getLatSpan() / 2, awc.getLon() + awc.getLonSpan() / 2); bounds.addPoint(awc.getLat() - awc.getLatSpan() / 2, awc.getLon() - awc.getLonSpan() / 2); } if (bounds.isEmpty()) { config.put("centerLat", 0.0); config.put("centerLon", 0.0); config.put("spanLat", 180.0); config.put("spanLon", 180.0); } else { config.put("centerLat", (bounds.getMinLat() + bounds.getMaxLat()) / 2); config.put("centerLon", (bounds.getMinLon() + bounds.getMaxLon()) / 2); config.put("spanLat", bounds.getMaxLat() - bounds.getMinLat()); config.put("spanLon", bounds.getMaxLon() - bounds.getMinLon()); } return config; }
AgencyBean agency = agencyWithCoverage.getAgency(); System.out.println("agency=" + agency.getId());
AgencyBean agency = agencyWithCoverage.getAgency(); System.out.println("agency=" + agency.getId());
AgencyBean agency = agencyWithCoverage.getAgency(); System.out.println("agency=" + agency.getId());
AgencyBean agency = agencyWithCoverage.getAgency();