12.3.1-10 baseline
Former-commit-id:4068f5295f
[formerly 7d62bca046401a670ef7bd917cbcbb073e061b60] Former-commit-id:22bd792cd9
This commit is contained in:
parent
6884520750
commit
ce3b74c605
208 changed files with 10195 additions and 3681 deletions
|
@ -62,6 +62,7 @@
|
|||
<color r = "0.549019607843" g = "0.541176470588" b = "0.541176470588" a = "1.0" />
|
||||
<color r = "0.698039215686" g = "0.749019607843" b = "0.788235294118" a = "1.0" />
|
||||
<color r = "0.760784313725" g = "0.360784313725" b = "0.36862745098" a = "1.0" />
|
||||
<color r = "0.929411764706" g = "0.752941176471" b = "0.36862745098" a = "1.0" />
|
||||
<color r = "0.929411764706" g = "0.427450980392" b = "0.729411764706" a = "1.0" />
|
||||
<color r = "0.874509803922" g = "0.325490196078" b = "0.674509803922" a = "1.0" />
|
||||
<color r = "0.760784313725" g = "0.141176470588" b = "0.533333333333" a = "1.0" />
|
||||
|
|
|
@ -1050,6 +1050,7 @@ Hazards_commonValues = [ \
|
|||
"Advisories|Winter Weather|WW.Y",
|
||||
"Statements|Coastal Flooding|CF.S",
|
||||
"Statements|Coastal Flooding|LS.S",
|
||||
"Statements|Coastal Flooding|RP.S",
|
||||
"Statements|Marine|MA.S",
|
||||
]
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ class Procedure (SmartScript.SmartScript):
|
|||
statMagSums[4]=statMagSums[3]*statMagSums[3]
|
||||
statMagSums[7]=statMagSums[3]*statMagSums[5]
|
||||
for k in xrange(numthresh):
|
||||
statMagSums[8+k]=less(statDirSums[2],magThresholds[k])
|
||||
statMagSums[8+k]=less(statMagSums[2],magThresholds[k])
|
||||
#
|
||||
# Setup place for sums
|
||||
#
|
||||
|
|
|
@ -61,7 +61,7 @@ if siteID == "GUM":
|
|||
'Hydrology' : ["FF.A", "FA.A"],
|
||||
'Fire Weather' : ["FW.A", "FW.W"],
|
||||
'Coastal Flood' : ["CF.S", "LS.S", "CF.Y", "CF.W", "CF.A",
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A"],
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A", "RP.S"],
|
||||
'Non-Precipitation' : ["AF.W", "AF.Y", "AQ.Y", "AS.O", "AS.Y", "DU.Y",
|
||||
"DS.W", "EH.W", "EH.A", "EC.W", "EC.A", "FG.Y", "FZ.W", "FZ.A",
|
||||
"HZ.W", "HZ.A", "ZF.Y", "FR.Y", "HT.Y", "HW.W", "HW.A",
|
||||
|
@ -84,7 +84,7 @@ else:
|
|||
'Fire Weather' : ["FW.A", "FW.W"],
|
||||
'Convective Watches' : ["SV.A", "TO.A"],
|
||||
'Coastal Flood' : ["CF.S", "LS.S", "CF.Y", "CF.W", "CF.A",
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A"],
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A", "RP.S"],
|
||||
'Non-Precipitation' : ["AF.W", "AF.Y", "AQ.Y", "AS.O", "AS.Y", "DU.Y",
|
||||
"DS.W", "EH.W", "EH.A", "EC.W", "EC.A", "FG.Y", "FZ.W", "FZ.A",
|
||||
"HZ.W", "HZ.A", "ZF.Y", "FR.Y", "HT.Y", "HW.W", "HW.A",
|
||||
|
|
|
@ -138,6 +138,7 @@ class CallToActions:
|
|||
"MH.Y": self.ctaMHY,
|
||||
"MS.Y": self.ctaMSY,
|
||||
"RB.Y": self.ctaRBY,
|
||||
"RP.S": self.ctaRPS,
|
||||
"SC.Y": self.ctaSCY,
|
||||
"SE.A": self.ctaSEA,
|
||||
"SE.W": self.ctaSEW,
|
||||
|
@ -504,6 +505,14 @@ LISTEN TO NOAA WEATHER RADIO OR LOCAL MEDIA FOR FURTHER INFORMATION.""",
|
|||
"""A SMALL CRAFT ADVISORY FOR ROUGH BAR MEANS THAT WAVE CONDITIONS ARE EXPECTED TO BE HAZARDOUS TO SMALL CRAFT IN OR NEAR HARBOR ENTRANCES.""",
|
||||
]
|
||||
|
||||
def ctaRPS(self):
|
||||
return [
|
||||
"""THERE IS A HIGH RISK OF RIP CURRENTS.
|
||||
|
||||
RIP CURRENTS ARE POWERFUL CHANNELS OF WATER FLOWING QUICKLY AWAY FROM SHORE...WHICH OCCUR MOST OFTEN AT LOW SPOTS OR BREAKS IN THE SANDBAR AND IN THE VICINITY OF STRUCTURES SUCH AS GROINS...JETTIES AND PIERS. HEED THE ADVICE OF LIFEGUARDS AND THE BEACH PATROL. PAY ATTENTION TO FLAGS AND POSTED SIGNS.
|
||||
|
||||
IF YOU BECOME CAUGHT IN A RIP CURRENT...DO NOT PANIC. REMAIN CALM AND BEGIN TO SWIM PARALLEL TO SHORE. ONCE YOU ARE AWAY FROM THE FORCE OF THE RIP CURRENT...BEGIN TO SWIM BACK TO THE BEACH. DO NOT ATTEMPT TO SWIM DIRECTLY AGAINST A RIP CURRENT. EVEN A STRONG SWIMMER CAN BECOME EXHAUSTED QUICKLY.""",
|
||||
]
|
||||
def ctaSCY(self):
|
||||
return [
|
||||
"""A SMALL CRAFT ADVISORY MEANS THAT WIND SPEEDS OF 21 TO 33 KNOTS ARE EXPECTED TO PRODUCE HAZARDOUS WAVE CONDITIONS TO SMALL CRAFT. INEXPERIENCED MARINERS...ESPECIALLY THOSE OPERATING SMALLER VESSELS SHOULD AVOID NAVIGATING IN THESE CONDITIONS.""",
|
||||
|
|
|
@ -431,13 +431,13 @@ class SAF_Overrides:
|
|||
"PrePunctuation": "",
|
||||
"PostPunctuation": ", ",
|
||||
"Weekday" : {
|
||||
0 : "Sunday",
|
||||
1 : "Monday",
|
||||
2 : "Tuesday",
|
||||
3 : "Wednesday",
|
||||
4 : "Thursday",
|
||||
5 : "Friday",
|
||||
6 : "Saturday"
|
||||
6 : "Sunday",
|
||||
0 : "Monday",
|
||||
1 : "Tuesday",
|
||||
2 : "Wednesday",
|
||||
3 : "Thursday",
|
||||
4 : "Friday",
|
||||
5 : "Saturday"
|
||||
},
|
||||
"Now": "Now",
|
||||
"Today":"Today",
|
||||
|
|
|
@ -156,7 +156,7 @@ class BOIVerifyUtility(SmartScript.SmartScript):
|
|||
#
|
||||
# Setup DEBUG level
|
||||
#
|
||||
self.DEBUG=10
|
||||
self.DEBUG=0
|
||||
#
|
||||
# Setup Observed file info
|
||||
#
|
||||
|
|
|
@ -17,6 +17,13 @@
|
|||
|
||||
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
|
||||
further_licensing_information.
|
||||
|
||||
SOFTWARE HISTORY
|
||||
|
||||
Date Ticket# Engineer Description
|
||||
__________________________________________________________________________
|
||||
02/28/2012 14536 Xiaochuan Changed DefaultRank to default
|
||||
|
||||
-->
|
||||
<ScanConfigMesoTable>
|
||||
<LinkToFrame>false</LinkToFrame>
|
||||
|
@ -24,7 +31,7 @@
|
|||
<TipsOption>false</TipsOption>
|
||||
<FilterOption>false</FilterOption>
|
||||
<ZoomFactor>4</ZoomFactor>
|
||||
<DefaultRank>mdaSR</DefaultRank>
|
||||
<DefaultRank>default</DefaultRank>
|
||||
|
||||
<!--
|
||||
MESO Table attributes
|
||||
|
|
|
@ -20,9 +20,12 @@
|
|||
|
||||
SOFTWARE HISTORY
|
||||
|
||||
Date Ticket# Engineer Description
|
||||
Date Ticket# Engineer Description
|
||||
__________________________________________________________________________
|
||||
Dec 28, 2011 14230 mgamazay Changed DefaultRank to ident
|
||||
Dec 28, 2011 14230 mgamazay Changed DefaultRank to ident
|
||||
|
||||
02/28/2012 14538 Xiaochuan Changed DefaultRank to default
|
||||
|
||||
-->
|
||||
<ScanConfigTvsTable>
|
||||
<LinkToFrame>false</LinkToFrame>
|
||||
|
@ -30,7 +33,7 @@
|
|||
<TipsOption>false</TipsOption>
|
||||
<FilterOption>false</FilterOption>
|
||||
<ZoomFactor>4</ZoomFactor>
|
||||
<DefaultRank>ident</DefaultRank>
|
||||
<DefaultRank>default</DefaultRank>
|
||||
|
||||
<!--
|
||||
TVS Table attributes
|
||||
|
|
|
@ -34,7 +34,7 @@ import com.raytheon.uf.common.datastorage.records.IntegerDataRecord;
|
|||
import com.raytheon.uf.common.datastorage.records.LongDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.ShortDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.StringDataRecord;
|
||||
import com.raytheon.uf.common.python.PythonScript;
|
||||
import com.raytheon.uf.common.python.PythonInterpreter;
|
||||
import com.raytheon.uf.viz.derivparam.library.DerivedParameterRequest;
|
||||
import com.raytheon.uf.viz.derivparam.tree.CubeLevel;
|
||||
|
||||
|
@ -55,7 +55,9 @@ import com.raytheon.uf.viz.derivparam.tree.CubeLevel;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MasterDerivScript extends PythonScript {
|
||||
public class MasterDerivScript extends PythonInterpreter {
|
||||
|
||||
protected static final String RESULT = "__result";
|
||||
|
||||
private static final String DATA_NAME = "Data";
|
||||
|
||||
|
@ -116,21 +118,13 @@ public class MasterDerivScript extends PythonScript {
|
|||
jep.eval(functionCall.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(String methodName, Map<String, Object> args) {
|
||||
// TODO maybe refactor architecture so all python scripts
|
||||
// have a master controller and execute becomes obsolete
|
||||
throw new UnsupportedOperationException(
|
||||
"For derived parameters, use executeScript() instead.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void evaluateArgument(String argName, Object argValue)
|
||||
throws JepException {
|
||||
if (prevArgs.containsKey(argValue)) {
|
||||
jep.eval(argName + " = " + prevArgs.get(argValue));
|
||||
} else if (argValue instanceof List) {
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
List valList = (List) argValue;
|
||||
Object val = valList.get(0);
|
||||
if (val instanceof CubeLevel) {
|
||||
|
@ -261,7 +255,6 @@ public class MasterDerivScript extends PythonScript {
|
|||
/**
|
||||
* Retrieves the result of the method execution
|
||||
*/
|
||||
@Override
|
||||
protected List<?> getExecutionResult() throws JepException {
|
||||
// Retrieve the results and return them
|
||||
List<IDataRecord> result = null;
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 28, 2009 3963 dhladky Initial creation.
|
||||
* March 5, 2012 14413 zhao Launch AreaConfigDlg w/o monitor
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,12 +52,12 @@ public class SafeseasAreaConfigAction extends AbstractHandler {
|
|||
|
||||
System.out.println("Activating/Action the Safeseas Area Config...");
|
||||
|
||||
SafeSeasMonitor monitor = SafeSeasMonitor.getInstance();
|
||||
//SafeSeasMonitor monitor = SafeSeasMonitor.getInstance();
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
monitor.launchDialog("area", shell);
|
||||
//monitor.launchDialog("area", shell);
|
||||
|
||||
//SSMonitoringAreaConfigDlg configDlg= new SSMonitoringAreaConfigDlg(shell, "Safe Seas Monitor Area Configuration");
|
||||
//configDlg.open();
|
||||
SSMonitoringAreaConfigDlg configDlg= new SSMonitoringAreaConfigDlg(shell, "Safe Seas Monitor Area Configuration");
|
||||
configDlg.open();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -23,12 +23,12 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.scan.data.ScanTableData;
|
||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
|
||||
|
@ -48,6 +48,8 @@ import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 2, 2010 mnash Initial creation
|
||||
*
|
||||
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
|
@ -74,11 +76,7 @@ public class SCANAlarmAlertManager {
|
|||
|
||||
private HashMap<String, HashMap<ScanTables, List<ScheduledAlarms>>> scheduledAlarmsMap;
|
||||
|
||||
private HashMap<String, HashMap<ScanTables, List<AlertedAlarms>>> alertedAlarmsMap;
|
||||
|
||||
private HashMap<String, HashMap<ScanTables, boolean[][]>> indicesMap;
|
||||
|
||||
private HashMap<String, HashMap<ScanTables, List<Point>>> toReset;
|
||||
private HashMap<String, HashMap<ScanTables, Set<AlertedAlarms>>> alertedAlarmsMap;
|
||||
|
||||
private HashMap<String, HashMap<ScanTables, List<String>>> idents;
|
||||
|
||||
|
@ -109,24 +107,12 @@ public class SCANAlarmAlertManager {
|
|||
}
|
||||
|
||||
if (!alertedAlarmsMap.containsKey(site)) {
|
||||
HashMap<ScanTables, List<AlertedAlarms>> siteAlertedAlarmsMap = new HashMap<ScanTables, List<AlertedAlarms>>();
|
||||
siteAlertedAlarmsMap.put(ScanTables.DMD,
|
||||
new CopyOnWriteArrayList<AlertedAlarms>());
|
||||
siteAlertedAlarmsMap.put(ScanTables.CELL,
|
||||
new CopyOnWriteArrayList<AlertedAlarms>());
|
||||
alertedAlarmsMap.put(site, siteAlertedAlarmsMap);
|
||||
}
|
||||
|
||||
if (!indicesMap.containsKey(site)) {
|
||||
HashMap<ScanTables, boolean[][]> siteIndicesMap = new HashMap<ScanTables, boolean[][]>();
|
||||
indicesMap.put(site, siteIndicesMap);
|
||||
}
|
||||
|
||||
if (!toReset.containsKey(site)) {
|
||||
HashMap<ScanTables, List<Point>> siteToReset = new HashMap<ScanTables, List<Point>>();
|
||||
siteToReset.put(ScanTables.CELL, new ArrayList<Point>());
|
||||
siteToReset.put(ScanTables.DMD, new ArrayList<Point>());
|
||||
toReset.put(site, siteToReset);
|
||||
HashMap<ScanTables, Set<AlertedAlarms>> siteAlertedAlarmsSet = new HashMap<ScanTables, Set<AlertedAlarms>>();
|
||||
siteAlertedAlarmsSet.put(ScanTables.DMD,
|
||||
new HashSet<AlertedAlarms>());
|
||||
siteAlertedAlarmsSet.put(ScanTables.CELL,
|
||||
new HashSet<AlertedAlarms>());
|
||||
alertedAlarmsMap.put(site, siteAlertedAlarmsSet);
|
||||
}
|
||||
|
||||
if (!idents.containsKey(site)) {
|
||||
|
@ -144,15 +130,7 @@ public class SCANAlarmAlertManager {
|
|||
}
|
||||
|
||||
if (alertedAlarmsMap == null) {
|
||||
alertedAlarmsMap = new HashMap<String, HashMap<ScanTables, List<AlertedAlarms>>>();
|
||||
}
|
||||
|
||||
if (indicesMap == null) {
|
||||
indicesMap = new HashMap<String, HashMap<ScanTables, boolean[][]>>();
|
||||
}
|
||||
|
||||
if (toReset == null) {
|
||||
toReset = new HashMap<String, HashMap<ScanTables, List<Point>>>();
|
||||
alertedAlarmsMap = new HashMap<String, HashMap<ScanTables, Set<AlertedAlarms>>>();
|
||||
}
|
||||
|
||||
if (idents == null) {
|
||||
|
@ -169,7 +147,7 @@ public class SCANAlarmAlertManager {
|
|||
* @param sdg
|
||||
*/
|
||||
public void calculateScanCells(SCANTableData data, ScanTables tableType,
|
||||
ScanDataGenerator sdg) {
|
||||
ScanDataGenerator sdg, Date latestTime) {
|
||||
int colLength = 0;
|
||||
if (tableType == ScanTables.CELL) {
|
||||
colLength = SCANConfigEnums.CELLTable.values().length;
|
||||
|
@ -178,12 +156,8 @@ public class SCANAlarmAlertManager {
|
|||
}
|
||||
|
||||
String site = sdg.getSite();
|
||||
clearAlertedAlarms(site, tableType);
|
||||
clearOldAlarms(site, tableType, latestTime);
|
||||
|
||||
if (tableType == ScanTables.CELL || tableType == ScanTables.DMD) {
|
||||
indicesMap.get(sdg.getSite()).put(tableType,
|
||||
new boolean[data.getTableRows().size()][colLength]);
|
||||
}
|
||||
SCANConfig config = SCANConfig.getInstance();
|
||||
|
||||
for (ScheduledAlarms alarm : scheduledAlarmsMap.get(site)
|
||||
|
@ -219,15 +193,13 @@ public class SCANAlarmAlertManager {
|
|||
if (valCompare) {
|
||||
addAlertedAlarm(site, tableType, scanData
|
||||
.getTableCellData(0).getCellText(),
|
||||
alarm.colName, AlarmType.AbsVal, row, index);
|
||||
indicesMap.get(site).get(tableType)[row][index] = true;
|
||||
} else if (indicesMap.get(site).get(tableType)[row][index] != true) {
|
||||
indicesMap.get(site).get(tableType)[row][index] = false;
|
||||
alarm.colName, AlarmType.AbsVal, row,
|
||||
index, latestTime);
|
||||
}
|
||||
row++;
|
||||
}
|
||||
} else if (tableType != ScanTables.DMD
|
||||
&& alarm.type == AlarmType.RateOfChange) {
|
||||
} else if ((tableType != ScanTables.DMD)
|
||||
&& (alarm.type == AlarmType.RateOfChange)) {
|
||||
ScanMonitor monitor = ScanMonitor.getInstance();
|
||||
|
||||
if (monitor.cellData != null) {
|
||||
|
@ -245,7 +217,7 @@ public class SCANAlarmAlertManager {
|
|||
.getTableData(tableType, site, previous);
|
||||
getScanTableDiff(data, tableDataPrev,
|
||||
tableType, colLength, sdg, alarm,
|
||||
config);
|
||||
config, latestTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +239,8 @@ public class SCANAlarmAlertManager {
|
|||
*/
|
||||
public void getScanTableDiff(SCANTableData data,
|
||||
ScanTableData<?> otherData, ScanTables tableType, int length,
|
||||
ScanDataGenerator sdg, ScheduledAlarms alarm, SCANConfig config) {
|
||||
ScanDataGenerator sdg, ScheduledAlarms alarm, SCANConfig config,
|
||||
Date latestTime) {
|
||||
SCANTableData scanOtherData = null;
|
||||
if (tableType == ScanTables.CELL) {
|
||||
scanOtherData = sdg.generateCellData(otherData);
|
||||
|
@ -326,18 +299,9 @@ public class SCANAlarmAlertManager {
|
|||
// add alarm
|
||||
addAlertedAlarm(site, tableType,
|
||||
currentTableCells[0].getCellText(),
|
||||
alarm.colName, alarm.type, row, i);
|
||||
// set the blinkability = true
|
||||
indicesMap.get(site).get(tableType)[row][i] = true;
|
||||
alarm.colName, alarm.type, row, i,
|
||||
latestTime);
|
||||
}
|
||||
// don't want to overwrite any current alarms
|
||||
else if (indicesMap.get(site).get(tableType)[row][i] != true) {
|
||||
indicesMap.get(site).get(tableType)[row][i] = false;
|
||||
}
|
||||
}
|
||||
// don't want to overwrite any current alarms
|
||||
else if (indicesMap.get(site).get(tableType)[row][i] != true) {
|
||||
indicesMap.get(site).get(tableType)[row][i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -346,28 +310,22 @@ public class SCANAlarmAlertManager {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return the indices of blinkable elements (boolean[][])
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean[][] getIndices(String site, ScanTables tableType) {
|
||||
if (indicesMap.get(site).get(tableType) == null) {
|
||||
return new boolean[0][0];
|
||||
}
|
||||
return indicesMap.get(site).get(tableType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the alarm and set the indices to false
|
||||
*
|
||||
* @param alarm
|
||||
*/
|
||||
public void removeAlarm(String site, ScanTables tableType,
|
||||
public void clearAlarm(String site, ScanTables tableType,
|
||||
AlertedAlarms alarm) {
|
||||
alertedAlarmsMap.get(site).get(tableType).remove(alarm);
|
||||
indicesMap.get(site).get(tableType)[alarm.row][alarm.col] = false;
|
||||
toReset.get(site).get(tableType).add(new Point(alarm.row, alarm.col));
|
||||
Set<AlertedAlarms> alarms = alertedAlarmsMap.get(site).get(tableType);
|
||||
for (AlertedAlarms aa: alarms) {
|
||||
if (alarm.ident.equalsIgnoreCase(aa.ident) &&
|
||||
alarm.colName.equalsIgnoreCase(aa.colName) &&
|
||||
(alarm.type == aa.type) && (alarm.row == aa.row)) {
|
||||
aa.cleared = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -384,9 +342,9 @@ public class SCANAlarmAlertManager {
|
|||
for (ScheduledAlarms theAlarm : scheduledAlarmsMap.get(site).get(
|
||||
tableType)) {
|
||||
if (alarm.colName.equals(theAlarm.colName)
|
||||
&& alarm.type == theAlarm.type) {
|
||||
if (alarm.type == AlarmType.RateOfChange
|
||||
&& tableType == ScanTables.DMD) {
|
||||
&& (alarm.type == theAlarm.type)) {
|
||||
if ((alarm.type == AlarmType.RateOfChange)
|
||||
&& (tableType == ScanTables.DMD)) {
|
||||
return;
|
||||
} else {
|
||||
scheduledAlarmsMap.get(site).get(tableType)
|
||||
|
@ -428,9 +386,25 @@ public class SCANAlarmAlertManager {
|
|||
* @param col
|
||||
*/
|
||||
public void addAlertedAlarm(String site, ScanTables tableType,
|
||||
String ident, String colName, AlarmType type, int row, int col) {
|
||||
alertedAlarmsMap.get(site).get(tableType)
|
||||
.add(new AlertedAlarms(ident, colName, type, row, col));
|
||||
String ident, String colName, AlarmType type, int row,
|
||||
int col, Date validTime) {
|
||||
Set<AlertedAlarms> alarms = alertedAlarmsMap.get(site).get(tableType);
|
||||
if (alarms.size() == 0) {
|
||||
alarms.add(new AlertedAlarms(ident, colName, type, row, col, validTime));
|
||||
return;
|
||||
}
|
||||
for (AlertedAlarms alarm: alarms) {
|
||||
if (alarm.ident.equalsIgnoreCase(ident) &&
|
||||
alarm.colName.equalsIgnoreCase(colName) &&
|
||||
(alarm.type == type) && (alarm.row == row)) {
|
||||
if (alarm.cleared) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
alarms.add(new AlertedAlarms(ident, colName, type, row, col, validTime));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -448,15 +422,27 @@ public class SCANAlarmAlertManager {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
public List<AlertedAlarms> getAlertedAlarms(String site,
|
||||
public Set<AlertedAlarms> getAlertedAlarms(String site,
|
||||
ScanTables tableType) {
|
||||
return alertedAlarmsMap.get(site).get(tableType);
|
||||
}
|
||||
|
||||
public int getAlertedAlarmCount(String site,
|
||||
ScanTables tableType) {
|
||||
int count = 0;
|
||||
for (AlertedAlarms alarm: alertedAlarmsMap.get(site).get(tableType)) {
|
||||
if (!alarm.cleared) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public boolean containsAlarm(String site, ScanTables tableType,
|
||||
AlarmType type, String colName, String ident) {
|
||||
for (AlertedAlarms alarm : alertedAlarmsMap.get(site).get(tableType)) {
|
||||
if (ident.equals(alarm.ident) && type == alarm.type
|
||||
if (ident.equals(alarm.ident) && (type == alarm.type)
|
||||
&& colName.equals(alarm.colName)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -464,19 +450,6 @@ public class SCANAlarmAlertManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the points to reset
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<Point> getPointsToReset(String site, ScanTables tableType) {
|
||||
return toReset.get(site).get(tableType);
|
||||
}
|
||||
|
||||
public void clearToReset(String site, ScanTables tableType) {
|
||||
toReset.get(site).get(tableType).clear();
|
||||
}
|
||||
|
||||
public boolean isRing() {
|
||||
return ring;
|
||||
}
|
||||
|
@ -493,18 +466,38 @@ public class SCANAlarmAlertManager {
|
|||
idents.get(site).get(tableType).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove any old alarms
|
||||
*
|
||||
* @param site
|
||||
* @param type
|
||||
*/
|
||||
private void clearOldAlarms(String site, ScanTables type, Date latestTime) {
|
||||
List<AlertedAlarms> clearList = new ArrayList<AlertedAlarms>();
|
||||
for (AlertedAlarms alarm: alertedAlarmsMap.get(site).get(type)) {
|
||||
if (latestTime.getTime() > alarm.validTime.getTime()) {
|
||||
clearList.add(alarm);
|
||||
}
|
||||
}
|
||||
|
||||
for (AlertedAlarms alarm: clearList) {
|
||||
alertedAlarmsMap.get(site).get(type).remove(alarm);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clear the alerted alarms and the indices
|
||||
*/
|
||||
public void clearAlertedAlarms(String site, ScanTables tableType) {
|
||||
for (AlertedAlarms alarm : alertedAlarmsMap.get(site).get(tableType)) {
|
||||
alertedAlarmsMap.get(site).get(tableType).remove(alarm);
|
||||
indicesMap.get(site).get(tableType)[alarm.row][alarm.col] = false;
|
||||
toReset.get(site).get(tableType)
|
||||
.add(new Point(alarm.row, alarm.col));
|
||||
alarm.cleared = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAlertedAlarms(String site, ScanTables tableType) {
|
||||
alertedAlarmsMap.get(site).get(tableType).clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the scheduled alarms
|
||||
*/
|
||||
|
@ -583,14 +576,19 @@ public class SCANAlarmAlertManager {
|
|||
int row;
|
||||
|
||||
int col;
|
||||
|
||||
boolean cleared = false;
|
||||
|
||||
Date validTime;
|
||||
|
||||
public AlertedAlarms(String ident, String colName, AlarmType type,
|
||||
int row, int col) {
|
||||
int row, int col, Date validTime) {
|
||||
this.ident = ident;
|
||||
this.colName = colName;
|
||||
this.type = type;
|
||||
this.row = row;
|
||||
this.col = col;
|
||||
this.validTime = validTime;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -602,7 +600,7 @@ public class SCANAlarmAlertManager {
|
|||
public String toString() {
|
||||
return "Identifier : " + this.ident + "\nColumn : " + this.colName
|
||||
+ "\nType : " + this.type.getName() + "\nRow #: "
|
||||
+ this.row + "\nCol #:" + this.col;
|
||||
+ this.row + "\nCol #:" + this.col + "\nCleared: " + cleared + "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 2, 2010 mnash Initial creation
|
||||
*
|
||||
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
|
@ -81,6 +83,7 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
|
|||
mgr = SCANAlarmAlertManager.getInstance(site);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
if (type == ScanTables.CELL) {
|
||||
setText("Cell Alarms");
|
||||
|
@ -122,50 +125,54 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
|
|||
btnComp.setLayoutData(gd);
|
||||
|
||||
for (final AlertedAlarms alarm : mgr.getAlertedAlarms(site, type)) {
|
||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
||||
final Button btn = new Button(btnComp, SWT.PUSH);
|
||||
btn.setText(alarm.ident + " --> " + alarm.colName + " "
|
||||
+ alarm.type.getName());
|
||||
btn.setData("ident", alarm.ident);
|
||||
btn.setData("attr", alarm.colName);
|
||||
btn.setLayoutData(gd);
|
||||
btn.setBackground(Display.getDefault()
|
||||
.getSystemColor(SWT.COLOR_RED));
|
||||
btn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
String ident = btn.getData("ident").toString();
|
||||
String attr = btn.getData("attr").toString();
|
||||
// get instance of the table dialog to use for the functions
|
||||
AbstractTableDlg tableDlg = ScanMonitor.getInstance()
|
||||
.getDialog(type, site);
|
||||
// display the trend graph dialogs
|
||||
if (tableDlg instanceof SCANCellTableDlg) {
|
||||
((SCANCellTableDlg) tableDlg).getScanTableComp()
|
||||
.displayTrendGraphDialog(ident, attr);
|
||||
} else if (tableDlg instanceof SCANDmdTableDlg) {
|
||||
((SCANDmdTableDlg) tableDlg).getScanTableComp()
|
||||
.displayTrendGraphDialog(ident, attr);
|
||||
if (alarm.cleared == false) {
|
||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
||||
final Button btn = new Button(btnComp, SWT.PUSH);
|
||||
btn.setText(alarm.ident + " --> " + alarm.colName + " "
|
||||
+ alarm.type.getName());
|
||||
btn.setData("ident", alarm.ident);
|
||||
btn.setData("attr", alarm.colName);
|
||||
btn.setLayoutData(gd);
|
||||
btn.setBackground(Display.getDefault()
|
||||
.getSystemColor(SWT.COLOR_RED));
|
||||
btn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
String ident = btn.getData("ident").toString();
|
||||
String attr = btn.getData("attr").toString();
|
||||
// get instance of the table dialog to use for the functions
|
||||
AbstractTableDlg tableDlg = ScanMonitor.getInstance()
|
||||
.getDialog(type, site);
|
||||
// display the trend graph dialogs
|
||||
if (tableDlg instanceof SCANCellTableDlg) {
|
||||
((SCANCellTableDlg) tableDlg).getScanTableComp()
|
||||
.displayTrendGraphDialog(ident, attr);
|
||||
} else if (tableDlg instanceof SCANDmdTableDlg) {
|
||||
((SCANDmdTableDlg) tableDlg).getScanTableComp()
|
||||
.displayTrendGraphDialog(ident, attr);
|
||||
}
|
||||
// recenter the map on the ident
|
||||
tableDlg.fireRecenter(ident, type, site);
|
||||
// highlight the correct row
|
||||
// TODO highlight the row
|
||||
|
||||
if (tableDlg instanceof SCANDmdTableDlg) {
|
||||
((SCANDmdTableDlg) tableDlg).alarmSelection(ident);
|
||||
}
|
||||
|
||||
tableDlg.mgr.clearAlarm(site, type, alarm);
|
||||
clearAllBtn.setText("Clear All "
|
||||
+ mgr.getAlertedAlarms(site, type).size()
|
||||
+ " Alarms");
|
||||
// remove the btn
|
||||
btn.dispose();
|
||||
btnComp.layout();
|
||||
if (mgr.getAlertedAlarms(site, type).size() <= 0) {
|
||||
shell.dispose();
|
||||
}
|
||||
}
|
||||
// recenter the map on the ident
|
||||
tableDlg.fireRecenter(ident, type, site);
|
||||
// highlight the correct row
|
||||
if (tableDlg instanceof SCANDmdTableDlg) {
|
||||
((SCANDmdTableDlg) tableDlg).alarmSelection(ident);
|
||||
}
|
||||
|
||||
tableDlg.mgr.removeAlarm(site, type, alarm);
|
||||
clearAllBtn.setText("Clear All "
|
||||
+ mgr.getAlertedAlarms(site, type).size()
|
||||
+ " Alarms");
|
||||
// remove the btn
|
||||
btn.dispose();
|
||||
btnComp.layout();
|
||||
if (mgr.getAlertedAlarms(site, type).size() <= 0) {
|
||||
shell.dispose();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
btnComp.layout();
|
||||
|
@ -174,6 +181,7 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
|
|||
sc.setExpandHorizontal(true);
|
||||
sc.setExpandVertical(true);
|
||||
sc.addControlListener(new ControlAdapter() {
|
||||
@Override
|
||||
public void controlResized(ControlEvent e) {
|
||||
Rectangle r = sc.getClientArea();
|
||||
sc.setMinSize(btnComp.computeSize(r.width, SWT.DEFAULT));
|
||||
|
@ -186,8 +194,13 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
|
|||
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
gd.widthHint = buttonWidth + 30;
|
||||
clearAllBtn = new Button(shell, SWT.PUSH);
|
||||
clearAllBtn.setText("Clear All "
|
||||
+ mgr.getAlertedAlarms(site, type).size() + " Alarms");
|
||||
int numAlarms = 0;
|
||||
for (AlertedAlarms alarm: mgr.getAlertedAlarms(site, type)) {
|
||||
if (alarm.cleared == false) {
|
||||
numAlarms++;
|
||||
}
|
||||
}
|
||||
clearAllBtn.setText("Clear All " + numAlarms + " Alarms");
|
||||
clearAllBtn.setBackground(Display.getDefault().getSystemColor(
|
||||
SWT.COLOR_RED));
|
||||
clearAllBtn.setLayoutData(gd);
|
||||
|
|
|
@ -73,6 +73,7 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.StormCellIdDisplayDlg;
|
|||
import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator;
|
||||
import com.raytheon.uf.viz.monitor.scan.data.UnwarnedCell;
|
||||
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlarmType;
|
||||
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlertedAlarms;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
|
||||
/**
|
||||
|
@ -85,6 +86,8 @@ import com.raytheon.viz.ui.EditorUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 21, 2009 #3039 lvenable Initial creation
|
||||
*
|
||||
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -471,7 +474,7 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
|
|||
alarmDlg = new SCANAlarmsDlg(shell, ScanTables.CELL, site);
|
||||
alarmDlg.open();
|
||||
if (!alarmBtn.isDisposed()
|
||||
&& mgr.getAlertedAlarms(site, scanTable).isEmpty()) {
|
||||
&& (mgr.getAlertedAlarmCount(site, scanTable) == 0)) {
|
||||
alarmBtn.setVisible(false);
|
||||
mgr.setRing(false);
|
||||
}
|
||||
|
@ -1174,17 +1177,14 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
|
|||
@Override
|
||||
public void notify(IMonitorEvent me) {
|
||||
if (me.getSource() instanceof IMonitor) {
|
||||
|
||||
ScanMonitor scan = (ScanMonitor) me.getSource();
|
||||
Date time = null;
|
||||
try {
|
||||
if (getLinkToFrame(scanTable.name())) {
|
||||
time = scan.getScanTime(scanTable, site);
|
||||
} else {
|
||||
|
||||
time = scan.getMostRecent(scan, scanTable.name(), site)
|
||||
.getRefTime();
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
@ -1231,7 +1231,7 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
|
|||
scanMostRecentTime = scan.getMostRecent(scan,
|
||||
scanTable.name(), site).getRefTime();
|
||||
} catch (NullPointerException npe) {
|
||||
// scan has beenn turned off
|
||||
// scan has been turned off
|
||||
}
|
||||
|
||||
if (scanMostRecentTime != null) {
|
||||
|
@ -1245,21 +1245,25 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
|
|||
&& !(EditorUtil.getActiveVizContainer()
|
||||
.getLoopProperties().isLooping())
|
||||
&& (mgr.getScheduledAlarms(site, scanTable).size() > 0)
|
||||
|
||||
&& currentTime.equals(scanMostRecentTime)
|
||||
|
||||
&& !scanCfg.getAlarmsDisabled(scanTable)) {
|
||||
mgr.clearAlertedAlarms(site, scanTable);
|
||||
mgr.clearToReset(site, scanTable);
|
||||
scanTableComp.checkBlink(sdg);
|
||||
scanTableComp.checkBlink(sdg, scanMostRecentTime);
|
||||
if (mgr.getAlertedAlarms(site, scanTable).size() > 0) {
|
||||
alarmBtn.setVisible(true);
|
||||
boolean displayAlarmBtn = false;
|
||||
for (AlertedAlarms alarm: mgr.getAlertedAlarms(site, scanTable)) {
|
||||
if (!alarm.cleared) {
|
||||
displayAlarmBtn = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
alarmBtn.setVisible(displayAlarmBtn);
|
||||
addAlarmTimer();
|
||||
} else {
|
||||
alarmBtn.setVisible(false);
|
||||
}
|
||||
} else {
|
||||
mgr.clearAlertedAlarms(site, scanTable);
|
||||
mgr.removeAlertedAlarms(site, scanTable);
|
||||
alarmBtn.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,6 +89,8 @@ import com.raytheon.viz.ui.EditorUtil;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 29, 2010 lvenable Initial creation
|
||||
*
|
||||
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -1069,9 +1071,7 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
|
|||
&& currentTime.equals(scan.getMostRecent(scan,
|
||||
scanTable.name(), site).getRefTime())
|
||||
&& !scanCfg.getAlarmsDisabled(scanTable)) {
|
||||
mgr.clearAlertedAlarms(site, scanTable);
|
||||
mgr.clearToReset(site, scanTable);
|
||||
dmdTableComp.checkBlink(sdg);
|
||||
dmdTableComp.checkBlink(sdg, scan.getMostRecent(scan, scanTable.name(), site).getRefTime());
|
||||
if (mgr.getAlertedAlarms(site, scanTable).size() > 0) {
|
||||
alarmBtn.setVisible(true);
|
||||
addAlarmTimer();
|
||||
|
@ -1079,7 +1079,7 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
|
|||
alarmBtn.setVisible(false);
|
||||
}
|
||||
} else {
|
||||
mgr.clearAlertedAlarms(site, scanTable);
|
||||
mgr.removeAlertedAlarms(site, scanTable);
|
||||
alarmBtn.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,8 @@ package com.raytheon.uf.viz.monitor.scan.tables;
|
|||
|
||||
import java.awt.Toolkit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
|
@ -56,7 +57,19 @@ import com.raytheon.uf.common.monitor.data.CommonTableConfig.SortDirection;
|
|||
import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
|
||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanColors;
|
||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
|
||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.TVSTable;
|
||||
import com.raytheon.uf.viz.monitor.scan.ScanMonitor;
|
||||
import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator;
|
||||
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlertedAlarms;
|
||||
|
||||
/* Modification History:
|
||||
* Date Ticket# Name Change
|
||||
* ------------ ---------- ------------ --------------------------
|
||||
* 02/23/2012 14538 Xiaochuan Fix TVS table default rank.
|
||||
*
|
||||
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
|
||||
*
|
||||
*/
|
||||
|
||||
public abstract class SCANTable extends Composite {
|
||||
protected Table table;
|
||||
|
@ -175,7 +188,7 @@ public abstract class SCANTable extends Composite {
|
|||
public void widgetDisposed(DisposeEvent arg0) {
|
||||
if ((scanTable == ScanTables.CELL)
|
||||
|| (scanTable == ScanTables.DMD)) {
|
||||
mgr.clearAlertedAlarms(site, scanTable);
|
||||
mgr.removeAlertedAlarms(site, scanTable);
|
||||
}
|
||||
tiFont.dispose();
|
||||
columnFont.dispose();
|
||||
|
@ -531,12 +544,6 @@ public abstract class SCANTable extends Composite {
|
|||
clearTableSelection();
|
||||
tableData = td;
|
||||
|
||||
// System.out.println("--- scanTable = " + scanTable.name());
|
||||
// System.out.println("--- setting table data in SCANTable");
|
||||
//
|
||||
// System.out.println("tableData.getTableRows().size() = "
|
||||
// + tableData.getTableRows().size());
|
||||
|
||||
if ((tableData == null) || (tableData.getTableRows().size() == 0)) {
|
||||
// System.out.println("*** no data");
|
||||
// table.setEnabled(true);
|
||||
|
@ -622,6 +629,10 @@ public abstract class SCANTable extends Composite {
|
|||
return;
|
||||
}
|
||||
|
||||
if( scanTable == ScanTables.TVS && sortedIndex == -1)
|
||||
{
|
||||
sortedIndex = TVSTable.valueOf("IDENT").ordinal();
|
||||
}
|
||||
// get the ident, if a row is outlined in blue
|
||||
if (tableIndex >= 0) {
|
||||
SCANTableRowData stdr = tableData.getTableRows().get(tableIndex);
|
||||
|
@ -673,9 +684,12 @@ public abstract class SCANTable extends Composite {
|
|||
}
|
||||
|
||||
ScanDataGenerator sdg = new ScanDataGenerator(site);
|
||||
if ((scanTable == ScanTables.CELL) || (scanTable == ScanTables.DMD)
|
||||
&& !mgr.getAlertedAlarms(site, scanTable).isEmpty()) {
|
||||
checkBlink(sdg);
|
||||
if ((scanTable == ScanTables.CELL) || ((scanTable == ScanTables.DMD)
|
||||
&& !mgr.getAlertedAlarms(site, scanTable).isEmpty())) {
|
||||
ScanMonitor monitor = ScanMonitor.getInstance();
|
||||
if (monitor.getMostRecent(monitor, scanTable.name(), site) != null) {
|
||||
checkBlink(sdg, monitor.getMostRecent(monitor, scanTable.name(), site).getRefTime());
|
||||
}
|
||||
}
|
||||
|
||||
// loop thru rows to find ident identified above and set new tableIndex
|
||||
|
@ -704,18 +718,6 @@ public abstract class SCANTable extends Composite {
|
|||
/**
|
||||
* Pack the table columns.
|
||||
*/
|
||||
// private void packColumns() {
|
||||
//
|
||||
// for (int i = 0; i < table.getColumnCount(); i++) {
|
||||
//
|
||||
// System.out.println("tc width = " + table.getColumn(i).getWidth());
|
||||
//
|
||||
// if (table.getColumn(i).getWidth() > 0) {
|
||||
// packSingleColumn(table.getColumn(i), i);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public boolean[] getVisibleColumns() {
|
||||
TableColumn[] tCols = table.getColumns();
|
||||
boolean[] visibleCols = new boolean[tCols.length];
|
||||
|
@ -754,8 +756,6 @@ public abstract class SCANTable extends Composite {
|
|||
// tCols[i].setWidth(table.getColumn(i).getWidth() + 5);
|
||||
tc.setWidth(table.getColumn(index).getWidth() + 2);
|
||||
|
||||
System.out.println("tc.getWidth() = " + tc.getWidth());
|
||||
|
||||
if (tc.getWidth() > defaultColWidth) {
|
||||
tc.setWidth(defaultColWidth);
|
||||
}
|
||||
|
@ -858,9 +858,6 @@ public abstract class SCANTable extends Composite {
|
|||
for (int i = 0; i < rowData.size(); i++) {
|
||||
rowData.get(i).getTableCellData(index).setColor();
|
||||
}
|
||||
if ((scanTable == ScanTables.CELL) || (scanTable == ScanTables.DMD)) {
|
||||
mgr.clearToReset(site, scanTable);
|
||||
}
|
||||
sortTableUsingConfig();
|
||||
}
|
||||
|
||||
|
@ -923,75 +920,7 @@ public abstract class SCANTable extends Composite {
|
|||
public void run() {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
|
||||
// Fail-safe check to determine if the we have
|
||||
// no
|
||||
// data
|
||||
// in the table data.
|
||||
if (timer != null && tableData != null) {
|
||||
|
||||
if (tableData.getTableRows().size() == 0) {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer.purge();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
boolean[][] indices = mgr.getIndices(site,
|
||||
scanTable);
|
||||
if (table.isDisposed()) {
|
||||
timer.cancel();
|
||||
timer.purge();
|
||||
} else {
|
||||
setBlinkColor();
|
||||
boolean allClear = true;
|
||||
// for (int i = 0; i < table.getItemCount();
|
||||
// i++) {
|
||||
for (int i = 0; i < tableData
|
||||
.getNumberOfDataRows(); i++) {
|
||||
TableItem ti = table.getItem(i);
|
||||
if (ti == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i < indices.length) {
|
||||
for (int j = 0; j < indices[i].length; j++) {
|
||||
|
||||
if (indices[i][j] == true) {
|
||||
allClear = false;
|
||||
ti.setBackground(j,
|
||||
blinkColor);
|
||||
|
||||
// handle the beep while
|
||||
// looking at
|
||||
// all the cells
|
||||
if (SCANConfig
|
||||
.getInstance()
|
||||
.getAlarmBell(
|
||||
scanTable)) {
|
||||
mgr.setRing(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
List<Point> points = mgr.getPointsToReset(
|
||||
site, scanTable);
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
updateThresholds(points.get(i).x,
|
||||
points.get(i).y);
|
||||
}
|
||||
points.clear();
|
||||
// checks if there are no more alarms
|
||||
// and then
|
||||
// will cancel the timer
|
||||
if (allClear == true) {
|
||||
timer.cancel();
|
||||
timer.purge();
|
||||
}
|
||||
}
|
||||
}
|
||||
runTimerTask();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1008,7 +937,7 @@ public abstract class SCANTable extends Composite {
|
|||
// Fail-safe check to determine if the we have no
|
||||
// data
|
||||
// in the table data.
|
||||
if (beepTimer != null && tableData != null) {
|
||||
if ((beepTimer != null) && (tableData != null)) {
|
||||
|
||||
if (tableData.getTableRows().size() == 0) {
|
||||
beepTimer.cancel();
|
||||
|
@ -1035,6 +964,75 @@ public abstract class SCANTable extends Composite {
|
|||
}
|
||||
}
|
||||
|
||||
private void runTimerTask() {
|
||||
// Fail-safe check to determine if the we have
|
||||
// no
|
||||
// data
|
||||
// in the table data.
|
||||
if ((timer != null) && (tableData != null)) {
|
||||
if (tableData.getTableRows().size() == 0) {
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer.purge();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (table.isDisposed()) {
|
||||
timer.cancel();
|
||||
timer.purge();
|
||||
} else {
|
||||
setBlinkColor();
|
||||
boolean allClear = true;
|
||||
|
||||
ArrayList<Point> points = new ArrayList<Point>();
|
||||
Set<AlertedAlarms> alarmList = mgr.getAlertedAlarms(site, scanTable);
|
||||
for (int i = 0; i < tableData
|
||||
.getNumberOfDataRows(); i++) {
|
||||
TableItem ti = table.getItem(i);
|
||||
if (ti == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((alarmList != null) && (alarmList.size() > 0)) {
|
||||
for (AlertedAlarms alarm: alarmList) {
|
||||
if (tableData.getTableRows().get(i).getIdent().equals(alarm.ident)) {
|
||||
if (alarm.cleared == false) {
|
||||
ti.setBackground(alarm.col, blinkColor);
|
||||
allClear = false;
|
||||
// handle the beep while
|
||||
// looking at
|
||||
// all the cells
|
||||
if (SCANConfig
|
||||
.getInstance()
|
||||
.getAlarmBell(
|
||||
scanTable)) {
|
||||
mgr.setRing(true);
|
||||
}
|
||||
} else {
|
||||
points.add(new Point(alarm.row, alarm.col));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
updateThresholds(points.get(i).x,
|
||||
points.get(i).y);
|
||||
}
|
||||
|
||||
// checks if there are no more alarms
|
||||
// and then
|
||||
// will cancel the timer
|
||||
if (allClear == true) {
|
||||
timer.cancel();
|
||||
timer.purge();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Timer getBlinkTimer() {
|
||||
if (timer == null) {
|
||||
timer = new Timer();
|
||||
|
@ -1042,9 +1040,9 @@ public abstract class SCANTable extends Composite {
|
|||
return timer;
|
||||
}
|
||||
|
||||
public void checkBlink(ScanDataGenerator sdg) {
|
||||
public void checkBlink(ScanDataGenerator sdg, Date latestTime) {
|
||||
if (!scanCfg.getAlarmsDisabled(scanTable)) {
|
||||
mgr.calculateScanCells(tableData, scanTable, sdg);
|
||||
mgr.calculateScanCells(tableData, scanTable, sdg, latestTime);
|
||||
blinkCells();
|
||||
}
|
||||
}
|
||||
|
@ -1084,6 +1082,7 @@ public abstract class SCANTable extends Composite {
|
|||
|
||||
// Set the background color to the sort color if that column is
|
||||
// sorted.
|
||||
// sortedColumnIndex=-1 is default sort
|
||||
if (sortedColumnIndex == -1) {
|
||||
scanCfg.getDefaultName();
|
||||
String sortColName = scanCfg.getDefaultRank(this.scanTable);
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 28, 2009 3963 dhladky Initial creation.
|
||||
* March 5, 2012 14413 zhao Launch AreaConfigDlg w/o monitor
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,12 +52,12 @@ public class SnowAreaConfigAction extends AbstractHandler {
|
|||
|
||||
System.out.println("Activating/Action the Snow Area Config...");
|
||||
|
||||
SnowMonitor monitor = SnowMonitor.getInstance();
|
||||
//SnowMonitor monitor = SnowMonitor.getInstance();
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
monitor.launchDialog("area", shell);
|
||||
//monitor.launchDialog("area", shell);
|
||||
|
||||
//SnowMonitoringAreaConfigDlg configDlg= new SnowMonitoringAreaConfigDlg(shell, "SNOW Monitor Area Configuration");
|
||||
//configDlg.open();
|
||||
SnowMonitoringAreaConfigDlg configDlg= new SnowMonitoringAreaConfigDlg(shell, "SNOW Monitor Area Configuration");
|
||||
configDlg.open();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -69,6 +69,7 @@ import com.raytheon.uf.viz.monitor.Activator;
|
|||
* Jun 24, 2010 5885/5886 zhao added initZoneStationLists(),
|
||||
* and revised accordingly
|
||||
* Apr 29, 2011 DR#8986 zhao Read in "Counties" instead of "Forecast Zones"
|
||||
* Feb 22, 2012 14413 zhao modified to reduce calls to database
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -250,8 +251,6 @@ public abstract class MonitoringAreaConfigDlg extends Dialog implements INewZone
|
|||
|
||||
private MonitorConfigurationManager configMgr = null;
|
||||
|
||||
private AdjacentWfoMgr adjMgr = null;
|
||||
|
||||
private Mode mode = Mode.Zone;
|
||||
|
||||
protected ArrayList<String> addedZones = new ArrayList<String>();
|
||||
|
@ -316,40 +315,7 @@ public abstract class MonitoringAreaConfigDlg extends Dialog implements INewZone
|
|||
/**
|
||||
* (3) set additional zones in the neighborhood of the monitor area
|
||||
*/
|
||||
additionalZones = adjMgr.getAdjZones();
|
||||
|
||||
// if a zone is already in maZones, remove it from additionalZones
|
||||
for (int i = 0; i < additionalZones.size(); i++) {
|
||||
if (maZones.contains(additionalZones.get(i))) {
|
||||
additionalZones.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
// if a zone (county) is in default monitor area zones but is not
|
||||
// in maZones, it must be added to additional zones
|
||||
try {
|
||||
ArrayList<String> defaultRegularZones = null;
|
||||
if ( SiteMap.getInstance().getSite4LetterId(currentSite).charAt(0) == 'K' ) { // CONUS site
|
||||
defaultRegularZones = MonitorAreaUtils.getUniqueCounties(currentSite);
|
||||
} else {
|
||||
defaultRegularZones = MonitorAreaUtils.getForecastZones(currentSite);
|
||||
}
|
||||
ArrayList<String> defaultMarineZones = MonitorAreaUtils
|
||||
.getMarineZones(currentSite);
|
||||
for (String zone : defaultRegularZones) {
|
||||
if (!maZones.contains(zone)) {
|
||||
additionalZones.add(zone);
|
||||
}
|
||||
}
|
||||
for (String zone : defaultMarineZones) {
|
||||
if (!maZones.contains(zone)) {
|
||||
additionalZones.add(zone);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
additionalZones = configMgr.getAdjacentAreaList(); //adjMgr.getAdjZones();
|
||||
|
||||
Collections.sort(additionalZones);
|
||||
|
||||
|
@ -359,10 +325,8 @@ public abstract class MonitoringAreaConfigDlg extends Dialog implements INewZone
|
|||
additionalStns = new ArrayList<String>();
|
||||
try {
|
||||
for (String zone : additionalZones) {
|
||||
ArrayList<StationIdXML> stnXmls = MonitorAreaUtils
|
||||
.getZoneReportingStationXMLs(zone);
|
||||
for (StationIdXML stnXml : stnXmls) {
|
||||
String stn = stnXml.getName() + "#" + stnXml.getType();
|
||||
ArrayList<String> stns = configMgr.getAdjacentAreaStationsWithType(zone);
|
||||
for (String stn : stns) {
|
||||
if (!additionalStns.contains(stn)) {
|
||||
additionalStns.add(stn);
|
||||
}
|
||||
|
@ -372,14 +336,6 @@ public abstract class MonitoringAreaConfigDlg extends Dialog implements INewZone
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// if a station is in maStations,
|
||||
// remove it from additionalStations
|
||||
for (String station : maStations) {
|
||||
if (additionalStns.contains(station)) {
|
||||
additionalStns.remove(station);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(additionalStns);
|
||||
|
||||
}
|
||||
|
@ -415,7 +371,6 @@ public abstract class MonitoringAreaConfigDlg extends Dialog implements INewZone
|
|||
|
||||
// set configuration and adjacent managers
|
||||
configMgr = getConfigManager();
|
||||
adjMgr = new AdjacentWfoMgr(currentSite);
|
||||
|
||||
// initialize zone/station lists
|
||||
initZoneStationLists();
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
further_licensing_information.
|
||||
-->
|
||||
<CrossSectionRotations>
|
||||
<rotation parameter="Into" mode="VR_COMPONENT_INTO"/>
|
||||
<rotation parameter="Along" mode="VR_COMPONENT_ALONG"/>
|
||||
<rotation parameter="Comp Into" mode="VR_COMPONENT_INTO"/>
|
||||
<rotation parameter="Comp Along" mode="VR_COMPONENT_ALONG"/>
|
||||
<rotation parameter="SNW" mode="VR_SECTION_COORDINATES"/>
|
||||
<rotation parameter="uFX" mode="VR_GEO_MOMENTUM"/>
|
||||
<rotation parameter="vertCirc" mode="VR_VERT_CIRC"/>
|
||||
|
|
|
@ -91,7 +91,8 @@ import com.vividsolutions.jts.geom.LineString;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 4, 2007 njensen Initial creation
|
||||
* 02/17/09 njensen Refactored to new rsc architecture
|
||||
*
|
||||
* 02/27/12 14490 kshresth Fixed cross sections not loading as images
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
|
@ -445,10 +446,10 @@ public abstract class AbstractCrossSectionResource extends
|
|||
if (getCapability(DisplayTypeCapability.class).getDisplayType() == DisplayType.IMAGE) {
|
||||
completeName += " Img";
|
||||
}
|
||||
completeName += " (";
|
||||
completeName += " ( ";
|
||||
|
||||
completeName += getUnitString();
|
||||
completeName += ") ";
|
||||
completeName += " ) ";
|
||||
|
||||
return completeName;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* This class starts AviationDialog as a stand alone component with runtime mode
|
||||
* of ALERT_VIZ.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -65,7 +65,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
|||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Aviation Dialog class.
|
||||
* The Aviation Dialog class that displays the start up menu for AvnFPS.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* This class is a run configuration component to launch the AvnFPS monitor.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -44,9 +44,9 @@ import com.raytheon.viz.avnconfig.TafSiteInfoEditorDlg;
|
|||
import com.raytheon.viz.avnconfig.TextEditorSetupDlg;
|
||||
|
||||
/**
|
||||
* This is the main AvnFPS setup dialog containing the controls to launch the
|
||||
* Text Editor, Monitoring Rules, TAF Site Info, TAF Products, or Triggers
|
||||
* dialog.
|
||||
* This class is the main AvnFPS configuration dialog. It contains the controls
|
||||
* to launch the Text Editor, Monitoring Rules, TAF Site Info, TAF Products, or
|
||||
* Climate Data dialogs.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
|
@ -79,14 +79,29 @@ public class AvnconfigDlg extends Dialog {
|
|||
@SuppressWarnings("unused")
|
||||
private MessageStatusComp msgStatusComp;
|
||||
|
||||
/**
|
||||
* Text Editor dialog.
|
||||
*/
|
||||
private TextEditorSetupDlg editorDlg;
|
||||
|
||||
/**
|
||||
* Monitoring Rules Dialog,
|
||||
*/
|
||||
private MonitoringCriteriaDlg monCriteriaDlg;
|
||||
|
||||
/**
|
||||
* TAF Site Information dialog.
|
||||
*/
|
||||
private TafSiteInfoEditorDlg siteInfoDlg;
|
||||
|
||||
/**
|
||||
* TAF Product dialog.
|
||||
*/
|
||||
private TafProductConfigDlg productsDlg;
|
||||
|
||||
/**
|
||||
* Climate Data dialog.
|
||||
*/
|
||||
private ClimateDataMenuDlg climateDataDlg;
|
||||
|
||||
/**
|
||||
|
@ -100,7 +115,7 @@ public class AvnconfigDlg extends Dialog {
|
|||
}
|
||||
|
||||
/**
|
||||
* Open method used to display the dialog.
|
||||
* Open method used set up components and display the dialog.
|
||||
*
|
||||
* @return Null.
|
||||
*/
|
||||
|
@ -344,19 +359,6 @@ public class AvnconfigDlg extends Dialog {
|
|||
}
|
||||
});
|
||||
|
||||
// The Triggers dialog is no longer needed.
|
||||
// gd = new GridData(buttonWidth, SWT.DEFAULT);
|
||||
// Button triggersBtn = new Button(buttonComp, SWT.PUSH);
|
||||
// triggersBtn.setText("Triggers");
|
||||
// triggersBtn.setLayoutData(gd);
|
||||
// triggersBtn.addSelectionListener(new SelectionAdapter() {
|
||||
// @Override
|
||||
// public void widgetSelected(SelectionEvent event) {
|
||||
// TriggerEditorDlg triggerDlg = new TriggerEditorDlg(shell);
|
||||
// triggerDlg.open();
|
||||
// }
|
||||
// });
|
||||
|
||||
gd = new GridData(buttonWidth, SWT.DEFAULT);
|
||||
Button climateBtn = new Button(buttonComp, SWT.PUSH);
|
||||
climateBtn.setText("Climate Data");
|
||||
|
|
|
@ -37,7 +37,8 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
|
|||
import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* This class is a handler for bring up the Ceiling/Visibility Distribution
|
||||
* dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -52,7 +53,9 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
|||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
// No long used @see com.raytheon.viz.aviation.CigVisDistComponent
|
||||
// TODO remove from base line.
|
||||
public class CigVisDistAction extends AbstractHandler {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(CigVisDistAction.class);
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
|||
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* This is a component class for launching the CigVisDistributionDlg dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -37,7 +37,7 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
|
|||
import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Action class for launching the Ceiling/Visibility Trend dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -52,7 +52,8 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
|||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
// TODO no longer used remove from the base line
|
||||
public class CigVisTrendAction extends AbstractHandler {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(CigVisTrendAction.class);
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
|||
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* This is a component class for lanuching the CigVisTrendDlg dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -37,7 +37,7 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
|
|||
import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Action class for the Climate's METAR Display.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -52,7 +52,8 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
|||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
// TODO no longer used remove from the base line
|
||||
public class MetarAction extends AbstractHandler {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(MetarAction.class);
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
|||
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* This is a component class for launching the Climate's MetarDisplayDialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -37,7 +37,7 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
|
|||
import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Action class for Climate's Wind Rose Dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -52,7 +52,8 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
|||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
// TODO no longer used remove from the base line
|
||||
public class WindRoseAction extends AbstractHandler {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(WindRoseAction.class);
|
||||
|
|
|
@ -30,7 +30,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
|
|||
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Component class for launching the Climate's WindRoseDlg.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -25,7 +25,7 @@ import java.util.Map;
|
|||
import com.raytheon.viz.aviation.guidance.GuidanceRequest;
|
||||
|
||||
/**
|
||||
* Guidance request used for caching data.
|
||||
* The base Guidance Request classed used for caching data.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -50,10 +50,20 @@ public class CacheGuidanceRequest extends GuidanceRequest {
|
|||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* The site associated with the request.
|
||||
*
|
||||
* @return siteID
|
||||
*/
|
||||
public String getSiteID() {
|
||||
return this.siteID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the site ID associated with the request.
|
||||
*
|
||||
* @param siteID
|
||||
*/
|
||||
public void setSiteID(String siteID) {
|
||||
this.siteID = siteID;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Guidance request used for caching data.
|
||||
* Guidance request used for caching Grid data.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -39,8 +39,15 @@ import java.util.Map;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class GridCacheGuidanceRequest extends CacheGuidanceRequest {
|
||||
// TODO remove use the siteID in CacheGuidanceRequest.
|
||||
protected String siteID;
|
||||
|
||||
/**
|
||||
* Build the Grid tag string for desired site.
|
||||
*
|
||||
* @param siteID
|
||||
* @return tag
|
||||
*/
|
||||
public static String getTag(String siteID) {
|
||||
return GuidanceType.GRID + ":" + siteID;
|
||||
}
|
||||
|
@ -52,10 +59,12 @@ public class GridCacheGuidanceRequest extends CacheGuidanceRequest {
|
|||
return map;
|
||||
}
|
||||
|
||||
// TODO remove use the one in CacheGuidanceRequest
|
||||
public String getSiteID() {
|
||||
return this.siteID;
|
||||
}
|
||||
|
||||
// TODOremove use the one in CacheGuidanceRequest
|
||||
public void setSiteID(String siteID) {
|
||||
this.siteID = siteID;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Guidance request used for caching data.
|
||||
* Guidance request used for caching Metar data.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -39,10 +39,18 @@ import java.util.Map;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class MetarCacheGuidanceRequest extends CacheGuidanceRequest {
|
||||
// TODO remove use the one in CacheGuidanceRequest
|
||||
protected String siteID;
|
||||
|
||||
protected String size;
|
||||
|
||||
/**
|
||||
* Generate tag based on site ID and METAR size.
|
||||
*
|
||||
* @param siteID
|
||||
* @param size
|
||||
* @return tag
|
||||
*/
|
||||
public static String getTag(String siteID, String size) {
|
||||
return GuidanceType.METAR + ":" + siteID + ":" + size;
|
||||
}
|
||||
|
@ -55,10 +63,12 @@ public class MetarCacheGuidanceRequest extends CacheGuidanceRequest {
|
|||
return map;
|
||||
}
|
||||
|
||||
// TODO remove use the one in CacheGuidanceRequest
|
||||
public String getSiteID() {
|
||||
return this.siteID;
|
||||
}
|
||||
|
||||
// TODO remove use the one in CacheGuidanceRequest
|
||||
public void setSiteID(String siteID) {
|
||||
this.siteID = siteID;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Map;
|
|||
import com.raytheon.uf.common.time.DataTime;
|
||||
|
||||
/**
|
||||
* Guidance request used for caching data.
|
||||
* Guidance request used for caching MOS data.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -42,20 +42,34 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class MosCacheGuidanceRequest extends CacheGuidanceRequest {
|
||||
// TODO remove use the one in CacheGuidanceRequest
|
||||
protected String siteID;
|
||||
|
||||
/**
|
||||
* The Reference time can be null for the current time.
|
||||
*/
|
||||
protected Date refTime;
|
||||
|
||||
/**
|
||||
* Get MOS tag for give site ID, model and the current time as the reference
|
||||
* time.
|
||||
*
|
||||
* @param siteID
|
||||
* @param model
|
||||
* @param format
|
||||
* @return
|
||||
* @return tag
|
||||
*/
|
||||
public static String getTag(String siteID, String model) {
|
||||
return getTag(siteID, model, "current");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get MOS tag based on site ID, model and reference time.
|
||||
*
|
||||
* @param siteID
|
||||
* @param model
|
||||
* @param refTime
|
||||
* @return tag
|
||||
*/
|
||||
public static String getTag(String siteID, String model, String refTime) {
|
||||
return model + ":" + siteID + ":" + refTime;
|
||||
}
|
||||
|
@ -72,10 +86,12 @@ public class MosCacheGuidanceRequest extends CacheGuidanceRequest {
|
|||
return map;
|
||||
}
|
||||
|
||||
// TODO remove use the one in CacheGuidanceRequest
|
||||
public String getSiteID() {
|
||||
return this.siteID;
|
||||
}
|
||||
|
||||
// TODO remove use the one in CacheGuidanceRequest
|
||||
public void setSiteID(String siteID) {
|
||||
this.siteID = siteID;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ import com.raytheon.viz.aviation.activator.Activator;
|
|||
import com.raytheon.viz.aviation.monitor.AvnPyUtil;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Class to handle the cache data jobs.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -101,8 +101,14 @@ public class PythonCacheGuidanceJob extends
|
|||
*/
|
||||
private Object waitMonitor;
|
||||
|
||||
/**
|
||||
* Object to synchronize suspending/restarting the instance of this class.
|
||||
*/
|
||||
private Object suspendMonitor;
|
||||
|
||||
/**
|
||||
* True when job suspended otherwise false.
|
||||
*/
|
||||
boolean suspendJob;
|
||||
|
||||
/**
|
||||
|
@ -161,12 +167,18 @@ public class PythonCacheGuidanceJob extends
|
|||
instance = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate the jobs is to be suspended.
|
||||
*/
|
||||
public static final void suspend() {
|
||||
if (instance != null) {
|
||||
instance.suspendJob = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the job it can resume working.
|
||||
*/
|
||||
public void restart() {
|
||||
synchronized (instance.suspendMonitor) {
|
||||
instance.suspendJob = false;
|
||||
|
@ -174,6 +186,10 @@ public class PythonCacheGuidanceJob extends
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup listener to clean up the instance of this class and any threads it
|
||||
* is running.
|
||||
*/
|
||||
private void setupDispose() {
|
||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
|
||||
.addDisposeListener(new DisposeListener() {
|
||||
|
@ -300,6 +316,13 @@ public class PythonCacheGuidanceJob extends
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear desired tags for sites.
|
||||
*
|
||||
* @param tags
|
||||
* A map with key of stites an array of tags to clear for the
|
||||
* site
|
||||
*/
|
||||
public synchronized void clearSiteObjs(Map<String, ArrayList<String>> tags) {
|
||||
for (Object s : tags.keySet().toArray()) {
|
||||
String siteID = s.toString();
|
||||
|
|
|
@ -23,7 +23,7 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Guidance request used for caching data.
|
||||
* Guidance request used for caching Tamp data.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -39,8 +39,16 @@ import java.util.Map;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class TampCacheGuidanceRequest extends CacheGuidanceRequest {
|
||||
// TODO remove use the one in CacheGuidanceRequest
|
||||
protected String siteID;
|
||||
|
||||
/**
|
||||
* Get TAMP tag based on site ID and model.
|
||||
*
|
||||
* @param siteID
|
||||
* @param model
|
||||
* @return tag
|
||||
*/
|
||||
public static String getTag(String siteID, String model) {
|
||||
return model + ":" + siteID;
|
||||
}
|
||||
|
@ -53,10 +61,12 @@ public class TampCacheGuidanceRequest extends CacheGuidanceRequest {
|
|||
return map;
|
||||
}
|
||||
|
||||
// TODO remove use the one in CacheGuidanceRequest
|
||||
public String getSiteID() {
|
||||
return this.siteID;
|
||||
}
|
||||
|
||||
// TODO remove use the one in CacheGuidanceRequest
|
||||
public void setSiteID(String siteID) {
|
||||
this.siteID = siteID;
|
||||
}
|
||||
|
|
|
@ -97,6 +97,11 @@ public class EtaViewer extends ViewerTab implements
|
|||
*/
|
||||
private List<String> stationList;
|
||||
|
||||
/**
|
||||
* The results from the last completed request. Should contain the raw
|
||||
* header and data information used for highlighting. Keep around for faster
|
||||
* updates when highlighting options state changes.
|
||||
*/
|
||||
private String[] currentGuidance;
|
||||
|
||||
/**
|
||||
|
@ -265,6 +270,12 @@ public class EtaViewer extends ViewerTab implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request desired data for display on the tab. A check is performed and if
|
||||
* all data is cached a request is queued to immediately update the tab.
|
||||
* Otherwise request is made to cache missing data and update the display
|
||||
* once it arrives.
|
||||
*/
|
||||
@Override
|
||||
public int generateGuidance(String siteID) {
|
||||
int cnt = super.generateGuidance(siteID);
|
||||
|
@ -306,8 +317,6 @@ public class EtaViewer extends ViewerTab implements
|
|||
} else {
|
||||
req.setSiteObjs(siteObjs);
|
||||
req.setRoutine(routineChk.getSelection());
|
||||
// textComp.getHeaderStTxt().setText("");
|
||||
// textComp.getDataStTxt().setText("");
|
||||
PythonGuidanceJob.getInstance().enqueue(req);
|
||||
}
|
||||
return cnt;
|
||||
|
@ -333,10 +342,23 @@ public class EtaViewer extends ViewerTab implements
|
|||
this.stationList = stationList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a tag for current time, site, and the tab's model.
|
||||
*
|
||||
* @param siteID
|
||||
* @return tag
|
||||
*/
|
||||
private String getTag(String siteID) {
|
||||
return MosCacheGuidanceRequest.getTag(siteID, this.model);
|
||||
}
|
||||
|
||||
/**
|
||||
* This creates a cache request.
|
||||
*
|
||||
* @param siteID
|
||||
* @param format
|
||||
* @return req
|
||||
*/
|
||||
private CacheGuidanceRequest createCacheRequest(String siteID, String format) {
|
||||
MosCacheGuidanceRequest req = new MosCacheGuidanceRequest();
|
||||
req.setTag(getTag(siteID));
|
||||
|
@ -347,6 +369,9 @@ public class EtaViewer extends ViewerTab implements
|
|||
return req;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a cache request for the list of sites.
|
||||
*/
|
||||
@Override
|
||||
public void generateCache(List<String> siteIDs) {
|
||||
for (String siteID : siteIDs) {
|
||||
|
|
|
@ -49,6 +49,9 @@ public class GridGuidanceRequest extends GuidanceRequest {
|
|||
this.siteObjs = siteObjs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Place in the map arguments need for grid.
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getPythonArguments() {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
|
|
@ -279,6 +279,12 @@ public class GridViewer extends ViewerTab implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request desired data for display on the tab. A check is performed and if
|
||||
* all data is cached a request is queued to immediately update the tab.
|
||||
* Otherwise request is made to cache missing data and update the display
|
||||
* once it arrives.
|
||||
*/
|
||||
@Override
|
||||
public int generateGuidance(String siteID) {
|
||||
int cnt = super.generateGuidance(siteID);
|
||||
|
@ -320,8 +326,6 @@ public class GridViewer extends ViewerTab implements
|
|||
} else {
|
||||
req.setSiteObjs(siteObjs);
|
||||
req.setRoutine(routineChk.getSelection());
|
||||
// textComp.getHeaderStTxt().setText("");
|
||||
// textComp.getDataStTxt().setText("");
|
||||
PythonGuidanceJob.getInstance().enqueue(req);
|
||||
}
|
||||
return cnt;
|
||||
|
@ -347,6 +351,9 @@ public class GridViewer extends ViewerTab implements
|
|||
this.stationList = stationList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a cache request for the list of sites.
|
||||
*/
|
||||
@Override
|
||||
public void generateCache(List<String> siteIDs) {
|
||||
for (String siteID : siteIDs) {
|
||||
|
@ -355,10 +362,22 @@ public class GridViewer extends ViewerTab implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get grid style tag for the site ID.
|
||||
*
|
||||
* @param siteID
|
||||
* @return tag
|
||||
*/
|
||||
private String getTag(String siteID) {
|
||||
return GridCacheGuidanceRequest.getTag(siteID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create grid cache request.
|
||||
*
|
||||
* @param siteID
|
||||
* @return req
|
||||
*/
|
||||
private CacheGuidanceRequest createCacheRequest(String siteID) {
|
||||
GridCacheGuidanceRequest req = new GridCacheGuidanceRequest();
|
||||
req.setTag(getTag(siteID));
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Map;
|
|||
import com.raytheon.uf.viz.core.jobs.QueueJobRequest;
|
||||
|
||||
/**
|
||||
* Basic request to generate guidance
|
||||
* Basic request to generate a request for the PythonGuidancdJob class.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -45,32 +45,75 @@ import com.raytheon.uf.viz.core.jobs.QueueJobRequest;
|
|||
|
||||
public class GuidanceRequest extends QueueJobRequest<String[]> {
|
||||
|
||||
/**
|
||||
* This enumeration class defines the various type of guidance request that
|
||||
* can be received and associates the python method executed to service the
|
||||
* request. The METAR_CACHE and TAF_CACHE are special types used by
|
||||
* observer's to inform when new data has arrived and the cache needs to be
|
||||
* cleared and the new data retrieved.
|
||||
*
|
||||
*/
|
||||
public static enum GuidanceType {
|
||||
MOS("tafgen"), TAMP("tampgen"), GRID("gridgen"), ETA("tafgen"), METAR(
|
||||
"metargen"), METAR_CACHE("clearMetarCache"), TAF_CACHE(
|
||||
"clearCache");
|
||||
|
||||
/**
|
||||
* The python method associated with the enumeration.
|
||||
*/
|
||||
private String pythonMethod;
|
||||
|
||||
/**
|
||||
* Constructor that associates a python method with the enumerator.
|
||||
*
|
||||
* @param pythonMethod
|
||||
*/
|
||||
private GuidanceType(String pythonMethod) {
|
||||
this.pythonMethod = pythonMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the enumeatior's python method.
|
||||
*
|
||||
* @return pythonMethod
|
||||
*/
|
||||
public String getPythonMethod() {
|
||||
return pythonMethod;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* List of site ID to query for.
|
||||
*/
|
||||
protected ArrayList<String> siteIDs;
|
||||
|
||||
/**
|
||||
* the model being used.
|
||||
*/
|
||||
protected String model;
|
||||
|
||||
/**
|
||||
* The format to use.
|
||||
*/
|
||||
protected String format;
|
||||
|
||||
/**
|
||||
* Type of request.
|
||||
*/
|
||||
protected GuidanceType guidanceType;
|
||||
|
||||
/**
|
||||
* Tag associated with the request.
|
||||
*/
|
||||
protected String tag;
|
||||
|
||||
/**
|
||||
* This creates a default map with the mapping of the site IDs, model and
|
||||
* format. The intent is to pass the map to the python code. This can be
|
||||
* overriden by subclasses to fulfill the needs of a given python method.
|
||||
*
|
||||
* @return map
|
||||
*/
|
||||
public Map<String, Object> getPythonArguments() {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("siteIDs", siteIDs);
|
||||
|
@ -79,42 +122,92 @@ public class GuidanceRequest extends QueueJobRequest<String[]> {
|
|||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of sites request is for.
|
||||
*
|
||||
* @return siteIDs
|
||||
*/
|
||||
public ArrayList<String> getSiteIDs() {
|
||||
return siteIDs;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param siteIDs
|
||||
* list of sites array request is for
|
||||
*/
|
||||
public void setSiteIDs(ArrayList<String> siteIDs) {
|
||||
this.siteIDs = siteIDs;
|
||||
}
|
||||
|
||||
/**
|
||||
* The model argument for the request.
|
||||
*
|
||||
* @return model
|
||||
*/
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the model argument for the request.
|
||||
*
|
||||
* @param model
|
||||
*/
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
/**
|
||||
* The format argument for the request.
|
||||
*
|
||||
* @return format
|
||||
*/
|
||||
public String getFormat() {
|
||||
return format;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the format argument for the request.
|
||||
*
|
||||
* @param format
|
||||
*/
|
||||
public void setFormat(String format) {
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return guidanceType
|
||||
*/
|
||||
public GuidanceType getGuidanceType() {
|
||||
return guidanceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the guidance type for the request.
|
||||
*
|
||||
* @param guidanceType
|
||||
*/
|
||||
public void setGuidanceType(GuidanceType guidanceType) {
|
||||
this.guidanceType = guidanceType;
|
||||
}
|
||||
|
||||
/**
|
||||
* The tag value for the request. Use to determine if the value has been
|
||||
* cached.
|
||||
*
|
||||
* @return tag
|
||||
*/
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the tag value of the request.
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
@ -132,6 +225,8 @@ public class GuidanceRequest extends QueueJobRequest<String[]> {
|
|||
state = tag.equals(oReq.tag);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO remove debug statement.
|
||||
if (state) {
|
||||
System.out.println("-- GuidanceRequest match tag: " + tag);
|
||||
}
|
||||
|
|
|
@ -60,6 +60,8 @@ public class GuidanceUtil {
|
|||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
// TODO Remove this method no longer used in java, python of xml
|
||||
// configuration.
|
||||
public static MetarRecord getLatestMetar(String siteID) {
|
||||
try {
|
||||
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
|
||||
|
@ -82,6 +84,13 @@ public class GuidanceUtil {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the GFE Point Data information for the task request.
|
||||
*
|
||||
* @param task
|
||||
* @return gfePointDataContainer
|
||||
* @throws VizException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static GFEPointDataContainer getGFEPointData(GetPointDataRequest task)
|
||||
throws VizException {
|
||||
|
|
|
@ -51,6 +51,9 @@ public class MetarGuidanceRequest extends GuidanceRequest {
|
|||
|
||||
protected ArrayList<String> siteObjs;
|
||||
|
||||
/**
|
||||
* Place in the map arguments need for Metar request.
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getPythonArguments() {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
|
|
@ -265,10 +265,23 @@ public class MetarViewer extends ViewerTab implements
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tag for the desired Metar Cache Request.
|
||||
*
|
||||
* @param siteID
|
||||
* @param size
|
||||
* @return tag
|
||||
*/
|
||||
private String getTag(String siteID, String size) {
|
||||
return MetarCacheGuidanceRequest.getTag(siteID, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request desired data for display on the tab. A check is performed and if
|
||||
* all data is cached a request is queued to immediately update the tab.
|
||||
* Otherwise request is made to cache missing data and update the display
|
||||
* once it arrives.
|
||||
*/
|
||||
@Override
|
||||
public int generateGuidance(String siteID) {
|
||||
int cnt = super.generateGuidance(siteID);
|
||||
|
@ -360,6 +373,11 @@ public class MetarViewer extends ViewerTab implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if flight category alerts are highlighted.
|
||||
*
|
||||
* @return state true when highlighted otherwise false
|
||||
*/
|
||||
public boolean highlightAlerts() {
|
||||
boolean state = false;
|
||||
if (!this.isDisposed()) {
|
||||
|
@ -487,6 +505,13 @@ public class MetarViewer extends ViewerTab implements
|
|||
return siteObj;
|
||||
}
|
||||
|
||||
/**
|
||||
* This creates a Metar cache data request.
|
||||
*
|
||||
* @param siteID
|
||||
* @param size
|
||||
* @return req
|
||||
*/
|
||||
private CacheGuidanceRequest createCacheRequest(String siteID, String size) {
|
||||
MetarCacheGuidanceRequest req = new MetarCacheGuidanceRequest();
|
||||
req.setTag(getTag(siteID, size));
|
||||
|
@ -496,6 +521,9 @@ public class MetarViewer extends ViewerTab implements
|
|||
return req;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a cache request for the list of sites.
|
||||
*/
|
||||
@Override
|
||||
public void generateCache(List<String> siteIDs) {
|
||||
String size = prevChkHrs;
|
||||
|
|
|
@ -167,6 +167,9 @@ public class MosViewer extends ViewerTab implements
|
|||
*/
|
||||
private List<String> stationList;
|
||||
|
||||
/**
|
||||
* Current header and data information displayed in the tab.
|
||||
*/
|
||||
private String[] currentGuidance;
|
||||
|
||||
/**
|
||||
|
@ -600,7 +603,7 @@ public class MosViewer extends ViewerTab implements
|
|||
public String getSite(String site) {
|
||||
return chooseModel(site, model);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Obtain the model.
|
||||
*
|
||||
|
|
|
@ -73,16 +73,36 @@ public class PythonGuidanceJob extends AbstractQueueJob<GuidanceRequest> {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PythonGuidanceJob.class);
|
||||
|
||||
/**
|
||||
* The single instance of this class.
|
||||
*/
|
||||
private static PythonGuidanceJob instance;
|
||||
|
||||
/**
|
||||
* List of tabs to send alerts to in order to purge data cache.
|
||||
*/
|
||||
private static final List<ViewerTab> viewerList = new ArrayList<ViewerTab>();
|
||||
|
||||
/**
|
||||
* instance of python to execute the python methods.
|
||||
*/
|
||||
private PythonScript python;
|
||||
|
||||
/**
|
||||
* Object to synchronize on when changing the suspendJob state.
|
||||
*/
|
||||
private Object suspendMonitor;
|
||||
|
||||
/**
|
||||
* flag to indicate job is suspended.
|
||||
*/
|
||||
private boolean suspendJob;
|
||||
|
||||
/**
|
||||
* Private constructor to enforce singleton.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
private PythonGuidanceJob(String name) {
|
||||
super(name);
|
||||
suspendMonitor = new Object();
|
||||
|
@ -90,6 +110,9 @@ public class PythonGuidanceJob extends AbstractQueueJob<GuidanceRequest> {
|
|||
setupDispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag to indicate job should go away.
|
||||
*/
|
||||
private boolean shutdown = false;
|
||||
|
||||
/**
|
||||
|
@ -124,30 +147,49 @@ public class PythonGuidanceJob extends AbstractQueueJob<GuidanceRequest> {
|
|||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shutdowns the running instance and cleans up any threads.
|
||||
*/
|
||||
private void shutdown() {
|
||||
shutdown = true;
|
||||
restart();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a tab that needs to be told about alerts.
|
||||
*
|
||||
* @param viewerTab
|
||||
*/
|
||||
public final static synchronized void addViewerTab(ViewerTab viewerTab) {
|
||||
viewerList.add(viewerTab);
|
||||
PythonCacheGuidanceJob.getInstance().restart();
|
||||
PythonGuidanceJob.getInstance().restart();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tab is being disposed and no longer needs to receive alerts.
|
||||
*
|
||||
* @param viewerTab
|
||||
*/
|
||||
public final static synchronized void removeViwerTab(ViewerTab viewerTab) {
|
||||
viewerList.remove(viewerTab);
|
||||
PythonCacheGuidanceJob.suspend();
|
||||
PythonGuidanceJob.suspend();
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop process of request and clear the queue.
|
||||
*/
|
||||
private final static void suspend() {
|
||||
if (instance != null) {
|
||||
instance.suspendJob = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restart processing of request.
|
||||
*/
|
||||
private void restart() {
|
||||
synchronized (instance.suspendMonitor) {
|
||||
instance.suspendJob = false;
|
||||
|
@ -155,6 +197,9 @@ public class PythonGuidanceJob extends AbstractQueueJob<GuidanceRequest> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up dispose listener to clean up when Cave goes away.
|
||||
*/
|
||||
private void setupDispose() {
|
||||
|
||||
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
|
||||
|
@ -337,6 +382,12 @@ public class PythonGuidanceJob extends AbstractQueueJob<GuidanceRequest> {
|
|||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does not return until the list of cache requests are
|
||||
* completed.
|
||||
*
|
||||
* @param cacheRequests
|
||||
*/
|
||||
public void waitForCacheRequests(List<CacheGuidanceRequest> cacheRequests) {
|
||||
PythonCacheGuidanceJob.getInstance()
|
||||
.waitForCacheRequests(cacheRequests);
|
||||
|
|
|
@ -56,6 +56,9 @@ public class TampRequest extends GuidanceRequest {
|
|||
|
||||
protected ArrayList<String> siteObjs;
|
||||
|
||||
/**
|
||||
* Overrides the method to place the arguments needed for TAMP request.
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getPythonArguments() {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
|
|
@ -279,6 +279,12 @@ public class TugViewer extends ViewerTab implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request desired data for display on the tab. A check is performed and if
|
||||
* all data is cached a request is queued to immediately update the tab.
|
||||
* Otherwise request is made to cache missing data and update the display
|
||||
* once it arrives.
|
||||
*/
|
||||
@Override
|
||||
public int generateGuidance(String siteID) {
|
||||
int cnt = super.generateGuidance(siteID);
|
||||
|
@ -356,10 +362,22 @@ public class TugViewer extends ViewerTab implements
|
|||
this.stationList = stationList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tag for the desired Tamp Cache Request.
|
||||
*
|
||||
* @param siteID
|
||||
* @return
|
||||
*/
|
||||
private String getTag(String siteID) {
|
||||
return TampCacheGuidanceRequest.getTag(siteID, model);
|
||||
}
|
||||
|
||||
/**
|
||||
* This creates a Tamp cache data request.
|
||||
*
|
||||
* @param siteID
|
||||
* @return
|
||||
*/
|
||||
private CacheGuidanceRequest createCacheRequest(String siteID) {
|
||||
TampCacheGuidanceRequest req = new TampCacheGuidanceRequest();
|
||||
req.setTag(getTag(siteID));
|
||||
|
@ -369,6 +387,9 @@ public class TugViewer extends ViewerTab implements
|
|||
return req;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queue a cache request for the list of sites.
|
||||
*/
|
||||
@Override
|
||||
public void generateCache(List<String> siteIDs) {
|
||||
for (String siteID : siteIDs) {
|
||||
|
|
|
@ -123,12 +123,18 @@ public abstract class ViewerTab extends Composite {
|
|||
*/
|
||||
protected IStatusSettable msgStatComp;
|
||||
|
||||
/**
|
||||
* Current site.
|
||||
*/
|
||||
protected String siteID;
|
||||
|
||||
/**
|
||||
* Taf data for the current site.
|
||||
*/
|
||||
protected TafSiteData siteData;
|
||||
|
||||
/**
|
||||
* When true tab is the active display.
|
||||
* Indicates when the tab is populated with the user's latest request.
|
||||
*/
|
||||
private boolean displayCurrent = false;
|
||||
|
||||
|
@ -149,8 +155,16 @@ public abstract class ViewerTab extends Composite {
|
|||
*/
|
||||
protected boolean allChkIsSelected;
|
||||
|
||||
/**
|
||||
* Dialog the viewer is associated with.
|
||||
*/
|
||||
protected TafViewerEditorDlg tafViewerEditorDlg;
|
||||
|
||||
/**
|
||||
* Set dialog viewer is associated with.
|
||||
*
|
||||
* @param tafViewerEditorDlg
|
||||
*/
|
||||
public void setTafViewerEditorDlg(TafViewerEditorDlg tafViewerEditorDlg) {
|
||||
this.tafViewerEditorDlg = tafViewerEditorDlg;
|
||||
}
|
||||
|
@ -168,6 +182,13 @@ public abstract class ViewerTab extends Composite {
|
|||
PythonGuidanceJob.addViewerTab(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method sub-classes must implement to request the caching of data
|
||||
* displayed by the tab.
|
||||
*
|
||||
* @param siteIDs
|
||||
* list of sites needing data cached
|
||||
*/
|
||||
abstract public void generateCache(List<String> siteIDs);
|
||||
|
||||
/*
|
||||
|
@ -185,18 +206,40 @@ public abstract class ViewerTab extends Composite {
|
|||
super.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return displayCurrent true when tab is populated with the current
|
||||
* request
|
||||
*/
|
||||
public boolean isDisplayCurrent() {
|
||||
return displayCurrent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current display's status. When true the tab is populate with the
|
||||
* current request. When false the tab is waiting to be updated with the
|
||||
* current request.
|
||||
*
|
||||
* @param displayCurrent
|
||||
*/
|
||||
public void setDisplayCurrent(boolean displayCurrent) {
|
||||
this.displayCurrent = displayCurrent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates the tab is selected as the current tab being displayed.
|
||||
*
|
||||
* @return currentTab
|
||||
*/
|
||||
public boolean isCurrentTab() {
|
||||
return currentTab;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current tab state.
|
||||
*
|
||||
* @param currentTab
|
||||
*/
|
||||
public void setCurrentTab(boolean currentTab) {
|
||||
this.currentTab = currentTab;
|
||||
}
|
||||
|
@ -249,20 +292,29 @@ public abstract class ViewerTab extends Composite {
|
|||
protected abstract void createTopControls(ResourceConfigMgr configMgr);
|
||||
|
||||
/**
|
||||
* This method is called so any extra initialization/setup and be done after
|
||||
* the initializeComponents method is called.
|
||||
* This method is called so any extra initialization/setup can be performed
|
||||
* after the initializeComponents method is called.
|
||||
*/
|
||||
protected abstract void finalInitialization();
|
||||
|
||||
/**
|
||||
* From the GUI the user can select various options to queue another display
|
||||
* request prior to a previous request being finished. This variable is used
|
||||
* to determine the last request queued so it will be the one to populate
|
||||
* the tab.
|
||||
*/
|
||||
private AtomicInteger generatGuidanceCount = new AtomicInteger(
|
||||
Integer.MIN_VALUE);
|
||||
|
||||
/**
|
||||
* Generate the guidance. Must override to queue a request.
|
||||
* This method must be overridden by the implementing class to perform the
|
||||
* queue of the type of requested need to populate the tab. The first thing
|
||||
* the override method should do is call its super method to properly set up
|
||||
* the siteID, states and to get the count value to return.
|
||||
*
|
||||
* @param siteID
|
||||
* Site ID.
|
||||
* @return cnt unique count
|
||||
* @return cnt unique count that increases each time the method is called.
|
||||
*/
|
||||
public int generateGuidance(String siteID) {
|
||||
int cnt = generatGuidanceCount.incrementAndGet();
|
||||
|
@ -271,10 +323,20 @@ public abstract class ViewerTab extends Composite {
|
|||
return cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to force request to get the current sites data.
|
||||
*/
|
||||
void reGenerateGuidance() {
|
||||
generateGuidance(siteID);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method must to be called by the implementing class' requestComoplete
|
||||
* method after it has populated the textComp header and data section. This
|
||||
* updates the highlighting of the TAF text in the viewer and adjusts the
|
||||
* width of the this tab's header and data text component so they will stay
|
||||
* aligned with each other when the horizontal scroll is moved.
|
||||
*/
|
||||
public void requestComplete() {
|
||||
tafViewerEditorDlg.populateTafViewer();
|
||||
|
||||
|
@ -471,8 +533,17 @@ public abstract class ViewerTab extends Composite {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return stationList list of sites tab needs to cache data for.
|
||||
*/
|
||||
public abstract List<String> getStationList();
|
||||
|
||||
/**
|
||||
* Set the list of stations tab needs to cache data for.
|
||||
*
|
||||
* @param stationList
|
||||
*/
|
||||
public abstract void setStationList(List<String> stationList);
|
||||
|
||||
/**
|
||||
|
@ -503,7 +574,10 @@ public abstract class ViewerTab extends Composite {
|
|||
|
||||
/**
|
||||
* Queue the retrieval of requests and if still active update display once
|
||||
* data is retrieved.
|
||||
* data is retrieved. This starts up a thread to wait for the cache data to
|
||||
* arrive so this method does not block and freeze the GUI. Once the data
|
||||
* arrives the cnt is used to determine if the user still wants to display
|
||||
* the data.
|
||||
*
|
||||
* @param cnt
|
||||
* - Unique count to indicate this request is still active.
|
||||
|
@ -569,6 +643,12 @@ public abstract class ViewerTab extends Composite {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the TAF's sites configuration information.
|
||||
*
|
||||
* @param site
|
||||
* @return tafSiteData
|
||||
*/
|
||||
protected TafSiteData getSiteData(String site) {
|
||||
ITafSiteConfig config;
|
||||
TafSiteData data = null;
|
||||
|
@ -585,8 +665,25 @@ public abstract class ViewerTab extends Composite {
|
|||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Let the implementing class determine what should be returned for the
|
||||
* site.
|
||||
*
|
||||
* @param site
|
||||
* @return
|
||||
*/
|
||||
public abstract String getSite(String site);
|
||||
|
||||
/**
|
||||
* Convince method used by implementing classes to determine what string to
|
||||
* return for the site base on the site and model.
|
||||
*
|
||||
* @param site
|
||||
* the site
|
||||
* @param model
|
||||
* the model being used for the tab
|
||||
* @return siteId
|
||||
*/
|
||||
public String chooseModel(String site, String model) {
|
||||
if ("gfslamp".equals(model)) {
|
||||
return getSiteData(site).gfslamp;
|
||||
|
|
|
@ -34,7 +34,8 @@ import org.eclipse.swt.widgets.Composite;
|
|||
|
||||
/**
|
||||
* This class creates all of the buttons that corresponds to the available
|
||||
* methods.
|
||||
* methods. Example of use is generating the buttons with the various rules
|
||||
* methods in the Monitoring Rules configuration dialog.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
|
@ -110,10 +111,8 @@ public class AvailMethodsComp extends Composite {
|
|||
}
|
||||
Collections.sort(keyList);
|
||||
|
||||
// for (int x = 0; x < methodArray.size(); ++x) {
|
||||
for (String key : keyList) {
|
||||
methodData = methodArray.get(methodIndex.get(key).intValue());
|
||||
// methodData = methodArray.get(x);
|
||||
|
||||
gd = new GridData(160, SWT.DEFAULT);
|
||||
Button tmpBtn = new Button(this, SWT.PUSH);
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
package com.raytheon.viz.avnconfig;
|
||||
|
||||
/**
|
||||
* Constants for use in AVNFPS Monitoring Rules
|
||||
* Constants for use in AVNFPS Monitoring Rules. Use to generate the display for
|
||||
* the Monitoring Rules dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -37,6 +38,10 @@ package com.raytheon.viz.avnconfig;
|
|||
*/
|
||||
|
||||
public class AvnConfigConstants {
|
||||
|
||||
/**
|
||||
* Rule methods for the mtr tab.
|
||||
*/
|
||||
private static final String[] mtrs_methods = { "AirportOpsThresh",
|
||||
"CigCatDelta", "CigMetarThresh", "CigTafThresh", "DDDelta",
|
||||
"FFDelta", "FltCatDelta", "FuelAlternate", "LFFMetar",
|
||||
|
@ -45,41 +50,97 @@ public class AvnConfigConstants {
|
|||
"CAC_FltCatDelta", "CAC_AirportOpsThresh", "CAC_VsbyMetarThresh",
|
||||
"CAC_VsbyTafThresh", "CAC_WxTafDelta" };
|
||||
|
||||
/**
|
||||
* Rule methods for the grids tab.
|
||||
*/
|
||||
private static final String[] grids_methods = { "DDDelta", "FFDelta",
|
||||
"CigCatDelta", "SkyMismatch", "VsbyCatDelta", "WxTafDelta",
|
||||
"WxGridsDelta" };
|
||||
|
||||
/**
|
||||
* Rule methods for the ltg tab.
|
||||
*/
|
||||
private static final String[] ltg_methods = { "TSObsDelta" };
|
||||
|
||||
/**
|
||||
* Rule methods for the rltg tab.
|
||||
*/
|
||||
private static final String[] rltg_methods = { "TSInTaf", "TSNotInTaf" };
|
||||
|
||||
/**
|
||||
* Rule methods for the ccfp tab.
|
||||
*/
|
||||
private static final String[] ccfp_methods = { "TSNotInTaf", "CBNotInTaf" };
|
||||
|
||||
/**
|
||||
* Rule methods for the llws tab.
|
||||
*/
|
||||
private static final String[] llws_methods = { "WSinRadar" };
|
||||
|
||||
/**
|
||||
* Not sure what this is for and could not find any use in the java, python
|
||||
* or xml files.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String[] MONITORING_RULE_FIELDS = { ".type", ".unique",
|
||||
".args", ".msg", ".comment" };
|
||||
|
||||
/**
|
||||
* Not sure what this is for and could not find any use in the java, python
|
||||
* or xml files.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String ACTIVE_RULES = ".rules.active";
|
||||
|
||||
/**
|
||||
*
|
||||
* This enum class associates the tabs name with the methods used to
|
||||
* generate it rules and the name of the configuration file that contains
|
||||
* the monitoring rules.
|
||||
*
|
||||
*/
|
||||
public enum DataSource {
|
||||
mtrs("mtrs", mtrs_methods), ltg("ltg", ltg_methods), rltg("rltg",
|
||||
rltg_methods), ccfp("ccfp", ccfp_methods), grids("grids",
|
||||
grids_methods), llws("llws", llws_methods);
|
||||
|
||||
/**
|
||||
* The methods for the monitoring rules
|
||||
*/
|
||||
private String[] methods;
|
||||
|
||||
/**
|
||||
* The file name without the suffix.
|
||||
*/
|
||||
private String filename;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*
|
||||
* @param fname
|
||||
* - the file name for the desired monitoring rules.
|
||||
* @param array
|
||||
* - Array of methods used with the monitoring rules.
|
||||
*/
|
||||
private DataSource(String fname, String[] array) {
|
||||
methods = array;
|
||||
filename = fname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of methods used with the monitoring rules.
|
||||
*
|
||||
* @return methods
|
||||
*/
|
||||
public String[] getMethods() {
|
||||
return methods;
|
||||
}
|
||||
|
||||
/**
|
||||
* The name of the configuration file that contains the monitoring
|
||||
* rules. This assumes the suffix for the file is always ".cfg".
|
||||
*
|
||||
* @return filename
|
||||
*/
|
||||
public String getFilename() {
|
||||
return filename + ".cfg";
|
||||
}
|
||||
|
@ -92,6 +153,12 @@ public class AvnConfigConstants {
|
|||
vsby, wind, sky, wx, cat;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* The various kinds of triggers. Since trigger should be going away most
|
||||
* likely this should be depreciated and eventually go away.
|
||||
*
|
||||
*/
|
||||
public enum triggerType {
|
||||
TAF, METAR, CCFP;
|
||||
}
|
||||
|
|
|
@ -29,10 +29,10 @@ 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.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.core.status.StatusConstants;
|
||||
|
||||
/**
|
||||
* Aviation File Util class.
|
||||
* This class contains static methods for handling the localization setup up for
|
||||
* AvnFPS.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -49,7 +49,9 @@ import com.raytheon.uf.viz.core.status.StatusConstants;
|
|||
*/
|
||||
|
||||
public class AvnConfigFileUtil {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(AvnConfigFileUtil.class);
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AvnConfigFileUtil.class);
|
||||
|
||||
/**
|
||||
* Obtain the LocalizationFile for configuration file.
|
||||
*
|
||||
|
@ -63,10 +65,9 @@ public class AvnConfigFileUtil {
|
|||
|
||||
if (lFile == null) {
|
||||
String site = LocalizationManager.getInstance().getCurrentSite();
|
||||
statusHandler.handle(Priority.CRITICAL,
|
||||
"Unable to find \"" + configFile
|
||||
+ "\" under the directory for site " + site + ".",
|
||||
null);
|
||||
statusHandler.handle(Priority.CRITICAL, "Unable to find \""
|
||||
+ configFile + "\" under the directory for site " + site
|
||||
+ ".", null);
|
||||
}
|
||||
|
||||
return lFile;
|
||||
|
@ -119,12 +120,10 @@ public class AvnConfigFileUtil {
|
|||
File file = pm.getStaticFile(configFile);
|
||||
|
||||
if (file == null) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to find \""
|
||||
+ configFile
|
||||
+ "\" under the directory for site "
|
||||
+ LocalizationManager.getInstance()
|
||||
.getCurrentSite() + ".", null);
|
||||
statusHandler.handle(Priority.PROBLEM, "Unable to find \""
|
||||
+ configFile + "\" under the directory for site "
|
||||
+ LocalizationManager.getInstance().getCurrentSite() + ".",
|
||||
null);
|
||||
}
|
||||
|
||||
return file;
|
||||
|
|
|
@ -43,7 +43,7 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource;
|
|||
import com.raytheon.viz.avnconfig.AvnConfigConstants.RuleType;
|
||||
|
||||
/**
|
||||
* Contains the configuration for AVNFPS
|
||||
* Contains the configuration for AVNFPS monitoring rules.
|
||||
*
|
||||
* A "master copy" of the configuration is kept in memory for performance
|
||||
* reasons for dispatching alerts. This copy is read only...and is reloaded when
|
||||
|
@ -55,7 +55,7 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.RuleType;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 12, 2009 avarani Initial creation
|
||||
* Oct 29, 2010 7262 rferrel Replaced deprecated class, improved
|
||||
* Oct 29, 2010 7262 rferrel Replaced depreciated class, improved
|
||||
* parsing and allow msg & comment to have
|
||||
* commas in the text.
|
||||
* Sep 27, 2011 10958 rferrel Added checks for required fields in
|
||||
|
@ -171,6 +171,10 @@ public class AvnConfiguration {
|
|||
return value.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load in information for each rule method in DataSource. Information is
|
||||
* used to populate the Rule Editor section.
|
||||
*/
|
||||
private void reload() {
|
||||
HierarchicalPreferenceStore store = Activator.getDefault()
|
||||
.getPreferenceStore();
|
||||
|
@ -234,6 +238,19 @@ public class AvnConfiguration {
|
|||
return configuration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the monitoring rules to a localized SITE configuration file.
|
||||
*
|
||||
* @param site
|
||||
* - site ID rules are for.
|
||||
* @param source
|
||||
* - the kind of data source
|
||||
* @param data
|
||||
* - The array of rules
|
||||
* @throws ConfigurationException
|
||||
* @throws IOException
|
||||
* @throws LocalizationOpFailedException
|
||||
*/
|
||||
public void setRules(String site, DataSource source,
|
||||
ArrayList<MethodData> data) throws ConfigurationException,
|
||||
IOException, LocalizationOpFailedException {
|
||||
|
@ -296,6 +313,19 @@ public class AvnConfiguration {
|
|||
lFile.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of monitoring rules from the localize SITE file.
|
||||
*
|
||||
* @param site
|
||||
* - site ID rules are for.
|
||||
* @param source
|
||||
* - The desired type of rules
|
||||
* @param maxSeverity
|
||||
* - The maximum serverity allowed.
|
||||
* @return rules
|
||||
* @throws ConfigurationException
|
||||
* @throws IOException
|
||||
*/
|
||||
public ArrayList<MethodData> getRules(String site, DataSource source,
|
||||
final int maxSeverity) throws ConfigurationException, IOException {
|
||||
ArrayList<MethodData> rules = new ArrayList<MethodData>();
|
||||
|
|
|
@ -724,6 +724,12 @@ public class DataSourceTabComp extends Composite implements
|
|||
activeRules.clear();
|
||||
|
||||
saveRules(siteID);
|
||||
|
||||
// TODO The site's rules are removed and replaced with the
|
||||
// current XXXXs rules.
|
||||
// Should any monitoring rules configuration files for the
|
||||
// site be deleted so it will pick up any changes made to the
|
||||
// default rules?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -745,6 +751,13 @@ public class DataSourceTabComp extends Composite implements
|
|||
activeRules);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rules that apply for a site and display them.
|
||||
*
|
||||
* @param siteID
|
||||
* @throws LocalizationException
|
||||
* @throws ConfigurationException
|
||||
*/
|
||||
public void reloadRules(String siteID) throws LocalizationException,
|
||||
ConfigurationException {
|
||||
this.siteID = siteID;
|
||||
|
@ -752,6 +765,12 @@ public class DataSourceTabComp extends Composite implements
|
|||
populateList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load active rules for the tab.
|
||||
*
|
||||
* @throws LocalizationException
|
||||
* @throws ConfigurationException
|
||||
*/
|
||||
private void loadActiveRulesList() throws LocalizationException,
|
||||
ConfigurationException {
|
||||
AvnConfiguration config = AvnConfiguration.load(false);
|
||||
|
@ -765,6 +784,11 @@ public class DataSourceTabComp extends Composite implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The DataSource type associated with this tab.
|
||||
*
|
||||
* @return dataSource
|
||||
*/
|
||||
public String getDataSource() {
|
||||
return pageData.getDataSource();
|
||||
}
|
||||
|
|
|
@ -375,6 +375,7 @@ public class FindReplaceDlg extends CaveSWTDialog {
|
|||
* "Replace by" text field
|
||||
*/
|
||||
private void replaceAll() {
|
||||
// TODO change to: while(findWhatText() { replaceText();}
|
||||
while (1 == 1) {
|
||||
if (findWhatText()) {
|
||||
replaceText();
|
||||
|
|
|
@ -210,6 +210,14 @@ public class LabelTextComp extends Composite {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the text for the control text field associated with key and if
|
||||
* applicable change its background color.
|
||||
*
|
||||
* @param key
|
||||
* @param text
|
||||
* - new text
|
||||
*/
|
||||
public void updateTextControl(String key, String text) {
|
||||
Text textControl = textControlMap.get(key);
|
||||
textControl.setText(text);
|
||||
|
|
|
@ -42,11 +42,11 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.viz.avncommon.AvnMessageMgr;
|
||||
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
|
||||
|
||||
|
@ -106,12 +106,14 @@ public class MessageStatusComp extends Composite implements IStatusSettable {
|
|||
private MessageViewerDlg msgViewerDlg;
|
||||
|
||||
/**
|
||||
* Background RGB color.
|
||||
* Background RGB color. Only used at construction time to create
|
||||
* newBgColor. No need to keep it around in a class variable.
|
||||
*/
|
||||
@Deprecated
|
||||
private RGB bgRGB;
|
||||
|
||||
/**
|
||||
* New background color.
|
||||
* New background color for the msgViewerBtn.
|
||||
*/
|
||||
private Color newBgColor;
|
||||
|
||||
|
@ -120,18 +122,41 @@ public class MessageStatusComp extends Composite implements IStatusSettable {
|
|||
*/
|
||||
private StatusMessageType msgType = null;
|
||||
|
||||
/**
|
||||
* Use to control the blinking of the background color.
|
||||
*/
|
||||
private Timer timer;
|
||||
|
||||
/**
|
||||
* Task use by timer to do the blinking work.
|
||||
*/
|
||||
private TimerTask timerTask;
|
||||
|
||||
/**
|
||||
* Counter used to determine how long to blink.
|
||||
*/
|
||||
private int timerCounter = 0;
|
||||
|
||||
/**
|
||||
* The color to use for the blinking.
|
||||
*/
|
||||
private Color currentMsgColor;
|
||||
|
||||
/**
|
||||
* When false blinking is active.
|
||||
*/
|
||||
private boolean timerDone = true;
|
||||
|
||||
/**
|
||||
* Message background RGB color. Only used at construction time to create
|
||||
* messageBgColor. No need to keep it around in a class variable.
|
||||
*/
|
||||
@Deprecated
|
||||
private RGB messageBgRGB;
|
||||
|
||||
/**
|
||||
* The normal back ground color for the text field.
|
||||
*/
|
||||
private Color messageBgColor;
|
||||
|
||||
/**
|
||||
|
@ -140,7 +165,11 @@ public class MessageStatusComp extends Composite implements IStatusSettable {
|
|||
* @param parent
|
||||
* Parent composite.
|
||||
* @param bgRGB
|
||||
* Background RGB.
|
||||
* Background RGB for dialog display button. (not used therefore
|
||||
* always defaults to white)
|
||||
* @param messageBgRGB
|
||||
* Background RGB for the message textfield. When null defaults
|
||||
* to white
|
||||
*/
|
||||
public MessageStatusComp(Composite parent, RGB bgRGB, RGB messageBgRGB) {
|
||||
super(parent, SWT.NONE);
|
||||
|
@ -162,7 +191,10 @@ public class MessageStatusComp extends Composite implements IStatusSettable {
|
|||
* @param msgType
|
||||
* Status message type.
|
||||
* @param bgRGB
|
||||
* Background RGB.
|
||||
* Background RGB for display button. When null defaults to
|
||||
* white.
|
||||
* @param messageBgRGB
|
||||
* Background RGB for text field. When null defaults to white.
|
||||
*/
|
||||
public MessageStatusComp(Composite parent, StatusMessageType msgType,
|
||||
RGB bgRGB, RGB messageBgRGB) {
|
||||
|
@ -297,7 +329,7 @@ public class MessageStatusComp extends Composite implements IStatusSettable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the message text in the dialog.
|
||||
* Set the message text in the dialog and start the blinking timer.
|
||||
*
|
||||
* @param msg
|
||||
* Message to add to the dialog.
|
||||
|
|
|
@ -100,6 +100,7 @@ public class MethodData implements Comparable<MethodData> {
|
|||
* @param methodArgsArray
|
||||
* Array of MethodArgData.
|
||||
*/
|
||||
// TODO - no references to this constructor. Can it be removed?
|
||||
public MethodData(String methodName, String comment,
|
||||
ArrayList<MethodArgData> methodArgsArray) {
|
||||
this.methodName = methodName;
|
||||
|
@ -314,10 +315,20 @@ public class MethodData implements Comparable<MethodData> {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set flag to indicate message comes from a file.
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
public void setMsgFromFile(boolean value) {
|
||||
msgFromFile = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if message comes form a file.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean getMsgFromFile() {
|
||||
return msgFromFile;
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class MonitoringCriteriaDlg extends Dialog {
|
|||
private Text siteIdTF;
|
||||
|
||||
/**
|
||||
* Site ID
|
||||
* Site ID initially set to the default id.
|
||||
*/
|
||||
private String siteId = "XXXX";
|
||||
|
||||
|
@ -391,12 +391,22 @@ public class MonitoringCriteriaDlg extends Dialog {
|
|||
StatusMessageType.MonitoringCriteria, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the rule methods for all pages.
|
||||
*/
|
||||
private void createDefaultRuleData() {
|
||||
for (DataSource source : DataSource.values()) {
|
||||
defaultRuleData.addPageData(createPageData(source));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the rule methods for a given page
|
||||
*
|
||||
* @param dataSource
|
||||
* source associated with the page
|
||||
* @return pageData
|
||||
*/
|
||||
private PageData createPageData(DataSource dataSource) {
|
||||
PageData pageData = new PageData(dataSource.toString());
|
||||
AvnConfiguration configData = AvnConfiguration.load(false);
|
||||
|
@ -409,6 +419,12 @@ public class MonitoringCriteriaDlg extends Dialog {
|
|||
return pageData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the data information and comment for a give rule.
|
||||
*
|
||||
* @param rule
|
||||
* @return methodData
|
||||
*/
|
||||
private MethodData createMethodData(MethodData rule) {
|
||||
MethodData methodData = new MethodData(rule.getMethodName(),
|
||||
rule.getComment(), rule.getMessage(), rule.getType(),
|
||||
|
@ -425,10 +441,22 @@ public class MonitoringCriteriaDlg extends Dialog {
|
|||
return methodData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Method Data Argument.
|
||||
*
|
||||
* @param argName
|
||||
* Name of the argument to be displayed
|
||||
* @param argValue
|
||||
* Default value for the argument
|
||||
* @return methodArgData
|
||||
*/
|
||||
private MethodArgData createMethodArgData(String argName, String argValue) {
|
||||
return new MethodArgData(argName, argValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the monitoring rules currently in use for site selected by the user.
|
||||
*/
|
||||
private void loadSite() {
|
||||
siteId = siteIdTF.getText().trim().toUpperCase();
|
||||
siteIdTF.setText(siteId);
|
||||
|
|
|
@ -43,6 +43,21 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
|||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
|
||||
/**
|
||||
* This class generates a list of localized files that can be opened in the
|
||||
* AvnFPS Text Editor.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @version 1.0
|
||||
*/
|
||||
public class OpenSaveDlg extends Dialog {
|
||||
/**
|
||||
* Dialog shell.
|
||||
|
@ -54,28 +69,67 @@ public class OpenSaveDlg extends Dialog {
|
|||
*/
|
||||
private Display display;
|
||||
|
||||
/**
|
||||
* Used to indicate if the dialog is being used for open or save as dialog.
|
||||
* Only the OPEN is used.
|
||||
*/
|
||||
// TODO remove the SAVE_AS code that is not used change the constructor to
|
||||
// not use.
|
||||
@Deprecated
|
||||
public static enum DialogType {
|
||||
OPEN, SAVE_AS
|
||||
};
|
||||
|
||||
/**
|
||||
* Dialog type. This is always OPEN.
|
||||
*/
|
||||
@Deprecated
|
||||
private DialogType dialogType;
|
||||
|
||||
/**
|
||||
* Font used to display file list.
|
||||
*/
|
||||
private Font controlFont;
|
||||
|
||||
/**
|
||||
* List of localized files that can be edited.
|
||||
*/
|
||||
private List cfgFileList;
|
||||
|
||||
/**
|
||||
* The localize file selected by the user.
|
||||
*/
|
||||
private LocalizationFile selectedFile;
|
||||
|
||||
/**
|
||||
* List of localized files used to generate the file list.
|
||||
*/
|
||||
private LocalizationFile[] locFiles;
|
||||
|
||||
/**
|
||||
* Uses file's display name as key to get the associated localized file.
|
||||
*/
|
||||
private Map<String, LocalizationFile> locFileMap;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param parent
|
||||
* shell
|
||||
* @param type
|
||||
*/
|
||||
public OpenSaveDlg(Shell parent, DialogType type) {
|
||||
super(parent, 0);
|
||||
|
||||
dialogType = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display dialog and sets the selected file when user clicks on the Open
|
||||
* button. Any other close leaves the the selected file null.
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public Object open() {
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
|
@ -106,6 +160,9 @@ public class OpenSaveDlg extends Dialog {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set up the dialog's display components.
|
||||
*/
|
||||
private void initializeComponents() {
|
||||
locFileMap = new TreeMap<String, LocalizationFile>();
|
||||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
@ -118,6 +175,10 @@ public class OpenSaveDlg extends Dialog {
|
|||
getAvailableConfigFiles();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the label and the scroll list that will contain the files the user
|
||||
* can edit.
|
||||
*/
|
||||
private void createListControl() {
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
Composite listComp = new Composite(shell, SWT.NONE);
|
||||
|
@ -137,7 +198,13 @@ public class OpenSaveDlg extends Dialog {
|
|||
cfgFileList.setFont(controlFont);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine based on DialogType what kind of action button to place at the
|
||||
* bottom of the dialog.
|
||||
*/
|
||||
private void createBottomButtons() {
|
||||
// TODO Only the DialogType.OPEN is ever used. Code needs to be
|
||||
// modified to no longer use DialogType.
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
Composite mainButtonComp = new Composite(shell, SWT.NONE);
|
||||
mainButtonComp.setLayout(new GridLayout(1, false));
|
||||
|
@ -188,6 +255,10 @@ public class OpenSaveDlg extends Dialog {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain from localization the configuration file information and populate
|
||||
* the dialog scroll list.
|
||||
*/
|
||||
private void getAvailableConfigFiles() {
|
||||
String[] extensions = new String[] { ".xml", ".cfg" };
|
||||
LocalizationType[] types = new LocalizationType[] {
|
||||
|
@ -230,6 +301,12 @@ public class OpenSaveDlg extends Dialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the localized file selected by the user or null if no file
|
||||
* selected.
|
||||
*
|
||||
* @return lfile
|
||||
*/
|
||||
public LocalizationFile getSelectedFile() {
|
||||
return selectedFile;
|
||||
}
|
||||
|
|
|
@ -22,24 +22,24 @@ package com.raytheon.viz.avnconfig;
|
|||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* A class containing 'page' data where the page is the tab on a tab folder
|
||||
* and the data contained in each folder.
|
||||
* A class containing 'page' data where the page is the tab on a tab folder and
|
||||
* the data contained in each folder.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 22 MAY 2008 1119 lvenable Initial creation
|
||||
* 22 MAY 2008 1119 lvenable Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class PageData {
|
||||
/**
|
||||
* Data source (or page name).
|
||||
* Data source (or page/tab name).
|
||||
*/
|
||||
private String dataSource;
|
||||
|
||||
|
@ -57,7 +57,9 @@ public class PageData {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param dataSource Data source (page name).
|
||||
*
|
||||
* @param dataSource
|
||||
* Data source (page name).
|
||||
*/
|
||||
public PageData(String dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
|
@ -66,8 +68,11 @@ public class PageData {
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param dataSource Data source (page name).
|
||||
* @param methodArray Array of MethodData.
|
||||
*
|
||||
* @param dataSource
|
||||
* Data source (page name).
|
||||
* @param methodArray
|
||||
* Array of MethodData.
|
||||
*/
|
||||
public PageData(String dataSource, ArrayList<MethodData> methodArray) {
|
||||
this.dataSource = dataSource;
|
||||
|
@ -83,7 +88,9 @@ public class PageData {
|
|||
|
||||
/**
|
||||
* Add MethodData to the MethodData array.
|
||||
* @param methodData MethodData object.
|
||||
*
|
||||
* @param methodData
|
||||
* MethodData object.
|
||||
*/
|
||||
public void addMethodData(MethodData methodData) {
|
||||
methodArray.add(methodData);
|
||||
|
@ -91,6 +98,7 @@ public class PageData {
|
|||
|
||||
/**
|
||||
* Get the data source name.
|
||||
*
|
||||
* @return The data source name.
|
||||
*/
|
||||
public String getDataSource() {
|
||||
|
@ -99,7 +107,9 @@ public class PageData {
|
|||
|
||||
/**
|
||||
* Set the data source name.
|
||||
* @param dataSource The data source name.
|
||||
*
|
||||
* @param dataSource
|
||||
* The data source name.
|
||||
*/
|
||||
public void setDataSource(String dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
|
@ -107,6 +117,7 @@ public class PageData {
|
|||
|
||||
/**
|
||||
* Get the array of MethodData.
|
||||
*
|
||||
* @return The array of MethodData.
|
||||
*/
|
||||
public ArrayList<MethodData> getMethodArray() {
|
||||
|
@ -115,6 +126,7 @@ public class PageData {
|
|||
|
||||
/**
|
||||
* Set the array of MethodData.
|
||||
*
|
||||
* @return The array of MethodData.
|
||||
*/
|
||||
public void setMethodArray(ArrayList<MethodData> methodArray) {
|
||||
|
|
|
@ -605,6 +605,11 @@ public class TafProductConfigDlg extends Dialog {
|
|||
StatusMessageType.TafProdConfig, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the product list from configuration and repopulate the product list.
|
||||
* This assumes getting the new list will places the default product at the
|
||||
* top of the list.
|
||||
*/
|
||||
private void update() {
|
||||
try {
|
||||
ITafSiteConfig config = TafSiteConfigFactory.getInstance();
|
||||
|
@ -625,6 +630,9 @@ public class TafProductConfigDlg extends Dialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The verify action call back. Displays problems in the status message.
|
||||
*/
|
||||
private void verify() {
|
||||
try {
|
||||
ITafSiteConfig config = TafSiteConfigFactory.getInstance();
|
||||
|
|
|
@ -9,9 +9,15 @@ import org.apache.commons.configuration.ConfigurationException;
|
|||
* implements the ITafSiteConfig interface. Intent is to allow changing between
|
||||
* classes without having to impact all the other classes that depend on
|
||||
* configuration class. This assumes implementing ITafSiteConfig contains the
|
||||
* static methods <code>getIntance</code> and <code>clearInstance</code>. if
|
||||
* static methods <code>getInstance</code> and <code>clearInstance</code>. if
|
||||
* needed it is up to the implementing class to synchronize these methods.
|
||||
*
|
||||
* <br>
|
||||
* <br>
|
||||
* This class is a bridge form using a single xml configuration file for
|
||||
* all sites to using the AWIPS I style configuration files. This makes porting
|
||||
* from AWIPS I easier for sites.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
|
|
|
@ -103,6 +103,9 @@ public class TafSiteConfigIni implements ITafSiteConfig {
|
|||
*/
|
||||
private static final String TMPL_EXT = "template";
|
||||
|
||||
/**
|
||||
* The template extension with the "." prefix.
|
||||
*/
|
||||
private static final String TMPL_DOT_EXT = "." + TMPL_EXT;
|
||||
|
||||
/**
|
||||
|
@ -134,6 +137,9 @@ public class TafSiteConfigIni implements ITafSiteConfig {
|
|||
*/
|
||||
private static final String PROD_EXT = "cfg";
|
||||
|
||||
/**
|
||||
* the product extension the the "." prefix.
|
||||
*/
|
||||
private static final String PROD_DOT_EXT = "." + PROD_EXT;
|
||||
|
||||
/**
|
||||
|
@ -259,6 +265,13 @@ public class TafSiteConfigIni implements ITafSiteConfig {
|
|||
return triggerMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get configuration mapping for the product.
|
||||
*
|
||||
* @param product
|
||||
* @return config - The configuration mapping for the product or null if
|
||||
* problem getting the mapping.
|
||||
*/
|
||||
private HierarchicalINIConfiguration getProductConfig(String product) {
|
||||
HierarchicalINIConfiguration config = configMaps.get(product);
|
||||
if (config == null) {
|
||||
|
@ -647,6 +660,16 @@ public class TafSiteConfigIni implements ITafSiteConfig {
|
|||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of localized files from a directory.
|
||||
*
|
||||
* @param dir
|
||||
* The directory to check
|
||||
* @param ext
|
||||
* The extension to look file
|
||||
* @return lFileArray The array of localized files in the directory with the
|
||||
* desired extension
|
||||
*/
|
||||
private LocalizationFile[] getLfiles(String dir, String ext) {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext context = pm.getContext(
|
||||
|
|
|
@ -309,7 +309,14 @@ public class TafSiteInfoEditorDlg extends Dialog {
|
|||
createBottomMessageControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an array into a comma separated string
|
||||
*
|
||||
* @param array
|
||||
* @return string
|
||||
*/
|
||||
private String arrayToString(String[] array) {
|
||||
// TODO convert to use StringBuilder.
|
||||
String s = "";
|
||||
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
|
@ -1577,6 +1584,10 @@ public class TafSiteInfoEditorDlg extends Dialog {
|
|||
return elevationTF.getText().matches("^-?[0-9]+$");
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the site information for the site user entered in site ID text
|
||||
* field and when valid populate the fields with the information.
|
||||
*/
|
||||
private void loadSite() {
|
||||
boolean loadFailed = false;
|
||||
String loadFailedMsg = null;
|
||||
|
|
|
@ -64,7 +64,7 @@ import com.raytheon.viz.avnconfig.OpenSaveDlg.DialogType;
|
|||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* Text Editor dialog.
|
||||
* A simple text Editor dialog allowing the user to modify a localized file.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
|
@ -151,6 +151,14 @@ public class TextEditorSetupDlg extends CaveSWTDialog {
|
|||
this(parent, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construction.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell
|
||||
* @param lFile
|
||||
* When not null a localized file to load into the editor.
|
||||
*/
|
||||
public TextEditorSetupDlg(Shell parent, LocalizationFile lFile) {
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT);
|
||||
setText("AvnFPS Text Editor");
|
||||
|
@ -642,6 +650,9 @@ public class TextEditorSetupDlg extends CaveSWTDialog {
|
|||
editorTextComp.setMenu(popupMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* The call back action for the Undo button.
|
||||
*/
|
||||
private void undoText() {
|
||||
if (undoStack.size() > 0) {
|
||||
HashMap<String, Object> undoData = undoStack.remove(undoStack
|
||||
|
@ -666,6 +677,9 @@ public class TextEditorSetupDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call back action for the Redo button.
|
||||
*/
|
||||
private void redoText() {
|
||||
if (redoStack.size() > 0) {
|
||||
HashMap<String, Object> redoData = redoStack.remove(redoStack
|
||||
|
@ -830,6 +844,11 @@ public class TextEditorSetupDlg extends CaveSWTDialog {
|
|||
openFile(dlg.getSelectedFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of a localized file and populates the editor.
|
||||
*
|
||||
* @param lFile
|
||||
*/
|
||||
private void openFile(LocalizationFile lFile) {
|
||||
openedFile = lFile;
|
||||
|
||||
|
|
|
@ -51,7 +51,9 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
import com.raytheon.viz.avnconfig.AvnConfigConstants.triggerType;
|
||||
|
||||
/**
|
||||
* Trigger editor dialog.
|
||||
* Trigger editor dialog. There are no longer any references to this class in
|
||||
* any of the java and python code or in the xml configuration files. Consider
|
||||
* removing this class from the base line.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
|
@ -67,6 +69,7 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.triggerType;
|
|||
* @version 1.0
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
public class TriggerEditorDlg extends Dialog {
|
||||
/**
|
||||
* Dialog shell.
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.viz.gfe.dialogs;
|
|||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
@ -31,6 +32,7 @@ import java.util.TimeZone;
|
|||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
|
||||
import com.raytheon.viz.core.mode.CAVEMode;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.IParmManager;
|
||||
|
||||
|
@ -45,6 +47,7 @@ import com.raytheon.viz.gfe.core.IParmManager;
|
|||
* 06/10/2008 Eric Babin Initial Creation
|
||||
* 04/30/2009 2282 rjpeter Refactored interfaces.
|
||||
* 08/19/2009 2547 rjpeter Implement Test/Prac database display.
|
||||
* 02/22/2012 14351 mli update with incoming databases
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
|
@ -114,6 +117,14 @@ public class WEBrowserTypeRecord {
|
|||
public java.util.List<String> getSources() {
|
||||
return sources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sources
|
||||
*/
|
||||
public java.util.List<String> getUpdatedSources() {
|
||||
makeSources();
|
||||
return sources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fields
|
||||
|
@ -134,9 +145,18 @@ public class WEBrowserTypeRecord {
|
|||
pracFlag = mode.equals(CAVEMode.PRACTICE);
|
||||
testFlag = mode.equals(CAVEMode.TEST);
|
||||
}
|
||||
List<DatabaseID> dbs = DataManager.getCurrentInstance()
|
||||
.getParmManager().getAvailableDbs();
|
||||
// List<DatabaseID> dbs = DataManager.getCurrentInstance()
|
||||
// .getParmManager().getAvailableDbs();
|
||||
|
||||
// Always retrieve updated databases
|
||||
List<DatabaseID> dbs = null;
|
||||
try {
|
||||
dbs = DataManager.getCurrentInstance().getClient().getAvailableDbs();
|
||||
} catch (GFEServerException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ArrayList<DatabaseID> filtDB = new ArrayList<DatabaseID>();
|
||||
|
||||
for (DatabaseID db : dbs) {
|
||||
|
@ -417,6 +437,25 @@ public class WEBrowserTypeRecord {
|
|||
return possibleParms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add ParmIDs for new database
|
||||
*/
|
||||
public void addNewParmIDs(String newSource) {
|
||||
ArrayList<ParmID> parmIds = new ArrayList<ParmID>();
|
||||
possibleParms = getPossibleParmIDs();
|
||||
parmIds.addAll(Arrays.asList(possibleParms));
|
||||
|
||||
ParmID ids[] = getFields(newSource);
|
||||
for ( int i = 0; i < ids.length; i++) {
|
||||
if (!parmIds.contains(ids[i])) {
|
||||
parmIds.add(ids[i]);
|
||||
}
|
||||
}
|
||||
|
||||
possibleParms = new ParmID[parmIds.size()];
|
||||
parmIds.toArray(possibleParms);
|
||||
}
|
||||
|
||||
public ArrayList<ParmID> getFilteredParmIDs(String sources[],
|
||||
String fields[], String planes[]) {
|
||||
ArrayList<ParmID> listToReturn = new ArrayList<ParmID>();
|
||||
|
|
|
@ -51,6 +51,7 @@ import org.eclipse.swt.widgets.ToolItem;
|
|||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
|
||||
import com.raytheon.viz.core.mode.CAVEMode;
|
||||
import com.raytheon.viz.gfe.GFEServerException;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.parm.Parm;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
|
@ -68,6 +69,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
|
|||
* 06/27/2008 ebabin Updated to properly add fields.
|
||||
* 04/30/2009 2282 rjpeter Refactored.
|
||||
* 08/19/2009 2547 rjpeter Fix Test/Prac database display.
|
||||
* 02/22/2012 14351 mli update with incoming new grids.
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
|
@ -517,6 +519,48 @@ public class WeatherElementBrowserDialog extends CaveJFACEDialog {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* check for incoming new databases
|
||||
*/
|
||||
private void checkForNewSource() {
|
||||
List<String> sortedSources = selectedType.getUpdatedSources();
|
||||
|
||||
if (sortedSources != null) {
|
||||
List<String> newSources = new ArrayList<String>();
|
||||
|
||||
// Check for new new database
|
||||
for (String source : sortedSources) {
|
||||
boolean found = false;
|
||||
for (int i = 0; i < sourceMenu.getItemCount(); i++) {
|
||||
if (sourceMenu.getItem(i).getText().equals(source)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
newSources.add(source);
|
||||
}
|
||||
}
|
||||
|
||||
// create menuItem for new database
|
||||
if (newSources != null) {
|
||||
for (String s : newSources) {
|
||||
selectedType.addNewParmIDs(s);
|
||||
final MenuItem item = new MenuItem(sourceMenu, SWT.PUSH);
|
||||
item.setText(s);
|
||||
item.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
addToList(item.getText(), sourceList);
|
||||
processSourceSelection();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void processSourceSelection() {
|
||||
java.util.List<String> currentSourceSelection = java.util.Arrays
|
||||
.asList(sourceList.getSelection());
|
||||
|
@ -814,6 +858,9 @@ public class WeatherElementBrowserDialog extends CaveJFACEDialog {
|
|||
sourceToolItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
// Check for new source
|
||||
checkForNewSource();
|
||||
|
||||
Rectangle rect = sourceToolItem.getBounds();
|
||||
Point pt = new Point(rect.x, rect.y + rect.height);
|
||||
pt = sourceToolBar.toDisplay(pt);
|
||||
|
@ -1205,9 +1252,18 @@ public class WeatherElementBrowserDialog extends CaveJFACEDialog {
|
|||
|
||||
private List<DatabaseID> getDatabases() {
|
||||
if (databases == null) {
|
||||
databases = dataManager.getParmManager().getAvailableDbs();
|
||||
// databases = dataManager.getParmManager().getAvailableDbs();
|
||||
|
||||
// Always Retrieve updated databases
|
||||
try {
|
||||
databases = DataManager.getCurrentInstance().getClient().getAvailableDbs();
|
||||
} catch (GFEServerException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return databases;
|
||||
|
||||
return databases;
|
||||
}
|
||||
|
||||
private ParmID[] getSelectedParmIDS() {
|
||||
|
|
|
@ -110,6 +110,7 @@ import com.raytheon.viz.ui.statusline.StatusStore;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 5, 2008 Eric Babin Initial Creation
|
||||
* Sep 27,2010 5813 gzhou get etn from param pattern hazXXXnnn
|
||||
* Feb 28,2012 14436 mli Add RP.S - Rip Current
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -1309,7 +1310,7 @@ public class MakeHazardDialog extends CaveSWTDialog implements
|
|||
hazardMap.put("Fire Weather", Arrays.asList("FW.A", "FW.W"));
|
||||
hazardMap.put("Convective Watches", Arrays.asList("SV.A", "TO.A"));
|
||||
hazardMap.put("Coastal Flood", Arrays.asList("CF.S", "LS.S",
|
||||
"CF.Y", "CF.W", "CF.A", "SU.Y", "SU.W", "LS.Y", "LS.W",
|
||||
"CF.Y", "CF.W", "CF.A", "SU.Y", "SU.W", "RP.S", "LS.Y", "LS.W",
|
||||
"LS.A"));
|
||||
hazardMap.put("Non-Precipitation", Arrays.asList("AF.W", "AF.Y",
|
||||
"AS.Y", "DU.Y", "DS.W", "EH.W", "EH.A", "EC.W", "EC.A",
|
||||
|
|
|
@ -7,4 +7,5 @@ com.raytheon.viz.grid.rsc.FfgVizGroupResourceData
|
|||
com.raytheon.viz.grid.rsc.RcmResourceData
|
||||
com.raytheon.viz.grid.rsc.GridLoadProperties
|
||||
com.raytheon.viz.grid.rsc.DataMappedGridResourceData
|
||||
com.raytheon.viz.grid.rsc.general.DifferenceGridResourceData
|
||||
com.raytheon.viz.grid.GridProductBrowserDataDefinition
|
|
@ -116,9 +116,7 @@ public class GribRequestableData extends AbstractRequestableData {
|
|||
@Override
|
||||
public IDataRecord[] getDataValue(Object arg) throws VizException {
|
||||
|
||||
if (arg == null) {
|
||||
return getDataValue(Request.ALL);
|
||||
} else if (arg instanceof Request) {
|
||||
if (arg instanceof Request) {
|
||||
Request request = (Request) arg;
|
||||
SoftReference<IDataRecord[]> record = cache.get(request);
|
||||
if (record != null) {
|
||||
|
@ -176,12 +174,10 @@ public class GribRequestableData extends AbstractRequestableData {
|
|||
}
|
||||
|
||||
return result;
|
||||
} else {
|
||||
return getDataValue(Request.ALL);
|
||||
}
|
||||
|
||||
throw new VizException(this.getClass().getSimpleName()
|
||||
+ " cannot process request of type: "
|
||||
+ arg.getClass().getSimpleName());
|
||||
|
||||
}
|
||||
|
||||
public void setDataValue(Request request, IDataRecord[] records) {
|
||||
|
|
|
@ -69,12 +69,10 @@ public class ImportRequestableData extends AliasRequestableData {
|
|||
}
|
||||
|
||||
public Object getDataValue(Object arg) throws VizException {
|
||||
if (!(arg instanceof Request)) {
|
||||
throw new VizException(this.getClass().getSimpleName()
|
||||
+ " cannot process request of type: "
|
||||
+ arg.getClass().getSimpleName());
|
||||
Request req = Request.ALL;
|
||||
if (arg instanceof Request) {
|
||||
req = (Request) arg;
|
||||
}
|
||||
Request req = (Request) arg;
|
||||
Object rval = getDataAndConvert(sourceRecord, Request.ALL);
|
||||
|
||||
if (sourceRecord2 != null) {
|
||||
|
@ -167,13 +165,16 @@ public class ImportRequestableData extends AliasRequestableData {
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.raytheon.uf.viz.derivparam.data.AliasRequestableData#getDependencies()
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.derivparam.data.AliasRequestableData#getDependencies
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public List<AbstractRequestableData> getDependencies() {
|
||||
return Arrays.asList(sourceRecord, sourceRecord2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
|
|||
import com.raytheon.viz.grid.util.CoverageUtils;
|
||||
import com.raytheon.viz.grid.util.SliceUtil;
|
||||
import com.raytheon.viz.grid.util.TiltUtils;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -49,6 +50,15 @@ import com.raytheon.viz.grid.util.TiltUtils;
|
|||
|
||||
public class TiltRequestableData extends AbstractRequestableData {
|
||||
|
||||
public static class TiltCenterPoint {
|
||||
private final Coordinate latLon;
|
||||
|
||||
public TiltCenterPoint(Coordinate latLon) {
|
||||
this.latLon = latLon;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public TiltRequestableData(String modelName, Level tiltAngle) {
|
||||
this.source = modelName;
|
||||
this.unit = SI.METER;
|
||||
|
@ -61,16 +71,20 @@ public class TiltRequestableData extends AbstractRequestableData {
|
|||
public FloatDataRecord getDataValue(Object arg) throws VizException {
|
||||
|
||||
GridCoverage coverage = CoverageUtils.getInstance().getCoverage(source);
|
||||
FloatDataRecord fdr = TiltUtils.getInstance().getHeightGrid(coverage,
|
||||
level.getLevelonevalue());
|
||||
if (arg == null) {
|
||||
return fdr;
|
||||
} else if (arg instanceof Request) {
|
||||
return SliceUtil.slice(fdr, (Request) arg);
|
||||
FloatDataRecord fdr = null;
|
||||
if (arg instanceof TiltCenterPoint) {
|
||||
Coordinate tiltLoc = ((TiltCenterPoint) arg).latLon;
|
||||
fdr = TiltUtils.getInstance().getHeightGrid(tiltLoc, coverage,
|
||||
level.getLevelonevalue());
|
||||
} else {
|
||||
fdr = TiltUtils.getInstance().getHeightGrid(coverage,
|
||||
level.getLevelonevalue());
|
||||
}
|
||||
if (arg instanceof Request) {
|
||||
return SliceUtil.slice(fdr, (Request) arg);
|
||||
} else {
|
||||
return fdr;
|
||||
}
|
||||
throw new VizException(this.getClass().getSimpleName()
|
||||
+ " cannot process request of type: "
|
||||
+ arg.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,9 @@ import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
|||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
|
||||
import com.raytheon.viz.grid.data.GribRequestableData;
|
||||
import com.raytheon.viz.grid.data.TiltRequestableData.TiltCenterPoint;
|
||||
import com.raytheon.viz.grid.util.CoverageUtils;
|
||||
import com.raytheon.viz.grid.util.TiltRequest;
|
||||
|
||||
/**
|
||||
* The RequestableDataRecord Class
|
||||
|
@ -107,7 +109,13 @@ public class RequestableDataRecord extends GribRecord {
|
|||
}
|
||||
|
||||
public IDataRecord[] getDataRecord(Request request) throws VizException {
|
||||
Object obj = requester.getDataValue(request);
|
||||
Object obj = null;
|
||||
if (request instanceof TiltRequest) {
|
||||
obj = requester.getDataValue(new TiltCenterPoint(
|
||||
((TiltRequest) request).getTiltLocation()));
|
||||
} else {
|
||||
obj = requester.getDataValue(request);
|
||||
}
|
||||
if (obj instanceof IDataRecord[]) {
|
||||
return (IDataRecord[]) obj;
|
||||
} else if (obj instanceof IDataRecord) {
|
||||
|
|
|
@ -546,7 +546,14 @@ public abstract class AbstractMapVectorResource extends
|
|||
StorageException, VizException {
|
||||
|
||||
IDataRecord rec = null;
|
||||
IDataRecord[] records = DataCubeContainer.getDataRecord(pdo);
|
||||
IDataRecord[] records = null;
|
||||
if (pdo instanceof GribRecord) {
|
||||
records = GridResourceData.getDataRecordsForTilt((GribRecord) pdo,
|
||||
descriptor);
|
||||
}
|
||||
if (records == null) {
|
||||
records = DataCubeContainer.getDataRecord(pdo);
|
||||
}
|
||||
if (records != null && records.length > 0) {
|
||||
rec = records[0].clone();
|
||||
}
|
||||
|
|
|
@ -252,8 +252,23 @@ public class GridResource extends
|
|||
|
||||
@Override
|
||||
protected IDataRecord getDataRecord() throws StorageException {
|
||||
IDataRecord record = super.getDataRecord();
|
||||
Unit<?> realDataUnit = ((GribRecord) pdo).getModelInfo()
|
||||
GribRecord gribRecord = (GribRecord) pdo;
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
IDataRecord[] records = GridResourceData.getDataRecordsForTilt(
|
||||
gribRecord, descriptor);
|
||||
if (records != null && records.length > 0) {
|
||||
record = records[0];
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
|
||||
if (record == null) {
|
||||
record = super.getDataRecord();
|
||||
}
|
||||
Unit<?> realDataUnit = gribRecord.getModelInfo()
|
||||
.getParameterUnitObject();
|
||||
Unit<?> expectedDataUnit = getCapability(ColorMapCapability.class)
|
||||
.getColorMapParameters().getDataUnit();
|
||||
|
@ -271,7 +286,7 @@ public class GridResource extends
|
|||
}
|
||||
}
|
||||
}
|
||||
GridGeometry2D realGridGeometry = ((GribRecord) pdo).getModelInfo()
|
||||
GridGeometry2D realGridGeometry = gribRecord.getModelInfo()
|
||||
.getLocation().getGridGeometry();
|
||||
GridGeometry2D expectedGridGeometry = this.gridGeometry[0];
|
||||
if (!realGridGeometry.equals(expectedGridGeometry)) {
|
||||
|
@ -707,7 +722,7 @@ public class GridResource extends
|
|||
}
|
||||
}
|
||||
GridMemoryBasedTileSet mbts = new GridMemoryBasedTileSet(
|
||||
record.getDataURI(), "Data", numLevels, 512, gridGeometry2D,
|
||||
record.getDataURI(), "Data", numLevels, 32, gridGeometry2D,
|
||||
this, conversion, PixelInCell.CELL_CORNER, record, viewType);
|
||||
return mbts;
|
||||
}
|
||||
|
|
|
@ -36,20 +36,32 @@ import com.raytheon.uf.common.dataplugin.grib.GribModel;
|
|||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.time.CombinedDataTime;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.DisplayType;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
|
||||
import com.raytheon.uf.viz.d2d.core.map.IDataScaleResource;
|
||||
import com.raytheon.uf.viz.d2d.core.time.LoadMode;
|
||||
import com.raytheon.uf.viz.d2d.core.time.TimeMatcher;
|
||||
import com.raytheon.viz.core.rsc.ICombinedResourceData;
|
||||
import com.raytheon.viz.grid.inv.GribDataCubeAlertMessageParser;
|
||||
import com.raytheon.viz.grid.inv.GridInventory;
|
||||
import com.raytheon.viz.grid.rsc.general.D2DGribGridResource;
|
||||
import com.raytheon.viz.grid.rsc.general.DifferenceGridResourceData;
|
||||
import com.raytheon.viz.grid.util.TiltRequest;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* Resource data for grids from GribRecords
|
||||
|
@ -107,6 +119,31 @@ public class GridResourceData extends AbstractRequestableResourceData implements
|
|||
super.update(updateData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractVizResource<?, ?> construct(LoadProperties loadProperties,
|
||||
IDescriptor descriptor) throws VizException {
|
||||
DisplayType displayType = loadProperties.getCapabilities()
|
||||
.getCapability(this, DisplayTypeCapability.class)
|
||||
.getDisplayType();
|
||||
if (secondaryResourceData != null
|
||||
&& (displayType == DisplayType.BARB
|
||||
|| displayType == DisplayType.ARROW
|
||||
|| displayType == DisplayType.DUALARROW || displayType == DisplayType.STREAMLINE)) {
|
||||
// GribGridResource does not support diff through a secondary
|
||||
// resource, instead it must use a DifferenceGridResource.
|
||||
ResourcePair one = new ResourcePair();
|
||||
one.setResourceData(this);
|
||||
one.setLoadProperties(loadProperties);
|
||||
ResourcePair two = new ResourcePair();
|
||||
two.setResourceData(secondaryResourceData);
|
||||
two.setLoadProperties(loadProperties);
|
||||
this.secondaryResourceData = null;
|
||||
return new DifferenceGridResourceData(one, two).construct(
|
||||
loadProperties, descriptor);
|
||||
}
|
||||
return super.construct(loadProperties, descriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractVizResource<?, ?> constructResource(
|
||||
LoadProperties loadProperties, PluginDataObject[] objects)
|
||||
|
@ -121,33 +158,20 @@ public class GridResourceData extends AbstractRequestableResourceData implements
|
|||
case IMAGE:
|
||||
sampling = sampling == null ? true : sampling;
|
||||
return new GridResource(this, loadProperties);
|
||||
case STREAMLINE:
|
||||
sampling = sampling == null ? false : sampling;
|
||||
return new GridVectorResource(
|
||||
this,
|
||||
loadProperties,
|
||||
com.raytheon.viz.pointdata.PointWindDisplay.DisplayType.STREAMLINE);
|
||||
case BARB:
|
||||
sampling = sampling == null ? false : sampling;
|
||||
return new GridVectorResource(
|
||||
this,
|
||||
loadProperties,
|
||||
com.raytheon.viz.pointdata.PointWindDisplay.DisplayType.BARB);
|
||||
case ICON:
|
||||
sampling = sampling == null ? false : sampling;
|
||||
return new GridIconResource(this, loadProperties);
|
||||
case BARB:
|
||||
case ARROW:
|
||||
sampling = sampling == null ? false : sampling;
|
||||
return new GridVectorResource(
|
||||
this,
|
||||
loadProperties,
|
||||
com.raytheon.viz.pointdata.PointWindDisplay.DisplayType.ARROW);
|
||||
case DUALARROW:
|
||||
case STREAMLINE:
|
||||
// TODO eventually contour and image should also use
|
||||
// D2DGribGridResource so that all data requesta nd transform of
|
||||
// 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;
|
||||
return new GridVectorResource(
|
||||
this,
|
||||
loadProperties,
|
||||
com.raytheon.viz.pointdata.PointWindDisplay.DisplayType.DUALARROW);
|
||||
return new D2DGribGridResource(this, loadProperties);
|
||||
case CONTOUR:
|
||||
default:
|
||||
sampling = sampling == null ? false : sampling;
|
||||
|
@ -155,12 +179,6 @@ public class GridResourceData extends AbstractRequestableResourceData implements
|
|||
}
|
||||
}
|
||||
|
||||
protected AbstractVizResource<?, ?> constructResource(DataTime[] dataTimes,
|
||||
LoadProperties loadProperties, PluginDataObject[] objects)
|
||||
throws VizException {
|
||||
return constructResource(loadProperties, objects);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the records
|
||||
*/
|
||||
|
@ -310,7 +328,6 @@ public class GridResourceData extends AbstractRequestableResourceData implements
|
|||
|
||||
}
|
||||
List<DataTime> availDataTimes = new ArrayList<DataTime>();
|
||||
int j = 0;
|
||||
for (int i = 0; i < primaryTimes.length; i++) {
|
||||
if (primaryTimes[i] != null && secondaryTimes[i] != null) {
|
||||
availDataTimes.add(new CombinedDataTime(
|
||||
|
@ -497,4 +514,38 @@ public class GridResourceData extends AbstractRequestableResourceData implements
|
|||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IDataRecord[] getDataRecordsForTilt(GribRecord record,
|
||||
IDescriptor descriptor) throws VizException {
|
||||
if (record.getModelInfo().getLevel().getMasterLevel().getName()
|
||||
.equals("TILT")) {
|
||||
Coordinate tiltLoc = findTiltLocation(descriptor.getResourceList());
|
||||
if (tiltLoc != null) {
|
||||
TiltRequest request = new TiltRequest();
|
||||
request.setType(Request.Type.ALL);
|
||||
request.setTiltLocation(tiltLoc);
|
||||
return DataCubeContainer.getDataRecord(record, request, null);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
private static Coordinate findTiltLocation(ResourceList resourceList) {
|
||||
for (ResourcePair rp : resourceList) {
|
||||
AbstractResourceData resourceData = rp.getResourceData();
|
||||
AbstractVizResource<?, ?> resource = rp.getResource();
|
||||
if (resource instanceof IDataScaleResource) {
|
||||
return ((IDataScaleResource) resource).getCenterLocation();
|
||||
}
|
||||
if (resourceData instanceof IResourceGroup) {
|
||||
Coordinate tiltLoc = findTiltLocation(((IResourceGroup) resourceData)
|
||||
.getResourceList());
|
||||
if (tiltLoc != null) {
|
||||
return tiltLoc;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,6 +103,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* addition to wind speed when sampling
|
||||
* is on.
|
||||
* 01/31/12 14306 kshresth Cursor readout as you sample the dispay
|
||||
* 02/10/12 14472 mhuang Fixed VB 'Height' field legend display error
|
||||
* when click 'Diff' button.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -178,8 +180,18 @@ public class GridVectorResource extends AbstractMapVectorResource implements
|
|||
match.setParameterName(Arrays.asList(modelInfo
|
||||
.getParameterAbbreviation()));
|
||||
match.setCreatingEntityNames(Arrays.asList(modelInfo.getModelName()));
|
||||
String parameterName = modelInfo.getParameterName();
|
||||
StyleType st = null;
|
||||
if (parameterName.equals("Height")) {
|
||||
st = StyleType.CONTOUR;
|
||||
} else if (parameterName.equals("Wind") || parameterName.equals("Total Wind")
|
||||
|| parameterName.equals("Total Wind (Vector)")) {
|
||||
st = StyleType.ARROW;
|
||||
} else {
|
||||
st = StyleType.IMAGERY;
|
||||
}
|
||||
StyleRule secondaryStyleRule = StyleManager.getInstance()
|
||||
.getStyleRule(StyleType.IMAGERY, match);
|
||||
.getStyleRule(st, match);
|
||||
if (secondaryStyleRule != null
|
||||
&& secondaryStyleRule.getPreferences()
|
||||
.getDisplayUnitLabel() != null) {
|
||||
|
@ -189,7 +201,6 @@ public class GridVectorResource extends AbstractMapVectorResource implements
|
|||
legendParams.model = modelInfo;
|
||||
legendParams.unit = secondaryUnits;
|
||||
legendParams.dataTime = getDisplayedDataTime();
|
||||
legendParams.type = "Img";
|
||||
secondaryName = secondaryGenerator.getName(legendParams,
|
||||
((GridResourceData) resourceData).secondaryResourceData);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -29,6 +29,8 @@ import java.util.Map;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.measure.Measure;
|
||||
import javax.measure.quantity.Angle;
|
||||
import javax.measure.unit.NonSI;
|
||||
import javax.measure.unit.Unit;
|
||||
import javax.measure.unit.UnitFormat;
|
||||
|
||||
|
@ -48,6 +50,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapLoader;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderable;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
|
@ -179,6 +182,9 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
});
|
||||
dataTimes = new ArrayList<DataTime>();
|
||||
requestJob = new GridDataRequestJob(this);
|
||||
// Capabilities need to be inited in construction for things like the
|
||||
// image combination tool.
|
||||
initCapabilities();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -284,7 +290,6 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
initCapabilities();
|
||||
initStylePreferences();
|
||||
initSampling();
|
||||
}
|
||||
|
@ -444,7 +449,7 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
if (params.getColorMapName() == null) {
|
||||
params.setColorMapName("Grid/gridded data");
|
||||
}
|
||||
params.setColorMap(target.buildColorMap(params
|
||||
params.setColorMap(ColorMapLoader.loadColorMap(params
|
||||
.getColorMapName()));
|
||||
}
|
||||
this.getCapability(ColorMapCapability.class)
|
||||
|
@ -592,12 +597,9 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
synchronized (requestJob) {
|
||||
GeneralGridData data = this.data.get(time);
|
||||
if (data == null) {
|
||||
List<PluginDataObject> pdoList = pdos.get(time);
|
||||
if (pdoList != null) {
|
||||
data = requestJob.requestData(time, pdoList);
|
||||
if (data != null) {
|
||||
this.data.put(time, data);
|
||||
}
|
||||
data = requestJob.requestData(time, pdos.get(time));
|
||||
if (data != null) {
|
||||
this.data.put(time, data);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
|
@ -678,13 +680,17 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
return descriptor.getTimeForResource(this);
|
||||
}
|
||||
|
||||
public Measure<Float, ?> inspectValue(ReferencedCoordinate coord)
|
||||
throws VizException {
|
||||
protected GeneralGridData getCurrentData() {
|
||||
DataTime time = getTimeForResource();
|
||||
if (time == null) {
|
||||
return null;
|
||||
}
|
||||
GeneralGridData data = requestData(time);
|
||||
return requestData(time);
|
||||
}
|
||||
|
||||
public Measure<Float, ?> inspectValue(ReferencedCoordinate coord)
|
||||
throws VizException {
|
||||
GeneralGridData data = getCurrentData();
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -700,6 +706,7 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
throw new VizException(e);
|
||||
}
|
||||
|
||||
sampleInterpolion.setData(null);
|
||||
Unit<?> unit = data.getDataUnit();
|
||||
|
||||
if (stylePreferences != null) {
|
||||
|
@ -714,6 +721,32 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
return Measure.valueOf(value, unit);
|
||||
}
|
||||
|
||||
public Measure<Float, Angle> inspectDirection(ReferencedCoordinate coord)
|
||||
throws VizException {
|
||||
GeneralGridData data = getCurrentData();
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
if (!data.isVector()) {
|
||||
return null;
|
||||
}
|
||||
sampleInterpolion.setData(data.getDirection().array());
|
||||
float value = Float.NaN;
|
||||
try {
|
||||
Coordinate xy = coord.asPixel(descriptor.getGridGeometry());
|
||||
value = sampleInterpolion.getReprojectedGridCell((int) xy.x,
|
||||
(int) xy.y);
|
||||
} catch (FactoryException e) {
|
||||
throw new VizException(e);
|
||||
} catch (TransformException e) {
|
||||
throw new VizException(e);
|
||||
}
|
||||
|
||||
sampleInterpolion.setData(null);
|
||||
|
||||
return Measure.valueOf(value, NonSI.DEGREE_ANGLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String inspect(ReferencedCoordinate coord) throws VizException {
|
||||
Measure<Float, ?> value = inspectValue(coord);
|
||||
|
@ -723,8 +756,14 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
if (value.getValue().isNaN()) {
|
||||
return "NO DATA";
|
||||
}
|
||||
|
||||
return inspect(value);
|
||||
Measure<Float, Angle> dir = inspectDirection(coord);
|
||||
if (dir != null) {
|
||||
return String.format("%.0f\u00B0 ",
|
||||
dir.floatValue(NonSI.DEGREE_ANGLE))
|
||||
+ formatInspect(value);
|
||||
} else {
|
||||
return formatInspect(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -734,9 +773,19 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
* @param unit
|
||||
* @return
|
||||
*/
|
||||
protected String inspect(Measure<Float, ?> value) {
|
||||
if (value.getUnit() == null) {
|
||||
protected String formatInspect(Measure<Float, ?> value) {
|
||||
Unit<?> dataUnit = value.getUnit();
|
||||
|
||||
if (dataUnit == null) {
|
||||
return sampleFormat.format(value);
|
||||
}
|
||||
Unit<?> styleUnit = null;
|
||||
if (stylePreferences != null) {
|
||||
styleUnit = stylePreferences.getDisplayUnits();
|
||||
}
|
||||
if (dataUnit.equals(styleUnit)) {
|
||||
return sampleFormat.format(value.getValue())
|
||||
+ stylePreferences.getDisplayUnitLabel();
|
||||
} else {
|
||||
return sampleFormat.format(value.getValue())
|
||||
+ UnitFormat.getUCUMInstance().format(value.getUnit());
|
||||
|
@ -748,6 +797,7 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
pdos.remove(dataTime);
|
||||
data.remove(dataTime);
|
||||
requestJob.remove(dataTime);
|
||||
dataTimes.remove(dataTime);
|
||||
IRenderable renderable = renderables.remove(dataTime);
|
||||
if (renderable != null) {
|
||||
disposeRenderable(renderable);
|
||||
|
@ -790,7 +840,14 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
}
|
||||
renderables.clear();
|
||||
data.clear();
|
||||
}
|
||||
|
||||
protected List<PluginDataObject> getCurrentPluginDataObjects() {
|
||||
return pdos.get(getTimeForResource());
|
||||
}
|
||||
|
||||
protected List<PluginDataObject> getPluginDataObjects(DataTime time) {
|
||||
return pdos.get(time);
|
||||
}
|
||||
|
||||
public AbstractVizResource<?, ?> getArrowResource() throws VizException {
|
||||
|
@ -830,7 +887,8 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
public boolean isArrowVector() {
|
||||
DisplayType displayType = getDisplayType();
|
||||
return displayType == DisplayType.BARB
|
||||
|| displayType == DisplayType.STREAMLINE;
|
||||
|| displayType == DisplayType.STREAMLINE
|
||||
|| displayType == DisplayType.DUALARROW;
|
||||
}
|
||||
|
||||
public boolean isWindVector() {
|
||||
|
@ -840,7 +898,8 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
|
|||
}
|
||||
|
||||
public boolean isLoadableAsImage() {
|
||||
return true;
|
||||
DisplayType displayType = getDisplayType();
|
||||
return displayType != DisplayType.IMAGE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,313 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.grid.rsc.general;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.List;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.coverage.grid.GridEnvelope2D;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.DirectPosition2D;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grib.spatial.projections.GridCoverage;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.AbstractInterpolation;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator;
|
||||
import com.raytheon.uf.viz.core.rsc.DisplayType;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.viz.grid.rsc.GridNameGenerator;
|
||||
import com.raytheon.viz.grid.rsc.GridNameGenerator.IGridNameResource;
|
||||
import com.raytheon.viz.grid.rsc.GridNameGenerator.LegendParameters;
|
||||
import com.raytheon.viz.grid.rsc.GridResourceData;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
*
|
||||
* A much more complex grib grid resource that attempts to match A1 displays
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 9, 2011 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
public class D2DGribGridResource extends GribGridResource<GridResourceData>
|
||||
implements IGridNameResource {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(D2DGribGridResource.class);
|
||||
|
||||
private AbstractInterpolation reprojectionInterpolation;
|
||||
|
||||
public D2DGribGridResource(GridResourceData resourceData,
|
||||
LoadProperties loadProperties) {
|
||||
super(resourceData, loadProperties);
|
||||
if (resourceData.getNameGenerator() == null) {
|
||||
resourceData.setNameGenerator(new GridNameGenerator());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
for (GribRecord record : resourceData.getRecords()) {
|
||||
addDataObject(record);
|
||||
}
|
||||
super.initInternal(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDataObject(PluginDataObject pdo) {
|
||||
if (gribModel == null) {
|
||||
super.addDataObject(pdo);
|
||||
calculateReprojection();
|
||||
} else {
|
||||
super.addDataObject(pdo);
|
||||
}
|
||||
requestData(pdo.getDataTime());
|
||||
}
|
||||
|
||||
@Override
|
||||
public GridGeometry2D getGridGeometry() {
|
||||
if (reprojectionInterpolation == null) {
|
||||
return gribModel.getLocation().getGridGeometry();
|
||||
} else {
|
||||
return GridGeometry2D.wrap(reprojectionInterpolation
|
||||
.getTargetGeometry());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneralGridData getData(DataTime time, List<PluginDataObject> pdos)
|
||||
throws VizException {
|
||||
GeneralGridData data = null;
|
||||
if (pdos == null) {
|
||||
return null;
|
||||
}
|
||||
// Attempt to figure out if there is a special tilt data request.
|
||||
GribRecord gribRecord = (GribRecord) pdos.get(0);
|
||||
IDataRecord[] recs = GridResourceData.getDataRecordsForTilt(gribRecord,
|
||||
descriptor);
|
||||
if (recs != null) {
|
||||
data = getData(recs, gribRecord.getModelInfo()
|
||||
.getParameterUnitObject());
|
||||
}
|
||||
// If there was no special tilt data just request data from super.
|
||||
if (data == null) {
|
||||
data = super.getData(time, pdos);
|
||||
}
|
||||
// Now reproject if we need to.
|
||||
if (reprojectionInterpolation != null) {
|
||||
try {
|
||||
if (data.isVector()) {
|
||||
reprojectionInterpolation.setData(data.getUComponent()
|
||||
.array());
|
||||
float[] udata = reprojectionInterpolation
|
||||
.getReprojectedGrid();
|
||||
reprojectionInterpolation.setData(data.getVComponent()
|
||||
.array());
|
||||
float[] vdata = reprojectionInterpolation
|
||||
.getReprojectedGrid();
|
||||
// When reprojecting it is necessary to recalculate the
|
||||
// direction of vectors based off the change in the "up"
|
||||
// direction
|
||||
GridGeometry2D sourceGeometry = GridGeometry2D
|
||||
.wrap(reprojectionInterpolation.getSourceGeometry());
|
||||
GridGeometry2D targetGeometry = GridGeometry2D
|
||||
.wrap(reprojectionInterpolation.getTargetGeometry());
|
||||
GridEnvelope2D targetRange = targetGeometry
|
||||
.getGridRange2D();
|
||||
|
||||
MathTransform grid2crs = targetGeometry.getGridToCRS();
|
||||
MathTransform crs2ll = MapUtil
|
||||
.getTransformToLatLon(targetGeometry
|
||||
.getCoordinateReferenceSystem());
|
||||
|
||||
for (int i = 0; i < targetRange.width; i++) {
|
||||
for (int j = 0; j < targetRange.height; j++) {
|
||||
int index = i + j * targetRange.width;
|
||||
if (udata[index] > -9999) {
|
||||
DirectPosition2D dp = new DirectPosition2D(i, j);
|
||||
grid2crs.transform(dp, dp);
|
||||
crs2ll.transform(dp, dp);
|
||||
Coordinate ll = new Coordinate(dp.x, dp.y);
|
||||
double rot = MapUtil.rotation(ll,
|
||||
targetGeometry);
|
||||
double rot2 = MapUtil.rotation(ll,
|
||||
sourceGeometry);
|
||||
double cos = Math.cos(Math.toRadians(180 + rot
|
||||
- rot2));
|
||||
double sin = Math.sin(Math.toRadians(180 + rot
|
||||
- rot2));
|
||||
double u = udata[index];
|
||||
double v = vdata[index];
|
||||
udata[index] = (float) (cos * u - sin * v);
|
||||
vdata[index] = (float) (sin * u + cos * v);
|
||||
}
|
||||
}
|
||||
}
|
||||
data = GeneralGridData.createVectorDataUV(
|
||||
FloatBuffer.wrap(udata), FloatBuffer.wrap(vdata),
|
||||
data.getDataUnit());
|
||||
|
||||
} else {
|
||||
reprojectionInterpolation.setData(data.getScalarData()
|
||||
.array());
|
||||
float[] fdata = reprojectionInterpolation
|
||||
.getReprojectedGrid();
|
||||
data = GeneralGridData.createScalarData(
|
||||
FloatBuffer.wrap(fdata), data.getDataUnit());
|
||||
}
|
||||
} catch (TransformException e) {
|
||||
throw new VizException(e);
|
||||
} catch (FactoryException e) {
|
||||
throw new VizException(e);
|
||||
}
|
||||
}
|
||||
// TODO before contours can be switched, we need to handle vector
|
||||
// direction style rule and reprojection of this data.
|
||||
// TODO before imaging can be switched over data mapping needs to be
|
||||
// incorporated.
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LegendParameters getLegendParameters() {
|
||||
LegendParameters legendParams = new LegendParameters();
|
||||
legendParams.model = gribModel;
|
||||
List<PluginDataObject> pdos = getCurrentPluginDataObjects();
|
||||
if (pdos != null && !pdos.isEmpty()) {
|
||||
gribModel = ((GribRecord) pdos.get(0)).getModelInfo();
|
||||
}
|
||||
if (stylePreferences != null) {
|
||||
legendParams.unit = stylePreferences.getDisplayUnitLabel();
|
||||
}
|
||||
if (legendParams.unit == null) {
|
||||
legendParams.unit = legendParams.model.getParameterUnit();
|
||||
}
|
||||
DisplayType displayType = getDisplayType();
|
||||
if (displayType == DisplayType.STREAMLINE) {
|
||||
legendParams.type = " Streamlines";
|
||||
} else if (displayType == DisplayType.BARB) {
|
||||
legendParams.type = "Wind Barbs";
|
||||
} else if (displayType == DisplayType.ARROW) {
|
||||
legendParams.type = "Arrows";
|
||||
} else if (displayType == DisplayType.IMAGE) {
|
||||
legendParams.type = "Img";
|
||||
}
|
||||
|
||||
return legendParams;
|
||||
}
|
||||
|
||||
private void calculateReprojection() {
|
||||
if (descriptor == null || gribModel == null) {
|
||||
return;
|
||||
}
|
||||
GridCoverage location = gribModel.getLocation();
|
||||
if (location != null && location.getSpacingUnit().equals("degree")) {
|
||||
double dx = location.getDx();
|
||||
Integer nx = location.getNx();
|
||||
if (dx * nx >= 360) {
|
||||
try {
|
||||
GridGeometry2D sourceGeometry = location.getGridGeometry();
|
||||
GeneralGridGeometry targetGeometry = sourceGeometry;
|
||||
if (descriptor != null) {
|
||||
targetGeometry = MapUtil.reprojectGeometry(
|
||||
sourceGeometry, descriptor.getGridGeometry()
|
||||
.getEnvelope(), true);
|
||||
}
|
||||
reprojectionInterpolation = new BilinearInterpolation(
|
||||
sourceGeometry, targetGeometry);
|
||||
clearRequestedData();
|
||||
} catch (Exception e) {
|
||||
reprojectionInterpolation = null;
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"Error reprojecting grid, grid will not be reprojected",
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void project(CoordinateReferenceSystem crs) throws VizException {
|
||||
super.project(crs);
|
||||
calculateReprojection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDescriptor(IMapDescriptor descriptor) {
|
||||
super.setDescriptor(descriptor);
|
||||
calculateReprojection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String inspect(ReferencedCoordinate coord) throws VizException {
|
||||
if (resourceData.isSampling()) {
|
||||
return gribModel.getParameterAbbreviation() + " = "
|
||||
+ super.inspect(coord);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (resourceData == null) {
|
||||
return super.getName();
|
||||
}
|
||||
AbstractNameGenerator generator = resourceData.getNameGenerator();
|
||||
if (generator == null) {
|
||||
return super.getName();
|
||||
}
|
||||
return generator.getName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLoadableAsImage() {
|
||||
DisplayType displayType = getDisplayType();
|
||||
return displayType == DisplayType.CONTOUR;
|
||||
}
|
||||
|
||||
}
|
|
@ -39,8 +39,11 @@ import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation;
|
|||
import com.raytheon.uf.common.time.CombinedDataTime;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.GroupNamingCapability;
|
||||
import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
|
||||
import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation;
|
||||
|
@ -64,7 +67,8 @@ import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineUtil;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class DifferenceGridResource extends
|
||||
AbstractGridResource<DifferenceGridResourceData> {
|
||||
AbstractGridResource<DifferenceGridResourceData> implements
|
||||
IResourceGroup {
|
||||
|
||||
// Defines a constant size for the difference grid
|
||||
private static final GridEnvelope GRID_ENVELOPE = new GeneralGridEnvelope(
|
||||
|
@ -89,9 +93,9 @@ public class DifferenceGridResource extends
|
|||
|
||||
@Override
|
||||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
super.initInternal(target);
|
||||
one.init(target);
|
||||
two.init(target);
|
||||
super.initInternal(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,6 +104,13 @@ public class DifferenceGridResource extends
|
|||
super.initCapabilities();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
paintProps.setDataTime(null);
|
||||
super.paintInternal(target, paintProps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParamLevelMatchCriteria getMatchCriteria() {
|
||||
return one.getMatchCriteria();
|
||||
|
@ -266,4 +277,9 @@ public class DifferenceGridResource extends
|
|||
CombineOperation.DIFFERENCE) + " " + oneTime.getLegendString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceList getResourceList() {
|
||||
return resourceData.getResourceList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,9 @@ import java.util.Arrays;
|
|||
|
||||
import javax.measure.unit.NonSI;
|
||||
import javax.measure.unit.SI;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
|
@ -52,11 +55,14 @@ import com.raytheon.uf.viz.core.rsc.ResourceList;
|
|||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class DifferenceGridResourceData extends AbstractResourceData implements
|
||||
IResourceGroup {
|
||||
|
||||
@XmlElement
|
||||
private ResourcePair one;
|
||||
|
||||
@XmlElement
|
||||
private ResourcePair two;
|
||||
|
||||
private ResourceList resourceList;
|
||||
|
|
|
@ -207,8 +207,8 @@ public class GeneralGridData {
|
|||
vComponent.rewind();
|
||||
direction = FloatBuffer.allocate(uComponent.capacity());
|
||||
while (vComponent.hasRemaining()) {
|
||||
direction.put((float) Math.atan2(uComponent.get(),
|
||||
vComponent.get()));
|
||||
direction.put((float) Math.toDegrees(Math.atan2(
|
||||
uComponent.get(), vComponent.get())));
|
||||
}
|
||||
uComponent.rewind();
|
||||
vComponent.rewind();
|
||||
|
|
|
@ -21,42 +21,27 @@ package com.raytheon.viz.grid.rsc.general;
|
|||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import javax.measure.Measure;
|
||||
import javax.measure.unit.Unit;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.grib.GribModel;
|
||||
import com.raytheon.uf.common.dataplugin.grib.GribRecord;
|
||||
import com.raytheon.uf.common.dataplugin.grib.spatial.projections.GridCoverage;
|
||||
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.AbstractInterpolation;
|
||||
import com.raytheon.uf.common.geospatial.interpolation.BilinearInterpolation;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
import com.raytheon.uf.viz.core.rsc.DisplayType;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
|
||||
import com.raytheon.uf.viz.core.style.level.Level;
|
||||
import com.raytheon.uf.viz.core.style.level.SingleLevel;
|
||||
import com.raytheon.viz.grid.GridLevelTranslator;
|
||||
import com.raytheon.viz.grid.rsc.GridNameGenerator.IGridNameResource;
|
||||
import com.raytheon.viz.grid.rsc.GridNameGenerator.LegendParameters;
|
||||
import com.raytheon.viz.grid.rsc.GridResourceData;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -75,27 +60,21 @@ import com.raytheon.viz.grid.rsc.GridResourceData;
|
|||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GribGridResource extends AbstractGridResource<GridResourceData>
|
||||
implements IGridNameResource {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AbstractGridResource.class);
|
||||
public class GribGridResource<T extends AbstractResourceData> extends
|
||||
AbstractGridResource<T> {
|
||||
|
||||
private GribModel gribModel;
|
||||
protected GribModel gribModel;
|
||||
|
||||
private AbstractInterpolation reprojectionInterpolation;
|
||||
|
||||
protected GribGridResource(GridResourceData resourceData,
|
||||
LoadProperties loadProperties) {
|
||||
public GribGridResource(T resourceData, LoadProperties loadProperties) {
|
||||
super(resourceData, loadProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addDataObject(PluginDataObject pdo) {
|
||||
public void addDataObject(PluginDataObject pdo) {
|
||||
if (pdo instanceof GribRecord) {
|
||||
if (gribModel == null) {
|
||||
GribRecord gribRecord = (GribRecord) pdo;
|
||||
gribModel = gribRecord.getModelInfo();
|
||||
calculateReprojection();
|
||||
}
|
||||
super.addDataObject(pdo);
|
||||
}
|
||||
|
@ -103,58 +82,26 @@ public class GribGridResource extends AbstractGridResource<GridResourceData>
|
|||
|
||||
@Override
|
||||
public GridGeometry2D getGridGeometry() {
|
||||
if (reprojectionInterpolation == null) {
|
||||
return gribModel.getLocation().getGridGeometry();
|
||||
} else {
|
||||
return GridGeometry2D.wrap(reprojectionInterpolation
|
||||
.getTargetGeometry());
|
||||
}
|
||||
return gribModel.getLocation().getGridGeometry();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneralGridData getData(DataTime time, List<PluginDataObject> pdos)
|
||||
throws VizException {
|
||||
GribRecord gribRecord = (GribRecord) pdos.get(0);
|
||||
GeneralGridData data = getData(gribRecord);
|
||||
if (reprojectionInterpolation != null) {
|
||||
try {
|
||||
if (data.isVector()) {
|
||||
reprojectionInterpolation.setData(data.getUComponent()
|
||||
.array());
|
||||
float[] udata = reprojectionInterpolation
|
||||
.getReprojectedGrid();
|
||||
reprojectionInterpolation.setData(data.getVComponent()
|
||||
.array());
|
||||
float[] vdata = reprojectionInterpolation
|
||||
.getReprojectedGrid();
|
||||
data = GeneralGridData.createVectorDataUV(
|
||||
FloatBuffer.wrap(udata), FloatBuffer.wrap(vdata),
|
||||
data.getDataUnit());
|
||||
} else {
|
||||
reprojectionInterpolation.setData(data.getScalarData()
|
||||
.array());
|
||||
float[] fdata = reprojectionInterpolation
|
||||
.getReprojectedGrid();
|
||||
data = GeneralGridData.createScalarData(
|
||||
FloatBuffer.wrap(fdata), data.getDataUnit());
|
||||
}
|
||||
} catch (TransformException e) {
|
||||
throw new VizException(e);
|
||||
} catch (FactoryException e) {
|
||||
throw new VizException(e);
|
||||
}
|
||||
if (pdos == null) {
|
||||
return null;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private GeneralGridData getData(GribRecord gribRecord) throws VizException {
|
||||
GribRecord gribRecord = (GribRecord) pdos.get(0);
|
||||
Unit<?> dataUnit = gribRecord.getModelInfo().getParameterUnitObject();
|
||||
IDataRecord[] dataRecs = DataCubeContainer.getDataRecord(gribRecord);
|
||||
return getData(dataRecs, dataUnit);
|
||||
}
|
||||
|
||||
protected GeneralGridData getData(IDataRecord[] dataRecs, Unit<?> dataUnit) {
|
||||
if (dataRecs.length == 1) {
|
||||
if (dataRecs[0] instanceof FloatDataRecord) {
|
||||
float[] fdata = ((FloatDataRecord) dataRecs[0]).getFloatData();
|
||||
return GeneralGridData.createScalarData(
|
||||
FloatBuffer.wrap(fdata), dataUnit);
|
||||
wrapDataRecord(dataRecs[0]), dataUnit);
|
||||
}
|
||||
} else if (dataRecs.length == 2) {
|
||||
FloatBuffer mag = wrapDataRecord(dataRecs[0]);
|
||||
|
@ -170,9 +117,15 @@ public class GribGridResource extends AbstractGridResource<GridResourceData>
|
|||
return null;
|
||||
}
|
||||
|
||||
private FloatBuffer wrapDataRecord(IDataRecord record) {
|
||||
protected FloatBuffer wrapDataRecord(IDataRecord record) {
|
||||
if (record instanceof FloatDataRecord) {
|
||||
float[] fdata = ((FloatDataRecord) record).getFloatData();
|
||||
fdata = Arrays.copyOf(fdata, fdata.length);
|
||||
for (int i = 0; i < fdata.length; i++) {
|
||||
if (fdata[i] <= -9999) {
|
||||
fdata[i] = Float.NaN;
|
||||
}
|
||||
}
|
||||
return FloatBuffer.wrap(fdata);
|
||||
}
|
||||
return null;
|
||||
|
@ -180,6 +133,9 @@ public class GribGridResource extends AbstractGridResource<GridResourceData>
|
|||
|
||||
@Override
|
||||
public ParamLevelMatchCriteria getMatchCriteria() {
|
||||
if (gribModel == null) {
|
||||
return null;
|
||||
}
|
||||
ParamLevelMatchCriteria criteria = new ParamLevelMatchCriteria();
|
||||
criteria.setParameterName(new ArrayList<String>());
|
||||
criteria.setLevels(new ArrayList<Level>());
|
||||
|
@ -201,67 +157,13 @@ public class GribGridResource extends AbstractGridResource<GridResourceData>
|
|||
}
|
||||
|
||||
@Override
|
||||
public LegendParameters getLegendParameters() {
|
||||
LegendParameters legendParams = new LegendParameters();
|
||||
legendParams.model = gribModel;
|
||||
if (stylePreferences != null) {
|
||||
legendParams.unit = stylePreferences.getDisplayUnitLabel();
|
||||
}
|
||||
if (legendParams.unit == null) {
|
||||
legendParams.unit = gribModel.getParameterUnit();
|
||||
}
|
||||
legendParams.type = DisplayType.getAbbreviation(getDisplayType());
|
||||
|
||||
return legendParams;
|
||||
}
|
||||
|
||||
private void calculateReprojection() {
|
||||
GridCoverage location = gribModel.getLocation();
|
||||
if (descriptor != null && location != null
|
||||
&& location.getSpacingUnit().equals("degree")) {
|
||||
double dx = location.getDx();
|
||||
Integer nx = location.getNx();
|
||||
if (dx * nx >= 360) {
|
||||
try {
|
||||
GridGeometry2D sourceGeometry = location.getGridGeometry();
|
||||
GeneralGridGeometry targetGeometry = sourceGeometry;
|
||||
if (descriptor != null) {
|
||||
targetGeometry = MapUtil.reprojectGeometry(
|
||||
sourceGeometry, descriptor.getGridGeometry()
|
||||
.getEnvelope(), true);
|
||||
}
|
||||
reprojectionInterpolation = new BilinearInterpolation(
|
||||
sourceGeometry, targetGeometry);
|
||||
clearRequestedData();
|
||||
} catch (Exception e) {
|
||||
reprojectionInterpolation = null;
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"Error reprojecting grid, grid will not be reprojected",
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void project(CoordinateReferenceSystem crs) throws VizException {
|
||||
super.project(crs);
|
||||
calculateReprojection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDescriptor(IMapDescriptor descriptor) {
|
||||
super.setDescriptor(descriptor);
|
||||
calculateReprojection();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String inspect(Measure<Float, ?> value) {
|
||||
if (resourceData.isSampling()) {
|
||||
return super.inspect(value);
|
||||
public String getName() {
|
||||
if (gribModel == null) {
|
||||
return "Grib Data";
|
||||
} else {
|
||||
return null;
|
||||
return gribModel.getModelTitle() + " "
|
||||
+ gribModel.getLevel().toString() + " "
|
||||
+ gribModel.getParameterName();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
class GridDataRequestJob extends Job {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(Job.class);
|
||||
.getHandler(GridDataRequestJob.class);
|
||||
|
||||
private static class GridDataRequest {
|
||||
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* This software was developed andimport com.raytheon.uf.common.datastorage.Request;
|
||||
Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.grid.util;
|
||||
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
*
|
||||
* This class provides a way for resources to pass a point to the GribDataCube
|
||||
* adapter that will be used as the center of all TILT levels.
|
||||
*
|
||||
* TODO I dont like this class because it causes problems if one of these
|
||||
* Requests gets inadvertantly sent over to PyPies/HDF5. We need a better way to
|
||||
* communicate with the GribDataCubeAdapter
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 9, 2011 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
public class TiltRequest extends Request {
|
||||
|
||||
private Coordinate tiltLocation;
|
||||
|
||||
public Coordinate getTiltLocation() {
|
||||
return tiltLocation;
|
||||
}
|
||||
|
||||
public void setTiltLocation(Coordinate tiltLocation) {
|
||||
this.tiltLocation = tiltLocation;
|
||||
}
|
||||
|
||||
}
|
|
@ -19,14 +19,10 @@
|
|||
**/
|
||||
package com.raytheon.viz.grid.util;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import org.geotools.coverage.grid.GridEnvelope2D;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
|
@ -42,9 +38,8 @@ import com.raytheon.uf.common.geospatial.MapUtil;
|
|||
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.status.StatusConstants;
|
||||
import com.raytheon.viz.grid.Activator;
|
||||
import com.raytheon.viz.radar.util.StationUtils;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* Utility for generating grids of tilt heights for a Radar.
|
||||
|
@ -62,13 +57,59 @@ import com.raytheon.viz.radar.util.StationUtils;
|
|||
* @version 1.0
|
||||
*/
|
||||
public class TiltUtils {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(TiltUtils.class);
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TiltUtils.class);
|
||||
|
||||
private Map<Integer, double[]> gridRadiusCache = new HashMap<Integer, double[]>();
|
||||
private static class CacheKey {
|
||||
|
||||
private ConcurrentMap<Integer, Long> gridRadiusCacheTime = new ConcurrentHashMap<Integer, Long>();
|
||||
private final int coverageId;
|
||||
|
||||
private Timer purgeTimer;
|
||||
private final double lat;
|
||||
|
||||
private final double lon;
|
||||
|
||||
public CacheKey(int coverageId, double lon, double lat) {
|
||||
this.coverageId = coverageId;
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + coverageId;
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(lat);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(lon);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
CacheKey other = (CacheKey) obj;
|
||||
if (coverageId != other.coverageId)
|
||||
return false;
|
||||
if (Double.doubleToLongBits(lat) != Double
|
||||
.doubleToLongBits(other.lat))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(lon) != Double
|
||||
.doubleToLongBits(other.lon))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private Map<CacheKey, Reference<double[]>> gridRadiusCache = new HashMap<CacheKey, Reference<double[]>>();
|
||||
|
||||
private static TiltUtils instance;
|
||||
|
||||
|
@ -81,25 +122,7 @@ public class TiltUtils {
|
|||
}
|
||||
|
||||
private TiltUtils() {
|
||||
purgeTimer = new Timer();
|
||||
|
||||
TimerTask purgeTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
// keep last 10 minutes of heights
|
||||
long purgeTime = System.currentTimeMillis() - 600000;
|
||||
Iterator<Entry<Integer, Long>> iter = gridRadiusCacheTime
|
||||
.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entry<Integer, Long> entry = iter.next();
|
||||
if (entry.getValue() < purgeTime) {
|
||||
gridRadiusCache.remove(entry.getKey());
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
purgeTimer.schedule(purgeTask, 600, 600000);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,15 +132,32 @@ public class TiltUtils {
|
|||
* in degrees
|
||||
*/
|
||||
public FloatDataRecord getHeightGrid(GridCoverage coverage, double tilt) {
|
||||
Integer coverageId = coverage.getId();
|
||||
|
||||
RadarStation homeRadar = StationUtils.getInstance()
|
||||
.getHomeRadarStation();
|
||||
return getHeightGrid(homeRadar, coverage, tilt);
|
||||
}
|
||||
|
||||
if (homeRadar != null) {
|
||||
public FloatDataRecord getHeightGrid(Coordinate latLon,
|
||||
GridCoverage coverage, double tilt) {
|
||||
|
||||
RadarStation radar = StationUtils.getInstance().getClosestRadarStation(
|
||||
latLon.x, latLon.y);
|
||||
return getHeightGrid(radar, coverage, tilt);
|
||||
}
|
||||
|
||||
private FloatDataRecord getHeightGrid(RadarStation radar,
|
||||
GridCoverage coverage, double tilt) {
|
||||
CacheKey cacheKey = new CacheKey(coverage.getId(), radar.getLon(),
|
||||
radar.getLat());
|
||||
if (radar != null) {
|
||||
GridGeometry2D geometry = MapUtil.getGridGeometry(coverage);
|
||||
GridEnvelope2D gridRange = geometry.getGridRange2D();
|
||||
double[] radius = gridRadiusCache.get(coverageId);
|
||||
double[] radius = null;
|
||||
Reference<double[]> radiusRef = gridRadiusCache.get(cacheKey);
|
||||
if (radiusRef != null) {
|
||||
radius = radiusRef.get();
|
||||
}
|
||||
if (radius == null) {
|
||||
try {
|
||||
|
||||
|
@ -126,8 +166,8 @@ public class TiltUtils {
|
|||
MathTransform fromLatLon = MapUtil
|
||||
.getTransformFromLatLon(coverage.getCrs());
|
||||
|
||||
double[] radarLonLat = new double[] {
|
||||
homeRadar.getLon(), homeRadar.getLat() };
|
||||
double[] radarLonLat = new double[] { radar.getLon(),
|
||||
radar.getLat() };
|
||||
double[] radarCrsCoord = new double[2];
|
||||
fromLatLon.transform(radarLonLat, 0, radarCrsCoord, 0,
|
||||
1);
|
||||
|
@ -156,27 +196,31 @@ public class TiltUtils {
|
|||
// use geodetic calculator
|
||||
MathTransform gridToLatLon = geometry.getGridToCRS();
|
||||
|
||||
radius = getRadius(gridRange, gridToLatLon);
|
||||
radius = getRadius(radar, gridRange, gridToLatLon);
|
||||
|
||||
}
|
||||
gridRadiusCache.put(coverageId, radius);
|
||||
gridRadiusCache.put(cacheKey, new SoftReference<double[]>(
|
||||
radius));
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(
|
||||
Priority.PROBLEM,
|
||||
"Error occurred generating height grid for radar tilt",
|
||||
e);
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"Error occurred generating height grid for radar tilt",
|
||||
e);
|
||||
}
|
||||
}
|
||||
return getHeightGrid(gridRange, radius, tilt);
|
||||
return getHeightGrid(radar, gridRange, radius, tilt);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public FloatDataRecord getHeightGrid(GridEnvelope2D gridRange,
|
||||
MathTransform gridToLatLon, double tilt) {
|
||||
RadarStation homeRadar = StationUtils.getInstance()
|
||||
.getHomeRadarStation();
|
||||
|
||||
try {
|
||||
double[] radius = getRadius(gridRange, gridToLatLon);
|
||||
return getHeightGrid(gridRange, radius, tilt);
|
||||
double[] radius = getRadius(homeRadar, gridRange, gridToLatLon);
|
||||
return getHeightGrid(homeRadar, gridRange, radius, tilt);
|
||||
} catch (TransformException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred generating height grid for radar tilt", e);
|
||||
|
@ -184,11 +228,9 @@ public class TiltUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
private FloatDataRecord getHeightGrid(GridEnvelope2D gridRange,
|
||||
double[] radius, double tilt) {
|
||||
RadarStation homeRadar = StationUtils.getInstance()
|
||||
.getHomeRadarStation();
|
||||
float elevMeter = homeRadar.getElevMeter();
|
||||
private FloatDataRecord getHeightGrid(RadarStation radar,
|
||||
GridEnvelope2D gridRange, double[] radius, double tilt) {
|
||||
float elevMeter = radar.getElevMeter();
|
||||
double tanTilt = Math.tan(Math.toRadians(tilt));
|
||||
float[] floatData = new float[radius.length];
|
||||
for (int i = 0; i < radius.length; i++) {
|
||||
|
@ -202,10 +244,8 @@ public class TiltUtils {
|
|||
return fdr;
|
||||
}
|
||||
|
||||
private double[] getRadius(GridEnvelope2D gridRange,
|
||||
private double[] getRadius(RadarStation radar, GridEnvelope2D gridRange,
|
||||
MathTransform gridToLatLon) throws TransformException {
|
||||
RadarStation homeRadar = StationUtils.getInstance()
|
||||
.getHomeRadarStation();
|
||||
int numPoints = gridRange.height * gridRange.width;
|
||||
int offset = 0;
|
||||
double[] gridCoordGrid = new double[numPoints * 2];
|
||||
|
@ -220,7 +260,7 @@ public class TiltUtils {
|
|||
|
||||
double[] radius = new double[numPoints];
|
||||
GeodeticCalculator gc = new GeodeticCalculator();
|
||||
gc.setStartingGeographicPoint(homeRadar.getLon(), homeRadar.getLat());
|
||||
gc.setStartingGeographicPoint(radar.getLon(), radar.getLat());
|
||||
offset = 0;
|
||||
|
||||
for (int i = 0; i < numPoints; i++) {
|
||||
|
|
|
@ -1490,25 +1490,16 @@ public class MultiPointResource extends
|
|||
|
||||
Envelope env = new Envelope(coord);
|
||||
List<?> elements = strTree.query(env);
|
||||
if (elements.size() > 0) {
|
||||
Iterator<?> iter = elements.iterator();
|
||||
/* Take the first one in the list */
|
||||
if (iter.hasNext()) {
|
||||
/* element 0 = Coordinate, 1 = inspectString */
|
||||
ArrayList<?> data = (ArrayList<?>) iter.next();
|
||||
|
||||
Shell shell = PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getShell();
|
||||
|
||||
GageData gage = getGageData((Coordinate) data.get(0));
|
||||
|
||||
if ((ts == null) || !ts.isOpen()) {
|
||||
ts = new TimeSeriesDlg(shell, gage, true);
|
||||
ts.open();
|
||||
} else {
|
||||
ts.updateSelection(gage, true);
|
||||
}
|
||||
}
|
||||
GageData closestGage=getNearestPoint(coord,elements);
|
||||
if (closestGage!=null) {
|
||||
if ((ts == null) || !ts.isOpen()) {
|
||||
Shell shell = PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getShell();
|
||||
ts = new TimeSeriesDlg(shell, closestGage, true);
|
||||
ts.open();
|
||||
} else {
|
||||
ts.updateSelection(closestGage, true);
|
||||
}
|
||||
|
||||
} else {
|
||||
showMessage();
|
||||
|
@ -1549,18 +1540,8 @@ public class MultiPointResource extends
|
|||
Envelope env = new Envelope(coord);
|
||||
List<?> elements = strTree.query(env);
|
||||
if (elements.size() > 0) {
|
||||
List<?> data = elements;
|
||||
if (elements.size() > 1) {
|
||||
data = nearest(coord, elements);
|
||||
}
|
||||
if ((data != null) && (data.size() > 0)) {
|
||||
List<?> element = (List<?>) data.get(0);
|
||||
|
||||
if ((element != null) && (element.size() > 0)) {
|
||||
/* element 0 = Coordinate, 1 = inspectString */
|
||||
GageData gageData = getGageData((Coordinate) element
|
||||
.get(0));
|
||||
|
||||
GageData gageData = getNearestPoint(coord, elements);
|
||||
if ((gageData != null)) {
|
||||
String lid = gageData.getLid();
|
||||
String dataType = toPEDTSEP(gageData);
|
||||
String fcstType = null;
|
||||
|
@ -1610,7 +1591,6 @@ public class MultiPointResource extends
|
|||
showMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1655,35 +1635,37 @@ public class MultiPointResource extends
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the data from the input list that is closest to the given
|
||||
* Return the nearest data in the elements list to the given
|
||||
* coordinate latitude/longitude.
|
||||
*
|
||||
* @param coord
|
||||
* Reference coordinate latitude/longitude
|
||||
* @param list
|
||||
* @param elements
|
||||
* List of Coordinates
|
||||
* @return The closest data if found. If the input list is null or empty a
|
||||
* null reference is returned.
|
||||
*/
|
||||
private static ArrayList<?> nearest(Coordinate coord, List<?> list) {
|
||||
ArrayList<?> retList = null;
|
||||
|
||||
double minDist = Double.MAX_VALUE;
|
||||
if ((list != null) && (list.size() > 0)) {
|
||||
for (Object o : list) {
|
||||
if (o instanceof ArrayList<?>) {
|
||||
ArrayList<?> subList = (ArrayList<?>) o;
|
||||
Coordinate c = (Coordinate) subList.get(0);
|
||||
double dx = coord.x - c.x;
|
||||
double dy = coord.y - c.y;
|
||||
double dist = (dx * dx) + (dy * dy);
|
||||
if (dist < minDist) {
|
||||
minDist = dist;
|
||||
retList = subList;
|
||||
}
|
||||
}
|
||||
}
|
||||
private GageData getNearestPoint(Coordinate coord, List<?> elements) {
|
||||
if (elements ==null || elements.size() <= 0) {
|
||||
return null;
|
||||
}
|
||||
return retList;
|
||||
|
||||
Iterator<?> iter = elements.iterator();
|
||||
double minDistance=Double.MAX_VALUE;
|
||||
GageData closestGage=null;
|
||||
while (iter.hasNext()) {
|
||||
ArrayList<?> data = (ArrayList<?>) iter.next();
|
||||
|
||||
GageData gage = getGageData((Coordinate) data.get(0));
|
||||
double lon=gage.getLon();
|
||||
double lat=gage.getLat();
|
||||
double distance = Math.sqrt(Math.pow((lon-coord.x),2)+Math.pow((lat-coord.y), 2));
|
||||
if (distance < minDistance) {
|
||||
minDistance=distance;
|
||||
closestGage=gage;
|
||||
}
|
||||
}
|
||||
return closestGage;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -36,6 +36,7 @@ import com.raytheon.viz.hydrocommon.datamanager.HydroDBDataManager;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 19, 2008 1787 askripsky Initial creation
|
||||
* Mar 08, 2012 14600 wkwock Delete one lid instead of one group
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -378,7 +379,7 @@ public class RPFFcstPointData extends HydroDBData implements IHydroDBData {
|
|||
|
||||
@Override
|
||||
public String getDeleteStatement() {
|
||||
return "DELETE FROM rpffcstpoint WHERE group_id="
|
||||
return "DELETE FROM rpffcstpoint WHERE lid="+getDBString(lid)+" and group_id="
|
||||
+ getDBString(groupID);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,8 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jun 30, 2009 2524 snaples Initial creation
|
||||
*
|
||||
* Feb 29 2010 9909 lbousaidi changed the for loop for getting
|
||||
* the HRAP grid bin
|
||||
* </pre>
|
||||
*
|
||||
* @author snaples
|
||||
|
@ -220,9 +221,8 @@ public class PlotGriddedTempResource extends
|
|||
buf = FloatBuffer.allocate(hrap_grid.maxi * hrap_grid.maxj);
|
||||
|
||||
/* Get value in the HRAP grid bins. */
|
||||
// for (j = 0; j < hrap_grid.maxj; j++) {
|
||||
for (j = hrap_grid.maxj - 1; j >= 0; j--) {
|
||||
for (i = 0; i < hrap_grid.maxi; i++) {
|
||||
for (j = 0; j < hrap_grid.maxj; j++) {
|
||||
for (i = 0; i < hrap_grid.maxi; i++) {
|
||||
|
||||
if (hrap_grid.owner[i][j] == -1) {
|
||||
continue;
|
||||
|
|
|
@ -134,7 +134,7 @@ public class GetBasinData {
|
|||
mean_areal_precip_global[ib].basin = ppp;
|
||||
for (l = 0; l < numpts; l++) {
|
||||
ibuf = in.readLine().trim();
|
||||
String[] locs = ibuf.split(" ");
|
||||
String[] locs = ibuf.split("\\s+");
|
||||
lat = Double.parseDouble(locs[0].trim());
|
||||
lon = Double.parseDouble(locs[1].trim());
|
||||
|
||||
|
|
|
@ -21,9 +21,12 @@ package com.raytheon.viz.radar;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
|
@ -44,7 +47,9 @@ import com.raytheon.uf.common.dataplugin.radar.level3.WindBarbPacket;
|
|||
import com.raytheon.uf.common.dataplugin.radar.util.RadarConstants;
|
||||
import com.raytheon.uf.common.dataplugin.radar.util.RadarDataRetriever;
|
||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest.OrderMode;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||
import com.raytheon.uf.common.datastorage.DataStoreFactory;
|
||||
import com.raytheon.uf.common.datastorage.IDataStore;
|
||||
|
@ -63,7 +68,8 @@ import com.raytheon.viz.awipstools.common.StormTrackData;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 16, 2009 mnash Initial creation
|
||||
* Feb 16, 2009 mnash Initial creation
|
||||
* 03/07/2012 DR 14660 D. Friedman Added time-based getSTIData* functions.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -169,6 +175,11 @@ public class RadarHelper {
|
|||
public static final String[] rdaChannelStr = { "NWS Single Thread",
|
||||
"RDA 1", "RDA 2" };
|
||||
|
||||
/**
|
||||
* The default maximimum difference in time used when retrieving STI data (15 minutes.)
|
||||
*/
|
||||
public static final long DEFAULT_MAX_STI_TIME_DIFFERENCE = 15 * 60 * 1000;
|
||||
|
||||
/**
|
||||
* Returns the information in the packet to be processed
|
||||
*
|
||||
|
@ -352,4 +363,148 @@ public class RadarHelper {
|
|||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the STI data for the radar and time specified by the given
|
||||
* RadarRecord.
|
||||
*
|
||||
* @param referenceRecord
|
||||
* Specifies the radar and time to search for.
|
||||
* @return The STI data record for the specified radar and closest in time
|
||||
* to the specified time within
|
||||
* {@link #DEFAULT_MAX_STI_TIME_DIFFERENCE} or null if there isn't
|
||||
* any STI data that matches.
|
||||
* @throws VizException
|
||||
*/
|
||||
public static StormTrackData getSTIDataForRadarRecord(
|
||||
RadarRecord referenceRecord) throws VizException {
|
||||
return getSTIData(referenceRecord.getIcao(), referenceRecord
|
||||
.getDataTime().getRefTime(), DEFAULT_MAX_STI_TIME_DIFFERENCE);
|
||||
}
|
||||
|
||||
private static final SimpleDateFormat DATE_FORMAT;
|
||||
static {
|
||||
DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
DATE_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the specified STI data.
|
||||
*
|
||||
* @param icao
|
||||
* The ICAO of there radar whose STI data is to be returned
|
||||
* @param targetTime
|
||||
* If not null, specifies the center or a time range to search.
|
||||
* If null, the latest STI product is retrieved
|
||||
* (<strong>TODO</strong>: DOES NOT WORK because "order by" is
|
||||
* ignored by DbQueryHandler.)
|
||||
* @param maxTimeDifference
|
||||
* The maximum acceptable difference in time from targetTime, in
|
||||
* milliseconds.
|
||||
* @return The STI data or null if there isn't any STI data in the database
|
||||
* that matches the given criteria
|
||||
* @throws VizException
|
||||
*/
|
||||
public static StormTrackData getSTIData(String icao, Date targetTime, long maxTimeDifference) throws VizException {
|
||||
StormTrackData rval = null;
|
||||
Exception exc = null;
|
||||
try {
|
||||
RadarRecord record = null;
|
||||
DbQueryRequest request = new DbQueryRequest();
|
||||
request.setEntityClass(RadarRecord.class.getName());
|
||||
request.setOrderByField("dataTime.refTime", OrderMode.DESC);
|
||||
if (targetTime != null) {
|
||||
if (maxTimeDifference != 0) {
|
||||
maxTimeDifference = Math.abs(maxTimeDifference);
|
||||
request.addConstraint("dataTime.refTime",
|
||||
new RequestConstraint(DATE_FORMAT.format(new Date(targetTime.getTime() - maxTimeDifference)),
|
||||
ConstraintType.GREATER_THAN_EQUALS));
|
||||
request.addConstraint("dataTime.refTime",
|
||||
new RequestConstraint(DATE_FORMAT.format(new Date(targetTime.getTime() + maxTimeDifference)),
|
||||
ConstraintType.LESS_THAN_EQUALS));
|
||||
RequestConstraint timeConstraint = new RequestConstraint(null, ConstraintType.BETWEEN);
|
||||
timeConstraint.setBetweenValueList(new String[] {
|
||||
DATE_FORMAT.format(new Date(targetTime.getTime() - maxTimeDifference)),
|
||||
DATE_FORMAT.format(new Date(targetTime.getTime() + maxTimeDifference))
|
||||
});
|
||||
request.addConstraint("dataTime.refTime", timeConstraint);
|
||||
} else {
|
||||
request.addConstraint("dataTime.refTime",
|
||||
new RequestConstraint(DATE_FORMAT.format(targetTime)));
|
||||
}
|
||||
} else
|
||||
request.setLimit(1);
|
||||
request.addConstraint("productCode", new RequestConstraint("58"));
|
||||
request.addConstraint("icao", new RequestConstraint(icao));
|
||||
request.addConstraint("pluginName", new RequestConstraint("radar"));
|
||||
|
||||
DbQueryResponse response = (DbQueryResponse) ThriftClient
|
||||
.sendRequest(request);
|
||||
if (targetTime != null && maxTimeDifference != 0) {
|
||||
// Find the record closest in time to targetTime.
|
||||
long bestDifference = Long.MAX_VALUE;
|
||||
for (Map<String, Object> result : response.getResults()) {
|
||||
RadarRecord aRecord = (RadarRecord) result.get(null);;
|
||||
long difference = Math.abs(aRecord.getDataTime()
|
||||
.getRefTime().getTime() - targetTime.getTime());
|
||||
if (difference < bestDifference) {
|
||||
bestDifference = difference;
|
||||
record = aRecord;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Map<String, Object> result : response.getResults()) {
|
||||
record = (RadarRecord) result.get(null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (record != null) {
|
||||
// Populate the radar record with its data
|
||||
File loc = HDF5Util.findHDF5Location(record);
|
||||
IDataStore dataStore = DataStoreFactory.getDataStore(loc);
|
||||
RadarDataRetriever.populateRadarRecord(dataStore, record);
|
||||
|
||||
// Get the Tabular data from the record
|
||||
Map<RadarConstants.MapValues, Map<RadarConstants.MapValues, String>> stiMap = record
|
||||
.getMapRecordVals();
|
||||
|
||||
String stiDir = null;
|
||||
String stiSpeed = null;
|
||||
double direction = 0;
|
||||
double speed = 0;
|
||||
|
||||
// Get the speed and dir from the record
|
||||
if (stiMap != null) {
|
||||
stiDir = stiMap.get(RadarConstants.MapValues.STI_TYPE).get(
|
||||
RadarConstants.MapValues.STI_AVG_DIRECTION);
|
||||
stiSpeed = stiMap.get(RadarConstants.MapValues.STI_TYPE)
|
||||
.get(RadarConstants.MapValues.STI_AVG_SPEED);
|
||||
}
|
||||
|
||||
if (stiDir == null || stiSpeed == null ||
|
||||
stiDir.isEmpty() || stiSpeed.isEmpty()) {
|
||||
direction = 0;
|
||||
speed = 0;
|
||||
} else {
|
||||
direction = Double.parseDouble(stiDir);
|
||||
speed = Double.parseDouble(stiSpeed);
|
||||
}
|
||||
|
||||
// Populate the return data with the STI data
|
||||
rval = new StormTrackData();
|
||||
rval.setDate(record.getDataTime().getRefTime());
|
||||
rval.setMotionDirection(direction);
|
||||
rval.setMotionSpeed(speed);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
exc = e;
|
||||
} catch (StorageException e) {
|
||||
exc = e;
|
||||
}
|
||||
if (exc != null)
|
||||
throw new VizException(exc);
|
||||
return rval;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -124,7 +124,6 @@ public class RadarDefaultInterrogator implements IRadarInterrogator {
|
|||
units = UnitFormat.getUCUMInstance().format(dispUnit);
|
||||
}
|
||||
if (dataValue == 0) {
|
||||
dataMap.put("numericValue", null);
|
||||
dataValueString = "NO DATA";
|
||||
} else if (th0 instanceof Float) {
|
||||
double f0 = (Float) th0;
|
||||
|
|
|
@ -55,7 +55,8 @@ import com.raytheon.viz.radar.ui.RadarDisplayManager;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 2, 2010 mnash Initial creation
|
||||
* Jul 2, 2010 mnash Initial creation
|
||||
* 03/07/2012 DR 14660 D. Friedman Use getSTIDataForRadarRecord
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -169,7 +170,7 @@ public class RadarSRMResource extends RadarRadialResource implements
|
|||
}
|
||||
if (srmSource.equals(SRMSource.STI)) {
|
||||
sourceName = "STI";
|
||||
StormTrackData stormTrackData = RadarHelper.getSTIData(icao);
|
||||
StormTrackData stormTrackData = RadarHelper.getSTIDataForRadarRecord(record);
|
||||
if (stormTrackData != null && stormTrackData.isValid()) {
|
||||
direction = stormTrackData.getMotionDirection();
|
||||
speed = stormTrackData.getMotionSpeed();
|
||||
|
|
|
@ -73,27 +73,29 @@ public class StationUtils implements IToolChangedListener {
|
|||
// String site = lm.getCurrentSite();
|
||||
|
||||
Coordinate home = ToolsDataManager.getInstance().getHome();
|
||||
double lat = home.y;
|
||||
double lon = home.x;
|
||||
|
||||
GetRadarSpatialRequest request = new GetRadarSpatialRequest();
|
||||
request.setLat(lat);
|
||||
request.setLon(lon);
|
||||
try {
|
||||
Object response = ThriftClient.sendRequest(request);
|
||||
|
||||
if (response != null && response instanceof RadarStation) {
|
||||
station = (RadarStation) response;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to retrieve home radar", e);
|
||||
}
|
||||
return getClosestRadarStation(home.x, home.y);
|
||||
}
|
||||
|
||||
return station;
|
||||
}
|
||||
|
||||
public RadarStation getClosestRadarStation(double lon, double lat) {
|
||||
GetRadarSpatialRequest request = new GetRadarSpatialRequest();
|
||||
request.setLat(lat);
|
||||
request.setLon(lon);
|
||||
try {
|
||||
Object response = ThriftClient.sendRequest(request);
|
||||
|
||||
if (response != null && response instanceof RadarStation) {
|
||||
return (RadarStation) response;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to retrieve home radar", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
|
|
@ -63,6 +63,7 @@ import com.raytheon.viz.texteditor.alarmalert.util.AlarmBeepJob;
|
|||
* Sep 21, 2009 mnash Initial creation
|
||||
* Aug 16, 2010 2187 cjeanbap Fixed a NullPointerException
|
||||
* Dec 23, 2010 7375 cjeanbap Force dialog ON TOP of over Dialog/Windows.
|
||||
* 03/19/2012 D. Friedman Fix alarming. Disable runloop in open().
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
|
@ -178,7 +179,13 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
|
|||
public Object open(boolean alarm) {
|
||||
// setInitialDialogLocation();
|
||||
|
||||
if (alarmShell.isVisible()) {
|
||||
if (alarm) {
|
||||
// provides the beep to alert the user that an alarm has come in
|
||||
abj = new AlarmBeepJob("AlarmBeepJob");
|
||||
abj.schedule();
|
||||
}
|
||||
|
||||
if (alarmShell != null && alarmShell.isVisible()) {
|
||||
alarmShell.setVisible(true);
|
||||
} else {
|
||||
display = parentShell.getDisplay();
|
||||
|
@ -187,23 +194,21 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
|
|||
}
|
||||
alarmShell.setLocation(locationX, locationY);
|
||||
|
||||
if (alarm) {
|
||||
// provides the beep to alert the user that an alarm has come in
|
||||
abj = new AlarmBeepJob("AlarmBeepJob");
|
||||
abj.schedule();
|
||||
}
|
||||
|
||||
alarmShell.pack();
|
||||
alarmShell.setVisible(true);
|
||||
alarmShell.setActive();
|
||||
|
||||
/* // TODO: what is this for?
|
||||
while (!alarmShell.isDisposed()) {
|
||||
if (!display.isDisposed() && !display.readAndDispatch()) {
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*// TODO: put this in the correct location.
|
||||
labelFont.dispose();
|
||||
*/
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -62,7 +62,8 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
|
|||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 18, 2009 mnash Initial creation
|
||||
* Sep 18, 2009 mnash Initial creation
|
||||
* 03/19/2012 D. Friedman Fix determination of "Alarm" entries.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -146,17 +147,23 @@ public class AlarmAlertFunctions {
|
|||
for(AlarmAlertProduct p : prods) {
|
||||
String search = p.getSearchString();
|
||||
|
||||
boolean match = false;
|
||||
if((search != null) && (search.length() > 0)) {
|
||||
if(s.indexOf(search) >= 0) {
|
||||
if ("Alarm".equals(p.getAlarmType()) && p.isAlarm()) {
|
||||
alarm = true;
|
||||
}
|
||||
productFound = p;
|
||||
break;
|
||||
match = true;
|
||||
}
|
||||
} else {
|
||||
productFound = p;
|
||||
break;
|
||||
match = true;
|
||||
}
|
||||
if (match) {
|
||||
if (productFound == null)
|
||||
productFound = p;
|
||||
if ("Alarm".equals(p.getAlarmType()) && p.isAlarm()) {
|
||||
alarm = true;
|
||||
productFound = p;
|
||||
}
|
||||
if (alarm)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* convert longitudes for Alaska when
|
||||
* they're in Eastern Hemisphere; invoke
|
||||
* it in convertCoords().
|
||||
* Feb 29, 2012 #13596 Qinglu Lin Added restoreAlaskaLon().
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
|
@ -267,4 +268,24 @@ public class GisUtil {
|
|||
return Arrays.equals(old, neww);
|
||||
}
|
||||
|
||||
/**
|
||||
* restoreAlaskaLon()
|
||||
*
|
||||
* 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).
|
||||
*/
|
||||
public static Coordinate restoreAlaskaLon(Coordinate oldCoords) {
|
||||
Coordinate coord = new Coordinate();
|
||||
if (oldCoords.x < -180. && oldCoords.y > 45.) {
|
||||
coord.x = 360. + oldCoords.x;
|
||||
} else {
|
||||
coord.x = oldCoords.x;
|
||||
}
|
||||
coord.y = oldCoords.y;
|
||||
return coord;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue