From f292f204c9154baafcce58f8a617ebdcc4fe54e3 Mon Sep 17 00:00:00 2001 From: Ben Steffensmeier Date: Wed, 11 Jun 2014 13:45:05 -0500 Subject: [PATCH] Omaha #2061 Remove references to IDecoderGettable.Amount from Range Rings. Former-commit-id: e267e8b0bae314abf3396db6072c6ff8adc732bf --- .../IRangeableResource.java | 18 ++-- .../ui/layer/RangeRingsOverlayLayer.java | 23 ++--- .../viz/radar/rsc/AbstractRadarResource.java | 62 ++----------- .../viz/radar/rsc/RadarImageResource.java | 12 ++- .../radar/rsc/image/RadarRadialResource.java | 89 ++++++++++++++----- 5 files changed, 106 insertions(+), 98 deletions(-) diff --git a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/capabilityInterfaces/IRangeableResource.java b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/capabilityInterfaces/IRangeableResource.java index b2e7369590..07065414d7 100644 --- a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/capabilityInterfaces/IRangeableResource.java +++ b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/capabilityInterfaces/IRangeableResource.java @@ -19,28 +19,34 @@ **/ package com.raytheon.viz.awipstools.capabilityInterfaces; -import com.raytheon.uf.common.dataplugin.IDecoderGettable.Amount; +import javax.measure.Measure; +import javax.measure.quantity.Length; + +import com.raytheon.uf.viz.core.rsc.AbstractVizResource; +import com.raytheon.viz.awipstools.ui.layer.RangeRingsOverlayLayer; import com.vividsolutions.jts.geom.Coordinate; /** - * TODO Add Description + * Interface for {@link AbstractVizResource}s that are able to provide + * information that can be used to draw range rings. * *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Jun 11, 2014  2061     bsteffen    Switch from Amount to Measure.
  * 
  * 
* * @author bgonzale * @version 1.0 + * @see RangeRingsOverlayLayer */ public interface IRangeableResource { - public Amount getElevation(); + public Measure getElevation(); public Coordinate getCenter(); diff --git a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/layer/RangeRingsOverlayLayer.java b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/layer/RangeRingsOverlayLayer.java index 0c49f74659..43d4f967f4 100644 --- a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/layer/RangeRingsOverlayLayer.java +++ b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/layer/RangeRingsOverlayLayer.java @@ -54,12 +54,15 @@ import com.vividsolutions.jts.geom.Envelope; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- *  12-03-09     #3698      bgonzale    Range rings overlay with labels 
- *                                      for radius in km and miles and
- *                                      labels for elevation in ftMSL and
- *                                      kmAgl.
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Dec 03, 2009  3698     bgonzale    Range rings overlay with labels 
+ *                                    for radius in km and miles and
+ *                                    labels for elevation in ftMSL and
+ *                                    kmAgl.
+ * Jun 11, 2014  2061     bsteffen    Switch IRangeableResource to return
+ *                                    Measure.
+ * 
  * 
  * 
  * 
@@ -139,8 +142,7 @@ public class RangeRingsOverlayLayer implements IRenderable { this.rangedResource = rangedResource; this.center = this.rangedResource.getCenter(); this.resourceSourceElevationInMeters = this.rangedResource - .getElevation().getUnit().getConverterTo(SI.METER) - .convert(this.rangedResource.getElevation().doubleValue()); + .getElevation().doubleValue(SI.METER); this.gc.setStartingGeographicPoint(this.center.x, this.center.y); updateTilt(); } @@ -151,15 +153,16 @@ public class RangeRingsOverlayLayer implements IRenderable { * @seecom.raytheon.viz.core.rsc.IVizResource#paint(com.raytheon.viz.core. * IGraphicsTarget, com.raytheon.viz.core.PixelExtent, double, float) */ + @Override public void paint(IGraphicsTarget target, PaintProperties paintProps) throws VizException { // calculate ring spacing to use, in miles - float zoomLevel = (float) paintProps.getZoomLevel(); + float zoomLevel = paintProps.getZoomLevel(); IExtent pixelExtent = paintProps.getView().getExtent(); float metersZoomConstant = 500000; int mapWidth = descriptor.getMapWidth(); - float dataZoom = (float) ((mapWidth * zoomLevel) / metersZoomConstant); + float dataZoom = (mapWidth * zoomLevel) / metersZoomConstant; double dRing = getStandardRadius(dataZoom); IWireframeShape shape = getRangeRingsWireframe(dRing, pixelExtent, diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/AbstractRadarResource.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/AbstractRadarResource.java index bcb2df5310..92f68c3904 100644 --- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/AbstractRadarResource.java +++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/AbstractRadarResource.java @@ -27,13 +27,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.measure.unit.NonSI; - import org.opengis.referencing.FactoryException; import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; -import com.raytheon.uf.common.dataplugin.IDecoderGettable.Amount; import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataplugin.radar.util.RadarInfoDict; @@ -63,7 +60,6 @@ import com.raytheon.uf.viz.d2d.core.sampling.ID2DSamplingResource; import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; import com.raytheon.uf.viz.d2d.core.time.ID2DTimeMatchingExtension; import com.raytheon.uf.viz.d2d.core.time.TimeMatcher; -import com.raytheon.viz.awipstools.capabilityInterfaces.IRangeableResource; import com.raytheon.viz.radar.DefaultVizRadarRecord; import com.raytheon.viz.radar.VizRadarRecord; import com.raytheon.viz.radar.interrogators.IRadarInterrogator; @@ -79,12 +75,13 @@ import com.vividsolutions.jts.geom.Coordinate; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Aug 03, 2010            mnash     Initial creation
- * MAR 05, 2013 15313      kshresth  Added sampling for DMD 
- * Apr 11, 2013 DR 16030   D. Friedman Fix NPE.
- * May  5, 2014 DR 17201   D. Friedman Enable same-radar time matching.
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Aug 03, 2010           mnash       Initial creation
+ * MAR 05, 2013  15313    kshresth    Added sampling for DMD 
+ * Apr 11, 2013  16030    D. Friedman Fix NPE.
+ * May  5, 2014  17201    D. Friedman Enable same-radar time matching.
+ * Jun 11, 2014  2061     bsteffen    Move rangeable methods to radial resource
  * 
  * 
* @@ -94,7 +91,7 @@ import com.vividsolutions.jts.geom.Coordinate; public class AbstractRadarResource extends AbstractVizResource implements - IResourceDataChanged, IRangeableResource, IDataScaleResource, + IResourceDataChanged, IDataScaleResource, IRadarTextGeneratingResource, ICacheObjectCallback, ID2DTimeMatchingExtension { private static final transient IUFStatusHandler statusHandler = UFStatus @@ -523,49 +520,6 @@ public class AbstractRadarResource extends return radarRecords; } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.awipstools.capabilityInterfaces.IRangeableResource#getCenter - * () - */ - @Override - public Coordinate getCenter() { - RadarRecord record = getRadarRecord(displayedDate); - if (record != null) { - return new Coordinate(record.getLongitude(), record.getLatitude()); - } - return new Coordinate(); - } - - /* - * (non-Javadoc) - * - * @seecom.raytheon.viz.awipstools.capabilityInterfaces.IRangeableResource# - * getElevation() - */ - @Override - public Amount getElevation() { - return new Amount(0.0, NonSI.FOOT); - } - - /* - * (non-Javadoc) - * - * @see - * com.raytheon.viz.awipstools.capabilityInterfaces.IRangeableResource#getTilt - * () - */ - @Override - public double getTilt() { - double tilt = 0.0; - if (displayedDate != null) { - tilt = displayedDate.getLevelValue(); - } - return tilt; - } - /* * (non-Javadoc) * diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/RadarImageResource.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/RadarImageResource.java index 79d36e4bf2..98b3ca7150 100644 --- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/RadarImageResource.java +++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/RadarImageResource.java @@ -72,7 +72,6 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; import com.raytheon.uf.viz.core.rsc.hdf5.ImageTile; -import com.raytheon.viz.awipstools.capabilities.RangeRingsOverlayCapability; import com.raytheon.viz.radar.VizRadarRecord; import com.raytheon.viz.radar.interrogators.IRadarInterrogator; import com.raytheon.viz.radar.util.DataUtilities; @@ -85,9 +84,11 @@ import com.vividsolutions.jts.geom.Coordinate; *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Aug 4, 2010            mnash     Initial creation
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Aug 04, 2010           mnash       Initial creation
+ * Jun 11, 2014  2061     bsteffen    Move rangeable capability to radial
+ *                                    resource
  * 
  * 
* @@ -345,9 +346,6 @@ public class RadarImageResource extends paintProps.getAlpha()); } } - RangeRingsOverlayCapability rrcap = getCapability(RangeRingsOverlayCapability.class); - rrcap.setRangeableResource(this); - rrcap.paint(target, paintProps); } public void paintRadar(IGraphicsTarget target, PaintProperties paintProps) diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/image/RadarRadialResource.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/image/RadarRadialResource.java index 4b91de5ea8..fb702e4610 100644 --- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/image/RadarRadialResource.java +++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/rsc/image/RadarRadialResource.java @@ -24,13 +24,13 @@ import java.util.HashMap; import java.util.Map; import javax.measure.Measure; +import javax.measure.quantity.Length; import javax.measure.unit.NonSI; import javax.measure.unit.SI; import org.opengis.referencing.crs.CoordinateReferenceSystem; import com.raytheon.uf.common.colormap.prefs.ColorMapParameters; -import com.raytheon.uf.common.dataplugin.IDecoderGettable.Amount; import com.raytheon.uf.common.dataplugin.radar.RadarRecord; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; @@ -40,11 +40,14 @@ import com.raytheon.uf.viz.core.DrawableImage; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IMesh; import com.raytheon.uf.viz.core.drawables.IImage; +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.map.MapDescriptor; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.viz.awipstools.capabilities.EAVCapability; +import com.raytheon.viz.awipstools.capabilities.RangeRingsOverlayCapability; +import com.raytheon.viz.awipstools.capabilityInterfaces.IRangeableResource; import com.raytheon.viz.awipstools.common.EstimatedActualVelocity; import com.raytheon.viz.awipstools.common.IRadialVelocityToolSource; import com.raytheon.viz.radar.VizRadarRecord; @@ -56,17 +59,19 @@ import com.raytheon.viz.radar.rsc.RadarResourceData; import com.vividsolutions.jts.geom.Coordinate; /** - * TODO Add Description + * {@link RadarImageResource} that is able to display radial data. * *
  * 
  * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * Jul 29, 2010            mnash       Initial creation
- * 05/02/2013   DR 14587   D. Friedman Implement IRadialVelocityToolSource
- * Jul 31, 2013       2190 mschenke    Convert interrogate string "msl" to Measure and 
- *                                     put in as "height"
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Jul 29, 2010           mnash       Initial creation
+ * May 02, 2013  14587    D. Friedman Implement IRadialVelocityToolSource
+ * Jul 31, 2013  2190     mschenke    Convert interrogate string "msl" to
+ *                                    Measure and put in as "height"
+ * Jun 11, 2014  2061     bsteffen    Move rangeable methods here.
+ * 
  * 
* * @author mnash @@ -74,7 +79,7 @@ import com.vividsolutions.jts.geom.Coordinate; */ public class RadarRadialResource extends RadarImageResource - implements IRadialVelocityToolSource { + implements IRadialVelocityToolSource, IRangeableResource { public static final String HEIGHT_INTERROGATE_ID = "height"; @@ -90,19 +95,13 @@ public class RadarRadialResource extends RadarImageResource super(rrd, loadProps, interrogator); } - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.radar.rsc.AbstractRadarResource#getElevation() - */ @Override - public Amount getElevation() { - RadarRecord radarRecord = getRadarRecord(displayedDate); - - if (radarRecord != null) { - return new Amount(radarRecord.getElevation(), NonSI.FOOT); - } - return super.getElevation(); + protected void paintInternal(IGraphicsTarget target, + PaintProperties paintProps) throws VizException { + super.paintInternal(target, paintProps); + RangeRingsOverlayCapability rrcap = getCapability(RangeRingsOverlayCapability.class); + rrcap.setRangeableResource(this); + rrcap.paint(target, paintProps); } /* @@ -268,4 +267,52 @@ public class RadarRadialResource extends RadarImageResource } return RadarProductFactory.isVelocityProductCode(productCode); } + + /* + * (non-Javadoc) + * + * @seecom.raytheon.viz.awipstools.capabilityInterfaces.IRangeableResource# + * getElevation() + */ + @Override + public Measure getElevation() { + RadarRecord radarRecord = getRadarRecord(displayedDate); + + if (radarRecord != null) { + return Measure.valueOf(radarRecord.getElevation(), NonSI.FOOT); + } + return Measure.valueOf(0.0, NonSI.FOOT); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.awipstools.capabilityInterfaces.IRangeableResource#getCenter + * () + */ + @Override + public Coordinate getCenter() { + RadarRecord record = getRadarRecord(displayedDate); + if (record != null) { + return new Coordinate(record.getLongitude(), record.getLatitude()); + } + return new Coordinate(); + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.awipstools.capabilityInterfaces.IRangeableResource#getTilt + * () + */ + @Override + public double getTilt() { + double tilt = 0.0; + if (displayedDate != null) { + tilt = displayedDate.getLevelValue(); + } + return tilt; + } }