12.10.1-5 baseline

Former-commit-id: 28dc700c3ef97a134c8871c2c52086fe7db43035
This commit is contained in:
Steve Harris 2012-09-17 15:42:31 -05:00
parent 13adee3fe9
commit a96d35a1fa
19 changed files with 344 additions and 192 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

@ -648,6 +648,13 @@ public class FFMPMonitor extends ResourceMonitor {
sourceName);
SourceXML source = getSourceConfig().getSource(sourceName);
if (source.getSourceType().equals(
SOURCE_TYPE.GUIDANCE.getSourceType())) {
// Always look back for guidance types because of long expiration times,
// prevents mosaic brittleness from occurring.
retrieveNew = true;
}
if (retrieveNew
|| ((time != null) && ((previousQueryTime == null) || (time
.getTime() < previousQueryTime.getTime())))) {
@ -2322,14 +2329,11 @@ public class FFMPMonitor extends ResourceMonitor {
final String fsiteKey;
final boolean fisProductLoad;
public FFMPLoadRecord(boolean isProductLoad, String siteKey,
FFMPRecord ffmpRec, String source, String huc) throws Exception {
this.fffmpRec = ffmpRec;
this.fsource = source;
this.fsiteKey = siteKey;
this.fisProductLoad = isProductLoad;
this.fhuc = huc;
}

View file

@ -3339,13 +3339,15 @@ public class FFMPResource extends
ArrayList<Double> qpeTimes = new ArrayList<Double>();
if (qpeBasin != null) {
for (Date date : qpeBasin.getValues().keySet()) {
double dtime = FFMPGuiUtils.getTimeDiff(mostRecentRefTime,
date);
fgd.setQpe(dtime, (double) qpeBasin.getAccumValue(date,
double currVal = qpeBasin.getAccumValue(date,
mostRecentRefTime, getQpeSourceExpiration(),
isRate()));
isRate());
fgd.setQpe(dtime, currVal);
qpeTimes.add(dtime);
}
}

View file

@ -53,7 +53,8 @@ import com.raytheon.uf.viz.core.rsc.ResourceList;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 28, 2011 mpduff Initial creation
* Jan 28, 2011 mpduff Initial creation.
* Sep 11, 2012 1162 mpduff Made mergeMetaDataMap method public.
*
* </pre>
*
@ -117,7 +118,7 @@ public class VizGroupResourceData extends AbstractRequestableResourceData
return resource;
}
private void mergeMetadataMap() {
public void mergeMetadataMap() {
if ((this.metadataMap == null) || this.metadataMap.isEmpty()) {
this.metadataMap = new HashMap<String, RequestConstraint>();

View file

@ -19,6 +19,19 @@
**/
package com.raytheon.viz.grid.rsc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.viz.core.rsc.VizGroupResourceData;
@ -31,7 +44,8 @@ import com.raytheon.viz.core.rsc.VizGroupResourceData;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 28, 2011 mpduff Initial creation
* Jan 28, 2011 mpduff Initial creation.
* Sep 11, 2012 1162 mpduff Override getAvailableTimes method.
*
* </pre>
*
@ -44,4 +58,31 @@ public class FfgVizGroupResourceData extends VizGroupResourceData {
// Make name generator here
nameGenerator = new FfgGridNameGenerator();
}
@Override
public DataTime[] getAvailableTimes() throws VizException {
Set<DataTime> baseTimes = new HashSet<DataTime>();
Iterator<ResourcePair> rpIter = resourceList.iterator();
super.mergeMetadataMap();
List<DataTime> availableTimes = new ArrayList<DataTime>();
while (rpIter.hasNext()) {
ResourcePair rp = rpIter.next();
if (rp.getResourceData() instanceof AbstractRequestableResourceData) {
AbstractRequestableResourceData arrd = (AbstractRequestableResourceData) rp
.getResourceData();
Collection<DataTime> times = Arrays.asList(arrd
.getAvailableTimes());
baseTimes.addAll(times);
}
}
availableTimes.addAll(baseTimes);
Collections.sort(availableTimes);
return availableTimes.toArray(new DataTime[availableTimes.size()]);
}
}

View file

@ -79,7 +79,7 @@ public class TimeSeriesDataManager extends HydroDataManager {
private static final String TIME_SERIES_DATA_QUERY = "select lid,obstime,lid,product_id from latestobsvalue";
private String INGEST_FILTER_QUERY = "select lid,pe,ts,extremum,dur from ingestfilter where lid=':lid' and ingest = 'T' order by pe asc,dur asc,ts asc,extremum asc";
private String INGEST_FILTER_QUERY = "select lid,pe,ts,extremum,dur from ingestfilter where lid=':lid' and ingest = 'T' order by pe asc,ts_rank asc,dur asc,ts asc,extremum asc";
private String SHEF_PE_QUERY = "select name||' '|| eng_unit from shefpe where pe=':pe'";

View file

@ -42,7 +42,8 @@ import com.raytheon.viz.texteditor.print.PrintDisplay;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
* TODO Add Description
* This is a dialog to display the desired products from the current alarm
* queue.
*
* <pre>
*
@ -58,6 +59,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Nov 15, 2011 11616 rferrel Change font to fixed width; and text now
* uses the font.
* Feb 03, 2012 14317 mhuang Make alarm display window wider
* Sep 6, 2012 13365 rferrel Accumulate and Display fix.
*
* </pre>
*
@ -67,6 +69,15 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
public class AlarmDisplayWindow extends CaveSWTDialog {
/**
* State to place the accumulate into after adding products in the preopen.
*/
public static enum ACCUMULATE_STATE {
UNCHANGE, TRUE, FALSE
}
private ACCUMULATE_STATE accum_state;
private Font font;
private StyledText text;
@ -75,6 +86,8 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
private static boolean accumulate;
private Button accumButton;
private Button printWindow;
private Button printBuffer;
@ -85,10 +98,12 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
/**
* @param parentShell
* @param style
* @param prodList
* @param accum_state
*/
protected AlarmDisplayWindow(Shell parentShell,
java.util.List<StdTextProduct> prodList) {
java.util.List<StdTextProduct> prodList,
ACCUMULATE_STATE accum_state) {
super(parentShell, SWT.RESIZE, CAVE.PERSPECTIVE_INDEPENDENT
| CAVE.INDEPENDENT_SHELL);
setText("Alarm Display Window");
@ -96,6 +111,7 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
if (prods == null) {
prods = new ArrayList<StdTextProduct>();
}
this.accum_state = accum_state;
}
@Override
@ -132,7 +148,6 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
private void initializeComponents() {
createMenus();
createTextArea();
populateText();
}
/**
@ -166,16 +181,9 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
final Button clearButton = new Button(buttonMenuComp, SWT.PUSH);
clearButton.setText("Clear");
final Button accumButton = new Button(buttonMenuComp, SWT.CHECK);
accumButton = new Button(buttonMenuComp, SWT.CHECK);
accumButton.setText("Accumulate");
accumButton.setSelection(accumulate);
if (accumulate) {
accumButton.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW));
} else {
accumButton.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
}
setAccumulate(accumulate);
printWindow.addSelectionListener(new SelectionAdapter() {
@Override
@ -215,14 +223,7 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
accumButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
accumulate = !accumulate;
if (accumulate) {
accumButton.setBackground(Display.getCurrent()
.getSystemColor(SWT.COLOR_YELLOW));
} else {
accumButton.setBackground(Display.getCurrent()
.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
}
setAccumulate(!accumulate);
}
});
}
@ -236,22 +237,28 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
}
private void populateText() {
if (prods != null) {
if (!prods.isEmpty()) {
for (int i = 0; i < prods.size(); i++) {
addText(prods.get(i).getProduct());
}
} else {
addText(actualText);
}
if (prods == null || prods.isEmpty()) {
text.setText(actualText);
} else {
addText(actualText);
if (accumulate) {
text.setText(actualText);
} else {
text.setText("");
}
boolean saveAccumulate = accumulate;
// Make sure all products in the list are displayed then restore
// accumulate.
accumulate = true;
for (StdTextProduct prod : prods) {
addText(prod.getProduct());
}
accumulate = saveAccumulate;
}
}
public void setProds(java.util.List<StdTextProduct> prodList) {
prods = prodList;
text.setText(actualText);
populateText();
}
@ -269,20 +276,39 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
}
/**
* Sets the accumulate to the desired state and if active updates the
* display.
*
* @param accumulate
* the accumulate to set
*/
public void setAccumulate(boolean accumulate) {
AlarmDisplayWindow.accumulate = accumulate;
if (accumButton != null && !accumButton.isDisposed()) {
accumButton.setSelection(accumulate);
if (accumulate) {
accumButton.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW));
} else {
accumButton.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
}
}
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO take this method out
AlarmDisplayWindow curr = new AlarmDisplayWindow(new Shell(), null);
curr.open();
@Override
protected void preOpened() {
super.preOpened();
populateText();
switch (accum_state) {
case TRUE:
setAccumulate(true);
break;
case FALSE:
setAccumulate(false);
break;
}
accum_state = ACCUMULATE_STATE.UNCHANGE;
}
@Override

View file

@ -53,6 +53,7 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.edex.services.textdbsrv.IQueryTransport;
import com.raytheon.viz.core.mode.CAVEMode;
import com.raytheon.viz.texteditor.alarmalert.dialogs.AlarmDisplayWindow.ACCUMULATE_STATE;
import com.raytheon.viz.texteditor.alarmalert.util.AlarmAlertFunctions;
import com.raytheon.viz.texteditor.alarmalert.util.AlarmAlertLists;
import com.raytheon.viz.texteditor.alarmalert.util.CurrentAlarmEvent;
@ -90,8 +91,9 @@ 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>
*
* @author mnash
@ -383,7 +385,8 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
}
if (alarmDisplayDlg == null) {
alarmDisplayDlg = new AlarmDisplayWindow(shell, prods);
alarmDisplayDlg = new AlarmDisplayWindow(shell, prods,
ACCUMULATE_STATE.UNCHANGE);
alarmDisplayDlg.open();
if (list != null && !list.isDisposed() && list.getItemCount() == 0) {
close();
@ -391,7 +394,8 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
} else {
if (alarmDisplayDlg.getShell() == null
|| alarmDisplayDlg.getShell().isDisposed()) {
alarmDisplayDlg = new AlarmDisplayWindow(shell, prods);
alarmDisplayDlg = new AlarmDisplayWindow(shell, prods,
ACCUMULATE_STATE.UNCHANGE);
alarmDisplayDlg.open();
if (list != null && !list.isDisposed()
&& list.getItemCount() == 0) {
@ -445,36 +449,25 @@ public class CurrentAlarmQueue extends CaveSWTDialog implements
list.removeAll();
AlarmAlertFunctions.getAlarmalertbell().close();
}
if (alarmDisplayDlg == null) {
java.util.List<StdTextProduct> prods = new ArrayList<StdTextProduct>();
if (command.length > 0) {
for (int i = 0; i < command.length; i++) {
prods.addAll(produceTextProduct(command[i]));
}
java.util.List<StdTextProduct> prods = new ArrayList<StdTextProduct>();
if (command.length > 0) {
for (int i = 0; i < command.length; i++) {
prods.addAll(produceTextProduct(command[i]));
}
alarmDisplayDlg = new AlarmDisplayWindow(shell, prods);
alarmDisplayDlg.setAccumulate(true);
}
if (alarmDisplayDlg == null) {
alarmDisplayDlg = new AlarmDisplayWindow(shell, prods,
ACCUMULATE_STATE.TRUE);
alarmDisplayDlg.open();
} else {
if (alarmDisplayDlg.getShell() == null
|| alarmDisplayDlg.getShell().isDisposed()) {
java.util.List<StdTextProduct> prods = new ArrayList<StdTextProduct>();
if (command.length > 0) {
for (int i = 0; i < command.length; i++) {
prods.addAll(produceTextProduct(command[i]));
}
}
alarmDisplayDlg = new AlarmDisplayWindow(shell, prods);
alarmDisplayDlg.setAccumulate(true);
alarmDisplayDlg = new AlarmDisplayWindow(shell, prods,
ACCUMULATE_STATE.TRUE);
alarmDisplayDlg.open();
} else {
alarmDisplayDlg.setAccumulate(true);
java.util.List<StdTextProduct> prods = new ArrayList<StdTextProduct>();
if (command.length > 0) {
for (int i = 0; i < command.length; i++) {
prods.addAll(produceTextProduct(command[i]));
}
}
alarmDisplayDlg.setProds(prods);
alarmDisplayDlg.setAccumulate(true);
alarmDisplayDlg.setDialogFocus();

View file

@ -284,8 +284,9 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* 25JUL2012 14459 rferrel Strip WMH headers when getting all METARs.
* 13AUG2012 14613 M.Gamazaychikov Ensured the WMO and MND header times are the same.
* 20AUG2012 15340 D.Friedman Use callbacks for stop sign dialog. Prevent NOR in header.
* 10SEP2012 15334 rferrel No longer wrap text pasted to an empty text field.
* 10Sep2012 15103 M.Gamazaychikov DR15103 -do not clear AFOS command from the text box
* when obs are updated and refactored executeCommand
* when obs are updated and refactored executeCommand
* 10SEP2012 15401 D.Friedman Fix QC problem caused by DR 15340.
* </pre>
*
@ -4116,6 +4117,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
private void pasteText() {
// AWIPS I just does the pasted in both overwrite and insert mode.
try {
// When pasting to empty editor assume text is properly formatted
// and does not need wrapping.
boolean doWrap = true;
if (textEditor.getText().trim().length() == 0) {
doWrap = false;
textEditor.setText("");
}
int start = -1;
if (textEditor.getSelectionCount() == 0) {
start = textEditor.getCaretOffset();
@ -4123,7 +4131,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
start = textEditor.getSelectionRange().x;
}
textEditor.paste();
rewrap(start, textEditor.getCaretOffset());
if (doWrap) {
rewrap(start, textEditor.getCaretOffset());
}
} catch (IllegalArgumentException ex) {
// Ignore
}
@ -4368,7 +4378,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
final CAVEMode mode = CAVEMode.getMode();
StdTextProduct prod = getStdTextProduct();
String afosId = prod.getCccid() + prod.getNnnid() + prod.getXxxid();
final String title = QualityControl.getProductWarningType(prod.getNnnid());
final String title = QualityControl.getProductWarningType(prod
.getNnnid());
final StringBuilder productMessage = new StringBuilder();
final StringBuilder modeMessage = new StringBuilder();
@ -4393,7 +4404,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
@Override
public void dialogDismissed(Object dialogResult) {
if (Boolean.TRUE.equals(dialogResult))
finishSendProduct1(resend, title, mode, productMessage, modeMessage);
finishSendProduct1(resend, title, mode,
productMessage, modeMessage);
}
});
@ -4403,7 +4415,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
finishSendProduct1(resend, title, mode, productMessage, modeMessage);
}
private void finishSendProduct1(final boolean resend, String title, CAVEMode mode, StringBuilder productMessage, StringBuilder modeMessage) {
private void finishSendProduct1(final boolean resend, String title,
CAVEMode mode, StringBuilder productMessage,
StringBuilder modeMessage) {
Pattern p = Pattern.compile(".\\%[s].");
Matcher m = p.matcher(STORED_SENT_MSG);
@ -4468,7 +4482,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
token);
OUPRequest req = new OUPRequest();
OfficialUserProduct oup = new OfficialUserProduct();
StdTextProduct prod = getStdTextProduct(); // TODO: makes me nervous...
StdTextProduct prod = getStdTextProduct(); // TODO: makes me
// nervous...
String awipsWanPil = prod.getSite() + prod.getNnnid()
+ prod.getXxxid();
String awipsID = prod.getNnnid() + prod.getXxxid();
@ -4623,15 +4638,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
boolean successful = false;
/*
* DR14613 - string currectDate is derived from Date now
* ensuring the same time in WMO heading and in the
* MND heading.
* DR14613 - string currectDate is derived from Date now ensuring the
* same time in WMO heading and in the MND heading.
*/
Date now = SimulatedTime.getSystemTime().getTime();
String currentDate = getCurrentDate(now);
TextDisplayModel tdmInst = TextDisplayModel.getInstance();
// Convert the text in the text editor to uppercase
// Convert the text in the text editor to uppercase
if (!isAutoSave) {
if (!verifyRequiredFields()) {
return false;
@ -4667,10 +4681,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
VtecObject vtecObj = VtecUtil.parseMessage(productText);
if (warnGenFlag) {
/*
/*
* DR14613 - string currectDate is derived from Date now
* ensuring the same time in WMO heading and in the
* MND heading.
* ensuring the same time in WMO heading and in the MND
* heading.
*/
productText = updateVtecTimes(productText, vtecObj, now);
productText = updateHeaderTimes(productText, now);
@ -5134,9 +5148,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
}
private String getCurrentDate(Date now) {
/*
* DR14613 - pass the Date now as an argument
*/
/*
* DR14613 - pass the Date now as an argument
*/
SimpleDateFormat formatter = new SimpleDateFormat("ddHHmm");
formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
return (formatter.format(now));
@ -5176,7 +5190,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
* @return
*/
private String updateHeaderTimes(String product, Date now) {
// Update the header time
// Update the header time
Matcher m = datePtrn.matcher(product);
if (m.find()) {
SimpleDateFormat headerFormat = new SimpleDateFormat(
@ -5187,10 +5201,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
product = product.replace(m.group(1), headerFormat.format(now)
.toUpperCase());
}
return product;
return product;
}
public void setCurrentWmoId(String wmoId) {
TextDisplayModel.getInstance().setWmoId(token, wmoId);
}

View file

@ -15,6 +15,7 @@ import com.raytheon.uf.common.geospatial.SpatialQueryResult;
import com.raytheon.viz.warngen.PreferenceUtil;
import com.raytheon.viz.warngen.gis.ClosestPoint;
import com.raytheon.viz.warngen.gis.GisUtil;
import com.raytheon.viz.warngen.gis.GisUtil.Direction;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
@ -94,9 +95,33 @@ public class DbAreaSourceDataAdaptor extends AbstractDbSourceDataAdaptor {
partOfArea = GisUtil.asStringList(GisUtil.calculatePortion(geom,
intersection, gc, ""));
String suppressedDirections = String.valueOf(attributes
.get(suppressedDirectionsField));
partOfArea.remove(suppressedDirections);
if (attributes.get(suppressedDirectionsField) != null) {
String suppressedDirections = String.valueOf(
attributes.get(suppressedDirectionsField))
.toLowerCase();
// supdirs can be 'nse', for example
// TODO create an enum constructor for Directions
for (int i = 0; i < suppressedDirections.length(); i++) {
switch (suppressedDirections.charAt(i)) {
case 'n':
partOfArea.remove(Direction.NORTH.toString());
break;
case 's':
partOfArea.remove(Direction.SOUTH.toString());
break;
case 'e':
partOfArea.remove(Direction.EAST.toString());
break;
case 'w':
partOfArea.remove(Direction.WEST.toString());
break;
case 'c':
partOfArea.remove(Direction.CENTRAL.toString());
break;
}
}
}
}
return partOfArea;

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,66 +550,77 @@ 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());
}
}
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.");
}
// 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);

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

@ -161,12 +161,14 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
ArrayList<Date> keys = new ArrayList<Date>();
for (Date date : values.descendingKeySet()) {
for (Date date : values.keySet()) {
if (date.before(beforeDate) && date.after(afterDate)) {
keys.add(date);
}
}
float factor = 0.0f;
for (Date key : keys) {
Date tdate = key;
float val = values.get(key);
@ -179,21 +181,20 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
if (val > 0.0f) {
float factor = 0.0f;
if ((prevDate.getTime() - tdate.getTime()) > expirationTime) {
// handle the gap and accumulate the book ends
// of it
factor = (float) ((prevDate.getTime() - (prevDate
.getTime() - expirationTime)) / (1000.0 * 60.0 * 60.0));
factor = ((prevDate.getTime() - (prevDate
.getTime() - expirationTime)) / (1000.0f * 60.0f * 60.0f));
} else {
factor = (float) ((prevDate.getTime() - tdate
.getTime()) / (1000.0 * 60.0 * 60.0));
factor = ((prevDate.getTime() - tdate
.getTime()) / (1000.0f * 60.0f * 60.0f));
}
// do absolute values so it dosen't matter which way
// you traverse the list
val = val * Math.abs(factor);
}
}
@ -341,7 +342,7 @@ public class FFMPBasin implements ISerializableObject, Cloneable {
@Override
public int compare(Date o1, Date o2) {
// Null checks?
return (o2.before(o1) ? -1 : (o1.equals(o2) ? 0 : 1));
return (int)Math.signum(o2.getTime() - o1.getTime()) ;
}
});

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 {
@ -218,8 +222,9 @@ public class GeometryUtil {
try {
section = g1.intersection(g2);
} catch (TopologyException e) {
// This exception is due to g2 having interior intersections
section = g1.intersection(g2.buffer(0));
// This exception is due to g2 having interior
// intersections
section = clean(g1).intersection(g2.buffer(0));
}
if (section != null) {
@ -232,6 +237,36 @@ public class GeometryUtil {
}
}
/**
* 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
*