diff --git a/cave/com.raytheon.viz.warnings/localization/bundles/AllWWA.xml b/cave/com.raytheon.viz.warnings/localization/bundles/AllWWA.xml new file mode 100644 index 0000000000..6a78b19cc9 --- /dev/null +++ b/cave/com.raytheon.viz.warnings/localization/bundles/AllWWA.xml @@ -0,0 +1,192 @@ + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.warnings/localization/bundles/ConvWWA.xml b/cave/com.raytheon.viz.warnings/localization/bundles/ConvWWA.xml new file mode 100644 index 0000000000..884f0946bb --- /dev/null +++ b/cave/com.raytheon.viz.warnings/localization/bundles/ConvWWA.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PLAN_VIEW + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.warnings/localization/bundles/FireWWA.xml b/cave/com.raytheon.viz.warnings/localization/bundles/FireWWA.xml new file mode 100644 index 0000000000..57cde11062 --- /dev/null +++ b/cave/com.raytheon.viz.warnings/localization/bundles/FireWWA.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.warnings/localization/bundles/FloodWWA.xml b/cave/com.raytheon.viz.warnings/localization/bundles/FloodWWA.xml new file mode 100644 index 0000000000..ad2584ca8c --- /dev/null +++ b/cave/com.raytheon.viz.warnings/localization/bundles/FloodWWA.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.warnings/localization/bundles/MarineWWA.xml b/cave/com.raytheon.viz.warnings/localization/bundles/MarineWWA.xml new file mode 100644 index 0000000000..f2c719def0 --- /dev/null +++ b/cave/com.raytheon.viz.warnings/localization/bundles/MarineWWA.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.warnings/localization/bundles/OtherWWA.xml b/cave/com.raytheon.viz.warnings/localization/bundles/OtherWWA.xml new file mode 100644 index 0000000000..08abfd0060 --- /dev/null +++ b/cave/com.raytheon.viz.warnings/localization/bundles/OtherWWA.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.warnings/localization/bundles/SPS.xml b/cave/com.raytheon.viz.warnings/localization/bundles/SPS.xml new file mode 100644 index 0000000000..da60b436bc --- /dev/null +++ b/cave/com.raytheon.viz.warnings/localization/bundles/SPS.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.warnings/localization/bundles/WindWWA.xml b/cave/com.raytheon.viz.warnings/localization/bundles/WindWWA.xml new file mode 100644 index 0000000000..4aca8d12e1 --- /dev/null +++ b/cave/com.raytheon.viz.warnings/localization/bundles/WindWWA.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.warnings/localization/bundles/WinterWWA.xml b/cave/com.raytheon.viz.warnings/localization/bundles/WinterWWA.xml new file mode 100644 index 0000000000..6f09ea6b2e --- /dev/null +++ b/cave/com.raytheon.viz.warnings/localization/bundles/WinterWWA.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cave/com.raytheon.viz.warnings/localization/menus/warnings/baseWarnings.xml b/cave/com.raytheon.viz.warnings/localization/menus/warnings/baseWarnings.xml index b7bbe5af61..1c0a4add35 100644 --- a/cave/com.raytheon.viz.warnings/localization/menus/warnings/baseWarnings.xml +++ b/cave/com.raytheon.viz.warnings/localization/menus/warnings/baseWarnings.xml @@ -1,172 +1,120 @@ - - - - - - - - - - - - - - - + + + + - - - - - - - + + + + + - - - - - - - - - - - - - - + - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cave/com.raytheon.viz.warnings/plugin.xml b/cave/com.raytheon.viz.warnings/plugin.xml index 6289b19e2f..1ec07c86ac 100644 --- a/cave/com.raytheon.viz.warnings/plugin.xml +++ b/cave/com.raytheon.viz.warnings/plugin.xml @@ -37,4 +37,12 @@ name="Warnings"> + + + + 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 ddb7e7a545..0cf91bb479 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 @@ -20,6 +20,7 @@ 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.dataplugin.warning.util.WarningLookups; import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType; import com.raytheon.uf.common.geospatial.ReferencedCoordinate; @@ -32,6 +33,7 @@ import com.raytheon.uf.common.time.TimeRange; import com.raytheon.uf.common.time.util.TimeUtil; import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.IGraphicsTarget; +import com.raytheon.uf.viz.core.RGBColors; import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle; import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment; @@ -51,6 +53,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; import com.raytheon.uf.viz.datacube.DataCubeContainer; import com.raytheon.viz.core.mode.CAVEMode; +import com.raytheon.viz.warnings.ui.DrawingPropertiesDialog; import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.GeometryFactory; @@ -91,6 +94,10 @@ import org.locationtech.jts.geom.prep.PreparedGeometryFactory; * Oct 16, 2015 4971 bsteffen Do not reverse order of text. * Nov 05, 2015 5070 randerso Adjust font sizes for dpi scaling * Aug 22, 2016 5842 dgilling Remove dependency on viz.texteditor plugin. + * Dec 19, 2018 ---- mjames@ucar Added phensig color table lookup. + * Mar 15, 2022 srcarter@ucar Add support for display settings for outline, fill, text and time displays + * Jun 24, 2022 srcarter@ucar Add 'statement/other' display settings, set enabled for only relevant WWA types + * Jun 28, 2022 srcarter@ucar Display sampling based on new 'sampling' settings * * * @@ -131,7 +138,73 @@ public abstract class AbstractWWAResource extends protected boolean project = false; } - + + /** Whether to display warning outlines by default */ + public static final boolean WARN_OUTLINE_DEFAULT = true; + /** Whether to display warning fill by default */ + public static final boolean WARN_FILL_DEFAULT = false; + /** Whether to display warning text by default */ + public static final boolean WARN_TEXT_DEFAULT = true; + /** Whether to display warning times by default */ + public static final boolean WARN_TIME_DEFAULT = true; + /** Whether to display watch outlines by default */ + public static final boolean WATCH_OUTLINE_DEFAULT = false; + /** Whether to display watch fill by default */ + public static final boolean WATCH_FILL_DEFAULT = true; + /** Whether to display watch text by default */ + public static final boolean WATCH_TEXT_DEFAULT = true; + /** Whether to display watch time by default */ + public static final boolean WATCH_TIME_DEFAULT = true; + /** Whether to display advisory outlines by default */ + public static final boolean ADV_OUTLINE_DEFAULT = true; + /** Whether to display advisory fill by default */ + public static final boolean ADV_FILL_DEFAULT = false; + /** Whether to display advisory text by default */ + public static final boolean ADV_TEXT_DEFAULT = true; + /** Whether to display advisory time by default */ + public static final boolean ADV_TIME_DEFAULT = true; + /** Whether to display statements/other outlines by default */ + public static final boolean OTHER_OUTLINE_DEFAULT = true; + /** Whether to display statements/other fill by default */ + public static final boolean OTHER_FILL_DEFAULT = true; + /** Whether to display statements/other text by default */ + public static final boolean OTHER_TEXT_DEFAULT = true; + /** Whether to display statements/other time by default */ + public static final boolean OTHER_TIME_DEFAULT = true; + //gui display variables + private boolean warnOutline = WARN_OUTLINE_DEFAULT; + private boolean warnFill = WARN_FILL_DEFAULT; + private boolean warnText = WARN_TEXT_DEFAULT; + private boolean warnTime = WARN_TIME_DEFAULT; + private boolean warnSample = true; + private boolean watchOutline = WATCH_OUTLINE_DEFAULT; + private boolean watchFill = WATCH_FILL_DEFAULT; + private boolean watchText = WATCH_TEXT_DEFAULT; + private boolean watchTime = WATCH_TIME_DEFAULT; + private boolean watchSample = true; + private boolean advOutline = ADV_OUTLINE_DEFAULT; + private boolean advFill = ADV_FILL_DEFAULT; + private boolean advText = ADV_TEXT_DEFAULT; + private boolean advTime = ADV_TIME_DEFAULT; + private boolean advSample = true; + private boolean otherOutline = OTHER_OUTLINE_DEFAULT; + private boolean otherFill = OTHER_FILL_DEFAULT; + private boolean otherText = OTHER_TEXT_DEFAULT; + private boolean otherTime = OTHER_TIME_DEFAULT; + private boolean otherSample = true; + private boolean enableWarnDisplay = false; + private boolean enableWatchDisplay = false; + private boolean enableAdvisoryDisplay = false; + private boolean enableOtherDisplay = false; + + // The significance values for WWAs + private static final String WARN_SIG = "W"; + private static final String WATCH_SIG = "A"; + private static final String ADVISORY_SIG = "Y"; + + /** The dialog used to change display properties */ + private DrawingPropertiesDialog drawingDialog; + protected static GeometryFactory gf = new GeometryFactory(); protected static PreparedGeometryFactory pgf = new PreparedGeometryFactory(); @@ -227,7 +300,33 @@ public abstract class AbstractWWAResource extends WarningEntry entry = entryMap.get(key); AbstractWarningRecord record = entry.record; - if (matchesFrame(entry, time, framePeriod, lastFrame) + String sig = record.getSig(); + boolean samplingOn = false; + if(sig !=null){ + if(sig.equals(WATCH_SIG)){ + if(showWatchSampling()){ + samplingOn = true; + } + }else if(sig.equals(WARN_SIG)){ + if(showWarnSampling()){ + samplingOn = true; + } + }else if(sig.equals(ADVISORY_SIG)){ + if(showAdvisorySampling()){ + samplingOn = true; + } + }else{ + if(showOtherSampling()){ + samplingOn = true; + } + } + }else{ + if(showOtherSampling()){ + samplingOn = true; + } + } + + if (samplingOn && matchesFrame(entry, time, framePeriod, lastFrame) && record.getGeometry() != null) { Geometry recordGeom = record.getGeometry(); @@ -244,6 +343,9 @@ public abstract class AbstractWWAResource extends } sb.append(text); } + sb.append("\n\n"); + sb.append(record.getOverviewText()); + sb.append(record.getSegText()); return sb.toString(); } } @@ -254,7 +356,7 @@ public abstract class AbstractWWAResource extends } } - return "NO DATA"; + return null; } protected void disposeEntry(final WarningEntry entry) { @@ -360,33 +462,79 @@ public abstract class AbstractWWAResource extends } for (WarningEntry entry : candidates.values()) { AbstractWarningRecord record = entry.record; + boolean drawShape = true; + boolean drawOutline = true; + boolean drawText = true; + boolean drawTime = true; + + String sig = record.getSig(); + boolean sigRecognized = false; + if(record != null && record.getSig() != null){ + + //warning + if(sig.equalsIgnoreCase(WARN_SIG)){ + drawShape = warnFill; + drawOutline = warnOutline; + drawText = warnText; + drawTime = warnTime; + sigRecognized = true; + } + //watch + else if(sig.equalsIgnoreCase(WATCH_SIG)){ + drawShape = watchFill; + drawOutline = watchOutline; + drawText = watchText; + drawTime = watchTime; + sigRecognized = true; + } + //advisory + else if(sig.equals(ADVISORY_SIG)){ + drawShape = advFill; + drawOutline = advOutline; + drawText = advText; + drawTime = advTime; + sigRecognized = true; + } + } + + if(sig == null || !sigRecognized){ + drawShape = otherFill; + drawOutline = otherOutline; + drawText = otherText; + drawTime = otherTime; + } // check shapes if (entry.project) { initShape(target, entry.record); entry.project = false; } + + RGB displaycolor = color; + if ( ! record.getPil().equals("SPS")) { + displaycolor = RGBColors.getRGBColor(getPhensigColor(record.getPhensig())); + } + + if(entry != null){ + //draw shape + if(drawShape && entry.shadedShape != null){ + target.drawShadedShape(entry.shadedShape, 1); + } + //draw outline + if(drawOutline && entry.wireframeShape != null){ + OutlineCapability oc = getCapability(OutlineCapability.class); + LineStyle lineStyle = oc.getLineStyle(); + int outlineWidth = oc.getOutlineWidth(); + // Make wire frame outline thicker for EMERGENCY warnings + if (EmergencyType.isEmergency(record.getRawmessage())) { + outlineWidth *= 3; + } - if (entry != null && entry.wireframeShape != null) { - LineStyle lineStyle = LineStyle.SOLID; - if (record.getProductClass() != null - && record.getProductClass().equals("T")) { - lineStyle = LineStyle.DASHED; - } - - int outlineWidth = getCapability(OutlineCapability.class) - .getOutlineWidth(); - // Make wire frame outline thicker for EMERGENCY warnings - if (EmergencyType.isEmergency(record.getRawmessage())) { - outlineWidth *= 3; - } - - target.drawWireframeShape( - entry.wireframeShape, - getCapability(ColorableCapability.class).getColor(), - outlineWidth, lineStyle); - } else if (entry != null && entry.shadedShape != null) { - target.drawShadedShape(entry.shadedShape, 1); + target.drawWireframeShape( + entry.wireframeShape, + displaycolor, + outlineWidth, lineStyle); + } } if (record != null && record.getGeometry() != null) { @@ -405,7 +553,16 @@ public abstract class AbstractWWAResource extends double mapWidth = descriptor.getMapWidth() * paintProps.getZoomLevel() / 1000; - String[] textToPrint = getText(record, mapWidth); + String[] fullText = getText(record, mapWidth); + + String[] textToPrint = {"",""}; + if(drawText){ + textToPrint[0] = fullText[0]; + } + if(drawTime){ + textToPrint[1] = fullText[1]; + } + if (warningsFont == null) { warningsFont = target.initializeFont(target .getDefaultFont().getFontName(), 9, @@ -414,8 +571,7 @@ public abstract class AbstractWWAResource extends 12); } - DrawableString params = new DrawableString(textToPrint, - color); + DrawableString params = new DrawableString(textToPrint, displaycolor); params.font = warningsFont; params.setCoordinates(d[0], d[1]); params.horizontalAlignment = HorizontalAlignment.RIGHT; @@ -428,7 +584,7 @@ public abstract class AbstractWWAResource extends // moves over text to add EMER in a different font textToPrint[1] = String.format("%1$-23" + "s", textToPrint[1]); - params.setText(textToPrint, color); + params.setText(textToPrint, displaycolor); DrawableString emergencyString = new DrawableString( params); @@ -436,7 +592,7 @@ public abstract class AbstractWWAResource extends d[1] + (paintProps.getZoomLevel()) * 90); emergencyString.font = emergencyFont; emergencyString.setText(new String[] { "", "", - " " + EmergencyType.EMER, "" }, color); + " " + EmergencyType.EMER, "" }, displaycolor); target.drawStrings(emergencyString); } @@ -539,7 +695,38 @@ public abstract class AbstractWWAResource extends if (!resourceData.getMetadataMap().containsKey("officeid") || resourceData.getMetadataMap().get("officeid") .getConstraintValue().contains(officeid)) { - this.recordsToLoad.add((AbstractWarningRecord) pdo); + + AbstractWarningRecord rec = (AbstractWarningRecord) pdo; + this.recordsToLoad.add(rec); + + //set the drawing display for the corresponding significance types + // if all settings are on, no need to keep doing it + if(rec !=null && (!enableWatchDisplay || !enableWarnDisplay || !enableAdvisoryDisplay || !enableOtherDisplay)){ + String sig = rec.getSig(); + boolean sigRecognized = false; + if(sig!=null){ + if(sig.equals(WARN_SIG)){ + enableWarnDisplay = true; + sigRecognized = true; + } + else if(sig.equals(WATCH_SIG)){ + enableWatchDisplay = true; + sigRecognized = true; + } + else if(sig.equals(ADVISORY_SIG)){ + enableAdvisoryDisplay = true; + sigRecognized = true; + } + } + if(sig == null || !sigRecognized){ + enableOtherDisplay = true; + } + } + + //update display if it already exists + if(drawingDialog != null && !drawingDialog.isDisposed()){ + drawingDialog.updateControlsEnabled(enableWatchDisplay, enableWarnDisplay, enableAdvisoryDisplay, enableOtherDisplay); + } } } } @@ -591,20 +778,27 @@ public abstract class AbstractWWAResource extends addRecord(sort(pdos)); } + protected String getPhensigColor(String phensig){ + WarningLookups lookup = new WarningLookups(); + System.out.println("Phensig"+ phensig); + return lookup.getPhensig(phensig).color; + } + + protected String getPhensigName(String phensig){ + WarningLookups lookup = new WarningLookups(); + return lookup.getPhensig(phensig).name; + } + protected String[] getText(AbstractWarningRecord record, double mapWidth) { - String vid = record.getPhensig(); - String phen = record.getPhen(); - String[] textToPrint = new String[] { "", "", "", "" }; + + String[] textToPrint = new String[] { "", "" }; - textToPrint[0] = record.getProductClass(); - if ((vid != null && phen != null) - && (vid.equals("TO.A") || vid.equals("SV.A") - || phen.equals("FL") || phen.equals("FA"))) { - textToPrint[0] += "." + vid; + if ( ! record.getPil().equals("SPS")) { + textToPrint[0] = getPhensigName(record.getPhensig()); + } else { + textToPrint[0] = "Special Weather Statement"; } - textToPrint[0] += "." + record.getEtn(); - textToPrint[1] = record.getPil(); - + String startFormatString = DEFAULT_FORMAT; String endFormatString = DEFAULT_FORMAT; if (mapWidth == 0) { @@ -616,14 +810,14 @@ public abstract class AbstractWWAResource extends } DateFormat startFormat = new SimpleDateFormat(startFormatString); - startFormat.setTimeZone(TimeUtil.GMT_TIME_ZONE); - textToPrint[2] = "Valid " - + startFormat.format(record.getStartTime().getTime()); - DateFormat endFormat = new SimpleDateFormat(endFormatString); + + startFormat.setTimeZone(TimeUtil.GMT_TIME_ZONE); endFormat.setTimeZone(TimeUtil.GMT_TIME_ZONE); - textToPrint[3] = "Thru " - + endFormat.format(record.getEndTime().getTime()); + + textToPrint[1] = startFormat.format(record.getStartTime().getTime()) + + "-" + endFormat.format(record.getEndTime().getTime());; + return textToPrint; } @@ -724,5 +918,369 @@ public abstract class AbstractWWAResource extends // set font to null for recycle safety emergencyFont = null; } + + if(drawingDialog != null){ + drawingDialog.hide(); + drawingDialog = null; + } } + + /** + * Set whether or not to display the outline for warnings + * @param warnOutline If true, will draw warning outlines + */ + public void setWarnOutlineDisplay(boolean warnOutline) { + this.warnOutline = warnOutline; + } + + /** + * Set whether or not to display the fill (shaded shape) + * for warnings + * @param warnFill If true, will draw the warning fill + */ + public void setWarnFillDisplay(boolean warnFill) { + this.warnFill = warnFill; + } + + /** + * Set whether or not to display the text for warnings + * @param warnText If true, will draw the warning title + */ + public void setWarnTextDisplay(boolean warnText) { + this.warnText = warnText; + } + + /** + * Set whether or not to display the time for warnings + * @param warnTime If true, will draw the warning time + */ + public void setWarnTimeDisplay(boolean warnTime) { + this.warnTime = warnTime; + } + + /** + * Set whether or not to display the sampling for warnings + * @param warnSample If true, will show the sampling output + * for warnings, when sampling is enabled + */ + public void setWarnSampleDisplay(boolean warnSample) { + this.warnSample = warnSample; + } + + /** + * Set whether or not to display the outline for watches + * @param watchOutline If true, will draw the watch outline + */ + public void setWatchOutlineDisplay(boolean watchOutline) { + this.watchOutline = watchOutline; + } + + /** + * Set whether or not to display the fill (shaded shape) for watches + * @param watchFill If true, will draw the watch fill + */ + public void setWatchFillDisplay(boolean watchFill) { + this.watchFill = watchFill; + } + + /** + * Set whether or not to display the text for watches + * @param watchText If true, will draw the watch title + */ + public void setWatchTextDisplay(boolean watchText) { + this.watchText = watchText; + } + + /** + * Set whether or not to display the time for watches + * @param watchTime If true, will draw the watch time + */ + public void setWatchTimeDisplay(boolean watchTime) { + this.watchTime = watchTime; + } + + /** + * Set whether or not to display the sampling for watches + * @param watchSample If true, will show the sampling output + * for watches, when sampling is enabled + */ + public void setWatchSampleDisplay(boolean watchSample) { + this.watchSample = watchSample; + } + + /** + * Set whether or not to display the outline for advisories + * @param advOutline If true, will draw the advisory outline + */ + public void setAdvisoryOutlineDisplay(boolean advOutline) { + this.advOutline = advOutline; + } + + /** + * Set whether or not to display the fill (shaded shape) for + * advisories + * @param advFill If true, will draw the advisory fill + */ + public void setAdvisoryFillDisplay(boolean advFill) { + this.advFill = advFill; + } + + /** + * Set whether or not to display the text for advisories + * @param advText If true, will draw the advisory title + */ + public void setAdvisoryTextDisplay(boolean advText) { + this.advText = advText; + } + + /** + * Set whether or not to display the time for advisories + * @param advTime If true, will draw the advisory time + */ + public void setAdvisoryTimeDisplay(boolean advTime) { + this.advTime = advTime; + } + + /** + * Set whether or not to display the sampling for advisories + * @param advSample If true, will show the sampling output + * for advisories, when sampling is enabled + */ + public void setAdvisorySampleDisplay(boolean advSample) { + this.advSample = advSample; + } + + /** + * Set whether or not to display the outline for statements + * and other records + * @param advOutline If true, will draw the outline + */ + public void setOtherOutlineDisplay(boolean otherOutline) { + this.otherOutline = otherOutline; + } + + /** + * Set whether or not to display the fill (shaded shape) for + * statements and other records + * @param otherFill If true, will draw the fill + */ + public void setOtherFillDisplay(boolean otherFill) { + this.otherFill = otherFill; + } + + /** + * Set whether or not to display the text for statements + * and other records + * @param otherText If true, will draw the title + */ + public void setOtherTextDisplay(boolean otherText) { + this.otherText = otherText; + } + + /** + * Set whether or not to display the time for statements + * and other records + * @param otherTime If true, will draw the time + */ + public void setOtherTimeDisplay(boolean otherTime) { + this.otherTime = otherTime; + } + + /** + * Set whether or not to display the sampling for statements/ + * other records + * @param otherSample If true, will show the sampling output + * for statements/other records, when sampling is enabled + */ + public void setOtherSampleDisplay(boolean otherSample) { + this.otherSample = otherSample; + } + + /** + * @return True if the warning outline is displayed + */ + public boolean showWarnOutline(){ + return warnOutline; + } + + /** + * @return True if the warning fill is displayed + */ + public boolean showWarnFill(){ + return warnFill; + } + + /** + * @return True if the warning text is displayed + */ + public boolean showWarnText(){ + return warnText; + } + + /** + * @return True if the warning time is displayed + */ + public boolean showWarnTime(){ + return warnTime; + } + + /** + * @return True if the warning sampling is to be displayed + */ + public boolean showWarnSampling(){ + return warnSample; + } + + /** + * @return True if the watch outline is displayed + */ + public boolean showWatchOutline(){ + return watchOutline; + } + + /** + * @return True if the watch fill is displayed + */ + public boolean showWatchFill(){ + return watchFill; + } + + /** + * @return True if the watch text is displayed + */ + public boolean showWatchText(){ + return watchText; + } + + /** + * @return True if the watch time is displayed + */ + public boolean showWatchTime(){ + return watchTime; + } + + /** + * @return True if the watch sampling is to be displayed + */ + public boolean showWatchSampling(){ + return watchSample; + } + + /** + * @return True if the advisory outline is displayed + */ + public boolean showAdvisoryOutline(){ + return advOutline; + } + + /** + * @return True if the advisory fill is displayed + */ + public boolean showAdvisoryFill(){ + return advFill; + } + + /** + * @return True if the advisory text is displayed + */ + public boolean showAdvisoryText(){ + return advText; + } + + /** + * @return True if the advisory time is displayed + */ + public boolean showAdvisoryTime(){ + return advTime; + } + + /** + * @return True if the advisory sampling is to be displayed + */ + public boolean showAdvisorySampling(){ + return advSample; + } + + /** + * @return True if the statement/other outline is displayed + */ + public boolean showOtherOutline(){ + return otherOutline; + } + + /** + * @return True if the statement/other fill is displayed + */ + public boolean showOtherFill(){ + return otherFill; + } + + /** + * @return True if the statement/other text is displayed + */ + public boolean showOtherText(){ + return otherText; + } + + /** + * @return True if the statement/other time is displayed + */ + public boolean showOtherTime(){ + return otherTime; + } + + /** + * @return True if the other/statement sampling is to be displayed + */ + public boolean showOtherSampling(){ + return otherSample; + } + + /** + * @return True if the warning display settings are to + * be enabled + */ + public boolean enableWarnDisplay() { + return enableWarnDisplay; + } + + /** + * @return True if the watch display settings are to + * be enabled + */ + public boolean enableWatchDisplay() { + return enableWatchDisplay; + } + + /** + * @return True if the advisory display settings are + * to be enabled + */ + public boolean enableAdvisoryDisplay() { + return enableAdvisoryDisplay; + } + + /** + * @return True if the warning statement/other settings + * are to be enabled + */ + public boolean enableOtherDisplay(){ + return enableOtherDisplay; + } + + /** + * Set the associated DrawingPropertiesDialog + * @param dialog + */ + public void setDrawingDialog(DrawingPropertiesDialog dialog){ + drawingDialog = dialog; + } + + /** + * @return The dialog used to set the display (drawing) properties + */ + public DrawingPropertiesDialog getDrawingDialog(){ + return drawingDialog; + } + } diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/CWASPSResource.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/CWASPSResource.java index bec3da9ea5..4d5815bc72 100644 --- a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/CWASPSResource.java +++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/CWASPSResource.java @@ -37,6 +37,8 @@ import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; import com.raytheon.uf.viz.core.drawables.FillPatterns; +import com.raytheon.uf.viz.core.drawables.IShadedShape; +import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.JTSCompiler; import com.raytheon.uf.viz.core.drawables.JTSCompiler.JTSGeometryData; import com.raytheon.uf.viz.core.drawables.JTSCompiler.PointStyle; @@ -65,6 +67,7 @@ import org.locationtech.jts.io.WKTReader; * Aug 22, 2016 5842 dgilling Remove dependency on viz.texteditor plugin. * Sep 14, 2016 3241 bsteffen Update deprecated JTSCompiler method calls * Mar 15, 2018 7047 dgilling Fix order of display of SPS metadata. + * Jun 24, 2022 srcarter@ucar Always create outline (wireshapes) and fill (shadedshapes) * * * @author rjpeter @@ -179,82 +182,47 @@ public class CWASPSResource extends WatchesResource { entry.record = record; entryMap.put(record.getDataURI(), entry); } - - // default to a wireframe shape - boolean isShaded = false; - - if (entry.shadedShape != null) { - // if the shape was in the shadedShape map then create a shaded - // shape - isShaded = true; - } else if ((entry.wireframeShape == null) - && (record.getGeometry() == null)) { - // if it is not in the wireframeShape map and the geometry is null - // then create a shaded shape - isShaded = true; - } - - if (isShaded) { - if (!record.getUgcZones().isEmpty()) { - // if the geometry is null get a geometry based on the county - // list - if (record.getGeometry() == null) { - record.setGeometry(getGeometry(record)); - } - if (record.getGeometry() != null) { - - // dispose old shape - if (entry.shadedShape != null) { - entry.shadedShape.dispose(); - } - - entry.shadedShape = target.createShadedShape(false, - descriptor.getGridGeometry()); - try { - geo = wktr.read(record.getGeometry().toString()); - - JTSCompiler jtsCompiler = new JTSCompiler( - entry.shadedShape, null, this.descriptor); - JTSGeometryData jtsData = jtsCompiler - .createGeometryData(); - jtsData.setPointStyle(PointStyle.CROSS); - jtsData.setGeometryColor(color); - try { - jtsCompiler.handle(geo, jtsData); - } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, - e.getLocalizedMessage(), e); - entryMap.remove(entry.record.getDataURI()); - return; - } - entry.shadedShape.setFillPattern(FillPatterns - .getGLPattern("VERTICAL_DOTTED")); - entry.shadedShape.compile(); - } catch (ParseException e) { - statusHandler.handle(Priority.PROBLEM, - e.getLocalizedMessage(), e); - } - } + + if (!record.getUgcZones().isEmpty()) { + // if the geometry is null get a geometry based on the county + // list + if (record.getGeometry() == null) { + record.setGeometry(getGeometry(record)); } - } else { + if (record.getGeometry() != null) { + try { + //give every entry a fill and outline + //add fill (shadedshape) + IShadedShape ss = target.createShadedShape(false, descriptor.getGridGeometry()); + geo = wktr.read(record.getGeometry().toString()); + JTSCompiler jtsCompiler = new JTSCompiler(ss, null, this.descriptor); + JTSGeometryData geoData = jtsCompiler.createGeometryData(); + geoData.setGeometryColor(color); + geoData.setPointStyle(PointStyle.CROSS); + jtsCompiler.handle(geo, geoData); + ss.setFillPattern(FillPatterns.getGLPattern("VERTICAL_DOTTED")); + ss.compile(); - try { - // dispose old shape - if (entry.wireframeShape != null) { - entry.wireframeShape.dispose(); + entry.shadedShape = ss; + + //add outline (wireshape) + IWireframeShape wfs = entry.wireframeShape; + + if (wfs != null) { + wfs.dispose(); + } + + wfs = target.createWireframeShape(false, descriptor); + + jtsCompiler = new JTSCompiler(null, wfs, descriptor); + jtsCompiler.handle(geo); + wfs.compile(); + entry.wireframeShape = wfs; + + } catch (Exception e) { + statusHandler.handle(Priority.ERROR, + "Error creating wireframe", e); } - - entry.wireframeShape = target.createWireframeShape(false, - descriptor); - geo = wktr.read(record.getGeometry().toString()); - - JTSCompiler jtsCompiler = new JTSCompiler(null, - entry.wireframeShape, descriptor); - jtsCompiler.handle(geo); - entry.wireframeShape.compile(); - } catch (Exception e) { - statusHandler.handle(Priority.ERROR, - "Error creating wireframe", e); } } } diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WWAResourceData.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WWAResourceData.java index d14b910498..1720f30e3d 100644 --- a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WWAResourceData.java +++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WWAResourceData.java @@ -46,6 +46,8 @@ import com.raytheon.viz.core.mode.CAVEMode; * Apr 28, 2014 DR 17310 D. Friedman Handle null VTEC fields. * Aug 28, 2014 ASM #15682 D. Friedman Refactor for WouWcnWatchesResourceData. * Apr 09, 2018 #6963 dgilling Support Practice mode. + * Oct 21, 2021 srcarter Simplified the construct method to always return WarningsResource + * Mar 15, 2022 srcarter Added a getter for the resource name * * * @@ -66,29 +68,18 @@ public class WWAResourceData extends AbstractRequestableResourceData { protected Collection records; + /* + * (non-Javadoc) + * + * @seecom.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData# + * constructResource(com.raytheon.uf.viz.core.comm.LoadProperties, + * com.raytheon.edex.db.objects.PluginDataObject[]) + */ @Override protected AbstractVizResource constructResource( LoadProperties loadProperties, PluginDataObject[] objects) throws VizException { - boolean watchResource = false; - records = new ArrayList<>(objects.length); - if (objects.length > 0) { - for (int i = 0; i < objects.length; i++) { - records.add((AbstractWarningRecord) objects[i]); - } - watchResource = "A".equals(((AbstractWarningRecord) objects[0]) - .getSig()); - } else if (loadProperties.isLoadWithoutData()) { - // I must be trying to load without data, Ill try. - RequestConstraint phenSig = getMetadataMap().get("phensig"); - watchResource = phenSig != null - && phenSig.getConstraintValue().contains(".A"); - } - - if (watchResource) { - return new WatchesResource(this, loadProperties); - } - + return new WarningsResource(this, loadProperties); } @@ -217,21 +208,12 @@ public class WWAResourceData extends AbstractRequestableResourceData { public boolean isRequeryNecessaryOnTimeMatch() { return false; } - - @Override - public HashMap getMetadataMap() { - HashMap metadataMap = super.getMetadataMap(); - - if (metadataMap.containsKey("pluginName")) { - metadataMap = new HashMap<>(metadataMap); - CAVEMode caveMode = CAVEMode.getMode(); - String pluginName = (CAVEMode.OPERATIONAL.equals(caveMode) - || CAVEMode.TEST.equals(caveMode)) ? "warning" - : "practicewarning"; - metadataMap.replace("pluginName", - new RequestConstraint(pluginName)); - } - - return metadataMap; + + /** + * @return The resource name (similar to what's displayed + * in the resource stack, except without the timestamp) + */ + public String getName(){ + return name; } } 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 3906a6a76e..76941580cb 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 @@ -37,6 +37,9 @@ import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.AbstractTimeMatcher; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo; +import com.raytheon.uf.viz.core.drawables.JTSCompiler.JTSGeometryData; +import com.raytheon.uf.viz.core.drawables.FillPatterns; +import com.raytheon.uf.viz.core.drawables.IShadedShape; import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.JTSCompiler; import com.raytheon.uf.viz.core.exception.VizException; @@ -70,6 +73,9 @@ import org.locationtech.jts.geom.Geometry; * Apr 14, 2014 DR 17257 D. Friedman Redo time matching on per-minute refresh. * Apr 28, 2015 ASM #15008 D. Friedman Create polygon for EXTs even if original product is not found. * Aug 22, 2016 #5842 dgilling Remove dependency on viz.texteditor plugin. + * Oct 21, 2021 srcarter modified initShape to set the shape on watches, and wireframe on warnings and advisories + * Mar 15, 2022 srcarter@ucar Change initshape() to add a shadedshape and wireframeshape to every entry + * * * * @@ -179,26 +185,38 @@ public class WarningsResource extends AbstractWWAResource { entry.record = record; entryMap.put(record.getDataURI(), entry); } + + WarningAction act = WarningAction.valueOf(record.getAct()); + + //give every entry a fill and outline + //add fill (shadedshape) + IShadedShape ss = target.createShadedShape(false, descriptor.getGridGeometry()); + geo = record.getGeometry(); + JTSCompiler jtsCompiler = new JTSCompiler(ss, null, this.descriptor); + JTSGeometryData geoData = jtsCompiler.createGeometryData(); + geoData.setGeometryColor(color); + jtsCompiler.handle(geo, geoData); + ss.setFillPattern(FillPatterns.getGLPattern(record.getPhen() + .equals("TO") ? "VERTICAL" : "HORIZONTAL")); + ss.compile(); + + entry.shadedShape = ss; + + //add outline (wireshape) IWireframeShape wfs = entry.wireframeShape; if (wfs != null) { wfs.dispose(); } - WarningAction act = WarningAction.valueOf(record.getAct()); - // Do not paint a wire frame shape for a CAN - if (act != WarningAction.CAN) { - wfs = target.createWireframeShape(false, descriptor); - geo = record.getGeometry(); - JTSCompiler jtsCompiler = new JTSCompiler(null, wfs, - descriptor); - jtsCompiler.handle(geo); - wfs.compile(); - entry.wireframeShape = wfs; - } else { - // Prevents sampling and a label to be painted - entry.record.setGeometry(null); - } + wfs = target.createWireframeShape(false, descriptor); + geo = record.getGeometry(); + + jtsCompiler = new JTSCompiler(null, wfs, descriptor); + jtsCompiler.handle(geo); + wfs.compile(); + entry.wireframeShape = wfs; + } catch (Exception e) { statusHandler.handle(Priority.ERROR, "Error creating wireframe", e); 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 81a172ac62..ec7d17ed45 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 @@ -27,6 +27,7 @@ import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.FillPatterns; import com.raytheon.uf.viz.core.drawables.IShadedShape; +import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.JTSCompiler; import com.raytheon.uf.viz.core.drawables.JTSCompiler.JTSGeometryData; import com.raytheon.uf.viz.core.exception.VizException; @@ -56,6 +57,7 @@ import org.locationtech.jts.geom.GeometryFactory; * Mar 04, 2014 2832 njensen Moved disposeInternal() to abstract class * Apr 07, 2014 2959 njensen Correct handling of color change * Jan 16, 2017 5976 bsteffen Update shaded shape constructor. + * Mar 15, 2022 srcarter@ucar Change initshape() to add a shadedshape and wireframeshape to every entry * * * @@ -169,11 +171,10 @@ public class WatchesResource extends AbstractWWAResource { if (!record.getUgcZones().isEmpty()) { setGeometry(record); if ((record.getGeometry() != null) && (record.getPhen() != null)) { - IShadedShape ss = target.createShadedShape(false, - descriptor.getGridGeometry()); + //add fill (shadedshape) + IShadedShape ss = target.createShadedShape(false, descriptor.getGridGeometry()); geo = record.getGeometry(); - JTSCompiler jtsCompiler = new JTSCompiler(ss, null, - this.descriptor); + JTSCompiler jtsCompiler = new JTSCompiler(ss, null, this.descriptor); JTSGeometryData geoData = jtsCompiler.createGeometryData(); geoData.setGeometryColor(color); jtsCompiler.handle(geo, geoData); @@ -187,6 +188,21 @@ public class WatchesResource extends AbstractWWAResource { entryMap.put(record.getDataURI(), entry); } entry.shadedShape = ss; + + //add outline (wireshape) + IWireframeShape wfs = entry.wireframeShape; + + if (wfs != null) { + wfs.dispose(); + } + + wfs = target.createWireframeShape(false, descriptor); + geo = record.getGeometry(); + + jtsCompiler = new JTSCompiler(null, wfs, descriptor); + jtsCompiler.handle(geo); + wfs.compile(); + entry.wireframeShape = wfs; } } } diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WouWcnWatchesResource.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WouWcnWatchesResource.java index 4bf15669f8..bc494907e5 100644 --- a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WouWcnWatchesResource.java +++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/rsc/WouWcnWatchesResource.java @@ -20,6 +20,7 @@ import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.drawables.FillPatterns; import com.raytheon.uf.viz.core.drawables.IShadedShape; +import com.raytheon.uf.viz.core.drawables.IWireframeShape; import com.raytheon.uf.viz.core.drawables.JTSCompiler; import com.raytheon.uf.viz.core.drawables.JTSCompiler.JTSGeometryData; import com.raytheon.uf.viz.core.drawables.JTSCompiler.PointStyle; @@ -38,6 +39,7 @@ import org.locationtech.jts.geom.Geometry; * ------------ ---------- ----------- -------------------------- * 2014-08-28 ASM #15682 D. Friemdan Initial creation * 2016-09-14 3241 bsteffen Update deprecated JTSCompiler method calls + * 2022-03-15 srcarter@ucar Changed initshape() to draw a shadedshape and wireframeshape for every entry * * */ @@ -242,11 +244,10 @@ public class WouWcnWatchesResource extends WatchesResource implements ISimulated } AbstractWarningRecord record = entry.record; if (record.getGeometry() != null) { - IShadedShape ss = target.createShadedShape(false, - descriptor.getGridGeometry()); + //added fill (shadedshape) + IShadedShape ss = target.createShadedShape(false, descriptor.getGridGeometry()); Geometry geo = (Geometry) record.getGeometry().clone(); - JTSCompiler jtsCompiler = new JTSCompiler(ss, null, - this.descriptor); + JTSCompiler jtsCompiler = new JTSCompiler(ss, null, this.descriptor); JTSGeometryData jtsData = jtsCompiler.createGeometryData(); jtsData.setPointStyle(PointStyle.CROSS); jtsData.setGeometryColor(color); @@ -255,6 +256,21 @@ public class WouWcnWatchesResource extends WatchesResource implements ISimulated .equals("TO") ? "VERTICAL" : "HORIZONTAL")); ss.compile(); entry.shadedShape = ss; + + //added outline (wireshape) + IWireframeShape wfs = entry.wireframeShape; + + if (wfs != null) { + wfs.dispose(); + } + + wfs = target.createWireframeShape(false, descriptor); + geo = record.getGeometry(); + + jtsCompiler = new JTSCompiler(null, wfs, descriptor); + jtsCompiler.handle(geo); + wfs.compile(); + entry.wireframeShape = wfs; } } diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/ui/DrawingPropertiesDialog.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/ui/DrawingPropertiesDialog.java new file mode 100644 index 0000000000..a6420aebd6 --- /dev/null +++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/ui/DrawingPropertiesDialog.java @@ -0,0 +1,364 @@ +package com.raytheon.viz.warnings.ui; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.warnings.rsc.AbstractWWAResource; + +/** + * Dialog with options for displaying the outline, fill, text, and time, + * individually, for each warnings, watches, and advisories. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer          Description
+ * ------------ ---------- ----------------  --------------------------
+ * Mar 15, 2022            srcarter@ucar     Initial creation
+ * Mar 21, 2022			   srcarter@ucar	 Set the current values every time initializeComponents is called (also called from .Open)
+ * Jun 24, 2022			   srcarter@ucar	 Move Watches to top, add section for Other/Statement, add 'enabled' functionality
+ * Jun 28, 2022			   srcarter@ucar	 Add 'Sampling' options
+ * 
+ * 
+ * + * @author srcarter + */ + +public class DrawingPropertiesDialog extends CaveSWTDialog { + + //gui components + private Button warnOutlineChk; + private Button warnFillChk; + private Button warnTextChk; + private Button warnTimeChk; + private Button warnSampleChk; + private Button watchOutlineChk; + private Button watchFillChk; + private Button watchTextChk; + private Button watchTimeChk; + private Button watchSampleChk; + private Button advOutlineChk; + private Button advFillChk; + private Button advTextChk; + private Button advTimeChk; + private Button advSampleChk; + private Button otherOutlineChk; + private Button otherFillChk; + private Button otherTextChk; + private Button otherTimeChk; + private Button otherSampleChk; + + /** + * The WWA Resource associated with this properties dialog + */ + private AbstractWWAResource myResource; + + + /** + * Creates a dialog with drawing options for all the warning, watches and + * advisories drawn in the resource + * @param parent The parent gui component to associate this dialog with + * @param rsc The WWA resource associated with this dialog + */ + protected DrawingPropertiesDialog(Shell parent, AbstractWWAResource rsc) { + super(parent, SWT.RESIZE | SWT.CLOSE); + myResource = rsc; + setText("WWA Drawing Properties"); + } + + @Override + // Create and initialize all gui components for controlling the drawing + // displays for the WWAs. + protected void initializeComponents(Shell shell) { + // --- Sub title --- + Composite subComp = new Composite(shell, SWT.NONE); + subComp.setLayout(new GridLayout(1, true)); + subComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + Label layerName = new Label(subComp, SWT.NONE); + layerName.setText(myResource.getResourceData().getName()); + + // --- Watches --- + Group watchComp = new Group(shell, SWT.NONE); + watchComp.setText("Watches"); + watchComp.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true)); + watchComp.setLayout(new GridLayout(2, true)); + + //outline and fill + watchOutlineChk = createButton(watchComp, "Show Outline"); + watchFillChk = createButton(watchComp, "Thatched Fill"); + + //text and time + watchTextChk = createButton(watchComp, "Show Text"); + watchTimeChk = createButton(watchComp, "Show Time"); + + //sample + watchSampleChk = createButton(watchComp, "Show Sampling"); + + // --- end Watches --- + + // --- Warnings --- + Group warnComp = new Group(shell, SWT.NONE); + warnComp.setText("Warnings"); + warnComp.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true)); + warnComp.setLayout(new GridLayout(2, true)); + + //outline and fill + warnOutlineChk = createButton(warnComp, "Show Outline"); + warnFillChk = createButton(warnComp, "Thatched Fill"); + //text and time + warnTextChk = createButton(warnComp, "Show Text"); + warnTimeChk = createButton(warnComp, "Show Time"); + //sample + warnSampleChk = createButton(warnComp, "Show Sampling"); + + // --- end Warnings --- + + // --- Advisories --- + Group advComp = new Group(shell, SWT.NONE); + advComp.setText("Advisories"); + advComp.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true)); + advComp.setLayout(new GridLayout(2, true)); + + //outline and fill + advOutlineChk = createButton(advComp, "Show Outline"); + advFillChk = createButton(advComp, "Thatched Fill"); + + //text and time + advTextChk = createButton(advComp, "Show Text"); + advTimeChk = createButton(advComp, "Show Time"); + + //sample + advSampleChk = createButton(advComp, "Show Sampling"); + + // --- end Advisories --- + + // --- Other --- + Group otherComp = new Group(shell, SWT.NONE); + otherComp.setText("Statements/Other"); + otherComp.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true)); + otherComp.setLayout(new GridLayout(2, true)); + + //outline and fill + otherOutlineChk = createButton(otherComp, "Show Outline"); + otherFillChk = createButton(otherComp, "Thatched Fill"); + + //text and time + otherTextChk = createButton(otherComp, "Show Text"); + otherTimeChk = createButton(otherComp, "Show Time"); + + //sample + otherSampleChk = createButton(otherComp, "Show Sampling"); + + // --- end Other --- + + // --- Bottom Buttons --- + Composite btnComp = new Composite(shell, SWT.NONE); + btnComp.setLayout(new GridLayout(1, true)); + btnComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + + // Reset Button + Button resetBtn = new Button(btnComp, SWT.PUSH); + resetBtn.setText("Reset Defaults"); + GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); + resetBtn.setLayoutData(gd); + resetBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event){ + resetDefaults(); + updateDisplay(); + } + }); + + // Close Button + Button closeBtn = new Button(btnComp, SWT.PUSH); + closeBtn.setText("Close"); + gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); + gd.widthHint = 70; + closeBtn.setLayoutData(gd); + closeBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + shell.setVisible(false); + } + }); + // --- end Buttons --- + + //set all the values + setToCurrentValues(); + + //set visibility from resource + setWarningControlsEnabled(myResource.enableWarnDisplay()); + setWatchControlsEnabled(myResource.enableWatchDisplay()); + setAdvisoryControlsEnabled(myResource.enableAdvisoryDisplay()); + setOtherControlsEnabled(myResource.enableOtherDisplay()); + } + + public void updateControlsEnabled(boolean enableWatch, boolean enableWarn, boolean enableAdv, boolean enableOther){ + setWatchControlsEnabled(enableWatch); + setWarningControlsEnabled(enableWarn); + setAdvisoryControlsEnabled(enableAdv); + setOtherControlsEnabled(enableOther); + } + + private void setWarningControlsEnabled(boolean isEnabled){ + warnOutlineChk.setEnabled(isEnabled); + warnFillChk.setEnabled(isEnabled); + warnTextChk.setEnabled(isEnabled); + warnTimeChk.setEnabled(isEnabled); + warnSampleChk.setEnabled(isEnabled); + } + + private void setWatchControlsEnabled(boolean isEnabled){ + watchOutlineChk.setEnabled(isEnabled); + watchFillChk.setEnabled(isEnabled); + watchTextChk.setEnabled(isEnabled); + watchTimeChk.setEnabled(isEnabled); + watchSampleChk.setEnabled(isEnabled); + } + + private void setAdvisoryControlsEnabled(boolean isEnabled){ + advOutlineChk.setEnabled(isEnabled); + advFillChk.setEnabled(isEnabled); + advTextChk.setEnabled(isEnabled); + advTimeChk.setEnabled(isEnabled); + advSampleChk.setEnabled(isEnabled); + } + + private void setOtherControlsEnabled(boolean isEnabled){ + otherOutlineChk.setEnabled(isEnabled); + otherFillChk.setEnabled(isEnabled); + otherTextChk.setEnabled(isEnabled); + otherTimeChk.setEnabled(isEnabled); + otherSampleChk.setEnabled(isEnabled); + } + + /** + * Creates a checkbox button used for defining the display + * properties of a given option for the WWA resource. Adds + * the selection listener to the button so it functions + * properly as well. + * @param parent The parent gui component to associate this + * button with + * @param title The text displayed next to the checkbox + * @return A Checkbox style button + */ + private Button createButton(Composite parent, String title){ + Button btn = new Button(parent, SWT.CHECK); + btn.setText(title); + btn.addSelectionListener(checkboxListener); + return btn; + } + + /** + * The listener used on all the display checkbox buttons + */ + private SelectionAdapter checkboxListener = new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event){ + updateDisplay(); + } + }; + + /** + * Updates all the display settings on the resource based on the + * current button selections in this dialog. Then issues a + * refresh on the resource so it updates the display. + */ + private void updateDisplay(){ + myResource.setWarnOutlineDisplay(warnOutlineChk.getSelection()); + myResource.setWarnFillDisplay(warnFillChk.getSelection()); + myResource.setWarnTextDisplay(warnTextChk.getSelection()); + myResource.setWarnTimeDisplay(warnTimeChk.getSelection()); + myResource.setWarnSampleDisplay(warnSampleChk.getSelection()); + + myResource.setWatchOutlineDisplay(watchOutlineChk.getSelection()); + myResource.setWatchFillDisplay(watchFillChk.getSelection()); + myResource.setWatchTextDisplay(watchTextChk.getSelection()); + myResource.setWatchTimeDisplay(watchTimeChk.getSelection()); + myResource.setWatchSampleDisplay(watchSampleChk.getSelection()); + + myResource.setAdvisoryOutlineDisplay(advOutlineChk.getSelection()); + myResource.setAdvisoryFillDisplay(advFillChk.getSelection()); + myResource.setAdvisoryTextDisplay(advTextChk.getSelection()); + myResource.setAdvisoryTimeDisplay(advTimeChk.getSelection()); + myResource.setAdvisorySampleDisplay(advSampleChk.getSelection()); + + myResource.setOtherOutlineDisplay(otherOutlineChk.getSelection()); + myResource.setOtherFillDisplay(otherFillChk.getSelection()); + myResource.setOtherTextDisplay(otherTextChk.getSelection()); + myResource.setOtherTimeDisplay(otherTimeChk.getSelection()); + myResource.setOtherSampleDisplay(otherSampleChk.getSelection()); + + myResource.issueRefresh(); + } + + /** + * Reset all the button selections in this dialog to the default + * values defined in the @AbstractWWAResource class + */ + private void resetDefaults(){ + warnOutlineChk.setSelection(AbstractWWAResource.WARN_OUTLINE_DEFAULT); + warnFillChk.setSelection(AbstractWWAResource.WARN_FILL_DEFAULT); + warnTextChk.setSelection(AbstractWWAResource.WARN_TEXT_DEFAULT); + warnTimeChk.setSelection(AbstractWWAResource.WARN_TIME_DEFAULT); + warnSampleChk.setSelection(true); + + watchOutlineChk.setSelection(AbstractWWAResource.WATCH_OUTLINE_DEFAULT); + watchFillChk.setSelection(AbstractWWAResource.WATCH_FILL_DEFAULT); + watchTextChk.setSelection(AbstractWWAResource.WATCH_TEXT_DEFAULT); + watchTimeChk.setSelection(AbstractWWAResource.WATCH_TIME_DEFAULT); + watchSampleChk.setSelection(true); + + advOutlineChk.setSelection(AbstractWWAResource.ADV_OUTLINE_DEFAULT); + advFillChk.setSelection(AbstractWWAResource.ADV_FILL_DEFAULT); + advTextChk.setSelection(AbstractWWAResource.ADV_TEXT_DEFAULT); + advTimeChk.setSelection(AbstractWWAResource.ADV_TIME_DEFAULT); + advSampleChk.setSelection(true); + + otherOutlineChk.setSelection(AbstractWWAResource.OTHER_OUTLINE_DEFAULT); + otherFillChk.setSelection(AbstractWWAResource.OTHER_FILL_DEFAULT); + otherTextChk.setSelection(AbstractWWAResource.OTHER_TEXT_DEFAULT); + otherTimeChk.setSelection(AbstractWWAResource.OTHER_TIME_DEFAULT); + otherSampleChk.setSelection(true); + } + + /** + * Set all the GUI checkboxes to the current boolean values from + * the associated resource + */ + protected void setToCurrentValues(){ + warnOutlineChk.setSelection(myResource.showWarnOutline()); + warnFillChk.setSelection(myResource.showWarnFill()); + warnTextChk.setSelection(myResource.showWarnText()); + warnTimeChk.setSelection(myResource.showWarnTime()); + warnSampleChk.setSelection(myResource.showWarnSampling()); + + watchOutlineChk.setSelection(myResource.showWatchOutline()); + watchFillChk.setSelection(myResource.showWatchFill()); + watchTextChk.setSelection(myResource.showWatchText()); + watchTimeChk.setSelection(myResource.showWatchTime()); + watchSampleChk.setSelection(myResource.showWatchSampling()); + + advOutlineChk.setSelection(myResource.showAdvisoryOutline()); + advFillChk.setSelection(myResource.showAdvisoryFill()); + advTextChk.setSelection(myResource.showAdvisoryText()); + advTimeChk.setSelection(myResource.showAdvisoryTime()); + advSampleChk.setSelection(myResource.showAdvisorySampling()); + + otherOutlineChk.setSelection(myResource.showOtherOutline()); + otherFillChk.setSelection(myResource.showOtherFill()); + otherTextChk.setSelection(myResource.showOtherText()); + otherTimeChk.setSelection(myResource.showOtherTime()); + otherSampleChk.setSelection(myResource.showOtherSampling()); + } +} diff --git a/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/ui/WWADrawingPropertiesAction.java b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/ui/WWADrawingPropertiesAction.java new file mode 100644 index 0000000000..1d65cc0ba2 --- /dev/null +++ b/cave/com.raytheon.viz.warnings/src/com/raytheon/viz/warnings/ui/WWADrawingPropertiesAction.java @@ -0,0 +1,75 @@ +package com.raytheon.viz.warnings.ui; + +import org.eclipse.ui.PlatformUI; + +import com.raytheon.uf.viz.core.rsc.AbstractVizResource; +import com.raytheon.viz.ui.cmenu.AbstractRightClickAction; +import com.raytheon.viz.warnings.rsc.AbstractWWAResource; +import com.raytheon.viz.warnings.rsc.CWASPSResource; +import com.raytheon.viz.warnings.rsc.WarningsResource; +import com.raytheon.viz.warnings.rsc.WatchesResource; + +/** + * This action shows an option in the resource menu that opens a new + * dialog which allows the users to specify display properties for + * the WWA resource. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer          Description
+ * ------------ ---------- ----------------  --------------------------
+ * Mar 15, 2022            srcarter@ucar     Initial creation
+ * Mar 17, 2022 		   srcarter@ucar	 Small change to isHidden to only display for proper resources
+ * Jun 24, 2022			   srcarter@ucar	 Enable for CWASPSResources as well
+ * 
+ * 
+ * + * @author srcarter + */ + +public class WWADrawingPropertiesAction extends AbstractRightClickAction { + + @Override + public String getText() { + return "Open Drawing Properties..."; + } + + /* (non-Javadoc) + * @see org.eclipse.jface.action.Action#run() + * + * Create and assign a new DrawingPropertiesDialog to the associated + * resource if it does not already have a dialog. If it has a dialog + * proceed with the existing one and show the dialog. + */ + @Override + public void run() { + AbstractWWAResource rsc = (AbstractWWAResource)getSelectedRsc(); + + DrawingPropertiesDialog dialog = rsc.getDrawingDialog(); + + if(dialog == null){ + dialog = new DrawingPropertiesDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), rsc); + rsc.setDrawingDialog(dialog); + } + dialog.open(); + } + + /* (non-Javadoc) + * @see com.raytheon.viz.ui.cmenu.AbstractRightClickAction#isHidden() + * + * Only display the drawing properties dialog for WarningsResource and + * WatchesResource, but not for a CWASPS resource. + */ + @Override + public boolean isHidden(){ + AbstractVizResource rsc = getSelectedRsc(); + + if(rsc instanceof WatchesResource || rsc instanceof WarningsResource){ + return false; + } + return true; + } + +} diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/util/WarningLookups.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/util/WarningLookups.java new file mode 100644 index 0000000000..ffdaad75dd --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/util/WarningLookups.java @@ -0,0 +1,139 @@ +package com.raytheon.uf.common.dataplugin.warning.util; + +import java.io.File; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +import com.raytheon.uf.common.localization.IPathManager; +import com.raytheon.uf.common.localization.LocalizationContext; +import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; +import com.raytheon.uf.common.localization.PathManagerFactory; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; + +/** + * Class for looking up phensig info for warnings/advisories. + * + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer  Description
+ * ------------- -------- --------- --------------------------------------------
+ * Dec 19, 2018           mjames    Initial creation
+ * 
+ * 
+ * + * @author mjames + */ +public class WarningLookups { + private static final IUFStatusHandler theHandler = UFStatus.getHandler(WarningLookups.class); + + private static final String LOOKUP_DIR = "warngen"; + + public static class PhensigValue { + public PhensigValue() {} + + public PhensigValue(String name, String color) { + this.name = name; + this.color = color; + } + + @XmlAttribute + public String name; + + @XmlAttribute + public String color; + } + + @XmlAccessorType(XmlAccessType.NONE) + public static abstract class AbstractLookup { + public abstract Map getMap(); + } + + @XmlRootElement + @XmlAccessorType(XmlAccessType.FIELD) + public static class PhensigColors extends + AbstractLookup { + public HashMap map = new HashMap<>(); + + @Override + public Map getMap() { + return map; + } + } + + private PhensigColors phensigColorLookup; + + public WarningLookups() { + try { + init(); + } catch (Exception e) { + theHandler.error("Failed to initialize lookups", e); + } + } + + private void init() throws Exception { + JAXBContext context = JAXBContext.newInstance(PhensigColors.class); + Unmarshaller u = context.createUnmarshaller(); + phensigColorLookup = load(new PhensigColors(), "phensigColors.xml", u); + } + + private static , K, V> T load( + T combinedLookup, String fileName, Unmarshaller u) { + + IPathManager pm = PathManagerFactory.getPathManager(); + + List contexts = Arrays.asList(pm + .getLocalSearchHierarchy(LocalizationType.COMMON_STATIC)); + Collections.reverse(contexts); + + for (LocalizationContext ctx : contexts) { + File f = pm.getFile(ctx, LOOKUP_DIR + IPathManager.SEPARATOR + fileName); + if (f != null && f.isFile()) { + try { + @SuppressWarnings("unchecked") + T lookup = (T) u.unmarshal(f); + if (!combinedLookup.getClass().isAssignableFrom( + lookup.getClass())) { + throw new Exception(String.format( + "file contains %s' expected %s", + lookup.getClass(), combinedLookup.getClass())); + } + combinedLookup.getMap().putAll(lookup.getMap()); + } catch (Exception e) { + theHandler.error( + String.format("%s: %s", f, e.getMessage()), e); + } + } + } + return combinedLookup; + } + + public PhensigValue getPhensig(String phensigCode) { + return phensigColorLookup.map.get(phensigCode); + } + + private static WarningLookups instance; + + public static synchronized WarningLookups getInstance() { + if (instance == null) + instance = new WarningLookups(); + return instance; + } + + public static synchronized void reload() { + instance = new WarningLookups(); + } +} \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/phensigColors.xml b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/phensigColors.xml new file mode 100644 index 0000000000..849f301767 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/utility/common_static/base/warngen/phensigColors.xml @@ -0,0 +1,109 @@ + + + + AQ.Y + AS.O + AS.Y + BH.S + BW.Y + BZ.A + BZ.W + CF.A + CF.W + CF.Y + CF.S + DS.W + DS.Y + DU.Y + EC.A + EC.W + EH.A + EH.W + EW.W + FA.A + FA.W + FA.Y + FF.A + FF.S + FF.W + FG.Y + FL.A + FL.W + HY.S + FL.S + FL.Y + FR.Y + FW.A + FW.W + FZ.A + FZ.W + GL.A + GL.W + HF.A + HF.W + HT.Y + HU.A + HU.S + HU.W + HW.A + HW.W + HZ.A + HZ.W + SQ.W + IS.W + LE.A + LE.W + LE.Y + LO.Y + LS.A + LS.S + LS.W + LS.Y + LW.Y + MA.A + MA.S + MA.W + MF.Y + MH.W + MH.Y + MS.Y + RB.Y + RP.S + SC.Y + SE.A + SE.W + SI.Y + SM.Y + SR.A + SR.W + SS.A + SS.W + SU.W + SU.Y + SV.A + SV.S + SV.W + SW.Y + TO.A + TO.W + TR.A + TR.W + TS.A + TS.W + TS.Y + TY.A + TY.W + UP.A + UP.W + UP.Y + WC.A + WC.W + WC.Y + WI.Y + WS.A + WS.W + WW.Y + ZF.Y + ZR.Y + +