From e2d8355f77a58895704885d2670014f9e40b6ad7 Mon Sep 17 00:00:00 2001 From: Matt Nash Date: Tue, 10 Sep 2013 09:04:08 -0500 Subject: [PATCH] Issue #2251 move style rules and preferences to common Change-Id: I50bd92d1ed4e08d7d6204b7fa1cca0e8f1645030 Former-commit-id: f0a32e82a150ace2adb086206f5b4b2ef17b02a0 [formerly 06e04a419d0dc8a4ecdc4c4c14637029377e369a [formerly 982f297ab19ebcb5e49f662c30b44992e63569cb]] Former-commit-id: 06e04a419d0dc8a4ecdc4c4c14637029377e369a Former-commit-id: e6af6c447fb249d59e6297a7b8d0362748f1390c --- .../feature.xml | 7 + .../META-INF/MANIFEST.MF | 5 +- ...f.common.serialization.ISerializableObject | 5 - .../viz/core/datastructure/DataCubeKey.java | 2 +- .../viz/core/slice/request/HeightScale.java | 2 +- .../META-INF/MANIFEST.MF | 7 +- .../raytheon/uf/viz/cwat/CWATResource.java | 18 +- .../META-INF/MANIFEST.MF | 4 +- .../viz/d2d/gfe/browser/GFEVbDataCatalog.java | 13 +- .../uf/viz/d2d/gfe/rsc/GFEGridResource.java | 12 +- .../viz/d2d/gfe/xy/GfeTimeSeriesAdapter.java | 20 +- .../META-INF/MANIFEST.MF | 3 +- .../timeseries/DmdTimeSeriesAdapter.java | 4 +- .../timeseries/GridTimeSeriesAdapter.java | 2 +- .../PointDataTimeSeriesAdapter.java | 27 +- .../META-INF/MANIFEST.MF | 3 +- .../monitor/ffmp/ui/rsc/FFMPColorUtils.java | 68 +- .../META-INF/MANIFEST.MF | 3 +- .../uf/viz/npp/viirs/rsc/VIIRSResource.java | 22 +- .../viirs/style/VIIRSDataMatchCriteria.java | 8 +- .../viirs/style/VIIRSDataRecordCriteria.java | 8 +- .../META-INF/MANIFEST.MF | 3 +- .../viz/objectiveanalysis/rsc/OAResource.java | 14 +- .../objectiveanalysis/rsc/OAResourceData.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../uf/viz/preciprate/PrecipRateResource.java | 61 +- .../META-INF/MANIFEST.MF | 3 +- .../com/raytheon/uf/viz/qpf/QPFResource.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../com/raytheon/uf/viz/vil/VILResource.java | 18 +- .../META-INF/MANIFEST.MF | 10 +- .../crosssection/graph/CrossSectionGraph.java | 4 +- .../rsc/AbstractCrossSectionResource.java | 13 +- .../rsc/CrossSectionContourResource.java | 12 +- .../rsc/CrossSectionImageResource.java | 10 +- .../rsc/CrossSectionVectorResource.java | 14 +- .../META-INF/MANIFEST.MF | 7 +- .../rsc/AbstractTimeHeightResource.java | 11 +- .../rsc/TimeHeightContourResource.java | 12 +- .../rsc/TimeHeightImageResource.java | 10 +- .../rsc/TimeHeightVectorResource.java | 12 +- .../META-INF/MANIFEST.MF | 6 +- .../adapter/AbstractTimeSeriesAdapter.java | 4 +- .../xy/timeseries/rsc/TimeSeriesResource.java | 32 +- .../META-INF/MANIFEST.MF | 4 +- .../xy/varheight/rsc/VarHeightResource.java | 11 +- .../META-INF/MANIFEST.MF | 7 +- .../core/contours/ContourCreateRequest.java | 2 +- .../viz/core/contours/ContourRenderable.java | 2 +- .../viz/core/contours/ContourSupport.java | 4 +- .../rsc/displays/GriddedContourDisplay.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../viz/core/graphing/DataAxisInfo.java | 2 +- .../viz/core/graphing/axis/AxisFactory.java | 17 +- .../viz/core/graphing/axis/AxisUtil.java | 4 +- .../core/graphing/util/GraphPrefsFactory.java | 20 +- .../core/graphing/util/GraphUtilPorted.java | 17 +- .../META-INF/MANIFEST.MF | 7 +- ...f.common.serialization.ISerializableObject | 4 - .../drawables/ColorMapParameterFactory.java | 28 +- .../raytheon/viz/core/topo/TopoResource.java | 26 +- .../META-INF/MANIFEST.MF | 3 +- .../rsc/grid/GenericGridResource.java | 4 +- .../com.raytheon.viz.gfe/META-INF/MANIFEST.MF | 3 +- .../com/raytheon/viz/gfe/rsc/GFEResource.java | 4 +- .../META-INF/MANIFEST.MF | 10 +- .../viz/grid/GridLevelTranslator.java | 4 +- .../rsc/general/AbstractGridResource.java | 34 +- .../rsc/general/DifferenceGridResource.java | 2 +- .../viz/grid/rsc/general/GridResource.java | 6 +- .../raytheon/viz/grid/util/RadarAdapter.java | 4 +- .../META-INF/MANIFEST.MF | 3 +- .../viz/mpe/ui/rsc/MPEFieldResource.java | 18 +- .../META-INF/MANIFEST.MF | 6 +- .../RadarDefaultInterrogator.java | 12 +- .../viz/radar/rsc/RadarNameGenerator.java | 12 +- .../viz/radar/util/DataUtilities.java | 12 +- .../META-INF/MANIFEST.MF | 3 +- .../viz/satellite/rsc/SatResource.java | 24 +- .../META-INF/MANIFEST.MF | 3 +- .../datacatalog/AbstractDataCatalog.java | 20 +- .../com.raytheon.uf.common.style/.classpath | 7 + .../com.raytheon.uf.common.style/.project | 28 + .../.settings/org.eclipse.jdt.core.prefs | 7 + .../META-INF/MANIFEST.MF | 19 + ...f.common.serialization.ISerializableObject | 9 + .../build.properties | 4 + .../style/AbstractStylePreferences.java | 2 +- .../uf/common}/style/LabelingPreferences.java | 2 +- .../uf/common}/style/MatchCriteria.java | 4 +- .../style/ParamLevelMatchCriteria.java | 14 +- .../uf/common/style/StyleException.java | 65 +- .../uf/common}/style/StyleManager.java | 71 +- .../raytheon/uf/common}/style/StyleRule.java | 2 +- .../uf/common}/style/StyleRuleset.java | 2 +- .../common}/style/arrow/ArrowPreferences.java | 4 +- .../style/contour/ContourPreferences.java | 6 +- .../uf/common}/style/graph/AxisScale.java | 2 +- .../common}/style/graph/GraphPreferences.java | 6 +- .../uf/common}/style/image/DataScale.java | 2 +- .../common}/style/image/ImagePreferences.java | 14 +- .../style/image/SamplePreferences.java | 2 +- .../uf/common}/style/level/Level.java | 2 +- .../uf/common}/style/level/RangeLevel.java | 2 +- .../uf/common}/style/level/SingleLevel.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../viz/rsc/mosaic/rsc/MosaicResource.java | 1162 +++++------ .../META-INF/MANIFEST.MF | 3 +- .../rsc/ncgrid/rsc/GridLevelTranslator.java | 4 +- .../viz/rsc/ncgrid/rsc/NcgridResource.java | 2 +- .../META-INF/MANIFEST.MF | 3 +- .../rsc/ncradar/rsc/RadarImageResource.java | 4 +- .../rsc/ncradar/rsc/RadarNameGenerator.java | 12 +- .../META-INF/MANIFEST.MF | 3 +- .../rsc/AbstractSatelliteResource.java | 38 +- .../META-INF/MANIFEST.MF | 3 +- .../display/SolarImageMatchCriteria.java | 8 +- .../rsc/solarimage/rsc/CylindCedDisplay.java | 2 +- .../rsc/solarimage/rsc/SolarImageDisplay.java | 285 +-- .../solarimage/rsc/SolarImageResource.java | 26 +- .../META-INF/MANIFEST.MF | 3 +- .../viz/ui/display/ColorBarFromColormap.java | 1702 +++++++++-------- 122 files changed, 2315 insertions(+), 2084 deletions(-) create mode 100644 edexOsgi/com.raytheon.uf.common.style/.classpath create mode 100644 edexOsgi/com.raytheon.uf.common.style/.project create mode 100644 edexOsgi/com.raytheon.uf.common.style/.settings/org.eclipse.jdt.core.prefs create mode 100644 edexOsgi/com.raytheon.uf.common.style/META-INF/MANIFEST.MF create mode 100644 edexOsgi/com.raytheon.uf.common.style/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject create mode 100644 edexOsgi/com.raytheon.uf.common.style/build.properties rename {cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/AbstractStylePreferences.java (99%) rename {cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/LabelingPreferences.java (99%) rename {cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/MatchCriteria.java (96%) rename {cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/ParamLevelMatchCriteria.java (95%) rename cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/VizStyleException.java => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleException.java (56%) rename {cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/StyleManager.java (77%) rename {cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/StyleRule.java (98%) rename {cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/StyleRuleset.java (98%) rename {cave/com.raytheon.viz.core/src/com/raytheon/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/arrow/ArrowPreferences.java (95%) rename {cave/com.raytheon.viz.core/src/com/raytheon/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/contour/ContourPreferences.java (97%) rename {cave/com.raytheon.viz.core/src/com/raytheon/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/graph/AxisScale.java (98%) rename {cave/com.raytheon.viz.core/src/com/raytheon/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/graph/GraphPreferences.java (93%) rename {cave/com.raytheon.viz.core/src/com/raytheon/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/image/DataScale.java (98%) rename {cave/com.raytheon.viz.core/src/com/raytheon/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/image/ImagePreferences.java (94%) rename {cave/com.raytheon.viz.core/src/com/raytheon/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/image/SamplePreferences.java (98%) rename {cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/level/Level.java (99%) rename {cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/level/RangeLevel.java (98%) rename {cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core => edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common}/style/level/SingleLevel.java (98%) diff --git a/cave/com.raytheon.uf.viz.core.feature/feature.xml b/cave/com.raytheon.uf.viz.core.feature/feature.xml index efc8de80fc..a2cd1f5b1b 100644 --- a/cave/com.raytheon.uf.viz.core.feature/feature.xml +++ b/cave/com.raytheon.uf.viz.core.feature/feature.xml @@ -199,4 +199,11 @@ install-size="0" version="0.0.0"/> + + diff --git a/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF index 95b900320a..5f6ec90fa7 100644 --- a/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.core/META-INF/MANIFEST.MF @@ -41,7 +41,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.alertmonitor;bundle-version="1.12.1174", com.raytheon.uf.common.python;bundle-version="1.12.1174", com.raytheon.uf.common.velocity;bundle-version="1.0.0", - ch.qos.logback;bundle-version="1.0.13" + ch.qos.logback;bundle-version="1.0.13", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Eclipse-BuddyPolicy: ext, registered, global Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.status, com.raytheon.uf.common.dataplugin.level, com.raytheon.uf.common.comm, ch.qos.logback @@ -82,8 +83,6 @@ Export-Package: com.raytheon.uf.viz.core, com.raytheon.uf.viz.core.rsc.updater, com.raytheon.uf.viz.core.sampling, com.raytheon.uf.viz.core.status, - com.raytheon.uf.viz.core.style, - com.raytheon.uf.viz.core.style.level, com.raytheon.uf.viz.core.tile, com.raytheon.uf.viz.core.time, com.raytheon.viz.core.slice.request, diff --git a/cave/com.raytheon.uf.viz.core/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/cave/com.raytheon.uf.viz.core/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject index add829be64..aa203ed95e 100644 --- a/cave/com.raytheon.uf.viz.core/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ b/cave/com.raytheon.uf.viz.core/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -23,9 +23,4 @@ com.raytheon.uf.viz.core.rsc.ResourceList com.raytheon.uf.viz.core.rsc.ResourceProperties com.raytheon.uf.viz.core.rsc.ProgressiveDisclosureProperties com.raytheon.uf.viz.core.rsc.LoadProperties -com.raytheon.uf.viz.core.style.level.SingleLevel -com.raytheon.uf.viz.core.style.level.RangeLevel -com.raytheon.uf.viz.core.style.StyleRule -com.raytheon.uf.viz.core.style.StyleRuleset -com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DataCubeKey.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DataCubeKey.java index c89e4eca26..2406dc35c6 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DataCubeKey.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/datastructure/DataCubeKey.java @@ -19,8 +19,8 @@ **/ package com.raytheon.uf.viz.core.datastructure; +import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.style.level.SingleLevel; /** * Key for data in the data cube diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/viz/core/slice/request/HeightScale.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/viz/core/slice/request/HeightScale.java index 464535eb6d..e8cdcb5481 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/viz/core/slice/request/HeightScale.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/viz/core/slice/request/HeightScale.java @@ -31,7 +31,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import com.raytheon.uf.common.serialization.ISerializableObject; import com.raytheon.uf.common.serialization.adapters.UnitAdapter; -import com.raytheon.uf.viz.core.style.level.Level.LevelType; +import com.raytheon.uf.common.style.level.Level.LevelType; /** * Height scale used by volume browser diff --git a/cave/com.raytheon.uf.viz.cwat/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.cwat/META-INF/MANIFEST.MF index 41daf2370a..52fa8387d6 100644 --- a/cave/com.raytheon.uf.viz.cwat/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.cwat/META-INF/MANIFEST.MF @@ -9,9 +9,10 @@ Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, com.raytheon.viz.core, - com.raytheon.uf.common.dataplugin.cwat;bundle-version="1.0.0", - com.raytheon.uf.common.colormap;bundle-version="1.11.17", - com.raytheon.uf.common.monitor;bundle-version="1.11.17" + com.raytheon.uf.common.dataplugin.cwat, + com.raytheon.uf.common.colormap, + com.raytheon.uf.common.monitor, + com.raytheon.uf.common.style Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.viz.cwat diff --git a/cave/com.raytheon.uf.viz.cwat/src/com/raytheon/uf/viz/cwat/CWATResource.java b/cave/com.raytheon.uf.viz.cwat/src/com/raytheon/uf/viz/cwat/CWATResource.java index f295126258..265373447c 100644 --- a/cave/com.raytheon.uf.viz.cwat/src/com/raytheon/uf/viz/cwat/CWATResource.java +++ b/cave/com.raytheon.uf.viz.cwat/src/com/raytheon/uf/viz/cwat/CWATResource.java @@ -40,6 +40,11 @@ import com.raytheon.uf.common.monitor.scan.SCTI; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.image.ImagePreferences; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.ColorMapLoader; @@ -51,11 +56,7 @@ import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay2; -import com.raytheon.viz.core.style.image.ImagePreferences; import com.vividsolutions.jts.geom.Coordinate; /** @@ -216,8 +217,13 @@ public class CWATResource extends ColorMapCapability.class).getColorMapParameters(); if (record != null && init) { - StyleRule sr = StyleManager.getInstance().getStyleRule( - StyleManager.StyleType.IMAGERY, getMatchCriteria()); + StyleRule sr; + try { + sr = StyleManager.getInstance().getStyleRule( + StyleManager.StyleType.IMAGERY, getMatchCriteria()); + } catch (StyleException e) { + throw new VizException(e.getLocalizedMessage(), e); + } this.colormapfile = ((ImagePreferences) sr.getPreferences()) .getDefaultColormap(); diff --git a/cave/com.raytheon.uf.viz.d2d.gfe/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.d2d.gfe/META-INF/MANIFEST.MF index ff32ce1ec2..c79534fb82 100644 --- a/cave/com.raytheon.uf.viz.d2d.gfe/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.d2d.gfe/META-INF/MANIFEST.MF @@ -22,6 +22,8 @@ Import-Package: com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.message, com.raytheon.uf.common.serialization.comm, com.raytheon.uf.common.status, + com.raytheon.uf.common.style, + com.raytheon.uf.common.style.level, com.raytheon.uf.common.time, com.raytheon.uf.viz.core, com.raytheon.uf.viz.core.catalog, @@ -32,8 +34,6 @@ Import-Package: com.raytheon.uf.common.dataplugin, com.raytheon.uf.viz.core.rsc, com.raytheon.uf.viz.core.rsc.capabilities, com.raytheon.uf.viz.core.status, - com.raytheon.uf.viz.core.style, - com.raytheon.uf.viz.core.style.level, com.raytheon.uf.viz.productbrowser, com.raytheon.uf.viz.xy.timeseries, com.raytheon.uf.viz.xy.timeseries.adapter, diff --git a/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/browser/GFEVbDataCatalog.java b/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/browser/GFEVbDataCatalog.java index f8535eab88..d2f19bd619 100644 --- a/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/browser/GFEVbDataCatalog.java +++ b/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/browser/GFEVbDataCatalog.java @@ -36,6 +36,11 @@ import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleManager.StyleType; +import com.raytheon.uf.common.style.StyleRule; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; @@ -43,10 +48,6 @@ import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractResourceData; import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.ResourceType; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.VizStyleException; import com.raytheon.uf.viz.d2d.gfe.rsc.GFEGridResource; import com.raytheon.uf.viz.d2d.gfe.rsc.GFEGridResourceData; import com.raytheon.viz.volumebrowser.datacatalog.AbstractDataCatalog; @@ -283,7 +284,7 @@ public class GFEVbDataCatalog extends AbstractDataCatalog { StyleRule sr = null; try { - StyleManager.StyleType styleType = StyleManager.StyleType.CONTOUR; + StyleType styleType = StyleManager.StyleType.CONTOUR; if (displayType.equals(DisplayType.IMAGE)) { styleType = StyleManager.StyleType.IMAGERY; @@ -294,7 +295,7 @@ public class GFEVbDataCatalog extends AbstractDataCatalog { } sr = StyleManager.getInstance().getStyleRule(styleType, criteria); - } catch (VizStyleException e) { + } catch (StyleException e) { statusHandler.handle(Priority.PROBLEM, "Unable to obtain a style rule for" + catalogEntry.getSelectedData().getUniqueKey(), e); diff --git a/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/rsc/GFEGridResource.java b/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/rsc/GFEGridResource.java index 4a7cd054be..70f7a79c12 100644 --- a/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/rsc/GFEGridResource.java +++ b/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/rsc/GFEGridResource.java @@ -33,19 +33,19 @@ import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice; import com.raytheon.uf.common.dataplugin.gfe.slice.ScalarGridSlice; import com.raytheon.uf.common.dataplugin.gfe.slice.VectorGridSlice; import com.raytheon.uf.common.geospatial.MapUtil; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.level.Level; +import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.level.Level; -import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.viz.grid.rsc.general.AbstractGridResource; import com.raytheon.viz.grid.rsc.general.GeneralGridData; /** * - * TODO Add Description + * Resource to render GFE grid data in D2D. * *
  * 
@@ -92,8 +92,8 @@ public class GFEGridResource extends AbstractGridResource {
             return;
         }
         try {
-            gfeRecord
-                    .setGridInfo(GFEDataAccessUtil.getGridParmInfo(gfeRecord.getParmId()));
+            gfeRecord.setGridInfo(GFEDataAccessUtil.getGridParmInfo(gfeRecord
+                    .getParmId()));
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
diff --git a/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/xy/GfeTimeSeriesAdapter.java b/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/xy/GfeTimeSeriesAdapter.java
index a459587ac8..e8abc37ae5 100644
--- a/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/xy/GfeTimeSeriesAdapter.java
+++ b/cave/com.raytheon.uf.viz.d2d.gfe/src/com/raytheon/uf/viz/d2d/gfe/xy/GfeTimeSeriesAdapter.java
@@ -18,14 +18,30 @@ import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice;
 import com.raytheon.uf.common.dataplugin.gfe.slice.ScalarGridSlice;
 import com.raytheon.uf.common.dataplugin.gfe.slice.VectorGridSlice;
 import com.raytheon.uf.common.geospatial.MapUtil;
+import com.raytheon.uf.common.style.level.Level;
+import com.raytheon.uf.common.style.level.SingleLevel;
 import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.style.level.Level;
-import com.raytheon.uf.viz.core.style.level.SingleLevel;
 import com.raytheon.uf.viz.xy.timeseries.adapter.AbstractTimeSeriesAdapter;
 import com.raytheon.viz.core.graphing.xy.XYData;
 import com.raytheon.viz.core.graphing.xy.XYDataList;
 import com.raytheon.viz.core.graphing.xy.XYWindImageData;
 
+/**
+ * Allows GFE data to be rendered on an XY display in D2D.
+ * 
+ * 
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Sep 5, 2013            mnash     Initial javadoc creation; we aren't able to pinpoint initial creation
+ * 
+ * 
+ * + * @author mnash + * @version 1.0 + */ public class GfeTimeSeriesAdapter extends AbstractTimeSeriesAdapter { private Unit unit = Unit.ONE; diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.d2d.xy.adapters/META-INF/MANIFEST.MF index e6600a06ad..2c0e66127e 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/META-INF/MANIFEST.MF @@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.core.runtime, com.raytheon.uf.viz.xy.timeseries;bundle-version="1.12.1174", javax.measure;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", - com.raytheon.uf.common.comm;bundle-version="1.12.1174" + com.raytheon.uf.common.comm;bundle-version="1.12.1174", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.dataplugin.grid, diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/DmdTimeSeriesAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/DmdTimeSeriesAdapter.java index 8f5d69b72a..02a4466b73 100644 --- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/DmdTimeSeriesAdapter.java +++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/DmdTimeSeriesAdapter.java @@ -27,9 +27,9 @@ import javax.measure.unit.Unit; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.util.RadarRecordUtil; +import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.uf.viz.xy.timeseries.adapter.AbstractTimeSeriesAdapter; import com.raytheon.viz.core.graphing.xy.XYData; import com.raytheon.viz.core.graphing.xy.XYDataList; @@ -37,7 +37,7 @@ import com.raytheon.viz.radar.util.DmdTools; import com.vividsolutions.jts.geom.Coordinate; /** - * TODO Add Description + * Radar DMD data on a Time Series display. * *
  * 
diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/GridTimeSeriesAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/GridTimeSeriesAdapter.java
index 6e496227bf..34527e0688 100644
--- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/GridTimeSeriesAdapter.java
+++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/GridTimeSeriesAdapter.java
@@ -43,11 +43,11 @@ import com.raytheon.uf.common.gridcoverage.GridCoverage;
 import com.raytheon.uf.common.status.IUFStatusHandler;
 import com.raytheon.uf.common.status.UFStatus;
 import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.style.level.SingleLevel;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.rsc.DisplayType;
-import com.raytheon.uf.viz.core.style.level.SingleLevel;
 import com.raytheon.uf.viz.xy.timeseries.adapter.AbstractTimeSeriesAdapter;
 import com.raytheon.viz.core.graphing.xy.XYData;
 import com.raytheon.viz.core.graphing.xy.XYDataList;
diff --git a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java
index 43f0c3f6eb..c095712702 100644
--- a/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java
+++ b/cave/com.raytheon.uf.viz.d2d.xy.adapters/src/com/raytheon/uf/viz/d2d/xy/adapters/timeseries/PointDataTimeSeriesAdapter.java
@@ -45,6 +45,7 @@ import com.raytheon.uf.common.geospatial.MapUtil;
 import com.raytheon.uf.common.pointdata.PointDataConstants;
 import com.raytheon.uf.common.pointdata.PointDataContainer;
 import com.raytheon.uf.common.pointdata.PointDataView;
+import com.raytheon.uf.common.style.level.SingleLevel;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.common.time.DataTime.FLAG;
 import com.raytheon.uf.common.time.TimeRange;
@@ -53,7 +54,6 @@ import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.level.LevelUtilities;
 import com.raytheon.uf.viz.core.rsc.DisplayType;
-import com.raytheon.uf.viz.core.style.level.SingleLevel;
 import com.raytheon.uf.viz.objectiveanalysis.rsc.OAGridTransformer;
 import com.raytheon.uf.viz.xy.timeseries.adapter.AbstractTimeSeriesAdapter;
 import com.raytheon.viz.core.graphing.xy.XYData;
@@ -121,10 +121,9 @@ public class PointDataTimeSeriesAdapter extends
         // Perhaps this should just be done using the resource metadatamap
         for (PluginDataObject pdo : recordsToLoad) {
             DataTime dt = pdo.getDataTime();
-            dataTimeConstraint.addToConstraintValueList(dt
-                    .toString());
+            dataTimeConstraint.addToConstraintValueList(dt.toString());
             refTimeOnly &= !dt.getUtilityFlags().contains(FLAG.FCST_USED);
-            if(refTimeOnly){
+            if (refTimeOnly) {
                 refTimeConstraint.addToConstraintValueList(TimeUtil
                         .formatToSqlTimestamp(dt.getRefTime()));
             }
@@ -136,23 +135,23 @@ public class PointDataTimeSeriesAdapter extends
         Map constraints = new HashMap(
                 resourceData.getMetadataMap());
         String[] parameters = null;
-        if(refTimeOnly){
-            refTimeConstraint.setConstraintType(RequestConstraint.ConstraintType.IN);
+        if (refTimeOnly) {
+            refTimeConstraint
+                    .setConstraintType(RequestConstraint.ConstraintType.IN);
             constraints.put("dataTime.refTime", refTimeConstraint);
-            parameters = new String[] {
-                    PointDataConstants.DATASET_REFTIME, parameter };
-        }else{
-            dataTimeConstraint.setConstraintType(RequestConstraint.ConstraintType.IN);
+            parameters = new String[] { PointDataConstants.DATASET_REFTIME,
+                    parameter };
+        } else {
+            dataTimeConstraint
+                    .setConstraintType(RequestConstraint.ConstraintType.IN);
             constraints.put("dataTime", dataTimeConstraint);
-            parameters = new String[] {
-                    PointDataConstants.DATASET_REFTIME,
+            parameters = new String[] { PointDataConstants.DATASET_REFTIME,
                     PointDataConstants.DATASET_FORECASTHR, parameter };
         }
 
         PointDataContainer pdc = DataCubeContainer.getPointData(
                 recordsToLoad[0].getPluginName(), parameters,
-                resourceData.getLevelKey(),
-                constraints);
+                resourceData.getLevelKey(), constraints);
         ArrayList data = new ArrayList();
         for (int uriCounter = 0; uriCounter < pdc.getAllocatedSz(); uriCounter++) {
             PointDataView pdv = pdc.readRandom(uriCounter);
diff --git a/cave/com.raytheon.uf.viz.monitor.ffmp/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.monitor.ffmp/META-INF/MANIFEST.MF
index a2b56d809b..05f56b95ed 100644
--- a/cave/com.raytheon.uf.viz.monitor.ffmp/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.uf.viz.monitor.ffmp/META-INF/MANIFEST.MF
@@ -26,7 +26,8 @@ Require-Bundle: org.eclipse.ui,
  com.raytheon.uf.viz.stats;bundle-version="1.0.0",
  com.raytheon.uf.common.event;bundle-version="1.0.0",
  com.raytheon.uf.common.dataaccess;bundle-version="1.0.0",
- com.raytheon.uf.common.colormap;bundle-version="1.12.1174"
+ com.raytheon.uf.common.colormap;bundle-version="1.12.1174",
+ com.raytheon.uf.common.style;bundle-version="1.0.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Import-Package: com.raytheon.uf.common.pointdata
diff --git a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPColorUtils.java b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPColorUtils.java
index 423497d410..a836f633db 100644
--- a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPColorUtils.java
+++ b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/rsc/FFMPColorUtils.java
@@ -32,13 +32,14 @@ import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
 import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
 import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS;
 import com.raytheon.uf.common.localization.LocalizationFile;
+import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
+import com.raytheon.uf.common.style.StyleException;
+import com.raytheon.uf.common.style.StyleManager;
+import com.raytheon.uf.common.style.StyleRule;
+import com.raytheon.uf.common.style.StyleRuleset;
+import com.raytheon.uf.common.style.image.ImagePreferences;
 import com.raytheon.uf.viz.core.drawables.ColorMapLoader;
 import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
-import com.raytheon.uf.viz.core.style.StyleManager;
-import com.raytheon.uf.viz.core.style.StyleRule;
-import com.raytheon.uf.viz.core.style.VizStyleException;
-import com.raytheon.viz.core.style.image.ImagePreferences;
 
 /**
  * FFMPColor Utility
@@ -53,7 +54,7 @@ import com.raytheon.viz.core.style.image.ImagePreferences;
  * 05/21/12		DR 14833    G. Zhang    Error handling for invalid cmap 
  * Apr 26, 2013 1954        bsteffen    Minor code cleanup throughout FFMP.
  * Jun 10, 2013 2075        njensen     Improved init time
- * 
+ * Sep 5, 2013  2051        mnash       Moved style rule instantiation so that we don't get NPEs
  * 
* * @author dhladky @@ -99,32 +100,33 @@ public class FFMPColorUtils { try { sr = StyleManager.getInstance().getStyleRule( StyleManager.StyleType.IMAGERY, getMatchCriteria()); - } catch (VizStyleException e) { + + String colormapfile = ((ImagePreferences) sr.getPreferences()) + .getDefaultColormap(); + + IColorMap cxml = null; + + try { + cxml = ColorMapLoader.loadColorMap(colormapfile); + } catch (VizException e) { + e.printStackTrace(); + } + + if (cxml == null) + cxml = getDefaultColorMap(); // DR 14833: load the default map + ColorMap colorMap = new ColorMap(colormapfile, (ColorMap) cxml); + colormapparams = new ColorMapParameters(); + colormapparams.setColorMap(colorMap); + colormapparams.setDisplayUnit(((ImagePreferences) sr + .getPreferences()).getDisplayUnits()); + colormapparams.setDataMapping(((ImagePreferences) sr + .getPreferences()).getDataMapping()); + + colormapparams.setColorMapMin(0); + colormapparams.setColorMapMax(255); + } catch (StyleException e) { e.printStackTrace(); } - String colormapfile = ((ImagePreferences) sr.getPreferences()) - .getDefaultColormap(); - - IColorMap cxml = null; - - try { - cxml = ColorMapLoader.loadColorMap(colormapfile); - } catch (VizException e) { - e.printStackTrace(); - } - - if (cxml == null) - cxml = getDefaultColorMap(); // DR 14833: load the default map - ColorMap colorMap = new ColorMap(colormapfile, (ColorMap) cxml); - colormapparams = new ColorMapParameters(); - colormapparams.setColorMap(colorMap); - colormapparams.setDisplayUnit(((ImagePreferences) sr.getPreferences()) - .getDisplayUnits()); - colormapparams.setDataMapping(((ImagePreferences) sr.getPreferences()) - .getDataMapping()); - - colormapparams.setColorMapMin(0); - colormapparams.setColorMapMax(255); } public ColorMapParameters getColorMapParameters() { @@ -350,8 +352,8 @@ public class FFMPColorUtils { * StyleRule loaded. So it is guaranteed the default can be loaded. */ - com.raytheon.uf.viz.core.style.StyleRuleset srs = StyleManager - .getInstance().getStyleRuleSet(StyleManager.StyleType.IMAGERY); + StyleRuleset srs = StyleManager.getInstance().getStyleRuleSet( + StyleManager.StyleType.IMAGERY); for (StyleRule srl : srs.getStyleRules()) { String pn = "", cm = ""; @@ -383,7 +385,7 @@ public class FFMPColorUtils { * * //get the StyleRule try { * sr=StyleManager.getInstance().getStyleRule(StyleManager - * .StyleType.IMAGERY, match); } catch (VizStyleException e) { + * .StyleType.IMAGERY, match); } catch (StyleException e) { * e.printStackTrace(); } } */ // get the colormapfile name diff --git a/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF index 2cce5512eb..37e903ce5e 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.npp.viirs/META-INF/MANIFEST.MF @@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", com.raytheon.uf.common.comm;bundle-version="1.12.1174", com.raytheon.viz.alerts;bundle-version="1.12.1174", - com.raytheon.uf.viz.npp;bundle-version="1.0.0" + com.raytheon.uf.viz.npp;bundle-version="1.0.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.viz.npp.viirs.rsc diff --git a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSResource.java b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSResource.java index 70bae29ddb..ee23fd24b3 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSResource.java +++ b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/rsc/VIIRSResource.java @@ -52,6 +52,13 @@ import com.raytheon.uf.common.geospatial.util.EnvelopeIntersection; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.LabelingPreferences; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleManager.StyleType; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.image.DataScale; +import com.raytheon.uf.common.style.image.ImagePreferences; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.DrawableImage; import com.raytheon.uf.viz.core.IGraphicsTarget; @@ -72,17 +79,11 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability; -import com.raytheon.uf.viz.core.style.LabelingPreferences; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleManager.StyleType; -import com.raytheon.uf.viz.core.style.StyleRule; import com.raytheon.uf.viz.core.tile.Tile; import com.raytheon.uf.viz.core.tile.TileSetRenderable; import com.raytheon.uf.viz.core.tile.TileSetRenderable.TileImageCreator; import com.raytheon.uf.viz.npp.viirs.Activator; import com.raytheon.uf.viz.npp.viirs.style.VIIRSDataRecordCriteria; -import com.raytheon.viz.core.style.image.DataScale; -import com.raytheon.viz.core.style.image.ImagePreferences; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryFactory; @@ -336,8 +337,13 @@ public class VIIRSResource extends name += " " + parameter; // Get style rule preferences - StyleRule styleRule = StyleManager.getInstance().getStyleRule( - StyleType.IMAGERY, new VIIRSDataRecordCriteria(dataRecord)); + StyleRule styleRule; + try { + styleRule = StyleManager.getInstance().getStyleRule( + StyleType.IMAGERY, new VIIRSDataRecordCriteria(dataRecord)); + } catch (StyleException e1) { + throw new VizException(e1.getLocalizedMessage(), e1); + } ImagePreferences preferences = null; if (styleRule != null) { preferences = (ImagePreferences) styleRule.getPreferences(); diff --git a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/style/VIIRSDataMatchCriteria.java b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/style/VIIRSDataMatchCriteria.java index 4e2707e1c6..2a7120e31b 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/style/VIIRSDataMatchCriteria.java +++ b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/style/VIIRSDataMatchCriteria.java @@ -26,8 +26,8 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import com.raytheon.uf.viz.core.style.MatchCriteria; -import com.raytheon.uf.viz.core.style.VizStyleException; +import com.raytheon.uf.common.style.MatchCriteria; +import com.raytheon.uf.common.style.StyleException; /** * Style match criteria for VIIRS data, order of importance is parameter, @@ -65,11 +65,11 @@ public class VIIRSDataMatchCriteria extends MatchCriteria { /* * (non-Javadoc) * - * @see com.raytheon.uf.viz.core.style.MatchCriteria#matches(com.raytheon + * @see com.raytheon.uf.common.style.MatchCriteria#matches(com.raytheon * .uf. viz.core.style.MatchCriteria) */ @Override - public int matches(MatchCriteria aCriteria) throws VizStyleException { + public int matches(MatchCriteria aCriteria) throws StyleException { int rval = -1; if (aCriteria instanceof VIIRSDataRecordCriteria) { return VIIRSDataRecordCriteria.matches( diff --git a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/style/VIIRSDataRecordCriteria.java b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/style/VIIRSDataRecordCriteria.java index 277867e761..17b3cf5b28 100644 --- a/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/style/VIIRSDataRecordCriteria.java +++ b/cave/com.raytheon.uf.viz.npp.viirs/src/com/raytheon/uf/viz/npp/viirs/style/VIIRSDataRecordCriteria.java @@ -20,8 +20,8 @@ package com.raytheon.uf.viz.npp.viirs.style; import com.raytheon.uf.common.dataplugin.npp.viirs.VIIRSDataRecord; -import com.raytheon.uf.viz.core.style.MatchCriteria; -import com.raytheon.uf.viz.core.style.VizStyleException; +import com.raytheon.uf.common.style.MatchCriteria; +import com.raytheon.uf.common.style.StyleException; /** * Match criteria for a populated {@link VIIRSDataRecord} object @@ -61,11 +61,11 @@ public class VIIRSDataRecordCriteria extends MatchCriteria { * (non-Javadoc) * * @see - * com.raytheon.uf.viz.core.style.MatchCriteria#matches(com.raytheon.uf. + * com.raytheon.uf.common.style.MatchCriteria#matches(com.raytheon.uf. * viz.core.style.MatchCriteria) */ @Override - public int matches(MatchCriteria aCriteria) throws VizStyleException { + public int matches(MatchCriteria aCriteria) throws StyleException { int rval = -1; if (aCriteria instanceof VIIRSDataMatchCriteria) { return matches(this, (VIIRSDataMatchCriteria) aCriteria); diff --git a/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF index 81a1ccdd55..f6cff94a29 100644 --- a/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.objectiveanalysis/META-INF/MANIFEST.MF @@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.viz.core.contours;bundle-version="1.11.17", com.raytheon.uf.viz.sounding;bundle-version="1.11.17", com.raytheon.uf.common.dataplugin.bufrua;bundle-version="1.11.17", - com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174" + com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.viz.objectiveanalysis.rsc diff --git a/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResource.java b/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResource.java index 82e609ba87..f897d8462c 100644 --- a/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResource.java +++ b/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResource.java @@ -49,6 +49,11 @@ import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.util.GridUtil; @@ -72,18 +77,13 @@ import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.VizStyleException; -import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay; import com.raytheon.viz.core.contours.rsc.displays.GriddedVectorDisplay; import com.raytheon.viz.core.contours.util.VectorGraphicsRenderableFactory; import com.raytheon.viz.core.drawables.ColorMapParameterFactory; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay.GriddedImagePaintProperties; -import com.raytheon.viz.core.style.contour.ContourPreferences; +import com.raytheon.uf.common.style.contour.ContourPreferences; import com.vividsolutions.jts.geom.Coordinate; /** @@ -471,7 +471,7 @@ public class OAResource extends .getPreferences(); this.parameterUnitString = prefs.getDisplayUnitLabel(); } - } catch (VizStyleException e) { + } catch (StyleException e) { statusHandler.handle(Priority.VERBOSE, e.getLocalizedMessage(), e); } diff --git a/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResourceData.java b/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResourceData.java index 6950598c18..5a6fe4ba0a 100644 --- a/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResourceData.java +++ b/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OAResourceData.java @@ -33,14 +33,14 @@ import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.LevelFactory; import com.raytheon.uf.common.dataplugin.level.MasterLevel; import com.raytheon.uf.common.dataplugin.level.mapping.LevelMappingFactory; +import com.raytheon.uf.common.style.level.SingleLevel; +import com.raytheon.uf.common.style.level.Level.LevelType; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.exception.VizCommunicationException; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.style.level.Level.LevelType; -import com.raytheon.uf.viz.core.style.level.SingleLevel; /** * Resource Data for Objective Analysis diff --git a/cave/com.raytheon.uf.viz.preciprate/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.preciprate/META-INF/MANIFEST.MF index fa34b7fdeb..2c87b91b30 100644 --- a/cave/com.raytheon.uf.viz.preciprate/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.preciprate/META-INF/MANIFEST.MF @@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.viz.awipstools;bundle-version="1.12.1174", com.raytheon.uf.viz.radar.gl;bundle-version="1.12.1174", com.raytheon.viz.core.gl;bundle-version="1.12.1174", - com.raytheon.uf.common.units;bundle-version="1.0.0" + com.raytheon.uf.common.units;bundle-version="1.0.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.viz.preciprate, diff --git a/cave/com.raytheon.uf.viz.preciprate/src/com/raytheon/uf/viz/preciprate/PrecipRateResource.java b/cave/com.raytheon.uf.viz.preciprate/src/com/raytheon/uf/viz/preciprate/PrecipRateResource.java index 3a3b10c87b..c0f82e925b 100644 --- a/cave/com.raytheon.uf.viz.preciprate/src/com/raytheon/uf/viz/preciprate/PrecipRateResource.java +++ b/cave/com.raytheon.uf.viz.preciprate/src/com/raytheon/uf/viz/preciprate/PrecipRateResource.java @@ -19,13 +19,11 @@ **/ package com.raytheon.uf.viz.preciprate; -import java.awt.Rectangle; import java.io.File; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Map; -import javax.measure.converter.MultiplyConverter; import javax.measure.converter.UnitConverter; import javax.measure.unit.NonSI; import javax.measure.unit.Unit; @@ -47,27 +45,25 @@ import com.raytheon.uf.common.monitor.scan.ScanUtils; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.image.ImagePreferences; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.units.PiecewisePixel; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.ColorMapLoader; import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo; -import com.raytheon.uf.viz.core.drawables.IImage; -import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; import com.raytheon.uf.viz.preciprate.xml.PrecipRateXML; import com.raytheon.uf.viz.preciprate.xml.SCANConfigPrecipRateXML; -import com.raytheon.viz.core.style.image.ImagePreferences; import com.raytheon.viz.radar.VizRadarRecord; import com.raytheon.viz.radar.interrogators.IRadarInterrogator; import com.raytheon.viz.radar.rsc.RadarTextResource.IRadarTextGeneratingResource; import com.raytheon.viz.radar.rsc.image.RadarRadialResource; -import com.raytheon.viz.radar.util.DataUtilities; public class PrecipRateResource extends RadarRadialResource implements IRadarTextGeneratingResource { @@ -80,7 +76,7 @@ public class PrecipRateResource extends RadarRadialResource implements private SCANConfigPrecipRateXML cfgMXL = null; private PrecipRateRecord precipRecord; - + private PrecipRateResourceData data = null; public PrecipRateResource(PrecipRateResourceData data, @@ -217,16 +213,12 @@ public class PrecipRateResource extends RadarRadialResource implements * raytheon.uf.viz.core.IGraphicsTarget, * com.raytheon.uf.viz.core.drawables.ColorMapParameters, * com.raytheon.uf.common.dataplugin.radar.RadarRecord, java.awt.Rectangle) - - @Override - protected IImage createImage(IGraphicsTarget target, - ColorMapParameters params, final RadarRecord record, - final Rectangle rect) throws VizException { - return target.getExtension(IColormappedImageExtension.class) - .initializeRaster( - new RadarImageDataRetrievalAdapter(record, null, rect) { - }, params); - } + * + * @Override protected IImage createImage(IGraphicsTarget target, + * ColorMapParameters params, final RadarRecord record, final Rectangle + * rect) throws VizException { return + * target.getExtension(IColormappedImageExtension.class) .initializeRaster( + * new RadarImageDataRetrievalAdapter(record, null, rect) { }, params); } */ @Override @@ -236,8 +228,13 @@ public class PrecipRateResource extends RadarRadialResource implements ColorMapParameters colorMapParameters = getCapability( ColorMapCapability.class).getColorMapParameters(); colorMapParameters = new ColorMapParameters(); - StyleRule sr = StyleManager.getInstance().getStyleRule( - StyleManager.StyleType.IMAGERY, getMatchCriteria()); + StyleRule sr; + try { + sr = StyleManager.getInstance().getStyleRule( + StyleManager.StyleType.IMAGERY, getMatchCriteria()); + } catch (StyleException e) { + throw new VizException(e.getLocalizedMessage(), e); + } String colormapfile = ((ImagePreferences) sr.getPreferences()) .getDefaultColormap(); @@ -252,10 +249,11 @@ public class PrecipRateResource extends RadarRadialResource implements colorMapParameters.setDataMin(0); colorMapParameters.setDataMapping(((ImagePreferences) sr .getPreferences()).getDataMapping()); - double[] d1 = {1,255}; - double[] d2 = {0,25.4}; + double[] d1 = { 1, 255 }; + double[] d2 = { 0, 25.4 }; @SuppressWarnings({ "rawtypes", "unchecked" }) - PiecewisePixel pw = new PiecewisePixel(NonSI.INCH.divide(NonSI.HOUR), d1, d2); + PiecewisePixel pw = new PiecewisePixel(NonSI.INCH.divide(NonSI.HOUR), + d1, d2); colorMapParameters.setDataUnit(pw); getCapability(ColorMapCapability.class).setColorMapParameters( colorMapParameters); @@ -359,9 +357,9 @@ public class PrecipRateResource extends RadarRadialResource implements dataVal = new RadarDataInterrogator(record).getDataValue(latLon .asLatLon()); if (dataVal == 0) { - return "NO DATA"; + return "NO DATA"; } - + } catch (Exception e) { UFStatus.getHandler().handle( Priority.PROBLEM, @@ -372,7 +370,7 @@ public class PrecipRateResource extends RadarRadialResource implements ColorMapParameters params = getCapability(ColorMapCapability.class) .getColorMapParameters(); double val = params.getDataToDisplayConverter().convert(dataVal); - + if (val >= ScanUtils.MM_TO_INCH * precipRecord.getHailcap() || Double.isNaN(val)) { return String.format( @@ -390,11 +388,12 @@ public class PrecipRateResource extends RadarRadialResource implements throws VizException { return null; } - + protected byte[] createConversionTable(ColorMapParameters params, RadarRecord record) { - - UnitConverter dataToImage = params.getDataToImageConverter();; + + UnitConverter dataToImage = params.getDataToImageConverter(); + ; Unit dataUnit = params.getDataUnit(); // precompute the converted value for every possible value in the // record. diff --git a/cave/com.raytheon.uf.viz.qpf/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.qpf/META-INF/MANIFEST.MF index a8bb2dc931..fb190db6d5 100644 --- a/cave/com.raytheon.uf.viz.qpf/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.qpf/META-INF/MANIFEST.MF @@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.viz.core.contours, com.raytheon.viz.pointdata;bundle-version="1.11.1", com.raytheon.uf.common.dataplugin.qpf;bundle-version="1.0.0", - com.raytheon.uf.viz.productbrowser;bundle-version="1.12.1153" + com.raytheon.uf.viz.productbrowser;bundle-version="1.12.1153", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.viz.qpf diff --git a/cave/com.raytheon.uf.viz.qpf/src/com/raytheon/uf/viz/qpf/QPFResource.java b/cave/com.raytheon.uf.viz.qpf/src/com/raytheon/uf/viz/qpf/QPFResource.java index a3e55c30ef..3d10923d94 100644 --- a/cave/com.raytheon.uf.viz.qpf/src/com/raytheon/uf/viz/qpf/QPFResource.java +++ b/cave/com.raytheon.uf.viz.qpf/src/com/raytheon/uf/viz/qpf/QPFResource.java @@ -33,13 +33,13 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.qpf.QPFRecord; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; import com.raytheon.viz.grid.rsc.general.AbstractGridResource; import com.raytheon.viz.grid.rsc.general.GeneralGridData; diff --git a/cave/com.raytheon.uf.viz.vil/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.vil/META-INF/MANIFEST.MF index a22d28c2fd..f75f9d1aeb 100644 --- a/cave/com.raytheon.uf.viz.vil/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.vil/META-INF/MANIFEST.MF @@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.viz.pointdata;bundle-version="1.11.1", com.raytheon.uf.common.dataplugin.vil;bundle-version="1.0.0", com.raytheon.uf.common.colormap;bundle-version="1.11.17", - com.raytheon.uf.common.monitor;bundle-version="1.11.17" + com.raytheon.uf.common.monitor;bundle-version="1.11.17", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.uf.viz.vil diff --git a/cave/com.raytheon.uf.viz.vil/src/com/raytheon/uf/viz/vil/VILResource.java b/cave/com.raytheon.uf.viz.vil/src/com/raytheon/uf/viz/vil/VILResource.java index cc0aa03bd4..08d7c2a822 100644 --- a/cave/com.raytheon.uf.viz.vil/src/com/raytheon/uf/viz/vil/VILResource.java +++ b/cave/com.raytheon.uf.viz.vil/src/com/raytheon/uf/viz/vil/VILResource.java @@ -38,6 +38,11 @@ import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.image.ImagePreferences; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.ColorMapLoader; @@ -49,11 +54,7 @@ import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay2; -import com.raytheon.viz.core.style.image.ImagePreferences; import com.vividsolutions.jts.geom.Coordinate; /** @@ -234,8 +235,13 @@ public class VILResource extends if (record != null && init) { // Get default colormap - StyleRule sr = StyleManager.getInstance().getStyleRule( - StyleManager.StyleType.IMAGERY, getMatchCriteria()); + StyleRule sr; + try { + sr = StyleManager.getInstance().getStyleRule( + StyleManager.StyleType.IMAGERY, getMatchCriteria()); + } catch (StyleException e) { + throw new VizException(e.getLocalizedMessage(), e); + } this.colormapfile = ((ImagePreferences) sr.getPreferences()) .getDefaultColormap(); diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF index 18823b5b04..90d00fb4d0 100644 --- a/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.uf.viz.xy.crosssection/META-INF/MANIFEST.MF @@ -24,6 +24,11 @@ Import-Package: com.raytheon.uf.common.dataplugin, com.raytheon.uf.common.dataquery.requests, com.raytheon.uf.common.localization, com.raytheon.uf.common.status, + com.raytheon.uf.common.style, + com.raytheon.uf.common.style.arrow, + com.raytheon.uf.common.style.contour, + com.raytheon.uf.common.style.graph, + com.raytheon.uf.common.style.level, com.raytheon.uf.common.time, com.raytheon.uf.common.topo, com.raytheon.uf.viz.d2d.core.map, @@ -33,10 +38,7 @@ Import-Package: com.raytheon.uf.common.dataplugin, com.raytheon.viz.core.map, com.raytheon.viz.core.rsc, com.raytheon.viz.core.rsc.jts, - com.raytheon.viz.core.slice.request, - com.raytheon.viz.core.style.arrow, - com.raytheon.viz.core.style.contour, - com.raytheon.viz.core.style.graph + com.raytheon.viz.core.slice.request Export-Package: com.raytheon.uf.viz.xy.crosssection, com.raytheon.uf.viz.xy.crosssection.adapter, com.raytheon.uf.viz.xy.crosssection.display, diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/graph/CrossSectionGraph.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/graph/CrossSectionGraph.java index c2736efb67..df39b282e1 100644 --- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/graph/CrossSectionGraph.java +++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/graph/CrossSectionGraph.java @@ -35,6 +35,7 @@ import com.raytheon.uf.common.geospatial.SpatialQueryResult; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.level.Level.LevelType; import com.raytheon.uf.common.topo.TopoQuery; import com.raytheon.uf.common.wxmath.Hgt2Pres; import com.raytheon.uf.viz.core.DrawableString; @@ -47,7 +48,6 @@ import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; -import com.raytheon.uf.viz.core.style.level.Level.LevelType; import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor; import com.raytheon.uf.viz.xy.crosssection.rsc.AbstractCrossSectionResource; import com.raytheon.uf.viz.xy.graph.AbstractGraph; @@ -68,7 +68,7 @@ import com.vividsolutions.jts.geom.Point; /** * - * TODO Add Description + * Creates a cross section on a graph display. * *
  * 
diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/AbstractCrossSectionResource.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/AbstractCrossSectionResource.java
index 1f22a67fc5..289978e70c 100644
--- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/AbstractCrossSectionResource.java
+++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/AbstractCrossSectionResource.java
@@ -49,6 +49,9 @@ import com.raytheon.uf.common.geospatial.MapUtil;
 import com.raytheon.uf.common.status.IUFStatusHandler;
 import com.raytheon.uf.common.status.UFStatus;
 import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.style.AbstractStylePreferences;
+import com.raytheon.uf.common.style.StyleException;
+import com.raytheon.uf.common.style.level.SingleLevel;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.IExtent;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
@@ -63,8 +66,6 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
 import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
-import com.raytheon.uf.viz.core.style.AbstractStylePreferences;
-import com.raytheon.uf.viz.core.style.level.SingleLevel;
 import com.raytheon.uf.viz.xy.crosssection.CrossSectionRotation;
 import com.raytheon.uf.viz.xy.crosssection.adapter.AbstractCrossSectionAdapter;
 import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor;
@@ -166,8 +167,12 @@ public abstract class AbstractCrossSectionResource extends
     @Override
     protected void initInternal(IGraphicsTarget target) throws VizException {
         if (prefs == null) {
-            prefs = GraphPrefsFactory.buildPreferences(
-                    resourceData.getParameter(), null);
+            try {
+                prefs = GraphPrefsFactory.buildPreferences(
+                        resourceData.getParameter(), null);
+            } catch (StyleException e) {
+                throw new VizException(e.getLocalizedMessage(), e);
+            }
         }
         int numTimes = dataTimes.size();
         if (numTimes > 0) {
diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionContourResource.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionContourResource.java
index 71161f6cc3..ef8628df98 100644
--- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionContourResource.java
+++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionContourResource.java
@@ -37,6 +37,11 @@ import org.opengis.referencing.operation.TransformException;
 import com.raytheon.uf.common.status.IUFStatusHandler;
 import com.raytheon.uf.common.status.UFStatus;
 import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
+import com.raytheon.uf.common.style.StyleManager;
+import com.raytheon.uf.common.style.StyleRule;
+import com.raytheon.uf.common.style.StyleException;
+import com.raytheon.uf.common.style.contour.ContourPreferences;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.IExtent;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
@@ -53,15 +58,10 @@ import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
-import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
-import com.raytheon.uf.viz.core.style.StyleManager;
-import com.raytheon.uf.viz.core.style.StyleRule;
-import com.raytheon.uf.viz.core.style.VizStyleException;
 import com.raytheon.uf.viz.xy.crosssection.adapter.AbstractCrossSectionAdapter;
 import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor;
 import com.raytheon.viz.core.contours.ContourSupport;
 import com.raytheon.viz.core.contours.ContourSupport.ContourGroup;
-import com.raytheon.viz.core.style.contour.ContourPreferences;
 import com.vividsolutions.jts.geom.Envelope;
 
 /**
@@ -118,7 +118,7 @@ public class CrossSectionContourResource extends AbstractCrossSectionResource
         try {
             sr = StyleManager.getInstance().getStyleRule(
                     StyleManager.StyleType.CONTOUR, match);
-        } catch (VizStyleException e) {
+        } catch (StyleException e) {
             statusHandler.handle(Priority.PROBLEM,
                     "Error getting contour style rule", e);
         }
diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java
index 30a951a78a..ea397a2754 100644
--- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java
+++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java
@@ -39,6 +39,10 @@ import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
 import com.raytheon.uf.common.status.IUFStatusHandler;
 import com.raytheon.uf.common.status.UFStatus;
 import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
+import com.raytheon.uf.common.style.StyleManager;
+import com.raytheon.uf.common.style.StyleRule;
+import com.raytheon.uf.common.style.StyleException;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.IExtent;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
@@ -53,10 +57,6 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
 import com.raytheon.uf.viz.core.rsc.LoadProperties;
 import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
-import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
-import com.raytheon.uf.viz.core.style.StyleManager;
-import com.raytheon.uf.viz.core.style.StyleRule;
-import com.raytheon.uf.viz.core.style.VizStyleException;
 import com.raytheon.uf.viz.xy.crosssection.adapter.AbstractCrossSectionAdapter;
 import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor;
 import com.raytheon.viz.core.drawables.ColorMapParameterFactory;
@@ -103,7 +103,7 @@ public class CrossSectionImageResource extends AbstractCrossSectionResource
         try {
             sr = StyleManager.getInstance().getStyleRule(
                     StyleManager.StyleType.IMAGERY, match);
-        } catch (VizStyleException e) {
+        } catch (StyleException e) {
             statusHandler.handle(Priority.PROBLEM,
                     "Error getting contour style rule", e);
         }
diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionVectorResource.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionVectorResource.java
index 16eceac2c6..e5da8a2a92 100644
--- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionVectorResource.java
+++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionVectorResource.java
@@ -26,6 +26,11 @@ import org.opengis.referencing.operation.MathTransform;
 
 import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
 import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
+import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
+import com.raytheon.uf.common.style.StyleException;
+import com.raytheon.uf.common.style.StyleManager;
+import com.raytheon.uf.common.style.StyleRule;
+import com.raytheon.uf.common.style.arrow.ArrowPreferences;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.IExtent;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
@@ -39,18 +44,13 @@ import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
-import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
-import com.raytheon.uf.viz.core.style.StyleManager;
-import com.raytheon.uf.viz.core.style.StyleRule;
-import com.raytheon.uf.viz.core.style.VizStyleException;
 import com.raytheon.uf.viz.xy.crosssection.adapter.AbstractCrossSectionAdapter;
 import com.raytheon.viz.core.contours.util.VectorGraphicsRenderable;
 import com.raytheon.viz.core.graphing.xy.XYWindImageData;
-import com.raytheon.viz.core.style.arrow.ArrowPreferences;
 import com.vividsolutions.jts.geom.Coordinate;
 
 /**
- * TODO Add Description
+ * Creates a vector resource on a cross section display.
  * 
  * 
  * 
@@ -89,7 +89,7 @@ public class CrossSectionVectorResource extends AbstractCrossSectionResource {
         try {
             sr = StyleManager.getInstance().getStyleRule(
                     StyleManager.StyleType.ARROW, match);
-        } catch (VizStyleException e) {
+        } catch (StyleException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
diff --git a/cave/com.raytheon.uf.viz.xy.timeheight/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.xy.timeheight/META-INF/MANIFEST.MF
index 313175129a..fe2d98d427 100644
--- a/cave/com.raytheon.uf.viz.xy.timeheight/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.uf.viz.xy.timeheight/META-INF/MANIFEST.MF
@@ -18,6 +18,9 @@ Import-Package: com.raytheon.uf.common.dataplugin,
  com.raytheon.uf.common.geospatial.interpolation,
  com.raytheon.uf.common.serialization,
  com.raytheon.uf.common.status,
+ com.raytheon.uf.common.style,
+ com.raytheon.uf.common.style.arrow,
+ com.raytheon.uf.common.style.contour,
  com.raytheon.uf.common.time,
  com.raytheon.uf.viz.core,
  com.raytheon.uf.viz.core.data,
@@ -30,7 +33,6 @@ Import-Package: com.raytheon.uf.common.dataplugin,
  com.raytheon.uf.viz.core.rsc.capabilities,
  com.raytheon.uf.viz.core.rsc.sampling,
  com.raytheon.uf.viz.core.status,
- com.raytheon.uf.viz.core.style,
  com.raytheon.uf.viz.d2d.core.map,
  com.raytheon.uf.viz.d2d.ui,
  com.raytheon.uf.viz.xy,
@@ -49,9 +51,6 @@ Import-Package: com.raytheon.uf.common.dataplugin,
  com.raytheon.viz.core.map,
  com.raytheon.viz.core.rsc,
  com.raytheon.viz.core.slice.request,
- com.raytheon.viz.core.style.arrow,
- com.raytheon.viz.core.style.contour,
- com.raytheon.viz.core.style.graph,
  com.raytheon.viz.grid.rsc,
  com.raytheon.viz.pointdata,
  com.raytheon.viz.ui.editor,
diff --git a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/AbstractTimeHeightResource.java b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/AbstractTimeHeightResource.java
index d6f3d18893..013a8d3dcd 100644
--- a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/AbstractTimeHeightResource.java
+++ b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/AbstractTimeHeightResource.java
@@ -37,6 +37,8 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
 import com.raytheon.uf.common.status.IUFStatusHandler;
 import com.raytheon.uf.common.status.UFStatus;
 import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.style.AbstractStylePreferences;
+import com.raytheon.uf.common.style.StyleException;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.IExtent;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
@@ -50,7 +52,6 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
 import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
-import com.raytheon.uf.viz.core.style.AbstractStylePreferences;
 import com.raytheon.uf.viz.xy.InterpUtils;
 import com.raytheon.uf.viz.xy.graph.IGraph;
 import com.raytheon.uf.viz.xy.graph.labeling.DataTimeLabel;
@@ -228,8 +229,12 @@ public abstract class AbstractTimeHeightResource extends
             secondaryResource.init(target);
         }
         if (prefs == null) {
-            prefs = GraphPrefsFactory.buildPreferences(
-                    resourceData.getParameter(), null);
+            try {
+                prefs = GraphPrefsFactory.buildPreferences(
+                        resourceData.getParameter(), null);
+            } catch (StyleException e) {
+                throw new VizException(e.getLocalizedMessage(), e);
+            }
         }
         if (interpolatedData == null) {
             loadDataJob.schedule();
diff --git a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightContourResource.java b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightContourResource.java
index 3fd43c0ce3..29aa1db643 100644
--- a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightContourResource.java
+++ b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightContourResource.java
@@ -25,6 +25,11 @@ import java.util.Arrays;
 import org.eclipse.swt.graphics.RGB;
 import org.geotools.coverage.grid.GeneralGridGeometry;
 
+import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
+import com.raytheon.uf.common.style.StyleManager;
+import com.raytheon.uf.common.style.StyleRule;
+import com.raytheon.uf.common.style.StyleException;
+import com.raytheon.uf.common.style.contour.ContourPreferences;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
 import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
 import com.raytheon.uf.viz.core.VizApp;
@@ -38,16 +43,11 @@ import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
-import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
-import com.raytheon.uf.viz.core.style.StyleManager;
-import com.raytheon.uf.viz.core.style.StyleRule;
-import com.raytheon.uf.viz.core.style.VizStyleException;
 import com.raytheon.uf.viz.xy.timeheight.display.TimeHeightDescriptor;
 import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter;
 import com.raytheon.viz.core.contours.ContourSupport;
 import com.raytheon.viz.core.contours.ContourSupport.ContourGroup;
 import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation;
-import com.raytheon.viz.core.style.contour.ContourPreferences;
 
 /**
  * Resource for displaying cross sections as contours
@@ -101,7 +101,7 @@ public class TimeHeightContourResource extends AbstractTimeHeightResource {
         try {
             sr = StyleManager.getInstance().getStyleRule(
                     StyleManager.StyleType.CONTOUR, match);
-        } catch (VizStyleException e) {
+        } catch (StyleException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
diff --git a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightImageResource.java b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightImageResource.java
index 0dee9ff574..2a1b09a653 100644
--- a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightImageResource.java
+++ b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightImageResource.java
@@ -31,6 +31,10 @@ import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation;
 import com.raytheon.uf.common.geospatial.interpolation.GridReprojection;
 import com.raytheon.uf.common.geospatial.interpolation.GridSampler;
 import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper;
+import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
+import com.raytheon.uf.common.style.StyleManager;
+import com.raytheon.uf.common.style.StyleRule;
+import com.raytheon.uf.common.style.StyleException;
 import com.raytheon.uf.viz.core.IExtent;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
 import com.raytheon.uf.viz.core.PixelCoverage;
@@ -43,10 +47,6 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
 import com.raytheon.uf.viz.core.rsc.LoadProperties;
 import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
-import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
-import com.raytheon.uf.viz.core.style.StyleManager;
-import com.raytheon.uf.viz.core.style.StyleRule;
-import com.raytheon.uf.viz.core.style.VizStyleException;
 import com.raytheon.uf.viz.xy.timeheight.display.TimeHeightDescriptor;
 import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter;
 import com.raytheon.viz.core.drawables.ColorMapParameterFactory;
@@ -88,7 +88,7 @@ public class TimeHeightImageResource extends AbstractTimeHeightResource
         try {
             sr = StyleManager.getInstance().getStyleRule(
                     StyleManager.StyleType.IMAGERY, match);
-        } catch (VizStyleException e) {
+        } catch (StyleException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
diff --git a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightVectorResource.java b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightVectorResource.java
index 6aff7b8e20..97d3308a6a 100644
--- a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightVectorResource.java
+++ b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/TimeHeightVectorResource.java
@@ -30,6 +30,11 @@ import org.eclipse.swt.graphics.RGB;
 import com.raytheon.uf.common.status.IUFStatusHandler;
 import com.raytheon.uf.common.status.UFStatus;
 import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
+import com.raytheon.uf.common.style.StyleManager;
+import com.raytheon.uf.common.style.StyleRule;
+import com.raytheon.uf.common.style.StyleException;
+import com.raytheon.uf.common.style.arrow.ArrowPreferences;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.IExtent;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
@@ -44,10 +49,6 @@ import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
-import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
-import com.raytheon.uf.viz.core.style.StyleManager;
-import com.raytheon.uf.viz.core.style.StyleRule;
-import com.raytheon.uf.viz.core.style.VizStyleException;
 import com.raytheon.uf.viz.xy.InterpUtils;
 import com.raytheon.uf.viz.xy.graph.IGraph;
 import com.raytheon.uf.viz.xy.timeheight.display.TimeHeightDescriptor;
@@ -56,7 +57,6 @@ import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter;
 import com.raytheon.viz.core.contours.util.VectorGraphicsRenderable;
 import com.raytheon.viz.core.graphing.xy.XYData;
 import com.raytheon.viz.core.graphing.xy.XYWindImageData;
-import com.raytheon.viz.core.style.arrow.ArrowPreferences;
 import com.vividsolutions.jts.geom.Coordinate;
 
 /**
@@ -104,7 +104,7 @@ public class TimeHeightVectorResource extends AbstractTimeHeightResource
         try {
             sr = StyleManager.getInstance().getStyleRule(
                     StyleManager.StyleType.ARROW, match);
-        } catch (VizStyleException e) {
+        } catch (StyleException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
diff --git a/cave/com.raytheon.uf.viz.xy.timeseries/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.xy.timeseries/META-INF/MANIFEST.MF
index 908de32e7f..0c21f2a735 100644
--- a/cave/com.raytheon.uf.viz.xy.timeseries/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.uf.viz.xy.timeseries/META-INF/MANIFEST.MF
@@ -22,6 +22,9 @@ Import-Package: com.raytheon.uf.common.dataplugin,
  com.raytheon.uf.common.geospatial,
  com.raytheon.uf.common.serialization,
  com.raytheon.uf.common.status,
+ com.raytheon.uf.common.style,
+ com.raytheon.uf.common.style.graph,
+ com.raytheon.uf.common.style.level,
  com.raytheon.uf.common.time,
  com.raytheon.uf.viz.core,
  com.raytheon.uf.viz.core.drawables,
@@ -30,8 +33,6 @@ Import-Package: com.raytheon.uf.common.dataplugin,
  com.raytheon.uf.viz.core.rsc,
  com.raytheon.uf.viz.core.rsc.capabilities,
  com.raytheon.uf.viz.core.status,
- com.raytheon.uf.viz.core.style,
- com.raytheon.uf.viz.core.style.level,
  com.raytheon.uf.viz.d2d.core,
  com.raytheon.uf.viz.d2d.ui,
  com.raytheon.uf.viz.xy,
@@ -42,7 +43,6 @@ Import-Package: com.raytheon.uf.common.dataplugin,
  com.raytheon.viz.core.graphing.util,
  com.raytheon.viz.core.graphing.xy,
  com.raytheon.viz.core.rsc,
- com.raytheon.viz.core.style.graph,
  com.raytheon.viz.ui.cmenu,
  com.raytheon.viz.ui.editor,
  com.raytheon.viz.ui.input,
diff --git a/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/adapter/AbstractTimeSeriesAdapter.java b/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/adapter/AbstractTimeSeriesAdapter.java
index 8750bb76fd..72e8f16261 100644
--- a/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/adapter/AbstractTimeSeriesAdapter.java
+++ b/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/adapter/AbstractTimeSeriesAdapter.java
@@ -28,15 +28,15 @@ import javax.measure.unit.Unit;
 import org.eclipse.swt.graphics.RGB;
 
 import com.raytheon.uf.common.dataplugin.PluginDataObject;
+import com.raytheon.uf.common.style.level.SingleLevel;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.rsc.DisplayType;
-import com.raytheon.uf.viz.core.style.level.SingleLevel;
 import com.raytheon.uf.viz.xy.timeseries.rsc.TimeSeriesResourceData;
 import com.raytheon.viz.core.graphing.xy.XYDataList;
 
 /**
- * TODO Add Description
+ * Adapts data for rendering on time series displays.
  * 
  * 
  * 
diff --git a/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResource.java b/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResource.java
index 9e8e7b17d0..8b93e5a437 100644
--- a/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResource.java
+++ b/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResource.java
@@ -46,6 +46,9 @@ import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
 import com.raytheon.uf.common.status.IUFStatusHandler;
 import com.raytheon.uf.common.status.UFStatus;
 import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.style.StyleException;
+import com.raytheon.uf.common.style.graph.GraphPreferences;
+import com.raytheon.uf.common.style.level.SingleLevel;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.IExtent;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
@@ -62,8 +65,6 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
-import com.raytheon.uf.viz.core.style.VizStyleException;
-import com.raytheon.uf.viz.core.style.level.SingleLevel;
 import com.raytheon.uf.viz.xy.graph.IGraph;
 import com.raytheon.uf.viz.xy.graph.labeling.DataTimeLabel;
 import com.raytheon.uf.viz.xy.graph.labeling.DoubleLabel;
@@ -80,7 +81,6 @@ import com.raytheon.viz.core.graphing.xy.XYImageData;
 import com.raytheon.viz.core.graphing.xy.XYWindImageData;
 import com.raytheon.viz.core.rsc.ICombinedResourceData;
 import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation;
-import com.raytheon.viz.core.style.graph.GraphPreferences;
 import com.vividsolutions.jts.geom.Coordinate;
 import com.vividsolutions.jts.geom.Geometry;
 
@@ -160,19 +160,21 @@ public class TimeSeriesResource extends
                         UnitConverter conv = currentUnit.getConverterTo(prefs
                                 .getDisplayUnits());
                         ListIterator it = data.getData().listIterator();
-                        while(it.hasNext()) {
+                        while (it.hasNext()) {
                             XYData d = it.next();
-                            if(d instanceof XYWindImageData){
+                            if (d instanceof XYWindImageData) {
                                 XYWindImageData wind = (XYWindImageData) d;
-                                double converted = conv.convert(wind.getWindSpd());
+                                double converted = conv.convert(wind
+                                        .getWindSpd());
                                 it.remove();
-                                if(wind.getImage() != null){
+                                if (wind.getImage() != null) {
                                     wind.getImage().dispose();
                                 }
-                                it.add(new XYWindImageData(wind.getX(), wind.getY(), converted, wind.getWindDir()));
-                            }else{
-                                double converted = conv.convert(((Number) d.getY())
-                                        .doubleValue());
+                                it.add(new XYWindImageData(wind.getX(), wind
+                                        .getY(), converted, wind.getWindDir()));
+                            } else {
+                                double converted = conv.convert(((Number) d
+                                        .getY()).doubleValue());
                                 d.setY(converted);
                             }
                         }
@@ -397,8 +399,8 @@ public class TimeSeriesResource extends
             try {
                 prefs = GraphPrefsFactory.buildPreferences(
                         resourceData.getYParameter().code, adapter.getLevel());
-            } catch (VizStyleException e) {
-                throw e;
+            } catch (StyleException e) {
+                throw new VizException(e.getLocalizedMessage(), e);
             }
         }
 
@@ -495,8 +497,8 @@ public class TimeSeriesResource extends
             sb.append(" ").append(resourceData.getLevelKey());
         }
         sb.append(String.format(" %s %s %s", adapter.getParameterName(),
-                "TSer", units != null && units.equals("") == false ? "(" + units
-                        + ")" : ""));
+                "TSer", units != null && units.equals("") == false ? "("
+                        + units + ")" : ""));
 
         if (secondaryResource != null) {
             return ICombinedResourceData.CombineUtil.getName(sb.toString(),
diff --git a/cave/com.raytheon.uf.viz.xy.varheight/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.xy.varheight/META-INF/MANIFEST.MF
index e05c73bf24..c0470d76ce 100644
--- a/cave/com.raytheon.uf.viz.xy.varheight/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.uf.viz.xy.varheight/META-INF/MANIFEST.MF
@@ -15,6 +15,8 @@ Import-Package: com.raytheon.uf.common.dataplugin,
  com.raytheon.uf.common.geospatial,
  com.raytheon.uf.common.serialization,
  com.raytheon.uf.common.status,
+ com.raytheon.uf.common.style,
+ com.raytheon.uf.common.style.graph,
  com.raytheon.uf.common.time,
  com.raytheon.uf.viz.core,
  com.raytheon.uf.viz.core.drawables,
@@ -24,7 +26,6 @@ Import-Package: com.raytheon.uf.common.dataplugin,
  com.raytheon.uf.viz.core.rsc,
  com.raytheon.uf.viz.core.rsc.capabilities,
  com.raytheon.uf.viz.core.status,
- com.raytheon.uf.viz.core.style,
  com.raytheon.uf.viz.d2d.core,
  com.raytheon.uf.viz.d2d.ui,
  com.raytheon.uf.viz.xy,
@@ -39,7 +40,6 @@ Import-Package: com.raytheon.uf.common.dataplugin,
  com.raytheon.viz.core.map,
  com.raytheon.viz.core.rsc,
  com.raytheon.viz.core.slice.request,
- com.raytheon.viz.core.style.graph,
  com.raytheon.viz.ui,
  com.raytheon.viz.ui.cmenu,
  com.raytheon.viz.ui.editor,
diff --git a/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/rsc/VarHeightResource.java b/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/rsc/VarHeightResource.java
index 200341ed45..445166de24 100644
--- a/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/rsc/VarHeightResource.java
+++ b/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/rsc/VarHeightResource.java
@@ -31,6 +31,8 @@ import org.eclipse.swt.graphics.RGB;
 
 import com.raytheon.uf.common.dataplugin.PluginDataObject;
 import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
+import com.raytheon.uf.common.style.StyleException;
+import com.raytheon.uf.common.style.graph.GraphPreferences;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.DrawableLine;
 import com.raytheon.uf.viz.core.IExtent;
@@ -64,7 +66,6 @@ import com.raytheon.viz.core.map.GeoUtil;
 import com.raytheon.viz.core.rsc.ICombinedResourceData;
 import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation;
 import com.raytheon.viz.core.slice.request.HeightScale;
-import com.raytheon.viz.core.style.graph.GraphPreferences;
 import com.vividsolutions.jts.geom.Coordinate;
 import com.vividsolutions.jts.geom.Geometry;
 
@@ -130,8 +131,12 @@ public class VarHeightResource extends
             this.combineOperation = combinedResourceData.getCombineOperation();
         }
 
-        prefs = GraphPrefsFactory.buildPreferences(resourceData.getParameter(),
-                null);
+        try {
+            prefs = GraphPrefsFactory.buildPreferences(
+                    resourceData.getParameter(), null);
+        } catch (StyleException e) {
+            throw new VizException(e.getLocalizedMessage(), e);
+        }
 
         resourceData.addChangeListener(new IResourceDataChanged() {
 
diff --git a/cave/com.raytheon.viz.core.contours/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.core.contours/META-INF/MANIFEST.MF
index 53a4e5d92e..a5b97975fe 100644
--- a/cave/com.raytheon.viz.core.contours/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.viz.core.contours/META-INF/MANIFEST.MF
@@ -11,12 +11,13 @@ Require-Bundle: org.eclipse.core.runtime,
  com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
  com.raytheon.uf.common.status;bundle-version="1.12.1174",
  com.raytheon.uf.common.util;bundle-version="1.12.1174",
- com.raytheon.uf.viz.core;bundle-version="1.12.1174",
+ com.raytheon.uf.viz.core;bundle-version="1.12.1174", 
  com.raytheon.uf.common.wxmath;bundle-version="1.0.0"
 Bundle-ActivationPolicy: lazy
 Export-Package: com.raytheon.viz.core.contours,
  com.raytheon.viz.core.contours.rsc.displays,
  com.raytheon.viz.core.contours.util
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Import-Package: com.raytheon.viz.core.interval,
- com.raytheon.viz.core.style.contour
+Import-Package: com.raytheon.uf.common.style,
+ com.raytheon.uf.common.style.contour,
+ com.raytheon.viz.core.interval
diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourCreateRequest.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourCreateRequest.java
index a6d5934c86..69d8232746 100644
--- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourCreateRequest.java
+++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourCreateRequest.java
@@ -22,11 +22,11 @@ package com.raytheon.viz.core.contours;
 import org.geotools.coverage.grid.GeneralGridGeometry;
 
 import com.raytheon.uf.common.datastorage.records.IDataRecord;
+import com.raytheon.uf.common.style.contour.ContourPreferences;
 import com.raytheon.uf.viz.core.IExtent;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
 import com.raytheon.uf.viz.core.map.IMapDescriptor;
 import com.raytheon.viz.core.contours.ContourSupport.ContourGroup;
-import com.raytheon.viz.core.style.contour.ContourPreferences;
 
 /**
  * ContourCreateRequest
diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourRenderable.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourRenderable.java
index 37f4402c12..ba06aebbc2 100644
--- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourRenderable.java
+++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourRenderable.java
@@ -33,6 +33,7 @@ import org.opengis.referencing.operation.MathTransform;
 import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
 import com.raytheon.uf.common.datastorage.records.IDataRecord;
 import com.raytheon.uf.common.geospatial.MapUtil;
+import com.raytheon.uf.common.style.contour.ContourPreferences;
 import com.raytheon.uf.common.wxmath.DistFilter;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
 import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
@@ -45,7 +46,6 @@ import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.map.IMapDescriptor;
 import com.raytheon.uf.viz.core.map.MapDescriptor;
 import com.raytheon.viz.core.contours.ContourSupport.ContourGroup;
-import com.raytheon.viz.core.style.contour.ContourPreferences;
 import com.vividsolutions.jts.geom.Coordinate;
 
 /**
diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourSupport.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourSupport.java
index 8fdbb44f7c..dcb7f5fee5 100644
--- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourSupport.java
+++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/ContourSupport.java
@@ -50,6 +50,7 @@ import com.raytheon.uf.common.geospatial.util.WorldWrapChecker;
 import com.raytheon.uf.common.status.IUFStatusHandler;
 import com.raytheon.uf.common.status.UFStatus;
 import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.style.LabelingPreferences;
 import com.raytheon.uf.common.util.GridUtil;
 import com.raytheon.uf.viz.core.DrawableString;
 import com.raytheon.uf.viz.core.IExtent;
@@ -62,7 +63,6 @@ import com.raytheon.uf.viz.core.drawables.IFont;
 import com.raytheon.uf.viz.core.drawables.IWireframeShape;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.map.IMapDescriptor;
-import com.raytheon.uf.viz.core.style.LabelingPreferences;
 import com.raytheon.viz.core.contours.cache.SubGridCacheKey;
 import com.raytheon.viz.core.contours.util.ContourContainer;
 import com.raytheon.viz.core.contours.util.FortConBuf;
@@ -72,7 +72,7 @@ import com.raytheon.viz.core.contours.util.StreamLineContainer.StreamLinePoint;
 import com.raytheon.viz.core.contours.util.StrmPak;
 import com.raytheon.viz.core.contours.util.StrmPakConfig;
 import com.raytheon.viz.core.interval.XFormFunctions;
-import com.raytheon.viz.core.style.contour.ContourPreferences;
+import com.raytheon.uf.common.style.contour.ContourPreferences;
 import com.vividsolutions.jts.geom.Geometry;
 
 /**
diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedContourDisplay.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedContourDisplay.java
index ab87c5d645..063992d8c1 100644
--- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedContourDisplay.java
+++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedContourDisplay.java
@@ -29,7 +29,7 @@ import com.raytheon.uf.common.datastorage.records.IDataRecord;
 import com.raytheon.uf.viz.core.exception.VizException;
 import com.raytheon.uf.viz.core.map.IMapDescriptor;
 import com.raytheon.viz.core.contours.ContourRenderable;
-import com.raytheon.viz.core.style.contour.ContourPreferences;
+import com.raytheon.uf.common.style.contour.ContourPreferences;
 
 /**
  * Displays contours from GFE Grid Data
diff --git a/cave/com.raytheon.viz.core.graphing/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.core.graphing/META-INF/MANIFEST.MF
index c36eddb8c2..047f4ecf52 100644
--- a/cave/com.raytheon.viz.core.graphing/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.viz.core.graphing/META-INF/MANIFEST.MF
@@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.ui,
  javax.measure,
  org.jep;bundle-version="1.0.0",
  com.raytheon.uf.common.python;bundle-version="1.11.17",
- com.raytheon.uf.common.colormap;bundle-version="1.12.1174"
+ com.raytheon.uf.common.colormap;bundle-version="1.12.1174",
+ com.raytheon.uf.common.style;bundle-version="1.0.0"
 Bundle-ActivationPolicy: lazy
 Export-Package: com.raytheon.viz.core.graphing,
  com.raytheon.viz.core.graphing.axis,
diff --git a/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/DataAxisInfo.java b/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/DataAxisInfo.java
index 61ca605643..703111bdad 100644
--- a/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/DataAxisInfo.java
+++ b/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/DataAxisInfo.java
@@ -20,7 +20,7 @@
 
 package com.raytheon.viz.core.graphing;
 
-import com.raytheon.viz.core.style.graph.GraphPreferences;
+import com.raytheon.uf.common.style.graph.GraphPreferences;
 
 /**
  * Ported from D2D
diff --git a/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/axis/AxisFactory.java b/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/axis/AxisFactory.java
index c25e2a137b..2a55a22f0e 100644
--- a/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/axis/AxisFactory.java
+++ b/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/axis/AxisFactory.java
@@ -29,10 +29,12 @@ import javax.measure.unit.Unit;
 
 import org.eclipse.swt.graphics.RGB;
 
+import com.raytheon.uf.common.style.graph.AxisScale;
+import com.raytheon.uf.common.style.graph.GraphPreferences;
+import com.raytheon.uf.common.style.level.SingleLevel;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
 import com.raytheon.uf.viz.core.exception.VizException;
-import com.raytheon.uf.viz.core.style.level.SingleLevel;
 import com.raytheon.viz.core.ColorUtil;
 import com.raytheon.viz.core.graphing.DataAxisInfo;
 import com.raytheon.viz.core.graphing.GraphUtil;
@@ -40,8 +42,6 @@ import com.raytheon.viz.core.graphing.util.GraphPrefsFactory;
 import com.raytheon.viz.core.graphing.util.GraphUtilPorted;
 import com.raytheon.viz.core.slice.request.HeightScale;
 import com.raytheon.viz.core.slice.request.HeightScale.ScaleType;
-import com.raytheon.viz.core.style.graph.AxisScale;
-import com.raytheon.viz.core.style.graph.GraphPreferences;
 
 /**
  * Factory methods for generating axes.
@@ -158,9 +158,10 @@ public class AxisFactory {
         } else if (firstInfo == null || secondInfo == null) {
             compatible = false;
         } else {
-            compatible = GraphUtilPorted.verifyDataAxisInfo(firstInfo
-                    .getDataMin(), dataAtZero, ABS_MIN, firstInfo.getDataMax(),
-                    units, firstInfo.getStyle(), secondInfo, true);
+            compatible = GraphUtilPorted.verifyDataAxisInfo(
+                    firstInfo.getDataMin(), dataAtZero, ABS_MIN,
+                    firstInfo.getDataMax(), units, firstInfo.getStyle(),
+                    secondInfo, true);
         }
 
         return compatible;
@@ -239,8 +240,8 @@ public class AxisFactory {
         rangeAxis.setRange(minLevel, maxLevel);
 
         // TODO should be configurable
-        GraphPreferences style = GraphPrefsFactory.buildSimplePreferences(scale
-                .getScale() == ScaleType.LOG, minLevel, maxLevel);
+        GraphPreferences style = GraphPrefsFactory.buildSimplePreferences(
+                scale.getScale() == ScaleType.LOG, minLevel, maxLevel);
         style.getAxisScale().setMaxValue(maxLevel);
         style.getAxisScale().setMinValue(minLevel);
         DataAxisInfo info = GraphUtilPorted.initDataAxisInfo((float) minLevel,
diff --git a/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/axis/AxisUtil.java b/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/axis/AxisUtil.java
index c17b038fbc..2226a52e5e 100644
--- a/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/axis/AxisUtil.java
+++ b/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/axis/AxisUtil.java
@@ -22,9 +22,9 @@ package com.raytheon.viz.core.graphing.axis;
 import java.text.DecimalFormat;
 import java.util.HashMap;
 
+import com.raytheon.uf.common.style.graph.AxisScale;
 import com.raytheon.viz.core.graphing.DataAxisInfo;
 import com.raytheon.viz.core.graphing.util.GraphUtilPorted;
-import com.raytheon.viz.core.style.graph.AxisScale;
 
 /**
  * 
@@ -33,7 +33,7 @@ import com.raytheon.viz.core.style.graph.AxisScale;
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- *                         njensen     Initial creation	
+ *                         njensen     Initial creation
  * 
  * 
* diff --git a/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/util/GraphPrefsFactory.java b/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/util/GraphPrefsFactory.java index ca2eb6216b..c3cc4e4f38 100644 --- a/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/util/GraphPrefsFactory.java +++ b/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/util/GraphPrefsFactory.java @@ -21,13 +21,13 @@ package com.raytheon.viz.core.graphing.util; import java.util.ArrayList; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.VizStyleException; -import com.raytheon.uf.viz.core.style.level.SingleLevel; -import com.raytheon.viz.core.style.graph.AxisScale; -import com.raytheon.viz.core.style.graph.GraphPreferences; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.graph.AxisScale; +import com.raytheon.uf.common.style.graph.GraphPreferences; +import com.raytheon.uf.common.style.level.SingleLevel; /** * Loads GraphPreferences from graph style rules @@ -36,7 +36,7 @@ import com.raytheon.viz.core.style.graph.GraphPreferences; * SOFTWARE HISTORY * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- - * Oct 23, 2007 njensen Initial creation + * Oct 23, 2007 njensen Initial creation * *
* @@ -47,7 +47,7 @@ import com.raytheon.viz.core.style.graph.GraphPreferences; public class GraphPrefsFactory { public static GraphPreferences buildPreferences(String parameter, - SingleLevel level) throws VizStyleException { + SingleLevel level) throws StyleException { GraphPreferences preferences = getPreferences(parameter, level); if (preferences == null) { preferences = new GraphPreferences(); @@ -98,7 +98,7 @@ public class GraphPrefsFactory { } private static GraphPreferences getPreferences(String parameter, - SingleLevel level) throws VizStyleException { + SingleLevel level) throws StyleException { GraphPreferences prefs = null; ParamLevelMatchCriteria match = new ParamLevelMatchCriteria(); match.setLevel(level); diff --git a/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/util/GraphUtilPorted.java b/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/util/GraphUtilPorted.java index fd3006525e..31937814cb 100644 --- a/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/util/GraphUtilPorted.java +++ b/cave/com.raytheon.viz.core.graphing/src/com/raytheon/viz/core/graphing/util/GraphUtilPorted.java @@ -20,10 +20,10 @@ package com.raytheon.viz.core.graphing.util; +import com.raytheon.uf.common.style.graph.AxisScale; +import com.raytheon.uf.common.style.graph.GraphPreferences; import com.raytheon.viz.core.graphing.DataAxisInfo; import com.raytheon.viz.core.interval.XFormFunctions; -import com.raytheon.viz.core.style.graph.AxisScale; -import com.raytheon.viz.core.style.graph.GraphPreferences; /** * Util methods ported from various parts of D2D. Mostly from XFormFunctions. @@ -367,8 +367,7 @@ public class GraphUtilPorted { .getInterval()); else if (value > dataAxisInfo.getDLinear()) return (float) (N_GRAPH_DATA_DIVS - Math.log10(dataAxisInfo - .getDivMax() - / value) + .getDivMax() / value) / dataAxisInfo.getInterval()); else return dataAxisInfo.getZeroDiv() + value @@ -1288,11 +1287,11 @@ public class GraphUtilPorted { float dataMax = valueOfAxisDivision(maxDiv, dataAxisInfo); // fprintf(stderr,"zoomAxisInfo dataMin %f dataMax // %f\n",dataMin,dataMax); - DataAxisInfo zoomedInfo = calcDataAxisInfo(dataMin, dataAxisInfo - .isZeroYes(), dataAxisInfo.getAbsMin(), dataMax, zoomFactor, - dataAxisInfo.getStyle(), dataAxisInfo.getDivMin(), dataAxisInfo - .getDivMax(), dataAxisInfo.getInterval(), dataAxisInfo - .getDLinear(), dataAxisInfo.getZeroDiv(), perDecade); + DataAxisInfo zoomedInfo = calcDataAxisInfo(dataMin, + dataAxisInfo.isZeroYes(), dataAxisInfo.getAbsMin(), dataMax, + zoomFactor, dataAxisInfo.getStyle(), dataAxisInfo.getDivMin(), + dataAxisInfo.getDivMax(), dataAxisInfo.getInterval(), + dataAxisInfo.getDLinear(), dataAxisInfo.getZeroDiv(), perDecade); return zoomedInfo; } diff --git a/cave/com.raytheon.viz.core/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.core/META-INF/MANIFEST.MF index 934be48e19..d5bd2eada0 100644 --- a/cave/com.raytheon.viz.core/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.core/META-INF/MANIFEST.MF @@ -28,7 +28,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.serialization.comm, org.eclipse.core.expressions, com.raytheon.uf.viz.application;bundle-version="1.0.0", - com.raytheon.uf.common.topo;bundle-version="1.12.1174" + com.raytheon.uf.common.topo;bundle-version="1.12.1174", + com.raytheon.uf.common.style;bundle-version="1.0.0" Eclipse-BuddyPolicy: ext, registered, global Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.uf.common.geospatial, com.raytheon.uf.common.serialization, com.raytheon.uf.common.status Export-Package: @@ -44,10 +45,6 @@ Export-Package: com.raytheon.viz.core.rsc.hdf5, com.raytheon.viz.core.rsc.jts, com.raytheon.viz.core.spatial, - com.raytheon.viz.core.style.arrow, - com.raytheon.viz.core.style.contour, - com.raytheon.viz.core.style.graph, - com.raytheon.viz.core.style.image, com.raytheon.viz.core.topo Bundle-Vendor: Raytheon Bundle-Activator: com.raytheon.viz.core.CorePlugin diff --git a/cave/com.raytheon.viz.core/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/cave/com.raytheon.viz.core/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject index b2b17897d9..90bcc0c47d 100644 --- a/cave/com.raytheon.viz.core/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ b/cave/com.raytheon.viz.core/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -1,7 +1,3 @@ -com.raytheon.viz.core.style.image.ImagePreferences -com.raytheon.viz.core.style.contour.ContourPreferences -com.raytheon.viz.core.style.arrow.ArrowPreferences -com.raytheon.viz.core.style.graph.GraphPreferences com.raytheon.viz.core.rsc.BestResResourceData com.raytheon.viz.core.rsc.BlendedResourceData com.raytheon.viz.core.topo.TopoResourceData \ No newline at end of file diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/drawables/ColorMapParameterFactory.java b/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/drawables/ColorMapParameterFactory.java index 58b9424333..f6e47bcdb1 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/drawables/ColorMapParameterFactory.java +++ b/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/drawables/ColorMapParameterFactory.java @@ -37,18 +37,19 @@ import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.LabelingPreferences; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.image.DataScale; +import com.raytheon.uf.common.style.image.DataScale.Type; +import com.raytheon.uf.common.style.image.ImagePreferences; +import com.raytheon.uf.common.style.level.RangeLevel; +import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.util.GridUtil; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.style.LabelingPreferences; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.level.RangeLevel; -import com.raytheon.uf.viz.core.style.level.SingleLevel; -import com.raytheon.viz.core.style.image.DataScale; -import com.raytheon.viz.core.style.image.DataScale.Type; -import com.raytheon.viz.core.style.image.ImagePreferences; /** * ColorMapParameterFactory @@ -92,8 +93,13 @@ public class ColorMapParameterFactory { entityList.add(entity); match.setCreatingEntityNames(entityList); } - StyleRule sr = StyleManager.getInstance().getStyleRule( - StyleManager.StyleType.IMAGERY, match); + StyleRule sr; + try { + sr = StyleManager.getInstance().getStyleRule( + StyleManager.StyleType.IMAGERY, match); + } catch (StyleException e) { + throw new VizException(e.getLocalizedMessage(), e); + } return build(sr, data, level, parameterUnits); } diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/topo/TopoResource.java b/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/topo/TopoResource.java index c3297461ba..14940fd703 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/topo/TopoResource.java +++ b/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/topo/TopoResource.java @@ -38,6 +38,15 @@ import com.raytheon.uf.common.colormap.prefs.ColorMapParameters.PersistedParamet import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; +import com.raytheon.uf.common.style.LabelingPreferences; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleManager.StyleType; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.image.DataScale; +import com.raytheon.uf.common.style.image.ImagePreferences; +import com.raytheon.uf.common.style.image.SamplePreferences; import com.raytheon.uf.common.topo.TopoUtils; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.ColorMapLoader; @@ -49,16 +58,8 @@ import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability; -import com.raytheon.uf.viz.core.style.LabelingPreferences; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleManager.StyleType; -import com.raytheon.uf.viz.core.style.StyleRule; import com.raytheon.uf.viz.core.tile.TileSetRenderable; import com.raytheon.uf.viz.core.tile.TileSetRenderable.TileImageCreator; -import com.raytheon.viz.core.style.image.DataScale; -import com.raytheon.viz.core.style.image.ImagePreferences; -import com.raytheon.viz.core.style.image.SamplePreferences; /** * Provides an SRTM hdf5-backed topographic map @@ -125,8 +126,13 @@ public class TopoResource extends // TODO: create topo style rules for topo and bathymetric topo ParamLevelMatchCriteria criteria = new ParamLevelMatchCriteria(); criteria.setParameterName(Arrays.asList(resourceData.getTopoFile())); - StyleRule styleRule = StyleManager.getInstance().getStyleRule( - StyleType.IMAGERY, criteria); + StyleRule styleRule; + try { + styleRule = StyleManager.getInstance().getStyleRule( + StyleType.IMAGERY, criteria); + } catch (StyleException e) { + throw new VizException(e.getLocalizedMessage(), e); + } // Default colormap String colorMapName = "topo"; diff --git a/cave/com.raytheon.viz.dataaccess/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.dataaccess/META-INF/MANIFEST.MF index cdb9e80477..31c12d9cba 100644 --- a/cave/com.raytheon.viz.dataaccess/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.dataaccess/META-INF/MANIFEST.MF @@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.viz.core;bundle-version="1.12.1174", com.raytheon.uf.common.colormap;bundle-version="1.12.1174", javax.measure;bundle-version="1.0.0", - org.apache.commons.lang;bundle-version="2.3.0" + org.apache.commons.lang;bundle-version="2.3.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.dataaccess.rsc, diff --git a/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/rsc/grid/GenericGridResource.java b/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/rsc/grid/GenericGridResource.java index e446caea3c..6343d56c4a 100644 --- a/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/rsc/grid/GenericGridResource.java +++ b/cave/com.raytheon.viz.dataaccess/src/com/raytheon/viz/dataaccess/rsc/grid/GenericGridResource.java @@ -34,6 +34,8 @@ import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; import com.raytheon.uf.common.dataaccess.grid.IGridData; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; +import com.raytheon.uf.common.style.level.SingleLevel; +import com.raytheon.uf.common.style.level.Level.LevelType; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.ColorMapLoader; @@ -41,8 +43,6 @@ import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; -import com.raytheon.uf.viz.core.style.level.Level.LevelType; -import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.viz.core.drawables.ColorMapParameterFactory; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay2; import com.raytheon.viz.dataaccess.rsc.AbstractDataAccessResource; diff --git a/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF index 2a23a1295d..44fccbc4c0 100644 --- a/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF @@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.auth;bundle-version="1.12.1174", com.raytheon.uf.common.python;bundle-version="1.12.1174", com.raytheon.uf.common.colormap;bundle-version="1.12.1174", - com.google.guava;bundle-version="1.0.0" + com.google.guava;bundle-version="1.0.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.gfe, com.raytheon.viz.gfe.constants, 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 028ced353e..500a830462 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 @@ -74,6 +74,7 @@ import com.raytheon.uf.common.geospatial.ReferencedObject.Type; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.LabelingPreferences; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.viz.core.DrawableString; @@ -104,14 +105,13 @@ import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; -import com.raytheon.uf.viz.core.style.LabelingPreferences; import com.raytheon.uf.viz.core.time.TimeMatchingJob; import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay; import com.raytheon.viz.core.contours.rsc.displays.GriddedVectorDisplay; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay.GriddedImagePaintProperties; import com.raytheon.viz.core.rsc.jts.JTSCompiler; -import com.raytheon.viz.core.style.contour.ContourPreferences; +import com.raytheon.uf.common.style.contour.ContourPreferences; import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.GFEPreference; import com.raytheon.viz.gfe.actions.ChangeCombineMode; diff --git a/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF index f5b5f37ffe..5f9f986734 100644 --- a/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.grid/META-INF/MANIFEST.MF @@ -39,6 +39,11 @@ Import-Package: com.raytheon.uf.common.comm, com.raytheon.uf.common.parameter, com.raytheon.uf.common.pointdata, com.raytheon.uf.common.serialization, + com.raytheon.uf.common.style, + com.raytheon.uf.common.style.arrow, + com.raytheon.uf.common.style.contour, + com.raytheon.uf.common.style.image, + com.raytheon.uf.common.style.level, com.raytheon.uf.common.time, com.raytheon.uf.common.topo, com.raytheon.uf.viz.d2d.core.map, @@ -46,8 +51,5 @@ Import-Package: com.raytheon.uf.common.comm, com.raytheon.viz.alerts.observers, com.raytheon.viz.core.drawables, com.raytheon.viz.core.rsc, - com.raytheon.viz.core.rsc.displays, - com.raytheon.viz.core.style.arrow, - com.raytheon.viz.core.style.contour, - com.raytheon.viz.core.style.image + com.raytheon.viz.core.rsc.displays Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/GridLevelTranslator.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/GridLevelTranslator.java index 36945cc64a..26c5cbf474 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/GridLevelTranslator.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/GridLevelTranslator.java @@ -25,8 +25,8 @@ import javax.measure.unit.SI; import javax.measure.unit.Unit; import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.viz.core.style.level.Level; -import com.raytheon.uf.viz.core.style.level.SingleLevel; +import com.raytheon.uf.common.style.level.Level; +import com.raytheon.uf.common.style.level.SingleLevel; /** * Grid Level Translator diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java index f88268818a..0de8ba3666 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/AbstractGridResource.java @@ -48,6 +48,18 @@ import com.raytheon.uf.common.geospatial.interpolation.data.FloatBufferWrapper; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.AbstractStylePreferences; +import com.raytheon.uf.common.style.MatchCriteria; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleManager.StyleType; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.arrow.ArrowPreferences; +import com.raytheon.uf.common.style.contour.ContourPreferences; +import com.raytheon.uf.common.style.image.ImagePreferences; +import com.raytheon.uf.common.style.level.Level; +import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.VizApp; @@ -73,15 +85,6 @@ import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; -import com.raytheon.uf.viz.core.style.AbstractStylePreferences; -import com.raytheon.uf.viz.core.style.MatchCriteria; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleManager.StyleType; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.VizStyleException; -import com.raytheon.uf.viz.core.style.level.Level; -import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.viz.core.contours.ContourRenderable; import com.raytheon.viz.core.contours.rsc.displays.AbstractGriddedDisplay; import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay; @@ -90,9 +93,6 @@ import com.raytheon.viz.core.contours.rsc.displays.GriddedVectorDisplay; import com.raytheon.viz.core.contours.util.VectorGraphicsRenderableFactory; import com.raytheon.viz.core.drawables.ColorMapParameterFactory; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay2; -import com.raytheon.viz.core.style.arrow.ArrowPreferences; -import com.raytheon.viz.core.style.contour.ContourPreferences; -import com.raytheon.viz.core.style.image.ImagePreferences; import com.raytheon.viz.grid.rsc.GriddedIconDisplay; import com.vividsolutions.jts.geom.Coordinate; @@ -303,7 +303,11 @@ public abstract class AbstractGridResource @Override protected void initInternal(IGraphicsTarget target) throws VizException { - initStylePreferences(); + try { + initStylePreferences(); + } catch (StyleException e) { + throw new VizException(e.getLocalizedMessage(), e); + } initSampling(); } @@ -351,9 +355,9 @@ public abstract class AbstractGridResource /** * Gets style preferences from the StyleManager * - * @throws VizStyleException + * @throws StyleException */ - protected void initStylePreferences() throws VizStyleException { + protected void initStylePreferences() throws StyleException { DisplayType displayType = getDisplayType(); StyleRule styleRule = null; MatchCriteria criteria = getMatchCriteria(); diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/DifferenceGridResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/DifferenceGridResource.java index 59785ce953..2e90cc8f78 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/DifferenceGridResource.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/DifferenceGridResource.java @@ -38,6 +38,7 @@ import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; import com.raytheon.uf.common.time.CombinedDataTime; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IGraphicsTarget; @@ -48,7 +49,6 @@ import com.raytheon.uf.viz.core.rsc.IResourceGroup; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceList; import com.raytheon.uf.viz.core.rsc.capabilities.GroupNamingCapability; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation; import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineUtil; diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridResource.java index 9343dcea25..557e06576b 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridResource.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GridResource.java @@ -32,14 +32,14 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.grid.GridRecord; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.level.Level; +import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.AbstractResourceData; import com.raytheon.uf.viz.core.rsc.LoadProperties; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.level.Level; -import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.viz.grid.GridLevelTranslator; /** diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/RadarAdapter.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/RadarAdapter.java index 73b1053f59..120db5d05e 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/RadarAdapter.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/util/RadarAdapter.java @@ -54,12 +54,12 @@ import com.raytheon.uf.common.gridcoverage.lookup.GridCoverageLookup; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.level.SingleLevel; +import com.raytheon.uf.common.style.level.Level.LevelType; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.catalog.CatalogQuery; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; -import com.raytheon.uf.viz.core.style.level.Level.LevelType; -import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.uf.viz.derivparam.library.DerivParamDesc; import com.raytheon.uf.viz.derivparam.library.DerivParamMethod; import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableNode; diff --git a/cave/com.raytheon.viz.mpe.ui/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.mpe.ui/META-INF/MANIFEST.MF index c9e2e60f27..80b37e7107 100644 --- a/cave/com.raytheon.viz.mpe.ui/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.mpe.ui/META-INF/MANIFEST.MF @@ -22,7 +22,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.dataplugin.shef;bundle-version="1.12.1174", com.raytheon.uf.viz.application, com.raytheon.viz.ui.personalities.awips;bundle-version="1.12.1174", - com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0" + com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.mpe.ui.dialogs.gagetable.xml, com.raytheon.viz.mpe.ui.displays, diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/MPEFieldResource.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/MPEFieldResource.java index 8f89c95331..1761b0f806 100644 --- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/MPEFieldResource.java +++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/rsc/MPEFieldResource.java @@ -43,16 +43,16 @@ import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingE import com.raytheon.uf.common.hydro.spatial.HRAPCoordinates; import com.raytheon.uf.common.mpe.util.XmrgFile; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.LabelingPreferences; +import com.raytheon.uf.common.style.contour.ContourPreferences; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; -import com.raytheon.uf.viz.core.style.LabelingPreferences; import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay2; -import com.raytheon.viz.core.style.contour.ContourPreferences; import com.raytheon.viz.mpe.MPEDateFormatter; import com.raytheon.viz.mpe.ui.Activator; import com.raytheon.viz.mpe.ui.DisplayFieldData; @@ -320,15 +320,15 @@ public class MPEFieldResource extends for (int i = 0; i < accumInterval; ++i) { timeToLoad.setTime(currTime.getRefTime()); timeToLoad.add(Calendar.HOUR, -i); - - if (displayField==DisplayFieldData.satPre) { - //SATPRE MPE file time stamp is the start time of the hour - //i.e. a 12z -13z product has a time stamp of 12z. - timeToLoad.add(Calendar.HOUR, -1); + + if (displayField == DisplayFieldData.satPre) { + // SATPRE MPE file time stamp is the start time of the hour + // i.e. a 12z -13z product has a time stamp of 12z. + timeToLoad.add(Calendar.HOUR, -1); } - + XmrgFile file = MPEDisplayManager.getXmrgFile(displayField, - timeToLoad.getTime()); + timeToLoad.getTime()); try { file.load(); } catch (IOException e) { diff --git a/cave/com.raytheon.viz.radar/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.radar/META-INF/MANIFEST.MF index b1c8b061f3..df58569294 100644 --- a/cave/com.raytheon.viz.radar/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.radar/META-INF/MANIFEST.MF @@ -44,9 +44,9 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.8.0", com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174", com.raytheon.viz.awipstools;bundle-version="1.12.1174", org.apache.batik;bundle-version="1.6.0", - com.raytheon.uf.common.wxmath + com.raytheon.uf.common.wxmath, + com.raytheon.uf.common.style;bundle-version="1.0.0" Import-Package: com.raytheon.viz.core.contours.util, com.raytheon.viz.core.drawables, com.raytheon.viz.core.rsc, - com.raytheon.viz.core.rsc.jts, - com.raytheon.viz.core.style.image + com.raytheon.viz.core.rsc.jts diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/interrogators/RadarDefaultInterrogator.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/interrogators/RadarDefaultInterrogator.java index e35b01c4e5..cf8e013ac1 100644 --- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/interrogators/RadarDefaultInterrogator.java +++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/interrogators/RadarDefaultInterrogator.java @@ -38,12 +38,12 @@ import com.raytheon.uf.common.geospatial.CRSCache; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; import com.raytheon.uf.common.units.PiecewisePixel; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.VizStyleException; -import com.raytheon.viz.core.style.image.ImagePreferences; +import com.raytheon.uf.common.style.image.ImagePreferences; import com.vividsolutions.jts.geom.Coordinate; /** @@ -253,7 +253,7 @@ public class RadarDefaultInterrogator implements IRadarInterrogator { try { sr = StyleManager.getInstance().getStyleRule( StyleManager.StyleType.IMAGERY, match); - } catch (VizStyleException e) { + } catch (StyleException e) { statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e); } if (sr != null && sr.getPreferences() instanceof ImagePreferences) { diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/RadarNameGenerator.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/RadarNameGenerator.java index c0c67a6ca2..a0a6200ead 100644 --- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/RadarNameGenerator.java +++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/RadarNameGenerator.java @@ -32,6 +32,10 @@ import com.raytheon.uf.common.dataplugin.radar.util.RadarInfoDict; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.drawables.AbstractDescriptor; import com.raytheon.uf.viz.core.map.MapDescriptor; @@ -39,11 +43,7 @@ import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.capabilities.BlendedCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.VizStyleException; -import com.raytheon.viz.core.style.image.ImagePreferences; +import com.raytheon.uf.common.style.image.ImagePreferences; import com.raytheon.viz.radar.rsc.graphic.RadarGraphicsResource; /** @@ -264,7 +264,7 @@ public class RadarNameGenerator extends AbstractNameGenerator { // unitName = "(" + unitName + ") "; } } - } catch (VizStyleException e1) { + } catch (StyleException e1) { // Don't worry about it just grab the units from the record. } diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/util/DataUtilities.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/util/DataUtilities.java index 259b773d85..9d043987c5 100644 --- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/util/DataUtilities.java +++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/util/DataUtilities.java @@ -28,11 +28,11 @@ import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.VizStyleException; -import com.raytheon.viz.core.style.image.ImagePreferences; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.image.ImagePreferences; /** * provides static utility method for getting the correct units for radar data. @@ -85,7 +85,7 @@ public class DataUtilities { try { sr = StyleManager.getInstance().getStyleRule( StyleManager.StyleType.IMAGERY, match); - } catch (VizStyleException e) { + } catch (StyleException e) { statusHandler.handle(Priority.PROBLEM, "Error processing radar data Unit from Style Rules", e); diff --git a/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF index dc63617b15..367976ea9a 100644 --- a/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.satellite/META-INF/MANIFEST.MF @@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174", com.raytheon.viz.ui;bundle-version="1.12.1174", com.raytheon.viz.core;bundle-version="1.12.1174", - javax.measure + javax.measure, + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.satellite, com.raytheon.viz.satellite.rsc diff --git a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java index 642010d825..f6111efa16 100644 --- a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java +++ b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatResource.java @@ -47,6 +47,14 @@ import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.image.ImagePreferences; +import com.raytheon.uf.common.style.image.SamplePreferences; +import com.raytheon.uf.common.style.level.Level; +import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.DrawableImage; import com.raytheon.uf.viz.core.IGraphicsTarget; @@ -59,15 +67,8 @@ import com.raytheon.uf.viz.core.rsc.AbstractPluginDataObjectResource; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.level.Level; -import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.uf.viz.derivparam.library.DerivedParameterRequest; import com.raytheon.viz.core.drawables.ColorMapParameterFactory; -import com.raytheon.viz.core.style.image.ImagePreferences; -import com.raytheon.viz.core.style.image.SamplePreferences; import com.raytheon.viz.satellite.SatelliteConstants; import com.raytheon.viz.satellite.tileset.SatDataRetriever; import com.raytheon.viz.satellite.tileset.SatTileSetRenderable; @@ -299,8 +300,13 @@ public class SatResource extends match.setParameterName(Arrays.asList(physicalElement)); match.setLevels(Arrays.asList((Level) level)); match.setCreatingEntityNames(Arrays.asList(record.getCreatingEntity())); - StyleRule sr = StyleManager.getInstance().getStyleRule( - StyleManager.StyleType.IMAGERY, match); + StyleRule sr; + try { + sr = StyleManager.getInstance().getStyleRule( + StyleManager.StyleType.IMAGERY, match); + } catch (StyleException e) { + throw new VizException(e.getLocalizedMessage(), e); + } if (sr != null && sr.getPreferences() instanceof ImagePreferences) { sampleRange = ((ImagePreferences) sr.getPreferences()) .getSamplePrefs(); diff --git a/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF index 4f0d682202..0c91c607db 100644 --- a/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF +++ b/cave/com.raytheon.viz.volumebrowser/META-INF/MANIFEST.MF @@ -31,7 +31,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.dataplugin.grid;bundle-version="1.0.0", com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174", com.raytheon.uf.viz.xy;bundle-version="1.12.1174", - com.raytheon.viz.core.graphing;bundle-version="1.12.1174" + com.raytheon.viz.core.graphing;bundle-version="1.12.1174", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Export-Package: com.raytheon.viz.volumebrowser, com.raytheon.viz.volumebrowser.datacatalog, diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java index 3b24284b95..f937b41695 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/datacatalog/AbstractDataCatalog.java @@ -37,6 +37,10 @@ import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizCommunicationException; import com.raytheon.uf.viz.core.level.LevelUtilities; @@ -45,10 +49,6 @@ import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceProperties; import com.raytheon.uf.viz.core.rsc.ResourceType; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.VizStyleException; import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.uf.viz.xy.crosssection.rsc.CrossSectionResourceData; import com.raytheon.uf.viz.xy.timeheight.rsc.TimeHeightResourceData; @@ -409,7 +409,7 @@ public abstract class AbstractDataCatalog implements IDataCatalog { } sr = StyleManager.getInstance().getStyleRule(styleType, match); - } catch (VizStyleException e) { + } catch (StyleException e) { statusHandler.handle(Priority.PROBLEM, "Unable to obtain a style rule for" + catalogEntry.getSelectedData().getUniqueKey(), e); @@ -486,14 +486,14 @@ public abstract class AbstractDataCatalog implements IDataCatalog { protected boolean isLatLon(String plane) { return ((plane != null) && (plane.startsWith("Lat") || plane.startsWith("Lon") || plane.equals("LATS") || plane - .equals("LONS"))); + .equals("LONS"))); } protected boolean isPointLine(String plane) { return ((plane != null) && (plane.startsWith("Line") || plane .startsWith("Point"))); } - + /** * Alter product parameters * @@ -501,9 +501,9 @@ public abstract class AbstractDataCatalog implements IDataCatalog { * @param selectedValue * @param productParameters */ - public void alterProductParameters( - String selectedKey, - String selectedValue, HashMap productParameters) { + public void alterProductParameters(String selectedKey, + String selectedValue, + HashMap productParameters) { return; } diff --git a/edexOsgi/com.raytheon.uf.common.style/.classpath b/edexOsgi/com.raytheon.uf.common.style/.classpath new file mode 100644 index 0000000000..ad32c83a78 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.style/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/edexOsgi/com.raytheon.uf.common.style/.project b/edexOsgi/com.raytheon.uf.common.style/.project new file mode 100644 index 0000000000..34959285d5 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.style/.project @@ -0,0 +1,28 @@ + + + com.raytheon.uf.common.style + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/edexOsgi/com.raytheon.uf.common.style/.settings/org.eclipse.jdt.core.prefs b/edexOsgi/com.raytheon.uf.common.style/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..c537b63063 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.style/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/edexOsgi/com.raytheon.uf.common.style/META-INF/MANIFEST.MF b/edexOsgi/com.raytheon.uf.common.style/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..8d12444ce9 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.style/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Style +Bundle-SymbolicName: com.raytheon.uf.common.style +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: RAYTHEON +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization +Export-Package: com.raytheon.uf.common.style, + com.raytheon.uf.common.style.arrow, + com.raytheon.uf.common.style.contour, + com.raytheon.uf.common.style.graph, + com.raytheon.uf.common.style.image, + com.raytheon.uf.common.style.level +Require-Bundle: com.raytheon.uf.common.colormap;bundle-version="1.12.1174", + com.raytheon.uf.common.serialization;bundle-version="1.12.1174", + javax.measure;bundle-version="1.0.0", + com.raytheon.uf.common.status;bundle-version="1.12.1174", + com.raytheon.uf.common.localization;bundle-version="1.12.1174" diff --git a/edexOsgi/com.raytheon.uf.common.style/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.common.style/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject new file mode 100644 index 0000000000..d0e4352dc9 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.style/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -0,0 +1,9 @@ +com.raytheon.uf.common.style.image.ImagePreferences +com.raytheon.uf.common.style.contour.ContourPreferences +com.raytheon.uf.common.style.arrow.ArrowPreferences +com.raytheon.uf.common.style.graph.GraphPreferences +com.raytheon.uf.common.style.level.SingleLevel +com.raytheon.uf.common.style.level.RangeLevel +com.raytheon.uf.common.style.StyleRule +com.raytheon.uf.common.style.StyleRuleset +com.raytheon.uf.common.style.ParamLevelMatchCriteria \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.style/build.properties b/edexOsgi/com.raytheon.uf.common.style/build.properties new file mode 100644 index 0000000000..34d2e4d2da --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.style/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/AbstractStylePreferences.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/AbstractStylePreferences.java similarity index 99% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/AbstractStylePreferences.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/AbstractStylePreferences.java index 62b2a0f3d3..b292d3332a 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/AbstractStylePreferences.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/AbstractStylePreferences.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style; +package com.raytheon.uf.common.style; import java.text.ParseException; import java.text.ParsePosition; diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/LabelingPreferences.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/LabelingPreferences.java similarity index 99% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/LabelingPreferences.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/LabelingPreferences.java index a3478e3cfb..962b87176c 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/LabelingPreferences.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/LabelingPreferences.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style; +package com.raytheon.uf.common.style; import java.util.Arrays; diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/MatchCriteria.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/MatchCriteria.java similarity index 96% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/MatchCriteria.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/MatchCriteria.java index 968b242ea4..c022f608c6 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/MatchCriteria.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/MatchCriteria.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style; +package com.raytheon.uf.common.style; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -54,5 +54,5 @@ public abstract class MatchCriteria implements ISerializableObject { * than a lower value */ public abstract int matches(MatchCriteria aCriteria) - throws VizStyleException; + throws StyleException; } diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/ParamLevelMatchCriteria.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/ParamLevelMatchCriteria.java similarity index 95% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/ParamLevelMatchCriteria.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/ParamLevelMatchCriteria.java index 86d5862003..f88f100d55 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/ParamLevelMatchCriteria.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/ParamLevelMatchCriteria.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style; +package com.raytheon.uf.common.style; import java.util.ArrayList; import java.util.List; @@ -29,9 +29,9 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlRootElement; -import com.raytheon.uf.viz.core.style.level.Level; -import com.raytheon.uf.viz.core.style.level.RangeLevel; -import com.raytheon.uf.viz.core.style.level.SingleLevel; +import com.raytheon.uf.common.style.level.Level; +import com.raytheon.uf.common.style.level.RangeLevel; +import com.raytheon.uf.common.style.level.SingleLevel; /** * @@ -136,12 +136,12 @@ public class ParamLevelMatchCriteria extends MatchCriteria { } @Override - public int matches(MatchCriteria criteria) throws VizStyleException { + public int matches(MatchCriteria criteria) throws StyleException { int returnValue = -1; if (criteria instanceof ParamLevelMatchCriteria) { ParamLevelMatchCriteria imgCriteria = (ParamLevelMatchCriteria) criteria; if (this.parameterNames.size() != 1) { - throw new VizStyleException( + throw new StyleException( "ParamLevelMatchCriteria requires single parameter to search for match against."); } String paramName = this.parameterNames.get(0); @@ -150,7 +150,7 @@ public class ParamLevelMatchCriteria extends MatchCriteria { if (this.levels.size() == 1) { level = levels.get(0); } else if (this.levels.size() > 1) { - throw new VizStyleException( + throw new StyleException( "ParamLevelMatchCriteria does not support matching against multiple levels."); } diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/VizStyleException.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleException.java similarity index 56% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/VizStyleException.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleException.java index ab600bc402..f21078c568 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/VizStyleException.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleException.java @@ -18,55 +18,54 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style; - -import com.raytheon.uf.viz.core.exception.VizException; +package com.raytheon.uf.common.style; /** - * VizException for styles. + * Exception for styles. * *
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Oct 1, 2007             njensen     Initial creation
- * 
+ * Sep 5, 2013  2051       mnash       Moved style rules to common and made 
+ *                                     this extend Exception instead of VizException
  * 
* * @author njensen */ -public class VizStyleException extends VizException { +public class StyleException extends Exception { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * Default Constructor - * - */ - public VizStyleException() { - super(); - } + /** + * Default Constructor + * + */ + public StyleException() { + super(); + } - /** - * @param message - */ - public VizStyleException(String message) { - super(message); - } + /** + * @param message + */ + public StyleException(String message) { + super(message); + } - /** - * @param message - * @param cause - */ - public VizStyleException(String message, Throwable cause) { - super(message, cause); - } + /** + * @param message + * @param cause + */ + public StyleException(String message, Throwable cause) { + super(message, cause); + } - /** - * @param cause - */ - public VizStyleException(Throwable cause) { - super(cause); - } + /** + * @param cause + */ + public StyleException(Throwable cause) { + super(cause); + } } diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/StyleManager.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleManager.java similarity index 77% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/StyleManager.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleManager.java index fffc05d083..ffdaf4df01 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/StyleManager.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleManager.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style; +package com.raytheon.uf.common.style; import java.util.EnumMap; import java.util.List; @@ -86,8 +86,8 @@ public class StyleManager { "styleRules", aType.extensions, true, true); StyleRuleset rules = new StyleRuleset(); for (LocalizationFile lf : files) { - rules.addStyleRules((StyleRuleset) SerializationUtil - .jaxbUnmarshalFromXmlFile(lf.getFile().getPath())); + rules.addStyleRules(SerializationUtil.jaxbUnmarshalFromXmlFile( + StyleRuleset.class, lf.getFile().getPath())); } this.rules.put(aType, rules); } catch (Exception e) { @@ -104,30 +104,33 @@ public class StyleManager { * @param aCriteria * the match criteria to find the best match for * @return the best matching style rule, or null if no matches are found - * @throws VizStyleException + * @throws StyleException */ public StyleRule getStyleRule(StyleType aStyleType, MatchCriteria aCriteria) - throws VizStyleException { + throws StyleException { synchronized (aStyleType) { if (!this.rules.containsKey(aStyleType)) { loadRules(aStyleType); } } - List rules = this.rules.get(aStyleType).getStyleRules(); + StyleRuleset set = this.rules.get(aStyleType); StyleRule bestMatch = null; - int matchRank = 0; - try { - for (StyleRule rule : rules) { - int value = aCriteria.matches(rule.getMatchCriteria()); - if (value > matchRank) { - matchRank = value; - bestMatch = rule; + if (set != null) { + List rules = this.rules.get(aStyleType).getStyleRules(); + int matchRank = 0; + try { + for (StyleRule rule : rules) { + int value = aCriteria.matches(rule.getMatchCriteria()); + if (value > matchRank) { + matchRank = value; + bestMatch = rule; + } } + } catch (Exception e) { + throw new StyleException( + "Error determining matching rules.", e); } - } catch (Exception e) { - throw new VizStyleException("Error determining matching rules.", e); } - return bestMatch; } @@ -149,24 +152,24 @@ public class StyleManager { return new double[] { vmin, vmax }; } - - /**2012-05-21 - * DR 14833: FFMP uses this getter to find the color - * map if a user modified ffmpImageryStlyeRules.xml - * incorrectly. - * - * @param st: StyleType - * @return: StyleRuleset related to the StyleType + + /** + * 2012-05-21 DR 14833: FFMP uses this getter to find the color map if a + * user modified ffmpImageryStlyeRules.xml incorrectly. + * + * @param st + * : StyleType + * @return: StyleRuleset related to the StyleType */ - public StyleRuleset getStyleRuleSet(StyleType st){ - - synchronized(st){ - - if( ! rules.containsKey(st)){ - loadRules(st); - } - } - - return rules.get(st); + public StyleRuleset getStyleRuleSet(StyleType st) { + + synchronized (st) { + + if (!rules.containsKey(st)) { + loadRules(st); + } + } + + return rules.get(st); } } diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/StyleRule.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleRule.java similarity index 98% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/StyleRule.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleRule.java index 11617c0da9..98c8c97bf2 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/StyleRule.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleRule.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style; +package com.raytheon.uf.common.style; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/StyleRuleset.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleRuleset.java similarity index 98% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/StyleRuleset.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleRuleset.java index 362a376054..3c80b0bb4c 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/StyleRuleset.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/StyleRuleset.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style; +package com.raytheon.uf.common.style; import java.util.ArrayList; diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/arrow/ArrowPreferences.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/arrow/ArrowPreferences.java similarity index 95% rename from cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/arrow/ArrowPreferences.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/arrow/ArrowPreferences.java index 922182375f..69c436e333 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/arrow/ArrowPreferences.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/arrow/ArrowPreferences.java @@ -17,14 +17,14 @@ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for * further licensing information. **/ -package com.raytheon.viz.core.style.arrow; +package com.raytheon.uf.common.style.arrow; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import com.raytheon.uf.viz.core.style.AbstractStylePreferences; +import com.raytheon.uf.common.style.AbstractStylePreferences; @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement(name = "arrowStyle") diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/contour/ContourPreferences.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/contour/ContourPreferences.java similarity index 97% rename from cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/contour/ContourPreferences.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/contour/ContourPreferences.java index 9995b5a65c..b4a3fb82a4 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/contour/ContourPreferences.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/contour/ContourPreferences.java @@ -18,15 +18,15 @@ * further licensing information. **/ -package com.raytheon.viz.core.style.contour; +package com.raytheon.uf.common.style.contour; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import com.raytheon.uf.viz.core.style.AbstractStylePreferences; -import com.raytheon.uf.viz.core.style.LabelingPreferences; +import com.raytheon.uf.common.style.AbstractStylePreferences; +import com.raytheon.uf.common.style.LabelingPreferences; /** * diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/graph/AxisScale.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/graph/AxisScale.java similarity index 98% rename from cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/graph/AxisScale.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/graph/AxisScale.java index 9809dd07c0..3bbd4407cd 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/graph/AxisScale.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/graph/AxisScale.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.viz.core.style.graph; +package com.raytheon.uf.common.style.graph; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/graph/GraphPreferences.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/graph/GraphPreferences.java similarity index 93% rename from cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/graph/GraphPreferences.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/graph/GraphPreferences.java index 853132b2eb..7f926a6e54 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/graph/GraphPreferences.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/graph/GraphPreferences.java @@ -18,15 +18,15 @@ * further licensing information. **/ -package com.raytheon.viz.core.style.graph; +package com.raytheon.uf.common.style.graph; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import com.raytheon.uf.viz.core.style.AbstractStylePreferences; -import com.raytheon.uf.viz.core.style.LabelingPreferences; +import com.raytheon.uf.common.style.AbstractStylePreferences; +import com.raytheon.uf.common.style.LabelingPreferences; /** * TODO class description diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/image/DataScale.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/image/DataScale.java similarity index 98% rename from cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/image/DataScale.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/image/DataScale.java index 93e752023c..ad02e39d8f 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/image/DataScale.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/image/DataScale.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.viz.core.style.image; +package com.raytheon.uf.common.style.image; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/image/ImagePreferences.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/image/ImagePreferences.java similarity index 94% rename from cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/image/ImagePreferences.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/image/ImagePreferences.java index fac868b0ac..e7c2cf1ed5 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/image/ImagePreferences.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/image/ImagePreferences.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.viz.core.style.image; +package com.raytheon.uf.common.style.image; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -26,8 +26,8 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences; -import com.raytheon.uf.viz.core.style.AbstractStylePreferences; -import com.raytheon.uf.viz.core.style.LabelingPreferences; +import com.raytheon.uf.common.style.AbstractStylePreferences; +import com.raytheon.uf.common.style.LabelingPreferences; /** * @@ -58,7 +58,7 @@ public class ImagePreferences extends AbstractStylePreferences { @XmlElement(name = "displayLegend") private String legend; - + @XmlElement private SamplePreferences samplePrefs; @@ -146,12 +146,12 @@ public class ImagePreferences extends AbstractStylePreferences { public void setSamplePrefs(SamplePreferences samplePrefs) { this.samplePrefs = samplePrefs; } - + /** - * @return the legend + * @return the legend */ public String getLegend() { return legend; } - + } diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/image/SamplePreferences.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/image/SamplePreferences.java similarity index 98% rename from cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/image/SamplePreferences.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/image/SamplePreferences.java index 6eee672f8d..247950f255 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/style/image/SamplePreferences.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/image/SamplePreferences.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.viz.core.style.image; +package com.raytheon.uf.common.style.image; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/level/Level.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/level/Level.java similarity index 99% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/level/Level.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/level/Level.java index 96a64305e9..1006f177d8 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/level/Level.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/level/Level.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style.level; +package com.raytheon.uf.common.style.level; import javax.measure.unit.NonSI; import javax.measure.unit.SI; diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/level/RangeLevel.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/level/RangeLevel.java similarity index 98% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/level/RangeLevel.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/level/RangeLevel.java index 97dbdb3b2d..74f8c6af76 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/level/RangeLevel.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/level/RangeLevel.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style.level; +package com.raytheon.uf.common.style.level; import javax.measure.Measure; import javax.xml.bind.annotation.XmlAccessType; diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/level/SingleLevel.java b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/level/SingleLevel.java similarity index 98% rename from cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/level/SingleLevel.java rename to edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/level/SingleLevel.java index 88b8d14c89..1b7f6fca41 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/style/level/SingleLevel.java +++ b/edexOsgi/com.raytheon.uf.common.style/src/com/raytheon/uf/common/style/level/SingleLevel.java @@ -18,7 +18,7 @@ * further licensing information. **/ -package com.raytheon.uf.viz.core.style.level; +package com.raytheon.uf.common.style.level; import javax.measure.Measure; import javax.xml.bind.annotation.XmlAccessType; diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.mosaic/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.rsc.mosaic/META-INF/MANIFEST.MF index 44ddd07d47..fd67a3d380 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.mosaic/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.mosaic/META-INF/MANIFEST.MF @@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", com.raytheon.viz.radar, gov.noaa.nws.ncep.viz.localization, - com.raytheon.uf.common.units;bundle-version="1.0.0" + com.raytheon.uf.common.units;bundle-version="1.0.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: com.raytheon.uf.common.dataplugin, diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.mosaic/src/gov/noaa/nws/ncep/viz/rsc/mosaic/rsc/MosaicResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.mosaic/src/gov/noaa/nws/ncep/viz/rsc/mosaic/rsc/MosaicResource.java index 35a1ec98ae..6e393d90ee 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.mosaic/src/gov/noaa/nws/ncep/viz/rsc/mosaic/rsc/MosaicResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.mosaic/src/gov/noaa/nws/ncep/viz/rsc/mosaic/rsc/MosaicResource.java @@ -7,7 +7,6 @@ import gov.noaa.nws.ncep.viz.common.ui.NmapCommon; import gov.noaa.nws.ncep.viz.resources.AbstractNatlCntrsResource; import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarResource; import gov.noaa.nws.ncep.viz.resources.colorBar.ColorBarResourceData; -import gov.noaa.nws.ncep.viz.rsc.mosaic.Activator; import gov.noaa.nws.ncep.viz.ui.display.ColorBarFromColormap; import gov.noaa.nws.ncep.viz.ui.display.NCMapDescriptor; @@ -41,6 +40,8 @@ import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.image.ImagePreferences; +import com.raytheon.uf.common.style.image.SamplePreferences; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.units.PiecewisePixel; import com.raytheon.uf.viz.core.HDF5Util; @@ -48,23 +49,17 @@ import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.map.MapDescriptor; -import com.raytheon.uf.viz.core.rsc.GenericResourceData; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceProperties; -import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability; -import com.raytheon.uf.viz.core.status.StatusConstants; import com.raytheon.viz.core.rsc.hdf5.AbstractTileSet; -import com.raytheon.viz.core.style.image.ImagePreferences; -import com.raytheon.viz.core.style.image.SamplePreferences; import com.vividsolutions.jts.geom.Coordinate; /** - * Provide Radar Mosaic raster rendering support + * Provide Radar Mosaic raster rendering support * *
  * 
@@ -83,637 +78,664 @@ import com.vividsolutions.jts.geom.Coordinate;
  *  06/21/2012     #825	      Greg Hull   rm mosaicInfo.txt; get legend info from the Record.
  *  07/18/12       717        Archana     Refactored a field used to align the label data
  * 12/19/2012     #960        Greg Hull   override propertiesChanged() to update colorBar.
- *        
+ * 
  * 
* * @author mli * @version 1 */ -public class MosaicResource extends AbstractNatlCntrsResource implements - IResourceDataChanged { +public class MosaicResource extends + AbstractNatlCntrsResource + implements IResourceDataChanged { - private static final IUFStatusHandler statusHandler = UFStatus.getHandler(MosaicResource.class, "Mosaic"); - - MosaicResourceData radarRscData; - - protected String baseFileName; + private static final IUFStatusHandler statusHandler = UFStatus.getHandler( + MosaicResource.class, "Mosaic"); - protected IGraphicsTarget grphTarget; - - protected int numLevels; + MosaicResourceData radarRscData; + + protected String baseFileName; + + protected IGraphicsTarget grphTarget; + + protected int numLevels; protected String viewType; - /** The line color */ - private static final RGB DEFAULT_COLOR = new RGB(255, 255, 255); + /** The line color */ + private static final RGB DEFAULT_COLOR = new RGB(255, 255, 255); + + protected RadarTileSet baseTile; - protected RadarTileSet baseTile; - private ColorMapParameters colorMapParameters = null; - + protected ColorBarResource cbarResource; - protected ResourcePair cbarRscPair; + protected ResourcePair cbarRscPair; - protected class FrameData extends AbstractFrameData { + protected class FrameData extends AbstractFrameData { - RadarTileSet tileSet; - DataTime tileTime; // the time of the data used to create the tileset - // used to determine if we need to replace the tile - // with a better timematch. - public int prodCode; - public String prodName; - public String unitName; - public int numLevels; - public String legendStr=""; + RadarTileSet tileSet; - - protected FrameData(DataTime time, int interval) { - super(time, interval); - tileTime = null; - } + DataTime tileTime; // the time of the data used to create the tileset + // used to determine if we need to replace the tile + // with a better timematch. - public boolean updateFrameData( IRscDataObject rscDataObj ) { - PluginDataObject pdo = ((DfltRecordRscDataObj)rscDataObj).getPDO(); - MosaicRecord radarRecord = (MosaicRecord) pdo; + public int prodCode; - prodCode = radarRecord.getProductCode(); - prodName = radarRecord.getProdName(); - numLevels = radarRecord.getNumLevels(); - unitName = radarRecord.getUnit(); - legendStr = createLegend( prodCode, prodName, numLevels, unitName ); - - synchronized (this) { - try { - if (!(pdo instanceof MosaicRecord)) { - statusHandler.handle(Priority.PROBLEM,"" - + this.getClass().getName() + " expected : " - + MosaicRecord.class.getName() + " Got: " + pdo); - return false; - } + public String prodName; - if( radarRscData.getProductCode().intValue() != prodCode ) { - System.out.println("??? radar product code in data Record doesn't match"+ - " the requested product code???"); - radarRscData.setProductCode( radarRecord.getProductCode() ); - } - - if (baseTile == null) { - try { - setColorMapParameters(radarRecord); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (StorageException e) { - e.printStackTrace(); - } catch (VizException e) { - e.printStackTrace(); - } - } + public String unitName; - - if( baseTile == null ) { - tileSet = baseTile = createTile(radarRecord, false); - tileTime = radarRecord.getDataTime(); - } - else { // if the tileset is already set, and the new record is - // is not a better match then return - if( tileSet != null && tileTime != null ) { - if( timeMatch(radarRecord.getDataTime()) >= timeMatch(tileTime) ) { - return false; - } - else { // if this is a better match, we need to create a new tile. - if( tileSet == baseTile ) { - tileSet = null; - } - else { - tileSet.dispose(); - tileSet = null; - } - } - } + public int numLevels; - tileSet = createTile(radarRecord, true); - tileTime = radarRecord.getDataTime(); - } - - if( grphTarget != null ) { - tileSet.init(grphTarget); - } - - Collections.sort(MosaicResource.this.dataTimes); - } - catch( VizException e ) { - System.out.println("Error processing MosaicRecord. " + e.getMessage() ); - return false; - } - } - return true; - } - - public void dispose() { - if( tileSet != baseTile && tileSet != null ) { - tileSet.dispose(); - tileSet = null; - } - } - } + public String legendStr = ""; + protected FrameData(DataTime time, int interval) { + super(time, interval); + tileTime = null; + } - public MosaicResource(MosaicResourceData rrd, LoadProperties loadProps) - throws VizException { - super(rrd, loadProps); - rrd.addChangeListener(this); + public boolean updateFrameData(IRscDataObject rscDataObj) { + PluginDataObject pdo = ((DfltRecordRscDataObj) rscDataObj).getPDO(); + MosaicRecord radarRecord = (MosaicRecord) pdo; - this.radarRscData = rrd; - - grphTarget = null; - this.dataTimes = new ArrayList(); -// this.productCode = 0; + prodCode = radarRecord.getProductCode(); + prodName = radarRecord.getProdName(); + numLevels = radarRecord.getNumLevels(); + unitName = radarRecord.getUnit(); + legendStr = createLegend(prodCode, prodName, numLevels, unitName); - if (this.getCapability(ColorableCapability.class).getColor() == null) { - this.getCapability(ColorableCapability.class).setColor( - DEFAULT_COLOR); - } - } + synchronized (this) { + try { + if (!(pdo instanceof MosaicRecord)) { + statusHandler + .handle(Priority.PROBLEM, + "" + this.getClass().getName() + + " expected : " + + MosaicRecord.class.getName() + + " Got: " + pdo); + return false; + } - - @Override - protected AbstractFrameData createNewFrame( DataTime frameTime, int frameInterval) { - return new FrameData( frameTime, frameInterval ); - } - - private String createLegend( int prodCode, String prodName, - int numLevels, String unitName) { - if( unitName == null ) { - unitName = " "; - } else { - if (!unitName.contains("(")) { - String temp = " ("; - temp += unitName + ") "; - unitName = temp; - } - if (unitName.contains("/10")) { - unitName = unitName.replace("/10", ""); - } - if (unitName.contains("*1000")) { - unitName = unitName.replace("*1000", ""); - } - } + if (radarRscData.getProductCode().intValue() != prodCode) { + System.out + .println("??? radar product code in data Record doesn't match" + + " the requested product code???"); + radarRscData.setProductCode(radarRecord + .getProductCode()); + } - String legendString = new String( prodName + unitName - + (int) (Math.log( numLevels) / Math.log(2)) + "-bit " ); - return legendString; - } - - @Override - public String getName() { + if (baseTile == null) { + try { + setColorMapParameters(radarRecord); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (StorageException e) { + e.printStackTrace(); + } catch (VizException e) { + e.printStackTrace(); + } + } - FrameData fd = (FrameData)getCurrentFrame(); + if (baseTile == null) { + tileSet = baseTile = createTile(radarRecord, false); + tileTime = radarRecord.getDataTime(); + } else { // if the tileset is already set, and the new + // record is + // is not a better match then return + if (tileSet != null && tileTime != null) { + if (timeMatch(radarRecord.getDataTime()) >= timeMatch(tileTime)) { + return false; + } else { // if this is a better match, we need to + // create a new tile. + if (tileSet == baseTile) { + tileSet = null; + } else { + tileSet.dispose(); + tileSet = null; + } + } + } - if( fd == null ) { - return "Natl Mosaic-No Data"; - } - else if( fd.tileTime == null || - fd.tileSet.getMapDescriptor().getFrameCount() == 0) { - - return fd.legendStr + "-No Data"; - } - else { - return fd.legendStr + NmapCommon.getTimeStringFromDataTime( fd.tileTime, "/"); - } - } - - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.core.rsc.IVizResource#dispose() - */ - @Override - public void disposeInternal() { - super.disposeInternal(); + tileSet = createTile(radarRecord, true); + tileTime = radarRecord.getDataTime(); + } - getDescriptor().getResourceList().remove( cbarRscPair ); - } + if (grphTarget != null) { + tileSet.init(grphTarget); + } - /* - * (non-Javadoc) - * - * @seecom.raytheon.viz.core.rsc.IVizResource#init(com.raytheon.viz.core. - * IGraphicsTarget) - */ - public void initResource(IGraphicsTarget target) throws VizException { - synchronized (this) { - this.viewType = target.getViewType(); + Collections.sort(MosaicResource.this.dataTimes); + } catch (VizException e) { + System.out.println("Error processing MosaicRecord. " + + e.getMessage()); + return false; + } + } + return true; + } + + public void dispose() { + if (tileSet != baseTile && tileSet != null) { + tileSet.dispose(); + tileSet = null; + } + } + } + + public MosaicResource(MosaicResourceData rrd, LoadProperties loadProps) + throws VizException { + super(rrd, loadProps); + rrd.addChangeListener(this); + + this.radarRscData = rrd; + + grphTarget = null; + this.dataTimes = new ArrayList(); + // this.productCode = 0; + + if (this.getCapability(ColorableCapability.class).getColor() == null) { + this.getCapability(ColorableCapability.class).setColor( + DEFAULT_COLOR); + } + } + + @Override + protected AbstractFrameData createNewFrame(DataTime frameTime, + int frameInterval) { + return new FrameData(frameTime, frameInterval); + } + + private String createLegend(int prodCode, String prodName, int numLevels, + String unitName) { + if (unitName == null) { + unitName = " "; + } else { + if (!unitName.contains("(")) { + String temp = " ("; + temp += unitName + ") "; + unitName = temp; + } + if (unitName.contains("/10")) { + unitName = unitName.replace("/10", ""); + } + if (unitName.contains("*1000")) { + unitName = unitName.replace("*1000", ""); + } + } + + String legendString = new String(prodName + unitName + + (int) (Math.log(numLevels) / Math.log(2)) + "-bit "); + return legendString; + } + + @Override + public String getName() { + + FrameData fd = (FrameData) getCurrentFrame(); + + if (fd == null) { + return "Natl Mosaic-No Data"; + } else if (fd.tileTime == null + || fd.tileSet.getMapDescriptor().getFrameCount() == 0) { + + return fd.legendStr + "-No Data"; + } else { + return fd.legendStr + + NmapCommon.getTimeStringFromDataTime(fd.tileTime, "/"); + } + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.core.rsc.IVizResource#dispose() + */ + @Override + public void disposeInternal() { + super.disposeInternal(); + + getDescriptor().getResourceList().remove(cbarRscPair); + } + + /* + * (non-Javadoc) + * + * @seecom.raytheon.viz.core.rsc.IVizResource#init(com.raytheon.viz.core. + * IGraphicsTarget) + */ + public void initResource(IGraphicsTarget target) throws VizException { + synchronized (this) { + this.viewType = target.getViewType(); this.grphTarget = target; - - // create the colorBar Resource and add it to the resourceList for this descriptor. - cbarRscPair = ResourcePair.constructSystemResourcePair( - new ColorBarResourceData( radarRscData.getColorBar() ) ); - - getDescriptor().getResourceList().add( cbarRscPair ); - getDescriptor().getResourceList().instantiateResources( getDescriptor(), true ); + + // create the colorBar Resource and add it to the resourceList for + // this descriptor. + cbarRscPair = ResourcePair + .constructSystemResourcePair(new ColorBarResourceData( + radarRscData.getColorBar())); + + getDescriptor().getResourceList().add(cbarRscPair); + getDescriptor().getResourceList().instantiateResources( + getDescriptor(), true); cbarResource = (ColorBarResource) cbarRscPair.getResource(); -// cbarResource.setColorBar( radarRscData.getColorBar() ); - getCapability(ImagingCapability.class).setSuppressingMenuItems(true); - getCapability(ColorMapCapability.class).setSuppressingMenuItems(true); - getCapability(ColorableCapability.class).setSuppressingMenuItems(true); + // cbarResource.setColorBar( radarRscData.getColorBar() ); + getCapability(ImagingCapability.class) + .setSuppressingMenuItems(true); + getCapability(ColorMapCapability.class).setSuppressingMenuItems( + true); + getCapability(ColorableCapability.class).setSuppressingMenuItems( + true); queryRecords(); - if (this.baseTile != null) { + if (this.baseTile != null) { this.baseTile.init(target); } - - for( AbstractFrameData frm : frameDataMap.values() ) { - AbstractTileSet ts = ((FrameData)frm).tileSet; - if( ts != null ) - ts.init(target); + + for (AbstractFrameData frm : frameDataMap.values()) { + AbstractTileSet ts = ((FrameData) frm).tileSet; + if (ts != null) + ts.init(target); } - - } - } - /* - * (non-Javadoc) - * - * @seecom.raytheon.viz.core.rsc.IVizResource#paint(com.raytheon.viz.core. - * IGraphicsTarget, com.raytheon.viz.core.PixelExtent, double, float) - */ - //@Override - public void paintFrame( AbstractFrameData frmData, IGraphicsTarget target, PaintProperties paintProps) - throws VizException { - if (paintProps == null || paintProps.getDataTime() == null) { - return; - } + } + } - FrameData currFrame = (FrameData) frmData; - RadarTileSet tileSet = currFrame.tileSet; + /* + * (non-Javadoc) + * + * @seecom.raytheon.viz.core.rsc.IVizResource#paint(com.raytheon.viz.core. + * IGraphicsTarget, com.raytheon.viz.core.PixelExtent, double, float) + */ + // @Override + public void paintFrame(AbstractFrameData frmData, IGraphicsTarget target, + PaintProperties paintProps) throws VizException { + if (paintProps == null || paintProps.getDataTime() == null) { + return; + } - try { - if (tileSet != null) { - ImagingCapability imgCap = new ImagingCapability(); - imgCap.setBrightness(radarRscData.getBrightness()); - imgCap.setContrast(radarRscData.getContrast()); - imgCap.setAlpha(radarRscData.getAlpha()); - paintProps.setAlpha(radarRscData.getAlpha()); - radarRscData.fireChangeListeners(ChangeType.CAPABILITY, imgCap); - colorMapParameters = getCapability(ColorMapCapability.class) - .getColorMapParameters(); - //TODO: Suggest making the following more resilient to errors -- handle case where - // "params" is null, which does occur if colormap file was not found. - if (colorMapParameters.getColorMap() == null) { - throw new VizException("ColorMap not specified"); - } + FrameData currFrame = (FrameData) frmData; + RadarTileSet tileSet = currFrame.tileSet; - tileSet.paint(target, paintProps); - } - - } catch (Exception e) { - String msg = e.getMessage(); - if (msg == null) { - msg = "Error rendering radar mosaic"; - } - throw new VizException(msg, e); - } + try { + if (tileSet != null) { + ImagingCapability imgCap = new ImagingCapability(); + imgCap.setBrightness(radarRscData.getBrightness()); + imgCap.setContrast(radarRscData.getContrast()); + imgCap.setAlpha(radarRscData.getAlpha()); + paintProps.setAlpha(radarRscData.getAlpha()); + radarRscData.fireChangeListeners(ChangeType.CAPABILITY, imgCap); + colorMapParameters = getCapability(ColorMapCapability.class) + .getColorMapParameters(); + // TODO: Suggest making the following more resilient to errors + // -- handle case where + // "params" is null, which does occur if colormap file was not + // found. + if (colorMapParameters.getColorMap() == null) { + throw new VizException("ColorMap not specified"); + } - } + tileSet.paint(target, paintProps); + } - @SuppressWarnings("unchecked") - private void setColorMapParameters(MosaicRecord radarRecord) throws FileNotFoundException, StorageException, VizException { - - File loc = HDF5Util.findHDF5Location(radarRecord); + } catch (Exception e) { + String msg = e.getMessage(); + if (msg == null) { + msg = "Error rendering radar mosaic"; + } + throw new VizException(msg, e); + } - IDataStore dataStore = DataStoreFactory.getDataStore(loc); + } - radarRecord.retrieveFromDataStore(dataStore); + @SuppressWarnings("unchecked") + private void setColorMapParameters(MosaicRecord radarRecord) + throws FileNotFoundException, StorageException, VizException { - Unit dataUnit = null; - if (radarRecord.getUnit() != null) { - try { - dataUnit = UnitFormat.getUCUMInstance().parseProductUnit( - radarRecord.getUnit(), new ParsePosition(0)); - } catch (ParseException e) { - throw new VizException("Unable to parse units ", e); - } - } else { - dataUnit = Unit.ONE; - } - int numLevels = radarRecord.getNumLevels(); - Object[] thresholds = radarRecord.getDecodedThresholds(); - DataMappingPreferences dmPref = new DataMappingPreferences(); - DataMappingEntry dmEntry; - List dmEntriesList = new ArrayList(0); - if (numLevels <= 16) { + File loc = HDF5Util.findHDF5Location(radarRecord); - ArrayList pixel = new ArrayList(); - ArrayList real = new ArrayList(); - for (int i = 0; i < numLevels; i++) { - dmEntry = new DataMappingEntry(); - dmEntry.setPixelValue(new Double(i)); - if (thresholds[i] instanceof Float) { - pixel.add(i); - real.add((Float) thresholds[i]); - dmEntry.setDisplayValue(((Float)thresholds[i]).doubleValue()); - dmEntry.setLabel(((Float)thresholds[i]).toString()); - }else{ - dmEntry.setDisplayValue(Double.NaN); - - if ( ((String)thresholds[i]).compareToIgnoreCase("NO DATA") == 0 ){ - dmEntry.setLabel("ND"); - }else - dmEntry.setLabel((String)thresholds[i]); - } - - dmEntriesList.add(dmEntry); + IDataStore dataStore = DataStoreFactory.getDataStore(loc); - } + radarRecord.retrieveFromDataStore(dataStore); - double[] pix = new double[pixel.size()]; - int i = 0; - for (Integer p : pixel) { - pix[i++] = p; - } + Unit dataUnit = null; + if (radarRecord.getUnit() != null) { + try { + dataUnit = UnitFormat.getUCUMInstance().parseProductUnit( + radarRecord.getUnit(), new ParsePosition(0)); + } catch (ParseException e) { + throw new VizException("Unable to parse units ", e); + } + } else { + dataUnit = Unit.ONE; + } + int numLevels = radarRecord.getNumLevels(); + Object[] thresholds = radarRecord.getDecodedThresholds(); + DataMappingPreferences dmPref = new DataMappingPreferences(); + DataMappingEntry dmEntry; + List dmEntriesList = new ArrayList( + 0); + if (numLevels <= 16) { - double[] std = new double[real.size()]; - i = 0; - for (Float r : real) { - std[i++] = r; - } + ArrayList pixel = new ArrayList(); + ArrayList real = new ArrayList(); + for (int i = 0; i < numLevels; i++) { + dmEntry = new DataMappingEntry(); + dmEntry.setPixelValue(new Double(i)); + if (thresholds[i] instanceof Float) { + pixel.add(i); + real.add((Float) thresholds[i]); + dmEntry.setDisplayValue(((Float) thresholds[i]) + .doubleValue()); + dmEntry.setLabel(((Float) thresholds[i]).toString()); + } else { + dmEntry.setDisplayValue(Double.NaN); - dataUnit = new PiecewisePixel(dataUnit, pix, std); - } else { - double offset = radarRecord.getThreshold(0); - double scale = radarRecord.getThreshold(1); - offset -= 2 * scale; - double[] pix = { 2, 255 }; - double[] data = { 2 * scale + offset, 255 * scale + offset }; - dataUnit = new PiecewisePixel(dataUnit, pix, data); - } + if (((String) thresholds[i]).compareToIgnoreCase("NO DATA") == 0) { + dmEntry.setLabel("ND"); + } else + dmEntry.setLabel((String) thresholds[i]); + } - ColorMap colorMap; - try { - colorMap = (ColorMap) ColorMapUtil.loadColorMap( - radarRscData.getResourceName().getRscCategory().getCategoryName(), - radarRscData.getColorMapName() ); - } catch (VizException e) { - throw new VizException("Error loading colormap: "+ radarRscData.getColorMapName() ); - } + dmEntriesList.add(dmEntry); + } - colorMapParameters = new ColorMapParameters(); - if (colorMapParameters.getDisplayUnit() == null) { - colorMapParameters.setDisplayUnit(dataUnit); - - } - - colorMapParameters.setColorMap( colorMap ); - colorMapParameters.setColorMapMax(255); - colorMapParameters.setColorMapMin(0); - colorMapParameters.setDataMax(255); - colorMapParameters.setDataMin(0); - getCapability(ColorMapCapability.class).setColorMapParameters( - colorMapParameters); - if( dmEntriesList.size() > 0 ){ - DataMappingEntry[] dmEntryArray = new DataMappingEntry[dmEntriesList.size()]; - dmEntriesList.toArray(dmEntryArray); - dmPref.setSerializableEntries(dmEntryArray); - ImagePreferences imgPref = new ImagePreferences(); - imgPref.setDataMapping(dmPref); - SamplePreferences sampPref = new SamplePreferences(); - sampPref.setMinValue(0); - sampPref.setMaxValue(255); - imgPref.setSamplePrefs(sampPref); - ColorBarFromColormap cBar = (ColorBarFromColormap)this.cbarResource.getResourceData().getColorbar(); - if(cBar != null ){ - cBar.setImagePreferences(imgPref); - - if(!cBar.isScalingAttemptedForThisColorMap()) - cBar.scalePixelValues(); + double[] pix = new double[pixel.size()]; + int i = 0; + for (Integer p : pixel) { + pix[i++] = p; + } - if(radarRecord.getUnit().compareToIgnoreCase("in") == 0 ){ - cBar.setDisplayUnitStr("INCHES"); - }else{ - cBar.setDisplayUnitStr(radarRecord.getUnit()); - } - - cBar.setAlignLabelInTheMiddleOfInterval(true); - cBar.setColorMap(colorMap); - - this.radarRscData.setColorBar(cBar); - } + double[] std = new double[real.size()]; + i = 0; + for (Float r : real) { + std[i++] = r; + } - } + dataUnit = new PiecewisePixel(dataUnit, pix, std); + } else { + double offset = radarRecord.getThreshold(0); + double scale = radarRecord.getThreshold(1); + offset -= 2 * scale; + double[] pix = { 2, 255 }; + double[] data = { 2 * scale + offset, 255 * scale + offset }; + dataUnit = new PiecewisePixel(dataUnit, pix, data); + } - } - - - - private RadarTileSet createTile(MosaicRecord radarRecord, boolean hasBasetile) throws VizException { - File loc = HDF5Util.findHDF5Location(radarRecord); + ColorMap colorMap; + try { + colorMap = (ColorMap) ColorMapUtil.loadColorMap(radarRscData + .getResourceName().getRscCategory().getCategoryName(), + radarRscData.getColorMapName()); + } catch (VizException e) { + throw new VizException("Error loading colormap: " + + radarRscData.getColorMapName()); + } - IDataStore dataStore = DataStoreFactory.getDataStore(loc); - - try { - radarRecord.retrieveFromDataStore(dataStore); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (StorageException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - RadarTileSet tileSet = null; - - int numLevels = radarRecord.getNumLevels(); - UnitConverter dataToImage = null; - if (numLevels <= 16) { - dataToImage = new MultiplyConverter(16); - } else { - dataToImage = colorMapParameters.getDataToImageConverter(); - } - - MosaicTiler tiler = new MosaicTiler(radarRecord, 1, radarRecord.getNx(), dataToImage); - - if (hasBasetile) { - tileSet = new RadarTileSet(tiler, baseTile, this, - grphTarget.getViewType()); - } else { - tileSet = new RadarTileSet(tiler, this, grphTarget.getViewType()); - } - - if( grphTarget != null ) - tileSet.setMapDescriptor(this.getNcMapDescriptor()); - - return tileSet; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.core.rsc.capabilities.IInspectableResource#inspect(com - * .vividsolutions.jts.geom.Coordinate) - */ - @Override - public String inspect(ReferencedCoordinate latLon) throws VizException { - - Map dataMap; - try { - dataMap = interrogate(latLon.asLatLon()); - } catch (Exception e) { - throw new VizException("Error converting coordinate for hover", e); - } - - if (dataMap == null) { - return "NO DATA"; - } - - StringBuffer displayedData = new StringBuffer(); - //displayedData.append(dataMap.get("ICAO") + " "); - - displayedData.append(dataMap.get("Value")); - - if (dataMap.containsKey("Shear")) { - displayedData.append(" " + dataMap.get("Shear")); - } - - if (dataMap.containsKey("Azimuth")) { - displayedData.append(" " + dataMap.get("MSL") + "MSL"); - displayedData.append(" " + dataMap.get("AGL") + "AGL"); - displayedData.append(" " + dataMap.get("Range")); - displayedData.append("@" + dataMap.get("Azimuth")); - } - - return displayedData.toString(); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.rsc.AbstractVizResource#interrogate(com.raytheon - * .uf.viz.core.geospatial.ReferencedCoordinate) - */ - @Override - public Map interrogate(ReferencedCoordinate coord) - throws VizException { - Map smap; - try { - smap = this.interrogate(coord.asLatLon()); - } catch (Exception e) { - throw new VizException("Error transforming", e); - } - Map rmap = new HashMap(); - - if( smap == null ) - return rmap; - - for (String smapKey : smap.keySet()) { - String value = smap.get(smapKey); - rmap.put(smapKey, value); - } - return rmap; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.core.rsc.capabilities.IInspectableResource#interrogate - * (com.vividsolutions.jts.geom.Coordinate) - */ - public Map interrogate(Coordinate latLon) - throws VizException { - return null; - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.core.rsc.capabilities.IProjectableResource#project(org - * .opengis.referencing.crs.CoordinateReferenceSystem) - */ - @Override - public void project(CoordinateReferenceSystem mapData) throws VizException { - - if (this.baseTile != null) - this.baseTile.reproject(); - - for( AbstractFrameData frm : frameDataMap.values() ) { - AbstractTileSet ts = ((FrameData)frm).tileSet; - if( ts != null ) - ts.reproject(); - else - System.out.println("ERROR reproject tiles"); - } - } - - - @Override - public void resourceChanged(ChangeType type, Object object) { - if ( type != null && type == ChangeType.CAPABILITY ){ - if (object instanceof ImagingCapability ){ - ImagingCapability imgCap = getCapability(ImagingCapability.class); - ImagingCapability newImgCap = ( ImagingCapability ) object; - imgCap.setBrightness(newImgCap.getBrightness(), false); - imgCap.setContrast(newImgCap.getContrast(), false); - imgCap.setAlpha(newImgCap.getAlpha(), false); - radarRscData.setAlpha( imgCap.getAlpha() ); - radarRscData.setBrightness( imgCap.getBrightness() ); - radarRscData.setContrast( imgCap.getContrast() ); - issueRefresh(); - - - } - else if (object instanceof ColorMapCapability ){ - - ColorMapCapability colorMapCap = getCapability(ColorMapCapability.class); - ColorMapCapability newColorMapCap = (ColorMapCapability) object; - colorMapCap.setColorMapParameters(newColorMapCap.getColorMapParameters(), false); - ColorMap theColorMap = ( ColorMap ) colorMapCap.getColorMapParameters().getColorMap(); - String colorMapName = colorMapCap.getColorMapParameters().getColorMapName(); - radarRscData.setColorMapName( colorMapName ); - radarRscData.getRscAttrSet().setAttrValue( "colorMapName", colorMapName ); - ColorBarFromColormap cBar = radarRscData.getColorBar(); - cBar.setColorMap( theColorMap ); - radarRscData.getRscAttrSet().setAttrValue( "colorBar", cBar ); - radarRscData.setIsEdited( true ); - issueRefresh(); - - } + colorMapParameters = new ColorMapParameters(); + if (colorMapParameters.getDisplayUnit() == null) { + colorMapParameters.setDisplayUnit(dataUnit); } - } + colorMapParameters.setColorMap(colorMap); + colorMapParameters.setColorMapMax(255); + colorMapParameters.setColorMapMin(0); + colorMapParameters.setDataMax(255); + colorMapParameters.setDataMin(0); + getCapability(ColorMapCapability.class).setColorMapParameters( + colorMapParameters); + if (dmEntriesList.size() > 0) { + DataMappingEntry[] dmEntryArray = new DataMappingEntry[dmEntriesList + .size()]; + dmEntriesList.toArray(dmEntryArray); + dmPref.setSerializableEntries(dmEntryArray); + ImagePreferences imgPref = new ImagePreferences(); + imgPref.setDataMapping(dmPref); + SamplePreferences sampPref = new SamplePreferences(); + sampPref.setMinValue(0); + sampPref.setMaxValue(255); + imgPref.setSamplePrefs(sampPref); + ColorBarFromColormap cBar = (ColorBarFromColormap) this.cbarResource + .getResourceData().getColorbar(); + if (cBar != null) { + cBar.setImagePreferences(imgPref); + + if (!cBar.isScalingAttemptedForThisColorMap()) + cBar.scalePixelValues(); + + if (radarRecord.getUnit().compareToIgnoreCase("in") == 0) { + cBar.setDisplayUnitStr("INCHES"); + } else { + cBar.setDisplayUnitStr(radarRecord.getUnit()); + } + + cBar.setAlignLabelInTheMiddleOfInterval(true); + cBar.setColorMap(colorMap); + + this.radarRscData.setColorBar(cBar); + } + + } - @Override - public void propertiesChanged(ResourceProperties updatedProps) { - - if( cbarRscPair != null ) { - cbarRscPair.getProperties().setVisible( updatedProps.isVisible() ); - } } - // the colorBar and/or the colormap may have changed so update the + private RadarTileSet createTile(MosaicRecord radarRecord, + boolean hasBasetile) throws VizException { + File loc = HDF5Util.findHDF5Location(radarRecord); + + IDataStore dataStore = DataStoreFactory.getDataStore(loc); + + try { + radarRecord.retrieveFromDataStore(dataStore); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (StorageException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + RadarTileSet tileSet = null; + + int numLevels = radarRecord.getNumLevels(); + UnitConverter dataToImage = null; + if (numLevels <= 16) { + dataToImage = new MultiplyConverter(16); + } else { + dataToImage = colorMapParameters.getDataToImageConverter(); + } + + MosaicTiler tiler = new MosaicTiler(radarRecord, 1, + radarRecord.getNx(), dataToImage); + + if (hasBasetile) { + tileSet = new RadarTileSet(tiler, baseTile, this, + grphTarget.getViewType()); + } else { + tileSet = new RadarTileSet(tiler, this, grphTarget.getViewType()); + } + + if (grphTarget != null) + tileSet.setMapDescriptor(this.getNcMapDescriptor()); + + return tileSet; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.core.rsc.capabilities.IInspectableResource#inspect(com + * .vividsolutions.jts.geom.Coordinate) + */ + @Override + public String inspect(ReferencedCoordinate latLon) throws VizException { + + Map dataMap; + try { + dataMap = interrogate(latLon.asLatLon()); + } catch (Exception e) { + throw new VizException("Error converting coordinate for hover", e); + } + + if (dataMap == null) { + return "NO DATA"; + } + + StringBuffer displayedData = new StringBuffer(); + // displayedData.append(dataMap.get("ICAO") + " "); + + displayedData.append(dataMap.get("Value")); + + if (dataMap.containsKey("Shear")) { + displayedData.append(" " + dataMap.get("Shear")); + } + + if (dataMap.containsKey("Azimuth")) { + displayedData.append(" " + dataMap.get("MSL") + "MSL"); + displayedData.append(" " + dataMap.get("AGL") + "AGL"); + displayedData.append(" " + dataMap.get("Range")); + displayedData.append("@" + dataMap.get("Azimuth")); + } + + return displayedData.toString(); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.rsc.AbstractVizResource#interrogate(com.raytheon + * .uf.viz.core.geospatial.ReferencedCoordinate) + */ + @Override + public Map interrogate(ReferencedCoordinate coord) + throws VizException { + Map smap; + try { + smap = this.interrogate(coord.asLatLon()); + } catch (Exception e) { + throw new VizException("Error transforming", e); + } + Map rmap = new HashMap(); + + if (smap == null) + return rmap; + + for (String smapKey : smap.keySet()) { + String value = smap.get(smapKey); + rmap.put(smapKey, value); + } + return rmap; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.core.rsc.capabilities.IInspectableResource#interrogate + * (com.vividsolutions.jts.geom.Coordinate) + */ + public Map interrogate(Coordinate latLon) + throws VizException { + return null; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.core.rsc.capabilities.IProjectableResource#project(org + * .opengis.referencing.crs.CoordinateReferenceSystem) + */ + @Override + public void project(CoordinateReferenceSystem mapData) throws VizException { + + if (this.baseTile != null) + this.baseTile.reproject(); + + for (AbstractFrameData frm : frameDataMap.values()) { + AbstractTileSet ts = ((FrameData) frm).tileSet; + if (ts != null) + ts.reproject(); + else + System.out.println("ERROR reproject tiles"); + } + } + + @Override + public void resourceChanged(ChangeType type, Object object) { + if (type != null && type == ChangeType.CAPABILITY) { + if (object instanceof ImagingCapability) { + ImagingCapability imgCap = getCapability(ImagingCapability.class); + ImagingCapability newImgCap = (ImagingCapability) object; + imgCap.setBrightness(newImgCap.getBrightness(), false); + imgCap.setContrast(newImgCap.getContrast(), false); + imgCap.setAlpha(newImgCap.getAlpha(), false); + radarRscData.setAlpha(imgCap.getAlpha()); + radarRscData.setBrightness(imgCap.getBrightness()); + radarRscData.setContrast(imgCap.getContrast()); + issueRefresh(); + + } else if (object instanceof ColorMapCapability) { + + ColorMapCapability colorMapCap = getCapability(ColorMapCapability.class); + ColorMapCapability newColorMapCap = (ColorMapCapability) object; + colorMapCap.setColorMapParameters( + newColorMapCap.getColorMapParameters(), false); + ColorMap theColorMap = (ColorMap) colorMapCap + .getColorMapParameters().getColorMap(); + String colorMapName = colorMapCap.getColorMapParameters() + .getColorMapName(); + radarRscData.setColorMapName(colorMapName); + radarRscData.getRscAttrSet().setAttrValue("colorMapName", + colorMapName); + ColorBarFromColormap cBar = radarRscData.getColorBar(); + cBar.setColorMap(theColorMap); + radarRscData.getRscAttrSet().setAttrValue("colorBar", cBar); + radarRscData.setIsEdited(true); + issueRefresh(); + + } + + } + + } + + @Override + public void propertiesChanged(ResourceProperties updatedProps) { + + if (cbarRscPair != null) { + cbarRscPair.getProperties().setVisible(updatedProps.isVisible()); + } + } + + // the colorBar and/or the colormap may have changed so update the // colorBarPainter and the colorMapParametersCapability which holds // the instance of the colorMap that Raytheon's code needs - @Override - public void resourceAttrsModified() { - // update the colorbarPainter with a possibly new colorbar - ColorBarFromColormap colorBar = radarRscData.getColorBar(); -// ColorBarFromColormap colorBar = (ColorBarFromColormap) radarRscData.getRscAttrSet().getRscAttr("colorBar").getAttrValue(); - cbarResource.setColorBar( colorBar ); - - ColorMapParameters cmapParams = getCapability(ColorMapCapability.class).getColorMapParameters(); - cmapParams.setColorMap( colorBar.getColorMap()); - cmapParams.setColorMapName( radarRscData.getColorMapName() ); - - getCapability(ColorMapCapability.class).setColorMapParameters( cmapParams ); + @Override + public void resourceAttrsModified() { + // update the colorbarPainter with a possibly new colorbar + ColorBarFromColormap colorBar = radarRscData.getColorBar(); + // ColorBarFromColormap colorBar = (ColorBarFromColormap) + // radarRscData.getRscAttrSet().getRscAttr("colorBar").getAttrValue(); + cbarResource.setColorBar(colorBar); - // TODO : how to migrate this to to11dr11? Or do we still need to do this? -// baseTile.resourceChanged(ChangeType.CAPABILITY, this.getCapability( ColorMapCapability.class)); - } + ColorMapParameters cmapParams = getCapability(ColorMapCapability.class) + .getColorMapParameters(); + cmapParams.setColorMap(colorBar.getColorMap()); + cmapParams.setColorMapName(radarRscData.getColorMapName()); + + getCapability(ColorMapCapability.class).setColorMapParameters( + cmapParams); + + // TODO : how to migrate this to to11dr11? Or do we still need to do + // this? + // baseTile.resourceChanged(ChangeType.CAPABILITY, this.getCapability( + // ColorMapCapability.class)); + } } diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF index be9feeac25..717a4c481a 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/META-INF/MANIFEST.MF @@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1161", gov.noaa.nws.ncep.common.log;bundle-version="1.0.0", gov.noaa.nws.ncep.viz.gempak;bundle-version="1.0.0", - gov.noaa.nws.ncep.viz.gempak.nativelib;bundle-version="1.0.0" + gov.noaa.nws.ncep.viz.gempak.nativelib;bundle-version="1.0.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: gov.noaa.nws.ncep.viz.rsc.ncgrid, diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/rsc/GridLevelTranslator.java b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/rsc/GridLevelTranslator.java index 3d0ec0c04c..07a2ebd64d 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/rsc/GridLevelTranslator.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/rsc/GridLevelTranslator.java @@ -25,8 +25,8 @@ import javax.measure.unit.SI; import javax.measure.unit.Unit; import com.raytheon.uf.common.dataplugin.grid.GridRecord; -import com.raytheon.uf.viz.core.style.level.Level; -import com.raytheon.uf.viz.core.style.level.SingleLevel; +import com.raytheon.uf.common.style.level.Level; +import com.raytheon.uf.common.style.level.SingleLevel; /** * Grid Level Translator diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/rsc/NcgridResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/rsc/NcgridResource.java index ab87879313..f45bd2795f 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/rsc/NcgridResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncgrid/src/gov/noaa/nws/ncep/viz/rsc/ncgrid/rsc/NcgridResource.java @@ -73,6 +73,7 @@ import com.raytheon.uf.common.geospatial.ISpatialObject; import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.serialization.comm.RequestRouter; +import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.VizApp; @@ -86,7 +87,6 @@ import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceType; -import com.raytheon.uf.viz.core.style.level.SingleLevel; /** * Grid contour Resource diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/META-INF/MANIFEST.MF index a8bfc1996b..38300307dd 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/META-INF/MANIFEST.MF @@ -23,7 +23,8 @@ Require-Bundle: org.apache.batik;bundle-version="1.6.0", gov.noaa.nws.ncep.viz.localization, com.raytheon.viz.ui, com.raytheon.viz.pointdata, - com.raytheon.uf.common.units;bundle-version="1.0.0" + com.raytheon.uf.common.units;bundle-version="1.0.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: com.raytheon.uf.common.dataplugin, diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/RadarImageResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/RadarImageResource.java index ed2ad3d885..4e6f31753e 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/RadarImageResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/RadarImageResource.java @@ -84,8 +84,8 @@ import com.raytheon.uf.viz.core.rsc.hdf5.ImageTile; import com.raytheon.viz.awipstools.capabilities.RangeRingsOverlayCapability; import com.raytheon.viz.awipstools.capabilityInterfaces.IRangeableResource; import com.raytheon.viz.core.drawables.ColorMapParameterFactory; -import com.raytheon.viz.core.style.image.ImagePreferences; -import com.raytheon.viz.core.style.image.SamplePreferences; +import com.raytheon.uf.common.style.image.ImagePreferences; +import com.raytheon.uf.common.style.image.SamplePreferences; import com.raytheon.viz.radar.interrogators.IRadarInterrogator; import com.raytheon.viz.radar.util.DataUtilities; import com.vividsolutions.jts.geom.Coordinate; diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/RadarNameGenerator.java b/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/RadarNameGenerator.java index 7dd671e552..1f36072789 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/RadarNameGenerator.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.ncradar/src/gov/noaa/nws/ncep/viz/rsc/ncradar/rsc/RadarNameGenerator.java @@ -23,17 +23,17 @@ import com.raytheon.uf.common.dataplugin.radar.util.RadarInfoDict; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleManager; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleException; import com.raytheon.uf.viz.core.drawables.AbstractDescriptor; import com.raytheon.uf.viz.core.map.MapDescriptor; import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.capabilities.BlendedCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleManager; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.VizStyleException; -import com.raytheon.viz.core.style.image.ImagePreferences; +import com.raytheon.uf.common.style.image.ImagePreferences; /** * Name generator for radar products. @@ -280,7 +280,7 @@ public class RadarNameGenerator extends AbstractNameGenerator { // unitName = "(" + unitName + ") "; } } - } catch (VizStyleException e1) { + } catch (StyleException e1) { // Don't worry about it just grab the units from the record. } diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/META-INF/MANIFEST.MF index c96575c143..964962f6cb 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/META-INF/MANIFEST.MF @@ -29,7 +29,8 @@ Require-Bundle: org.eclipse.ui, javax.media.opengl, com.raytheon.uf.viz.derivparam;bundle-version="1.11.31", gov.noaa.nws.ncep.common.dataplugin.mcidas;bundle-version="1.0.0", - com.raytheon.uf.common.dataplugin.satellite;bundle-version="1.0.0" + com.raytheon.uf.common.dataplugin.satellite;bundle-version="1.0.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: gov.noaa.nws.ncep.viz.rsc.satellite, diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/rsc/AbstractSatelliteResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/rsc/AbstractSatelliteResource.java index 8272478655..6753978573 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/rsc/AbstractSatelliteResource.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.satellite/src/gov/noaa/nws/ncep/viz/rsc/satellite/rsc/AbstractSatelliteResource.java @@ -2,9 +2,8 @@ package gov.noaa.nws.ncep.viz.rsc.satellite.rsc; import gov.noaa.nws.ncep.edex.common.metparameters.parameterconversion.NcUnits; import gov.noaa.nws.ncep.viz.common.ColorMapUtil; -import gov.noaa.nws.ncep.viz.common.area.IAreaProviderCapable; -import gov.noaa.nws.ncep.viz.common.area.IGridGeometryProvider; import gov.noaa.nws.ncep.viz.common.area.AreaName.AreaSource; +import gov.noaa.nws.ncep.viz.common.area.IAreaProviderCapable; import gov.noaa.nws.ncep.viz.common.ui.NmapCommon; import gov.noaa.nws.ncep.viz.localization.NcPathManager; import gov.noaa.nws.ncep.viz.resources.AbstractNatlCntrsResource; @@ -30,7 +29,6 @@ import javax.measure.unit.SI; import javax.measure.unit.Unit; import javax.measure.unit.UnitFormat; -import org.geotools.coverage.grid.GeneralGridGeometry; import org.geotools.coverage.grid.GridGeometry2D; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.datum.PixelInCell; @@ -50,6 +48,15 @@ import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.serialization.SerializationUtil; +import com.raytheon.uf.common.style.AbstractStylePreferences; +import com.raytheon.uf.common.style.MatchCriteria; +import com.raytheon.uf.common.style.ParamLevelMatchCriteria; +import com.raytheon.uf.common.style.StyleRule; +import com.raytheon.uf.common.style.StyleRuleset; +import com.raytheon.uf.common.style.StyleException; +import com.raytheon.uf.common.style.image.DataScale; +import com.raytheon.uf.common.style.image.ImagePreferences; +import com.raytheon.uf.common.style.image.SamplePreferences; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.VizApp; @@ -62,19 +69,10 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.ResourceProperties; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability; -import com.raytheon.uf.viz.core.style.AbstractStylePreferences; -import com.raytheon.uf.viz.core.style.MatchCriteria; -import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; -import com.raytheon.uf.viz.core.style.StyleRule; -import com.raytheon.uf.viz.core.style.StyleRuleset; -import com.raytheon.uf.viz.core.style.VizStyleException; import com.raytheon.uf.viz.derivparam.library.DerivedParameterRequest; import com.raytheon.viz.core.gl.IGLTarget; import com.raytheon.viz.core.rsc.hdf5.AbstractTileSet; import com.raytheon.viz.core.rsc.hdf5.FileBasedTileSet; -import com.raytheon.viz.core.style.image.DataScale; -import com.raytheon.viz.core.style.image.ImagePreferences; -import com.raytheon.viz.core.style.image.SamplePreferences; import com.raytheon.viz.satellite.SatelliteConstants; import com.vividsolutions.jts.geom.Coordinate; @@ -119,7 +117,8 @@ import com.vividsolutions.jts.geom.Coordinate; */ public abstract class AbstractSatelliteResource extends AbstractNatlCntrsResource - implements INatlCntrsResource, IResourceDataChanged, IAreaProviderCapable { + implements INatlCntrsResource, IResourceDataChanged, + IAreaProviderCapable { protected SatelliteResourceData satRscData; @@ -882,7 +881,7 @@ public abstract class AbstractSatelliteResource extends } catch (SerializationException e1) { e1.printStackTrace(); - } catch (VizStyleException e1) { + } catch (StyleException e1) { e1.printStackTrace(); } catch (NullPointerException e1) { @@ -1025,15 +1024,16 @@ public abstract class AbstractSatelliteResource extends } } - // for IAreaProviderCapable which triggers the Fit To Screen and Size Of Image + // for IAreaProviderCapable which triggers the Fit To Screen and Size Of + // Image // context menus @Override - public AreaSource getSourceProvider() { - return satRscData.getSourceProvider(); + public AreaSource getSourceProvider() { + return satRscData.getSourceProvider(); } @Override - public String getAreaName() { - return satRscData.getAreaName(); + public String getAreaName() { + return satRscData.getAreaName(); } } diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/META-INF/MANIFEST.MF index 5d7a29b9d7..39e429ee7b 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/META-INF/MANIFEST.MF @@ -28,7 +28,8 @@ Require-Bundle: gov.nasa.gsfc.fits, javax.measure;bundle-version="1.0.0", com.raytheon.uf.viz.xy.timeseries;bundle-version="1.12.1174", gov.noaa.nws.ncep.viz.common, - gov.noaa.nws.ncep.viz.resources;bundle-version="1.0.0" + gov.noaa.nws.ncep.viz.resources;bundle-version="1.0.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Import-Package: gov.noaa.nws.ncep.viz.ui.display diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/display/SolarImageMatchCriteria.java b/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/display/SolarImageMatchCriteria.java index 804d6ef2d2..727b3f098a 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/display/SolarImageMatchCriteria.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/display/SolarImageMatchCriteria.java @@ -26,8 +26,8 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; -import com.raytheon.uf.viz.core.style.MatchCriteria; -import com.raytheon.uf.viz.core.style.VizStyleException; +import com.raytheon.uf.common.style.MatchCriteria; +import com.raytheon.uf.common.style.StyleException; @XmlAccessorType(XmlAccessType.NONE) @@ -75,11 +75,11 @@ public class SolarImageMatchCriteria extends MatchCriteria { /* * (non-Javadoc) * - * @see com.raytheon.uf.viz.core.style.MatchCriteria#matches(com.raytheon + * @see com.raytheon.uf.common.style.MatchCriteria#matches(com.raytheon * .uf. viz.core.style.MatchCriteria) */ @Override - public int matches(MatchCriteria aCriteria) throws VizStyleException { + public int matches(MatchCriteria aCriteria) throws StyleException { int rval = -1; if (aCriteria instanceof SolarImageMatchCriteria) { rval = 0; diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/CylindCedDisplay.java b/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/CylindCedDisplay.java index 654d3ed1d7..680f2ec345 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/CylindCedDisplay.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/CylindCedDisplay.java @@ -37,7 +37,7 @@ import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.xy.graph.GraphProperties; -import com.raytheon.viz.core.style.image.DataScale; +import com.raytheon.uf.common.style.image.DataScale; import com.vividsolutions.jts.geom.Coordinate; /** diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/SolarImageDisplay.java b/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/SolarImageDisplay.java index af9c1024ed..e1409013c4 100644 --- a/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/SolarImageDisplay.java +++ b/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/SolarImageDisplay.java @@ -1,6 +1,5 @@ package gov.noaa.nws.ncep.viz.rsc.solarimage.rsc; - import gov.noaa.nws.ncep.common.dataplugin.solarimage.SolarImageRecord; import gov.noaa.nws.ncep.viz.rsc.solarimage.LogSolarImageDataCallback; import gov.noaa.nws.ncep.viz.rsc.solarimage.SolarImageDataCallback; @@ -29,6 +28,7 @@ import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.common.style.image.DataScale; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.PixelCoverage; import com.raytheon.uf.viz.core.drawables.IColormappedImage; @@ -37,13 +37,11 @@ import com.raytheon.uf.viz.core.drawables.IRenderable; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.ext.colormap.IColormappedImageExtension; import com.raytheon.uf.viz.core.exception.VizException; -import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.uf.viz.xy.graph.GraphProperties; -import com.raytheon.viz.core.style.image.DataScale; import com.vividsolutions.jts.geom.Coordinate; /** - * + * *
  * 
  * SOFTWARE HISTORY
@@ -76,8 +74,8 @@ public class SolarImageDisplay implements IRenderable {
     private SolarImageDataCallback dataCallback;
 
     private ColorMapParameters colorMapParameters;
-    
-    private boolean isColorMapChanged =  false;
+
+    private boolean isColorMapChanged = false;
 
     private final GeneralGridGeometry gridGeom;
 
@@ -90,103 +88,115 @@ public class SolarImageDisplay implements IRenderable {
     private MathTransform worldToPixel;
 
     private MathTransform pixelToWorld;
-    
+
     private final HeaderData headerData;
+
     private final Header header;
-    
+
     private final int nx;
+
     private final int ny;
-    
+
     private double scale;
+
     private AffineTransform at;
-    
+
     public CSConversions csConv;
-    
+
     private DataScale dataScale = null;
 
     public List points = new ArrayList();
+
     private ImageData imageData;
+
     boolean temflag = false;
-    
-    
-    public SolarImageDisplay(SolarImageRecord rec, ColorMapParameters cmp, GeneralGridGeometry gridGeometry, 
-            boolean logConvert, DataScale dataScale) throws VizException {
+
+    public SolarImageDisplay(SolarImageRecord rec, ColorMapParameters cmp,
+            GeneralGridGeometry gridGeometry, boolean logConvert,
+            DataScale dataScale) throws VizException {
         this.record = rec;
         this.colorMapParameters = cmp;
         this.gridGeom = gridGeometry;
         this.logConvert = logConvert;
         this.dataScale = dataScale;
-        if (this.logConvert){
+        if (this.logConvert) {
             dataCallback = new LogSolarImageDataCallback(record);
             imageData = dataCallback.getImageData();
         } else {
             dataCallback = new SolarImageDataCallback(record);
             imageData = dataCallback.getImageData();
         }
-            
+
         header = imageData.getHeader();
-//        if (header == null)
-//            populateHeader();
+        // if (header == null)
+        // populateHeader();
         nx = imageData.getNx();
         ny = imageData.getNy();
-        
+
         headerData = new HeaderData(record);
         csConv = new CSConversions(headerData);
-        
+
     }
-    
+
     @Override
     public void paint(IGraphicsTarget target, PaintProperties paintProps)
             throws VizException {
 
-        if (image == null || isColorMapChanged) { 
+        if (image == null || isColorMapChanged) {
 
-        	float scaleMin = dataScale.getMinValue().floatValue();
-        	float scaleMax = dataScale.getMaxValue().floatValue();
-        	float range = scaleMax - scaleMin;
-        	
-        	float cMapMax = (float)(range/255.0) * colorMapParameters.getColorMapMax(); 
-        	float cMapMin = (float) (range/255.0) * colorMapParameters.getColorMapMin(); 
-        	        	 
-        	//System.out.println(" test ****** before colorMapParameters min max = " +  colorMapParameters.getColorMapMin() + " " + colorMapParameters.getColorMapMax() + " cMapMax = " +cMapMax);
-        	
-        	if (range <= 255.0) {
-        		if ((colorMapParameters.getColorMapMax() > range)) {       		
-        			colorMapParameters.setColorMapMax(cMapMax);
-        		} 
-        		if ((colorMapParameters.getColorMapMin() > range)) {            		
-        			colorMapParameters.setColorMapMin(cMapMin);
-                } 
+            float scaleMin = dataScale.getMinValue().floatValue();
+            float scaleMax = dataScale.getMaxValue().floatValue();
+            float range = scaleMax - scaleMin;
+
+            float cMapMax = (float) (range / 255.0)
+                    * colorMapParameters.getColorMapMax();
+            float cMapMin = (float) (range / 255.0)
+                    * colorMapParameters.getColorMapMin();
+
+            // System.out.println(" test ****** before colorMapParameters min max = "
+            // + colorMapParameters.getColorMapMin() + " " +
+            // colorMapParameters.getColorMapMax() + " cMapMax = " +cMapMax);
+
+            if (range <= 255.0) {
+                if ((colorMapParameters.getColorMapMax() > range)) {
+                    colorMapParameters.setColorMapMax(cMapMax);
+                }
+                if ((colorMapParameters.getColorMapMin() > range)) {
+                    colorMapParameters.setColorMapMin(cMapMin);
+                }
             }
 
-        	else {	
-        		if (scaleMin >= 0) {
-            		if (colorMapParameters.getColorMapMax() >= 0 && cMapMax <= range) {
-                		colorMapParameters.setColorMapMax(cMapMax);
-                	}        	
-                	
-                	if (colorMapParameters.getColorMapMin() >= 0 && cMapMin <= range) {
-                		colorMapParameters.setColorMapMin(cMapMin);
-                	}
-        		}
-        		else {
-        			if (colorMapParameters.getColorMapMax() >= 0 && cMapMax <= range) {
-                		colorMapParameters.setColorMapMax(cMapMax-scaleMax);
-                	}     	
-                	
-                	if (colorMapParameters.getColorMapMin() >= 0 && cMapMin <= range) {
-                		colorMapParameters.setColorMapMin(cMapMin-scaleMax);
-                	}
-        		}
-        	}
-        	        	
-        	image = target.getExtension(IColormappedImageExtension.class)
-                    .initializeRaster(dataCallback, colorMapParameters); 
+            else {
+                if (scaleMin >= 0) {
+                    if (colorMapParameters.getColorMapMax() >= 0
+                            && cMapMax <= range) {
+                        colorMapParameters.setColorMapMax(cMapMax);
+                    }
+
+                    if (colorMapParameters.getColorMapMin() >= 0
+                            && cMapMin <= range) {
+                        colorMapParameters.setColorMapMin(cMapMin);
+                    }
+                } else {
+                    if (colorMapParameters.getColorMapMax() >= 0
+                            && cMapMax <= range) {
+                        colorMapParameters.setColorMapMax(cMapMax - scaleMax);
+                    }
+
+                    if (colorMapParameters.getColorMapMin() >= 0
+                            && cMapMin <= range) {
+                        colorMapParameters.setColorMapMin(cMapMin - scaleMax);
+                    }
+                }
+            }
+
+            image = target.getExtension(IColormappedImageExtension.class)
+                    .initializeRaster(dataCallback, colorMapParameters);
         }
-       
-       if (transform == null || extent == null) {
+
+        if (transform == null || extent == null) {
             try {
-            	transform = new WCSConverter(header);
+                transform = new WCSConverter(header);
             } catch (Exception e) {
                 statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
                         e);
@@ -194,22 +204,26 @@ public class SolarImageDisplay implements IRenderable {
                         "Could not create image to world coordinate transform",
                         e);
             }
-            
-            double[] ll = transform.imageToWorld(new double[] { 0, 0 });   
-            double[] lr = transform.imageToWorld(new double[] { nx, 0 });            		
+
+            double[] ll = transform.imageToWorld(new double[] { 0, 0 });
+            double[] lr = transform.imageToWorld(new double[] { nx, 0 });
             double[] ur = transform.imageToWorld(new double[] { nx, ny });
             double[] ul = transform.imageToWorld(new double[] { 0, ny });
-            
-//            double[] ll = transform.imageToWorld(new double[] { -0.5, -0.5 });   
-//            double[] lr = transform.imageToWorld(new double[] { nx - 0.5, -0.5 });            		
-//            double[] ur = transform.imageToWorld(new double[] { nx - 0.5, ny - 0.5 });            		
-//            double[] ul = transform.imageToWorld(new double[] { -0.5, ny - 0.5 });                                
-            
+
+            // double[] ll = transform.imageToWorld(new double[] { -0.5, -0.5
+            // });
+            // double[] lr = transform.imageToWorld(new double[] { nx - 0.5,
+            // -0.5 });
+            // double[] ur = transform.imageToWorld(new double[] { nx - 0.5, ny
+            // - 0.5 });
+            // double[] ul = transform.imageToWorld(new double[] { -0.5, ny -
+            // 0.5 });
+
             double minX = Math.min(ll[0], ul[0]);
             double maxX = Math.max(lr[0], ur[0]);
             double minY = Math.min(ll[1], lr[1]);
             double maxY = Math.max(ul[1], ur[1]);
-            
+
             if ((maxX - minX) > (maxY - minY)) {
                 scale = gridGeom.getEnvelope().getSpan(0) / (maxX - minX);
             } else {
@@ -223,17 +237,16 @@ public class SolarImageDisplay implements IRenderable {
             } else {
                 center = paintProps.getView().getExtent().getCenter();
             }
-            
+
             center[0] = gridGeom.getEnvelope().getMedian(0);
             center[1] = gridGeom.getEnvelope().getMedian(1);
-            
+
             double[] llp = new double[2];
             double[] lrp = new double[2];
             double[] ulp = new double[2];
             double[] urp = new double[2];
             try {
-                at = AffineTransform.getTranslateInstance(
-                        center[0], center[1]);
+                at = AffineTransform.getTranslateInstance(center[0], center[1]);
                 at.concatenate(AffineTransform.getScaleInstance(scale, -scale));
                 worldToPixel = new AffineTransform2D(at);
                 // System.out.println(worldToPixel.toWKT());
@@ -258,26 +271,28 @@ public class SolarImageDisplay implements IRenderable {
             }
 
             // handle THEMATIC
-            if (record.getWavelength().equalsIgnoreCase("THEMATIC")){
-	          	llp = new double[] { 0, 0 };
-	          	lrp = new double[] { 1000, 0 };
-	            urp = new double[] { 1000, 1000 };
-	            ulp = new double[] { 0, 1000 };
+            if (record.getWavelength().equalsIgnoreCase("THEMATIC")) {
+                llp = new double[] { 0, 0 };
+                lrp = new double[] { 1000, 0 };
+                urp = new double[] { 1000, 1000 };
+                ulp = new double[] { 0, 1000 };
             }
-            
+
             extent = new PixelCoverage(new Coordinate(ulp[0], ulp[1]),
                     new Coordinate(urp[0], urp[1]), new Coordinate(lrp[0],
                             lrp[1]), new Coordinate(llp[0], llp[1]));
-            //System.out.println("**** extent "+ulp[0]+" "+ ulp[1] +" "+urp[0]+" "+ urp[1]+" "+ lrp[0]+" "+lrp[1]+" "+ llp[0]+" "+llp[1] );
+            // System.out.println("**** extent "+ulp[0]+" "+ ulp[1]
+            // +" "+urp[0]+" "+ urp[1]+" "+ lrp[0]+" "+lrp[1]+" "+
+            // llp[0]+" "+llp[1] );
         }
-       
+
         image.setContrast(contrast);
         image.setBrightness(brightness);
         image.setInterpolated(isInterpolated);
-        target.drawRaster(image, extent, paintProps); 
-         
+        target.drawRaster(image, extent, paintProps);
+
     }
-    
+
     public void dispose() {
 
         if (this.image != null)
@@ -288,34 +303,41 @@ public class SolarImageDisplay implements IRenderable {
             throws VizException {
 
         Map map = new LinkedHashMap();
-   
+
         try {
             double[] pixel = new double[] { coord.asLatLon().x,
                     coord.asLatLon().y };
-            
+
             double[] world = new double[2];
-            pixelToWorld.transform(pixel, 0, world, 0, 1);  
-            map.put("HCC", new Coordinate(formatValue(world[0]), formatValue(world[1])));//move down
+            pixelToWorld.transform(pixel, 0, world, 0, 1);
+            map.put("HCC", new Coordinate(formatValue(world[0]),
+                    formatValue(world[1])));// move down
 
             double image[] = transform.WorldToImage(world);
-            // remember that image was flipped during earlier and stored with first pixel as top left
+            // remember that image was flipped during earlier and stored with
+            // first pixel as top left
             image[1] = ny - 1 - image[1];
-            map.put("Image", new Coordinate(formatValue(image[0]), formatValue(image[1])));
-           
-            double[] locWorld = (new CSConversions(headerData)).heliocentricToHeliographic(world, false);            
+            map.put("Image", new Coordinate(formatValue(image[0]),
+                    formatValue(image[1])));
+
+            double[] locWorld = (new CSConversions(headerData))
+                    .heliocentricToHeliographic(world, false);
             if (locWorld[0] > 180)
-            	locWorld[0] = locWorld[0] - 360;
+                locWorld[0] = locWorld[0] - 360;
             else if (locWorld[0] < -180)
-            	locWorld[0] = locWorld[0] +  360;
-            map.put("StonyHurst", new Coordinate(formatValue(locWorld[0]), formatValue(locWorld[1])));
-           
-            locWorld = (new CSConversions(headerData)).heliocentricToHeliographic(world, true); 
+                locWorld[0] = locWorld[0] + 360;
+            map.put("StonyHurst", new Coordinate(formatValue(locWorld[0]),
+                    formatValue(locWorld[1])));
+
+            locWorld = (new CSConversions(headerData))
+                    .heliocentricToHeliographic(world, true);
             if (locWorld[0] > 360)
-            	locWorld[0] = locWorld[0] - 360;
+                locWorld[0] = locWorld[0] - 360;
             else if (locWorld[0] < -360)
-            	locWorld[0] = locWorld[0] +  360;
-            map.put("Carrington", new Coordinate(formatValue(locWorld[0]), formatValue(locWorld[1])));
-                     
+                locWorld[0] = locWorld[0] + 360;
+            map.put("Carrington", new Coordinate(formatValue(locWorld[0]),
+                    formatValue(locWorld[1])));
+
             long x = Math.round(image[0]);
             long y = Math.round(image[1]);
             double val = getImageValue((int) x, (int) y);
@@ -330,22 +352,21 @@ public class SolarImageDisplay implements IRenderable {
 
         return map;
     }
-    
+
     public double formatValue(double val) {
-    	
-    	DecimalFormat df = new DecimalFormat("#.#####");
-    	double newVal = val;
-    	try { 
-	    	String valStr = df.format(val);
-	        Double valDbl = Double.parseDouble(valStr);
-	        newVal = valDbl;
-    	}
-    	catch (Exception e) {
-    		return val;
-    	}
-    	
+
+        DecimalFormat df = new DecimalFormat("#.#####");
+        double newVal = val;
+        try {
+            String valStr = df.format(val);
+            Double valDbl = Double.parseDouble(valStr);
+            newVal = valDbl;
+        } catch (Exception e) {
+            return val;
+        }
+
         return newVal;
-    } 
+    }
 
     public double getImageValue(int x, int y) {
         double value = Float.NaN;
@@ -359,8 +380,7 @@ public class SolarImageDisplay implements IRenderable {
 
     private boolean isInImageRange(int x, int y) {
 
-        return (x >= 0) && (x < nx) && (y >= 0)
-        && (y < ny);
+        return (x >= 0) && (x < nx) && (y >= 0) && (y < ny);
     }
 
     public void setBrightness(float brightness) {
@@ -374,30 +394,31 @@ public class SolarImageDisplay implements IRenderable {
     public void setInterpolationState(boolean isInterpolated) {
         this.isInterpolated = isInterpolated;
     }
-    
+
     public void setColorMapParameters(ColorMapParameters params) {
         this.colorMapParameters = params;
         this.isColorMapChanged = true;
     }
 
     public void setColorMapChanged(boolean val) {
-    	this.isColorMapChanged = val;;
+        this.isColorMapChanged = val;
+        ;
     }
-    
+
     public PixelCoverage getPixelCoverage() {
         return extent;
     }
-    
+
     public MathTransform getWorldToPixel() {
         return worldToPixel;
     }
-    
+
     public CSConversions getCSConversions() {
-    	return csConv;
+        return csConv;
     }
-    
+
     public HeaderData getHeaderData() {
-    	return headerData;
+        return headerData;
     }
-    
+
 }
diff --git a/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/SolarImageResource.java b/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/SolarImageResource.java
index 3a550171a2..3be2249a9b 100644
--- a/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/SolarImageResource.java
+++ b/ncep/gov.noaa.nws.ncep.viz.rsc.solarimage/src/gov/noaa/nws/ncep/viz/rsc/solarimage/rsc/SolarImageResource.java
@@ -36,6 +36,16 @@ import com.raytheon.uf.common.serialization.SerializationUtil;
 import com.raytheon.uf.common.status.IUFStatusHandler;
 import com.raytheon.uf.common.status.UFStatus;
 import com.raytheon.uf.common.status.UFStatus.Priority;
+import com.raytheon.uf.common.style.AbstractStylePreferences;
+import com.raytheon.uf.common.style.LabelingPreferences;
+import com.raytheon.uf.common.style.MatchCriteria;
+import com.raytheon.uf.common.style.StyleException;
+import com.raytheon.uf.common.style.StyleRule;
+import com.raytheon.uf.common.style.StyleRuleset;
+import com.raytheon.uf.common.style.image.DataScale;
+import com.raytheon.uf.common.style.image.DataScale.Type;
+import com.raytheon.uf.common.style.image.ImagePreferences;
+import com.raytheon.uf.common.style.image.SamplePreferences;
 import com.raytheon.uf.common.time.DataTime;
 import com.raytheon.uf.viz.core.IDisplayPaneContainer;
 import com.raytheon.uf.viz.core.IGraphicsTarget;
@@ -50,16 +60,6 @@ import com.raytheon.uf.viz.core.rsc.ResourceProperties;
 import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
 import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
-import com.raytheon.uf.viz.core.style.AbstractStylePreferences;
-import com.raytheon.uf.viz.core.style.LabelingPreferences;
-import com.raytheon.uf.viz.core.style.MatchCriteria;
-import com.raytheon.uf.viz.core.style.StyleRule;
-import com.raytheon.uf.viz.core.style.StyleRuleset;
-import com.raytheon.uf.viz.core.style.VizStyleException;
-import com.raytheon.viz.core.style.image.DataScale;
-import com.raytheon.viz.core.style.image.DataScale.Type;
-import com.raytheon.viz.core.style.image.ImagePreferences;
-import com.raytheon.viz.core.style.image.SamplePreferences;
 import com.vividsolutions.jts.geom.Coordinate;
 
 /**
@@ -77,6 +77,7 @@ import com.vividsolutions.jts.geom.Coordinate;
  * 03/19/2013    958       qzhou, sgurung   implemented colormap and colorbar
  * 04/03/2013    958       qzhou            Added cylindrical display to updateFrameData, paintFrame, 
  *                                          inspect, dispose and construct.
+ * Sep 5,2013    2051       mnash           Fixed a deprecated method.
  * 
* * @author qzhou, sgurung @@ -826,9 +827,8 @@ public class SolarImageResource extends File file = NcPathManager.getInstance().getStaticFile(locFileName); StyleRule sRule = null; try { - @SuppressWarnings("deprecation") StyleRuleset styleSet = (StyleRuleset) SerializationUtil - .jaxbUnmarshalFromXmlFile(file); + .jaxbUnmarshalFromXmlFile(StyleRuleset.class, file); if (styleSet != null) { List styleRuleList = styleSet.getStyleRules(); @@ -881,7 +881,7 @@ public class SolarImageResource extends } catch (SerializationException e1) { e1.printStackTrace(); - } catch (VizStyleException e1) { + } catch (StyleException e1) { e1.printStackTrace(); } catch (NullPointerException e1) { diff --git a/ncep/gov.noaa.nws.ncep.viz.ui.display/META-INF/MANIFEST.MF b/ncep/gov.noaa.nws.ncep.viz.ui.display/META-INF/MANIFEST.MF index 368637e55d..111f0b57e3 100644 --- a/ncep/gov.noaa.nws.ncep.viz.ui.display/META-INF/MANIFEST.MF +++ b/ncep/gov.noaa.nws.ncep.viz.ui.display/META-INF/MANIFEST.MF @@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.ui, com.raytheon.viz.core, gov.noaa.nws.ncep.viz.common;bundle-version="1.0.0", com.raytheon.uf.common.colormap;bundle-version="1.12.1174", - gov.noaa.nws.ncep.viz.localization;bundle-version="1.0.0" + gov.noaa.nws.ncep.viz.localization;bundle-version="1.0.0", + com.raytheon.uf.common.style;bundle-version="1.0.0" Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: gov.noaa.nws.ncep.viz.ui.display diff --git a/ncep/gov.noaa.nws.ncep.viz.ui.display/src/gov/noaa/nws/ncep/viz/ui/display/ColorBarFromColormap.java b/ncep/gov.noaa.nws.ncep.viz.ui.display/src/gov/noaa/nws/ncep/viz/ui/display/ColorBarFromColormap.java index b78c8d97ff..456013d9e0 100644 --- a/ncep/gov.noaa.nws.ncep.viz.ui.display/src/gov/noaa/nws/ncep/viz/ui/display/ColorBarFromColormap.java +++ b/ncep/gov.noaa.nws.ncep.viz.ui.display/src/gov/noaa/nws/ncep/viz/ui/display/ColorBarFromColormap.java @@ -1,5 +1,10 @@ package gov.noaa.nws.ncep.viz.ui.display; +import gov.noaa.nws.ncep.gempak.parameters.colorbar.ColorBarAnchorLocation; +import gov.noaa.nws.ncep.gempak.parameters.colorbar.ColorBarAttributesBuilder; +import gov.noaa.nws.ncep.gempak.parameters.colorbar.ColorBarOrientation; +import gov.noaa.nws.ncep.viz.common.RGBColorAdapter; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; @@ -18,43 +23,37 @@ import com.raytheon.uf.common.colormap.ColorMap; import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences; import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry; import com.raytheon.uf.common.serialization.ISerializableObject; -import com.raytheon.viz.core.style.image.ImagePreferences; - -import gov.noaa.nws.ncep.gempak.parameters.colorbar.ColorBarAnchorLocation; -import gov.noaa.nws.ncep.gempak.parameters.colorbar.ColorBarAttributesBuilder; -import gov.noaa.nws.ncep.gempak.parameters.colorbar.ColorBarOrientation; -import gov.noaa.nws.ncep.viz.common.RGBColorAdapter; -import gov.noaa.nws.ncep.viz.common.IntegerListAdapter; +import com.raytheon.uf.common.style.image.ImagePreferences; /** - * An ColorBar initialized from a ColorMap. + * An ColorBar initialized from a ColorMap. * *
- * SOFTWARE HISTORY
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * 04/14/10      #259        Greg Hull    Initial Creation.
- * 10/25/11      #463        qzhou        Added equals()
- * 12/06/11                  qzhou        Modified equals and added hashCode
- * 06/07/12      #717       Archana       Added imagePreferences to store the label information
- *                                        Added the method scalePixelValues() to 
- *                                        scale the pixel values whenever the 
- *                                        pixel values exceeded the actual number 
- *                                        of colors in the color map
- *                                        Added numPixelsToReAlignLabel to position the label at the
- *                                        beginning or at the middle of the color interval.
- *                                       
- * 06/07/12      #794       Archana       Added a Boolean flag called reverseOrder to enable/disable
- *                                        reversing the order of colors in the color-bar.                                  
- *
- * 06/18/12      #743       Archana       Added attributes to implement GEMPAK's CLRBAR parameter:
- *                                        xPixelCoordFraction, yPixelCoordFraction,drawColorBar,
- *                                        isDrawBoxAroundColorBar. added the corresponding setter/getter methods
- *                                        Added setAttributesFromColorBarAttributesBuilder()                                      
- *07/18/12       #717       Archana       Refactored numPixelsToReAlignLabel to alignLabelInTheMiddleOfInterval
- *                                        and added the corresponding setter/getter methods                                   
- *                                                                                   
- *                                                                                   
+ *  SOFTWARE HISTORY
+ *  Date         Ticket#     Engineer    Description
+ *  ------------ ----------  ----------- --------------------------
+ *  04/14/10      #259        Greg Hull    Initial Creation.
+ *  10/25/11      #463        qzhou        Added equals()
+ *  12/06/11                  qzhou        Modified equals and added hashCode
+ *  06/07/12      #717       Archana       Added imagePreferences to store the label information
+ *                                         Added the method scalePixelValues() to 
+ *                                         scale the pixel values whenever the 
+ *                                         pixel values exceeded the actual number 
+ *                                         of colors in the color map
+ *                                         Added numPixelsToReAlignLabel to position the label at the
+ *                                         beginning or at the middle of the color interval.
+ *                                        
+ *  06/07/12      #794       Archana       Added a Boolean flag called reverseOrder to enable/disable
+ *                                         reversing the order of colors in the color-bar.                                  
+ * 
+ *  06/18/12      #743       Archana       Added attributes to implement GEMPAK's CLRBAR parameter:
+ *                                         xPixelCoordFraction, yPixelCoordFraction,drawColorBar,
+ *                                         isDrawBoxAroundColorBar. added the corresponding setter/getter methods
+ *                                         Added setAttributesFromColorBarAttributesBuilder()                                      
+ * 07/18/12       #717       Archana       Refactored numPixelsToReAlignLabel to alignLabelInTheMiddleOfInterval
+ *                                         and added the corresponding setter/getter methods
+ * 
+ * 
  * 
* * @author ghull @@ -64,844 +63,865 @@ import gov.noaa.nws.ncep.viz.common.IntegerListAdapter; @XmlAccessorType(XmlAccessType.NONE) public class ColorBarFromColormap implements IColorBar, ISerializableObject { - @XmlElement - private ColorBarOrientation orientation = ColorBarOrientation.Vertical; + @XmlElement + private ColorBarOrientation orientation = ColorBarOrientation.Vertical; - @XmlElement - private ColorBarAnchorLocation anchorLoc = ColorBarAnchorLocation.LowerLeft; + @XmlElement + private ColorBarAnchorLocation anchorLoc = ColorBarAnchorLocation.LowerLeft; -// @XmlElement -// private String colorMapName = null; + // @XmlElement + // private String colorMapName = null; - // @XmlElement - private ColorMap colorMap = null; + // @XmlElement + private ColorMap colorMap = null; - // if we let the user edit the colormap then the IntervalColors will - // be used to create a new colormap instead of reading the colorMapName - // - // @XmlElement - private Boolean colorMapModified = false; + // if we let the user edit the colormap then the IntervalColors will + // be used to create a new colormap instead of reading the colorMapName + // + // @XmlElement + private Boolean colorMapModified = false; - @XmlElement - @XmlJavaTypeAdapter(RGBColorAdapter.class) - private RGB labelColor = new RGB(255, 255, 255); + @XmlElement + @XmlJavaTypeAdapter(RGBColorAdapter.class) + private RGB labelColor = new RGB(255, 255, 255); - @XmlElement(name = "pixelRGBs") - @XmlJavaTypeAdapter(RGBColorAdapter.class) - private final ArrayList pixelRGBs = new ArrayList(); + @XmlElement(name = "pixelRGBs") + @XmlJavaTypeAdapter(RGBColorAdapter.class) + private final ArrayList pixelRGBs = new ArrayList(); - private final ArrayList colors = new ArrayList(); + private final ArrayList colors = new ArrayList(); - private Unit dataUnits; - // private Unit displayUnits; + private Unit dataUnits; - @XmlElement - private Boolean showLabels = true; + // private Unit displayUnits; - @XmlElement - private Boolean reverseOrder = true; - - @XmlElement - String displayUnitStr = null; - -// @XmlElement -// @XmlJavaTypeAdapter(IntegerListAdapter.class) -// private ArrayList labeledPixels = new ArrayList(); + @XmlElement + private Boolean showLabels = true; - private static final Float defaultLength = .5f; - private static final int defaultWidth = 10; //change to 0.01 + @XmlElement + private Boolean reverseOrder = true; - @XmlElement - private Float lengthAsRatio = defaultLength; // as a ratio of the screen + @XmlElement + String displayUnitStr = null; - @XmlElement - private Integer widthInPixels = defaultWidth; // in pixels ? + // @XmlElement + // @XmlJavaTypeAdapter(IntegerListAdapter.class) + // private ArrayList labeledPixels = new ArrayList(); - private Display display = null; // the Display used to create the Colors in - // the intervals + private static final Float defaultLength = .5f; - private ImagePreferences imagePreferences = null; + private static final int defaultWidth = 10; // change to 0.01 - private Boolean isScalingAttemptedForThisColorMap = false; - - private ColorBarAttributesBuilder colorBarAttributesBuilder; + @XmlElement + private Float lengthAsRatio = defaultLength; // as a ratio of the screen + + @XmlElement + private Integer widthInPixels = defaultWidth; // in pixels ? + + private Display display = null; // the Display used to create the Colors in + // the intervals + + private ImagePreferences imagePreferences = null; + + private Boolean isScalingAttemptedForThisColorMap = false; + + private ColorBarAttributesBuilder colorBarAttributesBuilder; @XmlElement private Boolean drawColorBar = true; - + @XmlElement private Boolean drawBoxAroundColorBar = true; - + private double xPixelCoordFraction = 0.005; - - private double yPixelCoordFraction = 0.05; - - /** - * @param isScalingAttemptedForThisColorMap the isScalingAttemptedForThisColorMap to set - */ - public final void setIsScalingAttemptedForThisColorMap( - Boolean isScalingAttemptedForThisColorMap) { - this.isScalingAttemptedForThisColorMap = isScalingAttemptedForThisColorMap; - } + private double yPixelCoordFraction = 0.05; - /** - * @return the isScalingAttemptedForThisColorMap - */ - public final boolean isScalingAttemptedForThisColorMap() { - return isScalingAttemptedForThisColorMap.booleanValue(); - } + /** + * @param isScalingAttemptedForThisColorMap + * the isScalingAttemptedForThisColorMap to set + */ + public final void setIsScalingAttemptedForThisColorMap( + Boolean isScalingAttemptedForThisColorMap) { + this.isScalingAttemptedForThisColorMap = isScalingAttemptedForThisColorMap; + } - private boolean alignLabelInTheMiddleOfInterval; - - @Override - public void setAlignLabelInTheMiddleOfInterval(boolean b){ - alignLabelInTheMiddleOfInterval = b; - } - - - public ColorBarFromColormap() { - } + /** + * @return the isScalingAttemptedForThisColorMap + */ + public final boolean isScalingAttemptedForThisColorMap() { + return isScalingAttemptedForThisColorMap.booleanValue(); + } - public ColorBarFromColormap(ColorBarFromColormap cbar) { - if (cbar == null) { - return; - } -// colorMapName = (cbar.colorMapName == null ? null : new String( -// cbar.colorMapName)); - if (cbar.imagePreferences != null ) - imagePreferences = cbar.imagePreferences; - else - imagePreferences = new ImagePreferences(); - anchorLoc = cbar.anchorLoc; - orientation = cbar.orientation; - labelColor = cbar.labelColor; - dataUnits = cbar.dataUnits; - showLabels = cbar.showLabels; - lengthAsRatio = cbar.lengthAsRatio; - widthInPixels = cbar.widthInPixels; + private boolean alignLabelInTheMiddleOfInterval; + + @Override + public void setAlignLabelInTheMiddleOfInterval(boolean b) { + alignLabelInTheMiddleOfInterval = b; + } + + public ColorBarFromColormap() { + } + + public ColorBarFromColormap(ColorBarFromColormap cbar) { + if (cbar == null) { + return; + } + // colorMapName = (cbar.colorMapName == null ? null : new String( + // cbar.colorMapName)); + if (cbar.imagePreferences != null) + imagePreferences = cbar.imagePreferences; + else + imagePreferences = new ImagePreferences(); + anchorLoc = cbar.anchorLoc; + orientation = cbar.orientation; + labelColor = cbar.labelColor; + dataUnits = cbar.dataUnits; + showLabels = cbar.showLabels; + lengthAsRatio = cbar.lengthAsRatio; + widthInPixels = cbar.widthInPixels; reverseOrder = cbar.reverseOrder; alignLabelInTheMiddleOfInterval = cbar.alignLabelInTheMiddleOfInterval; isScalingAttemptedForThisColorMap = cbar.isScalingAttemptedForThisColorMap; colorBarAttributesBuilder = cbar.colorBarAttributesBuilder; alignLabelInTheMiddleOfInterval = cbar.alignLabelInTheMiddleOfInterval; - if (cbar.displayUnitStr != null ) - displayUnitStr = new String(cbar.displayUnitStr); - colorMap = null; - if( cbar.getColorMap() != null ) { - setColorMap(cbar.getColorMap()); - } - - } - -// public String getColorMapName() { -// return colorMapName; -// } -// -// // if a colormap is specified then the intervals & colors will -// // be defined by the colormap -// // The colormap name must also have the -// public void setColorMapName(String colorMapName) { -// this.colorMapName = colorMapName; -// // initFromColorMap( ); -// } - - public ColorMap getColorMap() { -// if (colorMapName != null && colorMap == null) { -// // initFromColorMap(); -// } - return colorMap; - } - - public boolean setColorMap(ColorMap cm) { - if (colorMap != null) { - // cleanup..... - pixelRGBs.clear(); - - for( Color clr : colors) { - clr.dispose(); - } - colors.clear(); - } - colorMap = cm; - if( colorMap == null || colorMap.getSize() == 0 ) { - return false; - } - - float[] reds = colorMap.getRed(); - float[] greens = colorMap.getGreen(); - float[] blues = colorMap.getBlue(); - - // interval units are pixels - dataUnits = null; - if (display == null ) - display = NcDisplayMngr.getActiveNatlCntrsEditor().getActiveDisplayPane().getDisplay(); - - for (int c = 0; c < reds.length; c++) { - RGB rgb = new RGB( scaleCmapValue(reds[c]), - scaleCmapValue(greens[c]), - scaleCmapValue(blues[c])); - pixelRGBs.add( rgb ); - colors.add(new Color(display, rgb)); - } - - - - return true; - } - - - public void scalePixelValues(){ - if ( colorMap != null && imagePreferences != null ){ - if (imagePreferences.getSamplePrefs() != null ){ - double maxValue = imagePreferences.getSamplePrefs().getMaxValue(); - if ( maxValue != 0 && maxValue != Double.NaN && maxValue > colorMap.getSize()){ - double scalingFactor = (int) Math.round(maxValue/ colorMap.getSize()); - DataMappingPreferences dmPref = imagePreferences.getDataMapping(); - if ( dmPref != null ){ - List dmEntriesList = dmPref.getEntries(); - if (dmEntriesList != null && dmEntriesList.size() > 0 ){ - isScalingAttemptedForThisColorMap = true; - for ( DataMappingEntry dmEntry : dmEntriesList ){ - double thisPixVal = dmEntry.getPixelValue().doubleValue(); - - double scaledPixVal = Math.round( thisPixVal); - - if ( thisPixVal >= scalingFactor){ - scaledPixVal = Math.round(thisPixVal/scalingFactor) ; - - if (scaledPixVal > colorMap.getSize() - 1) - scaledPixVal = colorMap.getSize() - 1; - - dmEntry.setPixelValue(scaledPixVal); - - } - - } - - DataMappingEntry[] dmEntryArray = new DataMappingEntry[dmEntriesList.size()]; - dmEntriesList.toArray(dmEntryArray); - dmPref.setSerializableEntries(dmEntryArray); - imagePreferences.setDataMapping(dmPref); - } - } - } - - } - } - } - - public int scaleCmapValue(float cmapVal) { - int rgbVal = (int) (cmapVal * 256); - return (rgbVal < 0 ? 0 : (rgbVal > 255 ? 255 : rgbVal)); - } - - public int getNumIntervals() { - return (colorMap != null ? colorMap.getSize() : 0); - } - - public RGB getLabelColor() { - return labelColor; - } - - public void setLabelColor(RGB labelColor) { - this.labelColor = labelColor; - } - - public Boolean getShowLabels() { - return showLabels; - } - - public void setShowLabels(Boolean showLabels) { - this.showLabels = showLabels; - } - - public Boolean getDrawToScale() { - return false; - } - - public void setDrawToScale(Boolean drawToScale) { -// System.out.println("drawToScale not applicable for Image ColorBars"); - } - - // public Unit getDataUnits() { - // return dataUnits; - // } - // - // public void setDataUnits(Unit dataUnits) { - // this.dataUnits = dataUnits; - // } - public ColorBarOrientation getOrientation() { - return orientation; - } - -// public void setOrientation1(ColorBarOrientation orientation) { -// this.orientation = orientation; -// } - - public ColorBarAnchorLocation getAnchorLoc() { - return anchorLoc; - } - -// public void setAnchorLoc1(ColorBarAnchorLocation anchorLoc) { -// this.anchorLoc = anchorLoc; -// } - - public int getNumDecimals() { - return 0; - } - - public void setNumDecimals(int numDecimals) { -// System.out.println("numDecimals not applicable for Image ColorBars"); - } - - // This doesn't really have a meaning for image colorbars - // - public void addColorBarInterval(Float min, Float max, RGB rgb) { - // colorMapModified = true; - } - - // - // Methods to get/set values for the colorBar pixels/intervals and colors - // - public RGB getRGB(int p) { - return (p < pixelRGBs.size() ? pixelRGBs.get(p) : null); - } - - public void setRGB(int c, RGB rgb) { - if (c < 0 || c >= getNumIntervals()) { - return; - } - colorMapModified = true; - - pixelRGBs.set(c, rgb); - - if( display != null ) { - colors.get(c).dispose(); - colors.set(c, new Color(display, rgb)); - } - colorMap = null; - } - - public Float getIntervalMin(int c) { - return (float)c; - } - - public Float getIntervalMax(int c) { - return (float) (c + 1); - } - - public boolean isValueInInterval(int c, Float value, Unit units) { - return false; // no-op for images - } - - public void setIntervalMin(int c, Float min) { - } - - public void setIntervalMax(int c, Float max) { - } - - // if numIntervals is passed in we will return the max value of the last - // interval - public String getLabelString(int i) { - if (!showLabels || i >= getNumIntervals() - || imagePreferences == null - || imagePreferences.getDataMapping() == null) { - return null; - } - // if applying to a colorMap then use the labeledPixels map - // otherwise get the value of the interval -// else { -// return (isPixelLabeled(i) ? Integer.toString(i) : null); -// } - - return imagePreferences.getDataMapping().getLabelValueForDataValue(i); - - } - - public void createNewInterval(int c) { - // currently do not support adding entries in the colormap - //colorMapModified = true; - } - - public void removeInterval(int c) { - // currently do not support removing entries from the colormap - //colorMapModified = true; - } - - // all the Colors in the intervals list will have this same device - public void setColorDevice(Display disp) { - if (display != disp) { - display = disp; - - for (Color c : colors) { - c.dispose(); - } - colors.clear(); - - for (int i = 0; i < getNumIntervals(); i++) { - colors.add(new Color(display, pixelRGBs.get(i))); - } - } - } - - public void dispose() { - if (display != null) { - display = null; - - for (Color c : colors) { - c.dispose(); - // colors.remove(c); - } - colors.clear(); - } - - showLabels = false; - imagePreferences = null; - displayUnitStr = null; - - } - - public boolean unlabelPixel(int p) { - - if ( imagePreferences == null ) - return false; - - DataMappingPreferences dmPref = imagePreferences.getDataMapping(); - if(dmPref != null){ - ListdmEntriesList = dmPref.getEntries(); - if (dmEntriesList != null && !dmEntriesList.isEmpty()){ - Iterator itr = dmEntriesList.iterator(); - - while(itr.hasNext()){ - if(itr.next().equals(new Double(p))){ - itr.remove(); - break; - } - } - } - } - return false; - } - - public boolean isPixelLabeled(int p) { - if(imagePreferences == null) - return false; - - DataMappingPreferences dmPref = imagePreferences.getDataMapping(); - - if( dmPref == null ) - return false; - - if (dmPref.getLabelValueForDataValue((double)p) == null ) - return false; - else - return true; -// return labeledPixels.contains(new Integer(p)); - } - -// public void removeAllLabels() { -// labeledPixels.clear(); -// } - - public float getDiscreteRange() { - return getNumIntervals(); - } - - public Color getColor(int intrvl) { - if( display == null ) { - return null; - } - - if( intrvl < getNumIntervals() ) { - // if for some reason there are fewer colors than intervals then fill in the colors - // array from the rgb array - while( colors.size() < getNumIntervals() ) { - colors.add( new Color( display, getRGB( colors.size() ) ) ); - } - return colors.get(intrvl); - } - else return null; - } - - public Unit getDataUnits() { - return null; - } - - public Float getLengthAsRatio() { - return lengthAsRatio; - } - - public Integer getWidthInPixels() { - return widthInPixels; - } - - /** - * For a pixel p, applies the corresponding label lblStr - */ - public void labelInterval(int p, String lblStr) { - if (lblStr != null) { - labelPixel(p,lblStr); - } else { - unlabelPixel(p); - } - } - - public void labelPixel(int p,String lblStr) { // , String lblStr ) { - - if ( lblStr == null || imagePreferences == null ) - return; - - DataMappingPreferences dmPref = imagePreferences.getDataMapping(); - if(dmPref != null){ - ListdmEntriesList = dmPref.getEntries(); - if (dmEntriesList != null && !dmEntriesList.isEmpty()){ - if(!dmEntriesList.contains(new Double(p))){ - DataMappingEntry dmEntry = new DataMappingEntry(); - dmEntry.setPixelValue((double)p); - dmEntry.setLabel(lblStr); - dmEntriesList.add(dmEntry); - DataMappingEntry[] entryArray = new DataMappingEntry[dmEntriesList.size()]; - dmEntriesList.toArray(entryArray); - dmPref.setSerializableEntries(entryArray); - imagePreferences.setDataMapping(dmPref); - } - } - } - - } - - public boolean isIntervalLabeled(int intrvl) { - return isPixelLabeled(intrvl); - } - - public void setDataUnits(Unit dataUnits) { - - } - - public void setLengthAsRatio(Float l) { - lengthAsRatio = l; - } - - public void setWidthInPixels(Integer w) { - widthInPixels = w; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result - + ((anchorLoc == null) ? 0 : anchorLoc.hashCode()); - result = prime * result - + ((colorMap == null) ? 0 : colorMap.hashCode()); - result = prime - * result - + ((colorMapModified == null) ? 0 : colorMapModified.hashCode()); - result = prime * result + ((colors == null) ? 0 : colors.hashCode()); - result = prime * result - + ((dataUnits == null) ? 0 : dataUnits.hashCode()); - result = prime * result - + ((labelColor == null) ? 0 : labelColor.hashCode()); -// result = prime * result -// + ((labeledPixels == null) ? 0 : labeledPixels.hashCode()); - result = prime * result - + ((lengthAsRatio == null) ? 0 : lengthAsRatio.hashCode()); - result = prime * result - + ((orientation == null) ? 0 : orientation.hashCode()); - result = prime * result - + ((pixelRGBs == null) ? 0 : pixelRGBs.hashCode()); - result = prime * result - + ((showLabels == null) ? 0 : showLabels.hashCode()); - result = prime * result - + ((widthInPixels == null) ? 0 : widthInPixels.hashCode()); - result = prime * result - + ((imagePreferences == null) ? 0 : imagePreferences.hashCode()); - - result = prime * result - + ((reverseOrder == null) ? 0 : reverseOrder.hashCode()); - - result = prime * result - + ((isScalingAttemptedForThisColorMap == null) ? 0 : isScalingAttemptedForThisColorMap.hashCode()); - - result = prime * result - + ((colorBarAttributesBuilder == null) ? 0 : colorBarAttributesBuilder.hashCode()); - - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof ColorBarFromColormap)) - return false; - - ColorBarFromColormap other = (ColorBarFromColormap) obj; - if (anchorLoc != other.anchorLoc) - return false; - if (colorMap == null) { - if (other.colorMap != null) - return false; - } else if (!colorMap.equals(other.colorMap)) - return false; - if (colorMapModified == null) { - if (other.colorMapModified != null) - return false; - } else if (!colorMapModified.equals(other.colorMapModified)) - return false; - if (colors == null) { - if (other.colors != null) - return false; - } else if (!colors.equals(other.colors)) - return false; - if (dataUnits == null) { - if (other.dataUnits != null) - return false; - } else if (!dataUnits.equals(other.dataUnits)) - return false; - if (labelColor == null) { - if (other.labelColor != null) - return false; - } else if (!labelColor.equals(other.labelColor)) - return false; -// if (labeledPixels == null) { -// if (other.labeledPixels != null) -// return false; -// } else if (!labeledPixels.equals(other.labeledPixels)) -// return false; - if (lengthAsRatio == null) { - if (other.lengthAsRatio != null) - return false; - } else if (!lengthAsRatio.equals(other.lengthAsRatio)) - return false; - if (orientation != other.orientation) - return false; - if (pixelRGBs == null) { - if (other.pixelRGBs != null) - return false; - } else if (!pixelRGBs.equals(other.pixelRGBs)) - return false; - if (showLabels == null) { - if (other.showLabels != null) - return false; - } else if (!showLabels.equals(other.showLabels)) - return false; - if (widthInPixels == null) { - if (other.widthInPixels != null) - return false; - } else if (!widthInPixels.equals(other.widthInPixels)) - return false; - - if (imagePreferences == null) { - if (other.imagePreferences != null) - return false; - } else if (!imagePreferences.equals(other.imagePreferences)) - return false; - - if (reverseOrder == null) { - if (other.reverseOrder != null) - return false; - } else if (!reverseOrder.equals(other.reverseOrder)) - return false; - - if (isScalingAttemptedForThisColorMap == null) { - if (other.isScalingAttemptedForThisColorMap != null) - return false; - } else if (!isScalingAttemptedForThisColorMap.equals(other.isScalingAttemptedForThisColorMap)) - return false; - - - if (colorBarAttributesBuilder == null) { - if (other.colorBarAttributesBuilder != null) - return false; - } else if (!colorBarAttributesBuilder.equals(other.colorBarAttributesBuilder)) - return false; - - return true; - } - - /** - * @param imagePreferences the imagePreferences to set - */ - public void setImagePreferences(ImagePreferences imgPref) { - this.imagePreferences = imgPref; - } - - /** - * @return the imagePreferences - */ - public ImagePreferences getImagePreferences() { - return imagePreferences; - } - - /** - * @return the reverseOrder - */ - @Override - public Boolean getReverseOrder() { - return reverseOrder; - } - - /** - * @param reverseOrder the reverseOrder to set - */ - - @Override - public void setReverseOrder(Boolean reverseOrder) { - this.reverseOrder = reverseOrder; - } - - /** - * @return the pixelRGBs - */ - public final ArrayList getPixelRGBs() { - return pixelRGBs; - } - - /** - * @param displayUnitStr the displayUnitStr to set - */ - public void setDisplayUnitStr(String displayUnitStr) { - this.displayUnitStr = displayUnitStr; - } - - /** - * @return the displayUnitStr - */ - @Override - public String getDisplayUnitStr() { - return displayUnitStr; - } - - @Override - public boolean isAlignLabelInTheMiddleOfInterval(){ - return alignLabelInTheMiddleOfInterval; - } - - public void setNumPixelsToReAlignLabel(boolean n){ - alignLabelInTheMiddleOfInterval = n; - } - - /** - * @return the colorBarAttributesBuilder - */ - public final ColorBarAttributesBuilder getColorBarAttributesBuilder() { - return colorBarAttributesBuilder; - } - - /** - * @param colorBarAttributesBuilder the colorBarAttributesBuilder to set - */ - public final void setColorBarAttributesBuilder( - ColorBarAttributesBuilder colorBarAttributesBuilder) { - this.colorBarAttributesBuilder = colorBarAttributesBuilder; - } - - @Override - public void setOrientation(ColorBarOrientation orientation) { - this.orientation = orientation; - - } - - @Override - public void setAnchorLoc(ColorBarAnchorLocation anchorLoc) { - this.anchorLoc = anchorLoc; - } - - @Override - public void setAttributesFromColorBarAttributesBuilder( - ColorBarAttributesBuilder colorBarAttributesBuilder) { - /* - * To be used when the GEMPAK parameter IMCBAR is implemented - */ - if (colorBarAttributesBuilder != null ){ - - setLengthAsRatio( (float) colorBarAttributesBuilder.getLength()); - setWidthInPixels( new Integer ( (int) colorBarAttributesBuilder.getWidth() * 1000)); - setAnchorLoc(colorBarAttributesBuilder.getAnchorLocation()); - setOrientation(colorBarAttributesBuilder.getColorBarOrientation()); - - setXPixelCoordFraction(colorBarAttributesBuilder.getX()); - setYPixelCoordFraction(colorBarAttributesBuilder.getY()); - setLabelColor(colorBarAttributesBuilder.getColor()); - setDrawBoxAroundColorBar(colorBarAttributesBuilder.isDrawBoxAroundColorBar()); - setDrawColorBar(colorBarAttributesBuilder.isDrawColorBar() ); - } - } - - /** - * @return the drawColorBar - */ - public final Boolean isDrawColorBar() { - return drawColorBar; - } - - /** - * @param drawColorBar the drawColorBar to set - */ - public final void setDrawColorBar(Boolean drawColorBar) { - this.drawColorBar = drawColorBar; - } - - /** - * @return the drawBoxAroundColorBar - */ - public final Boolean isDrawBoxAroundColorBar() { - return drawBoxAroundColorBar; - } - - /** - * @param drawBoxAroundColorBar the drawBoxAroundColorBar to set - */ - public final void setDrawBoxAroundColorBar(Boolean drawBoxAroundColorBar) { - this.drawBoxAroundColorBar = drawBoxAroundColorBar; - } - - /** - * @return the xPixelCoordFraction - */ - public final double getXPixelCoordFraction() { - return xPixelCoordFraction; - } - - /** - * @param xPixelCoordFraction the xPixelCoordFraction to set - */ - public final void setXPixelCoordFraction(double xPixelCoordFraction) { - this.xPixelCoordFraction = xPixelCoordFraction; - } - - /** - * @return the yPixelCoordFraction - */ - public final double getYPixelCoordFraction() { - return yPixelCoordFraction; - } - - /** - * @param yPixelCoordFraction the yPixelCoordFraction to set - */ - public final void setYPixelCoordFraction(double yPixelCoordFraction) { - this.yPixelCoordFraction = yPixelCoordFraction; - } - - - @Override - public void removeAllLabels() { - if(imagePreferences == null ) - return; - - DataMappingPreferences dmPref = imagePreferences.getDataMapping(); - - if(dmPref == null ) - return; - - dmPref.getEntries().clear(); - - } - + if (cbar.displayUnitStr != null) + displayUnitStr = new String(cbar.displayUnitStr); + colorMap = null; + if (cbar.getColorMap() != null) { + setColorMap(cbar.getColorMap()); + } + + } + + // public String getColorMapName() { + // return colorMapName; + // } + // + // // if a colormap is specified then the intervals & colors will + // // be defined by the colormap + // // The colormap name must also have the + // public void setColorMapName(String colorMapName) { + // this.colorMapName = colorMapName; + // // initFromColorMap( ); + // } + + public ColorMap getColorMap() { + // if (colorMapName != null && colorMap == null) { + // // initFromColorMap(); + // } + return colorMap; + } + + public boolean setColorMap(ColorMap cm) { + if (colorMap != null) { + // cleanup..... + pixelRGBs.clear(); + + for (Color clr : colors) { + clr.dispose(); + } + colors.clear(); + } + colorMap = cm; + if (colorMap == null || colorMap.getSize() == 0) { + return false; + } + + float[] reds = colorMap.getRed(); + float[] greens = colorMap.getGreen(); + float[] blues = colorMap.getBlue(); + + // interval units are pixels + dataUnits = null; + if (display == null) + display = NcDisplayMngr.getActiveNatlCntrsEditor() + .getActiveDisplayPane().getDisplay(); + + for (int c = 0; c < reds.length; c++) { + RGB rgb = new RGB(scaleCmapValue(reds[c]), + scaleCmapValue(greens[c]), scaleCmapValue(blues[c])); + pixelRGBs.add(rgb); + colors.add(new Color(display, rgb)); + } + + return true; + } + + public void scalePixelValues() { + if (colorMap != null && imagePreferences != null) { + if (imagePreferences.getSamplePrefs() != null) { + double maxValue = imagePreferences.getSamplePrefs() + .getMaxValue(); + if (maxValue != 0 && maxValue != Double.NaN + && maxValue > colorMap.getSize()) { + double scalingFactor = (int) Math.round(maxValue + / colorMap.getSize()); + DataMappingPreferences dmPref = imagePreferences + .getDataMapping(); + if (dmPref != null) { + List dmEntriesList = dmPref + .getEntries(); + if (dmEntriesList != null && dmEntriesList.size() > 0) { + isScalingAttemptedForThisColorMap = true; + for (DataMappingEntry dmEntry : dmEntriesList) { + double thisPixVal = dmEntry.getPixelValue() + .doubleValue(); + + double scaledPixVal = Math.round(thisPixVal); + + if (thisPixVal >= scalingFactor) { + scaledPixVal = Math.round(thisPixVal + / scalingFactor); + + if (scaledPixVal > colorMap.getSize() - 1) + scaledPixVal = colorMap.getSize() - 1; + + dmEntry.setPixelValue(scaledPixVal); + + } + + } + + DataMappingEntry[] dmEntryArray = new DataMappingEntry[dmEntriesList + .size()]; + dmEntriesList.toArray(dmEntryArray); + dmPref.setSerializableEntries(dmEntryArray); + imagePreferences.setDataMapping(dmPref); + } + } + } + + } + } + } + + public int scaleCmapValue(float cmapVal) { + int rgbVal = (int) (cmapVal * 256); + return (rgbVal < 0 ? 0 : (rgbVal > 255 ? 255 : rgbVal)); + } + + public int getNumIntervals() { + return (colorMap != null ? colorMap.getSize() : 0); + } + + public RGB getLabelColor() { + return labelColor; + } + + public void setLabelColor(RGB labelColor) { + this.labelColor = labelColor; + } + + public Boolean getShowLabels() { + return showLabels; + } + + public void setShowLabels(Boolean showLabels) { + this.showLabels = showLabels; + } + + public Boolean getDrawToScale() { + return false; + } + + public void setDrawToScale(Boolean drawToScale) { + // System.out.println("drawToScale not applicable for Image ColorBars"); + } + + // public Unit getDataUnits() { + // return dataUnits; + // } + // + // public void setDataUnits(Unit dataUnits) { + // this.dataUnits = dataUnits; + // } + public ColorBarOrientation getOrientation() { + return orientation; + } + + // public void setOrientation1(ColorBarOrientation orientation) { + // this.orientation = orientation; + // } + + public ColorBarAnchorLocation getAnchorLoc() { + return anchorLoc; + } + + // public void setAnchorLoc1(ColorBarAnchorLocation anchorLoc) { + // this.anchorLoc = anchorLoc; + // } + + public int getNumDecimals() { + return 0; + } + + public void setNumDecimals(int numDecimals) { + // System.out.println("numDecimals not applicable for Image ColorBars"); + } + + // This doesn't really have a meaning for image colorbars + // + public void addColorBarInterval(Float min, Float max, RGB rgb) { + // colorMapModified = true; + } + + // + // Methods to get/set values for the colorBar pixels/intervals and colors + // + public RGB getRGB(int p) { + return (p < pixelRGBs.size() ? pixelRGBs.get(p) : null); + } + + public void setRGB(int c, RGB rgb) { + if (c < 0 || c >= getNumIntervals()) { + return; + } + colorMapModified = true; + + pixelRGBs.set(c, rgb); + + if (display != null) { + colors.get(c).dispose(); + colors.set(c, new Color(display, rgb)); + } + colorMap = null; + } + + public Float getIntervalMin(int c) { + return (float) c; + } + + public Float getIntervalMax(int c) { + return (float) (c + 1); + } + + public boolean isValueInInterval(int c, Float value, Unit units) { + return false; // no-op for images + } + + public void setIntervalMin(int c, Float min) { + } + + public void setIntervalMax(int c, Float max) { + } + + // if numIntervals is passed in we will return the max value of the last + // interval + public String getLabelString(int i) { + if (!showLabels || i >= getNumIntervals() || imagePreferences == null + || imagePreferences.getDataMapping() == null) { + return null; + } + // if applying to a colorMap then use the labeledPixels map + // otherwise get the value of the interval + // else { + // return (isPixelLabeled(i) ? Integer.toString(i) : null); + // } + + return imagePreferences.getDataMapping().getLabelValueForDataValue(i); + + } + + public void createNewInterval(int c) { + // currently do not support adding entries in the colormap + // colorMapModified = true; + } + + public void removeInterval(int c) { + // currently do not support removing entries from the colormap + // colorMapModified = true; + } + + // all the Colors in the intervals list will have this same device + public void setColorDevice(Display disp) { + if (display != disp) { + display = disp; + + for (Color c : colors) { + c.dispose(); + } + colors.clear(); + + for (int i = 0; i < getNumIntervals(); i++) { + colors.add(new Color(display, pixelRGBs.get(i))); + } + } + } + + public void dispose() { + if (display != null) { + display = null; + + for (Color c : colors) { + c.dispose(); + // colors.remove(c); + } + colors.clear(); + } + + showLabels = false; + imagePreferences = null; + displayUnitStr = null; + + } + + public boolean unlabelPixel(int p) { + + if (imagePreferences == null) + return false; + + DataMappingPreferences dmPref = imagePreferences.getDataMapping(); + if (dmPref != null) { + List dmEntriesList = dmPref.getEntries(); + if (dmEntriesList != null && !dmEntriesList.isEmpty()) { + Iterator itr = dmEntriesList.iterator(); + + while (itr.hasNext()) { + if (itr.next().equals(new Double(p))) { + itr.remove(); + break; + } + } + } + } + return false; + } + + public boolean isPixelLabeled(int p) { + if (imagePreferences == null) + return false; + + DataMappingPreferences dmPref = imagePreferences.getDataMapping(); + + if (dmPref == null) + return false; + + if (dmPref.getLabelValueForDataValue((double) p) == null) + return false; + else + return true; + // return labeledPixels.contains(new Integer(p)); + } + + // public void removeAllLabels() { + // labeledPixels.clear(); + // } + + public float getDiscreteRange() { + return getNumIntervals(); + } + + public Color getColor(int intrvl) { + if (display == null) { + return null; + } + + if (intrvl < getNumIntervals()) { + // if for some reason there are fewer colors than intervals then + // fill in the colors + // array from the rgb array + while (colors.size() < getNumIntervals()) { + colors.add(new Color(display, getRGB(colors.size()))); + } + return colors.get(intrvl); + } else + return null; + } + + public Unit getDataUnits() { + return null; + } + + public Float getLengthAsRatio() { + return lengthAsRatio; + } + + public Integer getWidthInPixels() { + return widthInPixels; + } + + /** + * For a pixel p, applies the corresponding label lblStr + */ + public void labelInterval(int p, String lblStr) { + if (lblStr != null) { + labelPixel(p, lblStr); + } else { + unlabelPixel(p); + } + } + + public void labelPixel(int p, String lblStr) { // , String lblStr ) { + + if (lblStr == null || imagePreferences == null) + return; + + DataMappingPreferences dmPref = imagePreferences.getDataMapping(); + if (dmPref != null) { + List dmEntriesList = dmPref.getEntries(); + if (dmEntriesList != null && !dmEntriesList.isEmpty()) { + if (!dmEntriesList.contains(new Double(p))) { + DataMappingEntry dmEntry = new DataMappingEntry(); + dmEntry.setPixelValue((double) p); + dmEntry.setLabel(lblStr); + dmEntriesList.add(dmEntry); + DataMappingEntry[] entryArray = new DataMappingEntry[dmEntriesList + .size()]; + dmEntriesList.toArray(entryArray); + dmPref.setSerializableEntries(entryArray); + imagePreferences.setDataMapping(dmPref); + } + } + } + + } + + public boolean isIntervalLabeled(int intrvl) { + return isPixelLabeled(intrvl); + } + + public void setDataUnits(Unit dataUnits) { + + } + + public void setLengthAsRatio(Float l) { + lengthAsRatio = l; + } + + public void setWidthInPixels(Integer w) { + widthInPixels = w; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((anchorLoc == null) ? 0 : anchorLoc.hashCode()); + result = prime * result + + ((colorMap == null) ? 0 : colorMap.hashCode()); + result = prime + * result + + ((colorMapModified == null) ? 0 : colorMapModified.hashCode()); + result = prime * result + ((colors == null) ? 0 : colors.hashCode()); + result = prime * result + + ((dataUnits == null) ? 0 : dataUnits.hashCode()); + result = prime * result + + ((labelColor == null) ? 0 : labelColor.hashCode()); + // result = prime * result + // + ((labeledPixels == null) ? 0 : labeledPixels.hashCode()); + result = prime * result + + ((lengthAsRatio == null) ? 0 : lengthAsRatio.hashCode()); + result = prime * result + + ((orientation == null) ? 0 : orientation.hashCode()); + result = prime * result + + ((pixelRGBs == null) ? 0 : pixelRGBs.hashCode()); + result = prime * result + + ((showLabels == null) ? 0 : showLabels.hashCode()); + result = prime * result + + ((widthInPixels == null) ? 0 : widthInPixels.hashCode()); + result = prime + * result + + ((imagePreferences == null) ? 0 : imagePreferences.hashCode()); + + result = prime * result + + ((reverseOrder == null) ? 0 : reverseOrder.hashCode()); + + result = prime + * result + + ((isScalingAttemptedForThisColorMap == null) ? 0 + : isScalingAttemptedForThisColorMap.hashCode()); + + result = prime + * result + + ((colorBarAttributesBuilder == null) ? 0 + : colorBarAttributesBuilder.hashCode()); + + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ColorBarFromColormap)) + return false; + + ColorBarFromColormap other = (ColorBarFromColormap) obj; + if (anchorLoc != other.anchorLoc) + return false; + if (colorMap == null) { + if (other.colorMap != null) + return false; + } else if (!colorMap.equals(other.colorMap)) + return false; + if (colorMapModified == null) { + if (other.colorMapModified != null) + return false; + } else if (!colorMapModified.equals(other.colorMapModified)) + return false; + if (colors == null) { + if (other.colors != null) + return false; + } else if (!colors.equals(other.colors)) + return false; + if (dataUnits == null) { + if (other.dataUnits != null) + return false; + } else if (!dataUnits.equals(other.dataUnits)) + return false; + if (labelColor == null) { + if (other.labelColor != null) + return false; + } else if (!labelColor.equals(other.labelColor)) + return false; + // if (labeledPixels == null) { + // if (other.labeledPixels != null) + // return false; + // } else if (!labeledPixels.equals(other.labeledPixels)) + // return false; + if (lengthAsRatio == null) { + if (other.lengthAsRatio != null) + return false; + } else if (!lengthAsRatio.equals(other.lengthAsRatio)) + return false; + if (orientation != other.orientation) + return false; + if (pixelRGBs == null) { + if (other.pixelRGBs != null) + return false; + } else if (!pixelRGBs.equals(other.pixelRGBs)) + return false; + if (showLabels == null) { + if (other.showLabels != null) + return false; + } else if (!showLabels.equals(other.showLabels)) + return false; + if (widthInPixels == null) { + if (other.widthInPixels != null) + return false; + } else if (!widthInPixels.equals(other.widthInPixels)) + return false; + + if (imagePreferences == null) { + if (other.imagePreferences != null) + return false; + } else if (!imagePreferences.equals(other.imagePreferences)) + return false; + + if (reverseOrder == null) { + if (other.reverseOrder != null) + return false; + } else if (!reverseOrder.equals(other.reverseOrder)) + return false; + + if (isScalingAttemptedForThisColorMap == null) { + if (other.isScalingAttemptedForThisColorMap != null) + return false; + } else if (!isScalingAttemptedForThisColorMap + .equals(other.isScalingAttemptedForThisColorMap)) + return false; + + if (colorBarAttributesBuilder == null) { + if (other.colorBarAttributesBuilder != null) + return false; + } else if (!colorBarAttributesBuilder + .equals(other.colorBarAttributesBuilder)) + return false; + + return true; + } + + /** + * @param imagePreferences + * the imagePreferences to set + */ + public void setImagePreferences(ImagePreferences imgPref) { + this.imagePreferences = imgPref; + } + + /** + * @return the imagePreferences + */ + public ImagePreferences getImagePreferences() { + return imagePreferences; + } + + /** + * @return the reverseOrder + */ + @Override + public Boolean getReverseOrder() { + return reverseOrder; + } + + /** + * @param reverseOrder + * the reverseOrder to set + */ + + @Override + public void setReverseOrder(Boolean reverseOrder) { + this.reverseOrder = reverseOrder; + } + + /** + * @return the pixelRGBs + */ + public final ArrayList getPixelRGBs() { + return pixelRGBs; + } + + /** + * @param displayUnitStr + * the displayUnitStr to set + */ + public void setDisplayUnitStr(String displayUnitStr) { + this.displayUnitStr = displayUnitStr; + } + + /** + * @return the displayUnitStr + */ + @Override + public String getDisplayUnitStr() { + return displayUnitStr; + } + + @Override + public boolean isAlignLabelInTheMiddleOfInterval() { + return alignLabelInTheMiddleOfInterval; + } + + public void setNumPixelsToReAlignLabel(boolean n) { + alignLabelInTheMiddleOfInterval = n; + } + + /** + * @return the colorBarAttributesBuilder + */ + public final ColorBarAttributesBuilder getColorBarAttributesBuilder() { + return colorBarAttributesBuilder; + } + + /** + * @param colorBarAttributesBuilder + * the colorBarAttributesBuilder to set + */ + public final void setColorBarAttributesBuilder( + ColorBarAttributesBuilder colorBarAttributesBuilder) { + this.colorBarAttributesBuilder = colorBarAttributesBuilder; + } + + @Override + public void setOrientation(ColorBarOrientation orientation) { + this.orientation = orientation; + + } + + @Override + public void setAnchorLoc(ColorBarAnchorLocation anchorLoc) { + this.anchorLoc = anchorLoc; + } + + @Override + public void setAttributesFromColorBarAttributesBuilder( + ColorBarAttributesBuilder colorBarAttributesBuilder) { + /* + * To be used when the GEMPAK parameter IMCBAR is implemented + */ + if (colorBarAttributesBuilder != null) { + + setLengthAsRatio((float) colorBarAttributesBuilder.getLength()); + setWidthInPixels(new Integer( + (int) colorBarAttributesBuilder.getWidth() * 1000)); + setAnchorLoc(colorBarAttributesBuilder.getAnchorLocation()); + setOrientation(colorBarAttributesBuilder.getColorBarOrientation()); + + setXPixelCoordFraction(colorBarAttributesBuilder.getX()); + setYPixelCoordFraction(colorBarAttributesBuilder.getY()); + setLabelColor(colorBarAttributesBuilder.getColor()); + setDrawBoxAroundColorBar(colorBarAttributesBuilder + .isDrawBoxAroundColorBar()); + setDrawColorBar(colorBarAttributesBuilder.isDrawColorBar()); + } + } + + /** + * @return the drawColorBar + */ + public final Boolean isDrawColorBar() { + return drawColorBar; + } + + /** + * @param drawColorBar + * the drawColorBar to set + */ + public final void setDrawColorBar(Boolean drawColorBar) { + this.drawColorBar = drawColorBar; + } + + /** + * @return the drawBoxAroundColorBar + */ + public final Boolean isDrawBoxAroundColorBar() { + return drawBoxAroundColorBar; + } + + /** + * @param drawBoxAroundColorBar + * the drawBoxAroundColorBar to set + */ + public final void setDrawBoxAroundColorBar(Boolean drawBoxAroundColorBar) { + this.drawBoxAroundColorBar = drawBoxAroundColorBar; + } + + /** + * @return the xPixelCoordFraction + */ + public final double getXPixelCoordFraction() { + return xPixelCoordFraction; + } + + /** + * @param xPixelCoordFraction + * the xPixelCoordFraction to set + */ + public final void setXPixelCoordFraction(double xPixelCoordFraction) { + this.xPixelCoordFraction = xPixelCoordFraction; + } + + /** + * @return the yPixelCoordFraction + */ + public final double getYPixelCoordFraction() { + return yPixelCoordFraction; + } + + /** + * @param yPixelCoordFraction + * the yPixelCoordFraction to set + */ + public final void setYPixelCoordFraction(double yPixelCoordFraction) { + this.yPixelCoordFraction = yPixelCoordFraction; + } + + @Override + public void removeAllLabels() { + if (imagePreferences == null) + return; + + DataMappingPreferences dmPref = imagePreferences.getDataMapping(); + + if (dmPref == null) + return; + + dmPref.getEntries().clear(); + + } }