From 6cd151b42739cc7d936fcf428d5c5d1bb042129d Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Tue, 19 Nov 2013 14:08:26 -0600 Subject: [PATCH] Issue #2532 Fix grid displays of grids larger than the world. Former-commit-id: 6d878e336199c21a1931a24d82a0324747e82ee9 [formerly d3ed1ba35651092e4840a51187320fb25c9ca3ee] [formerly 6d878e336199c21a1931a24d82a0324747e82ee9 [formerly d3ed1ba35651092e4840a51187320fb25c9ca3ee] [formerly 41753c40b5264a20e16528e000862d737bc32bb0 [formerly e607da0bb204d61cbc998595f52406605c1953e0]]] Former-commit-id: 41753c40b5264a20e16528e000862d737bc32bb0 Former-commit-id: 7f441392b8bda63165394d7df33d62e487cabc3e [formerly 07743c436965a137d4ff381b613e942dfc91fccf] Former-commit-id: 1bc4453a8d85889c1a7c030d41b0dd2bb36f2594 --- .../viz/grid/rsc/general/D2DGridResource.java | 32 +++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGridResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGridResource.java index b0d3a1f679..6121f0ecbb 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGridResource.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGridResource.java @@ -47,7 +47,9 @@ import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; import com.raytheon.uf.common.geospatial.interpolation.Interpolation; import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation; import com.raytheon.uf.common.geospatial.util.EnvelopeIntersection; +import com.raytheon.uf.common.geospatial.util.GridGeometryWrapChecker; import com.raytheon.uf.common.gridcoverage.GridCoverage; +import com.raytheon.uf.common.gridcoverage.LatLonGridCoverage; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; @@ -86,10 +88,12 @@ import com.vividsolutions.jts.geom.Geometry; * constructor to avoid duplicate data * requests. * Jul 15, 2013 2107 bsteffen Fix sampling of grid vector arrows. - * Aug 27, 2013 2287 randerso Removed 180 degree adjustment required by error - * in Maputil.rotation + * Aug 27, 2013 2287 randerso Removed 180 degree adjustment required by + * error in Maputil.rotation * Sep 12, 2013 2309 bsteffen Request subgrids whenever possible. - * Sep 24, 2013 DR 15972 D. Friedman Make reprojection of grids configurable. + * Sep 24, 2013 15972 D. Friedman Make reprojection of grids configurable. + * Nov 19, 2013 2532 bsteffen Special handling of grids larger than the + * world. * * * @@ -156,14 +160,27 @@ public class D2DGridResource extends GridResource implements throws VizException { Unit dataUnit = gridRecord.getParameter().getUnit(); GridCoverage location = gridRecord.getLocation(); + /* + * Detect a special case. Several of the D2D specific "enhancements" do + * not handle grids larger than the world. Since this is a rare edge + * case, and fixing it would be very complicated just don't apply the + * "enhancements". + */ + boolean gridLargerThanWorld = location instanceof LatLonGridCoverage + && location.getNx() * location.getDx() > 360; GridGeometry2D gridGeometry = location.getGridGeometry(); /* Request data for tilts if this is Std Env sampling. */ IDataRecord[] dataRecs = GridResourceData.getDataRecordsForTilt( gridRecord, descriptor); if (dataRecs == null) { - GridGeometry2D subGridGeometry = calculateSubgrid(gridGeometry); - if (subGridGeometry.equals(gridGeometry)) { + GridGeometry2D subGridGeometry = gridGeometry; + if (!gridLargerThanWorld) { + subGridGeometry = calculateSubgrid(gridGeometry); + } + if (subGridGeometry == null) { + return null; + } else if (subGridGeometry.equals(gridGeometry)) { dataRecs = DataCubeContainer.getDataRecord(gridRecord); } else if (subGridGeometry != null) { /* transform subgrid envelope into a slab request. */ @@ -195,7 +212,10 @@ public class D2DGridResource extends GridResource implements // more evenly spaced near the pole. if (ReprojectionUtil.shouldReproject(gridRecord, gridGeometry, getDisplayType(), descriptor.getGridGeometry())) { - data = reprojectData(data); + if (!gridLargerThanWorld + || GridGeometryWrapChecker.checkForWrapping(gridGeometry) != -1) { + data = reprojectData(data); + } } /* * Wind Direction(and possibly others) can be set so that we rotate the