Package org.onebusaway.geospatial.model

Examples of org.onebusaway.geospatial.model.CoordinatePoint


    if (points.size() < 2)
      return points;

    int minIndex = 0;
    CoordinatePoint minPoint = null;

    for (int index = 0; index < points.size(); index++) {
      CoordinatePoint p = points.get(index);
      if (minPoint == null || POINTS_COMPARATOR.compare(p, minPoint) < 0) {
        minIndex = index;
        minPoint = p;
      }
    }
View Full Code Here


    assertUTMPoint(47.65458077, -122.30502529, 552186.99, 5278143.40);
    assertUTMPoint(47.66933, -122.289114, 553366.76, 5279793.45);

    List<CoordinatePoint> points = new ArrayList<CoordinatePoint>();

    points.add(new CoordinatePoint(47.65458077, -122.30502529));
    points.add(new CoordinatePoint(47.66933, -122.289114));

    List<XYPoint> results = new ArrayList<XYPoint>();

    UTMProjection projection = new UTMProjection(10);
    projection.forward(points, results, 2);
View Full Code Here

    assertEquals(553366.76, p1.getX(), 0.01);
    assertEquals(5279793.45, p1.getY(), 0.01);
  }

  private void assertUTMPoint(double lat, double lon, double x, double y) {
    CoordinatePoint point = new CoordinatePoint(lat, lon);
    int zone = UTMLibrary.getUTMZoneForLongitude(lon);

    UTMProjection projection = new UTMProjection(zone);
    XYPoint p = projection.forward(point);
View Full Code Here

    assertPoint(47.65458077, -122.30502529, 1277729.9998584972,
        242239.0006173002);
  }

  private void assertPoint(double lat, double lon, double x, double y) {
    CoordinatePoint point = new CoordinatePoint(lat, lon);
    XYPoint p = _projection.forward(point);

    assertEquals(x, p.getX(), 0.01);
    assertEquals(y, p.getY(), 0.01);
  }
View Full Code Here

  }

  @Test
  public void testGetCenterOfBounds() {
    CoordinateBounds b = new CoordinateBounds(-1.0, -2.0, 4.0, 3.6);
    CoordinatePoint p = SphericalGeometryLibrary.getCenterOfBounds(b);
    assertEquals(1.5, p.getLat(), 0.0);
    assertEquals(0.8, p.getLon(), 0.0);
  }
View Full Code Here

  }

  @Test
  public void testProjectPointToSegmentApproximate() {

    CoordinatePoint p = new CoordinatePoint(40.737284, -73.955430);
    CoordinatePoint seg1 = new CoordinatePoint(40.737997, -73.955472);
    CoordinatePoint seg2 = new CoordinatePoint(40.734575, -73.954979);

    CoordinatePoint r = SphericalGeometryLibrary.projectPointToSegmentAppropximate(
        p, seg1, seg2);

    assertEquals(40.73729256997116, r.getLat(), 0.0);
    assertEquals(-73.95537051431788, r.getLon(), 0.0);
  }
View Full Code Here

  @Test
  public void testDecode() {
    String polyline = "mz{aHryriV???tE???jE??AlC???lF??AlF??AnF???fF???|F???P?N???lE???T?\\???xD???|@???nD???xB???L?zG???nG?V???jD??qAxC??i@vAKXGTABAJ?B?B??AfF?D@`A??BPBZBr@???d@@`B?V?d@???zBAf@Cb@E^AX??Ad@??AfB?|A??@~G???vF???zF??A`H??WzAUx@??]v@??GL??yAzCg@x@??GH_@b@??c@f@??mC~C??gBtBi@f@??ABMF??cAn@kAl@wE`C??_Aj@C@eAx@a@Z[T??YT]Vg@`@??OVKVGRI`@CVG~@??@fA???pC??@tE??@lB?zA?P??AbN???lL??@hK?vC???N???T??AzN???LAhF?T?fG???dH";
    List<CoordinatePoint> decode = PolylineEncoder.decode(polyline);
    assertEquals(157, decode.size());
    CoordinatePoint p = decode.get(0);
    assertEquals(47.661350000000006, p.getLat(), 1e-5);
    assertEquals(-122.32618000000001, p.getLon(), 1e-5);
  }
View Full Code Here

  @Test
  public void testEncoder() {

    List<CoordinatePoint> points = new ArrayList<CoordinatePoint>();
    points.add(new CoordinatePoint(38.5, -120.2));
    points.add(new CoordinatePoint(40.7, -120.95));
    points.add(new CoordinatePoint(43.252, -126.453));

    String expected = "_p~iF~ps|U_ulLnnqC_mqNvxq`@";

    EncodedPolylineBean actual = PolylineEncoder.createEncodings(points, 0);
    Assert.assertEquals(expected, actual.getPoints());
View Full Code Here

  @Test
  public void test2() {

    List<CoordinatePoint> points = new ArrayList<CoordinatePoint>();
    points.add(new CoordinatePoint(47.67839087880088, -122.27878118907307));
    points.add(new CoordinatePoint(47.67845871865856, -122.27342376951559));
    points.add(new CoordinatePoint(47.682076843204875, -122.2735240417865));

    String expected = "}d_bHlqiiVKo`@sUR";

    EncodedPolylineBean actual = PolylineEncoder.createEncodings(points, 0);
    Assert.assertEquals(expected, actual.getPoints());
View Full Code Here

    this.lat = point.getLat();
    this.lon = point.getLon();
  }

  public CoordinatePoint getLocation() {
    return new CoordinatePoint(lat, lon);
  }
View Full Code Here

TOP

Related Classes of org.onebusaway.geospatial.model.CoordinatePoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.