();
+ 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;
+ }
}
diff --git a/cave/build/static/common/cave/etc/aviation/config/gui/ClimateTimeouts.xml b/cave/build/static/common/cave/etc/aviation/config/gui/ClimateTimeouts.xml
index 0796d4eaa0..27f8fd2b59 100644
--- a/cave/build/static/common/cave/etc/aviation/config/gui/ClimateTimeouts.xml
+++ b/cave/build/static/common/cave/etc/aviation/config/gui/ClimateTimeouts.xml
@@ -21,10 +21,11 @@
20
- 20
+ 120
90
1800
diff --git a/cave/build/static/common/cave/etc/aviation/python/toolpy/AdjustTimes.py b/cave/build/static/common/cave/etc/aviation/python/toolpy/AdjustTimes.py
index 3f376783f4..db028f02d9 100644
--- a/cave/build/static/common/cave/etc/aviation/python/toolpy/AdjustTimes.py
+++ b/cave/build/static/common/cave/etc/aviation/python/toolpy/AdjustTimes.py
@@ -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
diff --git a/cave/build/static/common/cave/etc/aviation/python/toolpy/UseMetarForPrevailing.py b/cave/build/static/common/cave/etc/aviation/python/toolpy/UseMetarForPrevailing.py
index b364649806..6879506dd3 100644
--- a/cave/build/static/common/cave/etc/aviation/python/toolpy/UseMetarForPrevailing.py
+++ b/cave/build/static/common/cave/etc/aviation/python/toolpy/UseMetarForPrevailing.py
@@ -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
diff --git a/cave/build/static/common/cave/etc/gfe/userPython/textUtilities/headline/FormatterRunner.py b/cave/build/static/common/cave/etc/gfe/userPython/textUtilities/headline/FormatterRunner.py
index ea82212391..62c370af65 100644
--- a/cave/build/static/common/cave/etc/gfe/userPython/textUtilities/headline/FormatterRunner.py
+++ b/cave/build/static/common/cave/etc/gfe/userPython/textUtilities/headline/FormatterRunner.py
@@ -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)
-
\ No newline at end of file
+
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/ScriptCreator.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/ScriptCreator.java
index 94052790a2..6fb89eeb6c 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/ScriptCreator.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/catalog/ScriptCreator.java
@@ -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.
*
*
*
@@ -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);
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/requests/ThriftClient.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/requests/ThriftClient.java
index 0c81f13840..632dc092d5 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/requests/ThriftClient.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/requests/ThriftClient.java
@@ -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.
*
*
*
@@ -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
*
*
*
@@ -272,9 +275,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);
}
@@ -286,8 +292,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() {
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dArrowStyleRules.xml b/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dArrowStyleRules.xml
index 1daeeb5004..3879db62cb 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dArrowStyleRules.xml
+++ b/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dArrowStyleRules.xml
@@ -80,9 +80,9 @@
K/m*1.0E6
-->
+ K/m*1.0E6
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dContourStyleRules.xml b/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dContourStyleRules.xml
index 66a272a6c3..bab5801554 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dContourStyleRules.xml
+++ b/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dContourStyleRules.xml
@@ -4084,4 +4084,13 @@ in | .03937 | 0 | 4 | | |..|8000F0FF| | 16 | \
+
+
+ Wind
+ Gust
+
+
+ kts
+
+
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dGraphStyleRules.xml b/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dGraphStyleRules.xml
index 1f2f625258..55d705073b 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dGraphStyleRules.xml
+++ b/cave/com.raytheon.uf.viz.d2d.ui/localization/styleRules/d2dGraphStyleRules.xml
@@ -498,4 +498,13 @@
+
+
+ MTV
+
+
+ g*m/(kg*s)
+
+
+
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml b/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml
index 058f36cdb9..9618c3d2d6 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml
+++ b/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml
@@ -1543,7 +1543,7 @@
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/AddAWIPSProcedure.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/AddAWIPSProcedure.java
index 15e570416e..056292b90f 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/AddAWIPSProcedure.java
+++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/AddAWIPSProcedure.java
@@ -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();
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java
index 7e8183533b..7e9d075b4b 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java
+++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java
@@ -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());
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java
index 3af3ceef9c..cd0eae8c30 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java
+++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java
@@ -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.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ *
+ *
+ *
+ * @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 openDialogs = new ArrayList();
+
private Font font;
private List dataList;
@@ -148,7 +167,7 @@ public class ProcedureDlg extends CaveSWTDialog {
private final java.util.List 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;
+ }
+ }
}
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java
index 657be9c429..baea4279c1 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java
+++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java
@@ -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.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * ??? Initial creation
+ * 07/31/2012 DR 15036 D. Friedman Ensure current user's procedures
+ * are visible.
+ *
+ *
+ * @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();
diff --git a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/CCP.xml b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/CCP.xml
index 427b0b177f..0286ffc47a 100644
--- a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/CCP.xml
+++ b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/CCP.xml
@@ -24,15 +24,15 @@
-
+
-
+
-
+
diff --git a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Wind.xml b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Wind.xml
index 12c62202c1..550260cb4d 100644
--- a/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Wind.xml
+++ b/cave/com.raytheon.uf.viz.derivparam/localization/derivedParameters/definitions/Wind.xml
@@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
-
+
diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanResource.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanResource.java
index 8c29ae880c..0b314f53ec 100644
--- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanResource.java
+++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/resource/ScanResource.java
@@ -79,6 +79,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* ------------ ---------- ----------- --------------------------
* Oct 13, 2009 dhladky Initial creation
*
+ * Jul 24 2012 12996 Xiaochuan Compare with MidVal()
+ *
*
*
* @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;
diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/TableUtil.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/TableUtil.java
index d6938540ae..146af00d7c 100644
--- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/TableUtil.java
+++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/TableUtil.java
@@ -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;
+ }
}
diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/StationTableComp.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/StationTableComp.java
index 0fda01f220..f15e3df3ac 100644
--- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/StationTableComp.java
+++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/ui/dialogs/StationTableComp.java
@@ -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();
}
diff --git a/cave/com.raytheon.uf.viz.radarapps.core/src/com/raytheon/uf/viz/radarapps/client/RcmClient.java b/cave/com.raytheon.uf.viz.radarapps.core/src/com/raytheon/uf/viz/radarapps/client/RcmClient.java
index 0a8a95501d..3887a91ecc 100644
--- a/cave/com.raytheon.uf.viz.radarapps.core/src/com/raytheon/uf/viz/radarapps/client/RcmClient.java
+++ b/cave/com.raytheon.uf.viz.radarapps.core/src/com/raytheon/uf/viz/radarapps/client/RcmClient.java
@@ -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
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ------------ --------------------------
+ * ???? D. Friedman Initial version
+ * 2012-07-27 DR 14896 D. Friedman Fix even topic name
+ *
+ *
+ *
+ * @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();
diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/AbstractCrossSectionResource.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/AbstractCrossSectionResource.java
index 00e4e60017..1f22a67fc5 100644
--- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/AbstractCrossSectionResource.java
+++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/AbstractCrossSectionResource.java
@@ -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(times);
Collections.sort(dataTimes);
- sliceMap.clear();
+ dataRetrievalJob.schedule();
}
protected void loadSlice(DataTime time) throws VizException {
diff --git a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java
index ed4305482d..9a914fa082 100644
--- a/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java
+++ b/cave/com.raytheon.uf.viz.xy.crosssection/src/com/raytheon/uf/viz/xy/crosssection/rsc/CrossSectionImageResource.java
@@ -136,10 +136,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)
diff --git a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/AbstractTimeHeightResource.java b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/AbstractTimeHeightResource.java
index b35100d512..b8cb40b58f 100644
--- a/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/AbstractTimeHeightResource.java
+++ b/cave/com.raytheon.uf.viz.xy.timeheight/src/com/raytheon/uf/viz/xy/timeheight/rsc/AbstractTimeHeightResource.java
@@ -450,6 +450,7 @@ public abstract class AbstractTimeHeightResource extends
secondaryResource.setDescriptor(descriptor);
}
super.setDescriptor(descriptor);
+ interpolatedData = null;
loadDataJob.schedule();
}
diff --git a/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResource.java b/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResource.java
index 6be8e20194..9e8e7b17d0 100644
--- a/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResource.java
+++ b/cave/com.raytheon.uf.viz.xy.timeseries/src/com/raytheon/uf/viz/xy/timeseries/rsc/TimeSeriesResource.java
@@ -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 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) {
diff --git a/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/util/ScaleHandler.java b/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/util/ScaleHandler.java
index d1e49fe28c..a669e8f8fb 100644
--- a/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/util/ScaleHandler.java
+++ b/cave/com.raytheon.uf.viz.xy.varheight/src/com/raytheon/uf/viz/xy/varheight/util/ScaleHandler.java
@@ -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);
}
}
diff --git a/cave/com.raytheon.viz.aviation/plugin.xml b/cave/com.raytheon.viz.aviation/plugin.xml
index 8d2737e59a..2a6e132304 100644
--- a/cave/com.raytheon.viz.aviation/plugin.xml
+++ b/cave/com.raytheon.viz.aviation/plugin.xml
@@ -87,5 +87,12 @@
value="aviation/config"
recursive="true">
+
+
diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRosePlotDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRosePlotDlg.java
index bffc923418..db908b75f9 100755
--- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRosePlotDlg.java
+++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRosePlotDlg.java
@@ -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
*
*
*
@@ -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(" ");
}
diff --git a/cave/com.raytheon.viz.bcd/src/com/raytheon/viz/bcd/BCDResource.java b/cave/com.raytheon.viz.bcd/src/com/raytheon/viz/bcd/BCDResource.java
index 063bebf687..ee088160f1 100644
--- a/cave/com.raytheon.viz.bcd/src/com/raytheon/viz/bcd/BCDResource.java
+++ b/cave/com.raytheon.viz.bcd/src/com/raytheon/viz/bcd/BCDResource.java
@@ -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
*
*
*
@@ -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;
diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/FormatterLauncherDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/FormatterLauncherDialog.java
index e1d95dadb0..9f123d61a4 100755
--- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/FormatterLauncherDialog.java
+++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/FormatterLauncherDialog.java
@@ -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.
*
*
*
@@ -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();
diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java
index bae55eb71d..03d528d974 100644
--- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java
+++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java
@@ -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().
*
*
*
@@ -253,7 +255,7 @@ public class SamplePainter {
private void calcGridLabels(Coordinate worldLoc, final List grids,
final GridID imageGrid, List sampleLabels, List colors) {
- if (grids.size() == 0) {
+ if (grids.isEmpty()) {
return;
}
@@ -261,9 +263,9 @@ public class SamplePainter {
// all parms
List 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) {
diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SampleRenderable.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SampleRenderable.java
index 4a9f2b70e0..675a712363 100644
--- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SampleRenderable.java
+++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SampleRenderable.java
@@ -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.
+ *
+ * Roughly based on AWIPS I class SampleVisual.
*
*
* 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().
*
*
*
@@ -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(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);
diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/smarttool/Tool.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/smarttool/Tool.java
index 70ed2e10ef..f5f1fbd529 100644
--- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/smarttool/Tool.java
+++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/smarttool/Tool.java
@@ -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;
diff --git a/cave/com.raytheon.viz.grid/localization/styleRules/gridImageryStyleRules.xml b/cave/com.raytheon.viz.grid/localization/styleRules/gridImageryStyleRules.xml
index 3a65243be8..da570400d3 100644
--- a/cave/com.raytheon.viz.grid/localization/styleRules/gridImageryStyleRules.xml
+++ b/cave/com.raytheon.viz.grid/localization/styleRules/gridImageryStyleRules.xml
@@ -2422,12 +2422,12 @@
%
- 5
+ -1
105
Grid/warm to cold
- 20
+ 20 40 60 80 100
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridResourceData.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridResourceData.java
index 875a7612a2..474a6b69aa 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridResourceData.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridResourceData.java
@@ -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:
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridVectorResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridVectorResource.java
index 8fa9be7ced..816bdd558a 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridVectorResource.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridVectorResource.java
@@ -108,6 +108,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
*
*
*
@@ -484,7 +485,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) {
@@ -519,7 +520,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) {
diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGribGridResource.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGribGridResource.java
index 1c942e2844..8dcbd1e285 100644
--- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGribGridResource.java
+++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/D2DGribGridResource.java
@@ -70,6 +70,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
*
*
*
@@ -247,7 +249,7 @@ public class D2DGribGridResource extends GribGridResource
// 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) {
diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java
index 953d9b0b1b..b91ddd7bbb 100644
--- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java
+++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java
@@ -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";
diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/resource/MultiPointResource.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/resource/MultiPointResource.java
index 6463f4d2cf..76f871ad7c 100644
--- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/resource/MultiPointResource.java
+++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/resource/MultiPointResource.java
@@ -119,7 +119,9 @@ import com.vividsolutions.jts.index.strtree.STRtree;
* Apr 5, 2011 8910 jpiatt Adjusted resource coordinates.
*
* May 16, 2011 9356 djingtao When timeseries is disposed, launch a new timesereis after double click
- * or right click to select TimeSeries
+ * or right click to select TimeSeries.
+ * Jul 23, 2012 15167 mpduff Sampling now displays for all stations that are very close
+ * together or overlapping.
*
*
*
@@ -946,6 +948,8 @@ public class MultiPointResource extends
@Override
public String inspect(ReferencedCoordinate coord) throws VizException {
try {
+ StringBuilder buffer = new StringBuilder();
+ boolean first = true;
Envelope env = new Envelope(coord.asLatLon());
List> elements = strTree.query(env);
if (elements.size() > 0) {
@@ -953,11 +957,18 @@ public class MultiPointResource extends
while (iter.hasNext()) {
ArrayList> list = (ArrayList>) iter.next();
if (list.get(1) instanceof String) {
- return (String) list.get(1);
- } else {
- return null;
+ if (!first) {
+ buffer.append("\n");
+ }
+ buffer.append((String) list.get(1));
+ first = false;
}
}
+ if (buffer.length() > 0) {
+ return buffer.toString();
+ } else {
+ return null;
+ }
}
} catch (Exception e) {
throw new VizException(e);
diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayDlg.java
index cdb7102a22..d034dafafe 100644
--- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayDlg.java
+++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayDlg.java
@@ -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
*
*
*
@@ -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());
diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDlg.java
index c473e39c1c..27ca9dc4d4 100644
--- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDlg.java
+++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDlg.java
@@ -111,6 +111,8 @@ 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.
*
*
* @author lvenable
@@ -437,6 +439,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;
@@ -1365,6 +1370,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 +1981,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 +2249,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);
diff --git a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/cresthistory/CrestHistoryCanvas.java b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/cresthistory/CrestHistoryCanvas.java
index 5179e342d3..c7bf0af623 100644
--- a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/cresthistory/CrestHistoryCanvas.java
+++ b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/cresthistory/CrestHistoryCanvas.java
@@ -63,684 +63,732 @@ import com.raytheon.viz.hydrocommon.HydroConstants;
* @version 1.0
*/
public class CrestHistoryCanvas extends Canvas {
- /**
- * Parent component.
- */
- private Composite parentComp;
-
- /**
- * Text font on the canvas.
- */
- private Font canvasFont;
-
- /**
- * Canvas width.
- */
- private final int CANVAS_WIDTH = 700;
-
- /**
- * Canvas height.
- */
- private final int CANVAS_HEIGHT = 520;
-
- /**
- * Y coordinate of the horizontal axis line.
- */
- private final int HLINE_YCOORD = CANVAS_HEIGHT - 40;
-
- /**
- * X coordinate of the vertical axis line.
- */
- private final int VLINE_XCOORD = 80;
-
- private final int HLINE_LEFT_OFFSET = 20;
-
- /**
- * Length of the horizontal axis line.
- */
- private final int HLINE_LENGTH = CANVAS_WIDTH - VLINE_XCOORD
- - HLINE_LEFT_OFFSET;
-
- /**
- * Length of the vertical axis line.
- */
- private final int VLINE_LENGTH = 450;
-
- /**
- * The number of pixels the vertical lines is from the top of the canvas.
- */
- private final int VLINE_PIXELS_FROM_TOP = CANVAS_HEIGHT - 40 - VLINE_LENGTH;
-
- /**
- * "STAGE IN FEET" text.
- */
- private final String STAGE_IN_FEET = "STAGE IN FEET";
-
- /**
- * Hash mark length.
- */
- private final int HASH_MARK = 10;
-
- /**
- * Small hash mark length.
- */
- private final int SMALL_HASH_MARK = 5;
-
- /**
- * Label Y coordinate offset.
- */
- private final int LABEL_Y_OFFSET = 15;
-
- /**
- * Label X coordinate offset.
- */
- private final int LABEL_X_OFFSET = 5;
-
- /**
- * Starting X coordinate for the year hash mark.
- */
- private final int YEAR_HASH_X_COORD_START = VLINE_XCOORD + 15;
-
- /**
- * Maximum stage value.
- */
- private double stageMaxVal = 0.0;
-
- /**
- * Minimum stage value.
- */
- private double stageMinVal = 0.0;
-
- /**
- * Number of MAJOR data items.
- */
- private int majorCount = 0;
-
- /**
- * Number of MODERATE data items.
- */
- private int modCount = 0;
-
- /**
- * Number of ACTION data items.
- */
- private int actionCount = 0;
-
- /**
- * Number of MINOR data items.
- */
- private int minorCount = 0;
-
- /**
- * Crest history data.
- */
- private CrestHistoryData crestHistoryData;
-
- /**
- * Map of the crest data (value) and the rectangle area on the canvas the
- * data occupies (key).
- */
- private HashMap crestDataMap;
-
- /**
- * Callback for selecting crest data.
- */
- private ISelectedCrestData selectCrestDataCB;
-
- /**
- * Constructor.
- *
- * @param parent
- * Parent composite.
- * @param crestHistoryData
- * Crest history data.
- * @param callback
- * Crest data selection callback.
- */
- public CrestHistoryCanvas(Composite parent,
- CrestHistoryData crestHistoryData, ISelectedCrestData callback) {
- super(parent, SWT.DOUBLE_BUFFERED);
-
- parentComp = parent;
- this.crestHistoryData = crestHistoryData;
- // work around for missing data
- if (crestHistoryData != null) {
- selectCrestDataCB = callback;
- stageMaxVal = crestHistoryData.getMaxStageLevel();
- stageMinVal = 0.0;
- } else {
- stageMaxVal = 0.0;
- stageMinVal = 0.0;
- }
- // another work around
- if ((crestHistoryData.getEndingYear() == 0)
- || (crestHistoryData.getStartingYear() == 0)) {
- Calendar cal = new GregorianCalendar();
- cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
- Date date = SimulatedTime.getSystemTime().getTime();
- cal.setTime(date);
- crestHistoryData.setStartingYear(1900);
- crestHistoryData.setEndingYear(cal.get(Calendar.YEAR));
- }
-
- init();
- }
-
- /**
- * Initialize method.
- */
- private void init() {
- if (crestHistoryData != null) {
- generateCrestDataMap();
- }
-
- canvasFont = new Font(parentComp.getDisplay(), "Monospace", 9,
- SWT.NORMAL);
-
- setupCanvas();
-
- addMouseListener(new MouseAdapter() {
- @Override
- public void mouseDown(MouseEvent e) {
- processMouseEvent(e);
- }
- });
- }
-
- /**
- * Regenerate the Crest history canvas
- *
- * @param crestHistoryData
- */
- public void updateCrestHistotryData(CrestHistoryData crestHistoryData) {
- this.crestHistoryData = crestHistoryData;
-
- if (crestHistoryData != null) {
- stageMaxVal = crestHistoryData.getMaxStageLevel();
- stageMinVal = 0.0;
- } else {
- stageMaxVal = 0.0;
- stageMinVal = 0.0;
- }
-
- generateCrestDataMap();
- redraw();
- }
-
- /**
- * Setup the drawing canvas.
- */
- private void setupCanvas() {
- GridData gd = new GridData(SWT.DEFAULT, SWT.TOP, false, true);
- gd.heightHint = CANVAS_HEIGHT;
- gd.widthHint = CANVAS_WIDTH;
-
- this.setSize(CANVAS_WIDTH, CANVAS_HEIGHT);
-
- setLayoutData(gd);
- addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
- drawCrestHistory(e);
- }
- });
-
- addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- canvasFont.dispose();
- }
- });
- }
-
- /**
- * Draw the crest history data and the graph lines & labels on the canvas.
- *
- * @param e
- * Paint event.
- */
- private void drawCrestHistory(PaintEvent e) {
- e.gc.setFont(canvasFont);
- int fontHeightMid = (e.gc.getFontMetrics().getHeight() / 2);
- int fontHeight = (e.gc.getFontMetrics().getHeight());
-
- e.gc.setBackground(parentComp.getDisplay().getSystemColor(
- SWT.COLOR_BLACK));
-
- e.gc.fillRectangle(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
-
- e.gc.setForeground(parentComp.getDisplay().getSystemColor(
- SWT.COLOR_WHITE));
-
- // ----------------------------------------
- // Draw horizontal and vertical axis lines
- // ----------------------------------------
-
- e.gc.drawLine(VLINE_XCOORD, HLINE_YCOORD, VLINE_XCOORD, HLINE_YCOORD
- - VLINE_LENGTH);
-
- e.gc.drawLine(VLINE_XCOORD, HLINE_YCOORD, VLINE_XCOORD + HLINE_LENGTH,
- HLINE_YCOORD);
-
- // ------------------------------------------------
- // Draw STAGE IN FEET vertical label
- // ------------------------------------------------
- char[] charArray = STAGE_IN_FEET.toCharArray();
-
- int tmpY = 120;
- for (int i = 0; i < charArray.length; i++) {
- e.gc.drawString(String.valueOf(charArray[i]), 5, tmpY, true);
- tmpY += fontHeight;
- }
-
- if (crestHistoryData != null) {
- // ------------------------------------------------
- // Draw the years and the hash marks
- // ------------------------------------------------
- int startyear = crestHistoryData.getStartingYear();
- int endyear = crestHistoryData.getEndingYear();
- int years = (endyear - startyear);
- double pixelsPerIncX;
- if (years == 0) {
- pixelsPerIncX = 0;
- } else {
- pixelsPerIncX = HLINE_LENGTH / years;
- }
-
- int yearXcoord = VLINE_XCOORD;
- int yearHashXcoord = YEAR_HASH_X_COORD_START;
- DecimalFormat df = new DecimalFormat();
- df.setMinimumIntegerDigits(1);
- df.setMaximumFractionDigits(0);
- df.setGroupingUsed(false);
-
- for (int i = 0; i <= years; i++) {
- int inc = new Double(Math.rint(pixelsPerIncX * i)).intValue();
- yearXcoord = YEAR_HASH_X_COORD_START + inc - 15;
- yearHashXcoord = YEAR_HASH_X_COORD_START + inc;
- if (years < 75) {
- if (i % 5 == 0) {
- e.gc.drawString(df.format(startyear + i), yearXcoord,
- CANVAS_HEIGHT - fontHeight - 3, true);
- e.gc.drawLine(yearHashXcoord, HLINE_YCOORD, yearHashXcoord,
- HLINE_YCOORD + HASH_MARK);
- }
- } else {
- if (i % 10 == 0) {
- e.gc.drawString(df.format(startyear + i), yearXcoord,
- CANVAS_HEIGHT - fontHeight - 3, true);
- e.gc.drawLine(yearHashXcoord, HLINE_YCOORD, yearHashXcoord,
- HLINE_YCOORD + HASH_MARK);
- }
- }
- }
-
- // -----------------------------------------
- // Draw stage hash marks
- // -----------------------------------------
-
- double maxPixValue = VLINE_LENGTH + VLINE_PIXELS_FROM_TOP;
- double numHashsY = stageMaxVal;
- double pixelsPerIncY = VLINE_LENGTH / numHashsY;
-
- for (int x = 0; x <= stageMaxVal; ++x) {
- int yCoord = HLINE_YCOORD
- - new Double(Math.round(x * pixelsPerIncY)).intValue();
-
- if (x % 5 == 0) {
- // draw little hash
- e.gc.drawLine(VLINE_XCOORD, yCoord, VLINE_XCOORD
- - SMALL_HASH_MARK, yCoord);
-
- String recStr = String.format("%5.1f", new Float(x)
- .floatValue());
- e.gc.drawString(recStr, 35, yCoord - fontHeightMid, true);
- }
- }
-
- // -----------------------------------------
- // Draw MAJOR line and label
- // -----------------------------------------
-
- double majorLevel = crestHistoryData.getMajorLevel();
-
- e.gc.setForeground(parentComp.getDisplay().getSystemColor(
- SWT.COLOR_MAGENTA));
-
- int majorYCoord = (int) (maxPixValue - Math
- .round(((majorLevel - stageMinVal) * pixelsPerIncY)));
-
- e.gc.drawLine(VLINE_XCOORD + 1, majorYCoord, VLINE_XCOORD
- + HLINE_LENGTH, majorYCoord);
-
- String majorLabel = String.format("%5.1f MAJOR (%d)", majorLevel,
- majorCount);
- e.gc.drawString(majorLabel, VLINE_XCOORD + LABEL_X_OFFSET,
- majorYCoord - LABEL_Y_OFFSET, true);
-
- // -----------------------------------------
- // Draw MODERATE line and label
- // -----------------------------------------
-
- double moderateLevel = crestHistoryData.getModerateLevel();
-
- e.gc.setForeground(parentComp.getDisplay().getSystemColor(
- SWT.COLOR_BLUE));
-
- int modYCoord = (int) (maxPixValue - Math
- .round(((moderateLevel - stageMinVal) * pixelsPerIncY)));
-
- e.gc.drawLine(VLINE_XCOORD + 1, modYCoord, VLINE_XCOORD
- + HLINE_LENGTH, modYCoord);
-
- String modLabel = String.format("%5.1f MODERATE (%d)",
- moderateLevel, modCount);
- e.gc.drawString(modLabel, VLINE_XCOORD + LABEL_X_OFFSET, modYCoord
- - LABEL_Y_OFFSET, true);
-
- // -----------------------------------------
- // Draw MINOR line and label
- // -----------------------------------------
-
- double minorLevel = crestHistoryData.getMinorLevel();
-
- e.gc.setForeground(parentComp.getDisplay().getSystemColor(
- SWT.COLOR_RED));
-
- int minorYCoord = (int) (maxPixValue - Math
- .round(((minorLevel - stageMinVal) * pixelsPerIncY)));
-
- e.gc.drawLine(VLINE_XCOORD + 1, minorYCoord, VLINE_XCOORD
- + HLINE_LENGTH, minorYCoord);
-
- String minorLabel = String.format("%5.1f MINOR (%d)", minorLevel,
- minorCount);
- e.gc.drawString(minorLabel, VLINE_XCOORD + LABEL_X_OFFSET,
- minorYCoord - LABEL_Y_OFFSET, true);
-
- e.gc.drawString("FLOOD", VLINE_XCOORD + HLINE_LENGTH - 40,
- minorYCoord - LABEL_Y_OFFSET, true);
-
- // -----------------------------------------
- // Draw ACTION line and label
- // -----------------------------------------
-
- double actionLevel = crestHistoryData.getActionLevel();
-
- e.gc.setForeground(parentComp.getDisplay().getSystemColor(
- SWT.COLOR_YELLOW));
-
- int actionYCoord = (int) (maxPixValue - Math
- .round(((actionLevel - stageMinVal) * pixelsPerIncY)));
-
- e.gc.drawLine(VLINE_XCOORD + 1, actionYCoord, VLINE_XCOORD
- + HLINE_LENGTH, actionYCoord);
-
- String actionLabel = String.format("%5.1f ACTION (%d)",
- actionLevel, actionCount);
- e.gc.drawString(actionLabel, VLINE_XCOORD + LABEL_X_OFFSET,
- actionYCoord - LABEL_Y_OFFSET, true);
-
- // -------------------------------------------
- // Draw crest data
- // -------------------------------------------
-
- CrestDrawData drawData;
- Rectangle rec;
-
- Set keys = crestDataMap.keySet();
-
- for (Iterator iterator = keys.iterator(); iterator
- .hasNext();) {
- rec = iterator.next();
- drawData = crestDataMap.get(rec);
-
- if (drawData.getDrawData() == false) {
- continue;
- }
-
- if (drawData.isSelected() == true) {
- e.gc.setBackground(parentComp.getDisplay().getSystemColor(
- SWT.COLOR_WHITE));
- } else {
- e.gc.setBackground(drawData.getColor());
- }
-
- e.gc.fillRectangle(rec.x, rec.y, rec.width, rec.height);
- }
- }
- }
-
- /**
- * Generate the map of crest data (value) and the rectangle areas on the
- * canvas (key).
- */
- private void generateCrestDataMap() {
- crestDataMap = new HashMap();
- CrestDrawData drawData;
- Rectangle rec;
-
- int circleWidth = 8;
- int circleHeight = 8;
-
- double maxPixValue = VLINE_LENGTH + VLINE_PIXELS_FROM_TOP;
- double numHashs = crestHistoryData.getMaxStageLevel();
- double pixelsPerIncY = VLINE_LENGTH / numHashs;
- int startyear = crestHistoryData.getStartingYear();
- int endyear = crestHistoryData.getEndingYear();
- int years = endyear - startyear;
- int pixelsPerIncX;
- if (years == 0) {
- pixelsPerIncX = 0;
- } else {
- pixelsPerIncX = HLINE_LENGTH / years;
- }
-
- //Init the counts
- this.majorCount=0;
- this.minorCount=0;
- this.actionCount=0;
- this.modCount=0;
-
- for (CrestData crestData : crestHistoryData.getCrestDataArray()) {
-
- int yCoord = (int) (maxPixValue - Math
- .round((crestData.getStage() * pixelsPerIncY)));
-
- double yearXOffset = crestData.getYear() - startyear;
- int xCoord = YEAR_HASH_X_COORD_START
- + new Double(Math.round(yearXOffset * pixelsPerIncX))
- .intValue();
-
- rec = new Rectangle(xCoord - circleWidth / 2, yCoord - circleHeight
- / 2, circleWidth, circleHeight);
-
- drawData = new CrestDrawData(crestData.getStage(), crestData
- .getYear(), calculateDataColor(crestData.getStage()));
-
- crestDataMap.put(rec, drawData);
- }
- }
-
- /**
- * Calculate color of the crest data.
- *
- * @param stage
- * Stage (in feet).
- * @return The color associated with the data.
- */
- private Color calculateDataColor(double stage) {
- if ((stage > crestHistoryData.getMajorLevel()) &&
- (crestHistoryData.getMajorLevel() != HydroConstants.MISSING_VALUE)) {
- ++majorCount;
- return parentComp.getDisplay().getSystemColor(SWT.COLOR_MAGENTA);
- } else if ((stage > crestHistoryData.getModerateLevel()) &&
- (crestHistoryData.getModerateLevel() != HydroConstants.MISSING_VALUE)) {
- ++modCount;
- return parentComp.getDisplay().getSystemColor(SWT.COLOR_BLUE);
- } else if ((stage > crestHistoryData.getMinorLevel()) &&
- (crestHistoryData.getMinorLevel() != HydroConstants.MISSING_VALUE)) {
- ++minorCount;
- return parentComp.getDisplay().getSystemColor(SWT.COLOR_RED);
- } else if ((stage > crestHistoryData.getActionLevel()) &&
- (crestHistoryData.getActionLevel() != HydroConstants.MISSING_VALUE)) {
- ++actionCount;
- return parentComp.getDisplay().getSystemColor(SWT.COLOR_YELLOW);
- }
-
- return parentComp.getDisplay().getSystemColor(SWT.COLOR_GREEN);
- }
-
- /**
- * Select the crest data if the mouse click is in the data rectangle.
- *
- * @param e
- * Mouse event.
- */
- public void processMouseEvent(MouseEvent e) {
- Rectangle rec;
- Rectangle foundRec = null;
- Rectangle selectedRec = null;
-
- Set keys = crestDataMap.keySet();
-
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- rec = iterator.next();
-
- // Check if the mouse's x & y coords is in the rectangle area or on
- // the
- // edge of the rectangle
- if (recContains(e.x, e.y, rec)) {
- foundRec = rec;
- // crestDataMap.get(rec).setSelected(true);
- } else if (crestDataMap.get(rec).isSelected() == true) {
- selectedRec = rec;
- }
-
- if (foundRec != null) {
- crestDataMap.get(foundRec).setSelected(true);
-
- if (selectedRec != null) {
- crestDataMap.get(selectedRec).setSelected(false);
- }
-
- if (selectCrestDataCB != null) {
- selectCrestDataCB.crestDataSelected(crestDataMap.get(
- foundRec).getStage(), crestDataMap.get(foundRec)
- .getYear());
- }
- }
- }
- this.redraw();
- }
-
- /**
- * This method is used in place of the Rectangle.contains() method. The
- * contains method only checks if the x,y is inside the rectangle area. This
- * method accounts for the x,y being on the edges of the rectangle.
- *
- * @param x
- * Mouse's x coordinate.
- * @param y
- * Mouse's y coordinate.
- * @param rec
- * Rectangle the mouse coordinates will be checked against.
- * @return True if the mouse's x & y coordinates are in/on the rectangle.
- */
- private boolean recContains(int x, int y, Rectangle rec) {
- if ((x < rec.x) || (x > (rec.x + rec.width))) {
- return false;
- }
-
- if ((y < rec.y) || (y > (rec.y + rec.height))) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Select the crest data based on the stage nad year passed in.
- *
- * @param stage
- * Stage in feet.
- * @param year
- * Year.
- */
- public void selectCrestData(double stage, int year) {
- Rectangle rec;
-
- Set keys = crestDataMap.keySet();
-
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- rec = iterator.next();
-
- crestDataMap.get(rec).setSelected(false);
-
- if ((crestDataMap.get(rec).getStage() == stage)
- && (crestDataMap.get(rec).getYear() == year)) {
- crestDataMap.get(rec).setSelected(true);
- }
- }
- this.redraw();
- }
-
- /**
- * Draw all of the crest data on the canvas.
- */
- public void drawAllCrestData() {
- Rectangle rec;
-
- Set keys = crestDataMap.keySet();
-
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- rec = iterator.next();
-
- crestDataMap.get(rec).setDrawData(true);
- }
-
- this.redraw();
- }
-
- /**
- * Draw only the crest data below the action stage.
- */
- public void drawDataBelowActionStage() {
- Rectangle rec;
-
- Set keys = crestDataMap.keySet();
-
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- rec = iterator.next();
-
- if (crestDataMap.get(rec).getStage() > crestHistoryData
- .getActionLevel()) {
- crestDataMap.get(rec).setDrawData(false);
- } else {
- crestDataMap.get(rec).setDrawData(true);
- }
- }
-
- this.redraw();
- }
-
- /**
- * Draw only the crest data above the action stage.
- */
- public void drawDataAboveActionStage() {
- Rectangle rec;
-
- Set keys = crestDataMap.keySet();
-
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- rec = iterator.next();
-
- if (crestDataMap.get(rec).getStage() < crestHistoryData
- .getActionLevel()) {
- crestDataMap.get(rec).setDrawData(false);
- } else {
- crestDataMap.get(rec).setDrawData(true);
- }
- }
-
- this.redraw();
- }
+ /**
+ * Parent component.
+ */
+ private Composite parentComp;
+
+ /**
+ * Text font on the canvas.
+ */
+ private Font canvasFont;
+
+ /**
+ * Canvas width.
+ */
+ private final int CANVAS_WIDTH = 700;
+
+ /**
+ * Canvas height.
+ */
+ private final int CANVAS_HEIGHT = 520;
+
+ /**
+ * Y coordinate of the horizontal axis line.
+ */
+ private final int HLINE_YCOORD = CANVAS_HEIGHT - 40;
+
+ /**
+ * X coordinate of the vertical axis line.
+ */
+ private final int VLINE_XCOORD = 80;
+
+ private final int HLINE_LEFT_OFFSET = 20;
+
+ /**
+ * Length of the horizontal axis line.
+ */
+ private final int HLINE_LENGTH = CANVAS_WIDTH - VLINE_XCOORD
+ - HLINE_LEFT_OFFSET;
+
+ /**
+ * Length of the vertical axis line.
+ */
+ private final int VLINE_LENGTH = 450;
+
+ /**
+ * The number of pixels the vertical lines is from the top of the canvas.
+ */
+ private final int VLINE_PIXELS_FROM_TOP = CANVAS_HEIGHT - 40 - VLINE_LENGTH;
+
+ /**
+ * "STAGE IN FEET" text.
+ */
+ private final String STAGE_IN_FEET = "STAGE IN FEET";
+
+ /**
+ * Hash mark length.
+ */
+ private final int HASH_MARK = 10;
+
+ /**
+ * Small hash mark length.
+ */
+ private final int SMALL_HASH_MARK = 5;
+
+ /**
+ * Label Y coordinate offset.
+ */
+ private final int LABEL_Y_OFFSET = 15;
+
+ /**
+ * Label X coordinate offset.
+ */
+ private final int LABEL_X_OFFSET = 5;
+
+ /**
+ * Starting X coordinate for the year hash mark.
+ */
+ private final int YEAR_HASH_X_COORD_START = VLINE_XCOORD + 15;
+
+ /**
+ * number of intervals on the y-axis
+ */
+ private final int NUM_VERTICAL_INTERVALS = 5;
+ /**
+ * Maximum stage value.
+ */
+ private double stageMaxVal = 0.0;
+
+ /**
+ * Minimum stage value.
+ */
+ private double stageMinVal = 0.0;
+
+ /**
+ * Number of MAJOR data items.
+ */
+ private int majorCount = 0;
+
+ /**
+ * Number of MODERATE data items.
+ */
+ private int modCount = 0;
+
+ /**
+ * Number of ACTION data items.
+ */
+ private int actionCount = 0;
+
+ /**
+ * Number of MINOR data items.
+ */
+ private int minorCount = 0;
+
+ /**
+ * Crest history data.
+ */
+ private CrestHistoryData crestHistoryData;
+
+ /**
+ * Map of the crest data (value) and the rectangle area on the canvas the
+ * data occupies (key).
+ */
+ private HashMap crestDataMap;
+
+ /**
+ * Callback for selecting crest data.
+ */
+ private ISelectedCrestData selectCrestDataCB;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * Parent composite.
+ * @param crestHistoryData
+ * Crest history data.
+ * @param callback
+ * Crest data selection callback.
+ */
+ public CrestHistoryCanvas(Composite parent,
+ CrestHistoryData crestHistoryData, ISelectedCrestData callback) {
+ super(parent, SWT.DOUBLE_BUFFERED);
+
+ parentComp = parent;
+ this.crestHistoryData = crestHistoryData;
+ // work around for missing data
+ if (crestHistoryData != null) {
+ selectCrestDataCB = callback;
+ stageMaxVal = crestHistoryData.getMaxStageLevel();
+ stageMinVal = crestHistoryData.getMinStageLevel();
+ } else {
+ stageMaxVal = 0.0;
+ stageMinVal = 0.0;
+ }
+ setYAxisMaxMin();
+ // another work around
+ if ((crestHistoryData.getEndingYear() == 0)
+ || (crestHistoryData.getStartingYear() == 0)) {
+ Calendar cal = new GregorianCalendar();
+ cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
+ Date date = SimulatedTime.getSystemTime().getTime();
+ cal.setTime(date);
+ crestHistoryData.setStartingYear(1900);
+ crestHistoryData.setEndingYear(cal.get(Calendar.YEAR));
+ }
+
+ init();
+ }
+
+ /**
+ * Initialize method.
+ */
+ private void init() {
+ if (crestHistoryData != null) {
+ generateCrestDataMap();
+ }
+
+ canvasFont = new Font(parentComp.getDisplay(), "Monospace", 9,
+ SWT.NORMAL);
+
+ setupCanvas();
+
+ addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseDown(MouseEvent e) {
+ processMouseEvent(e);
+ }
+ });
+ }
+
+ /**
+ * Regenerate the Crest history canvas
+ *
+ * @param crestHistoryData
+ */
+ public void updateCrestHistotryData(CrestHistoryData crestHistoryData) {
+ this.crestHistoryData = crestHistoryData;
+
+ if (crestHistoryData != null) {
+ stageMaxVal = crestHistoryData.getMaxStageLevel();
+ stageMinVal = crestHistoryData.getMinStageLevel();
+ } else {
+ stageMaxVal = 0.0;
+ stageMinVal = 0.0;
+ }
+
+ setYAxisMaxMin();
+ generateCrestDataMap();
+ redraw();
+ }
+
+ /**
+ * Setup the drawing canvas.
+ */
+ private void setupCanvas() {
+ GridData gd = new GridData(SWT.DEFAULT, SWT.TOP, false, true);
+ gd.heightHint = CANVAS_HEIGHT;
+ gd.widthHint = CANVAS_WIDTH;
+
+ this.setSize(CANVAS_WIDTH, CANVAS_HEIGHT);
+
+ setLayoutData(gd);
+ addPaintListener(new PaintListener() {
+ public void paintControl(PaintEvent e) {
+ drawCrestHistory(e);
+ }
+ });
+
+ addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ canvasFont.dispose();
+ }
+ });
+ }
+
+ /**
+ * Calculate for the max. and min. Y axis value
+ */
+ private void setYAxisMaxMin() {
+ int roundFactor = 5;
+ long lmax, lmin;
+
+ /*
+ * Round min down. If the original min data > 0, then don't round below
+ * 0.
+ */
+ lmin = (long) (stageMinVal / roundFactor);
+
+ if (lmin >= 0) {
+ stageMinVal = (lmin - 1) * roundFactor;
+ if (stageMinVal < 0)
+ stageMinVal = 0;
+ } else /* lmin < 0 */
+ {
+ stageMinVal = (lmin - 1) * roundFactor;
+ }
+
+ /*
+ * Round max up.
+ */
+ lmax = (long) (stageMaxVal / roundFactor);
+
+ /*
+ * If the difference between max_y and min_y < 10, round max_y up again.
+ */
+ if ((stageMaxVal - stageMaxVal) < 10) {
+ stageMaxVal = (lmax + 2) * roundFactor;
+ }
+
+ if (stageMinVal < 0) {
+ stageMinVal=0;
+ }
+
+ }
+
+ /**
+ * Draw the crest history data and the graph lines & labels on the canvas.
+ *
+ * @param e
+ * Paint event.
+ */
+ private void drawCrestHistory(PaintEvent e) {
+ e.gc.setFont(canvasFont);
+ int fontHeightMid = (e.gc.getFontMetrics().getHeight() / 2);
+ int fontHeight = (e.gc.getFontMetrics().getHeight());
+
+ e.gc.setBackground(parentComp.getDisplay().getSystemColor(
+ SWT.COLOR_BLACK));
+
+ e.gc.fillRectangle(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);
+
+ e.gc.setForeground(parentComp.getDisplay().getSystemColor(
+ SWT.COLOR_WHITE));
+
+ // ----------------------------------------
+ // Draw horizontal and vertical axis lines
+ // ----------------------------------------
+
+ e.gc.drawLine(VLINE_XCOORD, HLINE_YCOORD, VLINE_XCOORD, HLINE_YCOORD
+ - VLINE_LENGTH);
+
+ e.gc.drawLine(VLINE_XCOORD, HLINE_YCOORD, VLINE_XCOORD + HLINE_LENGTH,
+ HLINE_YCOORD);
+
+ // ------------------------------------------------
+ // Draw STAGE IN FEET vertical label
+ // ------------------------------------------------
+ char[] charArray = STAGE_IN_FEET.toCharArray();
+
+ int tmpY = 120;
+ for (int i = 0; i < charArray.length; i++) {
+ e.gc.drawString(String.valueOf(charArray[i]), 5, tmpY, true);
+ tmpY += fontHeight;
+ }
+
+ if (crestHistoryData != null) {
+ // ------------------------------------------------
+ // Draw the years and the hash marks
+ // ------------------------------------------------
+ int startyear = crestHistoryData.getStartingYear();
+ int endyear = crestHistoryData.getEndingYear();
+ int years = (endyear - startyear);
+ double pixelsPerIncX;
+ if (years == 0) {
+ pixelsPerIncX = 0;
+ } else {
+ pixelsPerIncX = HLINE_LENGTH / years;
+ }
+
+ int yearXcoord = VLINE_XCOORD;
+ int yearHashXcoord = YEAR_HASH_X_COORD_START;
+ DecimalFormat df = new DecimalFormat();
+ df.setMinimumIntegerDigits(1);
+ df.setMaximumFractionDigits(0);
+ df.setGroupingUsed(false);
+
+ for (int i = 0; i <= years; i++) {
+ int inc = new Double(Math.rint(pixelsPerIncX * i)).intValue();
+ yearXcoord = YEAR_HASH_X_COORD_START + inc - 15;
+ yearHashXcoord = YEAR_HASH_X_COORD_START + inc;
+ if (years < 75) {
+ if (i % 5 == 0) {
+ e.gc.drawString(df.format(startyear + i), yearXcoord,
+ CANVAS_HEIGHT - fontHeight - 3, true);
+ e.gc.drawLine(yearHashXcoord, HLINE_YCOORD,
+ yearHashXcoord, HLINE_YCOORD + HASH_MARK);
+ }
+ } else {
+ if (i % 10 == 0) {
+ e.gc.drawString(df.format(startyear + i), yearXcoord,
+ CANVAS_HEIGHT - fontHeight - 3, true);
+ e.gc.drawLine(yearHashXcoord, HLINE_YCOORD,
+ yearHashXcoord, HLINE_YCOORD + HASH_MARK);
+ }
+ }
+ }
+
+ // -----------------------------------------
+ // Draw stage hash marks
+ // -----------------------------------------
+
+ double maxPixValue = VLINE_LENGTH + VLINE_PIXELS_FROM_TOP;
+ double numHashsY = stageMaxVal - stageMinVal;
+ double valInc = (stageMaxVal - stageMinVal)
+ / NUM_VERTICAL_INTERVALS;
+
+ double pixelsPerIncY = VLINE_LENGTH / numHashsY;
+
+ for (int x = (int) (stageMinVal); x <= stageMaxVal; x += valInc) {
+ int yCoord = HLINE_YCOORD
+ - new Double(Math.round((x - stageMinVal)
+ * pixelsPerIncY)).intValue();
+
+ e.gc.drawLine(VLINE_XCOORD, yCoord, VLINE_XCOORD
+ - SMALL_HASH_MARK, yCoord);
+
+ String recStr = String.format("%5.1f",
+ new Float(x).floatValue());
+ e.gc.drawString(recStr, 35, yCoord - fontHeightMid, true);
+ }
+
+ // -----------------------------------------
+ // Draw MAJOR line and label
+ // -----------------------------------------
+
+ double majorLevel = crestHistoryData.getMajorLevel();
+
+ e.gc.setForeground(parentComp.getDisplay().getSystemColor(
+ SWT.COLOR_MAGENTA));
+
+ int majorYCoord = (int) (maxPixValue - Math
+ .round(((majorLevel - stageMinVal) * pixelsPerIncY)));
+
+ e.gc.drawLine(VLINE_XCOORD + 1, majorYCoord, VLINE_XCOORD
+ + HLINE_LENGTH, majorYCoord);
+
+ String majorLabel = String.format("%5.1f MAJOR (%d)", majorLevel,
+ majorCount);
+ e.gc.drawString(majorLabel, VLINE_XCOORD + LABEL_X_OFFSET,
+ majorYCoord - LABEL_Y_OFFSET, true);
+
+ // -----------------------------------------
+ // Draw MODERATE line and label
+ // -----------------------------------------
+
+ double moderateLevel = crestHistoryData.getModerateLevel();
+
+ e.gc.setForeground(parentComp.getDisplay().getSystemColor(
+ SWT.COLOR_BLUE));
+
+ int modYCoord = (int) (maxPixValue - Math
+ .round(((moderateLevel - stageMinVal) * pixelsPerIncY)));
+
+ e.gc.drawLine(VLINE_XCOORD + 1, modYCoord, VLINE_XCOORD
+ + HLINE_LENGTH, modYCoord);
+
+ String modLabel = String.format("%5.1f MODERATE (%d)",
+ moderateLevel, modCount);
+ e.gc.drawString(modLabel, VLINE_XCOORD + LABEL_X_OFFSET, modYCoord
+ - LABEL_Y_OFFSET, true);
+
+ // -----------------------------------------
+ // Draw MINOR line and label
+ // -----------------------------------------
+
+ double minorLevel = crestHistoryData.getMinorLevel();
+
+ e.gc.setForeground(parentComp.getDisplay().getSystemColor(
+ SWT.COLOR_RED));
+
+ int minorYCoord = (int) (maxPixValue - Math
+ .round(((minorLevel - stageMinVal) * pixelsPerIncY)));
+
+ e.gc.drawLine(VLINE_XCOORD + 1, minorYCoord, VLINE_XCOORD
+ + HLINE_LENGTH, minorYCoord);
+
+ String minorLabel = String.format("%5.1f MINOR (%d)", minorLevel,
+ minorCount);
+ e.gc.drawString(minorLabel, VLINE_XCOORD + LABEL_X_OFFSET,
+ minorYCoord - LABEL_Y_OFFSET, true);
+
+ e.gc.drawString("FLOOD", VLINE_XCOORD + HLINE_LENGTH - 40,
+ minorYCoord - LABEL_Y_OFFSET, true);
+
+ // -----------------------------------------
+ // Draw ACTION line and label
+ // -----------------------------------------
+
+ double actionLevel = crestHistoryData.getActionLevel();
+
+ e.gc.setForeground(parentComp.getDisplay().getSystemColor(
+ SWT.COLOR_YELLOW));
+
+ int actionYCoord = (int) (maxPixValue - Math
+ .round(((actionLevel - stageMinVal) * pixelsPerIncY)));
+
+ e.gc.drawLine(VLINE_XCOORD + 1, actionYCoord, VLINE_XCOORD
+ + HLINE_LENGTH, actionYCoord);
+
+ String actionLabel = String.format("%5.1f ACTION (%d)",
+ actionLevel, actionCount);
+ e.gc.drawString(actionLabel, VLINE_XCOORD + LABEL_X_OFFSET,
+ actionYCoord - LABEL_Y_OFFSET, true);
+
+ // -------------------------------------------
+ // Draw crest data
+ // -------------------------------------------
+
+ CrestDrawData drawData;
+ Rectangle rec;
+
+ Set keys = crestDataMap.keySet();
+
+ for (Iterator iterator = keys.iterator(); iterator
+ .hasNext();) {
+ rec = iterator.next();
+ drawData = crestDataMap.get(rec);
+
+ if (drawData.getDrawData() == false) {
+ continue;
+ }
+
+ if (drawData.isSelected() == true) {
+ e.gc.setBackground(parentComp.getDisplay().getSystemColor(
+ SWT.COLOR_WHITE));
+ } else {
+ e.gc.setBackground(drawData.getColor());
+ }
+
+ e.gc.fillRectangle(rec.x, rec.y, rec.width, rec.height);
+ }
+ }
+ }
+
+ /**
+ * Generate the map of crest data (value) and the rectangle areas on the
+ * canvas (key).
+ */
+ private void generateCrestDataMap() {
+ crestDataMap = new HashMap();
+ CrestDrawData drawData;
+ Rectangle rec;
+
+ int circleWidth = 8;
+ int circleHeight = 8;
+
+ double maxPixValue = VLINE_LENGTH + VLINE_PIXELS_FROM_TOP;
+ double numHashs = stageMaxVal - stageMinVal;
+ double pixelsPerIncY = VLINE_LENGTH / numHashs;
+ int startyear = crestHistoryData.getStartingYear();
+ int endyear = crestHistoryData.getEndingYear();
+ int years = endyear - startyear;
+ int pixelsPerIncX;
+ if (years == 0) {
+ pixelsPerIncX = 0;
+ } else {
+ pixelsPerIncX = HLINE_LENGTH / years;
+ }
+
+ // Init the counts
+ this.majorCount = 0;
+ this.minorCount = 0;
+ this.actionCount = 0;
+ this.modCount = 0;
+
+ for (CrestData crestData : crestHistoryData.getCrestDataArray()) {
+
+ int yCoord = (int) (maxPixValue - Math
+ .round(((crestData.getStage() - stageMinVal) * pixelsPerIncY)));
+
+ double yearXOffset = crestData.getYear() - startyear;
+ int xCoord = YEAR_HASH_X_COORD_START
+ + new Double(Math.round(yearXOffset * pixelsPerIncX))
+ .intValue();
+
+ rec = new Rectangle(xCoord - circleWidth / 2, yCoord - circleHeight
+ / 2, circleWidth, circleHeight);
+
+ drawData = new CrestDrawData(crestData.getStage(),
+ crestData.getYear(),
+ calculateDataColor(crestData.getStage()));
+
+ crestDataMap.put(rec, drawData);
+ }
+ }
+
+ /**
+ * Calculate color of the crest data.
+ *
+ * @param stage
+ * Stage (in feet).
+ * @return The color associated with the data.
+ */
+ private Color calculateDataColor(double stage) {
+ if ((stage > crestHistoryData.getMajorLevel())
+ && (crestHistoryData.getMajorLevel() != HydroConstants.MISSING_VALUE)) {
+ ++majorCount;
+ return parentComp.getDisplay().getSystemColor(SWT.COLOR_MAGENTA);
+ } else if ((stage > crestHistoryData.getModerateLevel())
+ && (crestHistoryData.getModerateLevel() != HydroConstants.MISSING_VALUE)) {
+ ++modCount;
+ return parentComp.getDisplay().getSystemColor(SWT.COLOR_BLUE);
+ } else if ((stage > crestHistoryData.getMinorLevel())
+ && (crestHistoryData.getMinorLevel() != HydroConstants.MISSING_VALUE)) {
+ ++minorCount;
+ return parentComp.getDisplay().getSystemColor(SWT.COLOR_RED);
+ } else if ((stage > crestHistoryData.getActionLevel())
+ && (crestHistoryData.getActionLevel() != HydroConstants.MISSING_VALUE)) {
+ ++actionCount;
+ return parentComp.getDisplay().getSystemColor(SWT.COLOR_YELLOW);
+ }
+
+ return parentComp.getDisplay().getSystemColor(SWT.COLOR_GREEN);
+ }
+
+ /**
+ * Select the crest data if the mouse click is in the data rectangle.
+ *
+ * @param e
+ * Mouse event.
+ */
+ public void processMouseEvent(MouseEvent e) {
+ Rectangle rec;
+ Rectangle foundRec = null;
+ Rectangle selectedRec = null;
+
+ Set keys = crestDataMap.keySet();
+
+ for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
+ rec = iterator.next();
+
+ // Check if the mouse's x & y coords is in the rectangle area or on
+ // the
+ // edge of the rectangle
+ if (recContains(e.x, e.y, rec)) {
+ foundRec = rec;
+ // crestDataMap.get(rec).setSelected(true);
+ } else if (crestDataMap.get(rec).isSelected() == true) {
+ selectedRec = rec;
+ }
+
+ if (foundRec != null) {
+ crestDataMap.get(foundRec).setSelected(true);
+
+ if (selectedRec != null) {
+ crestDataMap.get(selectedRec).setSelected(false);
+ }
+
+ if (selectCrestDataCB != null) {
+ selectCrestDataCB.crestDataSelected(
+ crestDataMap.get(foundRec).getStage(), crestDataMap
+ .get(foundRec).getYear());
+ }
+ }
+ }
+ this.redraw();
+ }
+
+ /**
+ * This method is used in place of the Rectangle.contains() method. The
+ * contains method only checks if the x,y is inside the rectangle area. This
+ * method accounts for the x,y being on the edges of the rectangle.
+ *
+ * @param x
+ * Mouse's x coordinate.
+ * @param y
+ * Mouse's y coordinate.
+ * @param rec
+ * Rectangle the mouse coordinates will be checked against.
+ * @return True if the mouse's x & y coordinates are in/on the rectangle.
+ */
+ private boolean recContains(int x, int y, Rectangle rec) {
+ if ((x < rec.x) || (x > (rec.x + rec.width))) {
+ return false;
+ }
+
+ if ((y < rec.y) || (y > (rec.y + rec.height))) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Select the crest data based on the stage nad year passed in.
+ *
+ * @param stage
+ * Stage in feet.
+ * @param year
+ * Year.
+ */
+ public void selectCrestData(double stage, int year) {
+ Rectangle rec;
+
+ Set keys = crestDataMap.keySet();
+
+ for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
+ rec = iterator.next();
+
+ crestDataMap.get(rec).setSelected(false);
+
+ if ((crestDataMap.get(rec).getStage() == stage)
+ && (crestDataMap.get(rec).getYear() == year)) {
+ crestDataMap.get(rec).setSelected(true);
+ }
+ }
+ this.redraw();
+ }
+
+ /**
+ * Draw all of the crest data on the canvas.
+ */
+ public void drawAllCrestData() {
+ Rectangle rec;
+
+ Set keys = crestDataMap.keySet();
+
+ for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
+ rec = iterator.next();
+
+ crestDataMap.get(rec).setDrawData(true);
+ }
+
+ this.redraw();
+ }
+
+ /**
+ * Draw only the crest data below the action stage.
+ */
+ public void drawDataBelowActionStage() {
+ Rectangle rec;
+
+ Set keys = crestDataMap.keySet();
+
+ for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
+ rec = iterator.next();
+
+ if (crestDataMap.get(rec).getStage() > crestHistoryData
+ .getActionLevel()) {
+ crestDataMap.get(rec).setDrawData(false);
+ } else {
+ crestDataMap.get(rec).setDrawData(true);
+ }
+ }
+
+ this.redraw();
+ }
+
+ /**
+ * Draw only the crest data above the action stage.
+ */
+ public void drawDataAboveActionStage() {
+ Rectangle rec;
+
+ Set keys = crestDataMap.keySet();
+
+ for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
+ rec = iterator.next();
+
+ if (crestDataMap.get(rec).getStage() < crestHistoryData
+ .getActionLevel()) {
+ crestDataMap.get(rec).setDrawData(false);
+ } else {
+ crestDataMap.get(rec).setDrawData(true);
+ }
+ }
+
+ this.redraw();
+ }
}
diff --git a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/datamanager/RiverDataManager.java b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/datamanager/RiverDataManager.java
index 64d9492796..691aa82a6f 100644
--- a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/datamanager/RiverDataManager.java
+++ b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/datamanager/RiverDataManager.java
@@ -66,683 +66,679 @@ import com.raytheon.viz.hydrocommon.data.RiverDataPoint;
public class RiverDataManager {
- /** Singleton instance of this class */
- private static RiverDataManager riverManager = null;
-
- /* Private Constructor */
- private RiverDataManager() {
- }
-
- /**
- * Get an instance of this singleton.
- *
- * @return Instance of this class
- */
- public static synchronized RiverDataManager getInstance() {
- if (riverManager == null) {
- riverManager = new RiverDataManager();
- }
- return riverManager;
- }
-
- private static final transient IUFStatusHandler statusHandler = UFStatus
- .getHandler(RiverDataManager.class);
-
- private LinkedHashMap crestData = null;
-
- private LinkedHashMap> riverData = null;
-
- private static String locationQuery = "SELECT name, county, state, elev, hsa, lat, lon, rb from location WHERE lid =";
-
- private static String riverStatQuery = "SELECT stream, mile, zd, tide, bf, wstg, fs, fq, action_flow, primary_pe FROM riverstat WHERE lid =";
-
- private static String descriptionQuery = "SELECT proximity, reach FROM descrip WHERE lid =";
-
- private static String crestQuery = "select stage, q, datcrst, timcrst, cremark, hw, jam, olddatum, suppress, prelim from crest where lid = '";
-
- private static String floodCatQuery = "SELECT minor_stage, moderate_stage, major_stage, minor_flow, moderate_flow, major_flow from floodcat WHERE lid = ";
-
- private static String riverInfoQuery = "SELECT rivermonlocation.group_id, rivermongroup.group_name FROM rivermongroup, rivermonlocation WHERE rivermongroup.group_id = rivermonlocation.group_id AND rivermonlocation.lid = ";
-
- private static String riverPointQuery = "SELECT l.lid, l.name, l.county, l.state, l.elev, l.hsa, l.lat, l.lon, "
- + "rml.group_id, "
- + "rmg.group_name, "
- + "r.stream, r.mile, r.zd AS zero, r.tide, r.bf AS bankfull, r.wstg AS action_stage, r.fs AS flood_stage, r.fq AS flood_flow, r.action_flow, r.primary_pe, "
- + "d.proximity, d.reach, "
- + "f.minor_stage AS minor, f.moderate_stage AS moderate, f.major_stage AS major, f.minor_flow AS minor, f.moderate_flow AS moderate, f.major_flow AS major "
- + "FROM location l "
- + "LEFT JOIN floodcat f ON l.lid::text = f.lid::text "
- + "LEFT JOIN descrip d ON l.lid::text = d.lid::text, riverstat r, rivermonlocation rml "
- + "LEFT JOIN rivermongroup rmg ON rml.group_id::text = rmg.group_id::text "
- + "WHERE l.lid::text = r.lid::text and r.lid::text = rml.lid::text "
- + "ORDER BY rml.group_id, r.mile desc";
-
- private static String riverObsvalueQueryFront = "SELECT distinct(foo.lid), foo.value, foo.maxtime from "
- + "(SELECT distinct height.lid, height.value, max(height.obstime) as maxtime "
- + "FROM height "
- + "WHERE height.lid in "
- + "(select distinct(lid) "
- + "from rivermonlocation "
- + "where rivermonlocation.group_id = ";
-
- private static String riverObsvalueQueryBack = ") GROUP BY height.lid, height.value) "
- + "AS foo "
- + "GROUP BY foo.lid, foo.value, foo.maxtime order by foo.lid, foo.maxtime desc";
-
- private static String riverFcstvalueQueryFront = "SELECT distinct(foo.lid), foo.value, foo.maxtime from "
- + "(SELECT distinct fcstheight.lid, fcstheight.value, max(fcstheight.validtime) as maxtime "
- + "FROM fcstheight "
- + "WHERE fcstheight.lid in "
- + "(select distinct(lid) "
- + "from rivermonlocation "
- + "where rivermonlocation.group_id = ";
-
- private static String riverFcstvalueQueryBack = ") GROUP BY fcstheight.lid, fcstheight.value) "
- + "AS foo "
- + "GROUP BY foo.lid, foo.value, foo.maxtime order by foo.lid, foo.maxtime desc";
-
- private static String riverIDQuery = "SELECT group_id FROM rivermonlocation where lid =";
-
- /**
- * River Query Crest
- *
- * @param lid
- * @return CrestHistoryData
- */
- public CrestHistoryData getRiverCrests(RiverDataPoint rdp, int allFlag) {
- CrestHistoryData crests = null;
-
- if (crestData == null) {
- crestData = new LinkedHashMap();
- }
-
- crests = new CrestHistoryData();
- String query = null;
-
- /* get crest data depending on action stage */
- if (rdp != null) {
- String sql = "select stage, q, datcrst, timcrst, cremark, hw, jam, olddatum, suppress, prelim "
- + "from crest where lid = '" + rdp.getLid();
-
- if (allFlag == 1) {
- query = sql + "' and stage >'" + rdp.getActionStage()
- + "' ORDER BY stage, q";
- } else if (allFlag == 2) {
- query = sql + "' and stage <'" + rdp.getActionStage()
- + "' ORDER BY stage, q";
- } else {
- query = sql + "' ORDER BY stage, q";
- }
-
- ArrayList