diff --git a/cave/com.raytheon.uf.viz.ccfp/src/com/raytheon/uf/viz/ccfp/rsc/CcfpResource.java b/cave/com.raytheon.uf.viz.ccfp/src/com/raytheon/uf/viz/ccfp/rsc/CcfpResource.java index 543b7370c5..ed1f457f7e 100644 --- a/cave/com.raytheon.uf.viz.ccfp/src/com/raytheon/uf/viz/ccfp/rsc/CcfpResource.java +++ b/cave/com.raytheon.uf.viz.ccfp/src/com/raytheon/uf/viz/ccfp/rsc/CcfpResource.java @@ -24,7 +24,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; @@ -533,7 +533,7 @@ public class CcfpResource extends synchronized (unprocessedRecords) { records = unprocessedRecords.get(dataTime); if (records == null) { - records = new HashSet(); + records = new LinkedHashSet(); unprocessedRecords.put(dataTime, records); brandNew = true; } diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/CurrentAlarmQueue.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/CurrentAlarmQueue.java index 30a4be159f..c110ad1010 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/CurrentAlarmQueue.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/CurrentAlarmQueue.java @@ -91,8 +91,8 @@ import com.raytheon.viz.ui.dialogs.ModeListener; * May 23, 2012 14952 rferrel Now use refTime/createtime to display * selected product * Aug 28, 2012 14795 mgamazaychikov Fixed problem with "Unhadled event loop" - * exception associated with closing - * "Current Alarm Queue" GUI + * exception associated with closing "Current + * Alarm Queue" GUI * Sep 6, 2012 13365 rferrel Accumulate and Display fix. * * diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java index c39ec708da..5570b83ee6 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/template/TemplateRunner.java @@ -125,8 +125,8 @@ import com.vividsolutions.jts.io.WKTReader; * Jul 16, 2012 15091 Qinglu Lin Compute intersection area, which is used for prevent 2nd timezone * from appearing in 2nd and 3rd bullets when not necessary. * Aug 13, 2012 14493 Qinglu Lin Handled MND time, event time, and TML time specially for COR to NEW. + * Aug 29, 2011 15351 jsanchez Set the timezone for TML time. * Sep 10, 2012 15295 snaples Added property setting for runtime log to createScript. - * * * * @author njensen @@ -242,7 +242,7 @@ public class TemplateRunner { AffectedAreas[] cancelareas = null; Map intersectAreas = null; Wx wx = null; - long wwaMNDTime = 0l; + long wwaMNDTime = 0l; try { t0 = System.currentTimeMillis(); areas = Area.findAffectedAreas(config, warnPolygon, warningArea, @@ -375,7 +375,7 @@ public class TemplateRunner { startTime.getTime(), DateUtil.roundDateTo15(endTime) .getTime(), warnPolygon); if (selectedAction == WarningAction.COR) { - wwaMNDTime = wx.getStartTime().getTime(); + wwaMNDTime = wx.getStartTime().getTime(); } else { context.put("now", simulatedTime); context.put("start", wx.getStartTime()); @@ -391,7 +391,7 @@ public class TemplateRunner { context.put("duration", duration); context.put("event", eventTime); - context.put("TMLtime", eventTime); + context.put("TMLtime", eventTime); context.put("ugcline", FipsUtil.getUgcLine(areas, wx.getEndTime(), 15)); context.put("areaPoly", GisUtil.convertCoords(warngenLayer @@ -550,67 +550,78 @@ public class TemplateRunner { context.put("etn", etn); context.put("start", oldWarn.getIssueTime().getTime()); if (oldWarn.getAct().equals("NEW")) { - context.put("now", new Date(wwaMNDTime)); + context.put("now", new Date(wwaMNDTime)); } else context.put("now", simulatedTime); context.put("event", oldWarn.getIssueTime().getTime()); - - String message = oldWarn.getRawmessage(); - if (!stormTrackState.originalTrack) { - context.put("TMLtime", oldWarn.getStartTime().getTime()); - } else { - int hour = 0; - int minute = 0; - int tmlIndex = message.indexOf("TIME...MOT...LOC"); - int zIndex = -1; - if (tmlIndex > 0) { - zIndex = message.indexOf("Z", tmlIndex); - if (zIndex > 0) { - int startIndex = tmlIndex+16+1; - String tmlTime = null; - tmlTime = message.substring(startIndex,startIndex+4); - if (tmlTime.length() == 4) { - hour = Integer.parseInt(tmlTime.substring(0,2)); - minute = Integer.parseInt(tmlTime.substring(2,4)); - } else if (tmlTime.length() == 3) { - hour = Integer.parseInt(tmlTime.substring(0,1)); - minute = Integer.parseInt(tmlTime.substring(1,3)); - } else { - throw new VizException("The length of hour and minute for TML time is neither 3 nor 4."); - } - Calendar c = Calendar.getInstance(); - c.set(Calendar.HOUR_OF_DAY,hour); - c.set(Calendar.MINUTE, minute); - context.put("TMLtime", c.getTime()); - } else { - throw new VizException("Z, therefore hour and minute, cannot be found in TIME...MOT...LOC line."); - } - } else { - // To prevent errors resulting from undefined context("TMLtime") - context.put("TMLtime", oldWarn.getIssueTime().getTime()); - } - } - - // corEventtime for "COR to NEW", not for "COR to CON, CAN, or CANCON" - if (oldWarn.getAct().equals("NEW")) { - int untilIndex = message.indexOf("UNTIL"); - int atIndex = -1; - int elipsisIndex = -1; - if (untilIndex > 0) { - atIndex = message.indexOf("AT", untilIndex); - if (atIndex > 0) { - int hhmmIndex = atIndex+3; - elipsisIndex = message.indexOf("...", hhmmIndex); - if (elipsisIndex > 0) { - context.put("corToNewMarker","cortonewmarker"); - context.put("corEventtime",message.substring(hhmmIndex,elipsisIndex)); - } - } - } - if (untilIndex < 0 || atIndex < 0 || elipsisIndex < 0) - throw new VizException("Cannot find * AT line."); - } - + + String message = oldWarn.getRawmessage(); + if (!stormTrackState.originalTrack) { + context.put("TMLtime", oldWarn.getStartTime().getTime()); + } else { + int hour = 0; + int minute = 0; + int tmlIndex = message.indexOf("TIME...MOT...LOC"); + int zIndex = -1; + if (tmlIndex > 0) { + zIndex = message.indexOf("Z", tmlIndex); + if (zIndex > 0) { + int startIndex = tmlIndex + 16 + 1; + String tmlTime = null; + tmlTime = message.substring(startIndex, + startIndex + 4); + if (tmlTime.length() == 4) { + hour = Integer + .parseInt(tmlTime.substring(0, 2)); + minute = Integer.parseInt(tmlTime.substring(2, + 4)); + } else if (tmlTime.length() == 3) { + hour = Integer + .parseInt(tmlTime.substring(0, 1)); + minute = Integer.parseInt(tmlTime.substring(1, + 3)); + } else { + throw new VizException( + "The length of hour and minute for TML time is neither 3 nor 4."); + } + Calendar c = Calendar.getInstance(TimeZone + .getTimeZone("GMT")); + c.set(Calendar.HOUR_OF_DAY, hour); + c.set(Calendar.MINUTE, minute); + context.put("TMLtime", c.getTime()); + } else { + throw new VizException( + "Z, therefore hour and minute, cannot be found in TIME...MOT...LOC line."); + } + } else { + // To prevent errors resulting from undefined + // context("TMLtime") + context.put("TMLtime", oldWarn.getIssueTime().getTime()); + } + } + + // corEventtime for "COR to NEW", not for + // "COR to CON, CAN, or CANCON" + if (oldWarn.getAct().equals("NEW")) { + int untilIndex = message.indexOf("UNTIL"); + int atIndex = -1; + int elipsisIndex = -1; + if (untilIndex > 0) { + atIndex = message.indexOf("AT", untilIndex); + if (atIndex > 0) { + int hhmmIndex = atIndex + 3; + elipsisIndex = message.indexOf("...", hhmmIndex); + if (elipsisIndex > 0) { + context.put("corToNewMarker", "cortonewmarker"); + context.put("corEventtime", message.substring( + hhmmIndex, elipsisIndex)); + } + } + } + if (untilIndex < 0 || atIndex < 0 || elipsisIndex < 0) + throw new VizException("Cannot find * AT line."); + } + Calendar cal = oldWarn.getEndTime(); cal.add(Calendar.MILLISECOND, 1); context.put("expire", cal.getTime()); diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/extremeWindWarningFollowup.vm b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/extremeWindWarningFollowup.vm index ca65bb9b66..4a41250f6c 100644 --- a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/extremeWindWarningFollowup.vm +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/extremeWindWarningFollowup.vm @@ -336,7 +336,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE. #printcoords(${areaPoly}, ${list}) TIME...MOT...LOC ## -${dateUtil.format(${event}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) @@ -487,7 +487,7 @@ LAT...LON ## #end TIME...MOT...LOC ## -${dateUtil.format(${event}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/impactSevereWeatherStatement.vm b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/impactSevereWeatherStatement.vm index 3aac4392af..4695eea693 100644 --- a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/impactSevereWeatherStatement.vm +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/impactSevereWeatherStatement.vm @@ -302,7 +302,7 @@ REMEMBER...A TORNADO WARNING STILL REMAINS IN EFFECT FOR !** PORTION AND COUNTY #printcoords(${areaPoly}, ${list}) TIME...MOT...LOC ## -${dateUtil.format(${now}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) @@ -1161,7 +1161,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE. #printcoords(${areaPoly}, ${list}) TIME...MOT...LOC ## -${dateUtil.format(${event}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/impactTornadoWarning.vm b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/impactTornadoWarning.vm index 4ca6ee4802..ae7916a2fa 100644 --- a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/impactTornadoWarning.vm +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/impactTornadoWarning.vm @@ -627,7 +627,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE. #printcoords(${areaPoly}, ${list}) TIME...MOT...LOC ## -${dateUtil.format(${event}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/severeWeatherStatement.vm b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/severeWeatherStatement.vm index da9149404a..4d724743de 100644 --- a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/severeWeatherStatement.vm +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/severeWeatherStatement.vm @@ -277,7 +277,7 @@ REMEMBER...A TORNADO WARNING STILL REMAINS IN EFFECT FOR !** PORTION AND COUNTY #printcoords(${areaPoly}, ${list}) TIME...MOT...LOC ## -${dateUtil.format(${now}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) @@ -859,7 +859,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE. #printcoords(${areaPoly}, ${list}) TIME...MOT...LOC ## -${dateUtil.format(${event}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/significantWeatherAdvisory.vm b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/significantWeatherAdvisory.vm index d0ceee0fff..c250d6c47e 100644 --- a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/significantWeatherAdvisory.vm +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/significantWeatherAdvisory.vm @@ -322,7 +322,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE. #printcoords(${areaPoly}, ${list}) TIME...MOT...LOC ## -${dateUtil.format(${event}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/specialMarineWarningFollowup.vm b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/specialMarineWarningFollowup.vm index 0779831aa9..6aad13d52d 100644 --- a/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/specialMarineWarningFollowup.vm +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/warngen/specialMarineWarningFollowup.vm @@ -563,7 +563,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE. #printcoords(${areaPoly}, ${list}) TIME...MOT...LOC ## -${dateUtil.format(${event}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) @@ -976,7 +976,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE. #printcoords(${areaPoly}, ${list}) TIME...MOT...LOC ## -${dateUtil.format(${event}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) @@ -1402,7 +1402,7 @@ THIS IS A TEST MESSAGE. DO NOT TAKE ACTION BASED ON THIS MESSAGE. #printcoords(${areaPoly}, ${list}) TIME...MOT...LOC ## -${dateUtil.format(${now}, ${timeFormat.time})}Z ## +${dateUtil.format(${TMLtime}, ${timeFormat.time})}Z ## ${mathUtil.roundAndPad(${movementDirection})}DEG ## ${mathUtil.round(${movementInKnots})}KT ## #foreach(${eventCoord} in ${eventLocation}) diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/util/GeometryUtil.java b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/util/GeometryUtil.java index 737400556a..0ce2c7f5f2 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/util/GeometryUtil.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.warning/src/com/raytheon/uf/common/dataplugin/warning/util/GeometryUtil.java @@ -1,19 +1,23 @@ package com.raytheon.uf.common.dataplugin.warning.util; import java.util.ArrayList; +import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.TreeSet; +import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryCollection; import com.vividsolutions.jts.geom.GeometryFactory; +import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.Polygon; import com.vividsolutions.jts.geom.TopologyException; import com.vividsolutions.jts.geom.prep.PreparedGeometry; import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory; import com.vividsolutions.jts.operation.overlay.snap.GeometrySnapper; +import com.vividsolutions.jts.operation.polygonize.Polygonizer; public class GeometryUtil { @@ -217,21 +221,52 @@ public class GeometryUtil { Geometry section = null; try { section = g1.intersection(g2); - } catch (TopologyException e) { - // This exception is due to g2 having interior intersections - section = g1.intersection(g2.buffer(0)); + } catch (TopologyException e) { + // This exception is due to g2 having interior + // intersections + section = clean(g1).intersection(g2.buffer(0)); } - + if (section != null) { setUserData(section, (CountyUserData) g2.getUserData()); section.setUserData(g2.getUserData()); intersections.add(section); - } + } } } } } + /** + * Returns a geometry from the noded line strings of g. + * + * @param g + * geometry to be cleaned up + * @return + */ + private static Geometry clean(Geometry g) { + Coordinate[] coords = g.getCoordinates(); + + // create a line string + GeometryFactory gf = new GeometryFactory(); + LineString ls = gf.createLineString(coords); + + // node the line string (insert vertices where lines cross) + com.vividsolutions.jts.geom.Point pt = gf.createPoint(ls + .getCoordinate()); + Geometry nodedLines = ls.union(pt); + + // create the polygon(s) from the noded line + Polygonizer polygonizer = new Polygonizer(); + polygonizer.add(nodedLines); + Collection polygons = polygonizer.getPolygons(); + + g = gf.createMultiPolygon( + polygons.toArray(new Polygon[polygons.size()])).buffer(0); + + return g; + } + /** * Get the difference between the 2 geometries *