Examples of XYPoint


Examples of org.onebusaway.geospatial.model.XYPoint

    ShapePointsLibrary spl = new ShapePointsLibrary();
    List<XYPoint> projectedShapePoints = spl.getProjectedShapePoints(
        shapePoints, projection);

    XYPoint stopPoint = projection.forward(new CoordinatePoint(
        47.664922340500475, -122.29066873484038));

    double[] distanceAlongShape = {0.0, 405.7, 814.0};
    List<PointAndIndex> assignments = spl.computePotentialAssignments(
        projectedShapePoints, distanceAlongShape, stopPoint, 0, 3);
View Full Code Here

Examples of org.onebusaway.geospatial.model.XYPoint

    assertEquals(445.4, assignment.distanceAlongShape, 0.1);
    assertEquals(6.2, assignment.distanceFromTarget, 0.1);
  }

  private XYPoint p(double x, double y) {
    return new XYPoint(x, y);
  }
View Full Code Here

Examples of org.onebusaway.geospatial.model.XYPoint

  private double[] shapePointDistances(List<XYPoint> points) {
    double[] distances = new double[points.size()];
    double accumulatedDistance = 0;
    for (int i = 0; i < points.size(); i++) {
      XYPoint point = points.get(i);
      if (i > 0)
        accumulatedDistance += point.getDistance(points.get(i - 1));
      distances[i] = accumulatedDistance;
    }
    return distances;
  }
View Full Code Here

Examples of org.onebusaway.geospatial.model.XYPoint

     */
    boolean previousEndpointDistanceGreaterThanSnappedDistance = false;
    double previousEndpointDistance = Double.POSITIVE_INFINITY;

    for (int i = fromIndex; i < toIndex - 1; i++) {
      XYPoint from = projectedShapePoints.get(i);
      XYPoint to = projectedShapePoints.get(i + 1);

      XYPoint location = GeometryLibrary.projectPointToSegment(targetPoint,
          from, to);
      double d = location.getDistance(targetPoint);
      double distanceAlongShape = shapePointDistance[i]
          + location.getDistance(from);
      PointAndIndex pindex = new PointAndIndex(location, i, d,
          distanceAlongShape);
      min.add(d, pindex);

      if (d <= _localMinimumThreshold) {
View Full Code Here

Examples of org.onebusaway.geospatial.model.XYPoint

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

    UTMProjection projection = new UTMProjection(10);
    projection.forward(points, results, 2);

    XYPoint p0 = results.get(0);
    XYPoint p1 = results.get(1);

    assertEquals(552186.99, p0.getX(), 0.01);
    assertEquals(5278143.40, p0.getY(), 0.01);

    assertEquals(553366.76, p1.getX(), 0.01);
    assertEquals(5279793.45, p1.getY(), 0.01);
  }
View Full Code Here

Examples of org.onebusaway.geospatial.model.XYPoint

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

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

Examples of org.onebusaway.geospatial.model.XYPoint

        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

Examples of org.onebusaway.geospatial.model.XYPoint

  private void printLineString(PrintWriter out, UTMProjection proj,
      LineString line, boolean latFirst) {
    for (int i = 0; i < line.getNumPoints(); i++) {
      Point point = line.getPointN(i);
      XYPoint p = new XYPoint(point.getX(), point.getY());
      CoordinatePoint c = proj.reverse(p);
      if (latFirst)
        out.println(c.getLat() + " " + c.getLon());
      else
        out.println(c.getLon() + " " + c.getLat());
View Full Code Here

Examples of org.onebusaway.geospatial.model.XYPoint

      if (_projection == null) {
        int zone = UTMLibrary.getUTMZoneForLongitude(stop.getLon());
        _projection = new UTMProjection(zone);
      }

      XYPoint point = _projection.forward(new CoordinatePoint(stop.getLat(),
          stop.getLon()));

      Point p = _factory.createPoint(new Coordinate(point.getX(), point.getY()));
      Geometry geometry = p.buffer(_bufferRadiusInMeters).getEnvelope();

      if (_geometry == null)
        _geometry = geometry;
      else
View Full Code Here

Examples of org.onebusaway.geospatial.model.XYPoint

      double latTo, double lonTo) {

    double d = distance(latFrom, lonFrom, latTo, lonTo);
    CoordinateBounds bounds = bounds(latFrom, lonFrom, d);

    XYPoint origin = new XYPoint(lonFrom, latFrom);
    XYPoint axis = new XYPoint(bounds.getMaxLon(), latFrom);
    XYPoint target = new XYPoint(lonTo, latTo);

    double angle = GeometryLibrary.getAngle(origin, axis, target);
    if (latTo < latFrom)
      angle = 2 * Math.PI - angle;

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.