Issue #1408: Merge 13.1.2-6 into development

Former-commit-id: 029ebaa63a [formerly 029ebaa63a [formerly 7f8ad9de743a19d21a6784fa7563a88c6bdd4d3c]]
Former-commit-id: 328be6ac2b
Former-commit-id: 6a5a0d7d09
This commit is contained in:
Richard Peter 2013-01-09 17:55:05 -06:00
parent 19b6b94e67
commit 709af3b25e
86 changed files with 1371 additions and 329 deletions

View file

@ -6,6 +6,7 @@
configuring file. Changed true or false setting on popup, text,
blink and color items followed the A1 configuring master.gcf file.
01/31/2012 dyninaj DR14427 added category NDFD
11/30/2012 jzeng DR14016 update GFE configuration
-->
<alertConfiguration name="DEFAULT">
<globalConfiguration height="37" width="-1" yPosition="-1" xPosition="-1" logLength="10" audioDuration="30" blinkDuration="5" expandedPopup="false" categoryShown="false" sourceKeyShown="false" priorityShown="false" mode="H2"/>
@ -126,11 +127,11 @@
</source>
<source locked="true" name="GFE" longName="GFE">
<configurationItem>
<metadata foreground="#000000" background="#ffff00" pythonEnabled="false" log="true" priority="SIGNIFICANT" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#666666" background="#00ff00" pythonEnabled="false" log="true" priority="EVENTA" popup="false" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#ffffff" background="#ee0000" pythonEnabled="false" log="true" priority="CRITICAL" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#ffffff" background="#000000" pythonEnabled="false" log="true" priority="EVENTB" popup="false" blink="false" text="false" audioEnabled="false"/>
<metadata foreground="#000000" background="#ffa500" pythonEnabled="false" log="true" priority="PROBLEM" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#ffffff" background="#ee20e0" pythonEnabled="false" log="true" priority="CRITICAL" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#ffffff" background="#ee0000" pythonEnabled="false" log="true" priority="SIGNIFICANT" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#000000" background="#ffff00" pythonEnabled="false" log="true" priority="PROBLEM" popup="true" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#000000" background="#ffa500" pythonEnabled="false" log="true" priority="EVENTA" popup="false" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#666666" background="#00ff00" pythonEnabled="false" log="true" priority="EVENTB" popup="false" blink="false" text="false" audioEnabled="false"/>
<metadata foreground="#ffffff" background="#000000" pythonEnabled="false" log="true" priority="VERBOSE" popup="false" blink="false" text="false" audioEnabled="false"/>
</configurationItem>
<configurationMonitor>

View file

@ -30,8 +30,7 @@
# Heading
#-----------------------------------------------------------------------------
#import siteConfig
#GFESUITE_HOME = siteConfig.GFESUITE_HOME
GFESUITE_HOME = "/awips2/GFESuite"
GFESUITE_PRDDIR = "/tmp/products"
yes = True
no = False

View file

@ -42,7 +42,7 @@
<contribute xsi:type="bundleItem" file="bundles/NOHRSC-SNOW.xml"
menuText="Snow Cover Elev" id="snowCoverElev">
<substitute key="param" value="sce"/>
<substitute key="customLegend" value="Snow Cover elevation (kft)"/>
<substitute key="customLegend" value="Snow Cover by elevation (kft)"/>
<substitute key="sampleFormat" value="0.00"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/NOHRSC-SNOW.xml"

View file

@ -61,12 +61,12 @@
</contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Tungchiang (RCMJ)" id="raobTungchiang"
menuText="Tungchiang (595530) (RCMJ)" id="raobTungchiang"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="595530"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Taipei (RCSS)" id="raobTaipei"
menuText="Taipei (589680) (RCSS)" id="raobTaipei"
editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="589680"/>
</contribute>

View file

@ -810,7 +810,7 @@ public interface IGraphicsTarget extends IImagingExtension {
public IView getView();
/**
* /** Use drawStrings(DrawableString parameters)
* Use drawStrings(DrawableString parameters)
*/
@Deprecated
public abstract void drawString(IFont font, String text, double x,

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter unit="K" name="Dew point depression" abbreviation="DpD" xmlns:ns2="group">
<DerivedParameter unit="K" name="Dewpoint depression" abbreviation="DpD" xmlns:ns2="group">
<Method name="Difference">
<Field abbreviation="T"/>
<Field abbreviation="DpT"/>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter unit="K" name="Dew point temperature" abbreviation="DpT" xmlns:ns2="group">
<DerivedParameter unit="K" name="Dewpoint temperature" abbreviation="DpT" xmlns:ns2="group">
<Method name="Dewpoint">
<Field abbreviation="T"/>
<Field abbreviation="RH"/>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="DpTmean" name="Dew Point Temp mean" unit="K">
<DerivedParameter abbreviation="DpTmean" name="Dewpoint Temp mean" unit="K">
<Method name="Alias" levels="Surface">
<Field abbreviation="DpTmean" level="2FHAG"/>
</Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<DerivedParameter abbreviation="DpTsprd" name="Dew Point Temp sprd" unit="K">
<DerivedParameter abbreviation="DpTsprd" name="Dewpoint Temp sprd" unit="K">
<Method name="Alias" levels="Surface">
<Field abbreviation="DpTsprd" level="2FHAG"/>
</Method>

View file

@ -56,6 +56,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* Jun 16, 2012 14386 zhao Modified the notify method
* Oct 30, 2012 skorolev Changed HashMap to Map
* Nov 11, 2012 1297 skorolev Added initiateProdArray
* Dec 03, 2012 15216/15639 zhao fixed a bug related to Link-to-Frame
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
*
* </pre>
@ -137,6 +138,9 @@ public class FogZoneTableDlg extends ZoneTableDlg {
if (date != null) {
Date nominalTime = date;
ObMultiHrsReports obData = fog.getObData();
if (!isLinkedToFrame()) {
nominalTime = obData.getLatestNominalTime();
}
FogDataGenerator fdg = new FogDataGenerator();
Map<String, CellType> fogAlgCellType = fdg.getAlgCellTypes(fog
.getAlgorithmData(nominalTime));

View file

@ -44,6 +44,7 @@ import com.vividsolutions.jts.geom.Point;
* has been created to calculate the pivot
* indexes.
* 10-27-2010 #6964 bkowal Added a public class member for the LineStyle.
* 11/29/2012 15571 Qinglu Lin Added compuateCurrentStormCenter();
*
* </pre>
*
@ -189,4 +190,32 @@ public class StormTrackState {
/** Set if you the duration needs to be calculated from the end time */
public Calendar endTime = null;
/** Compute the coordinate of the storm center at the time defined by dataTime via interpolation. */
public boolean compuateCurrentStormCenter(Coordinate coord, DataTime dateTime) {
if (futurePoints == null) return false;
int length = futurePoints.length;
if (length <=1) return false;
DataTime[] dt = new DataTime[2];
dt[0] = futurePoints[0].time;
dt[1] = futurePoints[length-1].time;
Coordinate[] cs = new Coordinate[] {futurePoints[0].coord,futurePoints[length-1].coord};
boolean crossed180 = false;
if (cs[0].x>0 && cs[1].x<0 || cs[0].x<0 && cs[1].x>0) {
crossed180 = true;
if (cs[0].x>0)
cs[0].x = -360. + cs[0].x;
if (cs[1].x>0)
cs[1].x = -360. + cs[1].x;
}
StormTrackUtil trackUtil = new StormTrackUtil();
coord.x = cs[0].x + (cs[1].x-cs[0].x)/trackUtil.timeBetweenDataTimes(dt[1],dt[0])
*trackUtil.timeBetweenDataTimes(dateTime,dt[0]);
coord.y = cs[0].y + (cs[1].y-cs[0].y)/trackUtil.timeBetweenDataTimes(dt[1],dt[0])
*trackUtil.timeBetweenDataTimes(dateTime,dt[0]);
if (crossed180)
if (coord.x<-180.0)
coord.x = 360. + coord.x;
return true;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

View file

@ -20,13 +20,19 @@
package com.raytheon.viz.gfe.actions;
import com.raytheon.viz.gfe.Activator;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.resource.ImageDescriptor;
import com.raytheon.viz.gfe.core.msgs.Message;
import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.ToolItem;
/**
* Action to show the ISC grids
*
@ -37,20 +43,70 @@ import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 07/20/09 1995 bphillip Initial release
*
* 12/06/12 DR 15574 jzeng Change the image of
* the icon when it is activated
* </pre>
*
* @author bphillip
* @version 1
*/
public class ShowISCGridsAction extends AbstractHandler {
/*
* non-active Image
*/
private static Image orgImg = null;
/*
* active Image
*/
private static Image actImg = null;
/*
* ImageDescriptor
*/
private static ImageDescriptor id = null;
/*
* Tool item
*/
private static ToolItem ti = null;
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class)
.show();
boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class).show();
/*
* Get toolItem
*/
if(ti == null) {
if (arg0.getTrigger() instanceof Event) {
Event e = (Event) arg0.getTrigger();
if ( e.widget instanceof ToolItem) {
ti = (ToolItem) e.widget;
}
}
}
/*
* Get Image when it is not activated
*/
if (orgImg == null) orgImg = ti.getImage();
/*
* Get Image when it is activated
*/
if ( actImg == null ){
if (id == null) {
id = Activator.imageDescriptorFromPlugin(
Activator.PLUGIN_ID, "icons/isc1.gif" );
}
actImg = id.createImage();
}
/*
* Change the image when it is active and
* change it back when it is not activated
*/
if (!current) ti.setImage(actImg);
else ti.setImage(orgImg);
new ShowISCGridsMsg(!current).send();
return null;
}
}

View file

@ -45,6 +45,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager;
@ -65,6 +66,8 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
* Mar 7, 2008 Eric Babin Initial Creation
* Oct 27, 2012 1287 rferrel Code cleanup for non-blocking dialog.
* Oct 25, 2012 1287 rferrel Code changes for non-blocking PublishDialog.
* Nov 30, 2012 15575 ryu Added variable replacement for SelectedStart,
* SelectedEnd, and home
* Nov 13, 2012 1298 rferrel Code changes for non-blocking UserEntryDialog.
*
* </pre>
@ -85,6 +88,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
private Map<String, String> scriptDict;
private String gfeHome;
private String prddir;
private ToggleSelectList scriptsList;
@ -104,6 +109,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
this.dataManager = dataManager;
gfeHome = Activator.getDefault().getPreferenceStore()
.getString("GFESUITE_HOME");
prddir = Activator.getDefault().getPreferenceStore()
.getString("GFESUITE_PRDDIR");
scripts = Activator.getDefault().getPreferenceStore()
@ -171,6 +178,15 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
.getSpatialEditorTime();
Date seEnd = new Date(seStart.getTime() + 60 * 1000);
Date selStart = new Date(0);
Date selEnd = new Date(0);
TimeRange selectedTR = dataManager.getParmOp()
.getSelectionTimeRange();
if (selectedTR != null) {
selStart = selectedTR.getStart();
selEnd = selectedTR.getEnd();
}
// The following variables are replaced by known values:
cmd = cmd.replace("{host}", hostParts[0]);
cmd = cmd.replace("{port}", hostParts[1]);
@ -178,8 +194,13 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
cmd = cmd.replace("{productDB}", productDB.toString());
cmd = cmd.replace("{SEstart}", gmtTime.format(seStart));
cmd = cmd.replace("{SEend}", gmtTime.format(seEnd));
cmd = cmd.replace("{SelectedStart}",
gmtTime.format(selStart));
cmd = cmd.replace("{SelectedEnd}",
gmtTime.format(selEnd));
cmd = cmd.replace("{time}", curLocalTime);
cmd = cmd.replace("{ztime}", curGMTTime);
cmd = cmd.replace("{home}", gfeHome);
cmd = cmd.replace("{prddir}", prddir);
// The user is prompted to enter the value with which to replace

View file

@ -23,8 +23,10 @@ import static com.raytheon.viz.gfe.product.StringUtil.stringJoin;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -76,6 +78,7 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
* 19 Feb 2010 4132 ryu Product correction.
* 30 Jul 2010 6719 jnjanga Placed cursor at the end of inserted CTA
* 26 Sep 2012 15423 ryu Avoid resetting text when possible.
* 03 Dec 2012 15620 ryu Unlock framed cities list for editing.
*
* </pre>
*
@ -141,6 +144,10 @@ public class StyledTextComp extends Composite {
private boolean highlight = Activator.getDefault().getPreferenceStore()
.getBoolean("HighlightFramingCodes");
private boolean newProduct = false;
private Set<String> unlockCitySegs;
private boolean autoWrapMode;
private int wrapColumn = 80; // TODO: get from external
@ -312,6 +319,7 @@ public class StyledTextComp extends Composite {
* The product text.
*/
public void setProductText(String text) {
newProduct = true;
textEditorST.setText(EMPTY);
textEditorST.setStyleRange(null);
parseProductText(text);
@ -320,6 +328,7 @@ public class StyledTextComp extends Composite {
lockText();
findFramingCodes();
textEditorST.getVerticalBar().setSelection(0);
newProduct = false;
}
/**
@ -339,10 +348,8 @@ public class StyledTextComp extends Composite {
* Lock the parts of the text that needs to be uneditable.
*/
private void lockText() {
int strLen = 0;
int startLine = 0;
int endLine = 0;
StyleRange sr;
// NOTE: For the endline variables we need to exclude the last line
// in the for loop because the the parsed index is at line x
@ -360,71 +367,70 @@ public class StyledTextComp extends Composite {
if (ciBlockTip != null) {
startLine = ciBlockTip.getStartIndex().x;
endLine = ciBlockTip.getEndIndex().x;
for (int i = startLine; i < endLine; i++) {
// Add 1 to the length to account for the \n character
strLen += productTextArray[i].length() + 1;
}
sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
strLen, lockColor, null);
textEditorST.setStyleRange(sr);
lockLines(productTextArray, startLine, endLine);
}
/*
* Lock the mnd text.
*/
strLen = 0;
HashMap<String, TextIndexPoints> mndMap = prodDataStruct.getMndMap();
TextIndexPoints mndTip = mndMap.get("mnd");
if (mndTip != null) {
startLine = mndTip.getStartIndex().x;
endLine = mndTip.getEndIndex().x;
for (int i = startLine; i < endLine; i++) {
// Add 1 to the length to account for the \n character
strLen += productTextArray[i].length() + 1;
}
sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
strLen, lockColor, null);
textEditorST.setStyleRange(sr);
lockLines(productTextArray, startLine, endLine);
}
/*
* Lock content in the UGC text.
*/
strLen = 0;
if (newProduct) {
unlockCitySegs = new HashSet<String>();
}
List<SegmentData> segArray = prodDataStruct.getSegmentsArray();
TextIndexPoints segTip;
TextIndexPoints segTip, cityTip;
for (SegmentData segmentData : segArray) {
/*
* Lock header.
*/
strLen = 0;
segTip = segmentData.getSegmentDataIndexPoints("header");
cityTip = segmentData.getSegmentDataIndexPoints("city");
if (segTip != null) {
startLine = segTip.getStartIndex().x;
endLine = segTip.getEndIndex().x;
for (int i = startLine; i < endLine; i++) {
// Add 1 to the length to account for the \n character
strLen += productTextArray[i].length() + 1;
String ugc = segTip.getText().substring(0, 6);
// Check if this is a segment for which the cities list
// should be unlocked. Cities list is unlocked for editing
// when framing codes are present.
if (newProduct) {
if (cityTip != null &&
cityTip.getText().indexOf("|*") > 0) {
unlockCitySegs.add(ugc);
}
}
sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
strLen, lockColor, null);
textEditorST.setStyleRange(sr);
if (unlockCitySegs.contains(ugc)) {
// Lock the segment header but skip the cities list.
int cityStart = cityTip.getStartIndex().x;
int cityEnd = cityTip.getEndIndex().x;
lockLines(productTextArray, startLine, cityStart);
lockLines(productTextArray, cityEnd, endLine);
}
else {
lockLines(productTextArray, startLine, endLine);
}
}
/*
* Lock term.
*/
strLen = 0;
segTip = segmentData.getSegmentDataIndexPoints("term");
if (segTip != null) {
@ -447,17 +453,22 @@ public class StyledTextComp extends Composite {
++endLineOffset;
}
for (int i = startLine; i < endLine + endLineOffset; i++) {
lockLines(productTextArray, startLine, endLine + endLineOffset);
}
}
}
private void lockLines(String[] productTextArray, int startLine, int endLine) {
int strLen = 0;
for (int i = startLine; i < endLine; i++) {
// Add 1 to the length to account for the \n character
strLen += productTextArray[i].length() + 1;
}
sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
StyleRange sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
strLen, lockColor, null);
textEditorST.setStyleRange(sr);
}
}
}
/**
* Find the framing codes in the text.

View file

@ -102,6 +102,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 09 OCT 2012 #15396 Fixed Instantaneous precip index so legend and map display
* will change each time duration is incremented or decremented
* for the "30 minutes Instantaneous" rainfall map .
* 04 Dec 2012 15602 wkwock Fix Hrs hour capped at 100.
*
* </pre>
*
* @author lvenable
@ -1023,6 +1025,7 @@ public class PointDataControlDlg extends CaveSWTDialog {
hoursSpnr.setPageIncrement(5);
hoursSpnr.setSelection(24);
hoursSpnr.setLayoutData(gd);
hoursSpnr.setMaximum(1000);
// hoursSpnr.addSelectionListener(new SelectionAdapter() {
// @Override
// public void widgetSelected(SelectionEvent event) {

View file

@ -21,10 +21,8 @@ package com.raytheon.viz.hydro.timeseries;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
@ -90,6 +88,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 04 Mar 2011 7644 lbousaid fixed Zoom in feature
* 30 May 2012 14967 wkwock fix insert deleted data to rejecteddata table
* 23 Jul 2012 15195 mpduff Fix dates for displaying groups
* 06 Dec 2012 15066 wkwock Fix "ctrl+r" not work in group mode
*
* </pre>
*
@ -973,7 +972,10 @@ public class TimeSeriesDisplayDlg extends CaveSWTDialog {
setZoomAction(false);
setSelectZoom(false);
reset = true;
displayCanvas.redraw();
for (TimeSeriesDisplayCanvas dc :canvasList){
dc.setZoomed(false);
dc.redraw();
}
} else {
displayCanvas.resetTS();
}

View file

@ -50,6 +50,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- --------------------------
* 02 Sep 2008 lvenable Initial creation.
* 30 Dec 2008 1802 askripsk Connect to database.
* 04 Dec 2012 15522 wkwock Fix incorrect zones and not able to add
*
* </pre>
*
@ -94,6 +95,10 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
*/
private Button clearBtn;
/**
* for keep track whether selected zones are initialized. false is not initialized.
*/
private boolean zonesFlag = false;
/**
* Constructor.
*
@ -157,6 +162,9 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
selectionCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!zonesFlag) {
getZoneData();
}
updateDisplay();
}
});
@ -328,6 +336,7 @@ public class CountyZoneUgcDlg extends CaveSWTDialog {
private void getZoneData() {
try {
CountyZoneUgcDataManager.getInstance().getZonesSelected(true);
zonesFlag=true;
} catch (VizException e) {
e.printStackTrace();
}

View file

@ -37,6 +37,7 @@ import com.raytheon.viz.hydrocommon.data.ZoneInfoData;
* ------------ ---------- ----------- --------------------------
* Jan 5, 2009 1802 askripsky Initial Creation
* Sep 11,2012 15362 wkwock Fix selected zones
* Dec 4, 2012 15522 wkwock Fix added zones
*
* </pre>
*
@ -159,7 +160,7 @@ public class CountyZoneUgcDataManager {
* @throws VizException
*/
public ArrayList<ZoneInfoData> getZonesSelected() throws VizException {
return getZonesSelected(true);
return getZonesSelected(false);
}
/**

View file

@ -350,6 +350,14 @@ public class OtherPrecipOptions {
up_arrow.setEnabled(true);
}
}
Calendar currentTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
Calendar tmpDate = (Calendar) currentTime.clone();
tmpDate.setTime(DailyQcUtils.pdata[DailyQcUtils.pcpn_day].data_time);
tmpDate.add(Calendar.HOUR_OF_DAY, (DailyQcUtils.pcpn_time-3)*6);
if (currentTime.before(tmpDate)){
up_arrow.setEnabled(false);
}
} else {
/* 24 hour mode. */
if (pcp_flag + 4 >= num_qc_days * 4) {

View file

@ -59,6 +59,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 16, 2009 snaples Initial creation
* Dec 04, 2012 15544 wkwock fix missing 12z-18z after 12
*
* </pre>
*
@ -1021,6 +1022,12 @@ public class DailyQcUtils {
btime.set(Calendar.SECOND, 0);
hrgt12z = 0;
}
/* In order to allow user access the 12~18Z point data for the most recent day,
advance one more day from current day if the later than 18Z */
Calendar currentTime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
if (currentTime.get(Calendar.HOUR_OF_DAY)>=18) {
btime.add(Calendar.DAY_OF_MONTH, 1);
}
emonth = btime.get(Calendar.MONTH);
Calendar otime = Calendar.getInstance(TimeZone.getTimeZone("GMT"));

View file

@ -56,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Jun 08, 2010 5851 cjeanbap Properly stop alarm/alert observer listener; shellComp is null.
* Oct 31, 2011 8510 rferrel made PRIMARY_MODEL and add check for nonblank productID.
* Sep 20, 2012 1196 rferrel No longer Blocks
* 12/07/2012 15555 m.gamazaychikov Fixed the implementation for New Proximity Alarm.
* </pre>
*
* @author mnash
@ -330,15 +331,34 @@ public class NewAlarmDlg extends CaveSWTDialog {
AOR = new Button(aor, SWT.CHECK);
aorData = new GridData(SWT.DEFAULT, SWT.CENTER, false, false);
AOR.setLayoutData(aorData);
if (prod != null) {
/*
* DR15555 - Set the AOR selection to:
* 1. true - for new alarm
* 2. product's state - for existing alarm
*/
if (prod.getProductId() != "") {
AOR.setSelection(prod.isAor());
}
else {
AOR.setSelection(true);
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW));
}
AOR.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (AOR.getSelection() == true) {
/*
* DR15555 - handle the AOR selection:
* - set the background yellow
* - set the AORDistance text to empty string
* - set the ugcList text to empty string
*/
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW));
AORDistance.setText("");
ugcList.setText("");
} else {
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
@ -355,21 +375,33 @@ public class NewAlarmDlg extends CaveSWTDialog {
AORDistance = new Text(aor, SWT.SINGLE | SWT.BORDER);
aorData = new GridData(SWT.END, SWT.DEFAULT, false, false);
aorData.horizontalAlignment = SWT.RIGHT;
aorData.widthHint = 20;
aorData.widthHint = 60;
AORDistance.setLayoutData(aorData);
if (prod != null) {
/*
* DR15555 - Set the AORDistance selection to:
* 1. empty string - for new alarm
* 2. product's distance - for existing alarm
*/
if (prod.getProductId() != "") {
AORDistance.setText(prod.getAorDistance());
}
else {
AORDistance.setText("");
}
AORDistance.addListener(SWT.KeyDown, new Listener() {
@Override
public void handleEvent(Event e) {
if (!"".equals(AORDistance.getText())
|| (e.character != 0x8 && e.character != 0x7f)) {
AOR.setSelection(true);
/*
* DR15555 - handle the AOR selection:
* - set the AOR background gray
* - un-select the AOR
* - set the ugcList text to empty string
*/
AOR.setSelection(false);
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW));
}
SWT.COLOR_WIDGET_BACKGROUND));
ugcList.setText("");
}
});
@ -378,7 +410,12 @@ public class NewAlarmDlg extends CaveSWTDialog {
distanceLabel.setItems(new String[] { "mi", "km" });
aorData.horizontalAlignment = SWT.RIGHT;
distanceLabel.setLayoutData(aorData);
if (prod != null) {
/*
* DR15555 - Set the distanceLabel selection to:
* 1. 'mi' - for new alarm
* 2. product's label - for existing alarm
*/
if (prod.getProductId() != "") {
distanceLabel.setText(prod.getAorLabel());
} else {
distanceLabel.select(0);
@ -394,9 +431,32 @@ public class NewAlarmDlg extends CaveSWTDialog {
ugcLabel.setText("UGC List:");
ugcList = new Text(ugc, SWT.SINGLE | SWT.BORDER);
ugcList.setLayoutData(gd);
if (prod != null) {
/*
* DR15555 - Set the ugcList selection to:
* 1. empty string - for new alarm
* 2. product's ugcList - for existing alarm
*/
if (prod.getProductId() != "") {
ugcList.setText(prod.getUgcList());
}
else {
ugcList.setText("");
}
ugcList.addListener(SWT.KeyDown, new Listener() {
@Override
public void handleEvent(Event e) {
/*
* DR15555 - handle the ugcList selection:
* - set the AOR background gray
* - un-select the AOR
* - set the AORDistance text to empty string
*/
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
AOR.setSelection(false);
AORDistance.setText("");
}
});
// separator
GridData fullLayoutData = new GridData(SWT.FILL, SWT.DEFAULT, true,

View file

@ -26,14 +26,25 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.xml.bind.JAXB;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.text.alarms.AlarmAlertProduct;
import com.raytheon.uf.common.dataplugin.text.alarms.AlarmAlertProduct.ProductType;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.geospatial.SpatialException;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
import com.raytheon.uf.common.geospatial.SpatialQueryResult;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
@ -45,11 +56,15 @@ import com.raytheon.uf.common.localization.exception.LocalizationOpFailedExcepti
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.viz.texteditor.alarmalert.dialogs.AlarmAlertBell;
import com.raytheon.viz.texteditor.command.CommandFactory;
import com.raytheon.viz.texteditor.command.CommandFailedException;
import com.raytheon.viz.texteditor.command.ICommand;
import com.raytheon.viz.texteditor.util.TextEditorUtil;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
/**
* This class is used for some of the calculation work used in the alarm/alert
@ -62,6 +77,8 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
* ------------ ---------- ----------- --------------------------
* Sep 18, 2009 mnash Initial creation
* 03/19/2012 D. Friedman Fix determination of "Alarm" entries.
* 12/07/2012 15555 m.gamazaychikov Added methods and constants for
* the implementation of proximity alarm
*
* </pre>
*
@ -69,6 +86,14 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
* @version 1.0
*/
/**
* @author michaelg
*
*/
/**
* @author michaelg
*
*/
public class AlarmAlertFunctions {
private static final AlarmAlertProduct.ProductType AA = AlarmAlertProduct.ProductType.Alarm_Alert;
@ -89,6 +114,23 @@ public class AlarmAlertFunctions {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AlarmAlertFunctions.class);
private static final Pattern UGC_NEW_PATTERN = Pattern
.compile("^(([A-Z]{3})(\\d{3}))$");
private static final Pattern UGC_FOLLOW_PATTERN = Pattern
.compile("^(\\d{3})$");
private static String DEFAULT_DISTANCE="3000";
private static final String HYPHEN = Pattern.quote("-");
public static final Pattern UGC = Pattern
.compile("(^(\\w{2}[CZ]\\d{3}\\S*-\\d{6}-)$|((\\d{3}-)*\\d{6}-)$|((\\d{3}-)+))");
private static final double ONE_DEGREE_MI = 69.09;
private static final double ONE_DEGREE_KM = 111.20;
protected void getGIS() {
}
@ -105,7 +147,22 @@ public class AlarmAlertFunctions {
string.append("AOR");
}
if (!"".equals(prod.getAorDistance())) {
string.append("+" + prod.getAorDistance() + prod.getAorLabel());
/*
* DR15555 - check the text content,
* if it is not a valid number set the
* text to default 3000 mi
*/
Scanner scn = new Scanner(prod.getAorDistance());
while (scn.hasNext()){
if (!scn.hasNextInt()){
prod.setAorDistance(DEFAULT_DISTANCE);
break;
}
else {
scn.next();
}
}
string.append("AOR+" + prod.getAorDistance() + prod.getAorLabel());
} else if (!"".equals(prod.getUgcList())) {
string.append("UGC-" + prod.getUgcList());
}
@ -219,10 +276,11 @@ public class AlarmAlertFunctions {
if (productId != null) {
productId = productId.trim().toUpperCase();
for (AlarmAlertProduct a : currentAlarms) {
// **************
// TODO : For now disable Proximity Alerts
// **************
if (AA.equals(a.getProductType())) {
ProductType pt = a.getProductType();
/*
* Alarm_Alert
*/
if (AA.equals(pt)) {
String s = a.getProductId();
if (s != null) {
s = s.trim().toUpperCase();
@ -234,11 +292,333 @@ public class AlarmAlertFunctions {
}
}
}
/*
* DR1555 - Proximity_Alarm
*/
else if (PA.equals(pt)) {;
String s = a.getProductId();
if (s != null) {
s = s.trim().toUpperCase();
if (s.equals(productId)) {
List<StdTextProduct> productList = getProduct(a
.getProductId());
if (productList.size() > 0) {
StdTextProduct stp = productList.get(0);
if (stp != null) {
Geometry messagePolygon = getMessagePolygon(stp);
if (a.isAor()) {
/*
* Check if polygon in the message
* is within the AOR
*/
if (matchAOR(messagePolygon)) {
prods.add(a);
}
} else if (!"".equals(a.getAorDistance())) {
/*
* Check if polygon in the message
* is within the AOR+distance
*/
if (matchAORExtention(a.getAorDistance(),
a.getAorLabel(), messagePolygon)) {
prods.add(a);
}
} else if (!"".equals(a.getUgcList())) {
/*
* Check if UGCs in the message
* match the UGCs in the alarm
*/
String messageUGCs = getMessageUGCs(stp
.getProduct());
String alarmUGCs = a.getUgcList();
if (matchUGCList(alarmUGCs, messageUGCs)) {
prods.add(a);
}
}
}
}
}
}
}
}
}
return prods;
}
/**
* Return a String containing UGCs specified in the message
*
* @param productText
* @return
*/
private static String getMessageUGCs(String productText) {
String ugcLine = "";
for (String line : productText.replaceAll("\r", "").trim().split("\n")) {
Matcher m = UGC.matcher(line);
if (m.find()) {
ugcLine += line;
continue;
} else if (ugcLine.length() > 0) {
break;
}
}
return ugcLine;
}
/**
* Returns true if the polygon intersects the CWA
*
* @param polygon
* @return
*/
private static boolean matchAOR(Geometry polygon) {
Geometry cwa = null;
String site = LocalizationManager.getInstance().getCurrentSite();
try {
cwa = readCountyWarningArea(site);
} catch (SpatialException e) {
e.printStackTrace();
}
if (cwa!=null) {
if (polygon.intersects(cwa)) {
return true;
}
}
return false;
}
/**
* Returns true if a UGC specified in the alarmUGCs is present in the
* messageUGCs
*
* @param alarmUGCs
* @param messageUGCs
* @return
*/
private static boolean matchUGCList(String alarmUGCs, String messageUGCs) {
List<String> alarmUGCList = getUGCs(alarmUGCs);
for ( String alarmUGC: alarmUGCList) {
if (messageUGCs.contains(alarmUGC) ) {
return true;
}
}
return false;
}
/**
* Return a List of strings of UGCs
*
* @param ugcString
* @return
*/
private static List<String> getUGCs(String ugcString) {
String[] ugcList = ugcString.split(HYPHEN);
// Process the list of UGC lines into a list of UGCs in full form
// matching edit area names
List<String> finalUGCList = new ArrayList<String>(ugcList.length);
String state = null;
for (String ugc : ugcList) {
Matcher newGroup = UGC_NEW_PATTERN.matcher(ugc);
if (newGroup.matches()) {
state = newGroup.group(2);
finalUGCList.add(newGroup.group(1));
} else {
Matcher followGroup = UGC_FOLLOW_PATTERN.matcher(ugc);
if (followGroup.matches()) {
finalUGCList.add(state + followGroup.group(1));
}
}
}
return finalUGCList;
}
/**
* Return Geometry representing the site's CWA
*
* @param site
* @return
* @throws SpatialException
*/
private static Geometry readCountyWarningArea(String site)
throws SpatialException {
Map<String, RequestConstraint> map = new HashMap<String, RequestConstraint>();
map.put("cwa", new RequestConstraint(site));
SpatialQueryResult[] result = SpatialQueryFactory.create().query("cwa",
null, null, map, null);
if (result == null || result.length == 0) {
return null;
}
return result[0].geometry;
}
/**
* Returns true if the polygon intersects the CWA+distance
*
* @param distanceStr
* @param distanceUnits
* @param polygon
* @return
*/
private static boolean matchAORExtention(String distanceStr,
String distanceUnits, Geometry polygon) {
Geometry cwa = null;
String site = LocalizationManager.getInstance().getCurrentSite();
try {
cwa = readCountyWarningArea(site);
} catch (SpatialException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Geometry CWAConvex = cwa.convexHull();
double d0 = 0.0d;
if ("mi".equalsIgnoreCase(distanceUnits)) {
d0 = ONE_DEGREE_MI;
} else {
d0 = ONE_DEGREE_KM;
}
Double distance = Double.parseDouble(distanceStr);
double centerLat = Math.toRadians(CWAConvex.getCentroid().getY());
Double deltaX = distance / (Math.cos(centerLat) * d0);
Double deltaY = distance / d0;
Geometry expandedCWA = expandCWABy(CWAConvex, deltaX, deltaY);
if (expandedCWA != null) {
if (polygon.intersects(expandedCWA)) {
return true;
}
}
return false;
}
/**
* Return expanded by deltaX-deltaY geometry
*
* @param CWAConvex
* @param deltaX
* @param deltaY
* @return
*/
private static Geometry expandCWABy(Geometry CWAConvex, Double deltaX,
Double deltaY) {
Coordinate[] coords = CWAConvex.getCoordinates();
Coordinate[] coordsExpanded = new Coordinate[coords.length];
Double centerLat = CWAConvex.getCentroid().getY();
Double centerLon = CWAConvex.getCentroid().getX();
for (int i = 0; i < coords.length; i++) {
double latE = coords[i].y;
double lonE = coords[i].x;
if (coords[i].x < centerLon) {
lonE = coords[i].x - deltaX;
;
} else if (coords[i].x > centerLon) {
lonE = coords[i].x + deltaX;
} else if (coords[i].x == centerLon) {
lonE = coords[i].x;
}
if (coords[i].y < centerLat) {
latE = coords[i].y - deltaY;
} else if (coords[i].y > centerLat) {
latE = coords[i].y + deltaY;
} else if (coords[i].y == centerLat) {
latE = coords[i].y;
}
coordsExpanded[i] = new Coordinate(lonE, latE);
}
GeometryFactory gf = new GeometryFactory();
return gf.createLinearRing(coordsExpanded).convexHull();
}
/**
* Return the polygon contained in message
*
* @param stp
* @return
*/
private static Geometry getMessagePolygon(StdTextProduct stp) {
String body = stp.getProduct();
if (body.contains("LAT...LON")) {
Coordinate[] coords = getLatLonCoords(body);
GeometryFactory gf = new GeometryFactory();
return gf.createLinearRing(coords);
}
return null;
}
/**
* Return an array of Coordinate[] contained in the message
*
* @param body
* @return
*/
private static Coordinate[] getLatLonCoords(String body) {
String latLon = "";
boolean insideLatLon = false;
ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
Pattern latLonPtrn = Pattern
.compile("LAT...LON+(\\s\\d{3,4}\\s\\d{3,5}){1,}");
Pattern subLatLonPtrn = Pattern.compile("\\s(\\d{3,4})\\s(\\d{3,5})");
String[] separatedLines = body.split("\n");
for (String line : separatedLines) {
Matcher m = latLonPtrn.matcher(line);
if (m.find()) {
latLon = line;
insideLatLon = true;
continue;
}
if (insideLatLon) {
m = subLatLonPtrn.matcher(line);
if (!line.startsWith("TIME...") && m.find()) {
latLon += " " + line.trim();
continue;
} else {
insideLatLon = false;
}
}
}
coordinates = processLatlons(latLon);
Coordinate[] coords = new Coordinate[coordinates.size()];
coords = coordinates.toArray(coords);
return coords;
}
/**
* Process the extracted from the message latlon coordinates
* @param latLon
* @return
*/
private static ArrayList<Coordinate> processLatlons(String latLon) {
ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
String currentToken = null;
String latlon = "LAT...LON";
String latitude = null;
String longitude = null;
boolean pair = false;
Double dlat, dlong;
StringTokenizer latlonTokens = new StringTokenizer(latLon);
while (latlonTokens.hasMoreTokens()) {
currentToken = latlonTokens.nextToken();
if (!currentToken.equals(latlon)) {
if (pair) {
longitude = currentToken;
pair = false;
dlat = (double) (Integer.parseInt(latitude) / 100.0);
dlong = (double) ((Integer.parseInt(longitude) / 100.0) * (-1.0));
coordinates.add(new Coordinate(dlong, dlat));
} else {
latitude = currentToken;
pair = true;
}
}
}
Double dlong0 = coordinates.get(0).x;
Double dlat0 = coordinates.get(0).y;
coordinates.add(new Coordinate(dlong0, dlat0));
return coordinates;
}
/**
* initialize the localization for user with the save/load functions
*

View file

@ -34,6 +34,8 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData;
@ -94,6 +96,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 07/26/2012 15171 rferrel Disable editor's send and clear AFOS PIL fields when
* invalid product Id and user want to edit it anyway.
* 09/20/2012 1196 rferrel Changing dialogs being called to not block.
* 11/26/2012 14526 mgamazaychikov Added traverse listener for RETURN key
* </pre>
*
* @author lvenable
@ -221,6 +224,10 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
// this was after shell.pack() before, any reason why?
checkEnableEnter();
/*
* 14526 - Add the traverse listener for RETURN key
*/
setTraverseListenerReturn();
}
@Override
@ -608,49 +615,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
enterBtn.setEnabled(true);
enterBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
boolean sendEnabled = true;
if (!isProductValid()) {
// Notify the user that the product may not be valid.
//
// TODO cannot use a model MessageBox here. If displayed
// when an Alarm Alert Bell appears Cave freezes and
// nothing can be done. Need to change this to extend
// CaveSWTDialog in a similar manner to
// WarnGenConfirmationDlg. Better solution if possible
// change AlermAlertBell so modal MessagBox can be used..
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
| SWT.YES | SWT.NO);
mb.setMessage("Product Designator "
+ wsfoIdTF.getText()
+ prodCatTF.getText()
+ prodDesignatorTF.getText()
+ " is not in the list of valid products. Use it anyway?");
if (mb.open() == SWT.NO) {
return;
}
parentEditor.enableSend(false);
sendEnabled = false;
} else {
parentEditor.enableSend(true);
}
// call the set methods
parentEditor.setCurrentWmoId(wmoTtaaiiTF.getText());
parentEditor.setCurrentSiteId(ccccTF.getText());
if (sendEnabled) {
parentEditor.setCurrentWsfoId(wsfoIdTF.getText());
parentEditor.setCurrentProdCategory(prodCatTF.getText());
parentEditor.setCurrentProdDesignator(prodDesignatorTF
.getText());
} else {
parentEditor.setCurrentWsfoId("");
parentEditor.setCurrentProdCategory("");
parentEditor.setCurrentProdDesignator("");
}
parentEditor.setAddressee(addresseeTF.getText());
setBbbId();
setReturnValue(true);
shell.dispose();
enterBtnPressed();
}
});
@ -668,6 +633,57 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
}
protected void enterBtnPressed() {
/*
* 14526 - Added the check for when RETURN key is pressed
* but the "Enter" button is not enabled.
*/
if ( !enterBtn.getEnabled()) {
return;
}
boolean sendEnabled = true;
if (!isProductValid()) {
// Notify the user that the product may not be valid.
//
// TODO cannot use a model MessageBox here. If displayed
// when an Alarm Alert Bell appears Cave freezes and
// nothing can be done. Need to change this to extend
// CaveSWTDialog in a similar manner to
// WarnGenConfirmationDlg. Better solution if possible
// change AlermAlertBell so modal MessagBox can be used..
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES
| SWT.NO);
mb.setMessage("Product Designator " + wsfoIdTF.getText()
+ prodCatTF.getText() + prodDesignatorTF.getText()
+ " is not in the list of valid products. Use it anyway?");
if (mb.open() == SWT.NO) {
return;
}
parentEditor.enableSend(false);
sendEnabled = false;
} else {
parentEditor.enableSend(true);
}
// call the set methods
parentEditor.setCurrentWmoId(wmoTtaaiiTF.getText());
parentEditor.setCurrentSiteId(ccccTF.getText());
if (sendEnabled) {
parentEditor.setCurrentWsfoId(wsfoIdTF.getText());
parentEditor.setCurrentProdCategory(prodCatTF.getText());
parentEditor.setCurrentProdDesignator(prodDesignatorTF.getText());
} else {
parentEditor.setCurrentWsfoId("");
parentEditor.setCurrentProdCategory("");
parentEditor.setCurrentProdDesignator("");
}
parentEditor.setAddressee(addresseeTF.getText());
setBbbId();
setReturnValue(true);
shell.dispose();
}
/**
* This is a convenience method that will center a label in a RowLayout.
* When controls are placed in a RowLayout they are "aligned" at the top of
@ -942,6 +958,17 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
}
}
});
/*
* 14526 - Add the traverse listener for RETURN key
*/
tf.addTraverseListener(new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent te) {
te.doit = true;
}
});
}
private void textFieldVerifyListener(final StyledText tf) {
@ -1005,4 +1032,19 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
if (allBtn != null)
allBtn.setSelection("ALL".equals(addressee));
}
/*
* Adds the traverse listener for RETURN key
*/
private void setTraverseListenerReturn() {
shell.addTraverseListener(new TraverseListener() {
@Override
public void keyTraversed(TraverseEvent event) {
if (event.detail == SWT.TRAVERSE_RETURN) {
enterBtnPressed();
}
}
});
}
}

View file

@ -60,7 +60,6 @@ import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ExtendedModifyEvent;
import org.eclipse.swt.custom.ExtendedModifyListener;
import org.eclipse.swt.custom.PopupList;
import org.eclipse.swt.custom.ST;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
@ -99,9 +98,11 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.MessageBox;
@ -303,6 +304,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* Do not use changed BBB from OUPResponse.
* 17OCT2012 1229 rferrel Changes for non-blocking SWTMessageBox.
* 05Nov2012 15560 S. Naples Added check to see if we are in edit mode before capturing keys.
* 28Nov2012 14842 M.Gamazaychikov Re-wrote processPopup method
* 13Dec2012 1353 rferrel Change to make edit cancel message not
* dispaly the red had kill job message.
* </pre>
@ -1105,6 +1107,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
private static final String[] popupItems = { "Select All", "Cut", "Copy",
"Paste" };
private static final boolean[] isPopItemDefault = { true, false, true,
false };
private boolean warnGenFlag = false;
private boolean textWorkstationFlag = false;
@ -3633,7 +3638,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
}
if (e.button == 3) {
processPopup(e.x, e.y);
processPopup();
}
}
@ -3646,20 +3651,35 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
/**
* Process the user choice from the popup list.
* DR14842 - re-written
*/
private void processPopup(int x, int y) {
PopupList popupList = new PopupList(shell);
popupList.setMinimumWidth(50);
private void processPopup() {
Menu menu = new Menu(shell, SWT.POP_UP);
List<String> items = Arrays.asList(popupItems);
for (String pi : popupItems) {
MenuItem mi = new MenuItem(menu, SWT.PUSH);
mi.setText(pi);
if (isEditMode()) {
popupList.setItems(popupItems);
mi.setEnabled(true);
} else {
popupList.setItems(new String[] { "Select All", "Copy" });
mi.setEnabled(isPopItemDefault[items.indexOf(pi)]);
}
mi.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event event) {
handleSelection(event);
}
});
}
menu.setVisible(true);
}
popupList.select(popupItems[0]);
Point p = Display.getCurrent().map(textEditor, null, x, y);
String choice = popupList.open(new Rectangle(p.x + 10, p.y + 10, 100,
200));
/**
* Handle the selection from the popup menu
* @param event
*/
protected void handleSelection(Event event) {
MenuItem item = (MenuItem) event.widget;
String choice = item.getText();
if (choice != null) {
if (popupItems[0].equals(choice)) {
textEditor.selectAll();

View file

@ -25,8 +25,8 @@
<substitute key="NAM40model" value="mesoEta212" />
<substitute key="ARWmodel1" value="HiResW-ARW-East" />
<substitute key="ARWmodel2" value="HiResW-ARW-West" />
<substitute key="MMMmodel1" value="HiResW-MMM-East" />
<substitute key="MMMmodel2" value="HiResW-MMM-West" />
<substitute key="MMMmodel1" value="HiResW-NMM-East" />
<substitute key="MMMmodel2" value="HiResW-NMM-West" />
<include installTo="menu:volume?after=VolumeBundles"
fileName="menus/volume/baseFamilies.xml">
</include>

View file

@ -1309,7 +1309,7 @@
key="PWmean" indentText="false" />
<contribute xsi:type="menuItem" menuText="Mean Sea Level Pressure"
key="PMSLmean" indentText="false" />
<contribute xsi:type="menuItem" menuText="Dew Point Temp"
<contribute xsi:type="menuItem" menuText="Dewpoint Temp"
key="DpTmean" indentText="false" />
<contribute xsi:type="menuItem" menuText="12-hr Large scale Snowfall"
key="SNOL12mean" indentText="false" />
@ -1353,7 +1353,7 @@
key="PWsprd" indentText="false" />
<contribute xsi:type="menuItem" menuText="Mean Sea Level Pressure"
key="PMSLsprd" indentText="false" />
<contribute xsi:type="menuItem" menuText="Dew Point Temp"
<contribute xsi:type="menuItem" menuText="Dewpoint Temp"
key="DpTsprd" indentText="false" />
<contribute xsi:type="menuItem" menuText="12-hr Large scale Snowfall"
key="SNOL12sprd" indentText="false" />

View file

@ -56,6 +56,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 1, 2010 mschenke Initial creation
* 12/06/2012 DR 15559 Qinglu Lin Added round() methods.
*
* </pre>
*
@ -953,4 +954,34 @@ public class PolygonUtil {
coordinate.x = x / Math.pow(10, decimalPlaces);
coordinate.y = y / Math.pow(10, decimalPlaces);
}
public static void round(List<Coordinate >coordinates, int decimalPlaces) {
for (Coordinate coordinate : coordinates) {
round(coordinate, decimalPlaces);
}
}
public static void round(Coordinate[] coordinates, int decimalPlaces) {
for (Coordinate coordinate : coordinates) {
round(coordinate, decimalPlaces);
}
}
/**
* round()
* Rounding coordinates, instead of truncating them.
*
* History
* 12/06/2012 DR 15559 Qinglu Lin Created.
*/
public static void round(Coordinate coordinate, int decimalPlaces) {
double x = coordinate.x * Math.pow(10, decimalPlaces);
double y = coordinate.y * Math.pow(10, decimalPlaces);
x = Math.round(x);
y = Math.round(y);
coordinate.x = x / Math.pow(10, decimalPlaces);
coordinate.y = y / Math.pow(10, decimalPlaces);
}
}

View file

@ -144,6 +144,15 @@ import com.vividsolutions.jts.io.WKTReader;
* warningAction is neither null nor WarningAction.NEW, removed
* some code from redrawBoxFromHatched().
* 11/15/2012 DR 15430 D. Friedman Use correct county/zone in createGeometryForWatches.
* 11/29/2012 DR 15571 Qinglu Lin Called compuateCurrentStormCenter() in getStormLocations();
* For CON, CAN, and COR, calculate Coordinate array, cc, specifically in
* getStormLocations().
* 12/10/2012 DR 15571 Qinglu Lin Change warningAction's initialization from null to WarningAction.NEW, and add code
* in getStormLocations() for handling case when warningAction equals WarningAction.NEW;
* 12/13/2012 DR 15559 Qinglu Lin Added code to call WarngenUIState's adjustPolygon().
* 12/17/2012 DR 15571 Qinglu Lin For hydro products,futurePoints is null. Resolved an issue caused by trying to get
* Coordinate[] from futurePoints.
* 12/18/2012 DR 15571 Qinglu Lin Resolved coordinate issue in TML line caused by clicking Restart button.
*
* </pre>
*
@ -229,7 +238,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
private GeospatialDataList geoData = null;
private WarningAction warningAction = null;
private WarningAction warningAction = WarningAction.NEW;
static {
for (int i = 0; i < 128; i++) {
@ -1600,7 +1609,16 @@ public class WarngenLayer extends AbstractStormTrackResource {
.hatchWarningArea(state.getWarningPolygon(),
state.getWarningArea());
if (hatched != null) {
state.setWarningPolygon(hatched);
// DR 15559
Coordinate[] coords = hatched.getCoordinates();
PolygonUtil.round(coords, 2);
state.adjustPolygon(coords);
GeometryFactory gf = new GeometryFactory();
LinearRing lr = gf.createLinearRing(coords);
state.setWarningPolygon(gf.createPolygon(lr, null));
updateWarnedAreas(true, true);
issueRefresh();
// End of DR 15559
state.snappedToArea = true;
}
System.out.println("Time to createWarningPolygon: "
@ -1822,6 +1840,13 @@ public class WarngenLayer extends AbstractStormTrackResource {
case POINT:
cc = new Coordinate[] { stormTrackState.futurePoints == null ? stormTrackState.dragMePoint
.getCoordinate() : stormTrackState.futurePoints[0].coord };
if (warningAction == null || warningAction == WarningAction.NEW || warningAction == WarningAction.CON
|| warningAction == WarningAction.CAN) {
Coordinate coord = new Coordinate(stormTrackState.dragMePoint.getCoordinate());
DataTime currentDataTime = new DataTime(SimulatedTime.getSystemTime().getTime());
if (stormTrackState.compuateCurrentStormCenter(coord,currentDataTime))
cc = new Coordinate[] {coord};
}
break;
case POLY:
Coordinate[] polyPoints = stormTrackState.dragMeLine

View file

@ -41,6 +41,8 @@ import com.vividsolutions.jts.geom.Polygon;
* May 7, 2010 mschenke Initial creation
* 03/14/2012 DR 14690 Qinglu Lin Add clear2().
* 10/26/2012 DR 15479 Qinglu Lin Added removeDuplicateCoordinate().
* 12/06/2012 DR 15559 Qinglu Lin Added computeSlope(), computeCoordinate(),
* and adjustPolygon().
*
* </pre>
*
@ -145,6 +147,151 @@ public class WarngenUIState {
warningPolygon = gf.createPolygon(gf.createLinearRing(vertices), null);
}
/**
* computeSlope
* compute the slope of a line.
*
* History
* 12/06/2012 DR 15559 Qinglu Lin Created.
*/
private double computeSlope(Coordinate[] coords, int i) {
double min = 1.0E-08;
double dx = coords[i].x-coords[i+1].x;
double slope = 0.0;
if (Math.abs(dx)>min) {
slope = (coords[i].y-coords[i+1].y)/dx;
}
return slope;
}
/**
* computeCoordinate
* Compute the x component of a coordinate after its y component
* is adjusted.
*
* History
* 12/06/2012 DR 15559 Qinglu Lin Created.
*/
private void computeCoordinate(Coordinate[] c, int i, int j) {
double slope;
slope = computeSlope(c,i);
int iPlus1 = i+1;
if (c[j].x>=c[i].x && c[j].x<=c[iPlus1].x ||
c[j].x>=c[iPlus1].x && c[j].x<=c[i].x) {
double x,y;
double min1 = 0.005d;
y = slope*(c[j].x-c[i].x) + c[i].y;
double d = Math.abs(y-c[j].y);
if (d>min1)
return;
double min2 = 1.0E-8d;
double delta = 0.005d; // empirical value
double dyMin = 0.01d;
int jMinus1 = j-1;
if (jMinus1<0)
jMinus1 = c.length-2;
int jPlus1 = j+1;
if (Math.abs(y-c[j].y)<min1) {
double dy1, dy2;
dy1 = Math.abs(c[jMinus1].y-y);
dy2 = Math.abs(c[jPlus1].y-y);
if (dy1>=dy2 && (Math.abs(dy1)>dyMin || Math.abs(dy2)>dyMin)) {
// attempt to use l2 for computation
if (c[j].y==c[jMinus1].y && Math.abs(c[j].x-c[jMinus1].x)>min2) {
// l2 is a horizontal line, use l3 for computation
if (c[jPlus1].y<c[j].y) delta = -delta;
slope = computeSlope(c,j);
if (Math.abs(slope) > min2) {
y = c[j].y+delta;
x = (y-c[jPlus1].y)/slope + c[jPlus1].x;
} else {
// l3 is a vertical line
y = c[j].y+delta;
x = c[j].x;
}
} else {
// use l2 for computation
if (c[jMinus1].y<c[j].y) delta = -delta;
slope = computeSlope(c,jMinus1);
if (Math.abs(slope) > min2) {
y = c[j].y+delta;
x = (y-c[jMinus1].y)/slope + c[jMinus1].x;
} else {
// l2 is a vertical line
y = c[j].y+delta;
x = c[j].x;
}
}
} else {
if (Math.abs(dy1)>dyMin || Math.abs(dy2)>dyMin) {
// attempt to use l3 for computation
if (c[j].y==c[jPlus1].y && Math.abs(c[j].x-c[jPlus1].x)>min2) {
// l3 is a horizontal line, use l2 for computation
if (c[jMinus1].y<c[j].y) delta = -delta;
slope = computeSlope(c,jMinus1);
if (Math.abs(slope) > min2) {
y = c[j].y+delta;
x = (y-c[jMinus1].y)/slope + c[jMinus1].x;
} else {
// l2 is a vertical line
y = c[j].y+delta;
x = c[j].x;
}
} else {
// use l3 for computation
if (c[jPlus1].y<c[j].y) delta = -delta;
slope = computeSlope(c,j);
if (Math.abs(slope) > min2) {
y = c[j].y+delta;
x = (y-c[jPlus1].y)/slope + c[jPlus1].x;
} else {
// l3 is a vertical line
y = c[j].y+delta;
x = c[j].x;
}
}
} else {
x = c[j].x;
y = c[j].y;
}
}
c[j].x = x;
c[j].y = y;
if (j==0)
c[c.length-1] = c[j];
}
}
}
/**
* adjustPolygon
* When a point is very close to a line in the initial warning polygon, the resulting coordinates
* cause the failure of polygon drawing in follow-up. The method move that kind of points away from
* the line, and return a Polygon.
*
* History
* 12/06/2012 DR 15559 Qinglu Lin Created.
*/
public void adjustPolygon(Coordinate[] coords) {
int n = coords.length;
for (int i=0; i<n-1; ++i) {
int j;
for (j=i+2; j<=n-2; j++) {
computeCoordinate(coords,i,j);
}
if (i<=n-3)
for (j=0; j<i; j++) {
computeCoordinate(coords,i,j);
}
else
for (j=1; j<i; j++) {
computeCoordinate(coords,i,j);
}
}
}
/**
* Set the old warning area in lat/lon projection. Will be converted to
* local

View file

@ -127,6 +127,11 @@ import com.vividsolutions.jts.io.WKTReader;
* Sep 10, 2012 15295 snaples Added property setting for runtime log to createScript.
* Sep 18, 2012 15332 jsanchez Used a new warning text handler.
* Nov 9, 1202 DR 15430 D. Friedman Improve watch inclusion.
* Nov 26, 2012 15550 Qinglu Lin For CAN to EXP, added TMLtime to context.
* Nov 30, 2012 15571 Qinglu Lin For NEW, assigned simulatedTime to TMLtime; For COR, used stormLocs
* in oldWarn.
* Dec 17, 2012 15571 Qinglu Lin For hydro products, resolved issue caused by calling wkt.read(loc)
* while loc is null.
* </pre>
*
* @author njensen
@ -368,8 +373,6 @@ public class TemplateRunner {
// CAN and EXP products follow different rules as followups
if (!(selectedAction == WarningAction.CAN || selectedAction == WarningAction.EXP)) {
Coordinate[] stormLocs = warngenLayer
.getStormLocations(stormTrackState);
wx = new Wx(config, stormTrackState,
warngenLayer.getStormLocations(stormTrackState),
startTime.getTime(), DateUtil.roundDateTo15(endTime)
@ -391,7 +394,10 @@ public class TemplateRunner {
context.put("duration", duration);
context.put("event", eventTime);
if (selectedAction == WarningAction.COR)
context.put("TMLtime", eventTime);
else
context.put("TMLtime", simulatedTime);
context.put("ugcline",
FipsUtil.getUgcLine(areas, wx.getEndTime(), 15));
context.put("areaPoly", GisUtil.convertCoords(warngenLayer
@ -433,13 +439,25 @@ public class TemplateRunner {
motionDirection -= 360;
}
context.put("movementDirection", motionDirection);
Coordinate[] stormLocs = warngenLayer
.getStormLocations(stormTrackState);
// Convert to Point2D representation as Velocity requires
// getX() and getY() methods which Coordinate does not have
Coordinate[] newStormLocs = GisUtil.d2dCoordinates(stormLocs);
Point2D.Double[] coords = new Point2D.Double[newStormLocs.length];
for (int i = 0; i < newStormLocs.length; i++) {
coords[i] = new Point2D.Double(newStormLocs[i].x,
newStormLocs[i].y);
if (selectedAction == WarningAction.COR) {
AbstractWarningRecord oldWarn = CurrentWarnings.getInstance(
threeLetterSiteId).getNewestByTracking(etn, phenSig);
String loc = oldWarn.getLoc();
if (loc != null) {
Geometry locGeom = wkt.read(loc);
stormLocs = locGeom.getCoordinates();
}
} else {
stormLocs = GisUtil.d2dCoordinates(stormLocs);
}
Point2D.Double[] coords = new Point2D.Double[stormLocs.length];
for (int i = 0; i < stormLocs.length; i++) {
coords[i] = new Point2D.Double(stormLocs[i].x,
stormLocs[i].y);
}
context.put("eventLocation", coords);
t0 = System.currentTimeMillis();
@ -453,6 +471,7 @@ public class TemplateRunner {
threeLetterSiteId).getNewestByTracking(etn, phenSig);
context.put("now", simulatedTime);
context.put("event", eventTime);
context.put("TMLtime", eventTime);
context.put("start", oldWarn.getStartTime().getTime());
context.put("expire", oldWarn.getEndTime().getTime());
Calendar canOrExpCal = Calendar.getInstance();
@ -468,11 +487,19 @@ public class TemplateRunner {
.getCoordinates()));
// If there is no storm track
if (oldWarn.getLoc() != null) {
Geometry locGeom = wkt.read(oldWarn.getLoc());
Coordinate[] locs = locGeom.getCoordinates();
// Convert to Point2D representation as Velocity requires
// getX() and getY() methods which Coordinate does not have
Point2D.Double[] coords = new Point2D.Double[locs.length];
Point2D.Double[] coords;
Coordinate[] locs;
if (selectedAction == WarningAction.CAN) {
locs = warngenLayer.getStormLocations(stormTrackState);
locs = GisUtil.d2dCoordinates(locs);
coords = new Point2D.Double[locs.length];
} else {
Geometry locGeom = wkt.read(oldWarn.getLoc());
locs = locGeom.getCoordinates();
coords = new Point2D.Double[locs.length];
}
for (int i = 0; i < locs.length; i++) {
coords[i] = new Point2D.Double(locs[i].x, locs[i].y);
}

Binary file not shown.

Binary file not shown.

View file

@ -82,10 +82,6 @@
<param name="feature"
value="com.raytheon.uf.edex.npp.feature" />
</antcall>
<antcall target="build">
<param name="feature"
value="com.raytheon.uf.edex.npp.feature" />
</antcall>
<antcall target="build">
<param name="feature"
value="com.raytheon.uf.edex.registry.feature" />

View file

@ -10,7 +10,6 @@
<sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>10</expirationMinutes>
<unit>inches</unit>
</source>
<source>
<SourceName>DPR</SourceName>
@ -22,7 +21,6 @@
<sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
</source>
<source>
<SourceName>DHRMOSAIC</SourceName>
@ -33,7 +31,6 @@
<sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion>
<dateFormat>yyyyMMddHHmm</dateFormat>
<hrapGridFactor>4</hrapGridFactor>
@ -47,7 +44,6 @@
<sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion>
<dateFormat>yyyyMMddHHmm</dateFormat>
<hrapGridFactor>4</hrapGridFactor>
@ -64,7 +60,6 @@
<sourceType>QPF</sourceType>
<rateOrAccum>accum</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<mosaic>true</mosaic>
</source>
<source>
@ -76,7 +71,6 @@
<sourceType>QPF</sourceType>
<rateOrAccum>accum</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion>
<mosaic>true</mosaic>
<dateFormat>yyyyMMddHHmm</dateFormat>
@ -91,7 +85,6 @@
<sourceType>QPF</sourceType>
<rateOrAccum>accum</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion>
<mosaic>true</mosaic>
<dateFormat>yyyyMMddHHmm</dateFormat>
@ -109,7 +102,6 @@
<expirationMinutes>2080</expirationMinutes>
<interpolatedGuidanceDelay>true</interpolatedGuidanceDelay>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<unit>inches</unit>
<conversion>0.03937</conversion>
<mosaic>true</mosaic>
<guidanceType>RFC</guidanceType>
@ -126,7 +118,6 @@
<expirationMinutes>2080</expirationMinutes>
<interpolatedGuidanceDelay>true</interpolatedGuidanceDelay>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<unit>inches</unit>
<conversion>0.03937</conversion>
<mosaic>true</mosaic>
<guidanceType>RFC</guidanceType>
@ -143,7 +134,6 @@
<expirationMinutes>2080</expirationMinutes>
<interpolatedGuidanceDelay>true</interpolatedGuidanceDelay>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<unit>inches</unit>
<conversion>0.03937</conversion>
<mosaic>true</mosaic>
<guidanceType>RFC</guidanceType>
@ -157,7 +147,6 @@
<sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>30</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion>
<hrapGridFactor>4</hrapGridFactor>
</source>
@ -170,7 +159,6 @@
<sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>30</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion>
<hrapGridFactor>4</hrapGridFactor>
</source>
@ -183,7 +171,6 @@
<sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
</source>
<source>
<SourceName>VGBDPR</SourceName>
@ -194,7 +181,6 @@
<sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
</source>
<product primarySource="DHRMOSAIC">
<rate>DHRMOSAIC</rate>

View file

@ -33,6 +33,7 @@ import com.raytheon.edex.plugin.gfe.cache.ifpparms.IFPParmIdCache;
import com.raytheon.edex.plugin.gfe.db.dao.GFEDao;
import com.raytheon.edex.plugin.gfe.db.dao.IscSendRecordDao;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
import com.raytheon.edex.plugin.gfe.exception.GfeMissingConfigurationException;
import com.raytheon.edex.plugin.gfe.isc.IRTManager;
import com.raytheon.edex.plugin.gfe.reference.MapManager;
import com.raytheon.edex.plugin.gfe.server.GridParmManager;
@ -75,6 +76,8 @@ import com.raytheon.uf.edex.site.ISiteActivationListener;
* Apr 06, 2012 #457 dgilling Clear site's ISCSendRecords on
* site deactivation.
* Jul 12, 2012 15162 ryu added check for invalid db at activation
* Dec 11, 2012 14360 ryu log a clean message in case of
* missing configuration (no stack trace).
*
* </pre>
*
@ -237,6 +240,13 @@ public class GFESiteActivation implements ISiteActivationListener {
"Error validating configuration for " + siteID);
}
internalActivateSite(siteID);
} catch (GfeMissingConfigurationException e) {
sendActivationFailedNotification(siteID);
// Stack trace is not printed per requirement for DR14360
statusHandler.handle(Priority.PROBLEM, siteID
+ " will not be activated: "
+ e.getLocalizedMessage());
throw e;
} catch (Exception e) {
sendActivationFailedNotification(siteID);
statusHandler.handle(Priority.PROBLEM, siteID

View file

@ -31,6 +31,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
import com.raytheon.edex.plugin.gfe.exception.GfeMissingConfigurationException;
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteDefinition;
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteKey;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
@ -52,6 +53,7 @@ import com.raytheon.uf.common.util.FileUtil;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 9, 2009 njensen Initial creation
* Dec 11, 2012 14360 ryu Throw specific exception for missing configuration.
*
* </pre>
*
@ -152,11 +154,11 @@ public class IFPServerConfigManager {
}
}
if (!siteConfigFound) {
throw new GfeConfigurationException(
throw new GfeMissingConfigurationException(
"No siteConfig.py file found for " + siteID);
}
} else {
throw new GfeConfigurationException(
throw new GfeMissingConfigurationException(
"No site config directory found for " + siteID);
}
siteDir = siteDirFile.getPath();

View file

@ -0,0 +1,59 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.exception;
/**
* Exception class for missing GFE server configuration
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 12/11/12 #14360 ryu Initial Creation
*
* </pre>
*
* @author ryu
* @version 1.0
*/
public class GfeMissingConfigurationException extends GfeConfigurationException {
private static final long serialVersionUID = 1L;
/**
* @param aCause
*/
public GfeMissingConfigurationException(String aCause) {
super(aCause);
}
/**
* Parser exception set with a cause and an existing exception. Used for
* exception chaining to preserve state.
*
* @param aCause
* @param anException
*/
public GfeMissingConfigurationException(String aCause, Throwable anException) {
super(aCause, anException);
}
}

View file

@ -935,7 +935,7 @@ public class D2DGridDatabase extends VGridDatabase {
break;
}
}
return !isAccum && isDuration;
return isDuration;
}
return !isAccum;

View file

@ -56,7 +56,7 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory;
* Oct 09, 2009 bphillip Initial creation
* Sep 19, 2011 10955 rferrel make sure process destroy is called.
* Jun 12, 2012 00609 djohnson Use EDEXUtil for EDEX_HOME.
* Nov 15,2012 15614 jdynina Added check for national center
* Nov 15, 2012 15614 jdynina Added check for national center
*
* </pre>
*

View file

@ -56,6 +56,8 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* correctly parse multiple SHEF formats
* 12/03/2008 chammack Camel refactor
* 12/xx/2010 jkorman Complete rewrite.
* 11/29/2012 lbousaidi fixed the decoding issue when the shef starts
* with :
* </pre>
*
* @author bphillip
@ -615,9 +617,6 @@ public class ShefSeparator extends AbstractRecordSeparator {
private static String removeInternalComments(String dataLine) {
String s = null;
if (dataLine != null) {
if (dataLine.startsWith(":")) {
s = new String();
} else {
StringBuilder buffer = new StringBuilder(dataLine.length());
boolean inComment = false;
for (int i = 0; i < dataLine.length(); i++) {
@ -631,7 +630,6 @@ public class ShefSeparator extends AbstractRecordSeparator {
}
}
s = buffer.toString();
}
} else {
s = new String();
}

View file

@ -78,6 +78,8 @@ import com.raytheon.uf.edex.database.dao.DaoConfig;
* 02/02/2009 1943 J. Sanchez Add method postRiverStatus.
* 05/29/2009 2410 J. Sanchez Posted data for unknstnvalue.
* 02/24/2012 14535 W. Kwock Correct the duration value.
* 11/29/2012 15530 lbousaidi corrected posting and production time for
* latestobsvalue table.
*
* </pre>
*
@ -1074,10 +1076,9 @@ public class PostTables {
}
cs.setString(11, productId);
cs.setTimestamp(12, new Timestamp(shefData.getObservationTimeObj()
.getTime()));
cs.setTimestamp(13, new Timestamp(shefData.getObservationTimeObj()
.getTime()));
cs.setTimestamp(12, new java.sql.Timestamp(productTime.getTime()));
cs.setTimestamp(13, new java.sql.Timestamp(postTime.getTime()));
int doOverwrite = PostTables.determineUpdateAction(duplicateOption,
record.isRevisedRecord());

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* 6/1/09 #2432 jsanchez Updated value magnitude for hourlypp/pc.
* 26 Nov 2012 #15554 lbousaidi used obstime instead of system time in isNear12Z
* routine.
* 4 Dec 2012 #15569 lbousaidi fixed daily pp value when token is set to USE_REVCODE
* </pre>
*
* @author mnash
@ -408,6 +409,13 @@ public class GagePP {
default:
break;
}
} else {
if (rec.getDataDuration() == 24) {
dailyPP.setValue(Double.valueOf(rec.getValue()));
dailyPP.setQc(String.valueOf(rec.getQualCode()));
rev_24hour_code = rec.revision;
}
}
/*
* Increment the count of total values. This should always

View file

@ -159,15 +159,19 @@ public class ModelData implements ISerializableObject {
public double getValue(String modelName, String prodType, Coordinate coor) {
double value = -99999.0;
try {
System.out.println("Freezing level---debug0 getValue "+modelName+" "+prodType+" "+coor+" "+gribMap.size());
Point point = getPoint(modelName, prodType, coor);
GridRecord gribRec = getRecord(modelName, prodType);
FloatDataRecord rec = (FloatDataRecord) getRecord(modelName,
prodType).getMessageData();
value = rec.getFloatData()[(gribRec.getSpatialObject().getNx() * point.x)
+ point.y];
System.out.println("Freezing level---debug1 getValue "+rec.getFloatData().length+" "+
gribRec.getSpatialObject().getNx()+","+gribRec.getSpatialObject().getNy()+" "+point);
value = rec.getFloatData()[(gribRec.getSpatialObject().getNx() *
(gribRec.getSpatialObject().getNy()-point.y)) + point.x];
} catch (Exception e) {
logger.error("No Grib value available....." + modelName + " "
+ prodType);
e.printStackTrace();
}
return value;
}

View file

@ -28,6 +28,7 @@ package com.raytheon.uf.common.monitor.xml;
* ------------ ---------- ----------- --------------------------
* 29 Jan, 2010 3915 dhladky Initial creation
* 18 Apr. 2012 DR 14619 dhladky Replace isOverride()
* 28 Nov. 2012 DR 14412 gzhang makes unit internal to this class
* </pre>
* @author dhladky
* @version 1.0
@ -86,9 +87,11 @@ public class SourceXML implements ISerializableObject {
@XmlElement(name = "interpolatedGuidanceTransition")
protected boolean interpolatedGuidanceTransition;
@XmlElement(name = "unit")
//@XmlElement(name = "unit") // DR 14412
protected String unit;
public static final String UNIT_TXT = "inches"; // DR 14412
@XmlElement(name = "conversion")
protected Double conversion = 1.0;
@ -285,6 +288,8 @@ public class SourceXML implements ISerializableObject {
}
public String getUnit() {
if( unit == null || unit.isEmpty()) // DR 14412
unit = UNIT_TXT;
return unit;
}

View file

@ -24,10 +24,22 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
import java.util.TreeSet;
import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.DirectPosition2D;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
import com.raytheon.uf.common.geospatial.ISpatialObject;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.PointUtil;
import com.raytheon.uf.common.monitor.xml.SCANModelParameterXML;
import com.vividsolutions.jts.geom.Coordinate;
@ -72,9 +84,9 @@ public class FreezingLevel {
// reference time
Calendar refTime = null;
private transient final Log logger = LogFactory.getLog(getClass());
public FreezingLevel(String modelName) {
this.modelName = modelName;
times = new HashMap<Integer, Date>();
zeroCount = 0;
@ -96,6 +108,79 @@ public class FreezingLevel {
}
}
/**
* find (x,y) coordinate for lat,lon(coor)
* @param coors
*/
public DirectPosition2D findXYloc(Coordinate coor, String type){
ScanDataCache cache = ScanDataCache.getInstance();
ISpatialObject iso = cache.getModelData().getGridRecord(modelName, type).getSpatialObject();
CoordinateReferenceSystem crs=iso.getCrs();
GridGeometry2D mapGeometry = MapUtil.getGridGeometry(iso);
DirectPosition2D resultPoint;
try {
resultPoint = PointUtil.determineExactIndex(
coor, crs, mapGeometry);
System.out.println("Freezing level -- lat,lon:"+coor+" = "+resultPoint);
return resultPoint;
} catch (Exception e) {
System.out.println("Error: Freezing level -- unable to find x,y coordinate for lat,lon:"+coor);
e.printStackTrace();
}
return null;
}
/**
* get the bi-linear interpolation value amount the nearest 4 points
*
* @param modelName, prodType, coor
* @return bi-linear interpolation amount the nearest 4 points
* @throws VizException
*/
public double getValue(String modelName, String prodType, Coordinate coor) {
double value = -99999.0;
try {
//xyLoc is the location in x,y
DirectPosition2D xyLoc = findXYloc(coor, prodType);
//data from hdf5
ScanDataCache cache = ScanDataCache.getInstance();
GridRecord gribRec = cache.getModelData().getGridRecord(modelName, prodType);
FloatDataRecord rec = (FloatDataRecord) gribRec.getMessageData();
//dimension of the record from hdf5, recNx =151 and recNy=113 during development
int recNx = gribRec.getSpatialObject().getNx();
int recNy = gribRec.getSpatialObject().getNy();
//get four nearest points/values form the record around xyLoc
int x0=(int)(xyLoc.x);
int x1=x0+1;
int y0=(int)(xyLoc.y);
int y1=y0+1;
double p1=xyLoc.x-x0;
double p2=1-p1;
double p3=xyLoc.y-y0;
double p4=1-p3;
double value2 = rec.getFloatData()[(recNx * y0) + x0];
double value3 = rec.getFloatData()[(recNx * y0) + x1];
double value0 = rec.getFloatData()[(recNx * y1) + x0];
double value1 = rec.getFloatData()[(recNx * y1) + x1];
//do a bi-linear interpolation amount the nearest 4 points
value = (p1*p4*value1)+(p2*p4*value0)+(p1*p3*value3)+(p2*p3*value2);
logger.info("bi-linear interpolation value: "+value+" "+value0+" "+value1+
" "+value2+" "+value3+" for coor:"+coor+" "+recNx+","+recNy);
} catch (Exception e) {
logger.error("No Grib value available....." + modelName + " "
+ prodType+" lat,lon:"+coor);
e.printStackTrace();
}
return value;
}
/**
* Give me the freezing level for an array of points
*
@ -107,6 +192,7 @@ public class FreezingLevel {
HashMap<Coordinate, Float> freezingMap = new HashMap<Coordinate, Float>();
ScanDataCache cache = ScanDataCache.getInstance();
//get data from hdf5 files
for (Coordinate coor : coors) {
HashMap<Integer, Double> ghValues = new HashMap<Integer, Double>();
@ -114,34 +200,46 @@ public class FreezingLevel {
for (Entry<String, Integer> entry : getGHLevelMap().entrySet()) {
if (cache.getModelData().isType(modelName, entry.getKey())) {
ghValues.put(entry.getValue(), cache.getModelData()
.getValue(modelName, entry.getKey(), coor));
ghValues.put(entry.getValue(), getValue(modelName, entry.getKey(), coor));
} else {
ghValues.put(entry.getValue(),null);
}
}
for (Entry<String, Integer> entry : getTLevelMap().entrySet()) {
if (cache.getModelData().isType(modelName, entry.getKey())) {
tValues.put(entry.getValue(), cache.getModelData()
.getValue(modelName, entry.getKey(), coor));
tValues.put(entry.getValue(), getValue(modelName, entry.getKey(), coor));
}
}
Double fLevel = -99999.0;
//here's the calculation
Double fLevel = 0.0;
Integer jtopLevel = null;
Integer ktopLevel = null;
int foundValFlag=-1;//-1=all ghValue and tValue are null,
//0=all ghValue<=-9000 and tValue<=273.16, 1=found a fLevel
System.out
.println("********** Starting Freezing Level Calculations *****************");
for (Integer level : ghValues.keySet()) {
TreeSet<Integer> ts= new TreeSet<Integer>(ghValues.keySet());//want an asc sorted list
Iterator<Integer> it = ts.iterator();
//for (Integer level : ghValues.keySet()) {
while (it.hasNext()) {
Integer level = (Integer) it.next();
Double tValue = tValues.get(level);
Double ghValue = ghValues.get(level);
System.out.println("GH Value: " + ghValue + " TValue: "
+ tValue);
if (ghValue != null && ghValue > -9000) {
if (tValue != null && tValue > 273.16) {
if (ghValue != null && tValue != null && foundValFlag ==-1){
foundValFlag=0;
}
if (ghValue != null && ghValue.doubleValue() > -9000) {
if (tValue != null && tValue.doubleValue() > 273.16) {
fLevel = (ghValues.get(ktopLevel) - ((ghValues
.get(ktopLevel) - ghValue) * ((273.16 - tValues
@ -155,6 +253,7 @@ public class FreezingLevel {
+ " - " + tValues.get(jtopLevel)
+ ")))) * .00328");
System.out.println("*** FreezingLevel = " + fLevel);
foundValFlag=1;
freezingMap.put(coor, fLevel.floatValue());
break;
} else {
@ -163,6 +262,12 @@ public class FreezingLevel {
}
}
}
if (foundValFlag==0) {//this means all tValue are <= 273.16
freezingMap.put(coor, 0.0f);
System.out.println("*** FreezingLevel = 0.0");
}
System.out
.println("********** Finished Freezing Level Calculations *****************");
}
@ -252,6 +357,7 @@ public class FreezingLevel {
paramXML.setModelName(model);
paramXML.setParameterName(param);
String sql = getSQL(interval, model, param, refTime);
System.out.println("Freezing level sql="+sql);
GridRecord modelRec = DATUtils.getMostRecentGridRecord(interval, sql,
paramXML);
@ -358,7 +464,7 @@ public class FreezingLevel {
+ "\' and grid_info.datasetId = \'"
+ model
+ "\' and level.masterlevel_name = 'MB' and level.levelonevalue = '"
+ level + "\' and reftime=\'" + refTimeStr + "\' order by grid.reftime desc, grid.forecasttime desc limit 1";
+ level + "\' and grid.reftime=\'" + refTimeStr + "\' and grid.forecasttime=0 order by grid.reftime desc limit 1";
return sql;
}
}

View file

@ -83,7 +83,10 @@ public class MpeRUCFreezingLevel {
.getToken("mpe_point_freezing_dir");
public static String dqcPreprocessorBasetime = AppsDefaults.getInstance()
.getToken("DQC_PREPROCESSOR_BASETIME");
.getToken("dqc_preprocessor_basetime");
public static String mpeSiteId = AppsDefaults.getInstance()
.getToken("mpe_site_id");
public File stationFile = null;
@ -93,29 +96,11 @@ public class MpeRUCFreezingLevel {
public static String[] models = new String[] { "RUC236" };
public MpeRUCFreezingLevel() {
try {
File directory = new File(stationFilePath);
this.stationFile = new File(stationFilePath+"/"+mpeSiteId+"_freezing_station_list");
if (directory != null) {
for (File file : directory.listFiles()) {
if (file != null) {
if (file.isFile()
&& file.getName().contains(
"freezing_station_list")) {
this.stationFile = file;
break;
}
}
}
}
} catch (Exception e) {
statusHandler
.handle(Priority.WARN, "No mpe_station_list_dir found");
}
// correct env vairiable dqcPreprocessorBasetime if needed
// correct env vairiable dqcPreprocessorBasetime if needed. Default to 12z
if (dqcPreprocessorBasetime == null) {
dqcPreprocessorBasetime = "00z";
dqcPreprocessorBasetime = "12z";
}
dqcPreprocessorBasetime = dqcPreprocessorBasetime.toLowerCase();
@ -123,7 +108,7 @@ public class MpeRUCFreezingLevel {
&& !dqcPreprocessorBasetime.equals("06z")
&& !dqcPreprocessorBasetime.equals("12z")
&& !dqcPreprocessorBasetime.equals("18z")) {
dqcPreprocessorBasetime = "00z";
dqcPreprocessorBasetime = "12z";
}
}
@ -227,10 +212,8 @@ public class MpeRUCFreezingLevel {
// order
try {
String site = PropertiesFactory.getInstance().getEnvProperties()
.getEnvValue("SITENAME");
ofstream = new FileOutputStream(getAbsoluteOutFileName(
dates[3].getTime(), site));
dates[3].getTime(), mpeSiteId));
out = new DataOutputStream(ofstream);
bw = new BufferedWriter(new OutputStreamWriter(out));
@ -277,8 +260,7 @@ public class MpeRUCFreezingLevel {
String fzlev = "M";
if (fle != null) {
fzlev = String.valueOf(fle.getFreezingLevel())
.substring(0, 4) + "S";
fzlev = String.format("%3.2f",fle. getFreezingLevel()) + "S";
}
buf.append(" " + fzlev);

View file

@ -62,6 +62,7 @@ import com.raytheon.uf.edex.site.SiteActivationMessage.Action;
* getActiveSites().
* Nov 1, 2012 15417 ryu Modified getActiveSites to include
* home site only if activated.
* Dec 11, 2012 14360 ryu No printing stack trace on activation exception
*
* </pre>
*
@ -115,8 +116,8 @@ public class SiteAwareRegistry {
try {
sa.activateSite(siteID);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
// Stack trace is not printed per requirement for DR14360
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage());
}
}

View file

@ -36,6 +36,7 @@ import os, sys
# 11/04/10 5849 cjeanbap Updated Notification package location
# 06/09/11 9841 rferrel fixed help and argument order
# for sendNotificationMsg.
# 11/29/12 DR14016 jzeng change priority definition from 0-3 to 1-4
#
#
class PrintHelpOnErrorParser(ArgumentParser):
@ -55,13 +56,13 @@ def main():
help="Port upon which the alertViz server is running.",
metavar="port")
group = parser.add_mutually_exclusive_group()
group.add_argument("-r", action="store_const", const=3, dest="priority",
group.add_argument("-r", action="store_const", const=4, dest="priority",
help="Send as a routine message. (default)")
group.add_argument("-s", action="store_const", const=1, dest="priority",
group.add_argument("-s", action="store_const", const=2, dest="priority",
help="Send as a significant message.")
group.add_argument("-u", action="store_const", const=0, dest="priority",
group.add_argument("-u", action="store_const", const=1, dest="priority",
help="Send as an urgent message.")
group.add_argument("-a", action="store_const", const=2, dest="priority",
group.add_argument("-a", action="store_const", const=3, dest="priority",
help="Send as an alert message.")
parser.add_argument("-c", action="store", dest="msgClass",
help="Message class.", metavar="class", default="GFE")

View file

@ -5,7 +5,7 @@
Name: awips2-ldm
Summary: AWIPS II LDM Distribution
Version: 6.8.1
Release: 26
Release: 27
Group: AWIPSII
BuildRoot: /tmp
URL: N/A

View file

@ -411,7 +411,7 @@ IDS|DDPLUS ^(FOUS[67].) (....) (..)(..)(..)
# FILE -overwrite -log -close -edex /data_store/misc_adm_messages/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H
#
# separate out svrwx lsr and GSM misc adm messages
IDS|DDPLUS ^(N[A-VYZ]....) (.{4}) (..)(..)(..)
IDS|DDPLUS|HDS ^(N[A-VYZ]....) (.{4}) (..)(..)(..)
FILE -overwrite -log -close -edex /data_store/misc_adm_messages/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H
IDS|DDPLUS ^(NWUS[01346-9].) (.{4}) (..)(..)(..)
FILE -overwrite -log -close -edex /data_store/misc_adm_messages/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H