12.6.1-5 baseline

Former-commit-id: 3cb550e019 [formerly 1ad64ffa98] [formerly 09f73b0601] [formerly 09f73b0601 [formerly c99afab05f]] [formerly 3cb550e019 [formerly 1ad64ffa98] [formerly 09f73b0601] [formerly 09f73b0601 [formerly c99afab05f]] [formerly 8947efbc7f [formerly 09f73b0601 [formerly c99afab05f] [formerly 8947efbc7f [formerly 052cb99a833ed45e1d7a6e965bf8c996c39e2ffb]]]]]
Former-commit-id: 8947efbc7f
Former-commit-id: 32effe24e5 [formerly d5c94ccef2] [formerly b69fa75919] [formerly 75c4c7d14cbef46abcce4acb1604d4b730fd79e2 [formerly 1cc870696aedf27ab003448e1146bd540b248a33] [formerly b69fa75919 [formerly a945ed8e6d]]]
Former-commit-id: 6391c41aadc47280c8ac82a432cb1defe5bb8fd6 [formerly fc6eb550115880692c0f2fd68727ccec55d0eef7] [formerly 3b468d9f50 [formerly 91e65230ad]]
Former-commit-id: 3b468d9f50
Former-commit-id: 883d66bc46
This commit is contained in:
Steve Harris 2012-06-11 16:22:23 -05:00
parent 4d74dcd505
commit 1ca6770734
162 changed files with 6393 additions and 6421 deletions

View file

@ -54,10 +54,9 @@ class ProcessVariableList:
## The following arguments are no longer used but remain part of the signature for compatibility reasons
## * parent - not needed
## * modal - similar functionality is achieved by setting or not setting a callback
## * dbSubsystem - not needed, see TODO
## * dataMgr - required for model and D2D_model widgets
## * cmdLineVarDict - not needed, see TODO
##
## TODO evaluate cmdLineVarDict and determine if it is really not needed
## TODO dbSubsytem may be needed when implementing the model and D2D_model widgets
##
## @param title: str() of the title of the dialog that will appear
@ -68,7 +67,7 @@ class ProcessVariableList:
## @param argList: list() of arguments to pass to the callback function
##
def __init__(self, title, varList, varDict=None, parent=None,
dbSubsystem=None, modal=1, runCB=None, argList=[],
dataMgr=None, modal=1, runCB=None, argList=[],
cmdLineVarDict=None):
self.__varDict = varDict
@ -80,7 +79,7 @@ class ProcessVariableList:
widgetList = buildWidgetList(varList)
# Construct the dialog
self.__dialog = ValuesDialog.openDialog(title, widgetList)
self.__dialog = ValuesDialog.openDialog(title, widgetList, dataMgr)
#self.__dialog = ValuesDialog(title,widgetList)
# since ValuesDialog blocks on open() we can set status and varDict here

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.viz.alertviz;
import java.io.PrintStream;
import java.io.StringWriter;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.jms.ExceptionListener;
@ -88,7 +89,11 @@ public class AlertVizClient implements MessageListener {
private CopyOnWriteArrayList<IAlertVizMessageCallback> listeners;
private Marshaller marshaller;
private static int POOL_SIZE = 5;
private java.util.Queue<Marshaller> marshallers = new ConcurrentLinkedQueue<Marshaller>();
private JAXBContext jaxbContext;
private static AlertVizClient instance;
@ -134,8 +139,7 @@ public class AlertVizClient implements MessageListener {
this.consumer.setMessageListener(this);
reconnect = false;
lastReconnectTime = System.currentTimeMillis();
JAXBContext context = JAXBContext.newInstance(StatusMessage.class);
marshaller = context.createMarshaller();
jaxbContext = JAXBContext.newInstance(StatusMessage.class);
} catch (JMSException e) {
reconnect = true;
throw new AlertvizException("Unable to connect to notification", e);
@ -158,8 +162,11 @@ public class AlertVizClient implements MessageListener {
if (retryOnExceptions == false && reconnect == true) {
printToConsole(statusMessage);
} else {
Marshaller marshaller = null;
try {
StringWriter sw = new StringWriter();
marshaller = getMarshaller();
marshaller.marshal(statusMessage, sw);
ActiveMQTextMessage message = new ActiveMQTextMessage();
message.setText(sw.toString());
@ -178,9 +185,21 @@ public class AlertVizClient implements MessageListener {
} catch (Exception e) {
throw new AlertvizException("Error sending message", e);
}
if (marshaller != null && marshallers.size() < POOL_SIZE) {
marshallers.add(marshaller);
}
}
}
private Marshaller getMarshaller() throws JAXBException {
Marshaller m = marshallers.poll();
if (m == null) {
m = jaxbContext.createMarshaller();
}
return m;
}
/**
* @param statusMessage
*/

View file

@ -188,38 +188,41 @@ public class Container implements IConfigurationChangedListener {
private boolean isShotGun(StatusMessage message) {
boolean retVal = false;
if (lastMessage != null) {
final long shotgunMessageCheckTime = this.shotgunMessageStartTime == 0 ? this.lastMessage
.getEventTime().getTime() : this.shotgunMessageStartTime;
if (this.lastMessage.getCategory().equals(message.getCategory())
&& this.lastMessage.getPriority() == message.getPriority()
&& this.lastMessage.getMessage().equals(
message.getMessage())
&& Math.abs(this.lastMessage.getEventTime().getTime()
- message.getEventTime().getTime()) < SHOTGUN_MESSAGE_MILLISECOND_THRESHOLD) {
&& (Math.abs(message.getEventTime().getTime()
- shotgunMessageCheckTime) < SHOTGUN_MESSAGE_MILLISECOND_THRESHOLD)) {
retVal = true;
++this.shotgunMessageCount;
if (this.shotgunMessageStartTime == 0) {
this.shotgunMessageStartTime = message.getEventTime()
this.shotgunMessageStartTime = lastMessage.getEventTime()
.getTime();
}
} else {
if (this.shotgunMessageCount != 0) {
if (this.shotgunMessageCount > 1) {
StringBuilder sb = new StringBuilder("Received ")
.append(this.shotgunMessageCount)
.append(" duplicate messages in ")
.append(message.getEventTime().getTime()
.append(this.lastMessage.getEventTime().getTime()
- this.shotgunMessageStartTime)
.append(" milliseconds. For message: ")
.append(this.lastMessage.getCategory()).append(":")
.append(this.lastMessage.getSourceKey())
.append(" ").append(this.lastMessage.getMessage());
this.shotgunMessageStartTime = 0;
this.shotgunMessageCount = 0;
StatusMessage sm = new StatusMessage(
this.lastMessage.getSourceKey(), "GDN_ADMIN",
this.lastMessage.getPriority(),
this.lastMessage.getPlugin(), sb.toString(), null);
sm.setEventTime(SimulatedTime.getSystemTime().getTime());
messageReceived(sm);
logInternal(sm);
}
this.shotgunMessageStartTime = 0;
this.shotgunMessageCount = 1;
}
}

View file

@ -25,9 +25,9 @@ import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.WeakHashMap;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement;
@ -48,7 +48,6 @@ import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.Activator;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.status.StatusConstants;
/**
* Creates uEngine scripts on the fly.
@ -75,7 +74,8 @@ import com.raytheon.uf.viz.core.status.StatusConstants;
* @version 1
*/
public class ScriptCreator {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ScriptCreator.class);
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ScriptCreator.class);
private static final String DEFAULT_SCRIPT_LIBRARY = "BaseRequest";
@ -99,10 +99,10 @@ public class ScriptCreator {
new Path("scriptTemplates/standardTemplate.vm"),
null)).getPath());
} catch (IOException e) {
statusHandler.handle(
Priority.CRITICAL,
"Unable to load the standard script template. Requesting products will not work until this is fixed.",
e);
statusHandler
.handle(Priority.CRITICAL,
"Unable to load the standard script template. Requesting products will not work until this is fixed.",
e);
}
}
@ -148,7 +148,7 @@ public class ScriptCreator {
return;
}
pluginToLibraryMap = new WeakHashMap<String, ScriptProperties>();
pluginToLibraryMap = new HashMap<String, ScriptProperties>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint(RESOURCE_EXTENSION);

View file

@ -938,7 +938,7 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
index = 1.0f;
}
return colorToRGB(colorMap.getColors().get(
(int) (index * colorMap.getSize())));
(int) (index * (colorMap.getSize()-1))));
}
/**
@ -954,7 +954,7 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
} else if (index > 1.0f) {
index = 1.0f;
}
return colorMap.getColors().get((int) (index * colorMap.getSize()));
return colorMap.getColors().get((int) (index * (colorMap.getSize()-1)));
}
public static RGB colorToRGB(Color c) {

View file

@ -19,6 +19,9 @@
**/
package com.raytheon.uf.viz.core.rsc.capabilities;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@ -46,6 +49,8 @@ public class DisplayTypeCapability extends AbstractCapability {
@XmlAttribute
private DisplayType displayType = DisplayType.CONTOUR;
private transient List<DisplayType> alternativeDisplayTypes;
public DisplayType getDisplayType() {
return displayType;
}
@ -54,6 +59,18 @@ public class DisplayTypeCapability extends AbstractCapability {
this.displayType = displayType;
}
public List<DisplayType> getAlternativeDisplayTypes() {
if (alternativeDisplayTypes == null) {
return Collections.emptyList();
}
return alternativeDisplayTypes;
}
public void setAlternativeDisplayTypes(
List<DisplayType> alternativeDisplayTypes) {
this.alternativeDisplayTypes = alternativeDisplayTypes;
}
/*
* (non-Javadoc)
*

View file

@ -140,7 +140,6 @@ public class D2DSamplingResource extends SamplingResource implements
inspectForced = false;
setSampling(false);
issueRefresh();
return true;
}
return false;
}

View file

@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.d2d.core;bundle-version="1.11.15",
com.raytheon.uf.viz.localization,
javax.measure;bundle-version="1.0.0",
com.raytheon.uf.common.ohd;bundle-version="1.12.1174"
com.raytheon.uf.common.ohd;bundle-version="1.12.1174",
com.raytheon.uf.common.cache;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Import-Package: com.raytheon.uf.common.colormap,

View file

@ -176,9 +176,9 @@ public class FFMPTableCellData {
if (displayAsInt == true) {
tmpVal = Math.rint(value);
} else {
if (!value.isNaN()) {
tmpVal = (double) (((int) ((value + 0.005) * 100))) / 100;
}
if (!value.isNaN()) {
tmpVal = (double) ((Math.round(value * 100.0))/100.0);
}
}
if ((columnName == FIELDS.GUIDANCE) && this.guidForcedFlag) {

View file

@ -1186,7 +1186,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
updateTimeDurationLabel(val, split);
if (dialogInitialized) {
fireTimeChangedEvent(val, split);
fireTimeChangedEvent(val, split, false);
}
updateD2DRefresh();
}
@ -1260,18 +1260,28 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
this.ffmpConfig.setVisibleColumns(attrData);
this.ffmpConfig.setAttrData(attrData);
this.ffmpTable.showHideTableColumns();
boolean changeSplit = false;
if (timeDurScale.split != ffmpConfig.isSplit()) {
changeSplit = true;
}
timeDurScale.setSplit(ffmpConfig.isSplit());
updateTimeDurationLabel(timeDurScale.getSelectedHoursValue(),
ffmpConfig.isSplit());
if (updateData) {
resource.clearTables();
resource.getDrawable(resource.getPaintTime()).setDirty(true);
FFMPMonitor monitor = FFMPMonitor.getInstance();
monitor.fireMonitorEvent(this.getClass().getName());
}
if (updateData) {
if (changeSplit) {
fireTimeChangedEvent(timeDurScale.getSelectedHoursValue(),
ffmpConfig.isSplit(), true);
}
resource.clearTables();
resource.getDrawable(resource.getPaintTime()).setDirty(true);
FFMPMonitor.getInstance().fireMonitorEvent(
this.getClass().getName());
}
ffmpTable.calculateTableSize();
shell.pack();
@ -1314,7 +1324,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
ffmpListeners.remove(fl);
}
public void fireTimeChangedEvent(double newTime, boolean split) {
public void fireTimeChangedEvent(double newTime, boolean split, boolean override) {
FFMPRecord.FIELDS field = FFMPRecord.FIELDS.QPE;
@ -1325,7 +1335,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
}
}
if (time != newTime) {
if ((time != newTime) || override) {
FFMPTimeChangeEvent ftce = new FFMPTimeChangeEvent(newTime, split);
Iterator<FFMPListener> iter = ffmpListeners.iterator();
while (iter.hasNext()) {
@ -1756,7 +1766,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
*/
timeDurScale.setTimeDurationAndUpdate(ffmpConfig.getFFMPConfigData()
.getTimeFrame());
fireTimeChangedEvent(ffmpConfig.getFFMPConfigData().getTimeFrame(), false);
fireTimeChangedEvent(ffmpConfig.getFFMPConfigData().getTimeFrame(), false, false);
/*
* Layer
@ -2006,6 +2016,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
dataLoadComp.setVisible(false);
shell.pack();
}
resource.manageLoaders(status);
}
@Override
@ -2053,7 +2065,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
public void tableDataUpdateComplete(FFMPTableDataUpdate updateData) {
final FFMPTableDataUpdate fupdateData = updateData;
if (!this.isDisposed()) {
Display.getDefault().asyncExec(new Runnable() {
@ -2078,9 +2090,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
resetCursor();
}
});
}
}
}
/**
* used to blank the group label when channging HUC
* while in an aggregate.

View file

@ -111,7 +111,7 @@ public class TimeDurScaleComp extends Composite {
/**
* Split flag.
*/
private boolean split = false;
public boolean split = false;
/**
* Display numbers for the range.

View file

@ -49,7 +49,7 @@ import com.raytheon.viz.core.style.image.ImagePreferences;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 08/29/09 2152 D. Hladky Initial release
*
* 05/21/12 DR 14833 G. Zhang Error handling for invalid cmap
* </pre>
*
* @author dhladky
@ -68,7 +68,16 @@ public class FFMPColorUtils {
private ArrayList<String> fileArray = new ArrayList<String>();
private TreeMap<Double, String> hourColorMapMap = new TreeMap<Double, String>();
private TreeMap<Double, String> hourColorMapMap = new TreeMap<Double, String>();
// DR 14833: replacing the one in the constructor
private StyleRule sr = null;
// DR 14833: used when no colormap found
private static final String DEFAULT_COLORMAP = "ffmp/qpe";
// DR 14833: used when paramname not matching colormap name found
private static final String DEFAULT_PARAMNAME = "qpe";
/**
* Set up FFMP Color maps
@ -84,7 +93,18 @@ public class FFMPColorUtils {
this.tableLoad = tableLoad;
this.colormapparams = null;
StyleRule sr = null;
// LocalizationFile[] files = ColorMapLoader.listColorMapFiles();
// for (LocalizationFile file : files) {
// String fn = file.getName();
// if (fn.startsWith("colormaps/ffmp/qpe"))
// {
// System.out.println(file.getName());
// String hour = fn.s
// }
//
// }
// StyleRule sr = null;// DR 14833 replaced by a instance field
try {
sr = StyleManager.getInstance().getStyleRule(
StyleManager.StyleType.IMAGERY, getMatchCriteria());
@ -102,6 +122,7 @@ public class FFMPColorUtils {
e.printStackTrace();
}
if(cxml == null) cxml = getDefaultColorMap(); // DR 14833: load the default map
ColorMap colorMap = new ColorMap(colormapfile, (ColorMap) cxml);
colormapparams = new ColorMapParameters();
colormapparams.setColorMap(colorMap);
@ -167,8 +188,8 @@ public class FFMPColorUtils {
double val2 = (Math.round(valueArg * 100.0)) / 100.0;
Double value = val2;
if (value < 0.01 && field != FIELDS.DIFF) {
if (value < 0.005 && field != FIELDS.DIFF) {
ret = 0;
} else if (field == FIELDS.DIFF) {
@ -320,5 +341,72 @@ public class FFMPColorUtils {
fileArray.add(fn);
}
}
}
/**
* DR 14833: Error handling for the following:
* when a user modified the ffmpImageryStyleRules.xml file
* without adding the related qpeX.cmap and for a user made
* error like: qpe6/qpe4.cmap then default qpe/qpe.cmap used.
*
*/
public IColorMap getDefaultColorMap(){
IColorMap cxml = null;
/*see parseFileNames(): colormap_name is "0.0" or qpe+key+".cmap"
double hour = hourColorMapMap.firstKey();
String cmapHour = ( hour==0.0 ? "" : String.valueOf(hour) );
System.out.println("FFMPColorUtils.getDefaultColorMap() cmapHour: "+cmapHour );*/
/* Loop through all StyleRules to get the default.
* In StyleManager.loadRules(StyleType), all levels(not only USER)
* StyleRule loaded. So it is guaranteed the default can be loaded.
*/
com.raytheon.uf.viz.core.style.StyleRuleset srs =
StyleManager.getInstance().getStyleRuleSet(StyleManager.StyleType.IMAGERY);
for(StyleRule srl : srs.getStyleRules()){
String pn="", cm="";
try{
pn = ((ParamLevelMatchCriteria)srl.getMatchCriteria()).getParameterNames().get(0);
cm = ((ImagePreferences)srl.getPreferences()).getDefaultColormap();
}catch(Exception e){ continue; }
if(DEFAULT_PARAMNAME.equalsIgnoreCase(pn) && DEFAULT_COLORMAP.equalsIgnoreCase(cm)){
sr = srl;
System.out.println("FFMPColorUtils.getDefaultColorMap(): StyleRule pn-cm value: "+pn+"-"+cm);
break;
}
}
/*
if(sr == null){
//get the MatchCriteria
ParamLevelMatchCriteria match = new ParamLevelMatchCriteria();
ArrayList<String> paramList = new ArrayList<String>();
paramList.add( FIELDS.QPE.getFieldName()+cmapHour );
match.setParameterName(paramList);
//get the StyleRule
try {
sr=StyleManager.getInstance().getStyleRule(StyleManager.StyleType.IMAGERY, match);
} catch (VizStyleException e) {
e.printStackTrace();
}
}
*/
//get the colormapfile name
String colormapfile = ((ImagePreferences) sr.getPreferences()).getDefaultColormap();
//load the colormap
try {
cxml = ColorMapLoader.loadColorMap(colormapfile);
} catch (VizException e) {
e.printStackTrace();
}
return cxml;
}
}

View file

@ -26,9 +26,9 @@ import java.util.HashMap;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPCacheRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
@ -94,17 +94,17 @@ public class FFMPDataGenerator {
FFMPBasinData virtualBasin = null;
FFMPRecord rateRecord = null;
FFMPCacheRecord rateRecord = null;
FFMPRecord qpeRecord = null;
FFMPCacheRecord qpeRecord = null;
FFMPRecord qpfRecord = null;
FFMPCacheRecord qpfRecord = null;
HashMap<String, FFMPRecord> guidRecords = null;
HashMap<String, FFMPCacheRecord> guidRecords = null;
FFMPRecord virtualRecord = null;
FFMPCacheRecord virtualRecord = null;
FFMPRecord baseRec = null;
FFMPCacheRecord baseRec = null;
// Date time = null;
@ -374,7 +374,7 @@ public class FFMPDataGenerator {
if ((qpfBasin != null)
&& (qpfBasin.get(parentBasinPfaf) != null)) {
qpf = qpfBasin.get(parentBasinPfaf).getValue(
qpf = qpfBasin.get(parentBasinPfaf).getAverageValue(
monitor.getQpfWindow().getAfterTime(),
monitor.getQpfWindow().getBeforeTime());
trd.setTableCellData(3, new FFMPTableCellData(
@ -557,7 +557,7 @@ public class FFMPDataGenerator {
if ((qpfBasin != null)
&& (qpfBasin.get(cBasin.getPfaf()) != null)) {
qpf = qpfBasin.get(cBasin.getPfaf()).getValue(
qpf = qpfBasin.get(cBasin.getPfaf()).getAverageValue(
monitor.getQpfWindow().getAfterTime(),
monitor.getQpfWindow().getBeforeTime());
// qpf = getQPFValue(false, cBasin.getPfaf(),
@ -872,7 +872,7 @@ public class FFMPDataGenerator {
trd.setTableCellData(
3,
new FFMPTableCellData(FIELDS.QPF, new Float(
qpeBasin.get(cBasin.getPfaf()).getValue(
qpfBasin.get(cBasin.getPfaf()).getMaxValue(
monitor.getQpfWindow()
.getAfterTime(),
monitor.getQpfWindow()
@ -960,7 +960,7 @@ public class FFMPDataGenerator {
Float.NaN));
}
if (qpfBasin != null) {
qpf = qpfBasin.getMaxValue(pfafs, monitor.getQpfWindow()
qpf = qpfBasin.getAverageMaxValue(pfafs, monitor.getQpfWindow()
.getAfterTime(), monitor.getQpfWindow()
.getBeforeTime());
@ -1103,7 +1103,7 @@ public class FFMPDataGenerator {
trd.setTableCellData(
3,
new FFMPTableCellData(FIELDS.QPF, new Float(
qpeBasin.get(cBasin.getPfaf()).getValue(
qpfBasin.get(cBasin.getPfaf()).getMaxValue(
monitor.getQpfWindow()
.getAfterTime(),
monitor.getQpfWindow()
@ -1266,7 +1266,9 @@ public class FFMPDataGenerator {
qpeBasin = qpeRecord.getBasinData(huc);
if (qpeBasin.getBasins().size() > 0) {
field = FIELDS.QPE;
baseRec = qpeRecord;
if (baseRec == null) {
baseRec = qpeRecord;
}
}
}
if (qpfRecord != null) {

View file

@ -102,7 +102,7 @@ public class FFMPDataLoader extends Thread {
sharePath = AppsDefaults.getInstance().getToken("apps_dir")
+ File.separator + "ffmp" + File.separator;
//sharePath = "/awips2/edex/data/share/hydroapps/ffmp/";
this.product = resourceData.getProduct();
this.siteKey = resourceData.siteKey;
this.dataKey = resourceData.dataKey;
@ -151,7 +151,9 @@ public class FFMPDataLoader extends Thread {
long time = System.currentTimeMillis();
try {
resourceData.setLoader(loadType);
System.out.println("Starting Loader: "+loadType.getLoaderType());
ProductRunXML productRun = runner.getProduct(siteKey);
ArrayList<String> qpfSources = new ArrayList<String>();
@ -162,8 +164,8 @@ public class FFMPDataLoader extends Thread {
|| (loadType == LOADER_TYPE.GENERAL)) {
rateURI = getMonitor().getAvailableUri(siteKey, dataKey,
product.getRate(), mostRecentTime);
}
}
NavigableMap<Date, List<String>> qpeURIs = getMonitor()
.getAvailableUris(siteKey, dataKey, product.getQpe(),
timeBack);
@ -185,7 +187,7 @@ public class FFMPDataLoader extends Thread {
qpfURIs = getMonitor().getAvailableUris(siteKey, dataKey,
qpfSource.getSourceName(), qpfTime);
if (qpfURIs != null) {
if (qpfURIs != null && !qpfURIs.isEmpty()) {
qpfs.add(qpfURIs);
qpfSources.add(qpfSource.getSourceName());
}
@ -213,11 +215,16 @@ public class FFMPDataLoader extends Thread {
iguidURIs = getMonitor().getAvailableUris(siteKey, dataKey,
guidSource.getSourceName(), guidTime);
if (iguidURIs != null) {
if (iguidURIs != null && !iguidURIs.isEmpty()) {
guids.put(guidSource.getSourceName(), iguidURIs);
}
}
}
// We only load all for long range data, all + layer for medium range
if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear();
hucsToLoad.add("ALL");
}
for (String phuc : hucsToLoad) {
@ -231,8 +238,9 @@ public class FFMPDataLoader extends Thread {
} else {
// rate
if (rateURI != null) {
System.out.println("Processing " + loadType
+ " Rate: huc = " + phuc);
fireLoaderEvent(loadType, "Processing "+product.getRate() + "/" + phuc,
isDone);
getMonitor().processUri(isProductLoad, rateURI,
siteKey, product.getRate(), timeBack, phuc);
fireLoaderEvent(loadType, product.getRate() + "/"
@ -240,8 +248,8 @@ public class FFMPDataLoader extends Thread {
}
// qpes
System.out.println("Processing " + loadType
+ " QPE: huc = " + phuc);
fireLoaderEvent(loadType, "Processing "+product.getQpe() + "/" + phuc,
isDone);
FFMPBasinData qpeData = null;
if ((loadType == LOADER_TYPE.INITIAL)
@ -258,10 +266,10 @@ public class FFMPDataLoader extends Thread {
getMonitor().insertFFMPData(qpeData, siteKey,
product.getQpe(), phuc);
}
}
}
if (!qpeURIs.isEmpty()) {
if (phuc.equals(config.getFFMPConfigData().getLayer())) {
if (!qpeURIs.isEmpty() && qpeData == null) {
if (phuc.equals(config.getFFMPConfigData().getLayer()) || phuc.equals("ALL")) {
getMonitor().processUris(qpeURIs, isProductLoad,
siteKey, product.getQpe(), timeBack, phuc,
loadType);
@ -274,8 +282,8 @@ public class FFMPDataLoader extends Thread {
int i = 0;
for (NavigableMap<Date, List<String>> qpfURIs : qpfs) {
// qpf
System.out.println("Processing " + loadType
+ " QPF: huc = " + phuc);
fireLoaderEvent(loadType, "Processing "+product.getQpf(i) + "/" + phuc,
isDone);
FFMPBasinData qpfData = null;
if ((loadType == LOADER_TYPE.INITIAL)
|| (loadType == LOADER_TYPE.SECONDARY)) {
@ -289,8 +297,8 @@ public class FFMPDataLoader extends Thread {
if (qpfData != null) {
if (phuc.equals(config.getFFMPConfigData()
.getLayer())
if ((phuc.equals(config.getFFMPConfigData()
.getLayer()) || phuc.equals("ALL"))
&& loadType == LOADER_TYPE.INITIAL
&& source.getSourceName().equals(
config.getFFMPConfigData()
@ -311,7 +319,7 @@ public class FFMPDataLoader extends Thread {
//if (isUrisProcessNeeded(qpfData,qpfURIs)) {/*DR13839*/
if ((qpfData == null) && !qpfURIs.isEmpty()) {
if (phuc.equals(config.getFFMPConfigData()
.getLayer())) { //old code: keep for reference*/
.getLayer()) || phuc.equals("ALL")) { //old code: keep for reference*/
//if (isHucProcessNeeded(phuc)) {/*DR13839*/
getMonitor().processUris(qpfURIs,
isProductLoad, siteKey,
@ -329,9 +337,8 @@ public class FFMPDataLoader extends Thread {
}
// virtuals only have data for ALL
if (phuc.equals("ALL")) {
System.out.println("Processing " + loadType
+ " VGB: huc = " + phuc);
fireLoaderEvent(loadType, "Processing "+product.getVirtual() + "/" + phuc,
isDone);
FFMPBasinData vgbData = null;
if ((loadType == LOADER_TYPE.INITIAL)
@ -361,16 +368,17 @@ public class FFMPDataLoader extends Thread {
}
// process guidance all at once
System.out.println("Processing " + loadType
+ " GUIDANCE: huc = " + phuc);
for (String type : productRun.getGuidanceTypes(product)) {
ArrayList<SourceXML> guidSources = productRun
.getGuidanceSources(product, type);
for (SourceXML guidSource : guidSources) {
NavigableMap<Date, List<String>> iguidURIs = guids
.get(guidSource.getSourceName());
fireLoaderEvent(loadType, "Processing "+guidSource.getSourceName() + "/" + phuc,
isDone);
getMonitor().processUris(iguidURIs, isProductLoad,
siteKey, guidSource.getSourceName(), timeBack,
@ -386,11 +394,10 @@ public class FFMPDataLoader extends Thread {
}
} catch (Exception e) {
isDone = true;
statusHandler.error("FFMP Data Loader terminated...."
System.err.println("FFMP Data Loader terminated...."
+ e.getMessage());
} finally {
isDone = true;
resourceData.setLoader(loadType);
}
String message = null;
@ -471,26 +478,35 @@ public class FFMPDataLoader extends Thread {
String sourceName = source.getSourceName();
File file = new File(sharePath + wfo + File.separator + sourceName
+ "-" + siteKey + "-" + pdataKey + "-" + huc + ".bin");
System.out.println("Buddy File path: " + file.getAbsolutePath());
FFMPBasinData basinData = null;
FFMPBasinData basinData = null;
if (file.exists()) {
if (file.exists()) {
System.out.println("Last mod: " + new Date(file.lastModified()));
//System.out.println("6 hour mod: " + new Date((System.currentTimeMillis() - (6 * 1000 * 3600))));
//System.out.println("DIFF: "+(file.lastModified() - (System.currentTimeMillis() - (6 * 1000 * 3600))));
System.out.println("File path: " + file.getName());
if (file.lastModified() > (System.currentTimeMillis() - (6 * 1000 * 3600))) {
System.out.println("Buddy File path: " + file.getName());
try {
basinData = (FFMPBasinData) SerializationUtil
.transformFromThrift(FileUtil.file2bytes(file,
false));
} catch (SerializationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
try {
basinData = (FFMPBasinData) SerializationUtil
.transformFromThrift(FileUtil.file2bytes(file, false));
} catch (SerializationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
return basinData;
return basinData;
}
}
/**
* Finds the home datakey identifier for QPF sources

View file

@ -52,6 +52,7 @@ import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPCacheRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGap;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
@ -65,9 +66,17 @@ import com.raytheon.uf.common.dataplugin.ffmp.FFMPVirtualGageBasinMetaData;
import com.raytheon.uf.common.dataplugin.ffmp.HucLevelGeometriesFactory;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.config.FFFGDataMgr;
import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.monitor.xml.DomainXML;
import com.raytheon.uf.common.monitor.xml.ProductRunXML;
import com.raytheon.uf.common.monitor.xml.ProductXML;
import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -108,6 +117,7 @@ import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpBasinTableDlg;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfig;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPAutoRefreshEvent;
import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPCWAChangeEvent;
import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPFieldChangeEvent;
@ -249,23 +259,23 @@ public class FFMPResource extends
};
private FFMPRecord rateRecord = null;
private FFMPCacheRecord rateRecord = null;
private boolean isNewRate = true;
private FFMPRecord qpeRecord = null;
private FFMPCacheRecord qpeRecord = null;
private boolean isNewQpe = true;
private FFMPRecord guidRecord = null;
private FFMPCacheRecord guidRecord = null;
private boolean isNewGuid = true;
private FFMPRecord qpfRecord = null;
private FFMPCacheRecord qpfRecord = null;
private boolean isNewQpf = true;
private FFMPRecord virtualRecord = null;
private FFMPCacheRecord virtualRecord = null;
private boolean isNewVirtual = true;
@ -309,7 +319,7 @@ public class FFMPResource extends
/** table slider time **/
private Date tableTime = null;
// complete reset
public boolean isQuery = true;
@ -332,6 +342,9 @@ public class FFMPResource extends
/** guidance source expiration **/
public long guidSourceExpiration = 0l;
/** QPF source expiration **/
public long qpfSourceExpiration = 0l;
/** is this a rate load **/
public Boolean isRate = null;
@ -622,7 +635,7 @@ public class FFMPResource extends
}
case QPF: {
value = getQpfRecord(recentTime).getBasinData("ALL")
.getMaxValue(pfafs, recentTime);
.getAverageMaxValue(pfafs, recentTime, getQpfSourceExpiration());
break;
}
case GUIDANCE: {
@ -673,7 +686,7 @@ public class FFMPResource extends
case RATE:// fall through
case QPF: {
value = getBasin(key, field, recentTime, aggregate)
.getValue(recentTime);
.getAverageValue(recentTime, getQpfSourceExpiration());
break;
}
case GUIDANCE: {
@ -700,7 +713,7 @@ public class FFMPResource extends
switch (field) {
case QPF: {
value = getBasin(key, field, recentTime, aggregate)
.getValue(recentTime);
.getAverageValue(recentTime, getQpfSourceExpiration());
break;
}
case GUIDANCE: {
@ -1262,18 +1275,6 @@ public class FFMPResource extends
}
}
if (getResourceData().isSecondaryLoad) {
// kick in tertiary loader
if (!getResourceData().isTertiaryLoad) {
if ((loader == null) || !loader.isAlive()) {
Date backDate = new Date(getMostRecentTime()
.getTime() - (24 * 1000 * 3600));
startLoader(getOldestTime(), backDate,
LOADER_TYPE.TERTIARY);
}
}
}
// the product string
if (isFfmpDataToggle() && fieldDescString != null) {
paintProductString(aTarget, paintProps);
@ -1568,13 +1569,13 @@ public class FFMPResource extends
buf.append("County: " + metaBasin.getState() + ", "
+ metaBasin.getCounty() + "\n");
String valst = null;
Float val = getBasinValue(pfaf, paintTime.getRefTime(),
Float val = getBasinValue(pfaf, getPaintTime().getRefTime(),
aggregate);
if (val.isNaN() || (val == FFMPUtils.MISSING)) {
valst = "NO DATA";
} else {
valst = df.format(getBasinValue(pfaf,
paintTime.getRefTime(), aggregate));
getPaintTime().getRefTime(), aggregate));
}
if (!valst.equals("NO DATA")) {
@ -2233,7 +2234,7 @@ public class FFMPResource extends
public DataTime getPaintTime() {
return paintTime;
}
/**
* Add a value to worst case hash
*
@ -3026,7 +3027,7 @@ public class FFMPResource extends
if (ffmpTime.getTime() != time || isSplit != ffmpTime.isSplit()) {
isSplit = ffmpTime.isSplit();
setTime(ffmpTime.getTime());
setTime(ffmpTime.getTime());
setTableTime();
if (interpolationMap != null) {
interpolationMap.clear();
@ -3916,7 +3917,7 @@ public class FFMPResource extends
private void purge(Date pdate) {
long time = pdate.getTime();
time = time - (3600 * 1000 * 24);
time = time - getPurgePeriod();
Date ndate = new Date(time);
ArrayList<Date> removes = new ArrayList<Date>();
@ -3965,6 +3966,30 @@ public class FFMPResource extends
}
return qpeSourceExpiration;
}
/**
* source expiration value as a long
*
* @return
*/
public long getQpfSourceExpiration() {
if (qpfSourceExpiration == 0l) {
SourceXML source = null;
if (getProduct() != null) {
FfmpTableConfigData ffmpTableCfgData = FfmpTableConfig
.getInstance().getTableConfigData(getSiteKey());
String qpfType = ffmpTableCfgData.getQpfType();
source = getProduct().getQpfSourcesByType(qpfType).get(0);
} else {
source = FFMPSourceConfigurationManager.getInstance()
.getSource(getResourceData().sourceName);
}
qpfSourceExpiration = source.getExpirationMinutes(getSiteKey()) * 60 * 1000;
}
return qpfSourceExpiration;
}
/**
* Gets the guidance source expiration
@ -4130,7 +4155,9 @@ public class FFMPResource extends
ArrayList<String> hucsToLoad = new ArrayList<String>();
if (isWorstCase) {
hucsToLoad.add("ALL");
if (!hucsToLoad.contains("ALL")) {
hucsToLoad.add("ALL");
}
}
// tertiary loader only loads ALL
@ -4163,5 +4190,62 @@ public class FFMPResource extends
loader.removeListener(this);
}
}
/**
* Get the purge file time
*/
public long getPurgePeriod() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
LocalizationFile lfFile = pm.getLocalizationFile(lc,
"purge/ffmpPurgeRules.xml");
if (lfFile.exists()) {
//TODO Need to figure out why we can't read in the purgeRules!
/*try {
PurgeRuleSet prs = (PurgeRuleSet) SerializationUtil
.jaxbUnmarshalFromXmlFile(lfFile.getFile().getAbsolutePath());
for (PurgeRule rule: prs.getRules()) {
if (rule.getId().equals("ffmp")) {
return rule.getPeriodInMillis();
}
}
} catch (SerializationException e) {
e.printStackTrace();
return 3600*24*1000;
} */
}
return 3600*24*1000;
}
/**
* Kicks off additional loaders that need to be fired off
* @param loader
* @param isDone
*/
public void manageLoaders(FFMPLoaderStatus status) {
if (status.getLoaderType() == LOADER_TYPE.SECONDARY) {
if (status.isDone() && !this.getResourceData().isTertiaryLoad) {
try {
Date startDate = new Date(getMostRecentTime().getTime() - 12 * 3600 * 1000);
FFMPMonitor.getInstance().startLoad(this, startDate,
LOADER_TYPE.TERTIARY);
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
"Secondary Data Load failure", e);
}
}
}
// We don't really care about status of tertiary and general loaders
}
}

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.SOURCE_TYPE;
import com.raytheon.uf.common.monitor.config.FFMPTemplateConfigurationManager;
import com.raytheon.uf.common.monitor.xml.DomainXML;
import com.raytheon.uf.common.monitor.xml.ProductRunXML;
import com.raytheon.uf.common.monitor.xml.ProductXML;
@ -229,41 +230,18 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
this.timeBack = new Date(
(long) (mostRecentTime.getRefTime().getTime() - (cfgBasinXML
.getTimeFrame() * 3600 * 1000)));
ArrayList<String> hucsToLoad = new ArrayList<String>();
hucsToLoad.add(ffmpConfig.getFFMPConfigData().getLayer());
if (!ffmpConfig.getFFMPConfigData().getLayer().equals("ALL")) {
hucsToLoad.add("ALL");
}
ArrayList<String> hucsToLoad = FFMPTemplateConfigurationManager.getInstance().getHucLevels();
// goes back X hours and pre populates the Data Hashes
FFMPDataLoader loader = new FFMPDataLoader(this, timeBack,
mostRecentTime.getRefTime(), LOADER_TYPE.INITIAL,
hucsToLoad);
loader.start();
int i = 0;
// make the table load wait for finish of initial data load
while (!loader.isDone) {
try {
// give it 120 or so seconds
if (i > 12000) {
statusHandler
.handle(Priority.WARN,
"Didn't load initial data in allotted time, releasing table");
break;
}
Thread.sleep(30);
i++;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} else {
SourceXML source = getPrimarySourceXML();
this.domains = monitor.getRunConfig().getDomains();
for (int i = 0; i < objects.length; i++) {
FFMPRecord rec = (FFMPRecord) objects[i];
rec.setExpiration(source.getExpirationMinutes(siteKey));

View file

@ -16,6 +16,7 @@ import com.raytheon.uf.viz.monitor.data.ObReport;
* Date Ticket # Engineer Description
* ---------------------------------------------------
* May 15, 2012 14510 zhao Modified generateObReport()
* June 1, 2012 14510 zhao Modified getPrWX()
*
*/
public class GenerateFSSObReport {
@ -108,6 +109,9 @@ public class GenerateFSSObReport {
* @return
*/
private static String getPrWX(String[] presWeather) {
if ( presWeather == null ) {
return "";
}
StringBuffer prWx = new StringBuffer();
for (int i = presWeather.length - 1; i >= 0; i--) {
if (presWeather[i] != "") {

View file

@ -77,14 +77,12 @@ import com.raytheon.uf.viz.core.style.StyleManager;
import com.raytheon.uf.viz.core.style.StyleRule;
import com.raytheon.uf.viz.core.style.VizStyleException;
import com.raytheon.uf.viz.core.style.level.SingleLevel;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay;
import com.raytheon.viz.core.contours.rsc.displays.GriddedVectorDisplay;
import com.raytheon.viz.core.drawables.ColorMapParameterFactory;
import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay;
import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay.GriddedImagePaintProperties;
import com.raytheon.viz.core.style.contour.ContourPreferences;
import com.raytheon.viz.grid.rsc.GridLoadProperties;
import com.vividsolutions.jts.geom.Coordinate;
/**
@ -106,7 +104,7 @@ import com.vividsolutions.jts.geom.Coordinate;
public class OAResource extends
AbstractVizResource<OAResourceData, MapDescriptor> implements
IResourceDataChanged, ILoadableAsImage {
IResourceDataChanged {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(OAResource.class);
@ -178,6 +176,8 @@ public class OAResource extends
this.displayType = getCapability(DisplayTypeCapability.class)
.getDisplayType();
getCapability(DisplayTypeCapability.class).setAlternativeDisplayTypes(
Arrays.asList(DisplayType.IMAGE));
resourceData.addChangeListener(this);
if (this.displayType == DisplayType.IMAGE) {
this.getCapability(ImagingCapability.class);
@ -694,17 +694,6 @@ public class OAResource extends
disposeRenderable(renderableMap.remove(dataTime));
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#getImageryResource()
*/
@Override
public AbstractVizResource<?, ?> getImageryResource() throws VizException {
return this.resourceData.construct(new GridLoadProperties(
DisplayType.IMAGE), descriptor);
}
/*
* (non-Javadoc)
*
@ -720,13 +709,4 @@ public class OAResource extends
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return true;
}
}

View file

@ -86,21 +86,21 @@ public class DialogAreaComposite extends ScrolledComposite {
Composite rowOfButtons = new Composite(composite, style);
GridLayout gridLayout = new GridLayout(1, false);
rowOfButtons.setLayout(gridLayout);
widget.buildComposite(rowOfButtons, style);
widget.buildComposite(rowOfButtons);
while (wIterator.hasNext()) {
widget = wIterator.next();
if (widget instanceof ButtonWidget) {
gridLayout.numColumns++;
widget.buildComposite(rowOfButtons, style);
widget.buildComposite(rowOfButtons);
} else {
widget.buildComposite(composite, style);
widget.buildComposite(composite);
break;
}
}
} else {
widget.buildComposite(composite, style);
widget.buildComposite(composite);
}
}

View file

@ -24,7 +24,7 @@ import java.util.ArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
@ -56,22 +56,26 @@ public abstract class ButtonWidget extends Widget {
* .swt.widgets.Composite, int)
*/
@Override
public Composite buildComposite(Composite parent, int style) {
public Composite buildComposite(Composite parent) {
Group group = new Group(parent, style);
Group group = new Group(parent, SWT.NONE);
group.setText(makeGuiLabel(getLabel()));
GridData layoutData = new GridData(SWT.DEFAULT, SWT.FILL, false, true);
group.setLayoutData(layoutData);
RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
rowLayout.pack = false;
group.setLayout(rowLayout);
GridLayout layout = new GridLayout(1, false);
layout.marginHeight = 0;
layout.verticalSpacing = 0;
group.setLayout(layout);
buttons = new ArrayList<Button>();
if (getOptions() != null) {
for (Object option : getOptions()) {
Button button = new Button(group, setStyle());
layoutData = new GridData(SWT.DEFAULT, SWT.DEFAULT, false,
false);
button.setLayoutData(layoutData);
button.setData(option);
String text = option.toString() != null ? option.toString()
: "";

View file

@ -19,9 +19,11 @@
**/
package com.raytheon.uf.viz.python.swt.widgets;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
@ -29,6 +31,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
@ -66,7 +69,7 @@ public abstract class InputWidget extends Widget implements Listener {
* @version 1.0
*/
public class helpRepositioner implements ControlListener {
public class HelpRepositioner implements ControlListener {
/*
* (non-Javadoc)
@ -112,20 +115,37 @@ public abstract class InputWidget extends Widget implements Listener {
* .swt.widgets.Composite, int)
*/
@Override
public Composite buildComposite(Composite parent, int style) {
public Composite buildComposite(Composite parent) {
Composite composite = new Composite(parent, style);
Group group = new Group(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
composite.setLayout(gridLayout);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
gridLayout.marginHeight = 0;
group.setLayout(gridLayout);
group.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
Label label = new Label(composite, style);
Label label = new Label(group, SWT.LEFT);
label.setText(makeGuiLabel(getLabel()));
text = new Text(composite, SWT.BORDER);
text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
String s = "";
if (getValue() != null) {
s = getValue().toString();
}
int width = 30;
if (s.length() > 20) {
width = s.length() + 10;
}
GC gc = new GC(parent);
width = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), width);
gc.dispose();
text = new Text(group, SWT.BORDER);
GridData layoutData = new GridData(SWT.DEFAULT, SWT.DEFAULT, true,
false);
layoutData.widthHint = width;
text.setLayoutData(layoutData);
text.addListener(SWT.Verify, this);
text.addListener(SWT.Modify, new Listener() {
@ -143,16 +163,14 @@ public abstract class InputWidget extends Widget implements Listener {
}
});
if (getValue() != null) {
text.setText(getValue().toString());
}
text.setText(s);
this.composite = composite;
this.composite = group;
composite.getShell().addControlListener(new helpRepositioner());
composite.addControlListener(new helpRepositioner());
group.getShell().addControlListener(new HelpRepositioner());
group.addControlListener(new HelpRepositioner());
return composite;
return group;
}

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.uf.viz.python.swt.widgets;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@ -61,12 +62,14 @@ public class LabelWidget extends Widget {
* .swt.widgets.Composite, int)
*/
@Override
public Composite buildComposite(Composite parent, int style) {
Group group = new Group(parent, style);
group.setLayout(new GridLayout());
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
public Composite buildComposite(Composite parent) {
Group group = new Group(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 4;
group.setLayout(layout);
group.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
Label label = new Label(group, style);
Label label = new Label(group, SWT.LEFT);
label.setText(makeGuiLabel(getLabel()));
Object value = getValue();
if (value != null) {

View file

@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
/**
* TODO Add Description
* List widget
*
* <pre>
*
@ -68,20 +68,21 @@ public class ListWidget extends Widget {
* .swt.widgets.Composite, int)
*/
@Override
public Composite buildComposite(Composite parent, int style) {
Group group = new Group(parent, style);
public Composite buildComposite(Composite parent) {
Group group = new Group(parent, SWT.NONE);
group.setText(makeGuiLabel(getLabel()));
GridLayout layout = new GridLayout(1, false);
group.setLayout(layout);
GridData layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
GridData layoutData = new GridData(SWT.DEFAULT, SWT.FILL, false, true);
group.setLayoutData(layoutData);
// TODO: change to ToggleSelectList
org.eclipse.swt.widgets.List list = new org.eclipse.swt.widgets.List(
group, SWT.BORDER | SWT.V_SCROLL
| (this.isMultiSelect ? SWT.MULTI : SWT.SINGLE));
layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
layoutData.heightHint = list.getItemHeight() * 30;
layoutData = new GridData(SWT.DEFAULT, SWT.FILL, false, true);
if (getOptions().size() > 30) {
layoutData.heightHint = list.getItemHeight() * 30;
}
list.setLayoutData(layoutData);
List<Object> values = getValues();
@ -113,7 +114,7 @@ public class ListWidget extends Widget {
}
});
return null;
return group;
}
@SuppressWarnings("unchecked")

View file

@ -96,12 +96,13 @@ public class PushButtonWidget extends Widget {
* .swt.widgets.Composite, int)
*/
@Override
public Composite buildComposite(Composite parent, int style) {
public Composite buildComposite(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
composite
.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
button = new Button(composite, SWT.PUSH);
button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
button.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
if (this.text != null) {
button.setText(makeGuiLabel(this.text));
}

View file

@ -22,6 +22,7 @@ package com.raytheon.uf.viz.python.swt.widgets;
import java.text.DecimalFormat;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
@ -97,24 +98,25 @@ public class ScaleWidget extends Widget {
* .swt.widgets.Composite, int)
*/
@Override
public Composite buildComposite(Composite parent, int style) {
public Composite buildComposite(Composite parent) {
Group group = new Group(parent, style);
Group group = new Group(parent, SWT.NONE);
group.setText(makeGuiLabel(getLabel()));
group.setLayout(new GridLayout());
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
group.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
label = new Label(group, style);
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
scale = new Scale(group, style);
scale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = new Label(group, SWT.CENTER);
label.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
scale = new Scale(group, SWT.HORIZONTAL);
GridData layoutData = new GridData(300, SWT.DEFAULT);
scale.setLayoutData(layoutData);
minValue = ((Number) (getOptions().get(0))).floatValue();
maxValue = ((Number) (getOptions().get(1))).floatValue();
range = Math.round((maxValue - minValue) / getResolution());
format = new DecimalFormat();
format.setMaximumFractionDigits(precision);
@ -191,7 +193,7 @@ public class ScaleWidget extends Widget {
}
public int getPrecision() {
return precision;
return precision;
}
/*
@ -235,8 +237,8 @@ public class ScaleWidget extends Widget {
super.setOptions(options);
}
public void setPrecision(int precision) {
this.precision = precision;
}
public void setPrecision(int precision) {
this.precision = precision;
}
}

View file

@ -51,7 +51,7 @@ public class ScrollbarWidget extends Widget {
* .swt.widgets.Composite, int)
*/
@Override
public Composite buildComposite(Composite parent, int style) {
public Composite buildComposite(Composite parent) {
parent.getShell().pack();
Point size = parent.getShell().getSize();
parent.getShell().setSize(size.x, ((Number) (getValue())).intValue());

View file

@ -59,7 +59,7 @@ public abstract class Widget {
* Class constructor
*/
protected Widget() {
options = new ArrayList<Object>();
this.options = new ArrayList<Object>();
}
/**
@ -154,10 +154,9 @@ public abstract class Widget {
* Builds a composite for the widget attached to the given parent.
*
* @param parent
* @param style
* @return Composite capable of being placed into an SWT container.
*/
public abstract Composite buildComposite(Composite parent, int style);
public abstract Composite buildComposite(Composite parent);
/**
* @param variable

View file

@ -202,36 +202,6 @@ public class QPFResource extends AbstractMapVectorResource implements
descriptor);
}
@SuppressWarnings("unchecked")
@Override
public AbstractVizResource<AbstractRequestableResourceData, MapDescriptor> getStreamlineResource()
throws VizException {
return (AbstractVizResource<AbstractRequestableResourceData, MapDescriptor>) this.resourceData
.construct(new GridLoadProperties(
com.raytheon.uf.viz.core.rsc.DisplayType.STREAMLINE),
descriptor);
}
@SuppressWarnings("unchecked")
@Override
public AbstractVizResource<AbstractRequestableResourceData, MapDescriptor> getWindBarbResource()
throws VizException {
return (AbstractVizResource<AbstractRequestableResourceData, MapDescriptor>) this.resourceData
.construct(new GridLoadProperties(
com.raytheon.uf.viz.core.rsc.DisplayType.BARB),
descriptor);
}
@SuppressWarnings("unchecked")
@Override
public AbstractVizResource<AbstractRequestableResourceData, MapDescriptor> getArrowResource()
throws VizException {
return (AbstractVizResource<AbstractRequestableResourceData, MapDescriptor>) this.resourceData
.construct(new GridLoadProperties(
com.raytheon.uf.viz.core.rsc.DisplayType.ARROW),
descriptor);
}
@Override
public void resourceChanged(ChangeType type, Object object) {
if (type.equals(ChangeType.DATA_UPDATE)) {
@ -254,31 +224,4 @@ public class QPFResource extends AbstractMapVectorResource implements
return null;
}
@Override
public boolean isStreamlineVector() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isWindVector() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isArrowVector() {
// TODO Auto-generated method stub
return false;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return false;
}
}

View file

@ -45,11 +45,9 @@ import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
@ -63,9 +61,7 @@ import com.raytheon.uf.viz.xy.crosssection.adapter.AbstractCrossSectionAdapter;
import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor;
import com.raytheon.viz.core.contours.ContourSupport;
import com.raytheon.viz.core.contours.ContourSupport.ContourGroup;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.core.style.contour.ContourPreferences;
import com.raytheon.viz.grid.rsc.GridLoadProperties;
import com.vividsolutions.jts.geom.Envelope;
/**
@ -86,7 +82,7 @@ import com.vividsolutions.jts.geom.Envelope;
*/
public class CrossSectionContourResource extends AbstractCrossSectionResource
implements ILoadableAsImage, IResourceDataChanged {
implements IResourceDataChanged {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CrossSectionContourResource.class);
@ -129,6 +125,8 @@ public class CrossSectionContourResource extends AbstractCrossSectionResource
if (sr != null) {
prefs = contourPrefs = (ContourPreferences) sr.getPreferences();
}
getCapability(DisplayTypeCapability.class).setAlternativeDisplayTypes(
Arrays.asList(DisplayType.IMAGE));
}
/*
@ -334,15 +332,6 @@ public class CrossSectionContourResource extends AbstractCrossSectionResource
contours.clear();
}
@Override
public AbstractVizResource<?, ?> getImageryResource() throws VizException {
GridLoadProperties props = new GridLoadProperties(DisplayType.IMAGE);
props.setResourceType(ResourceType.CROSS_SECTION);
AbstractVizResource<?, ?> rsc2 = resourceData.construct(props,
getDescriptor());
return rsc2;
}
@Override
public void resourceChanged(ChangeType type, Object object) {
if (type.equals(ChangeType.CAPABILITY)) {
@ -352,16 +341,6 @@ public class CrossSectionContourResource extends AbstractCrossSectionResource
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return true;
}
@Override
public void disposeTimeData(DataTime dataTime) {
super.disposeTimeData(dataTime);

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.xy.timeheight.rsc;
import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.swt.graphics.RGB;
import org.geotools.coverage.grid.GeneralGridGeometry;
@ -30,11 +31,11 @@ import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
@ -45,10 +46,8 @@ import com.raytheon.uf.viz.xy.timeheight.display.TimeHeightDescriptor;
import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter;
import com.raytheon.viz.core.contours.ContourSupport;
import com.raytheon.viz.core.contours.ContourSupport.ContourGroup;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation;
import com.raytheon.viz.core.style.contour.ContourPreferences;
import com.raytheon.viz.grid.rsc.GridLoadProperties;
/**
* Resource for displaying cross sections as contours
@ -67,8 +66,7 @@ import com.raytheon.viz.grid.rsc.GridLoadProperties;
* @version 1.0
*/
public class TimeHeightContourResource extends AbstractTimeHeightResource
implements ILoadableAsImage {
public class TimeHeightContourResource extends AbstractTimeHeightResource {
private static final double ZOOM_REACTION_FACTOR = .45;
@ -110,6 +108,8 @@ public class TimeHeightContourResource extends AbstractTimeHeightResource
if (sr != null) {
prefs = contourPrefs = (ContourPreferences) sr.getPreferences();
}
getCapability(DisplayTypeCapability.class).setAlternativeDisplayTypes(
Arrays.asList(DisplayType.IMAGE));
}
@Override
@ -219,33 +219,6 @@ public class TimeHeightContourResource extends AbstractTimeHeightResource
}
}
@Override
public AbstractVizResource<?, ?> getImageryResource() throws VizException {
GridLoadProperties props = new GridLoadProperties(DisplayType.IMAGE);
// TimeHeightImageResource rsc = new
// TimeHeightImageResource(resourceData,
// props, adapter);
// rsc.geometry = geometry;
// rsc.interpolatedData = interpolatedData;
// use resource data to construct so that everything gets set up
// properly
AbstractVizResource<?, ?> rsc = this.getResourceData().construct(props,
this.getDescriptor());
return rsc;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return true;
}
/*
* (non-Javadoc)
*

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.xy.timeheight.rsc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -35,7 +36,6 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
@ -52,13 +52,11 @@ import com.raytheon.uf.viz.xy.InterpUtils;
import com.raytheon.uf.viz.xy.graph.IGraph;
import com.raytheon.uf.viz.xy.timeheight.display.TimeHeightDescriptor;
import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.core.contours.util.VectorGraphicsRenderable;
import com.raytheon.viz.core.graphing.xy.XYData;
import com.raytheon.viz.core.graphing.xy.XYWindImageData;
import com.raytheon.viz.core.slice.request.VerticalPointRequest.TimeDirection;
import com.raytheon.viz.core.style.arrow.ArrowPreferences;
import com.raytheon.viz.grid.rsc.GridLoadProperties;
import com.vividsolutions.jts.geom.Coordinate;
/**
@ -81,7 +79,7 @@ import com.vividsolutions.jts.geom.Coordinate;
*/
public class TimeHeightVectorResource extends AbstractTimeHeightResource
implements ILoadableAsImage, IResourceDataChanged {
implements IResourceDataChanged {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TimeHeightVectorResource.class);
@ -114,6 +112,8 @@ public class TimeHeightVectorResource extends AbstractTimeHeightResource
prefs = arrowPrefs = (ArrowPreferences) sr.getPreferences();
}
this.getResourceData().addChangeListener(this);
getCapability(DisplayTypeCapability.class).setAlternativeDisplayTypes(
Arrays.asList(DisplayType.IMAGE));
}
@Override
@ -275,25 +275,6 @@ public class TimeHeightVectorResource extends AbstractTimeHeightResource
vgr.dispose();
}
@Override
public AbstractVizResource<?, ?> getImageryResource() throws VizException {
GridLoadProperties props = new GridLoadProperties(DisplayType.IMAGE);
TimeHeightImageResource rsc = new TimeHeightImageResource(resourceData,
props, adapter);
rsc.interpolatedData = interpolatedData;
return rsc;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return true;
}
/*
* (non-Javadoc)
*

View file

@ -500,141 +500,89 @@ public class LoaderDialog extends CaveSWTDialog {
String issueTime = "";
String bbb = tagToBBB();
String siteId = "";
boolean removePendingTags = false;
for (int i = 0; i < selected.length; i++) {
String ident = selected[i];
sb.append(TafUtil.LINE_BREAK);
sb.append(TafUtil.LINE_BREAK);
// Always retrieve pending TAF from the queue
// TafQueueRecord pendingTaf = TransmissionQueue.getInstance()
// .getPendingBySiteId(ident);
// TODO get this working with database
Object pendingTaf = null;
if (pendingTaf != null) {
// Only ask one time if pending TAF(s) should be removed.
// if (removePendingTags == false) {
// String tafType = "Routine";
// String pbbb = pendingTaf.getBBB();
// if (pbbb.startsWith("A")) {
// tafType = "Amended";
// } else if (pbbb.startsWith("C")) {
// tafType = "Correctetd";
// } else if (pbbb.startsWith("R")) {
// tafType = "Delayed";
// }
// String msg = tafType
// + " TAF(s) in pending queue will be removed!\n"
// +
// "Is this what you want to do? If not, press \'No\' and re-check\n"
// + "TAF forecast type for editing.";
// MessageBox msgBox = new MessageBox(getParent(), SWT.YES
// | SWT.NO);
// msgBox.setMessage(msg);
// msgBox.setText("Pending TAF");
// if (SWT.YES == msgBox.open()) {
// removePendingTags = true;
// } else {
// return;
// }
// }
//
// String text = pendingTaf.getTafText();
// sb.append(text);
// TransmissionQueue.getInstance().remove(pendingTaf.getInfo());
//
// if (i == 0) {
// wmoId = pendingTaf.getWmoId();
// siteId = pendingTaf.getSiteId();
// bbb = pendingTaf.getBBB();
// }
} else {
TafRecord taf = null;
if (order.equals("template") == false) {
taf = TafUtil.getLatestTaf(ident);
if (taf == null) {
if (i == 0) {
tveDlg.setMessageStatusError("No TAF for site "
+ ident);
return;
}
continue;
// } else {
// // TODO the TafEditDialog.py __getForecast line: 1538
// -
// // 1540
}
}
if (taf != null && order.equals("merge") == false) {
sb.append(TafUtil.safeFormatTaf(taf, false));
} else {
String[] results = getTafTemplate(ident, bbb);
String tmpl = results[0];
if (tmpl == null) {
MessageBox msgBox = new MessageBox(getParent(), SWT.OK);
msgBox.setMessage(ident + ": " + results[1]);
msgBox.setText("Problem with template");
msgBox.open();
TafRecord taf = null;
if (order.equals("template") == false) {
taf = TafUtil.getLatestTaf(ident);
if (taf == null) {
if (i == 0) {
tveDlg.setMessageStatusError("No TAF for site " + ident);
return;
}
if (taf != null && order.equals("merge") == true) {
// TODO merge taf and template here
String[] tmp = tmpl.split(TafUtil.LINE_BREAK);
String sTmpl = tmp[1];
Pattern rexp_tmp = Pattern.compile("^" + ident
+ "\\s+\\d{6}Z\\s+(\\d{4}/\\d{4}|\\d{6})\\s+");
sTmpl = rexp_tmp.matcher(sTmpl).replaceFirst("");
String fmtTaf = TafUtil.safeFormatTaf(taf, false)
.split("=")[0];
Pattern rexp_ramd = Pattern
.compile("\\s+AMD\\s(NOT\\sSKED|LTD\\sTO)([\\s\\w/]+)?");
fmtTaf = rexp_ramd.matcher(fmtTaf).replaceAll("")
.trim();
StringBuilder contents = new StringBuilder(fmtTaf);
contents.append(" ").append(sTmpl);
for (int index = 2; index < tmp.length; ++index) {
contents.append(TafUtil.LINE_BREAK).append(
tmp[index]);
}
sb.append(contents);
} else {
sb.append(tmpl);
if (i == 0) {
String itime = tmpl.split("\n")[1].split(" +")[1];
issueTime = itime.substring(0, 4) + "00";
}
continue;
}
}
if (taf != null && order.equals("merge") == false) {
sb.append(TafUtil.safeFormatTaf(taf, false));
} else {
String[] results = getTafTemplate(ident, bbb);
String tmpl = results[0];
if (tmpl == null) {
MessageBox msgBox = new MessageBox(getParent(), SWT.OK);
msgBox.setMessage(ident + ": " + results[1]);
msgBox.setText("Problem with template");
msgBox.open();
return;
}
if (taf != null && order.equals("merge") == true) {
// TODO merge taf and template here
String[] tmp = tmpl.split(TafUtil.LINE_BREAK);
String sTmpl = tmp[1];
Pattern rexp_tmp = Pattern.compile("^" + ident
+ "\\s+\\d{6}Z\\s+(\\d{4}/\\d{4}|\\d{6})\\s+");
sTmpl = rexp_tmp.matcher(sTmpl).replaceFirst("");
String fmtTaf = TafUtil.safeFormatTaf(taf, false)
.split("=")[0];
Pattern rexp_ramd = Pattern
.compile("\\s+AMD\\s(NOT\\sSKED|LTD\\sTO)([\\s\\w/]+)?");
fmtTaf = rexp_ramd.matcher(fmtTaf).replaceAll("").trim();
StringBuilder contents = new StringBuilder(fmtTaf);
contents.append(" ").append(sTmpl);
for (int index = 2; index < tmp.length; ++index) {
contents.append(TafUtil.LINE_BREAK).append(tmp[index]);
}
sb.append(contents);
} else {
sb.append(tmpl);
if (i == 0) {
String itime = tmpl.split("\n")[1].split(" +")[1];
issueTime = itime.substring(0, 4) + "00";
}
}
}
if (i == 0) {
if (taf != null) {
String[] header = taf.getWmoHeader().split(" ");
issueTime = header[2];
}
/**
* DR #5062: It appears that using the header that comes
* with the TAF gives a wrong wmoId and siteId; here, it is
* changed to use the header from TafSiteConfig; may need
* further investigation on this...
*/
try {
ITafSiteConfig config = TafSiteConfigFactory
.getInstance();
TafSiteData siteData = config.getSite(ident);
wmoId = siteData.wmo.split(" ")[0];
siteId = siteData.wmo.split(" ")[1];
} catch (FileNotFoundException e) {
tveDlg.setSendCollective(false);
} catch (ConfigurationException e) {
tveDlg.setSendCollective(false);
} catch (IOException e) {
tveDlg.setSendCollective(false);
}
bbb = tagToBBB();
if (i == 0) {
if (taf != null) {
String[] header = taf.getWmoHeader().split(" ");
issueTime = header[2];
}
/**
* DR #5062: It appears that using the header that comes with
* the TAF gives a wrong wmoId and siteId; here, it is changed
* to use the header from TafSiteConfig; may need further
* investigation on this...
*/
try {
ITafSiteConfig config = TafSiteConfigFactory.getInstance();
TafSiteData siteData = config.getSite(ident);
wmoId = siteData.wmo.split(" ")[0];
siteId = siteData.wmo.split(" ")[1];
} catch (FileNotFoundException e) {
tveDlg.setSendCollective(false);
} catch (ConfigurationException e) {
tveDlg.setSendCollective(false);
} catch (IOException e) {
tveDlg.setSendCollective(false);
}
bbb = tagToBBB();
}
}

View file

@ -348,14 +348,11 @@ public class SendDialog extends CaveSWTDialog {
// Forecaster ID
int forecasterId = forecasterArray.get(personList.getSelectionIndex())
.getId();
// long now = System.currentTimeMillis();
Calendar xmitTime = Calendar.getInstance();
// xmitTime.setTimeInMillis(now);
xmitTime.setTimeZone(TimeZone.getTimeZone("GMT"));
xmitTime.set(Calendar.HOUR_OF_DAY, hourSpnr.getSelection());
xmitTime.set(Calendar.MINUTE, minuteSpnr.getSelection());
xmitTime.set(Calendar.SECOND, secondSpnr.getSelection());
// request.setXmitTime(xmitTime.getTime());
String xmitTimestamp = String.format(TIMESTAMP_FORMAT,
xmitTime.get(Calendar.DAY_OF_MONTH),
xmitTime.get(Calendar.HOUR_OF_DAY),
@ -363,12 +360,9 @@ public class SendDialog extends CaveSWTDialog {
// BBB
String in = tabComp.getTextEditorControl().getText();
String bbb = tabComp.getBBB();
// request.addArgument("bbb", bbb);
// WMO ID
String siteWmoId = tabComp.getWmoId();
// request.addArgument("wmoid", siteWmoId);
// WMO Site
// String siteNode = tabComp.getWmoSiteId();
String siteNode = null;
java.util.List<String> stationIds = new ArrayList<String>();
@ -407,8 +401,6 @@ public class SendDialog extends CaveSWTDialog {
// Site ID
String siteId = fourLetterId.substring(1);
// Type
// String type = tafText.substring(0, 3);
// Update Header Time to transmission time.
tafText = TIMESTAMP_PATTERN.matcher(tafText).replaceFirst(
@ -433,18 +425,14 @@ public class SendDialog extends CaveSWTDialog {
try {
// Enqueue TAFs for transmission
System.out.println("Before - " + request.toString());
request.setRecords(records);
ServerResponse<String> response = (ServerResponse<String>) ThriftClient
.sendRequest(request);
System.out.println(response.toString());
if (response.isError()) {
statusHandler.handle(Priority.PROBLEM, response.toString());
tafsQeueued = false;
}
} catch (VizException e) {
// TODO Auto-generated catch block. Please revise as
// appropriate.
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
msgStatComp.setMessageText(e.getMessage(), shell.getDisplay()
.getSystemColor(SWT.COLOR_RED).getRGB());

View file

@ -21,6 +21,8 @@ package com.raytheon.viz.aviation.utility;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
@ -201,6 +203,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
createMessageControl(configMgr);
populateData();
updateDayTransList();
}
/**
@ -312,15 +315,15 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
if (indices.length == 0) {
return;
}
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.RETRANSMIT);
request.setState(getDisplayState());
java.util.List<String> idList = new ArrayList<String>();
java.util.List<String> idList = new ArrayList<String>(indices.length);
for (int index : indices) {
idList.add(transListId.get(index));
}
request.addArgument("idlist", idList);
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.RETRANSMIT);
request.setState(getDisplayState());
request.setArgument(idList);
try {
ServerResponse<java.util.List<String>> response = (ServerResponse<java.util.List<String>>) ThriftClient
.sendRequest(request);
@ -363,14 +366,14 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
return;
}
java.util.List<String> idList = new ArrayList<String>();
java.util.List<String> idList = new ArrayList<String>(indices.length);
for (int index : indices) {
idList.add(transListId.get(index));
}
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.GET_TAFS);
request.addArgument("idlist", idList);
request.setArgument(idList);
ServerResponse<String> response = null;
try {
response = (ServerResponse<String>) ThriftClient
@ -400,15 +403,19 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
*/
@SuppressWarnings("unchecked")
private void removeSelected() {
int[] indices = transList.getSelectionIndices();
if (indices.length == 0) {
return;
}
java.util.List<String> idList = new ArrayList<String>(indices.length);
for (int index : indices) {
idList.add(transListId.get(index));
}
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.REMOVE_SELECTED);
request.setState(getDisplayState());
request.setArgument(idList);
java.util.List<String> idList = new ArrayList<String>();
for (int index : transList.getSelectionIndices()) {
idList.add(transListId.get(index));
}
request.addArgument("idlist", idList);
try {
ServerResponse<java.util.List<String>> response = (ServerResponse<java.util.List<String>>) ThriftClient
.sendRequest(request);
@ -573,7 +580,6 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
transStText.setEditable(false);
transStText.setLayoutData(gd);
configMgr.setTextEditorFontAndColors(transStText);
updateDayTransList();
}
/**
@ -592,10 +598,9 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
private void updateDayTransList() {
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.GET_LOG);
List<Date> dateList = new ArrayList<Date>(2);
dayLbl.setText(dayOfWeek[selectedDay - 1]);
StringBuilder txt = new StringBuilder();
// Adjust currentDay to start of the day
Calendar currentDay = Calendar.getInstance();
currentDay.set(Calendar.HOUR_OF_DAY, 0);
@ -610,19 +615,20 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
if (currentDay.compareTo(selectedDayStart) < 0) {
selectedDayStart.add(Calendar.DAY_OF_MONTH, -7);
}
request.addArgument("starttime", selectedDayStart.getTime());
dateList.add(selectedDayStart.getTime());
// Determine start of next day.
Calendar selectedDayEnd = Calendar.getInstance();
selectedDayEnd.setTime(selectedDayStart.getTime());
selectedDayEnd.add(Calendar.DAY_OF_MONTH, 1);
request.addArgument("endtime", selectedDayEnd.getTime());
dateList.add(selectedDayEnd.getTime());
request.setArgument(dateList);
try {
ServerResponse<String> response = (ServerResponse<String>) ThriftClient
.sendRequest(request);
txt.append(response.getPayload());
transStText.setText(txt.toString());
String text = response.getPayload();
transStText.setText(text);
} catch (VizException e) {
msgStatComp.setMessageText(e.getMessage(), getParent().getDisplay()
.getSystemColor(SWT.COLOR_RED).getRGB());

View file

@ -31,6 +31,7 @@ import org.eclipse.ui.IWorkbenchPart;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.DisplayType;
import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.Mode;
@ -102,11 +103,17 @@ public class StormTrackUIManager extends InputAdapter {
container.registerMouseHandler(this);
}
Display display = Display.getCurrent();
VizApp.runAsync(new Runnable() {
@Override
public void run() {
Display display = getShell().getDisplay();
movePolygon = display.getSystemCursor(SWT.CURSOR_SIZEALL);
movePoint = display.getSystemCursor(SWT.CURSOR_HAND);
arrow = display.getSystemCursor(SWT.CURSOR_ARROW);
}
});
movePolygon = new Cursor(display, SWT.CURSOR_SIZEALL);
movePoint = new Cursor(display, SWT.CURSOR_HAND);
arrow = new Cursor(display, SWT.CURSOR_ARROW);
}
public void dispose() {
@ -115,9 +122,6 @@ public class StormTrackUIManager extends InputAdapter {
container.unregisterMouseHandler(this);
}
movePolygon.dispose();
movePoint.dispose();
arrow.dispose();
}
/**

View file

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<?eclipse version="3.2"?>
<plugin>
<extension
point="com.raytheon.viz.ui.contextualMenu">
<contextualMenu
actionClass="com.raytheon.viz.core.contours.cmenu.ConvertToImagery"
capabilityInterface="com.raytheon.viz.core.contours.ILoadableAsImage"
name="Load as Image"
sortID="110">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.core.contours.cmenu.ConvertToStreamlines"
capabilityInterface="com.raytheon.viz.core.contours.ILoadableAsStreamline"
name="Load as Streamlines"
sortID="111">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.core.contours.cmenu.ConvertToWindBarbs"
capabilityInterface="com.raytheon.viz.core.contours.ILoadableAsWindBarbs"
name="Load as Wind Barbs"
sortID="112">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.core.contours.cmenu.ConvertToArrows"
capabilityInterface="com.raytheon.viz.core.contours.ILoadableAsArrows"
name="Load as Arrows"
sortID="113">
</contextualMenu>
</extension>
</plugin>

View file

@ -1,58 +0,0 @@
/**
* 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.core.contours;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
/**
* ILoadableAsImage
*
* Interface that specifies an imagery resource can be created from an existing
* resource
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 25, 2007 chammack Initial Creation.
*
* </pre>
*
* @author chammack
* @version 1
*/
public interface ILoadableAsImage {
/**
* Return the corresponding imagery resource
*
* @return an imagery resource
* @throws VizException
*/
public abstract AbstractVizResource<?, ?> getImageryResource()
throws VizException;
public abstract boolean isLoadableAsImage();
}

View file

@ -1,58 +0,0 @@
/**
* 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.core.contours;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
/**
* ILoadableAsStreamline
*
* Interface that specifies a streamline resource can be created from an
* existing resource
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 04, 2008 brockwoo Initial Creation.
*
* </pre>
*
* @author brockwoo
* @version 1
*/
public interface ILoadableAsStreamline {
/**
* Return the corresponding imagery resource
*
* @return an imagery resource
* @throws VizException
*/
public abstract AbstractVizResource<?, ?> getStreamlineResource()
throws VizException;
public abstract boolean isStreamlineVector();
}

View file

@ -1,52 +0,0 @@
/**
* 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.core.contours;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 6, 2009 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public interface ILoadableAsWindBarbs {
/**
* Return the corresponding imagery resource
*
* @return an imagery resource
* @throws VizException
*/
public abstract AbstractVizResource<?, ?> getWindBarbResource()
throws VizException;
public abstract boolean isWindVector();
}

View file

@ -1,117 +0,0 @@
/**
* 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.core.contours.cmenu;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.viz.core.contours.ILoadableAsArrows;
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 6, 2009 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class ConvertToArrows extends AbstractRightClickAction {
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
System.out.println("Converting image to Arrows");
try {
IGraphicsTarget activeTarget = container.getActiveDisplayPane()
.getTarget();
AbstractVizResource<?, ?> arrowRsc = ((ILoadableAsArrows) this
.getSelectedRsc()).getArrowResource();
this.getDescriptor().getResourceList().add(arrowRsc);
} catch (VizException e) {
ErrorDialog.openError(Display.getCurrent().getActiveShell(),
"Error converting to imagery",
"Error converting contour resource to imagery resource",
new Status(Status.ERROR,
com.raytheon.viz.core.contours.Activator.PLUGIN_ID,
"Error creating imagery resource", e));
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#getText()
*/
@Override
public String getText() {
return "Load as Arrows";
}
@Override
public boolean isHidden() {
if (getSelectedRsc() instanceof ILoadableAsArrows) {
return !((ILoadableAsArrows) getSelectedRsc()).isArrowVector();
}
return false;
}
@Override
public boolean isEnabled() {
AbstractVizResource<?, ?> rsc = getSelectedRsc();
AbstractResourceData rrd = rsc.getResourceData();
if (rsc != null && rrd != null) {
for (ResourcePair rp : rsc.getDescriptor().getResourceList()) {
AbstractVizResource<?, ?> rsc2 = rp.getResource();
if (rsc2 != null
&& rsc2 != rsc
&& rrd.equals(rsc2.getResourceData()) == true
&& rsc2.getCapability(DisplayTypeCapability.class)
.getDisplayType() == DisplayType.ARROW) {
return false;
}
}
return true;
} else {
return false;
}
}
}

View file

@ -1,122 +0,0 @@
/**
* 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.core.contours.cmenu;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.viz.core.contours.ILoadableAsStreamline;
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
/**
* ConvertToStreamline
*
* Action to create an streamline resource from a contour resource
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 05, 2008 brockwoo Initial Creation.
*
* </pre>
*
* @author brockwoo
* @version 1
*/
public class ConvertToStreamlines extends AbstractRightClickAction {
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
try {
IGraphicsTarget activeTarget = container.getActiveDisplayPane()
.getTarget();
ILoadableAsStreamline rsc = ((ILoadableAsStreamline) this
.getSelectedRsc());
AbstractVizResource<?, ?> streamlineRsc = rsc
.getStreamlineResource();
this.getDescriptor().getResourceList().add(streamlineRsc);
} catch (VizException e) {
ErrorDialog.openError(Display.getCurrent().getActiveShell(),
"Error converting to imagery",
"Error converting contour resource to imagery resource",
new Status(Status.ERROR,
com.raytheon.viz.core.contours.Activator.PLUGIN_ID,
"Error creating imagery resource", e));
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#getText()
*/
@Override
public String getText() {
return "Load as Streamlines";
}
@Override
public boolean isHidden() {
if (getSelectedRsc() instanceof ILoadableAsStreamline) {
return !((ILoadableAsStreamline) getSelectedRsc())
.isStreamlineVector();
}
return false;
}
@Override
public boolean isEnabled() {
AbstractVizResource<?, ?> rsc = getSelectedRsc();
AbstractResourceData rrd = rsc.getResourceData();
if (rsc != null && rrd != null) {
for (ResourcePair rp : rsc.getDescriptor().getResourceList()) {
AbstractVizResource<?, ?> rsc2 = rp.getResource();
if (rsc2 != null
&& rsc2 != rsc
&& rrd.equals(rsc2.getResourceData()) == true
&& rsc2.getCapability(DisplayTypeCapability.class)
.getDisplayType() == DisplayType.STREAMLINE) {
return false;
}
}
return true;
} else {
return false;
}
}
}

View file

@ -1,118 +0,0 @@
/**
* 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.core.contours.cmenu;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.viz.core.contours.ILoadableAsWindBarbs;
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 6, 2009 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class ConvertToWindBarbs extends AbstractRightClickAction {
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
System.out.println("Converting image to Wind Barbs");
try {
IGraphicsTarget activeTarget = container.getActiveDisplayPane()
.getTarget();
ILoadableAsWindBarbs rsc = ((ILoadableAsWindBarbs) this
.getSelectedRsc());
AbstractVizResource<?, ?> arrowRsc = rsc.getWindBarbResource();
this.getDescriptor().getResourceList().add(arrowRsc);
} catch (VizException e) {
ErrorDialog.openError(Display.getCurrent().getActiveShell(),
"Error converting to imagery",
"Error converting contour resource to imagery resource",
new Status(Status.ERROR,
com.raytheon.viz.core.contours.Activator.PLUGIN_ID,
"Error creating imagery resource", e));
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#getText()
*/
@Override
public String getText() {
return "Load as Wind Barbs";
}
@Override
public boolean isHidden() {
if (getSelectedRsc() instanceof ILoadableAsWindBarbs) {
return !((ILoadableAsWindBarbs) getSelectedRsc()).isWindVector();
}
return false;
}
@Override
public boolean isEnabled() {
AbstractVizResource<?, ?> rsc = getSelectedRsc();
AbstractResourceData rrd = rsc.getResourceData();
if (rsc != null && rrd != null) {
for (ResourcePair rp : rsc.getDescriptor().getResourceList()) {
AbstractVizResource<?, ?> rsc2 = rp.getResource();
if (rsc2 != null
&& rsc2 != rsc
&& rrd.equals(rsc2.getResourceData()) == true
&& rsc2.getCapability(DisplayTypeCapability.class)
.getDisplayType() == DisplayType.BARB) {
return false;
}
}
return true;
} else {
return false;
}
}
}

View file

@ -226,6 +226,9 @@ public class BestResResource extends
@Override
public String inspect(ReferencedCoordinate latLon) throws VizException {
if (vizResource != null) {
Map<AbstractVizResource<?, ?>, DataTime[]> timeMap = descriptor
.getTimeMatchingMap();
timeMap.put(vizResource, timeMap.get(this));
return vizResource.inspect(latLon);
} else {
return "";

View file

@ -150,10 +150,6 @@
id="com.raytheon.uf.viz.thinclient.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.viz.npp.feature"
version="0.0.0"/>
<requires>
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
</requires>

View file

@ -41,6 +41,7 @@ import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID.DataType;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.server.lock.LockTable;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.DBInvChangeNotification;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridHistoryUpdateNotification;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.GridUpdateNotification;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.LockNotification;
import com.raytheon.uf.common.localization.IPathManager;
@ -238,6 +239,8 @@ public abstract class AbstractParmManager implements IParmManager {
private AbstractGFENotificationObserver<GridUpdateNotification> gridUpdateListener;
private AbstractGFENotificationObserver<GridHistoryUpdateNotification> gridHistoryUpdateListener;
private AbstractGFENotificationObserver<LockNotification> lockNotificationListener;
private AbstractGFENotificationObserver<SiteActivationNotification> siteActivationListener;
@ -337,6 +340,21 @@ public abstract class AbstractParmManager implements IParmManager {
};
this.gridHistoryUpdateListener = new AbstractGFENotificationObserver<GridHistoryUpdateNotification>(
GridHistoryUpdateNotification.class) {
@Override
public void notify(GridHistoryUpdateNotification notificationMessage) {
ParmID parmID = notificationMessage.getParmId();
Parm parm = getParm(parmID);
if (parm != null) {
parm.historyUpdateArrived(notificationMessage
.getHistories());
}
}
};
this.lockNotificationListener = new AbstractGFENotificationObserver<LockNotification>(
LockNotification.class) {
@ -377,6 +395,9 @@ public abstract class AbstractParmManager implements IParmManager {
dataManager.getNotificationRouter()
.addObserver(this.gridUpdateListener);
dataManager.getNotificationRouter().addObserver(
this.gridHistoryUpdateListener);
dataManager.getNotificationRouter().addObserver(
this.siteActivationListener);
@ -401,6 +422,9 @@ public abstract class AbstractParmManager implements IParmManager {
dataManager.getNotificationRouter().removeObserver(
this.gridUpdateListener);
dataManager.getNotificationRouter().removeObserver(
this.gridHistoryUpdateListener);
dataManager.getNotificationRouter().removeObserver(
this.siteActivationListener);

View file

@ -17,36 +17,27 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.core.contours;
package com.raytheon.viz.gfe.core.msgs;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.viz.gfe.core.parm.Parm;
/**
* TODO Add Description
* History updated listener
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 6, 2009 mschenke Initial creation
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 22, 2012 #598 randerso Initial creation
*
* </pre>
*
* @author mschenke
* @author chammack
* @version 1.0
*/
public interface IGridHistoryUpdatedListener {
public interface ILoadableAsArrows {
/**
* Return the corresponding imagery resource
*
* @return an imagery resource
* @throws VizException
*/
public abstract AbstractVizResource<?, ?> getArrowResource()
throws VizException;
public void gridHistoryUpdated(Parm parm, TimeRange timeRange);
public abstract boolean isArrowVector();
}

View file

@ -419,6 +419,54 @@ public class DbParm extends Parm {
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.gfe.core.parm.Parm#historyUpdateArrived(java.util.Map)
*/
@Override
public void historyUpdateArrived(
Map<TimeRange, List<GridDataHistory>> histories) {
// Old code also rejected when newTimeRanges.length was 0.
// Length 0 is valid for deletions over whole time range.
if (histories == null) {
return;
}
List<TimeRange> newTimeRanges = new ArrayList<TimeRange>(
histories.keySet());
// Find the full range of data affected
Collections.sort(newTimeRanges);
// process history updates
for (TimeRange tr : newTimeRanges) {
IGridData[] grids = this.getGridInventory(tr);
// if only a single unmodified grid exactly matches the time range
if (grids.length == 1 && !this.isLocked(tr)
&& grids[0].getGridSlice().getValidTime().equals(tr)) {
List<GridDataHistory> newHist = histories.get(tr);
GridDataHistory[] currentHist = grids[0].getGridSlice()
.getHistory();
// if current history exists and has a matching update time
if (currentHist != null
&& currentHist[0].getUpdateTime().equals(
newHist.get(0).getUpdateTime())) {
// update last sent time
currentHist[0].setLastSentTime(newHist.get(0)
.getLastSentTime());
}
}
// notify parm clients of history update
sendGridHistoryUpdatedNotification(tr);
}
}
@Override
protected boolean requestLock(List<LockRequest> lreq) {
@ -574,17 +622,20 @@ public class DbParm extends Parm {
success &= allSaved;
}
// if any pending saves
if (sgr.size() > 0) {
if (doSave(sgr)) {
for (TimeRange t : pendingUnlocks) {
lreq.add(new LockRequest(getParmID(), t, LockMode.UNLOCK));
}
} else {
if (!doSave(sgr)) {
success = false;
}
}
if (success) {
for (TimeRange t : pendingUnlocks) {
lreq.add(new LockRequest(getParmID(), t, LockMode.UNLOCK));
}
}
if (lreq.size() > 0) {
success &= requestLock(lreq);
}

View file

@ -928,6 +928,14 @@ public abstract class Parm implements Comparable<Parm> {
}
}
/**
* Sends a grid history updated notification to all parm clients. The time
* range of the updated history is given.
*/
protected void sendGridHistoryUpdatedNotification(final TimeRange tr) {
this.parmListeners.fireGridHistoryUpdatedListener(this, tr);
}
/**
* Command to start a parm edit sequence for the given time. This routine is
* used for grid and point modification routines (GridData and PointData).
@ -4525,6 +4533,16 @@ public abstract class Parm implements Comparable<Parm> {
public abstract void inventoryArrived(final TimeRange affectedTimeRange,
final Map<TimeRange, List<GridDataHistory>> histories);
/**
* Method called when notification of updated history arrives
*
* @param histories
*/
public void historyUpdateArrived(
Map<TimeRange, List<GridDataHistory>> histories) {
// do nothing default implementation
}
/**
* Updates the lock table with an updated version due to notifications
*

View file

@ -30,6 +30,7 @@ import com.raytheon.viz.gfe.core.msgs.GridDataChangedMsg;
import com.raytheon.viz.gfe.core.msgs.IColorTableModifiedListener;
import com.raytheon.viz.gfe.core.msgs.ICombineModeChangedListener;
import com.raytheon.viz.gfe.core.msgs.IGridDataChangedListener;
import com.raytheon.viz.gfe.core.msgs.IGridHistoryUpdatedListener;
import com.raytheon.viz.gfe.core.msgs.ILockTableChangedListener;
import com.raytheon.viz.gfe.core.msgs.IParameterSelectionChangedListener;
import com.raytheon.viz.gfe.core.msgs.IParmIDChangedListener;
@ -70,6 +71,8 @@ public class ParmListeners {
private final ListenerList parmInventoryChangedListeners;
private final ListenerList gridHistoryUpdatedListeners;
private final ListenerList parmIDChangedListeners;
private final ListenerList selectionTimeRangeChangedListeners;
@ -106,6 +109,8 @@ public class ParmListeners {
this.colorTableModifiedListeners = new ListenerList(
ListenerList.IDENTITY);
this.lockTableChangedListeners = new ListenerList(ListenerList.IDENTITY);
this.gridHistoryUpdatedListeners = new ListenerList(
ListenerList.IDENTITY);
this.notificationPool = pool;
}
@ -287,6 +292,43 @@ public class ParmListeners {
}
}
public void fireGridHistoryUpdatedListener(final Parm parm,
final TimeRange tr) {
for (Object listener : this.gridHistoryUpdatedListeners.getListeners()) {
final IGridHistoryUpdatedListener casted = (IGridHistoryUpdatedListener) listener;
Runnable notTask = new Runnable() {
@Override
public void run() {
casted.gridHistoryUpdated(parm, tr);
}
};
notificationPool.schedule(notTask);
}
}
/**
* Add grid history updated listener
*
* @param listener
*/
public void addGridHistoryUpdatedListener(
IGridHistoryUpdatedListener listener) {
Validate.notNull(listener, "Attempting to add null listener");
this.gridHistoryUpdatedListeners.add(listener);
}
/**
* Remove grid history updated listener
*
* @param listener
*/
public void removeGridHistoryUpdatedListener(
IGridHistoryUpdatedListener listener) {
this.gridHistoryUpdatedListeners.remove(listener);
}
/**
* Add grid changed listener
*
@ -490,5 +532,4 @@ public class ParmListeners {
ILockTableChangedListener listener) {
this.lockTableChangedListeners.remove(listener);
}
}

View file

@ -28,7 +28,6 @@ import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.viz.python.swt.Window;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
/**
@ -94,37 +93,35 @@ public class WrapLengthDialog extends CaveJFACEDialog {
*
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
protected void buttonPressed(int buttonId) {
if (buttonId == Window.OK) {
// Validate the value in the text field
wrapLength = null;
try {
wrapLength = Integer.valueOf(userText.getText());
} catch (NumberFormatException e) {
; // we'll handle it below
}
String errTxt = null;
if (wrapLength == null) {
errTxt = "Not an integer.";
} else if (wrapLength < MIN_COLUMNS) {
errTxt = "Wrap Length must be at least " + MIN_COLUMNS + ".";
} else if (wrapLength > MAX_COLUMNS) {
errTxt = "Wrap Length cannot be greater than " + MAX_COLUMNS
+ ".";
}
if (errTxt != null) {
MessageBox warningDialog = new MessageBox(getShell(), SWT.OK
| SWT.ICON_WARNING | SWT.APPLICATION_MODAL);
warningDialog.setText("Illegal value");
warningDialog.setMessage(errTxt + "\nPlease try again.");
warningDialog.open();
userText.selectAll();
userText.setFocus();
return;
}
@Override
protected void okPressed() {
// Validate the value in the text field
wrapLength = null;
try {
wrapLength = Integer.valueOf(userText.getText());
} catch (NumberFormatException e) {
; // we'll handle it below
}
String errTxt = null;
if (wrapLength == null) {
errTxt = "Not an integer.";
} else if (wrapLength < MIN_COLUMNS) {
errTxt = "Wrap Length must be at least " + MIN_COLUMNS + ".";
} else if (wrapLength > MAX_COLUMNS) {
errTxt = "Wrap Length cannot be greater than " + MAX_COLUMNS + ".";
}
if (errTxt != null) {
MessageBox warningDialog = new MessageBox(getShell(), SWT.OK
| SWT.ICON_WARNING | SWT.APPLICATION_MODAL);
warningDialog.setText("Illegal value");
warningDialog.setMessage(errTxt + "\nPlease try again.");
warningDialog.open();
userText.selectAll();
userText.setFocus();
return;
}
// If we got here, the dialog will close.
super.buttonPressed(buttonId);
super.okPressed();
}
/**

View file

@ -61,6 +61,7 @@ import com.raytheon.viz.gfe.core.msgs.GMDisplayModeMsg;
import com.raytheon.viz.gfe.core.msgs.HighlightMsg;
import com.raytheon.viz.gfe.core.msgs.IActivatedParmChangedListener;
import com.raytheon.viz.gfe.core.msgs.IGridDataChangedListener;
import com.raytheon.viz.gfe.core.msgs.IGridHistoryUpdatedListener;
import com.raytheon.viz.gfe.core.msgs.IGridVisibilityChangedListener;
import com.raytheon.viz.gfe.core.msgs.ILockTableChangedListener;
import com.raytheon.viz.gfe.core.msgs.IParameterSelectionChangedListener;
@ -95,7 +96,7 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener,
IGridVisibilityChangedListener, IActivatedParmChangedListener,
IGridDataChangedListener, ISelectionTimeRangeChangedListener,
IParameterSelectionChangedListener, ILockTableChangedListener,
IParmIDChangedListener, DisposeListener
IParmIDChangedListener, IGridHistoryUpdatedListener, DisposeListener
{
private static final transient IUFStatusHandler statusHandler = UFStatus
@ -258,7 +259,7 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener,
//
// private int redrawCount;
private Display display;
// private Display display;
/**
* @param aCanvas
@ -269,7 +270,7 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener,
public GridBar(final GridCanvas aCanvas, final Parm aParm,
final GridManager aGridManager) {
canvas = aCanvas;
display = canvas.getDisplay();
// display = canvas.getDisplay();
parm = aParm;
gridManager = aGridManager;
@ -284,6 +285,7 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener,
this.parm.getListeners().addParmInventoryChangedListener(this);
this.parm.getListeners().addGridChangedListener(this);
this.parm.getListeners().addGridHistoryUpdatedListener(this);
this.parm.getListeners().addSelectionTimeRangeChangedListener(this);
this.parm.getListeners().addParameterSelectionChangedListener(this);
this.parm.getListeners().addLockTableChangedListener(this);
@ -324,6 +326,7 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener,
parm.getListeners().removeParmInventoryChangedListener(this);
parm.getListeners().removeGridChangedListener(this);
parm.getListeners().removeGridHistoryUpdatedListener(this);
parm.getListeners().removeSelectionTimeRangeChangedListener(this);
parm.getListeners().removeParameterSelectionChangedListener(this);
parm.getListeners().removeLockTableChangedListener(this);
@ -1466,7 +1469,24 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener,
public void parmInventoryChanged(Parm parm, TimeRange timeRange) {
// System.out.println("parmInventoryChanged for " + this);
canvas.calcStepTimes();
if (this.gridManager.checkVisibility(timeRange)) {
if (this.parm.equals(parm)
&& this.gridManager.checkVisibility(timeRange)) {
redraw();
}
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.gfe.core.msgs.IGridHistoryUpdatedListener#historyUpdated
* (com.raytheon.viz.gfe.core.parm.Parm,
* com.raytheon.uf.common.time.TimeRange)
*/
@Override
public void gridHistoryUpdated(Parm parm, TimeRange timeRange) {
if (this.parm.equals(parm)
&& this.gridManager.checkVisibility(timeRange)) {
redraw();
}
}
@ -1511,8 +1531,10 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener,
@Override
public void gridDataChanged(ParmID parmId, TimeRange validTime) {
// System.out.println("gridDataChanged for " + this);
if (this.gridManager.checkVisibility(validTime)) {
// System.out.println(this + " processing gridDataChanged(" + parmId
// + ", " + validTime + ")");
if (this.parm.getParmID().equals(parmId)
&& this.gridManager.checkVisibility(validTime)) {
redraw();
}
}
@ -1536,7 +1558,9 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener,
@Override
public void lockTableChanged(Parm parm, LockTable lockTable) {
// System.out.println("lockTableChanged for " + this);
redraw();
if (this.parm.equals(parm)) {
redraw();
}
}
@Override

View file

@ -63,7 +63,6 @@ import com.raytheon.uf.common.dataplugin.gfe.grid.IGrid2D;
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData;
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData.CoordinateType;
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceID;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.UserMessageNotification;
import com.raytheon.uf.common.dataplugin.gfe.slice.DiscreteGridSlice;
import com.raytheon.uf.common.dataplugin.gfe.slice.IGridSlice;
import com.raytheon.uf.common.dataplugin.gfe.slice.ScalarGridSlice;
@ -124,7 +123,6 @@ import com.raytheon.viz.gfe.core.IReferenceSetManager.RefSetMode;
import com.raytheon.viz.gfe.core.griddata.DiscreteGridData;
import com.raytheon.viz.gfe.core.griddata.IGridData;
import com.raytheon.viz.gfe.core.griddata.WeatherGridData;
import com.raytheon.viz.gfe.core.internal.NotificationRouter.AbstractGFENotificationObserver;
import com.raytheon.viz.gfe.core.internal.OffscreenSpatialDisplayManager;
import com.raytheon.viz.gfe.core.msgs.IGridDataChangedListener;
import com.raytheon.viz.gfe.core.msgs.IParmIDChangedListener;
@ -276,8 +274,6 @@ public class GFEResource extends
};
private AbstractGFENotificationObserver<UserMessageNotification> notificationObserver;
/**
* Construct a resource that is capable of displaying a particular parm
*
@ -320,26 +316,6 @@ public class GFEResource extends
updateRightClickMenu();
// TODO: this probably should be done in parmManager or maybe not at all
// there should be some kind of parm inv update when new ISC data comes
// in that should be listened for in if ISC mode is on
notificationObserver = new AbstractGFENotificationObserver<UserMessageNotification>(
UserMessageNotification.class) {
@Override
public void notify(UserMessageNotification notificationMessage) {
if (notificationMessage.getCategory().equals("ISC")) {
for (Parm p : GFEResource.this.dataManager.getParmManager()
.getSelectedParms()) {
p.getListeners().fireGridChangedListener(p.getParmID(),
p.getInventorySpan());
}
reset();
}
}
};
dataManager.getNotificationRouter().addObserver(notificationObserver);
Message.registerInterest(this, ShowISCGridsMsg.class);
}
@ -399,8 +375,6 @@ public class GFEResource extends
}
}
dataManager.getNotificationRouter()
.removeObserver(notificationObserver);
parm.getListeners().removeGridChangedListener(gridChanged);
parm.getListeners().removeParmInventoryChangedListener(
parmInventoryChanged);
@ -1584,6 +1558,21 @@ public class GFEResource extends
if (gid != null) {
issueRefresh();
}
Parm iscParm = this.dataManager.getIscDataAccess()
.getISCParm(this.parm);
if (iscParm != null) {
if (message.show()) {
// iscParm.getListeners().addParmInventoryChangedListener(
// this.parmInventoryChanged);
iscParm.getListeners().addGridChangedListener(this.gridChanged);
} else {
// iscParm.getListeners().removeParmInventoryChangedListener(
// this.parmInventoryChanged);
iscParm.getListeners().removeGridChangedListener(
this.gridChanged);
}
}
}
}

View file

@ -48,8 +48,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.constants.StatusConstants;
import com.raytheon.viz.gfe.types.MutableInteger;
/**
@ -63,13 +61,16 @@ import com.raytheon.viz.gfe.types.MutableInteger;
* Sep 3, 2008 1283 njensen Fixed issues
* Sep 9, 2008 1283 njensen Implemented sample methods
* May 29, 2009 2159 rjpeter Optimized sample methods.
* May 24, 2012 673 randerso Added defaulted method calls
*
* </pre>
*
* @author mnash
* @version 1.0
*/
public class HistSample {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(HistSample.class);
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(HistSample.class);
private static final double DEG_TO_RAD = Math.PI / 180;
@ -239,6 +240,10 @@ public class HistSample {
_numSamplePoints = countSamplePoints();
}
public final HistValue average() {
return average(true);
}
/**
* Description : Returns the average of the samples for SCALAR. Returns the
* average magnitude/direction for VECTOR. The most common value is provided
@ -619,6 +624,18 @@ public class HistSample {
return _absoluteMax;
}
public final HistValue moderatedAverage() {
return moderatedAverage(15, 15, true);
}
public final HistValue moderatedAverage(int minpercent) {
return moderatedAverage(minpercent, 15, true);
}
public final HistValue moderatedAverage(int minpercent, int maxpercent) {
return moderatedAverage(minpercent, maxpercent, true);
}
/**
* Description : Returns the representative average of the samples for
* SCALAR. Returns the representative magnitude/direction for VECTOR. The
@ -794,6 +811,10 @@ public class HistSample {
}
}
public final HistValue moderatedMin() {
return moderatedMin(15);
}
/**
* Description : Returns the representative minimum value for the sample
* points. this is a no-op for WEATHER/DISCRETE. Percent should be between 0
@ -834,6 +855,10 @@ public class HistSample {
return _moderatedMin;
}
public final HistValue moderatedMax() {
return moderatedMax(15);
}
/**
* Description : Returns the representative maximu value for the sample
* points. This is a no-op for WEATHER/DISCRETE. Percent should be between 0
@ -878,6 +903,18 @@ public class HistSample {
return _moderatedMax;
}
public final HistValue stdDevAvg() {
return stdDevAvg(1.0f, 1.0f, true);
}
public final HistValue stdDevAvg(float minStdD) {
return stdDevAvg(minStdD, 1.0f, true);
}
public final HistValue stdDevAvg(float minStdD, float maxStdD) {
return stdDevAvg(minStdD, maxStdD, true);
}
/**
* Description : Returns the representative average of the samples for
* SCALAR. Returns the representative magnitude/direction for VECTOR. The
@ -1029,6 +1066,10 @@ public class HistSample {
}
}
public final HistValue stdDevMin() {
return stdDevMin(1.0f);
}
/**
* Description : Returns the representative minimum value for the sample
* points. This is a no-op for WEATHER/DISCRETE. Based on standard
@ -1068,6 +1109,10 @@ public class HistSample {
return _stdDevMin;
}
public final HistValue stdDevMax() {
return stdDevMax(1.0f);
}
/**
* Description : Returns the representative maximum value for the sample
* points. This is a no-op for WEATHER/DISCRETE. Based on standard
@ -1221,9 +1266,8 @@ public class HistSample {
Point saSize = new Point(area.getXdim(), area.getYdim());
if (!grid.getGridInfo().getGridLoc().gridSize().equals(saSize)) {
statusHandler.handle(Priority.PROBLEM, "Grid size ["
+ grid.getGridInfo().getGridLoc().gridSize()
+ "] and Grid2DBit size [" + saSize
+ "] not the same");
+ grid.getGridInfo().getGridLoc().gridSize()
+ "] and Grid2DBit size [" + saSize + "] not the same");
return;
}

View file

@ -22,20 +22,8 @@ package com.raytheon.viz.gfe.smartscript;
import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.viz.python.swt.widgets.CheckWidget;
import com.raytheon.uf.viz.python.swt.widgets.LabelWidget;
import com.raytheon.uf.viz.python.swt.widgets.ListWidget;
import com.raytheon.uf.viz.python.swt.widgets.NumberWidget;
import com.raytheon.uf.viz.python.swt.widgets.RadioWidget;
import com.raytheon.uf.viz.python.swt.widgets.ScaleWidget;
import com.raytheon.uf.viz.python.swt.widgets.ScrollbarWidget;
import com.raytheon.uf.viz.python.swt.widgets.TextWidget;
import com.raytheon.uf.viz.python.swt.widgets.Widget;
import com.raytheon.viz.gfe.core.DataManager;
/**
* TODO Add Description
* Contains definitions of entry fields for variable list GUIs
*
* <pre>
*
@ -111,7 +99,7 @@ public class FieldDefinition {
private List<? extends Object> valueList;
private float resolution;
private int precision;
public FieldDefinition() {
@ -185,192 +173,13 @@ public class FieldDefinition {
public void setResolution(float resolution) {
this.resolution = resolution;
}
public void setPrecision(int precision) {
this.precision = precision;
}
private int getPrecision() {
return precision;
}
public static List<Widget> buildWidgetList(List<FieldDefinition> fieldDefs,
DataManager dataMgr) {
List<Widget> widgets = new ArrayList<Widget>();
for (FieldDefinition fieldDef : fieldDefs) {
Widget widget = null;
// TODO: handle unimplemented FieldType values--see TODOs below
// Refer to AWIPS 1's SelectionDialog.py body() function for details
if (fieldDef.getType() == FieldType.LABEL) {
widget = makeLabel(fieldDef.getDescription(),
fieldDef.getDefaultValue());
} else if (fieldDef.getType() == FieldType.ALPHANUMERIC
|| fieldDef.getType() == FieldType.NUMERIC) {
widget = makeEntry(fieldDef.getDescription(),
fieldDef.getDefaultValue(),
(fieldDef.getType() == FieldType.NUMERIC));
} else if (fieldDef.getType() == FieldType.CHECK
|| fieldDef.getType() == FieldType.RADIO) {
widget = makeButtonList(
(fieldDef.getType() == FieldType.RADIO),
fieldDef.getDescription(), fieldDef.getValueList(),
fieldDef.getDefaultValue());
} else if (fieldDef.getType() == FieldType.SCALE) {
widget = makeScale(fieldDef.getDescription(),
fieldDef.getValueList(), fieldDef.getDefaultValue(),
fieldDef.getResolution(), fieldDef.getPrecision());
} else if (fieldDef.getType() == FieldType.SCROLLBAR) {
widget = makeScrollbar(fieldDef.getDescription(),
fieldDef.getDefaultValue());
} else if (fieldDef.getType() == FieldType.STARTTIME
|| fieldDef.getType() == FieldType.ENDTIME
|| fieldDef.getType() == FieldType.OUTPUT_DIRECTORY
|| fieldDef.getType() == FieldType.OUTPUT_FILE) {
// TODO: Implement "startTime", "endTime", "output file" and
// "output directory" AWIPS 1 smart script GUI widgets
} else if (fieldDef.getType() == FieldType.DATABASE
|| fieldDef.getType() == FieldType.DATABASES) {
// TODO: Implement "database" and "databases" AWIPS 1 smart
// script GUI widgets
} else if (fieldDef.getType() == FieldType.MODEL
|| fieldDef.getType() == FieldType.MODELS) {
List<DatabaseID> models = dataMgr.getParmManager()
.getAvailableDbs();
List<String> filteredDbIdList = new ArrayList<String>();
for (DatabaseID dbId : models) {
if (dbId.getDbType().equals("")
&& !(dbId.getModelName().contains("Fcst")
|| dbId.getModelName().contains("Official") || dbId
.getModelName().contains("Slider"))) {
filteredDbIdList.add(dbId.getModelId());
}
}
widget = makeButtonList(
(fieldDef.getType() == FieldType.MODEL),
fieldDef.getDescription(), filteredDbIdList,
fieldDef.getDefaultValue());
} else if (fieldDef.getType() == FieldType.D2DMODEL
|| fieldDef.getType() == FieldType.D2DMODELS) {
List<DatabaseID> models = dataMgr.getParmManager()
.getAvailableDbs();
List<String> filteredDbIdList = new ArrayList<String>();
for (DatabaseID dbId : models) {
if (dbId.getDbType().equals("D2D")
&& !(dbId.getModelName().contains("Fcst")
|| dbId.getModelName().contains("Official") || dbId
.getModelName().contains("Slider"))) {
filteredDbIdList.add(dbId.getModelId());
}
}
widget = makeButtonList(
(fieldDef.getType() == FieldType.D2DMODEL),
fieldDef.getDescription(), filteredDbIdList,
fieldDef.getDefaultValue());
} else if (fieldDef.getType().getPythonWidgetName()
.contains("parm")) {
// TODO: Implement all parm-related AWIPS 1 smart script GUI
// widgets
} else if (fieldDef.getType() == FieldType.REFSET
|| fieldDef.getType() == FieldType.REFSETS) {
// TODO: Implement "refset" and "refsets" AWIPS 1 smart script
// GUI widgets
} else if (fieldDef.getType() == FieldType.MAP
|| fieldDef.getType() == FieldType.MAPS) {
// TODO: Implement "map" and "maps" AWIPS 1 smart script GUI
// widgets
} else if (fieldDef.getType() == FieldType.TIMERANGE
|| fieldDef.getType() == FieldType.TIMERANGES) {
// TODO: Implement "timerange" and "timeranges" AWIPS 1 smart
// script GUI widgets
} else {
widget = makeLabel("ERROR: " + fieldDef.getDescription()
+ " unknown widget type: "
+ fieldDef.getType().getPythonWidgetName(), null);
}
widget.setVariable(fieldDef.getName());
widgets.add(widget);
}
return widgets;
this.precision = precision;
}
private static Widget makeLabel(String labelText, Object value) {
return new LabelWidget(labelText, value);
public int getPrecision() {
return precision;
}
private static Widget makeEntry(String labelText, Object value,
boolean numericOnly) {
Widget entryField = null;
if (numericOnly) {
entryField = new NumberWidget(labelText);
} else {
entryField = new TextWidget(labelText);
}
entryField.setValue(value);
return entryField;
}
private static Widget makeButtonList(boolean radioButton, String label,
List<? extends Object> elementList, Object initialValue) {
if (radioButton) {
return makeRadioList(label, elementList, initialValue);
} else {
return makeCheckList(label, elementList, initialValue);
}
}
private static Widget makeRadioList(String label,
List<? extends Object> elementList, Object initialValue) {
Widget radioList;
if (elementList.size() < 20) {
radioList = new RadioWidget(label);
} else {
radioList = new ListWidget(label, false);
}
radioList.setValue(initialValue);
radioList.setOptions(elementList);
return radioList;
}
private static Widget makeCheckList(String label,
List<? extends Object> elementList, Object initialValue) {
Widget checkList;
if (elementList.size() < 20) {
checkList = new CheckWidget(label);
} else {
checkList = new ListWidget(label, true);
}
checkList.setValue(initialValue);
checkList.setOptions(elementList);
return checkList;
}
private static ScaleWidget makeScale(String labelText,
List<? extends Object> valueList, Object initialValue, float res, int precision) {
ScaleWidget scale = new ScaleWidget(labelText);
scale.setOptions(valueList);
scale.setValue(initialValue);
scale.setResolution(res);
scale.setPrecision(precision);
return scale;
}
private static Widget makeScrollbar(String label, Object initialValue) {
Widget scrollbar = new ScrollbarWidget(label);
scrollbar.setValue(initialValue);
return scrollbar;
}
}

View file

@ -0,0 +1,426 @@
/**
* 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.gfe.ui.runtimeui;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.python.swt.widgets.CheckWidget;
import com.raytheon.uf.viz.python.swt.widgets.LabelWidget;
import com.raytheon.uf.viz.python.swt.widgets.ListWidget;
import com.raytheon.uf.viz.python.swt.widgets.NumberWidget;
import com.raytheon.uf.viz.python.swt.widgets.RadioWidget;
import com.raytheon.uf.viz.python.swt.widgets.ScaleWidget;
import com.raytheon.uf.viz.python.swt.widgets.ScrollbarWidget;
import com.raytheon.uf.viz.python.swt.widgets.TextWidget;
import com.raytheon.uf.viz.python.swt.widgets.Widget;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.smartscript.FieldDefinition;
import com.raytheon.viz.gfe.smartscript.FieldDefinition.FieldType;
/**
* Main dialog area for python VariableList defined GUIs
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 30, 2012 randerso Initial creation
*
* </pre>
*
* @author randerso
* @version 1.0
*/
public class DialogAreaComposite extends ScrolledComposite {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DialogAreaComposite.class);
private static final double MAX_HEIGHT_RATIO = 0.85;
private static final double MAX_WIDTH_RATIO = 0.85;
private List<Widget> widgetList;
private String packType;
private Composite varFrame;
private Composite topFrame;
/**
* @param parent
* @param fieldDefs
* @param dataMgr
* @param style
*/
public DialogAreaComposite(Composite parent,
List<FieldDefinition> fieldDefs, DataManager dataMgr) {
super(parent, SWT.H_SCROLL | SWT.V_SCROLL);
varFrame = new Composite(this, SWT.NONE);
this.setContent(varFrame);
this.setLayout(new GridLayout());
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
varFrame.setLayout(layout);
varFrame.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
widgetList = new ArrayList<Widget>();
this.packType = "";
for (FieldDefinition fieldDef : fieldDefs) {
Widget widget = null;
// TODO: handle unimplemented FieldType values--see TODOs below
// Refer to AWIPS 1's SelectionDialog.py body() function for details
if (fieldDef.getType() == FieldType.LABEL) {
widget = makeLabel(fieldDef.getDescription(),
fieldDef.getDefaultValue());
} else if (fieldDef.getType() == FieldType.ALPHANUMERIC
|| fieldDef.getType() == FieldType.NUMERIC) {
widget = makeEntry(fieldDef.getDescription(),
fieldDef.getDefaultValue(),
(fieldDef.getType() == FieldType.NUMERIC));
} else if (fieldDef.getType() == FieldType.CHECK
|| fieldDef.getType() == FieldType.RADIO) {
widget = makeButtonList(
(fieldDef.getType() == FieldType.RADIO),
fieldDef.getDescription(), fieldDef.getValueList(),
fieldDef.getDefaultValue());
} else if (fieldDef.getType() == FieldType.SCALE) {
widget = makeScale(fieldDef.getDescription(),
fieldDef.getValueList(), fieldDef.getDefaultValue(),
fieldDef.getResolution(), fieldDef.getPrecision());
} else if (fieldDef.getType() == FieldType.SCROLLBAR) {
widget = makeScrollbar(fieldDef.getDescription(),
fieldDef.getDefaultValue());
} else if (fieldDef.getType() == FieldType.STARTTIME
|| fieldDef.getType() == FieldType.ENDTIME
|| fieldDef.getType() == FieldType.OUTPUT_DIRECTORY
|| fieldDef.getType() == FieldType.OUTPUT_FILE) {
// TODO: Implement "startTime", "endTime", "output file" and
// "output directory" AWIPS 1 smart script GUI widgets
} else if (fieldDef.getType() == FieldType.DATABASE
|| fieldDef.getType() == FieldType.DATABASES) {
// TODO: Implement "database" and "databases" AWIPS 1 smart
// script GUI widgets
} else if (fieldDef.getType() == FieldType.MODEL
|| fieldDef.getType() == FieldType.MODELS) {
if (dataMgr != null) {
List<DatabaseID> models = dataMgr.getParmManager()
.getAvailableDbs();
List<String> filteredDbIdList = new ArrayList<String>();
for (DatabaseID dbId : models) {
if (dbId.getDbType().equals("")
&& !(dbId.getModelName().contains("Fcst")
|| dbId.getModelName().contains(
"Official") || dbId
.getModelName().contains("Slider"))) {
filteredDbIdList.add(dbId.getModelId());
}
}
widget = makeButtonList(
(fieldDef.getType() == FieldType.MODEL),
fieldDef.getDescription(), filteredDbIdList,
fieldDef.getDefaultValue());
} else {
statusHandler
.handle(Priority.ERROR,
"No dataMgr supplied to ProcessVariableList, cannot retrieve models");
}
} else if (fieldDef.getType() == FieldType.D2DMODEL
|| fieldDef.getType() == FieldType.D2DMODELS) {
if (dataMgr != null) {
List<DatabaseID> models = dataMgr.getParmManager()
.getAvailableDbs();
List<String> filteredDbIdList = new ArrayList<String>();
for (DatabaseID dbId : models) {
if (dbId.getDbType().equals("D2D")
&& !(dbId.getModelName().contains("Fcst")
|| dbId.getModelName().contains(
"Official") || dbId
.getModelName().contains("Slider"))) {
filteredDbIdList.add(dbId.getModelId());
}
}
widget = makeButtonList(
(fieldDef.getType() == FieldType.D2DMODEL),
fieldDef.getDescription(), filteredDbIdList,
fieldDef.getDefaultValue());
} else {
statusHandler
.handle(Priority.ERROR,
"No dataMgr supplied to ProcessVariableList, cannot retrieve models");
}
} else if (fieldDef.getType().getPythonWidgetName()
.contains("parm")) {
// TODO: Implement all parm-related AWIPS 1 smart script GUI
// widgets
} else if (fieldDef.getType() == FieldType.REFSET
|| fieldDef.getType() == FieldType.REFSETS) {
// TODO: Implement "refset" and "refsets" AWIPS 1 smart script
// GUI widgets
} else if (fieldDef.getType() == FieldType.MAP
|| fieldDef.getType() == FieldType.MAPS) {
// TODO: Implement "map" and "maps" AWIPS 1 smart script GUI
// widgets
} else if (fieldDef.getType() == FieldType.TIMERANGE
|| fieldDef.getType() == FieldType.TIMERANGES) {
// TODO: Implement "timerange" and "timeranges" AWIPS 1 smart
// script GUI widgets
} else {
widget = makeLabel("ERROR: " + fieldDef.getDescription()
+ " unknown widget type: "
+ fieldDef.getType().getPythonWidgetName(), null);
}
if (widget != null) {
widget.setVariable(fieldDef.getName());
widgetList.add(widget);
}
}
Rectangle monitorBounds = this.getDisplay().getPrimaryMonitor()
.getBounds();
int maxXSize = (int) (monitorBounds.width * MAX_WIDTH_RATIO);
int maxYSize = (int) (monitorBounds.height * MAX_HEIGHT_RATIO);
Point compositeSize = varFrame.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int xSize = compositeSize.x;
int ySize = compositeSize.y;
if (xSize > maxXSize) {
xSize = maxXSize;
}
if (ySize > maxYSize) {
ySize = maxYSize;
}
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = ySize;
gd.widthHint = xSize;
this.setLayoutData(gd);
this.setMinSize(new Point(xSize, ySize));
this.setExpandHorizontal(true);
this.setExpandVertical(true);
// Make sure widgets are scrolled into view when they gain focus
// see:
// http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/ScrollSWTwidgetsintoviewwhentheygetfocus.htm
final DialogAreaComposite sc = this;
Listener scrollOnFocus = new Listener() {
@Override
public void handleEvent(Event event) {
Control child = (Control) event.widget;
Rectangle bounds = child.getBounds();
Rectangle area = sc.getClientArea();
Point origin = sc.getOrigin();
if (origin.x > bounds.x) {
origin.x = Math.max(0, bounds.x);
}
if (origin.y > bounds.y) {
origin.y = Math.max(0, bounds.y);
}
if (origin.x + area.width < bounds.x + bounds.width) {
origin.x = Math
.max(0, bounds.x + bounds.width - area.width);
}
if (origin.y + area.height < bounds.y + bounds.height) {
origin.y = Math.max(0, bounds.y + bounds.height
- area.height);
}
sc.setOrigin(origin);
}
};
Control[] controls = varFrame.getChildren();
for (Control c : controls) {
c.addListener(SWT.Activate, scrollOnFocus);
}
}
private Widget makeLabel(String labelText, Object value) {
if (labelText.isEmpty()) {
this.packType = "";
return null;
}
// See if we have to start a new frame
if (!this.packType.equals("label")) {
this.topFrame = new Composite(this.varFrame, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
this.topFrame.setLayout(layout);
this.packType = "label";
}
Widget widget = new LabelWidget(labelText, value);
widget.buildComposite(this.topFrame);
return widget;
}
private Widget makeEntry(String labelText, Object value, boolean numericOnly) {
// See if we have to start a new frame
if (!this.packType.equals("entry")) {
this.topFrame = new Composite(this.varFrame, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
this.topFrame.setLayout(layout);
this.packType = "entry";
}
Widget widget = null;
if (numericOnly) {
widget = new NumberWidget(labelText);
} else {
widget = new TextWidget(labelText);
}
widget.setValue(value);
widget.buildComposite(this.topFrame);
return widget;
}
private Widget makeButtonList(boolean radioButton, String label,
List<? extends Object> elementList, Object initialValue) {
// See if we have to start a new frame
if (!this.packType.equals("button")) {
this.topFrame = new Composite(this.varFrame, SWT.NONE);
GridLayout layout = new GridLayout(0, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
this.topFrame.setLayout(layout);
this.packType = "button";
}
Widget widget;
if (radioButton) {
widget = makeRadioList(label, elementList, initialValue);
} else {
widget = makeCheckList(label, elementList, initialValue);
}
((GridLayout) this.topFrame.getLayout()).numColumns++;
widget.buildComposite(this.topFrame);
return widget;
}
private Widget makeRadioList(String label,
List<? extends Object> elementList, Object initialValue) {
Widget radioList;
if (elementList.size() > 20) {
radioList = new ListWidget(label, false);
} else {
radioList = new RadioWidget(label);
}
radioList.setValue(initialValue);
radioList.setOptions(elementList);
return radioList;
}
private Widget makeCheckList(String label,
List<? extends Object> elementList, Object initialValue) {
Widget checkList;
if (elementList.size() > 20) {
checkList = new ListWidget(label, true);
} else {
checkList = new CheckWidget(label);
}
checkList.setValue(initialValue);
checkList.setOptions(elementList);
return checkList;
}
private ScaleWidget makeScale(String labelText,
List<? extends Object> valueList, Object initialValue, float res,
int precision) {
// See if we have to start a new frame
if (!this.packType.equals("entry")) {
this.topFrame = new Composite(this.varFrame, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.verticalSpacing = 0;
layout.horizontalSpacing = 0;
this.topFrame.setLayout(layout);
this.packType = "entry";
}
ScaleWidget scale = new ScaleWidget(labelText);
scale.setOptions(valueList);
scale.setValue(initialValue);
scale.setResolution(res);
scale.setPrecision(precision);
scale.buildComposite(this.topFrame);
return scale;
}
private Widget makeScrollbar(String label, Object initialValue) {
Widget scrollbar = new ScrollbarWidget(label);
scrollbar.setValue(initialValue);
return scrollbar;
}
public List<Widget> getWidgetList() {
return this.widgetList;
}
}

View file

@ -24,13 +24,13 @@ import java.util.List;
import java.util.Map;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.viz.python.swt.ButtonConstant;
import com.raytheon.uf.viz.python.swt.DialogAreaComposite;
import com.raytheon.uf.viz.python.swt.widgets.LabelWidget;
import com.raytheon.uf.viz.python.swt.widgets.Widget;
import com.raytheon.viz.gfe.core.DataManager;
@ -56,13 +56,13 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
/**
* The top composite.
*/
protected Composite top;
protected DialogAreaComposite comp;
protected String name;
protected DataManager dataMgr;
private List<Widget> widgetList;
private List<FieldDefinition> fieldDefs;
@Override
protected void buttonPressed(int buttonId) {
@ -89,7 +89,7 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
super(parent);
this.name = title;
this.dataMgr = dataMgr;
this.widgetList = FieldDefinition.buildWidgetList(fieldDefs, dataMgr);
this.fieldDefs = fieldDefs;
this.setShellStyle(SWT.MODELESS | SWT.TITLE | SWT.RESIZE);
}
@ -115,15 +115,16 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
*/
@Override
protected Control createDialogArea(Composite parent) {
top = (Composite) super.createDialogArea(parent);
Composite top = (Composite) super.createDialogArea(parent);
// Create the main layout for the top level composite.
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 3;
mainLayout.marginWidth = 3;
mainLayout.marginHeight = 0;
mainLayout.marginWidth = 0;
top.setLayout(mainLayout);
initializeComponents();
this.comp = new DialogAreaComposite(top, fieldDefs, this.dataMgr);
this.comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
return top;
}
@ -143,17 +144,9 @@ public abstract class SelectionDlg extends CaveJFACEDialog {
parent.getSize().y + 20);
}
private void initializeComponents() {
createWidgetsControls();
}
private void createWidgetsControls() {
new DialogAreaComposite(top, widgetList, SWT.NONE);
}
protected Map<String, Object> getValues() {
Map<String, Object> map = new HashMap<String, Object>();
for (Widget w : widgetList) {
for (Widget w : this.comp.getWidgetList()) {
if (!(w instanceof LabelWidget)) {
map.put(w.getLabel(), w.getValue());
}

View file

@ -31,7 +31,6 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.python.swt.ButtonConstant;
import com.raytheon.uf.viz.python.swt.CallbackFunctor;
import com.raytheon.uf.viz.python.swt.DialogAreaComposite;
import com.raytheon.uf.viz.python.swt.widgets.LabelWidget;
import com.raytheon.uf.viz.python.swt.widgets.Widget;
import com.raytheon.viz.gfe.core.DataManager;
@ -61,7 +60,9 @@ public class ValuesDialog extends CaveJFACEDialog {
private String title;
private List<Widget> widgets;
private List<FieldDefinition> fieldDefs;
private DataManager dataMgr;
private Map<Object, Object> values;
@ -71,19 +72,24 @@ public class ValuesDialog extends CaveJFACEDialog {
private boolean closeAfterRun;
private DialogAreaComposite composite;
/**
* Class constructor
*
* @param title
* window title with "... Values" appended onto the end.
* @param widgetList
* a list of widgets this dialog will display.
* @param fieldDefs
* a list of field definitions this dialog will display.
* @param dataMgr
*/
public ValuesDialog(String title, List<FieldDefinition> widgetList) {
public ValuesDialog(String title, List<FieldDefinition> fieldDefs,
DataManager dataMgr) {
super(new Shell());
this.title = title + " Values";
this.widgets = FieldDefinition.buildWidgetList(widgetList,
DataManager.getCurrentInstance());
this.fieldDefs = fieldDefs;
this.dataMgr = dataMgr;
this.values = new HashMap<Object, Object>();
this.closeAfterRun = false;
@ -174,7 +180,7 @@ public class ValuesDialog extends CaveJFACEDialog {
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = new DialogAreaComposite(parent, widgets, SWT.NONE);
composite = new DialogAreaComposite(parent, fieldDefs, this.dataMgr);
return composite;
@ -187,7 +193,7 @@ public class ValuesDialog extends CaveJFACEDialog {
private void doRun() {
// get the values
for (Widget w : widgets) {
for (Widget w : composite.getWidgetList()) {
if (!(w instanceof LabelWidget)) {
Object key = (w.getVariable() != null) ? w.getVariable() : w
.getLabel();
@ -278,15 +284,13 @@ public class ValuesDialog extends CaveJFACEDialog {
return ValuesDialog.class.getClassLoader();
}
public static ValuesDialog openDialog(String title,
List<FieldDefinition> widgets) {
final String dialogTitle = title;
final List<FieldDefinition> widgetList = widgets;
public static ValuesDialog openDialog(final String title,
final List<FieldDefinition> fieldDefs, final DataManager dataMgr) {
VizApp.runSync(new Runnable() {
@Override
public void run() {
syncedDialog = new ValuesDialog(dialogTitle, widgetList);
syncedDialog = new ValuesDialog(title, fieldDefs, dataMgr);
syncedDialog.open();
}
});

View file

@ -83,10 +83,6 @@ import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
import com.raytheon.uf.viz.core.style.StyleRule;
import com.raytheon.viz.core.contours.ContourRenderable;
import com.raytheon.viz.core.contours.ILoadableAsArrows;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.core.contours.ILoadableAsStreamline;
import com.raytheon.viz.core.contours.ILoadableAsWindBarbs;
import com.raytheon.viz.core.contours.rsc.displays.AbstractGriddedDisplay;
import com.raytheon.viz.core.contours.rsc.displays.GriddedVectorDisplay;
import com.raytheon.viz.core.rsc.ICombinedResourceData;
@ -119,9 +115,7 @@ import com.raytheon.viz.pointdata.PointWindDisplay.DisplayType;
* @version 1
*/
public abstract class AbstractMapVectorResource extends
AbstractVizResource<AbstractRequestableResourceData, MapDescriptor>
implements ILoadableAsImage, ILoadableAsStreamline,
ILoadableAsWindBarbs, ILoadableAsArrows {
AbstractVizResource<AbstractRequestableResourceData, MapDescriptor> {
protected static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractMapVectorResource.class);

View file

@ -93,6 +93,7 @@ import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
import com.raytheon.uf.viz.core.rsc.hdf5.ImageTile;
import com.raytheon.uf.viz.core.style.DataMappingPreferences;
@ -112,6 +113,7 @@ import com.raytheon.viz.core.style.image.ImagePreferences;
import com.raytheon.viz.grid.GridLevelTranslator;
import com.raytheon.viz.grid.rsc.GridNameGenerator.IGridNameResource;
import com.raytheon.viz.grid.rsc.GridNameGenerator.LegendParameters;
import com.raytheon.viz.grid.xml.FieldDisplayTypesFactory;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.io.WKTReader;
@ -611,6 +613,11 @@ public class GridResource extends
parameterAbbrev = record.getModelInfo().getParameterAbbreviation();
units = record.getModelInfo().getParameterUnit();
this.getCapability(DisplayTypeCapability.class)
.setAlternativeDisplayTypes(
FieldDisplayTypesFactory.getInstance()
.getDisplayTypes(parameterAbbrev));
levelUnits = record.getModelInfo().getLevelUnit();
gridCoverage = record.getModelInfo().getLocation();

View file

@ -64,6 +64,7 @@ import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
import com.raytheon.uf.viz.core.style.StyleManager;
import com.raytheon.uf.viz.core.style.StyleManager.StyleType;
@ -78,6 +79,7 @@ import com.raytheon.viz.grid.rsc.GridNameGenerator.IGridNameResource;
import com.raytheon.viz.grid.rsc.GridNameGenerator.LegendParameters;
import com.raytheon.viz.grid.util.CoverageUtils;
import com.raytheon.viz.grid.util.RemappedImage;
import com.raytheon.viz.grid.xml.FieldDisplayTypesFactory;
import com.raytheon.viz.pointdata.PointWindDisplay.DisplayType;
import com.vividsolutions.jts.geom.Coordinate;
@ -122,19 +124,26 @@ public class GridVectorResource extends AbstractMapVectorResource implements
super(data, props);
data.addChangeListener(this);
String paramAbbrev = "";
GribRecord emptyRecord = new GribRecord();
for (GribRecord rec : data.getRecords()) {
try {
// don't add empty records
if (!emptyRecord.equals(rec)) {
paramAbbrev = rec.getModelInfo().getParameterAbbreviation();
this.addRecord(rec);
Collections.sort(this.dataTimes);
}
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Collections.sort(this.dataTimes);
this.getCapability(DisplayTypeCapability.class)
.setAlternativeDisplayTypes(
FieldDisplayTypesFactory.getInstance().getDisplayTypes(
paramAbbrev));
if (resourceData.getNameGenerator() == null) {
resourceData.setNameGenerator(new GridNameGenerator());
}
@ -582,51 +591,6 @@ public class GridVectorResource extends AbstractMapVectorResource implements
descriptor);
}
@SuppressWarnings("unchecked")
@Override
public AbstractVizResource<AbstractRequestableResourceData, MapDescriptor> getStreamlineResource()
throws VizException {
return (AbstractVizResource<AbstractRequestableResourceData, MapDescriptor>) resourceData
.construct(new GridLoadProperties(
com.raytheon.uf.viz.core.rsc.DisplayType.STREAMLINE),
descriptor);
}
@Override
public boolean isStreamlineVector() {
return false;
}
@SuppressWarnings("unchecked")
@Override
public AbstractVizResource<AbstractRequestableResourceData, MapDescriptor> getWindBarbResource()
throws VizException {
return (AbstractVizResource<AbstractRequestableResourceData, MapDescriptor>) resourceData
.construct(new GridLoadProperties(
com.raytheon.uf.viz.core.rsc.DisplayType.BARB),
descriptor);
}
@Override
public boolean isWindVector() {
return false;
}
@SuppressWarnings("unchecked")
@Override
public AbstractVizResource<AbstractRequestableResourceData, MapDescriptor> getArrowResource()
throws VizException {
return (AbstractVizResource<AbstractRequestableResourceData, MapDescriptor>) resourceData
.construct(new GridLoadProperties(
com.raytheon.uf.viz.core.rsc.DisplayType.ARROW),
descriptor);
}
@Override
public boolean isArrowVector() {
return false;
}
@Override
protected FloatDataRecord remapGrid(GridCoverage location,
GridCoverage location2, FloatDataRecord dataRecord,
@ -775,14 +739,4 @@ public class GridVectorResource extends AbstractMapVectorResource implements
super.project(mapData);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return displayType == null;
}
}

View file

@ -81,10 +81,6 @@ import com.raytheon.uf.viz.core.style.VizStyleException;
import com.raytheon.uf.viz.core.style.level.Level;
import com.raytheon.uf.viz.core.style.level.SingleLevel;
import com.raytheon.viz.core.contours.ContourRenderable;
import com.raytheon.viz.core.contours.ILoadableAsArrows;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.core.contours.ILoadableAsStreamline;
import com.raytheon.viz.core.contours.ILoadableAsWindBarbs;
import com.raytheon.viz.core.contours.rsc.displays.AbstractGriddedDisplay;
import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay;
import com.raytheon.viz.core.contours.rsc.displays.GriddedStreamlineDisplay;
@ -94,7 +90,6 @@ import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay2;
import com.raytheon.viz.core.style.arrow.ArrowPreferences;
import com.raytheon.viz.core.style.contour.ContourPreferences;
import com.raytheon.viz.core.style.image.ImagePreferences;
import com.raytheon.viz.grid.rsc.GridLoadProperties;
import com.raytheon.viz.grid.rsc.GriddedIconDisplay;
import com.vividsolutions.jts.geom.Coordinate;
@ -119,9 +114,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* @param <T>
*/
public abstract class AbstractGridResource<T extends AbstractResourceData>
extends AbstractVizResource<T, IMapDescriptor> implements
ILoadableAsArrows, ILoadableAsWindBarbs, ILoadableAsImage,
ILoadableAsStreamline {
extends AbstractVizResource<T, IMapDescriptor> {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractGridResource.class);
@ -300,6 +293,7 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
*/
protected void initCapabilities() {
DisplayType displayType = getDisplayType();
List<DisplayType> altDisplayTypes = new ArrayList<DisplayType>();
switch (displayType) {
case IMAGE:
if (!hasCapability(ImagingCapability.class)) {
@ -307,12 +301,18 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
this.getCapability(ImagingCapability.class)
.setInterpolationState(true);
}
altDisplayTypes.add(DisplayType.CONTOUR);
break;
case BARB:
case ARROW:
case DUALARROW:
case CONTOUR:
case STREAMLINE:
altDisplayTypes.add(DisplayType.BARB);
altDisplayTypes.add(DisplayType.ARROW);
altDisplayTypes.add(DisplayType.STREAMLINE);
case DUALARROW:
altDisplayTypes.add(DisplayType.ARROW);
case CONTOUR:
altDisplayTypes.add(DisplayType.IMAGE);
getCapability(ColorableCapability.class);
getCapability(DensityCapability.class);
getCapability(MagnificationCapability.class);
@ -324,6 +324,8 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
getCapability(MagnificationCapability.class);
break;
}
this.getCapability(DisplayTypeCapability.class)
.setAlternativeDisplayTypes(altDisplayTypes);
}
/**
@ -850,56 +852,4 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
return pdos.get(time);
}
public AbstractVizResource<?, ?> getArrowResource() throws VizException {
return newResource(new GridLoadProperties(DisplayType.ARROW));
}
public AbstractVizResource<?, ?> getStreamlineResource()
throws VizException {
return newResource(new GridLoadProperties(DisplayType.STREAMLINE));
}
public AbstractVizResource<?, ?> getWindBarbResource() throws VizException {
return newResource(new GridLoadProperties(DisplayType.BARB));
}
public AbstractVizResource<?, ?> getImageryResource() throws VizException {
return newResource(new GridLoadProperties(DisplayType.IMAGE));
}
private AbstractVizResource<?, ?> newResource(
GridLoadProperties loadProperties) throws VizException {
AbstractVizResource<?, ?> resource = resourceData.construct(
loadProperties, descriptor);
if (resource instanceof AbstractGridResource<?>) {
((AbstractGridResource<?>) resource).setData(data);
}
return resource;
}
public boolean isStreamlineVector() {
DisplayType displayType = getDisplayType();
return displayType == DisplayType.BARB
|| displayType == DisplayType.ARROW;
}
public boolean isArrowVector() {
DisplayType displayType = getDisplayType();
return displayType == DisplayType.BARB
|| displayType == DisplayType.STREAMLINE
|| displayType == DisplayType.DUALARROW;
}
public boolean isWindVector() {
DisplayType displayType = getDisplayType();
return displayType == DisplayType.ARROW
|| displayType == DisplayType.STREAMLINE;
}
public boolean isLoadableAsImage() {
DisplayType displayType = getDisplayType();
return displayType != DisplayType.IMAGE;
}
}

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.viz.grid.rsc.GridNameGenerator;
import com.raytheon.viz.grid.rsc.GridNameGenerator.IGridNameResource;
import com.raytheon.viz.grid.rsc.GridNameGenerator.LegendParameters;
@ -91,9 +92,15 @@ public class D2DGribGridResource extends GribGridResource<GridResourceData>
@Override
protected void initInternal(IGraphicsTarget target) throws VizException {
String paramAbbrev = "";
for (GribRecord record : resourceData.getRecords()) {
paramAbbrev = record.getModelInfo().getParameterAbbreviation();
addDataObject(record);
}
this.getCapability(DisplayTypeCapability.class)
.setAlternativeDisplayTypes(
FieldDisplayTypesFactory.getInstance().getDisplayTypes(
paramAbbrev));
super.initInternal(target);
}
@ -315,61 +322,4 @@ public class D2DGribGridResource extends GribGridResource<GridResourceData>
return generator.getName(this);
}
@Override
public boolean isLoadableAsImage() {
if (super.isLoadableAsImage()) {
DisplayType displayType = getDisplayType();
List<DisplayType> displayTypes = FieldDisplayTypesFactory
.getInstance().getDisplayTypes(
gribModel.getParameterAbbreviation());
if (displayTypes == null || displayTypes.isEmpty()) {
return displayType == DisplayType.CONTOUR;
}
return displayTypes.contains(DisplayType.IMAGE);
}
return false;
}
@Override
public boolean isStreamlineVector() {
if (super.isStreamlineVector()) {
List<DisplayType> displayTypes = FieldDisplayTypesFactory
.getInstance().getDisplayTypes(
gribModel.getParameterAbbreviation());
if (displayTypes == null || displayTypes.isEmpty()) {
return true;
}
return displayTypes.contains(DisplayType.STREAMLINE);
}
return false;
}
@Override
public boolean isArrowVector() {
if (super.isArrowVector()) {
List<DisplayType> displayTypes = FieldDisplayTypesFactory
.getInstance().getDisplayTypes(
gribModel.getParameterAbbreviation());
if (displayTypes == null || displayTypes.isEmpty()) {
return true;
}
return displayTypes.contains(DisplayType.ARROW);
}
return false;
}
@Override
public boolean isWindVector() {
if (super.isWindVector()) {
List<DisplayType> displayTypes = FieldDisplayTypesFactory
.getInstance().getDisplayTypes(
gribModel.getParameterAbbreviation());
if (displayTypes == null || displayTypes.isEmpty()) {
return true;
}
return displayTypes.contains(DisplayType.BARB);
}
return false;
}
}

View file

@ -47,7 +47,7 @@
<constraint constraintValue="grib" constraintType="EQUALS"/>
</mapping>
<mapping key="modelInfo.modelName">
<constraint constraintValue="FFG-TUA,FFG-ACR,FFG-STR,FFG-RSA,FFG-ORN,FFG-RHA,FFG-KRF,FFG-MSR,FFG-TAR,FFG-PTR,FFG-TIR,FFG-ALR,FFG-FWR"
<constraint constraintValue="FFG-TUA,FFG-ACR,FFG-STR,FFG-RSA,FFG-ORN,FFG-RHA,FFG-KRF,FFG-MSR,FFG-TAR,FFG-PTR,FFG-TIR-HiRes,FFG-ALR,FFG-FWR"
constraintType="IN" />
</mapping>
</metadataMap>
@ -321,7 +321,7 @@
<constraint constraintValue="grib" constraintType="EQUALS"/>
</mapping>
<mapping key="modelInfo.modelName">
<constraint constraintValue="FFG-TIR" constraintType="EQUALS"/>
<constraint constraintValue="FFG-TIR-HiRes" constraintType="EQUALS"/>
</mapping>
</metadataMap>
</resourceData>

View file

@ -246,19 +246,19 @@
menuText="1hr FFG" id="OH1hrFFG">
<dataURI>/grib/%/FFG-TIR/FFG0124hr/%</dataURI>
<substitute key="timespan" value="FFG0124hr"/>
<substitute key="model" value="FFG-TIR"/>
<substitute key="model" value="FFG-TIR-HiRes"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/hydro/FFGmosaic.xml"
menuText="3hr FFG" id="OH3hrFFG">
<dataURI>/grib/%/FFG-TIR/FFG0324hr/%</dataURI>
<dataURI>/grib/%/FFG-TIR-HiRes/FFG0324hr/%</dataURI>
<substitute key="timespan" value="FFG0324hr"/>
<substitute key="model" value="FFG-TIR"/>
<substitute key="model" value="FFG-TIR-HiRes"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/hydro/FFGmosaic.xml"
menuText="6hr FFG" id="OH6hrFFG">
<dataURI>/grib/%/FFG-TIR/FFG0624hr/%</dataURI>
<dataURI>/grib/%/FFG-TIR-HiRes/FFG0624hr/%</dataURI>
<substitute key="timespan" value="FFG0624hr"/>
<substitute key="model" value="FFG-TIR"/>
<substitute key="model" value="FFG-TIR-HiRes"/>
</contribute>
</contribute>
<contribute xsi:type="subMenu" menuText="SERFC" id="SERFCMenu">
@ -308,4 +308,4 @@
<contribute xsi:type="bundleItem" file="bundles/FFGZone.xml"
menuText="Zone FFG" id="ZnFFG">
</contribute>
</menuTemplate>
</menuTemplate>

View file

@ -135,6 +135,9 @@ public class TabularTimeSeriesDlg extends CaveSWTDialog implements
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TabularTimeSeriesDlg.class);
private static final String CARRIAGECONTROL = "\r";
private static final int MAX_TS_ON_LIST = 120;
private static final String HDRDEFAULT = " Value Time(Z) RV SQ QC Product Time Posted";
@ -3110,7 +3113,8 @@ public class TabularTimeSeriesDlg extends CaveSWTDialog implements
shefFileName));
String str;
while ((str = in.readLine()) != null) {
sb.append(str);
sb.append(CARRIAGECONTROL);
sb.append(str);
}
in.close();
} catch (IOException e) {

View file

@ -68,6 +68,7 @@ import com.raytheon.viz.hydrocommon.util.DbUtils;
* Apr 05, 2011 8732 jpiatt Added product_id to getGraphData query.
* June 01 2011 9499 djingtao add dur in getGraphData()
* July 25 2011 10082 djingtao modify edit()
* May 30 2012 14967 wkwock overload insertRejectedData method
* </pre>
*
* @author dhladky
@ -342,7 +343,7 @@ public class TimeSeriesDataManager extends HydroDataManager {
"select lid,obstime,value,product_id from ");
graphQuery.append(tablename + " where lid = '" + lid + "' and pe = '"
+ pe + "' " + "and dur = '" + dur + "' ");
graphQuery.append("and ts = '" + ts + "' and extremum = '" + extremum + "' and obstime ");
graphQuery.append("and ts = '" + ts + "' and extremum = '" + extremum.toUpperCase() + "' and obstime ");
graphQuery.append("between '"
+ HydroConstants.DATE_FORMAT.format(startTime) + "' ");
graphQuery.append("and '" + HydroConstants.DATE_FORMAT.format(endTime)
@ -896,6 +897,92 @@ public class TimeSeriesDataManager extends HydroDataManager {
HydroConstants.IHFS, QueryLanguage.SQL);
}
public int insertRejectedData(List<ForecastData> deleteList) throws VizException {
StringBuilder sb = new StringBuilder();
Date currentTime = Calendar.getInstance(TimeZone.getTimeZone("GMT")).getTime();
for (ForecastData dr : deleteList) {
Date productTime=dr.getProductTime();
if(productTime==null){ //get product time from DB if not available
StringBuilder sql = new StringBuilder("select producttime from ");
String tablename = DbUtils.getTableName(dr.getPe(), dr.getTs());
sql.append(tablename + " where ");
sql.append("lid = '" + dr.getLid() + "' ");
sql.append("and dur = " + dr.getDur() + " ");
sql.append("and ts = '" + dr.getTs().toUpperCase() + "' ");
sql.append("and extremum = '" + dr.getExtremum().toUpperCase() + "' ");
sql.append("and obstime = '" + dr.getObsTime() + "' ");
sql.append("and value = "+dr.getValue());
List<Object[]> sqlResult = (ArrayList<Object[]>) (DirectDbQuery.executeQuery(sql.toString(), HydroConstants.IHFS, QueryLanguage.SQL));
if (sqlResult !=null && sqlResult.size()>0 && sqlResult.get(0)[0]!=null)
productTime=(Date)sqlResult.get(0)[0];
else
productTime=currentTime; //use current time if still not available
}
sb.append("insert into rejecteddata(lid, pe, dur, ts, extremum, ");
sb.append("probability, validtime, basistime, postingtime, value, ");
sb.append("revision, shef_qual_code, product_id, producttime, quality_code, ");
sb.append("reject_type, userid) VALUES(");
sb.append("'" + dr.getLid() + "', ");
sb.append("'" + dr.getPe() + "', ");
sb.append(dr.getDur() + ", ");
sb.append("'" + dr.getTs() + "', ");
sb.append("'" + dr.getExtremum() + "', ");
sb.append(-1 + ", ");
/* set validtime for observed data */
if (dr.getValidTime() != null) {
sb.append("'"
+ HydroConstants.DATE_FORMAT.format(dr.getValidTime())
+ "', ");
} else {
sb.append("'"
+ (HydroConstants.DATE_FORMAT.format(dr.getObsTime()))
+ "', ");
}
if (dr.getBasisTime() != null) {
sb.append("'"
+ (dr.getBasisTime()) + "', ");
} else {
sb.append("'"
+ (HydroConstants.DATE_FORMAT.format(dr.getObsTime()))
+ "', ");
}
sb.append("'" + HydroConstants.DATE_FORMAT.format(currentTime) + "', ");
sb.append(dr.getValue() + ", ");
sb.append(dr.getRevision() + ", ");
sb.append("'" + dr.getShefQualCode() + "', ");
sb.append("'" + dr.getProductID() + "', ");
sb.append("'"
+ HydroConstants.DATE_FORMAT.format(productTime)
+ "', ");
sb.append(dr.getQualityCode() + ", ");
sb.append("'M', ");
sb.append("'" + LocalizationManager.getInstance().getCurrentUser()
+ "');");
}
AppsDefaults ad = AppsDefaults.getInstance();
boolean debug = ad.getBoolean(HydroConstants.DEBUG_HYDRO_DB_TOKEN,
false);
if (debug) {
System.out.println(ad.getToken(HydroConstants.PGHOST) + ":"
+ ad.getToken(HydroConstants.PGPORT) + ":"
+ ad.getToken(HydroConstants.DB_NAME));
System.out.println("Query: " + sb.toString());
}
return DirectDbQuery.executeStatement(sb.toString(),
HydroConstants.IHFS, QueryLanguage.SQL);
}
/**
* Deletes a list of Observations.
*

View file

@ -121,9 +121,10 @@ import com.raytheon.viz.hydrocommon.util.DbUtils;
* 12 July 2011 9709 djingtao add draw "DERIVED PP"
* 25 July 2011 10082 djingtao modify makeRegions()
* 10 August 2011 10457 djingtao allow red rubberband box to be draw for setMissing in Edit
* 27 March 20112 14527 wkwock Fix incomplete time series selection issue
* 27 March 2012 14527 wkwock Fix incomplete time series selection issue
* 24 April 2012 14669 wkwock Handle invalid color name
* 08 May 2012 14958 wkwock Fix overcrowded TS list
* 30 May 2012 14967 wkwock Fix incorrect product time
* @author lvenable
* @version 1.0
*
@ -1058,17 +1059,19 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
if (!pe.equalsIgnoreCase("PP")) {
/* Draw the floodstage lines if needed */
if (groupMode) {
if ((pe.toUpperCase().startsWith("H") || pe.toUpperCase()
.startsWith("Q")) && (graphData.getShowcat())) {
displayFloodCatLines(gc, graphData);
}
} else {
if ((pe.toUpperCase().startsWith("H") || pe.toUpperCase()
.startsWith("Q")) && (isFloodLineDisplay())) {
displayFloodCatLines(gc, graphData);
}
}
if (groupMode) {
if ((pe.toUpperCase().startsWith("H") || pe
.toUpperCase().startsWith("Q"))
&& (graphData.getShowcat())) {
displayFloodCatLines(gc, graphData);
}
} else {
if ((pe.toUpperCase().startsWith("H") || pe
.toUpperCase().startsWith("Q"))
&& (isFloodLineDisplay())) {
displayFloodCatLines(gc, graphData);
}
}
/* Draw points and lines */
if (pe.equalsIgnoreCase("PP")) {
@ -1442,7 +1445,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
ts = td.getTs().toUpperCase();
pe = td.getPe().toUpperCase();
dur = td.getDur();
String ext = td.getExtremum();
String ext = td.getExtremum().toUpperCase();
String tablename = DbUtils.getTableName(pe, ts);
@ -2009,6 +2012,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
data.setLid(td.getLid());
data.setDur(Integer.parseInt(td.getDur()));
data.setExtremum(td.getExtremum());
data.setProductTime(td.getProductTime());
data.setValue(new Double(pointArray[i].getY()));
if (td.getTs().toUpperCase().startsWith("F")
|| td.getTs().toUpperCase().startsWith("C")) {
@ -2434,6 +2439,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
p.setX(validTime);
pbak.setX(validTime);
Date productTime = row.getProducttime();
traceData.setProductTime(productTime);
if ((validTime.getTime() >= beginDate.getTime())
&& (validTime.getTime() <= endDate.getTime())

View file

@ -2422,30 +2422,63 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
if (tsSelected) {
ArrayList<SiteInfo> siList = tsMap.get(selectedTs.substring(0,1));
ArrayList<SiteInfo> numList = new ArrayList<SiteInfo>();
for (SiteInfo si: siList) {
// Add the selected TS
if (si.getTs().equals(selectedTs)) {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
// Check for TS values with a digit, those go after the TS
// values not containing digits
if (si.getTs().matches("\\D*\\d+\\D*")) {
numList.add(si);
} else {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
}
}
}
for (SiteInfo si: numList) {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
}
}
ArrayList<SiteInfo> numList = new ArrayList<SiteInfo>();
for (String ts: TS_ORDER) {
ArrayList<SiteInfo> siList = tsMap.get(ts);
for (SiteInfo si: siList) {
if (!siteInfoList.contains(si)) {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
if (si.getTs().matches("\\D*\\d+\\D*")) {
numList.add(si);
} else {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
}
}
}
for (SiteInfo si: numList) {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
}
numList.clear();
}
numList.clear();
ArrayList<SiteInfo> siList = tsMap.get(OTHER);
for (SiteInfo si: siList) {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
if (si.getTs().matches("\\D*\\d+\\D*")) {
numList.add(si);
} else {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
}
}
for (SiteInfo si: numList) {
bottomDataList.add(formatDataLine(si));
siteInfoList.add(si);
}
}
}
}

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.cache.CacheObject.ICacheObjectCallback;
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
@ -302,10 +303,17 @@ public class AbstractRadarResource<D extends IDescriptor> extends
if (resourceData.mode.equals("CZ-Pg")) {
return null;
}
// Grab current time
DataTime displayedDate = descriptor.getTimeForResource(this);
if (displayedDate == null) {
FramesInfo fi = descriptor.getFramesInfo();
DataTime[] times = fi.getTimeMap().get(this);
int index = fi.getFrameIndex();
if (times != null && index > 0 && index < times.length) {
displayedDate = times[index];
}
}
if (displayedDate == null) {
displayedDate = this.displayedDate;
}

View file

@ -21,7 +21,6 @@ package com.raytheon.viz.texteditor.alarmalert.dialogs;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.image.WritableRaster;
import java.io.File;
import org.eclipse.swt.SWT;
@ -52,7 +51,6 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.texteditor.alarmalert.util.AlarmBeepJob;
import com.raytheon.viz.texteditor.alarmalert.util.FlashBellJob;
@ -216,9 +214,12 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
alarmShell.setVisible(true);
alarmShell.pack();
alarmShell.setActive();
invert = false;
active = true;
flasher = new FlashBellJob("FlashBell", this, FLASH_DELAY);
// Start a new flash job only if one isn't currently running!
if(flasher == null) {
invert = false;
flasher = new FlashBellJob("FlashBell", this, FLASH_DELAY);
}
return null;
}

View file

@ -87,6 +87,8 @@ import com.raytheon.viz.ui.dialogs.ModeListener;
* with same afos pil but different issue
* times showed up in the product list of
* current alarm queue window.
* May 23, 2012 14952 rferrel Now use refTime/createtime to display
* selected product
* </pre>
*
* @author mnash
@ -106,8 +108,17 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
private Composite shellComp = null;
/**
* The alarm queue list.
*/
private List list = null;
/**
* A list of reference times maintained in the same order as the list
* entries.
*/
private java.util.List<Date> listDates;
private Button displayAll;
private IQueryTransport queryTransport = null;
@ -142,9 +153,11 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
return INSTANCE;
}
// Opens the dialog without ever displaying it, and does all the
// initializaton necessary to get alarms/alerts up and running without the
// user ever having to do more than open the text workstation.
/**
* Opens the dialog without ever displaying it, and does all the
* initialization necessary to get alarms/alerts up and running without the
* user ever having to do more than open the text workstation.
*/
public void openInvisible() {
Shell parent = getParent();
@ -179,11 +192,14 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
preOpened();
// shell.open();
opened();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override
protected Layout constructShellLayout() {
GridLayout mainLayout = new GridLayout(1, false);
@ -192,12 +208,24 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
return mainLayout;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
font.dispose();
AlarmAlertLists.getInstance().removeListener(this);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(final Shell shell) {
setReturnValue(false);
@ -263,66 +291,20 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
textComp.setLayout(gl);
GridData textData = new GridData(SWT.FILL, SWT.FILL, true, true);
textComp.setLayoutData(textData);
listDates = new ArrayList<Date>();
list = new List(textComp, SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE);
list.setLayoutData(textData);
list.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
// TODO Auto-generated method stub
System.err.println("CurrentAlarmQueue Selected:"
+ list.getSelectionCount() + " "
+ list.getSelection()[0]);
displayList();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
System.err.println("CurrentAlarmQueue DefaultSelected:"
+ list.getSelection());
}
});
// list.addKeyListener(new KeyListener() {
//
// @Override
// public void keyPressed(KeyEvent e) {
// // if (list.getSelectionIndex() >= list.getItemCount() - 1) {
// // list.setSelection(0);
// // } else {
// // list.setSelection(list.getSelectionIndex() - 1);
// // }
// //
// // if (list.getSelectionIndex() <= 0) {
// // list.setSelection(list.getItemCount() - 1);
// // } else {
// // list.setSelection(list.getSelectionIndex() + 1);
// // }
// // System.out.println("List selc : " +
// // list.getSelectionIndex());
// }
//
// @Override
// public void keyReleased(KeyEvent e) {
// // TODO Auto-generated method stub
//
// }
//
// });
// list.addMouseListener(new MouseListener() {
// @Override
// public void mouseDoubleClick(MouseEvent e) {
// }
//
// @Override
// public void mouseDown(MouseEvent e) {
// }
//
// @Override
// public void mouseUp(MouseEvent e) {
// displayList();
// }
// });
}
/**
@ -373,24 +355,19 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
});
}
/**
* Display the selected product the current alarm queue list.
*/
private void displayList() {
String command = "";
String alarmHHMM = "";
Date refDate = null;
if (list != null && list.getItemCount() > 0
&& list.getSelectionCount() > 0 && list.getSelection() != null) {
command = list.getSelection()[0].split(" ")[0];
// Get issue time of current alarm product (DR_14624)
String headTime = list.getSelection()[0].split(" ")[5];
String[] hdrTimeFields = null;
if (headTime != null) {
hdrTimeFields = headTime.split(":");
}
if (hdrTimeFields.length >= 2) {
alarmHHMM = hdrTimeFields[0] + hdrTimeFields[1];
}
refDate = listDates.get(list.getSelectionIndex());
AlarmAlertLists.getInstance().getCurrentAlarms()
.remove(list.getSelectionIndex());
listDates.remove(list.getSelectionIndex());
list.remove(list.getSelectionIndex());
if (list.getItemCount() == 0) {
AlarmAlertFunctions.getAlarmalertbell().close();
@ -398,35 +375,8 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
}
java.util.List<StdTextProduct> prods = null;
if (command != "") {
prods = produceTextProduct(command);
}
// Check incoming alarm product matching selected product from
// current Alarm Queue Window (DR_14624)
if (prods != null) {
if (prods.size() == 1) {
String inprod = null;
inprod = prods.get(0).getProduct();
String[] prodLines = inprod.split("\n");
String[] hdrFields = prodLines[0].split(" ");
String wmoId = hdrFields[0];
String site = hdrFields[1];
String hdrTime = hdrFields[2];
String hhmm = hdrTime.substring(2);
String bbb = "";
String awipsId = "";
// Use awips command to retrieve correct alarm product if it
// does
// not match (DR_14624)
if (!alarmHHMM.equals(hhmm)) {
String hdrDate = hdrTime.substring(0, 2);
hdrTime = hdrDate.concat(alarmHHMM);
prods = getAwipsTextProduct(awipsId, wmoId, site, hdrTime,
bbb);
}
}
if (command != "" && refDate != null) {
prods = produceTextProduct(command, refDate.getTime());
}
if (alarmDisplayDlg == null) {
@ -456,6 +406,9 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
}
}
/**
* Display all the products in the alarm queue list and clear the list.
*/
private void displayAll() {
String[] command = null;
if (list != null) {
@ -485,6 +438,7 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
}
}
AlarmAlertLists.getInstance().getCurrentAlarms().clear();
listDates.clear();
list.removeAll();
AlarmAlertFunctions.getAlarmalertbell().close();
}
@ -526,12 +480,20 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
displayAll.setEnabled(false);
}
/**
* Add a line to list that contains the afosPil and a date displayed as a
* local time string.
*
* @param afosPil
* @param date
*/
public void addToQueue(String afosPil, Date date) {
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
String s = formatter.format(date);
String lineText = afosPil + " alert message received at " + s;
if (!list.isDisposed()) {
displayAll.setEnabled(true);
listDates.add(date);
list.add(lineText);
list.select(0);
}
@ -573,6 +535,20 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
return prodList;
}
/**
* Get the product for the given AFOS command and reference time.
*
* @param command
* @param refTime
* @return prodList
*/
private java.util.List<StdTextProduct> produceTextProduct(String command,
Long refTime) {
ICommand cmd = CommandFactory.getAfosCommand(command, refTime);
executeCommand(cmd);
return prodList;
}
/*
* get text product using wmo command (DR_14624)
*/

View file

@ -23,7 +23,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.swt.widgets.Button;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.texteditor.alarmalert.dialogs.AlarmAlertBell;
@ -53,7 +52,7 @@ public class FlashBellJob extends Job {
private boolean disposed = false;
/**
*
* Set up the job and schedule the first run.
* @param name
* @param bell
* @param delay
@ -77,11 +76,9 @@ public class FlashBellJob extends Job {
VizApp.runSync(new Runnable() {
@Override
public void run() {
System.out.println("Flashing bell");
bell.flash();
}
});
System.out.println("Scheduling bell");
schedule(delay);
} else {
dispose();
@ -93,7 +90,6 @@ public class FlashBellJob extends Job {
* Cancel this job and release its reference to the DataManager
*/
public void dispose() {
System.out.println("Disposing bell job");
disposed = true;
bell = null;
this.cancel();

View file

@ -49,6 +49,7 @@ import com.raytheon.viz.texteditor.AfosBrowserModel;
* 21May2010 2187 cjeanbap Add operational mode functionality.
* 02Aug2010 2187 cjeanbap Update method signature to be consistent.
* 20Mar2011 8561 jdortiz Added enterEditor field.
* May 23, 2012 14952 rferrel Added refTime.
*
* </pre>
*
@ -61,13 +62,13 @@ public class AFOSCommand implements ICommand {
private AFOSParser parser = null;
private String locale = null;
private boolean enterEditor = false;
public AFOSCommand(String afosCommand, String siteId) {
private Long refTime;
public AFOSCommand(String afosCommand, String siteId, Long refTime) {
parser = new AFOSParser(afosCommand, siteId);
locale = siteId;
this.refTime = refTime;
}
@Override
@ -109,7 +110,12 @@ public class AFOSCommand implements ICommand {
req.setAfosCommand(parser.getAfosCommand());
req.setAfosLocale(AfosBrowserModel.getInstance().getLocalSite());
if (refTime != null) {
req.setRefTime(refTime);
req.setReftimeMode(true);
}
CAVEMode mode = CAVEMode.getMode();
boolean result = (CAVEMode.OPERATIONAL.equals(mode)
|| CAVEMode.TEST.equals(mode) ? true : false);

View file

@ -32,6 +32,7 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 30, 2009 2191 rjpeter Initial creation
* May 23, 2010 14952 rferrel Allow using refTime in AFOS commands.
*
* </pre>
*
@ -43,7 +44,11 @@ public class CommandFactory {
.getCurrentSite();
public static ICommand getAfosCommand(String afosCommand) {
return new AFOSCommand(afosCommand, localSiteId);
return new AFOSCommand(afosCommand, localSiteId, null);
}
public static ICommand getAfosCommand(String afosCommand, Long refTime) {
return new AFOSCommand(afosCommand, localSiteId, refTime);
}
public static ICommand getPreviousForAfosCommand(ICommand cmd) {
@ -58,7 +63,7 @@ public class CommandFactory {
String afosCommand = "-" + version + ":" + parser.getCcc()
+ parser.getNnn() + parser.getXxx();
return new AFOSCommand(afosCommand, localSiteId);
return new AFOSCommand(afosCommand, localSiteId, null);
}
public static ICommand getNextForAfosCommand(ICommand cmd) {
@ -75,7 +80,7 @@ public class CommandFactory {
afosCommand = parser.getCcc() + parser.getNnn() + parser.getXxx();
}
return new AFOSCommand(afosCommand, localSiteId);
return new AFOSCommand(afosCommand, localSiteId, null);
}
public static ICommand getLatestForAfosCommand(ICommand cmd) {
@ -83,7 +88,7 @@ public class CommandFactory {
AFOSParser parser = new AFOSParser(text, localSiteId);
String afosCommand = parser.getCcc() + parser.getNnn()
+ parser.getXxx();
return new AFOSCommand(afosCommand, localSiteId);
return new AFOSCommand(afosCommand, localSiteId, null);
}
public static ICommand getAllForAfosCommand(ICommand cmd) {
@ -91,7 +96,7 @@ public class CommandFactory {
AFOSParser parser = new AFOSParser(text, localSiteId);
String afosCommand = "ALL:" + parser.getCcc() + parser.getNnn()
+ parser.getXxx();
return new AFOSCommand(afosCommand, localSiteId);
return new AFOSCommand(afosCommand, localSiteId, null);
}
public static ICommand getWmoCommand(String wmoId, String cccc) {

View file

@ -86,6 +86,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 06/28/2010 4639 cjeanbap Allow user to create a new text product.
*
* 01/26/2012 14468 D.Friedman Fix initial BBB field selection.
* 05/30/2012 15046 D.Friedman Always set addressee field to ALL.
* </pre>
*
* @author lvenable
@ -448,7 +449,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
addresseeTF.setTextLimit(4);
addresseeTF.setLayoutData(rd);
// Set the "default" addressee to "ALL".
addresseeTF.setText(parentEditor.getAddressee());
addresseeTF.setText("ALL");
// When the number of characters enter reaches the max limit and
// the caret position is at the end then switch focus to the next
@ -459,16 +460,8 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
.getTextLimit()) {
wmoTtaaiiTF.setFocus();
}
// If the user changes the text in the addressee text field
// then "untoggle" the toggle buttons.
if (addresseeTF.getText().compareTo("000") != 0
&& addresseeTF.getText().compareTo("DEF") != 0
&& addresseeTF.getText().compareTo("ALL") != 0) {
zerosBtn.setSelection(false);
defBtn.setSelection(false);
allBtn.setSelection(false);
}
handleAddresseeModified();
}
});
@ -518,6 +511,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
addresseeTF.setText("ALL");
}
});
handleAddresseeModified();
Label sepLbl = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
sepLbl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@ -945,4 +939,16 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
}
});
}
private void handleAddresseeModified() {
// If the user changes the text in the addressee text field
// then update the toggle buttons.
String addressee = addresseeTF.getText();
if (zerosBtn != null)
zerosBtn.setSelection("000".equals(addressee));
if (defBtn != null)
defBtn.setSelection("DEF".equals(addressee));
if (allBtn != null)
allBtn.setSelection("ALL".equals(addressee));
}
}

View file

@ -67,6 +67,36 @@
actionClass="com.raytheon.viz.ui.cmenu.RightClickSeparator"
name="100-------------"
sortID="100"/>
<contextualMenu
actionClass="com.raytheon.viz.ui.cmenu.LoadAsGraphicsAction"
capabilityClass="com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability"
name="Load as Graphics"
sortID="109">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.ui.cmenu.LoadAsImageAction"
capabilityClass="com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability"
name="Load as Image"
sortID="110">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.ui.cmenu.LoadAsStreamlinesAction"
capabilityClass="com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability"
name="Load as Streamlines"
sortID="111">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.ui.cmenu.LoadAsBarbsAction"
capabilityClass="com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability"
name="Load as Wind Barbs"
sortID="112">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.ui.cmenu.LoadAsArrowsAction"
capabilityClass="com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability"
name="Load as Arrows"
sortID="113">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.ui.cmenu.RightClickSeparator"
name="200-------------"

View file

@ -0,0 +1,17 @@
package com.raytheon.viz.ui.cmenu;
import com.raytheon.uf.viz.core.rsc.DisplayType;
public class LoadAsArrowsAction extends LoadAsDisplayTypeAction {
@Override
public String getText() {
return "Load as Arrows";
}
@Override
protected DisplayType getDisplayType() {
return DisplayType.ARROW;
}
}

View file

@ -0,0 +1,17 @@
package com.raytheon.viz.ui.cmenu;
import com.raytheon.uf.viz.core.rsc.DisplayType;
public class LoadAsBarbsAction extends LoadAsDisplayTypeAction {
@Override
public String getText() {
return "Load as Wind Barbs";
}
@Override
protected DisplayType getDisplayType() {
return DisplayType.BARB;
}
}

View file

@ -17,45 +17,43 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.core.contours.cmenu;
package com.raytheon.viz.ui.cmenu;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.Activator;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.ResourceGroup;
import com.raytheon.uf.viz.core.rsc.ResourceProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.ImagingCapability;
import com.raytheon.uf.viz.core.status.StatusConstants;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
/**
* ConvertToImagery
*
* Action to create an imagery resource from a contoru resource
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 24, 2007 chammack Initial Creation.
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 26, 2010 bsteffen Initial creation
* Aug 10, 2011 njensen Added runWithEvent
*
* </pre>
*
* @author chammack
* @version 1
* @author bsteffen
* @version 1.0
*/
public class ConvertToImagery extends AbstractRightClickAction {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ConvertToImagery.class);
public abstract class LoadAsDisplayTypeAction extends AbstractRightClickAction {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(LoadAsDisplayTypeAction.class);
/*
* (non-Javadoc)
@ -65,22 +63,27 @@ public class ConvertToImagery extends AbstractRightClickAction {
@Override
public void run() {
try {
IGraphicsTarget activeTarget = container.getActiveDisplayPane()
.getTarget();
ILoadableAsImage rsc = ((ILoadableAsImage) this.getSelectedRsc());
AbstractVizResource<?, ?> imageryRsc = rsc.getImageryResource();
ResourceProperties rp = this.getDescriptor().getResourceList()
.getProperties(imageryRsc);
imageryRsc.getCapability(ImagingCapability.class).setBrightness(
0.5f);
this.getDescriptor().getResourceList().add(imageryRsc);
ResourcePair rp = selectedRsc;
ResourceGroup group = new ResourceGroup();
group.getResourceList().add(rp);
String xml = SerializationUtil.marshalToXml(group);
group = (ResourceGroup) SerializationUtil.unmarshalFromXml(xml);
rp = group.getResourceList().get(0);
rp.setProperties(new ResourceProperties());
rp.getLoadProperties()
.getCapabilities()
.getCapability(rp.getResourceData(),
DisplayTypeCapability.class)
.setDisplayType(getDisplayType());
rp.instantiateResource(getDescriptor());
getDescriptor().getResourceList().add(rp);
} catch (JAXBException e) {
statusHandler.handle(Priority.PROBLEM,
"Unexpected error cloning resource", e);
} catch (VizException e) {
statusHandler.handle(Priority.SIGNIFICANT,
"Error converting contour resource to imagery resource", e);
statusHandler.handle(Priority.PROBLEM,
"Unexpected error cloning resource", e);
}
}
/*
@ -90,15 +93,23 @@ public class ConvertToImagery extends AbstractRightClickAction {
*/
@Override
public String getText() {
return "Load as Image";
String typeString = getDisplayType().toString();
typeString = typeString.substring(0, 1).toUpperCase()
+ typeString.substring(1).toLowerCase();
return "Load as " + typeString;
}
@Override
public boolean isHidden() {
if (getSelectedRsc() instanceof ILoadableAsImage) {
return !((ILoadableAsImage) getSelectedRsc()).isLoadableAsImage();
AbstractVizResource<?, ?> rsc = getSelectedRsc();
if (rsc == null) {
return true;
}
return false;
DisplayTypeCapability cap = rsc
.getCapability(DisplayTypeCapability.class);
return cap.getDisplayType() == getDisplayType()
|| !cap.getAlternativeDisplayTypes().contains(getDisplayType());
}
@Override
@ -112,7 +123,7 @@ public class ConvertToImagery extends AbstractRightClickAction {
&& rsc2 != rsc
&& rrd.equals(rsc2.getResourceData()) == true
&& rsc2.getCapability(DisplayTypeCapability.class)
.getDisplayType() == DisplayType.IMAGE) {
.getDisplayType() == getDisplayType()) {
return false;
}
}
@ -122,4 +133,6 @@ public class ConvertToImagery extends AbstractRightClickAction {
}
}
protected abstract DisplayType getDisplayType();
}

View file

@ -0,0 +1,17 @@
package com.raytheon.viz.ui.cmenu;
import com.raytheon.uf.viz.core.rsc.DisplayType;
public class LoadAsGraphicsAction extends LoadAsDisplayTypeAction {
@Override
public String getText() {
return "Load as Graphics";
}
@Override
protected DisplayType getDisplayType() {
return DisplayType.CONTOUR;
}
}

View file

@ -0,0 +1,12 @@
package com.raytheon.viz.ui.cmenu;
import com.raytheon.uf.viz.core.rsc.DisplayType;
public class LoadAsImageAction extends LoadAsDisplayTypeAction {
@Override
protected DisplayType getDisplayType() {
return DisplayType.IMAGE;
}
}

View file

@ -0,0 +1,17 @@
package com.raytheon.viz.ui.cmenu;
import com.raytheon.uf.viz.core.rsc.DisplayType;
public class LoadAsStreamlinesAction extends LoadAsDisplayTypeAction {
@Override
public String getText() {
return "Load as Streamlines";
}
@Override
protected DisplayType getDisplayType() {
return DisplayType.STREAMLINE;
}
}

View file

@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.core,
com.raytheon.viz.ui,
com.raytheon.viz.ui.tools.map,
org.apache.velocity,
org.apache.velocity;bundle-version="1.6.0",
javax.vecmath,
javax.measure,
org.apache.commons.lang,

View file

@ -989,16 +989,21 @@ public class WarngenLayer extends AbstractStormTrackResource {
Geometry area = null;
if (polygon != null) {
for (GeospatialData r : geoData.features) {
Geometry intersection = GeometryUtil.intersection(polygon,
(Geometry) r.attributes
.get(GeospatialDataList.LOCAL_GEOM));
if (intersection.isEmpty()) {
continue;
}
if (area == null) {
area = intersection;
} else {
area = GeometryUtil.union(area, intersection);
PreparedGeometry prepGeom = (PreparedGeometry) r.attributes
.get(GeospatialDataList.LOCAL_PREP_GEOM);
try {
Geometry intersection = GeometryUtil.intersection(polygon, prepGeom);
if (intersection.isEmpty()) {
continue;
}
if (area == null) {
area = intersection;
} else {
area = GeometryUtil.union(area, intersection);
}
} catch (Exception e) {
// TODO handle exception correctly!!!
e.printStackTrace();
}
}
}
@ -1209,8 +1214,6 @@ public class WarngenLayer extends AbstractStormTrackResource {
"Inclusion Area not properly configured.", e);
}
}
System.out.println("determining hatchedArea took "
+ (System.currentTimeMillis() - t0));
// All area has been removed from the polygon...
if (insideCWA == false) {
state.strings.clear();
@ -1236,7 +1239,6 @@ public class WarngenLayer extends AbstractStormTrackResource {
// Snap back to polygon
state.setWarningPolygon(localToLatLon((Polygon) oldWarningPolygon));
newHatchedArea = (Geometry) oldWarningArea.clone();
updateWarnedAreas(snapHatchedAreaToPolygon, true);
} else if (areaPercent < 10 && state.isMarked()) {
// snap back to last valid user selected area
state.setWarningPolygon((Polygon) state
@ -1244,13 +1246,12 @@ public class WarngenLayer extends AbstractStormTrackResource {
newHatchedArea = latLonToLocal((Geometry) state
.getMarkedWarningArea().clone());
state.resetMarked();
updateWarnedAreas(snapHatchedAreaToPolygon, true);
} else if (newHatchedArea != null) {
// want intersection of newHatchedArea and oldWarningArea
} else if (warningPolygon != null) {
// want intersection of warningPolygon and oldWarningArea
Geometry intersection = null;
for (int n = 0; n < oldWarningArea.getNumGeometries(); ++n) {
Geometry oldArea = oldWarningArea.getGeometryN(n);
Geometry geom = GeometryUtil.intersection(newHatchedArea,
Geometry geom = GeometryUtil.intersection(warningPolygon,
oldArea);
if (geom.isEmpty() == false) {
if (intersection == null) {
@ -1264,6 +1265,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
newHatchedArea = intersection;
}
}
System.out.println("determining hatchedArea took "
+ (System.currentTimeMillis() - t0));
if (newHatchedArea == null) {
boolean initialWarning = false;
String[] followUps = this.getConfiguration().getFollowUps();
@ -1291,7 +1294,6 @@ public class WarngenLayer extends AbstractStormTrackResource {
newHatchedArea = localToLatLon(newHatchedArea);
state.setWarningArea(newHatchedArea);
state.mark(newHatchedArea);
newHatchedArea = buildArea(getPolygon());
// add "W" strings
if (determineInclusion) {
populateStrings();
@ -1722,21 +1724,10 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
Polygon warnPolygon = gf.createPolygon(lr, null);
// Remove intersected segments
if (warnPolygon.isValid() == false) {
List<Coordinate> points = new ArrayList<Coordinate>(
Arrays.asList(coords));
points.remove(points.size() - 1);
PolygonUtil.removeIntersectedSeg(points);
points.add(new Coordinate(points.get(0)));
warnPolygon = gf.createPolygon(gf.createLinearRing(points
.toArray(new Coordinate[points.size()])), null);
}
state.setWarningPolygon(warnPolygon);
state.setWarningArea(getWarningAreaFromPolygon(
state.getWarningPolygon(), record));
updateWarnedAreas(false, true);
issueRefresh();
updateWarnedAreas(true, true);
}
private DataTime recordFrameTime(AbstractWarningRecord warnRecord) {
@ -1955,10 +1946,10 @@ public class WarngenLayer extends AbstractStormTrackResource {
for (int j = 0; j < ls.length; j++) {
if (i != j
&& ls[i].intersection(ls[j]) != null
&& ls[i].intersection(ls[j]) != ls[i]
.getCoordinate(0)
&& ls[i].intersection(ls[j]) != ls[i]
.getCoordinate(1)) {
&& ls[i].intersection(ls[j]).equals(ls[i]
.getCoordinate(0)) == false
&& ls[i].intersection(ls[j]).equals(ls[i]
.getCoordinate(1)) == false) {
intersectFlag = true;
}
}

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.common.localization.exception.LocalizationException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 18, 2011 mschenke Initial creation
* 06/01/2012 DR 14555 D. Friedman Support new version of Velocity.
*
* </pre>
*
@ -106,4 +107,19 @@ public class LocalizationResourceLoader extends FileResourceLoader implements
public synchronized void fileUpdated(FileUpdatedMessage message) {
fileMap.remove(LocalizationUtil.extractName(message.getFileName()));
}
@Override
public boolean resourceExists(String name) {
LocalizationFile file = fileMap.get(name);
if (file == null || file.exists() == false) {
try {
file = FileUtil.getLocalizationFile(name, site);
file.addFileUpdatedObserver(this);
} catch (FileNotFoundException e) {
return false;
}
fileMap.put(name, file);
}
return true;
}
}

View file

@ -50,6 +50,12 @@ import com.raytheon.viz.warngen.gis.AffectedAreasComparator;
* Aug 29, 2011 10719 rferrel applyLocks no longer allows removal of
* required blank lines.
* May 10, 2012 14681 Qinglu Lin Updated regex string for Pattern listOfAreaNamePtrn, etc.
* May 30, 2012 14749 Qinglu Lin Handled CAN in a CANCON specifically.
* Jun 6, 2012 14749 Qinglu Lin Added code to lock "...THE" in "...THE CITY OF", etc.
* (David's concise approach was used. A quicker but
* lengthy code snippet is available) and to resolve issue with
* empty areaNotation and areasNotation which occurs when,
* for example, District of Columbia is followed by a county.
*
* </pre>
*
@ -107,7 +113,10 @@ public class WarningTextHandler {
.compile("\\*\\s(.*)\\s(WARNING|ADVISORY)(\\sFOR(.*)|\\.\\.\\.)");
private static final Pattern cancelPtrn = Pattern
.compile("(|(.*))(IS CANCELLED...)");
.compile("(|(.*))(IS CANCELLED\\.\\.\\.)");
private static final Pattern cancelOnlyPtrn = Pattern
.compile("(CANCELLED<\\/L>\\.\\.\\.)");
private static final Pattern expirePtrn = Pattern
.compile("(|(.*))((EXPIRED|WILL EXPIRE)\\sAT\\s\\d{3,4}\\s(AM|PM)\\s\\w{3}...)");
@ -115,6 +124,8 @@ public class WarningTextHandler {
private static final Pattern headlinePtrn = Pattern
.compile("(\\.\\.\\.((A|THE)\\s(.*)\\s(WARNING|ADVISORY))\\s(FOR|(REMAINS IN EFFECT (|(UNTIL\\s\\d{3,4}\\s(AM|PM)\\s\\w{3})))))(|(.*))");
private static final Pattern canVtecPtrn = Pattern.compile("(\\.CAN\\.)");
private static Pattern immediateCausePtrn = null;
/** ex. SARPY NE-DOUGLAS NE-WASHINGTON NE- */
@ -142,6 +153,9 @@ public class WarningTextHandler {
private static final Pattern lockedBlankLinesPattern = Pattern.compile(
"<L>(\\s*+)</L>", Pattern.MULTILINE);
private static final String LOCK_REPLACEMENT_TEXT = LOCK_START + "$0" + LOCK_END;
private static final Pattern extraTokensPattern = Pattern.compile("\\b(?:THE|IS|CANCELLED)\\b");
static {
String pattern = "";
@ -194,7 +208,7 @@ public class WarningTextHandler {
List<AffectedAreas> canceledAreasArr = canceledAreas != null ? Arrays
.asList(canceledAreas) : null;
originalMessage = applyLocks(originalMessage, areasArr,
canceledAreasArr, initialWarning);
canceledAreasArr, initialWarning, action);
}
originalMessage = removeExtraLines(originalMessage);
@ -236,11 +250,13 @@ public class WarningTextHandler {
private static String applyLocks(String originalMessage,
List<AffectedAreas> areas, List<AffectedAreas> canceledAreas,
boolean initialWarning) {
boolean initialWarning, WarningAction action) {
boolean firstBulletFound = false;
boolean insideFirstBullet = false;
boolean secondBulletFound = false;
boolean headlineFound = false;
// for CAN in a CANCON
boolean cancelVtecLineFound = false;
boolean insideLatLon = false;
boolean insideTML = false;
boolean checkForMND = true;
@ -269,6 +285,7 @@ public class WarningTextHandler {
// Set before to false if the line is beyond "THE NATIONAL WEATHER SERVICE IN" line.
boolean before = true;
ArrayList<String> usedAreaNotations = new ArrayList<String>();
for (int lineIndex = 0; lineIndex < seperatedLines.length; ++lineIndex) {
String line = seperatedLines[lineIndex];
@ -309,6 +326,12 @@ public class WarningTextHandler {
m = vtecPtrn.matcher(line);
if (m.find()) {
sb.append(LOCK_START + line + "\n" + LOCK_END);
// check out if .CAN. is in VTEC line of a CANCON product.
m = canVtecPtrn.matcher(line);
if (action == WarningAction.CANCON && m.find()) {
cancelVtecLineFound = true;
} else
cancelVtecLineFound = false;
continue;
}
@ -445,77 +468,120 @@ public class WarningTextHandler {
continue;
}
} else {
// head line pattern
m = headlinePtrn.matcher(line);
if (m.find()) {
checkForMND = false;
headlineFound = true;
line = line.replace(m.group(2), LOCK_START + m.group(2)
+ LOCK_END);
}
usedAreaNotations.clear();
// head line pattern
m = headlinePtrn.matcher(line);
if (m.find()) {
checkForMND = false;
headlineFound = true;
line = line.replace(m.group(2), LOCK_START + m.group(2)
+ LOCK_END);
}
// CAN portion in a CANCON
if (cancelVtecLineFound) {
for (AffectedAreas area : canceledAreas) {
String areaName = area.getName();
if (areaName != null) {
areaName = areaName.toUpperCase();
String[] tokens = areaName.split(" ");
for (String s: tokens)
if (line.contains(s))
line = line.replaceAll(s, LOCK_START
+ s + LOCK_END);
}
// areaNotation, e.g., COUNTY
String areaNotation = area.getAreaNotation().toUpperCase();
if (areaNotation != null && areaNotation.length()>0
&& !usedAreaNotations.contains(areaNotation)
&& line.contains(areaNotation)) {
line = line.replaceAll(areaNotation, LOCK_START
+ areaNotation + LOCK_END);
usedAreaNotations.add(areaNotation);
}
// areasNotation, e.g., COUNTIES
String areasNotation = area.getAreasNotation().toUpperCase();
if (areasNotation != null && areasNotation.length()>0
&& !usedAreaNotations.contains(areasNotation)
&& line.contains(areasNotation)) {
line = line.replaceAll(areasNotation, LOCK_START
+ areasNotation + LOCK_END);
usedAreaNotations.add(areasNotation);
}
}
// locking "THE" in "THE CITY OF MANASSAS", "...THE" in "...THE CITY",
// and "IS" or "CANCELLED" in "IS CANCELLED...".
line = extraTokensPattern.matcher(line).replaceAll(
LOCK_REPLACEMENT_TEXT);
if (headlineFound) {
ArrayList<String> usedAreaNotations = new ArrayList<String>();
if (areas != null && !marineProduct) {
for (AffectedAreas area : areas) {
if (area.getName() != null
&& line.contains(area.getName()
.toUpperCase())) {
line = line.replaceFirst(area.getName()
.toUpperCase(), LOCK_START
+ area.getName().toUpperCase()
+ LOCK_END);
}
m = cancelOnlyPtrn.matcher(line);
if (m.find())
cancelVtecLineFound = false;
sb.append(line + "\n");
continue;
} else {
// follow-ups other than CAN in a CANCON
if (headlineFound) {
usedAreaNotations.clear();
if (areas != null && !marineProduct) {
for (AffectedAreas area : areas) {
if (area.getName() != null
&& line.contains(area.getName()
.toUpperCase())) {
line = line.replaceFirst(area.getName()
.toUpperCase(), LOCK_START
+ area.getName().toUpperCase()
+ LOCK_END);
}
if (area.getAreaNotation() != null
&& !usedAreaNotations.contains(area
.getAreaNotation()
.toUpperCase())
&& line.contains(area.getAreaNotation())) {
line = line.replaceAll(" "
+ area.getAreaNotation()
.toUpperCase(), LOCK_START
+ " " + area.getAreaNotation()
+ LOCK_END);
usedAreaNotations.add(area
.getAreaNotation().toUpperCase());
}
}
}
if (area.getAreaNotation() != null
&& !usedAreaNotations.contains(area
.getAreaNotation()
.toUpperCase())
&& line.contains(area.getAreaNotation())) {
line = line.replaceAll(" "
+ area.getAreaNotation()
.toUpperCase(), LOCK_START
+ " " + area.getAreaNotation()
+ LOCK_END);
usedAreaNotations.add(area
.getAreaNotation().toUpperCase());
}
}
}
m = cancelPtrn.matcher(line);
if (m.find()) {
line = line.replaceFirst(m.group(3),
LOCK_START + m.group(3) + LOCK_END);
if (canceledAreas != null) {
for (AffectedAreas canceledArea : canceledAreas) {
if (line.contains(canceledArea.getName()
.toUpperCase())) {
line = line.replaceFirst(canceledArea
.getName().toUpperCase(),
LOCK_START
+ canceledArea
.getName()
.toUpperCase()
+ LOCK_END);
}
}
}
headlineFound = false;
}
m = expirePtrn.matcher(line);
if (m.find()) {
line = line.replaceFirst(m.group(3),
LOCK_START + m.group(3) + LOCK_END);
headlineFound = false;
}
sb.append(line + "\n");
continue;
}
m = cancelPtrn.matcher(line);
if (m.find()) {
line = line.replaceFirst(m.group(3),
LOCK_START + m.group(3) + LOCK_END);
if (canceledAreas != null) {
for (AffectedAreas canceledArea : canceledAreas) {
if (line.contains(canceledArea.getName()
.toUpperCase())) {
line = line.replaceFirst(canceledArea
.getName().toUpperCase(),
LOCK_START
+ canceledArea
.getName()
.toUpperCase()
+ LOCK_END);
}
}
}
headlineFound = false;
}
m = expirePtrn.matcher(line);
if (m.find()) {
line = line.replaceFirst(m.group(3),
LOCK_START + m.group(3) + LOCK_END);
headlineFound = false;
}
sb.append(line + "\n");
continue;
}
}
}
// Locking LAT...LON
@ -543,7 +609,6 @@ public class WarningTextHandler {
sb.append(LOCK_START + line + "\n" + LOCK_END);
continue;
}
// Locking TIME...MOT..LOC
m = tmlPtrn.matcher(line);
if (m.find()) {
@ -566,23 +631,22 @@ public class WarningTextHandler {
// Test lines
if (line.equals(TEST_MSG3)
|| line.equals(TEST_MSG1)
|| (line.startsWith("TEST...") && line
.endsWith("...TEST"))) {
sb.append(LOCK_START + line + LOCK_END + "\n");
continue;
}
|| line.equals(TEST_MSG1)
|| (line.startsWith("TEST...") && line
.endsWith("...TEST"))) {
sb.append(LOCK_START + line + LOCK_END + "\n");
continue;
}
m = testMessagePtrn.matcher(line);
if (m.find()) {
line = line.replace(m.group(2), LOCK_START + m.group(2)
+ LOCK_END);
line = line.replace(m.group(2), LOCK_START + m.group(2)
+ LOCK_END);
}
} catch (Exception e) {
// If an exception is thrown,
// log the exception but continue locking text
statusHandler.handle(Priority.PROBLEM, "Error locking line: "
+ line + "\n", e);
// If an exception is thrown,
// log the exception but continue locking text
statusHandler.handle(Priority.PROBLEM, "Error locking line: "
+ line + "\n", e);
}
sb.append(line + "\n");
insideLatLon = false;

View file

@ -30,6 +30,9 @@ import com.raytheon.viz.warnings.DateUtil;
* May 3, 2011 jsanchez Initial creation
* Aug 5, 2011 njensen Refactored maps
* Aug 22, 2011 10631 njensen Major refactor
* May 31, 2012 DR14992 mgamazaychikov Changed the order of strings in the
* String array returned from getText method
* Jun 04, 2012 DR14992 mgamazaychikov Reversed the previous changes
*
* </pre>
*

View file

@ -72,6 +72,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* to make SVS warning updates and
* original warning display properly
* in a given display frame
* Jun 04, 2012 DR14992 mgamazaychikov Reversed the textToPrint array to
* plot the strings in correct order
*
* </pre>
*
@ -575,7 +577,14 @@ public abstract class AbstractWarningResource extends AbstractWWAResource
warningsFont = target.getDefaultFont()
.deriveWithSize(11);
}
DrawableString params = new DrawableString(textToPrint,
// DR14992: reverse the textToPrint array to plot the strings in correct order
String [] textToPrintReversed = new String[textToPrint.length];
for(int i = 0; i < textToPrint.length; i++) {
textToPrintReversed[i] = textToPrint[textToPrint.length
- i - 1];
}
DrawableString params = new DrawableString(textToPrintReversed,
color);
params.font = warningsFont;
params.setCoordinates(d[0], d[1]);

View file

@ -55,6 +55,8 @@ import com.vividsolutions.jts.geom.Geometry;
* Aug 22, 2011 10631 njensen Major refactor
* May 3, 2012 DR 14741 porricel Stop setting end time of orig.
* warning to start time of update.
* Jun 04, 2012 DR14992 mgamazaychikov Fix the problem with plotting expiration time for
* NEW warning when CAN warning is issued
*
* </pre>
*
@ -99,7 +101,11 @@ public class WarningsResource extends AbstractWarningResource {
//if cancellation, set end time to start time
//of this action
if(act == WarningAction.CAN) {
// DR14992: fix the problem with plotting expiration time for
// NEW warning when CAN warning is issued
if(act == WarningAction.CAN &&
WarningAction.valueOf(entry.record.getAct()) == WarningAction.CAN) {
entry.record.setEndTime((Calendar) warnrec
.getStartTime().clone());
}

View file

@ -2,8 +2,8 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="velocity-tools-generic-1.3.jar" sourcepath="org.apache.velocitysrc.zip"/>
<classpathentry exported="true" kind="lib" path="velocity-1.5.jar" sourcepath="velocity-1.5-src.zip"/>
<classpathentry exported="true" kind="lib" path="oro-2.0.7.jar" sourcepath="org.apache.velocitysrc.zip"/>
<classpathentry exported="true" kind="lib" path="velocity-tools-generic-2.0.jar"/>
<classpathentry exported="true" kind="lib" path="velocity-1.7.jar" sourcepath="velocity-1.7-src.zip"/>
<classpathentry exported="true" kind="lib" path="oro-2.0.8.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -2,11 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Velocity Plug-in
Bundle-SymbolicName: org.apache.velocity
Bundle-Version: 1.5.0
Bundle-Version: 1.7.0
Eclipse-BuddyPolicy: ext, registered
Bundle-ClassPath: velocity-tools-generic-1.3.jar,
velocity-1.5.jar,
oro-2.0.7.jar
Bundle-ClassPath: velocity-tools-generic-2.0.jar,
velocity-1.7.jar,
oro-2.0.8.jar
Export-Package: org.apache.velocity,
org.apache.velocity.anakia,
org.apache.velocity.app,
@ -30,6 +30,8 @@ Export-Package: org.apache.velocity,
org.apache.velocity.texen,
org.apache.velocity.texen.ant,
org.apache.velocity.texen.util,
org.apache.velocity.tools,
org.apache.velocity.tools.config,
org.apache.velocity.tools.generic,
org.apache.velocity.tools.generic.log,
org.apache.velocity.util,
@ -38,6 +40,6 @@ Require-Bundle: org.apache.commons.beanutils,
org.apache.commons.collections,
org.apache.commons.lang
Bundle-Vendor: Raytheon-bundled OSS
Edex-Deploy: velocity-1.5.jar,
velocity-tools-generic-1.3.jar
Edex-Deploy: velocity-1.7.jar,
velocity-tools-generic-2.0.jar
Bundle-RequiredExecutionEnvironment: JavaSE-1.6

View file

@ -1,4 +1,4 @@
bin.includes = META-INF/,\
velocity-tools-generic-1.3.jar,\
velocity-1.5.jar,\
oro-2.0.7.jar
oro-2.0.8.jar,\
velocity-tools-generic-2.0.jar,\
velocity-1.7.jar

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -2,6 +2,7 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="lib" path="jaxen-1.1.4.jar"/>
<classpathentry exported="true" kind="lib" path="dom4j-1.6.1.jar" sourcepath="org.dom4jsrc.zip"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -4,6 +4,7 @@ Bundle-Name: Dom4j Plug-in
Bundle-SymbolicName: org.dom4j
Bundle-Version: 1.0.0.qualifier
Bundle-ClassPath: dom4j-1.6.1.jar,
jaxen-1.1.4.jar,
.
Export-Package: org.dom4j,
org.dom4j.bean,

Some files were not shown because too many files have changed in this diff Show more