public void utestProblem() { ProjectionImpl p = new LambertConformal(40.0, 0, 20.0, 60.0); LatLonPointImpl ptL = new LatLonPointImpl(-10, 135); LatLonPointImpl ptL2 = new LatLonPointImpl(10, 157.5); LatLonRect llbb = new LatLonRect(ptL, ptL2); ProjectionPoint pt1 = p.latLonToProj(ptL); ProjectionPoint pt2 = p.latLonToProj(ptL2); System.out.println("pt1 = "+pt1); System.out.println("pt2 = "+pt2); ProjectionPoint lr = p.latLonToProj(llbb.getLowerRightPoint()); System.out.println("lr = "+lr); if (!p.crossSeam(pt1, pt2)) doTest(p, llbb); } }
/** * Alternate way to calculate latLonToProjBB, originally in GridCoordSys. * Difficult to do this in a general way. * * @param latlonRect desired lat/lon rectangle * @return a ProjectionRect */ ProjectionRect latLonToProjBB2(LatLonRect latlonRect) { double minx, maxx, miny, maxy; LatLonPointImpl llpt = latlonRect.getLowerLeftPoint(); LatLonPointImpl urpt = latlonRect.getUpperRightPoint(); LatLonPointImpl lrpt = latlonRect.getLowerRightPoint(); LatLonPointImpl ulpt = latlonRect.getUpperLeftPoint(); if (isLatLon()) { minx = getMinOrMaxLon(llpt.getLongitude(), ulpt.getLongitude(), true); miny = Math.min(llpt.getLatitude(), lrpt.getLatitude()); maxx = getMinOrMaxLon(urpt.getLongitude(), lrpt.getLongitude(), false); maxy = Math.min(ulpt.getLatitude(), urpt.getLatitude()); } else { ProjectionPoint ll = latLonToProj(llpt, new ProjectionPointImpl()); ProjectionPoint ur = latLonToProj(urpt, new ProjectionPointImpl()); ProjectionPoint lr = latLonToProj(lrpt, new ProjectionPointImpl()); ProjectionPoint ul = latLonToProj(ulpt, new ProjectionPointImpl()); minx = Math.min(ll.getX(), ul.getX()); miny = Math.min(ll.getY(), lr.getY()); maxx = Math.max(ur.getX(), lr.getX()); maxy = Math.max(ul.getY(), ur.getY()); } return new ProjectionRect(minx, miny, maxx, maxy); }
/** * Alternate way to calculate latLonToProjBB, originally in GridCoordSys. * Difficult to do this in a general way. * * @param latlonRect desired lat/lon rectangle * @return a ProjectionRect */ ProjectionRect latLonToProjBB2(LatLonRect latlonRect) { double minx, maxx, miny, maxy; LatLonPointImpl llpt = latlonRect.getLowerLeftPoint(); LatLonPointImpl urpt = latlonRect.getUpperRightPoint(); LatLonPointImpl lrpt = latlonRect.getLowerRightPoint(); LatLonPointImpl ulpt = latlonRect.getUpperLeftPoint(); if (isLatLon()) { minx = getMinOrMaxLon(llpt.getLongitude(), ulpt.getLongitude(), true); miny = Math.min(llpt.getLatitude(), lrpt.getLatitude()); maxx = getMinOrMaxLon(urpt.getLongitude(), lrpt.getLongitude(), false); maxy = Math.min(ulpt.getLatitude(), urpt.getLatitude()); } else { ProjectionPoint ll = latLonToProj(llpt, new ProjectionPointImpl()); ProjectionPoint ur = latLonToProj(urpt, new ProjectionPointImpl()); ProjectionPoint lr = latLonToProj(lrpt, new ProjectionPointImpl()); ProjectionPoint ul = latLonToProj(ulpt, new ProjectionPointImpl()); minx = Math.min(ll.getX(), ul.getX()); miny = Math.min(ll.getY(), lr.getY()); maxx = Math.max(ur.getX(), lr.getX()); maxy = Math.max(ul.getY(), ur.getY()); } return new ProjectionRect(minx, miny, maxx, maxy); }
/** * Alternate way to calculate latLonToProjBB, originally in GridCoordSys. * Difficult to do this in a generral way. * * @param latlonRect desired lat/lon rectangle * @return a ProjectionRect */ ProjectionRect latLonToProjBB2(LatLonRect latlonRect) { double minx, maxx, miny, maxy; LatLonPointImpl llpt = latlonRect.getLowerLeftPoint(); LatLonPointImpl urpt = latlonRect.getUpperRightPoint(); LatLonPointImpl lrpt = latlonRect.getLowerRightPoint(); LatLonPointImpl ulpt = latlonRect.getUpperLeftPoint(); if (isLatLon()) { minx = getMinOrMaxLon(llpt.getLongitude(), ulpt.getLongitude(), true); miny = Math.min(llpt.getLatitude(), lrpt.getLatitude()); maxx = getMinOrMaxLon(urpt.getLongitude(), lrpt.getLongitude(), false); maxy = Math.min(ulpt.getLatitude(), urpt.getLatitude()); } else { ProjectionPoint ll = latLonToProj(llpt, new ProjectionPointImpl()); ProjectionPoint ur = latLonToProj(urpt, new ProjectionPointImpl()); ProjectionPoint lr = latLonToProj(lrpt, new ProjectionPointImpl()); ProjectionPoint ul = latLonToProj(ulpt, new ProjectionPointImpl()); minx = Math.min(ll.getX(), ul.getX()); miny = Math.min(ll.getY(), lr.getY()); maxx = Math.max(ur.getX(), lr.getX()); maxy = Math.max(ul.getY(), ur.getY()); } return new ProjectionRect(minx, miny, maxx, maxy); }
/** * Alternate way to calculate latLonToProjBB, originally in GridCoordSys. * Difficult to do this in a general way. * * @param latlonRect desired lat/lon rectangle * @return a ProjectionRect */ ProjectionRect latLonToProjBB2(LatLonRect latlonRect) { double minx, maxx, miny, maxy; LatLonPointImpl llpt = latlonRect.getLowerLeftPoint(); LatLonPointImpl urpt = latlonRect.getUpperRightPoint(); LatLonPointImpl lrpt = latlonRect.getLowerRightPoint(); LatLonPointImpl ulpt = latlonRect.getUpperLeftPoint(); if (isLatLon()) { minx = getMinOrMaxLon(llpt.getLongitude(), ulpt.getLongitude(), true); miny = Math.min(llpt.getLatitude(), lrpt.getLatitude()); maxx = getMinOrMaxLon(urpt.getLongitude(), lrpt.getLongitude(), false); maxy = Math.min(ulpt.getLatitude(), urpt.getLatitude()); } else { ProjectionPoint ll = latLonToProj(llpt, new ProjectionPointImpl()); ProjectionPoint ur = latLonToProj(urpt, new ProjectionPointImpl()); ProjectionPoint lr = latLonToProj(lrpt, new ProjectionPointImpl()); ProjectionPoint ul = latLonToProj(ulpt, new ProjectionPointImpl()); minx = Math.min(ll.getX(), ul.getX()); miny = Math.min(ll.getY(), lr.getY()); maxx = Math.max(ur.getX(), lr.getX()); maxy = Math.max(ul.getY(), ur.getY()); } return new ProjectionRect(minx, miny, maxx, maxy); }
LatLonPointImpl lrpt = rect.getLowerRightPoint(); LatLonPointImpl ulpt = rect.getUpperLeftPoint();
LatLonPointImpl lrpt = rect.getLowerRightPoint(); LatLonPointImpl ulpt = rect.getUpperLeftPoint();
LatLonPointImpl lrpt = rect.getLowerRightPoint(); LatLonPointImpl ulpt = rect.getUpperLeftPoint();
void doTests(ProjectionImpl p, double mid) { LatLonPointImpl ptL = new LatLonPointImpl(-10, 0.0); double xinc = 22.5; double yinc = 20.0; for (double lon = mid - 90; lon < mid + 90; lon += xinc) { ptL.setLongitude(lon); LatLonRect llbb = new LatLonRect(ptL, yinc, xinc); ProjectionPoint pt1 = p.latLonToProj(ptL); ProjectionPoint pt2 = p.latLonToProj(llbb.getLowerRightPoint()); if (!p.crossSeam(pt1, pt2)) doTest(p, llbb); } }
ProjectionPoint lrpt = latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());
ProjectionPoint lrpt = proj.latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = proj.latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());
ProjectionPoint lrpt = proj.latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = proj.latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());
ProjectionPoint lrpt = latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());
ProjectionPoint lrpt = latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());
ProjectionPoint lrpt = latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());