Geo { public static double mapToLon(final double value) { double lon = (((((value >= 0) ? value : -value) + 180) % 360) - 180) * ((value >= 0) ? 1.0 : -1.0); if (Double.compare(lon, 180.0) == 0) { lon = -lon; } assert MathUtils.isBetween(lon, -180.0, LON180) : "Longitude not in [-180, 180): " + lon; return lon; } private  Geo(); @Nonnull static GeoRectangle grow(@Nullable final GeoRectangle rectangle, @Nonnull final GeoPoint point); static double degreesLatToMeters(final double latDegrees); static double degreesLonToMetersAtLat(final double lonDegrees, final double lat); static double metersToDegreesLat(final double northMeters); static double metersToDegreesLonAtLat(final double eastMeters, final double lat); static double distanceInMeters(@Nonnull final GeoPoint p1, @Nonnull final GeoPoint p2); static double mapToLat(final double lat); static double mapToLon(final double value); @Nonnull static Duration estimatedMinTravelTime(
            @Nonnull final GeoPoint from,
            @Nonnull final GeoPoint to); @Nonnull static Duration estimatedMinTravelTime(
            @Nonnull final GeoPoint from,
            @Nonnull final GeoPoint to,
            final int roundToMeters); static final double EARTH_RADIUS_X_METERS; static final double EARTH_RADIUS_Y_METERS; static final double EARTH_CIRCUMFERENCE_X; static final double EARTH_CIRCUMFERENCE_Y; static final double METERS_PER_DEGREE_LAT; static final double METERS_PER_DEGREE_LON_EQUATOR; static final double LON180; }
@Test public void testMapToLon() { LOG.info("testMapToLon"); assertEquals(0, mapToLon(0), DELTA); assertEquals(-1, mapToLon(-1), DELTA); assertEquals(-180, mapToLon(-180), DELTA); assertEquals(LON180, mapToLon(LON180), DELTA); assertEquals(-180, mapToLon(180), DELTA); assertEquals(-180, mapToLon(-180), DELTA); assertEquals(-160, mapToLon(200), DELTA); assertEquals(160, mapToLon(-200), DELTA); assertTrue(abs(mapToLon(-360)) < DELTA); assertTrue(abs(mapToLon(360)) < DELTA); }