Examples of CoordinateBounds


Examples of org.onebusaway.geospatial.model.CoordinateBounds

    CoordinatePoint location = new CoordinatePoint(v.getY(), v.getX());

    for (double radius = initialRadius; radius < _walkSearchMaxRadius; radius += _walkSearchStep) {

      CoordinateBounds bounds = SphericalGeometryLibrary.bounds(location,
          radius);

      List<StopEntry> stops = _transitGraphDao.getStopsByLocation(bounds);

      if (stops.isEmpty())
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

public class FederatedByCoordinateBoundsMethodInvocationHandlerImplTest {

  @Test
  public void test01() throws Exception {
   
    CoordinateBounds bounds = new CoordinateBounds(0,1,2,3);

    SimpleFederatedService mockService = Mockito.mock(SimpleFederatedService.class);
    FederatedServiceCollection mockCollection = Mockito.mock(FederatedServiceCollectionImpl.class);
    Mockito.when(mockCollection.getServiceForBounds(bounds)).thenReturn(mockService);
   
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

  }
 
  @Test
  public void test02() throws Exception {
   
    CoordinateBounds bounds = new CoordinateBounds(0,1,2,3);
    CoordinateBoundsTestBean bean = new CoordinateBoundsTestBean();
    bean.setBounds(bounds);
   
    SimpleFederatedService mockService = Mockito.mock(SimpleFederatedService.class);
    FederatedServiceCollection mockCollection = Mockito.mock(FederatedServiceCollectionImpl.class);
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

    Map<String, CoordinateBounds> agencyIdsAndCoverageAreas = _agencyService.getAgencyIdsAndCoverageAreas();
    Map<String, List<CoordinateBounds>> result = new HashMap<String, List<CoordinateBounds>>();
    for (Map.Entry<String, CoordinateBounds> entry : agencyIdsAndCoverageAreas.entrySet()) {
      String agencyId = entry.getKey();
      CoordinateBounds bounds = entry.getValue();
      List<CoordinateBounds> coverage = Arrays.asList(bounds);
      result.put(agencyId, coverage);
    }
    return result;
  }
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

    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;
  }
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

   * Private Methods
   ****/

  private RoutesBean getRoutesWithoutRouteNameQuery(SearchQueryBean query) {

    CoordinateBounds bounds = query.getBounds();

    List<AgencyAndId> stops = _whereGeospatialService.getStopsByBounds(bounds);

    Set<RouteBean> routes = new HashSet<RouteBean>();
    for (AgencyAndId stopId : stops) {
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

      throws ServiceException {

    SearchResult<AgencyAndId> result = searchForRoutes(query);

    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);
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

  @Before
  public void start() throws Exception {

    _server = new Server(PORT);

    addServiceServlet(_server, "A", new CoordinateBounds(0, 0, 10, 10));
    addServiceServlet(_server, "B", new CoordinateBounds(20, 20, 30, 30));

    Map<String, List<CoordinateBounds>> agenciesB = new HashMap<String, List<CoordinateBounds>>();
    agenciesB.put("B", Arrays.asList(new CoordinateBounds(30, 30, 40, 40)));

    _server.start();

    _registry = new FederatedServiceRegistryImpl();
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

    Object value = args[_argumentIndex];

    if (_expression != null)
      value = _expression.invoke(value);

    CoordinateBounds bounds = (CoordinateBounds) value;

    FederatedService service = collection.getServiceForBounds(bounds);
    return method.invoke(service, args);
  }
View Full Code Here

Examples of org.onebusaway.geospatial.model.CoordinateBounds

    SimpleFederatedService serviceA = Mockito.mock(SimpleFederatedService.class);
    SimpleFederatedService serviceB = Mockito.mock(SimpleFederatedService.class);
   
    Map<String, List<CoordinateBounds>> firstProviderAgenciesAndCoverage = new HashMap<String, List<CoordinateBounds>>();
    firstProviderAgenciesAndCoverage.put("a1", Arrays.asList(new CoordinateBounds(1, 1, 3, 3),
        new CoordinateBounds(2, 2, 4, 4)));
    firstProviderAgenciesAndCoverage.put("a2", Arrays.asList(new CoordinateBounds(2, 5, 4, 6)));

    Map<String, List<CoordinateBounds>> secondProviderAgenciesAndCoverage = new HashMap<String, List<CoordinateBounds>>();
    secondProviderAgenciesAndCoverage.put("b1", Arrays.asList(new CoordinateBounds(5, 5, 7, 7),
        new CoordinateBounds(6, 6, 8, 8)));
    secondProviderAgenciesAndCoverage.put("b2", Arrays.asList(new CoordinateBounds(5, 2, 7, 4)));
   
    Mockito.when(serviceA.getAgencyIdsWithCoverageArea()).thenReturn(firstProviderAgenciesAndCoverage);
    Mockito.when(serviceB.getAgencyIdsWithCoverageArea()).thenReturn(secondProviderAgenciesAndCoverage);
   
    LazyFederatedServiceCollectionImpl collection = new LazyFederatedServiceCollectionImpl();
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.