/** * Get the lower right (southeast) point of the projection. * * <p>Returns the lower right point (or closest equivalent) of the projection based on the center * point and height and width of screen. * * <p>This is trivial for most cylindrical projections, but much more complicated for azimuthal * projections. * * @return LatLonPoint */ public LatLonPoint getLowerRight() { LatLonPoint tmp = new LatLonPoint.Double(); double lat, lon; // over north pole if (overNorthPole()) { lon = DATELINE; if (overEquator()) { // get bottom center for latitude inverse(width / 2, height, tmp); lat = tmp.getRadLat(); } else { // get bottom right corner for latitude inverse(width, height, tmp); lat = tmp.getRadLat(); } } // over south pole else if (overSouthPole()) { lat = SOUTH_POLE; lon = DATELINE; } // view in northern hemisphere else if (tmp.getRadLat() >= 0f) { // get the right top corner for longitude inverse(width, 0, tmp); lon = tmp.getRadLon(); if (overEquator()) { // get the bottom center (for latitude) inverse(width / 2, height, tmp); lat = tmp.getRadLat(); } else { // get the right bottom corner (for latitude) inverse(width, height, tmp); lat = tmp.getRadLat(); } } // view in southern hemisphere else { // get the right bottom corner for longitude inverse(width, height, tmp); lon = tmp.getRadLon(); // get bottom center for latitude inverse(width / 2, height, tmp); lat = tmp.getRadLat(); } tmp.setLatLon(lat, lon, true); // Debug.output("lr="+tmp); return tmp; }
/** * Get the upper left (northernmost and westernmost) point of the projection. * * <p>Returns the upper left point (or closest equivalent) of the projection based on the center * point and height and width of screen. * * @return LatLonPoint */ public LatLonPoint getUpperLeft() { LatLonPoint tmp = new LatLonPoint.Double(); double lat, lon; // over north pole if (overNorthPole()) { lat = NORTH_POLE; lon = -DATELINE; } // over south pole else if (overSouthPole()) { lon = -DATELINE; if (overEquator()) { // get top center for latitude inverse(width / 2, 0, tmp); lat = tmp.getRadLat(); } else { // get left top corner for latitude inverse(0, 0, tmp); lat = tmp.getRadLat(); } } // view in northern hemisphere else if (tmp.getRadLat() >= 0) { // get left top corner for longitude inverse(0, 0, tmp); lon = tmp.getRadLon(); // get top center for latitude inverse(width / 2, 0, tmp); lat = tmp.getRadLat(); } // view in southern hemisphere else { // get left bottom corner for longitude inverse(0, height, tmp); lon = tmp.getRadLon(); if (overEquator()) { // get top center (for latitude) inverse(width / 2, 0, tmp); lat = tmp.getRadLat(); } else { // get left top corner (for latitude) inverse(0, 0, tmp); lat = tmp.getRadLat(); } } tmp.setLatLon(lat, lon, true); // Debug.output("ul="+tmp); return tmp; }