Merge "Omaha #3681 SatBlended implements Interrogatable" into omaha_14.4.1
Former-commit-id:040f9f0877
[formerly 17861a7e752838399a918c3b09dcaba8095a6a18] Former-commit-id:c89de11b63
This commit is contained in:
commit
5d3e3e58dd
1 changed files with 48 additions and 2 deletions
|
@ -21,8 +21,11 @@ package com.raytheon.viz.satellite.rsc;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.measure.Measure;
|
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.ResourceList;
|
||||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
|
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.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;
|
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>
|
* <pre>
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
|
@ -67,6 +76,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
* values and returns NaN now
|
* values and returns NaN now
|
||||||
* Nov 18, 2013 2544 bsteffen Override recycleInternal
|
* Nov 18, 2013 2544 bsteffen Override recycleInternal
|
||||||
* Nov 20, 2013 2492 bsteffen Update inspect to use Measure objects
|
* Nov 20, 2013 2492 bsteffen Update inspect to use Measure objects
|
||||||
|
* Oct 27, 2014 3681 bsteffen Implement Interrogatable
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -76,7 +86,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
||||||
|
|
||||||
public class SatBlendedResource extends
|
public class SatBlendedResource extends
|
||||||
AbstractVizResource<SatBlendedResourceData, MapDescriptor> implements
|
AbstractVizResource<SatBlendedResourceData, MapDescriptor> implements
|
||||||
IResourceGroup, IRefreshListener, IResourceDataChanged {
|
IResourceGroup, IRefreshListener, IResourceDataChanged, Interrogatable {
|
||||||
|
|
||||||
private IMosaicImage mosaicImage = null;
|
private IMosaicImage mosaicImage = null;
|
||||||
|
|
||||||
|
@ -323,4 +333,40 @@ public class SatBlendedResource extends
|
||||||
public void resourceChanged(ChangeType type, Object object) {
|
public void resourceChanged(ChangeType type, Object object) {
|
||||||
refresh();
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue