public LatLonRect getBoundingBox() { if (rect == null) { if (stations.size() == 0) return null; Station s = stations.get(0); LatLonPointImpl llpt = new LatLonPointImpl(); llpt.set( s.getLatitude(), s.getLongitude()); rect = new LatLonRect(llpt, .001, .001); if (debug) System.out.println("start="+s.getLatitude()+" "+s.getLongitude()+" rect= "+rect.toString2()); for (int i = 1; i < stations.size(); i++) { s = stations.get(i); llpt.set( s.getLatitude(), s.getLongitude()); rect.extend( llpt); if (debug) System.out.println("add="+s.getLatitude()+" "+s.getLongitude()+" rect= "+rect.toString2()); } } if (rect.crossDateline() && rect.getWidth() > 350.0) { // call it global - less confusing double lat_min = rect.getLowerLeftPoint().getLatitude(); double deltaLat = rect.getUpperLeftPoint().getLatitude() - lat_min; rect = new LatLonRect( new LatLonPointImpl(lat_min, -180.0), deltaLat, 360.0); } return rect; }
protected void finishCalcBounds() { if (!calcBounds) return; if ((bb != null) && bb.crossDateline() && (bb.getWidth() > 350.0)) { // call it global - less confusing double lat_min = bb.getLowerLeftPoint().getLatitude(); double deltaLat = bb.getUpperLeftPoint().getLatitude() - lat_min; bb = new LatLonRect(new LatLonPointImpl(lat_min, -180.0), deltaLat, 360.0); } info.bbox = bb; info.minTime = minTime; info.maxTime = maxTime; info.nobs = count; info.nfeatures = count; info.setComplete(); }
public LatLonRect getBoundingBox() { if (rect == null) { List stations; try { stations = obsDataset.getStations(); } catch (IOException e) { return null; } if (stations.size() == 0) return null; ucar.unidata.geoloc.Station s = (ucar.unidata.geoloc.Station) stations.get(0); LatLonPointImpl llpt = new LatLonPointImpl(); llpt.set( s.getLatitude(), s.getLongitude()); rect = new LatLonRect(llpt, .001, .001); if (debug) System.out.println("start="+s.getLatitude()+" "+s.getLongitude()+" rect= "+rect.toString2()); for (int i = 1; i < stations.size(); i++) { s = (ucar.unidata.geoloc.Station) stations.get(i); llpt.set( s.getLatitude(), s.getLongitude()); rect.extend( llpt); if (debug) System.out.println("add="+s.getLatitude()+" "+s.getLongitude()+" rect= "+rect.toString2()); } } if (rect.crossDateline() && rect.getWidth() > 350.0) { // call it global - less confusing double lat_min = rect.getLowerLeftPoint().getLatitude(); double deltaLat = rect.getUpperLeftPoint().getLatitude() - lat_min; rect = new LatLonRect( new LatLonPointImpl(lat_min, -180.0), deltaLat, 360.0); } return rect; }
/** * 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 urpt = rect.getUpperRightPoint(); LatLonPointImpl lrpt = rect.getLowerRightPoint(); LatLonPointImpl ulpt = rect.getUpperLeftPoint();
double deltaLat = rect.getUpperLeftPoint().getLatitude() - lat_min; rect = new LatLonRect( new LatLonPointImpl(lat_min, -180.0), deltaLat, 360.0);
double deltaLat = rect.getUpperLeftPoint().getLatitude() - lat_min; rect = new LatLonRect( new LatLonPointImpl(lat_min, -180.0), deltaLat, 360.0);
double deltaLat = rect.getUpperLeftPoint().getLatitude() - lat_min; rect = new LatLonRect( new LatLonPointImpl(lat_min, -180.0), deltaLat, 360.0);
double deltaLat = rect.getUpperLeftPoint().getLatitude() - lat_min; rect = new LatLonRect( new LatLonPointImpl(lat_min, -180.0), deltaLat, 360.0);
protected void finishCalcBounds() { if (!calcBounds) return; if ((bb != null) && bb.crossDateline() && (bb.getWidth() > 350.0)) { // call it global - less confusing double lat_min = bb.getLowerLeftPoint().getLatitude(); double deltaLat = bb.getUpperLeftPoint().getLatitude() - lat_min; bb = new LatLonRect(new LatLonPointImpl(lat_min, -180.0), deltaLat, 360.0); } if (collection != null) { if (collection.getBoundingBox() == null) collection.setBoundingBox(bb); if (collection.getCalendarDateRange() == null) { CalendarDateRange dr = getCalendarDateRange(); if (dr != null) collection.setCalendarDateRange(dr); } if (collection.size() <= 0) { if (count < 0) count = 0; collection.setSize(count); } } }
protected void finishCalcBounds() { if (!calcBounds) return; if ((bb != null) && bb.crossDateline() && (bb.getWidth() > 350.0)) { // call it global - less confusing double lat_min = bb.getLowerLeftPoint().getLatitude(); double deltaLat = bb.getUpperLeftPoint().getLatitude() - lat_min; bb = new LatLonRect(new LatLonPointImpl(lat_min, -180.0), deltaLat, 360.0); } if (collection != null) { if (collection.getBoundingBox() == null) collection.setBoundingBox(bb); if (collection.getCalendarDateRange() == null) { CalendarDateRange dr = getCalendarDateRange(); if (dr != null) collection.setCalendarDateRange(dr); } if (collection.size() <= 0) { if (count < 0) count = 0; collection.setSize(count); } } }
ProjectionPoint urpt = proj.latLonToProj(rect.getUpperRightPoint(), new ProjectionPointImpl()); ProjectionPoint lrpt = proj.latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = proj.latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());
ProjectionPoint urpt = latLonToProj(rect.getUpperRightPoint(), new ProjectionPointImpl()); ProjectionPoint lrpt = latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());
ProjectionPoint urpt = latLonToProj(rect.getUpperRightPoint(), new ProjectionPointImpl()); ProjectionPoint lrpt = latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());
ProjectionPoint urpt = latLonToProj(rect.getUpperRightPoint(), new ProjectionPointImpl()); ProjectionPoint lrpt = latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());
ProjectionPoint urpt = proj.latLonToProj(rect.getUpperRightPoint(), new ProjectionPointImpl()); ProjectionPoint lrpt = proj.latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = proj.latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());
ProjectionPoint urpt = latLonToProj(rect.getUpperRightPoint(), new ProjectionPointImpl()); ProjectionPoint lrpt = latLonToProj(rect.getLowerRightPoint(), new ProjectionPointImpl()); ProjectionPoint ulpt = latLonToProj(rect.getUpperLeftPoint(), new ProjectionPointImpl());