Merge 12.9.1-4 into development_on_ss_builds

Former-commit-id: 0987fc6b3d [formerly cb46f57879] [formerly 0987fc6b3d [formerly cb46f57879] [formerly 5a453ee984 [formerly a178af491f4b4cd75ed1517f023354bab0b9c8c8]]]
Former-commit-id: 5a453ee984
Former-commit-id: 537dbadf64 [formerly 8a66b2f209]
Former-commit-id: 1792158ef8
This commit is contained in:
root 2012-08-15 22:15:20 +00:00
parent d47eda2d66
commit 0eb9520e15
296 changed files with 12695 additions and 9259 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

@ -21,14 +21,18 @@ package com.raytheon.rcm.server;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import com.raytheon.rcm.event.RadarEvent;
import com.raytheon.rcm.event.RadarEventAdapter;
/**
* TODO Add Description
* Send AlertViz notifications
*
* <pre>
*
@ -37,6 +41,7 @@ import com.raytheon.rcm.event.RadarEventAdapter;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 9, 2011 mnash Initial creation
* 2012-07-27 DR 14896 D. Friedman Handle multiple RPGs.
*
* </pre>
*
@ -46,13 +51,15 @@ import com.raytheon.rcm.event.RadarEventAdapter;
public class RadarServerAvailable extends RadarEventAdapter {
private static boolean attempted = false;
private static final String CONNECTION_DOWN_MESSAGE = "RPG connection is down.";
private static final String CONNECTION_UP_MESSAGE = "RPG connection is back up.";
private static final String AWIPS2_FXA_PROPERTY = "awips2_fxa";
private static final String DEFAULT_AWIPS2_FXA = "/awips2/fxa";
private static final String ANNOUNCER_PATH = "bin" + File.separator + "fxaAnnounce";
private ProcessBuilder builder;
private HashSet<String> knownFailures = new HashSet<String>();
/**
*
*/
public RadarServerAvailable(RadarServer server) {
}
@ -65,64 +72,73 @@ public class RadarServerAvailable extends RadarEventAdapter {
*/
@Override
public void handleRadarEvent(RadarEvent event) {
Process proc = null;
String home = System.getProperty("awips2_fxa");
if (home != null && !home.endsWith(File.separator)) {
home += File.separator;
} else if (home == null) {
Log.event("Cannot find awips2_fxa system variable");
return;
}
List<String> values = new ArrayList<String>();
values.add(home + "bin" + File.separator + "fxaAnnounce");
try {
if (event.getType() == RadarEvent.CONNECTION_ATTEMPT_FAILED) {
if (!attempted) {
Log.event("Executing " + values.get(0));
values.add(event.getRadarID() + " rpg connection is down.");
values.add("RADAR");
values.add("URGENT");
builder = new ProcessBuilder(values);
builder.redirectErrorStream(true);
proc = builder.start();
StringBuilder output = new StringBuilder();
Scanner s = new Scanner(proc.getInputStream());
while (s.hasNextLine()) {
if (output.length() > 0)
output.append('\n');
output.append(s.nextLine());
}
proc.waitFor();
attempted = true;
}
} else if (event.getType() == RadarEvent.CONNECTION_UP) {
if (attempted) {
Log.event("Executing " + values.get(0));
values.add(event.getRadarID()
+ " rpg connection is back up.");
values.add("RADAR");
values.add("URGENT");
builder = new ProcessBuilder(values);
builder.redirectErrorStream(true);
proc = builder.start();
StringBuilder output = new StringBuilder();
Scanner s = new Scanner(proc.getInputStream());
while (s.hasNextLine()) {
if (output.length() > 0)
output.append('\n');
output.append(s.nextLine());
}
proc.waitFor();
attempted = false;
}
final String radarId = event.getRadarID();
if (event.getType() == RadarEvent.CONNECTION_ATTEMPT_FAILED) {
if (! knownFailures.contains(radarId)) {
knownFailures.add(radarId);
sendNotification(radarId, CONNECTION_DOWN_MESSAGE);
}
} else if (event.getType() == RadarEvent.CONNECTION_UP) {
if (knownFailures.contains(radarId)) {
knownFailures.remove(radarId);
sendNotification(radarId, CONNECTION_UP_MESSAGE);
}
}
}
private void sendNotification(final String radarId, final String message) {
getExecutorService().submit(new Runnable() {
@Override
public void run() {
sendNotification2(radarId, message);
}
});
}
private void sendNotification2(String radarId, String message) {
ProcessBuilder builder;
Process proc = null;
String fxaDir = System.getProperty(AWIPS2_FXA_PROPERTY);
if (fxaDir == null)
fxaDir = DEFAULT_AWIPS2_FXA;
List<String> values = new ArrayList<String>();
values.add(fxaDir + File.separator + ANNOUNCER_PATH);
Log.event("Executing " + values.get(0));
values.add(radarId + ' ' + message);
values.add("RADAR");
values.add("URGENT");
builder = new ProcessBuilder(values);
builder.redirectErrorStream(true);
try {
proc = builder.start();
Scanner s = new Scanner(proc.getInputStream());
while (s.hasNextLine())
s.nextLine();
proc.waitFor();
} catch (Exception e) {
e.printStackTrace();
Log.errorf("Error running fxaAnnounce: %s", e);
} finally {
if (proc != null) {
proc.destroy();
}
}
}
// TODO: has to be daemon until there is a shutdown notification
private static ExecutorService executorService = Executors
.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r);
t.setDaemon(true);
return t;
}
});
private static ExecutorService getExecutorService() {
return executorService;
}
}

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

@ -21,10 +21,11 @@
<!--
Date DR# Engineer Description
03/26/2012 12864 zhao Changed CigVisTrendTimeout from 300 to 1800
07/27/2012 15169 zhao Changed WindRoseTimeout from 20 to 120
-->
<ClimateTimeouts>
<ClimateMetarTimeout>20</ClimateMetarTimeout>
<WindRoseTimeout>20</WindRoseTimeout>
<WindRoseTimeout>120</WindRoseTimeout>
<CigVisDistTimeout>90</CigVisDistTimeout>
<CigVisTrendTimeout>1800</CigVisTrendTimeout>
</ClimateTimeouts>

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

@ -94,7 +94,7 @@
#
#
import logging, re, time
import Avn, AvnLib, Busy, TafDecoder, AvnParser
import Avn, AvnLib, TafDecoder, AvnParser
_Logger = logging.getLogger(Avn.CATEGORY)
_AmdPat = re.compile(r'(AFT|TIL)\s+(\d{6})|(\d{4}/\d{4})')
@ -175,8 +175,7 @@ def updateTafs(bbb, fcsts):
badidents.append(ident)
if badidents:
Busy.showwarning('Could not update times for %s' % ' '.join(badidents),
master)
_Logger.warning('Could not update times for %s' % ' '.join(badidents))
return fcsts

View file

@ -78,7 +78,7 @@
#
#
import logging, time
import Avn, AvnLib, AvnParser, Busy, Globals, TafDecoder
import Avn, AvnLib, AvnParser, TafDecoder
import MetarData
@ -120,7 +120,6 @@ def updateTafs(bbb, fcsts):
badidents.append(ident)
if badidents:
Busy.showwarning('Could not update TAFs for %s' % ' '.join(badidents),
master)
_Logger.warning('Could not update TAFs for %s' % ' '.join(badidents))
return fcsts

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

@ -18,6 +18,7 @@
# further licensing information.
##
import TimeRange, AbsTime
import logging
import TextFormatter
import time, os, string, inspect, sys
@ -288,6 +289,17 @@ def runFormatter(databaseID, site, forecastList, cmdLineVarDict, vtecMode,
logger.info("Text Formatter Finished")
return forecasts
def getAbsTime(timeStr):
"Create an AbsTime from a string: YYYYMMDD_HHMM"
year = int(timeStr[0:4])
month = int(timeStr[4:6])
day = int(timeStr[6:8])
hour = int(timeStr[9:11])
minute = int(timeStr[11:13])
return AbsTime.absTimeYMD(year, month, day, hour, minute)
def writeToFile(forecasts, outputFile, mode):
if not outputFile is None and outputFile != "":
outfile = open(outputFile, mode)
@ -427,4 +439,4 @@ def reloadModule(moduleName):
except:
logger.exception("Import Failed " + moduleName)

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

@ -50,7 +50,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
/**
* Creates uEngine scripts on the fly.
* Creates uEngine scripts on the fly. DEPRECATED: Requests from viz should go
* through ThriftClient to the thrift service instead of using ScriptCreator and
* then going to the uengine service. The thrift service performs faster and is
* more maintainable. Use ThriftClient.
*
* <pre>
*
@ -73,6 +76,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* @author brockwoo
* @version 1
*/
@Deprecated
public class ScriptCreator {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ScriptCreator.class);

View file

@ -4,6 +4,7 @@ import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.UUID;
import javax.jws.WebService;
@ -20,6 +21,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
import com.raytheon.uf.common.serialization.comm.RemoteServiceRequest;
import com.raytheon.uf.common.serialization.comm.RequestWrapper;
import com.raytheon.uf.common.serialization.comm.ServiceException;
import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
import com.raytheon.uf.common.serialization.comm.util.ExceptionWrapper;
@ -50,9 +52,9 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
**/
/**
* The thrift client. used to send requests to the RemoteReqeustServer. Make
* The thrift client. used to send requests to the RemoteRequestServer. Make
* sure request type has registered a handler to handle the request on the
* server
* server.
*
* <pre>
*
@ -60,6 +62,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 3, 2009 mschenke Initial creation
* Jul 24, 2012 njensen Enhanced logging
*
* </pre>
*
@ -273,9 +276,12 @@ public class ThriftClient {
private static Object sendRequest(IServerRequest request,
String httpAddress, String uri) throws VizException {
httpAddress += uri;
String uniqueId = UUID.randomUUID().toString();
RequestWrapper wrapper = new RequestWrapper(request, VizApp.getWsId(),
uniqueId);
byte[] message;
try {
message = SerializationUtil.transformToThrift(request);
message = SerializationUtil.transformToThrift(wrapper);
} catch (SerializationException e) {
throw new VizException("unable to serialize request object", e);
}
@ -287,8 +293,8 @@ public class ThriftClient {
.postBinary(httpAddress, message);
long time = System.currentTimeMillis() - t0;
if (time >= SIMPLE_LOG_TIME) {
System.out.println("Took " + time + "ms to run request "
+ request);
System.out.println("Took " + time + "ms to run request id["
+ uniqueId + "] " + request.toString());
}
if (time >= BAD_LOG_TIME) {
new Exception() {

View file

@ -80,9 +80,9 @@
<arrowStyle>
<!--
<displayUnits>K/(km * 1000)</displayUnits>
-->
<displayUnits label="K/(km*1000)">K/m*1.0E6</displayUnits>
-->
<displayUnits label="C/m">K/m*1.0E6</displayUnits>
</arrowStyle>
</styleRule>

View file

@ -4084,4 +4084,13 @@ in | .03937 | 0 | 4 | | |..|8000F0FF| | 16 | \
</contourStyle>
</styleRule>
<styleRule>
<paramLevelMatches>
<parameter>Wind</parameter>
<parameter>Gust</parameter>
</paramLevelMatches>
<contourStyle>
<displayUnits>kts</displayUnits>
</contourStyle>
</styleRule>
</styleRuleset>

View file

@ -498,4 +498,13 @@
</graphStyle>
</styleRule>
<styleRule>
<paramLevelMatches>
<parameter>MTV</parameter>
</paramLevelMatches>
<graphStyle>
<displayUnits label="gm/kgs">g*m/(kg*s)</displayUnits>
</graphStyle>
</styleRule>
</styleRuleset>

View file

@ -1548,7 +1548,7 @@
</key>
<key
contextId="com.raytheon.uf.viz.d2d.ui"
commandId="com.raytheon.viz.ui.actions.printScreenAction"
commandId="com.raytheon.uf.viz.d2d.ui.actions.showPrintDialog"
schemeId="com.raytheon.viz.ui.awips.scheme"
sequence="M1+P">
</key>

View file

@ -57,7 +57,7 @@ public class AddAWIPSProcedure extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Procedure procedure = new Procedure();
ProcedureDlg dlg = new ProcedureDlg(null, procedure,
ProcedureDlg dlg = ProcedureDlg.getOrCreateDialog(null, procedure,
HandlerUtil.getActiveShell(event));
dlg.open();

View file

@ -24,6 +24,8 @@ import java.io.File;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.handlers.HandlerUtil;
import com.raytheon.uf.common.localization.LocalizationFile;
@ -53,6 +55,8 @@ import com.raytheon.viz.ui.actions.LoadSerializedXml;
*/
public class OpenAWIPSProcedure extends AbstractHandler {
private OpenProcedureListDlg dialog;
/*
* (non-Javadoc)
*
@ -62,16 +66,21 @@ public class OpenAWIPSProcedure extends AbstractHandler {
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
ProcedureListDlg listDlg = new OpenProcedureListDlg(
if(dialog != null){
dialog.open();
return null;
}
dialog = new OpenProcedureListDlg(
HandlerUtil.getActiveShell(event));
listDlg.open();
LocalizationFile selectedFile = listDlg.getSelectedFile();
dialog.open();
LocalizationFile selectedFile = dialog.getSelectedFile();
dialog = null;
if (selectedFile != null) {
File f = selectedFile.getFile();
Procedure p = (Procedure) LoadSerializedXml.deserialize(f);
ProcedureDlg dlg = new ProcedureDlg(
ProcedureDlg dlg = ProcedureDlg.getOrCreateDialog(
LocalizationUtil.extractName(selectedFile.getName()), p,
VizWorkbenchManager.getInstance().getCurrentWindow()
.getShell());

View file

@ -23,6 +23,7 @@ package com.raytheon.uf.viz.d2d.ui.dialogs.procedures;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Map.Entry;
@ -83,6 +84,22 @@ import com.raytheon.viz.ui.actions.SaveBundle;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
*
* Dialog for loading or modifying procedures.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
*
* </pre>
*
* @author unknown
* @version 1.0
*/
public class ProcedureDlg extends CaveSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus
@ -94,6 +111,8 @@ public class ProcedureDlg extends CaveSWTDialog {
public static final String PROCEDURES_DIR = "/procedures";
private static Collection<ProcedureDlg> openDialogs = new ArrayList<ProcedureDlg>();
private Font font;
private List dataList;
@ -148,7 +167,7 @@ public class ProcedureDlg extends CaveSWTDialog {
private final java.util.List<BundlePair> bundles;
public ProcedureDlg(String fileName, Procedure p, Shell parent) {
private ProcedureDlg(String fileName, Procedure p, Shell parent) {
// Win32
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL
| CAVE.DO_NOT_BLOCK);
@ -203,6 +222,9 @@ public class ProcedureDlg extends CaveSWTDialog {
@Override
protected void disposed() {
font.dispose();
synchronized (openDialogs) {
openDialogs.remove(this);
}
}
@Override
@ -989,4 +1011,44 @@ public class ProcedureDlg extends CaveSWTDialog {
};
dlg.open();
}
/**
* If there is a procedure dialog open for the given filename, return it,
* otherwise null.
*
* @param fileName
* @return
*/
public static ProcedureDlg getDialog(String fileName) {
synchronized (openDialogs) {
if (fileName != null) {
for (ProcedureDlg dialog : openDialogs) {
if (fileName.equals(dialog.fileName)) {
return dialog;
}
}
}
return null;
}
}
/**
* Get the ProcedureDlg for the given fileName. If the fileName is null or if there is no open dialog, create a new ProcedureDlg.
*
* @param fileName
* @param p
* @param parent
* @return
*/
public static ProcedureDlg getOrCreateDialog(String fileName, Procedure p,
Shell parent) {
synchronized (openDialogs) {
ProcedureDlg dialog = getDialog(fileName);
if (dialog == null) {
dialog = new ProcedureDlg(fileName, p, parent);
openDialogs.add(dialog);
}
return dialog;
}
}
}

View file

@ -54,6 +54,24 @@ import com.raytheon.uf.common.localization.LocalizationUtil;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
*
* A dialog which displays a list of procedures for opening, saving, or deleting.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ??? Initial creation
* 07/31/2012 DR 15036 D. Friedman Ensure current user's procedures
* are visible.
* </pre>
*
* @author unknown
* @version 1.0
*/
public class ProcedureListDlg extends CaveSWTDialog {
protected boolean oneLevel = true;
@ -317,10 +335,18 @@ public class ProcedureListDlg extends CaveSWTDialog {
if (treeViewer.getContentProvider() instanceof ProcedureTreeContentProvider) {
ProcedureTreeContentProvider content = (ProcedureTreeContentProvider) treeViewer
.getContentProvider();
Object find = content.findItem(user);
final Object find = content.findItem(user);
if (find != null) {
treeViewer.setExpandedElements(new Object[] { find });
treeViewer.reveal(find);
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
TreeItem[] items = treeViewer.getTree().getItems();
if (items != null && items.length > 0)
treeViewer.getTree().showItem(items[items.length - 1]);
treeViewer.reveal(find);
}
});
}
}
}
@ -449,14 +475,25 @@ public class ProcedureListDlg extends CaveSWTDialog {
procedureTF.setText(procedureTF.getText().concat(".xml"));
}
if (dataListContains(procedureTF.getText())) {
// Pop up a warning
boolean result = MessageDialog.openQuestion(shell,
"Confirm Overwrite",
"The procedure " + procedureTF.getText()
+ " already exists. Overwrite anyways?");
if (result == true) {
fileName = procedureTF.getText();
shell.dispose();
if (ProcedureDlg.getDialog(procedureTF.getText()) != null) {
// User cannot save if dialog is open.
MessageDialog
.openError(
shell,
"Cannot Save Procedure",
"The procedure "
+ procedureTF.getText()
+ " is currently open. It cannot be overwritten until it is closed or saved under another name.");
} else {
// Pop up a warning
boolean result = MessageDialog.openQuestion(shell,
"Confirm Overwrite",
"The procedure " + procedureTF.getText()
+ " already exists. Overwrite anyways?");
if (result == true) {
fileName = procedureTF.getText();
shell.dispose();
}
}
} else {
fileName = procedureTF.getText();

View file

@ -24,15 +24,15 @@
</Method>
<Method models="HPCGuide" displayName="Total Cloud Cover" name="Multiply">
<Field abbreviation="TCC"/>
<ConstantField value="0.01"/>
<ConstantField value="100.0"/>
</Method>
<Method models="RTMA" displayName="GOES Effective Cloud Amount" name="Multiply">
<Field abbreviation="TCC"/>
<ConstantField value="0.01"/>
<ConstantField value="100.0"/>
</Method>
<Method name="Multiply">
<Field abbreviation="TCC"/>
<ConstantField value="0.01"/>
<ConstantField value="100.0"/>
</Method>
<Method levels="Surface" name="Mapping">
<Field level="Station" abbreviation="clouds_bestCat"/>

View file

@ -18,4 +18,9 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="MnT12hr" name="12-hr Minimum Temperature" unit="K"/>
<DerivedParameter abbreviation="MnT12hr" name="12-hr Minimum Temperature" unit="K">
<Method name="Alias" levels="Surface"
models="MOSGuide" displayName="Minimum Temperature">
<Field abbreviation="MnT12hr" level="2FHAG"/>
</Method>
</DerivedParameter>

View file

@ -18,4 +18,9 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="MxT12hr" name="12-hr Maximum Temperature" unit="K"/>
<DerivedParameter abbreviation="MxT12hr" name="12-hr Maximum Temperature" unit="K">
<Method name="Alias" levels="Surface"
models="MOSGuide" displayName="Maximum Temperature">
<Field abbreviation="MxT12hr" level="2FHAG"/>
</Method>
</DerivedParameter>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter unit="m/s" name="Total Wind (Vector)" abbreviation="Wind">
<DerivedParameter unit="m/s" name="Wind" abbreviation="Wind">
<Method name="Vector">
<Field abbreviation="uW"/>
<Field abbreviation="vW"/>

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,45 +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

@ -79,6 +79,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- --------------------------
* Oct 13, 2009 dhladky Initial creation
*
* Jul 24 2012 12996 Xiaochuan Compare with MidVal()
*
* </pre>
*
* @author dhladky
@ -359,7 +361,7 @@ public class ScanResource extends
d = Double.valueOf(rank);
}
if (d >= getScanDrawer().ddfc.getLowerVal()) {
if (d >= getScanDrawer().ddfc.getMidVal()) {
if (!getScanDrawer().ddfc.isOverlap()) {
if ((dtdr != null) && !dtdr.getOverlap()) {
isOverlap = false;

View file

@ -902,192 +902,232 @@ public final class TableUtil {
return null;
}
private static TableRowData getSnowMetarHistTableRowData(ObReport report) {
TableRowData tblRowData = new TableRowData(8);
tblRowData.setTableCellData(0, new TableCellData(report.getObservationTime(),"HH:mm MMM dd",CellType.ObsHist));
tblRowData.setTableCellData(1,
new TableCellData(Math.round(new Float(report.getWindDir())),
CellType.ObsHist, true));
tblRowData.setTableCellData(2,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(3,
new TableCellData(Math.round(new Float(report.getWindGust())),
CellType.ObsHist, true));
tblRowData.setTableCellData(4, new TableCellData(report.getPressure(), CellType.ObsHist, CommonTableConfig.obsHistCols.P));
tblRowData.setTableCellData(
5,
new TableCellData(
Math.round(new Float(report.getTemperature())),
CellType.ObsHist, true));
tblRowData.setTableCellData(6,
new TableCellData(Math.round(new Float(report.getDewpoint())),
CellType.ObsHist, true));
tblRowData.setTableCellData(7, new TableCellData(report.getPressureChange(), CellType.ObsHist, CommonTableConfig.obsHistCols.PTend));
return tblRowData;
}
private static TableRowData getSnowMetarHistTableRowData(ObReport report) {
TableRowData tblRowData = new TableRowData(10);
tblRowData.setTableCellData(0,
new TableCellData(report.getObservationTime(), "HH:mm MMM dd",
CellType.ObsHist));
tblRowData.setTableCellData(1,
new TableCellData(new Float(report.getLatitude()),
CellType.ObsHist, true));
tblRowData.setTableCellData(2,
new TableCellData(new Float(report.getLongitude()),
CellType.ObsHist, true));
tblRowData.setTableCellData(3,
new TableCellData(Math.round(new Float(report.getWindDir())),
CellType.ObsHist, true));
tblRowData.setTableCellData(4,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(5,
new TableCellData(Math.round(new Float(report.getWindGust())),
CellType.ObsHist, true));
tblRowData.setTableCellData(6, new TableCellData(report.getPressure(),
CellType.ObsHist, CommonTableConfig.obsHistCols.P));
tblRowData.setTableCellData(7,
new TableCellData(
Math.round(new Float(report.getTemperature())),
CellType.ObsHist, true));
tblRowData.setTableCellData(8,
new TableCellData(Math.round(new Float(report.getDewpoint())),
CellType.ObsHist, true));
tblRowData.setTableCellData(9,
new TableCellData(report.getPressureChange(), CellType.ObsHist,
CommonTableConfig.obsHistCols.PTend));
return tblRowData;
}
private static TableRowData getSafeSeasMetarHistTableRowData(ObReport report) {
// same as getSnowHistTableRowData
return getSnowMetarHistTableRowData(report);
}
private static TableRowData getSafeseasMaritimeHistTableRowData(ObReport report) {
TableRowData tblRowData = new TableRowData(15);
tblRowData.setTableCellData(0, new TableCellData(report.getObservationTime(),"HH:mm MMM dd",CellType.ObsHist));
tblRowData.setTableCellData(1,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
2,
new TableCellData(
Math.round(new Float(report.getMaxWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(3,
new TableCellData(Math.round(new Float(report.getWindGust())),
CellType.ObsHist, true));
tblRowData.setTableCellData(4,
new TableCellData(
Math.round(new Float(report.getVisibility())),
CellType.ObsHist, true));
tblRowData.setTableCellData(5, new TableCellData(report.getPressure(), CellType.ObsHist, CommonTableConfig.obsHistCols.P));
tblRowData.setTableCellData(
6,
new TableCellData(Math.round(new Float(report
.getPressureChange())), CellType.ObsHist, true));
tblRowData.setTableCellData(
7,
new TableCellData(
Math.round(new Float(report.getTemperature())),
CellType.ObsHist, true));
tblRowData.setTableCellData(8,
new TableCellData(Math.round(new Float(report.getDewpoint())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
9,
new TableCellData(Math.round(new Float(report
.getSeaSurfaceTemp())), CellType.ObsHist, true));
tblRowData.setTableCellData(
10,
new TableCellData(Math.round(new Float(report
.getHighResWaveHeight())), CellType.ObsHist, true));
tblRowData.setTableCellData(
11,
new TableCellData(Math.round(new Float(report
.getWaveSteepness())), CellType.ObsHist, true));
tblRowData.setTableCellData(
12,
new TableCellData(
Math.round(new Float(report.getPSwellHeight())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
13,
new TableCellData(
Math.round(new Float(report.getPSwellPeriod())),
CellType.ObsHist, true));
tblRowData.setTableCellData(14,
new TableCellData(Math.round(new Float(report.getPSwellDir())),
CellType.ObsHist, true));
return tblRowData;
}
private static TableRowData getSafeseasMaritimeHistTableRowData(
ObReport report) {
TableRowData tblRowData = new TableRowData(17);
tblRowData.setTableCellData(0,
new TableCellData(report.getObservationTime(), "HH:mm MMM dd",
CellType.ObsHist));
tblRowData.setTableCellData(1,
new TableCellData(new Float(report.getLatitude()),
CellType.ObsHist, true));
tblRowData.setTableCellData(2,
new TableCellData(new Float(report.getLongitude()),
CellType.ObsHist, true));
tblRowData.setTableCellData(3,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
4,
new TableCellData(
Math.round(new Float(report.getMaxWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(5,
new TableCellData(Math.round(new Float(report.getWindGust())),
CellType.ObsHist, true));
tblRowData.setTableCellData(6,
new TableCellData(
Math.round(new Float(report.getVisibility())),
CellType.ObsHist, true));
tblRowData.setTableCellData(7, new TableCellData(report.getPressure(),
CellType.ObsHist, CommonTableConfig.obsHistCols.P));
tblRowData.setTableCellData(
8,
new TableCellData(Math.round(new Float(report
.getPressureChange())), CellType.ObsHist, true));
tblRowData.setTableCellData(
9,
new TableCellData(
Math.round(new Float(report.getTemperature())),
CellType.ObsHist, true));
tblRowData.setTableCellData(10,
new TableCellData(Math.round(new Float(report.getDewpoint())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
11,
new TableCellData(Math.round(new Float(report
.getSeaSurfaceTemp())), CellType.ObsHist, true));
tblRowData.setTableCellData(
12,
new TableCellData(Math.round(new Float(report
.getHighResWaveHeight())), CellType.ObsHist, true));
tblRowData.setTableCellData(
13,
new TableCellData(Math.round(new Float(report
.getWaveSteepness())), CellType.ObsHist, true));
tblRowData.setTableCellData(
14,
new TableCellData(
Math.round(new Float(report.getPSwellHeight())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
15,
new TableCellData(
Math.round(new Float(report.getPSwellPeriod())),
CellType.ObsHist, true));
tblRowData.setTableCellData(16,
new TableCellData(Math.round(new Float(report.getPSwellDir())),
CellType.ObsHist, true));
return tblRowData;
}
private static TableRowData getFogMaritimeHistTableRowData(ObReport report) {
TableRowData tblRowData = new TableRowData(16);
tblRowData.setTableCellData(0, new TableCellData(report.getObservationTime(),"HH:mm MMM dd",CellType.ObsHist));
tblRowData.setTableCellData(1,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
2,
new TableCellData(
Math.round(new Float(report.getMaxWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(3,
new TableCellData(Math.round(new Float(report.getWindGust())),
CellType.ObsHist, true));
tblRowData.setTableCellData(4,
new TableCellData(
Math.round(new Float(report.getVisibility())),
CellType.ObsHist, true));
tblRowData.setTableCellData(5, new TableCellData(report.getPressure(), CellType.ObsHist, CommonTableConfig.obsHistCols.P));
tblRowData.setTableCellData(
6,
new TableCellData(Math.round(new Float(report
.getPressureChange())), CellType.ObsHist, true));
tblRowData.setTableCellData(
7,
new TableCellData(
Math.round(new Float(report.getTemperature())),
CellType.ObsHist, true));
tblRowData.setTableCellData(8,
new TableCellData(Math.round(new Float(report.getDewpoint())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
9,
new TableCellData(Math.round(new Float(report
.getSeaSurfaceTemp())), CellType.ObsHist, true));
tblRowData.setTableCellData(
10,
new TableCellData(Math.round(new Float(report
.getHighResWaveHeight())), CellType.ObsHist, true));
tblRowData.setTableCellData(
11,
new TableCellData(Math.round(new Float(report
.getWaveSteepness())), CellType.ObsHist, true));
tblRowData.setTableCellData(
12,
new TableCellData(
Math.round(new Float(report.getPSwellHeight())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
13,
new TableCellData(
Math.round(new Float(report.getPSwellPeriod())),
CellType.ObsHist, true));
tblRowData.setTableCellData(14,
new TableCellData(Math.round(new Float(report.getPSwellDir())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
15,
new TableCellData(Math.round(new Float(report
.getRelativeHumidity())), CellType.ObsHist, true));
return tblRowData;
}
private static TableRowData getFogMaritimeHistTableRowData(ObReport report) {
TableRowData tblRowData = new TableRowData(18);
tblRowData.setTableCellData(0,
new TableCellData(report.getObservationTime(), "HH:mm MMM dd",
CellType.ObsHist));
tblRowData.setTableCellData(1,
new TableCellData(new Float(report.getLatitude()),
CellType.ObsHist, true));
tblRowData.setTableCellData(2,
new TableCellData(new Float(report.getLongitude()),
CellType.ObsHist, true));
tblRowData.setTableCellData(3,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
4,
new TableCellData(
Math.round(new Float(report.getMaxWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(5,
new TableCellData(Math.round(new Float(report.getWindGust())),
CellType.ObsHist, true));
tblRowData.setTableCellData(6,
new TableCellData(
Math.round(new Float(report.getVisibility())),
CellType.ObsHist, true));
tblRowData.setTableCellData(7, new TableCellData(report.getPressure(),
CellType.ObsHist, CommonTableConfig.obsHistCols.P));
tblRowData.setTableCellData(
8,
new TableCellData(Math.round(new Float(report
.getPressureChange())), CellType.ObsHist, true));
tblRowData.setTableCellData(
9,
new TableCellData(
Math.round(new Float(report.getTemperature())),
CellType.ObsHist, true));
tblRowData.setTableCellData(10,
new TableCellData(Math.round(new Float(report.getDewpoint())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
11,
new TableCellData(Math.round(new Float(report
.getSeaSurfaceTemp())), CellType.ObsHist, true));
tblRowData.setTableCellData(
12,
new TableCellData(Math.round(new Float(report
.getHighResWaveHeight())), CellType.ObsHist, true));
tblRowData.setTableCellData(
13,
new TableCellData(Math.round(new Float(report
.getWaveSteepness())), CellType.ObsHist, true));
tblRowData.setTableCellData(
14,
new TableCellData(
Math.round(new Float(report.getPSwellHeight())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
15,
new TableCellData(
Math.round(new Float(report.getPSwellPeriod())),
CellType.ObsHist, true));
tblRowData.setTableCellData(16,
new TableCellData(Math.round(new Float(report.getPSwellDir())),
CellType.ObsHist, true));
tblRowData.setTableCellData(
17,
new TableCellData(Math.round(new Float(report
.getRelativeHumidity())), CellType.ObsHist, true));
return tblRowData;
}
private static TableRowData getFogMetarHistTableRowData(ObReport report) {
TableRowData tblRowData = new TableRowData(12);
tblRowData.setTableCellData(0, new TableCellData(report.getObservationTime(),"HH:mm MMM dd",CellType.ObsHist));
tblRowData.setTableCellData(
1,
new TableCellData(Math.round(new Float(report
.getRelativeHumidity())), CellType.ObsHist, true));
tblRowData.setTableCellData(2,
new TableCellData(
Math.round(new Float(report.getVisibility())),
CellType.ObsHist, true));
tblRowData.setTableCellData(3,
new TableCellData(Math.round(new Float(report.getCeiling())),
CellType.ObsHist, true));
tblRowData.setTableCellData(4,
new TableCellData(Math.round(new Float(report.getWindDir())),
CellType.ObsHist, true));
tblRowData.setTableCellData(5,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(6,
new TableCellData(Math.round(new Float(report.getWindGust())),
CellType.ObsHist, true));
tblRowData.setTableCellData(7, new TableCellData(report.getPressure(), CellType.ObsHist, CommonTableConfig.obsHistCols.P));
int tmph = Math.round(new Float(report.getTemperature()));
int dpth = Math.round(new Float(report.getDewpoint()));
tblRowData.setTableCellData(8, new TableCellData(tmph,
CellType.ObsHist, true));
tblRowData.setTableCellData(9, new TableCellData(dpth,
CellType.ObsHist, true));
tblRowData.setTableCellData(10, new TableCellData(tmph - dpth,
CellType.ObsHist, true));
tblRowData.setTableCellData(11, new TableCellData(report.getPressureChange(), CellType.ObsHist, CommonTableConfig.obsHistCols.PTend));
return tblRowData;
}
private static TableRowData getFogMetarHistTableRowData(ObReport report) {
TableRowData tblRowData = new TableRowData(14);
tblRowData.setTableCellData(0,
new TableCellData(report.getObservationTime(), "HH:mm MMM dd",
CellType.ObsHist));
tblRowData.setTableCellData(1,
new TableCellData(new Float(report.getLatitude()),
CellType.ObsHist, true));
tblRowData.setTableCellData(2,
new TableCellData(new Float(report.getLongitude()),
CellType.ObsHist, true));
tblRowData.setTableCellData(
3,
new TableCellData(Math.round(new Float(report
.getRelativeHumidity())), CellType.ObsHist, true));
tblRowData.setTableCellData(4,
new TableCellData(
Math.round(new Float(report.getVisibility())),
CellType.ObsHist, true));
tblRowData.setTableCellData(5,
new TableCellData(Math.round(new Float(report.getCeiling())),
CellType.ObsHist, true));
tblRowData.setTableCellData(6,
new TableCellData(Math.round(new Float(report.getWindDir())),
CellType.ObsHist, true));
tblRowData.setTableCellData(7,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
CellType.ObsHist, true));
tblRowData.setTableCellData(8,
new TableCellData(Math.round(new Float(report.getWindGust())),
CellType.ObsHist, true));
tblRowData.setTableCellData(9, new TableCellData(report.getPressure(),
CellType.ObsHist, CommonTableConfig.obsHistCols.P));
int tmph = Math.round(new Float(report.getTemperature()));
int dpth = Math.round(new Float(report.getDewpoint()));
tblRowData.setTableCellData(10, new TableCellData(tmph,
CellType.ObsHist, true));
tblRowData.setTableCellData(11, new TableCellData(dpth,
CellType.ObsHist, true));
tblRowData.setTableCellData(12, new TableCellData(tmph - dpth,
CellType.ObsHist, true));
tblRowData.setTableCellData(13,
new TableCellData(report.getPressureChange(), CellType.ObsHist,
CommonTableConfig.obsHistCols.PTend));
return tblRowData;
}
}

View file

@ -301,7 +301,7 @@ public class StationTableComp extends TableComp {
* @param name
*/
public void setIdLabel(String name) {
idLbl.setText("Zone/County: " + name);
idLbl.setText("Zone/County: "+ this.id +" - "+ name);
controlComp.layout();
}

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

@ -61,7 +61,6 @@ import com.raytheon.rcm.mqsrvr.ReqObj;
import com.raytheon.rcm.rmr.RmrEvent;
import com.raytheon.uf.common.dataplugin.radar.request.RadarServerConnectionRequest;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.preferences.JMSPreferences;
import com.raytheon.uf.viz.core.requests.ThriftClient;
// TODO: use of queueSession outside synchronized(stateLock) could cause
@ -69,6 +68,23 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
// TODO: conflicts over setting fatalMsg
/**
* Manages client connection to RadarServer
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ------------ --------------------------
* ???? D. Friedman Initial version
* 2012-07-27 DR 14896 D. Friedman Fix even topic name
*
* </pre>
*
* @author dfriedma
* @version 1.0
*/
public class RcmClient implements MessageListener, ExceptionListener {
private String connectionURL;
@ -211,6 +227,11 @@ public class RcmClient implements MessageListener, ExceptionListener {
return;
}
/*
* TODO: ActiveMQ is hard-coded. If switching to Qpid or another
* service, it may be necessary to use JMSPreferences.getPolicyString on
* the topic name below.
*/
ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(uri);
// This stuff can block...
try {
@ -238,8 +259,7 @@ public class RcmClient implements MessageListener, ExceptionListener {
topicConn.setExceptionListener(this);
topicSession = topicConn.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
topic = topicSession.createTopic(JMSPreferences
.getPolicyString("RadarEvents"));
topic = topicSession.createTopic("RadarEvents");
queueConn.start();
topicConn.start();

View file

@ -231,11 +231,13 @@ public abstract class AbstractCrossSectionResource extends
time = time.clone();
time.setLevelValue((double) i);
times.add(time);
sliceMap.put(time, null);
dataRetrievalJob.times.add(time);
}
}
dataTimes = new ArrayList<DataTime>(times);
Collections.sort(dataTimes);
sliceMap.clear();
dataRetrievalJob.schedule();
}
protected void loadSlice(DataTime time) throws VizException {

View file

@ -138,10 +138,12 @@ public class CrossSectionImageResource extends AbstractCrossSectionResource
super.initInternal(target);
// defaults
ImagingCapability imageCap = getCapability(ImagingCapability.class);
imageCap.setInterpolationState(true);
imageCap.setBrightness(1.0f);
imageCap.setContrast(1.0f);
if (!hasCapability(ImagingCapability.class)) {
ImagingCapability imageCap = getCapability(ImagingCapability.class);
imageCap.setInterpolationState(true);
imageCap.setBrightness(1.0f);
imageCap.setContrast(1.0f);
}
}
private IImage constructImage(float[] floatData, IGraphicsTarget target)

View file

@ -450,6 +450,7 @@ public abstract class AbstractTimeHeightResource extends
secondaryResource.setDescriptor(descriptor);
}
super.setDescriptor(descriptor);
interpolatedData = null;
loadDataJob.schedule();
}

View file

@ -26,6 +26,7 @@ import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
import java.util.TimeZone;
import java.util.TreeSet;
@ -76,6 +77,7 @@ import com.raytheon.viz.core.graphing.util.GraphPrefsFactory;
import com.raytheon.viz.core.graphing.xy.XYData;
import com.raytheon.viz.core.graphing.xy.XYDataList;
import com.raytheon.viz.core.graphing.xy.XYImageData;
import com.raytheon.viz.core.graphing.xy.XYWindImageData;
import com.raytheon.viz.core.rsc.ICombinedResourceData;
import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation;
import com.raytheon.viz.core.style.graph.GraphPreferences;
@ -157,10 +159,22 @@ public class TimeSeriesResource extends
if (currentUnit.isCompatible(prefs.getDisplayUnits())) {
UnitConverter conv = currentUnit.getConverterTo(prefs
.getDisplayUnits());
for (XYData d : data.getData()) {
double converted = conv.convert(((Number) d.getY())
.doubleValue());
d.setY(converted);
ListIterator<XYData> it = data.getData().listIterator();
while(it.hasNext()) {
XYData d = it.next();
if(d instanceof XYWindImageData){
XYWindImageData wind = (XYWindImageData) d;
double converted = conv.convert(wind.getWindSpd());
it.remove();
if(wind.getImage() != null){
wind.getImage().dispose();
}
it.add(new XYWindImageData(wind.getX(), wind.getY(), converted, wind.getWindDir()));
}else{
double converted = conv.convert(((Number) d.getY())
.doubleValue());
d.setY(converted);
}
}
units = prefs.getDisplayUnitLabel();
} else {
@ -457,13 +471,6 @@ public class TimeSeriesResource extends
String lat = nf.format(Math.abs(y));
String stnID = "";
String source = resourceData.getSource();
String unit = "";
if (prefs != null && prefs.getDisplayUnits() != null) {
unit = prefs.getDisplayUnitLabel();
} else {
unit = adapter.getDataUnit().toString();
}
if (resourceData.getMetadataMap().get("location.stationId") != null) {
stnID = resourceData.getMetadataMap().get("location.stationId")
@ -488,7 +495,7 @@ public class TimeSeriesResource extends
sb.append(" ").append(resourceData.getLevelKey());
}
sb.append(String.format(" %s %s %s", adapter.getParameterName(),
"TSer", unit != null && unit.equals("") == false ? "(" + unit
"TSer", units != null && units.equals("") == false ? "(" + units
+ ")" : ""));
if (secondaryResource != null) {

View file

@ -26,6 +26,7 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
import com.raytheon.uf.viz.d2d.core.ID2DRenderableDisplay;
@ -75,30 +76,29 @@ public class ScaleHandler extends AbstractHandler {
* @param scale
*/
static void setScale(IDisplayPaneContainer editor, String scale) {
if (editor.getActiveDisplayPane().getRenderableDisplay() instanceof ID2DRenderableDisplay) {
ID2DRenderableDisplay disp = (ID2DRenderableDisplay) editor
.getActiveDisplayPane().getRenderableDisplay();
for (IDisplayPane pane : editor.getDisplayPanes()) {
if (pane.getRenderableDisplay() instanceof ID2DRenderableDisplay) {
ID2DRenderableDisplay disp = (ID2DRenderableDisplay) pane
.getRenderableDisplay();
if (scale.equals(disp.getScale())) {
// don't set the scale if it is the same as the display's
// current scale
return;
}
if (scale.equals(disp.getScale())) {
// don't set the scale if it is the same as the display's
// current
// scale
return;
disp.setScale(scale);
if (pane == editor.getActiveDisplayPane()) {
VizGlobalsManager.getCurrentInstance().updateChanges(
editor.getActiveDisplayPane()
.getRenderableDisplay().getGlobalsMap());
}
}
disp.setScale(scale);
// update the scale button
final ICommandService service = (ICommandService) PlatformUI
.getWorkbench().getService(ICommandService.class);
VizGlobalsManager.getCurrentInstance().updateChanges(
editor.getActiveDisplayPane().getRenderableDisplay()
.getGlobalsMap());
service.refreshElements(
"com.raytheon.uf.viz.xy.height.scalebutton", null);
}
ICommandService service = (ICommandService) PlatformUI.getWorkbench()
.getService(ICommandService.class);
service.refreshElements("com.raytheon.uf.viz.xy.height.scalebutton",
null);
}
}

View file

@ -87,5 +87,12 @@
value="aviation/config"
recursive="true">
</path>
<path
application="AvnFPS"
localizationType="CAVE_STATIC"
name="Avnwatch"
value="aviation/avnwatch"
recursive="true">
</path>
</extension>
</plugin>

View file

@ -55,7 +55,6 @@ import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.HelpUsageDlg;
import com.raytheon.viz.avnconfig.ITafSiteConfig;
@ -80,6 +79,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 9/12/2008 1444 grichard Accommodate separate message logs.
* 3/31/2011 8774 rferrel killProcess when doing a disposed
* 4/14/2011 8861 rferrel Use SaveImageDlg class
* 23JUL2012 15169 zhao Use Combo for 'Month' and 'Number of Months'
* & disabled site controls while drawing
*
* </pre>
*
@ -101,14 +102,14 @@ public class WindRosePlotDlg extends CaveSWTDialog {
private List siteList;
/**
* Month spinner.
* Month
*/
private Spinner monthSpnr;
private Combo monthCbo;
/**
* Number of months.
*/
private Spinner numMonthsSpnr;
private Combo numMonthsCbo;
/**
* Hours spinner.
@ -427,20 +428,19 @@ public class WindRosePlotDlg extends CaveSWTDialog {
Label monthLbl = new Label(monthHourComp, SWT.NONE);
monthLbl.setText("Month:");
gd = new GridData(40, SWT.DEFAULT);
monthSpnr = new Spinner(monthHourComp, SWT.BORDER);
monthSpnr.setDigits(0);
monthSpnr.setIncrement(1);
monthSpnr.setPageIncrement(3);
monthSpnr.setMinimum(1);
monthSpnr.setMaximum(12);
monthSpnr.setSelection(cal.get(Calendar.MONTH) + 1);
monthSpnr.setLayoutData(gd);
monthSpnr.addSelectionListener(new SelectionAdapter() {
gd = new GridData(66, SWT.DEFAULT);
monthCbo = new Combo(monthHourComp, SWT.DROP_DOWN | SWT.READ_ONLY);
monthCbo.setLayoutData(gd);
for ( int i = 1; i <= 12; i++ ) {
monthCbo.add(""+i, i-1);
}
monthCbo.select(cal.get(Calendar.MONTH));
monthCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
//System.out.println(" *************** monthsCbo.getText() = " + monthCbo.getText() );
if (autoRedrawChk.getSelection()) {
redrawWindRose();
redrawWindRose();
}
}
});
@ -448,20 +448,19 @@ public class WindRosePlotDlg extends CaveSWTDialog {
Label numMonthLbl = new Label(monthHourComp, SWT.NONE);
numMonthLbl.setText("Num Months:");
gd = new GridData(40, SWT.DEFAULT);
numMonthsSpnr = new Spinner(monthHourComp, SWT.BORDER);
numMonthsSpnr.setDigits(0);
numMonthsSpnr.setIncrement(1);
numMonthsSpnr.setPageIncrement(3);
numMonthsSpnr.setMinimum(1);
numMonthsSpnr.setMaximum(12);
numMonthsSpnr.setSelection(1);
numMonthsSpnr.setLayoutData(gd);
numMonthsSpnr.addSelectionListener(new SelectionAdapter() {
gd = new GridData(66, SWT.DEFAULT);
numMonthsCbo = new Combo(monthHourComp, SWT.DROP_DOWN | SWT.READ_ONLY);
numMonthsCbo.setLayoutData(gd);
for ( int i = 1; i <= 12; i++ ) {
numMonthsCbo.add(""+i, i-1);
}
numMonthsCbo.select(0);
numMonthsCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
//System.out.println(" *************** numMonthsCbo.getText() = " + numMonthsCbo.getText() );
if (autoRedrawChk.getSelection()) {
redrawWindRose();
redrawWindRose();
}
}
});
@ -586,8 +585,10 @@ public class WindRosePlotDlg extends CaveSWTDialog {
generateWindRoseHeader();
windRoseCanvasComp.updateAndRedraw(windRoseConfigData.cloneData(),
windRoseHeader, monthSpnr.getText(),
numMonthsSpnr.getText(), hourSpnr.getText(),
windRoseHeader,
monthCbo.getText(),
numMonthsCbo.getText(),
hourSpnr.getText(),
numHoursSpnr.getText(), flightCatCbo.getSelectionIndex(),
siteList.getItem(siteList.getSelectionIndex()), this);
}
@ -599,11 +600,21 @@ public class WindRosePlotDlg extends CaveSWTDialog {
if (state == true) {
++busyCount;
shell.setCursor(waitCursor);
monthCbo.setEnabled(false);
numMonthsCbo.setEnabled(false);
hourSpnr.setEnabled(false);
numHoursSpnr.setEnabled(false);
flightCatCbo.setEnabled(false);
drawBtn.setEnabled(false);
} else {
--busyCount;
if (busyCount == 0) {
shell.setCursor(defaultCursor);
monthCbo.setEnabled(true);
numMonthsCbo.setEnabled(true);
hourSpnr.setEnabled(true);
numHoursSpnr.setEnabled(true);
flightCatCbo.setEnabled(true);
drawBtn.setEnabled(true);
}
}
@ -634,23 +645,21 @@ public class WindRosePlotDlg extends CaveSWTDialog {
header.append(siteList.getItem(siteList.getSelectionIndex()));
header.append(" ");
header.append(MONTHS[monthSpnr.getSelection() - 1]);
header.append(MONTHS[monthCbo.getSelectionIndex()]);
if (numMonthsSpnr.getSelection() == 1) {
if ( numMonthsCbo.getSelectionIndex() == 0 ) {
header.append(" ");
} else {
header.append("-");
int endMonth = 0;
if (((numMonthsSpnr.getSelection() - 1) + monthSpnr.getSelection()) > 12) {
endMonth = (numMonthsSpnr.getSelection() - 1)
+ monthSpnr.getSelection() - 12;
header.append(MONTHS[endMonth - 1]);
if ( ( numMonthsCbo.getSelectionIndex() + monthCbo.getSelectionIndex() ) > 11 ) {
endMonth = numMonthsCbo.getSelectionIndex() + monthCbo.getSelectionIndex() - 12;
header.append(MONTHS[endMonth]);
} else {
endMonth = (numMonthsSpnr.getSelection() - 1)
+ monthSpnr.getSelection();
header.append(MONTHS[endMonth - 1]);
endMonth = numMonthsCbo.getSelectionIndex() + monthCbo.getSelectionIndex();
header.append(MONTHS[endMonth]);
}
header.append(" ");
}

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

@ -26,6 +26,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.util.ArrayList;
@ -69,6 +70,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 7/1/06 chammack Initial Creation.
* 1/10/08 562 bphillip Modified to handle .bcx files
* 02/11/09 njensen Refactored to new rsc architecture
* 07/31/12 DR 14935 D. Friedman Handle little-endian files
*
* </pre>
*
@ -190,6 +192,14 @@ public class BCDResource extends
ByteBuffer buffer = fc.map(MapMode.READ_ONLY, 0, file.length());
// Determine byte order of data
if (buffer.remaining() >= 4) {
// Whether BCX or not, first value is an int.
// Note: Different from A1 which tests >31 or >500
if (buffer.getInt(0) > Short.MAX_VALUE)
buffer.order(ByteOrder.LITTLE_ENDIAN);
}
int i = 0;
double minLat = Double.MAX_VALUE;

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

@ -718,10 +718,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) {
@ -735,9 +732,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

@ -88,6 +88,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* practice and test modes
* Sep 16, 2010 6831 ryu Show same product for different areas on a sub-menu
* Nov 22, 2011 8781 mli remove Processor menu
* Jul 26, 2012 15165 ryu Set default db source when formatter has no db defined.
*
* </pre>
*
@ -776,6 +777,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
ProductDefinition prodDef = textProductMgr
.getProductDefinition(productName);
String dataSource = (String) prodDef.get("database");
if (dataSource == null)
dataSource = "Official";
if (dataSource.equals("ISC")) {
selectedDataSource = getIscDataSource();

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

@ -66,6 +66,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/08/2008 chammack Initial Port from AWIPS I (minus ISC support)
* 07/23/2012 #936 dgilling Reinstate config-handling code to
* calcGridLabels().
*
* </pre>
*
@ -253,7 +255,7 @@ public class SamplePainter {
private void calcGridLabels(Coordinate worldLoc, final List<GridID> grids,
final GridID imageGrid, List<String> sampleLabels, List<RGB> colors) {
if (grids.size() == 0) {
if (grids.isEmpty()) {
return;
}
@ -261,9 +263,9 @@ public class SamplePainter {
// all parms
List<String> limitSamples = Arrays.asList(Activator.getDefault()
.getPreferenceStore().getStringArray("SampleParms"));
// assumes all grids shared same grid location.
boolean inGrid = false;
Coordinate gridCoordinate = MapUtil.latLonToGridCoordinate(worldLoc,
PixelOrientation.UPPER_LEFT, grids.get(0).getParm()
.getGridInfo().getGridLoc());
@ -280,27 +282,41 @@ public class SamplePainter {
inGrid = true;
}
// sample label color
RGB labelColor = new RGB(255, 255, 255);
// get the list of samples that should be painted and in the
// order
for (GridID grid : grids) {
String pName = grid.getParm().getParmID().compositeNameUI();
// do we plot this weather element?
if ((limitSamples.size() != 0) && !limitSamples.contains(pName)) {
if ((!limitSamples.isEmpty()) && !limitSamples.contains(pName)) {
continue; // skip
}
// calculate color
RGB labelColor = grid.getParm().getDisplayAttributes()
.getBaseColor();
if (grid.equals(imageGrid)) {
RGB color = new RGB(255, 255, 255);
String colorName = Activator.getDefault().getPreferenceStore()
.getString("ImageLegend_color");
if (!colorName.isEmpty()) {
color = RGBColors.getRGBColor(colorName);
}
labelColor = color;
}
String parmColorName = Activator.getDefault().getPreferenceStore()
.getString(pName + "_Sample_color");
if (!parmColorName.isEmpty()) {
labelColor = RGBColors.getRGBColor(parmColorName);
}
// get the data value
String label = NO_DATA_LABEL;
if (inGrid) {
// isc mode or grid from isc database
if (showISC || grid.getParm().getParmState().isIscParm()) {
label = iscSampleLabel(grid, gridCoordinate);
} else if (showDataValues) {
final IGridData gridData = grid.grid();
if (gridData != null) {

View file

@ -38,6 +38,7 @@ import com.raytheon.viz.gfe.core.msgs.Message;
import com.raytheon.viz.gfe.core.msgs.Message.IMessageClient;
import com.raytheon.viz.gfe.core.msgs.ShowQuickViewDataMsg;
import com.raytheon.viz.gfe.core.parm.Parm;
import com.raytheon.viz.gfe.core.parm.ParmDisplayAttributes.VisMode;
import com.raytheon.viz.gfe.edittool.EditToolPaintProperties;
import com.raytheon.viz.gfe.edittool.GridID;
import com.raytheon.viz.gfe.rsc.GFEFonts;
@ -45,16 +46,18 @@ import com.vividsolutions.jts.geom.Coordinate;
/**
* Handles the display for on-demand sampling capability.
*
* Roughly based on AWIPS I class of the same name.
* <p>
* Roughly based on AWIPS I class SampleVisual.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/08/2008 chammack Initial Creation.
* 11Jun2008 #1193 ebabin Updates for toggling lat/lon for sample set.
* 06/11/2008 #1193 ebabin Updates for toggling lat/lon for sample set.
* 07/21/2009 bphillip Removed the points field
* 07/23/2012 #936 dgilling Properly retrieve imageGrid for paintMarkers()
* and paintSamples().
*
* </pre>
*
@ -148,13 +151,17 @@ public class SampleRenderable implements IRenderable, IMessageClient {
imageGrid = qvGrid;
} else {
Parm[] parms = sdm.getCurrentlyEnabledParms();
Parm imageParm = sdm.getActivatedParm();
Parm imageParm = null;
Arrays.sort(parms);
gids = new ArrayList<GridID>(parms.length);
Date date = sdm.getSpatialEditorTime();
for (int i = 0; i < parms.length; i++) {
gids.add(new GridID(parms[i], date));
for (Parm p : parms) {
gids.add(new GridID(p, date));
if (p.getDisplayAttributes().getVisMode() == VisMode.IMAGE) {
imageParm = p;
}
}
imageGrid = new GridID(imageParm, date);
@ -184,12 +191,16 @@ public class SampleRenderable implements IRenderable, IMessageClient {
Date date = sdm.getSpatialEditorTime();
Parm[] parms = sdm.getCurrentlyEnabledParms();
Parm imageParm = sdm.getActivatedParm();
Parm imageParm = null;
Arrays.sort(parms);
GridID[] grids = new GridID[parms.length];
for (int i = 0; i < parms.length; i++) {
grids[i] = new GridID(parms[i], date);
if (parms[i].getDisplayAttributes().getVisMode() == VisMode.IMAGE) {
imageParm = parms[i];
}
}
GridID imageGrid = new GridID(imageParm, date);

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

@ -603,7 +603,9 @@ public class Tool {
parmToEdit.startParmEdit(new Date[] { timeInfluence });
} catch (GFEOperationFailedException e) {
statusHandler.handle(Priority.PROBLEM,
"Error during start parm edit", e);
"Error during start parm edit for " + toolName + " - already running." +
" Please wait for the operation to complete and try again.",
e);
return;
}
startedParmEdit = true;

View file

@ -2422,12 +2422,12 @@
<imageStyle>
<displayUnits>%</displayUnits>
<range scale="LINEAR">
<minValue>5</minValue>
<minValue>-1</minValue>
<maxValue>105</maxValue>
</range>
<defaultColormap>Grid/warm to cold</defaultColormap>
<colorbarLabeling>
<increment>20</increment>
<values>20 40 60 80 100</values>
</colorbarLabeling>
</imageStyle>
</styleRule>

View file

@ -162,6 +162,7 @@ public class GridResourceData extends AbstractRequestableResourceData implements
sampling = sampling == null ? false : sampling;
return new GridIconResource(this, loadProperties);
case BARB:
sampling = sampling == null ? false : sampling;
case ARROW:
case DUALARROW:
case STREAMLINE:
@ -170,7 +171,7 @@ public class GridResourceData extends AbstractRequestableResourceData implements
// grib data in D2D is in one location. There are only a few
// products that do not work correctly, contours of vector
// direction, and data mapped images.
sampling = sampling == null ? false : sampling;
sampling = sampling == null ? true : sampling;
return new D2DGribGridResource(this, loadProperties);
case CONTOUR:
default:

View file

@ -109,6 +109,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 05/16/2012 14993 D. Friedman Fix "blocky" contours
* 06/19/2012 14988 D. Friedman Reproject based on conformality
* 07/09/2012 14940 M. Porricelli Apply reprojection to streamlines
* 07/23/2012 14968 M. Porricelli Changed wording of streamline legend
*
* </pre>
*
@ -491,7 +492,7 @@ public class GridVectorResource extends AbstractMapVectorResource implements
legendParams.dataTime = getDisplayedDataTime();
if (displayType == DisplayType.STREAMLINE) {
legendParams.type = " Streamlines";
legendParams.type = " Strmlns";
} else if (displayType == DisplayType.BARB) {
legendParams.type = "Wind Barbs";
} else if (displayType == DisplayType.ARROW) {
@ -526,7 +527,7 @@ public class GridVectorResource extends AbstractMapVectorResource implements
legendParams.dataTime = getDisplayedDataTime();
if (displayType == DisplayType.STREAMLINE) {
legendParams.type = " Streamlines";
legendParams.type = " Strmlns";
} else if (displayType == DisplayType.BARB) {
legendParams.type = "Wind Barbs";
} else if (displayType == DisplayType.ARROW) {

View file

@ -74,6 +74,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- --------------------------
* Mar 9, 2011 bsteffen Initial creation
* 06/19/2012 14988 D. Friedman Reproject based on conformality
* 07/23/2012 14968 M. Porricelli Changed wording of streamline
* legend
*
* </pre>
*
@ -258,7 +260,7 @@ public class D2DGribGridResource extends GribGridResource<GridResourceData>
// The default type does not display in the legend
legendParams.type = "";
} else if (displayType == DisplayType.STREAMLINE) {
legendParams.type = "Streamlines";
legendParams.type = "Strmlns";
} else if (displayType == DisplayType.BARB) {
legendParams.type = "Wind Barbs";
} else if (displayType == DisplayType.ARROW) {

View file

@ -237,7 +237,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
/**
* The duration in millis being displayed.
*/
private int duration;
private int duration = 3600;
/**
* Holds the display string and insert time for later use.
@ -1126,7 +1126,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog {
String day = parts[2];
String date = parts[3];
String hour = parts[4];
duration = Integer.parseInt(durationStr) * FFGConstants.MILLIS_PER_HOUR;
duration = Integer.parseInt(durationStr) * FFGConstants.SECONDS_PER_HOUR;
String paramAbr = "FFG" + durationStr + "24hr";

View file

@ -343,24 +343,21 @@ public class MultiPointResource extends
Coordinate xy = new Coordinate(gage.getLon(), gage.getLat());
gage.setCoordinate(xy);
double latInc = .05;
double lonInc = .03;
/* Create a small envelope around the point */
double shiftHeightValue = getShiftHeight(gage);
double shiftWidthValue = getShiftWidth(gage);
if (existing != null) {
Coordinate p1 = new Coordinate(existing.getLon() + lonInc,
existing.getLat() + latInc);
Coordinate p2 = new Coordinate(existing.getLon() - lonInc,
existing.getLat() - latInc);
Envelope oldEnv = new Envelope(p1, p2);
PixelExtent pe = getPixelExtent(existing, getShiftWidth(existing),
getShiftHeight(existing));
Envelope oldEnv = descriptor.pixelToWorld(pe);
strTree.remove(oldEnv, existing);
}
/* Create a small envelope around the point */
Coordinate p1 = new Coordinate(gage.getLon() + lonInc,
gage.getLat() + latInc);
Coordinate p2 = new Coordinate(gage.getLon() - lonInc,
gage.getLat() - latInc);
Envelope newEnv = new Envelope(p1, p2);
PixelExtent pe = getPixelExtent(gage, getShiftWidth(gage),
getShiftHeight(gage));
Envelope newEnv = descriptor.pixelToWorld(pe);
strTree.insert(newEnv, gage);
dataMap.put(lid, gage);
@ -871,12 +868,19 @@ public class MultiPointResource extends
Envelope env = new Envelope(coord.asLatLon());
List<?> elements = strTree.query(env);
if (elements.size() > 0) {
StringBuffer sb = new StringBuffer();
boolean first = true;
Iterator<?> iter = elements.iterator();
while (iter.hasNext()) {
GageData gage = (GageData) iter.next();
return "GAGE: " + gage.getName() + " VALUE: "
+ gage.getGageValue();
if (!first) {
sb.append("\n");
}
sb.append("GAGE: " + gage.getName() + " VALUE: "
+ gage.getGageValue());
first = false;
}
return sb.toString();
}
} catch (Exception e) {
throw new VizException(e);

View file

@ -87,8 +87,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* so that it would place the
* entire time series within the
* printable area of the page.
* 04 Mar 2011 7644 lbousaid fixed Zoom in feature
* 30 May 2012 14967 wkwock fix insert deleted data to rejecteddata table
* 04 Mar 2011 7644 lbousaid fixed Zoom in feature
* 30 May 2012 14967 wkwock fix insert deleted data to rejecteddata table
* 23 Jul 2012 15195 mpduff Fix dates for displaying groups
*
* </pre>
*
@ -1360,22 +1361,9 @@ public class TimeSeriesDisplayDlg extends CaveSWTDialog {
linesMI.setSelection(true);
}
/* Get time data from group info */
int pastHours = groupInfo.getPastHours();
int futureHours = groupInfo.getFutureHours();
Calendar futureCal = Calendar.getInstance(TimeZone
.getTimeZone("GMT"));
Date d = SimulatedTime.getSystemTime().getTime();
futureCal.setTime(d);
futureCal.add(Calendar.HOUR_OF_DAY, futureHours);
Calendar pastCal = Calendar.getInstance(TimeZone
.getTimeZone("GMT"));
pastCal.setTime(d);
pastCal.add(Calendar.HOUR_OF_DAY, pastHours * -1);
displayCanvas = new TimeSeriesDisplayCanvas(this,
canvasComp, gd, pastCal.getTime(),
futureCal.getTime(), groupInfo.isGroupSelected());
canvasComp, gd, beginDate,
endDate, groupInfo.isGroupSelected());
displayCanvas.setHorizontalSpan(gd.getXsize());
displayCanvas.setVerticalSpan(gd.getYsize());
displayCanvas.showGridLines(groupInfo.isGridLines());

View file

@ -111,6 +111,11 @@ import com.raytheon.viz.hydrocommon.util.StnClassSyncUtil;
* be ran as a standalone application
* 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.
* 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
@ -437,6 +442,9 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
/** Holds the Group Information */
private GroupInfo groupInfo;
/** Holds the last graphed GroupInfo object */
private GroupInfo prevGroupInfo;
/** Holds the page information */
private PageInfo pageInfo = null;
@ -1156,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);
@ -1202,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());
}
}
});
}
@ -1365,6 +1377,20 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
endDayBtn.setText(String.valueOf(endCal.get(Calendar.DAY_OF_MONTH)));
endHourBtn.setText(String.valueOf(endCal.get(Calendar.HOUR_OF_DAY)));
}
private void updateTimeButtons() {
beginYearBtn.setText(String.valueOf(beginCal.get(Calendar.YEAR)));
beginMonthBtn.setText(String.valueOf(beginCal.get(Calendar.MONTH) + 1));
beginDayBtn
.setText(String.valueOf(beginCal.get(Calendar.DAY_OF_MONTH)));
beginHourBtn
.setText(String.valueOf(beginCal.get(Calendar.HOUR_OF_DAY)));
endYearBtn.setText(String.valueOf(endCal.get(Calendar.YEAR)));
endMonthBtn.setText(String.valueOf(endCal.get(Calendar.MONTH) + 1));
endDayBtn.setText(String.valueOf(endCal.get(Calendar.DAY_OF_MONTH)));
endHourBtn.setText(String.valueOf(endCal.get(Calendar.HOUR_OF_DAY)));
}
/**
* Populates the station list box.
@ -1962,7 +1988,12 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
} else {
// TODO log error here, invalid value
System.err.println("Error in Group Definition Config file: " + line);
}
}
// select the first item in the list
if (groupDataList.getItemCount() > 0) {
groupDataList.select(0);
}
}
/**
@ -2225,32 +2256,26 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
GroupInfo groupInfo = groupList.get(groupDataList
.getSelectionIndex());
int pastHours = groupInfo.getPastHours();
int futureHours = groupInfo.getFutureHours();
// long beginMillis = beginDate.getTime();
// long endMillis = endDate.getTime();
// long currentMillis = SimulatedTime.getSystemTime().getTime().getTime();
//
// long hoursBack = (currentMillis - beginMillis) / (1000*60*60);
// long hoursAhead = (endMillis - currentMillis) / (1000*60*60);
// groupInfo.setPastHours((int) hoursBack);
// groupInfo.setFutureHours((int) hoursAhead);
groupInfo.setPastHours(pastHours);
groupInfo.setFutureHours(futureHours);
// Calendar futureCal = Calendar.getInstance(TimeZone
// .getTimeZone("GMT"));
// Date d = SimulatedTime.getSystemTime().getTime();
// futureCal.setTime(d);
// futureCal.add(Calendar.HOUR_OF_DAY, futureHours);
// Calendar pastCal = Calendar.getInstance(TimeZone
// .getTimeZone("GMT"));
// pastCal.setTime(d);
// pastCal.add(Calendar.HOUR_OF_DAY, pastHours * -1);
if (prevGroupInfo == null || !prevGroupInfo.equals(groupInfo)) {
int pastHours = groupInfo.getPastHours();
int futureHours = groupInfo.getFutureHours();
beginCal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
beginCal.add(Calendar.HOUR_OF_DAY, pastHours * -1);
endCal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
endCal.add(Calendar.HOUR_OF_DAY, futureHours);
beginDate = beginCal.getTime();
endDate = endCal.getTime();
updateTimeButtons();
groupInfo.setPastHours(pastHours);
groupInfo.setFutureHours(futureHours);
}
timeSeriesDisplayDlg.setGroupInfo(groupInfo);
prevGroupInfo = groupInfo;
}
timeSeriesDisplayDlg.setBeginDate(beginDate);
timeSeriesDisplayDlg.setEndDate(endDate);

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();
}
}
/**

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