Issue #1162 - Fix the NCEP/Hydro RFC FFG Mosaic displays.

Fixed the grid resource and created FFGVizGroupResource.

Change-Id: I4e90fb77c9a27da049e6c06d091076961e7f304c

Former-commit-id: 643eaea29d [formerly d99d895daeaa049c6b4e683b7fbd37186f5ef1dc]
Former-commit-id: 9fe028c438
This commit is contained in:
Mike Duff 2012-09-20 10:17:47 -05:00
parent 6a0eac44b2
commit ff2bb36d39
5 changed files with 337 additions and 48 deletions

View file

@ -1,19 +1,19 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
@ -42,16 +42,17 @@ import com.raytheon.viz.grid.util.TiltRequest;
/**
* The RequestableDataRecord Class
*
*
* <pre>
*
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 18, 2010 bsteffen Initial creation
*
*
* </pre>
*
*
* @author bsteffen
* @version 1.0
*/
@ -60,7 +61,7 @@ public class RequestableDataRecord extends GribRecord {
private static final long serialVersionUID = 1L;
private AbstractRequestableData requester;
private final AbstractRequestableData requester;
public RequestableDataRecord(AbstractRequestableData requester)
throws VizException {
@ -74,6 +75,9 @@ public class RequestableDataRecord extends GribRecord {
coverage);
}
GribModel modelInfo = new GribModel();
if (requester instanceof GribRequestableData) {
setGridVersion(((GribRequestableData) requester).getGribSource().getGridVersion());
}
modelInfo.setModelName(requester.getSource());
modelInfo.setLocation(coverage);
modelInfo.setLevel(requester.getLevel());

View file

@ -0,0 +1,203 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.grid.rsc;
import java.util.ArrayList;
import java.util.Map;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.time.DataTime;
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.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IRefreshListener;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability;
import com.raytheon.viz.core.rsc.VizGroupResourceData;
/**
* FFG Group Resource class.
*
* Based off VizGroupResource.java
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 19, 2012 1162 mpduff Initial creation.
*
* </pre>
*
* @author mpduff
* @version 1.0
*/
public class FFGVizGroupResource extends
AbstractVizResource<VizGroupResourceData, MapDescriptor> implements
IResourceDataChanged, IRefreshListener {
private final String NO_DATA = "No Data";
/**
* Constructor.
*
* @param resourceData
* @param loadProperties
*/
protected FFGVizGroupResource(VizGroupResourceData resourceData,
LoadProperties loadProperties) {
super(resourceData, loadProperties);
dataTimes = new ArrayList<DataTime>();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#disposeInternal()
*/
@Override
protected void disposeInternal() {
for (ResourcePair rp : this.resourceData.getResourceList()) {
if (rp.getResource() != null) {
rp.getResource().dispose();
}
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#paintInternal(com.raytheon
* .uf.viz.core.IGraphicsTarget,
* com.raytheon.uf.viz.core.drawables.PaintProperties)
*/
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
for (ResourcePair rp : this.resourceData.getResourceList()) {
if (rp.getResource() != null) {
rp.getResource().paint(target, paintProps);
}
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#inspect(com.raytheon
* .uf.common.geospatial.ReferencedCoordinate)
*/
@Override
public String inspect(ReferencedCoordinate coord) throws VizException {
ResourceList rl = resourceData.getResourceList();
String value = "No Data";
for (ResourcePair pair : rl) {
if (pair.getResource() != null) {
AbstractVizResource<?,?> rsc = pair.getResource();
value = rsc.inspect(coord);
if (!value.equals(NO_DATA)) {
return value;
}
}
}
return value;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#interrogate(com.raytheon
* .uf.common.geospatial.ReferencedCoordinate)
*/
@Override
public Map<String, Object> interrogate(ReferencedCoordinate coord)
throws VizException {
// TODO Auto-generated method stub
return super.interrogate(coord);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#initInternal(com.raytheon
* .uf.viz.core.IGraphicsTarget)
*/
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
for (AbstractVizResource<?, ?> resource : resourceData.getRscs()) {
if (resource != null) {
resource.init(target);
resource.registerListener(this);
}
}
// If child resources have capabilities that this does not, steal them
for (AbstractVizResource<?, ?> rcs : getResourceData().getRscs()) {
for (AbstractCapability capability : rcs.getCapabilities()
.getCapabilityClassCollection()) {
this.getCapabilities().addCapability(capability);
capability.setResourceData(resourceData);
}
}
// Spread my master capability set to all my children
for (AbstractCapability capability : getCapabilities()
.getCapabilityClassCollection()) {
for (AbstractVizResource<?, ?> rcs : getResourceData().getRscs()) {
rcs.getCapabilities().addCapability(capability);
}
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.rsc.IRefreshListener#refresh()
*/
@Override
public void refresh() {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.IResourceDataChanged#resourceChanged(com
* .raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType,
* java.lang.Object)
*/
@Override
public void resourceChanged(ChangeType type, Object object) {
// TODO Auto-generated method stub
}
}

View file

@ -1,61 +1,67 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.grid.rsc;
import javax.measure.unit.Unit;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
import com.raytheon.viz.core.rsc.VizGroupResource;
import com.raytheon.viz.core.rsc.VizGroupResourceData;
/**
* FFG Grid Name Generator.
*
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 29, 2011 mpduff Initial creation
*
* Jan 29, 2011 mpduff Initial creation
* Sep 19, 2012 1162 mpudff Protect against null pointer
*
* </pre>
*
*
* @author mpduff
* @version 1.0
*/
public class FfgGridNameGenerator extends GridNameGenerator {
public FfgGridNameGenerator() {
}
/*
* (non-Javadoc)
*
*
* @see
* com.raytheon.viz.grid.rsc.GridNameGenerator#getName(com.raytheon.uf.viz
* .core.rsc.AbstractVizResource)
*/
@Override
public String getName(AbstractVizResource<?, ?> absResource) {
String unit = ((VizGroupResource) absResource).getCapability(ColorMapCapability.class).getColorMapParameters().getDisplayUnit().toString();
return ((VizGroupResourceData) absResource.getResourceData()).getName() + "(" + unit + ")";
Unit<?> unitObj = ((FFGVizGroupResource) absResource).getCapability(ColorMapCapability.class).getColorMapParameters().getDisplayUnit();
if (unitObj != null) {
return ((VizGroupResourceData) absResource.getResourceData()).getName() + "(" + unitObj.toString() + ")";
}
return ((VizGroupResourceData) absResource.getResourceData()).getName();
}
}

View file

@ -1,19 +1,19 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
@ -28,16 +28,19 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
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.viz.core.rsc.VizGroupResourceData;
/**
* FFG Resource Data.
*
*
* <pre>
*
* SOFTWARE HISTORY
@ -50,7 +53,7 @@ import com.raytheon.viz.core.rsc.VizGroupResourceData;
* </pre>
*
* @author mpduff
* @version 1.0
* @version 1.0
*/
public class FfgVizGroupResourceData extends VizGroupResourceData {
@ -85,4 +88,11 @@ public class FfgVizGroupResourceData extends VizGroupResourceData {
return availableTimes.toArray(new DataTime[availableTimes.size()]);
}
@Override
protected AbstractVizResource<?, ?> constructResource(
LoadProperties loadProperties, PluginDataObject[] objects)
throws VizException {
return new FFGVizGroupResource(this, loadProperties);
}
}

View file

@ -1,19 +1,19 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
@ -112,6 +112,7 @@ import com.raytheon.viz.core.rsc.hdf5.AbstractTileSet;
import com.raytheon.viz.core.rsc.hdf5.MemoryBasedTileSet;
import com.raytheon.viz.core.style.image.ImagePreferences;
import com.raytheon.viz.grid.GridLevelTranslator;
import com.raytheon.viz.grid.record.RequestableDataRecord;
import com.raytheon.viz.grid.rsc.GridNameGenerator.IGridNameResource;
import com.raytheon.viz.grid.rsc.GridNameGenerator.LegendParameters;
import com.raytheon.viz.grid.xml.FieldDisplayTypesFactory;
@ -121,14 +122,14 @@ import com.vividsolutions.jts.io.WKTReader;
/**
* Grid Resource
*
*
* Accepts grib data records from different time and levels. Data record array
* should represent a single parameter.
*
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 28, 2007 chammack Initial Creation.
@ -139,9 +140,10 @@ import com.vividsolutions.jts.io.WKTReader;
* 06/19/2012 14988 D. Friedman Choose interpolation method based on
* ImagingCapability.isInterpolationState().
* Oversample reprojected grids.
*
* 09/20/2012 15394 mpduff Condense the PDOs based on grid version.
* Get DataTime from paintProps.
* </pre>
*
*
* @author chammack
* @version 1
*/
@ -202,7 +204,7 @@ public class GridResource extends
* The great protector of all things related to dataTimes, do not modify or
* iterate over pdosToParse, dataTimes, or tileSet unless you sync on this
* or else...
*
*
*/
protected Object timeLock = new Object();
@ -540,7 +542,7 @@ public class GridResource extends
}
private class DataRetrievalJob extends Job {
private ConcurrentLinkedQueue<GridMemoryBasedTileSet> tilesToRetrieve = new ConcurrentLinkedQueue<GridMemoryBasedTileSet>();
private final ConcurrentLinkedQueue<GridMemoryBasedTileSet> tilesToRetrieve = new ConcurrentLinkedQueue<GridMemoryBasedTileSet>();
public DataRetrievalJob() {
super("Retrieving Gridded Data");
@ -566,7 +568,7 @@ public class GridResource extends
}
}
private DataRetrievalJob dataRetriever = new DataRetrievalJob();
private final DataRetrievalJob dataRetriever = new DataRetrievalJob();
/**
* Constructor
@ -785,7 +787,7 @@ public class GridResource extends
/*
* (non-Javadoc)
*
*
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#disposeInternal()
*/
@Override
@ -807,6 +809,7 @@ public class GridResource extends
this.target = target;
if (pdosToParse.size() > 0) {
condensePDOs();
for (PluginDataObject pdo : pdosToParse) {
createTile(pdo);
}
@ -893,9 +896,71 @@ public class GridResource extends
}
}
/**
* Condense the PDOs to one pdo per level per DataTime based on
* the gridVersion.
*/
private void condensePDOs() {
Map<DataTime, Map<String, List<PluginDataObject>>> dateMap = new HashMap<DataTime, Map<String, List<PluginDataObject>>>();
List<PluginDataObject> newList = new ArrayList<PluginDataObject>();
for (PluginDataObject pdo : pdosToParse) {
if (pdo instanceof RequestableDataRecord) {
String level = null;
if (!dateMap.containsKey(pdo.getDataTime())) {
Map<String, List<PluginDataObject>> levelMap = new HashMap<String, List<PluginDataObject>>();
RequestableDataRecord rdr = (RequestableDataRecord) pdo;
level = rdr.getModelInfo().getLevel().getLevelInfo();
levelMap.put(level, new ArrayList<PluginDataObject>());
dateMap.put(pdo.getDataTime(), levelMap);
}
Map<String, List<PluginDataObject>> levelsMap = dateMap.get(pdo
.getDataTime());
String lvl = ((RequestableDataRecord) pdo).getModelInfo()
.getLevelInfo();
if (!levelsMap.containsKey(lvl)) {
levelsMap.put(lvl, new ArrayList<PluginDataObject>());
}
levelsMap.get(lvl).add(pdo);
}
}
// loop over each date
for (DataTime time : dateMap.keySet()) {
Map<String, List<PluginDataObject>> levelMap = dateMap.get(time);
// loop over each level
for (String key : levelMap.keySet()) {
List<PluginDataObject> pdos = levelMap.get(key);
PluginDataObject maxVersionedPdo = null;
int maxVersion = -1;
// loop over all the pdos for this level
for (PluginDataObject pdo : pdos) {
RequestableDataRecord rdr = (RequestableDataRecord) pdo;
int version = ((GribRecord) rdr).getGridVersion();
if (version > maxVersion) {
maxVersion = version;
maxVersionedPdo = pdo;
}
}
newList.add(maxVersionedPdo);
}
}
if (!newList.isEmpty()) {
pdosToParse.clear();
pdosToParse.addAll(newList);
}
}
/**
* Combine the given tiles sets
*
*
* @param gridMemoryBasedTileSet
* @param gridMemoryBasedTileSet2
* @param dataTime
@ -1099,7 +1164,7 @@ public class GridResource extends
/**
* Subtracts the second parameter from the first.
*
*
* @param floatDataRecord1
* @param floatDataRecord2
* @param primaryMax
@ -1157,7 +1222,7 @@ public class GridResource extends
/**
* Dynamically scale the color map based on the data in the given tileset
*
*
* @param gridMemoryBasedTileSet
*/
private void updateColorMap(GridMemoryBasedTileSet gridMemoryBasedTileSet) {
@ -1202,7 +1267,7 @@ public class GridResource extends
PaintProperties paintProps) throws VizException {
this.target = target;
DataTime time = descriptor.getFramesInfo().getTimeForResource(this);
DataTime time = paintProps.getDataTime();
Map<Float, GridMemoryBasedTileSet> tileGroup = tileSet.get(time);
if (tileGroup == null) {
return;
@ -1441,7 +1506,7 @@ public class GridResource extends
/*
* (non-Javadoc)
*
*
* @see
* com.raytheon.viz.core.rsc.capabilities.IVertSeqResource#getVerticalLevels
* ()
@ -1452,7 +1517,7 @@ public class GridResource extends
/*
* (non-Javadoc)
*
*
* @see
* com.raytheon.viz.core.rsc.capabilities.IVertSeqResource#getVerticalLevelType
* ()
@ -1463,7 +1528,7 @@ public class GridResource extends
/*
* (non-Javadoc)
*
*
* @see
* com.raytheon.viz.core.rsc.capabilities.IVertSeqResource#setVerticalLevel
* (float)
@ -1520,9 +1585,10 @@ public class GridResource extends
if (object instanceof ImagingCapability) {
// TODO: check if interpolation state really changed
try {
if (descriptor != null)
if (descriptor != null) {
project(descriptor.getGridGeometry()
.getCoordinateReferenceSystem());
}
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
"Error updating grid resource imaging", e);
@ -1550,7 +1616,7 @@ public class GridResource extends
/*
* (non-Javadoc)
*
*
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#getName()
*/
@Override