Package edu.caltech.csn.geocell

Examples of edu.caltech.csn.geocell.GeocellContainer


  @Test
  public void testToFromGeohashString() {
    final Converter<String> converter = new GeohashConv();
    for (Point pt : TestLocations.getLocations().values()) {
      final GeocellContainer gc = new GeocellContainer(pt, 1);

      // For the entire range of Geohash resolutions.
      for (int i = 5; i < 55; i += 5) {
        gc.changeResolution(i);
        final String t = converter.fromGeocellContainer(gc);
        final long geocell = converter.toGeocell(t);
        assertEquals(gc.getGeocell(), geocell);
      }
    }
  }
View Full Code Here


  @Test
  public void testToFromGeoModelString() {
    final Converter<String> geoModelConv = new GeoModelConv();
    for (Point pt : TestLocations.getLocations().values()) {
      final GeocellContainer gc = new GeocellContainer(pt, 1);

      // For the entire range of Geomodel resolutions.
      // (Library unofficially supports non-multiples of 4).
      for (int i = 4; i < 58; i++) {
        gc.changeResolution(i);
        final String t = geoModelConv.fromGeocellContainer(gc);
        final long geocell = geoModelConv.toGeocell(t);
        assertEquals(gc.getGeocell(), geocell);
      }
    }
  }
View Full Code Here

public class GeocellContainerConv implements Converter<GeocellContainer> {

  @Override
  public GeocellContainer fromGeocellContainer(final GeocellContainer geocellContainer) {
    // Clone required because containers are mutable.
    return new GeocellContainer(geocellContainer);
  }
View Full Code Here

    return convertedGeocell.getGeocell();
  }

  @Override
  public GeocellContainer fromGeocell(final long geocell) {
    return new GeocellContainer(geocell);
  }
View Full Code Here

  @Test
  public void testToFromGeostring() {
    final Converter<String> geostringConv = new GeostringConv();
    for (Point pt : TestLocations.getLocations().values()) {
      final GeocellContainer gc = new GeocellContainer(pt, 1);

      // For the entire range of Geostring resolutions.
      for (int i = 1; i < 58; i++) {
        gc.changeResolution(i);
        final String t = geostringConv.fromGeocellContainer(gc);
        final long geocell = geostringConv.toGeocell(t);
        assertEquals(gc.getGeocell(), geocell);
      }
    }
  }
View Full Code Here

  @Test
  public void testToFromLongGeocell() {
    final Converter<Integer> converter = new GeocellIntConv();
    for (Point pt : TestLocations.getLocations().values()) {
      final GeocellContainer gc = new GeocellContainer(pt, 1);

      // For the entire range of GeocellInt resolutions.
      for (int i = 1; i < 27; i++) {
        gc.changeResolution(i);
        final int t = converter.fromGeocellContainer(gc);
        final long geocell = converter.toGeocell(t);
        assertEquals(gc.getGeocell(), geocell);
      }
    }
  }
View Full Code Here

TOP

Related Classes of edu.caltech.csn.geocell.GeocellContainer

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.