/** copy constructor - avoid clone !! */ public ProjectionImpl constructCopy() { return new VerticalPerspectiveView( getOriginLat(), getOriginLon(), R, getHeight(), false_east, false_north); }
false_north = false_northing; precalculate(); addParameter(CF.GRID_MAPPING_NAME, CF.VERTICAL_PERSPECTIVE); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.LONGITUDE_OF_PROJECTION_ORIGIN, lon0); addParameter(CF.EARTH_RADIUS, earthRadius * 1000); addParameter(CF.PERSPECTIVE_POINT_HEIGHT, distance * 1000); if (false_easting != 0 || false_northing != 0) { addParameter(CF.FALSE_EASTING, false_easting); addParameter(CF.FALSE_NORTHING, false_northing); addParameter(CDM.UNITS, "km");
/** * Create a String of the parameters. * * @return a String of the parameters */ public String paramsToString() { return toString(); }
/** * Check for equality with the Object in question * * @param proj object to check * @return true if they are equal */ public boolean equals(Object proj) { if ( !(proj instanceof VerticalPerspectiveView)) { return false; } VerticalPerspectiveView oo = (VerticalPerspectiveView) proj; return (this.getOriginLat() == oo.getOriginLat()) && (this.getOriginLon() == oo.getOriginLon()) && (this.getHeight() == oo.getHeight()) && (this.defaultMapArea.equals(oo.defaultMapArea)); }
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); }
double height = 35747.0; VerticalPerspectiveView a = new VerticalPerspectiveView(0, 0, radius, height); ProjectionRect r = a.latLonToProjBB(rect); System.out.println(" ProjectionRect result = " + r);
ProjectionPoint llpt = latLonToProj(rect.getLowerLeftPoint(), new ProjectionPointImpl()); ProjectionPoint urpt = latLonToProj(rect.getUpperRightPoint(), new ProjectionPointImpl()); ProjectionPoint lrpt = latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl()); if (!addGoodPts(goodPts, llpt)) countBad++; if (!addGoodPts(goodPts, urpt)) countBad++; if (!addGoodPts(goodPts, lrpt)) countBad++; if (!addGoodPts(goodPts, ulpt)) countBad++; addGoodPts(goodPts, new ProjectionPointImpl(0, maxR)); addGoodPts(goodPts, new ProjectionPointImpl(maxR, 0)); addGoodPts(goodPts, new ProjectionPointImpl(0, -maxR)); addGoodPts(goodPts, new ProjectionPointImpl(-maxR, 0)); addGoodPts(goodPts, new ProjectionPointImpl(xcoord, getLimitCoord(xcoord))); addGoodPts(goodPts, new ProjectionPointImpl(getLimitCoord(ycoord), ycoord)); } else if (!ProjectionPointImpl.isInfinite(urpt)) { double xcoord = urpt.getX(); addGoodPts(goodPts, new ProjectionPointImpl(xcoord, -getLimitCoord(xcoord)));
/** * Set the height above the earth * @param height height above the earth */ public void setHeight(double height) { H = height; precalculate(); }
public ProjectionCT makeCoordinateTransform(AttributeContainer ctv, String geoCoordinateUnits) { readStandardParams(ctv, geoCoordinateUnits); double distance = readAttributeDouble(ctv, CF.PERSPECTIVE_POINT_HEIGHT, Double.NaN); if (Double.isNaN(distance)) { distance = readAttributeDouble(ctv, "height_above_earth", Double.NaN); } if (Double.isNaN(lon0) || Double.isNaN(lat0) || Double.isNaN(distance)) throw new IllegalArgumentException("Vertical Perspective must have: " + CF.LONGITUDE_OF_PROJECTION_ORIGIN + ", " + CF.LATITUDE_OF_PROJECTION_ORIGIN + ", and " + CF.PERSPECTIVE_POINT_HEIGHT + "(or height_above_earth) " + "attributes"); // We assume distance comes in 'm' (CF-compliant) and we pass in as 'km' ucar.unidata.geoloc.projection.VerticalPerspectiveView proj = new ucar.unidata.geoloc.projection.VerticalPerspectiveView(lat0, lon0, earth_radius, distance / 1000., false_easting, false_northing); return new ProjectionCT(ctv.getName(), "FGDC", proj); } }
/** * Clone this projection. * * @return Clone of this */ public Object clone() { VerticalPerspectiveView cl = (VerticalPerspectiveView) super.clone(); cl.origin = new LatLonPointImpl(getOriginLat(), getOriginLon()); return cl; }
public void utestVerticalPerspectiveView() { testProjectionLonMax(new VerticalPerspectiveView(), 66, 60); VerticalPerspectiveView p = new VerticalPerspectiveView(); VerticalPerspectiveView p2 = (VerticalPerspectiveView) p.constructCopy(); assert p.equals(p2); }
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); }
double height = 35747.0; VerticalPerspectiveView a = new VerticalPerspectiveView(0, 0, radius, height); ProjectionRect r = a.latLonToProjBB(rect); System.out.println(" ProjectionRect result = " + r);
ProjectionPoint llpt = latLonToProj(rect.getLowerLeftPoint(), new ProjectionPointImpl()); ProjectionPoint urpt = latLonToProj(rect.getUpperRightPoint(), new ProjectionPointImpl()); ProjectionPoint lrpt = latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl()); if (!addGoodPts(goodPts, llpt)) countBad++; if (!addGoodPts(goodPts, urpt)) countBad++; if (!addGoodPts(goodPts, lrpt)) countBad++; if (!addGoodPts(goodPts, ulpt)) countBad++; addGoodPts( goodPts, new ProjectionPointImpl(0, maxR)); addGoodPts( goodPts, new ProjectionPointImpl(maxR, 0)); addGoodPts( goodPts, new ProjectionPointImpl(0, -maxR)); addGoodPts( goodPts, new ProjectionPointImpl(-maxR, 0)); addGoodPts( goodPts, new ProjectionPointImpl(xcoord, getLimitCoord( xcoord))); addGoodPts( goodPts, new ProjectionPointImpl(getLimitCoord( ycoord), ycoord)); addGoodPts( goodPts, new ProjectionPointImpl(xcoord, -getLimitCoord( xcoord))); addGoodPts( goodPts, new ProjectionPointImpl( -getLimitCoord( ycoord), ycoord));
/** * Set the height above the earth * @param height height above the earth */ public void setHeight(double height) { H = height; precalculate(); }
public CoordinateTransform makeCoordinateTransform(NetcdfDataset ds, Variable ctv) { readStandardParams(ds, ctv); double distance = readAttributeDouble(ctv, CF.PERSPECTIVE_POINT_HEIGHT, Double.NaN); if (Double.isNaN(distance)) { distance = readAttributeDouble(ctv, "height_above_earth", Double.NaN); } if (Double.isNaN(lon0) || Double.isNaN(lat0) || Double.isNaN(distance)) throw new IllegalArgumentException("Vertical Perspective must have: " + CF.LONGITUDE_OF_PROJECTION_ORIGIN + ", " + CF.LATITUDE_OF_PROJECTION_ORIGIN + ", and " + CF.PERSPECTIVE_POINT_HEIGHT + "(or height_above_earth) " + "attributes"); // We assume distance comes in 'm' (CF-compliant) and we pass in as 'km' ucar.unidata.geoloc.projection.VerticalPerspectiveView proj = new ucar.unidata.geoloc.projection.VerticalPerspectiveView(lat0, lon0, earth_radius, distance / 1000., false_easting, false_northing); return new ProjectionCT(ctv.getShortName(), "FGDC", proj); } }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new VerticalPerspectiveView(getOriginLat(), getOriginLon(), R, getHeight(), false_east, false_north); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
private static void test(double lat, double lon) { double radius = 6371.0; VerticalPerspectiveView a = new VerticalPerspectiveView(0, 0, radius, 5.62 * radius); ProjectionPoint 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); }
double height = 35747.0; VerticalPerspectiveView a = new VerticalPerspectiveView(0, 0, radius, height); ProjectionRect r = a.latLonToProjBB(rect); System.out.println(" ProjectionRect result = "+r);
false_north = false_northing; precalculate(); addParameter(CF.GRID_MAPPING_NAME, CF.VERTICAL_PERSPECTIVE); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.LONGITUDE_OF_PROJECTION_ORIGIN, lon0); addParameter(CF.EARTH_RADIUS, earthRadius * 1000); addParameter(CF.PERSPECTIVE_POINT_HEIGHT, distance * 1000); if (false_easting != 0 || false_northing != 0) { addParameter(CF.FALSE_EASTING, false_easting); addParameter(CF.FALSE_NORTHING, false_northing); addParameter(CDM.UNITS, "km");