12.3.1-10 baseline

Former-commit-id: 22bd792cd9 [formerly 0e4128712b [formerly 4068f5295f] [formerly 22bd792cd9 [formerly 7d62bca046401a670ef7bd917cbcbb073e061b60]]]
Former-commit-id: 0e4128712b [formerly 4068f5295f]
Former-commit-id: 0e4128712b
Former-commit-id: 760ead2047
This commit is contained in:
Steve Harris 2012-03-27 17:20:30 -05:00
parent b2394f317f
commit 5472b5f6bf
208 changed files with 10195 additions and 3681 deletions

View file

@ -62,6 +62,7 @@
<color r = "0.549019607843" g = "0.541176470588" b = "0.541176470588" a = "1.0" /> <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.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.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.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.874509803922" g = "0.325490196078" b = "0.674509803922" a = "1.0" />
<color r = "0.760784313725" g = "0.141176470588" b = "0.533333333333" a = "1.0" /> <color r = "0.760784313725" g = "0.141176470588" b = "0.533333333333" a = "1.0" />

View file

@ -1050,6 +1050,7 @@ Hazards_commonValues = [ \
"Advisories|Winter Weather|WW.Y", "Advisories|Winter Weather|WW.Y",
"Statements|Coastal Flooding|CF.S", "Statements|Coastal Flooding|CF.S",
"Statements|Coastal Flooding|LS.S", "Statements|Coastal Flooding|LS.S",
"Statements|Coastal Flooding|RP.S",
"Statements|Marine|MA.S", "Statements|Marine|MA.S",
] ]

View file

@ -337,7 +337,7 @@ class Procedure (SmartScript.SmartScript):
statMagSums[4]=statMagSums[3]*statMagSums[3] statMagSums[4]=statMagSums[3]*statMagSums[3]
statMagSums[7]=statMagSums[3]*statMagSums[5] statMagSums[7]=statMagSums[3]*statMagSums[5]
for k in xrange(numthresh): 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 # Setup place for sums
# #

View file

@ -61,7 +61,7 @@ if siteID == "GUM":
'Hydrology' : ["FF.A", "FA.A"], 'Hydrology' : ["FF.A", "FA.A"],
'Fire Weather' : ["FW.A", "FW.W"], 'Fire Weather' : ["FW.A", "FW.W"],
'Coastal Flood' : ["CF.S", "LS.S", "CF.Y", "CF.W", "CF.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", '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", "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", "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"], 'Fire Weather' : ["FW.A", "FW.W"],
'Convective Watches' : ["SV.A", "TO.A"], 'Convective Watches' : ["SV.A", "TO.A"],
'Coastal Flood' : ["CF.S", "LS.S", "CF.Y", "CF.W", "CF.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", '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", "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", "HZ.W", "HZ.A", "ZF.Y", "FR.Y", "HT.Y", "HW.W", "HW.A",

View file

@ -138,6 +138,7 @@ class CallToActions:
"MH.Y": self.ctaMHY, "MH.Y": self.ctaMHY,
"MS.Y": self.ctaMSY, "MS.Y": self.ctaMSY,
"RB.Y": self.ctaRBY, "RB.Y": self.ctaRBY,
"RP.S": self.ctaRPS,
"SC.Y": self.ctaSCY, "SC.Y": self.ctaSCY,
"SE.A": self.ctaSEA, "SE.A": self.ctaSEA,
"SE.W": self.ctaSEW, "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.""", """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): def ctaSCY(self):
return [ 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.""", """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.""",

View file

@ -431,13 +431,13 @@ class SAF_Overrides:
"PrePunctuation": "", "PrePunctuation": "",
"PostPunctuation": ", ", "PostPunctuation": ", ",
"Weekday" : { "Weekday" : {
0 : "Sunday", 6 : "Sunday",
1 : "Monday", 0 : "Monday",
2 : "Tuesday", 1 : "Tuesday",
3 : "Wednesday", 2 : "Wednesday",
4 : "Thursday", 3 : "Thursday",
5 : "Friday", 4 : "Friday",
6 : "Saturday" 5 : "Saturday"
}, },
"Now": "Now", "Now": "Now",
"Today":"Today", "Today":"Today",

View file

@ -156,7 +156,7 @@ class BOIVerifyUtility(SmartScript.SmartScript):
# #
# Setup DEBUG level # Setup DEBUG level
# #
self.DEBUG=10 self.DEBUG=0
# #
# Setup Observed file info # Setup Observed file info
# #

View file

@ -17,6 +17,13 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
SOFTWARE HISTORY
Date Ticket# Engineer Description
__________________________________________________________________________
02/28/2012 14536 Xiaochuan Changed DefaultRank to default
--> -->
<ScanConfigMesoTable> <ScanConfigMesoTable>
<LinkToFrame>false</LinkToFrame> <LinkToFrame>false</LinkToFrame>
@ -24,7 +31,7 @@
<TipsOption>false</TipsOption> <TipsOption>false</TipsOption>
<FilterOption>false</FilterOption> <FilterOption>false</FilterOption>
<ZoomFactor>4</ZoomFactor> <ZoomFactor>4</ZoomFactor>
<DefaultRank>mdaSR</DefaultRank> <DefaultRank>default</DefaultRank>
<!-- <!--
MESO Table attributes MESO Table attributes

View file

@ -20,9 +20,12 @@
SOFTWARE HISTORY 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> <ScanConfigTvsTable>
<LinkToFrame>false</LinkToFrame> <LinkToFrame>false</LinkToFrame>
@ -30,7 +33,7 @@
<TipsOption>false</TipsOption> <TipsOption>false</TipsOption>
<FilterOption>false</FilterOption> <FilterOption>false</FilterOption>
<ZoomFactor>4</ZoomFactor> <ZoomFactor>4</ZoomFactor>
<DefaultRank>ident</DefaultRank> <DefaultRank>default</DefaultRank>
<!-- <!--
TVS Table attributes TVS Table attributes

View file

@ -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.LongDataRecord;
import com.raytheon.uf.common.datastorage.records.ShortDataRecord; import com.raytheon.uf.common.datastorage.records.ShortDataRecord;
import com.raytheon.uf.common.datastorage.records.StringDataRecord; 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.library.DerivedParameterRequest;
import com.raytheon.uf.viz.derivparam.tree.CubeLevel; import com.raytheon.uf.viz.derivparam.tree.CubeLevel;
@ -55,7 +55,9 @@ import com.raytheon.uf.viz.derivparam.tree.CubeLevel;
* @version 1.0 * @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"; private static final String DATA_NAME = "Data";
@ -116,21 +118,13 @@ public class MasterDerivScript extends PythonScript {
jep.eval(functionCall.toString()); 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 @Override
protected void evaluateArgument(String argName, Object argValue) protected void evaluateArgument(String argName, Object argValue)
throws JepException { throws JepException {
if (prevArgs.containsKey(argValue)) { if (prevArgs.containsKey(argValue)) {
jep.eval(argName + " = " + prevArgs.get(argValue)); jep.eval(argName + " = " + prevArgs.get(argValue));
} else if (argValue instanceof List) { } else if (argValue instanceof List) {
@SuppressWarnings("unchecked") @SuppressWarnings({ "rawtypes" })
List valList = (List) argValue; List valList = (List) argValue;
Object val = valList.get(0); Object val = valList.get(0);
if (val instanceof CubeLevel) { if (val instanceof CubeLevel) {
@ -261,7 +255,6 @@ public class MasterDerivScript extends PythonScript {
/** /**
* Retrieves the result of the method execution * Retrieves the result of the method execution
*/ */
@Override
protected List<?> getExecutionResult() throws JepException { protected List<?> getExecutionResult() throws JepException {
// Retrieve the results and return them // Retrieve the results and return them
List<IDataRecord> result = null; List<IDataRecord> result = null;

View file

@ -37,6 +37,7 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 28, 2009 3963 dhladky Initial creation. * Dec 28, 2009 3963 dhladky Initial creation.
* March 5, 2012 14413 zhao Launch AreaConfigDlg w/o monitor
* *
* </pre> * </pre>
* *
@ -51,12 +52,12 @@ public class SafeseasAreaConfigAction extends AbstractHandler {
System.out.println("Activating/Action the Safeseas Area Config..."); System.out.println("Activating/Action the Safeseas Area Config...");
SafeSeasMonitor monitor = SafeSeasMonitor.getInstance(); //SafeSeasMonitor monitor = SafeSeasMonitor.getInstance();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
monitor.launchDialog("area", shell); //monitor.launchDialog("area", shell);
//SSMonitoringAreaConfigDlg configDlg= new SSMonitoringAreaConfigDlg(shell, "Safe Seas Monitor Area Configuration"); SSMonitoringAreaConfigDlg configDlg= new SSMonitoringAreaConfigDlg(shell, "Safe Seas Monitor Area Configuration");
//configDlg.open(); configDlg.open();
return null; return null;
} }

View file

@ -23,12 +23,12 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.swt.SWT; 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.dataplugin.scan.data.ScanTableData;
import com.raytheon.uf.common.monitor.scan.config.SCANConfig; 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 * Dec 2, 2010 mnash Initial creation
* *
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
*
* </pre> * </pre>
* *
* @author mnash * @author mnash
@ -74,11 +76,7 @@ public class SCANAlarmAlertManager {
private HashMap<String, HashMap<ScanTables, List<ScheduledAlarms>>> scheduledAlarmsMap; private HashMap<String, HashMap<ScanTables, List<ScheduledAlarms>>> scheduledAlarmsMap;
private HashMap<String, HashMap<ScanTables, List<AlertedAlarms>>> alertedAlarmsMap; private HashMap<String, HashMap<ScanTables, Set<AlertedAlarms>>> alertedAlarmsMap;
private HashMap<String, HashMap<ScanTables, boolean[][]>> indicesMap;
private HashMap<String, HashMap<ScanTables, List<Point>>> toReset;
private HashMap<String, HashMap<ScanTables, List<String>>> idents; private HashMap<String, HashMap<ScanTables, List<String>>> idents;
@ -109,24 +107,12 @@ public class SCANAlarmAlertManager {
} }
if (!alertedAlarmsMap.containsKey(site)) { if (!alertedAlarmsMap.containsKey(site)) {
HashMap<ScanTables, List<AlertedAlarms>> siteAlertedAlarmsMap = new HashMap<ScanTables, List<AlertedAlarms>>(); HashMap<ScanTables, Set<AlertedAlarms>> siteAlertedAlarmsSet = new HashMap<ScanTables, Set<AlertedAlarms>>();
siteAlertedAlarmsMap.put(ScanTables.DMD, siteAlertedAlarmsSet.put(ScanTables.DMD,
new CopyOnWriteArrayList<AlertedAlarms>()); new HashSet<AlertedAlarms>());
siteAlertedAlarmsMap.put(ScanTables.CELL, siteAlertedAlarmsSet.put(ScanTables.CELL,
new CopyOnWriteArrayList<AlertedAlarms>()); new HashSet<AlertedAlarms>());
alertedAlarmsMap.put(site, siteAlertedAlarmsMap); alertedAlarmsMap.put(site, siteAlertedAlarmsSet);
}
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);
} }
if (!idents.containsKey(site)) { if (!idents.containsKey(site)) {
@ -144,15 +130,7 @@ public class SCANAlarmAlertManager {
} }
if (alertedAlarmsMap == null) { if (alertedAlarmsMap == null) {
alertedAlarmsMap = new HashMap<String, HashMap<ScanTables, List<AlertedAlarms>>>(); alertedAlarmsMap = new HashMap<String, HashMap<ScanTables, Set<AlertedAlarms>>>();
}
if (indicesMap == null) {
indicesMap = new HashMap<String, HashMap<ScanTables, boolean[][]>>();
}
if (toReset == null) {
toReset = new HashMap<String, HashMap<ScanTables, List<Point>>>();
} }
if (idents == null) { if (idents == null) {
@ -169,7 +147,7 @@ public class SCANAlarmAlertManager {
* @param sdg * @param sdg
*/ */
public void calculateScanCells(SCANTableData data, ScanTables tableType, public void calculateScanCells(SCANTableData data, ScanTables tableType,
ScanDataGenerator sdg) { ScanDataGenerator sdg, Date latestTime) {
int colLength = 0; int colLength = 0;
if (tableType == ScanTables.CELL) { if (tableType == ScanTables.CELL) {
colLength = SCANConfigEnums.CELLTable.values().length; colLength = SCANConfigEnums.CELLTable.values().length;
@ -178,12 +156,8 @@ public class SCANAlarmAlertManager {
} }
String site = sdg.getSite(); 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(); SCANConfig config = SCANConfig.getInstance();
for (ScheduledAlarms alarm : scheduledAlarmsMap.get(site) for (ScheduledAlarms alarm : scheduledAlarmsMap.get(site)
@ -219,15 +193,13 @@ public class SCANAlarmAlertManager {
if (valCompare) { if (valCompare) {
addAlertedAlarm(site, tableType, scanData addAlertedAlarm(site, tableType, scanData
.getTableCellData(0).getCellText(), .getTableCellData(0).getCellText(),
alarm.colName, AlarmType.AbsVal, row, index); alarm.colName, AlarmType.AbsVal, row,
indicesMap.get(site).get(tableType)[row][index] = true; index, latestTime);
} else if (indicesMap.get(site).get(tableType)[row][index] != true) {
indicesMap.get(site).get(tableType)[row][index] = false;
} }
row++; row++;
} }
} else if (tableType != ScanTables.DMD } else if ((tableType != ScanTables.DMD)
&& alarm.type == AlarmType.RateOfChange) { && (alarm.type == AlarmType.RateOfChange)) {
ScanMonitor monitor = ScanMonitor.getInstance(); ScanMonitor monitor = ScanMonitor.getInstance();
if (monitor.cellData != null) { if (monitor.cellData != null) {
@ -245,7 +217,7 @@ public class SCANAlarmAlertManager {
.getTableData(tableType, site, previous); .getTableData(tableType, site, previous);
getScanTableDiff(data, tableDataPrev, getScanTableDiff(data, tableDataPrev,
tableType, colLength, sdg, alarm, tableType, colLength, sdg, alarm,
config); config, latestTime);
} }
} }
} }
@ -267,7 +239,8 @@ public class SCANAlarmAlertManager {
*/ */
public void getScanTableDiff(SCANTableData data, public void getScanTableDiff(SCANTableData data,
ScanTableData<?> otherData, ScanTables tableType, int length, ScanTableData<?> otherData, ScanTables tableType, int length,
ScanDataGenerator sdg, ScheduledAlarms alarm, SCANConfig config) { ScanDataGenerator sdg, ScheduledAlarms alarm, SCANConfig config,
Date latestTime) {
SCANTableData scanOtherData = null; SCANTableData scanOtherData = null;
if (tableType == ScanTables.CELL) { if (tableType == ScanTables.CELL) {
scanOtherData = sdg.generateCellData(otherData); scanOtherData = sdg.generateCellData(otherData);
@ -326,18 +299,9 @@ public class SCANAlarmAlertManager {
// add alarm // add alarm
addAlertedAlarm(site, tableType, addAlertedAlarm(site, tableType,
currentTableCells[0].getCellText(), currentTableCells[0].getCellText(),
alarm.colName, alarm.type, row, i); alarm.colName, alarm.type, row, i,
// set the blinkability = true latestTime);
indicesMap.get(site).get(tableType)[row][i] = true;
} }
// 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 * Remove the alarm and set the indices to false
* *
* @param alarm * @param alarm
*/ */
public void removeAlarm(String site, ScanTables tableType, public void clearAlarm(String site, ScanTables tableType,
AlertedAlarms alarm) { AlertedAlarms alarm) {
alertedAlarmsMap.get(site).get(tableType).remove(alarm); Set<AlertedAlarms> alarms = alertedAlarmsMap.get(site).get(tableType);
indicesMap.get(site).get(tableType)[alarm.row][alarm.col] = false; for (AlertedAlarms aa: alarms) {
toReset.get(site).get(tableType).add(new Point(alarm.row, alarm.col)); 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( for (ScheduledAlarms theAlarm : scheduledAlarmsMap.get(site).get(
tableType)) { tableType)) {
if (alarm.colName.equals(theAlarm.colName) if (alarm.colName.equals(theAlarm.colName)
&& alarm.type == theAlarm.type) { && (alarm.type == theAlarm.type)) {
if (alarm.type == AlarmType.RateOfChange if ((alarm.type == AlarmType.RateOfChange)
&& tableType == ScanTables.DMD) { && (tableType == ScanTables.DMD)) {
return; return;
} else { } else {
scheduledAlarmsMap.get(site).get(tableType) scheduledAlarmsMap.get(site).get(tableType)
@ -428,9 +386,25 @@ public class SCANAlarmAlertManager {
* @param col * @param col
*/ */
public void addAlertedAlarm(String site, ScanTables tableType, public void addAlertedAlarm(String site, ScanTables tableType,
String ident, String colName, AlarmType type, int row, int col) { String ident, String colName, AlarmType type, int row,
alertedAlarmsMap.get(site).get(tableType) int col, Date validTime) {
.add(new AlertedAlarms(ident, colName, type, row, col)); 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 * @return
*/ */
public List<AlertedAlarms> getAlertedAlarms(String site, public Set<AlertedAlarms> getAlertedAlarms(String site,
ScanTables tableType) { ScanTables tableType) {
return alertedAlarmsMap.get(site).get(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, public boolean containsAlarm(String site, ScanTables tableType,
AlarmType type, String colName, String ident) { AlarmType type, String colName, String ident) {
for (AlertedAlarms alarm : alertedAlarmsMap.get(site).get(tableType)) { 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)) { && colName.equals(alarm.colName)) {
return true; return true;
} }
@ -464,19 +450,6 @@ public class SCANAlarmAlertManager {
return false; 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() { public boolean isRing() {
return ring; return ring;
} }
@ -493,18 +466,38 @@ public class SCANAlarmAlertManager {
idents.get(site).get(tableType).clear(); 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 * clear the alerted alarms and the indices
*/ */
public void clearAlertedAlarms(String site, ScanTables tableType) { public void clearAlertedAlarms(String site, ScanTables tableType) {
for (AlertedAlarms alarm : alertedAlarmsMap.get(site).get(tableType)) { for (AlertedAlarms alarm : alertedAlarmsMap.get(site).get(tableType)) {
alertedAlarmsMap.get(site).get(tableType).remove(alarm); alarm.cleared = true;
indicesMap.get(site).get(tableType)[alarm.row][alarm.col] = false;
toReset.get(site).get(tableType)
.add(new Point(alarm.row, alarm.col));
} }
} }
public void removeAlertedAlarms(String site, ScanTables tableType) {
alertedAlarmsMap.get(site).get(tableType).clear();
}
/** /**
* Clear the scheduled alarms * Clear the scheduled alarms
*/ */
@ -583,14 +576,19 @@ public class SCANAlarmAlertManager {
int row; int row;
int col; int col;
boolean cleared = false;
Date validTime;
public AlertedAlarms(String ident, String colName, AlarmType type, public AlertedAlarms(String ident, String colName, AlarmType type,
int row, int col) { int row, int col, Date validTime) {
this.ident = ident; this.ident = ident;
this.colName = colName; this.colName = colName;
this.type = type; this.type = type;
this.row = row; this.row = row;
this.col = col; this.col = col;
this.validTime = validTime;
} }
/* /*
@ -602,7 +600,7 @@ public class SCANAlarmAlertManager {
public String toString() { public String toString() {
return "Identifier : " + this.ident + "\nColumn : " + this.colName return "Identifier : " + this.ident + "\nColumn : " + this.colName
+ "\nType : " + this.type.getName() + "\nRow #: " + "\nType : " + this.type.getName() + "\nRow #: "
+ this.row + "\nCol #:" + this.col; + this.row + "\nCol #:" + this.col + "\nCleared: " + cleared + "\n";
} }
} }
} }

View file

@ -49,6 +49,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 2, 2010 mnash Initial creation * Dec 2, 2010 mnash Initial creation
* *
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
*
* </pre> * </pre>
* *
* @author mnash * @author mnash
@ -81,6 +83,7 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
mgr = SCANAlarmAlertManager.getInstance(site); mgr = SCANAlarmAlertManager.getInstance(site);
} }
@Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
if (type == ScanTables.CELL) { if (type == ScanTables.CELL) {
setText("Cell Alarms"); setText("Cell Alarms");
@ -122,50 +125,54 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
btnComp.setLayoutData(gd); btnComp.setLayoutData(gd);
for (final AlertedAlarms alarm : mgr.getAlertedAlarms(site, type)) { for (final AlertedAlarms alarm : mgr.getAlertedAlarms(site, type)) {
gd = new GridData(buttonWidth, SWT.DEFAULT); if (alarm.cleared == false) {
final Button btn = new Button(btnComp, SWT.PUSH); gd = new GridData(buttonWidth, SWT.DEFAULT);
btn.setText(alarm.ident + " --> " + alarm.colName + " " final Button btn = new Button(btnComp, SWT.PUSH);
+ alarm.type.getName()); btn.setText(alarm.ident + " --> " + alarm.colName + " "
btn.setData("ident", alarm.ident); + alarm.type.getName());
btn.setData("attr", alarm.colName); btn.setData("ident", alarm.ident);
btn.setLayoutData(gd); btn.setData("attr", alarm.colName);
btn.setBackground(Display.getDefault() btn.setLayoutData(gd);
.getSystemColor(SWT.COLOR_RED)); btn.setBackground(Display.getDefault()
btn.addSelectionListener(new SelectionAdapter() { .getSystemColor(SWT.COLOR_RED));
@Override btn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { @Override
String ident = btn.getData("ident").toString(); public void widgetSelected(SelectionEvent e) {
String attr = btn.getData("attr").toString(); String ident = btn.getData("ident").toString();
// get instance of the table dialog to use for the functions String attr = btn.getData("attr").toString();
AbstractTableDlg tableDlg = ScanMonitor.getInstance() // get instance of the table dialog to use for the functions
.getDialog(type, site); AbstractTableDlg tableDlg = ScanMonitor.getInstance()
// display the trend graph dialogs .getDialog(type, site);
if (tableDlg instanceof SCANCellTableDlg) { // display the trend graph dialogs
((SCANCellTableDlg) tableDlg).getScanTableComp() if (tableDlg instanceof SCANCellTableDlg) {
.displayTrendGraphDialog(ident, attr); ((SCANCellTableDlg) tableDlg).getScanTableComp()
} else if (tableDlg instanceof SCANDmdTableDlg) { .displayTrendGraphDialog(ident, attr);
((SCANDmdTableDlg) tableDlg).getScanTableComp() } else if (tableDlg instanceof SCANDmdTableDlg) {
.displayTrendGraphDialog(ident, attr); ((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(); btnComp.layout();
@ -174,6 +181,7 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
sc.setExpandHorizontal(true); sc.setExpandHorizontal(true);
sc.setExpandVertical(true); sc.setExpandVertical(true);
sc.addControlListener(new ControlAdapter() { sc.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) { public void controlResized(ControlEvent e) {
Rectangle r = sc.getClientArea(); Rectangle r = sc.getClientArea();
sc.setMinSize(btnComp.computeSize(r.width, SWT.DEFAULT)); 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); GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = buttonWidth + 30; gd.widthHint = buttonWidth + 30;
clearAllBtn = new Button(shell, SWT.PUSH); clearAllBtn = new Button(shell, SWT.PUSH);
clearAllBtn.setText("Clear All " int numAlarms = 0;
+ mgr.getAlertedAlarms(site, type).size() + " Alarms"); for (AlertedAlarms alarm: mgr.getAlertedAlarms(site, type)) {
if (alarm.cleared == false) {
numAlarms++;
}
}
clearAllBtn.setText("Clear All " + numAlarms + " Alarms");
clearAllBtn.setBackground(Display.getDefault().getSystemColor( clearAllBtn.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_RED)); SWT.COLOR_RED));
clearAllBtn.setLayoutData(gd); clearAllBtn.setLayoutData(gd);

View file

@ -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.ScanDataGenerator;
import com.raytheon.uf.viz.monitor.scan.data.UnwarnedCell; 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.AlarmType;
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlertedAlarms;
import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.EditorUtil;
/** /**
@ -85,6 +86,8 @@ import com.raytheon.viz.ui.EditorUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 21, 2009 #3039 lvenable Initial creation * Nov 21, 2009 #3039 lvenable Initial creation
* *
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
*
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -471,7 +474,7 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
alarmDlg = new SCANAlarmsDlg(shell, ScanTables.CELL, site); alarmDlg = new SCANAlarmsDlg(shell, ScanTables.CELL, site);
alarmDlg.open(); alarmDlg.open();
if (!alarmBtn.isDisposed() if (!alarmBtn.isDisposed()
&& mgr.getAlertedAlarms(site, scanTable).isEmpty()) { && (mgr.getAlertedAlarmCount(site, scanTable) == 0)) {
alarmBtn.setVisible(false); alarmBtn.setVisible(false);
mgr.setRing(false); mgr.setRing(false);
} }
@ -1174,17 +1177,14 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
@Override @Override
public void notify(IMonitorEvent me) { public void notify(IMonitorEvent me) {
if (me.getSource() instanceof IMonitor) { if (me.getSource() instanceof IMonitor) {
ScanMonitor scan = (ScanMonitor) me.getSource(); ScanMonitor scan = (ScanMonitor) me.getSource();
Date time = null; Date time = null;
try { try {
if (getLinkToFrame(scanTable.name())) { if (getLinkToFrame(scanTable.name())) {
time = scan.getScanTime(scanTable, site); time = scan.getScanTime(scanTable, site);
} else { } else {
time = scan.getMostRecent(scan, scanTable.name(), site) time = scan.getMostRecent(scan, scanTable.name(), site)
.getRefTime(); .getRefTime();
} }
} catch (Exception e) { } catch (Exception e) {
} }
@ -1231,7 +1231,7 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
scanMostRecentTime = scan.getMostRecent(scan, scanMostRecentTime = scan.getMostRecent(scan,
scanTable.name(), site).getRefTime(); scanTable.name(), site).getRefTime();
} catch (NullPointerException npe) { } catch (NullPointerException npe) {
// scan has beenn turned off // scan has been turned off
} }
if (scanMostRecentTime != null) { if (scanMostRecentTime != null) {
@ -1245,21 +1245,25 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
&& !(EditorUtil.getActiveVizContainer() && !(EditorUtil.getActiveVizContainer()
.getLoopProperties().isLooping()) .getLoopProperties().isLooping())
&& (mgr.getScheduledAlarms(site, scanTable).size() > 0) && (mgr.getScheduledAlarms(site, scanTable).size() > 0)
&& currentTime.equals(scanMostRecentTime) && currentTime.equals(scanMostRecentTime)
&& !scanCfg.getAlarmsDisabled(scanTable)) { && !scanCfg.getAlarmsDisabled(scanTable)) {
mgr.clearAlertedAlarms(site, scanTable); scanTableComp.checkBlink(sdg, scanMostRecentTime);
mgr.clearToReset(site, scanTable);
scanTableComp.checkBlink(sdg);
if (mgr.getAlertedAlarms(site, scanTable).size() > 0) { 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(); addAlarmTimer();
} else { } else {
alarmBtn.setVisible(false); alarmBtn.setVisible(false);
} }
} else { } else {
mgr.clearAlertedAlarms(site, scanTable); mgr.removeAlertedAlarms(site, scanTable);
alarmBtn.setVisible(false); alarmBtn.setVisible(false);
} }
} }

View file

@ -89,6 +89,8 @@ import com.raytheon.viz.ui.EditorUtil;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 29, 2010 lvenable Initial creation * Apr 29, 2010 lvenable Initial creation
* *
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
*
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -1069,9 +1071,7 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
&& currentTime.equals(scan.getMostRecent(scan, && currentTime.equals(scan.getMostRecent(scan,
scanTable.name(), site).getRefTime()) scanTable.name(), site).getRefTime())
&& !scanCfg.getAlarmsDisabled(scanTable)) { && !scanCfg.getAlarmsDisabled(scanTable)) {
mgr.clearAlertedAlarms(site, scanTable); dmdTableComp.checkBlink(sdg, scan.getMostRecent(scan, scanTable.name(), site).getRefTime());
mgr.clearToReset(site, scanTable);
dmdTableComp.checkBlink(sdg);
if (mgr.getAlertedAlarms(site, scanTable).size() > 0) { if (mgr.getAlertedAlarms(site, scanTable).size() > 0) {
alarmBtn.setVisible(true); alarmBtn.setVisible(true);
addAlarmTimer(); addAlarmTimer();
@ -1079,7 +1079,7 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
alarmBtn.setVisible(false); alarmBtn.setVisible(false);
} }
} else { } else {
mgr.clearAlertedAlarms(site, scanTable); mgr.removeAlertedAlarms(site, scanTable);
alarmBtn.setVisible(false); alarmBtn.setVisible(false);
} }
} }

View file

@ -21,7 +21,8 @@ package com.raytheon.uf.viz.monitor.scan.tables;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.Date;
import java.util.Set;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; 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.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanColors; 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.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.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 { public abstract class SCANTable extends Composite {
protected Table table; protected Table table;
@ -175,7 +188,7 @@ public abstract class SCANTable extends Composite {
public void widgetDisposed(DisposeEvent arg0) { public void widgetDisposed(DisposeEvent arg0) {
if ((scanTable == ScanTables.CELL) if ((scanTable == ScanTables.CELL)
|| (scanTable == ScanTables.DMD)) { || (scanTable == ScanTables.DMD)) {
mgr.clearAlertedAlarms(site, scanTable); mgr.removeAlertedAlarms(site, scanTable);
} }
tiFont.dispose(); tiFont.dispose();
columnFont.dispose(); columnFont.dispose();
@ -531,12 +544,6 @@ public abstract class SCANTable extends Composite {
clearTableSelection(); clearTableSelection();
tableData = td; 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)) { if ((tableData == null) || (tableData.getTableRows().size() == 0)) {
// System.out.println("*** no data"); // System.out.println("*** no data");
// table.setEnabled(true); // table.setEnabled(true);
@ -622,6 +629,10 @@ public abstract class SCANTable extends Composite {
return; return;
} }
if( scanTable == ScanTables.TVS && sortedIndex == -1)
{
sortedIndex = TVSTable.valueOf("IDENT").ordinal();
}
// get the ident, if a row is outlined in blue // get the ident, if a row is outlined in blue
if (tableIndex >= 0) { if (tableIndex >= 0) {
SCANTableRowData stdr = tableData.getTableRows().get(tableIndex); SCANTableRowData stdr = tableData.getTableRows().get(tableIndex);
@ -673,9 +684,12 @@ public abstract class SCANTable extends Composite {
} }
ScanDataGenerator sdg = new ScanDataGenerator(site); ScanDataGenerator sdg = new ScanDataGenerator(site);
if ((scanTable == ScanTables.CELL) || (scanTable == ScanTables.DMD) if ((scanTable == ScanTables.CELL) || ((scanTable == ScanTables.DMD)
&& !mgr.getAlertedAlarms(site, scanTable).isEmpty()) { && !mgr.getAlertedAlarms(site, scanTable).isEmpty())) {
checkBlink(sdg); 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 // 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. * 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() { public boolean[] getVisibleColumns() {
TableColumn[] tCols = table.getColumns(); TableColumn[] tCols = table.getColumns();
boolean[] visibleCols = new boolean[tCols.length]; boolean[] visibleCols = new boolean[tCols.length];
@ -754,8 +756,6 @@ public abstract class SCANTable extends Composite {
// tCols[i].setWidth(table.getColumn(i).getWidth() + 5); // tCols[i].setWidth(table.getColumn(i).getWidth() + 5);
tc.setWidth(table.getColumn(index).getWidth() + 2); tc.setWidth(table.getColumn(index).getWidth() + 2);
System.out.println("tc.getWidth() = " + tc.getWidth());
if (tc.getWidth() > defaultColWidth) { if (tc.getWidth() > defaultColWidth) {
tc.setWidth(defaultColWidth); tc.setWidth(defaultColWidth);
} }
@ -858,9 +858,6 @@ public abstract class SCANTable extends Composite {
for (int i = 0; i < rowData.size(); i++) { for (int i = 0; i < rowData.size(); i++) {
rowData.get(i).getTableCellData(index).setColor(); rowData.get(i).getTableCellData(index).setColor();
} }
if ((scanTable == ScanTables.CELL) || (scanTable == ScanTables.DMD)) {
mgr.clearToReset(site, scanTable);
}
sortTableUsingConfig(); sortTableUsingConfig();
} }
@ -923,75 +920,7 @@ public abstract class SCANTable extends Composite {
public void run() { public void run() {
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(new Runnable() {
public void run() { public void run() {
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;
}
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();
}
}
}
} }
}); });
} }
@ -1008,7 +937,7 @@ public abstract class SCANTable extends Composite {
// Fail-safe check to determine if the we have no // Fail-safe check to determine if the we have no
// data // data
// in the table data. // in the table data.
if (beepTimer != null && tableData != null) { if ((beepTimer != null) && (tableData != null)) {
if (tableData.getTableRows().size() == 0) { if (tableData.getTableRows().size() == 0) {
beepTimer.cancel(); 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() { public Timer getBlinkTimer() {
if (timer == null) { if (timer == null) {
timer = new Timer(); timer = new Timer();
@ -1042,9 +1040,9 @@ public abstract class SCANTable extends Composite {
return timer; return timer;
} }
public void checkBlink(ScanDataGenerator sdg) { public void checkBlink(ScanDataGenerator sdg, Date latestTime) {
if (!scanCfg.getAlarmsDisabled(scanTable)) { if (!scanCfg.getAlarmsDisabled(scanTable)) {
mgr.calculateScanCells(tableData, scanTable, sdg); mgr.calculateScanCells(tableData, scanTable, sdg, latestTime);
blinkCells(); blinkCells();
} }
} }
@ -1084,6 +1082,7 @@ public abstract class SCANTable extends Composite {
// Set the background color to the sort color if that column is // Set the background color to the sort color if that column is
// sorted. // sorted.
// sortedColumnIndex=-1 is default sort
if (sortedColumnIndex == -1) { if (sortedColumnIndex == -1) {
scanCfg.getDefaultName(); scanCfg.getDefaultName();
String sortColName = scanCfg.getDefaultRank(this.scanTable); String sortColName = scanCfg.getDefaultRank(this.scanTable);

View file

@ -37,6 +37,7 @@ import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 28, 2009 3963 dhladky Initial creation. * Dec 28, 2009 3963 dhladky Initial creation.
* March 5, 2012 14413 zhao Launch AreaConfigDlg w/o monitor
* *
* </pre> * </pre>
* *
@ -51,12 +52,12 @@ public class SnowAreaConfigAction extends AbstractHandler {
System.out.println("Activating/Action the Snow Area Config..."); System.out.println("Activating/Action the Snow Area Config...");
SnowMonitor monitor = SnowMonitor.getInstance(); //SnowMonitor monitor = SnowMonitor.getInstance();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
monitor.launchDialog("area", shell); //monitor.launchDialog("area", shell);
//SnowMonitoringAreaConfigDlg configDlg= new SnowMonitoringAreaConfigDlg(shell, "SNOW Monitor Area Configuration"); SnowMonitoringAreaConfigDlg configDlg= new SnowMonitoringAreaConfigDlg(shell, "SNOW Monitor Area Configuration");
//configDlg.open(); configDlg.open();
return null; return null;
} }

View file

@ -69,6 +69,7 @@ import com.raytheon.uf.viz.monitor.Activator;
* Jun 24, 2010 5885/5886 zhao added initZoneStationLists(), * Jun 24, 2010 5885/5886 zhao added initZoneStationLists(),
* and revised accordingly * and revised accordingly
* Apr 29, 2011 DR#8986 zhao Read in "Counties" instead of "Forecast Zones" * 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> * </pre>
* *
@ -250,8 +251,6 @@ public abstract class MonitoringAreaConfigDlg extends Dialog implements INewZone
private MonitorConfigurationManager configMgr = null; private MonitorConfigurationManager configMgr = null;
private AdjacentWfoMgr adjMgr = null;
private Mode mode = Mode.Zone; private Mode mode = Mode.Zone;
protected ArrayList<String> addedZones = new ArrayList<String>(); 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 * (3) set additional zones in the neighborhood of the monitor area
*/ */
additionalZones = adjMgr.getAdjZones(); additionalZones = configMgr.getAdjacentAreaList(); //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();
}
Collections.sort(additionalZones); Collections.sort(additionalZones);
@ -359,10 +325,8 @@ public abstract class MonitoringAreaConfigDlg extends Dialog implements INewZone
additionalStns = new ArrayList<String>(); additionalStns = new ArrayList<String>();
try { try {
for (String zone : additionalZones) { for (String zone : additionalZones) {
ArrayList<StationIdXML> stnXmls = MonitorAreaUtils ArrayList<String> stns = configMgr.getAdjacentAreaStationsWithType(zone);
.getZoneReportingStationXMLs(zone); for (String stn : stns) {
for (StationIdXML stnXml : stnXmls) {
String stn = stnXml.getName() + "#" + stnXml.getType();
if (!additionalStns.contains(stn)) { if (!additionalStns.contains(stn)) {
additionalStns.add(stn); additionalStns.add(stn);
} }
@ -372,14 +336,6 @@ public abstract class MonitoringAreaConfigDlg extends Dialog implements INewZone
e.printStackTrace(); 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); Collections.sort(additionalStns);
} }
@ -415,7 +371,6 @@ public abstract class MonitoringAreaConfigDlg extends Dialog implements INewZone
// set configuration and adjacent managers // set configuration and adjacent managers
configMgr = getConfigManager(); configMgr = getConfigManager();
adjMgr = new AdjacentWfoMgr(currentSite);
// initialize zone/station lists // initialize zone/station lists
initZoneStationLists(); initZoneStationLists();

View file

@ -19,8 +19,8 @@
further_licensing_information. further_licensing_information.
--> -->
<CrossSectionRotations> <CrossSectionRotations>
<rotation parameter="Into" mode="VR_COMPONENT_INTO"/> <rotation parameter="Comp Into" mode="VR_COMPONENT_INTO"/>
<rotation parameter="Along" mode="VR_COMPONENT_ALONG"/> <rotation parameter="Comp Along" mode="VR_COMPONENT_ALONG"/>
<rotation parameter="SNW" mode="VR_SECTION_COORDINATES"/> <rotation parameter="SNW" mode="VR_SECTION_COORDINATES"/>
<rotation parameter="uFX" mode="VR_GEO_MOMENTUM"/> <rotation parameter="uFX" mode="VR_GEO_MOMENTUM"/>
<rotation parameter="vertCirc" mode="VR_VERT_CIRC"/> <rotation parameter="vertCirc" mode="VR_VERT_CIRC"/>

View file

@ -91,7 +91,8 @@ import com.vividsolutions.jts.geom.LineString;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 4, 2007 njensen Initial creation * Dec 4, 2007 njensen Initial creation
* 02/17/09 njensen Refactored to new rsc architecture * 02/17/09 njensen Refactored to new rsc architecture
* * 02/27/12 14490 kshresth Fixed cross sections not loading as images
*
* </pre> * </pre>
* *
* @author njensen * @author njensen
@ -445,10 +446,10 @@ public abstract class AbstractCrossSectionResource extends
if (getCapability(DisplayTypeCapability.class).getDisplayType() == DisplayType.IMAGE) { if (getCapability(DisplayTypeCapability.class).getDisplayType() == DisplayType.IMAGE) {
completeName += " Img"; completeName += " Img";
} }
completeName += " ("; completeName += " ( ";
completeName += getUnitString(); completeName += getUnitString();
completeName += ") "; completeName += " ) ";
return completeName; return completeName;
} }

View file

@ -25,7 +25,8 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; 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> * <pre>
* *

View file

@ -65,7 +65,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/** /**
* Aviation Dialog class. * The Aviation Dialog class that displays the start up menu for AvnFPS.
* *
* <pre> * <pre>
* *

View file

@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
/** /**
* TODO Add Description * This class is a run configuration component to launch the AvnFPS monitor.
* *
* <pre> * <pre>
* *

View file

@ -44,9 +44,9 @@ import com.raytheon.viz.avnconfig.TafSiteInfoEditorDlg;
import com.raytheon.viz.avnconfig.TextEditorSetupDlg; import com.raytheon.viz.avnconfig.TextEditorSetupDlg;
/** /**
* This is the main AvnFPS setup dialog containing the controls to launch the * This class is the main AvnFPS configuration dialog. It contains the controls
* Text Editor, Monitoring Rules, TAF Site Info, TAF Products, or Triggers * to launch the Text Editor, Monitoring Rules, TAF Site Info, TAF Products, or
* dialog. * Climate Data dialogs.
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
@ -79,14 +79,29 @@ public class AvnconfigDlg extends Dialog {
@SuppressWarnings("unused") @SuppressWarnings("unused")
private MessageStatusComp msgStatusComp; private MessageStatusComp msgStatusComp;
/**
* Text Editor dialog.
*/
private TextEditorSetupDlg editorDlg; private TextEditorSetupDlg editorDlg;
/**
* Monitoring Rules Dialog,
*/
private MonitoringCriteriaDlg monCriteriaDlg; private MonitoringCriteriaDlg monCriteriaDlg;
/**
* TAF Site Information dialog.
*/
private TafSiteInfoEditorDlg siteInfoDlg; private TafSiteInfoEditorDlg siteInfoDlg;
/**
* TAF Product dialog.
*/
private TafProductConfigDlg productsDlg; private TafProductConfigDlg productsDlg;
/**
* Climate Data dialog.
*/
private ClimateDataMenuDlg climateDataDlg; 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. * @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); gd = new GridData(buttonWidth, SWT.DEFAULT);
Button climateBtn = new Button(buttonComp, SWT.PUSH); Button climateBtn = new Button(buttonComp, SWT.PUSH);
climateBtn.setText("Climate Data"); climateBtn.setText("Climate Data");

View file

@ -37,7 +37,8 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
/** /**
* TODO Add Description * This class is a handler for bring up the Ceiling/Visibility Distribution
* dialog.
* *
* <pre> * <pre>
* *
@ -52,7 +53,9 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
* @author mnash * @author mnash
* @version 1.0 * @version 1.0
*/ */
@Deprecated
// No long used @see com.raytheon.viz.aviation.CigVisDistComponent
// TODO remove from base line.
public class CigVisDistAction extends AbstractHandler { public class CigVisDistAction extends AbstractHandler {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CigVisDistAction.class); .getHandler(CigVisDistAction.class);

View file

@ -30,7 +30,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
/** /**
* TODO Add Description * This is a component class for launching the CigVisDistributionDlg dialog.
* *
* <pre> * <pre>
* *

View file

@ -37,7 +37,7 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
/** /**
* TODO Add Description * Action class for launching the Ceiling/Visibility Trend dialog.
* *
* <pre> * <pre>
* *
@ -52,7 +52,8 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
* @author mnash * @author mnash
* @version 1.0 * @version 1.0
*/ */
@Deprecated
// TODO no longer used remove from the base line
public class CigVisTrendAction extends AbstractHandler { public class CigVisTrendAction extends AbstractHandler {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CigVisTrendAction.class); .getHandler(CigVisTrendAction.class);

View file

@ -30,7 +30,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
/** /**
* TODO Add Description * This is a component class for lanuching the CigVisTrendDlg dialog.
* *
* <pre> * <pre>
* *

View file

@ -37,7 +37,7 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
/** /**
* TODO Add Description * Action class for the Climate's METAR Display.
* *
* <pre> * <pre>
* *
@ -52,7 +52,8 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
* @author mnash * @author mnash
* @version 1.0 * @version 1.0
*/ */
@Deprecated
// TODO no longer used remove from the base line
public class MetarAction extends AbstractHandler { public class MetarAction extends AbstractHandler {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(MetarAction.class); .getHandler(MetarAction.class);

View file

@ -30,7 +30,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
/** /**
* TODO Add Description * This is a component class for launching the Climate's MetarDisplayDialog.
* *
* <pre> * <pre>
* *

View file

@ -37,7 +37,7 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
/** /**
* TODO Add Description * Action class for Climate's Wind Rose Dialog.
* *
* <pre> * <pre>
* *
@ -52,7 +52,8 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
* @author mnash * @author mnash
* @version 1.0 * @version 1.0
*/ */
@Deprecated
// TODO no longer used remove from the base line
public class WindRoseAction extends AbstractHandler { public class WindRoseAction extends AbstractHandler {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(WindRoseAction.class); .getHandler(WindRoseAction.class);

View file

@ -30,7 +30,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
/** /**
* TODO Add Description * Component class for launching the Climate's WindRoseDlg.
* *
* <pre> * <pre>
* *

View file

@ -25,7 +25,7 @@ import java.util.Map;
import com.raytheon.viz.aviation.guidance.GuidanceRequest; import com.raytheon.viz.aviation.guidance.GuidanceRequest;
/** /**
* Guidance request used for caching data. * The base Guidance Request classed used for caching data.
* *
* <pre> * <pre>
* *
@ -50,10 +50,20 @@ public class CacheGuidanceRequest extends GuidanceRequest {
return map; return map;
} }
/**
* The site associated with the request.
*
* @return siteID
*/
public String getSiteID() { public String getSiteID() {
return this.siteID; return this.siteID;
} }
/**
* Set the site ID associated with the request.
*
* @param siteID
*/
public void setSiteID(String siteID) { public void setSiteID(String siteID) {
this.siteID = siteID; this.siteID = siteID;
} }

View file

@ -23,7 +23,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* Guidance request used for caching data. * Guidance request used for caching Grid data.
* *
* <pre> * <pre>
* *
@ -39,8 +39,15 @@ import java.util.Map;
* @version 1.0 * @version 1.0
*/ */
public class GridCacheGuidanceRequest extends CacheGuidanceRequest { public class GridCacheGuidanceRequest extends CacheGuidanceRequest {
// TODO remove use the siteID in CacheGuidanceRequest.
protected String siteID; protected String siteID;
/**
* Build the Grid tag string for desired site.
*
* @param siteID
* @return tag
*/
public static String getTag(String siteID) { public static String getTag(String siteID) {
return GuidanceType.GRID + ":" + siteID; return GuidanceType.GRID + ":" + siteID;
} }
@ -52,10 +59,12 @@ public class GridCacheGuidanceRequest extends CacheGuidanceRequest {
return map; return map;
} }
// TODO remove use the one in CacheGuidanceRequest
public String getSiteID() { public String getSiteID() {
return this.siteID; return this.siteID;
} }
// TODOremove use the one in CacheGuidanceRequest
public void setSiteID(String siteID) { public void setSiteID(String siteID) {
this.siteID = siteID; this.siteID = siteID;
} }

View file

@ -23,7 +23,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* Guidance request used for caching data. * Guidance request used for caching Metar data.
* *
* <pre> * <pre>
* *
@ -39,10 +39,18 @@ import java.util.Map;
* @version 1.0 * @version 1.0
*/ */
public class MetarCacheGuidanceRequest extends CacheGuidanceRequest { public class MetarCacheGuidanceRequest extends CacheGuidanceRequest {
// TODO remove use the one in CacheGuidanceRequest
protected String siteID; protected String siteID;
protected String size; 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) { public static String getTag(String siteID, String size) {
return GuidanceType.METAR + ":" + siteID + ":" + size; return GuidanceType.METAR + ":" + siteID + ":" + size;
} }
@ -55,10 +63,12 @@ public class MetarCacheGuidanceRequest extends CacheGuidanceRequest {
return map; return map;
} }
// TODO remove use the one in CacheGuidanceRequest
public String getSiteID() { public String getSiteID() {
return this.siteID; return this.siteID;
} }
// TODO remove use the one in CacheGuidanceRequest
public void setSiteID(String siteID) { public void setSiteID(String siteID) {
this.siteID = siteID; this.siteID = siteID;
} }

View file

@ -26,7 +26,7 @@ import java.util.Map;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
/** /**
* Guidance request used for caching data. * Guidance request used for caching MOS data.
* *
* <pre> * <pre>
* *
@ -42,20 +42,34 @@ import com.raytheon.uf.common.time.DataTime;
* @version 1.0 * @version 1.0
*/ */
public class MosCacheGuidanceRequest extends CacheGuidanceRequest { public class MosCacheGuidanceRequest extends CacheGuidanceRequest {
// TODO remove use the one in CacheGuidanceRequest
protected String siteID; protected String siteID;
/**
* The Reference time can be null for the current time.
*/
protected Date refTime; protected Date refTime;
/** /**
* Get MOS tag for give site ID, model and the current time as the reference
* time.
*
* @param siteID * @param siteID
* @param model * @param model
* @param format * @return tag
* @return
*/ */
public static String getTag(String siteID, String model) { public static String getTag(String siteID, String model) {
return getTag(siteID, model, "current"); 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) { public static String getTag(String siteID, String model, String refTime) {
return model + ":" + siteID + ":" + refTime; return model + ":" + siteID + ":" + refTime;
} }
@ -72,10 +86,12 @@ public class MosCacheGuidanceRequest extends CacheGuidanceRequest {
return map; return map;
} }
// TODO remove use the one in CacheGuidanceRequest
public String getSiteID() { public String getSiteID() {
return this.siteID; return this.siteID;
} }
// TODO remove use the one in CacheGuidanceRequest
public void setSiteID(String siteID) { public void setSiteID(String siteID) {
this.siteID = siteID; this.siteID = siteID;
} }

View file

@ -46,7 +46,7 @@ import com.raytheon.viz.aviation.activator.Activator;
import com.raytheon.viz.aviation.monitor.AvnPyUtil; import com.raytheon.viz.aviation.monitor.AvnPyUtil;
/** /**
* TODO Add Description * Class to handle the cache data jobs.
* *
* <pre> * <pre>
* *
@ -101,8 +101,14 @@ public class PythonCacheGuidanceJob extends
*/ */
private Object waitMonitor; private Object waitMonitor;
/**
* Object to synchronize suspending/restarting the instance of this class.
*/
private Object suspendMonitor; private Object suspendMonitor;
/**
* True when job suspended otherwise false.
*/
boolean suspendJob; boolean suspendJob;
/** /**
@ -161,12 +167,18 @@ public class PythonCacheGuidanceJob extends
instance = null; instance = null;
} }
/**
* Indicate the jobs is to be suspended.
*/
public static final void suspend() { public static final void suspend() {
if (instance != null) { if (instance != null) {
instance.suspendJob = true; instance.suspendJob = true;
} }
} }
/**
* Notify the job it can resume working.
*/
public void restart() { public void restart() {
synchronized (instance.suspendMonitor) { synchronized (instance.suspendMonitor) {
instance.suspendJob = false; 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() { private void setupDispose() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
.addDisposeListener(new DisposeListener() { .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) { public synchronized void clearSiteObjs(Map<String, ArrayList<String>> tags) {
for (Object s : tags.keySet().toArray()) { for (Object s : tags.keySet().toArray()) {
String siteID = s.toString(); String siteID = s.toString();

View file

@ -23,7 +23,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* Guidance request used for caching data. * Guidance request used for caching Tamp data.
* *
* <pre> * <pre>
* *
@ -39,8 +39,16 @@ import java.util.Map;
* @version 1.0 * @version 1.0
*/ */
public class TampCacheGuidanceRequest extends CacheGuidanceRequest { public class TampCacheGuidanceRequest extends CacheGuidanceRequest {
// TODO remove use the one in CacheGuidanceRequest
protected String siteID; 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) { public static String getTag(String siteID, String model) {
return model + ":" + siteID; return model + ":" + siteID;
} }
@ -53,10 +61,12 @@ public class TampCacheGuidanceRequest extends CacheGuidanceRequest {
return map; return map;
} }
// TODO remove use the one in CacheGuidanceRequest
public String getSiteID() { public String getSiteID() {
return this.siteID; return this.siteID;
} }
// TODO remove use the one in CacheGuidanceRequest
public void setSiteID(String siteID) { public void setSiteID(String siteID) {
this.siteID = siteID; this.siteID = siteID;
} }

View file

@ -97,6 +97,11 @@ public class EtaViewer extends ViewerTab implements
*/ */
private List<String> stationList; 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; 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 @Override
public int generateGuidance(String siteID) { public int generateGuidance(String siteID) {
int cnt = super.generateGuidance(siteID); int cnt = super.generateGuidance(siteID);
@ -306,8 +317,6 @@ public class EtaViewer extends ViewerTab implements
} else { } else {
req.setSiteObjs(siteObjs); req.setSiteObjs(siteObjs);
req.setRoutine(routineChk.getSelection()); req.setRoutine(routineChk.getSelection());
// textComp.getHeaderStTxt().setText("");
// textComp.getDataStTxt().setText("");
PythonGuidanceJob.getInstance().enqueue(req); PythonGuidanceJob.getInstance().enqueue(req);
} }
return cnt; return cnt;
@ -333,10 +342,23 @@ public class EtaViewer extends ViewerTab implements
this.stationList = stationList; this.stationList = stationList;
} }
/**
* Get a tag for current time, site, and the tab's model.
*
* @param siteID
* @return tag
*/
private String getTag(String siteID) { private String getTag(String siteID) {
return MosCacheGuidanceRequest.getTag(siteID, this.model); return MosCacheGuidanceRequest.getTag(siteID, this.model);
} }
/**
* This creates a cache request.
*
* @param siteID
* @param format
* @return req
*/
private CacheGuidanceRequest createCacheRequest(String siteID, String format) { private CacheGuidanceRequest createCacheRequest(String siteID, String format) {
MosCacheGuidanceRequest req = new MosCacheGuidanceRequest(); MosCacheGuidanceRequest req = new MosCacheGuidanceRequest();
req.setTag(getTag(siteID)); req.setTag(getTag(siteID));
@ -347,6 +369,9 @@ public class EtaViewer extends ViewerTab implements
return req; return req;
} }
/**
* Queue a cache request for the list of sites.
*/
@Override @Override
public void generateCache(List<String> siteIDs) { public void generateCache(List<String> siteIDs) {
for (String siteID : siteIDs) { for (String siteID : siteIDs) {

View file

@ -49,6 +49,9 @@ public class GridGuidanceRequest extends GuidanceRequest {
this.siteObjs = siteObjs; this.siteObjs = siteObjs;
} }
/**
* Place in the map arguments need for grid.
*/
@Override @Override
public Map<String, Object> getPythonArguments() { public Map<String, Object> getPythonArguments() {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();

View file

@ -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 @Override
public int generateGuidance(String siteID) { public int generateGuidance(String siteID) {
int cnt = super.generateGuidance(siteID); int cnt = super.generateGuidance(siteID);
@ -320,8 +326,6 @@ public class GridViewer extends ViewerTab implements
} else { } else {
req.setSiteObjs(siteObjs); req.setSiteObjs(siteObjs);
req.setRoutine(routineChk.getSelection()); req.setRoutine(routineChk.getSelection());
// textComp.getHeaderStTxt().setText("");
// textComp.getDataStTxt().setText("");
PythonGuidanceJob.getInstance().enqueue(req); PythonGuidanceJob.getInstance().enqueue(req);
} }
return cnt; return cnt;
@ -347,6 +351,9 @@ public class GridViewer extends ViewerTab implements
this.stationList = stationList; this.stationList = stationList;
} }
/**
* Queue a cache request for the list of sites.
*/
@Override @Override
public void generateCache(List<String> siteIDs) { public void generateCache(List<String> siteIDs) {
for (String siteID : 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) { private String getTag(String siteID) {
return GridCacheGuidanceRequest.getTag(siteID); return GridCacheGuidanceRequest.getTag(siteID);
} }
/**
* Create grid cache request.
*
* @param siteID
* @return req
*/
private CacheGuidanceRequest createCacheRequest(String siteID) { private CacheGuidanceRequest createCacheRequest(String siteID) {
GridCacheGuidanceRequest req = new GridCacheGuidanceRequest(); GridCacheGuidanceRequest req = new GridCacheGuidanceRequest();
req.setTag(getTag(siteID)); req.setTag(getTag(siteID));

View file

@ -26,7 +26,7 @@ import java.util.Map;
import com.raytheon.uf.viz.core.jobs.QueueJobRequest; import com.raytheon.uf.viz.core.jobs.QueueJobRequest;
/** /**
* Basic request to generate guidance * Basic request to generate a request for the PythonGuidancdJob class.
* *
* <pre> * <pre>
* *
@ -45,32 +45,75 @@ import com.raytheon.uf.viz.core.jobs.QueueJobRequest;
public class GuidanceRequest extends QueueJobRequest<String[]> { 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 { public static enum GuidanceType {
MOS("tafgen"), TAMP("tampgen"), GRID("gridgen"), ETA("tafgen"), METAR( MOS("tafgen"), TAMP("tampgen"), GRID("gridgen"), ETA("tafgen"), METAR(
"metargen"), METAR_CACHE("clearMetarCache"), TAF_CACHE( "metargen"), METAR_CACHE("clearMetarCache"), TAF_CACHE(
"clearCache"); "clearCache");
/**
* The python method associated with the enumeration.
*/
private String pythonMethod; private String pythonMethod;
/**
* Constructor that associates a python method with the enumerator.
*
* @param pythonMethod
*/
private GuidanceType(String pythonMethod) { private GuidanceType(String pythonMethod) {
this.pythonMethod = pythonMethod; this.pythonMethod = pythonMethod;
} }
/**
* Get the enumeatior's python method.
*
* @return pythonMethod
*/
public String getPythonMethod() { public String getPythonMethod() {
return pythonMethod; return pythonMethod;
} }
} }
/**
* List of site ID to query for.
*/
protected ArrayList<String> siteIDs; protected ArrayList<String> siteIDs;
/**
* the model being used.
*/
protected String model; protected String model;
/**
* The format to use.
*/
protected String format; protected String format;
/**
* Type of request.
*/
protected GuidanceType guidanceType; protected GuidanceType guidanceType;
/**
* Tag associated with the request.
*/
protected String tag; 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() { public Map<String, Object> getPythonArguments() {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
map.put("siteIDs", siteIDs); map.put("siteIDs", siteIDs);
@ -79,42 +122,92 @@ public class GuidanceRequest extends QueueJobRequest<String[]> {
return map; return map;
} }
/**
* The list of sites request is for.
*
* @return siteIDs
*/
public ArrayList<String> getSiteIDs() { public ArrayList<String> getSiteIDs() {
return siteIDs; return siteIDs;
} }
/**
*
* @param siteIDs
* list of sites array request is for
*/
public void setSiteIDs(ArrayList<String> siteIDs) { public void setSiteIDs(ArrayList<String> siteIDs) {
this.siteIDs = siteIDs; this.siteIDs = siteIDs;
} }
/**
* The model argument for the request.
*
* @return model
*/
public String getModel() { public String getModel() {
return model; return model;
} }
/**
* Set the model argument for the request.
*
* @param model
*/
public void setModel(String model) { public void setModel(String model) {
this.model = model; this.model = model;
} }
/**
* The format argument for the request.
*
* @return format
*/
public String getFormat() { public String getFormat() {
return format; return format;
} }
/**
* Set the format argument for the request.
*
* @param format
*/
public void setFormat(String format) { public void setFormat(String format) {
this.format = format; this.format = format;
} }
/**
*
* @return guidanceType
*/
public GuidanceType getGuidanceType() { public GuidanceType getGuidanceType() {
return guidanceType; return guidanceType;
} }
/**
* Set the guidance type for the request.
*
* @param guidanceType
*/
public void setGuidanceType(GuidanceType guidanceType) { public void setGuidanceType(GuidanceType guidanceType) {
this.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() { public String getTag() {
return tag; return tag;
} }
/**
* Set the tag value of the request.
*
* @param tag
*/
public void setTag(String tag) { public void setTag(String tag) {
this.tag = tag; this.tag = tag;
} }
@ -132,6 +225,8 @@ public class GuidanceRequest extends QueueJobRequest<String[]> {
state = tag.equals(oReq.tag); state = tag.equals(oReq.tag);
} }
} }
// TODO remove debug statement.
if (state) { if (state) {
System.out.println("-- GuidanceRequest match tag: " + tag); System.out.println("-- GuidanceRequest match tag: " + tag);
} }

View file

@ -60,6 +60,8 @@ public class GuidanceUtil {
* @return * @return
*/ */
@Deprecated @Deprecated
// TODO Remove this method no longer used in java, python of xml
// configuration.
public static MetarRecord getLatestMetar(String siteID) { public static MetarRecord getLatestMetar(String siteID) {
try { try {
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>(); Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
@ -82,6 +84,13 @@ public class GuidanceUtil {
return null; return null;
} }
/**
* Get the GFE Point Data information for the task request.
*
* @param task
* @return gfePointDataContainer
* @throws VizException
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static GFEPointDataContainer getGFEPointData(GetPointDataRequest task) public static GFEPointDataContainer getGFEPointData(GetPointDataRequest task)
throws VizException { throws VizException {

View file

@ -51,6 +51,9 @@ public class MetarGuidanceRequest extends GuidanceRequest {
protected ArrayList<String> siteObjs; protected ArrayList<String> siteObjs;
/**
* Place in the map arguments need for Metar request.
*/
@Override @Override
public Map<String, Object> getPythonArguments() { public Map<String, Object> getPythonArguments() {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();

View file

@ -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) { private String getTag(String siteID, String size) {
return MetarCacheGuidanceRequest.getTag(siteID, 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 @Override
public int generateGuidance(String siteID) { public int generateGuidance(String siteID) {
int cnt = super.generateGuidance(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() { public boolean highlightAlerts() {
boolean state = false; boolean state = false;
if (!this.isDisposed()) { if (!this.isDisposed()) {
@ -487,6 +505,13 @@ public class MetarViewer extends ViewerTab implements
return siteObj; return siteObj;
} }
/**
* This creates a Metar cache data request.
*
* @param siteID
* @param size
* @return req
*/
private CacheGuidanceRequest createCacheRequest(String siteID, String size) { private CacheGuidanceRequest createCacheRequest(String siteID, String size) {
MetarCacheGuidanceRequest req = new MetarCacheGuidanceRequest(); MetarCacheGuidanceRequest req = new MetarCacheGuidanceRequest();
req.setTag(getTag(siteID, size)); req.setTag(getTag(siteID, size));
@ -496,6 +521,9 @@ public class MetarViewer extends ViewerTab implements
return req; return req;
} }
/**
* Queue a cache request for the list of sites.
*/
@Override @Override
public void generateCache(List<String> siteIDs) { public void generateCache(List<String> siteIDs) {
String size = prevChkHrs; String size = prevChkHrs;

View file

@ -167,6 +167,9 @@ public class MosViewer extends ViewerTab implements
*/ */
private List<String> stationList; private List<String> stationList;
/**
* Current header and data information displayed in the tab.
*/
private String[] currentGuidance; private String[] currentGuidance;
/** /**
@ -600,7 +603,7 @@ public class MosViewer extends ViewerTab implements
public String getSite(String site) { public String getSite(String site) {
return chooseModel(site, model); return chooseModel(site, model);
} }
/** /**
* Obtain the model. * Obtain the model.
* *

View file

@ -73,16 +73,36 @@ public class PythonGuidanceJob extends AbstractQueueJob<GuidanceRequest> {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PythonGuidanceJob.class); .getHandler(PythonGuidanceJob.class);
/**
* The single instance of this class.
*/
private static PythonGuidanceJob instance; 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>(); private static final List<ViewerTab> viewerList = new ArrayList<ViewerTab>();
/**
* instance of python to execute the python methods.
*/
private PythonScript python; private PythonScript python;
/**
* Object to synchronize on when changing the suspendJob state.
*/
private Object suspendMonitor; private Object suspendMonitor;
/**
* flag to indicate job is suspended.
*/
private boolean suspendJob; private boolean suspendJob;
/**
* Private constructor to enforce singleton.
*
* @param name
*/
private PythonGuidanceJob(String name) { private PythonGuidanceJob(String name) {
super(name); super(name);
suspendMonitor = new Object(); suspendMonitor = new Object();
@ -90,6 +110,9 @@ public class PythonGuidanceJob extends AbstractQueueJob<GuidanceRequest> {
setupDispose(); setupDispose();
} }
/**
* Flag to indicate job should go away.
*/
private boolean shutdown = false; private boolean shutdown = false;
/** /**
@ -124,30 +147,49 @@ public class PythonGuidanceJob extends AbstractQueueJob<GuidanceRequest> {
return instance; return instance;
} }
/**
* Shutdowns the running instance and cleans up any threads.
*/
private void shutdown() { private void shutdown() {
shutdown = true; shutdown = true;
restart(); restart();
instance = null; instance = null;
} }
/**
* Add a tab that needs to be told about alerts.
*
* @param viewerTab
*/
public final static synchronized void addViewerTab(ViewerTab viewerTab) { public final static synchronized void addViewerTab(ViewerTab viewerTab) {
viewerList.add(viewerTab); viewerList.add(viewerTab);
PythonCacheGuidanceJob.getInstance().restart(); PythonCacheGuidanceJob.getInstance().restart();
PythonGuidanceJob.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) { public final static synchronized void removeViwerTab(ViewerTab viewerTab) {
viewerList.remove(viewerTab); viewerList.remove(viewerTab);
PythonCacheGuidanceJob.suspend(); PythonCacheGuidanceJob.suspend();
PythonGuidanceJob.suspend(); PythonGuidanceJob.suspend();
} }
/**
* Stop process of request and clear the queue.
*/
private final static void suspend() { private final static void suspend() {
if (instance != null) { if (instance != null) {
instance.suspendJob = true; instance.suspendJob = true;
} }
} }
/**
* Restart processing of request.
*/
private void restart() { private void restart() {
synchronized (instance.suspendMonitor) { synchronized (instance.suspendMonitor) {
instance.suspendJob = false; 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() { private void setupDispose() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell() PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
@ -337,6 +382,12 @@ public class PythonGuidanceJob extends AbstractQueueJob<GuidanceRequest> {
return Status.OK_STATUS; 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) { public void waitForCacheRequests(List<CacheGuidanceRequest> cacheRequests) {
PythonCacheGuidanceJob.getInstance() PythonCacheGuidanceJob.getInstance()
.waitForCacheRequests(cacheRequests); .waitForCacheRequests(cacheRequests);

View file

@ -56,6 +56,9 @@ public class TampRequest extends GuidanceRequest {
protected ArrayList<String> siteObjs; protected ArrayList<String> siteObjs;
/**
* Overrides the method to place the arguments needed for TAMP request.
*/
@Override @Override
public Map<String, Object> getPythonArguments() { public Map<String, Object> getPythonArguments() {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();

View file

@ -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 @Override
public int generateGuidance(String siteID) { public int generateGuidance(String siteID) {
int cnt = super.generateGuidance(siteID); int cnt = super.generateGuidance(siteID);
@ -356,10 +362,22 @@ public class TugViewer extends ViewerTab implements
this.stationList = stationList; this.stationList = stationList;
} }
/**
* Get the tag for the desired Tamp Cache Request.
*
* @param siteID
* @return
*/
private String getTag(String siteID) { private String getTag(String siteID) {
return TampCacheGuidanceRequest.getTag(siteID, model); return TampCacheGuidanceRequest.getTag(siteID, model);
} }
/**
* This creates a Tamp cache data request.
*
* @param siteID
* @return
*/
private CacheGuidanceRequest createCacheRequest(String siteID) { private CacheGuidanceRequest createCacheRequest(String siteID) {
TampCacheGuidanceRequest req = new TampCacheGuidanceRequest(); TampCacheGuidanceRequest req = new TampCacheGuidanceRequest();
req.setTag(getTag(siteID)); req.setTag(getTag(siteID));
@ -369,6 +387,9 @@ public class TugViewer extends ViewerTab implements
return req; return req;
} }
/**
* Queue a cache request for the list of sites.
*/
@Override @Override
public void generateCache(List<String> siteIDs) { public void generateCache(List<String> siteIDs) {
for (String siteID : siteIDs) { for (String siteID : siteIDs) {

View file

@ -123,12 +123,18 @@ public abstract class ViewerTab extends Composite {
*/ */
protected IStatusSettable msgStatComp; protected IStatusSettable msgStatComp;
/**
* Current site.
*/
protected String siteID; protected String siteID;
/**
* Taf data for the current site.
*/
protected TafSiteData siteData; 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; private boolean displayCurrent = false;
@ -149,8 +155,16 @@ public abstract class ViewerTab extends Composite {
*/ */
protected boolean allChkIsSelected; protected boolean allChkIsSelected;
/**
* Dialog the viewer is associated with.
*/
protected TafViewerEditorDlg tafViewerEditorDlg; protected TafViewerEditorDlg tafViewerEditorDlg;
/**
* Set dialog viewer is associated with.
*
* @param tafViewerEditorDlg
*/
public void setTafViewerEditorDlg(TafViewerEditorDlg tafViewerEditorDlg) { public void setTafViewerEditorDlg(TafViewerEditorDlg tafViewerEditorDlg) {
this.tafViewerEditorDlg = tafViewerEditorDlg; this.tafViewerEditorDlg = tafViewerEditorDlg;
} }
@ -168,6 +182,13 @@ public abstract class ViewerTab extends Composite {
PythonGuidanceJob.addViewerTab(this); 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); abstract public void generateCache(List<String> siteIDs);
/* /*
@ -185,18 +206,40 @@ public abstract class ViewerTab extends Composite {
super.dispose(); super.dispose();
} }
/**
*
* @return displayCurrent true when tab is populated with the current
* request
*/
public boolean isDisplayCurrent() { public boolean isDisplayCurrent() {
return displayCurrent; 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) { public void setDisplayCurrent(boolean displayCurrent) {
this.displayCurrent = displayCurrent; this.displayCurrent = displayCurrent;
} }
/**
* Indicates the tab is selected as the current tab being displayed.
*
* @return currentTab
*/
public boolean isCurrentTab() { public boolean isCurrentTab() {
return currentTab; return currentTab;
} }
/**
* Set the current tab state.
*
* @param currentTab
*/
public void setCurrentTab(boolean currentTab) { public void setCurrentTab(boolean currentTab) {
this.currentTab = currentTab; this.currentTab = currentTab;
} }
@ -249,20 +292,29 @@ public abstract class ViewerTab extends Composite {
protected abstract void createTopControls(ResourceConfigMgr configMgr); protected abstract void createTopControls(ResourceConfigMgr configMgr);
/** /**
* This method is called so any extra initialization/setup and be done after * This method is called so any extra initialization/setup can be performed
* the initializeComponents method is called. * after the initializeComponents method is called.
*/ */
protected abstract void finalInitialization(); 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( private AtomicInteger generatGuidanceCount = new AtomicInteger(
Integer.MIN_VALUE); 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 * @param siteID
* Site ID. * Site ID.
* @return cnt unique count * @return cnt unique count that increases each time the method is called.
*/ */
public int generateGuidance(String siteID) { public int generateGuidance(String siteID) {
int cnt = generatGuidanceCount.incrementAndGet(); int cnt = generatGuidanceCount.incrementAndGet();
@ -271,10 +323,20 @@ public abstract class ViewerTab extends Composite {
return cnt; return cnt;
} }
/**
* Used to force request to get the current sites data.
*/
void reGenerateGuidance() { void reGenerateGuidance() {
generateGuidance(siteID); 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() { public void requestComplete() {
tafViewerEditorDlg.populateTafViewer(); 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(); 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); 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 * 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 * @param cnt
* - Unique count to indicate this request is still active. * - 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) { protected TafSiteData getSiteData(String site) {
ITafSiteConfig config; ITafSiteConfig config;
TafSiteData data = null; TafSiteData data = null;
@ -585,8 +665,25 @@ public abstract class ViewerTab extends Composite {
return data; return data;
} }
/**
* Let the implementing class determine what should be returned for the
* site.
*
* @param site
* @return
*/
public abstract String getSite(String site); 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) { public String chooseModel(String site, String model) {
if ("gfslamp".equals(model)) { if ("gfslamp".equals(model)) {
return getSiteData(site).gfslamp; return getSiteData(site).gfslamp;

View file

@ -34,7 +34,8 @@ import org.eclipse.swt.widgets.Composite;
/** /**
* This class creates all of the buttons that corresponds to the available * 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> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
@ -110,10 +111,8 @@ public class AvailMethodsComp extends Composite {
} }
Collections.sort(keyList); Collections.sort(keyList);
// for (int x = 0; x < methodArray.size(); ++x) {
for (String key : keyList) { for (String key : keyList) {
methodData = methodArray.get(methodIndex.get(key).intValue()); methodData = methodArray.get(methodIndex.get(key).intValue());
// methodData = methodArray.get(x);
gd = new GridData(160, SWT.DEFAULT); gd = new GridData(160, SWT.DEFAULT);
Button tmpBtn = new Button(this, SWT.PUSH); Button tmpBtn = new Button(this, SWT.PUSH);

View file

@ -20,7 +20,8 @@
package com.raytheon.viz.avnconfig; 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> * <pre>
* *
@ -37,6 +38,10 @@ package com.raytheon.viz.avnconfig;
*/ */
public class AvnConfigConstants { public class AvnConfigConstants {
/**
* Rule methods for the mtr tab.
*/
private static final String[] mtrs_methods = { "AirportOpsThresh", private static final String[] mtrs_methods = { "AirportOpsThresh",
"CigCatDelta", "CigMetarThresh", "CigTafThresh", "DDDelta", "CigCatDelta", "CigMetarThresh", "CigTafThresh", "DDDelta",
"FFDelta", "FltCatDelta", "FuelAlternate", "LFFMetar", "FFDelta", "FltCatDelta", "FuelAlternate", "LFFMetar",
@ -45,41 +50,97 @@ public class AvnConfigConstants {
"CAC_FltCatDelta", "CAC_AirportOpsThresh", "CAC_VsbyMetarThresh", "CAC_FltCatDelta", "CAC_AirportOpsThresh", "CAC_VsbyMetarThresh",
"CAC_VsbyTafThresh", "CAC_WxTafDelta" }; "CAC_VsbyTafThresh", "CAC_WxTafDelta" };
/**
* Rule methods for the grids tab.
*/
private static final String[] grids_methods = { "DDDelta", "FFDelta", private static final String[] grids_methods = { "DDDelta", "FFDelta",
"CigCatDelta", "SkyMismatch", "VsbyCatDelta", "WxTafDelta", "CigCatDelta", "SkyMismatch", "VsbyCatDelta", "WxTafDelta",
"WxGridsDelta" }; "WxGridsDelta" };
/**
* Rule methods for the ltg tab.
*/
private static final String[] ltg_methods = { "TSObsDelta" }; private static final String[] ltg_methods = { "TSObsDelta" };
/**
* Rule methods for the rltg tab.
*/
private static final String[] rltg_methods = { "TSInTaf", "TSNotInTaf" }; private static final String[] rltg_methods = { "TSInTaf", "TSNotInTaf" };
/**
* Rule methods for the ccfp tab.
*/
private static final String[] ccfp_methods = { "TSNotInTaf", "CBNotInTaf" }; private static final String[] ccfp_methods = { "TSNotInTaf", "CBNotInTaf" };
/**
* Rule methods for the llws tab.
*/
private static final String[] llws_methods = { "WSinRadar" }; 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", public static final String[] MONITORING_RULE_FIELDS = { ".type", ".unique",
".args", ".msg", ".comment" }; ".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"; 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 { public enum DataSource {
mtrs("mtrs", mtrs_methods), ltg("ltg", ltg_methods), rltg("rltg", mtrs("mtrs", mtrs_methods), ltg("ltg", ltg_methods), rltg("rltg",
rltg_methods), ccfp("ccfp", ccfp_methods), grids("grids", rltg_methods), ccfp("ccfp", ccfp_methods), grids("grids",
grids_methods), llws("llws", llws_methods); grids_methods), llws("llws", llws_methods);
/**
* The methods for the monitoring rules
*/
private String[] methods; private String[] methods;
/**
* The file name without the suffix.
*/
private String filename; 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) { private DataSource(String fname, String[] array) {
methods = array; methods = array;
filename = fname; filename = fname;
} }
/**
* Get the array of methods used with the monitoring rules.
*
* @return methods
*/
public String[] getMethods() { public String[] getMethods() {
return methods; 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() { public String getFilename() {
return filename + ".cfg"; return filename + ".cfg";
} }
@ -92,6 +153,12 @@ public class AvnConfigConstants {
vsby, wind, sky, wx, cat; 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 { public enum triggerType {
TAF, METAR, CCFP; TAF, METAR, CCFP;
} }

View file

@ -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;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.localization.LocalizationManager; 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> * <pre>
* *
@ -49,7 +49,9 @@ import com.raytheon.uf.viz.core.status.StatusConstants;
*/ */
public class AvnConfigFileUtil { 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. * Obtain the LocalizationFile for configuration file.
* *
@ -63,10 +65,9 @@ public class AvnConfigFileUtil {
if (lFile == null) { if (lFile == null) {
String site = LocalizationManager.getInstance().getCurrentSite(); String site = LocalizationManager.getInstance().getCurrentSite();
statusHandler.handle(Priority.CRITICAL, statusHandler.handle(Priority.CRITICAL, "Unable to find \""
"Unable to find \"" + configFile + configFile + "\" under the directory for site " + site
+ "\" under the directory for site " + site + ".", + ".", null);
null);
} }
return lFile; return lFile;
@ -119,12 +120,10 @@ public class AvnConfigFileUtil {
File file = pm.getStaticFile(configFile); File file = pm.getStaticFile(configFile);
if (file == null) { if (file == null) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM, "Unable to find \""
"Unable to find \"" + configFile + "\" under the directory for site "
+ configFile + LocalizationManager.getInstance().getCurrentSite() + ".",
+ "\" under the directory for site " null);
+ LocalizationManager.getInstance()
.getCurrentSite() + ".", null);
} }
return file; return file;

View file

@ -43,7 +43,7 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource;
import com.raytheon.viz.avnconfig.AvnConfigConstants.RuleType; 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 * 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 * 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 * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 12, 2009 avarani Initial creation * 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 * parsing and allow msg & comment to have
* commas in the text. * commas in the text.
* Sep 27, 2011 10958 rferrel Added checks for required fields in * Sep 27, 2011 10958 rferrel Added checks for required fields in
@ -171,6 +171,10 @@ public class AvnConfiguration {
return value.toString(); return value.toString();
} }
/**
* Load in information for each rule method in DataSource. Information is
* used to populate the Rule Editor section.
*/
private void reload() { private void reload() {
HierarchicalPreferenceStore store = Activator.getDefault() HierarchicalPreferenceStore store = Activator.getDefault()
.getPreferenceStore(); .getPreferenceStore();
@ -234,6 +238,19 @@ public class AvnConfiguration {
return configuration; 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, public void setRules(String site, DataSource source,
ArrayList<MethodData> data) throws ConfigurationException, ArrayList<MethodData> data) throws ConfigurationException,
IOException, LocalizationOpFailedException { IOException, LocalizationOpFailedException {
@ -296,6 +313,19 @@ public class AvnConfiguration {
lFile.save(); 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, public ArrayList<MethodData> getRules(String site, DataSource source,
final int maxSeverity) throws ConfigurationException, IOException { final int maxSeverity) throws ConfigurationException, IOException {
ArrayList<MethodData> rules = new ArrayList<MethodData>(); ArrayList<MethodData> rules = new ArrayList<MethodData>();

View file

@ -724,6 +724,12 @@ public class DataSourceTabComp extends Composite implements
activeRules.clear(); activeRules.clear();
saveRules(siteID); 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); 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, public void reloadRules(String siteID) throws LocalizationException,
ConfigurationException { ConfigurationException {
this.siteID = siteID; this.siteID = siteID;
@ -752,6 +765,12 @@ public class DataSourceTabComp extends Composite implements
populateList(); populateList();
} }
/**
* Load active rules for the tab.
*
* @throws LocalizationException
* @throws ConfigurationException
*/
private void loadActiveRulesList() throws LocalizationException, private void loadActiveRulesList() throws LocalizationException,
ConfigurationException { ConfigurationException {
AvnConfiguration config = AvnConfiguration.load(false); 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() { public String getDataSource() {
return pageData.getDataSource(); return pageData.getDataSource();
} }

View file

@ -375,6 +375,7 @@ public class FindReplaceDlg extends CaveSWTDialog {
* "Replace by" text field * "Replace by" text field
*/ */
private void replaceAll() { private void replaceAll() {
// TODO change to: while(findWhatText() { replaceText();}
while (1 == 1) { while (1 == 1) {
if (findWhatText()) { if (findWhatText()) {
replaceText(); replaceText();

View file

@ -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) { public void updateTextControl(String key, String text) {
Text textControl = textControlMap.get(key); Text textControl = textControlMap.get(key);
textControl.setText(text); textControl.setText(text);

View file

@ -42,11 +42,11 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text; 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.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory; 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;
import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType;
@ -106,12 +106,14 @@ public class MessageStatusComp extends Composite implements IStatusSettable {
private MessageViewerDlg msgViewerDlg; 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; private RGB bgRGB;
/** /**
* New background color. * New background color for the msgViewerBtn.
*/ */
private Color newBgColor; private Color newBgColor;
@ -120,18 +122,41 @@ public class MessageStatusComp extends Composite implements IStatusSettable {
*/ */
private StatusMessageType msgType = null; private StatusMessageType msgType = null;
/**
* Use to control the blinking of the background color.
*/
private Timer timer; private Timer timer;
/**
* Task use by timer to do the blinking work.
*/
private TimerTask timerTask; private TimerTask timerTask;
/**
* Counter used to determine how long to blink.
*/
private int timerCounter = 0; private int timerCounter = 0;
/**
* The color to use for the blinking.
*/
private Color currentMsgColor; private Color currentMsgColor;
/**
* When false blinking is active.
*/
private boolean timerDone = true; 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; private RGB messageBgRGB;
/**
* The normal back ground color for the text field.
*/
private Color messageBgColor; private Color messageBgColor;
/** /**
@ -140,7 +165,11 @@ public class MessageStatusComp extends Composite implements IStatusSettable {
* @param parent * @param parent
* Parent composite. * Parent composite.
* @param bgRGB * @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) { public MessageStatusComp(Composite parent, RGB bgRGB, RGB messageBgRGB) {
super(parent, SWT.NONE); super(parent, SWT.NONE);
@ -162,7 +191,10 @@ public class MessageStatusComp extends Composite implements IStatusSettable {
* @param msgType * @param msgType
* Status message type. * Status message type.
* @param bgRGB * @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, public MessageStatusComp(Composite parent, StatusMessageType msgType,
RGB bgRGB, RGB messageBgRGB) { 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 * @param msg
* Message to add to the dialog. * Message to add to the dialog.

View file

@ -100,6 +100,7 @@ public class MethodData implements Comparable<MethodData> {
* @param methodArgsArray * @param methodArgsArray
* Array of MethodArgData. * Array of MethodArgData.
*/ */
// TODO - no references to this constructor. Can it be removed?
public MethodData(String methodName, String comment, public MethodData(String methodName, String comment,
ArrayList<MethodArgData> methodArgsArray) { ArrayList<MethodArgData> methodArgsArray) {
this.methodName = methodName; 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) { public void setMsgFromFile(boolean value) {
msgFromFile = value; msgFromFile = value;
} }
/**
* Indicates if message comes form a file.
*
* @return
*/
public boolean getMsgFromFile() { public boolean getMsgFromFile() {
return msgFromFile; return msgFromFile;
} }

View file

@ -88,7 +88,7 @@ public class MonitoringCriteriaDlg extends Dialog {
private Text siteIdTF; private Text siteIdTF;
/** /**
* Site ID * Site ID initially set to the default id.
*/ */
private String siteId = "XXXX"; private String siteId = "XXXX";
@ -391,12 +391,22 @@ public class MonitoringCriteriaDlg extends Dialog {
StatusMessageType.MonitoringCriteria, null, null); StatusMessageType.MonitoringCriteria, null, null);
} }
/**
* Create the rule methods for all pages.
*/
private void createDefaultRuleData() { private void createDefaultRuleData() {
for (DataSource source : DataSource.values()) { for (DataSource source : DataSource.values()) {
defaultRuleData.addPageData(createPageData(source)); 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) { private PageData createPageData(DataSource dataSource) {
PageData pageData = new PageData(dataSource.toString()); PageData pageData = new PageData(dataSource.toString());
AvnConfiguration configData = AvnConfiguration.load(false); AvnConfiguration configData = AvnConfiguration.load(false);
@ -409,6 +419,12 @@ public class MonitoringCriteriaDlg extends Dialog {
return pageData; return pageData;
} }
/**
* Obtain the data information and comment for a give rule.
*
* @param rule
* @return methodData
*/
private MethodData createMethodData(MethodData rule) { private MethodData createMethodData(MethodData rule) {
MethodData methodData = new MethodData(rule.getMethodName(), MethodData methodData = new MethodData(rule.getMethodName(),
rule.getComment(), rule.getMessage(), rule.getType(), rule.getComment(), rule.getMessage(), rule.getType(),
@ -425,10 +441,22 @@ public class MonitoringCriteriaDlg extends Dialog {
return methodData; 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) { private MethodArgData createMethodArgData(String argName, String argValue) {
return new MethodArgData(argName, argValue); return new MethodArgData(argName, argValue);
} }
/**
* Load the monitoring rules currently in use for site selected by the user.
*/
private void loadSite() { private void loadSite() {
siteId = siteIdTF.getText().trim().toUpperCase(); siteId = siteIdTF.getText().trim().toUpperCase();
siteIdTF.setText(siteId); siteIdTF.setText(siteId);

View file

@ -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.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; 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 { public class OpenSaveDlg extends Dialog {
/** /**
* Dialog shell. * Dialog shell.
@ -54,28 +69,67 @@ public class OpenSaveDlg extends Dialog {
*/ */
private Display display; 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 { public static enum DialogType {
OPEN, SAVE_AS OPEN, SAVE_AS
}; };
/**
* Dialog type. This is always OPEN.
*/
@Deprecated
private DialogType dialogType; private DialogType dialogType;
/**
* Font used to display file list.
*/
private Font controlFont; private Font controlFont;
/**
* List of localized files that can be edited.
*/
private List cfgFileList; private List cfgFileList;
/**
* The localize file selected by the user.
*/
private LocalizationFile selectedFile; private LocalizationFile selectedFile;
/**
* List of localized files used to generate the file list.
*/
private LocalizationFile[] locFiles; private LocalizationFile[] locFiles;
/**
* Uses file's display name as key to get the associated localized file.
*/
private Map<String, LocalizationFile> locFileMap; private Map<String, LocalizationFile> locFileMap;
/**
* Constructor
*
* @param parent
* shell
* @param type
*/
public OpenSaveDlg(Shell parent, DialogType type) { public OpenSaveDlg(Shell parent, DialogType type) {
super(parent, 0); super(parent, 0);
dialogType = type; 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() { public Object open() {
Shell parent = getParent(); Shell parent = getParent();
display = parent.getDisplay(); display = parent.getDisplay();
@ -106,6 +160,9 @@ public class OpenSaveDlg extends Dialog {
return null; return null;
} }
/**
* Set up the dialog's display components.
*/
private void initializeComponents() { private void initializeComponents() {
locFileMap = new TreeMap<String, LocalizationFile>(); locFileMap = new TreeMap<String, LocalizationFile>();
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL); controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
@ -118,6 +175,10 @@ public class OpenSaveDlg extends Dialog {
getAvailableConfigFiles(); getAvailableConfigFiles();
} }
/**
* Create the label and the scroll list that will contain the files the user
* can edit.
*/
private void createListControl() { private void createListControl() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite listComp = new Composite(shell, SWT.NONE); Composite listComp = new Composite(shell, SWT.NONE);
@ -137,7 +198,13 @@ public class OpenSaveDlg extends Dialog {
cfgFileList.setFont(controlFont); cfgFileList.setFont(controlFont);
} }
/**
* Determine based on DialogType what kind of action button to place at the
* bottom of the dialog.
*/
private void createBottomButtons() { 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); GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite mainButtonComp = new Composite(shell, SWT.NONE); Composite mainButtonComp = new Composite(shell, SWT.NONE);
mainButtonComp.setLayout(new GridLayout(1, false)); 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() { private void getAvailableConfigFiles() {
String[] extensions = new String[] { ".xml", ".cfg" }; String[] extensions = new String[] { ".xml", ".cfg" };
LocalizationType[] types = new LocalizationType[] { 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() { public LocalizationFile getSelectedFile() {
return selectedFile; return selectedFile;
} }

View file

@ -22,24 +22,24 @@ package com.raytheon.viz.avnconfig;
import java.util.ArrayList; import java.util.ArrayList;
/** /**
* A class containing 'page' data where the page is the tab on a tab folder * A class containing 'page' data where the page is the tab on a tab folder and
* and the data contained in each folder. * the data contained in each folder.
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 22 MAY 2008 1119 lvenable Initial creation * 22 MAY 2008 1119 lvenable Initial creation
* *
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
* @version 1.0 * @version 1.0
* *
*/ */
public class PageData { public class PageData {
/** /**
* Data source (or page name). * Data source (or page/tab name).
*/ */
private String dataSource; private String dataSource;
@ -57,7 +57,9 @@ public class PageData {
/** /**
* Constructor. * Constructor.
* @param dataSource Data source (page name). *
* @param dataSource
* Data source (page name).
*/ */
public PageData(String dataSource) { public PageData(String dataSource) {
this.dataSource = dataSource; this.dataSource = dataSource;
@ -66,8 +68,11 @@ public class PageData {
/** /**
* Constructor. * 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) { public PageData(String dataSource, ArrayList<MethodData> methodArray) {
this.dataSource = dataSource; this.dataSource = dataSource;
@ -83,7 +88,9 @@ public class PageData {
/** /**
* Add MethodData to the MethodData array. * Add MethodData to the MethodData array.
* @param methodData MethodData object. *
* @param methodData
* MethodData object.
*/ */
public void addMethodData(MethodData methodData) { public void addMethodData(MethodData methodData) {
methodArray.add(methodData); methodArray.add(methodData);
@ -91,6 +98,7 @@ public class PageData {
/** /**
* Get the data source name. * Get the data source name.
*
* @return The data source name. * @return The data source name.
*/ */
public String getDataSource() { public String getDataSource() {
@ -99,7 +107,9 @@ public class PageData {
/** /**
* Set the data source name. * Set the data source name.
* @param dataSource The data source name. *
* @param dataSource
* The data source name.
*/ */
public void setDataSource(String dataSource) { public void setDataSource(String dataSource) {
this.dataSource = dataSource; this.dataSource = dataSource;
@ -107,6 +117,7 @@ public class PageData {
/** /**
* Get the array of MethodData. * Get the array of MethodData.
*
* @return The array of MethodData. * @return The array of MethodData.
*/ */
public ArrayList<MethodData> getMethodArray() { public ArrayList<MethodData> getMethodArray() {
@ -115,6 +126,7 @@ public class PageData {
/** /**
* Set the array of MethodData. * Set the array of MethodData.
*
* @return The array of MethodData. * @return The array of MethodData.
*/ */
public void setMethodArray(ArrayList<MethodData> methodArray) { public void setMethodArray(ArrayList<MethodData> methodArray) {

View file

@ -605,6 +605,11 @@ public class TafProductConfigDlg extends Dialog {
StatusMessageType.TafProdConfig, null, null); 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() { private void update() {
try { try {
ITafSiteConfig config = TafSiteConfigFactory.getInstance(); 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() { private void verify() {
try { try {
ITafSiteConfig config = TafSiteConfigFactory.getInstance(); ITafSiteConfig config = TafSiteConfigFactory.getInstance();

View file

@ -9,9 +9,15 @@ import org.apache.commons.configuration.ConfigurationException;
* implements the ITafSiteConfig interface. Intent is to allow changing between * implements the ITafSiteConfig interface. Intent is to allow changing between
* classes without having to impact all the other classes that depend on * classes without having to impact all the other classes that depend on
* configuration class. This assumes implementing ITafSiteConfig contains the * 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. * 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> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY

View file

@ -103,6 +103,9 @@ public class TafSiteConfigIni implements ITafSiteConfig {
*/ */
private static final String TMPL_EXT = "template"; private static final String TMPL_EXT = "template";
/**
* The template extension with the "." prefix.
*/
private static final String TMPL_DOT_EXT = "." + TMPL_EXT; 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"; private static final String PROD_EXT = "cfg";
/**
* the product extension the the "." prefix.
*/
private static final String PROD_DOT_EXT = "." + PROD_EXT; private static final String PROD_DOT_EXT = "." + PROD_EXT;
/** /**
@ -259,6 +265,13 @@ public class TafSiteConfigIni implements ITafSiteConfig {
return triggerMap; 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) { private HierarchicalINIConfiguration getProductConfig(String product) {
HierarchicalINIConfiguration config = configMaps.get(product); HierarchicalINIConfiguration config = configMaps.get(product);
if (config == null) { if (config == null) {
@ -647,6 +660,16 @@ public class TafSiteConfigIni implements ITafSiteConfig {
return config; 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) { private LocalizationFile[] getLfiles(String dir, String ext) {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext( LocalizationContext context = pm.getContext(

View file

@ -309,7 +309,14 @@ public class TafSiteInfoEditorDlg extends Dialog {
createBottomMessageControls(); createBottomMessageControls();
} }
/**
* Converts an array into a comma separated string
*
* @param array
* @return string
*/
private String arrayToString(String[] array) { private String arrayToString(String[] array) {
// TODO convert to use StringBuilder.
String s = ""; String s = "";
for (int i = 0; i < array.length; i++) { for (int i = 0; i < array.length; i++) {
@ -1577,6 +1584,10 @@ public class TafSiteInfoEditorDlg extends Dialog {
return elevationTF.getText().matches("^-?[0-9]+$"); 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() { private void loadSite() {
boolean loadFailed = false; boolean loadFailed = false;
String loadFailedMsg = null; String loadFailedMsg = null;

View file

@ -64,7 +64,7 @@ import com.raytheon.viz.avnconfig.OpenSaveDlg.DialogType;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/** /**
* Text Editor dialog. * A simple text Editor dialog allowing the user to modify a localized file.
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
@ -151,6 +151,14 @@ public class TextEditorSetupDlg extends CaveSWTDialog {
this(parent, null); 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) { public TextEditorSetupDlg(Shell parent, LocalizationFile lFile) {
super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT);
setText("AvnFPS Text Editor"); setText("AvnFPS Text Editor");
@ -642,6 +650,9 @@ public class TextEditorSetupDlg extends CaveSWTDialog {
editorTextComp.setMenu(popupMenu); editorTextComp.setMenu(popupMenu);
} }
/**
* The call back action for the Undo button.
*/
private void undoText() { private void undoText() {
if (undoStack.size() > 0) { if (undoStack.size() > 0) {
HashMap<String, Object> undoData = undoStack.remove(undoStack 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() { private void redoText() {
if (redoStack.size() > 0) { if (redoStack.size() > 0) {
HashMap<String, Object> redoData = redoStack.remove(redoStack HashMap<String, Object> redoData = redoStack.remove(redoStack
@ -830,6 +844,11 @@ public class TextEditorSetupDlg extends CaveSWTDialog {
openFile(dlg.getSelectedFile()); openFile(dlg.getSelectedFile());
} }
/**
* Get the contents of a localized file and populates the editor.
*
* @param lFile
*/
private void openFile(LocalizationFile lFile) { private void openFile(LocalizationFile lFile) {
openedFile = lFile; openedFile = lFile;

View file

@ -51,7 +51,9 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.avnconfig.AvnConfigConstants.triggerType; 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> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
@ -67,6 +69,7 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.triggerType;
* @version 1.0 * @version 1.0
* *
*/ */
@Deprecated
public class TriggerEditorDlg extends Dialog { public class TriggerEditorDlg extends Dialog {
/** /**
* Dialog shell. * Dialog shell.

View file

@ -21,6 +21,7 @@ package com.raytheon.viz.gfe.dialogs;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; 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.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.viz.core.mode.CAVEMode; 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.DataManager;
import com.raytheon.viz.gfe.core.IParmManager; 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 * 06/10/2008 Eric Babin Initial Creation
* 04/30/2009 2282 rjpeter Refactored interfaces. * 04/30/2009 2282 rjpeter Refactored interfaces.
* 08/19/2009 2547 rjpeter Implement Test/Prac database display. * 08/19/2009 2547 rjpeter Implement Test/Prac database display.
* 02/22/2012 14351 mli update with incoming databases
* </pre> * </pre>
* *
* @author ebabin * @author ebabin
@ -114,6 +117,14 @@ public class WEBrowserTypeRecord {
public java.util.List<String> getSources() { public java.util.List<String> getSources() {
return sources; return sources;
} }
/**
* @return the sources
*/
public java.util.List<String> getUpdatedSources() {
makeSources();
return sources;
}
/** /**
* @return the fields * @return the fields
@ -134,9 +145,18 @@ public class WEBrowserTypeRecord {
pracFlag = mode.equals(CAVEMode.PRACTICE); pracFlag = mode.equals(CAVEMode.PRACTICE);
testFlag = mode.equals(CAVEMode.TEST); testFlag = mode.equals(CAVEMode.TEST);
} }
List<DatabaseID> dbs = DataManager.getCurrentInstance() // List<DatabaseID> dbs = DataManager.getCurrentInstance()
.getParmManager().getAvailableDbs(); // .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>(); ArrayList<DatabaseID> filtDB = new ArrayList<DatabaseID>();
for (DatabaseID db : dbs) { for (DatabaseID db : dbs) {
@ -417,6 +437,25 @@ public class WEBrowserTypeRecord {
return possibleParms; 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[], public ArrayList<ParmID> getFilteredParmIDs(String sources[],
String fields[], String planes[]) { String fields[], String planes[]) {
ArrayList<ParmID> listToReturn = new ArrayList<ParmID>(); ArrayList<ParmID> listToReturn = new ArrayList<ParmID>();

View file

@ -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.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.viz.core.mode.CAVEMode; 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.DataManager;
import com.raytheon.viz.gfe.core.parm.Parm; import com.raytheon.viz.gfe.core.parm.Parm;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; 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. * 06/27/2008 ebabin Updated to properly add fields.
* 04/30/2009 2282 rjpeter Refactored. * 04/30/2009 2282 rjpeter Refactored.
* 08/19/2009 2547 rjpeter Fix Test/Prac database display. * 08/19/2009 2547 rjpeter Fix Test/Prac database display.
* 02/22/2012 14351 mli update with incoming new grids.
* </pre> * </pre>
* *
* @author ebabin * @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() { private void processSourceSelection() {
java.util.List<String> currentSourceSelection = java.util.Arrays java.util.List<String> currentSourceSelection = java.util.Arrays
.asList(sourceList.getSelection()); .asList(sourceList.getSelection());
@ -814,6 +858,9 @@ public class WeatherElementBrowserDialog extends CaveJFACEDialog {
sourceToolItem.addSelectionListener(new SelectionAdapter() { sourceToolItem.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
// Check for new source
checkForNewSource();
Rectangle rect = sourceToolItem.getBounds(); Rectangle rect = sourceToolItem.getBounds();
Point pt = new Point(rect.x, rect.y + rect.height); Point pt = new Point(rect.x, rect.y + rect.height);
pt = sourceToolBar.toDisplay(pt); pt = sourceToolBar.toDisplay(pt);
@ -1205,9 +1252,18 @@ public class WeatherElementBrowserDialog extends CaveJFACEDialog {
private List<DatabaseID> getDatabases() { private List<DatabaseID> getDatabases() {
if (databases == null) { 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() { private ParmID[] getSelectedParmIDS() {

View file

@ -110,6 +110,7 @@ import com.raytheon.viz.ui.statusline.StatusStore;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 5, 2008 Eric Babin Initial Creation * Jun 5, 2008 Eric Babin Initial Creation
* Sep 27,2010 5813 gzhou get etn from param pattern hazXXXnnn * Sep 27,2010 5813 gzhou get etn from param pattern hazXXXnnn
* Feb 28,2012 14436 mli Add RP.S - Rip Current
* *
* </pre> * </pre>
* *
@ -1309,7 +1310,7 @@ public class MakeHazardDialog extends CaveSWTDialog implements
hazardMap.put("Fire Weather", Arrays.asList("FW.A", "FW.W")); hazardMap.put("Fire Weather", Arrays.asList("FW.A", "FW.W"));
hazardMap.put("Convective Watches", Arrays.asList("SV.A", "TO.A")); hazardMap.put("Convective Watches", Arrays.asList("SV.A", "TO.A"));
hazardMap.put("Coastal Flood", Arrays.asList("CF.S", "LS.S", 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")); "LS.A"));
hazardMap.put("Non-Precipitation", Arrays.asList("AF.W", "AF.Y", hazardMap.put("Non-Precipitation", Arrays.asList("AF.W", "AF.Y",
"AS.Y", "DU.Y", "DS.W", "EH.W", "EH.A", "EC.W", "EC.A", "AS.Y", "DU.Y", "DS.W", "EH.W", "EH.A", "EC.W", "EC.A",

View file

@ -7,4 +7,5 @@ com.raytheon.viz.grid.rsc.FfgVizGroupResourceData
com.raytheon.viz.grid.rsc.RcmResourceData com.raytheon.viz.grid.rsc.RcmResourceData
com.raytheon.viz.grid.rsc.GridLoadProperties com.raytheon.viz.grid.rsc.GridLoadProperties
com.raytheon.viz.grid.rsc.DataMappedGridResourceData com.raytheon.viz.grid.rsc.DataMappedGridResourceData
com.raytheon.viz.grid.rsc.general.DifferenceGridResourceData
com.raytheon.viz.grid.GridProductBrowserDataDefinition com.raytheon.viz.grid.GridProductBrowserDataDefinition

View file

@ -116,9 +116,7 @@ public class GribRequestableData extends AbstractRequestableData {
@Override @Override
public IDataRecord[] getDataValue(Object arg) throws VizException { public IDataRecord[] getDataValue(Object arg) throws VizException {
if (arg == null) { if (arg instanceof Request) {
return getDataValue(Request.ALL);
} else if (arg instanceof Request) {
Request request = (Request) arg; Request request = (Request) arg;
SoftReference<IDataRecord[]> record = cache.get(request); SoftReference<IDataRecord[]> record = cache.get(request);
if (record != null) { if (record != null) {
@ -176,12 +174,10 @@ public class GribRequestableData extends AbstractRequestableData {
} }
return result; 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) { public void setDataValue(Request request, IDataRecord[] records) {

View file

@ -69,12 +69,10 @@ public class ImportRequestableData extends AliasRequestableData {
} }
public Object getDataValue(Object arg) throws VizException { public Object getDataValue(Object arg) throws VizException {
if (!(arg instanceof Request)) { Request req = Request.ALL;
throw new VizException(this.getClass().getSimpleName() if (arg instanceof Request) {
+ " cannot process request of type: " req = (Request) arg;
+ arg.getClass().getSimpleName());
} }
Request req = (Request) arg;
Object rval = getDataAndConvert(sourceRecord, Request.ALL); Object rval = getDataAndConvert(sourceRecord, Request.ALL);
if (sourceRecord2 != null) { 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 @Override
public List<AbstractRequestableData> getDependencies() { public List<AbstractRequestableData> getDependencies() {
return Arrays.asList(sourceRecord, sourceRecord2); return Arrays.asList(sourceRecord, sourceRecord2);
} }
} }

View file

@ -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.CoverageUtils;
import com.raytheon.viz.grid.util.SliceUtil; import com.raytheon.viz.grid.util.SliceUtil;
import com.raytheon.viz.grid.util.TiltUtils; import com.raytheon.viz.grid.util.TiltUtils;
import com.vividsolutions.jts.geom.Coordinate;
/** /**
* TODO Add Description * TODO Add Description
@ -49,6 +50,15 @@ import com.raytheon.viz.grid.util.TiltUtils;
public class TiltRequestableData extends AbstractRequestableData { 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) { public TiltRequestableData(String modelName, Level tiltAngle) {
this.source = modelName; this.source = modelName;
this.unit = SI.METER; this.unit = SI.METER;
@ -61,16 +71,20 @@ public class TiltRequestableData extends AbstractRequestableData {
public FloatDataRecord getDataValue(Object arg) throws VizException { public FloatDataRecord getDataValue(Object arg) throws VizException {
GridCoverage coverage = CoverageUtils.getInstance().getCoverage(source); GridCoverage coverage = CoverageUtils.getInstance().getCoverage(source);
FloatDataRecord fdr = TiltUtils.getInstance().getHeightGrid(coverage, FloatDataRecord fdr = null;
level.getLevelonevalue()); if (arg instanceof TiltCenterPoint) {
if (arg == null) { Coordinate tiltLoc = ((TiltCenterPoint) arg).latLon;
return fdr; fdr = TiltUtils.getInstance().getHeightGrid(tiltLoc, coverage,
} else if (arg instanceof Request) { level.getLevelonevalue());
return SliceUtil.slice(fdr, (Request) arg); } 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());
} }
} }

View file

@ -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.core.exception.VizException;
import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData; import com.raytheon.uf.viz.derivparam.data.AbstractRequestableData;
import com.raytheon.viz.grid.data.GribRequestableData; 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.CoverageUtils;
import com.raytheon.viz.grid.util.TiltRequest;
/** /**
* The RequestableDataRecord Class * The RequestableDataRecord Class
@ -107,7 +109,13 @@ public class RequestableDataRecord extends GribRecord {
} }
public IDataRecord[] getDataRecord(Request request) throws VizException { 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[]) { if (obj instanceof IDataRecord[]) {
return (IDataRecord[]) obj; return (IDataRecord[]) obj;
} else if (obj instanceof IDataRecord) { } else if (obj instanceof IDataRecord) {

View file

@ -546,7 +546,14 @@ public abstract class AbstractMapVectorResource extends
StorageException, VizException { StorageException, VizException {
IDataRecord rec = null; 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) { if (records != null && records.length > 0) {
rec = records[0].clone(); rec = records[0].clone();
} }

View file

@ -252,8 +252,23 @@ public class GridResource extends
@Override @Override
protected IDataRecord getDataRecord() throws StorageException { protected IDataRecord getDataRecord() throws StorageException {
IDataRecord record = super.getDataRecord(); GribRecord gribRecord = (GribRecord) pdo;
Unit<?> realDataUnit = ((GribRecord) pdo).getModelInfo() 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(); .getParameterUnitObject();
Unit<?> expectedDataUnit = getCapability(ColorMapCapability.class) Unit<?> expectedDataUnit = getCapability(ColorMapCapability.class)
.getColorMapParameters().getDataUnit(); .getColorMapParameters().getDataUnit();
@ -271,7 +286,7 @@ public class GridResource extends
} }
} }
} }
GridGeometry2D realGridGeometry = ((GribRecord) pdo).getModelInfo() GridGeometry2D realGridGeometry = gribRecord.getModelInfo()
.getLocation().getGridGeometry(); .getLocation().getGridGeometry();
GridGeometry2D expectedGridGeometry = this.gridGeometry[0]; GridGeometry2D expectedGridGeometry = this.gridGeometry[0];
if (!realGridGeometry.equals(expectedGridGeometry)) { if (!realGridGeometry.equals(expectedGridGeometry)) {
@ -707,7 +722,7 @@ public class GridResource extends
} }
} }
GridMemoryBasedTileSet mbts = new GridMemoryBasedTileSet( GridMemoryBasedTileSet mbts = new GridMemoryBasedTileSet(
record.getDataURI(), "Data", numLevels, 512, gridGeometry2D, record.getDataURI(), "Data", numLevels, 32, gridGeometry2D,
this, conversion, PixelInCell.CELL_CORNER, record, viewType); this, conversion, PixelInCell.CELL_CORNER, record, viewType);
return mbts; return mbts;
} }

View file

@ -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.grib.GribRecord;
import com.raytheon.uf.common.dataplugin.level.Level; import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; 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.CombinedDataTime;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; 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.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData; import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; 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.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability; 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.LoadMode;
import com.raytheon.uf.viz.d2d.core.time.TimeMatcher; import com.raytheon.uf.viz.d2d.core.time.TimeMatcher;
import com.raytheon.viz.core.rsc.ICombinedResourceData; import com.raytheon.viz.core.rsc.ICombinedResourceData;
import com.raytheon.viz.grid.inv.GribDataCubeAlertMessageParser; import com.raytheon.viz.grid.inv.GribDataCubeAlertMessageParser;
import com.raytheon.viz.grid.inv.GridInventory; 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 * Resource data for grids from GribRecords
@ -107,6 +119,31 @@ public class GridResourceData extends AbstractRequestableResourceData implements
super.update(updateData); 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 @Override
protected AbstractVizResource<?, ?> constructResource( protected AbstractVizResource<?, ?> constructResource(
LoadProperties loadProperties, PluginDataObject[] objects) LoadProperties loadProperties, PluginDataObject[] objects)
@ -121,33 +158,20 @@ public class GridResourceData extends AbstractRequestableResourceData implements
case IMAGE: case IMAGE:
sampling = sampling == null ? true : sampling; sampling = sampling == null ? true : sampling;
return new GridResource(this, loadProperties); 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: case ICON:
sampling = sampling == null ? false : sampling; sampling = sampling == null ? false : sampling;
return new GridIconResource(this, loadProperties); return new GridIconResource(this, loadProperties);
case BARB:
case ARROW: case ARROW:
sampling = sampling == null ? false : sampling;
return new GridVectorResource(
this,
loadProperties,
com.raytheon.viz.pointdata.PointWindDisplay.DisplayType.ARROW);
case DUALARROW: 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; sampling = sampling == null ? false : sampling;
return new GridVectorResource( return new D2DGribGridResource(this, loadProperties);
this,
loadProperties,
com.raytheon.viz.pointdata.PointWindDisplay.DisplayType.DUALARROW);
case CONTOUR: case CONTOUR:
default: default:
sampling = sampling == null ? false : sampling; 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 * @return the records
*/ */
@ -310,7 +328,6 @@ public class GridResourceData extends AbstractRequestableResourceData implements
} }
List<DataTime> availDataTimes = new ArrayList<DataTime>(); List<DataTime> availDataTimes = new ArrayList<DataTime>();
int j = 0;
for (int i = 0; i < primaryTimes.length; i++) { for (int i = 0; i < primaryTimes.length; i++) {
if (primaryTimes[i] != null && secondaryTimes[i] != null) { if (primaryTimes[i] != null && secondaryTimes[i] != null) {
availDataTimes.add(new CombinedDataTime( availDataTimes.add(new CombinedDataTime(
@ -497,4 +514,38 @@ public class GridResourceData extends AbstractRequestableResourceData implements
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; 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;
}
} }

View file

@ -103,6 +103,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* addition to wind speed when sampling * addition to wind speed when sampling
* is on. * is on.
* 01/31/12 14306 kshresth Cursor readout as you sample the dispay * 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> * </pre>
* *
@ -178,8 +180,18 @@ public class GridVectorResource extends AbstractMapVectorResource implements
match.setParameterName(Arrays.asList(modelInfo match.setParameterName(Arrays.asList(modelInfo
.getParameterAbbreviation())); .getParameterAbbreviation()));
match.setCreatingEntityNames(Arrays.asList(modelInfo.getModelName())); 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() StyleRule secondaryStyleRule = StyleManager.getInstance()
.getStyleRule(StyleType.IMAGERY, match); .getStyleRule(st, match);
if (secondaryStyleRule != null if (secondaryStyleRule != null
&& secondaryStyleRule.getPreferences() && secondaryStyleRule.getPreferences()
.getDisplayUnitLabel() != null) { .getDisplayUnitLabel() != null) {
@ -189,7 +201,6 @@ public class GridVectorResource extends AbstractMapVectorResource implements
legendParams.model = modelInfo; legendParams.model = modelInfo;
legendParams.unit = secondaryUnits; legendParams.unit = secondaryUnits;
legendParams.dataTime = getDisplayedDataTime(); legendParams.dataTime = getDisplayedDataTime();
legendParams.type = "Img";
secondaryName = secondaryGenerator.getName(legendParams, secondaryName = secondaryGenerator.getName(legendParams,
((GridResourceData) resourceData).secondaryResourceData); ((GridResourceData) resourceData).secondaryResourceData);
} catch (Exception e) { } catch (Exception e) {

View file

@ -29,6 +29,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import javax.measure.Measure; import javax.measure.Measure;
import javax.measure.quantity.Angle;
import javax.measure.unit.NonSI;
import javax.measure.unit.Unit; import javax.measure.unit.Unit;
import javax.measure.unit.UnitFormat; 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.common.time.DataTime;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.VizApp; 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.ColorMapParameters;
import com.raytheon.uf.viz.core.drawables.IRenderable; import com.raytheon.uf.viz.core.drawables.IRenderable;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
@ -179,6 +182,9 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
}); });
dataTimes = new ArrayList<DataTime>(); dataTimes = new ArrayList<DataTime>();
requestJob = new GridDataRequestJob(this); 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 @Override
protected void initInternal(IGraphicsTarget target) throws VizException { protected void initInternal(IGraphicsTarget target) throws VizException {
initCapabilities();
initStylePreferences(); initStylePreferences();
initSampling(); initSampling();
} }
@ -444,7 +449,7 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
if (params.getColorMapName() == null) { if (params.getColorMapName() == null) {
params.setColorMapName("Grid/gridded data"); params.setColorMapName("Grid/gridded data");
} }
params.setColorMap(target.buildColorMap(params params.setColorMap(ColorMapLoader.loadColorMap(params
.getColorMapName())); .getColorMapName()));
} }
this.getCapability(ColorMapCapability.class) this.getCapability(ColorMapCapability.class)
@ -592,12 +597,9 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
synchronized (requestJob) { synchronized (requestJob) {
GeneralGridData data = this.data.get(time); GeneralGridData data = this.data.get(time);
if (data == null) { if (data == null) {
List<PluginDataObject> pdoList = pdos.get(time); data = requestJob.requestData(time, pdos.get(time));
if (pdoList != null) { if (data != null) {
data = requestJob.requestData(time, pdoList); this.data.put(time, data);
if (data != null) {
this.data.put(time, data);
}
} }
} }
return data; return data;
@ -678,13 +680,17 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
return descriptor.getTimeForResource(this); return descriptor.getTimeForResource(this);
} }
public Measure<Float, ?> inspectValue(ReferencedCoordinate coord) protected GeneralGridData getCurrentData() {
throws VizException {
DataTime time = getTimeForResource(); DataTime time = getTimeForResource();
if (time == null) { if (time == null) {
return null; return null;
} }
GeneralGridData data = requestData(time); return requestData(time);
}
public Measure<Float, ?> inspectValue(ReferencedCoordinate coord)
throws VizException {
GeneralGridData data = getCurrentData();
if (data == null) { if (data == null) {
return null; return null;
} }
@ -700,6 +706,7 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
throw new VizException(e); throw new VizException(e);
} }
sampleInterpolion.setData(null);
Unit<?> unit = data.getDataUnit(); Unit<?> unit = data.getDataUnit();
if (stylePreferences != null) { if (stylePreferences != null) {
@ -714,6 +721,32 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
return Measure.valueOf(value, unit); 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 @Override
public String inspect(ReferencedCoordinate coord) throws VizException { public String inspect(ReferencedCoordinate coord) throws VizException {
Measure<Float, ?> value = inspectValue(coord); Measure<Float, ?> value = inspectValue(coord);
@ -723,8 +756,14 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
if (value.getValue().isNaN()) { if (value.getValue().isNaN()) {
return "NO DATA"; return "NO DATA";
} }
Measure<Float, Angle> dir = inspectDirection(coord);
return inspect(value); 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 * @param unit
* @return * @return
*/ */
protected String inspect(Measure<Float, ?> value) { protected String formatInspect(Measure<Float, ?> value) {
if (value.getUnit() == null) { Unit<?> dataUnit = value.getUnit();
if (dataUnit == null) {
return sampleFormat.format(value); 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 { } else {
return sampleFormat.format(value.getValue()) return sampleFormat.format(value.getValue())
+ UnitFormat.getUCUMInstance().format(value.getUnit()); + UnitFormat.getUCUMInstance().format(value.getUnit());
@ -748,6 +797,7 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
pdos.remove(dataTime); pdos.remove(dataTime);
data.remove(dataTime); data.remove(dataTime);
requestJob.remove(dataTime); requestJob.remove(dataTime);
dataTimes.remove(dataTime);
IRenderable renderable = renderables.remove(dataTime); IRenderable renderable = renderables.remove(dataTime);
if (renderable != null) { if (renderable != null) {
disposeRenderable(renderable); disposeRenderable(renderable);
@ -790,7 +840,14 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
} }
renderables.clear(); renderables.clear();
data.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 { public AbstractVizResource<?, ?> getArrowResource() throws VizException {
@ -830,7 +887,8 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
public boolean isArrowVector() { public boolean isArrowVector() {
DisplayType displayType = getDisplayType(); DisplayType displayType = getDisplayType();
return displayType == DisplayType.BARB return displayType == DisplayType.BARB
|| displayType == DisplayType.STREAMLINE; || displayType == DisplayType.STREAMLINE
|| displayType == DisplayType.DUALARROW;
} }
public boolean isWindVector() { public boolean isWindVector() {
@ -840,7 +898,8 @@ public abstract class AbstractGridResource<T extends AbstractResourceData>
} }
public boolean isLoadableAsImage() { public boolean isLoadableAsImage() {
return true; DisplayType displayType = getDisplayType();
return displayType != DisplayType.IMAGE;
} }
} }

View file

@ -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;
}
}

View file

@ -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.CombinedDataTime;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.IGraphicsTarget; 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.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.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.capabilities.GroupNamingCapability; import com.raytheon.uf.viz.core.rsc.capabilities.GroupNamingCapability;
import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation; import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation;
@ -64,7 +67,8 @@ import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineUtil;
* @version 1.0 * @version 1.0
*/ */
public class DifferenceGridResource extends public class DifferenceGridResource extends
AbstractGridResource<DifferenceGridResourceData> { AbstractGridResource<DifferenceGridResourceData> implements
IResourceGroup {
// Defines a constant size for the difference grid // Defines a constant size for the difference grid
private static final GridEnvelope GRID_ENVELOPE = new GeneralGridEnvelope( private static final GridEnvelope GRID_ENVELOPE = new GeneralGridEnvelope(
@ -89,9 +93,9 @@ public class DifferenceGridResource extends
@Override @Override
protected void initInternal(IGraphicsTarget target) throws VizException { protected void initInternal(IGraphicsTarget target) throws VizException {
super.initInternal(target);
one.init(target); one.init(target);
two.init(target); two.init(target);
super.initInternal(target);
} }
@Override @Override
@ -100,6 +104,13 @@ public class DifferenceGridResource extends
super.initCapabilities(); super.initCapabilities();
} }
@Override
protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException {
paintProps.setDataTime(null);
super.paintInternal(target, paintProps);
}
@Override @Override
public ParamLevelMatchCriteria getMatchCriteria() { public ParamLevelMatchCriteria getMatchCriteria() {
return one.getMatchCriteria(); return one.getMatchCriteria();
@ -266,4 +277,9 @@ public class DifferenceGridResource extends
CombineOperation.DIFFERENCE) + " " + oneTime.getLegendString(); CombineOperation.DIFFERENCE) + " " + oneTime.getLegendString();
} }
@Override
public ResourceList getResourceList() {
return resourceData.getResourceList();
}
} }

View file

@ -23,6 +23,9 @@ import java.util.Arrays;
import javax.measure.unit.NonSI; import javax.measure.unit.NonSI;
import javax.measure.unit.SI; 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.common.time.DataTime;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
@ -52,11 +55,14 @@ import com.raytheon.uf.viz.core.rsc.ResourceList;
* @author bsteffen * @author bsteffen
* @version 1.0 * @version 1.0
*/ */
@XmlAccessorType(XmlAccessType.NONE)
public class DifferenceGridResourceData extends AbstractResourceData implements public class DifferenceGridResourceData extends AbstractResourceData implements
IResourceGroup { IResourceGroup {
@XmlElement
private ResourcePair one; private ResourcePair one;
@XmlElement
private ResourcePair two; private ResourcePair two;
private ResourceList resourceList; private ResourceList resourceList;

View file

@ -207,8 +207,8 @@ public class GeneralGridData {
vComponent.rewind(); vComponent.rewind();
direction = FloatBuffer.allocate(uComponent.capacity()); direction = FloatBuffer.allocate(uComponent.capacity());
while (vComponent.hasRemaining()) { while (vComponent.hasRemaining()) {
direction.put((float) Math.atan2(uComponent.get(), direction.put((float) Math.toDegrees(Math.atan2(
vComponent.get())); uComponent.get(), vComponent.get())));
} }
uComponent.rewind(); uComponent.rewind();
vComponent.rewind(); vComponent.rewind();

View file

@ -21,42 +21,27 @@ package com.raytheon.viz.grid.rsc.general;
import java.nio.FloatBuffer; import java.nio.FloatBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import javax.measure.Measure;
import javax.measure.unit.Unit; import javax.measure.unit.Unit;
import org.geotools.coverage.grid.GeneralGridGeometry;
import org.geotools.coverage.grid.GridGeometry2D; 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.PluginDataObject;
import com.raytheon.uf.common.dataplugin.grib.GribModel; import com.raytheon.uf.common.dataplugin.grib.GribModel;
import com.raytheon.uf.common.dataplugin.grib.GribRecord; 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.FloatDataRecord;
import com.raytheon.uf.common.datastorage.records.IDataRecord; 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.common.time.DataTime;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.IMapDescriptor; import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; 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.Level;
import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.uf.viz.core.style.level.SingleLevel;
import com.raytheon.viz.grid.GridLevelTranslator; 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 * @author bsteffen
* @version 1.0 * @version 1.0
*/ */
public class GribGridResource extends AbstractGridResource<GridResourceData> public class GribGridResource<T extends AbstractResourceData> extends
implements IGridNameResource { AbstractGridResource<T> {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractGridResource.class);
private GribModel gribModel; protected GribModel gribModel;
private AbstractInterpolation reprojectionInterpolation; public GribGridResource(T resourceData, LoadProperties loadProperties) {
protected GribGridResource(GridResourceData resourceData,
LoadProperties loadProperties) {
super(resourceData, loadProperties); super(resourceData, loadProperties);
} }
@Override @Override
protected void addDataObject(PluginDataObject pdo) { public void addDataObject(PluginDataObject pdo) {
if (pdo instanceof GribRecord) { if (pdo instanceof GribRecord) {
if (gribModel == null) { if (gribModel == null) {
GribRecord gribRecord = (GribRecord) pdo; GribRecord gribRecord = (GribRecord) pdo;
gribModel = gribRecord.getModelInfo(); gribModel = gribRecord.getModelInfo();
calculateReprojection();
} }
super.addDataObject(pdo); super.addDataObject(pdo);
} }
@ -103,58 +82,26 @@ public class GribGridResource extends AbstractGridResource<GridResourceData>
@Override @Override
public GridGeometry2D getGridGeometry() { public GridGeometry2D getGridGeometry() {
if (reprojectionInterpolation == null) { return gribModel.getLocation().getGridGeometry();
return gribModel.getLocation().getGridGeometry();
} else {
return GridGeometry2D.wrap(reprojectionInterpolation
.getTargetGeometry());
}
} }
@Override @Override
public GeneralGridData getData(DataTime time, List<PluginDataObject> pdos) public GeneralGridData getData(DataTime time, List<PluginDataObject> pdos)
throws VizException { throws VizException {
GribRecord gribRecord = (GribRecord) pdos.get(0); if (pdos == null) {
GeneralGridData data = getData(gribRecord); return null;
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);
}
} }
return data; GribRecord gribRecord = (GribRecord) pdos.get(0);
}
private GeneralGridData getData(GribRecord gribRecord) throws VizException {
Unit<?> dataUnit = gribRecord.getModelInfo().getParameterUnitObject(); Unit<?> dataUnit = gribRecord.getModelInfo().getParameterUnitObject();
IDataRecord[] dataRecs = DataCubeContainer.getDataRecord(gribRecord); IDataRecord[] dataRecs = DataCubeContainer.getDataRecord(gribRecord);
return getData(dataRecs, dataUnit);
}
protected GeneralGridData getData(IDataRecord[] dataRecs, Unit<?> dataUnit) {
if (dataRecs.length == 1) { if (dataRecs.length == 1) {
if (dataRecs[0] instanceof FloatDataRecord) { if (dataRecs[0] instanceof FloatDataRecord) {
float[] fdata = ((FloatDataRecord) dataRecs[0]).getFloatData();
return GeneralGridData.createScalarData( return GeneralGridData.createScalarData(
FloatBuffer.wrap(fdata), dataUnit); wrapDataRecord(dataRecs[0]), dataUnit);
} }
} else if (dataRecs.length == 2) { } else if (dataRecs.length == 2) {
FloatBuffer mag = wrapDataRecord(dataRecs[0]); FloatBuffer mag = wrapDataRecord(dataRecs[0]);
@ -170,9 +117,15 @@ public class GribGridResource extends AbstractGridResource<GridResourceData>
return null; return null;
} }
private FloatBuffer wrapDataRecord(IDataRecord record) { protected FloatBuffer wrapDataRecord(IDataRecord record) {
if (record instanceof FloatDataRecord) { if (record instanceof FloatDataRecord) {
float[] fdata = ((FloatDataRecord) record).getFloatData(); 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 FloatBuffer.wrap(fdata);
} }
return null; return null;
@ -180,6 +133,9 @@ public class GribGridResource extends AbstractGridResource<GridResourceData>
@Override @Override
public ParamLevelMatchCriteria getMatchCriteria() { public ParamLevelMatchCriteria getMatchCriteria() {
if (gribModel == null) {
return null;
}
ParamLevelMatchCriteria criteria = new ParamLevelMatchCriteria(); ParamLevelMatchCriteria criteria = new ParamLevelMatchCriteria();
criteria.setParameterName(new ArrayList<String>()); criteria.setParameterName(new ArrayList<String>());
criteria.setLevels(new ArrayList<Level>()); criteria.setLevels(new ArrayList<Level>());
@ -201,67 +157,13 @@ public class GribGridResource extends AbstractGridResource<GridResourceData>
} }
@Override @Override
public LegendParameters getLegendParameters() { public String getName() {
LegendParameters legendParams = new LegendParameters(); if (gribModel == null) {
legendParams.model = gribModel; return "Grib Data";
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);
} else { } else {
return null; return gribModel.getModelTitle() + " "
+ gribModel.getLevel().toString() + " "
+ gribModel.getParameterName();
} }
} }

View file

@ -55,7 +55,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
class GridDataRequestJob extends Job { class GridDataRequestJob extends Job {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(Job.class); .getHandler(GridDataRequestJob.class);
private static class GridDataRequest { private static class GridDataRequest {

View file

@ -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;
}
}

View file

@ -19,14 +19,10 @@
**/ **/
package com.raytheon.viz.grid.util; package com.raytheon.viz.grid.util;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; 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.GridEnvelope2D;
import org.geotools.coverage.grid.GridGeometry2D; 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.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; 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.raytheon.viz.radar.util.StationUtils;
import com.vividsolutions.jts.geom.Coordinate;
/** /**
* Utility for generating grids of tilt heights for a Radar. * Utility for generating grids of tilt heights for a Radar.
@ -62,13 +57,59 @@ import com.raytheon.viz.radar.util.StationUtils;
* @version 1.0 * @version 1.0
*/ */
public class TiltUtils { 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; private static TiltUtils instance;
@ -81,25 +122,7 @@ public class TiltUtils {
} }
private 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 * in degrees
*/ */
public FloatDataRecord getHeightGrid(GridCoverage coverage, double tilt) { public FloatDataRecord getHeightGrid(GridCoverage coverage, double tilt) {
Integer coverageId = coverage.getId();
RadarStation homeRadar = StationUtils.getInstance() RadarStation homeRadar = StationUtils.getInstance()
.getHomeRadarStation(); .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); GridGeometry2D geometry = MapUtil.getGridGeometry(coverage);
GridEnvelope2D gridRange = geometry.getGridRange2D(); 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) { if (radius == null) {
try { try {
@ -126,8 +166,8 @@ public class TiltUtils {
MathTransform fromLatLon = MapUtil MathTransform fromLatLon = MapUtil
.getTransformFromLatLon(coverage.getCrs()); .getTransformFromLatLon(coverage.getCrs());
double[] radarLonLat = new double[] { double[] radarLonLat = new double[] { radar.getLon(),
homeRadar.getLon(), homeRadar.getLat() }; radar.getLat() };
double[] radarCrsCoord = new double[2]; double[] radarCrsCoord = new double[2];
fromLatLon.transform(radarLonLat, 0, radarCrsCoord, 0, fromLatLon.transform(radarLonLat, 0, radarCrsCoord, 0,
1); 1);
@ -156,27 +196,31 @@ public class TiltUtils {
// use geodetic calculator // use geodetic calculator
MathTransform gridToLatLon = geometry.getGridToCRS(); 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) { } catch (Exception e) {
statusHandler.handle( statusHandler
Priority.PROBLEM, .handle(Priority.PROBLEM,
"Error occurred generating height grid for radar tilt", "Error occurred generating height grid for radar tilt",
e); e);
} }
} }
return getHeightGrid(gridRange, radius, tilt); return getHeightGrid(radar, gridRange, radius, tilt);
} }
return null; return null;
} }
public FloatDataRecord getHeightGrid(GridEnvelope2D gridRange, public FloatDataRecord getHeightGrid(GridEnvelope2D gridRange,
MathTransform gridToLatLon, double tilt) { MathTransform gridToLatLon, double tilt) {
RadarStation homeRadar = StationUtils.getInstance()
.getHomeRadarStation();
try { try {
double[] radius = getRadius(gridRange, gridToLatLon); double[] radius = getRadius(homeRadar, gridRange, gridToLatLon);
return getHeightGrid(gridRange, radius, tilt); return getHeightGrid(homeRadar, gridRange, radius, tilt);
} catch (TransformException e) { } catch (TransformException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error occurred generating height grid for radar tilt", e); "Error occurred generating height grid for radar tilt", e);
@ -184,11 +228,9 @@ public class TiltUtils {
return null; return null;
} }
private FloatDataRecord getHeightGrid(GridEnvelope2D gridRange, private FloatDataRecord getHeightGrid(RadarStation radar,
double[] radius, double tilt) { GridEnvelope2D gridRange, double[] radius, double tilt) {
RadarStation homeRadar = StationUtils.getInstance() float elevMeter = radar.getElevMeter();
.getHomeRadarStation();
float elevMeter = homeRadar.getElevMeter();
double tanTilt = Math.tan(Math.toRadians(tilt)); double tanTilt = Math.tan(Math.toRadians(tilt));
float[] floatData = new float[radius.length]; float[] floatData = new float[radius.length];
for (int i = 0; i < radius.length; i++) { for (int i = 0; i < radius.length; i++) {
@ -202,10 +244,8 @@ public class TiltUtils {
return fdr; return fdr;
} }
private double[] getRadius(GridEnvelope2D gridRange, private double[] getRadius(RadarStation radar, GridEnvelope2D gridRange,
MathTransform gridToLatLon) throws TransformException { MathTransform gridToLatLon) throws TransformException {
RadarStation homeRadar = StationUtils.getInstance()
.getHomeRadarStation();
int numPoints = gridRange.height * gridRange.width; int numPoints = gridRange.height * gridRange.width;
int offset = 0; int offset = 0;
double[] gridCoordGrid = new double[numPoints * 2]; double[] gridCoordGrid = new double[numPoints * 2];
@ -220,7 +260,7 @@ public class TiltUtils {
double[] radius = new double[numPoints]; double[] radius = new double[numPoints];
GeodeticCalculator gc = new GeodeticCalculator(); GeodeticCalculator gc = new GeodeticCalculator();
gc.setStartingGeographicPoint(homeRadar.getLon(), homeRadar.getLat()); gc.setStartingGeographicPoint(radar.getLon(), radar.getLat());
offset = 0; offset = 0;
for (int i = 0; i < numPoints; i++) { for (int i = 0; i < numPoints; i++) {

View file

@ -1490,25 +1490,16 @@ public class MultiPointResource extends
Envelope env = new Envelope(coord); Envelope env = new Envelope(coord);
List<?> elements = strTree.query(env); List<?> elements = strTree.query(env);
if (elements.size() > 0) { GageData closestGage=getNearestPoint(coord,elements);
Iterator<?> iter = elements.iterator(); if (closestGage!=null) {
/* Take the first one in the list */ if ((ts == null) || !ts.isOpen()) {
if (iter.hasNext()) { Shell shell = PlatformUI.getWorkbench()
/* element 0 = Coordinate, 1 = inspectString */ .getActiveWorkbenchWindow().getShell();
ArrayList<?> data = (ArrayList<?>) iter.next(); ts = new TimeSeriesDlg(shell, closestGage, true);
ts.open();
Shell shell = PlatformUI.getWorkbench() } else {
.getActiveWorkbenchWindow().getShell(); ts.updateSelection(closestGage, true);
}
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);
}
}
} else { } else {
showMessage(); showMessage();
@ -1549,18 +1540,8 @@ public class MultiPointResource extends
Envelope env = new Envelope(coord); Envelope env = new Envelope(coord);
List<?> elements = strTree.query(env); List<?> elements = strTree.query(env);
if (elements.size() > 0) { if (elements.size() > 0) {
List<?> data = elements; GageData gageData = getNearestPoint(coord, elements);
if (elements.size() > 1) { if ((gageData != null)) {
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));
String lid = gageData.getLid(); String lid = gageData.getLid();
String dataType = toPEDTSEP(gageData); String dataType = toPEDTSEP(gageData);
String fcstType = null; String fcstType = null;
@ -1610,7 +1591,6 @@ public class MultiPointResource extends
showMessage(); 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. * coordinate latitude/longitude.
* *
* @param coord * @param coord
* Reference coordinate latitude/longitude * 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 * @return The closest data if found. If the input list is null or empty a
* null reference is returned. * null reference is returned.
*/ */
private static ArrayList<?> nearest(Coordinate coord, List<?> list) { private GageData getNearestPoint(Coordinate coord, List<?> elements) {
ArrayList<?> retList = null; if (elements ==null || elements.size() <= 0) {
return 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;
}
}
}
} }
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;
} }
/* /*

View file

@ -36,6 +36,7 @@ import com.raytheon.viz.hydrocommon.datamanager.HydroDBDataManager;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 19, 2008 1787 askripsky Initial creation * Dec 19, 2008 1787 askripsky Initial creation
* Mar 08, 2012 14600 wkwock Delete one lid instead of one group
* *
* </pre> * </pre>
* *
@ -378,7 +379,7 @@ public class RPFFcstPointData extends HydroDBData implements IHydroDBData {
@Override @Override
public String getDeleteStatement() { public String getDeleteStatement() {
return "DELETE FROM rpffcstpoint WHERE group_id=" return "DELETE FROM rpffcstpoint WHERE lid="+getDBString(lid)+" and group_id="
+ getDBString(groupID); + getDBString(groupID);
} }

View file

@ -86,7 +86,8 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jun 30, 2009 2524 snaples Initial creation * Jun 30, 2009 2524 snaples Initial creation
* * Feb 29 2010 9909 lbousaidi changed the for loop for getting
* the HRAP grid bin
* </pre> * </pre>
* *
* @author snaples * @author snaples
@ -220,9 +221,8 @@ public class PlotGriddedTempResource extends
buf = FloatBuffer.allocate(hrap_grid.maxi * hrap_grid.maxj); buf = FloatBuffer.allocate(hrap_grid.maxi * hrap_grid.maxj);
/* Get value in the HRAP grid bins. */ /* Get value in the HRAP grid bins. */
// for (j = 0; j < hrap_grid.maxj; j++) { 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 (i = 0; i < hrap_grid.maxi; i++) {
if (hrap_grid.owner[i][j] == -1) { if (hrap_grid.owner[i][j] == -1) {
continue; continue;

View file

@ -134,7 +134,7 @@ public class GetBasinData {
mean_areal_precip_global[ib].basin = ppp; mean_areal_precip_global[ib].basin = ppp;
for (l = 0; l < numpts; l++) { for (l = 0; l < numpts; l++) {
ibuf = in.readLine().trim(); ibuf = in.readLine().trim();
String[] locs = ibuf.split(" "); String[] locs = ibuf.split("\\s+");
lat = Double.parseDouble(locs[0].trim()); lat = Double.parseDouble(locs[0].trim());
lon = Double.parseDouble(locs[1].trim()); lon = Double.parseDouble(locs[1].trim());

View file

@ -21,9 +21,12 @@ package com.raytheon.viz.radar;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TimeZone;
import org.eclipse.swt.graphics.RGB; 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.RadarConstants;
import com.raytheon.uf.common.dataplugin.radar.util.RadarDataRetriever; 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;
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;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse; import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.IDataStore;
@ -63,7 +68,8 @@ import com.raytheon.viz.awipstools.common.StormTrackData;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * 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> * </pre>
* *
@ -169,6 +175,11 @@ public class RadarHelper {
public static final String[] rdaChannelStr = { "NWS Single Thread", public static final String[] rdaChannelStr = { "NWS Single Thread",
"RDA 1", "RDA 2" }; "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 * Returns the information in the packet to be processed
* *
@ -352,4 +363,148 @@ public class RadarHelper {
return rval; 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;
}
} }

View file

@ -124,7 +124,6 @@ public class RadarDefaultInterrogator implements IRadarInterrogator {
units = UnitFormat.getUCUMInstance().format(dispUnit); units = UnitFormat.getUCUMInstance().format(dispUnit);
} }
if (dataValue == 0) { if (dataValue == 0) {
dataMap.put("numericValue", null);
dataValueString = "NO DATA"; dataValueString = "NO DATA";
} else if (th0 instanceof Float) { } else if (th0 instanceof Float) {
double f0 = (Float) th0; double f0 = (Float) th0;

View file

@ -55,7 +55,8 @@ import com.raytheon.viz.radar.ui.RadarDisplayManager;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * 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> * </pre>
* *
@ -169,7 +170,7 @@ public class RadarSRMResource extends RadarRadialResource implements
} }
if (srmSource.equals(SRMSource.STI)) { if (srmSource.equals(SRMSource.STI)) {
sourceName = "STI"; sourceName = "STI";
StormTrackData stormTrackData = RadarHelper.getSTIData(icao); StormTrackData stormTrackData = RadarHelper.getSTIDataForRadarRecord(record);
if (stormTrackData != null && stormTrackData.isValid()) { if (stormTrackData != null && stormTrackData.isValid()) {
direction = stormTrackData.getMotionDirection(); direction = stormTrackData.getMotionDirection();
speed = stormTrackData.getMotionSpeed(); speed = stormTrackData.getMotionSpeed();

View file

@ -73,27 +73,29 @@ public class StationUtils implements IToolChangedListener {
// String site = lm.getCurrentSite(); // String site = lm.getCurrentSite();
Coordinate home = ToolsDataManager.getInstance().getHome(); Coordinate home = ToolsDataManager.getInstance().getHome();
double lat = home.y; return getClosestRadarStation(home.x, 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 station; 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) * (non-Javadoc)
* *

View file

@ -63,6 +63,7 @@ import com.raytheon.viz.texteditor.alarmalert.util.AlarmBeepJob;
* Sep 21, 2009 mnash Initial creation * Sep 21, 2009 mnash Initial creation
* Aug 16, 2010 2187 cjeanbap Fixed a NullPointerException * Aug 16, 2010 2187 cjeanbap Fixed a NullPointerException
* Dec 23, 2010 7375 cjeanbap Force dialog ON TOP of over Dialog/Windows. * 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> * </pre>
* *
* @author mnash * @author mnash
@ -178,7 +179,13 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
public Object open(boolean alarm) { public Object open(boolean alarm) {
// setInitialDialogLocation(); // 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); alarmShell.setVisible(true);
} else { } else {
display = parentShell.getDisplay(); display = parentShell.getDisplay();
@ -187,23 +194,21 @@ public class AlarmAlertBell extends Dialog implements MouseMoveListener,
} }
alarmShell.setLocation(locationX, locationY); 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.pack();
alarmShell.setVisible(true); alarmShell.setVisible(true);
alarmShell.setActive(); alarmShell.setActive();
/* // TODO: what is this for?
while (!alarmShell.isDisposed()) { while (!alarmShell.isDisposed()) {
if (!display.isDisposed() && !display.readAndDispatch()) { if (!display.isDisposed() && !display.readAndDispatch()) {
display.sleep(); display.sleep();
} }
} }
*/
/*// TODO: put this in the correct location.
labelFont.dispose(); labelFont.dispose();
*/
} }
return null; return null;

View file

@ -62,7 +62,8 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * 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> * </pre>
* *
@ -146,17 +147,23 @@ public class AlarmAlertFunctions {
for(AlarmAlertProduct p : prods) { for(AlarmAlertProduct p : prods) {
String search = p.getSearchString(); String search = p.getSearchString();
boolean match = false;
if((search != null) && (search.length() > 0)) { if((search != null) && (search.length() > 0)) {
if(s.indexOf(search) >= 0) { if(s.indexOf(search) >= 0) {
if ("Alarm".equals(p.getAlarmType()) && p.isAlarm()) { match = true;
alarm = true;
}
productFound = p;
break;
} }
} else { } else {
productFound = p; match = true;
break; }
if (match) {
if (productFound == null)
productFound = p;
if ("Alarm".equals(p.getAlarmType()) && p.isAlarm()) {
alarm = true;
productFound = p;
}
if (alarm)
break;
} }
} }
} }

View file

@ -55,6 +55,7 @@ import com.vividsolutions.jts.geom.Polygon;
* convert longitudes for Alaska when * convert longitudes for Alaska when
* they're in Eastern Hemisphere; invoke * they're in Eastern Hemisphere; invoke
* it in convertCoords(). * it in convertCoords().
* Feb 29, 2012 #13596 Qinglu Lin Added restoreAlaskaLon().
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -267,4 +268,24 @@ public class GisUtil {
return Arrays.equals(old, neww); 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