Omaha #3681 SatBlended implements Interrogatable

Former-commit-id: a399d3720c [formerly bc029ab047] [formerly 9d375a5617] [formerly 9d375a5617 [formerly 790dee3349]] [formerly a399d3720c [formerly bc029ab047] [formerly 9d375a5617] [formerly 9d375a5617 [formerly 790dee3349]] [formerly 5e63b30ab0 [formerly 9d375a5617 [formerly 790dee3349] [formerly 5e63b30ab0 [formerly 10b1129bb8c938d99b9c74816927f3879a1ef6a2]]]]]
Former-commit-id: 5e63b30ab0
Former-commit-id: af3178755c [formerly f155b32503] [formerly cba6b0d5b0] [formerly 9e178d54c313668991375d902123c772165b3690 [formerly bdf94dd893731133791297446b5077f743a86e63] [formerly cba6b0d5b0 [formerly 2bca486744]]]
Former-commit-id: 067e696d4a0d0353293d733408a0e2110676c8ed [formerly d71960717193edcf2cfc4665e13ecbed0d3a8b56] [formerly 53e138540e [formerly 43f33db057]]
Former-commit-id: 53e138540e
Former-commit-id: ffbc221ddd
This commit is contained in:
Ben Steffensmeier 2014-10-27 15:59:11 -05:00
parent 3356c412d8
commit 52f9496493

View file

@ -21,8 +21,11 @@ package com.raytheon.viz.satellite.rsc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.measure.Measure;
@ -50,10 +53,16 @@ import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
import com.raytheon.uf.viz.core.rsc.interrogation.Interrogatable;
import com.raytheon.uf.viz.core.rsc.interrogation.InterrogateMap;
import com.raytheon.uf.viz.core.rsc.interrogation.InterrogationKey;
import com.raytheon.uf.viz.core.rsc.interrogation.Interrogator;
import com.vividsolutions.jts.geom.Coordinate;
/**
* TODO Add Description
* Displays multiple satellite resources in a single resource. Uses graphics
* mosaicing to combine images so that alhpa blending correctly treats multiple
* images as a single layer when applying the alpha.
*
* <pre>
* SOFTWARE HISTORY
@ -67,6 +76,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* values and returns NaN now
* Nov 18, 2013 2544 bsteffen Override recycleInternal
* Nov 20, 2013 2492 bsteffen Update inspect to use Measure objects
* Oct 27, 2014 3681 bsteffen Implement Interrogatable
*
* </pre>
*
@ -76,7 +86,7 @@ import com.vividsolutions.jts.geom.Coordinate;
public class SatBlendedResource extends
AbstractVizResource<SatBlendedResourceData, MapDescriptor> implements
IResourceGroup, IRefreshListener, IResourceDataChanged {
IResourceGroup, IRefreshListener, IResourceDataChanged, Interrogatable {
private IMosaicImage mosaicImage = null;
@ -323,4 +333,40 @@ public class SatBlendedResource extends
public void resourceChanged(ChangeType type, Object object) {
refresh();
}
@Override
public Set<InterrogationKey<?>> getInterrogationKeys() {
Set<InterrogationKey<?>> set = new HashSet<>();
List<Interrogatable> resourceList = getResourceList()
.getResourcesByTypeAsType(Interrogatable.class);
for (Interrogatable resource : resourceList) {
set.addAll(resource.getInterrogationKeys());
}
return set;
}
@Override
public InterrogateMap interrogate(ReferencedCoordinate coordinate,
DataTime time, InterrogationKey<?>... keys) {
if (!Arrays.asList(keys).contains(Interrogator.VALUE)) {
keys = Arrays.copyOf(keys, keys.length + 1);
keys[keys.length - 1] = Interrogator.VALUE;
}
List<Interrogatable> list = getResourceList().getResourcesByTypeAsType(
Interrogatable.class);
Collections.reverse(list);
for (Interrogatable resource : list) {
InterrogateMap result = resource
.interrogate(
coordinate, time, keys);
Measure<? extends Number, ?> value = result.get(Interrogator.VALUE);
if (value != null) {
double quantity = value.getValue().doubleValue();
if (!Double.isNaN(quantity)) {
return result;
}
}
}
return new InterrogateMap();
}
}