12.9.1-1 baseline
Former-commit-id: 6601ddb09c2928754c2c3859dac284998d73ff81
This commit is contained in:
parent
b5e8fee24d
commit
31ae7ea218
139 changed files with 5153 additions and 3439 deletions
|
@ -21,14 +21,18 @@ package com.raytheon.rcm.server;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
import com.raytheon.rcm.event.RadarEvent;
|
||||
import com.raytheon.rcm.event.RadarEventAdapter;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Send AlertViz notifications
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -37,6 +41,7 @@ import com.raytheon.rcm.event.RadarEventAdapter;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 9, 2011 mnash Initial creation
|
||||
* 2012-07-27 DR 14896 D. Friedman Handle multiple RPGs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,13 +51,15 @@ import com.raytheon.rcm.event.RadarEventAdapter;
|
|||
|
||||
public class RadarServerAvailable extends RadarEventAdapter {
|
||||
|
||||
private static boolean attempted = false;
|
||||
private static final String CONNECTION_DOWN_MESSAGE = "RPG connection is down.";
|
||||
private static final String CONNECTION_UP_MESSAGE = "RPG connection is back up.";
|
||||
|
||||
private static final String AWIPS2_FXA_PROPERTY = "awips2_fxa";
|
||||
private static final String DEFAULT_AWIPS2_FXA = "/awips2/fxa";
|
||||
private static final String ANNOUNCER_PATH = "bin" + File.separator + "fxaAnnounce";
|
||||
|
||||
private ProcessBuilder builder;
|
||||
private HashSet<String> knownFailures = new HashSet<String>();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public RadarServerAvailable(RadarServer server) {
|
||||
}
|
||||
|
||||
|
@ -65,64 +72,73 @@ public class RadarServerAvailable extends RadarEventAdapter {
|
|||
*/
|
||||
@Override
|
||||
public void handleRadarEvent(RadarEvent event) {
|
||||
Process proc = null;
|
||||
String home = System.getProperty("awips2_fxa");
|
||||
if (home != null && !home.endsWith(File.separator)) {
|
||||
home += File.separator;
|
||||
} else if (home == null) {
|
||||
Log.event("Cannot find awips2_fxa system variable");
|
||||
return;
|
||||
}
|
||||
List<String> values = new ArrayList<String>();
|
||||
values.add(home + "bin" + File.separator + "fxaAnnounce");
|
||||
try {
|
||||
if (event.getType() == RadarEvent.CONNECTION_ATTEMPT_FAILED) {
|
||||
if (!attempted) {
|
||||
Log.event("Executing " + values.get(0));
|
||||
values.add(event.getRadarID() + " rpg connection is down.");
|
||||
values.add("RADAR");
|
||||
values.add("URGENT");
|
||||
builder = new ProcessBuilder(values);
|
||||
builder.redirectErrorStream(true);
|
||||
|
||||
proc = builder.start();
|
||||
StringBuilder output = new StringBuilder();
|
||||
Scanner s = new Scanner(proc.getInputStream());
|
||||
while (s.hasNextLine()) {
|
||||
if (output.length() > 0)
|
||||
output.append('\n');
|
||||
output.append(s.nextLine());
|
||||
}
|
||||
proc.waitFor();
|
||||
attempted = true;
|
||||
}
|
||||
} else if (event.getType() == RadarEvent.CONNECTION_UP) {
|
||||
if (attempted) {
|
||||
Log.event("Executing " + values.get(0));
|
||||
values.add(event.getRadarID()
|
||||
+ " rpg connection is back up.");
|
||||
values.add("RADAR");
|
||||
values.add("URGENT");
|
||||
builder = new ProcessBuilder(values);
|
||||
builder.redirectErrorStream(true);
|
||||
proc = builder.start();
|
||||
StringBuilder output = new StringBuilder();
|
||||
Scanner s = new Scanner(proc.getInputStream());
|
||||
while (s.hasNextLine()) {
|
||||
if (output.length() > 0)
|
||||
output.append('\n');
|
||||
output.append(s.nextLine());
|
||||
}
|
||||
proc.waitFor();
|
||||
attempted = false;
|
||||
}
|
||||
final String radarId = event.getRadarID();
|
||||
if (event.getType() == RadarEvent.CONNECTION_ATTEMPT_FAILED) {
|
||||
if (! knownFailures.contains(radarId)) {
|
||||
knownFailures.add(radarId);
|
||||
sendNotification(radarId, CONNECTION_DOWN_MESSAGE);
|
||||
}
|
||||
} else if (event.getType() == RadarEvent.CONNECTION_UP) {
|
||||
if (knownFailures.contains(radarId)) {
|
||||
knownFailures.remove(radarId);
|
||||
sendNotification(radarId, CONNECTION_UP_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendNotification(final String radarId, final String message) {
|
||||
getExecutorService().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendNotification2(radarId, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendNotification2(String radarId, String message) {
|
||||
ProcessBuilder builder;
|
||||
Process proc = null;
|
||||
|
||||
String fxaDir = System.getProperty(AWIPS2_FXA_PROPERTY);
|
||||
if (fxaDir == null)
|
||||
fxaDir = DEFAULT_AWIPS2_FXA;
|
||||
|
||||
List<String> values = new ArrayList<String>();
|
||||
values.add(fxaDir + File.separator + ANNOUNCER_PATH);
|
||||
Log.event("Executing " + values.get(0));
|
||||
values.add(radarId + ' ' + message);
|
||||
values.add("RADAR");
|
||||
values.add("URGENT");
|
||||
builder = new ProcessBuilder(values);
|
||||
builder.redirectErrorStream(true);
|
||||
|
||||
try {
|
||||
proc = builder.start();
|
||||
Scanner s = new Scanner(proc.getInputStream());
|
||||
while (s.hasNextLine())
|
||||
s.nextLine();
|
||||
proc.waitFor();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.errorf("Error running fxaAnnounce: %s", e);
|
||||
} finally {
|
||||
if (proc != null) {
|
||||
proc.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: has to be daemon until there is a shutdown notification
|
||||
private static ExecutorService executorService = Executors
|
||||
.newSingleThreadExecutor(new ThreadFactory() {
|
||||
@Override
|
||||
public Thread newThread(Runnable r) {
|
||||
Thread t = new Thread(r);
|
||||
t.setDaemon(true);
|
||||
return t;
|
||||
}
|
||||
});
|
||||
|
||||
private static ExecutorService getExecutorService() {
|
||||
return executorService;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,11 @@
|
|||
<!--
|
||||
Date DR# Engineer Description
|
||||
03/26/2012 12864 zhao Changed CigVisTrendTimeout from 300 to 1800
|
||||
07/27/2012 15169 zhao Changed WindRoseTimeout from 20 to 120
|
||||
-->
|
||||
<ClimateTimeouts>
|
||||
<ClimateMetarTimeout>20</ClimateMetarTimeout>
|
||||
<WindRoseTimeout>20</WindRoseTimeout>
|
||||
<WindRoseTimeout>120</WindRoseTimeout>
|
||||
<CigVisDistTimeout>90</CigVisDistTimeout>
|
||||
<CigVisTrendTimeout>1800</CigVisTrendTimeout>
|
||||
</ClimateTimeouts>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
|
||||
/**
|
||||
* Creates uEngine scripts on the fly.
|
||||
* Creates uEngine scripts on the fly. DEPRECATED: Requests from viz should go
|
||||
* through ThriftClient to the thrift service instead of using ScriptCreator and
|
||||
* then going to the uengine service. The thrift service performs faster and is
|
||||
* more maintainable. Use ThriftClient.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -73,6 +76,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
* @author brockwoo
|
||||
* @version 1
|
||||
*/
|
||||
@Deprecated
|
||||
public class ScriptCreator {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ScriptCreator.class);
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.jws.WebService;
|
||||
|
||||
|
@ -20,6 +21,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
|
|||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
import com.raytheon.uf.common.serialization.comm.RemoteServiceRequest;
|
||||
import com.raytheon.uf.common.serialization.comm.RequestWrapper;
|
||||
import com.raytheon.uf.common.serialization.comm.ServiceException;
|
||||
import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
|
||||
import com.raytheon.uf.common.serialization.comm.util.ExceptionWrapper;
|
||||
|
@ -50,9 +52,9 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
**/
|
||||
|
||||
/**
|
||||
* The thrift client. used to send requests to the RemoteReqeustServer. Make
|
||||
* The thrift client. used to send requests to the RemoteRequestServer. Make
|
||||
* sure request type has registered a handler to handle the request on the
|
||||
* server
|
||||
* server.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -60,6 +62,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 3, 2009 mschenke Initial creation
|
||||
* Jul 24, 2012 njensen Enhanced logging
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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() {
|
||||
|
|
|
@ -80,9 +80,9 @@
|
|||
<arrowStyle>
|
||||
<!--
|
||||
<displayUnits>K/(km * 1000)</displayUnits>
|
||||
-->
|
||||
<displayUnits label="K/(km*1000)">K/m*1.0E6</displayUnits>
|
||||
-->
|
||||
<displayUnits label="C/m">K/m*1.0E6</displayUnits>
|
||||
</arrowStyle>
|
||||
</styleRule>
|
||||
|
||||
|
|
|
@ -4084,4 +4084,13 @@ in | .03937 | 0 | 4 | | |..|8000F0FF| | 16 | \
|
|||
</contourStyle>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<paramLevelMatches>
|
||||
<parameter>Wind</parameter>
|
||||
<parameter>Gust</parameter>
|
||||
</paramLevelMatches>
|
||||
<contourStyle>
|
||||
<displayUnits>kts</displayUnits>
|
||||
</contourStyle>
|
||||
</styleRule>
|
||||
</styleRuleset>
|
||||
|
|
|
@ -498,4 +498,13 @@
|
|||
</graphStyle>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<paramLevelMatches>
|
||||
<parameter>MTV</parameter>
|
||||
</paramLevelMatches>
|
||||
<graphStyle>
|
||||
<displayUnits label="gm/kgs">g*m/(kg*s)</displayUnits>
|
||||
</graphStyle>
|
||||
</styleRule>
|
||||
|
||||
</styleRuleset>
|
|
@ -1543,7 +1543,7 @@
|
|||
</key>
|
||||
<key
|
||||
contextId="com.raytheon.uf.viz.d2d.ui"
|
||||
commandId="com.raytheon.viz.ui.actions.printScreenAction"
|
||||
commandId="com.raytheon.uf.viz.d2d.ui.actions.showPrintDialog"
|
||||
schemeId="com.raytheon.viz.ui.awips.scheme"
|
||||
sequence="M1+P">
|
||||
</key>
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -23,6 +23,7 @@ package com.raytheon.uf.viz.d2d.ui.dialogs.procedures;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
@ -83,6 +84,22 @@ import com.raytheon.viz.ui.actions.SaveBundle;
|
|||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
|
||||
/**
|
||||
*
|
||||
* Dialog for loading or modifying procedures.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author unknown
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ProcedureDlg extends CaveSWTDialog {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
|
@ -94,6 +111,8 @@ public class ProcedureDlg extends CaveSWTDialog {
|
|||
|
||||
public static final String PROCEDURES_DIR = "/procedures";
|
||||
|
||||
private static Collection<ProcedureDlg> openDialogs = new ArrayList<ProcedureDlg>();
|
||||
|
||||
private Font font;
|
||||
|
||||
private List dataList;
|
||||
|
@ -148,7 +167,7 @@ public class ProcedureDlg extends CaveSWTDialog {
|
|||
|
||||
private final java.util.List<BundlePair> bundles;
|
||||
|
||||
public ProcedureDlg(String fileName, Procedure p, Shell parent) {
|
||||
private ProcedureDlg(String fileName, Procedure p, Shell parent) {
|
||||
// Win32
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL
|
||||
| CAVE.DO_NOT_BLOCK);
|
||||
|
@ -203,6 +222,9 @@ public class ProcedureDlg extends CaveSWTDialog {
|
|||
@Override
|
||||
protected void disposed() {
|
||||
font.dispose();
|
||||
synchronized (openDialogs) {
|
||||
openDialogs.remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -989,4 +1011,44 @@ public class ProcedureDlg extends CaveSWTDialog {
|
|||
};
|
||||
dlg.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is a procedure dialog open for the given filename, return it,
|
||||
* otherwise null.
|
||||
*
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public static ProcedureDlg getDialog(String fileName) {
|
||||
synchronized (openDialogs) {
|
||||
if (fileName != null) {
|
||||
for (ProcedureDlg dialog : openDialogs) {
|
||||
if (fileName.equals(dialog.fileName)) {
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ProcedureDlg for the given fileName. If the fileName is null or if there is no open dialog, create a new ProcedureDlg.
|
||||
*
|
||||
* @param fileName
|
||||
* @param p
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
public static ProcedureDlg getOrCreateDialog(String fileName, Procedure p,
|
||||
Shell parent) {
|
||||
synchronized (openDialogs) {
|
||||
ProcedureDlg dialog = getDialog(fileName);
|
||||
if (dialog == null) {
|
||||
dialog = new ProcedureDlg(fileName, p, parent);
|
||||
openDialogs.add(dialog);
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,24 @@ import com.raytheon.uf.common.localization.LocalizationUtil;
|
|||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
*
|
||||
* A dialog which displays a list of procedures for opening, saving, or deleting.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* ??? Initial creation
|
||||
* 07/31/2012 DR 15036 D. Friedman Ensure current user's procedures
|
||||
* are visible.
|
||||
* </pre>
|
||||
*
|
||||
* @author unknown
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ProcedureListDlg extends CaveSWTDialog {
|
||||
|
||||
protected boolean oneLevel = true;
|
||||
|
@ -317,10 +335,18 @@ public class ProcedureListDlg extends CaveSWTDialog {
|
|||
if (treeViewer.getContentProvider() instanceof ProcedureTreeContentProvider) {
|
||||
ProcedureTreeContentProvider content = (ProcedureTreeContentProvider) treeViewer
|
||||
.getContentProvider();
|
||||
Object find = content.findItem(user);
|
||||
final Object find = content.findItem(user);
|
||||
if (find != null) {
|
||||
treeViewer.setExpandedElements(new Object[] { find });
|
||||
treeViewer.reveal(find);
|
||||
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TreeItem[] items = treeViewer.getTree().getItems();
|
||||
if (items != null && items.length > 0)
|
||||
treeViewer.getTree().showItem(items[items.length - 1]);
|
||||
treeViewer.reveal(find);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -449,14 +475,25 @@ public class ProcedureListDlg extends CaveSWTDialog {
|
|||
procedureTF.setText(procedureTF.getText().concat(".xml"));
|
||||
}
|
||||
if (dataListContains(procedureTF.getText())) {
|
||||
// Pop up a warning
|
||||
boolean result = MessageDialog.openQuestion(shell,
|
||||
"Confirm Overwrite",
|
||||
"The procedure " + procedureTF.getText()
|
||||
+ " already exists. Overwrite anyways?");
|
||||
if (result == true) {
|
||||
fileName = procedureTF.getText();
|
||||
shell.dispose();
|
||||
if (ProcedureDlg.getDialog(procedureTF.getText()) != null) {
|
||||
// User cannot save if dialog is open.
|
||||
MessageDialog
|
||||
.openError(
|
||||
shell,
|
||||
"Cannot Save Procedure",
|
||||
"The procedure "
|
||||
+ procedureTF.getText()
|
||||
+ " is currently open. It cannot be overwritten until it is closed or saved under another name.");
|
||||
} else {
|
||||
// Pop up a warning
|
||||
boolean result = MessageDialog.openQuestion(shell,
|
||||
"Confirm Overwrite",
|
||||
"The procedure " + procedureTF.getText()
|
||||
+ " already exists. Overwrite anyways?");
|
||||
if (result == true) {
|
||||
fileName = procedureTF.getText();
|
||||
shell.dispose();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fileName = procedureTF.getText();
|
||||
|
|
|
@ -24,15 +24,15 @@
|
|||
</Method>
|
||||
<Method models="HPCGuide" displayName="Total Cloud Cover" name="Multiply">
|
||||
<Field abbreviation="TCC"/>
|
||||
<ConstantField value="0.01"/>
|
||||
<ConstantField value="100.0"/>
|
||||
</Method>
|
||||
<Method models="RTMA" displayName="GOES Effective Cloud Amount" name="Multiply">
|
||||
<Field abbreviation="TCC"/>
|
||||
<ConstantField value="0.01"/>
|
||||
<ConstantField value="100.0"/>
|
||||
</Method>
|
||||
<Method name="Multiply">
|
||||
<Field abbreviation="TCC"/>
|
||||
<ConstantField value="0.01"/>
|
||||
<ConstantField value="100.0"/>
|
||||
</Method>
|
||||
<Method levels="Surface" name="Mapping">
|
||||
<Field level="Station" abbreviation="clouds_bestCat"/>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
|
||||
further_licensing_information.
|
||||
-->
|
||||
<DerivedParameter unit="m/s" name="Total Wind (Vector)" abbreviation="Wind">
|
||||
<DerivedParameter unit="m/s" name="Wind" abbreviation="Wind">
|
||||
<Method name="Vector">
|
||||
<Field abbreviation="uW"/>
|
||||
<Field abbreviation="vW"/>
|
||||
|
|
|
@ -79,6 +79,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 13, 2009 dhladky Initial creation
|
||||
*
|
||||
* Jul 24 2012 12996 Xiaochuan Compare with MidVal()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -359,7 +361,7 @@ public class ScanResource extends
|
|||
d = Double.valueOf(rank);
|
||||
}
|
||||
|
||||
if (d >= getScanDrawer().ddfc.getLowerVal()) {
|
||||
if (d >= getScanDrawer().ddfc.getMidVal()) {
|
||||
if (!getScanDrawer().ddfc.isOverlap()) {
|
||||
if ((dtdr != null) && !dtdr.getOverlap()) {
|
||||
isOverlap = false;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,6 @@ import com.raytheon.rcm.mqsrvr.ReqObj;
|
|||
import com.raytheon.rcm.rmr.RmrEvent;
|
||||
import com.raytheon.uf.common.dataplugin.radar.request.RadarServerConnectionRequest;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.preferences.JMSPreferences;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
// TODO: use of queueSession outside synchronized(stateLock) could cause
|
||||
|
@ -69,6 +68,23 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
|
||||
// TODO: conflicts over setting fatalMsg
|
||||
|
||||
/**
|
||||
* Manages client connection to RadarServer
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ------------ --------------------------
|
||||
* ???? D. Friedman Initial version
|
||||
* 2012-07-27 DR 14896 D. Friedman Fix even topic name
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dfriedma
|
||||
* @version 1.0
|
||||
*/
|
||||
public class RcmClient implements MessageListener, ExceptionListener {
|
||||
|
||||
private String connectionURL;
|
||||
|
@ -211,6 +227,11 @@ public class RcmClient implements MessageListener, ExceptionListener {
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: ActiveMQ is hard-coded. If switching to Qpid or another
|
||||
* service, it may be necessary to use JMSPreferences.getPolicyString on
|
||||
* the topic name below.
|
||||
*/
|
||||
ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(uri);
|
||||
// This stuff can block...
|
||||
try {
|
||||
|
@ -238,8 +259,7 @@ public class RcmClient implements MessageListener, ExceptionListener {
|
|||
topicConn.setExceptionListener(this);
|
||||
topicSession = topicConn.createTopicSession(false,
|
||||
Session.AUTO_ACKNOWLEDGE);
|
||||
topic = topicSession.createTopic(JMSPreferences
|
||||
.getPolicyString("RadarEvents"));
|
||||
topic = topicSession.createTopic("RadarEvents");
|
||||
|
||||
queueConn.start();
|
||||
topicConn.start();
|
||||
|
|
|
@ -231,11 +231,13 @@ public abstract class AbstractCrossSectionResource extends
|
|||
time = time.clone();
|
||||
time.setLevelValue((double) i);
|
||||
times.add(time);
|
||||
sliceMap.put(time, null);
|
||||
dataRetrievalJob.times.add(time);
|
||||
}
|
||||
}
|
||||
dataTimes = new ArrayList<DataTime>(times);
|
||||
Collections.sort(dataTimes);
|
||||
sliceMap.clear();
|
||||
dataRetrievalJob.schedule();
|
||||
}
|
||||
|
||||
protected void loadSlice(DataTime time) throws VizException {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -450,6 +450,7 @@ public abstract class AbstractTimeHeightResource extends
|
|||
secondaryResource.setDescriptor(descriptor);
|
||||
}
|
||||
super.setDescriptor(descriptor);
|
||||
interpolatedData = null;
|
||||
loadDataJob.schedule();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Calendar;
|
|||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Set;
|
||||
import java.util.TimeZone;
|
||||
import java.util.TreeSet;
|
||||
|
@ -76,6 +77,7 @@ import com.raytheon.viz.core.graphing.util.GraphPrefsFactory;
|
|||
import com.raytheon.viz.core.graphing.xy.XYData;
|
||||
import com.raytheon.viz.core.graphing.xy.XYDataList;
|
||||
import com.raytheon.viz.core.graphing.xy.XYImageData;
|
||||
import com.raytheon.viz.core.graphing.xy.XYWindImageData;
|
||||
import com.raytheon.viz.core.rsc.ICombinedResourceData;
|
||||
import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation;
|
||||
import com.raytheon.viz.core.style.graph.GraphPreferences;
|
||||
|
@ -157,10 +159,22 @@ public class TimeSeriesResource extends
|
|||
if (currentUnit.isCompatible(prefs.getDisplayUnits())) {
|
||||
UnitConverter conv = currentUnit.getConverterTo(prefs
|
||||
.getDisplayUnits());
|
||||
for (XYData d : data.getData()) {
|
||||
double converted = conv.convert(((Number) d.getY())
|
||||
.doubleValue());
|
||||
d.setY(converted);
|
||||
ListIterator<XYData> it = data.getData().listIterator();
|
||||
while(it.hasNext()) {
|
||||
XYData d = it.next();
|
||||
if(d instanceof XYWindImageData){
|
||||
XYWindImageData wind = (XYWindImageData) d;
|
||||
double converted = conv.convert(wind.getWindSpd());
|
||||
it.remove();
|
||||
if(wind.getImage() != null){
|
||||
wind.getImage().dispose();
|
||||
}
|
||||
it.add(new XYWindImageData(wind.getX(), wind.getY(), converted, wind.getWindDir()));
|
||||
}else{
|
||||
double converted = conv.convert(((Number) d.getY())
|
||||
.doubleValue());
|
||||
d.setY(converted);
|
||||
}
|
||||
}
|
||||
units = prefs.getDisplayUnitLabel();
|
||||
} else {
|
||||
|
@ -457,13 +471,6 @@ public class TimeSeriesResource extends
|
|||
String lat = nf.format(Math.abs(y));
|
||||
String stnID = "";
|
||||
String source = resourceData.getSource();
|
||||
String unit = "";
|
||||
|
||||
if (prefs != null && prefs.getDisplayUnits() != null) {
|
||||
unit = prefs.getDisplayUnitLabel();
|
||||
} else {
|
||||
unit = adapter.getDataUnit().toString();
|
||||
}
|
||||
|
||||
if (resourceData.getMetadataMap().get("location.stationId") != null) {
|
||||
stnID = resourceData.getMetadataMap().get("location.stationId")
|
||||
|
@ -488,7 +495,7 @@ public class TimeSeriesResource extends
|
|||
sb.append(" ").append(resourceData.getLevelKey());
|
||||
}
|
||||
sb.append(String.format(" %s %s %s", adapter.getParameterName(),
|
||||
"TSer", unit != null && unit.equals("") == false ? "(" + unit
|
||||
"TSer", units != null && units.equals("") == false ? "(" + units
|
||||
+ ")" : ""));
|
||||
|
||||
if (secondaryResource != null) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -87,5 +87,12 @@
|
|||
value="aviation/config"
|
||||
recursive="true">
|
||||
</path>
|
||||
<path
|
||||
application="AvnFPS"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Avnwatch"
|
||||
value="aviation/avnwatch"
|
||||
recursive="true">
|
||||
</path>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -55,7 +55,6 @@ import org.eclipse.swt.widgets.MenuItem;
|
|||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Spinner;
|
||||
|
||||
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
|
||||
import com.raytheon.viz.avnconfig.HelpUsageDlg;
|
||||
import com.raytheon.viz.avnconfig.ITafSiteConfig;
|
||||
|
@ -80,6 +79,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* 9/12/2008 1444 grichard Accommodate separate message logs.
|
||||
* 3/31/2011 8774 rferrel killProcess when doing a disposed
|
||||
* 4/14/2011 8861 rferrel Use SaveImageDlg class
|
||||
* 23JUL2012 15169 zhao Use Combo for 'Month' and 'Number of Months'
|
||||
* & disabled site controls while drawing
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -101,14 +102,14 @@ public class WindRosePlotDlg extends CaveSWTDialog {
|
|||
private List siteList;
|
||||
|
||||
/**
|
||||
* Month spinner.
|
||||
* Month
|
||||
*/
|
||||
private Spinner monthSpnr;
|
||||
private Combo monthCbo;
|
||||
|
||||
/**
|
||||
* Number of months.
|
||||
*/
|
||||
private Spinner numMonthsSpnr;
|
||||
private Combo numMonthsCbo;
|
||||
|
||||
/**
|
||||
* Hours spinner.
|
||||
|
@ -427,20 +428,19 @@ public class WindRosePlotDlg extends CaveSWTDialog {
|
|||
Label monthLbl = new Label(monthHourComp, SWT.NONE);
|
||||
monthLbl.setText("Month:");
|
||||
|
||||
gd = new GridData(40, SWT.DEFAULT);
|
||||
monthSpnr = new Spinner(monthHourComp, SWT.BORDER);
|
||||
monthSpnr.setDigits(0);
|
||||
monthSpnr.setIncrement(1);
|
||||
monthSpnr.setPageIncrement(3);
|
||||
monthSpnr.setMinimum(1);
|
||||
monthSpnr.setMaximum(12);
|
||||
monthSpnr.setSelection(cal.get(Calendar.MONTH) + 1);
|
||||
monthSpnr.setLayoutData(gd);
|
||||
monthSpnr.addSelectionListener(new SelectionAdapter() {
|
||||
gd = new GridData(66, SWT.DEFAULT);
|
||||
monthCbo = new Combo(monthHourComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||
monthCbo.setLayoutData(gd);
|
||||
for ( int i = 1; i <= 12; i++ ) {
|
||||
monthCbo.add(""+i, i-1);
|
||||
}
|
||||
monthCbo.select(cal.get(Calendar.MONTH));
|
||||
monthCbo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
//System.out.println(" *************** monthsCbo.getText() = " + monthCbo.getText() );
|
||||
if (autoRedrawChk.getSelection()) {
|
||||
redrawWindRose();
|
||||
redrawWindRose();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -448,20 +448,19 @@ public class WindRosePlotDlg extends CaveSWTDialog {
|
|||
Label numMonthLbl = new Label(monthHourComp, SWT.NONE);
|
||||
numMonthLbl.setText("Num Months:");
|
||||
|
||||
gd = new GridData(40, SWT.DEFAULT);
|
||||
numMonthsSpnr = new Spinner(monthHourComp, SWT.BORDER);
|
||||
numMonthsSpnr.setDigits(0);
|
||||
numMonthsSpnr.setIncrement(1);
|
||||
numMonthsSpnr.setPageIncrement(3);
|
||||
numMonthsSpnr.setMinimum(1);
|
||||
numMonthsSpnr.setMaximum(12);
|
||||
numMonthsSpnr.setSelection(1);
|
||||
numMonthsSpnr.setLayoutData(gd);
|
||||
numMonthsSpnr.addSelectionListener(new SelectionAdapter() {
|
||||
gd = new GridData(66, SWT.DEFAULT);
|
||||
numMonthsCbo = new Combo(monthHourComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||
numMonthsCbo.setLayoutData(gd);
|
||||
for ( int i = 1; i <= 12; i++ ) {
|
||||
numMonthsCbo.add(""+i, i-1);
|
||||
}
|
||||
numMonthsCbo.select(0);
|
||||
numMonthsCbo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
//System.out.println(" *************** numMonthsCbo.getText() = " + numMonthsCbo.getText() );
|
||||
if (autoRedrawChk.getSelection()) {
|
||||
redrawWindRose();
|
||||
redrawWindRose();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -586,8 +585,10 @@ public class WindRosePlotDlg extends CaveSWTDialog {
|
|||
generateWindRoseHeader();
|
||||
|
||||
windRoseCanvasComp.updateAndRedraw(windRoseConfigData.cloneData(),
|
||||
windRoseHeader, monthSpnr.getText(),
|
||||
numMonthsSpnr.getText(), hourSpnr.getText(),
|
||||
windRoseHeader,
|
||||
monthCbo.getText(),
|
||||
numMonthsCbo.getText(),
|
||||
hourSpnr.getText(),
|
||||
numHoursSpnr.getText(), flightCatCbo.getSelectionIndex(),
|
||||
siteList.getItem(siteList.getSelectionIndex()), this);
|
||||
}
|
||||
|
@ -599,11 +600,21 @@ public class WindRosePlotDlg extends CaveSWTDialog {
|
|||
if (state == true) {
|
||||
++busyCount;
|
||||
shell.setCursor(waitCursor);
|
||||
monthCbo.setEnabled(false);
|
||||
numMonthsCbo.setEnabled(false);
|
||||
hourSpnr.setEnabled(false);
|
||||
numHoursSpnr.setEnabled(false);
|
||||
flightCatCbo.setEnabled(false);
|
||||
drawBtn.setEnabled(false);
|
||||
} else {
|
||||
--busyCount;
|
||||
if (busyCount == 0) {
|
||||
shell.setCursor(defaultCursor);
|
||||
monthCbo.setEnabled(true);
|
||||
numMonthsCbo.setEnabled(true);
|
||||
hourSpnr.setEnabled(true);
|
||||
numHoursSpnr.setEnabled(true);
|
||||
flightCatCbo.setEnabled(true);
|
||||
drawBtn.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
@ -634,23 +645,21 @@ public class WindRosePlotDlg extends CaveSWTDialog {
|
|||
header.append(siteList.getItem(siteList.getSelectionIndex()));
|
||||
header.append(" ");
|
||||
|
||||
header.append(MONTHS[monthSpnr.getSelection() - 1]);
|
||||
header.append(MONTHS[monthCbo.getSelectionIndex()]);
|
||||
|
||||
if (numMonthsSpnr.getSelection() == 1) {
|
||||
if ( numMonthsCbo.getSelectionIndex() == 0 ) {
|
||||
header.append(" ");
|
||||
} else {
|
||||
header.append("-");
|
||||
|
||||
int endMonth = 0;
|
||||
|
||||
if (((numMonthsSpnr.getSelection() - 1) + monthSpnr.getSelection()) > 12) {
|
||||
endMonth = (numMonthsSpnr.getSelection() - 1)
|
||||
+ monthSpnr.getSelection() - 12;
|
||||
header.append(MONTHS[endMonth - 1]);
|
||||
if ( ( numMonthsCbo.getSelectionIndex() + monthCbo.getSelectionIndex() ) > 11 ) {
|
||||
endMonth = numMonthsCbo.getSelectionIndex() + monthCbo.getSelectionIndex() - 12;
|
||||
header.append(MONTHS[endMonth]);
|
||||
} else {
|
||||
endMonth = (numMonthsSpnr.getSelection() - 1)
|
||||
+ monthSpnr.getSelection();
|
||||
header.append(MONTHS[endMonth - 1]);
|
||||
endMonth = numMonthsCbo.getSelectionIndex() + monthCbo.getSelectionIndex();
|
||||
header.append(MONTHS[endMonth]);
|
||||
}
|
||||
header.append(" ");
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.io.FileInputStream;
|
|||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.FileChannel.MapMode;
|
||||
import java.util.ArrayList;
|
||||
|
@ -69,6 +70,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* 7/1/06 chammack Initial Creation.
|
||||
* 1/10/08 562 bphillip Modified to handle .bcx files
|
||||
* 02/11/09 njensen Refactored to new rsc architecture
|
||||
* 07/31/12 DR 14935 D. Friedman Handle little-endian files
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -190,6 +192,14 @@ public class BCDResource extends
|
|||
|
||||
ByteBuffer buffer = fc.map(MapMode.READ_ONLY, 0, file.length());
|
||||
|
||||
// Determine byte order of data
|
||||
if (buffer.remaining() >= 4) {
|
||||
// Whether BCX or not, first value is an int.
|
||||
// Note: Different from A1 which tests >31 or >500
|
||||
if (buffer.getInt(0) > Short.MAX_VALUE)
|
||||
buffer.order(ByteOrder.LITTLE_ENDIAN);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
|
||||
double minLat = Double.MAX_VALUE;
|
||||
|
|
|
@ -88,6 +88,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
|||
* practice and test modes
|
||||
* Sep 16, 2010 6831 ryu Show same product for different areas on a sub-menu
|
||||
* Nov 22, 2011 8781 mli remove Processor menu
|
||||
* Jul 26, 2012 15165 ryu Set default db source when formatter has no db defined.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -776,6 +777,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements
|
|||
ProductDefinition prodDef = textProductMgr
|
||||
.getProductDefinition(productName);
|
||||
String dataSource = (String) prodDef.get("database");
|
||||
if (dataSource == null)
|
||||
dataSource = "Official";
|
||||
|
||||
if (dataSource.equals("ISC")) {
|
||||
selectedDataSource = getIscDataSource();
|
||||
|
|
|
@ -66,6 +66,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 04/08/2008 chammack Initial Port from AWIPS I (minus ISC support)
|
||||
* 07/23/2012 #936 dgilling Reinstate config-handling code to
|
||||
* calcGridLabels().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -253,7 +255,7 @@ public class SamplePainter {
|
|||
private void calcGridLabels(Coordinate worldLoc, final List<GridID> grids,
|
||||
final GridID imageGrid, List<String> sampleLabels, List<RGB> colors) {
|
||||
|
||||
if (grids.size() == 0) {
|
||||
if (grids.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -261,9 +263,9 @@ public class SamplePainter {
|
|||
// all parms
|
||||
List<String> limitSamples = Arrays.asList(Activator.getDefault()
|
||||
.getPreferenceStore().getStringArray("SampleParms"));
|
||||
|
||||
// assumes all grids shared same grid location.
|
||||
boolean inGrid = false;
|
||||
|
||||
Coordinate gridCoordinate = MapUtil.latLonToGridCoordinate(worldLoc,
|
||||
PixelOrientation.UPPER_LEFT, grids.get(0).getParm()
|
||||
.getGridInfo().getGridLoc());
|
||||
|
@ -280,27 +282,41 @@ public class SamplePainter {
|
|||
inGrid = true;
|
||||
}
|
||||
|
||||
// sample label color
|
||||
RGB labelColor = new RGB(255, 255, 255);
|
||||
|
||||
// get the list of samples that should be painted and in the
|
||||
// order
|
||||
for (GridID grid : grids) {
|
||||
String pName = grid.getParm().getParmID().compositeNameUI();
|
||||
|
||||
// do we plot this weather element?
|
||||
if ((limitSamples.size() != 0) && !limitSamples.contains(pName)) {
|
||||
if ((!limitSamples.isEmpty()) && !limitSamples.contains(pName)) {
|
||||
continue; // skip
|
||||
}
|
||||
|
||||
// calculate color
|
||||
RGB labelColor = grid.getParm().getDisplayAttributes()
|
||||
.getBaseColor();
|
||||
|
||||
if (grid.equals(imageGrid)) {
|
||||
RGB color = new RGB(255, 255, 255);
|
||||
String colorName = Activator.getDefault().getPreferenceStore()
|
||||
.getString("ImageLegend_color");
|
||||
if (!colorName.isEmpty()) {
|
||||
color = RGBColors.getRGBColor(colorName);
|
||||
}
|
||||
labelColor = color;
|
||||
}
|
||||
String parmColorName = Activator.getDefault().getPreferenceStore()
|
||||
.getString(pName + "_Sample_color");
|
||||
if (!parmColorName.isEmpty()) {
|
||||
labelColor = RGBColors.getRGBColor(parmColorName);
|
||||
}
|
||||
|
||||
// get the data value
|
||||
String label = NO_DATA_LABEL;
|
||||
if (inGrid) {
|
||||
|
||||
// isc mode or grid from isc database
|
||||
if (showISC || grid.getParm().getParmState().isIscParm()) {
|
||||
label = iscSampleLabel(grid, gridCoordinate);
|
||||
|
||||
} else if (showDataValues) {
|
||||
final IGridData gridData = grid.grid();
|
||||
if (gridData != null) {
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.raytheon.viz.gfe.core.msgs.Message;
|
|||
import com.raytheon.viz.gfe.core.msgs.Message.IMessageClient;
|
||||
import com.raytheon.viz.gfe.core.msgs.ShowQuickViewDataMsg;
|
||||
import com.raytheon.viz.gfe.core.parm.Parm;
|
||||
import com.raytheon.viz.gfe.core.parm.ParmDisplayAttributes.VisMode;
|
||||
import com.raytheon.viz.gfe.edittool.EditToolPaintProperties;
|
||||
import com.raytheon.viz.gfe.edittool.GridID;
|
||||
import com.raytheon.viz.gfe.rsc.GFEFonts;
|
||||
|
@ -45,16 +46,18 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
|
||||
/**
|
||||
* Handles the display for on-demand sampling capability.
|
||||
*
|
||||
* Roughly based on AWIPS I class of the same name.
|
||||
* <p>
|
||||
* Roughly based on AWIPS I class SampleVisual.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 04/08/2008 chammack Initial Creation.
|
||||
* 11Jun2008 #1193 ebabin Updates for toggling lat/lon for sample set.
|
||||
* 06/11/2008 #1193 ebabin Updates for toggling lat/lon for sample set.
|
||||
* 07/21/2009 bphillip Removed the points field
|
||||
* 07/23/2012 #936 dgilling Properly retrieve imageGrid for paintMarkers()
|
||||
* and paintSamples().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -148,13 +151,17 @@ public class SampleRenderable implements IRenderable, IMessageClient {
|
|||
imageGrid = qvGrid;
|
||||
} else {
|
||||
Parm[] parms = sdm.getCurrentlyEnabledParms();
|
||||
Parm imageParm = sdm.getActivatedParm();
|
||||
Parm imageParm = null;
|
||||
Arrays.sort(parms);
|
||||
gids = new ArrayList<GridID>(parms.length);
|
||||
|
||||
Date date = sdm.getSpatialEditorTime();
|
||||
for (int i = 0; i < parms.length; i++) {
|
||||
gids.add(new GridID(parms[i], date));
|
||||
|
||||
for (Parm p : parms) {
|
||||
gids.add(new GridID(p, date));
|
||||
|
||||
if (p.getDisplayAttributes().getVisMode() == VisMode.IMAGE) {
|
||||
imageParm = p;
|
||||
}
|
||||
}
|
||||
|
||||
imageGrid = new GridID(imageParm, date);
|
||||
|
@ -184,12 +191,16 @@ public class SampleRenderable implements IRenderable, IMessageClient {
|
|||
|
||||
Date date = sdm.getSpatialEditorTime();
|
||||
Parm[] parms = sdm.getCurrentlyEnabledParms();
|
||||
Parm imageParm = sdm.getActivatedParm();
|
||||
Parm imageParm = null;
|
||||
|
||||
Arrays.sort(parms);
|
||||
GridID[] grids = new GridID[parms.length];
|
||||
for (int i = 0; i < parms.length; i++) {
|
||||
grids[i] = new GridID(parms[i], date);
|
||||
|
||||
if (parms[i].getDisplayAttributes().getVisMode() == VisMode.IMAGE) {
|
||||
imageParm = parms[i];
|
||||
}
|
||||
}
|
||||
|
||||
GridID imageGrid = new GridID(imageParm, date);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -2422,12 +2422,12 @@
|
|||
<imageStyle>
|
||||
<displayUnits>%</displayUnits>
|
||||
<range scale="LINEAR">
|
||||
<minValue>5</minValue>
|
||||
<minValue>-1</minValue>
|
||||
<maxValue>105</maxValue>
|
||||
</range>
|
||||
<defaultColormap>Grid/warm to cold</defaultColormap>
|
||||
<colorbarLabeling>
|
||||
<increment>20</increment>
|
||||
<values>20 40 60 80 100</values>
|
||||
</colorbarLabeling>
|
||||
</imageStyle>
|
||||
</styleRule>
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -247,7 +249,7 @@ public class D2DGribGridResource extends GribGridResource<GridResourceData>
|
|||
// The default type does not display in the legend
|
||||
legendParams.type = "";
|
||||
} else if (displayType == DisplayType.STREAMLINE) {
|
||||
legendParams.type = "Streamlines";
|
||||
legendParams.type = "Strmlns";
|
||||
} else if (displayType == DisplayType.BARB) {
|
||||
legendParams.type = "Wind Barbs";
|
||||
} else if (displayType == DisplayType.ARROW) {
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -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);
|
||||
|
|
|
@ -87,8 +87,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* so that it would place the
|
||||
* entire time series within the
|
||||
* printable area of the page.
|
||||
* 04 Mar 2011 7644 lbousaid fixed Zoom in feature
|
||||
* 30 May 2012 14967 wkwock fix insert deleted data to rejecteddata table
|
||||
* 04 Mar 2011 7644 lbousaid fixed Zoom in feature
|
||||
* 30 May 2012 14967 wkwock fix insert deleted data to rejecteddata table
|
||||
* 23 Jul 2012 15195 mpduff Fix dates for displaying groups
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -1360,22 +1361,9 @@ public class TimeSeriesDisplayDlg extends CaveSWTDialog {
|
|||
linesMI.setSelection(true);
|
||||
}
|
||||
|
||||
/* Get time data from group info */
|
||||
int pastHours = groupInfo.getPastHours();
|
||||
int futureHours = groupInfo.getFutureHours();
|
||||
|
||||
Calendar futureCal = Calendar.getInstance(TimeZone
|
||||
.getTimeZone("GMT"));
|
||||
Date d = SimulatedTime.getSystemTime().getTime();
|
||||
futureCal.setTime(d);
|
||||
futureCal.add(Calendar.HOUR_OF_DAY, futureHours);
|
||||
Calendar pastCal = Calendar.getInstance(TimeZone
|
||||
.getTimeZone("GMT"));
|
||||
pastCal.setTime(d);
|
||||
pastCal.add(Calendar.HOUR_OF_DAY, pastHours * -1);
|
||||
displayCanvas = new TimeSeriesDisplayCanvas(this,
|
||||
canvasComp, gd, pastCal.getTime(),
|
||||
futureCal.getTime(), groupInfo.isGroupSelected());
|
||||
canvasComp, gd, beginDate,
|
||||
endDate, groupInfo.isGroupSelected());
|
||||
displayCanvas.setHorizontalSpan(gd.getXsize());
|
||||
displayCanvas.setVerticalSpan(gd.getYsize());
|
||||
displayCanvas.showGridLines(groupInfo.isGridLines());
|
||||
|
|
|
@ -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.
|
||||
* </pre>
|
||||
*
|
||||
* @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);
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -141,7 +141,7 @@ public class FFGGridResource extends
|
|||
String user_id = System.getProperty("user.name");
|
||||
this.duration = data.getDuration();
|
||||
colorSet = HydroDisplayManager.getInstance().getFFGColorMap(user_id,
|
||||
"FFG", duration * 60 * 1000);
|
||||
"FFG", duration);
|
||||
|
||||
loadData();
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ public class FFGGridResource extends
|
|||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
|
||||
int hours = this.resourceData.getDuration()
|
||||
/ HydroConstants.MILLIS_PER_HOUR;
|
||||
/ HydroConstants.SECONDS_PER_HOUR;
|
||||
String hourStr = "hour";
|
||||
if (hours != 1) {
|
||||
hourStr = hourStr.concat("s");
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
</resourceData>
|
||||
</resource>
|
||||
<timeMatcher xsi:type="d2DTimeMatcher" deltaFilter="0" forecastFilter="0"/>
|
||||
<numberOfFrames>12</numberOfFrames>
|
||||
</descriptor>
|
||||
</displays>
|
||||
</displayList>
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
</resourceData>
|
||||
</resource>
|
||||
<timeMatcher xsi:type="d2DTimeMatcher" deltaFilter="0" forecastFilter="0"/>
|
||||
<numberOfFrames>12</numberOfFrames>
|
||||
</descriptor>
|
||||
</displays>
|
||||
</displayList>
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
</resourceData>
|
||||
</resource>
|
||||
<timeMatcher xsi:type="d2DTimeMatcher" deltaFilter="0" forecastFilter="0"/>
|
||||
<numberOfFrames>12</numberOfFrames>
|
||||
</descriptor>
|
||||
</displays>
|
||||
</displayList>
|
||||
|
|
|
@ -64,7 +64,10 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
* 11/8/2007 520 grichard Implemented build 11 features.
|
||||
* 11/26/2007 520 grichard Implemented SuperSite in preparation for JiBX'ng.
|
||||
* 12/14/2007 582 grichard Implemented build 12 features.
|
||||
*
|
||||
* ======================================
|
||||
* AWIPS2 DR Work
|
||||
* 07/24/2012 939 jkorman Modified parseAfosMasterPil() handle blank lines as well
|
||||
* as lines with trailing whitespace.
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
|
@ -73,6 +76,21 @@ public final class AfosBrowserModel {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AfosBrowserModel.class);
|
||||
|
||||
// Need at least this many characters in an afosMasterPIL entry
|
||||
// Need the CCCNNN and at least a 1 character XXX
|
||||
private static final int MIN_MASTPIL_LEN = 7;
|
||||
// but no more than 9 characters.
|
||||
private static final int MAX_MASTPIL_LEN = 9;
|
||||
|
||||
private static final int CCC_PIL_POS = 0;
|
||||
|
||||
private static final int NNN_PIL_POS = 3;
|
||||
|
||||
private static final int XXX_PIL_POS = 6;
|
||||
|
||||
private static final String SITE_WILDCARD = "@@@";
|
||||
|
||||
private static final String COMMENT_DELIM = "#";
|
||||
/**
|
||||
* The VTEC Afos Product enumeration
|
||||
*/
|
||||
|
@ -265,7 +283,7 @@ public final class AfosBrowserModel {
|
|||
br = new BufferedReader(new FileReader(fileToParse));
|
||||
while ((line = br.readLine()) != null) {
|
||||
// skip comments.
|
||||
if (line.startsWith("#")) {
|
||||
if (line.startsWith(COMMENT_DELIM)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -294,7 +312,7 @@ public final class AfosBrowserModel {
|
|||
br = new BufferedReader(new FileReader(fileToParse));
|
||||
while ((line = br.readLine()) != null) {
|
||||
// skip comments.
|
||||
if (line.startsWith("#")) {
|
||||
if (line.startsWith(COMMENT_DELIM)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -324,7 +342,7 @@ public final class AfosBrowserModel {
|
|||
br = new BufferedReader(new FileReader(fileToParse));
|
||||
while ((line = br.readLine()) != null) {
|
||||
// skip comments.
|
||||
if (line.startsWith("#")) {
|
||||
if (line.startsWith(COMMENT_DELIM)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -351,42 +369,69 @@ public final class AfosBrowserModel {
|
|||
return cccOriginMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read and parse an afos PIL list. In the event of processing multiple
|
||||
* files, the most recent entry overwrites a current entry.
|
||||
*
|
||||
* @param fileToParse
|
||||
* File reference containing the PIL list.
|
||||
*/
|
||||
private void parseAfosMasterPil(File fileToParse) {
|
||||
if (fileToParse != null && fileToParse.exists()) {
|
||||
BufferedReader br = null;
|
||||
String line = null;
|
||||
|
||||
String localCCC = SiteMap.getInstance()
|
||||
.getCCCFromXXXCode(localSite);
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(fileToParse));
|
||||
|
||||
while ((line = br.readLine()) != null) {
|
||||
// skip comments.
|
||||
if (line.startsWith("#")) {
|
||||
// Remove any trailing spaces.
|
||||
line = line.trim();
|
||||
// skip blank lines or comments.
|
||||
if ((line.length() == 0) || line.startsWith(COMMENT_DELIM)) {
|
||||
continue;
|
||||
}
|
||||
String ccc = line.substring(0, 3);
|
||||
if (line.length() >= MIN_MASTPIL_LEN) {
|
||||
String ccc = line.substring(CCC_PIL_POS, NNN_PIL_POS);
|
||||
if (ccc.equals(SITE_WILDCARD)) {
|
||||
ccc = localCCC;
|
||||
}
|
||||
String nnn = line.substring(NNN_PIL_POS, XXX_PIL_POS);
|
||||
String xxx;
|
||||
if(line.length() > MAX_MASTPIL_LEN) {
|
||||
// Only take the first 9 characters of the line.
|
||||
// Trim in case there are any internal spaces.
|
||||
xxx = line.substring(XXX_PIL_POS, MAX_MASTPIL_LEN + 1).trim();
|
||||
} else {
|
||||
// Just grab the remainder of the input line.
|
||||
// Its already been trimmed.
|
||||
xxx = line.substring(6);
|
||||
}
|
||||
|
||||
if (ccc.equals("@@@")) {
|
||||
ccc = SiteMap.getInstance()
|
||||
.getCCCFromXXXCode(localSite);
|
||||
Map<String, SortedSet<String>> nnnxxx = masterPil
|
||||
.get(ccc);
|
||||
if (nnnxxx == null) {
|
||||
nnnxxx = new HashMap<String, SortedSet<String>>();
|
||||
masterPil.put(ccc, nnnxxx);
|
||||
}
|
||||
|
||||
SortedSet<String> xxxList = nnnxxx.get(nnn);
|
||||
if (xxxList == null) {
|
||||
xxxList = new TreeSet<String>();
|
||||
nnnxxx.put(nnn, xxxList);
|
||||
}
|
||||
|
||||
xxxList.add(xxx);
|
||||
} else {
|
||||
String msg = String.format(
|
||||
"Line [%s] in file %s incorrect", line,
|
||||
fileToParse.getPath());
|
||||
|
||||
statusHandler.handle(Priority.SIGNIFICANT, msg);
|
||||
}
|
||||
|
||||
String nnn = line.substring(3, 6);
|
||||
String xxx = line.substring(6);
|
||||
|
||||
Map<String, SortedSet<String>> nnnxxx = masterPil.get(ccc);
|
||||
if (nnnxxx == null) {
|
||||
nnnxxx = new HashMap<String, SortedSet<String>>();
|
||||
masterPil.put(ccc, nnnxxx);
|
||||
}
|
||||
|
||||
SortedSet<String> xxxList = nnnxxx.get(nnn);
|
||||
if (xxxList == null) {
|
||||
xxxList = new TreeSet<String>();
|
||||
nnnxxx.put(nnn, xxxList);
|
||||
}
|
||||
|
||||
xxxList.add(xxx);
|
||||
} // while
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
|
@ -519,7 +564,7 @@ public final class AfosBrowserModel {
|
|||
public boolean contains(String ccc, String nnn, String xxx) {
|
||||
boolean rval = false;
|
||||
Map<String, SortedSet<String>> catMap = masterPil.get(ccc);
|
||||
if (catMap != null) {
|
||||
if ((catMap != null) && (xxx != null)) {
|
||||
SortedSet<String> desList = catMap.get(nnn);
|
||||
if (desList != null) {
|
||||
rval = desList.contains(xxx);
|
||||
|
|
|
@ -67,6 +67,7 @@ import com.raytheon.viz.texteditor.alarmalert.util.FlashBellJob;
|
|||
* Dec 23, 2010 7375 cjeanbap Force dialog ON TOP of over Dialog/Windows.
|
||||
* 03/19/2012 D. Friedman Fix alarming. Disable runloop in open().
|
||||
* May 18, 2012 jkorman Added flashing alarm image.
|
||||
* Jul 25, 2012 15122 rferrel Add sound delay interval.
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
|
@ -75,10 +76,15 @@ import com.raytheon.viz.texteditor.alarmalert.util.FlashBellJob;
|
|||
|
||||
public class AlarmAlertBell extends Dialog implements MouseMoveListener,
|
||||
MouseListener {
|
||||
|
||||
|
||||
// delay in milliseconds - flash every 1 1/2 seconds
|
||||
private static final int FLASH_DELAY = 1500;
|
||||
|
||||
|
||||
/**
|
||||
* Repeat the alarm sound every minute.
|
||||
*/
|
||||
private static final long SOUND_DELAY = 60 * 1000L;
|
||||
|
||||
private Shell parentShell;
|
||||
|
||||
private Shell alarmShell;
|
||||
|
@ -90,15 +96,15 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
|
|||
private String bellPath;
|
||||
|
||||
private FlashBellJob flasher;
|
||||
|
||||
|
||||
private Image norm_bell;
|
||||
|
||||
private Image revs_bell;
|
||||
|
||||
private boolean invert = false;
|
||||
|
||||
|
||||
private boolean active = false;
|
||||
|
||||
|
||||
private Button button;
|
||||
|
||||
private AlarmBeepJob abj = null;
|
||||
|
@ -196,9 +202,9 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
|
|||
}
|
||||
|
||||
public Object open(boolean alarm) {
|
||||
if (alarm) {
|
||||
if (alarm && abj == null) {
|
||||
// provides the beep to alert the user that an alarm has come in
|
||||
abj = new AlarmBeepJob("AlarmBeepJob");
|
||||
abj = new AlarmBeepJob("AlarmBeepJob", SOUND_DELAY);
|
||||
abj.schedule();
|
||||
}
|
||||
|
||||
|
@ -216,28 +222,33 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
|
|||
alarmShell.setActive();
|
||||
active = true;
|
||||
// Start a new flash job only if one isn't currently running!
|
||||
if(flasher == null) {
|
||||
if (flasher == null) {
|
||||
invert = false;
|
||||
flasher = new FlashBellJob("FlashBell", this, FLASH_DELAY);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the AlarmAlertBell and turn off the "flasher" job
|
||||
* if running.
|
||||
* Close the AlarmAlertBell and turn off the "flasher" and "abj" job if
|
||||
* running.
|
||||
*/
|
||||
public void close() {
|
||||
if(!alarmShell.isDisposed()) {
|
||||
if (!alarmShell.isDisposed()) {
|
||||
alarmShell.setVisible(false);
|
||||
}
|
||||
active = false;
|
||||
if(flasher != null) {
|
||||
if (flasher != null) {
|
||||
flasher.cancel();
|
||||
flasher = null;
|
||||
}
|
||||
if (abj != null) {
|
||||
abj.cancel();
|
||||
abj = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setInitialDialogLocation() {
|
||||
if (locationX < 0) {
|
||||
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
|
@ -263,7 +274,7 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
|
|||
bellPath = imageFile.getFile().getAbsolutePath();
|
||||
norm_bell = new Image(display, bellPath);
|
||||
button = new Button(alarmShell, SWT.IMAGE_GIF);
|
||||
if(norm_bell != null) {
|
||||
if (norm_bell != null) {
|
||||
createInvertImage(bellPath);
|
||||
button.setImage(norm_bell);
|
||||
}
|
||||
|
@ -330,12 +341,12 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
|
|||
private void createInvertImage(String path) {
|
||||
if (norm_bell != null) {
|
||||
ImageData id = new ImageData(path);
|
||||
for(int i = 0;i < id.width;i++) {
|
||||
for(int j = 0;j < id.height;j++) {
|
||||
if(id.getPixel(i,j) == 0) {
|
||||
id.setPixel(i,j,1);
|
||||
for (int i = 0; i < id.width; i++) {
|
||||
for (int j = 0; j < id.height; j++) {
|
||||
if (id.getPixel(i, j) == 0) {
|
||||
id.setPixel(i, j, 1);
|
||||
} else {
|
||||
id.setPixel(i,j,0);
|
||||
id.setPixel(i, j, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,17 +356,18 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
|
|||
|
||||
/**
|
||||
* Check to see if the dialog is active.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isActive() {
|
||||
return active;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Alternate between normal and reverse images.
|
||||
*/
|
||||
public void flash() {
|
||||
if(invert) {
|
||||
if (invert) {
|
||||
button.setImage(revs_bell);
|
||||
} else {
|
||||
button.setImage(norm_bell);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.viz.texteditor.alarmalert.dialogs;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
|
@ -37,6 +38,10 @@ import org.eclipse.swt.widgets.Text;
|
|||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.viz.texteditor.alarmalert.util.AlarmAlertFunctions;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
|
@ -49,6 +54,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 17, 2009 mnash Initial creation
|
||||
* ======================================
|
||||
* AWIPS2 DR Work
|
||||
* 07/25/2012 953 jkorman Modified file "search" to return LocalizationFile
|
||||
* instead of File so references are deleted in all locations.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -58,6 +67,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
|
||||
public class AlarmAlertSaveLoadDlg extends CaveSWTDialog {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AlarmAlertSaveLoadDlg.class);
|
||||
|
||||
private Font font;
|
||||
|
||||
private Composite shellComp;
|
||||
|
@ -136,13 +148,21 @@ public class AlarmAlertSaveLoadDlg extends CaveSWTDialog {
|
|||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
lists.setLayoutData(gd);
|
||||
LocalizationContext lc = AlarmAlertFunctions.initUserLocalization();
|
||||
LocalizationFile fileDir = PathManagerFactory.getPathManager()
|
||||
.getLocalizationFile(lc, "alarms");
|
||||
File file = fileDir.getFile();
|
||||
final File[] fileList = file.listFiles();
|
||||
for (File locFile : fileList) {
|
||||
if (locFile.getName().endsWith(".xml")) {
|
||||
lists.add(locFile.getName());
|
||||
|
||||
// Get a list of localization files!
|
||||
LocalizationFile[] fList = PathManagerFactory.getPathManager()
|
||||
.listFiles(lc, "alarms", new String[] { "xml" }, false, true);
|
||||
|
||||
final java.util.List<LocalizationFile> fileList = new ArrayList<LocalizationFile>();
|
||||
for (LocalizationFile locFile : fList) {
|
||||
// We only want the filename in the display list.
|
||||
String[] s = locFile.getName().split("/");
|
||||
// Make sure we have some data!
|
||||
if (s.length > 0) {
|
||||
// The last element is the filename.
|
||||
lists.add(s[s.length - 1]);
|
||||
// Complete file reference here.
|
||||
fileList.add(locFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,17 +190,30 @@ public class AlarmAlertSaveLoadDlg extends CaveSWTDialog {
|
|||
// loads the
|
||||
loadButton.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
// Set the filename to be returned through getFileName()
|
||||
fileName = lists.getSelection()[0];
|
||||
// TODO load the file
|
||||
shell.close();
|
||||
}
|
||||
});
|
||||
|
||||
// delete the file from the list and from the file system
|
||||
// delete the file from the display list and from the file system
|
||||
deleteButton.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
int num = lists.getSelectionIndex();
|
||||
fileList[num].delete();
|
||||
LocalizationFile f = fileList.get(num);
|
||||
try {
|
||||
if (!f.delete()) {
|
||||
String msg = String.format(
|
||||
"ALARM/ALERT:Failed deleting file %s", f
|
||||
.getFile().getPath());
|
||||
statusHandler.handle(Priority.PROBLEM, msg);
|
||||
}
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
String msg = String.format(
|
||||
"ALARM/ALERT:Failed deleting file %s", f.getFile()
|
||||
.getPath());
|
||||
statusHandler.handle(Priority.PROBLEM, msg, e);
|
||||
}
|
||||
lists.remove(num);
|
||||
}
|
||||
});
|
||||
|
@ -250,8 +283,8 @@ public class AlarmAlertSaveLoadDlg extends CaveSWTDialog {
|
|||
// get the file name
|
||||
saveButton.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
// Set the filename to be returned through getFileName()
|
||||
fileName = textBox.getText();
|
||||
// TODO load the file
|
||||
shell.close();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -188,15 +188,17 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
|
|||
lines.append(text.getLine(lineIndex)).append("\n");
|
||||
}
|
||||
|
||||
PrintDisplay.print(true, lines.toString(),
|
||||
UFStatus.getHandler(AlarmDisplayWindow.class));
|
||||
PrintDisplay.print(lines.toString(), text.getFont()
|
||||
.getFontData()[0], UFStatus
|
||||
.getHandler(AlarmDisplayWindow.class));
|
||||
}
|
||||
});
|
||||
|
||||
printBuffer.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
PrintDisplay.print(true, text.getText(),
|
||||
PrintDisplay.print(text.getText(),
|
||||
text.getFont().getFontData()[0],
|
||||
UFStatus.getHandler(AlarmDisplayWindow.class));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -27,8 +27,6 @@ import java.io.FileWriter;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.xml.bind.JAXB;
|
||||
|
||||
|
@ -76,7 +74,7 @@ public class AlarmAlertFunctions {
|
|||
private static final AlarmAlertProduct.ProductType AA = AlarmAlertProduct.ProductType.Alarm_Alert;
|
||||
|
||||
private static final AlarmAlertProduct.ProductType PA = AlarmAlertProduct.ProductType.Proximity_Alarm;
|
||||
|
||||
|
||||
private static final Object configFileLock = new Object();
|
||||
|
||||
private static final String ALARM_ALERT_PATH = "alarms" + File.separator;
|
||||
|
@ -130,50 +128,52 @@ public class AlarmAlertFunctions {
|
|||
*/
|
||||
public static void isInAlarmList(AlarmAlertProduct prod) {
|
||||
AlarmAlertLists instance = AlarmAlertLists.getInstance();
|
||||
|
||||
|
||||
List<AlarmAlertProduct> currentAlarms = instance.getFilteredProducts();
|
||||
boolean alarm = false;
|
||||
List<AlarmAlertProduct> prods = findMatches(prod.getProductId(), currentAlarms);
|
||||
List<AlarmAlertProduct> prods = findMatches(prod.getProductId(),
|
||||
currentAlarms);
|
||||
// did we match anything?
|
||||
boolean alertAlarm = (prods.size() > 0);
|
||||
if(alertAlarm) {
|
||||
if (alertAlarm) {
|
||||
String pId = prods.get(0).getProductId();
|
||||
// first go get the product. All of the matching product identifiers are
|
||||
// first go get the product. All of the matching product identifiers
|
||||
// are
|
||||
// the same so just get the first.
|
||||
List<StdTextProduct> prodList = getProduct(pId);
|
||||
AlarmAlertProduct productFound = null;
|
||||
if(prodList.size() > 0) {
|
||||
if (prodList.size() > 0) {
|
||||
String s = prodList.get(0).getProduct();
|
||||
for(AlarmAlertProduct p : prods) {
|
||||
for (AlarmAlertProduct p : prods) {
|
||||
String search = p.getSearchString();
|
||||
|
||||
|
||||
boolean match = false;
|
||||
if((search != null) && (search.length() > 0)) {
|
||||
if(s.indexOf(search) >= 0) {
|
||||
match = true;
|
||||
if ((search != null) && (search.length() > 0)) {
|
||||
if (s.indexOf(search) >= 0) {
|
||||
match = true;
|
||||
}
|
||||
} else {
|
||||
match = true;
|
||||
match = true;
|
||||
}
|
||||
if (match) {
|
||||
if (productFound == null)
|
||||
productFound = p;
|
||||
if ("Alarm".equals(p.getAlarmType()) && p.isAlarm()) {
|
||||
alarm = true;
|
||||
productFound = p;
|
||||
}
|
||||
if (alarm)
|
||||
break;
|
||||
if (productFound == null)
|
||||
productFound = p;
|
||||
if ("Alarm".equals(p.getAlarmType()) && p.isAlarm()) {
|
||||
alarm = true;
|
||||
productFound = p;
|
||||
}
|
||||
if (alarm)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(productFound != null) {
|
||||
if (productFound != null) {
|
||||
prod.setAlarm(productFound.isAlarm());
|
||||
prod.setAlarmType(productFound.getAlarmType());
|
||||
|
||||
|
||||
instance.getCurrentAlarms().add(prod);
|
||||
instance.fireNewCurrentAlarmEvent(prod);
|
||||
|
||||
|
||||
ringBell(alarm);
|
||||
}
|
||||
}
|
||||
|
@ -184,46 +184,51 @@ public class AlarmAlertFunctions {
|
|||
}
|
||||
|
||||
/**
|
||||
* Retrieve a text product from the text database based on its productId.
|
||||
* @param productId AFOS ProductId to retrieve from the text database.
|
||||
* Retrieve a text product from the text database based on its productId.
|
||||
*
|
||||
* @param productId
|
||||
* AFOS ProductId to retrieve from the text database.
|
||||
* @return A list of text products. Will always return a not null reference.
|
||||
*/
|
||||
private static List<StdTextProduct> getProduct(String productId) {
|
||||
List<StdTextProduct> productList = null;
|
||||
|
||||
|
||||
ICommand command = CommandFactory.getAfosCommand(productId);
|
||||
try {
|
||||
productList = command.executeCommand(TextEditorUtil.getTextDbsrvTransport());
|
||||
productList = command.executeCommand(TextEditorUtil
|
||||
.getTextDbsrvTransport());
|
||||
} catch (CommandFailedException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
if(productList == null) {
|
||||
if (productList == null) {
|
||||
productList = new ArrayList<StdTextProduct>();
|
||||
}
|
||||
return productList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return a list of all alarms that match the incoming product identifier.
|
||||
*
|
||||
* @param productId
|
||||
* @param currentAlarms
|
||||
* @return
|
||||
*/
|
||||
private static List<AlarmAlertProduct> findMatches(String productId, List<AlarmAlertProduct> currentAlarms) {
|
||||
private static List<AlarmAlertProduct> findMatches(String productId,
|
||||
List<AlarmAlertProduct> currentAlarms) {
|
||||
List<AlarmAlertProduct> prods = new ArrayList<AlarmAlertProduct>();
|
||||
if(productId != null) {
|
||||
productId = productId.toUpperCase();
|
||||
if (productId != null) {
|
||||
productId = productId.trim().toUpperCase();
|
||||
for (AlarmAlertProduct a : currentAlarms) {
|
||||
//**************
|
||||
// **************
|
||||
// TODO : For now disable Proximity Alerts
|
||||
//**************
|
||||
if(AA.equals(a.getProductType())) {
|
||||
// **************
|
||||
if (AA.equals(a.getProductType())) {
|
||||
String s = a.getProductId();
|
||||
if(s != null) {
|
||||
s = s.toUpperCase();
|
||||
if(s.equals(productId)) {
|
||||
// Reset the productId so we know we're dealing with uppercase
|
||||
if (s != null) {
|
||||
s = s.trim().toUpperCase();
|
||||
if (s.equals(productId)) {
|
||||
// Reset the productId so we know we're dealing with
|
||||
// uppercase
|
||||
a.setProductId(s);
|
||||
prods.add(a);
|
||||
}
|
||||
|
@ -233,8 +238,7 @@ public class AlarmAlertFunctions {
|
|||
}
|
||||
return prods;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* initialize the localization for user with the save/load functions
|
||||
*
|
||||
|
|
|
@ -24,7 +24,7 @@ import java.awt.Toolkit;
|
|||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.ui.progress.UIJob;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -35,6 +35,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 19, 2009 mnash Initial creation
|
||||
* Jul 25, 2012 15122 rferrel Add sound repeat interval.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -42,17 +43,29 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class AlarmBeepJob extends Job {
|
||||
public class AlarmBeepJob extends UIJob {
|
||||
|
||||
private static final int BEEP_COUNT = 5;
|
||||
|
||||
private static final long BEEP_INTERVAL = 1000L;
|
||||
|
||||
private boolean disposed;
|
||||
|
||||
private long delay;
|
||||
|
||||
private int count = 0;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public AlarmBeepJob(String name) {
|
||||
public AlarmBeepJob(String name, long delay) {
|
||||
super(name);
|
||||
|
||||
if (delay > (BEEP_COUNT * BEEP_INTERVAL)) {
|
||||
this.delay = delay;
|
||||
} else {
|
||||
this.delay = (BEEP_COUNT + 1) * BEEP_INTERVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -62,27 +75,21 @@ public class AlarmBeepJob extends Job {
|
|||
* IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||
IStatus status = Status.OK_STATUS;
|
||||
if (count < 5) {
|
||||
if (count < BEEP_COUNT) {
|
||||
Toolkit.getDefaultToolkit().beep();
|
||||
reSchedule();
|
||||
if (!disposed) {
|
||||
this.schedule(BEEP_INTERVAL);
|
||||
}
|
||||
count++;
|
||||
} else {
|
||||
dispose();
|
||||
} else if (!disposed) {
|
||||
schedule(delay - (BEEP_COUNT * BEEP_INTERVAL));
|
||||
count = 0;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schedule this job to run after the desired interval
|
||||
*/
|
||||
public void reSchedule() {
|
||||
if (!disposed) {
|
||||
this.schedule(1 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel this job and release its reference to the DataManager
|
||||
*/
|
||||
|
|
|
@ -90,6 +90,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* 01/26/2012 14468 D.Friedman Fix initial BBB field selection.
|
||||
* 05/30/2012 15046 D.Friedman Always set addressee field to ALL.
|
||||
* 06/19/2012 14975 D.Friedman Run callback when dialog is dismissed.
|
||||
* 07/26/2012 15171 rferrel Disable editor's send and clear AFOS PIL fields when
|
||||
* invalid product Id and user want to edit it anyway,
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -202,11 +204,11 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
|||
@Override
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
if (parentEditor != null)
|
||||
parentEditor.headerBlockDlgDismissed(
|
||||
Boolean.TRUE.equals(getReturnValue()));
|
||||
parentEditor.headerBlockDlgDismissed(Boolean.TRUE
|
||||
.equals(getReturnValue()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
setReturnValue(false);
|
||||
|
||||
createWmoIdFields();
|
||||
|
@ -274,7 +276,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
|||
|
||||
// Create the message/indicator group combo box.
|
||||
gd = new GridData(70, SWT.DEFAULT);
|
||||
bbbCboBx = new Combo(wmoIdComp, SWT.DROP_DOWN|SWT.READ_ONLY);
|
||||
bbbCboBx = new Combo(wmoIdComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||
bbbCboBx.setItems(BBB_LIST);
|
||||
bbbCboBx.select(3);
|
||||
bbbCboBx.setLayoutData(gd);
|
||||
|
@ -298,7 +300,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
|||
|
||||
// Create the message/indicator version group combo box.
|
||||
gd = new GridData(70, SWT.DEFAULT);
|
||||
bbbVerCboBx = new Combo(wmoIdComp, SWT.DROP_DOWN|SWT.READ_ONLY);
|
||||
bbbVerCboBx = new Combo(wmoIdComp, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||
bbbVerCboBx.setItems(CHAR_LIST);
|
||||
bbbVerCboBx.select(0);
|
||||
bbbVerCboBx.setLayoutData(gd);
|
||||
|
@ -473,7 +475,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
|||
.getTextLimit()) {
|
||||
wmoTtaaiiTF.setFocus();
|
||||
}
|
||||
|
||||
|
||||
handleAddresseeModified();
|
||||
}
|
||||
});
|
||||
|
@ -595,6 +597,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
|||
enterBtn.setEnabled(true);
|
||||
enterBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
boolean sendEnabled = true;
|
||||
if (!isProductValid()) {
|
||||
// Notify the user that the product may not be valid.
|
||||
//
|
||||
|
@ -614,15 +617,25 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
|||
if (mb.open() == SWT.NO) {
|
||||
return;
|
||||
}
|
||||
parentEditor.enableSend(false);
|
||||
sendEnabled = false;
|
||||
} else {
|
||||
parentEditor.enableSend(true);
|
||||
}
|
||||
|
||||
// call the set methods
|
||||
parentEditor.setCurrentWmoId(wmoTtaaiiTF.getText());
|
||||
parentEditor.setCurrentSiteId(ccccTF.getText());
|
||||
parentEditor.setCurrentWsfoId(wsfoIdTF.getText());
|
||||
parentEditor.setCurrentProdCategory(prodCatTF.getText());
|
||||
parentEditor.setCurrentProdDesignator(prodDesignatorTF
|
||||
.getText());
|
||||
if (sendEnabled) {
|
||||
parentEditor.setCurrentWsfoId(wsfoIdTF.getText());
|
||||
parentEditor.setCurrentProdCategory(prodCatTF.getText());
|
||||
parentEditor.setCurrentProdDesignator(prodDesignatorTF
|
||||
.getText());
|
||||
} else {
|
||||
parentEditor.setCurrentWsfoId("");
|
||||
parentEditor.setCurrentProdCategory("");
|
||||
parentEditor.setCurrentProdDesignator("");
|
||||
}
|
||||
parentEditor.setAddressee(addresseeTF.getText());
|
||||
setBbbId();
|
||||
setReturnValue(true);
|
||||
|
|
|
@ -535,22 +535,9 @@ public class AfosBrowserDlg extends CaveSWTDialog implements
|
|||
loadContinueBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
/*
|
||||
* if ((nodeList.getSelectionIndex() > -1) &&
|
||||
* (categoryList.getSelectionIndex() > -1) &&
|
||||
* designatorList.getSelectionIndex() > -1) {
|
||||
*/
|
||||
/*
|
||||
* TextDisplayModel.getInstance().setProductNode(token,
|
||||
* selectedNode);
|
||||
* TextDisplayModel.getInstance().setProductCategory(token,
|
||||
* selectedCategory);
|
||||
* TextDisplayModel.getInstance().setProductDesignator(token,
|
||||
* selectedDesignator);
|
||||
*/
|
||||
callbackClient.executeCommand(CommandFactory
|
||||
.getAfosCommand(currentAfosCommand));
|
||||
// }
|
||||
loadContinueBtn.setFocus();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -563,20 +550,8 @@ public class AfosBrowserDlg extends CaveSWTDialog implements
|
|||
loadCloseBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
/*
|
||||
* if ((nodeList.getSelectionIndex() > -1) &&
|
||||
* (categoryList.getSelectionIndex() > -1) &&
|
||||
* designatorList.getSelectionIndex() > -1) {
|
||||
* TextDisplayModel.getInstance().setProductNode(token,
|
||||
* selectedNode);
|
||||
* TextDisplayModel.getInstance().setProductCategory(token,
|
||||
* selectedCategory);
|
||||
* TextDisplayModel.getInstance().setProductDesignator(token,
|
||||
* selectedDesignator);
|
||||
*/
|
||||
callbackClient.executeCommand(CommandFactory
|
||||
.getAfosCommand(currentAfosCommand));
|
||||
// }
|
||||
|
||||
setReturnValue(false);
|
||||
shell.setVisible(false);
|
||||
|
@ -778,7 +753,7 @@ public class AfosBrowserDlg extends CaveSWTDialog implements
|
|||
// Get the designator list - ensure that the entries are three
|
||||
// characters in length.
|
||||
for (String s : xxx) {
|
||||
if(s.length() == 1) {
|
||||
if (s.length() == 1) {
|
||||
s = s + " ";
|
||||
} else if (s.length() == 2) {
|
||||
s = s + " ";
|
||||
|
|
|
@ -44,6 +44,7 @@ import java.util.Scanner;
|
|||
import java.util.TimeZone;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -67,8 +68,6 @@ import org.eclipse.swt.custom.VerifyKeyListener;
|
|||
import org.eclipse.swt.dnd.Clipboard;
|
||||
import org.eclipse.swt.dnd.TextTransfer;
|
||||
import org.eclipse.swt.dnd.Transfer;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.FocusAdapter;
|
||||
|
@ -87,6 +86,7 @@ import org.eclipse.swt.events.ShellEvent;
|
|||
import org.eclipse.swt.events.VerifyEvent;
|
||||
import org.eclipse.swt.events.VerifyListener;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.FontData;
|
||||
import org.eclipse.swt.graphics.FontMetrics;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
|
@ -279,6 +279,8 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
|||
* 24Apr2012 14548 rferrel Merging lines for wrap places a space beween words when needed.
|
||||
* 27Apr2012 14902 rferrel No longer have blank line between AWIPS ID and UGC line.
|
||||
* 06/19/2012 14975 D.Friedman Prevent zeroed-out WMO header times.
|
||||
* 18JUL2012 14457 rferrel Add mouse listener to clear site's update obs when clicked on.
|
||||
* 25JUL2012 14459 rferrel Strip WMH headers when getting all METARs.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -308,6 +310,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
private static final int END_ELEMENT_TAG_LEN = END_ELEMENT_TAG.length();
|
||||
|
||||
private static final String METAR_LINE = "^(METAR |SPECI |\\s+\\S)";
|
||||
|
||||
private static final Pattern METAR_PATTERN = Pattern.compile(METAR_LINE);
|
||||
|
||||
private final List<String> displayedPils = new ArrayList<String>();
|
||||
|
||||
private Pattern obsRegex = null;
|
||||
|
@ -943,13 +949,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
/**
|
||||
* flag to indicate it a product request is from the GUI or an updated ob.
|
||||
*/
|
||||
private boolean updating = false;
|
||||
private AtomicInteger updateCount = new AtomicInteger(0);
|
||||
|
||||
private NotifyExpiration notify;
|
||||
|
||||
private NotifyExpiration queuedNotify = null;
|
||||
|
||||
private String queuedAfos = null;
|
||||
private String queuedProduct = null;
|
||||
|
||||
/**
|
||||
* The Warngen work product id for draft PILs.
|
||||
|
@ -1090,9 +1096,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
private RemoteRetrievalRequest lastRemoteRetrievalRequest;
|
||||
|
||||
private Clipboard clipboard;
|
||||
|
||||
private enum HeaderEditSession { CLOSE_ON_EXIT, IN_EDITOR }
|
||||
|
||||
|
||||
private MouseListener updateObsListener = null;
|
||||
|
||||
private enum HeaderEditSession {
|
||||
CLOSE_ON_EXIT, IN_EDITOR
|
||||
}
|
||||
|
||||
private HeaderEditSession headerEditSession;
|
||||
|
||||
static {
|
||||
|
@ -1192,7 +1202,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
@Override
|
||||
protected void initializeComponents(final Shell shell) {
|
||||
shell.setSize(MIN_WIDTH, MIN_HEIGHT);
|
||||
Display display = getDisplay();
|
||||
clipboard = new Clipboard(getDisplay());
|
||||
|
||||
|
@ -1201,32 +1210,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
medFont = new Font(display, "Courier", 11, SWT.NORMAL);
|
||||
lrgFont = new Font(display, "Courier", 13, SWT.NORMAL);
|
||||
|
||||
// this.shell = shell;
|
||||
shell.addControlListener(new ControlAdapter() {
|
||||
public void controlResized(ControlEvent e) {
|
||||
if (canRedraw == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Shell resizedShell = (Shell) e.getSource();
|
||||
final Point point = resizedShell.getSize();
|
||||
|
||||
if (point.x != MIN_WIDTH || point.y < (MIN_HEIGHT / 2)) {
|
||||
canRedraw = false;
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
if (point.y < (MIN_HEIGHT / 2)) {
|
||||
point.y = (MIN_HEIGHT / 2);
|
||||
}
|
||||
|
||||
resizedShell.setSize(MIN_WIDTH, point.y);
|
||||
canRedraw = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (textWorkstationFlag || isWarnGenDlg) {
|
||||
shell.addShellListener(new ShellAdapter() {
|
||||
@Override
|
||||
|
@ -2632,8 +2615,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (rv == true) {
|
||||
recompileRegex();
|
||||
wordWrapEnabled = true;
|
||||
// textEditor.setWordWrap(true);
|
||||
// sizeTextEditor();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2650,10 +2631,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
smallFontItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
textEditor.setFont(smlFont);
|
||||
// textEditorComp.layout();
|
||||
sizeTextEditor();
|
||||
headerTF.setFont(smlFont);
|
||||
if (smallFontItem.getSelection()) {
|
||||
textEditor.setFont(smlFont);
|
||||
headerTF.setFont(smlFont);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -2663,10 +2644,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
mediumFontItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
textEditor.setFont(medFont);
|
||||
// textEditorComp.layout();
|
||||
sizeTextEditor();
|
||||
headerTF.setFont(medFont);
|
||||
if (mediumFontItem.getSelection()) {
|
||||
textEditor.setFont(medFont);
|
||||
headerTF.setFont(medFont);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -2675,10 +2656,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
largeFontItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
textEditor.setFont(lrgFont);
|
||||
// textEditorComp.layout();
|
||||
sizeTextEditor();
|
||||
headerTF.setFont(lrgFont);
|
||||
if (largeFontItem.getSelection()) {
|
||||
textEditor.setFont(lrgFont);
|
||||
headerTF.setFont(lrgFont);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2816,6 +2797,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
clearTextEditor();
|
||||
if (updateObsListener != null) {
|
||||
textEditor.removeMouseListener(updateObsListener);
|
||||
updateObsListener = null;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2871,7 +2856,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent event) {
|
||||
|
||||
String tmp = afosCmdTF.getText();
|
||||
tmp = tmp.trim();
|
||||
afosCmdTF.setText(tmp);
|
||||
|
@ -2959,7 +2943,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent event) {
|
||||
textEditor.setFocus();
|
||||
wmoTtaaiiTF.setText(wmoTtaaiiTF.getText().toUpperCase());
|
||||
ccccTF.setText(ccccTF.getText().toUpperCase());
|
||||
wmoSearch();
|
||||
|
@ -3018,7 +3001,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent event) {
|
||||
textEditor.setFocus();
|
||||
wmoTtaaiiTF.setText(wmoTtaaiiTF.getText().toUpperCase());
|
||||
ccccTF.setText(ccccTF.getText().toUpperCase());
|
||||
wmoSearch();
|
||||
|
@ -3080,22 +3062,15 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
|
||||
public void widgetDefaultSelected(SelectionEvent event) {
|
||||
textEditor.setFocus();
|
||||
awipsIdTF.setText(awipsIdTF.getText().trim().toUpperCase());
|
||||
int charCount = awipsIdTF.getCharCount();
|
||||
if (charCount < 4 || charCount > 6) {
|
||||
// System.out
|
||||
// .printf("Must enter a 6 or 9 character AFOS PIL%n");
|
||||
// System.out.printf("Character Count = %d%n", charCount);
|
||||
userInformation("Must enter a 4 to 6 character AWIPS ID");
|
||||
awipsIdTF.setFocus();
|
||||
return;
|
||||
} else {
|
||||
// System.out.printf("NNN = %s%n", awipsIdTF.getText(0, 2));
|
||||
TextDisplayModel.getInstance().setProductCategory(token,
|
||||
awipsIdTF.getText(0, 2));
|
||||
// System.out.printf("XXX = %s%n",
|
||||
// awipsIdTF.getText(3, charCount - 1));
|
||||
TextDisplayModel.getInstance().setProductDesignator(token,
|
||||
awipsIdTF.getText(3, charCount - 1));
|
||||
}
|
||||
|
@ -3151,10 +3126,33 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* state of the check box
|
||||
*/
|
||||
private void handleUpdateObsChkBtn(boolean checked) {
|
||||
// String pil = TextDisplayModel.getInstance().getAfosPil(token);
|
||||
// System.out.println("Update Obs: state = " + checked + ", AFOS PIL = "
|
||||
// + pil);
|
||||
if (checked) {
|
||||
if (updateObsListener == null) {
|
||||
updateObsListener = new MouseListener() {
|
||||
|
||||
@Override
|
||||
public void mouseUp(MouseEvent e) {
|
||||
try {
|
||||
int offset = textEditor
|
||||
.getOffsetAtLocation(new Point(e.x, e.y));
|
||||
clearUpdateFlag(offset);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// bad mouse location ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDoubleClick(MouseEvent e) {
|
||||
// Ignore
|
||||
}
|
||||
};
|
||||
textEditor.addMouseListener(updateObsListener);
|
||||
}
|
||||
NotificationManagerJob.addObserver(ALARM_ALERT_TOPIC, this);
|
||||
} else {
|
||||
NotificationManagerJob.removeObserver(ALARM_ALERT_TOPIC, this);
|
||||
|
@ -3162,6 +3160,18 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
}
|
||||
|
||||
private void clearUpdateFlag(int offset) {
|
||||
for (StyleRange range : textEditor.getStyleRanges()) {
|
||||
if (range.start <= offset && offset < (range.start + range.length)) {
|
||||
StyleRange lock = (StyleRange) range.clone();
|
||||
lock.background = null;
|
||||
lock.foreground = null;
|
||||
textEditor.setStyleRange(lock);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearAfosCmdTF() {
|
||||
if (!afosCmdTF.isDisposed()) {
|
||||
afosCmdTF.setText("");
|
||||
|
@ -3364,7 +3374,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* Create the text editor (styled text) control.
|
||||
*/
|
||||
private void createTextAreaEditor() {
|
||||
GridData gd = new GridData(GridData.FILL_BOTH);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
textEditorComp = new Composite(shell, SWT.NONE);
|
||||
GridLayout gridLayout = new GridLayout(1, false);
|
||||
textEditorComp.setLayout(gridLayout);
|
||||
|
@ -3372,8 +3382,16 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
textEditor = new StyledText(textEditorComp, SWT.BORDER | SWT.MULTI
|
||||
| SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
textEditor.setWordWrap(false);
|
||||
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
textEditor.setFont(medFont);
|
||||
GC gc = new GC(textEditor);
|
||||
FontMetrics fm = gc.getFontMetrics();
|
||||
gc.dispose();
|
||||
int width = EDITOR_WIDTH * fm.getAverageCharWidth();
|
||||
gd.widthHint = width;
|
||||
|
||||
textEditor.setLayoutData(gd);
|
||||
textEditor.setWordWrap(false);
|
||||
textEditor.setEditable(false);
|
||||
textEditor.setKeyBinding(SWT.INSERT, SWT.NULL); // DR 7826
|
||||
|
||||
|
@ -3436,22 +3454,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// }
|
||||
// });
|
||||
|
||||
sizeTextEditor();
|
||||
|
||||
textEditor.addVerifyKeyListener(new VerifyKeyListener() {
|
||||
public void verifyKey(VerifyEvent event) {
|
||||
|
||||
// System.out.println("event.keyCode = " + event.keyCode);
|
||||
// System.out.println("event.character = <" + event.character
|
||||
// + ">");
|
||||
//
|
||||
// System.out.println("String.valueOf(event.character) = <"
|
||||
// + String.valueOf(event.character) + ">");
|
||||
//
|
||||
// System.out.println("String.valueOf(event.character).length =
|
||||
// <"
|
||||
// + String.valueOf(event.character).length() + ">");
|
||||
|
||||
if (event.keyCode == SWT.DEL || event.character == SWT.BS
|
||||
|| event.keyCode == SWT.SHIFT) {
|
||||
// Do nothing...
|
||||
|
@ -3667,20 +3671,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
statusBarLabel.setLayoutData(gd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Size the text editor based on the text font size.
|
||||
*/
|
||||
private void sizeTextEditor() {
|
||||
GC gc = new GC(textEditor);
|
||||
FontMetrics fm = gc.getFontMetrics();
|
||||
gc.dispose();
|
||||
int width = EDITOR_WIDTH * fm.getAverageCharWidth();
|
||||
GridData data = new GridData(GridData.FILL_VERTICAL);
|
||||
data.widthHint = width;
|
||||
textEditor.setLayoutData(data);
|
||||
textEditorComp.layout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter the text editor mode.
|
||||
*/
|
||||
|
@ -3764,12 +3754,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
stopAutoSave();
|
||||
|
||||
if (warnGenFlag && queuedAfos != null) {
|
||||
if (warnGenFlag && queuedProduct != null) {
|
||||
// Display the WarnGen in the queue, perform the popup and stop the
|
||||
// cancel.
|
||||
showWarngenProduct(queuedAfos, queuedNotify);
|
||||
showWarngenProduct(queuedProduct, queuedNotify);
|
||||
queuedNotify = null;
|
||||
queuedAfos = null;
|
||||
queuedProduct = null;
|
||||
return false;
|
||||
}
|
||||
// Set the edit mode flag
|
||||
|
@ -3866,14 +3856,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// Create and display the AWIPS header block dialog.
|
||||
AWIPSHeaderBlockDlg awipsHeaderBlockDlg = new AWIPSHeaderBlockDlg(
|
||||
shell, this);
|
||||
|
||||
headerEditSession = closeEditorOnCancel ?
|
||||
HeaderEditSession.CLOSE_ON_EXIT : HeaderEditSession.IN_EDITOR;
|
||||
|
||||
headerEditSession = closeEditorOnCancel ? HeaderEditSession.CLOSE_ON_EXIT
|
||||
: HeaderEditSession.IN_EDITOR;
|
||||
|
||||
awipsHeaderBlockDlg.open();
|
||||
// headerBlockDlgDismissed() is called when the dialog is dismissed.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Called by AWIPSHeaderBlockDlg when it is dismissed.
|
||||
*
|
||||
|
@ -3884,23 +3874,24 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
public void headerBlockDlgDismissed(boolean dialogResult) {
|
||||
HeaderEditSession lastSession = headerEditSession;
|
||||
headerEditSession = null;
|
||||
|
||||
|
||||
// If the user cancels the AWIPS header block dialog then
|
||||
// get out of edit mode.
|
||||
// Otherwise use the node, product category, and product designator.
|
||||
|
||||
|
||||
boolean editing = false;
|
||||
|
||||
|
||||
if (dialogResult == true) {
|
||||
|
||||
TextDisplayModel tdm = TextDisplayModel.getInstance();
|
||||
|
||||
|
||||
// Update the buttonology.
|
||||
updateButtonology(tdm.getAfosPil(token));
|
||||
String bbbid = tdm.getBbbId(token);
|
||||
|
||||
|
||||
String nnnxxx = workProductId != null ? workProductId : tdm
|
||||
.getProductCategory(token) + tdm.getProductDesignator(token);
|
||||
.getProductCategory(token)
|
||||
+ tdm.getProductDesignator(token);
|
||||
// Set the header text field.
|
||||
if (bbbid.equals("NOR")) {
|
||||
String wmoId = tdm.getWmoId(token);
|
||||
|
@ -3912,25 +3903,26 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
setHeaderTextField(tdm.getWmoId(token), tdm.getSiteId(token),
|
||||
currentDateId + " " + bbbid, "\n", nnnxxx);
|
||||
}
|
||||
|
||||
|
||||
// Update the "now editing" title of the text editor window.
|
||||
updateNowEditingTitle();
|
||||
|
||||
|
||||
editing = true;
|
||||
} else {
|
||||
if (lastSession == HeaderEditSession.CLOSE_ON_EXIT)
|
||||
editing = !cancelEditor(false);
|
||||
editing = !cancelEditor(false);
|
||||
}
|
||||
|
||||
|
||||
if (lastSession == HeaderEditSession.CLOSE_ON_EXIT)
|
||||
if (editing) {
|
||||
StdTextProduct product = TextDisplayModel.getInstance()
|
||||
.getStdTextProduct(token);
|
||||
.getStdTextProduct(token);
|
||||
if (product == null)
|
||||
return;
|
||||
if (autoSave == null) {
|
||||
// user can cancel the edit immediately when the header is
|
||||
// displayed, verify it was not cancelled before starting the
|
||||
// displayed, verify it was not cancelled before starting
|
||||
// the
|
||||
// autoSave task.
|
||||
autoSave = new AutoSaveTask(product.getWmoid(),
|
||||
product.getSite());
|
||||
|
@ -4080,7 +4072,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
* Print all text from the text editor to the default printer.
|
||||
*/
|
||||
private void printAllText() {
|
||||
PrintDisplay.print(true, textEditor.getText(), statusHandler);
|
||||
FontData fontData = textEditor.getFont().getFontData()[0];
|
||||
PrintDisplay.print(textEditor.getText(), fontData, statusHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4102,7 +4095,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (mb.open() == SWT.YES) {
|
||||
String tmpText = textEditor.getText();
|
||||
Point point = textEditor.getSelection();
|
||||
PrintDisplay.print(true, textEditor.getSelectionText(),
|
||||
FontData fontData = textEditor.getFont().getFontData()[0];
|
||||
PrintDisplay.print(textEditor.getSelectionText(), fontData,
|
||||
statusHandler);
|
||||
textEditor.setText(tmpText);
|
||||
textEditor.setSelection(point);
|
||||
|
@ -4642,15 +4636,18 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
|
||||
if (!isAutoSave) {
|
||||
if (! resend) {
|
||||
if (!resend) {
|
||||
// If not a resend, set the DDHHMM field to the current time
|
||||
productText = replaceDDHHMM(productText, currentDate);
|
||||
|
||||
|
||||
VtecObject vtecObj = VtecUtil.parseMessage(productText);
|
||||
if (warnGenFlag) {
|
||||
// TODO: Pass in some flavor of currentDate to use to set the
|
||||
// times. Currently roll over to the next minute between getting
|
||||
// currentDate and getting the times in this method will cause
|
||||
// TODO: Pass in some flavor of currentDate to use to set
|
||||
// the
|
||||
// times. Currently roll over to the next minute between
|
||||
// getting
|
||||
// currentDate and getting the times in this method will
|
||||
// cause
|
||||
// them to be different.
|
||||
productText = updateVtecTimes(productText, vtecObj);
|
||||
// Update editor so the proper send times are displayed.
|
||||
|
@ -4726,10 +4723,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
return successful;
|
||||
}
|
||||
|
||||
/** Replaces the WMO heading DDHHMM field with the given text.
|
||||
* @param productText Product text which includes the WMO heading
|
||||
* @param ddhhmm Replacement text
|
||||
|
||||
/**
|
||||
* Replaces the WMO heading DDHHMM field with the given text.
|
||||
*
|
||||
* @param productText
|
||||
* Product text which includes the WMO heading
|
||||
* @param ddhhmm
|
||||
* Replacement text
|
||||
* @return The modified product text
|
||||
*/
|
||||
private static String replaceDDHHMM(String productText, String ddhhmm) {
|
||||
|
@ -4748,8 +4749,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
sb.append(' ');
|
||||
sb.append(s);
|
||||
}
|
||||
if (parts.length > 1)
|
||||
sb.append('\n').append(parts[1]);
|
||||
if (parts.length > 1) {
|
||||
sb.append('\n').append(parts[1]);
|
||||
}
|
||||
|
||||
productText = sb.toString();
|
||||
}
|
||||
|
||||
|
@ -4890,14 +4893,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// Capture the input from the styled text widget.
|
||||
StringBuffer sb = new StringBuffer(st.getText());
|
||||
String errMsg = null;
|
||||
// System.out.println("Initial: " + sb);
|
||||
// int counter = 0;
|
||||
int currentIndex = 0;
|
||||
int startIndex = 0;
|
||||
int endIndex = 0;
|
||||
try {
|
||||
while (sb.indexOf(BEGIN_ELEMENT_TAG, 0) >= 0) {
|
||||
// System.out.println("Trial " + counter++ + ": " + sb);
|
||||
currentIndex = 0;
|
||||
startIndex = 0;
|
||||
endIndex = 0;
|
||||
|
@ -4957,7 +4957,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
*/
|
||||
@Override
|
||||
public void verifyText(VerifyEvent event) {
|
||||
// System.out.println("verify text event.start="+event.star0t);
|
||||
int length = event.end - event.start;
|
||||
try {
|
||||
if (length == 0) {
|
||||
|
@ -5204,6 +5203,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
statusBarLabel.update();
|
||||
boolean hasAttachment = false;
|
||||
String attachedFilename = new String();
|
||||
boolean validExecuteCommand = true;
|
||||
|
||||
try {
|
||||
if (queryTransport == null) {
|
||||
|
@ -5238,7 +5238,17 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
hasAttachment = true;
|
||||
}
|
||||
|
||||
if (updating) {
|
||||
String commandText = command.getCommandTextFields()[0];
|
||||
StdTextProductId stdProdId = prod.getProdId();
|
||||
|
||||
if ("MTR".equals(stdProdId.getNnnid())
|
||||
&& (commandText.startsWith("ALL:")
|
||||
|| commandText.startsWith("A:") || commandText
|
||||
.endsWith("000"))) {
|
||||
stripWMOHeaders(prod);
|
||||
}
|
||||
|
||||
if (updateCount.get() > 0) {
|
||||
updateDisplayedProduct(prod);
|
||||
} else {
|
||||
setDisplayedProduct(prod);
|
||||
|
@ -5294,10 +5304,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (!accumChkBtn.getSelection()) {
|
||||
textEditor.setText("");
|
||||
}
|
||||
validExecuteCommand = false;
|
||||
}
|
||||
} catch (CommandFailedException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error retrieving metatdata", e);
|
||||
validExecuteCommand = false;
|
||||
}
|
||||
|
||||
if (!this.isDisposed()) {
|
||||
|
@ -5313,104 +5325,104 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
} else {
|
||||
resendWarningProductnItem.setEnabled(true);
|
||||
}
|
||||
|
||||
// Always give focus to textEditor after populating it.
|
||||
if (validExecuteCommand) {
|
||||
textEditor.setFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showWarngenProduct(String afosId, NotifyExpiration notify) {
|
||||
private void stripWMOHeaders(StdTextProduct prod) {
|
||||
String[] lines = prod.getProduct().split("\n");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String line : lines) {
|
||||
Matcher m = METAR_PATTERN.matcher(line);
|
||||
if (m.find()) {
|
||||
sb.append(line).append("\n");
|
||||
}
|
||||
}
|
||||
prod.setProduct(sb.toString());
|
||||
}
|
||||
|
||||
public void showWarngenProduct(String product, NotifyExpiration notify) {
|
||||
inEditMode = true;
|
||||
this.notify = notify;
|
||||
StdTextProduct tmp = null;
|
||||
final SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss.SSS");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
long t0 = System.currentTimeMillis();
|
||||
try {
|
||||
if (queryTransport == null) {
|
||||
queryTransport = TextEditorUtil.getTextDbsrvTransport();
|
||||
}
|
||||
long t2 = System.currentTimeMillis();
|
||||
System.out
|
||||
.println("Time getting TextDbSrv transport: " + (t2 - t0));
|
||||
ICommand cmd = CommandFactory.getAfosCommand(afosId);
|
||||
long t3 = System.currentTimeMillis();
|
||||
System.out.println("Time getting afos command: " + (t3 - t2));
|
||||
tmp = cmd.executeCommand(queryTransport).get(0);
|
||||
long t4 = System.currentTimeMillis();
|
||||
System.out.println("Time executing afos cmd: " + (t4 - t3));
|
||||
} catch (CommandFailedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
long t1 = System.currentTimeMillis();
|
||||
System.out
|
||||
.println(sdf.format(new Date())
|
||||
+ ": Text Workstation retrieving work product from database in "
|
||||
+ (t1 - t0) + "ms.");
|
||||
String[] tokens = product.split(":", 2);
|
||||
|
||||
String warning = tmp.getProduct();
|
||||
String[] nnnxxx = TextDisplayModel.getNnnXxx(warning);
|
||||
String siteNode = SiteAbbreviationUtil.getSiteNode(nnnxxx[1]);
|
||||
String ttaaii = SiteAbbreviationUtil.getTtaaii(siteNode + nnnxxx[0]
|
||||
+ nnnxxx[1]);
|
||||
final String w = warning.replace(TextWarningConstants.TTAAII, ttaaii);
|
||||
if (tokens.length == 2) {
|
||||
String afosId = tokens[0];
|
||||
String warning = tokens[1];
|
||||
|
||||
TextDisplayModel.getInstance().createStdTextProduct(token, w, siteNode);
|
||||
String[] nnnxxx = TextDisplayModel.getNnnXxx(warning);
|
||||
String siteNode = SiteAbbreviationUtil.getSiteNode(nnnxxx[1]);
|
||||
String ttaaii = SiteAbbreviationUtil.getTtaaii(siteNode + nnnxxx[0]
|
||||
+ nnnxxx[1]);
|
||||
final String w = warning.replace(TextWarningConstants.TTAAII,
|
||||
ttaaii);
|
||||
|
||||
workProductId = afosId.substring(3);
|
||||
warnGenFlag = true;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
long t0 = System.currentTimeMillis();
|
||||
// For VTEC related warning messages, turn off wordwrap by
|
||||
// default.
|
||||
if (textEditor == null) {
|
||||
openDialog();
|
||||
}
|
||||
TextDisplayModel.getInstance().createStdTextProduct(token, w,
|
||||
siteNode);
|
||||
|
||||
if (textEditor.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
workProductId = afosId.substring(3);
|
||||
warnGenFlag = true;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
long t0 = System.currentTimeMillis();
|
||||
// For VTEC related warning messages, turn off wordwrap by
|
||||
// default.
|
||||
if (textEditor == null) {
|
||||
openDialog();
|
||||
}
|
||||
|
||||
// textEditor.setWordWrap(false);
|
||||
if (textEditor.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the text editor's contents to the warning message.
|
||||
textEditor.removeVerifyListener(TextEditorDialog.this);
|
||||
textEditor.setText(w);
|
||||
//
|
||||
// // Mark the uneditable warning text
|
||||
// if (markUneditableText(textEditor)) {
|
||||
// // Add listener to monitor attempt to edit locked text
|
||||
// textEditor.addVerifyListener(TextEditorDialog.this);
|
||||
// }
|
||||
showDialog();
|
||||
long t1 = System.currentTimeMillis();
|
||||
// textEditor.setWordWrap(false);
|
||||
|
||||
System.out.println(sdf.format(new Date())
|
||||
+ ": Text Workstation took " + (t1 - t0)
|
||||
+ "ms to show dialog");
|
||||
enterEditor();
|
||||
// Set the text editor's contents to the warning message.
|
||||
textEditor.removeVerifyListener(TextEditorDialog.this);
|
||||
textEditor.setText(w);
|
||||
//
|
||||
// // Mark the uneditable warning text
|
||||
// if (markUneditableText(textEditor)) {
|
||||
// // Add listener to monitor attempt to edit locked text
|
||||
// textEditor.addVerifyListener(TextEditorDialog.this);
|
||||
// }
|
||||
showDialog();
|
||||
long t1 = System.currentTimeMillis();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss.SSS");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
System.out.println(sdf.format(new Date())
|
||||
+ ": Text Workstation took " + (t1 - t0)
|
||||
+ "ms to show dialog");
|
||||
enterEditor();
|
||||
|
||||
if (autoWrapMenuItem != null) {
|
||||
Menu menu = autoWrapMenuItem.getMenu();
|
||||
for (MenuItem item : menu.getItems()) {
|
||||
if (item.getSelection()) {
|
||||
Object obj = item.getData();
|
||||
if (obj instanceof WrapButtonCfg) {
|
||||
WrapButtonCfg buttonCfg = (WrapButtonCfg) obj;
|
||||
if (buttonCfg.isWrapEnabled()) {
|
||||
charWrapCol = buttonCfg.getWrapCol();
|
||||
wordWrapEnabled = true;
|
||||
recompileRegex();
|
||||
} else {
|
||||
wordWrapEnabled = false;
|
||||
if (autoWrapMenuItem != null) {
|
||||
Menu menu = autoWrapMenuItem.getMenu();
|
||||
for (MenuItem item : menu.getItems()) {
|
||||
if (item.getSelection()) {
|
||||
Object obj = item.getData();
|
||||
if (obj instanceof WrapButtonCfg) {
|
||||
WrapButtonCfg buttonCfg = (WrapButtonCfg) obj;
|
||||
if (buttonCfg.isWrapEnabled()) {
|
||||
charWrapCol = buttonCfg.getWrapCol();
|
||||
wordWrapEnabled = true;
|
||||
recompileRegex();
|
||||
} else {
|
||||
wordWrapEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
saved = false;
|
||||
}
|
||||
saved = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void replaceWorkProductId() {
|
||||
|
@ -5575,7 +5587,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
// open the script output window
|
||||
scriptOutput.open();
|
||||
System.out.println("output window closed...");
|
||||
// update the menu following close
|
||||
if (scriptsShowOutputItem != null
|
||||
&& !scriptsShowOutputItem.isDisposed()) {
|
||||
|
@ -5780,7 +5791,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
|
||||
@Override
|
||||
public void windowClosing() {
|
||||
System.out.println("script editor window closing");
|
||||
if (scriptRunner == null) {
|
||||
setScriptMenuControls(true);
|
||||
}
|
||||
|
@ -5883,17 +5893,27 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
regex = "(METAR |SPECI )K" + product.getXxxid();
|
||||
}
|
||||
|
||||
boolean haveWMOHeader = false;
|
||||
|
||||
if (regex != null) {
|
||||
// Find METAR to replace.
|
||||
// This assumes the product's METAR is the latest METAR and not a
|
||||
// duplicate or older then the display. If not the case a check of
|
||||
// duplicate or older in the display. If not the case a check of
|
||||
// the timestamp can be performed adjusting for possible roll over
|
||||
// to the next month.
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
for (int i = 0; i < noOfLines; ++i) {
|
||||
if (pattern.matcher(textEditor.getLine(i)).find()) {
|
||||
// Adjust to the METAR's Wmo Header line.
|
||||
lineIndex = i - 1;
|
||||
lineIndex = i;
|
||||
if (i > 0) {
|
||||
Matcher m = METAR_PATTERN.matcher(textEditor
|
||||
.getLine(i - 1));
|
||||
if (!m.find()) {
|
||||
// Adjust to the METAR's Wmo Header line.
|
||||
--lineIndex;
|
||||
haveWMOHeader = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5904,11 +5924,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
} else {
|
||||
String prefix = product.getWmoid() + " " + product.getSite();
|
||||
// System.out.println("new header" + prefix);
|
||||
for (int i = 0; i < noOfLines; i++) {
|
||||
if (textEditor.getLine(i).startsWith(prefix)) {
|
||||
// found replacement point
|
||||
// System.out.println("found " + prefix + " at line " + i);
|
||||
lineIndex = i;
|
||||
break;
|
||||
}
|
||||
|
@ -5917,46 +5935,61 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
if (lineIndex == -1) {
|
||||
lineIndex = noOfLines;
|
||||
}
|
||||
// note: this returns the number of lines in the text display area
|
||||
// Since lines are zero indexed, this points to the second line
|
||||
// of the product. Assuming a WMO header, this is the first line
|
||||
// of the product
|
||||
// System.out.println("inserting text at: " + lineIndex);
|
||||
|
||||
String productText = product.getProduct();
|
||||
|
||||
if (lineIndex == noOfLines) {
|
||||
textEditor.append("\n");
|
||||
textEditor.append(product.getProduct());
|
||||
textEditor.append(productText);
|
||||
} else {
|
||||
// need to find end of current product, then replace.
|
||||
int nextProductLoc = -1;
|
||||
for (int i = lineIndex + 2; i < noOfLines; i++) {
|
||||
String temp = textEditor.getLine(i);
|
||||
if (!temp.startsWith(" ")) {
|
||||
if (haveWMOHeader) {
|
||||
// Assume next product also has WMO header
|
||||
for (int i = lineIndex + 2; i < noOfLines; i++) {
|
||||
String temp = textEditor.getLine(i);
|
||||
if (!temp.startsWith(" ")) {
|
||||
if (temp.startsWith("METAR")
|
||||
|| temp.startsWith("SPECI")) {
|
||||
continue;
|
||||
} else {
|
||||
// found next product
|
||||
nextProductLoc = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Remove WMO header
|
||||
productText = productText
|
||||
.substring(productText.indexOf('\n') + 1);
|
||||
// Assume next product does not have a WMO header
|
||||
for (int i = lineIndex + 1; i < noOfLines; ++i) {
|
||||
String temp = textEditor.getLine(i);
|
||||
if (temp.startsWith("METAR") || temp.startsWith("SPECI")) {
|
||||
continue;
|
||||
} else {
|
||||
// found next product
|
||||
nextProductLoc = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int start = textEditor.getOffsetAtLine(lineIndex);
|
||||
int end = textEditor.getCharCount();
|
||||
if (nextProductLoc != -1) {
|
||||
end = textEditor.getOffsetAtLine(nextProductLoc);
|
||||
textEditor.replaceTextRange(start, end - start,
|
||||
product.getProduct() + "\n");
|
||||
textEditor.replaceTextRange(start, end - start, productText
|
||||
+ "\n");
|
||||
} else {
|
||||
textEditor.replaceTextRange(start, end - start,
|
||||
product.getProduct());
|
||||
textEditor.replaceTextRange(start, end - start, productText);
|
||||
}
|
||||
}
|
||||
|
||||
// if updating, we need to highlight the site name. If the first word of
|
||||
// the line is "METAR" or "SPECI", we need to highlight the second word
|
||||
lineIndex++; // need to skip the WMO header
|
||||
if (haveWMOHeader) {
|
||||
lineIndex++; // need to skip the WMO header
|
||||
}
|
||||
String line = textEditor.getLine(lineIndex);
|
||||
// System.out.println(line);
|
||||
int startIndex = textEditor.getOffsetAtLine(lineIndex);
|
||||
if (line.startsWith("METAR") || line.startsWith("SPECI")) {
|
||||
startIndex += 6; // skip first word plus a space
|
||||
|
@ -5971,7 +6004,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
// retrieved for display in this text editor dialog
|
||||
// instance.
|
||||
TextDisplayModel.getInstance().setStdTextProduct(token, product);
|
||||
updating = false;
|
||||
updateCount.addAndGet(-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6281,7 +6314,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
msgPIL = "";
|
||||
}
|
||||
if (isObsDisplayed(msgPIL)) {
|
||||
updating = true;
|
||||
updateCount.addAndGet(1);
|
||||
ICommand command = CommandFactory.getAfosCommand(msgPIL);
|
||||
UpdateObsRun run = new UpdateObsRun(command);
|
||||
VizApp.runSync(run);
|
||||
|
@ -7183,9 +7216,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
}
|
||||
}
|
||||
|
||||
public void enableSend(boolean state) {
|
||||
editorSendBtn.setEnabled(state);
|
||||
}
|
||||
|
||||
public void enqueue(String afosId, NotifyExpiration notify2) {
|
||||
queuedNotify = notify2;
|
||||
queuedAfos = afosId;
|
||||
queuedProduct = afosId;
|
||||
}
|
||||
|
||||
private boolean gfeForbidden(String ccc, String nnn) {
|
||||
|
|
|
@ -19,13 +19,15 @@
|
|||
**/
|
||||
package com.raytheon.viz.texteditor.print;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.print.PageFormat;
|
||||
import java.awt.print.Printable;
|
||||
import java.awt.print.PrinterException;
|
||||
import java.awt.print.PrinterJob;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.FontData;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.printing.Printer;
|
||||
import org.eclipse.swt.printing.PrinterData;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -39,6 +41,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 15, 2011 10557 rferrel Initial creation
|
||||
* Jul 17, 2012 14274 rferrel Now use eclipse Printer instead of awt.
|
||||
* Text is printed using same font as the GUI
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -47,107 +51,182 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
*/
|
||||
|
||||
public class PrintDisplay {
|
||||
/**
|
||||
* Print the text/document to the default print.
|
||||
*
|
||||
* @param autoPrint
|
||||
* true send text directly to printer without prompting user for
|
||||
* selecting a different printer.
|
||||
* @param printedText
|
||||
* the text to print.
|
||||
*/
|
||||
public static void print(boolean autoPrint, String printedText,
|
||||
public static void print(final String printedText, final FontData fontData,
|
||||
IUFStatusHandler statusHandler) {
|
||||
if (printedText == null || printedText.trim().length() == 0) {
|
||||
// Do not waste paper on blank text.
|
||||
PrinterData data = Printer.getDefaultPrinterData();
|
||||
if (data == null) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"No default printer specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
PrintDisplay printer = new PrintDisplay(autoPrint, statusHandler);
|
||||
printer.printIt(printedText);
|
||||
if (printedText == null || printedText.trim().length() == 0) {
|
||||
// Do not waste paper when nothing to print.
|
||||
return;
|
||||
}
|
||||
|
||||
final Printer printer = new Printer(data);
|
||||
PrintDisplay pd = new PrintDisplay(printer, printedText, fontData);
|
||||
pd.printJob();
|
||||
}
|
||||
|
||||
private boolean autoPrint;
|
||||
private Printer printer;
|
||||
|
||||
private IUFStatusHandler statusHandler;
|
||||
private String textToPrint;
|
||||
|
||||
private PrintDisplay(boolean autoPrint, IUFStatusHandler statusHandler) {
|
||||
this.autoPrint = autoPrint;
|
||||
this.statusHandler = statusHandler;
|
||||
private FontData printerFontData;
|
||||
|
||||
private int leftMargin;
|
||||
|
||||
private int rightMargin;
|
||||
|
||||
private int topMargin;
|
||||
|
||||
private int bottomMargin;
|
||||
|
||||
private String tabs;
|
||||
|
||||
private GC gc;
|
||||
|
||||
private int tabWidth;
|
||||
|
||||
private int lineHeight;
|
||||
|
||||
StringBuilder wordBuffer;
|
||||
|
||||
int x;
|
||||
|
||||
int y;
|
||||
|
||||
int index;
|
||||
|
||||
int end;
|
||||
|
||||
private PrintDisplay(Printer printer, String text, FontData fontData) {
|
||||
this.printer = printer;
|
||||
this.textToPrint = text;
|
||||
this.printerFontData = fontData;
|
||||
}
|
||||
|
||||
private void printIt(String printedText) {
|
||||
PrinterJob printerJob = PrinterJob.getPrinterJob();
|
||||
|
||||
if (autoPrint || printerJob.printDialog()) {
|
||||
printerJob.setPrintable(new Document(printedText));
|
||||
try {
|
||||
printerJob.print();
|
||||
} catch (PrinterException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
private void printJob() {
|
||||
Thread thread = new Thread("Printing") {
|
||||
public void run() {
|
||||
printIt();
|
||||
printer.dispose();
|
||||
}
|
||||
};
|
||||
thread.start();
|
||||
}
|
||||
|
||||
private void printIt() {
|
||||
if (printer.startJob("Text")) { // the string is the job name - shows up
|
||||
// in the printer's job list
|
||||
Rectangle clientArea = printer.getClientArea();
|
||||
Rectangle trim = printer.computeTrim(0, 0, 0, 0);
|
||||
Point dpi = printer.getDPI();
|
||||
|
||||
// one inch from left side of paper
|
||||
leftMargin = dpi.x + trim.x;
|
||||
// one inch from right side of paper
|
||||
rightMargin = clientArea.width - dpi.x + trim.x + trim.width;
|
||||
topMargin = dpi.y + trim.y; // one inch from top edge of paper
|
||||
// one inch from bottom edge of paper
|
||||
bottomMargin = clientArea.height - dpi.y + trim.y + trim.height;
|
||||
|
||||
// Create a buffer for computing tab width.
|
||||
int tabSize = 4;
|
||||
StringBuilder tabBuffer = new StringBuilder(tabSize);
|
||||
for (int i = 0; i < tabSize; i++)
|
||||
tabBuffer.append(' ');
|
||||
tabs = tabBuffer.toString();
|
||||
|
||||
/*
|
||||
* Create printer GC, and create and set the printer font &
|
||||
* foreground color.
|
||||
*/
|
||||
gc = new GC(printer);
|
||||
Font printerFont = new Font(printer, printerFontData);
|
||||
Color printerForegroundColor = new Color(printer, new RGB(0, 0, 0));
|
||||
Color printerBackgroundColor = new Color(printer, new RGB(255, 255,
|
||||
255));
|
||||
|
||||
gc.setFont(printerFont);
|
||||
gc.setForeground(printerForegroundColor);
|
||||
gc.setBackground(printerBackgroundColor);
|
||||
tabWidth = gc.stringExtent(tabs).x;
|
||||
lineHeight = gc.getFontMetrics().getHeight();
|
||||
|
||||
// Print text to current gc using word wrap
|
||||
printText();
|
||||
printer.endJob();
|
||||
|
||||
// Cleanup graphics resources used in printing
|
||||
printerFont.dispose();
|
||||
printerForegroundColor.dispose();
|
||||
printerBackgroundColor.dispose();
|
||||
gc.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private class Document implements Printable {
|
||||
|
||||
private final String[] printedText;
|
||||
|
||||
private int numPages = 0;
|
||||
|
||||
public Document(String printedText) {
|
||||
super();
|
||||
this.printedText = printedText.split("\n");
|
||||
private void printText() {
|
||||
printer.startPage();
|
||||
wordBuffer = new StringBuilder();
|
||||
x = leftMargin;
|
||||
y = topMargin;
|
||||
index = 0;
|
||||
end = textToPrint.length();
|
||||
while (index < end) {
|
||||
char c = textToPrint.charAt(index);
|
||||
index++;
|
||||
if (c != 0) {
|
||||
if (c == 0x0a || c == 0x0d) {
|
||||
if (c == 0x0d && index < end
|
||||
&& textToPrint.charAt(index) == 0x0a) {
|
||||
index++; // if this is cr-lf, skip the lf
|
||||
}
|
||||
printWordBuffer();
|
||||
newline();
|
||||
} else {
|
||||
if (c != '\t') {
|
||||
wordBuffer.append(c);
|
||||
}
|
||||
if (Character.isWhitespace(c)) {
|
||||
printWordBuffer();
|
||||
if (c == '\t') {
|
||||
x += tabWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (y + lineHeight <= bottomMargin) {
|
||||
printer.endPage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
|
||||
throws PrinterException {
|
||||
// --- Create the Graphics2D object
|
||||
Graphics2D g2d = (Graphics2D) graphics;
|
||||
|
||||
// --- Set the drawing color to black
|
||||
g2d.setPaint(Color.black);
|
||||
java.awt.Font font = g2d.getFont();
|
||||
String name = font.getName();
|
||||
int style = font.getStyle();
|
||||
int size = font.getSize();
|
||||
|
||||
g2d.setFont(new java.awt.Font(name, style, size - 2));
|
||||
|
||||
// --- Translate the origin to 0,0 for the top left corner
|
||||
g2d.translate(pageFormat.getImageableX(),
|
||||
pageFormat.getImageableY());
|
||||
|
||||
// Determine the lines per page and number of pages to print.
|
||||
java.awt.FontMetrics metrics = g2d.getFontMetrics();
|
||||
int lineHeight = metrics.getHeight();
|
||||
int linesPerPage = (int) Math.floor(pageFormat.getImageableHeight()
|
||||
/ lineHeight);
|
||||
numPages = ((printedText.length - 1) / linesPerPage) + 1;
|
||||
|
||||
// Calculate the start line for this page.
|
||||
int startLine = pageIndex * linesPerPage;
|
||||
int endLine = startLine + linesPerPage - 1;
|
||||
if (endLine >= printedText.length) {
|
||||
endLine = printedText.length - 1;
|
||||
private void printWordBuffer() {
|
||||
if (wordBuffer.length() > 0) {
|
||||
String word = wordBuffer.toString();
|
||||
int wordWidth = gc.stringExtent(word).x;
|
||||
if (x + wordWidth > rightMargin) {
|
||||
// word doesn't fit on current line, so wrap
|
||||
newline();
|
||||
}
|
||||
gc.drawString(word, x, y, false);
|
||||
x += wordWidth;
|
||||
wordBuffer.setLength(0);
|
||||
}
|
||||
}
|
||||
|
||||
// Tell the PrinterJob if the page number is not a legal one.
|
||||
if (pageIndex >= numPages) {
|
||||
return NO_SUCH_PAGE;
|
||||
private void newline() {
|
||||
x = leftMargin;
|
||||
y += lineHeight;
|
||||
if (y + lineHeight > bottomMargin) {
|
||||
printer.endPage();
|
||||
if (index + 1 < end) {
|
||||
y = topMargin;
|
||||
printer.startPage();
|
||||
}
|
||||
|
||||
int y = 0;
|
||||
for (int i = startLine; i <= endLine; i++) {
|
||||
y += lineHeight;
|
||||
g2d.drawString(printedText[i], 0, y);
|
||||
}
|
||||
|
||||
g2d.dispose();
|
||||
// --- Validate the page
|
||||
return (PAGE_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ import com.raytheon.uf.common.site.SiteMap;
|
|||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.viz.texteditor.TextWarningConstants;
|
||||
|
||||
/**
|
||||
|
@ -45,6 +46,22 @@ import com.raytheon.viz.texteditor.TextWarningConstants;
|
|||
|
||||
public class SiteAbbreviationUtil {
|
||||
|
||||
private static String mySiteNode;
|
||||
|
||||
/**
|
||||
* Returns the 3 letter site node for the current localization.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getMySiteNode() {
|
||||
if (mySiteNode == null) {
|
||||
mySiteNode = getSiteNode(LocalizationManager.getInstance()
|
||||
.getCurrentSite());
|
||||
}
|
||||
|
||||
return mySiteNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Grabs the site node from the FXA database afoslookup table.
|
||||
*
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.viz.textworkstation;
|
|||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
import java.util.Timer;
|
||||
|
@ -110,9 +111,9 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
|
|||
|
||||
private Label utcTimeLabel;
|
||||
|
||||
private Label gmtTimeLabel;
|
||||
private Label localTimeLabel;
|
||||
|
||||
SimpleDateFormat sdfGMT = new SimpleDateFormat("EEE dd MMM yyyy HH:mm z");
|
||||
SimpleDateFormat sdfLocal = new SimpleDateFormat("EEE dd MMM yyyy HH:mm z");
|
||||
|
||||
SimpleDateFormat sdfUTC = new SimpleDateFormat("EEE dd MMM yyyy HH:mm z");
|
||||
|
||||
|
@ -197,8 +198,8 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
private void initializeComponents() {
|
||||
sdfGMT.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
sdfUTC.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
sdfLocal.setTimeZone(Calendar.getInstance().getTimeZone());
|
||||
|
||||
createMenus();
|
||||
new Label(shell, SWT.NONE).setText("host: "
|
||||
|
@ -365,16 +366,18 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
private void createTimeLabels() {
|
||||
GridData gd = new GridData(300, SWT.DEFAULT);
|
||||
gmtTimeLabel = new Label(shell, SWT.CENTER);
|
||||
gmtTimeLabel.setLayoutData(gd);
|
||||
GridData gd = null;
|
||||
|
||||
gd = new GridData(300, SWT.DEFAULT);
|
||||
utcTimeLabel = new Label(shell, SWT.CENTER);
|
||||
utcTimeLabel.setLayoutData(gd);
|
||||
|
||||
gd = new GridData(300, SWT.DEFAULT);
|
||||
localTimeLabel = new Label(shell, SWT.CENTER);
|
||||
localTimeLabel.setLayoutData(gd);
|
||||
|
||||
date = SimulatedTime.getSystemTime().getTime();
|
||||
gmtTimeLabel.setText(sdfGMT.format(date));
|
||||
localTimeLabel.setText(sdfLocal.format(date));
|
||||
utcTimeLabel.setText(sdfUTC.format(date));
|
||||
}
|
||||
|
||||
|
@ -510,7 +513,7 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
|
|||
|
||||
private void updateTimeLabels() {
|
||||
date = SimulatedTime.getSystemTime().getTime();
|
||||
gmtTimeLabel.setText(sdfGMT.format(date));
|
||||
localTimeLabel.setText(sdfLocal.format(date));
|
||||
utcTimeLabel.setText(sdfUTC.format(date));
|
||||
}
|
||||
|
||||
|
@ -596,14 +599,14 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
|
|||
// messages.
|
||||
delta += TextWorkstationDlg.incDelta;
|
||||
} else if (message.isNotExpired()) {
|
||||
String afosId = message.getMessagePayload().toString();
|
||||
String product = message.getMessagePayload().toString();
|
||||
if (wgDlg == null) {
|
||||
productToDisplay = afosId;
|
||||
productToDisplay = product;
|
||||
} else {
|
||||
if (!wgDlg.isEditMode()) {
|
||||
wgDlg.showWarngenProduct(afosId, notify);
|
||||
wgDlg.showWarngenProduct(product, notify);
|
||||
} else {
|
||||
wgDlg.enqueue(afosId, notify);
|
||||
wgDlg.enqueue(product, notify);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -392,6 +392,9 @@ public class VizWorkbenchManager implements IPartListener, IPartListener2,
|
|||
}
|
||||
activeEditorMap
|
||||
.put(part.getSite().getWorkbenchWindow(), active);
|
||||
if (active instanceof IDisplayPaneContainer) {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,12 +33,12 @@ import javax.jms.MessageProducer;
|
|||
import javax.jms.Session;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.text.request.InsertStdTextProductRequest;
|
||||
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
|
||||
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.comm.JMSConnection;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.core.mode.CAVEMode;
|
||||
|
@ -65,173 +65,209 @@ import com.raytheon.viz.texteditor.util.SiteAbbreviationUtil;
|
|||
*/
|
||||
|
||||
public class WarningSender implements IWarngenObserver {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(WarningSender.class);
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(WarningSender.class);
|
||||
|
||||
private String hostName = null;
|
||||
private String hostName = null;
|
||||
|
||||
private boolean notifyError;
|
||||
private boolean notifyError;
|
||||
|
||||
private static final long MILLISECONDS_PER_SECOND = 1000;
|
||||
private static final long MILLISECONDS_PER_SECOND = 1000;
|
||||
|
||||
private static final long SECONDS_PER_MINUTE = 60;
|
||||
private static final long SECONDS_PER_MINUTE = 60;
|
||||
|
||||
private static final long TTL_MINUTES = 5;
|
||||
private static final long TTL_MINUTES = 5;
|
||||
|
||||
private static Pattern PATTERN = Pattern.compile("(\\d{1,1})");
|
||||
private static Pattern PATTERN = Pattern.compile("(\\d{1,1})");
|
||||
|
||||
private static final SimpleDateFormat sdf;
|
||||
private static final SimpleDateFormat sdf;
|
||||
|
||||
static {
|
||||
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
}
|
||||
static {
|
||||
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc) Incoming message was not a binary
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.texteditor.msgs.IWarngenObserver#setTextWarngenDisplay
|
||||
* (java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setTextWarngenDisplay(String warning, boolean ne) {
|
||||
this.notifyError = ne;
|
||||
/*
|
||||
* (non-Javadoc) Incoming message was not a binary
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.texteditor.msgs.IWarngenObserver#setTextWarngenDisplay
|
||||
* (java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setTextWarngenDisplay(String warning, boolean ne) {
|
||||
this.notifyError = ne;
|
||||
|
||||
String number = "0";
|
||||
String host = TextWorkstationConstants.getId();
|
||||
long t0 = System.currentTimeMillis();
|
||||
String siteNode = SiteAbbreviationUtil.getSiteNode(LocalizationManager
|
||||
.getInstance().getCurrentSite());
|
||||
System.out.println("Get site node time: "
|
||||
+ (System.currentTimeMillis() - t0));
|
||||
if (host == null) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Text Workstation host not set in preferences.");
|
||||
} else {
|
||||
Matcher m = PATTERN.matcher(host);
|
||||
if (m.find()) {
|
||||
number = m.group();
|
||||
}
|
||||
}
|
||||
String number = "0";
|
||||
String host = TextWorkstationConstants.getId();
|
||||
long t0 = System.currentTimeMillis();
|
||||
String siteNode = SiteAbbreviationUtil.getSiteNode(LocalizationManager
|
||||
.getInstance().getCurrentSite());
|
||||
System.out.println("Get site node time: "
|
||||
+ (System.currentTimeMillis() - t0));
|
||||
if (host == null) {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Text Workstation host not set in preferences.");
|
||||
} else {
|
||||
Matcher m = PATTERN.matcher(host);
|
||||
if (m.find()) {
|
||||
number = m.group();
|
||||
}
|
||||
}
|
||||
|
||||
String id = siteNode + "WRKWG" + number;
|
||||
String id = siteNode + "WRKWG" + number;
|
||||
boolean sentToTextDatabase = false;
|
||||
|
||||
try {
|
||||
CAVEMode mode = CAVEMode.getMode();
|
||||
boolean operationalMode = (CAVEMode.OPERATIONAL.equals(mode)
|
||||
|| CAVEMode.TEST.equals(mode) ? true : false);
|
||||
try {
|
||||
boolean messageNotSent = true;
|
||||
int connectCount = 0;
|
||||
t0 = System.currentTimeMillis();
|
||||
byte[] data = SerializationUtil.transformToThrift(id + ":"
|
||||
+ warning);
|
||||
while (messageNotSent && connectCount < 4) {
|
||||
Session s = null;
|
||||
MessageProducer mp = null;
|
||||
Connection conn = null;
|
||||
try {
|
||||
conn = JMSConnection.getInstance().getFactory()
|
||||
.createConnection();
|
||||
s = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
|
||||
mp = s.createProducer(s
|
||||
.createQueue(TextWorkstationConstants
|
||||
.getDestinationTextWorkstationQueueName()));
|
||||
mp.setTimeToLive(TTL_MINUTES * SECONDS_PER_MINUTE
|
||||
* MILLISECONDS_PER_SECOND);
|
||||
BytesMessage m = s.createBytesMessage();
|
||||
m.writeBytes(data);
|
||||
mp.send(m);
|
||||
long t1 = System.currentTimeMillis();
|
||||
System.out.println(WarningSender.getCurTimeString() + ": "
|
||||
+ id + " sent to text workstation in " + (t1 - t0)
|
||||
+ "ms in " + (connectCount + 1)
|
||||
+ (connectCount > 0 ? " tries" : " try"));
|
||||
messageNotSent = false;
|
||||
} catch (JMSException e) {
|
||||
if (notifyError) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"Error trying to send product ["
|
||||
+ id
|
||||
+ "] to Text Workstation. Attempting to reconnect. ",
|
||||
e);
|
||||
notifyError = false;
|
||||
}
|
||||
} finally {
|
||||
if (mp != null) {
|
||||
try {
|
||||
mp.close();
|
||||
mp = null;
|
||||
} catch (Exception e) {
|
||||
mp = null;
|
||||
}
|
||||
}
|
||||
if (s != null) {
|
||||
try {
|
||||
s.close();
|
||||
s = null;
|
||||
} catch (Exception e) {
|
||||
s = null;
|
||||
}
|
||||
}
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
conn = null;
|
||||
} catch (Exception e) {
|
||||
conn = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (messageNotSent) {
|
||||
if (!sentToTextDatabase) {
|
||||
try {
|
||||
sendToTextDatabase(id, warning);
|
||||
sentToTextDatabase = true;
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error trying to save product [" + id
|
||||
+ "] to Text Database: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Generate StdTextProduct and insert into db
|
||||
t0 = System.currentTimeMillis();
|
||||
ThriftClient.sendRequest(new InsertStdTextProductRequest(id,
|
||||
warning, operationalMode));
|
||||
connectCount++;
|
||||
switch (connectCount) {
|
||||
case 1:
|
||||
Thread.sleep(1000);
|
||||
break;
|
||||
case 2:
|
||||
Thread.sleep(5 * 1000);
|
||||
break;
|
||||
case 3:
|
||||
Thread.sleep(30 * 1000);
|
||||
break;
|
||||
case 4:
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not reconnect (" + id
|
||||
+ ") after 3 tries: ", null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(WarningSender.getCurTimeString() + ": " + id
|
||||
+ " saved to textdb in "
|
||||
+ (System.currentTimeMillis() - t0) + "ms");
|
||||
if (!sentToTextDatabase) {
|
||||
try {
|
||||
sendToTextDatabase(id, warning);
|
||||
sentToTextDatabase = true;
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error trying to save product [" + id
|
||||
+ "] to Text Database: ", e);
|
||||
}
|
||||
}
|
||||
} catch (UnknownHostException uhe) {
|
||||
if (notifyError) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"unable to map hostname, " + hostName
|
||||
+ ", to an ip address", uhe);
|
||||
notifyError = false;
|
||||
}
|
||||
|
||||
boolean messageNotSent = true;
|
||||
int connectCount = 0;
|
||||
t0 = System.currentTimeMillis();
|
||||
while (messageNotSent && connectCount < 4) {
|
||||
Session s = null;
|
||||
MessageProducer mp = null;
|
||||
Connection conn = null;
|
||||
try {
|
||||
conn = JMSConnection.getInstance().getFactory()
|
||||
.createConnection();
|
||||
s = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
|
||||
mp = s.createProducer(s
|
||||
.createQueue(TextWorkstationConstants
|
||||
.getDestinationTextWorkstationQueueName()));
|
||||
mp.setTimeToLive(TTL_MINUTES * SECONDS_PER_MINUTE
|
||||
* MILLISECONDS_PER_SECOND);
|
||||
BytesMessage m = s.createBytesMessage();
|
||||
m.writeBytes(DynamicSerializationManager.getManager(
|
||||
SerializationType.Thrift).serialize(id));
|
||||
mp.send(m);
|
||||
System.out.println(WarningSender.getCurTimeString() + ": "
|
||||
+ id + " sent to text workstation in "
|
||||
+ (System.currentTimeMillis() - t0) + "ms");
|
||||
messageNotSent = false;
|
||||
} catch (JMSException e) {
|
||||
if (notifyError) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"Error trying to send message ("
|
||||
+ id
|
||||
+ ") to Text Workstation. Attempting to reconnect. ",
|
||||
e);
|
||||
notifyError = false;
|
||||
}
|
||||
} finally {
|
||||
if (mp != null) {
|
||||
try {
|
||||
mp.close();
|
||||
mp = null;
|
||||
} catch (Exception e) {
|
||||
mp = null;
|
||||
}
|
||||
}
|
||||
if (s != null) {
|
||||
try {
|
||||
s.close();
|
||||
s = null;
|
||||
} catch (Exception e) {
|
||||
s = null;
|
||||
}
|
||||
}
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
conn = null;
|
||||
} catch (Exception e) {
|
||||
conn = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (messageNotSent) {
|
||||
connectCount++;
|
||||
switch (connectCount) {
|
||||
case 1:
|
||||
Thread.sleep(1000);
|
||||
break;
|
||||
case 2:
|
||||
Thread.sleep(5 * 1000);
|
||||
break;
|
||||
case 3:
|
||||
Thread.sleep(30 * 1000);
|
||||
break;
|
||||
case 4:
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not reconnect (" + id
|
||||
+ ") after 3 tries: ", null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (UnknownHostException uhe) {
|
||||
if (notifyError) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"unable to map hostname, " + hostName
|
||||
+ ", to an ip address", uhe);
|
||||
notifyError = false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error trying to send product [" + id
|
||||
+ "] to Text Workstation: ", e);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error trying to send message (" + id
|
||||
+ ") to Text Workstation: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Saves a product to the text database.
|
||||
*
|
||||
* @param id
|
||||
* @param warning
|
||||
* @throws VizException
|
||||
*/
|
||||
public static void sendToTextDatabase(String id, String warning)
|
||||
throws VizException {
|
||||
CAVEMode mode = CAVEMode.getMode();
|
||||
boolean operationalMode = (CAVEMode.OPERATIONAL.equals(mode)
|
||||
|| CAVEMode.TEST.equals(mode) ? true : false);
|
||||
|
||||
public static String getCurTimeString() {
|
||||
String rval = null;
|
||||
synchronized (sdf) {
|
||||
rval = sdf.format(new Date());
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
// Generate StdTextProduct and insert into db
|
||||
long t0 = System.currentTimeMillis();
|
||||
ThriftClient.sendRequest(new InsertStdTextProductRequest(id, warning,
|
||||
operationalMode));
|
||||
|
||||
System.out.println(WarningSender.getCurTimeString() + ": " + id
|
||||
+ " saved to textdb in " + (System.currentTimeMillis() - t0)
|
||||
+ "ms");
|
||||
}
|
||||
|
||||
public static String getCurTimeString() {
|
||||
String rval = null;
|
||||
synchronized (sdf) {
|
||||
rval = sdf.format(new Date());
|
||||
}
|
||||
return rval;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,14 +19,18 @@
|
|||
**/
|
||||
package com.raytheon.viz.warngen.config;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.warning.config.PointSourceConfiguration;
|
||||
import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
|
@ -35,6 +39,7 @@ import com.raytheon.uf.common.geospatial.SpatialException;
|
|||
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
|
||||
import com.raytheon.uf.common.geospatial.SpatialQueryResult;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.maps.rsc.DbMapQueryFactory;
|
||||
import com.raytheon.viz.warngen.PreferenceUtil;
|
||||
import com.raytheon.viz.warngen.gis.ClosestPoint;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
@ -96,21 +101,62 @@ public class DbPointSourceDataAdaptor implements IPointSourceDataAdaptor {
|
|||
}
|
||||
}
|
||||
|
||||
List<ClosestPoint> points = new ArrayList<ClosestPoint>();
|
||||
List<ClosestPoint> points = null;
|
||||
|
||||
try {
|
||||
SpatialQueryResult[] ptFeatures = SpatialQueryFactory.create()
|
||||
.query(pointSource,
|
||||
ptFields.toArray(new String[ptFields.size()]),
|
||||
searchArea, filter, SearchMode.INTERSECTS);
|
||||
SpatialQueryResult[] ptFeatures = null;
|
||||
Double decimationTolerance = pointConfig
|
||||
.getGeometryDecimationTolerance();
|
||||
String field = "the_geom";
|
||||
|
||||
if (decimationTolerance != null && decimationTolerance > 0) {
|
||||
// find available tolerances
|
||||
List<Double> results = DbMapQueryFactory.getMapQuery(
|
||||
"mapdata." + pointSource.toLowerCase(), field)
|
||||
.getLevels();
|
||||
Collections.sort(results, Collections.reverseOrder());
|
||||
|
||||
boolean found = false;
|
||||
for (Double val : results) {
|
||||
if (val <= decimationTolerance) {
|
||||
decimationTolerance = val;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
decimationTolerance = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (decimationTolerance != null) {
|
||||
DecimalFormat df = new DecimalFormat("0.######");
|
||||
String suffix = "_"
|
||||
+ StringUtils.replaceChars(
|
||||
df.format(decimationTolerance), '.', '_');
|
||||
ptFeatures = SpatialQueryFactory.create().query(pointSource,
|
||||
field + suffix,
|
||||
ptFields.toArray(new String[ptFields.size()]),
|
||||
searchArea, filter, SearchMode.INTERSECTS);
|
||||
} else {
|
||||
ptFeatures = SpatialQueryFactory.create().query(pointSource,
|
||||
ptFields.toArray(new String[ptFields.size()]),
|
||||
searchArea, filter, SearchMode.INTERSECTS);
|
||||
}
|
||||
|
||||
if (ptFeatures != null) {
|
||||
points = new ArrayList<ClosestPoint>(ptFeatures.length);
|
||||
} else {
|
||||
points = new ArrayList<ClosestPoint>(0);
|
||||
}
|
||||
|
||||
for (SpatialQueryResult ptRslt : ptFeatures) {
|
||||
if (ptRslt != null && ptRslt.geometry != null) {
|
||||
Object nameObj = ptRslt.attributes.get(pointField);
|
||||
if (nameObj != null) {
|
||||
int population = 0;
|
||||
int warngenlev = 0;
|
||||
ClosestPoint cp = new ClosestPoint();
|
||||
|
||||
if (ptFields.contains("population")) {
|
||||
try {
|
||||
population = Integer.valueOf(String
|
||||
|
|
|
@ -27,6 +27,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.warning.config.AreaConfiguration;
|
||||
import com.raytheon.uf.common.dataplugin.warning.config.AreaSourceConfiguration;
|
||||
|
@ -70,7 +71,7 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* MarineZones shapefiles have no FE_AREA.
|
||||
* Apr 13, 2012 #14691 Qinglu lin Added code for two more fe_area: er and nr.
|
||||
* May 4, 2012 #14887 Qinglu lin Changed 0.25 to 0.60 for DEFAULT_PORTION_TOLERANCE;
|
||||
* added code to pass a Envelope calculatePortion().
|
||||
* added code to pass a Envelope calculatePortion().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -172,8 +173,9 @@ public class Area {
|
|||
|
||||
List<String> uniqueFips = new ArrayList<String>();
|
||||
List<AffectedAreas> areas = new ArrayList<AffectedAreas>();
|
||||
GeodeticCalculator gc = new GeodeticCalculator();
|
||||
for (GeospatialData regionFeature : countyMap.values()) {
|
||||
Geometry regionGeom = regionFeature.geometry;
|
||||
Geometry regionGeom = regionFeature.geometry;
|
||||
AffectedAreas area = new AffectedAreas();
|
||||
area.name = regionFeature.attributes.get(areaField).toString();
|
||||
area.fips = regionFeature.attributes.get(fipsField).toString();
|
||||
|
@ -217,7 +219,8 @@ public class Area {
|
|||
* DEFAULT_PORTION_TOLERANCE;
|
||||
if (areaIntersection < tolerCheck) {
|
||||
area.partOfArea = GisUtil.asStringList(GisUtil
|
||||
.calculatePortion(regionGeom, intersection, area.suppress));
|
||||
.calculatePortion(regionGeom, intersection, gc,
|
||||
area.suppress));
|
||||
}
|
||||
|
||||
// Search the parent region
|
||||
|
@ -225,66 +228,67 @@ public class Area {
|
|||
if (parentRegion != null) {
|
||||
area.parentRegion = String.valueOf(parentRegion.attributes
|
||||
.get(parentAreaField));
|
||||
String feArea = (String)regionFeature.attributes.get("FE_AREA");
|
||||
final List<String> partList = new ArrayList<String>();
|
||||
String feArea = (String) regionFeature.attributes
|
||||
.get("FE_AREA");
|
||||
final List<String> partList = new ArrayList<String>();
|
||||
if (feArea == null) {
|
||||
// Marine warnings
|
||||
partList.add("");
|
||||
// Marine warnings
|
||||
partList.add("");
|
||||
} else {
|
||||
if (feArea.equals("pa"))
|
||||
partList.add("PA");
|
||||
else if(feArea.equals("mi"))
|
||||
partList.add("MI");
|
||||
else if(feArea.equals("pd"))
|
||||
partList.add("PD");
|
||||
else if(feArea.equals("up"))
|
||||
partList.add("UP");
|
||||
else if(feArea.equals("bb"))
|
||||
partList.add("BB");
|
||||
else if(feArea.equals("er"))
|
||||
partList.add("ER");
|
||||
else if(feArea.equals("eu"))
|
||||
partList.add("EU");
|
||||
else if(feArea.equals("sr"))
|
||||
partList.add("SR");
|
||||
else if(feArea.equals("nr"))
|
||||
partList.add("NR");
|
||||
else if(feArea.equals("wu"))
|
||||
partList.add("WU");
|
||||
else if(feArea.equals("ds"))
|
||||
partList.add("DS");
|
||||
else if(feArea.equals("ne"))
|
||||
partList.add("NE");
|
||||
else if(feArea.equals("nw"))
|
||||
partList.add("NW");
|
||||
else if(feArea.equals("se"))
|
||||
partList.add("SE");
|
||||
else if(feArea.equals("sw"))
|
||||
partList.add("SW");
|
||||
else {
|
||||
for (int i=0; i<feArea.length(); i++) {
|
||||
char c = feArea.charAt(i);
|
||||
switch (c) {
|
||||
case 'c':
|
||||
partList.add("CENTRAL");
|
||||
break;
|
||||
case 'w':
|
||||
partList.add("WEST");
|
||||
break;
|
||||
case 'n':
|
||||
partList.add("NORTH");
|
||||
break;
|
||||
case 'e':
|
||||
partList.add("EAST");
|
||||
break;
|
||||
case 's':
|
||||
partList.add("SOUTH");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (feArea.equals("pa"))
|
||||
partList.add("PA");
|
||||
else if (feArea.equals("mi"))
|
||||
partList.add("MI");
|
||||
else if (feArea.equals("pd"))
|
||||
partList.add("PD");
|
||||
else if (feArea.equals("up"))
|
||||
partList.add("UP");
|
||||
else if (feArea.equals("bb"))
|
||||
partList.add("BB");
|
||||
else if (feArea.equals("er"))
|
||||
partList.add("ER");
|
||||
else if (feArea.equals("eu"))
|
||||
partList.add("EU");
|
||||
else if (feArea.equals("sr"))
|
||||
partList.add("SR");
|
||||
else if (feArea.equals("nr"))
|
||||
partList.add("NR");
|
||||
else if (feArea.equals("wu"))
|
||||
partList.add("WU");
|
||||
else if (feArea.equals("ds"))
|
||||
partList.add("DS");
|
||||
else if (feArea.equals("ne"))
|
||||
partList.add("NE");
|
||||
else if (feArea.equals("nw"))
|
||||
partList.add("NW");
|
||||
else if (feArea.equals("se"))
|
||||
partList.add("SE");
|
||||
else if (feArea.equals("sw"))
|
||||
partList.add("SW");
|
||||
else {
|
||||
for (int i = 0; i < feArea.length(); i++) {
|
||||
char c = feArea.charAt(i);
|
||||
switch (c) {
|
||||
case 'c':
|
||||
partList.add("CENTRAL");
|
||||
break;
|
||||
case 'w':
|
||||
partList.add("WEST");
|
||||
break;
|
||||
case 'n':
|
||||
partList.add("NORTH");
|
||||
break;
|
||||
case 'e':
|
||||
partList.add("EAST");
|
||||
break;
|
||||
case 's':
|
||||
partList.add("SOUTH");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
area.partOfParentRegion = partList;
|
||||
}
|
||||
|
@ -333,7 +337,9 @@ public class Area {
|
|||
for (int i = 0; i < warnArea.getNumGeometries(); i++) {
|
||||
Geometry geom = warnArea.getGeometryN(i);
|
||||
if (f.geometry.intersects(geom)) {
|
||||
GeometryUtil.buildGeometryList(geoms, f.geometry);
|
||||
Geometry intersect = f.geometry.intersection(geom);
|
||||
intersect.setUserData(f.geometry.getUserData());
|
||||
GeometryUtil.buildGeometryList(geoms, intersect);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,27 +66,33 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
public class GisUtil {
|
||||
|
||||
private static final float PORTION_OF_CENTER = 0.16875f;
|
||||
|
||||
|
||||
private static final float DIRECTION_DELTA = 15;
|
||||
|
||||
private static final float EXTREME_DELTA = 0.0625f;
|
||||
|
||||
private static final double CONTAINS_PERCENTAGE = 0.1;
|
||||
|
||||
// When both xDirection and yDirection are Direction.CENTRAL, for a rectangle
|
||||
// polygon, MIN1 is the maximum value of either distanceX or distanceY
|
||||
|
||||
// When both xDirection and yDirection are Direction.CENTRAL, for a
|
||||
// rectangle
|
||||
// polygon, MIN1 is the maximum value of either distanceX or distanceY
|
||||
// for EnumSet.of(xDirection,yDirection) to be returned.
|
||||
private static final float MIN1 = 0.01f;
|
||||
|
||||
// When both xDirection and yDirection are Direction.CENTRAL, for a right triangle
|
||||
// polygon, MIN2 is the maximum value of both distanceX and distanceY
|
||||
|
||||
// When both xDirection and yDirection are Direction.CENTRAL, for a right
|
||||
// triangle
|
||||
// polygon, MIN2 is the maximum value of both distanceX and distanceY
|
||||
// for EnumSet.of(xDirection,yDirection) to be returned.
|
||||
private static final float MIN2 = 0.045f;
|
||||
|
||||
// When yDirection is NORTH or SOUTH, in order to add CENTRAL to retval, required
|
||||
// minimum ratio of width of intersection envelope to that of county envelope;
|
||||
// when xDirection is EAST or WEST, in order to add CENTRAL to retval, required
|
||||
// minimum ratio of height of intersection envelope to that of county envelope;
|
||||
|
||||
// When yDirection is NORTH or SOUTH, in order to add CENTRAL to retval,
|
||||
// required
|
||||
// minimum ratio of width of intersection envelope to that of county
|
||||
// envelope;
|
||||
// when xDirection is EAST or WEST, in order to add CENTRAL to retval,
|
||||
// required
|
||||
// minimum ratio of height of intersection envelope to that of county
|
||||
// envelope;
|
||||
private static final float RATIO = 0.5f;
|
||||
|
||||
public static enum Direction {
|
||||
|
@ -135,12 +141,12 @@ public class GisUtil {
|
|||
}
|
||||
|
||||
public static EnumSet<Direction> calculatePortion(Geometry geom,
|
||||
Geometry geom2) {
|
||||
return calculatePortion(geom, geom2, SuppressMap.NONE);
|
||||
Geometry geom2, GeodeticCalculator gc) {
|
||||
return calculatePortion(geom, geom2, gc, SuppressMap.NONE);
|
||||
}
|
||||
|
||||
public static EnumSet<Direction> calculatePortion(Geometry geom,
|
||||
Geometry intersection, String suppressType) {
|
||||
Geometry intersection, GeodeticCalculator gc, String suppressType) {
|
||||
Direction xDirection = null;
|
||||
Direction yDirection = null;
|
||||
|
||||
|
@ -161,23 +167,25 @@ public class GisUtil {
|
|||
double extremaThresholdY = approximateHeight * EXTREME_DELTA;
|
||||
|
||||
if (distanceX < centerThresholdX) {
|
||||
xDirection = Direction.CENTRAL;
|
||||
if (distanceY < centerThresholdY)
|
||||
yDirection = Direction.CENTRAL;
|
||||
xDirection = Direction.CENTRAL;
|
||||
if (distanceY < centerThresholdY)
|
||||
yDirection = Direction.CENTRAL;
|
||||
}
|
||||
|
||||
if (xDirection != null && yDirection != null) {
|
||||
// Both xDirection equals Direction.CENTRAL and yDirection equals Direction.CENTRAL
|
||||
// calculated above is not always correct for returning EnumSet.of(xDirection,yDirection).
|
||||
// The following 'if statement' filters out some cases.
|
||||
if (distanceX < MIN1 || distanceY < MIN1 || (distanceX < MIN2 && distanceY < MIN2))
|
||||
return EnumSet.of(xDirection,yDirection);
|
||||
// Both xDirection equals Direction.CENTRAL and yDirection equals
|
||||
// Direction.CENTRAL
|
||||
// calculated above is not always correct for returning
|
||||
// EnumSet.of(xDirection,yDirection).
|
||||
// The following 'if statement' filters out some cases.
|
||||
if (distanceX < MIN1 || distanceY < MIN1
|
||||
|| (distanceX < MIN2 && distanceY < MIN2))
|
||||
return EnumSet.of(xDirection, yDirection);
|
||||
}
|
||||
|
||||
|
||||
xDirection = null;
|
||||
yDirection = null;
|
||||
|
||||
GeodeticCalculator gc = new GeodeticCalculator();
|
||||
|
||||
gc.setStartingGeographicPoint(centroid.x, centroid.y);
|
||||
gc.setDestinationGeographicPoint(point.x, point.y);
|
||||
double azimuth = gc.getAzimuth();
|
||||
|
@ -229,26 +237,32 @@ public class GisUtil {
|
|||
&& !suppressType.equals(SuppressMap.ALL))
|
||||
retVal.add(yDirection);
|
||||
|
||||
if (xDirection != null &&
|
||||
(xDirection.equals(Direction.WEST) || xDirection.equals(Direction.EAST))) {
|
||||
if ( env.getHeight() < RATIO*approximateHeight) {
|
||||
if (xDirection != null
|
||||
&& (xDirection.equals(Direction.WEST) || xDirection
|
||||
.equals(Direction.EAST))) {
|
||||
if (env.getHeight() < RATIO * approximateHeight) {
|
||||
retVal.add(Direction.CENTRAL);
|
||||
}
|
||||
}
|
||||
|
||||
if (yDirection != null &&
|
||||
(yDirection.equals(Direction.NORTH) || yDirection.equals(Direction.SOUTH))) {
|
||||
if ( env.getWidth() < RATIO*approximateWidth) {
|
||||
if (yDirection != null
|
||||
&& (yDirection.equals(Direction.NORTH) || yDirection
|
||||
.equals(Direction.SOUTH))) {
|
||||
if (env.getWidth() < RATIO * approximateWidth) {
|
||||
retVal.add(Direction.CENTRAL);
|
||||
}
|
||||
}
|
||||
|
||||
if ((retVal.contains(Direction.NORTH) && retVal.contains(Direction.WEST)) ||
|
||||
(retVal.contains(Direction.NORTH) && retVal.contains(Direction.EAST)) ||
|
||||
(retVal.contains(Direction.SOUTH) && retVal.contains(Direction.WEST)) ||
|
||||
(retVal.contains(Direction.SOUTH) && retVal.contains(Direction.EAST)) ) {
|
||||
if (retVal.contains(Direction.CENTRAL))
|
||||
retVal.remove(Direction.CENTRAL);
|
||||
|
||||
if ((retVal.contains(Direction.NORTH) && retVal
|
||||
.contains(Direction.WEST))
|
||||
|| (retVal.contains(Direction.NORTH) && retVal
|
||||
.contains(Direction.EAST))
|
||||
|| (retVal.contains(Direction.SOUTH) && retVal
|
||||
.contains(Direction.WEST))
|
||||
|| (retVal.contains(Direction.SOUTH) && retVal
|
||||
.contains(Direction.EAST))) {
|
||||
if (retVal.contains(Direction.CENTRAL))
|
||||
retVal.remove(Direction.CENTRAL);
|
||||
}
|
||||
|
||||
if (isExtreme && !suppressType.equals(SuppressMap.ALL))
|
||||
|
@ -286,11 +300,11 @@ public class GisUtil {
|
|||
coord.x = oldCoord.x;
|
||||
}
|
||||
coord.y = oldCoord.y;
|
||||
|
||||
|
||||
return coord;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Coordinate[] d2dCoordinates(Coordinate[] oldCoords) {
|
||||
int length = oldCoords.length;
|
||||
Coordinate[] coords = new Coordinate[length];
|
||||
|
@ -327,15 +341,15 @@ public class GisUtil {
|
|||
/**
|
||||
* restoreAlaskaLon()
|
||||
*
|
||||
* Feb 28, 2012 DR13596 Qinglu Lin Created.
|
||||
* Feb 28, 2012 DR13596 Qinglu Lin Created.
|
||||
*
|
||||
* If the longitude of a Coordinate is less than -180 and corresponding
|
||||
* latitude is larger than 45 degree North, convert it to a value
|
||||
* equivalent to (360 + the longitude).
|
||||
* If the longitude of a Coordinate is less than -180 and corresponding
|
||||
* latitude is larger than 45 degree North, convert it to a value equivalent
|
||||
* to (360 + the longitude).
|
||||
*/
|
||||
public static Coordinate restoreAlaskaLon(Coordinate oldCoords) {
|
||||
Coordinate coord = new Coordinate();
|
||||
if (oldCoords.x < -180. && oldCoords.y > 45.) {
|
||||
if (oldCoords.x < -180. && oldCoords.y > 45.) {
|
||||
coord.x = 360. + oldCoords.x;
|
||||
} else {
|
||||
coord.x = oldCoords.x;
|
||||
|
|
|
@ -53,6 +53,8 @@ import com.raytheon.uf.common.dataplugin.warning.config.PathcastConfiguration;
|
|||
import com.raytheon.uf.common.dataplugin.warning.config.PointSourceConfiguration;
|
||||
import com.raytheon.uf.common.dataplugin.warning.config.PointSourceConfiguration.SearchMethod;
|
||||
import com.raytheon.uf.common.dataplugin.warning.config.WarngenConfiguration;
|
||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialData;
|
||||
import com.raytheon.uf.common.dataplugin.warning.gis.GeospatialFactory;
|
||||
import com.raytheon.uf.common.dataplugin.warning.util.FileUtil;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.geospatial.DestinationGeodeticCalculator;
|
||||
|
@ -264,6 +266,7 @@ public class Wx {
|
|||
Date start = DateUtil.roundDate(new Date(wwaStartTime + delta),
|
||||
pathcastConfiguration.getInterval());
|
||||
Date stormTime = new Date(wwaStartTime);
|
||||
DestinationGeodeticCalculator gc = new DestinationGeodeticCalculator();
|
||||
while (start.getTime() <= wwaStopTime) {
|
||||
PathCast cast = new PathCast();
|
||||
cast.time = new Date(start.getTime());
|
||||
|
@ -277,7 +280,6 @@ public class Wx {
|
|||
Coordinate[] pathCoords = new Coordinate[stormLocations.length];
|
||||
for (int i = 0; i < pathCoords.length; ++i) {
|
||||
Coordinate loc = stormLocations[i];
|
||||
DestinationGeodeticCalculator gc = new DestinationGeodeticCalculator();
|
||||
gc.setStartingGeographicPoint(loc.x, loc.y);
|
||||
long time = (cast.time.getTime() - stormTime.getTime()) / 1000;
|
||||
double distance = stormTrackState.speed * time;
|
||||
|
@ -363,11 +365,9 @@ public class Wx {
|
|||
null, false, SearchMode.INTERSECTS);
|
||||
}
|
||||
|
||||
SpatialQueryResult[] timeZoneFeatures = SpatialQueryFactory
|
||||
.create().query(timezoneTable,
|
||||
new String[] { timezoneField },
|
||||
bufferedPathCastArea, null, false,
|
||||
SearchMode.INTERSECTS);
|
||||
// timeZones are limited, use data for whole CWA and further
|
||||
// intersection later
|
||||
GeospatialData[] timeZones = GeospatialFactory.getTimezones();
|
||||
|
||||
Map<PathCast, List<ClosestPoint>> pcPoints = new HashMap<PathCast, List<ClosestPoint>>();
|
||||
for (PathCast pc : pathcasts) {
|
||||
|
@ -383,7 +383,8 @@ public class Wx {
|
|||
Point centroid = pcGeom != null ? pcGeom.getCentroid()
|
||||
: warningPolygon.getCentroid();
|
||||
|
||||
SpatialQueryResult myArea = null, myTz = null;
|
||||
SpatialQueryResult myArea = null;
|
||||
GeospatialData myTz = null;
|
||||
|
||||
if (areaFeatures != null) {
|
||||
// Find area and parent area
|
||||
|
@ -395,13 +396,13 @@ public class Wx {
|
|||
}
|
||||
}
|
||||
|
||||
if (timeZoneFeatures != null) {
|
||||
if (timeZones != null) {
|
||||
// Find time zone
|
||||
if (timeZoneFeatures.length == 1) {
|
||||
myTz = timeZoneFeatures[0];
|
||||
if (timeZones.length == 1) {
|
||||
myTz = timeZones[0];
|
||||
} else {
|
||||
for (SpatialQueryResult tzResult : timeZoneFeatures) {
|
||||
if (tzResult.geometry.contains(centroid)) {
|
||||
for (GeospatialData tzResult : timeZones) {
|
||||
if (tzResult.prepGeom.contains(centroid)) {
|
||||
myTz = tzResult;
|
||||
break;
|
||||
}
|
||||
|
@ -435,7 +436,9 @@ public class Wx {
|
|||
}
|
||||
|
||||
// Find closest points
|
||||
List<ClosestPoint> points = new ArrayList<ClosestPoint>();
|
||||
GeodeticCalculator gc = new GeodeticCalculator();
|
||||
List<ClosestPoint> points = new ArrayList<ClosestPoint>(
|
||||
ptFeatures.length);
|
||||
for (SpatialQueryResult pointRslt : ptFeatures) {
|
||||
Geometry localPt = (Geometry) pointRslt.attributes
|
||||
.get(transformedKey);
|
||||
|
@ -467,7 +470,6 @@ public class Wx {
|
|||
cp.distance = minDist;
|
||||
cp.roundedDistance = (int) metersToDistance
|
||||
.convert(minDist);
|
||||
GeodeticCalculator gc = new GeodeticCalculator();
|
||||
gc.setStartingGeographicPoint(cp.point.x, cp.point.y);
|
||||
gc.setDestinationGeographicPoint(closestCoord.x,
|
||||
closestCoord.y);
|
||||
|
@ -529,8 +531,7 @@ public class Wx {
|
|||
// check for same point in other pathcast objects. If same point
|
||||
// exists, remove from which ever pathcast is furthest away
|
||||
Set<String> closestPtNames = new HashSet<String>(30);
|
||||
List<ClosestPoint> tmpPoints = new ArrayList<ClosestPoint>(
|
||||
maxCount);
|
||||
List<ClosestPoint> tmpPoints = new ArrayList<ClosestPoint>(maxCount);
|
||||
Queue<PathCast> tmp = new ArrayDeque<PathCast>(pathcasts);
|
||||
while (tmp.isEmpty() == false) {
|
||||
PathCast pc = tmp.remove();
|
||||
|
@ -560,14 +561,14 @@ public class Wx {
|
|||
|
||||
tmpPoints.clear();
|
||||
for (int i = 0; i < points.size() && i < maxCount; ++i) {
|
||||
ClosestPoint point = points.get(i);
|
||||
String name = point.getName();
|
||||
if (!closestPtNames.contains(name)) {
|
||||
// To prevent duplicate cities in pathcast,
|
||||
// only unused point is added to tmpPoints
|
||||
tmpPoints.add(point);
|
||||
closestPtNames.add(name);
|
||||
}
|
||||
ClosestPoint point = points.get(i);
|
||||
String name = point.getName();
|
||||
if (!closestPtNames.contains(name)) {
|
||||
// To prevent duplicate cities in pathcast,
|
||||
// only unused point is added to tmpPoints
|
||||
tmpPoints.add(point);
|
||||
closestPtNames.add(name);
|
||||
}
|
||||
}
|
||||
if (tmpPoints.size() > 0) {
|
||||
pc.points = tmpPoints.toArray(new ClosestPoint[tmpPoints
|
||||
|
@ -711,7 +712,7 @@ public class Wx {
|
|||
|
||||
// Sort by fields should have been validated to be same as well
|
||||
List<String> fields = pointConfigs[0].getSortBy() != null ? Arrays
|
||||
.asList(pointConfigs[0].getSortBy()) : new ArrayList<String>();
|
||||
.asList(pointConfigs[0].getSortBy()) : new ArrayList<String>(0);
|
||||
|
||||
Geometry searchArea = null;
|
||||
double bufferVal = thresholdInMeters;
|
||||
|
@ -734,9 +735,9 @@ public class Wx {
|
|||
stormCoords.length + endStormCoords.length);
|
||||
allCoords.addAll(Arrays.asList(stormCoords));
|
||||
long time = (wwaStopTime - wwaStartTime) / 1000;
|
||||
DestinationGeodeticCalculator gc = new DestinationGeodeticCalculator();
|
||||
for (int i = stormCoords.length - 1; i >= 0; --i) {
|
||||
Coordinate loc = stormCoords[i];
|
||||
DestinationGeodeticCalculator gc = new DestinationGeodeticCalculator();
|
||||
gc.setStartingGeographicPoint(loc.x, loc.y);
|
||||
double distance = stormTrackState.speed * time;
|
||||
gc.setDirection(StormTrackDisplay
|
||||
|
@ -769,25 +770,32 @@ public class Wx {
|
|||
|
||||
List<ClosestPoint> availablePoints = new ArrayList<ClosestPoint>();
|
||||
for (PointSourceConfiguration pointConfig : pointConfigs) {
|
||||
long t0 = System.currentTimeMillis();
|
||||
availablePoints.addAll(DataAdaptorFactory.createPointSource(
|
||||
pointConfig).getData(config, pointConfig,
|
||||
bufferedSearchArea, localizedSite));
|
||||
long t1 = System.currentTimeMillis();
|
||||
System.out.println("getClosestPoint.dbQuery took " + (t1 - t0)
|
||||
+ " for point source " + pointConfig.getPointSource());
|
||||
}
|
||||
|
||||
// Convert searchArea to a local projection
|
||||
Geometry localSearchArea = JTS.transform(searchArea, latLonToLocal);
|
||||
|
||||
List<List<ClosestPoint>> points = new ArrayList<List<ClosestPoint>>();
|
||||
Coordinate[] localCoords = localSearchArea.getCoordinates();
|
||||
Coordinate[] coords = searchArea.getCoordinates();
|
||||
List<List<ClosestPoint>> points = new ArrayList<List<ClosestPoint>>(
|
||||
coords.length);
|
||||
GeodeticCalculator gc = new GeodeticCalculator();
|
||||
Map<String, ClosestPoint> nameMap = new HashMap<String, ClosestPoint>(
|
||||
(int) (availablePoints.size() * 1.3));
|
||||
for (int i = 0; i < coords.length; ++i) {
|
||||
Coordinate coord = localCoords[i];
|
||||
Geometry localDistanceGeom = dimensions == 1 ? localSearchArea : gf
|
||||
.createPoint(coord);
|
||||
Geometry distanceGeom = dimensions == 1 ? searchArea : gf
|
||||
.createPoint(coords[i]);
|
||||
List<ClosestPoint> pts = new ArrayList<ClosestPoint>();
|
||||
Map<String, ClosestPoint> nameMap = new HashMap<String, ClosestPoint>();
|
||||
nameMap.clear();
|
||||
|
||||
for (ClosestPoint cp : availablePoints) {
|
||||
Geometry localPt = JTS.transform(gf.createPoint(cp.point),
|
||||
|
@ -800,16 +808,10 @@ public class Wx {
|
|||
ClosestPoint existingPt = nameMap.get(cp.name);
|
||||
if (existingPt == null || distance < existingPt.distance) {
|
||||
// Set the distances
|
||||
ClosestPoint cp2 = new ClosestPoint(cp);
|
||||
cp2.distance = distance;
|
||||
ClosestPoint cp2 = new ClosestPoint(cp);
|
||||
cp2.distance = distance;
|
||||
cp2.roundedDistance = (int) metersToDistance
|
||||
.convert(distance);
|
||||
// No point by name or we are better at this location
|
||||
if (existingPt != null) {
|
||||
// There was an existing point, remove it
|
||||
pts.remove(existingPt);
|
||||
}
|
||||
GeodeticCalculator gc = new GeodeticCalculator();
|
||||
gc.setStartingGeographicPoint(cp2.point.x, cp2.point.y);
|
||||
Coordinate cen = distanceGeom.getCentroid()
|
||||
.getCoordinate();
|
||||
|
@ -822,11 +824,12 @@ public class Wx {
|
|||
cp2.oppositeRoundedAzimuth = ClosestPoint
|
||||
.adjustAngle(cp2.roundedAzimuth + 180);
|
||||
nameMap.put(cp2.name, cp2);
|
||||
pts.add(cp2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<ClosestPoint> pts = new ArrayList<ClosestPoint>(
|
||||
nameMap.values());
|
||||
if (fields.isEmpty() == false) {
|
||||
// Sort the points based on sortBy fields
|
||||
Collections.sort(pts, new ClosestPointComparator(fields));
|
||||
|
@ -839,38 +842,52 @@ public class Wx {
|
|||
}
|
||||
|
||||
// Filter to maxCount (Somewhat duplicate logic as pathcast)
|
||||
Queue<List<ClosestPoint>> tmp = new ArrayDeque<List<ClosestPoint>>(
|
||||
points);
|
||||
while (tmp.isEmpty() == false) {
|
||||
List<ClosestPoint> pts = tmp.remove();
|
||||
for (int i = 0; i < pts.size() && i < maxCount; ++i) {
|
||||
// For each point, look for duplicate points in another
|
||||
ClosestPoint cp = pts.get(i);
|
||||
for (List<ClosestPoint> pts2 : tmp) {
|
||||
if (pts2 != pts) {
|
||||
ClosestPoint found = find(cp, pts2, maxCount);
|
||||
if (found != null) {
|
||||
// We found a point within maxCount in this
|
||||
// list.
|
||||
if (found.distance < cp.distance) {
|
||||
// This point is closer to the other
|
||||
pts.remove(i--);
|
||||
break;
|
||||
} else {
|
||||
// Remove from other pathcast, we are closer
|
||||
pts2.remove(found);
|
||||
if (points.size() == 1) {
|
||||
// optimized for single instance
|
||||
List<ClosestPoint> pts = points.get(0);
|
||||
if (pts.size() > maxCount) {
|
||||
// need to reduce points
|
||||
pts.subList(maxCount, pts.size()).clear();
|
||||
}
|
||||
} else if (points.size() > 1) {
|
||||
Queue<List<ClosestPoint>> tmp = new ArrayDeque<List<ClosestPoint>>(
|
||||
points);
|
||||
while (!tmp.isEmpty()) {
|
||||
List<ClosestPoint> pts = tmp.remove();
|
||||
int maxIndex = Math.min(pts.size(), maxCount);
|
||||
for (int i = 0; i < maxIndex; ++i) {
|
||||
// For each point, look for duplicate points in another
|
||||
ClosestPoint cp = pts.get(i);
|
||||
for (List<ClosestPoint> pts2 : tmp) {
|
||||
if (pts2 != pts) {
|
||||
ClosestPoint found = find(cp, pts2, maxCount);
|
||||
if (found != null) {
|
||||
// We found a point within maxCount in this
|
||||
// list.
|
||||
if (found.distance < cp.distance) {
|
||||
// This point is closer to the other
|
||||
pts.remove(i--);
|
||||
// changed size of pts, may need to change
|
||||
// maxIndex
|
||||
if (pts.size() < maxIndex) {
|
||||
maxIndex--;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
// Remove from other pathcast, we are
|
||||
// closer
|
||||
pts2.remove(found);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<ClosestPoint> tmpPoints = new ArrayList<ClosestPoint>(maxCount);
|
||||
for (int i = 0; i < pts.size() && i < maxCount; ++i) {
|
||||
tmpPoints.add(pts.get(i));
|
||||
if (pts.size() > maxIndex) {
|
||||
// need to reduce points
|
||||
pts.subList(maxIndex, pts.size()).clear();
|
||||
}
|
||||
}
|
||||
pts.clear();
|
||||
pts.addAll(tmpPoints);
|
||||
}
|
||||
if (points.size() == 1) {
|
||||
List<ClosestPoint> rval = points.get(0);
|
||||
|
|
|
@ -2045,14 +2045,12 @@ public class WarngenDialog extends CaveSWTDialog implements
|
|||
/**
|
||||
* Set the shell to visible and then move it on top of the CAVE dialog.
|
||||
*/
|
||||
public void showDialog(boolean show) {
|
||||
if (shell != null && shell.isDisposed() == false) {
|
||||
if (shell.isVisible() != show) {
|
||||
// Only call setVisible if we aren't what we need
|
||||
shell.setVisible(show);
|
||||
}
|
||||
|
||||
public void showDialog(boolean show) {
|
||||
if (shell != null && shell.isDisposed() == false) {
|
||||
if (show) {
|
||||
if (shell.isVisible() == false) {
|
||||
shell.setVisible(true);
|
||||
}
|
||||
// Move above parent shell if we are showing it
|
||||
shell.moveAbove(getParent());
|
||||
}
|
||||
|
|
|
@ -202,9 +202,6 @@ public class WarngenUIManager extends InputAdapter {
|
|||
return super.handleMouseUp(x, y, mouseButton);
|
||||
}
|
||||
|
||||
if (mouseButton == 2 && !pointCreated) {
|
||||
new DeleteVertexAction().run();
|
||||
}
|
||||
|
||||
if (mouseButton == 3) {
|
||||
Coordinate c = container.translateClick(x, y);
|
||||
|
@ -425,11 +422,14 @@ public class WarngenUIManager extends InputAdapter {
|
|||
Coordinate toRemove = (Coordinate) coords[idx].clone();
|
||||
GeometryFactory gf = new GeometryFactory();
|
||||
List<Coordinate> coordList = new ArrayList<Coordinate>();
|
||||
|
||||
List<Coordinate> alreadyRemoved = new ArrayList<Coordinate>();
|
||||
|
||||
for (int i = 0; i < coords.length; ++i) {
|
||||
Coordinate toAdd = (Coordinate) coords[i].clone();
|
||||
if (!toAdd.equals(toRemove)) {
|
||||
if (!toAdd.equals(toRemove) || alreadyRemoved.contains(toAdd)) {
|
||||
coordList.add(toAdd);
|
||||
} else {
|
||||
alreadyRemoved.add(toAdd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,14 +22,17 @@ package com.raytheon.viz.warngen.template;
|
|||
import java.awt.geom.Point2D;
|
||||
import java.io.StringWriter;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
|
@ -41,12 +44,14 @@ import javax.measure.converter.UnitConverter;
|
|||
import javax.measure.unit.NonSI;
|
||||
import javax.measure.unit.SI;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.apache.velocity.Template;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
import org.apache.velocity.app.VelocityEngine;
|
||||
import org.apache.velocity.tools.generic.ListTool;
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
|
||||
import com.raytheon.uf.common.activetable.ActiveTableMode;
|
||||
import com.raytheon.uf.common.activetable.ActiveTableRecord;
|
||||
|
@ -67,6 +72,7 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.maps.rsc.DbMapQueryFactory;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.awipstools.ToolsDataManager;
|
||||
import com.raytheon.viz.awipstools.common.StormTrackData;
|
||||
|
@ -96,6 +102,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.GeometryCollection;
|
||||
import com.vividsolutions.jts.geom.Polygon;
|
||||
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
|
||||
import com.vividsolutions.jts.io.WKTReader;
|
||||
|
||||
/**
|
||||
|
@ -218,7 +225,8 @@ public class TemplateRunner {
|
|||
context.put("dateUtil", new DateUtil());
|
||||
context.put("pointComparator", new ClosestPointComparator());
|
||||
|
||||
String action = followupData != null ? followupData.getAct() : WarningAction.NEW.toString();
|
||||
String action = followupData != null ? followupData.getAct()
|
||||
: WarningAction.NEW.toString();
|
||||
String phen = followupData != null ? followupData.getPhen() : null;
|
||||
String sig = followupData != null ? followupData.getSig() : null;
|
||||
String etn = followupData != null ? followupData.getEtn() : null;
|
||||
|
@ -249,20 +257,21 @@ public class TemplateRunner {
|
|||
String[] oneLetterTZ;
|
||||
double minSize = 1.0E-3d;
|
||||
if (areas != null && areas.length > 0) {
|
||||
Set<String> timeZones = new HashSet<String>();
|
||||
Set<String> timeZones = new HashSet<String>();
|
||||
for (AffectedAreas area : areas) {
|
||||
if (area.getTimezone() != null) {
|
||||
// Handles counties that span two time zones
|
||||
String oneLetterTimeZones = area.getTimezone().trim();
|
||||
oneLetterTZ = new String[oneLetterTimeZones.length()];
|
||||
if (oneLetterTimeZones.length() == 1) {
|
||||
timeZones.add(String.valueOf(oneLetterTimeZones.charAt(0)));
|
||||
timeZones.add(String.valueOf(oneLetterTimeZones
|
||||
.charAt(0)));
|
||||
} else {
|
||||
// Determine if one letter timezone is going to be put into timeZones.
|
||||
Polygon[] poly1, poly2;
|
||||
int n1, n2;
|
||||
double size, totalSize;
|
||||
for (int i = 0; i < oneLetterTimeZones.length(); i++) {
|
||||
for (int i = 0; i < oneLetterTimeZones.length(); i++) {
|
||||
oneLetterTZ[i] = String.valueOf(oneLetterTimeZones.charAt(i));
|
||||
Geometry timezoneGeom = warngenLayer.getTimezoneGeom(oneLetterTZ[i]);
|
||||
t0 = System.currentTimeMillis();
|
||||
|
@ -298,8 +307,8 @@ public class TemplateRunner {
|
|||
+ (System.currentTimeMillis() - t0));
|
||||
if (totalSize > minSize) {
|
||||
timeZones.add(oneLetterTZ[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// If timeZones has nothing in it when the hatched area is very small,
|
||||
// use the timezone of larger intersection size.
|
||||
if (timeZones.size() == 0 ) {
|
||||
|
@ -321,11 +330,11 @@ public class TemplateRunner {
|
|||
|
||||
Iterator<String> iterator = timeZones.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
if (context.get("localtimezone") == null) {
|
||||
context.put("localtimezone", iterator.next());
|
||||
} else if (context.get("secondtimezone") == null) {
|
||||
context.put("secondtimezone", iterator.next());
|
||||
}
|
||||
if (context.get("localtimezone") == null) {
|
||||
context.put("localtimezone", iterator.next());
|
||||
} else if (context.get("secondtimezone") == null) {
|
||||
context.put("secondtimezone", iterator.next());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,11 +352,12 @@ public class TemplateRunner {
|
|||
"expire",
|
||||
DateUtil.roundDateTo15(selectedAction == WarningAction.EXT ? endTime
|
||||
: wx.getEndTime()));
|
||||
|
||||
|
||||
// duration: convert millisecond to minute
|
||||
long duration = (wx.getEndTime().getTime()-wx.getStartTime().getTime())/(1000*60);
|
||||
long duration = (wx.getEndTime().getTime() - wx.getStartTime()
|
||||
.getTime()) / (1000 * 60);
|
||||
context.put("duration", duration);
|
||||
|
||||
|
||||
context.put("event", eventTime);
|
||||
context.put("ugcline",
|
||||
FipsUtil.getUgcLine(areas, wx.getEndTime(), 15));
|
||||
|
@ -392,8 +402,7 @@ public class TemplateRunner {
|
|||
context.put("movementDirection", motionDirection);
|
||||
// Convert to Point2D representation as Velocity requires
|
||||
// getX() and getY() methods which Coordinate does not have
|
||||
Coordinate[] newStormLocs = GisUtil
|
||||
.d2dCoordinates(stormLocs);
|
||||
Coordinate[] newStormLocs = GisUtil.d2dCoordinates(stormLocs);
|
||||
Point2D.Double[] coords = new Point2D.Double[newStormLocs.length];
|
||||
for (int i = 0; i < newStormLocs.length; i++) {
|
||||
coords[i] = new Point2D.Double(newStormLocs[i].x,
|
||||
|
@ -524,8 +533,9 @@ public class TemplateRunner {
|
|||
if (totalSegments > 1) {
|
||||
al = FollowUpUtil.canceledAreasFromText(originalText);
|
||||
}
|
||||
context.put("cancel"+ config.getAreaConfig().getVariable(), al);
|
||||
context.put("ugclinecan", FollowUpUtil.getUgcLineCanFromText(originalText));
|
||||
context.put("cancel" + config.getAreaConfig().getVariable(), al);
|
||||
context.put("ugclinecan",
|
||||
FollowUpUtil.getUgcLineCanFromText(originalText));
|
||||
} else if (selectedAction == WarningAction.EXT) {
|
||||
context.put("action", WarningAction.EXT.toString());
|
||||
context.put("etn", etn);
|
||||
|
@ -641,7 +651,7 @@ public class TemplateRunner {
|
|||
+ (System.currentTimeMillis() - tz0));
|
||||
|
||||
return WarningTextHandler.handle(script.toString().toUpperCase(),
|
||||
areas, cancelareas, selectedAction,
|
||||
areas, cancelareas, selectedAction,
|
||||
WarningAction.valueOf((String) context.get("action")),
|
||||
config.getAutoLockText());
|
||||
}
|
||||
|
@ -720,15 +730,13 @@ public class TemplateRunner {
|
|||
Validate.isTrue(
|
||||
config.getAreaConfig().getIncludedWatchAreaBuffer() >= 0,
|
||||
"IncludedWatchAreaBuffer can not be negative");
|
||||
Polygon watchArea = (Polygon) polygon.buffer(milesToKilometer
|
||||
.convert(config.getAreaConfig().getIncludedWatchAreaBuffer())
|
||||
/ KmToDegrees);
|
||||
WatchUtil rval = null;
|
||||
GetActiveTableRequest req = new GetActiveTableRequest();
|
||||
String[] includedWatches = config.getIncludedWatches();
|
||||
|
||||
if (config.getIncludedWatches() != null
|
||||
&& config.getIncludedWatches().length > 0) {
|
||||
if (includedWatches != null && includedWatches.length > 0) {
|
||||
String phensigList = null;
|
||||
for (String includedWatch : config.getIncludedWatches()) {
|
||||
for (String includedWatch : includedWatches) {
|
||||
if (includedWatch.equalsIgnoreCase("torWatches")) {
|
||||
phensigList = phensigList == null ? "TO.A" : phensigList
|
||||
+ ",TO.A";
|
||||
|
@ -737,66 +745,137 @@ public class TemplateRunner {
|
|||
+ ",SV.A";
|
||||
}
|
||||
}
|
||||
|
||||
req.setPhensigList(phensigList);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (CAVEMode.getMode().equals(CAVEMode.PRACTICE)) {
|
||||
req.setMode(ActiveTableMode.PRACTICE);
|
||||
} else {
|
||||
req.setMode(ActiveTableMode.OPERATIONAL);
|
||||
}
|
||||
if (CAVEMode.getMode().equals(CAVEMode.PRACTICE)) {
|
||||
req.setMode(ActiveTableMode.PRACTICE);
|
||||
} else {
|
||||
req.setMode(ActiveTableMode.OPERATIONAL);
|
||||
}
|
||||
|
||||
req.setSiteID(fourLetterSiteId);
|
||||
req.setRequestValidTimes(true);
|
||||
req.setSiteID(fourLetterSiteId);
|
||||
req.setRequestValidTimes(true);
|
||||
|
||||
GetActiveTableResponse resp = (GetActiveTableResponse) ThriftClient
|
||||
.sendRequest(req);
|
||||
java.util.List<ActiveTableRecord> activeTable = resp.getActiveTable();
|
||||
long t0 = System.currentTimeMillis();
|
||||
GetActiveTableResponse resp = (GetActiveTableResponse) ThriftClient
|
||||
.sendRequest(req);
|
||||
long t1 = System.currentTimeMillis();
|
||||
java.util.List<ActiveTableRecord> activeTable = resp
|
||||
.getActiveTable();
|
||||
|
||||
if (activeTable != null && activeTable.isEmpty() == false) {
|
||||
warngenLayer.createGeometryForWatches(watchArea, activeTable);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
System.out.println("getWatches.getActiveTable time: " + (t1 - t0)
|
||||
+ ", found "
|
||||
+ (activeTable != null ? activeTable.size() : "0")
|
||||
+ " watches");
|
||||
boolean val = activeTable != null && !activeTable.isEmpty();
|
||||
if (val) {
|
||||
// Look for ones with valid geometry
|
||||
|
||||
SpatialQueryResult[] parentRegionFeatures = null;
|
||||
try {
|
||||
parentRegionFeatures = SpatialQueryFactory.create().query("States",
|
||||
new String[] { "Name" }, watchArea, null, false,
|
||||
SearchMode.INTERSECTS);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
t0 = System.currentTimeMillis();
|
||||
Polygon watchArea = (Polygon) polygon.buffer(milesToKilometer
|
||||
.convert(config.getAreaConfig()
|
||||
.getIncludedWatchAreaBuffer())
|
||||
/ KmToDegrees);
|
||||
t1 = System.currentTimeMillis();
|
||||
System.out.println("getWatches.polygonBuffer time: "
|
||||
+ (t1 - t0));
|
||||
|
||||
WatchUtil rval = new WatchUtil();
|
||||
WeatherAdvisoryWatch watch = null;
|
||||
t0 = System.currentTimeMillis();
|
||||
warngenLayer.createGeometryForWatches(watchArea, activeTable);
|
||||
t1 = System.currentTimeMillis();
|
||||
System.out.println("getWatches.createWatchGeometry time: "
|
||||
+ (t1 - t0));
|
||||
SpatialQueryResult[] parentRegionFeatures = null;
|
||||
|
||||
for (ActiveTableRecord atr : activeTable) {
|
||||
// For each State in our watchArea...
|
||||
for (int j = 0; j < parentRegionFeatures.length; j++) {
|
||||
watch = new WeatherAdvisoryWatch();
|
||||
watch.setEndTime(atr.getEndTime().getTime());
|
||||
watch.setPhensig(atr.getPhensig());
|
||||
try {
|
||||
String field = "the_geom";
|
||||
t0 = System.currentTimeMillis();
|
||||
List<Double> results = DbMapQueryFactory.getMapQuery(
|
||||
"mapdata.states", field).getLevels();
|
||||
Collections.sort(results, Collections.reverseOrder());
|
||||
Double decimationTolerance = null;
|
||||
for (Double result : results) {
|
||||
if (result <= 0.064) {
|
||||
decimationTolerance = result;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the intersection of watchArea with State.
|
||||
Geometry parentGeom = parentRegionFeatures[j].geometry;
|
||||
if (decimationTolerance != null) {
|
||||
DecimalFormat df = new DecimalFormat("0.######");
|
||||
String suffix = "_"
|
||||
+ StringUtils.replaceChars(df.format(results
|
||||
.get(results.size() - 1)), '.', '_');
|
||||
parentRegionFeatures = SpatialQueryFactory.create()
|
||||
.query("states", field + suffix,
|
||||
new String[] { "Name" }, watchArea,
|
||||
null, false, SearchMode.INTERSECTS);
|
||||
} else {
|
||||
parentRegionFeatures = SpatialQueryFactory.create()
|
||||
.query("states", new String[] { "Name" },
|
||||
watchArea, null, false,
|
||||
SearchMode.INTERSECTS);
|
||||
}
|
||||
|
||||
// If State intersections intersects with out ATR record, add
|
||||
// watch
|
||||
if (GeometryUtil.intersects(parentGeom, atr.getGeometry())) {
|
||||
watch.setParentRegion(parentRegionFeatures[j].attributes
|
||||
.get("Name").toString());
|
||||
|
||||
watch.setPartOfParentRegion(GisUtil.asStringList(GisUtil
|
||||
.calculatePortion(parentGeom, atr.getGeometry())));
|
||||
rval.addWaw(watch);
|
||||
t1 = System.currentTimeMillis();
|
||||
System.out.println("getWatches.stateSpatialQuery time: "
|
||||
+ (t1 - t0) + ", found "
|
||||
+ parentRegionFeatures.length + " states");
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error querying state geometries", e);
|
||||
return null;
|
||||
}
|
||||
|
||||
rval = new WatchUtil();
|
||||
WeatherAdvisoryWatch watch = null;
|
||||
long cumulativeIntersect = 0;
|
||||
long cumulativeCalcPortion = 0;
|
||||
GeodeticCalculator gc = new GeodeticCalculator();
|
||||
|
||||
// For each State in our watchArea...
|
||||
for (int j = 0; j < parentRegionFeatures.length; j++) {
|
||||
Geometry parentGeom = parentRegionFeatures[j].geometry;
|
||||
List<PreparedGeometry> prepGeoms = new ArrayList<PreparedGeometry>();
|
||||
GeometryUtil.recursivePreparedGeometry(parentGeom,
|
||||
prepGeoms);
|
||||
|
||||
for (ActiveTableRecord atr : activeTable) {
|
||||
// Get the intersection of watchArea with State.
|
||||
watch = new WeatherAdvisoryWatch();
|
||||
watch.setEndTime(atr.getEndTime().getTime());
|
||||
watch.setPhensig(atr.getPhensig());
|
||||
|
||||
// If State intersections intersects with out ATR
|
||||
// record, add watch
|
||||
t0 = System.currentTimeMillis();
|
||||
boolean intersects = GeometryUtil.intersects(prepGeoms,
|
||||
atr.getGeometry());
|
||||
t1 = System.currentTimeMillis();
|
||||
cumulativeIntersect = (t1 - t0);
|
||||
|
||||
if (intersects) {
|
||||
watch.setParentRegion(parentRegionFeatures[j].attributes
|
||||
.get("Name").toString());
|
||||
|
||||
t0 = System.currentTimeMillis();
|
||||
watch.setPartOfParentRegion(GisUtil
|
||||
.asStringList(GisUtil.calculatePortion(
|
||||
parentGeom, atr.getGeometry(), gc)));
|
||||
t1 = System.currentTimeMillis();
|
||||
cumulativeCalcPortion = (t1 - t0);
|
||||
rval.addWaw(watch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("getWatches.cumulativeIntersect: "
|
||||
+ cumulativeIntersect);
|
||||
System.out.println("getWatches.cumulativeCalcPortion: "
|
||||
+ cumulativeCalcPortion);
|
||||
}
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,12 @@ import org.apache.velocity.tools.generic.MathTool;
|
|||
/**
|
||||
* @author bwoodle
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 31, 2012 15219 Qinglu Lin Added roundAndPad().
|
||||
*
|
||||
*/
|
||||
public class WarnGenMathTool extends MathTool {
|
||||
|
||||
|
@ -57,4 +63,19 @@ public class WarnGenMathTool extends MathTool {
|
|||
return roundToInt(num, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Round movement direction to integer, and pad it with leading zeros
|
||||
* if it's less than 100
|
||||
*/
|
||||
public static String roundAndPad(double direction) {
|
||||
int num = (int)Math.rint(direction);
|
||||
if (num < 10)
|
||||
return String.format ("00%s",num);
|
||||
else
|
||||
if (num < 100)
|
||||
return String.format ("0%s",num);
|
||||
else
|
||||
return String.format ("%s",num);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -441,6 +441,8 @@ public class WarningTextHandler {
|
|||
}
|
||||
|
||||
if (line.trim().length() == 0) {
|
||||
insideTML = false;
|
||||
insideLatLon = false;
|
||||
headlineFound = false;
|
||||
if (smwCan) {
|
||||
if (lockSmwCan)
|
||||
|
@ -694,7 +696,7 @@ public class WarningTextHandler {
|
|||
// Locking LAT...LON
|
||||
m = latLonPtrn.matcher(line);
|
||||
if (m.find()) {
|
||||
sb.append(LOCK_START + line + "\n");
|
||||
sb.append(LOCK_START + line + "\n" + LOCK_END);
|
||||
insideLatLon = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -702,11 +704,10 @@ public class WarningTextHandler {
|
|||
if (insideLatLon) {
|
||||
m = subLatLonPtrn.matcher(line);
|
||||
if (m.find()) {
|
||||
sb.append(line + "\n");
|
||||
sb.append(LOCK_START +line + "\n" + LOCK_END);
|
||||
continue;
|
||||
} else {
|
||||
insideLatLon = false;
|
||||
sb.append(LOCK_END);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -719,7 +720,7 @@ public class WarningTextHandler {
|
|||
// Locking TIME...MOT..LOC
|
||||
m = tmlPtrn.matcher(line);
|
||||
if (m.find()) {
|
||||
sb.append(LOCK_START + line + "\n");
|
||||
sb.append(LOCK_START + line + "\n"+ LOCK_END);
|
||||
insideTML = true;
|
||||
continue;
|
||||
}
|
||||
|
@ -727,11 +728,10 @@ public class WarningTextHandler {
|
|||
if (insideTML) {
|
||||
m = subTMLPtrn.matcher(line);
|
||||
if (m.matches()) {
|
||||
sb.append(line + "\n");
|
||||
sb.append(LOCK_START + line + "\n" + LOCK_END);
|
||||
continue;
|
||||
} else {
|
||||
insideTML = false;
|
||||
sb.append(LOCK_END);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
95
deltaScripts/future/relocateTextUtilities.py
Normal file
95
deltaScripts/future/relocateTextUtilities.py
Normal file
|
@ -0,0 +1,95 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
##
|
||||
# This software was developed and / or modified by Raytheon Company,
|
||||
# pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
#
|
||||
# U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
# This software product contains export-restricted data whose
|
||||
# export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
# to non-U.S. persons whether in the United States or abroad requires
|
||||
# an export license or other authorization.
|
||||
#
|
||||
# Contractor Name: Raytheon Company
|
||||
# Contractor Address: 6825 Pine Street, Suite 340
|
||||
# Mail Stop B8
|
||||
# Omaha, NE 68106
|
||||
# 402.291.0100
|
||||
#
|
||||
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
# further licensing information.
|
||||
##
|
||||
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
def forceTextProdRegen():
|
||||
oldTextProds = glob.glob('/awips2/edex/data/utility/cave_static/configured/*/gfe/userPython/textProducts/*.py*')
|
||||
for script in oldTextProds:
|
||||
try:
|
||||
os.remove(script)
|
||||
except:
|
||||
pass
|
||||
oldTextUtils = glob.glob('/awips2/edex/data/utility/cave_static/configured/*/gfe/userPython/textUtilities/regular/*.py*')
|
||||
for script in oldTextUtils:
|
||||
try:
|
||||
os.remove(script)
|
||||
except:
|
||||
pass
|
||||
# touch shapefile and template file to force regen of textProducts and all textUtilities
|
||||
shapeFile = glob.glob('/awips2/edex/data/utility/edex_static/base/shapefiles/*/*.shp')[0]
|
||||
prodTemplate = glob.glob('/awips2/edex/data/utility/edex_static/base/textproducts/templates/product/*.py')[0]
|
||||
# passing None as the second arg is equivalent to running touch
|
||||
os.utime(shapeFile, None)
|
||||
os.utime(prodTemplate, None)
|
||||
|
||||
def relocateSiteLevelUtils():
|
||||
sitePaths = getSubDirs('/awips2/edex/data/utility/cave_static/site')
|
||||
for site in sitePaths:
|
||||
scripts = glob.glob(os.path.join(site, 'gfe/userPython/textProducts/*.py'))
|
||||
for script in scripts:
|
||||
if not isTextProduct(script):
|
||||
moveToUtilities(script)
|
||||
|
||||
def relocateUserLevelUtils():
|
||||
userPaths = getSubDirs('/awips2/edex/data/utility/cave_static/user')
|
||||
for user in userPaths:
|
||||
scripts = glob.glob(os.path.join(user, 'gfe/userPython/textProducts/*.py'))
|
||||
for script in scripts:
|
||||
if not isTextProduct(script):
|
||||
moveToUtilities(script)
|
||||
|
||||
def getSubDirs(path):
|
||||
return [os.path.join(path, name) for name in os.listdir(path)
|
||||
if os.path.isdir(os.path.join(path, name))]
|
||||
|
||||
def isTextProduct(path):
|
||||
retVal = False
|
||||
with open(path, 'r') as f:
|
||||
txt = f.read()
|
||||
if "class TextProduct" in txt:
|
||||
retVal = True
|
||||
return retVal
|
||||
|
||||
def moveToUtilities(srcPath):
|
||||
destPath = srcPath.replace('textProducts', 'textUtilities/regular', 1)
|
||||
if not os.path.isdir(os.path.dirname(destPath)):
|
||||
os.makedirs(os.path.dirname(destPath))
|
||||
shutil.move(srcPath, destPath)
|
||||
# make sure any .pyo, .pyc, and .md5 files are not left behind
|
||||
garbageFiles = glob.glob(srcPath + "*")
|
||||
for file in garbageFiles:
|
||||
try:
|
||||
os.remove(file)
|
||||
except:
|
||||
pass
|
||||
|
||||
def main():
|
||||
forceTextProdRegen()
|
||||
relocateSiteLevelUtils()
|
||||
relocateUserLevelUtils()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -62,9 +62,9 @@
|
|||
<property name="c3p0.acquire_increment">1</property>
|
||||
<property name="c3p0.idle_test_period">60</property>
|
||||
<property name="c3p0.timeout">300</property>
|
||||
<property name="c3p0.max_size">10</property>
|
||||
<property name="c3p0.max_statements">10</property>
|
||||
<property name="c3p0.min_size">1</property>
|
||||
<property name="c3p0.max_size">20</property>
|
||||
<property name="c3p0.max_statements">20</property>
|
||||
|
||||
|
||||
<!-- Cache Properties -->
|
||||
|
|
|
@ -17,12 +17,32 @@
|
|||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<!-- ThriftSrv (RemoteRequestRouteWrapper) request log -->
|
||||
<appender name="ThriftSrvRequestLog" class="org.apache.log4j.rolling.RollingFileAppender">
|
||||
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
|
||||
<param name="FileNamePattern" value="${edex.home}/logs/edex-request-thriftSrv-%d{yyyyMMdd}.log"/>
|
||||
</rollingPolicy>
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-5p %d [%t] %c{1}: %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<appender name="ThriftSrvRequestLogAsync" class="org.apache.log4j.AsyncAppender">
|
||||
<appender-ref ref="ThriftSrvRequestLog" />
|
||||
</appender>
|
||||
|
||||
|
||||
<logger name="ProductSrvRequestLogger" additivity="false">
|
||||
<level value="DEBUG"/>
|
||||
<appender-ref ref="ProductSrvRequestLog"/>
|
||||
</logger>
|
||||
|
||||
<logger name="ThriftSrvRequestLogger" additivity="false">
|
||||
<level value="Info"/>
|
||||
<appender-ref ref="ThriftSrvRequestLogAsync" />
|
||||
</logger>
|
||||
|
||||
|
||||
<logger name="com.raytheon">
|
||||
<level value="INFO"/>
|
||||
|
|
|
@ -241,7 +241,5 @@
|
|||
<ARCHIVEDIR>archiveDir</ARCHIVEDIR>
|
||||
<SVCBACKUP>svcBackupDir</SVCBACKUP>
|
||||
<MHS_DATA>mhsData</MHS_DATA>
|
||||
<REQUEST_TIME_FILTER>requestTimeLogFilter</REQUEST_TIME_FILTER>
|
||||
<RESPONSE_SIZE_FILTER>responseSizeLogFilter</RESPONSE_SIZE_FILTER>
|
||||
</properties>
|
||||
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
<fxaDebugSaveBadTextFiles>false</fxaDebugSaveBadTextFiles>
|
||||
<svcBackupDir>${env:edex.home}/../GFESuite/</svcBackupDir>
|
||||
<mhsData>/data/fxa/mhs</mhsData>
|
||||
<requestTimeLogFilter>1000</requestTimeLogFilter>
|
||||
<requestSizeLogFilter>8</requestSizeLogFilter>
|
||||
</properties>
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
##### UPDATED 3/2/12 12.2.1-4 BY EVAN BOOKBINDER
|
||||
##### Qinglu Lin 04-04-2012 DR 14691.
|
||||
##### Qinglu Lin 06-18-2012 DR 15043. Use duration in secondBullet.
|
||||
|
||||
#*
|
||||
##### Qinglu Lin 07-31-2012 DR 15217. Use roundAndPad for movement direction in DEG.
|
||||
####################################################################################################
|
||||
Mile Marker Test Code
|
||||
macro "mmarkers" use (called out of VM_global_library.vm):
|
||||
|
@ -330,7 +329,7 @@ ${mathUtil.abs(${mathUtil.round($v100)})}##
|
|||
#macro( tml $time $motdir $motspd $timeFormat $eventlocation )
|
||||
TIME...MOT...LOC ##
|
||||
${dateUtil.format(${start}, ${timeFormat.time})}Z ##
|
||||
${mathUtil.round(${motdir})}DEG ##
|
||||
${mathUtil.roundAndPad(${motdir})}DEG ##
|
||||
${mathUtil.round(${motspd})}KT ##
|
||||
#foreach(${eventCoord} in ${eventLocation})
|
||||
#llFormat(${eventCoord.y}) #llFormat(${eventCoord.x}) ##
|
||||
|
|
|
@ -296,6 +296,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -256,6 +256,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -290,6 +290,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -336,6 +336,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -321,6 +321,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -267,6 +267,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -306,6 +306,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -349,6 +349,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -167,7 +167,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
|
|||
|
||||
TIME...MOT...LOC ##
|
||||
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
|
||||
${mathUtil.round(${movementDirection})}DEG ##
|
||||
${mathUtil.roundAndPad(${movementDirection})}DEG ##
|
||||
${mathUtil.round(${movementInKnots})}KT ##
|
||||
#foreach(${eventCoord} in ${eventLocation})
|
||||
#llFormat(${eventCoord.y}) #llFormat(${eventCoord.x}) ##
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#################
|
||||
################################################################
|
||||
## EXTREME WIND WARNING TEMPLATE ##
|
||||
## (SLIGHTLY) MODIFIED BY TOM BIRCHARD - WFO HFO ##
|
||||
############################################################################
|
||||
## EXTREME WIND WARNING TEMPLATE ##
|
||||
## (SLIGHTLY) MODIFIED BY TOM BIRCHARD - WFO HFO ##
|
||||
## VERSION AWIPS II 1.0 -- 15-APRIL-2011
|
||||
## MODIFIED EVAN BOOKBINDER 09-16-2011 OB11.0.8-8 ##
|
||||
## EVAN BOOKBINDER WFO EAX 11-04-2011 OB11.9-3 (DRs) ##
|
||||
## ##
|
||||
##################################################################
|
||||
## MODIFIED EVAN BOOKBINDER 09-16-2011 OB11.0.8-8 ##
|
||||
## EVAN BOOKBINDER WFO EAX 11-04-2011 OB11.9-3 (DRs) ##
|
||||
## QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
|
||||
## ##
|
||||
############################################################################
|
||||
## EWW PRODUCT ##
|
||||
#################
|
||||
##
|
||||
|
@ -188,7 +189,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
|
|||
|
||||
TIME...MOT...LOC ##
|
||||
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
|
||||
${mathUtil.round(${movementDirection})}DEG ##
|
||||
${mathUtil.roundAndPad(${movementDirection})}DEG ##
|
||||
${mathUtil.round(${movementInKnots})}KT ##
|
||||
#foreach(${eventCoord} in ${eventLocation})
|
||||
#llFormat(${eventCoord.y}) #llFormat(${eventCoord.x}) ##
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
## EWW SVS ##
|
||||
## MODIFIED EVAN BOOKBINDER 09-16-2011 OB11.0.8-8
|
||||
## Evan Bookbinder 4-25-2012 for OB 12.3.1 (corText)
|
||||
## QINGLU LIN 7-31-2012 DR 15217 use roundAndPad
|
||||
################################################
|
||||
##
|
||||
### CREATE PHRASING DEPENDING ON WHETHER WE ISSUE EXP PRIOR TO EXPIRATION TIME OR NOT
|
||||
|
@ -336,7 +337,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
|
|||
|
||||
TIME...MOT...LOC ##
|
||||
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
|
||||
${mathUtil.round(${movementDirection})}DEG ##
|
||||
${mathUtil.roundAndPad(${movementDirection})}DEG ##
|
||||
${mathUtil.round(${movementInKnots})}KT ##
|
||||
#foreach(${eventCoord} in ${eventLocation})
|
||||
#llFormat(${eventCoord.y}) #llFormat(${eventCoord.x}) ##
|
||||
|
@ -487,7 +488,7 @@ LAT...LON ##
|
|||
|
||||
TIME...MOT...LOC ##
|
||||
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
|
||||
${mathUtil.round(${movementDirection})}DEG ##
|
||||
${mathUtil.roundAndPad(${movementDirection})}DEG ##
|
||||
${mathUtil.round(${movementInKnots})}KT ##
|
||||
#foreach(${eventCoord} in ${eventLocation})
|
||||
#llFormat(${eventCoord.y}) #llFormat(${eventCoord.x}) ##
|
||||
|
|
|
@ -338,6 +338,7 @@ ALTHOUGH IT SERVES NO PURPOSE HERE, IT WILL CRASH WARNGEN IF REMOVED -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -311,6 +311,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -269,6 +269,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -275,6 +275,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -304,6 +304,7 @@ and place into this template -->
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
## VERSION AWIPS II 1.0 -- 2-21-2012 OB12.1.1-1 ##
|
||||
## VERSION AWIPS II 1.1 -- 2-29-2012 OB12.2.1-4 ##
|
||||
## VERSION AWIPS II 1.2 -- 4-20-2012 ##
|
||||
## BY QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
|
||||
################################################################
|
||||
##
|
||||
##SET SOME INITIAL VARIABLES
|
||||
|
@ -656,7 +657,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
|
|||
|
||||
TIME...MOT...LOC ##
|
||||
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
|
||||
${mathUtil.round(${movementDirection})}DEG ##
|
||||
${mathUtil.roundAndPad(${movementDirection})}DEG ##
|
||||
${mathUtil.round(${movementInKnots})}KT ##
|
||||
#foreach(${eventCoord} in ${eventLocation})
|
||||
#llFormat(${eventCoord.y}) #llFormat(${eventCoord.x}) ##
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
## VERSION AWIPS II 1.0 -- 2-21-2012 OB12.1.1-1 ##
|
||||
## VERSION AWIPS II 1.1 -- 2-29-2012 OB12.2.1-4 ##
|
||||
## VERSION AWIPS II 1.2 -- 4-20-2012 ##
|
||||
## BY QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
|
||||
################################################################
|
||||
##
|
||||
###################################################################
|
||||
|
@ -302,7 +303,7 @@ REMEMBER...A TORNADO WARNING STILL REMAINS IN EFFECT FOR !** PORTION AND COUNTY
|
|||
|
||||
TIME...MOT...LOC ##
|
||||
${dateUtil.format(${now}, ${timeFormat.time})}Z ##
|
||||
${mathUtil.round(${movementDirection})}DEG ##
|
||||
${mathUtil.roundAndPad(${movementDirection})}DEG ##
|
||||
${mathUtil.round(${movementInKnots})}KT ##
|
||||
#foreach(${eventCoord} in ${eventLocation})
|
||||
#llFormat(${eventCoord.y}) #llFormat(${eventCoord.x}) ##
|
||||
|
@ -1161,7 +1162,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
|
|||
|
||||
TIME...MOT...LOC ##
|
||||
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
|
||||
${mathUtil.round(${movementDirection})}DEG ##
|
||||
${mathUtil.roundAndPad(${movementDirection})}DEG ##
|
||||
${mathUtil.round(${movementInKnots})}KT ##
|
||||
#foreach(${eventCoord} in ${eventLocation})
|
||||
#llFormat(${eventCoord.y}) #llFormat(${eventCoord.x}) ##
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
## VERSION AWIPS II 1.0 -- 2-21-2012 OB12.1.1-1 ##
|
||||
## VERSION AWIPS II 1.1 -- 2-29-2012 OB12.2.1-4 ##
|
||||
## VERSION AWIPS II 1.2 -- 4-20-2012 ##
|
||||
## BY QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
|
||||
################################################################
|
||||
## ESTABLISH SOME INITIAL VARIABLES
|
||||
#set ($preAmble = "")
|
||||
|
@ -627,7 +628,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
|
|||
|
||||
TIME...MOT...LOC ##
|
||||
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
|
||||
${mathUtil.round(${movementDirection})}DEG ##
|
||||
${mathUtil.roundAndPad(${movementDirection})}DEG ##
|
||||
${mathUtil.round(${movementInKnots})}KT ##
|
||||
#foreach(${eventCoord} in ${eventLocation})
|
||||
#llFormat(${eventCoord.y}) #llFormat(${eventCoord.x}) ##
|
||||
|
|
|
@ -369,6 +369,7 @@ and place into this template
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -396,6 +396,7 @@ and place into this template
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -398,6 +398,7 @@ and place into this template
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -368,6 +368,7 @@ and place into this template
|
|||
|
||||
<pointSource variable="riverdrainages">
|
||||
<pointSource>ffmp_basins</pointSource>
|
||||
<geometryDecimationTolerance>0.064</geometryDecimationTolerance>
|
||||
<pointField>streamname</pointField>
|
||||
<filter>
|
||||
<mapping key="cwa">
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
## 11-04-2011 OB11.9-3 (DRs) ##
|
||||
## 2-24-2012 OB12.2.1 CLEANUP ##
|
||||
## BY QINGLU LIN 6-18-2012 DR 15043 use duration ##
|
||||
## BY QINGLU LIN 7-31-2012 DR 15217 use roundAndPad ##
|
||||
################################################################
|
||||
##
|
||||
##SET SOME INITIAL VARIABLES
|
||||
|
@ -475,7 +476,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE.
|
|||
|
||||
TIME...MOT...LOC ##
|
||||
${dateUtil.format(${event}, ${timeFormat.time})}Z ##
|
||||
${mathUtil.round(${movementDirection})}DEG ##
|
||||
${mathUtil.roundAndPad(${movementDirection})}DEG ##
|
||||
${mathUtil.round(${movementInKnots})}KT ##
|
||||
#foreach(${eventCoord} in ${eventLocation})
|
||||
#llFormat(${eventCoord.y}) #llFormat(${eventCoord.x}) ##
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue