Search in sources :

Example 1 with Position

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);
}
Also used : Position(net.sf.marineapi.nmea.util.Position) Test(org.junit.Test)

Example 2 with Position

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());
}
Also used : Position(net.sf.marineapi.nmea.util.Position) Test(org.junit.Test)

Example 3 with Position

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());
}
Also used : Position(net.sf.marineapi.nmea.util.Position) Test(org.junit.Test)

Example 4 with Position

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);
}
Also used : Position(net.sf.marineapi.nmea.util.Position) Test(org.junit.Test)

Example 5 with Position

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());
}
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