Search in sources :

Example 16 with Position

use of net.sf.marineapi.nmea.util.Position in project marine-api by ktuukkan.

the class PositionParserTest method testSetPositionValuesSW.

/**
	 * Test method for 
	 * {@link net.sf.marineapi.nmea.parser.PositionParser#setPositionValues(Position, int, int, int, int)
	 */
@Test
public void testSetPositionValuesSW() {
    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,S,"));
    assertTrue(s2.contains(",02501.941,W,"));
    assertNotNull(p);
    assertEquals(lat, p.getLatitude(), 0.0000001);
    assertEquals(lon, p.getLongitude(), 0.0000001);
}
Also used : Position(net.sf.marineapi.nmea.util.Position) Test(org.junit.Test)

Aggregations

Position (net.sf.marineapi.nmea.util.Position)16 Test (org.junit.Test)11 DataNotAvailableException (net.sf.marineapi.nmea.parser.DataNotAvailableException)1 GGASentence (net.sf.marineapi.nmea.sentence.GGASentence)1 GLLSentence (net.sf.marineapi.nmea.sentence.GLLSentence)1 RMCSentence (net.sf.marineapi.nmea.sentence.RMCSentence)1 Sentence (net.sf.marineapi.nmea.sentence.Sentence)1 VTGSentence (net.sf.marineapi.nmea.sentence.VTGSentence)1 CompassPoint (net.sf.marineapi.nmea.util.CompassPoint)1 Date (net.sf.marineapi.nmea.util.Date)1 FaaMode (net.sf.marineapi.nmea.util.FaaMode)1 GpsFixQuality (net.sf.marineapi.nmea.util.GpsFixQuality)1 Time (net.sf.marineapi.nmea.util.Time)1 PositionEvent (net.sf.marineapi.provider.event.PositionEvent)1