/** * copy constructor - avoid clone !! */ @Override public ProjectionImpl constructCopy() { return new MSGnavigation(lat0, lon0, 1000 * major_axis, 1000 * minor_axis, 1000 * sat_height, scale_x, scale_y); }
maxR = .99 * this.major_axis * Math.sqrt((P - 1) / (P + 1)); addParameter(CF.GRID_MAPPING_NAME, "MSGnavigation"); addParameter(CF.LONGITUDE_OF_PROJECTION_ORIGIN, lon0); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.SEMI_MAJOR_AXIS, major_axis); addParameter(CF.SEMI_MINOR_AXIS, minor_axis); addParameter(HEIGHT_FROM_EARTH_CENTER, sat_height); addParameter(SCALE_X, scale_x); addParameter(SCALE_Y, scale_y);
@Override public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl destPoint) { geocoord2pixcoord(latlon.getLatitude(), latlon.getLongitude(), destPoint); return destPoint; }
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)));
@Test public void testConstructCopy() throws Exception { // These are the same as the values used in MSGnavigation() except for the 2nd, lon0. For the purposes of // this test, that's the only argument I care about. MSGnavigation msgNav = new MSGnavigation(0.0, 180, R_EQ, R_POL, SAT_HEIGHT, SAT_HEIGHT - R_EQ, SAT_HEIGHT - R_EQ); Assert.assertEquals(Math.PI, msgNav.getLon0(), 1e-6); // 180° = π radians. // The 2 tests below failed prior to TDS-575 being fixed. MSGnavigation msgNavCopy1 = (MSGnavigation) msgNav.constructCopy(); Assert.assertEquals(Math.PI, msgNavCopy1.getLon0(), 1e-6); // 180° = π radians. MSGnavigation msgNavCopy2 = (MSGnavigation) msgNavCopy1.constructCopy(); Assert.assertEquals(Math.PI, msgNavCopy2.getLon0(), 1e-6); // 180° = π radians. } }
@Override public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl destPoint) { pixcoord2geocoord(ppt.getX(), ppt.getY(), destPoint); return destPoint; }
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)));
@Override public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl destPoint) { int status = pixcoord2geocoord(ppt.getX(), ppt.getY(), destPoint); return destPoint; }
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new MSGnavigation( lat0, Math.toDegrees(lon0), 1000 * major_axis, 1000 * minor_axis, 1000 * sat_height, scale_x, scale_y); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
@Override public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl destPoint) { int status = geocoord2pixcoord(latlon.getLatitude(), latlon.getLongitude(), destPoint); return destPoint; }
@Override public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl destPoint) { int status = pixcoord2geocoord(ppt.getX(), ppt.getY(), destPoint); return destPoint; }
maxR = .99 * this.major_axis * Math.sqrt((P - 1) / (P + 1)); addParameter(CF.GRID_MAPPING_NAME, "MSGnavigation"); addParameter(CF.LONGITUDE_OF_PROJECTION_ORIGIN, lon0); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, lat0); addParameter(CF.SEMI_MAJOR_AXIS, major_axis); addParameter(CF.SEMI_MINOR_AXIS, minor_axis); addParameter(HEIGHT_FROM_EARTH_CENTER, sat_height); addParameter(SCALE_X, scale_x); addParameter(SCALE_Y, scale_y);
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new MSGnavigation( lat0, Math.toDegrees(lon0), 1000 * major_axis, 1000 * minor_axis, 1000 * sat_height, scale_x, scale_y); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
@Override public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl destPoint) { geocoord2pixcoord(latlon.getLatitude(), latlon.getLongitude(), destPoint); return destPoint; }
@Override public LatLonPoint projToLatLon(ProjectionPoint ppt, LatLonPointImpl destPoint) { pixcoord2geocoord(ppt.getX(), ppt.getY(), destPoint); return destPoint; }
maxR2 = maxR * maxR; addParameter("grid_mapping_name", "MSGnavigation"); addParameter("longitude_of_projection_origin", new Double(lon0)); addParameter("latitude_of_projection_origin", new Double(lat0)); addParameter("semi_major_axis", new Double(major_axis)); addParameter("semi_minor_axis", new Double(minor_axis)); addParameter("height_from_earth_center", new Double(sat_height)); addParameter("scale_x", new Double(scale_x)); addParameter("scale_y", new Double(scale_y));
@Override public ProjectionImpl constructCopy() { ProjectionImpl result = new MSGnavigation(lat0, lon0, 1000 * major_axis, 1000 * minor_axis, 1000 * sat_height, scale_x, scale_y); result.setDefaultMapArea(defaultMapArea); result.setName(name); return result; }
@Override public ProjectionPoint latLonToProj(LatLonPoint latlon, ProjectionPointImpl destPoint) { int status = geocoord2pixcoord(latlon.getLatitude(), latlon.getLongitude(), destPoint); return destPoint; }
maxR2 = maxR * maxR; addParameter(CF.GRID_MAPPING_NAME, "MSGnavigation"); addParameter(CF.LONGITUDE_OF_PROJECTION_ORIGIN, new Double(lon0)); addParameter(CF.LATITUDE_OF_PROJECTION_ORIGIN, new Double(lat0)); addParameter(CF.SEMI_MAJOR_AXIS, new Double(major_axis)); addParameter(CF.SEMI_MINOR_AXIS, new Double(minor_axis)); addParameter(HEIGHT_FROM_EARTH_CENTER, new Double(sat_height)); addParameter(SCALE_X, new Double(scale_x)); addParameter(SCALE_Y, new Double(scale_y));
@Test public void testMSG() { doOne(new MSGnavigation(), 60, 60, true); testProjection(new MSGnavigation()); MSGnavigation m = new MSGnavigation(); showProjVal(m, 0, 0); showProjVal(m, 60, 0); showProjVal(m, -60, 0); showProjVal(m, 0, 60); showProjVal(m, 0, -60); }