Merge tag 'OB_14.4.1-15m' into omaha_15.1.1
Former-commit-id: 4fe28e2a0013f77c8a04a56789fc4e101039d77f
This commit is contained in:
commit
4088396ba5
62 changed files with 3076 additions and 3047 deletions
|
@ -41,8 +41,8 @@ SET A2_JAVA_REG=
|
|||
SET A2_PYTHON_REG=
|
||||
|
||||
REM Determine where we will be logging to.
|
||||
SET HOME_DIRECTORY=%HOMEDRIVE%%HOMEPATH%
|
||||
SET CAVEDATA_LOG_DIRECTORY=%HOMEDRIVE%%HOMEPATH%\caveData\logs
|
||||
SET HOME_DIRECTORY=%USERPROFILE%
|
||||
SET CAVEDATA_LOG_DIRECTORY=%HOME_DIRECTORY%\caveData\logs
|
||||
SET CONSOLE_LOG_DIRECTORY=%CAVEDATA_LOG_DIRECTORY%\consoleLogs\%COMPUTERNAME%
|
||||
IF NOT EXIST "%CONSOLE_LOG_DIRECTORY%" (MKDIR "%CONSOLE_LOG_DIRECTORY%")
|
||||
|
||||
|
@ -58,6 +58,10 @@ REM instead of -formatter- strings like Linux allows.
|
|||
python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%%d_%%H%%M%%S');" > %RND_DATETIME_FILE%
|
||||
SET /p LOG_DATETIME= < %RND_DATETIME_FILE%
|
||||
DEL %RND_DATETIME_FILE%
|
||||
|
||||
SET LOGFILE_CONSOLE=%CAVEDATA_LOG_DIRECTORY%\alertviz_%LOG_DATETIME%_console.log
|
||||
SET LOGFILE_ALERTVIZ=%CAVEDATA_LOG_DIRECTORY%\alertviz_%LOG_DATETIME%_admin.log
|
||||
|
||||
"%CONTAINING_DIRECTORY%alertviz.exe" %* > "%CONSOLE_LOG_DIRECTORY%\alertviz_%LOG_DATETIME%.log" 2>&1
|
||||
IF %ERRORLEVEL% == 0 (EXIT)
|
||||
echo Restarting AlertViz.
|
||||
|
|
|
@ -44,8 +44,8 @@ SET A2_JAVA_REG=
|
|||
SET A2_PYTHON_REG=
|
||||
|
||||
REM Determine where we will be logging to.
|
||||
SET HOME_DIRECTORY=%HOMEDRIVE%%HOMEPATH%
|
||||
SET CAVEDATA_LOG_DIRECTORY=%HOMEDRIVE%%HOMEPATH%\caveData\logs
|
||||
SET HOME_DIRECTORY=%USERPROFILE%
|
||||
SET CAVEDATA_LOG_DIRECTORY=%HOME_DIRECTORY%\caveData\logs
|
||||
SET CONSOLE_LOG_DIRECTORY=%CAVEDATA_LOG_DIRECTORY%\consoleLogs\%COMPUTERNAME%
|
||||
IF NOT EXIST "%CONSOLE_LOG_DIRECTORY%" (MKDIR "%CONSOLE_LOG_DIRECTORY%")
|
||||
|
||||
|
@ -59,6 +59,11 @@ python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%
|
|||
SET /p LOG_DATETIME= < %RND_DATETIME_FILE%
|
||||
DEL %RND_DATETIME_FILE%
|
||||
|
||||
SET LOGFILE_CAVE=%CAVEDATA_LOG_DIRECTORY%\cave_%LOG_DATETIME%_logs.log
|
||||
SET LOGFILE_CONSOLE=%CAVEDATA_LOG_DIRECTORY%\cave_%LOG_DATETIME%_console.log
|
||||
SET LOGFILE_PERFORMANCE=%CAVEDATA_LOG_DIRECTORY%\cave_%LOG_DATETIME%_perf.log
|
||||
SET LOGFILE_PRODUCT_EDITOR=%CAVEDATA_LOG_DIRECTORY%\cave_%LOG_DATETIME%_productEditor.log
|
||||
|
||||
echo THIS CMD WINDOW CAN BE CLOSED AT ANY TIME!
|
||||
cd %HOMEPATH%
|
||||
REM Start CAVE.
|
||||
|
|
|
@ -108,6 +108,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
|||
* May 14, 2014 3061 bclement added better checks for when to send invite/session payloads
|
||||
* Jun 16, 2014 3288 bclement feed venue configuration changes
|
||||
* Jun 17, 2014 3078 bclement peer to peer communication uses private chat
|
||||
* Feb 12, 2015 4117 bclement fixed 14.3/14.4 peer-to-peer messaging
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -232,10 +233,6 @@ public class SharedDisplaySession extends VenueSession implements
|
|||
if (obj == null) {
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* TODO it would be nice to use MUC private chat for this, but it would
|
||||
* break backwards compatibility
|
||||
*/
|
||||
boolean doSend = true;
|
||||
if (hasRole(SharedDisplayRole.DATA_PROVIDER)
|
||||
&& !isSharedDisplayClient(participant)) {
|
||||
|
@ -248,9 +245,20 @@ public class SharedDisplaySession extends VenueSession implements
|
|||
doSend = false;
|
||||
}
|
||||
if (doSend) {
|
||||
String to;
|
||||
/*
|
||||
* clients older than 14.4 expect peer to peer messages sent
|
||||
* directly to the user ID. When all clients are 14.4 or above it
|
||||
* will be safe to always send to the room handle.
|
||||
*/
|
||||
if (participant.hasActualUserId()) {
|
||||
to = participant.getUserid().getFQName();
|
||||
} else {
|
||||
to = participant.getFQName();
|
||||
}
|
||||
SessionPayload payload = new SessionPayload(PayloadType.Command,
|
||||
obj);
|
||||
Message msg = new Message(participant.getFQName(), Type.normal);
|
||||
Message msg = new Message(to, Type.normal);
|
||||
msg.addExtension(payload);
|
||||
msg.setFrom(conn.getUser());
|
||||
msg.setProperty(Tools.PROP_SESSION_ID, getSessionId());
|
||||
|
|
|
@ -22,8 +22,11 @@ package com.raytheon.uf.viz.hpe.rsc;
|
|||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
@ -32,6 +35,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
|
||||
import com.raytheon.uf.common.plugin.hpe.data.HpeLabelKey;
|
||||
import com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataRequest;
|
||||
import com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataResponse;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -66,6 +70,7 @@ import com.raytheon.viz.grid.rsc.general.D2DGridResource;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* May 5, 2014 3026 mpduff Initial creation
|
||||
* Dec 16, 2014 3026 mpduff Change location of text
|
||||
* Feb 13, 2015 4121 mpduff Change label caching.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -80,8 +85,8 @@ public class HpeLabelResource extends
|
|||
private final IUFStatusHandler logger = UFStatus
|
||||
.getHandler(HpeLabelResource.class);
|
||||
|
||||
private final Map<Date, String> hpeTextCache = Collections
|
||||
.synchronizedMap(new HashMap<Date, String>());
|
||||
private final Map<HpeLabelKey, String> hpeTextCache = Collections
|
||||
.synchronizedMap(new HashMap<HpeLabelKey, String>());
|
||||
|
||||
private DrawableString drawableString = null;
|
||||
|
||||
|
@ -98,7 +103,16 @@ public class HpeLabelResource extends
|
|||
public void resourceChanged(ChangeType type, Object object) {
|
||||
if (type == ChangeType.DATA_REMOVE) {
|
||||
if (object instanceof DataTime) {
|
||||
hpeTextCache.remove(((DataTime) object).getRefTime());
|
||||
Set<Entry<HpeLabelKey, String>> entrySet = hpeTextCache
|
||||
.entrySet();
|
||||
Iterator<Entry<HpeLabelKey, String>> iter = entrySet.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entry<HpeLabelKey, String> entry = iter.next();
|
||||
HpeLabelKey key = entry.getKey();
|
||||
if (key.getDate().equals(((DataTime) object).getRefTime())) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +177,8 @@ public class HpeLabelResource extends
|
|||
}
|
||||
|
||||
private String getText(Date date, String productId) {
|
||||
String text = hpeTextCache.get(date);
|
||||
HpeLabelKey key = new HpeLabelKey(productId, date);
|
||||
String text = hpeTextCache.get(key);
|
||||
if (text == null) {
|
||||
dataJob.scheduleRetrieval(date, productId);
|
||||
}
|
||||
|
@ -214,7 +229,8 @@ public class HpeLabelResource extends
|
|||
.sendRequest(req);
|
||||
Map<Date, String> data = response.getData();
|
||||
for (Date d : data.keySet()) {
|
||||
hpeTextCache.put(d, data.get(d));
|
||||
HpeLabelKey key = new HpeLabelKey(productId, d);
|
||||
hpeTextCache.put(key, data.get(d));
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.error(e.getLocalizedMessage(), e);
|
||||
|
@ -223,4 +239,4 @@ public class HpeLabelResource extends
|
|||
return Status.OK_STATUS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -81,6 +81,7 @@ import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
|
|||
import com.raytheon.uf.common.monitor.xml.DomainXML;
|
||||
import com.raytheon.uf.common.monitor.xml.ProductXML;
|
||||
import com.raytheon.uf.common.monitor.xml.SourceXML;
|
||||
import com.raytheon.uf.common.plugin.hpe.data.HpeLabelKey;
|
||||
import com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataRequest;
|
||||
import com.raytheon.uf.common.plugin.hpe.request.HpeLabelDataResponse;
|
||||
import com.raytheon.uf.common.status.IPerformanceStatusHandler;
|
||||
|
@ -91,7 +92,6 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.time.util.ITimer;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.StringUtil;
|
||||
import com.raytheon.uf.viz.core.DrawableLine;
|
||||
import com.raytheon.uf.viz.core.DrawableString;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
|
@ -198,7 +198,8 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* assignments.
|
||||
* Sep 23, 2014 3009 njensen Overrode recycleInternal()
|
||||
* Nov 10, 2014 3026 dhladky HPE BIAS displays.
|
||||
* Dec 16, 2014 3026 mpduff Change location of text
|
||||
* Dec 16, 2014 3026 mpduff Change location of text.
|
||||
* Feb 13, 2015 4121 mpduff Change label caching.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -268,6 +269,9 @@ public class FFMPResource extends
|
|||
/** HPE Constant */
|
||||
private static final String HPE = "HPE";
|
||||
|
||||
/** BiasHPE Constant */
|
||||
private static final String BHPE = "BHPE";
|
||||
|
||||
/** the stream cross hatched area **/
|
||||
private IWireframeShape streamOutlineShape = null;
|
||||
|
||||
|
@ -424,6 +428,8 @@ public class FFMPResource extends
|
|||
|
||||
private DrawableString basinLocatorString = null;
|
||||
|
||||
private DrawableString hpeLabelString = null;
|
||||
|
||||
private RGB basinTraceColor = null;
|
||||
|
||||
private RGB basinBoundaryColor = null;
|
||||
|
@ -440,8 +446,12 @@ public class FFMPResource extends
|
|||
private boolean restoreTable = false;
|
||||
|
||||
/** HPE bias source legend cache */
|
||||
private final Map<Date, String> hpeLegendMap = Collections
|
||||
.synchronizedMap(new HashMap<Date, String>());
|
||||
private final Map<HpeLabelKey, String> hpeLegendMap = Collections
|
||||
.synchronizedMap(new HashMap<HpeLabelKey, String>());
|
||||
|
||||
/** Lookup of Date to product ids displaying for that date */
|
||||
private final Map<Date, List<String>> hpeCacheLookup = Collections
|
||||
.synchronizedMap(new HashMap<Date, List<String>>());
|
||||
|
||||
/** Flag denoting data as HPE */
|
||||
private boolean isHpe;
|
||||
|
@ -538,11 +548,30 @@ public class FFMPResource extends
|
|||
PluginDataObject[] pdos = (PluginDataObject[]) object;
|
||||
for (PluginDataObject pdo : pdos) {
|
||||
FFMPRecord ffmpRec = (FFMPRecord) pdo;
|
||||
hpeLegendMap.remove(ffmpRec.getDataTime().getRefTime());
|
||||
Date date = ffmpRec.getDataTime().getRefTime();
|
||||
removeHpeLabels(date);
|
||||
}
|
||||
} else if (object instanceof DataTime) {
|
||||
DataTime dt = (DataTime) object;
|
||||
hpeLegendMap.remove(dt.getRefTime());
|
||||
removeHpeLabels(dt.getRefTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the labels in the cache for the given time and product.
|
||||
*
|
||||
* @param date
|
||||
* The time to remove
|
||||
* @param productId
|
||||
* The product to remove
|
||||
*/
|
||||
private void removeHpeLabels(Date date) {
|
||||
List<String> products = hpeCacheLookup.remove(date);
|
||||
if (products != null) {
|
||||
for (String product : products) {
|
||||
HpeLabelKey key = new HpeLabelKey(product, date);
|
||||
hpeLegendMap.remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1253,12 +1282,19 @@ public class FFMPResource extends
|
|||
basinLocatorString.horizontalAlignment = HorizontalAlignment.CENTER;
|
||||
basinLocatorString.verticallAlignment = VerticalAlignment.MIDDLE;
|
||||
basinLocatorString.addTextStyle(TextStyle.BLANKED);
|
||||
|
||||
hpeLabelString = new DrawableString("", getCapability(
|
||||
ColorableCapability.class).getColor());
|
||||
hpeLabelString.font = font;
|
||||
hpeLabelString.horizontalAlignment = HorizontalAlignment.CENTER;
|
||||
hpeLabelString.verticallAlignment = VerticalAlignment.TOP;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Set flag for HPE data
|
||||
isHpe = resourceData.siteKey.equalsIgnoreCase(HPE)
|
||||
|| resourceData.siteKey.equalsIgnoreCase("BHPE");
|
||||
isHpe = resourceData.dataKey.equalsIgnoreCase(HPE)
|
||||
|| resourceData.dataKey.equalsIgnoreCase(BHPE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1479,6 +1515,24 @@ public class FFMPResource extends
|
|||
paintUpAndDownStream(aTarget, paintProps);
|
||||
}
|
||||
|
||||
// draw hpe strings if HPE
|
||||
if (isHpe) {
|
||||
// Paint the HPE bias source text if HPE
|
||||
String text = getHpeText(paintTime.getRefTime());
|
||||
|
||||
if (text != null && text.trim().length() > 0) {
|
||||
double[] pixel = paintProps.getView().getDisplayCoords(
|
||||
new double[] { 110, 120 }, aTarget);
|
||||
hpeLabelString
|
||||
.setText(text,
|
||||
getCapability(ColorableCapability.class)
|
||||
.getColor());
|
||||
hpeLabelString.setCoordinates(pixel[0], pixel[1]);
|
||||
aTarget.drawStrings(hpeLabelString);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// always reset
|
||||
isQuery = false;
|
||||
} finally {
|
||||
|
@ -1503,15 +1557,6 @@ public class FFMPResource extends
|
|||
.append(FFMPRecord.getFieldLongDescription(getField()));
|
||||
}
|
||||
|
||||
// Paint the HPE bias source text if HPE
|
||||
if (isHpe && qpeRecord != null) {
|
||||
String text = getText(paintTime.getRefTime());
|
||||
if (text != null) {
|
||||
sb.append(StringUtil.NEWLINE);
|
||||
sb.append(text);
|
||||
}
|
||||
}
|
||||
|
||||
fieldDescString.setText(sb.toString(),
|
||||
getCapability(ColorableCapability.class).getColor());
|
||||
fieldDescString.setCoordinates(pixel[0], pixel[1]);
|
||||
|
@ -4178,14 +4223,44 @@ public class FFMPResource extends
|
|||
* @param date
|
||||
* @return
|
||||
*/
|
||||
private String getText(Date date) {
|
||||
String text = hpeLegendMap.get(date);
|
||||
private String getHpeText(Date date) {
|
||||
List<String> products = hpeCacheLookup.get(date);
|
||||
if (products == null) {
|
||||
products = new ArrayList<String>(0);
|
||||
}
|
||||
HpeLabelKey key = new HpeLabelKey();
|
||||
key.setDate(date);
|
||||
for (String product : products) {
|
||||
key.setProductName(product);
|
||||
}
|
||||
String text = hpeLegendMap.get(key);
|
||||
if (text == null) {
|
||||
FFMPRecord hpeQpeRecord = getQpeRecord();
|
||||
String wfo = null;
|
||||
String siteKey = null;
|
||||
String dataKey = null;
|
||||
String sourceName = null;
|
||||
|
||||
if (qpeRecord != null) {
|
||||
wfo = qpeRecord.getWfo();
|
||||
siteKey = qpeRecord.getSiteKey();
|
||||
dataKey = qpeRecord.getDataKey();
|
||||
sourceName = qpeRecord.getSourceName();
|
||||
} else if (qpfRecord != null) {
|
||||
wfo = qpfRecord.getWfo();
|
||||
siteKey = qpfRecord.getSiteKey();
|
||||
dataKey = qpfRecord.getDataKey();
|
||||
sourceName = qpfRecord.getSourceName();
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
String productId = monitor.getProductID(paintTime.getRefTime(),
|
||||
hpeQpeRecord.getWfo(), hpeQpeRecord.getSiteKey(),
|
||||
hpeQpeRecord.getDataKey(), hpeQpeRecord.getSourceName());
|
||||
wfo, siteKey, dataKey, sourceName);
|
||||
dataJob.scheduleRetrieval(date, productId);
|
||||
statusHandler.info("Loading product " + productId);
|
||||
}
|
||||
|
||||
if (text == null) {
|
||||
text = "";
|
||||
}
|
||||
|
||||
return text;
|
||||
|
@ -4237,7 +4312,12 @@ public class FFMPResource extends
|
|||
.sendRequest(req);
|
||||
Map<Date, String> data = response.getData();
|
||||
for (Date d : data.keySet()) {
|
||||
hpeLegendMap.put(d, data.get(d));
|
||||
HpeLabelKey key = new HpeLabelKey(productId, d);
|
||||
hpeLegendMap.put(key, data.get(d));
|
||||
if (!hpeCacheLookup.containsKey(d)) {
|
||||
hpeCacheLookup.put(d, new ArrayList<String>());
|
||||
}
|
||||
hpeCacheLookup.get(d).add(productId);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.error(e.getLocalizedMessage(), e);
|
||||
|
|
|
@ -29,6 +29,9 @@ import java.util.SortedMap;
|
|||
import java.util.TreeMap;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
|
@ -37,6 +40,7 @@ import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
|
|||
import com.raytheon.uf.common.geospatial.SpatialException;
|
||||
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -48,6 +52,7 @@ import com.raytheon.uf.viz.monitor.IMonitor;
|
|||
import com.raytheon.uf.viz.monitor.Monitor;
|
||||
import com.raytheon.uf.viz.monitor.ObsMonitor;
|
||||
import com.raytheon.uf.viz.monitor.data.AreaContainer;
|
||||
import com.raytheon.uf.viz.monitor.data.MonitoringArea;
|
||||
import com.raytheon.uf.viz.monitor.data.ObMultiHrsReports;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.uf.viz.monitor.data.ObsData;
|
||||
|
@ -59,6 +64,7 @@ import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
|
|||
import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
|
||||
import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogZoneTableDlg;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorThresholdConfiguration;
|
||||
import com.raytheon.viz.alerts.observers.ProductAlertObserver;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
@ -82,11 +88,8 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* Oct.31 2012 1297 skorolev Clean code
|
||||
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
|
||||
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
|
||||
* Sep 04, 2014 3220 skorolev
|
||||
* Sep 23, 2014 3356 njensen Remove unnecessary import
|
||||
* Jan 27, 2015 3220 skorolev Corrected fogConfig assignment.Moved refreshing of table in the UI thread.
|
||||
* Updated configUpdate method and added updateMonitoringArea.
|
||||
* Replaced MonitoringArea with fogConfig.Updated code for better performance.
|
||||
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
|
||||
* Sep 23, 2014 3356 njensen Remove unnecessary import
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -104,12 +107,21 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
/** Singleton instance of this class */
|
||||
private static FogMonitor monitor = null;
|
||||
|
||||
/**
|
||||
* This object contains all observation data necessary for the table dialogs
|
||||
* and trending plots [this replaces the objects of ObsData and TableData
|
||||
* below Jan 21, 2010, zhao]
|
||||
*/
|
||||
private ObMultiHrsReports obData;
|
||||
|
||||
/** data holder for FOG **/
|
||||
private ObsData obsData;
|
||||
|
||||
/** data holder for FOG ALG data **/
|
||||
private SortedMap<Date, Map<String, FOG_THREAT>> algorithmData = null;
|
||||
|
||||
private Date dialogTime = null;
|
||||
|
||||
/** list of coordinates for each zone **/
|
||||
private Map<String, Geometry> zoneGeometries = null;
|
||||
|
||||
|
@ -120,7 +132,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
private MonitoringAreaConfigDlg areaDialog = null;
|
||||
|
||||
/** area config manager **/
|
||||
private static FSSObsMonitorConfigurationManager fogConfig = null;
|
||||
private FSSObsMonitorConfigurationManager fogConfig = null;
|
||||
|
||||
/** table data for the station table **/
|
||||
private final TableData stationTableData = new TableData(
|
||||
|
@ -149,10 +161,13 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
*/
|
||||
private FogMonitor() {
|
||||
pluginPatterns.add(fogPattern);
|
||||
fogConfig = FSSObsMonitorConfigurationManager.getFogObsManager();
|
||||
fogConfig = new FSSObsMonitorConfigurationManager(MonName.fog.name());
|
||||
updateMonitoringArea();
|
||||
initObserver(OBS, this);
|
||||
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
|
||||
obData.setThresholdMgr(FogThresholdMgr.getInstance());
|
||||
obData.getZoneTableData();
|
||||
readTableConfig(MonitorThresholdConfiguration.FOG_THRESHOLD_CONFIG);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -163,10 +178,13 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
public static synchronized FogMonitor getInstance() {
|
||||
if (monitor == null) {
|
||||
monitor = new FogMonitor();
|
||||
// Pre-populate dialog with an observations from DB
|
||||
monitor.createDataStructures();
|
||||
monitor.getAdjAreas();
|
||||
monitor.processProductAtStartup(fogConfig);
|
||||
monitor.processProductAtStartup(MonName.fog.name());
|
||||
monitor.fireMonitorEvent(monitor);
|
||||
}
|
||||
|
||||
return monitor;
|
||||
}
|
||||
|
||||
|
@ -190,11 +208,12 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
// [Jan 21, 2010, zhao]
|
||||
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
|
||||
obData.setThresholdMgr(FogThresholdMgr.getInstance());
|
||||
|
||||
obsData = new ObsData();
|
||||
algorithmData = new TreeMap<Date, Map<String, FOG_THREAT>>();
|
||||
|
||||
for (String zone : fogConfig.getAreaList()) {
|
||||
obsData.addArea(zone, fogConfig.getAreaStations(zone));
|
||||
for (String zone : MonitoringArea.getPlatformMap().keySet()) {
|
||||
obsData.addArea(zone, MonitoringArea.getPlatformMap().get(zone));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,10 +251,38 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
@Override
|
||||
public void processProductMessage(final AlertMessage filtered) {
|
||||
if (fogPattern.matcher(filtered.dataURI).matches()) {
|
||||
processURI(filtered.dataURI, filtered, fogConfig);
|
||||
processURI(filtered.dataURI, filtered);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that reads the table configuration and updates the zone monitor
|
||||
* threshold map
|
||||
*
|
||||
* @param file
|
||||
* -- the xml configuration filename
|
||||
*/
|
||||
public void readTableConfig(String file) {
|
||||
// TODO update for Maritime
|
||||
Map<String, List<String>> zones = new HashMap<String, List<String>>();
|
||||
// create zones and stations list
|
||||
try {
|
||||
for (String zone : fogConfig.getAreaList()) {
|
||||
// add the unique
|
||||
List<String> stations = fogConfig.getAreaStations(zone);
|
||||
zones.put(zone, stations);
|
||||
}
|
||||
} catch (Exception ve) {
|
||||
String msg = "FOG Monitor failed to load configuration..."
|
||||
+ this.getClass().getName();
|
||||
ErrorDialog.openError(Display.getCurrent().getActiveShell(),
|
||||
"FOG Monitor failed to load configuration", msg,
|
||||
new Status(IStatus.ERROR, Activator.PLUGIN_ID, msg, ve));
|
||||
|
||||
}
|
||||
MonitoringArea.setPlatformMap(zones);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -269,9 +316,9 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
@Override
|
||||
public void configUpdate(IMonitorConfigurationEvent me) {
|
||||
fogConfig = (FSSObsMonitorConfigurationManager) me.getSource();
|
||||
obData.getObHourReports().updateZones(fogConfig);
|
||||
updateMonitoringArea();
|
||||
if (zoneDialog != null && !zoneDialog.isDisposed()) {
|
||||
obData.updateTableCache();
|
||||
zoneDialog.refreshZoneTableData(obData);
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
@ -286,6 +333,21 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
monitor = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the zone based on the icao passed into it
|
||||
*
|
||||
* @param icao
|
||||
* @return zone
|
||||
*/
|
||||
public String findZone(String icao) {
|
||||
for (String zone : MonitoringArea.getPlatformMap().keySet()) {
|
||||
if (MonitoringArea.getPlatformMap().get(zone).contains(icao)) {
|
||||
return zone;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the main map
|
||||
*
|
||||
|
@ -305,20 +367,14 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
@Override
|
||||
protected void process(ObReport result) throws Exception {
|
||||
obData.addReport(result);
|
||||
// update table cache
|
||||
obData.getZoneTableData(result.getRefHour());
|
||||
// Get zones containing station
|
||||
List<String> zones = fogConfig.getAreaByStationId(result
|
||||
.getPlatformId());
|
||||
if (!zones.isEmpty() || zones != null) {
|
||||
for (String zn : zones) {
|
||||
AreaContainer ac = getTableData().getArea(zn);
|
||||
if (ac != null) {
|
||||
ac.addReport(result.getObservationTime(), result);
|
||||
}
|
||||
String zone = findZone(result.getPlatformId());
|
||||
if (zone != null) {
|
||||
AreaContainer ac = getTableData().getArea(zone);
|
||||
if (ac != null) {
|
||||
ac.addReport(result.getObservationTime(), result);
|
||||
fireMonitorEvent(this);
|
||||
}
|
||||
}
|
||||
fireMonitorEvent(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -338,20 +394,26 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
*/
|
||||
public void launchDialog(String type, Shell shell) {
|
||||
if (type.equals("zone")) {
|
||||
zoneDialog = new FogZoneTableDlg(shell, obData);
|
||||
addMonitorListener(zoneDialog);
|
||||
zoneDialog.addMonitorControlListener(this);
|
||||
if (zoneDialog == null) {
|
||||
zoneDialog = new FogZoneTableDlg(shell, obData);
|
||||
addMonitorListener(zoneDialog);
|
||||
zoneDialog.addMonitorControlListener(this);
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
}
|
||||
zoneDialog.open();
|
||||
} else if (type.equals("area")) {
|
||||
areaDialog = new FogMonitoringAreaConfigDlg(shell,
|
||||
"Fog Monitor Area Configuration");
|
||||
areaDialog.setCloseCallback(new ICloseCallback() {
|
||||
if (areaDialog == null) {
|
||||
areaDialog = new FogMonitoringAreaConfigDlg(shell,
|
||||
"Fog Monitor Area Configuration");
|
||||
areaDialog.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
areaDialog = null;
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
areaDialog = null;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
areaDialog.open();
|
||||
}
|
||||
}
|
||||
|
@ -383,7 +445,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
algData = algorithmData.get(time);
|
||||
} else {
|
||||
// by default is nothing in the ALG column
|
||||
for (String zone : fogConfig.getAreaList()) {
|
||||
for (String zone : MonitoringArea.getPlatformMap().keySet()) {
|
||||
algData.put(zone, FOG_THREAT.GRAY);
|
||||
}
|
||||
}
|
||||
|
@ -471,18 +533,21 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
*
|
||||
* @param drawTime
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ObsMonitor#updateDialogTime(java.util.Date)
|
||||
*/
|
||||
@Override
|
||||
public void updateDialogTime(Date dialogTime) {
|
||||
this.dialogTime = dialogTime;
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* The date for the dialog to stay in step with
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Date getDialogDate() {
|
||||
return dialogTime;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -557,14 +622,9 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
@Override
|
||||
protected void processAtStartup(ObReport report) {
|
||||
obData.addReport(report);
|
||||
List<String> zones = fogConfig.getAreaByStationId(report
|
||||
.getPlatformId());
|
||||
if (!zones.isEmpty() || zones != null) {
|
||||
for (String zn : zones) {
|
||||
getTableData().getArea(zn).addReport(
|
||||
report.getObservationTime(), report);
|
||||
}
|
||||
}
|
||||
String zone = findZone(report.getPlatformId());
|
||||
getTableData().getArea(zone).addReport(report.getObservationTime(),
|
||||
report);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -577,11 +637,20 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets Fog Area configuration dialog
|
||||
* Reads Table Configuration.
|
||||
*
|
||||
* Method that reads the table configuration and updates the zone monitor
|
||||
* threshold map
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public MonitoringAreaConfigDlg getAreaDialog() {
|
||||
return areaDialog;
|
||||
private void updateMonitoringArea() {
|
||||
Map<String, List<String>> zones = new HashMap<String, List<String>>();
|
||||
// create zones and station list
|
||||
for (String zone : fogConfig.getAreaList()) {
|
||||
List<String> stations = fogConfig.getAreaStations(zone);
|
||||
zones.put(zone, stations);
|
||||
}
|
||||
MonitoringArea.setPlatformMap(zones);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
22
cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/threshold/FogThresholdMgr.java
Normal file → Executable file
22
cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/threshold/FogThresholdMgr.java
Normal file → Executable file
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.monitor.fog.threshold;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
||||
|
@ -41,7 +42,6 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
|
|||
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
|
||||
* May 20, 2014 3086 skorolev Cleaned code.
|
||||
* Sep 04, 2014 3220 skorolev Removed "site".
|
||||
* Oct 16, 2014 3220 skorolev Corrected areaConfigMgr assignment.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -61,7 +61,8 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
|
|||
super("DefaultFogDisplayThresholds.xml",
|
||||
"DefaultFogMonitorThresholds.xml", AppName.FOG.name()
|
||||
.toLowerCase());
|
||||
areaConfigMgr = FSSObsMonitorConfigurationManager.getFogObsManager();
|
||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(
|
||||
MonName.fog.name());
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -74,6 +75,7 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
|
|||
if (classInstance == null) {
|
||||
classInstance = new FogThresholdMgr();
|
||||
}
|
||||
|
||||
return classInstance;
|
||||
}
|
||||
|
||||
|
@ -116,4 +118,20 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
|
|||
}
|
||||
return threshKeys;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
|
||||
* getMonitorAreaConfigInstance()
|
||||
*/
|
||||
@Override
|
||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||
if (areaConfigMgr == null) {
|
||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(
|
||||
MonName.fog.name());
|
||||
}
|
||||
return areaConfigMgr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.monitor.fog.FogMonitor;
|
||||
import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* The Fog Monitor Action
|
||||
|
@ -42,7 +42,6 @@ import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
|
|||
* May 08, 2014 3086 skorolev Added CloseCallback to dialog.
|
||||
* Sep 16, 2014 2757 skorolev Added test of dialog on dispose.
|
||||
* Sep 19, 2014 3220 skorolev Added check on dispose.
|
||||
* Jan 08, 2015 3220 skorolev Used area type for launchDialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -66,13 +65,19 @@ public class FogAreaConfigAction extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
FogMonitor fog = FogMonitor.getInstance();
|
||||
|
||||
if (fog.getAreaDialog() == null || fog.getAreaDialog().isDisposed()) {
|
||||
if (areaDialog == null || areaDialog.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
fog.launchDialog("area", shell);
|
||||
areaDialog = new FogMonitoringAreaConfigDlg(shell,
|
||||
"Fog Monitor Area Configuration");
|
||||
areaDialog.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
areaDialog = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
areaDialog.open();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- -------------
|
||||
* May 21, 2014 3086 skorolev Cleaned code.
|
||||
* Oct 16, 2014 3220 skorolev Added condition to avoid NPE.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -179,23 +178,22 @@ public class FogMonitorMeteoTab extends TabItemComp implements
|
|||
ThresholdsXML threshXML = ftm.getThresholdsXmlData(duKey);
|
||||
|
||||
List<AreaXML> areasArray = threshXML.getAreas();
|
||||
if (areasArray != null) {
|
||||
for (AreaXML area : areasArray) {
|
||||
String areaID = area.getAreaId();
|
||||
FogMonitorMeteoData fmmd = new FogMonitorMeteoData();
|
||||
fmmd.setAreaID(areaID);
|
||||
|
||||
/*
|
||||
* Visibility
|
||||
*/
|
||||
String xmlKey = FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey();
|
||||
fmmd.setMeteoVisR(ftm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
fmmd.setMeteoVisY(ftm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
for (AreaXML area : areasArray) {
|
||||
String areaID = area.getAreaId();
|
||||
FogMonitorMeteoData fmmd = new FogMonitorMeteoData();
|
||||
fmmd.setAreaID(areaID);
|
||||
|
||||
fogDataArray.add(fmmd);
|
||||
}
|
||||
/*
|
||||
* Visibility
|
||||
*/
|
||||
String xmlKey = FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey();
|
||||
fmmd.setMeteoVisR(ftm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
fmmd.setMeteoVisY(ftm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
fogDataArray.add(fmmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
32
cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogMonitoringAreaConfigDlg.java
Normal file → Executable file
32
cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogMonitoringAreaConfigDlg.java
Normal file → Executable file
|
@ -24,6 +24,7 @@ import org.eclipse.swt.widgets.Display;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
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.DataUsageKey;
|
||||
|
@ -48,11 +49,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Apr 28, 2014 3086 skorolev Updated getConfigManager.
|
||||
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
|
||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
|
||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||
* Nov 21, 2014 3841 skorolev Corrected handleOkBtnSelection.
|
||||
* Dec 11, 2014 3220 skorolev Removed unnecessary code.
|
||||
* Feb 03, 2015 3841 skorolev Replaced resetParams with resetStatus.
|
||||
* Feb 10, 2015 3886 skorolev Changed confirmation message.
|
||||
*
|
||||
* </pre>
|
||||
|
@ -73,6 +70,7 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
*/
|
||||
public FogMonitoringAreaConfigDlg(Shell parent, String title) {
|
||||
super(parent, title, AppName.FOG);
|
||||
FogMonitor.getInstance();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -88,8 +86,13 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
"Confirm Cofiguration Changes", "Save changes?");
|
||||
if (choice == SWT.YES) {
|
||||
// Save the config xml file.
|
||||
saveConfigs();
|
||||
resetAndSave();
|
||||
/**
|
||||
* DR#11279: re-initialize threshold manager and the monitor
|
||||
* using new monitor area configuration
|
||||
*/
|
||||
FogThresholdMgr.reInitialize();
|
||||
fireConfigUpdateEvent();
|
||||
// Open Threshold Dialog if zones/stations are added.
|
||||
if ((!configMgr.getAddedZones().isEmpty())
|
||||
|| (!configMgr.getAddedStations().isEmpty())) {
|
||||
|
@ -99,19 +102,19 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
fogMonitorDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
// Clean added zones and stations. Close dialog.
|
||||
configMgr.getAddedZones().clear();
|
||||
configMgr.getAddedStations().clear();
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
});
|
||||
fogMonitorDlg.open();
|
||||
}
|
||||
// Clean added zones and stations.
|
||||
configMgr.getAddedZones().clear();
|
||||
configMgr.getAddedStations().clear();
|
||||
}
|
||||
/**
|
||||
* DR#11279: re-initialize threshold manager and the monitor
|
||||
* using new monitor area configuration
|
||||
*/
|
||||
fireConfigUpdateEvent();
|
||||
resetStatus();
|
||||
} else { // Return back to continue edit.
|
||||
return;
|
||||
}
|
||||
|
@ -128,6 +131,7 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
private void fireConfigUpdateEvent() {
|
||||
final IMonitorConfigurationEvent me = new IMonitorConfigurationEvent(
|
||||
configMgr);
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -145,7 +149,11 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
*/
|
||||
@Override
|
||||
protected FSSObsMonitorConfigurationManager getInstance() {
|
||||
return FSSObsMonitorConfigurationManager.getFogObsManager();
|
||||
if (configMgr == null) {
|
||||
configMgr = new FSSObsMonitorConfigurationManager(
|
||||
MonName.fog.name());
|
||||
}
|
||||
return configMgr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
55
cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogZoneTableDlg.java
Normal file → Executable file
55
cave/com.raytheon.uf.viz.monitor.fog/src/com/raytheon/uf/viz/monitor/fog/ui/dialogs/FogZoneTableDlg.java
Normal file → Executable file
|
@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.Display;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName;
|
||||
|
@ -58,9 +59,8 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
|
|||
* Dec 03, 2012 15216/15639 zhao fixed a bug related to Link-to-Frame
|
||||
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs.
|
||||
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
|
||||
* Jan 27, 2015 3220 skorolev Removed "site".Added check on dispose.Corrected configMgr assignment.
|
||||
* Added table cache update.
|
||||
* Feb 04, 2015 3841 skorolev Corrected notify method for empty table update.
|
||||
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ?
|
||||
|
@ -79,10 +79,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
|
|||
*/
|
||||
public FogZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
|
||||
super(parent, obData, CommonConfig.AppName.FOG);
|
||||
configMgr = FSSObsMonitorConfigurationManager.getFogObsManager();
|
||||
obData.updateTableCache();
|
||||
zoneTblData = obData.getZoneTableData();
|
||||
zoneTblData.sortData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,11 +145,12 @@ public class FogZoneTableDlg extends ZoneTableDlg {
|
|||
// The algorithm output.
|
||||
|
||||
if (me.getSource() instanceof FogMonitor) {
|
||||
|
||||
FogMonitor fog = (FogMonitor) me.getSource();
|
||||
ObMultiHrsReports obData = fog.getObData();
|
||||
Date date = fog.getDialogTime();
|
||||
Date date = fog.getDialogDate();
|
||||
if (date != null) {
|
||||
Date nominalTime = date;
|
||||
ObMultiHrsReports obData = fog.getObData();
|
||||
if (!isLinkedToFrame()) {
|
||||
nominalTime = obData.getLatestNominalTime();
|
||||
}
|
||||
|
@ -162,12 +159,33 @@ public class FogZoneTableDlg extends ZoneTableDlg {
|
|||
.getAlgorithmData(nominalTime));
|
||||
obData.setFogAlgCellType(fogAlgCellType);
|
||||
this.updateTableDlg(obData.getObHourReports(nominalTime));
|
||||
} else {
|
||||
this.updateZoneTable(obData.getLatestNominalTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Jan 25, 2010, #4281, zhao, Modified to pass an ObMultiHrsReports object
|
||||
* to table dialog
|
||||
*
|
||||
* @Override public void notify(IMonitorEvent me) { if
|
||||
* (zoneTable.isDisposed()) return;
|
||||
*
|
||||
* if (me.getSource() instanceof FogMonitor) { FogMonitor monitor
|
||||
* = (FogMonitor)me.getSource();
|
||||
* this.updateTableDlg(monitor.getObData()); }
|
||||
*
|
||||
* //if (me.getSource() instanceof FogMonitor) { //
|
||||
* IMPORTANT!!!!!! For now we just grab the most recent time from
|
||||
* the OBSTable // When we have the CAVE rendering working we will
|
||||
* grab it from the CaveResource! // Date date = new Date(); //
|
||||
* FogMonitor fog = (FogMonitor)me.getSource(); //
|
||||
* FogDataGenerator fdg = new FogDataGenerator(); // TableData
|
||||
* tZoneTableData = fdg.generateZoneData(fog.getTableData(),
|
||||
* fog.getAlgorithmData(), date); //
|
||||
* updateZoneTable(tZoneTableData, fog.getStationTableData(),
|
||||
* date); //} }
|
||||
*/
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -276,4 +294,19 @@ public class FogZoneTableDlg extends ZoneTableDlg {
|
|||
protected void shellDisposeAction() {
|
||||
// Not used
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#
|
||||
* getMonitorAreaConfigInstance()
|
||||
*/
|
||||
@Override
|
||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||
if (configMgr == null || configMgr.isPopulated()) {
|
||||
configMgr = new FSSObsMonitorConfigurationManager(
|
||||
MonName.fog.name());
|
||||
}
|
||||
return configMgr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
|
|||
import com.raytheon.uf.common.geospatial.SpatialException;
|
||||
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -48,6 +49,7 @@ import com.raytheon.uf.viz.monitor.IMonitor;
|
|||
import com.raytheon.uf.viz.monitor.Monitor;
|
||||
import com.raytheon.uf.viz.monitor.ObsMonitor;
|
||||
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
|
||||
import com.raytheon.uf.viz.monitor.data.MonitoringArea;
|
||||
import com.raytheon.uf.viz.monitor.data.ObMultiHrsReports;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.uf.viz.monitor.data.TableCellData;
|
||||
|
@ -59,6 +61,8 @@ import com.raytheon.uf.viz.monitor.safeseas.listeners.ISSResourceListener;
|
|||
import com.raytheon.uf.viz.monitor.safeseas.threshold.SSThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg;
|
||||
import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSZoneTableDlg;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorThresholdConfiguration;
|
||||
import com.raytheon.viz.alerts.observers.ProductAlertObserver;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
|
@ -81,9 +85,8 @@ import com.vividsolutions.jts.geom.Geometry;
|
|||
* Oct 26, 2012 1280 skorolev Clean code and made changes for non-blocking dialog
|
||||
* Oct 30, 2012 1297 skorolev Changed HashMap to Map
|
||||
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
|
||||
* Jan 27, 2015 3220 skorolev Removed local getMonitorAreaConfig method.Updated configUpdate method and added updateMonitoringArea.
|
||||
* Corrected ssAreaConfig assignment. Moved refreshing of table in the UI thread.
|
||||
* Replaced MonitoringArea with ssAreaConfig.Updated code for better performance.
|
||||
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
|
||||
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -107,7 +110,13 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
private SSMonitoringAreaConfigDlg areaDialog = null;
|
||||
|
||||
/** configuration manager **/
|
||||
private static FSSObsMonitorConfigurationManager ssAreaConfig = null;
|
||||
private FSSObsMonitorConfigurationManager ssAreaConfig = null;
|
||||
|
||||
/**
|
||||
* This object contains all observation data necessary for the table dialogs
|
||||
* and trending plots
|
||||
*/
|
||||
private ObMultiHrsReports obData;
|
||||
|
||||
/** table data for the zone table **/
|
||||
private final TableData zoneTableData = new TableData(
|
||||
|
@ -126,6 +135,9 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
/** List of SAFESEAS resource listeners **/
|
||||
private final List<ISSResourceListener> safeSeasResources = new ArrayList<ISSResourceListener>();
|
||||
|
||||
/** Time which Zone/County dialog shows. **/
|
||||
private Date dialogTime = null;
|
||||
|
||||
/** list of coordinates for each zone **/
|
||||
private Map<String, Geometry> zoneGeometries = null;
|
||||
|
||||
|
@ -149,10 +161,14 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
*/
|
||||
private SafeSeasMonitor() {
|
||||
pluginPatterns.add(ssPattern);
|
||||
ssAreaConfig = FSSObsMonitorConfigurationManager.getSsObsManager();
|
||||
ssAreaConfig = new FSSObsMonitorConfigurationManager(MonName.ss.name());
|
||||
updateMonitoringArea();
|
||||
initObserver(OBS, this);
|
||||
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS);
|
||||
obData.setThresholdMgr(SSThresholdMgr.getInstance());
|
||||
obData.getZoneTableData();
|
||||
readTableConfig(MonitorThresholdConfiguration.SAFESEAS_THRESHOLD_CONFIG);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -161,9 +177,11 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
public static synchronized SafeSeasMonitor getInstance() {
|
||||
if (monitor == null) {
|
||||
monitor = new SafeSeasMonitor();
|
||||
// Pre-populate dialog with an observation (METAR) for KOMA
|
||||
monitor.createDataStructures();
|
||||
monitor.getAdjAreas();
|
||||
monitor.processProductAtStartup(ssAreaConfig);
|
||||
monitor.processProductAtStartup("ss");
|
||||
monitor.fireMonitorEvent(monitor);
|
||||
}
|
||||
return monitor;
|
||||
}
|
||||
|
@ -198,21 +216,26 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
*/
|
||||
public void launchDialog(String type, Shell shell) {
|
||||
if (type.equals("zone")) {
|
||||
zoneDialog = new SSZoneTableDlg(shell, obData);
|
||||
addMonitorListener(zoneDialog);
|
||||
zoneDialog.addMonitorControlListener(this);
|
||||
if (zoneDialog == null) {
|
||||
zoneDialog = new SSZoneTableDlg(shell, obData);
|
||||
addMonitorListener(zoneDialog);
|
||||
zoneDialog.addMonitorControlListener(this);
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
}
|
||||
zoneDialog.open();
|
||||
} else if (type.equals("area")) {
|
||||
areaDialog = new SSMonitoringAreaConfigDlg(shell,
|
||||
"SAFESEAS Monitor Area Configuration");
|
||||
areaDialog.setCloseCallback(new ICloseCallback() {
|
||||
if (areaDialog == null) {
|
||||
areaDialog = new SSMonitoringAreaConfigDlg(shell,
|
||||
"Safe Seas Monitor Area Configuration");
|
||||
areaDialog.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
areaDialog = null;
|
||||
}
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
areaDialog = null;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
areaDialog.open();
|
||||
}
|
||||
}
|
||||
|
@ -251,7 +274,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
@Override
|
||||
public void processProductMessage(final AlertMessage filtered) {
|
||||
if (ssPattern.matcher(filtered.dataURI).matches()) {
|
||||
processURI(filtered.dataURI, filtered, ssAreaConfig);
|
||||
processURI(filtered.dataURI, filtered);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,6 +297,31 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
stationTableData.addReplaceDataRow(stationRowData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads Table Configuration.
|
||||
*
|
||||
* Method that reads the table configuration and updates the zone monitor
|
||||
* threshold map
|
||||
*
|
||||
* @param file
|
||||
* -- the xml configuration filename
|
||||
*/
|
||||
public void readTableConfig(String file) {
|
||||
Map<String, List<String>> zones = new HashMap<String, List<String>>();
|
||||
// create zones and station list
|
||||
try {
|
||||
for (String zone : ssAreaConfig.getAreaList()) {
|
||||
List<String> stations = ssAreaConfig.getAreaStations(zone);
|
||||
zones.put(zone, stations);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.CRITICAL,
|
||||
"SafeSeas failed to load configuration..."
|
||||
+ this.getClass().getName(), e);
|
||||
}
|
||||
MonitoringArea.setPlatformMap(zones);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -307,9 +355,9 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
@Override
|
||||
public void configUpdate(IMonitorConfigurationEvent me) {
|
||||
ssAreaConfig = (FSSObsMonitorConfigurationManager) me.getSource();
|
||||
obData.getObHourReports().updateZones(ssAreaConfig);
|
||||
updateMonitoringArea();
|
||||
if (zoneDialog != null && !zoneDialog.isDisposed()) {
|
||||
obData.updateTableCache();
|
||||
zoneDialog.refreshZoneTableData(obData);
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
@ -365,8 +413,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
@Override
|
||||
protected void process(ObReport result) throws Exception {
|
||||
obData.addReport(result);
|
||||
// update table cache
|
||||
obData.getZoneTableData(result.getRefHour());
|
||||
fireMonitorEvent(this);
|
||||
}
|
||||
|
||||
|
@ -375,18 +421,30 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
*
|
||||
* @param dialogTime
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ObsMonitor#updateDialogTime(java.util.Date)
|
||||
*/
|
||||
@Override
|
||||
public void updateDialogTime(Date dialogTime) {
|
||||
this.dialogTime = dialogTime;
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Dialog Time.
|
||||
*
|
||||
* @return dialogTime
|
||||
*/
|
||||
public Date getDialogTime() {
|
||||
return dialogTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dialogTime
|
||||
*
|
||||
* @param dialogTime
|
||||
*/
|
||||
public void setDialogTime(Date dialogTime) {
|
||||
this.dialogTime = dialogTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds recourse listener
|
||||
*
|
||||
|
@ -432,6 +490,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
*/
|
||||
@Override
|
||||
public ArrayList<Date> getTimeOrderedKeys(IMonitor monitor, String type) {
|
||||
// Not used
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -485,7 +544,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
algData = algorithmData.get(time);
|
||||
} else {
|
||||
// by default is nothing in the Fog column
|
||||
for (String zone : ssAreaConfig.getAreaList()) {
|
||||
for (String zone : MonitoringArea.getPlatformMap().keySet()) {
|
||||
algData.put(zone, FOG_THREAT.GRAY);
|
||||
}
|
||||
}
|
||||
|
@ -526,6 +585,15 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets zone dialog
|
||||
*
|
||||
* @return zoneDialog
|
||||
*/
|
||||
public ZoneTableDlg getDialog() {
|
||||
return zoneDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets adjacent areas
|
||||
*/
|
||||
|
@ -602,11 +670,20 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets SAFESEAS Area configuration dialog
|
||||
* Reads Table Configuration.
|
||||
*
|
||||
* Method that reads the table configuration and updates the zone monitor
|
||||
* threshold map
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SSMonitoringAreaConfigDlg getAreaDialog() {
|
||||
return areaDialog;
|
||||
public void updateMonitoringArea() {
|
||||
Map<String, List<String>> zones = new HashMap<String, List<String>>();
|
||||
// create zones and station list
|
||||
for (String zone : ssAreaConfig.getAreaList()) {
|
||||
List<String> stations = ssAreaConfig.getAreaStations(zone);
|
||||
zones.put(zone, stations);
|
||||
}
|
||||
MonitoringArea.setPlatformMap(zones);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 21, 2010 4891 skorolev Initial Creation.
|
||||
* Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references
|
||||
* Feb 24, 2015 3220 dhladky removed misnamed un-needed method.
|
||||
* </pre>
|
||||
*
|
||||
* @author skorolev
|
||||
|
|
19
cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/threshold/SSThresholdMgr.java
Normal file → Executable file
19
cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/threshold/SSThresholdMgr.java
Normal file → Executable file
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.monitor.safeseas.threshold;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
||||
|
@ -41,7 +42,6 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
|
|||
* Feb 03, 2014 #2757 skorolev Fixed reInitialize().
|
||||
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
|
||||
* Sep 04, 2014 3220 skorolev Removed "site".
|
||||
* Oct 16, 2014 3220 skorolev Corrected areaConfigMgr assignment.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -59,7 +59,7 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
|
|||
super("DefaultSSDisplayThresholds.xml",
|
||||
"DefaultSSMonitorThresholds.xml", AppName.SAFESEAS.name()
|
||||
.toLowerCase());
|
||||
areaConfigMgr = FSSObsMonitorConfigurationManager.getSsObsManager();
|
||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name());
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -113,4 +113,19 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
|
|||
}
|
||||
return threshKeys;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
|
||||
* getMonitorAreaConfigInstance()
|
||||
*/
|
||||
@Override
|
||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||
if (areaConfigMgr == null) {
|
||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(
|
||||
MonName.ss.name());
|
||||
}
|
||||
return areaConfigMgr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor;
|
||||
import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* The SAFESEAS Action
|
||||
|
@ -41,7 +42,6 @@ import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor;
|
|||
* May 08, 2014 3086 skorolev Added CloseCallback to dialog.
|
||||
* Sep 16, 2014 2757 skorolev Added test of dialog on dispose.
|
||||
* Sep 19, 2014 3220 skorolev Added check on dispose.
|
||||
* Jan 08, 2015 3220 skorolev Used area type for launchDialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -51,6 +51,11 @@ import com.raytheon.uf.viz.monitor.safeseas.SafeSeasMonitor;
|
|||
|
||||
public class SafeseasAreaConfigAction extends AbstractHandler {
|
||||
|
||||
/**
|
||||
* SAFESEAS Monitoring Area Configuration Dialog.
|
||||
*/
|
||||
private SSMonitoringAreaConfigDlg configDlg;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -60,14 +65,19 @@ public class SafeseasAreaConfigAction extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
SafeSeasMonitor monitor = SafeSeasMonitor.getInstance();
|
||||
if (monitor.getAreaDialog() == null
|
||||
|| monitor.getAreaDialog().isDisposed()) {
|
||||
if (configDlg == null || configDlg.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
monitor.launchDialog("area", shell);
|
||||
configDlg = new SSMonitoringAreaConfigDlg(shell,
|
||||
"SAFESEAS Monitor Area Configuration");
|
||||
configDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
configDlg = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
configDlg.open();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,309 +41,305 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
|||
* SAFESEAS Monitor Meteo Table.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 17, 2014 2757 skorolev Removed unnecessary printouts.
|
||||
* Oct 16, 2014 3220 skorolev Added condition to avoid NPE.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author skorolev
|
||||
* @version 1.0
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SSMonitorMeteoTab extends TabItemComp implements
|
||||
IUpdateMonitorMeteo {
|
||||
public class SSMonitorMeteoTab extends TabItemComp implements IUpdateMonitorMeteo
|
||||
{
|
||||
private SSMonitorMeteoEditDlg monitorMeteoEditDlg;
|
||||
|
||||
|
||||
private ArrayList<String> areaIDArray;
|
||||
|
||||
|
||||
private ArrayList<SSMonitorMeteoData> ssDataArray;
|
||||
|
||||
public SSMonitorMeteoTab(TabFolder parent, DataUsageKey duKey) {
|
||||
|
||||
public SSMonitorMeteoTab(TabFolder parent, DataUsageKey duKey)
|
||||
{
|
||||
super(parent, duKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createListHeader(Composite parentComp) {
|
||||
@Override
|
||||
protected void createListHeader(Composite parentComp)
|
||||
{
|
||||
Composite lblComp = new Composite(parentComp, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(5, false);
|
||||
gl.horizontalSpacing = 0;
|
||||
gl.horizontalSpacing = 0;
|
||||
gl.marginHeight = 0;
|
||||
gl.marginWidth = 0;
|
||||
lblComp.setLayout(gl);
|
||||
|
||||
|
||||
/*
|
||||
* Create filler label.
|
||||
*/
|
||||
GridData gd = new GridData(75, SWT.DEFAULT);
|
||||
Label fillerLbl = new Label(lblComp, SWT.CENTER);
|
||||
fillerLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
/*
|
||||
* Meteo
|
||||
*/
|
||||
Composite meteoComp = createGroupComposite(lblComp, 5, null);
|
||||
createLabelComp(meteoComp, "Wind", "Speed(kt)", false);
|
||||
createLabelComp(meteoComp, "Peak", "Wind(kt)", false);
|
||||
Composite meteoComp = createGroupComposite(lblComp, 5, null);
|
||||
createLabelComp(meteoComp, "Wind", "Speed(kt)", false);
|
||||
createLabelComp(meteoComp, "Peak", "Wind(kt)", false);
|
||||
createLabelComp(meteoComp, "Gust", "Speed(kt)", false);
|
||||
createLabelComp(meteoComp, "Wave", "Height(ft)", false);
|
||||
createLabelComp(meteoComp, "Vis(mi)", "", true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populateList() {
|
||||
if (ssDataArray == null) {
|
||||
protected void populateList()
|
||||
{
|
||||
if (ssDataArray == null)
|
||||
{
|
||||
createDataArray();
|
||||
}
|
||||
|
||||
|
||||
boolean update = false;
|
||||
if (dataList.getItemCount() > 0) {
|
||||
if (dataList.getItemCount() > 0)
|
||||
{
|
||||
update = true;
|
||||
}
|
||||
|
||||
|
||||
RangesUtil rangeUtil = RangesUtil.getInstance();
|
||||
|
||||
|
||||
areaIDArray = new ArrayList<String>();
|
||||
|
||||
|
||||
String tmpVisStr;
|
||||
String currentAreaID;
|
||||
|
||||
|
||||
double visVal = 0.0;
|
||||
|
||||
StringBuilder sb = null;
|
||||
|
||||
StringBuilder sb = null;
|
||||
SSMonitorMeteoData ssmmd = null;
|
||||
|
||||
for (int i = 0; i < ssDataArray.size(); i++) {
|
||||
|
||||
for (int i = 0; i < ssDataArray.size(); i++)
|
||||
{
|
||||
sb = new StringBuilder();
|
||||
|
||||
|
||||
ssmmd = ssDataArray.get(i);
|
||||
|
||||
|
||||
currentAreaID = ssmmd.getAreaID();
|
||||
areaIDArray.add(currentAreaID);
|
||||
|
||||
|
||||
sb.append(String.format(areaIdFmt, currentAreaID));
|
||||
|
||||
|
||||
/*
|
||||
* Wind Speed
|
||||
*/
|
||||
appendIntData(sb, ssmmd.getWindSpeedR(), ssmmd.getWindSpeedY());
|
||||
|
||||
|
||||
/*
|
||||
* Peak Wind
|
||||
*/
|
||||
appendIntData(sb, ssmmd.getPeakWindR(), ssmmd.getPeakWindY());
|
||||
|
||||
|
||||
/*
|
||||
* Gust Wind
|
||||
*/
|
||||
appendIntData(sb, ssmmd.getGustSpeedR(), ssmmd.getGustSpeedY());
|
||||
|
||||
|
||||
/*
|
||||
* Wave Height
|
||||
*/
|
||||
appendIntData(sb, ssmmd.getWaveHgtR(), ssmmd.getWaveHgtY());
|
||||
|
||||
|
||||
/*
|
||||
* Visibility
|
||||
*/
|
||||
visVal = ssmmd.getVisR();
|
||||
tmpVisStr = rangeUtil.getVisString((int) visVal);
|
||||
*/
|
||||
visVal = ssmmd.getVisR();
|
||||
tmpVisStr = rangeUtil.getVisString((int)visVal);
|
||||
sb.append(String.format(dataFmt, tmpVisStr));
|
||||
|
||||
visVal = ssmmd.getVisY();
|
||||
tmpVisStr = rangeUtil.getVisString((int) visVal);
|
||||
sb.append(String.format(dataFmt, tmpVisStr));
|
||||
|
||||
|
||||
visVal = ssmmd.getVisY();
|
||||
tmpVisStr = rangeUtil.getVisString((int)visVal);
|
||||
sb.append(String.format(dataFmt, tmpVisStr));
|
||||
|
||||
/*
|
||||
* Append a space and add the data line to the list.
|
||||
*/
|
||||
sb.append(" ");
|
||||
|
||||
if (update == true) {
|
||||
|
||||
if (update == true)
|
||||
{
|
||||
dataList.setItem(i, sb.toString());
|
||||
} else {
|
||||
dataList.add(sb.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
dataList.add(sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
packListControls();
|
||||
}
|
||||
|
||||
private void createDataArray() {
|
||||
|
||||
private void createDataArray()
|
||||
{
|
||||
ssDataArray = new ArrayList<SSMonitorMeteoData>();
|
||||
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
String xmlKey;
|
||||
String areaID;
|
||||
|
||||
String areaID;
|
||||
|
||||
ThresholdsXML threshXML = sstm.getThresholdsXmlData(duKey);
|
||||
|
||||
|
||||
ArrayList<AreaXML> areasArray = threshXML.getAreas();
|
||||
|
||||
if (areasArray != null) {
|
||||
for (AreaXML area : areasArray) {
|
||||
areaID = area.getAreaId();
|
||||
SSMonitorMeteoData ssmmd = new SSMonitorMeteoData();
|
||||
|
||||
ssmmd.setAreaID(areaID);
|
||||
|
||||
/*
|
||||
* Wind Speed
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey();
|
||||
ssmmd.setWindSpeedR(sstm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
ssmmd.setWindSpeedY(sstm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Peak Wind
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey();
|
||||
ssmmd.setPeakWindR(sstm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
ssmmd.setPeakWindY(sstm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Gust Speed
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey();
|
||||
ssmmd.setGustSpeedR(sstm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
ssmmd.setGustSpeedY(sstm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Wave Height
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey();
|
||||
ssmmd.setWaveHgtR(sstm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
ssmmd.setWaveHgtY(sstm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Visibility
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey();
|
||||
ssmmd.setVisR(sstm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
ssmmd.setVisY(sstm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
/*
|
||||
* Add data to array.
|
||||
*/
|
||||
ssDataArray.add(ssmmd);
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private SSMonitorMeteoData getDataAtFirstSelection() {
|
||||
int index = dataList.getSelectionIndex();
|
||||
|
||||
return ssDataArray.get(index);
|
||||
}
|
||||
|
||||
private void updateDataArray(SSMonitorMeteoData ssmmd) {
|
||||
int[] dataListIndexes = dataList.getSelectionIndices();
|
||||
int currentIndex = 0;
|
||||
|
||||
for (int i = 0; i < dataListIndexes.length; i++) {
|
||||
currentIndex = dataListIndexes[i];
|
||||
|
||||
ssDataArray.get(currentIndex).updateData(ssmmd);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commitDataToXML() {
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
String xmlKey;
|
||||
String areaID;
|
||||
|
||||
for (SSMonitorMeteoData ssmmd : ssDataArray) {
|
||||
areaID = ssmmd.getAreaID();
|
||||
|
||||
|
||||
for (AreaXML area : areasArray)
|
||||
{
|
||||
areaID = area.getAreaId();
|
||||
SSMonitorMeteoData ssmmd = new SSMonitorMeteoData();
|
||||
|
||||
ssmmd.setAreaID(areaID);
|
||||
|
||||
/*
|
||||
* Wind Speed
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
ssmmd.getWindSpeedR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
ssmmd.getWindSpeedY());
|
||||
|
||||
ssmmd.setWindSpeedR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
ssmmd.setWindSpeedY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Peak Wind
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
ssmmd.getPeakWindR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
ssmmd.getPeakWindY());
|
||||
|
||||
ssmmd.setPeakWindR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
ssmmd.setPeakWindY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Gust Speed
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
ssmmd.getGustSpeedR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
ssmmd.getGustSpeedY());
|
||||
|
||||
ssmmd.setGustSpeedR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
ssmmd.setGustSpeedY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Wave Height
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
ssmmd.getWaveHgtR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
ssmmd.getWaveHgtY());
|
||||
ssmmd.setWaveHgtR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
ssmmd.setWaveHgtY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Visibility
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
ssmmd.getVisR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
ssmmd.getVisY());
|
||||
ssmmd.setVisR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
ssmmd.setVisY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Add data to array.
|
||||
*/
|
||||
ssDataArray.add(ssmmd);
|
||||
}
|
||||
}
|
||||
|
||||
private SSMonitorMeteoData getDataAtFirstSelection()
|
||||
{
|
||||
int index = dataList.getSelectionIndex();
|
||||
|
||||
return ssDataArray.get(index);
|
||||
}
|
||||
|
||||
private void updateDataArray(SSMonitorMeteoData ssmmd)
|
||||
{
|
||||
int[] dataListIndexes = dataList.getSelectionIndices();
|
||||
int currentIndex = 0;
|
||||
|
||||
for (int i = 0; i < dataListIndexes.length; i++)
|
||||
{
|
||||
currentIndex = dataListIndexes[i];
|
||||
|
||||
ssDataArray.get(currentIndex).updateData(ssmmd);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commitDataToXML()
|
||||
{
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
String xmlKey;
|
||||
String areaID;
|
||||
|
||||
for (SSMonitorMeteoData ssmmd : ssDataArray)
|
||||
{
|
||||
areaID = ssmmd.getAreaID();
|
||||
|
||||
/*
|
||||
* Wind Speed
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssmmd.getWindSpeedR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssmmd.getWindSpeedY());
|
||||
|
||||
/*
|
||||
* Peak Wind
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssmmd.getPeakWindR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssmmd.getPeakWindY());
|
||||
|
||||
/*
|
||||
* Gust Speed
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssmmd.getGustSpeedR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssmmd.getGustSpeedY());
|
||||
|
||||
/*
|
||||
* Wave Height
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssmmd.getWaveHgtR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssmmd.getWaveHgtY());
|
||||
|
||||
/*
|
||||
* Visibility
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, ssmmd.getVisR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, ssmmd.getVisY());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadData() {
|
||||
public void reloadData()
|
||||
{
|
||||
dataList.removeAll();
|
||||
ssDataArray.clear();
|
||||
ssDataArray = null;
|
||||
|
||||
populateList();
|
||||
|
||||
populateList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void editDataAction() {
|
||||
protected void editDataAction()
|
||||
{
|
||||
SSMonitorMeteoData ssmmd = getDataAtFirstSelection();
|
||||
|
||||
if (monitorMeteoEditDlg == null) {
|
||||
monitorMeteoEditDlg = new SSMonitorMeteoEditDlg(getParent()
|
||||
.getShell(), ssmmd, this);
|
||||
|
||||
if (monitorMeteoEditDlg == null)
|
||||
{
|
||||
monitorMeteoEditDlg = new SSMonitorMeteoEditDlg(getParent().getShell(), ssmmd, this);
|
||||
monitorMeteoEditDlg.open();
|
||||
monitorMeteoEditDlg = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateThresholdData(SSMonitorMeteoData ssmmd) {
|
||||
public void updateThresholdData(SSMonitorMeteoData ssmmd)
|
||||
{
|
||||
updateDataArray(ssmmd);
|
||||
populateList();
|
||||
populateList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,404 +36,312 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
|
|||
import com.raytheon.uf.viz.monitor.xml.AreaXML;
|
||||
import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
||||
|
||||
/**
|
||||
* SAFESEAS Monitor Swell Table.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 16, 2014 3220 skorolev Added condition to avoid NPE.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SSMonitorSwellTab extends TabItemComp implements
|
||||
IUpdateDisplayMonitorSwell {
|
||||
public class SSMonitorSwellTab extends TabItemComp implements IUpdateDisplayMonitorSwell
|
||||
{
|
||||
private SSDispMonSwellEditDlg monitorSwellEditDlg;
|
||||
|
||||
|
||||
private ArrayList<String> areaIDArray;
|
||||
|
||||
|
||||
private ArrayList<SSDispMonSwellData> ssDataArray;
|
||||
|
||||
public SSMonitorSwellTab(TabFolder parent, DataUsageKey duKey) {
|
||||
|
||||
public SSMonitorSwellTab(TabFolder parent, DataUsageKey duKey)
|
||||
{
|
||||
super(parent, duKey, true);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#createListHeader(org
|
||||
* .eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
protected void createListHeader(Composite parentComp) {
|
||||
@Override
|
||||
protected void createListHeader(Composite parentComp)
|
||||
{
|
||||
Composite lblComp = new Composite(parentComp, SWT.NONE);
|
||||
GridLayout gl = new GridLayout(5, false);
|
||||
gl.horizontalSpacing = 0;
|
||||
gl.horizontalSpacing = 0;
|
||||
gl.marginHeight = 0;
|
||||
gl.marginWidth = 0;
|
||||
lblComp.setLayout(gl);
|
||||
|
||||
|
||||
/*
|
||||
* Create filler label.
|
||||
*/
|
||||
GridData gd = new GridData(75, SWT.DEFAULT);
|
||||
Label fillerLbl = new Label(lblComp, SWT.CENTER);
|
||||
fillerLbl.setLayoutData(gd);
|
||||
|
||||
|
||||
/*
|
||||
* Primary Swell
|
||||
*/
|
||||
Composite priSwellComp = createGroupComposite(lblComp, 4,
|
||||
"Primary Swell");
|
||||
Composite priSwellComp = createGroupComposite(lblComp, 4, "Primary Swell");
|
||||
createLabelComp(priSwellComp, "Height(ft)", "", false);
|
||||
createLabelComp(priSwellComp, "Periods(s)", "", false);
|
||||
createLabelComp(priSwellComp, "Dir(deg)", "(from)", false);
|
||||
createLabelComp(priSwellComp, "Dir(deg)", "(to)", false);
|
||||
|
||||
createLabelComp(priSwellComp, "Dir(deg)", "(to)", false);
|
||||
|
||||
/*
|
||||
* Secondary Swell
|
||||
*/
|
||||
Composite secSwellComp = createGroupComposite(lblComp, 4,
|
||||
"Secondary Swell");
|
||||
Composite secSwellComp = createGroupComposite(lblComp, 4, "Secondary Swell");
|
||||
createLabelComp(secSwellComp, "Height(ft)", "", false);
|
||||
createLabelComp(secSwellComp, "Periods(s)", "", false);
|
||||
createLabelComp(secSwellComp, "Dir(deg)", "(from)", false);
|
||||
createLabelComp(secSwellComp, "Dir(deg)", "(to)", false);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#populateList()
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populateList() {
|
||||
if (ssDataArray == null) {
|
||||
protected void populateList()
|
||||
{
|
||||
if (ssDataArray == null)
|
||||
{
|
||||
createDataArray();
|
||||
}
|
||||
|
||||
|
||||
boolean update = false;
|
||||
if (dataList.getItemCount() > 0) {
|
||||
if (dataList.getItemCount() > 0)
|
||||
{
|
||||
update = true;
|
||||
}
|
||||
|
||||
|
||||
areaIDArray = new ArrayList<String>();
|
||||
|
||||
|
||||
String currentAreaID;
|
||||
|
||||
StringBuilder sb = null;
|
||||
|
||||
StringBuilder sb = null;
|
||||
SSDispMonSwellData sssd = null;
|
||||
|
||||
for (int i = 0; i < ssDataArray.size(); i++) {
|
||||
|
||||
for (int i = 0; i < ssDataArray.size(); i++)
|
||||
{
|
||||
sb = new StringBuilder();
|
||||
|
||||
|
||||
sssd = ssDataArray.get(i);
|
||||
|
||||
|
||||
currentAreaID = sssd.getAreaID();
|
||||
areaIDArray.add(currentAreaID);
|
||||
|
||||
sb.append(String.format(areaIdFmt, currentAreaID));
|
||||
|
||||
|
||||
sb.append(String.format(areaIdFmt, currentAreaID));
|
||||
|
||||
/*
|
||||
* Primary Swell
|
||||
*/
|
||||
appendIntData(sb, sssd.getPriSwellHeightR(),
|
||||
sssd.getPriSwellHeightY());
|
||||
|
||||
double higherThreshold = Math.max(sssd.getPriSwellPeriodR(),
|
||||
sssd.getPriSwellPeriodY());
|
||||
double lowerThreshold = Math.min(sssd.getPriSwellPeriodR(),
|
||||
sssd.getPriSwellPeriodY());
|
||||
if (rankSwellPeriodHigh) {
|
||||
sssd.setRankSwellPeriodHigh(true);
|
||||
sssd.setPriSwellPeriodR(higherThreshold);
|
||||
sssd.setPriSwellPeriodY(lowerThreshold);
|
||||
appendIntData(sb, sssd.getPriSwellHeightR(), sssd.getPriSwellHeightY());
|
||||
|
||||
double higherThreshold = Math.max(sssd.getPriSwellPeriodR(), sssd.getPriSwellPeriodY());
|
||||
double lowerThreshold = Math.min(sssd.getPriSwellPeriodR(), sssd.getPriSwellPeriodY());
|
||||
if ( rankSwellPeriodHigh ) {
|
||||
sssd.setRankSwellPeriodHigh(true);
|
||||
sssd.setPriSwellPeriodR(higherThreshold);
|
||||
sssd.setPriSwellPeriodY(lowerThreshold);
|
||||
} else {
|
||||
sssd.setRankSwellPeriodHigh(false);
|
||||
sssd.setPriSwellPeriodR(lowerThreshold);
|
||||
sssd.setPriSwellPeriodY(higherThreshold);
|
||||
sssd.setRankSwellPeriodHigh(false);
|
||||
sssd.setPriSwellPeriodR(lowerThreshold);
|
||||
sssd.setPriSwellPeriodY(higherThreshold);
|
||||
}
|
||||
appendIntData(sb, sssd.getPriSwellPeriodR(),
|
||||
sssd.getPriSwellPeriodY());
|
||||
|
||||
appendIntData(sb, sssd.getPriSwellDirFromR(),
|
||||
sssd.getPriSwellDirFromY());
|
||||
appendIntData(sb, sssd.getPriSwellDirToR(),
|
||||
sssd.getPriSwellDirToY());
|
||||
|
||||
appendIntData(sb, sssd.getPriSwellPeriodR(), sssd.getPriSwellPeriodY());
|
||||
|
||||
appendIntData(sb, sssd.getPriSwellDirFromR(), sssd.getPriSwellDirFromY());
|
||||
appendIntData(sb, sssd.getPriSwellDirToR(), sssd.getPriSwellDirToY());
|
||||
|
||||
/*
|
||||
* Secondary Swell
|
||||
*/
|
||||
appendIntData(sb, sssd.getSecSwellHeightR(),
|
||||
sssd.getSecSwellHeightY());
|
||||
|
||||
higherThreshold = Math.max(sssd.getSecSwellPeriodR(),
|
||||
sssd.getSecSwellPeriodY());
|
||||
lowerThreshold = Math.min(sssd.getSecSwellPeriodR(),
|
||||
sssd.getSecSwellPeriodY());
|
||||
if (rankSwellPeriodHigh) {
|
||||
// sssd.setRankSwellPeriodHigh(true);
|
||||
sssd.setSecSwellPeriodR(higherThreshold);
|
||||
sssd.setSecSwellPeriodY(lowerThreshold);
|
||||
appendIntData(sb, sssd.getSecSwellHeightR(), sssd.getSecSwellHeightY());
|
||||
|
||||
higherThreshold = Math.max(sssd.getSecSwellPeriodR(), sssd.getSecSwellPeriodY());
|
||||
lowerThreshold = Math.min(sssd.getSecSwellPeriodR(), sssd.getSecSwellPeriodY());
|
||||
if ( rankSwellPeriodHigh ) {
|
||||
//sssd.setRankSwellPeriodHigh(true);
|
||||
sssd.setSecSwellPeriodR(higherThreshold);
|
||||
sssd.setSecSwellPeriodY(lowerThreshold);
|
||||
} else {
|
||||
// sssd.setRankSwellPeriodHigh(false);
|
||||
sssd.setSecSwellPeriodR(lowerThreshold);
|
||||
sssd.setSecSwellPeriodY(higherThreshold);
|
||||
//sssd.setRankSwellPeriodHigh(false);
|
||||
sssd.setSecSwellPeriodR(lowerThreshold);
|
||||
sssd.setSecSwellPeriodY(higherThreshold);
|
||||
}
|
||||
appendIntData(sb, sssd.getSecSwellPeriodR(),
|
||||
sssd.getSecSwellPeriodY());
|
||||
|
||||
appendIntData(sb, sssd.getSecSwellDirFromR(),
|
||||
sssd.getSecSwellDirFromY());
|
||||
appendIntData(sb, sssd.getSecSwellDirToR(),
|
||||
sssd.getSecSwellDirToY());
|
||||
|
||||
appendIntData(sb, sssd.getSecSwellPeriodR(), sssd.getSecSwellPeriodY());
|
||||
|
||||
appendIntData(sb, sssd.getSecSwellDirFromR(), sssd.getSecSwellDirFromY());
|
||||
appendIntData(sb, sssd.getSecSwellDirToR(), sssd.getSecSwellDirToY());
|
||||
|
||||
/*
|
||||
* Append a space and add the data line to the list.
|
||||
*/
|
||||
sb.append(" ");
|
||||
|
||||
if (update == true) {
|
||||
|
||||
if (update == true)
|
||||
{
|
||||
dataList.setItem(i, sb.toString());
|
||||
} else {
|
||||
dataList.add(sb.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
dataList.add(sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
packListControls();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Data Array.
|
||||
*/
|
||||
private void createDataArray() {
|
||||
|
||||
private void createDataArray()
|
||||
{
|
||||
ssDataArray = new ArrayList<SSDispMonSwellData>();
|
||||
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
String xmlKey;
|
||||
String areaID;
|
||||
|
||||
String areaID;
|
||||
|
||||
ThresholdsXML threshXML = sstm.getThresholdsXmlData(duKey);
|
||||
|
||||
|
||||
ArrayList<AreaXML> areasArray = threshXML.getAreas();
|
||||
|
||||
if (areasArray != null) {
|
||||
for (AreaXML area : areasArray) {
|
||||
areaID = area.getAreaId();
|
||||
SSDispMonSwellData sssd = new SSDispMonSwellData();
|
||||
|
||||
sssd.setAreaID(areaID);
|
||||
|
||||
/*
|
||||
* Primary Swell
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey();
|
||||
sssd.setPriSwellHeightR(sstm.getThresholdValue(duKey,
|
||||
threshKeyR, areaID, xmlKey));
|
||||
sssd.setPriSwellHeightY(sstm.getThresholdValue(duKey,
|
||||
threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey();
|
||||
sssd.setPriSwellPeriodR(sstm.getThresholdValue(duKey,
|
||||
threshKeyR, areaID, xmlKey));
|
||||
sssd.setPriSwellPeriodY(sstm.getThresholdValue(duKey,
|
||||
threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey();
|
||||
sssd.setPriSwellDirFromR(sstm.getThresholdValue(duKey,
|
||||
threshKeyR, areaID, xmlKey));
|
||||
sssd.setPriSwellDirFromY(sstm.getThresholdValue(duKey,
|
||||
threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey();
|
||||
sssd.setPriSwellDirToR(sstm.getThresholdValue(duKey,
|
||||
threshKeyR, areaID, xmlKey));
|
||||
sssd.setPriSwellDirToY(sstm.getThresholdValue(duKey,
|
||||
threshKeyY, areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Secondary Swell
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey();
|
||||
sssd.setSecSwellHeightR(sstm.getThresholdValue(duKey,
|
||||
threshKeyR, areaID, xmlKey));
|
||||
sssd.setSecSwellHeightY(sstm.getThresholdValue(duKey,
|
||||
threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey();
|
||||
sssd.setSecSwellPeriodR(sstm.getThresholdValue(duKey,
|
||||
threshKeyR, areaID, xmlKey));
|
||||
sssd.setSecSwellPeriodY(sstm.getThresholdValue(duKey,
|
||||
threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey();
|
||||
sssd.setSecSwellDirFromR(sstm.getThresholdValue(duKey,
|
||||
threshKeyR, areaID, xmlKey));
|
||||
sssd.setSecSwellDirFromY(sstm.getThresholdValue(duKey,
|
||||
threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey();
|
||||
sssd.setSecSwellDirToR(sstm.getThresholdValue(duKey,
|
||||
threshKeyR, areaID, xmlKey));
|
||||
sssd.setSecSwellDirToY(sstm.getThresholdValue(duKey,
|
||||
threshKeyY, areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Add data to array.
|
||||
*/
|
||||
ssDataArray.add(sssd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Data at first selection.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private SSDispMonSwellData getDataAtFirstSelection() {
|
||||
int index = dataList.getSelectionIndex();
|
||||
|
||||
return ssDataArray.get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Data Array.
|
||||
*
|
||||
* @param sssd
|
||||
*/
|
||||
private void updateDataArray(SSDispMonSwellData sssd) {
|
||||
int[] dataListIndexes = dataList.getSelectionIndices();
|
||||
int currentIndex = 0;
|
||||
|
||||
for (int i = 0; i < dataListIndexes.length; i++) {
|
||||
currentIndex = dataListIndexes[i];
|
||||
|
||||
ssDataArray.get(currentIndex).updateData(sssd);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#commitDataToXML()
|
||||
*/
|
||||
@Override
|
||||
public void commitDataToXML() {
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
String xmlKey;
|
||||
String areaID;
|
||||
|
||||
for (SSDispMonSwellData sssd : ssDataArray) {
|
||||
areaID = sssd.getAreaID();
|
||||
|
||||
for (AreaXML area : areasArray)
|
||||
{
|
||||
areaID = area.getAreaId();
|
||||
SSDispMonSwellData sssd = new SSDispMonSwellData();
|
||||
|
||||
sssd.setAreaID(areaID);
|
||||
|
||||
/*
|
||||
* Primary Swell
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
sssd.getPriSwellHeightR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
sssd.getPriSwellHeightY());
|
||||
|
||||
sssd.setPriSwellHeightR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
sssd.setPriSwellHeightY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
sssd.getPriSwellPeriodR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
sssd.getPriSwellPeriodY());
|
||||
|
||||
sssd.setPriSwellPeriodR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
sssd.setPriSwellPeriodY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
sssd.getPriSwellDirFromR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
sssd.getPriSwellDirFromY());
|
||||
|
||||
sssd.setPriSwellDirFromR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
sssd.setPriSwellDirFromY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
sssd.getPriSwellDirToR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
sssd.getPriSwellDirToY());
|
||||
|
||||
sssd.setPriSwellDirToR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
sssd.setPriSwellDirToY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Secondary Swell
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
sssd.getSecSwellHeightR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
sssd.getSecSwellHeightY());
|
||||
|
||||
sssd.setSecSwellHeightR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
sssd.setSecSwellHeightY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
sssd.getSecSwellPeriodR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
sssd.getSecSwellPeriodY());
|
||||
|
||||
sssd.setSecSwellPeriodR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
sssd.setSecSwellPeriodY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
sssd.getSecSwellDirFromR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
sssd.getSecSwellDirFromY());
|
||||
|
||||
sssd.setSecSwellDirFromR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
sssd.setSecSwellDirFromY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey,
|
||||
sssd.getSecSwellDirToR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey,
|
||||
sssd.getSecSwellDirToY());
|
||||
sssd.setSecSwellDirToR(sstm.getThresholdValue(duKey, threshKeyR, areaID, xmlKey));
|
||||
sssd.setSecSwellDirToY(sstm.getThresholdValue(duKey, threshKeyY, areaID, xmlKey));
|
||||
|
||||
/*
|
||||
* Add data to array.
|
||||
*/
|
||||
ssDataArray.add(sssd);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#reloadData()
|
||||
*/
|
||||
|
||||
private SSDispMonSwellData getDataAtFirstSelection()
|
||||
{
|
||||
int index = dataList.getSelectionIndex();
|
||||
|
||||
return ssDataArray.get(index);
|
||||
}
|
||||
|
||||
private void updateDataArray(SSDispMonSwellData sssd)
|
||||
{
|
||||
int[] dataListIndexes = dataList.getSelectionIndices();
|
||||
int currentIndex = 0;
|
||||
|
||||
for (int i = 0; i < dataListIndexes.length; i++)
|
||||
{
|
||||
currentIndex = dataListIndexes[i];
|
||||
|
||||
ssDataArray.get(currentIndex).updateData(sssd);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadData() {
|
||||
public void commitDataToXML()
|
||||
{
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
|
||||
String xmlKey;
|
||||
String areaID;
|
||||
|
||||
for (SSDispMonSwellData sssd : ssDataArray)
|
||||
{
|
||||
areaID = sssd.getAreaID();
|
||||
|
||||
/*
|
||||
* Primary Swell
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getPriSwellHeightR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getPriSwellHeightY());
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getPriSwellPeriodR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getPriSwellPeriodY());
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getPriSwellDirFromR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getPriSwellDirFromY());
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getPriSwellDirToR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getPriSwellDirToY());
|
||||
|
||||
/*
|
||||
* Secondary Swell
|
||||
*/
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getSecSwellHeightR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getSecSwellHeightY());
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getSecSwellPeriodR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getSecSwellPeriodY());
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getSecSwellDirFromR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getSecSwellDirFromY());
|
||||
|
||||
xmlKey = SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey();
|
||||
sstm.setThresholdValue(duKey, threshKeyR, areaID, xmlKey, sssd.getSecSwellDirToR());
|
||||
sstm.setThresholdValue(duKey, threshKeyY, areaID, xmlKey, sssd.getSecSwellDirToY());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reloadData()
|
||||
{
|
||||
dataList.removeAll();
|
||||
ssDataArray.clear();
|
||||
ssDataArray = null;
|
||||
|
||||
populateList();
|
||||
|
||||
populateList();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.TabItemComp#editDataAction()
|
||||
*/
|
||||
@Override
|
||||
protected void editDataAction() {
|
||||
protected void editDataAction()
|
||||
{
|
||||
SSDispMonSwellData sssd = getDataAtFirstSelection();
|
||||
|
||||
if (monitorSwellEditDlg == null) {
|
||||
monitorSwellEditDlg = new SSDispMonSwellEditDlg(getParent()
|
||||
.getShell(), sssd, this, false);
|
||||
|
||||
if (monitorSwellEditDlg == null)
|
||||
{
|
||||
monitorSwellEditDlg = new SSDispMonSwellEditDlg(getParent().getShell(), sssd, this, false);
|
||||
monitorSwellEditDlg.open();
|
||||
monitorSwellEditDlg = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.IUpdateDisplayMonitorSwell
|
||||
* #updateThresholdData(com.raytheon.uf.viz.monitor.safeseas.threshold.
|
||||
* SSDispMonSwellData)
|
||||
*/
|
||||
@Override
|
||||
public void updateThresholdData(SSDispMonSwellData sssd) {
|
||||
public void updateThresholdData(SSDispMonSwellData sssd)
|
||||
{
|
||||
updateDataArray(sssd);
|
||||
populateList();
|
||||
populateList();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
25
cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSMonitoringAreaConfigDlg.java
Normal file → Executable file
25
cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSMonitoringAreaConfigDlg.java
Normal file → Executable file
|
@ -24,6 +24,7 @@ import org.eclipse.swt.widgets.Display;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
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.DataUsageKey;
|
||||
|
@ -48,11 +49,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Apr 28, 2014 3086 skorolev Updated getConfigManager.
|
||||
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
|
||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
|
||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||
* Nov 21, 2014 3841 skorolev Corrected handleOkBtnSelection.
|
||||
* Dec 11, 2014 3220 skorolev Removed unnecessary code.
|
||||
* Feb 03, 2015 3841 skorolev Replaced resetParams with resetStatus.
|
||||
* Feb 10, 2015 3886 skorolev Changed confirmation message.
|
||||
*
|
||||
*
|
||||
|
@ -74,6 +71,7 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
*/
|
||||
public SSMonitoringAreaConfigDlg(Shell parent, String title) {
|
||||
super(parent, title, AppName.SAFESEAS);
|
||||
SafeSeasMonitor.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,11 +81,12 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
"Confirm Cofiguration Changes", "Save changes?");
|
||||
if (choice == SWT.YES) {
|
||||
// Save the config xml file.
|
||||
saveConfigs();
|
||||
resetAndSave();
|
||||
SSThresholdMgr.reInitialize();
|
||||
fireConfigUpdateEvent();
|
||||
// Open Threshold Dialog if zones/stations are added.
|
||||
if ((!configMgr.getAddedZones().isEmpty())
|
||||
|| (!configMgr.getAddedStations().isEmpty())) {
|
||||
// Open Threshold Dialog if zones/stations are added.
|
||||
if (editDialog() == SWT.YES) {
|
||||
ssMonitorDlg = new SSDispMonThreshDlg(shell,
|
||||
CommonConfig.AppName.SAFESEAS,
|
||||
|
@ -95,15 +94,19 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
ssMonitorDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
// Clean added zones and stations. Close dialog.
|
||||
configMgr.getAddedZones().clear();
|
||||
configMgr.getAddedStations().clear();
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
});
|
||||
ssMonitorDlg.open();
|
||||
}
|
||||
// Clean added zones and stations.
|
||||
configMgr.getAddedZones().clear();
|
||||
configMgr.getAddedStations().clear();
|
||||
}
|
||||
fireConfigUpdateEvent();
|
||||
resetStatus();
|
||||
} else { // Return back to continue edit.
|
||||
return;
|
||||
}
|
||||
|
@ -120,6 +123,7 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
private void fireConfigUpdateEvent() {
|
||||
final IMonitorConfigurationEvent me = new IMonitorConfigurationEvent(
|
||||
configMgr);
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -137,7 +141,10 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
*/
|
||||
@Override
|
||||
public FSSObsMonitorConfigurationManager getInstance() {
|
||||
return FSSObsMonitorConfigurationManager.getSsObsManager();
|
||||
if (configMgr == null) {
|
||||
configMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name());
|
||||
}
|
||||
return configMgr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
31
cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSZoneTableDlg.java
Normal file → Executable file
31
cave/com.raytheon.uf.viz.monitor.safeseas/src/com/raytheon/uf/viz/monitor/safeseas/ui/dialogs/SSZoneTableDlg.java
Normal file → Executable file
|
@ -29,6 +29,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName;
|
||||
|
@ -54,11 +55,9 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
|||
* Dec 30, 2009 3424 zhao use ObMultiHrsReports for obs data archive
|
||||
* Oct 30, 2012 1297 skorolev Changed HashMap to Map
|
||||
* Nov 10, 2012 1297 skorolev Added initiateProdArray
|
||||
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs.
|
||||
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
|
||||
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
|
||||
* Jan 27, 2015 3220 skorolev Removed "site". Added check on dispose.Corrected configMgr assignment.
|
||||
* Added table cache update.
|
||||
* Feb 04, 2015 3841 skorolev Corrected notify method for empty table update.
|
||||
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -81,10 +80,6 @@ public class SSZoneTableDlg extends ZoneTableDlg {
|
|||
*/
|
||||
public SSZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
|
||||
super(parent, obData, CommonConfig.AppName.SAFESEAS);
|
||||
configMgr = FSSObsMonitorConfigurationManager.getSsObsManager();
|
||||
obData.updateTableCache();
|
||||
zoneTblData = obData.getZoneTableData();
|
||||
zoneTblData.sortData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,10 +150,10 @@ public class SSZoneTableDlg extends ZoneTableDlg {
|
|||
|
||||
if (me.getSource() instanceof SafeSeasMonitor) {
|
||||
SafeSeasMonitor monitor = (SafeSeasMonitor) me.getSource();
|
||||
ObMultiHrsReports obData = monitor.getObData();
|
||||
Date date = monitor.getDialogTime();
|
||||
if (date != null) {
|
||||
Date nominalTime = date;
|
||||
ObMultiHrsReports obData = monitor.getObData();
|
||||
if (!isLinkedToFrame()) {
|
||||
nominalTime = obData.getLatestNominalTime();
|
||||
}
|
||||
|
@ -167,8 +162,6 @@ public class SSZoneTableDlg extends ZoneTableDlg {
|
|||
obData.setFogAlgCellType(monitor.getAlgCellTypes(fogAlgThreats));
|
||||
this.updateTableDlg(monitor.getObData().getObHourReports(
|
||||
nominalTime));
|
||||
} else {
|
||||
this.updateZoneTable(obData.getLatestNominalTime());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -286,7 +279,7 @@ public class SSZoneTableDlg extends ZoneTableDlg {
|
|||
* setZoneSortColumnAndDirection()
|
||||
*/
|
||||
@Override
|
||||
public void setZoneSortColumnAndDirection() {
|
||||
protected void setZoneSortColumnAndDirection() {
|
||||
if (zoneTblData != null) {
|
||||
zoneSortColumn = zoneTblData.getSortColumn();
|
||||
zoneSortDirection = zoneTblData.getSortDirection();
|
||||
|
@ -326,4 +319,18 @@ public class SSZoneTableDlg extends ZoneTableDlg {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#
|
||||
* getMonitorAreaConfigInstance()
|
||||
*/
|
||||
@Override
|
||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||
if (configMgr == null || configMgr.isPopulated()) {
|
||||
configMgr = new FSSObsMonitorConfigurationManager(MonName.ss.name());
|
||||
}
|
||||
return configMgr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,14 +20,18 @@
|
|||
package com.raytheon.uf.viz.monitor.snow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -36,6 +40,7 @@ import com.raytheon.uf.viz.core.notification.NotificationMessage;
|
|||
import com.raytheon.uf.viz.monitor.IMonitor;
|
||||
import com.raytheon.uf.viz.monitor.Monitor;
|
||||
import com.raytheon.uf.viz.monitor.ObsMonitor;
|
||||
import com.raytheon.uf.viz.monitor.data.MonitoringArea;
|
||||
import com.raytheon.uf.viz.monitor.data.ObMultiHrsReports;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
|
||||
|
@ -68,10 +73,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Nov. 1, 2012 1297 skorolev Changed HashMap to Map and clean code
|
||||
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
|
||||
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
|
||||
* Jan 27, 2015 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
|
||||
* Corrected snowConfig assignment.Corrected snowConfig assignment.
|
||||
* Moved refreshing of table in the UI thread.Replaced MonitoringArea with snowAreaConfig.
|
||||
* Updated code for better performance.
|
||||
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -95,7 +97,13 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
private SnowMonitoringAreaConfigDlg areaDialog = null;
|
||||
|
||||
/** SNOW configuration manager **/
|
||||
private static FSSObsMonitorConfigurationManager snowAreaConfig = null;
|
||||
private FSSObsMonitorConfigurationManager snowConfig = null;
|
||||
|
||||
/**
|
||||
* This object contains all observation data necessary for the table dialogs
|
||||
* and trending plots
|
||||
*/
|
||||
private ObMultiHrsReports obData;
|
||||
|
||||
/** All SNOW datauri start with this */
|
||||
private final String OBS = "fssobs";
|
||||
|
@ -103,6 +111,9 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
/** regex wild card filter */
|
||||
private final String wildCard = "[\\w\\(\\)-_:.]+";
|
||||
|
||||
/** Time which Zone/County dialog shows. **/
|
||||
private Date dialogTime = null;
|
||||
|
||||
/** Array of snow listeners **/
|
||||
private final List<ISnowResourceListener> snowResources = new ArrayList<ISnowResourceListener>();
|
||||
|
||||
|
@ -117,10 +128,12 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
*/
|
||||
private SnowMonitor() {
|
||||
pluginPatterns.add(snowPattern);
|
||||
snowAreaConfig = FSSObsMonitorConfigurationManager.getSnowObsManager();
|
||||
snowConfig = new FSSObsMonitorConfigurationManager(MonName.snow.name());
|
||||
updateMonitoringArea();
|
||||
initObserver(OBS, this);
|
||||
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);
|
||||
obData.setThresholdMgr(SnowThresholdMgr.getInstance());
|
||||
obData.getZoneTableData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,17 +144,12 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
public static synchronized SnowMonitor getInstance() {
|
||||
if (monitor == null) {
|
||||
monitor = new SnowMonitor();
|
||||
monitor.createDataStructures();
|
||||
monitor.processProductAtStartup(snowAreaConfig);
|
||||
monitor.processProductAtStartup("snow");
|
||||
monitor.fireMonitorEvent(monitor);
|
||||
}
|
||||
return monitor;
|
||||
}
|
||||
|
||||
private void createDataStructures() {
|
||||
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);
|
||||
obData.setThresholdMgr(SnowThresholdMgr.getInstance());
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-initialization of monitor.
|
||||
*
|
||||
|
@ -162,21 +170,26 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
*/
|
||||
public void launchDialog(String type, Shell shell) {
|
||||
if (type.equals("zone")) {
|
||||
zoneDialog = new SnowZoneTableDlg(shell, obData);
|
||||
addMonitorListener(zoneDialog);
|
||||
zoneDialog.addMonitorControlListener(this);
|
||||
if (zoneDialog == null) {
|
||||
zoneDialog = new SnowZoneTableDlg(shell, obData);
|
||||
addMonitorListener(zoneDialog);
|
||||
zoneDialog.addMonitorControlListener(this);
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
}
|
||||
zoneDialog.open();
|
||||
} else if (type.equals("area")) {
|
||||
areaDialog = new SnowMonitoringAreaConfigDlg(shell,
|
||||
"SNOW Monitor Area Configuration");
|
||||
areaDialog.setCloseCallback(new ICloseCallback() {
|
||||
if (areaDialog == null) {
|
||||
areaDialog = new SnowMonitoringAreaConfigDlg(shell,
|
||||
"SNOW Monitor Area Configuration");
|
||||
areaDialog.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
areaDialog = null;
|
||||
}
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
areaDialog = null;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
areaDialog.open();
|
||||
}
|
||||
}
|
||||
|
@ -224,10 +237,40 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
@Override
|
||||
public void processProductMessage(final AlertMessage filtered) {
|
||||
if (snowPattern.matcher(filtered.dataURI).matches()) {
|
||||
processURI(filtered.dataURI, filtered, snowAreaConfig);
|
||||
processURI(filtered.dataURI, filtered);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort by Date.
|
||||
*
|
||||
* @author dhladky
|
||||
*
|
||||
*/
|
||||
public class SortByDate implements Comparator<Date> {
|
||||
@Override
|
||||
public int compare(Date o1, Date o2) {
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads Table Configuration.
|
||||
*
|
||||
* Method that reads the table configuration and updates the zone monitor
|
||||
* threshold map
|
||||
*
|
||||
*/
|
||||
public void updateMonitoringArea() {
|
||||
Map<String, List<String>> zones = new HashMap<String, List<String>>();
|
||||
// create zones and station list
|
||||
for (String zone : snowConfig.getAreaList()) {
|
||||
List<String> stations = snowConfig.getAreaStations(zone);
|
||||
zones.put(zone, stations);
|
||||
}
|
||||
MonitoringArea.setPlatformMap(zones);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -260,10 +303,10 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
*/
|
||||
@Override
|
||||
public void configUpdate(IMonitorConfigurationEvent me) {
|
||||
snowAreaConfig = (FSSObsMonitorConfigurationManager) me.getSource();
|
||||
obData.getObHourReports().updateZones(snowAreaConfig);
|
||||
snowConfig = (FSSObsMonitorConfigurationManager) me.getSource();
|
||||
updateMonitoringArea();
|
||||
if (zoneDialog != null && !zoneDialog.isDisposed()) {
|
||||
obData.updateTableCache();
|
||||
zoneDialog.refreshZoneTableData(obData);
|
||||
fireMonitorEvent(zoneDialog.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
@ -293,10 +336,27 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
@Override
|
||||
protected void process(ObReport result) throws Exception {
|
||||
obData.addReport(result);
|
||||
obData.getZoneTableData(result.getRefHour());
|
||||
fireMonitorEvent(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Dialog Time.
|
||||
*
|
||||
* @return dialogTime
|
||||
*/
|
||||
public Date getDialogTime() {
|
||||
return dialogTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets dialog time.
|
||||
*
|
||||
* @param dialogTime
|
||||
*/
|
||||
public void setDialogTime(Date dialogTime) {
|
||||
this.dialogTime = dialogTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a listener.
|
||||
*
|
||||
|
@ -317,6 +377,16 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
snowResources.remove(isru);
|
||||
}
|
||||
|
||||
/**
|
||||
* SnowResource sets the Drawtime.
|
||||
*
|
||||
* @param dialogTime
|
||||
*/
|
||||
public void updateDialogTime(Date dialogTime) {
|
||||
this.dialogTime = dialogTime;
|
||||
fireMonitorEvent(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close SNOW zone table dialog.
|
||||
*/
|
||||
|
@ -348,7 +418,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets SNOW Zone Dialog.
|
||||
* Gets Zone Dialog.
|
||||
*
|
||||
* @return zoneDialog
|
||||
*/
|
||||
|
@ -356,15 +426,6 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
|
|||
return zoneDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets SNOW Area configuration dialog
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SnowMonitoringAreaConfigDlg getAreaDialog() {
|
||||
return areaDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the zoneDialog
|
||||
*
|
||||
|
|
21
cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/threshold/SnowThresholdMgr.java
Normal file → Executable file
21
cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/threshold/SnowThresholdMgr.java
Normal file → Executable file
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.monitor.snow.threshold;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
||||
|
@ -41,7 +42,6 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowMonitor;
|
|||
* Feb 03, 2014 #2757 skorolev Fixed reInitialize()
|
||||
* May 21, 2014 3086 skorolev Cleaned code.
|
||||
* Sep 04, 2014 3220 skorolev Removed "site".
|
||||
* Oct 16, 2014 3220 skorolev Corrected areaConfigMgr assignment.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -58,7 +58,9 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
|
|||
super("DefaultSnowDisplayThresholds.xml",
|
||||
"DefaultSnowMonitorThresholds.xml", AppName.SNOW.name()
|
||||
.toLowerCase());
|
||||
areaConfigMgr = FSSObsMonitorConfigurationManager.getSnowObsManager();
|
||||
|
||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(
|
||||
MonName.snow.name());
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -112,4 +114,19 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
|
|||
}
|
||||
return threshKeys;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
|
||||
* getMonitorAreaConfigInstance()
|
||||
*/
|
||||
@Override
|
||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||
if (areaConfigMgr == null) {
|
||||
areaConfigMgr = new FSSObsMonitorConfigurationManager(
|
||||
MonName.snow.name());
|
||||
}
|
||||
return areaConfigMgr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.monitor.snow.SnowMonitor;
|
||||
import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* The Snow Area Action
|
||||
|
@ -50,6 +51,11 @@ import com.raytheon.uf.viz.monitor.snow.SnowMonitor;
|
|||
|
||||
public class SnowAreaConfigAction extends AbstractHandler {
|
||||
|
||||
/**
|
||||
* SNOW Monitoring Area Configuration Dialog.
|
||||
*/
|
||||
private SnowMonitoringAreaConfigDlg configDlg;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -59,12 +65,19 @@ public class SnowAreaConfigAction extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
SnowMonitor snow = SnowMonitor.getInstance();
|
||||
if (snow.getAreaDialog() == null || snow.getAreaDialog().isDisposed()) {
|
||||
if (configDlg == null || configDlg.isDisposed()) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
snow.launchDialog("area", shell);
|
||||
configDlg = new SnowMonitoringAreaConfigDlg(shell,
|
||||
"SNOW Monitor Area Configuration");
|
||||
configDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
configDlg = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
configDlg.open();
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -48,7 +48,6 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 21, 2014 3086 skorolev Cleaned code.
|
||||
* Oct 16, 2014 3220 skorolev Added condition to avoid NPE.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -214,86 +213,84 @@ public class SnowDisplayMeteoTab extends TabItemComp implements
|
|||
|
||||
List<AreaXML> areasArray = threshXML.getAreas();
|
||||
|
||||
if (areasArray != null) {
|
||||
for (AreaXML area : areasArray) {
|
||||
areaID = area.getAreaId();
|
||||
SnowDisplayMeteoData sdmd = new SnowDisplayMeteoData();
|
||||
for (AreaXML area : areasArray) {
|
||||
areaID = area.getAreaId();
|
||||
SnowDisplayMeteoData sdmd = new SnowDisplayMeteoData();
|
||||
|
||||
sdmd.setAreaID(areaID);
|
||||
sdmd.setAreaID(areaID);
|
||||
|
||||
/* Tempature */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey();
|
||||
sdmd.setTempR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setTempY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
/* Tempature */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey();
|
||||
sdmd.setTempR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setTempY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
/* Dew point */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey();
|
||||
sdmd.setDewpointR(stm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
sdmd.setDewpointY(stm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
/* Dew point */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey();
|
||||
sdmd.setDewpointR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setDewpointY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
/* Visibility */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey();
|
||||
sdmd.setVisR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setVisY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
/* Visibility */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey();
|
||||
sdmd.setVisR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setVisY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
/* SLP */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey();
|
||||
sdmd.setSlpR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setSlpY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
/* SLP */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey();
|
||||
sdmd.setSlpR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setSlpY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
/* Hourly Precipitation */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey();
|
||||
sdmd.setHrPrecipR(stm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
sdmd.setHrPrecipY(stm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
/* Hourly Precipitation */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey();
|
||||
sdmd.setHrPrecipR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setHrPrecipY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
/* Wind Chill */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey();
|
||||
sdmd.setWindChillR(stm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
sdmd.setWindChillY(stm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
/* Wind Chill */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey();
|
||||
sdmd.setWindChillR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setWindChillY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
/* Frost Bite */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey();
|
||||
sdmd.setFrostBiteR(stm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
sdmd.setFrostBiteY(stm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
/* Frost Bite */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey();
|
||||
sdmd.setFrostBiteR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setFrostBiteY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
/* Snow Depth */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey();
|
||||
sdmd.setSnowDepthR(stm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
sdmd.setSnowDepthY(stm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
/* Snow Depth */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey();
|
||||
sdmd.setSnowDepthR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setSnowDepthY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
/* SNINCR Hourly */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey();
|
||||
sdmd.setSnincrHrlyR(stm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
sdmd.setSnincrHrlyY(stm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
/* SNINCR Hourly */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey();
|
||||
sdmd.setSnincrHrlyR(stm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
sdmd.setSnincrHrlyY(stm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
|
||||
/* SNINCR Total */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey();
|
||||
sdmd.setSnincrTotR(stm.getThresholdValue(duKey, threshKeyR,
|
||||
areaID, xmlKey));
|
||||
sdmd.setSnincrTotY(stm.getThresholdValue(duKey, threshKeyY,
|
||||
areaID, xmlKey));
|
||||
/* SNINCR Total */
|
||||
xmlKey = SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey();
|
||||
sdmd.setSnincrTotR(stm.getThresholdValue(duKey, threshKeyR, areaID,
|
||||
xmlKey));
|
||||
sdmd.setSnincrTotY(stm.getThresholdValue(duKey, threshKeyY, areaID,
|
||||
xmlKey));
|
||||
|
||||
/* Add data to array. */
|
||||
snowDataArray.add(sdmd);
|
||||
}
|
||||
/* Add data to array. */
|
||||
snowDataArray.add(sdmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
25
cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowMonitoringAreaConfigDlg.java
Normal file → Executable file
25
cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowMonitoringAreaConfigDlg.java
Normal file → Executable file
|
@ -24,6 +24,7 @@ import org.eclipse.swt.widgets.Display;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
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.DataUsageKey;
|
||||
|
@ -48,13 +49,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Apr 28, 2014 3086 skorolev Updated snowConfigManager.
|
||||
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
|
||||
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
|
||||
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
|
||||
* Oct 27, 2014 3667 skorolev Cleaned code.
|
||||
* Nov 21, 2014 3841 skorolev Corrected handleOkBtnSelection.
|
||||
* Dec 11, 2014 3220 skorolev Removed unnecessary code.
|
||||
* Feb 03, 2015 3841 skorolev Replaced resetParams with resetStatus.
|
||||
* Feb 10, 2015 3886 skorolev Changed confirmation message.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -73,6 +69,7 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
*/
|
||||
public SnowMonitoringAreaConfigDlg(Shell parent, String title) {
|
||||
super(parent, title, AppName.SNOW);
|
||||
SnowMonitor.getInstance();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -88,8 +85,9 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
"Confirm Cofiguration Changes", "Save changes?");
|
||||
if (choice == SWT.YES) {
|
||||
// Save the config xml file.
|
||||
saveConfigs();
|
||||
resetAndSave();
|
||||
SnowThresholdMgr.reInitialize();
|
||||
fireConfigUpdateEvent();
|
||||
// Open Threshold Dialog if zones/stations are added.
|
||||
if ((!configMgr.getAddedZones().isEmpty())
|
||||
|| (!configMgr.getAddedStations().isEmpty())) {
|
||||
|
@ -104,15 +102,19 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
// Clean added zones and stations. Close dialog.
|
||||
configMgr.getAddedZones().clear();
|
||||
configMgr.getAddedStations().clear();
|
||||
setReturnValue(true);
|
||||
close();
|
||||
}
|
||||
});
|
||||
snowMonitorDlg.open();
|
||||
}
|
||||
// Clean added zones and stations.
|
||||
configMgr.getAddedZones().clear();
|
||||
configMgr.getAddedStations().clear();
|
||||
}
|
||||
fireConfigUpdateEvent();
|
||||
resetStatus();
|
||||
} else { // Return back to continue edit.
|
||||
return;
|
||||
}
|
||||
|
@ -132,7 +134,11 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
*/
|
||||
@Override
|
||||
protected FSSObsMonitorConfigurationManager getInstance() {
|
||||
return FSSObsMonitorConfigurationManager.getSnowObsManager();
|
||||
if (configMgr == null) {
|
||||
configMgr = new FSSObsMonitorConfigurationManager(
|
||||
MonName.snow.name());
|
||||
}
|
||||
return configMgr;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -152,6 +158,7 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
|
|||
private void fireConfigUpdateEvent() {
|
||||
final IMonitorConfigurationEvent me = new IMonitorConfigurationEvent(
|
||||
configMgr);
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
30
cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowZoneTableDlg.java
Normal file → Executable file
30
cave/com.raytheon.uf.viz.monitor.snow/src/com/raytheon/uf/viz/monitor/snow/ui/dialogs/SnowZoneTableDlg.java
Normal file → Executable file
|
@ -26,6 +26,7 @@ import java.util.List;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DisplayVarName;
|
||||
|
@ -53,9 +54,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
|
|||
* Nov. 8, 2012 1297 skorolev Added initiateProdArray method
|
||||
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs
|
||||
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
|
||||
* Jan 27, 2015 3220 skorolev Removed "site". Added check on dispose.Corrected configMgr assignment.
|
||||
* Added table cache update.
|
||||
* Feb 04, 2015 3841 skorolev Corrected notify method for empty table update.
|
||||
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -76,10 +75,6 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
|
|||
*/
|
||||
public SnowZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
|
||||
super(parent, obData, CommonConfig.AppName.SNOW);
|
||||
configMgr = FSSObsMonitorConfigurationManager.getSnowObsManager();
|
||||
obData.updateTableCache();
|
||||
zoneTblData = obData.getZoneTableData();
|
||||
zoneTblData.sortData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,15 +143,12 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
|
|||
|
||||
if (me.getSource() instanceof SnowMonitor) {
|
||||
SnowMonitor monitor = (SnowMonitor) me.getSource();
|
||||
ObMultiHrsReports obData = monitor.getObData();
|
||||
Date date = monitor.getDialogTime();
|
||||
if (date != null) {
|
||||
if (!isLinkedToFrame()) {
|
||||
date = obData.getLatestNominalTime();
|
||||
date = monitor.getObData().getLatestNominalTime();
|
||||
}
|
||||
this.updateTableDlg(obData.getObHourReports(date));
|
||||
} else {
|
||||
this.updateZoneTable(obData.getLatestNominalTime());
|
||||
this.updateTableDlg(monitor.getObData().getObHourReports(date));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -264,4 +256,18 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
|
|||
protected void shellDisposeAction() {
|
||||
// Not used
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg#getInstance()
|
||||
*/
|
||||
@Override
|
||||
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
|
||||
if (configMgr == null || configMgr.isPopulated()) {
|
||||
configMgr = new FSSObsMonitorConfigurationManager(
|
||||
MonName.snow.name());
|
||||
}
|
||||
return configMgr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,19 +21,18 @@ package com.raytheon.uf.viz.monitor;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
|
||||
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
|
||||
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecordTransform;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.inventory.exception.DataCubeException;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
|
@ -44,7 +43,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.core.notification.NotificationMessage;
|
||||
import com.raytheon.uf.viz.datacube.DataCubeContainer;
|
||||
import com.raytheon.uf.viz.monitor.data.ObMultiHrsReports;
|
||||
import com.raytheon.uf.viz.monitor.data.MonitoringArea;
|
||||
import com.raytheon.uf.viz.monitor.data.ObReport;
|
||||
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
|
||||
import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
|
||||
|
@ -62,7 +61,7 @@ import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
|
|||
* Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references
|
||||
* Feb 04, 2014 2757 skorolev Added filter for removed stations
|
||||
* May 08, 2014 3086 skorolev Added current site definition.
|
||||
* Jan 27, 2015 3220 skorolev Removed cwa and monitorUsefrom vals.Added zones parameter to processURI.Updated code for better performance.
|
||||
* Sep 04, 2014 3220 skorolev Removed cwa and monitorUsefrom vals.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -104,15 +103,6 @@ public abstract class ObsMonitor extends Monitor {
|
|||
/** these are the patterns for the stations **/
|
||||
protected ArrayList<Pattern> stationPatterns = new ArrayList<Pattern>();
|
||||
|
||||
/**
|
||||
* This object contains all observation data necessary for the table dialogs
|
||||
* and trending plots
|
||||
*/
|
||||
protected ObMultiHrsReports obData;
|
||||
|
||||
/** current time of monitor dialog */
|
||||
protected Date dialogTime;
|
||||
|
||||
/** Current CWA **/
|
||||
public static String cwa = LocalizationManager.getInstance().getSite();
|
||||
|
||||
|
@ -197,30 +187,45 @@ public abstract class ObsMonitor extends Monitor {
|
|||
*
|
||||
* @param dataURI
|
||||
* @param filtered
|
||||
* @param areaConfig
|
||||
*/
|
||||
public void processURI(String dataURI, AlertMessage filtered,
|
||||
final FSSObsMonitorConfigurationManager areaConfig) {
|
||||
List<String> zones = areaConfig.getAreaList();
|
||||
public void processURI(String dataURI, AlertMessage filtered) {
|
||||
try {
|
||||
Map<String, RequestConstraint> constraints = RequestConstraint
|
||||
.toConstraintMapping(DataURIUtil.createDataURIMap(dataURI));
|
||||
FSSObsRecord[] pdos = requestFSSObs(constraints, null);
|
||||
if (pdos.length > 0 && pdos[0].getTimeObs() != null) {
|
||||
final FSSObsRecord objectToSend = pdos[0];
|
||||
if (!zones.isEmpty()) {
|
||||
ObReport result = GenerateFSSObReport
|
||||
.generateObReport(objectToSend);
|
||||
statusHandler.handle(Priority.INFO, "New FSSrecord ===> "
|
||||
+ objectToSend.getDataURI());
|
||||
try {
|
||||
process(result);
|
||||
} catch (Exception e) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"An error has occured processing the incoming messages.",
|
||||
e);
|
||||
}
|
||||
try {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
// Filter removed stations
|
||||
ArrayList<String> zones = MonitoringArea
|
||||
.getZoneIds(objectToSend
|
||||
.getPlatformId());
|
||||
if (!zones.isEmpty()) {
|
||||
ObReport result = GenerateFSSObReport
|
||||
.generateObReport(objectToSend);
|
||||
statusHandler
|
||||
.handle(Priority.INFO,
|
||||
"New FSSrecord ===> "
|
||||
+ objectToSend
|
||||
.getDataURI());
|
||||
process(result);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"An error has occured processing the incoming messages.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
"An error has occured processing incoming dataURIs.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
|
@ -232,58 +237,56 @@ public abstract class ObsMonitor extends Monitor {
|
|||
/**
|
||||
* Process products at startup
|
||||
*
|
||||
* @param zones
|
||||
* @param monitorName
|
||||
*
|
||||
*/
|
||||
public void processProductAtStartup(
|
||||
FSSObsMonitorConfigurationManager areaConfig) {
|
||||
public void processProductAtStartup(String monitorName) {
|
||||
|
||||
List<String> zones = areaConfig.getAreaList();
|
||||
if (!zones.isEmpty()) {
|
||||
/**
|
||||
* Assume this number for MaxNumObsTimes is larger enough to cover
|
||||
* data of all observations (at least 24 hours' worth of data) in
|
||||
* database [changed from 10 to 240 on May, 18, 2010 for DR #6015,
|
||||
* zhao]
|
||||
*/
|
||||
int MaxNumObsTimes = 240;
|
||||
Map<String, RequestConstraint> vals = new HashMap<String, RequestConstraint>();
|
||||
try {
|
||||
vals.put(FSSObsRecord.PLUGIN_NAME_ID, new RequestConstraint(
|
||||
FSSObsRecord.PLUGIN_NAME));
|
||||
/**
|
||||
* Assume this number for MaxNumObsTimes is larger enough to cover data
|
||||
* of all observations (at least 24 hours' worth of data) in database
|
||||
* [changed from 10 to 240 on May, 18, 2010 for DR #6015, zhao]
|
||||
*/
|
||||
int MaxNumObsTimes = 240;
|
||||
Map<String, RequestConstraint> vals = new HashMap<String, RequestConstraint>();
|
||||
try {
|
||||
vals.put(FSSObsRecord.PLUGIN_NAME_ID, new RequestConstraint(
|
||||
FSSObsRecord.PLUGIN_NAME));
|
||||
|
||||
DataTime[] dataTimesAvailable = DataCubeContainer
|
||||
.performTimeQuery(vals, false);
|
||||
DataTime[] selectedTimes = dataTimesAvailable;
|
||||
DataTime[] dataTimesAvailable = DataCubeContainer.performTimeQuery(
|
||||
vals, false);
|
||||
DataTime[] selectedTimes = dataTimesAvailable;
|
||||
|
||||
// Ensure that the latest product is retrieved.
|
||||
// [Modified: retrieve at most MaxNumObsTimes data
|
||||
// points, Feb
|
||||
// 19, 2010, zhao]
|
||||
if (dataTimesAvailable.length > 0) {
|
||||
Arrays.sort(dataTimesAvailable);
|
||||
// at most, MaxNumObsTimes observation times are
|
||||
// considered
|
||||
if (dataTimesAvailable.length > MaxNumObsTimes) {
|
||||
selectedTimes = new DataTime[MaxNumObsTimes];
|
||||
System.arraycopy(dataTimesAvailable,
|
||||
dataTimesAvailable.length - MaxNumObsTimes,
|
||||
selectedTimes, 0, MaxNumObsTimes);
|
||||
}
|
||||
// Ensure that the latest product is retrieved.
|
||||
// [Modified: retrieve at most MaxNumObsTimes data
|
||||
// points, Feb
|
||||
// 19, 2010, zhao]
|
||||
if (dataTimesAvailable.length > 0) {
|
||||
Arrays.sort(dataTimesAvailable);
|
||||
// at most, MaxNumObsTimes observation times are
|
||||
// considered
|
||||
if (dataTimesAvailable.length > MaxNumObsTimes) {
|
||||
selectedTimes = new DataTime[MaxNumObsTimes];
|
||||
System.arraycopy(dataTimesAvailable,
|
||||
dataTimesAvailable.length - MaxNumObsTimes,
|
||||
selectedTimes, 0, MaxNumObsTimes);
|
||||
}
|
||||
|
||||
FSSObsRecord[] obsRecords = requestFSSObs(vals,
|
||||
selectedTimes);
|
||||
for (FSSObsRecord objectToSend : obsRecords) {
|
||||
// Filter removed stations
|
||||
final ObReport result = GenerateFSSObReport
|
||||
FSSObsRecord[] obsRecords = requestFSSObs(vals, selectedTimes);
|
||||
for (FSSObsRecord objectToSend : obsRecords) {
|
||||
// Filter removed stations
|
||||
ArrayList<String> zones = MonitoringArea
|
||||
.getZoneIds(objectToSend.getPlatformId());
|
||||
if (!zones.isEmpty()) {
|
||||
ObReport result = GenerateFSSObReport
|
||||
.generateObReport(objectToSend);
|
||||
processAtStartup(result);
|
||||
}
|
||||
}
|
||||
} catch (DataCubeException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"No data in database at startup.");
|
||||
}
|
||||
} catch (DataCubeException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"No data in database at startup. " + monitorName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -312,35 +315,4 @@ public abstract class ObsMonitor extends Monitor {
|
|||
constraints);
|
||||
return FSSObsRecordTransform.toFSSObsRecords(pdc);
|
||||
}
|
||||
|
||||
public ObMultiHrsReports getObData() {
|
||||
return obData;
|
||||
}
|
||||
|
||||
public void setObData(ObMultiHrsReports obData) {
|
||||
this.obData = obData;
|
||||
}
|
||||
|
||||
/**
|
||||
* The date for the dialog to stay in step with
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Date getDialogTime() {
|
||||
return dialogTime;
|
||||
}
|
||||
|
||||
public void setDialogTime(Date dialogTime) {
|
||||
this.dialogTime = dialogTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resource sets the Drawtime.
|
||||
*
|
||||
* @param dialogTime
|
||||
*/
|
||||
public void updateDialogTime(Date dialogTime) {
|
||||
this.dialogTime = dialogTime;
|
||||
fireMonitorEvent(this);
|
||||
}
|
||||
}
|
||||
|
|
152
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/MonitorAreaThresholds.java
Executable file → Normal file
152
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/MonitorAreaThresholds.java
Executable file → Normal file
|
@ -20,10 +20,8 @@
|
|||
package com.raytheon.uf.viz.monitor.data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ChosenAppKey;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.ThreatLevel;
|
||||
|
@ -42,7 +40,6 @@ import com.raytheon.uf.common.monitor.data.ObConst.VarName;
|
|||
* Feb 17, 2009 1999 grichard Initial creation.
|
||||
* 3/16/2009 2047 grichard Add threat monitoring routines.
|
||||
* Dec 24, 2009 3424 zhao added getDualValuedThresholdMap and getSingleValuedThresholdMap
|
||||
* Jan 12, 2015 3220 skorolev Replaced MonitoringArea with areaConfig.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -65,6 +62,56 @@ public final class MonitorAreaThresholds {
|
|||
// Map containing the display thresholds
|
||||
private static Map<String, DisplayThresholdsSet> zoneDisplayThresholds = new HashMap<String, DisplayThresholdsSet>();
|
||||
|
||||
/**
|
||||
* This method receives an observation report and a variable name, and
|
||||
* returns the threat level of that single variable.
|
||||
*
|
||||
* @param report
|
||||
* -- the observation report
|
||||
* @param varName
|
||||
* -- the variable name within the report
|
||||
* @return -- the threat level
|
||||
*/
|
||||
public static ObConst.ThreatLevel getThreatLevel(ObReport report,
|
||||
VarName varName) {
|
||||
|
||||
ThreatLevel threatLevel = ThreatLevel.GRAY;
|
||||
ThreatLevel temp = ThreatLevel.GRAY;
|
||||
float varValue = ObConst.MISSING;
|
||||
|
||||
try {
|
||||
varValue = getReportVarValue(report, varName);
|
||||
|
||||
String zoneId = report.getZoneId();
|
||||
// TEMPORARILY USE DEFAULT ZONE ID, NAMELY, DEFAULT STATION.
|
||||
zoneId = ObConst.DEFAULT_STATION_NAME;
|
||||
if (report.isStationary()) {
|
||||
if (MonitoringArea.listZonesToPlatform(report.getPlatformId())
|
||||
.isEmpty()) {
|
||||
// use the default zone if there are no zones
|
||||
temp = getZoneThreatLevel(zoneId, varName, varValue);
|
||||
if (temp.ordinal() < threatLevel.ordinal()) {
|
||||
threatLevel = temp;
|
||||
}
|
||||
} else {
|
||||
for (String z : MonitoringArea.listZonesToPlatform(report
|
||||
.getPlatformId())) {
|
||||
temp = getZoneThreatLevel(z, varName, varValue);
|
||||
if (temp.ordinal() < threatLevel.ordinal()) {
|
||||
threatLevel = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
temp = getZoneThreatLevel(zoneId, varName, varValue);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// return the default threat level
|
||||
}
|
||||
|
||||
return threatLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method receives an observation report and a variable name, and
|
||||
* returns the threat level of that single variable.
|
||||
|
@ -80,13 +127,12 @@ public final class MonitorAreaThresholds {
|
|||
|
||||
ThreatLevel threatLevel = ThreatLevel.GRAY;
|
||||
ThreatLevel temp = ThreatLevel.GRAY;
|
||||
String station = report.getPlatformId();
|
||||
|
||||
try {
|
||||
if (report.isStationary()) {
|
||||
if (chosenAppKey == ChosenAppKey.SAFESEAS) {
|
||||
List<String> ssZones = FSSObsMonitorConfigurationManager
|
||||
.getSsObsManager().getAreaByStationId(station);
|
||||
if (ssZones.isEmpty()) {
|
||||
if (MonitoringArea.listZonesToPlatform(
|
||||
report.getPlatformId()).isEmpty()) {
|
||||
// use the default zone if there are no zones
|
||||
for (VarName v : VarName.values()) {
|
||||
if (v == VarName.TEMPERATURE
|
||||
|
@ -104,7 +150,8 @@ public final class MonitorAreaThresholds {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
for (String z : ssZones) {
|
||||
for (String z : MonitoringArea
|
||||
.listZonesToPlatform(report.getPlatformId())) {
|
||||
for (VarName v : VarName.values()) {
|
||||
if (v == VarName.TEMPERATURE
|
||||
|| v == VarName.WIND_CHILL
|
||||
|
@ -122,9 +169,8 @@ public final class MonitorAreaThresholds {
|
|||
}
|
||||
}
|
||||
} else if (chosenAppKey == ChosenAppKey.SNOW) {
|
||||
List<String> snowZones = FSSObsMonitorConfigurationManager
|
||||
.getSnowObsManager().getAreaByStationId(station);
|
||||
if (snowZones.isEmpty()) {
|
||||
if (MonitoringArea.listZonesToPlatform(
|
||||
report.getPlatformId()).isEmpty()) {
|
||||
// use the default zone if there are no zones
|
||||
for (VarName v : VarName.values()) {
|
||||
if (v == VarName.PRIM_SWELL_HT) {
|
||||
|
@ -139,7 +185,8 @@ public final class MonitorAreaThresholds {
|
|||
}
|
||||
|
||||
} else {
|
||||
for (String z : snowZones) {
|
||||
for (String z : MonitoringArea
|
||||
.listZonesToPlatform(report.getPlatformId())) {
|
||||
for (VarName v : VarName.values()) {
|
||||
if (v == VarName.PRIM_SWELL_HT) {
|
||||
break;
|
||||
|
@ -152,10 +199,9 @@ public final class MonitorAreaThresholds {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {// chosenAppKey = FOG
|
||||
List<String> fogZones = FSSObsMonitorConfigurationManager
|
||||
.getFogObsManager().getAreaByStationId(station);
|
||||
if (fogZones.isEmpty()) {
|
||||
} else {
|
||||
if (MonitoringArea.listZonesToPlatform(
|
||||
report.getPlatformId()).isEmpty()) {
|
||||
// use the default zone if there are no zones
|
||||
temp = getZoneThreatLevel(ObConst.DEFAULT_STATION_NAME,
|
||||
VarName.PRES_WX, report.getPresentWx());
|
||||
|
@ -163,21 +209,20 @@ public final class MonitorAreaThresholds {
|
|||
threatLevel = temp;
|
||||
}
|
||||
temp = getZoneThreatLevel(ObConst.DEFAULT_STATION_NAME,
|
||||
VarName.VISIBILITY,
|
||||
getReportVarValue(report, VarName.VISIBILITY));
|
||||
VarName.VISIBILITY, getReportVarValue(report,
|
||||
VarName.VISIBILITY));
|
||||
if (temp.ordinal() < threatLevel.ordinal()) {
|
||||
threatLevel = temp;
|
||||
}
|
||||
} else {
|
||||
for (String z : fogZones) {
|
||||
for (String z : MonitoringArea
|
||||
.listZonesToPlatform(report.getPlatformId())) {
|
||||
temp = getZoneThreatLevel(z, VarName.PRES_WX,
|
||||
report.getPresentWx());
|
||||
if (temp.ordinal() < threatLevel.ordinal()) {
|
||||
threatLevel = temp;
|
||||
}
|
||||
temp = getZoneThreatLevel(
|
||||
z,
|
||||
VarName.VISIBILITY,
|
||||
temp = getZoneThreatLevel(z, VarName.VISIBILITY,
|
||||
getReportVarValue(report,
|
||||
VarName.VISIBILITY));
|
||||
if (temp.ordinal() < threatLevel.ordinal()) {
|
||||
|
@ -186,7 +231,6 @@ public final class MonitorAreaThresholds {
|
|||
}
|
||||
}
|
||||
}
|
||||
// report is not Stationary
|
||||
} else {
|
||||
if (chosenAppKey == ChosenAppKey.SAFESEAS) {
|
||||
String zoneId = report.getZoneId();
|
||||
|
@ -199,8 +243,8 @@ public final class MonitorAreaThresholds {
|
|||
} else if (v == VarName.STATIONARY) {
|
||||
break;
|
||||
}
|
||||
temp = getZoneThreatLevel(zoneId, v,
|
||||
getReportVarValue(report, v));
|
||||
temp = getZoneThreatLevel(zoneId, v, getReportVarValue(
|
||||
report, v));
|
||||
if (temp.ordinal() < threatLevel.ordinal()) {
|
||||
threatLevel = temp;
|
||||
}
|
||||
|
@ -213,13 +257,13 @@ public final class MonitorAreaThresholds {
|
|||
if (v == VarName.PRIM_SWELL_HT) {
|
||||
break;
|
||||
}
|
||||
temp = getZoneThreatLevel(zoneId, v,
|
||||
getReportVarValue(report, v));
|
||||
temp = getZoneThreatLevel(zoneId, v, getReportVarValue(
|
||||
report, v));
|
||||
if (temp.ordinal() < threatLevel.ordinal()) {
|
||||
threatLevel = temp;
|
||||
}
|
||||
}
|
||||
} else {// chosenAppKey = FOG
|
||||
} else {
|
||||
String zoneId = report.getZoneId();
|
||||
// TEMPORARILY USE DEFAULT ZONE ID, NAMELY, DEFAULT STATION.
|
||||
zoneId = ObConst.DEFAULT_STATION_NAME;
|
||||
|
@ -561,44 +605,32 @@ public final class MonitorAreaThresholds {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [Dec 24, 2009, zhao]
|
||||
*
|
||||
* @param zone
|
||||
* the zone ID
|
||||
* @param varName
|
||||
* enumerated-type variable name
|
||||
* @return single-valued threshold map, or null if the variable name is
|
||||
* invalid or if the map contains no mapping for the key
|
||||
* @param zone the zone ID
|
||||
* @param varName enumerated-type variable name
|
||||
* @return single-valued threshold map, or null if the variable
|
||||
* name is invalid or if the map contains no mapping for the key
|
||||
*/
|
||||
public static Map<ObConst.ThreatLevel, Float> getSingleValuedThresholdMap(
|
||||
String zone, ObConst.VarName varName) {
|
||||
if (varName == VarName.WIND_DIR || varName == VarName.PRIM_SWELL_DIR
|
||||
|| varName == VarName.SEC_SWELL_DIR) {
|
||||
return null;
|
||||
}
|
||||
return zoneMonitorThresholds.get(zone).getSingleValuedThresholdMap(
|
||||
varName);
|
||||
public static Map<ObConst.ThreatLevel,Float> getSingleValuedThresholdMap(String zone, ObConst.VarName varName) {
|
||||
if (varName == VarName.WIND_DIR || varName == VarName.PRIM_SWELL_DIR || varName == VarName.SEC_SWELL_DIR ) {
|
||||
return null;
|
||||
}
|
||||
return zoneMonitorThresholds.get(zone).getSingleValuedThresholdMap(varName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* [Dec 24, 2009, zhao]
|
||||
*
|
||||
* @param zone
|
||||
* the zone ID
|
||||
* @param varName
|
||||
* enumerated-type variable name
|
||||
* @return duel-valued threshold map, or null if the variable name is
|
||||
* invalid or if the map contains no mapping for the key
|
||||
* @param zone the zone ID
|
||||
* @param varName enumerated-type variable name
|
||||
* @return duel-valued threshold map, or null if the variable
|
||||
* name is invalid or if the map contains no mapping for the key
|
||||
*/
|
||||
public static Map<ObConst.ThreatLevel, Float[]> getDualValuedThresholdMap(
|
||||
String zone, ObConst.VarName varName) {
|
||||
if (varName != VarName.WIND_DIR || varName != VarName.PRIM_SWELL_DIR
|
||||
|| varName != VarName.SEC_SWELL_DIR) {
|
||||
return null;
|
||||
}
|
||||
return zoneMonitorThresholds.get(zone).getDualValuedThresholdMap(
|
||||
varName);
|
||||
public static Map<ObConst.ThreatLevel,Float[]> getDualValuedThresholdMap(String zone, ObConst.VarName varName) {
|
||||
if (varName != VarName.WIND_DIR || varName != VarName.PRIM_SWELL_DIR || varName != VarName.SEC_SWELL_DIR ) {
|
||||
return null;
|
||||
}
|
||||
return zoneMonitorThresholds.get(zone).getDualValuedThresholdMap(varName);
|
||||
}
|
||||
}
|
||||
|
|
91
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java
Normal file → Executable file
91
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObHourReports.java
Normal file → Executable file
|
@ -23,8 +23,9 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
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.status.IUFStatusHandler;
|
||||
|
@ -40,14 +41,12 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec. 1, 2009 3424 zhao Initial creation.
|
||||
* Oct.29, 2012 1297 skorolev Changed HashMap to Map
|
||||
* Oct.31, 2012 1297 skorolev Cleaned code.
|
||||
* Sep 04, 2014 3220 skorolev Added updateZones method.
|
||||
* Dec 18, 2014 3841 skorolev Corrected updateZones method.
|
||||
* Jan 27, 2015 3220 skorolev Replaced MonitoringArea with areaConfig.Changed updateZones method.
|
||||
* Oct.31 2012 1297 skorolev Cleaned code.
|
||||
* Sep 04 2014 3220 skorolev Added updateZones method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -74,9 +73,6 @@ public class ObHourReports {
|
|||
*/
|
||||
private Map<String, ObZoneHourReports> hourReports;
|
||||
|
||||
/**
|
||||
* current threshold manager
|
||||
*/
|
||||
private AbstractThresholdMgr thresholdMgr;
|
||||
|
||||
/**
|
||||
|
@ -90,8 +86,9 @@ public class ObHourReports {
|
|||
this.appName = appName;
|
||||
this.thresholdMgr = thresholdMgr;
|
||||
hourReports = new HashMap<String, ObZoneHourReports>();
|
||||
List<String> zones = thresholdMgr.getAreaConfigMgr().getAreaList();
|
||||
for (String zone : zones) {
|
||||
Map<String, List<String>> zoneStationMap = MonitoringArea
|
||||
.getPlatformMap();
|
||||
for (String zone : zoneStationMap.keySet()) {
|
||||
hourReports.put(zone, new ObZoneHourReports(nominalTime, zone,
|
||||
appName, thresholdMgr));
|
||||
}
|
||||
|
@ -104,25 +101,28 @@ public class ObHourReports {
|
|||
*/
|
||||
public void addReport(ObReport report) {
|
||||
String station = report.getPlatformId();
|
||||
List<String> zones = thresholdMgr.getAreaConfigMgr()
|
||||
.getAreaByStationId(station);
|
||||
List<String> zones = MonitoringArea.getZoneIds(station);
|
||||
if (zones.size() == 0) {
|
||||
statusHandler
|
||||
.info("Error: station: "
|
||||
.error("Error: station: "
|
||||
+ station
|
||||
+ " is not associated with any zone in the monitoring area");
|
||||
return;
|
||||
}
|
||||
boolean hasZone = false;
|
||||
for (String zone : zones) {
|
||||
if (hourReports.containsKey(zone)) {
|
||||
hasZone = true;
|
||||
hourReports.get(zone).addReport(report);
|
||||
}
|
||||
}
|
||||
if (hasZone == false) {
|
||||
statusHandler
|
||||
.error("Error in addreport() of ObHourReports: unable to add obs report to data archive");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets HourReports
|
||||
*
|
||||
* @return hourReports
|
||||
*/
|
||||
public Map<String, ObZoneHourReports> getHourReports() {
|
||||
|
@ -186,8 +186,8 @@ public class ObHourReports {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets ObZoneHourReports Returns the ObZoneHourReports object of a
|
||||
* caller-specified zone. If such object not available, returns null.
|
||||
* Returns the ObZoneHourReports object of a caller-specified zone. If such
|
||||
* object not available, returns null.
|
||||
*
|
||||
* @param zone
|
||||
* @return hour reports
|
||||
|
@ -200,8 +200,6 @@ public class ObHourReports {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets NominalTime
|
||||
*
|
||||
* @return nominalTime
|
||||
*/
|
||||
public Date getNominalTime() {
|
||||
|
@ -209,8 +207,6 @@ public class ObHourReports {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets AppName
|
||||
*
|
||||
* @return appName
|
||||
*/
|
||||
public CommonConfig.AppName getAppName() {
|
||||
|
@ -219,31 +215,32 @@ public class ObHourReports {
|
|||
|
||||
/**
|
||||
* Updates zones in the Hour Reports
|
||||
*
|
||||
* @param configMgr
|
||||
*/
|
||||
public void updateZones(FSSObsMonitorConfigurationManager configMgr) {
|
||||
// Updated list of zones
|
||||
List<String> updtZones = configMgr.getAreaList();
|
||||
// remove zones
|
||||
hourReports.keySet().retainAll(updtZones);
|
||||
// add zones
|
||||
for (String zone : updtZones) {
|
||||
if (!hourReports.keySet().contains(zone)) {
|
||||
hourReports.put(zone, new ObZoneHourReports(nominalTime, zone,
|
||||
appName, thresholdMgr));
|
||||
public void updateZones() {
|
||||
Map<String, List<String>> zoneStationMap = MonitoringArea
|
||||
.getPlatformMap();
|
||||
// remove zones or stations
|
||||
List<String> hourZones = new CopyOnWriteArrayList<String>(
|
||||
hourReports.keySet());
|
||||
for (String zone : hourZones) {
|
||||
if (hourReports.keySet().contains(zone)) {
|
||||
List<String> stations = new CopyOnWriteArrayList<String>(
|
||||
hourReports.get(zone).getZoneHourReports().keySet());
|
||||
for (String stn : stations) {
|
||||
if (!zoneStationMap.get(zone).contains(stn)) {
|
||||
hourReports.get(zone).getZoneHourReports().remove(stn);
|
||||
}
|
||||
}
|
||||
if (!zoneStationMap.keySet().contains(zone)) {
|
||||
hourReports.remove(zone);
|
||||
}
|
||||
}
|
||||
}
|
||||
// add and(or) remove stations
|
||||
for (String zone : updtZones) {
|
||||
// Updated list of stations in this zone
|
||||
List<String> updtStns = thresholdMgr.getAreaConfigMgr()
|
||||
.getAreaStations(zone);
|
||||
// remove stations
|
||||
hourReports.get(zone).getZoneHourReports().keySet()
|
||||
.retainAll(updtStns);
|
||||
// add stations
|
||||
for (String stn : updtStns) {
|
||||
// add zones
|
||||
for (String zone : zoneStationMap.keySet()) {
|
||||
List<String> stations = new CopyOnWriteArrayList<String>(
|
||||
zoneStationMap.get(zone));
|
||||
for (String stn : stations) {
|
||||
if (!hourReports.get(zone).getZoneHourReports()
|
||||
.containsKey(stn)) {
|
||||
hourReports
|
||||
|
@ -254,8 +251,10 @@ public class ObHourReports {
|
|||
stn, appName, thresholdMgr));
|
||||
}
|
||||
}
|
||||
// update hourReports for current zone
|
||||
hourReports.get(zone).getZoneHourReports();
|
||||
if (!hourReports.containsKey(zone)) {
|
||||
hourReports.put(zone, new ObZoneHourReports(nominalTime, zone,
|
||||
appName, thresholdMgr));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,14 +24,11 @@ import java.util.Calendar;
|
|||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
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;
|
||||
|
@ -54,11 +51,9 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
|||
* Dec 24, 2009 3424 zhao added getTrendDataSet() that returns ObTrendDataSet object
|
||||
* Jan 25, 2010 4281, 3888, 3877 wkwock/zhao added getHistTableData method
|
||||
* Oct.31, 2012 1297 skorolev Clean code.
|
||||
* Jan.29, 2013 15654 zhao add Wind Chill calculation for SNOW
|
||||
* Jan 27, 2015 3220 skorolev Updated getStationTableData method.Replaced MonitoringArea with cfgMgr.
|
||||
* Added multiHrsTabData - Table data cache.
|
||||
* Feb 04, 2015 3841 skorolev Corrected getEmptyZoneTableData method.
|
||||
*
|
||||
* Jan. 29, 2013 15654 zhao add Wind Chill calculation for SNOW
|
||||
* Sep 04, 2014 3220 skorolev Updated getStationTableData method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author zhao
|
||||
|
@ -83,14 +78,9 @@ public class ObMultiHrsReports {
|
|||
private CommonConfig.AppName appName;
|
||||
|
||||
/**
|
||||
* FSSObs records cache. Key is nominal time, value is ObHourReports object
|
||||
* key is nominal time, value is ObHourReports object
|
||||
*/
|
||||
private SortedMap<Date, ObHourReports> multiHrsReports = new TreeMap<Date, ObHourReports>();
|
||||
|
||||
/**
|
||||
* Monitor Table data cache. Key is nominal time, value is TableData
|
||||
*/
|
||||
private ConcurrentHashMap<Date, TableData> multiHrsTabData = new ConcurrentHashMap<Date, TableData>();
|
||||
private SortedMap<Date, ObHourReports> multiHrsReports;
|
||||
|
||||
/**
|
||||
* The maximum number of most recent hours within which observation reports
|
||||
|
@ -107,10 +97,29 @@ public class ObMultiHrsReports {
|
|||
*/
|
||||
public ObMultiHrsReports(CommonConfig.AppName appName) {
|
||||
this.appName = appName;
|
||||
multiHrsReports = new TreeMap<Date, ObHourReports>();
|
||||
if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
|
||||
initFogAlgCellType();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an array of ObReport objects to the ObMultiHrsReports object (Don't
|
||||
* use! VK)
|
||||
*
|
||||
* @param result
|
||||
*/
|
||||
public void addReports(ObReport[] results) {
|
||||
for (ObReport report : results) {
|
||||
/**
|
||||
* DR #8723: if wind speed is zero, wind direction should be N/A,
|
||||
* not 0
|
||||
*/
|
||||
if (report.getWindSpeed() < 0.0001) { // zero wind speed
|
||||
report.setWindDir(ObConst.MISSING);
|
||||
}
|
||||
addReport(report);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -120,6 +129,8 @@ public class ObMultiHrsReports {
|
|||
* @return returns multiHrsReports
|
||||
*/
|
||||
public void addReport(ObReport report) {
|
||||
// Date nominalTime = TableUtil
|
||||
// .getNominalTime(report.getObservationTime());
|
||||
Date nominalTime = report.getRefHour();
|
||||
/**
|
||||
* DR #8723: if wind speed is zero, wind direction should be N/A, not 0
|
||||
|
@ -140,54 +151,50 @@ public class ObMultiHrsReports {
|
|||
/**
|
||||
* DR15654: set Wind Chill for SNOW
|
||||
*/
|
||||
if (appName == AppName.SNOW) {
|
||||
if (report.getTemperature() != ObConst.MISSING
|
||||
&& report.getWindSpeed() != ObConst.MISSING) {
|
||||
report.setWindChill(calcWindChill(report.getTemperature(),
|
||||
report.getWindSpeed()));
|
||||
if ( appName == AppName.SNOW ) {
|
||||
if ( report.getTemperature() != ObConst.MISSING && report.getWindSpeed() != ObConst.MISSING ) {
|
||||
report.setWindChill(calcWindChill( report.getTemperature(), report.getWindSpeed() ));
|
||||
}
|
||||
|
||||
}
|
||||
ObHourReports obHourReports;
|
||||
// new nominal time; create a new ObHourReports object
|
||||
if (multiHrsReports.isEmpty()
|
||||
|| !multiHrsReports.containsKey(nominalTime)) {
|
||||
obHourReports = new ObHourReports(nominalTime, appName,
|
||||
thresholdMgr);
|
||||
|
||||
if (multiHrsReports.containsKey(nominalTime)) {
|
||||
multiHrsReports.get(nominalTime).addReport(report);
|
||||
} else {
|
||||
// the map is full; delete the oldest entry
|
||||
// new nominal time; create a new ObHourReports object
|
||||
if (multiHrsReports.size() >= maxFrames) {
|
||||
// the map is full; delete the oldest entry
|
||||
multiHrsReports.remove(multiHrsReports.firstKey());
|
||||
}
|
||||
// update multiHrsReports with new data
|
||||
obHourReports = multiHrsReports.get(nominalTime);
|
||||
ObHourReports obHourReports = new ObHourReports(nominalTime,
|
||||
appName, thresholdMgr);
|
||||
obHourReports.addReport(report);
|
||||
multiHrsReports.put(nominalTime, obHourReports);
|
||||
}
|
||||
obHourReports.addReport(report);
|
||||
// update data cache
|
||||
multiHrsReports.put(nominalTime, obHourReports);
|
||||
}
|
||||
|
||||
/**
|
||||
* DR 15654: Wind Chill calculation formula based on
|
||||
* http://www.nws.noaa.gov/om/windchill/ as of Jan. 29, 2013
|
||||
*
|
||||
* @param temp
|
||||
* in degree F
|
||||
* @param windSpd
|
||||
* in knots
|
||||
* @return wind chill in degree F
|
||||
*/
|
||||
private float calcWindChill(float temp, float windSpd) {
|
||||
if (temp > 50.0 || windSpd < 3.0) {
|
||||
return ObConst.MISSING;
|
||||
}
|
||||
/**
|
||||
* 1 knots = 1.15078 mph
|
||||
*/
|
||||
float spd = (float) Math.pow(1.15078 * windSpd, 0.16);
|
||||
return 35.74f + 0.6215f * temp - 35.75f * spd + 0.4275f * temp * spd;
|
||||
}
|
||||
/**
|
||||
* DR 15654:
|
||||
* Wind Chill calculation formula based on
|
||||
* http://www.nws.noaa.gov/om/windchill/
|
||||
* as of Jan. 29, 2013
|
||||
*
|
||||
* @param temperature in degree F
|
||||
* @param windSpeed in knots
|
||||
* @return wind chill in degree F
|
||||
*/
|
||||
private float calcWindChill(float temp, float windSpd) {
|
||||
if ( temp > 50.0 || windSpd < 3.0 ) {
|
||||
return ObConst.MISSING;
|
||||
}
|
||||
/**
|
||||
* 1 knots = 1.15078 mph
|
||||
*/
|
||||
float spd = (float) Math.pow(1.15078*windSpd, 0.16);
|
||||
return 35.74f + 0.6215f*temp - 35.75f*spd + 0.4275f*temp*spd;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns a zone TableData object of the latest nominal time. If no data
|
||||
* available (the map is empty), returns an empty zone TableData object
|
||||
* (table cells filled with "N/A").
|
||||
|
@ -204,31 +211,26 @@ public class ObMultiHrsReports {
|
|||
/**
|
||||
* Returns a zone TableData object for a caller-specified nominal-time. If
|
||||
* no data available, returns an empty/default zone TableData object (table
|
||||
* cells filled with "N/A"). Updates multiHrsTabData table cache.
|
||||
* cells filled with "N/A").
|
||||
*
|
||||
* @param nominalTime
|
||||
* @return
|
||||
*/
|
||||
public TableData getZoneTableData(Date nominalTime) {
|
||||
TableData tabData = null;
|
||||
if (nominalTime == null || !multiHrsReports.containsKey(nominalTime)) {
|
||||
return getEmptyZoneTableData();
|
||||
}
|
||||
if (appName == AppName.FOG) {
|
||||
tabData = this.getObHourReports(nominalTime).getFogZoneTableData(
|
||||
return this.getObHourReports(nominalTime).getFogZoneTableData(
|
||||
fogAlgCellType);
|
||||
} else if (appName == AppName.SAFESEAS) {
|
||||
tabData = this.getObHourReports(nominalTime).getSSZoneTableData(
|
||||
}
|
||||
if (appName == AppName.SAFESEAS) {
|
||||
return this.getObHourReports(nominalTime).getSSZoneTableData(
|
||||
fogAlgCellType);
|
||||
}
|
||||
|
||||
} else {
|
||||
tabData = this.getObHourReports(nominalTime).getZoneTableData();
|
||||
}
|
||||
// update table data cache
|
||||
if (multiHrsTabData.replace(nominalTime, tabData) == null) {
|
||||
multiHrsTabData.put(nominalTime, tabData);
|
||||
}
|
||||
return tabData;
|
||||
return this.getObHourReports(nominalTime).getZoneTableData();
|
||||
// return multiHrsReports.get(nominalTime).getZoneTableData();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,27 +243,15 @@ public class ObMultiHrsReports {
|
|||
.getSystemTime().getTime());
|
||||
ObHourReports hourReports = new ObHourReports(nominalTime, appName,
|
||||
thresholdMgr);
|
||||
TableData tabData = null;
|
||||
if (appName == AppName.FOG) {
|
||||
tabData = hourReports.getFogZoneTableData(fogAlgCellType);
|
||||
} else {
|
||||
tabData = hourReports.getZoneTableData();
|
||||
return hourReports.getFogZoneTableData(fogAlgCellType);
|
||||
}
|
||||
// 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;
|
||||
return hourReports.getZoneTableData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the station TableData object for the latest nominal time. If no
|
||||
* data available, an empty/default station TableData object is returned
|
||||
*
|
||||
* @param zone
|
||||
* @return
|
||||
*/
|
||||
public TableData getStationTableData(String zone) {
|
||||
if (multiHrsReports.isEmpty()) {
|
||||
|
@ -274,13 +264,9 @@ public class ObMultiHrsReports {
|
|||
* Returns a station TableData object for a caller-specified nominal-time
|
||||
* and zone ID. If no data available, an empty/default station TableData
|
||||
* object is returned.
|
||||
*
|
||||
* @param nominalTime
|
||||
* @param zone
|
||||
* @return
|
||||
*/
|
||||
public TableData getStationTableData(Date nominalTime, String zone) {
|
||||
if (zone.equals("")) {
|
||||
if(zone.equals("")){
|
||||
return this.getEmptyZoneTableData();
|
||||
}
|
||||
if (nominalTime == null) {
|
||||
|
@ -310,7 +296,6 @@ public class ObMultiHrsReports {
|
|||
* @param zone
|
||||
* @param Station
|
||||
* @param varName
|
||||
* @param productName
|
||||
* @return ObTrendDataSet object, or null if no data available
|
||||
*/
|
||||
public ObTrendDataSet getTrendDataSet(String zone, String station,
|
||||
|
@ -388,15 +373,12 @@ public class ObMultiHrsReports {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets Histogram Table Data
|
||||
*
|
||||
* @param zone
|
||||
* : current zone
|
||||
* @param station
|
||||
* : station ID
|
||||
* station ID
|
||||
* @param obsType
|
||||
* : ObsHistType
|
||||
* @return
|
||||
* ObsHistType
|
||||
* @return TableData object for obs history table
|
||||
*/
|
||||
public TableData getHistTableData(String zone, String station,
|
||||
ObsHistType obsType) {
|
||||
|
@ -485,46 +467,41 @@ public class ObMultiHrsReports {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets table cache
|
||||
* Returns a SortedMap object <nominal time, ObHourReports object>
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ConcurrentHashMap<Date, TableData> getMultiHrsTabData() {
|
||||
return multiHrsTabData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets table cache
|
||||
*
|
||||
* @param multiHrsTabData
|
||||
*/
|
||||
public void setMultiHrsTabData(
|
||||
ConcurrentHashMap<Date, TableData> multiHrsTabData) {
|
||||
this.multiHrsTabData = multiHrsTabData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets data cache
|
||||
*
|
||||
* @return SortedMap object <nominal time, ObHourReports object>
|
||||
* @return multiHrsReports
|
||||
*/
|
||||
public SortedMap<Date, ObHourReports> getMultiHrsReports() {
|
||||
return multiHrsReports;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets data cache
|
||||
* Returns a SortedMap object (key is nominal time, value is zone TableData
|
||||
* object)
|
||||
*
|
||||
* @param multiHrsReports
|
||||
* @return
|
||||
*/
|
||||
public void setMultiHrsReports(
|
||||
SortedMap<Date, ObHourReports> multiHrsReports) {
|
||||
this.multiHrsReports = multiHrsReports;
|
||||
public SortedMap<Date, TableData> getMultiHrsTableData() {
|
||||
SortedMap<Date, TableData> multiHrsTblData = new TreeMap<Date, TableData>();
|
||||
if (appName == AppName.FOG) {
|
||||
for (Date nominalTime : multiHrsReports.keySet()) {
|
||||
multiHrsTblData.put(
|
||||
nominalTime,
|
||||
multiHrsReports.get(nominalTime).getFogZoneTableData(
|
||||
fogAlgCellType));
|
||||
}
|
||||
return multiHrsTblData;
|
||||
}
|
||||
for (Date nominalTime : multiHrsReports.keySet()) {
|
||||
multiHrsTblData.put(nominalTime, multiHrsReports.get(nominalTime)
|
||||
.getZoneTableData());
|
||||
}
|
||||
return multiHrsTblData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the Latest NominalTime Returns the latest nominal time if the map is
|
||||
* not empty; otherwise, returns the nominal time of the present date-time
|
||||
* Returns the latest nominal time if the map is not empty; otherwise,
|
||||
* returns the nominal time of the present date-time
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
@ -540,38 +517,31 @@ public class ObMultiHrsReports {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets Nominal Times
|
||||
* Returns a set of nominal times
|
||||
*
|
||||
* @return a set of nominal times
|
||||
* @return
|
||||
*/
|
||||
public Set<Date> getNominalTimes() {
|
||||
return multiHrsReports.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ObHourReports Returns the ObHourReports object of the latest nominal
|
||||
* time. If no data available, returns an empty ObHourReports object.
|
||||
* Returns the ObHourReports object of the latest nominal time. If no data
|
||||
* available, returns an empty ObHourReports object.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ObHourReports getObHourReports() {
|
||||
if (multiHrsReports.isEmpty()) {
|
||||
ObHourReports obHrsReps = new ObHourReports(
|
||||
TableUtil.getNominalTime(SimulatedTime.getSystemTime()
|
||||
.getTime()), appName, thresholdMgr);
|
||||
Date refTm = obHrsReps.getNominalTime();
|
||||
TableData tabData = obHrsReps.getZoneTableData();
|
||||
multiHrsTabData.clear();
|
||||
multiHrsTabData.put(refTm, tabData);
|
||||
return obHrsReps;
|
||||
return new ObHourReports(TableUtil.getNominalTime(SimulatedTime
|
||||
.getSystemTime().getTime()), appName, thresholdMgr);
|
||||
}
|
||||
return multiHrsReports.get(multiHrsReports.lastKey());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ObHourReports Returns an ObHourReports object of a caller-specified
|
||||
* nominal time. If no data available, returns an empty ObHourReports
|
||||
* object.
|
||||
* Returns an ObHourReports object of a caller-specified nominal time. If no
|
||||
* data available, returns an empty ObHourReports object.
|
||||
*
|
||||
* @param nominalTime
|
||||
* @return
|
||||
|
@ -604,7 +574,6 @@ public class ObMultiHrsReports {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets Threshold Manager
|
||||
*
|
||||
* @return the threshold manager
|
||||
*/
|
||||
|
@ -622,7 +591,6 @@ public class ObMultiHrsReports {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets map of types for ALG cell
|
||||
*
|
||||
* @return fogAlgCellType
|
||||
*/
|
||||
|
@ -635,26 +603,11 @@ public class ObMultiHrsReports {
|
|||
*/
|
||||
private void initFogAlgCellType() {
|
||||
fogAlgCellType = new HashMap<String, CellType>();
|
||||
FSSObsMonitorConfigurationManager cfgMgr = null;
|
||||
if (appName.equals(CommonConfig.AppName.FOG)) {
|
||||
cfgMgr = FSSObsMonitorConfigurationManager.getFogObsManager();
|
||||
} else if (appName.equals(CommonConfig.AppName.SAFESEAS)) {
|
||||
cfgMgr = FSSObsMonitorConfigurationManager.getSsObsManager();
|
||||
}
|
||||
List<String> zones = cfgMgr.getAreaList();
|
||||
Set<String> zones = MonitoringArea.getPlatformMap().keySet();
|
||||
Iterator<String> itr = zones.iterator();
|
||||
while (itr.hasNext()) {
|
||||
fogAlgCellType.put(itr.next(), CellType.NotAvailable);
|
||||
}
|
||||
setFogAlgCellType(fogAlgCellType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates table cache
|
||||
*/
|
||||
public void updateTableCache() {
|
||||
for (Date time : multiHrsReports.keySet()) {
|
||||
getZoneTableData(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1022
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObZoneHourReports.java
Executable file → Normal file
1022
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/data/ObZoneHourReports.java
Executable file → Normal file
File diff suppressed because it is too large
Load diff
|
@ -25,12 +25,10 @@ import java.util.Date;
|
|||
import com.raytheon.uf.common.geospatial.ISpatialQuery;
|
||||
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
|
||||
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;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
|
||||
import com.raytheon.uf.viz.monitor.config.CommonTableConfig;
|
||||
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
|
||||
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType;
|
||||
|
@ -52,8 +50,6 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
|||
* May 23, 2012 14410 zhao Modified getCellTypeForBlizWarn and getCellTypeForHsnowWarn modules
|
||||
* Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn
|
||||
* May 23, 2014 3086 skorolev Corrected ObsHistType. Cleaned code.
|
||||
* Nov 21, 2014 3841 skorolev Added coordinates in the hover text for a newly added zones.
|
||||
* Jan 08, 2015 3220 skorolev Corrected code for Fog and SNOW table data.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -114,13 +110,9 @@ public final class TableUtil {
|
|||
isZone = true;
|
||||
}
|
||||
|
||||
String hoverText = "";
|
||||
String hoverText = null;
|
||||
if (isZone) {
|
||||
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
|
||||
.getFogObsManager().getAreaXml(zone);
|
||||
if (zoneXML != null) {
|
||||
hoverText = getZoneHoverText(zoneXML);
|
||||
}
|
||||
hoverText = getZoneHoverText(areaId);
|
||||
} else {
|
||||
hoverText = getStationHoverText(areaId);
|
||||
}
|
||||
|
@ -328,8 +320,7 @@ public final class TableUtil {
|
|||
* dialog)
|
||||
* @param zone
|
||||
* @param report
|
||||
* @param tm
|
||||
* Abstract Threshold Manager
|
||||
* @param tm Abstract Threshold Manager
|
||||
* @param fogCellType
|
||||
* @return
|
||||
*/
|
||||
|
@ -345,13 +336,9 @@ public final class TableUtil {
|
|||
isZone = true;
|
||||
}
|
||||
|
||||
String hoverText = "";
|
||||
String hoverText = null;
|
||||
if (isZone) {
|
||||
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
|
||||
.getSsObsManager().getAreaXml(zone);
|
||||
if (zoneXML != null) {
|
||||
hoverText = getZoneHoverText(zoneXML);
|
||||
}
|
||||
hoverText = getZoneHoverText(areaId);
|
||||
} else {
|
||||
hoverText = getStationHoverText(areaId);
|
||||
}
|
||||
|
@ -650,13 +637,9 @@ public final class TableUtil {
|
|||
isZone = true;
|
||||
}
|
||||
|
||||
String hoverText = "";
|
||||
String hoverText = null;
|
||||
if (isZone) {
|
||||
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
|
||||
.getSnowObsManager().getAreaXml(zone);
|
||||
if (zoneXML != null) {
|
||||
hoverText = getZoneHoverText(zoneXML);
|
||||
}
|
||||
hoverText = getZoneHoverText(areaId);
|
||||
} else {
|
||||
hoverText = getStationHoverText(areaId);
|
||||
}
|
||||
|
@ -901,9 +884,8 @@ public final class TableUtil {
|
|||
* @param zone
|
||||
* @return
|
||||
*/
|
||||
private static String getZoneHoverText(AreaIdXML zoneXML) {
|
||||
private static String getZoneHoverText(String zone) {
|
||||
|
||||
String zone = zoneXML.getAreaId();
|
||||
ISpatialQuery sq = null;
|
||||
String sql = null;
|
||||
String hoverText = zone.substring(0, 2) + ", ";
|
||||
|
@ -932,11 +914,6 @@ public final class TableUtil {
|
|||
} else {
|
||||
hoverText += (String) results[0].toString();
|
||||
}
|
||||
} else {
|
||||
if (zoneXML.getCLat() != null) {
|
||||
hoverText += "(" + zoneXML.getCLat() + ", "
|
||||
+ zoneXML.getCLon() + ")";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
47
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/AbstractThresholdMgr.java
Executable file → Normal file
47
cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/thresholds/AbstractThresholdMgr.java
Executable file → Normal file
|
@ -33,9 +33,6 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
|||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
|
||||
import com.raytheon.uf.viz.monitor.filename.DefaultFilenameMgr;
|
||||
|
@ -56,8 +53,6 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
|||
* Mar 22, 2010 #4282 zhao obtain zone IDs from monitoring-area-config-manager
|
||||
* Feb 16, 2011 #7346 zhao added getDirectionalThresholdValueCellType(...)
|
||||
* Apr 28, 2014 3086 skorolev Updated getAreaConfigMgr method.
|
||||
* Oct 17, 2014 3220 skorolev Replaced System.out.print with debug statusHandler.
|
||||
* Jan 08, 2015 3220 skorolev Added getAreaConfigMgr.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -66,13 +61,10 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
|||
*/
|
||||
public abstract class AbstractThresholdMgr {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AbstractThresholdMgr.class);
|
||||
|
||||
/**
|
||||
* Monitor Area Configuration Manager.
|
||||
*/
|
||||
public FSSObsMonitorConfigurationManager areaConfigMgr;
|
||||
protected FSSObsMonitorConfigurationManager areaConfigMgr;
|
||||
|
||||
/**
|
||||
* Default file name for the FOG display thresholds.
|
||||
|
@ -142,6 +134,7 @@ public abstract class AbstractThresholdMgr {
|
|||
this.defMonitorThreshName = defMonitorThreshName;
|
||||
this.appName = appName;
|
||||
this.site = LocalizationManager.getInstance().getCurrentSite();
|
||||
this.areaConfigMgr = getMonitorAreaConfigInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -208,7 +201,7 @@ public abstract class AbstractThresholdMgr {
|
|||
LocalizationFile locFile = pm.getLocalizationFile(context,
|
||||
pathAndFileName);
|
||||
|
||||
statusHandler.handle(Priority.DEBUG, "--- validate path = "
|
||||
System.out.println("--- validate path = "
|
||||
+ locFile.getFile().getAbsolutePath());
|
||||
|
||||
return locFile.getFile().exists();
|
||||
|
@ -533,8 +526,7 @@ public abstract class AbstractThresholdMgr {
|
|||
|
||||
ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.DISPLAY);
|
||||
|
||||
statusHandler.handle(Priority.DEBUG, "---- "
|
||||
+ currFullDisplayXmlFileName);
|
||||
System.out.println("---- " + currFullDisplayXmlFileName);
|
||||
|
||||
displayThreshMgr.createConfigFromDefaults(
|
||||
currFullDisplayXmlFileName, areaIDs, threshKeys);
|
||||
|
@ -772,17 +764,14 @@ public abstract class AbstractThresholdMgr {
|
|||
ArrayList<AreaXML> areasArray = displayXML.getAreas();
|
||||
|
||||
for (AreaXML area : areasArray) {
|
||||
statusHandler.handle(Priority.DEBUG, "--- " + area.getAreaId());
|
||||
System.out.println("--- " + area.getAreaId());
|
||||
|
||||
ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds();
|
||||
|
||||
for (AreaThresholdXML atXml : atXmlArray) {
|
||||
statusHandler.handle(Priority.DEBUG,
|
||||
"****** " + atXml.getKey());
|
||||
statusHandler.handle(Priority.DEBUG,
|
||||
" R " + atXml.getRed());
|
||||
statusHandler.handle(Priority.DEBUG,
|
||||
" Y " + atXml.getYellow());
|
||||
System.out.println("****** " + atXml.getKey());
|
||||
System.out.println(" R " + atXml.getRed());
|
||||
System.out.println(" Y " + atXml.getYellow());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -795,27 +784,23 @@ public abstract class AbstractThresholdMgr {
|
|||
ArrayList<AreaXML> areasArray = threshXmlCopy.getAreas();
|
||||
|
||||
for (AreaXML area : areasArray) {
|
||||
statusHandler.handle(Priority.DEBUG, "--- " + area.getAreaId());
|
||||
System.out.println("--- " + area.getAreaId());
|
||||
|
||||
ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds();
|
||||
|
||||
for (AreaThresholdXML atXml : atXmlArray) {
|
||||
statusHandler.handle(Priority.DEBUG,
|
||||
"****** " + atXml.getKey());
|
||||
statusHandler.handle(Priority.DEBUG,
|
||||
" R " + atXml.getRed());
|
||||
statusHandler.handle(Priority.DEBUG,
|
||||
" Y " + atXml.getYellow());
|
||||
System.out.println("****** " + atXml.getKey());
|
||||
System.out.println(" R " + atXml.getRed());
|
||||
System.out.println(" Y " + atXml.getYellow());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets current Area configuration manager.
|
||||
* Gets Monitor Area Configuration manager.
|
||||
*
|
||||
* @return
|
||||
* @return manager
|
||||
*/
|
||||
public FSSObsMonitorConfigurationManager getAreaConfigMgr() {
|
||||
return areaConfigMgr;
|
||||
}
|
||||
protected abstract FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance();
|
||||
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 15, 2009 #3963 lvenable Initial creation
|
||||
* Dec 4, 2012 #1351 skorolev Cleaned code
|
||||
* Oct 16, 2014 #3220 skorolev Added error message when Default threshold configuration file is corrupted or empty.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -146,11 +145,7 @@ public class ThresholdMgr {
|
|||
ThresholdsXML.class);
|
||||
createXmlFromDefaults(cfgXmlDefaults, areaIDs, keys);
|
||||
} catch (Exception e) {
|
||||
statusHandler
|
||||
.handle(Priority.ERROR,
|
||||
"Default threshold configuration file "
|
||||
+ fullDefaultPathName
|
||||
+ " is corrupted.\nDelete the files in the folder on the server side and restart CAVE.");
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -56,7 +56,6 @@ 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.
|
||||
* Nov 21, 2014 3841 skorolev Corrected handleAddNewStation method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -262,8 +261,8 @@ public class AddNewStationDlg extends CaveSWTDialog {
|
|||
return;
|
||||
}
|
||||
macDlg.addNewStationAction(stn);
|
||||
macDlg.configMgr.addStation(area, stn, type, false);
|
||||
macDlg.configMgr.getStations().add(stn);
|
||||
macDlg.getInstance().addStation(area, stn, type, false);
|
||||
macDlg.getInstance().getStations().add(stn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,6 +28,7 @@ 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;
|
||||
|
||||
|
@ -48,7 +49,6 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
|
||||
* Apr 23, 2014 3054 skorolev Deleted unnecessary parameter in addArea method.
|
||||
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
|
||||
* Nov 21, 2014 3841 skorolev Corrected handleAddNewAction method.
|
||||
* Feb 10, 2015 3886 skorolev Added fixed width for dialog.
|
||||
*
|
||||
* </pre>
|
||||
|
@ -236,12 +236,9 @@ 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();
|
||||
if (macDlg.formIsValid(areaId, latString, lonString)) {
|
||||
handleAddNewAction(areaId, latString, lonString);
|
||||
}
|
||||
handleAddNewAction(latString, lonString);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -261,32 +258,61 @@ public class AddNewZoneDlg extends CaveSWTDialog {
|
|||
/**
|
||||
* Adds a new zone.
|
||||
*
|
||||
* @param areaId
|
||||
* @param latString
|
||||
* @param lonString
|
||||
* @throws NumberFormatException
|
||||
*/
|
||||
private void handleAddNewAction(String areaId, String latString,
|
||||
String lonString) throws NumberFormatException {
|
||||
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.");
|
||||
return;
|
||||
}
|
||||
if (macDlg.isExistingZone(areaId)) {
|
||||
macDlg.displayInputErrorMsg("The Area ID, "
|
||||
displayInputErrorMsg("The Area ID, "
|
||||
+ areaId
|
||||
+ ", is already in your Monitoring Area or among your Additional Zones.");
|
||||
return;
|
||||
}
|
||||
double lat = Double.parseDouble(latString.trim());
|
||||
double lon = Double.parseDouble(lonString.trim());
|
||||
ZoneType type = ZoneType.REGULAR;
|
||||
if (appName != AppName.SNOW) {
|
||||
if (marineZoneRdo.getSelection() || idTF.getText().charAt(2) == 'Z') {
|
||||
type = ZoneType.MARITIME;
|
||||
}
|
||||
}
|
||||
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
|
||||
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.addArea(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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ 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.
|
||||
* Nov 21, 2014 3841 skorolev Corrected deleteSelected method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -190,8 +189,8 @@ public class DeleteStationDlg extends CaveSWTDialog {
|
|||
if (stationList.getSelectionIndex() != -1) {
|
||||
int idx = stationList.getSelectionIndex();
|
||||
String selection = stationList.getItem(idx);
|
||||
retval = macDlg.configMgr.getAddedStations().get(idx);
|
||||
macDlg.configMgr.getAddedStations().remove(idx);
|
||||
retval = configMgr.getAddedStations().get(idx);
|
||||
configMgr.getAddedStations().remove(idx);
|
||||
stationList.remove(selection);
|
||||
populate();
|
||||
} else {
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
**/
|
||||
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;
|
||||
|
@ -39,7 +37,6 @@ import org.eclipse.swt.widgets.Text;
|
|||
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;
|
||||
|
||||
/**
|
||||
|
@ -56,8 +53,6 @@ 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.
|
||||
* Nov 21, 2014 3841 skorolev Content of ID field made an editable.
|
||||
* Feb 03, 2015 3841 skorolev Fixed deleteSelected method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -90,11 +85,17 @@ 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 boolean delZone = false;
|
||||
private String delZone;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -226,6 +227,21 @@ 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;
|
||||
|
@ -235,17 +251,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
saveBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
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.");
|
||||
}
|
||||
saveSelected();
|
||||
}
|
||||
});
|
||||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
|
||||
|
@ -304,21 +310,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
* Populate list of added zones.
|
||||
*/
|
||||
private void populate() {
|
||||
java.util.List<String> newList = new ArrayList<String>();
|
||||
java.util.List<AreaIdXML> maList = macDlg.configMgr.getConfigXml()
|
||||
.getAreaIds();
|
||||
for (AreaIdXML maZone : maList) {
|
||||
if (maZone.getCLat() != null) {
|
||||
newList.add(maZone.getAreaId());
|
||||
}
|
||||
}
|
||||
java.util.List<AreaIdXML> adtnlList = macDlg.configMgr
|
||||
.getAdjAreaConfigXml().getAreaIds();
|
||||
for (AreaIdXML aZone : adtnlList) {
|
||||
if (aZone.getCLat() != null) {
|
||||
newList.add(aZone.getAreaId());
|
||||
}
|
||||
}
|
||||
java.util.List<String> newList = macDlg.configMgr.getAddedZones();
|
||||
zoneList.setItems(newList.toArray(new String[newList.size()]));
|
||||
}
|
||||
|
||||
|
@ -328,25 +320,26 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
private void handleZoneSelection() {
|
||||
String zone = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
AreaIdXML areaXml = macDlg.configMgr.getAreaXml(zone);
|
||||
AreaIdXML adjAreaXml = macDlg.configMgr.getAdjAreaXML(zone);
|
||||
// DR #7343: a null areaXml causes an "Unhandled event loop exception"
|
||||
if (areaXml != null) {
|
||||
idTF.setText(areaXml.getAreaId());
|
||||
// idTF.setEnabled(false);
|
||||
idTF.setEnabled(false);
|
||||
latTF.setText(String.valueOf(areaXml.getCLat()));
|
||||
lonTF.setText(String.valueOf(areaXml.getCLon()));
|
||||
} else if (adjAreaXml != null) {
|
||||
idTF.setText(adjAreaXml.getAreaId());
|
||||
// idTF.setEnabled(false);
|
||||
latTF.setText(String.valueOf(adjAreaXml.getCLat()));
|
||||
lonTF.setText(String.valueOf(adjAreaXml.getCLon()));
|
||||
if (areaXml.getType() == ZoneType.REGULAR) {
|
||||
nonMarineRdo.setSelection(true);
|
||||
marineRdo.setSelection(false);
|
||||
} else {
|
||||
nonMarineRdo.setSelection(false);
|
||||
marineRdo.setSelection(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete selected zones.
|
||||
*/
|
||||
private Boolean deleteSelected() {
|
||||
private String deleteSelected() {
|
||||
if (zoneList.getItemCount() != 0) {
|
||||
if (zoneList.getSelectionIndex() == -1) {
|
||||
MessageBox messageBox = new MessageBox(shell,
|
||||
|
@ -355,86 +348,62 @@ public class EditNewZoneDlg extends CaveSWTDialog {
|
|||
messageBox.setMessage("Please select zone to be deleted.");
|
||||
messageBox.open();
|
||||
zoneList.select(0);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
String area = zoneList.getItem(zoneList.getSelectionIndex());
|
||||
zoneList.remove(zoneList.getSelectionIndex());
|
||||
zoneList.select(0);
|
||||
if (zoneList.getItemCount() != 0) {
|
||||
handleZoneSelection();
|
||||
} else {
|
||||
idTF.setText("");
|
||||
latTF.setText("");
|
||||
lonTF.setText("");
|
||||
}
|
||||
if (macDlg.getMaZones().contains(area)) {
|
||||
macDlg.getMaZones().remove(area);
|
||||
macDlg.configMgr.removeArea(area);
|
||||
}
|
||||
if (macDlg.getAdditionalZones().contains(area)) {
|
||||
macDlg.getAdditionalZones().remove(area);
|
||||
macDlg.configMgr.removeAdjArea(area);
|
||||
}
|
||||
macDlg.maZonesRemoved = true;
|
||||
return true;
|
||||
macDlg.configMgr.removeArea(area);
|
||||
idTF.setText("");
|
||||
latTF.setText("");
|
||||
lonTF.setText("");
|
||||
return area;
|
||||
} else {
|
||||
bottomLbl.setText("No zones have been deleted.");
|
||||
}
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save selected zones.
|
||||
*/
|
||||
/**
|
||||
* @param area
|
||||
* Original zone ID
|
||||
* @param areaStr
|
||||
* New zone ID
|
||||
* @param latStr
|
||||
* Latitude
|
||||
* @param lonStr
|
||||
* Longitude
|
||||
* @throws NumberFormatException
|
||||
*/
|
||||
private void saveSelected(String area, String areaStr, String latStr,
|
||||
String lonStr) throws NumberFormatException {
|
||||
private void saveSelected() {
|
||||
|
||||
ArrayList<StationIdXML> stationIds = macDlg.configMgr.getAreaXml(area)
|
||||
.getStationIds();
|
||||
|
||||
double lat = Double.parseDouble(latStr);
|
||||
double lon = Double.parseDouble(lonStr);
|
||||
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
|
||||
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 (macDlg.configMgr.getAreaList().contains(area)) {
|
||||
if (macDlg.getMaZones().contains(area)) {
|
||||
macDlg.getMaZones().remove(area);
|
||||
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;
|
||||
}
|
||||
}
|
||||
macDlg.configMgr.removeAddedArea(area);
|
||||
macDlg.configMgr.removeArea(area);
|
||||
macDlg.configMgr.addArea(areaXML);
|
||||
} else if (macDlg.getAdditionalZones().contains(area)) {
|
||||
macDlg.getAdditionalZones().remove(area);
|
||||
macDlg.configMgr.removeAdjArea(area);
|
||||
macDlg.configMgr.addAdjArea(areaXML);
|
||||
} else {
|
||||
bottomLbl.setText("No zones have been edited.");
|
||||
}
|
||||
populate();
|
||||
// Return cursor to the list.
|
||||
zoneList.select(zoneList.indexOf(areaStr));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -45,7 +45,7 @@ import org.eclipse.swt.widgets.Text;
|
|||
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;
|
||||
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -78,9 +78,6 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Sep 24, 2014 2757 skorolev Fixed problem with adding and removing zones.
|
||||
* Oct 27, 2014 3667 skorolev Corrected functionality of dialog. Cleaned code.
|
||||
* Nov 12, 2014 3650 skorolev Added confirmation box for unsaved changes in the dialog.
|
||||
* Dec 18, 2014 3841 skorolev Added formIsValid method. Corrected addZoneStn method.
|
||||
* Feb 10, 2015 3886 skorolev Expanded the confirmation window in the showMessage to encompass the entire title.
|
||||
* Feb 03, 2015 3841 skorolev Fixed saving problem for distance and time.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -880,7 +877,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
* Handles the Add New button click.
|
||||
*/
|
||||
private void handleAddNewAction() {
|
||||
// Zone configure
|
||||
if (zoneRdo.getSelection() == true) {
|
||||
if (addNewZoneDlg == null) {
|
||||
addNewZoneDlg = new AddNewZoneDlg(shell, appName, this);
|
||||
|
@ -896,9 +892,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
});
|
||||
}
|
||||
addNewZoneDlg.open();
|
||||
} else { // Station configure
|
||||
if (maRegionalList.getSelectionIndex() != -1) {
|
||||
String area = maRegionalList.getItem(maRegionalList
|
||||
} else {
|
||||
if (associatedList.getSelectionIndex() != -1) {
|
||||
String area = associatedList.getItem(associatedList
|
||||
.getSelectionIndex());
|
||||
if (addNewStnDlg == null) {
|
||||
addNewStnDlg = new AddNewStationDlg(shell, appName, area,
|
||||
|
@ -919,9 +915,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
MessageBox messageBox = new MessageBox(shell,
|
||||
SWT.ICON_INFORMATION | SWT.NONE);
|
||||
messageBox.setText("Selection error.");
|
||||
messageBox.setMessage("Please select a monitoring zone.");
|
||||
messageBox.setMessage("Please select associated zone.");
|
||||
messageBox.open();
|
||||
maRegionalList.select(0);
|
||||
associatedList.select(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -936,8 +932,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
editDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if ((boolean) returnValue) {
|
||||
if (returnValue instanceof String) {
|
||||
// Update the edit dialog
|
||||
String selectedZone = returnValue.toString();
|
||||
maZones.remove(selectedZone);
|
||||
populateLeftLists();
|
||||
}
|
||||
editDlg = null;
|
||||
|
@ -1091,20 +1089,20 @@ 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);
|
||||
monitorAreaList
|
||||
.setItems(maZones.toArray(new String[maZones.size()]));
|
||||
monitorAreaList.setSelection(maZones.indexOf(zone));
|
||||
handleMonitorAreaListSelection();
|
||||
additionalZones.remove(zone);
|
||||
configMgr.addArea(zoneXML);
|
||||
configMgr.addArea(zone, zone.charAt(2) == 'Z' ? ZoneType.MARITIME
|
||||
: ZoneType.REGULAR);
|
||||
if (!configMgr.getAddedZones().contains(zone)) {
|
||||
configMgr.getAddedZones().add(zone);
|
||||
}
|
||||
configMgr.removeAdjArea(zone);
|
||||
handleMonitorAreaListSelection();
|
||||
} else { // Station mode
|
||||
if (associatedList.getSelectionCount() == 0) {
|
||||
showMessage(shell, SWT.ERROR, "Selection Needed",
|
||||
|
@ -1149,8 +1147,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
|
||||
associatedList.removeAll();
|
||||
if (mode == Mode.Zone) {
|
||||
// entry is a zone to remove.
|
||||
AreaIdXML zoneXML = configMgr.getAreaXml(entry);
|
||||
if (!additionalZones.contains(entry)) {
|
||||
additionalZones.add(entry);
|
||||
}
|
||||
|
@ -1163,9 +1159,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
if (configMgr.getAddedZones().contains(entry)) {
|
||||
configMgr.getAddedZones().remove(entry);
|
||||
}
|
||||
configMgr.addAdjArea(zoneXML);
|
||||
|
||||
configMgr.addAdjArea(entry,
|
||||
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
|
||||
: ZoneType.REGULAR);
|
||||
} else { // Station mode
|
||||
// entry is a station to remove.
|
||||
additionalStns.add(entry);
|
||||
Collections.sort(additionalStns);
|
||||
additionalList.setItems(additionalStns
|
||||
|
@ -1244,12 +1242,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
} 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(zoneXML);
|
||||
configMgr.addArea(entry,
|
||||
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
|
||||
: ZoneType.REGULAR);
|
||||
}
|
||||
String stn = monitorAreaList.getItem(monitorAreaList
|
||||
.getSelectionIndex());
|
||||
|
@ -1343,10 +1342,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Saving configuration parameters.
|
||||
* Reset and Saving configuration parameters.
|
||||
*/
|
||||
protected void saveConfigs() {
|
||||
protected void resetAndSave() {
|
||||
getValues();
|
||||
resetStatus();
|
||||
configMgr.saveConfigXml();
|
||||
configMgr.saveAdjacentAreaConfigXml();
|
||||
}
|
||||
|
@ -1415,27 +1415,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
return false;
|
||||
}
|
||||
|
||||
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("Invalid Area ID = '"
|
||||
+ area
|
||||
+ "' 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.");
|
||||
retVal = false;
|
||||
}
|
||||
if (latString == null || latString.isEmpty() || lonString == null
|
||||
|| lonString.isEmpty()) {
|
||||
latLonErrorMsg(latString, lonString);
|
||||
retVal = false;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -1563,35 +1542,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
|
|||
return state;
|
||||
}
|
||||
|
||||
public java.util.List<String> getMaZones() {
|
||||
return maZones;
|
||||
}
|
||||
|
||||
public java.util.List<String> getMaStations() {
|
||||
return maStations;
|
||||
}
|
||||
|
||||
public java.util.List<String> getAdditionalZones() {
|
||||
return additionalZones;
|
||||
}
|
||||
|
||||
public java.util.List<String> getAdditionalStns() {
|
||||
return additionalStns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays Input Error Message
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public void displayInputErrorMsg(String msg) {
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
|
||||
| SWT.OK);
|
||||
messageBox.setText("Invalid input");
|
||||
messageBox.setMessage(msg);
|
||||
messageBox.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Configuration manager.
|
||||
*
|
||||
|
|
|
@ -94,8 +94,8 @@ import com.vividsolutions.jts.io.ParseException;
|
|||
* Nov.11, 2012 1297 skorolev new abstract initiateProdArray()
|
||||
* May 13, 2014 3133 njensen Updated getting ObsHistType from configMgr
|
||||
* May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager.
|
||||
* Sep 15, 2014 3220 skorolev Added refreshZoneTableData method.
|
||||
* Nov 03, 2014 3741 skorolev Updated zoom procedures.
|
||||
* Jan 27, 2015 3220 skorolev Added refreshZoneTableData method.Added condition into launchTrendPlot to avoid NPE.Updated code for better performance.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -259,6 +259,9 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
this.site = LocalizationManager.getInstance().getCurrentSite();
|
||||
dFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
this.obData = obData;
|
||||
// the zone table data of the latest nominal time:
|
||||
zoneTblData = obData.getZoneTableData();
|
||||
zoneTblData.sortData();
|
||||
nominalTime = obData.getLatestNominalTime();
|
||||
}
|
||||
|
||||
|
@ -454,16 +457,12 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
* their current values
|
||||
*/
|
||||
setZoneSortColumnAndDirection();
|
||||
// get tab cache data
|
||||
zoneTblData = obData.getMultiHrsTabData().get(date);
|
||||
// update table if there are tab data in cache
|
||||
if (zoneTblData != null) {
|
||||
zoneTblData.setSortColumnAndDirection(zoneSortColumn,
|
||||
zoneSortDirection);
|
||||
zoneTblData.sortData();
|
||||
zoneTable.setTableData(zoneTblData);
|
||||
zoneTable.table.redraw();
|
||||
}
|
||||
zoneTblData = obData.getZoneTableData(date);
|
||||
zoneTblData
|
||||
.setSortColumnAndDirection(zoneSortColumn, zoneSortDirection);
|
||||
zoneTblData.sortData();
|
||||
zoneTable.setTableData(zoneTblData);
|
||||
zoneTable.table.redraw();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -495,7 +494,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
/**
|
||||
* Sets Column and Sort Direction for Zone table.
|
||||
*/
|
||||
public void setZoneSortColumnAndDirection() {
|
||||
protected void setZoneSortColumnAndDirection() {
|
||||
if (zoneTblData != null) {
|
||||
zoneSortColumn = zoneTblData.getSortColumn();
|
||||
zoneSortDirection = zoneTblData.getSortDirection();
|
||||
|
@ -605,9 +604,6 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
@Override
|
||||
public void zoneTableAction(int rowNum) {
|
||||
|
||||
zoneTblData = obData.getZoneTableData(nominalTime);
|
||||
zoneTblData.sortData();
|
||||
// set selectedZone to the selected zone
|
||||
selectedZone = zoneTblData.getTableRows().get(rowNum)
|
||||
.getTableCellData(0).getCellText();
|
||||
|
@ -739,14 +735,10 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
.getTableCellData(0).getCellText();
|
||||
// Set dialog index
|
||||
String dialogID = appName.name() + station;
|
||||
ObsHistType histType = null;
|
||||
if (configMgr != null) {
|
||||
String strHistType = configMgr
|
||||
.getStationType(selectedZone, station);
|
||||
histType = ObsHistType.valueOf(strHistType);
|
||||
}
|
||||
if (histType == null)
|
||||
return;
|
||||
String strHistType = getMonitorAreaConfigInstance().getStationType(
|
||||
selectedZone, station);
|
||||
ObsHistType histType = ObsHistType.valueOf(strHistType);
|
||||
|
||||
/**
|
||||
* For Snow monitor, no history table is displayed for a Maritime
|
||||
* station
|
||||
|
@ -971,4 +963,21 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
|
|||
}
|
||||
return varName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Configuration manager.
|
||||
*
|
||||
* @return manager
|
||||
*/
|
||||
protected abstract FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance();
|
||||
|
||||
/**
|
||||
* Refreshes Zone Table.
|
||||
*
|
||||
* @param obData
|
||||
*/
|
||||
public void refreshZoneTableData(ObMultiHrsReports obData) {
|
||||
obData.getObHourReports().updateZones();
|
||||
this.updateTableDlg(obData.getObHourReports());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ import com.raytheon.viz.ui.personalities.awips.CAVE;
|
|||
* Nov 14, 2013 2361 njensen Remove initializeSerialization()
|
||||
* Nov 06, 2014 3356 njensen Always initialize ILocalizationAdapter
|
||||
* in case cache preference is not enabled
|
||||
* Feb 23, 2015 4164 dlovely Call AlertViz initialize.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -211,6 +212,7 @@ public class ThinClientComponent extends CAVE implements IThinClientComponent {
|
|||
// JMS Enabled, register product alerts
|
||||
registerProductAlerts();
|
||||
}
|
||||
initializeAlertViz();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
-XX:G1OldCSetRegionThresholdPercent=25
|
||||
-XX:G1HeapWastePercent=5</vmArgs>
|
||||
<vmArgsLin>-Xmx2048M -XX:MaxDirectMemorySize=2G</vmArgsLin>
|
||||
<vmArgsWin>-Dfile.encoding=UTF-8 -Xmx768M</vmArgsWin>
|
||||
<vmArgsWin>-Dfile.encoding=UTF-8 -Xmx2560M</vmArgsWin>
|
||||
</launcherArgs>
|
||||
|
||||
<windowImages/>
|
||||
|
|
|
@ -45,6 +45,7 @@ import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
|
|||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.satellite.SatMapCoverage;
|
||||
import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord;
|
||||
import com.raytheon.uf.common.dataplugin.satellite.units.generic.GenericPixel;
|
||||
import com.raytheon.uf.common.geospatial.IGridGeometryProvider;
|
||||
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
|
||||
import com.raytheon.uf.common.geospatial.data.GeographicDataSource;
|
||||
|
@ -123,6 +124,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Jun 12, 2014 3238 bsteffen Implement Interrogatable
|
||||
* Aug 21, 2014 DR 17313 jgerth Set no data value if no data mapping
|
||||
* Oct 15, 2014 3681 bsteffen create renderable in interrogate if necessary.
|
||||
* Feb 17, 2015 4135 bsteffen Set no data value for derived products.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -396,8 +399,19 @@ public class SatResource extends
|
|||
if (persisted != null) {
|
||||
colorMapParameters.applyPersistedParameters(persisted);
|
||||
}
|
||||
if (colorMapParameters.getDataMapping() == null)
|
||||
colorMapParameters.setNoDataValue(0);
|
||||
if (colorMapParameters.getDataMapping() == null) {
|
||||
if (unit instanceof GenericPixel) {
|
||||
/**
|
||||
* Generic Pixel only comes from derived parameter which used
|
||||
* signed data so 0 is valid but -128 is used as a no data
|
||||
* value.
|
||||
*/
|
||||
colorMapParameters.setNoDataValue(Byte.MIN_VALUE);
|
||||
} else {
|
||||
colorMapParameters.setNoDataValue(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getCapability(ColorMapCapability.class).setColorMapParameters(
|
||||
colorMapParameters);
|
||||
|
|
|
@ -65,6 +65,7 @@ import com.raytheon.uf.viz.personalities.cave.component.CAVEApplication;
|
|||
* Aug 26, 2014 3356 njensen Explicitly set localization adapter
|
||||
* Sep 10, 2014 3612 mschenke Refactored to extend CAVEApplication
|
||||
* Jan 15, 2015 3947 mapeters cleanup() doesn't throw Exception.
|
||||
* Feb 23, 2015 4164 dlovely Extracted AlertViz initialize.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -201,6 +202,13 @@ public abstract class AbstractAWIPSComponent extends CAVEApplication {
|
|||
@Override
|
||||
protected void initializeObservers() {
|
||||
super.initializeObservers();
|
||||
initializeAlertViz();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize AlertViz.
|
||||
*/
|
||||
protected void initializeAlertViz() {
|
||||
// Setup AlertViz observer
|
||||
if ((getRuntimeModes() & ALERT_VIZ) != 0) {
|
||||
// Set up alertviz
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>gov.noaa.nws.crh.edex.grib.decoderpostprocessor.feature</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1 @@
|
|||
bin.includes = feature.xml
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feature
|
||||
id="gov.noaa.nws.crh.edex.grib.decoderpostprocessor.feature"
|
||||
label="Feature"
|
||||
version="1.0.0">
|
||||
|
||||
<description url="http://www.example.com/description">
|
||||
[Enter Feature Description here.]
|
||||
</description>
|
||||
|
||||
<copyright url="http://www.example.com/copyright">
|
||||
[Enter Copyright Description here.]
|
||||
</copyright>
|
||||
|
||||
<license url="http://www.example.com/license">
|
||||
[Enter License Description here.]
|
||||
</license>
|
||||
|
||||
<plugin
|
||||
id="gov.noaa.nws.crh.edex.grib.decoderpostprocessor"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
|
@ -70,6 +70,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
|||
import com.raytheon.uf.common.message.WsId;
|
||||
import com.raytheon.uf.common.python.PyUtil;
|
||||
import com.raytheon.uf.common.python.PythonEval;
|
||||
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -107,7 +108,7 @@ import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
|
|||
* Jan 21, 2014 #2720 randerso Improve efficiency of merging polygons in edit area generation
|
||||
* Aug 27, 2014 #3563 randerso Fix issue where edit areas are regenerated unnecessarily
|
||||
* Oct 20, 2014 #3685 randerso Changed structure of editAreaAttrs to keep zones from different maps separated
|
||||
*
|
||||
* Feb 19, 2015 #4125 rjpeter Fix jaxb performance issue
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
|
@ -577,6 +578,9 @@ public class MapManager {
|
|||
}
|
||||
|
||||
if (areaDir.isDirectory() && areaDir.canWrite()) {
|
||||
SingleTypeJAXBManager<ReferenceData> jaxbManager = ReferenceData
|
||||
.getJAXBManager();
|
||||
|
||||
for (ReferenceData ref : data) {
|
||||
ref.getPolygons(CoordinateType.LATLON);
|
||||
File path = new File(FileUtil.join(areaDir.getAbsolutePath(),
|
||||
|
@ -586,8 +590,7 @@ public class MapManager {
|
|||
// old one, write a warning to the log.
|
||||
ReferenceData other = null;
|
||||
try {
|
||||
other = ReferenceData.getJAXBManager()
|
||||
.unmarshalFromXmlFile(path);
|
||||
other = jaxbManager.unmarshalFromXmlFile(path);
|
||||
} catch (Exception e) {
|
||||
statusHandler.error("Error reading edit area file "
|
||||
+ path.getAbsolutePath(), e);
|
||||
|
@ -604,7 +607,7 @@ public class MapManager {
|
|||
} else {
|
||||
// Write the new edit area file.
|
||||
try {
|
||||
ReferenceData.getJAXBManager().marshalToXmlFile(ref,
|
||||
jaxbManager.marshalToXmlFile(ref,
|
||||
path.getAbsolutePath());
|
||||
} catch (Exception e) {
|
||||
statusHandler.error("Error writing edit area to file "
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
|||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.LocalizationUtil;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
|
@ -50,7 +51,7 @@ import com.raytheon.uf.common.util.FileUtil;
|
|||
* Aug 07, 2013 1561 njensen Use pm.listFiles() instead of pm.listStaticFiles()
|
||||
* Sep 30, 2013 2361 njensen Use JAXBManager for XML
|
||||
* Sep 08, 2104 3592 randerso Changed to use new pm listStaticFiles()
|
||||
*
|
||||
* Feb 19, 2015 4125 rjpeter Fix jaxb performance issue
|
||||
* </pre>
|
||||
*
|
||||
* @author dgilling
|
||||
|
@ -65,9 +66,9 @@ public class ReferenceMgr {
|
|||
private static final String EDIT_AREAS_DIR = FileUtil.join("gfe",
|
||||
"editAreas");
|
||||
|
||||
private IPathManager pathMgr;
|
||||
private final IPathManager pathMgr;
|
||||
|
||||
private GridLocation dbGridLocation;
|
||||
private final GridLocation dbGridLocation;
|
||||
|
||||
public ReferenceMgr(final IFPServerConfig config) {
|
||||
this.pathMgr = PathManagerFactory.getPathManager();
|
||||
|
@ -113,6 +114,8 @@ public class ReferenceMgr {
|
|||
final List<ReferenceID> ids) {
|
||||
ServerResponse<List<ReferenceData>> sr = new ServerResponse<List<ReferenceData>>();
|
||||
List<ReferenceData> data = new ArrayList<ReferenceData>();
|
||||
SingleTypeJAXBManager<ReferenceData> jaxbManager = ReferenceData
|
||||
.getJAXBManager();
|
||||
|
||||
// process each ReferenceID requested
|
||||
for (ReferenceID id : ids) {
|
||||
|
@ -131,8 +134,8 @@ public class ReferenceMgr {
|
|||
// open and read the file
|
||||
ReferenceData refData = null;
|
||||
try {
|
||||
refData = ReferenceData.getJAXBManager().unmarshalFromXmlFile(
|
||||
lf.getFile().getPath());
|
||||
refData = jaxbManager.unmarshalFromXmlFile(lf.getFile()
|
||||
.getPath());
|
||||
} catch (Exception e) {
|
||||
sr.addMessage("Unable to read reference data [" + id + "]");
|
||||
data = Collections.emptyList();
|
||||
|
|
|
@ -23,10 +23,14 @@
|
|||
# ------------ ---------- ----------- --------------------------
|
||||
# 01/13/2015 #3955 randerso Changed to use ifpServer.getTopoData
|
||||
#
|
||||
# 02/17/2015 4139 randerso Removed timeFromComponents and dependent
|
||||
# functions in favor of calendar.timegm
|
||||
#
|
||||
##
|
||||
|
||||
|
||||
import string, getopt, sys, time, gzip, os, LogStream, stat, traceback
|
||||
import calendar
|
||||
from collections import OrderedDict
|
||||
import numpy
|
||||
#import pupynere as NetCDF
|
||||
|
@ -221,51 +225,6 @@ def processParmList(argDict, db):
|
|||
final.append(p)
|
||||
return final
|
||||
|
||||
###-------------------------------------------------------------------------###
|
||||
# leap year routine
|
||||
def leapYear(year):
|
||||
return (year % 4 == 0 and (year + 100) % 400 != 0)
|
||||
|
||||
###-------------------------------------------------------------------------###
|
||||
# days in month routine
|
||||
def daysInMonth(month, year):
|
||||
days = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
|
||||
|
||||
if month != 2:
|
||||
return days[month - 1]
|
||||
|
||||
# special February handling for leap years
|
||||
if leapYear(year):
|
||||
return days[1] + 1
|
||||
else:
|
||||
return days[1]
|
||||
|
||||
###-------------------------------------------------------------------------###
|
||||
# convert to time from components
|
||||
# 0-year,1-month,2-day,3-hour,4-min,5-sec
|
||||
def timeFromComponents(timeTuple):
|
||||
epochDays = 0
|
||||
pyear = 1970
|
||||
pmonth = 1 # startTime
|
||||
|
||||
while pyear != timeTuple[0]:
|
||||
epochDays = epochDays + 365 # days in year
|
||||
if leapYear(pyear):
|
||||
epochDays = epochDays + 1 # account for leap year
|
||||
pyear = pyear + 1
|
||||
|
||||
while pmonth != timeTuple[1]:
|
||||
epochDays = epochDays + daysInMonth(pmonth, timeTuple[0])
|
||||
pmonth = pmonth + 1
|
||||
|
||||
epochDays = epochDays + timeTuple[2] - 1 # but not this day
|
||||
|
||||
epochTime = epochDays * 86400 + \
|
||||
timeTuple[3] * 3600 + timeTuple[4] * 60 + timeTuple[5]
|
||||
|
||||
return int(epochTime)
|
||||
|
||||
|
||||
###-------------------------------------------------------------------------###
|
||||
### Returns true if the specified time is contained within the timeRange
|
||||
def contains(timerange, time):
|
||||
|
@ -303,14 +262,14 @@ def getIntTime(timeStr):
|
|||
"Create an Integer time from a string: YYYYMMDD_HHMM"
|
||||
|
||||
try:
|
||||
intTime = time.strptime(timeStr, "%Y%m%d_%H%M")
|
||||
timeTuple = time.strptime(timeStr, "%Y%m%d_%H%M")
|
||||
except:
|
||||
logProblem(timeStr, \
|
||||
"is not a valid time string. Use YYYYMMDD_HHMM",traceback.format_exc())
|
||||
s = timeStr + " is not a valid time string. Use YYYYMMDD_HHMM"
|
||||
raise SyntaxError, s
|
||||
return
|
||||
return timeFromComponents(intTime)
|
||||
return calendar.timegm(timeTuple)
|
||||
|
||||
###-------------------------------------------------------------------------###
|
||||
### Makes a TimeRange from the input string of the form YYYYMMDD_HHMM.
|
||||
|
|
|
@ -16,10 +16,17 @@
|
|||
#
|
||||
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
# further licensing information.
|
||||
# ----------------------------------------------------------------------------
|
||||
# SOFTWARE HISTORY
|
||||
#
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 02/17/2015 4139 randerso Replaced call to iscTime.timeFromComponents
|
||||
# with call to calendar.timegm
|
||||
##
|
||||
|
||||
|
||||
import os, stat, time, string, sys
|
||||
import os, stat, time, string, sys, calendar
|
||||
import iscTime, iscUtil, mergeGrid
|
||||
try:
|
||||
# dev environment
|
||||
|
@ -973,7 +980,7 @@ class IscMosaic:
|
|||
importError = True
|
||||
while importError:
|
||||
try:
|
||||
intTime = time.strptime(timeStr, "%Y%m%d_%H%M")
|
||||
timeTuple = time.strptime(timeStr, "%Y%m%d_%H%M")
|
||||
importError = False
|
||||
except ImportError:
|
||||
importError = True
|
||||
|
@ -981,7 +988,7 @@ class IscMosaic:
|
|||
logger.exception("%s is not a valid time string. Use YYYYMMDD_HHMM", timeStr)
|
||||
raise Exception, "Bad date format YYYYMMDD_HHMM"
|
||||
|
||||
return iscTime.timeFromComponents(intTime)
|
||||
return calendar.timegm(timeTuple)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# get netcdf input variables
|
||||
|
|
|
@ -28,53 +28,10 @@
|
|||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# 07/06/09 1995 bphillip Initial Creation.
|
||||
#
|
||||
#
|
||||
# 02/17/2015 4139 randerso Removed timeFromComponents and dependent
|
||||
# functions in favor of calendar.timegm
|
||||
#
|
||||
|
||||
|
||||
# leap year routine
|
||||
def leapYear(year):
|
||||
return (year % 4 == 0 and (year+100) % 400 != 0)
|
||||
|
||||
# days in month routine
|
||||
def daysInMonth(month, year):
|
||||
days = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
|
||||
|
||||
if month != 2:
|
||||
return days[month-1]
|
||||
|
||||
# special February handling for leap years
|
||||
if leapYear(year):
|
||||
return days[1]+1
|
||||
else:
|
||||
return days[1]
|
||||
|
||||
# convert to time from components
|
||||
# 0-year,1-month,2-day,3-hour,4-min,5-sec
|
||||
def timeFromComponents(timeTuple):
|
||||
epochDays = 0
|
||||
pyear = 1970
|
||||
pmonth = 1 # startTime
|
||||
|
||||
while pyear != timeTuple[0]:
|
||||
epochDays = epochDays + 365 # days in year
|
||||
if leapYear(pyear):
|
||||
epochDays = epochDays + 1 # account for leap year
|
||||
pyear = pyear + 1
|
||||
|
||||
while pmonth != timeTuple[1]:
|
||||
epochDays = epochDays + daysInMonth(pmonth, timeTuple[0])
|
||||
pmonth = pmonth + 1
|
||||
|
||||
epochDays = epochDays + timeTuple[2] - 1; # but not this day
|
||||
|
||||
epochTime = epochDays*86400 + \
|
||||
timeTuple[3]*3600 + timeTuple[4]*60 + timeTuple[5]
|
||||
|
||||
return int(epochTime)
|
||||
|
||||
|
||||
# time range routines
|
||||
def containsT(tr, t):
|
||||
return (t >= tr[0] and t < tr[1])
|
||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
* added serialization adapter, removed setters.
|
||||
* 08/06/13 #1571 randerso Added hibernate annotations, javadoc cleanup
|
||||
* 10/22/2013 #2361 njensen Remove ISerializableObject
|
||||
* 02/17/2015 #4139 randerso Fix expandTRToQuantum to work with pre-epoch times.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -139,9 +140,11 @@ public class TimeConstraints {
|
|||
}
|
||||
|
||||
long secSinceMidnight = absTime.getTime() % TimeUtil.MILLIS_PER_DAY;
|
||||
if (secSinceMidnight < 0) {
|
||||
secSinceMidnight += TimeUtil.MILLIS_PER_DAY;
|
||||
}
|
||||
|
||||
long midnight = (absTime.getTime() / TimeUtil.MILLIS_PER_DAY)
|
||||
* TimeUtil.MILLIS_PER_DAY;
|
||||
long midnight = absTime.getTime() - secSinceMidnight;
|
||||
|
||||
int tStart = startTime - repeatInterval;
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.dataplugin.gfe.reference;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -36,7 +38,7 @@ import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
|
|||
import com.raytheon.uf.common.dataplugin.gfe.grid.Grid2DBit;
|
||||
import com.raytheon.uf.common.dataplugin.gfe.util.GfeUtil;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.geospatial.adapter.JTSGeometryAdapter;
|
||||
import com.raytheon.uf.common.geospatial.adapter.GeometryAdapter;
|
||||
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
|
@ -69,7 +71,7 @@ import com.vividsolutions.jts.geom.Polygonal;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 01/31/2008 randerso Initial creation
|
||||
* 10/01/2013 2361 njensen Added static JAXBManager
|
||||
*
|
||||
* 02/19/2015 4125 rjpeter Updated to return a new pooled JAXBManager on request.
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
|
@ -85,8 +87,7 @@ public class ReferenceData {
|
|||
|
||||
private static final GeometryFactory geometryFactory = new GeometryFactory();
|
||||
|
||||
private static final SingleTypeJAXBManager<ReferenceData> jaxb = SingleTypeJAXBManager
|
||||
.createWithoutException(ReferenceData.class);
|
||||
private static Reference<SingleTypeJAXBManager<ReferenceData>> jaxbRef = null;
|
||||
|
||||
public enum RefType {
|
||||
NONE, QUERY, POLYGON, QUERY_POLYGON
|
||||
|
@ -102,7 +103,7 @@ public class ReferenceData {
|
|||
@DynamicSerializeElement
|
||||
private String query;
|
||||
|
||||
@XmlJavaTypeAdapter(value = JTSGeometryAdapter.class)
|
||||
@XmlJavaTypeAdapter(value = GeometryAdapter.class)
|
||||
@DynamicSerializeElement
|
||||
private MultiPolygon polygons;
|
||||
|
||||
|
@ -113,12 +114,27 @@ public class ReferenceData {
|
|||
private CoordinateType coordType;
|
||||
|
||||
/**
|
||||
* Returns the JAXBManager that handles ReferenceData
|
||||
* Returns the JAXBManager that handles ReferenceData.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static SingleTypeJAXBManager<ReferenceData> getJAXBManager() {
|
||||
return jaxb;
|
||||
// not worried about concurrency, two can be created without issue
|
||||
SingleTypeJAXBManager<ReferenceData> rval = null;
|
||||
|
||||
if (jaxbRef != null) {
|
||||
rval = jaxbRef.get();
|
||||
}
|
||||
|
||||
if (rval == null) {
|
||||
rval = SingleTypeJAXBManager.createWithoutException(true,
|
||||
ReferenceData.class);
|
||||
if (rval != null) {
|
||||
jaxbRef = new SoftReference<>(rval);
|
||||
}
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -224,7 +240,7 @@ public class ReferenceData {
|
|||
* @return
|
||||
*/
|
||||
public MultiPolygon getPolygons(CoordinateType coordType) {
|
||||
if (grid != null && polygons == null) {
|
||||
if ((grid != null) && (polygons == null)) {
|
||||
calcPolygons();
|
||||
}
|
||||
convertTo(coordType);
|
||||
|
@ -308,7 +324,7 @@ public class ReferenceData {
|
|||
* from these newly converted polygons and the current Reference ID.
|
||||
*/
|
||||
private void convertToGrid() {
|
||||
if (grid != null && polygons == null) {
|
||||
if ((grid != null) && (polygons == null)) {
|
||||
coordType = CoordinateType.GRID;
|
||||
calcPolygons();
|
||||
}
|
||||
|
@ -339,7 +355,7 @@ public class ReferenceData {
|
|||
* ID.
|
||||
*/
|
||||
private void convertToLatLon() {
|
||||
if (grid != null && polygons == null) {
|
||||
if ((grid != null) && (polygons == null)) {
|
||||
coordType = CoordinateType.GRID;
|
||||
calcPolygons();
|
||||
}
|
||||
|
@ -361,11 +377,11 @@ public class ReferenceData {
|
|||
* @return
|
||||
*/
|
||||
public RefType refType() {
|
||||
if (query != null && query.length() > 0 && polygons != null) {
|
||||
if ((query != null) && (query.length() > 0) && (polygons != null)) {
|
||||
return RefType.QUERY_POLYGON;
|
||||
} else if (query != null && query.length() > 0) {
|
||||
} else if ((query != null) && (query.length() > 0)) {
|
||||
return RefType.QUERY;
|
||||
} else if (polygons != null || grid != null) {
|
||||
} else if ((polygons != null) || (grid != null)) {
|
||||
return RefType.POLYGON;
|
||||
}
|
||||
|
||||
|
@ -378,7 +394,7 @@ public class ReferenceData {
|
|||
* @return
|
||||
*/
|
||||
public boolean isQuery() {
|
||||
return query != null && query.length() > 0;
|
||||
return (query != null) && (query.length() > 0);
|
||||
}
|
||||
|
||||
// no implementation found in C++ source
|
||||
|
@ -509,13 +525,13 @@ public class ReferenceData {
|
|||
int endcol = -1;
|
||||
while (endcol < cols) {
|
||||
startcol = endcol + 1;
|
||||
while (startcol < cols && !grid.getAsBoolean(startcol, row)) {
|
||||
while ((startcol < cols) && !grid.getAsBoolean(startcol, row)) {
|
||||
startcol++;
|
||||
}
|
||||
|
||||
endcol = startcol + 1;
|
||||
if (startcol < cols) {
|
||||
while (endcol < cols && grid.getAsBoolean(endcol, row)) {
|
||||
while ((endcol < cols) && grid.getAsBoolean(endcol, row)) {
|
||||
endcol++;
|
||||
}
|
||||
|
||||
|
@ -674,11 +690,11 @@ public class ReferenceData {
|
|||
RefType type = refType();
|
||||
s.append(" Type: " + type);
|
||||
|
||||
if (type == RefType.POLYGON || type == RefType.QUERY_POLYGON) {
|
||||
if ((type == RefType.POLYGON) || (type == RefType.QUERY_POLYGON)) {
|
||||
// s.append(" Polygons: " + polygons);
|
||||
s.append(" CoordType: " + coordType);
|
||||
}
|
||||
if (type == RefType.QUERY || type == RefType.QUERY_POLYGON) {
|
||||
if ((type == RefType.QUERY) || (type == RefType.QUERY_POLYGON)) {
|
||||
s.append(" Query: " + query);
|
||||
}
|
||||
|
||||
|
@ -727,12 +743,13 @@ public class ReferenceData {
|
|||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
result = (prime * result)
|
||||
+ (coordType == null ? 0 : coordType.hashCode());
|
||||
result = prime * result + (gloc == null ? 0 : gloc.hashCode());
|
||||
result = prime * result + (grid == null ? 0 : grid.hashCode());
|
||||
result = prime * result + (polygons == null ? 0 : polygons.hashCode());
|
||||
result = prime * result + (query == null ? 0 : query.hashCode());
|
||||
result = (prime * result) + (gloc == null ? 0 : gloc.hashCode());
|
||||
result = (prime * result) + (grid == null ? 0 : grid.hashCode());
|
||||
result = (prime * result)
|
||||
+ (polygons == null ? 0 : polygons.hashCode());
|
||||
result = (prime * result) + (query == null ? 0 : query.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ import com.vividsolutions.jts.io.WKTWriter;
|
|||
* Apr 30, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager
|
||||
* Oct 17, 2014 2757 skorolev Corrected SQL in the getAdjacentZones to avoid duplicates.
|
||||
* Nov 03, 2014 3741 skorolev Updated getZoneCenter and added getStationCenter methods.
|
||||
* Dec 02, 2014 3841 skorolev Fixed possible duplicates in SQL expression.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -192,8 +191,7 @@ public class MonitorAreaUtils {
|
|||
+ zoneEnvelope
|
||||
+ "', -1), the_geom) "
|
||||
+ "and (catalogtype = 1 or catalogtype = 33 or catalogtype = 32 or catalogtype = 1000) order by stationid asc";
|
||||
// 1= CAT_TYPE_ICAO, 33=CAT_TYPE_CMAN ,
|
||||
// 32=CAT_TYPE_BUOY_FXD 1000=CAT_TYPE_MESONET see ObStation.java
|
||||
|
||||
ISpatialQuery sq = SpatialQueryFactory.create();
|
||||
Object[] results = sq.dbRequest(sql, META_DB);
|
||||
if (results.length != 0) {
|
||||
|
@ -601,9 +599,7 @@ public class MonitorAreaUtils {
|
|||
Coordinate stnCenter = null;
|
||||
ISpatialQuery sq = null;
|
||||
String sql = "select AsBinary(the_geom) from common_obs_spatial where stationid = '"
|
||||
+ stationid
|
||||
+ "'"
|
||||
+ "and (catalogtype = 1 or catalogtype = 33 or catalogtype = 32 or catalogtype = 1000)";
|
||||
+ stationid + "'";
|
||||
sq = SpatialQueryFactory.create();
|
||||
Object results[] = sq.dbRequest(sql, "metadata");
|
||||
if (results.length > 0) {
|
||||
|
|
141
edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FSSObsMonitorConfigurationManager.java
Normal file → Executable file
141
edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FSSObsMonitorConfigurationManager.java
Normal file → Executable file
|
@ -67,7 +67,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
* May 13 2014 3133 njensen getStationType returns String instead of ObsHistType
|
||||
* May 15 2014 3086 skorolev Renamed from MonitorConfigurationManager. Replaces three separate area configuration managers with one.
|
||||
* Sep 04 2014 3220 skorolev Added fileUpdated method.
|
||||
* Nov 21 2014 3841 skorolev Corrected addArea, addAdjArea and added getAdjAreaConfigXml.
|
||||
* Feb 24 2015 3220 dhladky Made sure config file is read in on change.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -128,21 +128,15 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
ss, fog, snow
|
||||
};
|
||||
|
||||
/** Instance of SAFESEAS monitor configuration manager. */
|
||||
private static FSSObsMonitorConfigurationManager ssInstance = new FSSObsMonitorConfigurationManager(
|
||||
MonName.ss.name());
|
||||
|
||||
/** Instance of Fog monitor configuration manager. */
|
||||
private static FSSObsMonitorConfigurationManager fogInstance = new FSSObsMonitorConfigurationManager(
|
||||
MonName.fog.name());
|
||||
|
||||
/** Instance of SNOW monitor configuration manager. */
|
||||
private static FSSObsMonitorConfigurationManager snowInstance = new FSSObsMonitorConfigurationManager(
|
||||
MonName.snow.name());
|
||||
|
||||
/** Localization Area Configuration File. */
|
||||
private LocalizationFile lacf = null;
|
||||
|
||||
/** Configuration XML is updated and saved */
|
||||
protected boolean isPopulated;
|
||||
|
||||
/** Singleton instance of this class */
|
||||
private static FSSObsMonitorConfigurationManager instance = null;
|
||||
|
||||
/**
|
||||
* Private Constructor
|
||||
*
|
||||
|
@ -150,6 +144,7 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
*/
|
||||
public FSSObsMonitorConfigurationManager(String monitorName) {
|
||||
setMonitorName(monitorName);
|
||||
setPopulated(false);
|
||||
// Avoid confusion in file path
|
||||
if (monitorName == MonName.ss.name()) {
|
||||
pluginName = "safeseas";
|
||||
|
@ -169,6 +164,21 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
readConfigXml();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an instance of Configuration manager for FSSObs monitors.
|
||||
*
|
||||
* @param monitor
|
||||
* Name of monitor
|
||||
* @return Instance of manager
|
||||
*/
|
||||
public static synchronized FSSObsMonitorConfigurationManager getInstance(
|
||||
String monitor) {
|
||||
if (instance == null) {
|
||||
instance = new FSSObsMonitorConfigurationManager(monitor);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads the XML configuration data for the current XML file name. filename:
|
||||
* monitor area config file name adjAreaFileName: adjacent areas config file
|
||||
|
@ -184,11 +194,11 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
|
||||
this.currentSite = lc.getContextName();
|
||||
lacf = pm.getLocalizationFile(lc, configFileName);
|
||||
lacf.addFileUpdatedObserver(this);
|
||||
String monitorAreaFilePath = lacf.getFile().getAbsolutePath();
|
||||
MonAreaConfigXML configXmltmp = jaxb
|
||||
.unmarshalFromXmlFile(monitorAreaFilePath.toString());
|
||||
configXml = configXmltmp;
|
||||
setPopulated(true);
|
||||
} catch (Exception e) {
|
||||
statusHandler
|
||||
.handle(Priority.WARN,
|
||||
|
@ -318,6 +328,7 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
newXmlFile.save();
|
||||
lacf = newXmlFile;
|
||||
lacf.addFileUpdatedObserver(this);
|
||||
setPopulated(true);
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.ERROR, e.getMessage());
|
||||
}
|
||||
|
@ -358,18 +369,21 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
* @param type
|
||||
* Type of zone
|
||||
*/
|
||||
public void addArea(AreaIdXML areaXML) {
|
||||
public void addArea(String areaId, ZoneType type) {
|
||||
List<AreaIdXML> areaXmlList = configXml.getAreaIds();
|
||||
boolean areaExists = false;
|
||||
String areaId = areaXML.getAreaId();
|
||||
for (AreaIdXML area : areaXmlList) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
area.setType(type);
|
||||
areaExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (areaExists == false) {
|
||||
configXml.addAreaId(areaXML);
|
||||
AreaIdXML area = new AreaIdXML();
|
||||
area.setAreaId(areaId);
|
||||
area.setType(type);
|
||||
configXml.addAreaId(area);
|
||||
if (!addedZones.contains(areaId)) {
|
||||
addedZones.add(areaId);
|
||||
}
|
||||
|
@ -528,11 +542,11 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the zones where station is monitoring
|
||||
* Gets an area of a station.
|
||||
*
|
||||
* @param stationId
|
||||
* The station to get the zones
|
||||
* @return List of zones
|
||||
* The station to get the area
|
||||
* @return List of areas
|
||||
*/
|
||||
public List<String> getAreaByStationId(String stationId) {
|
||||
List<String> results = new ArrayList<String>();
|
||||
|
@ -672,23 +686,6 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 from the monitoring area.
|
||||
*
|
||||
|
@ -792,15 +789,6 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
return configXml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Adjacent Configuration Xml
|
||||
*
|
||||
* @return the adjAreaConfigXml
|
||||
*/
|
||||
public MonAreaConfigXML getAdjAreaConfigXml() {
|
||||
return adjAreaConfigXml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Added Zones
|
||||
*
|
||||
|
@ -967,6 +955,24 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
FSSObsMonitorConfigurationManager.monitorName = monitorName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag is true if config file updated and saved.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isPopulated() {
|
||||
return isPopulated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets flag indicating that config file has been updated and saved.
|
||||
*
|
||||
* @param isPopulated
|
||||
*/
|
||||
public void setPopulated(boolean isPopulated) {
|
||||
this.isPopulated = isPopulated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Adjacent Area.
|
||||
*
|
||||
|
@ -985,49 +991,24 @@ public class FSSObsMonitorConfigurationManager implements
|
|||
/**
|
||||
* Add Adjacent Area.
|
||||
*
|
||||
* @param area
|
||||
* @param areaId
|
||||
* @param type
|
||||
*/
|
||||
public void addAdjArea(AreaIdXML areaXML) {
|
||||
public void addAdjArea(String areaId, ZoneType type) {
|
||||
List<AreaIdXML> adjAreaList = adjAreaConfigXml.getAreaIds();
|
||||
boolean areaExists = false;
|
||||
for (AreaIdXML area : adjAreaList) {
|
||||
if (area.getAreaId().equals(areaXML.getAreaId())) {
|
||||
if (area.getAreaId().equals(areaId)) {
|
||||
area.setType(type);
|
||||
areaExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (areaExists == false) {
|
||||
adjAreaConfigXml.addAreaId(areaXML);
|
||||
AreaIdXML area = new AreaIdXML();
|
||||
area.setAreaId(areaId);
|
||||
area.setType(type);
|
||||
adjAreaConfigXml.addAreaId(area);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fog monitor area configuration manager.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static FSSObsMonitorConfigurationManager getFogObsManager() {
|
||||
fogInstance.readConfigXml();
|
||||
return fogInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SAFESEAS monitor area configuration manager.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static FSSObsMonitorConfigurationManager getSsObsManager() {
|
||||
ssInstance.readConfigXml();
|
||||
return ssInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SNOW monitor area configuration manager.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static FSSObsMonitorConfigurationManager getSnowObsManager() {
|
||||
snowInstance.readConfigXml();
|
||||
return snowInstance;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.common.plugin.hpe.data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* An object to act as the HPE/BiasHPE text key
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 11, 2015 4121 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
public class HpeLabelKey {
|
||||
/** Product Name */
|
||||
private String productName;
|
||||
|
||||
/** Product date/time */
|
||||
private Date date;
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public HpeLabelKey() {
|
||||
|
||||
}
|
||||
|
||||
public HpeLabelKey(String productName, Date date) {
|
||||
this.productName = productName;
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the productName
|
||||
*/
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param productName
|
||||
* the productName to set
|
||||
*/
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the date
|
||||
*/
|
||||
public Date getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param date
|
||||
* the date to set
|
||||
*/
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((date == null) ? 0 : date.hashCode());
|
||||
result = prime * result
|
||||
+ ((productName == null) ? 0 : productName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
HpeLabelKey other = (HpeLabelKey) obj;
|
||||
if (date == null) {
|
||||
if (other.date != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!date.equals(other.date)) {
|
||||
return false;
|
||||
}
|
||||
if (productName == null) {
|
||||
if (other.productName != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!productName.equals(other.productName)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HpeLabelKey [productName=" + productName + ", date=" + date
|
||||
+ "]";
|
||||
}
|
||||
}
|
116
edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/DatMenuUtil.java
Normal file → Executable file
116
edexOsgi/com.raytheon.uf.edex.dat.utils/src/com/raytheon/uf/edex/dat/utils/DatMenuUtil.java
Normal file → Executable file
|
@ -43,6 +43,7 @@ import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager;
|
|||
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.DATA_TYPE;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.config.SCANRunSiteConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.xml.FFMPRunXML;
|
||||
import com.raytheon.uf.common.monitor.xml.ProductRunXML;
|
||||
|
@ -478,29 +479,30 @@ public class DatMenuUtil extends AbstractMenuUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates SAFESEAS Menu.
|
||||
* Creates Safeseas Menu.
|
||||
*/
|
||||
private void createSafeseasMenu() {
|
||||
FSSObsMonitorConfigurationManager ssConfig = FSSObsMonitorConfigurationManager
|
||||
.getSsObsManager();
|
||||
Set<String> ssStns = ssConfig.getStationIDs();
|
||||
StringBuilder stations = new StringBuilder();
|
||||
for (String s : ssStns) {
|
||||
if (stations.length() > 0) {
|
||||
stations.append(",");
|
||||
.getInstance(MonName.ss.name());
|
||||
Set<String> ssStns = ssConfig.getStationIDs();
|
||||
StringBuilder stations = new StringBuilder();
|
||||
for (String s : ssStns) {
|
||||
if (stations.length() > 0) {
|
||||
stations.append(",");
|
||||
}
|
||||
stations.append(s);
|
||||
}
|
||||
stations.append(s);
|
||||
}
|
||||
String ssStations = stations.toString();
|
||||
CommonMenuContributionFile safeMenuContributionFile = new CommonMenuContributionFile();
|
||||
safeMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
||||
safeMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
||||
safeMenuContributionFile.contribution[0] = processOtherContribution(
|
||||
ssStations, "menus/safeseas/baseSafeSeas.xml",
|
||||
"menu:obs?before=EndOfMaritime", "SAFESEAS",
|
||||
safeMenuContributionFile.contribution[0]);
|
||||
toXml(safeMenuContributionFile, "menus" + File.separator + "safeseas"
|
||||
+ File.separator + "index.xml");
|
||||
String ssStations = stations.toString();
|
||||
CommonMenuContributionFile safeMenuContributionFile = new CommonMenuContributionFile();
|
||||
safeMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
||||
safeMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
||||
safeMenuContributionFile.contribution[0] = processOtherContribution(
|
||||
ssStations, "menus/safeseas/baseSafeSeas.xml",
|
||||
"menu:obs?before=EndOfMaritime", "SAFESEAS",
|
||||
safeMenuContributionFile.contribution[0]);
|
||||
toXml(safeMenuContributionFile, "menus" + File.separator
|
||||
+ "safeseas" + File.separator + "index.xml");
|
||||
ssConfig = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -508,51 +510,53 @@ public class DatMenuUtil extends AbstractMenuUtil {
|
|||
*/
|
||||
private void createFogMenu() {
|
||||
FSSObsMonitorConfigurationManager fogConfig = FSSObsMonitorConfigurationManager
|
||||
.getFogObsManager();
|
||||
Set<String> fogStns = fogConfig.getStationIDs();
|
||||
StringBuilder stations = new StringBuilder();
|
||||
for (String s : fogStns) {
|
||||
if (stations.length() > 0) {
|
||||
stations.append(",");
|
||||
.getInstance(MonName.fog.name());
|
||||
Set<String> fogStns = fogConfig.getStationIDs();
|
||||
StringBuilder stations = new StringBuilder();
|
||||
for (String s : fogStns) {
|
||||
if (stations.length() > 0) {
|
||||
stations.append(",");
|
||||
}
|
||||
stations.append(s);
|
||||
}
|
||||
stations.append(s);
|
||||
}
|
||||
String fogStations = stations.toString();
|
||||
CommonMenuContributionFile fogMenuContributionFile = new CommonMenuContributionFile();
|
||||
fogMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
||||
fogMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
||||
fogMenuContributionFile.contribution[0] = processOtherContribution(
|
||||
fogStations, "menus/fog/baseFog.xml",
|
||||
"menu:obs?after=FOGPLACEHOLDER", "Fog Monitor",
|
||||
fogMenuContributionFile.contribution[0]);
|
||||
toXml(fogMenuContributionFile, "menus" + File.separator + "fog"
|
||||
+ File.separator + "index.xml");
|
||||
String fogStations = stations.toString();
|
||||
CommonMenuContributionFile fogMenuContributionFile = new CommonMenuContributionFile();
|
||||
fogMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
||||
fogMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
||||
fogMenuContributionFile.contribution[0] = processOtherContribution(
|
||||
fogStations, "menus/fog/baseFog.xml",
|
||||
"menu:obs?after=FOGPLACEHOLDER", "Fog Monitor",
|
||||
fogMenuContributionFile.contribution[0]);
|
||||
toXml(fogMenuContributionFile, "menus" + File.separator + "fog"
|
||||
+ File.separator + "index.xml");
|
||||
fogConfig = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates SNOW Menu.
|
||||
* Creates Snow Menu.
|
||||
*/
|
||||
private void createSnowMenu() {
|
||||
FSSObsMonitorConfigurationManager snowConfig = FSSObsMonitorConfigurationManager
|
||||
.getSnowObsManager();
|
||||
Set<String> snowStns = snowConfig.getStationIDs();
|
||||
StringBuilder stations = new StringBuilder();
|
||||
for (String s : snowStns) {
|
||||
if (stations.length() > 0) {
|
||||
stations.append(",");
|
||||
.getInstance(MonName.snow.name());
|
||||
Set<String> snowStns = snowConfig.getStationIDs();
|
||||
StringBuilder stations = new StringBuilder();
|
||||
for (String s : snowStns) {
|
||||
if (stations.length() > 0) {
|
||||
stations.append(",");
|
||||
}
|
||||
stations.append(s);
|
||||
}
|
||||
stations.append(s);
|
||||
}
|
||||
String snowStations = stations.toString();
|
||||
CommonMenuContributionFile snowMenuContributionFile = new CommonMenuContributionFile();
|
||||
snowMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
||||
snowMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
||||
snowMenuContributionFile.contribution[0] = processOtherContribution(
|
||||
snowStations, "menus/snow/baseSnow.xml",
|
||||
"menu:obs?after=SNOWPLACEHOLDER", "SNOW",
|
||||
snowMenuContributionFile.contribution[0]);
|
||||
toXml(snowMenuContributionFile, "menus" + File.separator + "snow"
|
||||
+ File.separator + "index.xml");
|
||||
String snowStations = stations.toString();
|
||||
CommonMenuContributionFile snowMenuContributionFile = new CommonMenuContributionFile();
|
||||
snowMenuContributionFile.contribution = new CommonIncludeMenuItem[1];
|
||||
snowMenuContributionFile.contribution[0] = new CommonIncludeMenuItem();
|
||||
snowMenuContributionFile.contribution[0] = processOtherContribution(
|
||||
snowStations, "menus/snow/baseSnow.xml",
|
||||
"menu:obs?after=SNOWPLACEHOLDER", "SNOW",
|
||||
snowMenuContributionFile.contribution[0]);
|
||||
toXml(snowMenuContributionFile, "menus" + File.separator + "snow"
|
||||
+ File.separator + "index.xml");
|
||||
snowConfig = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -132,6 +132,7 @@ public class FogConfig {
|
|||
// our new coverage boundaries including adjacent areas
|
||||
Geometry monitorAreaGeo = AdjacentWfoMgr.getAdjacentAreas(getCwa());
|
||||
// (SK) Geometry monitorAreaGeo =
|
||||
// FogDbUtils.getMonitoringAreaGeometry(filter.getCwaGeometry(),getCwa());
|
||||
setCenter(monitorAreaGeo.getCentroid().getCoordinate());
|
||||
Coordinate[] coords = monitorAreaGeo.getEnvelope().getCoordinates();
|
||||
this.upperLeftCorner = coords[1];
|
||||
|
|
File diff suppressed because it is too large
Load diff
71
edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsGenerator.java
Normal file → Executable file
71
edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsGenerator.java
Normal file → Executable file
|
@ -21,14 +21,13 @@
|
|||
package com.raytheon.uf.edex.plugin.fssobs;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.raytheon.edex.site.SiteUtil;
|
||||
import com.raytheon.edex.urifilter.URIFilter;
|
||||
import com.raytheon.edex.urifilter.URIGenerateMessage;
|
||||
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigEvent;
|
||||
import com.raytheon.uf.common.monitor.events.MonitorConfigListener;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -70,17 +69,10 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
|
|||
/** Product */
|
||||
private static final String productType = "fssobs";
|
||||
|
||||
/** All stations to be filtered. */
|
||||
private Set<String> allStations = null;
|
||||
/** Sets of all stations to filter for */
|
||||
private HashSet<String> allStations = null;
|
||||
|
||||
/** Fog monitor area configuration file */
|
||||
public FSSObsMonitorConfigurationManager fogAreaConfig = null;
|
||||
|
||||
/** SAFESEAS monitor area configuration file */
|
||||
public FSSObsMonitorConfigurationManager ssAreaConfig = null;
|
||||
|
||||
/** SNOW monitor area configuration file */
|
||||
public FSSObsMonitorConfigurationManager snowAreaConfig = null;
|
||||
private FSSObsMonitorConfigurationManager currManager = null;
|
||||
|
||||
/**
|
||||
* Public construction
|
||||
|
@ -148,14 +140,12 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
|
|||
+ " process Filter Config...");
|
||||
allStations = new HashSet<String>();
|
||||
|
||||
List<String> ssStations = getSSAreaConfig().getStations();
|
||||
allStations.addAll(ssStations);
|
||||
|
||||
List<String> fogStations = getFogAreaConfig().getStations();
|
||||
allStations.addAll(fogStations);
|
||||
|
||||
List<String> snowStations = getSnowAreaConfig().getStations();
|
||||
allStations.addAll(snowStations);
|
||||
for (MonName mname : MonName.values()) {
|
||||
currManager = new FSSObsMonitorConfigurationManager(mname.name());
|
||||
currManager.addListener(this);
|
||||
allStations.addAll(currManager.getStations());
|
||||
currManager = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -197,45 +187,4 @@ public class FSSObsGenerator extends CompositeProductGenerator implements
|
|||
dmu.createMenus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Fog monitor area configuration file.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public FSSObsMonitorConfigurationManager getFogAreaConfig() {
|
||||
if (fogAreaConfig == null) {
|
||||
fogAreaConfig = FSSObsMonitorConfigurationManager
|
||||
.getFogObsManager();
|
||||
fogAreaConfig.addListener(this);
|
||||
}
|
||||
return fogAreaConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets SAFESEAS monitor area configuration file.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public FSSObsMonitorConfigurationManager getSSAreaConfig() {
|
||||
if (ssAreaConfig == null) {
|
||||
ssAreaConfig = FSSObsMonitorConfigurationManager.getSsObsManager();
|
||||
ssAreaConfig.addListener(this);
|
||||
}
|
||||
return ssAreaConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets SNOW monitor area configuration file.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public FSSObsMonitorConfigurationManager getSnowAreaConfig() {
|
||||
if (snowAreaConfig == null) {
|
||||
snowAreaConfig = FSSObsMonitorConfigurationManager
|
||||
.getSnowObsManager();
|
||||
snowAreaConfig.addListener(this);
|
||||
}
|
||||
return snowAreaConfig;
|
||||
}
|
||||
}
|
||||
|
|
7
edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsURIFilter.java
Normal file → Executable file
7
edexOsgi/com.raytheon.uf.edex.plugin.fssobs/src/com/raytheon/uf/edex/plugin/fssobs/FSSObsURIFilter.java
Normal file → Executable file
|
@ -3,7 +3,7 @@ package com.raytheon.uf.edex.plugin.fssobs;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
import java.util.TimeZone;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -23,7 +23,6 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Dec 5, 2012 #1351 skorolev Cleaned code
|
||||
* Feb 15, 2013 1638 mschenke Moved DataURINotificationMessage to uf.common.dataplugin
|
||||
* Sep 04, 2014 3220 skorolev Removed CWA from filter.
|
||||
* Oct 17, 2014 3220 skorolev Replaced HashSet with Set.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -54,7 +53,7 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
private String dataType;
|
||||
|
||||
/** All filtered stations */
|
||||
private Set<String> stations = null;
|
||||
private HashSet<String> stations = null;
|
||||
|
||||
/** Date format **/
|
||||
private static String datePattern = "yyyy-MM-dd_HH:mm:ss.S";
|
||||
|
@ -73,7 +72,7 @@ public class FSSObsURIFilter extends URIFilter {
|
|||
* @param stations
|
||||
* for FSSObs filter
|
||||
*/
|
||||
public FSSObsURIFilter(String name, Set<String> stations) {
|
||||
public FSSObsURIFilter(String name, HashSet<String> stations) {
|
||||
super(name);
|
||||
logger.info("FSSObsFilter " + name + " Filter construction...");
|
||||
setDataTypes(new String[] { "obs", "sfcobs", "ldadmesonet" });
|
||||
|
|
11
edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java
Normal file → Executable file
11
edexOsgi/com.raytheon.uf.edex.plugin.loctables/src/com/raytheon/uf/edex/plugin/loctables/ingest/LocationTablesIngest.java
Normal file → Executable file
|
@ -29,6 +29,7 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
|
||||
import com.raytheon.uf.edex.ndm.ingest.IDataSetIngester;
|
||||
import com.raytheon.uf.edex.ndm.ingest.INationalDatasetSubscriber;
|
||||
import com.raytheon.uf.edex.plugin.loctables.util.CommonObsSpatialBuilder;
|
||||
|
@ -55,7 +56,6 @@ import com.raytheon.uf.edex.plugin.loctables.util.store.ObStationStoreStrategy;
|
|||
* Mar 06, 2014 2876 mpduff New NDM plugin.
|
||||
* Apr 28, 2014 3086 skorolev Updated setupLocalFiles method
|
||||
* Sep 04, 2014 3220 skorolev Removed parameter currentSite from FSSObs configuration managers.
|
||||
* Oct 17, 2014 3220 skorolev Corrected FSSObsMonitorConfigurationManager instances.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -128,9 +128,12 @@ public class LocationTablesIngest implements INationalDatasetSubscriber {
|
|||
private void setupLocalFiles() {
|
||||
List<FSSObsMonitorConfigurationManager> monitors = new ArrayList<FSSObsMonitorConfigurationManager>();
|
||||
|
||||
monitors.add(FSSObsMonitorConfigurationManager.getSsObsManager());
|
||||
monitors.add(FSSObsMonitorConfigurationManager.getFogObsManager());
|
||||
monitors.add(FSSObsMonitorConfigurationManager.getSnowObsManager());
|
||||
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.fog
|
||||
.name()));
|
||||
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.ss
|
||||
.name()));
|
||||
monitors.add(FSSObsMonitorConfigurationManager.getInstance(MonName.snow
|
||||
.name()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue