/** * copy constructor - avoid clone !! */ public ProjectionImpl constructCopy() { return new RotatedPole(northPole.getY(), northPole.getX()); }
private static void test(double lat, double lon) { double radius = 6371.0; VerticalPerspectiveView a = new VerticalPerspectiveView(0, 0, radius, 5.62 * radius); ProjectionPointImpl p = a.latLonToProj(lat, lon); System.out.println("-----\nproj point = " + p); System.out.println("x/r = " + p.getX() / radius); // see snyder p 174 System.out.println("y/r = " + p.getY() / radius); LatLonPoint ll = a.projToLatLon(p); System.out.println(" lat = " + ll.getLatitude() + " should be= " + lat); System.out.println(" lon = " + ll.getLongitude() + " should be= " + lon); }
private static void test(double lat, double lon) { double radius = 6371.0; VerticalPerspectiveView a = new VerticalPerspectiveView(0, 0, radius, 5.62*radius); ProjectionPointImpl p = a.latLonToProj(lat, lon); System.out.println("-----\nproj point = " + p); System.out.println("x/r = " + p.getX()/radius); // see snyder p 174 System.out.println("y/r = " + p.getY()/radius); LatLonPoint ll = a.projToLatLon(p); System.out.println(" lat = "+ll.getLatitude()+ " should be= " + lat); System.out.println(" lon = "+ll.getLongitude()+ " should be= " + lon); }
/** * nicely format this point * * @return nicely formatted point */ public String toString() { return Format.d(getX(), 4) + " " + Format.d(getY(), 4); }
/** * nicely format this point * * @return nicely formatted point */ public String toString() { return Format.d(getX(), 4) + " " + Format.d(getY(), 4); }
/** * 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()); }
/** * nicely format this point * * @return nicely formatted point */ public String toString() { return Format.d(getX(), 4) + " " + Format.d(getY(), 4); }
/** * 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()); }
/** * 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()); }
/** * nicely format this point * * @return nicely formatted point */ public String toString() { return Format.d(getX(), 4) + " " + Format.d(getY(), 4); }
public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl xy) { double lam = Math.toRadians( latlon.getLongitude() - lon0); double phi = Math.toRadians( latlon.getLatitude()); if (earth.isSpherical()) { xy.setLocation(scaleFactor * lam, Math.sin(phi) / scaleFactor); } else { xy.setLocation(scaleFactor * lam, .5 * MapMath.qsfn(Math.sin(phi), e, one_es) / scaleFactor); } xy.setLocation(totalScale * xy.getX() + falseEasting, totalScale * xy.getY() + falseNorthing); return xy; }
public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl xy) { double lam = Math.toRadians( latlon.getLongitude() - lon0); double phi = Math.toRadians( latlon.getLatitude()); if (earth.isSpherical()) { xy.setLocation(scaleFactor * lam, Math.sin(phi) / scaleFactor); } else { xy.setLocation(scaleFactor * lam, .5 * MapMath.qsfn(Math.sin(phi), e, one_es) / scaleFactor); } xy.setLocation(totalScale * xy.getX() + falseEasting, totalScale * xy.getY() + falseNorthing); return xy; }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new RotatedPole(northPole.getY(), northPole.getX()); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new RotatedPole(northPole.getY(), northPole.getX()); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new RotatedPole(northPole.getY(), northPole.getX()); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
/** * 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 testLCseam() { // test seam crossing LambertConformal lc = new LambertConformal(40.0, 180.0, 20.0, 60.0); ProjectionPointImpl p1 = (ProjectionPointImpl) lc.latLonToProj(new LatLonPointImpl(0.0, -1.0), new ProjectionPointImpl()); ProjectionPointImpl p2 = (ProjectionPointImpl) lc.latLonToProj(new LatLonPointImpl(0.0, 1.0), new ProjectionPointImpl()); if (show) { System.out.printf(" p1= x=%f y=%f%n", p1.getX(), p1.getY()); System.out.printf(" p2= x=%f y=%f%n", p2.getX(), p2.getY()); } assert lc.crossSeam(p1, p2); }
public GdsHorizCoordSys makeHorizCoordSys() { ProjectionImpl proj = null; Earth earth = getEarth(); if (earth.isSpherical()) { proj = new ucar.unidata.geoloc.projection.LambertConformal(latin1, lov, latin1, latin2, 0.0, 0.0, earth.getEquatorRadius() * .001); } else { proj = new ucar.unidata.geoloc.projection.proj4.LambertConformalConicEllipse(latin1, lov, latin1, latin2, 0.0, 0.0, earth); } LatLonPointImpl startLL = new LatLonPointImpl(la1, lo1); ProjectionPointImpl start = (ProjectionPointImpl) proj.latLonToProj(startLL); return new GdsHorizCoordSys(getNameShort(), template, 0, scanMode, proj, start.getX(), getDx(), start.getY(), getDy(), getNx(), getNy(), null); }
/** * Test that the unrotated centre lat/lon is the origin of the rotated * projection. */ @Test public void testLatLonToProj() { LatLonPointImpl latlon = new LatLonPointImpl(54, 254); ProjectionPointImpl result = new ProjectionPointImpl(); proj.latLonToProj(latlon, result); Assert.assertEquals("Unexpected rotated longitude", 0, result.getX(), TOLERANCE); Assert.assertEquals("Unexpected rotated latitude", 0, result.getY(), TOLERANCE); }