12.9.1-4 baseline

Former-commit-id: df38541c9df38c634626ae214f288b606004a768
This commit is contained in:
Steve Harris 2012-08-15 15:19:10 -05:00
parent 36d80b1f60
commit dcda3a2290
171 changed files with 7381 additions and 5351 deletions

View file

@ -30,6 +30,6 @@
<request> <productCode>34</productCode> <pdw20>16</pdw20> </request>
<request> <productCode>34</productCode> <pdw20>32</pdw20> </request>
</cronOTR>
<cronOTR cron="0 0 * * * ?" productCode="173" randomWait="600" hoursBack="3" wmo="SDUS8" nnn="DU3"/>
<cronOTR cron="0 0 12 * * ?" productCode="173" randomWait="600" hoursBack="24" wmo="SDUS8" nnn="DU6"/>
<cronOTR cron="0 10 * * * ?" productCode="173" randomWait="300" hoursBack="3" wmo="SDUS8" nnn="DU3"/>
<cronOTR cron="0 10 12 * * ?" productCode="173" randomWait="300" hoursBack="24" wmo="SDUS8" nnn="DU6"/>
</cronOTRConfiguration>

View file

@ -178,10 +178,6 @@
<param name="feature"
value="com.raytheon.uf.viz.localization.perspective.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature"
value="com.raytheon.uf.viz.alertviz.localization.feature" />
</antcall>
<antcall target="p2.build.repo">
<param name="feature"
value="com.raytheon.viz.radar.feature" />

View file

@ -26,6 +26,10 @@
# DELIVERED
#
# History:
# Revision 17
# Created: 10-AUG-2012 15:00:00 GZHANG
# DR 14702: Added fix for PyTables in Gui().trend()
#
# Revision 16 (DELIVERED)
# Created: 06-MAR-2008 17:01:20 OBERFIEL
# Added fix for leap-years.
@ -661,7 +665,7 @@ class Gui():
n1 = max(0, n-2*int((t-t1)//3600.0)-1) # small enough
n2 = n1 + 5*self.MaxHours # big enough
data = [(row['date_time'], row['cig'], row['vis']) for row in \
table.where('(t1<=date_time) & (date_time<t2)')]
table.where('(t1<=date_time) & (date_time<t2)', start=n1, stop=n2)]
process_data(count, data, t1, self.MaxHours, table)
# calculate frequencies
args = count.keys()

View file

@ -122,8 +122,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
# Make argDict accessible
self.__argDict = argDict

View file

@ -1905,12 +1905,9 @@ class FWS_Overrides:
# Get VariableList and _issuance_list variables
varDict = argDict["varDict"]
for key in varDict.keys():
print "key", key
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
elif type(key) is str:
exec "self._" + key + "= varDict[key]"
self._language = argDict["language"]

View file

@ -796,7 +796,7 @@ class SmartScript(BaseTool.BaseTool):
if "A" == status:
importance = Priority.PROBLEM
elif "R" == status:
importance = Priority.EVENTA
importance = Priority.EVENTB
elif "U" == status:
importance = Priority.CRITICAL
else:

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.viz.alertviz.localization.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View file

@ -1 +0,0 @@
bin.includes = feature.xml

View file

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.raytheon.uf.viz.alertviz.localization.feature"
label="Alertviz Localization Feature"
version="1.0.0.qualifier"
provider-name="RAYTHEON">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
<requires>
<import feature="com.raytheon.uf.viz.common.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
<import feature="com.raytheon.uf.viz.eclipse.feature" version="1.0.0.qualifier"/>
</requires>
<plugin
id="com.raytheon.uf.viz.alertviz.localization"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.viz.alertviz.localization</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,7 +0,0 @@
#Mon Apr 04 17:11:52 CDT 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -1,25 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ui Plug-in
Bundle-SymbolicName: com.raytheon.uf.viz.alertviz.localization;singleton:=true
Bundle-Version: 1.12.1174.qualifier
Bundle-Activator: com.raytheon.uf.viz.alertviz.Activator
Bundle-Vendor: Raytheon
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
com.raytheon.uf.common.localization,
com.raytheon.uf.common.message;bundle-version="1.11.11",
com.raytheon.uf.viz.alertviz;bundle-version="1.11.11"
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Export-Package: com.raytheon.uf.viz.alertviz.localization,
com.raytheon.uf.viz.alertviz.localization.actions
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.uf.common.alertmonitor,
com.raytheon.uf.common.util,
com.raytheon.uf.viz.localization,
com.raytheon.uf.viz.localization.adapter,
com.raytheon.uf.viz.localization.filetreeview,
com.raytheon.uf.viz.localization.service,
com.raytheon.viz.ui,
com.raytheon.viz.ui.dialogs

View file

@ -1,5 +0,0 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml

View file

@ -1,102 +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.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Configurations"
value="alertViz/configurations"
recursive="false"
localizationAdapter="com.raytheon.uf.viz.alertviz.localization.AlertVizLocalizationAdapter"
extensionFilter=".xml">
</path>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Python"
value="alertViz/python"
recursive="false"
localizationAdapter="com.raytheon.uf.viz.alertviz.localization.AlertVizLocalizationAdapter"
extensionFilter=".py">
</path>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Audio"
value="alertVizAudio"
recursive="false"
localizationAdapter="com.raytheon.uf.viz.alertviz.localization.AlertVizLocalizationAdapter"
extensionFilter=".wav">
</path>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Monitor Icons"
value="monitorIcons"
recursive="false"
localizationAdapter="com.raytheon.uf.viz.alertviz.localization.AlertVizLocalizationAdapter"
extensionFilter=".png">
</path>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Forced configuration"
value="alertViz"
recursive="false"
extensionFilter=".xml">
</path>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Custom Repository"
value="alertViz/customizations"
recursive="false"
extensionFilter=".xml">
</path>
</extension>
<!--extension
point="org.eclipse.ui.editors">
<editor
default="true"
id="com.raytheon.viz.alertviz.ui.configuration.editor"
name="AlertViz Configuration Editor" extensions="xml"
class="com.raytheon.uf.viz.alertviz.localization.editor.AlertVizConfigurationEditorPart">
</editor>
</extension-->
</plugin>

View file

@ -1,78 +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.uf.viz.alertviz.localization;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jface.action.IMenuManager;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.viz.alertviz.localization.actions.AlertVizFileImportAction;
import com.raytheon.uf.viz.localization.adapter.LocalizationPerspectiveAdapter;
import com.raytheon.uf.viz.localization.filetreeview.FileTreeEntryData;
/**
* Localization perspective adapter for AlertViz.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 04, 2011 5853 bgonzale Initial creation
*
* </pre>
*
* @author bgonzale
* @version 1.0
*/
public class AlertVizLocalizationAdapter extends LocalizationPerspectiveAdapter {
private static final Map<String, LocalizationLevel> localizationMap = getLocalizationMap();
@Override
public boolean addContextMenuItems(IMenuManager menuMgr,
FileTreeEntryData[] selectedData) {
if (selectedData.length == 1) {
FileTreeEntryData selected = selectedData[0];
if (selected.getClass() == FileTreeEntryData.class) {
LocalizationLevel level = localizationMap.get(selected
.getName());
menuMgr.add(new AlertVizFileImportAction(
(FileTreeEntryData) selected, level));
return true;
}
}
return false;
}
private static Map<String, LocalizationLevel> getLocalizationMap() {
Map<String, LocalizationLevel> map = new HashMap<String, LocalizationLevel>();
map.put("Audio", LocalizationLevel.SITE);
map.put("Configurations", LocalizationLevel.USER);
map.put("Scripts", LocalizationLevel.SITE);
map.put("Python", LocalizationLevel.SITE);
return map;
}
}

View file

@ -1,161 +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.uf.viz.alertviz.localization.actions;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.jface.action.Action;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
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.localization.exception.LocalizationOpFailedException;
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.localization.filetreeview.FileTreeEntryData;
import com.raytheon.viz.ui.VizWorkbenchManager;
/**
* Opens a file dialog for importing files.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 04, 2011 5853 bgonzale Initial creation
*
* </pre>
*
* @author bgonzale
* @version 1.0
*/
public class AlertVizFileImportAction extends Action {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AlertVizFileImportAction.class, "GDN_ADMIN",
"GDN_ADMIN");
private static final String PLUGIN_ID = "com.raytheon.uf.viz.alertviz.ui";
private static final String ASTERISK = "*";
private static final String ALL_FILES = "*.*";
private LocalizationLevel level;
private String[] extensions;
private String path;
/**
* @param fileEntry
*
*/
public AlertVizFileImportAction(FileTreeEntryData fileEntry) {
this(fileEntry, LocalizationLevel.USER);
}
/**
* @param fileEntry
* @param level
*
*/
public AlertVizFileImportAction(FileTreeEntryData fileEntry,
LocalizationLevel level) {
super("Import");
this.level = level == null ? LocalizationLevel.USER : level;
this.path = fileEntry.getPath();
String[] fileEntryExtensions = fileEntry.getPathData().getFilter();
this.extensions = new String[fileEntryExtensions.length + 1];
for (int i = 0; i < fileEntryExtensions.length; ++i) {
this.extensions[i] = ASTERISK + fileEntryExtensions[i];
}
this.extensions[this.extensions.length - 1] = ALL_FILES;
}
@Override
public void run() {
Shell shell = VizWorkbenchManager.getInstance().getCurrentWindow()
.getShell();
FileDialog fd = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
fd.setText("Import " + level + " File");
fd.setFilterExtensions(extensions);
fd.setFilterPath(System.getProperty("user.home"));
String fileName = fd.open();
if (fileName != null) {
File file = new File(fileName);
if (file.exists() && file.isFile()) {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext ctx = pm.getContext(
LocalizationType.CAVE_STATIC, level);
LocalizationFile locFile = pm.getLocalizationFile(ctx, path
+ File.separator + file.getName());
try {
saveToLocalizationFile(file, locFile);
} catch (FileNotFoundException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
} catch (IOException e) {
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
} catch (LocalizationOpFailedException e) {
statusHandler.handle(Priority.CRITICAL,
"Error Importing file " + fileName, e);
}
}
}
}
private void saveToLocalizationFile(File file, LocalizationFile locFile)
throws IOException, LocalizationOpFailedException {
File newFile = locFile.getFile();
InputStream in = new FileInputStream(file);
OutputStream out = new FileOutputStream(newFile);
byte[] buff = new byte[1024];
int len;
while ((len = in.read(buff)) > 0) {
out.write(buff, 0, len);
}
in.close();
out.close();
locFile.save();
}
}

View file

@ -341,7 +341,7 @@ public class FileSelectDlg extends Dialog {
importNewBtn1.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
FileDialog newFileDlg = new FileDialog(shell, SWT.OPEN
| SWT.MULTI);
| SWT.SINGLE);
newFileDlg.setFilterExtensions(fileExtensions);
String newFileName = newFileDlg.open();
if (newFileName != null) {

View file

@ -27,5 +27,79 @@
id="com.raytheon.viz.notification.statusHandler">
</statusHandler>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Configurations"
value="alertViz/configurations"
recursive="false"
extensionFilter=".xml">
</path>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Python"
value="alertViz/python"
recursive="false"
extensionFilter=".py">
</path>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Audio"
value="alertVizAudio"
recursive="false"
extensionFilter=".wav">
</path>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Monitor Icons"
value="monitorIcons"
recursive="false"
extensionFilter=".png">
</path>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Forced configuration"
value="alertViz"
recursive="false"
extensionFilter=".xml">
</path>
</extension>
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="Alertviz"
localizationType="CAVE_STATIC"
name="Custom Repository"
value="alertViz/customizations"
recursive="false"
extensionFilter=".xml">
</path>
</extension>
<!--extension
point="org.eclipse.ui.editors">
<editor
default="true"
id="com.raytheon.viz.alertviz.ui.configuration.editor"
name="AlertViz Configuration Editor" extensions="xml"
class="com.raytheon.uf.viz.alertviz.localization.editor.AlertVizConfigurationEditorPart">
</editor>
</extension-->
</plugin>

View file

@ -819,7 +819,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
// We can import into true directories, not group datas
mgr.add(new Separator());
mgr.add(new ImportFileAction(fdata.getPathData().getType(),
fdata.getPath()));
fdata.getPath(), fdata.getPathData().getFilter()));
}
}
}

View file

@ -67,17 +67,36 @@ public class ImportFileAction extends Action {
private static final String FORMAT_STRING = "The file '%s' already exists at the %s level and "
+ "will be deleted. Proceed?";
private static final String ASTERISK = "*";
private String directoryPath;
private LocalizationType contextType;
private String[] fileExtensionFilterArr;
public ImportFileAction(LocalizationType contextType, String directoryPath) {
super("Import File...");
this.contextType = contextType;
this.directoryPath = directoryPath;
}
/*
public ImportFileAction(LocalizationType contextType, String directoryPath, String[] filter) {
this(contextType, directoryPath);
if (filter != null) {
this.fileExtensionFilterArr = new String[filter.length];
for (int i = 0; i < filter.length; ++i) {
if (filter[i] != null && filter[i].startsWith(".")) {
// prepend an asterisk as required by FileDialog.
this.fileExtensionFilterArr[i] = ASTERISK + filter[i];
} else {
this.fileExtensionFilterArr[i] = filter[i];
}
}
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
@ -87,6 +106,9 @@ public class ImportFileAction extends Action {
Shell parent = VizWorkbenchManager.getInstance().getCurrentWindow()
.getShell();
FileDialog dialog = new FileDialog(parent);
if (fileExtensionFilterArr != null) {
dialog.setFilterExtensions(fileExtensionFilterArr);
}
String fileToImport = dialog.open();
if (fileToImport != null) {
File importFile = new File(fileToImport);

View file

@ -820,20 +820,15 @@ public class FFMPMonitor extends ResourceMonitor {
populateFFMPRecord(product, siteKey, dataKey, sourceName,
ptime, phuc, retrieveNew);
}
} else {
// special case where FFG is the primary source
// check for special case with dual stand alone and table
// display loaded
SourceXML sourcexml = getSourceConfig().getSource(sourceName);
} else {
// special case where FFG is the primary source
// check for special case with dual stand alone and table
// display loaded
if (sourcexml.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
sourceName = sourcexml.getDisplayName();
} else {
populateFFMPRecord(product, siteKey, dataKey, sourceName,
ptime, phuc, retrieveNew);
}
}
populateFFMPRecord(product, siteKey, dataKey, sourceName,
ptime, phuc, retrieveNew);
}
record = ffmpData.get(siteKey).get(sourceName);
}
@ -1109,6 +1104,8 @@ public class FFMPMonitor extends ResourceMonitor {
}
resourceListeners.remove(listener);
// clean up if we can
System.gc();
}
public ArrayList<IFFMPResourceListener> getResourceListenerList() {

View file

@ -279,8 +279,11 @@ public class FFTIControlDlg extends Dialog {
&& (thisItem.getQpeDurHr() == nextItem.getQpeDurHr())
&& (thisItem.getGuidDurHr() == nextItem.getGuidDurHr())
&& (thisItem.getQpfDurHr() == nextItem.getQpfDurHr())
&& (thisItem.getTotalDurHr() == nextItem.getTotalDurHr())) {
&& (thisItem.getTotalDurHr() == nextItem.getTotalDurHr())
&& (thisItem.getQpeSrc().length > 0 && nextItem.getQpeSrc().length > 0 && thisItem.getQpeSrc()[0].equals(nextItem.getQpeSrc()[0]))
&& (thisItem.getQpfSrc().length > 0 && nextItem.getQpfSrc().length > 0 && thisItem.getQpfSrc()[0].equals(nextItem.getQpfSrc()[0]))
&& (thisItem.getGuidSrc().length > 0 && nextItem.getGuidSrc().length > 0 && thisItem.getGuidSrc()[0].equals(nextItem.getGuidSrc()[0]))) {
duplicateLst.add(i + 1);
duplicateLst.add(j + 1);
}
@ -295,8 +298,14 @@ public class FFTIControlDlg extends Dialog {
HashSet<Integer> duplicates = getDuplicates();
if (duplicates.size() > 0) {
String setsStr = "";
for (Integer setIndex : duplicates)
setsStr += setIndex + "/";
int i = 0;
for (Integer setIndex : duplicates) {
setsStr += setIndex;
if (i != duplicates.size()-1) {
setsStr = setsStr + "/";
}
i++;
}
MessageBox messageBox = new MessageBox(shell, SWT.OK);
messageBox.setText("Warning: Duplicate Setting(s)!");
messageBox

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.monitor.ffmp.ffti;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import org.eclipse.swt.SWT;
@ -45,6 +46,17 @@ import com.raytheon.uf.common.monitor.xml.ProductRunXML;
import com.raytheon.uf.common.monitor.xml.ProductXML;
import com.raytheon.uf.common.monitor.xml.SourceXML;
/**
* FFTI Setting Composite.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 08/07/2012 578 mpduff FFTI now only a single selection and populates
* correctly.
* </pre>
*/
public class SettingComp extends Composite implements DurationInterface {
/**
* Parent tab folder.
@ -102,6 +114,8 @@ public class SettingComp extends Composite implements DurationInterface {
// temporary storage for qpf
private String selectedQpfVal = "0";
private FFTISettingXML fftiSetting;
public SettingComp(TabFolder parent) {
super(parent, 0);
@ -115,7 +129,8 @@ public class SettingComp extends Composite implements DurationInterface {
super(parent, 0);
this.parent = parent;
this.fftiSetting = fftiSetting;
init();
// set the attributes
@ -217,6 +232,8 @@ public class SettingComp extends Composite implements DurationInterface {
accumRdo.setEnabled(true);
accumAction(accumAttrib);
setSettings();
}
private void createAttributeControls() {
@ -318,7 +335,7 @@ public class SettingComp extends Composite implements DurationInterface {
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = listWidth;
gd.heightHint = listHeight;
qpeList = new List(precipSrcComp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
qpeList = new List(precipSrcComp, SWT.BORDER | SWT.V_SCROLL);
qpeList.setLayoutData(gd);
fillQpeList();
@ -327,8 +344,7 @@ public class SettingComp extends Composite implements DurationInterface {
gd.horizontalSpan = 2;
gd.widthHint = listWidth - 75;
gd.heightHint = listHeight;
guidList = new List(precipSrcComp, SWT.BORDER | SWT.MULTI
| SWT.V_SCROLL);
guidList = new List(precipSrcComp, SWT.BORDER | SWT.V_SCROLL);
guidList.setLayoutData(gd);
fillGuidList();
@ -337,7 +353,7 @@ public class SettingComp extends Composite implements DurationInterface {
gd.horizontalSpan = 2;
gd.widthHint = listWidth;
gd.heightHint = listHeight;
qpfList = new List(precipSrcComp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
qpfList = new List(precipSrcComp, SWT.BORDER | SWT.V_SCROLL);
qpfList.setLayoutData(gd);
fillQpfList();
@ -393,9 +409,6 @@ public class SettingComp extends Composite implements DurationInterface {
guidSet.add(sourceName);
guidList.add(sourceName);
}
if (guidList.getItemCount() > 0) {
guidList.setSelection(0);
}
guidList.addSelectionListener(new SelectionListener() {
@ -438,9 +451,10 @@ public class SettingComp extends Composite implements DurationInterface {
if (source.isMosaic()) {
if (!qpeSet.contains(product.getProductKey())) {
if (!qpeSet.contains(source.getDisplayName())) {
qpeSet.add(source.getDisplayName());
qpeList.add(source.getDisplayName());
String displayName = source.getDisplayName();
if (!qpeSet.contains(displayName)) {
qpeSet.add(displayName);
qpeList.add(displayName);
}
break;
}
@ -460,10 +474,6 @@ public class SettingComp extends Composite implements DurationInterface {
}
}
}
if (qpeList.getItemCount() > 0) {
qpeList.setSelection(0);
}
}
/**
@ -516,10 +526,6 @@ public class SettingComp extends Composite implements DurationInterface {
}
}
}
if (qpfList.getItemCount() > 0) {
qpfList.setSelection(0);
}
}
/**
@ -598,6 +604,55 @@ public class SettingComp extends Composite implements DurationInterface {
SWT.COLOR_WHITE));
attrLbl.setLayoutData(gd);
}
/**
* Set the dialog to reflect the saved configuration.
*/
private void setSettings() {
// Select the configured items, otherwise select the first
if (this.fftiSetting != null) {
// QPE
if (fftiSetting.getQpeSource().getDisplayNameList() == null ||
fftiSetting.getQpeSource().getDisplayNameList().isEmpty()) {
qpeList.setSelection(0);
} else {
// Only using the first one in the list to match A1
java.util.List<String> items = Arrays.asList(qpeList.getItems());
String name = fftiSetting.getQpeSource().getDisplayNameList().get(0);
int idx = items.indexOf(name);
qpeList.select(idx);
qpeList.showSelection();
}
// GUID
if (fftiSetting.getGuidSource().getDisplayNameList() == null ||
fftiSetting.getGuidSource().getDisplayNameList().isEmpty()) {
guidList.setSelection(0);
} else {
// Only using the first one in the list to match A1
java.util.List<String> items = Arrays.asList(guidList.getItems());
String name = fftiSetting.getGuidSource().getDisplayNameList().get(0);
int idx = items.indexOf(name);
guidList.select(idx);
guidList.showSelection();
}
// QPF
if (fftiSetting.getQpfSource().getDisplayNameList() == null ||
fftiSetting.getQpfSource().getDisplayNameList().isEmpty()) {
qpfList.setSelection(0);
} else {
// Only using the first one in the list to match A1
java.util.List<String> items = Arrays.asList(qpfList.getItems());
String name = fftiSetting.getQpfSource().getDisplayNameList().get(0);
int idx = items.indexOf(name);
qpfList.select(idx);
qpfList.showSelection();
}
}
}
private void accumAction(FFTIAttribute attribVal) {
// change attribute values

View file

@ -45,6 +45,22 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData.COLUMN_NA
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
/**
* FFMP GUI Config Object.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 01, 2012 14168 mpduff Add convenience methods for
* getting ColorCell and ReverseFilter
*
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class FFMPConfig {
private static FFMPConfig classInstance = new FFMPConfig();
@ -97,9 +113,9 @@ public class FFMPConfig {
private HashMap<ThreshColNames, ThresholdManager> threshMgrMap;
private HashMap<String, ThreshColNames> thresholdLookup;
private AttributesDlgData attrData = null;
private boolean reReadAttrData = false;
private FFMPConfig() {
@ -357,7 +373,7 @@ public class FFMPConfig {
return null;
}
public void createAttributesDlgData(String siteKey) {
ArrayList<FFMPTableColumnXML> columnData = ffmpCfgBasin
.getTableColumnData();
@ -371,7 +387,7 @@ public class FFMPConfig {
for (int i = 0; i < columns.length; i++) {
String column = columns[i];
String displayName = null;
for (FFMPTableColumnXML tcXML : columnData) {
if (column.contains("_")) {
String[] parts = column.split("_");
@ -380,10 +396,14 @@ public class FFMPConfig {
}
if (column.equalsIgnoreCase(tcXML.getColumnName())) {
boolean includedInTable = false;
if (column.equalsIgnoreCase(COLUMN_NAME.GUID.getColumnName()) ||
column.equalsIgnoreCase(COLUMN_NAME.RATIO.getColumnName()) ||
column.equalsIgnoreCase(COLUMN_NAME.DIFF.getColumnName())) {
if (ffmpCfgBasin.getIncludedGuids().contains(displayName)) {
if (column.equalsIgnoreCase(COLUMN_NAME.GUID
.getColumnName())
|| column.equalsIgnoreCase(COLUMN_NAME.RATIO
.getColumnName())
|| column.equalsIgnoreCase(COLUMN_NAME.DIFF
.getColumnName())) {
if (ffmpCfgBasin.getIncludedGuids().contains(
displayName)) {
includedInTable = true;
attrData.setGuidColumnIncluded(displayName,
includedInTable);
@ -397,8 +417,9 @@ public class FFMPConfig {
}
}
}
public AttributesDlgData getVisibleColumns(String siteKey, boolean reReadAttrData) {
public AttributesDlgData getVisibleColumns(String siteKey,
boolean reReadAttrData) {
this.reReadAttrData = reReadAttrData;
return getVisibleColumns(siteKey);
}
@ -413,33 +434,46 @@ public class FFMPConfig {
public void setVisibleColumns(AttributesDlgData attrData) {
this.attrData = attrData;
ArrayList<FFMPTableColumnXML> columnData = ffmpCfgBasin
.getTableColumnData();
for (FFMPTableColumnXML tcXML : columnData) {
if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.RATE.getColumnName())) {
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.RATE.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.NAME.getColumnName())) {
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.NAME.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.QPE.getColumnName())) {
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.QPE.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.QPF.getColumnName())) {
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.QPF.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.GUID.getColumnName())) {
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.GUID.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.RATIO.getColumnName())) {
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.RATIO.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.DIFF.getColumnName())) {
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.DIFF.getColumnName()));
if (tcXML.getColumnName().equalsIgnoreCase(
COLUMN_NAME.RATE.getColumnName())) {
tcXML.setDisplayedInTable(attrData
.isColumnVisible(COLUMN_NAME.RATE.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(
COLUMN_NAME.NAME.getColumnName())) {
tcXML.setDisplayedInTable(attrData
.isColumnVisible(COLUMN_NAME.NAME.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(
COLUMN_NAME.QPE.getColumnName())) {
tcXML.setDisplayedInTable(attrData
.isColumnVisible(COLUMN_NAME.QPE.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(
COLUMN_NAME.QPF.getColumnName())) {
tcXML.setDisplayedInTable(attrData
.isColumnVisible(COLUMN_NAME.QPF.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(
COLUMN_NAME.GUID.getColumnName())) {
tcXML.setDisplayedInTable(attrData
.isColumnVisible(COLUMN_NAME.GUID.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(
COLUMN_NAME.RATIO.getColumnName())) {
tcXML.setDisplayedInTable(attrData
.isColumnVisible(COLUMN_NAME.RATIO.getColumnName()));
} else if (tcXML.getColumnName().equalsIgnoreCase(
COLUMN_NAME.DIFF.getColumnName())) {
tcXML.setDisplayedInTable(attrData
.isColumnVisible(COLUMN_NAME.DIFF.getColumnName()));
}
}
HashMap<String, Boolean> guidanceMap = attrData.getGuidanceList();
String list = "";
boolean first = true;
for (String key: guidanceMap.keySet()) {
for (String key : guidanceMap.keySet()) {
if (first == false) {
list.concat(",");
}
@ -496,7 +530,8 @@ public class FFMPConfig {
* starts. If the column is not visible then default the sort column to be
* the name column.
*
* @param siteKey The siteKey being used
* @param siteKey
* The siteKey being used
* @return Column index.
*/
public int getStartSortIndex(String siteKey) {
@ -506,7 +541,7 @@ public class FFMPConfig {
FfmpTableConfig tableCfg = FfmpTableConfig.getInstance();
FFMPSourceConfigurationManager sourceConfigManager = FFMPSourceConfigurationManager
.getInstance();
FFMPRunXML runner = configManager.getRunner(monitor.getWfo());
ProductRunXML prodRunXml = runner.getProduct(siteKey);
String name = prodRunXml.getProductName();
@ -514,7 +549,7 @@ public class FFMPConfig {
ProductXML productXml = sourceConfigManager.getProduct(name);
ArrayList<String> guidTypes = productXml.getAvailableGuidanceTypes();
String guidRankSource = null;
if (guidTypes.size() > 1) {
String colSorted = ffmpCfgBasin.getColumnSorted();
@ -523,7 +558,7 @@ public class FFMPConfig {
guidRankSource = parts[1];
}
}
FfmpTableConfigData tableCfgData = tableCfg.getTableConfigData(siteKey);
String[] tableColumns = tableCfgData.getTableColumnKeys();
String sortedColName = ffmpCfgBasin.getColumnSorted();
@ -539,7 +574,7 @@ public class FFMPConfig {
column = parts[1];
guidType = parts[0];
}
if (column.equalsIgnoreCase(sortedColName)) {
if ((guidType != null) && (guidRankSource != null)) {
if (guidType.equalsIgnoreCase(guidRankSource)) {
@ -554,7 +589,7 @@ public class FFMPConfig {
}
}
}
return 0;
}
@ -562,10 +597,16 @@ public class FFMPConfig {
if (columnName.contains("_")) {
return true;
}
return false;
}
/**
* Get the filter value for this column.
*
* @param threshColName
* @return The filter value
*/
public double getFilterValue(ThreshColNames threshColName) {
ArrayList<FFMPTableColumnXML> columnData = ffmpCfgBasin
.getTableColumnData();
@ -575,6 +616,36 @@ public class FFMPConfig {
return data.getFilter();
}
/**
* Get the ColorCell value for this column.
*
* @param threshColName
* @return The ColorCell value
*/
public boolean isColorCell(ThreshColNames threshColName) {
ArrayList<FFMPTableColumnXML> columnData = ffmpCfgBasin
.getTableColumnData();
FFMPTableColumnXML data = columnData.get(threshColName.getColIndex());
return data.getColorCell();
}
/**
* Get the reverse filter value for this column.
*
* @param threshColName
* @return The Reverse Filter value
*/
public boolean isReverseFilter(ThreshColNames threshColName) {
ArrayList<FFMPTableColumnXML> columnData = ffmpCfgBasin
.getTableColumnData();
FFMPTableColumnXML data = columnData.get(threshColName.getColIndex());
return data.getReverseFilter();
}
/**
* @return the attrData
*/
@ -583,7 +654,8 @@ public class FFMPConfig {
}
/**
* @param attrData the attrData to set
* @param attrData
* the attrData to set
*/
public void setAttrData(AttributesDlgData attrData) {
this.attrData = attrData;
@ -597,12 +669,13 @@ public class FFMPConfig {
}
/**
* @param reReadAttrData the reReadAttrData to set
* @param reReadAttrData
* the reReadAttrData to set
*/
public void setReReadAttrData(boolean reReadAttrData) {
this.reReadAttrData = reReadAttrData;
}
public String getIncludedGuids() {
return ffmpCfgBasin.getIncludedGuids();
}

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig.ThreshColNames;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData.COLUMN_NAME;
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
/**
@ -67,17 +68,20 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
* Apr 7, 2009 lvenable Initial creation
* Mar 15,2012 DR 14406 gzhang Fixing QPF Column Title Missing
* Mar 20,2012 DR 14250 gzhang Eliminating column Missing values
* Aug 01, 2012 14168 mpduff Only allow filtering if ColorCell is true
* </pre>
*
* @author lvenable
* @version 1.0
*/
public abstract class FFMPTable extends Composite {
/** Default column width */
protected static final int DEFAULT_COLUMN_WIDTH = 95;//DR14406: old value: 75 too small
protected static final int DEFAULT_COLUMN_WIDTH = 95;// DR14406: old value:
// 75 too small
/** DR14406: For columns with more words */
/** DR14406: For columns with more words */
protected static final int EXTRA_COLUMN_WIDTH = 28;
protected String currentPfaf = null;
/**
@ -326,10 +330,10 @@ public abstract class FFMPTable extends Composite {
cols[j].setImage(null);
cols[j].setWidth(defaultColWidth);
}
// reset the tableIndex
tableIndex = -1;
/*
* Check of the column is sortable.
*/
@ -377,17 +381,36 @@ public abstract class FFMPTable extends Composite {
int sortColIndex = table.indexOf(sortedTableColumn);
boolean isAFilterCol = false;
ThreshColNames sortedThreshCol = null;
boolean reverseFilter = false;
double filterNum = Double.NaN;
String columnName = getColumnKeys()[sortColIndex];
String sortedColumnName = getColumnKeys()[sortColIndex];
FFMPConfigBasinXML ffmpCfgBasin = FFMPConfig.getInstance()
.getFFMPConfigData();
ArrayList<FFMPTableColumnXML> ffmpTableCols = ffmpCfgBasin
.getTableColumnData();
for (ThreshColNames threshColName : ThreshColNames.values()) {
if (sortedColumnName.contains(threshColName.name())) {
sortedThreshCol = threshColName;
break;
}
}
// Check if the sorted column is a column that will contain a filter.
if (!columnName.equalsIgnoreCase("NAME")) {
isAFilterCol = true;
for (ThreshColNames threshColName : ThreshColNames.values()) {
if (columnName.contains(threshColName.name())) {
sortedThreshCol = threshColName;
filterNum = ffmpConfig.getFilterValue(threshColName);
// Check the gui config to see if colorCell is true. If false then do
// not apply filter
for (FFMPTableColumnXML xml : ffmpTableCols) {
if (xml.getColumnName().contains(sortedThreshCol.name())) {
if (ffmpConfig.isColorCell(sortedThreshCol)) {
// Only filter if colorCell is true
isAFilterCol = true;
filterNum = ffmpConfig.getFilterValue(sortedThreshCol);
reverseFilter = ffmpConfig.isReverseFilter(sortedThreshCol);
}
break;
}
}
@ -414,38 +437,16 @@ public abstract class FFMPTable extends Composite {
extent.x);
/*
* Check if the sorted column is a filter column.
* Check if the data value is Not A Number.
*/
if (isAFilterCol == true) {
/*
* Check if the data value is Not A Number.
*/
float dataVal = cellData[sortColIndex]
.getValueAsFloat();
//DR 14250 fix: any value not a number will be omitted
if (/*sortedThreshCol.name().equalsIgnoreCase("RATIO") &&*/ Float.isNaN(dataVal)) {
continue;
}
// if (sortedThreshCol.name().equalsIgnoreCase("RATIO") == false) {
// If the data value is less/more than the filter value
// continue
// so we don't put the data in the table. Less for normal
// filtering,
// more for reverse filtering
ArrayList<FFMPTableColumnXML> tcList = ffmpConfig
.getFFMPConfigData().getTableColumnData();
boolean reverseFilter = false;
for (FFMPTableColumnXML tc : tcList) {
if (tc.getColumnName().equalsIgnoreCase(
sortedThreshCol.name())) {
reverseFilter = tc.getReverseFilter();
break;
}
}
// }
float dataVal = cellData[sortColIndex].getValueAsFloat();
// DR 14250 fix: any value not a number will be omitted
if (/* sortedThreshCol.name().equalsIgnoreCase("RATIO") && */Float
.isNaN(dataVal)) {
continue;
}
if (isAFilterCol) {
if (reverseFilter) {
if (dataVal > filterNum) {
continue;
@ -458,7 +459,7 @@ public abstract class FFMPTable extends Composite {
}
indexArray.add(t);
// Check to see if this is the selected row
if (rowData.getPfaf().equals(currentPfaf)) {
tableIndex = indexArray.indexOf(t);
@ -667,7 +668,10 @@ public abstract class FFMPTable extends Composite {
}
}
imageWidth = maxTextLength * textWidth + EXTRA_COLUMN_WIDTH;//DR14406: old value 6 too small
imageWidth = maxTextLength * textWidth + EXTRA_COLUMN_WIDTH;// DR14406:
// old value
// 6 too
// small
imageHeight = textHeight * 2;
gc.dispose();
@ -722,25 +726,34 @@ public abstract class FFMPTable extends Composite {
String[] tmpArray = colName.split("\n");
for (int j = 0; j < tmpArray.length; j++) {
// if (tmpArray[j].length() > maxTextLen) {
// maxTextLen = tmpArray[j].length();
// }
// }
// if (tmpArray[j].length() > maxTextLen) {
// maxTextLen = tmpArray[j].length();
// }
// }
xCoord = Math.round((imageWidth / 2)- (tmpArray[j].length() /*DR14406: old value: maxTextLen*/* textWidth / 2));
yCoord = j*(textHeight+1);//DR14406: old value 0 is only for the 1st line
gc.drawText(tmpArray[j], xCoord, yCoord, true);//DR14406: draw each line separately
xCoord = Math.round((imageWidth / 2)
- (tmpArray[j].length() /*
* DR14406: old value:
* maxTextLen
*/* textWidth / 2));
yCoord = j * (textHeight + 1);// DR14406: old value 0 is
// only for the 1st line
gc.drawText(tmpArray[j], xCoord, yCoord, true);// DR14406:
// draw each
// line
// separately
}
} else {
xCoord = Math.round((imageWidth / 2)
- (colName.length() * textWidth / 2));
yCoord = imageHeight / 2 - textHeight / 2 - 1;
gc.drawText(colName, xCoord, yCoord, true);//DR14406: draw text with a single line
gc.drawText(colName, xCoord, yCoord, true);// DR14406: draw text
// with a single line
}
// System.out.println("Column name = " + colName);
//DR14406: move the below text drawing code into the if-else blocks
//gc.drawText(colName, xCoord, yCoord, true);
// System.out.println("Column name = " + colName);
// DR14406: move the below text drawing code into the if-else blocks
// gc.drawText(colName, xCoord, yCoord, true);
gc.dispose();
tc.setImage(img);
@ -794,9 +807,10 @@ public abstract class FFMPTable extends Composite {
tCols[i].setWidth(table.getColumn(i).getWidth());
} else {
tCols[i].setWidth(defaultColWidth);
}
setQPFColName(tCols[i], col);//DR14406: set QPF title with quicker response
}
setQPFColName(tCols[i], col);// DR14406: set QPF title with
// quicker response
} else {
tCols[i].setWidth(0);
}
@ -876,27 +890,24 @@ public abstract class FFMPTable extends Composite {
*/
protected abstract int getColumnIndex(String sortCol);
/**
* DR14406 code: QPF column's name should be re-set
* when a user choose another type of QPF from the
* Attributes... button.
* DR14406 code: QPF column's name should be re-set when a user choose
* another type of QPF from the Attributes... button.
*
* See FfmpTableConfigData.setQpfType() with ColumnAttribData
*
* @param tCols: TableColumn
* @param col: Column name
* @param tCols
* : TableColumn
* @param col
* : Column name
*/
private void setQPFColName(TableColumn tCols, String col){
if(COLUMN_NAME.QPF.getColumnName().equalsIgnoreCase(col)){
setColumnImages();
tCols.setWidth(defaultColWidth+EXTRA_COLUMN_WIDTH);//38);
}
private void setQPFColName(TableColumn tCols, String col) {
if (COLUMN_NAME.QPF.getColumnName().equalsIgnoreCase(col)) {
setColumnImages();
tCols.setWidth(defaultColWidth + EXTRA_COLUMN_WIDTH);// 38);
}
}
}

View file

@ -84,6 +84,8 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPLoaderStatus;
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPResource;
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataLoader;
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataUpdate;
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
@ -96,6 +98,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 30, 2009 lvenable Initial creation
* Jul 31, 2012 14517 mpduff Fix map blanking on updates and table updates
* for rapid slider changes.
* Aug 01, 2012 14168 mpduff Only allow items into the Thresholds menu if
* ColorCell is true.
*
* </pre>
*
@ -110,7 +116,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
.getHandler(FfmpBasinTableDlg.class);
private List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>();
private MenuItem linkToFrameMI;
private MenuItem worstCaseMI;
@ -220,7 +226,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
private Composite tableComp;
private FFMPTableDataLoader dataRetrieveThread = null;
private boolean sweet = true;
public FfmpBasinTableDlg(Shell parent, FFMPTableData tData,
@ -496,10 +502,11 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
mi.setSelection(true);
break;
}
}
}
} else {
sourceMenuItems.get(0).setSelection(true);
ffmpConfig.getFFMPConfigData().setGuidSrc(sourceMenuItems.get(0).getText());
ffmpConfig.getFFMPConfigData().setGuidSrc(
sourceMenuItems.get(0).getText());
}
fireFieldChangedEvent(FFMPRecord.FIELDS.RATIO, false);
@ -561,7 +568,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
for (int i = 0; i < sourceMenuItems.size(); i++) {
String rdo = sourceMenuItems.get(i).getText();
if (rdo.equals(guidSrc)) {
ffmpConfig.getFFMPConfigData().setGuidSrc(guidSrc);
ffmpConfig.getFFMPConfigData().setGuidSrc(
guidSrc);
fireConfigUpdateEvent();
break;
}
@ -1023,18 +1031,21 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
// Loop over enum from config singleton to create menu items
for (ThreshColNames colName : ThreshColNames.values()) {
MenuItem mi = new MenuItem(popupMenu, SWT.NONE);
mi.setText(colName.name());
mi.setData(colName);
mi.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
MenuItem mi = (MenuItem) e.getSource();
ThreshColNames colName = (ThreshColNames) mi.getData();
if (ffmpConfig.isColorCell(colName)) {
// only add a menu item if colorCell is true
MenuItem mi = new MenuItem(popupMenu, SWT.NONE);
mi.setText(colName.name());
mi.setData(colName);
mi.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
MenuItem mi = (MenuItem) e.getSource();
ThreshColNames colName = (ThreshColNames) mi.getData();
displayThresholdsDialog(colName);
}
});
displayThresholdsDialog(colName);
}
});
}
}
// Set the pop-up menu as the pop-up for the shell
@ -1267,27 +1278,27 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
this.ffmpConfig.setAttrData(attrData);
this.ffmpTable.showHideTableColumns();
boolean changeSplit = false;
if (timeDurScale.split != ffmpConfig.isSplit()) {
changeSplit = true;
changeSplit = true;
}
timeDurScale.setSplit(ffmpConfig.isSplit());
updateTimeDurationLabel(timeDurScale.getSelectedHoursValue(),
ffmpConfig.isSplit());
if (updateData) {
if (updateData) {
if (changeSplit) {
fireTimeChangedEvent(timeDurScale.getSelectedHoursValue(),
ffmpConfig.isSplit(), true);
}
resource.clearTables();
resource.getDrawable(resource.getPaintTime()).setDirty(true);
FFMPMonitor.getInstance().fireMonitorEvent(
this.getClass().getName());
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();
@ -1330,7 +1341,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
ffmpListeners.remove(fl);
}
public void fireTimeChangedEvent(double newTime, boolean split, boolean override) {
public void fireTimeChangedEvent(double newTime, boolean split,
boolean override) {
FFMPRecord.FIELDS field = FFMPRecord.FIELDS.QPE;
@ -1381,7 +1393,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
if (waitCursor == true) {
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
}
FFMPFieldChangeEvent ffce = new FFMPFieldChangeEvent(field);
Iterator<FFMPListener> iter = ffmpListeners.iterator();
@ -1420,9 +1432,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
if (!selected) {
cwas.remove(cwa);
} else {
if (!cwas.contains(cwa)) {
cwas.add(cwa);
}
if (!cwas.contains(cwa)) {
cwas.add(cwa);
}
}
FFMPCWAChangeEvent fcce = new FFMPCWAChangeEvent(cwas);
@ -1659,23 +1671,22 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
* @param tData
*/
public void resetData(FFMPTableData tData) {
if (!ffmpTable.isDisposed()) {
this.mainTableData = tData;
//System.out.println("---" + tData.getTableRows().size());
// System.out.println("---" + tData.getTableRows().size());
ffmpTable.clearTableSelection();
//long time = System.currentTimeMillis();
// long time = System.currentTimeMillis();
ffmpTable
.setCenteredAggregationKey(resource.centeredAggregationKey);
ffmpTable.setTableData(mainTableData);
//long time1 = System.currentTimeMillis();
// long time1 = System.currentTimeMillis();
resetCursor();
shell.pack();
shell.redraw();
//System.out
// .println("Time to load Data into table " + (time1 - time));
// System.out
// .println("Time to load Data into table " + (time1 - time));
}
}
@ -1689,7 +1700,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|| allOnlySmallBasinsMI.getSelection()) {
groupLbl.setText(name);
}
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
fireScreenRecenterEvent(pfaf, 1);
}
@ -1776,7 +1787,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
*/
timeDurScale.setTimeDurationAndUpdate(ffmpConfig.getFFMPConfigData()
.getTimeFrame());
fireTimeChangedEvent(ffmpConfig.getFFMPConfigData().getTimeFrame(), false, false);
fireTimeChangedEvent(ffmpConfig.getFFMPConfigData().getTimeFrame(),
false, false);
/*
* Layer
@ -1847,7 +1859,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
}
fireAutoRefreshEvent(false);
/*
* CWAs
*
@ -2039,7 +2051,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
resource, basinTrendDlg, allowNewTableUpdate, sourceUpdate,
date, this);
synchronized (retrievalQueue) {
synchronized (retrievalQueue) {
if (dataRetrieveThread == null || dataRetrieveThread.isDone()) {
retrievalQueue.clear();
dataRetrieveThread = tableLoader;
@ -2050,7 +2062,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
}
}
}
/**
* Get the latest TableDataLoader and clear all previous loaders
*
@ -2058,7 +2070,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
*/
private FFMPTableDataLoader getLoader() {
synchronized (retrievalQueue) {
FFMPTableDataLoader loader = retrievalQueue.get(retrievalQueue.size() - 1);
FFMPTableDataLoader loader = retrievalQueue.get(retrievalQueue
.size() - 1);
retrievalQueue.clear();
return loader;
}
@ -2091,46 +2104,54 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
public void tableDataUpdateComplete(FFMPTableDataUpdate updateData) {
final FFMPTableDataUpdate fupdateData = updateData;
if (!this.isDisposed()) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
allowNewTableUpdate = fupdateData.isAllowNewTableUpdate();
sourceUpdate = fupdateData.isSourceUpdate();
if (fupdateData.getTableData() != null && sweet) {
resetData(fupdateData.getTableData());
}
if (fupdateData.isFireGraph()) {
fireGraphDataEvent(fupdateData.getGraphPfaf(), false,
fupdateData.getGraphTime());
}
setValidTime(fupdateData.getValidTime());
updateGapValueLabel(fupdateData.getGapValueLabel());
resetCursor();
sweet = true;
if (retrievalQueue.size() > 0) {
dataRetrieveThread = getLoader();
dataRetrieveThread.start();
}
processUpdate(fupdateData);
}
});
}
}
}
/**
* used to blank the group label when channging HUC
* while in an aggregate.
* Process the update
*/
private void processUpdate(FFMPTableDataUpdate fupdateData) {
allowNewTableUpdate = fupdateData.isAllowNewTableUpdate();
sourceUpdate = fupdateData.isSourceUpdate();
if (retrievalQueue.size() > 0) {
dataRetrieveThread = getLoader();
dataRetrieveThread.start();
return;
} else {
}
if (fupdateData.getTableData() != null && sweet) {
resetData(fupdateData.getTableData());
}
if (fupdateData.isFireGraph()) {
fireGraphDataEvent(fupdateData.getGraphPfaf(), false,
fupdateData.getGraphTime());
}
setValidTime(fupdateData.getValidTime());
updateGapValueLabel(fupdateData.getGapValueLabel());
resetCursor();
sweet = true;
}
/**
* used to blank the group label when channging HUC while in an aggregate.
*/
public void blankGroupLabel() {
if (groupLbl != null) {
groupLbl.setText("");
}
if (groupLbl != null) {
groupLbl.setText("");
}
}
}

View file

@ -149,6 +149,8 @@ import com.vividsolutions.jts.geom.Point;
* ------------ ---------- ----------- --------------------------
* 29 June, 2009 2521 dhladky Initial creation
* 11 Apr. 2012 DR 14522 gzhang Fixing invalid thread error.
* 31 July 2012 14517 mpduff Fix for blanking map on update.
*
* </pre>
* @author dhladky
* @version 1.0
@ -376,6 +378,9 @@ public class FFMPResource extends
/** force utility **/
private FFFGForceUtil forceUtil = null;
/** Restore Table flag */
private boolean restoreTable = false;
/**
* FFMP resource
*
@ -2441,7 +2446,8 @@ public class FFMPResource extends
}
if ((cwaBasins.size() == 0)
|| !req.extent.equals(drawable.getExt())
|| !phuc.equals(drawable.getHuc())) {
|| !phuc.equals(drawable.getHuc())
|| restoreTable) {
Envelope env = null;
try {
Envelope e = req.descriptor.pixelToWorld(req.extent,
@ -2466,7 +2472,7 @@ public class FFMPResource extends
templates, getSiteKey(), cwa, phuc);
for (Entry<Long, Envelope> entry : envMap.entrySet()) {
if (env.intersects(entry.getValue())) {
if (env.intersects(entry.getValue()) || env.contains(entry.getValue())) {
// add the individual basins
cwaBasins.add(entry.getKey());
}
@ -2766,6 +2772,10 @@ public class FFMPResource extends
}
}
if (restoreTable) {
restoreTable = false;
}
drawable.setTime(req.time);
if (lowestCenter != ZOOM.BASIN) {
drawable.setCenterAggrKey(centeredAggregationKey);
@ -3189,7 +3199,8 @@ public class FFMPResource extends
public void restoreTable() {
centeredAggregationKey = null;
centeredAggregatePfafList = null;
restoreTable = true;
lowestCenter = FFMPRecord.ZOOM.WFO;
getDescriptor().getRenderableDisplay().getExtent().reset();
zoom(1.0f);

View file

@ -41,7 +41,8 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpBasinTableDlg;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 13, 2011 dhladky Initial creation
* Oct 13, 2011 dhladky Initial creation.
* Jul 31, 2012 14517 mpduff Fix for Rapid slider changes
*
* </pre>
*
@ -142,11 +143,13 @@ public class FFMPTableDataLoader extends Thread {
// System.out
// .println(" Cache MISSSSSSSSSSSS!!!!!");
double origDrawTime = resource.getTime();
FFMPDataGenerator dg = new FFMPDataGenerator(
ffmp, resource);
tData = dg.generateFFMPData();
drawable.setTableData(iHuc, tData);
drawable.setDrawTime(resource.getTime());
drawable.setDrawTime(origDrawTime);
}
}
} catch (Exception e) {

View file

@ -67,9 +67,12 @@ import com.vividsolutions.jts.geom.Coordinate;
* replaced deprecated function calls
* replaced deprecated function calls
* Feb 10, 2011 8030 bkowal access to the plots ArrayList is now synchronized
* Feb 15, 2011 8036 bkowal magnification only affects the x-axis, wind bards, and
* Feb 15, 2011 8036 bkowal magnification only affects the x-axis, wind barbs, and
* the color bar.
*
* ======================================
* AWIPS2 DR Work
* 08/10/2012 1035 jkorman Changed number of 'staffs' from 12 to 13 and changed time
* display to match AWIPS I.
* </pre>
*
* @author dhladky
@ -81,6 +84,8 @@ public class ProfilerResource extends
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ProfilerResource.class);
private static final int NUM_PROFILE_STAFFS = 13;
/* Graphic target */
private IGraphicsTarget target = null;
@ -137,7 +142,7 @@ public class ProfilerResource extends
protected void initInternal(IGraphicsTarget target) throws VizException {
this.target = target;
dataTimes = new ArrayList<DataTime>();
incX = (ProfilerUtils.profilerRectangle.width / 12);
incX = (ProfilerUtils.profilerRectangle.width / NUM_PROFILE_STAFFS);
incYheight = ProfilerUtils.profilerRectangle.height / maxY;
@ -222,7 +227,7 @@ public class ProfilerResource extends
earliestTime = Math.min(earliestTime, validTime);
latestTime = Math.max(latestTime, validTime);
}
long earliestRequestTime = earliestTime - 12 * 3600000;
long earliestRequestTime = earliestTime - NUM_PROFILE_STAFFS * 3600000;
List<DataTime> requestTimes = new ArrayList<DataTime>();
for (DataTime time : resourceData.getAvailableTimes()) {
long validTime = time.getValidTime().getTimeInMillis();
@ -343,7 +348,7 @@ public class ProfilerResource extends
if (x < 0) {
continue;
}
if (x >= 12) {
if (x >= NUM_PROFILE_STAFFS) {
continue;
}
ArrayList<PlotObject> plots = entry.getValue();
@ -463,9 +468,10 @@ public class ProfilerResource extends
}
Calendar c = paintProps.getDataTime().getValidTime();
for (int i = 0; i < 12; i++) {
for (int i = 0; i < NUM_PROFILE_STAFFS; i++) {
String d = String.format("%1$tH:%1$tM", c);
// String d = String.format("%1$tH:%1$tM", c);
String d = String.format("%1$tH", c);
parameters.setText(d, ProfilerUtils.GRAPH_COLOR);
parameters.basics.x = ProfilerUtils.profilerRectangle.x
+ (i * incX) + (incX / 2);

View file

@ -213,6 +213,7 @@ import com.raytheon.viz.texteditor.msgs.IAviationObserver;
* 08/12/2011 10612 rferrel saveFile will now always push file back to the server.
* 11/29/2011 11612 rferrel Added getViewerTabList.
* 20JUL2012 14570 gzhang/zhao Highlight correct time groups in TAF Viewer
* 08AGU2012 15613 zhao Modified highlightTAF()
*
* </pre>
*
@ -3674,8 +3675,11 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable,
}
ResourceConfigMgr configMgr = ResourceConfigMgr.getInstance();
String taf = tafViewerStTxt.getText();
String taf = tafViewerStTxt.getText();
int offset = taf.indexOf("TAF");
if ( showHeadersChk.getSelection() ) {
offset = taf.indexOf("TAF", offset + 3);
}
try {
int end = taf.indexOf("TAF", offset + 3);
if (end > 0) {
@ -3705,7 +3709,7 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable,
for (String alertKey : tempoMap.keySet()) {
//System.out.println("2___alertKey: "+ alertKey);
for (String value : tempoMap.get(alertKey)) {
System.out.println("3___value: "+ value);
//System.out.println("3___value: "+ value);
str.setLength(1);
str.append(value);
int len = str.length();
@ -3745,6 +3749,11 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable,
str.setLength(len);
str.append("\n");
startIndex = taf.indexOf(str.toString());
if (startIndex < 0) {
str.setLength(len);
str.append("=");
startIndex = taf.indexOf(str.toString());
}
}
if (startIndex >= 0 /*within the same line*/&& startIndex < endIndex) {
@ -3983,11 +3992,11 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable,
// Only load the latest TAF, and assume it is the first one in
// the Viewer.
sb.append(TafUtil.safeFormatTaf(tafsInViewer[0], false));
String bbb = "";
String originalBbb = "";
String[] header = tafsInViewer[0].getWmoHeader().split(" ");
if (header.length > 3) {
bbb = header[3];
originalBbb = header[3];
}
ITafSiteConfig config = TafSiteConfigFactory.getInstance();
@ -3997,6 +4006,7 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable,
String stationId = siteData.wmo.split(" ")[1];
String issueTime = header[2];
String bbb = "";
if (type == null) {
// Do nothing
} else if (type == TafSettings.OPEN_AMD) {

View file

@ -63,7 +63,7 @@ import com.raytheon.viz.aviation.resource.ResourceConfigMgr.ResourceTag;
* and set default value for check hours.
* 04/28/2011 8065 rferrel Add flag to indicate display is current
* and implement data caching
* 20JUL2012 14570 gzhang/zhao Added "tempo" to alertMap
* 31JUL2012 14570 zhao Highlight Metar alert for case of 'cat'
*
* </pre>
*
@ -127,6 +127,7 @@ public class MetarViewer extends ViewerTab implements
*/
private static final HashMap<String, String[]> alertMap = new HashMap<String, String[]>();
static {
//alertMap.put("cat", new String[] { "<vsby>", "</vsby>", "<sky>", "</sky>" }); // 14570
alertMap.put("tempo", new String[] { "<vsby>", "</vsby>", "<wind>", "</wind>", "<wx>", "</wx>", "<sky>", "</sky>" }); // 14570
alertMap.put("vsby", new String[] { "<vsby>", "</vsby>" });
alertMap.put("wind", new String[] { "<wind>", "</wind>" });
@ -410,7 +411,12 @@ public class MetarViewer extends ViewerTab implements
if (alertMap != null && alertMap.size() > 0) {
for (String key : alertMap.keySet()) {
colorViewerAlert(key, configMgr);
if ( key.equals("cat") ) { // "cat" involves "visibility" and "sky condition"
colorViewerAlert("vsby", configMgr);
colorViewerAlert("sky", configMgr);
} else {
colorViewerAlert(key, configMgr);
}
}
}
}

View file

@ -63,7 +63,7 @@ import com.raytheon.viz.aviation.xml.MonitorCfg;
* May 13, 2011 8611 rferrel Added type to help determine blink state.
* Apr 30, 2012 14717 zhao Indicators turn gray when Metar is outdated
* 20JUL2012 14570 gzhang/zhao Modified for highlighting correct time groups in TAF Viewer
*
* 11AUG2012 14570 zhao Added 'cat' to alert_key_map
* </pre>
*
* @author lvenable
@ -126,7 +126,8 @@ public class SiteMonitor implements IRequestCompleteListener<Map<?, ?>> {
*/
private static final Map<String, String[]> ALERT_KEY_MAP = new HashMap<String, String[]>();
{
ALERT_KEY_MAP.put("tempo", new String[] { "wind", "vsby", "pcp", "obv", "vcnty", "sky" } ); // 14570
ALERT_KEY_MAP.put("cat", new String[] { "vsby", "sky" }); // 14570
//ALERT_KEY_MAP.put("tempo", new String[] { "wind", "vsby", "pcp", "obv", "vcnty", "sky" } ); // 14570
ALERT_KEY_MAP.put("vsby", new String[] { "vsby" });
ALERT_KEY_MAP.put("wind", new String[] { "wind" });
ALERT_KEY_MAP.put("wx", new String[] { "pcp", "obv", "vcnty" });

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Jul 6, 2010 5792 rferrel getLatestTafs now returns tafs
* sorted by issue date newest at
* the start of the array.
* 08AUG2012 15613 zhao Modified safeFormatTaf()
*
* </pre>
*
@ -161,12 +162,13 @@ public class TafUtil {
*/
public static String safeFormatTaf(TafRecord t, boolean includeHeader) {
StringBuilder sb = new StringBuilder();
if (includeHeader) {
sb.append(t.getWmoHeader());
sb.append(LINE_BREAK);
}
if (t != null) {
String[] text = t.getTafText().split("[\r\n]");
if (includeHeader) {
sb.append(t.getWmoHeader());
sb.append(LINE_BREAK);
sb.append("TAF").append(t.getStationId().substring(1,4)).append(LINE_BREAK);
}
String firstLine = text[0];
if (firstLine.startsWith("TAF AMD")
|| firstLine.startsWith("TAF COR")) {
@ -191,6 +193,7 @@ public class TafUtil {
sb.append(LINE_BREAK);
}
}
sb.append(LINE_BREAK);
}
return sb.toString();
}

View file

@ -68,6 +68,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 28 FEB 2008 938 lvenable Initial creation.
* 4/15/2009 1982 grichard Provide feedback when saving a working TAF.
* 12/08/2011 11745 rferrel Updated header time to transmission time.
* 08AUG2012 15613 zhao Determine proper BBB for transmission
*
* </pre>
*
@ -364,7 +365,7 @@ public class SendDialog extends CaveSWTDialog {
String siteWmoId = tabComp.getWmoId();
// WMO Site
String siteNode = null;
java.util.List<String> stationIds = new ArrayList<String>();
//java.util.List<String> stationIds = new ArrayList<String>();
ArrayList<String> tafs = new ArrayList<String>();
ArrayList<String> updatedTafs = new ArrayList<String>();
@ -402,6 +403,16 @@ public class SendDialog extends CaveSWTDialog {
// Site ID
String siteId = fourLetterId.substring(1);
/*
* If "AAX" or "CCX" or "RRX", determine BBB for transmission
*/
String xmitBbb = bbb;
if ( bbb.equals("AAX") || bbb.equals("CCX") || bbb.equals("RRX") ) {
String type = bbb.substring(0, 2);
xmitBbb = getXmitBbb( type, siteId);
}
// Update Header Time to transmission time.
tafText = TIMESTAMP_PATTERN.matcher(tafText).replaceFirst(
xmitTimestamp);
@ -418,7 +429,7 @@ public class SendDialog extends CaveSWTDialog {
}
TafQueueRecord record = new TafQueueRecord(forecasterId,
xmitTime.getTime(), tafText, bbb, siteId, siteWmoId,
xmitTime.getTime(), tafText, xmitBbb, siteId, siteWmoId,
siteNode, xmitTime.getTime());
records.add(record);
}
@ -455,4 +466,41 @@ public class SendDialog extends CaveSWTDialog {
tabComp.setTafSent(tafsQeueued);
shell.dispose();
}
@SuppressWarnings("unchecked")
private String getXmitBbb(String type, String siteId) {
try {
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.GET_LIST);
request.setState(TafQueueRecord.TafQueueState.SENT);
ServerResponse<java.util.List<String>> response = (ServerResponse<java.util.List<String>>) ThriftClient.sendRequest(request);
java.util.List<String> payload = response.getPayload();
String [] records = (String []) payload.toArray(new String[0]);
int numRecords = records.length;
for ( int i = numRecords-1; i >=0; i-- ) {
if ( records[i].contains(siteId) ) {
String [] texts = records[i].split("-");
String bbb = texts[texts.length-2];
if ( bbb.equals(" ") ) {
return type+"A";
}
if ( bbb.subSequence(0, 2).equals(type) ) {
char[] newX = new char[] { bbb.charAt(2) };
if ( newX[0] == 'X' ) {
newX[0] = 'A';
} else {
newX[0]++;
}
return type + new String( newX );
}
}
}
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return type + "A";
}
}

View file

@ -50,10 +50,6 @@
id="com.raytheon.uf.viz.d2d.core.feature"
version="0.0.0"/>
<includes
id="com.raytheon.uf.viz.alertviz.localization.feature"
version="0.0.0"/>
<includes
id="com.raytheon.viz.radar.feature"
version="0.0.0"/>

View file

@ -34,6 +34,7 @@ import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.util.SafeRunnable;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
@ -76,7 +77,6 @@ public class PythonPreferenceStore implements IPreferenceStore,
private String configName;
@SuppressWarnings("unchecked")
public PythonPreferenceStore(String configName) {
this.propertyChangeListeners = new ArrayList<IPropertyChangeListener>();
this.configurationChangeListeners = new ArrayList<IConfigurationChangeListener>();
@ -84,7 +84,8 @@ public class PythonPreferenceStore implements IPreferenceStore,
this.loadConfiguration(configName);
}
public void loadConfiguration(String configName) {
@SuppressWarnings("unchecked")
public void loadConfiguration(String configName) {
IPathManager pathMgr = PathManagerFactory.getPathManager();
String utilityDir = pathMgr.getFile(
pathMgr.getContext(LocalizationType.CAVE_STATIC,
@ -92,23 +93,14 @@ public class PythonPreferenceStore implements IPreferenceStore,
com.raytheon.uf.common.util.FileUtil.join("gfe", "utility"))
.getPath();
String configDir = com.raytheon.uf.common.util.FileUtil.join("gfe",
"userPython", "gfeConfig");
String baseDir = pathMgr.getFile(
pathMgr.getContext(LocalizationType.CAVE_STATIC,
LocalizationLevel.BASE), configDir).getPath();
String siteDir = pathMgr.getFile(
pathMgr.getContext(LocalizationType.CAVE_STATIC,
LocalizationLevel.SITE), configDir).getPath();
String userDir = pathMgr.getFile(
pathMgr.getContext(LocalizationType.CAVE_STATIC,
LocalizationLevel.USER), configDir).getPath();
String configPath = GfePyIncludeUtil.getConfigIncludePath();
String vtecPath = GfePyIncludeUtil.getVtecIncludePath();
PythonScript py = null;
try {
py = new PythonScript(
utilityDir + File.separator + "loadConfig.py",
PyUtil.buildJepIncludePath(userDir, siteDir, baseDir));
PyUtil.buildJepIncludePath(configPath, vtecPath));
} catch (JepException e) {
statusHandler.handle(Priority.CRITICAL,
"Unable to load GFE config", e);

View file

@ -121,10 +121,11 @@ public class ConfigCatalog extends AbstractScriptCatalog {
// Look for HideConfigFile = True in the file
PythonScript pscript = null;
try {
String includePath = PyUtil
.buildJepIncludePath(GfePyIncludeUtil
.getConfigIncludePath());
pscript = new PythonScript(file.getAbsolutePath(), includePath,
String configPath = GfePyIncludeUtil.getConfigIncludePath();
String vtecPath = GfePyIncludeUtil.getVtecIncludePath();
pscript = new PythonScript(file.getAbsolutePath(),
PyUtil.buildJepIncludePath(configPath, vtecPath),
getClass().getClassLoader(), preEvals);
Boolean scriptValue = (Boolean) pscript.execute(
"checkHideConfigFile", null);

View file

@ -19,8 +19,8 @@
**/
package com.raytheon.viz.gfe.core;
import com.raytheon.viz.gfe.core.time.SelectTimeRange;
import com.raytheon.viz.gfe.core.time.SelectTimeRange.Mode;
import com.raytheon.uf.common.dataplugin.gfe.time.SelectTimeRange;
import com.raytheon.uf.common.dataplugin.gfe.time.SelectTimeRange.Mode;
/**
* TODO Add Description
@ -31,6 +31,7 @@ import com.raytheon.viz.gfe.core.time.SelectTimeRange.Mode;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 3, 2009 randerso Initial creation
* Aug 1, 2012 #965 dgilling Change location of SelectTimeRange.
*
* </pre>
*

View file

@ -79,12 +79,12 @@ public abstract class AbstractGridData implements IGridData {
protected boolean iscCapable = true;
protected Date lastAccessTime;
protected long lastAccessTime;
protected Grid2DBit changedPoints;
protected AbstractGridData(Parm aParm, IGridSlice aSlice) {
this.lastAccessTime = SimulatedTime.getSystemTime().getTime();
this.lastAccessTime = System.currentTimeMillis();
this.parm = aParm;
this.gridSlice = aSlice;
// this.gridSlice.setUseCache(true);
@ -135,7 +135,7 @@ public abstract class AbstractGridData implements IGridData {
}
@Override
public Date getLastAccessTime() {
public long getLastAccessTime() {
return this.lastAccessTime;
}
@ -184,7 +184,7 @@ public abstract class AbstractGridData implements IGridData {
}
}
this.lastAccessTime = SimulatedTime.getSystemTime().getTime();
this.lastAccessTime = System.currentTimeMillis();
}
@Override
@ -458,7 +458,7 @@ public abstract class AbstractGridData implements IGridData {
public boolean applyDelta(Date time, float delta, boolean taper,
Grid2DBit pointsToChange) {
if (delta == 0.0) {
return false; // nothing to change
return true; // nothing to change
}
populate();
checkOkayForEdit();
@ -863,12 +863,12 @@ public abstract class AbstractGridData implements IGridData {
if (!this.isPopulated()) {
return;
}
String msg = "Depopulating " + getParm().getParmID() + " tr="
+ getGridTime();
statusHandler.handle(Priority.DEBUG, msg, new Exception("Debug: "
+ msg));
// String msg = "Depopulating " + getParm().getParmID() + " tr="
// + getGridTime();
// statusHandler.handle(Priority.DEBUG, msg, new Exception("Debug: "
// + msg));
this.lastAccessTime = SimulatedTime.getSystemTime().getTime();
this.lastAccessTime = 0;
setGridSliceDataToNull();
}
}

View file

@ -158,7 +158,7 @@ public interface IGridData extends Comparable<IGridData> {
*
* @return time the grid was last accessed
*/
public Date getLastAccessTime();
public long getLastAccessTime();
/**
* Returns the time range associated with this grid.

View file

@ -32,6 +32,8 @@ import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import com.raytheon.uf.common.dataplugin.gfe.time.SelectTimeRange;
import com.raytheon.uf.common.dataplugin.gfe.time.SelectTimeRange.Mode;
import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager;
@ -47,8 +49,6 @@ import com.raytheon.viz.gfe.GFEServerException;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.ISelectTimeRangeManager;
import com.raytheon.viz.gfe.core.msgs.SelectTimeRangesChangedMsg;
import com.raytheon.viz.gfe.core.time.SelectTimeRange;
import com.raytheon.viz.gfe.core.time.SelectTimeRange.Mode;
/**
* Class which manages the selection time range definitions that are stored on
@ -60,6 +60,7 @@ import com.raytheon.viz.gfe.core.time.SelectTimeRange.Mode;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 3, 2009 #3135 randerso Initial creation
* Aug 1, 2012 #965 dgilling Change location of SelectTimeRange.
*
* </pre>
*

View file

@ -708,10 +708,7 @@ public class DbParm extends Parm {
continue; // grid overlaps spatial editor time -- skip it
}
long lastAccess = 0;
if (grid.getLastAccessTime() != null) {
lastAccess = grid.getLastAccessTime().getTime();
}
long lastAccess = grid.getLastAccessTime();
long delta = now - lastAccess;
if (delta < milliseconds) {
@ -725,9 +722,10 @@ public class DbParm extends Parm {
// only deallocate unlocked grids
if (!locked) {
String msg = "Deallocating " + getParmID() + " tr=" + gTime;
statusHandler.handle(Priority.DEBUG, msg, new Exception(
"Debug: " + msg));
// String msg = "Deallocating " + getParmID() + " tr=" +
// gTime;
// statusHandler.handle(Priority.DEBUG, msg, new Exception(
// "Debug: " + msg));
grid.depopulate();
}

View file

@ -304,10 +304,7 @@ public class VCParm extends VParm implements IParmListChangedListener,
continue;
} // grid overlaps spatial editor time -- skip it
long lastAccess = 0;
if (grid.getLastAccessTime() != null) {
lastAccess = grid.getLastAccessTime().getTime();
}
long lastAccess = grid.getLastAccessTime();
long delta = now - lastAccess;
if (delta < milliseconds) {

View file

@ -158,77 +158,84 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
@Override
protected IStatus run(IProgressMonitor monitor) {
long t0 = System.currentTimeMillis();
final CountDownLatch latch = new CountDownLatch(
MAX_CONCURRENT_SAVES);
final AtomicBoolean allSuccessful = new AtomicBoolean(true);
// spawn separate jobs top save parms
for (int i = 0; i < MAX_CONCURRENT_SAVES; i++) {
new Job("Saving Parms") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
Parm parm = null;
while ((parm = parms.poll()) != null) {
String parmString = parm.getParmID()
.toString();
try {
// save data
if (statusHandler
.isPriorityEnabled(Priority.DEBUG)) {
statusHandler.handle(
Priority.DEBUG, "Save: "
+ parmString);
}
if (!parm.saveParameter(true)) {
allSuccessful.set(false);
}
} catch (Exception e) {
allSuccessful.set(false);
statusHandler.handle(Priority.ERROR,
"Error occurred saving parm "
+ parmString, e);
}
}
} finally {
latch.countDown();
}
return Status.OK_STATUS;
}
}.schedule();
}
try {
latch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
final CountDownLatch latch = new CountDownLatch(
MAX_CONCURRENT_SAVES);
if (!allSuccessful.get()) {
statusHandler.handle(Priority.PROBLEM,
"Some grids were not saved. See log for details.");
} else {
statusHandler.handle(Priority.DEBUG, "Save Complete");
}
// spawn separate jobs top save parms
for (int i = 0; i < MAX_CONCURRENT_SAVES; i++) {
new Job("Saving Parms") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
Parm parm = null;
while ((parm = parms.poll()) != null) {
String parmString = parm.getParmID()
.toString();
try {
// save data
if (statusHandler
.isPriorityEnabled(Priority.DEBUG)) {
statusHandler.handle(
Priority.DEBUG,
"Save: " + parmString);
}
if (!parm.saveParameter(true)) {
allSuccessful.set(false);
}
} catch (Throwable e) {
allSuccessful.set(false);
statusHandler.handle(
Priority.ERROR,
"Error occurred saving parm "
+ parmString, e);
}
}
} catch (Throwable e) {
allSuccessful.set(false);
statusHandler.handle(Priority.ERROR,
e.getLocalizedMessage(), e);
} finally {
latch.countDown();
}
VizApp.runAsync(new Runnable() {
@Override
public void run() {
AbstractSaveParameterDialog.this.getShell().setCursor(
origCursor);
AbstractSaveParameterDialog.this
.saveFinished(allSuccessful.get());
return Status.OK_STATUS;
}
}.schedule();
}
});
long t1 = System.currentTimeMillis();
System.out.println("GFE Save Forecast took: " + (t1 - t0)
+ " ms");
latch.await();
} catch (Throwable e) {
allSuccessful.set(false);
statusHandler.handle(Priority.PROBLEM,
e.getLocalizedMessage(), e);
} finally {
if (!allSuccessful.get()) {
statusHandler
.handle(Priority.PROBLEM,
"Some grids were not saved. See log for details.");
} else {
statusHandler.handle(Priority.DEBUG, "Save Complete");
}
VizApp.runAsync(new Runnable() {
@Override
public void run() {
AbstractSaveParameterDialog.this.getShell()
.setCursor(origCursor);
AbstractSaveParameterDialog.this
.saveFinished(allSuccessful.get());
}
});
long t1 = System.currentTimeMillis();
System.out.println("GFE Save Forecast took: " + (t1 - t0)
+ " ms");
}
return Status.OK_STATUS;
}
};
saveJob.setSystem(true);

View file

@ -811,7 +811,13 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements
@Override
public void referenceSetChanged(ReferenceData refSet,
ArrayList<Envelope> domains) {
activeChanged();
VizApp.runAsync(new Runnable() {
@Override
public void run() {
activeChanged();
}
});
}
/*
@ -822,7 +828,13 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements
*/
@Override
public void referenceSetIDChanged(ReferenceID refID) {
activeChanged();
VizApp.runAsync(new Runnable() {
@Override
public void run() {
activeChanged();
}
});
}
/*
@ -838,7 +850,13 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements
java.util.List<ReferenceID> deletions,
java.util.List<ReferenceID> changes) {
this.refreshRefsets();
VizApp.runAsync(new Runnable() {
@Override
public void run() {
refreshRefsets();
}
});
}
/*
@ -849,7 +867,13 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements
*/
@Override
public void editAreaGroupInvChanged() {
this.refreshRefsets();
VizApp.runAsync(new Runnable() {
@Override
public void run() {
refreshRefsets();
}
});
}
/*
@ -863,36 +887,35 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements
@Override
public void displayedParmListChanged(Parm[] parms, Parm[] deletions,
Parm[] additions) {
refreshParms();
}
private void activeChanged() {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
// Update display when active refset changes
ReferenceData refData = refSetMgr.getActiveRefSet();
// Fix active refset display
if (!activeDisplay.isDisposed()) {
activeDisplay.setText(getActiveRefDesc(refData));
}
// Enable/Disable Undo button
if (!undoButton.isDisposed()) {
undoButton.setEnabled(!refData.refType().equals(
RefType.NONE));
}
// Enable/Disable Convert to Location button
if (!convertButton.isDisposed()) {
convertButton.setEnabled(refData.isQuery());
}
refreshParms();
}
});
}
private void activeChanged() {
// Update display when active refset changes
ReferenceData refData = refSetMgr.getActiveRefSet();
// Fix active refset display
if (!activeDisplay.isDisposed()) {
activeDisplay.setText(getActiveRefDesc(refData));
}
// Enable/Disable Undo button
if (!undoButton.isDisposed()) {
undoButton.setEnabled(!refData.refType().equals(RefType.NONE));
}
// Enable/Disable Convert to Location button
if (!convertButton.isDisposed()) {
convertButton.setEnabled(refData.isQuery());
}
}
private String getActiveRefDesc(ReferenceData refData) {
String s = "";
@ -947,37 +970,29 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements
}
private void refreshRefsets() {
VizApp.runAsync(new Runnable() {
if (groupList.isDisposed() || editAreasList.isDisposed()) {
return;
}
@Override
public void run() {
if (groupList.isDisposed() || editAreasList.isDisposed()) {
return;
}
String[] groups = groupList.getSelection();
String[] groups = groupList.getSelection();
// Refresh the Group and Areas lists
java.util.List<String> availGroups = refSetMgr.getGroupInventory();
availGroups.add("Misc");
groupList.setItems(availGroups.toArray(new String[availGroups.size()]));
// Refresh the Group and Areas lists
java.util.List<String> availGroups = refSetMgr
.getGroupInventory();
availGroups.add("Misc");
groupList.setItems(availGroups.toArray(new String[availGroups
.size()]));
// update selection
groupList.deselectAll();
for (String group : groups) {
int index = groupList.indexOf(group);
if (index >= 0) {
groupList.select(index);
}
}
groups = groupList.getSelection();
String[] areaNames = getAreaNames(groups);
editAreasList.setItems(areaNames);
// update selection
groupList.deselectAll();
for (String group : groups) {
int index = groupList.indexOf(group);
if (index >= 0) {
groupList.select(index);
}
});
}
groups = groupList.getSelection();
String[] areaNames = getAreaNames(groups);
editAreasList.setItems(areaNames);
}
private void refreshParms() {

View file

@ -41,17 +41,15 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.dataplugin.gfe.time.SelectTimeRange;
import com.raytheon.uf.common.dataplugin.gfe.time.SelectTimeRange.Mode;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
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.SimulatedTime;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.GFEServerException;
import com.raytheon.viz.gfe.constants.StatusConstants;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.time.SelectTimeRange;
import com.raytheon.viz.gfe.core.time.SelectTimeRange.Mode;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
import com.raytheon.viz.ui.widgets.SpinScale;
@ -64,6 +62,7 @@ import com.raytheon.viz.ui.widgets.SpinScale;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 7, 2009 randerso Initial creation
* Aug 1, 2012 #965 dgilling Change location of SelectTimeRange.
*
* </pre>
*
@ -72,7 +71,8 @@ import com.raytheon.viz.ui.widgets.SpinScale;
*/
public class SaveDeleteSelectTRDialog extends CaveJFACEDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(SaveDeleteSelectTRDialog.class);
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(SaveDeleteSelectTRDialog.class);
private DataManager dataManager;

View file

@ -115,6 +115,8 @@ import com.vividsolutions.jts.geom.LineString;
* Jul 29, 2009 randerso Initial creation
* Jul 02, 2010 6285 mpduff Fixed contours to update after
* drawing and calculating new grid.
* Aug 08, 2012 #621 dgilling Fix ConcurrentModificationException
* in handling of renderables field.
*
* </pre>
*
@ -323,6 +325,9 @@ public class ContourTool extends AbstractFreeformTool implements
*/
private void replaceCLines(List<CLine> contours) {
clearRenderables();
List<IRenderable> renderables = new ArrayList<IRenderable>(
this.renderables);
renderables.add(freeformRenderable);
if (currentGrid != null) {
@ -353,26 +358,34 @@ public class ContourTool extends AbstractFreeformTool implements
}
}
renderables.add(renderable);
refresh();
}
this.renderables = renderables;
refresh();
}
private void disposeRenderables() {
List<IRenderable> renderables = new ArrayList<IRenderable>(
this.renderables);
for (IRenderable renderable : renderables) {
if (renderable instanceof JTSRenderable) {
((JTSRenderable) renderable).dispose();
}
}
renderables.clear();
this.renderables = renderables;
}
private void clearRenderables() {
List<IRenderable> renderables = new ArrayList<IRenderable>(
this.renderables);
for (IRenderable renderable : renderables) {
if (renderable instanceof JTSRenderable) {
((JTSRenderable) renderable).clear();
}
}
renderables.clear();
this.renderables = renderables;
}
private void initializeContourData(IGridData grid) {

View file

@ -647,13 +647,14 @@ public class GridBar implements IMessageClient, IParmInventoryChangedListener,
Rectangle rect = computeRect(dataTR);
gc.setFont(timeBlockSourceFont);
gc.setTextAntialias(SWT.OFF);
String s = truncateLabelToFit(gc, text, rect.width);
Point textSize = gc.stringExtent(s);
if (textSize.x < rect.width + DATA_BLOCK_HORIZONTAL_MARGIN) {
int xOffset = (rect.width - textSize.x) / 2;
int yOffset = (rect.height - textSize.y) / 2;
gc.drawString(s, rect.x + xOffset, rect.y + yOffset, false);
gc.drawString(s, rect.x + xOffset, rect.y + yOffset, true);
}
}

View file

@ -305,9 +305,13 @@ public class MultiPointResource extends
newDataMap.put(gage.getLid(), gage);
/* Create a small envelope around the point */
Coordinate p1 = new Coordinate(gage.getLon() + .03, gage.getLat() + .05);
Coordinate p2 = new Coordinate(gage.getLon() - .03, gage.getLat() - .05);
Envelope env = new Envelope(p1, p2);
double shiftHeightValue = getShiftHeight(gage);
double shiftWidthValue = getShiftWidth(gage);
PixelExtent pe = getPixelExtent(gage, shiftWidthValue,
shiftHeightValue);
Envelope env = this.descriptor.pixelToWorld(pe);
ArrayList<Object> data = new ArrayList<Object>();
data.add(xy);
data.add("GAGE: " + gage.getName() + " VALUE: " + gage.getGageValue());
@ -776,13 +780,11 @@ public class MultiPointResource extends
/**
* Get the x direction shift value.
*
* @param props
* The PaintProperties object
* @param gage
* The GageData object
* @return The number of pixels to shift in the x direction
*/
private double getShiftWidth(PaintProperties props, GageData gage) {
private double getShiftWidth(GageData gage) {
double shiftWidthValue = (gage.getX_shift() / 2.0)
/ screenToWorldWidthRatio;
@ -792,13 +794,11 @@ public class MultiPointResource extends
/**
* Get the y direction shift value.
*
* @param props
* The PaintProperties object
* @param gage
* The GageData object
* @return The number of pixels to shift in the y direction
*/
private double getShiftHeight(PaintProperties props, GageData gage) {
private double getShiftHeight(GageData gage) {
double shiftHeightValue = (gage.getY_shift() / 2.0)
/ screenToWorldHeightRatio;
@ -886,8 +886,8 @@ public class MultiPointResource extends
Coordinate c = gageData.getCoordinate();
double[] pixel = descriptor.worldToPixel(new double[] { c.x, c.y });
double shiftHeightValue = getShiftHeight(paintProps, gageData);
double shiftWidthValue = getShiftWidth(paintProps, gageData);
double shiftHeightValue = getShiftHeight(gageData);
double shiftWidthValue = getShiftWidth(gageData);
if (pixel != null) {
if (paintProps.getView().getExtent().contains(pixel)) {
@ -918,9 +918,8 @@ public class MultiPointResource extends
if (currentData != null) {
List<GageData> siteList = pdcManager.getObsReportList();
if ((siteList != null) && siteList.contains(currentData)) {
double shiftHeightValue = getShiftHeight(paintProps,
currentData);
double shiftWidthValue = getShiftWidth(paintProps, currentData);
double shiftHeightValue = getShiftHeight(currentData);
double shiftWidthValue = getShiftWidth(currentData);
PixelExtent pe = getPixelExtent(currentData, shiftWidthValue,
shiftHeightValue);

View file

@ -112,7 +112,10 @@ import com.raytheon.viz.hydrocommon.util.StnClassSyncUtil;
* without starting CAVE.
* 01 June 2011 9499 djingtao update openGraph()
* 23 Jul 2012 15180 mpduff Auto select the first group in the predefined group list
* 23 Jul 2012 15195 mpduff Fix Group graphing to use the date widgets.
* 23 Jul 2012 15195 mpduff Fix Group graphing to use the date widgets.
* 08 Aug 2012 570 mpduff Fix a Ctrl-F in Station list causing IndexOutOfBounds error.
* 08 Aug 2012 657 mpduff Fix error when selecting a TS while no selection has been made
* in the Station List.
* </pre>
*
* @author lvenable
@ -1161,10 +1164,12 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
tsOrderCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
String line = topDataList.getItem(topDataList
.getSelectionIndex());
String selectedLid = line.substring(0, line.indexOf(" "));
populateBottomList(selectedLid, tsOrderCbo.getSelectionIndex());
if (topDataList.getSelectionIndex() != -1) {
String line = topDataList.getItem(topDataList
.getSelectionIndex());
String selectedLid = line.substring(0, line.indexOf(" "));
populateBottomList(selectedLid, tsOrderCbo.getSelectionIndex());
}
}
});
tsOrderCbo.select(1);
@ -1207,9 +1212,11 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
topDataList.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
populateBottomList(
lidList.get(topDataList.getSelectionIndex()),
tsOrderCbo.getSelectionIndex());
if (topDataList.getSelectionIndex() != -1) {
populateBottomList(
lidList.get(topDataList.getSelectionIndex()),
tsOrderCbo.getSelectionIndex());
}
}
});
}

View file

@ -62,7 +62,8 @@ import com.raytheon.viz.hydrocommon.HydroConstants;
* Apr 18, 2011 8963 jpiatt Removed Left Scale call to scale manager.
* July 12 2011 9709 djingtao draw right Y axis for showPP is true. add new
* function adjust_pcymax()
* Aug. 10, 2011 10457 djingtao allow the red rubberband box to be drawn for setMissing in Edit
* Aug. 10, 2011 10457 djingtao allow the red rubberband box to be drawn for setMissing in Edit
* Jul. 24, 2012 15195 mpduff Fix x axis scales.
*
* </pre>
*
@ -492,7 +493,7 @@ public class TimeSeriesGraphCanvas extends Canvas {
}
// Check canvas width. if small then need to skip extra days
if (this.canvasWidth < 600) {
if (this.canvasWidth < 500) {
daysSkip++;
}
@ -537,8 +538,8 @@ public class TimeSeriesGraphCanvas extends Canvas {
/* ******************** */
/* Hour annotation */
/* ******************** */
dy = 10;
if (ndays < 4) {
dy = 10;
if (ndays < 8 && this.canvasWidth > 450) {
if (hour < 10) {
gc.drawText("0" + hour, x + leftBorder - dx, bottomBorder + 22);
} else {

View file

@ -1,45 +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.hydrocommon.ratingcurve;
/**
* Interface for getting the sort type for the rating curve data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
*24 Nov, 2008 1628 dhladky Initial creation
*
* </pre>
*
* @author dhladky
* @version 1.0
*/
public interface IRatingCurveSort
{
/**
* Get the sort type.
* @return The sort type.
*/
String getSortType();
}

View file

@ -167,4 +167,44 @@ public class RatingCurveData implements Comparable<RatingCurveData>
return ret;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits(discharge);
result = prime * result + (int) (temp ^ (temp >>> 32));
temp = Double.doubleToLongBits(stage);
result = prime * result + (int) (temp ^ (temp >>> 32));
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
RatingCurveData other = (RatingCurveData) obj;
if (Double.doubleToLongBits(discharge) != Double
.doubleToLongBits(other.discharge))
return false;
if (Double.doubleToLongBits(stage) != Double
.doubleToLongBits(other.stage))
return false;
return true;
}
}

View file

@ -38,12 +38,12 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
@ -77,7 +77,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* @author lvenable
* @version 1.0
*/
public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
public class RatingCurveDlg extends CaveSWTDialog {
/**
* Control font.
@ -229,18 +229,6 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
*/
private Button saveBtn;
/**
* Sort by enumeration.
*/
private enum sortBy {
Stage, Discharge
};
/**
* Sort by
*/
private sortBy sortKey;
/**
* Dialog lid information.
*/
@ -285,11 +273,6 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
*/
private RatingCurveShiftData selectedRatingShift = null;
/**
* The current selected rating point
*/
private RatingCurveData selectedRatingPoint = null;
/**
* Shift amount
*/
@ -488,91 +471,6 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
df.setMaximumFractionDigits(2);
df.setMaximumIntegerDigits(3);
shiftDataList.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
int index = 0; // default
RatingCurveShiftData rcsd = shiftData.get(index);
shiftValueTF.setText(df.format(rcsd.getValue()));
shiftDateTF.setText(sdf.format(rcsd.getDate().getTime()));
shiftActiveChk.setSelection(rcsd.isActive());
generateShiftList(rcsd);
setSelectedShift(rcsd);
if (shiftActiveChk.getSelection()) {
// redraw the canvas with shifted data
ratingCurveCanvas.updateCurveData(shiftCurveArray,
floodDbl, recordDbl, shiftAmount);
} else {
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
}
}
@Override
public void widgetSelected(SelectionEvent e) {
int index = shiftDataList.getSelectionIndex();
setSelectedShift(shiftData.get(index));
RatingCurveShiftData rcsd = shiftData.get(index);
shiftValueTF.setText(df.format(rcsd.getValue()));
shiftDateTF.setText(sdf.format(rcsd.getDate().getTime()));
shiftActiveChk.setSelection(rcsd.isActive());
if (shiftActiveChk.getSelection()) {
// redraw the canvas with shifted data
generateShiftList(getEditingShiftData());
ratingCurveCanvas.updateCurveData(shiftCurveArray,
floodDbl, recordDbl, shiftAmount);
} else {
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
}
}
});
shiftActiveChk.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// redraw the canvas with shifted data
if ((shiftData.size() > 0) && (shiftDataList != null)) {
int index = 0;
RatingCurveShiftData rcsd = shiftData.get(index);
if (rcsd.isActive()) {
ratingCurveCanvas.updateCurveData(shiftCurveArray,
floodDbl, recordDbl, shiftAmount);
shiftActiveChk.setSelection(rcsd.isActive());
} else {
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
}
}
}
@Override
public void widgetSelected(SelectionEvent e) {
// redraw the canvas with shifted data
if ((shiftData.size() > 0)
&& (shiftDataList.getSelectionIndex() != -1)) {
RatingCurveShiftData rcsd = shiftData.get(shiftDataList
.getSelectionIndex());
generateShiftList(rcsd);
if (rcsd.isActive()) {
ratingCurveCanvas.updateCurveData(shiftCurveArray,
floodDbl, recordDbl, shiftAmount);
} else {
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
}
}
}
});
// --------------------------------------------------------
// Create the Shift Remove & Update/Insert buttons
// --------------------------------------------------------
@ -589,25 +487,7 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
shftRemoveBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (getEditingShiftData() != null) {
int index = shiftDataList.getSelectionIndex();
removedCurveShifts.add(getEditingShiftData());
shiftData.remove(index);
selectedRatingShift = null;
shiftDataList.removeAll();
for (RatingCurveShiftData rcsd : shiftData) {
shiftDataList.add(getShiftListString(rcsd));
}
shiftDataList.redraw();
shiftValueTF.setText("");
shiftDateTF.setText("");
shiftActiveChk.setSelection(false);
// default without shifting
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
}
removeShift();
}
});
@ -656,25 +536,31 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
curveClearAllBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
// get rid of every point
removedPoints = noShiftCurveArray;
noShiftCurveArray.clear();
noShiftCurveDataList.removeAll();
noShiftCurveDataList.redraw();
MessageBox messageDialog = new MessageBox(shell, SWT.OK | SWT.CANCEL);
messageDialog.setText("Clear Confirmation");
messageDialog.setMessage("This will clear the list for " + lid + ".");
int response = messageDialog.open();
if (shiftCurveArray != null) {
shiftCurveArray.clear();
shiftCurveDataList.removeAll();
shiftCurveDataList.redraw();
if (response == SWT.OK) {
// get rid of every point
removedPoints = noShiftCurveArray;
noShiftCurveArray.clear();
noShiftCurveDataList.removeAll();
noShiftCurveDataList.redraw();
if (shiftCurveArray != null) {
shiftCurveArray.clear();
}
shiftCurveDataList.removeAll();
shiftCurveDataList.redraw();
stageTF.setText("");
dischargeTF.setText("");
selectedRatingShift = null;
ratingCurveCanvas.updateCurveData(noShiftCurveArray, floodDbl,
recordDbl, shiftAmount);
}
stageTF.setText("");
dischargeTF.setText("");
selectedRatingShift = null;
selectedRatingPoint = null;
ratingCurveCanvas.updateCurveData(noShiftCurveArray, floodDbl,
recordDbl, shiftAmount);
}
});
@ -686,20 +572,28 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
@Override
public void widgetSelected(SelectionEvent event) {
if (noShiftCurveDataList.getSelectionIndex() != -1) {
// get rid of this point
int index = noShiftCurveDataList.getSelectionIndex();
removedPoints.add(noShiftCurveArray.remove(index));
remakeRatingCurveDataList();
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
| SWT.OK | SWT.CANCEL);
mb.setText("Remove Base Rating Point Confirmation");
mb.setMessage("This will remove the highlighted pair.");
int response = mb.open();
stageTF.setText("");
dischargeTF.setText("");
if (response == SWT.OK) {
// get rid of this point
int index = noShiftCurveDataList.getSelectionIndex();
removedPoints.add(noShiftCurveArray.remove(index));
remakeRatingCurveDataList();
if (getEditingShiftData() != null) {
generateShiftList(getEditingShiftData());
}
stageTF.setText("");
dischargeTF.setText("");
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
if (getEditingShiftData() != null) {
generateShiftList(getEditingShiftData());
}
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
}
}
}
});
@ -712,47 +606,10 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
@Override
public void widgetSelected(SelectionEvent event) {
if (verifyDouble(stageTF) && verifyInt(dischargeTF)) {
RatingCurveData rcd = new RatingCurveData(new Double(
stageTF.getText().trim()), new Double(dischargeTF
.getText().trim()));
if (noShiftCurveDataList != null) {
if (getEditingCurveData() != null) {
int index = noShiftCurveDataList
.getSelectionIndex();
if (index > -1) {
noShiftCurveArray.remove(index);
noShiftCurveDataList.remove(index);
}
}
}
if (!addedPoints.contains(rcd)) {
addedPoints.add(rcd);
} else {
addedPoints.remove(rcd);
addedPoints.add(rcd);
}
noShiftCurveArray.add(rcd);
remakeRatingCurveDataList();
if (getEditingShiftData() != null) {
if (getEditingShiftData().isActive()) {
int index = shiftDataList.getSelectionIndex();
generateShiftList(shiftData.get(index));
ratingCurveCanvas.updateCurveData(shiftCurveArray,
floodDbl, recordDbl, shiftAmount);
} else {
ratingCurveCanvas.updateCurveData(
noShiftCurveArray, floodDbl, recordDbl,
shiftAmount);
}
} else {
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
}
insertBaseCurvePoint(rcd);
}
}
});
@ -769,6 +626,49 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
shiftValueTF.setEditable(true);
}
}
private void insertBaseCurvePoint(RatingCurveData rcd) {
if (!noShiftCurveArray.contains(rcd)) {
// Check for a matching stage value
RatingCurveData data = null;
for (RatingCurveData d: noShiftCurveArray) {
if (d.getStage() == rcd.getStage()) {
data = d;
break;
}
}
if (data != null) {
noShiftCurveArray.remove(data);
}
noShiftCurveArray.add(rcd);
if (!addedPoints.contains(rcd)) {
addedPoints.add(rcd);
} else {
addedPoints.remove(rcd);
addedPoints.add(rcd);
}
remakeRatingCurveDataList();
if (getEditingShiftData() != null) {
if (getEditingShiftData().isActive()) {
int index = shiftDataList.getSelectionIndex();
generateShiftList(shiftData.get(index));
ratingCurveCanvas.updateCurveData(shiftCurveArray,
floodDbl, recordDbl, shiftAmount);
} else {
ratingCurveCanvas.updateCurveData(
noShiftCurveArray, floodDbl, recordDbl,
shiftAmount);
}
} else {
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
}
}
}
/**
* Create the controls on the right side of the dialog.
@ -789,10 +689,17 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
createStageDischargeLabels(rightComp);
gd = new GridData(220, 400);
shiftCurveDataList = new List(rightComp, SWT.BORDER | SWT.SINGLE
| SWT.V_SCROLL);
shiftCurveDataList = new List(rightComp, SWT.BORDER | SWT.V_SCROLL);
shiftCurveDataList.setFont(controlFont);
shiftCurveDataList.setLayoutData(gd);
shiftCurveDataList.deselectAll();
shiftCurveDataList.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GRAY));
shiftCurveDataList.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
shiftCurveDataList.deselectAll();
}
});
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
ratingLbl = new Label(rightComp, SWT.CENTER);
@ -804,17 +711,6 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
| SWT.V_SCROLL);
noShiftCurveDataList.setFont(controlFont);
noShiftCurveDataList.setLayoutData(gd);
if (noShiftCurveArray != null) {
// populate the list
for (RatingCurveData curve : noShiftCurveArray) {
noShiftCurveDataList.add(curve.toString());
}
noShiftCurveDataList.setEnabled(true);
} else {
noShiftCurveDataList.setEnabled(false);
}
noShiftCurveDataList.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
@ -823,10 +719,27 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
stageTF.setText(String.format("%7.2f", data.getStage()));
dischargeTF
.setText(String.format("%7.1f", data.getDischarge()));
setSelectedCurveData(data);
}
});
if (noShiftCurveArray != null) {
// populate the list
RatingCurveShiftData currentShift = null;
if (shiftData != null && shiftData.size() > 0) {
if (shiftData.get(0).isActive()) {
currentShift = shiftData.get(0);
}
}
for (RatingCurveData curve : noShiftCurveArray) {
noShiftCurveDataList.add(curve.toString());
}
if (noShiftCurveDataList.getItemCount() > 0) {
noShiftCurveDataList.select(0);
generateShiftList(currentShift);
}
}
createStageDischargeTextFields(rightComp);
}
@ -987,7 +900,12 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
if (label != null) {
ratingLbl.setText(label);
}
if (noShiftCurveArray.size() > 0) {
RatingCurveData rcd = noShiftCurveArray.get(0);
this.stageTF.setText(String.valueOf(rcd.getStage()));
this.dischargeTF.setText(String.valueOf(rcd.getDischarge()));
}
}
/**
@ -1052,10 +970,10 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
* @param rcsd
*/
public void generateShiftList(RatingCurveShiftData rcsd) {
shiftCurveDataList.removeAll();
if (rcsd != null) {
shiftAmount = rcsd.getValue();
shiftCurveDataList.removeAll();
shiftCurveArray = new ArrayList<RatingCurveData>();
// remake the rating curve with shift data
@ -1067,38 +985,14 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
}
// redraw for the full effect
shiftCurveDataList.redraw();
} else {
// make the rating curve with no shift data
for (RatingCurveData curve : noShiftCurveArray) {
shiftCurveDataList.add(curve.toString());
}
}
}
@Override
public String getSortType() {
// TODO Auto-generated method stub
return "Stage";
}
/**
* Sort the crest data by stage value.
*/
public void sortByStage() {
sortKey = sortBy.Stage;
sortCurveData();
}
/**
* Sort the crest data by flow value.
*/
public void sortByDischarge() {
sortKey = sortBy.Discharge;
sortCurveData();
}
/**
* Sort the curve data.
*/
private void sortCurveData() {
Collections.sort(noShiftCurveArray);
}
/**
* Imports a rating curve
*
@ -1268,51 +1162,101 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
RatingCurveShiftData rcsd = new RatingCurveShiftData(lid, cal,
new Double(shiftValueTF.getText()), shiftActiveChk
.getSelection());
// remove old
if (shiftDataList != null) {
int index = shiftDataList.getSelectionIndex();
if (index != -1) {
if (rcsd.getDate().getTime().equals(
shiftData.get(index).getDate().getTime())) {
shiftDataList.remove(index);
shiftData.remove(index);
}
} else {
for (int i = 0; i < shiftData.size(); i++) {
RatingCurveShiftData data = shiftData.get(i);
if (data.getDate().getTime().equals(cal.getTime())) {
shiftData.remove(i);
shiftDataList.remove(i);
i--;
}
}
}
if (shiftData.size() > 0 && shiftData.contains(rcsd)) {
for (RatingCurveShiftData sd: shiftData) {
if (rcsd.toString().equals(sd.toString())) {
sd.setActive(rcsd.isActive());
sd.setDate(rcsd.getDate());
sd.setLid(rcsd.getLid());
sd.setValue(rcsd.getValue());
break;
}
}
} else {
shiftData.add(rcsd);
}
if (!addedCurveShifts.contains(rcsd)) {
addedCurveShifts.add(rcsd);
addedCurveShifts.add(rcsd);
} else {
addedCurveShifts.remove(rcsd);
addedCurveShifts.add(rcsd);
addedCurveShifts.remove(rcsd);
addedCurveShifts.add(rcsd);
}
shiftData.add(rcsd);
shiftDataList.add(getShiftListString(rcsd));
shiftDataList.redraw();
shiftDataList.removeAll();
Collections.sort(shiftData);
if (shiftActiveChk.getSelection()) {
generateShiftList(rcsd);
ratingCurveCanvas.updateCurveData(shiftCurveArray,
floodDbl, recordDbl, shiftAmount);
for (RatingCurveShiftData sd: shiftData) {
shiftDataList.add(getShiftListString(sd));
}
// Display the latest shift
RatingCurveShiftData currentShift = shiftData.get(0);
if (currentShift.isActive()) {
generateShiftList(currentShift);
ratingCurveCanvas.updateCurveData(shiftCurveArray,
floodDbl, recordDbl, currentShift.getValue());
} else {
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, 0);
}
}
shiftValueTF.setText("");
shiftDateTF.setText("");
shiftActiveChk.setSelection(false);
} catch (Exception e) {
e.printStackTrace();
}
}
private void removeShift() {
if (shiftDataList.getItemCount() > 0 && shiftDataList.getSelectionCount() > 0) {
MessageBox messageDialog = new MessageBox(shell, SWT.OK | SWT.CANCEL);
messageDialog.setText("Shift Remove Confirmation");
messageDialog.setMessage("This will remove the highlighted shift.");
int response = messageDialog.open();
if (response == SWT.OK) {
String selection = shiftDataList.getItem(shiftDataList.getSelectionIndex());
for (RatingCurveShiftData sd: shiftData) {
if (getShiftListString(sd).equals(selection)) {
removedCurveShifts.add(sd);
break;
}
}
shiftData.removeAll(removedCurveShifts);
shiftDataList.removeAll();
Collections.sort(shiftData);
for (RatingCurveShiftData rcsd : shiftData) {
shiftDataList.add(getShiftListString(rcsd));
}
shiftDataList.redraw();
if (shiftData.size() > 0) {
shiftAmount = shiftData.get(0).getValue();
} else {
shiftAmount = 0;
}
ratingCurveCanvas.updateCurveData(noShiftCurveArray,
floodDbl, recordDbl, shiftAmount);
if (shiftData.size() > 0) {
RatingCurveShiftData currentShift = shiftData.get(0);
if (currentShift.isActive()) {
generateShiftList(currentShift);
} else {
generateShiftList(null);
}
} else {
generateShiftList(null);
}
}
}
}
/**
* Verify validity of input
@ -1371,44 +1315,40 @@ public class RatingCurveDlg extends CaveSWTDialog implements IRatingCurveSort {
return selectedRatingShift;
}
/**
* set the current curve shift
*
* @param selectedRatingShift
*/
private void setSelectedShift(RatingCurveShiftData selectedRatingShift) {
this.selectedRatingShift = selectedRatingShift;
}
/**
* Get the editing curve data
*
* @return
*/
private RatingCurveData getEditingCurveData() {
return selectedRatingPoint;
}
/**
* Sets the selected curve data
*
* @param selectedRatingPoint
*/
private void setSelectedCurveData(RatingCurveData selectedRatingPoint) {
this.selectedRatingPoint = selectedRatingPoint;
}
/**
* update the noShiftCurveDataList
*/
private void remakeRatingCurveDataList() {
sortCurveData();
Collections.sort(noShiftCurveArray);
int index = noShiftCurveDataList.getSelectionIndex();
noShiftCurveDataList.removeAll();
shiftCurveDataList.removeAll();
for (RatingCurveData rcd : noShiftCurveArray) {
noShiftCurveDataList.add(rcd.toString());
}
noShiftCurveDataList.redraw();
if (shiftData.size() > 0) {
RatingCurveShiftData currentShift = shiftData.get(0);
if (currentShift.isActive()) {
generateShiftList(currentShift);
} else {
remakeRatingCurveDataList();
}
} else {
remakeRatingCurveDataList();
}
if (noShiftCurveDataList.getItemCount() > 0) {
if (index >= noShiftCurveDataList.getItemCount()) {
noShiftCurveDataList.select(noShiftCurveDataList.getItemCount() - 1);
} else if (index >= 0 && index < noShiftCurveArray.size()) {
noShiftCurveDataList.select(index);
} else {
noShiftCurveDataList.select(0);
}
noShiftCurveDataList.showSelection();
}
}
/**

View file

@ -40,7 +40,7 @@ import java.util.TimeZone;
* @version 1.0
*/
public class RatingCurveShiftData {
public class RatingCurveShiftData implements Comparable<RatingCurveShiftData> {
private String lid = null;
@ -90,18 +90,34 @@ public class RatingCurveShiftData {
public String getLid() {
return lid;
}
public void setLid(String lid) {
this.lid = lid;
}
public Calendar getDate() {
return date;
}
public void setDate(Calendar date) {
this.date = date;
}
public double getValue() {
return value;
}
public void setValue(double value) {
this.value = value;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
/**
* Get the date in a MM/DD/YYYY format.
@ -125,4 +141,16 @@ public class RatingCurveShiftData {
return sb.toString();
}
@Override
public int compareTo(RatingCurveShiftData o) {
if (this.date.getTime().equals(o.getDate().getTime())) {
return 0;
} else if (this.date.getTime().before(o.getDate().getTime())) {
return 1;
} else if (this.date.getTime().after(o.getDate().getTime())) {
return -1;
}
return 0;
}
}

View file

@ -54,6 +54,7 @@ import com.raytheon.viz.hydrocommon.whfslib.GagePPOptions.upd_action;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 5, 2008 1649 snaples Initial creation
* Aug 8, 2012 15271 snaples Updated hourly slot
*
* </pre>
*
@ -140,12 +141,6 @@ public final class GagePPWrite {
String obstime = sdf.format(dto);
GagePPOptions opts = options;
int hr = dt.get(Calendar.HOUR_OF_DAY);
if (hr == 0) {
hr = 24;
dt.add(Calendar.HOUR_OF_DAY, -1);
obstime = sdf.format(dt);
dto = dt.getTime();
}
int min = dt.get(Calendar.MINUTE);
char sixhroffset = get_offset_code(min);
char sixhrqc = 'M';
@ -212,7 +207,7 @@ public final class GagePPWrite {
pHourpp.setSixhroffset(String.valueOf(sixhr_offset));
pHourpp.setSixhrqc(String.valueOf(sixhr_qc));
set_hour_slot_value(pHourpp, hr, new_hourly_value);
set_6hour_slot_value(pHourpp, six + 1, pp_value);
set_6hour_slot_value(pHourpp, six, pp_value);
update_gage_rec(pHourpp);
}
@ -283,7 +278,7 @@ public final class GagePPWrite {
if (hpp.getSixhrqc() != null) {
old_six_qc = hpp.getSixhrqc().toCharArray();
}
Short sixval = get_6hour_slot_value(hpp, six + 1);
Short sixval = get_6hour_slot_value(hpp, six);
prev_sixhroff = old_sixhroffset[six];
prev_sixqc = old_six_qc[six];
@ -363,7 +358,7 @@ public final class GagePPWrite {
pHourpp.setSixhroffset(String.valueOf(sixhr_offset));
pHourpp.setSixhrqc(String.valueOf(six_hr_qc));
set_hour_slot_value(pHourpp, hr, hr_value);
set_6hour_slot_value(pHourpp, six + 1, six_hr_slot_val);
set_6hour_slot_value(pHourpp, six, six_hr_slot_val);
update_gage_rec(pHourpp);
}
}
@ -733,22 +728,22 @@ public final class GagePPWrite {
* the HourPC structure.
*/
switch (hour) {
case 1: /* 00z - 06z */
case 0: /* 00z - 06z */
precip_value = pHourlyPP.getSixhr06();
break;
case 2: /* 06z - 12z */
case 1: /* 06z - 12z */
precip_value = pHourlyPP.getSixhr12();
break;
case 3: /* 12z - 18z */
case 2: /* 12z - 18z */
precip_value = pHourlyPP.getSixhr18();
break;
case 4: /* 18z - 00z */
case 3: /* 18z - 00z */
precip_value = pHourlyPP.getSixhr24();
break;
@ -773,25 +768,25 @@ public final class GagePPWrite {
* the HourPC structure.
*/
switch (hour) {
case 1: /* 00z - 06z */
case 0: /* 00z - 06z */
precip_value = new Short((short) val);
pHourlyPP.setSixhr06(precip_value);
break;
case 2: /* 06z - 12z */
case 1: /* 06z - 12z */
precip_value = new Short((short) val);
pHourlyPP.setSixhr12(precip_value);
break;
case 3: /* 12z - 18z */
case 2: /* 12z - 18z */
precip_value = new Short((short) val);
pHourlyPP.setSixhr18(precip_value);
break;
case 4: /* 18z - 00z */
case 3: /* 18z - 00z */
precip_value = new Short((short) val);
pHourlyPP.setSixhr24(precip_value);
@ -927,7 +922,7 @@ public final class GagePPWrite {
precip_value = pHourlyPP.getHour23();
break;
case 24:
case 0:
precip_value = pHourlyPP.getHour24();
break;
@ -1068,12 +1063,13 @@ public final class GagePPWrite {
pHourly.setHour23(precip_value);
break;
case 24:
case 0:
precip_value = new Short((short) val);
pHourly.setHour24(precip_value);
break;
default:
precip_value = new Short((short) MISSING_PRECIP);
break;
}

View file

@ -104,6 +104,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* Dec 1, 2008 1748 snaples Added enum for Gage Color
* Aug 11, 2010 5733 jwang Removed Polygon Edit and Gages
* legend from MPE perspective
* Aug 8, 2012 15271 snaples Updated hourly slot
* </pre>
*
* @author randerso
@ -536,7 +537,7 @@ public class MPEDisplayManager {
clearMPEData();
try {
dm.readRadarData(newDate);
dm.readGageData(newDate);
dm.readGageData(newDate, newDate);
if (gageTableDlg != null) {
gageTableDlg.updateDate(newDate);

View file

@ -90,6 +90,7 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 8, 2011 mschenke Initial creation
* Aug 8, 2012 15271 snaples Updated hourly slot
*
* </pre>
*
@ -160,7 +161,7 @@ public class MPEGageResource extends AbstractMPEInputResource {
.getRenderableDisplay());
loadColors();
lastDate = displayMgr.getCurrentDate();
addPoints(MPEDataManager.getInstance().readGageData(lastDate));
addPoints(MPEDataManager.getInstance().readGageData(lastDate, lastDate));
}
@Override
@ -215,7 +216,7 @@ public class MPEGageResource extends AbstractMPEInputResource {
synchronized (mutex) {
if (curDate != null && curDate.equals(lastDate) == false) {
lastDate = curDate;
addPoints(MPEDataManager.getInstance().readGageData(lastDate));
addPoints(MPEDataManager.getInstance().readGageData(lastDate, lastDate));
}
}

View file

@ -54,6 +54,7 @@ import com.raytheon.viz.mpe.core.MPEDataManager.MPEGageData;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 30, 2008 snaples Initial creation
* Aug 8, 2012 15271 snaples Updated hourly slot
* </pre>
*
* @author snaples
@ -301,7 +302,7 @@ public class RegenHrFlds {
e.printStackTrace();
}
MPEDataManager.getInstance().readGageData(datetime);
MPEDataManager.getInstance().readGageData(datetime, datetime);
/* Read radar data */
MPEDataManager.getInstance().readRadarData(datetime);
MPEDataManager.getInstance().clearEditGages();

View file

@ -85,6 +85,9 @@ import com.vividsolutions.jts.geom.Envelope;
* 04/13/2009 2251 jsanchez Plot profilers.
* 05/12/2009 2338 jsanchez Updated resourceChanged. Registered units.
* 06/08/2009 2450 jsanchez Updated inpsect method to find closest plot.
* ======================================
* AWIPS2 DR Work
* 08/09/2012 1011 jkorman Added screenToWorldRatio calc to paintInternal.
*
*
* </pre>
@ -230,6 +233,8 @@ public class PlotResource extends
if (this.stationsToParse.size() > 0) {
this.updateRecords();
}
this.screenToWorldRatio = paintProps.getCanvasBounds().width
/ paintProps.getView().getExtent().getWidth();
boolean delayLoop = false;
DataTime thisFrameTime = this.displayedObsTime;
if (thisFrameTime != null) {
@ -847,14 +852,18 @@ public class PlotResource extends
ArrayList<Coordinate> availableCoord) {
double x1 = latlon.x;
double y1 = latlon.y;
double minDistance = MAX_SAMPLE_DISANCE;
// double minDistance = MAX_SAMPLE_DISANCE;
double minDistance = MAX_SAMPLE_DISANCE * MAX_SAMPLE_DISANCE;
int minIndex = -1;
for (int i = 0; i < availableCoord.size(); i++) {
Coordinate coord = availableCoord.get(i);
double x2 = coord.x;
double y2 = coord.y;
double d = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
// double d = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
double dx = x2 - x1;
double dy = y2 - y1;
double d = (dx * dx) + (dy * dy);
if (d < minDistance) {
minDistance = d;

View file

@ -24,8 +24,8 @@
<contribute xsi:type="titleItem" titleText="------ Z/V ------"
id="${icao}Terminal4panelZV" />
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev0} ${elev1} ${elev2} ${elev3}"
id="${icao}${elev0}${elev1}${elev2}${elev3}Terminal4panelZV"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev3} ${elev4}"
id="${icao}${elev1}${elev2}${elev3}${elev4}Terminal4panelZV"
suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
@ -38,17 +38,17 @@
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="" />
<substitute key="elevation1" value="${elev0}" />
<substitute key="elevation2" value="${elev1}" />
<substitute key="elevation3" value="${elev2}" />
<substitute key="elevation4" value="${elev3}" />
<substitute key="elevation1" value="${elev1}" />
<substitute key="elevation2" value="${elev2}" />
<substitute key="elevation3" value="${elev3}" />
<substitute key="elevation4" value="${elev4}" />
</contribute>
<contribute xsi:type="separator" id="below${icao}Terminal4panelZSRM8" />
<contribute xsi:type="titleItem" titleText="------ Z/SRM8 ------"
id="${icao}Terminal4panelZSRM8" />
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev0} ${elev1} ${elev2} ${elev3}"
id="${icao}{elev0}${elev1}${elev2}${elev3}Terminal4panelZSRM8"
file="bundles/DefaultRadarFourPanelBlendedBestRes.xml" menuText="${elev1} ${elev2} ${elev3} ${elev4}"
id="${icao}${elev1}${elev2}${elev3}${elev4}Terminal4panelZSRM8"
suppressErrors="${suppressErrors3}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
@ -61,10 +61,10 @@
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="SRM8" />
<substitute key="elevation1" value="${elev0}" />
<substitute key="elevation2" value="${elev1}" />
<substitute key="elevation3" value="${elev2}" />
<substitute key="elevation4" value="${elev3}" />
<substitute key="elevation1" value="${elev1}" />
<substitute key="elevation2" value="${elev2}" />
<substitute key="elevation3" value="${elev3}" />
<substitute key="elevation4" value="${elev4}" />
</contribute>
</contribute>
</menuTemplate>
</menuTemplate>

View file

@ -29,17 +29,7 @@
<substitute key="product2" value="187"/>
<substitute key="product3" value=""/>
<substitute key="product4" value=""/>
<substitute key="elevation" value="0.0--360.0" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev0} Refl" id="${icao}Terminal${elev0}Refl" suppressErrors="${suppressErrors0}">
<substitute key="icao" value="${icao}" />
<substitute key="mode" value=""/>
<substitute key="product1" value="180"/>
<substitute key="product2" value="181"/>
<substitute key="product3" value=""/>
<substitute key="product4" value=""/>
<substitute key="elevation" value="${elev0}--${elev0}" />
<substitute key="elevation" value="0.5--360.0" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev1} Refl" id="${icao}Terminal${elev1}Refl" suppressErrors="${suppressErrors1}">
@ -289,20 +279,10 @@
<substitute key="product2" value="181"/>
<substitute key="product3" value=""/>
<substitute key="product4" value=""/>
<substitute key="elevation" value="0.0--360.0" />
<substitute key="elevation" value="0.5--360.0" />
</contribute>
</contribute>
<contribute xsi:type="subMenu" menuText="${icao} Vel" id="${icao}TerminalVel">
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev0} Vel" id="${icao}Terminal${elev0}Vel" suppressErrors="${suppressErrors0}">
<substitute key="icao" value="${icao}" />
<substitute key="mode" value=""/>
<substitute key="product1" value="182"/>
<substitute key="product2" value="183"/>
<substitute key="product3" value=""/>
<substitute key="product4" value=""/>
<substitute key="elevation" value="${elev0}--${elev0}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev1} Vel" id="${icao}Terminal${elev1}Vel" suppressErrors="${suppressErrors1}">
<substitute key="icao" value="${icao}" />
@ -552,7 +532,7 @@
<substitute key="product2" value="183"/>
<substitute key="product3" value=""/>
<substitute key="product4" value=""/>
<substitute key="elevation" value="0.0--360.0" />
<substitute key="elevation" value="0.5--360.0" />
</contribute>
</contribute>
</menuTemplate>
</menuTemplate>

View file

@ -21,22 +21,6 @@
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="titleItem" titleText="------ Z/SRM8 Combo ------"
id="${icao}TerminalZSRM8Combo" />
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarBlendedBestRes.xml" menuText="${elev0} Z/SRM8"
id="${icao}${elev0}ZSRM8" suppressErrors="${suppressErrors0}" >
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
<substitute key="product2" value="181" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode1" value="" />
<substitute key="product5" value="182" />
<substitute key="product6" value="" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="SRM8" />
<substitute key="elevation" value="${elev0}--${elev0}" />
</contribute>
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarBlendedBestRes.xml" menuText="${elev1} Z/SRM8"
id="${icao}${elev1}ZSRM8" suppressErrors="${suppressErrors1}">
@ -443,22 +427,6 @@
<contribute xsi:type="separator" id="BelowTerminalZSRM8Tilts" />
<contribute xsi:type="titleItem" titleText="------ Z/V Combo ------"
id="${icao}TerminallZVCombo" />
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarBlendedBestRes.xml" menuText="${elev0} Z/V"
id="${icao}${elev0}ZV" suppressErrors="${suppressErrors0}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="180" />
<substitute key="product2" value="181" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode1" value="" />
<substitute key="product5" value="182" />
<substitute key="product6" value="183" />
<substitute key="product7" value="" />
<substitute key="product8" value="" />
<substitute key="mode2" value="" />
<substitute key="elevation" value="${elev0}--${elev0}" />
</contribute>
<contribute xsi:type="bundleItem"
file="bundles/DefaultRadarBlendedBestRes.xml" menuText="${elev1} Z/V"
id="${icao}${elev1}ZV" suppressErrors="${suppressErrors1}">
@ -862,4 +830,4 @@
</contribute>
</contribute>
<contribute xsi:type="separator" id="BelowTerminalZVTilts" />
</menuTemplate>
</menuTemplate>

View file

@ -21,16 +21,6 @@
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="subMenu" menuText="${icao} High Res (8-bit) SRM8"
id="${icao}TerminalHighResTerminal8bitSRM">
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev0} SRM8" id="${icao}${elev0}TerminalTerminal8bitSRM" suppressErrors="${suppressErrors0}">
<substitute key="icao" value="${icao}" />
<substitute key="product1" value="182" />
<substitute key="product2" value="" />
<substitute key="product3" value="" />
<substitute key="product4" value="" />
<substitute key="mode" value="SRM8" />
<substitute key="elevation" value="${elev0}--${elev0}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadarBestRes.xml"
menuText="${elev1} SRM8" id="${icao}${elev1}Terminal8bitSRM" suppressErrors="${suppressErrors1}">
<substitute key="icao" value="${icao}" />
@ -284,12 +274,6 @@
</contribute>
<contribute xsi:type="subMenu" menuText="${icao} Spectrum Width"
id="${icao}TerminalSpectrumWidth">
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
menuText="${elev0} Spec Width" id="${icao}Terminal${elev0}SpecWidth" suppressErrors="${suppressErrors0}">
<substitute key="icao" value="${icao}" />
<substitute key="product" value="185" />
<substitute key="elevation" value="${elev0}--${elev0}" />
</contribute>
<contribute xsi:type="bundleItem" file="bundles/DefaultRadar.xml"
menuText="${elev1} Spec Width" id="${icao}Terminal${elev1}SpecWidth" suppressErrors="${suppressErrors1}">
<substitute key="icao" value="${icao}" />
@ -435,4 +419,4 @@
<substitute key="elevation" value="${elev24}--${elev24}" />
</contribute>
</contribute>
</menuTemplate>
</menuTemplate>

View file

@ -281,6 +281,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* 06/19/2012 14975 D.Friedman Prevent zeroed-out WMO header times.
* 18JUL2012 14457 rferrel Add mouse listener to clear site's update obs when clicked on.
* 25JUL2012 14459 rferrel Strip WMH headers when getting all METARs.
* 13AUG2012 14613 M.Gamazaychikov Ensured the WMO and MND header times are the same.
* </pre>
*
* @author lvenable
@ -4603,10 +4604,16 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
}
boolean successful = false;
// Convert the text in the text editor to uppercase
String currentDate = getCurrentDate();
/*
* DR14613 - string currectDate is derived from Date now
* ensuring the same time in WMO heading and in the
* MND heading.
*/
Date now = SimulatedTime.getSystemTime().getTime();
String currentDate = getCurrentDate(now);
TextDisplayModel tdmInst = TextDisplayModel.getInstance();
// Convert the text in the text editor to uppercase
if (!isAutoSave) {
if (!verifyRequiredFields()) {
return false;
@ -4642,14 +4649,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
VtecObject vtecObj = VtecUtil.parseMessage(productText);
if (warnGenFlag) {
// TODO: Pass in some flavor of currentDate to use to set
// the
// times. Currently roll over to the next minute between
// getting
// currentDate and getting the times in this method will
// cause
// them to be different.
productText = updateVtecTimes(productText, vtecObj);
/*
* DR14613 - string currectDate is derived from Date now
* ensuring the same time in WMO heading and in the
* MND heading.
*/
productText = updateVtecTimes(productText, vtecObj, now);
productText = updateHeaderTimes(productText, now);
// Update editor so the proper send times are displayed.
String[] b = productText.split("\n");
StringBuilder body = new StringBuilder();
@ -5110,19 +5116,28 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
headerTF.setText("");
}
private String getCurrentDate() {
Date now = SimulatedTime.getSystemTime().getTime();
private String getCurrentDate(Date now) {
/*
* DR14613 - pass the Date now as an argument
*/
SimpleDateFormat formatter = new SimpleDateFormat("ddHHmm");
formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
return (formatter.format(now));
}
private String updateVtecTimes(String product, VtecObject vtecObj) {
/**
* Update the VTEC time using the Date now.
*
* @param product
* @param vtecObj
* @param now
* @return
*/
private String updateVtecTimes(String product, VtecObject vtecObj, Date now) {
if (vtecObj == null || vtecObj.getAction().equals("COR")) {
return product;
}
Date now = SimulatedTime.getSystemTime().getTime();
// Update the vtec start time
if (vtecObj.getAction().equals("NEW")) {
SimpleDateFormat vtecFormatter = new SimpleDateFormat(
@ -5131,9 +5146,20 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
product = product.replace(
vtecFormatter.format(vtecObj.getStartTime().getTime()),
vtecFormatter.format(now));
}
}
// Update the header time
return product;
}
/**
* Update the MND header time using the Date now.
*
* @param product
* @param now
* @return
*/
private String updateHeaderTimes(String product, Date now) {
// Update the header time
Matcher m = datePtrn.matcher(product);
if (m.find()) {
SimpleDateFormat headerFormat = new SimpleDateFormat(
@ -5144,9 +5170,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
product = product.replace(m.group(1), headerFormat.format(now)
.toUpperCase());
}
return product;
return product;
}
public void setCurrentWmoId(String wmoId) {
TextDisplayModel.getInstance().setWmoId(token, wmoId);

View file

@ -1234,7 +1234,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
((oldWarningPolygon.intersection(warningPolygon)
.getArea() / oldWarningArea.getArea()) * 100))
.intValue();
if (oldWarningPolygon.intersects(warningPolygon) == false
if (GeometryUtil.intersects(oldWarningPolygon, warningPolygon) == false
&& !state.isMarked()) {
// Snap back to polygon
state.setWarningPolygon(localToLatLon((Polygon) oldWarningPolygon));
@ -1873,7 +1873,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
IDisplayPaneContainer container = getResourceContainer();
Coordinate[] coords = warningPolygon.getExteriorRing().getCoordinates();
if (vertexId >= coords.length) {
if (vertexId >= coords.length || vertexId < 0) {
return vertexId;
}
int rval = vertexId;

View file

@ -126,7 +126,6 @@ public class WarngenUIManager extends InputAdapter {
@Override
public boolean handleMouseDown(int x, int y, int button) {
warngenLayer.showDialog(true);
menuMove = false;
lastMouseX = x;
lastMouseY = y;
if (!handleInput || warngenLayer.isBoxEditable() == false) {
@ -135,7 +134,7 @@ public class WarngenUIManager extends InputAdapter {
boolean rval = false;
if (button == 1 && moveType != null) {
return true;
} else if (button == 2) {
} else if (button == 2 && menuMove == false) {
/** Try to add vertex */
new AddVertexAction().run();
if (pointCreated) {
@ -202,8 +201,7 @@ public class WarngenUIManager extends InputAdapter {
return super.handleMouseUp(x, y, mouseButton);
}
if (mouseButton == 3) {
if (mouseButton == 3 && menuMove == false) {
Coordinate c = container.translateClick(x, y);
WarngenUIState state = warngenLayer.getWarngenState();
boolean geomsEqual = true;
@ -245,13 +243,14 @@ public class WarngenUIManager extends InputAdapter {
boolean rval = false;
if (moveType != null || pointDeleted || pointCreated) {
if (moveType != null || pointDeleted || pointCreated || menuMove) {
try {
if (moveType == MoveType.ALL_POINTS) {
WarngenUIState state = warngenLayer.getWarngenState();
Coordinate[] coordinates = state.getWarningPolygon().getCoordinates();
Coordinate[] coordinates = state.getWarningPolygon()
.getCoordinates();
PolygonUtil.truncate(coordinates, 2);
GeometryFactory gf = new GeometryFactory();
LinearRing lr = gf.createLinearRing(coordinates);
state.setWarningPolygon(gf.createPolygon(lr, null));
@ -265,15 +264,13 @@ public class WarngenUIManager extends InputAdapter {
}
pointDeleted = false;
pointCreated = false;
menuMove = false;
return rval;
}
@Override
public boolean handleMouseMove(int x, int y) {
if (menuMove) {
movePointIndex = StormTrackUIManager.getCoordinateIndex(
warngenLayer, warngenLayer.getPolygon().getCoordinates(),
new Coordinate(lastMouseX, lastMouseY));
move(x, y);
warngenLayer.getWarngenState().geometryChanged = true;
return true;
@ -426,7 +423,8 @@ public class WarngenUIManager extends InputAdapter {
for (int i = 0; i < coords.length; ++i) {
Coordinate toAdd = (Coordinate) coords[i].clone();
if (!toAdd.equals(toRemove) || alreadyRemoved.contains(toAdd)) {
if (!toAdd.equals(toRemove)
|| alreadyRemoved.contains(toAdd)) {
coordList.add(toAdd);
} else {
alreadyRemoved.add(toAdd);
@ -441,11 +439,11 @@ public class WarngenUIManager extends InputAdapter {
LinearRing lr = gf.createLinearRing(coordList
.toArray(new Coordinate[coordList.size()]));
Polygon newPoly = gf.createPolygon(lr, null);
if (newPoly.isValid() == false) {
return;
}
warngenLayer.getWarngenState().setWarningPolygon(newPoly);
try {
warngenLayer.updateWarnedAreas(true, true);
@ -498,6 +496,9 @@ public class WarngenUIManager extends InputAdapter {
@Override
public void run() {
moveType = MoveType.SINGLE_POINT;
movePointIndex = StormTrackUIManager.getCoordinateIndex(
warngenLayer, warngenLayer.getPolygon().getCoordinates(),
new Coordinate(lastMouseX, lastMouseY));
menuMove = true;
}
@ -511,6 +512,9 @@ public class WarngenUIManager extends InputAdapter {
@Override
public void run() {
moveType = MoveType.ALL_POINTS;
movePointIndex = StormTrackUIManager.getCoordinateIndex(
warngenLayer, warngenLayer.getPolygon().getCoordinates(),
new Coordinate(lastMouseX, lastMouseY));
menuMove = true;
}

View file

@ -29,14 +29,15 @@ import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.util.Properties;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -100,7 +101,6 @@ import com.raytheon.viz.warngen.util.WeatherAdvisoryWatch;
import com.raytheon.viz.warnings.DateUtil;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryCollection;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
import com.vividsolutions.jts.io.WKTReader;
@ -122,6 +122,7 @@ import com.vividsolutions.jts.io.WKTReader;
* Jun 15, 2012 15043 Qinglu Lin Added duration to context.
* Jul 16, 2012 15091 Qinglu Lin Compute intersection area, which is used for prevent 2nd timezone
* from appearing in 2nd and 3rd bullets when not necessary.
* Aug 13, 2012 14493 Qinglu Lin Handled MND time, event time, and TML time specially for COR to NEW.
*
* </pre>
*
@ -181,6 +182,7 @@ public class TemplateRunner {
.getFrameTimes();
Date eventTime = datatimes != null && datatimes.length > 0 ? datatimes[datatimes.length - 1]
.getRefTimeAsCalendar().getTime() : startTime;
Date simulatedTime = SimulatedTime.getSystemTime().getTime();
WarngenConfiguration config = warngenLayer.getConfiguration();
StormTrackState stormTrackState = warngenLayer.getStormTrackState();
@ -236,6 +238,8 @@ public class TemplateRunner {
AffectedAreas[] areas = null;
AffectedAreas[] cancelareas = null;
Map<String, Object> intersectAreas = null;
Wx wx = null;
long wwaMNDTime = 0l;
try {
t0 = System.currentTimeMillis();
areas = Area.findAffectedAreas(config, warnPolygon, warningArea,
@ -260,71 +264,92 @@ public class TemplateRunner {
Set<String> timeZones = new HashSet<String>();
for (AffectedAreas area : areas) {
if (area.getTimezone() != null) {
// Handles counties that span two time zones
// Handles counties that span two time zones
String oneLetterTimeZones = area.getTimezone().trim();
oneLetterTZ = new String[oneLetterTimeZones.length()];
if (oneLetterTimeZones.length() == 1) {
timeZones.add(String.valueOf(oneLetterTimeZones
.charAt(0)));
} else {
// Determine if one letter timezone is going to be put into timeZones.
Polygon[] poly1, poly2;
int n1, n2;
double size, totalSize;
// Determine if one letter timezone is going to be
// put into timeZones.
Polygon[] poly1, poly2;
int n1, n2;
double size, totalSize;
for (int i = 0; i < oneLetterTimeZones.length(); i++) {
oneLetterTZ[i] = String.valueOf(oneLetterTimeZones.charAt(i));
Geometry timezoneGeom = warngenLayer.getTimezoneGeom(oneLetterTZ[i]);
t0 = System.currentTimeMillis();
poly1 = null; poly2 = null;
n1 = 0; n2 = 0;
size = 0.0d; totalSize = 0.0d;
if (timezoneGeom != null && warningArea!= null) {
if (intersectSize.get(oneLetterTZ[i]) != null) continue;
poly1 = new Polygon[warningArea.getNumGeometries()];
n1 = warningArea.getNumGeometries();
for (int j = 0; j < n1; j++) {
poly1[j] = (Polygon)warningArea.getGeometryN(j);
}
poly2 = new Polygon[timezoneGeom.getNumGeometries()];
n2 = timezoneGeom.getNumGeometries();
for (int j = 0; j < n2; j++) {
poly2[j] = (Polygon)timezoneGeom.getGeometryN(j);
}
// Calculate the total size of intersection
for (Polygon p1: poly1) {
for (Polygon p2: poly2) {
size = p1.intersection(p2).getArea();
if (size > 0.0)
totalSize += size;
}
if (totalSize > minSize) break; //save time when the size of poly1 or poly2 is large
}
intersectSize.put(oneLetterTZ[i],totalSize);
} else
throw new VizException("Either timezoneGeom or/and warningArea is null. " +
"Timezone cannot be determined.");
System.out.println("Time to do size computation = "
+ (System.currentTimeMillis() - t0));
if (totalSize > minSize) {
timeZones.add(oneLetterTZ[i]);
oneLetterTZ[i] = String
.valueOf(oneLetterTimeZones.charAt(i));
Geometry timezoneGeom = warngenLayer
.getTimezoneGeom(oneLetterTZ[i]);
t0 = System.currentTimeMillis();
poly1 = null;
poly2 = null;
n1 = 0;
n2 = 0;
size = 0.0d;
totalSize = 0.0d;
if (timezoneGeom != null && warningArea != null) {
if (intersectSize.get(oneLetterTZ[i]) != null)
continue;
poly1 = new Polygon[warningArea
.getNumGeometries()];
n1 = warningArea.getNumGeometries();
for (int j = 0; j < n1; j++) {
poly1[j] = (Polygon) warningArea
.getGeometryN(j);
}
poly2 = new Polygon[timezoneGeom
.getNumGeometries()];
n2 = timezoneGeom.getNumGeometries();
for (int j = 0; j < n2; j++) {
poly2[j] = (Polygon) timezoneGeom
.getGeometryN(j);
}
// Calculate the total size of intersection
for (Polygon p1 : poly1) {
for (Polygon p2 : poly2) {
size = p1.intersection(p2)
.getArea();
if (size > 0.0)
totalSize += size;
}
if (totalSize > minSize)
break; // save time when the size of
// poly1 or poly2 is large
}
intersectSize
.put(oneLetterTZ[i], totalSize);
} else
throw new VizException(
"Either timezoneGeom or/and warningArea is null. "
+ "Timezone cannot be determined.");
System.out
.println("Time to do size computation = "
+ (System.currentTimeMillis() - t0));
if (totalSize > minSize) {
timeZones.add(oneLetterTZ[i]);
}
}
// If timeZones has nothing in it when the hatched area is very small,
// use the timezone of larger intersection size.
if (timeZones.size() == 0 ) {
if (intersectSize.size() > 1)
if (intersectSize.get(oneLetterTZ[0]) > intersectSize.get(oneLetterTZ[1])) {
timeZones.add(oneLetterTZ[0]);
} else {
timeZones.add(oneLetterTZ[1]);
}
else
throw new VizException("The size of intersectSize is less than 1, " +
"timezone cannot be determined.");
}
// If timeZones has nothing in it when the hatched
// area is very small,
// use the timezone of larger intersection size.
if (timeZones.size() == 0) {
if (intersectSize.size() > 1)
if (intersectSize.get(oneLetterTZ[0]) > intersectSize
.get(oneLetterTZ[1])) {
timeZones.add(oneLetterTZ[0]);
} else {
timeZones.add(oneLetterTZ[1]);
}
else
throw new VizException(
"The size of intersectSize is less than 1, "
+ "timezone cannot be determined.");
}
}
} else {
throw new VizException("Calling to area.getTimezone() returns null.");
throw new VizException(
"Calling to area.getTimezone() returns null.");
}
}
@ -342,12 +367,16 @@ public class TemplateRunner {
if (!(selectedAction == WarningAction.CAN || selectedAction == WarningAction.EXP)) {
Coordinate[] stormLocs = warngenLayer
.getStormLocations(stormTrackState);
Wx wx = new Wx(config, stormTrackState,
wx = new Wx(config, stormTrackState,
warngenLayer.getStormLocations(stormTrackState),
startTime.getTime(), DateUtil.roundDateTo15(endTime)
.getTime(), warnPolygon);
context.put("now", SimulatedTime.getSystemTime().getTime());
context.put("start", wx.getStartTime());
if (selectedAction == WarningAction.COR) {
wwaMNDTime = wx.getStartTime().getTime();
} else {
context.put("now", simulatedTime);
context.put("start", wx.getStartTime());
}
context.put(
"expire",
DateUtil.roundDateTo15(selectedAction == WarningAction.EXT ? endTime
@ -359,6 +388,7 @@ public class TemplateRunner {
context.put("duration", duration);
context.put("event", eventTime);
context.put("TMLtime", eventTime);
context.put("ugcline",
FipsUtil.getUgcLine(areas, wx.getEndTime(), 15));
context.put("areaPoly", GisUtil.convertCoords(warngenLayer
@ -382,7 +412,7 @@ public class TemplateRunner {
StormTrackData std = ToolsDataManager.getInstance()
.getStormTrackData();
std.setDate(SimulatedTime.getSystemTime().getTime());
std.setDate(simulatedTime);
std.setMotionDirection((int) wx.getMovementDirection());
std.setMotionSpeed((int) Math.round(wx.getMovementSpeed("kn")));
@ -418,11 +448,12 @@ public class TemplateRunner {
// Example: s[0-5] = T.CON-KLWX.SV.W.0123
AbstractWarningRecord oldWarn = CurrentWarnings.getInstance(
threeLetterSiteId).getNewestByTracking(etn, phenSig);
context.put("now", SimulatedTime.getSystemTime().getTime());
context.put("now", simulatedTime);
context.put("event", eventTime);
context.put("start", oldWarn.getStartTime().getTime());
context.put("expire", oldWarn.getEndTime().getTime());
Calendar canOrExpCal = Calendar.getInstance();
canOrExpCal.setTimeZone(TimeZone.getTimeZone("GMT"));
canOrExpCal.add(Calendar.MINUTE, 10);
canOrExpCal.add(Calendar.MILLISECOND, 1);
context.put(
@ -452,7 +483,7 @@ public class TemplateRunner {
StormTrackData std = ToolsDataManager.getInstance()
.getStormTrackData();
std.setDate(SimulatedTime.getSystemTime().getTime());
std.setDate(simulatedTime);
std.setMotionDirection(oldWarn.getMotdir());
std.setMotionSpeed(oldWarn.getMotspd());
t0 = System.currentTimeMillis();
@ -515,8 +546,68 @@ public class TemplateRunner {
}
context.put("etn", etn);
context.put("start", oldWarn.getIssueTime().getTime());
context.put("now", SimulatedTime.getSystemTime().getTime());
if (oldWarn.getAct().equals("NEW")) {
context.put("now", new Date(wwaMNDTime));
} else
context.put("now", simulatedTime);
context.put("event", oldWarn.getIssueTime().getTime());
String message = oldWarn.getRawmessage();
if (!stormTrackState.originalTrack) {
context.put("TMLtime", oldWarn.getStartTime().getTime());
} else {
int hour = 0;
int minute = 0;
int tmlIndex = message.indexOf("TIME...MOT...LOC");
int zIndex = -1;
if (tmlIndex > 0) {
zIndex = message.indexOf("Z", tmlIndex);
if (zIndex > 0) {
int startIndex = tmlIndex+16+1;
String tmlTime = null;
tmlTime = message.substring(startIndex,startIndex+4);
if (tmlTime.length() == 4) {
hour = Integer.parseInt(tmlTime.substring(0,2));
minute = Integer.parseInt(tmlTime.substring(2,4));
} else if (tmlTime.length() == 3) {
hour = Integer.parseInt(tmlTime.substring(0,1));
minute = Integer.parseInt(tmlTime.substring(1,3));
} else {
throw new VizException("The length of hour and minute for TML time is neither 3 nor 4.");
}
Calendar c = Calendar.getInstance();
c.set(Calendar.HOUR_OF_DAY,hour);
c.set(Calendar.MINUTE, minute);
context.put("TMLtime", c.getTime());
} else {
throw new VizException("Z, therefore hour and minute, cannot be found in TIME...MOT...LOC line.");
}
} else {
// To prevent errors resulting from undefined context("TMLtime")
context.put("TMLtime", oldWarn.getIssueTime().getTime());
}
}
// corEventtime for "COR to NEW", not for "COR to CON, CAN, or CANCON"
if (oldWarn.getAct().equals("NEW")) {
int untilIndex = message.indexOf("UNTIL");
int atIndex = -1;
int elipsisIndex = -1;
if (untilIndex > 0) {
atIndex = message.indexOf("AT", untilIndex);
if (atIndex > 0) {
int hhmmIndex = atIndex+3;
elipsisIndex = message.indexOf("...", hhmmIndex);
if (elipsisIndex > 0) {
context.put("corToNewMarker","cortonewmarker");
context.put("corEventtime",message.substring(hhmmIndex,elipsisIndex));
}
}
}
if (untilIndex < 0 || atIndex < 0 || elipsisIndex < 0)
throw new VizException("Cannot find * AT line.");
}
Calendar cal = oldWarn.getEndTime();
cal.add(Calendar.MILLISECOND, 1);
context.put("expire", cal.getTime());
@ -547,7 +638,9 @@ public class TemplateRunner {
context.put("expire", oldWarn.getEndTime().getTime());
context.put("ugcline", FipsUtil.getUgcLine(areas, oldWarn
.getEndTime().getTime(), 15));
Calendar cancelTime = (Calendar) oldWarn.getEndTime().clone();
Calendar cancelTime = Calendar.getInstance();
cancelTime.setTime(simulatedTime);
cancelTime.setTimeZone(TimeZone.getTimeZone("GMT"));
cancelTime.add(Calendar.MINUTE, 10);
String[] tmp = compareGeomsForFollowUp(oldWarn, warnPolygon,
areas, cancelTime.getTime(), config);

View file

@ -63,8 +63,7 @@ import com.raytheon.viz.warngen.gis.AffectedAreasComparator;
* c)Locking does not work for areal flood advisory followup;
* d)NullointException/locking does not work for special marine warning
* and locking beyond first paragragh.
* Jul 17, 2012 14989 Qinglu Lin Removed locks, <L> and </L>, for county names in pathcast line.
* Aug 6, 2012 15219 Qinglu Lin For tmlPtrn, changed d{1,3}DEG to d{3}DEG.
* Jul 17, 2012 14989 Qinglu Lin Removed locks, <L> and </L>, for county names in pathcast line.
*
* </pre>
*
@ -134,10 +133,14 @@ public class WarningTextHandler {
.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 final Pattern smwCanPtrn = Pattern.compile("(\\.MA\\.W\\.)");
private static final Pattern afaCanPtrn = Pattern.compile("(\\.FA\\.Y\\.)");
private static final Pattern smwHeadlinePtrn = Pattern.compile("(THE AFFECTED AREAS WERE)");
private static final Pattern smwHeadlinePtrn = Pattern
.compile("(THE AFFECTED AREAS WERE)");
private static Pattern immediateCausePtrn = null;
/** ex. SARPY NE-DOUGLAS NE-WASHINGTON NE- */
@ -155,19 +158,22 @@ public class WarningTextHandler {
private static final Pattern subLatLonPtrn = Pattern
.compile("^((?!TIME...MOT... LOC))\\s{1,}\\d{3,4}\\s\\d{3,5}(|(\\s\\d{3,4}\\s\\d{3,5}){1,})");
private static final Pattern tmlPtrn = Pattern
.compile("TIME...MOT...LOC \\d{3,4}Z\\s\\d{3}DEG\\s\\d{1,3}KT((\\s\\d{3,4}\\s\\d{3,5}){1,})");
.compile("TIME...MOT...LOC \\d{3,4}Z\\s\\d{3}DEG\\s\\d{1,3}KT((\\s\\d{3,4}\\s\\d{3,5}){1,})");
private static final Pattern subTMLPtrn = Pattern
.compile("(\\d{3,5}\\s){1,}");
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");
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 = "";
@ -177,7 +183,7 @@ public class WarningTextHandler {
pattern = "(.*)(A DAM BREAK";
for (String ic : immediateCause.split("\n")) {
String[] parts = ic.split("\\\\");
pattern += "|" + parts[1].trim();
pattern += "| " + parts[1].trim();
}
pattern += ")(.*)";
immediateCausePtrn = Pattern.compile(pattern);
@ -190,8 +196,8 @@ public class WarningTextHandler {
}
public static String handle(String originalMessage, AffectedAreas[] areas,
AffectedAreas[] canceledAreas, WarningAction action, WarningAction action2,
boolean autoLock) {
AffectedAreas[] canceledAreas, WarningAction action,
WarningAction action2, boolean autoLock) {
long t0 = System.currentTimeMillis();
if (action == WarningAction.NEW) {
try {
@ -294,9 +300,10 @@ public class WarningTextHandler {
boolean startLines = true;
// Set before to false if the line is beyond "THE NATIONAL WEATHER SERVICE IN" line.
// Set before to false if the line is beyond
// "THE NATIONAL WEATHER SERVICE IN" line.
boolean before = true;
boolean isCancelledFound = false;
// for CAN of CANCON of Special Marine Warning
@ -305,56 +312,57 @@ public class WarningTextHandler {
// for CAN of CANCON of Areal Flood Advisory
boolean afaCan = false;
int afaCanBlankline = 0;
int afaCanBlankline = 0;
String[] tokens = null;
if (canceledAreas != null) {
String areaNames = "";
for (AffectedAreas area : canceledAreas) {
String areaName = area.getName();
if (areaName != null && areaName.length()>0) {
areaName = areaName.toUpperCase();
areaNames += areaName + " ";
}
}
areaNames = areaNames.trim();
HashSet<String> areaNameSet = new HashSet<String>();
String[] tokens0 = areaNames.split(" ");
int tokensLength = tokens0.length;
for (int i=0;i<tokensLength;i++)
{
areaNameSet.add(tokens0[i]);
}
tokens = (String[])areaNameSet.toArray(new String[areaNameSet.size()]);
String s0;
for (int i=0;i<areaNameSet.size()-1;i++) {
s0 = tokens[i];
String s1;
for (int j=i;j<areaNameSet.size();j++){
if (tokens[j].length() > s0.length()) {
s1 = s0;
s0 = tokens[j];
tokens[j] = s1;
}
}
tokens[i] = s0;
}
String areaNames = "";
for (AffectedAreas area : canceledAreas) {
String areaName = area.getName();
if (areaName != null && areaName.length() > 0) {
areaName = areaName.toUpperCase();
areaNames += areaName + " ";
}
}
areaNames = areaNames.trim();
HashSet<String> areaNameSet = new HashSet<String>();
String[] tokens0 = areaNames.split(" ");
int tokensLength = tokens0.length;
for (int i = 0; i < tokensLength; i++) {
areaNameSet.add(tokens0[i]);
}
tokens = (String[]) areaNameSet.toArray(new String[areaNameSet
.size()]);
String s0;
for (int i = 0; i < areaNameSet.size() - 1; i++) {
s0 = tokens[i];
String s1;
for (int j = i; j < areaNameSet.size(); j++) {
if (tokens[j].length() > s0.length()) {
s1 = s0;
s0 = tokens[j];
tokens[j] = s1;
}
}
tokens[i] = s0;
}
}
boolean ruralFound=false, ruralReplace=false;
boolean ruralFound = false, ruralReplace = false;
ArrayList<String> usedAreaNotations = new ArrayList<String>();
for (int lineIndex = 0; lineIndex < seperatedLines.length; ++lineIndex) {
String line = seperatedLines[lineIndex];
if (line.contains("THE NATIONAL WEATHER SERVICE IN") || line.contains("OTHER LOCATIONS IMPACTED")) {
if (line.contains("THE NATIONAL WEATHER SERVICE IN")
|| line.contains("OTHER LOCATIONS IMPACTED")) {
before = false;
}
if (!ruralFound && line.contains("MAINLY RURAL AREAS")) {
ruralFound = true;
ruralFound = true;
}
// This prevents blank line(s) after the header from being locked.
if (startLines && lineIndex > 1) {
startLines = line.trim().length() == 0;
@ -394,10 +402,10 @@ public class WarningTextHandler {
cancelVtecLineFound = true;
m = smwCanPtrn.matcher(line);
if (m.find())
smwCan = true;
smwCan = true;
m = afaCanPtrn.matcher(line);
if (m.find())
afaCan = true;
afaCan = true;
}
continue;
}
@ -410,13 +418,14 @@ public class WarningTextHandler {
}
if (before) {
m = listOfAreaNamePtrn.matcher(line);
if (m.find()) {
if (!(line.contains("!**") || line.contains("**!") || line.contains("OTHER LOCATIONS"))) {
sb.append(LOCK_START + line + "\n" + LOCK_END);
continue;
}
}
m = listOfAreaNamePtrn.matcher(line);
if (m.matches()) {
if (!(line.contains("!**") || line.contains("**!") || line
.contains("OTHER LOCATIONS"))) {
sb.append(LOCK_START + line + "\n" + LOCK_END);
continue;
}
}
}
// Locking Date in the MND header
@ -427,35 +436,34 @@ public class WarningTextHandler {
}
if (ruralFound)
if (!ruralReplace)
ruralReplace = true;
else
if (ruralReplace) {
if (line.trim().length() == 0)
ruralFound = false;
else {
line = line.replace("<L>","");
line = line.replace("</L>","");
sb.append(line + "\n");
continue;
}
}
if (!ruralReplace)
ruralReplace = true;
else if (ruralReplace) {
if (line.trim().length() == 0)
ruralFound = false;
else {
line = line.replace("<L>", "");
line = line.replace("</L>", "");
sb.append(line + "\n");
continue;
}
}
if (line.trim().length() == 0) {
insideTML = false;
insideLatLon = false;
headlineFound = false;
if (smwCan) {
if (lockSmwCan)
cancelVtecLineFound = false;
lockSmwCan = false;
if (lockSmwCan)
cancelVtecLineFound = false;
lockSmwCan = false;
}
if (afaCan) {
afaCanBlankline += 1;
if (afaCanBlankline > 1) {
afaCan = false;
cancelVtecLineFound = false;
}
afaCanBlankline += 1;
if (afaCanBlankline > 1) {
afaCan = false;
cancelVtecLineFound = false;
}
}
if (startLines) {
// Don't lock blank line after header
@ -564,134 +572,151 @@ public class WarningTextHandler {
continue;
}
} else {
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) {
if (smwCan) {
// lock marine zone names
if (lockSmwCan) {
if (line.length()==0) {
lockSmwCan = false;
} else
line = LOCK_START + line + LOCK_END;
} else {
m = smwHeadlinePtrn.matcher(line);
if (m.find())
lockSmwCan = true;
}
} else {
for (String s: tokens)
if (line.contains(s))
line = line.replace(s, LOCK_START
+ s + LOCK_END);
for (AffectedAreas area : canceledAreas) {
String areaNotation = area.getAreaNotation();
if (areaNotation != null) {
// areaNotation, e.g., COUNTY
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);
}
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) {
if (smwCan) {
// lock marine zone names
if (lockSmwCan) {
if (line.length() == 0) {
lockSmwCan = false;
} else
line = LOCK_START + line + LOCK_END;
} else {
m = smwHeadlinePtrn.matcher(line);
if (m.find())
lockSmwCan = true;
}
} else {
for (String s : tokens)
if (line.contains(s))
line = line.replace(s, LOCK_START + s
+ LOCK_END);
for (AffectedAreas area : canceledAreas) {
String areaNotation = area.getAreaNotation();
if (areaNotation != null) {
// areaNotation, e.g., COUNTY
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 (cancelVtecLineFound && isCancelledFound)
cancelVtecLineFound = false;
if (cancelVtecLineFound && isCancelledFound)
cancelVtecLineFound = false;
m = cancelOnlyPtrn.matcher(line);
if (m.find())
cancelVtecLineFound = false;
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);
}
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 = 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;
}
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;
}
}
sb.append(line + "\n");
continue;
}
}
}
// Locking LAT...LON
@ -705,7 +730,7 @@ public class WarningTextHandler {
if (insideLatLon) {
m = subLatLonPtrn.matcher(line);
if (m.find()) {
sb.append(LOCK_START +line + "\n" + LOCK_END);
sb.append(LOCK_START + line + "\n" + LOCK_END);
continue;
} else {
insideLatLon = false;
@ -721,7 +746,7 @@ public class WarningTextHandler {
// Locking TIME...MOT..LOC
m = tmlPtrn.matcher(line);
if (m.find()) {
sb.append(LOCK_START + line + "\n"+ LOCK_END);
sb.append(LOCK_START + line + "\n" + LOCK_END);
insideTML = true;
continue;
}
@ -739,22 +764,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;
@ -850,31 +875,32 @@ public class WarningTextHandler {
return sb.toString();
}
private static String wrapLocations(String locationsLine) {
StringBuffer sb = new StringBuffer();
String line = " ";
String[] locations = locationsLine.split("\\.\\.\\.");
for (int i = 0; i < locations.length; i++) {
String location = locations[i];
int size = (i == locations.length - 1)? location.length() : location.length() + 3;
int size = (i == locations.length - 1) ? location.length()
: location.length() + 3;
if (line.length() + size >= MAX_WIDTH - 2) {
sb.append(line + "\n");
line = " ";
}
}
if (i == locations.length - 1) {
line += location;
} else {
line += location + "...";
}
}
sb.append(line + "\n");
return sb.toString();
}

View file

@ -3,6 +3,7 @@ package com.raytheon.viz.warnings.rsc;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@ -74,7 +75,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* in a given display frame
* Jun 04, 2012 DR14992 mgamazaychikov Reversed the textToPrint array to
* plot the strings in correct order
*
* Aug 09, 2012 DR 15166 D.Friedman Plot only the most recent record for
* an event.
* </pre>
*
* @author jsanchez
@ -530,77 +532,94 @@ public abstract class AbstractWarningResource extends AbstractWWAResource
lastFrame = true;
}
synchronized (paintLock) {
for (String datauri : entryMap.keySet()) {
WarningEntry entry = entryMap.get(datauri);
AbstractWarningRecord record = entry.record;
HashMap<String, WarningEntry> candidates =
new HashMap<String, AbstractWarningResource.WarningEntry>();
for (WarningEntry entry : entryMap.values()) {
if (matchesFrame(entry, paintProps.getDataTime(), framePeriod,
lastFrame)) {
String key = getEventKey(entry);
WarningEntry current = candidates.get(key);
if (current == null || current.record.getIssueTime().
before(entry.record.getIssueTime()) ||
(current.record.getIssueTime().equals(entry.record.getIssueTime()) &&
current.record.getInsertTime().before(entry.record.getInsertTime()))
)
candidates.put(key, entry);
}
}
for (WarningEntry entry : candidates.values()) {
AbstractWarningRecord record = entry.record;
// check shapes
if (entry.project) {
initShape(target, entry.record);
entry.project = false;
}
// check shapes
if (entry.project) {
initShape(target, entry.record);
entry.project = false;
}
if (entry != null && entry.wireframeShape != null) {
LineStyle lineStyle = (record.getProductClass() != null && record
.getProductClass().equals("T")) ? LineStyle.DASHED
: LineStyle.SOLID;
target.drawWireframeShape(entry.wireframeShape,
getCapability(ColorableCapability.class)
.getColor(),
getCapability(OutlineCapability.class)
.getOutlineWidth(), lineStyle);
} else if (entry != null && entry.shadedShape != null) {
target.drawShadedShape(entry.shadedShape, 1);
}
if (entry != null && entry.wireframeShape != null) {
LineStyle lineStyle = (record.getProductClass() != null && record
.getProductClass().equals("T")) ? LineStyle.DASHED
: LineStyle.SOLID;
target.drawWireframeShape(entry.wireframeShape,
getCapability(ColorableCapability.class)
.getColor(),
getCapability(OutlineCapability.class)
.getOutlineWidth(), lineStyle);
} else if (entry != null && entry.shadedShape != null) {
target.drawShadedShape(entry.shadedShape, 1);
}
if (record != null && record.getGeometry() != null) {
// Calculate the upper left portion of the polygon
Coordinate upperLeft = new Coordinate(180, -90);
if (record != null && record.getGeometry() != null) {
// Calculate the upper left portion of the polygon
Coordinate upperLeft = new Coordinate(180, -90);
for (Coordinate c : record.getGeometry()
.getCoordinates()) {
if (c.y - c.x > upperLeft.y - upperLeft.x) {
upperLeft = c;
}
for (Coordinate c : record.getGeometry()
.getCoordinates()) {
if (c.y - c.x > upperLeft.y - upperLeft.x) {
upperLeft = c;
}
double[] d = descriptor.worldToPixel(new double[] {
upperLeft.x, upperLeft.y });
d[0] -= paintProps.getZoomLevel() * 100;
double mapWidth = descriptor.getMapWidth()
* paintProps.getZoomLevel() / 1000;
String[] textToPrint = getText(record, mapWidth);
if (warningsFont == null) {
warningsFont = target.getDefaultFont()
.deriveWithSize(11);
}
// 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]);
params.textStyle = TextStyle.NORMAL;
params.horizontalAlignment = HorizontalAlignment.RIGHT;
params.verticallAlignment = VerticalAlignment.BOTTOM;
params.magnification = getCapability(
MagnificationCapability.class)
.getMagnification();
target.drawStrings(params);
}
double[] d = descriptor.worldToPixel(new double[] {
upperLeft.x, upperLeft.y });
d[0] -= paintProps.getZoomLevel() * 100;
double mapWidth = descriptor.getMapWidth()
* paintProps.getZoomLevel() / 1000;
String[] textToPrint = getText(record, mapWidth);
if (warningsFont == null) {
warningsFont = target.getDefaultFont()
.deriveWithSize(11);
}
// 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]);
params.textStyle = TextStyle.NORMAL;
params.horizontalAlignment = HorizontalAlignment.RIGHT;
params.verticallAlignment = VerticalAlignment.BOTTOM;
params.magnification = getCapability(
MagnificationCapability.class)
.getMagnification();
target.drawStrings(params);
}
}
}
}
private static String getEventKey(WarningEntry entry) {
AbstractWarningRecord r = entry.record;
return r.getOfficeid() + '.' + r.getPhensig() + '.' + r.getEtn();
}
protected boolean matchesFrame(WarningEntry entry, DataTime paintTime,
TimeRange framePeriod, boolean lastFrame) {
TimeRange recordPeriod = new TimeRange(entry.record.getStartTime()

View file

@ -8,6 +8,10 @@
</layout>
</appender>
<appender name="asyncConsole" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="console" />
</appender>
<!-- radar log -->
<appender name="RadarLog" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
@ -130,8 +134,8 @@
<appender name="ThreadBasedLog" class="com.raytheon.uf.edex.log.ThreadBasedAppender">
<param name="ThreadPatterns" value="RadarLog:radarThreadPool.*;SatelliteLog:satelliteThreadPool.*;ShefLog:shefThreadPool.*;TextLog:textThreadPool.*;SmartInitLog:smartInit.*"/>
<param name="DefaultAppender" value="console"/>
<appender-ref ref="console"/>
<param name="DefaultAppender" value="asyncConsole"/>
<appender-ref ref="asyncConsole"/>
<appender-ref ref="RadarLog"/>
<appender-ref ref="SatelliteLog"/>
<appender-ref ref="ShefLog"/>

View file

@ -8,6 +8,10 @@
</layout>
</appender>
<appender name="asyncConsole" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="console" />
</appender>
<!-- ProductSrvRequest log -->
<appender name="ProductSrvRequestLog" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
@ -19,6 +23,10 @@
</layout>
</appender>
<appender name="ProductSrvRequestLogAsync" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="ProductSrvRequestLog" />
</appender>
<!-- ThriftSrv (RemoteRequestRouteWrapper) request log -->
<appender name="ThriftSrvRequestLog" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
@ -28,14 +36,14 @@
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
</layout>
</appender>
<appender name="ThriftSrvRequestLogAsync" class="org.apache.log4j.AsyncAppender">
<appender-ref ref="ThriftSrvRequestLog" />
</appender>
<logger name="ProductSrvRequestLogger" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="ProductSrvRequestLog"/>
<appender-ref ref="ProductSrvRequestLogAsync"/>
</logger>
<logger name="ThriftSrvRequestLogger" additivity="false">
@ -104,6 +112,6 @@
<!-- default logging -->
<root>
<level value="INFO"/>
<appender-ref ref="console"/>
<appender-ref ref="asyncConsole"/>
</root>
</log4j:configuration>
</log4j:configuration>

View file

@ -126,6 +126,18 @@ class TimeRange(JUtil.JavaWrapperClass):
def __ne__(self, other):
return not self == other
def __lt__(self, other):
return self.__tr.compareTo(other.toJavaObj()) < 0
def __le__(self, other):
return self.__tr.compareTo(other.toJavaObj()) <= 0
def __gt__(self, other):
return self.__tr.compareTo(other.toJavaObj()) > 0
def __ge__(self, other):
return self.__tr.compareTo(other.toJavaObj()) >= 0
def __hash__(self):
if not self.__hash:
self.__hash = self.startTime().unixTime() ^ self.endTime().unixTime()
@ -134,6 +146,9 @@ class TimeRange(JUtil.JavaWrapperClass):
def __str__(self):
return str(self.__tr.toString())
def __repr__(self):
return str(self.__tr.toString())
def javaTimeRangeListToPyList(timeRanges):
pylist = []
size = timeRanges.size()

View file

@ -2,6 +2,7 @@
##### Qinglu Lin 04-04-2012 DR 14691.
##### Qinglu Lin 06-18-2012 DR 15043. Use duration in secondBullet.
##### Qinglu Lin 07-31-2012 DR 15217. Use roundAndPad for movement direction in DEG.
##### Qinglu Lin 08-13-2012 DR 14493. Use corToNewMarker and corEventtime.
####################################################################################################
Mile Marker Test Code
macro "mmarkers" use (called out of VM_global_library.vm):
@ -660,7 +661,11 @@ UNTIL ${dateUtil.format(${expire}, ${timeFormat.clock}, 15, ${localtimezone})}##
#end
#macro(thirdBullet $dateUtil $eventtime $timeFormat $localtimezone $secondtimezone)
#if(${corToNewMarker})
AT ${corEventtime}##
#else
AT ${dateUtil.format(${eventtime}, ${timeFormat.clock}, ${localtimezone})}##
#end
#if(${secondtimezone})
/${dateUtil.format(${eventtime}, ${timeFormat.clock}, ${secondtimezone})}/##
#end

View file

@ -1,6 +1,8 @@
#####################
####################################################################
## CUSTOM TEMPLATE ##
#####################
## History
## QINGLU LIN 8-14-2012 DR 14493 use corToNewMarker and TMLtime ##
####################################################################
${WMOId} ${vtecOffice} 000000
CUSTOM
${ugcline}
@ -166,7 +168,11 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
#if(${corToNewMarker})
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
#else
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
#end
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -6,7 +6,7 @@
## MODIFIED EVAN BOOKBINDER 09-16-2011 OB11.0.8-8 ##
## EVAN BOOKBINDER WFO EAX 11-04-2011 OB11.9-3 (DRs) ##
## QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
## ##
## QINGLU LIN 8-14-2012 DR 14493 use TMLtime ##
############################################################################
## EWW PRODUCT ##
#################
@ -188,7 +188,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -6,6 +6,7 @@
## VERSION AWIPS II 1.1 -- 2-29-2012 OB12.2.1-4 ##
## VERSION AWIPS II 1.2 -- 4-20-2012 ##
## BY QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
## QINGLU LIN 8-14-2012 DR 14493 use TMLtime ##
################################################################
##
##SET SOME INITIAL VARIABLES
@ -656,7 +657,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -9,6 +9,7 @@
## 2-24-2012 OB12.2.1 CLEANUP ##
## BY QINGLU LIN 6-18-2012 DR 15043 use duration ##
## BY QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
## BY QINGLU LIN 8-14-2012 DR 14493 use TMLtime ##
################################################################
##
##SET SOME INITIAL VARIABLES
@ -475,7 +476,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -10,7 +10,8 @@
## Cleaned up wind coding for version 1.4 ##
## VERSION AWIPS II 1.5 -- MAR 2 2012 OB12.2.1-4 ##
## BY QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
#####################################################
## BY QINGLU LIN 8-14-2012 DR 14493 use TMLtime ##
################################################################
## Added Volcano Information in version 1.3 for sites where
## Volcanoes affect their marine zones. If sites wish to hide
## this information comment out the appropriate bullets in the
@ -394,7 +395,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -12,6 +12,7 @@
## EVAN BOOKBINDER WFO EAX 2-24-12 - OB12.2.1 ##
## MIKE REGA 5-03-12 - DR 14885 MND blank line ##
## QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
## QINGLU LIN 8-14-2012 DR 14493 use TMLtime ##
###############################################################################
## ESTABLISH SOME INITIAL VARIABLES
#set($preAmble = "")
@ -421,7 +422,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
#printcoords(${areaPoly}, ${list})
TIME...MOT...LOC ##
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ##
${mathUtil.roundAndPad(${movementDirection})}DEG ##
${mathUtil.round(${movementInKnots})}KT ##
#foreach(${eventCoord} in ${eventLocation})

View file

@ -5,6 +5,9 @@
# A simple example would be
# BASE:common_static/textdb/textCategoryClass.txt
#AvnFPS files
SITE:cave_static/aviation/avnwatch/aviationForecasterConfig.xml
#D2D files
BASE:cave_static/derivedParameters/DerivedParameterInterface.py
@ -155,3 +158,6 @@ BASE:edex_static/smartInit/NamDNG5.py
#gfeConfig files
BASE:cave_static/gfe/userPython/gfeConfig/gfeConfig.py
# FFMP Files
SITE:common_static/purge/ffmpPurgeRules.xml
SITE:common_static/ffmp/FFMPTemplateConfig.xml

View file

@ -339,8 +339,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
self._longTermFcstrNumber = self._getForecasterNumber(self._longTermFcstrNumber)
self._shortTermFcstrNumber = self._getForecasterNumber(self._shortTermFcstrNumber)
self._aviationFcstrNumber = self._getForecasterNumber(self._aviationFcstrNumber)

View file

@ -1093,8 +1093,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
#Tropical exceptions
try:

View file

@ -201,8 +201,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
self._forecasterNumber = self._getForecasterNumber(self._forecasterNumber)
# Make argDict accessible

View file

@ -750,8 +750,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
self._language = argDict["language"]

View file

@ -1049,9 +1049,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
for key in varDict.keys():
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
exec "self._" + variable + "= varDict[key]"
self._language = argDict["language"]

View file

@ -114,8 +114,6 @@ class TextProduct(GenericReport.TextProduct):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
return fcst
def _preProcessArea(self, fcst, editArea, areaLabel, argDict):

View file

@ -80,8 +80,6 @@ class TextProduct(CivilEmerg.TextProduct):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
fcst = fcst + "AN EARTHQUAKE HAS BEEN FELT " + self._felt + " BY " +\
self._extent + " " + "IN THE |*enter area*| AREA. " + \

View file

@ -806,9 +806,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
self._language = argDict["language"]
return None

View file

@ -539,8 +539,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
# Set up product-specific variables
self._colWidth = 13

View file

@ -219,9 +219,7 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
for key in varDict.keys():
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
exec "self._" + variable + "= varDict[key]"
# Calculate current times
self._ddhhmmTime = self.getCurrentTime(

View file

@ -693,8 +693,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
self._language = argDict["language"]

View file

@ -250,8 +250,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis,
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
self._language = argDict["language"]

View file

@ -219,8 +219,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
self._language = argDict["language"]
return None

View file

@ -165,8 +165,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
try:
if self._tropicalStorm == "YES":

View file

@ -530,8 +530,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
self._format = "Standard"
self._extended = "Without Extended"

View file

@ -878,8 +878,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
if type(key) is types.TupleType:
label, variable = key
exec "self._" + variable + "= varDict[key]"
else:
exec "self._" + key + "= varDict[key]"
self._language = argDict["language"]
return None

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