12.6.1-9 baseline

Former-commit-id: 2c0ff851ca [formerly 2c0ff851ca [formerly 8f93efb93ec2d244fe599c16b3af5b33784c0232]]
Former-commit-id: 27afa60345
Former-commit-id: 4f7bb90bb0
This commit is contained in:
Steve Harris 2012-07-10 07:53:49 -05:00
parent 6325fcc6f1
commit d5fa61041b
400 changed files with 23465 additions and 13403 deletions

View file

@ -30,4 +30,6 @@
<request> <productCode>34</productCode> <pdw20>16</pdw20> </request> <request> <productCode>34</productCode> <pdw20>16</pdw20> </request>
<request> <productCode>34</productCode> <pdw20>32</pdw20> </request> <request> <productCode>34</productCode> <pdw20>32</pdw20> </request>
</cronOTR> </cronOTR>
<cronOTR cron="0 0 * * * ?" productCode="173" randomWait="600" hoursBack="3" wmo="SDUS8" nnn="DU3"/>
<cronOTR cron="0 0 12 * * ?" productCode="173" randomWait="600" hoursBack="24" wmo="SDUS8" nnn="DU6"/>
</cronOTRConfiguration> </cronOTRConfiguration>

View file

@ -485,18 +485,16 @@ class Procedure (SmartScript.SmartScript):
# #
# get History of last time this grid was modified # get History of last time this grid was modified
# #
username = ""
updtime = None
historyList=self.getGridHistory(dbid,parm,"SFC",gridTR) historyList=self.getGridHistory(dbid,parm,"SFC",gridTR)
for hists in historyList: for hists in historyList:
for hist in hists: for hist in hists:
if hist[4] not in [None, "None"]: if hist[4] not in [None, "None"]:
username=hist[4].split(':')[1] username=hist[4].split(':')[1]
else:
username=""
if hist[5] is not None: if hist[5] is not None:
updtime=hist[5].unixTime() updtime=hist[5].unixTime()
else:
updtime = None
if self.VU.getDebug()>=1: if self.VU.getDebug()>=1:
t2=self.gstring1(time.gmtime(updtime)) t2=self.gstring1(time.gmtime(updtime))
@ -830,6 +828,7 @@ class Procedure (SmartScript.SmartScript):
# different values from getComposite after IFPS16. # different values from getComposite after IFPS16.
# #
def getBetterComposite(self,parmName, timeRange): def getBetterComposite(self,parmName, timeRange):
from com.raytheon.uf.common.dataplugin.gfe.db.objects import GFERecord_GridType as GridType
# #
# Get the type, rateParm flag, and limits # Get the type, rateParm flag, and limits
# for the parameter name passed in. # for the parameter name passed in.
@ -864,7 +863,7 @@ class Procedure (SmartScript.SmartScript):
sum=self._empty+150.0 sum=self._empty+150.0
else: else:
sum=self._empty sum=self._empty
if (wxType==1): if GridType.VECTOR.equals(wxType):
sumv=self._empty sumv=self._empty
cnt = zeros_like(self._empty) cnt = zeros_like(self._empty)
all = ones_like(self._empty) all = ones_like(self._empty)
@ -880,7 +879,7 @@ class Procedure (SmartScript.SmartScript):
# #
# Add to sums, or min/max # Add to sums, or min/max
# #
if wxType==0: # SCALAR if GridType.SCALAR.equals(wxType): # SCALAR
bits,isc=comp bits,isc=comp
#isc=self.getGrids("ISC",parmName,"SFC",tr) #isc=self.getGrids("ISC",parmName,"SFC",tr)
# #
@ -904,14 +903,14 @@ class Procedure (SmartScript.SmartScript):
else: else:
sum=where(bits,sum+isc,sum) sum=where(bits,sum+isc,sum)
cnt[bits] += 1 cnt[bits] += 1
if wxType==1: # VECTOR if GridType.VECTOR.equals(wxType): # VECTOR
bits,mag,direc=comp bits,mag,direc=comp
#(mag,dir)=self.getGrids("ISC",parmName,"SFC",tr) #(mag,dir)=self.getGrids("ISC",parmName,"SFC",tr)
(u,v)=self.MagDirToUV(mag,direc) (u,v)=self.MagDirToUV(mag,direc)
sum=where(bits,sum+u,sum) sum=where(bits,sum+u,sum)
sumv=where(bits,sumv+v,sumv) sumv=where(bits,sumv+v,sumv)
cnt[bits] += 1 cnt[bits] += 1
if wxType==2: # WEATHER if GridType.WEATHER.equals(wxType): # WEATHER
bits,keys,strings=comp bits,keys,strings=comp
#(keys,strings)=self.getGrids("ISC",parmName,"SFC",tr) #(keys,strings)=self.getGrids("ISC",parmName,"SFC",tr)
# #
@ -920,9 +919,9 @@ class Procedure (SmartScript.SmartScript):
# #
noISC=less(cnt,0.5) noISC=less(cnt,0.5)
bits=greater(cnt,0.5) bits=greater(cnt,0.5)
if ((wxType==0)or(wxType==1)): if GridType.SCALAR.equals(wxType) or GridType.VECTOR.equals(wxType):
cnt[less(cnt,1)] = 1 cnt[less(cnt,1)] = 1
if (wxType==1): if GridType.VECTOR.equals(wxType):
sum=where(noISC,minlimit,sum/cnt) sum=where(noISC,minlimit,sum/cnt)
sumv=where(noISC,minlimit,sumv/cnt) sumv=where(noISC,minlimit,sumv/cnt)
(mag,direc)=self.UVToMagDir(sum,sumv) (mag,direc)=self.UVToMagDir(sum,sumv)

View file

@ -97,8 +97,8 @@ class Procedure (SmartScript.SmartScript):
trList = [] trList = []
for g in gridInfo: for g in gridInfo:
start = g.gridTime().startTime().unixTime() start = g.gridTime().startTime().unixTime() * 1000
end = g.gridTime().endTime().unixTime() end = g.gridTime().endTime().unixTime() * 1000
tr = TimeRange.TimeRange(start,end) tr = TimeRange.TimeRange(start,end)
if tr.overlaps(timeRange): if tr.overlaps(timeRange):
trList.append(tr) trList.append(tr)
@ -243,7 +243,8 @@ class Procedure (SmartScript.SmartScript):
modelTR_cum = self.getModelTimeRange(modelID, "prob34", weNames) modelTR_cum = self.getModelTimeRange(modelID, "prob34", weNames)
weNames = ["pwsD34", "pwsD64", "pwsN34", "pwsN64"] weNames = ["pwsD34", "pwsD64", "pwsN34", "pwsN64"]
modelTR_inc = self.getModelTimeRange(modelID, "pws34", weNames) modelTR_inc = self.getModelTimeRange(modelID, "pws34", weNames)
if modelTR_cum is None or len(modelTR_cum) < 3:
return
timeRange = modelTR_cum[0] timeRange = modelTR_cum[0]
minTime = modelTR_cum[1] minTime = modelTR_cum[1]
maxTime = modelTR_cum[2] maxTime = modelTR_cum[2]

View file

@ -4367,13 +4367,13 @@ class BOIVerifyUtility(SmartScript.SmartScript):
recmatch=logical_and(recbase,recfit) recmatch=logical_and(recbase,recfit)
recnumbers=compress(recmatch,self.fncRecs) recnumbers=compress(recmatch,self.fncRecs)
recList=list(recnumbers) recList=list(recnumbers)
recList.sort(lambda x,y: cmp(self.fncStime[x],self.fncStime[y])) recList.sort(lambda x,y: cmp(self.fncStime[int(x)],self.fncStime[int(y)]))
else: else:
recmatch=logical_and(greater(self.oncEtime,stime), recmatch=logical_and(greater(self.oncEtime,stime),
less(self.oncStime,etime)) less(self.oncStime,etime))
recnumbers=compress(recmatch,self.oncRecs) recnumbers=compress(recmatch,self.oncRecs)
recList=list(recnumbers) recList=list(recnumbers)
recList.sort(lambda x,y: cmp(self.oncStime[x],self.oncStime[y])) recList.sort(lambda x,y: cmp(self.oncStime[int(x)],self.oncStime[int(y)]))
self.logMsg("number of intersecting grids:%d"%len(recList),10) self.logMsg("number of intersecting grids:%d"%len(recList),10)
if len(recList)<1: if len(recList)<1:
return retVal return retVal

View file

@ -54,10 +54,9 @@ class ProcessVariableList:
## The following arguments are no longer used but remain part of the signature for compatibility reasons ## The following arguments are no longer used but remain part of the signature for compatibility reasons
## * parent - not needed ## * parent - not needed
## * modal - similar functionality is achieved by setting or not setting a callback ## * modal - similar functionality is achieved by setting or not setting a callback
## * dbSubsystem - not needed, see TODO ## * dataMgr - required for model and D2D_model widgets
## * cmdLineVarDict - not needed, see TODO ## * cmdLineVarDict - not needed, see TODO
## ##
## TODO evaluate cmdLineVarDict and determine if it is really not needed
## TODO dbSubsytem may be needed when implementing the model and D2D_model widgets ## TODO dbSubsytem may be needed when implementing the model and D2D_model widgets
## ##
## @param title: str() of the title of the dialog that will appear ## @param title: str() of the title of the dialog that will appear
@ -68,7 +67,7 @@ class ProcessVariableList:
## @param argList: list() of arguments to pass to the callback function ## @param argList: list() of arguments to pass to the callback function
## ##
def __init__(self, title, varList, varDict=None, parent=None, def __init__(self, title, varList, varDict=None, parent=None,
dbSubsystem=None, modal=1, runCB=None, argList=[], dataMgr=None, modal=1, runCB=None, argList=[],
cmdLineVarDict=None): cmdLineVarDict=None):
self.__varDict = varDict self.__varDict = varDict
@ -80,7 +79,7 @@ class ProcessVariableList:
widgetList = buildWidgetList(varList) widgetList = buildWidgetList(varList)
# Construct the dialog # Construct the dialog
self.__dialog = ValuesDialog.openDialog(title, widgetList) self.__dialog = ValuesDialog.openDialog(title, widgetList, dataMgr)
#self.__dialog = ValuesDialog(title,widgetList) #self.__dialog = ValuesDialog(title,widgetList)
# since ValuesDialog blocks on open() we can set status and varDict here # since ValuesDialog blocks on open() we can set status and varDict here

View file

@ -1838,12 +1838,8 @@ class SmartScript(BaseTool.BaseTool):
# @rtype: list of strings # @rtype: list of strings
def getDiscreteKeys(self, elementName): def getDiscreteKeys(self, elementName):
parm = self.getParm("Fcst", elementName, "SFC") parm = self.getParm("Fcst", elementName, "SFC")
keyList = [] keyList = parm.getGridInfo().getDiscreteKeys()
inventory = parm.getGridInventory() keyList = JUtil.javaStringListToPylist(keyList)
for gridData in inventory:
slice = gridData.getGridSlice()
for discreteKey in slice.getKey():
keyList.append(discreteKey.toString())
return keyList return keyList
######################################################################### #########################################################################

View file

@ -107,7 +107,7 @@
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="New Orleans, LA (KLIX)" id="raobNewOrleans_LA" menuText="New Orleans, LA (KLIX)" id="raobNewOrleans_LA"
editorType="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpSkewTEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpSkewTEditor">
<substitute key="stationId" value="72231"/> <substitute key="stationId" value="72233"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Wash-Dulles, VA (KIAD)" id="raobWash-Dulles" menuText="Wash-Dulles, VA (KIAD)" id="raobWash-Dulles"

View file

@ -88,6 +88,11 @@
menuText="Elko, NV (KLKN)" id="raobElko_NV" menuText="Elko, NV (KLKN)" id="raobElko_NV"
editorType="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpSkewTEditor"> editorType="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpSkewTEditor">
<substitute key="stationId" value="72582"/> <substitute key="stationId" value="72582"/>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Las Vegas, NV (KVEF)" id="raobLasVegas_NV"
editorType="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpSkewTEditor">
<substitute key="stationId" value="72388"/>
</contribute> </contribute>
<contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml" <contribute xsi:type="bundleItem" file="bundles/UpperAirRaob.xml"
menuText="Medford, OR (KMFR)" id="raobMedford_OR" menuText="Medford, OR (KMFR)" id="raobMedford_OR"

View file

@ -25,9 +25,9 @@ import java.io.IOException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.WeakHashMap;
import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
@ -48,7 +48,6 @@ import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.core.Activator; import com.raytheon.uf.viz.core.Activator;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.status.StatusConstants;
/** /**
* Creates uEngine scripts on the fly. * Creates uEngine scripts on the fly.
@ -75,7 +74,8 @@ import com.raytheon.uf.viz.core.status.StatusConstants;
* @version 1 * @version 1
*/ */
public class ScriptCreator { public class ScriptCreator {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ScriptCreator.class); private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ScriptCreator.class);
private static final String DEFAULT_SCRIPT_LIBRARY = "BaseRequest"; private static final String DEFAULT_SCRIPT_LIBRARY = "BaseRequest";
@ -99,8 +99,8 @@ public class ScriptCreator {
new Path("scriptTemplates/standardTemplate.vm"), new Path("scriptTemplates/standardTemplate.vm"),
null)).getPath()); null)).getPath());
} catch (IOException e) { } catch (IOException e) {
statusHandler.handle( statusHandler
Priority.CRITICAL, .handle(Priority.CRITICAL,
"Unable to load the standard script template. Requesting products will not work until this is fixed.", "Unable to load the standard script template. Requesting products will not work until this is fixed.",
e); e);
} }
@ -148,7 +148,7 @@ public class ScriptCreator {
return; return;
} }
pluginToLibraryMap = new WeakHashMap<String, ScriptProperties>(); pluginToLibraryMap = new HashMap<String, ScriptProperties>();
IExtensionRegistry registry = Platform.getExtensionRegistry(); IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint(RESOURCE_EXTENSION); IExtensionPoint point = registry.getExtensionPoint(RESOURCE_EXTENSION);

View file

@ -938,7 +938,7 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
index = 1.0f; index = 1.0f;
} }
return colorToRGB(colorMap.getColors().get( return colorToRGB(colorMap.getColors().get(
(int) (index * colorMap.getSize()))); (int) (index * (colorMap.getSize()-1))));
} }
/** /**
@ -954,7 +954,7 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
} else if (index > 1.0f) { } else if (index > 1.0f) {
index = 1.0f; index = 1.0f;
} }
return colorMap.getColors().get((int) (index * colorMap.getSize())); return colorMap.getColors().get((int) (index * (colorMap.getSize()-1)));
} }
public static RGB colorToRGB(Color c) { public static RGB colorToRGB(Color c) {

View file

@ -19,6 +19,9 @@
**/ **/
package com.raytheon.uf.viz.core.rsc.capabilities; package com.raytheon.uf.viz.core.rsc.capabilities;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
@ -46,6 +49,8 @@ public class DisplayTypeCapability extends AbstractCapability {
@XmlAttribute @XmlAttribute
private DisplayType displayType = DisplayType.CONTOUR; private DisplayType displayType = DisplayType.CONTOUR;
private transient List<DisplayType> alternativeDisplayTypes;
public DisplayType getDisplayType() { public DisplayType getDisplayType() {
return displayType; return displayType;
} }
@ -54,6 +59,18 @@ public class DisplayTypeCapability extends AbstractCapability {
this.displayType = displayType; this.displayType = displayType;
} }
public List<DisplayType> getAlternativeDisplayTypes() {
if (alternativeDisplayTypes == null) {
return Collections.emptyList();
}
return alternativeDisplayTypes;
}
public void setAlternativeDisplayTypes(
List<DisplayType> alternativeDisplayTypes) {
this.alternativeDisplayTypes = alternativeDisplayTypes;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

View file

@ -41,7 +41,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 24, 2007 njensen Initial creation * Sep 24, 2007 njensen Initial creation
* * May 21, 2012 DR 14833 gzhang Adding a getter for StyleRuleset
* </pre> * </pre>
* *
* @author njensen * @author njensen
@ -150,4 +150,23 @@ public class StyleManager {
} }
/**2012-05-21
* DR 14833: FFMP uses this getter to find the color
* map if a user modified ffmpImageryStlyeRules.xml
* incorrectly.
*
* @param st: StyleType
* @return: StyleRuleset related to the StyleType
*/
public StyleRuleset getStyleRuleSet(StyleType st){
synchronized(st){
if( ! rules.containsKey(st)){
loadRules(st);
}
}
return rules.get(st);
}
} }

View file

@ -35,4 +35,17 @@
scriptLibrary="BaseRequest"> scriptLibrary="BaseRequest">
</scriptTemplate> </scriptTemplate>
</extension> </extension>
<!-- for making CWAT available on Localization Perspective in CAVE: 2012-05-14 from DHladky -->
<extension
point="com.raytheon.uf.viz.localization.localizationpath">
<path
application="D2D"
localizationType="common_static"
name="CWAT"
recursive="true"
value="cwat">
</path>
</extension>
</plugin> </plugin>

View file

@ -140,7 +140,6 @@ public class D2DSamplingResource extends SamplingResource implements
inspectForced = false; inspectForced = false;
setSampling(false); setSampling(false);
issueRefresh(); issueRefresh();
return true;
} }
return false; return false;
} }

View file

@ -102,7 +102,18 @@ public class D2DNSharpDescriptor extends NsharpSkewTDescriptor {
IDescriptor.FrameChangeMode dmode = IDescriptor.FrameChangeMode IDescriptor.FrameChangeMode dmode = IDescriptor.FrameChangeMode
.valueOf(mode.name()); .valueOf(mode.name());
// Just hand this off to the resource. // Just hand this off to the resource.
getSkewtResource().setSteppingTimeLine(dop, dmode); switch (dmode) {
case TIME_ONLY:
getSkewtResource().setSteppingTimeLine(dop, dmode /*ignored*/);
break;
case SPACE_ONLY:
// noop for now
break;
case TIME_AND_SPACE:
// same as TIME_ONLY for now
getSkewtResource().setSteppingTimeLine(dop, dmode /*ignored*/);
break;
}
} }
}; };
} }

View file

@ -152,10 +152,25 @@ public class D2DNSharpResource extends
skewRsc.addRsc(myDataMap, stnInfo); skewRsc.addRsc(myDataMap, stnInfo);
// Adding to nsharp changes the frame but in D2D we like to keep the // Adding to nsharp changes the frame but in D2D we like to keep the
// current frame. // current frame.
while (picked != null backToPicked : while (picked != null
&& !skewRsc.getPickedStnInfoStr().equals(picked)) { && !skewRsc.getPickedStnInfoStr().equals(picked)) {
skewRsc.setSteppingTimeLine(FrameChangeOperation.NEXT, String initStn = skewRsc.getPickedStnInfoStr().substring(0, 4);
FrameChangeMode.TIME_AND_SPACE); do { // for each station...
String initTimePickedStnInfoStr = skewRsc.getPickedStnInfoStr();
do { // ...for each time
skewRsc.setSteppingTimeLine(FrameChangeOperation.NEXT, FrameChangeMode.TIME_ONLY);
// see if we're back home; if so, success
if (skewRsc.getPickedStnInfoStr().equals(picked)) {
break backToPicked;
}
// if we've cycled through all times for this station...
} while (!skewRsc.getPickedStnInfoStr().equals(initTimePickedStnInfoStr));
// ...then go to the next station
skewRsc.setSteppingStnIdList(FrameChangeOperation.NEXT);
// if we've cycled through all stations without a station/time match...
} while (!skewRsc.getPickedStnInfoStr().substring(0, 4).equals(initStn));
// ...then something is wrong
//TODO: consider logging internal error here? -- original "picked" station/time not found
} }
issueRefresh(); issueRefresh();
} }

View file

@ -178,8 +178,8 @@ public abstract class D2DNSharpResourceData extends
stnInfo.setRangestarttime(fcstTime); stnInfo.setRangestarttime(fcstTime);
} }
if (coordinate != null) { if (coordinate != null) {
stnInfo.setLongitude((float) coordinate.x); stnInfo.setLongitude(coordinate.x);
stnInfo.setLatitude((float) coordinate.y); stnInfo.setLatitude(coordinate.y);
} }
if (pointName != null) { if (pointName != null) {
stnInfo.setStnDisplayInfo(pointName + " " stnInfo.setStnDisplayInfo(pointName + " "

View file

@ -108,6 +108,7 @@
<styleRule> <styleRule>
<paramLevelMatches> <paramLevelMatches>
<parameter>Wind</parameter> <parameter>Wind</parameter>
<parameter>Gust</parameter>
</paramLevelMatches> </paramLevelMatches>
<arrowStyle> <arrowStyle>
<displayUnits>kts</displayUnits> <displayUnits>kts</displayUnits>

View file

@ -32,6 +32,7 @@ import javax.measure.unit.Unit;
import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.coverage.grid.GridGeometry2D;
import org.geotools.geometry.DirectPosition2D; import org.geotools.geometry.DirectPosition2D;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.grib.GribModel; import com.raytheon.uf.common.dataplugin.grib.GribModel;
@ -87,6 +88,8 @@ public class GribCSAdapter extends AbstractCrossSectionAdapter<GribRecord> {
private Unit<?> unit; private Unit<?> unit;
private CoordinateReferenceSystem crs;
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -250,21 +253,6 @@ public class GribCSAdapter extends AbstractCrossSectionAdapter<GribRecord> {
if (xVal <= -9999) { if (xVal <= -9999) {
continue; continue;
} }
// these cases handle rotating a vector to be oriented
// towards the north pole rather than the up direction of a
// grid.
if (c == 0) {
speed = xVal;
} else if (c == 1) {
direction = xVal - 180
+ MapUtil.rotation(coordinates[i], area);
xVal = (float) direction;
direction = Math.toRadians(direction);
} else if (c == 2) {
xVal = (float) (-speed * Math.sin(direction));
} else if (c == 3) {
xVal = (float) (-speed * Math.cos(direction));
}
dataLists.get(c).add(new XYData(xVal, yVal)); dataLists.get(c).add(new XYData(xVal, yVal));
} }
} }
@ -292,6 +280,7 @@ public class GribCSAdapter extends AbstractCrossSectionAdapter<GribRecord> {
super.addRecord(pdo); super.addRecord(pdo);
if (pdo != null && pdo instanceof GribRecord) { if (pdo != null && pdo instanceof GribRecord) {
unit = ((GribRecord) pdo).getModelInfo().getParameterUnitObject(); unit = ((GribRecord) pdo).getModelInfo().getParameterUnitObject();
crs = ((GribRecord) pdo).getSpatialObject().getCrs();
} }
yRecords.remove(pdo.getDataTime()); yRecords.remove(pdo.getDataTime());
} }
@ -355,4 +344,12 @@ public class GribCSAdapter extends AbstractCrossSectionAdapter<GribRecord> {
} }
} }
@Override
public CoordinateReferenceSystem getDataCoordinateReferenceSystem() {
if (crs == null) {
return super.getDataCoordinateReferenceSystem();
}
return crs;
}
} }

View file

@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DerivedParameter unit="kn" name="Wind Gust" abbreviation="Gust" xmlns:ns2="group"> <DerivedParameter unit="m/s" name="Wind Gust" abbreviation="Gust" xmlns:ns2="group">
<Method name="Vector" levels="Surface" models="obs"> <Method name="Vector" levels="Surface" models="obs">
<Field level="Station" abbreviation="windGust"/> <Field level="Station" abbreviation="windGust"/>
<Field abbreviation="WD"/> <Field abbreviation="WD"/>
<ConstantField value="1.0"/> <ConstantField value="1.0"/>
</Method> </Method>
<Method name="Vector"> <Method name="Vector">
<Field abbreviation="uGust"/> <Field abbreviation="uGust" unit="m/s"/>
<Field abbreviation="vGust"/> <Field abbreviation="vGust" unit="m/s"/>
</Method> </Method>
<Method name="Vector"> <Method name="Vector">
<Field abbreviation="WGS"/> <Field abbreviation="WGS" unit="m/s"/>
<Field abbreviation="WGD"/> <Field abbreviation="WGD"/>
<ConstantField value="1.0"/> <ConstantField value="1.0"/>
</Method> </Method>
<Method name="Vector"> <Method name="Vector">
<Field abbreviation="WGS"/> <Field abbreviation="WGS" unit="m/s"/>
<Field abbreviation="WD"/> <Field abbreviation="WD"/>
<ConstantField value="1.0"/> <ConstantField value="1.0"/>
</Method> </Method>
<Method name="Vector"> <Method name="Vector">
<Field abbreviation="uW"/> <Field abbreviation="uW"/>
<Field abbreviation="vW"/> <Field abbreviation="vW"/>
<Field abbreviation="WGS"/> <Field abbreviation="WGS" unit="m/s"/>
</Method> </Method>
</DerivedParameter> </DerivedParameter>

View file

@ -18,4 +18,8 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG" name="Probabilistic Storm Surge height w/10% chance of being exceeded" unit="ft"/> <DerivedParameter abbreviation="TPCSG" name="Probabilistic Storm Surge height w/10% chance of being exceeded" unit="ft">
<Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="Surge10Pct"/>
</Method>
</DerivedParameter>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_518E2" name="Probabilistic Storm Surge probability &gt; 17 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-518E2" name="Probabilistic Storm Surge probability &gt; 17 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge17Ft"/> <Field abbreviation="PSurge17Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_549E2" name="Probabilistic Storm Surge probability &gt; 18 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-549E2" name="Probabilistic Storm Surge probability &gt; 18 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge18Ft"/> <Field abbreviation="PSurge18Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_579E2" name="Probabilistic Storm Surge probability &gt; 19 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-579E2" name="Probabilistic Storm Surge probability &gt; 19 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge19Ft"/> <Field abbreviation="PSurge19Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_122E2" name="Probabilistic Storm Surge probability &gt; 4 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-122E2" name="Probabilistic Storm Surge probability &gt; 4 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge4Ft"/> <Field abbreviation="PSurge4Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_152E2" name="Probabilistic Storm Surge probability &gt; 5 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-152E2" name="Probabilistic Storm Surge probability &gt; 5 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge5Ft"/> <Field abbreviation="PSurge5Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_183E2" name="Probabilistic Storm Surge probability &gt; 6 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-183E2" name="Probabilistic Storm Surge probability &gt; 6 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge6Ft"/> <Field abbreviation="PSurge6Ft"/>
</Method> </Method>

View file

@ -18,4 +18,8 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_20" name="Probabilistic Storm Surge height w/20% chance of being exceeded" unit="ft"/> <DerivedParameter abbreviation="TPCSG-20" name="Probabilistic Storm Surge height w/20% chance of being exceeded" unit="ft">
<Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="Surge20Pct"/>
</Method>
</DerivedParameter>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_213E2" name="Probabilistic Storm Surge probability &gt; 7 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-213E2" name="Probabilistic Storm Surge probability &gt; 7 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge7Ft"/> <Field abbreviation="PSurge7Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_244E2" name="Probabilistic Storm Surge probability &gt; 8 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-244E2" name="Probabilistic Storm Surge probability &gt; 8 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge8Ft"/> <Field abbreviation="PSurge8Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_274E2" name="Probabilistic Storm Surge probability &gt; 9 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-274E2" name="Probabilistic Storm Surge probability &gt; 9 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge9Ft"/> <Field abbreviation="PSurge9Ft"/>
</Method> </Method>

View file

@ -18,4 +18,8 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_30" name="Probabilistic Storm Surge height w/30% chance of being exceeded" unit="ft"/> <DerivedParameter abbreviation="TPCSG-30" name="Probabilistic Storm Surge height w/30% chance of being exceeded" unit="ft">
<Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="Surge30Pct"/>
</Method>
</DerivedParameter>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_305E2" name="Probabilistic Storm Surge probability &gt; 10 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-305E2" name="Probabilistic Storm Surge probability &gt; 10 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge10Ft"/> <Field abbreviation="PSurge10Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_335E2" name="Probabilistic Storm Surge probability &gt; 11 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-335E2" name="Probabilistic Storm Surge probability &gt; 11 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge11Ft"/> <Field abbreviation="PSurge11Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_366E2" name="Probabilistic Storm Surge probability &gt; 12 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-366E2" name="Probabilistic Storm Surge probability &gt; 12 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge12Ft"/> <Field abbreviation="PSurge12Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_396E2" name="Probabilistic Storm Surge probability &gt; 13 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-396E2" name="Probabilistic Storm Surge probability &gt; 13 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge13Ft"/> <Field abbreviation="PSurge13Ft"/>
</Method> </Method>

View file

@ -18,4 +18,8 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_40" name="Probabilistic Storm Surge height w/40% chance of being exceeded" unit="ft"/> <DerivedParameter abbreviation="TPCSG-40" name="Probabilistic Storm Surge height w/40% chance of being exceeded" unit="ft">
<Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="Surge40Pct"/>
</Method>
</DerivedParameter>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_427E2" name="Probabilistic Storm Surge probability &gt; 14 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-427E2" name="Probabilistic Storm Surge probability &gt; 14 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge14Ft"/> <Field abbreviation="PSurge14Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_457E2" name="Probabilistic Storm Surge probability &gt; 15 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-457E2" name="Probabilistic Storm Surge probability &gt; 15 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge15Ft"/> <Field abbreviation="PSurge15Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_488E2" name="Probabilistic Storm Surge probability &gt; 16 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-488E2" name="Probabilistic Storm Surge probability &gt; 16 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge16Ft"/> <Field abbreviation="PSurge16Ft"/>
</Method> </Method>

View file

@ -18,4 +18,8 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_50" name="Probabilistic Storm Surge height w/50% chance of being exceeded" unit="ft"/> <DerivedParameter abbreviation="TPCSG-50" name="Probabilistic Storm Surge height w/50% chance of being exceeded" unit="ft">
<Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="Surge50Pct"/>
</Method>
</DerivedParameter>

View file

@ -18,4 +18,8 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_60" name="Probabilistic Storm Surge height w/60% chance of being exceeded" unit="ft"/> <DerivedParameter abbreviation="TPCSG-60" name="Probabilistic Storm Surge height w/60% chance of being exceeded" unit="ft">
<Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="Surge60Pct"/>
</Method>
</DerivedParameter>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_610E2" name="Probabilistic Storm Surge probability &gt; 20 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-610E2" name="Probabilistic Storm Surge probability &gt; 20 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge20Ft"/> <Field abbreviation="PSurge20Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_61E2" name="Probabilistic Storm Surge probability &gt; 2 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-61E2" name="Probabilistic Storm Surge probability &gt; 2 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge2Ft"/> <Field abbreviation="PSurge2Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_640E2" name="Probabilistic Storm Surge probability &gt; 21 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-640E2" name="Probabilistic Storm Surge probability &gt; 21 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge21Ft"/> <Field abbreviation="PSurge21Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_671E2" name="Probabilistic Storm Surge probability &gt; 22 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-671E2" name="Probabilistic Storm Surge probability &gt; 22 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge22Ft"/> <Field abbreviation="PSurge22Ft"/>
</Method> </Method>

View file

@ -18,4 +18,8 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_70" name="Probabilistic Storm Surge height w/70% chance of being exceeded" unit="ft"/> <DerivedParameter abbreviation="TPCSG-70" name="Probabilistic Storm Surge height w/70% chance of being exceeded" unit="ft">
<Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="Surge70Pct"/>
</Method>
</DerivedParameter>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_701E2" name="Probabilistic Storm Surge probability &gt; 23 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-701E2" name="Probabilistic Storm Surge probability &gt; 23 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge23Ft"/> <Field abbreviation="PSurge23Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_732E2" name="Probabilistic Storm Surge probability &gt; 24 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-732E2" name="Probabilistic Storm Surge probability &gt; 24 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge24Ft"/> <Field abbreviation="PSurge24Ft"/>
</Method> </Method>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_762E2" name="Probabilistic Storm Surge probability &gt; 25 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-762E2" name="Probabilistic Storm Surge probability &gt; 25 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge25Ft"/> <Field abbreviation="PSurge25Ft"/>
</Method> </Method>

View file

@ -18,4 +18,8 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_80" name="Probabilistic Storm Surge height w/80% chance of being exceeded" unit="ft"/> <DerivedParameter abbreviation="TPCSG-80" name="Probabilistic Storm Surge height w/80% chance of being exceeded" unit="ft">
<Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="Surge80Pct"/>
</Method>
</DerivedParameter>

View file

@ -18,4 +18,8 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_90" name="Probabilistic Storm Surge height w/90% chance of being exceeded" unit="ft"/> <DerivedParameter abbreviation="TPCSG-90" name="Probabilistic Storm Surge height w/90% chance of being exceeded" unit="ft">
<Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="Surge90Pct"/>
</Method>
</DerivedParameter>

View file

@ -18,7 +18,7 @@
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information. further_licensing_information.
--> -->
<DerivedParameter abbreviation="TPCSG_91E2" name="Probabilistic Storm Surge probability &gt; 3 feet" unit="%"> <DerivedParameter abbreviation="TPCSG-91E2" name="Probabilistic Storm Surge probability &gt; 3 feet" unit="%">
<Method models="TPCSurgeProb" name="Alias"> <Method models="TPCSurgeProb" name="Alias">
<Field abbreviation="PSurge3Ft"/> <Field abbreviation="PSurge3Ft"/>
</Method> </Method>

View file

@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.d2d.core;bundle-version="1.11.15", com.raytheon.uf.viz.d2d.core;bundle-version="1.11.15",
com.raytheon.uf.viz.localization, com.raytheon.uf.viz.localization,
javax.measure;bundle-version="1.0.0", javax.measure;bundle-version="1.0.0",
com.raytheon.uf.common.ohd;bundle-version="1.12.1174" com.raytheon.uf.common.ohd;bundle-version="1.12.1174",
com.raytheon.uf.common.cache;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Import-Package: com.raytheon.uf.common.colormap, Import-Package: com.raytheon.uf.common.colormap,

View file

@ -28,6 +28,7 @@ import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPCacheRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord; import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
@ -115,7 +116,7 @@ public class FFMPMonitor extends ResourceMonitor implements
public static String datePattern = "yyyy-MM-dd HH:mm:ss"; public static String datePattern = "yyyy-MM-dd HH:mm:ss";
/** FFMP Records indexed by site, times and field **/ /** FFMP Records indexed by site, times and field **/
public ConcurrentHashMap<String, ConcurrentHashMap<String, FFMPRecord>> ffmpData = null; public ConcurrentHashMap<String, ConcurrentHashMap<String, FFMPCacheRecord>> ffmpData = null;
// list of earliest available date queried by site, sourceName // list of earliest available date queried by site, sourceName
public ConcurrentHashMap<String, ConcurrentHashMap<String, Date>> ffmpAvailableUriQueryDates = null; public ConcurrentHashMap<String, ConcurrentHashMap<String, Date>> ffmpAvailableUriQueryDates = null;
@ -174,6 +175,16 @@ public class FFMPMonitor extends ResourceMonitor implements
resourceListeners.clear(); resourceListeners.clear();
} }
// clear all remaining data
if (ffmpData != null) {
for (String key : ffmpData.keySet()) {
for (Entry<String, FFMPCacheRecord> entry : ffmpData.get(key)
.entrySet()) {
entry.getValue().closeCache();
}
}
}
ffmpData = null; ffmpData = null;
ffmpAvailableUriQueryDates = null; ffmpAvailableUriQueryDates = null;
ffmpAvailableUris = null; ffmpAvailableUris = null;
@ -281,7 +292,7 @@ public class FFMPMonitor extends ResourceMonitor implements
* Creates the linked maps * Creates the linked maps
*/ */
private void createDataStructures() { private void createDataStructures() {
ffmpData = new ConcurrentHashMap<String, ConcurrentHashMap<String, FFMPRecord>>(); ffmpData = new ConcurrentHashMap<String, ConcurrentHashMap<String, FFMPCacheRecord>>();
ffmpAvailableUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentSkipListMap<Date, List<String>>>>(); ffmpAvailableUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentSkipListMap<Date, List<String>>>>();
ffmpAvailableUriQueryDates = new ConcurrentHashMap<String, ConcurrentHashMap<String, Date>>(); ffmpAvailableUriQueryDates = new ConcurrentHashMap<String, ConcurrentHashMap<String, Date>>();
ffmpLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>>(); ffmpLoadedUris = new ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, ConcurrentHashMap<String, String>>>>();
@ -360,12 +371,6 @@ public class FFMPMonitor extends ResourceMonitor implements
return ffmpRec; return ffmpRec;
} }
public FFMPRecord populateFFMPRecord(ProductXML product, String siteKey,
String dataKey, String source, Date ptime, String phuc) {
return populateFFMPRecord(product, siteKey, dataKey, source, ptime,
phuc, false);
}
/** /**
* populate a new FFMPRecord * populate a new FFMPRecord
* *
@ -375,11 +380,10 @@ public class FFMPMonitor extends ResourceMonitor implements
* @return * @return
* @throws VizException * @throws VizException
*/ */
public FFMPRecord populateFFMPRecord(ProductXML product, String siteKey, public void populateFFMPRecord(ProductXML product, String siteKey,
String dataKey, String source, Date ptime, String phuc, String dataKey, String source, Date ptime, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
FFMPRecord ffmpRec = null;
boolean isProductLoad = false; boolean isProductLoad = false;
if (product != null) { if (product != null) {
isProductLoad = true; isProductLoad = true;
@ -397,9 +401,9 @@ public class FFMPMonitor extends ResourceMonitor implements
&& !getUriMap(siteKey, source, phuc) && !getUriMap(siteKey, source, phuc)
.containsKey(uri)) { .containsKey(uri)) {
try { try {
ffmpRec = loadRecordFromDatabase(uri);
populateFFMPRecord(isProductLoad, siteKey, populateFFMPRecord(isProductLoad, siteKey,
ffmpRec, source, phuc); loadRecordFromDatabase(uri), source,
phuc);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"FFMP Can't retrieve FFMP URI, " + uri, "FFMP Can't retrieve FFMP URI, " + uri,
@ -410,8 +414,6 @@ public class FFMPMonitor extends ResourceMonitor implements
} }
} }
} }
return ffmpRec;
} }
/** /**
@ -423,8 +425,9 @@ public class FFMPMonitor extends ResourceMonitor implements
* @return * @return
* @throws VizException * @throws VizException
*/ */
public FFMPRecord populateFFMPRecord(boolean isProductLoad, String uri, public FFMPCacheRecord populateFFMPRecord(boolean isProductLoad,
String siteKey, String source, String phuc) throws Exception { String uri, String siteKey, String source, String phuc)
throws Exception {
try { try {
populateFFMPRecord(isProductLoad, siteKey, populateFFMPRecord(isProductLoad, siteKey,
@ -647,7 +650,6 @@ public class FFMPMonitor extends ResourceMonitor implements
query.append("' and sitekey = '"); query.append("' and sitekey = '");
query.append(siteKey); query.append(siteKey);
if (!source.isMosaic()) { if (!source.isMosaic()) {
query.append("' and datakey = '"); query.append("' and datakey = '");
query.append(dataKey); query.append(dataKey);
@ -733,12 +735,13 @@ public class FFMPMonitor extends ResourceMonitor implements
* @return * @return
* *
*/ */
public FFMPRecord getFFMPData(ProductXML product, String siteKey, public FFMPCacheRecord getFFMPData(ProductXML product, String siteKey,
String dataKey, String sourceName, Date ptime, String phuc, String dataKey, String sourceName, Date ptime, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
FFMPRecord record = ffmpData.get(siteKey).get(sourceName); FFMPCacheRecord record = ffmpData.get(siteKey).get(sourceName);
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData().getGuidSrc(); String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
.getGuidSrc();
if ((record != null) if ((record != null)
&& (record.getBasinData(phuc).getBasins().size() > 0)) { && (record.getBasinData(phuc).getBasins().size() > 0)) {
@ -797,6 +800,10 @@ public class FFMPMonitor extends ResourceMonitor implements
ProductRunXML productRun = getRunConfig().getProduct( ProductRunXML productRun = getRunConfig().getProduct(
siteKey); siteKey);
if (sourceXML
.getSourceType()
.equals(FFMPSourceConfigurationManager.SOURCE_TYPE.GUIDANCE
.getSourceType())) {
for (SourceXML ffgSource : productRun for (SourceXML ffgSource : productRun
.getGuidanceSources(product, guidSrc)) { .getGuidanceSources(product, guidSrc)) {
@ -804,6 +811,10 @@ public class FFMPMonitor extends ResourceMonitor implements
ffgSource.getSourceName(), ptime, phuc, ffgSource.getSourceName(), ptime, phuc,
retrieveNew); retrieveNew);
} }
} else {
populateFFMPRecord(product, siteKey, dataKey,
sourceName, ptime, phuc, retrieveNew);
}
} }
} else { } else {
populateFFMPRecord(product, siteKey, dataKey, sourceName, populateFFMPRecord(product, siteKey, dataKey, sourceName,
@ -905,14 +916,19 @@ public class FFMPMonitor extends ResourceMonitor implements
FFMPResourceData frd = resource.getResourceData(); FFMPResourceData frd = resource.getResourceData();
if (loadType == LOADER_TYPE.SECONDARY) { if (loadType == LOADER_TYPE.SECONDARY) {
hucsToLoad.remove("ALL"); //hucsToLoad.remove("ALL");
hucsToLoad.remove(getConfig().getFFMPConfigData().getLayer()); //hucsToLoad.remove(getConfig().getFFMPConfigData().getLayer());
timeBack = new Date( timeBack = new Date(
(long) (resource.getMostRecentTime().getTime() - ((getConfig() (long) (resource.getMostRecentTime().getTime() - ((getConfig()
.getFFMPConfigData().getTimeFrame() * 3) * 3600 * 1000))); .getFFMPConfigData().getTimeFrame() * 3) * 3600 * 1000)));
frd.timeBack = timeBack; frd.timeBack = timeBack;
} else if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear();
hucsToLoad.add("ALL");
startTime = new Date(resource.getMostRecentTime().getTime() - (3600 * 1000 * 6));
timeBack = new Date(resource.getMostRecentTime().getTime() - (3600 * 1000 * 24));
} }
frd.floader = new FFMPDataLoader(frd, timeBack, startTime, loadType, frd.floader = new FFMPDataLoader(frd, timeBack, startTime, loadType,
@ -1083,6 +1099,11 @@ public class FFMPMonitor extends ResourceMonitor implements
res.getResourceData().floader = null; res.getResourceData().floader = null;
int val = siteCount.get(res.getSiteKey()); int val = siteCount.get(res.getSiteKey());
// clear out the cache
for (Entry<String, FFMPCacheRecord> entry: ffmpData.get(res.getSiteKey()).entrySet()){
entry.getValue().closeCache();
}
if ((val == 1) && (siteCount.size() > 1)) { if ((val == 1) && (siteCount.size() > 1)) {
ffmpData.remove(res.getSiteKey()); ffmpData.remove(res.getSiteKey());
@ -1163,7 +1184,7 @@ public class FFMPMonitor extends ResourceMonitor implements
* @param retrieveNew * @param retrieveNew
* @return * @return
*/ */
public FFMPRecord getQPERecord(ProductXML product, String siteKey, public FFMPCacheRecord getQPERecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc, String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
@ -1204,7 +1225,7 @@ public class FFMPMonitor extends ResourceMonitor implements
* @param retrieveNew * @param retrieveNew
* @return * @return
*/ */
public FFMPRecord getRateRecord(ProductXML product, String siteKey, public FFMPCacheRecord getRateRecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc, String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
@ -1246,7 +1267,7 @@ public class FFMPMonitor extends ResourceMonitor implements
* @param retrieveNew * @param retrieveNew
* @return * @return
*/ */
public FFMPRecord getQPFRecord(ProductXML product, String siteKey, public FFMPCacheRecord getQPFRecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc, String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
@ -1300,17 +1321,19 @@ public class FFMPMonitor extends ResourceMonitor implements
* @param phuc * @param phuc
* @return * @return
*/ */
public FFMPRecord getGuidanceRecord(ProductXML product, String siteKey, public FFMPCacheRecord getGuidanceRecord(ProductXML product,
String sourceName, Date date, String phuc, boolean isStandAlone) { String siteKey, String sourceName, Date date, String phuc,
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData().getGuidSrc(); boolean isStandAlone) {
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
.getGuidSrc();
if (!isStandAlone && guidSrc.startsWith("xxx")) { if (!isStandAlone && guidSrc.startsWith("xxx")) {
return null; return null;
} }
if (product != null) { if (product != null) {
ProductRunXML productRun = FFMPRunConfigurationManager ProductRunXML productRun = FFMPRunConfigurationManager
.getInstance().getProduct(siteKey); .getInstance().getProduct(siteKey);
SourceXML source = productRun.getGuidanceSources(product, SourceXML source = productRun.getGuidanceSources(product, guidSrc)
guidSrc).get(0); .get(0);
sourceName = source.getDisplayName(); sourceName = source.getDisplayName();
} }
@ -1329,17 +1352,18 @@ public class FFMPMonitor extends ResourceMonitor implements
* @param retrieveNew * @param retrieveNew
* @return * @return
*/ */
public HashMap<String, FFMPRecord> getGuidanceRecords(ProductXML product, public HashMap<String, FFMPCacheRecord> getGuidanceRecords(
String siteKey, Date date, String phuc, boolean retrieveNew) { ProductXML product, String siteKey, Date date, String phuc,
boolean retrieveNew) {
HashMap<String, FFMPRecord> guidRecs = new HashMap<String, FFMPRecord>(); HashMap<String, FFMPCacheRecord> guidRecs = new HashMap<String, FFMPCacheRecord>();
ProductRunXML productRun = FFMPRunConfigurationManager.getInstance() ProductRunXML productRun = FFMPRunConfigurationManager.getInstance()
.getProduct(siteKey); .getProduct(siteKey);
ArrayList<String> guidTypes = productRun.getGuidanceTypes(product); ArrayList<String> guidTypes = productRun.getGuidanceTypes(product);
for (String type : guidTypes) { for (String type : guidTypes) {
FFMPRecord guidRec = getFFMPData(product, siteKey, null, type, FFMPCacheRecord guidRec = getFFMPData(product, siteKey, null, type,
date, phuc, retrieveNew); date, phuc, retrieveNew);
guidRecs.put(type, guidRec); guidRecs.put(type, guidRec);
} }
@ -1360,9 +1384,9 @@ public class FFMPMonitor extends ResourceMonitor implements
throws VizException { throws VizException {
if (product != null) { if (product != null) {
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData().getGuidSrc(); String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
SourceXML source = product.getGuidanceSourcesByType( .getGuidSrc();
guidSrc).get(0); SourceXML source = product.getGuidanceSourcesByType(guidSrc).get(0);
sourceName = source.getDisplayName(); sourceName = source.getDisplayName();
} }
@ -1378,7 +1402,7 @@ public class FFMPMonitor extends ResourceMonitor implements
* @param retrieveNew * @param retrieveNew
* @return * @return
*/ */
public FFMPRecord getVirtualRecord(ProductXML product, String siteKey, public FFMPCacheRecord getVirtualRecord(ProductXML product, String siteKey,
String dataKey, String sourceName, Date date, String phuc, String dataKey, String sourceName, Date date, String phuc,
boolean retrieveNew) { boolean retrieveNew) {
// comparisons done with table display // comparisons done with table display
@ -1406,7 +1430,7 @@ public class FFMPMonitor extends ResourceMonitor implements
Long pfaf) throws VizException { Long pfaf) throws VizException {
FFMPBasin basin = null; FFMPBasin basin = null;
// check for already loaded records // check for already loaded records
FFMPRecord record = ffmpData.get(siteKey).get(sourceName); FFMPCacheRecord record = ffmpData.get(siteKey).get(sourceName);
if (record != null) { if (record != null) {
FFMPBasinData basinData = record.getBasinData(phuc); FFMPBasinData basinData = record.getBasinData(phuc);
if (basinData != null) { if (basinData != null) {
@ -1727,8 +1751,8 @@ public class FFMPMonitor extends ResourceMonitor implements
if (ffmpData != null) { if (ffmpData != null) {
if (ffmpData.containsKey(fsiteKey)) { if (ffmpData.containsKey(fsiteKey)) {
FFMPRecord record = ffmpData.get(fsiteKey).get( FFMPCacheRecord record = ffmpData.get(fsiteKey)
sourceName); .get(sourceName);
if (record != null) { if (record != null) {
record.purgeData(fdate); record.purgeData(fdate);
} }
@ -1740,7 +1764,8 @@ public class FFMPMonitor extends ResourceMonitor implements
} else { } else {
if (ffmpData != null) { if (ffmpData != null) {
if (ffmpData.containsKey(fsiteKey)) { if (ffmpData.containsKey(fsiteKey)) {
FFMPRecord record = ffmpData.get(fsiteKey).get(fsource); FFMPCacheRecord record = ffmpData.get(fsiteKey).get(
fsource);
if (record != null) { if (record != null) {
record.purgeData(fdate); record.purgeData(fdate);
} }
@ -2405,7 +2430,7 @@ public class FFMPMonitor extends ResourceMonitor implements
IDataStore dataStore = DataStoreFactory.getDataStore(loc); IDataStore dataStore = DataStoreFactory.getDataStore(loc);
if (!ffmpData.containsKey(fsiteKey)) { if (!ffmpData.containsKey(fsiteKey)) {
ConcurrentHashMap<String, FFMPRecord> fieldRecs = new ConcurrentHashMap<String, FFMPRecord>(); ConcurrentHashMap<String, FFMPCacheRecord> fieldRecs = new ConcurrentHashMap<String, FFMPCacheRecord>();
ffmpData.put(fsiteKey, fieldRecs); ffmpData.put(fsiteKey, fieldRecs);
} }
@ -2418,13 +2443,15 @@ public class FFMPMonitor extends ResourceMonitor implements
mySource = source.getDisplayName(); mySource = source.getDisplayName();
} }
FFMPRecord curRecord = ffmpData.get(fsiteKey).get(mySource); FFMPCacheRecord curRecord = ffmpData.get(fsiteKey).get(
mySource);
if (curRecord == null) { if (curRecord == null) {
// ensure the record can only be set once // ensure the record can only be set once
synchronized (ffmpData) { synchronized (ffmpData) {
curRecord = ffmpData.get(fsiteKey).get(mySource); curRecord = ffmpData.get(fsiteKey).get(mySource);
if (curRecord == null) { if (curRecord == null) {
curRecord = fffmpRec; curRecord = new FFMPCacheRecord(fffmpRec,
mySource);
ffmpData.get(fsiteKey).put(mySource, curRecord); ffmpData.get(fsiteKey).put(mySource, curRecord);
} }
} }
@ -2455,7 +2482,7 @@ public class FFMPMonitor extends ResourceMonitor implements
"Retrieving and Populating URI: , " "Retrieving and Populating URI: , "
+ dataUri); + dataUri);
curRecord.retrieveMapFromDataStore(dataStore, curRecord.retrieveMapFromDataStore(dataStore,
dataUri, getTemplates(fsiteKey), fhuc, dataUri, getTemplates(fffmpRec.getSiteKey()), fhuc,
fffmpRec.getDataTime().getRefTime(), fffmpRec.getDataTime().getRefTime(),
fffmpRec.getSourceName()); fffmpRec.getSourceName());
} catch (Exception e) { } catch (Exception e) {

View file

@ -177,7 +177,7 @@ public class FFMPTableCellData {
tmpVal = Math.rint(value); tmpVal = Math.rint(value);
} else { } else {
if (!value.isNaN()) { if (!value.isNaN()) {
tmpVal = (double) (((int) ((value + 0.005) * 100))) / 100; tmpVal = (double) ((Math.round(value * 100.0))/100.0);
} }
} }

View file

@ -1186,7 +1186,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
updateTimeDurationLabel(val, split); updateTimeDurationLabel(val, split);
if (dialogInitialized) { if (dialogInitialized) {
fireTimeChangedEvent(val, split); fireTimeChangedEvent(val, split, false);
} }
updateD2DRefresh(); updateD2DRefresh();
} }
@ -1260,17 +1260,27 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
this.ffmpConfig.setVisibleColumns(attrData); this.ffmpConfig.setVisibleColumns(attrData);
this.ffmpConfig.setAttrData(attrData); this.ffmpConfig.setAttrData(attrData);
this.ffmpTable.showHideTableColumns(); this.ffmpTable.showHideTableColumns();
boolean changeSplit = false;
if (timeDurScale.split != ffmpConfig.isSplit()) {
changeSplit = true;
}
timeDurScale.setSplit(ffmpConfig.isSplit()); timeDurScale.setSplit(ffmpConfig.isSplit());
updateTimeDurationLabel(timeDurScale.getSelectedHoursValue(), updateTimeDurationLabel(timeDurScale.getSelectedHoursValue(),
ffmpConfig.isSplit()); ffmpConfig.isSplit());
if (updateData) { if (updateData) {
if (changeSplit) {
fireTimeChangedEvent(timeDurScale.getSelectedHoursValue(),
ffmpConfig.isSplit(), true);
}
resource.clearTables(); resource.clearTables();
resource.getDrawable(resource.getPaintTime()).setDirty(true); resource.getDrawable(resource.getPaintTime()).setDirty(true);
FFMPMonitor monitor = FFMPMonitor.getInstance(); FFMPMonitor.getInstance().fireMonitorEvent(
monitor.fireMonitorEvent(this.getClass().getName()); this.getClass().getName());
} }
ffmpTable.calculateTableSize(); ffmpTable.calculateTableSize();
@ -1314,7 +1324,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
ffmpListeners.remove(fl); ffmpListeners.remove(fl);
} }
public void fireTimeChangedEvent(double newTime, boolean split) { public void fireTimeChangedEvent(double newTime, boolean split, boolean override) {
FFMPRecord.FIELDS field = FFMPRecord.FIELDS.QPE; FFMPRecord.FIELDS field = FFMPRecord.FIELDS.QPE;
@ -1325,7 +1335,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
} }
} }
if (time != newTime) { if ((time != newTime) || override) {
FFMPTimeChangeEvent ftce = new FFMPTimeChangeEvent(newTime, split); FFMPTimeChangeEvent ftce = new FFMPTimeChangeEvent(newTime, split);
Iterator<FFMPListener> iter = ffmpListeners.iterator(); Iterator<FFMPListener> iter = ffmpListeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
@ -1756,7 +1766,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
*/ */
timeDurScale.setTimeDurationAndUpdate(ffmpConfig.getFFMPConfigData() timeDurScale.setTimeDurationAndUpdate(ffmpConfig.getFFMPConfigData()
.getTimeFrame()); .getTimeFrame());
fireTimeChangedEvent(ffmpConfig.getFFMPConfigData().getTimeFrame(), false); fireTimeChangedEvent(ffmpConfig.getFFMPConfigData().getTimeFrame(), false, false);
/* /*
* Layer * Layer
@ -2006,6 +2016,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
dataLoadComp.setVisible(false); dataLoadComp.setVisible(false);
shell.pack(); shell.pack();
} }
resource.manageLoaders(status);
} }
@Override @Override

View file

@ -111,7 +111,7 @@ public class TimeDurScaleComp extends Composite {
/** /**
* Split flag. * Split flag.
*/ */
private boolean split = false; public boolean split = false;
/** /**
* Display numbers for the range. * Display numbers for the range.

View file

@ -49,7 +49,7 @@ import com.raytheon.viz.core.style.image.ImagePreferences;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 08/29/09 2152 D. Hladky Initial release * 08/29/09 2152 D. Hladky Initial release
* * 05/21/12 DR 14833 G. Zhang Error handling for invalid cmap
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -70,6 +70,15 @@ public class FFMPColorUtils {
private TreeMap<Double, String> hourColorMapMap = new TreeMap<Double, String>(); private TreeMap<Double, String> hourColorMapMap = new TreeMap<Double, String>();
// DR 14833: replacing the one in the constructor
private StyleRule sr = null;
// DR 14833: used when no colormap found
private static final String DEFAULT_COLORMAP = "ffmp/qpe";
// DR 14833: used when paramname not matching colormap name found
private static final String DEFAULT_PARAMNAME = "qpe";
/** /**
* Set up FFMP Color maps * Set up FFMP Color maps
* *
@ -84,7 +93,18 @@ public class FFMPColorUtils {
this.tableLoad = tableLoad; this.tableLoad = tableLoad;
this.colormapparams = null; this.colormapparams = null;
StyleRule sr = null; // LocalizationFile[] files = ColorMapLoader.listColorMapFiles();
// for (LocalizationFile file : files) {
// String fn = file.getName();
// if (fn.startsWith("colormaps/ffmp/qpe"))
// {
// System.out.println(file.getName());
// String hour = fn.s
// }
//
// }
// StyleRule sr = null;// DR 14833 replaced by a instance field
try { try {
sr = StyleManager.getInstance().getStyleRule( sr = StyleManager.getInstance().getStyleRule(
StyleManager.StyleType.IMAGERY, getMatchCriteria()); StyleManager.StyleType.IMAGERY, getMatchCriteria());
@ -102,6 +122,7 @@ public class FFMPColorUtils {
e.printStackTrace(); e.printStackTrace();
} }
if(cxml == null) cxml = getDefaultColorMap(); // DR 14833: load the default map
ColorMap colorMap = new ColorMap(colormapfile, (ColorMap) cxml); ColorMap colorMap = new ColorMap(colormapfile, (ColorMap) cxml);
colormapparams = new ColorMapParameters(); colormapparams = new ColorMapParameters();
colormapparams.setColorMap(colorMap); colormapparams.setColorMap(colorMap);
@ -168,7 +189,7 @@ public class FFMPColorUtils {
double val2 = (Math.round(valueArg * 100.0)) / 100.0; double val2 = (Math.round(valueArg * 100.0)) / 100.0;
Double value = val2; Double value = val2;
if (value < 0.01 && field != FIELDS.DIFF) { if (value < 0.005 && field != FIELDS.DIFF) {
ret = 0; ret = 0;
} else if (field == FIELDS.DIFF) { } else if (field == FIELDS.DIFF) {
@ -321,4 +342,71 @@ public class FFMPColorUtils {
} }
} }
} }
/**
* DR 14833: Error handling for the following:
* when a user modified the ffmpImageryStyleRules.xml file
* without adding the related qpeX.cmap and for a user made
* error like: qpe6/qpe4.cmap then default qpe/qpe.cmap used.
*
*/
public IColorMap getDefaultColorMap(){
IColorMap cxml = null;
/*see parseFileNames(): colormap_name is "0.0" or qpe+key+".cmap"
double hour = hourColorMapMap.firstKey();
String cmapHour = ( hour==0.0 ? "" : String.valueOf(hour) );
System.out.println("FFMPColorUtils.getDefaultColorMap() cmapHour: "+cmapHour );*/
/* Loop through all StyleRules to get the default.
* In StyleManager.loadRules(StyleType), all levels(not only USER)
* StyleRule loaded. So it is guaranteed the default can be loaded.
*/
com.raytheon.uf.viz.core.style.StyleRuleset srs =
StyleManager.getInstance().getStyleRuleSet(StyleManager.StyleType.IMAGERY);
for(StyleRule srl : srs.getStyleRules()){
String pn="", cm="";
try{
pn = ((ParamLevelMatchCriteria)srl.getMatchCriteria()).getParameterNames().get(0);
cm = ((ImagePreferences)srl.getPreferences()).getDefaultColormap();
}catch(Exception e){ continue; }
if(DEFAULT_PARAMNAME.equalsIgnoreCase(pn) && DEFAULT_COLORMAP.equalsIgnoreCase(cm)){
sr = srl;
System.out.println("FFMPColorUtils.getDefaultColorMap(): StyleRule pn-cm value: "+pn+"-"+cm);
break;
}
}
/*
if(sr == null){
//get the MatchCriteria
ParamLevelMatchCriteria match = new ParamLevelMatchCriteria();
ArrayList<String> paramList = new ArrayList<String>();
paramList.add( FIELDS.QPE.getFieldName()+cmapHour );
match.setParameterName(paramList);
//get the StyleRule
try {
sr=StyleManager.getInstance().getStyleRule(StyleManager.StyleType.IMAGERY, match);
} catch (VizStyleException e) {
e.printStackTrace();
}
}
*/
//get the colormapfile name
String colormapfile = ((ImagePreferences) sr.getPreferences()).getDefaultColormap();
//load the colormap
try {
cxml = ColorMapLoader.loadColorMap(colormapfile);
} catch (VizException e) {
e.printStackTrace();
}
return cxml;
}
} }

View file

@ -26,9 +26,9 @@ import java.util.HashMap;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPCacheRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS; import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates; import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils; import com.raytheon.uf.common.dataplugin.ffmp.FFMPUtils;
@ -94,17 +94,17 @@ public class FFMPDataGenerator {
FFMPBasinData virtualBasin = null; FFMPBasinData virtualBasin = null;
FFMPRecord rateRecord = null; FFMPCacheRecord rateRecord = null;
FFMPRecord qpeRecord = null; FFMPCacheRecord qpeRecord = null;
FFMPRecord qpfRecord = null; FFMPCacheRecord qpfRecord = null;
HashMap<String, FFMPRecord> guidRecords = null; HashMap<String, FFMPCacheRecord> guidRecords = null;
FFMPRecord virtualRecord = null; FFMPCacheRecord virtualRecord = null;
FFMPRecord baseRec = null; FFMPCacheRecord baseRec = null;
// Date time = null; // Date time = null;
@ -374,7 +374,7 @@ public class FFMPDataGenerator {
if ((qpfBasin != null) if ((qpfBasin != null)
&& (qpfBasin.get(parentBasinPfaf) != null)) { && (qpfBasin.get(parentBasinPfaf) != null)) {
qpf = qpfBasin.get(parentBasinPfaf).getValue( qpf = qpfBasin.get(parentBasinPfaf).getAverageValue(
monitor.getQpfWindow().getAfterTime(), monitor.getQpfWindow().getAfterTime(),
monitor.getQpfWindow().getBeforeTime()); monitor.getQpfWindow().getBeforeTime());
trd.setTableCellData(3, new FFMPTableCellData( trd.setTableCellData(3, new FFMPTableCellData(
@ -557,7 +557,7 @@ public class FFMPDataGenerator {
if ((qpfBasin != null) if ((qpfBasin != null)
&& (qpfBasin.get(cBasin.getPfaf()) != null)) { && (qpfBasin.get(cBasin.getPfaf()) != null)) {
qpf = qpfBasin.get(cBasin.getPfaf()).getValue( qpf = qpfBasin.get(cBasin.getPfaf()).getAverageValue(
monitor.getQpfWindow().getAfterTime(), monitor.getQpfWindow().getAfterTime(),
monitor.getQpfWindow().getBeforeTime()); monitor.getQpfWindow().getBeforeTime());
// qpf = getQPFValue(false, cBasin.getPfaf(), // qpf = getQPFValue(false, cBasin.getPfaf(),
@ -872,7 +872,7 @@ public class FFMPDataGenerator {
trd.setTableCellData( trd.setTableCellData(
3, 3,
new FFMPTableCellData(FIELDS.QPF, new Float( new FFMPTableCellData(FIELDS.QPF, new Float(
qpeBasin.get(cBasin.getPfaf()).getValue( qpfBasin.get(cBasin.getPfaf()).getMaxValue(
monitor.getQpfWindow() monitor.getQpfWindow()
.getAfterTime(), .getAfterTime(),
monitor.getQpfWindow() monitor.getQpfWindow()
@ -960,7 +960,7 @@ public class FFMPDataGenerator {
Float.NaN)); Float.NaN));
} }
if (qpfBasin != null) { if (qpfBasin != null) {
qpf = qpfBasin.getMaxValue(pfafs, monitor.getQpfWindow() qpf = qpfBasin.getAverageMaxValue(pfafs, monitor.getQpfWindow()
.getAfterTime(), monitor.getQpfWindow() .getAfterTime(), monitor.getQpfWindow()
.getBeforeTime()); .getBeforeTime());
@ -1103,7 +1103,7 @@ public class FFMPDataGenerator {
trd.setTableCellData( trd.setTableCellData(
3, 3,
new FFMPTableCellData(FIELDS.QPF, new Float( new FFMPTableCellData(FIELDS.QPF, new Float(
qpeBasin.get(cBasin.getPfaf()).getValue( qpfBasin.get(cBasin.getPfaf()).getMaxValue(
monitor.getQpfWindow() monitor.getQpfWindow()
.getAfterTime(), .getAfterTime(),
monitor.getQpfWindow() monitor.getQpfWindow()
@ -1266,9 +1266,11 @@ public class FFMPDataGenerator {
qpeBasin = qpeRecord.getBasinData(huc); qpeBasin = qpeRecord.getBasinData(huc);
if (qpeBasin.getBasins().size() > 0) { if (qpeBasin.getBasins().size() > 0) {
field = FIELDS.QPE; field = FIELDS.QPE;
if (baseRec == null) {
baseRec = qpeRecord; baseRec = qpeRecord;
} }
} }
}
if (qpfRecord != null) { if (qpfRecord != null) {
qpfBasin = qpfRecord.getBasinData(huc); qpfBasin = qpfRecord.getBasinData(huc);
} }

View file

@ -151,6 +151,8 @@ public class FFMPDataLoader extends Thread {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
try { try {
resourceData.setLoader(loadType);
System.out.println("Starting Loader: "+loadType.getLoaderType());
ProductRunXML productRun = runner.getProduct(siteKey); ProductRunXML productRun = runner.getProduct(siteKey);
ArrayList<String> qpfSources = new ArrayList<String>(); ArrayList<String> qpfSources = new ArrayList<String>();
@ -185,7 +187,7 @@ public class FFMPDataLoader extends Thread {
qpfURIs = getMonitor().getAvailableUris(siteKey, dataKey, qpfURIs = getMonitor().getAvailableUris(siteKey, dataKey,
qpfSource.getSourceName(), qpfTime); qpfSource.getSourceName(), qpfTime);
if (qpfURIs != null) { if (qpfURIs != null && !qpfURIs.isEmpty()) {
qpfs.add(qpfURIs); qpfs.add(qpfURIs);
qpfSources.add(qpfSource.getSourceName()); qpfSources.add(qpfSource.getSourceName());
} }
@ -213,11 +215,16 @@ public class FFMPDataLoader extends Thread {
iguidURIs = getMonitor().getAvailableUris(siteKey, dataKey, iguidURIs = getMonitor().getAvailableUris(siteKey, dataKey,
guidSource.getSourceName(), guidTime); guidSource.getSourceName(), guidTime);
if (iguidURIs != null) { if (iguidURIs != null && !iguidURIs.isEmpty()) {
guids.put(guidSource.getSourceName(), iguidURIs); guids.put(guidSource.getSourceName(), iguidURIs);
} }
} }
} }
// We only load all for long range data, all + layer for medium range
if (loadType == LOADER_TYPE.TERTIARY) {
hucsToLoad.clear();
hucsToLoad.add("ALL");
}
for (String phuc : hucsToLoad) { for (String phuc : hucsToLoad) {
@ -231,8 +238,9 @@ public class FFMPDataLoader extends Thread {
} else { } else {
// rate // rate
if (rateURI != null) { if (rateURI != null) {
System.out.println("Processing " + loadType fireLoaderEvent(loadType, "Processing "+product.getRate() + "/" + phuc,
+ " Rate: huc = " + phuc); isDone);
getMonitor().processUri(isProductLoad, rateURI, getMonitor().processUri(isProductLoad, rateURI,
siteKey, product.getRate(), timeBack, phuc); siteKey, product.getRate(), timeBack, phuc);
fireLoaderEvent(loadType, product.getRate() + "/" fireLoaderEvent(loadType, product.getRate() + "/"
@ -240,8 +248,8 @@ public class FFMPDataLoader extends Thread {
} }
// qpes // qpes
System.out.println("Processing " + loadType fireLoaderEvent(loadType, "Processing "+product.getQpe() + "/" + phuc,
+ " QPE: huc = " + phuc); isDone);
FFMPBasinData qpeData = null; FFMPBasinData qpeData = null;
if ((loadType == LOADER_TYPE.INITIAL) if ((loadType == LOADER_TYPE.INITIAL)
@ -260,8 +268,8 @@ public class FFMPDataLoader extends Thread {
} }
} }
if (!qpeURIs.isEmpty()) { if (!qpeURIs.isEmpty() && qpeData == null) {
if (phuc.equals(config.getFFMPConfigData().getLayer())) { if (phuc.equals(config.getFFMPConfigData().getLayer()) || phuc.equals("ALL")) {
getMonitor().processUris(qpeURIs, isProductLoad, getMonitor().processUris(qpeURIs, isProductLoad,
siteKey, product.getQpe(), timeBack, phuc, siteKey, product.getQpe(), timeBack, phuc,
loadType); loadType);
@ -274,8 +282,8 @@ public class FFMPDataLoader extends Thread {
int i = 0; int i = 0;
for (NavigableMap<Date, List<String>> qpfURIs : qpfs) { for (NavigableMap<Date, List<String>> qpfURIs : qpfs) {
// qpf // qpf
System.out.println("Processing " + loadType fireLoaderEvent(loadType, "Processing "+product.getQpf(i) + "/" + phuc,
+ " QPF: huc = " + phuc); isDone);
FFMPBasinData qpfData = null; FFMPBasinData qpfData = null;
if ((loadType == LOADER_TYPE.INITIAL) if ((loadType == LOADER_TYPE.INITIAL)
|| (loadType == LOADER_TYPE.SECONDARY)) { || (loadType == LOADER_TYPE.SECONDARY)) {
@ -289,8 +297,8 @@ public class FFMPDataLoader extends Thread {
if (qpfData != null) { if (qpfData != null) {
if (phuc.equals(config.getFFMPConfigData() if ((phuc.equals(config.getFFMPConfigData()
.getLayer()) .getLayer()) || phuc.equals("ALL"))
&& loadType == LOADER_TYPE.INITIAL && loadType == LOADER_TYPE.INITIAL
&& source.getSourceName().equals( && source.getSourceName().equals(
config.getFFMPConfigData() config.getFFMPConfigData()
@ -311,7 +319,7 @@ public class FFMPDataLoader extends Thread {
//if (isUrisProcessNeeded(qpfData,qpfURIs)) {/*DR13839*/ //if (isUrisProcessNeeded(qpfData,qpfURIs)) {/*DR13839*/
if ((qpfData == null) && !qpfURIs.isEmpty()) { if ((qpfData == null) && !qpfURIs.isEmpty()) {
if (phuc.equals(config.getFFMPConfigData() if (phuc.equals(config.getFFMPConfigData()
.getLayer())) { //old code: keep for reference*/ .getLayer()) || phuc.equals("ALL")) { //old code: keep for reference*/
//if (isHucProcessNeeded(phuc)) {/*DR13839*/ //if (isHucProcessNeeded(phuc)) {/*DR13839*/
getMonitor().processUris(qpfURIs, getMonitor().processUris(qpfURIs,
isProductLoad, siteKey, isProductLoad, siteKey,
@ -329,9 +337,8 @@ public class FFMPDataLoader extends Thread {
} }
// virtuals only have data for ALL // virtuals only have data for ALL
if (phuc.equals("ALL")) { if (phuc.equals("ALL")) {
System.out.println("Processing " + loadType fireLoaderEvent(loadType, "Processing "+product.getVirtual() + "/" + phuc,
+ " VGB: huc = " + phuc); isDone);
FFMPBasinData vgbData = null; FFMPBasinData vgbData = null;
if ((loadType == LOADER_TYPE.INITIAL) if ((loadType == LOADER_TYPE.INITIAL)
@ -361,17 +368,18 @@ public class FFMPDataLoader extends Thread {
} }
// process guidance all at once // process guidance all at once
System.out.println("Processing " + loadType
+ " GUIDANCE: huc = " + phuc);
for (String type : productRun.getGuidanceTypes(product)) { for (String type : productRun.getGuidanceTypes(product)) {
ArrayList<SourceXML> guidSources = productRun ArrayList<SourceXML> guidSources = productRun
.getGuidanceSources(product, type); .getGuidanceSources(product, type);
for (SourceXML guidSource : guidSources) { for (SourceXML guidSource : guidSources) {
NavigableMap<Date, List<String>> iguidURIs = guids NavigableMap<Date, List<String>> iguidURIs = guids
.get(guidSource.getSourceName()); .get(guidSource.getSourceName());
fireLoaderEvent(loadType, "Processing "+guidSource.getSourceName() + "/" + phuc,
isDone);
getMonitor().processUris(iguidURIs, isProductLoad, getMonitor().processUris(iguidURIs, isProductLoad,
siteKey, guidSource.getSourceName(), timeBack, siteKey, guidSource.getSourceName(), timeBack,
phuc, loadType); phuc, loadType);
@ -386,11 +394,10 @@ public class FFMPDataLoader extends Thread {
} }
} catch (Exception e) { } catch (Exception e) {
isDone = true; isDone = true;
statusHandler.error("FFMP Data Loader terminated...." System.err.println("FFMP Data Loader terminated...."
+ e.getMessage()); + e.getMessage());
} finally { } finally {
isDone = true; isDone = true;
resourceData.setLoader(loadType);
} }
String message = null; String message = null;
@ -471,22 +478,31 @@ public class FFMPDataLoader extends Thread {
String sourceName = source.getSourceName(); String sourceName = source.getSourceName();
File file = new File(sharePath + wfo + File.separator + sourceName File file = new File(sharePath + wfo + File.separator + sourceName
+ "-" + siteKey + "-" + pdataKey + "-" + huc + ".bin"); + "-" + siteKey + "-" + pdataKey + "-" + huc + ".bin");
System.out.println("Buddy File path: " + file.getAbsolutePath());
FFMPBasinData basinData = null; FFMPBasinData basinData = null;
if (file.exists()) { if (file.exists()) {
System.out.println("File path: " + file.getName()); System.out.println("Last mod: " + new Date(file.lastModified()));
//System.out.println("6 hour mod: " + new Date((System.currentTimeMillis() - (6 * 1000 * 3600))));
//System.out.println("DIFF: "+(file.lastModified() - (System.currentTimeMillis() - (6 * 1000 * 3600))));
if (file.lastModified() > (System.currentTimeMillis() - (6 * 1000 * 3600))) {
System.out.println("Buddy File path: " + file.getName());
try { try {
basinData = (FFMPBasinData) SerializationUtil basinData = (FFMPBasinData) SerializationUtil
.transformFromThrift(FileUtil.file2bytes(file, false)); .transformFromThrift(FileUtil.file2bytes(file,
false));
} catch (SerializationException e) { } catch (SerializationException e) {
e.printStackTrace(); e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
}
return basinData; return basinData;

View file

@ -52,6 +52,7 @@ import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPCacheRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGap; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGap;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
@ -65,9 +66,17 @@ import com.raytheon.uf.common.dataplugin.ffmp.FFMPVirtualGageBasinMetaData;
import com.raytheon.uf.common.dataplugin.ffmp.HucLevelGeometriesFactory; import com.raytheon.uf.common.dataplugin.ffmp.HucLevelGeometriesFactory;
import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate; import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.config.FFFGDataMgr; import com.raytheon.uf.common.monitor.config.FFFGDataMgr;
import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager; import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
import com.raytheon.uf.common.monitor.xml.DomainXML; import com.raytheon.uf.common.monitor.xml.DomainXML;
import com.raytheon.uf.common.monitor.xml.ProductRunXML;
import com.raytheon.uf.common.monitor.xml.ProductXML; import com.raytheon.uf.common.monitor.xml.ProductXML;
import com.raytheon.uf.common.monitor.xml.SourceXML; import com.raytheon.uf.common.monitor.xml.SourceXML;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
@ -108,6 +117,7 @@ import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig; import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpBasinTableDlg; import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpBasinTableDlg;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfig; import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfig;
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPAutoRefreshEvent; import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPAutoRefreshEvent;
import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPCWAChangeEvent; import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPCWAChangeEvent;
import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPFieldChangeEvent; import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPFieldChangeEvent;
@ -249,23 +259,23 @@ public class FFMPResource extends
}; };
private FFMPRecord rateRecord = null; private FFMPCacheRecord rateRecord = null;
private boolean isNewRate = true; private boolean isNewRate = true;
private FFMPRecord qpeRecord = null; private FFMPCacheRecord qpeRecord = null;
private boolean isNewQpe = true; private boolean isNewQpe = true;
private FFMPRecord guidRecord = null; private FFMPCacheRecord guidRecord = null;
private boolean isNewGuid = true; private boolean isNewGuid = true;
private FFMPRecord qpfRecord = null; private FFMPCacheRecord qpfRecord = null;
private boolean isNewQpf = true; private boolean isNewQpf = true;
private FFMPRecord virtualRecord = null; private FFMPCacheRecord virtualRecord = null;
private boolean isNewVirtual = true; private boolean isNewVirtual = true;
@ -333,6 +343,9 @@ public class FFMPResource extends
/** guidance source expiration **/ /** guidance source expiration **/
public long guidSourceExpiration = 0l; public long guidSourceExpiration = 0l;
/** QPF source expiration **/
public long qpfSourceExpiration = 0l;
/** is this a rate load **/ /** is this a rate load **/
public Boolean isRate = null; public Boolean isRate = null;
@ -622,7 +635,7 @@ public class FFMPResource extends
} }
case QPF: { case QPF: {
value = getQpfRecord(recentTime).getBasinData("ALL") value = getQpfRecord(recentTime).getBasinData("ALL")
.getMaxValue(pfafs, recentTime); .getAverageMaxValue(pfafs, recentTime, getQpfSourceExpiration());
break; break;
} }
case GUIDANCE: { case GUIDANCE: {
@ -673,7 +686,7 @@ public class FFMPResource extends
case RATE:// fall through case RATE:// fall through
case QPF: { case QPF: {
value = getBasin(key, field, recentTime, aggregate) value = getBasin(key, field, recentTime, aggregate)
.getValue(recentTime); .getAverageValue(recentTime, getQpfSourceExpiration());
break; break;
} }
case GUIDANCE: { case GUIDANCE: {
@ -700,7 +713,7 @@ public class FFMPResource extends
switch (field) { switch (field) {
case QPF: { case QPF: {
value = getBasin(key, field, recentTime, aggregate) value = getBasin(key, field, recentTime, aggregate)
.getValue(recentTime); .getAverageValue(recentTime, getQpfSourceExpiration());
break; break;
} }
case GUIDANCE: { case GUIDANCE: {
@ -1262,18 +1275,6 @@ public class FFMPResource extends
} }
} }
if (getResourceData().isSecondaryLoad) {
// kick in tertiary loader
if (!getResourceData().isTertiaryLoad) {
if ((loader == null) || !loader.isAlive()) {
Date backDate = new Date(getMostRecentTime()
.getTime() - (24 * 1000 * 3600));
startLoader(getOldestTime(), backDate,
LOADER_TYPE.TERTIARY);
}
}
}
// the product string // the product string
if (isFfmpDataToggle() && fieldDescString != null) { if (isFfmpDataToggle() && fieldDescString != null) {
paintProductString(aTarget, paintProps); paintProductString(aTarget, paintProps);
@ -1568,13 +1569,13 @@ public class FFMPResource extends
buf.append("County: " + metaBasin.getState() + ", " buf.append("County: " + metaBasin.getState() + ", "
+ metaBasin.getCounty() + "\n"); + metaBasin.getCounty() + "\n");
String valst = null; String valst = null;
Float val = getBasinValue(pfaf, paintTime.getRefTime(), Float val = getBasinValue(pfaf, getPaintTime().getRefTime(),
aggregate); aggregate);
if (val.isNaN() || (val == FFMPUtils.MISSING)) { if (val.isNaN() || (val == FFMPUtils.MISSING)) {
valst = "NO DATA"; valst = "NO DATA";
} else { } else {
valst = df.format(getBasinValue(pfaf, valst = df.format(getBasinValue(pfaf,
paintTime.getRefTime(), aggregate)); getPaintTime().getRefTime(), aggregate));
} }
if (!valst.equals("NO DATA")) { if (!valst.equals("NO DATA")) {
@ -3916,7 +3917,7 @@ public class FFMPResource extends
private void purge(Date pdate) { private void purge(Date pdate) {
long time = pdate.getTime(); long time = pdate.getTime();
time = time - (3600 * 1000 * 24); time = time - getPurgePeriod();
Date ndate = new Date(time); Date ndate = new Date(time);
ArrayList<Date> removes = new ArrayList<Date>(); ArrayList<Date> removes = new ArrayList<Date>();
@ -3966,6 +3967,30 @@ public class FFMPResource extends
return qpeSourceExpiration; return qpeSourceExpiration;
} }
/**
* source expiration value as a long
*
* @return
*/
public long getQpfSourceExpiration() {
if (qpfSourceExpiration == 0l) {
SourceXML source = null;
if (getProduct() != null) {
FfmpTableConfigData ffmpTableCfgData = FfmpTableConfig
.getInstance().getTableConfigData(getSiteKey());
String qpfType = ffmpTableCfgData.getQpfType();
source = getProduct().getQpfSourcesByType(qpfType).get(0);
} else {
source = FFMPSourceConfigurationManager.getInstance()
.getSource(getResourceData().sourceName);
}
qpfSourceExpiration = source.getExpirationMinutes(getSiteKey()) * 60 * 1000;
}
return qpfSourceExpiration;
}
/** /**
* Gets the guidance source expiration * Gets the guidance source expiration
* *
@ -4130,8 +4155,10 @@ public class FFMPResource extends
ArrayList<String> hucsToLoad = new ArrayList<String>(); ArrayList<String> hucsToLoad = new ArrayList<String>();
if (isWorstCase) { if (isWorstCase) {
if (!hucsToLoad.contains("ALL")) {
hucsToLoad.add("ALL"); hucsToLoad.add("ALL");
} }
}
// tertiary loader only loads ALL // tertiary loader only loads ALL
if (type != LOADER_TYPE.TERTIARY) { if (type != LOADER_TYPE.TERTIARY) {
@ -4164,4 +4191,61 @@ public class FFMPResource extends
} }
} }
/**
* Get the purge file time
*/
public long getPurgePeriod() {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext lc = pm.getContext(
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
LocalizationFile lfFile = pm.getLocalizationFile(lc,
"purge/ffmpPurgeRules.xml");
if (lfFile.exists()) {
//TODO Need to figure out why we can't read in the purgeRules!
/*try {
PurgeRuleSet prs = (PurgeRuleSet) SerializationUtil
.jaxbUnmarshalFromXmlFile(lfFile.getFile().getAbsolutePath());
for (PurgeRule rule: prs.getRules()) {
if (rule.getId().equals("ffmp")) {
return rule.getPeriodInMillis();
}
}
} catch (SerializationException e) {
e.printStackTrace();
return 3600*24*1000;
} */
}
return 3600*24*1000;
}
/**
* Kicks off additional loaders that need to be fired off
* @param loader
* @param isDone
*/
public void manageLoaders(FFMPLoaderStatus status) {
if (status.getLoaderType() == LOADER_TYPE.SECONDARY) {
if (status.isDone() && !this.getResourceData().isTertiaryLoad) {
try {
Date startDate = new Date(getMostRecentTime().getTime() - 12 * 3600 * 1000);
FFMPMonitor.getInstance().startLoad(this, startDate,
LOADER_TYPE.TERTIARY);
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM,
"Secondary Data Load failure", e);
}
}
}
// We don't really care about status of tertiary and general loaders
}
} }

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager; import com.raytheon.uf.common.monitor.config.FFMPRunConfigurationManager;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.SOURCE_TYPE; import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.SOURCE_TYPE;
import com.raytheon.uf.common.monitor.config.FFMPTemplateConfigurationManager;
import com.raytheon.uf.common.monitor.xml.DomainXML; import com.raytheon.uf.common.monitor.xml.DomainXML;
import com.raytheon.uf.common.monitor.xml.ProductRunXML; import com.raytheon.uf.common.monitor.xml.ProductRunXML;
import com.raytheon.uf.common.monitor.xml.ProductXML; import com.raytheon.uf.common.monitor.xml.ProductXML;
@ -229,36 +230,13 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
this.timeBack = new Date( this.timeBack = new Date(
(long) (mostRecentTime.getRefTime().getTime() - (cfgBasinXML (long) (mostRecentTime.getRefTime().getTime() - (cfgBasinXML
.getTimeFrame() * 3600 * 1000))); .getTimeFrame() * 3600 * 1000)));
ArrayList<String> hucsToLoad = new ArrayList<String>(); ArrayList<String> hucsToLoad = FFMPTemplateConfigurationManager.getInstance().getHucLevels();
hucsToLoad.add(ffmpConfig.getFFMPConfigData().getLayer());
if (!ffmpConfig.getFFMPConfigData().getLayer().equals("ALL")) {
hucsToLoad.add("ALL");
}
// goes back X hours and pre populates the Data Hashes // goes back X hours and pre populates the Data Hashes
FFMPDataLoader loader = new FFMPDataLoader(this, timeBack, FFMPDataLoader loader = new FFMPDataLoader(this, timeBack,
mostRecentTime.getRefTime(), LOADER_TYPE.INITIAL, mostRecentTime.getRefTime(), LOADER_TYPE.INITIAL,
hucsToLoad); hucsToLoad);
loader.start(); loader.start();
int i = 0;
// make the table load wait for finish of initial data load
while (!loader.isDone) {
try {
// give it 120 or so seconds
if (i > 12000) {
statusHandler
.handle(Priority.WARN,
"Didn't load initial data in allotted time, releasing table");
break;
}
Thread.sleep(30);
i++;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} else { } else {
SourceXML source = getPrimarySourceXML(); SourceXML source = getPrimarySourceXML();

View file

@ -48,6 +48,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec. 3, 2009 3424 zhao Initial creation. * Dec. 3, 2009 3424 zhao Initial creation.
* Jan 25, 2010 4281 wkwock/Zhao Added history-table-row-data related modules * Jan 25, 2010 4281 wkwock/Zhao Added history-table-row-data related modules
* May 23, 2012 14410 zhao Modified getCellTypeForBlizWarn and getCellTypeForHsnowWarn modules
* *
* </pre> * </pre>
* *
@ -751,22 +752,38 @@ public final class TableUtil {
String presentWx = report.getPresentWx(); String presentWx = report.getPresentWx();
CellType windSpeed = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_WIND_SPEED.getXmlKey(), report.getWindSpeed()); CellType windSpeed = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), report.getWindSpeed());
CellType peakWind = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_PEAK_WIND.getXmlKey(), report.getMaxWindSpeed()); CellType peakWind = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), report.getMaxWindSpeed());
CellType windGust = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_GUST_SPEED.getXmlKey(), report.getWindGust()); CellType windGust = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), report.getWindGust());
CellType visibility = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey(), report.getVisibility()); CellType visibility = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_BLIZZ_VIS.getXmlKey(), report.getVisibility());
if ( presentWx.contains("SN") || presentWx.contains("BLSN") ) { if ( presentWx.contains("SN") || presentWx.contains("BLSN") ) {
// snow or blowing snow observed // snow or blowing snow observed
if ( windSpeed.equals(CellType.R) || peakWind.equals(CellType.R) || windGust.equals(CellType.R) || visibility.equals(CellType.R) ) { if ( windSpeed.equals(CellType.R) || peakWind.equals(CellType.R) || windGust.equals(CellType.R) ) {
if ( visibility.equals(CellType.R) ) {
type = CellType.R; type = CellType.R;
} else if ( windSpeed.equals(CellType.Y) || peakWind.equals(CellType.Y) || windGust.equals(CellType.Y) || visibility.equals(CellType.Y) ) { } else {
type = CellType.Y; type = CellType.Y;
} else if ( windSpeed.equals(CellType.G) || peakWind.equals(CellType.G) || windGust.equals(CellType.G) || visibility.equals(CellType.G) ) { }
} else if ( windSpeed.equals(CellType.Y) || peakWind.equals(CellType.Y) || windGust.equals(CellType.Y) ) {
type = CellType.Y;
} else if ( windSpeed.equals(CellType.G) || peakWind.equals(CellType.G) || windGust.equals(CellType.G) ) {
if ( visibility.equals(CellType.R) || visibility.equals(CellType.Y) ) {
type = CellType.Y;
} else if ( visibility.equals(CellType.G) ) {
type = CellType.G; type = CellType.G;
} else {
type = CellType.NotAvailable;
}
} else {
if ( visibility.equals(CellType.R) || visibility.equals(CellType.Y) ) {
type = CellType.Y;
} else {
type = CellType.NotAvailable;
}
} }
} else { } else {
// snow or blowing snow not observed // snow or blowing snow not observed
@ -837,11 +854,11 @@ public final class TableUtil {
CellType type = CellType.NotAvailable; // default, assuming no observation available CellType type = CellType.NotAvailable; // default, assuming no observation available
CellType snowDepth = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey(), report.getSnowDepth()); CellType snowDepth = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_HSW_SNOW_DEPTH.getXmlKey(), report.getSnowDepth());
CellType snincrHourly = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey(), report.getSnincrHourly()); CellType snincrHourly = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_HOURLY.getXmlKey(), report.getSnincrHourly());
CellType snincrTotal = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey(), report.getSnincrTotal()); CellType snincrTotal = tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone, MonitorConfigConstants.SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_TOTAL.getXmlKey(), report.getSnincrTotal());
if ( snowDepth.equals(CellType.R) || snincrHourly.equals(CellType.R) || snincrTotal.equals(CellType.R) ) { if ( snowDepth.equals(CellType.R) || snincrHourly.equals(CellType.R) || snincrTotal.equals(CellType.R) ) {
type = CellType.R; type = CellType.R;

View file

@ -77,14 +77,12 @@ import com.raytheon.uf.viz.core.style.StyleManager;
import com.raytheon.uf.viz.core.style.StyleRule; import com.raytheon.uf.viz.core.style.StyleRule;
import com.raytheon.uf.viz.core.style.VizStyleException; import com.raytheon.uf.viz.core.style.VizStyleException;
import com.raytheon.uf.viz.core.style.level.SingleLevel; import com.raytheon.uf.viz.core.style.level.SingleLevel;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay; import com.raytheon.viz.core.contours.rsc.displays.GriddedContourDisplay;
import com.raytheon.viz.core.contours.rsc.displays.GriddedVectorDisplay; import com.raytheon.viz.core.contours.rsc.displays.GriddedVectorDisplay;
import com.raytheon.viz.core.drawables.ColorMapParameterFactory; import com.raytheon.viz.core.drawables.ColorMapParameterFactory;
import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay;
import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay.GriddedImagePaintProperties; import com.raytheon.viz.core.rsc.displays.GriddedImageDisplay.GriddedImagePaintProperties;
import com.raytheon.viz.core.style.contour.ContourPreferences; import com.raytheon.viz.core.style.contour.ContourPreferences;
import com.raytheon.viz.grid.rsc.GridLoadProperties;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
@ -106,7 +104,7 @@ import com.vividsolutions.jts.geom.Coordinate;
public class OAResource extends public class OAResource extends
AbstractVizResource<OAResourceData, MapDescriptor> implements AbstractVizResource<OAResourceData, MapDescriptor> implements
IResourceDataChanged, ILoadableAsImage { IResourceDataChanged {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(OAResource.class); .getHandler(OAResource.class);
@ -178,6 +176,8 @@ public class OAResource extends
this.displayType = getCapability(DisplayTypeCapability.class) this.displayType = getCapability(DisplayTypeCapability.class)
.getDisplayType(); .getDisplayType();
getCapability(DisplayTypeCapability.class).setAlternativeDisplayTypes(
Arrays.asList(DisplayType.IMAGE));
resourceData.addChangeListener(this); resourceData.addChangeListener(this);
if (this.displayType == DisplayType.IMAGE) { if (this.displayType == DisplayType.IMAGE) {
this.getCapability(ImagingCapability.class); this.getCapability(ImagingCapability.class);
@ -694,17 +694,6 @@ public class OAResource extends
disposeRenderable(renderableMap.remove(dataTime)); disposeRenderable(renderableMap.remove(dataTime));
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#getImageryResource()
*/
@Override
public AbstractVizResource<?, ?> getImageryResource() throws VizException {
return this.resourceData.construct(new GridLoadProperties(
DisplayType.IMAGE), descriptor);
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -720,13 +709,4 @@ public class OAResource extends
} }
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return true;
}
} }

View file

@ -86,21 +86,21 @@ public class DialogAreaComposite extends ScrolledComposite {
Composite rowOfButtons = new Composite(composite, style); Composite rowOfButtons = new Composite(composite, style);
GridLayout gridLayout = new GridLayout(1, false); GridLayout gridLayout = new GridLayout(1, false);
rowOfButtons.setLayout(gridLayout); rowOfButtons.setLayout(gridLayout);
widget.buildComposite(rowOfButtons, style); widget.buildComposite(rowOfButtons);
while (wIterator.hasNext()) { while (wIterator.hasNext()) {
widget = wIterator.next(); widget = wIterator.next();
if (widget instanceof ButtonWidget) { if (widget instanceof ButtonWidget) {
gridLayout.numColumns++; gridLayout.numColumns++;
widget.buildComposite(rowOfButtons, style); widget.buildComposite(rowOfButtons);
} else { } else {
widget.buildComposite(composite, style); widget.buildComposite(composite);
break; break;
} }
} }
} else { } else {
widget.buildComposite(composite, style); widget.buildComposite(composite);
} }
} }

View file

@ -24,7 +24,7 @@ import java.util.ArrayList;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
@ -56,22 +56,26 @@ public abstract class ButtonWidget extends Widget {
* .swt.widgets.Composite, int) * .swt.widgets.Composite, int)
*/ */
@Override @Override
public Composite buildComposite(Composite parent, int style) { public Composite buildComposite(Composite parent) {
Group group = new Group(parent, style); Group group = new Group(parent, SWT.NONE);
group.setText(makeGuiLabel(getLabel())); group.setText(makeGuiLabel(getLabel()));
GridData layoutData = new GridData(SWT.DEFAULT, SWT.FILL, false, true); GridData layoutData = new GridData(SWT.DEFAULT, SWT.FILL, false, true);
group.setLayoutData(layoutData); group.setLayoutData(layoutData);
RowLayout rowLayout = new RowLayout(SWT.VERTICAL); GridLayout layout = new GridLayout(1, false);
rowLayout.pack = false; layout.marginHeight = 0;
group.setLayout(rowLayout); layout.verticalSpacing = 0;
group.setLayout(layout);
buttons = new ArrayList<Button>(); buttons = new ArrayList<Button>();
if (getOptions() != null) { if (getOptions() != null) {
for (Object option : getOptions()) { for (Object option : getOptions()) {
Button button = new Button(group, setStyle()); Button button = new Button(group, setStyle());
layoutData = new GridData(SWT.DEFAULT, SWT.DEFAULT, false,
false);
button.setLayoutData(layoutData);
button.setData(option); button.setData(option);
String text = option.toString() != null ? option.toString() String text = option.toString() != null ? option.toString()
: ""; : "";

View file

@ -19,9 +19,11 @@
**/ **/
package com.raytheon.uf.viz.python.swt.widgets; package com.raytheon.uf.viz.python.swt.widgets;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener; import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
@ -29,6 +31,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
@ -66,7 +69,7 @@ public abstract class InputWidget extends Widget implements Listener {
* @version 1.0 * @version 1.0
*/ */
public class helpRepositioner implements ControlListener { public class HelpRepositioner implements ControlListener {
/* /*
* (non-Javadoc) * (non-Javadoc)
@ -112,20 +115,37 @@ public abstract class InputWidget extends Widget implements Listener {
* .swt.widgets.Composite, int) * .swt.widgets.Composite, int)
*/ */
@Override @Override
public Composite buildComposite(Composite parent, int style) { public Composite buildComposite(Composite parent) {
Composite composite = new Composite(parent, style); Group group = new Group(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout(); GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2; gridLayout.numColumns = 2;
composite.setLayout(gridLayout); gridLayout.marginHeight = 0;
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group.setLayout(gridLayout);
group.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
Label label = new Label(composite, style); Label label = new Label(group, SWT.LEFT);
label.setText(makeGuiLabel(getLabel())); label.setText(makeGuiLabel(getLabel()));
text = new Text(composite, SWT.BORDER); String s = "";
text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); if (getValue() != null) {
s = getValue().toString();
}
int width = 30;
if (s.length() > 20) {
width = s.length() + 10;
}
GC gc = new GC(parent);
width = Dialog.convertWidthInCharsToPixels(gc.getFontMetrics(), width);
gc.dispose();
text = new Text(group, SWT.BORDER);
GridData layoutData = new GridData(SWT.DEFAULT, SWT.DEFAULT, true,
false);
layoutData.widthHint = width;
text.setLayoutData(layoutData);
text.addListener(SWT.Verify, this); text.addListener(SWT.Verify, this);
text.addListener(SWT.Modify, new Listener() { text.addListener(SWT.Modify, new Listener() {
@ -143,16 +163,14 @@ public abstract class InputWidget extends Widget implements Listener {
} }
}); });
if (getValue() != null) { text.setText(s);
text.setText(getValue().toString());
}
this.composite = composite; this.composite = group;
composite.getShell().addControlListener(new helpRepositioner()); group.getShell().addControlListener(new HelpRepositioner());
composite.addControlListener(new helpRepositioner()); group.addControlListener(new HelpRepositioner());
return composite; return group;
} }

View file

@ -19,6 +19,7 @@
**/ **/
package com.raytheon.uf.viz.python.swt.widgets; package com.raytheon.uf.viz.python.swt.widgets;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@ -61,12 +62,14 @@ public class LabelWidget extends Widget {
* .swt.widgets.Composite, int) * .swt.widgets.Composite, int)
*/ */
@Override @Override
public Composite buildComposite(Composite parent, int style) { public Composite buildComposite(Composite parent) {
Group group = new Group(parent, style); Group group = new Group(parent, SWT.NONE);
group.setLayout(new GridLayout()); GridLayout layout = new GridLayout();
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); layout.marginHeight = 4;
group.setLayout(layout);
group.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false));
Label label = new Label(group, style); Label label = new Label(group, SWT.LEFT);
label.setText(makeGuiLabel(getLabel())); label.setText(makeGuiLabel(getLabel()));
Object value = getValue(); Object value = getValue();
if (value != null) { if (value != null) {

View file

@ -32,7 +32,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
/** /**
* TODO Add Description * List widget
* *
* <pre> * <pre>
* *
@ -68,20 +68,21 @@ public class ListWidget extends Widget {
* .swt.widgets.Composite, int) * .swt.widgets.Composite, int)
*/ */
@Override @Override
public Composite buildComposite(Composite parent, int style) { public Composite buildComposite(Composite parent) {
Group group = new Group(parent, style); Group group = new Group(parent, SWT.NONE);
group.setText(makeGuiLabel(getLabel())); group.setText(makeGuiLabel(getLabel()));
GridLayout layout = new GridLayout(1, false); GridLayout layout = new GridLayout(1, false);
group.setLayout(layout); group.setLayout(layout);
GridData layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); GridData layoutData = new GridData(SWT.DEFAULT, SWT.FILL, false, true);
group.setLayoutData(layoutData); group.setLayoutData(layoutData);
// TODO: change to ToggleSelectList
org.eclipse.swt.widgets.List list = new org.eclipse.swt.widgets.List( org.eclipse.swt.widgets.List list = new org.eclipse.swt.widgets.List(
group, SWT.BORDER | SWT.V_SCROLL group, SWT.BORDER | SWT.V_SCROLL
| (this.isMultiSelect ? SWT.MULTI : SWT.SINGLE)); | (this.isMultiSelect ? SWT.MULTI : SWT.SINGLE));
layoutData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); layoutData = new GridData(SWT.DEFAULT, SWT.FILL, false, true);
if (getOptions().size() > 30) {
layoutData.heightHint = list.getItemHeight() * 30; layoutData.heightHint = list.getItemHeight() * 30;
}
list.setLayoutData(layoutData); list.setLayoutData(layoutData);
List<Object> values = getValues(); List<Object> values = getValues();
@ -113,7 +114,7 @@ public class ListWidget extends Widget {
} }
}); });
return null; return group;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View file

@ -96,12 +96,13 @@ public class PushButtonWidget extends Widget {
* .swt.widgets.Composite, int) * .swt.widgets.Composite, int)
*/ */
@Override @Override
public Composite buildComposite(Composite parent, int style) { public Composite buildComposite(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE); Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(new GridLayout()); composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); composite
.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
button = new Button(composite, SWT.PUSH); button = new Button(composite, SWT.PUSH);
button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); button.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
if (this.text != null) { if (this.text != null) {
button.setText(makeGuiLabel(this.text)); button.setText(makeGuiLabel(this.text));
} }

View file

@ -22,6 +22,7 @@ package com.raytheon.uf.viz.python.swt.widgets;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.List; import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
@ -97,18 +98,19 @@ public class ScaleWidget extends Widget {
* .swt.widgets.Composite, int) * .swt.widgets.Composite, int)
*/ */
@Override @Override
public Composite buildComposite(Composite parent, int style) { public Composite buildComposite(Composite parent) {
Group group = new Group(parent, style); Group group = new Group(parent, SWT.NONE);
group.setText(makeGuiLabel(getLabel())); group.setText(makeGuiLabel(getLabel()));
group.setLayout(new GridLayout()); group.setLayout(new GridLayout());
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
label = new Label(group, style); label = new Label(group, SWT.CENTER);
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); label.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
scale = new Scale(group, style); scale = new Scale(group, SWT.HORIZONTAL);
scale.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData layoutData = new GridData(300, SWT.DEFAULT);
scale.setLayoutData(layoutData);
minValue = ((Number) (getOptions().get(0))).floatValue(); minValue = ((Number) (getOptions().get(0))).floatValue();
maxValue = ((Number) (getOptions().get(1))).floatValue(); maxValue = ((Number) (getOptions().get(1))).floatValue();

View file

@ -51,7 +51,7 @@ public class ScrollbarWidget extends Widget {
* .swt.widgets.Composite, int) * .swt.widgets.Composite, int)
*/ */
@Override @Override
public Composite buildComposite(Composite parent, int style) { public Composite buildComposite(Composite parent) {
parent.getShell().pack(); parent.getShell().pack();
Point size = parent.getShell().getSize(); Point size = parent.getShell().getSize();
parent.getShell().setSize(size.x, ((Number) (getValue())).intValue()); parent.getShell().setSize(size.x, ((Number) (getValue())).intValue());

View file

@ -59,7 +59,7 @@ public abstract class Widget {
* Class constructor * Class constructor
*/ */
protected Widget() { protected Widget() {
options = new ArrayList<Object>(); this.options = new ArrayList<Object>();
} }
/** /**
@ -154,10 +154,9 @@ public abstract class Widget {
* Builds a composite for the widget attached to the given parent. * Builds a composite for the widget attached to the given parent.
* *
* @param parent * @param parent
* @param style
* @return Composite capable of being placed into an SWT container. * @return Composite capable of being placed into an SWT container.
*/ */
public abstract Composite buildComposite(Composite parent, int style); public abstract Composite buildComposite(Composite parent);
/** /**
* @param variable * @param variable

View file

@ -202,36 +202,6 @@ public class QPFResource extends AbstractMapVectorResource implements
descriptor); descriptor);
} }
@SuppressWarnings("unchecked")
@Override
public AbstractVizResource<AbstractRequestableResourceData, MapDescriptor> getStreamlineResource()
throws VizException {
return (AbstractVizResource<AbstractRequestableResourceData, MapDescriptor>) this.resourceData
.construct(new GridLoadProperties(
com.raytheon.uf.viz.core.rsc.DisplayType.STREAMLINE),
descriptor);
}
@SuppressWarnings("unchecked")
@Override
public AbstractVizResource<AbstractRequestableResourceData, MapDescriptor> getWindBarbResource()
throws VizException {
return (AbstractVizResource<AbstractRequestableResourceData, MapDescriptor>) this.resourceData
.construct(new GridLoadProperties(
com.raytheon.uf.viz.core.rsc.DisplayType.BARB),
descriptor);
}
@SuppressWarnings("unchecked")
@Override
public AbstractVizResource<AbstractRequestableResourceData, MapDescriptor> getArrowResource()
throws VizException {
return (AbstractVizResource<AbstractRequestableResourceData, MapDescriptor>) this.resourceData
.construct(new GridLoadProperties(
com.raytheon.uf.viz.core.rsc.DisplayType.ARROW),
descriptor);
}
@Override @Override
public void resourceChanged(ChangeType type, Object object) { public void resourceChanged(ChangeType type, Object object) {
if (type.equals(ChangeType.DATA_UPDATE)) { if (type.equals(ChangeType.DATA_UPDATE)) {
@ -254,31 +224,4 @@ public class QPFResource extends AbstractMapVectorResource implements
return null; return null;
} }
@Override
public boolean isStreamlineVector() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isWindVector() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isArrowVector() {
// TODO Auto-generated method stub
return false;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return false;
}
} }

View file

@ -173,13 +173,13 @@ public class TearOffMenuListener implements IMenuListener2 {
longest = check; longest = check;
} }
} }
byte[] bytes = new byte[longest.length() * 2]; int length = longest.length();
Arrays.fill(bytes, (byte) '|'); if (length == 0) {
// String filled = new String(bytes); length = 10;
String filled = "- - - - - - TEAR-OFF : " }
+ menu.getParentItem().getText() + " - - - - - -"; byte[] bytes = new byte[length];
// String filled = "-" * bytes.length Arrays.fill(bytes, (byte) '-');
String filled = new String(bytes);
new ActionContributionItem(new TearOffAction(filled, manager, menu)) new ActionContributionItem(new TearOffAction(filled, manager, menu))
.fill(menu, index); .fill(menu, index);
} }

View file

@ -19,11 +19,19 @@
**/ **/
package com.raytheon.uf.viz.xy.crosssection; package com.raytheon.uf.viz.xy.crosssection;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import org.geotools.geometry.DirectPosition2D;
import org.geotools.referencing.GeodeticCalculator; import org.geotools.referencing.GeodeticCalculator;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import com.raytheon.uf.common.geospatial.MapUtil;
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.xy.crosssection.CrossSectionRotationsFile.RotationMode; import com.raytheon.uf.viz.xy.crosssection.CrossSectionRotationsFile.RotationMode;
import com.raytheon.viz.core.slice.request.HeightScale; import com.raytheon.viz.core.slice.request.HeightScale;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
@ -46,10 +54,13 @@ import com.vividsolutions.jts.geom.Coordinate;
*/ */
public class CrossSectionRotation { public class CrossSectionRotation {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CrossSectionRotation.class);
public static List<float[]> rotateVector(String parameter, public static List<float[]> rotateVector(String parameter,
List<Coordinate> linePoints, List<float[]> floatData, List<Coordinate> linePoints, List<float[]> floatData,
int lineLengthInMeters, HeightScale heightScale) { int lineLengthInMeters, HeightScale heightScale,
CoordinateReferenceSystem dataCRS) {
if (floatData.size() < 4) { if (floatData.size() < 4) {
return floatData; return floatData;
} }
@ -73,7 +84,7 @@ public class CrossSectionRotation {
int height = result.length / width; int height = result.length / width;
float[] cosRot = new float[width]; float[] cosRot = new float[width];
float[] sinRot = new float[width]; float[] sinRot = new float[width];
getRotationCoefs(linePoints, cosRot, sinRot); getRotationCoefs(linePoints, cosRot, sinRot, dataCRS);
switch (mode) { switch (mode) {
case VR_NO_ROTATION: { case VR_NO_ROTATION: {
return floatData; return floatData;
@ -166,18 +177,31 @@ public class CrossSectionRotation {
} }
private static void getRotationCoefs(List<Coordinate> linePoints, private static void getRotationCoefs(List<Coordinate> linePoints,
float[] cosRot, float[] sinRot) { float[] cosRot, float[] sinRot, CoordinateReferenceSystem crs) {
for (int i = 0; i < linePoints.size() - 1; i++) { List<Coordinate> convertedPoints = new ArrayList<Coordinate>();
Coordinate c1 = linePoints.get(i); try {
Coordinate c2 = linePoints.get(i + 1); MathTransform transform = MapUtil.getTransformFromLatLon(crs);
for (Coordinate c : linePoints) {
DirectPosition2D dp = new DirectPosition2D(c.x, c.y);
transform.transform(dp, dp);
convertedPoints.add(new Coordinate(dp.x, dp.y));
}
} catch (Throwable e) {
statusHandler.handle(Priority.VERBOSE,
"Error reprojecting points for cross section rotation", e);
convertedPoints = linePoints;
}
for (int i = 0; i < convertedPoints.size() - 1; i++) {
Coordinate c1 = convertedPoints.get(i);
Coordinate c2 = convertedPoints.get(i + 1);
double x = c2.x - c1.x; double x = c2.x - c1.x;
double y = c2.y - c1.y; double y = c2.y - c1.y;
double m = Math.sqrt(x * x + y * y); double m = Math.sqrt(x * x + y * y);
cosRot[i] = (float) (x / m); cosRot[i] = (float) (x / m);
sinRot[i] = (float) (y / m); sinRot[i] = (float) (y / m);
} }
cosRot[cosRot.length - 1] = Float.NaN; cosRot[cosRot.length - 1] = Float.NaN;
sinRot[sinRot.length - 1] = Float.NaN; sinRot[sinRot.length - 1] = Float.NaN;
} }
} }

View file

@ -29,8 +29,10 @@ import java.util.List;
import javax.measure.unit.Unit; import javax.measure.unit.Unit;
import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.coverage.grid.GridGeometry2D;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor; import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor;
@ -116,4 +118,8 @@ public abstract class AbstractCrossSectionAdapter<T extends PluginDataObject>
}); });
} }
public CoordinateReferenceSystem getDataCoordinateReferenceSystem() {
return MapUtil.LATLON_PROJECTION;
}
} }

View file

@ -258,7 +258,8 @@ public abstract class AbstractCrossSectionResource extends
.getExtent().getMaxX(), 0)[0]; .getExtent().getMaxX(), 0)[0];
floatData = CrossSectionRotation.rotateVector( floatData = CrossSectionRotation.rotateVector(
resourceData.getParameter(), Arrays.asList(lineData), resourceData.getParameter(), Arrays.asList(lineData),
floatData, lineLengthInMeters, descriptor.getHeightScale()); floatData, lineLengthInMeters, descriptor.getHeightScale(),
adapter.getDataCoordinateReferenceSystem());
if (adapter.getUnit().isCompatible(getUnit())) { if (adapter.getUnit().isCompatible(getUnit())) {
UnitConverter converter = adapter.getUnit().getConverterTo( UnitConverter converter = adapter.getUnit().getConverterTo(
getUnit()); getUnit());

View file

@ -45,11 +45,9 @@ import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.drawables.IFont; import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability; import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability; import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
@ -63,9 +61,7 @@ import com.raytheon.uf.viz.xy.crosssection.adapter.AbstractCrossSectionAdapter;
import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor; import com.raytheon.uf.viz.xy.crosssection.display.CrossSectionDescriptor;
import com.raytheon.viz.core.contours.ContourSupport; import com.raytheon.viz.core.contours.ContourSupport;
import com.raytheon.viz.core.contours.ContourSupport.ContourGroup; import com.raytheon.viz.core.contours.ContourSupport.ContourGroup;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.core.style.contour.ContourPreferences; import com.raytheon.viz.core.style.contour.ContourPreferences;
import com.raytheon.viz.grid.rsc.GridLoadProperties;
import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.Envelope;
/** /**
@ -86,7 +82,7 @@ import com.vividsolutions.jts.geom.Envelope;
*/ */
public class CrossSectionContourResource extends AbstractCrossSectionResource public class CrossSectionContourResource extends AbstractCrossSectionResource
implements ILoadableAsImage, IResourceDataChanged { implements IResourceDataChanged {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CrossSectionContourResource.class); .getHandler(CrossSectionContourResource.class);
@ -129,6 +125,8 @@ public class CrossSectionContourResource extends AbstractCrossSectionResource
if (sr != null) { if (sr != null) {
prefs = contourPrefs = (ContourPreferences) sr.getPreferences(); prefs = contourPrefs = (ContourPreferences) sr.getPreferences();
} }
getCapability(DisplayTypeCapability.class).setAlternativeDisplayTypes(
Arrays.asList(DisplayType.IMAGE));
} }
/* /*
@ -334,15 +332,6 @@ public class CrossSectionContourResource extends AbstractCrossSectionResource
contours.clear(); contours.clear();
} }
@Override
public AbstractVizResource<?, ?> getImageryResource() throws VizException {
GridLoadProperties props = new GridLoadProperties(DisplayType.IMAGE);
props.setResourceType(ResourceType.CROSS_SECTION);
AbstractVizResource<?, ?> rsc2 = resourceData.construct(props,
getDescriptor());
return rsc2;
}
@Override @Override
public void resourceChanged(ChangeType type, Object object) { public void resourceChanged(ChangeType type, Object object) {
if (type.equals(ChangeType.CAPABILITY)) { if (type.equals(ChangeType.CAPABILITY)) {
@ -352,16 +341,6 @@ public class CrossSectionContourResource extends AbstractCrossSectionResource
} }
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return true;
}
@Override @Override
public void disposeTimeData(DataTime dataTime) { public void disposeTimeData(DataTime dataTime) {
super.disposeTimeData(dataTime); super.disposeTimeData(dataTime);

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.xy.timeheight.rsc; package com.raytheon.uf.viz.xy.timeheight.rsc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.geotools.coverage.grid.GeneralGridGeometry; import org.geotools.coverage.grid.GeneralGridGeometry;
@ -30,11 +31,11 @@ import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IFont; import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability; import com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability; import com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria; import com.raytheon.uf.viz.core.style.ParamLevelMatchCriteria;
@ -45,10 +46,8 @@ import com.raytheon.uf.viz.xy.timeheight.display.TimeHeightDescriptor;
import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter; import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter;
import com.raytheon.viz.core.contours.ContourSupport; import com.raytheon.viz.core.contours.ContourSupport;
import com.raytheon.viz.core.contours.ContourSupport.ContourGroup; import com.raytheon.viz.core.contours.ContourSupport.ContourGroup;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation; import com.raytheon.viz.core.rsc.ICombinedResourceData.CombineOperation;
import com.raytheon.viz.core.style.contour.ContourPreferences; import com.raytheon.viz.core.style.contour.ContourPreferences;
import com.raytheon.viz.grid.rsc.GridLoadProperties;
/** /**
* Resource for displaying cross sections as contours * Resource for displaying cross sections as contours
@ -67,8 +66,7 @@ import com.raytheon.viz.grid.rsc.GridLoadProperties;
* @version 1.0 * @version 1.0
*/ */
public class TimeHeightContourResource extends AbstractTimeHeightResource public class TimeHeightContourResource extends AbstractTimeHeightResource {
implements ILoadableAsImage {
private static final double ZOOM_REACTION_FACTOR = .45; private static final double ZOOM_REACTION_FACTOR = .45;
@ -110,6 +108,8 @@ public class TimeHeightContourResource extends AbstractTimeHeightResource
if (sr != null) { if (sr != null) {
prefs = contourPrefs = (ContourPreferences) sr.getPreferences(); prefs = contourPrefs = (ContourPreferences) sr.getPreferences();
} }
getCapability(DisplayTypeCapability.class).setAlternativeDisplayTypes(
Arrays.asList(DisplayType.IMAGE));
} }
@Override @Override
@ -219,33 +219,6 @@ public class TimeHeightContourResource extends AbstractTimeHeightResource
} }
} }
@Override
public AbstractVizResource<?, ?> getImageryResource() throws VizException {
GridLoadProperties props = new GridLoadProperties(DisplayType.IMAGE);
// TimeHeightImageResource rsc = new
// TimeHeightImageResource(resourceData,
// props, adapter);
// rsc.geometry = geometry;
// rsc.interpolatedData = interpolatedData;
// use resource data to construct so that everything gets set up
// properly
AbstractVizResource<?, ?> rsc = this.getResourceData().construct(props,
this.getDescriptor());
return rsc;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return true;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.xy.timeheight.rsc; package com.raytheon.uf.viz.xy.timeheight.rsc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -35,7 +36,6 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IImage; import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.DisplayType; import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged; import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
@ -52,13 +52,11 @@ import com.raytheon.uf.viz.xy.InterpUtils;
import com.raytheon.uf.viz.xy.graph.IGraph; import com.raytheon.uf.viz.xy.graph.IGraph;
import com.raytheon.uf.viz.xy.timeheight.display.TimeHeightDescriptor; import com.raytheon.uf.viz.xy.timeheight.display.TimeHeightDescriptor;
import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter; import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter;
import com.raytheon.viz.core.contours.ILoadableAsImage;
import com.raytheon.viz.core.contours.util.VectorGraphicsRenderable; import com.raytheon.viz.core.contours.util.VectorGraphicsRenderable;
import com.raytheon.viz.core.graphing.xy.XYData; import com.raytheon.viz.core.graphing.xy.XYData;
import com.raytheon.viz.core.graphing.xy.XYWindImageData; import com.raytheon.viz.core.graphing.xy.XYWindImageData;
import com.raytheon.viz.core.slice.request.VerticalPointRequest.TimeDirection; import com.raytheon.viz.core.slice.request.VerticalPointRequest.TimeDirection;
import com.raytheon.viz.core.style.arrow.ArrowPreferences; import com.raytheon.viz.core.style.arrow.ArrowPreferences;
import com.raytheon.viz.grid.rsc.GridLoadProperties;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
@ -81,7 +79,7 @@ import com.vividsolutions.jts.geom.Coordinate;
*/ */
public class TimeHeightVectorResource extends AbstractTimeHeightResource public class TimeHeightVectorResource extends AbstractTimeHeightResource
implements ILoadableAsImage, IResourceDataChanged { implements IResourceDataChanged {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TimeHeightVectorResource.class); .getHandler(TimeHeightVectorResource.class);
@ -114,6 +112,8 @@ public class TimeHeightVectorResource extends AbstractTimeHeightResource
prefs = arrowPrefs = (ArrowPreferences) sr.getPreferences(); prefs = arrowPrefs = (ArrowPreferences) sr.getPreferences();
} }
this.getResourceData().addChangeListener(this); this.getResourceData().addChangeListener(this);
getCapability(DisplayTypeCapability.class).setAlternativeDisplayTypes(
Arrays.asList(DisplayType.IMAGE));
} }
@Override @Override
@ -275,25 +275,6 @@ public class TimeHeightVectorResource extends AbstractTimeHeightResource
vgr.dispose(); vgr.dispose();
} }
@Override
public AbstractVizResource<?, ?> getImageryResource() throws VizException {
GridLoadProperties props = new GridLoadProperties(DisplayType.IMAGE);
TimeHeightImageResource rsc = new TimeHeightImageResource(resourceData,
props, adapter);
rsc.interpolatedData = interpolatedData;
return rsc;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.core.contours.ILoadableAsImage#isLoadableAsImage()
*/
@Override
public boolean isLoadableAsImage() {
return true;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

View file

@ -13,9 +13,9 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.texteditor, com.raytheon.viz.texteditor,
org.geotools, org.geotools,
com.raytheon.edex.plugin.ccfp, com.raytheon.edex.plugin.ccfp,
com.raytheon.edex.plugin.taf,
com.raytheon.uf.common.pointdata;bundle-version="1.11.7", com.raytheon.uf.common.pointdata;bundle-version="1.11.7",
com.raytheon.uf.common.serialization, com.raytheon.uf.common.serialization,
com.raytheon.edex.plugin.taf;bundle-version="1.12.1174",
com.raytheon.viz.pointdata;bundle-version="1.11.7", com.raytheon.viz.pointdata;bundle-version="1.11.7",
com.raytheon.uf.common.python;bundle-version="1.11.7", com.raytheon.uf.common.python;bundle-version="1.11.7",
org.jep;bundle-version="1.0.0", org.jep;bundle-version="1.0.0",
@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.0.0", com.raytheon.uf.common.dataplugin.binlightning;bundle-version="1.0.0",
com.raytheon.uf.common.site, com.raytheon.uf.common.site,
com.raytheon.viz.ui.personalities.awips;bundle-version="1.12.1174", com.raytheon.viz.ui.personalities.awips;bundle-version="1.12.1174",
com.raytheon.uf.viz.application;bundle-version="1.0.0" com.raytheon.uf.viz.application;bundle-version="1.0.0",
com.raytheon.uf.common.tafqueue;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Export-Package: com.raytheon.viz.aviation, Export-Package: com.raytheon.viz.aviation,

View file

@ -49,8 +49,6 @@ import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.viz.aviation.monitor.TafUtil; import com.raytheon.viz.aviation.monitor.TafUtil;
import com.raytheon.viz.aviation.resource.ResourceConfigMgr; import com.raytheon.viz.aviation.resource.ResourceConfigMgr;
import com.raytheon.viz.aviation.resource.ResourceConfigMgr.ResourceTag; import com.raytheon.viz.aviation.resource.ResourceConfigMgr.ResourceTag;
import com.raytheon.viz.aviation.utility.TafMessageData;
import com.raytheon.viz.aviation.utility.TransmissionQueue;
import com.raytheon.viz.avnconfig.ITafSiteConfig; import com.raytheon.viz.avnconfig.ITafSiteConfig;
import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteConfigFactory;
import com.raytheon.viz.avnconfig.TafSiteData; import com.raytheon.viz.avnconfig.TafSiteData;
@ -502,66 +500,21 @@ public class LoaderDialog extends CaveSWTDialog {
String issueTime = ""; String issueTime = "";
String bbb = tagToBBB(); String bbb = tagToBBB();
String siteId = ""; String siteId = "";
boolean removePendingTags = false;
for (int i = 0; i < selected.length; i++) { for (int i = 0; i < selected.length; i++) {
String ident = selected[i]; String ident = selected[i];
sb.append(TafUtil.LINE_BREAK); sb.append(TafUtil.LINE_BREAK);
sb.append(TafUtil.LINE_BREAK); sb.append(TafUtil.LINE_BREAK);
// Always retrieve pending TAF from the queue // Always retrieve pending TAF from the queue
TafMessageData pendingTaf = TransmissionQueue.getInstance()
.getPendingBySiteId(ident);
if (pendingTaf != null) {
// Only ask one time if pending TAF(s) should be removed.
if (removePendingTags == false) {
String tafType = "Routine";
String pbbb = pendingTaf.getBBB();
if (pbbb.startsWith("A")) {
tafType = "Amended";
} else if (pbbb.startsWith("C")) {
tafType = "Correctetd";
} else if (pbbb.startsWith("R")) {
tafType = "Delayed";
}
String msg = tafType
+ " TAF(s) in pending queue will be removed!\n"
+ "Is this what you want to do? If not, press \'No\' and re-check\n"
+ "TAF forecast type for editing.";
MessageBox msgBox = new MessageBox(getParent(), SWT.YES
| SWT.NO);
msgBox.setMessage(msg);
msgBox.setText("Pending TAF");
if (SWT.YES == msgBox.open()) {
removePendingTags = true;
} else {
return;
}
}
String text = pendingTaf.getTafText();
sb.append(text);
TransmissionQueue.getInstance().remove(pendingTaf.getInfo());
if (i == 0) {
wmoId = pendingTaf.getWmoId();
siteId = pendingTaf.getSiteId();
bbb = pendingTaf.getBBB();
}
} else {
TafRecord taf = null; TafRecord taf = null;
if (order.equals("template") == false) { if (order.equals("template") == false) {
taf = TafUtil.getLatestTaf(ident); taf = TafUtil.getLatestTaf(ident);
if (taf == null) { if (taf == null) {
if (i == 0) { if (i == 0) {
tveDlg.setMessageStatusError("No TAF for site " tveDlg.setMessageStatusError("No TAF for site " + ident);
+ ident);
return; return;
} }
continue; continue;
// } else {
// // TODO the TafEditDialog.py __getForecast line: 1538
// -
// // 1540
} }
} }
@ -588,13 +541,11 @@ public class LoaderDialog extends CaveSWTDialog {
.split("=")[0]; .split("=")[0];
Pattern rexp_ramd = Pattern Pattern rexp_ramd = Pattern
.compile("\\s+AMD\\s(NOT\\sSKED|LTD\\sTO)([\\s\\w/]+)?"); .compile("\\s+AMD\\s(NOT\\sSKED|LTD\\sTO)([\\s\\w/]+)?");
fmtTaf = rexp_ramd.matcher(fmtTaf).replaceAll("") fmtTaf = rexp_ramd.matcher(fmtTaf).replaceAll("").trim();
.trim();
StringBuilder contents = new StringBuilder(fmtTaf); StringBuilder contents = new StringBuilder(fmtTaf);
contents.append(" ").append(sTmpl); contents.append(" ").append(sTmpl);
for (int index = 2; index < tmp.length; ++index) { for (int index = 2; index < tmp.length; ++index) {
contents.append(TafUtil.LINE_BREAK).append( contents.append(TafUtil.LINE_BREAK).append(tmp[index]);
tmp[index]);
} }
sb.append(contents); sb.append(contents);
} else { } else {
@ -613,14 +564,13 @@ public class LoaderDialog extends CaveSWTDialog {
} }
/** /**
* DR #5062: It appears that using the header that comes * DR #5062: It appears that using the header that comes with
* with the TAF gives a wrong wmoId and siteId; here, it is * the TAF gives a wrong wmoId and siteId; here, it is changed
* changed to use the header from TafSiteConfig; may need * to use the header from TafSiteConfig; may need further
* further investigation on this... * investigation on this...
*/ */
try { try {
ITafSiteConfig config = TafSiteConfigFactory ITafSiteConfig config = TafSiteConfigFactory.getInstance();
.getInstance();
TafSiteData siteData = config.getSite(ident); TafSiteData siteData = config.getSite(ident);
wmoId = siteData.wmo.split(" ")[0]; wmoId = siteData.wmo.split(" ")[0];
siteId = siteData.wmo.split(" ")[1]; siteId = siteData.wmo.split(" ")[1];
@ -635,7 +585,6 @@ public class LoaderDialog extends CaveSWTDialog {
bbb = tagToBBB(); bbb = tagToBBB();
} }
} }
}
tveDlg.populateEditorTab(sb.toString().trim(), wmoId, siteId, tveDlg.populateEditorTab(sb.toString().trim(), wmoId, siteId,
issueTime, bbb); issueTime, bbb);

View file

@ -42,11 +42,15 @@ import org.eclipse.swt.widgets.Spinner;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.tafqueue.ServerResponse;
import com.raytheon.uf.common.tafqueue.TafQueueRecord;
import com.raytheon.uf.common.tafqueue.TafQueueRequest;
import com.raytheon.uf.common.tafqueue.TafQueueRequest.Type;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.aviation.AviationDialog; import com.raytheon.viz.aviation.AviationDialog;
import com.raytheon.viz.aviation.editor.EditorTafTabComp; import com.raytheon.viz.aviation.editor.EditorTafTabComp;
import com.raytheon.viz.aviation.resource.ResourceConfigMgr; import com.raytheon.viz.aviation.resource.ResourceConfigMgr;
import com.raytheon.viz.aviation.utility.TafMessageData;
import com.raytheon.viz.aviation.utility.TransmissionQueue;
import com.raytheon.viz.aviation.xml.ForecasterConfig; import com.raytheon.viz.aviation.xml.ForecasterConfig;
import com.raytheon.viz.avnconfig.IStatusSettable; import com.raytheon.viz.avnconfig.IStatusSettable;
import com.raytheon.viz.avnconfig.ITafSiteConfig; import com.raytheon.viz.avnconfig.ITafSiteConfig;
@ -321,19 +325,34 @@ public class SendDialog extends CaveSWTDialog {
okBtn.addSelectionListener(new SelectionAdapter() { okBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
TransmissionQueue queue = TransmissionQueue.getInstance(); sendAction();
}
});
gd = new GridData(80, SWT.DEFAULT);
Button cancelBtn = new Button(buttonComp, SWT.PUSH);
configMgr.setDefaultFontAndColors(cancelBtn, "Cancel", gd);
cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
shell.dispose();
}
});
}
@SuppressWarnings("unchecked")
private void sendAction() {
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.CREATE);
// Forecaster ID // Forecaster ID
int forecasterId = forecasterArray.get( int forecasterId = forecasterArray.get(personList.getSelectionIndex())
personList.getSelectionIndex()).getId(); .getId();
// Transmit time
long now = System.currentTimeMillis();
Calendar xmitTime = Calendar.getInstance(); Calendar xmitTime = Calendar.getInstance();
xmitTime.setTimeInMillis(now);
xmitTime.setTimeZone(TimeZone.getTimeZone("GMT")); xmitTime.setTimeZone(TimeZone.getTimeZone("GMT"));
xmitTime.set(Calendar.HOUR_OF_DAY, hourSpnr.getSelection()); xmitTime.set(Calendar.HOUR_OF_DAY, hourSpnr.getSelection());
xmitTime.set(Calendar.MINUTE, minuteSpnr.getSelection()); xmitTime.set(Calendar.MINUTE, minuteSpnr.getSelection());
xmitTime.set(Calendar.SECOND, secondSpnr.getSelection()); xmitTime.set(Calendar.SECOND, secondSpnr.getSelection());
String xmitTimestamp = String.format(TIMESTAMP_FORMAT, String xmitTimestamp = String.format(TIMESTAMP_FORMAT,
xmitTime.get(Calendar.DAY_OF_MONTH), xmitTime.get(Calendar.DAY_OF_MONTH),
xmitTime.get(Calendar.HOUR_OF_DAY), xmitTime.get(Calendar.HOUR_OF_DAY),
@ -344,7 +363,8 @@ public class SendDialog extends CaveSWTDialog {
// WMO ID // WMO ID
String siteWmoId = tabComp.getWmoId(); String siteWmoId = tabComp.getWmoId();
// WMO Site // WMO Site
String siteNode = tabComp.getWmoSiteId(); String siteNode = null;
java.util.List<String> stationIds = new ArrayList<String>();
ArrayList<String> tafs = new ArrayList<String>(); ArrayList<String> tafs = new ArrayList<String>();
ArrayList<String> updatedTafs = new ArrayList<String>(); ArrayList<String> updatedTafs = new ArrayList<String>();
@ -372,40 +392,53 @@ public class SendDialog extends CaveSWTDialog {
} }
} }
boolean tafsQeueued = true;
java.util.List<TafQueueRecord> records = new ArrayList<TafQueueRecord>();
for (String tafText : tafs) { for (String tafText : tafs) {
String fourLetterId = tafText.substring( String fourLetterId = tafText.substring(tafText.indexOf('\n') + 1,
tafText.indexOf('\n') + 1,
tafText.indexOf(' ', tafText.indexOf('\n'))); tafText.indexOf(' ', tafText.indexOf('\n')));
// Site ID // Site ID
String siteId = fourLetterId.substring(1); String siteId = fourLetterId.substring(1);
// Type
String type = tafText.substring(0, 3);
// Update Header Time to transmission time. // Update Header Time to transmission time.
tafText = TIMESTAMP_PATTERN.matcher(tafText).replaceFirst( tafText = TIMESTAMP_PATTERN.matcher(tafText).replaceFirst(
xmitTimestamp); xmitTimestamp);
updatedTafs.add(tafText); updatedTafs.add(tafText);
try { try {
ITafSiteConfig config = TafSiteConfigFactory ITafSiteConfig config = TafSiteConfigFactory.getInstance();
.getInstance();
TafSiteData siteData = config.getSite(fourLetterId); TafSiteData siteData = config.getSite(fourLetterId);
siteWmoId = siteData.wmo.split(" ")[0]; siteWmoId = siteData.wmo.split(" ")[0];
siteNode = siteData.wmo.split(" ")[1]; siteNode = siteData.wmo.split(" ")[1];
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error reading site configuration for " "Error reading site configuration for " + siteId
+ siteId
+ ", attempting to proceed anyway", e); + ", attempting to proceed anyway", e);
} }
// Enqueue TAF for transmission TafQueueRecord record = new TafQueueRecord(forecasterId,
queue.enqueue(new TafMessageData(forecasterId, xmitTime, xmitTime.getTime(), tafText, bbb, siteId, siteWmoId,
tafText, bbb, siteId, siteWmoId, siteNode, type, siteNode, xmitTime.getTime());
xmitTime)); records.add(record);
} }
tabComp.setTafSent(true);
try {
// Enqueue TAFs for transmission
request.setRecords(records);
ServerResponse<String> response = (ServerResponse<String>) ThriftClient
.sendRequest(request);
if (response.isError()) {
statusHandler.handle(Priority.PROBLEM, response.toString());
tafsQeueued = false;
}
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
msgStatComp.setMessageText(e.getMessage(), shell.getDisplay()
.getSystemColor(SWT.COLOR_RED).getRGB());
}
if (tafsQeueued) {
// Update the TAF display with transmission time. // Update the TAF display with transmission time.
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
String prefix = ""; String prefix = "";
@ -415,21 +448,11 @@ public class SendDialog extends CaveSWTDialog {
} }
tabComp.getTextEditorControl().setText(sb.toString()); tabComp.getTextEditorControl().setText(sb.toString());
msgStatComp.setMessageText( msgStatComp.setMessageText(
"The TAF has been sent to the transmission queue.", "The TAF has been sent to the transmission queue.", shell
shell.getDisplay().getSystemColor(SWT.COLOR_GREEN) .getDisplay().getSystemColor(SWT.COLOR_GREEN)
.getRGB()); .getRGB());
shell.dispose();
} }
}); tabComp.setTafSent(tafsQeueued);
gd = new GridData(80, SWT.DEFAULT);
Button cancelBtn = new Button(buttonComp, SWT.PUSH);
configMgr.setDefaultFontAndColors(cancelBtn, "Cancel", gd);
cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
shell.dispose(); shell.dispose();
} }
});
}
} }

View file

@ -1,130 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.aviation.utility;
import java.util.Calendar;
import java.util.TimeZone;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 27, 2009 avarani Initial creation
*
* </pre>
*
* @author avarani
* @version 1.0
*/
public class TafMessageData implements Comparable<TafMessageData> {
private int forecasterId;
private Calendar xmitTime;
private String tafText;
private String bbb;
private String siteId;
private String siteWmoId;
private String siteNode;
private String type;
private Calendar headerTime;
public TafMessageData(int forecasterId, Calendar xmitTime, String tafText,
String bbb, String siteId, String siteWmoId, String siteNode,
String type, Calendar headerTime) {
this.forecasterId = forecasterId;
this.xmitTime = xmitTime;
this.tafText = tafText;
this.bbb = bbb;
this.siteId = siteId;
this.siteWmoId = siteWmoId;
this.siteNode = siteNode;
this.type = type;
this.headerTime = headerTime;
}
public String getInfo() {
return String
.format(
"%1$03d-%7$s%8$s%5$s-%6$s-%7$s-%2$ty%2$tm%2$td%2$tH%2$tM-%4$s-%9$d",
forecasterId, headerTime, tafText, bbb, siteId,
siteWmoId, siteNode, type,
(xmitTime.getTimeInMillis() / 1000));
}
// Update the xmitTime to the current time.
public void updateTime() {
xmitTime = Calendar.getInstance();
xmitTime.setTimeInMillis(System.currentTimeMillis());
xmitTime.setTimeZone(TimeZone.getTimeZone("GMT"));
}
public long getXmitTime() {
return xmitTime.getTimeInMillis();
}
public String getTafText() {
return tafText;
}
/*
* (non-Javadoc)
*
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
@Override
public int compareTo(TafMessageData o) {
if (o.xmitTime.before(this.xmitTime)) {
return -1;
} else if (this.xmitTime.before(o.xmitTime)) {
return 1;
} else {
return 0;
}
}
public String getSiteId() {
return siteId;
}
public String getWmoId() {
return siteWmoId;
}
public String getBBB() {
return bbb;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
}

View file

@ -1,191 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.aviation.utility;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Calendar;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import com.raytheon.uf.common.dissemination.OUPRequest;
import com.raytheon.uf.common.dissemination.OUPResponse;
import com.raytheon.uf.common.dissemination.OfficialUserProduct;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
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.uf.viz.core.requests.ThriftClient;
/**
* This job handles the actual transmission of the TAF.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 31, 2009 avarani Initial creation
*
* </pre>
*
* @author avarani
* @version 1.0
*/
public class TafTransmissionJob extends Job {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(TafTransmissionJob.class);
/**
* The TafMessageData to be sent out by this job.
*/
private TafMessageData data;
/**
* @param name
*/
public TafTransmissionJob(String name, TafMessageData data) {
super(name);
this.data = data;
}
/*
* (non-Javadoc)
*
* @seeorg.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
* IProgressMonitor)
*/
@Override
protected IStatus run(IProgressMonitor monitor) {
OfficialUserProduct oup = new OfficialUserProduct();
String name = data.getInfo();
String[] words = name.split("-");
String awips = words[1];
String tstamp = words[4].substring(4);
String bbb = words[5].substring(words[5].length() - 3);
oup.setFilename(name);
oup.setProductText(data.getTafText());
oup.setAwipsWanPil(awips);
oup.setUserDateTimeStamp(tstamp);
oup.setSource("AvnFPS");
if (!bbb.equals("___")) {
oup.setWmoType(bbb);
}
OUPRequest req = new OUPRequest();
req.setProduct(oup);
OUPResponse resp;
boolean success = false;
String additionalInfo = "";
try {
resp = (OUPResponse) ThriftClient.sendRequest(req);
success = resp.isSendLocalSuccess();
if (resp.hasFailure()) {
// check which kind of failure
Priority p = Priority.EVENTA;
if (!resp.isAttempted()) {
// if was never attempted to send or store even locally
p = Priority.CRITICAL;
additionalInfo = " ERROR local store never attempted";
} else if (!resp.isSendLocalSuccess()) {
// if send/store locally failed
p = Priority.CRITICAL;
additionalInfo = " ERROR store locally failed";
} else if (!resp.isSendWANSuccess()) {
// if send to WAN failed
if (resp.getNeedAcknowledgment()) {
// if ack was needed, if it never sent then no ack
// was received
p = Priority.CRITICAL;
additionalInfo = " ERROR send to WAN failed and no acknowledgment received";
} else {
// if no ack was needed
p = Priority.EVENTA;
additionalInfo = " WARNING send to WAN failed";
}
} else if (resp.getNeedAcknowledgment()
&& !resp.isAcknowledged()) {
// if sent but not acknowledged when acknowledgment is
// needed
p = Priority.CRITICAL;
additionalInfo = " ERROR no acknowledgment received";
}
statusHandler.handle(p, resp.getMessage());
}
} catch (VizException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
TransmissionQueue queue = TransmissionQueue.getInstance();
queue.updateMessageStatus(data, success);
String logMessage;
if (success) {
logMessage = "SUCCESS " + data.getInfo() + additionalInfo;
} else {
logMessage = "FAILURE " + data.getInfo() + additionalInfo;
}
String tempTafPath = "aviation/transmissionLogs/";
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
String path = pm.getFile(context, tempTafPath).getAbsolutePath();
File tmp = new File(path);
if (!(tmp.exists())) {
tmp.mkdirs();
}
String fname = "AviationTransmissionLog.txt";
LocalizationFile lFile = pm.getLocalizationFile(context, tempTafPath
+ fname);
File file = lFile.getFile();
try {
FileWriter writer = new FileWriter(file, true);
BufferedWriter output = new BufferedWriter(writer);
Calendar c = Calendar.getInstance();
String year = Integer.toString(c.get(Calendar.YEAR));
String month = Integer.toString(c.get(Calendar.MONTH) + 1);
String day = Integer.toString(c.get(Calendar.DAY_OF_MONTH));
output.write(year + month + day + "," + logMessage + "\n");
output.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return Status.OK_STATUS;
}
}

View file

@ -1,349 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.aviation.utility;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
/**
* The TransmissionQueue class manages the transmission queue for AvnFPS. It
* stores a list of TAFs that are pending and sent as well as a list of TAFs
* that failed to transmit.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 27, 2009 avarani Initial creation
*
* </pre>
*
* @author avarani
* @version 1.0
*/
public class TransmissionQueue {
private static TransmissionQueue xmitQueueInstance = null;
private HashMap<TafMessageData, TafTransmissionJob> pendingList;
private ArrayList<TafMessageData> sentList;
private ArrayList<TafMessageData> errorList;
/**
* private constructor
*/
private TransmissionQueue() {
pendingList = new HashMap<TafMessageData, TafTransmissionJob>();
sentList = new ArrayList<TafMessageData>();
errorList = new ArrayList<TafMessageData>();
}
/**
* @return a reference to the TransmissionQueue instance
*/
public static synchronized TransmissionQueue getInstance() {
if (xmitQueueInstance == null) {
xmitQueueInstance = new TransmissionQueue();
}
return xmitQueueInstance;
}
/**
* Add a TafMessageData object to the pending queue.
*
* @param data
* TafMessageData object
*/
public void enqueue(TafMessageData data) {
long now = System.currentTimeMillis();
long xmitTime = data.getXmitTime();
long delay = xmitTime - now;
if (delay < 0) {
delay = 0;
}
TafTransmissionJob job = new TafTransmissionJob(
"AvnFPS TAF transmission job", data);
job.setSystem(true);
job.schedule(delay);
pendingList.put(data, job);
}
/**
* Prohibit cloning
*/
@Override
public Object clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException();
}
/**
* Retrieve a list of the pending TAFs.
*
* @return an ArrayList containing the info strings of the pending TAFs.
*/
public ArrayList<String> getPending() {
ArrayList<String> out = new ArrayList<String>();
Set<TafMessageData> keys = pendingList.keySet();
for (TafMessageData data : keys) {
out.add(data.getInfo());
}
return out;
}
public TafMessageData getPendingBySiteId(String siteId) {
Set<TafMessageData> keys = pendingList.keySet();
TafMessageData found = null;
for (TafMessageData data : keys) {
if (data.getSiteId().equals(siteId)) {
found = data;
break;
}
}
return found;
}
/**
* Retrieve a list of the TAFs that have been successfuly sent.
*
* @return an ArrayLsit containing the info strings of the TAFs that have
* been successfuly sent.
*/
public ArrayList<String> getSent() {
ArrayList<String> out = new ArrayList<String>();
for (TafMessageData data : sentList) {
out.add(data.getInfo());
}
return out;
}
/**
* Retrieve a list of the TAFs that failed to send.
*
* @return an ArrayList containing the info string of the TAFs that failed
* to send.
*/
public ArrayList<String> getErrors() {
ArrayList<String> out = new ArrayList<String>();
for (TafMessageData data : errorList) {
out.add(data.getInfo());
}
return out;
}
/**
* Retrieve the text of a specified TAF in the pending list
*
* @param tafInfo
* TAF info string for the desired TAF
* @return The text of the TAF
*/
public String getPendingText(String tafInfo) {
Set<TafMessageData> keys = pendingList.keySet();
String text = null;
for (TafMessageData data : keys) {
if (tafInfo.equals(data.getInfo())) {
text = data.getTafText();
break;
}
}
return text;
}
/**
* Retrieve the text of a specified TAF in the sent list
*
* @param tafInfo
* TAF info string for the desired TAF
* @return The text of the TAF
*/
public String getSentText(String tafInfo) {
String text = null;
for (TafMessageData data : sentList) {
if (tafInfo.equals(data.getInfo())) {
text = data.getTafText();
break;
}
}
return text;
}
/**
* Retrieve the text of a specified TAF in the error list
*
* @param tafInfo
* TAF info string for the desired TAF
* @return The text of the TAF
*/
public String getErrorText(String tafInfo) {
String text = null;
for (TafMessageData data : errorList) {
if (tafInfo.equals(data.getInfo())) {
text = data.getTafText();
break;
}
}
return text;
}
/**
* Retrive a log of all transmission attempts for the current day.
*
* @return an ArrayList containing the status of all transmission attempts
* for the current day.
*/
public ArrayList<String> getLog() {
ArrayList<String> logList = new ArrayList<String>();
try {
String tempTafPath = "aviation/transmissionLogs/";
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationContext context = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.SITE);
String fname = "AviationTransmissionLog.txt";
LocalizationFile lFile = pm.getLocalizationFile(context,
tempTafPath + fname);
File file = lFile.getFile();
FileReader reader = new FileReader(file);
BufferedReader input = new BufferedReader(reader);
String line = null;
while ((line = input.readLine()) != null) {
logList.add(line);
}
} catch (IOException e) {
logList.add("Error, log file not found.");
}
return logList;
}
/**
* Remove a TAF from the list of pending TAFs.
*
* @param tafInfo
* the TafMessageData info string for the TAF to be removed from
* the pending queue.
*/
public void remove(String tafInfo) {
Set<TafMessageData> keys = pendingList.keySet();
for (TafMessageData data : keys) {
if (tafInfo.equals(data.getInfo())) {
TafTransmissionJob job = pendingList.remove(data);
job.cancel();
break;
}
}
}
/**
* Attempt to retransmit a TAF.
*
* @param tafInfo
* the TafMessageData info string for the TAF to retransmit.
* @param bad
* flag that determines which list to look in for the TAF to
* retransmit. True indicates the TAF should come from the error
* list, false indicates the sent list.
*/
public void retransmit(String tafInfo, boolean bad) {
TafMessageData retrans = null;
ArrayList<TafMessageData> list = null;
// If bad flag is set, check the bad list for the taf to retransmit,
// otherwise check the sent list.
if (bad) {
list = errorList;
} else {
list = sentList;
}
for (TafMessageData data : list) {
if (tafInfo.equals(data.getInfo())) {
list.remove(data);
retrans = data;
break;
}
}
retrans.updateTime();
enqueue(retrans);
}
/**
* Update the status of a pending TAF by moving it either to the sent or the
* error list. This method should only be called by the TafTransmissionJob's
* run method.
*
* @param taf
* the TafMessageData object to update
* @param success
* boolean
*/
public void updateMessageStatus(TafMessageData taf, boolean success) {
String tafInfo = taf.getInfo();
Set<TafMessageData> keys = pendingList.keySet();
for (TafMessageData data : keys) {
if (tafInfo.equals(data.getInfo())) {
pendingList.remove(data);
break;
}
}
if (success) {
sentList.add(taf);
} else {
errorList.add(taf);
}
}
}

View file

@ -21,8 +21,8 @@ package com.raytheon.viz.aviation.utility;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections; import java.util.Date;
import java.util.HashMap; import java.util.List;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.custom.StyledText;
@ -35,14 +35,21 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.tafqueue.ServerResponse;
import com.raytheon.uf.common.tafqueue.TafQueueRecord.TafQueueState;
import com.raytheon.uf.common.tafqueue.TafQueueRequest;
import com.raytheon.uf.common.tafqueue.TafQueueRequest.Type;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.aviation.resource.ResourceConfigMgr; import com.raytheon.viz.aviation.resource.ResourceConfigMgr;
import com.raytheon.viz.avnconfig.HelpUsageDlg; import com.raytheon.viz.avnconfig.HelpUsageDlg;
import com.raytheon.viz.avnconfig.IStatusSettable;
import com.raytheon.viz.avnconfig.MessageStatusComp; import com.raytheon.viz.avnconfig.MessageStatusComp;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.widgets.ToggleSelectList;
/** /**
* TransmissionQueueDlg class displays the Transmission Queue dialog for AvnFPS. * TransmissionQueueDlg class displays the Transmission Queue dialog for AvnFPS.
@ -52,6 +59,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 28 FEB 2008 938 lvenable Initial creation * 28 FEB 2008 938 lvenable Initial creation
* 14 MAY 2012 14715 rferrel Use EDEX to perform requests.
* *
* </pre> * </pre>
* *
@ -60,6 +68,26 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* *
*/ */
public class TransmissionQueueDlg extends CaveSWTDialog { public class TransmissionQueueDlg extends CaveSWTDialog {
private static String helpText = "This dialog is used to manage transmission and transmission log files.\n\n"
+ "The top area manages the forecast files written by the forecast editor.\n"
+ "The 'Files' scrolled list window lists files in one of 'pending', 'sent'\n"
+ "and 'bad' directories. The time is when the file was written. The file\n"
+ "name is \n"
+ " xxx-CCCCNNNXXX-yymmddHHMM-BBB\n"
+ "where xxx is the forecaster number. The transmission program \n"
+ "avnxmitserv uses NNN to determine the transmission window for regular\n"
+ "forecasts.\n\n"
+ "The bottom area is used to view transmission log files. There is one\n"
+ "file for each day of the week. By default, log files for the current day\n"
+ "are shown.\n\nButtons:\n"
+ " Refresh: refreshes both the directory list and log file windows.\n"
+ " View: allows to view selected transmission file(s)\n"
+ " Remove: deletes transmission files\n"
+ " Retransmit: forces the transmission program to send selected files.\n"
+ " If the file is in the 'bad' or 'sent' directory, it is \n"
+ " moved back to 'pending'. The transmission time (the last\n"
+ " part of the file name) is updated to the current time.\n"
+ " Help: displays this window";
/** /**
* Pending radio button. * Pending radio button.
@ -76,10 +104,17 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
*/ */
private Button badRdo; private Button badRdo;
/**
* Button to retransmit selected sent or bad records.
*/
private Button retransmitBtn;
/** /**
* Transmission list control. * Transmission list control.
*/ */
private List transList; private ToggleSelectList transList;
private java.util.List<String> transListId;
/** /**
* Transmission day control. * Transmission day control.
@ -100,15 +135,20 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
"Wednesday", "Thursday", "Friday", "Saturday" }; "Wednesday", "Thursday", "Friday", "Saturday" };
/** /**
* Selected day of the week. * The Selected day of the week Calendar day of the week value.
*/ */
private String selectedDay; private int selectedDay;
/** /**
* Main composite. * Main composite.
*/ */
private Composite mainComp; private Composite mainComp;
/**
* Message status composite.
*/
private IStatusSettable msgStatComp;
/** /**
* Constructor. * Constructor.
* *
@ -136,6 +176,8 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
GridLayout gl = new GridLayout(1, true); GridLayout gl = new GridLayout(1, true);
mainComp = new Composite(shell, SWT.NONE); mainComp = new Composite(shell, SWT.NONE);
mainComp.setLayout(gl); mainComp.setLayout(gl);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
mainComp.setLayoutData(gd);
// Initialize all of the controls and layouts // Initialize all of the controls and layouts
initializeComponents(); initializeComponents();
@ -145,8 +187,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
* Initialize the components on the display. * Initialize the components on the display.
*/ */
private void initializeComponents() { private void initializeComponents() {
int dayInt = Calendar.getInstance().get(Calendar.DAY_OF_WEEK); selectedDay = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
selectedDay = dayOfWeek[dayInt - 1];
ResourceConfigMgr configMgr = ResourceConfigMgr.getInstance(); ResourceConfigMgr configMgr = ResourceConfigMgr.getInstance();
configMgr.setDefaultColors(mainComp); configMgr.setDefaultColors(mainComp);
@ -162,6 +203,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
createMessageControl(configMgr); createMessageControl(configMgr);
populateData(); populateData();
updateDayTransList();
} }
/** /**
@ -198,6 +240,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
populateData(); populateData();
updateDayTransList();
} }
}); });
@ -209,25 +252,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
viewBtn.addSelectionListener(new SelectionAdapter() { viewBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
int idx = transList.getSelectionIndex(); viewTafs();
if (idx >= 0) {
String tafInfo = transList.getItem(idx);
TransmissionQueue queue = TransmissionQueue.getInstance();
String tafText = null;
if (pendingRdo.getSelection()) {
tafText = queue.getPendingText(tafInfo);
} else if (sentRdo.getSelection()) {
tafText = queue.getSentText(tafInfo);
} else if (badRdo.getSelection()) {
tafText = queue.getErrorText(tafInfo);
}
TransmissionViewerDlg tvd = new TransmissionViewerDlg(
shell, tafText, tafInfo);
tvd.open();
}
} }
}); });
@ -235,42 +260,33 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
Button removeBtn = new Button(buttonComp, SWT.PUSH); Button removeBtn = new Button(buttonComp, SWT.PUSH);
removeBtn.setLayoutData(gd); removeBtn.setLayoutData(gd);
removeBtn.setText("Remove"); removeBtn.setText("Remove");
removeBtn.setToolTipText("Delete selected forecast");
configMgr.setDefaultFontAndColors(removeBtn); configMgr.setDefaultFontAndColors(removeBtn);
removeBtn.addSelectionListener(new SelectionAdapter() { removeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
TransmissionQueue queue = TransmissionQueue.getInstance(); MessageBox questionMB = new MessageBox(shell, SWT.ICON_WARNING
| SWT.YES | SWT.NO);
if (pendingRdo.getSelection()) {
MessageBox questionMB = new MessageBox(shell,
SWT.ICON_WARNING | SWT.YES | SWT.NO);
questionMB.setText("Remove Pending Transmission"); questionMB.setText("Remove Pending Transmission");
questionMB questionMB
.setMessage("Are you sure you want to remove this pending transmission from the queue?"); .setMessage("Are you sure you want to remove this pending transmission from the queue?");
int result = questionMB.open(); int result = questionMB.open();
if (result == SWT.YES) { if (result == SWT.YES) {
queue.remove(transList.getItem(transList removeSelected();
.getSelectionIndex()));
populateData();
}
} }
} }
}); });
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Button retransmitBtn = new Button(buttonComp, SWT.PUSH); retransmitBtn = new Button(buttonComp, SWT.PUSH);
retransmitBtn.setLayoutData(gd); retransmitBtn.setLayoutData(gd);
retransmitBtn.setText("Retransmit"); retransmitBtn.setText("Retransmit");
configMgr.setDefaultFontAndColors(retransmitBtn); configMgr.setDefaultFontAndColors(retransmitBtn);
retransmitBtn.addSelectionListener(new SelectionAdapter() { retransmitBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
TransmissionQueue queue = TransmissionQueue.getInstance(); retransmit();
queue.retransmit(
transList.getItem(transList.getSelectionIndex()),
badRdo.getSelection());
populateData();
} }
}); });
@ -282,15 +298,140 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
helpBtn.addSelectionListener(new SelectionAdapter() { helpBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
String text = "This dialog is used to manage transmission and to transmission log files.\n\nThe top area is to manage forecast files written by the forecast editor.\nThe 'Files' scrolled list window lists files in one of 'pending', 'sent'\nand 'bad' directories. The time is when the file was written. The file\nname is \n xxx-CCCCNNNXXX-yymmddHHMM-BBB\nwhere xxx is the forecaster number. The transmission program \navnxmitserv uses NNN to determine the transmission window for regular \nforecasts.\n\nThe bottom area is used to view transmission log files. There is one \nfile for each day of the week. By default, log files for the current day \nare shown.\n\nButtons:\n Refresh: refreshes both the directory list and log file windows.\n View: allows to view selected transmission file(s)\n Remove: deletes transmission files\n Retransmit: forces the transmission program to send selected files.\n If the file is in the 'bad' or 'sent' directory, it is \n moved back to 'pending'. The transmission time (the last\n part of the file name) is updated to the current time.\n Help: displays this window";
String description = "Help"; String description = "Help";
HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description,
text); helpText);
usageDlg.open(); usageDlg.open();
} }
}); });
} }
/**
* Action method to request the selected records be immediately transmitted.
*/
@SuppressWarnings("unchecked")
private void retransmit() {
int[] indices = transList.getSelectionIndices();
if (indices.length == 0) {
return;
}
java.util.List<String> idList = new ArrayList<String>(indices.length);
for (int index : indices) {
idList.add(transListId.get(index));
}
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.RETRANSMIT);
request.setState(getDisplayState());
request.setArgument(idList);
try {
ServerResponse<java.util.List<String>> response = (ServerResponse<java.util.List<String>>) ThriftClient
.sendRequest(request);
int color = SWT.COLOR_GREEN;
if (response.isError()) {
color = SWT.COLOR_RED;
}
msgStatComp.setMessageText(response.getMessages().get(0),
getParent().getDisplay().getSystemColor(color).getRGB());
populateTransList(response.getPayload());
} catch (VizException e) {
msgStatComp.setMessageText(e.getMessage(), getParent().getDisplay()
.getSystemColor(SWT.COLOR_RED).getRGB());
}
}
/**
* Determine the state of the records being viewed.
*
* @return state
*/
private TafQueueState getDisplayState() {
TafQueueState state = TafQueueState.PENDING;
if (sentRdo.getSelection()) {
state = TafQueueState.SENT;
} else if (badRdo.getSelection()) {
state = TafQueueState.BAD;
}
return state;
}
/**
* This brings up the TAF viewer and populates it with the selected records.
*/
@SuppressWarnings("unchecked")
private void viewTafs() {
int[] indices = transList.getSelectionIndices();
if (indices.length == 0) {
return;
}
java.util.List<String> idList = new ArrayList<String>(indices.length);
for (int index : indices) {
idList.add(transListId.get(index));
}
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.GET_TAFS);
request.setArgument(idList);
ServerResponse<String> response = null;
try {
response = (ServerResponse<String>) ThriftClient
.sendRequest(request);
String tafText = response.getPayload();
String tafInfo = null;
if (indices.length == 1) {
tafInfo = transList.getItem(indices[0]);
} else {
tafInfo = "Viewing multiple forecasts";
}
TransmissionViewerDlg tvd = new TransmissionViewerDlg(shell,
tafText, tafInfo);
tvd.open();
} catch (VizException e) {
msgStatComp.setMessageText(e.getMessage(), getParent().getDisplay()
.getSystemColor(SWT.COLOR_RED).getRGB());
}
}
/**
* Action to perform to remove the selected records from being displayed.
* This updates the database and repopulates the list.
*/
@SuppressWarnings("unchecked")
private void removeSelected() {
int[] indices = transList.getSelectionIndices();
if (indices.length == 0) {
return;
}
java.util.List<String> idList = new ArrayList<String>(indices.length);
for (int index : indices) {
idList.add(transListId.get(index));
}
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.REMOVE_SELECTED);
request.setState(getDisplayState());
request.setArgument(idList);
try {
ServerResponse<java.util.List<String>> response = (ServerResponse<java.util.List<String>>) ThriftClient
.sendRequest(request);
populateTransList(response.getPayload());
int color = SWT.COLOR_GREEN;
if (response.isError()) {
color = SWT.COLOR_RED;
}
msgStatComp.setMessageText(response.getMessages().get(0),
getParent().getDisplay().getSystemColor(color).getRGB());
} catch (VizException e) {
msgStatComp.setMessageText(e.getMessage(), getParent().getDisplay()
.getSystemColor(SWT.COLOR_RED).getRGB());
}
}
/** /**
* Create the file transmission controls. * Create the file transmission controls.
*/ */
@ -316,36 +457,36 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
directoryGroup.setLayoutData(gd); directoryGroup.setLayoutData(gd);
configMgr.setDefaultFontAndColors(directoryGroup); configMgr.setDefaultFontAndColors(directoryGroup);
SelectionAdapter adapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
Button button = (Button) event.getSource();
if (button.getSelection()) {
retransmitBtn.setEnabled((Boolean) button.getData());
populateData();
}
}
};
gd = new GridData(85, SWT.DEFAULT); gd = new GridData(85, SWT.DEFAULT);
pendingRdo = new Button(directoryGroup, SWT.RADIO); pendingRdo = new Button(directoryGroup, SWT.RADIO);
configMgr.setDefaultFontAndColors(pendingRdo, "pending", gd); configMgr.setDefaultFontAndColors(pendingRdo, "pending", gd);
pendingRdo.addSelectionListener(new SelectionAdapter() { pendingRdo.addSelectionListener(adapter);
@Override pendingRdo.setData(false);
public void widgetSelected(SelectionEvent event) {
populateData();
}
});
gd = new GridData(85, SWT.DEFAULT); gd = new GridData(85, SWT.DEFAULT);
sentRdo = new Button(directoryGroup, SWT.RADIO); sentRdo = new Button(directoryGroup, SWT.RADIO);
sentRdo.setSelection(true); sentRdo.setSelection(true);
retransmitBtn.setEnabled(true);
configMgr.setDefaultFontAndColors(sentRdo, "sent", gd); configMgr.setDefaultFontAndColors(sentRdo, "sent", gd);
sentRdo.addSelectionListener(new SelectionAdapter() { sentRdo.addSelectionListener(adapter);
@Override sentRdo.setData(true);
public void widgetSelected(SelectionEvent event) {
populateData();
}
});
gd = new GridData(85, SWT.DEFAULT); gd = new GridData(85, SWT.DEFAULT);
badRdo = new Button(directoryGroup, SWT.RADIO); badRdo = new Button(directoryGroup, SWT.RADIO);
configMgr.setDefaultFontAndColors(badRdo, "bad", gd); configMgr.setDefaultFontAndColors(badRdo, "bad", gd);
badRdo.addSelectionListener(new SelectionAdapter() { badRdo.addSelectionListener(adapter);
@Override badRdo.setData(true);
public void widgetSelected(SelectionEvent event) {
populateData();
}
});
// ------------------------------------------------- // -------------------------------------------------
// Create right side label and transmission list // Create right side label and transmission list
@ -367,10 +508,11 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
gd.widthHint = 600; gd.widthHint = 600;
gd.heightHint = 150; gd.heightHint = 150;
transList = new List(transListComp, SWT.BORDER | SWT.SINGLE transList = new ToggleSelectList(transListComp, SWT.BORDER | SWT.MULTI
| SWT.V_SCROLL | SWT.H_SCROLL); | SWT.V_SCROLL | SWT.H_SCROLL);
transList.setLayoutData(gd); transList.setLayoutData(gd);
configMgr.setListBoxFont(transList); configMgr.setListBoxFont(transList);
transListId = new ArrayList<String>();
} }
/** /**
@ -384,22 +526,29 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
dayOfWeekComp.setLayoutData(gd); dayOfWeekComp.setLayoutData(gd);
configMgr.setDefaultColors(dayOfWeekComp); configMgr.setDefaultColors(dayOfWeekComp);
for (String day : dayOfWeek) { SelectionAdapter adapter = new SelectionAdapter() {
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
final Button dayRdo = new Button(dayOfWeekComp, SWT.RADIO);
dayRdo.setText(day);
dayRdo.setData(day);
dayRdo.setLayoutData(gd);
configMgr.setDefaultFontAndColors(dayRdo);
dayRdo.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
selectedDay = (String) dayRdo.getData(); Button dayRdo = (Button) event.getSource();
if (dayRdo.getSelection()) {
selectedDay = (Integer) dayRdo.getData();
updateDayTransList(); updateDayTransList();
} }
}); }
};
if (day.compareTo(selectedDay) == 0) { for (int index = 0; index < dayOfWeek.length; ++index) {
String day = dayOfWeek[index];
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Button dayRdo = new Button(dayOfWeekComp, SWT.RADIO);
dayRdo.setText(day);
// The Calendar.SUNDAY, MONDAY, etc.
dayRdo.setData(index + 1);
dayRdo.setLayoutData(gd);
configMgr.setDefaultFontAndColors(dayRdo);
dayRdo.addSelectionListener(adapter);
if (day.compareTo(dayOfWeek[selectedDay - 1]) == 0) {
dayRdo.setSelection(true); dayRdo.setSelection(true);
} }
} }
@ -418,7 +567,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
dayLbl = new Label(transAttemptComp, SWT.CENTER); dayLbl = new Label(transAttemptComp, SWT.CENTER);
dayLbl.setText(selectedDay); dayLbl.setText(dayOfWeek[selectedDay - 1]);
dayLbl.setLayoutData(gd); dayLbl.setLayoutData(gd);
configMgr.setDefaultFontAndColors(dayLbl); configMgr.setDefaultFontAndColors(dayLbl);
@ -431,83 +580,104 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
transStText.setEditable(false); transStText.setEditable(false);
transStText.setLayoutData(gd); transStText.setLayoutData(gd);
configMgr.setTextEditorFontAndColors(transStText); configMgr.setTextEditorFontAndColors(transStText);
updateDayTransList();
} }
/** /**
* Create the message status composite. * Create the message status composite.
*/ */
private void createMessageControl(ResourceConfigMgr configMgr) { private void createMessageControl(ResourceConfigMgr configMgr) {
new MessageStatusComp(mainComp, configMgr.getDefaultBackgroundRGB(), msgStatComp = new MessageStatusComp(mainComp,
configMgr.getDefaultBackgroundRGB(),
configMgr.getMsgBarBackground()); configMgr.getMsgBarBackground());
} }
/** /**
* Update the transmission day list. * Update the transmission day list.
*/ */
@SuppressWarnings("unchecked")
private void updateDayTransList() { private void updateDayTransList() {
TransmissionQueue queue = TransmissionQueue.getInstance(); TafQueueRequest request = new TafQueueRequest();
ArrayList<String> display = null; request.setType(Type.GET_LOG);
Calendar c = Calendar.getInstance(); List<Date> dateList = new ArrayList<Date>(2);
HashMap<String, String> calendar = new HashMap<String, String>();
String year = Integer.toString(c.get(Calendar.YEAR));
String month = Integer.toString(c.get(Calendar.MONTH) + 1);
String day = Integer.toString(c.get(Calendar.DATE));
String date = year + month + day;
calendar.put(dayOfWeek[c.get(Calendar.DAY_OF_WEEK) - 1], date);
for (int i = 1; i < 7; i++) { dayLbl.setText(dayOfWeek[selectedDay - 1]);
c.add(Calendar.DATE, -1); // Adjust currentDay to start of the day
year = Integer.toString(c.get(Calendar.YEAR)); Calendar currentDay = Calendar.getInstance();
month = Integer.toString(c.get(Calendar.MONTH) + 1); currentDay.set(Calendar.HOUR_OF_DAY, 0);
day = Integer.toString(c.get(Calendar.DATE)); currentDay.set(Calendar.MINUTE, 0);
date = year + month + day; currentDay.set(Calendar.SECOND, 0);
calendar.put(dayOfWeek[c.get(Calendar.DAY_OF_WEEK) - 1], date); currentDay.set(Calendar.MILLISECOND, 0);
// Adjust selected day to current or previous week.
Calendar selectedDayStart = Calendar.getInstance();
selectedDayStart.setTime(currentDay.getTime());
selectedDayStart.set(Calendar.DAY_OF_WEEK, selectedDay);
if (currentDay.compareTo(selectedDayStart) < 0) {
selectedDayStart.add(Calendar.DAY_OF_MONTH, -7);
} }
dateList.add(selectedDayStart.getTime());
dayLbl.setText(selectedDay); // Determine start of next day.
System.out.println(selectedDay); Calendar selectedDayEnd = Calendar.getInstance();
selectedDayEnd.setTime(selectedDayStart.getTime());
selectedDayEnd.add(Calendar.DAY_OF_MONTH, 1);
dateList.add(selectedDayEnd.getTime());
request.setArgument(dateList);
display = queue.getLog(); try {
String txt = ""; ServerResponse<String> response = (ServerResponse<String>) ThriftClient
.sendRequest(request);
if (display.size() == 1 && display.get(0).startsWith("Error")) { String text = response.getPayload();
txt = display.get(0); transStText.setText(text);
} else { } catch (VizException e) {
for (String str : display) { msgStatComp.setMessageText(e.getMessage(), getParent().getDisplay()
String today = calendar.get(selectedDay); .getSystemColor(SWT.COLOR_RED).getRGB());
String[] bits = str.split(",");
if (today.equals(bits[0])) {
txt += bits[1] + "\n";
} }
} }
}
transStText.setText(txt);
}
/** /**
* Populate the top text area with a list of TAF messages that have been * Populate the top text area with a list of TAF messages that have been
* successfuly sent, are pending transmission, or have failed. * successfully sent, are pending transmission, or have failed.
*/ */
@SuppressWarnings("unchecked")
private void populateData() { private void populateData() {
TransmissionQueue queue = TransmissionQueue.getInstance();
transList.removeAll(); transList.removeAll();
ArrayList<String> display = null; transListId.clear();
if (pendingRdo.getSelection()) { try {
display = queue.getPending(); TafQueueRequest request = new TafQueueRequest();
} else if (sentRdo.getSelection()) { request.setType(Type.GET_LIST);
display = queue.getSent();
} else if (badRdo.getSelection()) { request.setState(getDisplayState());
display = queue.getErrors();
ServerResponse<java.util.List<String>> response = (ServerResponse<java.util.List<String>>) ThriftClient
.sendRequest(request);
if (response.isError()) {
msgStatComp.setMessageText(response.getMessages().get(0),
getParent().getDisplay().getSystemColor(SWT.COLOR_RED)
.getRGB());
}
populateTransList(response.getPayload());
} catch (VizException e) {
msgStatComp.setMessageText(e.getMessage(), getParent().getDisplay()
.getSystemColor(SWT.COLOR_RED).getRGB());
}
} }
Collections.sort(display); /**
* This takes the payload list of strings and splits them up into the
for (String str : display) { * display list and a hidden list of record ids. Assumes each entry is of
transList.add(str); * the format: record_id,record_info.
*
* @param payload
*/
private void populateTransList(java.util.List<String> payload) {
transList.removeAll();
transListId.clear();
for (String record : payload) {
String[] bits = record.split(",");
transListId.add(bits[0]);
transList.add(bits[1]);
} }
} }
} }

View file

@ -79,6 +79,8 @@ public class TransmissionViewerDlg extends CaveSWTDialog {
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
mainComp = new Composite(shell, SWT.NONE); mainComp = new Composite(shell, SWT.NONE);
mainComp.setLayout(new GridLayout(1, false)); mainComp.setLayout(new GridLayout(1, false));
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
mainComp.setLayoutData(gd);
// Initialize all of the controls and layouts // Initialize all of the controls and layouts
initializeComponents(); initializeComponents();

View file

@ -130,8 +130,8 @@ public class HelpUsageDlg extends CaveSWTDialog {
*/ */
private void createHelpTextControl() { private void createHelpTextControl() {
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 300; gd.heightHint = 420;
gd.widthHint = 475; gd.widthHint = 600;
helpStTxt = new StyledText(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL helpStTxt = new StyledText(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL
| SWT.H_SCROLL); | SWT.H_SCROLL);
helpStTxt.setWordWrap(false); helpStTxt.setWordWrap(false);

View file

@ -50,4 +50,11 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="com.raytheon.uf.common.tafqueue"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature> </feature>

View file

@ -31,6 +31,7 @@ import org.eclipse.ui.IWorkbenchPart;
import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo; import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.DisplayType; import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.DisplayType;
import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.Mode; import com.raytheon.viz.awipstools.common.stormtrack.StormTrackState.Mode;
@ -102,11 +103,17 @@ public class StormTrackUIManager extends InputAdapter {
container.registerMouseHandler(this); container.registerMouseHandler(this);
} }
Display display = Display.getCurrent(); VizApp.runAsync(new Runnable() {
@Override
public void run() {
Display display = getShell().getDisplay();
movePolygon = display.getSystemCursor(SWT.CURSOR_SIZEALL);
movePoint = display.getSystemCursor(SWT.CURSOR_HAND);
arrow = display.getSystemCursor(SWT.CURSOR_ARROW);
}
});
movePolygon = new Cursor(display, SWT.CURSOR_SIZEALL);
movePoint = new Cursor(display, SWT.CURSOR_HAND);
arrow = new Cursor(display, SWT.CURSOR_ARROW);
} }
public void dispose() { public void dispose() {
@ -115,9 +122,6 @@ public class StormTrackUIManager extends InputAdapter {
container.unregisterMouseHandler(this); container.unregisterMouseHandler(this);
} }
movePolygon.dispose();
movePoint.dispose();
arrow.dispose();
} }
/** /**

View file

@ -559,7 +559,8 @@ public class TimeOfArrivalLayer extends AbstractStormTrackResource {
*/ */
public void reopenDialog() { public void reopenDialog() {
// Open the dialog // Open the dialog
if (dialog == null || dialog.getShell().isDisposed()) { if (dialog == null || dialog.getShell() == null
|| dialog.getShell().isDisposed()) {
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
@Override @Override

View file

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<?eclipse version="3.2"?>
<plugin>
<extension
point="com.raytheon.viz.ui.contextualMenu">
<contextualMenu
actionClass="com.raytheon.viz.core.contours.cmenu.ConvertToImagery"
capabilityInterface="com.raytheon.viz.core.contours.ILoadableAsImage"
name="Load as Image"
sortID="110">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.core.contours.cmenu.ConvertToStreamlines"
capabilityInterface="com.raytheon.viz.core.contours.ILoadableAsStreamline"
name="Load as Streamlines"
sortID="111">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.core.contours.cmenu.ConvertToWindBarbs"
capabilityInterface="com.raytheon.viz.core.contours.ILoadableAsWindBarbs"
name="Load as Wind Barbs"
sortID="112">
</contextualMenu>
<contextualMenu
actionClass="com.raytheon.viz.core.contours.cmenu.ConvertToArrows"
capabilityInterface="com.raytheon.viz.core.contours.ILoadableAsArrows"
name="Load as Arrows"
sortID="113">
</contextualMenu>
</extension>
</plugin>

View file

@ -1,52 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.core.contours;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 6, 2009 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public interface ILoadableAsArrows {
/**
* Return the corresponding imagery resource
*
* @return an imagery resource
* @throws VizException
*/
public abstract AbstractVizResource<?, ?> getArrowResource()
throws VizException;
public abstract boolean isArrowVector();
}

View file

@ -1,58 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.core.contours;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
/**
* ILoadableAsImage
*
* Interface that specifies an imagery resource can be created from an existing
* resource
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 25, 2007 chammack Initial Creation.
*
* </pre>
*
* @author chammack
* @version 1
*/
public interface ILoadableAsImage {
/**
* Return the corresponding imagery resource
*
* @return an imagery resource
* @throws VizException
*/
public abstract AbstractVizResource<?, ?> getImageryResource()
throws VizException;
public abstract boolean isLoadableAsImage();
}

View file

@ -1,58 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.core.contours;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
/**
* ILoadableAsStreamline
*
* Interface that specifies a streamline resource can be created from an
* existing resource
*
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 04, 2008 brockwoo Initial Creation.
*
* </pre>
*
* @author brockwoo
* @version 1
*/
public interface ILoadableAsStreamline {
/**
* Return the corresponding imagery resource
*
* @return an imagery resource
* @throws VizException
*/
public abstract AbstractVizResource<?, ?> getStreamlineResource()
throws VizException;
public abstract boolean isStreamlineVector();
}

View file

@ -1,52 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.core.contours;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 6, 2009 mschenke Initial creation
*
* </pre>
*
* @author mschenke
* @version 1.0
*/
public interface ILoadableAsWindBarbs {
/**
* Return the corresponding imagery resource
*
* @return an imagery resource
* @throws VizException
*/
public abstract AbstractVizResource<?, ?> getWindBarbResource()
throws VizException;
public abstract boolean isWindVector();
}

Some files were not shown because too many files have changed in this diff Show more