Omaha #4461 Create a custom frame coordinator for radar.

Former-commit-id: ed815b7ae8533cc3b9fb12b7b9bf201f8f145a9a
This commit is contained in:
Ben Steffensmeier 2015-05-13 12:43:18 -05:00
parent c58a008d3d
commit 8073d3709f
10 changed files with 599 additions and 132 deletions

View file

@ -49,7 +49,6 @@ import com.raytheon.uf.viz.core.VizConstants;
import com.raytheon.uf.viz.core.comm.PerspectiveSpecificLoadProperties;
import com.raytheon.uf.viz.core.drawables.AbstractDescriptor;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.FrameCoordinator;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
@ -82,7 +81,8 @@ import com.raytheon.uf.viz.d2d.core.D2DLoadProperties;
* like A1.
* May 5, 2014 3265 bsteffen Better handling of resources returning
* null dataTimes.
*
* May 13, 2015 4461 bsteffen Move the logic to change frames into the
* FrameCoordinator.
*
* </pre>
*
@ -254,8 +254,6 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
}
}
}
FramesInfo currInfo = descriptor.getFramesInfo();
// Find the times for the time match basis.
DataTime[] timeSteps = findBasisTimes(descriptor.getResourceList(),
descriptor.getNumberOfFrames());
@ -278,9 +276,21 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
}
// Update the descriptor to the new times.
int dateIndex = determineNewIndex(descriptor, currInfo, timeSteps);
descriptor.setFramesInfo(new FramesInfo(timeSteps, dateIndex,
resourceTimeMap));
if ((timeMatchBasis.getDescriptor() != null)
&& (timeMatchBasis.getDescriptor() != descriptor)) {
int idx = timeMatchBasis.getDescriptor().getFramesInfo()
.getFrameIndex();
if ((idx >= 0) && (idx < timeSteps.length)) {
descriptor.setFramesInfo(new FramesInfo(timeSteps, idx,
resourceTimeMap));
} else {
descriptor.setFramesInfo(new FramesInfo(timeSteps,
resourceTimeMap));
}
} else {
descriptor.setFramesInfo(new FramesInfo(timeSteps,
resourceTimeMap));
}
// Add Remove data for all the resources.
for (Entry<AbstractVizResource<?, ?>, DataTime[]> entry : resourceTimeMap
@ -292,95 +302,6 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
}
}
private int indexToUpdateTo(IDescriptor descriptor, DataTime[] oldTimes,
int oldIndex, DataTime[] frames, int startFrame) {
int frameToUse = startFrame;
IRenderableDisplay display = descriptor.getRenderableDisplay();
if ((display != null) && (display.getContainer() != null)) {
IDisplayPaneContainer container = display.getContainer();
if (container.getLoopProperties().isLooping()) {
return frameToUse;
}
}
switch (descriptor.getFrameCoordinator().getAnimationMode()) {
case Latest: {
if (oldIndex == (oldTimes.length - 1)) {
frameToUse = frames.length - 1;
}
break;
}
case Temporal: {
// was our old time the last frame for that time?
boolean wasLastForTime = (oldIndex == FrameCoordinator
.getLastTimeIndex(oldTimes, oldIndex));
if (wasLastForTime) {
// check if a new time came in for our frame
int latestForTime = FrameCoordinator.getLastTimeIndex(frames,
startFrame);
if (latestForTime > startFrame) {
frameToUse = latestForTime;
}
}
break;
}
case Vertical: {
boolean wasLastForTime = (oldIndex == FrameCoordinator
.getLastVerticalIndex(oldTimes, oldIndex));
if (wasLastForTime) {
frameToUse = FrameCoordinator.getLastVerticalIndex(frames,
startFrame);
}
}
}
return frameToUse;
}
/**
* Determines the new time index for a descriptor
*
* @param descriptor
* the descriptor
* @param timeSteps
* the list of times for the time match basis.
* @return
*/
private int determineNewIndex(IDescriptor descriptor, FramesInfo currInfo,
DataTime[] timeSteps) {
if ((timeSteps == null) || (timeSteps.length == 0)) {
return -1;
}
// If possible just copy from the time match basis
if ((timeMatchBasis.getDescriptor() != null)
&& (timeMatchBasis.getDescriptor() != descriptor)) {
int idx = timeMatchBasis.getDescriptor().getFramesInfo()
.getFrameIndex();
if ((idx >= 0) && (idx < timeSteps.length)) {
return idx;
}
}
// Next try to get the closest time to
DataTime[] origSteps = currInfo.getFrameTimes();
int curIndex = currInfo.getFrameIndex();
if ((origSteps != null) && (curIndex >= 0)
&& (curIndex < origSteps.length)) {
DataTime startTime = origSteps[curIndex];
int dateIndex = Arrays.binarySearch(timeSteps, startTime);
if (dateIndex < 0) {
if (timeSteps[0].getMatchValid() > startTime.getMatchValid()) {
return 0;
}
} else {
dateIndex = indexToUpdateTo(descriptor, origSteps, curIndex,
timeSteps, dateIndex);
if ((dateIndex >= 0) && (dateIndex < (timeSteps.length - 1))) {
return dateIndex;
}
}
}
// if that didn't work just return the last frame
return timeSteps.length - 1;
}
/**
* Recursively determine times for all resource, or if it is an
* IResourceGroup then for all resources in it.

View file

@ -0,0 +1,71 @@
/**
* 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.radar.frame;
import com.raytheon.uf.common.time.DataTime;
/**
*
* A {@link DataTime} that also contains information about the volume scan time
* and the elevation number for the time it represents. This is used by the
* {@link SailsFrameCoordinator}
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* May 13, 2015 4461 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class RadarDataTime extends DataTime {
private static final long serialVersionUID = 1L;
private Integer elevationNumber;
private int volumeScanNumber;
public RadarDataTime(DataTime time) {
super(time.getRefTime());
}
public Integer getElevationNumber() {
return elevationNumber;
}
public void setElevationNumber(Integer elevationNumber) {
this.elevationNumber = elevationNumber;
}
public int getVolumeScanNumber() {
return volumeScanNumber;
}
public void setVolumeScanNumber(int volumeScanNumber) {
this.volumeScanNumber = volumeScanNumber;
}
}

View file

@ -0,0 +1,113 @@
/**
* 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.radar.frame;
import java.util.HashMap;
import java.util.Map;
import com.raytheon.uf.common.time.DataTime;
/**
*
* A cache of the most recently viewed frame time. The cache is keyed off the
* volume scan number and the primary elevation angle and will return the most
* recently viewed frame time for the key.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* May 13, 2015 4461 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class RadarFrameCache {
private Map<Key, RadarDataTime> cache = new HashMap<>();
/**
* This should be called whenever a frame is displayed to update the cache
*/
public void setLastFrameTime(DataTime time) {
if (time instanceof RadarDataTime) {
RadarDataTime rtime = (RadarDataTime) time;
cache.put(new Key(rtime), rtime);
}
}
/**
* Get the most recent displayed frame that matches the volume scan and
* elevation angle of the provided time. If no time is in the cache then the
* time is returned.
*/
public RadarDataTime getLastFrameTime(RadarDataTime otherTime) {
RadarDataTime result = cache.get(new Key(otherTime));
if(result == null){
result = otherTime;
}
return result;
}
private static class Key {
private final int volumeScanNumber;
private final double primaryElevationAngle;
private final int hashCode;
public Key(RadarDataTime time) {
this.volumeScanNumber = time.getVolumeScanNumber();
this.primaryElevationAngle = time.getLevelValue();
long temp = Double.doubleToLongBits(primaryElevationAngle);
int hashCode = 31 + (int) (temp ^ (temp >>> 32));
hashCode = 31 * hashCode + volumeScanNumber;
this.hashCode = hashCode;
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Key other = (Key) obj;
if (Double.doubleToLongBits(primaryElevationAngle) != Double
.doubleToLongBits(other.primaryElevationAngle))
return false;
if (volumeScanNumber != other.volumeScanNumber)
return false;
return true;
}
}
}

View file

@ -0,0 +1,286 @@
/**
* 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.radar.frame;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.core.drawables.AbstractDescriptor;
import com.raytheon.uf.viz.core.drawables.FrameCoordinator;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IDescriptor.IFrameChangedListener;
import com.raytheon.uf.viz.core.drawables.IFrameCoordinator;
import com.raytheon.viz.radar.ui.RadarDisplayManager;
/**
*
* A specialized frame coordinator which introduces specialized behavior when
* the time match basis is a radar resource and that radar is in
* SAILS(Supplemental Adaptive Intra-Volume Low-Level Scan) mode. Many of the
* operations are the same as a normal {@link FrameCoordinator} except the
* following:
*
* <ul>
* <li>When the last frame is displayed it will go to the frame with the highest
* elevation number that is part of the last volume scan. The opposite is true
* when going to the first frame.
*
* <li>When traversing the vertical dimension all frames in the same volume scan
* will be considered even if the reftimes are different. When choosing between
* multiple frames with the same volume scan and elevation angle the frame that
* was most recently viewed will be used.
*
* </ul>
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* May 13, 2015 4461 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class SailsFrameCoordinator extends FrameCoordinator implements
IFrameChangedListener {
private final RadarFrameCache cache;
private final RadarDisplayManager displayManager;
public SailsFrameCoordinator(IDescriptor descriptor) {
super(descriptor);
cache = new RadarFrameCache();
descriptor.addFrameChangedListener(this);
this.displayManager = RadarDisplayManager.getInstance();
IFrameCoordinator existing = descriptor.getFrameCoordinator();
currentAnimationMode = existing.getAnimationMode();
}
protected boolean isEnabled() {
return displayManager.getCurrentSettings().isSailsFrameCoordinator();
}
@Override
protected int getLastVerticalIndex(DataTime[] frames, int dataIndex,
IFrameValidator validator) {
if (isEnabled()) {
List<RadarDataTime> volumeScan = getVolumeScan(frames, dataIndex);
Collections.sort(volumeScan, new ElevationAngleComparator<>());
Collections.reverse(volumeScan);
for (RadarDataTime time : volumeScan) {
if (validator.isValid(time)) {
return getBestFrameIndex(frames, time, validator);
}
}
}
return super.getLastVerticalIndex(frames, dataIndex, validator);
}
@Override
protected int getFirstVerticalIndex(DataTime[] frames, int dataIndex,
IFrameValidator validator) {
if (isEnabled()) {
List<RadarDataTime> volumeScan = getVolumeScan(frames, dataIndex);
Collections.sort(volumeScan, new ElevationAngleComparator<>());
for (RadarDataTime time : volumeScan) {
if (validator.isValid(time)) {
return getBestFrameIndex(frames, time, validator);
}
}
}
return super.getLastVerticalIndex(frames, dataIndex, validator);
}
@Override
protected int getNextVerticalIndex(DataTime[] frames, int dataIndex,
FrameChangeOperation op, IFrameValidator validator) {
if (isEnabled()) {
if (op == FrameChangeOperation.NEXT) {
List<RadarDataTime> volumeScan = getVolumeScan(frames,
dataIndex);
Collections.sort(volumeScan, new ElevationAngleComparator<>());
int startIdx = volumeScan.indexOf(frames[dataIndex]);
double currentLevel = volumeScan.get(startIdx).getLevelValue();
int idx = (startIdx + 1) % volumeScan.size();
while (idx != startIdx) {
RadarDataTime time = volumeScan.get(idx);
if (validator.isValid(time)
&& time.getLevelValue() != currentLevel) {
return getBestFrameIndex(frames, time, validator);
}
idx = (idx + 1) % volumeScan.size();
}
} else if (op == FrameChangeOperation.PREVIOUS) {
List<RadarDataTime> volumeScan = getVolumeScan(frames,
dataIndex);
Collections.sort(volumeScan, new ElevationAngleComparator<>());
int startIdx = volumeScan.indexOf(frames[dataIndex]);
double currentLevel = volumeScan.get(startIdx).getLevelValue();
int idx = (startIdx + volumeScan.size() - 1)
% volumeScan.size();
while (idx != startIdx) {
RadarDataTime time = volumeScan.get(idx);
if (validator.isValid(time)
&& time.getLevelValue() != currentLevel) {
return getBestFrameIndex(frames, time, validator);
}
idx = (idx + volumeScan.size() - 1) % volumeScan.size();
}
}
}
return super.getNextVerticalIndex(frames, dataIndex, op, validator);
}
@Override
protected int getLastDataTimeIndex(DataTime[] frames, int dataIndex,
IFrameValidator validator) {
int idx = super.getLastDataTimeIndex(frames, dataIndex, validator);
if (isEnabled()) {
List<RadarDataTime> volumeScan = getVolumeScan(frames, idx);
Collections.sort(volumeScan, new ElevationNumberComparator());
Collections.reverse(volumeScan);
for (RadarDataTime time : volumeScan) {
if (validator.isValid(time)) {
return Arrays.asList(frames).indexOf(time);
}
}
}
return idx;
}
@Override
protected int getFirstDataTimeIndex(DataTime[] frames, int dataIndex,
IFrameValidator validator) {
int idx = super.getFirstDataTimeIndex(frames, dataIndex, validator);
if (isEnabled()) {
List<RadarDataTime> volumeScan = getVolumeScan(frames, idx);
Collections.sort(volumeScan, new ElevationNumberComparator());
for (RadarDataTime time : volumeScan) {
if (validator.isValid(time)) {
return Arrays.asList(frames).indexOf(time);
}
}
}
return idx;
}
/**
* Given an example time, find the best time in the frames that has the same
* volume scan number and primary elevation angle. This is done by
* consulting the cache to see if there is a previously viewed frame that
* can be used.
*/
private int getBestFrameIndex(DataTime[] frames, RadarDataTime example,
IFrameValidator validator) {
List<DataTime> framesList = Arrays.asList(frames);
DataTime cached = cache.getLastFrameTime(example);
int index = framesList.indexOf(cached);
if (index >= 0 && validator.isValid(frames[index])) {
return index;
} else {
return framesList.indexOf(example);
}
}
/**
* Get a list of all the {@link DataTime} in frames that are an instance of
* {@link RadarDataTime} and have the same volume scan number as the
* DataTime at the provided index.
*/
private static List<RadarDataTime> getVolumeScan(DataTime[] frames,
int dataIndex) {
DataTime example = frames[dataIndex];
if (example instanceof RadarDataTime) {
int volumeScanNumber = ((RadarDataTime) example)
.getVolumeScanNumber();
long exampleRef = example.getRefTime().getTime();
List<RadarDataTime> result = new ArrayList<>();
for (DataTime frame : frames) {
if (frame instanceof RadarDataTime) {
RadarDataTime radarTime = (RadarDataTime) frame;
if (radarTime.getVolumeScanNumber() == volumeScanNumber) {
long timeRef = radarTime.getRefTime().getTime();
long diff = Math.abs(exampleRef - timeRef);
if (diff < TimeUtil.MILLIS_PER_HOUR) {
result.add(radarTime);
}
}
}
}
return result;
}
return Collections.emptyList();
}
public static void addToDescriptor(IDescriptor descriptor) {
IFrameCoordinator current = descriptor.getFrameCoordinator();
if (current instanceof SailsFrameCoordinator) {
return;
}
if (descriptor instanceof AbstractDescriptor) {
current = new SailsFrameCoordinator(descriptor);
((AbstractDescriptor) descriptor).setFrameCoordinator(current);
}
}
/**
* Used for sorting times based off elevation angle.
*/
private static class ElevationAngleComparator<T extends DataTime>
implements Comparator<T> {
@Override
public int compare(T time1, T time2) {
return Double.compare(time1.getLevelValue(), time2.getLevelValue());
}
}
/**
* Used for sorting times based off elevation number.
*/
private static class ElevationNumberComparator implements
Comparator<RadarDataTime> {
@Override
public int compare(RadarDataTime time1, RadarDataTime time2) {
return Integer.compare(time1.getElevationNumber(),
time2.getElevationNumber());
}
}
@Override
public void frameChanged(IDescriptor descriptor, DataTime oldTime,
DataTime newTime) {
cache.setLastFrameTime(newTime);
}
}

View file

@ -62,6 +62,7 @@ import com.raytheon.uf.viz.d2d.core.time.ID2DTimeMatchingExtension;
import com.raytheon.uf.viz.d2d.core.time.TimeMatcher;
import com.raytheon.viz.radar.DefaultVizRadarRecord;
import com.raytheon.viz.radar.VizRadarRecord;
import com.raytheon.viz.radar.frame.SailsFrameCoordinator;
import com.raytheon.viz.radar.interrogators.IRadarInterrogator;
import com.raytheon.viz.radar.rsc.RadarTextResource.IRadarTextGeneratingResource;
import com.raytheon.viz.radar.textcontributors.IRadarTextContributor;
@ -82,6 +83,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 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
* May 13, 2015 4461 bsteffen Add sails frame coordinator.
*
* </pre>
*
@ -179,6 +181,7 @@ public class AbstractRadarResource<D extends IDescriptor> extends
*/
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
SailsFrameCoordinator.addToDescriptor(descriptor);
RadarTextResourceData.addRadarTextResource(descriptor);
}

View file

@ -52,6 +52,8 @@ import com.raytheon.viz.radar.interrogators.IRadarInterrogator;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 23, 2009 chammack Initial creation
* May 13, 2015 4461 bsteffen Invalidate time cache on all updates
* for SAILS.
*
* </pre>
*
@ -229,6 +231,16 @@ public class RadarResourceData extends AbstractRequestableResourceData {
return all;
}
@Override
public void update(Object updateData) {
super.update(updateData);
/*
* The available time cache will contain DataTime objects when it needs
* to contain RadarDataTime objects so it must be invalidated.
*/
invalidateAvailableTimesCache();
}
@Override
public void update(AlertMessage... messages) {
for (AlertMessage message : messages) {
@ -242,6 +254,7 @@ public class RadarResourceData extends AbstractRequestableResourceData {
}
}
super.update(messages);
invalidateAvailableTimesCache();
}
}

View file

@ -20,11 +20,10 @@
package com.raytheon.viz.radar.ui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font;
@ -54,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- --------------------------
* 04 DEC 2007 373 lvenable Initial creation
* 06 Nov 2014 DCS 16776 zwang Add control for MBA
* May 13, 2015 4461 bsteffen Add option for sails.
*
* </pre>
*
@ -132,7 +132,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
* Show MBA Wind Shear check box.
*/
private Button showMbaWindShear;
/**
* Overlap Mesos check box.
*/
@ -193,6 +193,11 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
*/
private Spinner speedSpnr;
/**
* enable sails frame coordinator check box.
*/
private Button enableSails;
/**
* Constructor.
*
@ -234,6 +239,8 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
addSeparator();
createSrmControls();
createCustomStormMotionGroup();
addSeparator();
createSailsControls();
createCloseButton();
updateDialogFromValues();
@ -294,6 +301,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
speedSpnr.setSelection(values.getSrmSpeed());
enableCustomStormControls(values.getSrmSource().equals(
RadarSRMResource.SRMSource.CUSTOM));
enableSails.setSelection(values.isSailsFrameCoordinator());
}
/**
@ -323,18 +331,14 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
showStormScale.setPageIncrement(1);
showStormScale.setLayoutData(gd);
showStormScale.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
showStormLbl.setText(String.valueOf(showStormScale
.getSelection()));
}
});
showStormScale.addKeyListener(new KeyListener() {
@Override
public void keyPressed(KeyEvent e) {
}
showStormScale.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
@ -372,6 +376,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
}
stiTrackToShowCbo.setLayoutData(gd);
stiTrackToShowCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
values.setStiTrackType(RadarDisplayManager.TrackTypes
.fromString(stiTrackToShowCbo.getText()));
@ -429,6 +434,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
lowPohCbo.setLayoutData(gd);
lowPohCbo.setLayoutData(gd);
lowPohCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (lowPohCbo.getSelectionIndex() > highPohCbo
.getSelectionIndex()) {
@ -459,6 +465,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
lowPoshCbo.setLayoutData(gd);
lowPoshCbo.setLayoutData(gd);
lowPoshCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (lowPoshCbo.getSelectionIndex() > highPoshCbo
.getSelectionIndex()) {
@ -490,6 +497,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
highPohCbo.setLayoutData(gd);
highPohCbo.setLayoutData(gd);
highPohCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (lowPohCbo.getSelectionIndex() > highPohCbo
.getSelectionIndex()) {
@ -519,6 +527,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
highPoshCbo.setLayoutData(gd);
highPoshCbo.setLayoutData(gd);
highPoshCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (lowPoshCbo.getSelectionIndex() > highPoshCbo
.getSelectionIndex()) {
@ -555,6 +564,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
showElevatedTvsChk = new Button(tvsComp, SWT.CHECK);
showElevatedTvsChk.setText("Show elevated TVS");
showElevatedTvsChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
values.setTvsShowElevated(showElevatedTvsChk.getSelection());
}
@ -586,6 +596,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
showExtrapolatedChk = new Button(dmdMdTvsComp, SWT.CHECK);
showExtrapolatedChk.setText("Show extrapolated features");
showExtrapolatedChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
values.setDmdMdTvsShowExtrapolated(showExtrapolatedChk
.getSelection());
@ -617,6 +628,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
minFeatureScale.setMaximum(15);
minFeatureScale.setLayoutData(gd);
minFeatureScale.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
minFeatureScaleLbl.setText(String.valueOf(minFeatureScale
.getSelection()));
@ -642,6 +654,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
overlapMesosChk.setText("Show overlapping Mesos");
overlapMesosChk.setLayoutData(gd);
overlapMesosChk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
values.setDmdShowOverlapping(overlapMesosChk.getSelection());
}
@ -662,6 +675,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
}
dmdTrackToShowCbo.setLayoutData(gd);
dmdTrackToShowCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
values.setDmdTrackType(RadarDisplayManager.TrackTypes
.fromString(dmdTrackToShowCbo.getText()));
@ -687,6 +701,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
showMbaWindShear = new Button(mbaComp, SWT.CHECK);
showMbaWindShear.setText("Show Wind Shear");
showMbaWindShear.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
values.setMbaShowWindShear(showMbaWindShear.getSelection());
}
@ -708,6 +723,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
stormMotionRdo = new Button(srmComp, SWT.RADIO);
stormMotionRdo.setText("Storm Motion from WarnGen Track");
stormMotionRdo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
values.setSrmSource(RadarSRMResource.SRMSource.WARNGEN);
enableCustomStormControls(false);
@ -724,6 +740,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
averageStormRdo = new Button(srmComp, SWT.RADIO);
averageStormRdo.setText("Average Storm Motion from STI");
averageStormRdo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
values.setSrmSource(RadarSRMResource.SRMSource.STI);
enableCustomStormControls(false);
@ -736,6 +753,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
customStormRdo = new Button(srmComp, SWT.RADIO);
customStormRdo.setText("Custom Storm Motion");
customStormRdo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
values.setSrmSource(RadarSRMResource.SRMSource.CUSTOM);
enableCustomStormControls(true);
@ -768,9 +786,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
dirScale.setMaximum(359);
dirScale.setIncrement(5);
dirScale.setLayoutData(gd);
dirScale.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent e) {
}
dirScale.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
@ -778,9 +794,6 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
dirSpnr.setSelection(dirScale.getSelection());
}
@Override
public void mouseDown(MouseEvent e) {
}
});
gd = new GridData(30, SWT.DEFAULT);
@ -788,9 +801,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
dirSpnr.setLayoutData(gd);
dirSpnr.setMinimum(dirScale.getMinimum());
dirSpnr.setMaximum(dirScale.getMaximum());
dirSpnr.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent e) {
}
dirSpnr.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
@ -798,9 +809,6 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
dirScale.setSelection(dirSpnr.getSelection());
}
@Override
public void mouseDown(MouseEvent e) {
}
});
// Filler label
@ -837,9 +845,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
speedScale.setMaximum(99);
speedScale.setIncrement(5);
speedScale.setLayoutData(gd);
speedScale.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent e) {
}
speedScale.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
@ -847,9 +853,6 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
speedSpnr.setSelection(speedScale.getSelection());
}
@Override
public void mouseDown(MouseEvent e) {
}
});
gd = new GridData(30, SWT.DEFAULT);
@ -857,9 +860,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
speedSpnr.setLayoutData(gd);
speedSpnr.setMinimum(speedScale.getMinimum());
speedSpnr.setMaximum(speedScale.getMaximum());
speedSpnr.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent e) {
}
speedSpnr.addMouseListener(new MouseAdapter() {
@Override
public void mouseUp(MouseEvent e) {
@ -867,9 +868,6 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
speedScale.setSelection(speedSpnr.getSelection());
}
@Override
public void mouseDown(MouseEvent e) {
}
});
// Filler label
@ -892,6 +890,31 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
spdMaxLbl.setLayoutData(gd);
}
private void createSailsControls() {
Composite sailsComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
sailsComp.setLayout(gl);
GridData gd = new GridData(60, SWT.DEFAULT);
Label mbaLbl = new Label(sailsComp, SWT.NONE);
mbaLbl.setFont(labelFont);
mbaLbl.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE));
mbaLbl.setText("SAILS");
mbaLbl.setLayoutData(gd);
enableSails = new Button(sailsComp, SWT.CHECK);
enableSails.setText("Enable SAILS Frame Coordinator");
enableSails
.setToolTipText("The SAILS frame coordinator enables custom actions for the up/down arrows and the last frame button that");
enableSails.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
values.setSailsFrameCoordinator(enableSails.getSelection());
}
});
}
/**
* Create the close button.
*/
@ -908,6 +931,7 @@ public class RadarDisplayControlDlg extends CaveSWTDialog {
closeBtn.setText("Close");
closeBtn.setLayoutData(gd);
closeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
shell.dispose();
}

View file

@ -30,6 +30,7 @@ import com.raytheon.viz.radar.ui.RadarDisplayManager.TrackTypes;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/06/2014 DCS 16776 zwang Add control for MBA
* May 13, 2015 4461 bsteffen Add option for sails.
*
* </pre>
*
@ -74,6 +75,8 @@ public class RadarDisplayControls {
private boolean showAll;
private boolean sailsFrameCoordinator;
public RadarDisplayControls() {
}
@ -383,4 +386,16 @@ public class RadarDisplayControls {
RadarDisplayManager.getInstance().displayConfigUpdated();
}
}
public boolean isSailsFrameCoordinator() {
return sailsFrameCoordinator;
}
public void setSailsFrameCoordinator(boolean sailsFrameCoordinator) {
if (sailsFrameCoordinator != this.sailsFrameCoordinator) {
this.sailsFrameCoordinator = sailsFrameCoordinator;
RadarDisplayManager.getInstance().displayConfigUpdated();
}
}
}

View file

@ -46,7 +46,7 @@ import com.raytheon.viz.radar.rsc.image.RadarSRMResource.SRMSource;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
*
* May 13, 2015 4461 bsteffen Add option for sails.
*
* </pre>
*
@ -222,6 +222,8 @@ public class RadarDisplayManager {
prefs.setValue("SRM_Source", currentValues.getSrmSource().name());
prefs.setValue("SRM_Direction", currentValues.getSrmDir());
prefs.setValue("SRM_Speed", currentValues.getSrmSpeed());
prefs.setValue("SAILS_FrameCoordinator",
currentValues.isSailsFrameCoordinator());
// Put the IO on a different thread to avoid hanging.
saveJob.schedule();
}
@ -262,6 +264,8 @@ public class RadarDisplayManager {
.getString("SRM_Source")));
currentVals.setSrmDir(prefs.getInt("SRM_Direction"));
currentVals.setSrmSpeed(prefs.getInt("SRM_Speed"));
currentVals.setSailsFrameCoordinator(prefs
.getBoolean("SAILS_FrameCoordinator"));
currentValues = currentVals;
}

View file

@ -28,7 +28,6 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
import com.raytheon.uf.common.dataquery.requests.DbQueryRequestSet;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
@ -36,6 +35,7 @@ import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponseSet;
import com.raytheon.uf.common.derivparam.library.DerivedParameterGenerator;
import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -47,6 +47,7 @@ import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.pointdata.util.AbstractPointDataInventory;
import com.raytheon.viz.pointdata.util.PointDataCubeAdapter;
import com.raytheon.viz.radar.frame.RadarDataTime;
/**
*
@ -60,6 +61,9 @@ import com.raytheon.viz.pointdata.util.PointDataCubeAdapter;
* ------------ ---------- ----------- --------------------------
* Oct 8, 2009 bsteffen Initial creation
* Nov 21, 2009 #3576 rjpeter Refactored use of DerivParamDesc.
* May 13, 2015 4461 bsteffen Generate radar times from time queries.
*
*
* </pre>
*
* @author bsteffen
@ -75,6 +79,10 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
private static final String LEVEL_FIELD = "primaryElevationAngle";
private static final String ELEVATION_FIELD = "elevationNumber";
private static final String VOLUME_FIELD = "volumeScanNumber";
@Override
public String[] getSupportedPlugins() {
return new String[] { "radar" };
@ -133,7 +141,14 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
time = new DataTime((Date) map.get(dataTimefield), 0);
} else {
time = (DataTime) map.get(dataTimefield);
time.setLevelValue((Double) map.get(LEVEL_FIELD));
RadarDataTime radarTime = new RadarDataTime(time);
Number level = (Number) map.get(LEVEL_FIELD);
radarTime.setLevelValue(level.doubleValue());
Number elevation = (Number) map.get(ELEVATION_FIELD);
radarTime.setElevationNumber(elevation.intValue());
Number volume = (Number) map.get(VOLUME_FIELD);
radarTime.setVolumeScanNumber(volume.intValue());
time = radarTime;
}
// Best res requests need this because they span a time period
if (time.getRefTime().before(
@ -166,6 +181,8 @@ public class RadarDataCubeAdapter extends PointDataCubeAdapter {
request.addRequestField(dataTimefield, latestOnly);
if (!latestOnly) {
request.addRequestField(LEVEL_FIELD);
request.addRequestField(ELEVATION_FIELD);
request.addRequestField(VOLUME_FIELD);
}
request.setDistinct(true);
return request;