/** * copy constructor - avoid clone !! */ public ProjectionImpl constructCopy() { return new LambertConformalConicEllipse(getOriginLat(), getOriginLon(), getParallelOne(), getParallelTwo(), getFalseEasting(), getFalseNorthing(), getEarth()); }
public static void main(String[] args) { LambertConformalConicEllipse a = new LambertConformalConicEllipse(23.0, -96.0, 29.5, 45.5, 0, 0, new Earth(6378137.0, 0.0, 298.257222101)); System.out.printf("proj = %s %s%n%n", a.getName(), a.paramsToString()); //fromProj(a, 1730.692593817677, 1970.917991173046); //toProj(a, 39.089117, -75.649278); fromProj(a, 5747, 13470); }
/** * 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 LambertConformalConicEllipse)) return false; LambertConformalConicEllipse oo = (LambertConformalConicEllipse) proj; return ((this.getParallelOne() == oo.getParallelOne()) && (this.getParallelTwo() == oo.getParallelTwo()) && (this.getOriginLat() == oo.getOriginLat()) && (this.getOriginLon() == oo.getOriginLon()) && this.earth.equals(oo.earth)); }
this.totalScale = earth.getMajor() * .001; // scale factor for cartesion coords in km. initialize(); addParameter(CF.GRID_MAPPING_NAME, CF.LAMBERT_CONFORMAL_CONIC); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.LONGITUDE_OF_CENTRAL_MERIDIAN, lon0); if (par2 == par1) { addParameter(CF.STANDARD_PARALLEL, par1); } else { double[] data = new double[2]; data[0] = par1; data[1] = par2; addParameter(new Parameter(CF.STANDARD_PARALLEL, data)); addParameter(CF.FALSE_EASTING, falseEasting); addParameter(CF.FALSE_NORTHING, falseNorthing); addParameter(CDM.UNITS, "km"); addParameter(CF.SEMI_MAJOR_AXIS, earth.getMajor()); addParameter(CF.INVERSE_FLATTENING, 1.0/earth.getFlattening());
proj = new ucar.unidata.geoloc.projection.proj4.LambertConformalConicEllipse(lat0, lon0, pars[0], pars[1], false_easting, false_northing, earth);
public void utestLCCE() { testProjectionLonMax(new LambertConformalConicEllipse(), 360, 80); LambertConformalConicEllipse p = new LambertConformalConicEllipse(); LambertConformalConicEllipse p2 = (LambertConformalConicEllipse) p.constructCopy(); assert p.equals(p2); }
public ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latLon.getLatitude()); double theta = computeTheta(latLon.getLongitude()); double rho = 0.0; if (Math.abs(Math.abs(fromLat) - MapMath.HALFPI) >= TOL) { double term; if (isSpherical) term = Math.pow(Math.tan(MapMath.QUARTERPI + .5 * fromLat), -n); else term = Math.pow(MapMath.tsfn(fromLat, Math.sin(fromLat), e), n); rho = c * term; } double toX = (rho * Math.sin(theta)); double toY = (rho0 - rho * Math.cos(theta)); result.setLocation(totalScale * toX + falseEasting, totalScale * toY + falseNorthing); return result; }
/** * 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 LambertConformalConicEllipse)) return false; LambertConformalConicEllipse oo = (LambertConformalConicEllipse) proj; if ((this.getDefaultMapArea() == null) != (oo.defaultMapArea == null)) return false; // common case is that these are null if (this.getDefaultMapArea() != null && !this.defaultMapArea.equals(oo.defaultMapArea)) return false; return ((this.getParallelOne() == oo.getParallelOne()) && (this.getParallelTwo() == oo.getParallelTwo()) && (this.getOriginLat() == oo.getOriginLat()) && (this.getOriginLon() == oo.getOriginLon()) && this.earth.equals(oo.earth)); }
this.totalScale = earth.getMajor() * .001; // scale factor for cartesion coords in km. initialize(); addParameter(CF.GRID_MAPPING_NAME, CF.LAMBERT_CONFORMAL_CONIC); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.LONGITUDE_OF_CENTRAL_MERIDIAN, lon0); if (par2 == par1) { addParameter(CF.STANDARD_PARALLEL, par1); } else { double[] data = new double[2]; data[0] = par1; data[1] = par2; addParameter(new Parameter(CF.STANDARD_PARALLEL, data)); addParameter(CF.FALSE_EASTING, falseEasting); addParameter(CF.FALSE_NORTHING, falseNorthing); addParameter(CDM.UNITS, "km"); addParameter(CF.SEMI_MAJOR_AXIS, earth.getMajor()); addParameter(CF.INVERSE_FLATTENING, 1.0/earth.getFlattening());
proj = new ucar.unidata.geoloc.projection.proj4.LambertConformalConicEllipse(lat0, lon0, pars[0], pars[1], false_easting, false_northing, earth);
public ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latLon.getLatitude()); double theta = computeTheta(latLon.getLongitude()); double rho = 0.0; if (Math.abs(Math.abs(fromLat) - MapMath.HALFPI) >= TOL) { double term; if (isSpherical) term = Math.pow(Math.tan(MapMath.QUARTERPI + .5 * fromLat), -n); else term = Math.pow(MapMath.tsfn(fromLat, Math.sin(fromLat), e), n); rho = c * term; } double toX = (rho * Math.sin(theta)); double toY = (rho0 - rho * Math.cos(theta)); result.setLocation(totalScale * toX + falseEasting, totalScale * toY + falseNorthing); return result; }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new LambertConformalConicEllipse(getOriginLat(), getOriginLon(), getParallelOne(), getParallelTwo(), getFalseEasting(), getFalseNorthing(), getEarth()); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
public static void main(String[] args) { LambertConformalConicEllipse a = new LambertConformalConicEllipse(23.0, -96.0, 29.5, 45.5, 0, 0, new Earth(6378137.0, 0.0, 298.257222101)); System.out.printf("proj = %s %s%n%n", a.getName(), a.paramsToString()); //fromProj(a, 1730.692593817677, 1970.917991173046); //toProj(a, 39.089117, -75.649278); fromProj(a, 5747, 13470); }
this.totalScale = earth.getMajor() * .001; // scale factor for cartesion coords in km. initialize(); addParameter(ATTR_NAME, "lambert_conformal_conic"); addParameter("latitude_of_projection_origin", lat0); addParameter("longitude_of_central_meridian", lon0); if (par2 == par1) { addParameter("standard_parallel", par1); } else { double[] data = new double[2]; data[0] = par1; data[1] = par2; addParameter(new Parameter("standard_parallel", data)); addParameter("false_easting", falseEasting); addParameter("false_northing", falseNorthing); addParameter("units", "km"); addParameter("semi_major_axis", earth.getMajor()); addParameter("inverse_flattening", 1.0/earth.getFlattening());
proj = new ucar.unidata.geoloc.projection.proj4.LambertConformalConicEllipse(lat0, lon0, pars[0], pars[1], false_easting, false_northing, earth);
public ProjectionPoint latLonToProj(LatLonPoint latLon, ProjectionPointImpl result) { double fromLat = Math.toRadians(latLon.getLatitude()); double theta = computeTheta(latLon.getLongitude()); double rho = 0.0; if (Math.abs(Math.abs(fromLat) - MapMath.HALFPI) >= TOL) { double term; if (isSpherical) term = Math.pow(Math.tan(MapMath.QUARTERPI + .5 * fromLat), -n); else term = Math.pow(MapMath.tsfn(fromLat, Math.sin(fromLat), e), n); rho = c * term; } double toX = (rho * Math.sin(theta)); double toY = (rho0 - rho * Math.cos(theta)); result.setLocation(totalScale * toX + falseEasting, totalScale * toY + falseNorthing); return result; }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new LambertConformalConicEllipse(getOriginLat(), getOriginLon(), getParallelOne(), getParallelTwo(), getFalseEasting(), getFalseNorthing(), getEarth()); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
public static void main(String[] args) { LambertConformalConicEllipse a = new LambertConformalConicEllipse(23.0, -96.0, 29.5, 45.5, 0, 0, new Earth(6378137.0, 0.0, 298.257222101)); System.out.printf("proj = %s %s%n%n", a.getName(), a.paramsToString()); //fromProj(a, 1730.692593817677, 1970.917991173046); //toProj(a, 39.089117, -75.649278); fromProj(a, 5747, 13470); }
this.totalScale = earth.getMajor() * .001; // scale factor for cartesion coords in km. initialize(); addParameter(CF.GRID_MAPPING_NAME, CF.LAMBERT_CONFORMAL_CONIC); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.LONGITUDE_OF_CENTRAL_MERIDIAN, lon0); if (par2 == par1) { addParameter(CF.STANDARD_PARALLEL, par1); } else { double[] data = new double[2]; data[0] = par1; data[1] = par2; addParameter(new Parameter(CF.STANDARD_PARALLEL, data)); addParameter(CF.FALSE_EASTING, falseEasting); addParameter(CF.FALSE_NORTHING, falseNorthing); addParameter(CDM.UNITS, "km"); addParameter(CF.SEMI_MAJOR_AXIS, earth.getMajor()); addParameter(CF.INVERSE_FLATTENING, 1.0/earth.getFlattening());
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); }