Issue #1408: Merge 13.1.2-6 into development

Former-commit-id: 7f8ad9de743a19d21a6784fa7563a88c6bdd4d3c
This commit is contained in:
Richard Peter 2013-01-09 17:55:05 -06:00
parent 3acf0edad0
commit 029ebaa63a
86 changed files with 1371 additions and 329 deletions

View file

@ -5,7 +5,8 @@
12/26/2011 Xiaochuan DR14236 (trac 11710) request to fix SCAN Alert Visualization BASE 12/26/2011 Xiaochuan DR14236 (trac 11710) request to fix SCAN Alert Visualization BASE
configuring file. Changed true or false setting on popup, text, configuring file. Changed true or false setting on popup, text,
blink and color items followed the A1 configuring master.gcf file. blink and color items followed the A1 configuring master.gcf file.
01/31/2012 dyninaj DR14427 added category NDFD 01/31/2012 dyninaj DR14427 added category NDFD
11/30/2012 jzeng DR14016 update GFE configuration
--> -->
<alertConfiguration name="DEFAULT"> <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"/> <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"/>
@ -125,12 +126,12 @@
</configurationMonitor> </configurationMonitor>
</source> </source>
<source locked="true" name="GFE" longName="GFE"> <source locked="true" name="GFE" longName="GFE">
<configurationItem> <configurationItem>
<metadata foreground="#000000" background="#ffff00" pythonEnabled="false" log="true" priority="SIGNIFICANT" 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="#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="SIGNIFICANT" popup="true" 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="#000000" background="#ffff00" pythonEnabled="false" log="true" priority="PROBLEM" 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="EVENTA" popup="false" blink="false" text="true" audioEnabled="false"/>
<metadata foreground="#000000" background="#ffa500" pythonEnabled="false" log="true" priority="PROBLEM" popup="true" 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"/> <metadata foreground="#ffffff" background="#000000" pythonEnabled="false" log="true" priority="VERBOSE" popup="false" blink="false" text="false" audioEnabled="false"/>
</configurationItem> </configurationItem>
<configurationMonitor> <configurationMonitor>

View file

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

View file

@ -42,7 +42,7 @@
<contribute xsi:type="bundleItem" file="bundles/NOHRSC-SNOW.xml" <contribute xsi:type="bundleItem" file="bundles/NOHRSC-SNOW.xml"
menuText="Snow Cover Elev" id="snowCoverElev"> menuText="Snow Cover Elev" id="snowCoverElev">
<substitute key="param" value="sce"/> <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"/> <substitute key="sampleFormat" value="0.00"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/NOHRSC-SNOW.xml" <contribute xsi:type="bundleItem" file="bundles/NOHRSC-SNOW.xml"

View file

@ -61,12 +61,12 @@
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <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"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="595530"/> <substitute key="stationId" value="595530"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <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"> editorType="gov.noaa.nws.ncep.ui.nsharp.display.NsharpEditor">
<substitute key="stationId" value="589680"/> <substitute key="stationId" value="589680"/>
</contribute> </contribute>

View file

@ -810,7 +810,7 @@ public interface IGraphicsTarget extends IImagingExtension {
public IView getView(); public IView getView();
/** /**
* /** Use drawStrings(DrawableString parameters) * Use drawStrings(DrawableString parameters)
*/ */
@Deprecated @Deprecated
public abstract void drawString(IFont font, String text, double x, 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 See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. 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"> <Method name="Difference">
<Field abbreviation="T"/> <Field abbreviation="T"/>
<Field abbreviation="DpT"/> <Field abbreviation="DpT"/>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. 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"> <Method name="Dewpoint">
<Field abbreviation="T"/> <Field abbreviation="T"/>
<Field abbreviation="RH"/> <Field abbreviation="RH"/>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. 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"> <Method name="Alias" levels="Surface">
<Field abbreviation="DpTmean" level="2FHAG"/> <Field abbreviation="DpTmean" level="2FHAG"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. 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"> <Method name="Alias" levels="Surface">
<Field abbreviation="DpTsprd" level="2FHAG"/> <Field abbreviation="DpTsprd" level="2FHAG"/>
</Method> </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 * Jun 16, 2012 14386 zhao Modified the notify method
* Oct 30, 2012 skorolev Changed HashMap to Map * Oct 30, 2012 skorolev Changed HashMap to Map
* Nov 11, 2012 1297 skorolev Added initiateProdArray * 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. * Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
* *
* </pre> * </pre>
@ -137,6 +138,9 @@ public class FogZoneTableDlg extends ZoneTableDlg {
if (date != null) { if (date != null) {
Date nominalTime = date; Date nominalTime = date;
ObMultiHrsReports obData = fog.getObData(); ObMultiHrsReports obData = fog.getObData();
if (!isLinkedToFrame()) {
nominalTime = obData.getLatestNominalTime();
}
FogDataGenerator fdg = new FogDataGenerator(); FogDataGenerator fdg = new FogDataGenerator();
Map<String, CellType> fogAlgCellType = fdg.getAlgCellTypes(fog Map<String, CellType> fogAlgCellType = fdg.getAlgCellTypes(fog
.getAlgorithmData(nominalTime)); .getAlgorithmData(nominalTime));

View file

@ -44,6 +44,7 @@ import com.vividsolutions.jts.geom.Point;
* has been created to calculate the pivot * has been created to calculate the pivot
* indexes. * indexes.
* 10-27-2010 #6964 bkowal Added a public class member for the LineStyle. * 10-27-2010 #6964 bkowal Added a public class member for the LineStyle.
* 11/29/2012 15571 Qinglu Lin Added compuateCurrentStormCenter();
* *
* </pre> * </pre>
* *
@ -189,4 +190,32 @@ public class StormTrackState {
/** Set if you the duration needs to be calculated from the end time */ /** Set if you the duration needs to be calculated from the end time */
public Calendar endTime = null; 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; package com.raytheon.viz.gfe.actions;
import com.raytheon.viz.gfe.Activator;
import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException; 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.Message;
import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg; 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 * Action to show the ISC grids
* *
@ -37,20 +43,70 @@ import com.raytheon.viz.gfe.core.msgs.ShowISCGridsMsg;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 07/20/09 1995 bphillip Initial release * 07/20/09 1995 bphillip Initial release
* * 12/06/12 DR 15574 jzeng Change the image of
* the icon when it is activated
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
* @version 1 * @version 1
*/ */
public class ShowISCGridsAction extends AbstractHandler { 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 @Override
public Object execute(ExecutionEvent arg0) throws ExecutionException { public Object execute(ExecutionEvent arg0) throws ExecutionException {
boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class) boolean current = Message.inquireLastMessage(ShowISCGridsMsg.class).show();
.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(); new ShowISCGridsMsg(!current).send();
return null; return null;
} }
} }

View file

@ -1,19 +1,19 @@
/** /**
* This software was developed and / or modified by Raytheon Company, * This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government. * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
* *
* U.S. EXPORT CONTROLLED TECHNICAL DATA * U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose * This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination * export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires * to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization. * an export license or other authorization.
* *
* Contractor Name: Raytheon Company * Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340 * Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8 * Mail Stop B8
* Omaha, NE 68106 * Omaha, NE 68106
* 402.291.0100 * 402.291.0100
* *
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
@ -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;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.DataManager;
@ -57,7 +58,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
/** /**
* The product generation scripts dialog. * The product generation scripts dialog.
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
@ -65,10 +66,12 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
* Mar 7, 2008 Eric Babin Initial Creation * Mar 7, 2008 Eric Babin Initial Creation
* Oct 27, 2012 1287 rferrel Code cleanup for non-blocking dialog. * Oct 27, 2012 1287 rferrel Code cleanup for non-blocking dialog.
* Oct 25, 2012 1287 rferrel Code changes for non-blocking PublishDialog. * 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. * Nov 13, 2012 1298 rferrel Code changes for non-blocking UserEntryDialog.
* *
* </pre> * </pre>
* *
* @author ebabin * @author ebabin
* @version 1.0 * @version 1.0
*/ */
@ -85,6 +88,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
private Map<String, String> scriptDict; private Map<String, String> scriptDict;
private String gfeHome;
private String prddir; private String prddir;
private ToggleSelectList scriptsList; private ToggleSelectList scriptsList;
@ -104,6 +109,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS); this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS);
this.dataManager = dataManager; this.dataManager = dataManager;
gfeHome = Activator.getDefault().getPreferenceStore()
.getString("GFESUITE_HOME");
prddir = Activator.getDefault().getPreferenceStore() prddir = Activator.getDefault().getPreferenceStore()
.getString("GFESUITE_PRDDIR"); .getString("GFESUITE_PRDDIR");
scripts = Activator.getDefault().getPreferenceStore() scripts = Activator.getDefault().getPreferenceStore()
@ -139,7 +146,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
} }
/** /**
* *
*/ */
private void runScripts() { private void runScripts() {
int[] idxs = scriptsList.getSelectionIndices(); int[] idxs = scriptsList.getSelectionIndices();
@ -171,6 +178,15 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
.getSpatialEditorTime(); .getSpatialEditorTime();
Date seEnd = new Date(seStart.getTime() + 60 * 1000); 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: // The following variables are replaced by known values:
cmd = cmd.replace("{host}", hostParts[0]); cmd = cmd.replace("{host}", hostParts[0]);
cmd = cmd.replace("{port}", hostParts[1]); cmd = cmd.replace("{port}", hostParts[1]);
@ -178,8 +194,13 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
cmd = cmd.replace("{productDB}", productDB.toString()); cmd = cmd.replace("{productDB}", productDB.toString());
cmd = cmd.replace("{SEstart}", gmtTime.format(seStart)); cmd = cmd.replace("{SEstart}", gmtTime.format(seStart));
cmd = cmd.replace("{SEend}", gmtTime.format(seEnd)); 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("{time}", curLocalTime);
cmd = cmd.replace("{ztime}", curGMTTime); cmd = cmd.replace("{ztime}", curGMTTime);
cmd = cmd.replace("{home}", gfeHome);
cmd = cmd.replace("{prddir}", prddir); cmd = cmd.replace("{prddir}", prddir);
// The user is prompted to enter the value with which to replace // The user is prompted to enter the value with which to replace
@ -404,7 +425,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see * @see
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets * org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
* .Shell) * .Shell)

View file

@ -23,8 +23,10 @@ import static com.raytheon.viz.gfe.product.StringUtil.stringJoin;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -76,6 +78,7 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
* 19 Feb 2010 4132 ryu Product correction. * 19 Feb 2010 4132 ryu Product correction.
* 30 Jul 2010 6719 jnjanga Placed cursor at the end of inserted CTA * 30 Jul 2010 6719 jnjanga Placed cursor at the end of inserted CTA
* 26 Sep 2012 15423 ryu Avoid resetting text when possible. * 26 Sep 2012 15423 ryu Avoid resetting text when possible.
* 03 Dec 2012 15620 ryu Unlock framed cities list for editing.
* *
* </pre> * </pre>
* *
@ -141,6 +144,10 @@ public class StyledTextComp extends Composite {
private boolean highlight = Activator.getDefault().getPreferenceStore() private boolean highlight = Activator.getDefault().getPreferenceStore()
.getBoolean("HighlightFramingCodes"); .getBoolean("HighlightFramingCodes");
private boolean newProduct = false;
private Set<String> unlockCitySegs;
private boolean autoWrapMode; private boolean autoWrapMode;
private int wrapColumn = 80; // TODO: get from external private int wrapColumn = 80; // TODO: get from external
@ -312,6 +319,7 @@ public class StyledTextComp extends Composite {
* The product text. * The product text.
*/ */
public void setProductText(String text) { public void setProductText(String text) {
newProduct = true;
textEditorST.setText(EMPTY); textEditorST.setText(EMPTY);
textEditorST.setStyleRange(null); textEditorST.setStyleRange(null);
parseProductText(text); parseProductText(text);
@ -320,6 +328,7 @@ public class StyledTextComp extends Composite {
lockText(); lockText();
findFramingCodes(); findFramingCodes();
textEditorST.getVerticalBar().setSelection(0); 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. * Lock the parts of the text that needs to be uneditable.
*/ */
private void lockText() { private void lockText() {
int strLen = 0;
int startLine = 0; int startLine = 0;
int endLine = 0; int endLine = 0;
StyleRange sr;
// NOTE: For the endline variables we need to exclude the last line // 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 // 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) { if (ciBlockTip != null) {
startLine = ciBlockTip.getStartIndex().x; startLine = ciBlockTip.getStartIndex().x;
endLine = ciBlockTip.getEndIndex().x; endLine = ciBlockTip.getEndIndex().x;
lockLines(productTextArray, startLine, endLine);
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);
} }
/* /*
* Lock the mnd text. * Lock the mnd text.
*/ */
strLen = 0;
HashMap<String, TextIndexPoints> mndMap = prodDataStruct.getMndMap(); HashMap<String, TextIndexPoints> mndMap = prodDataStruct.getMndMap();
TextIndexPoints mndTip = mndMap.get("mnd"); TextIndexPoints mndTip = mndMap.get("mnd");
if (mndTip != null) { if (mndTip != null) {
startLine = mndTip.getStartIndex().x; startLine = mndTip.getStartIndex().x;
endLine = mndTip.getEndIndex().x; endLine = mndTip.getEndIndex().x;
lockLines(productTextArray, startLine, endLine);
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);
} }
/* /*
* Lock content in the UGC text. * Lock content in the UGC text.
*/ */
strLen = 0; if (newProduct) {
unlockCitySegs = new HashSet<String>();
}
List<SegmentData> segArray = prodDataStruct.getSegmentsArray(); List<SegmentData> segArray = prodDataStruct.getSegmentsArray();
TextIndexPoints segTip; TextIndexPoints segTip, cityTip;
for (SegmentData segmentData : segArray) { for (SegmentData segmentData : segArray) {
/* /*
* Lock header. * Lock header.
*/ */
strLen = 0;
segTip = segmentData.getSegmentDataIndexPoints("header"); segTip = segmentData.getSegmentDataIndexPoints("header");
cityTip = segmentData.getSegmentDataIndexPoints("city");
if (segTip != null) { if (segTip != null) {
startLine = segTip.getStartIndex().x; startLine = segTip.getStartIndex().x;
endLine = segTip.getEndIndex().x; endLine = segTip.getEndIndex().x;
for (int i = startLine; i < endLine; i++) { String ugc = segTip.getText().substring(0, 6);
// Add 1 to the length to account for the \n character
strLen += productTextArray[i].length() + 1; // 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), if (unlockCitySegs.contains(ugc)) {
strLen, lockColor, null); // Lock the segment header but skip the cities list.
textEditorST.setStyleRange(sr); 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. * Lock term.
*/ */
strLen = 0;
segTip = segmentData.getSegmentDataIndexPoints("term"); segTip = segmentData.getSegmentDataIndexPoints("term");
if (segTip != null) { if (segTip != null) {
@ -447,18 +453,23 @@ public class StyledTextComp extends Composite {
++endLineOffset; ++endLineOffset;
} }
for (int i = startLine; i < endLine + endLineOffset; i++) { lockLines(productTextArray, startLine, endLine + endLineOffset);
// 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);
} }
} }
} }
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;
}
StyleRange sr = new StyleRange(textEditorST.getOffsetAtLine(startLine),
strLen, lockColor, null);
textEditorST.setStyleRange(sr);
}
/** /**
* Find the framing codes in the text. * 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 * 09 OCT 2012 #15396 Fixed Instantaneous precip index so legend and map display
* will change each time duration is incremented or decremented * will change each time duration is incremented or decremented
* for the "30 minutes Instantaneous" rainfall map . * for the "30 minutes Instantaneous" rainfall map .
* 04 Dec 2012 15602 wkwock Fix Hrs hour capped at 100.
*
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -1023,6 +1025,7 @@ public class PointDataControlDlg extends CaveSWTDialog {
hoursSpnr.setPageIncrement(5); hoursSpnr.setPageIncrement(5);
hoursSpnr.setSelection(24); hoursSpnr.setSelection(24);
hoursSpnr.setLayoutData(gd); hoursSpnr.setLayoutData(gd);
hoursSpnr.setMaximum(1000);
// hoursSpnr.addSelectionListener(new SelectionAdapter() { // hoursSpnr.addSelectionListener(new SelectionAdapter() {
// @Override // @Override
// public void widgetSelected(SelectionEvent event) { // public void widgetSelected(SelectionEvent event) {

View file

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

View file

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

View file

@ -37,6 +37,7 @@ import com.raytheon.viz.hydrocommon.data.ZoneInfoData;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 5, 2009 1802 askripsky Initial Creation * Jan 5, 2009 1802 askripsky Initial Creation
* Sep 11,2012 15362 wkwock Fix selected zones * Sep 11,2012 15362 wkwock Fix selected zones
* Dec 4, 2012 15522 wkwock Fix added zones
* *
* </pre> * </pre>
* *
@ -159,7 +160,7 @@ public class CountyZoneUgcDataManager {
* @throws VizException * @throws VizException
*/ */
public ArrayList<ZoneInfoData> getZonesSelected() 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); 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 { } else {
/* 24 hour mode. */ /* 24 hour mode. */
if (pcp_flag + 4 >= num_qc_days * 4) { if (pcp_flag + 4 >= num_qc_days * 4) {

View file

@ -59,6 +59,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 16, 2009 snaples Initial creation * Feb 16, 2009 snaples Initial creation
* Dec 04, 2012 15544 wkwock fix missing 12z-18z after 12
* *
* </pre> * </pre>
* *
@ -1021,6 +1022,12 @@ public class DailyQcUtils {
btime.set(Calendar.SECOND, 0); btime.set(Calendar.SECOND, 0);
hrgt12z = 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); emonth = btime.get(Calendar.MONTH);
Calendar otime = Calendar.getInstance(TimeZone.getTimeZone("GMT")); 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. * 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. * Oct 31, 2011 8510 rferrel made PRIMARY_MODEL and add check for nonblank productID.
* Sep 20, 2012 1196 rferrel No longer Blocks * Sep 20, 2012 1196 rferrel No longer Blocks
* 12/07/2012 15555 m.gamazaychikov Fixed the implementation for New Proximity Alarm.
* </pre> * </pre>
* *
* @author mnash * @author mnash
@ -330,15 +331,34 @@ public class NewAlarmDlg extends CaveSWTDialog {
AOR = new Button(aor, SWT.CHECK); AOR = new Button(aor, SWT.CHECK);
aorData = new GridData(SWT.DEFAULT, SWT.CENTER, false, false); aorData = new GridData(SWT.DEFAULT, SWT.CENTER, false, false);
AOR.setLayoutData(aorData); 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()); AOR.setSelection(prod.isAor());
} }
else {
AOR.setSelection(true);
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW));
}
AOR.addSelectionListener(new SelectionAdapter() { AOR.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (AOR.getSelection() == true) { 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( AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_YELLOW)); SWT.COLOR_YELLOW));
AORDistance.setText("");
ugcList.setText("");
} else { } else {
AOR.setBackground(Display.getCurrent().getSystemColor( AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND)); SWT.COLOR_WIDGET_BACKGROUND));
@ -355,22 +375,34 @@ public class NewAlarmDlg extends CaveSWTDialog {
AORDistance = new Text(aor, SWT.SINGLE | SWT.BORDER); AORDistance = new Text(aor, SWT.SINGLE | SWT.BORDER);
aorData = new GridData(SWT.END, SWT.DEFAULT, false, false); aorData = new GridData(SWT.END, SWT.DEFAULT, false, false);
aorData.horizontalAlignment = SWT.RIGHT; aorData.horizontalAlignment = SWT.RIGHT;
aorData.widthHint = 20; aorData.widthHint = 60;
AORDistance.setLayoutData(aorData); 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()); AORDistance.setText(prod.getAorDistance());
} }
else {
AORDistance.setText("");
}
AORDistance.addListener(SWT.KeyDown, new Listener() { AORDistance.addListener(SWT.KeyDown, new Listener() {
@Override @Override
public void handleEvent(Event e) { public void handleEvent(Event e) {
if (!"".equals(AORDistance.getText()) /*
|| (e.character != 0x8 && e.character != 0x7f)) { * DR15555 - handle the AOR selection:
AOR.setSelection(true); * - set the AOR background gray
AOR.setBackground(Display.getCurrent().getSystemColor( * - un-select the AOR
SWT.COLOR_YELLOW)); * - set the ugcList text to empty string
} */
} AOR.setSelection(false);
AOR.setBackground(Display.getCurrent().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND));
ugcList.setText("");
}
}); });
distanceLabel = new Combo(aor, SWT.READ_ONLY); distanceLabel = new Combo(aor, SWT.READ_ONLY);
@ -378,7 +410,12 @@ public class NewAlarmDlg extends CaveSWTDialog {
distanceLabel.setItems(new String[] { "mi", "km" }); distanceLabel.setItems(new String[] { "mi", "km" });
aorData.horizontalAlignment = SWT.RIGHT; aorData.horizontalAlignment = SWT.RIGHT;
distanceLabel.setLayoutData(aorData); 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()); distanceLabel.setText(prod.getAorLabel());
} else { } else {
distanceLabel.select(0); distanceLabel.select(0);
@ -394,9 +431,32 @@ public class NewAlarmDlg extends CaveSWTDialog {
ugcLabel.setText("UGC List:"); ugcLabel.setText("UGC List:");
ugcList = new Text(ugc, SWT.SINGLE | SWT.BORDER); ugcList = new Text(ugc, SWT.SINGLE | SWT.BORDER);
ugcList.setLayoutData(gd); 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()); 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 // separator
GridData fullLayoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, 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.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; 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 javax.xml.bind.JAXB;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.text.alarms.AlarmAlertProduct; 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.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.ILocalizationFileObserver;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; 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.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; 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.alarmalert.dialogs.AlarmAlertBell;
import com.raytheon.viz.texteditor.command.CommandFactory; import com.raytheon.viz.texteditor.command.CommandFactory;
import com.raytheon.viz.texteditor.command.CommandFailedException; import com.raytheon.viz.texteditor.command.CommandFailedException;
import com.raytheon.viz.texteditor.command.ICommand; import com.raytheon.viz.texteditor.command.ICommand;
import com.raytheon.viz.texteditor.util.TextEditorUtil; 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 * 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 * Sep 18, 2009 mnash Initial creation
* 03/19/2012 D. Friedman Fix determination of "Alarm" entries. * 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> * </pre>
* *
@ -69,6 +86,14 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
* @version 1.0 * @version 1.0
*/ */
/**
* @author michaelg
*
*/
/**
* @author michaelg
*
*/
public class AlarmAlertFunctions { public class AlarmAlertFunctions {
private static final AlarmAlertProduct.ProductType AA = AlarmAlertProduct.ProductType.Alarm_Alert; private static final AlarmAlertProduct.ProductType AA = AlarmAlertProduct.ProductType.Alarm_Alert;
@ -88,6 +113,23 @@ public class AlarmAlertFunctions {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AlarmAlertFunctions.class); .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() { protected void getGIS() {
@ -105,7 +147,22 @@ public class AlarmAlertFunctions {
string.append("AOR"); string.append("AOR");
} }
if (!"".equals(prod.getAorDistance())) { 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())) { } else if (!"".equals(prod.getUgcList())) {
string.append("UGC-" + prod.getUgcList()); string.append("UGC-" + prod.getUgcList());
} }
@ -219,10 +276,11 @@ public class AlarmAlertFunctions {
if (productId != null) { if (productId != null) {
productId = productId.trim().toUpperCase(); productId = productId.trim().toUpperCase();
for (AlarmAlertProduct a : currentAlarms) { for (AlarmAlertProduct a : currentAlarms) {
// ************** ProductType pt = a.getProductType();
// TODO : For now disable Proximity Alerts /*
// ************** * Alarm_Alert
if (AA.equals(a.getProductType())) { */
if (AA.equals(pt)) {
String s = a.getProductId(); String s = a.getProductId();
if (s != null) { if (s != null) {
s = s.trim().toUpperCase(); s = s.trim().toUpperCase();
@ -234,12 +292,334 @@ 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 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 * initialize the localization for user with the save/load functions
* *
* @return the initialized localization * @return the initialized localization

View file

@ -34,6 +34,8 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; 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.VerifyEvent;
import org.eclipse.swt.events.VerifyListener; import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData; 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 * 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. * invalid product Id and user want to edit it anyway.
* 09/20/2012 1196 rferrel Changing dialogs being called to not block. * 09/20/2012 1196 rferrel Changing dialogs being called to not block.
* 11/26/2012 14526 mgamazaychikov Added traverse listener for RETURN key
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -221,6 +224,10 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
// this was after shell.pack() before, any reason why? // this was after shell.pack() before, any reason why?
checkEnableEnter(); checkEnableEnter();
/*
* 14526 - Add the traverse listener for RETURN key
*/
setTraverseListenerReturn();
} }
@Override @Override
@ -608,49 +615,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
enterBtn.setEnabled(true); enterBtn.setEnabled(true);
enterBtn.addSelectionListener(new SelectionAdapter() { enterBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
boolean sendEnabled = true; enterBtnPressed();
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();
} }
}); });
@ -668,7 +633,58 @@ 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. * 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 * When controls are placed in a RowLayout they are "aligned" at the top of
* the cell. * the cell.
@ -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) { private void textFieldVerifyListener(final StyledText tf) {
@ -1005,4 +1032,19 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
if (allBtn != null) if (allBtn != null)
allBtn.setSelection("ALL".equals(addressee)); 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.SWT;
import org.eclipse.swt.custom.ExtendedModifyEvent; import org.eclipse.swt.custom.ExtendedModifyEvent;
import org.eclipse.swt.custom.ExtendedModifyListener; import org.eclipse.swt.custom.ExtendedModifyListener;
import org.eclipse.swt.custom.PopupList;
import org.eclipse.swt.custom.ST; import org.eclipse.swt.custom.ST;
import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText; 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.Combo;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.MessageBox;
@ -303,6 +304,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* Do not use changed BBB from OUPResponse. * Do not use changed BBB from OUPResponse.
* 17OCT2012 1229 rferrel Changes for non-blocking SWTMessageBox. * 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. * 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 * 13Dec2012 1353 rferrel Change to make edit cancel message not
* dispaly the red had kill job message. * dispaly the red had kill job message.
* </pre> * </pre>
@ -1104,6 +1106,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
private static final String[] popupItems = { "Select All", "Cut", "Copy", private static final String[] popupItems = { "Select All", "Cut", "Copy",
"Paste" }; "Paste" };
private static final boolean[] isPopItemDefault = { true, false, true,
false };
private boolean warnGenFlag = false; private boolean warnGenFlag = false;
@ -3633,7 +3638,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
} }
if (e.button == 3) { if (e.button == 3) {
processPopup(e.x, e.y); processPopup();
} }
} }
@ -3646,33 +3651,48 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
/** /**
* Process the user choice from the popup list. * Process the user choice from the popup list.
* DR14842 - re-written
*/ */
private void processPopup(int x, int y) { private void processPopup() {
PopupList popupList = new PopupList(shell); Menu menu = new Menu(shell, SWT.POP_UP);
popupList.setMinimumWidth(50); List<String> items = Arrays.asList(popupItems);
if (isEditMode()) { for (String pi : popupItems) {
popupList.setItems(popupItems); MenuItem mi = new MenuItem(menu, SWT.PUSH);
} else { mi.setText(pi);
popupList.setItems(new String[] { "Select All", "Copy" }); if (isEditMode()) {
} mi.setEnabled(true);
popupList.select(popupItems[0]); } else {
mi.setEnabled(isPopItemDefault[items.indexOf(pi)]);
Point p = Display.getCurrent().map(textEditor, null, x, y); }
String choice = popupList.open(new Rectangle(p.x + 10, p.y + 10, 100, mi.addListener(SWT.Selection, new Listener() {
200)); public void handleEvent(Event event) {
if (choice != null) { handleSelection(event);
if (popupItems[0].equals(choice)) { }
textEditor.selectAll(); });
} else if (popupItems[1].equals(choice)) { }
cutText(); menu.setVisible(true);
} else if (popupItems[2].equals(choice)) { }
copyText();
} else if (popupItems[3].equals(choice)) { /**
pasteText(); * Handle the selection from the popup menu
} * @param event
textEditor.update(); */
} protected void handleSelection(Event event) {
} MenuItem item = (MenuItem) event.widget;
String choice = item.getText();
if (choice != null) {
if (popupItems[0].equals(choice)) {
textEditor.selectAll();
} else if (popupItems[1].equals(choice)) {
cutText();
} else if (popupItems[2].equals(choice)) {
copyText();
} else if (popupItems[3].equals(choice)) {
pasteText();
}
textEditor.update();
}
}
/** /**
* creates the bar containing the script runner controls. * creates the bar containing the script runner controls.

View file

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

View file

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

View file

@ -56,7 +56,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 1, 2010 mschenke Initial creation * Dec 1, 2010 mschenke Initial creation
* * 12/06/2012 DR 15559 Qinglu Lin Added round() methods.
*
* </pre> * </pre>
* *
* @author mschenke * @author mschenke
@ -953,4 +954,34 @@ public class PolygonUtil {
coordinate.x = x / Math.pow(10, decimalPlaces); coordinate.x = x / Math.pow(10, decimalPlaces);
coordinate.y = y / 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,7 +144,16 @@ import com.vividsolutions.jts.io.WKTReader;
* warningAction is neither null nor WarningAction.NEW, removed * warningAction is neither null nor WarningAction.NEW, removed
* some code from redrawBoxFromHatched(). * some code from redrawBoxFromHatched().
* 11/15/2012 DR 15430 D. Friedman Use correct county/zone in createGeometryForWatches. * 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> * </pre>
* *
* @author mschenke * @author mschenke
@ -229,7 +238,7 @@ public class WarngenLayer extends AbstractStormTrackResource {
private GeospatialDataList geoData = null; private GeospatialDataList geoData = null;
private WarningAction warningAction = null; private WarningAction warningAction = WarningAction.NEW;
static { static {
for (int i = 0; i < 128; i++) { for (int i = 0; i < 128; i++) {
@ -1600,8 +1609,17 @@ public class WarngenLayer extends AbstractStormTrackResource {
.hatchWarningArea(state.getWarningPolygon(), .hatchWarningArea(state.getWarningPolygon(),
state.getWarningArea()); state.getWarningArea());
if (hatched != null) { if (hatched != null) {
state.setWarningPolygon(hatched); // DR 15559
state.snappedToArea = true; 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: " System.out.println("Time to createWarningPolygon: "
+ (System.currentTimeMillis() - t0) + "ms"); + (System.currentTimeMillis() - t0) + "ms");
@ -1820,9 +1838,16 @@ public class WarngenLayer extends AbstractStormTrackResource {
Coordinate[] cc = null; Coordinate[] cc = null;
switch (stormTrackState.displayType) { switch (stormTrackState.displayType) {
case POINT: case POINT:
cc = new Coordinate[] { stormTrackState.futurePoints == null ? stormTrackState.dragMePoint cc = new Coordinate[] { stormTrackState.futurePoints == null ? stormTrackState.dragMePoint
.getCoordinate() : stormTrackState.futurePoints[0].coord }; .getCoordinate() : stormTrackState.futurePoints[0].coord };
break; 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: case POLY:
Coordinate[] polyPoints = stormTrackState.dragMeLine Coordinate[] polyPoints = stormTrackState.dragMeLine
.getCoordinates(); .getCoordinates();

View file

@ -41,6 +41,8 @@ import com.vividsolutions.jts.geom.Polygon;
* May 7, 2010 mschenke Initial creation * May 7, 2010 mschenke Initial creation
* 03/14/2012 DR 14690 Qinglu Lin Add clear2(). * 03/14/2012 DR 14690 Qinglu Lin Add clear2().
* 10/26/2012 DR 15479 Qinglu Lin Added removeDuplicateCoordinate(). * 10/26/2012 DR 15479 Qinglu Lin Added removeDuplicateCoordinate().
* 12/06/2012 DR 15559 Qinglu Lin Added computeSlope(), computeCoordinate(),
* and adjustPolygon().
* *
* </pre> * </pre>
* *
@ -145,6 +147,151 @@ public class WarngenUIState {
warningPolygon = gf.createPolygon(gf.createLinearRing(vertices), null); 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 * Set the old warning area in lat/lon projection. Will be converted to
* local * 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 10, 2012 15295 snaples Added property setting for runtime log to createScript.
* Sep 18, 2012 15332 jsanchez Used a new warning text handler. * Sep 18, 2012 15332 jsanchez Used a new warning text handler.
* Nov 9, 1202 DR 15430 D. Friedman Improve watch inclusion. * 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> * </pre>
* *
* @author njensen * @author njensen
@ -368,8 +373,6 @@ public class TemplateRunner {
// CAN and EXP products follow different rules as followups // CAN and EXP products follow different rules as followups
if (!(selectedAction == WarningAction.CAN || selectedAction == WarningAction.EXP)) { if (!(selectedAction == WarningAction.CAN || selectedAction == WarningAction.EXP)) {
Coordinate[] stormLocs = warngenLayer
.getStormLocations(stormTrackState);
wx = new Wx(config, stormTrackState, wx = new Wx(config, stormTrackState,
warngenLayer.getStormLocations(stormTrackState), warngenLayer.getStormLocations(stormTrackState),
startTime.getTime(), DateUtil.roundDateTo15(endTime) startTime.getTime(), DateUtil.roundDateTo15(endTime)
@ -391,7 +394,10 @@ public class TemplateRunner {
context.put("duration", duration); context.put("duration", duration);
context.put("event", eventTime); context.put("event", eventTime);
context.put("TMLtime", eventTime); if (selectedAction == WarningAction.COR)
context.put("TMLtime", eventTime);
else
context.put("TMLtime", simulatedTime);
context.put("ugcline", context.put("ugcline",
FipsUtil.getUgcLine(areas, wx.getEndTime(), 15)); FipsUtil.getUgcLine(areas, wx.getEndTime(), 15));
context.put("areaPoly", GisUtil.convertCoords(warngenLayer context.put("areaPoly", GisUtil.convertCoords(warngenLayer
@ -433,13 +439,25 @@ public class TemplateRunner {
motionDirection -= 360; motionDirection -= 360;
} }
context.put("movementDirection", motionDirection); context.put("movementDirection", motionDirection);
Coordinate[] stormLocs = warngenLayer
.getStormLocations(stormTrackState);
// Convert to Point2D representation as Velocity requires // Convert to Point2D representation as Velocity requires
// getX() and getY() methods which Coordinate does not have // getX() and getY() methods which Coordinate does not have
Coordinate[] newStormLocs = GisUtil.d2dCoordinates(stormLocs); if (selectedAction == WarningAction.COR) {
Point2D.Double[] coords = new Point2D.Double[newStormLocs.length]; AbstractWarningRecord oldWarn = CurrentWarnings.getInstance(
for (int i = 0; i < newStormLocs.length; i++) { threeLetterSiteId).getNewestByTracking(etn, phenSig);
coords[i] = new Point2D.Double(newStormLocs[i].x, String loc = oldWarn.getLoc();
newStormLocs[i].y); 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); context.put("eventLocation", coords);
t0 = System.currentTimeMillis(); t0 = System.currentTimeMillis();
@ -453,6 +471,7 @@ public class TemplateRunner {
threeLetterSiteId).getNewestByTracking(etn, phenSig); threeLetterSiteId).getNewestByTracking(etn, phenSig);
context.put("now", simulatedTime); context.put("now", simulatedTime);
context.put("event", eventTime); context.put("event", eventTime);
context.put("TMLtime", eventTime);
context.put("start", oldWarn.getStartTime().getTime()); context.put("start", oldWarn.getStartTime().getTime());
context.put("expire", oldWarn.getEndTime().getTime()); context.put("expire", oldWarn.getEndTime().getTime());
Calendar canOrExpCal = Calendar.getInstance(); Calendar canOrExpCal = Calendar.getInstance();
@ -468,13 +487,21 @@ public class TemplateRunner {
.getCoordinates())); .getCoordinates()));
// If there is no storm track // If there is no storm track
if (oldWarn.getLoc() != null) { if (oldWarn.getLoc() != null) {
Geometry locGeom = wkt.read(oldWarn.getLoc());
Coordinate[] locs = locGeom.getCoordinates();
// Convert to Point2D representation as Velocity requires // Convert to Point2D representation as Velocity requires
// getX() and getY() methods which Coordinate does not have // 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++) { for (int i = 0; i < locs.length; i++) {
coords[i] = new Point2D.Double(locs[i].x, locs[i].y); coords[i] = new Point2D.Double(locs[i].x, locs[i].y);
} }
context.put("eventLocation", coords); context.put("eventLocation", coords);
double motionDirection = oldWarn.getMotdir(); double motionDirection = oldWarn.getMotdir();

Binary file not shown.

Binary file not shown.

View file

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

View file

@ -9,8 +9,7 @@
<dataType>RADAR</dataType> <dataType>RADAR</dataType>
<sourceType>QPE</sourceType> <sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum> <rateOrAccum>rate</rateOrAccum>
<expirationMinutes>10</expirationMinutes> <expirationMinutes>10</expirationMinutes>
<unit>inches</unit>
</source> </source>
<source> <source>
<SourceName>DPR</SourceName> <SourceName>DPR</SourceName>
@ -21,8 +20,7 @@
<dataType>RADAR</dataType> <dataType>RADAR</dataType>
<sourceType>QPE</sourceType> <sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum> <rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes> <expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
</source> </source>
<source> <source>
<SourceName>DHRMOSAIC</SourceName> <SourceName>DHRMOSAIC</SourceName>
@ -32,8 +30,7 @@
<dataType>XMRG</dataType> <dataType>XMRG</dataType>
<sourceType>QPE</sourceType> <sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum> <rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes> <expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion> <conversion>0.0003937</conversion>
<dateFormat>yyyyMMddHHmm</dateFormat> <dateFormat>yyyyMMddHHmm</dateFormat>
<hrapGridFactor>4</hrapGridFactor> <hrapGridFactor>4</hrapGridFactor>
@ -46,8 +43,7 @@
<dataType>XMRG</dataType> <dataType>XMRG</dataType>
<sourceType>QPE</sourceType> <sourceType>QPE</sourceType>
<rateOrAccum>rate</rateOrAccum> <rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes> <expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion> <conversion>0.0003937</conversion>
<dateFormat>yyyyMMddHHmm</dateFormat> <dateFormat>yyyyMMddHHmm</dateFormat>
<hrapGridFactor>4</hrapGridFactor> <hrapGridFactor>4</hrapGridFactor>
@ -63,8 +59,7 @@
<dataType>PDO</dataType> <dataType>PDO</dataType>
<sourceType>QPF</sourceType> <sourceType>QPF</sourceType>
<rateOrAccum>accum</rateOrAccum> <rateOrAccum>accum</rateOrAccum>
<expirationMinutes>15</expirationMinutes> <expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<mosaic>true</mosaic> <mosaic>true</mosaic>
</source> </source>
<source> <source>
@ -75,8 +70,7 @@
<dataType>XMRG</dataType> <dataType>XMRG</dataType>
<sourceType>QPF</sourceType> <sourceType>QPF</sourceType>
<rateOrAccum>accum</rateOrAccum> <rateOrAccum>accum</rateOrAccum>
<expirationMinutes>15</expirationMinutes> <expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion> <conversion>0.0003937</conversion>
<mosaic>true</mosaic> <mosaic>true</mosaic>
<dateFormat>yyyyMMddHHmm</dateFormat> <dateFormat>yyyyMMddHHmm</dateFormat>
@ -90,8 +84,7 @@
<dataType>XMRG</dataType> <dataType>XMRG</dataType>
<sourceType>QPF</sourceType> <sourceType>QPF</sourceType>
<rateOrAccum>accum</rateOrAccum> <rateOrAccum>accum</rateOrAccum>
<expirationMinutes>15</expirationMinutes> <expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion> <conversion>0.0003937</conversion>
<mosaic>true</mosaic> <mosaic>true</mosaic>
<dateFormat>yyyyMMddHHmm</dateFormat> <dateFormat>yyyyMMddHHmm</dateFormat>
@ -108,8 +101,7 @@
<rateOrAccum>accum</rateOrAccum> <rateOrAccum>accum</rateOrAccum>
<expirationMinutes>2080</expirationMinutes> <expirationMinutes>2080</expirationMinutes>
<interpolatedGuidanceDelay>true</interpolatedGuidanceDelay> <interpolatedGuidanceDelay>true</interpolatedGuidanceDelay>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition> <interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<unit>inches</unit>
<conversion>0.03937</conversion> <conversion>0.03937</conversion>
<mosaic>true</mosaic> <mosaic>true</mosaic>
<guidanceType>RFC</guidanceType> <guidanceType>RFC</guidanceType>
@ -125,8 +117,7 @@
<rateOrAccum>accum</rateOrAccum> <rateOrAccum>accum</rateOrAccum>
<expirationMinutes>2080</expirationMinutes> <expirationMinutes>2080</expirationMinutes>
<interpolatedGuidanceDelay>true</interpolatedGuidanceDelay> <interpolatedGuidanceDelay>true</interpolatedGuidanceDelay>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition> <interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<unit>inches</unit>
<conversion>0.03937</conversion> <conversion>0.03937</conversion>
<mosaic>true</mosaic> <mosaic>true</mosaic>
<guidanceType>RFC</guidanceType> <guidanceType>RFC</guidanceType>
@ -142,8 +133,7 @@
<rateOrAccum>accum</rateOrAccum> <rateOrAccum>accum</rateOrAccum>
<expirationMinutes>2080</expirationMinutes> <expirationMinutes>2080</expirationMinutes>
<interpolatedGuidanceDelay>true</interpolatedGuidanceDelay> <interpolatedGuidanceDelay>true</interpolatedGuidanceDelay>
<interpolatedGuidanceTransition>true</interpolatedGuidanceTransition> <interpolatedGuidanceTransition>true</interpolatedGuidanceTransition>
<unit>inches</unit>
<conversion>0.03937</conversion> <conversion>0.03937</conversion>
<mosaic>true</mosaic> <mosaic>true</mosaic>
<guidanceType>RFC</guidanceType> <guidanceType>RFC</guidanceType>
@ -156,8 +146,7 @@
<dataType>XMRG</dataType> <dataType>XMRG</dataType>
<sourceType>GAGE</sourceType> <sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum> <rateOrAccum>rate</rateOrAccum>
<expirationMinutes>30</expirationMinutes> <expirationMinutes>30</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion> <conversion>0.0003937</conversion>
<hrapGridFactor>4</hrapGridFactor> <hrapGridFactor>4</hrapGridFactor>
</source> </source>
@ -169,8 +158,7 @@
<dataType>XMRG</dataType> <dataType>XMRG</dataType>
<sourceType>GAGE</sourceType> <sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum> <rateOrAccum>rate</rateOrAccum>
<expirationMinutes>30</expirationMinutes> <expirationMinutes>30</expirationMinutes>
<unit>inches</unit>
<conversion>0.0003937</conversion> <conversion>0.0003937</conversion>
<hrapGridFactor>4</hrapGridFactor> <hrapGridFactor>4</hrapGridFactor>
</source> </source>
@ -182,8 +170,7 @@
<dataType>RADAR</dataType> <dataType>RADAR</dataType>
<sourceType>GAGE</sourceType> <sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum> <rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes> <expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
</source> </source>
<source> <source>
<SourceName>VGBDPR</SourceName> <SourceName>VGBDPR</SourceName>
@ -193,8 +180,7 @@
<dataType>RADAR</dataType> <dataType>RADAR</dataType>
<sourceType>GAGE</sourceType> <sourceType>GAGE</sourceType>
<rateOrAccum>rate</rateOrAccum> <rateOrAccum>rate</rateOrAccum>
<expirationMinutes>15</expirationMinutes> <expirationMinutes>15</expirationMinutes>
<unit>inches</unit>
</source> </source>
<product primarySource="DHRMOSAIC"> <product primarySource="DHRMOSAIC">
<rate>DHRMOSAIC</rate> <rate>DHRMOSAIC</rate>

View file

@ -1,19 +1,19 @@
/** /**
* This software was developed and / or modified by Raytheon Company, * This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government. * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
* *
* U.S. EXPORT CONTROLLED TECHNICAL DATA * U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose * This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination * export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires * to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization. * an export license or other authorization.
* *
* Contractor Name: Raytheon Company * Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340 * Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8 * Mail Stop B8
* Omaha, NE 68106 * Omaha, NE 68106
* 402.291.0100 * 402.291.0100
* *
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
@ -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.GFEDao;
import com.raytheon.edex.plugin.gfe.db.dao.IscSendRecordDao; import com.raytheon.edex.plugin.gfe.db.dao.IscSendRecordDao;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException; 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.isc.IRTManager;
import com.raytheon.edex.plugin.gfe.reference.MapManager; import com.raytheon.edex.plugin.gfe.reference.MapManager;
import com.raytheon.edex.plugin.gfe.server.GridParmManager; import com.raytheon.edex.plugin.gfe.server.GridParmManager;
@ -64,9 +65,9 @@ import com.raytheon.uf.edex.site.ISiteActivationListener;
/** /**
* Activates the GFE server capabilities for a site * Activates the GFE server capabilities for a site
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
@ -75,9 +76,11 @@ import com.raytheon.uf.edex.site.ISiteActivationListener;
* Apr 06, 2012 #457 dgilling Clear site's ISCSendRecords on * Apr 06, 2012 #457 dgilling Clear site's ISCSendRecords on
* site deactivation. * site deactivation.
* Jul 12, 2012 15162 ryu added check for invalid db at activation * 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> * </pre>
* *
* @author njensen * @author njensen
* @version 1.0 * @version 1.0
*/ */
@ -214,7 +217,7 @@ public class GFESiteActivation implements ISiteActivationListener {
/** /**
* Activates a site by reading its server config and generating maps, topo, * Activates a site by reading its server config and generating maps, topo,
* and text products for the site * and text products for the site
* *
* @param siteID * @param siteID
*/ */
@Override @Override
@ -237,6 +240,13 @@ public class GFESiteActivation implements ISiteActivationListener {
"Error validating configuration for " + siteID); "Error validating configuration for " + siteID);
} }
internalActivateSite(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) { } catch (Exception e) {
sendActivationFailedNotification(siteID); sendActivationFailedNotification(siteID);
statusHandler.handle(Priority.PROBLEM, siteID statusHandler.handle(Priority.PROBLEM, siteID
@ -253,10 +263,10 @@ public class GFESiteActivation implements ISiteActivationListener {
/** /**
* Activate site routine for internal use. * Activate site routine for internal use.
* *
* Doesn't update the site list so it is preserved when loading sites at * Doesn't update the site list so it is preserved when loading sites at
* start up * start up
* *
* @param siteID * @param siteID
* @throws PluginException * @throws PluginException
* @throws GfeException * @throws GfeException
@ -478,7 +488,7 @@ public class GFESiteActivation implements ISiteActivationListener {
/** /**
* Deactivates a site's GFE services * Deactivates a site's GFE services
* *
* @param siteID * @param siteID
*/ */
@Override @Override
@ -552,7 +562,7 @@ public class GFESiteActivation implements ISiteActivationListener {
/** /**
* Returns the currently active GFE sites the server is running * Returns the currently active GFE sites the server is running
* *
* @return the active sites * @return the active sites
*/ */
@Override @Override
@ -562,7 +572,7 @@ public class GFESiteActivation implements ISiteActivationListener {
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
* @see com.raytheon.uf.edex.site.ISiteActivationListener#validateConfig() * @see com.raytheon.uf.edex.site.ISiteActivationListener#validateConfig()
*/ */
@Override @Override

View file

@ -1,19 +1,19 @@
/** /**
* This software was developed and / or modified by Raytheon Company, * This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government. * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
* *
* U.S. EXPORT CONTROLLED TECHNICAL DATA * U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose * This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination * export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires * to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization. * an export license or other authorization.
* *
* Contractor Name: Raytheon Company * Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340 * Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8 * Mail Stop B8
* Omaha, NE 68106 * Omaha, NE 68106
* 402.291.0100 * 402.291.0100
* *
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
@ -31,6 +31,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException; 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.DiscreteDefinition;
import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteKey; import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteKey;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil; import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
@ -45,16 +46,17 @@ import com.raytheon.uf.common.util.FileUtil;
/** /**
* Manages the serverConfigs of active sites * Manages the serverConfigs of active sites
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 9, 2009 njensen Initial creation * Jul 9, 2009 njensen Initial creation
* * Dec 11, 2012 14360 ryu Throw specific exception for missing configuration.
*
* </pre> * </pre>
* *
* @author njensen * @author njensen
* @version 1.0 * @version 1.0
*/ */
@ -72,7 +74,7 @@ public class IFPServerConfigManager {
/** /**
* Returns the sites that have active configurations * Returns the sites that have active configurations
* *
* @return * @return
*/ */
protected static Set<String> getActiveSites() { protected static Set<String> getActiveSites() {
@ -81,7 +83,7 @@ public class IFPServerConfigManager {
/** /**
* Gets the server configuration for a particular site * Gets the server configuration for a particular site
* *
* @param siteID * @param siteID
* the site * the site
* @return the site's configuration * @return the site's configuration
@ -100,7 +102,7 @@ public class IFPServerConfigManager {
/** /**
* Initializes a site's serverConfig by reading in the site's localConfig * Initializes a site's serverConfig by reading in the site's localConfig
* *
* @param siteID * @param siteID
* the site * the site
* @return the site's configuration * @return the site's configuration
@ -152,11 +154,11 @@ public class IFPServerConfigManager {
} }
} }
if (!siteConfigFound) { if (!siteConfigFound) {
throw new GfeConfigurationException( throw new GfeMissingConfigurationException(
"No siteConfig.py file found for " + siteID); "No siteConfig.py file found for " + siteID);
} }
} else { } else {
throw new GfeConfigurationException( throw new GfeMissingConfigurationException(
"No site config directory found for " + siteID); "No site config directory found for " + siteID);
} }
siteDir = siteDirFile.getPath(); siteDir = siteDirFile.getPath();
@ -186,7 +188,7 @@ public class IFPServerConfigManager {
/** /**
* Removes a site's configuration from the set of active configurations * Removes a site's configuration from the set of active configurations
* *
* @param siteID * @param siteID
*/ */
protected static void removeSite(String siteID) { protected static void removeSite(String siteID) {

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; break;
} }
} }
return !isAccum && isDuration; return isDuration;
} }
return !isAccum; return !isAccum;

View file

@ -56,8 +56,8 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory;
* Oct 09, 2009 bphillip Initial creation * Oct 09, 2009 bphillip Initial creation
* Sep 19, 2011 10955 rferrel make sure process destroy is called. * Sep 19, 2011 10955 rferrel make sure process destroy is called.
* Jun 12, 2012 00609 djohnson Use EDEXUtil for EDEX_HOME. * 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> * </pre>
* *
* @author bphillip * @author bphillip

View file

@ -56,6 +56,8 @@ import com.raytheon.uf.edex.wmo.message.WMOHeader;
* correctly parse multiple SHEF formats * correctly parse multiple SHEF formats
* 12/03/2008 chammack Camel refactor * 12/03/2008 chammack Camel refactor
* 12/xx/2010 jkorman Complete rewrite. * 12/xx/2010 jkorman Complete rewrite.
* 11/29/2012 lbousaidi fixed the decoding issue when the shef starts
* with :
* </pre> * </pre>
* *
* @author bphillip * @author bphillip
@ -615,9 +617,6 @@ public class ShefSeparator extends AbstractRecordSeparator {
private static String removeInternalComments(String dataLine) { private static String removeInternalComments(String dataLine) {
String s = null; String s = null;
if (dataLine != null) { if (dataLine != null) {
if (dataLine.startsWith(":")) {
s = new String();
} else {
StringBuilder buffer = new StringBuilder(dataLine.length()); StringBuilder buffer = new StringBuilder(dataLine.length());
boolean inComment = false; boolean inComment = false;
for (int i = 0; i < dataLine.length(); i++) { for (int i = 0; i < dataLine.length(); i++) {
@ -630,8 +629,7 @@ public class ShefSeparator extends AbstractRecordSeparator {
inComment = !inComment; inComment = !inComment;
} }
} }
s = buffer.toString(); s = buffer.toString();
}
} else { } else {
s = new String(); 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. * 02/02/2009 1943 J. Sanchez Add method postRiverStatus.
* 05/29/2009 2410 J. Sanchez Posted data for unknstnvalue. * 05/29/2009 2410 J. Sanchez Posted data for unknstnvalue.
* 02/24/2012 14535 W. Kwock Correct the duration value. * 02/24/2012 14535 W. Kwock Correct the duration value.
* 11/29/2012 15530 lbousaidi corrected posting and production time for
* latestobsvalue table.
* *
* </pre> * </pre>
* *
@ -1074,11 +1076,10 @@ public class PostTables {
} }
cs.setString(11, productId); cs.setString(11, productId);
cs.setTimestamp(12, new Timestamp(shefData.getObservationTimeObj()
.getTime())); cs.setTimestamp(12, new java.sql.Timestamp(productTime.getTime()));
cs.setTimestamp(13, new Timestamp(shefData.getObservationTimeObj() cs.setTimestamp(13, new java.sql.Timestamp(postTime.getTime()));
.getTime()));
int doOverwrite = PostTables.determineUpdateAction(duplicateOption, int doOverwrite = PostTables.determineUpdateAction(duplicateOption,
record.isRevisedRecord()); record.isRevisedRecord());
cs.setInt(14, doOverwrite); cs.setInt(14, doOverwrite);

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. * 6/1/09 #2432 jsanchez Updated value magnitude for hourlypp/pc.
* 26 Nov 2012 #15554 lbousaidi used obstime instead of system time in isNear12Z * 26 Nov 2012 #15554 lbousaidi used obstime instead of system time in isNear12Z
* routine. * routine.
* 4 Dec 2012 #15569 lbousaidi fixed daily pp value when token is set to USE_REVCODE
* </pre> * </pre>
* *
* @author mnash * @author mnash
@ -408,6 +409,13 @@ public class GagePP {
default: default:
break; 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 * 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) { public double getValue(String modelName, String prodType, Coordinate coor) {
double value = -99999.0; double value = -99999.0;
try { try {
System.out.println("Freezing level---debug0 getValue "+modelName+" "+prodType+" "+coor+" "+gribMap.size());
Point point = getPoint(modelName, prodType, coor); Point point = getPoint(modelName, prodType, coor);
GridRecord gribRec = getRecord(modelName, prodType); GridRecord gribRec = getRecord(modelName, prodType);
FloatDataRecord rec = (FloatDataRecord) getRecord(modelName, FloatDataRecord rec = (FloatDataRecord) getRecord(modelName,
prodType).getMessageData(); prodType).getMessageData();
value = rec.getFloatData()[(gribRec.getSpatialObject().getNx() * point.x) System.out.println("Freezing level---debug1 getValue "+rec.getFloatData().length+" "+
+ point.y]; gribRec.getSpatialObject().getNx()+","+gribRec.getSpatialObject().getNy()+" "+point);
value = rec.getFloatData()[(gribRec.getSpatialObject().getNx() *
(gribRec.getSpatialObject().getNy()-point.y)) + point.x];
} catch (Exception e) { } catch (Exception e) {
logger.error("No Grib value available....." + modelName + " " logger.error("No Grib value available....." + modelName + " "
+ prodType); + prodType);
e.printStackTrace();
} }
return value; return value;
} }

View file

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

View file

@ -24,10 +24,22 @@ import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map.Entry; 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.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.raytheon.uf.common.monitor.xml.SCANModelParameterXML;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
@ -72,9 +84,9 @@ public class FreezingLevel {
// reference time // reference time
Calendar refTime = null; Calendar refTime = null;
private transient final Log logger = LogFactory.getLog(getClass());
public FreezingLevel(String modelName) { public FreezingLevel(String modelName) {
this.modelName = modelName; this.modelName = modelName;
times = new HashMap<Integer, Date>(); times = new HashMap<Integer, Date>();
zeroCount = 0; 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 * 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>(); HashMap<Coordinate, Float> freezingMap = new HashMap<Coordinate, Float>();
ScanDataCache cache = ScanDataCache.getInstance(); ScanDataCache cache = ScanDataCache.getInstance();
//get data from hdf5 files
for (Coordinate coor : coors) { for (Coordinate coor : coors) {
HashMap<Integer, Double> ghValues = new HashMap<Integer, Double>(); HashMap<Integer, Double> ghValues = new HashMap<Integer, Double>();
@ -114,34 +200,46 @@ public class FreezingLevel {
for (Entry<String, Integer> entry : getGHLevelMap().entrySet()) { for (Entry<String, Integer> entry : getGHLevelMap().entrySet()) {
if (cache.getModelData().isType(modelName, entry.getKey())) { if (cache.getModelData().isType(modelName, entry.getKey())) {
ghValues.put(entry.getValue(), getValue(modelName, entry.getKey(), coor));
ghValues.put(entry.getValue(), cache.getModelData() } else {
.getValue(modelName, entry.getKey(), coor)); ghValues.put(entry.getValue(),null);
} }
} }
for (Entry<String, Integer> entry : getTLevelMap().entrySet()) { for (Entry<String, Integer> entry : getTLevelMap().entrySet()) {
if (cache.getModelData().isType(modelName, entry.getKey())) { if (cache.getModelData().isType(modelName, entry.getKey())) {
tValues.put(entry.getValue(), cache.getModelData() tValues.put(entry.getValue(), getValue(modelName, entry.getKey(), coor));
.getValue(modelName, entry.getKey(), coor));
} }
} }
Double fLevel = -99999.0; //here's the calculation
Double fLevel = 0.0;
Integer jtopLevel = null; Integer jtopLevel = null;
Integer ktopLevel = 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 System.out
.println("********** Starting Freezing Level Calculations *****************"); .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 tValue = tValues.get(level);
Double ghValue = ghValues.get(level); Double ghValue = ghValues.get(level);
System.out.println("GH Value: " + ghValue + " TValue: " System.out.println("GH Value: " + ghValue + " TValue: "
+ tValue); + tValue);
if (ghValue != null && ghValue > -9000) { if (ghValue != null && tValue != null && foundValFlag ==-1){
if (tValue != null && tValue > 273.16) { foundValFlag=0;
}
if (ghValue != null && ghValue.doubleValue() > -9000) {
if (tValue != null && tValue.doubleValue() > 273.16) {
fLevel = (ghValues.get(ktopLevel) - ((ghValues fLevel = (ghValues.get(ktopLevel) - ((ghValues
.get(ktopLevel) - ghValue) * ((273.16 - tValues .get(ktopLevel) - ghValue) * ((273.16 - tValues
@ -155,6 +253,7 @@ public class FreezingLevel {
+ " - " + tValues.get(jtopLevel) + " - " + tValues.get(jtopLevel)
+ ")))) * .00328"); + ")))) * .00328");
System.out.println("*** FreezingLevel = " + fLevel); System.out.println("*** FreezingLevel = " + fLevel);
foundValFlag=1;
freezingMap.put(coor, fLevel.floatValue()); freezingMap.put(coor, fLevel.floatValue());
break; break;
} else { } 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 System.out
.println("********** Finished Freezing Level Calculations *****************"); .println("********** Finished Freezing Level Calculations *****************");
} }
@ -252,6 +357,7 @@ public class FreezingLevel {
paramXML.setModelName(model); paramXML.setModelName(model);
paramXML.setParameterName(param); paramXML.setParameterName(param);
String sql = getSQL(interval, model, param, refTime); String sql = getSQL(interval, model, param, refTime);
System.out.println("Freezing level sql="+sql);
GridRecord modelRec = DATUtils.getMostRecentGridRecord(interval, sql, GridRecord modelRec = DATUtils.getMostRecentGridRecord(interval, sql,
paramXML); paramXML);
@ -358,7 +464,7 @@ public class FreezingLevel {
+ "\' and grid_info.datasetId = \'" + "\' and grid_info.datasetId = \'"
+ model + model
+ "\' and level.masterlevel_name = 'MB' and level.levelonevalue = '" + "\' 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; return sql;
} }
} }

View file

@ -83,7 +83,10 @@ public class MpeRUCFreezingLevel {
.getToken("mpe_point_freezing_dir"); .getToken("mpe_point_freezing_dir");
public static String dqcPreprocessorBasetime = AppsDefaults.getInstance() 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; public File stationFile = null;
@ -93,29 +96,11 @@ public class MpeRUCFreezingLevel {
public static String[] models = new String[] { "RUC236" }; public static String[] models = new String[] { "RUC236" };
public MpeRUCFreezingLevel() { public MpeRUCFreezingLevel() {
try { this.stationFile = new File(stationFilePath+"/"+mpeSiteId+"_freezing_station_list");
File directory = new File(stationFilePath);
if (directory != null) { // correct env vairiable dqcPreprocessorBasetime if needed. Default to 12z
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
if (dqcPreprocessorBasetime == null) { if (dqcPreprocessorBasetime == null) {
dqcPreprocessorBasetime = "00z"; dqcPreprocessorBasetime = "12z";
} }
dqcPreprocessorBasetime = dqcPreprocessorBasetime.toLowerCase(); dqcPreprocessorBasetime = dqcPreprocessorBasetime.toLowerCase();
@ -123,7 +108,7 @@ public class MpeRUCFreezingLevel {
&& !dqcPreprocessorBasetime.equals("06z") && !dqcPreprocessorBasetime.equals("06z")
&& !dqcPreprocessorBasetime.equals("12z") && !dqcPreprocessorBasetime.equals("12z")
&& !dqcPreprocessorBasetime.equals("18z")) { && !dqcPreprocessorBasetime.equals("18z")) {
dqcPreprocessorBasetime = "00z"; dqcPreprocessorBasetime = "12z";
} }
} }
@ -227,10 +212,8 @@ public class MpeRUCFreezingLevel {
// order // order
try { try {
String site = PropertiesFactory.getInstance().getEnvProperties()
.getEnvValue("SITENAME");
ofstream = new FileOutputStream(getAbsoluteOutFileName( ofstream = new FileOutputStream(getAbsoluteOutFileName(
dates[3].getTime(), site)); dates[3].getTime(), mpeSiteId));
out = new DataOutputStream(ofstream); out = new DataOutputStream(ofstream);
bw = new BufferedWriter(new OutputStreamWriter(out)); bw = new BufferedWriter(new OutputStreamWriter(out));
@ -277,8 +260,7 @@ public class MpeRUCFreezingLevel {
String fzlev = "M"; String fzlev = "M";
if (fle != null) { if (fle != null) {
fzlev = String.valueOf(fle.getFreezingLevel()) fzlev = String.format("%3.2f",fle. getFreezingLevel()) + "S";
.substring(0, 4) + "S";
} }
buf.append(" " + fzlev); buf.append(" " + fzlev);

View file

@ -1,19 +1,19 @@
/** /**
* This software was developed and / or modified by Raytheon Company, * This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government. * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
* *
* U.S. EXPORT CONTROLLED TECHNICAL DATA * U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose * This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination * export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires * to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization. * an export license or other authorization.
* *
* Contractor Name: Raytheon Company * Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340 * Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8 * Mail Stop B8
* Omaha, NE 68106 * Omaha, NE 68106
* 402.291.0100 * 402.291.0100
* *
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
@ -48,23 +48,24 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory;
import com.raytheon.uf.edex.site.SiteActivationMessage.Action; import com.raytheon.uf.edex.site.SiteActivationMessage.Action;
/** /**
* *
* Site Aware Registry * Site Aware Registry
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 30, 2010 rjpeter Initial creation * Nov 30, 2010 rjpeter Initial creation
* Jul 31, 2012 #965 dgilling Force ordering of sites in * Jul 31, 2012 #965 dgilling Force ordering of sites in
* getActiveSites(). * getActiveSites().
* Nov 1, 2012 15417 ryu Modified getActiveSites to include * Nov 1, 2012 15417 ryu Modified getActiveSites to include
* home site only if activated. * home site only if activated.
* * Dec 11, 2012 14360 ryu No printing stack trace on activation exception
*
* </pre> * </pre>
* *
* @author rjpeter * @author rjpeter
* @version 1.0 * @version 1.0
*/ */
@ -100,7 +101,7 @@ public class SiteAwareRegistry {
/** /**
* registers/adds site activation listeners * registers/adds site activation listeners
* *
* @param sa * @param sa
* the listener to register / add to the list * the listener to register / add to the list
*/ */
@ -115,8 +116,8 @@ public class SiteAwareRegistry {
try { try {
sa.activateSite(siteID); sa.activateSite(siteID);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), // Stack trace is not printed per requirement for DR14360
e); statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage());
} }
} }
@ -134,7 +135,7 @@ public class SiteAwareRegistry {
/** /**
* get the set of strings for the active sites * get the set of strings for the active sites
* *
* @return the requested array of Strings this is a string array to make it * @return the requested array of Strings this is a string array to make it
* work with dwr frontend, most of the other stuff is Set<String> * work with dwr frontend, most of the other stuff is Set<String>
*/ */
@ -156,7 +157,7 @@ public class SiteAwareRegistry {
/** /**
* Checks to see if the given site is active * Checks to see if the given site is active
* *
* @param site * @param site
* The site to check * The site to check
* @return True if the site is active, else false * @return True if the site is active, else false
@ -182,7 +183,7 @@ public class SiteAwareRegistry {
/** /**
* activate the site specified in each listener * activate the site specified in each listener
* *
* @param siteID * @param siteID
*/ */
public void activateSite(String siteID) { public void activateSite(String siteID) {
@ -203,7 +204,7 @@ public class SiteAwareRegistry {
/** /**
* deactivate the site specified in each listener * deactivate the site specified in each listener
* *
* @param siteID * @param siteID
*/ */
public void deactivateSite(String siteID) { public void deactivateSite(String siteID) {
@ -223,7 +224,7 @@ public class SiteAwareRegistry {
/** /**
* cycle the site specified in each listener * cycle the site specified in each listener
* *
* @param siteID * @param siteID
*/ */
public void cycleSite(String siteID) { public void cycleSite(String siteID) {

View file

@ -35,7 +35,8 @@ import os, sys
# 09/14/10 dgilling Initial Creation. # 09/14/10 dgilling Initial Creation.
# 11/04/10 5849 cjeanbap Updated Notification package location # 11/04/10 5849 cjeanbap Updated Notification package location
# 06/09/11 9841 rferrel fixed help and argument order # 06/09/11 9841 rferrel fixed help and argument order
# for sendNotificationMsg. # for sendNotificationMsg.
# 11/29/12 DR14016 jzeng change priority definition from 0-3 to 1-4
# #
# #
class PrintHelpOnErrorParser(ArgumentParser): class PrintHelpOnErrorParser(ArgumentParser):
@ -55,13 +56,13 @@ def main():
help="Port upon which the alertViz server is running.", help="Port upon which the alertViz server is running.",
metavar="port") metavar="port")
group = parser.add_mutually_exclusive_group() 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)") 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.") 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.") 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.") help="Send as an alert message.")
parser.add_argument("-c", action="store", dest="msgClass", parser.add_argument("-c", action="store", dest="msgClass",
help="Message class.", metavar="class", default="GFE") help="Message class.", metavar="class", default="GFE")

View file

@ -5,7 +5,7 @@
Name: awips2-ldm Name: awips2-ldm
Summary: AWIPS II LDM Distribution Summary: AWIPS II LDM Distribution
Version: 6.8.1 Version: 6.8.1
Release: 26 Release: 27
Group: AWIPSII Group: AWIPSII
BuildRoot: /tmp BuildRoot: /tmp
URL: N/A 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 # 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 # 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 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}) (..)(..)(..) 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 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