use of net.sf.marineapi.nmea.util.Position in project marine-api by ktuukkan.
the class PositionParserTest method testSetPositionValuesNE.
/**
* Test method for
* {@link net.sf.marineapi.nmea.parser.PositionParser#setPositionValues(Position, int, int, int, int)
*/
@Test
public void testSetPositionValuesNE() {
final double lat = 60 + (11.552 / 60);
final double lon = 25 + (1.941 / 60);
Position p2 = new Position(lat, lon);
instance.setPositionValues(p2, 0, 1, 2, 3);
final String s2 = instance.toString();
final Position p = instance.parsePosition(0, 1, 2, 3);
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 RMCTest method testSetPosition.
@Test
public void testSetPosition() {
final double lat = 61 + (1.111 / 60);
final double lon = 27 + (7.777 / 60);
Position p = new Position(lat, lon);
rmc.setPosition(p);
String str = rmc.toString();
Position wp = rmc.getPosition();
assertTrue(str.contains(",6101.111,N,02707.777,E,"));
assertNotNull(wp);
assertEquals(lat, wp.getLatitude(), 0.0000001);
assertEquals(lon, wp.getLongitude(), 0.0000001);
assertEquals(CompassPoint.NORTH, wp.getLatitudeHemisphere());
assertEquals(CompassPoint.EAST, wp.getLongitudeHemisphere());
}
use of net.sf.marineapi.nmea.util.Position in project marine-api by ktuukkan.
the class GLLTest method testGetPosition.
/**
* Test method for
* {@link net.sf.marineapi.nmea.parser.GLLParser#getPosition()}.
*/
@Test
public void testGetPosition() {
final double lat = 60 + (11.552 / 60);
final double lon = 25 + (1.941 / 60);
Position p = instance.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 GGATest method testGetPosition.
@Test
public void testGetPosition() {
// expected lat/lon values
final double lat = 60 + (11.552 / 60);
final double lon = 25 + (1.941 / 60);
final double alt = 28.0;
Position p = gga.getPosition();
assertNotNull(p);
assertEquals(lat, p.getLatitude(), 0.0000001);
assertEquals(CompassPoint.NORTH, p.getLatitudeHemisphere());
assertEquals(lon, p.getLongitude(), 0.0000001);
assertEquals(CompassPoint.EAST, p.getLongitudeHemisphere());
assertEquals(Datum.WGS84, p.getDatum());
assertEquals(alt, p.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());
}
Aggregations