From a89a2939373fca2ddac94d62770df232b53b35ed Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Wed, 26 Feb 2014 14:32:26 -0600 Subject: [PATCH] Issue #2703 Fix GFE time matching in iscMode. Former-commit-id: 553292ae4f3c7f081381b12e986fdad479eceb0a [formerly fa6dcaac84cd51ce54155d9f4c4f3d68e74be857] [formerly 2425b9665c25ebc22b6b8d156ae3b436c33f79c7] [formerly 2425b9665c25ebc22b6b8d156ae3b436c33f79c7 [formerly d8bfdd1a7e6360ad1c6f630cccc624d9d98c5229]] [formerly 07bc9f075fce8311b511f1d7d1f40b7ca0981caa [formerly 2425b9665c25ebc22b6b8d156ae3b436c33f79c7 [formerly d8bfdd1a7e6360ad1c6f630cccc624d9d98c5229] [formerly 07bc9f075fce8311b511f1d7d1f40b7ca0981caa [formerly cbc63092bed92bb35a450c012b5bc882e4c82b35]]]] Former-commit-id: 07bc9f075fce8311b511f1d7d1f40b7ca0981caa Former-commit-id: fa7d47e64f8c6076efd5d438d6d221f5ea0628c8 [formerly 21789a864d2ed6b3a1c15882fe3f817dac2fd3f7] [formerly 0fde78c5952ebb237f448e058af0f17d8c9b021c [formerly 804cbb48e661f3fc6de13e438bc3f9eba9bca718]] Former-commit-id: 0fde78c5952ebb237f448e058af0f17d8c9b021c Former-commit-id: 66b052cd5a8540ea1e6cbf93d21bada9b062a126 --- .../viz/gfe/core/GFEMapRenderableDisplay.java | 16 +- .../raytheon/viz/gfe/core/GFETimeMatcher.java | 31 +- .../com/raytheon/viz/gfe/rsc/GFEResource.java | 623 ++++++++---------- 3 files changed, 326 insertions(+), 344 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFEMapRenderableDisplay.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFEMapRenderableDisplay.java index 7c33c268f7..0513e2959b 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFEMapRenderableDisplay.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFEMapRenderableDisplay.java @@ -49,9 +49,10 @@ import com.raytheon.viz.gfe.rsc.GFEResource; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Feb 19, 2009            chammack     Initial creation
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Feb 19, 2009           chammack    Initial creation
+ * Jan 23, 2014  2703     bsteffen    Always get resource time from descriptor.
  * 
  * 
* @@ -117,11 +118,9 @@ public class GFEMapRenderableDisplay extends PlainMapRenderableDisplay @Override protected PaintProperties calcPaintDataTime(PaintProperties paintProps, AbstractVizResource rsc) { - if (dataMgr != null) { - // Get time for resource from FramesInfo - paintProps.setDataTime(paintProps.getFramesInfo() - .getTimeForResource(rsc)); - } + // Get time for resource from FramesInfo + paintProps.setDataTime(paintProps.getFramesInfo().getTimeForResource( + rsc)); GFEPaintProperties gfeProps = new GFEPaintProperties(paintProps); if (qvTime != null) { @@ -184,4 +183,5 @@ public class GFEMapRenderableDisplay extends PlainMapRenderableDisplay public void spatialEditorTimeChanged(Date date) { this.refresh(); } + } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFETimeMatcher.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFETimeMatcher.java index 8c8a204fb7..df709b5a4b 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFETimeMatcher.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/core/GFETimeMatcher.java @@ -63,7 +63,7 @@ import com.raytheon.viz.gfe.rsc.GFEResource; * ------------- -------- ----------- -------------------------- * Nov 14, 2012 mschenke Initial creation * Feb 26, 2013 1708 randerso Fixed double notification for time change - * Jan 23, 2014 2703 bsteffen Add JAXB Annotations. + * Jan 23, 2014 2703 bsteffen Add JAXB Annotations, fix iscMode. * * * @@ -108,6 +108,7 @@ public class GFETimeMatcher extends AbstractTimeMatcher { if (resource instanceof GFEResource) { GFEResource rsc = (GFEResource) resource; Parm parm = rsc.getParm(); + Parm iscParm = getIscParm(parm); DataTime[] rscTimes = new DataTime[descriptorTimes.length]; for (int i = 0; i < descriptorTimes.length; ++i) { IGridData overlapping = parm.overlappingGrid(descriptorTimes[i] @@ -116,7 +117,16 @@ public class GFETimeMatcher extends AbstractTimeMatcher { TimeRange tr = overlapping.getGridTime(); rscTimes[i] = new DataTime(tr.getStart().getTime(), new TimeRange(tr.getStart(), tr.getEnd())); + } else if (iscParm != null) { + overlapping = iscParm.overlappingGrid(descriptorTimes[i] + .getRefTime()); + if (overlapping != null) { + TimeRange tr = overlapping.getGridTime(); + rscTimes[i] = new DataTime(tr.getStart().getTime(), + new TimeRange(tr.getStart(), tr.getEnd())); + } } + } if (timeMap != null) { timeMap.put(rsc, rscTimes); @@ -134,8 +144,17 @@ public class GFETimeMatcher extends AbstractTimeMatcher { List parms = new ArrayList(rscs.size()); for (GFEResource rsc : rscs) { if (rsc.getProperties().isVisible()) { - parms.add(rsc.getParm()); + Parm parm = rsc.getParm(); + parms.add(parm); + Parm iscParm = getIscParm(parm); + if (iscParm != null) { + parms.add(iscParm); + } tmbResources.add(rsc); + DataManager dataManager = parm.getDataManager(); + if (dataManager.getParmManager().iscMode()) { + parms.add(dataManager.getIscDataAccess().getISCParm(parm)); + } } } @@ -287,4 +306,12 @@ public class GFETimeMatcher extends AbstractTimeMatcher { } return new ArrayList(dateSet); } + + private static Parm getIscParm(Parm parm) { + DataManager dataManager = parm.getDataManager(); + if (dataManager.getParmManager().iscMode()) { + return dataManager.getIscDataAccess().getISCParm(parm); + } + return null; + } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/rsc/GFEResource.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/rsc/GFEResource.java index da8c644dfb..f59d220e16 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/rsc/GFEResource.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/rsc/GFEResource.java @@ -154,7 +154,7 @@ import com.vividsolutions.jts.geom.Envelope; * * SOFTWARE HISTORY * - * Date Ticket# Engineer Description + * Date Ticket# Engineer Description * ------------- -------- ----------- -------------------------- * Mar 01, 2008 chammack Initial Creation. * Aug 20, 2008 dglazesk Update for the ColorMap interface change @@ -166,7 +166,9 @@ import com.vividsolutions.jts.geom.Envelope; * Sep 23, 2013 2363 bsteffen Add more vector configuration options. * Oct 31, 2013 2508 randerso Change to use DiscreteGridSlice.getKeys() * Dec 11, 2013 2621 randerso Removed conditional from getParm so it never returns null - * Jan 23, 2014 2703 bsteffen Allow construction using a resourceData. + * Jan 23, 2014 2703 bsteffen Allow construction using a resourceData, + * paint using the time in paintProps and + * remove dead code in paintInternal * * * @@ -488,15 +490,9 @@ public class GFEResource extends PaintProperties paintProps) throws VizException { GFEPaintProperties myPaintProps = (GFEPaintProperties) paintProps; + this.curTime = myPaintProps.getDataTime(); - // TODO: Time matching changes for Hazard Services broke display of ISC - // grids when in ISC mode with no Fcst grid present. This fixes the - // issue for now but will need to be resolved for Hazard Services - - // this.curTime = myPaintProps.getDataTime(); - this.curTime = new DataTime(this.dataManager.getSpatialDisplayManager() - .getSpatialEditorTime()); - + // No data to be displayed here if (curTime == null) { return; } @@ -519,11 +515,6 @@ public class GFEResource extends this.lastGraphicsTarget = target; - // No data to be displayed here - if (this.curTime == null) { - return; - } - IGridData[] gd = this.parm.getGridInventory(this.curTime .getValidPeriod()); @@ -554,369 +545,333 @@ public class GFEResource extends .setRenderingOrder(renderingOrder); descriptor.getResourceList().sort(); - if (gd != null) { - IGridSlice gs = null; - if (dataManager.getParmManager().iscMode() && (gd.length == 0)) { - GridParmInfo gpi = this.parm.getGridInfo(); - GridType gridType = gpi.getGridType(); + IGridSlice gs = null; + if (dataManager.getParmManager().iscMode() && (gd.length == 0)) { + GridParmInfo gpi = this.parm.getGridInfo(); + GridType gridType = gpi.getGridType(); - IGrid2D dummyGrid = null; - switch (gridType) { - case SCALAR: - dummyGrid = new Grid2DFloat(gpi.getGridLoc().getNx(), - gpi.getGridLoc().getNy(), Float.NaN); - gs = new ScalarGridSlice(this.curTime.getValidPeriod(), - gpi, new GridDataHistory[] {}, - (Grid2DFloat) dummyGrid); - break; - case VECTOR: - dummyGrid = new Grid2DFloat(gpi.getGridLoc().getNx(), - gpi.getGridLoc().getNy(), Float.NaN); - gs = new VectorGridSlice(this.curTime.getValidPeriod(), - gpi, new GridDataHistory[] {}, - (Grid2DFloat) dummyGrid, - (Grid2DFloat) dummyGrid); - break; - case WEATHER: - dummyGrid = new Grid2DByte(gpi.getGridLoc().getNx(), - gpi.getGridLoc().getNy()); - gs = new WeatherGridSlice( - this.curTime.getValidPeriod(), gpi, - new GridDataHistory[] {}, - (Grid2DByte) dummyGrid, new WeatherKey[] {}); - break; - case DISCRETE: - dummyGrid = new Grid2DByte(gpi.getGridLoc().getNx(), - gpi.getGridLoc().getNy()); - gs = new DiscreteGridSlice( - this.curTime.getValidPeriod(), gpi, - new GridDataHistory[] {}, - (Grid2DByte) dummyGrid, new DiscreteKey[] {}); - break; - default: - return; - } - } else if (gd.length == 0) { + IGrid2D dummyGrid = null; + switch (gridType) { + case SCALAR: + dummyGrid = new Grid2DFloat(gpi.getGridLoc().getNx(), gpi + .getGridLoc().getNy(), Float.NaN); + gs = new ScalarGridSlice(this.curTime.getValidPeriod(), + gpi, new GridDataHistory[] {}, + (Grid2DFloat) dummyGrid); + break; + case VECTOR: + dummyGrid = new Grid2DFloat(gpi.getGridLoc().getNx(), gpi + .getGridLoc().getNy(), Float.NaN); + gs = new VectorGridSlice(this.curTime.getValidPeriod(), + gpi, new GridDataHistory[] {}, + (Grid2DFloat) dummyGrid, (Grid2DFloat) dummyGrid); + break; + case WEATHER: + dummyGrid = new Grid2DByte(gpi.getGridLoc().getNx(), gpi + .getGridLoc().getNy()); + gs = new WeatherGridSlice(this.curTime.getValidPeriod(), + gpi, new GridDataHistory[] {}, + (Grid2DByte) dummyGrid, new WeatherKey[] {}); + break; + case DISCRETE: + dummyGrid = new Grid2DByte(gpi.getGridLoc().getNx(), gpi + .getGridLoc().getNy()); + gs = new DiscreteGridSlice(this.curTime.getValidPeriod(), + gpi, new GridDataHistory[] {}, + (Grid2DByte) dummyGrid, new DiscreteKey[] {}); + break; + default: return; - } else { - gs = gd[0].getGridSlice(); + } + } else { + gs = gd[0].getGridSlice(); + } + if ((gs instanceof VectorGridSlice) + || (gs instanceof ScalarGridSlice)) { + + if (this.gridDisplay != null) { + this.gridDisplay.dispose(); } - if ((gs instanceof VectorGridSlice) - || (gs instanceof ScalarGridSlice)) { - - if (this.gridDisplay != null) { - this.gridDisplay.dispose(); - } - - if (this.contourDisplay != null) { - this.contourDisplay.dispose(); - } - - this.gridDisplay = null; - this.contourDisplay = null; + if (this.contourDisplay != null) { + this.contourDisplay.dispose(); } - if (gs instanceof VectorGridSlice) { - VectorGridSlice vectorSlice = (VectorGridSlice) gs; - Grid2DBit mask = parm.getDisplayAttributes() - .getDisplayMask(); + this.gridDisplay = null; + this.contourDisplay = null; + } - if (dataManager.getParmManager().iscMode() || iscParm) { - vectorSlice = new VectorGridSlice(); - mask = dataManager.getIscDataAccess().getCompositeGrid( - new GridID(this.parm, this.dataManager - .getSpatialDisplayManager() - .getSpatialEditorTime()), true, - vectorSlice); + if (gs instanceof VectorGridSlice) { + VectorGridSlice vectorSlice = (VectorGridSlice) gs; + Grid2DBit mask = parm.getDisplayAttributes().getDisplayMask(); + + if (dataManager.getParmManager().iscMode() || iscParm) { + vectorSlice = new VectorGridSlice(); + mask = dataManager.getIscDataAccess().getCompositeGrid( + new GridID(this.parm, this.curTime.getRefTime()), + true, vectorSlice); + } + + Grid2DFloat maskedGrid = new Grid2DFloat(vectorSlice + .getMagGrid().getXdim(), vectorSlice.getMagGrid() + .getYdim(), Float.NaN); + maskedGrid.copyWithMask(vectorSlice.getMagGrid(), mask); + FloatBuffer mag = maskedGrid.getBuffer(); + + Grid2DFloat dirGrid = new Grid2DFloat(vectorSlice.getMagGrid() + .getXdim(), vectorSlice.getDirGrid().getYdim(), + Float.NaN); + dirGrid.copyWithMask(vectorSlice.getDirGrid(), mask); + FloatBuffer dir = dirGrid.getBuffer(); + + if (visTypes.contains(VisualizationType.IMAGE)) { + this.gridDisplay = new GriddedImageDisplay(mag, descriptor, + this.gridGeometry); + } + + clearVectorDisplays(); + VectorGraphicsConfig vectorConfig; + for (VisualizationType type : visTypes) { + switch (type) { + case WIND_ARROW: + vectorConfig = new VectorGraphicsConfig(); + double size = getVectorSize("WindArrowDefaultSize"); + vectorConfig.setBaseSize(size); + vectorConfig.setCalmCircleSizeRatio(vectorConfig + .getCalmCircleSizeRatio() * BARB_SCALE_FACTOR); + vectorConfig.setArrowHeadStaffRatio(ARROW_HEAD_RATIO); + vectorConfig.alwaysIncludeCalmCircle(); + vectorConfig.alwaysIncludeVector(); + // get the logFactor + double logFactor = prefs.getDouble(parm.getParmID() + .compositeNameUI() + "_arrowScaling"); + double maxVal = parm.getGridInfo().getMaxValue(); + if (logFactor <= 0.0) { + vectorConfig.setLinearArrowScaleFactor(size + / maxVal); + } else { + vectorConfig.setArrowScaler(new LogArrowScalar( + size, logFactor, maxVal)); + } + + this.vectorDisplay.add(new GriddedVectorDisplay(mag, + dir, descriptor, MapUtil.getGridGeometry(gs + .getGridInfo().getGridLoc()), + VECTOR_DENSITY_FACTOR, false, + visTypeToDisplayType(type), vectorConfig)); + break; + + case WIND_BARB: + vectorConfig = new VectorGraphicsConfig(); + vectorConfig + .setBaseSize(getVectorSize("WindBarbDefaultSize") + * BARB_SCALE_FACTOR); + vectorConfig.alwaysIncludeCalmCircle(); + vectorConfig.alwaysIncludeVector(); + this.vectorDisplay + .add(new GriddedVectorDisplay(mag, dir, + descriptor, MapUtil.getGridGeometry(gs + .getGridInfo().getGridLoc()), + VECTOR_DENSITY_FACTOR + / BARB_SCALE_FACTOR, false, + visTypeToDisplayType(type), + vectorConfig)); + break; + + case IMAGE: + break; + + default: + statusHandler.handle( + Priority.PROBLEM, + "Unsupported Visualization Type: " + + type.toString()); } + } + } else if (gs instanceof ScalarGridSlice) { + ScalarGridSlice scalarSlice = (ScalarGridSlice) gs; + Grid2DBit mask = parm.getDisplayAttributes().getDisplayMask(); - Grid2DFloat maskedGrid = new Grid2DFloat(vectorSlice - .getMagGrid().getXdim(), vectorSlice.getMagGrid() - .getYdim(), Float.NaN); - maskedGrid.copyWithMask(vectorSlice.getMagGrid(), mask); - FloatBuffer mag = maskedGrid.getBuffer(); + if (dataManager.getParmManager().iscMode() || iscParm) { + scalarSlice = new ScalarGridSlice(); + mask = dataManager.getIscDataAccess().getCompositeGrid( + new GridID(this.parm, this.curTime.getRefTime()), + true, scalarSlice); - Grid2DFloat dirGrid = new Grid2DFloat(vectorSlice - .getMagGrid().getXdim(), vectorSlice.getDirGrid() - .getYdim(), Float.NaN); - dirGrid.copyWithMask(vectorSlice.getDirGrid(), mask); - FloatBuffer dir = dirGrid.getBuffer(); + } + Grid2DFloat scalarGrid = scalarSlice.getScalarGrid(); + if (scalarGrid != null) { + Grid2DFloat maskedGrid = new Grid2DFloat( + scalarGrid.getXdim(), scalarGrid.getYdim(), + Float.NaN); + maskedGrid.copyWithMask(scalarGrid, mask); + FloatBuffer fb = maskedGrid.getBuffer(); if (visTypes.contains(VisualizationType.IMAGE)) { - this.gridDisplay = new GriddedImageDisplay(mag, + this.gridDisplay = new GriddedImageDisplay(fb, descriptor, this.gridGeometry); } - clearVectorDisplays(); - VectorGraphicsConfig vectorConfig; - for (VisualizationType type : visTypes) { - switch (type) { - case WIND_ARROW: - vectorConfig = new VectorGraphicsConfig(); - double size = getVectorSize("WindArrowDefaultSize"); - vectorConfig.setBaseSize(size); - vectorConfig.setCalmCircleSizeRatio(vectorConfig - .getCalmCircleSizeRatio() - * BARB_SCALE_FACTOR); - vectorConfig - .setArrowHeadStaffRatio(ARROW_HEAD_RATIO); - vectorConfig.alwaysIncludeCalmCircle(); - vectorConfig.alwaysIncludeVector(); - // get the logFactor - double logFactor = prefs.getDouble(parm.getParmID() - .compositeNameUI() + "_arrowScaling"); - double maxVal = parm.getGridInfo().getMaxValue(); - if (logFactor <= 0.0) { - vectorConfig.setLinearArrowScaleFactor(size - / maxVal); - } else { - vectorConfig.setArrowScaler(new LogArrowScalar( - size, logFactor, maxVal)); - } - - this.vectorDisplay.add(new GriddedVectorDisplay( - mag, dir, descriptor, MapUtil - .getGridGeometry(gs.getGridInfo() - .getGridLoc()), - VECTOR_DENSITY_FACTOR, false, - visTypeToDisplayType(type), vectorConfig)); - break; - - case WIND_BARB: - vectorConfig = new VectorGraphicsConfig(); - vectorConfig - .setBaseSize(getVectorSize("WindBarbDefaultSize") - * BARB_SCALE_FACTOR); - vectorConfig.alwaysIncludeCalmCircle(); - vectorConfig.alwaysIncludeVector(); - this.vectorDisplay.add(new GriddedVectorDisplay( - mag, dir, descriptor, MapUtil - .getGridGeometry(gs.getGridInfo() - .getGridLoc()), - VECTOR_DENSITY_FACTOR / BARB_SCALE_FACTOR, - false, visTypeToDisplayType(type), - vectorConfig)); - break; - - case IMAGE: - break; - - default: - statusHandler.handle( - Priority.PROBLEM, - "Unsupported Visualization Type: " - + type.toString()); - } + if (visTypes.contains(VisualizationType.CONTOUR)) { + this.contourDisplay = new GriddedContourDisplay( + descriptor, this.gridGeometry, fb); } - } else if (gs instanceof ScalarGridSlice) { - ScalarGridSlice scalarSlice = (ScalarGridSlice) gs; - Grid2DBit mask = parm.getDisplayAttributes() - .getDisplayMask(); + } + } else if (gs instanceof DiscreteGridSlice) { + DiscreteGridSlice slice = (DiscreteGridSlice) gs; - if (dataManager.getParmManager().iscMode() || iscParm) { - scalarSlice = new ScalarGridSlice(); - mask = dataManager.getIscDataAccess().getCompositeGrid( - new GridID(this.parm, this.dataManager - .getSpatialDisplayManager() - .getSpatialEditorTime()), true, - scalarSlice); + // Dispose all of the outlineShapes and shadedShapes + for (IWireframeShape shape : outlineShapes.values()) { + shape.dispose(); + } + outlineShapes.clear(); + for (Collection shapeList : shadedShapes.values()) { + for (IShadedShape shadedShape : shapeList) { + shadedShape.dispose(); } - Grid2DFloat scalarGrid = scalarSlice.getScalarGrid(); - if (scalarGrid != null) { - Grid2DFloat maskedGrid = new Grid2DFloat( - scalarGrid.getXdim(), scalarGrid.getYdim(), - Float.NaN); - maskedGrid.copyWithMask(scalarGrid, mask); + shapeList.clear(); + } + shadedShapes.clear(); - FloatBuffer fb = maskedGrid.getBuffer(); - if (visTypes.contains(VisualizationType.IMAGE)) { - this.gridDisplay = new GriddedImageDisplay(fb, - descriptor, this.gridGeometry); + Grid2DBit mask = parm.getDisplayAttributes().getDisplayMask(); + + if (dataManager.getParmManager().iscMode() || iscParm) { + slice = new DiscreteGridSlice(); + GridID gid = new GridID(parm, this.curTime.getRefTime()); + mask = dataManager.getIscDataAccess().getCompositeGrid(gid, + true, slice); + } + + for (DiscreteKey discreteKey : slice.getKeys()) { + + if (discreteKey.isValid()) { + outlineShapes.put(discreteKey, target + .createWireframeShape(false, this.descriptor)); + + Collection shapeList = new ArrayList(); + shadedShapes.put(discreteKey, shapeList); + + WxValue wxValue = new DiscreteWxValue(discreteKey, parm); + + List fillAttrs = DiscreteDisplayUtil + .getFillAttributes(wxValue); + + boolean first = true; + for (ImageAttr attr : fillAttrs) { + IShadedShape shadedShape = target + .createShadedShape(false, + this.descriptor.getGridGeometry(), + true); + shapeList.add(shadedShape); + + IWireframeShape outlineShape = first ? outlineShapes + .get(discreteKey) : null; + first = false; + + JTSCompiler jtsCompiler = new JTSCompiler( + shadedShape, outlineShape, this.descriptor); + + byte[] fillPattern = FillPatterns.getGLPattern(attr + .getFillPatternName()); + + RGB fillColor = RGBColors.getRGBColor(attr + .getColorName()); + + Grid2DBit tmpBit = slice.eq(discreteKey).and(mask); + + ReferenceData refData = new ReferenceData(gs + .getGridInfo().getGridLoc(), + new ReferenceID("temp"), tmpBit); + + jtsCompiler.handle( + refData.getPolygons(CoordinateType.LATLON), + fillColor); + shadedShape.compile(); + shadedShape.setFillPattern(fillPattern); } - if (visTypes.contains(VisualizationType.CONTOUR)) { - this.contourDisplay = new GriddedContourDisplay( - descriptor, this.gridGeometry, fb); - } + outlineShapes.get(discreteKey).compile(); } - } else if (gs instanceof DiscreteGridSlice) { - DiscreteGridSlice slice = (DiscreteGridSlice) gs; + } + } else if (gs instanceof WeatherGridSlice) { + WeatherGridSlice slice = (WeatherGridSlice) gs; - // Dispose all of the outlineShapes and shadedShapes - for (IWireframeShape shape : outlineShapes.values()) { - shape.dispose(); + // Dispose all of the outlineShapes and shadedShapes + for (IWireframeShape shape : outlineShapes.values()) { + shape.dispose(); + } + outlineShapes.clear(); + + for (Collection shapeList : shadedShapes.values()) { + for (IShadedShape shadedShape : shapeList) { + shadedShape.dispose(); } - outlineShapes.clear(); + shapeList.clear(); + } + shadedShapes.clear(); - for (Collection shapeList : shadedShapes - .values()) { - for (IShadedShape shadedShape : shapeList) { - shadedShape.dispose(); - } - shapeList.clear(); - } - shadedShapes.clear(); + Grid2DBit mask = parm.getDisplayAttributes().getDisplayMask(); - Grid2DBit mask = parm.getDisplayAttributes() - .getDisplayMask(); + if (dataManager.getParmManager().iscMode() || iscParm) { + slice = new WeatherGridSlice(); + GridID gid = new GridID(parm, this.curTime.getRefTime()); + mask = dataManager.getIscDataAccess().getCompositeGrid(gid, + true, slice); + } - if (dataManager.getParmManager().iscMode() || iscParm) { - slice = new DiscreteGridSlice(); - GridID gid = new GridID(parm, this.dataManager - .getSpatialDisplayManager() - .getSpatialEditorTime()); - mask = dataManager.getIscDataAccess().getCompositeGrid( - gid, true, slice); - } + for (WeatherKey weatherKey : slice.getKeys()) { - for (DiscreteKey discreteKey : slice.getKeys()) { + if (weatherKey.isValid()) { + outlineShapes.put(weatherKey, target + .createWireframeShape(false, this.descriptor)); - if (discreteKey.isValid()) { - outlineShapes.put(discreteKey, target - .createWireframeShape(false, - this.descriptor)); + Collection shapeList = new ArrayList(); + shadedShapes.put(weatherKey, shapeList); - Collection shapeList = new ArrayList(); - shadedShapes.put(discreteKey, shapeList); + WxValue wxValue = new WeatherWxValue(weatherKey, parm); - WxValue wxValue = new DiscreteWxValue(discreteKey, - parm); + List fillAttrs = DiscreteDisplayUtil + .getFillAttributes(wxValue); - List fillAttrs = DiscreteDisplayUtil - .getFillAttributes(wxValue); + boolean first = true; + for (ImageAttr attr : fillAttrs) { + IShadedShape shadedShape = target + .createShadedShape(false, + this.descriptor.getGridGeometry(), + true); + shapeList.add(shadedShape); - boolean first = true; - for (ImageAttr attr : fillAttrs) { - IShadedShape shadedShape = target - .createShadedShape(false, - this.descriptor, true); - shapeList.add(shadedShape); + IWireframeShape outlineShape = first ? outlineShapes + .get(weatherKey) : null; + first = false; - IWireframeShape outlineShape = first ? outlineShapes - .get(discreteKey) : null; - first = false; + JTSCompiler jtsCompiler = new JTSCompiler( + shadedShape, outlineShape, this.descriptor); - JTSCompiler jtsCompiler = new JTSCompiler( - shadedShape, outlineShape, - this.descriptor); + byte[] fillPattern = FillPatterns.getGLPattern(attr + .getFillPatternName()); - byte[] fillPattern = FillPatterns - .getGLPattern(attr.getFillPatternName()); + RGB fillColor = RGBColors.getRGBColor(attr + .getColorName()); - RGB fillColor = RGBColors.getRGBColor(attr - .getColorName()); + Grid2DBit tmpBit = slice.eq(weatherKey).and(mask); - Grid2DBit tmpBit = slice.eq(discreteKey).and( - mask); + ReferenceData refData = new ReferenceData(gs + .getGridInfo().getGridLoc(), + new ReferenceID("temp"), tmpBit); - ReferenceData refData = new ReferenceData(gs - .getGridInfo().getGridLoc(), - new ReferenceID("temp"), tmpBit); + jtsCompiler.handle( + refData.getPolygons(CoordinateType.LATLON), + fillColor); + shadedShape.compile(); + shadedShape.setFillPattern(fillPattern); + } // next diIdx - jtsCompiler.handle(refData - .getPolygons(CoordinateType.LATLON), - fillColor); - shadedShape.compile(); - shadedShape.setFillPattern(fillPattern); - } - - outlineShapes.get(discreteKey).compile(); - } - } - } else if (gs instanceof WeatherGridSlice) { - WeatherGridSlice slice = (WeatherGridSlice) gs; - - // Dispose all of the outlineShapes and shadedShapes - for (IWireframeShape shape : outlineShapes.values()) { - shape.dispose(); - } - outlineShapes.clear(); - - for (Collection shapeList : shadedShapes - .values()) { - for (IShadedShape shadedShape : shapeList) { - shadedShape.dispose(); - } - shapeList.clear(); - } - shadedShapes.clear(); - - Grid2DBit mask = parm.getDisplayAttributes() - .getDisplayMask(); - - if (dataManager.getParmManager().iscMode() || iscParm) { - slice = new WeatherGridSlice(); - GridID gid = new GridID(parm, this.dataManager - .getSpatialDisplayManager() - .getSpatialEditorTime()); - mask = dataManager.getIscDataAccess().getCompositeGrid( - gid, true, slice); - } - - for (WeatherKey weatherKey : slice.getKeys()) { - - if (weatherKey.isValid()) { - outlineShapes.put(weatherKey, target - .createWireframeShape(false, - this.descriptor)); - - Collection shapeList = new ArrayList(); - shadedShapes.put(weatherKey, shapeList); - - WxValue wxValue = new WeatherWxValue(weatherKey, - parm); - - List fillAttrs = DiscreteDisplayUtil - .getFillAttributes(wxValue); - - boolean first = true; - for (ImageAttr attr : fillAttrs) { - IShadedShape shadedShape = target - .createShadedShape(false, - this.descriptor, true); - shapeList.add(shadedShape); - - IWireframeShape outlineShape = first ? outlineShapes - .get(weatherKey) : null; - first = false; - - JTSCompiler jtsCompiler = new JTSCompiler( - shadedShape, outlineShape, - this.descriptor); - - byte[] fillPattern = FillPatterns - .getGLPattern(attr.getFillPatternName()); - - RGB fillColor = RGBColors.getRGBColor(attr - .getColorName()); - - Grid2DBit tmpBit = slice.eq(weatherKey).and( - mask); - - ReferenceData refData = new ReferenceData(gs - .getGridInfo().getGridLoc(), - new ReferenceID("temp"), tmpBit); - - jtsCompiler.handle(refData - .getPolygons(CoordinateType.LATLON), - fillColor); - shadedShape.compile(); - shadedShape.setFillPattern(fillPattern); - } // next diIdx - - outlineShapes.get(weatherKey).compile(); - } + outlineShapes.get(weatherKey).compile(); } } } - } else if (this.curTime == null) { - if (this.gridDisplay != null) { - this.gridDisplay.dispose(); - this.gridDisplay = null; - } - this.lastDisplayedTime = null; } float brightness = 1.0f;