From 3e748f800f1025954f77398e944e8d0fe814fc3e Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Mon, 31 Aug 2015 10:12:34 -0500 Subject: [PATCH] Omaha #4709 Style rules for SAR winds. Former-commit-id: ce089919bdf103567b7ed51400ef06381181437e --- .../uf/viz/pointset/rsc/PointSetFrame.java | 8 +++- .../uf/viz/pointset/rsc/PointSetResource.java | 38 +++++++++++++---- .../build.properties | 3 +- .../pointSetSatelliteImageryStyleRules.xml | 41 +++++++++++++++++++ 4 files changed, 79 insertions(+), 11 deletions(-) create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.pointset/utility/common_static/base/styleRules/pointSetSatelliteImageryStyleRules.xml diff --git a/cave/com.raytheon.uf.viz.pointset/src/com/raytheon/uf/viz/pointset/rsc/PointSetFrame.java b/cave/com.raytheon.uf.viz.pointset/src/com/raytheon/uf/viz/pointset/rsc/PointSetFrame.java index 0d27ffb4ef..622d6dc94d 100644 --- a/cave/com.raytheon.uf.viz.pointset/src/com/raytheon/uf/viz/pointset/rsc/PointSetFrame.java +++ b/cave/com.raytheon.uf.viz.pointset/src/com/raytheon/uf/viz/pointset/rsc/PointSetFrame.java @@ -85,7 +85,13 @@ public class PointSetFrame { } public String inspect(double x, double y) { - return image.getDataValue(x, y) + record.getParameter().getUnitString(); + double data_value = image.getDataValue(x, y); + if (Double.isNaN(data_value)) { + return "No Data"; + } else { + return String.format("%4.2f %s", image.getDataValue(x, y), record + .getParameter().getUnitString()); + } } public boolean paint(PaintProperties paintProps, IGraphicsTarget target) diff --git a/cave/com.raytheon.uf.viz.pointset/src/com/raytheon/uf/viz/pointset/rsc/PointSetResource.java b/cave/com.raytheon.uf.viz.pointset/src/com/raytheon/uf/viz/pointset/rsc/PointSetResource.java index f84257290c..ae96cb5e66 100644 --- a/cave/com.raytheon.uf.viz.pointset/src/com/raytheon/uf/viz/pointset/rsc/PointSetResource.java +++ b/cave/com.raytheon.uf.viz.pointset/src/com/raytheon/uf/viz/pointset/rsc/PointSetResource.java @@ -47,6 +47,7 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.pointset.PointSetRecord; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.numeric.UnsignedNumbers; +import com.raytheon.uf.common.style.AbstractStylePreferences; import com.raytheon.uf.common.style.ParamLevelMatchCriteria; import com.raytheon.uf.common.style.StyleException; import com.raytheon.uf.common.style.StyleManager; @@ -88,6 +89,8 @@ public class PointSetResource extends private final PointSetStageJob stageJob = new PointSetStageJob(); + private StyleRule styleRule; + private Map frames = new HashMap<>(); protected PointSetResource(PointSetResourceData resourceData, @@ -116,7 +119,7 @@ public class PointSetResource extends matchCriteria.setCreatingEntityNames(Arrays.asList(record .getDatasetId())); try { - StyleRule styleRule = StyleManager.getInstance().getStyleRule( + styleRule = StyleManager.getInstance().getStyleRule( StyleType.IMAGERY, matchCriteria); if (styleRule != null) { return ColorMapParameterFactory.build(styleRule, record @@ -251,17 +254,34 @@ public class PointSetResource extends } else { PointSetRecord record = frame.getRecord(); String unitStr = record.getParameter().getUnitString(); - ColorMapParameters parameters = getCapability( - ColorMapCapability.class).getColorMapParameters(); - if (parameters != null) { - Unit unit = parameters.getDisplayUnit(); - if (unit != null) { - unitStr = UnitFormat.getUCUMInstance().format(unit); + boolean includeLevel = true; + if (styleRule != null) { + AbstractStylePreferences prefs = styleRule.getPreferences(); + includeLevel = !prefs.getDisplayFlags() + .hasFlag("NoPlane"); + String prefsUnitStr = prefs.getDisplayUnitLabel(); + if (prefsUnitStr != null) { + unitStr = prefs.getDisplayUnitLabel(); + } + } else { + ColorMapParameters parameters = getCapability( + ColorMapCapability.class).getColorMapParameters(); + if (parameters != null) { + Unit unit = parameters.getDisplayUnit(); + if (unit != null) { + unitStr = UnitFormat.getUCUMInstance().format(unit); + } } } - return frame.getRecord().getDatasetId() + " " + record.getLevel() - + " " + record.getParameter().getName() + " (" + unitStr + String datasetIdPart = frame.getRecord().getDatasetId(); + String levelPart = ""; + if (includeLevel) { + levelPart = " " + record.getLevel(); + } + String paramPart = " " + record.getParameter().getName() + " (" + + unitStr + ")"; + return datasetIdPart + levelPart + paramPart; } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pointset/build.properties b/edexOsgi/com.raytheon.uf.common.dataplugin.pointset/build.properties index 34d2e4d2da..544aa7de88 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.pointset/build.properties +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.pointset/build.properties @@ -1,4 +1,5 @@ source.. = src/ output.. = bin/ bin.includes = META-INF/,\ - . + .,\ + utility/ diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.pointset/utility/common_static/base/styleRules/pointSetSatelliteImageryStyleRules.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.pointset/utility/common_static/base/styleRules/pointSetSatelliteImageryStyleRules.xml new file mode 100644 index 0000000000..268d0c1e4f --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.pointset/utility/common_static/base/styleRules/pointSetSatelliteImageryStyleRules.xml @@ -0,0 +1,41 @@ + + + + + + RADARSAT-2 + SENTINEL-1A + WS + + + m/s + NoPlane + + 0 + 75 + + Grid/gridded data + + 10 + + + +