Issue #2176 Increased line width of emergency polygon and changed font for regular warning products.

Change-Id: Icb5456d038a8a2fadbe10f70a2ef32c8ba1f7816

Former-commit-id: a57cec0ed8 [formerly 61dd32d0244c9a6af8e63ed2b789cfa15d7c9539]
Former-commit-id: ce051787a7
This commit is contained in:
Jonathan Sanchez 2013-09-05 11:24:16 -05:00
parent d002ceea4d
commit 3f0c709b3f
8 changed files with 210 additions and 148 deletions

View file

@ -27,6 +27,7 @@ import com.raytheon.uf.common.activetable.ActiveTableMode;
import com.raytheon.uf.common.activetable.ActiveTableRecord;
import com.raytheon.uf.common.activetable.GetActiveTableRequest;
import com.raytheon.uf.common.activetable.GetActiveTableResponse;
import com.raytheon.uf.common.dataplugin.warning.EmergencyType;
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -48,6 +49,7 @@ import com.raytheon.viz.texteditor.util.VtecUtil;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 23, 2013 2176 jsanchez Initial creation
* Sep 4, 2013 2176 jsanchez Moved EmergencyType to a public class.
*
* </pre>
*
@ -62,38 +64,6 @@ public class EmergencyConfirmationMsg implements IWarnGenConfirmationable {
private String productMessage;
private static class EmergencyType {
private static final EmergencyType TORNADO = new EmergencyType(
"TORNADO EMERGENCY", "TO.W");
private static final EmergencyType FLASH_FLOOD = new EmergencyType(
"FLASH FLOOD EMERGENCY", "FF.W");
private final String value;
private final String phensig;
private final static EmergencyType[] values = new EmergencyType[] {
TORNADO, FLASH_FLOOD };
private EmergencyType(String type, String phensig) {
this.value = type;
this.phensig = phensig;
}
public static EmergencyType valueOf(String phensig) {
EmergencyType type = null;
for (EmergencyType t : values) {
if (t.phensig.equals(phensig)) {
type = t;
break;
}
}
return type;
}
};
/**
* Orders the ActiveTableRecord based on the issue time (ascending)
*/
@ -126,11 +96,11 @@ public class EmergencyConfirmationMsg implements IWarnGenConfirmationable {
// Check if the warning product is a valid EmergencyType.
if (type != null) {
boolean currentEmergency = body.contains("EMERGENCY");
boolean currentEmergency = EmergencyType.isEmergency(body);
if (action == WarningAction.NEW && currentEmergency) {
// Only occurs when the warning is first issued and not any
// other action
productMessage = "This is a " + type.value;
productMessage = "This is a " + type.getValue();
} else if (action == WarningAction.CON
|| action == WarningAction.EXT
|| action == WarningAction.CANCON) {
@ -159,14 +129,14 @@ public class EmergencyConfirmationMsg implements IWarnGenConfirmationable {
new ActiveTableRecordComparator());
ActiveTableRecord record = records
.get(records.size() - 1);
boolean wasEmergency = record.getRawmessage().contains(
"EMERGENCY");
boolean wasEmergency = EmergencyType.isEmergency(record
.getRawmessage());
if (!wasEmergency && currentEmergency) {
productMessage = "This is an upgrade of a "
+ type.value;
+ type.getValue();
} else if (wasEmergency && !currentEmergency) {
productMessage = "This is a downgrade of a "
+ type.value;
+ type.getValue();
}
}
} catch (VizException e) {

View file

@ -44,7 +44,6 @@ import java.util.Scanner;
import java.util.TimeZone;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -331,7 +330,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* 25July2013 15733 GHull Read font and color prefs from TextEditorCfg.
* 23Aug2013 DR 16514 D. Friedman Fix handling of completed product requests. Do not change
* command history or close browser window for "update obs".
*
* 04Sep2013 2176 jsanchez Changed the order of the QC check dialogs.
* </pre>
*
* @author lvenable
@ -2952,20 +2951,23 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* The font size sub menu.
*/
private void createFontSizeSubMenu(Menu fontSizeSubMenu) {
FontSizeCfg fontSizeCfg = TextEditorCfg.getTextEditorCfg().getFontSizeCfg();
SizeButtonCfg seldFontBtn = TextEditorCfg.getTextEditorCfg().getSelectedFontButton();
FontSizeCfg fontSizeCfg = TextEditorCfg.getTextEditorCfg()
.getFontSizeCfg();
SizeButtonCfg seldFontBtn = TextEditorCfg.getTextEditorCfg()
.getSelectedFontButton();
for (SizeButtonCfg buttonCfg : fontSizeCfg.getButtons()) {
MenuItem item = new MenuItem(fontSizeSubMenu, SWT.RADIO);
item.setText(buttonCfg.getLabelName());
item.setSelection( false );
item.setSelection(false);
item.setData(buttonCfg);
// if this button is the initial selection.
if( seldFontBtn.getLabelName().equals( buttonCfg.getLabelName() ) ) {
if (seldFontBtn.getLabelName().equals(buttonCfg.getLabelName())) {
item.setSelection(true);
setDefaultFont( seldFontBtn.getFontSize(), seldFontBtn.getFontName() );
setDefaultFont(seldFontBtn.getFontSize(),
seldFontBtn.getFontName());
}
item.addSelectionListener(new SelectionAdapter() {
@ -2973,10 +2975,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
public void widgetSelected(SelectionEvent event) {
MenuItem item = (MenuItem) event.getSource();
if (item.getSelection()) {
int selectFontSize = ( (SizeButtonCfg) item.getData()).getFontSize();
String seldFontName = ((SizeButtonCfg) item.getData()).getFontName();
setDefaultFont( selectFontSize, seldFontName );
int selectFontSize = ((SizeButtonCfg) item.getData())
.getFontSize();
String seldFontName = ((SizeButtonCfg) item.getData())
.getFontName();
setDefaultFont(selectFontSize, seldFontName);
textEditor.setFont(dftFont);
headerTF.setFont(dftFont);
@ -2987,8 +2991,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
}
public void setDefaultFont( int fontSize, String fontName ) {
dftFont = new Font( getDisplay(), fontName, fontSize, SWT.NORMAL);
public void setDefaultFont(int fontSize, String fontName) {
dftFont = new Font(getDisplay(), fontName, fontSize, SWT.NORMAL);
}
/**
@ -3723,7 +3727,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
textEditorComp = new Composite(shell, SWT.NONE);
GridLayout gridLayout = new GridLayout(1, false);
// TextColorsCfg textColorCfg = null;
// TextColorsCfg textColorCfg = null;
textEditorComp.setLayout(gridLayout);
textEditorComp.setLayoutData(gd);
@ -3745,8 +3749,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
airportToolTip = new DefaultToolTip(textEditor, SWT.DEFAULT, true);
textEditor.setKeyBinding(SWT.INSERT, SWT.NULL); // DR 7826
// textColorCfg = getTextColorCfg();
setDefaultTextColor( TextEditorCfg.getTextEditorCfg() );
// textColorCfg = getTextColorCfg();
setDefaultTextColor(TextEditorCfg.getTextEditorCfg());
textEditor.setForeground(textForeground);
textEditor.setBackground(textBackground);
@ -3948,42 +3952,46 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
});
}
// private TextColorsCfg getTextColorCfg() {
// TextColorsCfg textColorsCfg = TextEditorCfg.getTextEditorCfg().getTextColorsCfg();
//
// // Perform Sanity Checks on configuration.
// StringBuilder message = new StringBuilder();
//
// for (TextColorElement textElm : textColorsCfg.getTextColorElements()) {
// String prmtName = textElm.getParamName();
// if (prmtName == null) {
// message.append("Item \"paramName\" problem!\n");
//
// }
//
// if( textElm.getColor() == null ) {
// message.append("Item \"color\" data enter problem!\n");
// }
//
// if (message.length() > 0) {
// message.insert(0, "TextColorsCfg broblem(s): ");
// IUFStatusHandler statusHandler = UFStatus
// .getHandler(TextEditorDialog.class);
// statusHandler.handle(Priority.PROBLEM, message.toString());
// }
//
// }
//
// return textColorsCfg;
// }
// private TextColorsCfg getTextColorCfg() {
// TextColorsCfg textColorsCfg =
// TextEditorCfg.getTextEditorCfg().getTextColorsCfg();
//
// // Perform Sanity Checks on configuration.
// StringBuilder message = new StringBuilder();
//
// for (TextColorElement textElm : textColorsCfg.getTextColorElements()) {
// String prmtName = textElm.getParamName();
// if (prmtName == null) {
// message.append("Item \"paramName\" problem!\n");
//
// }
//
// if( textElm.getColor() == null ) {
// message.append("Item \"color\" data enter problem!\n");
// }
//
// if (message.length() > 0) {
// message.insert(0, "TextColorsCfg broblem(s): ");
// IUFStatusHandler statusHandler = UFStatus
// .getHandler(TextEditorDialog.class);
// statusHandler.handle(Priority.PROBLEM, message.toString());
// }
//
// }
//
// return textColorsCfg;
// }
private void setDefaultTextColor(TextEditorCfg txtClrCfg ) {
textBackground = new Color( shell.getDisplay(), txtClrCfg.getTextBackgroundColor() );
textForeground = new Color(shell.getDisplay(), txtClrCfg.getTextForegroundColor() );
highlightBackground = new Color(shell.getDisplay(), txtClrCfg.getHighlightTextBackgroundColor() );
highlightForeground = new Color(shell.getDisplay(), txtClrCfg.getHighlightTextForegroundColor() );
private void setDefaultTextColor(TextEditorCfg txtClrCfg) {
textBackground = new Color(shell.getDisplay(),
txtClrCfg.getTextBackgroundColor());
textForeground = new Color(shell.getDisplay(),
txtClrCfg.getTextForegroundColor());
highlightBackground = new Color(shell.getDisplay(),
txtClrCfg.getHighlightTextBackgroundColor());
highlightForeground = new Color(shell.getDisplay(),
txtClrCfg.getHighlightTextForegroundColor());
}
/**
@ -4858,14 +4866,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
@Override
public void dialogClosed(Object returnValue) {
if (Boolean.TRUE.equals(returnValue)) {
checkEmergencyProduct(resend);
finishSendProduct(resend);
}
}
});
wgcd.open();
} else {
checkEmergencyProduct(resend);
finishSendProduct(resend);
}
} else {
finishSendProduct(resend);
@ -4915,7 +4923,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
@Override
public void dialogClosed(Object returnValue) {
if (Boolean.TRUE.equals(returnValue)) {
warngenCloseCallback(resend);
checkEmergencyProduct(resend);
}
}
});
@ -4943,14 +4951,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
@Override
public void dialogClosed(Object returnValue) {
if (Boolean.TRUE.equals(returnValue)) {
finishSendProduct(resend);
warngenCloseCallback(resend);
}
}
});
wgcd.open();
} else {
finishSendProduct(resend);
warngenCloseCallback(resend);
}
}
@ -5903,7 +5911,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
return;
}
if (! isObsUpdated) {
if (!isObsUpdated) {
if (browser != null) {
browser.close();
browser = null;
@ -6097,7 +6105,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
private void postExecute(boolean hasAttachment, boolean enterEditor,
boolean validExecuteCommand, String attachedFilename) {
if (!this.isDisposed()) {
if (! productQueryJob.isExpectingRequests()) {
if (!productQueryJob.isExpectingRequests()) {
if (hasAttachment) {
statusBarLabel.setText("Attachment: " + attachedFilename);
} else {

View file

@ -20,6 +20,7 @@
package com.raytheon.viz.warngen.gui;
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
import com.raytheon.uf.common.dataplugin.warning.EmergencyType;
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil;
@ -39,6 +40,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* Aug 7, 2013 2243 jsanchez Set all the attributes of an AbstractWarningRecord and added an expiration string. Removed calendar object.
* Aug 15,2013 2243 jsanchez Improved the expiration string off by one minute. Fixed for practice mode.
* Aug 15,2013 2243 jsanchez Improved the expiration string off by one minute.
* Sep 4,2013 2176 jsanchez Used EmergencyType class to identify emergency products.
* </pre>
*
* @author rferrel
@ -96,8 +98,8 @@ public class FollowupData extends AbstractWarningRecord {
rval.append(buildExpStr(status, record));
}
if (record.getRawmessage().contains("EMERGENCY")) {
rval.append(" EMER");
if (EmergencyType.isEmergency(record.getRawmessage())) {
rval.append(" " + EmergencyType.EMER);
}
equvialentString = rval.substring(0,
record.getProductClass().equals("T") ? 20 : 18);

View file

@ -15,6 +15,7 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord;
import com.raytheon.uf.common.dataplugin.warning.EmergencyType;
import com.raytheon.uf.common.dataplugin.warning.PracticeWarningRecord;
import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
@ -80,6 +81,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* Remove frameAltered condition in matchesFrame. It prevented entries from being displayed.
* Check if geometry is null when inspecting.
* Jul 22, 2013 2176 jsanchez Updated the wire frame and text for EMERGENCY warnings.
* Sep 4, 2013 2176 jsanchez Made the polygon line width thicker and made regular text not bold.
* </pre>
*
* @author jsanchez
@ -133,7 +135,9 @@ public abstract class AbstractWWAResource extends
/** map of dataURI to a warning entry **/
protected Map<String, WarningEntry> entryMap;
protected IFont warningsFont;
protected IFont warningsFont = null;
protected IFont emergencyFont = null;
protected RGB color;
@ -368,8 +372,8 @@ public abstract class AbstractWWAResource extends
int outlineWidth = getCapability(OutlineCapability.class)
.getOutlineWidth();
// Make wire frame outline thicker for EMERGENCY warnings
if (record.getRawmessage().contains("EMERGENCY")) {
outlineWidth *= 2;
if (EmergencyType.isEmergency(record.getRawmessage())) {
outlineWidth *= 3;
}
target.drawWireframeShape(
@ -398,7 +402,10 @@ public abstract class AbstractWWAResource extends
* paintProps.getZoomLevel() / 1000;
String[] textToPrint = getText(record, mapWidth);
if (warningsFont == null) {
warningsFont = target.getDefaultFont().deriveWithSize(
warningsFont = target.initializeFont(target
.getDefaultFont().getFontName(), 11,
new IFont.Style[0]);
emergencyFont = target.getDefaultFont().deriveWithSize(
11);
}
// DR14992: reverse the textToPrint array to plot the
@ -418,15 +425,24 @@ public abstract class AbstractWWAResource extends
params.verticallAlignment = VerticalAlignment.BOTTOM;
params.magnification = getCapability(
MagnificationCapability.class).getMagnification();
target.drawStrings(params);
// Draws the string again to have it appear bolder
if (textToPrintReversed[2].endsWith("EMER")) {
params.setText(new String[] { "", "", "EMER", "" },
color);
target.drawStrings(params);
if (EmergencyType.isEmergency(record.getRawmessage())) {
// moves over text to add EMER in a different font
textToPrintReversed[2] = String.format("%1$-21" + "s",
textToPrintReversed[2]);
params.setText(textToPrintReversed, color);
DrawableString emergencyString = new DrawableString(
params);
emergencyString.font = emergencyFont;
emergencyString.setText(new String[] { "", "",
" " + EmergencyType.EMER, "" }, color);
target.drawStrings(emergencyString);
}
target.drawStrings(params);
}
}
}
@ -598,12 +614,7 @@ public abstract class AbstractWWAResource extends
textToPrint[0] += "." + vid;
}
textToPrint[0] += "." + record.getEtn();
if (record.getRawmessage().contains("EMERGENCY")) {
textToPrint[1] = record.getPil() + " EMER";
} else {
textToPrint[1] = record.getPil();
}
textToPrint[1] = record.getPil();
SimpleDateFormat startFormat = DEFAULT_FORMAT;
SimpleDateFormat endFormat = DEFAULT_FORMAT;

View file

@ -60,7 +60,8 @@ import com.vividsolutions.jts.geom.Geometry;
* Sep 27, 2012 1149 jsanchez Refactored methods from AbstractWarningsResource into this class.
* Apr 18, 2013 1877 jsanchez Ordered the records the same for update and initial load.
* Removed no longer needed frameAltered. Do not set wire frame for a CAN.
* Jul 24, 2013 DR16350 mgamazaychikov Fix the problem with plotting EXP warning
* Jul 24, 2013 DR16350 mgamazaychikov Fix the problem with plotting EXP warning
* Sep 5, 2013 2176 jsanchez Disposed the emergency font.
* </pre>
*
* @author jsanchez
@ -143,6 +144,10 @@ public class WarningsResource extends AbstractWWAResource {
if (warningsFont != null) {
warningsFont.dispose();
}
if (emergencyFont != null) {
emergencyFont.dispose();
}
}
@Override
@ -234,7 +239,7 @@ public class WarningsResource extends AbstractWWAResource {
for (AbstractWarningRecord warnrec : recordsToLoad) {
WarningAction act = WarningAction.valueOf(warnrec.getAct());
if (act == WarningAction.CON || act == WarningAction.CAN
|| act == WarningAction.EXT) {
|| act == WarningAction.EXT) {
AbstractWarningRecord createShape = null;
for (String key : entryMap.keySet()) {
WarningEntry entry = entryMap.get(key);

View file

@ -49,6 +49,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* Sep 27, 2012 1149 jsanchez Refactored methods from AbstractWarningsResource into this class.
* May 06, 2013 1930 bsteffen Check for null in WatchesResource.
* May 10, 2013 1951 rjpeter Updated ugcZones references
* Sep 5, 2013 2176 jsanchez Disposed the emergency font.
* </pre>
*
* @author jsanchez
@ -140,6 +141,10 @@ public class WatchesResource extends AbstractWWAResource {
if (warningsFont != null) {
warningsFont.dispose();
}
if (emergencyFont != null) {
emergencyFont.dispose();
}
}
@Override

View file

@ -0,0 +1,91 @@
/**
* 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.dataplugin.warning;
/**
* Helps manage and identify emergency products.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 4, 2013 2176 jsanchez Initial creation
*
* </pre>
*
* @author jsanchez
* @version 1.0
*/
public class EmergencyType {
public static final String EMER = "EMER";
private static final EmergencyType TORNADO = new EmergencyType(
"TORNADO EMERGENCY", "TO.W");
private static final EmergencyType FLASH_FLOOD = new EmergencyType(
"FLASH FLOOD EMERGENCY", "FF.W");
private final String value;
private final String phensig;
private final static EmergencyType[] values = new EmergencyType[] {
TORNADO, FLASH_FLOOD };
private EmergencyType(String type, String phensig) {
this.value = type;
this.phensig = phensig;
}
public static EmergencyType valueOf(String phensig) {
EmergencyType type = null;
for (EmergencyType t : values) {
if (t.phensig.equals(phensig)) {
type = t;
break;
}
}
return type;
}
/**
* Checks to see if the text product is an emergency product.
*
* @param rawmessage
* @return
*/
public static boolean isEmergency(String rawmessage) {
for (EmergencyType type : values) {
if (rawmessage != null && rawmessage.contains(type.getValue())) {
return true;
}
}
return false;
}
public String getValue() {
return value;
}
}

View file

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<!--
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.
-->
<configuration>
<warngenOfficeShort>OMAHA/VALLEY NE</warngenOfficeShort>
<warngenOfficeLoc>OMAHA</warngenOfficeLoc>
<backupCWAs>EAX/KANSAS CITY,DMX/DES MOINES,BOX/BOSTON,LBF/NORTH PLATTE,PQR/PORTLAND</backupCWAs>
<siteNode>OMA</siteNode>
<defaultTemplate>severethunderstorm</defaultTemplate>
<mainWarngenProducts>Flash Flood/ffw,Severe Thunderstorm/severethunderstorm,Tornado/tornado</mainWarngenProducts>
<otherWarngenProducts>Severe Weather Statement/SVS,Flash Flood Statement/ffs,non-convective FFW (Dam Break)/dambreak,non-convective Flash Flood Statement/dambreakffs,Areal Flood Warning/flw,Areal Flood Warning Followup/fls,Areal Flood Advisory/fla,Areal Flood Advisory Followup/flas,Special Marine Warning/smw,Marine Weather Statement (SMW Follow)/smws,Marine Weather Statement standalone/marinestatement,Short Term Forecast/shortterm,Special Weather Statement (zones)/sws</otherWarngenProducts>
<followupListRefreshDelay>5000</followupListRefreshDelay>
</configuration>