Merge branch 'development' into Enhanced_points
Former-commit-id:fa7c31206b
[formerly5feac55dbd
] [formerly32cf7fd764
[formerly 3aec6326bfce36758b93c7955ce3d0ee49e30cc3]] Former-commit-id:32cf7fd764
Former-commit-id:592ab923bb
This commit is contained in:
commit
5a8e58eda5
596 changed files with 28868 additions and 40120 deletions
|
@ -30,6 +30,6 @@
|
|||
<request> <productCode>34</productCode> <pdw20>16</pdw20> </request>
|
||||
<request> <productCode>34</productCode> <pdw20>32</pdw20> </request>
|
||||
</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"/>
|
||||
<cronOTR cron="0 10 * * * ?" productCode="173" randomWait="300" hoursBack="3" wmo="SDUS8" nnn="DU3"/>
|
||||
<cronOTR cron="0 10 12 * * ?" productCode="173" randomWait="300" hoursBack="24" wmo="SDUS8" nnn="DU6"/>
|
||||
</cronOTRConfiguration>
|
|
@ -21,14 +21,18 @@ package com.raytheon.rcm.server;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
|
||||
import com.raytheon.rcm.event.RadarEvent;
|
||||
import com.raytheon.rcm.event.RadarEventAdapter;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Send AlertViz notifications
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -37,6 +41,7 @@ import com.raytheon.rcm.event.RadarEventAdapter;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 9, 2011 mnash Initial creation
|
||||
* 2012-07-27 DR 14896 D. Friedman Handle multiple RPGs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,13 +51,15 @@ import com.raytheon.rcm.event.RadarEventAdapter;
|
|||
|
||||
public class RadarServerAvailable extends RadarEventAdapter {
|
||||
|
||||
private static boolean attempted = false;
|
||||
private static final String CONNECTION_DOWN_MESSAGE = "RPG connection is down.";
|
||||
private static final String CONNECTION_UP_MESSAGE = "RPG connection is back up.";
|
||||
|
||||
private static final String AWIPS2_FXA_PROPERTY = "awips2_fxa";
|
||||
private static final String DEFAULT_AWIPS2_FXA = "/awips2/fxa";
|
||||
private static final String ANNOUNCER_PATH = "bin" + File.separator + "fxaAnnounce";
|
||||
|
||||
private ProcessBuilder builder;
|
||||
private HashSet<String> knownFailures = new HashSet<String>();
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public RadarServerAvailable(RadarServer server) {
|
||||
}
|
||||
|
||||
|
@ -65,64 +72,73 @@ public class RadarServerAvailable extends RadarEventAdapter {
|
|||
*/
|
||||
@Override
|
||||
public void handleRadarEvent(RadarEvent event) {
|
||||
Process proc = null;
|
||||
String home = System.getProperty("awips2_fxa");
|
||||
if (home != null && !home.endsWith(File.separator)) {
|
||||
home += File.separator;
|
||||
} else if (home == null) {
|
||||
Log.event("Cannot find awips2_fxa system variable");
|
||||
return;
|
||||
}
|
||||
List<String> values = new ArrayList<String>();
|
||||
values.add(home + "bin" + File.separator + "fxaAnnounce");
|
||||
try {
|
||||
if (event.getType() == RadarEvent.CONNECTION_ATTEMPT_FAILED) {
|
||||
if (!attempted) {
|
||||
Log.event("Executing " + values.get(0));
|
||||
values.add(event.getRadarID() + " rpg connection is down.");
|
||||
values.add("RADAR");
|
||||
values.add("URGENT");
|
||||
builder = new ProcessBuilder(values);
|
||||
builder.redirectErrorStream(true);
|
||||
|
||||
proc = builder.start();
|
||||
StringBuilder output = new StringBuilder();
|
||||
Scanner s = new Scanner(proc.getInputStream());
|
||||
while (s.hasNextLine()) {
|
||||
if (output.length() > 0)
|
||||
output.append('\n');
|
||||
output.append(s.nextLine());
|
||||
}
|
||||
proc.waitFor();
|
||||
attempted = true;
|
||||
}
|
||||
} else if (event.getType() == RadarEvent.CONNECTION_UP) {
|
||||
if (attempted) {
|
||||
Log.event("Executing " + values.get(0));
|
||||
values.add(event.getRadarID()
|
||||
+ " rpg connection is back up.");
|
||||
values.add("RADAR");
|
||||
values.add("URGENT");
|
||||
builder = new ProcessBuilder(values);
|
||||
builder.redirectErrorStream(true);
|
||||
proc = builder.start();
|
||||
StringBuilder output = new StringBuilder();
|
||||
Scanner s = new Scanner(proc.getInputStream());
|
||||
while (s.hasNextLine()) {
|
||||
if (output.length() > 0)
|
||||
output.append('\n');
|
||||
output.append(s.nextLine());
|
||||
}
|
||||
proc.waitFor();
|
||||
attempted = false;
|
||||
}
|
||||
final String radarId = event.getRadarID();
|
||||
if (event.getType() == RadarEvent.CONNECTION_ATTEMPT_FAILED) {
|
||||
if (! knownFailures.contains(radarId)) {
|
||||
knownFailures.add(radarId);
|
||||
sendNotification(radarId, CONNECTION_DOWN_MESSAGE);
|
||||
}
|
||||
} else if (event.getType() == RadarEvent.CONNECTION_UP) {
|
||||
if (knownFailures.contains(radarId)) {
|
||||
knownFailures.remove(radarId);
|
||||
sendNotification(radarId, CONNECTION_UP_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendNotification(final String radarId, final String message) {
|
||||
getExecutorService().submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sendNotification2(radarId, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sendNotification2(String radarId, String message) {
|
||||
ProcessBuilder builder;
|
||||
Process proc = null;
|
||||
|
||||
String fxaDir = System.getProperty(AWIPS2_FXA_PROPERTY);
|
||||
if (fxaDir == null)
|
||||
fxaDir = DEFAULT_AWIPS2_FXA;
|
||||
|
||||
List<String> values = new ArrayList<String>();
|
||||
values.add(fxaDir + File.separator + ANNOUNCER_PATH);
|
||||
Log.event("Executing " + values.get(0));
|
||||
values.add(radarId + ' ' + message);
|
||||
values.add("RADAR");
|
||||
values.add("URGENT");
|
||||
builder = new ProcessBuilder(values);
|
||||
builder.redirectErrorStream(true);
|
||||
|
||||
try {
|
||||
proc = builder.start();
|
||||
Scanner s = new Scanner(proc.getInputStream());
|
||||
while (s.hasNextLine())
|
||||
s.nextLine();
|
||||
proc.waitFor();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Log.errorf("Error running fxaAnnounce: %s", e);
|
||||
} finally {
|
||||
if (proc != null) {
|
||||
proc.destroy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: has to be daemon until there is a shutdown notification
|
||||
private static ExecutorService executorService = Executors
|
||||
.newSingleThreadExecutor(new ThreadFactory() {
|
||||
@Override
|
||||
public Thread newThread(Runnable r) {
|
||||
Thread t = new Thread(r);
|
||||
t.setDaemon(true);
|
||||
return t;
|
||||
}
|
||||
});
|
||||
|
||||
private static ExecutorService getExecutorService() {
|
||||
return executorService;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,10 +178,6 @@
|
|||
<param name="feature"
|
||||
value="com.raytheon.uf.viz.localization.perspective.feature" />
|
||||
</antcall>
|
||||
<antcall target="p2.build.repo">
|
||||
<param name="feature"
|
||||
value="com.raytheon.uf.viz.alertviz.localization.feature" />
|
||||
</antcall>
|
||||
<antcall target="p2.build.repo">
|
||||
<param name="feature"
|
||||
value="com.raytheon.viz.radar.feature" />
|
||||
|
|
|
@ -21,10 +21,11 @@
|
|||
<!--
|
||||
Date DR# Engineer Description
|
||||
03/26/2012 12864 zhao Changed CigVisTrendTimeout from 300 to 1800
|
||||
07/27/2012 15169 zhao Changed WindRoseTimeout from 20 to 120
|
||||
-->
|
||||
<ClimateTimeouts>
|
||||
<ClimateMetarTimeout>20</ClimateMetarTimeout>
|
||||
<WindRoseTimeout>20</WindRoseTimeout>
|
||||
<WindRoseTimeout>120</WindRoseTimeout>
|
||||
<CigVisDistTimeout>90</CigVisDistTimeout>
|
||||
<CigVisTrendTimeout>1800</CigVisTrendTimeout>
|
||||
</ClimateTimeouts>
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
# DELIVERED
|
||||
#
|
||||
# History:
|
||||
# Revision 17
|
||||
# Created: 10-AUG-2012 15:00:00 GZHANG
|
||||
# DR 14702: Added fix for PyTables in Gui().trend()
|
||||
#
|
||||
# Revision 16 (DELIVERED)
|
||||
# Created: 06-MAR-2008 17:01:20 OBERFIEL
|
||||
# Added fix for leap-years.
|
||||
|
@ -661,7 +665,7 @@ class Gui():
|
|||
n1 = max(0, n-2*int((t-t1)//3600.0)-1) # small enough
|
||||
n2 = n1 + 5*self.MaxHours # big enough
|
||||
data = [(row['date_time'], row['cig'], row['vis']) for row in \
|
||||
table.where('(t1<=date_time) & (date_time<t2)')]
|
||||
table.where('(t1<=date_time) & (date_time<t2)', start=n1, stop=n2)]
|
||||
process_data(count, data, t1, self.MaxHours, table)
|
||||
# calculate frequencies
|
||||
args = count.keys()
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
#
|
||||
#
|
||||
import logging, re, time
|
||||
import Avn, AvnLib, Busy, TafDecoder, AvnParser
|
||||
import Avn, AvnLib, TafDecoder, AvnParser
|
||||
|
||||
_Logger = logging.getLogger(Avn.CATEGORY)
|
||||
_AmdPat = re.compile(r'(AFT|TIL)\s+(\d{6})|(\d{4}/\d{4})')
|
||||
|
@ -175,8 +175,7 @@ def updateTafs(bbb, fcsts):
|
|||
badidents.append(ident)
|
||||
|
||||
if badidents:
|
||||
Busy.showwarning('Could not update times for %s' % ' '.join(badidents),
|
||||
master)
|
||||
_Logger.warning('Could not update times for %s' % ' '.join(badidents))
|
||||
|
||||
return fcsts
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
#
|
||||
#
|
||||
import logging, time
|
||||
import Avn, AvnLib, AvnParser, Busy, Globals, TafDecoder
|
||||
import Avn, AvnLib, AvnParser, TafDecoder
|
||||
|
||||
import MetarData
|
||||
|
||||
|
@ -120,7 +120,6 @@ def updateTafs(bbb, fcsts):
|
|||
badidents.append(ident)
|
||||
|
||||
if badidents:
|
||||
Busy.showwarning('Could not update TAFs for %s' % ' '.join(badidents),
|
||||
master)
|
||||
_Logger.warning('Could not update TAFs for %s' % ' '.join(badidents))
|
||||
|
||||
return fcsts
|
||||
|
|
46
cave/build/static/common/cave/etc/bundles/maps/Locations.xml
Normal file
46
cave/build/static/common/cave/etc/bundles/maps/Locations.xml
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!--
|
||||
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.
|
||||
-->
|
||||
<bundle>
|
||||
<displayList>
|
||||
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<descriptor xsi:type="mapDescriptor">
|
||||
<resource>
|
||||
<loadProperties>
|
||||
<capabilities>
|
||||
<capability xsi:type="outlineCapability" lineStyle="SOLID" outlineOn="true" outlineWidth="1" />
|
||||
<capability xsi:type="colorableCapability" colorAsString="#9b9b9b" />
|
||||
<capability xsi:type="labelableCapability" labelField="name" />
|
||||
</capabilities>
|
||||
<resourceType>PLAN_VIEW</resourceType>
|
||||
</loadProperties>
|
||||
<properties isSystemResource="false" isBlinking="false" isMapLayer="true" isHoverOn="false" isVisible="true">
|
||||
<pdProps maxDisplayWidth="100000000" minDisplayWidth="0"/>
|
||||
</properties>
|
||||
<resourceData xsi:type="dbMapResourceData">
|
||||
<table>mapdata.location</table>
|
||||
<constraint>cwa = '${site}'</constraint>
|
||||
<mapName>Locations</mapName>
|
||||
</resourceData>
|
||||
</resource>
|
||||
</descriptor>
|
||||
</displays>
|
||||
</displayList>
|
||||
</bundle>
|
|
@ -354,10 +354,10 @@ MaxMenuItemsBeforeCascade = 30
|
|||
# Defines the percent that the office domain will be expanded for the
|
||||
# spatial editor full-screen view. The user can specify the expansion
|
||||
# for each of the four directions. If not specified, the default is 10%.
|
||||
OfficeDomain_expandLeft = 10 # ifpIMAGE only
|
||||
OfficeDomain_expandRight = 10 # ifpIMAGE only
|
||||
OfficeDomain_expandTop = 10 # ifpIMAGE only
|
||||
OfficeDomain_expandBottom = 10 # ifpIMAGE only
|
||||
OfficeDomain_expandLeft = 10
|
||||
OfficeDomain_expandRight = 10
|
||||
OfficeDomain_expandTop = 10
|
||||
OfficeDomain_expandBottom = 10
|
||||
|
||||
# Initial location of Edit Action Dialog
|
||||
# These are absolute screen coordinates (not relative to GFE window)
|
||||
|
|
|
@ -0,0 +1,307 @@
|
|||
# ----------------------------------------------------------------------------
|
||||
# This software is in the public domain, furnished "as is", without technical
|
||||
# support, and with no warranty, express or implied, as to its usefulness for
|
||||
# any purpose.
|
||||
#
|
||||
# MakeHazard.py
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# Apr 03,2012 436 randerso Converted to Python procedure to allow some
|
||||
# level of site customization
|
||||
# Apr 09,2012 436 randerso Merged RNK's MakeHazards_Elevation procedure
|
||||
#
|
||||
# Author: randerso
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# The MenuItems list defines the GFE menu item(s) under which the
|
||||
# Procedure is to appear.
|
||||
# Possible items are: Populate, Edit, Consistency, Verify, Hazards
|
||||
MenuItems = ["Hazards"]
|
||||
|
||||
|
||||
import SmartScript
|
||||
import time, string, sys
|
||||
import HazardUtils
|
||||
import re
|
||||
import numpy
|
||||
import LogStream
|
||||
import JUtil
|
||||
|
||||
class Procedure (SmartScript.SmartScript):
|
||||
def __init__(self, dbss):
|
||||
SmartScript.SmartScript.__init__(self, dbss)
|
||||
|
||||
self._dataManager = dbss
|
||||
self._afterInit = 0 #flag indicating init is done.
|
||||
|
||||
self._tropicalHaz = ['HU.W','HU.A','HU.S','TR.W','TR.A']
|
||||
self._natlBaseETN = 1001
|
||||
|
||||
|
||||
def setUpUI(self):
|
||||
if sys.modules.has_key("MakeHazardConfig"):
|
||||
sys.modules.__delitem__("MakeHazardConfig")
|
||||
import MakeHazardConfig
|
||||
|
||||
args = {}
|
||||
args['dataManager'] = self._dataManager
|
||||
args['selectedTimeRange'] = self.selectedTimeRange
|
||||
args['mapColor'] = MakeHazardConfig.mapColor
|
||||
args['defaultMapWidth'] = MakeHazardConfig.defaultMapWidth
|
||||
args['timeScaleEndTime'] = MakeHazardConfig.timeScaleEndTime
|
||||
args['areaThreshold'] = MakeHazardConfig.areaThreshold
|
||||
args['defaultHazardType'] = MakeHazardConfig.defaultHazardType
|
||||
args['mapNames'] = MakeHazardConfig.mapNames
|
||||
args['hazardDict'] = MakeHazardConfig.hazardDict
|
||||
args['tcmList'] = MakeHazardConfig.tcmList
|
||||
args['tropicalHaz'] = self._tropicalHaz
|
||||
args['natlBaseETN'] = self._natlBaseETN
|
||||
|
||||
if not hasattr(MakeHazardConfig, 'localEffectAreas') or \
|
||||
MakeHazardConfig.localEffectAreas is None:
|
||||
args['localEffectAreas'] = {}
|
||||
else:
|
||||
args['localEffectAreas'] = MakeHazardConfig.localEffectAreas
|
||||
|
||||
if not hasattr(MakeHazardConfig, 'localAreaData') or \
|
||||
MakeHazardConfig.localAreaData is None:
|
||||
args['localAreaData'] = {}
|
||||
else:
|
||||
args['localAreaData'] = MakeHazardConfig.localAreaData
|
||||
|
||||
# create the Java/SWT dialog and open it
|
||||
from com.raytheon.viz.gfe.makehazard import MakeHazardDialog
|
||||
self.__dlg = MakeHazardDialog.createFromPython(
|
||||
JUtil.pyValToJavaObj(args)
|
||||
)
|
||||
self.__dlg.openFromPython()
|
||||
|
||||
# run the Java/SWT event loop
|
||||
try:
|
||||
dismiss = False
|
||||
while not dismiss:
|
||||
args = JUtil.javaObjToPyVal(self.__dlg.runFromPython(), converter)
|
||||
dismiss = True;
|
||||
# if args is None, then Cancel was pressed
|
||||
if args is not None:
|
||||
# dismiss is True if the Run/Dismiss button is pressed,
|
||||
# false if Run is pressed
|
||||
dismiss = args["dismiss"]
|
||||
del args["dismiss"]
|
||||
|
||||
if self.makeHazardGrid(**args) != 1:
|
||||
dismiss = False
|
||||
finally:
|
||||
# close the Java/SWT dialog when Cancelled, Dismissed or exception occurs
|
||||
self.__dlg.closeFromPython()
|
||||
|
||||
# RJM modified this routine from the HazardUtility file
|
||||
# returns a Numeric mask where each zone in zoneList is set to 1
|
||||
def _makeMask(self, zoneList, hazLocalEffect):
|
||||
|
||||
# RJM had to modify this next line to point to the hazUtils
|
||||
# for the getGridSize routine.
|
||||
gridSize = self._hazUtils._getGridSize()
|
||||
mask = numpy.zeros(gridSize)
|
||||
eaList = self.editAreaList()
|
||||
|
||||
# Get the elevation from the GUI input. We'll do this by clipping
|
||||
# of any numerical digits from the local effect.
|
||||
# elevation_string = re.findall("\d+", hazLocalEffect)
|
||||
# print "re elevation=", elevation_string, "xxx"
|
||||
# try:
|
||||
# elevation = elevation_string[0]
|
||||
# except:
|
||||
# elevation = "None"
|
||||
# print "re elevation=", elevation, "xxx"
|
||||
for z in zoneList:
|
||||
print "in _makeMask processing zone ", z
|
||||
|
||||
if z in eaList:
|
||||
zoneArea = self.getEditArea(z)
|
||||
zoneMask = self.encodeEditArea(zoneArea)
|
||||
|
||||
# Code added by RJM. This checks to see if the local effect
|
||||
# area was specified and is a valid edit area. If so,
|
||||
# make a mask from it, and then do an intersection with
|
||||
# the zone mask.
|
||||
if hazLocalEffect in eaList:
|
||||
print "Masking",z,"with",hazLocalEffect
|
||||
localEffectArea = self.getEditArea(hazLocalEffect)
|
||||
localEffectMask = self.encodeEditArea(localEffectArea)
|
||||
zoneMask = numpy.logical_and(zoneMask, localEffectMask)
|
||||
|
||||
mask = numpy.logical_or(mask, zoneMask)
|
||||
# else:
|
||||
# if z in eaList:
|
||||
# zoneArea = self.getEditArea(z)
|
||||
# zoneMask = self.encodeEditArea(zoneArea)
|
||||
# mask = numpy.logical_or(mask, zoneMask)
|
||||
|
||||
return mask
|
||||
|
||||
# Creates the hazard grid based on the dialog input
|
||||
def makeHazardGrid(self, selectedHazard, timeRange, areaList, segmentNumber,
|
||||
selectedTimeRange, defaultAreaList, defaultHazard, defaultSegment,
|
||||
hazLocalEffect):
|
||||
siteID = self.getSiteID()
|
||||
usingHazLocalEffect = (hazLocalEffect != 'None')
|
||||
|
||||
if len(areaList) == 0:
|
||||
editArea = self.getActiveEditArea()
|
||||
mask = self.encodeEditArea(editArea)
|
||||
else:
|
||||
# make the mask based on the list selections
|
||||
if not usingHazLocalEffect:
|
||||
mask = self._hazUtils._makeMask(areaList)
|
||||
else:
|
||||
mask = self._makeMask(areaList, hazLocalEffect)
|
||||
|
||||
if usingHazLocalEffect:
|
||||
# get the segment number and filter for valid characters
|
||||
segNum = segmentNumber
|
||||
|
||||
# get the hazards currently defined as temporary grids
|
||||
hazParms = self.getHazardParmNames()
|
||||
|
||||
# look through the list of grids and create a list of
|
||||
# segment numbers (if any) that are already in use
|
||||
# for the current hazard
|
||||
# if len(hazParms) == 0:
|
||||
# self.statusBarMsg("No temporary grids to merge.", "S")
|
||||
# return 0
|
||||
segList = []
|
||||
print "selectedHazard=", selectedHazard
|
||||
selectedPhen = selectedHazard[0:2]
|
||||
selectedSig = selectedHazard[3]
|
||||
print "selectedPhen,selectedSig=", selectedPhen, ".", selectedSig
|
||||
for hazParm in hazParms:
|
||||
print "hazParm=", hazParm
|
||||
trList = self._hazUtils._getWEInventory(hazParm)
|
||||
for tr in trList:
|
||||
print " tr=", tr, timeRange
|
||||
intersect_hours = tr.intersection(timeRange).duration()
|
||||
print " intersect=", intersect_hours
|
||||
intersect_percent = intersect_hours / timeRange.duration() * 100.0
|
||||
print " intersect %=", intersect_percent
|
||||
phen = hazParm[3:5]
|
||||
sig = hazParm[5:6]
|
||||
print "phen,sig=", phen, ".", sig
|
||||
if len(hazParm) > 6:
|
||||
if hazParm[6:].isdigit():
|
||||
seg = int(hazParm[6:])
|
||||
print " seg=", seg
|
||||
if phen == selectedPhen and sig == selectedSig:
|
||||
segList.append(seg)
|
||||
print "appending ", seg
|
||||
else:
|
||||
seg = 0
|
||||
segList.sort()
|
||||
|
||||
# print "looping through segList"
|
||||
# for seg in segList:
|
||||
# print " seg=", seg," elev=", elevation
|
||||
# if str(elevation) == str(seg):
|
||||
# print "adding 1 to elevation"
|
||||
# elevation += 1
|
||||
#
|
||||
# if elevation > 400:
|
||||
# print "using elevation for segNum"
|
||||
# segNum = elevation
|
||||
# # replace the segmentNumber field with the elevation +/- the Above/Below indicator.
|
||||
# self.__dlg.setSegmentNumber(elevation)
|
||||
# segmentNumber = str(elevation)
|
||||
# print "*** segmentNumber=", segmentNumber
|
||||
|
||||
index = string.find(selectedHazard, " ")
|
||||
if index != -1:
|
||||
selectedHazard = selectedHazard[0:index]
|
||||
if len(segmentNumber) > 0:
|
||||
hazardKey = selectedHazard + ":" + segmentNumber
|
||||
else:
|
||||
hazardKey = selectedHazard
|
||||
|
||||
defaultHazKey = ""
|
||||
if len(defaultSegment) > 0 and defaultHazard is not None:
|
||||
defaultHazKey = defaultHazard + ":" + defaultSegment
|
||||
|
||||
weName = self._hazUtils._makeTempWEName(hazardKey)
|
||||
|
||||
# if we're modifying, remove the old grid first
|
||||
if defaultAreaList != [] and hazardKey == defaultHazKey:
|
||||
self.deleteCmd([weName], self.selectedTimeRange)
|
||||
|
||||
# if we have no selection prevent user from making an empty hazard
|
||||
if 1 not in mask:
|
||||
self.statusBarMsg("NO EDIT AREA SELECTED: \n Select area from map or load edit area in GFE!", "S")
|
||||
return 0
|
||||
|
||||
self._hazUtils._addHazard(weName, timeRange, hazardKey, mask)
|
||||
LogStream.logUse("Set: ", weName,
|
||||
self._hazUtils._printTime(timeRange.startTime().unixTime()),
|
||||
self._hazUtils._printTime(timeRange.endTime().unixTime()), hazardKey,
|
||||
self._hazUtils._printAreas(areaList))
|
||||
|
||||
return 1
|
||||
|
||||
def getHazardParmNames(self):
|
||||
# get the list of loaded temporary hazard parms
|
||||
parms = self.loadedParms()
|
||||
hazParms = []
|
||||
for weName, level, dbID in parms:
|
||||
if "haz" in weName:
|
||||
key = self._hazUtils._tempWENameToKey(weName)
|
||||
index = string.find(key, ":")
|
||||
if index != -1:
|
||||
mkey = key[0:index]
|
||||
segNum = key[index+1:]
|
||||
else:
|
||||
mkey = key
|
||||
segNum = ""
|
||||
|
||||
# append the hazard and a description
|
||||
parmName = "haz" + key
|
||||
parmName = string.replace(parmName, ".", "")
|
||||
parmName = string.replace(parmName, ":", "")
|
||||
hazParms.append(parmName)
|
||||
|
||||
return hazParms
|
||||
|
||||
def execute(self, timeRange):
|
||||
#self._hazUtils = HazardUtils.HazardUtils(self._dataManager, self.eaMgr())
|
||||
self._hazUtils = HazardUtils.HazardUtils(self._dataManager, None)
|
||||
# save the selected timeRange
|
||||
self.selectedTimeRange = timeRange
|
||||
|
||||
self.setToolType("numeric")
|
||||
|
||||
# see if the Hazards WE is loaded in the GFE, if not abort the tool
|
||||
if not self._hazUtils._hazardsLoaded():
|
||||
self.statusBarMsg("Hazards Weather Element must be loaded in " + \
|
||||
"the GFE before running MakeHazard", "S")
|
||||
self.cancel()
|
||||
|
||||
|
||||
# always separate the Hazards grid first
|
||||
self._hazUtils._separateHazardGrids()
|
||||
|
||||
self.setUpUI()
|
||||
|
||||
self._afterInit = 1 #initialization done
|
||||
|
||||
return
|
||||
|
||||
def converter(obj):
|
||||
import AbsTime
|
||||
import TimeRange
|
||||
retVal = None
|
||||
|
||||
objtype = obj.jclassname
|
||||
if objtype == "java.util.Date":
|
||||
retVal = AbsTime.AbsTime(obj)
|
||||
elif objtype == "com.raytheon.uf.common.time.TimeRange":
|
||||
retVal = TimeRange.TimeRange(obj)
|
||||
return retVal
|
||||
|
|
@ -1,157 +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.
|
||||
##
|
||||
|
||||
# AWIPS1 imports SmartScript to retrieve the site ID below, but
|
||||
# since all we need is just that site ID, it makes more sense to
|
||||
# import DataManager directly to get that rather than all of the
|
||||
# SmartScript module
|
||||
# import SmartScript
|
||||
from com.raytheon.viz.gfe.core import DataManager
|
||||
|
||||
def sortHazardList(dict):
|
||||
#sorts the entries in the menus in alphabetical order, returns sorted
|
||||
#dictionary
|
||||
import VTECTable
|
||||
for ent in dict.keys():
|
||||
values = dict[ent]
|
||||
# get the descriptive word for this phen/sig
|
||||
items = []
|
||||
for v in values:
|
||||
desc = VTECTable.VTECTable.get(v,'')
|
||||
items.append((desc, v))
|
||||
items.sort() #sorts by description
|
||||
#extract out the sorted phen/sig
|
||||
phensig = []
|
||||
for desc, v in items:
|
||||
phensig.append(v)
|
||||
dict[ent] = phensig
|
||||
return dict
|
||||
|
||||
|
||||
###########################################################
|
||||
############## ###############
|
||||
############## CONFIGURATION SECTION ###############
|
||||
############## ###############
|
||||
|
||||
# Lists of hazards organized by type in a dictionary
|
||||
# Set these to value you use for your site. To minimize scrolling,
|
||||
# change the order so that the most common values your site uses are
|
||||
# near the front of each list. The key is the menu entry on the
|
||||
# Make Hazard dialog, the values are the key values for Hazards.
|
||||
siteID = DataManager.getCurrentInstance().getSiteID()
|
||||
if siteID == "GUM":
|
||||
hazardDict = {
|
||||
'Hydrology' : ["FF.A", "FA.A"],
|
||||
'Fire Weather' : ["FW.A", "FW.W"],
|
||||
'Coastal Flood' : ["CF.S", "LS.S", "CF.Y", "CF.W", "CF.A",
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A", "RP.S"],
|
||||
'Non-Precipitation' : ["AF.W", "AF.Y", "AQ.Y", "AS.O", "AS.Y", "DU.Y",
|
||||
"DS.W", "EH.W", "EH.A", "EC.W", "EC.A", "FG.Y", "FZ.W", "FZ.A",
|
||||
"HZ.W", "HZ.A", "ZF.Y", "FR.Y", "HT.Y", "HW.W", "HW.A",
|
||||
"LW.Y", "SM.Y", "WI.Y"],
|
||||
'Marine' : ["MA.S", "MH.W", "MH.Y", "BW.Y", "UP.Y", "MF.Y",
|
||||
"GL.A", "GL.W", "SE.A", "SE.W", "UP.A", "UP.W", "HF.A", "HF.W", "LO.Y", "SC.Y", "SW.Y",
|
||||
"RB.Y", "SI.Y", "MS.Y", "SR.A", "SR.W"],
|
||||
'Typhoon' : ["TY.A", "TY.W", "TR.A", "TR.W", "HU.S"],
|
||||
'Tsunami' : ["TS.A", "TS.W"],
|
||||
|
||||
#'Local' : ["TEST"], #example of adding local hazards
|
||||
# you can define your own groups of hazards by adding new categories
|
||||
}
|
||||
else:
|
||||
hazardDict = {
|
||||
'Winter Weather' : ["BZ.W", "BZ.A", "ZR.Y",
|
||||
"IS.W", "LE.Y", "LE.W", "LE.A",
|
||||
"WC.Y", "WC.W", "WC.A", "WS.W", "WS.A", "WW.Y"],
|
||||
'Hydrology' : ["FF.A", "FA.A"],
|
||||
'Fire Weather' : ["FW.A", "FW.W"],
|
||||
'Convective Watches' : ["SV.A", "TO.A"],
|
||||
'Coastal Flood' : ["CF.S", "LS.S", "CF.Y", "CF.W", "CF.A",
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A", "RP.S"],
|
||||
'Non-Precipitation' : ["AF.W", "AF.Y", "AQ.Y", "AS.O", "AS.Y", "DU.Y",
|
||||
"DS.W", "EH.W", "EH.A", "EC.W", "EC.A", "FG.Y", "FZ.W", "FZ.A",
|
||||
"HZ.W", "HZ.A", "ZF.Y", "FR.Y", "HT.Y", "HW.W", "HW.A",
|
||||
"LW.Y", "SM.Y", "WI.Y"],
|
||||
'Marine' : ["MA.S", "MH.W", "MH.Y", "BW.Y", "UP.Y", "MF.Y",
|
||||
"GL.A", "GL.W", "SE.A", "SE.W", "UP.A", "UP.W", "HF.A", "HF.W", "LO.Y", "SC.Y", "SW.Y",
|
||||
"RB.Y", "SI.Y", "MS.Y", "SR.A", "SR.W"],
|
||||
'Tropical Cyclone' : ["HU.W", "HU.A", "HU.S", "TR.W", "TR.A"],
|
||||
'Tsunami' : ["TS.A", "TS.W"],
|
||||
|
||||
#'Local' : ["TEST"], #example of adding local hazards
|
||||
# you can define your own groups of hazards by adding new categories
|
||||
}
|
||||
|
||||
|
||||
# This function sorts the hazards in the hazardDict by description.
|
||||
# Comment it out if this is not desired.
|
||||
hazardDict = sortHazardList(hazardDict)
|
||||
|
||||
# Dictionary of map categories and the map names. The "<site>" is
|
||||
# substituted with your site name. The names of the map must match
|
||||
# those defined in the ifpServer. The keys in mapNames must match
|
||||
# the keys in hazardDict.
|
||||
|
||||
mapNames = {
|
||||
'Fire Weather' : ["FireWxZones_<site>"],
|
||||
'Hydrology' : ["Zones_<site>"],
|
||||
'Coastal Flood': ["Zones_<site>"],
|
||||
'Convective Watches' : ["Marine_Zones_<site>","FIPS_<site>"],
|
||||
'Non-Precipitation' : ["Zones_<site>"],
|
||||
'Tropical Cyclone' : ["Offshore_Marine_Zones_<site>",
|
||||
"Marine_Zones_<site>","Zones_<site>"],
|
||||
'Typhoon' : ["Offshore_Marine_Zones_<site>",
|
||||
"Marine_Zones_<site>","Zones_<site>"],
|
||||
'Tsunami' : ["Offshore_Marine_Zones_<site>",
|
||||
"Marine_Zones_<site>","Zones_<site>"],
|
||||
'Winter Weather' : ["Zones_<site>"],
|
||||
'Marine' : ["Offshore_Marine_Zones_<site>",
|
||||
"Marine_Zones_<site>"],
|
||||
#'Local' : ["Zones_<site>"], #example of adding local class
|
||||
}
|
||||
|
||||
# The hazard type chosen when MakeHazard opens
|
||||
defaultHazardType = "Non-Precipitation"
|
||||
|
||||
# this is the color for the selected areas in the map
|
||||
mapColor = "red"
|
||||
|
||||
# initial map width
|
||||
defaultMapWidth = 400;
|
||||
|
||||
# the percentage that an area must be covered to default to selected
|
||||
areaThreshold = 0.10
|
||||
|
||||
# End time in hours of the time scales
|
||||
timeScaleEndTime = 96
|
||||
|
||||
# Define the tropical product used to identify the particular storm
|
||||
tcmList = [] # Comment out for HLS sites
|
||||
|
||||
# Uncomment line below for Atlantic basin sites
|
||||
#tcmList = ["TCMAT1", "TCMAT2", "TCMAT3", "TCMAT4", "TCMAT5"]
|
||||
|
||||
# Uncomment line below for EPac basin sites
|
||||
#tcmList = ["TCMEP1", "TCMEP2", "TCMEP3", "TCMEP4", "TCMEP5"]
|
||||
|
||||
# Uncomment line below for CPac basin sites
|
||||
#self.tcmList = ["TCMCP1", "TCMCP2", "TCMCP3", "TCMCP4", "TCMCP5"]
|
||||
|
||||
#################### END CONFIGURATION SECTION #################
|
|
@ -1,207 +1,99 @@
|
|||
##
|
||||
# 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.
|
||||
##
|
||||
# ----------------------------------------------------------------------------
|
||||
# This software is in the public domain, furnished "as is", without technical
|
||||
# support, and with no warranty, express or implied, as to its usefulness for
|
||||
# any purpose.
|
||||
#
|
||||
#
|
||||
# QPF_SmartTool.py
|
||||
# This is an example of a more complicated tool.
|
||||
# It determines a QPF value based on the current QPF value,
|
||||
# the Wind value, and surrounding Topography
|
||||
# information.
|
||||
#
|
||||
# It has sub-methods that are called by the main method.
|
||||
# These sub-methods calculate Vertical Motion and translate
|
||||
# it into a QPF term.
|
||||
#
|
||||
# Author: wier (translated to Python by hansen)
|
||||
# Updated by hansen 1/00 based on suggestions from Rusty Billingsley
|
||||
# Updated by njensen for AWIPS-II
|
||||
# ----------------------------------------------------------------------------
|
||||
WeatherElementEdited = "QPF"
|
||||
|
||||
|
||||
ToolType = "numeric"
|
||||
WeatherElementEdited = "QPF"
|
||||
from numpy import *
|
||||
import MetLib, time
|
||||
|
||||
HideTool = 0
|
||||
|
||||
# You can screen the elements for which your tool will appear by using
|
||||
# a ScreenList. For example:
|
||||
#
|
||||
|
||||
VariableList = [
|
||||
("Vertical Motion Influence" , 50, "scale", [0,100]),
|
||||
("Vertical Motion Influence" , 50, "scale", [0,100]),
|
||||
]
|
||||
|
||||
# This allows us to use the sin and cos functions
|
||||
from math import *
|
||||
|
||||
from numpy import *
|
||||
|
||||
AVG_GRID_SPACE = 10000
|
||||
RAD_TO_DEG = 57.2958
|
||||
|
||||
####################
|
||||
# QPF Smart Tool
|
||||
# Set up Class
|
||||
import SmartScript
|
||||
# For available commands, see SmartScript
|
||||
|
||||
|
||||
class Tool (SmartScript.SmartScript):
|
||||
def __init__(self, dbss):
|
||||
SmartScript.SmartScript.__init__(self, dbss)
|
||||
|
||||
def execute(self, QPF, Wind, Topo, varDict):
|
||||
"Sets QPF within Active Edit Area based on Wind and Topo."
|
||||
# Smooths the specified grid by the specified factor
|
||||
# With factor == 3, 3x3 smooth, factor == 5 5x5 smooth, etc.
|
||||
# Even factors (4, 6, 8,...) round up to the next odd value
|
||||
# If factors <3 are specified, the unmodified grid is returned.
|
||||
def smoothGrid(self, grid, factor):
|
||||
# factors of less than 3 are useless or dangerous
|
||||
if factor < 3:
|
||||
return grid
|
||||
st = time.time()
|
||||
half = int(factor)/ 2
|
||||
sg = zeros(grid.shape,float64)
|
||||
count = zeros(grid.shape,float64)
|
||||
gridOfOnes = ones(grid.shape,float64)
|
||||
for y in xrange(-half, half + 1):
|
||||
for x in xrange(-half, half + 1):
|
||||
if y < 0:
|
||||
yTargetSlice = slice(-y, None, None)
|
||||
ySrcSlice = slice(0, y, None)
|
||||
if y == 0:
|
||||
yTargetSlice = slice(0, None, None)
|
||||
ySrcSlice = slice(0, None, None)
|
||||
if y > 0:
|
||||
yTargetSlice = slice(0, -y, None)
|
||||
ySrcSlice = slice(y, None, None)
|
||||
if x < 0:
|
||||
xTargetSlice = slice(-x, None, None)
|
||||
xSrcSlice = slice(0, x, None)
|
||||
if x == 0:
|
||||
xTargetSlice = slice(0, None, None)
|
||||
xSrcSlice = slice(0, None, None)
|
||||
if x > 0:
|
||||
xTargetSlice = slice(0, -x, None)
|
||||
xSrcSlice = slice(x, None, None)
|
||||
|
||||
VerticalMotion_Grid = self.VerticalMotionGrid(Wind, Topo)
|
||||
|
||||
scale = varDict["Vertical Motion Influence"] / 50.0
|
||||
|
||||
value = QPF * (1.0 + scale * VerticalMotion_Grid)
|
||||
return value.astype('float32')
|
||||
|
||||
def VerticalMotionGrid(self, Wind_Grid, Topo_Grid):
|
||||
# Create Vertical Motion grid from Wind Grid and Topography
|
||||
|
||||
# The Topo_Grid is a 2-D array where
|
||||
# each entry is a scalar elevation, for example:
|
||||
# x = 0
|
||||
# y = 0
|
||||
# elevation = Topo_Grid[x][y]
|
||||
|
||||
# The Wind_Grid is 2-D array where
|
||||
# each entry is a 2-tuple of magnitude and direction,
|
||||
# for example:
|
||||
# wind_tuple = Wind_Grid[x][y]
|
||||
# magnitude = wind_tuple[0]
|
||||
# direction = wind_tuple[1]
|
||||
|
||||
# Create a VerticalMotion_Grid that is
|
||||
# a 2-D array
|
||||
|
||||
xGridSize = len(Topo_Grid)
|
||||
yGridSize = len(Topo_Grid[0])
|
||||
vmArray = []
|
||||
|
||||
first = 1
|
||||
for x in range(xGridSize):
|
||||
# Add a new column
|
||||
vmArray = zeros(Topo_Grid.shape)
|
||||
|
||||
for y in range(yGridSize):
|
||||
# Calculate the value for this point
|
||||
wind_tuple = (Wind_Grid[0][x][y], Wind_Grid[1][x][y])
|
||||
vmValue = self.VerticalMotion(wind_tuple,Topo_Grid,x,y)
|
||||
|
||||
# Set the value
|
||||
vmArray[x][y] = vmValue
|
||||
|
||||
# Keep track of min/max values
|
||||
if first:
|
||||
first = 0
|
||||
min = vmValue
|
||||
max = vmValue
|
||||
else:
|
||||
if vmValue < min:
|
||||
min = vmValue
|
||||
if vmValue > max:
|
||||
max = vmValue
|
||||
|
||||
# Now normalize the grid to values between -1 and 1
|
||||
factor1 = (max + min) / 2
|
||||
factor2 = (max-min) / 2
|
||||
for x in range(xGridSize):
|
||||
for y in range(yGridSize):
|
||||
vmArray[x][y] = (vmArray[x][y] - factor1) / factor2
|
||||
|
||||
return vmArray
|
||||
|
||||
|
||||
def VerticalMotion(self, Wind, Topo_Grid, x,y):
|
||||
# wind is a 2-tuple: wind[0] is magnitude, wind[1] is direction
|
||||
magnitude = Wind[0]
|
||||
direction = Wind[1]
|
||||
|
||||
# Determine wind u and v components.
|
||||
# First compute wind vector angle from north, in radians.
|
||||
rads = (direction - 180) / RAD_TO_DEG
|
||||
|
||||
# u and v components
|
||||
# (convert from knots to meters per second 1.94384 knots / m/s )
|
||||
uw = sin(rads) * magnitude / 1.94384
|
||||
vw = cos(rads) * magnitude / 1.94384
|
||||
|
||||
# find slope vector components (svx, svy) at this point (x, y).
|
||||
# Direction is that of maximum slope and magnitude is the
|
||||
# slope = rise/run, unitless.
|
||||
svx, svy = self.findSlopeVector(x, y, Topo_Grid)
|
||||
|
||||
# multiply (dot product) wind vector by slope vector
|
||||
# to get the value of the vertical air motion.
|
||||
vertAirSpeed = uw * svx + vw * svy
|
||||
|
||||
return vertAirSpeed
|
||||
|
||||
def findSlopeVector(self, x,y, Topo_Grid):
|
||||
# the Topo_Grid of the center grid point at x,y.
|
||||
# Topo_Grid is a tuple of tuples representing a 2-D grid.
|
||||
|
||||
sumxcomp = sumycomp = count = 0
|
||||
centerh = Topo_Grid[x][y]
|
||||
|
||||
gridSizeX = len(Topo_Grid)
|
||||
gridSizeY = len(Topo_Grid[0])
|
||||
|
||||
for i in range(x-1, x+2):
|
||||
for j in range(y-1, y+2):
|
||||
# skip indices beyond limits of grid
|
||||
if i < 0 or j < 0 or i >= gridSizeX or j >= gridSizeY:
|
||||
continue
|
||||
# components of vector pointing from the center xc,yc
|
||||
# to the grid point (i,j)
|
||||
xcomp = i-x
|
||||
ycomp = j-y
|
||||
|
||||
# if at center point; distance is 0, do not compute
|
||||
if i == x and j == y:
|
||||
continue
|
||||
|
||||
# distance between pair of grid points
|
||||
dist = AVG_GRID_SPACE * sqrt(xcomp*xcomp + ycomp*ycomp)
|
||||
|
||||
# error trap to avoid 0 divide; should never occur
|
||||
if dist == 0.0:
|
||||
continue
|
||||
|
||||
# slope from center to the other grid point; + if up from center
|
||||
# (dist and _Topo_Grid values must be in same units)
|
||||
slope = (Topo_Grid[i][j] - centerh) / dist
|
||||
|
||||
# multiply original components by slope to get the slope vector
|
||||
# components from (xc,yc) to (i,j),
|
||||
# and add into summation of all x and y components
|
||||
sumxcomp += xcomp * slope
|
||||
sumycomp += ycomp * slope
|
||||
count += 1
|
||||
|
||||
# average all slope vectors to neighbor points
|
||||
svx = sumxcomp / count
|
||||
svy = sumycomp / count
|
||||
|
||||
# ensure "reasonable" values - less than 45 degrees
|
||||
if abs(svx) > 1.0:
|
||||
svx /= abs(svx)
|
||||
if abs(svy) > 1.0:
|
||||
svy /= abs(svy)
|
||||
|
||||
return svx, svy
|
||||
target = [yTargetSlice, xTargetSlice]
|
||||
src = [ySrcSlice, xSrcSlice]
|
||||
sg[target] += grid[src]
|
||||
count[target] += gridOfOnes[src]
|
||||
return sg / count
|
||||
|
||||
# Required Method: Execute
|
||||
# %comment
|
||||
# Fill in the arguments you want to use -- WeatherElement1, WeatherElement2...
|
||||
def execute(self, QPF, Wind, varDict):
|
||||
|
||||
# get the scale value
|
||||
scale = float(varDict["Vertical Motion Influence"]) / 50.0
|
||||
|
||||
# Calculate the gridient of the topoGrid
|
||||
topoGrid = self.getTopo()
|
||||
|
||||
d_dx, d_dy = MetLib.gradient(topoGrid)
|
||||
|
||||
# Convert wind to u and v components
|
||||
u, v = self.MagDirToUV(Wind[0], Wind[1])
|
||||
|
||||
# Calculate the dot product which is positive when wind blows
|
||||
# upslope and negative when it blows downslope
|
||||
dotGrid = MetLib.dot((d_dx, d_dy), (u, -v)) / 5000.0
|
||||
dotGrid = self.smoothGrid(dotGrid, 9)
|
||||
|
||||
# adjust the existing QPF grid using the scale and dot product
|
||||
QPF = QPF * (1 + scale * dotGrid)
|
||||
|
||||
return QPF
|
||||
|
|
|
@ -122,8 +122,6 @@ class TextProduct(TextRules.TextRules, SampleAnalysis.SampleAnalysis):
|
|||
if type(key) is types.TupleType:
|
||||
label, variable = key
|
||||
exec "self._" + variable + "= varDict[key]"
|
||||
else:
|
||||
exec "self._" + key + "= varDict[key]"
|
||||
|
||||
# Make argDict accessible
|
||||
self.__argDict = argDict
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
# further licensing information.
|
||||
##
|
||||
|
||||
import TimeRange, AbsTime
|
||||
import logging
|
||||
import TextFormatter
|
||||
import time, os, string, inspect, sys
|
||||
|
@ -288,6 +289,17 @@ def runFormatter(databaseID, site, forecastList, cmdLineVarDict, vtecMode,
|
|||
logger.info("Text Formatter Finished")
|
||||
return forecasts
|
||||
|
||||
def getAbsTime(timeStr):
|
||||
"Create an AbsTime from a string: YYYYMMDD_HHMM"
|
||||
|
||||
year = int(timeStr[0:4])
|
||||
month = int(timeStr[4:6])
|
||||
day = int(timeStr[6:8])
|
||||
hour = int(timeStr[9:11])
|
||||
minute = int(timeStr[11:13])
|
||||
|
||||
return AbsTime.absTimeYMD(year, month, day, hour, minute)
|
||||
|
||||
def writeToFile(forecasts, outputFile, mode):
|
||||
if not outputFile is None and outputFile != "":
|
||||
outfile = open(outputFile, mode)
|
||||
|
@ -427,4 +439,4 @@ def reloadModule(moduleName):
|
|||
except:
|
||||
logger.exception("Import Failed " + moduleName)
|
||||
|
||||
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1061,10 +1061,7 @@ class HazardUtils(SmartScript.SmartScript):
|
|||
|
||||
#print areas, from dictionary
|
||||
def _printAreas(self, areas):
|
||||
ara = []
|
||||
for a in areas.keys():
|
||||
if areas[a] == 1:
|
||||
ara.append(a)
|
||||
ara = list(areas)
|
||||
ara.sort()
|
||||
return ara
|
||||
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
# ----------------------------------------------------------------------------
|
||||
# This software is in the public domain, furnished "as is", without technical
|
||||
# support, and with no warranty, express or implied, as to its usefulness for
|
||||
# any purpose.
|
||||
#
|
||||
# MakeHazard.py
|
||||
#
|
||||
# SOFTWARE HISTORY
|
||||
# Date Ticket# Engineer Description
|
||||
# ------------ ---------- ----------- --------------------------
|
||||
# Jul 10,2012 436 randerso Separated configuration data from the
|
||||
# MakeHazard procedure
|
||||
#
|
||||
# Author: randerso
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
def sortHazardList(dict):
|
||||
#sorts the entries in the menus in alphabetical order, returns sorted
|
||||
#dictionary
|
||||
import VTECTable
|
||||
for ent in dict.keys():
|
||||
values = dict[ent]
|
||||
# get the descriptive word for this phen/sig
|
||||
items = []
|
||||
for v in values:
|
||||
desc = VTECTable.VTECTable.get(v,'')
|
||||
items.append((desc, v))
|
||||
items.sort() #sorts by description
|
||||
#extract out the sorted phen/sig
|
||||
phensig = []
|
||||
for desc, v in items:
|
||||
phensig.append(v)
|
||||
dict[ent] = phensig
|
||||
|
||||
return dict
|
||||
|
||||
# Lists of hazards organized by type in a dictionary
|
||||
# Set these to value you use for your site. To minimize scrolling,
|
||||
# change the order so that the most common values your site uses are
|
||||
# near the front of each list. The key is the menu entry on the
|
||||
# Make Hazard dialog, the values are the key values for Hazards.
|
||||
|
||||
# Using OrderedDict allows you to control the order in which the
|
||||
# Hazard Types are displayed in the dialog
|
||||
#
|
||||
from collections import OrderedDict
|
||||
hazardDict = OrderedDict([
|
||||
('Winter Weather', ["BZ.W", "BZ.A", "ZR.Y",
|
||||
"IS.W", "LE.Y", "LE.W", "LE.A",
|
||||
"WC.Y", "WC.W", "WC.A", "WS.W", "WS.A", "WW.Y"]),
|
||||
('Hydrology', ["FF.A", "FA.A"]),
|
||||
('Fire Weather', ["FW.A", "FW.W"]),
|
||||
('Convective Watches', ["SV.A", "TO.A"]),
|
||||
('Coastal Flood', ["CF.S", "LS.S", "CF.Y", "CF.W", "CF.A",
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A", "RP.S"]),
|
||||
('Non-Precipitation', ["AF.W", "AF.Y", "AQ.Y", "AS.O", "AS.Y", "DU.Y",
|
||||
"DS.W", "EH.W", "EH.A", "EC.W", "EC.A", "FG.Y", "FZ.W", "FZ.A",
|
||||
"HZ.W", "HZ.A", "ZF.Y", "FR.Y", "HT.Y", "HW.W", "HW.A",
|
||||
"LW.Y", "SM.Y", "WI.Y"]),
|
||||
('Marine', ["MA.S", "MH.W", "MH.Y", "BW.Y", "UP.Y", "MF.Y",
|
||||
"GL.A", "GL.W", "SE.A", "SE.W", "UP.A", "UP.W", "HF.A", "HF.W", "LO.Y", "SC.Y", "SW.Y",
|
||||
"RB.Y", "SI.Y", "MS.Y", "SR.A", "SR.W"]),
|
||||
('Tropical Cyclone', ["HU.W", "HU.A", "HU.S", "TR.W", "TR.A"]),
|
||||
('Tsunami', ["TS.A", "TS.W"]),
|
||||
|
||||
# ('Local', ["TEST"]), #example of adding local hazards
|
||||
# you can define your own groups of hazards by adding new categories
|
||||
])
|
||||
|
||||
# for GUM use comment out the above definition and uncomment the one below
|
||||
|
||||
#hazardDict = OrderedDict([
|
||||
# ('Hydrology', ["FF.A", "FA.A"]),
|
||||
# ('Fire Weather', ["FW.A", "FW.W"]),
|
||||
# ('Coastal Flood', ["CF.S", "LS.S", "CF.Y", "CF.W", "CF.A",
|
||||
# "SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A", "RP.S"]),
|
||||
# ('Non-Precipitation', ["AF.W", "AF.Y", "AQ.Y", "AS.O", "AS.Y", "DU.Y",
|
||||
# "DS.W", "EH.W", "EH.A", "EC.W", "EC.A", "FG.Y", "FZ.W", "FZ.A",
|
||||
# "HZ.W", "HZ.A", "ZF.Y", "FR.Y", "HT.Y", "HW.W", "HW.A",
|
||||
# "LW.Y", "SM.Y", "WI.Y"]),
|
||||
# ('Marine', ["MA.S", "MH.W", "MH.Y", "BW.Y", "UP.Y", "MF.Y",
|
||||
# "GL.A", "GL.W", "SE.A", "SE.W", "UP.A", "UP.W", "HF.A", "HF.W", "LO.Y", "SC.Y", "SW.Y",
|
||||
# "RB.Y", "SI.Y", "MS.Y", "SR.A", "SR.W"]),
|
||||
# ('Typhoon', ["TY.A", "TY.W", "TR.A", "TR.W", "HU.S"]),
|
||||
# ('Tsunami', ["TS.A", "TS.W"]),
|
||||
#
|
||||
# # ('Local', ["TEST"]), #example of adding local hazards
|
||||
# # you can define your own groups of hazards by adding new categories
|
||||
# ])
|
||||
|
||||
|
||||
# This function sorts the hazards in the hazardDict by description.
|
||||
# Comment it out if this is not desired.
|
||||
hazardDict = sortHazardList(hazardDict)
|
||||
|
||||
# Dictionary of map categories and the map names. The "<site>" is
|
||||
# substituted with your site name. The names of the map must match
|
||||
# those defined in the ifpServer. The keys in mapNames must match
|
||||
# the keys in hazardDict.
|
||||
|
||||
mapNames = {
|
||||
'Fire Weather' : ["FireWxZones_<site>"],
|
||||
'Hydrology' : ["Zones_<site>"],
|
||||
'Coastal Flood': ["Zones_<site>"],
|
||||
'Convective Watches' : ["Marine_Zones_<site>","FIPS_<site>"],
|
||||
'Non-Precipitation' : ["Zones_<site>"],
|
||||
'Tropical Cyclone' : ["Offshore_Marine_Zones_<site>",
|
||||
"Marine_Zones_<site>","Zones_<site>"],
|
||||
'Typhoon' : ["Offshore_Marine_Zones_<site>",
|
||||
"Marine_Zones_<site>","Zones_<site>"],
|
||||
'Tsunami' : ["Offshore_Marine_Zones_<site>",
|
||||
"Marine_Zones_<site>","Zones_<site>"],
|
||||
'Winter Weather' : ["Zones_<site>"],
|
||||
'Marine' : ["Offshore_Marine_Zones_<site>",
|
||||
"Marine_Zones_<site>"],
|
||||
#'Local' : ["Zones_<site>"], #example of adding local class
|
||||
}
|
||||
|
||||
# The defaultHazardType - selected when the tool is first run. This
|
||||
# must be one of the categories (keys) in the mapNames and hazardDict.
|
||||
defaultHazardType = "Non-Precipitation"
|
||||
|
||||
# this is the color for the selected areas in the map
|
||||
mapColor = "red" # color of selected areas
|
||||
|
||||
# initial map width
|
||||
defaultMapWidth = 400;
|
||||
|
||||
# the percentage that an area must be covered to default to selected
|
||||
areaThreshold = 0.10
|
||||
|
||||
# End time in hours of the time scales
|
||||
timeScaleEndTime = 96
|
||||
|
||||
# Define the tropical product used to identify the particular storm
|
||||
tcmList = [] # Comment out for HLS sites
|
||||
|
||||
# Uncomment line below for Atlantic basin sites
|
||||
#tcmList = ["TCMAT1", "TCMAT2", "TCMAT3", "TCMAT4", "TCMAT5"]
|
||||
|
||||
# Uncomment line below for EPac basin sites
|
||||
#tcmList = ["TCMEP1", "TCMEP2", "TCMEP3", "TCMEP4", "TCMEP5"]
|
||||
|
||||
# Uncomment line below for CPac basin sites
|
||||
#tcmList = ["TCMCP1", "TCMCP2", "TCMCP3", "TCMCP4", "TCMCP5"]
|
||||
|
||||
# Dictionary mapping Hazard Types to applicable local effect areas
|
||||
# that can be intersected with the zone edit areas.
|
||||
# You should not define localEffectAreas entries for Tropical Cyclone
|
||||
# or Convective Watches.
|
||||
localEffectAreas = {}
|
||||
|
||||
#localEffectAreas = {
|
||||
# 'Winter Weather' : ["Below_1000","Below_1500","Below_2000","Below_2500","Below_3000","Below_3500","Below_4000",
|
||||
# "Above_1000","Above_1500","Above_2000","Above_2500","Above_3000","Above_3500"],
|
||||
# }
|
||||
|
||||
# Dictionary associating local Effect Area names with a corresponding
|
||||
# segment number, display name, and list of zones to be auto-selected
|
||||
# If you do not wish to auto-select zones you should supply an empty list
|
||||
#
|
||||
# The display name allows you to display a "pretty" string in the UI rather
|
||||
# than the edit area name. If the display name is empty ("") the edit area
|
||||
# name will be used.
|
||||
localAreaData = {}
|
||||
|
||||
#localAreaData = {
|
||||
# "Below_1000" : ( 999, "", []),
|
||||
# "Below_1500" : (1499, "", []),
|
||||
# "Below_2000" : (1999, "", []),
|
||||
# "Below_2500" : (2499, "", []),
|
||||
# "Below_3000" : (2999, "", []),
|
||||
# "Below_3500" : (3499, "", []),
|
||||
# "Below_4000" : (3999, "", []),
|
||||
# "Above_1000" : (1000, "", []),
|
||||
# "Above_1500" : (1500, "", []),
|
||||
# "Above_2000" : (2000, "", []),
|
||||
# "Above_2500" : (2500, "", []),
|
||||
# "Above_3000" : (3000, "", []),
|
||||
# "Above_3500" : (3500, "", []),
|
||||
# }
|
||||
|
|
@ -796,7 +796,7 @@ class SmartScript(BaseTool.BaseTool):
|
|||
if "A" == status:
|
||||
importance = Priority.PROBLEM
|
||||
elif "R" == status:
|
||||
importance = Priority.EVENTA
|
||||
importance = Priority.EVENTB
|
||||
elif "U" == status:
|
||||
importance = Priority.CRITICAL
|
||||
else:
|
||||
|
|
|
@ -1,126 +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.
|
||||
##
|
||||
# ----------------------------------------------------------------------------
|
||||
# This software is in the public domain, furnished "as is", without technical
|
||||
# support, and with no warranty, express or implied, as to its usefulness for
|
||||
# any purpose.
|
||||
#
|
||||
# MakeHazard.py
|
||||
#
|
||||
# Author: wdougherty
|
||||
# ----------------------------------------------------------------------------
|
||||
import numpy
|
||||
import JUtil
|
||||
import LogStream
|
||||
import TimeRange
|
||||
from HazardUtils import HazardUtils
|
||||
from HazardUtils import ELEMENT
|
||||
from HazardUtils import MODEL
|
||||
from HazardUtils import LEVEL
|
||||
from HazardUtils import SUCCESS
|
||||
from HazardUtils import FAIL_REDUNDANT
|
||||
|
||||
def makeHazard(hazard, dbss, timeRange, zones, segment, selectedTimeRange, defaultAreaList, defaultHazard, defaultSegment):
|
||||
hazardUtils = HazardUtils(dbss, None)
|
||||
# hazard has already been validated
|
||||
# timeRange has already been validated
|
||||
|
||||
# convert zones to a Python list
|
||||
if zones is None:
|
||||
zones = []
|
||||
if defaultAreaList is None:
|
||||
defaultAreaList = []
|
||||
|
||||
if not isinstance(zones, list):
|
||||
zones = JUtil.javaStringListToPylist(zones)
|
||||
if not isinstance(defaultAreaList, list):
|
||||
defaultAreaList = JUtil.javaStringListToPylist(defaultAreaList)
|
||||
|
||||
# Find the mask that describes the area covered by the hazard
|
||||
if [] == zones:
|
||||
ea = hazardUtils.getActiveEditArea()
|
||||
if ea is None:
|
||||
mask = None
|
||||
else:
|
||||
mask = hazardUtils.encodeEditArea(ea)
|
||||
else:
|
||||
mask = hazardUtils._makeMask(zones)
|
||||
|
||||
# Hazards need to be separated for makeHazard's temp hazard grid.
|
||||
# If the user hasn't already separated them, it's up to us.
|
||||
if hazardUtils._tempWELoaded():
|
||||
pass # Hazards are already separated
|
||||
else:
|
||||
hazParm = hazardUtils.getParm(MODEL,ELEMENT,LEVEL)
|
||||
# If the inventory span is invalid, the hazards grid is empty.
|
||||
if hazParm.getInventorySpan().isValid():
|
||||
if SUCCESS != hazardUtils._separateHazardGrids():
|
||||
return False
|
||||
|
||||
# Build the hazard key
|
||||
hazardKey = hazard
|
||||
defaultHazardKey = defaultHazard
|
||||
|
||||
if segment is None:
|
||||
segment = ""
|
||||
if defaultSegment is None:
|
||||
defaultSegment = ""
|
||||
|
||||
segment = segment.strip()
|
||||
defaultSegment = defaultSegment.strip()
|
||||
|
||||
if "" != segment:
|
||||
hazardKey = hazardKey + ":" + segment
|
||||
if "" != defaultSegment and defaultHazardKey is not None:
|
||||
defaultHazardKey = defaultHazardKey + ":" + defaultSegment
|
||||
|
||||
# Create the name of the temp weather element from hazardKey
|
||||
weName = hazardUtils._makeTempWEName(hazardKey)
|
||||
|
||||
# if we're modifying, remove the old grid first
|
||||
if defaultAreaList != [] and hazardKey == defaultHazardKey:
|
||||
hazardUtils.deleteCmd([weName], selectedTimeRange)
|
||||
|
||||
# Don't allow the user to create an empty hazard grid
|
||||
if not numpy.any(mask):
|
||||
hazardUtils.statusBarMsg(
|
||||
"NO EDIT AREA SELECTED: \n Select area from map or load edit area in GFE!",
|
||||
"S", "GHG Status")
|
||||
return False
|
||||
|
||||
# Create the temporary hazard grid
|
||||
hazardUtils._addHazard(weName, timeRange, hazardKey, mask)
|
||||
|
||||
# convert timeRange to Python for logging
|
||||
timeRange = TimeRange.TimeRange(timeRange)
|
||||
# log the creation of the temp hazard
|
||||
LogStream.logEvent("Set: " + weName + " " +
|
||||
hazardUtils._printTime(timeRange.startTime().unixTime()) + " " +
|
||||
hazardUtils._printTime(timeRange.endTime().unixTime()) + " " +
|
||||
hazardKey + " " + str(zones))
|
||||
return True
|
||||
|
||||
##
|
||||
#
|
||||
def ensureSeparated(dbss):
|
||||
hazardUtils = HazardUtils(dbss, None)
|
||||
rtnCode = hazardUtils._separateHazardGrids()
|
||||
separated = rtnCode in [SUCCESS, FAIL_REDUNDANT]
|
||||
return separated
|
|
@ -1,250 +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.
|
||||
##
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
import string, time
|
||||
from com.raytheon.uf.common.status import UFStatus
|
||||
from com.raytheon.uf.common.status import UFStatus_Priority as Priority
|
||||
|
||||
|
||||
### New class for fetching ETN from TCM header for tropical hazards
|
||||
class TCMDecoder:
|
||||
def __init__(self):
|
||||
self.pos = 0
|
||||
# key words in TCM products from NCEP
|
||||
self.keyWordDict = {"NATIONAL HURRICANE CENTER" : self.decodeAltFilename,
|
||||
}
|
||||
|
||||
self.fcstList = [] # a place to store all of the forecasts
|
||||
|
||||
self.text = [] # the text product
|
||||
|
||||
self.currentFcst = {} # the current forecast we are docoding
|
||||
|
||||
self.baseProductTime = 0
|
||||
|
||||
self.altFilename = ""
|
||||
|
||||
self._handler = UFStatus.getHandler("GFE", 'GFE')
|
||||
|
||||
def stripText(self):
|
||||
endStr = chr(13) + chr(13) + chr(10)
|
||||
for i in range(len(self.text)):
|
||||
self.text[i] = string.replace(self.text[i], endStr, "")
|
||||
return
|
||||
|
||||
def getFcstList(self):
|
||||
return self.fcstList
|
||||
|
||||
def getBaseProductTime(self):
|
||||
return self.baseProductTime
|
||||
|
||||
def getAltInfoFilename(self):
|
||||
return self.altFilename
|
||||
|
||||
def currentLine(self):
|
||||
return self.text[self.pos]
|
||||
|
||||
def nextLine(self):
|
||||
self.pos = self.pos + 1
|
||||
if self.pos < len(self.text):
|
||||
return self.text[self.pos]
|
||||
else:
|
||||
return ""
|
||||
|
||||
def monthNum(self, monthStr):
|
||||
monthList = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN",
|
||||
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]
|
||||
|
||||
try:
|
||||
return monthList.index(monthStr) + 1
|
||||
except ValueError:
|
||||
return 0
|
||||
|
||||
def convertBaseTime(self, timeStr):
|
||||
# timeStr format: "HHMM UTC DAY MON DD YYYY"
|
||||
try:
|
||||
baseTime = time.strptime(timeStr, "%H%M UTC %a %b %d %Y")
|
||||
print "baseTime is", baseTime
|
||||
return baseTime
|
||||
except ValueError:
|
||||
return
|
||||
|
||||
|
||||
# extract time parts from the str
|
||||
# strList = string.split(timeStr)
|
||||
# if len(strList) != 6:
|
||||
# print "Invalid time string:", timeStr
|
||||
# print "Format should be of the form HHMM UTC DAY MON DD YYYY"
|
||||
# return
|
||||
#
|
||||
# hour = int(timeStr[0:2])
|
||||
# minute = int(timeStr[2:4])
|
||||
# monthStr = strList[3]
|
||||
# month = self.monthNum(monthStr)
|
||||
# day = int(strList[4])
|
||||
# year = int(strList[5])
|
||||
#
|
||||
# # time.mktime returns time in seconds but in local time
|
||||
# baseTime = time.mktime((year, month, day, hour, minute, 0, 0, 0, 0))
|
||||
# print "month is", month
|
||||
# print "baseTime is", baseTime
|
||||
|
||||
## # Adjust to UTC
|
||||
## diffTime = time.mktime(time.gmtime()) - time.mktime(time.localtime())
|
||||
## print "diffTime is", diffTime
|
||||
|
||||
## # subtract timeZone and round to the nearest hour
|
||||
## roundedTime = int((baseTime - diffTime) / 3600) * 3600
|
||||
##
|
||||
# return baseTime
|
||||
|
||||
def convert_ddhhmm(self, ddhhmmStr, baseTime):
|
||||
|
||||
# remove the slash if present
|
||||
ddhhmmStr = string.replace(ddhhmmStr, "/", "")
|
||||
|
||||
if baseTime == 0:
|
||||
baseTime = time.time()
|
||||
|
||||
# extract the time parts
|
||||
dayStr = ddhhmmStr[0:2]
|
||||
hourStr = ddhhmmStr[2:4]
|
||||
minStr = ddhhmmStr[4:6]
|
||||
day = int(dayStr)
|
||||
hour = int(hourStr)
|
||||
minute = int(minStr)
|
||||
tupleTime = time.gmtime(baseTime)
|
||||
year = tupleTime[0]
|
||||
month = tupleTime[1]
|
||||
# see if we crossed over to a new month
|
||||
if tupleTime[2] > day:
|
||||
month = month + 1
|
||||
if month > 12:
|
||||
month = 1
|
||||
year = year + 1
|
||||
|
||||
newTuple = (year, month, day, hour, minute, tupleTime[5],
|
||||
tupleTime[6], tupleTime[7], tupleTime[8])
|
||||
|
||||
secondsTime = time.mktime(newTuple)
|
||||
# Adjustment to UTC
|
||||
diffTime = time.mktime(time.gmtime()) - time.mktime(time.localtime())
|
||||
return secondsTime - diffTime # subtract timeZone
|
||||
|
||||
def decodeProductTime(self):
|
||||
# Time of the product found on the next line
|
||||
timeStr = self.nextLine()
|
||||
print "the time string is:", timeStr
|
||||
|
||||
# sanity check for the time string
|
||||
hhmm = timeStr[0:4]
|
||||
for c in hhmm:
|
||||
if not c in string.digits:
|
||||
return
|
||||
|
||||
baseTime = self.convertBaseTime(timeStr)
|
||||
self.baseProductTime = baseTime
|
||||
|
||||
return
|
||||
|
||||
def decodeAltFilename(self):
|
||||
nameStr = self.currentLine()
|
||||
parts = string.split(nameStr)
|
||||
|
||||
self.altFilename = parts[-1] # grab the last string token
|
||||
return
|
||||
|
||||
def decodeTCMProduct(self, TCMProduct):
|
||||
self.text = TCMProduct
|
||||
self.pos = 0
|
||||
self.fcstList = []
|
||||
## self.defaultEyeDiameter = eyeDiameter
|
||||
|
||||
self.stripText()
|
||||
while self.pos < len(TCMProduct):
|
||||
line = self.currentLine()
|
||||
for k in self.keyWordDict.keys():
|
||||
if string.find(line, k) > -1:
|
||||
self.keyWordDict[k]()
|
||||
break
|
||||
self.pos = self.pos + 1
|
||||
|
||||
# store the last forecast in the list of forecasts
|
||||
if self.currentFcst != {}:
|
||||
self.fcstList.append(self.currentFcst)
|
||||
self.currentFcst = {} # reset
|
||||
|
||||
return
|
||||
## End TCM decoder class
|
||||
|
||||
### New methods to pull ETN from TCM if grid is not initialized with ETN
|
||||
def tcmETNforTrop(tcmProduct):
|
||||
tcmProd = tcmProduct
|
||||
# print "chosen TCM is", tcmProd
|
||||
tcmDecoder = TCMDecoder()
|
||||
TCMProduct = getTextProductFromDB(tcmProd)
|
||||
if len(TCMProduct) < 3:
|
||||
msg = tcmProd + " could not be retrieved from the text database."
|
||||
statusBarMsg(msg, "S")
|
||||
return None # Just return if no TCM is found. Something's really wrong
|
||||
else:
|
||||
tcmDecoder.decodeTCMProduct(TCMProduct)
|
||||
altFileName = tcmDecoder.getAltInfoFilename()
|
||||
stormNum = altFileName[2:4]
|
||||
## print "storm number is", stormNum
|
||||
nationalBase = "10"
|
||||
tropicalETN = nationalBase + stormNum
|
||||
## print "Tropical ETN is: ", tropicalETN
|
||||
## print "lenth of tropical ETN is:", len(tropicalETN)
|
||||
return tropicalETN
|
||||
|
||||
def getTextProductFromDB(productID):
|
||||
from com.raytheon.viz.gfe import Activator
|
||||
from com.raytheon.viz.gfe.core import DataManager
|
||||
from com.raytheon.viz.gfe.product import TextDBUtil
|
||||
|
||||
prefStore = Activator.getDefault().getPreferenceStore()
|
||||
if prefStore.contains("TestVTECDecode"):
|
||||
testVtec = prefStore.getBoolean("TestVTECDecode")
|
||||
else:
|
||||
testVtec = False
|
||||
gfeMode = (DataManager.getCurrentInstance().getOpMode().name() == "OPERATIONAL")
|
||||
opMode = testVtec or gfeMode
|
||||
fullText = TextDBUtil.retrieveProduct(productID, opMode)
|
||||
textList = fullText.splitlines(True)
|
||||
return textList
|
||||
|
||||
def statusBarMsg(message, status, category="GFE"):
|
||||
from com.raytheon.uf.common.status import UFStatus
|
||||
from com.raytheon.uf.common.status import UFStatus_Priority as Priority
|
||||
from com.raytheon.viz.gfe import Activator
|
||||
from com.raytheon.viz.gfe.constants import StatusConstants
|
||||
|
||||
if "A" == status:
|
||||
importance = Priority.PROBLEM
|
||||
elif "R" == status:
|
||||
importance = Priority.EVENTA
|
||||
elif "U" == status:
|
||||
importance = Priority.CRITICAL
|
||||
else:
|
||||
importance = Priority.SIGNIFICANT
|
||||
|
||||
self._handler.handle(importance,message)
|
0
cave/build/static/linux/cave/caveEnvironment/bin/tmbRemoteCheck
Executable file → Normal file
0
cave/build/static/linux/cave/caveEnvironment/bin/tmbRemoteCheck
Executable file → Normal file
0
cave/build/static/linux/cave/caveEnvironment/bin/tmcp
Executable file → Normal file
0
cave/build/static/linux/cave/caveEnvironment/bin/tmcp
Executable file → Normal file
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.viz.alertviz.localization.feature</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1 +0,0 @@
|
|||
bin.includes = feature.xml
|
|
@ -1,33 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feature
|
||||
id="com.raytheon.uf.viz.alertviz.localization.feature"
|
||||
label="Alertviz Localization Feature"
|
||||
version="1.0.0.qualifier"
|
||||
provider-name="RAYTHEON">
|
||||
|
||||
<description url="http://www.example.com/description">
|
||||
[Enter Feature Description here.]
|
||||
</description>
|
||||
|
||||
<copyright url="http://www.example.com/copyright">
|
||||
[Enter Copyright Description here.]
|
||||
</copyright>
|
||||
|
||||
<license url="http://www.example.com/license">
|
||||
[Enter License Description here.]
|
||||
</license>
|
||||
|
||||
<requires>
|
||||
<import feature="com.raytheon.uf.viz.common.core.feature" version="1.0.0.qualifier"/>
|
||||
<import feature="com.raytheon.uf.viz.core.feature" version="1.0.0.qualifier"/>
|
||||
<import feature="com.raytheon.uf.viz.eclipse.feature" version="1.0.0.qualifier"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
id="com.raytheon.uf.viz.alertviz.localization"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.raytheon.uf.viz.alertviz.localization</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,7 +0,0 @@
|
|||
#Mon Apr 04 17:11:52 CDT 2011
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
|
@ -1,25 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Ui Plug-in
|
||||
Bundle-SymbolicName: com.raytheon.uf.viz.alertviz.localization;singleton:=true
|
||||
Bundle-Version: 1.12.1174.qualifier
|
||||
Bundle-Activator: com.raytheon.uf.viz.alertviz.Activator
|
||||
Bundle-Vendor: Raytheon
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.raytheon.uf.common.localization,
|
||||
com.raytheon.uf.common.message;bundle-version="1.11.11",
|
||||
com.raytheon.uf.viz.alertviz;bundle-version="1.11.11"
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
||||
Export-Package: com.raytheon.uf.viz.alertviz.localization,
|
||||
com.raytheon.uf.viz.alertviz.localization.actions
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Import-Package: com.raytheon.uf.common.alertmonitor,
|
||||
com.raytheon.uf.common.util,
|
||||
com.raytheon.uf.viz.localization,
|
||||
com.raytheon.uf.viz.localization.adapter,
|
||||
com.raytheon.uf.viz.localization.filetreeview,
|
||||
com.raytheon.uf.viz.localization.service,
|
||||
com.raytheon.viz.ui,
|
||||
com.raytheon.viz.ui.dialogs
|
|
@ -1,5 +0,0 @@
|
|||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml
|
|
@ -1,102 +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.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Configurations"
|
||||
value="alertViz/configurations"
|
||||
recursive="false"
|
||||
localizationAdapter="com.raytheon.uf.viz.alertviz.localization.AlertVizLocalizationAdapter"
|
||||
extensionFilter=".xml">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Python"
|
||||
value="alertViz/python"
|
||||
recursive="false"
|
||||
localizationAdapter="com.raytheon.uf.viz.alertviz.localization.AlertVizLocalizationAdapter"
|
||||
extensionFilter=".py">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Audio"
|
||||
value="alertVizAudio"
|
||||
recursive="false"
|
||||
localizationAdapter="com.raytheon.uf.viz.alertviz.localization.AlertVizLocalizationAdapter"
|
||||
extensionFilter=".wav">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Monitor Icons"
|
||||
value="monitorIcons"
|
||||
recursive="false"
|
||||
localizationAdapter="com.raytheon.uf.viz.alertviz.localization.AlertVizLocalizationAdapter"
|
||||
extensionFilter=".png">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Forced configuration"
|
||||
value="alertViz"
|
||||
recursive="false"
|
||||
extensionFilter=".xml">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Custom Repository"
|
||||
value="alertViz/customizations"
|
||||
recursive="false"
|
||||
extensionFilter=".xml">
|
||||
</path>
|
||||
</extension>
|
||||
<!--extension
|
||||
point="org.eclipse.ui.editors">
|
||||
<editor
|
||||
default="true"
|
||||
id="com.raytheon.viz.alertviz.ui.configuration.editor"
|
||||
name="AlertViz Configuration Editor" extensions="xml"
|
||||
class="com.raytheon.uf.viz.alertviz.localization.editor.AlertVizConfigurationEditorPart">
|
||||
</editor>
|
||||
</extension-->
|
||||
</plugin>
|
|
@ -1,78 +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.uf.viz.alertviz.localization;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.viz.alertviz.localization.actions.AlertVizFileImportAction;
|
||||
import com.raytheon.uf.viz.localization.adapter.LocalizationPerspectiveAdapter;
|
||||
import com.raytheon.uf.viz.localization.filetreeview.FileTreeEntryData;
|
||||
|
||||
/**
|
||||
* Localization perspective adapter for AlertViz.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 04, 2011 5853 bgonzale Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bgonzale
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class AlertVizLocalizationAdapter extends LocalizationPerspectiveAdapter {
|
||||
|
||||
private static final Map<String, LocalizationLevel> localizationMap = getLocalizationMap();
|
||||
|
||||
@Override
|
||||
public boolean addContextMenuItems(IMenuManager menuMgr,
|
||||
FileTreeEntryData[] selectedData) {
|
||||
if (selectedData.length == 1) {
|
||||
FileTreeEntryData selected = selectedData[0];
|
||||
|
||||
if (selected.getClass() == FileTreeEntryData.class) {
|
||||
LocalizationLevel level = localizationMap.get(selected
|
||||
.getName());
|
||||
menuMgr.add(new AlertVizFileImportAction(
|
||||
(FileTreeEntryData) selected, level));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Map<String, LocalizationLevel> getLocalizationMap() {
|
||||
Map<String, LocalizationLevel> map = new HashMap<String, LocalizationLevel>();
|
||||
map.put("Audio", LocalizationLevel.SITE);
|
||||
map.put("Configurations", LocalizationLevel.USER);
|
||||
map.put("Scripts", LocalizationLevel.SITE);
|
||||
map.put("Python", LocalizationLevel.SITE);
|
||||
return map;
|
||||
}
|
||||
}
|
|
@ -1,161 +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.uf.viz.alertviz.localization.actions;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import org.eclipse.jface.action.Action;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
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.localization.exception.LocalizationOpFailedException;
|
||||
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.localization.filetreeview.FileTreeEntryData;
|
||||
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||
|
||||
/**
|
||||
* Opens a file dialog for importing files.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 04, 2011 5853 bgonzale Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bgonzale
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class AlertVizFileImportAction extends Action {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(AlertVizFileImportAction.class, "GDN_ADMIN",
|
||||
"GDN_ADMIN");
|
||||
|
||||
private static final String PLUGIN_ID = "com.raytheon.uf.viz.alertviz.ui";
|
||||
|
||||
private static final String ASTERISK = "*";
|
||||
|
||||
private static final String ALL_FILES = "*.*";
|
||||
|
||||
private LocalizationLevel level;
|
||||
|
||||
private String[] extensions;
|
||||
|
||||
private String path;
|
||||
|
||||
/**
|
||||
* @param fileEntry
|
||||
*
|
||||
*/
|
||||
public AlertVizFileImportAction(FileTreeEntryData fileEntry) {
|
||||
this(fileEntry, LocalizationLevel.USER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fileEntry
|
||||
* @param level
|
||||
*
|
||||
*/
|
||||
public AlertVizFileImportAction(FileTreeEntryData fileEntry,
|
||||
LocalizationLevel level) {
|
||||
super("Import");
|
||||
this.level = level == null ? LocalizationLevel.USER : level;
|
||||
this.path = fileEntry.getPath();
|
||||
String[] fileEntryExtensions = fileEntry.getPathData().getFilter();
|
||||
this.extensions = new String[fileEntryExtensions.length + 1];
|
||||
for (int i = 0; i < fileEntryExtensions.length; ++i) {
|
||||
this.extensions[i] = ASTERISK + fileEntryExtensions[i];
|
||||
}
|
||||
this.extensions[this.extensions.length - 1] = ALL_FILES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Shell shell = VizWorkbenchManager.getInstance().getCurrentWindow()
|
||||
.getShell();
|
||||
FileDialog fd = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
|
||||
|
||||
fd.setText("Import " + level + " File");
|
||||
fd.setFilterExtensions(extensions);
|
||||
fd.setFilterPath(System.getProperty("user.home"));
|
||||
|
||||
String fileName = fd.open();
|
||||
|
||||
if (fileName != null) {
|
||||
File file = new File(fileName);
|
||||
|
||||
if (file.exists() && file.isFile()) {
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext ctx = pm.getContext(
|
||||
LocalizationType.CAVE_STATIC, level);
|
||||
LocalizationFile locFile = pm.getLocalizationFile(ctx, path
|
||||
+ File.separator + file.getName());
|
||||
|
||||
try {
|
||||
saveToLocalizationFile(file, locFile);
|
||||
} catch (FileNotFoundException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
} catch (IOException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
statusHandler.handle(Priority.CRITICAL,
|
||||
"Error Importing file " + fileName, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveToLocalizationFile(File file, LocalizationFile locFile)
|
||||
throws IOException, LocalizationOpFailedException {
|
||||
File newFile = locFile.getFile();
|
||||
InputStream in = new FileInputStream(file);
|
||||
OutputStream out = new FileOutputStream(newFile);
|
||||
byte[] buff = new byte[1024];
|
||||
int len;
|
||||
|
||||
while ((len = in.read(buff)) > 0) {
|
||||
out.write(buff, 0, len);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
locFile.save();
|
||||
}
|
||||
}
|
|
@ -341,7 +341,7 @@ public class FileSelectDlg extends Dialog {
|
|||
importNewBtn1.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
FileDialog newFileDlg = new FileDialog(shell, SWT.OPEN
|
||||
| SWT.MULTI);
|
||||
| SWT.SINGLE);
|
||||
newFileDlg.setFilterExtensions(fileExtensions);
|
||||
String newFileName = newFileDlg.open();
|
||||
if (newFileName != null) {
|
||||
|
|
|
@ -27,5 +27,79 @@
|
|||
id="com.raytheon.viz.notification.statusHandler">
|
||||
</statusHandler>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Configurations"
|
||||
value="alertViz/configurations"
|
||||
recursive="false"
|
||||
extensionFilter=".xml">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Python"
|
||||
value="alertViz/python"
|
||||
recursive="false"
|
||||
extensionFilter=".py">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Audio"
|
||||
value="alertVizAudio"
|
||||
recursive="false"
|
||||
extensionFilter=".wav">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Monitor Icons"
|
||||
value="monitorIcons"
|
||||
recursive="false"
|
||||
extensionFilter=".png">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Forced configuration"
|
||||
value="alertViz"
|
||||
recursive="false"
|
||||
extensionFilter=".xml">
|
||||
</path>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.uf.viz.localization.localizationpath">
|
||||
<path
|
||||
application="Alertviz"
|
||||
localizationType="CAVE_STATIC"
|
||||
name="Custom Repository"
|
||||
value="alertViz/customizations"
|
||||
recursive="false"
|
||||
extensionFilter=".xml">
|
||||
</path>
|
||||
</extension>
|
||||
<!--extension
|
||||
point="org.eclipse.ui.editors">
|
||||
<editor
|
||||
default="true"
|
||||
id="com.raytheon.viz.alertviz.ui.configuration.editor"
|
||||
name="AlertViz Configuration Editor" extensions="xml"
|
||||
class="com.raytheon.uf.viz.alertviz.localization.editor.AlertVizConfigurationEditorPart">
|
||||
</editor>
|
||||
</extension-->
|
||||
</plugin>
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -63,6 +64,7 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 22, 2009 3072 bsteffen Initial creation
|
||||
* Aug 23, 2012 1096 njensen Fixed memory leaks
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -161,8 +163,10 @@ public class CcfpResource extends
|
|||
}
|
||||
|
||||
private void disposeFrames() {
|
||||
for (DisplayFrame frame : frames.values()) {
|
||||
frame.dispose();
|
||||
synchronized (frames) {
|
||||
for (DisplayFrame frame : frames.values()) {
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,11 +184,15 @@ public class CcfpResource extends
|
|||
|
||||
@Override
|
||||
public String inspect(ReferencedCoordinate coord) throws VizException {
|
||||
if (frames.get(this.displayedDataTime) == null) {
|
||||
DisplayFrame frame = null;
|
||||
synchronized (frames) {
|
||||
frame = frames.get(this.displayedDataTime);
|
||||
}
|
||||
if (frame == null) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder res = new StringBuilder();
|
||||
for (CcfpRecord record : frames.get(this.displayedDataTime).records) {
|
||||
for (CcfpRecord record : frame.records) {
|
||||
// Check if we have an area we are rendering
|
||||
if (isPaintingArea(record)) {
|
||||
try {
|
||||
|
@ -216,15 +224,20 @@ public class CcfpResource extends
|
|||
*/
|
||||
private void updateRecords(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
DisplayFrame frame = frames.get(this.displayedDataTime);
|
||||
if (frame == null) {
|
||||
frame = new DisplayFrame();
|
||||
frames.put(this.displayedDataTime, frame);
|
||||
DisplayFrame frame = null;
|
||||
synchronized (frames) {
|
||||
frame = frames.get(this.displayedDataTime);
|
||||
if (frame == null) {
|
||||
frame = new DisplayFrame();
|
||||
frames.put(this.displayedDataTime, frame);
|
||||
}
|
||||
}
|
||||
|
||||
// Add all the new Records
|
||||
Collection<CcfpRecord> newRecords = unprocessedRecords
|
||||
.get(this.displayedDataTime);
|
||||
Collection<CcfpRecord> newRecords = null;
|
||||
synchronized (unprocessedRecords) {
|
||||
newRecords = unprocessedRecords.get(this.displayedDataTime);
|
||||
}
|
||||
for (CcfpRecord record : newRecords) {
|
||||
// If we need to draw anything for this record then keep it
|
||||
if (isPaintingArea(record) || isPaintingMovement(record)
|
||||
|
@ -259,14 +272,19 @@ public class CcfpResource extends
|
|||
this.displayedDataTime = paintProps.getDataTime();
|
||||
|
||||
// First check to see if we need to process new data
|
||||
Collection<CcfpRecord> unprocessed = unprocessedRecords
|
||||
.get(this.displayedDataTime);
|
||||
Collection<CcfpRecord> unprocessed = null;
|
||||
synchronized (unprocessedRecords) {
|
||||
unprocessed = unprocessedRecords.get(this.displayedDataTime);
|
||||
}
|
||||
if (unprocessed != null && unprocessed.size() > 0) {
|
||||
updateRecords(target, paintProps);
|
||||
}
|
||||
|
||||
// Hopefully we now have some data to display, if not bail
|
||||
DisplayFrame frame = frames.get(this.displayedDataTime);
|
||||
DisplayFrame frame = null;
|
||||
synchronized (frames) {
|
||||
frame = frames.get(this.displayedDataTime);
|
||||
}
|
||||
if (frame == null) {
|
||||
this.displayedDataTime = null;
|
||||
return;
|
||||
|
@ -509,14 +527,24 @@ public class CcfpResource extends
|
|||
*/
|
||||
protected void addRecord(CcfpRecord obj) {
|
||||
DataTime dataTime = obj.getDataTime();
|
||||
Collection<CcfpRecord> records = unprocessedRecords.get(dataTime);
|
||||
if (records == null) {
|
||||
records = new ArrayList<CcfpRecord>();
|
||||
unprocessedRecords.put(dataTime, records);
|
||||
this.dataTimes.add(dataTime);
|
||||
Collections.sort(this.dataTimes);
|
||||
if (resourceData.durationMatches(dataTime)) {
|
||||
Collection<CcfpRecord> records = null;
|
||||
boolean brandNew = false;
|
||||
synchronized (unprocessedRecords) {
|
||||
records = unprocessedRecords.get(dataTime);
|
||||
if (records == null) {
|
||||
records = new HashSet<CcfpRecord>();
|
||||
unprocessedRecords.put(dataTime, records);
|
||||
brandNew = true;
|
||||
}
|
||||
}
|
||||
if (brandNew) {
|
||||
this.dataTimes.add(dataTime);
|
||||
Collections.sort(this.dataTimes);
|
||||
}
|
||||
|
||||
records.add(obj);
|
||||
}
|
||||
records.add(obj);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -677,16 +705,40 @@ public class CcfpResource extends
|
|||
|
||||
@Override
|
||||
public void project(CoordinateReferenceSystem crs) throws VizException {
|
||||
disposeFrames();
|
||||
// add as unprocessed to make sure frames created
|
||||
for (DataTime time : frames.keySet()) {
|
||||
DisplayFrame frame = frames.get(time);
|
||||
if (frame != null) {
|
||||
List<CcfpRecord> copyList = new ArrayList<CcfpRecord>(
|
||||
frame.records);
|
||||
unprocessedRecords.put(time, copyList);
|
||||
synchronized (frames) {
|
||||
disposeFrames();
|
||||
// add as unprocessed to make sure frames created
|
||||
for (DataTime time : frames.keySet()) {
|
||||
DisplayFrame frame = frames.get(time);
|
||||
if (frame != null) {
|
||||
List<CcfpRecord> copyList = new ArrayList<CcfpRecord>(
|
||||
frame.records);
|
||||
synchronized (unprocessedRecords) {
|
||||
unprocessedRecords.put(time, copyList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(DataTime time) {
|
||||
super.remove(time);
|
||||
Collection<CcfpRecord> notNeeded = null;
|
||||
synchronized (unprocessedRecords) {
|
||||
notNeeded = unprocessedRecords.remove(time);
|
||||
}
|
||||
if (notNeeded != null) {
|
||||
notNeeded.clear();
|
||||
}
|
||||
|
||||
DisplayFrame frame = null;
|
||||
synchronized (frames) {
|
||||
frame = frames.remove(time);
|
||||
}
|
||||
if (frame != null) {
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,12 +31,10 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.ccfp.Activator;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.LoadProperties;
|
||||
import com.raytheon.uf.viz.core.status.StatusConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -56,8 +54,9 @@ import com.raytheon.uf.viz.core.status.StatusConstants;
|
|||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class CcfpResourceData extends AbstractRequestableResourceData {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(CcfpResourceData.class);
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(CcfpResourceData.class);
|
||||
|
||||
// This flag determnies if we draw lines and polygons
|
||||
@XmlAttribute
|
||||
private boolean displayArea = true;
|
||||
|
@ -69,35 +68,34 @@ public class CcfpResourceData extends AbstractRequestableResourceData {
|
|||
// This flag determines if we display text boxes
|
||||
@XmlAttribute
|
||||
private boolean displayText = true;
|
||||
|
||||
|
||||
// Filter by coverage
|
||||
@XmlAttribute
|
||||
private int coverageFilter = 0;
|
||||
|
||||
|
||||
|
||||
@XmlAttribute
|
||||
private int validDuration = 0;
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (obj instanceof CcfpResourceData == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
CcfpResourceData other = (CcfpResourceData) obj;
|
||||
|
||||
if (other.coverageFilter != this.coverageFilter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (other.validDuration != this.validDuration) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (other.displayText != this.displayText) {
|
||||
return false;
|
||||
}
|
||||
|
@ -109,7 +107,7 @@ public class CcfpResourceData extends AbstractRequestableResourceData {
|
|||
if (other.displayMovement != this.displayMovement) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -122,7 +120,7 @@ public class CcfpResourceData extends AbstractRequestableResourceData {
|
|||
DataTime[] originalTimes = super.getAvailableTimes();
|
||||
ArrayList<DataTime> newTimes = new ArrayList<DataTime>();
|
||||
for (DataTime time : originalTimes) {
|
||||
if (time.getValidPeriod().getDuration() == validDuration * 1000) {
|
||||
if (durationMatches(time)) {
|
||||
newTimes.add(time);
|
||||
}
|
||||
}
|
||||
|
@ -147,6 +145,18 @@ public class CcfpResourceData extends AbstractRequestableResourceData {
|
|||
return nr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a DataTime's valid period matches the duration of the resource
|
||||
* data
|
||||
*
|
||||
* @param time
|
||||
* the time to check
|
||||
* @return true if the durations are equal, otherwise false
|
||||
*/
|
||||
protected boolean durationMatches(DataTime time) {
|
||||
return time.getValidPeriod().getDuration() == validDuration * 1000;
|
||||
}
|
||||
|
||||
public boolean isDisplayArea() {
|
||||
return displayArea;
|
||||
}
|
||||
|
@ -185,6 +195,6 @@ public class CcfpResourceData extends AbstractRequestableResourceData {
|
|||
|
||||
public void setValidDuration(int validDuration) {
|
||||
this.validDuration = validDuration;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ com.raytheon.uf.viz.core.rsc.capabilities.LabelableCapability
|
|||
com.raytheon.uf.viz.core.rsc.capabilities.DensityCapability
|
||||
com.raytheon.uf.viz.core.rsc.capabilities.DisplayTypeCapability
|
||||
com.raytheon.uf.viz.core.rsc.capabilities.MagnificationCapability
|
||||
com.raytheon.uf.viz.core.rsc.capabilities.MultiChannelCapability
|
||||
com.raytheon.uf.viz.core.rsc.capabilities.PointCapability
|
||||
com.raytheon.uf.viz.core.rsc.capabilities.TimeMatchBasisCapability
|
||||
com.raytheon.uf.viz.core.rsc.GenericResourceData
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</bean>
|
||||
|
||||
<!-- FIXME: Uncomment to re-enable cache at CAVE startup
|
||||
<bean id="gfeDiskCache" class="com.raytheon.uf.common.cache.DiskCache" init-method="activateCache">
|
||||
<bean id="gfeDiskCache" class="com.raytheon.uf.common.cache.disk.DiskCache" init-method="activateCache">
|
||||
<property name="name" value="GFE"/> -->
|
||||
<!-- TODO: Make this an envionment variable that's passed in -->
|
||||
<!-- Cache directory relative to caveData/etc/workstation/${host} default is diskCache, will be followed by ${NAME}/${PID} -->
|
||||
|
|
|
@ -50,7 +50,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
|
||||
/**
|
||||
* Creates uEngine scripts on the fly.
|
||||
* Creates uEngine scripts on the fly. DEPRECATED: Requests from viz should go
|
||||
* through ThriftClient to the thrift service instead of using ScriptCreator and
|
||||
* then going to the uengine service. The thrift service performs faster and is
|
||||
* more maintainable. Use ThriftClient.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -73,6 +76,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
* @author brockwoo
|
||||
* @version 1
|
||||
*/
|
||||
@Deprecated
|
||||
public class ScriptCreator {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ScriptCreator.class);
|
||||
|
|
|
@ -187,6 +187,8 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
|
|||
|
||||
private boolean mirror;
|
||||
|
||||
private double noDataValue = Double.NaN;
|
||||
|
||||
@XmlElement
|
||||
private PersistedParameters persisted = new PersistedParameters();
|
||||
|
||||
|
@ -1009,4 +1011,20 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
|
|||
this.colorMapMax = params.colorMapMax;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the noDataValue
|
||||
*/
|
||||
public double getNoDataValue() {
|
||||
return noDataValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param noDataValue
|
||||
* the noDataValue to set
|
||||
*/
|
||||
public void setNoDataValue(double noDataValue) {
|
||||
this.noDataValue = noDataValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class ImagingSupport {
|
|||
bulk.toArray(new DrawableImage[bulk.size()]));
|
||||
}
|
||||
|
||||
return rval & skipped;
|
||||
return rval & !skipped;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,104 +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.uf.viz.core.drawables.ext.colormap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* {@link IImagingExtension} used to create and draw multi-channel R,G,B images
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 5, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IMultiChannelImageExtension extends IImagingExtension {
|
||||
|
||||
public static enum Channel {
|
||||
RED, GREEN, BLUE;
|
||||
}
|
||||
|
||||
public static class ChannelData {
|
||||
public String name;
|
||||
|
||||
public ColorMapParameters parameters;
|
||||
|
||||
public boolean invert;
|
||||
|
||||
public ChannelData(String name, ColorMapParameters params,
|
||||
boolean invert) {
|
||||
this.name = name;
|
||||
this.parameters = params;
|
||||
}
|
||||
}
|
||||
|
||||
public static interface IMultiChannelImage extends IImage {
|
||||
|
||||
public Map<Channel, IImageChannel> getImageMapping();
|
||||
|
||||
public void setImageMapping(Map<Channel, IImageChannel> mapping);
|
||||
|
||||
}
|
||||
|
||||
public static interface IImageChannel extends IColormappedImage {
|
||||
|
||||
public void setInverted(boolean inverted);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a true color image, this
|
||||
*
|
||||
* @param channelMap
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public IMultiChannelImage constructImage(
|
||||
Map<Channel, IImageChannel> imageMapping) throws VizException;
|
||||
|
||||
/**
|
||||
* Construct a IImageChannel for a IMultiChannelImage
|
||||
*
|
||||
* @param callback
|
||||
* @param inverted
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public IImageChannel constructImage(
|
||||
IColorMapDataRetrievalCallback callback, ChannelData channelData)
|
||||
throws VizException;
|
||||
|
||||
}
|
|
@ -34,7 +34,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
* if you have dozens or hundreds of tasks that each take a short time. Creating
|
||||
* a job for each task can result in more threads than is useful. If you instead
|
||||
* use a JobPool it reduces the number of threads by limiting the number of
|
||||
* eclipse jobs tBhat are created. For many tasks a JobPool may perform faster
|
||||
* eclipse jobs that are created. For many tasks a JobPool may perform faster
|
||||
* than using eclipse Jobs directly because thread creation and context
|
||||
* switching are reduced.
|
||||
*
|
||||
|
@ -59,6 +59,12 @@ public class JobPool {
|
|||
|
||||
protected List<Job> jobList;
|
||||
|
||||
protected boolean cancel = false;
|
||||
|
||||
protected Object cancelLock = new Object();
|
||||
|
||||
protected Object joinLock = new Object();
|
||||
|
||||
public JobPool(String name, int size) {
|
||||
this(name, size, null, null);
|
||||
}
|
||||
|
@ -82,46 +88,75 @@ public class JobPool {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void schedule(Runnable runnable) {
|
||||
workQueue.offer(runnable);
|
||||
Job job = jobQueue.poll();
|
||||
if (job != null) {
|
||||
job.schedule();
|
||||
public void schedule(Runnable runnable) {
|
||||
// do not schedule while canceling(cancel should be fast).
|
||||
synchronized (cancelLock) {
|
||||
if (cancel) {
|
||||
return;
|
||||
}
|
||||
// do not schedule while joining, join might be slow but the javaDoc
|
||||
// warns others.
|
||||
synchronized (joinLock) {
|
||||
workQueue.offer(runnable);
|
||||
Job job = jobQueue.poll();
|
||||
if (job != null) {
|
||||
job.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Join on the Runnables in the pool. Attempting to schedule other Runnables
|
||||
* will block until join as returned so be careful when calling
|
||||
* will block until join has returned so be careful when calling
|
||||
*/
|
||||
public synchronized void join() {
|
||||
for (Job j : jobList) {
|
||||
try {
|
||||
j.join();
|
||||
} catch (InterruptedException e) {
|
||||
// Ignore interupt
|
||||
public void join() {
|
||||
synchronized (joinLock) {
|
||||
for (Job j : jobList) {
|
||||
try {
|
||||
j.join();
|
||||
} catch (InterruptedException e) {
|
||||
// Ignore interupt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel the job pool, will clear out the workQueue then join on all jobs
|
||||
* running
|
||||
* running. Once canceled all future calls to schedule will be ignored.
|
||||
*/
|
||||
public synchronized void cancel() {
|
||||
workQueue.clear();
|
||||
join();
|
||||
public void cancel() {
|
||||
cancel(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel the job pool, will clear out the workQueue and optionally join
|
||||
* runnning jobs. Once canceled all future calls to schedule will be
|
||||
* ignored.
|
||||
*
|
||||
* @param join
|
||||
* true if you want to join before returning.
|
||||
*/
|
||||
public void cancel(boolean join) {
|
||||
synchronized (cancelLock) {
|
||||
cancel = true;
|
||||
workQueue.clear();
|
||||
}
|
||||
if (join) {
|
||||
join();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels the specified runnable. Returns true if the provided runnable was
|
||||
* waiting to be run but now is now. Returns false if the provided runnable
|
||||
* waiting to be run but now is not. Returns false if the provided runnable
|
||||
* is already running or if it was not enqueued to begin with.
|
||||
*
|
||||
* @param runnable
|
||||
* @return
|
||||
*/
|
||||
public synchronized boolean cancel(Runnable runnable) {
|
||||
public boolean cancel(Runnable runnable) {
|
||||
return workQueue.remove(runnable);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.jws.WebService;
|
||||
|
||||
|
@ -20,6 +21,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
|
|||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
||||
import com.raytheon.uf.common.serialization.comm.RemoteServiceRequest;
|
||||
import com.raytheon.uf.common.serialization.comm.RequestWrapper;
|
||||
import com.raytheon.uf.common.serialization.comm.ServiceException;
|
||||
import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
|
||||
import com.raytheon.uf.common.serialization.comm.util.ExceptionWrapper;
|
||||
|
@ -50,9 +52,9 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
**/
|
||||
|
||||
/**
|
||||
* The thrift client. used to send requests to the RemoteReqeustServer. Make
|
||||
* The thrift client. used to send requests to the RemoteRequestServer. Make
|
||||
* sure request type has registered a handler to handle the request on the
|
||||
* server
|
||||
* server.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -60,6 +62,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 3, 2009 mschenke Initial creation
|
||||
* Jul 24, 2012 njensen Enhanced logging
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -273,9 +276,12 @@ public class ThriftClient {
|
|||
private static Object sendRequest(IServerRequest request,
|
||||
String httpAddress, String uri) throws VizException {
|
||||
httpAddress += uri;
|
||||
String uniqueId = UUID.randomUUID().toString();
|
||||
RequestWrapper wrapper = new RequestWrapper(request, VizApp.getWsId(),
|
||||
uniqueId);
|
||||
byte[] message;
|
||||
try {
|
||||
message = SerializationUtil.transformToThrift(request);
|
||||
message = SerializationUtil.transformToThrift(wrapper);
|
||||
} catch (SerializationException e) {
|
||||
throw new VizException("unable to serialize request object", e);
|
||||
}
|
||||
|
@ -287,9 +293,8 @@ public class ThriftClient {
|
|||
.postBinary(httpAddress, message);
|
||||
long time = System.currentTimeMillis() - t0;
|
||||
if (time >= SIMPLE_LOG_TIME) {
|
||||
System.out.println("Time to execute " + request);
|
||||
System.out.println("Took " + time + "ms");
|
||||
|
||||
System.out.println("Took " + time + "ms to run request id["
|
||||
+ uniqueId + "] " + request.toString());
|
||||
}
|
||||
if (time >= BAD_LOG_TIME) {
|
||||
new Exception() {
|
||||
|
|
|
@ -158,6 +158,18 @@ public class ResourceList extends CopyOnWriteArrayList<ResourcePair> implements
|
|||
return add(rp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function for determining if the {@link ResourcePair} can be added to the
|
||||
* list. Default checks if the pair is already in the list and returns false
|
||||
* if so
|
||||
*
|
||||
* @param e
|
||||
* @return
|
||||
*/
|
||||
protected boolean canAdd(ResourcePair e) {
|
||||
return contains(e) == false;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -165,7 +177,7 @@ public class ResourceList extends CopyOnWriteArrayList<ResourcePair> implements
|
|||
*/
|
||||
@Override
|
||||
public boolean add(ResourcePair e) {
|
||||
if (e == null || contains(e)) {
|
||||
if (e == null || canAdd(e) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -263,7 +275,7 @@ public class ResourceList extends CopyOnWriteArrayList<ResourcePair> implements
|
|||
}
|
||||
|
||||
synchronized (this) {
|
||||
if (contains(e)) {
|
||||
if (canAdd(e) == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -276,9 +288,7 @@ public class ResourceList extends CopyOnWriteArrayList<ResourcePair> implements
|
|||
|
||||
super.add(i >= 0 ? (i + 1) : 0, e);
|
||||
synchronized (resourcesToInstantiate) {
|
||||
if (resourcesToInstantiate.contains(e) == false) {
|
||||
resourcesToInstantiate.add(e);
|
||||
}
|
||||
resourcesToInstantiate.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -300,7 +310,7 @@ public class ResourceList extends CopyOnWriteArrayList<ResourcePair> implements
|
|||
if (rp.getResource() == null) {
|
||||
Validate.notNull(rp.getResourceData());
|
||||
}
|
||||
if (contains(rp) == false) {
|
||||
if (canAdd(rp)) {
|
||||
toAdd.add(rp);
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +410,13 @@ public class ResourceList extends CopyOnWriteArrayList<ResourcePair> implements
|
|||
|
||||
super.remove(index);
|
||||
synchronized (resourcesToInstantiate) {
|
||||
resourcesToInstantiate.remove(rp);
|
||||
// Ensure rp is removed from list entirely
|
||||
Iterator<ResourcePair> iter = resourcesToInstantiate.iterator();
|
||||
while (iter.hasNext()) {
|
||||
if (iter.next() == rp) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -1,313 +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.uf.viz.core.rsc.capabilities;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IMultiChannelImageExtension.Channel;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IMultiChannelImageExtension.ChannelData;
|
||||
|
||||
/**
|
||||
* Capability for multi channel imagery
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 20, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class MultiChannelCapability extends AbstractCapability {
|
||||
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public static class ChannelSerializable {
|
||||
|
||||
@XmlAttribute
|
||||
private String name;
|
||||
|
||||
@XmlAttribute
|
||||
private Channel channel;
|
||||
|
||||
@XmlAttribute
|
||||
private boolean invert;
|
||||
|
||||
@XmlElement
|
||||
private float dataMin;
|
||||
|
||||
@XmlElement
|
||||
private float dataMax;
|
||||
|
||||
@XmlElement
|
||||
private float cmapMin;
|
||||
|
||||
@XmlElement
|
||||
private float cmapMax;
|
||||
|
||||
public ChannelSerializable() {
|
||||
|
||||
}
|
||||
|
||||
public ChannelSerializable(Channel channel, ChannelData channelData) {
|
||||
this.channel = channel;
|
||||
this.name = channelData.name;
|
||||
this.invert = channelData.invert;
|
||||
ColorMapParameters params = channelData.parameters;
|
||||
this.dataMin = params.getDataMin();
|
||||
this.dataMax = params.getDataMax();
|
||||
this.cmapMin = params.getColorMapMin();
|
||||
this.cmapMax = params.getColorMapMax();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the channel
|
||||
*/
|
||||
public Channel getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param channel
|
||||
* the channel to set
|
||||
*/
|
||||
public void setChannel(Channel channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dataMin
|
||||
*/
|
||||
public float getDataMin() {
|
||||
return dataMin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataMin
|
||||
* the dataMin to set
|
||||
*/
|
||||
public void setDataMin(float dataMin) {
|
||||
this.dataMin = dataMin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dataMax
|
||||
*/
|
||||
public float getDataMax() {
|
||||
return dataMax;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataMax
|
||||
* the dataMax to set
|
||||
*/
|
||||
public void setDataMax(float dataMax) {
|
||||
this.dataMax = dataMax;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cmapMin
|
||||
*/
|
||||
public float getCmapMin() {
|
||||
return cmapMin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cmapMin
|
||||
* the cmapMin to set
|
||||
*/
|
||||
public void setCmapMin(float cmapMin) {
|
||||
this.cmapMin = cmapMin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cmapMax
|
||||
*/
|
||||
public float getCmapMax() {
|
||||
return cmapMax;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cmapMax
|
||||
* the cmapMax to set
|
||||
*/
|
||||
public void setCmapMax(float cmapMax) {
|
||||
this.cmapMax = cmapMax;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the invert
|
||||
*/
|
||||
public boolean isInvert() {
|
||||
return invert;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param invert
|
||||
* the invert to set
|
||||
*/
|
||||
public void setInvert(boolean invert) {
|
||||
this.invert = invert;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class Marshaller extends
|
||||
XmlAdapter<ChannelSerializable[], HashMap<Channel, ChannelData>> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang
|
||||
* .Object)
|
||||
*/
|
||||
@Override
|
||||
public HashMap<Channel, ChannelData> unmarshal(ChannelSerializable[] v)
|
||||
throws Exception {
|
||||
HashMap<Channel, ChannelData> channelMap = new HashMap<Channel, ChannelData>();
|
||||
for (ChannelSerializable cs : v) {
|
||||
ColorMapParameters params = new ColorMapParameters();
|
||||
params.setDataMin(cs.dataMin);
|
||||
params.setDataMax(cs.dataMax);
|
||||
params.setColorMapMin(cs.cmapMin);
|
||||
params.setColorMapMax(cs.cmapMax);
|
||||
channelMap.put(cs.channel, new ChannelData(cs.name, params,
|
||||
cs.invert));
|
||||
}
|
||||
return channelMap;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object
|
||||
* )
|
||||
*/
|
||||
@Override
|
||||
public ChannelSerializable[] marshal(HashMap<Channel, ChannelData> v)
|
||||
throws Exception {
|
||||
ChannelSerializable[] serializable = new ChannelSerializable[v
|
||||
.size()];
|
||||
int i = 0;
|
||||
for (Entry<Channel, ChannelData> entry : v.entrySet()) {
|
||||
ChannelSerializable cs = new ChannelSerializable(
|
||||
entry.getKey(), entry.getValue());
|
||||
serializable[i++] = cs;
|
||||
}
|
||||
return serializable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@XmlJavaTypeAdapter(value = Marshaller.class)
|
||||
private HashMap<Channel, ChannelData> channelMap = new HashMap<Channel, ChannelData>();
|
||||
|
||||
private String[] names;
|
||||
|
||||
/**
|
||||
* @return the names
|
||||
*/
|
||||
public String[] getNames() {
|
||||
return names;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param names
|
||||
* the names to set
|
||||
*/
|
||||
public void setNames(String[] names) {
|
||||
this.names = names;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the channelMap
|
||||
*/
|
||||
public Map<Channel, ChannelData> getChannelMap() {
|
||||
return channelMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param channelMap
|
||||
* the channelMap to set
|
||||
*/
|
||||
public void setChannelMap(HashMap<Channel, ChannelData> channelMap) {
|
||||
if (channelMap == null) {
|
||||
channelMap = new HashMap<Channel, ChannelData>();
|
||||
}
|
||||
this.channelMap = channelMap;
|
||||
capabilityChanged();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability#
|
||||
* capabilityChanged()
|
||||
*/
|
||||
@Override
|
||||
public void capabilityChanged() {
|
||||
super.capabilityChanged();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability#clone()
|
||||
*/
|
||||
@Override
|
||||
public AbstractCapability clone() {
|
||||
MultiChannelCapability cap = new MultiChannelCapability();
|
||||
cap.channelMap = new HashMap<Channel, ChannelData>(channelMap);
|
||||
return cap;
|
||||
}
|
||||
|
||||
}
|
|
@ -123,7 +123,7 @@ public class Tile {
|
|||
* @param y
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(double x, double y) {
|
||||
public boolean crsContains(double x, double y) {
|
||||
Envelope env = tileGeometry.getEnvelope();
|
||||
return env.getMinimum(0) <= x && env.getMaximum(0) >= x
|
||||
&& env.getMinimum(1) <= y && env.getMaximum(1) >= y;
|
||||
|
@ -135,8 +135,22 @@ public class Tile {
|
|||
* @param c
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(Coordinate c) {
|
||||
return contains(c.x, c.y);
|
||||
public boolean crsContains(Coordinate c) {
|
||||
return crsContains(c.x, c.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the x/y coordinate is contained by the Tile's grid
|
||||
* envelope
|
||||
*
|
||||
* @param gridX
|
||||
* @param gridY
|
||||
* @return
|
||||
*/
|
||||
public boolean gridContains(int gridX, int gridY) {
|
||||
GridEnvelope ge = tileGeometry.getGridRange();
|
||||
return ge.getLow(0) <= gridX && ge.getHigh(0) >= gridX
|
||||
&& ge.getLow(1) <= gridY && ge.getHigh(1) >= gridY;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -225,11 +225,14 @@ public class TileLevel {
|
|||
* @return
|
||||
*/
|
||||
public Tile getTile(double x, double y) {
|
||||
int xIdx = (int) x / tileSize;
|
||||
int yIdx = (int) y / tileSize;
|
||||
double xIdx = x / tileSize;
|
||||
double yIdx = y / tileSize;
|
||||
if (xIdx >= 0 && yIdx >= 0 && xIdx < getNumXTiles()
|
||||
&& yIdx < getNumYTiles()) {
|
||||
return tiles[yIdx][xIdx];
|
||||
Tile tile = getTile((int) xIdx, (int) yIdx);
|
||||
if (tile.gridContains((int) x, (int) y)) {
|
||||
return tile;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -371,6 +371,7 @@ public class TileSetRenderable implements IRenderable {
|
|||
}
|
||||
jobMap.clear();
|
||||
} else {
|
||||
target.setNeedsRefresh(true);
|
||||
// Create tiles needing images
|
||||
createTileImages(target, tilesNeedingImage);
|
||||
}
|
||||
|
|
|
@ -73,7 +73,8 @@ import com.raytheon.uf.viz.d2d.core.D2DLoadProperties;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 10, 2009 chammack Initial creation
|
||||
* 2012-04-20 DR 14699 D. Friedman Work around race conditions
|
||||
* 2012-04-20 DR 14699 D. Friedman Work around race conditions
|
||||
* 2012-08-14 DR 15160 D. Friedman Reduce chance of UI blocking
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -94,9 +95,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
@Override
|
||||
public void disposed(AbstractVizResource<?, ?> resource) {
|
||||
if ((resource == timeMatchBasis)) {
|
||||
synchronized (D2DTimeMatcher.this) {
|
||||
timeMatchBasis = null;
|
||||
}
|
||||
internalSetTimeMatchBasis(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,6 +127,11 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
private boolean needRetry;
|
||||
private int nRetries;
|
||||
|
||||
// DR 15160 state
|
||||
private transient boolean pendingTmbChange = false;
|
||||
private transient boolean inTimeMatch = false;
|
||||
private transient AbstractVizResource<?, ?> pendingTimeMatchBasis;
|
||||
|
||||
/**
|
||||
* Default Constructor.
|
||||
*/
|
||||
|
@ -158,8 +162,15 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
public void redoTimeMatching(IDescriptor descriptor) throws VizException {
|
||||
|
||||
synchronized (this) {
|
||||
if (inTimeMatch) {
|
||||
needRetry = true;
|
||||
return;
|
||||
}
|
||||
pendingTmbChange = false;
|
||||
inTimeMatch = true;
|
||||
needRetry = false;
|
||||
|
||||
}
|
||||
try {
|
||||
if (timeMatchBasis != null) {
|
||||
IDescriptor tmDescriptor = timeMatchBasis.getDescriptor();
|
||||
if (tmDescriptor != null && tmDescriptor != descriptor) {
|
||||
|
@ -205,13 +216,27 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
}
|
||||
}
|
||||
|
||||
if (needRetry) {
|
||||
if (nRetries < 200) {
|
||||
++nRetries;
|
||||
TimeMatchingJob.scheduleTimeMatch(descriptor);
|
||||
}
|
||||
} else
|
||||
nRetries = 0;
|
||||
} finally {
|
||||
boolean scheduleRetry = false;
|
||||
synchronized (this) {
|
||||
inTimeMatch = false;
|
||||
if (pendingTmbChange) {
|
||||
pendingTmbChange = false;
|
||||
changeTimeMatchBasis(pendingTimeMatchBasis);
|
||||
pendingTimeMatchBasis = null;
|
||||
scheduleRetry = true;
|
||||
}
|
||||
|
||||
if (needRetry) {
|
||||
if (nRetries < 200) {
|
||||
++nRetries;
|
||||
scheduleRetry = true;
|
||||
}
|
||||
} else
|
||||
nRetries = 0;
|
||||
}
|
||||
if (scheduleRetry)
|
||||
TimeMatchingJob.scheduleTimeMatch(descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -708,9 +733,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
IDescriptor descriptor) {
|
||||
if ((resource == timeMatchBasis)
|
||||
&& (descriptor instanceof AbstractDescriptor)) {
|
||||
synchronized (this) {
|
||||
timeMatchBasis = null;
|
||||
}
|
||||
internalSetTimeMatchBasis(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1004,4 +1027,17 @@ public class D2DTimeMatcher extends AbstractTimeMatcher implements
|
|||
configFactory.resetMultiload();
|
||||
}
|
||||
|
||||
// For DR 15160
|
||||
protected void internalSetTimeMatchBasis(AbstractVizResource<?, ?> timeMatchBasis) {
|
||||
synchronized (this) {
|
||||
if (inTimeMatch) {
|
||||
pendingTmbChange = true;
|
||||
pendingTimeMatchBasis = timeMatchBasis;
|
||||
} else {
|
||||
pendingTmbChange = false;
|
||||
pendingTimeMatchBasis = null;
|
||||
changeTimeMatchBasis(timeMatchBasis);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,9 +80,9 @@
|
|||
<arrowStyle>
|
||||
<!--
|
||||
<displayUnits>K/(km * 1000)</displayUnits>
|
||||
-->
|
||||
<displayUnits label="K/(km*1000)">K/m*1.0E6</displayUnits>
|
||||
-->
|
||||
<displayUnits label="C/m">K/m*1.0E6</displayUnits>
|
||||
</arrowStyle>
|
||||
</styleRule>
|
||||
|
||||
|
|
|
@ -4084,4 +4084,13 @@ in | .03937 | 0 | 4 | | |..|8000F0FF| | 16 | \
|
|||
</contourStyle>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<paramLevelMatches>
|
||||
<parameter>Wind</parameter>
|
||||
<parameter>Gust</parameter>
|
||||
</paramLevelMatches>
|
||||
<contourStyle>
|
||||
<displayUnits>kts</displayUnits>
|
||||
</contourStyle>
|
||||
</styleRule>
|
||||
</styleRuleset>
|
||||
|
|
|
@ -498,4 +498,13 @@
|
|||
</graphStyle>
|
||||
</styleRule>
|
||||
|
||||
<styleRule>
|
||||
<paramLevelMatches>
|
||||
<parameter>MTV</parameter>
|
||||
</paramLevelMatches>
|
||||
<graphStyle>
|
||||
<displayUnits label="gm/kgs">g*m/(kg*s)</displayUnits>
|
||||
</graphStyle>
|
||||
</styleRule>
|
||||
|
||||
</styleRuleset>
|
|
@ -1568,7 +1568,7 @@
|
|||
</key>
|
||||
<key
|
||||
contextId="com.raytheon.uf.viz.d2d.ui"
|
||||
commandId="com.raytheon.viz.ui.actions.printScreenAction"
|
||||
commandId="com.raytheon.uf.viz.d2d.ui.actions.showPrintDialog"
|
||||
schemeId="com.raytheon.viz.ui.awips.scheme"
|
||||
sequence="M1+P">
|
||||
</key>
|
||||
|
|
|
@ -57,7 +57,7 @@ public class AddAWIPSProcedure extends AbstractHandler {
|
|||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
Procedure procedure = new Procedure();
|
||||
ProcedureDlg dlg = new ProcedureDlg(null, procedure,
|
||||
ProcedureDlg dlg = ProcedureDlg.getOrCreateDialog(null, procedure,
|
||||
HandlerUtil.getActiveShell(event));
|
||||
dlg.open();
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@ import java.io.File;
|
|||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
|
@ -53,6 +55,8 @@ import com.raytheon.viz.ui.actions.LoadSerializedXml;
|
|||
*/
|
||||
public class OpenAWIPSProcedure extends AbstractHandler {
|
||||
|
||||
private OpenProcedureListDlg dialog;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -62,16 +66,21 @@ public class OpenAWIPSProcedure extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
ProcedureListDlg listDlg = new OpenProcedureListDlg(
|
||||
if(dialog != null){
|
||||
dialog.open();
|
||||
return null;
|
||||
}
|
||||
|
||||
dialog = new OpenProcedureListDlg(
|
||||
HandlerUtil.getActiveShell(event));
|
||||
listDlg.open();
|
||||
|
||||
LocalizationFile selectedFile = listDlg.getSelectedFile();
|
||||
|
||||
dialog.open();
|
||||
|
||||
LocalizationFile selectedFile = dialog.getSelectedFile();
|
||||
dialog = null;
|
||||
if (selectedFile != null) {
|
||||
File f = selectedFile.getFile();
|
||||
Procedure p = (Procedure) LoadSerializedXml.deserialize(f);
|
||||
ProcedureDlg dlg = new ProcedureDlg(
|
||||
ProcedureDlg dlg = ProcedureDlg.getOrCreateDialog(
|
||||
LocalizationUtil.extractName(selectedFile.getName()), p,
|
||||
VizWorkbenchManager.getInstance().getCurrentWindow()
|
||||
.getShell());
|
||||
|
|
|
@ -23,6 +23,7 @@ package com.raytheon.uf.viz.d2d.ui.dialogs.procedures;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
@ -83,6 +84,22 @@ import com.raytheon.viz.ui.actions.SaveBundle;
|
|||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
|
||||
/**
|
||||
*
|
||||
* Dialog for loading or modifying procedures.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author unknown
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ProcedureDlg extends CaveSWTDialog {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
|
@ -94,6 +111,8 @@ public class ProcedureDlg extends CaveSWTDialog {
|
|||
|
||||
public static final String PROCEDURES_DIR = "/procedures";
|
||||
|
||||
private static Collection<ProcedureDlg> openDialogs = new ArrayList<ProcedureDlg>();
|
||||
|
||||
private Font font;
|
||||
|
||||
private List dataList;
|
||||
|
@ -148,7 +167,7 @@ public class ProcedureDlg extends CaveSWTDialog {
|
|||
|
||||
private final java.util.List<BundlePair> bundles;
|
||||
|
||||
public ProcedureDlg(String fileName, Procedure p, Shell parent) {
|
||||
private ProcedureDlg(String fileName, Procedure p, Shell parent) {
|
||||
// Win32
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL
|
||||
| CAVE.DO_NOT_BLOCK);
|
||||
|
@ -203,6 +222,9 @@ public class ProcedureDlg extends CaveSWTDialog {
|
|||
@Override
|
||||
protected void disposed() {
|
||||
font.dispose();
|
||||
synchronized (openDialogs) {
|
||||
openDialogs.remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -989,4 +1011,44 @@ public class ProcedureDlg extends CaveSWTDialog {
|
|||
};
|
||||
dlg.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* If there is a procedure dialog open for the given filename, return it,
|
||||
* otherwise null.
|
||||
*
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public static ProcedureDlg getDialog(String fileName) {
|
||||
synchronized (openDialogs) {
|
||||
if (fileName != null) {
|
||||
for (ProcedureDlg dialog : openDialogs) {
|
||||
if (fileName.equals(dialog.fileName)) {
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ProcedureDlg for the given fileName. If the fileName is null or if there is no open dialog, create a new ProcedureDlg.
|
||||
*
|
||||
* @param fileName
|
||||
* @param p
|
||||
* @param parent
|
||||
* @return
|
||||
*/
|
||||
public static ProcedureDlg getOrCreateDialog(String fileName, Procedure p,
|
||||
Shell parent) {
|
||||
synchronized (openDialogs) {
|
||||
ProcedureDlg dialog = getDialog(fileName);
|
||||
if (dialog == null) {
|
||||
dialog = new ProcedureDlg(fileName, p, parent);
|
||||
openDialogs.add(dialog);
|
||||
}
|
||||
return dialog;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,24 @@ import com.raytheon.uf.common.localization.LocalizationUtil;
|
|||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
*
|
||||
* A dialog which displays a list of procedures for opening, saving, or deleting.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* ??? Initial creation
|
||||
* 07/31/2012 DR 15036 D. Friedman Ensure current user's procedures
|
||||
* are visible.
|
||||
* </pre>
|
||||
*
|
||||
* @author unknown
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ProcedureListDlg extends CaveSWTDialog {
|
||||
|
||||
protected boolean oneLevel = true;
|
||||
|
@ -317,10 +335,18 @@ public class ProcedureListDlg extends CaveSWTDialog {
|
|||
if (treeViewer.getContentProvider() instanceof ProcedureTreeContentProvider) {
|
||||
ProcedureTreeContentProvider content = (ProcedureTreeContentProvider) treeViewer
|
||||
.getContentProvider();
|
||||
Object find = content.findItem(user);
|
||||
final Object find = content.findItem(user);
|
||||
if (find != null) {
|
||||
treeViewer.setExpandedElements(new Object[] { find });
|
||||
treeViewer.reveal(find);
|
||||
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
TreeItem[] items = treeViewer.getTree().getItems();
|
||||
if (items != null && items.length > 0)
|
||||
treeViewer.getTree().showItem(items[items.length - 1]);
|
||||
treeViewer.reveal(find);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -449,14 +475,25 @@ public class ProcedureListDlg extends CaveSWTDialog {
|
|||
procedureTF.setText(procedureTF.getText().concat(".xml"));
|
||||
}
|
||||
if (dataListContains(procedureTF.getText())) {
|
||||
// Pop up a warning
|
||||
boolean result = MessageDialog.openQuestion(shell,
|
||||
"Confirm Overwrite",
|
||||
"The procedure " + procedureTF.getText()
|
||||
+ " already exists. Overwrite anyways?");
|
||||
if (result == true) {
|
||||
fileName = procedureTF.getText();
|
||||
shell.dispose();
|
||||
if (ProcedureDlg.getDialog(procedureTF.getText()) != null) {
|
||||
// User cannot save if dialog is open.
|
||||
MessageDialog
|
||||
.openError(
|
||||
shell,
|
||||
"Cannot Save Procedure",
|
||||
"The procedure "
|
||||
+ procedureTF.getText()
|
||||
+ " is currently open. It cannot be overwritten until it is closed or saved under another name.");
|
||||
} else {
|
||||
// Pop up a warning
|
||||
boolean result = MessageDialog.openQuestion(shell,
|
||||
"Confirm Overwrite",
|
||||
"The procedure " + procedureTF.getText()
|
||||
+ " already exists. Overwrite anyways?");
|
||||
if (result == true) {
|
||||
fileName = procedureTF.getText();
|
||||
shell.dispose();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fileName = procedureTF.getText();
|
||||
|
|
|
@ -385,11 +385,12 @@ public class MasterDerivScript extends PythonInterpreter {
|
|||
private void setDataRecordArg(String argName, IDataRecord argValue)
|
||||
throws JepException {
|
||||
boolean reshape = true;
|
||||
long[] sizes = argValue.getSizes();
|
||||
if (argValue instanceof FloatDataRecord) {
|
||||
FloatDataRecord record = (FloatDataRecord) argValue;
|
||||
if (record.getDimension() == 2) {
|
||||
jep.setNumeric(argName, record.getFloatData(),
|
||||
(int) record.getSizes()[0], (int) record.getSizes()[1]);
|
||||
if (sizes.length == 2) {
|
||||
jep.setNumeric(argName, record.getFloatData(), (int) sizes[0],
|
||||
(int) sizes[1]);
|
||||
reshape = false;
|
||||
} else {
|
||||
evaluateArgument(argName, record.getFloatData());
|
||||
|
@ -401,18 +402,18 @@ public class MasterDerivScript extends PythonInterpreter {
|
|||
jep.eval("del globals()['numpy']");
|
||||
} else if (argValue instanceof IntegerDataRecord) {
|
||||
IntegerDataRecord record = (IntegerDataRecord) argValue;
|
||||
if (record.getDimension() == 2) {
|
||||
jep.setNumeric(argName, record.getIntData(),
|
||||
(int) record.getSizes()[0], (int) record.getSizes()[1]);
|
||||
if (sizes.length == 2) {
|
||||
jep.setNumeric(argName, record.getIntData(), (int) sizes[0],
|
||||
(int) sizes[1]);
|
||||
reshape = false;
|
||||
} else {
|
||||
evaluateArgument(argName, record.getIntData());
|
||||
}
|
||||
} else if (argValue instanceof ByteDataRecord) {
|
||||
ByteDataRecord record = (ByteDataRecord) argValue;
|
||||
if (record.getDimension() == 2) {
|
||||
jep.setNumeric(argName, record.getByteData(),
|
||||
(int) record.getSizes()[0], (int) record.getSizes()[1]);
|
||||
if (sizes.length == 2) {
|
||||
jep.setNumeric(argName, record.getByteData(), (int) sizes[0],
|
||||
(int) sizes[1]);
|
||||
reshape = false;
|
||||
} else {
|
||||
evaluateArgument(argName, record.getByteData());
|
||||
|
|
|
@ -24,15 +24,15 @@
|
|||
</Method>
|
||||
<Method models="HPCGuide" displayName="Total Cloud Cover" name="Multiply">
|
||||
<Field abbreviation="TCC"/>
|
||||
<ConstantField value="0.01"/>
|
||||
<ConstantField value="100.0"/>
|
||||
</Method>
|
||||
<Method models="RTMA" displayName="GOES Effective Cloud Amount" name="Multiply">
|
||||
<Field abbreviation="TCC"/>
|
||||
<ConstantField value="0.01"/>
|
||||
<ConstantField value="100.0"/>
|
||||
</Method>
|
||||
<Method name="Multiply">
|
||||
<Field abbreviation="TCC"/>
|
||||
<ConstantField value="0.01"/>
|
||||
<ConstantField value="100.0"/>
|
||||
</Method>
|
||||
<Method levels="Surface" name="Mapping">
|
||||
<Field level="Station" abbreviation="clouds_bestCat"/>
|
||||
|
|
|
@ -18,4 +18,9 @@
|
|||
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
|
||||
further_licensing_information.
|
||||
-->
|
||||
<DerivedParameter abbreviation="MnT12hr" name="12-hr Minimum Temperature" unit="K"/>
|
||||
<DerivedParameter abbreviation="MnT12hr" name="12-hr Minimum Temperature" unit="K">
|
||||
<Method name="Alias" levels="Surface"
|
||||
models="MOSGuide" displayName="Minimum Temperature">
|
||||
<Field abbreviation="MnT12hr" level="2FHAG"/>
|
||||
</Method>
|
||||
</DerivedParameter>
|
|
@ -18,4 +18,9 @@
|
|||
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
|
||||
further_licensing_information.
|
||||
-->
|
||||
<DerivedParameter abbreviation="MxT12hr" name="12-hr Maximum Temperature" unit="K"/>
|
||||
<DerivedParameter abbreviation="MxT12hr" name="12-hr Maximum Temperature" unit="K">
|
||||
<Method name="Alias" levels="Surface"
|
||||
models="MOSGuide" displayName="Maximum Temperature">
|
||||
<Field abbreviation="MxT12hr" level="2FHAG"/>
|
||||
</Method>
|
||||
</DerivedParameter>
|
|
@ -18,7 +18,7 @@
|
|||
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
|
||||
further_licensing_information.
|
||||
-->
|
||||
<DerivedParameter unit="m/s" name="Total Wind (Vector)" abbreviation="Wind">
|
||||
<DerivedParameter unit="m/s" name="Wind" abbreviation="Wind">
|
||||
<Method name="Vector">
|
||||
<Field abbreviation="uW"/>
|
||||
<Field abbreviation="vW"/>
|
||||
|
|
|
@ -171,11 +171,11 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
|
||||
protected Map<String, List<String>> sourceAliases = new HashMap<String, List<String>>();
|
||||
|
||||
private List<String> allSources;
|
||||
protected List<String> allSources;
|
||||
|
||||
private List<String> allParameters;
|
||||
protected List<String> allParameters;
|
||||
|
||||
private List<Level> allLevels;
|
||||
protected List<Level> allLevels;
|
||||
|
||||
/**
|
||||
* A call to this method assigns the passed grid tree to the original grid
|
||||
|
|
|
@ -819,7 +819,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
|
|||
// We can import into true directories, not group datas
|
||||
mgr.add(new Separator());
|
||||
mgr.add(new ImportFileAction(fdata.getPathData().getType(),
|
||||
fdata.getPath()));
|
||||
fdata.getPath(), fdata.getPathData().getFilter()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,17 +67,36 @@ public class ImportFileAction extends Action {
|
|||
private static final String FORMAT_STRING = "The file '%s' already exists at the %s level and "
|
||||
+ "will be deleted. Proceed?";
|
||||
|
||||
private static final String ASTERISK = "*";
|
||||
|
||||
private String directoryPath;
|
||||
|
||||
private LocalizationType contextType;
|
||||
|
||||
private String[] fileExtensionFilterArr;
|
||||
|
||||
public ImportFileAction(LocalizationType contextType, String directoryPath) {
|
||||
super("Import File...");
|
||||
this.contextType = contextType;
|
||||
this.directoryPath = directoryPath;
|
||||
}
|
||||
|
||||
/*
|
||||
public ImportFileAction(LocalizationType contextType, String directoryPath, String[] filter) {
|
||||
this(contextType, directoryPath);
|
||||
if (filter != null) {
|
||||
this.fileExtensionFilterArr = new String[filter.length];
|
||||
for (int i = 0; i < filter.length; ++i) {
|
||||
if (filter[i] != null && filter[i].startsWith(".")) {
|
||||
// prepend an asterisk as required by FileDialog.
|
||||
this.fileExtensionFilterArr[i] = ASTERISK + filter[i];
|
||||
} else {
|
||||
this.fileExtensionFilterArr[i] = filter[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.jface.action.Action#run()
|
||||
|
@ -87,6 +106,9 @@ public class ImportFileAction extends Action {
|
|||
Shell parent = VizWorkbenchManager.getInstance().getCurrentWindow()
|
||||
.getShell();
|
||||
FileDialog dialog = new FileDialog(parent);
|
||||
if (fileExtensionFilterArr != null) {
|
||||
dialog.setFilterExtensions(fileExtensionFilterArr);
|
||||
}
|
||||
String fileToImport = dialog.open();
|
||||
if (fileToImport != null) {
|
||||
File importFile = new File(fileToImport);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -279,8 +279,11 @@ public class FFTIControlDlg extends Dialog {
|
|||
&& (thisItem.getQpeDurHr() == nextItem.getQpeDurHr())
|
||||
&& (thisItem.getGuidDurHr() == nextItem.getGuidDurHr())
|
||||
&& (thisItem.getQpfDurHr() == nextItem.getQpfDurHr())
|
||||
&& (thisItem.getTotalDurHr() == nextItem.getTotalDurHr())) {
|
||||
|
||||
&& (thisItem.getTotalDurHr() == nextItem.getTotalDurHr())
|
||||
&& (thisItem.getQpeSrc().length > 0 && nextItem.getQpeSrc().length > 0 && thisItem.getQpeSrc()[0].equals(nextItem.getQpeSrc()[0]))
|
||||
&& (thisItem.getQpfSrc().length > 0 && nextItem.getQpfSrc().length > 0 && thisItem.getQpfSrc()[0].equals(nextItem.getQpfSrc()[0]))
|
||||
&& (thisItem.getGuidSrc().length > 0 && nextItem.getGuidSrc().length > 0 && thisItem.getGuidSrc()[0].equals(nextItem.getGuidSrc()[0]))) {
|
||||
|
||||
duplicateLst.add(i + 1);
|
||||
duplicateLst.add(j + 1);
|
||||
}
|
||||
|
@ -295,8 +298,14 @@ public class FFTIControlDlg extends Dialog {
|
|||
HashSet<Integer> duplicates = getDuplicates();
|
||||
if (duplicates.size() > 0) {
|
||||
String setsStr = "";
|
||||
for (Integer setIndex : duplicates)
|
||||
setsStr += setIndex + "/";
|
||||
int i = 0;
|
||||
for (Integer setIndex : duplicates) {
|
||||
setsStr += setIndex;
|
||||
if (i != duplicates.size()-1) {
|
||||
setsStr = setsStr + "/";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
MessageBox messageBox = new MessageBox(shell, SWT.OK);
|
||||
messageBox.setText("Warning: Duplicate Setting(s)!");
|
||||
messageBox
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package com.raytheon.uf.viz.monitor.ffmp.ffti;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -45,6 +46,17 @@ import com.raytheon.uf.common.monitor.xml.ProductRunXML;
|
|||
import com.raytheon.uf.common.monitor.xml.ProductXML;
|
||||
import com.raytheon.uf.common.monitor.xml.SourceXML;
|
||||
|
||||
/**
|
||||
* FFTI Setting Composite.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 08/07/2012 578 mpduff FFTI now only a single selection and populates
|
||||
* correctly.
|
||||
* </pre>
|
||||
*/
|
||||
public class SettingComp extends Composite implements DurationInterface {
|
||||
/**
|
||||
* Parent tab folder.
|
||||
|
@ -102,6 +114,8 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
|
||||
// temporary storage for qpf
|
||||
private String selectedQpfVal = "0";
|
||||
|
||||
private FFTISettingXML fftiSetting;
|
||||
|
||||
public SettingComp(TabFolder parent) {
|
||||
super(parent, 0);
|
||||
|
@ -115,7 +129,8 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
super(parent, 0);
|
||||
|
||||
this.parent = parent;
|
||||
|
||||
this.fftiSetting = fftiSetting;
|
||||
|
||||
init();
|
||||
|
||||
// set the attributes
|
||||
|
@ -217,6 +232,8 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
|
||||
accumRdo.setEnabled(true);
|
||||
accumAction(accumAttrib);
|
||||
|
||||
setSettings();
|
||||
}
|
||||
|
||||
private void createAttributeControls() {
|
||||
|
@ -318,7 +335,7 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
gd.widthHint = listWidth;
|
||||
gd.heightHint = listHeight;
|
||||
qpeList = new List(precipSrcComp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
|
||||
qpeList = new List(precipSrcComp, SWT.BORDER | SWT.V_SCROLL);
|
||||
qpeList.setLayoutData(gd);
|
||||
fillQpeList();
|
||||
|
||||
|
@ -327,8 +344,7 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
gd.horizontalSpan = 2;
|
||||
gd.widthHint = listWidth - 75;
|
||||
gd.heightHint = listHeight;
|
||||
guidList = new List(precipSrcComp, SWT.BORDER | SWT.MULTI
|
||||
| SWT.V_SCROLL);
|
||||
guidList = new List(precipSrcComp, SWT.BORDER | SWT.V_SCROLL);
|
||||
guidList.setLayoutData(gd);
|
||||
fillGuidList();
|
||||
|
||||
|
@ -337,7 +353,7 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
gd.horizontalSpan = 2;
|
||||
gd.widthHint = listWidth;
|
||||
gd.heightHint = listHeight;
|
||||
qpfList = new List(precipSrcComp, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
|
||||
qpfList = new List(precipSrcComp, SWT.BORDER | SWT.V_SCROLL);
|
||||
qpfList.setLayoutData(gd);
|
||||
fillQpfList();
|
||||
|
||||
|
@ -393,9 +409,6 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
guidSet.add(sourceName);
|
||||
guidList.add(sourceName);
|
||||
}
|
||||
if (guidList.getItemCount() > 0) {
|
||||
guidList.setSelection(0);
|
||||
}
|
||||
|
||||
guidList.addSelectionListener(new SelectionListener() {
|
||||
|
||||
|
@ -438,9 +451,10 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
|
||||
if (source.isMosaic()) {
|
||||
if (!qpeSet.contains(product.getProductKey())) {
|
||||
if (!qpeSet.contains(source.getDisplayName())) {
|
||||
qpeSet.add(source.getDisplayName());
|
||||
qpeList.add(source.getDisplayName());
|
||||
String displayName = source.getDisplayName();
|
||||
if (!qpeSet.contains(displayName)) {
|
||||
qpeSet.add(displayName);
|
||||
qpeList.add(displayName);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -460,10 +474,6 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (qpeList.getItemCount() > 0) {
|
||||
qpeList.setSelection(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -516,10 +526,6 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (qpfList.getItemCount() > 0) {
|
||||
qpfList.setSelection(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -598,6 +604,55 @@ public class SettingComp extends Composite implements DurationInterface {
|
|||
SWT.COLOR_WHITE));
|
||||
attrLbl.setLayoutData(gd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the dialog to reflect the saved configuration.
|
||||
*/
|
||||
private void setSettings() {
|
||||
// Select the configured items, otherwise select the first
|
||||
|
||||
if (this.fftiSetting != null) {
|
||||
// QPE
|
||||
if (fftiSetting.getQpeSource().getDisplayNameList() == null ||
|
||||
fftiSetting.getQpeSource().getDisplayNameList().isEmpty()) {
|
||||
qpeList.setSelection(0);
|
||||
} else {
|
||||
// Only using the first one in the list to match A1
|
||||
java.util.List<String> items = Arrays.asList(qpeList.getItems());
|
||||
String name = fftiSetting.getQpeSource().getDisplayNameList().get(0);
|
||||
int idx = items.indexOf(name);
|
||||
qpeList.select(idx);
|
||||
qpeList.showSelection();
|
||||
}
|
||||
|
||||
// GUID
|
||||
if (fftiSetting.getGuidSource().getDisplayNameList() == null ||
|
||||
fftiSetting.getGuidSource().getDisplayNameList().isEmpty()) {
|
||||
guidList.setSelection(0);
|
||||
} else {
|
||||
// Only using the first one in the list to match A1
|
||||
java.util.List<String> items = Arrays.asList(guidList.getItems());
|
||||
String name = fftiSetting.getGuidSource().getDisplayNameList().get(0);
|
||||
int idx = items.indexOf(name);
|
||||
guidList.select(idx);
|
||||
guidList.showSelection();
|
||||
}
|
||||
|
||||
// QPF
|
||||
if (fftiSetting.getQpfSource().getDisplayNameList() == null ||
|
||||
fftiSetting.getQpfSource().getDisplayNameList().isEmpty()) {
|
||||
qpfList.setSelection(0);
|
||||
} else {
|
||||
// Only using the first one in the list to match A1
|
||||
java.util.List<String> items = Arrays.asList(qpfList.getItems());
|
||||
String name = fftiSetting.getQpfSource().getDisplayNameList().get(0);
|
||||
int idx = items.indexOf(name);
|
||||
qpfList.select(idx);
|
||||
qpfList.showSelection();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void accumAction(FFTIAttribute attribVal) {
|
||||
// change attribute values
|
||||
|
|
|
@ -45,6 +45,22 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData.COLUMN_NA
|
|||
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
|
||||
|
||||
/**
|
||||
* FFMP GUI Config Object.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 01, 2012 14168 mpduff Add convenience methods for
|
||||
* getting ColorCell and ReverseFilter
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public class FFMPConfig {
|
||||
private static FFMPConfig classInstance = new FFMPConfig();
|
||||
|
||||
|
@ -97,9 +113,9 @@ public class FFMPConfig {
|
|||
private HashMap<ThreshColNames, ThresholdManager> threshMgrMap;
|
||||
|
||||
private HashMap<String, ThreshColNames> thresholdLookup;
|
||||
|
||||
|
||||
private AttributesDlgData attrData = null;
|
||||
|
||||
|
||||
private boolean reReadAttrData = false;
|
||||
|
||||
private FFMPConfig() {
|
||||
|
@ -357,7 +373,7 @@ public class FFMPConfig {
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public void createAttributesDlgData(String siteKey) {
|
||||
ArrayList<FFMPTableColumnXML> columnData = ffmpCfgBasin
|
||||
.getTableColumnData();
|
||||
|
@ -371,7 +387,7 @@ public class FFMPConfig {
|
|||
for (int i = 0; i < columns.length; i++) {
|
||||
String column = columns[i];
|
||||
String displayName = null;
|
||||
|
||||
|
||||
for (FFMPTableColumnXML tcXML : columnData) {
|
||||
if (column.contains("_")) {
|
||||
String[] parts = column.split("_");
|
||||
|
@ -380,10 +396,14 @@ public class FFMPConfig {
|
|||
}
|
||||
if (column.equalsIgnoreCase(tcXML.getColumnName())) {
|
||||
boolean includedInTable = false;
|
||||
if (column.equalsIgnoreCase(COLUMN_NAME.GUID.getColumnName()) ||
|
||||
column.equalsIgnoreCase(COLUMN_NAME.RATIO.getColumnName()) ||
|
||||
column.equalsIgnoreCase(COLUMN_NAME.DIFF.getColumnName())) {
|
||||
if (ffmpCfgBasin.getIncludedGuids().contains(displayName)) {
|
||||
if (column.equalsIgnoreCase(COLUMN_NAME.GUID
|
||||
.getColumnName())
|
||||
|| column.equalsIgnoreCase(COLUMN_NAME.RATIO
|
||||
.getColumnName())
|
||||
|| column.equalsIgnoreCase(COLUMN_NAME.DIFF
|
||||
.getColumnName())) {
|
||||
if (ffmpCfgBasin.getIncludedGuids().contains(
|
||||
displayName)) {
|
||||
includedInTable = true;
|
||||
attrData.setGuidColumnIncluded(displayName,
|
||||
includedInTable);
|
||||
|
@ -397,8 +417,9 @@ public class FFMPConfig {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AttributesDlgData getVisibleColumns(String siteKey, boolean reReadAttrData) {
|
||||
|
||||
public AttributesDlgData getVisibleColumns(String siteKey,
|
||||
boolean reReadAttrData) {
|
||||
this.reReadAttrData = reReadAttrData;
|
||||
return getVisibleColumns(siteKey);
|
||||
}
|
||||
|
@ -413,33 +434,46 @@ public class FFMPConfig {
|
|||
|
||||
public void setVisibleColumns(AttributesDlgData attrData) {
|
||||
this.attrData = attrData;
|
||||
|
||||
|
||||
ArrayList<FFMPTableColumnXML> columnData = ffmpCfgBasin
|
||||
.getTableColumnData();
|
||||
|
||||
|
||||
for (FFMPTableColumnXML tcXML : columnData) {
|
||||
if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.RATE.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.RATE.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.NAME.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.NAME.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.QPE.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.QPE.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.QPF.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.QPF.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.GUID.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.GUID.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.RATIO.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.RATIO.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(COLUMN_NAME.DIFF.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData.isColumnVisible(COLUMN_NAME.DIFF.getColumnName()));
|
||||
if (tcXML.getColumnName().equalsIgnoreCase(
|
||||
COLUMN_NAME.RATE.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData
|
||||
.isColumnVisible(COLUMN_NAME.RATE.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(
|
||||
COLUMN_NAME.NAME.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData
|
||||
.isColumnVisible(COLUMN_NAME.NAME.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(
|
||||
COLUMN_NAME.QPE.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData
|
||||
.isColumnVisible(COLUMN_NAME.QPE.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(
|
||||
COLUMN_NAME.QPF.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData
|
||||
.isColumnVisible(COLUMN_NAME.QPF.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(
|
||||
COLUMN_NAME.GUID.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData
|
||||
.isColumnVisible(COLUMN_NAME.GUID.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(
|
||||
COLUMN_NAME.RATIO.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData
|
||||
.isColumnVisible(COLUMN_NAME.RATIO.getColumnName()));
|
||||
} else if (tcXML.getColumnName().equalsIgnoreCase(
|
||||
COLUMN_NAME.DIFF.getColumnName())) {
|
||||
tcXML.setDisplayedInTable(attrData
|
||||
.isColumnVisible(COLUMN_NAME.DIFF.getColumnName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HashMap<String, Boolean> guidanceMap = attrData.getGuidanceList();
|
||||
String list = "";
|
||||
boolean first = true;
|
||||
for (String key: guidanceMap.keySet()) {
|
||||
for (String key : guidanceMap.keySet()) {
|
||||
if (first == false) {
|
||||
list.concat(",");
|
||||
}
|
||||
|
@ -496,7 +530,8 @@ public class FFMPConfig {
|
|||
* starts. If the column is not visible then default the sort column to be
|
||||
* the name column.
|
||||
*
|
||||
* @param siteKey The siteKey being used
|
||||
* @param siteKey
|
||||
* The siteKey being used
|
||||
* @return Column index.
|
||||
*/
|
||||
public int getStartSortIndex(String siteKey) {
|
||||
|
@ -506,7 +541,7 @@ public class FFMPConfig {
|
|||
FfmpTableConfig tableCfg = FfmpTableConfig.getInstance();
|
||||
FFMPSourceConfigurationManager sourceConfigManager = FFMPSourceConfigurationManager
|
||||
.getInstance();
|
||||
|
||||
|
||||
FFMPRunXML runner = configManager.getRunner(monitor.getWfo());
|
||||
ProductRunXML prodRunXml = runner.getProduct(siteKey);
|
||||
String name = prodRunXml.getProductName();
|
||||
|
@ -514,7 +549,7 @@ public class FFMPConfig {
|
|||
ProductXML productXml = sourceConfigManager.getProduct(name);
|
||||
|
||||
ArrayList<String> guidTypes = productXml.getAvailableGuidanceTypes();
|
||||
|
||||
|
||||
String guidRankSource = null;
|
||||
if (guidTypes.size() > 1) {
|
||||
String colSorted = ffmpCfgBasin.getColumnSorted();
|
||||
|
@ -523,7 +558,7 @@ public class FFMPConfig {
|
|||
guidRankSource = parts[1];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FfmpTableConfigData tableCfgData = tableCfg.getTableConfigData(siteKey);
|
||||
String[] tableColumns = tableCfgData.getTableColumnKeys();
|
||||
String sortedColName = ffmpCfgBasin.getColumnSorted();
|
||||
|
@ -539,7 +574,7 @@ public class FFMPConfig {
|
|||
column = parts[1];
|
||||
guidType = parts[0];
|
||||
}
|
||||
|
||||
|
||||
if (column.equalsIgnoreCase(sortedColName)) {
|
||||
if ((guidType != null) && (guidRankSource != null)) {
|
||||
if (guidType.equalsIgnoreCase(guidRankSource)) {
|
||||
|
@ -554,7 +589,7 @@ public class FFMPConfig {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -562,10 +597,16 @@ public class FFMPConfig {
|
|||
if (columnName.contains("_")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the filter value for this column.
|
||||
*
|
||||
* @param threshColName
|
||||
* @return The filter value
|
||||
*/
|
||||
public double getFilterValue(ThreshColNames threshColName) {
|
||||
ArrayList<FFMPTableColumnXML> columnData = ffmpCfgBasin
|
||||
.getTableColumnData();
|
||||
|
@ -575,6 +616,36 @@ public class FFMPConfig {
|
|||
return data.getFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ColorCell value for this column.
|
||||
*
|
||||
* @param threshColName
|
||||
* @return The ColorCell value
|
||||
*/
|
||||
public boolean isColorCell(ThreshColNames threshColName) {
|
||||
ArrayList<FFMPTableColumnXML> columnData = ffmpCfgBasin
|
||||
.getTableColumnData();
|
||||
|
||||
FFMPTableColumnXML data = columnData.get(threshColName.getColIndex());
|
||||
|
||||
return data.getColorCell();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the reverse filter value for this column.
|
||||
*
|
||||
* @param threshColName
|
||||
* @return The Reverse Filter value
|
||||
*/
|
||||
public boolean isReverseFilter(ThreshColNames threshColName) {
|
||||
ArrayList<FFMPTableColumnXML> columnData = ffmpCfgBasin
|
||||
.getTableColumnData();
|
||||
|
||||
FFMPTableColumnXML data = columnData.get(threshColName.getColIndex());
|
||||
|
||||
return data.getReverseFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attrData
|
||||
*/
|
||||
|
@ -583,7 +654,8 @@ public class FFMPConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param attrData the attrData to set
|
||||
* @param attrData
|
||||
* the attrData to set
|
||||
*/
|
||||
public void setAttrData(AttributesDlgData attrData) {
|
||||
this.attrData = attrData;
|
||||
|
@ -597,12 +669,13 @@ public class FFMPConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param reReadAttrData the reReadAttrData to set
|
||||
* @param reReadAttrData
|
||||
* the reReadAttrData to set
|
||||
*/
|
||||
public void setReReadAttrData(boolean reReadAttrData) {
|
||||
this.reReadAttrData = reReadAttrData;
|
||||
}
|
||||
|
||||
|
||||
public String getIncludedGuids() {
|
||||
return ffmpCfgBasin.getIncludedGuids();
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.raytheon.uf.common.monitor.data.CommonConfig;
|
|||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig.ThreshColNames;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData.COLUMN_NAME;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
|
||||
|
||||
/**
|
||||
|
@ -67,17 +68,24 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
|
|||
* Apr 7, 2009 lvenable Initial creation
|
||||
* Mar 15,2012 DR 14406 gzhang Fixing QPF Column Title Missing
|
||||
* Mar 20,2012 DR 14250 gzhang Eliminating column Missing values
|
||||
* Aug 01, 2012 14168 mpduff Only allow filtering if ColorCell is true
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class FFMPTable extends Composite {
|
||||
/** Default column width */
|
||||
protected static final int DEFAULT_COLUMN_WIDTH = 95;//DR14406: old value: 75 too small
|
||||
protected static final int DEFAULT_COLUMN_WIDTH = 95;// DR14406: old value:
|
||||
// 75 too small
|
||||
|
||||
/** DR14406: For columns with more words */
|
||||
/** DR14406: For columns with more words */
|
||||
protected static final int EXTRA_COLUMN_WIDTH = 28;
|
||||
|
||||
private static final String NAME = "Name";
|
||||
|
||||
protected String currentPfaf = null;
|
||||
|
||||
/**
|
||||
* Main table control.
|
||||
*/
|
||||
|
@ -325,6 +333,9 @@ public abstract class FFMPTable extends Composite {
|
|||
cols[j].setWidth(defaultColWidth);
|
||||
}
|
||||
|
||||
// reset the tableIndex
|
||||
tableIndex = -1;
|
||||
|
||||
/*
|
||||
* Check of the column is sortable.
|
||||
*/
|
||||
|
@ -372,20 +383,41 @@ public abstract class FFMPTable extends Composite {
|
|||
int sortColIndex = table.indexOf(sortedTableColumn);
|
||||
boolean isAFilterCol = false;
|
||||
ThreshColNames sortedThreshCol = null;
|
||||
boolean reverseFilter = false;
|
||||
double filterNum = Double.NaN;
|
||||
|
||||
String columnName = getColumnKeys()[sortColIndex];
|
||||
// Check if the sorted column is a column that will contain a filter.
|
||||
if (!columnName.equalsIgnoreCase("NAME")) {
|
||||
isAFilterCol = true;
|
||||
String sortedColumnName = getColumnKeys()[sortColIndex];
|
||||
|
||||
FFMPConfigBasinXML ffmpCfgBasin = FFMPConfig.getInstance()
|
||||
.getFFMPConfigData();
|
||||
|
||||
ArrayList<FFMPTableColumnXML> ffmpTableCols = ffmpCfgBasin
|
||||
.getTableColumnData();
|
||||
|
||||
if (!sortedColumnName.equalsIgnoreCase(NAME)) {
|
||||
for (ThreshColNames threshColName : ThreshColNames.values()) {
|
||||
if (columnName.contains(threshColName.name())) {
|
||||
if (sortedColumnName.contains(threshColName.name())) {
|
||||
sortedThreshCol = threshColName;
|
||||
filterNum = ffmpConfig.getFilterValue(threshColName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the sorted column is a column that will contain a filter.
|
||||
// Check the gui config to see if colorCell is true. If false then do
|
||||
// not apply filter
|
||||
for (FFMPTableColumnXML xml : ffmpTableCols) {
|
||||
if (xml.getColumnName().contains(sortedThreshCol.name())) {
|
||||
if (ffmpConfig.isColorCell(sortedThreshCol)) {
|
||||
// Only filter if colorCell is true
|
||||
isAFilterCol = true;
|
||||
filterNum = ffmpConfig.getFilterValue(sortedThreshCol);
|
||||
reverseFilter = ffmpConfig.isReverseFilter(sortedThreshCol);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
table.removeAll();
|
||||
|
||||
if (tableData == null) {
|
||||
|
@ -409,51 +441,36 @@ public abstract class FFMPTable extends Composite {
|
|||
extent.x);
|
||||
|
||||
/*
|
||||
* Check if the sorted column is a filter column.
|
||||
* Check if the data value is Not A Number.
|
||||
*/
|
||||
if (isAFilterCol == true) {
|
||||
/*
|
||||
* Check if the data value is Not A Number.
|
||||
*/
|
||||
float dataVal = cellData[sortColIndex]
|
||||
.getValueAsFloat();
|
||||
//DR 14250 fix: any value not a number will be omitted
|
||||
if (/*sortedThreshCol.name().equalsIgnoreCase("RATIO") &&*/ Float.isNaN(dataVal)) {
|
||||
if (!sortedColumnName.equalsIgnoreCase(NAME)) {
|
||||
float dataVal = cellData[sortColIndex].getValueAsFloat();
|
||||
|
||||
// DR 14250 fix: any value not a number will be omitted
|
||||
if (Float.isNaN(dataVal)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// if (sortedThreshCol.name().equalsIgnoreCase("RATIO") == false) {
|
||||
|
||||
// If the data value is less/more than the filter value
|
||||
// continue
|
||||
// so we don't put the data in the table. Less for normal
|
||||
// filtering,
|
||||
// more for reverse filtering
|
||||
ArrayList<FFMPTableColumnXML> tcList = ffmpConfig
|
||||
.getFFMPConfigData().getTableColumnData();
|
||||
boolean reverseFilter = false;
|
||||
for (FFMPTableColumnXML tc : tcList) {
|
||||
if (tc.getColumnName().equalsIgnoreCase(
|
||||
sortedThreshCol.name())) {
|
||||
reverseFilter = tc.getReverseFilter();
|
||||
break;
|
||||
|
||||
if (isAFilterCol) {
|
||||
if (reverseFilter) {
|
||||
if (dataVal > filterNum) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (dataVal < filterNum) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
if (reverseFilter) {
|
||||
if (dataVal > filterNum) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
if (dataVal < filterNum) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
indexArray.add(t);
|
||||
|
||||
// Check to see if this is the selected row
|
||||
if (rowData.getPfaf().equals(currentPfaf)) {
|
||||
tableIndex = indexArray.indexOf(t);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* VIRTUAL TABLE
|
||||
*
|
||||
|
@ -597,6 +614,10 @@ public abstract class FFMPTable extends Composite {
|
|||
* Table column to sort.
|
||||
*/
|
||||
private void sortTableData(TableColumn tc) {
|
||||
if (tableData == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String sortCol = (String) tc.getData();
|
||||
|
||||
int sortDir = getColumnAttributeData(sortCol).getSortDir();
|
||||
|
@ -657,7 +678,10 @@ public abstract class FFMPTable extends Composite {
|
|||
}
|
||||
}
|
||||
|
||||
imageWidth = maxTextLength * textWidth + EXTRA_COLUMN_WIDTH;//DR14406: old value 6 too small
|
||||
imageWidth = maxTextLength * textWidth + EXTRA_COLUMN_WIDTH;// DR14406:
|
||||
// old value
|
||||
// 6 too
|
||||
// small
|
||||
imageHeight = textHeight * 2;
|
||||
|
||||
gc.dispose();
|
||||
|
@ -712,25 +736,34 @@ public abstract class FFMPTable extends Composite {
|
|||
String[] tmpArray = colName.split("\n");
|
||||
|
||||
for (int j = 0; j < tmpArray.length; j++) {
|
||||
// if (tmpArray[j].length() > maxTextLen) {
|
||||
// maxTextLen = tmpArray[j].length();
|
||||
// }
|
||||
// }
|
||||
// if (tmpArray[j].length() > maxTextLen) {
|
||||
// maxTextLen = tmpArray[j].length();
|
||||
// }
|
||||
// }
|
||||
|
||||
xCoord = Math.round((imageWidth / 2)- (tmpArray[j].length() /*DR14406: old value: maxTextLen*/* textWidth / 2));
|
||||
yCoord = j*(textHeight+1);//DR14406: old value 0 is only for the 1st line
|
||||
gc.drawText(tmpArray[j], xCoord, yCoord, true);//DR14406: draw each line separately
|
||||
xCoord = Math.round((imageWidth / 2)
|
||||
- (tmpArray[j].length() /*
|
||||
* DR14406: old value:
|
||||
* maxTextLen
|
||||
*/* textWidth / 2));
|
||||
yCoord = j * (textHeight + 1);// DR14406: old value 0 is
|
||||
// only for the 1st line
|
||||
gc.drawText(tmpArray[j], xCoord, yCoord, true);// DR14406:
|
||||
// draw each
|
||||
// line
|
||||
// separately
|
||||
}
|
||||
} else {
|
||||
xCoord = Math.round((imageWidth / 2)
|
||||
- (colName.length() * textWidth / 2));
|
||||
yCoord = imageHeight / 2 - textHeight / 2 - 1;
|
||||
gc.drawText(colName, xCoord, yCoord, true);//DR14406: draw text with a single line
|
||||
gc.drawText(colName, xCoord, yCoord, true);// DR14406: draw text
|
||||
// with a single line
|
||||
}
|
||||
|
||||
// System.out.println("Column name = " + colName);
|
||||
//DR14406: move the below text drawing code into the if-else blocks
|
||||
//gc.drawText(colName, xCoord, yCoord, true);
|
||||
// System.out.println("Column name = " + colName);
|
||||
// DR14406: move the below text drawing code into the if-else blocks
|
||||
// gc.drawText(colName, xCoord, yCoord, true);
|
||||
|
||||
gc.dispose();
|
||||
tc.setImage(img);
|
||||
|
@ -784,9 +817,10 @@ public abstract class FFMPTable extends Composite {
|
|||
tCols[i].setWidth(table.getColumn(i).getWidth());
|
||||
} else {
|
||||
tCols[i].setWidth(defaultColWidth);
|
||||
}
|
||||
|
||||
setQPFColName(tCols[i], col);//DR14406: set QPF title with quicker response
|
||||
}
|
||||
|
||||
setQPFColName(tCols[i], col);// DR14406: set QPF title with
|
||||
// quicker response
|
||||
} else {
|
||||
tCols[i].setWidth(0);
|
||||
}
|
||||
|
@ -866,27 +900,24 @@ public abstract class FFMPTable extends Composite {
|
|||
*/
|
||||
protected abstract int getColumnIndex(String sortCol);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* DR14406 code: QPF column's name should be re-set
|
||||
* when a user choose another type of QPF from the
|
||||
* Attributes... button.
|
||||
* DR14406 code: QPF column's name should be re-set when a user choose
|
||||
* another type of QPF from the Attributes... button.
|
||||
*
|
||||
* See FfmpTableConfigData.setQpfType() with ColumnAttribData
|
||||
*
|
||||
* @param tCols: TableColumn
|
||||
* @param col: Column name
|
||||
* @param tCols
|
||||
* : TableColumn
|
||||
* @param col
|
||||
* : Column name
|
||||
*/
|
||||
private void setQPFColName(TableColumn tCols, String col){
|
||||
|
||||
if(COLUMN_NAME.QPF.getColumnName().equalsIgnoreCase(col)){
|
||||
|
||||
setColumnImages();
|
||||
tCols.setWidth(defaultColWidth+EXTRA_COLUMN_WIDTH);//38);
|
||||
|
||||
}
|
||||
private void setQPFColName(TableColumn tCols, String col) {
|
||||
|
||||
if (COLUMN_NAME.QPF.getColumnName().equalsIgnoreCase(col)) {
|
||||
|
||||
setColumnImages();
|
||||
tCols.setWidth(defaultColWidth + EXTRA_COLUMN_WIDTH);// 38);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,8 +33,6 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig.ThreshColNames;
|
|||
public class FFMPTableComp extends FFMPTable {
|
||||
private FfmpTableConfig tableConfig;
|
||||
|
||||
private String currentPfaf = null;
|
||||
|
||||
/**
|
||||
* Table selection callback.
|
||||
*/
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.text.SimpleDateFormat;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -83,6 +84,8 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPLoaderStatus;
|
|||
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPResource;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataLoader;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPTableDataUpdate;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
|
||||
import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
|
@ -95,6 +98,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 30, 2009 lvenable Initial creation
|
||||
* Jul 31, 2012 14517 mpduff Fix map blanking on updates and table updates
|
||||
* for rapid slider changes.
|
||||
* Aug 01, 2012 14168 mpduff Only allow items into the Thresholds menu if
|
||||
* ColorCell is true.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -108,6 +115,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FfmpBasinTableDlg.class);
|
||||
|
||||
private List<FFMPTableDataLoader> retrievalQueue = new ArrayList<FFMPTableDataLoader>();
|
||||
|
||||
private MenuItem linkToFrameMI;
|
||||
|
||||
private MenuItem worstCaseMI;
|
||||
|
@ -216,8 +225,10 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
|
||||
private Composite tableComp;
|
||||
|
||||
private Thread dataRetrieveThread = null;
|
||||
|
||||
private FFMPTableDataLoader dataRetrieveThread = null;
|
||||
|
||||
private boolean groupLabelFlag = true;
|
||||
|
||||
public FfmpBasinTableDlg(Shell parent, FFMPTableData tData,
|
||||
FFMPResource resource) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL
|
||||
|
@ -491,10 +502,11 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
mi.setSelection(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
sourceMenuItems.get(0).setSelection(true);
|
||||
ffmpConfig.getFFMPConfigData().setGuidSrc(sourceMenuItems.get(0).getText());
|
||||
ffmpConfig.getFFMPConfigData().setGuidSrc(
|
||||
sourceMenuItems.get(0).getText());
|
||||
}
|
||||
|
||||
fireFieldChangedEvent(FFMPRecord.FIELDS.RATIO, false);
|
||||
|
@ -556,7 +568,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
for (int i = 0; i < sourceMenuItems.size(); i++) {
|
||||
String rdo = sourceMenuItems.get(i).getText();
|
||||
if (rdo.equals(guidSrc)) {
|
||||
ffmpConfig.getFFMPConfigData().setGuidSrc(guidSrc);
|
||||
ffmpConfig.getFFMPConfigData().setGuidSrc(
|
||||
guidSrc);
|
||||
fireConfigUpdateEvent();
|
||||
break;
|
||||
}
|
||||
|
@ -1018,18 +1031,21 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
|
||||
// Loop over enum from config singleton to create menu items
|
||||
for (ThreshColNames colName : ThreshColNames.values()) {
|
||||
MenuItem mi = new MenuItem(popupMenu, SWT.NONE);
|
||||
mi.setText(colName.name());
|
||||
mi.setData(colName);
|
||||
mi.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
MenuItem mi = (MenuItem) e.getSource();
|
||||
ThreshColNames colName = (ThreshColNames) mi.getData();
|
||||
if (ffmpConfig.isColorCell(colName)) {
|
||||
// only add a menu item if colorCell is true
|
||||
MenuItem mi = new MenuItem(popupMenu, SWT.NONE);
|
||||
mi.setText(colName.name());
|
||||
mi.setData(colName);
|
||||
mi.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
MenuItem mi = (MenuItem) e.getSource();
|
||||
ThreshColNames colName = (ThreshColNames) mi.getData();
|
||||
|
||||
displayThresholdsDialog(colName);
|
||||
}
|
||||
});
|
||||
displayThresholdsDialog(colName);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Set the pop-up menu as the pop-up for the shell
|
||||
|
@ -1184,6 +1200,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
@Override
|
||||
public void timeDurationUpdated(double val, boolean split) {
|
||||
shell.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
|
||||
|
||||
updateTimeDurationLabel(val, split);
|
||||
if (dialogInitialized) {
|
||||
fireTimeChangedEvent(val, split, false);
|
||||
|
@ -1261,27 +1278,27 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
this.ffmpConfig.setAttrData(attrData);
|
||||
this.ffmpTable.showHideTableColumns();
|
||||
boolean changeSplit = false;
|
||||
|
||||
|
||||
if (timeDurScale.split != ffmpConfig.isSplit()) {
|
||||
changeSplit = true;
|
||||
changeSplit = true;
|
||||
}
|
||||
|
||||
timeDurScale.setSplit(ffmpConfig.isSplit());
|
||||
updateTimeDurationLabel(timeDurScale.getSelectedHoursValue(),
|
||||
ffmpConfig.isSplit());
|
||||
|
||||
if (updateData) {
|
||||
if (updateData) {
|
||||
|
||||
if (changeSplit) {
|
||||
fireTimeChangedEvent(timeDurScale.getSelectedHoursValue(),
|
||||
ffmpConfig.isSplit(), true);
|
||||
}
|
||||
resource.clearTables();
|
||||
resource.getDrawable(resource.getPaintTime()).setDirty(true);
|
||||
FFMPMonitor.getInstance().fireMonitorEvent(
|
||||
this.getClass().getName());
|
||||
if (changeSplit) {
|
||||
fireTimeChangedEvent(timeDurScale.getSelectedHoursValue(),
|
||||
ffmpConfig.isSplit(), true);
|
||||
}
|
||||
resource.clearTables();
|
||||
resource.getDrawable(resource.getPaintTime()).setDirty(true);
|
||||
FFMPMonitor.getInstance().fireMonitorEvent(
|
||||
this.getClass().getName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ffmpTable.calculateTableSize();
|
||||
shell.pack();
|
||||
|
@ -1324,7 +1341,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
ffmpListeners.remove(fl);
|
||||
}
|
||||
|
||||
public void fireTimeChangedEvent(double newTime, boolean split, boolean override) {
|
||||
public void fireTimeChangedEvent(double newTime, boolean split,
|
||||
boolean override) {
|
||||
|
||||
FFMPRecord.FIELDS field = FFMPRecord.FIELDS.QPE;
|
||||
|
||||
|
@ -1414,9 +1432,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
if (!selected) {
|
||||
cwas.remove(cwa);
|
||||
} else {
|
||||
if (!cwas.contains(cwa)) {
|
||||
cwas.add(cwa);
|
||||
}
|
||||
if (!cwas.contains(cwa)) {
|
||||
cwas.add(cwa);
|
||||
}
|
||||
}
|
||||
|
||||
FFMPCWAChangeEvent fcce = new FFMPCWAChangeEvent(cwas);
|
||||
|
@ -1628,7 +1646,6 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
@Override
|
||||
public void run() {
|
||||
// Must be a full 11 digit pfaf in order to display the graph.
|
||||
System.out.println(pfaf);
|
||||
if ((pfaf.length() < 11) && pfaf.matches("\\d+")) {
|
||||
resetCursor();
|
||||
return;
|
||||
|
@ -1653,28 +1670,31 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
* @param tData
|
||||
*/
|
||||
public void resetData(FFMPTableData tData) {
|
||||
|
||||
if (!ffmpTable.isDisposed()) {
|
||||
this.mainTableData = tData;
|
||||
//System.out.println("---" + tData.getTableRows().size());
|
||||
// System.out.println("---" + tData.getTableRows().size());
|
||||
ffmpTable.clearTableSelection();
|
||||
//long time = System.currentTimeMillis();
|
||||
// long time = System.currentTimeMillis();
|
||||
ffmpTable
|
||||
.setCenteredAggregationKey(resource.centeredAggregationKey);
|
||||
ffmpTable.setTableData(mainTableData);
|
||||
//long time1 = System.currentTimeMillis();
|
||||
// long time1 = System.currentTimeMillis();
|
||||
|
||||
resetCursor();
|
||||
shell.pack();
|
||||
shell.redraw();
|
||||
|
||||
//System.out
|
||||
// .println("Time to load Data into table " + (time1 - time));
|
||||
// System.out
|
||||
// .println("Time to load Data into table " + (time1 - time));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tableSelection(String pfaf, String name) {
|
||||
if (groupLbl.getText().length() > 0) {
|
||||
groupLabelFlag = false;
|
||||
}
|
||||
|
||||
if ((groupLbl.getText().length() == 0)
|
||||
|| allOnlySmallBasinsMI.getSelection()) {
|
||||
groupLbl.setText(name);
|
||||
|
@ -1766,7 +1786,8 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
timeDurScale.setTimeDurationAndUpdate(ffmpConfig.getFFMPConfigData()
|
||||
.getTimeFrame());
|
||||
fireTimeChangedEvent(ffmpConfig.getFFMPConfigData().getTimeFrame(), false, false);
|
||||
fireTimeChangedEvent(ffmpConfig.getFFMPConfigData().getTimeFrame(),
|
||||
false, false);
|
||||
|
||||
/*
|
||||
* Layer
|
||||
|
@ -1837,7 +1858,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
fireAutoRefreshEvent(false);
|
||||
|
||||
|
||||
/*
|
||||
* CWAs
|
||||
*
|
||||
|
@ -1989,7 +2010,6 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
// System.out.println("Status message...");
|
||||
|
||||
if (gd.exclude == true) {
|
||||
System.out.println("Showing data load comp");
|
||||
((GridData) dataLoadComp.getLayoutData()).exclude = false;
|
||||
dataLoadComp.setVisible(true);
|
||||
shell.pack();
|
||||
|
@ -2028,13 +2048,30 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
FFMPTableDataLoader tableLoader = new FFMPTableDataLoader(me,
|
||||
resource, basinTrendDlg, allowNewTableUpdate, sourceUpdate,
|
||||
date, this);
|
||||
if (dataRetrieveThread != null) {
|
||||
dataRetrieveThread.interrupt();
|
||||
dataRetrieveThread = null;
|
||||
}
|
||||
|
||||
dataRetrieveThread = new Thread(tableLoader);
|
||||
dataRetrieveThread.start();
|
||||
synchronized (retrievalQueue) {
|
||||
if (dataRetrieveThread == null || dataRetrieveThread.isDone()) {
|
||||
retrievalQueue.clear();
|
||||
dataRetrieveThread = tableLoader;
|
||||
dataRetrieveThread.start();
|
||||
} else {
|
||||
retrievalQueue.add(tableLoader);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the latest TableDataLoader and clear all previous loaders
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private FFMPTableDataLoader getLoader() {
|
||||
synchronized (retrievalQueue) {
|
||||
FFMPTableDataLoader loader = retrievalQueue.get(retrievalQueue
|
||||
.size() - 1);
|
||||
retrievalQueue.clear();
|
||||
return loader;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2065,40 +2102,54 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
|
|||
public void tableDataUpdateComplete(FFMPTableDataUpdate updateData) {
|
||||
|
||||
final FFMPTableDataUpdate fupdateData = updateData;
|
||||
|
||||
|
||||
if (!this.isDisposed()) {
|
||||
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
allowNewTableUpdate = fupdateData.isAllowNewTableUpdate();
|
||||
sourceUpdate = fupdateData.isSourceUpdate();
|
||||
|
||||
if (fupdateData.getTableData() != null) {
|
||||
resetData(fupdateData.getTableData());
|
||||
}
|
||||
|
||||
if (fupdateData.isFireGraph()) {
|
||||
fireGraphDataEvent(fupdateData.getGraphPfaf(), false,
|
||||
fupdateData.getGraphTime());
|
||||
}
|
||||
|
||||
setValidTime(fupdateData.getValidTime());
|
||||
updateGapValueLabel(fupdateData.getGapValueLabel());
|
||||
|
||||
resetCursor();
|
||||
processUpdate(fupdateData);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* used to blank the group label when channging HUC
|
||||
* while in an aggregate.
|
||||
* Process the update
|
||||
*/
|
||||
private void processUpdate(FFMPTableDataUpdate fupdateData) {
|
||||
allowNewTableUpdate = fupdateData.isAllowNewTableUpdate();
|
||||
sourceUpdate = fupdateData.isSourceUpdate();
|
||||
|
||||
if (retrievalQueue.size() > 0) {
|
||||
dataRetrieveThread = getLoader();
|
||||
dataRetrieveThread.start();
|
||||
return;
|
||||
}
|
||||
|
||||
if (fupdateData.getTableData() != null && groupLabelFlag) {
|
||||
resetData(fupdateData.getTableData());
|
||||
}
|
||||
|
||||
groupLabelFlag = true;
|
||||
if (fupdateData.isFireGraph()) {
|
||||
fireGraphDataEvent(fupdateData.getGraphPfaf(), false,
|
||||
fupdateData.getGraphTime());
|
||||
}
|
||||
|
||||
setValidTime(fupdateData.getValidTime());
|
||||
updateGapValueLabel(fupdateData.getGapValueLabel());
|
||||
|
||||
resetCursor();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* used to blank the group label when channging HUC while in an aggregate.
|
||||
*/
|
||||
public void blankGroupLabel() {
|
||||
if (groupLbl != null) {
|
||||
groupLbl.setText("");
|
||||
}
|
||||
if (groupLbl != null) {
|
||||
groupLbl.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
package com.raytheon.uf.viz.monitor.ffmp.ui.listeners;
|
||||
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
|
||||
public interface IFFMPMonitorListener {
|
||||
|
||||
public void updateDialogTime(DataTime time);
|
||||
|
||||
}
|
|
@ -73,9 +73,24 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
|
|||
public class FFMPDataGenerator {
|
||||
private FfmpTableConfig tableConfig;
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FFMPDataGenerator.class);
|
||||
|
||||
private final String ALL = "ALL";
|
||||
|
||||
private final String NA = "NA";
|
||||
|
||||
private String siteKey;
|
||||
private String dataKey;
|
||||
private ProductXML product;
|
||||
private Date paintRefTime;
|
||||
private Date tableTime;
|
||||
private Object centeredAggregationKey;
|
||||
private String huc;
|
||||
private ArrayList<DomainXML> domains;
|
||||
private double sliderTime;
|
||||
private boolean isWorstCase = false;
|
||||
|
||||
FFMPConfig ffmpCfg = FFMPConfig.getInstance();
|
||||
|
||||
FFMPTemplates ft = null;
|
||||
|
@ -125,16 +140,27 @@ public class FFMPDataGenerator {
|
|||
private FfmpTableConfigData ffmpTableCfgData = null;
|
||||
|
||||
public FFMPDataGenerator(FFMPMonitor monitor, FFMPResource resource) {
|
||||
this.tableConfig = FfmpTableConfig.getInstance();
|
||||
siteKey = resource.getSiteKey();
|
||||
dataKey = resource.getDataKey();
|
||||
product = resource.getProduct();
|
||||
paintRefTime = resource.getPaintTime().getRefTime();
|
||||
tableTime = resource.getTableTime();
|
||||
centeredAggregationKey = resource.centeredAggregationKey;
|
||||
huc = resource.getHuc();
|
||||
domains = resource.getDomains();
|
||||
sliderTime = resource.getTime();
|
||||
isWorstCase = resource.isWorstCase();
|
||||
|
||||
this.tableConfig = FfmpTableConfig.getInstance();
|
||||
this.resource = resource;
|
||||
this.monitor = monitor;
|
||||
this.ft = monitor.getTemplates(resource.getSiteKey());
|
||||
this.ft = monitor.getTemplates(siteKey);
|
||||
this.primarySource = resource.getResourceData().getPrimarySourceXML();
|
||||
this.isRate = primarySource.isRate();
|
||||
this.expirationTime = primarySource.getExpirationMinutes(resource
|
||||
.getSiteKey()) * 60 * 1000;
|
||||
ffmpTableCfgData = tableConfig
|
||||
.getTableConfigData(resource.getSiteKey());
|
||||
.getTableConfigData(siteKey);
|
||||
}
|
||||
|
||||
public FFMPTableData generateFFMPData() throws Exception {
|
||||
|
@ -149,24 +175,23 @@ public class FFMPDataGenerator {
|
|||
if (field != null) {
|
||||
if (baseRec != null) {
|
||||
FFMPBasinData fbd = null;
|
||||
if (resource.centeredAggregationKey != null) {
|
||||
fbd = baseRec.getBasinData("ALL");
|
||||
if (centeredAggregationKey != null) {
|
||||
fbd = baseRec.getBasinData(ALL);
|
||||
} else {
|
||||
fbd = baseRec.getBasinData(resource.getHuc());
|
||||
fbd = baseRec.getBasinData(huc);
|
||||
}
|
||||
|
||||
if (fbd.getBasins().size() > 0) {
|
||||
if ((resource.centeredAggregationKey == null)
|
||||
|| resource.getHuc().equals("ALL")) {
|
||||
if ((centeredAggregationKey == null)
|
||||
|| huc.equals(ALL)) {
|
||||
// System.out.println(fbd.getBasins().keySet().size()
|
||||
// + " rows in the table");
|
||||
for (Long key : fbd.getBasins().keySet()) {
|
||||
if (resource.getHuc().equals("ALL")) {
|
||||
for (DomainXML domain : resource
|
||||
.getDomains()) {
|
||||
if (huc.equals(ALL)) {
|
||||
for (DomainXML domain : domains) {
|
||||
|
||||
FFMPBasinMetaData fmdb = ft.getBasin(
|
||||
resource.getSiteKey(), key);
|
||||
siteKey, key);
|
||||
|
||||
if (fmdb == null) {
|
||||
continue;
|
||||
|
@ -183,7 +208,7 @@ public class FFMPDataGenerator {
|
|||
if (virtualBasin != null) {
|
||||
for (Long id : ft
|
||||
.getVirtualGageBasinLookupIds(
|
||||
resource.getSiteKey(),
|
||||
siteKey,
|
||||
key)) {
|
||||
setFFMPRow(
|
||||
virtualBasin
|
||||
|
@ -203,13 +228,13 @@ public class FFMPDataGenerator {
|
|||
|
||||
ArrayList<Long> pfafs = ft
|
||||
.getAggregatePfafs(key,
|
||||
resource.getSiteKey(),
|
||||
resource.getHuc());
|
||||
siteKey,
|
||||
huc);
|
||||
|
||||
boolean isVGB = false;
|
||||
if (ft.checkVGBsInAggregate(key,
|
||||
resource.getSiteKey(),
|
||||
resource.getHuc())) {
|
||||
siteKey,
|
||||
huc)) {
|
||||
isVGB = true;
|
||||
}
|
||||
|
||||
|
@ -217,8 +242,8 @@ public class FFMPDataGenerator {
|
|||
|
||||
FFMPBasinMetaData fmdb = ft
|
||||
.getBasinInDomains(
|
||||
resource.getSiteKey(),
|
||||
resource.getDomains(),
|
||||
siteKey,
|
||||
domains,
|
||||
pfafs);
|
||||
|
||||
if (fmdb != null) {
|
||||
|
@ -239,11 +264,10 @@ public class FFMPDataGenerator {
|
|||
.getCenteredAggregatePfafs()) {
|
||||
|
||||
FFMPBasinMetaData fmdb = ft.getBasin(
|
||||
resource.getSiteKey(), key);
|
||||
siteKey, key);
|
||||
|
||||
if (fmdb != null) {
|
||||
for (DomainXML domain : resource
|
||||
.getDomains()) {
|
||||
for (DomainXML domain : domains) {
|
||||
|
||||
if ((domain.getCwa().equals(fmdb
|
||||
.getCwa()))
|
||||
|
@ -256,7 +280,7 @@ public class FFMPDataGenerator {
|
|||
if (virtualBasin != null) {
|
||||
for (Long id : ft
|
||||
.getVirtualGageBasinLookupIds(
|
||||
resource.getSiteKey(),
|
||||
siteKey,
|
||||
key)) {
|
||||
setFFMPRow(
|
||||
virtualBasin
|
||||
|
@ -325,17 +349,17 @@ public class FFMPDataGenerator {
|
|||
// in this special case it is actually the LID
|
||||
trd.setPfaf(((FFMPVirtualGageBasin) cBasin).getLid());
|
||||
FFMPVirtualGageBasinMetaData fvgmbd = ft
|
||||
.getVirtualGageBasinMetaData(resource.getSiteKey(),
|
||||
.getVirtualGageBasinMetaData(siteKey,
|
||||
((FFMPVirtualGageBasin) cBasin).getLid());
|
||||
FFMPBasinMetaData metabasin = ft.getBasin(
|
||||
resource.getSiteKey(), fvgmbd.getParentPfaf());
|
||||
siteKey, fvgmbd.getParentPfaf());
|
||||
Long parentBasinPfaf = fvgmbd.getParentPfaf();
|
||||
|
||||
if (fvgmbd != null) {
|
||||
mouseOverText = metabasin.getBasinId() + "\n"
|
||||
+ fvgmbd.getLid() + "-" + fvgmbd.getName();
|
||||
|
||||
if (!resource.getHuc().equals("ALL")) {
|
||||
if (!huc.equals(ALL)) {
|
||||
displayName += "-" + fvgmbd.getName();
|
||||
}
|
||||
}
|
||||
|
@ -343,12 +367,12 @@ public class FFMPDataGenerator {
|
|||
trd.setTableCellData(0, new FFMPTableCellData(rowField,
|
||||
displayName, mouseOverText));
|
||||
|
||||
if (!resource.isWorstCase() || resource.getHuc().equals("ALL")
|
||||
|| (resource.centeredAggregationKey != null)) {
|
||||
if (!isWorstCase || huc.equals(ALL)
|
||||
|| (centeredAggregationKey != null)) {
|
||||
|
||||
if (cBasin.getValues().size() > 0) {
|
||||
rate = ((FFMPVirtualGageBasin) cBasin)
|
||||
.getValue(resource.getPaintTime().getRefTime());
|
||||
.getValue(paintRefTime);
|
||||
trd.setTableCellData(1, new FFMPTableCellData(
|
||||
FIELDS.RATE, rate));
|
||||
} else {
|
||||
|
@ -357,7 +381,7 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
if (cBasin.getValues().size() > 0) {
|
||||
|
||||
if (resource.getTime() > 0.00) {
|
||||
if (sliderTime > 0.00) {
|
||||
qpe = cBasin.getAccumValue(monitor.getQpeWindow()
|
||||
.getAfterTime(), monitor.getQpeWindow()
|
||||
.getBeforeTime(), expirationTime, isRate);
|
||||
|
@ -394,7 +418,7 @@ public class FFMPDataGenerator {
|
|||
boolean forced = false;
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
forceUtil.setSliderTime(resource.getTime());
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
|
||||
if ((guidBasin != null)
|
||||
&& ((FFMPGuidanceBasin) guidBasin
|
||||
|
@ -407,26 +431,26 @@ public class FFMPDataGenerator {
|
|||
if (domain == null) {
|
||||
pfafList = ft.getAggregatePfafs(
|
||||
cBasin.getPfaf(),
|
||||
resource.getSiteKey(),
|
||||
resource.getHuc());
|
||||
} else if (!domain.equals("NA")) {
|
||||
if (!resource.getHuc().equals("ALL")) {
|
||||
siteKey,
|
||||
huc);
|
||||
} else if (!domain.equals(NA)) {
|
||||
if (!huc.equals(ALL)) {
|
||||
pfafList = ft
|
||||
.getAggregatePfafsByDomain(
|
||||
parentBasinPfaf,
|
||||
resource.getSiteKey(),
|
||||
siteKey,
|
||||
domain,
|
||||
resource.getHuc());
|
||||
huc);
|
||||
}
|
||||
} else {
|
||||
pfafList = ft.getAggregatePfafsByDomain(
|
||||
parentBasinPfaf,
|
||||
resource.getSiteKey(), domain,
|
||||
resource.getHuc());
|
||||
siteKey, domain,
|
||||
huc);
|
||||
pfafList.add(ft.getAggregatedPfaf(
|
||||
cBasin.getPfaf(),
|
||||
resource.getSiteKey(),
|
||||
resource.getHuc()));
|
||||
siteKey,
|
||||
huc));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,7 +458,7 @@ public class FFMPDataGenerator {
|
|||
|
||||
if (fdm.isForcingConfigured()) {
|
||||
FFMPBasin parentBasin = baseRec.getBasinData(
|
||||
"ALL").get(parentBasinPfaf);
|
||||
ALL).get(parentBasinPfaf);
|
||||
forceUtil.calculateForcings(domain, ft,
|
||||
parentBasin);
|
||||
forcedPfafs = forceUtil.getForcedPfafList();
|
||||
|
@ -446,7 +470,7 @@ public class FFMPDataGenerator {
|
|||
// value(s)
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData("ALL")
|
||||
.getBasinData(ALL)
|
||||
.getAverageGuidanceValue(
|
||||
pfafList,
|
||||
resource.getGuidanceInterpolators()
|
||||
|
@ -457,7 +481,7 @@ public class FFMPDataGenerator {
|
|||
} else if (forcedPfafs.size() > 1) {
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData("ALL")
|
||||
.getBasinData(ALL)
|
||||
.getAverageGuidanceValue(
|
||||
pfafList,
|
||||
resource.getGuidanceInterpolators()
|
||||
|
@ -469,7 +493,7 @@ public class FFMPDataGenerator {
|
|||
} else if (pfafList.size() > 1) {
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData("ALL")
|
||||
.getBasinData(ALL)
|
||||
.getAverageGuidanceValue(
|
||||
pfafList,
|
||||
resource.getGuidanceInterpolators()
|
||||
|
@ -479,8 +503,7 @@ public class FFMPDataGenerator {
|
|||
resource.getGuidSourceExpiration());
|
||||
} else {
|
||||
guidance = resource.getGuidanceValue(
|
||||
ffmpGuidBasin, resource.getPaintTime()
|
||||
.getRefTime(), guidType);
|
||||
ffmpGuidBasin, paintRefTime, guidType);
|
||||
|
||||
if (guidance < 0.0f) {
|
||||
guidance = Float.NaN;
|
||||
|
@ -530,11 +553,11 @@ public class FFMPDataGenerator {
|
|||
displayName, cBasin.getPfaf().toString() + "\n"
|
||||
+ displayName));
|
||||
|
||||
if (!resource.isWorstCase() || resource.getHuc().equals("ALL")
|
||||
|| (resource.centeredAggregationKey != null)) {
|
||||
if (!isWorstCase || huc.equals(ALL)
|
||||
|| (centeredAggregationKey != null)) {
|
||||
if ((rateBasin != null)
|
||||
&& (rateBasin.get(cBasin.getPfaf()) != null)) {
|
||||
rate = rateBasin.get(cBasin.getPfaf()).getValue(resource.getPaintTime().getRefTime());
|
||||
rate = rateBasin.get(cBasin.getPfaf()).getValue(paintRefTime);
|
||||
trd.setTableCellData(1, new FFMPTableCellData(
|
||||
FIELDS.RATE, rate));
|
||||
// System.out.println("rate: "+rate);
|
||||
|
@ -579,7 +602,7 @@ public class FFMPDataGenerator {
|
|||
boolean forced = false;
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
forceUtil.setSliderTime(resource.getTime());
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
|
||||
if ((guidBasin != null)
|
||||
&& ((FFMPGuidanceBasin) guidBasin.get(cBasin
|
||||
|
@ -592,26 +615,26 @@ public class FFMPDataGenerator {
|
|||
if (domain == null) {
|
||||
pfafList = ft.getAggregatePfafs(
|
||||
cBasin.getPfaf(),
|
||||
resource.getSiteKey(),
|
||||
resource.getHuc());
|
||||
} else if (!domain.equals("NA")) {
|
||||
if (!resource.getHuc().equals("ALL")) {
|
||||
siteKey,
|
||||
huc);
|
||||
} else if (!domain.equals(NA)) {
|
||||
if (!huc.equals(ALL)) {
|
||||
pfafList = ft
|
||||
.getAggregatePfafsByDomain(
|
||||
cBasin.getPfaf(),
|
||||
resource.getSiteKey(),
|
||||
siteKey,
|
||||
domain,
|
||||
resource.getHuc());
|
||||
huc);
|
||||
}
|
||||
} else {
|
||||
pfafList = ft.getAggregatePfafsByDomain(
|
||||
cBasin.getPfaf(),
|
||||
resource.getSiteKey(), domain,
|
||||
resource.getHuc());
|
||||
siteKey, domain,
|
||||
huc);
|
||||
pfafList.add(ft.getAggregatedPfaf(
|
||||
cBasin.getPfaf(),
|
||||
resource.getSiteKey(),
|
||||
resource.getHuc()));
|
||||
siteKey,
|
||||
huc));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -628,7 +651,7 @@ public class FFMPDataGenerator {
|
|||
// value(s)
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData("ALL")
|
||||
.getBasinData(ALL)
|
||||
.getAverageGuidanceValue(
|
||||
pfafList,
|
||||
resource.getGuidanceInterpolators()
|
||||
|
@ -639,7 +662,7 @@ public class FFMPDataGenerator {
|
|||
} else if (forcedPfafs.size() > 1) {
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData("ALL")
|
||||
.getBasinData(ALL)
|
||||
.getAverageGuidanceValue(
|
||||
pfafList,
|
||||
resource.getGuidanceInterpolators()
|
||||
|
@ -651,7 +674,7 @@ public class FFMPDataGenerator {
|
|||
} else if (pfafList.size() > 1) {
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData("ALL")
|
||||
.getBasinData(ALL)
|
||||
.getAverageGuidanceValue(
|
||||
pfafList,
|
||||
resource.getGuidanceInterpolators()
|
||||
|
@ -739,22 +762,22 @@ public class FFMPDataGenerator {
|
|||
if (cBasin.getAggregated()) {
|
||||
if (domain == null) {
|
||||
pfafList = ft.getAggregatePfafs(cBasin.getPfaf(),
|
||||
resource.getSiteKey(), resource.getHuc());
|
||||
} else if (!domain.equals("NA")) {
|
||||
if (!resource.getHuc().equals("ALL")) {
|
||||
siteKey, huc);
|
||||
} else if (!domain.equals(NA)) {
|
||||
if (!huc.equals(ALL)) {
|
||||
pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(),
|
||||
resource.getSiteKey(), domain, resource.getHuc());
|
||||
siteKey, domain, huc);
|
||||
}
|
||||
} else {
|
||||
pfafList = ft.getAggregatePfafsByDomain(cBasin.getPfaf(),
|
||||
resource.getSiteKey(), domain, resource.getHuc());
|
||||
siteKey, domain, huc);
|
||||
pfafList.add(ft.getAggregatedPfaf(cBasin.getPfaf(),
|
||||
resource.getSiteKey(), resource.getHuc()));
|
||||
siteKey, huc));
|
||||
}
|
||||
}
|
||||
|
||||
if (!resource.isWorstCase() || resource.getHuc().equals("ALL")
|
||||
|| (resource.centeredAggregationKey != null)) {
|
||||
if (!isWorstCase || huc.equals(ALL)
|
||||
|| (centeredAggregationKey != null)) {
|
||||
if (((forcedPfafs.size() > 1)) || forced) {
|
||||
// Calculate an average
|
||||
guidance = forceUtil.getAvgForcedValue(pfafList, forcedPfafs,
|
||||
|
@ -785,25 +808,25 @@ public class FFMPDataGenerator {
|
|||
String name = null;
|
||||
|
||||
try {
|
||||
if (resource.getHuc().equals("ALL")
|
||||
|| (resource.centeredAggregationKey != null)) {
|
||||
name = ft.getBasin(resource.getSiteKey(), basin.getPfaf())
|
||||
if (huc.equals(ALL)
|
||||
|| (centeredAggregationKey != null)) {
|
||||
name = ft.getBasin(siteKey, basin.getPfaf())
|
||||
.getStreamName();
|
||||
}
|
||||
// aggregations
|
||||
else {
|
||||
|
||||
ArrayList<Long> pfafs = ft.getAggregatePfafs(basin.getPfaf(),
|
||||
resource.getSiteKey(), resource.getHuc());
|
||||
siteKey, huc);
|
||||
if (pfafs.size() > 0) {
|
||||
if (resource.getHuc().equals("COUNTY")) {
|
||||
name = ft.getCountyStateName(resource.getSiteKey(),
|
||||
if (huc.equals("COUNTY")) {
|
||||
name = ft.getCountyStateName(siteKey,
|
||||
basin.getPfaf());
|
||||
} else {
|
||||
for (int i = 0; i < pfafs.size(); i++) {
|
||||
if (ft.getBasin(resource.getSiteKey(), pfafs.get(0))
|
||||
if (ft.getBasin(siteKey, pfafs.get(0))
|
||||
.getHucName() != null) {
|
||||
name = ft.getBasin(resource.getSiteKey(),
|
||||
name = ft.getBasin(siteKey,
|
||||
pfafs.get(0)).getHucName();
|
||||
break;
|
||||
}
|
||||
|
@ -832,7 +855,7 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
|
||||
ArrayList<Long> pfafs = ft.getAggregatePfafs(cBasin.getPfaf(),
|
||||
resource.getSiteKey(), resource.getHuc(), activeDomains);
|
||||
siteKey, huc, activeDomains);
|
||||
trd.setPfaf(cBasin.getPfaf().toString());
|
||||
Float qpe = Float.NaN;
|
||||
Float guidance = Float.NaN;
|
||||
|
@ -846,13 +869,13 @@ public class FFMPDataGenerator {
|
|||
1,
|
||||
new FFMPTableCellData(FIELDS.RATE, virtualBasin
|
||||
.get(cBasin.getPfaf()).getValue(
|
||||
resource.getPaintTime().getRefTime())));
|
||||
paintRefTime)));
|
||||
} else {
|
||||
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
|
||||
Float.NaN));
|
||||
}
|
||||
if (virtualBasin != null) {
|
||||
if (resource.getTime() > 0.00) {
|
||||
if (sliderTime > 0.00) {
|
||||
qpe = virtualBasin.get(cBasin.getPfaf()).getAccumValue(
|
||||
monitor.getQpeWindow().getAfterTime(),
|
||||
monitor.getQpeWindow().getBeforeTime(),
|
||||
|
@ -887,7 +910,7 @@ public class FFMPDataGenerator {
|
|||
int i = 0;
|
||||
for (String guidType : guidBasins.keySet()) {
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
forceUtil.setSliderTime(resource.getTime());
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
|
||||
|
@ -941,7 +964,7 @@ public class FFMPDataGenerator {
|
|||
} else {
|
||||
if (pfafs.size() > 0) {
|
||||
if (rateBasin != null) {
|
||||
rate = rateBasin.getMaxValue(pfafs, resource.getPaintTime().getRefTime());
|
||||
rate = rateBasin.getMaxValue(pfafs, paintRefTime);
|
||||
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
|
||||
rate));
|
||||
} else {
|
||||
|
@ -950,8 +973,8 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
if (qpeBasin != null) {
|
||||
qpe = qpeBasin.getAccumMaxValue(pfafs, monitor
|
||||
.getQpeWindow().getAfterTime(), monitor
|
||||
.getQpeWindow().getBeforeTime(), expirationTime,
|
||||
.getQpeWindow().getBeforeTime(), monitor
|
||||
.getQpeWindow().getAfterTime(), expirationTime,
|
||||
isRate);
|
||||
trd.setTableCellData(2, new FFMPTableCellData(FIELDS.QPE,
|
||||
qpe));
|
||||
|
@ -977,7 +1000,7 @@ public class FFMPDataGenerator {
|
|||
int i = 0;
|
||||
for (String guidType : guidBasins.keySet()) {
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
forceUtil.setSliderTime(resource.getTime());
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
|
||||
|
@ -986,9 +1009,9 @@ public class FFMPDataGenerator {
|
|||
&& (guidBasin.getBasins().size() > 0)) {
|
||||
if (cBasin.getAggregated()) {
|
||||
pfafList = ft.getAggregatePfafs(cBasin.getPfaf(),
|
||||
resource.getSiteKey(), resource.getHuc());
|
||||
siteKey, huc);
|
||||
pfafList.add(ft.getAggregatedPfaf(cBasin.getPfaf(),
|
||||
resource.getSiteKey(), resource.getHuc()));
|
||||
siteKey, huc));
|
||||
}
|
||||
|
||||
boolean forced = false;
|
||||
|
@ -1008,10 +1031,10 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
if (resource.isWorstCase()) {
|
||||
if (isWorstCase) {
|
||||
guidance = guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData("ALL")
|
||||
.getBasinData(ALL)
|
||||
.getMaxGuidanceValue(
|
||||
pfafs,
|
||||
resource.getGuidanceInterpolators()
|
||||
|
@ -1021,7 +1044,7 @@ public class FFMPDataGenerator {
|
|||
} else {
|
||||
FFMPGuidanceBasin basin = (FFMPGuidanceBasin) guidRecords
|
||||
.get(guidType)
|
||||
.getBasinData(resource.getHuc())
|
||||
.getBasinData(huc)
|
||||
.get(cBasin.getPfaf());
|
||||
guidance = resource.getGuidanceValue(basin, monitor
|
||||
.getQpeWindow().getBeforeTime(), guidType);
|
||||
|
@ -1081,7 +1104,7 @@ public class FFMPDataGenerator {
|
|||
trd.setTableCellData(
|
||||
1,
|
||||
new FFMPTableCellData(FIELDS.RATE, rateBasin.get(
|
||||
cBasin.getPfaf()).getValue(resource.getPaintTime().getRefTime())));
|
||||
cBasin.getPfaf()).getValue(paintRefTime)));
|
||||
} else {
|
||||
trd.setTableCellData(1, new FFMPTableCellData(FIELDS.RATE,
|
||||
Float.NaN));
|
||||
|
@ -1118,7 +1141,7 @@ public class FFMPDataGenerator {
|
|||
int i = 0;
|
||||
for (String guidType : guidBasins.keySet()) {
|
||||
FFFGForceUtil forceUtil = forceUtils.get(guidType);
|
||||
forceUtil.setSliderTime(resource.getTime());
|
||||
forceUtil.setSliderTime(sliderTime);
|
||||
|
||||
FFMPBasinData guidBasin = guidBasins.get(guidType);
|
||||
|
||||
|
@ -1185,85 +1208,78 @@ public class FFMPDataGenerator {
|
|||
* @throws VizException
|
||||
*/
|
||||
private FIELDS getBaseField() {
|
||||
FIELDS field = null;
|
||||
String huc = null;
|
||||
System.out.println("Paint/Table Time: " + paintRefTime + "/" + tableTime);
|
||||
|
||||
FIELDS field = null;
|
||||
String localHuc = null;
|
||||
dman = FFFGDataMgr.getInstance();
|
||||
|
||||
|
||||
FfmpTableConfigData ffmpTableCfgData = FfmpTableConfig.getInstance()
|
||||
.getTableConfigData(resource.getSiteKey());
|
||||
.getTableConfigData(siteKey);
|
||||
String qpfType = ffmpTableCfgData.getQpfType();
|
||||
ProductRunXML productRun = FFMPRunConfigurationManager.getInstance()
|
||||
.getProduct(resource.getSiteKey());
|
||||
.getProduct(siteKey);
|
||||
String qpfSource = productRun
|
||||
.getQpfSources(resource.getProduct(), qpfType).get(0)
|
||||
.getQpfSources(product, qpfType).get(0)
|
||||
.getSourceName();
|
||||
|
||||
FFMPConfig config = FFMPConfig.getInstance();
|
||||
String includedCWAs = config.getFFMPConfigData().getIncludedCWAs();
|
||||
cwaArr = includedCWAs.split(",");
|
||||
monitor.setQpfWindow(monitor.getTimeWindow(qpfSource, resource
|
||||
.getPaintTime().getRefTime(), resource.getSiteKey()));
|
||||
Date qpeTime = resource.getPaintTime().getRefTime();
|
||||
monitor.setQpfWindow(monitor.getTimeWindow(qpfSource, paintRefTime, siteKey));
|
||||
Date qpeTime = paintRefTime;
|
||||
if (resource.isSplit()) {
|
||||
// hack off the QPF duration for the table values of QPE (Split
|
||||
// Window)
|
||||
double duration = FFMPSourceConfigurationManager.getInstance()
|
||||
.getSource(qpfSource).getDurationHour();
|
||||
qpeTime = new Date((long) (resource.getPaintTime().getRefTime()
|
||||
.getTime() - (duration * 3600 * 1000)));
|
||||
qpeTime = new Date((long) (qpeTime.getTime() - (duration * 3600 * 1000)));
|
||||
}
|
||||
|
||||
monitor.setQpeWindow(new FFMPTimeWindow(resource.getTableTime(),
|
||||
monitor.setQpeWindow(new FFMPTimeWindow(tableTime,
|
||||
qpeTime));
|
||||
// set keys
|
||||
String siteKey = resource.getSiteKey();
|
||||
String dataKey = resource.getDataKey();
|
||||
ProductXML product = resource.getProduct();
|
||||
|
||||
if (resource.isWorstCase() || (resource.centeredAggregationKey != null)) {
|
||||
if (isWorstCase || (centeredAggregationKey != null)) {
|
||||
// make sure that "ALL" is loaded
|
||||
huc = "ALL";
|
||||
|
||||
localHuc = ALL;
|
||||
rateRecord = monitor.getRateRecord(product, siteKey, dataKey,
|
||||
product.getRate(), resource.getPaintTime().getRefTime(),
|
||||
huc, true);
|
||||
product.getRate(), paintRefTime, localHuc, true);
|
||||
qpeRecord = monitor.getQPERecord(product, siteKey, dataKey,
|
||||
product.getQpe(), resource.getTableTime(), huc, true);
|
||||
product.getQpe(), tableTime, localHuc, true);
|
||||
qpfRecord = monitor.getQPFRecord(product, siteKey, dataKey, null,
|
||||
resource.getPaintTime().getRefTime(), huc, true);
|
||||
paintRefTime, localHuc, true);
|
||||
guidRecords = monitor.getGuidanceRecords(product, siteKey,
|
||||
resource.getTableTime(), huc, true);
|
||||
tableTime, localHuc, true);
|
||||
virtualRecord = monitor.getVirtualRecord(product, siteKey, dataKey,
|
||||
product.getVirtual(), resource.getTableTime(), huc, true);
|
||||
product.getVirtual(), tableTime, localHuc, true);
|
||||
} else {
|
||||
rateRecord = monitor.getRateRecord(product, siteKey, dataKey,
|
||||
product.getRate(), resource.getPaintTime().getRefTime(),
|
||||
resource.getHuc(), true);
|
||||
product.getRate(), paintRefTime, huc, true);
|
||||
qpeRecord = monitor.getQPERecord(product, siteKey, dataKey,
|
||||
product.getQpe(), resource.getTableTime(),
|
||||
resource.getHuc(), true);
|
||||
product.getQpe(), tableTime, huc, true);
|
||||
qpfRecord = monitor.getQPFRecord(product, siteKey, dataKey, null,
|
||||
resource.getPaintTime().getRefTime(), resource.getHuc(), true);
|
||||
paintRefTime, huc, true);
|
||||
guidRecords = monitor.getGuidanceRecords(product, siteKey,
|
||||
resource.getTableTime(), resource.getHuc(), true);
|
||||
if (resource.getHuc().equals("ALL")) {
|
||||
tableTime, huc, true);
|
||||
if (huc.equals(ALL)) {
|
||||
virtualRecord = monitor.getVirtualRecord(product, siteKey,
|
||||
dataKey, product.getVirtual(), resource.getTableTime(),
|
||||
resource.getHuc(), true);
|
||||
dataKey, product.getVirtual(), tableTime,
|
||||
huc, true);
|
||||
}
|
||||
huc = resource.getHuc();
|
||||
localHuc = huc;
|
||||
}
|
||||
|
||||
try {
|
||||
if (rateRecord != null) {
|
||||
rateBasin = rateRecord.getBasinData(huc);
|
||||
rateBasin = rateRecord.getBasinData(localHuc);
|
||||
if (rateBasin.getBasins().size() > 0) {
|
||||
field = FIELDS.RATE;
|
||||
baseRec = rateRecord;
|
||||
}
|
||||
}
|
||||
if (qpeRecord != null) {
|
||||
qpeBasin = qpeRecord.getBasinData(huc);
|
||||
qpeBasin = qpeRecord.getBasinData(localHuc);
|
||||
if (qpeBasin.getBasins().size() > 0) {
|
||||
field = FIELDS.QPE;
|
||||
if (baseRec == null) {
|
||||
|
@ -1272,21 +1288,21 @@ public class FFMPDataGenerator {
|
|||
}
|
||||
}
|
||||
if (qpfRecord != null) {
|
||||
qpfBasin = qpfRecord.getBasinData(huc);
|
||||
qpfBasin = qpfRecord.getBasinData(localHuc);
|
||||
}
|
||||
if (guidRecords != null) {
|
||||
guidBasins = new HashMap<String, FFMPBasinData>();
|
||||
for (String type : guidRecords.keySet()) {
|
||||
if (guidRecords.get(type) != null) {
|
||||
guidBasins.put(type, guidRecords.get(type)
|
||||
.getBasinData(huc));
|
||||
.getBasinData(localHuc));
|
||||
} else {
|
||||
guidBasins.put(type, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (virtualRecord != null) {
|
||||
virtualBasin = virtualRecord.getBasinData(huc);
|
||||
virtualBasin = virtualRecord.getBasinData(localHuc);
|
||||
}
|
||||
|
||||
// Get interpolators
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
@ -35,12 +37,9 @@ import com.raytheon.uf.common.monitor.xml.ProductRunXML;
|
|||
import com.raytheon.uf.common.monitor.xml.ProductXML;
|
||||
import com.raytheon.uf.common.monitor.xml.SourceXML;
|
||||
import com.raytheon.uf.common.ohd.AppsDefaults;
|
||||
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
|
||||
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
import com.raytheon.uf.common.serialization.SerializationUtil;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.SimulatedTime;
|
||||
import com.raytheon.uf.common.util.FileUtil;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.FFMPMonitor;
|
||||
import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig;
|
||||
|
@ -57,7 +56,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoaderEvent;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 28 Feb, 2011 7587 dhladky Initial creation
|
||||
* 25 Jan, 2012 DR13839 gzhang Handle Uris and Huc processing
|
||||
* 25 Jan, 2012 DR13839 gzhang Handle Uris and Huc processing
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -65,8 +64,8 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.listeners.FFMPLoaderEvent;
|
|||
*/
|
||||
public class FFMPDataLoader extends Thread {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FFMPDataLoader.class);
|
||||
// private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
// .getHandler(FFMPDataLoader.class);
|
||||
|
||||
private String sharePath = null;
|
||||
|
||||
|
@ -102,8 +101,7 @@ public class FFMPDataLoader extends Thread {
|
|||
|
||||
sharePath = AppsDefaults.getInstance().getToken("apps_dir")
|
||||
+ File.separator + "ffmp" + File.separator;
|
||||
//sharePath = "/awips2/edex/data/share/hydroapps/ffmp/";
|
||||
|
||||
|
||||
this.product = resourceData.getProduct();
|
||||
this.siteKey = resourceData.siteKey;
|
||||
this.dataKey = resourceData.dataKey;
|
||||
|
@ -152,9 +150,8 @@ public class FFMPDataLoader extends Thread {
|
|||
long time = System.currentTimeMillis();
|
||||
|
||||
try {
|
||||
resourceData.setLoader(loadType);
|
||||
System.out.println("Starting Loader: "+loadType.getLoaderType());
|
||||
|
||||
resourceData.setLoader(loadType);
|
||||
|
||||
ProductRunXML productRun = runner.getProduct(siteKey);
|
||||
ArrayList<String> qpfSources = new ArrayList<String>();
|
||||
|
||||
|
@ -165,8 +162,8 @@ public class FFMPDataLoader extends Thread {
|
|||
|| (loadType == LOADER_TYPE.GENERAL)) {
|
||||
rateURI = getMonitor().getAvailableUri(siteKey, dataKey,
|
||||
product.getRate(), mostRecentTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NavigableMap<Date, List<String>> qpeURIs = getMonitor()
|
||||
.getAvailableUris(siteKey, dataKey, product.getQpe(),
|
||||
timeBack);
|
||||
|
@ -221,11 +218,12 @@ public class FFMPDataLoader extends Thread {
|
|||
}
|
||||
}
|
||||
}
|
||||
// We only load all for long range data, all + layer for medium range
|
||||
// We only load all for long range data, all + layer for medium
|
||||
// range
|
||||
if (loadType == LOADER_TYPE.TERTIARY) {
|
||||
hucsToLoad.clear();
|
||||
hucsToLoad.add("ALL");
|
||||
}
|
||||
hucsToLoad.clear();
|
||||
hucsToLoad.add("ALL");
|
||||
}
|
||||
|
||||
for (String phuc : hucsToLoad) {
|
||||
|
||||
|
@ -239,9 +237,10 @@ public class FFMPDataLoader extends Thread {
|
|||
} else {
|
||||
// rate
|
||||
if (rateURI != null) {
|
||||
fireLoaderEvent(loadType, "Processing "+product.getRate() + "/" + phuc,
|
||||
fireLoaderEvent(loadType,
|
||||
"Processing " + product.getRate() + "/" + phuc,
|
||||
isDone);
|
||||
|
||||
|
||||
getMonitor().processUri(isProductLoad, rateURI,
|
||||
siteKey, product.getRate(), timeBack, phuc);
|
||||
fireLoaderEvent(loadType, product.getRate() + "/"
|
||||
|
@ -249,12 +248,11 @@ public class FFMPDataLoader extends Thread {
|
|||
}
|
||||
|
||||
// qpes
|
||||
fireLoaderEvent(loadType, "Processing "+product.getQpe() + "/" + phuc,
|
||||
isDone);
|
||||
fireLoaderEvent(loadType, "Processing " + product.getQpe()
|
||||
+ "/" + phuc, isDone);
|
||||
FFMPBasinData qpeData = null;
|
||||
|
||||
if ((loadType == LOADER_TYPE.INITIAL)
|
||||
|| (loadType == LOADER_TYPE.SECONDARY)) {
|
||||
if (loadType == LOADER_TYPE.INITIAL) {
|
||||
|
||||
SourceXML source = getMonitor().getSourceConfig()
|
||||
.getSource(product.getQpe());
|
||||
|
@ -267,13 +265,13 @@ public class FFMPDataLoader extends Thread {
|
|||
getMonitor().insertFFMPData(qpeData, siteKey,
|
||||
product.getQpe(), phuc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!qpeURIs.isEmpty() && qpeData == null) {
|
||||
if (phuc.equals(config.getFFMPConfigData().getLayer()) || phuc.equals("ALL")) {
|
||||
if (phuc.equals(config.getFFMPConfigData().getLayer())
|
||||
|| phuc.equals("ALL")) {
|
||||
getMonitor().processUris(qpeURIs, isProductLoad,
|
||||
siteKey, product.getQpe(), timeBack, phuc,
|
||||
loadType);
|
||||
siteKey, product.getQpe(), timeBack, phuc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,11 +281,11 @@ public class FFMPDataLoader extends Thread {
|
|||
int i = 0;
|
||||
for (NavigableMap<Date, List<String>> qpfURIs : qpfs) {
|
||||
// qpf
|
||||
fireLoaderEvent(loadType, "Processing "+product.getQpf(i) + "/" + phuc,
|
||||
fireLoaderEvent(loadType,
|
||||
"Processing " + product.getQpf(i) + "/" + phuc,
|
||||
isDone);
|
||||
FFMPBasinData qpfData = null;
|
||||
if ((loadType == LOADER_TYPE.INITIAL)
|
||||
|| (loadType == LOADER_TYPE.SECONDARY)) {
|
||||
if (loadType == LOADER_TYPE.INITIAL) {
|
||||
|
||||
SourceXML source = getMonitor().getSourceConfig()
|
||||
.getSource(qpfSources.get(i));
|
||||
|
@ -309,7 +307,7 @@ public class FFMPDataLoader extends Thread {
|
|||
getMonitor().processUris(qpfURIs,
|
||||
isProductLoad, siteKey,
|
||||
source.getSourceName(),
|
||||
timeBack, phuc, loadType);
|
||||
timeBack, phuc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,15 +315,19 @@ public class FFMPDataLoader extends Thread {
|
|||
source.getSourceName(), phuc);
|
||||
}
|
||||
}
|
||||
//if (isUrisProcessNeeded(qpfData,qpfURIs)) {/*DR13839*/
|
||||
// if (isUrisProcessNeeded(qpfData,qpfURIs))
|
||||
// {/*DR13839*/
|
||||
if ((qpfData == null) && !qpfURIs.isEmpty()) {
|
||||
if (phuc.equals(config.getFFMPConfigData()
|
||||
.getLayer()) || phuc.equals("ALL")) { //old code: keep for reference*/
|
||||
//if (isHucProcessNeeded(phuc)) {/*DR13839*/
|
||||
.getLayer()) || phuc.equals("ALL")) { // old
|
||||
// code:
|
||||
// keep
|
||||
// for
|
||||
// reference*/
|
||||
// if (isHucProcessNeeded(phuc)) {/*DR13839*/
|
||||
getMonitor().processUris(qpfURIs,
|
||||
isProductLoad, siteKey,
|
||||
product.getQpf(i), timeBack, phuc,
|
||||
loadType);
|
||||
product.getQpf(i), timeBack, phuc);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,12 +340,12 @@ public class FFMPDataLoader extends Thread {
|
|||
}
|
||||
// virtuals only have data for ALL
|
||||
if (phuc.equals("ALL")) {
|
||||
fireLoaderEvent(loadType, "Processing "+product.getVirtual() + "/" + phuc,
|
||||
fireLoaderEvent(loadType,
|
||||
"Processing " + product.getVirtual() + "/" + phuc,
|
||||
isDone);
|
||||
FFMPBasinData vgbData = null;
|
||||
|
||||
if ((loadType == LOADER_TYPE.INITIAL)
|
||||
|| (loadType == LOADER_TYPE.SECONDARY)) {
|
||||
if (loadType == LOADER_TYPE.INITIAL) {
|
||||
|
||||
SourceXML source = getMonitor().getSourceConfig()
|
||||
.getSource(product.getVirtual());
|
||||
|
@ -360,8 +362,7 @@ public class FFMPDataLoader extends Thread {
|
|||
|
||||
if ((vgbData == null) && !virtualURIs.isEmpty()) {
|
||||
getMonitor().processUris(virtualURIs, isProductLoad,
|
||||
siteKey, product.getVirtual(), timeBack, phuc,
|
||||
loadType);
|
||||
siteKey, product.getVirtual(), timeBack, phuc);
|
||||
}
|
||||
|
||||
fireLoaderEvent(loadType,
|
||||
|
@ -370,20 +371,21 @@ public class FFMPDataLoader extends Thread {
|
|||
|
||||
// process guidance all at once
|
||||
for (String type : productRun.getGuidanceTypes(product)) {
|
||||
|
||||
|
||||
ArrayList<SourceXML> guidSources = productRun
|
||||
.getGuidanceSources(product, type);
|
||||
for (SourceXML guidSource : guidSources) {
|
||||
|
||||
|
||||
NavigableMap<Date, List<String>> iguidURIs = guids
|
||||
.get(guidSource.getSourceName());
|
||||
|
||||
fireLoaderEvent(loadType, "Processing "+guidSource.getSourceName() + "/" + phuc,
|
||||
isDone);
|
||||
|
||||
fireLoaderEvent(loadType,
|
||||
"Processing " + guidSource.getSourceName()
|
||||
+ "/" + phuc, isDone);
|
||||
|
||||
getMonitor().processUris(iguidURIs, isProductLoad,
|
||||
siteKey, guidSource.getSourceName(), timeBack,
|
||||
phuc, loadType);
|
||||
phuc);
|
||||
|
||||
fireLoaderEvent(loadType, guidSource.getSourceName()
|
||||
+ "/" + phuc, isDone);
|
||||
|
@ -394,7 +396,6 @@ public class FFMPDataLoader extends Thread {
|
|||
fireLoaderEvent(loadType, phuc + " Load complete", isDone);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
isDone = true;
|
||||
System.err.println("FFMP Data Loader terminated...."
|
||||
+ e.getMessage());
|
||||
} finally {
|
||||
|
@ -479,35 +480,75 @@ public class FFMPDataLoader extends Thread {
|
|||
String sourceName = source.getSourceName();
|
||||
File file = new File(sharePath + wfo + File.separator + sourceName
|
||||
+ "-" + siteKey + "-" + pdataKey + "-" + huc + ".bin");
|
||||
System.out.println("Buddy File path: " + file.getAbsolutePath());
|
||||
File lockFile = new File(sharePath + wfo + File.separator + sourceName
|
||||
+ "-" + siteKey + "-" + pdataKey + ".lock");
|
||||
|
||||
FFMPBasinData basinData = null;
|
||||
while (lockFile.exists()) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
try {
|
||||
sleep(100);
|
||||
i++;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (file.exists()) {
|
||||
|
||||
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))));
|
||||
break;
|
||||
}
|
||||
|
||||
if (file.lastModified() > (System.currentTimeMillis() - (6 * 1000 * 3600))) {
|
||||
|
||||
System.out.println("Buddy File path: " + file.getName());
|
||||
|
||||
try {
|
||||
basinData = (FFMPBasinData) SerializationUtil
|
||||
.transformFromThrift(FileUtil.file2bytes(file,
|
||||
false));
|
||||
} catch (SerializationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Buddy File expected path: "
|
||||
+ file.getAbsolutePath());
|
||||
FFMPBasinData basinData = null;
|
||||
|
||||
return basinData;
|
||||
if (file.exists()) {
|
||||
|
||||
}
|
||||
System.out.println("Last mod: " + new Date(file.lastModified()));
|
||||
|
||||
if (file.lastModified() > (System.currentTimeMillis() - (6 * 1000 * 3600))) {
|
||||
|
||||
while (lockFile.exists()) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
try {
|
||||
System.out.println("Waiting for new file: "
|
||||
+ file.getAbsolutePath());
|
||||
sleep(100);
|
||||
i++;
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
BufferedInputStream is = null;
|
||||
|
||||
try {
|
||||
|
||||
System.out.println("Loading file: " + file.getName());
|
||||
is = new BufferedInputStream(new FileInputStream(file));
|
||||
DynamicSerializationManager dsm = DynamicSerializationManager
|
||||
.getManager(SerializationType.Thrift);
|
||||
basinData = (FFMPBasinData) dsm.deserialize(is);
|
||||
} catch (SerializationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (is != null) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return basinData;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the home datakey identifier for QPF sources
|
||||
|
@ -533,5 +574,5 @@ public class FFMPDataLoader extends Thread {
|
|||
return siteKey;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,19 +1,19 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
|
@ -73,10 +73,8 @@ 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.FFMPRunConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
|
||||
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.SourceXML;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -151,7 +149,10 @@ import com.vividsolutions.jts.geom.Point;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 29 June, 2009 2521 dhladky Initial creation
|
||||
* 11 Apr. 2012 DR 14522 gzhang Fixing invalid thread error.
|
||||
* 31 July 2012 14517 mpduff Fix for blanking map on update.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
* @version 1.0
|
||||
*/
|
||||
|
@ -217,7 +218,7 @@ public class FFMPResource extends
|
|||
private IShadedShape streamShadedShape = null;
|
||||
|
||||
/** always the same vertexes, one for each CWA **/
|
||||
private FFMPShapeContainer shadedShapes = new FFMPShapeContainer();
|
||||
private FFMPShapeContainer shadedShapes = new FFMPShapeContainer();
|
||||
|
||||
/** Basin shaded shape **/
|
||||
protected ConcurrentHashMap<DataTime, FFMPDrawable> drawables = new ConcurrentHashMap<DataTime, FFMPDrawable>();
|
||||
|
@ -307,7 +308,7 @@ public class FFMPResource extends
|
|||
|
||||
/** show ffmp color display */
|
||||
private boolean showFfmpData = true;
|
||||
|
||||
|
||||
/** qpf split window */
|
||||
private boolean isSplit = false;
|
||||
|
||||
|
@ -319,7 +320,7 @@ public class FFMPResource extends
|
|||
|
||||
/** table slider time **/
|
||||
private Date tableTime = null;
|
||||
|
||||
|
||||
// complete reset
|
||||
public boolean isQuery = true;
|
||||
|
||||
|
@ -342,7 +343,7 @@ public class FFMPResource extends
|
|||
|
||||
/** guidance source expiration **/
|
||||
public long guidSourceExpiration = 0l;
|
||||
|
||||
|
||||
/** QPF source expiration **/
|
||||
public long qpfSourceExpiration = 0l;
|
||||
|
||||
|
@ -373,11 +374,16 @@ public class FFMPResource extends
|
|||
private RGB basinBoundaryColor = null;
|
||||
|
||||
/** ordered list of times **/
|
||||
private ArrayList<Date> timeOrderedKeys = null;
|
||||
private ArrayList<Date> timeOrderedKeys = new ArrayList<Date>();
|
||||
|
||||
private boolean toKeysInitialized = false;
|
||||
|
||||
/** force utility **/
|
||||
private FFFGForceUtil forceUtil = null;
|
||||
|
||||
/** Restore Table flag */
|
||||
private boolean restoreTable = false;
|
||||
|
||||
/**
|
||||
* FFMP resource
|
||||
*
|
||||
|
@ -409,8 +415,11 @@ public class FFMPResource extends
|
|||
FFFGDataMgr.getUpdatedInstance();
|
||||
PluginDataObject[] pdos = (PluginDataObject[]) object;
|
||||
FFMPRecord ffmpRec = (FFMPRecord) pdos[pdos.length - 1];
|
||||
// an update clears everything
|
||||
clear();
|
||||
// only care about the most recent one
|
||||
try {
|
||||
|
||||
if (ffmpRec.getSourceName()
|
||||
.equals(getResourceData().sourceName)) {
|
||||
// go back an extra time step
|
||||
|
@ -426,6 +435,11 @@ public class FFMPResource extends
|
|||
}
|
||||
|
||||
updateTimeOrderedkeys(ffmpRec.getDataTime().getRefTime());
|
||||
|
||||
if (getResourceData().tableLoad) {
|
||||
setTableTime();
|
||||
}
|
||||
|
||||
setRecord(ffmpRec);
|
||||
|
||||
statusHandler.handle(Priority.INFO, "Updating : Previous: "
|
||||
|
@ -434,19 +448,31 @@ public class FFMPResource extends
|
|||
|
||||
if (getResourceData().tableLoad) {
|
||||
|
||||
startLoader(previousMostRecentTime, ffmpRec
|
||||
.getDataTime().getRefTime(),
|
||||
LOADER_TYPE.GENERAL);
|
||||
if (loader == null) {
|
||||
startLoader(previousMostRecentTime, ffmpRec
|
||||
.getDataTime().getRefTime(),
|
||||
LOADER_TYPE.GENERAL);
|
||||
} else {
|
||||
while (!loader.isDone) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
startLoader(previousMostRecentTime, ffmpRec
|
||||
.getDataTime().getRefTime(),
|
||||
LOADER_TYPE.GENERAL);
|
||||
}
|
||||
|
||||
while (!loader.isDone) {
|
||||
try {
|
||||
Thread.sleep(10);
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
setTableTime();
|
||||
purge(ffmpRec.getDataTime().getRefTime());
|
||||
}
|
||||
|
||||
|
@ -463,19 +489,17 @@ public class FFMPResource extends
|
|||
isNewQpf = true;
|
||||
}
|
||||
|
||||
if (getResourceData().tableLoad) {
|
||||
|
||||
isFirst = true;
|
||||
allowNewTableUpdate();
|
||||
monitor.updateDialog(this);
|
||||
}
|
||||
|
||||
} catch (VizException ve) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Error updating record",
|
||||
ve);
|
||||
}
|
||||
}
|
||||
|
||||
if (getResourceData().tableLoad) {
|
||||
allowNewTableUpdate();
|
||||
isFirst = true;
|
||||
}
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -486,7 +510,7 @@ public class FFMPResource extends
|
|||
}
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void hucChanged() {
|
||||
|
||||
|
@ -579,7 +603,7 @@ public class FFMPResource extends
|
|||
return getColorUtil().colorByValue(value);
|
||||
} else {
|
||||
if (getCenteredAggregatePfafs().contains(key) && isParent()) {
|
||||
|
||||
// this is for a reason
|
||||
} else {
|
||||
if (!isMaintainLayer() && isParent()) {
|
||||
return getColorUtil().colorByValue(value);
|
||||
|
@ -635,7 +659,8 @@ public class FFMPResource extends
|
|||
}
|
||||
case QPF: {
|
||||
value = getQpfRecord(recentTime).getBasinData("ALL")
|
||||
.getAverageMaxValue(pfafs, recentTime, getQpfSourceExpiration());
|
||||
.getAverageMaxValue(pfafs, recentTime,
|
||||
getQpfSourceExpiration());
|
||||
break;
|
||||
}
|
||||
case GUIDANCE: {
|
||||
|
@ -652,8 +677,8 @@ public class FFMPResource extends
|
|||
value = getQpeRecord().getBasinData("ALL")
|
||||
.getAccumMaxValue(
|
||||
pfafs,
|
||||
getTableTime(),
|
||||
recentTime,
|
||||
getTableTime(),
|
||||
getQpeSourceExpiration(),
|
||||
getResourceData().getPrimarySourceXML()
|
||||
.isRate());
|
||||
|
@ -683,10 +708,14 @@ public class FFMPResource extends
|
|||
pfafs);
|
||||
break;
|
||||
}
|
||||
case RATE:// fall through
|
||||
case RATE:
|
||||
value = getBasin(key, field, recentTime, aggregate)
|
||||
.getValue(recentTime);
|
||||
break;
|
||||
case QPF: {
|
||||
value = getBasin(key, field, recentTime, aggregate)
|
||||
.getAverageValue(recentTime, getQpfSourceExpiration());
|
||||
.getAverageValue(recentTime,
|
||||
getQpfSourceExpiration());
|
||||
break;
|
||||
}
|
||||
case GUIDANCE: {
|
||||
|
@ -713,7 +742,8 @@ public class FFMPResource extends
|
|||
switch (field) {
|
||||
case QPF: {
|
||||
value = getBasin(key, field, recentTime, aggregate)
|
||||
.getAverageValue(recentTime, getQpfSourceExpiration());
|
||||
.getAverageValue(recentTime,
|
||||
getQpfSourceExpiration());
|
||||
break;
|
||||
}
|
||||
case GUIDANCE: {
|
||||
|
@ -739,9 +769,9 @@ public class FFMPResource extends
|
|||
if (forceUtil == null) {
|
||||
forceUtil = new FFFGForceUtil(this, getFFGName());
|
||||
}
|
||||
|
||||
|
||||
forceUtil.setSliderTime(this.getTime());
|
||||
|
||||
|
||||
if (pfafs != null) {
|
||||
forceUtil.calculateForcings(pfafs,
|
||||
monitor.getTemplates(getSiteKey()), basin);
|
||||
|
@ -780,7 +810,13 @@ public class FFMPResource extends
|
|||
sfield = FFMPRecord.FIELDS.QPE;
|
||||
}
|
||||
|
||||
PluginDataObject pdo = getRecord(sfield, paintTime.getRefTime());
|
||||
PluginDataObject pdo = null;
|
||||
|
||||
try {
|
||||
pdo = getRecord(sfield, paintTime.getRefTime());
|
||||
} catch (NullPointerException npe) {
|
||||
return "No Data Available";
|
||||
}
|
||||
|
||||
if (pdo == null) {
|
||||
return "No Data Available";
|
||||
|
@ -817,9 +853,9 @@ public class FFMPResource extends
|
|||
/**
|
||||
* Gets the record currently used
|
||||
*
|
||||
* @return FFMPRecord
|
||||
* @return FFMPCacheRecord
|
||||
*/
|
||||
public FFMPRecord getRateRecord(Date recentTime) {
|
||||
public FFMPCacheRecord getRateRecord(Date recentTime) {
|
||||
|
||||
if ((rateRecord == null) && isNewRate) {
|
||||
try {
|
||||
|
@ -840,16 +876,15 @@ public class FFMPResource extends
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return rateRecord;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the record currently used
|
||||
*
|
||||
* @return FFMPRecord
|
||||
* @return FFMPCacheRecord
|
||||
*/
|
||||
public FFMPRecord getQpeRecord() {
|
||||
public FFMPCacheRecord getQpeRecord() {
|
||||
try {
|
||||
if ((qpeRecord == null) && (getTableTime() != null) && isNewQpe) {
|
||||
|
||||
|
@ -869,6 +904,7 @@ public class FFMPResource extends
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// System.out.println("FFMPResource.getQPERecord(): " + getTableTime());
|
||||
|
||||
return qpeRecord;
|
||||
}
|
||||
|
@ -876,9 +912,9 @@ public class FFMPResource extends
|
|||
/**
|
||||
* Gets the record currently used
|
||||
*
|
||||
* @return FFMPRecord
|
||||
* @return FFMPCacheRecord
|
||||
*/
|
||||
public FFMPRecord getGuidanceRecord() {
|
||||
public FFMPCacheRecord getGuidanceRecord() {
|
||||
try {
|
||||
if ((guidRecord == null) || isNewGuid) {
|
||||
Date date = null;
|
||||
|
@ -895,11 +931,13 @@ public class FFMPResource extends
|
|||
}
|
||||
|
||||
if (isWorstCase()) {
|
||||
guidRecord = monitor.getGuidanceRecord(getProduct(),
|
||||
getSiteKey(), sourceName, date, "ALL", isStandAlone);
|
||||
guidRecord = monitor
|
||||
.getGuidanceRecord(getProduct(), getSiteKey(),
|
||||
sourceName, date, "ALL", isStandAlone);
|
||||
} else {
|
||||
guidRecord = monitor.getGuidanceRecord(getProduct(),
|
||||
getSiteKey(), sourceName, date, getHuc(), isStandAlone);
|
||||
getSiteKey(), sourceName, date, getHuc(),
|
||||
isStandAlone);
|
||||
}
|
||||
|
||||
isNewGuid = false;
|
||||
|
@ -915,9 +953,9 @@ public class FFMPResource extends
|
|||
/**
|
||||
* Gets the record currently used
|
||||
*
|
||||
* @return FFMPRecord
|
||||
* @return FFMPReFFMPCacheRecordcord
|
||||
*/
|
||||
public FFMPRecord getQpfRecord(Date recentTime) {
|
||||
public FFMPCacheRecord getQpfRecord(Date recentTime) {
|
||||
try {
|
||||
if ((qpfRecord == null) && isNewQpf) {
|
||||
Date date = null;
|
||||
|
@ -951,9 +989,9 @@ public class FFMPResource extends
|
|||
/**
|
||||
* Gets the record currently used
|
||||
*
|
||||
* @return FFMPRecord
|
||||
* @return FFMPCacheRecord
|
||||
*/
|
||||
public FFMPRecord getVirtualRecord() {
|
||||
public FFMPCacheRecord getVirtualRecord() {
|
||||
try {
|
||||
if ((virtualRecord == null) && isNewVirtual) {
|
||||
virtualRecord = monitor.getVirtualRecord(getProduct(),
|
||||
|
@ -973,9 +1011,9 @@ public class FFMPResource extends
|
|||
* General get record call
|
||||
*
|
||||
* @param pfield
|
||||
* @return FFMPRecord
|
||||
* @return FFMPCacheRecord
|
||||
*/
|
||||
public FFMPRecord getRecord(FIELDS pfield, Date recentTime) {
|
||||
public FFMPCacheRecord getRecord(FIELDS pfield, Date recentTime) {
|
||||
if (pfield == FIELDS.GUIDANCE) {
|
||||
return getGuidanceRecord();
|
||||
} else if (pfield == FIELDS.RATIO) {
|
||||
|
@ -1051,12 +1089,12 @@ public class FFMPResource extends
|
|||
}
|
||||
|
||||
/**
|
||||
* DR 14522 fixing: enclosing font setting
|
||||
* into GUI thread to avoid invalid thread
|
||||
* access.
|
||||
* DR 14522 fixing: enclosing font setting into GUI thread to avoid invalid
|
||||
* thread access.
|
||||
*/
|
||||
@Override
|
||||
protected void initInternal(final IGraphicsTarget target) throws VizException {
|
||||
@Override
|
||||
protected void initInternal(final IGraphicsTarget target)
|
||||
throws VizException {
|
||||
EditableManager.makeEditable(this,
|
||||
getCapability(EditableCapability.class).isEditable());
|
||||
IDisplayPaneContainer container = getResourceContainer();
|
||||
|
@ -1081,40 +1119,45 @@ public class FFMPResource extends
|
|||
} catch (Exception ex) {
|
||||
statusHandler.handle(Priority.PROBLEM, "Error opening FFMP", ex);
|
||||
}
|
||||
|
||||
//DR 14522: use Display.getDefault().asyncExec() for GUI thread.
|
||||
org.eclipse.swt.widgets.Display.getDefault().asyncExec(new Runnable(){
|
||||
|
||||
public void run(){
|
||||
|
||||
if (/*this.*/font == null) {
|
||||
/*this.*/font = target.initializeFont("Dialog", 11, null);
|
||||
}
|
||||
|
||||
font.setMagnification(getCapability(MagnificationCapability.class)
|
||||
.getMagnification().floatValue());
|
||||
|
||||
if (/*this.*/xfont == null) {
|
||||
IFont.Style[] styles = new IFont.Style[] { IFont.Style.BOLD };
|
||||
/*this.*/xfont = target.initializeFont("Monospace", 12, styles);
|
||||
}
|
||||
// DR 14522: use Display.getDefault().asyncExec() for GUI thread.
|
||||
org.eclipse.swt.widgets.Display.getDefault().asyncExec(new Runnable() {
|
||||
|
||||
xfont.setMagnification(getCapability(MagnificationCapability.class)
|
||||
.getMagnification().floatValue());
|
||||
|
||||
fieldDescString = new DrawableString("FFMP " + df.format(getTime())
|
||||
+ " hour " + FFMPRecord.getFieldLongDescription(getField()),
|
||||
getCapability(ColorableCapability.class).getColor());
|
||||
fieldDescString.font = font;
|
||||
fieldDescString.horizontalAlignment = HorizontalAlignment.CENTER;
|
||||
fieldDescString.verticallAlignment = VerticalAlignment.MIDDLE;
|
||||
public void run() {
|
||||
|
||||
basinLocatorString = new DrawableString("X", new RGB(255, 255, 255));
|
||||
basinLocatorString.font = xfont;
|
||||
basinLocatorString.horizontalAlignment = HorizontalAlignment.CENTER;
|
||||
basinLocatorString.verticallAlignment = VerticalAlignment.MIDDLE;
|
||||
basinLocatorString.textStyle = TextStyle.BLANKED;
|
||||
}
|
||||
if (/* this. */font == null) {
|
||||
/* this. */font = target.initializeFont("Dialog", 11, null);
|
||||
}
|
||||
|
||||
font.setMagnification(getCapability(
|
||||
MagnificationCapability.class).getMagnification()
|
||||
.floatValue());
|
||||
|
||||
if (/* this. */xfont == null) {
|
||||
IFont.Style[] styles = new IFont.Style[] { IFont.Style.BOLD };
|
||||
/* this. */xfont = target.initializeFont("Monospace", 12,
|
||||
styles);
|
||||
}
|
||||
|
||||
xfont.setMagnification(getCapability(
|
||||
MagnificationCapability.class).getMagnification()
|
||||
.floatValue());
|
||||
|
||||
fieldDescString = new DrawableString("FFMP "
|
||||
+ df.format(getTime()) + " hour "
|
||||
+ FFMPRecord.getFieldLongDescription(getField()),
|
||||
getCapability(ColorableCapability.class).getColor());
|
||||
fieldDescString.font = font;
|
||||
fieldDescString.horizontalAlignment = HorizontalAlignment.CENTER;
|
||||
fieldDescString.verticallAlignment = VerticalAlignment.MIDDLE;
|
||||
|
||||
basinLocatorString = new DrawableString("X", new RGB(255, 255,
|
||||
255));
|
||||
basinLocatorString.font = xfont;
|
||||
basinLocatorString.horizontalAlignment = HorizontalAlignment.CENTER;
|
||||
basinLocatorString.verticallAlignment = VerticalAlignment.MIDDLE;
|
||||
basinLocatorString.textStyle = TextStyle.BLANKED;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1148,13 +1191,17 @@ public class FFMPResource extends
|
|||
FFMPDrawable drawable = null;
|
||||
|
||||
if (paintTime != null) {
|
||||
|
||||
if (loader != null && !loader.isDone && loader.loadType == LOADER_TYPE.GENERAL) {
|
||||
return;
|
||||
}
|
||||
if (!drawables.containsKey(paintTime)) {
|
||||
|
||||
drawable = new FFMPDrawable(getDomains());
|
||||
drawables.put(paintTime, drawable);
|
||||
} else {
|
||||
// we found it!
|
||||
drawable = drawables.get(paintTime);
|
||||
// System.out.println("Found the drawable");
|
||||
|
||||
if (!paintTime.equals(drawable.getTime())) {
|
||||
drawable.setDirty(true);
|
||||
|
@ -1174,10 +1221,12 @@ public class FFMPResource extends
|
|||
|
||||
if (getResourceData().tableLoad
|
||||
&& !paintTime.getRefTime().equals(getMostRecentTime())) {
|
||||
|
||||
setMostRecentTime(paintTime.getRefTime());
|
||||
setTableTime();
|
||||
monitor.updateDialog(this);
|
||||
// if (isLinkToFrame && loader != null && loader.loadType != LOADER_TYPE.GENERAL) {
|
||||
if (isLinkToFrame) {
|
||||
updateDialog();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (getResourceData().getMonitor().ffmpSplash != null) {
|
||||
|
@ -1464,11 +1513,25 @@ public class FFMPResource extends
|
|||
|
||||
@Override
|
||||
public void project(CoordinateReferenceSystem mapData) throws VizException {
|
||||
|
||||
|
||||
if (shadedShapes != null) {
|
||||
shadedShapes.clear();
|
||||
shadedShapes.clear();
|
||||
}
|
||||
|
||||
|
||||
if (streamShadedShape != null) {
|
||||
streamShadedShape.dispose();
|
||||
streamShadedShape = null;
|
||||
}
|
||||
if (streamOutlineShape != null) {
|
||||
streamOutlineShape.dispose();
|
||||
streamOutlineShape = null;
|
||||
}
|
||||
|
||||
if (smallBasinOverlayShape != null) {
|
||||
smallBasinOverlayShape.dispose();
|
||||
smallBasinOverlayShape = null;
|
||||
}
|
||||
|
||||
setQuery(true);
|
||||
refresh();
|
||||
}
|
||||
|
@ -1544,9 +1607,9 @@ public class FFMPResource extends
|
|||
if (getHuc().equals("ALL") || centeredAggregationKey != null) {
|
||||
pfaf = metaBasin.getPfaf();
|
||||
if (isMaintainLayer) {
|
||||
pfaf = monitor.getTemplates(getSiteKey()).findAggregatedPfaf(
|
||||
pfaf, getSiteKey(), getHuc());
|
||||
aggregate = true;
|
||||
pfaf = monitor.getTemplates(getSiteKey())
|
||||
.findAggregatedPfaf(pfaf, getSiteKey(), getHuc());
|
||||
aggregate = true;
|
||||
}
|
||||
} else {
|
||||
pfaf = monitor.getTemplates(getSiteKey()).findAggregatedPfaf(
|
||||
|
@ -1574,8 +1637,8 @@ public class FFMPResource extends
|
|||
if (val.isNaN() || (val == FFMPUtils.MISSING)) {
|
||||
valst = "NO DATA";
|
||||
} else {
|
||||
valst = df.format(getBasinValue(pfaf,
|
||||
getPaintTime().getRefTime(), aggregate));
|
||||
valst = df.format(getBasinValue(pfaf, getPaintTime()
|
||||
.getRefTime(), aggregate));
|
||||
}
|
||||
|
||||
if (!valst.equals("NO DATA")) {
|
||||
|
@ -1731,12 +1794,12 @@ public class FFMPResource extends
|
|||
if (getResourceData().tableLoad) {
|
||||
|
||||
if (isUpdateDialog) {
|
||||
monitor.updateDialog(this);
|
||||
updateDialog();
|
||||
}
|
||||
|
||||
// stops the annoying wait cursor every time you re-center
|
||||
if (getHuc().equals("ALL")
|
||||
&& (lowestCenter == FFMPRecord.ZOOM.BASIN)) {
|
||||
|| (lowestCenter == FFMPRecord.ZOOM.BASIN)) {
|
||||
basinTableDlg.getShell().setCursor(null);
|
||||
}
|
||||
}
|
||||
|
@ -1970,7 +2033,7 @@ public class FFMPResource extends
|
|||
for (Entry<DataTime, FFMPDrawable> entry : drawables.entrySet()) {
|
||||
entry.getValue().dispose();
|
||||
}
|
||||
|
||||
|
||||
drawables.clear();
|
||||
}
|
||||
}
|
||||
|
@ -2234,7 +2297,7 @@ public class FFMPResource extends
|
|||
public DataTime getPaintTime() {
|
||||
return paintTime;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a value to worst case hash
|
||||
*
|
||||
|
@ -2242,9 +2305,9 @@ public class FFMPResource extends
|
|||
* @param value
|
||||
*/
|
||||
private void addWorstCase(Long aggPfaf, Date recentTime, Float value) {
|
||||
if (drawables.get(new DataTime(recentTime)) != null) {
|
||||
drawables.get(new DataTime(recentTime)).worstCaseHash.put(aggPfaf,
|
||||
value);
|
||||
FFMPDrawable drawable = drawables.get(new DataTime(recentTime));
|
||||
if (drawable != null && drawable.worstCaseHash != null) {
|
||||
drawable.worstCaseHash.put(aggPfaf, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2409,7 +2472,7 @@ public class FFMPResource extends
|
|||
}
|
||||
if ((cwaBasins.size() == 0)
|
||||
|| !req.extent.equals(drawable.getExt())
|
||||
|| !phuc.equals(drawable.getHuc())) {
|
||||
|| !phuc.equals(drawable.getHuc()) || restoreTable) {
|
||||
Envelope env = null;
|
||||
try {
|
||||
Envelope e = req.descriptor.pixelToWorld(req.extent,
|
||||
|
@ -2434,7 +2497,8 @@ public class FFMPResource extends
|
|||
templates, getSiteKey(), cwa, phuc);
|
||||
for (Entry<Long, Envelope> entry : envMap.entrySet()) {
|
||||
|
||||
if (env.intersects(entry.getValue())) {
|
||||
if (env.intersects(entry.getValue())
|
||||
|| env.contains(entry.getValue())) {
|
||||
// add the individual basins
|
||||
cwaBasins.add(entry.getKey());
|
||||
}
|
||||
|
@ -2518,11 +2582,11 @@ public class FFMPResource extends
|
|||
// the
|
||||
// the basin when the color map changes.
|
||||
if (globalRegen || drawable.genCwa(cwa)) {
|
||||
//System.out
|
||||
//.println("Regenerating the entire image: CWA: +"
|
||||
//+ cwa
|
||||
//+ " Table:"
|
||||
//+ resourceData.tableLoad);
|
||||
// System.out
|
||||
// .println("Regenerating the entire image: CWA: +"
|
||||
// + cwa
|
||||
// + " Table:"
|
||||
// + resourceData.tableLoad);
|
||||
// get base aggr basins that are in screen area
|
||||
Set<Long> cwaPfafs = null;
|
||||
cwaPfafs = getAreaBasins(cwa, req, phuc);
|
||||
|
@ -2535,7 +2599,6 @@ public class FFMPResource extends
|
|||
} else {
|
||||
// center selected, determine center key
|
||||
if (!phuc.equals("ALL")) {
|
||||
|
||||
if (centeredAggregationKey instanceof String) {
|
||||
if (lowestCenter != ZOOM.BASIN) {
|
||||
|
||||
|
@ -2546,6 +2609,14 @@ public class FFMPResource extends
|
|||
} else {
|
||||
centeredAggr = (Long) drawable
|
||||
.getCenterAggrKey();
|
||||
// this is a fall back for VGB's
|
||||
if (centeredAggr == null) {
|
||||
centeredAggr = templates
|
||||
.findAggregatedVGB(
|
||||
(String) centeredAggregationKey,
|
||||
getSiteKey(),
|
||||
phuc);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -2554,6 +2625,13 @@ public class FFMPResource extends
|
|||
} else {
|
||||
centeredAggr = (Long) drawable
|
||||
.getCenterAggrKey();
|
||||
if (centeredAggr == null) {
|
||||
centeredAggr = templates
|
||||
.getAggregatedPfaf(
|
||||
(Long) centeredAggregationKey,
|
||||
getSiteKey(),
|
||||
phuc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2728,6 +2806,10 @@ public class FFMPResource extends
|
|||
}
|
||||
}
|
||||
|
||||
if (restoreTable) {
|
||||
restoreTable = false;
|
||||
}
|
||||
|
||||
drawable.setTime(req.time);
|
||||
if (lowestCenter != ZOOM.BASIN) {
|
||||
drawable.setCenterAggrKey(centeredAggregationKey);
|
||||
|
@ -2782,6 +2864,11 @@ public class FFMPResource extends
|
|||
|
||||
// check whether or not the dialog needs to be dumped
|
||||
monitor.splashDisposeAndDataLoad(getResource());
|
||||
|
||||
if (getResourceData().tableLoad && isFirst) {
|
||||
isFirst = false;
|
||||
updateDialog();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -3006,13 +3093,13 @@ public class FFMPResource extends
|
|||
centeredAggregatePfafList = null;
|
||||
|
||||
if (isAutoRefresh) {
|
||||
if (basinTableDlg != null) {
|
||||
// Gets rid of the aggregate name if it is zoomed into one
|
||||
basinTableDlg.blankGroupLabel();
|
||||
}
|
||||
clearTables();
|
||||
hucChanged();
|
||||
refresh();
|
||||
if (basinTableDlg != null) {
|
||||
// Gets rid of the aggregate name if it is zoomed into one
|
||||
basinTableDlg.blankGroupLabel();
|
||||
}
|
||||
clearTables();
|
||||
hucChanged();
|
||||
refresh();
|
||||
}
|
||||
|
||||
updateDialog();
|
||||
|
@ -3022,12 +3109,12 @@ public class FFMPResource extends
|
|||
public void timeChanged(FFMPTimeChangeEvent fhce, FFMPRecord.FIELDS fieldArg)
|
||||
throws VizException {
|
||||
|
||||
FFMPTime ffmpTime = (FFMPTime) fhce.getSource();
|
||||
|
||||
FFMPTime ffmpTime = (FFMPTime) fhce.getSource();
|
||||
|
||||
if (ffmpTime.getTime() != time || isSplit != ffmpTime.isSplit()) {
|
||||
|
||||
isSplit = ffmpTime.isSplit();
|
||||
setTime(ffmpTime.getTime());
|
||||
isSplit = ffmpTime.isSplit();
|
||||
setTime(ffmpTime.getTime());
|
||||
setTableTime();
|
||||
if (interpolationMap != null) {
|
||||
interpolationMap.clear();
|
||||
|
@ -3112,6 +3199,7 @@ public class FFMPResource extends
|
|||
}
|
||||
|
||||
refresh();
|
||||
|
||||
updateDialog();
|
||||
}
|
||||
|
||||
|
@ -3145,6 +3233,7 @@ public class FFMPResource extends
|
|||
public void restoreTable() {
|
||||
centeredAggregationKey = null;
|
||||
centeredAggregatePfafList = null;
|
||||
restoreTable = true;
|
||||
|
||||
lowestCenter = FFMPRecord.ZOOM.WFO;
|
||||
getDescriptor().getRenderableDisplay().getExtent().reset();
|
||||
|
@ -3168,7 +3257,8 @@ public class FFMPResource extends
|
|||
@Override
|
||||
public FFMPGraphData getGraphData(String pfafString) throws VizException {
|
||||
FfmpTableConfig tableConfig = FfmpTableConfig.getInstance();
|
||||
String ffgGraphType = tableConfig.getTableConfigData(getSiteKey()).getFfgGraphType();
|
||||
String ffgGraphType = tableConfig.getTableConfigData(getSiteKey())
|
||||
.getFfgGraphType();
|
||||
Long basinPfaf = null;
|
||||
Long dataId = null;
|
||||
FFMPVirtualGageBasinMetaData fvgbmd = null;
|
||||
|
@ -3342,7 +3432,7 @@ public class FFMPResource extends
|
|||
|
||||
if (fvgbmd != null) {
|
||||
try {
|
||||
// VGB's use a different timing sequence
|
||||
// VGB's use a different timing sequenceFFMPResource
|
||||
String lid = fvgbmd.getLid();
|
||||
|
||||
virtualBasin = monitor.getVirtualGageBasinData(dataId, lid,
|
||||
|
@ -3502,13 +3592,18 @@ public class FFMPResource extends
|
|||
* Sets the time used for accumulation drawn from the slider time
|
||||
*/
|
||||
private void setTableTime() {
|
||||
|
||||
Date recentTime = getMostRecentTime();
|
||||
long time = new Double(recentTime.getTime() - (1000 * 3600) * getTime())
|
||||
.longValue();
|
||||
Date date = new Date();
|
||||
date.setTime(time);
|
||||
this.tableTime = date;
|
||||
if (tableTime == null) {
|
||||
tableTime = new Date();
|
||||
}
|
||||
|
||||
synchronized (tableTime) {
|
||||
Date recentTime = getMostRecentTime();
|
||||
long time = new Double(recentTime.getTime() - (1000 * 3600)
|
||||
* getTime()).longValue();
|
||||
Date date = new Date();
|
||||
date.setTime(time);
|
||||
this.tableTime = date;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3666,9 +3761,10 @@ public class FFMPResource extends
|
|||
* @param set
|
||||
* @return ordered dates
|
||||
*/
|
||||
public ArrayList<Date> getTimeOrderedKeys() {
|
||||
if (timeOrderedKeys == null) {
|
||||
|
||||
public synchronized ArrayList<Date> getTimeOrderedKeys() {
|
||||
if (timeOrderedKeys == null || !toKeysInitialized) {
|
||||
toKeysInitialized = true;
|
||||
|
||||
// stand alone displays use this
|
||||
timeOrderedKeys = new ArrayList<Date>();
|
||||
|
||||
|
@ -3849,9 +3945,9 @@ public class FFMPResource extends
|
|||
public boolean isLinkToFrame() {
|
||||
return isLinkToFrame;
|
||||
}
|
||||
|
||||
|
||||
public boolean isSplit() {
|
||||
return isSplit;
|
||||
return isSplit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3966,31 +4062,30 @@ public class FFMPResource extends
|
|||
}
|
||||
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();
|
||||
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;
|
||||
}
|
||||
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
|
||||
*
|
||||
|
@ -4000,12 +4095,13 @@ public class FFMPResource extends
|
|||
if (guidSourceExpiration == 0l) {
|
||||
if (getProduct() != null) {
|
||||
|
||||
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData().getIncludedGuids();
|
||||
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
|
||||
.getIncludedGuids();
|
||||
if (guidSrc.contains(",")) {
|
||||
String[] parts = guidSrc.split(",");
|
||||
guidSrc = parts[0];
|
||||
}
|
||||
SourceXML source = getProduct().getGuidanceSourcesByType(
|
||||
SourceXML source = getProduct().getGuidanceSourcesByType(
|
||||
guidSrc).get(0);
|
||||
guidSourceExpiration = source
|
||||
.getExpirationMinutes(getSiteKey()) * 60 * 1000;
|
||||
|
@ -4068,7 +4164,8 @@ public class FFMPResource extends
|
|||
String ffgName = null;
|
||||
|
||||
if (getResourceData().tableLoad) {
|
||||
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData().getGuidSrc();
|
||||
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
|
||||
.getGuidSrc();
|
||||
if (guidSrc.startsWith("xxx")) {
|
||||
ffgName = "";
|
||||
} else {
|
||||
|
@ -4155,9 +4252,7 @@ public class FFMPResource extends
|
|||
ArrayList<String> hucsToLoad = new ArrayList<String>();
|
||||
|
||||
if (isWorstCase) {
|
||||
if (!hucsToLoad.contains("ALL")) {
|
||||
hucsToLoad.add("ALL");
|
||||
}
|
||||
hucsToLoad.add("ALL");
|
||||
}
|
||||
|
||||
// tertiary loader only loads ALL
|
||||
|
@ -4190,62 +4285,61 @@ public class FFMPResource extends
|
|||
loader.removeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the purge file time
|
||||
*/
|
||||
public long getPurgePeriod() {
|
||||
|
||||
IPathManager pm = PathManagerFactory.getPathManager();
|
||||
LocalizationContext lc = pm.getContext(
|
||||
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
|
||||
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;
|
||||
} */
|
||||
|
||||
|
||||
// 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;
|
||||
|
||||
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);
|
||||
|
||||
if (status.getLoaderType() == LOADER_TYPE.SECONDARY) {
|
||||
if (status.isDone() && !this.getResourceData().isTertiaryLoad) {
|
||||
try {
|
||||
Date startDate = new Date(getMostRecentTime().getTime()
|
||||
- (6 * 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
|
||||
}
|
||||
}
|
||||
|
||||
// We don't really care about status of tertiary and general loaders
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.rsc;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.NavigableMap;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
|
@ -40,7 +42,6 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
|||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
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.FFMPTemplateConfigurationManager;
|
||||
import com.raytheon.uf.common.monitor.xml.DomainXML;
|
||||
import com.raytheon.uf.common.monitor.xml.ProductRunXML;
|
||||
import com.raytheon.uf.common.monitor.xml.ProductXML;
|
||||
|
@ -230,23 +231,62 @@ public class FFMPResourceData extends AbstractRequestableResourceData {
|
|||
this.timeBack = new Date(
|
||||
(long) (mostRecentTime.getRefTime().getTime() - (cfgBasinXML
|
||||
.getTimeFrame() * 3600 * 1000)));
|
||||
ArrayList<String> hucsToLoad = FFMPTemplateConfigurationManager.getInstance().getHucLevels();
|
||||
ArrayList<String> hucsToLoad = monitor.getTemplates(siteKey).getTemplateMgr().getHucLevels();
|
||||
//ArrayList<String> hucsToLoad = new ArrayList<String>();
|
||||
//hucsToLoad.add(cfgBasinXML.getLayer());
|
||||
//hucsToLoad.add("ALL");
|
||||
// goes back X hours and pre populates the Data Hashes
|
||||
FFMPDataLoader loader = new FFMPDataLoader(this, timeBack,
|
||||
mostRecentTime.getRefTime(), LOADER_TYPE.INITIAL,
|
||||
hucsToLoad);
|
||||
loader.start();
|
||||
|
||||
} else {
|
||||
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 > 4000) {
|
||||
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 {
|
||||
/*
|
||||
* This appears completely un-orthodox for anything in D2D. But
|
||||
* alas FFMP always does things differently. According to Vada
|
||||
* Driesbach, FFMP in stand alone mode functions similarly to
|
||||
* the way it does in table mode. Meaning you have to reach back
|
||||
* and find time windows for the source displayed +- the
|
||||
* expirationTime. None of the sources are displayed for exact
|
||||
* times like everything else in D2D. This forces us to use the
|
||||
* same Data Population methods the table uses. The only
|
||||
* difference here is they are done for single sources.
|
||||
*/
|
||||
|
||||
SourceXML source = getPrimarySourceXML();
|
||||
this.domains = monitor.getRunConfig().getDomains();
|
||||
|
||||
for (int i = 0; i < objects.length; i++) {
|
||||
FFMPRecord rec = (FFMPRecord) objects[i];
|
||||
rec.setExpiration(source.getExpirationMinutes(siteKey));
|
||||
rec.setRate(source.isRate());
|
||||
populateRecord(getProduct(), rec, huc);
|
||||
SourceXML source = monitor.getSourceConfig().getSource(
|
||||
sourceName);
|
||||
|
||||
if (source != null) {
|
||||
|
||||
long oldestTime = availableTimes[0].getRefTime().getTime();
|
||||
long expirationTime = source.getExpirationMinutes(siteKey) * 60 * 1000;
|
||||
Date standAloneTime = new Date(oldestTime - expirationTime);
|
||||
|
||||
NavigableMap<Date, List<String>> sourceURIs = getMonitor()
|
||||
.getAvailableUris(siteKey, dataKey, sourceName,
|
||||
standAloneTime);
|
||||
getMonitor().processUris(sourceURIs, false, siteKey,
|
||||
sourceName, standAloneTime, "ALL");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,8 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpBasinTableDlg;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 13, 2011 dhladky Initial creation
|
||||
* Oct 13, 2011 dhladky Initial creation.
|
||||
* Jul 31, 2012 14517 mpduff Fix for Rapid slider changes
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -49,7 +50,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpBasinTableDlg;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class FFMPTableDataLoader implements Runnable {
|
||||
public class FFMPTableDataLoader extends Thread {
|
||||
|
||||
private IMonitorEvent fme = null;
|
||||
|
||||
|
@ -64,6 +65,8 @@ public class FFMPTableDataLoader implements Runnable {
|
|||
private Date date = null;
|
||||
|
||||
private FfmpBasinTableDlg callback = null;
|
||||
|
||||
private boolean isDone = false;
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FFMPTableDataLoader.class);
|
||||
|
@ -96,7 +99,6 @@ public class FFMPTableDataLoader implements Runnable {
|
|||
public void run() {
|
||||
|
||||
if (fme.getSource() instanceof FFMPMonitor) {
|
||||
|
||||
FFMPTableDataUpdate tableDataUpdate = new FFMPTableDataUpdate();
|
||||
FFMPMonitor ffmp = (FFMPMonitor) fme.getSource();
|
||||
|
||||
|
@ -109,12 +111,12 @@ public class FFMPTableDataLoader implements Runnable {
|
|||
|
||||
FFMPTableData tData = null;
|
||||
|
||||
try {
|
||||
|
||||
FFMPDrawable drawable = resource.getDrawable(resource
|
||||
.getPaintTime());
|
||||
|
||||
if ((drawable != null)
|
||||
try {
|
||||
|
||||
FFMPDrawable drawable = resource.getDrawable(resource
|
||||
.getPaintTime());
|
||||
|
||||
if ((drawable != null)
|
||||
&& (drawable.getDrawTime() == resource
|
||||
.getTime())) {
|
||||
String iHuc = null;
|
||||
|
@ -124,8 +126,7 @@ public class FFMPTableDataLoader implements Runnable {
|
|||
iHuc = "ALL";
|
||||
}
|
||||
if (drawable.getTableData(iHuc) != null) {
|
||||
|
||||
//System.out.println(" Cache HITTTTTTTTT!!!!!");
|
||||
// System.out.println(" Cache HITTTTTTTTT!!!!!");
|
||||
tData = drawable.getTableData(iHuc);
|
||||
}
|
||||
}
|
||||
|
@ -140,13 +141,15 @@ public class FFMPTableDataLoader implements Runnable {
|
|||
iHuc = "ALL";
|
||||
}
|
||||
|
||||
//System.out
|
||||
// .println(" Cache MISSSSSSSSSSSS!!!!!");
|
||||
// System.out
|
||||
// .println(" Cache MISSSSSSSSSSSS!!!!!");
|
||||
|
||||
double origDrawTime = resource.getTime();
|
||||
FFMPDataGenerator dg = new FFMPDataGenerator(
|
||||
ffmp, resource);
|
||||
tData = dg.generateFFMPData();
|
||||
drawable.setTableData(iHuc, tData);
|
||||
drawable.setDrawTime(resource.getTime());
|
||||
drawable.setDrawTime(origDrawTime);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -174,8 +177,7 @@ public class FFMPTableDataLoader implements Runnable {
|
|||
tableDataUpdate.setFireGraph(true);
|
||||
tableDataUpdate.setGraphPfaf(basinTrendDlg
|
||||
.getPfaf());
|
||||
tableDataUpdate.setGraphTime(resource
|
||||
.getTableTime());
|
||||
tableDataUpdate.setGraphTime(resource.getMostRecentTime());
|
||||
}
|
||||
|
||||
sourceUpdate = false;
|
||||
|
@ -204,8 +206,14 @@ public class FFMPTableDataLoader implements Runnable {
|
|||
tableDataUpdate.setGapValueLabel(gapVal);
|
||||
tableDataUpdate.setAllowNewTableUpdate(allowNewTableUpdate);
|
||||
tableDataUpdate.setSourceUpdate(sourceUpdate);
|
||||
|
||||
isDone = true;
|
||||
|
||||
callback.tableDataUpdateComplete(tableDataUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return isDone;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,8 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 13, 2009 dhladky Initial creation
|
||||
*
|
||||
* Jul 24 2012 12996 Xiaochuan Compare with MidVal()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -359,7 +361,7 @@ public class ScanResource extends
|
|||
d = Double.valueOf(rank);
|
||||
}
|
||||
|
||||
if (d >= getScanDrawer().ddfc.getLowerVal()) {
|
||||
if (d >= getScanDrawer().ddfc.getMidVal()) {
|
||||
if (!getScanDrawer().ddfc.isOverlap()) {
|
||||
if ((dtdr != null) && !dtdr.getOverlap()) {
|
||||
isOverlap = false;
|
||||
|
|
|
@ -902,192 +902,232 @@ public final class TableUtil {
|
|||
return null;
|
||||
}
|
||||
|
||||
private static TableRowData getSnowMetarHistTableRowData(ObReport report) {
|
||||
TableRowData tblRowData = new TableRowData(8);
|
||||
tblRowData.setTableCellData(0, new TableCellData(report.getObservationTime(),"HH:mm MMM dd",CellType.ObsHist));
|
||||
tblRowData.setTableCellData(1,
|
||||
new TableCellData(Math.round(new Float(report.getWindDir())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(2,
|
||||
new TableCellData(Math.round(new Float(report.getWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(3,
|
||||
new TableCellData(Math.round(new Float(report.getWindGust())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(4, new TableCellData(report.getPressure(), CellType.ObsHist, CommonTableConfig.obsHistCols.P));
|
||||
tblRowData.setTableCellData(
|
||||
5,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getTemperature())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(6,
|
||||
new TableCellData(Math.round(new Float(report.getDewpoint())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(7, new TableCellData(report.getPressureChange(), CellType.ObsHist, CommonTableConfig.obsHistCols.PTend));
|
||||
return tblRowData;
|
||||
}
|
||||
private static TableRowData getSnowMetarHistTableRowData(ObReport report) {
|
||||
TableRowData tblRowData = new TableRowData(10);
|
||||
tblRowData.setTableCellData(0,
|
||||
new TableCellData(report.getObservationTime(), "HH:mm MMM dd",
|
||||
CellType.ObsHist));
|
||||
tblRowData.setTableCellData(1,
|
||||
new TableCellData(new Float(report.getLatitude()),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(2,
|
||||
new TableCellData(new Float(report.getLongitude()),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(3,
|
||||
new TableCellData(Math.round(new Float(report.getWindDir())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(4,
|
||||
new TableCellData(Math.round(new Float(report.getWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(5,
|
||||
new TableCellData(Math.round(new Float(report.getWindGust())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(6, new TableCellData(report.getPressure(),
|
||||
CellType.ObsHist, CommonTableConfig.obsHistCols.P));
|
||||
tblRowData.setTableCellData(7,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getTemperature())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(8,
|
||||
new TableCellData(Math.round(new Float(report.getDewpoint())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(9,
|
||||
new TableCellData(report.getPressureChange(), CellType.ObsHist,
|
||||
CommonTableConfig.obsHistCols.PTend));
|
||||
return tblRowData;
|
||||
}
|
||||
|
||||
private static TableRowData getSafeSeasMetarHistTableRowData(ObReport report) {
|
||||
// same as getSnowHistTableRowData
|
||||
return getSnowMetarHistTableRowData(report);
|
||||
}
|
||||
|
||||
private static TableRowData getSafeseasMaritimeHistTableRowData(ObReport report) {
|
||||
TableRowData tblRowData = new TableRowData(15);
|
||||
tblRowData.setTableCellData(0, new TableCellData(report.getObservationTime(),"HH:mm MMM dd",CellType.ObsHist));
|
||||
tblRowData.setTableCellData(1,
|
||||
new TableCellData(Math.round(new Float(report.getWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
2,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getMaxWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(3,
|
||||
new TableCellData(Math.round(new Float(report.getWindGust())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(4,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getVisibility())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(5, new TableCellData(report.getPressure(), CellType.ObsHist, CommonTableConfig.obsHistCols.P));
|
||||
tblRowData.setTableCellData(
|
||||
6,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getPressureChange())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
7,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getTemperature())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(8,
|
||||
new TableCellData(Math.round(new Float(report.getDewpoint())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
9,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getSeaSurfaceTemp())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
10,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getHighResWaveHeight())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
11,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getWaveSteepness())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
12,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getPSwellHeight())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
13,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getPSwellPeriod())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(14,
|
||||
new TableCellData(Math.round(new Float(report.getPSwellDir())),
|
||||
CellType.ObsHist, true));
|
||||
return tblRowData;
|
||||
}
|
||||
private static TableRowData getSafeseasMaritimeHistTableRowData(
|
||||
ObReport report) {
|
||||
TableRowData tblRowData = new TableRowData(17);
|
||||
tblRowData.setTableCellData(0,
|
||||
new TableCellData(report.getObservationTime(), "HH:mm MMM dd",
|
||||
CellType.ObsHist));
|
||||
tblRowData.setTableCellData(1,
|
||||
new TableCellData(new Float(report.getLatitude()),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(2,
|
||||
new TableCellData(new Float(report.getLongitude()),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(3,
|
||||
new TableCellData(Math.round(new Float(report.getWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
4,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getMaxWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(5,
|
||||
new TableCellData(Math.round(new Float(report.getWindGust())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(6,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getVisibility())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(7, new TableCellData(report.getPressure(),
|
||||
CellType.ObsHist, CommonTableConfig.obsHistCols.P));
|
||||
tblRowData.setTableCellData(
|
||||
8,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getPressureChange())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
9,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getTemperature())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(10,
|
||||
new TableCellData(Math.round(new Float(report.getDewpoint())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
11,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getSeaSurfaceTemp())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
12,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getHighResWaveHeight())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
13,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getWaveSteepness())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
14,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getPSwellHeight())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
15,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getPSwellPeriod())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(16,
|
||||
new TableCellData(Math.round(new Float(report.getPSwellDir())),
|
||||
CellType.ObsHist, true));
|
||||
return tblRowData;
|
||||
}
|
||||
|
||||
private static TableRowData getFogMaritimeHistTableRowData(ObReport report) {
|
||||
TableRowData tblRowData = new TableRowData(16);
|
||||
tblRowData.setTableCellData(0, new TableCellData(report.getObservationTime(),"HH:mm MMM dd",CellType.ObsHist));
|
||||
tblRowData.setTableCellData(1,
|
||||
new TableCellData(Math.round(new Float(report.getWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
2,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getMaxWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(3,
|
||||
new TableCellData(Math.round(new Float(report.getWindGust())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(4,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getVisibility())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(5, new TableCellData(report.getPressure(), CellType.ObsHist, CommonTableConfig.obsHistCols.P));
|
||||
tblRowData.setTableCellData(
|
||||
6,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getPressureChange())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
7,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getTemperature())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(8,
|
||||
new TableCellData(Math.round(new Float(report.getDewpoint())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
9,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getSeaSurfaceTemp())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
10,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getHighResWaveHeight())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
11,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getWaveSteepness())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
12,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getPSwellHeight())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
13,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getPSwellPeriod())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(14,
|
||||
new TableCellData(Math.round(new Float(report.getPSwellDir())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
15,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getRelativeHumidity())), CellType.ObsHist, true));
|
||||
return tblRowData;
|
||||
}
|
||||
private static TableRowData getFogMaritimeHistTableRowData(ObReport report) {
|
||||
TableRowData tblRowData = new TableRowData(18);
|
||||
tblRowData.setTableCellData(0,
|
||||
new TableCellData(report.getObservationTime(), "HH:mm MMM dd",
|
||||
CellType.ObsHist));
|
||||
tblRowData.setTableCellData(1,
|
||||
new TableCellData(new Float(report.getLatitude()),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(2,
|
||||
new TableCellData(new Float(report.getLongitude()),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(3,
|
||||
new TableCellData(Math.round(new Float(report.getWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
4,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getMaxWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(5,
|
||||
new TableCellData(Math.round(new Float(report.getWindGust())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(6,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getVisibility())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(7, new TableCellData(report.getPressure(),
|
||||
CellType.ObsHist, CommonTableConfig.obsHistCols.P));
|
||||
tblRowData.setTableCellData(
|
||||
8,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getPressureChange())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
9,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getTemperature())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(10,
|
||||
new TableCellData(Math.round(new Float(report.getDewpoint())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
11,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getSeaSurfaceTemp())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
12,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getHighResWaveHeight())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
13,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getWaveSteepness())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
14,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getPSwellHeight())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
15,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getPSwellPeriod())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(16,
|
||||
new TableCellData(Math.round(new Float(report.getPSwellDir())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
17,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getRelativeHumidity())), CellType.ObsHist, true));
|
||||
return tblRowData;
|
||||
}
|
||||
|
||||
private static TableRowData getFogMetarHistTableRowData(ObReport report) {
|
||||
TableRowData tblRowData = new TableRowData(12);
|
||||
tblRowData.setTableCellData(0, new TableCellData(report.getObservationTime(),"HH:mm MMM dd",CellType.ObsHist));
|
||||
tblRowData.setTableCellData(
|
||||
1,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getRelativeHumidity())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(2,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getVisibility())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(3,
|
||||
new TableCellData(Math.round(new Float(report.getCeiling())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(4,
|
||||
new TableCellData(Math.round(new Float(report.getWindDir())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(5,
|
||||
new TableCellData(Math.round(new Float(report.getWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(6,
|
||||
new TableCellData(Math.round(new Float(report.getWindGust())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(7, new TableCellData(report.getPressure(), CellType.ObsHist, CommonTableConfig.obsHistCols.P));
|
||||
int tmph = Math.round(new Float(report.getTemperature()));
|
||||
int dpth = Math.round(new Float(report.getDewpoint()));
|
||||
tblRowData.setTableCellData(8, new TableCellData(tmph,
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(9, new TableCellData(dpth,
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(10, new TableCellData(tmph - dpth,
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(11, new TableCellData(report.getPressureChange(), CellType.ObsHist, CommonTableConfig.obsHistCols.PTend));
|
||||
return tblRowData;
|
||||
}
|
||||
private static TableRowData getFogMetarHistTableRowData(ObReport report) {
|
||||
TableRowData tblRowData = new TableRowData(14);
|
||||
tblRowData.setTableCellData(0,
|
||||
new TableCellData(report.getObservationTime(), "HH:mm MMM dd",
|
||||
CellType.ObsHist));
|
||||
tblRowData.setTableCellData(1,
|
||||
new TableCellData(new Float(report.getLatitude()),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(2,
|
||||
new TableCellData(new Float(report.getLongitude()),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(
|
||||
3,
|
||||
new TableCellData(Math.round(new Float(report
|
||||
.getRelativeHumidity())), CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(4,
|
||||
new TableCellData(
|
||||
Math.round(new Float(report.getVisibility())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(5,
|
||||
new TableCellData(Math.round(new Float(report.getCeiling())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(6,
|
||||
new TableCellData(Math.round(new Float(report.getWindDir())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(7,
|
||||
new TableCellData(Math.round(new Float(report.getWindSpeed())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(8,
|
||||
new TableCellData(Math.round(new Float(report.getWindGust())),
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(9, new TableCellData(report.getPressure(),
|
||||
CellType.ObsHist, CommonTableConfig.obsHistCols.P));
|
||||
int tmph = Math.round(new Float(report.getTemperature()));
|
||||
int dpth = Math.round(new Float(report.getDewpoint()));
|
||||
tblRowData.setTableCellData(10, new TableCellData(tmph,
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(11, new TableCellData(dpth,
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(12, new TableCellData(tmph - dpth,
|
||||
CellType.ObsHist, true));
|
||||
tblRowData.setTableCellData(13,
|
||||
new TableCellData(report.getPressureChange(), CellType.ObsHist,
|
||||
CommonTableConfig.obsHistCols.PTend));
|
||||
return tblRowData;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ public class StationTableComp extends TableComp {
|
|||
* @param name
|
||||
*/
|
||||
public void setIdLabel(String name) {
|
||||
idLbl.setText("Zone/County: " + name);
|
||||
idLbl.setText("Zone/County: "+ this.id +" - "+ name);
|
||||
controlComp.layout();
|
||||
}
|
||||
|
||||
|
|
|
@ -67,9 +67,12 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* replaced deprecated function calls
|
||||
* replaced deprecated function calls
|
||||
* Feb 10, 2011 8030 bkowal access to the plots ArrayList is now synchronized
|
||||
* Feb 15, 2011 8036 bkowal magnification only affects the x-axis, wind bards, and
|
||||
* Feb 15, 2011 8036 bkowal magnification only affects the x-axis, wind barbs, and
|
||||
* the color bar.
|
||||
*
|
||||
* ======================================
|
||||
* AWIPS2 DR Work
|
||||
* 08/10/2012 1035 jkorman Changed number of 'staffs' from 12 to 13 and changed time
|
||||
* display to match AWIPS I.
|
||||
* </pre>
|
||||
*
|
||||
* @author dhladky
|
||||
|
@ -81,6 +84,8 @@ public class ProfilerResource extends
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ProfilerResource.class);
|
||||
|
||||
private static final int NUM_PROFILE_STAFFS = 13;
|
||||
|
||||
/* Graphic target */
|
||||
private IGraphicsTarget target = null;
|
||||
|
||||
|
@ -137,7 +142,7 @@ public class ProfilerResource extends
|
|||
protected void initInternal(IGraphicsTarget target) throws VizException {
|
||||
this.target = target;
|
||||
dataTimes = new ArrayList<DataTime>();
|
||||
incX = (ProfilerUtils.profilerRectangle.width / 12);
|
||||
incX = (ProfilerUtils.profilerRectangle.width / NUM_PROFILE_STAFFS);
|
||||
|
||||
incYheight = ProfilerUtils.profilerRectangle.height / maxY;
|
||||
|
||||
|
@ -222,7 +227,7 @@ public class ProfilerResource extends
|
|||
earliestTime = Math.min(earliestTime, validTime);
|
||||
latestTime = Math.max(latestTime, validTime);
|
||||
}
|
||||
long earliestRequestTime = earliestTime - 12 * 3600000;
|
||||
long earliestRequestTime = earliestTime - NUM_PROFILE_STAFFS * 3600000;
|
||||
List<DataTime> requestTimes = new ArrayList<DataTime>();
|
||||
for (DataTime time : resourceData.getAvailableTimes()) {
|
||||
long validTime = time.getValidTime().getTimeInMillis();
|
||||
|
@ -343,7 +348,7 @@ public class ProfilerResource extends
|
|||
if (x < 0) {
|
||||
continue;
|
||||
}
|
||||
if (x >= 12) {
|
||||
if (x >= NUM_PROFILE_STAFFS) {
|
||||
continue;
|
||||
}
|
||||
ArrayList<PlotObject> plots = entry.getValue();
|
||||
|
@ -463,9 +468,10 @@ public class ProfilerResource extends
|
|||
}
|
||||
|
||||
Calendar c = paintProps.getDataTime().getValidTime();
|
||||
for (int i = 0; i < 12; i++) {
|
||||
for (int i = 0; i < NUM_PROFILE_STAFFS; i++) {
|
||||
|
||||
String d = String.format("%1$tH:%1$tM", c);
|
||||
// String d = String.format("%1$tH:%1$tM", c);
|
||||
String d = String.format("%1$tH", c);
|
||||
parameters.setText(d, ProfilerUtils.GRAPH_COLOR);
|
||||
parameters.basics.x = ProfilerUtils.profilerRectangle.x
|
||||
+ (i * incX) + (incX / 2);
|
||||
|
|
|
@ -61,7 +61,6 @@ import com.raytheon.rcm.mqsrvr.ReqObj;
|
|||
import com.raytheon.rcm.rmr.RmrEvent;
|
||||
import com.raytheon.uf.common.dataplugin.radar.request.RadarServerConnectionRequest;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.preferences.JMSPreferences;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
// TODO: use of queueSession outside synchronized(stateLock) could cause
|
||||
|
@ -69,6 +68,23 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
|
|||
|
||||
// TODO: conflicts over setting fatalMsg
|
||||
|
||||
/**
|
||||
* Manages client connection to RadarServer
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ------------ --------------------------
|
||||
* ???? D. Friedman Initial version
|
||||
* 2012-07-27 DR 14896 D. Friedman Fix even topic name
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author dfriedma
|
||||
* @version 1.0
|
||||
*/
|
||||
public class RcmClient implements MessageListener, ExceptionListener {
|
||||
|
||||
private String connectionURL;
|
||||
|
@ -211,6 +227,11 @@ public class RcmClient implements MessageListener, ExceptionListener {
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: ActiveMQ is hard-coded. If switching to Qpid or another
|
||||
* service, it may be necessary to use JMSPreferences.getPolicyString on
|
||||
* the topic name below.
|
||||
*/
|
||||
ActiveMQConnectionFactory connFac = new ActiveMQConnectionFactory(uri);
|
||||
// This stuff can block...
|
||||
try {
|
||||
|
@ -238,8 +259,7 @@ public class RcmClient implements MessageListener, ExceptionListener {
|
|||
topicConn.setExceptionListener(this);
|
||||
topicSession = topicConn.createTopicSession(false,
|
||||
Session.AUTO_ACKNOWLEDGE);
|
||||
topic = topicSession.createTopic(JMSPreferences
|
||||
.getPolicyString("RadarEvents"));
|
||||
topic = topicSession.createTopic("RadarEvents");
|
||||
|
||||
queueConn.start();
|
||||
topicConn.start();
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#include <colorUtil>
|
||||
#include <indexing>
|
||||
|
||||
// Multiplier used to store bit mask safely between 0-1
|
||||
const float maskMultiplier = 8.0;
|
||||
|
||||
uniform sampler2D rawTex;
|
||||
uniform float naturalMin;
|
||||
uniform float naturalMax;
|
||||
|
@ -14,43 +17,74 @@ uniform sampler2D trueColorTexture;
|
|||
uniform int height;
|
||||
uniform int width;
|
||||
|
||||
uniform float noDataValue;
|
||||
uniform float alphaStep;
|
||||
uniform int expectedMask;
|
||||
|
||||
int toBitMask(float alpha) {
|
||||
return int((alpha * maskMultiplier) + 0.5);
|
||||
}
|
||||
|
||||
float getIndex(sampler2D rawTex, float cmapMin, float cmapMax, float naturalMin, float naturalMax, int isFloat) {
|
||||
vec4 textureValue = texture2D(rawTex, gl_TexCoord[0].st);
|
||||
float naturalVal = textureValue.r;
|
||||
if ( isFloat == 0 ) {
|
||||
naturalVal = ((naturalVal * (naturalMax - naturalMin)) + naturalMin);
|
||||
}
|
||||
float index = findIndex(naturalVal, cmapMin, cmapMax);
|
||||
if (index < 0.0 || index > 1.0) {
|
||||
index = -1.0;
|
||||
|
||||
float index = -1.0;
|
||||
if (naturalVal != noDataValue && naturalVal == naturalVal) {
|
||||
index = findIndex(naturalVal, cmapMin, cmapMax);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec2 xy = gl_FragCoord.xy;
|
||||
vec4 imageVal = texture2D(rawTex,gl_TexCoord[0].st);
|
||||
vec4 curVal = texture2D(trueColorTexture, vec2((xy.x / float(width)), (xy.y / float(height))));
|
||||
|
||||
float r = curVal.r;
|
||||
float g = curVal.g;
|
||||
float b = curVal.b;
|
||||
float a = curVal.a;
|
||||
|
||||
float index = getIndex(rawTex, cmapMin, cmapMax, naturalMin, naturalMax, isFloat);
|
||||
if ( index < 0.0 ) {
|
||||
index = a = 0.0;
|
||||
if ( band == -1 ) {
|
||||
vec4 imageVal = texture2D(rawTex,gl_TexCoord[0].st);
|
||||
float r = imageVal.r;
|
||||
float g = imageVal.g;
|
||||
float b = imageVal.b;
|
||||
float a = imageVal.a;
|
||||
|
||||
// Round because of 8-bit floating point precision
|
||||
int bitMask = toBitMask(a);
|
||||
if (expectedMask > 0 && bitMask == expectedMask ) {
|
||||
a = 1.0;
|
||||
} else {
|
||||
a = 0.0;
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(r,g,b,a);
|
||||
} else {
|
||||
a = 1.0;
|
||||
vec2 xy = gl_FragCoord.xy;
|
||||
vec4 imageVal = texture2D(rawTex,gl_TexCoord[0].st);
|
||||
vec4 curVal = texture2D(trueColorTexture, vec2((xy.x / float(width)), (xy.y / float(height))));
|
||||
|
||||
float r = curVal.r;
|
||||
float g = curVal.g;
|
||||
float b = curVal.b;
|
||||
float a = curVal.a;
|
||||
|
||||
float index = getIndex(rawTex, cmapMin, cmapMax, naturalMin, naturalMax, isFloat);
|
||||
if ( index != -1.0 ) {
|
||||
int currentMask = toBitMask(a);
|
||||
int bitValue = (1 << band);
|
||||
if ( band == 0 && index > r ) {
|
||||
r = index;
|
||||
} else if ( band == 1 && index > g ) {
|
||||
g = index;
|
||||
} else if ( band == 2 && index > b ) {
|
||||
b = index;
|
||||
}
|
||||
|
||||
if ( (currentMask & bitValue) == 0 ) {
|
||||
// alpha does not contain this bit yet!
|
||||
a = (currentMask | bitValue) / maskMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(r,g,b,a);
|
||||
}
|
||||
if ( band == 0 && index > r ) {
|
||||
r = index;
|
||||
} else if ( band == 1 && index > g ) {
|
||||
g = index;
|
||||
} else if ( band == 2 && index > b ) {
|
||||
b = index;
|
||||
}
|
||||
|
||||
gl_FragColor = vec4(r,g,b,a);
|
||||
}
|
|
@ -19,6 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.truecolor.gl.extension;
|
||||
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.media.opengl.GL;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
|
@ -61,6 +64,11 @@ public class GLTrueColorImagingExtension extends AbstractGLSLImagingExtension
|
|||
|
||||
private Channel renderingChannel;
|
||||
|
||||
/** The current rendering bit mask, specifies what bands we rendered */
|
||||
private int currentMask = 0;
|
||||
|
||||
private Map<ColorMapParameters, Object> parameters = new IdentityHashMap<ColorMapParameters, Object>();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -102,6 +110,9 @@ public class GLTrueColorImagingExtension extends AbstractGLSLImagingExtension
|
|||
if (image instanceof GLTrueColorImage) {
|
||||
GLTrueColorImage trueColorImage = (GLTrueColorImage) image;
|
||||
if (trueColorImage.isRepaint()) {
|
||||
// Reset current bit mask
|
||||
currentMask = 0;
|
||||
parameters.clear();
|
||||
writeToImage = trueColorImage;
|
||||
GLOffscreenRenderingExtension extension = target
|
||||
.getExtension(GLOffscreenRenderingExtension.class);
|
||||
|
@ -114,17 +125,17 @@ public class GLTrueColorImagingExtension extends AbstractGLSLImagingExtension
|
|||
DrawableImage[] imagesToDraw = trueColorImage
|
||||
.getImages(channel);
|
||||
if (imagesToDraw != null && imagesToDraw.length > 0) {
|
||||
// Mark the channel bit in the current bit mask
|
||||
currentMask |= (1 << channel.ordinal());
|
||||
|
||||
// Make sure images are staged before we mosaic them
|
||||
ImagingSupport.prepareImages(target, imagesToDraw);
|
||||
|
||||
// Each image needs to draw separately due to gl
|
||||
// issues when
|
||||
// zoomed in very far, rendered parts near the
|
||||
// corners don't
|
||||
// show all the pixels for each image. Pushing and
|
||||
// popping
|
||||
// GL_TEXTURE_BIT before/after each render fixes
|
||||
// this issue
|
||||
// issues when zoomed in very far, rendered parts
|
||||
// near the corners don't show all the pixels for
|
||||
// each image. Pushing and popping GL_TEXTURE_BIT
|
||||
// before/after each render fixes this issue
|
||||
for (DrawableImage di : imagesToDraw) {
|
||||
allPainted &= drawRasters(paintProps, di);
|
||||
}
|
||||
|
@ -133,18 +144,21 @@ public class GLTrueColorImagingExtension extends AbstractGLSLImagingExtension
|
|||
trueColorImage.setRepaint(allPainted == false);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
} catch (VizException e) {
|
||||
extension.renderOnscreen();
|
||||
throw e;
|
||||
}
|
||||
renderingChannel = null;
|
||||
writeToImage = null;
|
||||
trueColorImage.setImageParameters(parameters.keySet());
|
||||
trueColorImage.bind(target.getGl());
|
||||
return imageCoverage;
|
||||
} else {
|
||||
target.drawRasters(paintProps,
|
||||
new DrawableImage(trueColorImage.getWrappedImage(),
|
||||
imageCoverage));
|
||||
return null;
|
||||
}
|
||||
|
||||
target.drawRasters(paintProps,
|
||||
new DrawableImage(trueColorImage.getWrappedImage(),
|
||||
imageCoverage));
|
||||
// Don't actually render this image now since we just did it
|
||||
return null;
|
||||
} else {
|
||||
GL gl = target.getGl();
|
||||
// bind on GL_TEXTURE1 as 0 is channel image
|
||||
|
@ -164,10 +178,18 @@ public class GLTrueColorImagingExtension extends AbstractGLSLImagingExtension
|
|||
@Override
|
||||
public void postImageRender(PaintProperties paintProps,
|
||||
AbstractGLImage image, Object data) throws VizException {
|
||||
GL gl = target.getGl();
|
||||
// Unbind the writeToImage from GL_TEXTURE1
|
||||
gl.glActiveTexture(GL.GL_TEXTURE1);
|
||||
gl.glBindTexture(writeToImage.getTextureStorageType(), 0);
|
||||
if (image instanceof GLTrueColorImage) {
|
||||
target.getExtension(GLOffscreenRenderingExtension.class)
|
||||
.renderOnscreen();
|
||||
target.drawRasters(paintProps, new DrawableImage(
|
||||
((GLTrueColorImage) image).getWrappedImage(),
|
||||
(PixelCoverage) data));
|
||||
} else if (writeToImage != null) {
|
||||
GL gl = target.getGl();
|
||||
// Unbind the writeToImage from GL_TEXTURE1
|
||||
gl.glActiveTexture(GL.GL_TEXTURE1);
|
||||
gl.glBindTexture(writeToImage.getTextureStorageType(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -182,32 +204,54 @@ public class GLTrueColorImagingExtension extends AbstractGLSLImagingExtension
|
|||
@Override
|
||||
public void loadShaderData(GLShaderProgram program, IImage image,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
if (image instanceof GLColormappedImage == false) {
|
||||
throw new VizException(
|
||||
"Can only render colormapped images in true color");
|
||||
if (image instanceof GLTrueColorImage) {
|
||||
program.setUniform("band", -1);
|
||||
program.setUniform("rawTex", 0);
|
||||
program.setUniform("expectedMask", currentMask);
|
||||
} else {
|
||||
if (image instanceof GLColormappedImage == false) {
|
||||
throw new VizException(
|
||||
"Can only render colormapped images in true color");
|
||||
}
|
||||
|
||||
GLColormappedImage cmapImage = (GLColormappedImage) image;
|
||||
ColorMapParameters colorMapParameters = cmapImage
|
||||
.getColorMapParameters();
|
||||
parameters.put(colorMapParameters, null);
|
||||
int textureType = cmapImage.getTextureType();
|
||||
|
||||
// Set the band image data
|
||||
program.setUniform("rawTex", 0);
|
||||
program.setUniform("naturalMin", colorMapParameters.getDataMin());
|
||||
program.setUniform("naturalMax", colorMapParameters.getDataMax());
|
||||
program.setUniform("cmapMin", colorMapParameters.getColorMapMin());
|
||||
program.setUniform("cmapMax", colorMapParameters.getColorMapMax());
|
||||
program.setUniform("isFloat", textureType == GL.GL_FLOAT
|
||||
|| textureType == GL.GL_HALF_FLOAT_ARB ? 1 : 0);
|
||||
program.setUniform("noDataValue",
|
||||
colorMapParameters.getNoDataValue());
|
||||
|
||||
// Set the composite image data
|
||||
program.setUniform("trueColorTexture", 1);
|
||||
program.setUniform("width", writeToImage.getWidth());
|
||||
program.setUniform("height", writeToImage.getHeight());
|
||||
|
||||
// Set the band we are rendering to
|
||||
program.setUniform("band", renderingChannel.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
GLColormappedImage cmapImage = (GLColormappedImage) image;
|
||||
ColorMapParameters colorMapParameters = cmapImage
|
||||
.getColorMapParameters();
|
||||
int textureType = cmapImage.getTextureType();
|
||||
|
||||
// Set the band image data
|
||||
program.setUniform("rawTex", 0);
|
||||
program.setUniform("naturalMin", colorMapParameters.getDataMin());
|
||||
program.setUniform("naturalMax", colorMapParameters.getDataMax());
|
||||
program.setUniform("cmapMin", colorMapParameters.getColorMapMin());
|
||||
program.setUniform("cmapMax", colorMapParameters.getColorMapMax());
|
||||
program.setUniform("isFloat", textureType == GL.GL_FLOAT
|
||||
|| textureType == GL.GL_HALF_FLOAT_ARB ? 1 : 0);
|
||||
|
||||
// Set the composite image data
|
||||
program.setUniform("trueColorTexture", 1);
|
||||
program.setUniform("width", writeToImage.getWidth());
|
||||
program.setUniform("height", writeToImage.getHeight());
|
||||
|
||||
// Set the band we are rendering to
|
||||
program.setUniform("band", renderingChannel.ordinal());
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.core.gl.ext.AbstractGLImagingExtension#enableBlending
|
||||
* (javax.media.opengl.GL)
|
||||
*/
|
||||
@Override
|
||||
protected void enableBlending(GL gl) {
|
||||
// Do not enable blending for this extension as it messes with alpha
|
||||
// values between passes
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,12 +22,16 @@ package com.raytheon.uf.viz.truecolor.gl.image;
|
|||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.RenderedImage;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.IExtent;
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IColorMapParametersListener;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.truecolor.extension.ITrueColorImagingExtension.Channel;
|
||||
|
@ -36,7 +40,9 @@ import com.raytheon.viz.core.gl.images.GLDelegateImage;
|
|||
import com.raytheon.viz.core.gl.images.GLImage;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* GL implementation of {@link ITrueColorImage}. Manages drawable images for
|
||||
* {@link Channel} objects. Listens for changes on the ColorMapParameters for
|
||||
* the underlying images so it knows when repaint
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -53,7 +59,7 @@ import com.raytheon.viz.core.gl.images.GLImage;
|
|||
*/
|
||||
|
||||
public class GLTrueColorImage extends GLDelegateImage<GLImage> implements
|
||||
ITrueColorImage {
|
||||
ITrueColorImage, IColorMapParametersListener {
|
||||
|
||||
private static class RGBCallback implements IRenderedImageCallback {
|
||||
private int[] bounds;
|
||||
|
@ -77,6 +83,9 @@ public class GLTrueColorImage extends GLDelegateImage<GLImage> implements
|
|||
|
||||
private Map<Channel, DrawableImage[]> channelMap = new HashMap<Channel, DrawableImage[]>();
|
||||
|
||||
/* Identity set used to track color map parameters currently listening on */
|
||||
private Map<ColorMapParameters, Object> listening = new IdentityHashMap<ColorMapParameters, Object>();
|
||||
|
||||
/**
|
||||
* @param extensionClass
|
||||
*/
|
||||
|
@ -121,12 +130,15 @@ public class GLTrueColorImage extends GLDelegateImage<GLImage> implements
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the images for the specified channel
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @param channel
|
||||
* @return
|
||||
* @see com.raytheon.uf.viz.truecolor.extension.ITrueColorImagingExtension.
|
||||
* ITrueColorImage
|
||||
* #getImages(com.raytheon.uf.viz.truecolor.extension.ITrueColorImagingExtension
|
||||
* .Channel)
|
||||
*/
|
||||
@Override
|
||||
public DrawableImage[] getImages(Channel channel) {
|
||||
return channelMap.get(channel);
|
||||
}
|
||||
|
@ -177,4 +189,61 @@ public class GLTrueColorImage extends GLDelegateImage<GLImage> implements
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IColorMapParametersListener#
|
||||
* colorMapChanged()
|
||||
*/
|
||||
@Override
|
||||
public void colorMapChanged() {
|
||||
// Repaint image on colormap change events
|
||||
repaint = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ColorMapParameters it's images are using. We add ourselves as
|
||||
* listeners so we can repaint on changes
|
||||
*
|
||||
* @param parameters
|
||||
*/
|
||||
public void setImageParameters(Collection<ColorMapParameters> parameters) {
|
||||
boolean same = false;
|
||||
if (parameters.size() == listening.size()) {
|
||||
same = true;
|
||||
for (ColorMapParameters params : parameters) {
|
||||
same &= listening.containsKey(params);
|
||||
if (!same) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!same) {
|
||||
// Current image parameters list different from passed in, set up
|
||||
// listeners on new set and remove from current set
|
||||
for (ColorMapParameters params : listening.keySet()) {
|
||||
params.removeListener(this);
|
||||
}
|
||||
listening.clear();
|
||||
for (ColorMapParameters params : parameters) {
|
||||
params.addListener(this);
|
||||
listening.put(params, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.core.gl.images.GLDelegateImage#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
for (ColorMapParameters params : listening.keySet()) {
|
||||
params.removeListener(this);
|
||||
}
|
||||
listening.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,13 +5,14 @@ Bundle-SymbolicName: com.raytheon.uf.viz.truecolor;singleton:=true
|
|||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Activator: com.raytheon.uf.viz.truecolor.Activator
|
||||
Bundle-Vendor: RAYTHEON
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.viz.core
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.viz.core, com.raytheon.viz.ui
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.core.runtime,
|
||||
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
|
||||
com.raytheon.viz.ui;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.time;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174"
|
||||
com.raytheon.uf.common.geospatial;bundle-version="1.12.1174",
|
||||
javax.measure;bundle-version="1.0.0"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.viz.truecolor.extension
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
com.raytheon.uf.viz.truecolor.rsc.TrueColorResourceGroupData
|
||||
com.raytheon.uf.viz.truecolor.rsc.ChannelInfo
|
||||
com.raytheon.uf.viz.truecolor.rsc.ChannelResource
|
|
@ -28,4 +28,12 @@
|
|||
renderingOrderId="IMAGE_COUNTRY"
|
||||
resourceType="PLAN_VIEW"/>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.raytheon.viz.ui.contextualMenu">
|
||||
<contextualMenu
|
||||
actionClass="com.raytheon.uf.viz.truecolor.ui.TrueColorDialogAction"
|
||||
capabilityClass="com.raytheon.uf.viz.truecolor.rsc.TrueColorResourceGroup"
|
||||
name="TrueColorImaging"
|
||||
sortID="25"/>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
|
|
@ -55,6 +55,8 @@ public interface ITrueColorImagingExtension extends IImagingExtension {
|
|||
|
||||
public void setImages(Channel channel, DrawableImage... images);
|
||||
|
||||
public DrawableImage[] getImages(Channel channel);
|
||||
|
||||
public void setSize(int[] bounds);
|
||||
|
||||
public void setImageExtent(IExtent extent);
|
||||
|
|
|
@ -0,0 +1,192 @@
|
|||
/**
|
||||
* 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.uf.viz.truecolor.rsc;
|
||||
|
||||
import java.text.ParsePosition;
|
||||
|
||||
import javax.measure.unit.Unit;
|
||||
import javax.measure.unit.UnitFormat;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.raytheon.uf.viz.truecolor.extension.ITrueColorImagingExtension.Channel;
|
||||
|
||||
/**
|
||||
* Channel information (range/unit) for a true color channel
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 20, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class ChannelInfo {
|
||||
|
||||
@XmlAttribute
|
||||
private Channel channel;
|
||||
|
||||
@XmlElement
|
||||
private double rangeMin = 0.0;
|
||||
|
||||
@XmlElement
|
||||
private double rangeMax = 1.0;
|
||||
|
||||
private Unit<?> unit = Unit.ONE;
|
||||
|
||||
/**
|
||||
* @return the channel
|
||||
*/
|
||||
public Channel getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param channel
|
||||
* the channel to set
|
||||
*/
|
||||
public void setChannel(Channel channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rangeMin
|
||||
*/
|
||||
public double getRangeMin() {
|
||||
return rangeMin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rangeMin
|
||||
* the rangeMin to set
|
||||
*/
|
||||
public void setRangeMin(double rangeMin) {
|
||||
this.rangeMin = rangeMin;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the rangeMax
|
||||
*/
|
||||
public double getRangeMax() {
|
||||
return rangeMax;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param rangeMax
|
||||
* the rangeMax to set
|
||||
*/
|
||||
public void setRangeMax(double rangeMax) {
|
||||
this.rangeMax = rangeMax;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the unit
|
||||
*/
|
||||
public Unit<?> getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param unit
|
||||
* the unit to set
|
||||
*/
|
||||
public void setUnit(Unit<?> unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
@XmlElement(name = "unit")
|
||||
public void setUnitString(String unit) {
|
||||
if (unit != null) {
|
||||
this.unit = UnitFormat.getUCUMInstance().parseObject(unit,
|
||||
new ParsePosition(0));
|
||||
} else {
|
||||
this.unit = null;
|
||||
}
|
||||
if (this.unit == null) {
|
||||
this.unit = Unit.ONE;
|
||||
}
|
||||
}
|
||||
|
||||
public String getUnitString() {
|
||||
// Let anything with Unit.ONE serialize back out as null since it was
|
||||
// probably never set and will default to Unit.ONE
|
||||
return unit != Unit.ONE ? UnitFormat.getUCUMInstance().format(unit)
|
||||
: null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((channel == null) ? 0 : channel.hashCode());
|
||||
long temp;
|
||||
temp = Double.doubleToLongBits(rangeMax);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
temp = Double.doubleToLongBits(rangeMin);
|
||||
result = prime * result + (int) (temp ^ (temp >>> 32));
|
||||
result = prime * result + ((unit == null) ? 0 : unit.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ChannelInfo other = (ChannelInfo) obj;
|
||||
if (channel != other.channel)
|
||||
return false;
|
||||
if (Double.doubleToLongBits(rangeMax) != Double
|
||||
.doubleToLongBits(other.rangeMax))
|
||||
return false;
|
||||
if (Double.doubleToLongBits(rangeMin) != Double
|
||||
.doubleToLongBits(other.rangeMin))
|
||||
return false;
|
||||
if (unit == null) {
|
||||
if (other.unit != null)
|
||||
return false;
|
||||
} else if (!unit.equals(other.unit))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
/**
|
||||
* 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.uf.viz.truecolor.rsc;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.truecolor.extension.ITrueColorImagingExtension.Channel;
|
||||
|
||||
/**
|
||||
* Object that represents a resource bound to a {@link Channel}
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 16, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class ChannelResource {
|
||||
|
||||
@XmlElement
|
||||
protected AbstractResourceData resourceData;
|
||||
|
||||
@XmlElement
|
||||
protected Channel channel;
|
||||
|
||||
@XmlAttribute
|
||||
protected String channelName;
|
||||
|
||||
/**
|
||||
* @return the resourceData
|
||||
*/
|
||||
public AbstractResourceData getResourceData() {
|
||||
return resourceData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param resourceData
|
||||
* the resourceData to set
|
||||
*/
|
||||
public void setResourceData(AbstractResourceData resourceData) {
|
||||
this.resourceData = resourceData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the channel
|
||||
*/
|
||||
public Channel getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param channel
|
||||
* the channel to set
|
||||
*/
|
||||
public void setChannel(Channel channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the channelName
|
||||
*/
|
||||
public String getChannelName() {
|
||||
return channelName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param channelName
|
||||
* the channelName to set
|
||||
*/
|
||||
public void setChannelName(String channelName) {
|
||||
this.channelName = channelName;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((channelName == null) ? 0 : channelName.hashCode());
|
||||
result = prime * result
|
||||
+ ((resourceData == null) ? 0 : resourceData.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ChannelResource other = (ChannelResource) obj;
|
||||
if (channelName == null) {
|
||||
if (other.channelName != null)
|
||||
return false;
|
||||
} else if (!channelName.equals(other.channelName))
|
||||
return false;
|
||||
if (resourceData == null) {
|
||||
if (other.resourceData != null)
|
||||
return false;
|
||||
} else if (!resourceData.equals(other.resourceData))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -20,16 +20,22 @@
|
|||
package com.raytheon.uf.viz.truecolor.rsc;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.IExtent;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension.ImageProvider;
|
||||
|
@ -71,10 +77,68 @@ public class TrueColorResourceGroup extends
|
|||
AbstractVizResource<TrueColorResourceGroupData, IDescriptor> implements
|
||||
IResourceGroup, IResourceDataChanged {
|
||||
|
||||
public static class DisplayedChannelResource {
|
||||
|
||||
private String displayName;
|
||||
|
||||
public AbstractVizResource<?, ?> resource;
|
||||
|
||||
public ChannelResource channel;
|
||||
|
||||
private DisplayedChannelResource(ChannelResource cr,
|
||||
AbstractVizResource<?, ?> resource) {
|
||||
this.channel = cr;
|
||||
this.resource = resource;
|
||||
this.displayName = cr.getChannelName();
|
||||
if (displayName == null) {
|
||||
displayName = resource.getName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the display name of the channel
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the resource is bound to the specified {@link Channel}
|
||||
*
|
||||
* @param channel
|
||||
* @return
|
||||
*/
|
||||
public boolean isChannel(Channel channel) {
|
||||
return this.channel.getChannel() == channel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Channel getChannel() {
|
||||
return channel.getChannel();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final String DEFAULT_NAME = "RGB Composite";
|
||||
|
||||
private Map<Channel, DisplayedChannelResource> displayedResources;
|
||||
|
||||
private ITrueColorImage image;
|
||||
|
||||
private boolean timeAgnostic = true;
|
||||
|
||||
private String baseName;
|
||||
|
||||
/**
|
||||
* Mapping to keep colormap parameters in sync with ChannelInfo in
|
||||
* resourceData
|
||||
*/
|
||||
private Map<ColorMapParameters, ChannelInfo> channelInfoMap = new IdentityHashMap<ColorMapParameters, ChannelInfo>();
|
||||
|
||||
/**
|
||||
* @param resourceData
|
||||
* @param loadProperties
|
||||
|
@ -124,11 +188,24 @@ public class TrueColorResourceGroup extends
|
|||
image.setSize(new int[] { rect.width, rect.height });
|
||||
image.setImageExtent(extent);
|
||||
|
||||
FramesInfo fi = paintProps.getFramesInfo();
|
||||
for (Channel c : Channel.values()) {
|
||||
ResourcePair rp = resourceData.getResource(c);
|
||||
if (rp != null) {
|
||||
image.setImages(c, getImages(rp, target, paintProps));
|
||||
DrawableImage[] images = null;
|
||||
DisplayedChannelResource dcr = displayedResources.get(c);
|
||||
if (dcr != null) {
|
||||
DataTime dcrTime = fi.getTimeForResource(dcr.resource);
|
||||
if (dcrTime != null) {
|
||||
paintProps.setDataTime(fi.getTimeForResource(dcr.resource));
|
||||
Collection<DrawableImage> dcrImages = dcr.resource
|
||||
.getCapability(ImagingCapability.class)
|
||||
.getProvider().getImages(target, paintProps);
|
||||
if (dcrImages != null) {
|
||||
images = dcrImages.toArray(new DrawableImage[dcrImages
|
||||
.size()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
image.setImages(c, images);
|
||||
}
|
||||
|
||||
Coordinate ul = new Coordinate(extent.getMinX(), extent.getMaxY());
|
||||
|
@ -139,17 +216,6 @@ public class TrueColorResourceGroup extends
|
|||
target.drawRaster(image, new PixelCoverage(ul, ur, lr, ll), paintProps);
|
||||
}
|
||||
|
||||
private DrawableImage[] getImages(ResourcePair rp, IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
paintProps.setDataTime(paintProps.getFramesInfo().getTimeForResource(
|
||||
rp.getResource()));
|
||||
ImagingCapability imaging = rp.getResource().getCapability(
|
||||
ImagingCapability.class);
|
||||
Collection<DrawableImage> images = imaging.getProvider().getImages(
|
||||
target, paintProps);
|
||||
return images.toArray(new DrawableImage[images.size()]);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -172,45 +238,155 @@ public class TrueColorResourceGroup extends
|
|||
// We will name the composite
|
||||
getCapability(GroupNamingCapability.class);
|
||||
|
||||
// Initialize them
|
||||
for (ResourcePair rp : getResourceList()) {
|
||||
AbstractVizResource<?, ?> resource = rp.getResource();
|
||||
resource.init(target);
|
||||
// Check resource for required capabilities
|
||||
String error = null;
|
||||
if (resource.hasCapability(ImagingCapability.class)) {
|
||||
ImagingCapability imaging = resource
|
||||
.getCapability(ImagingCapability.class);
|
||||
if (imaging.getProvider() != null) {
|
||||
if (resource.hasCapability(ColorMapCapability.class) == false) {
|
||||
error = "does not have ColorMapCapability";
|
||||
displayedResources = new HashMap<Channel, DisplayedChannelResource>();
|
||||
ResourceList resources = getResourceList();
|
||||
for (ChannelResource cr : resourceData.getChannelResources()) {
|
||||
for (ResourcePair rp : resources) {
|
||||
if (cr.getResourceData() == rp.getResourceData()) {
|
||||
DisplayedChannelResource displayedResource = new DisplayedChannelResource(
|
||||
cr, rp.getResource());
|
||||
AbstractVizResource<?, ?> resource = rp.getResource();
|
||||
resource.init(target);
|
||||
|
||||
// Check resource for required capabilities
|
||||
String error = null;
|
||||
if (resource.hasCapability(ImagingCapability.class)) {
|
||||
ImagingCapability imaging = resource
|
||||
.getCapability(ImagingCapability.class);
|
||||
if (imaging.getProvider() != null) {
|
||||
if (resource
|
||||
.hasCapability(ColorMapCapability.class) == false) {
|
||||
error = "does not have ColorMapCapability";
|
||||
} else if (resource.getCapability(
|
||||
ColorMapCapability.class)
|
||||
.getColorMapParameters() == null) {
|
||||
error = "does not have ColorMapParameters set";
|
||||
}
|
||||
} else {
|
||||
error = "does not have image provider set on the ImagingCapability";
|
||||
}
|
||||
} else {
|
||||
error = "does not have the ImagingCapability";
|
||||
}
|
||||
} else {
|
||||
error = "does not have image provider set on the ImagingCapability";
|
||||
if (cr.getChannel() == null) {
|
||||
error = "is not tied to any channel";
|
||||
} else if (displayedResources.containsKey(cr.getChannel())) {
|
||||
error = "is tied to a channel already in use";
|
||||
}
|
||||
|
||||
if (error == null) {
|
||||
// No errors so far, check for ChannelInfo override
|
||||
ColorMapParameters params = resource.getCapability(
|
||||
ColorMapCapability.class)
|
||||
.getColorMapParameters();
|
||||
ChannelInfo ci = resourceData
|
||||
.getChannelInfo(displayedResource.getChannel());
|
||||
if (ci == null
|
||||
|| ci.getUnit().isCompatible(
|
||||
params.getDataUnit())) {
|
||||
if (ci == null) {
|
||||
ci = new ChannelInfo();
|
||||
ci.setChannel(displayedResource.getChannel());
|
||||
resourceData.setChannelInfo(ci);
|
||||
} else {
|
||||
params.setDisplayUnit(ci.getUnit());
|
||||
params.setColorMapMin((float) params
|
||||
.getDisplayToDataConverter().convert(
|
||||
ci.getRangeMin()));
|
||||
params.setColorMapMax((float) params
|
||||
.getDisplayToDataConverter().convert(
|
||||
ci.getRangeMax()));
|
||||
}
|
||||
channelInfoMap.put(params, ci);
|
||||
resourceChanged(
|
||||
ChangeType.CAPABILITY,
|
||||
resource.getCapability(ColorMapCapability.class));
|
||||
} else {
|
||||
error = "is not compatible with custom ChannelInfo for Channel="
|
||||
+ displayedResource.getChannel();
|
||||
}
|
||||
}
|
||||
|
||||
if (error != null) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
displayedResource.getDisplayName()
|
||||
+ " resource in true color composite "
|
||||
+ error);
|
||||
resources.remove(rp);
|
||||
} else {
|
||||
resource.getResourceData().addChangeListener(this);
|
||||
displayedResources.put(displayedResource.getChannel(),
|
||||
displayedResource);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
error = "does not have the ImagingCapability";
|
||||
}
|
||||
if (error != null) {
|
||||
Activator.statusHandler.handle(Priority.PROBLEM,
|
||||
resourceData.getCompositeName(rp)
|
||||
+ " resource in true color composite " + error);
|
||||
resourceData.removeResource(rp);
|
||||
}
|
||||
}
|
||||
|
||||
if (displayedResources.size() == 0) {
|
||||
throw new VizException(
|
||||
"No resources to draw in true color composite");
|
||||
}
|
||||
|
||||
ITrueColorImagingExtension ext = target
|
||||
.getExtension(ITrueColorImagingExtension.class);
|
||||
image = ext.initializeRaster(new int[] { 0, 0 }, null);
|
||||
resourceData.addChangeListener(this);
|
||||
// Set initial ImagingCapability parameters
|
||||
resourceChanged(ChangeType.CAPABILITY,
|
||||
getCapability(ImagingCapability.class));
|
||||
|
||||
// Every resource has to be time agnostic for us to be as well
|
||||
timeAgnostic = true;
|
||||
for (ResourcePair rp : getResourceList()) {
|
||||
// If any resource is not time agnostic, neither are we
|
||||
timeAgnostic &= rp.getResource().isTimeAgnostic();
|
||||
for (DisplayedChannelResource dr : displayedResources.values()) {
|
||||
timeAgnostic &= dr.resource.isTimeAgnostic();
|
||||
}
|
||||
|
||||
String groupName = resourceData.getGroupName();
|
||||
if (groupName == null) {
|
||||
groupName = "True Color Composite";
|
||||
}
|
||||
String channels = " (";
|
||||
for (Channel c : Channel.values()) {
|
||||
if (displayedResources.containsKey(c)) {
|
||||
channels += c.name().substring(0, 1);
|
||||
}
|
||||
}
|
||||
channels += "): ";
|
||||
baseName = groupName + channels;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
String name = baseName;
|
||||
boolean first = true;
|
||||
for (Channel c : Channel.values()) {
|
||||
DisplayedChannelResource dcr = displayedResources.get(c);
|
||||
if (dcr != null) {
|
||||
if (!first) {
|
||||
name += "/";
|
||||
}
|
||||
first = false;
|
||||
|
||||
boolean has = true;
|
||||
if (image != null && image.getImages(c) == null) {
|
||||
has = false;
|
||||
}
|
||||
if (has) {
|
||||
name += dcr.getDisplayName();
|
||||
} else {
|
||||
String channelName = c.name();
|
||||
name += "No " + channelName.substring(0, 1)
|
||||
+ channelName.substring(1).toLowerCase();
|
||||
}
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -243,8 +419,23 @@ public class TrueColorResourceGroup extends
|
|||
image.setBrightness(imaging.getBrightness());
|
||||
image.setContrast(imaging.getContrast());
|
||||
image.setInterpolated(imaging.isInterpolationState());
|
||||
} else if (object instanceof ColorMapCapability) {
|
||||
ColorMapParameters params = ((ColorMapCapability) object)
|
||||
.getColorMapParameters();
|
||||
ChannelInfo ci = channelInfoMap.get(params);
|
||||
if (ci != null) {
|
||||
ci.setRangeMin(params.getDataToDisplayConverter().convert(
|
||||
params.getColorMapMin()));
|
||||
ci.setRangeMax(params.getDataToDisplayConverter().convert(
|
||||
params.getColorMapMax()));
|
||||
ci.setUnit(params.getDisplayUnit());
|
||||
}
|
||||
}
|
||||
}
|
||||
issueRefresh();
|
||||
}
|
||||
|
||||
public Collection<DisplayedChannelResource> getChannelResources() {
|
||||
return displayedResources.values();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,18 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.truecolor.rsc;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractNameGenerator;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceGroup;
|
||||
|
@ -35,8 +41,7 @@ import com.raytheon.uf.viz.truecolor.extension.ITrueColorImagingExtension.Channe
|
|||
|
||||
/**
|
||||
* {@link TrueColorResourceGroup} resource data. Contains a red/blue/green
|
||||
* channel resource and a name. Sub resources that .equal each other will be
|
||||
* replaced with the first reference to save time
|
||||
* channel resource and a name.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -51,7 +56,7 @@ import com.raytheon.uf.viz.truecolor.extension.ITrueColorImagingExtension.Channe
|
|||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class TrueColorResourceGroupData extends AbstractResourceData implements
|
||||
IResourceGroup {
|
||||
|
||||
|
@ -60,23 +65,10 @@ public class TrueColorResourceGroupData extends AbstractResourceData implements
|
|||
@XmlElement
|
||||
private String groupName;
|
||||
|
||||
@XmlElement
|
||||
private AbstractResourceData redChannelResource;
|
||||
@XmlElement(name = "channelResource")
|
||||
private List<ChannelResource> channelResources;
|
||||
|
||||
@XmlElement
|
||||
private AbstractResourceData greenChannelResource;
|
||||
|
||||
@XmlElement
|
||||
private AbstractResourceData blueChannelResource;
|
||||
|
||||
public TrueColorResourceGroupData() {
|
||||
nameGenerator = new AbstractNameGenerator() {
|
||||
@Override
|
||||
public String getName(AbstractVizResource<?, ?> resource) {
|
||||
return groupName;
|
||||
}
|
||||
};
|
||||
}
|
||||
private Map<Channel, ChannelInfo> channelInfo = new HashMap<Channel, ChannelInfo>();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -86,27 +78,23 @@ public class TrueColorResourceGroupData extends AbstractResourceData implements
|
|||
@Override
|
||||
public ResourceList getResourceList() {
|
||||
if (resourceList == null) {
|
||||
resourceList = new ResourceList();
|
||||
// Initialize the resource list, if any of the resources equal each
|
||||
// other, replace with reference instead of copy to save memory
|
||||
if (redChannelResource != null) {
|
||||
addResource(redChannelResource);
|
||||
}
|
||||
if (greenChannelResource != null) {
|
||||
if (greenChannelResource.equals(redChannelResource)) {
|
||||
greenChannelResource = redChannelResource;
|
||||
} else {
|
||||
addResource(greenChannelResource);
|
||||
}
|
||||
}
|
||||
if (blueChannelResource != null) {
|
||||
if (blueChannelResource.equals(redChannelResource)) {
|
||||
blueChannelResource = redChannelResource;
|
||||
} else if (blueChannelResource.equals(greenChannelResource)) {
|
||||
blueChannelResource = greenChannelResource;
|
||||
} else {
|
||||
addResource(blueChannelResource);
|
||||
resourceList = new ResourceList() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
protected boolean canAdd(ResourcePair e) {
|
||||
// Don't allow a ResourcePair that == another in the list
|
||||
Iterator<ResourcePair> iter = iterator();
|
||||
while (iter.hasNext()) {
|
||||
if (iter.next() == e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
for (ChannelResource resource : channelResources) {
|
||||
addResource(resource.getResourceData());
|
||||
}
|
||||
}
|
||||
return resourceList;
|
||||
|
@ -120,50 +108,6 @@ public class TrueColorResourceGroupData extends AbstractResourceData implements
|
|||
resourceList.add(rp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a resource from the resource data
|
||||
*
|
||||
* @param rp
|
||||
*/
|
||||
public void removeResource(ResourcePair rp) {
|
||||
resourceList.remove(rp);
|
||||
if (rp.getResourceData() == redChannelResource) {
|
||||
redChannelResource = null;
|
||||
}
|
||||
if (rp.getResourceData() == greenChannelResource) {
|
||||
greenChannelResource = null;
|
||||
}
|
||||
if (rp.getResourceData() == blueChannelResource) {
|
||||
blueChannelResource = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the composite name of the resource pair (Red, Red/Green, Blue, etc)
|
||||
*
|
||||
* @param rp
|
||||
* @return
|
||||
*/
|
||||
public String getCompositeName(ResourcePair rp) {
|
||||
String name = "";
|
||||
if (rp.getResourceData() == redChannelResource) {
|
||||
name += "Red";
|
||||
}
|
||||
if (rp.getResourceData() == greenChannelResource) {
|
||||
if (name.isEmpty() == false) {
|
||||
name += "/";
|
||||
}
|
||||
name += "Green";
|
||||
}
|
||||
if (rp.getResourceData() == blueChannelResource) {
|
||||
if (name.isEmpty() == false) {
|
||||
name += "/";
|
||||
}
|
||||
name += "Blue";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -190,33 +134,6 @@ public class TrueColorResourceGroupData extends AbstractResourceData implements
|
|||
// Nothing to update, updates will be handled by sub resources
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the resource pair associated with the {@link Channel}
|
||||
*
|
||||
* @param channel
|
||||
* @return
|
||||
*/
|
||||
public ResourcePair getResource(Channel channel) {
|
||||
AbstractResourceData toCheckFor = null;
|
||||
switch (channel) {
|
||||
case RED:
|
||||
toCheckFor = redChannelResource;
|
||||
break;
|
||||
case GREEN:
|
||||
toCheckFor = greenChannelResource;
|
||||
break;
|
||||
case BLUE:
|
||||
toCheckFor = blueChannelResource;
|
||||
break;
|
||||
}
|
||||
for (ResourcePair rp : getResourceList()) {
|
||||
if (rp.getResourceData() == toCheckFor) {
|
||||
return rp;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the groupName
|
||||
*/
|
||||
|
@ -233,49 +150,68 @@ public class TrueColorResourceGroupData extends AbstractResourceData implements
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the redChannelResource
|
||||
* @return the channelResources
|
||||
*/
|
||||
public AbstractResourceData getRedChannelResource() {
|
||||
return redChannelResource;
|
||||
public List<ChannelResource> getChannelResources() {
|
||||
return channelResources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param redChannelResource
|
||||
* the redChannelResource to set
|
||||
* @param channelResources
|
||||
* the channelResources to set
|
||||
*/
|
||||
public void setRedChannelResource(AbstractResourceData redChannelResource) {
|
||||
this.redChannelResource = redChannelResource;
|
||||
public void setChannelResources(List<ChannelResource> channelResources) {
|
||||
this.channelResources = channelResources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the greenChannelResource
|
||||
* @return the channelInfo
|
||||
*/
|
||||
public AbstractResourceData getGreenChannelResource() {
|
||||
return greenChannelResource;
|
||||
public ChannelInfo getChannelInfo(Channel channel) {
|
||||
return channelInfo.get(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param greenChannelResource
|
||||
* the greenChannelResource to set
|
||||
* @param channelInfo
|
||||
* the channelInfo to set
|
||||
*/
|
||||
public void setGreenChannelResource(
|
||||
AbstractResourceData greenChannelResource) {
|
||||
this.greenChannelResource = greenChannelResource;
|
||||
public void setChannelInfo(ChannelInfo channelInfo) {
|
||||
this.channelInfo.put(channelInfo.getChannel(), channelInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the blueChannelResource
|
||||
*/
|
||||
public AbstractResourceData getBlueChannelResource() {
|
||||
return blueChannelResource;
|
||||
public ChannelInfo[] getChannelInfoArray() {
|
||||
return this.channelInfo.values().toArray(
|
||||
new ChannelInfo[channelInfo.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param blueChannelResource
|
||||
* the blueChannelResource to set
|
||||
@XmlElement(name = "channelInfo")
|
||||
public void setChannelInfoArray(ChannelInfo[] channelInfo) {
|
||||
if (channelInfo == null) {
|
||||
channelInfo = new ChannelInfo[0];
|
||||
}
|
||||
this.channelInfo.clear();
|
||||
for (ChannelInfo ci : channelInfo) {
|
||||
setChannelInfo(ci);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
public void setBlueChannelResource(AbstractResourceData blueChannelResource) {
|
||||
this.blueChannelResource = blueChannelResource;
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result
|
||||
+ ((channelInfo == null) ? 0 : channelInfo.hashCode());
|
||||
result = prime
|
||||
* result
|
||||
+ ((channelResources == null) ? 0 : channelResources.hashCode());
|
||||
result = prime * result
|
||||
+ ((groupName == null) ? 0 : groupName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -292,26 +228,21 @@ public class TrueColorResourceGroupData extends AbstractResourceData implements
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
TrueColorResourceGroupData other = (TrueColorResourceGroupData) obj;
|
||||
if (blueChannelResource == null) {
|
||||
if (other.blueChannelResource != null)
|
||||
if (channelInfo == null) {
|
||||
if (other.channelInfo != null)
|
||||
return false;
|
||||
} else if (!blueChannelResource.equals(other.blueChannelResource))
|
||||
} else if (!channelInfo.equals(other.channelInfo))
|
||||
return false;
|
||||
if (greenChannelResource == null) {
|
||||
if (other.greenChannelResource != null)
|
||||
if (channelResources == null) {
|
||||
if (other.channelResources != null)
|
||||
return false;
|
||||
} else if (!greenChannelResource.equals(other.greenChannelResource))
|
||||
} else if (!channelResources.equals(other.channelResources))
|
||||
return false;
|
||||
if (groupName == null) {
|
||||
if (other.groupName != null)
|
||||
return false;
|
||||
} else if (!groupName.equals(other.groupName))
|
||||
return false;
|
||||
if (redChannelResource == null) {
|
||||
if (other.redChannelResource != null)
|
||||
return false;
|
||||
} else if (!redChannelResource.equals(other.redChannelResource))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.ui.dialogs;
|
||||
package com.raytheon.uf.viz.truecolor.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -30,20 +30,24 @@ import org.eclipse.swt.events.SelectionEvent;
|
|||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IMultiChannelImageExtension.Channel;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.colormap.IMultiChannelImageExtension.ChannelData;
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.MultiChannelCapability;
|
||||
import com.raytheon.uf.viz.core.rsc.IDisposeListener;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability;
|
||||
import com.raytheon.uf.viz.truecolor.extension.ITrueColorImagingExtension.Channel;
|
||||
import com.raytheon.uf.viz.truecolor.rsc.TrueColorResourceGroup;
|
||||
import com.raytheon.uf.viz.truecolor.rsc.TrueColorResourceGroup.DisplayedChannelResource;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ColorMapSliderComp;
|
||||
|
||||
/**
|
||||
* Dialog for manipulating multi channel capability
|
||||
* Dialog for modifying true color attributes on a dialog
|
||||
*
|
||||
* TODO: Update sliders when combo changes
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -51,7 +55,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.MultiChannelCapability;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 3, 2012 mschenke Initial creation
|
||||
* Aug 16, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -59,29 +63,26 @@ import com.raytheon.uf.viz.core.rsc.capabilities.MultiChannelCapability;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MultiChannelDialog extends CaveSWTDialog {
|
||||
public class TrueColorDialog extends CaveSWTDialog implements IDisposeListener {
|
||||
|
||||
private static final String DISABLED = "Disabled";
|
||||
|
||||
private AbstractVizResource<?, ?> resource;
|
||||
|
||||
private MultiChannelCapability capability;
|
||||
|
||||
private String[] items;
|
||||
protected TrueColorResourceGroup resource;
|
||||
|
||||
private List<ColorMapSliderComp> sliderComps;
|
||||
|
||||
public MultiChannelDialog(Shell parent, AbstractVizResource<?, ?> resource,
|
||||
MultiChannelCapability capability) {
|
||||
super(parent);
|
||||
this.capability = capability;
|
||||
/**
|
||||
* Creates the TrueColorDialog as a window of the parent Shell
|
||||
*
|
||||
* @param parent
|
||||
* @param resource
|
||||
*/
|
||||
public TrueColorDialog(Shell parent, TrueColorResourceGroup resource) {
|
||||
super(parent, SWT.DIALOG_TRIM);
|
||||
this.resource = resource;
|
||||
String[] names = capability.getNames();
|
||||
this.items = new String[names.length + 1];
|
||||
System.arraycopy(names, 0, items, 1, names.length);
|
||||
items[0] = DISABLED;
|
||||
this.sliderComps = new ArrayList<ColorMapSliderComp>();
|
||||
setText("Channel Options");
|
||||
setText("Composite Options");
|
||||
resource.registerListener(this);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -93,9 +94,15 @@ public class MultiChannelDialog extends CaveSWTDialog {
|
|||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
Map<Channel, ChannelData> channelMap = capability.getChannelMap();
|
||||
Collection<DisplayedChannelResource> resources = resource
|
||||
.getChannelResources();
|
||||
for (Channel c : Channel.values()) {
|
||||
addGroup(shell, c, channelMap.get(c));
|
||||
for (DisplayedChannelResource rsc : resources) {
|
||||
if (rsc.isChannel(c)) {
|
||||
addGroup(shell, c, rsc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Composite buttonComp = new Composite(shell, SWT.NONE);
|
||||
|
@ -129,73 +136,39 @@ public class MultiChannelDialog extends CaveSWTDialog {
|
|||
b.setLayoutData(gd);
|
||||
}
|
||||
|
||||
private void addGroup(Composite parent, Channel channel,
|
||||
final ChannelData data) {
|
||||
/**
|
||||
* @param shell
|
||||
* @param c
|
||||
* @param displayedChannelResource
|
||||
*/
|
||||
private void addGroup(Composite parent, final Channel channel,
|
||||
DisplayedChannelResource displayedResource) {
|
||||
ColorMapParameters params = null;
|
||||
if (data != null) {
|
||||
params = data.parameters;
|
||||
if (displayedResource != null) {
|
||||
params = displayedResource.resource.getCapability(
|
||||
ColorMapCapability.class).getColorMapParameters();
|
||||
} else {
|
||||
params = new ColorMapParameters();
|
||||
}
|
||||
|
||||
String groupName = channel.name();
|
||||
if (displayedResource != null) {
|
||||
groupName += " (" + displayedResource.getDisplayName() + ")";
|
||||
}
|
||||
|
||||
Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
|
||||
group.setLayout(new GridLayout(4, false));
|
||||
group.setText(channel + ":");
|
||||
group.setLayout(new GridLayout(1, false));
|
||||
group.setText(groupName + ":");
|
||||
group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
|
||||
|
||||
final ColorMapSliderComp cmapSlider = new ColorMapSliderComp(group,
|
||||
params);
|
||||
cmapSlider.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
((GridData) cmapSlider.getLayoutData()).widthHint = 450;
|
||||
sliderComps.add(cmapSlider);
|
||||
|
||||
final Button invertBtn = new Button(group, SWT.CHECK);
|
||||
invertBtn.addSelectionListener(new SelectionAdapter() {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse
|
||||
* .swt.events.SelectionEvent)
|
||||
*/
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
data.invert = invertBtn.getSelection();
|
||||
resource.issueRefresh();
|
||||
}
|
||||
});
|
||||
|
||||
if (data != null) {
|
||||
invertBtn.setSelection(data.invert);
|
||||
}
|
||||
|
||||
Label label = new Label(group, SWT.NONE);
|
||||
label.setText("Invert");
|
||||
|
||||
final Combo options = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||
options.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
|
||||
options.setItems(items);
|
||||
if (data == null) {
|
||||
options.setText(DISABLED);
|
||||
if (displayedResource == null) {
|
||||
enable(group, false);
|
||||
} else {
|
||||
if (data.name == null) {
|
||||
options.setText(DISABLED);
|
||||
enable(cmapSlider, false);
|
||||
} else {
|
||||
options.setText(data.name);
|
||||
}
|
||||
options.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (DISABLED.equals(options.getText())) {
|
||||
enable(cmapSlider, false);
|
||||
data.name = null;
|
||||
} else {
|
||||
enable(cmapSlider, true);
|
||||
data.name = options.getText();
|
||||
}
|
||||
capability.capabilityChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,4 +182,28 @@ public class MultiChannelDialog extends CaveSWTDialog {
|
|||
private void okPressed() {
|
||||
close();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.IDisposeListener#disposed(com.raytheon.uf
|
||||
* .viz.core.rsc.AbstractVizResource)
|
||||
*/
|
||||
@Override
|
||||
public void disposed(AbstractVizResource<?, ?> rsc) {
|
||||
close();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
|
||||
*/
|
||||
@Override
|
||||
protected void disposed() {
|
||||
super.disposed();
|
||||
resource.unregisterListener(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -17,7 +17,10 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.viz.ui.cmenu;
|
||||
package com.raytheon.uf.viz.truecolor.ui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
|
@ -25,14 +28,11 @@ import org.eclipse.swt.widgets.Listener;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IDisposeListener;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.MultiChannelCapability;
|
||||
import com.raytheon.viz.ui.dialogs.MultiChannelDialog;
|
||||
import com.raytheon.uf.viz.truecolor.rsc.TrueColorResourceGroup;
|
||||
import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
|
||||
|
||||
/**
|
||||
* Right click action that opens a dialog for modifying resources with
|
||||
* MultiChannelCapability
|
||||
* Action that opens the {@link TrueColorDialog}
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -40,7 +40,7 @@ import com.raytheon.viz.ui.dialogs.MultiChannelDialog;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 3, 2012 mschenke Initial creation
|
||||
* Aug 16, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,7 +48,9 @@ import com.raytheon.viz.ui.dialogs.MultiChannelDialog;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MultiChannelImagingAction extends AbstractRightClickAction {
|
||||
public class TrueColorDialogAction extends AbstractRightClickAction {
|
||||
|
||||
private static Map<TrueColorResourceGroup, TrueColorDialog> dialogMap = new HashMap<TrueColorResourceGroup, TrueColorDialog>();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
|
@ -57,7 +59,7 @@ public class MultiChannelImagingAction extends AbstractRightClickAction {
|
|||
*/
|
||||
@Override
|
||||
public String getText() {
|
||||
return "Channel Options...";
|
||||
return "Composite Options...";
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -67,26 +69,22 @@ public class MultiChannelImagingAction extends AbstractRightClickAction {
|
|||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
final AbstractVizResource<?, ?> rsc = getSelectedRsc();
|
||||
MultiChannelCapability cap = rsc
|
||||
.getCapability(MultiChannelCapability.class);
|
||||
final MultiChannelDialog dialog = new MultiChannelDialog(shell, rsc,
|
||||
cap);
|
||||
final IDisposeListener listener = new IDisposeListener() {
|
||||
@Override
|
||||
public void disposed(AbstractVizResource<?, ?> rsc) {
|
||||
dialog.close();
|
||||
}
|
||||
};
|
||||
rsc.registerListener(listener);
|
||||
dialog.addListener(SWT.Dispose, new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
rsc.unregisterListener(listener);
|
||||
}
|
||||
});
|
||||
TrueColorResourceGroup resource = (TrueColorResourceGroup) getSelectedRsc();
|
||||
TrueColorDialog dialog = dialogMap.get(resource);
|
||||
if (dialog == null) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
dialog = new TrueColorDialog(shell, resource);
|
||||
final TrueColorDialog toRemove = dialog;
|
||||
dialogMap.put(resource, dialog);
|
||||
dialog.addListener(SWT.Close, new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
dialogMap.remove(toRemove.resource);
|
||||
}
|
||||
});
|
||||
}
|
||||
dialog.open();
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue