Merge "Issue #2947 Improve support for Satellite combined products." into development

Former-commit-id: 4f1ca4c4dfeb84b582bfe7fe8375fb9f619cdd94
This commit is contained in:
Nate Jensen 2014-04-21 12:39:56 -05:00 committed by Gerrit Code Review
commit 5c223a8ce3
6 changed files with 73 additions and 40 deletions

View file

@ -37,9 +37,11 @@ import com.raytheon.uf.viz.truecolor.extension.ITrueColorImagingExtension.Channe
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 20, 2012 mschenke Initial creation
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Aug 20, 2012 mschenke Initial creation
* Apr 18, 2014 2947 bsteffen Support unitless data.
*
*
* </pre>
*
@ -117,20 +119,22 @@ public class ChannelInfo {
* the unit to set
*/
public void setUnit(Unit<?> unit) {
this.unit = unit;
if (unit == null) {
this.unit = Unit.ONE;
} else {
this.unit = unit;
}
}
@XmlElement(name = "unit")
public void setUnitString(String unit) {
if (unit != null) {
this.unit = UnitFormat.getUCUMInstance().parseObject(unit,
new ParsePosition(0));
setUnit(UnitFormat.getUCUMInstance().parseObject(unit,
new ParsePosition(0)));
} else {
this.unit = null;
}
if (this.unit == null) {
this.unit = Unit.ONE;
setUnit(null);
}
}
public String getUnitString() {

View file

@ -24,6 +24,8 @@ import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import javax.measure.converter.UnitConverter;
import org.eclipse.swt.graphics.Rectangle;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@ -63,9 +65,10 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 6, 2012 mschenke Initial creation
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Aug 06, 2012 mschenke Initial creation
* Apr 18, 2014 2947 bsteffen Support unitless data.
*
* </pre>
*
@ -422,11 +425,16 @@ public class TrueColorResourceGroup extends
} else if (object instanceof ColorMapCapability) {
ColorMapParameters params = ((ColorMapCapability) object)
.getColorMapParameters();
UnitConverter toDisplay = params
.getColorMapToDisplayConverter();
if (toDisplay == null) {
toDisplay = UnitConverter.IDENTITY;
}
ChannelInfo ci = channelInfoMap.get(params);
if (ci != null) {
ci.setRangeMin(params.getDataToDisplayConverter().convert(
ci.setRangeMin(toDisplay.convert(
params.getColorMapMin()));
ci.setRangeMax(params.getDataToDisplayConverter().convert(
ci.setRangeMax(toDisplay.convert(
params.getColorMapMax()));
ci.setUnit(params.getDisplayUnit());
}

View file

@ -58,6 +58,7 @@ import com.raytheon.viz.core.gl.images.GLOffscreenColormappedImage;
* Nov 20, 2013 2492 bsteffen Mosaic in image units.
* Apr 08, 2014 2950 bsteffen Always use float for maximum precision
* offscreen so interpolation works.
* Apr 18, 2014 2947 bsteffen Fix mosaicing of datamapped images.
*
* </pre>
*
@ -144,7 +145,7 @@ public abstract class GLMosaicImageExtension extends
GLColormappedImageExtension.setupDataMapping(gl,
(AbstractGLColormappedImage) image,
writeToImage.getDataUnit(), 2, 3);
writeToImage.getDataUnit(), GL.GL_TEXTURE2, GL.GL_TEXTURE3);
return image;
}
// Fall through here, no actual rendering will occur

View file

@ -69,6 +69,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Nov 06, 2012 15157 D. Friedman Allow configured inclusion percentage
* Oct 10, 2013 2104 mschenke Fixed broken percentage calculation
* Mar 11, 2014 2896 bsteffen Limit the number of divisions.
* Apr 18, 2014 2947 bsteffen limit divisions more for pretiled data.
*
*
* </pre>
@ -298,7 +299,7 @@ public class SatBestResResourceData extends AbstractRequestableResourceData {
}
private double getInclusionPercentage(IDescriptor descriptor,
ResourcePair rp, Polygon extent) throws VizException {
ResourcePair rp, Polygon extent) {
Double totalPercentage = Double.NaN;
GeneralGridGeometry targetGeometry = descriptor.getGridGeometry();
try {
@ -313,10 +314,14 @@ public class SatBestResResourceData extends AbstractRequestableResourceData {
request.setDistinct(true);
DbQueryResponse response = (DbQueryResponse) ThriftClient
.sendRequest(request);
IGridGeometryProvider[] coverages = response.getFieldObjects(
"coverage", IGridGeometryProvider.class);
int maxDivisions = 1024;
if (coverages.length > 0) {
maxDivisions = Math.max(16, maxDivisions / coverages.length);
}
Geometry area = null;
for (Map<String, Object> result : response.getResults()) {
IGridGeometryProvider provider = (IGridGeometryProvider) result
.get("coverage");
for (IGridGeometryProvider provider : coverages) {
GridGeometry2D gridGeometry = provider.getGridGeometry();
double envWidth = gridGeometry.getEnvelope().getSpan(0);
@ -326,14 +331,14 @@ public class SatBestResResourceData extends AbstractRequestableResourceData {
int xDiv = (int) (envWidth / 100);
int yDiv = (int) (envHeight / 100);
if (xDiv * yDiv > 1024 * 1024) {
/* Don't wasste too much time/memory, preserve aspect ratio. */
if ((long) xDiv * (long) yDiv > maxDivisions * maxDivisions) {
/* Don't waste too much time/memory, preserve aspect ratio. */
if (xDiv > yDiv) {
yDiv = 1024 * yDiv / xDiv;
xDiv = 1024;
yDiv = maxDivisions * yDiv / xDiv;
xDiv = maxDivisions;
} else {
xDiv = 1024 * xDiv / yDiv;
yDiv = 1024;
xDiv = maxDivisions * xDiv / yDiv;
yDiv = maxDivisions;
}
}
Geometry intersection = EnvelopeIntersection

View file

@ -58,18 +58,26 @@ import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.datacube.DataCubeContainer;
/**
* TODO Add Description
* Resource which displays multiple Satellite resources simultaneously. It is
* designed for displaying multiple, potentially overlapping regions such as
* the GOES East/West CONUS displays. This resource takes advantage of the
* mosaicing capability to render all teh satellite products into a single
* composite so that alpha changes are consistent for overlapping areas.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 19, 2009 jsanchez Initial creation
* Mar 10, 2009 800 jsanchez Returned a single display name at a time.
* Mar 20, 2009 jsanchez Constructed resource with highest frequency first.
* Apr 29, 2009 2295 jsanchez Removed the size parameter in getFrequencyIndex().
* Jun 17, 2009 2493 jsanchez Displayed both times in CONUS scale.
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Feb 19, 2009 jsanchez Initial creation
* Mar 10, 2009 800 jsanchez Returned a single display name at a time.
* Mar 20, 2009 jsanchez Constructed resource with highest
* frequency first.
* Apr 29, 2009 2295 jsanchez Removed the size parameter in
* getFrequencyIndex().
* Jun 17, 2009 2493 jsanchez Displayed both times in CONUS scale.
* Apr 18, 2014 2947 bsteffen Allow resources being blended to omit
* load properties.
*
* </pre>
*
@ -147,8 +155,12 @@ public class SatBlendedResourceData extends AbstractRequestableResourceData
if (rp.getResource() != null) {
rp.setResourceData(rp.getResource().getResourceData());
}
rp.getLoadProperties().overrideCapabilities(
loadProperties.getCapabilities());
LoadProperties props = rp.getLoadProperties();
if (props == null) {
props = new LoadProperties();
rp.setLoadProperties(props);
}
props.overrideCapabilities(loadProperties.getCapabilities());
boolean success = true;
try {
success = rp.instantiateResource(descriptor, false);

View file

@ -41,7 +41,6 @@ import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.satellite.SatMapCoverage;
import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord;
import com.raytheon.uf.common.dataplugin.satellite.units.SatelliteUnits;
import com.raytheon.uf.common.geospatial.IGridGeometryProvider;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
@ -60,12 +59,14 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.ColorMapLoader;
import com.raytheon.uf.viz.core.drawables.IRenderable;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension.ImageProvider;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
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.rsc.capabilities.ImagingCapability;
import com.raytheon.viz.satellite.SatelliteConstants;
import com.raytheon.viz.satellite.inventory.DerivedSatelliteRecord;
import com.raytheon.viz.satellite.tileset.SatDataRetriever;
@ -98,7 +99,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Nov 20, 2013 2492 bsteffen Always get min/max values from style
* rules.
* Apr 09, 2014 2947 bsteffen Improve flexibility of sat derived
* parameters.
* parameters, implement ImageProvider
*
* </pre>
*
@ -106,7 +107,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* @version 1
*/
public class SatResource extends
AbstractPluginDataObjectResource<SatResourceData, IMapDescriptor> {
AbstractPluginDataObjectResource<SatResourceData, IMapDescriptor>
implements ImageProvider {
/** String id to look for satellite-provided data values */
public static final String SATELLITE_DATA_INTERROGATE_ID = "satelliteDataValue";
@ -268,7 +270,7 @@ public class SatResource extends
private void initializeFirstFrame(SatelliteRecord record)
throws VizException {
SatelliteUnits.register();
getCapability(ImagingCapability.class).setProvider(this);
ColorMapParameters colorMapParameters = null;
IColorMap colorMap = null;
String cmName = null;
@ -463,6 +465,7 @@ public class SatResource extends
record.getCreatingEntity());
}
@Override
public List<DrawableImage> getImages(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
SatRenderable renderable = (SatRenderable) getOrCreateRenderable(paintProps