Merge branch 'omaha_13.4.1' (13.4.1-7) into development

Conflicts:
	cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ui/layer/VRShearLayer.java
	cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/interrogators/RadarVelocityInterrogator.java
	edexOsgi/build.edex/esb/conf/spring/edex.xml
	edexOsgi/com.raytheon.edex.common/src/com/raytheon/edex/db/purge/SchemaManager.java
	edexOsgi/com.raytheon.uf.edex.purgesrv/src/com/raytheon/uf/edex/purgesrv/PurgeJob.java

Change-Id: Ie7062275be13d6b19bbc9476b0c0f5aba129c862

Former-commit-id: 207c17d5af [formerly 2c009eb618] [formerly a12830f762] [formerly c5040038d3 [formerly a12830f762 [formerly 3f82f4d18bd7d0afa1e4cb49493e690d9160c24e]]]
Former-commit-id: c5040038d3
Former-commit-id: 4a7cd13915319fef7cf3e6405d041ffee0348571 [formerly bcf4dcc810]
Former-commit-id: 6c09ab9bdf
This commit is contained in:
Richard Peter 2013-05-13 17:11:05 -05:00
commit 994357c357
80 changed files with 3419 additions and 2260 deletions

View file

@ -2,19 +2,19 @@
##
# 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.
##
@ -119,7 +119,7 @@ nnn = r'(?:[A-Z]{2}[ZC])?\d{3}'
purge = r'(?P<purgeT>\d{6})-'
ugc = r'\n(?P<uhdr>' + r'[A-Z]{2}[Z|C](?:(?:\d{3})|(?:ALL))' + r'(?:[->]\n?' + nnn + \
r')*-\n?' + purge + el + r')'
cityh = r'-\n(?P<incc>(?:\s*\n)*(?:INCLUDING THE (?:CITIES|CITY) OF...)?)'
cityh = r'(?<=-\n(?!.*-\n))(?P<incc>(?:.*\n))'
body = r'(?P<body>(?:^.*\n)*?)'
#body = r'.*'
@ -192,20 +192,20 @@ class ProductParser:
#l = headline_re.finditer(str)
l = single_head_re.finditer(str)
for m in l:
if m is not None:
if m is not None:
#print 'phl m = ', m
newstart = start + m.start()
m = headline_re.match(m.group(0))
if m is not None:
hdlns.append(self.dumpMatch(m, newstart))
#print 'hdlns = ', hdlns
rval['headInfo'] = hdlns
def dumpMatch(self, m, offset=0, rval=None):
if rval is None:
rval = {}
#print 'dumpmatch m = ', m.groupdict()
for k in m.groupdict().keys():
if m.start(k) != -1 and m.start(k) != m.end(k):
@ -234,7 +234,7 @@ class ProductParser:
segs = []
l = ugch_re.finditer(self._str)
for m in l:
if m is not None:
m1 = cityh_re.search(self._str, m.end())
@ -250,7 +250,7 @@ class ProductParser:
else:
continue
m4 = head_re.search(self._str, m.end(), m3.end())
d = self.dumpMatch(m)
d = self.dumpMatch(m2, rval=d)
d = self.dumpMatch(m3, rval=d)
@ -266,7 +266,7 @@ class ProductParser:
else:
d['city'] = (self.tkc(m2.start()),
self.tkc(m2.start()))
if m4 is not None:
#print 'm4 = ', m4.group()
d = self.dumpMatch(m4, rval=d)
@ -284,7 +284,7 @@ class ProductParser:
rval['frames'] = frames
return rval
def parseFromJava(self, text):
self._str = text
self._ci = None
@ -295,13 +295,13 @@ class ProductParser:
lc.append(count)
count += l
self._totals = lc
#print 'text START ----------------------'
#print text
#print 'text END ------------------------'
result = self.parse()
#print 'result = ', result
return JUtil.pyDictToJavaMap(result)

View file

@ -22,6 +22,7 @@ package com.raytheon.uf.viz.core.comm;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import javax.jms.ConnectionFactory;
import org.apache.qpid.client.AMQConnectionFactory;
@ -41,6 +42,7 @@ import com.raytheon.uf.viz.core.VizApp;
* Nov 2, 2009 #3067 chammack Send all jms connections through failover:// to properly reconnect
* Nov 2, 2011 #7391 bkowal Ensure that the generated WsId is properly formatted to be
* included in a url.
* May 09, 2013 1814 rjpeter Updated prefetch to 10.
* </pre>
*
* @author chammack
@ -50,7 +52,7 @@ public class JMSConnection {
private static JMSConnection instance;
private String jndiProviderUrl;
private final String jndiProviderUrl;
private AMQConnectionFactory factory;
@ -76,17 +78,18 @@ public class JMSConnection {
// reconnect
this.factory = new AMQConnectionFactory(
"amqp://guest:guest@"
+ URLEncoder.encode(VizApp.getWsId().toString(), "UTF-8")
+ URLEncoder.encode(VizApp.getWsId().toString(),
"UTF-8")
+ "/edex?brokerlist='"
+ this.jndiProviderUrl
+ "?connecttimeout='5000'&heartbeat='0''&maxprefetch='0'&sync_publish='all'&failover='nofailover'");
+ "?connecttimeout='5000'&heartbeat='0''&maxprefetch='10'&sync_publish='all'&failover='nofailover'");
} catch (URLSyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (UnsupportedEncodingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
/**

View file

@ -19,10 +19,123 @@
further_licensing_information.
-->
<DerivedParameter abbreviation="CapeStk" name="Cape Stack">
<!-- For Composite Agl levels it is better to explicitly list the levels
to Union to avoid pulling in extra levels, specifically levels defined at
kft heights. -->
<Method name="Union" levels="0-1kmAgl">
<Field abbreviation="cCape" level="0kmAgl" />
<Field abbreviation="cCape" level="0.5kmAgl" />
<Field abbreviation="cCape" level="1kmAgl" />
</Method>
<Method name="Union" levels="0-1.5kmAgl">
<Field abbreviation="cCape" level="0kmAgl" />
<Field abbreviation="cCape" level="0.5kmAgl" />
<Field abbreviation="cCape" level="1kmAgl" />
<Field abbreviation="cCape" level="1.5kmAgl" />
</Method>
<Method name="Union" levels="0-2kmAgl">
<Field abbreviation="cCape" level="0kmAgl" />
<Field abbreviation="cCape" level="0.5kmAgl" />
<Field abbreviation="cCape" level="1kmAgl" />
<Field abbreviation="cCape" level="1.5kmAgl" />
<Field abbreviation="cCape" level="2kmAgl" />
</Method>
<Method name="Union" levels="0-2.5kmAgl">
<Field abbreviation="cCape" level="0kmAgl" />
<Field abbreviation="cCape" level="0.5kmAgl" />
<Field abbreviation="cCape" level="1kmAgl" />
<Field abbreviation="cCape" level="1.5kmAgl" />
<Field abbreviation="cCape" level="2kmAgl" />
<Field abbreviation="cCape" level="2.5kmAgl" />
</Method>
<Method name="Union" levels="0-3kmAgl">
<Field abbreviation="cCape" level="0kmAgl" />
<Field abbreviation="cCape" level="0.5kmAgl" />
<Field abbreviation="cCape" level="1kmAgl" />
<Field abbreviation="cCape" level="1.5kmAgl" />
<Field abbreviation="cCape" level="2kmAgl" />
<Field abbreviation="cCape" level="2.5kmAgl" />
<Field abbreviation="cCape" level="3kmAgl" />
</Method>
<Method name="Union" levels="0-4kmAgl">
<Field abbreviation="cCape" level="0kmAgl" />
<Field abbreviation="cCape" level="0.5kmAgl" />
<Field abbreviation="cCape" level="1kmAgl" />
<Field abbreviation="cCape" level="1.5kmAgl" />
<Field abbreviation="cCape" level="2kmAgl" />
<Field abbreviation="cCape" level="2.5kmAgl" />
<Field abbreviation="cCape" level="3kmAgl" />
<Field abbreviation="cCape" level="3.5kmAgl" />
<Field abbreviation="cCape" level="4kmAgl" />
</Method>
<Method name="Union" levels="0-5kmAgl">
<Field abbreviation="cCape" level="0kmAgl" />
<Field abbreviation="cCape" level="0.5kmAgl" />
<Field abbreviation="cCape" level="1kmAgl" />
<Field abbreviation="cCape" level="1.5kmAgl" />
<Field abbreviation="cCape" level="2kmAgl" />
<Field abbreviation="cCape" level="2.5kmAgl" />
<Field abbreviation="cCape" level="3kmAgl" />
<Field abbreviation="cCape" level="3.5kmAgl" />
<Field abbreviation="cCape" level="4kmAgl" />
<Field abbreviation="cCape" level="4.5kmAgl" />
<Field abbreviation="cCape" level="5kmAgl" />
</Method>
<Method name="Union" levels="0-6kmAgl">
<Field abbreviation="cCape" level="0kmAgl" />
<Field abbreviation="cCape" level="0.5kmAgl" />
<Field abbreviation="cCape" level="1kmAgl" />
<Field abbreviation="cCape" level="1.5kmAgl" />
<Field abbreviation="cCape" level="2kmAgl" />
<Field abbreviation="cCape" level="2.5kmAgl" />
<Field abbreviation="cCape" level="3kmAgl" />
<Field abbreviation="cCape" level="3.5kmAgl" />
<Field abbreviation="cCape" level="4kmAgl" />
<Field abbreviation="cCape" level="4.5kmAgl" />
<Field abbreviation="cCape" level="5kmAgl" />
<Field abbreviation="cCape" level="5.5kmAgl" />
<Field abbreviation="cCape" level="6kmAgl" />
</Method>
<Method name="Union" levels="0-8kmAgl">
<Field abbreviation="cCape" level="0kmAgl" />
<Field abbreviation="cCape" level="0.5kmAgl" />
<Field abbreviation="cCape" level="1kmAgl" />
<Field abbreviation="cCape" level="1.5kmAgl" />
<Field abbreviation="cCape" level="2kmAgl" />
<Field abbreviation="cCape" level="2.5kmAgl" />
<Field abbreviation="cCape" level="3kmAgl" />
<Field abbreviation="cCape" level="3.5kmAgl" />
<Field abbreviation="cCape" level="4kmAgl" />
<Field abbreviation="cCape" level="4.5kmAgl" />
<Field abbreviation="cCape" level="5kmAgl" />
<Field abbreviation="cCape" level="5.5kmAgl" />
<Field abbreviation="cCape" level="6kmAgl" />
<Field abbreviation="cCape" level="7kmAgl" />
<Field abbreviation="cCape" level="8kmAgl" />
</Method>
<Method name="Union" levels="0-10kmAgl">
<Field abbreviation="cCape" level="0kmAgl" />
<Field abbreviation="cCape" level="0.5kmAgl" />
<Field abbreviation="cCape" level="1kmAgl" />
<Field abbreviation="cCape" level="1.5kmAgl" />
<Field abbreviation="cCape" level="2kmAgl" />
<Field abbreviation="cCape" level="2.5kmAgl" />
<Field abbreviation="cCape" level="3kmAgl" />
<Field abbreviation="cCape" level="3.5kmAgl" />
<Field abbreviation="cCape" level="4kmAgl" />
<Field abbreviation="cCape" level="4.5kmAgl" />
<Field abbreviation="cCape" level="5kmAgl" />
<Field abbreviation="cCape" level="5.5kmAgl" />
<Field abbreviation="cCape" level="6kmAgl" />
<Field abbreviation="cCape" level="7kmAgl" />
<Field abbreviation="cCape" level="8kmAgl" />
<Field abbreviation="cCape" level="9kmAgl" />
<Field abbreviation="cCape" level="10kmAgl" />
</Method>
<Method name="Union" levels="C,FHAG">
<Field abbreviation="cCape"/>
<Field abbreviation="cCape" />
</Method>
<Method name="Union" levels="C,MB">
<Field abbreviation="cCape"/>
<Field abbreviation="cCape" />
</Method>
</DerivedParameter>

View file

@ -81,7 +81,7 @@ public abstract class FFMPTable extends Composite {
/** DR14406: For columns with more words */
protected static final int EXTRA_COLUMN_WIDTH = 28;
private static final String NAME = "Name";
protected String currentPfaf = null;
@ -401,23 +401,24 @@ public abstract class FFMPTable extends Composite {
break;
}
}
// Check if the sorted column is a column that will contain a filter.
// Check the gui config to see if colorCell is true. If false then do
// not apply filter
// Check if the sorted column is a column that will contain a
// filter. Check the gui config to see if colorCell is true. If
// false then do not apply filter
for (FFMPTableColumnXML xml : ffmpTableCols) {
if (xml.getColumnName().contains(sortedThreshCol.name())) {
if (ffmpConfig.isColorCell(sortedThreshCol)) {
// Only filter if colorCell is true
isAFilterCol = true;
filterNum = ffmpConfig.getFilterValue(sortedThreshCol);
reverseFilter = ffmpConfig.isReverseFilter(sortedThreshCol);
reverseFilter = ffmpConfig
.isReverseFilter(sortedThreshCol);
}
break;
}
}
}
table.removeAll();
if (tableData == null) {
@ -445,12 +446,12 @@ public abstract class FFMPTable extends Composite {
*/
if (!sortedColumnName.equalsIgnoreCase(NAME)) {
float dataVal = cellData[sortColIndex].getValueAsFloat();
// DR 14250 fix: any value not a number will be omitted
if (Float.isNaN(dataVal)) {
continue;
}
if (isAFilterCol) {
if (reverseFilter) {
if (dataVal > filterNum) {
@ -470,7 +471,7 @@ public abstract class FFMPTable extends Composite {
tableIndex = indexArray.indexOf(t);
}
}
/*
* VIRTUAL TABLE
*
@ -617,15 +618,13 @@ public abstract class FFMPTable extends Composite {
if (tableData == null) {
return;
}
String sortCol = (String) tc.getData();
int sortDir = getColumnAttributeData(sortCol).getSortDir();
int columnIndex = getColumnIndex(sortCol);
tableData.setSortColumnAndDirection(columnIndex, sortDir);
tableData.sortData();
tableData.sortData(columnIndex, sortDir);
FfmpTableConfigData ffmpTableCfgData = FfmpTableConfig.getInstance()
.getTableConfigData(this.siteKey);

View file

@ -19,7 +19,6 @@
**/
package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS;
@ -39,6 +38,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig.ThreshColNames;
* ------------ ---------- ----------- --------------------------
* Apr 6, 2009 lvenable Initial creation
* Apr 12, 2013 1902 mpduff Optimized the color assignments.
* May 7, 2013 1986 njensen Optimized sortBy
*
* </pre>
*
@ -205,30 +205,19 @@ public class FFMPTableCellData {
return this.hoverText;
}
/**
* Sort by method.
*
* @param direction
* Sort direction.
* @return Object that is a string or number.
*/
public Object sortByObject(int direction) {
if (cellText != null) {
return String.format("%-20S", cellText);
} else if (value.isNaN() == false) {
public float sortByNumber() {
if (!value.isNaN()) {
if (displayAsInt == true) {
return new Float(Math.round(value));
return (float) Math.round(value);
}
return new Float(value);
} else if (value.isNaN() == true) {
if (direction == SWT.DOWN) {
return Float.MAX_VALUE * -1.0f;
}
return Float.MAX_VALUE;
return value.floatValue();
} else {
// NaN is not displayed in the table when sorting by
// this column, so the value to return here is not especially
// important
return Float.NEGATIVE_INFINITY;
}
return "Unknown";
}
public String displayString() {

View file

@ -38,6 +38,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ISortColumn;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 7, 2009 lvenable Initial creation
* May 7, 2013 1986 njensen Optimized sortData()
*
* </pre>
*
@ -151,19 +152,6 @@ public class FFMPTableData implements ISortColumn {
return tableRows;
}
/**
* Set the sort column and direction.
*
* @param columnIndex
* Column index.
* @param direction
* Sort direction.
*/
public void setSortColumnAndDirection(int columnIndex, int direction) {
currentSortColumnIndex = columnIndex;
currentSortDirection = direction;
}
/**
* Get the sort column index.
*
@ -186,8 +174,21 @@ public class FFMPTableData implements ISortColumn {
/**
* Sort the table data.
*
* @param columnIndex
* the column to sort on
* @param direction
* the direction to sort by
*/
public void sortData() {
Collections.sort(tableRows);
public void sortData(int columnIndex, int direction) {
if (columnIndex != currentSortColumnIndex
|| direction != currentSortDirection) {
currentSortColumnIndex = columnIndex;
currentSortDirection = direction;
Collections.sort(tableRows);
if (getSortDirection() == SWT.DOWN) {
Collections.reverse(tableRows);
}
}
}
}

View file

@ -19,8 +19,6 @@
**/
package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs;
import org.eclipse.swt.SWT;
import com.raytheon.uf.viz.monitor.ui.dialogs.ISortColumn;
/**
@ -34,6 +32,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ISortColumn;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 7, 2009 lvenable Initial creation
* May 7, 2013 1986 njensen Sped up compareTo()
*
* </pre>
*
@ -138,36 +137,16 @@ public class FFMPTableRowData implements Comparable<FFMPTableRowData> {
@Override
public int compareTo(FFMPTableRowData otherObj) {
int selectedIndex = sortCB.getSortColumn();
int direction = sortCB.getSortDirection();
int x = 0;
Object thisData = rowCells[selectedIndex].sortByObject(direction);
Object otherData = otherObj.rowCells[selectedIndex]
.sortByObject(direction);
if (thisData instanceof String) {
x = ((String) thisData).compareTo((String) otherData);
} else if (thisData instanceof Number) {
double thisNumber = (Float) thisData;
double otherNumber = (Float) otherData;
if (thisNumber < otherNumber) {
x = -1;
} else if (thisNumber > otherNumber) {
x = 1;
} else {
x = 0;
}
FFMPTableCellData selectedCell = rowCells[selectedIndex];
if (selectedCell.getCellText() != null) {
String thisText = selectedCell.getCellText();
String otherText = otherObj.rowCells[selectedIndex].getCellText();
return thisText.compareTo(otherText);
} else {
float thisFloat = selectedCell.sortByNumber();
float otherFloat = otherObj.rowCells[selectedIndex].sortByNumber();
return Float.compare(thisFloat, otherFloat);
}
if (direction == SWT.DOWN) {
if (x < 0) {
return 1;
} else if (x > 0) {
return -1;
}
}
return x;
}
}

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.monitor.xml.SourceXML;
* Jul 20, 2011 mpduff Initial creation
* 01/14/13 1569 dhladky changed arraylist to list
* 04/15/13 1890 dhladky Changed COUNTY to use constant
* 05/10/13 1919 mpduff If there are forced pfafs then the aggregate is forced.
*
* </pre>
*
@ -57,7 +58,7 @@ public class FFFGForceUtil {
private List<Long> pfafList = new ArrayList<Long>();
private FFMPResource resource;
private final FFMPResource resource;
private String domain = "NA";
@ -65,7 +66,7 @@ public class FFFGForceUtil {
private SourceXML sourceXML2 = null;
private FFMPGuidanceInterpolation interp;
private final FFMPGuidanceInterpolation interp;
private double src1Hr = -999;
@ -151,7 +152,7 @@ public class FFFGForceUtil {
}
FFFGDataMgr fdm = FFFGDataMgr.getInstance();
if ((sliderTime >= src1Hr) && (sliderTime <= src2Hr)) {
// Slider falls between the source times
if (sliderTime == src1Hr) {
@ -212,6 +213,8 @@ public class FFFGForceUtil {
}
}
}
} else if (!forcedPfafList.isEmpty()) {
forced = true;
}
}
}
@ -227,7 +230,7 @@ public class FFFGForceUtil {
}
long pfaf = pfafList2.get(i);
long countyFips = ft.getCountyFipsByPfaf(pfaf);
if (countyFips != prevCtyFips) {
if (fdm.isBasinForced(source, countyFips)) {
forcedList.add(pfaf);
@ -243,29 +246,28 @@ public class FFFGForceUtil {
return forcedList;
}
public float getAvgForcedValue(List<Long> pfafList,
List<Long> forcedPfafs,
FFMPGuidanceInterpolation interpolation,
long expiration, FFMPTemplates templates) {
public float getAvgForcedValue(List<Long> pfafList, List<Long> forcedPfafs,
FFMPGuidanceInterpolation interpolation, long expiration,
FFMPTemplates templates) {
float tvalue = 0.0f;
float value;
int i = 0;
if (interpolation.isInterpolate() == false) {
FFFGDataMgr dman = FFFGDataMgr.getInstance();
for (long pfaf: forcedPfafs) {
for (long pfaf : forcedPfafs) {
long countyFips = templates.getCountyFipsByPfaf(pfaf);
templates.getCountyFipsByPfaf(pfaf);
value = dman.adjustValue(Float.NaN, interpolation.getStandardSource(), pfaf,
countyFips);
value = dman.adjustValue(Float.NaN,
interpolation.getStandardSource(), pfaf, countyFips);
tvalue += value;
i++;
}
return tvalue/i;
return tvalue / i;
}
return Float.NaN;
}
@ -307,7 +309,8 @@ public class FFFGForceUtil {
}
/**
* @param sliderTime the sliderTime to set
* @param sliderTime
* the sliderTime to set
*/
public void setSliderTime(double sliderTime) {
this.sliderTime = sliderTime;

View file

@ -73,10 +73,12 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
* feb 20, 2013 1635 dhladky Fixed multi guidance displays
* Feb 28, 2013 1729 dhladky General enhancements for speed.
* Apr 12, 2013 1902 mpduff Code Cleanup.
* Apr 15, 2013 1890 dhladky Added another constant fix.
* Apr 15, 2013 1911 dhladky Fixed forced FFG for centered aggregates.
* Apr 24, 2013 1946 mpduff Fixed FFFG value for ALL when an aggregate is forced
* Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP.
* Apr 15, 2013 1890 dhladky Added another constant fix.
* Apr 15, 2013 1911 dhladky Fixed forced FFG for centered aggregates.
* Apr 24, 2013 1946 mpduff Fixed FFFG value for ALL when an aggregate is forced
* Apr 26, 2013 1954 bsteffen Minor code cleanup throughout FFMP.
* May 07, 2013 1986 njensen Removed unnecessary sort
* May 10, 2013 1919 mpduff Fixed problem with VGBs
*
* </pre>
*
@ -98,12 +100,10 @@ public class FFMPDataGenerator {
private final Date paintRefTime;
private final Object centeredAggregationKey;
private final String huc;
private final double sliderTime;
private boolean isWorstCase = false;
@ -305,7 +305,6 @@ public class FFMPDataGenerator {
}
}
}
tData.sortData();
}
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
@ -354,7 +353,6 @@ public class FFMPDataGenerator {
String lid = vgBasin.getLid();
if (lid != null) {
StringBuilder sb = new StringBuilder(lid);
// in this special case it is actually the LID
trd.setPfaf(lid);
@ -411,21 +409,18 @@ public class FFMPDataGenerator {
for (String guidType : guidBasins.keySet()) {
guidance = Float.NaN;
FFFGForceUtil forceUtil = forceUtils.get(guidType);
forceUtil.setSliderTime(sliderTime);
FFMPTableCellData guidCellData = getGuidanceCellData(
cBasin, domain, guidType, parentBasinPfaf);
if (guidCellData == null) {
guidCellData = new FFMPTableCellData(
FIELDS.GUIDANCE, Float.NaN);
} else {
guidance = guidCellData.getValueAsFloat();
// check for forcing even if no data are available
guidance = getForcedAvg(domain, cBasin, guidType);
}
trd.setTableCellData(i + 4, guidCellData);
float ratioValue = Float.NaN;
float diffValue = Float.NaN;
// If guidance is NaN then it cannot be > 0
if (!qpe.isNaN() && (guidance > 0.0f)) {
ratioValue = FFMPUtils.getRatioValue(qpe, guidance);
@ -435,7 +430,6 @@ public class FFMPDataGenerator {
FIELDS.RATIO, ratioValue));
trd.setTableCellData(i + 6, new FFMPTableCellData(
FIELDS.DIFF, diffValue));
i += 3;
}
} else {
@ -443,7 +437,6 @@ public class FFMPDataGenerator {
}
tData.addDataRow(trd);
}
} else {
displayName = getDisplayName(cBasin);
@ -499,15 +492,12 @@ public class FFMPDataGenerator {
guidance = Float.NaN;
FFFGForceUtil forceUtil = forceUtils.get(guidType);
forceUtil.setSliderTime(sliderTime);
FFMPTableCellData guidCellData = getGuidanceCellData(
cBasin, domain, guidType, cBasinPfaf);
if (guidCellData == null) {
// check for forcing even if no data are available
guidance = getForcedAvg(forceUtil, domain, cBasin,
guidType);
boolean forced = !guidance.isNaN();
guidCellData = new FFMPTableCellData(
FIELDS.GUIDANCE, guidance, forced);
guidance = getForcedAvg(domain, cBasin, guidType);
} else {
guidance = guidCellData.getValueAsFloat();
}
@ -556,6 +546,7 @@ public class FFMPDataGenerator {
boolean forced = false;
Float guidance = Float.NaN;
FFFGForceUtil forceUtil = forceUtils.get(guidType);
forceUtil.setSliderTime(sliderTime);
// If aggregate, get basins within the aggregate
if (cBasin.getAggregated()) {
@ -571,6 +562,9 @@ public class FFMPDataGenerator {
siteKey, domain, huc);
pfafList.add(ft.getAggregatedPfaf(cBasinPfaf, siteKey, huc));
}
} else {
pfafList = new ArrayList<Long>();
pfafList.add(cBasinPfaf);
}
if (FFFGDataMgr.getInstance().isForcingConfigured()) {
@ -583,16 +577,19 @@ public class FFMPDataGenerator {
forced = forceUtil.isForced();
}
if (!forcedPfafs.isEmpty() || !pfafList.isEmpty() && centeredAggregationKey == null) {
FFMPBasinData basinData = guidRecords.get(guidType).getBasinData(
ALL);
guidance = basinData.getAverageGuidanceValue(pfafList, resource
.getGuidanceInterpolators().get(guidType), guidance,
forcedPfafs, resource.getGuidSourceExpiration(guidType));
forced = !forcedPfafs.isEmpty();
if (!forcedPfafs.isEmpty() || forced || !pfafList.isEmpty()) {
// Recalculate guidance using the forced value(s)
guidance = guidRecords
.get(guidType)
.getBasinData(ALL)
.getAverageGuidanceValue(pfafList,
resource.getGuidanceInterpolators().get(guidType),
guidance, forcedPfafs,
resource.getGuidSourceExpiration(guidType));
} else {
guidance = resource.getGuidanceValue(ffmpGuidBasin, paintRefTime,
guidType);
if (guidance < 0.0f) {
guidance = Float.NaN;
}
@ -601,8 +598,9 @@ public class FFMPDataGenerator {
return new FFMPTableCellData(FIELDS.GUIDANCE, guidance, forced);
}
private float getForcedAvg(FFFGForceUtil forceUtil, String domain,
FFMPBasin cBasin, String guidType) {
private float getForcedAvg(String domain, FFMPBasin cBasin, String guidType) {
FFFGForceUtil forceUtil = forceUtils.get(guidType);
forceUtil.setSliderTime(sliderTime);
FFFGDataMgr fdm = FFFGDataMgr.getInstance();
List<Long> forcedPfafs;
List<Long> pfafList = new ArrayList<Long>();
@ -642,12 +640,6 @@ public class FFMPDataGenerator {
guidance = forceUtil.getAvgForcedValue(pfafList, forcedPfafs,
resource.getGuidanceInterpolators().get(guidType),
resource.getGuidSourceExpiration(guidType), ft);
// } else if (forcedPfafs.size() > 1) {
// guidance = forceUtil.getAvgForcedValue(pfafList,
// forcedPfafs,
// resource.getGuidanceInterpolators().get(guidType),
// resource.getGuidSourceExpiration(), ft);
// forced = true;
}
} else {
// TODO Calculate a max value
@ -1014,7 +1006,6 @@ public class FFMPDataGenerator {
monitor.setQpeWindow(new FFMPTimeWindow(tableTime, qpeTime));
if (isWorstCase || (centeredAggregationKey != null)) {
// make sure that "ALL" is loaded
localHuc = ALL;

View file

@ -44,6 +44,7 @@ import com.raytheon.uf.viz.core.localization.CAVELocalizationNotificationObserve
import com.raytheon.uf.viz.core.localization.LocalizationConstants;
import com.raytheon.uf.viz.core.localization.LocalizationInitializer;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob;
/**
*
@ -55,6 +56,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* ------------ ---------- ----------- --------------------------
* Sep 29, 2008 #1433 chammack Initial creation
* Jan 12, 2012 #27 rferrel Added createAlertVisualization
* May 08, 2013 1939 rjpeter Updated to start NotificationManagerJob.
* </pre>
*
* @author chammack
@ -128,6 +130,10 @@ public class AlertVizApplication implements IStandaloneComponent {
// Job is not running on port, launch UI.
AlertVisualization av = createAlertVisualization(true, display);
// open JMS connection to allow alerts to be received
NotificationManagerJob.connect();
Throwable t = null;
try {
while (!display.isDisposed()) {
@ -153,17 +159,18 @@ public class AlertVizApplication implements IStandaloneComponent {
display.dispose();
if (t != null) {
// Killed because of error, set exit status to non zero value
return IApplication.EXIT_RELAUNCH;
return IApplication.EXIT_RELAUNCH;
}
}
return av.getExitStatus();
}
protected AlertVisualization createAlertVisualization(
boolean runningStandalone, final Display display) {
return new AlertVisualization(runningStandalone, display);
boolean runningStandalone, final Display display) {
return new AlertVisualization(runningStandalone, display);
}
protected void initializeObservers() {
CAVELocalizationNotificationObserver.register();
}

View file

@ -30,6 +30,8 @@ import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
@ -43,6 +45,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.viz.ui.menus.widgets.tearoff.TearOffMenuDialog.MenuPathElement;
@ -57,6 +60,8 @@ import com.raytheon.uf.viz.ui.menus.widgets.tearoff.TearOffMenuDialog.MenuPathEl
* ------------ ---------- ----------- --------------------------
* Sep 15, 2011 mnash Initial creation
* Apr 10, 2013 DR 15185 D. Friedman Preserve tear-offs over perspective switches.
* Apr 30, 2013 DR 15727 D. Friedman Try to make items that depend on an active
* workbench window work correctly.
*
* </pre>
*
@ -378,7 +383,7 @@ public class MenuItemComposite extends Composite {
private MouseAdapter getMouseAdapter() {
MouseAdapter mouseAdapter = new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
public void mouseDown(final MouseEvent e) {
MenuItem item = getItem();
if (item.getMenu() != null) {
@ -394,73 +399,123 @@ public class MenuItemComposite extends Composite {
return;
}
// handle the selection event, so if it is able to load
// something, do it (by looping over ALL the selection
// listeners assigned to the item)
for (Listener list : item.getListeners(SWT.Selection)) {
Event event = new Event();
event.type = SWT.Selection;
event.widget = item;
list.handleEvent(event);
}
if (isDisposed()) {
return;
}
// handles the check boxes, if clicking the check box
// need to not do this (because SWT does it already)
// otherwise do it
if (firstItem instanceof Button
&& firstItem.getStyle() == SWT.CHECK) {
if (e.widget != firstItem) {
((Button) firstItem).setSelection(!((Button) firstItem)
.getSelection());
}
}
// Handle radio selection changing...
Control[] siblings = getParent().getChildren();
for (int i = 0; i < siblings.length; i++) {
final MenuItemComposite mic = (MenuItemComposite) siblings[i];
if (mic.separator == false
&& mic.getItem().getStyle() == SWT.RADIO) {
try {
MenuItemComposite parent = null;
// check whether a Label is clicked or a
// MenuItemComposite
if (e.widget instanceof MenuItemComposite) {
parent = (MenuItemComposite) e.widget;
} else {
parent = (MenuItemComposite) ((Control) e.widget)
.getParent();
}
// check that the radio groups match
if (mic.getData("radioGroup").equals(
parent.getData("radioGroup"))) {
if (!parent.getItem()
.getText()
.replaceAll("&", "")
.equals(mic.getItem().getText().replaceAll(
"&", ""))) {
mic.getItem().setSelection(false);
((Button) mic.firstItem)
.setSelection(false);
} else {
mic.getItem().setSelection(true);
((Button) mic.firstItem).setSelection(true);
}
}
} catch (NullPointerException e1) {
e1.printStackTrace();
/*
* Many menu items do not work unless there in an active
* workbench window.
*
* If not already active (and it probably will not be), make the
* shell of the original menu item active and finish selecting
* the item after receiving an activation event. Otherwise,
* finish selecting the item immediately.
*
* Also select immediately if the shell if not visible or is
* minimized because we cannot exepect to get an activation
* event.
*
* TODO: This is all still a kludge and could cause unexpected
* behavior.
*/
final Shell shell = item.getParent().getShell();
Display display = shell.getDisplay();
if (shell.isVisible() && !shell.getMinimized()
&& display.getActiveShell() != shell) {
shell.addShellListener(new ShellAdapter() {
@Override
public void shellActivated(ShellEvent e2) {
shell.removeShellListener(this);
selectItem(e);
}
}
@Override
public void shellDeiconified(ShellEvent e) {
shell.removeShellListener(this);
}
@Override
public void shellIconified(ShellEvent e) {
shell.removeShellListener(this);
}
@Override
public void shellClosed(ShellEvent e) {
shell.removeShellListener(this);
}
});
shell.setActive();
} else {
selectItem(e);
}
}
};
return mouseAdapter;
}
private void selectItem(MouseEvent e) {
MenuItem item = getItem();
// handle the selection event, so if it is able to load
// something, do it (by looping over ALL the selection
// listeners assigned to the item)
for (Listener list : item.getListeners(SWT.Selection)) {
Event event = new Event();
event.type = SWT.Selection;
event.widget = item;
list.handleEvent(event);
}
if (isDisposed()) {
return;
}
// handles the check boxes, if clicking the check box
// need to not do this (because SWT does it already)
// otherwise do it
if (firstItem instanceof Button
&& firstItem.getStyle() == SWT.CHECK) {
if (e.widget != firstItem) {
((Button) firstItem).setSelection(!((Button) firstItem)
.getSelection());
}
}
// Handle radio selection changing...
Control[] siblings = getParent().getChildren();
for (int i = 0; i < siblings.length; i++) {
final MenuItemComposite mic = (MenuItemComposite) siblings[i];
if (mic.separator == false
&& mic.getItem().getStyle() == SWT.RADIO) {
try {
MenuItemComposite parent = null;
// check whether a Label is clicked or a
// MenuItemComposite
if (e.widget instanceof MenuItemComposite) {
parent = (MenuItemComposite) e.widget;
} else {
parent = (MenuItemComposite) ((Control) e.widget)
.getParent();
}
// check that the radio groups match
if (mic.getData("radioGroup").equals(
parent.getData("radioGroup"))) {
if (!parent.getItem()
.getText()
.replaceAll("&", "")
.equals(mic.getItem().getText().replaceAll(
"&", ""))) {
mic.getItem().setSelection(false);
((Button) mic.firstItem)
.setSelection(false);
} else {
mic.getItem().setSelection(true);
((Button) mic.firstItem).setSelection(true);
}
}
} catch (NullPointerException e1) {
e1.printStackTrace();
}
}
}
}
@Override
public void dispose() {
if (arrow != null) {

View file

@ -27,6 +27,12 @@
capabilityClass="com.raytheon.viz.awipstools.capabilities.RangeRingsOverlayCapability"
name="Range Rings Capability"
sortID="2"/>
<contextualMenu
actionClass="com.raytheon.viz.awipstools.ui.action.VelocitySourceAction"
capabilityClass="com.raytheon.viz.awipstools.ui.layer.VRShearLayer"
name="Velocity Source"
sortID="601">
</contextualMenu>
</extension>
<extension
point="com.raytheon.viz.ui.contextualMenu">
@ -201,9 +207,6 @@
commandId="com.raytheon.viz.awipstools.arbitrary">
</handler>
</extension>
<extension point="com.raytheon.uf.viz.core.alterBundle">
<alterBundle class="com.raytheon.viz.awipstools.ToolsAlterBundleContributor"/>
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution

View file

@ -46,6 +46,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 10/08/2010 5953 bgonzale refactored EAV code out of layer class.
* 05/02/2013 DR 14587 D. Friedman Use base velocity.
*
* </pre>
*
@ -71,6 +72,10 @@ public class EstimatedActualVelocity {
public static final String EST_ACT_VEL_LOCATION = "Estimated Act Vel";
private static String NUMERIC_VALUE_KEY = "numericValue";
private static String BASE_VELOCITY_NUMERIC_VALUE_KEY = "baseVelocity-numericValue";
private List<EAVConfig> eavList = new ArrayList<EAVConfig>();
private int _dirForward;
@ -194,8 +199,12 @@ public class EstimatedActualVelocity {
&& (dataMap.get("Mnemonic").equals("V")
|| dataMap.get("Mnemonic").equals("HV") || dataMap
.get("Mnemonic").equals("SRM"))
&& dataMap.get("numericValue") != null) {
return Double.parseDouble((String) dataMap.get("numericValue"));
&& (dataMap.get(BASE_VELOCITY_NUMERIC_VALUE_KEY) != null ||
dataMap.get(NUMERIC_VALUE_KEY) != null)) {
String s = (String) dataMap.get(BASE_VELOCITY_NUMERIC_VALUE_KEY);
if (s == null)
s = (String) dataMap.get(NUMERIC_VALUE_KEY);
return Double.parseDouble(s);
}
}
return 0;

View file

@ -0,0 +1,16 @@
package com.raytheon.viz.awipstools.common;
/**
* Dynamic tag for radial velocity data sources for shear tools
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ------------ --------------------------
* 5/2/2013 DR 14587 D. Friedman Initial revision
*
* </pre>
*/
public interface IRadialVelocityToolSource {
boolean isRadialVelocitySource();
}

View file

@ -0,0 +1,123 @@
package com.raytheon.viz.awipstools.ui.action;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.viz.awipstools.ui.layer.VRShearLayer;
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
/**
* Displays a menu of resources that can be used with the VR Shear tool.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ------------ --------------------------
* 5/2/2013 DR 14587 D. Friedman Initial revision
*
* </pre>
*/
public class VelocitySourceAction extends AbstractRightClickAction implements IMenuCreator {
private Menu menu;
/**
* Default constructor.
*/
public VelocitySourceAction() {
super(Action.AS_DROP_DOWN_MENU);
setMenuCreator(this);
}
@Override
public IMenuCreator getMenuCreator() {
return this;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#getText()
*/
@Override
public String getText() {
return "Velocity Source";
}
@Override
public void dispose() {
if (menu != null) {
menu.dispose();
menu = null;
}
}
@Override
public Menu getMenu(Control parent) {
if (menu != null) {
menu.dispose();
}
menu = new Menu(parent);
fillMenu(menu, parent.getDisplay());
return menu;
}
@Override
public Menu getMenu(Menu parent) {
if (menu != null) {
menu.dispose();
}
menu = new Menu(parent);
fillMenu(menu, parent.getDisplay());
return menu;
}
public void fillMenu(Menu menu, Display d) {
VRShearLayer layer = getVRShearLayer();
if (layer != null) {
AbstractVizResource<?, ?> selectedResource = layer.getSelectedVelocitySource();
ActionContributionItem actionItem;
actionItem = new ActionContributionItem(
new SetVelocitySourceAction(null, selectedResource == null));
actionItem.fill(menu, -1);
for (AbstractVizResource<?, ?> resource : layer.getEligibleResources(false)) {
actionItem = new ActionContributionItem(
new SetVelocitySourceAction(resource, resource == selectedResource));
actionItem.fill(menu, -1);
}
}
}
private class SetVelocitySourceAction extends Action {
private AbstractVizResource<?, ?> resource;
public SetVelocitySourceAction(AbstractVizResource<?, ?> resource, boolean selected) {
super(resource != null ? resource.getName() : "(default)", Action.AS_RADIO_BUTTON);
setChecked(selected);
this.resource = resource;
}
@Override
public void run() {
VRShearLayer layer = getVRShearLayer();
if (layer != null) {
layer.setSelectedVelocitySource(resource);
}
}
}
private VRShearLayer getVRShearLayer() {
if (getSelectedRsc() instanceof VRShearLayer) {
return (VRShearLayer) getSelectedRsc();
} else {
return null;
}
}
}

View file

@ -66,6 +66,7 @@ import com.vividsolutions.jts.operation.buffer.BufferOp;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 15Mar2013 15693 mgamazaychikov Added magnification capability.
* 05/02/2013 DR 14587 D. Friedman Use base velocity.
*
* </pre>
*
@ -458,6 +459,10 @@ public class ShearLayer extends
}
protected static class VelocityRange {
private static String VALUE_KEY = "Value";
private static String BASE_VELOCITY_VALUE_KEY = "baseVelocity-Value";
Float lower;
Float upper;
@ -466,13 +471,16 @@ public class ShearLayer extends
public VelocityRange(Map<String, Object> map) {
if (map != null && map.containsKey("Mnemonic")
&& map.containsKey("Value")) {
&& (map.containsKey(BASE_VELOCITY_VALUE_KEY) ||
map.containsKey(VALUE_KEY))) {
String mnemonic = map.get("Mnemonic").toString();
if (mnemonic.equalsIgnoreCase("V")
|| mnemonic.equalsIgnoreCase("SRM")
|| mnemonic.equalsIgnoreCase("HV")) {
String s = map.get("Value").toString();
String s = map.get(BASE_VELOCITY_VALUE_KEY).toString();
if (s == null)
s = map.get(VALUE_KEY).toString();
if (s != null && !s.equalsIgnoreCase("NO DATA")) {
final String corePatternStr = "-?[0-9]+\\.[0-9]+";
final String symbolPatternStr = "[<>]";

View file

@ -19,7 +19,9 @@
**/
package com.raytheon.viz.awipstools.ui.layer;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.measure.converter.UnitConverter;
@ -35,10 +37,12 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
import com.raytheon.viz.awipstools.common.IRadialVelocityToolSource;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.LineString;
@ -59,6 +63,8 @@ import com.vividsolutions.jts.geom.LineString;
* counter-clockwise rotation. The order of the points will also
* no longer impact the sign that is displayed.
* 15Mar2013 15693 mgamazaychikov Added magnification capability.
* 02May2013 DR 14587 D. Friedman Correct calculation. Make source velocity data choice more
* explicit.
*
* </pre>
*
@ -71,6 +77,8 @@ public class VRShearLayer extends ShearLayer {
private static final int NUM_ANGLE_POINTERS = 7200;
private AbstractVizResource<?, ?> selectedVelocitySource;
/**
* @param data
* @param props
@ -90,17 +98,19 @@ public class VRShearLayer extends ShearLayer {
*/
@Override
public String getName() {
return VRSHEAR_LOCATION;
String name = VRSHEAR_LOCATION;
if (selectedVelocitySource != null)
name = name + makeLabel(selectedVelocitySource);
return name;
}
@Override
protected String calculateShearLabel(double length, Coordinate sCoor,
Coordinate eCoor, Coordinate midpointCoor) throws VizException {
ResourceList list = descriptor.getResourceList();
for (Iterator<ResourcePair> iter = list.iterator(); iter.hasNext();) {
ResourcePair rPair = iter.next();
AbstractVizResource<?, ?> rsc = rPair.getResource();
List<AbstractVizResource<?, ?>> potentialSources = getEligibleResources(false);
for (AbstractVizResource<?, ?> rsc : getVelocitySources()) {
Map<String, Object> mapS = (rsc)
.interrogate(new ReferencedCoordinate(sCoor));
Map<String, Object> mapE = (rsc)
@ -162,13 +172,17 @@ public class VRShearLayer extends ShearLayer {
long midpointRange = new Float(getRangeValue(mapMid))
.longValue();
String velocitySymbol = velS.pickSeparatorSymbol(velE);
double sec = (velocity / (length * 3600));
double sec = (velocity / (length * 1800));
return String.format("%1s%.1fkts %.1fnm %.4f/s dist:%2dnm",
velocitySymbol, velocity, length, sec, midpointRange);
boolean needLabel = selectedVelocitySource != null
|| potentialSources.size() > 1;
return String.format("%1s%.1fkts %.1fnm %.4f/s dist:%2dnm%s",
velocitySymbol, velocity, length, sec, midpointRange,
needLabel ? makeLabel(rsc) : "");
}
}
return "NO DATA";
return "NO DATA"
+ (selectedVelocitySource != null ? makeLabel(selectedVelocitySource) : "");
}
@Override
@ -203,4 +217,65 @@ public class VRShearLayer extends ShearLayer {
drawBaselineLabel(target, labelPoint, label);
return label;
}
public AbstractVizResource<?, ?> getSelectedVelocitySource() {
return selectedVelocitySource;
}
public void setSelectedVelocitySource(
AbstractVizResource<?, ?> selectedVelocitySource) {
this.selectedVelocitySource = selectedVelocitySource;
issueRefresh();
}
public List<AbstractVizResource<?, ?>> getEligibleResources(boolean forDefault) {
ArrayList<AbstractVizResource<?, ?>> list = new ArrayList<AbstractVizResource<?,?>>();
getEligibleResources1(getDescriptor().getResourceList(), forDefault, list);
Collections.reverse(list); // Topmost first, but TODO: shouldn't reverse combos...
return list;
}
public void getEligibleResources1(ResourceList resourceList, boolean forDefault,
List<AbstractVizResource<?, ?>> list) {
for (ResourcePair rp : resourceList) {
if (rp.getResource() instanceof IResourceGroup) {
getEligibleResources1(((IResourceGroup)rp.getResource()).getResourceList(), forDefault, list);
} else if (isEligibleResource(rp, forDefault)) {
list.add(rp.getResource());
}
}
}
private boolean isEligibleResource(ResourcePair rp, boolean forDefault) {
AbstractVizResource<?, ?> resource = rp.getResource();
return resource instanceof IRadialVelocityToolSource
&& ((IRadialVelocityToolSource) resource)
.isRadialVelocitySource() &&
(!forDefault || rp.getProperties().isVisible());
}
private List<AbstractVizResource<?, ?>> getVelocitySources() {
List<AbstractVizResource<?, ?>> list;
if (selectedVelocitySource != null) {
/* Note: This checks for DISPOSED, but not if the resource has
* somehow changed so that it no longer contains velocity data.
* This could happen for combo resources if we held references
* to the combo rather than the component resources.
*/
if (selectedVelocitySource.getStatus() != ResourceStatus.DISPOSED) {
list = new ArrayList<AbstractVizResource<?, ?>>(1);
list.add(selectedVelocitySource);
return list;
} else {
selectedVelocitySource = null;
}
}
list = getEligibleResources(true);
return list;
}
private String makeLabel(AbstractVizResource<?, ?> resource) {
return String.format(" (%s)", resource.getName());
}
}

View file

@ -79,6 +79,7 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
* 30 Jul 2010 6719 jnjanga Placed cursor at the end of inserted CTA
* 26 Sep 2012 15423 ryu Avoid resetting text when possible.
* 03 Dec 2012 15620 ryu Unlock framed cities list for editing.
* 30 APR 2013 16095 ryu Modified updateTextStyle() to not lock edited text.
*
* </pre>
*
@ -742,15 +743,12 @@ public class StyledTextComp extends Composite {
// .getStyleRangeAtOffset(event.start + event.length + 1);
// if it's in a framing code, turn it red
// or if it's in a locked section (because a programmatic text
// update was made), turn it blue
if (startRange != null
&& endRange != null
&& event.start > startRange.start
&& event.start + event.length < endRange.start
&& startRange.similarTo(endRange)
&& (startRange.foreground.equals(frameColor) || startRange.foreground
.equals(lockColor))) {
&& startRange.foreground.equals(frameColor)) {
StyleRange style = (StyleRange) startRange.clone();
style.start = event.start;
style.length = event.length;

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.viz.hydro.timeseries;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.QualifiedName;
@ -30,9 +27,8 @@ import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
/**
* The TimeSeriesDataJob Manager asynchronously retrieves
* Time Series Graph and Time Series Tabular Data via the
* Eclipse Job capability.
* The TimeSeriesDataJob Manager asynchronously retrieves Time Series Graph and
* Time Series Tabular Data via the Eclipse Job capability.
*
* <pre>
*
@ -40,7 +36,8 @@ import org.eclipse.core.runtime.jobs.Job;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 28, 2011 bkowal Initial creation
* Jan 28, 2011 bkowal Initial creation
* May 06, 2013 1976 mpduff Moved c.getDataForGraph() inside .runasync block
*
* </pre>
*
@ -71,11 +68,12 @@ public class TimeSeriesDataJobManager extends Job {
TimeSeriesDisplayCanvas tsDisplayCanvas = (TimeSeriesDisplayCanvas) this
.getProperty(new QualifiedName(null,
"TimeSeriesDisplayCanvas"));
tsDisplayCanvas.getDataForGraph();
final TimeSeriesDisplayCanvas c = tsDisplayCanvas;
tsDisplayCanvas.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
if(!c.isDisposed()) {
if (!c.isDisposed()) {
c.getDataForGraph();
c.redraw();
}
}

View file

@ -43,7 +43,6 @@ import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
@ -60,6 +59,9 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.shef.tables.Fcstheight;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.hydro.timeseries.graph.TimeSeriesGraphCanvas;
import com.raytheon.viz.hydro.timeseries.util.GraphData;
@ -133,19 +135,21 @@ import com.raytheon.viz.hydrocommon.util.DbUtils;
* 13 Nov 2012 15416 lbousaidi added a check when the colorname is null and a call to
* getGroupModeColor
* 09 Jan 2012 15493 lbousaidi added code to delete data while zooming when you draw a box
* 16 Jan 2013 15695 wkwock Fix popup menu
* 16 Jan 2013 15695 wkwock Fix popup menu
* 24 Apr 2013 1921 mpduff Fix zoom reset to only reset the "active" graph
* 06 May 2013 1976 mpduff Refactored Hydro time series data access.
* @author lvenable
* @version 1.0
*
*/
public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
IJobChangeListener {
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(TimeSeriesDisplayCanvas.class);
/** The maximum number of forecast traces. */
private static final int MAX_FCST_TRACES = 30;
private final String INCH = "in";
private final String FEET = "ft";
private final String CFS = "cfs";
@ -157,16 +161,6 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
*/
private final Composite parentComp;
/**
* Flag indicating that obs data are not available.
*/
private boolean noDataAvailable = true;
/**
* Flag indicating that forecast data are not available.
*/
private boolean noFcstDataAvailable = true;
/**
* No Data Available string.
*/
@ -199,7 +193,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
private Date maxDate = null;
/** List of visible traces */
private ArrayList<TraceData> traceArray = null;
private List<TraceData> traceArray = null;
/** Graph data object */
private GraphData graphData = null;
@ -338,11 +332,6 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
*/
private ArrayList<Boolean> validGraph;
/**
* Is the graph valid
*/
private boolean findGraph = false;
/**
* Show Latest Forecast flag.
*/
@ -352,11 +341,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
* record of the number of forecast traces and type source
*/
private int num_of_fcstTraces = 0;
private int num_of_fcstTs = 0;
private Boolean inDataRetreival = Boolean.FALSE;
private volatile boolean inDataRetreival;
private TimeSeriesDataJobManager tsDataJobManager = null;
@ -367,14 +352,18 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
/**
* Constructor.
*
* @param dialog
* Parent dialog
* @param parent
* Parent composite.
* @param lid
* Location Id
* @param pe
* Physical Element
* @param ts
* Type Source
* parent composite
* @param graphData
* Graph data object
* @param beginDate
* starting date
* @param endDate
* ending date
* @param groupMode
* groupMode
*/
public TimeSeriesDisplayCanvas(final TimeSeriesDisplayDlg dialog,
Composite parent, GraphData graphData, Date beginDate,
@ -388,21 +377,20 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
this.dialog = dialog;
this.tsDataJobManager = new TimeSeriesDataJobManager();
setDialog(dialog);
this.graphData.setBeginDate(beginDate);
this.graphData.setEndDate(endDate);
lineWidth = AppsDefaults.getInstance().getInt(
HydroConstants.TS_LINEWIDTH, 1);
crossHairCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_CROSS);
arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_ARROW);
northSouthCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_SIZENS);
handCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
crossHairCursor = parent.getDisplay().getSystemCursor(SWT.CURSOR_CROSS);
northSouthCursor = parent.getDisplay().getSystemCursor(
SWT.CURSOR_SIZENS);
handCursor = parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND);
newRequest = true;
parentComp = parent;
tsCanvas = this;
white = parentComp.getDisplay().getSystemColor(SWT.COLOR_WHITE);
black = parentComp.getDisplay().getSystemColor(SWT.COLOR_BLACK);
dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
setRatingCurveExist(false);
@ -413,7 +401,6 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
@Override
public void handleEvent(Event e) {
// Set true so new regions will be created as graph is resized
createRegions = true;
resizeGraph(parentShell.getClientArea());
redraw();
@ -447,7 +434,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
private void scheduleDataRetrieval() {
inDataRetreival = Boolean.TRUE;
inDataRetreival = true;
tsDataJobManager.scheduleGetGraphData(this, this);
}
@ -483,7 +470,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
drawCanvas(e.gc);
}
} catch (Exception ex) {
ex.printStackTrace();
statusHandler.handle(Priority.WARN,
"Problem Painting Graph", ex);
}
}
});
@ -526,46 +514,25 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
this.resizeGraph(bounds);
}
/**
* Get the data for the lid and pe values passed in. If the graphData object
* is null, get data from IHFS else reuse the data
*/
public void getDataForGraph() {
try {
/*
* Get the data for the lid and pe values passed in. If the
* graphData object is null, get data from IHFS else reuse the data
*/
int start_num = 0;
int end_num = 0;
validGraph = new ArrayList<Boolean>();
for (int d = 0; d < 100; d++)
validGraph.add(false);
ArrayList<TraceData> traceList = graphData.getOriginalTraces();
if (traceList.isEmpty()) {
if (groupMode && latestFcstFlag && (num_of_fcstTraces != 0)) {
for (int g = 0; g < graphData.getNumTraces()
- (num_of_fcstTraces - num_of_fcstTs); g++) {
traceList.add(graphData.getTraceData(g));
}
} else
traceList = graphData.getTraces();
}
graphData.setTraces(traceList);
// Clone the list here because we are adding to it in the
// getFcstData
@SuppressWarnings("unchecked")
ArrayList<TraceData> clonedList = (ArrayList<TraceData>) traceList
.clone();
start_num = clonedList.size();
num_of_fcstTraces = 0;
num_of_fcstTs = 0;
HashSet<String> uniqueList = new HashSet<String>();
List<TraceData> traceList = graphData.getOriginalTraces();
graphData.setTraces(new ArrayList<TraceData>());
for (int i = 0; i < clonedList.size(); i++) {
if (clonedList.get(i).isForecast()) {
TraceData td = clonedList.get(i);
HashSet<String> uniqueList = new HashSet<String>();
// Make a copy of the list so we can add to the original while
// iterating over it
List<TraceData> iterList = new ArrayList<TraceData>();
for (TraceData td : traceList) {
iterList.add(td);
}
for (TraceData td : iterList) {
if (td.isForecast()) {
String traceKey = td.getLid() + td.getPe() + td.getTs()
+ td.getDur() + td.getExtremum();
if (uniqueList.contains(traceKey))
@ -574,37 +541,15 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
uniqueList.add(traceKey);
}
int return_fcst_num = getFcstData(clonedList.get(i));
if (groupMode && !latestFcstFlag && (return_fcst_num > 1)) {
num_of_fcstTraces = num_of_fcstTraces + return_fcst_num;
num_of_fcstTs++;
}
validGraph.set(i, noFcstDataAvailable);
if (return_fcst_num > 1) {
end_num = start_num + (return_fcst_num - 1);
for (int k = start_num; k < end_num; k++) {
validGraph.set(k, noFcstDataAvailable);
}
start_num = end_num;
}
getFcstData(td);
} else {
graphData.addTrace(clonedList.get(i));
getData(clonedList.get(i));
validGraph.set(i, noDataAvailable);
getData(td);
graphData.addTrace(td);
}
}
graphData.setBeginDate(beginDate);
graphData.setEndDate(endDate);
} finally {
inDataRetreival = Boolean.FALSE;
inDataRetreival = false;
}
// newRequest = false;
// getAgain = false;
}
/**
@ -616,7 +561,9 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
protected void drawCanvas(GC gc) {
gc.setFont(canvasFont);
fontHeight = (gc.getFontMetrics().getHeight());
if (fontHeight == -999) {
fontHeight = (gc.getFontMetrics().getHeight());
}
int fontAveWidth = gc.getFontMetrics().getAverageCharWidth();
int swtColor = SWT.COLOR_BLACK;
if (this.dialog.isInverseVideo()) {
@ -683,8 +630,6 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
/* Data Access Manager */
TimeSeriesDataManager dataManager = TimeSeriesDataManager.getInstance();
// TimeSeriesDataManager dataManagerStn = TimeSeriesDataManager
// .getInstance();
try {
String[] sa = dataManager.getStnRiverName(lid);
if ((sa != null) && (sa[0] != null) && (sa[1] != null)) {
@ -704,8 +649,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
siteLabel = lid;
}
} catch (VizException e) {
// TODO Auto-generated catch block
e.printStackTrace();
statusHandler.handle(Priority.ERROR,
"Error retrieving river names", e);
}
/* Find the flood stage */
@ -720,15 +665,14 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
/* Get the data traces */
traceArray = graphData.getTraces();
traceArray.trimToSize();
/* find valid graph with data or not */
findGraph = false;
for (int j = 0; j < traceArray.size(); j++) {
if ((validGraph != null) && !validGraph.get(j)) {
findGraph = true;
/* Is there data for the graph */
boolean hasData = false;
for (TraceData td : traceArray) {
if (td.getTsData() != null && td.getTsData().length > 0) {
hasData = true;
break;
}
}
@ -736,7 +680,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
/*
* If no data are available then draw no data available information.
*/
if (!findGraph) {
if (!hasData) {
setForegroundColor(gc, SWT.COLOR_WHITE);
// Draws a white border around the graph area
int[] points = { GRAPHBORDER, GRAPHBORDER,
@ -751,7 +695,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
int tmpY = canvasHeight / 2;
if (this.dialog.isInverseVideo()) {
gc.setBackground(this.white);
gc.setBackground(parentComp.getDisplay().getSystemColor(
SWT.COLOR_WHITE));
}
gc.drawString(NO_DATA_AVAILABLE, tmpX, tmpY);
gc.drawString(siteLabel + " fs=" + floodStage, GRAPHBORDER - 15,
@ -767,7 +712,6 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
/* Get the data traces */
traceArray = graphData.getTraces();
traceArray.trimToSize();
setForegroundColor(gc, SWT.COLOR_CYAN);
if (pointString != null) {
@ -776,7 +720,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
if (this.dialog.isInverseVideo()) {
gc.setBackground(this.white);
gc.setBackground(parentComp.getDisplay().getSystemColor(
SWT.COLOR_WHITE));
}
gc.drawString(siteLabel + " fs=" + floodStage,
GRAPHBORDER_LEFT - 10, GRAPHBORDER - fontHeight * 2);
@ -784,22 +729,16 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
int index = GRAPHBORDER_LEFT - 10;
// If labels run off the right of the canvas then need to stack them
boolean stackLabels = false;
// This should start at 2 because the first stack will be above a
// line
int stackCount = 2;
int stackCount = 2; // This should start as 2 because the first
// stack will be above a line
int labelStartX = 0;
int labelStartY = 0;
// store the label to be plotted on the gc legend later
ArrayList noDataLabels = new ArrayList<String>();
List<String> noDataLabels = new ArrayList<String>();
for (int j = 0; j < traceArray.size(); j++) {
TraceData td = traceArray.get(j);
boolean traceValid = true;
if (validGraph.get(j)) {
traceValid = false;
}
if (td.getPe().equalsIgnoreCase(HydroConstants.PP)) {
/*
@ -879,7 +818,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
}
} catch (Exception ex) {
ex.printStackTrace();
statusHandler.handle(Priority.ERROR,
"Error deriving PP", ex);
}
}
@ -972,8 +912,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
try {
labelString = dataManager.getShefPE(pe);
} catch (VizException ve) {
ve.printStackTrace();
// TODO Log error here
statusHandler.handle(Priority.ERROR,
"Error retrieving SHEF PE data", ve);
}
}
@ -1109,7 +1049,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
// draw no data legends
setForegroundColor(gc, SWT.COLOR_WHITE);
for (int i = 0; i < noDataLabels.size(); i++) {
String labelString = (String) noDataLabels.get(i);
String labelString = noDataLabels.get(i);
if (stackLabels
|| ((labelString.length() * fontAveWidth) + 50 + index > canvasWidth)) {
int[] xy = getLabelLocation(index, labelString, stackCount);
@ -1506,14 +1446,13 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
pointsbak.add(pbak);
}
}
noDataAvailable = false;
} else {
noDataAvailable = true;
}
} catch (VizException e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Error retrieving graph data",
e);
} catch (ClassNotFoundException e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Error retrieving graph data",
e);
}
td.setTsData(points.toArray(new TimeSeriesPoint[points.size()]));
@ -1595,7 +1534,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
String units = FEET;
boolean isRiverData = true;
boolean isStage = true;
ArrayList<TraceData> traces = graphData.getTraces();
List<TraceData> traces = graphData.getTraces();
for (TraceData trace : traces) {
if (!trace.getPe().toUpperCase().startsWith("H")
&& !trace.getPe().toUpperCase().startsWith("Q")) {
@ -1690,7 +1629,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
break;
} else {
pointSelected = false;
setCursor(arrowCursor);
setCursor(null);
}
}
} else {
@ -1701,7 +1640,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
break;
} else {
pointSelected = false;
setCursor(arrowCursor);
setCursor(null);
}
}
}
@ -1722,7 +1661,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
break;
} else {
pointSelected = false;
setCursor(arrowCursor);
setCursor(null);
}
}
} else {
@ -1733,7 +1672,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
break;
} else {
pointSelected = false;
setCursor(arrowCursor);
setCursor(null);
}
}
}
@ -1755,7 +1694,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
break;
} else {
pointSelected = false;
setCursor(arrowCursor);
setCursor(null);
}
}
} else {
@ -1766,7 +1705,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
break;
} else {
pointSelected = false;
setCursor(arrowCursor);
setCursor(null);
}
}
}
@ -1837,7 +1776,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
selectedTraceId = i;
break;
} else {
setCursor(arrowCursor);
setCursor(null);
selectableTrace = false;
}
}
@ -1848,7 +1787,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
selectableTrace = true;
selectedTraceId = traceId;
} else {
setCursor(arrowCursor);
setCursor(null);
selectableTrace = false;
}
}
@ -1861,15 +1800,15 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
/**
*
* @param x
* location x (of mouse pointer)
* : location x (of mouse pointer)
* @param y
* location y (of mouse pointer)
* : location y (of mouse pointer)
* @return the nearest trace. -999 if x,y is too far away
*/
private int findTracePoint(int x, int y) {
double distance = Double.MAX_VALUE;
int choosingTrace = -999;
ArrayList<TraceData> traceList = graphData.getTraces();
List<TraceData> traceList = graphData.getTraces();
// this loop is to find the closest point/line for every trace that's on
int closePoints[] = new int[traceList.size()];
@ -1889,12 +1828,13 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
y2 = dataPts[i + 3];
}
double curDistance = Double.MAX_VALUE;
if (x1 == x2 && y1 == y2) // distance from a point
// distance from a point
if (x1 == x2 && y1 == y2) {
curDistance = Math.sqrt(Math.pow(x - x1, 2)
+ Math.pow(y - y1, 2));
else {// distance from a line segment
// from
// http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment
} else {
// distance from a line segment from
// http://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment
double p2X = x2 - x1;
double p2Y = y2 - y1;
@ -2170,12 +2110,11 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
/* Get the data traces */
traceArray = graphData.getTraces();
traceArray.trimToSize();
// Set true so new regions will be created
createRegions = true;
setCursor(arrowCursor);
setCursor(null);
redraw();
}
@ -2187,12 +2126,11 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
setZoomed(false);
dialog.setZoomAction(false);
traceArray = graphData.getTraces();
traceArray.trimToSize();
// Set true so new regions will be created
createRegions = true;
setCursor(arrowCursor);
setCursor(null);
redraw();
return;
@ -2235,7 +2173,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
* @param dataPts
* the points that make up the lines
*/
private void makeRegions(ArrayList<TraceData> traceList) {
private void makeRegions(List<TraceData> traceList) {
if (createRegions == true) {
/* Dispose of the previous regions */
for (Region r : regionList) {
@ -2466,7 +2404,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
*/
private void setForegroundColor(TraceData td, int traceIndex, GC gc) {
if (dialog.isInverseVideo()) {
gc.setForeground(black);
gc.setForeground(parentComp.getDisplay().getSystemColor(
SWT.COLOR_BLACK));
} else {
if (traceSelected && (selectedTraceId == traceIndex)
&& !dialog.isCancel()) { // if in edit mode
@ -2503,7 +2442,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
*/
private void setBackgroundColor(TraceData td, int traceIndex, GC gc) {
if (dialog.isInverseVideo()) {
gc.setBackground(black);
gc.setBackground(parentComp.getDisplay().getSystemColor(
SWT.COLOR_BLACK));
} else {
if (traceSelected && (selectedTraceId == traceIndex)
&& !dialog.isCancel()) { // if in edit mode
@ -2605,34 +2545,41 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
if (basisTime.getTime() != prevBasisTime.getTime()) {
if (ntraces < MAX_FCST_TRACES) {
traceData.setXmin(beginDate);
traceData.setXmax(endDate);
n = 0; /* Reset npts in new forecast trace */
traceData.setBasistime(prevBasisTime);
ntraces++;
traceData.setTsData(points
.toArray(new TimeSeriesPoint[points
.size()]));
points = new ArrayList<TimeSeriesPoint>();
if (!this.latestFcstFlag) {
if (ntraces < MAX_FCST_TRACES) {
traceData.setXmin(beginDate);
traceData.setXmax(endDate);
n = 0; /* Reset npts in new forecast trace */
traceData.setBasistime(prevBasisTime);
ntraces++;
traceData.setTsData(points
.toArray(new TimeSeriesPoint[points
.size()]));
points = new ArrayList<TimeSeriesPoint>();
if (ntraces >= 1) {
traceDataList.add(traceData);
if (ntraces >= 1) {
traceDataList.add(traceData);
}
traceData = new TraceData();
traceData.setForecast(true);
traceData.setDur(dur);
traceData.setExtremum(extremum);
traceData.setLid(lid);
traceData.setPe(pe);
traceData.setTs(ts);
traceData.setName(name);
traceData.setBasistime(basisTime);
traceData.setProductTime(productTime);
traceData.setTraceOn(!this.latestFcstFlag);
} else {
/*
* reached max fcst traces, break out of
* loop
*/
break;
}
traceData = new TraceData();
traceData.setForecast(true);
traceData.setDur(dur);
traceData.setExtremum(extremum);
traceData.setLid(lid);
traceData.setPe(pe);
traceData.setTs(ts);
traceData.setName(name);
traceData.setBasistime(basisTime);
traceData.setProductTime(productTime);
traceData.setTraceOn(!this.latestFcstFlag);
} else {
/* reached max fcst traces, break out of loop */
break;
}
}
@ -2687,13 +2634,12 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
traceDataList.add(traceData);
ntraces++;
}
noFcstDataAvailable = false;
} else {
noFcstDataAvailable = true;
traceDataList.add(traceData);// although nothing from DB
}
} catch (VizException e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Error retrieving graph data",
e);
}
traceData.setTsData(points.toArray(new TimeSeriesPoint[points.size()]));
@ -2780,7 +2726,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
*
* @return The trace list
*/
private ArrayList<TraceData> getTraceList() {
private List<TraceData> getTraceList() {
return traceArray;
}
@ -2826,7 +2772,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
try {
redraw();
} catch (Exception e) {
e.printStackTrace();
statusHandler.handle(Priority.ERROR, "Error drawing graph",
e);
}
}
});
@ -2847,7 +2794,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
/**
* @return the traceArray
*/
public ArrayList<TraceData> getTraceArray() {
public List<TraceData> getTraceArray() {
return traceArray;
}
@ -2858,4 +2805,5 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
public void setZoomed(boolean zoomed) {
this.zoomed = zoomed;
}
}

View file

@ -120,6 +120,7 @@ import com.raytheon.viz.hydrocommon.util.StnClassSyncUtil;
* despite start up in CAVE or standalone.
* 30 Jan 2013 15264 wkwock Fix the missing group_definition.cfg file crash
* 05 Feb 2013 1578 rferrel Dialog made non-blocking and a singleton.
* 06 May 2013 1976 mpduff Code cleanup.
* </pre>
*
* @author lvenable
@ -127,7 +128,7 @@ import com.raytheon.viz.hydrocommon.util.StnClassSyncUtil;
*
*/
public class TimeSeriesDlg extends CaveHydroSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(TimeSeriesDlg.class);
/* Constants */
@ -441,27 +442,18 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
private LIDData currLidData = new LIDData();
/** List of GroupInfo objects */
private ArrayList<GroupInfo> groupList = new ArrayList<GroupInfo>();
/** Holds the Group Information */
private GroupInfo groupInfo;
private final ArrayList<GroupInfo> groupList = new ArrayList<GroupInfo>();
/** Holds the last graphed GroupInfo object */
private GroupInfo prevGroupInfo;
/** Holds the page information */
private PageInfo pageInfo = null;
/** Holds the graph information */
private GraphData graphData = null;
private String groupConfigFilePath = null;
private ArrayList<SiteInfo> siteInfoList = new ArrayList<SiteInfo>();
private final ArrayList<SiteInfo> siteInfoList = new ArrayList<SiteInfo>();
private ArrayList<TabInfo> tabInfoList = new ArrayList<TabInfo>();
private final ArrayList<TabInfo> tabInfoList = new ArrayList<TabInfo>();
private HydroDisplayManager displayManager;
private final HydroDisplayManager displayManager;
private boolean openTimeSeriesDisplays = false;
@ -662,7 +654,7 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
font = new Font(shell.getDisplay(), "Monospace", 11, SWT.NORMAL);
// Initialize all of the controls and layoutsendCal
// Initialize all of the controls
initializeComponents();
setCurrentData();
}
@ -1097,7 +1089,6 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
public void keyReleased(KeyEvent event) {
String search = searchTF.getText();
if (!search.equals("") && !search.equals(" ")) {
/* Iterate over the location Ids in the list */
ListIterator<String> iter = lidList.listIterator();
while (iter.hasNext()) {
@ -1119,10 +1110,8 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
}
}
}
} else {
// topDataList.setSelection(0); // Commented to more closely
// match legacy app
}
if (topDataList.getSelectionIndex() > 0) {
populateBottomList(
lidList.get(topDataList.getSelectionIndex()),
@ -1276,6 +1265,7 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
bottomDataList.setLayoutData(gd);
bottomDataList.setFont(font);
bottomDataList.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event e) {
correctSelections();
}
@ -1532,7 +1522,6 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
si.setTs((String) row[2]);
si.setExt((String) row[3]);
si.setDur((Integer) row[4]);
// siteInfoList.add(si);
if (si.getPe().startsWith("H")) {
if (!si.getPe().equals(prevPE)) {
@ -1617,6 +1606,14 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
} else {
this.populateGroupListForStandalone();
}
for (GroupInfo gi : this.groupList) {
for (PageInfo pi : gi.getPageInfoList()) {
for (GraphData gd : pi.getGraphDataList()) {
gd.saveTraceInfo();
}
}
}
}
/**
@ -1644,7 +1641,6 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
groupDataList.removeAll();
if (this.groupConfigFilePath != null) {
this.readGroupList();
}
}
@ -1653,6 +1649,10 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
* Read the Group List file.
*/
private void readGroupList() {
GroupInfo groupInfo = null;
PageInfo pageInfo = null;
GraphData graphData = null;
try {
BufferedReader in = new BufferedReader(new FileReader(
groupConfigFilePath));
@ -1664,7 +1664,148 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
if (str.trim().equals("")) {
continue;
}
processGroupData(str);
boolean showpp_flag = false;
// Remove any leading whitespace
String line = str.replaceAll("^\\s+", "");
if (line.startsWith(GROUP)) {
groupInfo = new GroupInfo();
groupInfo.setGroupSelected(true);
groupList.add(groupInfo);
}
String[] parts = line.split(":");
if (parts[0].equals(GROUP)) {
String[] pairs = parts[1].split(",");
for (String s : pairs) {
String[] values = s.split("=", 2);
// make sure we have values to go with the key
if (values.length > 1) {
if ((values[0] != null)
&& values[0].equalsIgnoreCase(NAME)) {
if (values[1] != null)
groupInfo.setGroupName(values[1]);
groupDataList.add(groupInfo.getGroupName());
} else if (values[0].equalsIgnoreCase(DESCRIPT)) {
groupInfo.setDescription(values[1]);
} else if (values[0].equalsIgnoreCase(GRID)) {
if (values[1].equalsIgnoreCase("T")) {
groupInfo.setGridLines(true);
} else {
groupInfo.setGridLines(false);
}
} else if (values[0].equalsIgnoreCase(TRACEMODE)) {
groupInfo.setTraceMode(values[1]);
} else if (values[0].equalsIgnoreCase(PASTHOURS)) {
groupInfo.setPastHours(Integer
.parseInt(values[1]));
} else if (values[0].equalsIgnoreCase(FUTUREHOURS)) {
groupInfo.setFutureHours(Integer
.parseInt(values[1]));
} else {
statusHandler.warn("Invalid key/value pair: "
+ s);
}
}
}
} else if (parts[0].equals(PAGE)) {
String[] values = parts[1].split("=", 2);
if (values.length > 1) {
pageInfo = new PageInfo();
pageInfo.setTitle(values[1]);
groupInfo.addPageInfo(pageInfo);
}
} else if (parts[0].equals(GRAPH)) {
graphData = new GraphData();
String[] pairs = parts[1].split(",");
for (String s : pairs) {
String[] values = s.split("=", 2);
if (values.length > 1) {
if (values[0].equalsIgnoreCase(POS)) {
graphData.setGraph_pos(Integer
.parseInt(values[1]));
} else if (values[0].equalsIgnoreCase(XSIZE)) {
graphData.setXsize(Integer.parseInt(values[1]));
} else if (values[0].equalsIgnoreCase(YSIZE)) {
graphData.setYsize(Integer.parseInt(values[1]));
} else if (values[0].equalsIgnoreCase(YLINEAR)) {
graphData.setYlinear(values[1]);
} else if (values[0].equalsIgnoreCase(YSCALE)) {
graphData.setYscale(values[1]);
} else if (values[0].equalsIgnoreCase(SHOWCAT)) {
if (values[1].equalsIgnoreCase("T")) {
graphData.setShowcat(true);
} else {
graphData.setShowcat(false);
}
} else if (values[0].equalsIgnoreCase(DERIVEPP)) {
graphData.setDerivepp(values[1]);
} else if (values[0].equalsIgnoreCase(SHOWPP)) {
if (values[1].equalsIgnoreCase("T")) {
showpp_flag = true;
} else {
showpp_flag = false;
}
} else if (values[0]
.equalsIgnoreCase(LATESTFCSTONLY)) {
if (values[1].equalsIgnoreCase("T")) {
graphData.setLatestfcstonly(true);
} else {
graphData.setLatestfcstonly(false);
}
} else {
statusHandler.warn("Invalid key/value pair: "
+ s);
}
}
}
// handle the case where there isn't a page element when
// there should be
if (pageInfo == null) {
pageInfo = new PageInfo();
groupInfo.addPageInfo(pageInfo);
}
pageInfo.addGraphData(graphData);
} else if (parts[0].equals(TRACE)) {
TraceData td = new TraceData();
String[] pairs = parts[1].split(",");
for (String s : pairs) {
String[] values = s.split("=", 2);
if (values.length > 1) {
if (values[0].equalsIgnoreCase(STN)) {
td.setLid(values[1]);
} else if (values[0]
.equalsIgnoreCase(HydroConstants.PC)) {
td.setPc(values[1]);
if (showpp_flag == true)
graphData.setShowpp(true);
else
graphData.setShowpp(false);
} else if (values[0].equalsIgnoreCase(COLOR)) {
td.setColorName(values[1]);
}
}
}
graphData.addTrace(td);
graphData.setBeginDate(beginDate);
graphData.setEndDate(endDate);
} else {
statusHandler
.warn("Error in Group Definition Config file: "
+ line);
}
// select the first item in the list
if (groupDataList.getItemCount() > 0) {
groupDataList.select(0);
}
}
in.close();
} catch (IOException e) {
@ -1831,7 +1972,7 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
}
}
// Reset the siteInfoList selections
// Reset the selections
int selectedIndex = bottomDataList.getSelectionIndex();
for (int i = 0; i < siteInfoList.size(); i++) {
@ -1893,144 +2034,6 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
timeSeriesDisplayDlg.getShell().moveAbove(this.shell);
}
/**
* Process the lines in the group config file.
*
* @param line
*/
private void processGroupData(String line) {
Boolean showpp_flag = false;
// Remove any leading whitespace
line = line.replaceAll("^\\s+", "");
if (line.startsWith(GROUP)) {
groupInfo = new GroupInfo();
groupInfo.setGroupSelected(true);
groupList.add(groupInfo);
}
String[] parts = line.split(":");
if (parts[0].equals(GROUP)) {
String[] pairs = parts[1].split(",");
for (String s : pairs) {
String[] values = s.split("=", 2);
// make sure we have values to go with the key
if (values.length > 1) {
if ((values[0] != null) && values[0].equalsIgnoreCase(NAME)) {
if (values[1] != null)
groupInfo.setGroupName(values[1]);
groupDataList.add(groupInfo.getGroupName());
} else if (values[0].equalsIgnoreCase(DESCRIPT)) {
groupInfo.setDescription(values[1]);
} else if (values[0].equalsIgnoreCase(GRID)) {
if (values[1].equalsIgnoreCase("T")) {
groupInfo.setGridLines(true);
} else {
groupInfo.setGridLines(false);
}
} else if (values[0].equalsIgnoreCase(TRACEMODE)) {
groupInfo.setTraceMode(values[1]);
} else if (values[0].equalsIgnoreCase(PASTHOURS)) {
groupInfo.setPastHours(Integer.parseInt(values[1]));
} else if (values[0].equalsIgnoreCase(FUTUREHOURS)) {
groupInfo.setFutureHours(Integer.parseInt(values[1]));
} else {
statusHandler.warn("Invalid key/value pair: " + s);
}
}
}
} else if (parts[0].equals(PAGE)) {
String[] values = parts[1].split("=", 2);
if (values.length > 1) {
pageInfo = new PageInfo();
pageInfo.setTitle(values[1]);
groupInfo.addPageInfo(pageInfo);
}
} else if (parts[0].equals(GRAPH)) {
graphData = new GraphData();
String[] pairs = parts[1].split(",");
for (String s : pairs) {
String[] values = s.split("=", 2);
if (values.length > 1) {
if (values[0].equalsIgnoreCase(POS)) {
graphData.setGraph_pos(Integer.parseInt(values[1]));
} else if (values[0].equalsIgnoreCase(XSIZE)) {
graphData.setXsize(Integer.parseInt(values[1]));
} else if (values[0].equalsIgnoreCase(YSIZE)) {
graphData.setYsize(Integer.parseInt(values[1]));
} else if (values[0].equalsIgnoreCase(YLINEAR)) {
graphData.setYlinear(values[1]);
} else if (values[0].equalsIgnoreCase(YSCALE)) {
graphData.setYscale(values[1]);
} else if (values[0].equalsIgnoreCase(SHOWCAT)) {
if (values[1].equalsIgnoreCase("T")) {
graphData.setShowcat(true);
} else {
graphData.setShowcat(false);
}
} else if (values[0].equalsIgnoreCase(DERIVEPP)) {
graphData.setDerivepp(values[1]);
} else if (values[0].equalsIgnoreCase(SHOWPP)) {
if (values[1].equalsIgnoreCase("T")) {
showpp_flag = true;
} else {
showpp_flag = false;
}
} else if (values[0].equalsIgnoreCase(LATESTFCSTONLY)) {
if (values[1].equalsIgnoreCase("T")) {
graphData.setLatestfcstonly(true);
} else {
graphData.setLatestfcstonly(false);
}
} else {
statusHandler.warn("Invalid key/value pair: " + s);
}
}
}
// handle the case where there isn't a page element when
// there should be
if (pageInfo == null) {
pageInfo = new PageInfo();
}
pageInfo.addGraphData(graphData);
} else if (parts[0].equals(TRACE)) {
TraceData td = new TraceData();
String[] pairs = parts[1].split(",");
for (String s : pairs) {
String[] values = s.split("=", 2);
if (values.length > 1) {
if (values[0].equalsIgnoreCase(STN)) {
td.setLid(values[1]);
} else if (values[0].equalsIgnoreCase(HydroConstants.PC)) {
td.setPc(values[1]);
if (showpp_flag == true)
graphData.setShowpp(true);
else
graphData.setShowpp(false);
} else if (values[0].equalsIgnoreCase(COLOR)) {
td.setColorName(values[1]);
}
}
}
graphData.addTrace(td);
graphData.setBeginDate(beginDate);
graphData.setEndDate(endDate);
} else {
statusHandler
.warn("Error in Group Definition Config file: " + line);
}
// select the first item in the list
if (groupDataList.getItemCount() > 0) {
groupDataList.select(0);
}
}
/**
* Handle Table option when selected on the Time Series Control Dialog
*/
@ -2062,7 +2065,7 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
/* Set up the GraphData objects */
if (modeCbo.getText().equals(STATION_SELECTION)) {
groupInfo = new GroupInfo();
GroupInfo groupInfo = new GroupInfo();
groupInfo.setCurrentPage(0);
/* Get the data from the station list */
@ -2096,7 +2099,8 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
} else {
/* Set the group info object */
groupInfo = groupList.get(groupDataList.getSelectionIndex());
GroupInfo groupInfo = groupList.get(groupDataList
.getSelectionIndex());
tabularDlg.setGroupInfo(groupInfo);
for (PageInfo pi : groupInfo.getPageInfoList()) {
@ -2151,7 +2155,7 @@ public class TimeSeriesDlg extends CaveHydroSWTDialog {
/* Set up the GraphData objects */
if (modeCbo.getText().equals(STATION_SELECTION)) {
int numberGraphs = 1;
groupInfo = new GroupInfo();
GroupInfo groupInfo = new GroupInfo();
groupInfo.setCurrentPage(0);
/* Get the data from the station list */

View file

@ -21,6 +21,7 @@ package com.raytheon.viz.hydro.timeseries.util;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.raytheon.viz.hydrocommon.HydroConstants;
@ -28,62 +29,68 @@ import com.raytheon.viz.hydrocommon.HydroConstants;
* Object to hold the data and metadata for the time series.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 24, 2008 mpduff Initial creation
* Jun 24, 2008 mpduff Initial creation.
* May 06, 2013 1976 mpduff Use List interface.
*
* </pre>
*
*
* @author mpduff
* @version 1.0
* @version 1.0
*/
public class GraphData {
public class GraphData {
private double x;
/**
* yMax - yMin
*/
private double y;
private double y2;
/**
* Graph Area Width
*/
private int w;
/**
* Graph Area Height
*/
private int h;
private boolean displayFlowUnit;
private Date xMin;
private Date xMax;
private double ymin = Integer.MAX_VALUE;
private double ymax = Integer.MIN_VALUE;
private double ymin2;
private double ymax2;
/**
* List of traces for graphing
*/
private ArrayList<TraceData> traces = new ArrayList<TraceData>();
private List<TraceData> traces = new ArrayList<TraceData>();
/**
* List of traces for this graphing object
*/
private ArrayList<TraceData> originalTraces = new ArrayList<TraceData>();
private ArrayList<Boolean> isStage = new ArrayList<Boolean>();
private final List<TraceData> originalTraces = new ArrayList<TraceData>();
private List<Boolean> isStage = new ArrayList<Boolean>();
private Date beginDate = null;
private Date endDate = null;
private String title = null;
@ -119,16 +126,25 @@ public class GraphData {
private String showppc = null;
private String latestfcstonlyc = null;
private double actionStage = -9999;
private double floodStage = -9999;
private double minorStage = -9999;
private double moderateStage = -9999;
private double majorStage = -9999;
private double actionFlow = -9999;
private double floodFlow = -9999;
private double minorFlow = -9999;
private double moderateFlow = -9999;
private double majorFlow = -9999;
/**
@ -139,7 +155,8 @@ public class GraphData {
}
/**
* @param x the x to set
* @param x
* the x to set
*/
public void setX(double x) {
this.x = x;
@ -154,7 +171,9 @@ public class GraphData {
/**
* y = yMax - yMin
* @param y the y to set
*
* @param y
* the y to set
*/
public void setY(double y) {
this.y = y;
@ -168,7 +187,8 @@ public class GraphData {
}
/**
* @param w the w to set
* @param w
* the w to set
*/
public void setW(int w) {
this.w = w;
@ -182,7 +202,8 @@ public class GraphData {
}
/**
* @param h the h to set
* @param h
* the h to set
*/
public void setH(int h) {
this.h = h;
@ -203,7 +224,8 @@ public class GraphData {
}
/**
* @param display_flow_unit the display_flow_unit to set
* @param display_flow_unit
* the display_flow_unit to set
*/
public void setDisplayFlowUnit(boolean displayFlowUnit) {
this.displayFlowUnit = displayFlowUnit;
@ -217,7 +239,8 @@ public class GraphData {
}
/**
* @param min the xMin to set
* @param min
* the xMin to set
*/
public void setXMin(Date min) {
xMin = min;
@ -231,68 +254,13 @@ public class GraphData {
}
/**
* @param max the xMax to set
* @param max
* the xMax to set
*/
public void setXMax(Date max) {
xMax = max;
}
// /**
// * @return the oldXMax
// */
// public Date getOldXMax() {
// return oldXMax;
// }
//
// /**
// * @param oldXMax the oldXMax to set
// */
// public void setOldXMax(Date oldXMax) {
// this.oldXMax = oldXMax;
// }
//
// /**
// * @return the oldXMin
// */
// public Date getOldXMin() {
// return oldXMin;
// }
//
// /**
// * @param oldXMin the oldXMin to set
// */
// public void setOldXMin(Date oldXMin) {
// this.oldXMin = oldXMin;
// }
//
// /**
// * @return the orgXMax
// */
// public Date getOrgXMax() {
// return orgXMax;
// }
//
// /**
// * @param orgXMax the orgXMax to set
// */
// public void setOrgXMax(Date orgXMax) {
// this.orgXMax = orgXMax;
// }
//
// /**
// * @return the orgXMin
// */
// public Date getOrgXMin() {
// return orgXMin;
// }
//
// /**
// * @param orgXMin the orgXMin to set
// */
// public void setOrgXMin(Date orgXMin) {
// this.orgXMin = orgXMin;
// }
/**
* @return the ymin
*/
@ -301,7 +269,8 @@ public class GraphData {
}
/**
* @param ymin the ymin to set
* @param ymin
* the ymin to set
*/
public void setYmin(double ymin) {
this.ymin = ymin;
@ -315,7 +284,8 @@ public class GraphData {
}
/**
* @param ymax the ymax to set
* @param ymax
* the ymax to set
*/
public void setYmax(double ymax) {
this.ymax = ymax;
@ -324,21 +294,22 @@ public class GraphData {
/**
* @return the traces
*/
public ArrayList<TraceData> getTraces() {
public List<TraceData> getTraces() {
return traces;
}
public TraceData getTraceData(int index) {
return traces.get(index);
}
/**
* @param traces the traces to set
* @param traces
* the traces to set
*/
public void setTraces(ArrayList<TraceData> traces) {
public void setTraces(List<TraceData> traces) {
this.traces = traces;
}
public void addTrace(TraceData trace) {
if (traces.size() < HydroConstants.MAX_TRACES) {
if (!traces.contains(trace)) {
@ -350,12 +321,13 @@ public class GraphData {
/**
* @return the isStage
*/
public ArrayList<Boolean> getIsStage() {
public List<Boolean> getIsStage() {
return isStage;
}
/**
* @param isStage the isStage to set
* @param isStage
* the isStage to set
*/
public void setIsStage(ArrayList<Boolean> isStage) {
this.isStage = isStage;
@ -364,7 +336,8 @@ public class GraphData {
/**
* Add the isStage boolean value to the list
*
* @param isStage true if value is stage, false otherwise
* @param isStage
* true if value is stage, false otherwise
*/
public void addIsStage(boolean isStage) {
if (traces.size() < HydroConstants.MAX_TRACES) {
@ -380,7 +353,8 @@ public class GraphData {
}
/**
* @param beginCal the beginCal to set
* @param beginCal
* the beginCal to set
*/
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
@ -394,7 +368,8 @@ public class GraphData {
}
/**
* @param endCal the endCal to set
* @param endCal
* the endCal to set
*/
public void setEndDate(Date endDate) {
this.endDate = endDate;
@ -408,7 +383,8 @@ public class GraphData {
}
/**
* @param title the title to set
* @param title
* the title to set
*/
public void setTitle(String title) {
this.title = title;
@ -422,7 +398,8 @@ public class GraphData {
}
/**
* @param num_traces the num_traces to set
* @param num_traces
* the num_traces to set
*/
public void setNum_traces(int num_traces) {
this.num_traces = num_traces;
@ -436,7 +413,8 @@ public class GraphData {
}
/**
* @param graph_pos the graph_pos to set
* @param graph_pos
* the graph_pos to set
*/
public void setGraph_pos(int graph_pos) {
this.graph_pos = graph_pos;
@ -450,7 +428,8 @@ public class GraphData {
}
/**
* @param xsize the xsize to set
* @param xsize
* the xsize to set
*/
public void setXsize(int xsize) {
this.xsize = xsize;
@ -464,7 +443,8 @@ public class GraphData {
}
/**
* @param ysize the ysize to set
* @param ysize
* the ysize to set
*/
public void setYsize(int ysize) {
this.ysize = ysize;
@ -478,7 +458,8 @@ public class GraphData {
}
/**
* @param yscale the yscale to set
* @param yscale
* the yscale to set
*/
public void setYscale(String yscale) {
this.yscale = yscale;
@ -492,7 +473,8 @@ public class GraphData {
}
/**
* @param ylinear the ylinear to set
* @param ylinear
* the ylinear to set
*/
public void setYlinear(String ylinear) {
this.ylinear = ylinear;
@ -506,7 +488,8 @@ public class GraphData {
}
/**
* @param showcat the showcat to set
* @param showcat
* the showcat to set
*/
public void setShowcat(boolean showcat) {
this.showcat = showcat;
@ -520,7 +503,8 @@ public class GraphData {
}
/**
* @param derivepp the derivepp to set
* @param derivepp
* the derivepp to set
*/
public void setDerivepp(String derivepp) {
this.derivepp = derivepp;
@ -534,7 +518,8 @@ public class GraphData {
}
/**
* @param showpp the showpp to set
* @param showpp
* the showpp to set
*/
public void setShowpp(boolean showpp) {
this.showpp = showpp;
@ -548,7 +533,8 @@ public class GraphData {
}
/**
* @param latestfcstonly the latestfcstonly to set
* @param latestfcstonly
* the latestfcstonly to set
*/
public void setLatestfcstonly(boolean latestfcstonly) {
this.latestfcstonly = latestfcstonly;
@ -562,7 +548,8 @@ public class GraphData {
}
/**
* @param ylinearc the ylinearc to set
* @param ylinearc
* the ylinearc to set
*/
public void setYlinearc(String ylinearc) {
this.ylinearc = ylinearc;
@ -576,7 +563,8 @@ public class GraphData {
}
/**
* @param yscalec the yscalec to set
* @param yscalec
* the yscalec to set
*/
public void setYscalec(String yscalec) {
this.yscalec = yscalec;
@ -590,7 +578,8 @@ public class GraphData {
}
/**
* @param showcatc the showcatc to set
* @param showcatc
* the showcatc to set
*/
public void setShowcatc(String showcatc) {
this.showcatc = showcatc;
@ -604,7 +593,8 @@ public class GraphData {
}
/**
* @param deriveppc the deriveppc to set
* @param deriveppc
* the deriveppc to set
*/
public void setDeriveppc(String deriveppc) {
this.deriveppc = deriveppc;
@ -618,7 +608,8 @@ public class GraphData {
}
/**
* @param showppc the showppc to set
* @param showppc
* the showppc to set
*/
public void setShowppc(String showppc) {
this.showppc = showppc;
@ -632,7 +623,8 @@ public class GraphData {
}
/**
* @param latestfcstonlyc the latestfcstonlyc to set
* @param latestfcstonlyc
* the latestfcstonlyc to set
*/
public void setLatestfcstonlyc(String latestfcstonlyc) {
this.latestfcstonlyc = latestfcstonlyc;
@ -651,7 +643,8 @@ public class GraphData {
}
/**
* @param actionStage the actionStage to set
* @param actionStage
* the actionStage to set
*/
public void setActionStage(double actionStage) {
this.actionStage = actionStage;
@ -665,7 +658,8 @@ public class GraphData {
}
/**
* @param minorStage the minorStage to set
* @param minorStage
* the minorStage to set
*/
public void setMinorStage(double minorStage) {
this.minorStage = minorStage;
@ -679,7 +673,8 @@ public class GraphData {
}
/**
* @param moderateStage the moderateStage to set
* @param moderateStage
* the moderateStage to set
*/
public void setModerateStage(double moderateStage) {
this.moderateStage = moderateStage;
@ -693,7 +688,8 @@ public class GraphData {
}
/**
* @param majorStage the majorStage to set
* @param majorStage
* the majorStage to set
*/
public void setMajorStage(double majorStage) {
this.majorStage = majorStage;
@ -707,7 +703,8 @@ public class GraphData {
}
/**
* @param actionFlow the actionFlow to set
* @param actionFlow
* the actionFlow to set
*/
public void setActionFlow(double actionFlow) {
this.actionFlow = actionFlow;
@ -721,7 +718,8 @@ public class GraphData {
}
/**
* @param minorFlow the minorFlow to set
* @param minorFlow
* the minorFlow to set
*/
public void setMinorFlow(double minorFlow) {
this.minorFlow = minorFlow;
@ -735,7 +733,8 @@ public class GraphData {
}
/**
* @param moderateFlow the moderateFlow to set
* @param moderateFlow
* the moderateFlow to set
*/
public void setModerateFlow(double moderateFlow) {
this.moderateFlow = moderateFlow;
@ -749,7 +748,8 @@ public class GraphData {
}
/**
* @param majorFlow the majorFlow to set
* @param majorFlow
* the majorFlow to set
*/
public void setMajorFlow(double majorFlow) {
this.majorFlow = majorFlow;
@ -763,7 +763,8 @@ public class GraphData {
}
/**
* @param floodStage the floodStage to set
* @param floodStage
* the floodStage to set
*/
public void setFloodStage(double floodStage) {
this.floodStage = floodStage;
@ -777,7 +778,8 @@ public class GraphData {
}
/**
* @param floodFlow the floodFlow to set
* @param floodFlow
* the floodFlow to set
*/
public void setFloodFlow(double floodFlow) {
this.floodFlow = floodFlow;
@ -791,7 +793,8 @@ public class GraphData {
}
/**
* @param ymin2 the ymin2 to set
* @param ymin2
* the ymin2 to set
*/
public void setYmin2(double ymin2) {
this.ymin2 = ymin2;
@ -805,7 +808,8 @@ public class GraphData {
}
/**
* @param ymax2 the ymax2 to set
* @param ymax2
* the ymax2 to set
*/
public void setYmax2(double ymax2) {
this.ymax2 = ymax2;
@ -819,7 +823,8 @@ public class GraphData {
}
/**
* @param y2 the y2 to set
* @param y2
* the y2 to set
*/
public void setY2(double y2) {
this.y2 = y2;
@ -828,21 +833,22 @@ public class GraphData {
/**
* @return the originalTraces
*/
public ArrayList<TraceData> getOriginalTraces() {
ArrayList<TraceData> rtnList = new ArrayList<TraceData>(originalTraces.size());
for (TraceData td: originalTraces) {
public List<TraceData> getOriginalTraces() {
List<TraceData> rtnList = new ArrayList<TraceData>(
originalTraces.size());
for (TraceData td : originalTraces) {
TraceData data = new TraceData(td);
rtnList.add(data);
}
return rtnList;
}
/**
* Generate a copy of the original trace data.
*/
public void saveTraceInfo() {
for (TraceData td: traces) {
for (TraceData td : traces) {
TraceData data = new TraceData(td);
originalTraces.add(data);
}

View file

@ -76,6 +76,7 @@ import com.raytheon.viz.mpe.util.WriteQPFGrids;
* Mar 24, 2009 snaples Initial creation
* Sep 19, 2011 10955 rferrel Use RunProcess
* Nov 06, 2012 15481 wkwock Fix save 6 hours precipitation files
* May 02, 2013 15956 wkwock Fix incorrect contents in precip_LLL_grid_yyyymmdd.nc file
*
* </pre>
*
@ -765,6 +766,13 @@ public class SaveLevel2Data {
DailyQcUtils.precip_stations, hrap_grid,
DailyQcUtils.pdata, DailyQcUtils.pcp_in_use);
//copy DailyQcUtils.pcp.value to datavals
for (int h = 0; h < hrap_grid.maxj; h++) {
for (int i = 0; i < hrap_grid.maxi; i++) {
datavals[i][h] = (DailyQcUtils.pcp.value[i][h] / 100.f);
}
}
String dbuf = String.format("%s%s_%04d%02d%02d", grid_file,
timefile[2][l], gm.get(Calendar.YEAR),
gm.get(Calendar.MONTH) + 1,

View file

@ -44,6 +44,7 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Hrap_Grid;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 7, 2011 snaples Initial creation
* May 02, 2013 15956 wkwock Fix incorrect contents in precip_LLL_grid_yyyymmdd.nc file
*
* </pre>
*
@ -274,7 +275,7 @@ public class AutoDailyQC {
otime.get(Calendar.DAY_OF_MONTH));
File pl2 = new File(precip_level2_file);
if (pl2.exists()) {
if (!pl2.exists()) {//dr16046:file not exist then don't generate
precip_level2_flag[i] = 0;
System.out
.println(String
@ -389,6 +390,8 @@ public class AutoDailyQC {
CreateMap cm = new CreateMap();
cm.create_map(num);
}
//Here's the 12 to 12 whole day nc file
//for (int l = 0; l < 5; l++) {
for (int l = 0; l < num_period_qc; l++) {
if (DailyQcUtils.pdata[i].used[l] == 0) {
@ -415,6 +418,13 @@ public class AutoDailyQC {
DailyQcUtils.getHrap_grid(),
DailyQcUtils.pdata, DailyQcUtils.pcp_in_use);
//copy data from DailyQcUtils.pcp.value to datavals
for (int y = 0; y < hrap_grid.maxj; y++) {
for (int x = 0; x < hrap_grid.maxi; x++) {
datavals[x][y] = (DailyQcUtils.pcp.value[x][y] / 100.f);
}
}
/* output grid to file in Ascii format */
dbuf = String.format("%s%s_%04d%02d%02d",
DailyQcUtils.grid_file,

View file

@ -260,15 +260,9 @@ public class RadarDMDInterrogator extends RadarGraphicInterrogator implements
break;
case RANK:
// Rank
String ranks = currFeature
.getValue(DMDAttributeIDs._2D_STRENGTH_RANK
.toString());
int tiltNum = 0;
if ((ranks.length() > 0)
&& !ranks.isEmpty()) {
tiltNum = ranks.split(",").length - 1;
}
String rank = ranks.split(",")[tiltNum];
String rank = currFeature
.getValue(DMDAttributeIDs.STRENGTH_RANK
.toString());
rval.append("r" + rank + " ");
break;
case MSI:

View file

@ -55,6 +55,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 4, 2010 mnash Initial creation
* 05/02/2013 DR 14587 D. Friedman Refactor to store multiple types.
*
* </pre>
*
@ -103,8 +104,22 @@ public class RadarDefaultInterrogator implements IRadarInterrogator {
dataMap.put("Angle", radarRecord.getPrimaryElevationAngle().toString());
int dataValue = addParameters(radarRecord, latLon, dataMap);
addValueToMap(dataValue, "", radarRecord, params, dataMap);
dataMap.put("numericValue", String.valueOf(dataValue));
computeValues(radarRecord, dataMap, dataValue, params);
return dataMap;
}
/**
* @param dataValue
* @param baseName
* @param dataMap
*/
protected void addValueToMap(int dataValue, String baseName,
RadarRecord radarRecord, ColorMapParameters params,
Map<String, String> dataMap) {
String numericValueKey = baseName + "numericValue";
dataMap.put(numericValueKey, String.valueOf(dataValue));
String dataValueString = "";
if (radarRecord.getNumLevels() <= 16 && radarRecord.getNumLevels() != 0
@ -123,7 +138,7 @@ public class RadarDefaultInterrogator implements IRadarInterrogator {
units = UnitFormat.getUCUMInstance().format(dispUnit);
}
if (dataValue == 0) {
dataMap.put("numericValue", null);
dataMap.put(numericValueKey, null);
dataValueString = "NO DATA";
} else if (th0 instanceof Float) {
double f0 = (Float) th0;
@ -131,7 +146,7 @@ public class RadarDefaultInterrogator implements IRadarInterrogator {
if (converter != null) {
f0 = converter.convert(dataValue);
}
dataMap.put("numericValue", String.valueOf(f0));
dataMap.put(numericValueKey, String.valueOf(f0));
if (dataValue < 15) {
Object th1 = radarRecord.getDecodedThreshold(dataValue + 1);
@ -178,16 +193,14 @@ public class RadarDefaultInterrogator implements IRadarInterrogator {
// Handle cases where the the actual value is used
// /////////////////////////////////////////////////////////
if (dataValue == 0) {
dataMap.put("numericValue", null);
dataMap.put(numericValueKey, null);
dataValueString = "NO DATA";
} else {
dataValueString = decodeValues(dataValue, dataMap, radarRecord,
dataValueString = decodeValues(dataValue, baseName, dataMap, radarRecord,
params);
}
}
dataMap.put("Value", dataValueString);
computeValues(radarRecord, dataMap, dataValue, params);
return dataMap;
dataMap.put(baseName + "Value", dataValueString);
}
public void computeValues(RadarRecord radarRecord,
@ -202,11 +215,11 @@ public class RadarDefaultInterrogator implements IRadarInterrogator {
* @param dataMap
* @return
*/
public String decodeValues(int dataValue, Map<String, String> dataMap,
public String decodeValues(int dataValue, String baseName, Map<String, String> dataMap,
RadarRecord radarRecord, ColorMapParameters params) {
UnitConverter converter = getConverter(params, radarRecord);
double dispVal = converter.convert(dataValue);
dataMap.put("numericValue", String.valueOf(dispVal));
dataMap.put(baseName + "numericValue", String.valueOf(dispVal));
if (params.getDataMapping() != null) {
for (DataMappingEntry entry : params.getDataMapping().getEntries()) {
if (entry.getSample() == null) {

View file

@ -54,7 +54,7 @@ public class RadarEETInterrogator extends RadarRadialInterrogator implements
* com.raytheon.uf.viz.core.drawables.ColorMapParameters)
*/
@Override
public String decodeValues(int dataValue, Map<String, String> dataMap,
public String decodeValues(int dataValue, String baseName, Map<String, String> dataMap,
RadarRecord radarRecord, ColorMapParameters params) {
dataValue -= 2;
String d = "";
@ -66,7 +66,7 @@ public class RadarEETInterrogator extends RadarRadialInterrogator implements
} else {
d = String.valueOf(dataValue);
}
dataMap.put("numericValue", d);
dataMap.put(baseName + "numericValue", d);
return String.format("%s %s", d,
UnitFormat.getUCUMInstance().format(params.getDisplayUnit()));
}

View file

@ -54,7 +54,7 @@ public class RadarVILInterrogator extends RadarRasterInterrogator implements
* (int, java.util.Map)
*/
@Override
public String decodeValues(int dataValue, Map<String, String> dataMap,
public String decodeValues(int dataValue, String baseName, Map<String, String> dataMap,
RadarRecord radarRecord, ColorMapParameters params) {
double decoded[] = new double[] { 0, 0, 0, 0, 0 };
// TODO still doesn't return correct value

View file

@ -26,6 +26,8 @@ import javax.measure.unit.SI;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.util.RadarDataInterrogator;
import com.vividsolutions.jts.geom.Coordinate;
/**
* TODO Add Description
@ -36,6 +38,7 @@ import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 5, 2010 mnash Initial creation
* 05/02/2013 DR 14587 D. Friedman Store base velocity in map.
*
* </pre>
*
@ -123,4 +126,14 @@ public class RadarVelocityInterrogator extends RadarRadialInterrogator
dataMap.put("Shear", String.format("%.4f/s", shear));
}
}
@Override
public Map<String, String> sample(RadarRecord radarRecord,
Coordinate latLon, ColorMapParameters params) {
Map<String, String> map = super.sample(radarRecord, latLon, params);
int dataValue = interrogator.getDataValue(latLon,
RadarDataInterrogator.DataType.BASE_VELOCITY);
addValueToMap(dataValue, "baseVelocity-", radarRecord, params, map);
return map;
}
}

View file

@ -59,6 +59,7 @@ import com.raytheon.viz.radar.ui.xy.RadarXsectXYResource;
* ------------ ---------- ----------- --------------------------
* Aug 4, 2010 mnash Initial creation
* 03/04/2013 DCS51 zwang Handle GFM product
* 05/02/2013 DR 14587 D. Friedman Add isVelocityProductCode
*
* </pre>
*
@ -151,4 +152,8 @@ public class RadarProductFactory {
}
return resource;
}
public static boolean isVelocityProductCode(int productCode) {
return velocities.contains(productCode);
}
}

View file

@ -30,6 +30,8 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.dataplugin.IDecoderGettable.Amount;
import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.DrawableImage;
import com.raytheon.uf.viz.core.IGraphicsTarget;
@ -41,9 +43,11 @@ import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.viz.awipstools.capabilities.EAVCapability;
import com.raytheon.viz.awipstools.common.EstimatedActualVelocity;
import com.raytheon.viz.awipstools.common.IRadialVelocityToolSource;
import com.raytheon.viz.radar.VizRadarRecord;
import com.raytheon.viz.radar.interrogators.IRadarInterrogator;
import com.raytheon.viz.radar.rsc.RadarImageResource;
import com.raytheon.viz.radar.rsc.RadarProductFactory;
import com.raytheon.viz.radar.rsc.RadarResourceData;
import com.vividsolutions.jts.geom.Coordinate;
@ -56,6 +60,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 29, 2010 mnash Initial creation
* 05/02/2013 DR 14587 D. Friedman Implement IRadialVelocityToolSource
*
* </pre>
*
@ -63,7 +68,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* @version 1.0
*/
public class RadarRadialResource extends RadarImageResource<MapDescriptor> {
public class RadarRadialResource extends RadarImageResource<MapDescriptor> implements IRadialVelocityToolSource {
private static final String EAV_VALUE = "EAC.Value";
@ -214,4 +219,24 @@ public class RadarRadialResource extends RadarImageResource<MapDescriptor> {
radarRecord, descriptor.getGridGeometry());
}
@Override
public boolean isRadialVelocitySource() {
int productCode = -1;
try {
// TODO: This duplicates logic in RadarResourceData.constructResource
if (radarRecords != null && ! radarRecords.isEmpty()) {
RadarRecord r = radarRecords.values().iterator().next();
productCode = r.getProductCode();
} else {
RequestConstraint productCodeConstraint = getResourceData()
.getMetadataMap().get("productCode");
if (productCodeConstraint.getConstraintType() == ConstraintType.EQUALS)
productCode = Integer.parseInt(productCodeConstraint
.getConstraintValue());
}
} catch (RuntimeException e) {
// ignore
}
return RadarProductFactory.isVelocityProductCode(productCode);
}
}

View file

@ -25,6 +25,8 @@ import java.util.Map;
import java.util.Map.Entry;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.measure.unit.UnitFormat;
@ -53,6 +55,10 @@ import com.vividsolutions.jts.geom.Envelope;
* Nov 09 2012 15586 Xiaochuan In dataRowFormat, set MSI maximum
* size to 5.
* MAR 05, 2013 15313 kshresth Added sampling for DMD
*
* MAY 01, 2013 15150 kshresth Added logic to match DMD Radar Graphic
* Display and SCAN DMD Table Display
*
* </pre>
*
* @author mnash
@ -154,9 +160,15 @@ public class GraphicDataUtil {
.toString());
// Range @ Azimuth
String range = setupConverter(currFeature,
DMDAttributeIDs.BASE_RANGE.toString(),
0, true);
double range = Double
.parseDouble(currFeature
.getValue(DMDAttributeIDs.BASE_RANGE
.toString()));
UnitConverter converter = SI.KILOMETER
.getConverterTo(NonSI.NAUTICAL_MILE);
int rangeNm = (int) Math
.round(converter.convert(range));
String azimuth = currFeature
.getValue(DMDAttributeIDs.BASE_AZIMUTH
.toString());
@ -215,7 +227,7 @@ public class GraphicDataUtil {
// put together the final string to display in
// the table
String fnlString = String.format(dataRowFormat,
mid, range, azimuth, baseHeight, depth,
mid, rangeNm, azimuth, baseHeight, depth,
rank, msi, llrotv, llg2g, mxrotv,
htmxrv);

View file

@ -33,6 +33,7 @@ import java.util.regex.Pattern;
* Initial creation
* Aug 25, 2011 10719 rferrel Removed the no longer common ugcPtrn.
* Aug 6, 2012 15219 Qinglu Lin For tmlPtrn, changed d{1,3}DEG to d{3}DEG.
* May 1, 2013 15893 mgamazaychikov Changed listOfAreaNamePtrn.
* </pre>
*
@ -56,7 +57,7 @@ public interface IQCCheck {
.compile("/[A-Za-z0-9]{5}.[0-3NU].(\\w{2}).\\d{6}T\\d{4}Z.\\d{6}T\\d{4}Z.\\d{6}T\\d{4}Z.\\w{2}/");
public static final Pattern listOfAreaNamePtrn = Pattern
.compile("^((\\w{1,}\\s{1}\\w{2}-){1,})");
.compile("^(\\w{1,}\\s{1}[\\w{1,}\\s{1}]*-{1,})");
public static final Pattern firstBulletPtrn = Pattern
.compile("\\*\\s(.*)\\s(WARNING|ADVISORY)(\\sFOR(.*)|...)");

View file

@ -41,6 +41,9 @@
commandId="com.raytheon.viz.volumebrowser.volumeBrowserRef">
</handler>
</extension>
<extension point="com.raytheon.uf.viz.core.alterBundle">
<alterBundle id="tools" class="com.raytheon.viz.volumebrowser.ToolsAlterBundleContributor"/>
</extension>
<extension point="com.raytheon.uf.viz.core.alterBundle">
<alterBundle id="grids" class="com.raytheon.viz.volumebrowser.GridAlterBundleContributor"/>
</extension>

View file

@ -0,0 +1,443 @@
/*****************************************************************************************
* COPYRIGHT (c), 2007, RAYTHEON COMPANY
* ALL RIGHTS RESERVED, An Unpublished Work
*
* RAYTHEON PROPRIETARY
* If the end user is not the U.S. Government or any agency thereof, use
* or disclosure of data contained in this source code file is subject to
* the proprietary restrictions set forth in the Master Rights File.
*
* U.S. GOVERNMENT PURPOSE RIGHTS NOTICE
* If the end user is the U.S. Government or any agency thereof, this source
* code is provided to the U.S. Government with Government Purpose Rights.
* Use or disclosure of data contained in this source code file is subject to
* the "Government Purpose Rights" restriction in the Master Rights File.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* Use or disclosure of data contained in this source code file is subject to
* the export restrictions set forth in the Master Rights File.
******************************************************************************************/
package com.raytheon.viz.volumebrowser;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.procedures.AlterBundleChangeEvent;
import com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.uf.viz.core.procedures.IAlterBundleContributor;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.IBaseLinesContainer;
import com.raytheon.uf.viz.core.rsc.IPointsToolContainer;
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureDlg;
import com.raytheon.uf.viz.points.IPointChangedListener;
import com.raytheon.uf.viz.points.PointUtilities;
import com.raytheon.uf.viz.points.PointsDataManager;
import com.raytheon.uf.viz.points.data.IPointNode;
import com.raytheon.uf.viz.xy.crosssection.rsc.CrossSectionResourceData;
import com.raytheon.viz.awipstools.ToolsDataManager;
import com.raytheon.viz.volumebrowser.datacatalog.AbstractDataCatalog;
import com.raytheon.viz.volumebrowser.datacatalog.DataCatalogManager;
import com.raytheon.viz.volumebrowser.vbui.SelectedData;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.LineString;
/**
* This class generates the alter bundle's contributions for points and lines.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Initial creation
* Aug 08, 2012 #875 rferrel Generate menu entries for points.
* Oct 03, 2012 #1248 rferrel Added listener for when points change.
* May 03, 2013 DR14824 mgamazaychikov Added alterResource method
*
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public class ToolsAlterBundleContributor extends AlterBundleContributorAdapter {
private static final String POINTS_PREFIX = "Point-";
private static final String LINES_PREFIX = "Line-";
private static final String POINTS_KEY = "point";
private static final String LINES_KEY = "line";
private static final String PLUGIN_KEY = "pluginName";
private static final String REPORTYPE_KEY = "reportType";
private IPointChangedListener pointChangedListener;
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.procedures.IAlterBundleContributor#getAlterables
* ()
*/
@Override
public Map<String, String[]> getAlterables() {
Map<String, String[]> alterables = new HashMap<String, String[]>();
String[] linesValues = createLineArray();
String[] pointsValues = createPointArray();
alterables.put(LINES_KEY, linesValues);
alterables.put(POINTS_KEY, pointsValues);
return alterables;
}
private final static Pattern pat = Pattern.compile(File.separator + "+");
private List<String> createChildrenList(PointsDataManager pdm,
IPointNode parent) {
List<String> childrenList = new ArrayList<String>();
for (IPointNode node : pdm.getChildren(parent)) {
if (node.isGroup()) {
String value = node.getGroup().replace(
PointUtilities.DELIM_CHAR, ' ')
+ File.separator;
value = pat.matcher(value).replaceAll(
IAlterBundleContributor.MENU_SEPARATOR);
childrenList.add(value);
childrenList.addAll(createChildrenList(pdm, node));
} else {
String value = (node.getGroup() + File.separator
+ POINTS_PREFIX + node.getName()).replace(
PointUtilities.DELIM_CHAR, ' ');
value = pat.matcher(value).replaceAll(
IAlterBundleContributor.MENU_SEPARATOR);
childrenList.add(value);
}
}
return childrenList;
}
private String[] createLineArray() {
ToolsDataManager tdm = ToolsDataManager.getInstance();
Collection<String> blNames = tdm.getBaselineNames();
String[] lines = new String[blNames.size()];
int i = 0;
for (String line : blNames) {
lines[i] = LINES_PREFIX + line;
++i;
}
Arrays.sort(lines);
String[] linesValues = new String[lines.length + 2];
linesValues[0] = ProcedureDlg.ORIGINAL;
linesValues[1] = ProcedureDlg.CURRENT;
System.arraycopy(lines, 0, linesValues, 2, lines.length);
return linesValues;
}
/**
* @return pointsValues
*/
private String[] createPointArray() {
PointsDataManager pdm = PointsDataManager.getInstance();
List<String> pointsList = new ArrayList<String>();
pointsList.add(ProcedureDlg.ORIGINAL);
pointsList.add(ProcedureDlg.CURRENT);
pointsList.add(IAlterBundleContributor.MI_SEPARATOR);
pointsList.addAll(createChildrenList(pdm, null));
String[] pointsValues = pointsList.toArray(new String[0]);
return pointsValues;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.procedures.IAlterBundleContributor#alterBundle
* (com.raytheon.uf.viz.core.procedures.Bundle, java.lang.String,
* java.lang.String)
*/
@Override
public void alterBundle(Bundle bundleToAlter, String alterKey,
String alterValue) {
if (alterValue != null) {
if (POINTS_KEY.equals(alterKey)) {
if (ProcedureDlg.CURRENT.equals(alterValue)) {
for (AbstractRenderableDisplay display : bundleToAlter
.getDisplays()) {
replaceWithCurrentPoints(display.getDescriptor()
.getResourceList());
}
} else if (ProcedureDlg.ORIGINAL.equals(alterValue) == false) {
String point = alterValue.replace(POINTS_PREFIX, "");
alterPoints(bundleToAlter, point);
}
} else if (LINES_KEY.equals(alterKey)) {
if (ProcedureDlg.CURRENT.equals(alterValue)) {
replaceWithCurrentLines(bundleToAlter);
} else if (ProcedureDlg.ORIGINAL.equals(alterValue) == false) {
String line = alterValue.replace(LINES_PREFIX, "");
alterLines(bundleToAlter, line);
}
}
}
}
/**
* @param list
*/
private void replaceWithCurrentPoints(ResourceList list) {
for (ResourcePair rp : list) {
AbstractResourceData rData = rp.getResourceData();
if (rData instanceof IPointsToolContainer) {
alterContainer((IPointsToolContainer) rData,
((IPointsToolContainer) rData).getPointLetter());
} else if (rData instanceof IResourceGroup) {
replaceWithCurrentPoints(((IResourceGroup) rData)
.getResourceList());
}
}
}
/**
* @param b
*/
private void replaceWithCurrentLines(Bundle b) {
for (AbstractRenderableDisplay display : b.getDisplays()) {
IDescriptor desc = display.getDescriptor();
if (desc instanceof IBaseLinesContainer) {
String line = ((IBaseLinesContainer) desc).getBaseLine();
if (line != null && line.startsWith("Line")) {
alterContainer((IBaseLinesContainer) desc,
line.replace("Line", ""));
}
}
}
}
/**
* @param bundleToAlter
* @param point
*/
private void alterPoints(Bundle bundleToAlter, String point) {
for (AbstractRenderableDisplay display : bundleToAlter.getDisplays()) {
alterResourceList(display.getDescriptor().getResourceList(), point);
}
}
/**
* @param list
* @param selectedString
*/
private void alterResourceList(ResourceList list, String selectedString) {
for (ResourcePair rp : list) {
AbstractResourceData rData = rp.getResourceData();
if (rData instanceof AbstractRequestableResourceData) {
alterResource((AbstractRequestableResourceData) rData, POINTS_KEY,
selectedString);
alterContainer((IPointsToolContainer) rData, selectedString);
} else if (rData instanceof IResourceGroup) {
alterResourceList(((IResourceGroup) rData).getResourceList(),
selectedString);
}
}
}
private void alterResource(AbstractRequestableResourceData data, String selectedKey,
String selectedString) {
if (selectedString == null) {
return;
}
HashMap<String, RequestConstraint> metadataMap = data.getMetadataMap();
HashMap<String, RequestConstraint> metadataMapOld = new HashMap<String, RequestConstraint>();
// make a copy of original matedata map
metadataMapOld.putAll(metadataMap);
// obtain data catalog
AbstractDataCatalog ac = getDataCatalog (metadataMap);
if ( ac == null ) {
return;
}
// change the parameters in the original metadata map
ac.alterProductParameters(selectedKey, selectedString,
(HashMap<String, RequestConstraint>) metadataMap);
// in addition to metadata map resource data needs to be modified
// for CrossSectionResourceData
if (data instanceof CrossSectionResourceData) {
String theKeyToChange = null;
Iterator<Map.Entry<String, RequestConstraint>> it = metadataMap
.entrySet().iterator();
while (it.hasNext()) {
@SuppressWarnings({ "unchecked", "rawtypes" })
Map.Entry<String, RequestConstraint> pairs = (Map.Entry) it
.next();
String currentKey = (String) pairs.getKey();
String currentValue = metadataMap.get(currentKey)
.getConstraintValue();
if (metadataMapOld.containsKey(currentKey)) {
String oldValue = metadataMapOld.get(currentKey)
.getConstraintValue();
if (!oldValue.equalsIgnoreCase(currentValue)) {
theKeyToChange = currentKey;
}
}
}
String stationID = metadataMap.get(theKeyToChange)
.getConstraintValue();
List<String> stationIDs = Arrays.asList(stationID
.split("\\s*,\\s*"));
((CrossSectionResourceData) data).setStationIDs(stationIDs);
}
}
private AbstractDataCatalog getDataCatalog(
HashMap<String, RequestConstraint> metadataMap) {
String pluginName = null;
String reportType = null;
if (metadataMap.containsKey(PLUGIN_KEY)) {
pluginName = metadataMap.get(PLUGIN_KEY).getConstraintValue();
} else {
return null;
}
if (metadataMap.containsKey(REPORTYPE_KEY)) {
reportType = metadataMap.get(REPORTYPE_KEY).getConstraintValue();
} else {
return null;
}
String sourcesKey = pluginName + reportType;
SelectedData sd = new SelectedData(null, sourcesKey, null, null, null,
null, null);
return (AbstractDataCatalog) DataCatalogManager
.getDataCatalogManager().getDataCatalog(sd);
}
/**
* @param rData
* @param selectedString
*/
private void alterContainer(IPointsToolContainer container,
String selectedString) {
Coordinate point = PointsDataManager.getInstance().getCoordinate(
selectedString);
container.setPointCoordinate(point);
container.setPointLetter(selectedString);
}
/**
* @param bundleToAlter
* @param line
*/
private void alterLines(Bundle bundleToAlter, String line) {
for (AbstractRenderableDisplay display : bundleToAlter.getDisplays()) {
if (display.getDescriptor() instanceof IBaseLinesContainer) {
alterContainer((IBaseLinesContainer) display.getDescriptor(),
line);
ResourceList rl = display.getDescriptor().getResourceList();
for (ResourcePair rp : rl) {
AbstractResourceData rData = rp.getResourceData();
if (rData instanceof AbstractRequestableResourceData) {
alterResource((AbstractRequestableResourceData) rData, LINES_KEY,
line);
}
}
}
}
}
/**
* @param container
* @param selectedString
*/
private void alterContainer(IBaseLinesContainer container,
String selectedString) {
LineString line = ToolsDataManager.getInstance().getBaseline(
selectedString);
container.setBaseLine(selectedString);
container.setBaseLineString(line);
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter#
* getAlterables(java.lang.String)
*/
@Override
public String[] getAlterables(String key) {
if (key == POINTS_KEY) {
return createPointArray();
} else if (key == LINES_KEY) {
return createLineArray();
}
return null;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter#
* listenerSetup()
*/
@Override
public void listenerSetup() {
if (pointChangedListener == null) {
pointChangedListener = new IPointChangedListener() {
@Override
public void pointChanged() {
notifyBundleListeners();
}
};
PointsDataManager.getInstance().addPointsChangedListener(
pointChangedListener);
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter#
* listenerShutdown()
*/
@Override
public void listenerShutdown() {
if (pointChangedListener != null) {
PointsDataManager.getInstance().removePointsChangedListener(
pointChangedListener);
pointChangedListener = null;
}
}
/**
* Received notification of changes to points notify anyone interested in
* the change.
*/
private void notifyBundleListeners() {
AlterBundleChangeEvent event = new AlterBundleChangeEvent(
new String[] { POINTS_KEY });
fireAlterBundleChangeListener(event);
}
}

View file

@ -77,6 +77,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 07/31/2012 #875 rferrel Now uses points.
* Feb 21, 2013 1617 bsteffen fixed vb sounding point selection for
* points which contain the word Point
* May 03, 2013 DR14824 mgamazaychikov Added alterProductParameters method
*
*
* </pre>
@ -503,5 +504,18 @@ public abstract class AbstractDataCatalog implements IDataCatalog {
return ((plane != null) && (plane.startsWith("Line") || plane
.startsWith("Point")));
}
/**
* Alter product parameters
*
* @param selectedKey
* @param selectedValue
* @param productParameters
*/
public void alterProductParameters(
String selectedKey,
String selectedValue, HashMap<String, RequestConstraint> productParameters) {
return;
}
}

View file

@ -136,6 +136,7 @@ import com.vividsolutions.jts.geom.Polygon;
* Feb 18, 2013 #1633 rferrel Changed checkFollowupSelection to use SimulatedTime.
* Mar 28, 2013 DR 15974 D. Friedman Do not track removed GIDs.
* Apr 11, 2013 1894 jsanchez Removed the ability to load/unload maps via bullet selection. This will be resolved in a follow on ticket.
* Apr 30, 2013 DR 16118 Qinglu Lin For reissue (followup NEW), called redrawFromWarned() in okPressed().
* </pre>
*
* @author chammack
@ -989,6 +990,11 @@ public class WarngenDialog extends CaveSWTDialog implements
return;
}
if (followupData != null && WarningAction.valueOf(followupData
.getAct()) == WarningAction.NEW) {
redrawFromWarned();
}
if ((followupData == null || (WarningAction.valueOf(followupData
.getAct()) == WarningAction.CON && warngenLayer
.conWarnAreaChanged(followupData)))

View file

@ -172,6 +172,7 @@ import com.vividsolutions.jts.io.WKTReader;
* 04/10/2013 DR 16044 D. Friedman Fix NPE in getAllFipsInArea.
* 04/11/2013 1894 jsanchez Kept tracked of the currently loaded custom maps.
* 04/12/1013 DR 16045 Qinglu Lin Updated AreaHatcher's run() by calling removeDuplicateCoordinate().
* 04/23/1013 DR 16064 Qinglu Lin Added removeDuplicateGid() and applies it in populateStrings().
* 04/24/2013 1943 jsanchez Replaced used of areaConfig with areaSource.
* </pre>
*
@ -2649,6 +2650,8 @@ public class WarngenLayer extends AbstractStormTrackResource {
Set<String> prefixes = new HashSet<String>(Arrays.asList(GeometryUtil
.getGID(state.getWarningArea())));
prefixes = removeDuplicateGid(prefixes);
for (GeospatialData f : geoData.features) {
Geometry geom = f.geometry;
if (prefixes.contains(GeometryUtil.getPrefix(geom.getUserData()))) {
@ -2954,4 +2957,46 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
return slope;
}
/**
* Some counties/forecast zones have two GIDs, one is for the large portion of that
* county and the other is for the small portion, e.g., inlets of a bay. Prince William
* County, Virginia is such an example. As WarnGen needs to mark a hatched county with
* only one W, one of the GIDs needs to be filtered out. The approach in the method is
* to remove the GID for the area of smaller size.
*/
private Set<String> removeDuplicateGid(Set<String> prefixes) {
if (prefixes.size() < 2)
return prefixes;
Map<String, Double> fipsSize = new HashMap<String, Double>();
Map<String, String> namePrefix = new HashMap<String, String>();
Iterator<String> iter = prefixes.iterator();
String fips = null;
String prefix = null;
while (iter.hasNext()) {
prefix = iter.next();
double size = 0.0d;
for (GeospatialData f : geoData.features) {
fips = getFips(f);
Geometry geom = f.geometry;
if(prefix.equals(GeometryUtil.getPrefix(geom.getUserData()))) {
size = geom.getArea();
if (fipsSize.containsKey(fips)) {
if (fipsSize.get(fips) < size) {
fipsSize.put(fips, size);
namePrefix.put(fips, prefix);
break;
}
} else {
fipsSize.put(fips, size);
namePrefix.put(fips, prefix);
}
}
}
}
return new HashSet<String>(namePrefix.values());
}
}

View file

@ -48,6 +48,7 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 27, 2012 1149 jsanchez Refactored methods from AbstractWarningsResource into this class.
* May 06, 2013 1930 bsteffen Check for null in WatchesResource.
*
* </pre>
*
@ -186,16 +187,13 @@ public class WatchesResource extends AbstractWWAResource {
if (record.getUgczones().size() > 0) {
setGeometry(record);
if (record.getGeometry() != null) {
if (record.getGeometry() != null && record.getPhen() != null) {
IShadedShape ss = target.createShadedShape(false,
descriptor.getGridGeometry(), false);
geo = (Geometry) record.getGeometry().clone();
JTSCompiler jtsCompiler = new JTSCompiler(ss, null,
this.descriptor, PointStyle.CROSS);
jtsCompiler.handle(geo, color);
if (record.getPhen() == null) {
return;
}
ss.setFillPattern(FillPatterns.getGLPattern(record.getPhen()
.equals("TO") ? "VERTICAL" : "HORIZONTAL"));
ss.compile();
@ -272,7 +270,7 @@ public class WatchesResource extends AbstractWWAResource {
if (createShape != null) {
WarningEntry entry = entryMap.get(createShape
.getDataURI());
if (entry != null) {
if (entry != null && entry.shadedShape != null) {
entry.shadedShape.dispose();
}
initShape(target, createShape);

View file

@ -44,6 +44,7 @@ import com.raytheon.edex.util.Util;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.SerializableManager;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.core.props.PropertiesFactory;
import com.raytheon.uf.edex.database.DatabasePluginProperties;
@ -69,8 +70,8 @@ import com.raytheon.uf.edex.database.plugin.PluginVersionDao;
* 2/9/2009 1990 bphillip Fixed index creation
* 03/20/09 njensen Implemented IPluginRegistryChanged
* Mar 29, 2013 1841 djohnson Remove unused method, warnings, and close streams with utility method.
* May 02, 2013 1970 bgonzale Updated createIndexTableNamePattern to match text preceeding
* %TABLE%.
* Mar 02, 2013 1970 bgonzale Added check for abstract entities in sql index naming.
* Removed unused private method populateSchema.
* </pre>
*
* @author bphillip
@ -89,6 +90,8 @@ public class SchemaManager implements IDatabasePluginRegistryChanged {
*/
private static final long pluginLockTimeOutMillis = 120000;
private static final String TABLE = "%TABLE%";
/** The singleton instance */
private static SchemaManager instance;
@ -105,7 +108,7 @@ public class SchemaManager implements IDatabasePluginRegistryChanged {
.compile("^create (?:table |index |sequence )(?:[A-Za-z_0-9]*\\.)?(.+?)(?: .*)?$");
private final Pattern createIndexTableNamePattern = Pattern
.compile("^create index \\w*?%TABLE%.+? on (.+?) .*$");
.compile("^create index %TABLE%.+? on (.+?) .*$");
/**
* Gets the singleton instance
@ -295,8 +298,12 @@ public class SchemaManager implements IDatabasePluginRegistryChanged {
if (sql.startsWith("create index")) {
Matcher matcher = createIndexTableNamePattern.matcher(sql);
if (matcher.matches()) {
createSql.set(i,
sql.replace("%TABLE%", matcher.group(1)));
createSql.set(i, StringUtil.replace(sql, TABLE,
matcher.group(1)));
} else if (sql.contains(TABLE)) {
// replace %TABLE% in sql statements with an empty
// string
createSql.set(i, StringUtil.replace(sql, TABLE, ""));
}
}
}

View file

@ -70,7 +70,7 @@
<filter>
<method bean="gfeNotifyFilter" method="isGfeNotification" />
<bean ref="serializationUtil" method="transformToThrift" />
<to uri="jms-generic:topic:edex.alerts.gfe" />
<to uri="jms-generic:topic:edex.alerts.gfe?timeToLive=60000" />
</filter>
<doCatch>
<exception>java.lang.Throwable</exception>

View file

@ -118,7 +118,7 @@
<!-- Convert the topic into a queue so only one consumer gets each message and we still have competing consumers. -->
<route id="gfeDataURINotificationQueueRoute">
<from uri="jms-gfe-notify:topic:edex.alerts?durableSubscriptionName=gfeNotificationSubscription" />
<from uri="jms-gfe-notify:topic:edex.alerts?clientId=gfeNotify&amp;durableSubscriptionName=gfeNotificationSubscription" />
<doTry>
<to uri="jms-generic:queue:gfeDataURINotification"/>
<doCatch>

View file

@ -997,23 +997,29 @@ public class GFEDao extends DefaultPluginDao {
sess = getHibernateTemplate().getSessionFactory()
.openStatelessSession();
tx = sess.beginTransaction();
// use intersection of time range, UPDATE statement don't auto join
// table so have to manually select the id
Query query = sess
.createQuery("UPDATE GridDataHistory SET lastSentTime = ?"
+ " WHERE parent.parmId = ? AND parent.dataTime.validPeriod.start >= ?"
+ " AND parent.dataTime.validPeriod.end >= ?");
query.setParameter(0, parmId);
query.setTimestamp(1, tr.getStart());
+ " WHERE parent.id in (SELECT id FROM GFERecord "
+ " WHERE parmId = ?"
+ " AND dataTime.validPeriod.start < ?"
+ " AND dataTime.validPeriod.end > ?)");
query.setTimestamp(0, sentTime);
query.setParameter(1, parmId);
query.setTimestamp(2, tr.getEnd());
query.setTimestamp(3, tr.getStart());
query.executeUpdate();
// use intersection of time range
query = sess
.createQuery("SELECT hist.parent.dataTime.validPeriod, hist "
+ "FROM GridDataHistory hist"
+ " WHERE hist.parent.parmId = ? AND hist.parent.dataTime.validPeriod.start >= ?"
+ " AND hist.parent.dataTime.validPeriod.end >= ?");
+ " WHERE hist.parent.parmId = ? AND hist.parent.dataTime.validPeriod.start < ?"
+ " AND hist.parent.dataTime.validPeriod.end > ?");
query.setParameter(0, parmId);
query.setTimestamp(1, tr.getStart());
query.setTimestamp(2, tr.getEnd());
query.setTimestamp(1, tr.getEnd());
query.setTimestamp(2, tr.getStart());
rows = query.list();
tx.commit();
} catch (Exception e) {

View file

@ -75,8 +75,8 @@ public class GFELockDao extends CoreDao {
* If errors occur during database interaction
*/
@SuppressWarnings("unchecked")
public Map<ParmID, LockTable> getLocks(final List<ParmID> parmIds, WsId wsId)
throws DataAccessLayerException {
public Map<ParmID, LockTable> getLocks(final Collection<ParmID> parmIds,
WsId wsId) throws DataAccessLayerException {
// Return if no parmIDs are provided
if (parmIds.isEmpty()) {
return Collections.emptyMap();

View file

@ -34,11 +34,10 @@ import jep.JepException;
import com.raytheon.edex.plugin.gfe.config.GFESiteActivation;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfig;
import com.raytheon.edex.plugin.gfe.config.IFPServerConfigManager;
import com.raytheon.edex.plugin.gfe.db.dao.GFEDao;
import com.raytheon.edex.plugin.gfe.exception.GfeConfigurationException;
import com.raytheon.edex.plugin.gfe.server.GridParmManager;
import com.raytheon.edex.plugin.gfe.server.database.GridDatabase;
import com.raytheon.edex.plugin.gfe.util.SendNotifications;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.gfe.GridDataHistory;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
@ -48,7 +47,6 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.edex.core.EDEXUtil;
import com.raytheon.uf.edex.database.plugin.PluginFactory;
/**
* Class to for running the isc scripts
@ -200,28 +198,25 @@ public class IscSendJob implements Runnable {
}
try {
// TODO: Interact with IFPGridDatabase
GFEDao dao = (GFEDao) PluginFactory.getInstance().getPluginDao(
"gfe");
ServerResponse<List<TimeRange>> sr = GridParmManager
.getGridInventory(id);
if (!sr.isOkay()) {
statusHandler.error("Error getting inventory for " + id);
return;
}
WsId wsId = new WsId(InetAddress.getLocalHost(), "ISC", "ISC");
List<GridHistoryUpdateNotification> notifications = new ArrayList<GridHistoryUpdateNotification>(
1);
Map<TimeRange, List<GridDataHistory>> histories = dao
GridDatabase gridDb = GridParmManager.getDb(id.getDbId());
ServerResponse<Map<TimeRange, List<GridDataHistory>>> sr = gridDb
.updateSentTime(id, tr, new Date());
notifications.add(new GridHistoryUpdateNotification(id,
histories, wsId, siteId));
SendNotifications.send(notifications);
} catch (PluginException e) {
statusHandler.error("Error creating GFE dao!", e);
if (sr.isOkay()) {
WsId wsId = new WsId(InetAddress.getLocalHost(), "ISC",
"ISC");
List<GridHistoryUpdateNotification> notifications = new ArrayList<GridHistoryUpdateNotification>(
1);
Map<TimeRange, List<GridDataHistory>> histories = sr
.getPayload();
notifications.add(new GridHistoryUpdateNotification(id,
histories, wsId, siteId));
SendNotifications.send(notifications);
} else {
statusHandler
.error("Error updating last sent times in GFERecords: "
+ sr.getMessages());
}
} catch (Exception e) {
statusHandler.error(
"Error updating last sent times in GFERecords.", e);

View file

@ -479,6 +479,24 @@ public abstract class GridDatabase {
+ this.getClass().getName());
}
/**
* Updates the sent time for all histories of passed parmId during the
* timeRange. The histories are then returned in a map by timeRange.
*
* @param parmId
* the parmId to use
* @param tr
* the time range to update sent time for
* @param sentTime
* the sent time to update to
* @return
*/
public ServerResponse<Map<TimeRange, List<GridDataHistory>>> updateSentTime(
final ParmID parmId, TimeRange tr, Date sentTime) {
throw new UnsupportedOperationException("Not implemented for class "
+ this.getClass().getName());
}
public ServerResponse<?> saveGridSlices(ParmID parmId, TimeRange tr,
List<IGridSlice> sliceData, WsId requestor,
List<TimeRange> skipDelete) {

View file

@ -2555,6 +2555,7 @@ public class IFPGridDatabase extends GridDatabase {
public ServerResponse<?> updatePublishTime(List<GridDataHistory> history,
Date publishTime) {
ServerResponse<?> sr = new ServerResponse<String>();
GFEDao dao = null;
try {
dao = (GFEDao) PluginFactory.getInstance().getPluginDao("gfe");
@ -2566,6 +2567,7 @@ public class IFPGridDatabase extends GridDatabase {
"Unable to update grid history!", e);
sr.addMessage("Error updating history");
}
return sr;
}
@ -2592,4 +2594,35 @@ public class IFPGridDatabase extends GridDatabase {
return rval;
}
/**
* Updates the sent time for all histories of passed parmId during the
* timeRange. The histories are then returned in a map by timeRange.
*
* @param parmId
* the parmId to use
* @param tr
* the time range to update sent time for
* @param sentTime
* the sent time to update to
* @return
*/
@Override
public ServerResponse<Map<TimeRange, List<GridDataHistory>>> updateSentTime(
final ParmID parmId, TimeRange tr, Date sentTime) {
ServerResponse<Map<TimeRange, List<GridDataHistory>>> sr = new ServerResponse<Map<TimeRange, List<GridDataHistory>>>();
try {
ParmID dbParmId = getCachedParmID(parmId);
GFEDao dao = new GFEDao();
sr.setPayload(dao.updateSentTime(dbParmId, tr, sentTime));
} catch (UnknownParmIdException e) {
sr.addMessage(e.getLocalizedMessage());
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to update grid history last sent time", e);
sr.addMessage("Unable to update grid history last sent time");
}
return sr;
}
}

View file

@ -119,12 +119,41 @@ public class LockManager {
}
// extract the ParmIds from the request list
List<ParmID> parmIds = new ArrayList<ParmID>();
Set<ParmID> parmIds = new HashSet<ParmID>();
try {
sr.addMessages(extractParmIds(request, parmIds, siteID));
List<ParmID> nonIfpParmIds = new LinkedList<ParmID>();
sr.setPayload(new ArrayList<LockTable>(dao.getLocks(parmIds,
requestor).values()));
// remove parm IDs that are not persisted to database
Iterator<ParmID> iter = parmIds.iterator();
while (iter.hasNext()) {
ParmID id = iter.next();
if (id.getId() == 0) {
nonIfpParmIds.add(id);
iter.remove();
}
}
List<LockTable> payLoad = null;
if (!parmIds.isEmpty()) {
Map<ParmID, LockTable> lockMap = dao.getLocks(parmIds,
requestor);
payLoad = new ArrayList<LockTable>(lockMap.size()
+ nonIfpParmIds.size());
payLoad.addAll(lockMap.values());
} else {
payLoad = new ArrayList<LockTable>(nonIfpParmIds.size());
}
if (!nonIfpParmIds.isEmpty()) {
for (ParmID id : nonIfpParmIds) {
payLoad.add(new LockTable(id, new ArrayList<Lock>(0),
requestor));
}
}
sr.setPayload(payLoad);
} catch (Exception e) {
logger.error("Error getting lock tables for " + parmIds, e);
sr.addMessage("Error getting lock tables for " + parmIds);
@ -214,12 +243,22 @@ public class LockManager {
return sr;
}
List<ParmID> parmIds = new LinkedList<ParmID>();
Set<ParmID> parmIds = new HashSet<ParmID>();
Map<ParmID, LockTable> lockTableMap;
try {
// extract the ParmIds from the requests
sr.addMessages(extractParmIdsFromLockReq(req, parmIds, siteID));
Iterator<ParmID> iter = parmIds.iterator();
while (iter.hasNext()) {
ParmID id = iter.next();
// non persisted parm IDs cannot be locked
if (id.getId() == 0) {
sr.addMessage("ParmID " + id + " is not a lockable parm");
iter.remove();
}
}
// get the lock tables specific to the extracted parmIds
lockTableMap = dao.getLocks(parmIds, requestor);
} catch (Exception e) {
@ -681,14 +720,14 @@ public class LockManager {
* @throws GfeException
*/
private ServerResponse<?> extractParmIds(List<LockTableRequest> ltrList,
List<ParmID> parmIds, String siteID) throws GfeException {
Set<ParmID> parmIds, String siteID) throws GfeException {
ServerResponse<?> sr = new ServerResponse<String>();
// process each request
for (LockTableRequest ltr : ltrList) {
if (ltr.isParmRequest()) {
ParmID parmId = ltr.getParmId();
// append parm (if not already in the list)
// append parm (if not already in the set)
if (!parmIds.contains(parmId)) {
parmIds.add(GridParmManager.getDb(parmId.getDbId())
.getCachedParmID(parmId));
@ -697,11 +736,7 @@ public class LockManager {
// get all the parmIds for that databaseId
List<ParmID> pids = GridParmManager.getParmList(ltr.getDbId())
.getPayload();
for (ParmID id : pids) {
if (!parmIds.contains(id)) {
parmIds.add(id);
}
}
parmIds.addAll(pids);
} else {
// get all the parms for all the databases
List<DatabaseID> dbids = GridParmManager.getDbInventory(siteID)
@ -709,11 +744,7 @@ public class LockManager {
for (int j = 0; j < dbids.size(); j++) {
List<ParmID> pids = GridParmManager.getParmList(
dbids.get(j)).getPayload();
for (ParmID id : pids) {
if (!parmIds.contains(id)) {
parmIds.add(id);
}
}
parmIds.addAll(pids);
}
}
}
@ -738,7 +769,7 @@ public class LockManager {
* If errors occur
*/
private ServerResponse<?> extractParmIdsFromLockReq(List<LockRequest> lrs,
List<ParmID> parmIds, String siteID) throws GfeException {
Set<ParmID> parmIds, String siteID) throws GfeException {
ServerResponse<?> sr = new ServerResponse<String>();
// process each request

View file

@ -205,7 +205,7 @@ public class GfeIngestNotificationFilter {
// if we don't have the other component for this
// fcstHour
if (otherTimes == null
if ((otherTimes == null)
|| !otherTimes.remove(fcstHour)) {
// need to wait for other component
ParmID compPid = new ParmID(d2dParamName,
@ -372,7 +372,8 @@ public class GfeIngestNotificationFilter {
throws Exception {
byte[] message = SerializationUtil.transformToThrift(notifications);
EDEXUtil.getMessageProducer().sendAsyncUri(
"jms-generic:topic:gfeGribNotification", message);
"jms-generic:topic:gfeGribNotification?timeToLive=60000",
message);
SendNotifications.send(notifications);
}

View file

@ -77,6 +77,8 @@ from com.raytheon.uf.edex.database.cluster import ClusterTask
# 03/12/13 1759 dgilling Remove unnecessary command line
# processing.
# 04/24/13 1941 dgilling Re-port WECache to match A1.
# 05/08/13 1988 dgilling Fix history handling bug in
# __getDbGrid().
#
#
@ -730,12 +732,6 @@ class IscMosaic:
grid = self._wec[tr]
if grid is not None:
destGrid, history = grid
tempHistory = []
for hist in history:
tempHistory.append(hist.getCodedString())
history = tempHistory
self.__dbGrid = (destGrid, history, tr)
else:
self.logProblem("Unable to access grid for ",
@ -743,6 +739,7 @@ class IscMosaic:
return None
return (self.__dbGrid[0], self.__dbGrid[1])
#---------------------------------------------------------------------
# calculate file start/end processing times
# Returns (startTime, endTime) or None for processing

View file

@ -83,7 +83,7 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* that sent notification to D2DParmIdCache.
* 01/14/13 #1469 bkowal Removed the hdf5 data directory
* 04/08/13 #1293 bkowal Removed references to hdffileid.
*
* 05/08/13 1814 rjpeter Added time to live to topic message
* </pre>
*
* @author bphillip
@ -101,7 +101,7 @@ public class GribDao extends PluginDao {
private static final String THINNED_PTS = "thinnedPts";
private static final String PURGE_MODEL_CACHE_TOPIC = "jms-generic:topic:purgeGribModelCache";
private static final String PURGE_MODEL_CACHE_TOPIC = "jms-generic:topic:purgeGribModelCache?timeToLive=60000";
/**
* Creates a new GribPyDao object
@ -171,7 +171,7 @@ public class GribDao extends PluginDao {
IPersistable obj) throws Exception {
GribRecord gribRec = (GribRecord) obj;
if (gribRec.getMessageData() != null
if ((gribRec.getMessageData() != null)
&& !gribRec.getModelInfo().getParameterName().equals("Missing")) {
AbstractStorageRecord storageRecord = null;
AbstractStorageRecord localSection = null;
@ -182,8 +182,8 @@ public class GribDao extends PluginDao {
* Stores the binary data to the HDF5 data store
*/
if (gribRec.getMessageData() instanceof float[]) {
if (gribRec.getSpatialObject() != null
&& gribRec.getMessageData() != null) {
if ((gribRec.getSpatialObject() != null)
&& (gribRec.getMessageData() != null)) {
long[] sizes = new long[] {
(gribRec.getSpatialObject()).getNx(),
(gribRec.getSpatialObject()).getNy() };
@ -316,7 +316,7 @@ public class GribDao extends PluginDao {
for (PluginDataObject record : records) {
GribRecord rec = (GribRecord) record;
GribModel model = rec.getModelInfo();
if (model.getParameterName() == null
if ((model.getParameterName() == null)
|| model.getParameterName().equals("Missing")) {
logger.info("Discarding record due to missing or unknown parameter mapping: "
+ record);
@ -327,7 +327,7 @@ public class GribDao extends PluginDao {
if (level != null) {
MasterLevel ml = level.getMasterLevel();
if (ml != null
if ((ml != null)
&& !LevelFactory.UNKNOWN_LEVEL.equals(ml.getName())) {
validLevel = true;
}
@ -362,7 +362,7 @@ public class GribDao extends PluginDao {
for (PluginDataObject record : records) {
GribRecord rec = (GribRecord) record;
GribModel model = rec.getModelInfo();
if (model.getParameterName() == null
if ((model.getParameterName() == null)
|| model.getParameterName().equals("Missing")) {
logger.info("Discarding record due to missing or unknown parameter mapping: "
+ record);
@ -373,7 +373,7 @@ public class GribDao extends PluginDao {
if (level != null) {
MasterLevel ml = level.getMasterLevel();
if (ml != null
if ((ml != null)
&& !LevelFactory.UNKNOWN_LEVEL.equals(ml.getName())) {
validLevel = true;
}

View file

@ -58,6 +58,8 @@ import com.raytheon.uf.common.util.mapping.MultipleMappingException;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 29, 2013 DR 15715 dhuffman Near line 202; Transposed edex site and base precedence
* per DR: loading was in reverse.
* Apr 30, 2013 bsteffen Initial javadoc
* Apr 30, 2013 1961 bsteffen Add ability to disable grib tables.
*
@ -199,8 +201,8 @@ public class GribModelLookup {
LocalizationFile[] modelFiles = PathManagerFactory.getPathManager()
.listFiles(
new LocalizationContext[] { edexStaticSite,
edexStaticBase },
new LocalizationContext[] { edexStaticBase,
edexStaticSite },
"grib" + IPathManager.SEPARATOR + "models", // Win32
new String[] { ".xml" }, false, true);

View file

@ -37,6 +37,7 @@ import org.apache.commons.logging.LogFactory;
* 20080512 1131 jkorman Initial implementation.
* Apr 29, 2013 1958 bgonzale Added class RedbookBlockHeader,
* and nested Factory interface.
* May 06, 2013 1979 bgonzale Catch Header at the end of buffer.
*
* </pre>
*
@ -76,7 +77,7 @@ public abstract class RedbookBlock {
this.header = header;
hasLength = (this.header.hdr & LEN_MASK) == 0;
hasLength = ((this.header.hdr & LEN_MASK) == 0 && data.hasRemaining());
hasChkSum = (this.header.hdr & CHKSUM_MASK) == 0;

View file

@ -26,7 +26,6 @@ import java.util.Map;
import java.util.Properties;
import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlock.RedbookBlockFactory;
import com.raytheon.edex.plugin.redbook.decoder.RedbookFcstMap;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.util.PropertiesUtil;
@ -55,8 +54,8 @@ import com.raytheon.uf.common.util.ReflectionUtil;
* @version 1.0
*/
public class RedbookBlockBuilder {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(RedbookFcstMap.class);
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(RedbookBlockBuilder.class);
private static final int MIN_REMAINING = 4;

View file

@ -51,6 +51,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* routine.
* 4 Dec 2012 #15569 lbousaidi fixed daily pp value when token is set to USE_REVCODE
* 02 Feb 2012 #15845 lbousaidi added check for data that comes in as -999
* 07 May 2013 #15880 lbousaidi changed pPE parameter because it was inserting to the
* wrong hour field.
* </pre>
*
* @author mnash
@ -559,10 +561,10 @@ public class GagePP {
int minute = dt.get(Calendar.MINUTE);
if (((pPE.charAt(1) == 'P' && minute >= MINUTES_PER_HOUR
- pOptions.getIntlppp()))
|| (pPE.charAt(1) == 'C' && minute >= MINUTES_PER_HOUR
- pOptions.getIntpc())) {
if (rec.getPhysicalElement().getCode().charAt(1) == 'C'
&& minute >= MINUTES_PER_HOUR - pOptions.getIntpc()
|| (pPE.charAt(1) == 'P'
&& minute >= MINUTES_PER_HOUR - pOptions.getIntlppp())) {
hour++;
dt.add(Calendar.HOUR_OF_DAY, 1);
rec.setObsTime(dt.getTime());

View file

@ -52,6 +52,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 5, 2008 1649 snaples Initial creation
* May 7, 2013 15880 lbousaidi changed minute_offset to offset in
* in write_1_HourValue routine.
*
* </pre>
*
@ -253,7 +255,7 @@ public final class GagePPWrite {
pHid.setTs(ts);
pHid.setObsdate(obsDate);
pHourpc.setId(pHid);
pHourpc.setMinuteOffset(new String(minute_offset));
pHourpc.setMinuteOffset(new String(offset));
pHourpc.setHourlyQc(new String(qc));
PrecipUtils.set_hour_slot_value(pHourpc, hr, newDataValue);
rec = pHourpc;

View file

@ -152,7 +152,7 @@
<method bean="textDecoder" method="separator" />
<bean ref="textDecoder" method="transformToSimpleString" />
<bean ref="serializationUtil" method="transformToThrift"/>
<to uri="jms-text:topic:edex.alarms.msg" />
<to uri="jms-text:topic:edex.alarms.msg?timeToLive=60000" />
</split>
</route>

View file

@ -19,7 +19,6 @@
further_licensing_information.
-->
<requestPatterns xmlns:ns2="group">
<regex>AWIPS_*</regex>
<regex>FAA_*</regex>
<regex>WWLLN_*</regex>
</requestPatterns>
</requestPatterns>

View file

@ -21,6 +21,7 @@ package com.raytheon.edex.plugin.warning.gis;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@ -65,10 +66,16 @@ import com.raytheon.uf.edex.database.cluster.ClusterLockUtils.LockState;
import com.raytheon.uf.edex.database.cluster.ClusterTask;
import com.raytheon.uf.edex.database.dao.CoreDao;
import com.raytheon.uf.edex.database.dao.DaoConfig;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryCollection;
import com.vividsolutions.jts.geom.GeometryCollectionIterator;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineString;
import com.vividsolutions.jts.geom.LinearRing;
import com.vividsolutions.jts.geom.MultiPolygon;
import com.vividsolutions.jts.geom.Point;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.geom.prep.PreparedGeometry;
import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
@ -85,6 +92,7 @@ import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
* Jul 18, 2011 rjpeter Initial creation
* Mar 29, 2012 #14691 Qinglu Lin Added returned value of getFeArea() of
* AreaConfiguration to areaFields List.
* May 7, 2013 15690 Qinglu Lin Added convertToMultiPolygon() and updated queryGeospatialData().
* </pre>
*
* @author rjpeter
@ -382,6 +390,36 @@ public class GeospatialDataGenerator {
SpatialQueryResult[] features = SpatialQueryFactory.create().query(
areaSource, areaFields.toArray(new String[areaFields.size()]),
null, map, SearchMode.WITHIN);
// clip against County Warning Area
String cwaSource = "cwa";
List<String> cwaAreaFields = new ArrayList<String>(Arrays.asList("wfo", "gid"));
HashMap<String, RequestConstraint> cwaMap = new HashMap<String, RequestConstraint>(
2);
cwaMap.put("wfo", new RequestConstraint(site, ConstraintType.LIKE));
SpatialQueryResult[] cwaFeatures = SpatialQueryFactory.create().query(
cwaSource, cwaAreaFields.toArray(new String[cwaAreaFields.size()]),
null, cwaMap, SearchMode.WITHIN);
Geometry multiPolygon = null;
Geometry clippedGeom = null;
for (int i = 0; i < features.length; i++) {
multiPolygon = null;
for (int j = 0; j < cwaFeatures.length; j++) {
clippedGeom = features[i].geometry.intersection(cwaFeatures[j].geometry);
if (clippedGeom instanceof GeometryCollection) {
GeometryCollection gc = (GeometryCollection)clippedGeom;
if (multiPolygon != null)
multiPolygon = multiPolygon.union(convertToMultiPolygon(gc));
else
multiPolygon = convertToMultiPolygon(gc);
}
}
if (multiPolygon != null)
features[i].geometry = multiPolygon;
else if (clippedGeom != null)
features[i].geometry = clippedGeom;
}
topologySimplifyQueryResults(features);
// convert to GeospatialData
@ -398,6 +436,66 @@ public class GeospatialDataGenerator {
return rval;
}
/**
* Convert a GeometryCollection to a MultiPolygon.
* @param gc
*/
private static MultiPolygon convertToMultiPolygon(GeometryCollection gc) {
GeometryCollectionIterator iter = new GeometryCollectionIterator(gc);
Set<Polygon> polygons = new HashSet<Polygon>();
MultiPolygon mp = null;
iter.next();
while (iter.hasNext()) {
Object o = iter.next();
if (o instanceof MultiPolygon) {
if (mp == null)
mp = (MultiPolygon)o;
else
mp = (MultiPolygon)mp.union((MultiPolygon)o);
} else if (o instanceof Polygon) {
polygons.add((Polygon)o);
} else if (o instanceof LineString || o instanceof Point) {
LinearRing lr = null;
Coordinate[] coords = null;
if (o instanceof LineString) {
Coordinate[] cs = ((LineString) o).getCoordinates();
if (cs.length < 4) {
coords = new Coordinate[4];
for (int j = 0; j< cs.length; j++)
coords[j] = new Coordinate(cs[j]);
for (int j = cs.length; j < 4; j++)
coords[j] = new Coordinate(cs[3-j]);
} else {
coords = new Coordinate[cs.length+1];
for (int j = 0; j < cs.length; j++)
coords[j] = new Coordinate(cs[j]);
coords[cs.length] = new Coordinate(cs[0]);
}
} else {
coords = new Coordinate[4];
for (int i = 0; i < 4; i++)
coords[i] = ((Point)o).getCoordinate();
}
lr = (((Geometry)o).getFactory()).createLinearRing(coords);
Polygon poly = (new GeometryFactory()).createPolygon(lr, null);
polygons.add((Polygon)poly);
} else {
statusHandler.handle(Priority.WARN,
"Unprocessed Geometry object: " + o.getClass().getName());
}
}
if (mp == null && polygons.size() == 0)
return null;
if (polygons.size() > 0) {
Polygon[] p = polygons.toArray(new Polygon[0]);
if (mp != null)
mp = (MultiPolygon)mp.union(new MultiPolygon(p, gc.getFactory()));
else
mp = new MultiPolygon(p, gc.getFactory());
}
return mp;
}
/**
* Simplifies the overall geometries using a single collection to preserve
* boundaries. Geometries are updated in place.

View file

@ -44,7 +44,7 @@
<route id="utilityNotify">
<from uri="vm://utilityNotify" />
<bean ref="serializationUtil" method="transformToThrift" />
<to uri="jms-generic:topic:edex.alerts.utility" />
<to uri="jms-generic:topic:edex.alerts.utility?timeToLive=60000" />
</route>
</camelContext>

View file

@ -49,7 +49,8 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
* 06/22/09 2152 D. Hladky Initial release
* 01/27/13 1478 D. Hladky Added support for write of aggregate record cache
* 01/27/13 1569 D. Hladky Added support for write of aggregate record cache
* Apr 16, 2013 1912 bsteffen Initial bulk hdf5 access for ffmp
* 04/16/13 1912 bsteffen Initial bulk hdf5 access for ffmp
* 05/09/13 1919 mpduff Use parent pfaf instead of lookupId.
*
* </pre>
*
@ -58,10 +59,6 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
*/
@DynamicSerialize
public class FFMPBasinData implements ISerializableObject {
/**
*
*/
private static final long serialVersionUID = 8162247989509750715L;
public static final double GUIDANCE_MISSING = -999999.0;
@ -76,12 +73,12 @@ public class FFMPBasinData implements ISerializableObject {
/**
* Pending load tasks that need to be run to fully populate basins
*/
private List<LoadTask> tasks = new ArrayList<LoadTask>();
private final List<LoadTask> tasks = new ArrayList<LoadTask>();
/**
* Cache of basins in order for easy population from Load Tasks.
*/
private Map<String, FFMPBasin[]> orderedBasinsCache = new HashMap<String, FFMPBasin[]>();
private final Map<String, FFMPBasin[]> orderedBasinsCache = new HashMap<String, FFMPBasin[]>();
/**
* Public one arg constructor
@ -690,7 +687,7 @@ public class FFMPBasinData implements ISerializableObject {
FFMPBasin basin = this.basins.get(fvgbmd.getLookupId());
if (basin == null) {
basin = new FFMPVirtualGageBasin(fvgbmd.getLid(),
fvgbmd.getLookupId(), false);
fvgbmd.getParentPfaf(), false);
this.basins.put(fvgbmd.getLookupId(), basin);
}
basins[j++] = basin;
@ -702,6 +699,9 @@ public class FFMPBasinData implements ISerializableObject {
}
}
/**
* Load now.
*/
public void loadNow() {
synchronized (tasks) {
if (!tasks.isEmpty()) {
@ -728,6 +728,9 @@ public class FFMPBasinData implements ISerializableObject {
this.date = date;
}
/**
* {@inheritDoc}
*/
@Override
public void process(FloatDataRecord record) {
float[] values = record.getFloatData();
@ -736,6 +739,9 @@ public class FFMPBasinData implements ISerializableObject {
}
}
/**
* Apply the value to the basin/
*/
protected void applyValue(FFMPBasin basin, float value) {
if (basin.contains(date)) {
float curval = basin.getValue(date);

View file

@ -71,6 +71,7 @@ import com.vividsolutions.jts.simplify.TopologyPreservingSimplifier;
* Dec 9, 2010 rjpeter Initial creation
* Apr 25, 2013 1954 bsteffen Decompress ffmp geometries to save time
* loading them.
* Apr 25, 2013 1954 bsteffen Undo last commit to avoid invalid geoms.
*
* </pre>
*

View file

@ -35,6 +35,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 21, 2011 mschenke Initial creation
* 05/02/2013 DR 14587 D. Friedman Store base velocity
*
* </pre>
*
@ -44,6 +45,8 @@ import com.vividsolutions.jts.geom.Coordinate;
public class RadarDataInterrogator {
public enum DataType { BASE_VELOCITY }
private double lastRange;
private double lastAzimuth;
@ -75,12 +78,20 @@ public class RadarDataInterrogator {
}
public int getDataValue(RadarRecord record, Coordinate latLon) {
return getDataValue(record, latLon, (DataType) null);
}
public int getDataValue(RadarRecord record, Coordinate latLon, DataType dataType) {
this.record = record;
return getDataValue(latLon);
return getDataValue(latLon, dataType);
}
public int getDataValue(Coordinate latLon) {
int[] rval = getDataValues(new Coordinate[] { latLon });
return getDataValue(latLon, null);
}
public int getDataValue(Coordinate latLon, DataType dataType) {
int[] rval = getDataValues(new Coordinate[] { latLon }, dataType);
if (rval != null && rval.length > 0) {
return rval[0];
}
@ -88,6 +99,10 @@ public class RadarDataInterrogator {
return 0;
}
public int[] getDataValues(Coordinate[] latLonArray) {
return getDataValues(latLonArray, null);
}
/**
* Used to return the data value for the lat/lon passed in. Used for raster
* and radial data. Use the getGraphicDataValue() method for graphic data.
@ -95,7 +110,7 @@ public class RadarDataInterrogator {
* @param latLon
* @return
*/
public int[] getDataValues(Coordinate[] latLonArray) {
public int[] getDataValues(Coordinate[] latLonArray, DataType dataType) {
double[] input = new double[latLonArray.length * 2];
double[] output = new double[input.length];
@ -207,7 +222,7 @@ public class RadarDataInterrogator {
if (this.lastRadialIndex >= 0 && this.lastBin >= startBin
&& this.lastRadialIndex < record.getNumRadials()
&& this.lastBin < endBin) {
if (record.srmData != null) {
if (record.srmData != null && dataType != DataType.BASE_VELOCITY) {
rval[index] = RadarRecordUtil.getSRMDataValue(
record, this.lastRadialIndex, this.lastBin
- startBin) & 0xFF;

View file

@ -65,6 +65,26 @@ import com.raytheon.uf.common.util.ConvertUtil;
* plugin specific data type would be called SatelliteRecord.
*
* <pre>
* Hibernate Annotation Requirements for "@Entity" annotated classes that are subclasses
* of PluginDataObject
*
* 1) If it is not abstract and not a super class for "@Entity" annotated
* subclasses, then add a SequenceGenerator annotation:
* "@SequenceGenerator(initialValue = 1, name = PluginDataObject.ID_GEN, sequenceName = "
* <tablename>seq")"
*
* 2) If it is abstract and a super class for @Entity annotated subclasses:
*
* - if there are "@ManyToOne" or "@OneToMany" relationships to the class, then
* an "@Entity" annotation has to be used otherwise use a "@MappedSuperClass"
* annotation
*
* - Add an "@Inheritance" annotation
* "@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)"
*
* - Add an "@Sequence" annotation
* "@SequenceGenerator(name = PluginDataObject.ID_GEN)"
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------

View file

@ -38,6 +38,7 @@ import org.apache.commons.lang.StringUtils;
* Oct 20, 2011 rferrel Initial creation
* Jul 13, 2012 740 djohnson Add join.
* Nov 09, 2012 1322 djohnson Add NEWLINE, createMessage.
* Mar 02, 2013 1970 bgonzale Added fast string replacement method.
*
* </pre>
*
@ -185,4 +186,27 @@ public final class StringUtil {
return msg.toString();
}
/**
* Fast replacement of all String target elements in String source with
* String replacement.
*
* @param source
* String that instances will be replaced in.
* @param target
* @param replacement
* @return a new String equivalent to source with target Strings replaced by
* String replacement
*/
public static String replace(final String source, final String target,
final String replacement) {
int targetIndex = 0;
StringBuilder sb = new StringBuilder(source);
while ((targetIndex = sb.indexOf(target, targetIndex)) > -1) {
sb.replace(targetIndex, targetIndex + target.length(), replacement);
targetIndex += replacement.length();
}
return sb.toString();
}
}

View file

@ -44,7 +44,7 @@
<route id="vtecNotify">
<from uri="vm:edex.vtecAlert" />
<bean ref="serializationUtil" method="transformToThrift" />
<to uri="jms-generic:topic:edex.alerts.vtec" />
<to uri="jms-generic:topic:edex.alerts.vtec?timeToLive=60000" />
</route>
<route id="practiceVtecRoute">
<from uri="jms-activetable:queue:practiceActiveTable?concurrentConsumers=1" />

View file

@ -46,7 +46,7 @@
<bean class="com.raytheon.uf.edex.plugin.grid.dao.GridDao"
factory-method="setPurgeModelCacheTopic">
<constructor-arg value="jms-generic:topic:purgeGridInfoCache" />
<constructor-arg value="jms-generic:topic:purgeGridInfoCache?timeToLive=60000" />
</bean>
<camelContext id="grid-common-camel" xmlns="http://camel.apache.org/schema/spring"

View file

@ -36,8 +36,8 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 2, 2012 dgilling Initial creation
*
* Nov 2, 2012 dgilling Initial creation
* May 08, 2013 1814 rjpeter Added time to live to topic.
* </pre>
*
* @author dgilling
@ -47,7 +47,7 @@ import com.raytheon.uf.edex.plugin.grid.dao.GridDao;
public class DeleteAllGridDataHandler implements
IRequestHandler<DeleteAllGridDataRequest> {
private static final String PLUGIN_PURGED_TOPIC = "jms-generic:topic:pluginPurged";
private static final String PLUGIN_PURGED_TOPIC = "jms-generic:topic:pluginPurged?timeToLive=60000";
/*
* (non-Javadoc)

View file

@ -45,7 +45,7 @@ import com.raytheon.uf.edex.database.purge.PurgeLogger;
* ------------ ---------- ----------- --------------------------
* Apr 19, 2012 #470 bphillip Initial creation
* Jun 20, 2012 NC#606 ghull send purge-complete messages
*
* May 08, 2013 1814 rjpeter Added time to live to topic
* </pre>
*
* @author bphillip
@ -53,261 +53,265 @@ import com.raytheon.uf.edex.database.purge.PurgeLogger;
*/
public class PurgeJob extends Thread {
/** The type of purge */
public enum PURGE_JOB_TYPE {
PURGE_ALL, PURGE_EXPIRED
}
public static final String PLUGIN_PURGED_TOPIC = "jms-generic:topic:pluginPurged";
/** The type of purge */
public enum PURGE_JOB_TYPE {
PURGE_ALL, PURGE_EXPIRED
}
private long startTime;
public static final String PLUGIN_PURGED_TOPIC = "jms-generic:topic:pluginPurged?timeToLive=60000";
/** The cluster task name to use for purge jobs */
public static final String TASK_NAME = "Purge Plugin Data";
private long startTime;
/** The plugin associated with this purge job */
private String pluginName;
/** The cluster task name to use for purge jobs */
public static final String TASK_NAME = "Purge Plugin Data";
/** The type of purge job being executed */
private PURGE_JOB_TYPE purgeType;
/** The plugin associated with this purge job */
private final String pluginName;
/** Last time job has printed a timed out message */
private long lastTimeOutMessage = 0;
private PurgeManager purgeManager;
/** The type of purge job being executed */
private final PURGE_JOB_TYPE purgeType;
/**
* Creates a new Purge job for the specified plugin.
*
* @param pluginName
* The plugin to be purged
* @param purgeType
* The type of purge to be executed
*/
public PurgeJob(String pluginName, PURGE_JOB_TYPE purgeType, PurgeManager purgeManager) {
// Give the thread a name
this.setName("Purge-" + pluginName.toUpperCase() + "-Thread");
this.pluginName = pluginName;
this.purgeType = purgeType;
this.purgeManager = purgeManager;
}
/** Last time job has printed a timed out message */
private final long lastTimeOutMessage = 0;
public void run() {
private PurgeManager purgeManager;
// Flag used to track if this job has failed
boolean failed = false;
startTime = System.currentTimeMillis();
PurgeLogger.logInfo("Purging expired data...", pluginName);
PluginDao dao = null;
/**
* Creates a new Purge job for the specified plugin.
*
* @param pluginName
* The plugin to be purged
* @param purgeType
* The type of purge to be executed
*/
public PurgeJob(String pluginName, PURGE_JOB_TYPE purgeType, PurgeManager purgeManager) {
// Give the thread a name
this.setName("Purge-" + pluginName.toUpperCase() + "-Thread");
this.pluginName = pluginName;
this.purgeType = purgeType;
this.purgeManager = purgeManager;
}
try {
dao = PluginFactory.getInstance().getPluginDao(pluginName);
if (dao.getDaoClass() != null) {
dao.purgeExpiredData();
PurgeLogger.logInfo("Data successfully Purged!", pluginName);
@Override
public void run() {
EDEXUtil.getMessageProducer().sendAsyncUri( PLUGIN_PURGED_TOPIC, pluginName );
} else {
Method m = dao.getClass().getMethod("purgeExpiredData",
new Class[] {});
if (m != null) {
if (m.getDeclaringClass().equals(PluginDao.class)) {
PurgeLogger
.logWarn(
"Unable to purge data. This plugin does not specify a record class and does not implement a custom purger.",
pluginName);
} else {
if (this.purgeType.equals(PURGE_JOB_TYPE.PURGE_EXPIRED)) {
dao.purgeExpiredData();
} else {
dao.purgeAllData();
}
// Flag used to track if this job has failed
boolean failed = false;
startTime = System.currentTimeMillis();
PurgeLogger.logInfo("Purging expired data...", pluginName);
PluginDao dao = null;
PurgeLogger.logInfo("Data successfully Purged!", pluginName);
try {
dao = PluginFactory.getInstance().getPluginDao(pluginName);
if (dao.getDaoClass() != null) {
dao.purgeExpiredData();
EDEXUtil.getMessageProducer().sendAsyncUri( PLUGIN_PURGED_TOPIC, pluginName );
}
}
}
} catch (Exception e) {
failed = true;
// keep getting next exceptions with sql exceptions to ensure
// we can see the underlying error
PurgeLogger
.logError("Error purging expired data!\n", pluginName, e);
Throwable t = e.getCause();
while (t != null) {
if (t instanceof SQLException) {
SQLException se = ((SQLException) t).getNextException();
PurgeLogger.logError("Next exception:", pluginName, se);
}
t = t.getCause();
}
} finally {
ClusterTask purgeLock = purgeManager.getPurgeLock();
try {
/*
* Update the status accordingly if the purge failed or
* succeeded
*/
PurgeDao purgeDao = new PurgeDao();
PurgeJobStatus status = purgeDao
.getJobForPlugin(this.pluginName);
if (status == null) {
PurgeLogger.logError(
"Purge job completed but no status object found!",
this.pluginName);
} else {
if (failed) {
status.incrementFailedCount();
if (status.getFailedCount() >= purgeManager.getFatalFailureCount()) {
PurgeLogger
.logFatal(
"Purger for this plugin has reached or exceeded consecutive failure limit of "
+ purgeManager
.getFatalFailureCount()
+ ". Data will no longer being purged for this plugin.",
pluginName);
} else {
PurgeLogger.logError("Purge job has failed "
+ status.getFailedCount()
+ " consecutive times.", this.pluginName);
// Back the start time off by half an hour to try to
// purgin soon, don't want to start immediately so
// it doesn't ping pong between servers in a time
// out scenario
Date startTime = status.getStartTime();
startTime.setTime(startTime.getTime() - (1800000));
}
} else {
status.setFailedCount(0);
}
PurgeLogger.logInfo("Data successfully Purged!", pluginName);
/*
* This purger thread has exceeded the time out duration but
* finally finished. Output a message and update the status
*/
int deadPurgeJobAge = purgeManager
.getDeadPurgeJobAge();
Calendar purgeTimeOutLimit = Calendar.getInstance();
purgeTimeOutLimit.setTimeZone(TimeZone.getTimeZone("GMT"));
purgeTimeOutLimit.add(Calendar.MINUTE, -deadPurgeJobAge);
if (startTime < purgeTimeOutLimit.getTimeInMillis()) {
PurgeLogger
.logInfo(
"Purge job has recovered from timed out state!!",
pluginName);
}
status.setRunning(false);
purgeDao.update(status);
/*
* Log execution times
*/
long executionTime = getAge();
long execTimeInMinutes = executionTime / 60000;
if (execTimeInMinutes > 0) {
PurgeLogger.logInfo("Purge run time: " + executionTime
+ " ms (" + execTimeInMinutes + " minutes)",
this.pluginName);
} else {
PurgeLogger.logInfo("Purge run time: " + executionTime
+ " ms", this.pluginName);
}
}
} catch (Throwable e) {
PurgeLogger
.logError(
"An unexpected error occurred upon completion of the purge job",
this.pluginName, e);
} finally {
ClusterLockUtils.unlock(purgeLock, false);
}
}
}
EDEXUtil.getMessageProducer().sendAsyncUri(PLUGIN_PURGED_TOPIC,
pluginName);
public void printTimedOutMessage(int deadPurgeJobAge) {
// only print message every 5 minutes
if (System.currentTimeMillis() - lastTimeOutMessage > 300000) {
PurgeLogger.logFatal(
"Purger running time has exceeded timeout duration of "
+ deadPurgeJobAge
+ " minutes. Current running time: "
+ (getAge() / 60000) + " minutes", pluginName);
printStackTrace();
}
}
} else {
Method m = dao.getClass().getMethod("purgeExpiredData",
new Class[] {});
if (m != null) {
if (m.getDeclaringClass().equals(PluginDao.class)) {
PurgeLogger
.logWarn(
"Unable to purge data. This plugin does not specify a record class and does not implement a custom purger.",
pluginName);
} else {
if (this.purgeType.equals(PURGE_JOB_TYPE.PURGE_EXPIRED)) {
dao.purgeExpiredData();
} else {
dao.purgeAllData();
}
/**
* Prints the stack trace for this job thread.
*/
public void printStackTrace() {
StringBuffer buffer = new StringBuffer();
buffer.append("Stack trace for Purge Job Thread:\n");
buffer.append(getStackTrace(this));
// If this thread is blocked, output the stack traces for the other
// blocked threads to assist in determining the source of the
// deadlocked
// threads
if (this.getState().equals(State.BLOCKED)) {
buffer.append("\tDUMPING OTHER BLOCKED THREADS\n");
buffer.append(getBlockedStackTraces());
PurgeLogger.logInfo("Data successfully Purged!",
pluginName);
}
PurgeLogger.logError(buffer.toString(), this.pluginName);
EDEXUtil.getMessageProducer().sendAsyncUri(
PLUGIN_PURGED_TOPIC, pluginName);
}
}
}
} catch (Exception e) {
failed = true;
// keep getting next exceptions with sql exceptions to ensure
// we can see the underlying error
PurgeLogger
.logError("Error purging expired data!\n", pluginName, e);
Throwable t = e.getCause();
while (t != null) {
if (t instanceof SQLException) {
SQLException se = ((SQLException) t).getNextException();
PurgeLogger.logError("Next exception:", pluginName, se);
}
t = t.getCause();
}
} finally {
ClusterTask purgeLock = purgeManager.getPurgeLock();
try {
/*
* Update the status accordingly if the purge failed or
* succeeded
*/
PurgeDao purgeDao = new PurgeDao();
PurgeJobStatus status = purgeDao
.getJobForPlugin(this.pluginName);
if (status == null) {
PurgeLogger.logError(
"Purge job completed but no status object found!",
this.pluginName);
} else {
if (failed) {
status.incrementFailedCount();
if (status.getFailedCount() >= purgeManager.getFatalFailureCount()) {
PurgeLogger
.logFatal(
"Purger for this plugin has reached or exceeded consecutive failure limit of "
+ purgeManager
.getFatalFailureCount()
+ ". Data will no longer being purged for this plugin.",
pluginName);
} else {
PurgeLogger.logError("Purge job has failed "
+ status.getFailedCount()
+ " consecutive times.", this.pluginName);
// Back the start time off by half an hour to try to
// purgin soon, don't want to start immediately so
// it doesn't ping pong between servers in a time
// out scenario
Date startTime = status.getStartTime();
startTime.setTime(startTime.getTime() - (1800000));
}
} else {
status.setFailedCount(0);
}
}
/*
* This purger thread has exceeded the time out duration but
* finally finished. Output a message and update the status
*/
int deadPurgeJobAge = purgeManager
.getDeadPurgeJobAge();
Calendar purgeTimeOutLimit = Calendar.getInstance();
purgeTimeOutLimit.setTimeZone(TimeZone.getTimeZone("GMT"));
purgeTimeOutLimit.add(Calendar.MINUTE, -deadPurgeJobAge);
if (startTime < purgeTimeOutLimit.getTimeInMillis()) {
PurgeLogger
.logInfo(
"Purge job has recovered from timed out state!!",
pluginName);
}
status.setRunning(false);
purgeDao.update(status);
/*
* Log execution times
*/
long executionTime = getAge();
long execTimeInMinutes = executionTime / 60000;
if (execTimeInMinutes > 0) {
PurgeLogger.logInfo("Purge run time: " + executionTime
+ " ms (" + execTimeInMinutes + " minutes)",
this.pluginName);
} else {
PurgeLogger.logInfo("Purge run time: " + executionTime
+ " ms", this.pluginName);
}
}
} catch (Throwable e) {
PurgeLogger
.logError(
"An unexpected error occurred upon completion of the purge job",
this.pluginName, e);
} finally {
ClusterLockUtils.unlock(purgeLock, false);
}
}
}
/**
* Gets the stack traces for all other threads in the BLOCKED state in the
* JVM
*
* @return The stack traces for all other threads in the BLOCKED state in
* the JVM
*/
private String getBlockedStackTraces() {
StringBuffer buffer = new StringBuffer();
Map<Thread, StackTraceElement[]> threads = Thread.getAllStackTraces();
for (Thread t : threads.keySet()) {
if (t.getState().equals(State.BLOCKED)) {
if (t.getId() != this.getId()) {
buffer.append(getStackTrace(t));
}
}
}
public void printTimedOutMessage(int deadPurgeJobAge) {
// only print message every 5 minutes
if (System.currentTimeMillis() - lastTimeOutMessage > 300000) {
PurgeLogger.logFatal(
"Purger running time has exceeded timeout duration of "
+ deadPurgeJobAge
+ " minutes. Current running time: "
+ (getAge() / 60000) + " minutes", pluginName);
printStackTrace();
}
}
return buffer.toString();
}
/**
* Prints the stack trace for this job thread.
*/
public void printStackTrace() {
StringBuffer buffer = new StringBuffer();
buffer.append("Stack trace for Purge Job Thread:\n");
buffer.append(getStackTrace(this));
// If this thread is blocked, output the stack traces for the other
// blocked threads to assist in determining the source of the
// deadlocked
// threads
if (this.getState().equals(State.BLOCKED)) {
buffer.append("\tDUMPING OTHER BLOCKED THREADS\n");
buffer.append(getBlockedStackTraces());
/**
* Gets the stack trace for the given thread
*
* @param thread
* The thread to get the stack trace for
* @return The stack trace as a String
*/
private String getStackTrace(Thread thread) {
StringBuffer buffer = new StringBuffer();
StackTraceElement[] stack = Thread.getAllStackTraces().get(thread);
buffer.append("\tThread ID: ").append(thread.getId())
.append(" Thread state: ").append(this.getState())
.append("\n");
if (stack == null) {
buffer.append("No stack trace could be retrieved for this thread");
} else {
for (int i = 0; i < stack.length; i++) {
buffer.append("\t\t").append(stack[i]).append("\n");
}
}
return buffer.toString();
}
}
PurgeLogger.logError(buffer.toString(), this.pluginName);
public long getStartTime() {
return startTime;
}
}
public long getAge() {
return System.currentTimeMillis() - startTime;
}
/**
* Gets the stack traces for all other threads in the BLOCKED state in the
* JVM
*
* @return The stack traces for all other threads in the BLOCKED state in
* the JVM
*/
private String getBlockedStackTraces() {
StringBuffer buffer = new StringBuffer();
Map<Thread, StackTraceElement[]> threads = Thread.getAllStackTraces();
for (Thread t : threads.keySet()) {
if (t.getState().equals(State.BLOCKED)) {
if (t.getId() != this.getId()) {
buffer.append(getStackTrace(t));
}
}
}
return buffer.toString();
}
/**
* Gets the stack trace for the given thread
*
* @param thread
* The thread to get the stack trace for
* @return The stack trace as a String
*/
private String getStackTrace(Thread thread) {
StringBuffer buffer = new StringBuffer();
StackTraceElement[] stack = Thread.getAllStackTraces().get(thread);
buffer.append("\tThread ID: ").append(thread.getId())
.append(" Thread state: ").append(this.getState())
.append("\n");
if (stack == null) {
buffer.append("No stack trace could be retrieved for this thread");
} else {
for (StackTraceElement element : stack) {
buffer.append("\t\t").append(element).append("\n");
}
}
return buffer.toString();
}
public long getStartTime() {
return startTime;
}
public long getAge() {
return System.currentTimeMillis() - startTime;
}
}

View file

@ -28,7 +28,7 @@
<method bean="siteActivateNotifyFilter" method="isSiteActivateNotification" />
<bean ref="siteActivationMonitor" method="handleNotification"/>
<bean ref="serializationUtil" method="transformToThrift" />
<to uri="jms-generic:topic:edex.alerts.siteActivate" />
<to uri="jms-generic:topic:edex.alerts.siteActivate?timeToLive=60000" />
</filter>
</route>
</camelContext>
@ -42,4 +42,4 @@
<property name="routeId" value="siteActivationRoute"/>
</bean>
</beans>

View file

@ -45,7 +45,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 1, 2012 14715 rferrel Initial creation
*
* May 08, 2013 1814 rjpeter Added time to live to topic
* </pre>
*
* @author rferrel
@ -92,8 +92,7 @@ public class TafQueueRequestHandler implements IRequestHandler<TafQueueRequest>
case GET_TAFS:
response = new ServerResponse<String>();
idList = (List<String>) request.getArgument();
List<TafQueueRecord> records = (List<TafQueueRecord>) dao
.getRecordsById(idList);
List<TafQueueRecord> records = dao.getRecordsById(idList);
makeTafs(records, response);
break;
case REMOVE_SELECTED:
@ -111,7 +110,7 @@ public class TafQueueRequestHandler implements IRequestHandler<TafQueueRequest>
+ " forecast(s) removed.");
}
makeList(state, dao, response);
if (state == TafQueueState.PENDING && numRemoved > 0) {
if ((state == TafQueueState.PENDING) && (numRemoved > 0)) {
sendNotification(Type.REMOVE_SELECTED);
}
break;
@ -193,6 +192,6 @@ public class TafQueueRequestHandler implements IRequestHandler<TafQueueRequest>
throws SerializationException, EdexException {
byte[] message = SerializationUtil.transformToThrift(type.toString());
EDEXUtil.getMessageProducer().sendAsyncUri(
"jms-generic:topic:tafQueueChanged", message);
"jms-generic:topic:tafQueueChanged?timeToLive=60000", message);
}
}

View file

@ -10,7 +10,7 @@
<bean id="userAuthenticationDataChangedHandler"
class="com.raytheon.uf.edex.useradmin.services.UserAuthenticationDataChangedHandler">
<constructor-arg type="java.lang.String"
value="jms-generic:topic:user.authentication.changed?destinationResolver=#qpidDurableResolver" />
value="jms-generic:topic:user.authentication.changed?timeToLive=60000&amp;destinationResolver=#qpidDurableResolver" />
</bean>
<bean factory-bean="handlerRegistry" factory-method="register">

View file

@ -80,7 +80,8 @@ cp -r ${LOCALIZATION_PATH}/cave_static/site/${CAPS_SITE}/gfe $caveDest/site
log_msg 70
log_msg Copying cave site maps configuration for site ${CAPS_SITE} to temporary directory...
cp -r ${LOCALIZATION_PATH}/cave_static/site/${CAPS_SITE}/bundles/maps $caveDest/site
mkdir $caveDest/site/bundles
cp -r ${LOCALIZATION_PATH}/cave_static/site/${CAPS_SITE}/bundles/maps $caveDest/site/bundles
log_msg 75
log_msg Copying cave site colormaps configuration for site ${CAPS_SITE} to temporary directory...

View file

@ -10,6 +10,7 @@ package gov.noaa.nws.ncep.ui.nsharp.display.rsc;
* Date Ticket# Engineer Description
* ------- ------- -------- -----------
* 04/23/2012 229 Chin Chen Initial coding
* May 08, 2013 1847 bsteffen Allow painting with no Wind Data.
*
* </pre>
*
@ -798,6 +799,9 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
//System.out.println( "layer#"+ i+ " RE_MAX_WIND =" + spd );
}
}
if (layerStateList.isEmpty()) {
return;
}
//#2: apply minimum distance rule, i.e no two wind layer closer than the minimum distance, also make sure
// relative max wind layer is picked.
lastHeight = -9999;

View file

@ -228,8 +228,6 @@ fi
cd ../${POSTGIS_SRC_DIR}
_POSTGRESQL_ROOT=${RPM_BUILD_ROOT}/awips2/postgresql
_POSTGRESQL_BIN=${_POSTGRESQL_ROOT}/bin
# disable doc since it attempts to download files from
# the internet
./configure \
--with-pgconfig=${_POSTGRESQL_BIN}/pg_config \
--with-geosconfig=${_POSTGRESQL_BIN}/geos-config \
@ -241,9 +239,25 @@ RC="$?"
if [ ! "${RC}" = "0" ]; then
exit 1
fi
# disable doc since it attempts to download files from
# the internet
echo "#Do Nothing" > doc/Makefile.in
echo "docs:" > doc/Makefile
echo "" >> doc/Makefile
echo "docs-install:" >> doc/Makefile
echo "" >> doc/Makefile
echo "docs-uninstall:" >> doc/Makefile
echo "" >> doc/Makefile
echo "comments-install:" >> doc/Makefile
echo "" >> doc/Makefile
echo "comments-uninstall:" >> doc/Makefile
echo "" >> doc/Makefile
echo "clean:" >> doc/Makefile
echo "" >> doc/Makefile
make
RC="$?"
if [ ! "${RC}" = "0" ]; then
# run make twice - the first time may fail due to doc
make
if [ $? -ne 0 ]; then
exit 1
fi
make install
@ -340,4 +354,4 @@ and populate the AWIPS II databases.
%defattr(644,awips,fxalpha,755)
%dir /awips2/psql/lib
/awips2/psql/lib/*
/awips2/psql/lib/*

View file

@ -27,6 +27,7 @@
- Date Ticket# Engineer Description
- ============ ========== =========== ==========================
- Mar 18, 2013 1814 rjpeter Initial Creation
- May 08, 2013 1814 rjpeter Remove slow consumer disconnect
-
-->
<virtualhosts>
@ -39,11 +40,6 @@
<class>org.apache.qpid.server.store.derby.DerbyMessageStore</class>
<environment-path>${QPID_WORK}/messageStore</environment-path>
</store>
<slow-consumer-detection>
<!-- Only check every 5 minutes -->
<delay>5</delay>
<timeunit>minutes</timeunit>
</slow-consumer-detection>
<queues>
<!-- Define default exchange -->
<exchange>amq.direct</exchange>
@ -63,6 +59,8 @@
<durable>true</durable>
<!-- Configure queues
Queues created on demand for AWIPS II
<queue>
<name>external.dropbox</name>
<external..dropbox>
@ -71,31 +69,6 @@
</queue>
-->
</queues>
<topics>
<slow-consumer-detection>
<!-- The maximum depth in bytes before -->
<!-- the policy will be applied-->
<depth>104857600</depth>
<!-- The maximum message age in milliseconds -->
<!-- before the policy will be applied -->
<messageAge>600000</messageAge>
<!-- The maximum number of message before -->
<!-- which the policy will be applied-->
<messageCount>5000</messageCount>
<!-- Policy Selection -->
<policy>
<name>topicDelete</name>
<topicDelete>
<!-- Uncomment to enable deletion of durable subscriptions that fall behind -->
<!--delete-persistent/-->
</topicDelete>
</policy>
</slow-consumer-detection>
<!-- Slow Consumer disconnect could be configured per topic. Use global configuration for now -->
</topics>
</edex>
</virtualhost>
</virtualhosts>

View file

@ -3,7 +3,7 @@ diff -crB a/qpid-java.spec b/qpid-java.spec
--- b/qpid-java.spec 2013-04-24 13:31:29.000000000 -0500
***************
*** 1,6 ****
Name: qpid-java
! Name: qpid-java
Version: 0.18
! Release: 2%{?dist}
Summary: Java implementation of Apache Qpid
@ -12,9 +12,9 @@ diff -crB a/qpid-java.spec b/qpid-java.spec
--- 1,8 ----
+ %define _awips2_directory "/awips2/qpid"
+
Name: qpid-java
! Name: awips2-qpid-java
Version: 0.18
! Release: 5%{?dist}
! Release: 1%{?dist}
Summary: Java implementation of Apache Qpid
License: Apache Software License
Group: Development/Java

View file

@ -375,11 +375,6 @@ if [ "${1}" = "-qpid" ]; then
fi
if [ "${1}" = "-ldm" ]; then
# Ensure that the user has root privileges.
if [ ! ${UID} = 0 ]; then
echo "ERROR: You must have root privileges to build ldm."
exit 1
fi
buildRPM "awips2-ldm"
exit 0