use of net.sf.marineapi.nmea.util.Position in project marine-api by ktuukkan.
the class GLLTest method testSetPositionWithNonZeroValues.
/**
* Test method for
* {@link net.sf.marineapi.nmea.parser.GLLParser#setPosition(Position)}.
*/
@Test
public void testSetPositionWithNonZeroValues() {
final double lat = 60 + (11.552 / 60);
final double lon = 25 + (1.941 / 60);
Position p2 = new Position(lat, lon);
instance.setPosition(p2);
final String s2 = instance.toString();
final Position p = instance.getPosition();
assertTrue(s2.contains(",6011.552,N,"));
assertTrue(s2.contains(",02501.941,E,"));
assertNotNull(p);
assertEquals(lat, p.getLatitude(), 0.0000001);
assertEquals(lon, p.getLongitude(), 0.0000001);
}
use of net.sf.marineapi.nmea.util.Position in project marine-api by ktuukkan.
the class GGATest method testSetPosition.
@Test
public void testSetPosition() {
final double lat = 61 + (1.111 / 60);
final double lon = 27 + (7.777 / 60);
final double alt = 11.1;
Position p = new Position(lat, lon);
p.setAltitude(alt);
gga.setPosition(p);
final String str = gga.toString();
assertTrue(str.contains(",6101.111,N,"));
assertTrue(str.contains(",02707.777,E,"));
Position wp = gga.getPosition();
assertNotNull(wp);
assertEquals(lat, wp.getLatitude(), 0.0000001);
assertEquals(lon, wp.getLongitude(), 0.0000001);
assertEquals(CompassPoint.NORTH, wp.getLatitudeHemisphere());
assertEquals(CompassPoint.EAST, wp.getLongitudeHemisphere());
assertEquals(alt, wp.getAltitude(), 0.01);
}
use of net.sf.marineapi.nmea.util.Position in project marine-api by ktuukkan.
the class RMCTest method testGetPosition.
/**
* Test method for
* {@link net.sf.marineapi.nmea.parser.RMCParser#getPosition()}.
*/
@Test
public void testGetPosition() {
final double lat = 60 + (11.552 / 60);
final double lon = 25 + (1.941 / 60);
Position p = rmc.getPosition();
assertNotNull(p);
assertEquals(lat, p.getLatitude(), 0.0000001);
assertEquals(lon, p.getLongitude(), 0.0000001);
assertEquals(CompassPoint.NORTH, p.getLatitudeHemisphere());
assertEquals(CompassPoint.EAST, p.getLongitudeHemisphere());
}
use of net.sf.marineapi.nmea.util.Position in project marine-api by ktuukkan.
the class GNSTest method setPosition.
@Test
public void setPosition() throws Exception {
final double LAT = 61.23456;
final double LON = 21.23456;
empty.setPosition(new Position(LAT, LON));
Position p = empty.getPosition();
assertEquals(LAT, p.getLatitude(), 0.00001);
assertEquals(CompassPoint.NORTH, p.getLatitudeHemisphere());
assertEquals(LON, p.getLongitude(), 0.00001);
assertEquals(CompassPoint.EAST, p.getLongitudeHemisphere());
}
use of net.sf.marineapi.nmea.util.Position in project marine-api by ktuukkan.
the class GNSTest method getPosition.
@Test
public void getPosition() throws Exception {
// 4332.69262,S,17235.48549,E
final double LAT = -(43 + 32.69262 / 60);
final double LON = 172 + 35.48549 / 60;
Position p = gns.getPosition();
assertEquals(LAT, p.getLatitude(), 0.00001);
assertEquals(CompassPoint.SOUTH, p.getLatitudeHemisphere());
assertEquals(LON, p.getLongitude(), 0.00001);
assertEquals(CompassPoint.EAST, p.getLongitudeHemisphere());
}
Aggregations