@Test public void testGetLatitudeAsString() { assertEquals("00 00.000N", Position.create(0.0, 0.0).getLatitudeAsString()); assertEquals("90 00.000N", Position.create(90.0, 0.0).getLatitudeAsString()); assertEquals("90 00.000S", Position.create(-90.0, 0.0).getLatitudeAsString()); assertEquals("01 00.000N", Position.create(1.0, 0.0).getLatitudeAsString()); assertEquals("01 00.000S", Position.create(-1.0, 0.0).getLatitudeAsString()); assertEquals("56 25.927N", Position.create(56.432111, 0.0).getLatitudeAsString()); assertEquals("56 25.927S", Position.create(-56.432111, 0.0).getLatitudeAsString()); assertEquals("55 00.000N", Position.create(55.0, 0.0).getLatitudeAsString()); assertEquals("56 07.400N", Position.create(56.123325, 0.0).getLatitudeAsString()); assertEquals("56 07.450N", Position.create(56.124171, 0.0).getLatitudeAsString()); assertEquals("01 00.000N", Position.create(1.0, 0.0).getLatitudeAsString()); assertEquals("56 07.407N", Position.create(56.123456, 0.0).getLatitudeAsString()); assertEquals("01 00.000N", Position.create(1.0, 0.0).getLatitudeAsString()); assertEquals("55 34.046N", Position.create(55.567435, 0.0).getLatitudeAsString()); }
public String getLatitudeAsString() { double lat = latitude; if (lat < 0) { lat *= -1; } int hours = (int) lat; lat -= hours; lat *= 60; StringBuilder latitudeAsString = new StringBuilder(16); latitudeAsString.append(format00(hours)); latitudeAsString.append(" "); latitudeAsString.append(format00((int) lat)); latitudeAsString.append("."); latitudeAsString.append(format000((int) Math.round(1000 * (lat - (int) lat)))); latitudeAsString.append(latitude < 0 ? "S" : "N"); return latitudeAsString.toString(); }
Position implements Message, Serializable { public String getLatitudeAsString() { double lat = latitude; if (lat < 0) { lat *= -1; } int hours = (int) lat; lat -= hours; lat *= 60; StringBuilder latitudeAsString = new StringBuilder(16); latitudeAsString.append(format00(hours)); latitudeAsString.append(" "); latitudeAsString.append(format00((int) lat)); latitudeAsString.append("."); latitudeAsString.append(format000((int) Math.round(1000 * (lat - (int) lat)))); latitudeAsString.append(latitude < 0 ? "S" : "N"); return latitudeAsString.toString(); } }
Position implements Message, Serializable { public String getLatitudeAsString() { double lat = latitude; if (lat < 0) { lat *= -1; } int hours = (int) lat; lat -= hours; lat *= 60; StringBuilder latitudeAsString = new StringBuilder(16); latitudeAsString.append(format00(hours)); latitudeAsString.append(" "); latitudeAsString.append(format00((int) lat)); latitudeAsString.append("."); latitudeAsString.append(format000((int) Math.round(1000 * (lat - (int) lat)))); latitudeAsString.append(latitude < 0 ? "S" : "N"); return latitudeAsString.toString(); } Position(double latitude, double longitude); }
Position implements Message, Serializable { public String getLatitudeAsString() { double lat = latitude; if (lat < 0) { lat *= -1; } int hours = (int) lat; lat -= hours; lat *= 60; StringBuilder latitudeAsString = new StringBuilder(16); latitudeAsString.append(format00(hours)); latitudeAsString.append(" "); latitudeAsString.append(format00((int) lat)); latitudeAsString.append("."); latitudeAsString.append(format000((int) Math.round(1000 * (lat - (int) lat)))); latitudeAsString.append(latitude < 0 ? "S" : "N"); return latitudeAsString.toString(); } Position(double latitude, double longitude); @Override boolean equals(Object other); boolean equals(Position other); double geodesicDistanceTo(Position other); double geodesicFinalBearingTo(Position other); double geodesicInitialBearingTo(Position other); long getCell(double degress); int getCellInt(double degress); double getLatitude(); String getLatitudeAsString(); double getLongitude(); String getLongitudeAsString(); @Override int hashCode(); @Override Position immutable(); double rhumbLineBearingTo(Position position); double rhumbLineDistanceTo(Position other); String toJSON(); long toPackedLong(); @Override String toString(); String toStringDegrees(); Position withLatitude(double latitude); Position withLongitude(double longitude); PositionTime withTime(long time); static Position create(double latitude, double longitude); static Position fromBinary(Binary b); Binary toBinary(); static Position fromPackedLong(long l); static boolean isValid(double latitude, double longitude); static Position random(); static Position random(Random rnd); static double verifyLatitude(double latitude); static double verifyLongitude(double longitude); }
Position implements Message, Serializable { public String getLatitudeAsString() { double lat = latitude; if (lat < 0) { lat *= -1; } int hours = (int) lat; lat -= hours; lat *= 60; StringBuilder latitudeAsString = new StringBuilder(16); latitudeAsString.append(format00(hours)); latitudeAsString.append(" "); latitudeAsString.append(format00((int) lat)); latitudeAsString.append("."); latitudeAsString.append(format000((int) Math.round(1000 * (lat - (int) lat)))); latitudeAsString.append(latitude < 0 ? "S" : "N"); return latitudeAsString.toString(); } Position(double latitude, double longitude); @Override boolean equals(Object other); boolean equals(Position other); double geodesicDistanceTo(Position other); double geodesicFinalBearingTo(Position other); double geodesicInitialBearingTo(Position other); long getCell(double degress); int getCellInt(double degress); double getLatitude(); String getLatitudeAsString(); double getLongitude(); String getLongitudeAsString(); @Override int hashCode(); @Override Position immutable(); double rhumbLineBearingTo(Position position); double rhumbLineDistanceTo(Position other); String toJSON(); long toPackedLong(); @Override String toString(); String toStringDegrees(); Position withLatitude(double latitude); Position withLongitude(double longitude); PositionTime withTime(long time); static Position create(double latitude, double longitude); static Position fromBinary(Binary b); Binary toBinary(); static Position fromPackedLong(long l); static boolean isValid(double latitude, double longitude); static Position random(); static Position random(Random rnd); static double verifyLatitude(double latitude); static double verifyLongitude(double longitude); static final MessageSerializer<Position> SERIALIZER; }