@Test public void testLatToString() { assertThat(LatLonPoints.latToString(89.501, 3)).isEqualTo("89.501N"); assertThat(LatLonPoints.latToString(89.501, 2)).isEqualTo("89.50N"); assertThat(LatLonPoints.latToString(89.501, 1)).isEqualTo("89.5N"); assertThat(LatLonPoints.latToString(89.401, 0)).isEqualTo("89N"); assertThat(LatLonPoints.latToString(99.999, 0)).isEqualTo("100N"); assertThat(LatLonPoints.latToString(99.999, 1)).isEqualTo("100.0N"); assertThat(LatLonPoints.latToString(99.999, 2)).isEqualTo("100.00N"); assertThat(LatLonPoints.latToString(99.999, 3)).isEqualTo("99.999N"); }
public static String latToString(double lat, int ndec) { boolean is_north = (lat >= 0.0); if (!is_north) lat = -lat; String f = "%." + ndec + "f"; Formatter latBuff = new Formatter(); latBuff.format(f, lat); latBuff.format("%s", is_north ? "N" : "S"); return latBuff.toString(); }
LatLonPoints { public static String latToString(double lat, int ndec) { boolean is_north = (lat >= 0.0); if (!is_north) lat = -lat; String f = "%." + ndec + "f"; Formatter latBuff = new Formatter(); latBuff.format(f, lat); latBuff.format("%s", is_north ? "N" : "S"); return latBuff.toString(); } }
LatLonPoints { public static String latToString(double lat, int ndec) { boolean is_north = (lat >= 0.0); if (!is_north) lat = -lat; String f = "%." + ndec + "f"; Formatter latBuff = new Formatter(); latBuff.format(f, lat); latBuff.format("%s", is_north ? "N" : "S"); return latBuff.toString(); }  }
LatLonPoints { public static String latToString(double lat, int ndec) { boolean is_north = (lat >= 0.0); if (!is_north) lat = -lat; String f = "%." + ndec + "f"; Formatter latBuff = new Formatter(); latBuff.format(f, lat); latBuff.format("%s", is_north ? "N" : "S"); return latBuff.toString(); }  static boolean betweenLon(double lon, double lonBeg, double lonEnd); static double lonNormal360(double lon); static double lonNormal(double lon, double center); static double lonNormalFrom(double lon, double start); static double lonNormal(double lon); static double lonDiff(double lon1, double lon2); static double latNormal(double lat); static String latToString(double lat, int ndec); static String lonToString(double lon, int ndec); static boolean isInfinite(ProjectionPoint pt); static double range180(double lon); static String toString(LatLonPoint pt, int sigDigits); static String toString(ProjectionPoint pt, int sigDigits); }
LatLonPoints { public static String latToString(double lat, int ndec) { boolean is_north = (lat >= 0.0); if (!is_north) lat = -lat; String f = "%." + ndec + "f"; Formatter latBuff = new Formatter(); latBuff.format(f, lat); latBuff.format("%s", is_north ? "N" : "S"); return latBuff.toString(); }  static boolean betweenLon(double lon, double lonBeg, double lonEnd); static double lonNormal360(double lon); static double lonNormal(double lon, double center); static double lonNormalFrom(double lon, double start); static double lonNormal(double lon); static double lonDiff(double lon1, double lon2); static double latNormal(double lat); static String latToString(double lat, int ndec); static String lonToString(double lon, int ndec); static boolean isInfinite(ProjectionPoint pt); static double range180(double lon); static String toString(LatLonPoint pt, int sigDigits); static String toString(ProjectionPoint pt, int sigDigits);  }