Merge "Omaha #3873 Moving platforms not appearing in safeseas display. Change-Id: Id2c4372360370af52a0ff2441e64d5f6bb85a4b4" into omaha_16.1.1.1
Former-commit-id: b9c926e244921e3405d9b6d2cbd84f1671c7db4f
This commit is contained in:
commit
0b1dd79397
23 changed files with 1040 additions and 667 deletions
|
@ -197,14 +197,11 @@
|
|||
<constraint constraintValue="fssobs"
|
||||
constraintType="EQUALS" />
|
||||
</mapping>
|
||||
|
||||
<mapping key="reportType">
|
||||
<constraint constraintValue="1006,1003"
|
||||
constraintType="IN" />
|
||||
</mapping>
|
||||
<mapping key="location.stationId">
|
||||
<constraint constraintValue="${stations}"
|
||||
constraintType="IN" />
|
||||
</mapping>
|
||||
|
||||
</metadataMap>
|
||||
<alertParser xsi:type="plotAlertParser" />
|
||||
|
@ -227,7 +224,6 @@
|
|||
isRequeryNecessaryOnTimeMatch="true"
|
||||
isTopOfTheHour="false">
|
||||
<metadataMap>
|
||||
|
||||
<mapping key="pluginName">
|
||||
<constraint constraintValue="fssobs"
|
||||
constraintType="EQUALS" />
|
||||
|
@ -240,7 +236,6 @@
|
|||
<constraint constraintValue="${stations}"
|
||||
constraintType="IN" />
|
||||
</mapping>
|
||||
|
||||
</metadataMap>
|
||||
</resourceData>
|
||||
</resource>
|
||||
|
@ -272,10 +267,6 @@
|
|||
<constraint constraintValue="1007"
|
||||
constraintType="EQUALS" />
|
||||
</mapping>
|
||||
<mapping key="location.stationId">
|
||||
<constraint constraintValue="${stations}"
|
||||
constraintType="IN" />
|
||||
</mapping>
|
||||
|
||||
</metadataMap>
|
||||
<binOffset virtualOffset="0"
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.raytheon.uf.viz.monitor.data.ObReport;
|
|||
* May 15, 2012 14510 zhao Modified generateObReport()
|
||||
* Jan 06, 2014 2653 skorolev Included SNOW data into ObReport.
|
||||
* Sep 20, 2015 3873 skorolev Added IsStationary and getReportType.
|
||||
* Dec 02, 2015 3873 dhladky Fixed missing parameters.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -48,6 +49,7 @@ public class GenerateFSSObReport {
|
|||
// Generate the observation report.
|
||||
ObReport obReport = new ObReport();
|
||||
FSSObsRecord fssData = (FSSObsRecord) report;
|
||||
|
||||
try {
|
||||
obReport.setObservationTime(fssData.getTimeObs().getTime());
|
||||
obReport.setRefHour(fssData.getRefHour().getTime());
|
||||
|
@ -59,7 +61,7 @@ public class GenerateFSSObReport {
|
|||
obReport.setTimesFromFssobDataURI(report.getDataURI());
|
||||
}
|
||||
obReport.setPlatformId(fssData.getPlatformId());
|
||||
obReport.setStationary(fssData.getIsStationary());
|
||||
obReport.setStationary(fssData.isStationary());
|
||||
obReport.setLatitude((float) fssData.getLatitude());
|
||||
obReport.setLongitude((float) fssData.getLongitude());
|
||||
// Table data:
|
||||
|
@ -117,19 +119,31 @@ public class GenerateFSSObReport {
|
|||
return obReport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the type of the report. ReportType Enumeration
|
||||
*/
|
||||
private static ReportType getReportType(String reportType) {
|
||||
if (reportType == null) {
|
||||
reportType = "";
|
||||
}
|
||||
switch (reportType) {
|
||||
case "1003":
|
||||
case "1004":
|
||||
case "1005":
|
||||
case "1006":
|
||||
case "1007":
|
||||
case "1003":
|
||||
return ReportType.SYNOPTIC_SHIP;
|
||||
case "1004":
|
||||
return ReportType.SYNOPTIC_CMAN;
|
||||
case "1005":
|
||||
return ReportType.SYNOPTIC_MOORED_BUOY;
|
||||
case "1006":
|
||||
return ReportType.DRIFTING_BUOY;
|
||||
case "1007":
|
||||
return ReportType.MARITIME;
|
||||
// TODO:MESONET
|
||||
default:
|
||||
case "SPECI":
|
||||
return ReportType.SPECI;
|
||||
case "METAR":
|
||||
return ReportType.METAR;
|
||||
case "MESONET":
|
||||
return ReportType.MESONET;
|
||||
default:
|
||||
return ReportType.METAR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ProcessObsJob extends Job {
|
|||
protected static final int PROGRESS_FACTOR = 1;
|
||||
|
||||
/** how many hours do FSSObs go back we wish to load here **/
|
||||
public static final int HOUR_BACK = 24;
|
||||
public static final int HOUR_BACK = 12;
|
||||
|
||||
private ObsMonitor obsMonitor;
|
||||
|
||||
|
|
|
@ -27,12 +27,15 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.geospatial.SpatialException;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ReportType;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||
import com.raytheon.uf.common.monitor.xml.StationIdXML;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -56,6 +59,9 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Sep 04 2014 3220 skorolev Added updateZones method.
|
||||
* Mar 17 2015 3888 dhladky check for nulls
|
||||
* Sep 25 2015 3873 skorolev Corrected addReport for moving platforms.
|
||||
* Oct 19 2015 3841 skorolev Added try to saveConfigXml
|
||||
* Nov 12 2015 3841 dhladky Augmented Slav's fix for moving platforms.
|
||||
* Dec 02 2015 3873 dhladky Pulled 3841 changes to 16.1.1.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,26 +76,26 @@ public class ObHourReports {
|
|||
/**
|
||||
* the nominal time of this ObHourReports object
|
||||
*/
|
||||
private Date nominalTime;
|
||||
private final Date nominalTime;
|
||||
|
||||
/**
|
||||
* application name (SNOW, FOG, SAFESEAS)
|
||||
*/
|
||||
private CommonConfig.AppName appName;
|
||||
private final CommonConfig.AppName appName;
|
||||
|
||||
/**
|
||||
* key is zone id, value is ObZoneHourReports object
|
||||
*/
|
||||
private Map<String, ObZoneHourReports> hourReports;
|
||||
private final Map<String, ObZoneHourReports> hourReports;
|
||||
|
||||
/**
|
||||
* current threshold manager
|
||||
*/
|
||||
private AbstractThresholdMgr thresholdMgr;
|
||||
private final AbstractThresholdMgr thresholdMgr;
|
||||
|
||||
private Set<String> zones = new HashSet<String>();
|
||||
private final Set<String> zones = new HashSet<String>();
|
||||
|
||||
private FSSObsMonitorConfigurationManager configMgr;
|
||||
private final FSSObsMonitorConfigurationManager configMgr;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
|
@ -161,9 +167,22 @@ public class ObHourReports {
|
|||
try {
|
||||
// use only marine zones
|
||||
if (zone.charAt(2) == 'Z') {
|
||||
|
||||
Coordinate zcoor = MonitorAreaUtils.getZoneCenter(zone);
|
||||
double shipToZone = distance(latShip, lonShip, zcoor.y,
|
||||
zcoor.x);
|
||||
double latZone;
|
||||
double lonZone;
|
||||
|
||||
if (zcoor != null) {
|
||||
latZone = zcoor.y;
|
||||
lonZone = zcoor.x;
|
||||
} else {
|
||||
// Newly added zone
|
||||
AreaIdXML zoneXML = configMgr.getAreaXml(zone);
|
||||
latZone = zoneXML.getCLat();
|
||||
lonZone = zoneXML.getCLon();
|
||||
}
|
||||
double shipToZone = distance(latShip, lonShip, latZone,
|
||||
lonZone);
|
||||
if (shipToZone <= shipDist) {
|
||||
// associate moving platform with monitoring zone.
|
||||
shipZones.add(zone);
|
||||
|
@ -181,12 +200,18 @@ public class ObHourReports {
|
|||
continue;
|
||||
}
|
||||
} catch (SpatialException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not determine distance from moving platform to zone: Platform: "
|
||||
+ report.getPlatformId() + " Zone: " + zone, e);
|
||||
}
|
||||
}
|
||||
// Update configuration file.
|
||||
configMgr.saveConfigXml();
|
||||
try {
|
||||
configMgr.saveConfigXml();
|
||||
} catch (LocalizationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Problem saving Localization file!", e);
|
||||
} catch (SerializationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Problem serializaing Localization File!", e);
|
||||
}
|
||||
return shipZones;
|
||||
}
|
||||
|
||||
|
@ -206,9 +231,12 @@ public class ObHourReports {
|
|||
*/
|
||||
public TableData getZoneTableData() {
|
||||
TableData tblData = new TableData(appName);
|
||||
for (String zone : hourReports.keySet()) {
|
||||
tblData.addTableRowData(this.getObZoneHourReports(zone)
|
||||
.getZoneTableRowData());
|
||||
// Area configuration manager controls what gets displayed
|
||||
for (String zone : configMgr.getAreaList()) {
|
||||
if (hourReports.containsKey(zone)) {
|
||||
tblData.addTableRowData(this.getObZoneHourReports(zone)
|
||||
.getZoneTableRowData());
|
||||
}
|
||||
}
|
||||
return tblData;
|
||||
}
|
||||
|
@ -221,15 +249,18 @@ public class ObHourReports {
|
|||
*/
|
||||
public TableData getFogZoneTableData(Map<String, CellType> algCellType) {
|
||||
TableData tblData = new TableData(AppName.FOG);
|
||||
for (String zone : hourReports.keySet()) {
|
||||
CellType theAlgCellType;
|
||||
if (algCellType.containsKey(zone)) {
|
||||
theAlgCellType = algCellType.get(zone);
|
||||
} else {
|
||||
theAlgCellType = CellType.NotAvailable;
|
||||
// Area configuration manager controls what gets displayed
|
||||
for (String zone : configMgr.getAreaList()) {
|
||||
if (hourReports.containsKey(zone)) {
|
||||
CellType theAlgCellType;
|
||||
if (algCellType.containsKey(zone)) {
|
||||
theAlgCellType = algCellType.get(zone);
|
||||
} else {
|
||||
theAlgCellType = CellType.NotAvailable;
|
||||
}
|
||||
tblData.addTableRowData(this.getObZoneHourReports(zone)
|
||||
.getFogZoneTableRowData(theAlgCellType));
|
||||
}
|
||||
tblData.addTableRowData(this.getObZoneHourReports(zone)
|
||||
.getFogZoneTableRowData(theAlgCellType));
|
||||
}
|
||||
return tblData;
|
||||
}
|
||||
|
@ -242,15 +273,18 @@ public class ObHourReports {
|
|||
*/
|
||||
public TableData getSSZoneTableData(Map<String, CellType> fogCellType) {
|
||||
TableData tblData = new TableData(AppName.SAFESEAS);
|
||||
for (String zone : hourReports.keySet()) {
|
||||
CellType theFogCellType;
|
||||
if (fogCellType.containsKey(zone)) {
|
||||
theFogCellType = fogCellType.get(zone);
|
||||
} else {
|
||||
theFogCellType = CellType.NotAvailable;
|
||||
// Area configuration manager controls what gets displayed
|
||||
for (String zone : configMgr.getAreaList()) {
|
||||
if (hourReports.containsKey(zone)) {
|
||||
CellType theFogCellType;
|
||||
if (fogCellType.containsKey(zone)) {
|
||||
theFogCellType = fogCellType.get(zone);
|
||||
} else {
|
||||
theFogCellType = CellType.NotAvailable;
|
||||
}
|
||||
tblData.addTableRowData(this.getObZoneHourReports(zone)
|
||||
.getSSZoneTableRowData(theFogCellType));
|
||||
}
|
||||
tblData.addTableRowData(this.getObZoneHourReports(zone)
|
||||
.getSSZoneTableRowData(theFogCellType));
|
||||
}
|
||||
return tblData;
|
||||
}
|
||||
|
@ -302,7 +336,7 @@ public class ObHourReports {
|
|||
if (!hourReports.keySet().contains(zone)) {
|
||||
hourReports.put(zone, new ObZoneHourReports(nominalTime, zone,
|
||||
appName, thresholdMgr));
|
||||
}
|
||||
}
|
||||
}
|
||||
// add and(or) remove stations
|
||||
for (String zone : updtZones) {
|
||||
|
@ -364,4 +398,4 @@ public class ObHourReports {
|
|||
private static double toRad(double value) {
|
||||
return value * Math.PI / 180;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,11 +36,8 @@ import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.M
|
|||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.viz.monitor.ProcessObsJob;
|
||||
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
|
||||
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType;
|
||||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
||||
|
@ -61,7 +58,9 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
|||
* Oct 31, 2012 1297 skorolev Clean code.
|
||||
* Jan 29, 2013 15654 zhao add Wind Chill calculation for SNOW
|
||||
* Sep 04, 2014 3220 skorolev Updated getStationTableData method.
|
||||
* Sep 25, 2015 3873 skorolev Added multiHrsTabData. Corrected getEmptyZoneTableData().
|
||||
* Sep 25, 2015 3873 skorolev Added multiHrsTabData.
|
||||
* Nov 12, 2015 3841 dhladky Augmented Slav's update fix.
|
||||
* Dec 02 2015 3873 dhladky Pulled 3841 changes to 16.1.1.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -70,8 +69,6 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
|||
*/
|
||||
|
||||
public class ObMultiHrsReports {
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ObMultiHrsReports.class);
|
||||
|
||||
/**
|
||||
* Thresholds manager
|
||||
|
@ -86,7 +83,7 @@ public class ObMultiHrsReports {
|
|||
/**
|
||||
* application name (snow, fog, safeseas, etc)
|
||||
*/
|
||||
private final CommonConfig.AppName appName;
|
||||
private CommonConfig.AppName appName;
|
||||
|
||||
/**
|
||||
* FSSObs records cache. Key is nominal time, value is ObHourReports object
|
||||
|
@ -98,7 +95,7 @@ public class ObMultiHrsReports {
|
|||
*/
|
||||
private ConcurrentHashMap<Date, TableData> multiHrsTabData = new ConcurrentHashMap<Date, TableData>();
|
||||
|
||||
private final int maxFrames = ObConst.MAX_FRAMES;
|
||||
private int maxFrames = ObConst.MAX_FRAMES;
|
||||
|
||||
private FSSObsMonitorConfigurationManager cfgMgr = null;
|
||||
|
||||
|
@ -130,6 +127,7 @@ public class ObMultiHrsReports {
|
|||
*/
|
||||
public void addReport(ObReport report) {
|
||||
Date nominalTime = report.getRefHour();
|
||||
|
||||
/**
|
||||
* DR #8723: if wind speed is zero, wind direction should be N/A, not 0
|
||||
*/
|
||||
|
@ -170,11 +168,15 @@ public class ObMultiHrsReports {
|
|||
// update multiHrsReports with new data
|
||||
obHourReports = multiHrsReports.get(nominalTime);
|
||||
}
|
||||
obHourReports.addReport(report);
|
||||
// update data cache
|
||||
multiHrsReports.put(nominalTime, obHourReports);
|
||||
TableData tblData = obHourReports.getZoneTableData();
|
||||
multiHrsTabData.put(nominalTime, tblData);
|
||||
|
||||
if (report != null && obHourReports != null) {
|
||||
obHourReports.addReport(report);
|
||||
// update data cache
|
||||
multiHrsReports.put(nominalTime, obHourReports);
|
||||
TableData tblData = obHourReports.getZoneTableData();
|
||||
multiHrsTabData.put(nominalTime, tblData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -248,10 +250,8 @@ public class ObMultiHrsReports {
|
|||
* @return
|
||||
*/
|
||||
public TableData getEmptyZoneTableData() {
|
||||
long currentTime = SimulatedTime.getSystemTime().getMillis();
|
||||
Date nominalTime = new Date(currentTime
|
||||
- (ProcessObsJob.HOUR_BACK * TimeUtil.MILLIS_PER_HOUR));
|
||||
|
||||
Date nominalTime = TableUtil.getNominalTime(SimulatedTime
|
||||
.getSystemTime().getTime());
|
||||
ObHourReports hourReports = new ObHourReports(nominalTime, appName,
|
||||
thresholdMgr);
|
||||
TableData tabData = null;
|
||||
|
@ -260,6 +260,12 @@ public class ObMultiHrsReports {
|
|||
} else {
|
||||
tabData = hourReports.getZoneTableData();
|
||||
}
|
||||
// update data cache
|
||||
multiHrsReports.put(nominalTime, hourReports);
|
||||
// update cache with empty table data
|
||||
if (multiHrsTabData.replace(nominalTime, tabData) == null) {
|
||||
multiHrsTabData.put(nominalTime, tabData);
|
||||
}
|
||||
return tabData;
|
||||
}
|
||||
|
||||
|
@ -519,7 +525,7 @@ public class ObMultiHrsReports {
|
|||
* @return
|
||||
*/
|
||||
public ObHourReports getObHourReports() {
|
||||
if (multiHrsReports.isEmpty()) {
|
||||
if (multiHrsReports.isEmpty() || multiHrsTabData.isEmpty()) {
|
||||
ObHourReports obHrsReps = new ObHourReports(
|
||||
TableUtil.getNominalTime(SimulatedTime.getSystemTime()
|
||||
.getTime()), appName, thresholdMgr);
|
||||
|
@ -612,8 +618,12 @@ public class ObMultiHrsReports {
|
|||
* Updates table cache
|
||||
*/
|
||||
public void updateTableCache() {
|
||||
// clear and rebuild table data on config changes
|
||||
multiHrsTabData.clear();
|
||||
|
||||
for (Date time : multiHrsReports.keySet()) {
|
||||
getZoneTableData(time);
|
||||
TableData tblData = getZoneTableData(time);
|
||||
multiHrsTabData.put(time, tblData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
|
||||
* Apr 23, 2014 3054 skorolev Added MESONET handling.
|
||||
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
||||
* Dec 02, 2015 3873 dhladky Pulled 3841 to 16.1.1.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -261,7 +262,7 @@ public class AddNewStationDlg extends CaveSWTDialog {
|
|||
return;
|
||||
}
|
||||
macDlg.addNewStationAction(stn);
|
||||
macDlg.getInstance().addStation(area, stn, type, false);
|
||||
macDlg.getInstance().addNewStation(area, stn, type, false);
|
||||
macDlg.getInstance().getStations().add(stn);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,13 +22,14 @@ package com.raytheon.uf.viz.monitor.ui.dialogs;
|
|||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.VerifyEvent;
|
||||
import org.eclipse.swt.events.VerifyListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
|
@ -50,6 +51,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Apr 23, 2014 3054 skorolev Deleted unnecessary parameter in addArea method.
|
||||
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
||||
* Feb 10, 2015 3886 skorolev Added fixed width for dialog.
|
||||
* Aug 17, 2015 3841 skorolev Corrected handleAddNewAction method.
|
||||
* Nov 12, 2015 3841 dhladky Augmented Slav's fix for moving platforms.
|
||||
* Dec 02, 2015 3873 dhladky Pulled 3841 to 16.1.1.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -59,7 +63,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
public class AddNewZoneDlg extends CaveSWTDialog {
|
||||
|
||||
/** Application name. */
|
||||
private AppName appName;
|
||||
private final AppName appName;
|
||||
|
||||
/** Marine zone radio button. */
|
||||
private Button marineZoneRdo;
|
||||
|
@ -77,7 +81,25 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
|||
private Text centroidLonTF;
|
||||
|
||||
/** Monitoring Area Configuration Dialog. */
|
||||
private MonitoringAreaConfigDlg macDlg;
|
||||
private final MonitoringAreaConfigDlg macDlg;
|
||||
|
||||
/** County constant char */
|
||||
private static final char C = 'C';
|
||||
|
||||
/** Zone constant char */
|
||||
private static final char Z = 'Z';
|
||||
|
||||
/** Upper Latitude Boundary **/
|
||||
public static double upLatBound = 90.0;
|
||||
|
||||
/** Lower Latitude Boundary **/
|
||||
public static double lowLatBound = -90.0;
|
||||
|
||||
/** Upper Longitude Boundary **/
|
||||
public static double upLonBound = 180.0;
|
||||
|
||||
/** Lower Longitude Boundary **/
|
||||
public static double lowLonBound = -180.0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -144,13 +166,15 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
|||
/*
|
||||
* Add the radio controls.
|
||||
*/
|
||||
Composite radioComp = new Composite(topComp, SWT.NONE);
|
||||
radioComp.setLayout(new GridLayout(1, false));
|
||||
marineZoneRdo = new Button(radioComp, SWT.RADIO);
|
||||
marineZoneRdo.setText("Marine Zone");
|
||||
marineZoneRdo.setSelection(true);
|
||||
countyRdo = new Button(radioComp, SWT.RADIO);
|
||||
countyRdo.setText("County");
|
||||
if (!appName.equals(AppName.SNOW)) {
|
||||
Composite radioComp = new Composite(topComp, SWT.NONE);
|
||||
radioComp.setLayout(new GridLayout(1, false));
|
||||
marineZoneRdo = new Button(radioComp, SWT.RADIO);
|
||||
marineZoneRdo.setText("Marine Zone");
|
||||
marineZoneRdo.setSelection(true);
|
||||
countyRdo = new Button(radioComp, SWT.RADIO);
|
||||
countyRdo.setText("County");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -179,11 +203,21 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
|||
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
|
||||
gd.widthHint = 200;
|
||||
Label idLbl = new Label(textComp, SWT.RIGHT);
|
||||
idLbl.setText("Id (e.g. AMZ080):");
|
||||
if (appName.equals(AppName.SNOW)) {
|
||||
idLbl.setText("Id (e.g. AMC080):");
|
||||
} else {
|
||||
idLbl.setText("Id (e.g. AMZ080):");
|
||||
}
|
||||
idLbl.setLayoutData(gd);
|
||||
|
||||
idTF = new Text(textComp, SWT.BORDER);
|
||||
idTF.setLayoutData(new GridData(120, SWT.DEFAULT));
|
||||
idTF.addVerifyListener(new VerifyListener() {
|
||||
@Override
|
||||
public void verifyText(VerifyEvent e) {
|
||||
e.text = e.text.toUpperCase();
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.CENTER, true, true);
|
||||
Label centroidLatLbl = new Label(textComp, SWT.RIGHT);
|
||||
|
@ -236,9 +270,12 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
|||
addBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
String areaId = idTF.getText();
|
||||
String latString = centroidLatTF.getText();
|
||||
String lonString = centroidLonTF.getText();
|
||||
handleAddNewAction(latString, lonString);
|
||||
if (macDlg.formIsValid(areaId, latString, lonString)) {
|
||||
handleAddNewAction(areaId, latString, lonString);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -261,58 +298,43 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
|||
* @param latString
|
||||
* @param lonString
|
||||
*/
|
||||
private void handleAddNewAction(String latString, String lonString) {
|
||||
String areaId = idTF.getText();
|
||||
if (areaId.equals("") || areaId.length() != 6
|
||||
|| (areaId.charAt(2) != 'C' && areaId.charAt(2) != 'Z')) {
|
||||
displayInputErrorMsg("Invalid Area ID = '" + areaId
|
||||
+ "' entered. Please enter a correctly formatted Area ID.");
|
||||
private void handleAddNewAction(String areaId, String latString,
|
||||
String lonString) throws NumberFormatException {
|
||||
|
||||
ZoneType type = ZoneType.REGULAR;
|
||||
char charAt = idTF.getText().charAt(2);
|
||||
if (!appName.equals(AppName.SNOW)) {
|
||||
if (marineZoneRdo.getSelection()) {
|
||||
type = ZoneType.MARITIME;
|
||||
}
|
||||
// correct zone type
|
||||
if (marineZoneRdo.getSelection() && charAt != Z) {
|
||||
String z = idTF.getText().substring(2).replace(charAt, Z);
|
||||
idTF.setText(idTF.getText().substring(0, 2) + z);
|
||||
}
|
||||
if (countyRdo.getSelection() && charAt != C) {
|
||||
String c = idTF.getText().substring(2).replace(charAt, C);
|
||||
idTF.setText(idTF.getText().substring(0, 2) + c);
|
||||
}
|
||||
} else if (appName.equals(AppName.SNOW) && charAt != C) {
|
||||
String c = idTF.getText().substring(2).replace(charAt, C);
|
||||
idTF.setText(idTF.getText().substring(0, 2) + c);
|
||||
}
|
||||
double lat = Double.parseDouble(latString.trim());
|
||||
double lon = Double.parseDouble(lonString.trim());
|
||||
if (lat > upLatBound || lat < lowLatBound || lon > upLonBound || lon < lowLonBound) {
|
||||
macDlg.latLonErrorMsg(latString, lonString);
|
||||
return;
|
||||
}
|
||||
areaId = idTF.getText();
|
||||
if (macDlg.isExistingZone(areaId)) {
|
||||
displayInputErrorMsg("The Area ID, "
|
||||
macDlg.displayInputErrorMsg("The Area ID, "
|
||||
+ areaId
|
||||
+ ", is already in your Monitoring Area or among your Additional Zones.");
|
||||
return;
|
||||
}
|
||||
if (latString == null || latString.isEmpty() || lonString == null
|
||||
|| lonString.isEmpty()) {
|
||||
macDlg.latLonErrorMsg(latString, lonString);
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
double lat = Double.parseDouble(latString.trim());
|
||||
double lon = Double.parseDouble(lonString.trim());
|
||||
ZoneType type = ZoneType.REGULAR;
|
||||
if (appName != AppName.SNOW) {
|
||||
if (marineZoneRdo.getSelection()) {
|
||||
type = ZoneType.MARITIME;
|
||||
}
|
||||
}
|
||||
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
|
||||
macDlg.latLonErrorMsg(latString, lonString);
|
||||
return;
|
||||
}
|
||||
macDlg.configMgr.addArea(areaId, lat, lon, type);
|
||||
macDlg.addNewZoneAction(areaId, centroidLatTF.getText(),
|
||||
centroidLonTF.getText());
|
||||
} catch (NumberFormatException e) {
|
||||
macDlg.latLonErrorMsg(latString, lonString);
|
||||
return;
|
||||
}
|
||||
macDlg.configMgr.addNewArea(areaId, lat, lon, type);
|
||||
macDlg.addZoneToMA(areaId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays Input Error Message
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
private void displayInputErrorMsg(String msg) {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
|
||||
| SWT.OK);
|
||||
messageBox.setText("Invalid input");
|
||||
messageBox.setMessage(msg);
|
||||
messageBox.open();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.monitor.ui.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
|
@ -35,6 +37,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
|
@ -50,6 +53,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
|
||||
* Apr 23, 2014 3054 skorolev Fixed issue with deleting a new station.
|
||||
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
||||
* Aug 17, 2015 3841 skorolev Corrected deleteSelected method.
|
||||
* Nov 12, 2015 3841 dhladky Augmented Slav's work.
|
||||
* Dec 02, 2015 3873 dhladky Pulled 3841 to 16.1.1.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -64,11 +70,10 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
|||
/** Control font. */
|
||||
private Font controlFont;
|
||||
|
||||
/** Area configuration manager. */
|
||||
private FSSObsMonitorConfigurationManager configMgr;
|
||||
|
||||
/** Monitoring Area Configuration Dialog */
|
||||
private MonitoringAreaConfigDlg macDlg;
|
||||
private final MonitoringAreaConfigDlg macDlg;
|
||||
|
||||
private final java.util.List<String> newAddedStns = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -77,13 +82,14 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
|||
* Parent shell.
|
||||
* @param appName
|
||||
* Application name.
|
||||
* @param area
|
||||
* @param macDlg
|
||||
*/
|
||||
public DeleteStationDlg(Shell parent, AppName appName,
|
||||
MonitoringAreaConfigDlg macDlg) {
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
|
||||
setText(appName.toString() + ": Delete a Newly Entered Station");
|
||||
this.macDlg = macDlg;
|
||||
configMgr = macDlg.getInstance();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -114,6 +120,11 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
|||
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
createListControl();
|
||||
createBottomButtons();
|
||||
FSSObsMonitorConfigurationManager cfgMgr = macDlg.getInstance();
|
||||
java.util.List<AreaIdXML> areaList = cfgMgr.getConfigXml().getAreaIds();
|
||||
newAddedStns.addAll(cfgMgr.getNewlyAddedStations(areaList));
|
||||
areaList = cfgMgr.getAdjAreaConfigXml().getAreaIds();
|
||||
newAddedStns.addAll(cfgMgr.getNewlyAddedStations(areaList));
|
||||
populate();
|
||||
}
|
||||
|
||||
|
@ -175,8 +186,7 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
|||
* Populate list of added stations.
|
||||
*/
|
||||
private void populate() {
|
||||
java.util.List<String> addedStations = configMgr.getAddedStations();
|
||||
stationList.setItems(addedStations.toArray(new String[addedStations
|
||||
stationList.setItems(newAddedStns.toArray(new String[newAddedStns
|
||||
.size()]));
|
||||
}
|
||||
|
||||
|
@ -184,15 +194,21 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
|||
* Delete stations from the list.
|
||||
*/
|
||||
private String deleteSelected() {
|
||||
String retval = null;
|
||||
String retval = "";
|
||||
if (stationList.getItemCount() != 0) {
|
||||
if (stationList.getSelectionIndex() != -1) {
|
||||
int idx = stationList.getSelectionIndex();
|
||||
String selection = stationList.getItem(idx);
|
||||
retval = configMgr.getAddedStations().get(idx);
|
||||
configMgr.getAddedStations().remove(idx);
|
||||
stationList.remove(selection);
|
||||
FSSObsMonitorConfigurationManager cfgMgr = macDlg.getInstance();
|
||||
java.util.List<AreaIdXML> areaXmlList = cfgMgr.getConfigXml()
|
||||
.getAreaIds();
|
||||
cfgMgr.removeStation(selection.split("#")[0], areaXmlList);
|
||||
areaXmlList = cfgMgr.getAdjAreaConfigXml().getAreaIds();
|
||||
cfgMgr.removeStation(selection.split("#")[0], areaXmlList);
|
||||
newAddedStns.remove(selection);
|
||||
populate();
|
||||
macDlg.maStationsChanged = true;
|
||||
} else {
|
||||
MessageBox messageBox = new MessageBox(shell,
|
||||
SWT.ICON_INFORMATION | SWT.NONE);
|
||||
|
|
|
@ -19,9 +19,13 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.monitor.ui.dialogs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.VerifyEvent;
|
||||
import org.eclipse.swt.events.VerifyListener;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
|
@ -34,9 +38,11 @@ import org.eclipse.swt.widgets.MessageBox;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
||||
import com.raytheon.uf.common.monitor.xml.StationIdXML;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
|
@ -53,6 +59,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Apr 23, 2014 3054 skorolev Fixed issues with removing a new zone from list.
|
||||
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
||||
* Nov 10, 2014 3741 skorolev Fixed configXML issue.
|
||||
* Aug 17, 2015 3841 skorolev Made editable a content of ID field.
|
||||
* Nov 12, 2015 3841 dhladky Augmented Slav's update fixes.
|
||||
* Dec 02, 2015 3873 dhladky Pulled 3841 to 16.1.1.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -62,7 +71,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
public class EditNewZoneDlg extends CaveSWTDialog {
|
||||
|
||||
/** Call back interface. */
|
||||
private MonitoringAreaConfigDlg macDlg;
|
||||
private final MonitoringAreaConfigDlg macDlg;
|
||||
|
||||
/** Zone list control. */
|
||||
private List zoneList;
|
||||
|
@ -85,17 +94,11 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
/** Control font. */
|
||||
private Font controlFont;
|
||||
|
||||
/** Marine station radio button. */
|
||||
private Button marineRdo;
|
||||
|
||||
/** None Marine station radio button. */
|
||||
private Button nonMarineRdo;
|
||||
|
||||
/** Bottom label */
|
||||
private Label bottomLbl;
|
||||
|
||||
/** Deleted zone */
|
||||
private String delZone;
|
||||
private boolean delZone = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -142,7 +145,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
createListAndTextControls();
|
||||
createBottomLabel();
|
||||
createCloseButton();
|
||||
populate();
|
||||
populate("");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -202,6 +205,12 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
gd.horizontalSpan = 2;
|
||||
idTF = new Text(textButtonComp, SWT.BORDER);
|
||||
idTF.setLayoutData(gd);
|
||||
idTF.addVerifyListener(new VerifyListener() {
|
||||
@Override
|
||||
public void verifyText(VerifyEvent e) {
|
||||
e.text = e.text.toUpperCase();
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 2;
|
||||
|
@ -227,21 +236,6 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
lonTF = new Text(textButtonComp, SWT.BORDER);
|
||||
lonTF.setLayoutData(gd);
|
||||
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 2;
|
||||
gd.verticalIndent = 15;
|
||||
marineRdo = new Button(textButtonComp, SWT.RADIO);
|
||||
marineRdo.setLayoutData(gd);
|
||||
marineRdo.setSelection(false);
|
||||
marineRdo.setText("Marine Station");
|
||||
|
||||
gd = new GridData();
|
||||
gd.horizontalSpan = 2;
|
||||
nonMarineRdo = new Button(textButtonComp, SWT.RADIO);
|
||||
nonMarineRdo.setLayoutData(gd);
|
||||
nonMarineRdo.setSelection(true);
|
||||
nonMarineRdo.setText("Non-Marine Station");
|
||||
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
|
||||
gd.widthHint = 80;
|
||||
gd.verticalIndent = 5;
|
||||
|
@ -251,7 +245,17 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
saveBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
saveSelected();
|
||||
if (zoneList.getItemCount() != 0) {
|
||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
String areaStr = idTF.getText();
|
||||
String latStr = latTF.getText();
|
||||
String lonStr = lonTF.getText();
|
||||
if (macDlg.formIsValid(areaStr, latStr, lonStr)) {
|
||||
saveSelected(area, areaStr, latStr, lonStr);
|
||||
}
|
||||
} else {
|
||||
bottomLbl.setText("No zones have been edited.");
|
||||
}
|
||||
}
|
||||
});
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
|
||||
|
@ -309,9 +313,25 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Populate list of added zones.
|
||||
*/
|
||||
private void populate() {
|
||||
java.util.List<String> newList = macDlg.configMgr.getAddedZones();
|
||||
private void populate(String selected) {
|
||||
java.util.List<String> newList = new ArrayList<String>();
|
||||
java.util.List<AreaIdXML> maList = macDlg.getInstance().getConfigXml()
|
||||
.getAreaIds();
|
||||
for (AreaIdXML maZone : maList) {
|
||||
if (maZone.getCLat() != null) {
|
||||
newList.add(maZone.getAreaId());
|
||||
}
|
||||
}
|
||||
java.util.List<AreaIdXML> adtnlList = macDlg.getInstance()
|
||||
.getAdjAreaConfigXml().getAreaIds();
|
||||
for (AreaIdXML aZone : adtnlList) {
|
||||
if (aZone.getCLat() != null) {
|
||||
newList.add(aZone.getAreaId());
|
||||
}
|
||||
}
|
||||
zoneList.removeAll();
|
||||
zoneList.setItems(newList.toArray(new String[newList.size()]));
|
||||
macDlg.populateLeftLists(selected);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -319,27 +339,24 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
*/
|
||||
private void handleZoneSelection() {
|
||||
String zone = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
AreaIdXML areaXml = macDlg.configMgr.getAreaXml(zone);
|
||||
// DR #7343: a null areaXml causes an "Unhandled event loop exception"
|
||||
FSSObsMonitorConfigurationManager cfgMgr = macDlg.getInstance();
|
||||
AreaIdXML areaXml = cfgMgr.getAreaXml(zone);
|
||||
AreaIdXML adjAreaXml = cfgMgr.getAdjAreaXML(zone);
|
||||
if (areaXml != null) {
|
||||
idTF.setText(areaXml.getAreaId());
|
||||
idTF.setEnabled(false);
|
||||
latTF.setText(String.valueOf(areaXml.getCLat()));
|
||||
lonTF.setText(String.valueOf(areaXml.getCLon()));
|
||||
if (areaXml.getType() == ZoneType.REGULAR) {
|
||||
nonMarineRdo.setSelection(true);
|
||||
marineRdo.setSelection(false);
|
||||
} else {
|
||||
nonMarineRdo.setSelection(false);
|
||||
marineRdo.setSelection(true);
|
||||
}
|
||||
} else if (adjAreaXml != null) {
|
||||
idTF.setText(adjAreaXml.getAreaId());
|
||||
latTF.setText(String.valueOf(adjAreaXml.getCLat()));
|
||||
lonTF.setText(String.valueOf(adjAreaXml.getCLon()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete selected zones.
|
||||
*/
|
||||
private String deleteSelected() {
|
||||
private boolean deleteSelected() {
|
||||
if (zoneList.getItemCount() != 0) {
|
||||
if (zoneList.getSelectionIndex() == -1) {
|
||||
MessageBox messageBox = new MessageBox(shell,
|
||||
|
@ -348,62 +365,99 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
messageBox.setMessage("Please select zone to be deleted.");
|
||||
messageBox.open();
|
||||
zoneList.select(0);
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
AreaIdXML zoneXML = null;
|
||||
FSSObsMonitorConfigurationManager cfgMgr = macDlg.getInstance();
|
||||
if (cfgMgr.getConfigXml().containsArea(area)) {
|
||||
zoneXML = cfgMgr.getAreaXml(area);
|
||||
} else if (cfgMgr.getAdjAreaConfigXml().containsArea(area)) {
|
||||
zoneXML = cfgMgr.getAdjAreaXML(area);
|
||||
}
|
||||
zoneList.remove(zoneList.getSelectionIndex());
|
||||
macDlg.configMgr.removeArea(area);
|
||||
idTF.setText("");
|
||||
latTF.setText("");
|
||||
lonTF.setText("");
|
||||
return area;
|
||||
zoneList.select(0);
|
||||
if (zoneList.getItemCount() != 0) {
|
||||
handleZoneSelection();
|
||||
} else {
|
||||
idTF.setText("");
|
||||
latTF.setText("");
|
||||
lonTF.setText("");
|
||||
}
|
||||
if (zoneXML != null && macDlg.getMaZones().contains(area)) {
|
||||
macDlg.getMaZones().remove(area);
|
||||
cfgMgr.removeArea(zoneXML);
|
||||
}
|
||||
if (zoneXML != null && macDlg.getAdditionalZones().contains(area)) {
|
||||
macDlg.getAdditionalZones().remove(area);
|
||||
cfgMgr.removeAdjArea(zoneXML);
|
||||
}
|
||||
macDlg.populateLeftLists("");
|
||||
macDlg.maZonesChanged = true;
|
||||
return true;
|
||||
} else {
|
||||
bottomLbl.setText("No zones have been deleted.");
|
||||
}
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save selected zones.
|
||||
*
|
||||
* @param area
|
||||
* Original zone ID
|
||||
* @param areaStr
|
||||
* New zone ID
|
||||
* @param latStr
|
||||
* Latitude
|
||||
* @param lonStr
|
||||
* Longitude
|
||||
* @throws NumberFormatException
|
||||
*/
|
||||
private void saveSelected() {
|
||||
|
||||
if (zoneList.getItemCount() != 0) {
|
||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
String latStr = latTF.getText();
|
||||
String lontStr = lonTF.getText();
|
||||
if (latStr == null || latStr.isEmpty() || lontStr == null
|
||||
|| lontStr.isEmpty()) {
|
||||
macDlg.latLonErrorMsg(latStr, lontStr);
|
||||
return;
|
||||
} else {
|
||||
try {
|
||||
double lat = Double.parseDouble(latStr);
|
||||
double lon = Double.parseDouble(lontStr);
|
||||
if (lat > 90.0 || lat < -90.0 || lon > 180.0
|
||||
|| lon < -180.0) {
|
||||
macDlg.latLonErrorMsg(latStr, lontStr);
|
||||
return;
|
||||
}
|
||||
ZoneType type = ZoneType.REGULAR;
|
||||
if (marineRdo.getSelection()) {
|
||||
type = ZoneType.MARITIME;
|
||||
}
|
||||
// Replace previously added zone
|
||||
macDlg.configMgr.removeArea(area);
|
||||
macDlg.configMgr.removeAddedArea(area);
|
||||
macDlg.configMgr.addArea(area, lat, lon, type);
|
||||
populate();
|
||||
// Return cursor to the top of the list.
|
||||
zoneList.select(0);
|
||||
} catch (NumberFormatException e) {
|
||||
macDlg.latLonErrorMsg(latStr, lontStr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
private void saveSelected(String area, String areaStr, String latStr,
|
||||
String lonStr) throws NumberFormatException {
|
||||
FSSObsMonitorConfigurationManager cfgMgr = macDlg.getInstance();
|
||||
java.util.List<StationIdXML> stationIds;
|
||||
if (macDlg.getMaZones().contains(area)) {
|
||||
stationIds = cfgMgr.getAreaXml(area).getStationIds();
|
||||
} else if (macDlg.getAdditionalZones().contains(area)) {
|
||||
stationIds = cfgMgr.getAdjAreaXML(area).getStationIds();
|
||||
} else {
|
||||
bottomLbl.setText("No zones have been edited.");
|
||||
return;
|
||||
}
|
||||
double lat = Double.parseDouble(latStr);
|
||||
double lon = Double.parseDouble(lonStr);
|
||||
if (lat > AddNewZoneDlg.upLatBound || lat < AddNewZoneDlg.lowLatBound || lon > AddNewZoneDlg.upLonBound || lon < AddNewZoneDlg.lowLonBound) {
|
||||
macDlg.latLonErrorMsg(latStr, lonStr);
|
||||
return;
|
||||
}
|
||||
ZoneType type = ZoneType.REGULAR;
|
||||
if (areaStr.charAt(2) != 'C') {
|
||||
type = (ZoneType.MARITIME);
|
||||
}
|
||||
AreaIdXML areaXML = new AreaIdXML();
|
||||
areaXML.setAreaId(areaStr);
|
||||
areaXML.setCLat(lat);
|
||||
areaXML.setCLon(lon);
|
||||
areaXML.setType(type);
|
||||
areaXML.setStationIds(stationIds);
|
||||
// Replace previously added zone
|
||||
if (cfgMgr.getAreaList().contains(area)) {
|
||||
if (macDlg.getMaZones().contains(area)) {
|
||||
int idx = macDlg.getMaZones().indexOf(area);
|
||||
macDlg.getMaZones().set(idx, areaXML.getAreaId());
|
||||
}
|
||||
cfgMgr.replaceArea(cfgMgr.getAreaXml(area), areaXML);
|
||||
} else if (macDlg.getAdditionalZones().contains(area)) {
|
||||
if (macDlg.getAdditionalZones().contains(area)) {
|
||||
int idx = macDlg.getAdditionalZones().indexOf(area);
|
||||
macDlg.getAdditionalZones().set(idx, areaXML.getAreaId());
|
||||
}
|
||||
cfgMgr.replaceAdjArea(cfgMgr.getAdjAreaXML(area), areaXML);
|
||||
}
|
||||
populate(areaStr);
|
||||
// Return cursor to the list.
|
||||
zoneList.select(zoneList.indexOf(areaStr));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -21,7 +21,9 @@ package com.raytheon.uf.viz.monitor.ui.dialogs;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -47,7 +49,7 @@ import com.raytheon.uf.common.localization.exception.LocalizationException;
|
|||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -83,6 +85,9 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Nov 12, 2014 3650 skorolev Added confirmation box for unsaved changes in the dialog.
|
||||
* Mar 08, 2015 3888 dhladky Restored threshold pop-up when adding new stations/zones.
|
||||
* Sep 18, 2015 3873 skorolev Added formIsValid method.
|
||||
* Oct 19, 2015 3841 skorolev Corrected formIsValid messages.
|
||||
* Nov 12, 2015 3841 dhladky Augmented Slav's fix for moving platforms.
|
||||
* Dec 02, 2015 3873 dhladky Pulled 3841 to 16.1.1.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -185,7 +190,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
private Font controlFont;
|
||||
|
||||
/** Application name. **/
|
||||
private CommonConfig.AppName appName;
|
||||
private final CommonConfig.AppName appName;
|
||||
|
||||
/** The current site. **/
|
||||
protected static String currentSite = null;
|
||||
|
@ -194,13 +199,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
private java.util.List<String> maZones = null;
|
||||
|
||||
/** monitor area zones status. */
|
||||
protected boolean maZonesRemoved = false;
|
||||
protected boolean maZonesChanged = false;
|
||||
|
||||
/** monitor area stations **/
|
||||
private java.util.List<String> maStations = null;
|
||||
|
||||
/** monitor area stations status. */
|
||||
protected boolean maStationsRemoved = false;
|
||||
protected boolean maStationsChanged = false;
|
||||
|
||||
/** monitor area additional zones **/
|
||||
private java.util.List<String> additionalZones = null;
|
||||
|
@ -234,11 +239,12 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
/** Flag set when user wants to close with unsaved modifications. */
|
||||
protected boolean closeFlag = false;
|
||||
|
||||
private final static String INVALID_AREA_MSG = "Invalid Area ID = '%s' entered.\n"
|
||||
private final static String INVALID_AREA_MSG_C = "Invalid Area ID = '%s' entered.\n"
|
||||
+ "Please enter a correctly formatted Area ID:\n"
|
||||
+ "Zone ID must have six characters.\n"
|
||||
+ "A third character should be C for county and Z for marine zone.\n"
|
||||
+ "Use only capital characters.";
|
||||
+ "Zone ID must have three letters and three digits.\n"
|
||||
+ "A third character should be C for county";
|
||||
|
||||
private final static String INVALID_AREA_MSG_Z = "and Z for marine zone.\n";
|
||||
|
||||
private final static String INVALID_COORD_MSG = "Invalid Lat/Lon entered:\n"
|
||||
+ "Latitude = '%s'\n"
|
||||
|
@ -250,6 +256,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
private final static String MODIFY_THRESHOLD_MSG = "New zones have been added, and their monitoring thresholds "
|
||||
+ "have been set to default values; would you like to modify "
|
||||
+ "their threshold values now?";
|
||||
|
||||
|
||||
/** County constant char */
|
||||
private static final char C = 'C';
|
||||
|
||||
/** Zone constant char */
|
||||
private static final char Z = 'Z';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -350,7 +363,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
// initialize zone/station lists
|
||||
initZoneStationLists();
|
||||
// Populate the dialog
|
||||
populateLeftLists();
|
||||
populateLeftLists("");
|
||||
setValues();
|
||||
shell.addShellListener(new ShellAdapter() {
|
||||
@Override
|
||||
|
@ -422,7 +435,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
mode = Mode.Zone;
|
||||
changeZoneStationControls();
|
||||
populateLeftLists();
|
||||
populateLeftLists("");
|
||||
if (!getShell().isDisposed()) {
|
||||
getShell().setCursor(null);
|
||||
}
|
||||
|
@ -438,7 +451,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
mode = Mode.Station;
|
||||
changeZoneStationControls();
|
||||
populateLeftLists();
|
||||
populateLeftLists("");
|
||||
if (!getShell().isDisposed()) {
|
||||
getShell().setCursor(null);
|
||||
}
|
||||
|
@ -515,7 +528,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
removeZoneStn();
|
||||
maZonesRemoved = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -611,7 +623,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
removeAssociated();
|
||||
maStationsRemoved = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -914,7 +925,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
public void dialogClosed(Object returnValue) {
|
||||
if ((Boolean) returnValue) {
|
||||
// Update the dialog
|
||||
populateLeftLists();
|
||||
populateLeftLists("");
|
||||
}
|
||||
addNewZoneDlg = null;
|
||||
}
|
||||
|
@ -933,7 +944,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
public void dialogClosed(Object returnValue) {
|
||||
if ((Boolean) returnValue) {
|
||||
// Update the dialog
|
||||
populateLeftLists();
|
||||
populateLeftLists("");
|
||||
}
|
||||
addNewStnDlg = null;
|
||||
}
|
||||
|
@ -963,7 +974,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
// Update the edit dialog
|
||||
populateLeftLists();
|
||||
String selectedZone = returnValue.toString();
|
||||
maZones.remove(selectedZone);
|
||||
populateLeftLists("");
|
||||
}
|
||||
editDlg = null;
|
||||
}
|
||||
|
@ -977,10 +990,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
// Update the delete dialog
|
||||
String selectedStn = returnValue.toString();
|
||||
maStations.remove(selectedStn);
|
||||
populateLeftLists();
|
||||
String station = returnValue.toString();
|
||||
maStations.remove(station);
|
||||
populateLeftLists("");
|
||||
}
|
||||
deleteStnDlg = null;
|
||||
}
|
||||
|
@ -1011,13 +1023,14 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
maRegionalList.setItems(additionalZones
|
||||
.toArray(new String[additionalZones.size()]));
|
||||
}
|
||||
maRegionalList.select(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the zone list boxes.
|
||||
*/
|
||||
private void populateLeftLists() {
|
||||
protected void populateLeftLists(String selected) {
|
||||
if (mode == Mode.Zone) {
|
||||
/** Zone Mode */
|
||||
Collections.sort(maZones);
|
||||
|
@ -1037,7 +1050,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
}
|
||||
if (monitorAreaList.getItemCount() > 0) {
|
||||
// select top of the list
|
||||
monitorAreaList.setSelection(0);
|
||||
if (selected.equals("")) {
|
||||
monitorAreaList.setSelection(0);
|
||||
} else {
|
||||
monitorAreaList.setSelection(monitorAreaList.indexOf(selected));
|
||||
}
|
||||
handleMonitorAreaListSelection();
|
||||
}
|
||||
}
|
||||
|
@ -1071,6 +1088,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
configMgr.setShipDistance(shipDistance.getSelection());
|
||||
configMgr.setUseAlgorithms(fogChk.getSelection());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1116,6 +1135,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
if (mode == Mode.Zone) {
|
||||
String zone = additionalList.getItem(additionalList
|
||||
.getSelectionIndex());
|
||||
AreaIdXML zoneXML = configMgr.getAdjAreaXML(zone);
|
||||
additionalList.remove(additionalList.getSelectionIndex());
|
||||
maZones.add(zone);
|
||||
Collections.sort(maZones);
|
||||
|
@ -1123,13 +1143,12 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
.setItems(maZones.toArray(new String[maZones.size()]));
|
||||
monitorAreaList.setSelection(maZones.indexOf(zone));
|
||||
additionalZones.remove(zone);
|
||||
configMgr.addArea(zone, zone.charAt(2) == 'Z' ? ZoneType.MARITIME
|
||||
: ZoneType.REGULAR);
|
||||
configMgr.addArea(zoneXML);
|
||||
handleMonitorAreaListSelection();
|
||||
if (!configMgr.getAddedZones().contains(zone)) {
|
||||
configMgr.getAddedZones().add(zone);
|
||||
}
|
||||
configMgr.removeAdjArea(zone);
|
||||
handleMonitorAreaListSelection();
|
||||
configMgr.removeAdjArea(zoneXML);
|
||||
} else { // Station mode
|
||||
if (associatedList.getSelectionCount() == 0) {
|
||||
showMessage(shell, SWT.ERROR, "Selection Needed",
|
||||
|
@ -1149,10 +1168,12 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
.getSelectionIndex());
|
||||
String stnId = stn.substring(0, stn.indexOf('#'));
|
||||
String stnType = stn.substring(stn.indexOf('#') + 1);
|
||||
configMgr.addStation(zone, stnId, stnType, configMgr
|
||||
configMgr.addNewStation(zone, stnId, stnType, configMgr
|
||||
.getAddedStations().contains(stnId));
|
||||
handleMonitorAreaListSelection();
|
||||
}
|
||||
|
||||
maZonesChanged = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1171,10 +1192,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
}
|
||||
String entry = monitorAreaList.getItem(monitorAreaList
|
||||
.getSelectionIndex());
|
||||
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
|
||||
associatedList.removeAll();
|
||||
|
||||
if (mode == Mode.Zone) {
|
||||
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
|
||||
// entry is a zone to remove.
|
||||
AreaIdXML zoneXML = configMgr.getAreaXml(entry);
|
||||
if (!additionalZones.contains(entry)) {
|
||||
additionalZones.add(entry);
|
||||
}
|
||||
|
@ -1183,24 +1205,33 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
.toArray(new String[additionalZones.size()]));
|
||||
additionalList.setSelection(additionalZones.indexOf(entry));
|
||||
maZones.remove(entry);
|
||||
configMgr.removeArea(entry);
|
||||
configMgr.removeArea(zoneXML);
|
||||
if (configMgr.getAddedZones().contains(entry)) {
|
||||
configMgr.getAddedZones().remove(entry);
|
||||
}
|
||||
|
||||
configMgr.addAdjArea(entry,
|
||||
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
|
||||
: ZoneType.REGULAR);
|
||||
} else { // Station mode
|
||||
// entry is a station to remove.
|
||||
configMgr.addAdjArea(zoneXML);
|
||||
associatedList.removeAll();
|
||||
} else { // Station mode. entry is name#type of station.
|
||||
if (associatedList.getItemCount() >= 1
|
||||
&& associatedList.getSelectionIndex() < 0) {
|
||||
showMessage(shell, SWT.ERROR, "Selection Needed",
|
||||
"You must select a associated area zone to remove.");
|
||||
return;
|
||||
}
|
||||
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
|
||||
String stnZone = associatedList.getSelection()[0];
|
||||
additionalStns.add(entry);
|
||||
Collections.sort(additionalStns);
|
||||
additionalList.setItems(additionalStns
|
||||
.toArray(new String[additionalStns.size()]));
|
||||
additionalList.setSelection(additionalStns.indexOf(entry));
|
||||
maStations.remove(entry);
|
||||
configMgr.removeStation(entry.substring(0, entry.indexOf('#')));
|
||||
// station removes from configuration XML files
|
||||
configMgr.removeStationFromArea(stnZone,
|
||||
entry.substring(0, entry.indexOf('#')));
|
||||
}
|
||||
|
||||
maZonesChanged = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1233,11 +1264,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
}
|
||||
String entry = maRegionalList.getItem(maRegionalList
|
||||
.getSelectionIndex());
|
||||
String[] items = associatedList.getItems();
|
||||
ArrayList<String> itemList = new ArrayList<String>();
|
||||
for (String item : items) {
|
||||
itemList.add(item);
|
||||
}
|
||||
java.util.List<String> itemList = new LinkedList<String>(
|
||||
Arrays.asList(associatedList.getItems()));
|
||||
if (itemList.contains(entry)) {
|
||||
/**
|
||||
* if selected entry is already in associated list: highlight the
|
||||
|
@ -1266,26 +1294,28 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
.getSelectionIndex());
|
||||
String stnId = entry.substring(0, entry.indexOf('#'));
|
||||
String stnType = entry.substring(entry.indexOf('#') + 1);
|
||||
configMgr.addStation(zone, stnId, stnType, configMgr
|
||||
|
||||
configMgr.addNewStation(zone, stnId, stnType, configMgr
|
||||
.getAddedStations().contains(stnId));
|
||||
} else { // Station mode
|
||||
if (regionalRdo.getSelection()) {
|
||||
// entry is a zone selected from additional zones
|
||||
AreaIdXML zoneXML = configMgr.getAdjAreaXML(entry);
|
||||
maZones.add(entry);
|
||||
Collections.sort(maZones);
|
||||
additionalZones.remove(entry);
|
||||
maRegionalList.remove(maRegionalList.getSelectionIndex());
|
||||
configMgr.addArea(entry,
|
||||
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
|
||||
: ZoneType.REGULAR);
|
||||
configMgr.addArea(zoneXML);
|
||||
}
|
||||
String stn = monitorAreaList.getItem(monitorAreaList
|
||||
.getSelectionIndex());
|
||||
String stnId = stn.substring(0, stn.indexOf('#'));
|
||||
String stnType = stn.substring(stn.indexOf('#') + 1);
|
||||
configMgr.addStation(entry, stnId, stnType, configMgr
|
||||
configMgr.addNewStation(entry, stnId, stnType, configMgr
|
||||
.getAddedStations().contains(stnId));
|
||||
}
|
||||
|
||||
maStationsChanged = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1308,7 +1338,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
if (mode == Mode.Zone) {
|
||||
String zone = monitorAreaList.getItem(monitorAreaList
|
||||
.getSelectionIndex());
|
||||
configMgr.removeStation(zone, entry);
|
||||
configMgr.removeStationFromArea(zone, entry);
|
||||
java.util.List<String> zones = configMgr.getAreaByStationId(entry
|
||||
.substring(0, entry.indexOf('#')));
|
||||
if (zones.size() == 0) {
|
||||
|
@ -1324,11 +1354,15 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
.toArray(new String[additionalStns.size()]));
|
||||
}
|
||||
}
|
||||
|
||||
} else { // Station mode
|
||||
String stn = monitorAreaList.getItem(monitorAreaList
|
||||
.getSelectionIndex());
|
||||
configMgr.removeStation(entry, stn);
|
||||
configMgr.removeStationFromArea(entry, stn);
|
||||
|
||||
}
|
||||
|
||||
maStationsChanged = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1411,7 +1445,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
public void addZoneToMA(String zone) {
|
||||
maZones.add(zone);
|
||||
Collections.sort(maZones);
|
||||
populateLeftLists();
|
||||
populateLeftLists(zone);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1423,7 +1457,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
public void addStationToMA(String stnWithType) {
|
||||
maStations.add(stnWithType);
|
||||
Collections.sort(maStations);
|
||||
populateLeftLists();
|
||||
populateLeftLists("");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1453,11 +1487,26 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Testing input in the form.
|
||||
*
|
||||
* @param area
|
||||
* @param latString
|
||||
* @param lonString
|
||||
* @return
|
||||
*/
|
||||
public boolean formIsValid(String area, String latString, String lonString) {
|
||||
boolean retVal = true;
|
||||
if (area.equals("") || area.length() != 6
|
||||
|| (area.charAt(2) != 'C' && area.charAt(2) != 'Z')) {
|
||||
displayInputErrorMsg(String.format(INVALID_AREA_MSG, area));
|
||||
|| (area.charAt(2) != C && area.charAt(2) != Z)) {
|
||||
StringBuilder invalidMsg = new StringBuilder(INVALID_AREA_MSG_C);
|
||||
if (appName.equals(AppName.SNOW)) {
|
||||
invalidMsg.append(".");
|
||||
} else {
|
||||
invalidMsg.append(" ");
|
||||
invalidMsg.append(INVALID_AREA_MSG_Z);
|
||||
}
|
||||
displayInputErrorMsg(String.format(invalidMsg.toString(), area));
|
||||
retVal = false;
|
||||
}
|
||||
if (latString == null || latString.isEmpty() || lonString == null
|
||||
|
@ -1514,6 +1563,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ui.dialogs.INewZoneStnAction#latLonErrorMsg()
|
||||
*/
|
||||
@Override
|
||||
public void latLonErrorMsg(String latStr, String lonStr) {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
|
||||
| SWT.OK);
|
||||
|
@ -1526,8 +1576,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
protected void resetStatus() {
|
||||
this.timeWindowChanged = false;
|
||||
this.maZonesRemoved = false;
|
||||
this.maStationsRemoved = false;
|
||||
this.maZonesChanged = false;
|
||||
this.maStationsChanged = false;
|
||||
this.shipDistanceChanged = false;
|
||||
this.fogChkChanged = false;
|
||||
}
|
||||
|
@ -1541,8 +1591,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
if (!configMgr.getAddedZones().isEmpty()
|
||||
|| !configMgr.getAddedStations().isEmpty()
|
||||
|| this.timeWindowChanged || this.shipDistanceChanged
|
||||
|| this.fogChkChanged || this.maZonesRemoved
|
||||
|| this.maStationsRemoved) {
|
||||
|| this.fogChkChanged || this.maZonesChanged
|
||||
|| this.maStationsChanged) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1612,4 +1662,4 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
* @return manager
|
||||
*/
|
||||
protected abstract FSSObsMonitorConfigurationManager getInstance();
|
||||
}
|
||||
}
|
|
@ -100,6 +100,8 @@ import com.vividsolutions.jts.io.ParseException;
|
|||
* Sep 15, 2014 3220 skorolev Added refreshZoneTableData method.
|
||||
* Nov 03, 2014 3741 skorolev Updated zoom procedures.
|
||||
* Sep 25, 2015 3873 skorolev Added center definition for moving platforms.
|
||||
* Nov 09, 2015 3841 dhladky Update all tables when zones/stations are updated.
|
||||
* Dec 02, 2015 3873 dhladky Pulled 3841 to 16.1.1.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -231,7 +233,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
protected abstract void shellDisposeAction();
|
||||
|
||||
/** List of opened plots. **/
|
||||
private Map<String, CaveSWTDialog> openedDlgs = new HashMap<String, CaveSWTDialog>();
|
||||
private final Map<String, CaveSWTDialog> openedDlgs = new HashMap<String, CaveSWTDialog>();
|
||||
|
||||
/** row index in the station table. **/
|
||||
public int rowIndex;
|
||||
|
@ -490,10 +492,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
public void updateTableDlg(ObHourReports obHrData) {
|
||||
nominalTime = obHrData.getNominalTime();
|
||||
updateZoneTable(nominalTime);
|
||||
if (!selectedZone.equals("")
|
||||
&& obHrData.getHourReports().containsKey(selectedZone)) {
|
||||
updateStationTable(nominalTime);
|
||||
}
|
||||
updateStationTable(nominalTime);
|
||||
updateNominalTimeLabel(nominalTime);
|
||||
}
|
||||
|
||||
|
@ -795,8 +794,8 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
private void zoomToZone(String zone) throws Exception {
|
||||
Coordinate zoneCenter = MonitorAreaUtils.getZoneCenter(zone);
|
||||
if (zoneCenter == null) { // Test a newly added zone.
|
||||
AreaIdXML zoneXML = configMgr.getAreaXml(zone);
|
||||
if (zoneXML != null // Coordinates do not the null values.
|
||||
AreaIdXML zoneXML = getMonitorAreaConfigInstance().getAreaXml(zone);
|
||||
if (zoneXML != null
|
||||
&& (zoneXML.getCLon() != null || zoneXML.getCLat() != null)) {
|
||||
zoneCenter = new Coordinate(zoneXML.getCLon(),
|
||||
zoneXML.getCLat());
|
||||
|
@ -1013,6 +1012,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
public void refreshZoneTableData(ObMultiHrsReports obData) {
|
||||
obData.getObHourReports().updateZones();
|
||||
obData.updateTableCache();
|
||||
this.updateTableDlg(obData.getObHourReports());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -61,6 +61,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* ------------- -------- ----------- --------------------------
|
||||
* Jun 11, 2014 2061 bsteffen Remove IDecoderGettable
|
||||
* Sep 04, 2014 3220 skorolev Removed cwa and monitorUse from record.
|
||||
* Dec 02, 2015 3873 dhladky Method naming fixes.
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
@ -119,7 +120,7 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
|
|||
@Transient
|
||||
@DynamicSerializeElement
|
||||
@XmlElement
|
||||
private boolean isStationary;
|
||||
private boolean stationary;
|
||||
|
||||
// Actual time of the observation
|
||||
@Transient
|
||||
|
@ -439,13 +440,6 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
|
|||
return location.getElevation();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the isStationary
|
||||
*/
|
||||
public boolean isStationary() {
|
||||
return isStationary;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the refHour
|
||||
*/
|
||||
|
@ -718,18 +712,6 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
|
|||
this.location = location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isStationary
|
||||
* the isStationary to set
|
||||
*/
|
||||
public void setIsStationary(boolean isStationary) {
|
||||
this.isStationary = isStationary;
|
||||
}
|
||||
|
||||
public boolean getIsStationary() {
|
||||
return isStationary;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeObs
|
||||
* the timeObs to set
|
||||
|
@ -1114,4 +1096,21 @@ public class FSSObsRecord extends PersistablePluginDataObject implements
|
|||
public String getPluginName() {
|
||||
return PLUGIN_NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this a moving or stationary platform
|
||||
* @return
|
||||
*/
|
||||
public boolean isStationary() {
|
||||
return stationary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set moving or stationary platform
|
||||
* @param stationary
|
||||
*/
|
||||
public void setStationary(boolean stationary) {
|
||||
this.stationary = stationary;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,8 +37,9 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 8, 2011 skorolev Initial creation
|
||||
* Mar 8, 2011 skorolev Initial creation
|
||||
* Jul 23, 2014 3410 bclement location changed to floats
|
||||
* Dec 02, 2015 3873 dhladky Added reportType, stationary
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -132,6 +133,10 @@ public class FSSObsRecordTransform {
|
|||
private static final String WIND_GUST = "windGust";
|
||||
|
||||
private static final String WIND_SPEED = "windSpeed";
|
||||
|
||||
private static final String STATIONARY = "stationary";
|
||||
|
||||
private static final String REPORT_TYPE = "reportType";
|
||||
|
||||
public static final String[] FSSOBS_PARAMS = { DATA_URI, LONGITUDE,
|
||||
LATITUDE, ELEVATION, CEILING, DEWPOINT, DEWPOINT_DEPR,
|
||||
|
@ -143,7 +148,7 @@ public class FSSObsRecordTransform {
|
|||
SKY_COVER, SNOW_INC_HOURLY, SNOW_INC_TOTAL, SNOW_DEPTH,
|
||||
STATION_NAME, TEMPERATURE, TIME_OBS, REF_HOUR, CLOUD_AMOUNT_TOT,
|
||||
VISIBILITY, WAVE_HEIGHT, WV_HGT, WV_PD, WV_STEEPNESS, WIND_DIR,
|
||||
WIND_GUST, WIND_SPEED };
|
||||
WIND_GUST, WIND_SPEED, STATIONARY, REPORT_TYPE };
|
||||
|
||||
public static final String FSSOBS_PARAMS_LIST;
|
||||
|
||||
|
@ -181,10 +186,15 @@ public class FSSObsRecordTransform {
|
|||
return records.toArray(new FSSObsRecord[records.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconstitutes an FSSObsRecord from the pointData view.
|
||||
* @param pdv
|
||||
* @return
|
||||
*/
|
||||
private static FSSObsRecord toFSSObsRecord(PointDataView pdv) {
|
||||
FSSObsRecord obs = null;
|
||||
if (pdv != null) {
|
||||
// String uri = pdv.getString(DATA_URI);
|
||||
|
||||
obs = new FSSObsRecord();
|
||||
obs.setDataURI(pdv.getString(DATA_URI));
|
||||
SurfaceObsLocation loc = new SurfaceObsLocation(
|
||||
|
@ -194,6 +204,8 @@ public class FSSObsRecordTransform {
|
|||
loc.assignLocation(lat, lon);
|
||||
loc.setElevation(pdv.getNumber(ELEVATION).intValue());
|
||||
obs.setLocation(loc);
|
||||
obs.setStationary(Boolean.parseBoolean(pdv.getString(STATIONARY)));
|
||||
obs.setReportType(pdv.getString(REPORT_TYPE));
|
||||
obs.setCeiling(pdv.getFloat(CEILING));
|
||||
obs.setDewpoint(pdv.getNumber(DEWPOINT).floatValue());
|
||||
obs.setDewpointDepr(pdv.getFloat(DEWPOINT_DEPR));
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
package com.raytheon.uf.common.monitor.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -36,6 +38,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
|
|||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.exception.LocalizationException;
|
||||
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
|
||||
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
|
||||
|
@ -44,11 +47,13 @@ import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
|||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
||||
import com.raytheon.uf.common.monitor.xml.MonAreaConfigXML;
|
||||
import com.raytheon.uf.common.monitor.xml.StationIdXML;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
|
||||
import com.raytheon.uf.common.site.SiteMap;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.vividsolutions.jts.io.ParseException;
|
||||
|
||||
/**
|
||||
* Fog, SAFESEAS and SNOW Monitor configuration manager.
|
||||
|
@ -71,6 +76,10 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* Sep 04 2014 3220 skorolev Added fileUpdated method.
|
||||
* Feb 24 2015 3220 dhladky Made sure config file is read in on change.
|
||||
* Sep 17 2015 3873 skorolev Corrected getInstance, addArea, addAdjArea and added getAdjAreaConfigXml.
|
||||
* Oct 20 2015 3841 skorolev Changed save method.
|
||||
* Dec 02 2015 3873 dhladky Pulled 3841 changes to 16.1.1.
|
||||
*
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -192,16 +201,14 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
boolean monitorAreaFileExists = true;
|
||||
boolean adjacentAreaFileExists = true;
|
||||
// Read area configuration XML file.
|
||||
try {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext lc = pm.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
|
||||
this.currentSite = lc.getContextName();
|
||||
lacf = pm.getLocalizationFile(lc, configFileName);
|
||||
String monitorAreaFilePath = lacf.getFile().getAbsolutePath();
|
||||
MonAreaConfigXML configXmltmp = jaxb
|
||||
.unmarshalFromXmlFile(monitorAreaFilePath.toString());
|
||||
configXml = configXmltmp;
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.SITE);
|
||||
this.currentSite = lc.getContextName();
|
||||
lacf = pm.getLocalizationFile(lc, configFileName);
|
||||
try (InputStream inStrm = lacf.openInputStream()) {
|
||||
configXml = (MonAreaConfigXML) jaxb
|
||||
.unmarshalFromInputStream(inStrm);
|
||||
} catch (Exception e) {
|
||||
statusHandler
|
||||
.handle(Priority.WARN,
|
||||
|
@ -212,12 +219,11 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
monitorAreaFileExists = false;
|
||||
}
|
||||
// Read adjacent area configuration XML file.
|
||||
String adjacentAreaFilePath = pm.getFile(
|
||||
pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.SITE), adjAreaConfigFileName)
|
||||
.getAbsolutePath();
|
||||
try {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
String adjacentAreaFilePath = pm.getFile(
|
||||
pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.SITE), adjAreaConfigFileName)
|
||||
.getAbsolutePath();
|
||||
MonAreaConfigXML configXmltmp = jaxb
|
||||
.unmarshalFromXmlFile(adjacentAreaFilePath.toString());
|
||||
adjAreaConfigXml = configXmltmp;
|
||||
|
@ -230,108 +236,138 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
adjacentAreaFileExists = false;
|
||||
}
|
||||
|
||||
try {
|
||||
// Check for a monitor area config file, if one does not exist,
|
||||
// create and use defaults
|
||||
/**
|
||||
* Note: Read in "county" for CONUS site, "forecast zone" for OCONUS
|
||||
* site [DR#9905]
|
||||
*/
|
||||
if (!monitorAreaFileExists) {
|
||||
List<String> zones;
|
||||
if (SiteMap.getInstance().getSite4LetterId(currentSite)
|
||||
.charAt(0) == 'K') { // CONUS site
|
||||
zones = MonitorAreaUtils.getUniqueCounties(currentSite);
|
||||
} else { // OCONUS site
|
||||
zones = MonitorAreaUtils.getForecastZones(currentSite);
|
||||
}
|
||||
List<String> marineZones = MonitorAreaUtils
|
||||
.getMarineZones(currentSite);
|
||||
if (!zones.isEmpty()) {
|
||||
for (String zone : zones) {
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.REGULAR);
|
||||
List<StationIdXML> stations = MonitorAreaUtils
|
||||
// Check for a monitor area config file, if one does not exist,
|
||||
// create and use defaults
|
||||
/**
|
||||
* Note: Read in "county" for CONUS site, "forecast zone" for OCONUS
|
||||
* site [DR#9905]
|
||||
*/
|
||||
if (!monitorAreaFileExists) {
|
||||
List<String> zones;
|
||||
if (SiteMap.getInstance().getSite4LetterId(currentSite).charAt(0) == 'K') { // CONUS
|
||||
// site
|
||||
zones = MonitorAreaUtils.getUniqueCounties(currentSite);
|
||||
} else { // OCONUS site
|
||||
zones = MonitorAreaUtils.getForecastZones(currentSite);
|
||||
}
|
||||
List<String> marineZones = MonitorAreaUtils
|
||||
.getMarineZones(currentSite);
|
||||
if (!zones.isEmpty()) {
|
||||
for (String zone : zones) {
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.REGULAR);
|
||||
List<StationIdXML> stations;
|
||||
try {
|
||||
stations = MonitorAreaUtils
|
||||
.getZoneReportingStationXMLs(zone);
|
||||
if (!stations.isEmpty()) {
|
||||
for (StationIdXML station : stations) {
|
||||
zoneXml.addStationIdXml(station);
|
||||
}
|
||||
}
|
||||
configXml.addAreaId(zoneXml);
|
||||
} catch (ParseException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not get stations from zone " + zone, e);
|
||||
}
|
||||
configXml.addAreaId(zoneXml);
|
||||
}
|
||||
// add marine zones if any exist
|
||||
if (!marineZones.isEmpty()) {
|
||||
for (String zone : marineZones) {
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.MARITIME);
|
||||
}
|
||||
// add marine zones if any exist
|
||||
if (!marineZones.isEmpty()) {
|
||||
for (String zone : marineZones) {
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.MARITIME);
|
||||
try {
|
||||
List<StationIdXML> stations = MonitorAreaUtils
|
||||
.getZoneReportingStationXMLs(zone);
|
||||
|
||||
if (!stations.isEmpty()) {
|
||||
for (StationIdXML station : stations) {
|
||||
zoneXml.addStationIdXml(station);
|
||||
}
|
||||
}
|
||||
configXml.addAreaId(zoneXml);
|
||||
} catch (ParseException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not get stations from zone " + zone, e);
|
||||
}
|
||||
configXml.addAreaId(zoneXml);
|
||||
}
|
||||
configXml.setTimeWindow(DEFAULT_TIME);
|
||||
}
|
||||
configXml.setTimeWindow(DEFAULT_TIME);
|
||||
try {
|
||||
saveConfigXml();
|
||||
} catch (LocalizationException | SerializationException e1) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not save area configuration file.", e1);
|
||||
}
|
||||
// Check for an adjacent area config file, if one does not exist,
|
||||
// create and use defaults
|
||||
if (!adjacentAreaFileExists) {
|
||||
AdjacentWfoMgr adjMgr = new AdjacentWfoMgr(currentSite);
|
||||
List<String> zones = adjMgr.getAdjZones();
|
||||
if (!zones.isEmpty()) {
|
||||
for (String zone : zones) {
|
||||
List<String> adjZones = adjMgr.getAdjZones();
|
||||
if (!adjZones.isEmpty()) {
|
||||
for (String zone : adjZones) {
|
||||
AreaIdXML zoneXml = new AreaIdXML();
|
||||
zoneXml.setAreaId(zone);
|
||||
zoneXml.setType(ZoneType.REGULAR);
|
||||
List<StationIdXML> stations = MonitorAreaUtils
|
||||
.getZoneReportingStationXMLs(zone);
|
||||
if (!stations.isEmpty()) {
|
||||
for (StationIdXML station : stations) {
|
||||
zoneXml.addStationIdXml(station);
|
||||
try {
|
||||
List<StationIdXML> stations = MonitorAreaUtils
|
||||
.getZoneReportingStationXMLs(zone);
|
||||
|
||||
if (!stations.isEmpty()) {
|
||||
for (StationIdXML station : stations) {
|
||||
zoneXml.addStationIdXml(station);
|
||||
}
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not get stations from zone " + zone,
|
||||
e);
|
||||
}
|
||||
adjAreaConfigXml.addAreaId(zoneXml);
|
||||
}
|
||||
}
|
||||
saveAdjacentAreaConfigXml();
|
||||
try {
|
||||
saveAdjacentAreaConfigXml();
|
||||
} catch (SerializationException | LocalizationException
|
||||
| IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Could not save adjacent area configuration file.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the monitor area XML configuration data to the current XML file
|
||||
* name.
|
||||
*
|
||||
* @throws LocalizationException
|
||||
* @throws SerializationException
|
||||
*/
|
||||
public void saveConfigXml() {
|
||||
public void saveConfigXml() throws LocalizationException,
|
||||
SerializationException {
|
||||
// Save the xml object to disk
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.SITE);
|
||||
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
|
||||
getConfigFileName());
|
||||
if (newXmlFile.getFile().getParentFile().exists() == false) {
|
||||
newXmlFile.getFile().getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
try {
|
||||
jaxb.marshalToXmlFile(configXml, newXmlFile.getFile()
|
||||
.getAbsolutePath());
|
||||
newXmlFile.save();
|
||||
lacf = newXmlFile;
|
||||
lacf.addFileUpdatedObserver(this);
|
||||
setPopulated(true);
|
||||
String path = newXmlFile.getFile().getAbsolutePath();
|
||||
jaxb.marshalToXmlFile(configXml, path);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"There was a problem to save configuration XML file: "
|
||||
+ getConfigFileName(), e);
|
||||
}
|
||||
lacf = newXmlFile;
|
||||
lacf.addFileUpdatedObserver(this);
|
||||
setPopulated(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -339,53 +375,40 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
* name.
|
||||
*
|
||||
* @param filename
|
||||
* adjacentAreaConfig.xml
|
||||
* adjacentAreaConfig.xml adjAreaConfigXml
|
||||
* @throws SerializationException
|
||||
* @throws IOException
|
||||
*/
|
||||
public void saveAdjacentAreaConfigXml() {
|
||||
public void saveAdjacentAreaConfigXml() throws SerializationException,
|
||||
LocalizationException, IOException {
|
||||
// Save the xml object to disk
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext lc = pm.getContext(LocalizationType.COMMON_STATIC,
|
||||
LocalizationLevel.SITE);
|
||||
LocalizationFile newXmlFile = pm.getLocalizationFile(lc,
|
||||
getAdjAreaConfigFileName());
|
||||
if (newXmlFile.getFile().getParentFile().exists() == false) {
|
||||
newXmlFile.getFile().getParentFile().mkdirs();
|
||||
}
|
||||
|
||||
try {
|
||||
jaxb.marshalToXmlFile(adjAreaConfigXml, newXmlFile.getFile()
|
||||
.getAbsolutePath());
|
||||
newXmlFile.save();
|
||||
String path = newXmlFile.getFile().getAbsolutePath();
|
||||
jaxb.marshalToXmlFile(adjAreaConfigXml, path);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"There was a problem saving Adjacent Area Configuration XML file: "
|
||||
+ getAdjAreaConfigFileName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new Area to the configuration. This method only adds the area, the
|
||||
* other info will need to be added to the area via the other methods in
|
||||
* this class.
|
||||
* Adds Area XML.
|
||||
*
|
||||
* @param areaId
|
||||
* @param type
|
||||
* Type of zone
|
||||
* @param areaXML
|
||||
*/
|
||||
public void addArea(String areaId, ZoneType type) {
|
||||
public void addArea(AreaIdXML areaXML) {
|
||||
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||
boolean areaExists = false;
|
||||
for (AreaIdXML area : areaXmlList) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
area.setType(type);
|
||||
areaExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (areaExists == false) {
|
||||
AreaIdXML area = new AreaIdXML();
|
||||
area.setAreaId(areaId);
|
||||
area.setType(type);
|
||||
configXml.addAreaId(area);
|
||||
if (!addedZones.contains(areaId)) {
|
||||
addedZones.add(areaId);
|
||||
if (!areaXmlList.contains(areaXML)) {
|
||||
configXml.addAreaId(areaXML);
|
||||
if (!addedZones.contains(areaXML.getAreaId())) {
|
||||
addedZones.add(areaXML.getAreaId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +427,7 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
* @param type
|
||||
* The area type
|
||||
*/
|
||||
public void addArea(String areaId, double lat, double lon, ZoneType type) {
|
||||
public void addNewArea(String areaId, double lat, double lon, ZoneType type) {
|
||||
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||
boolean areaExists = false;
|
||||
for (AreaIdXML area : areaXmlList) {
|
||||
|
@ -440,12 +463,15 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
* The station id
|
||||
* @param type
|
||||
* The station type
|
||||
* @param existingStation
|
||||
* Does the station already exist
|
||||
* @param added
|
||||
* Station has been added (true | false)
|
||||
*/
|
||||
public void addStation(String areaId, String stationId, String type,
|
||||
boolean existingStation) {
|
||||
public void addNewStation(String areaId, String stationId, String type,
|
||||
boolean added) {
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
if (!configXml.containsArea(areaId)) {
|
||||
areaList = adjAreaConfigXml.getAreaIds();
|
||||
}
|
||||
if (stationId.contains("#")) {
|
||||
stationId = stationId.substring(0, stationId.indexOf("#"));
|
||||
}
|
||||
|
@ -454,8 +480,13 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
StationIdXML stationXml = new StationIdXML();
|
||||
stationXml.setName(stationId);
|
||||
stationXml.setType(type);
|
||||
if (added) {
|
||||
stationXml.setAdded(added);
|
||||
}
|
||||
area.addStationIdXml(stationXml);
|
||||
addedStations.add(stationId + "#" + type);
|
||||
if (!addedStations.contains(stationId)) {
|
||||
addedStations.add(stationId + "#" + type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -609,6 +640,22 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
return stations;
|
||||
}
|
||||
|
||||
public List<String> getNewlyAddedStations(List<AreaIdXML> areaXml) {
|
||||
ArrayList<String> retVal = new ArrayList<String>();
|
||||
for (AreaIdXML area : areaXml) {
|
||||
List<StationIdXML> stationList = area.getStationIds();
|
||||
if (!stationList.isEmpty()) {
|
||||
for (StationIdXML stn : stationList) {
|
||||
if (stn.isAdded()) {
|
||||
retVal.add(stn.getName() + "#" + stn.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of all monitoring areas.
|
||||
*
|
||||
|
@ -645,34 +692,34 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
* @param station
|
||||
* Station to remove from the area
|
||||
*/
|
||||
public void removeStation(String area, String station) {
|
||||
station = station.substring(0, station.indexOf("#"));
|
||||
public void removeStationFromArea(String area, String station) {
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML areaXml : areaList) {
|
||||
if (areaXml.getAreaId().equals(area)) {
|
||||
List<StationIdXML> stationList = areaXml.getStationIds();
|
||||
if (!stationList.isEmpty()) {
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
if (stationList.get(i).getName().equals(station)) {
|
||||
StationIdXML stationXml = stationList.get(i);
|
||||
if (stationXml.getName().equals(station.split("#")[0])) {
|
||||
stationList.remove(i);
|
||||
areaXml.getStationIds();
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a station from the monitoring area.
|
||||
* Removes a station from all monitoring areas.
|
||||
*
|
||||
* @param station
|
||||
* The station to remove
|
||||
*/
|
||||
public void removeStation(String station) {
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML areaXml : areaList) {
|
||||
List<StationIdXML> stationList = areaXml.getStationIds();
|
||||
public void removeStation(String station, List<AreaIdXML> areaListXML) {
|
||||
for (AreaIdXML areaXML : areaListXML) {
|
||||
List<StationIdXML> stationList = areaXML.getStationIds();
|
||||
if (!stationList.isEmpty()) {
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
StationIdXML stationXml = stationList.get(i);
|
||||
|
@ -703,39 +750,69 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes an area from the monitoring area.
|
||||
* Gets an AdjAreaXml.
|
||||
*
|
||||
* @param zone
|
||||
* from additional list
|
||||
* @return
|
||||
*/
|
||||
public AreaIdXML getAdjAreaXML(String zone) {
|
||||
List<AreaIdXML> areaList = adjAreaConfigXml.getAreaIds();
|
||||
for (AreaIdXML adjAreaXml : areaList) {
|
||||
if (adjAreaXml.getAreaId().equals(zone)) {
|
||||
return adjAreaXml;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an area XML from the area configuration.
|
||||
*
|
||||
* @param area
|
||||
* The area to remove
|
||||
*/
|
||||
public void removeArea(String area) {
|
||||
public void removeArea(AreaIdXML area) {
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (int i = 0; i < areaList.size(); i++) {
|
||||
if (areaList.get(i).getAreaId().equals(area)) {
|
||||
areaList.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < addedZones.size(); i++) {
|
||||
if (addedZones.get(i).equals(area)) {
|
||||
addedZones.remove(i);
|
||||
break;
|
||||
if (areaList.contains(area)) {
|
||||
areaList.remove(area);
|
||||
if (addedZones.contains(area.getAreaId())) {
|
||||
addedZones.remove(area.getAreaId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an added area.
|
||||
* Replaces existing area XML in the area configuration.
|
||||
*
|
||||
* @param area
|
||||
* The area to remove
|
||||
* @param areaOld
|
||||
* @param areaNew
|
||||
*/
|
||||
public void removeAddedArea(String area) {
|
||||
for (int i = 0; i < addedZones.size(); i++) {
|
||||
if (addedZones.get(i).equals(area)) {
|
||||
addedZones.remove(i);
|
||||
break;
|
||||
}
|
||||
public void replaceArea(AreaIdXML areaOld, AreaIdXML areaNew) {
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
int idx = areaList.indexOf(areaOld);
|
||||
areaList.set(idx, areaNew);
|
||||
if (addedZones.contains(areaOld)) {
|
||||
addedZones.set(addedZones.indexOf(areaOld), areaNew.getAreaId());
|
||||
} else {
|
||||
addedZones.add(areaNew.getAreaId());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces existing area XML in the adjusted area configuration
|
||||
*
|
||||
* @param areaOld
|
||||
* @param areaNew
|
||||
*/
|
||||
public void replaceAdjArea(AreaIdXML areaOld, AreaIdXML areaNew) {
|
||||
List<AreaIdXML> areaList = adjAreaConfigXml.getAreaIds();
|
||||
int idx = areaList.indexOf(areaOld);
|
||||
areaList.set(idx, areaNew);
|
||||
if (addedZones.contains(areaOld)) {
|
||||
addedZones.set(addedZones.indexOf(areaOld), areaNew.getAreaId());
|
||||
} else {
|
||||
addedZones.add(areaNew.getAreaId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -805,6 +882,15 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
return configXml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Adjacent Configuration Xml
|
||||
*
|
||||
* @return the adjAreaConfigXml
|
||||
*/
|
||||
public MonAreaConfigXML getAdjAreaConfigXml() {
|
||||
return adjAreaConfigXml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Added Zones
|
||||
*
|
||||
|
@ -855,13 +941,12 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
String result = null;
|
||||
List<AreaIdXML> areaList = configXml.getAreaIds();
|
||||
for (AreaIdXML area : areaList) {
|
||||
if (area.getAreaId().equals(theZone)) {
|
||||
if (area.getAreaId().equals(theZone)
|
||||
&& area.containsStation(theStation)) {
|
||||
List<StationIdXML> stationList = area.getStationIds();
|
||||
if (!stationList.isEmpty()) {
|
||||
for (StationIdXML station : stationList) {
|
||||
if (station.getName().equals(theStation)) {
|
||||
return station.getType();
|
||||
}
|
||||
for (StationIdXML station : stationList) {
|
||||
if (station.getName().equals(theStation)) {
|
||||
result = station.getType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -974,45 +1059,42 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove Adjacent Area.
|
||||
* Remove Adjacent Area XML.
|
||||
*
|
||||
* @param zone
|
||||
*/
|
||||
public void removeAdjArea(String zone) {
|
||||
public void removeAdjArea(AreaIdXML zone) {
|
||||
List<AreaIdXML> adjAreaList = adjAreaConfigXml.getAreaIds();
|
||||
for (int i = 0; i < adjAreaList.size(); i++) {
|
||||
if (adjAreaList.get(i).getAreaId().equals(zone)) {
|
||||
adjAreaList.remove(i);
|
||||
break;
|
||||
if (adjAreaList.contains(zone)) {
|
||||
adjAreaList.remove(zone);
|
||||
if (addedZones.contains(zone.getAreaId())) {
|
||||
addedZones.remove(zone.getAreaId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Adjacent Area.
|
||||
* Add Adjacent Area XML.
|
||||
*
|
||||
* @param areaId
|
||||
* @param type
|
||||
* @param areaXML
|
||||
*/
|
||||
public void addAdjArea(String areaId, ZoneType type) {
|
||||
public void addAdjArea(AreaIdXML areaXML) {
|
||||
List<AreaIdXML> adjAreaList = adjAreaConfigXml.getAreaIds();
|
||||
boolean areaExists = false;
|
||||
for (AreaIdXML area : adjAreaList) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
area.setType(type);
|
||||
areaExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (areaExists == false) {
|
||||
AreaIdXML area = new AreaIdXML();
|
||||
area.setAreaId(areaId);
|
||||
area.setType(type);
|
||||
adjAreaConfigXml.addAreaId(area);
|
||||
if (!adjAreaList.contains(areaXML)) {
|
||||
adjAreaConfigXml.addAreaId(areaXML);
|
||||
}
|
||||
}
|
||||
|
||||
public List<MonitorConfigListener> getListeners() {
|
||||
return listeners;
|
||||
/**
|
||||
* Gets configuration manager for monitor.
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static FSSObsMonitorConfigurationManager getObsManager(
|
||||
MonName monitor) {
|
||||
FSSObsMonitorConfigurationManager instance = getInstance(monitor);
|
||||
instance.readConfigXml();
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
package com.raytheon.uf.common.monitor.xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -36,6 +38,8 @@ import javax.xml.bind.annotation.XmlElements;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 21, 2009 lvenable Initial creation
|
||||
* Sep 03, 2015 3841 skorolev Added containsStation method
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,7 +50,7 @@ import javax.xml.bind.annotation.XmlElements;
|
|||
public class AreaIdXML {
|
||||
|
||||
@XmlElements({ @XmlElement(name = "StationID", type = StationIdXML.class) })
|
||||
private ArrayList<StationIdXML> stationIds = new ArrayList<StationIdXML>();
|
||||
private List<StationIdXML> stationIds = new ArrayList<StationIdXML>();
|
||||
|
||||
@XmlAttribute(name = "id")
|
||||
private String areaId;
|
||||
|
@ -67,11 +71,11 @@ public class AreaIdXML {
|
|||
public AreaIdXML() {
|
||||
}
|
||||
|
||||
public ArrayList<StationIdXML> getStationIds() {
|
||||
public List<StationIdXML> getStationIds() {
|
||||
return stationIds;
|
||||
}
|
||||
|
||||
public void setStationIds(ArrayList<StationIdXML> stationIds) {
|
||||
public void setStationIds(List<StationIdXML> stationIds) {
|
||||
this.stationIds = stationIds;
|
||||
}
|
||||
|
||||
|
@ -138,4 +142,21 @@ public class AreaIdXML {
|
|||
public void setCLon(Double lon) {
|
||||
cLon = lon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param station
|
||||
* @return
|
||||
*/
|
||||
public boolean containsStation(String station) {
|
||||
if (!stationIds.isEmpty()) {
|
||||
Iterator<StationIdXML> itr = getStationIds().iterator();
|
||||
while (itr.hasNext()) {
|
||||
if (itr.next().getName().equals(station)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
package com.raytheon.uf.common.monitor.xml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -37,6 +39,8 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 21, 2009 lvenable Initial creation
|
||||
* May 15, 2014 3086 skorolev Changed type for timeWindow element.
|
||||
* Sep 03, 2015 3841 skorolev Added containsArea method.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,7 +52,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
public class MonAreaConfigXML {
|
||||
|
||||
@XmlElements({ @XmlElement(name = "AreaID", type = AreaIdXML.class) })
|
||||
private ArrayList<AreaIdXML> areaIds = new ArrayList<AreaIdXML>();
|
||||
private List<AreaIdXML> areaIds = new ArrayList<AreaIdXML>();
|
||||
|
||||
/**
|
||||
* Time period in minutes during which stations are monitoring.
|
||||
|
@ -71,11 +75,11 @@ public class MonAreaConfigXML {
|
|||
public MonAreaConfigXML() {
|
||||
}
|
||||
|
||||
public ArrayList<AreaIdXML> getAreaIds() {
|
||||
public List<AreaIdXML> getAreaIds() {
|
||||
return areaIds;
|
||||
}
|
||||
|
||||
public void setAreaIds(ArrayList<AreaIdXML> areaIds) {
|
||||
public void setAreaIds(List<AreaIdXML> areaIds) {
|
||||
this.areaIds = areaIds;
|
||||
}
|
||||
|
||||
|
@ -130,4 +134,21 @@ public class MonAreaConfigXML {
|
|||
public void addAreaId(AreaIdXML areaXml) {
|
||||
areaIds.add(areaXml);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if areaXML exist for area ID.
|
||||
*
|
||||
* @param area
|
||||
* area ID
|
||||
* @return areaXML
|
||||
*/
|
||||
public boolean containsArea(String areaId) {
|
||||
Iterator<AreaIdXML> itr = getAreaIds().iterator();
|
||||
while (itr.hasNext()) {
|
||||
if (itr.next().getAreaId().equals(areaId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ import javax.xml.bind.annotation.XmlAttribute;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 21, 2009 lvenable Initial creation
|
||||
* Aug 25, 2015 3481 skorolev Added attribute for newly added station
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -47,6 +49,9 @@ public class StationIdXML {
|
|||
@XmlAttribute(name = "name")
|
||||
private String name;
|
||||
|
||||
@XmlAttribute(name = "added", required = false)
|
||||
private boolean added;
|
||||
|
||||
public static final String MARITIME = "MARITIME";
|
||||
|
||||
public static final String METAR = "METAR";
|
||||
|
@ -79,4 +84,12 @@ public class StationIdXML {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isAdded() {
|
||||
return added;
|
||||
}
|
||||
|
||||
public void setAdded(boolean added) {
|
||||
this.added = added;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,4 +63,6 @@
|
|||
<parameter name="skyCover" numDims="2" type="STRING" size="8" dimension="maxSkyCover"/>
|
||||
<parameter name="totCloudAmount" numDims="1" type="INT" />
|
||||
<parameter name="stnName" numDims="1" type="STRING" size="64"/>
|
||||
<parameter name="reportType" numDims="1" type="STRING" size="64"/>
|
||||
<parameter name="stationary" numDims="1" type="STRING" size="64"/>
|
||||
</pointDataDescription>
|
|
@ -45,6 +45,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
|
|||
* Dec 3, 2010 skorolev Initial creation
|
||||
* Jul 23, 2014 3410 bclement location changed to floats
|
||||
* Sep 18, 2015 3873 skorolev Fixed assigning timeObs for maritime record.
|
||||
* Dec 02, 2015 3873 dhladky Added missing point data params.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -283,6 +284,8 @@ public class FSSObsDataTransform {
|
|||
private static final String SOIL_TEMPERATURE = "soilTemperature";
|
||||
|
||||
private static final String SOIL_MOISTURE = "soilMoisture";
|
||||
|
||||
private static final String STATIONARY = "stationary";
|
||||
|
||||
static {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
@ -313,6 +316,12 @@ public class FSSObsDataTransform {
|
|||
OBS_PARAMS_LIST = sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the metar record, creating an FSSObs record.
|
||||
* @param container
|
||||
* @return
|
||||
* @throws JAXBException
|
||||
*/
|
||||
public static FSSObsRecord fromMetarRecord(PointDataContainer container)
|
||||
throws JAXBException {
|
||||
container.setCurrentSz(container.getAllocatedSz());
|
||||
|
@ -474,6 +483,12 @@ public class FSSObsDataTransform {
|
|||
MESOWEST_PARAMS_LIST = sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the maritime record, creating an FSSObs record.
|
||||
* @param container
|
||||
* @return
|
||||
* @throws JAXBException
|
||||
*/
|
||||
public static FSSObsRecord fromMaritimeRecord(PointDataContainer container)
|
||||
throws JAXBException {
|
||||
container.setCurrentSz(container.getAllocatedSz());
|
||||
|
@ -562,6 +577,7 @@ public class FSSObsDataTransform {
|
|||
}
|
||||
|
||||
/**
|
||||
* Read the MESOWEST record, creating an FSSOBS record.
|
||||
* @param result
|
||||
* @return
|
||||
*/
|
||||
|
@ -628,10 +644,17 @@ public class FSSObsDataTransform {
|
|||
return fssr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the view and write to HDF5 file
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
public static PointDataView buildView(FSSObsRecord record) {
|
||||
pdc = PointDataContainer.build(fsspdd);
|
||||
PointDataView pdv = pdc.append();
|
||||
|
||||
pdv.setString(STATIONARY, Boolean.toString(record.isStationary()));
|
||||
pdv.setString(REPORT_TYPE, record.getReportType());
|
||||
pdv.setFloat(CEILING, record.getCeiling());
|
||||
pdv.setFloat(DEWPOINT, record.getDewpoint());
|
||||
pdv.setFloat(DEWPOINT_DEPR, record.getDewpointDepr());
|
||||
|
@ -690,8 +713,6 @@ public class FSSObsDataTransform {
|
|||
pdv.setFloat(WIND_GUST, record.getWindGust());
|
||||
pdv.setFloat(HI_RES_WV_HGT, record.getHighResWaveHeight());
|
||||
|
||||
// pdv.setLong(TIME_NOMINAL, record.getRefHour().getTimeInMillis());
|
||||
|
||||
record.setPointDataView(pdv);
|
||||
return pdv;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.raytheon.edex.site.SiteUtil;
|
|||
import com.raytheon.edex.urifilter.URIFilter;
|
||||
import com.raytheon.edex.urifilter.URIGenerateMessage;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
||||
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
|
||||
import com.raytheon.uf.common.geospatial.SpatialException;
|
||||
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
|
||||
|
@ -37,6 +38,7 @@ import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.M
|
|||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -60,6 +62,9 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Aug 18, 2014 3530 bclement removed constructDataURI() call
|
||||
* Sep 04, 2014 3220 skorolev Replaced 3 URI filters with one.
|
||||
* Sep 18, 2015 3873 skorolev Added moving platforms testing.
|
||||
* Oct 19, 2015 3841 skorolev Corrected isNearZone.
|
||||
* Nov 12, 2015 3841 dhladky Augmented Slav's moving platform fix.
|
||||
* Dec 02, 2015 3873 dhladky Fixed performance problems, missing params.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -72,6 +77,16 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FSSObsGenerator.class);
|
||||
|
||||
/** List of fixed types **/
|
||||
protected static final String[] stationaryTypes = new String[] {
|
||||
ObConst.METAR, ObConst.MESONET, ObConst.SPECI,
|
||||
ObConst.SYNOPTIC_CMAN, ObConst.SYNOPTIC_MOORED_BUOY };
|
||||
|
||||
/** list of moving types **/
|
||||
protected static final String[] movingTypes = new String[] {
|
||||
ObConst.SYNOPTIC_SHIP, ObConst.DRIFTING_BUOY,
|
||||
ObConst.SYNOPTIC_MAROB };
|
||||
|
||||
/** Name of composite generator */
|
||||
private static final String genName = "FSSObs";
|
||||
|
||||
|
@ -79,7 +94,7 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
|
|||
private static final String productType = "fssobs";
|
||||
|
||||
/** Stations to filter */
|
||||
private Set<String> allStations = new HashSet<String>();
|
||||
private final Set<String> allStations = new HashSet<String>();
|
||||
|
||||
public FSSObsMonitorConfigurationManager fogmcm = null;
|
||||
|
||||
|
@ -87,6 +102,9 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
|
|||
|
||||
public FSSObsMonitorConfigurationManager snowmcm = null;
|
||||
|
||||
/** Zone constant char */
|
||||
private static final char Z = 'Z';
|
||||
|
||||
/**
|
||||
* Public construction
|
||||
*/
|
||||
|
@ -105,76 +123,147 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
|
|||
public void generateProduct(URIGenerateMessage genMessage) {
|
||||
|
||||
FSSObsConfig fss_config = null;
|
||||
boolean isStationary = true;
|
||||
|
||||
try {
|
||||
fss_config = new FSSObsConfig(genMessage, this);
|
||||
this.setPluginDao(new FSSObsDAO(productType));
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Couldn't read FSSObs configuration information.", e);
|
||||
}
|
||||
List<FSSObsRecord> fssRecs = new ArrayList<FSSObsRecord>();
|
||||
for (String uri : genMessage.getUris()) {
|
||||
// Test if moving platforms are within configuration distance
|
||||
if (uri.contains(ObConst.SYNOPTIC_SHIP)
|
||||
|| uri.contains(ObConst.DRIFTING_BUOY)
|
||||
|| uri.contains(ObConst.SYNOPTIC_MAROB)) {
|
||||
isStationary = false;
|
||||
try {
|
||||
if (!isNearZone(uri)) {
|
||||
continue;
|
||||
|
||||
boolean isStationary = true;
|
||||
String reportType = null;
|
||||
boolean inRange = false;
|
||||
|
||||
// check if moving type
|
||||
for (String t : movingTypes) {
|
||||
if (uri.contains(t)) {
|
||||
reportType = t;
|
||||
isStationary = false;
|
||||
|
||||
try {
|
||||
if (isNearZone(uri)) {
|
||||
inRange = true;
|
||||
statusHandler.handle(Priority.INFO,
|
||||
"===> Moving platform in Range " + uri);
|
||||
}
|
||||
} catch (SpatialException e) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"URI: "
|
||||
+ uri
|
||||
+ " could not be checked for Location information.",
|
||||
e);
|
||||
// If the location info is bad. we don't want it.
|
||||
inRange = false;
|
||||
}
|
||||
} catch (SpatialException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
FSSObsRecord fssObsRec = new FSSObsRecord();
|
||||
fssObsRec.setIsStationary(isStationary);
|
||||
fssObsRec = fss_config.getTableRow(uri);
|
||||
FSSObsDataTransform.buildView(fssObsRec);
|
||||
fssRecs.add(fssObsRec);
|
||||
if (isStationary) {
|
||||
// determine stationary type
|
||||
for (String t : stationaryTypes) {
|
||||
if (uri.contains(t)) {
|
||||
reportType = t;
|
||||
inRange = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We only want what we know how to decode
|
||||
if (reportType != null && inRange) {
|
||||
|
||||
FSSObsRecord fssObsRec = new FSSObsRecord();
|
||||
fssObsRec.setReportType(reportType);
|
||||
fssObsRec.setStationary(isStationary);
|
||||
fssObsRec = fss_config.getTableRow(uri);
|
||||
FSSObsDataTransform.buildView(fssObsRec);
|
||||
fssRecs.add(fssObsRec);
|
||||
}
|
||||
}
|
||||
|
||||
if (!fssRecs.isEmpty()) {
|
||||
this.setPluginDataObjects((PluginDataObject[]) fssRecs
|
||||
this.setPluginDataObjects(fssRecs
|
||||
.toArray(new PluginDataObject[fssRecs.size()]));
|
||||
statusHandler.handle(Priority.INFO, "===> Successfully generated "
|
||||
+ fssRecs.size() + " records.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test distance between moving platform and zone centroud.
|
||||
* Checks if ship is near monitoring zones and should be included in FSSObs
|
||||
* data.
|
||||
*
|
||||
* @param uri
|
||||
* @return
|
||||
* sfcobs URI
|
||||
* @return true if ship is in vicinity of zone
|
||||
* @throws SpatialException
|
||||
*/
|
||||
private boolean isNearZone(String uri) throws SpatialException {
|
||||
boolean retVal = false;
|
||||
Set<String> marineZone = new HashSet<String>();
|
||||
for (String z : getSSConfig().getAreaList()) {
|
||||
if (z.charAt(2) == 'Z') {
|
||||
marineZone.add(z);
|
||||
}
|
||||
}
|
||||
for (String z : getFogConfig().getAreaList()) {
|
||||
if (z.charAt(2) == 'Z') {
|
||||
marineZone.add(z);
|
||||
}
|
||||
}
|
||||
String[] items = uri.split(DataURI.SEPARATOR);
|
||||
double latShip = Double.parseDouble(items[6]);
|
||||
double lonShip = Double.parseDouble(items[7]);
|
||||
|
||||
double ssShipDist = getSSConfig().getShipDistance();
|
||||
if (ssShipDist != 0.0) {
|
||||
// check SAFSEAS zones
|
||||
retVal = checkMarineZones(getSSConfig(), ssShipDist, latShip,
|
||||
lonShip);
|
||||
}
|
||||
|
||||
double fogShipDist = getFogConfig().getShipDistance();
|
||||
// take the biggest distance
|
||||
double configDist = ssShipDist > fogShipDist ? ssShipDist : fogShipDist;
|
||||
if (configDist != 0.0) {
|
||||
String[] items = uri.split("/");
|
||||
double latShip = Double.parseDouble(items[6]);
|
||||
double lonShip = Double.parseDouble(items[7]);
|
||||
for (String zone : marineZone) {
|
||||
Coordinate coor = MonitorAreaUtils.getZoneCenter(zone);
|
||||
double shipTozone = distance(latShip, lonShip, coor.y, coor.x);
|
||||
|
||||
if (fogShipDist != 0.0 && !retVal) {
|
||||
// check Fog zones
|
||||
retVal = checkMarineZones(getFogConfig(), fogShipDist, latShip,
|
||||
lonShip);
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Test distance between moving platform and marine zone centroid.
|
||||
*
|
||||
* @param cfg
|
||||
* configuration manager
|
||||
* @param configDist
|
||||
* configuration distance
|
||||
* @param lat
|
||||
* ship latitude
|
||||
* @param lon
|
||||
* ship longitude
|
||||
* @return true if distance less configDist
|
||||
*/
|
||||
private boolean checkMarineZones(FSSObsMonitorConfigurationManager cfg,
|
||||
double configDist, double lat, double lon) {
|
||||
boolean retVal = false;
|
||||
for (String zone : cfg.getAreaList()) {
|
||||
if (zone.charAt(2) == Z) {
|
||||
// initial distance
|
||||
double shipTozone = configDist;
|
||||
try {
|
||||
Coordinate coor = MonitorAreaUtils.getZoneCenter(zone);
|
||||
// zone should have center coordinates.
|
||||
if (coor != null) {
|
||||
shipTozone = distance(lat, lon, coor.y, coor.x);
|
||||
} else {
|
||||
// newly added zone
|
||||
AreaIdXML ssXML = cfg.getAreaXml(zone);
|
||||
shipTozone = distance(lat, lon, ssXML.getCLat(),
|
||||
ssXML.getCLon());
|
||||
}
|
||||
} catch (SpatialException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Couldn't find marine zone within distance. lon: "+lon+" lat: "+lat+" dist: "+configDist, e);
|
||||
}
|
||||
if (shipTozone < configDist) {
|
||||
retVal = true;
|
||||
}
|
||||
|
@ -324,4 +413,4 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
|
|||
return snowmcm;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -27,6 +27,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin
|
||||
* Sep 04, 2014 3220 skorolev Removed CWA from filter.
|
||||
* Sep 17, 2015 3873 skorolev Added pattern for moving platforms.
|
||||
* Dec 02, 2015 3873 dhladky Revamped for better performance.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -37,30 +38,12 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(URIFilter.class);
|
||||
|
||||
/** Station ID **/
|
||||
private String stn;
|
||||
|
||||
/** Station coordinates **/
|
||||
private Coordinate stationCoor = null;
|
||||
|
||||
/** Patterns used for matching URI's **/
|
||||
private HashMap<String, Pattern> patternKeys = null;
|
||||
|
||||
/** METAR Pattern **/
|
||||
private Pattern metarPattern = null;
|
||||
|
||||
/** Maritime Pattern **/
|
||||
private Pattern maritimePattern = null;
|
||||
|
||||
/** Mesowest Pattern **/
|
||||
private Pattern mesowestPattern = null;
|
||||
|
||||
/** Pattern for moving platforms **/
|
||||
private Pattern movingPattern = null;
|
||||
|
||||
/** Current data type #METAR, #Maritime or #Mesonet **/
|
||||
private String dataType;
|
||||
|
||||
/** All filtered stations */
|
||||
private Set<String> stations = null;
|
||||
|
||||
|
@ -95,34 +78,45 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
*/
|
||||
@Override
|
||||
public void setMatchURIs() {
|
||||
|
||||
Pattern pat = Pattern.compile("#");
|
||||
/**
|
||||
* For non moving platforms we setup specific patterns as they are fixed locations.
|
||||
*/
|
||||
for (String st : stations) {
|
||||
String[] tokens = pat.split(st);
|
||||
setStn(tokens[0]);
|
||||
setDataType(tokens[1]);
|
||||
switch (getDataType()) {
|
||||
String station = tokens[0];
|
||||
String dataType = tokens[1];
|
||||
switch (dataType) {
|
||||
case ObConst.METAR:
|
||||
setMetarPattern();
|
||||
getMatchURIs().put(getMetarPattern(), 0l);
|
||||
Pattern metarPattern = getMetarPattern(station);
|
||||
statusHandler.info("Adding Pattern for type: "+ObConst.METAR+" Pattern: "+metarPattern.toString());
|
||||
getMatchURIs().put(metarPattern, 0l);
|
||||
break;
|
||||
case ObConst.MARITIME:
|
||||
setMaritimePattern();
|
||||
getMatchURIs().put(getMaritimePattern(), 0l);
|
||||
Pattern maritimePattern = getMaritimePattern(station);
|
||||
statusHandler.info("Adding Pattern for type: "+ObConst.MARITIME+" Pattern: "+maritimePattern.toString());
|
||||
getMatchURIs().put(maritimePattern, 0l);
|
||||
break;
|
||||
case ObConst.MESONET:
|
||||
setMesowestPattern();
|
||||
getMatchURIs().put(getMesowestPattern(), 0l);
|
||||
Pattern mesowestPattern = getMesowestPattern(station);
|
||||
statusHandler.info("Adding Pattern for type: "+ObConst.MESONET+" Pattern: "+mesowestPattern.toString());
|
||||
getMatchURIs().put(mesowestPattern, 0l);
|
||||
break;
|
||||
default:
|
||||
statusHandler.error("Get unknown data type " + getDataType());
|
||||
statusHandler.error("Get unknown data type " + dataType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
String[] repTyps = { ObConst.SYNOPTIC_SHIP, ObConst.DRIFTING_BUOY,
|
||||
ObConst.SYNOPTIC_MAROB };
|
||||
for (String rt : repTyps) {
|
||||
setMovingPattern(rt);
|
||||
getMatchURIs().put(getMovingPattern(), 0l);
|
||||
|
||||
/**
|
||||
* Moving types aren't fixed, we use a general pattern and then filter upon discovery.
|
||||
*/
|
||||
|
||||
for (String rt : FSSObsGenerator.movingTypes) {
|
||||
Pattern movingPattern = getMovingPattern(rt);
|
||||
statusHandler.info("Adding Pattern for type: "+rt+" Pattern: "+movingPattern.toString());
|
||||
getMatchURIs().put(movingPattern, 0l);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,121 +269,53 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
|
||||
/**
|
||||
* Gets Metar Pattern.
|
||||
*
|
||||
* @return MetarPattern
|
||||
*/
|
||||
public Pattern getMetarPattern() {
|
||||
private Pattern getMetarPattern(String station) {
|
||||
// "/obs/2010-11-01_14:15:00.0/METAR<SPECI???>/null/K0A9/36.371/-82.173"
|
||||
Pattern metarPattern = Pattern.compile("/obs/" + wildCard + uriSeperator
|
||||
+ wildCard + uriSeperator + "null" + uriSeperator + station
|
||||
+ uriSeperator);
|
||||
return metarPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Metar Pattern.
|
||||
* Gets Maritime Pattern
|
||||
*/
|
||||
public void setMetarPattern() {
|
||||
// "/obs/2010-11-01_14:15:00.0/METAR<SPECI???>/null/K0A9/36.371/-82.173"
|
||||
metarPattern = Pattern.compile("/obs/" + wildCard + uriSeperator
|
||||
+ wildCard + uriSeperator + "null" + uriSeperator + getStn()
|
||||
+ uriSeperator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Maritime Pattern.
|
||||
*
|
||||
* @return MaritimePattern
|
||||
*/
|
||||
public Pattern getMaritimePattern() {
|
||||
return maritimePattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Maritime Pattern
|
||||
*/
|
||||
public void setMaritimePattern() {
|
||||
private Pattern getMaritimePattern(String station) {
|
||||
// /sfcobs/2010-10-28_10:36:00.0/1004[5]/null/BEPB6/32.373/-64.703
|
||||
maritimePattern = Pattern.compile("/sfcobs/" + wildCard + uriSeperator
|
||||
+ wildCard + uriSeperator + "null" + uriSeperator + getStn()
|
||||
Pattern maritimePattern = Pattern.compile("/sfcobs/" + wildCard + uriSeperator
|
||||
+ wildCard + uriSeperator + "null" + uriSeperator + station
|
||||
+ uriSeperator);
|
||||
return maritimePattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Mesowest Pattern.
|
||||
*
|
||||
* @return the mesowestPattern
|
||||
*/
|
||||
public Pattern getMesowestPattern() {
|
||||
return mesowestPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets Mesowest Pattern.
|
||||
*
|
||||
* @param mesowestPattern
|
||||
* the mesowestPattern to set
|
||||
*/
|
||||
public void setMesowestPattern() {
|
||||
private Pattern getMesowestPattern(String station) {
|
||||
// There is no dataURI for ldadmesonet data
|
||||
// /ldadmesonet/2011-06-29_22:10:00.0/mesonet/NWSRAWS/RINN4/41.1181/-74.2403
|
||||
mesowestPattern = Pattern.compile("/ldadmesonet/" + wildCard
|
||||
Pattern mesowestPattern = Pattern.compile("/ldadmesonet/" + wildCard
|
||||
+ uriSeperator + wildCard + uriSeperator + wildCard
|
||||
+ uriSeperator + getStn());
|
||||
+ uriSeperator + station);
|
||||
return mesowestPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets pattern for moving platforms and MAROBs
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Pattern getMovingPattern() {
|
||||
return movingPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets pattern for ships "1003", drifting buoys "1006" and MAROBs "1007".
|
||||
*
|
||||
* @param reportType
|
||||
*/
|
||||
public void setMovingPattern(String reportType) {
|
||||
private Pattern getMovingPattern(String reportType) {
|
||||
// /sfcobs/2010-10-28_10:36:00.0/1003<6,7>/null/BEPB6/32.373/-64.703
|
||||
this.movingPattern = Pattern.compile("/sfcobs/" + wildCard
|
||||
Pattern movingPattern = Pattern.compile("/sfcobs/" + wildCard
|
||||
+ uriSeperator + reportType + uriSeperator + wildCard
|
||||
+ uriSeperator);
|
||||
return movingPattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets station name
|
||||
*
|
||||
* @return the stn
|
||||
*/
|
||||
public String getStn() {
|
||||
return stn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets station name.
|
||||
*
|
||||
* @param stn
|
||||
* the stn to set
|
||||
*/
|
||||
public void setStn(String stn) {
|
||||
this.stn = stn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets data type.
|
||||
*
|
||||
* @param the
|
||||
* dataType to set
|
||||
*/
|
||||
public void setDataType(String type) {
|
||||
this.dataType = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data type.
|
||||
*
|
||||
* @return the dataType
|
||||
*/
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ import com.raytheon.uf.edex.pointdata.PointDataQuery;
|
|||
* Apr 28, 2014 3086 skorolev Updated getStations method.
|
||||
* Sep 04, 2014 3220 skorolev Removed getStations method.
|
||||
* Sep 18, 2015 3873 skorolev Removed identical constant definitions.
|
||||
* Dec 02, 2015 3873 dhladky Logging change.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -352,7 +353,7 @@ public class FSSObsUtils {
|
|||
case "":
|
||||
break;
|
||||
default:
|
||||
statusHandler.error("Get unknown sky cover " + sc);
|
||||
statusHandler.warn("Get unknown sky cover " + sc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import com.raytheon.uf.edex.plugin.fssobs.FSSObsUtils;
|
|||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* Sep 04, 2014 3220 skorolev Removed cwa and monitorUse from data set.
|
||||
* Sep 18, 2015 3873 skorolev Removed identical constant definitions.
|
||||
* Dec 02, 2015 3873 dhladky Logging change.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -85,32 +86,25 @@ public class FSSObsConfig {
|
|||
public FSSObsRecord getTableRow(String uri) {
|
||||
String dt = uri.substring(1)
|
||||
.substring(0, uri.substring(1).indexOf("/"));
|
||||
if (dt.equals("obs")) {
|
||||
try {
|
||||
tableRow = FSSObsUtils.getRecordFromMetar(uri);
|
||||
|
||||
} catch (PluginException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
} else if (dt.equals("sfcobs")) {
|
||||
try {
|
||||
try {
|
||||
|
||||
if (dt.equals("obs")) {
|
||||
tableRow = FSSObsUtils.getRecordFromMetar(uri);
|
||||
} else if (dt.equals("sfcobs")) {
|
||||
tableRow = FSSObsUtils.getRecordFromMaritime(uri);
|
||||
} catch (PluginException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
} else if (dt.equals("ldadmesonet")) {
|
||||
try {
|
||||
} else if (dt.equals("ldadmesonet")) {
|
||||
tableRow = FSSObsUtils.getRecordFromMesowest(uri);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
|
||||
} catch (PluginException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Could not create type: "
|
||||
+ dt + " URI: " + uri, e);
|
||||
}
|
||||
|
||||
if (tableRow.getRelativeHumidity() == ObConst.MISSING) {
|
||||
Float RH = FSSObsUtils.getRH(tableRow.getDewpoint(),
|
||||
tableRow.getTemperature());
|
||||
tableRow.getTemperature());
|
||||
tableRow.setRelativeHumidity(RH);
|
||||
}
|
||||
float[] snowData = FSSObsUtils.getSnowData(tableRow);
|
||||
|
|
Loading…
Add table
Reference in a new issue