diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/stationprofile/StationProfileDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/stationprofile/StationProfileDlg.java index a1f6763239..750c703738 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/stationprofile/StationProfileDlg.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/stationprofile/StationProfileDlg.java @@ -328,8 +328,8 @@ public class StationProfileDlg extends CaveSWTDialog { * Calculate pixel and offset values. */ private void calculateValues() { - double totalElevInc = Math.abs(stationProfData.getElevationFtMax()) - - Math.abs(stationProfData.getElevationFtMin()); + double totalElevInc = stationProfData.getElevationFtMax() + - stationProfData.getElevationFtMin(); // Calculate the offset between the elevation points double offsetDbl = totalElevInc / 5; @@ -684,6 +684,7 @@ public class StationProfileDlg extends CaveSWTDialog { if (stationList != null) { SimpleDateFormat sdf = new SimpleDateFormat("HH:mm MM/dd"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); + int i = 0; for (Statprof station : stationList) { // Skip gage if the river mile is not valid @@ -694,6 +695,7 @@ public class StationProfileDlg extends CaveSWTDialog { e.gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK)); x = calcRiverMileXCoord(station.getId().getMile()); y = calcElevationYCoord(station.getId().getZd()); + i++; // hash mark at each site e.gc.drawLine(x, y, x, y + POINT_HASH); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java index 04fd01d75a..db47b600b5 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java @@ -150,7 +150,7 @@ import com.vividsolutions.jts.geom.Polygon; * Aug 15, 2013 DR 16418 D. Friedman Make dialog visibility match editable state. * Sep 17, 2013 DR 16496 D. Friedman Make editable state more consistent. * Oct 01, 2013 DR16612 m.gamazaychikov Fixed inconsistencies with track locking and updateListSelected method - * Oct 29, 2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the pollygon the be used. + * Oct 29, 2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the polygon the be used. * * * @author chammack @@ -1064,14 +1064,16 @@ public class WarngenDialog extends CaveSWTDialog implements if ((followupData != null) && (WarningAction.valueOf(followupData.getAct()) == WarningAction.NEW)) { - redrawFromWarned(); + if (! redrawFromWarned()) + return; } if (((followupData == null) || ((WarningAction.valueOf(followupData .getAct()) == WarningAction.CON) && warngenLayer .conWarnAreaChanged(followupData))) && !polygonLocked && !trackLocked) { - redrawFromWarned(); + if (!redrawFromWarned()) + return; } // Need to check again because redraw may have failed. @@ -1448,14 +1450,10 @@ public class WarngenDialog extends CaveSWTDialog implements /** * Redraw everything based on warned area */ - private void redrawFromWarned() { - try { - warngenLayer.redrawBoxFromHatched(); - } catch (VizException e) { - statusHandler.handle(Priority.PROBLEM, - "Error redrawing box from hatched", e); - } + private boolean redrawFromWarned() { + boolean result = warngenLayer.redrawBoxFromHatched(); warngenLayer.issueRefresh(); + return result; } /** diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java index a9f7e18629..13ccbf53d4 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java @@ -396,6 +396,8 @@ public class WarngenLayer extends AbstractStormTrackResource { private Polygon oldWarningPolygon; + private boolean haveInput; + public AreaHatcher(PolygonUtil polygonUtil) { super("Hatching Warning Area"); setSystem(true); @@ -513,6 +515,7 @@ public class WarngenLayer extends AbstractStormTrackResource { this.warningPolygon = warningPolygon; this.warningArea = warningArea; this.oldWarningPolygon = oldWarningPolygon; + this.haveInput = true; } schedule(); } @@ -520,12 +523,15 @@ public class WarngenLayer extends AbstractStormTrackResource { public synchronized Geometry[] getHatchedAreas() { Polygon hatchedArea = null; Geometry hatchedWarningArea = null; - if (getState() == Job.RUNNING) { + while (getState() != Job.NONE) { try { join(); } catch (InterruptedException e) { + break; } } + if (! this.haveInput) + return null; hatchedArea = this.hatchedArea; hatchedWarningArea = this.hatchedWarningArea; return new Geometry[] { hatchedArea, hatchedWarningArea }; @@ -2254,13 +2260,14 @@ public class WarngenLayer extends AbstractStormTrackResource { } /** - * + * @return true if the box has been redraw successfully */ - public void redrawBoxFromHatched() throws VizException { + public boolean redrawBoxFromHatched() { + boolean result = true; if (state.snappedToArea == false) { if (state.getWarningArea() == null || state.getWarningArea().isEmpty()) { - return; + return true; } try { @@ -2269,6 +2276,14 @@ public class WarngenLayer extends AbstractStormTrackResource { Geometry hatchedArea = state.getWarningArea(); if (areaHatcher != null) { Geometry[] areas = areaHatcher.getHatchedAreas(); + if (areas == null) { + // Somehow, the hatcher has not been run. Try it now. + warningAreaChanged(); + areas = areaHatcher.getHatchedAreas(); + // If still null, give up. + if (areas == null) + return false; + } hatched = (Polygon) areas[0]; hatchedArea = areas[1]; } @@ -2302,15 +2317,18 @@ public class WarngenLayer extends AbstractStormTrackResource { issueRefresh(); statusHandler.handle(Priority.PROBLEM, "Could not redraw box from warned area"); + result = false; } System.out.println("Time to createWarningPolygon: " + (System.currentTimeMillis() - t0) + "ms"); } catch (Exception e) { statusHandler.handle(Priority.PROBLEM, "Error hatching polygon", e); + result = false; } issueRefresh(); } + return result; } public void createDamThreatArea(Coordinate[] coordinates) { 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 70c93c3987..3e8533c5b2 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 @@ -56,6 +56,8 @@ import com.vividsolutions.jts.io.WKTReader; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * May 10, 2013 1951 rjpeter Initial history entry, updated ugcZones references + * Nov 08, 2013 16758 mgamazaychikov Added mergeWatches to simplify SPS processing + * and getEventKey to create SPS-unique key * * * @author rjpeter @@ -286,4 +288,27 @@ public class CWASPSResource extends WatchesResource { return textToPrint; } + + /** + * Groups all the ugc zones with the same 'product.act.phensig.etn' + * + * Since there are no ugc zones in SPSs return the input watch records + * without changing them. + */ + protected List mergeWatches( + List watchrecs) { + return watchrecs; + } + + /** + * Create unique enough key to be used in paint method entryMap + * + * Use wmoId and countyHeader fields + **/ + @Override + protected String getEventKey(WarningEntry entry) { + AbstractWarningRecord rec = entry.record; + return rec.getWmoid().replaceAll(" ", "_") + ':' + + rec.getInsertTime().getTimeInMillis(); + } } 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 6b4b755a75..1494ac5034 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 @@ -50,6 +50,8 @@ import com.vividsolutions.jts.geom.GeometryFactory; * 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. + * Nov 8, 2013 16758 mgamazaychikov Changed access modifier of mergeWatches to protected + * so a child class can override the implementation. * * * @author jsanchez @@ -377,7 +379,7 @@ public class WatchesResource extends AbstractWWAResource { /** * Groups all the ugc zones with the same 'product.act.phensig.etn' */ - private List mergeWatches( + protected List mergeWatches( List watchrecs) { Map watches = new HashMap(); for (AbstractWarningRecord watchrec : watchrecs) {