Merge branch 'ss_builds' (12.10.1-5) into development

Conflicts:
	cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/CurrentAlarmQueue.java

Former-commit-id: 39f15fe032 [formerly 4e988dde641d01295134080111e738f25a110e6d]
Former-commit-id: dd6ac67e17
This commit is contained in:
Steve Harris 2012-09-17 15:46:11 -05:00
commit 15a625adb7
10 changed files with 128 additions and 82 deletions

View file

@ -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<CcfpRecord>();
records = new LinkedHashSet<CcfpRecord>();
unprocessedRecords.put(dataTime, records);
brandNew = true;
}

View file

@ -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.
* </pre>
*

View file

@ -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.
*
* </pre>
*
* @author njensen
@ -242,7 +242,7 @@ public class TemplateRunner {
AffectedAreas[] cancelareas = null;
Map<String, Object> 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());

View file

@ -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})

View file

@ -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})

View file

@ -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})

View file

@ -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})

View file

@ -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})

View file

@ -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})

View file

@ -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<Polygon> polygons = polygonizer.getPolygons();
g = gf.createMultiPolygon(
polygons.toArray(new Polygon[polygons.size()])).buffer(0);
return g;
}
/**
* Get the difference between the 2 geometries
*