diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractAWTFont.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractAWTFont.java index 667e9374f4..699e3335f6 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractAWTFont.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractAWTFont.java @@ -34,6 +34,8 @@ import java.util.List; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 24, 2013 2189 mschenke Initial creation + * Sep 13, 2013 16581 kshrestha Variables scaleFont and smoothing + * initialized to true. * * * @@ -45,9 +47,9 @@ public abstract class AbstractAWTFont implements IFont { protected Font font; - protected boolean scaleFont; + protected boolean scaleFont = true; - protected boolean smoothing; + protected boolean smoothing = true; protected AbstractAWTFont(String fontName, float fontSize, Style[] styles) { this(new Font(fontName, toAwtStyle(styles), (int) fontSize)); diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/AbstractGriddedDisplay.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/AbstractGriddedDisplay.java index e1a0fe52f9..db50729cbe 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/AbstractGriddedDisplay.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/AbstractGriddedDisplay.java @@ -68,6 +68,8 @@ import com.vividsolutions.jts.geom.Coordinate; * Aug 27, 2013 #2287 randerso Replaced hard coded constant with densityFactor * parameter to allow application specific density * scaling to better match A1 displays + * Sep 10, 2013 DR 16257 MPorricelli Fix so that wind for global grids displays on + * mercator maps. * * * @@ -215,14 +217,31 @@ public abstract class AbstractGriddedDisplay implements IRenderable { // space // Linear distance(between (0,0) and (0,1) makes more sense but // looks to sparse. - DirectPosition2D p1 = new DirectPosition2D(0, 0); - DirectPosition2D p2 = new DirectPosition2D(1, 1); - try { - grid2grid.transform(p1, p1); - grid2grid.transform(p2, p2); - } catch (TransformException e) { - throw new VizException(e); - } + DirectPosition2D p1 = new DirectPosition2D(); + DirectPosition2D p2 = new DirectPosition2D(); + + boolean doneTryingCoords = false; + int i = -1; + // starting with coords (0,0), (1,1), try until tranform succeeds, + // or until have gone through a set of diagonal coords + do { + try { + i++; + if (i + 1 < gridDims[0] && i + 1 < gridDims[1]) { + p1.x = p1.y = i; + p2.x = p2.y = i + 1; + grid2grid.transform(p1, p1); + grid2grid.transform(p2, p2); + doneTryingCoords = true; + } + } catch (TransformException e) { + if (i + 1 >= gridDims[0] || i + 1 >= gridDims[1]) { + doneTryingCoords = true; + throw new VizException(e); + } + } + } while (!doneTryingCoords); + pixelSize = p1.distance(p2); IExtent viewPixelExtent = paintProps.getView().getExtent(); diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java index e906f0d79f..321186e971 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/GriddedVectorDisplay.java @@ -61,6 +61,10 @@ import com.vividsolutions.jts.geom.Coordinate; * adjustment of density. * Added gridRelative flag to indicate whether direction * data is relative to grid or true north + * Sep 9, 2013 DR16257 MPorricelli When setDestinationGeographicPoint fails (which can + * happen for global lat/lon grid winds displayed on + * Equidistant Cylindrical map) try again with different + * pixel location. * * * @@ -157,7 +161,7 @@ public class GriddedVectorDisplay extends AbstractGriddedDisplay { if (Float.isNaN(spd) || Float.isNaN(dir)) { return; } - + int tryDiffPixLoc = 0; try { ReferencedCoordinate rCoord = new ReferencedCoordinate( gridGeometryOfGrid, ijcoord); @@ -169,12 +173,24 @@ public class GriddedVectorDisplay extends AbstractGriddedDisplay { if (stationPixelLocation != null) { stationPixelLocation[1]--; - double[] newWorldLocation = this.descriptor - .pixelToWorld(stationPixelLocation); - this.gc.setStartingGeographicPoint(stationLocation[0], - stationLocation[1]); - this.gc.setDestinationGeographicPoint(newWorldLocation[0], - newWorldLocation[1]); + do { + try { + double[] newWorldLocation = this.descriptor + .pixelToWorld(stationPixelLocation); + this.gc.setStartingGeographicPoint(stationLocation[0], + stationLocation[1]); + this.gc.setDestinationGeographicPoint( + newWorldLocation[0], newWorldLocation[1]); + tryDiffPixLoc = 2; // setting of pts succeeded; do not need to try again + + } catch (Exception e2) { + if (tryDiffPixLoc == 0) { // setting of points failed first time through + stationPixelLocation[1] += 2; // try pixel location in opposite dir of 1st try + tryDiffPixLoc++; + } else + throw new VizException(e2); // failed on second try; give up + } + } while (tryDiffPixLoc < 2); } if (gridRelative) { @@ -185,6 +201,7 @@ public class GriddedVectorDisplay extends AbstractGriddedDisplay { // rotate dir from true north to display up dir -= this.gc.getAzimuth(); + } catch (Exception e) { throw new VizException(e); } diff --git a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/PlotLocationCache.java b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/PlotLocationCache.java index b38f451b56..7495ed6b1e 100644 --- a/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/PlotLocationCache.java +++ b/cave/com.raytheon.viz.core.contours/src/com/raytheon/viz/core/contours/rsc/displays/PlotLocationCache.java @@ -44,6 +44,10 @@ import org.opengis.referencing.operation.TransformException; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Oct 13, 2011 bsteffen Initial creation + * Sep 10, 2013 DR 16257 MPorricelli Eliminate values that + * fail to be tranformed,e.g. + * when too close to pole for + * mercator projections * * * @@ -146,7 +150,19 @@ public class PlotLocationCache { ConcatenatedTransform.create(grid2crs, crs2crs), crs2grid); - grid2grid.transform(result, 0, result, 0, xDim * yDim); + try { + grid2grid.transform(result, 0, result, 0, xDim * yDim); + } catch (TransformException e1) { + // Set values to NaN when fail transform + for (int i = 0; i < result.length; i += 2) { + try { + grid2grid.transform(result, i, result, i, 1); + } catch (TransformException e2) { + result[i] = Float.NaN; + result[i + 1] = Float.NaN; + } + } + } } catch (FactoryException e) { throw new RuntimeException(e); } catch (InvalidGridGeometryException e) { diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/EmergencyConfirmationMsg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/EmergencyConfirmationMsg.java index 52540b778c..84ea2d9712 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/EmergencyConfirmationMsg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/EmergencyConfirmationMsg.java @@ -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. * * * @@ -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) { diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java index 6ab357941e..f933aa7674 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java @@ -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. * * * @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 { diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java index 3e9e82b24f..f9a16efd4c 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/config/DbAreaSourceDataAdaptor.java @@ -40,6 +40,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; * Mar 25, 2013 1605 jsanchez Set ClosestPoint's prepGeom. * Apr 24, 2013 1944 jsanchez Updated calculateLocationPortion visibility to public. * May 2, 2013 1963 jsanchez Referenced calculatePortion from GisUtil if intersection less than DEFAULT_PORTION_TOLERANCE. + * Sep 13, 2013 DR 16601 D. Friedman Fix from jsanchez: Allow cities outside the CWA. * * * @@ -156,8 +157,6 @@ public class DbAreaSourceDataAdaptor extends AbstractDbSourceDataAdaptor { filter = new HashMap(); } - filter.put(cwaField, new RequestConstraint(localizedSite)); - return filter; } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/FollowupData.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/FollowupData.java index 90abe1fc73..ef06609c0c 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/FollowupData.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/FollowupData.java @@ -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. * * * @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); diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java index 34424f20bd..c796d18a46 100644 --- a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java +++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/AbstractWWAResource.java @@ -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. * * * @author jsanchez @@ -133,7 +135,9 @@ public abstract class AbstractWWAResource extends /** map of dataURI to a warning entry **/ protected Map 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; diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java index 206f92ce98..45a5567ffa 100644 --- a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java +++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WarningsResource.java @@ -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. * * * @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); diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WatchesResource.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WatchesResource.java index 9580cfa9e6..6b4b755a75 100644 --- a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WatchesResource.java +++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WatchesResource.java @@ -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. * * * @author jsanchez @@ -140,6 +141,10 @@ public class WatchesResource extends AbstractWWAResource { if (warningsFont != null) { warningsFont.dispose(); } + + if (emergencyFont != null) { + emergencyFont.dispose(); + } } @Override diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/EmergencyType.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/EmergencyType.java new file mode 100644 index 0000000000..bcb1ff1d76 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/EmergencyType.java @@ -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. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Sep  4, 2013  2176      jsanchez     Initial creation
+ * 
+ * 
+ * + * @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; + } + +} diff --git a/localization/localization.OAX/utility/common_static/site/OAX/warngen/config.xml b/localization/localization.OAX/utility/common_static/site/OAX/warngen/config.xml deleted file mode 100644 index 608df36aa5..0000000000 --- a/localization/localization.OAX/utility/common_static/site/OAX/warngen/config.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - OMAHA/VALLEY NE - OMAHA - EAX/KANSAS CITY,DMX/DES MOINES,BOX/BOSTON,LBF/NORTH PLATTE,PQR/PORTLAND - OMA - severethunderstorm - Flash Flood/ffw,Severe Thunderstorm/severethunderstorm,Tornado/tornado - 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 - 5000 - \ No newline at end of file