/** * This returns true when the line between pt1 and pt2 crosses the seam. * When the cone is flattened, the "seam" is lon0 +- 180. * * @param pt1 point 1 * @param pt2 point 2 * @return true when the line between pt1 and pt2 crosses the seam. */ public boolean crossSeam(ProjectionPoint pt1, ProjectionPoint pt2) { return (pt1.getX() * pt2.getX() < 0); }
/** * Does the line between these two points cross the projection "seam". * * @param pt1 the line goes between these two points * @param pt2 the line goes between these two points * @return false if there is no seam */ public boolean crossSeam(ProjectionPoint pt1, ProjectionPoint pt2) { return Math.abs(pt1.getX() - pt2.getX()) > 270.0; // ?? LOOK: do I believe this }
@Override public boolean crossSeam(ProjectionPoint pt1, ProjectionPoint pt2) { // either point is infinite if (ProjectionPointImpl.isInfinite(pt1) || ProjectionPointImpl.isInfinite(pt2)) return true; // opposite signed X values, larger then 100 km return (pt1.getX() * pt2.getX() < 0) && (Math.abs(pt1.getX() - pt2.getX()) > 100); }
/** * set x,y location from pt * * @param pt point to use for values */ public void setLocation(ProjectionPoint pt) { setLocation(pt.getX(), pt.getY()); }
/** * set x,y location from pt * * @param pt point to use for values */ public void setLocation(ProjectionPoint pt) { setLocation(pt.getX(), pt.getY()); }
/** * Convert projection coordinates to a LatLonPoint * Note: a new object is not created on each call for the return value. * * @param world convert from these projection coordinates * @param result the object to write to * @return LatLonPoint convert to these lat/lon coordinates */ public LatLonPoint projToLatLon(ProjectionPoint world, LatLonPointImpl result) { return convert2latlon.projToLatLon(world.getX(), world.getY(), result); }
@Override public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl destPoint) { pixcoord2geocoord(ppt.getX(), ppt.getY(), destPoint); return destPoint; }
private static void toProj(ProjectionImpl p, double lat, double lon) { System.out.printf("lon,lat = %f %f%n", lon, lat); ProjectionPoint pt = p.latLonToProj(lat, lon); System.out.printf("x,y = %f %f%n", pt.getX(), pt.getY()); LatLonPoint ll = p.projToLatLon(pt); System.out.printf("lon,lat = %f %f%n%n", ll.getLongitude(), ll.getLatitude()); }
private static void fromProj(ProjectionImpl p, double x, double y) { System.out.printf("x,y = %f %f%n", x,y); LatLonPoint ll = p.projToLatLon(x, y); System.out.printf("lon,lat = %f %f%n", ll.getLongitude(), ll.getLatitude()); ProjectionPoint pt = p.latLonToProj(ll); System.out.printf("x,y = %f %f%n%n", pt.getX(), pt.getY()); }
private static void toProj(ProjectionImpl p, double lat, double lon) { System.out.printf("lon,lat = %f %f%n", lon, lat); ProjectionPoint pt = p.latLonToProj(lat, lon); System.out.printf("x,y = %f %f%n", pt.getX(), pt.getY()); LatLonPoint ll = p.projToLatLon(pt); System.out.printf("lon,lat = %f %f%n%n", ll.getLongitude(), ll.getLatitude()); }
private static void fromProj(ProjectionImpl p, double x, double y) { System.out.printf("x,y = %f %f%n", x,y); LatLonPoint ll = p.projToLatLon(x, y); System.out.printf("lon,lat = %f %f%n", ll.getLongitude(), ll.getLatitude()); ProjectionPoint pt = p.latLonToProj(ll); System.out.printf("x,y = %f %f%n%n", pt.getX(), pt.getY()); }
private static void fromProj(ProjectionImpl p, double x, double y) { System.out.printf("x,y = %f %f%n", x,y); LatLonPoint ll = p.projToLatLon(x, y); System.out.printf("lon,lat = %f %f%n", ll.getLongitude(), ll.getLatitude()); ProjectionPoint pt = p.latLonToProj(ll); System.out.printf("x,y = %f %f%n%n", pt.getX(), pt.getY()); }
/** * Returns true if this represents the same point as pt. * * @param pt point to check * @return true if this represents the same point as pt. */ public boolean equals(ProjectionPoint pt) { return (pt.getX() == getX()) && (pt.getY() == getY()); }
/** * Get the Lower Right Point * * @return the Lower Right Point */ public ProjectionPoint getLowerRightPoint() { return new ProjectionPointImpl(getMaxPoint().getX(), getMinPoint().getY()); }
@Override public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl destPoint) { double x = ppt.getX(); double y = ppt.getY(); if (isGeoCoordinateScaled) x = x * geoCoordinateScaleFactor; double[] lonlat = navigation.satToEarth(x, y); destPoint.setLongitude(lonlat[0]); destPoint.setLatitude(lonlat[1]); return destPoint; }
/** * Get the Upper Left Point * * @return the Upper Left Point */ public ProjectionPoint getUpperLeftPoint() { return new ProjectionPointImpl(getMinPoint().getX(), getMaxPoint().getY()); }
@Override public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl destPoint) { double[] lonlat = navigation.satToEarth(ppt.getX(), ppt.getY()); destPoint.setLongitude(lonlat[0]); destPoint.setLatitude(lonlat[1]); return destPoint; }
/** * Returns true if this represents the same point as pt, using Misc.closeEnough. * * @param pt2 point to check against * @return true if this represents the same point as pt2. */ public boolean closeEnough(ProjectionPoint pt2) { return Misc.closeEnough(getX(), pt2.getX()) && Misc.closeEnough(getY(), pt2.getY()); }
/** * Returns true if this represents the same point as pt, using Misc.closeEnough. * * @param pt2 point to check against * @return true if this represents the same point as pt2. */ public boolean closeEnough(ProjectionPoint pt2) { return Misc.closeEnough(getX(), pt2.getX()) && Misc.closeEnough(getY(), pt2.getY()); }
@Test public void testGetLowerLeftPoint() { ProjectionPoint getllp = projectionRect.getLowerLeftPoint(); double llx = projectionRect.getMinX(); double lly = projectionRect.getMinY(); double urx = projectionRect.getMaxX(); double ury = projectionRect.getMaxY(); assertEquals(llx, getllp.getX(), 0); assertEquals(lly, getllp.getY(), 0); assertNotEquals(urx, getllp.getX()); assertNotEquals(ury, getllp.getY()); }