/** copy constructor - avoid clone !! */ public ProjectionImpl constructCopy() { return new Orthographic( getOriginLat(), getOriginLon(), R); }
/** * Construct a Orthographic Projection, specify earth radius * * @param lat0 lat origin of the coord. system on the projection plane * @param lon0 lon origin of the coord. system on the projection plane * @param earthRadius radius of the earth * @throws IllegalArgumentException if lat0, par1, par2 = +/-90 deg */ public Orthographic(double lat0, double lon0, double earthRadius) { super("Orthographic", false); this.lat0 = Math.toRadians(lat0); this.lon0 = Math.toRadians(lon0); R = earthRadius; precalculate(); addParameter(CF.GRID_MAPPING_NAME, CF.ORTHOGRAPHIC); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.LONGITUDE_OF_PROJECTION_ORIGIN, lon0); addParameter(CF.EARTH_RADIUS, earthRadius * 1000); }
/** * Test * * @param args not used */ public static void main(String[] args) { Orthographic a = new Orthographic(40, -100); ProjectionPointImpl p = a.latLonToProj(30, -110); System.out.println("proj point = " + p); LatLonPoint ll = a.projToLatLon(p); System.out.println("ll = " + ll); } }
@Override protected Orthographic createProjection(final ParameterValueGroup p) { if (p == null) return new Orthographic(); return new Orthographic(value(p, CF.LATITUDE_OF_PROJECTION_ORIGIN), value(p, CF.LONGITUDE_OF_PROJECTION_ORIGIN), earthRadius(p) / KILOMETRE); } }
/** * 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 Orthographic)) { return false; } Orthographic oo = (Orthographic) proj; return ((this.getOriginLat() == oo.getOriginLat()) && (this.getOriginLon() == oo.getOriginLon()) && this.defaultMapArea.equals(oo.defaultMapArea)); }
/** * Set the origin latitude. * * @param lat the origin latitude. */ public void setOriginLat(double lat) { lat0 = Math.toRadians(lat); precalculate(); }
@Test public void testOrtho() { testProjectionLonMax(new Orthographic(), 10, 10); Orthographic p = new Orthographic(); Orthographic p2 = (Orthographic) p.constructCopy(); assert p.equals(p2); }
/** * Create a String of the parameters. * * @return a String of the parameters */ public String paramsToString() { return toString(); }
public CoordinateTransform makeCoordinateTransform(NetcdfDataset ds, Variable ctv) { double lon0 = readAttributeDouble( ctv, CF.LONGITUDE_OF_PROJECTION_ORIGIN, Double.NaN); double lat0 = readAttributeDouble( ctv, CF.LATITUDE_OF_PROJECTION_ORIGIN, Double.NaN); ucar.unidata.geoloc.projection.Orthographic proj = new ucar.unidata.geoloc.projection.Orthographic(lat0, lon0); return new ProjectionCT(ctv.getShortName(), "FGDC", proj); } }
/** * Clone this projection. * * @return Clone of this */ public Object clone() { Orthographic cl = (Orthographic) super.clone(); cl.origin = new LatLonPointImpl(getOriginLat(), getOriginLon()); return cl; }
/** * Set the origin longitude. * @param lon the origin longitude. */ public void setOriginLon(double lon) { lon0 = Math.toRadians(lon); precalculate(); }
/** * Create a String of the parameters. * * @return a String of the parameters */ public String paramsToString() { return toString(); }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new Orthographic(getOriginLat(), getOriginLon(), R); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
/** * Test * * @param args not used */ public static void main(String[] args) { Orthographic a = new Orthographic(40, -100); ProjectionPoint p = a.latLonToProj(30, -110); System.out.println("proj point = " + p); LatLonPoint ll = a.projToLatLon(p); System.out.println("ll = " + ll); } }
/** * Construct a Orthographic Projection, specify earth radius * * @param lat0 lat origin of the coord. system on the projection plane * @param lon0 lon origin of the coord. system on the projection plane * @param earthRadius radius of the earth * @throws IllegalArgumentException if lat0, par1, par2 = +/-90 deg */ public Orthographic(double lat0, double lon0, double earthRadius) { super("Orthographic", false); this.lat0 = Math.toRadians(lat0); this.lon0 = Math.toRadians(lon0); R = earthRadius; precalculate(); addParameter(CF.GRID_MAPPING_NAME, CF.ORTHOGRAPHIC); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.LONGITUDE_OF_PROJECTION_ORIGIN, lon0); addParameter(CF.EARTH_RADIUS, earthRadius * 1000); }
public ProjectionCT makeCoordinateTransform(AttributeContainer ctv, String geoCoordinateUnits) { double lon0 = readAttributeDouble( ctv, CF.LONGITUDE_OF_PROJECTION_ORIGIN, Double.NaN); double lat0 = readAttributeDouble( ctv, CF.LATITUDE_OF_PROJECTION_ORIGIN, Double.NaN); ucar.unidata.geoloc.projection.Orthographic proj = new ucar.unidata.geoloc.projection.Orthographic(lat0, lon0); return new ProjectionCT(ctv.getName(), "FGDC", proj); } }
/** * Set the origin latitude. * * @param lat the origin latitude. */ public void setOriginLat(double lat) { lat0 = Math.toRadians(lat); precalculate(); }
/** * Create a String of the parameters. * * @return a String of the parameters */ public String paramsToString() { return toString(); }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new Orthographic(getOriginLat(), getOriginLon(), R); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
/** * Test * * @param args not used */ public static void main(String[] args) { Orthographic a = new Orthographic(40, -100); ProjectionPointImpl p = a.latLonToProj(30, -110); System.out.println("proj point = " + p); LatLonPoint ll = a.projToLatLon(p); System.out.println("ll = " + ll); } }