コード例 #1
0
 @Test
 public void testParseDestinationPosition() {
   Wgs84Position position =
       format.parseCommentPosition("L339/Wuppertaler Strasse @50.918890,7.560880 ");
   assertDoubleEquals(7.560880, position.getLongitude());
   assertDoubleEquals(50.918890, position.getLatitude());
   assertEquals("L339/Wuppertaler Strasse", position.getDescription());
 }
コード例 #2
0
ファイル: TcxFormat.java プロジェクト: silros/RouteConverter
 protected Short getHeartBeatRate(Wgs84Position position) {
   if (position != null) {
     WptType wpt = position.getOrigin(WptType.class);
     if (wpt != null) {
       Double heartBeatRate = getHeartBeatRate(wpt);
       if (heartBeatRate != null) return heartBeatRate.shortValue();
     }
   }
   return null;
 }
コード例 #3
0
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Wgs84Position that = (Wgs84Position) o;

    return !(comment != null ? !comment.equals(that.comment) : that.comment != null)
        && !(getElevation() != null
            ? !getElevation().equals(that.getElevation())
            : that.getElevation() != null)
        && !(heading != null ? !heading.equals(that.heading) : that.heading != null)
        && !(latitude != null ? !latitude.equals(that.latitude) : that.latitude != null)
        && !(longitude != null ? !longitude.equals(that.longitude) : that.longitude != null)
        && !(getTime() != null ? !getTime().equals(that.getTime()) : that.getTime() != null)
        && !(hdop != null ? !hdop.equals(that.hdop) : that.hdop != null)
        && !(pdop != null ? !pdop.equals(that.pdop) : that.pdop != null)
        && !(vdop != null ? !vdop.equals(that.vdop) : that.vdop != null)
        && !(satellites != null ? !satellites.equals(that.satellites) : that.satellites != null);
  }
コード例 #4
0
 @Test
 public void testParseWWWNoCoordinatesFromInput8() {
   List<Wgs84Position> positions = parsePositions(INPUT8_WWW_NO_COORDINATES);
   assertNotNull(positions);
   assertEquals(2, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertNull(position1.getLongitude());
   assertNull(position1.getLatitude());
   assertEquals("hannover", position1.getDescription());
   Wgs84Position position2 = positions.get(1);
   assertNull(position2.getLongitude());
   assertNull(position2.getLatitude());
   assertEquals("hamburg", position2.getDescription());
 }
コード例 #5
0
 @Test
 public void testParsePositionsFromInput3() {
   List<Wgs84Position> positions = parsePositions(INPUT3);
   assertNotNull(positions);
   assertEquals(2, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertNull(position1.getLongitude());
   assertNull(position1.getLatitude());
   assertEquals("L\u00fcbeck, Germany", position1.getDescription());
   Wgs84Position position2 = positions.get(1);
   assertNull(position2.getLongitude());
   assertNull(position2.getLatitude());
   assertEquals("Hamburg, Germany", position2.getDescription());
 }
コード例 #6
0
 @Test
 public void testParseGeocodePositionsFromInput5() {
   List<Wgs84Position> positions = parsePositions(INPUT5);
   assertNotNull(positions);
   assertEquals(2, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertDoubleEquals(-78.922058, position1.getLongitude());
   assertDoubleEquals(40.323122, position1.getLatitude());
   assertEquals("326 Napoleon St, Johnstown, PA 15901 (War Memorial)", position1.getDescription());
   Wgs84Position position2 = positions.get(1);
   assertDoubleEquals(-79.950354, position2.getLongitude());
   assertDoubleEquals(40.443995, position2.getLatitude());
   assertEquals(
       "4400 Forbes Ave, Pittsburgh, PA 15213 (Carnegie Museums )", position2.getDescription());
 }
コード例 #7
0
  protected int getBoundsZoomLevel(List<BaseNavigationPosition> positions) {
    if ((positions == null) || (positions.size() < 1)) return 0;

    Wgs84Position northEast = Positions.northEast(positions);
    Wgs84Position southWest = Positions.southWest(positions);

    StringBuffer buffer = new StringBuffer();
    buffer
        .append("return map.getBoundsZoomLevel(new GLatLngBounds(")
        .append("new GLatLng(")
        .append(northEast.getLatitude())
        .append(",")
        .append(northEast.getLongitude())
        .append("),")
        .append("new GLatLng(")
        .append(southWest.getLatitude())
        .append(",")
        .append(southWest.getLongitude())
        .append(")")
        .append("));");

    String zoomLevel = executeScriptWithResult(buffer.toString());
    return zoomLevel != null ? Transfer.parseDouble(zoomLevel).intValue() : 1;
  }
コード例 #8
0
  @Test
  public void testParsePosition() {
    Map<String, String> map = new HashMap<>();
    map.put("Longitude", "11753270");
    map.put("Latitude", "47688350");

    Wgs84Position position1 = format.parsePosition(map);
    assertNotNull(position1);
    assertDoubleEquals(11.75327, position1.getLongitude());
    assertDoubleEquals(47.68835, position1.getLatitude());
    assertNull(position1.getElevation());
    assertNull(position1.getTime());
    assertNull(position1.getDescription());

    map.put("City", "Innsbruck");
    map.put("County", "Tirol");

    Wgs84Position position2 = format.parsePosition(map);
    assertNotNull(position2);
    assertEquals("Innsbruck, Tirol", position2.getDescription());

    map.put("State", "A");

    Wgs84Position position3 = format.parsePosition(map);
    assertNotNull(position3);
    assertEquals("A Innsbruck, Tirol", position3.getDescription());

    map.put("Address", "39 Gumppstrasse");
    map.put("Zip", "6020");

    Wgs84Position position4 = format.parsePosition(map);
    assertNotNull(position4);
    assertEquals("A-6020 Innsbruck, Tirol, 39 Gumppstrasse", position4.getDescription());
  }
コード例 #9
0
 @Test
 public void testParseNewGoogleMaps2015FromInput10() {
   List<Wgs84Position> positions = parsePositions(INPUT10_NEW_GOOGLE_MAPS_2015);
   assertNotNull(positions);
   assertEquals(6, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertNull(position1.getLongitude());
   assertNull(position1.getLatitude());
   assertEquals("Sterzing, Bozen, Italien", position1.getDescription());
   Wgs84Position position2 = positions.get(1);
   assertNull(position2.getLongitude());
   assertNull(position2.getLatitude());
   assertEquals(
       "Jaufenpass, Sankt Leonhard in Passeier, Bozen, Italien", position2.getDescription());
   Wgs84Position position3 = positions.get(2);
   assertNull(position3.getLongitude());
   assertNull(position3.getLatitude());
   assertEquals("Ofenpass, 7532 Cierfs, Schweiz", position3.getDescription());
 }
コード例 #10
0
 @Test
 public void testParseNegativeStartPosition() {
   Wgs84Position position = format.parsePlainPosition("-50.954318,-7.311401");
   assertDoubleEquals(-7.311401, position.getLongitude());
   assertDoubleEquals(-50.954318, position.getLatitude());
 }
コード例 #11
0
 @Test
 public void testParseDestinationPositions() {
   List<Wgs84Position> positions =
       format.parseDestinationPositions(
           "L339/Wuppertaler Strasse @50.918890,7.560880 to: B @ -1.1 , -2.2to:[email protected],4.4");
   assertEquals(3, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertDoubleEquals(7.560880, position1.getLongitude());
   assertDoubleEquals(50.918890, position1.getLatitude());
   assertEquals("L339/Wuppertaler Strasse", position1.getDescription());
   Wgs84Position position2 = positions.get(1);
   assertDoubleEquals(-2.2, position2.getLongitude());
   assertDoubleEquals(-1.1, position2.getLatitude());
   assertEquals("B", position2.getDescription());
   Wgs84Position position3 = positions.get(2);
   assertDoubleEquals(4.4, position3.getLongitude());
   assertDoubleEquals(3.3, position3.getLatitude());
   assertEquals("C", position3.getDescription());
 }
コード例 #12
0
 @Test
 public void testParseNewGoogleMaps2014FromInput9() {
   List<Wgs84Position> positions = parsePositions(INPUT9_NEW_GOOGLE_MAPS_2014);
   assertNotNull(positions);
   assertEquals(3, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertNull(position1.getLongitude());
   assertNull(position1.getLatitude());
   assertEquals("Aachen-Rothe Erde", position1.getDescription());
   Wgs84Position position2 = positions.get(1);
   assertNull(position2.getLongitude());
   assertNull(position2.getLatitude());
   assertEquals("Mainz-Kastel, Wiesbaden", position2.getDescription());
   Wgs84Position position3 = positions.get(2);
   assertNull(position3.getLongitude());
   assertNull(position3.getLatitude());
   assertEquals("Hanns-Martin-Schleyer-Stra\u00dfe, Sindelfingen", position3.getDescription());
 }
コード例 #13
0
 @Test
 public void testParseEncodedGeocodePositionsFromInput7() {
   List<Wgs84Position> positions = parsePositions(INPUT7_GEOCODE);
   assertNotNull(positions);
   assertEquals(4, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertNull(position1.getLongitude());
   assertNull(position1.getLatitude());
   assertEquals("Hamburg/Uhlenhorst", position1.getDescription());
   Wgs84Position position2 = positions.get(2);
   assertDoubleEquals(10.419159, position2.getLongitude());
   assertDoubleEquals(53.588429, position2.getLatitude());
   assertEquals(null, position2.getDescription());
   Wgs84Position position3 = positions.get(3);
   assertEquals(null, position3.getLongitude());
   assertEquals(null, position3.getLatitude());
   assertEquals("Breitenfelde/Neuenlande", position3.getDescription());
 }
コード例 #14
0
 @Test
 public void testParseGeocodePositionsWithViaFromInput6() {
   List<Wgs84Position> positions = parsePositions(INPUT6);
   assertNotNull(positions);
   assertEquals(5, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertDoubleEquals(-78.922058, position1.getLongitude());
   assertDoubleEquals(40.323122, position1.getLatitude());
   assertEquals("326 Napoleon St, Johnstown, PA 15901 (War Memorial)", position1.getDescription());
   Wgs84Position position2 = positions.get(2);
   assertDoubleEquals(-79.14302, position2.getLongitude());
   assertDoubleEquals(40.06483, position2.getLatitude());
   assertEquals("I-70 W/I-76 W/Pennsylvania Turnpike", position2.getDescription());
   Wgs84Position position3 = positions.get(3);
   assertDoubleEquals(-79.434904, position3.getLongitude());
   assertDoubleEquals(40.127779, position3.getLatitude());
   assertEquals("PA-31", position3.getDescription());
   Wgs84Position position4 = positions.get(4);
   assertDoubleEquals(-79.950354, position4.getLongitude());
   assertDoubleEquals(40.443995, position4.getLatitude());
   assertEquals(
       "4400 Forbes Ave, Pittsburgh, PA 15213 (Carnegie Museums )", position4.getDescription());
 }
コード例 #15
0
 @Test
 public void testParsePositionsFromInput1() {
   List<Wgs84Position> positions = parsePositions(INPUT1_EMAIL);
   assertNotNull(positions);
   assertEquals(6, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertNull(position1.getLongitude());
   assertNull(position1.getLatitude());
   assertEquals(
       "H\u00f6lderlinstra\u00dfe, 51545 Br\u00f6l, Oberbergischer Kreis, Nordrhein-Westfalen, Deutschland",
       position1.getDescription());
   Wgs84Position position3 = positions.get(2);
   assertDoubleEquals(7.46395, position3.getLongitude());
   assertDoubleEquals(50.88518, position3.getLatitude());
   assertEquals("L350", position3.getDescription());
   Wgs84Position position6 = positions.get(5);
   assertNull(position6.getLongitude());
   assertNull(position6.getLatitude());
   assertEquals("K\u00f6ln, Riehler Str. 190", position6.getDescription());
 }
コード例 #16
0
 @Test
 public void testParsePositionsFromInput4Stripped() {
   List<Wgs84Position> positions = parsePositions(INPUT4_STRIPPED);
   assertNotNull(positions);
   assertEquals(3, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertDoubleEquals(10.480100, position1.getLongitude());
   assertDoubleEquals(51.125340, position1.getLatitude());
   assertEquals("L1042/Langensaltzaer Strasse", position1.getDescription());
   Wgs84Position position2 = positions.get(1);
   assertDoubleEquals(10.723944, position2.getLongitude());
   assertDoubleEquals(51.116994, position2.getLatitude());
   assertNull(position2.getDescription());
   Wgs84Position position3 = positions.get(2);
   assertDoubleEquals(10.74325, position3.getLongitude());
   assertDoubleEquals(50.9445, position3.getLatitude());
   assertEquals("Friedhofsweg", position3.getDescription());
 }
コード例 #17
0
 @Test
 public void testParsePositionsFromInput2() {
   List<Wgs84Position> positions = parsePositions(INPUT2);
   assertNotNull(positions);
   assertEquals(3, positions.size());
   Wgs84Position position1 = positions.get(0);
   assertNull(position1.getLongitude());
   assertNull(position1.getLatitude());
   assertEquals("51545 Waldbroel, Hoelderlinstr.", position1.getDescription());
   Wgs84Position position2 = positions.get(1);
   assertNull(position2.getLongitude());
   assertNull(position2.getLatitude());
   assertEquals("50389 Wesseling, Urfelder Strasse 221", position2.getDescription());
   Wgs84Position position3 = positions.get(2);
   assertDoubleEquals(6.962585, position3.getLongitude());
   assertDoubleEquals(50.876178, position3.getLatitude());
   assertNull(position3.getDescription());
 }