Merge branch 'omaha_14.2.1' (14.2.1-8) into development

Conflicts:
	cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/localization/LocalizationManager.java
	cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ui/zoneselector/ZoneSelectorResource.java
	cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/general/GeneralGridData.java
	cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java
	edexOsgi/com.raytheon.edex.plugin.gfe/utility/edex_static/base/config/gfe/serverConfig.py
	edexOsgi/com.raytheon.edex.plugin.textlightning/src/com/raytheon/edex/plugin/textlightning/impl/TextLightningParser.java
	edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java
	edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/response/GridResponseData.java
	edexOsgi/com.raytheon.uf.common.dataaccess/src/com/raytheon/uf/common/dataaccess/util/PDOUtil.java
	edexOsgi/com.raytheon.uf.edex.datadelivery.bandwidth.ncf/src/com/raytheon/uf/edex/datadelivery/bandwidth/sbn/SbnSimulator.java

Change-Id: Ia74f80ced9091ff0497ccc6d93e876b5a9807f75

Former-commit-id: 0e25ae35c1 [formerly a47eaa9af45db41391fe46e36ec0793f70d06ad6]
Former-commit-id: 1c150e6e8b
This commit is contained in:
Richard Peter 2014-02-27 15:18:26 -06:00
commit f13c86bc3e
380 changed files with 11663 additions and 6763 deletions

View file

@ -107,6 +107,40 @@
</max-perm>
</ini-substitutions>
</memory-setting>
<memory-setting>
<command-line-args>
<first-arg>-component</first-arg>
<second-arg>servicebackup</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>256M</value>
</max-memory>
<max-perm>
<value>128m</value>
</max-perm>
</ini-substitutions>
</memory-setting>
<memory-setting>
<command-line-args>
<first-arg>-perspective</first-arg>
<second-arg>National Centers</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>1536M</value>
</max-memory>
<max-perm>
<value>DEFAULT</value>
</max-perm>
</ini-substitutions>
</memory-setting>
</arch.x86>
<arch.x86_64>
@ -182,6 +216,40 @@
</max-perm>
</ini-substitutions>
</memory-setting>
</arch.x86_64>
<memory-setting>
<command-line-args>
<first-arg>-component</first-arg>
<second-arg>servicebackup</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>256M</value>
</max-memory>
<max-perm>
<value>128m</value>
</max-perm>
</ini-substitutions>
</memory-setting>
<memory-setting>
<command-line-args>
<first-arg>-perspective</first-arg>
<second-arg>National Centers</second-arg>
</command-line-args>
<ini-substitutions>
<max-memory>
<value>2048M</value>
</max-memory>
<max-perm>
<value>DEFAULT</value>
</max-perm>
</ini-substitutions>
</memory-setting>
</arch.x86_64>
</cave-memory-settings>

View file

@ -1,5 +0,0 @@
s2s
default : SKY_COVER_00
1 : SKY_COVER_00
4 : SKY_COVER_08
7 : SKY_COVER_06

View file

@ -1,13 +0,0 @@
s2s
0 : SKY_COVER_00
1 : SKY_COVER_02
2 : SKY_COVER_03
4 : SKY_COVER_08
5 : SKY_COVER_00
6 : SKY_COVER_05
8 : SKY_COVER_09
9 : SKY_COVER_03
11 : SKY_COVER_03
12 : SKY_COVER_02
13 : SKY_COVER_02
14 : SKY_COVER_00

View file

@ -1,11 +0,0 @@
s2s
SEV : ICING_08
MODSEV : ICING_06
MOD : ICING_05
LGTMOD : ICING_04
LGT : ICING_03
TRACELGT: ICING_02
TRACE : ICING_01
NEG : ICING_00

View file

@ -1,10 +0,0 @@
s2s
0 : PRESSURE_TENDENCY_00
1 : PRESSURE_TENDENCY_01
2 : PRESSURE_TENDENCY_02
3 : PRESSURE_TENDENCY_03
4 : PRESSURE_TENDENCY_04
5 : PRESSURE_TENDENCY_05
6 : PRESSURE_TENDENCY_06
7 : PRESSURE_TENDENCY_07
8 : PRESSURE_TENDENCY_08

View file

@ -1,11 +0,0 @@
s2s
default : SKY_COVER_10
BLNK : SKY_COVER_10
SKC : SKY_COVER_00
CLR : SKY_COVER_00
FEW : SKY_COVER_02
SCT : SKY_COVER_03
BKN : SKY_COVER_06
OVC : SKY_COVER_08
OBS : SKY_COVER_09
VV : SKY_COVER_09

View file

@ -1,10 +0,0 @@
s2s
default : SKY_COVER_10
1 : SKY_COVER_10
2 : SKY_COVER_00
3 : SKY_COVER_00
4 : SKY_COVER_03
5 : SKY_COVER_02
6 : SKY_COVER_06
7 : SKY_COVER_08
8 : SKY_COVER_09

View file

@ -1,9 +0,0 @@
s2s
EXTRM :TURBULENCE_7
SEV :TURBULENCE_6
MODSEV:TURBULENCE_5
MOD :TURBULENCE_4
LGTMOD:TURBULENCE_3
LGT :TURBULENCE_2
NEGLGT:TURBULENCE_1
NEG :TURBULENCE_0

View file

@ -1,71 +0,0 @@
s2s
-SHRA : PRESENT_WX_080
+SHRA : PRESENT_WX_082
SHRA : PRESENT_WX_081
-SHSN : PRESENT_WX_085
+SHSN : PRESENT_WX_086
SHSN : PRESENT_WX_086
-TSRA : PRESENT_WX_095
+TSRA : PRESENT_WX_097
TSRA : PRESENT_WX_095
-TSSN : PRESENT_WX_095
+TSSN : PRESENT_WX_097
TSSN : PRESENT_WX_095
FZRASN : PRESENT_WX_066
BCBR : PRESENT_WX_010
MIBR : PRESENT_WX_010
BR : PRESENT_WX_010
FZFG : PRESENT_WX_048
BCFG : PRESENT_WX_041
MIFG : PRESENT_WX_044
FG : PRESENT_WX_045
TS : PRESENT_WX_095
+TS : PRESENT_WX_097
FC : PRESENT_WX_019
+FC : PRESENT_WX_019
PO : PRESENT_WX_008
DRSN : PRESENT_WX_036
+DRSN : PRESENT_WX_037
BLSN : PRESENT_WX_038
+BLSN : PRESENT_WX_039
FU : PRESENT_WX_004
HZ : PRESENT_WX_005
-SH : PRESENT_WX_080
SH : PRESENT_WX_081
DU : PRESENT_WX_006
SA : PRESENT_WX_007
SS : PRESENT_WX_009
DS : PRESENT_WX_009
+SS : PRESENT_WX_009
+DS : PRESENT_WX_009
-FZRA : PRESENT_WX_066
-FZDZ : PRESENT_WX_056
FZRA : PRESENT_WX_067
FZDZ : PRESENT_WX_057
GR : PRESENT_WX_088
IC : PRESENT_WX_078
PE : PRESENT_WX_079
PL : PRESENT_WX_079
GS : PRESENT_WX_087
DZRA : PRESENT_WX_058
RADZ : PRESENT_WX_058
RASN : PRESENT_WX_069
SNRA : PRESENT_WX_069
-RA : PRESENT_WX_061
+RA : PRESENT_WX_065
RA : PRESENT_WX_063
-DZ : PRESENT_WX_051
+DZ : PRESENT_WX_055
DZ : PRESENT_WX_053
-SN : PRESENT_WX_071
+SN : PRESENT_WX_075
SN : PRESENT_WX_073
-UP : PRESENT_WX_203
+UP : PRESENT_WX_203
UP : PRESENT_WX_203
IP : PRESENT_WX_079
SG : PRESENT_WX_077
VA : PRESENT_WX_201
PRFG : PRESENT_WX_044
SQ : PRESENT_WX_018
BLDU : PRESENT_WX_007

View file

@ -85,8 +85,10 @@ if [ -f /awips2/java/jre/lib/amd64/server/libjvm.so ]; then
fi
#run a loop for alertviz
while [ $exitVal -ne 0 ]
count=0
while [ $exitVal -ne 0 -a $count -lt 10 ]
do
count=`expr $count + 1`
curTime=`date +%Y%m%d_%H%M%S`
LOGFILE=${LOGDIR}/alertviz_${curTime}_console.log
export LOGFILE_ALERTVIZ=${LOGDIR}/alertviz_${curTime}_admin.log

View file

@ -28,6 +28,8 @@
# cave sessions.
# Dec 05, 2013 #2590 dgilling Modified so gfeclient.sh can be wrapped
# around this script.
# Jan 24, 2014 #2739 bsteffen Log exit status
# Jan 30, 2014 #2593 bclement warns based on memory usage, fixed for INI files with spaces
#
#
@ -45,6 +47,8 @@ JAVA_INSTALL="/awips2/java"
PYTHON_INSTALL="/awips2/python"
export AWIPS_INSTALL_DIR="${CAVE_INSTALL}"
MAX_MEM_PROPORTION="0.9"
source ${CAVE_INSTALL}/caveUtil.sh
RC=$?
if [ ${RC} -ne 0 ]; then
@ -61,6 +65,9 @@ copyVizShutdownUtilIfNecessary
# delete any old disk caches in the background
deleteOldCaveDiskCaches &
# Enable core dumps
ulimit -c unlimited
export LD_LIBRARY_PATH=${JAVA_INSTALL}/lib:${PYTHON_INSTALL}/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=libpython.so
if [[ -z "$CALLED_EXTEND_LIB_PATH" ]]; then
@ -109,20 +116,39 @@ export TEXTWS=`hostname | sed -e 's/lx/xt/g'`
hostName=`hostname -s`
if [[ $hostName =~ xt.* ]]; then
export IGNORE_NUM_CAVES=1
fi
# check number of running caves
if [[ -z $IGNORE_NUM_CAVES ]]; then
# free usually reports below on G threshold (11 instead of 12G), giving the 3 cave recommended in field
mem=( `free -g | grep "Mem:"` )
# get total memory on system in bytes
mem=( `free -b | grep "Mem:"` )
mem=${mem[1]}
let _maxCaves=mem/3
getPidsOfMyRunningCaves
if [[ "$_numPids" -ge "$_maxCaves" ]]; then
zenity --question --title "Max CAVE sessions already running" --text "$_numPids CAVE sessions already running. Starting more may impact system performance and stability.\n\nProceed?"
# get max amount of system memory used before we warn
memThreshold=$(echo "$mem * $MAX_MEM_PROPORTION" | bc)
# remove decimal
printf -v memThreshold "%.0f" "$memThreshold"
# get launcher.ini argument determined by user arguments
lookupINI "$@"
launcherRegex='--launcher.ini\s(.+\.ini)'
# default to cave.ini
targetIni="/awips2/cave/cave.ini"
if [[ $CAVE_INI_ARG =~ $launcherRegex ]]
then
targetIni="${BASH_REMATCH[1]}"
fi
# read max memory that could be used by this instance
memOfLaunchingCave=$(readMemFromIni "$targetIni")
# read total max memory of caves already running
getTotalMemOfRunningCaves
# add them together
_totalAfterStart=$(($memOfLaunchingCave + $_totalRunningMem))
if [[ "$_totalAfterStart" -ge "$memThreshold" ]]; then
# convert to megs for display
memOfLaunchingCave=$(($memOfLaunchingCave / $BYTES_IN_MB))
_totalRunningMem=$(($_totalRunningMem / $BYTES_IN_MB))
getPidsOfMyRunningCaves
memMsg="$_numPids CAVE applications already running with a combined max memory of ${_totalRunningMem}MB. "
memMsg+="The requested application has a max memory requirement of ${memOfLaunchingCave}MB. "
memMsg+="Starting may impact system performance and stability.\n\nProceed?"
zenity --question --title "Low Available Memory for Application" --text "$memMsg"
cancel="$?"
if [[ "$cancel" == "1" ]]; then
@ -172,49 +198,59 @@ if [ ! -d $LOGDIR ]; then
mkdir -p $LOGDIR
fi
export pid=$$
curTime=`date +%Y%m%d_%H%M%S`
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_alertviz.log"
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_perf.log"
# can we write to log directory
if [ -w ${LOGDIR} ]; then
touch ${LOGFILE}
fi
# At this point fork so that log files can be set up with the process pid and
# this process can log the exit status of cave.
(
export pid=`/bin/bash -c 'echo $PPID'`
# remove "-noredirect" flag from command-line if set so it doesn't confuse any
# commands we call later.
redirect="true"
USER_ARGS=()
while [[ $1 ]]
do
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_alertviz.log"
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_perf.log"
# can we write to log directory
if [ -w ${LOGDIR} ]; then
touch ${LOGFILE}
fi
# remove "-noredirect" flag from command-line if set so it doesn't confuse any
# commands we call later.
redirect="true"
USER_ARGS=()
while [[ $1 ]]
do
if [[ "$1" == "-noredirect" ]]
then
redirect="false"
redirect="false"
else
USER_ARGS+=("$1")
USER_ARGS+=("$1")
fi
shift
done
done
# Special instructions for the 64-bit jvm.
ARCH_ARGS=""
if [ -f /awips2/java/jre/lib/amd64/server/libjvm.so ]; then
ARCH_ARGS="-vm /awips2/java/jre/lib/amd64/server/libjvm.so"
fi
# Special instructions for the 64-bit jvm.
ARCH_ARGS=""
if [ -f /awips2/java/jre/lib/amd64/server/libjvm.so ]; then
ARCH_ARGS="-vm /awips2/java/jre/lib/amd64/server/libjvm.so"
fi
lookupINI "${USER_ARGS[@]}"
lookupINI "${USER_ARGS[@]}"
if [[ "${runMonitorThreads}" == "true" ]] ; then
# nohup to allow tar process to continue after user has logged out
nohup ${CAVE_INSTALL}/monitorThreads.sh $pid >> /dev/null 2>&1 &
fi
if [[ "${runMonitorThreads}" == "true" ]] ; then
# nohup to allow tar process to continue after user has logged out
nohup ${CAVE_INSTALL}/monitorThreads.sh $pid >> /dev/null 2>&1 &
fi
if [[ "${redirect}" == "true" ]] ; then
exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} "${CAVE_INI_ARG}" "${USER_ARGS[@]}" > ${LOGFILE} 2>&1
else
exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} "${CAVE_INI_ARG}" "${USER_ARGS[@]}" 2>&1 | tee ${LOGFILE}
fi
) &
pid=$!
LOGFILE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_${pid}_console.log"
logExitStatus $pid $LOGFILE
if [[ "${redirect}" == "true" ]] ; then
exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} "${USER_ARGS[@]}" > ${LOGFILE} 2>&1
else
exec ${CAVE_INSTALL}/cave ${ARCH_ARGS} ${SWITCHES} ${CAVE_INI_ARG} "${USER_ARGS[@]}" 2>&1 | tee ${LOGFILE}
fi

View file

@ -25,6 +25,10 @@
# Dec 05, 2013 #2593 rjpeter Fix getPidsOfMyRunningCaves
# Dec 05, 2013 #2590 dgilling Modified extendLibraryPath() to export a
# var if it's already been run.
# Jan 24, 2014 #2739 bsteffen Add method to log exit status of process.
# Jan 30, 2014 #2593 bclement extracted generic part of getPidsOfMyRunningCaves into forEachRunningCave
# added methods for reading max memory from .ini files
# fixes for INI files with spaces
#
#
@ -39,6 +43,10 @@ fi
# This script will be sourced by cave.sh.
export CAVE_INI_ARG=
BYTES_IN_KB=1024
BYTES_IN_MB=1048576
BYTES_IN_GB=1073741824
function lookupINI()
{
# Arguments:
@ -55,7 +63,7 @@ function lookupINI()
position=$(( $position + 1 ))
nextArg=${!position}
retrieveAssociatedINI ${arg} ${nextArg}
retrieveAssociatedINI ${arg} "${nextArg}"
RC=$?
if [ ${RC} -eq 0 ]; then
export CAVE_INI_ARG="--launcher.ini /awips2/cave/${ASSOCIATED_INI}"
@ -116,8 +124,8 @@ function copyVizShutdownUtilIfNecessary()
chmod a+x ${HOME}/.kde/shutdown/${VIZ_UTILITY_SCRIPT}
}
# returns _numPids and array _pids containing the pids of the currently running cave sessions.
function getPidsOfMyRunningCaves()
# takes a function as an argument and calls the function passing in the ps string of the process
function forEachRunningCave()
{
local user=`whoami`
local caveProcs=`ps -ef | grep -E "(/awips2/cave|/usr/local/viz)/cave " | grep -v "grep" | grep $user`
@ -125,17 +133,89 @@ function getPidsOfMyRunningCaves()
# preserve IFS and set it to line feed only
local PREV_IFS=$IFS
IFS=$'\n'
_numPids=0
# grab the pids for future use
for caveProc in $caveProcs
do
_pids[$_numPids]=`echo $caveProc | awk '{print $2}'`
let "_numPids+=1"
"$@" $caveProc
done
IFS=$PREV_IFS
}
# takes in ps string of cave process, stores pid in _pids and increments _numPids
function processPidOfCave()
{
_pids[$_numPids]=`echo $1 | awk '{print $2}'`
let "_numPids+=1"
}
# returns _numPids and array _pids containing the pids of the currently running cave sessions.
function getPidsOfMyRunningCaves()
{
_numPids=0
forEachRunningCave processPidOfCave
}
# takes a name of an ini file as an argument, echos the memory (in bytes) from file (or default)
function readMemFromIni()
{
local inifile="$1"
local mem
local unit
local regex='^[^#]*-Xmx([0-9]+)([bBkKmMgG])?'
# read ini file line by line looking for Xmx arg
while read -r line
do
if [[ $line =~ $regex ]]
then
mem=${BASH_REMATCH[1]}
unit=${BASH_REMATCH[2]}
break
fi
done < "$inifile"
# convert to bytes
case "$unit" in
[kK])
mem=$(($mem * $BYTES_IN_KB))
;;
[mM])
mem=$(($mem * $BYTES_IN_MB))
;;
[gG])
mem=$(($mem * $BYTES_IN_GB))
;;
esac
regex='^[0-9]+$'
if [[ ! $mem =~ $regex ]]
then
# we couldn't find a valid Xmx value
# java default is usually 1G
mem=1073741824
fi
echo $mem
}
# takes in ps string of cave process, reads Xmx from ini and adds bytes to _totalRunninMem
function addMemOfCave()
{
local inifile
# get ini file from process string
local regex='--launcher.ini\s(.+\.ini)'
if [[ $1 =~ $regex ]]
then
inifile="${BASH_REMATCH[1]}"
else
inifile="/awips2/cave/cave.ini"
fi
let "_totalRunningMem+=$(readMemFromIni "$inifile")"
}
# finds total max memory of running caves in bytes and places it in _totalRunningMem
function getTotalMemOfRunningCaves()
{
_totalRunningMem=0
forEachRunningCave addMemOfCave
}
function deleteOldCaveDiskCaches()
{
local curDir=`pwd`
@ -193,3 +273,28 @@ function deleteOldCaveDiskCaches()
cd $curDir
}
# log the exit status and time to a log file, requires 2 args pid and log file
function logExitStatus()
{
pid=$1
logFile=$2
trap 'kill $pid' SIGHUP SIGINT SIGQUIT SIGTERM
wait $pid
exitCode=$?
curTime=`date --rfc-3339=seconds`
echo Exited at $curTime with an exit status of $exitCode >> $logFile
# If a core file was generated attempt to save it to a better place
coreFile=core.$pid
if [ -f "$coreFile" ]; then
basePath="/data/fxa/cave"
hostName=`hostname -s`
hostPath="$basePath/$hostName/"
mkdir -p $hostPath
if [ -d "$hostPath" ]; then
cp $coreFile $hostPath
fi
fi
}

View file

@ -81,6 +81,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* archive and category directory and
* implementation of compression.
* Oct 08, 2013 2442 rferrel Remove category directory.
* Feb 04, 2013 2270 rferrel Move HDF files to parent's directory.
*
* </pre>
*
@ -89,6 +90,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*/
public class GenerateCaseDlg extends CaveSWTDialog {
/** Extension for HDF files. */
private static final String hdfExt = ".h5";
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(GenerateCaseDlg.class);
@ -539,6 +544,11 @@ public class GenerateCaseDlg extends CaveSWTDialog {
new File(destination, file));
}
} else {
// DR 2270 bump HDF files up a directory.
if (destination.getName().endsWith(hdfExt)) {
destination = new File(destination.getParentFile()
.getParentFile(), destination.getName());
}
FileUtil.copyFile(source, destination);
destination.setLastModified(source.lastModified());
}
@ -652,6 +662,13 @@ public class GenerateCaseDlg extends CaveSWTDialog {
addTarFiles(file.listFiles());
}
} else {
// DR 2270 bump HDF files up a directory.
if (name.endsWith(hdfExt)) {
File destination = new File(file.getParentFile()
.getParentFile(), file.getName());
name = destination.getAbsolutePath().substring(
startRelativePath);
}
TarArchiveEntry entry = new TarArchiveEntry(file, name);
entry.setSize(file.length());
FileInputStream fileStream = null;

View file

@ -21,10 +21,6 @@
package com.raytheon.uf.viz.core;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
@ -52,6 +48,7 @@ import com.raytheon.uf.viz.core.localization.LocalizationManager;
* Jan 14, 2013 1469 bkowal Removed the hdf5 data directory.
* Aug 27, 2013 2295 bkowal Removed the jms server property; added
* jms connection string
* Feb 17, 2014 2812 njensen getHostName() now uses getWsId()'s hostname
*
* </pre>
*
@ -255,45 +252,20 @@ public final class VizApp {
private static String host = null;
/**
* Gets the ip address of the host machine calling the function
* Gets the host name from the WsId of the host machine calling the function
*
* @return
*/
public static synchronized String getHostName() {
if (host == null) {
InetAddress addrToUse = null;
boolean found = false;
try {
Enumeration<NetworkInterface> nis = NetworkInterface
.getNetworkInterfaces();
while (nis.hasMoreElements() && !found) {
NetworkInterface ni = nis.nextElement();
ni.isVirtual();
ni.isUp();
Enumeration<InetAddress> addrs = ni.getInetAddresses();
while (addrs.hasMoreElements() && !found) {
InetAddress addr = addrs.nextElement();
if (addr.isLinkLocalAddress() == false
&& addr.isSiteLocalAddress() == false
&& addr.isLoopbackAddress() == false) {
addrToUse = addr;
found = true;
}
}
}
} catch (SocketException e) {
e.printStackTrace();
}
if (addrToUse == null) {
host = getWsId().getHostName();
if (host == null) {
String hostname = System.getenv("HOSTNAME");
if (hostname != null && hostname.trim().length() == 0) {
if (hostname != null && hostname.trim().length() > 0) {
host = hostname;
} else {
host = "localhost";
}
} else {
host = addrToUse.getHostName();
}
}
return host;

View file

@ -19,6 +19,10 @@
**/
package com.raytheon.uf.viz.core.comm;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.comm.IHttpsCredentialsHandler;
import com.raytheon.uf.viz.core.auth.UserController;
@ -34,6 +38,7 @@ import com.raytheon.uf.viz.core.auth.UserController;
* ------------ ---------- ----------- --------------------------
* Mar 04, 2013 1786 mpduff Initial creation.
* Jun 07, 2013 1981 mpduff Save user's username in UserController.
* Feb 10, 2014 2704 njensen Added credentialsFailed()
*
* </pre>
*
@ -59,4 +64,11 @@ public class CaveHttpsCredentialsHandler implements IHttpsCredentialsHandler {
UserController.updateUserData(credentials[0]);
return credentials;
}
@Override
public void credentialsFailed() {
MessageDialog.openError(new Shell(Display.getDefault()),
"Login failed",
"Invalid username and/or password. Please try again.");
}
}

View file

@ -20,9 +20,7 @@
package com.raytheon.uf.viz.core.comm;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -55,7 +53,8 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Mar 22, 2013 1786 mpduff Changed to use HttpClient for
* connectivity.
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Jan 15, 2013 njensen Added printConnectivityProblems()
* Jan 15, 2014 njensen Added printConnectivityProblems()
* Feb 04, 2014 2704 njensen Check JMS capability, return exceptions with results
*
* </pre>
*
@ -77,9 +76,16 @@ public class ConnectivityManager {
public String server;
public Exception exception;
public ConnectivityResult(boolean hc, String server) {
this(hc, server, null);
}
public ConnectivityResult(boolean hc, String server, Exception e) {
this.hasConnectivity = hc;
this.server = server;
this.exception = e;
}
}
@ -94,6 +100,7 @@ public class ConnectivityManager {
public static void checkHttpServer(String server,
IConnectivityCallback callback) {
boolean good = false;
Exception exc = null;
try {
HttpClient client = HttpClient.getInstance();
HttpGet request = new HttpGet();
@ -101,9 +108,9 @@ public class ConnectivityManager {
client.executeRequest(request);
good = true;
} catch (Exception e) {
printConnectivityProblem(server, "http", e);
exc = e;
}
callback.connectionChecked(new ConnectivityResult(good, server));
callback.connectionChecked(new ConnectivityResult(good, server, exc));
}
/**
@ -115,12 +122,13 @@ public class ConnectivityManager {
public static void checkLocalizationServer(String server,
IConnectivityCallback callback) {
boolean good = false;
Exception exc = null;
try {
good = checkLocalizationServer(server, true) != null;
} catch (Exception e) {
printConnectivityProblem(server, "localization", e);
exc = e;
}
callback.connectionChecked(new ConnectivityResult(good, server));
callback.connectionChecked(new ConnectivityResult(good, server, exc));
}
/**
@ -142,47 +150,49 @@ public class ConnectivityManager {
.sendRequest(req, server);
getServersResponseCache.put(server, resp);
return resp;
}
/**
* Checks the connectivity of the given server
* Checks the connectivity of the given alert service
*
* @param server
* server to check
* @return whether quit was selected. TODO: need to return two booleans, one
* for quit and one for connectivity
*/
public static void checkJmsServer(String server,
public static void checkAlertService(String server,
IConnectivityCallback callback) {
boolean good = true;
Exception exc = null;
try {
ActiveMQConnectionFactory f = new ActiveMQConnectionFactory(server);
f.createConnection().close();
} catch (JMSException e) {
printConnectivityProblem(server, "JMS", e);
exc = e;
good = false;
}
callback.connectionChecked(new ConnectivityResult(good, server));
callback.connectionChecked(new ConnectivityResult(good, server, exc));
}
/**
* Prints the connectivity exception to the console, to help with diagnosing
* connection issues
* Checks the connectivity of the given JMS server
*
* @param server
* the server address it attempted to connect to
* @param serverType
* the type of server it attempted to connect to
* @param e
* the exception that occurred
* @param connectionString
* @param callback
*/
private static void printConnectivityProblem(String server,
String serverType, Exception e) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(sdf.format(new Date()) + " MAY NOT BE AN ERROR:");
System.out.println("Couldn't connect to " + serverType + " server at "
+ server);
e.printStackTrace(System.out);
public static void checkJmsServer(String connectionString,
IConnectivityCallback callback) {
boolean good = true;
Exception exc = null;
try {
JMSConnection jms = new JMSConnection(connectionString);
jms.getFactory().createConnection().close();
} catch (JMSException e) {
exc = e;
good = false;
}
callback.connectionChecked(new ConnectivityResult(good,
connectionString, exc));
}
}

View file

@ -42,7 +42,8 @@ import org.eclipse.ui.PlatformUI;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 6, 2013 1786 mpduff Initial creation
* Mar 06, 2013 1786 mpduff Initial creation
* Feb 10, 2014 2704 njensen Allow message to expand size of dialog
*
* </pre>
*
@ -50,6 +51,7 @@ import org.eclipse.ui.PlatformUI;
* @version 1.0
*/
public class HttpsLoginDlg extends Dialog {
private static final long serialVersionUID = 1L;
private Shell shell;
@ -76,7 +78,7 @@ public class HttpsLoginDlg extends Dialog {
*/
public HttpsLoginDlg(String message) {
super(new Shell(Display.getDefault(), SWT.TITLE));
this.message = message;
this.message = message.replace("\"", "");
}
/**
@ -112,7 +114,9 @@ public class HttpsLoginDlg extends Dialog {
comp.setLayout(new GridLayout(2, false));
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 500;
if (message == null || message.length() < 50) {
gd.widthHint = 500;
}
gd.horizontalSpan = 2;
Label authMessage = new Label(comp, SWT.CENTER);

View file

@ -19,11 +19,17 @@
**/
package com.raytheon.uf.viz.core.localization;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.net.UnknownHostException;
import java.util.regex.Pattern;
import org.apache.http.conn.HttpHostConnectException;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.VerifyEvent;
@ -41,6 +47,8 @@ import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.comm.HttpServerException;
import com.raytheon.uf.common.comm.InvalidURIException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -58,6 +66,9 @@ import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
* ------------ ---------- ----------- --------------------------
* Aug 05, 2009 mschenke Initial creation
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Shifted some private fields/methods to protected,
* Added status and details, better site validation
* Feb 17, 2014 2704 njensen Changed some alertviz fields to protected
*
* </pre>
*
@ -66,16 +77,23 @@ import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
*/
public class ConnectivityPreferenceDialog extends Dialog {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ConnectivityPreferenceDialog.class, "CAVE");
protected static final Pattern VALID_SITENAME = Pattern
.compile("^[A-Za-z0-9._-]+$");
private class LocalizationCallback implements IConnectivityCallback {
@Override
public void connectionChecked(ConnectivityResult results) {
localizationGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private class AlertVizCallback implements IConnectivityCallback {
@ -83,31 +101,32 @@ public class ConnectivityPreferenceDialog extends Dialog {
@Override
public void connectionChecked(ConnectivityResult results) {
alertVizGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
/**
* Set time dialog shell
*/
private Shell shell;
/**
* Display component
*/
private Display display;
protected Display display;
private Label localizationLabel;
private Text localizationText;
protected Text localizationText;
private String localization = "";
private boolean localizationGood = false;
private Text alertVizText;
protected Text alertVizText;
private String alertVizServer = null;
protected String alertVizServer = null;
private boolean alertVizGood = true;
@ -115,10 +134,16 @@ public class ConnectivityPreferenceDialog extends Dialog {
private String site = "";
private Text siteText;
protected Text siteText;
private Label statusLabel;
private boolean canceled = false;
private Composite detailsComp;
private StyledText detailsText;
private IConnectivityCallback localizationCallback = new LocalizationCallback();
private IConnectivityCallback alertCallback = new AlertVizCallback();
@ -126,14 +151,20 @@ public class ConnectivityPreferenceDialog extends Dialog {
/**
* Title of the dialog.
*/
private static final String dialogTitle = "Connectivity Preferences";
private String title;
public ConnectivityPreferenceDialog(boolean checkAlertViz) {
this(new Shell(Display.getDefault()), checkAlertViz);
protected String status;
protected String details;
public ConnectivityPreferenceDialog(boolean checkAlertViz, String title) {
this(new Shell(Display.getDefault()), checkAlertViz, title);
}
public ConnectivityPreferenceDialog(Shell parentShell, boolean checkAlertViz) {
public ConnectivityPreferenceDialog(Shell parentShell,
boolean checkAlertViz, String title) {
super(parentShell);
this.title = title;
localization = LocalizationManager.getInstance()
.getLocalizationServer();
site = LocalizationManager.getInstance().getSite();
@ -155,8 +186,8 @@ public class ConnectivityPreferenceDialog extends Dialog {
if (!validate()) {
Shell parent = getParent();
display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM);
shell.setText(dialogTitle);
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
shell.setText(title);
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, true);
@ -165,6 +196,9 @@ public class ConnectivityPreferenceDialog extends Dialog {
initializeComponents();
shell.pack();
shell.setMinimumSize(shell.getBounds().width,
shell.getBounds().height);
updateStatus(false, status, details);
shell.open();
while (!shell.isDisposed()) {
@ -177,16 +211,69 @@ public class ConnectivityPreferenceDialog extends Dialog {
}
private void initializeComponents() {
createErrorText();
Composite textBoxComp = new Composite(shell, SWT.NONE);
textBoxComp.setLayout(new GridLayout(2, false));
createTextBoxes(textBoxComp);
createStatusText();
createBottomButtons();
}
private void createErrorText() {
Label label = new Label(shell, SWT.CENTER);
label.setText("Error: Unable to connect to localization server");
/**
* Creates the status label, text, and details button
*/
protected void createStatusText() {
Composite comp = new Composite(shell, SWT.NONE);
comp.setLayout(new GridLayout(3, false));
comp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
Label lbl = new Label(comp, SWT.NONE);
lbl.setText("Status:");
GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
statusLabel = new Label(comp, SWT.BORDER);
statusLabel.setLayoutData(gd);
statusLabel.setText("");
final Button detailsButton = new Button(comp, SWT.TOGGLE);
detailsButton.setText("Details");
detailsButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (detailsComp.isVisible()) {
((GridData) detailsComp.getLayoutData()).exclude = true;
detailsComp.setVisible(false);
shell.pack();
} else {
((GridData) detailsComp.getLayoutData()).exclude = false;
((GridData) detailsComp.getLayoutData()).widthHint = detailsComp
.getBounds().width;
detailsComp.setVisible(true);
shell.pack();
}
}
});
createDetailsText();
}
/**
* Creates the expanding details text
*/
protected void createDetailsText() {
detailsComp = new Composite(shell, SWT.NONE);
detailsComp.setLayout(new GridLayout(1, false));
detailsComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 150;
detailsText = new StyledText(detailsComp, SWT.BORDER | SWT.MULTI
| SWT.H_SCROLL | SWT.V_SCROLL);
detailsText.setText("");
detailsText.setLayoutData(gd);
/*
* Hide the composite
*/
((GridData) detailsComp.getLayoutData()).exclude = true;
detailsComp.setVisible(false);
}
protected void createTextBoxes(Composite textBoxComp) {
@ -194,12 +281,12 @@ public class ConnectivityPreferenceDialog extends Dialog {
localizationLabel = new Label(textBoxComp, SWT.RIGHT);
localizationLabel.setText("Localization Server:");
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
GridData gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
localizationLabel.setLayoutData(gd);
localizationText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
localizationText = new Text(textBoxComp, SWT.BORDER);
gd = new GridData(SWT.LEFT, SWT.None, true, true);
gd.widthHint = 300;
localizationText.setLayoutData(gd);
localizationText.setText(localization == null ? "" : localization);
@ -207,17 +294,18 @@ public class ConnectivityPreferenceDialog extends Dialog {
Label label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Site:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
label.setLayoutData(gd);
siteText = new Text(textBoxComp, SWT.NONE);
siteText = new Text(textBoxComp, SWT.BORDER);
siteText.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
e.text = e.text.toUpperCase();
}
});
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd = new GridData(SWT.LEFT, SWT.None, true, true);
gd.widthHint = 300;
siteText.setLayoutData(gd);
siteText.setText(site == null ? "" : site);
@ -299,7 +387,7 @@ public class ConnectivityPreferenceDialog extends Dialog {
shell.setVisible(false);
MessageDialog
.openError(
null,
shell,
"Connectivity Error",
"Unable to validate localization preferences, please enter valid options or quit the application");
shell.setVisible(true);
@ -327,6 +415,8 @@ public class ConnectivityPreferenceDialog extends Dialog {
}
public boolean validate() {
status = null;
details = null;
if (localizationText != null && !localizationText.isDisposed()
&& localizationText.isEnabled()) {
String localization = localizationText.getText().trim();
@ -360,20 +450,28 @@ public class ConnectivityPreferenceDialog extends Dialog {
} else {
validateSite();
}
return siteGood && localizationGood && alertVizGood;
boolean everythingGood = siteGood && localizationGood && alertVizGood;
updateStatus(everythingGood, status, details);
return everythingGood;
}
private void validateLocalization() {
ConnectivityManager.checkLocalizationServer(localization, localizationCallback);
ConnectivityManager.checkLocalizationServer(localization,
localizationCallback);
}
private void validateAlertviz() {
ConnectivityManager.checkJmsServer(alertVizServer, alertCallback);
protected void validateAlertviz() {
ConnectivityManager.checkAlertService(alertVizServer, alertCallback);
}
private void validateSite() {
if (site == null || site.trim().equals("")) {
protected void validateSite() {
if (site == null || site.trim().length() == 0
|| !VALID_SITENAME.matcher(site).find()) {
siteGood = false;
if (status == null) {
status = "Invalid Site ID";
}
} else {
siteGood = true;
}
@ -387,6 +485,20 @@ public class ConnectivityPreferenceDialog extends Dialog {
}
}
/**
* Gets the color for the status label
*
* @param isGood
* @return
*/
protected Color getForegroundColor(boolean isGood) {
if (isGood) {
return display.getSystemColor(SWT.COLOR_DARK_GREEN);
} else {
return display.getSystemColor(SWT.COLOR_DARK_RED);
}
}
public String getLocalization() {
return localization;
}
@ -438,4 +550,118 @@ public class ConnectivityPreferenceDialog extends Dialog {
localizationText.setEnabled(enabled);
}
}
/**
* Builds a details string based on a stacktrace of connectivity results. If
* there is no exception with the results, this returns the empty string.
*
* @param results
* @return
*/
protected String buildDetails(ConnectivityResult results) {
StringBuilder sb = new StringBuilder();
if (results.exception != null) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
results.exception.printStackTrace(ps);
String stack = baos.toString();
ps.close();
sb.append(stack);
}
return sb.toString();
}
/**
* Adds new details to the details field without overwriting it
*
* @param newDetails
*/
protected void appendDetails(String newDetails) {
if (details == null) {
details = "";
}
if (details.length() > 0) {
details += "\n\n\n";
}
details += newDetails;
}
/**
* Creates an error message for the status label by attempting to find the
* most relevant error message from the exception's stacktrace.
*
* @param result
* @return
*/
protected String buildErrorMessage(ConnectivityResult result) {
StringBuilder sb = new StringBuilder();
Exception prettyErrExc = result.exception;
/*
* Loop through the Caused Bys and try to find one that is the most
* useful for the label. This is totally arbitrary and corresponds to
* what njensen predicted would be most useful.
*/
while (prettyErrExc != null) {
if (prettyErrExc instanceof HttpHostConnectException
|| prettyErrExc instanceof InvalidURIException) {
sb.append(prettyErrExc.getMessage());
break;
}
if (prettyErrExc instanceof UnknownHostException) {
sb.append("Unknown host: " + prettyErrExc.getMessage());
break;
} else if (prettyErrExc instanceof HttpServerException) {
sb.append("Server returned Error ");
String emsg = prettyErrExc.getMessage();
int titleIndex = emsg.indexOf("<title>");
if (titleIndex > -1) {
String httpMsg = emsg.substring(titleIndex + 7,
emsg.indexOf("</title>"));
sb.append(httpMsg);
} else {
int statusCode = ((HttpServerException) prettyErrExc)
.getStatusCode();
sb.append(statusCode);
break;
}
}
prettyErrExc = (Exception) prettyErrExc.getCause();
}
if (sb.length() == 0) {
if (result.exception != null
&& result.exception.getMessage() != null) {
sb.append(result.exception.getMessage());
} else {
sb.append("Connectivity Error");
}
}
return sb.toString();
}
/**
* Updates the status label and details of the connectivity dialog
*
* @param good
* @param status
* @param details
*/
protected void updateStatus(boolean good, String status, String details) {
if (statusLabel != null && !statusLabel.isDisposed()
&& detailsText != null && !detailsText.isDisposed()) {
statusLabel.setForeground(getForegroundColor(good));
detailsText.setText(details != null ? details : "");
if (good) {
statusLabel.setText("Successful connection");
} else {
if (status != null) {
statusLabel.setText(status);
} else {
// shoudln't be able to reach this but just in case
statusLabel.setText("Connection error");
}
}
}
}
}

View file

@ -52,6 +52,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
* provided by EDEX.
* Feb 04, 2014 2704 njensen Pass connectivity dialog title
*
* </pre>
*
@ -108,7 +109,7 @@ public class LocalizationInitializer {
protected void setupServers() throws VizException {
if (promptUI) {
ConnectivityPreferenceDialog dlg = new ConnectivityPreferenceDialog(
checkAlertviz);
checkAlertviz, "Connectivity Preferences");
if (dlg.open() == true) {
System.exit(0);
}

View file

@ -96,6 +96,7 @@ import com.raytheon.uf.viz.core.requests.ThriftClient;
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is now
* provided by EDEX.
* Feb 04, 2014 2704 njensen Allow setting server without saving
* Feb 06, 2014 2761 mnash Add region localization level
*
* </pre>
@ -233,14 +234,34 @@ public class LocalizationManager implements IPropertyChangeListener {
}
}
/**
* Sets the localization server and saves the setting
*
* @param currentServer
* the localization URI
*/
public void setCurrentServer(String currentServer) {
setCurrentServer(currentServer, true);
}
/**
* Sets the localization server
*
* @param currentServer
* the localization URI
* @param save
* whether or not to save the setting
*/
public void setCurrentServer(String currentServer, boolean save) {
if (!this.currentServer.equals(currentServer)) {
this.currentServer = currentServer;
if (!overrideServer) {
localizationStore.putValue(
LocalizationConstants.P_LOCALIZATION_HTTP_SERVER,
this.currentServer);
applyChanges();
if (save) {
applyChanges();
}
}
try {

View file

@ -236,7 +236,7 @@ public class LocalizationPreferences extends FieldEditorPreferencePage
if (alertEditor != null) {
text = alertEditor.getTextControl(getFieldEditorParent());
ConnectivityManager.checkJmsServer(text.getText().trim(),
ConnectivityManager.checkAlertService(text.getText().trim(),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {
@ -260,6 +260,7 @@ public class LocalizationPreferences extends FieldEditorPreferencePage
* @see
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
@Override
public void init(IWorkbench workbench) {
}

View file

@ -86,7 +86,7 @@ public class LocalizationServerEditor extends StringFieldEditor implements
ConnectivityManager.checkHttpServer(this.getTextControl().getText(),
this);
} else {
ConnectivityManager.checkJmsServer(this.getTextControl().getText(),
ConnectivityManager.checkAlertService(this.getTextControl().getText(),
this);
}
if (!good) {

View file

@ -20,19 +20,18 @@
package com.raytheon.uf.viz.core.reflect;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.framework.namespace.BundleNamespace;
import org.osgi.framework.namespace.PackageNamespace;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;
import org.reflections.scanners.SubTypesScanner;
@ -56,6 +55,7 @@ import com.raytheon.uf.viz.core.Activator;
* Oct 18, 2013 2491 bsteffen Initial creation
* Dec 10, 2013 2602 bsteffen Add null checks to detect unloaded
* bundles.
* Feb 03, 2013 2764 bsteffen Use OSGi API to get dependencies.
*
* </pre>
*
@ -68,15 +68,11 @@ public class SubClassLocator implements ISubClassLocator {
private static final String CACHE_FILENAME = "subclassCache.txt";
private static final Pattern COMMA_SPLIT = Pattern.compile("[,]");
private static final Pattern SEMICOLON_SPLIT = Pattern.compile("[;]");
private final Map<String, BundleReflections> reflectionLookup = new HashMap<String, BundleReflections>();
private final Map<String, Bundle> bundleLookup = new HashMap<String, Bundle>();
private final Map<String, List<Bundle>> requiredBundles = new HashMap<String, List<Bundle>>();
private final Map<String, Collection<Bundle>> requiredBundles = new HashMap<String, Collection<Bundle>>();
private final BundleClassCache cache;
@ -145,8 +141,8 @@ public class SubClassLocator implements ISubClassLocator {
*/
return Collections.emptySet();
}
if(bundle.getState() == Bundle.UNINSTALLED){
if (bundle.getState() == Bundle.UNINSTALLED) {
/*
* We won't be able to get a class loader for uninstalled bundles so
* don't process them.
@ -167,7 +163,8 @@ public class SubClassLocator implements ISubClassLocator {
Set<Class<?>> dependencies = getRequiredSubclasses(base, bundle,
recursiveClasses);
/* Must pass dependencies in so type heirarchy is complete. */
Set<Class<?>> owned = loadSubClassesReflectively(bundle, dependencies);
Set<Class<?>> owned = loadSubClassesReflectively(bundle,
dependencies);
/* populate the cache */
ownedNames = new String[owned.size()];
int index = 0;
@ -188,8 +185,7 @@ public class SubClassLocator implements ISubClassLocator {
Arrays.asList(ownedNames));
if (includeRequiredSubclasses) {
Set<Class<?>> dependencies = getRequiredSubclasses(base,
bundle,
recursiveClasses);
bundle, recursiveClasses);
Set<Class<?>> all = new HashSet<Class<?>>(dependencies);
all.addAll(owned);
recursiveClasses.put(bundleName, all);
@ -287,31 +283,32 @@ public class SubClassLocator implements ISubClassLocator {
}
/**
* Parse bundle header to get all required bundles
* Get back all the bundles this bundle depends on.
*
* @param bundle
* the bundle
* @return bundles required by bundle.
*/
private List<Bundle> getRequiredBundles(Bundle bundle) {
private Collection<Bundle> getRequiredBundles(Bundle bundle) {
String bundleName = bundle.getSymbolicName();
List<Bundle> required = requiredBundles.get(bundle);
Collection<Bundle> required = requiredBundles.get(bundleName);
if (required == null) {
required = new ArrayList<Bundle>();
String requiredBundlesHeader = bundle.getHeaders().get(
Constants.REQUIRE_BUNDLE);
if (requiredBundlesHeader != null) {
String[] requiredBundles = COMMA_SPLIT
.split(requiredBundlesHeader);
for (String requiredBundleName : requiredBundles) {
String[] nameParts = SEMICOLON_SPLIT
.split(requiredBundleName);
Bundle reqBundle = bundleLookup.get(nameParts[0]);
if (reqBundle != null) {
required.add(reqBundle);
}
required = new HashSet<Bundle>();
BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
if (bundleWiring != null) {
/* Get Required bundles */
for (BundleWire bw : bundleWiring
.getRequiredWires(BundleNamespace.BUNDLE_NAMESPACE)) {
required.add(bw.getProviderWiring().getBundle());
}
/* Get Bundles through import package */
for (BundleWire bw : bundleWiring
.getRequiredWires(PackageNamespace.PACKAGE_NAMESPACE)) {
required.add(bw.getProviderWiring().getBundle());
}
}
/* Avoid recursion */
required.remove(bundle);
requiredBundles.put(bundleName, required);
}

View file

@ -36,6 +36,7 @@ import org.geotools.referencing.crs.DefaultGeographicCRS;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.geospatial.CRSCache;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -63,14 +64,17 @@ import com.vividsolutions.jts.geom.Coordinate;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 8, 2012 mschenke Initial creation
* May 28, 2013 2037 njensen Made imageMap concurrent to fix leak
* Jun 20, 2013 2122 mschenke Fixed null pointer in interrogate and made
* canceling jobs safer
* Oct 16, 2013 2333 mschenke Added auto NaN checking for interrogation
* Nov 14, 2013 2492 mschenke Added more interrogate methods that take units
* Date Ticket# Engineer Description
* ------------- -------- ----------- -----------------------------------------
* Aug 08, 2012 mschenke Initial creation
* May 28, 2013 2037 njensen Made imageMap concurrent to fix leak
* Jun 20, 2013 2122 mschenke Fixed null pointer in interrogate and
* made canceling jobs safer
* Oct 16, 2013 2333 mschenke Added auto NaN checking for interrogation
* Nov 14, 2013 2492 mschenke Added more interrogate methods that take
* units
* Feb 07, 2014 2211 bsteffen Fix sampling units when data mapping is
* enabled.
*
* </pre>
*
@ -539,55 +543,65 @@ public class TileSetRenderable implements IRenderable {
public double interrogate(Coordinate coordinate, Unit<?> resultUnit,
double nanValue) throws VizException {
double dataValue = Double.NaN;
TileLevel level = tileSet.getTileLevel(lastPaintedLevel);
double[] grid = null;
try {
double[] local = new double[2];
llToLocalProj
.transform(new double[] { coordinate.x, coordinate.y }, 0,
local, 0, 1);
double localX = local[0];
double localY = local[1];
TileLevel level = tileSet.getTileLevel(lastPaintedLevel);
double[] grid = level.crsToGrid(localX, localY);
Tile tile = level.getTile(grid[0], grid[1]);
if (tile != null) {
DrawableImage di = imageMap.get(tile);
if (di != null) {
IImage image = di.getImage();
if (image instanceof IColormappedImage) {
IColormappedImage cmapImage = (IColormappedImage) image;
dataValue = cmapImage.getValue(
(int) grid[0] % tileSize, (int) grid[1]
% tileSize);
if (dataValue == nanValue) {
dataValue = Double.NaN;
} else {
Unit<?> dataUnit = cmapImage.getDataUnit();
if (resultUnit != null && dataUnit != null
&& dataUnit.equals(resultUnit) == false) {
if (resultUnit.isCompatible(dataUnit)) {
dataValue = dataUnit.getConverterTo(
resultUnit).convert(dataValue);
} else {
throw new IllegalArgumentException(
"Unable to interrogate tile set. "
+ String.format(
"Desired unit (%s) is not compatible with data unit (%s).",
UnitFormat
.getUCUMInstance()
.format(resultUnit),
UnitFormat
.getUCUMInstance()
.format(dataUnit)));
}
}
}
}
}
}
grid = level.crsToGrid(local[0], local[1]);
} catch (TransformException e) {
throw new VizException("Error interrogating ", e);
}
IColormappedImage cmapImage = null;
Tile tile = level.getTile(grid[0], grid[1]);
if (tile != null) {
DrawableImage di = imageMap.get(tile);
if (di != null) {
IImage image = di.getImage();
if (image instanceof IColormappedImage) {
cmapImage = (IColormappedImage) image;
}
}
}
if (cmapImage != null) {
dataValue = cmapImage.getValue((int) grid[0] % tileSize,
(int) grid[1] % tileSize);
if (dataValue == nanValue) {
dataValue = Double.NaN;
} else {
ColorMapParameters parameters = cmapImage
.getColorMapParameters();
Unit<?> dataUnit = cmapImage.getDataUnit();
if (parameters.getDataMapping() != null) {
/*
* Ignore dataUnit, use colorMapUnit which is derived from
* the data mapping
*/
dataUnit = parameters.getColorMapUnit();
}
if (resultUnit != null && dataUnit != null
&& dataUnit.equals(resultUnit) == false) {
if (resultUnit.isCompatible(dataUnit)) {
dataValue = dataUnit.getConverterTo(resultUnit)
.convert(dataValue);
} else {
UnitFormat uf = UnitFormat.getUCUMInstance();
String message = String
.format("Unable to interrogate tile set. Desired unit (%s) is not compatible with data unit (%s).",
uf.format(resultUnit),
uf.format(dataUnit));
throw new IllegalArgumentException(message);
}
}
}
}
return dataValue;
}
}

View file

@ -43,11 +43,11 @@ 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.BinOffset;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.DisplayType;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.uf.viz.productbrowser.AbstractRequestableProductBrowserDataDefinition;
import com.raytheon.uf.viz.productbrowser.ProductBrowserLabel;
import com.raytheon.uf.viz.productbrowser.ProductBrowserPreference;
@ -74,6 +74,7 @@ import com.raytheon.viz.pointdata.util.PointDataInventory;
* Nov 19, 2013 2458 mpduff Only pull subscriptions for the local site
* Nov 21, 2013 2554 dhladky Restored ADHOC's to working.
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -439,8 +440,8 @@ public class DataDeliveryProductBrowserDataDefinition
final ISubscriptionHandler handler = RegistryObjectHandlers
.get(ISubscriptionHandler.class);
try {
subList = handler.getByFilters(null, LocalizationManager
.getInstance().getCurrentSite());
subList = handler.getByFilters(null,
DataDeliveryUtils.getDataDeliveryId());
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}

View file

@ -26,7 +26,6 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.BandwidthUtilizationDlg;
import com.raytheon.uf.viz.datadelivery.bandwidth.ui.GraphDataUtil;
/**
* Action handler for the bandwidth scheduling graph.
@ -40,6 +39,7 @@ import com.raytheon.uf.viz.datadelivery.bandwidth.ui.GraphDataUtil;
* Nov 25, 2012 1269 mpduff Initial creation.
* Dec 13, 2012 1269 lvenable Updated to use a graph utility for the graph data.
* Oct 28, 2013 2430 mpduff Removed redraw if already open.
* Jan 29, 2014 2722 mpduff Don't get graph data up front.
*
* </pre>
*
@ -58,11 +58,9 @@ public class BandwidthScheduleGraphAction extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
if (dlg == null || dlg.isDisposed()) {
GraphDataUtil gdu = new GraphDataUtil(null);
gdu.retrieveData();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
dlg = new BandwidthUtilizationDlg(shell, gdu);
dlg = new BandwidthUtilizationDlg(shell);
dlg.open();
} else {
dlg.open();

View file

@ -31,11 +31,11 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionManagerFilter;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
/**
* Subscription Manager Dialog Action class.
@ -49,8 +49,9 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
* Jan 10, 2012 mpduff Initial creation
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
* May 28, 2013 1650 djohnson Allow using filters for the Subscription Manager Dialog.
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Sep 04, 2013 2330 bgonzale execute now filters subscriptions by current site id.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
*
* </pre>
@ -81,7 +82,7 @@ public class SubscriptionManagerAction extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) {
return loadSubscriptionManager(SubscriptionManagerFilters
.getBySiteId(LocalizationManager.getInstance().getCurrentSite()));
.getBySiteId(DataDeliveryUtils.getDataDeliveryId()));
}
/**

View file

@ -103,7 +103,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Nov 19, 2013 1531 mpduff Made graph resizable.
* Nov 25, 2013 2545 mpduff Default to Opsnet if Network not available yet.
* Dec 17, 2013 2633 mpduff Fix redraw problems..
* Jan 09, 2013 2633 mpduff On resize keep graph at bottom so data are always visible.
* Jan 09, 2014 2633 mpduff On resize keep graph at bottom so data are always visible.
* Jan 29, 2014 2722 mpduff Changed how graph data are requested.
* </pre>
*
* @author lvenable
@ -250,13 +251,13 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* @param graphDataUtil
* Bandwidth graph data object
*/
public BandwidthCanvasComp(Composite parentComp, GraphDataUtil graphDataUtil) {
public BandwidthCanvasComp(Composite parentComp) {
super(parentComp, SWT.BORDER);
this.parentComp = parentComp;
this.display = this.parentComp.getDisplay();
this.graphDataUtil = graphDataUtil;
this.bgd = this.graphDataUtil.getGraphData(false);
this.graphDataUtil = new GraphDataUtil(this);
this.bgd = this.graphDataUtil.getGraphData();
init();
}
@ -265,7 +266,6 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* Initialize method.
*/
private void init() {
this.graphDataUtil.setDataUpdateCallback(this);
NotificationManagerJob.addObserver("notify.msg", this);
this.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
@ -1409,7 +1409,7 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
* @param graphData
* Bandwidth graph data.
*/
public void setGraphData(BandwidthGraphData graphData) {
private void setGraphData(BandwidthGraphData graphData) {
this.bgd = graphData;
generateCanvasSettings();
@ -1527,14 +1527,15 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
// Do a full update every 10 minutes
if (fullUpdateMinuteCount > 10) {
graphDataUtil.requestGraphDataUsingThread();
fullUpdateMinuteCount = 0;
}
}
}
}
/**
* This method will update the subscription table with any updates,
* deletions, or new subscriptions.
* This method will update the graph with any updates, deletions, or new
* subscriptions.
*/
@Override
public void notificationArrived(NotificationMessage[] messages) {
@ -1559,7 +1560,7 @@ public class BandwidthCanvasComp extends Composite implements IDialogClosed,
VizApp.runAsync(new Runnable() {
@Override
public void run() {
setGraphData(graphDataUtil.getGraphData(true));
setGraphData(graphDataUtil.getGraphData());
updateCanvasSettings();
updateCanvases();
layout();

View file

@ -53,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Dec 13, 2012 1269 lvenable Fixes and updates.
* Oct 28, 2013 2430 mpduff Add % of bandwidth utilized graph.
* Nov 19, 2013 1531 mpduff Made resizable.
* Jan 29, 2014 2722 mpduff GraphDataUtil not in this class.
*
* </pre>
*
@ -77,9 +78,6 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
/** Graph composite */
private BandwidthCanvasComp canvasComp;
/** Graph data utility class */
private final GraphDataUtil graphDataUtil;
private MenuItem displayOpsNetMI;
private MenuItem displaySbnMI;
@ -92,12 +90,10 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
* @param graphDataUtil
* Graph data utility object
*/
public BandwidthUtilizationDlg(Shell parent, GraphDataUtil graphDataUtil) {
public BandwidthUtilizationDlg(Shell parent) {
super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE, CAVE.DO_NOT_BLOCK
| CAVE.INDEPENDENT_SHELL);
setText("Bandwidth Utilization");
this.graphDataUtil = graphDataUtil;
}
/**
@ -133,7 +129,7 @@ public class BandwidthUtilizationDlg extends CaveSWTDialog {
mainComp.setLayout(gl);
mainComp.setLayoutData(gd);
canvasComp = new BandwidthCanvasComp(mainComp, graphDataUtil);
canvasComp = new BandwidthCanvasComp(mainComp);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gl = new GridLayout(1, false);

View file

@ -46,6 +46,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Dec 12, 2012 1269 lvenable Initial creation
* Feb 14, 2013 1596 djohnson Remove sysouts, correct statusHandler class, handle null response.
* Mar 26, 2013 1827 djohnson Graph data should be requested from data delivery.
* Jan 29, 2014 2722 mpduff Callback is now passed in.
*
* </pre>
*
@ -67,7 +68,7 @@ public class GraphDataUtil implements Runnable {
private BandwidthGraphData graphData;
/** Callback called when the data has been updated */
private IDataUpdated dataUpdatedCB;
private final IDataUpdated dataUpdatedCB;
/** Executor service used for the threaded data retrieval */
private final ExecutorService service = Executors.newSingleThreadExecutor();
@ -83,21 +84,10 @@ public class GraphDataUtil implements Runnable {
this.dataUpdatedCB = dataUpdatedCB;
}
/**
* Set the updated data callback.
*
* @param dataUpdatedCB
* Call back called when the data has been updated via separate
* thread.
*/
public void setDataUpdateCallback(IDataUpdated dataUpdatedCB) {
this.dataUpdatedCB = dataUpdatedCB;
}
/**
* Perform a data retrieval on the UI thread.
*/
public void retrieveData() {
private void retrieveData() {
response = sendRequest(request);
if (response != null) {
@ -115,10 +105,11 @@ public class GraphDataUtil implements Runnable {
* returning the data.
* @return Bandwidth graph data.
*/
public BandwidthGraphData getGraphData(boolean newData) {
if (newData || graphData == null) {
public BandwidthGraphData getGraphData() {
if (graphData == null) {
retrieveData();
}
return graphData;
}

View file

@ -48,7 +48,6 @@ 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.util.FileUtil;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.datadelivery.common.ui.IDialogClosed;
import com.raytheon.uf.viz.datadelivery.common.ui.SortImages.SortDirection;
@ -57,6 +56,7 @@ import com.raytheon.uf.viz.datadelivery.common.ui.TableComp;
import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig;
import com.raytheon.uf.viz.datadelivery.common.ui.TableDataManager;
import com.raytheon.uf.viz.datadelivery.common.ui.ViewDetailsDlg;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.BrowserColumnNames;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
@ -85,6 +85,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil
* Apr 10, 2013 1891 djohnson Declare variable as List.
* Sep 11, 2013 2352 mpduff Add siteId to getSubscribedToDataSetNames method.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -627,7 +628,7 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
try {
datasetNames = DataDeliveryHandlers.getSubscriptionHandler()
.getSubscribedToDataSetNames(
LocalizationManager.getInstance().getCurrentSite());
DataDeliveryUtils.getDataDeliveryId());
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to retrieve subscription dataset names!", e);

View file

@ -19,6 +19,10 @@
**/
package com.raytheon.uf.viz.datadelivery.common.ui;
import java.util.List;
import com.raytheon.uf.viz.datadelivery.notification.NotificationRowData;
/**
* Table find interface.
*
@ -30,6 +34,7 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
* ------------ ---------- ----------- --------------------------
* May 7, 2012 jpiatt Initial creation.
* Sep 26, 2013 2417 mpduff Add clearSelection method.
* Feb 07, 2014 2453 mpduff Added getCurrentSelectionIndex method.
* </pre>
*
* @author jpiatt
@ -38,26 +43,34 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
public interface ITableFind {
/**
* handleFind call
* handle page selection
*/
void handlePageSelection();
/**
* handleFind call
* select a row
*
* @param index
*/
void selectIndex(int index);
void selectRow(NotificationRowData row);
/**
* handleFind call
* handle multiple rows
*
* @param indices
*/
void selectIndices(int[] indices);
void selectRows(List<NotificationRowData> rows);
/**
* Clear any table selections.
*/
void clearSelections();
/**
* Get the currently selected index within the data array, not the visible
* table.
*
* @return
*/
int getCurrentSelectionIndex();
}

View file

@ -29,7 +29,8 @@ package com.raytheon.uf.viz.datadelivery.common.ui;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 06, 2012 lvenable Initial creation
* Apr 10, 2013 1891 djohnson Declare variable as List.
* Apr 10, 2013 1891 djohnson Declare variable as List.
* Feb 07, 2014 2453 mpduff Added getSize().
*
* </pre>
*
@ -132,8 +133,7 @@ public class TableDataManager<T extends ITableData<T>> implements ISortTable {
public T getDataRow(int index) {
if (index >= 0 && index < tableData.size()) {
return tableData.get(index);
}
else {
} else {
return tableData.get(0);
}
}
@ -187,4 +187,13 @@ public class TableDataManager<T extends ITableData<T>> implements ISortTable {
public SortDirection getSortDirection() {
return currentSortDirection;
}
/**
* Get the size of the data array.
*
* @return The size
*/
public int getSize() {
return this.tableData.size();
}
}

View file

@ -97,6 +97,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
* May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
* Jun 13, 2013 2108 mpduff Refactored DataSizeUtils.
* Oct 28, 2013 2292 mpduff Change overlap services.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* </pre>
*
* @author jpiatt
@ -410,8 +411,7 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay,
subscription.setCoverage(cov);
}
subscription.addOfficeID(LocalizationManager.getInstance()
.getCurrentSite());
subscription.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
if (sizeUtils != null) {
subscription.setDataSetSize(sizeUtils
.getDataSetSizeInKb(subscription));

View file

@ -20,21 +20,18 @@
package com.raytheon.uf.viz.datadelivery.notification;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.SelectionAdapter;
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.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@ -59,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Dec 12. 2012 1418 mpduff Change label.
* Aug 30, 2013 2314 mpduff Fixed find, filter, and various other bugs.
* Sep 26, 2013 2417 mpduff Reset the highlight all indices on close.
* Feb 07, 2014 2453 mpduff Refactored dialog.
*
* </pre>
*
@ -95,41 +93,20 @@ public class FindDlg extends CaveSWTDialog {
/** ITableFind callback */
private final ITableFind callback;
/** Table row Index */
int tableIndex = -1;
/** Table row start Index */
int startIndex = 0;
/** Table row end Index */
int endIndex = 0;
/** Table row selected Index */
int selectedIndex = 0;
private int selectedIndex = 0;
/** Message Checkbox flag */
boolean msgFlag = false;
private boolean msgFlag = false;
/** Category Checkbox flag */
boolean categoryFlag = false;
private boolean categoryFlag = false;
/** Case Sensitive flag */
boolean caseFlag = false;
/** Yes continue search flag */
boolean yesFlag = false;
/** Found Item flag */
boolean exists = false;
private boolean caseFlag = false;
/** Exclude search flag */
boolean excludeFlag = false;
/** Message string */
String msg = null;
/** Subscription string */
String sub = null;
private boolean excludeFlag = false;
/**
* Constructor.
@ -150,13 +127,11 @@ public class FindDlg extends CaveSWTDialog {
*/
public FindDlg(Shell parent,
TableDataManager<NotificationRowData> filteredTableList,
int sIndex, int eIndex, int selected, ITableFind callback) {
int selected, ITableFind callback) {
super(parent, SWT.DIALOG_TRIM, CAVE.NONE | CAVE.DO_NOT_BLOCK);
this.setText("Find");
this.filteredTableList = filteredTableList;
sIndex = startIndex;
eIndex = endIndex;
selectedIndex = selected;
this.callback = callback;
}
@ -185,12 +160,6 @@ public class FindDlg extends CaveSWTDialog {
*/
@Override
protected void initializeComponents(Shell shell) {
shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
callback.selectIndices(null);
}
});
createFindLayout();
createBottomButtons();
}
@ -219,12 +188,6 @@ public class FindDlg extends CaveSWTDialog {
findTxt.setLayoutData(gd);
findTxt.selectAll();
findTxt.setLayoutData(gd);
findTxt.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
findText();
}
});
gl = new GridLayout(2, false);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
@ -314,89 +277,16 @@ public class FindDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
callback.selectIndices(null);
close();
}
});
}
/**
* Find text on key release. Check all pages of filtered list. Stop when
* match is found and don't move to the next.
*/
private void findText() {
// Text in the find text box
String text = findTxt.getText();
// Get button selections
msgFlag = msgBtn.getSelection();
categoryFlag = categoryBtn.getSelection();
caseFlag = caseBtn.getSelection();
excludeFlag = exclusionBtn.getSelection();
int itemCount = filteredTableList.getDataArray().size();
tableIndex = 0;
if (filteredTableList != null) {
// Check rows in the entire filtered list - all pages
for (NotificationRowData row : filteredTableList.getDataArray()) {
// Column data
msg = row.getMessage();
sub = row.getCategory();
if (tableIndex <= itemCount) {
tableIndex++;
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
// Select index if matches message or subscription
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive
// message or subscription
if ((!msg.toUpperCase()
.contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
} else if ((msg.toUpperCase().contains(
text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
exists = true;
callback.selectIndex(tableIndex);
break;
}
}
}
}
}
}
/**
* Find Button action handler. Find the next matching row upon button click.
*/
private void handleFindBtn() {
int prevSelectedIndex = selectedIndex;
// Text in the find text box
String text = findTxt.getText();
@ -420,56 +310,20 @@ public class FindDlg extends CaveSWTDialog {
boolean continueSearch = true;
boolean exists = false;
boolean hitEnd = false;
selectedIndex = selectedIndex + 1;
selectedIndex = callback.getCurrentSelectionIndex() + 1;
while (continueSearch) {
if (tableIndex < itemCount) {
// Get the row data starting at the currently highlighted row
if (selectedIndex < itemCount) {
NotificationRowData row = filteredTableList.getDataArray().get(
tableIndex);
selectedIndex);
// Column data
msg = row.getMessage();
sub = row.getCategory();
tableIndex++;
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
// Select index if matches message or subscription
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive message or
// subscription
if ((!msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
} else if ((msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(text.toLowerCase()) && categoryFlag)) {
continueSearch = false;
callback.selectIndex(tableIndex);
}
}
// If the item was found set exists to true
if (!continueSearch) {
boolean matchFound = checkForMatch(text, row);
if (matchFound) {
continueSearch = false;
exists = true;
callback.selectRow(row);
}
selectedIndex++;
} else {
if (!hitEnd) {
int answer = DataDeliveryUtils
@ -480,10 +334,11 @@ public class FindDlg extends CaveSWTDialog {
"The end of the table has been reached. Would you like to search from the beginning of the table?");
if (answer == SWT.NO) {
exists = true;
selectedIndex = prevSelectedIndex;
break;
// Start search over at beginning of table
} else if (answer == SWT.YES) {
tableIndex = 0;
// Start search over at beginning of table
selectedIndex = 0;
continueSearch = true;
}
hitEnd = true;
@ -499,7 +354,7 @@ public class FindDlg extends CaveSWTDialog {
mb.setText("Find Warning");
mb.setMessage("No item matching your search was found.");
mb.open();
tableIndex = 0;
selectedIndex = prevSelectedIndex;
callback.clearSelections();
}
}
@ -509,7 +364,6 @@ public class FindDlg extends CaveSWTDialog {
* text.
*/
private void handleHighlightBtn() {
// Text in the find text box
String text = findTxt.getText();
@ -519,61 +373,54 @@ public class FindDlg extends CaveSWTDialog {
caseFlag = caseBtn.getSelection();
excludeFlag = exclusionBtn.getSelection();
ArrayList<Integer> items = new ArrayList<Integer>();
int[] indices = new int[0];
// Start search at beginning of table
tableIndex = 0;
List<NotificationRowData> items = new ArrayList<NotificationRowData>();
if (filteredTableList != null) {
for (int i = 0; i < filteredTableList.getDataArray().size(); i++) {
for (int i = 0; i < filteredTableList.getSize(); i++) {
NotificationRowData row = filteredTableList.getDataArray().get(
i);
// Message Column
msg = row.getMessage();
// Subscription Name column
sub = row.getCategory();
if (caseFlag) {
if (excludeFlag) {
// Select index if does not match message or
// subscription
if ((!msg.contains(text) && msgFlag)
|| (!sub.contains(text) && categoryFlag)) {
items.add(i);
}
} else if ((msg.contains(text) && msgFlag)
|| (sub.contains(text) && categoryFlag)) {
// Select index if matches message or subscription
items.add(i);
}
} else {
if (excludeFlag) {
// Select index if matches non case sensitive message or
// subscription
if ((!msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (!sub.toLowerCase().contains(
text.toLowerCase()) && categoryFlag)) {
items.add(i);
}
} else if ((msg.toUpperCase().contains(text.toUpperCase()) && msgFlag)
|| (sub.toLowerCase().contains(text.toLowerCase()) && categoryFlag)) {
items.add(i);
}
boolean matchFound = checkForMatch(text, row);
if (matchFound) {
items.add(row);
}
tableIndex++;
}
indices = new int[items.size()];
// Create an int array of the rows to highlight
for (int i = 0; i < items.size(); i++) {
indices[i] = items.get(i);
}
callback.selectIndices(indices);
callback.selectRows(items);
}
}
}
/**
* Check if the matchText matches the row.
*
* @param matchText
* The text to match
* @param row
* The row to check
* @return true if matches
*/
private boolean checkForMatch(String matchText, NotificationRowData row) {
boolean matchFound = false;
String msg = row.getMessage();
String sub = row.getCategory();
if (!caseFlag) {
msg = msg.toUpperCase();
sub = sub.toUpperCase();
matchText = matchText.toUpperCase();
}
if (excludeFlag) {
if ((!msg.contains(matchText) && msgFlag)
|| (!sub.contains(matchText) && categoryFlag)) {
matchFound = true;
}
} else {
if ((msg.contains(matchText) && msgFlag)
|| (sub.contains(matchText) && categoryFlag)) {
matchFound = true;
}
}
return matchFound;
}
}

View file

@ -104,6 +104,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Aug 30, 2013 2314 mpduff Change the reading of the xml. Make load config dlg non-blocking.
* Sep 25, 2013 2408 mpduff Added a restore hidden notifications menu.
* Sep 25, 2013 2410 mpduff Check type of localization file.
* Feb 07, 2013 2453 mpduff Support find dialog refactor..
*
* </pre>
*
@ -394,7 +395,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
hideOlderMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tableComp.handleDeleteOlderThan();
tableComp.handleHideOlderThan();
}
});
@ -405,7 +406,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
hideMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
tableComp.handleDeleteNotification();
tableComp.handleHideNotification();
}
});
@ -493,7 +494,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
mi.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
tableComp.handleDeleteByPriority((Integer) ((MenuItem) e
tableComp.handleHideByPriority((Integer) ((MenuItem) e
.getSource()).getData());
}
});
@ -540,6 +541,17 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
id = Activator.imageDescriptorFromPlugin(
"com.raytheon.uf.viz.datadelivery", "icons/dd_new.png");
trayImg2 = id.createImage();
/*
* Check if the images are null.
*/
if (trayImg1 == null) {
System.out.println("*** Tray image 1 is null...");
} else {
System.out
.println("*** Tray image 1 is not null and should have an image...");
}
tray = display.getSystemTray();
createTray();
@ -572,8 +584,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
private void handleFind() {
if (fnd == null || fnd.isDisposed()) {
fnd = new FindDlg(shell, tableComp.getFilteredTableList(),
tableComp.getStartIndex(), tableComp.getEndIndex(),
tableComp.getSelectedIndex(), tableComp);
tableComp.getTable().getSelectionIndex(), tableComp);
fnd.open();
} else {
fnd.bringToTop();
@ -839,7 +850,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
if (isDisposed() == false && tableComp.passesFilter(records)) {
tableComp.populateTableDataRows(records);
tableComp.populateTable();
tableComp.handlePageSelection();
// update title display......
if (tableComp.isLocked()) {
setText(TITLE_TEXT + tableComp.getPauseCountLabel());

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jun 07, 2012 687 lvenable Table data refactor.
* Aug 30, 2013 2314 mpduff Fix formatting.
* Sep 16, 2013 2375 mpduff Change date sort order.
* Feb 07, 2014 2453 mpduff Added toString()
*
* </pre>
*
@ -299,4 +300,8 @@ public class NotificationRowData implements ITableData<NotificationRowData> {
}
}
@Override
public String toString() {
return this.date.toString() + " - " + this.message;
}
}

View file

@ -144,6 +144,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
* Nov 07, 2013 2291 skorolev Used showText() method for "Unable to Create Subscription" message.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is updated and created.
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -471,8 +472,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
btn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String currentSite = LocalizationManager.getInstance()
.getCurrentSite();
String currentSite = DataDeliveryUtils.getDataDeliveryId();
SiteSelectionDlg dlg = new SiteSelectionDlg(shell, currentSite,
sharedSites);
dlg.setCloseCallback(new ICloseCallback() {
@ -1030,7 +1030,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
subscription = sharedSub;
} else {
Set<String> officeList = Sets.newHashSet();
officeList.add(LocalizationManager.getInstance().getCurrentSite());
officeList.add(DataDeliveryUtils.getDataDeliveryId());
subscription.setOfficeIDs(officeList);
}
@ -1540,8 +1540,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog {
*/
private void setSubscriptionId(Subscription sub) {
if (sub.getOriginatingSite() == null) {
LocalizationManager lm = LocalizationManager.getInstance();
sub.setOriginatingSite(lm.getCurrentSite());
sub.setOriginatingSite(DataDeliveryUtils.getDataDeliveryId());
}
String id = RegistryUtil.getRegistryObjectKey(sub);
sub.setId(id);

View file

@ -41,10 +41,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.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.datadelivery.common.ui.GroupSelectComp;
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
import com.raytheon.viz.ui.presenter.components.WidgetConf;
@ -67,7 +67,8 @@ import com.raytheon.viz.ui.presenter.components.WidgetConf;
* Apr 08, 2013 1826 djohnson Remove delivery options.
* May 14, 2013 1040 mpduff Changed to add office Id rather than setting it.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is created.
* Nov 08, 2013 2506 bgonzale Removed send notification when a subscription is created.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
@ -263,8 +264,7 @@ public class GroupAddDlg extends CaveSWTDialog {
System.out.println("Fix Me: Need to calculate data set size");
subscription.setDataSetSize(999);
subscription.addOfficeID(LocalizationManager.getInstance()
.getCurrentSite());
subscription.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
// TODO: How to do this better? Will shared subscriptions participate in
// groups?

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 29, 2013 1040 mpduff Initial creation
* Feb 11, 2014 2771 bgonzale Show all SiteDataTypes in site list.
*
* </pre>
*
@ -153,9 +154,7 @@ public class SiteSelectionDlg extends CaveSWTDialog {
for (Entry<String, SiteData> entry : siteDataMap.entrySet()) {
SiteDataType type = entry.getValue().getType();
if (type == SiteDataType.WFO || type == SiteDataType.RFC) {
siteList.add(entry.getKey());
}
siteList.add(entry.getKey());
}
// Remove the current site

View file

@ -26,6 +26,9 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.xml.bind.JAXBException;
@ -72,6 +75,7 @@ import com.raytheon.uf.common.site.SiteMap;
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.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
@ -148,6 +152,10 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Dec 05, 2013 2570 skorolev Show All subscriptions.
* Jan 08, 2014 2642 mpduff Update dialog for permissions, adding site to shared
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Feb 04, 2014 2722 mpduff Add auto-refresh task.
* Feb 14, 2014 2806 mpduff Disable activate/deactivate buttons when viewing other site's subscriptions
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
*
* </pre>
*
* @author mpduff
@ -184,8 +192,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
/** Current site */
private final String CURRENT_SITE = LocalizationManager.getInstance()
.getCurrentSite();
private final String CURRENT_SITE = DataDeliveryUtils.getDataDeliveryId();
/** The activate button */
private Button activateBtn;
@ -278,6 +285,8 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
/** New menu */
private MenuItem newMI;
private final ScheduledExecutorService scheduler;
/**
* Constructor
*
@ -292,6 +301,9 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
| CAVE.DO_NOT_BLOCK);
this.filter = filter;
scheduler = Executors.newScheduledThreadPool(1);
scheduler.scheduleAtFixedRate(new RefreshTask(), 15, 15,
TimeUnit.MINUTES);
setText("Data Delivery Subscription Manager");
}
@ -346,7 +358,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
createBottomButtons();
enableMenus(true);
enableControls(true);
}
/*
@ -364,6 +376,17 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
return mainLayout;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
super.disposed();
scheduler.shutdownNow();
}
/**
* Create subscription menu.
*/
@ -634,7 +657,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
@Override
public void widgetSelected(SelectionEvent event) {
handleFilterSelection();
enableMenus(officeCbo.getText().equals(CURRENT_SITE));
enableControls(officeCbo.getText().equals(CURRENT_SITE));
}
});
@ -659,8 +682,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
*/
@Override
public void handleRefresh() {
tableComp.populateData();
tableComp.populateTable();
tableComp.handleRefresh();
}
private void createBottomButtons() {
@ -1498,9 +1520,12 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
/**
* Enable/Disable menus.
* Enable/Disable controls.
*
* @param enable
* true to enable, false to disable
*/
private void enableMenus(boolean enable) {
private void enableControls(boolean enable) {
copyMI.setEnabled(enable);
deleteGroupMI.setEnabled(enable);
editMI.setEnabled(enable);
@ -1510,5 +1535,24 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
groupMI.setEnabled(enable);
newMI.setEnabled(enable);
tableComp.enableMenus(enable);
activateBtn.setEnabled(enable);
deactivateBtn.setEnabled(enable);
}
/**
* Private inner work thread used to auto refresh dialog.
*/
private class RefreshTask implements Runnable {
@Override
public void run() {
if (TimeUtil.currentTimeMillis() - tableComp.getLastUpdateTime() >= TimeUtil.MILLIS_PER_MINUTE * 5) {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
handleRefresh();
}
});
}
}
}
}

View file

@ -97,6 +97,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Oct 22, 2013 2292 mpduff Removed subscriptionOverlapService.
* Nov 07, 2013 2291 skorolev Used showText() method for "Shared Subscription" message.
* Jan 26, 2014 2259 mpduff Turn off subs to be deactivated.
* Feb 04, 2014 2677 mpduff Don't do overlap checks when deactivating subs.
*
* </pre>
*
@ -542,28 +543,42 @@ public class SubscriptionService implements ISubscriptionService {
final IForceApplyPromptDisplayText displayTextStrategy)
throws RegistryHandlerException {
SubscriptionOverlapRequest request = new SubscriptionOverlapRequest(
subscriptions);
if (subscriptions == null || subscriptions.isEmpty()) {
return new SubscriptionServiceResult(false,
"No subscriptions submitted.");
}
SubscriptionOverlapResponse response = null;
try {
response = (SubscriptionOverlapResponse) RequestRouter.route(
request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
if (response.isDuplicate()) {
return new SubscriptionServiceResult(true,
StringUtil.createMessage(DUPLICATE_SUBSCRIPTIONS,
response.getSubscriptionNameList()));
}
/*
* If activating the subscriptions check for overlaps.
*
* Only need to check one because all are being updated the same way.
*/
if (subscriptions.get(0).getSubscriptionState() == SubscriptionState.ON) {
SubscriptionOverlapRequest request = new SubscriptionOverlapRequest(
subscriptions);
if (response.isOverlap()) {
List<String> subNames = response.getSubscriptionNameList();
Collections.sort(subNames);
forceApplyPrompt.displayMessage(displayTextStrategy, StringUtil
.createMessage(OVERLAPPING_SUBSCRIPTIONS, subNames));
SubscriptionOverlapResponse response = null;
try {
response = (SubscriptionOverlapResponse) RequestRouter.route(
request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
if (response.isDuplicate()) {
return new SubscriptionServiceResult(true,
StringUtil.createMessage(DUPLICATE_SUBSCRIPTIONS,
response.getSubscriptionNameList()));
}
if (response.isOverlap()) {
List<String> subNames = response.getSubscriptionNameList();
Collections.sort(subNames);
forceApplyPrompt.displayMessage(displayTextStrategy,
StringUtil.createMessage(OVERLAPPING_SUBSCRIPTIONS,
subNames));
}
} catch (Exception e) {
statusHandler.error("Error checking subscription overlapping",
e);
return new SubscriptionServiceResult(false);
}
} catch (Exception e) {
statusHandler.error("Error checking subscription overlapping", e);
return new SubscriptionServiceResult(false);
}
try {

View file

@ -57,9 +57,9 @@ import com.raytheon.uf.common.registry.handler.RegistryObjectHandlers;
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.util.TimeUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessageContainsType;
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
@ -110,6 +110,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Jan 08, 2014 2642 mpduff Enable/disable menus based on site, allow user to add their site to a shared sub.
* Feb 04, 2014 2722 mpduff Add last update time.
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* @version 1.0
*/
@ -120,8 +122,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
.getHandler(SubscriptionTableComp.class);
/** Current site constant */
private final String CURRENT_SITE = LocalizationManager.getInstance()
.getCurrentSite();
private final String CURRENT_SITE = DataDeliveryUtils.getDataDeliveryId();
/** Pop up menu object. */
private Menu popupMenu;
@ -163,6 +164,9 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
/** Currently selected site */
private boolean currentSiteSelected;
/** Last table update time */
protected long lastUpdateTime = TimeUtil.currentTimeMillis();
/**
* Constructor.
*
@ -760,6 +764,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
lastUpdateTime = TimeUtil.currentTimeMillis();
if (!isDisposed()) {
handleRefresh();
}
@ -783,9 +788,11 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
*/
@Override
public void handleRefresh() {
populateData();
populateTable();
if (!isDisposed()) {
populateData();
populateTable();
this.lastUpdateTime = TimeUtil.currentTimeMillis();
}
}
@Override
@ -888,4 +895,11 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
});
job.schedule();
}
/**
* @return the lastUpdateTime
*/
public long getLastUpdateTime() {
return lastUpdateTime;
}
}

View file

@ -142,6 +142,9 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Nov 14, 2013 2548 mpduff Set the subscription type (QUERY OR RECURRING)
* Jan 14, 2014 2459 mpduff Change Subscription status code
* Jan 20, 2014 2538 mpduff Call doesNameExist method to check for dupes
* Feb 11, 2014 2771 bgonzale Use Data Delivery ID instead of Site.
* Feb 26, 2014 #2833 lvenable Added code to prevent the Subset (this) dialog from
* disappearing when the Subscription button is double clicked.
* </pre>
*
* @author mpduff
@ -416,7 +419,7 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
int buttonWidth = 87;
GridData btnData = new GridData(buttonWidth, SWT.DEFAULT);
Button subscribeBtn = new Button(bottomComp, SWT.PUSH);
final Button subscribeBtn = new Button(bottomComp, SWT.PUSH);
if (!create) {
subscribeBtn.setText("Continue...");
subscribeBtn.setToolTipText("Click to continue editing");
@ -429,6 +432,14 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
subscribeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
/*
* Need to disable the Subscription button as it takes time to
* do all of the validation. Once the subscription dialog
* returns the button will enable.
*/
subscribeBtn.setEnabled(false);
if (subscription == null) {
launchCreateSubscriptionGui(createSubscription(
new SiteSubscription(), Network.OPSNET));
@ -437,6 +448,9 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
subscription.getRoute());
launchCreateSubscriptionGui(subscription);
}
// Enable the button.
subscribeBtn.setEnabled(true);
}
});
@ -570,8 +584,7 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
sub.setOwner((create) ? LocalizationManager.getInstance()
.getCurrentUser() : this.subscription.getOwner());
sub.setOriginatingSite(LocalizationManager.getInstance()
.getCurrentSite());
sub.setOriginatingSite(DataDeliveryUtils.getDataDeliveryId());
sub.setSubscriptionType(SubscriptionType.RECURRING);
return setupCommonSubscriptionAttributes(sub, defaultRoute);
@ -599,7 +612,7 @@ public abstract class SubsetManagerDlg extends CaveSWTDialog implements
sub.setRoute(defaultRoute);
sub.setName(nameText.getText());
if (subscription == null || subscription.getOfficeIDs() == null) {
sub.addOfficeID(LocalizationManager.getInstance().getCurrentSite());
sub.addOfficeID(DataDeliveryUtils.getDataDeliveryId());
} else {
sub.setOfficeIDs(subscription.getOfficeIDs());
}

View file

@ -34,6 +34,9 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthRequest.RequestType;
import com.raytheon.uf.common.datadelivery.registry.Coverage;
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
import com.raytheon.uf.common.datadelivery.registry.DataType;
@ -43,6 +46,8 @@ import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.PointTime;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.serialization.comm.RequestRouter;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil;
import com.raytheon.uf.common.util.SizeUtil;
@ -82,8 +87,9 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jul 26, 2031 2232 mpduff Removed sendAuthorizationRequest method.
* Aug 30, 2013 2288 bgonzale Added latency to details display.
* Sep 30, 2013 1797 dhladky Time GriddedTime separation
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Nov 07, 2013 2291 skorolev Added showText() method for messages with many lines.
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
* Nov 07, 2013 2291 skorolev Added showText() method for messages with many lines.
* Feb 11, 2014 2771 bgonzale Added Data Delivery ID, getter, and retrieval method.
* </pre>
*
* @author mpduff
@ -121,6 +127,8 @@ public class DataDeliveryUtils {
public static final String UNABLE_TO_RETRIEVE_PENDING_SUBSCRIPTIONS = "Unable to retrieve pending subscriptions!";
private static final String dataDeliveryId = retrieveDataDeliveryId();
/**
* TABLE_TYPE enumeration.
*/
@ -832,4 +840,21 @@ public class DataDeliveryUtils {
public static int getMaxLatency(GriddedDataSet dataSet) {
return getMaxLatency(new ArrayList<Integer>(dataSet.getCycles()));
}
public static String getDataDeliveryId() {
return dataDeliveryId;
}
private static String retrieveDataDeliveryId() {
IBandwidthRequest request = new IBandwidthRequest();
request.setRequestType(RequestType.GET_DATADELIVERY_ID);
try {
SuccessfulExecution response = (SuccessfulExecution) RequestRouter
.route(request, DataDeliveryConstants.DATA_DELIVERY_SERVER);
return (String) response.getResponse();
} catch (Exception e) {
throw new RuntimeException(
"Unable to retrieve Data Delivery ID from EDEX.", e);
}
}
}

View file

@ -31,6 +31,7 @@ import com.raytheon.uf.viz.datadelivery.notification.xml.MessageLoadXML;
* Mar 12, 2012 jsanchez Initial creation
* Jan 22, 2013 1501 djohnson Route requests to datadelivery.
* Sep 05, 2013 2314 mpduff support the load all messages option.
* Feb 07, 2014 2453 mpduff Remove username query param.
*
* </pre>
*
@ -84,10 +85,9 @@ public class NotificationHandler implements INotificationObserver {
public List<NotificationRecord> intialLoad(MessageLoadXML messageLoad,
ArrayList<String> users) {
int loadAmount;
String username = null;
Integer hours = null;
Integer maxResults = null;
Boolean loadAll = false;
boolean loadAll = false;
// Retrieve the message load configuration
if (messageLoad != null) {
loadAll = messageLoad.isLoadAllMessages();
@ -100,22 +100,11 @@ public class NotificationHandler implements INotificationObserver {
}
}
// Set usernames from filter
if (users != null && users.isEmpty() == false) {
StringBuffer sb = new StringBuffer();
for (String user : users) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append(user);
}
username = sb.toString();
}
// Request data from the notification table.
// Note: Removing username query parameter for front end label
// consistency
try {
GetNotificationRequest request = new GetNotificationRequest();
request.setUsername(username);
request.setHours(hours);
request.setMaxResults(maxResults);
request.setLoadAll(loadAll);

View file

@ -57,6 +57,7 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
* Jul 16, 2013 2158 bsteffen Allow VizGlobalsManager to work without
* accessing UI thread.
* Oct 15, 2013 2361 njensen Added startupTimer
* Jan 27, 2014 2744 njensen Add Local History pref back in
*
* </pre>
*
@ -192,8 +193,17 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor {
for (IPreferenceNode root : topNodes) {
String rootId = root.getId();
if (rootId.equals("org.eclipse.ui.preferencePages.Workbench")) {
IPreferenceNode node = root
.findSubNode("org.eclipse.ui.preferencePages.Workspace");
if (node != null) {
node.remove("org.eclipse.ui.preferencePages.LinkedResources");
node.remove("org.eclipse.ui.preferencePages.BuildOrder");
IPreferenceNode localHistoryNode = node
.findSubNode("org.eclipse.ui.preferencePages.FileStates");
root.add(localHistoryNode);
root.remove("org.eclipse.ui.preferencePages.Workspace");
}
root.remove("org.eclipse.search.preferences.SearchPreferencePage");
root.remove("org.eclipse.ui.preferencePages.Workspace");
} else if (rootId.equals("org.python.pydev.prefs")) {
root.remove("org.python.pydev.ui.pythonpathconf.interpreterPreferencesPageJython");
root.remove("org.python.pydev.ui.pythonpathconf.interpreterPreferencesPageIronpython");
@ -325,7 +335,7 @@ public class VizWorkbenchAdvisor extends WorkbenchAdvisor {
startupTimer.stop();
System.out.println("Workbench startup time: "
+ startupTimer.getElapsedTime() + " ms");
}
}
}

View file

@ -123,8 +123,10 @@ public class AlertVizApplication implements IStandaloneComponent {
AlertvizJob as = new AlertvizJob(port);
if (as.isAlreadyStarted()) {
Container.logInternal(Priority.ERROR,
"Alertviz already started on port: " + port + ", exiting");
String exitMsg = "Alertviz already started on port: " + port
+ ", exiting";
System.out.println(exitMsg);
Container.logInternal(Priority.ERROR, exitMsg);
return IApplication.EXIT_OK;
}

View file

@ -36,6 +36,7 @@ import com.raytheon.uf.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.comm.ConnectivityManager.ConnectivityResult;
import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
/**
@ -51,6 +52,7 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a
* preference.
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Only one field for proxy server
*
* </pre>
*
@ -61,9 +63,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
private BooleanFieldEditor useProxies;
private StringFieldEditor pypiesServer;
private StringFieldEditor servicesServer;
private StringFieldEditor proxyServer;
private Button connectivityButton;
@ -92,18 +92,11 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
"&Use Proxy Servers", getFieldEditorParent());
addField(useProxies);
servicesServer = new StringFieldEditor(
ThinClientPreferenceConstants.P_SERVICES_PROXY,
"&Services Address: ", getFieldEditorParent());
servicesServer.setErrorMessage("Cannot connect to Services server");
addField(servicesServer);
pypiesServer = new StringFieldEditor(
ThinClientPreferenceConstants.P_PYPIES_PROXY,
"&Pypies Address: ", getFieldEditorParent());
pypiesServer.setErrorMessage("Cannot connect to Pypies server");
addField(pypiesServer);
proxyServer = new StringFieldEditor(
ThinClientPreferenceConstants.P_PROXY_ADDRESS,
"&Proxy Address: ", getFieldEditorParent());
proxyServer.setErrorMessage("Cannot connect to Proxy server");
addField(proxyServer);
addConnectivityButton();
}
@ -131,43 +124,40 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
* Check the connectivity of the server field editors
*/
private void checkConnectivity() {
final ConnectivityResult result = new ConnectivityResult(false, "");
final ConnectivityResult servicesResult = new ConnectivityResult(false,
"");
final ConnectivityResult pypiesResult = new ConnectivityResult(false,
"");
String errorMessage = "Cannot connect to proxy server: ";
boolean serverError = false;
// check HTTP Server
Text text = servicesServer.getTextControl(getFieldEditorParent());
ConnectivityManager.checkLocalizationServer(text.getText().trim(),
Text text = proxyServer.getTextControl(getFieldEditorParent());
String proxyAddr = text.getText().trim();
ConnectivityManager.checkLocalizationServer(
ThinClientUriUtil.getServicesAddress(proxyAddr),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {
result.hasConnectivity = results.hasConnectivity;
servicesResult.hasConnectivity = results.hasConnectivity;
}
});
if (result.hasConnectivity) {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_WHITE));
} else {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_RED));
serverError = true;
}
// check Pypies Server
Text textPypies = pypiesServer.getTextControl(getFieldEditorParent());
ConnectivityManager.checkHttpServer(textPypies.getText().trim(),
ConnectivityManager.checkHttpServer(
ThinClientUriUtil.getPypiesAddress(proxyAddr),
new IConnectivityCallback() {
@Override
public void connectionChecked(ConnectivityResult results) {
result.hasConnectivity = results.hasConnectivity;
pypiesResult.hasConnectivity = results.hasConnectivity;
}
});
if (result.hasConnectivity) {
textPypies.setBackground(Display.getDefault().getSystemColor(
if (servicesResult.hasConnectivity && pypiesResult.hasConnectivity) {
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_WHITE));
} else {
textPypies.setBackground(Display.getDefault().getSystemColor(
text.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_RED));
serverError = true;
}
@ -191,8 +181,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
private void updateEnabledFields() {
boolean useProxies = this.useProxies.getBooleanValue();
servicesServer.setEnabled(useProxies, connectivityButton.getParent());
pypiesServer.setEnabled(useProxies, connectivityButton.getParent());
proxyServer.setEnabled(useProxies, connectivityButton.getParent());
connectivityButton.setEnabled(useProxies);
}

View file

@ -0,0 +1,91 @@
/**
* 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.thinclient;
/**
* Utilities for manipulating thin client URIs
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 3, 2014 njensen Initial creation
*
* </pre>
*
* @author njensen
* @version 1.0
*/
public class ThinClientUriUtil {
private static String services = "services";
private static String pypies = "pypies";
static {
services = System.getProperty("thinclient.proxy.services", services);
pypies = System.getProperty("thinclient.proxy.pypies", pypies);
}
private ThinClientUriUtil() {
}
/**
* Returns the address to connect to EDEX services when going through the
* thin client proxy
*
* @param proxyAddress
* the address of the proxy server
* @return
*/
public static String getServicesAddress(String proxyAddress) {
return appendTrailingSlash(proxyAddress) + services;
}
/**
* Returns the address to connect to PyPIES when going through the thin
* client proxy
*
* @param proxyAddress
* the address of the proxy server
* @return
*/
public static String getPypiesAddress(String proxyAddress) {
return appendTrailingSlash(proxyAddress) + pypies;
}
/**
* Appends a trailing slash to an address if the address does not have one
*
* @param proxyAddress
* @return
*/
private static String appendTrailingSlash(String proxyAddress) {
if (!proxyAddress.endsWith("/")) {
proxyAddress += "/";
}
return proxyAddress;
}
}

View file

@ -25,15 +25,15 @@ import org.apache.commons.collections.map.DefaultedMap;
import org.eclipse.jface.preference.IPreferenceStore;
import com.raytheon.uf.common.comm.HttpClient;
import com.raytheon.uf.common.localization.msgs.GetServersRequest;
import com.raytheon.uf.common.localization.msgs.GetServersResponse;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.VizServers;
import com.raytheon.uf.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationInitializer;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
@ -51,8 +51,9 @@ import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
* Dec 06, 2012 1396 njensen Added setting VizServers
* Jan 14, 2013 1469 bkowal Removed setting the hdf5 data directory
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Aug 27, 2013 2295 bkowal The entire jms connection string is
* Aug 27, 2013 2295 bkowal The entire jms connection string is
* now provided by EDEX.
* Feb 04, 2014 2704 njensen Single proxy address/preference
*
* </pre>
*
@ -87,20 +88,25 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer {
.getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS);
if (store.getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES)) {
String servicesProxy = store
.getString(ThinClientPreferenceConstants.P_SERVICES_PROXY);
LocalizationManager.getInstance().setCurrentServer(servicesProxy);
String proxyAddr = store
.getString(ThinClientPreferenceConstants.P_PROXY_ADDRESS);
String servicesProxy = ThinClientUriUtil
.getServicesAddress(proxyAddr);
LocalizationManager.getInstance().setCurrentServer(servicesProxy,
false);
VizApp.setHttpServer(servicesProxy);
if (!disableJMS) {
GetServersRequest req = new GetServersRequest();
GetServersResponse resp = (GetServersResponse) ThriftClient
.sendLocalizationRequest(req);
GetServersResponse resp = ConnectivityManager
.checkLocalizationServer(servicesProxy, false);
if (!disableJMS) {
VizApp.setJmsConnectionString(resp.getJmsConnectionString());
}
}
VizApp.setHttpServer(servicesProxy);
VizApp.setPypiesServer(store
.getString(ThinClientPreferenceConstants.P_PYPIES_PROXY));
String pypiesProxy = ThinClientUriUtil
.getPypiesAddress(proxyAddr);
VizApp.setPypiesServer(pypiesProxy);
boolean compressRequests = store
.getBoolean(ThinClientPreferenceConstants.P_ENABLE_REQUEST_COMPRESSION);
HttpClient.getInstance().setCompressRequests(compressRequests);

View file

@ -30,6 +30,7 @@ package com.raytheon.uf.viz.thinclient.preferences;
* ------------ ---------- ----------- --------------------------
* Oct 20, 2011 mschenke Initial creation
* Jan 14, 2013 1469 bkowal The hdf5 data directory is no longer a preference constant.
* Feb 04, 2014 2704 njensen Single proxy preference constant
*
* </pre>
*
@ -47,10 +48,6 @@ public class ThinClientPreferenceConstants {
public static String P_USE_PROXIES = "useHttpProxy";
public static String P_SERVICES_PROXY = "servicesProxyAddress";
public static String P_PYPIES_PROXY = "pypiesProxyAddress";
public static String P_MENU_TIME_UPDATE_INTERVALS = "menuTimeUpdateInterval";
public static String P_DATA_UPDATE_INTERVALS = "dataUpdateInterval";
@ -70,4 +67,6 @@ public class ThinClientPreferenceConstants {
public static String P_ENABLE_REQUEST_COMPRESSION = "enableRequestCompression";
public static String P_PREFERENCE_PLACEHOLDER = "placeholderPreference";
public static String P_PROXY_ADDRESS = "proxyAddress";
}

View file

@ -27,25 +27,30 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
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.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.localization.msgs.GetServersResponse;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.comm.ConnectivityManager;
import com.raytheon.uf.viz.core.comm.ConnectivityManager.ConnectivityResult;
import com.raytheon.uf.viz.core.comm.IConnectivityCallback;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.ConnectivityPreferenceDialog;
import com.raytheon.uf.viz.core.localization.LocalizationConstants;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.thinclient.Activator;
import com.raytheon.uf.viz.thinclient.ThinClientUriUtil;
import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
/**
* TODO Add Description
* Connectivity dialog for launching thinclient or thinalertviz. Contains extra
* options not available when connecting with a normal CAVE.
*
* <pre>
*
@ -55,6 +60,11 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* ------------ ---------- ----------- --------------------------
* Nov 23, 2011 bsteffen Initial creation
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Refactored
* Feb 17, 2014 2704 njensen Added checks for alertviz connectivity
* Feb 20, 2014 2704 njensen Fix issues where settings are valid
* but dialog doesn't realize it
*
*
* </pre>
*
@ -71,8 +81,11 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override
public void connectionChecked(ConnectivityResult results) {
servicesGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private class PypiesCallback implements IConnectivityCallback {
@ -80,26 +93,30 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override
public void connectionChecked(ConnectivityResult results) {
pypiesGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private class JmsCallback implements IConnectivityCallback {
@Override
public void connectionChecked(ConnectivityResult results) {
jmsGood = results.hasConnectivity;
appendDetails(buildDetails(results));
if (!results.hasConnectivity && status == null) {
status = buildErrorMessage(results);
}
}
}
private Label servicesLabel;
private Text servicesText;
private String services = "";
private boolean servicesGood = false;
private IConnectivityCallback servicesCallback = new ServicesCallback();
private Label pypiesLabel;
private Text pypiesText;
private String pypies = "";
private boolean pypiesGood = false;
private IConnectivityCallback pypiesCallback = new PypiesCallback();
@ -108,15 +125,29 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
private boolean useProxy = false;
private Button disableJmsCheck;
private boolean disableJms = false;
private boolean jmsGood = false;
private Label jmsErrorLabel;
private IConnectivityCallback jmsCallback = new JmsCallback();
private Text proxyText;
private String proxyAddress;
public ThinClientConnectivityDialog(boolean checkAlertViz) {
super(checkAlertViz);
super(checkAlertViz, "Thin Client Connectivity Preferences");
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
useProxy = store
.getBoolean(ThinClientPreferenceConstants.P_USE_PROXIES);
services = store
.getString(ThinClientPreferenceConstants.P_SERVICES_PROXY);
pypies = store.getString(ThinClientPreferenceConstants.P_PYPIES_PROXY);
disableJms = store
.getBoolean(ThinClientPreferenceConstants.P_DISABLE_JMS);
proxyAddress = store
.getString(ThinClientPreferenceConstants.P_PROXY_ADDRESS);
}
@Override
@ -124,66 +155,75 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
super.createTextBoxes(textBoxComp);
Label label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Use Proxy Servers:");
GridData gd = new GridData(SWT.RIGHT, SWT.None, true, true);
label.setText("Disable JMS:");
GridData gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
label.setLayoutData(gd);
useProxyCheck = new Button(textBoxComp, SWT.CHECK | SWT.LEFT);
Composite jmsComp = new Composite(textBoxComp, SWT.NONE);
GridLayout gl = new GridLayout(2, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
jmsComp.setLayout(gl);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
jmsComp.setLayoutData(gd);
disableJmsCheck = new Button(jmsComp, SWT.CHECK | SWT.LEFT);
disableJmsCheck.setSelection(disableJms);
disableJmsCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
disableJms = disableJmsCheck.getSelection();
validate();
}
});
jmsErrorLabel = new Label(jmsComp, SWT.LEFT);
jmsErrorLabel.setText("Error connecting to JMS");
jmsErrorLabel.setForeground(display.getSystemColor(SWT.COLOR_RED));
jmsErrorLabel.setVisible(false);
label = new Label(textBoxComp, SWT.RIGHT);
label.setText("Use Proxy Server:");
gd = new GridData(SWT.RIGHT, SWT.CENTER, true, true);
gd.widthHint = 150;
label.setLayoutData(gd);
Composite proxyComp = new Composite(textBoxComp, SWT.NONE);
gl = new GridLayout(2, false);
gl.marginHeight = 0;
gl.marginWidth = 0;
proxyComp.setLayout(gl);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
proxyComp.setLayoutData(gd);
useProxyCheck = new Button(proxyComp, SWT.CHECK | SWT.LEFT);
useProxyCheck.setSelection(useProxy);
useProxyCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateProxyEnabled();
}
});
servicesLabel = new Label(textBoxComp, SWT.RIGHT);
servicesLabel.setText("Services Proxy Address:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 150;
servicesLabel.setLayoutData(gd);
proxyText = new Text(proxyComp, SWT.NONE | SWT.BORDER);
gd = new GridData(SWT.FILL, SWT.None, true, true);
proxyText.setLayoutData(gd);
proxyText.setText(proxyAddress == null ? "" : proxyAddress);
proxyText.setBackground(getTextColor(servicesGood && pypiesGood));
servicesText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 300;
servicesText.setLayoutData(gd);
servicesText.setText(services);
if (!servicesGood) {
servicesText.setBackground(textBoxComp.getDisplay().getSystemColor(
SWT.COLOR_RED));
}
pypiesLabel = new Label(textBoxComp, SWT.RIGHT);
pypiesLabel.setText("Pypies Proxy Address:");
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 150;
pypiesLabel.setLayoutData(gd);
pypiesText = new Text(textBoxComp, SWT.NONE);
gd = new GridData(SWT.RIGHT, SWT.None, true, true);
gd.widthHint = 300;
pypiesText.setLayoutData(gd);
pypiesText.setText(pypies);
if (!pypiesGood) {
pypiesText.setBackground(textBoxComp.getDisplay().getSystemColor(
SWT.COLOR_RED));
}
updateProxyEnabled();
}
@Override
protected void applySettings() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
store.setValue(ThinClientPreferenceConstants.P_USE_PROXIES, useProxy);
store.setValue(ThinClientPreferenceConstants.P_DISABLE_JMS, disableJms);
if (useProxy) {
store.setValue(ThinClientPreferenceConstants.P_SERVICES_PROXY,
services);
store.setValue(ThinClientPreferenceConstants.P_PYPIES_PROXY, pypies);
// Set the site and alertViz server for super.
LocalizationManager.getInstance().setCurrentSite(getSite());
store.setValue(ThinClientPreferenceConstants.P_USE_PROXIES,
useProxy);
store.setValue(ThinClientPreferenceConstants.P_PROXY_ADDRESS,
proxyAddress);
if (getAlertVizServer() != null) {
LocalizationManager
.getInstance()
@ -191,11 +231,11 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
.setValue(LocalizationConstants.P_ALERT_SERVER,
getAlertVizServer());
}
// setting the site will save the preference store
LocalizationManager.getInstance().setCurrentSite(getSite());
try {
((IPersistentPreferenceStore) store).save();
((IPersistentPreferenceStore) LocalizationManager.getInstance()
.getLocalizationStore()).save();
} catch (IOException e) {
statusHandler.handle(Priority.SIGNIFICANT,
"Unable to persist localization preference store", e);
@ -208,51 +248,125 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
@Override
public boolean validate() {
boolean superValid = super.validate();
if (!useProxy) {
return superValid;
boolean superResult = super.validate();
validateJms(superResult);
return superResult && jmsGood;
}
if (servicesText != null && !servicesText.isDisposed()
&& servicesText.isEnabled()) {
String services = servicesText.getText().trim();
if (!servicesGood || !this.services.equals(services)) {
this.services = services;
validateServices();
servicesText.setBackground(getTextColor(servicesGood));
}
} else {
status = null;
details = null;
// validate proxy
if (proxyText != null && !proxyText.isDisposed()
&& proxyText.isEnabled()) {
proxyAddress = proxyText.getText();
}
if (proxyAddress != null && proxyAddress.length() > 0) {
validateServices();
}
if (pypiesText != null && !pypiesText.isDisposed()
&& pypiesText.isEnabled()) {
String pypies = pypiesText.getText().trim();
if (!pypiesGood || !this.pypies.equals(pypies)) {
this.pypies = pypies;
validatePypies();
pypiesText.setBackground(getTextColor(pypiesGood));
}
} else {
validatePypies();
} else {
status = "Please enter a thin client proxy server address";
}
return servicesGood && pypiesGood && isSiteGood() && isAlertVizGood();
if (proxyText != null && !proxyText.isDisposed()) {
proxyText.setBackground(getTextColor(servicesGood && pypiesGood));
}
validateJms(servicesGood);
// validate site
if (siteText != null && !siteText.isDisposed()) {
super.setSite(siteText.getText());
}
super.validateSite();
if (siteText != null && !siteText.isDisposed()) {
siteText.setBackground(getTextColor(isSiteGood()));
}
// validate alertviz
// apparently alertvizserver == null means it's alertviz itself
if (alertVizServer != null) {
if (alertVizText != null && !alertVizText.isDisposed()) {
setAlertVizServer(alertVizText.getText());
}
super.validateAlertviz();
if (alertVizText != null && !alertVizText.isDisposed()) {
alertVizText.setBackground(getTextColor(isAlertVizGood()));
}
}
boolean everythingGood = servicesGood && pypiesGood && isSiteGood()
&& isAlertVizGood() && jmsGood;
updateStatus(everythingGood, status, details);
return everythingGood;
}
private void validateServices() {
ConnectivityManager.checkLocalizationServer(services, servicesCallback);
ConnectivityManager.checkLocalizationServer(
ThinClientUriUtil.getServicesAddress(proxyAddress),
servicesCallback);
}
private void validatePypies() {
ConnectivityManager.checkHttpServer(pypies, pypiesCallback);
ConnectivityManager.checkHttpServer(
ThinClientUriUtil.getPypiesAddress(proxyAddress),
pypiesCallback);
}
private void updateProxyEnabled() {
useProxy = useProxyCheck.getSelection();
servicesLabel.setEnabled(useProxy);
servicesText.setEnabled(useProxy);
pypiesLabel.setEnabled(useProxy);
pypiesText.setEnabled(useProxy);
setLocalizationEnabled(!useProxy);
proxyText.setEnabled(useProxy);
super.setLocalizationEnabled(!useProxy);
if (useProxy) {
if (localizationText != null && !localizationText.isDisposed()) {
localizationText.setBackground(getTextColor(true));
}
} else {
if (proxyText != null && !proxyText.isDisposed()) {
proxyText.setBackground(getTextColor(true));
}
}
validate();
}
/**
* Validates that a connection to JMS works.
*
* @param hasEdexConnection
* if we've successfully connected to edex
*/
private void validateJms(boolean hasEdexConnection) {
// only check Jms if it's enabled and we can connect to the services
if (!disableJms) {
if (hasEdexConnection) {
try {
String server = useProxy ? ThinClientUriUtil
.getServicesAddress(proxyAddress)
: getLocalization();
GetServersResponse response = ConnectivityManager
.checkLocalizationServer(server, false);
ConnectivityManager.checkJmsServer(
response.getJmsConnectionString(), jmsCallback);
} catch (VizException e) {
if (status == null) {
status = "Error connecting to JMS";
}
appendDetails(buildDetails(new ConnectivityResult(false,
null, e)));
jmsGood = false;
}
} else {
// JMS can't be good if we're not connected to edex cause
// then we don't even know where to connect to
jmsGood = false;
}
}
jmsGood = (jmsGood || disableJms);
if (jmsErrorLabel != null && !jmsErrorLabel.isDisposed()) {
jmsErrorLabel.setVisible(!jmsGood);
}
}
}

View file

@ -6,8 +6,13 @@ const int RED_BAND = 0;
const int GREEN_BAND = 1;
const int BLUE_BAND = 2;
uniform DataTexture rawData;
uniform DataMapping dataMapping;
uniform sampler2D rawDataTex;
uniform DataTextureInfo rawData;
uniform sampler1D dataMappingDataValues;
uniform sampler1D dataMappingColorValues;
uniform int dataMappingValues;
uniform ColorMapping colorMapping;
uniform sampler2D trueColorTexture;
@ -49,7 +54,7 @@ vec4 applyColorBand(int colorband) {
vec2((xy.x / width), (xy.y / height)));
// Lookup raw data value
float dataValue = textureToDataValue(rawData, gl_TexCoord[0].st);
float dataValue = textureToDataValue(rawDataTex, rawData, gl_TexCoord[0].st);
float r = curVal.r;
float g = curVal.g;
@ -58,7 +63,7 @@ vec4 applyColorBand(int colorband) {
if (dataValue != rawData.noDataValue && dataValue == dataValue) {
// Convert dataValue to cmapValue
float cmapValue = dataToColorMapValue(dataValue, dataMapping);
float cmapValue = dataToColorMapValue(dataValue, dataMappingDataValues, dataMappingColorValues, dataMappingValues);
float index = getColorMappingIndex(cmapValue, colorMapping);
int currentMask = toBitMask(a);
@ -86,4 +91,4 @@ void main(void) {
} else {
gl_FragColor = applyColorBand(band);
}
}
}

View file

@ -45,12 +45,14 @@ import com.raytheon.uf.viz.core.exception.VizException;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 4, 2009 njensen Initial creation
* Jul 6, 2010 5792 rferrel getLatestTafs now returns tafs
* sorted by issue date newest at
* the start of the array.
* 08AUG2012 15613 zhao Modified safeFormatTaf()
* Sep 4, 2009 njensen Initial creation
* Jul 6, 2010 5792 rferrel getLatestTafs now returns tafs
* sorted by issue date newest at
* the start of the array.
* 08AUG2012 15613 zhao Modified safeFormatTaf()
* Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references
* Feb 24, 2014 2830 njensen Sort dataTimes in getLatestTafs()
* so it works correctly
*
* </pre>
*
@ -97,6 +99,11 @@ public class TafUtil {
TafRecord.PLUGIN_NAME));
map.put("stationId", new RequestConstraint(siteID));
/*
* even if only requesting one, cannot pass in true because that
* will return a DataTime with only refTime set and tafs need to
* have fcstTime, validPeriod, etc set
*/
DataTime[] dt = DataCubeContainer.performTimeQuery(map, false);
if (dt.length == 0) {
return null;
@ -105,6 +112,7 @@ public class TafUtil {
if (size > dt.length) {
size = dt.length;
}
Arrays.sort(dt);
DataTime[] requestedTimes = new DataTime[size];
int k = 0;
for (int i = dt.length - 1; i > -1; i--) {

View file

@ -3,7 +3,10 @@
#include <mapping>
#include <coloring>
uniform sampler1D colorMappingColorMap;
uniform sampler1D colorMappingAlphaMask;
uniform ColorMapping colorMapping;
uniform ColorModifiers modifiers;
uniform float bkgrndRed;
@ -19,12 +22,12 @@ void main(void){
if ( logFactor > 0.0 ) {
index = getLogFactorIndex(index, logFactor);
}
vec4 color = texture1D(colorMapping.colorMap, index).rgba;
vec4 color = texture1D(colorMappingColorMap, index).rgba;
// Apply alpha mask if set
float alpha = color.a;
if ( applyMask == 1 ) {
if ( texture1D(colorMapping.alphaMask , index ).r != 0.0 ) {
if ( texture1D(colorMappingAlphaMask , index ).r != 0.0 ) {
color = vec4(bkgrndRed, bkgrndGreen, bkgrndBlue, alpha);
}
}

View file

@ -1,13 +1,21 @@
#include <mapping>
#include <coloring>
uniform DataTexture rawData;
uniform DataMapping dataMapping;
uniform sampler2D rawDataTex;
uniform DataTextureInfo rawData;
uniform sampler1D dataMappingDataValues;
uniform sampler1D dataMappingColorValues;
uniform int dataMappingValues;
uniform sampler1D colorMappingColorMap;
uniform sampler1D colorMappingAlphaMask;
uniform ColorMapping colorMapping;
uniform ColorModifiers modifiers;
void main(void) {
float dataValue = textureToDataValue(rawData, gl_TexCoord[0].st);
float dataValue = textureToDataValue(rawDataTex, rawData, gl_TexCoord[0].st);
// No data check/special NaN check
if (dataValue == rawData.noDataValue || dataValue != dataValue) {
@ -16,9 +24,9 @@ void main(void) {
}
// Convert dataValue to cmapValue
float cmapValue = dataToColorMapValue(dataValue, dataMapping);
float cmapValue = dataToColorMapValue(dataValue, dataMappingDataValues, dataMappingColorValues, dataMappingValues);
// Get color for colormapping, given value
vec4 textureColor = getColorByValue(cmapValue, colorMapping);
vec4 textureColor = getColorByValue(cmapValue, colorMapping, colorMappingColorMap, colorMappingAlphaMask);
// Apply the color modifiers into gl_FragColor
gl_FragColor = applyColorModifiers(textureColor, modifiers);
}

View file

@ -8,8 +8,7 @@
* implied data will range 0-1 and need scaling to get raw value
* where scaleMin maps to 0 and scaleMax maps to 1.
*/
struct DataTexture {
sampler2D rawTex;
struct DataTextureInfo {
float noDataValue;
int isScaled;
float scaleMin;
@ -18,23 +17,9 @@ struct DataTexture {
float height;
};
/**
* Fields used for converting from image data values to
* colormapping data values. Done to avoid conversions in
* application code. dmv[i] -> cmv[i]. Linear interpolation
* is done where non-exact matches are found. Mappings should
* be uploaded as floats so no scaling is needed
*/
struct DataMapping {
sampler1D dataMappingValues;
sampler1D colorMappingValues;
int numMappingValues;
};
struct ColorMapping {
/** Fields for color map and size. colorMap contains colors to
* use for mapping. cmapMin/Max is range colormap is applied over */
sampler1D colorMap;
float cmapMin;
float cmapMax;
@ -42,7 +27,6 @@ struct ColorMapping {
* same size as colorMap and contains 0s and 1s, 1 indicating alpha
* should be set to completely transparent */
int applyMask;
sampler1D alphaMask;
/** Fields for logarithmic and mirrored indexing into the colorMap */
int isMirrored;
@ -51,28 +35,28 @@ struct ColorMapping {
};
/**
* Returns the data value for the DataTexture at location.
* Returns the data value for the DataTextureInfo at location.
*/
float textureToDataValue(DataTexture texture, vec2 location) {
vec4 textureValue = texture2D(texture.rawTex, location);
float textureToDataValue(sampler2D texture, DataTextureInfo info, vec2 location) {
vec4 textureValue = texture2D(texture, location);
float dataValue = textureValue.r;
if (texture.isScaled == 1) {
if (info.isScaled == 1) {
// Convert to non-scaled value
dataValue = ((dataValue * (texture.scaleMax - texture.scaleMin))
+ texture.scaleMin);
dataValue = ((dataValue * (info.scaleMax - info.scaleMin))
+ info.scaleMin);
}
return dataValue;
}
/**
* Returns the data value for the DataTexture at location.
* Returns the data value for the DataTextureInfo at location.
*/
float dataToTextureValue(DataTexture texture, float dataValue) {
float dataToTextureValue(DataTextureInfo info, float dataValue) {
float textureValue = dataValue;
if (texture.isScaled == 1) {
textureValue = (dataValue - texture.scaleMin)
/ (texture.scaleMax - texture.scaleMin);
if (info.isScaled == 1) {
textureValue = (dataValue - info.scaleMin)
/ (info.scaleMax - info.scaleMin);
}
return textureValue;
}
@ -86,10 +70,9 @@ float lookupMappingValue(sampler1D mappingTex, int index,
}
/**
* Converts a data value into a colorMap value given the DataMapping
* Converts a data value into a colorMap value given the data mapping info
*/
float dataToColorMapValue(float dataValue, DataMapping mapping) {
int numMappingValues = mapping.numMappingValues;
float dataToColorMapValue(float dataValue, sampler1D dataMappingDataValues, sampler1D dataMappingColorValues, int numMappingValues) {
if (numMappingValues == 0) {
// Short circuit if no mapping is needed
return dataValue;
@ -99,9 +82,9 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
int lowIndex = 0;
int highIndex = numMappingValues - 1;
float lowValue = lookupMappingValue(mapping.dataMappingValues, lowIndex,
float lowValue = lookupMappingValue(dataMappingDataValues, lowIndex,
numMappingValues);
float highValue = lookupMappingValue(mapping.dataMappingValues, highIndex,
float highValue = lookupMappingValue(dataMappingDataValues, highIndex,
numMappingValues);
int reversed = 0;
if (lowValue > highValue) {
@ -117,7 +100,7 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
int nextIndex = lowIndex + ((highIndex - lowIndex) / 2);
if (nextIndex > lowIndex && nextIndex < highIndex) {
// Look up next value and determine if it is a high or low
float nextValue = lookupMappingValue(mapping.dataMappingValues,
float nextValue = lookupMappingValue(dataMappingDataValues,
nextIndex, numMappingValues);
if (nextValue < dataValue) {
if (reversed == 0) {
@ -146,9 +129,9 @@ float dataToColorMapValue(float dataValue, DataMapping mapping) {
factor = 1.0 - factor;
}
float lowCmapValue = lookupMappingValue(mapping.colorMappingValues,
float lowCmapValue = lookupMappingValue(dataMappingColorValues,
lowIndex, numMappingValues);
float highCmapValue = lookupMappingValue(mapping.colorMappingValues,
float highCmapValue = lookupMappingValue(dataMappingColorValues,
highIndex, numMappingValues);
return lowCmapValue + (highCmapValue - lowCmapValue) * factor;
@ -180,16 +163,16 @@ float getLinearIndex(float cmapValue, float cmapMin, float cmapMax) {
*/
float valueToLogIndex(float value, float rangeMin, float rangeMax) {
// Account for 0 min index
if (rangeMin == 0) {
if (rangeMin == 0.0) {
rangeMin = 0.0000001;
if (rangeMax < 0) {
if (rangeMax < 0.0) {
rangeMin = -rangeMin;
}
}
int reverse = 0;
if ((value < rangeMin && rangeMin > 0)
|| (value > rangeMin && rangeMin < 0)) {
if ((value < rangeMin && rangeMin > 0.0)
|| (value > rangeMin && rangeMin < 0.0)) {
reverse = 1;
}
@ -200,7 +183,7 @@ float valueToLogIndex(float value, float rangeMin, float rangeMax) {
// Check uncomputable index value, everything between this range is 0,
// rangeMin->rangeMax 0 -> 1, -rangeMin->-rangeMax 0 -> -1
if (value <= rangeMin && value >= -rangeMin) {
return 0;
return 0.0;
}
float index = (log(value) - log(rangeMin))
@ -232,12 +215,12 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
float index = 0.0;
// Flag if min/max values are on opposite sides of zero
int minMaxOpposite = 0;
if ((cmapMin < 0 && cmapMax > 0) || (cmapMin > 0 && cmapMax < 0)) {
if ((cmapMin < 0.0 && cmapMax > 0.0) || (cmapMin > 0.0 && cmapMax < 0.0)) {
minMaxOpposite = 1;
}
if (mirror != 0 || minMaxOpposite != 0) {
if (cmapMax < 0) {
if (cmapMax < 0.0) {
// Invert colormapping if negative range was given
cmapValue = -cmapValue;
}
@ -261,9 +244,9 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
float logPosCmapMax = absLogZeroVal + log(posCmapMax);
// Calculate index which zeroVal is at based on neg max and pos max
float zeroValIndex = logNegCmapMax / (logNegCmapMax + logPosCmapMax);
if (cmapValue > 0) {
if (cmapValue > 0.0) {
index = valueToLogIndex(rangeValue, zeroVal, posCmapMax);
index = zeroValIndex + (1 - zeroValIndex) * index;
index = zeroValIndex + (1.0 - zeroValIndex) * index;
} else {
index = valueToLogIndex(rangeValue, zeroVal, negCmapMax);
index = zeroValIndex - zeroValIndex * index;
@ -277,8 +260,8 @@ float getLogIndex(float cmapValue, float cmapMin, float cmapMax, int mirror) {
if (inverted == 1) {
index = 1.0 - index;
}
if (cmapMin > 0 && cmapValue < rangeMin
|| (cmapMin < 0 && cmapValue > -rangeMin)) {
if (cmapMin > 0.0 && cmapValue < rangeMin
|| (cmapMin < 0.0 && cmapValue > -rangeMin)) {
index = -index;
}
}
@ -333,13 +316,13 @@ float getColorMappingIndex(float cmapValue, ColorMapping colorMapping) {
/**
* Returns a color for the index based on the ColorMapping
*/
vec4 getColorByIndex(float index, ColorMapping colorMapping) {
vec4 getColorByIndex(float index, sampler1D colorMap, sampler1D alphaMask, int applyMask) {
// Lookup color in colorMap for index
vec4 textureColor = texture1D(colorMapping.colorMap, index).rgba;
vec4 textureColor = texture1D(colorMap, index).rgba;
// Apply alpha mask
if (colorMapping.applyMask == 1) {
if (texture1D(colorMapping.alphaMask, index).r != 0.0) {
if (applyMask == 1) {
if (texture1D(alphaMask, index).r != 0.0) {
textureColor = vec4(textureColor.rgb, 0.0);
}
}
@ -349,7 +332,7 @@ vec4 getColorByIndex(float index, ColorMapping colorMapping) {
/**
* Returns a color for the cmapValue based on the ColorMapping
*/
vec4 getColorByValue(float cmapValue, ColorMapping colorMapping) {
return getColorByIndex(getColorMappingIndex(cmapValue, colorMapping),
colorMapping);
vec4 getColorByValue(float cmapValue, ColorMapping colorMapping, sampler1D colorMap, sampler1D alphaMask) {
float index = getColorMappingIndex(cmapValue, colorMapping);
return getColorByIndex(index, colorMap, alphaMask, colorMapping.applyMask);
}

View file

@ -3,21 +3,27 @@
#include <mapping>
uniform DataTexture imageData;
uniform DataMapping imageToMosaic;
uniform DataTexture mosaicData;
uniform sampler2D imageDataTex;
uniform DataTextureInfo imageData;
uniform sampler1D imageToMosaicDataValues;
uniform sampler1D imageToMosaicColorValues;
uniform int imageToMosaicValues;
uniform sampler2D mosaicDataTex;
uniform DataTextureInfo mosaicData;
void main(void) {
float imageValue = textureToDataValue(imageData, gl_TexCoord[0].st);
float imageValue = textureToDataValue(imageDataTex, imageData, gl_TexCoord[0].st);
vec2 frag_xy = gl_FragCoord.xy;
float mosaicValue = textureToDataValue(mosaicData,
float mosaicValue = textureToDataValue(mosaicDataTex, mosaicData,
vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height));
float newValue = mosaicValue;
// No data check/special NaN check
if (imageValue != imageData.noDataValue && imageValue == imageValue) {
// Convert image value to mosaic value
imageValue = dataToColorMapValue(imageValue, imageToMosaic);
imageValue = dataToColorMapValue(imageValue, imageToMosaicDataValues, imageToMosaicColorValues, imageToMosaicValues);
if (imageValue > mosaicValue) {
newValue = imageValue;
}

View file

@ -3,14 +3,20 @@
#include <mapping>
uniform DataTexture imageData;
uniform DataMapping imageToMosaic;
uniform DataTexture mosaicData;
uniform sampler2D imageDataTex;
uniform DataTextureInfo imageData;
uniform sampler1D imageToMosaicDataValues;
uniform sampler1D imageToMosaicColorValues;
uniform int imageToMosaicValues;
uniform sampler2D mosaicDataTex;
uniform DataTextureInfo mosaicData;
void main(void) {
float imageValue = textureToDataValue(imageData, gl_TexCoord[0].st);
float imageValue = textureToDataValue(imageDataTex, imageData, gl_TexCoord[0].st);
vec2 frag_xy = gl_FragCoord.xy;
float mosaicValue = textureToDataValue(mosaicData,
float mosaicValue = textureToDataValue(mosaicDataTex, mosaicData,
vec2(frag_xy.x / mosaicData.width, frag_xy.y / mosaicData.height));
float newValue;
@ -19,7 +25,7 @@ void main(void) {
// Use existing value
newValue = mosaicValue;
} else {
newValue = dataToColorMapValue(imageValue, imageToMosaic);
newValue = dataToColorMapValue(imageValue, imageToMosaicDataValues, imageToMosaicColorValues, imageToMosaicValues);
}
gl_FragColor = vec4(dataToTextureValue(mosaicData, newValue), 0.0, 0.0,
1.0);

View file

@ -56,7 +56,9 @@ public class GLSLStructFactory {
int texBinding, AbstractGLColormappedImage image) {
ColorMapParameters parameters = image.getColorMapParameters();
AbstractGLColorMapDataFormat dataFormat = image.getDataFormat();
setFieldUniform(program, name, "rawTex", texBinding);
// Set the texture outside the struct
setFieldUniform(program, name + "Tex", texBinding);
// Set struct fields
setFieldUniform(program, name, "noDataValue",
parameters.getNoDataValue());
setFieldUniform(program, name, "isScaled", dataFormat.isScaled());
@ -82,11 +84,9 @@ public class GLSLStructFactory {
public static void createDataMapping(GLShaderProgram program, String name,
int dataMappingTexBinding, int colorMappingTexBinding,
int numMappingValues) {
setFieldUniform(program, name, "dataMappingValues",
dataMappingTexBinding);
setFieldUniform(program, name, "colorMappingValues",
colorMappingTexBinding);
setFieldUniform(program, name, "numMappingValues", numMappingValues);
setFieldUniform(program, name + "DataValues", dataMappingTexBinding);
setFieldUniform(program, name + "ColorValues", colorMappingTexBinding);
setFieldUniform(program, name + "Values", numMappingValues);
}
/**
@ -101,12 +101,12 @@ public class GLSLStructFactory {
public static void createColorMapping(GLShaderProgram program, String name,
int colorMapTexBinding, int alphaMaskTexBinding,
ColorMapParameters parameters) {
setFieldUniform(program, name, "colorMap", colorMapTexBinding);
setFieldUniform(program, name + "ColorMap", colorMapTexBinding);
setFieldUniform(program, name, "cmapMin", parameters.getColorMapMin());
setFieldUniform(program, name, "cmapMax", parameters.getColorMapMax());
setFieldUniform(program, name, "applyMask", parameters.isUseMask());
setFieldUniform(program, name, "alphaMask", alphaMaskTexBinding);
setFieldUniform(program, name + "AlphaMask", alphaMaskTexBinding);
setFieldUniform(program, name, "isMirrored", parameters.isMirror());
setFieldUniform(program, name, "isLogarithmic",
@ -132,6 +132,13 @@ public class GLSLStructFactory {
private static void setFieldUniform(GLShaderProgram program,
String structName, String fieldName, Object fieldValue) {
program.setUniform(structName + FIELD_SEPERATOR + fieldName, fieldValue);
setFieldUniform(program, structName + FIELD_SEPERATOR + fieldName,
fieldValue);
}
private static void setFieldUniform(GLShaderProgram program,
String fieldName, Object fieldValue) {
program.setUniform(fieldName, fieldValue);
}
}

View file

@ -1706,8 +1706,9 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
endAzm += 360.0;
}
double totalAzimuth = (endAzm - startAzm);
boolean includeSides = circle.includeSides && !fill
&& ((endAzm - startAzm) < 360.0);
&& (totalAzimuth < 360.0);
if (fill) {
gl.glBegin(GL.GL_TRIANGLE_FAN);
@ -1720,8 +1721,16 @@ public class GLTarget extends AbstractGraphicsTarget implements IGLTarget {
}
}
double step = (endAzm - startAzm) / (circle.numberOfPoints);
for (double azm = startAzm; azm <= endAzm; azm += step) {
// Get the number of unique points in the circle
int points = circle.numberOfPoints;
if (totalAzimuth >= 360) {
// If angle is meant to be complete circle, add extra point
// to ensure circle is touching
points += 1;
}
double step = totalAzimuth / (points - 1);
for (int i = 0; i < points; ++i) {
double azm = startAzm + (i * step);
double[] pointOnCircle = getPointOnCircle(x, y, z, radius,
azm);
gl.glVertex3d(pointOnCircle[0], pointOnCircle[1],

View file

@ -36,6 +36,8 @@ import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters.PersistedParameters;
import com.raytheon.uf.common.datastorage.DataStoreFactory;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.datastorage.Request;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.style.LabelingPreferences;
import com.raytheon.uf.common.style.ParamLevelMatchCriteria;
@ -91,6 +93,8 @@ public class TopoResource extends
protected TileSetRenderable topoTileSet;
private double noDataValue;
protected TopoResource(TopoResourceData topoData,
LoadProperties loadProperties, File dataFile) throws VizException {
super(topoData, loadProperties);
@ -189,12 +193,13 @@ public class TopoResource extends
}
SamplePreferences samplePrefs = prefs.getSamplePrefs();
if (samplePrefs != null && samplePrefs.getFormatString() != null) {
if ((samplePrefs != null)
&& (samplePrefs.getFormatString() != null)) {
params.setFormatString(samplePrefs.getFormatString());
}
LabelingPreferences labelPrefs = prefs.getColorbarLabeling();
if (labelPrefs != null && labelPrefs.getValues() != null) {
if ((labelPrefs != null) && (labelPrefs.getValues() != null)) {
params.setColorBarIntervals(labelPrefs.getValues());
}
}
@ -213,6 +218,16 @@ public class TopoResource extends
getCapability(ColorMapCapability.class).setColorMapParameters(params);
IDataStore dataStore = DataStoreFactory.getDataStore(this.dataFile);
try {
IDataRecord rec = dataStore.retrieve("/", "full",
Request.buildPointRequest(new java.awt.Point(0, 0)));
noDataValue = rec.getFillValue().doubleValue();
} catch (Exception e) {
statusHandler.error(e.getLocalizedMessage(), e);
noDataValue = Double.NaN;
}
topoTileSet = new TileSetRenderable(
getCapability(ImagingCapability.class), getTopoGeometry(),
getTopoTileImageCreator(), getNumberOfTopoLevels(), 512);
@ -284,7 +299,7 @@ public class TopoResource extends
double height;
try {
// height = TopoQuery.getInstance().getHeight(coord.asLatLon());
height = topoTileSet.interrogate(coord.asLatLon());
height = topoTileSet.interrogate(coord.asLatLon(), noDataValue);
} catch (Exception e) {
throw new VizException("Error transforming", e);
}

View file

@ -1,5 +1,4 @@
#!/bin/bash
# CAVE startup script
# Note: CAVE will not run as 'root'
@ -25,8 +24,6 @@
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Dec 04, 2013 #2589 dgilling Create command-line arg that controls
# xvfb initialization.
# Dec 05, 2013 #2593 rjpeter set IGNORE_NUM_CAVES
# Dec 05, 2013 #2590 dgilling Remove duplicated code and call to
# cave.sh.
@ -50,28 +47,12 @@ fi
PROGRAM_NAME="gfeclient"
# remove "-enablegl" flag from command-line if set so it doesn't confuse any
# commands we call later.
USER_ARGS=()
while [[ $1 ]]
do
if [ "$1" == "-enablegl" ]
then
ENABLEGL="true"
else
USER_ARGS+=("$1")
fi
shift
done
if [ -n "$ENABLEGL" ]
# if display not set
if [ -n "$DISPLAY" ]
then
# if display not set
if [ -n "$DISPLAY" ]
then
echo "Using Display set to $DISPLAY"
extendLibraryPath
else
else
echo "Display not set, creating offscreen x on port $$"
extendLibraryPath "-noX"
Xvfb :$$ -screen 0 1280x1024x24 &
@ -79,13 +60,12 @@ then
export DISPLAY="localhost:$$.0"
#don't use shader when no display set
SWITCHES="${SWITCHES} -no_shader"
fi
fi
export IGNORE_NUM_CAVES=1
source /awips2/cave/cave.sh -nosplash -noredirect -component gfeclient "${USER_ARGS[@]}" &
wait
source /awips2/cave/cave.sh -nosplash -noredirect -component gfeclient "$@" &
wait $!
if [ -n "$xvfb" ]
then

View file

@ -22,8 +22,7 @@
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Dec 04, 2013 #2589 dgilling Create command-line arg that controls
# xvfb initialization.
# Feb 07, 2014 #2509 dgilling Fix baseline merge issue.
#
#
@ -37,8 +36,7 @@ CAVE_DIR=/awips2/cave
# execute the runProcedure module
_GFECLI="${RUN_FROM_DIR}/gfeclient.sh"
_GFECLI_ARGS="-enablegl"
_MODULE="${CAVE_DIR}/etc/gfe/utility/PngWriter.py"
_MODULE="${RUN_FROM_DIR}/src/ifpimage/PngWriter.py"
# quoting of '$@' is used to prevent command line interpretation
if [ ! -f $_GFECLI ] || [ ! -d $CAVE_DIR ]
@ -46,6 +44,6 @@ then
echo "CAVE and/or gfeclient not installed on this workstation ..exiting"
exit 1
else
$_GFECLI $_GFECLI_ARGS $_MODULE "$@"
$_GFECLI $_MODULE "$@"
fi

View file

@ -505,16 +505,16 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
def windSpdProb_thresholds(self, tree, node):
return [
((50.0, 80.0), (40.0, 60.0)), # Per 1
(45.0, 32.5), # Per 2
(40.0, 25.0), # Per 3
(35.0, 20.0), # Per 4
(30.0, 15.0), # Per 5
(25.0, 12.5), # Per 6
(22.5, 10.0), # Per 7
(20.0, 8.0), # Per 8
(17.5, 6.0), # Per 9
(15.0, 5.0), # Per 10
((45.0, 80.0), (25.0, 60.0)), # Per 1
(35.0, 20.0), # Per 2
(30.0, 15.0), # Per 3
(25.0, 12.5), # Per 4
(22.5, 10.0), # Per 5
(20.0, 8.0), # Per 6
(17.5, 7.0), # Per 7
(15.0, 6.0), # Per 8
(12.5, 5.0), # Per 9
(10.0, 4.0), # Per 10
]
def firstComponentPeriod(self, tree, node):
@ -1130,7 +1130,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
desc = "posHR"
elif maxMag >= 34.0:
desc = "posTS"
elif pws64 >= thresh64low or pws64 +2.0 >= thresh64low:
elif pws64 >= thresh64low or pws64 +5.0 >= thresh64low:
desc = "posHR"
elif pws34 >= thresh34low or pws34+10.0 >= thresh34low:
desc = "posTS"
@ -1203,7 +1203,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
desc = "posHR"
elif maxMag >= 34.0:
desc = "posTS"
elif pws64 >= thresh64 or pws64 +2.0 >= thresh64:
elif pws64 >= thresh64 or pws64 +5.0 >= thresh64:
desc = "posHR"
elif pws34 >= thresh34 or pws34+10.0 >= thresh34:
desc = "posTS"
@ -1299,7 +1299,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
else:
self.debug_print("HERE I AM")
if pws64 >= thresh64 or pws64+1.0 >= thresh64:
if pws64 >= thresh64 or pws64+2.5 >= thresh64:
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
@ -1399,7 +1399,7 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
else:
self.debug_print("HERE I AM")
if pws64 >= thresh64 or pws64+1 >= thresh64:
if pws64 >= thresh64 or pws64+2.5 >= thresh64:
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
@ -1435,14 +1435,18 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
self.debug_print("(34 kt threshold, 64 kt threshold) = (%.2f, %.2f)" %
(thresh34, thresh64), 1)
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64) and maxMag >= 20.0:
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64):
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34) and maxMag >= 20.0:
elif (self._Hurricane_A or self._Hurricane_W) and maxMag >= 50:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34):
desc = "posTS"
elif maxMag >= 34.0:
desc = "posTS"
elif (self._Hurricane_A or self._Hurricane_W or self._TropStorm_A or self._TropStorm_W) and maxMag >= 25:
desc = "posTS"
else:
desc = ""
@ -1470,14 +1474,18 @@ class VectorRelatedPhrases(PhraseBuilder.PhraseBuilder):
self.debug_print("(34 kt threshold, 64 kt threshold) = (%.2f, %.2f)" %
(thresh34, thresh64), 1)
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64) and maxMag >= 20.0:
if (pws64 >= thresh64 or (pws64 + 1.0) >= thresh64):
desc = "posHR"
elif maxMag >= 64.0:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34) and maxMag >= 20.0:
elif (self._Hurricane_A or self._Hurricane_W) and maxMag >= 50:
desc = "posHR"
elif (pws34 >= thresh34 or (pws34 + 2.5) >= thresh34):
desc = "posTS"
elif maxMag >= 34.0:
desc = "posTS"
elif (self._Hurricane_A or self._Hurricane_W or self._TropStorm_A or self._TropStorm_W) and maxMag >= 25:
desc = "posTS"
else:
desc = ""

View file

@ -29,7 +29,7 @@
# ------------ ---------- ----------- --------------------------
# 07/25/08 njensen Initial Creation.
# 09/05/13 #2329 randerso Added error handling
#
# 02/06/2014 #2591 randerso Changed log level to debug
#
import sys, traceback, os, time, LogStream
@ -55,7 +55,7 @@ def getCombinations(comboName):
with open(filename,'r') as fd:
filecontents = fd.read()
LogStream.logProblem("\nERROR loading combinations file: "+ comboName +
LogStream.logDebug("ERROR loading combinations file: "+ comboName +
"\nmd.__file__: " + md.__file__ +
"\ndir(md): " + str(dir(md)) +
"\n" + md.__file__ + " last modified: " + time.strftime("%Y-%m-%d %H:%M:%S",time.gmtime(os.path.getmtime(md.__file__))) +

View file

@ -63,6 +63,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager;
* DataManager instance.
* 05 SEP 2013 2329 randerso Added call to ZoneCombinerComp.applyZoneCombo when
* when run formatter button is clicked.
* 05 FEB 2014 2591 randerso Added dataManager to ZoneCombinerComp constructor
*
* </pre>
*
@ -592,7 +593,7 @@ public class ProductAreaComp extends Composite implements
*/
private void createZoneCombinerComp() {
zoneCombiner = new ZoneCombinerComp(stackGridComp, productTabCB,
productName, getTextProductManager());
productName, getTextProductManager(), this.dataMgr);
}
/**

View file

@ -152,6 +152,10 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 05/08/2013 #1842 dgilling Add alternate setProductText(), fix
* warnings.
* 09/03/2013 16534 ryu Refactor; sneak in a change for Ron (RM #1597).
* 01/06/2014 2649 dgilling Pass flag to StoreTransmitDlg to only
* update VTEC lines on products that
* aren't being corrected.
* 02/05/2014 17022 ryu Modified loadDraft() to fix merging of WMO heading and AWIPS ID.
*
* </pre>
*
@ -1139,7 +1143,7 @@ public class ProductEditorComp extends Composite implements
// prevent the launching of another dialog until the modal dialog is
// closed.
StoreTransmitDlg storeDlg = new StoreTransmitDlg(parent.getShell(),
showStore, this, transmissionCB, pid);
showStore, this, transmissionCB, pid, !textComp.isCorMode());
storeDlg.open();
}
}
@ -2386,10 +2390,13 @@ public class ProductEditorComp extends Composite implements
}
DraftProduct draft = DraftProduct.load(lf);
setTabColorFunc(productStateEnum.Finished);
productDefinition = draft.getProductDefinition();
clearProductText();
setProductText(draft.getProductText());
setTabColorFunc(productStateEnum.Finished);
setStatusText('R', productId + " draft loaded.");
if (productDefinition.get("brain") != null) {
brain();
String msg = "Your saved draft was loaded, but the draft is invalid "
@ -2877,7 +2884,7 @@ public class ProductEditorComp extends Composite implements
mb2.open();
return;
}
// Word-wrap the whole selection.
int curLine = styledText.getLineAtOffset(selectionRange.x);
int lastSelIdx = selectionRange.x + selectionRange.y - 1;

View file

@ -67,19 +67,24 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 21 APR 2008 ### lvenable Initial creation
* 19 FEB 2010 4132 ryu Product correction.
* 28May2010 2187 cjeanbap Added StdTextProductFactory
* functionality.
* 09 NOV 2012 1298 rferrel Changes for non-blocking dialog.
* 02apr2013 15564 mgamazaychikov Ensured awipsWanPil to be 10 characters space-padded long
* 08 MAY 2013 1842 dgilling Use VtecUtil to set product ETNs, fix
* Apr 21, 2008 ### lvenable Initial creation
* Feb 19, 2010 4132 ryu Product correction.
* May 28, 2010 2187 cjeanbap Added StdTextProductFactory
* functionality.
* Nov 09, 2012 1298 rferrel Changes for non-blocking dialog.
* Apr 02, 2013 15564 mgamazaychikov Ensured awipsWanPil to be 10 characters
* space-padded long
* May 08, 2013 1842 dgilling Use VtecUtil to set product ETNs, fix
* warnings.
* 07 Jun 2013 1981 mpduff Set user's id in OUPRequest as it is now a protected operation.
* 23 Oct 2013 1843 dgilling Ensure that dialog is always closed,
* Jun 07, 2013 1981 mduff Set user's id in OUPRequest as it is
* now a protected operation.
* Oct 23, 2013 1843 dgilling Ensure that dialog is always closed,
* even on failure, changes for error handling
* of intersite ETN assignment.
* 18 Dec 2013 2641 dgilling Support changes to GFEVtecUtil.getVtecLinesThatNeedEtn().
* Dec 18, 2013 2641 dgilling Support changes to GFEVtecUtil.getVtecLinesThatNeedEtn().
* Jan 06, 2014 2649 dgilling Make ETN assignment process optional.
* Feb 17, 2014 2774 dgilling Merge changes from 14.1 baseline to 14.2.
*
* </pre>
*
* @author lvenable
@ -142,17 +147,26 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
private final String pid;
private final boolean updateVtec;
/**
* Constructor.
*
* @param parent
* Parent shell.
* @param storeDialog
* Store flag. True is store, false is transmit.
* @param editor
* Parent editor. Product will be updated in this editor after
* transmission.
* @param transmissionCB
* @param pid
* @param updateVtec
* Whether or not to update the ETNs of any VTEC lines in the
* product to be transmitted. Recommend setting this to false
* when correcting a previously transmitted product.
*/
public StoreTransmitDlg(Shell parent, boolean storeDialog,
ProductEditorComp editor, ITransmissionState transmissionCB,
String pid) {
String pid, boolean updateVtec) {
super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
CAVE.DO_NOT_BLOCK);
@ -161,6 +175,7 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
parentEditor = editor;
this.productText = editor.getProductText();
this.pid = pid;
this.updateVtec = updateVtec;
}
@Override
@ -344,114 +359,78 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
// Store/Transmit the product...
if (!countdownThread.threadCancelled()) {
boolean retrieveEtnFailed = false;
try {
if (updateVtec) {
// With GFE VTEC products, it's possible to have multiple
// segments with NEW vtec action codes and the same phensig.
// For
// this reason, HazardsTable.py implemented a "cache" that
// would
// ensure all NEWs for the same phensig would be assigned
// the
// same ETN. This Map replicates that legacy behavior.
//
// This "cache" has two levels:
// 1. The first level is keyed by the hazard's phensig.
// 2. The second level is keyed by the valid period of the
// hazard.
// Effectively, making this a Map<Phensig, Map<ValidPeriod,
// ETN>>.
Map<String, List<VtecObject>> vtecsToAssignEtn = GFEVtecUtil
.initETNCache(productText);
Map<String, Map<TimeRange, Integer>> etnCache = new HashMap<String, Map<TimeRange, Integer>>();
List<VtecObject> vtecsToAssignEtn = GFEVtecUtil
.getVtecLinesThatNeedEtn(productText);
// With GFE VTEC products, it's possible to have multiple segments
// with
// NEW vtec action codes and the same phensig. For this reason,
// HazardsTable.py implemented a "cache" that would ensure all NEWs
// for
// the same phensig would be assigned the same ETN. This Map
// replicates
// that legacy behavior.
//
// This "cache" has two levels:
// 1. The first level is keyed by the hazard's phensig.
// 2. The second level is keyed by the valid period of the hazard.
// Effectively, making this a Map<Phensig, Map<ValidPeriod, ETN>>.
Map<String, Map<TimeRange, Integer>> etnCache = new HashMap<String, Map<TimeRange, Integer>>();
for (String phensig : vtecsToAssignEtn.keySet()) {
Map<TimeRange, Integer> l2EtnCache = new HashMap<TimeRange, Integer>();
List<VtecObject> vtecs = vtecsToAssignEtn.get(phensig);
for (VtecObject vtec : vtecsToAssignEtn) {
try {
GetNextEtnResponse serverResponse = GFEVtecUtil.getNextEtn(
vtec.getOffice(), vtec.getPhensig(), true, true);
if (!serverResponse.isOkay()) {
final VtecObject vtecToFix = vtec;
final boolean[] exitLoopContainer = { false };
final Exception[] exceptionContainer = { null };
final GetNextEtnResponse[] responseContainer = { serverResponse };
for (int i = 0; i < vtecs.size(); i++) {
VtecObject vtec = vtecs.get(i);
TimeRange validPeriod = new TimeRange(
vtec.getStartTime(), vtec.getEndTime());
Integer currentEtn = vtec.getSequence();
do {
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
GetNextEtnResponse serverResponse = responseContainer[0];
ETNConfirmationDialog dlg = new ETNConfirmationDialog(
getShell(), serverResponse);
if (dlg.open() == ETNConfirmationDialog.OK) {
int etn = dlg.getProposedEtn();
statusHandler.info(String
.format("User confirmed ETN for %s: %04d",
serverResponse
.getPhensig(),
etn));
try {
GetNextEtnResponse followupResp = GFEVtecUtil.getNextEtn(
vtecToFix.getOffice(),
vtecToFix.getPhensig(),
true, true, true, etn);
responseContainer[0] = followupResp;
} catch (VizException e) {
exceptionContainer[0] = e;
exitLoopContainer[0] = true;
}
} else {
statusHandler
.info("User declined to fix ETN for %s",
serverResponse
.getPhensig());
exitLoopContainer[0] = true;
}
}
});
} while (!responseContainer[0].isOkay()
&& !exitLoopContainer[0]);
if (!responseContainer[0].isOkay()) {
String msg = "Unable to set ETN for phensig "
+ responseContainer[0].getPhensig()
+ "\nStatus: "
+ responseContainer[0].toString();
Exception e = exceptionContainer[0];
if (e == null) {
throw new VizException(msg);
// the first time we select a new, unique ETN, any
// other
// VTEC lines in the product that have the same
// phensig
// and an adjacent TimeRange can also re-use this
// ETN
if (currentEtn == 0) {
currentEtn = getNextEtn(vtec);
l2EtnCache.put(validPeriod, currentEtn);
} else {
throw new VizException(msg, e);
// BUT...once we've made our one pass through
// the
// product and re-used the ETN where
// appropriate, we
// should not check again
continue;
}
for (int j = i + 1; j < vtecs.size(); j++) {
VtecObject vtec2 = vtecs.get(j);
TimeRange validPeriod2 = new TimeRange(
vtec2.getStartTime(),
vtec2.getEndTime());
Integer currentEtn2 = vtec2.getSequence();
if ((currentEtn2 == 0)
&& (validPeriod2
.isAdjacentTo(validPeriod) || validPeriod2
.overlaps(validPeriod))) {
l2EtnCache.put(validPeriod2, currentEtn);
vtec2.setSequence(currentEtn);
}
}
} else {
serverResponse = responseContainer[0];
}
etnCache.put(phensig, l2EtnCache);
}
TimeRange validPeriod = new TimeRange(vtec.getStartTime()
.getTime(), vtec.getEndTime().getTime());
String phensig = vtec.getPhensig();
Map<TimeRange, Integer> etnsByTR = etnCache.get(phensig);
if (etnsByTR == null) {
etnsByTR = new HashMap<TimeRange, Integer>();
etnCache.put(phensig, etnsByTR);
}
etnsByTR.put(validPeriod, serverResponse.getNextEtn());
} catch (VizException e) {
statusHandler.handle(Priority.CRITICAL,
"Error setting ETNs for product", e);
retrieveEtnFailed = true;
VizApp.runAsync(new Runnable() {
@Override
public void run() {
sendTransmissionStatus(ConfigData.productStateEnum.Failed);
StoreTransmitDlg.this.parentEditor.revive();
}
});
break;
productText = GFEVtecUtil.finalizeETNs(productText,
etnCache);
}
}
if (!retrieveEtnFailed) {
productText = GFEVtecUtil.finalizeETNs(productText, etnCache);
VizApp.runSync(new Runnable() {
@ -476,6 +455,17 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
}
});
} catch (VizException e) {
statusHandler.handle(Priority.CRITICAL,
"Error preparing product for transmission.", e);
VizApp.runAsync(new Runnable() {
@Override
public void run() {
sendTransmissionStatus(ConfigData.productStateEnum.Failed);
StoreTransmitDlg.this.parentEditor.revive();
}
});
}
}
@ -490,6 +480,65 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
});
}
private Integer getNextEtn(VtecObject vtec) throws VizException {
GetNextEtnResponse serverResponse = GFEVtecUtil.getNextEtn(
vtec.getOffice(), vtec.getPhensig(), true, true);
if (!serverResponse.isOkay()) {
final VtecObject vtecToFix = vtec;
final boolean[] exitLoopContainer = { false };
final Exception[] exceptionContainer = { null };
final GetNextEtnResponse[] responseContainer = { serverResponse };
do {
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
GetNextEtnResponse serverResponse = responseContainer[0];
ETNConfirmationDialog dlg = new ETNConfirmationDialog(
getShell(), serverResponse);
if (dlg.open() == ETNConfirmationDialog.OK) {
int etn = dlg.getProposedEtn();
statusHandler.info(String.format(
"User confirmed ETN for %s: %04d",
serverResponse.getPhensig(), etn));
try {
GetNextEtnResponse followupResp = GFEVtecUtil
.getNextEtn(vtecToFix.getOffice(),
vtecToFix.getPhensig(), true,
true, true, etn);
responseContainer[0] = followupResp;
} catch (VizException e) {
exceptionContainer[0] = e;
exitLoopContainer[0] = true;
}
} else {
statusHandler.info(
"User declined to fix ETN for %s",
serverResponse.getPhensig());
exitLoopContainer[0] = true;
}
}
});
} while (!responseContainer[0].isOkay() && !exitLoopContainer[0]);
if (!responseContainer[0].isOkay()) {
String msg = "Unable to set ETN for phensig "
+ responseContainer[0].getPhensig() + "\nStatus: "
+ responseContainer[0].toString();
Exception e = exceptionContainer[0];
if (e == null) {
throw new VizException(msg);
} else {
throw new VizException(msg, e);
}
} else {
serverResponse = responseContainer[0];
}
}
return serverResponse.getNextEtn();
}
/**
* Method to transmit the product.
*/
@ -597,4 +646,4 @@ public class StoreTransmitDlg extends CaveSWTDialog implements
transmissionCB.setTransmissionState(status);
}
}
}
}

View file

@ -58,8 +58,7 @@ import org.opengis.referencing.operation.TransformException;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
import com.raytheon.uf.common.dataplugin.gfe.exception.GfeException;
import com.raytheon.uf.common.localization.FileUpdatedMessage;
import com.raytheon.uf.common.localization.ILocalizationFileObserver;
import com.raytheon.uf.common.dataplugin.gfe.server.notify.CombinationsFileChangedNotification;
import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -74,7 +73,9 @@ import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.internal.NotificationRouter.AbstractGFENotificationObserver;
import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil;
import com.raytheon.viz.gfe.textformatter.TextProductManager;
import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
@ -99,6 +100,12 @@ import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
* not found to match A1.
* Dec 03, 2013 #2591 dgilling Ensure all change states to the combo
* file are handled.
* Jan 07, 2014 #2662 randerso Disabled zone combiner if no maps are selected
* Feb 04, 2014 #2591 randerso Forced reload of combinations file after save to ensure
* file is updated prior to running formatter
* Changed to use CombinationsFileChangedNotification instead of
* FileUpdatedMessage so we can ignore our own changes
* Moved retrieval of combinations file to CombinationsFileUtil.init
*
* </pre>
*
@ -106,8 +113,7 @@ import com.raytheon.viz.gfe.ui.zoneselector.ZoneSelector;
* @version 1.0
*
*/
public class ZoneCombinerComp extends Composite implements
ILocalizationFileObserver, IZoneCombiner {
public class ZoneCombinerComp extends Composite implements IZoneCombiner {
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ZoneCombinerComp.class);
@ -190,6 +196,8 @@ public class ZoneCombinerComp extends Composite implements
protected TextProductManager textProductMgr;
protected DataManager dataManager;
protected String product;
protected boolean mapRequired;
@ -223,6 +231,8 @@ public class ZoneCombinerComp extends Composite implements
private List<String> mapNames;
private AbstractGFENotificationObserver<CombinationsFileChangedNotification> comboChangeListener;
private void initPreferences() {
IPreferenceStore prefs = Activator.getDefault().getPreferenceStore();
@ -246,7 +256,8 @@ public class ZoneCombinerComp extends Composite implements
* Product name.
*/
public ZoneCombinerComp(Composite parent, IProductTab callBack,
String productName, TextProductManager textProductMgr) {
String productName, TextProductManager textProductMgr,
DataManager dataManager) {
super(parent, SWT.NONE);
this.parent = parent;
@ -257,7 +268,13 @@ public class ZoneCombinerComp extends Composite implements
this.textProductMgr = textProductMgr;
mapRequired = textProductMgr.mapRequired(productName);
this.dataManager = dataManager;
mapRequired = this.textProductMgr.mapRequired(productName);
this.mapNames = getMapNames(productName);
if (mapNames.isEmpty()) {
mapRequired = false;
}
initPreferences();
init();
@ -267,15 +284,47 @@ public class ZoneCombinerComp extends Composite implements
LocalizationType.CAVE_STATIC, LocalizationLevel.BASE);
comboDir = pathMgr.getLocalizationFile(baseCtx,
CombinationsFileUtil.COMBO_DIR_PATH);
comboDir.addFileUpdatedObserver(this);
this.comboChangeListener = new AbstractGFENotificationObserver<CombinationsFileChangedNotification>(
CombinationsFileChangedNotification.class) {
@Override
public void notify(
CombinationsFileChangedNotification notificationMessage) {
comboFileChanged(notificationMessage);
}
};
this.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
comboDir.removeFileUpdatedObserver(ZoneCombinerComp.this);
ZoneCombinerComp.this.dataManager.getNotificationRouter()
.removeObserver(
ZoneCombinerComp.this.comboChangeListener);
}
});
dataManager.getNotificationRouter().addObserver(
this.comboChangeListener);
}
private List<String> getMapNames(String productName) {
Object obj = this.textProductMgr.getMapNameForCombinations(productName);
List<String> mapNames = new ArrayList<String>();
if (obj instanceof String) {
String s = (String) obj;
if (!s.isEmpty()) {
mapNames.add(s);
}
} else if (obj instanceof List<?>) {
@SuppressWarnings("unchecked")
List<String> list = (List<String>) obj;
mapNames.addAll(list);
}
return mapNames;
}
/**
@ -757,9 +806,14 @@ public class ZoneCombinerComp extends Composite implements
}
try {
String comboName = getCombinationsFileName();
CombinationsFileUtil.generateAutoCombinationsFile(
zoneSelector.getZoneGroupings(), getCombinationsFileName()
+ ".py");
zoneSelector.getZoneGroupings(), comboName);
// reload here forces file to be retrieved from server before
// allowing formatter to run
loadCombinationsFile(comboName);
applyButtonState(false);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, "Unable to save "
@ -790,21 +844,9 @@ public class ZoneCombinerComp extends Composite implements
}
Map<String, Integer> comboDict = loadCombinationsFile(comboName);
Object obj = textProductMgr.getMapNameForCombinations(productName);
mapNames = new ArrayList<String>();
if (obj instanceof String) {
String s = (String) obj;
if (!s.isEmpty()) {
mapNames.add(s);
}
} else if (obj instanceof List<?>) {
@SuppressWarnings("unchecked")
List<String> list = (List<String>) obj;
mapNames.addAll(list);
}
boolean singleComboOnly = false;
obj = textProductMgr.getDefinitionValue(productName, "singleComboOnly");
Object obj = textProductMgr.getDefinitionValue(productName,
"singleComboOnly");
if (obj != null) {
if (obj instanceof Integer) {
singleComboOnly = ((Integer) obj) != 0;
@ -915,17 +957,7 @@ public class ZoneCombinerComp extends Composite implements
public Map<String, Integer> loadCombinationsFile(String comboName) {
Map<String, Integer> dict = new HashMap<String, Integer>();
try {
File localFile = PathManagerFactory.getPathManager().getStaticFile(
FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH,
comboName + ".py"));
List<List<String>> combolist = new ArrayList<List<String>>();
if ((localFile != null) && localFile.exists()) {
combolist = CombinationsFileUtil.init(comboName);
} else {
// statusHandler
// .error("Combinations file not found: " + comboName);
}
List<List<String>> combolist = CombinationsFileUtil.init(comboName);
// reformat combinations into combo dictionary
int group = 1;
@ -941,8 +973,7 @@ public class ZoneCombinerComp extends Composite implements
return new HashMap<String, Integer>();
}
currentComboFile = FileUtil.join(CombinationsFileUtil.COMBO_DIR_PATH,
comboName + ".py");
currentComboFile = comboName;
return dict;
}
@ -977,20 +1008,14 @@ public class ZoneCombinerComp extends Composite implements
return colors;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.localization.ILocalizationFileObserver#fileUpdated
* (com.raytheon.uf.common.localization.FileUpdatedMessage)
*/
@Override
public void fileUpdated(FileUpdatedMessage message) {
if (message.getFileName().equalsIgnoreCase(currentComboFile)) {
File file = new File(message.getFileName());
String comboName = file.getName().replace(".py", "");
private void comboFileChanged(CombinationsFileChangedNotification notif) {
String comboName = notif.getCombinationsFileName();
// if it's the same file and not changed by me update the combos
if (comboName.equalsIgnoreCase(currentComboFile)
&& !VizApp.getWsId().equals(notif.getWhoChanged())) {
statusHandler
.info("Received FileUpdatedMessage for combinations file: "
.info("Received CombinationsFileChangedNotification for combinations file: "
+ comboName);
Map<String, Integer> comboDict = loadCombinationsFile(comboName);
this.zoneSelector.updateCombos(comboDict);

View file

@ -59,6 +59,8 @@ import com.raytheon.viz.gfe.rsc.GFEResource;
* Feb 14, 2013 1616 bsteffen Add option for interpolation of colormap
* parameters, disable colormap interpolation
* by default.
* 02/11/2014 #2788 randerso Fixed infinite loop in computeIntervalAndPrecision
* when pmax < pmin
*
* </pre>
*
@ -186,10 +188,10 @@ public class ContinuousColorbar implements IColorBarDisplay {
dstring.font = colorbarResource.getColorbarScaleFont();
dstring.textStyle = TextStyle.NORMAL;
for (int i = 0; (minParm + i * interval) <= maxParm; i++) {
for (int i = 0; (minParm + (i * interval)) <= maxParm; i++) {
// check to see whether this colorTable item needs to be
// rendered
float labelValue = minParm + i * interval;
float labelValue = minParm + (i * interval);
// Check to see if value is same as previous unless float....
if ((tmpValue != (int) labelValue) || (precision > 0)) {
@ -197,7 +199,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
labelValue, precision);
labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent);
+ (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
if (GFEColorbarResource.isLabelWithin(pe.getMinX(),
pe.getMaxX(), labelLoc, 0)) {
@ -219,10 +221,10 @@ public class ContinuousColorbar implements IColorBarDisplay {
labelValue = labelValueObj.floatValue();
if (precision == 0) {
labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent);
+ (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
} else {
labelLoc = llx
+ ((labelValue - minParm) / (maxParm - minParm) * xExtent);
+ (((labelValue - minParm) / (maxParm - minParm)) * xExtent);
}
if (GFEColorbarResource.isLabelWithin(pe.getMinX(),
pe.getMaxX(), labelLoc, 0)) {
@ -246,7 +248,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
float floatValue = ((ScalarWxValue) wxv).getValue();
if ((floatValue >= minParm) && (floatValue <= maxParm)) {
labelLoc = llx
+ ((floatValue - minParm) / (maxParm - minParm) * xExtent);
+ (((floatValue - minParm) / (maxParm - minParm)) * xExtent);
String s = wxv.toString();
dstring.font = colorbarResource.getPickupValueFont();
@ -261,12 +263,11 @@ public class ContinuousColorbar implements IColorBarDisplay {
dstring.shadowColor = new RGB(0, 0, 0);
}
double halfWidth = target.getStringsBounds(dstring).getWidth()
* ratio / 2;
double halfWidth = (target.getStringsBounds(dstring).getWidth() * ratio) / 2;
if (labelLoc - halfWidth < pe.getMinX()) {
if ((labelLoc - halfWidth) < pe.getMinX()) {
labelLoc = pe.getMinX() + halfWidth;
} else if (labelLoc + halfWidth > pe.getMaxX()) {
} else if ((labelLoc + halfWidth) > pe.getMaxX()) {
labelLoc = pe.getMaxX() - halfWidth;
}
dstring.setCoordinates(labelLoc,
@ -298,7 +299,8 @@ public class ContinuousColorbar implements IColorBarDisplay {
// initial values are good if decade < parmExtent
// loop is infinite if parmExtent is NaN or 0, so avoid it
if (decade < parmExtent || Float.isNaN(parmExtent) || parmExtent == 0.0) {
if (Float.isNaN(parmExtent) || (parmExtent <= 0.0)
|| (decade < parmExtent)) {
return new float[] { finterval, precision, labelLength };
}
@ -438,7 +440,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
switch (parm.getGridInfo().getGridType()) {
case SCALAR:
return new ScalarWxValue(min + (max - min) * fractionX, parm);
return new ScalarWxValue(min + ((max - min) * fractionX), parm);
case VECTOR:
WxValue previous = parm.getParmState().getPickUpValue();
float mag = 0.0f;
@ -448,7 +450,7 @@ public class ContinuousColorbar implements IColorBarDisplay {
dir = ((VectorWxValue) previous).getDir();
}
if (mouseButton == 1) {
mag = min + (max - min) * fractionX;
mag = min + ((max - min) * fractionX);
} else if (mouseButton == 2) {
dir = 360 * fractionX;
}

View file

@ -51,6 +51,7 @@ import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SingleTypeJAXBManager;
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.util.FileUtil;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.core.internal.IFPClient;
@ -68,6 +69,8 @@ import com.raytheon.viz.gfe.textformatter.CombinationsFileUtil.ComboData.Entry;
* Sep 05, 2013 #2329 randerso Moved genereateAutoCombinationsFile here
* Cleaned up error handling
* Sep 30, 2013 2361 njensen Use JAXBManager for XML
* Feb 05, 2014 #2591 randerso Forced retrieval of combinations file
* Implemented retry on error
*
* </pre>
*
@ -79,6 +82,8 @@ public class CombinationsFileUtil {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CombinationsFileUtil.class);
private static final int MAX_TRIES = 2;
public static String COMBO_DIR_PATH = FileUtil.join("gfe", "combinations");
public static String SAVED_COMBO_DIR = FileUtil.join("gfe", "comboData");
@ -215,13 +220,20 @@ public class CombinationsFileUtil {
IPathManager pm = PathManagerFactory.getPathManager();
// retrieve combinations file if it's changed
LocalizationFile lf = pm.getStaticLocalizationFile(FileUtil.join(
COMBO_DIR_PATH, comboName + ".py"));
File pyFile;
try {
pyFile = lf.getFile(true);
} catch (LocalizationException e) {
throw new GfeException("Error retrieving combinations file: "
+ comboName, e);
}
LocalizationContext baseContext = pm.getContext(
LocalizationType.CAVE_STATIC, LocalizationLevel.BASE);
// Strip any path components from comboName
File comboFile = new File(comboName);
comboName = comboFile.getName();
String scriptPath = FileUtil.join(
GfePyIncludeUtil.getUtilitiesLF(baseContext).getFile()
.getPath(), "CombinationsInterface.py");
@ -230,21 +242,41 @@ public class CombinationsFileUtil {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("comboName", comboName);
PythonScript python = null;
for (int retryCount = 0; retryCount < MAX_TRIES; retryCount++) {
try {
python = new PythonScript(scriptPath, PyUtil.buildJepIncludePath(
python = new PythonScript(scriptPath,
PyUtil.buildJepIncludePath(
GfePyIncludeUtil.getCombinationsIncludePath(),
GfePyIncludeUtil.getCommonPythonIncludePath()),
CombinationsFileUtil.class.getClassLoader());
Object com = python.execute("getCombinations", map);
combos = (List<List<String>>) com;
// if successfully retrieved break out of the loop
break;
} catch (JepException e) {
// remove the .pyo file
new File(pyFile.getAbsolutePath() + "o").delete();
// if not last try, log and try again
if (retryCount < MAX_TRIES - 1) {
// log but don't pop up
statusHandler.handle(Priority.EVENTB,
"Error loading combinations file: " + comboName
+ ", retrying ", e);
}
// else throw exception
else {
throw new GfeException("Error loading combinations file: "
+ comboName, e);
}
} finally {
if (python != null) {
python.dispose();
}
}
}
return combos;
}

View file

@ -74,6 +74,7 @@ import com.vividsolutions.jts.geom.Envelope;
* ------------ ---------- ----------- --------------------------
* Aug 23, 2011 randerso Initial creation
* May 30, 2013 #2028 randerso Fixed date line issue with map display
* Jan 07, 2014 #2662 randerso Fixed limitZones (subDomainUGCs) support
*
* </pre>
*
@ -158,7 +159,6 @@ public abstract class AbstractZoneSelector extends PaneManager {
return this.zoomLevel;
}
// command to label the zones, calls setMap() to update the display
public void setLabelZones(boolean labelZones) {
if (labelZones == this.labelZones) {
return;
@ -182,7 +182,9 @@ public abstract class AbstractZoneSelector extends PaneManager {
return;
}
this.limitZoneNames = limitZones;
setMapInternal(this.mapRscList);
for (ZoneSelectorResource mapRsc : this.mapRscList) {
mapRsc.setLimitZones(limitZones);
}
}
/*
@ -287,7 +289,7 @@ public abstract class AbstractZoneSelector extends PaneManager {
.retrieveMap(bundlePath).getResourceData();
ZoneSelectorResource rsc = new ZoneSelectorResource(rscData,
new LoadProperties(), gloc);
new LoadProperties(), gloc, this.limitZoneNames);
mapRscList.add(rsc);
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, "Error loading map: "

View file

@ -102,6 +102,7 @@ import com.vividsolutions.jts.io.WKBReader;
* Apr 10, 2013 #1854 randerso Fix for compatibility with PostGIS 2.0
* May 30, 2013 #2028 randerso Fixed date line issue with map display
* Jul 31, 2013 #2239 randerso Fixed scaling of maps that cross the date line
* Jan 07, 2014 #2662 randerso Fixed limitZones (subDomainUGCs) support
* Feb 18, 2014 #2819 randerso Removed unnecessary clones of geometries
*
* </pre>
@ -231,6 +232,7 @@ public class ZoneSelectorResource extends DbMapResource {
int numPoints = 0;
int wfoPoints = 0;
List<String> limitZones = req.rsc.getLimitZones();
WKBReader wkbReader = new WKBReader();
for (int i = 0; i < mappedResult.getResultCount(); i++) {
if (canceled) {
@ -260,6 +262,12 @@ public class ZoneSelectorResource extends DbMapResource {
// TODO: what do we do with this?
// zoneName = "";
}
if (limitZones != null
&& !limitZones.contains(zoneName)) {
continue;
}
String wfo = (String) mappedResult
.getRowColumnValue(i, "wfo");
@ -533,6 +541,8 @@ public class ZoneSelectorResource extends DbMapResource {
private Map<String, ZoneInfo> zoneData;
private List<String> limitZones;
private RGB defaultFillColor;
private RGB outlineColor;
@ -560,9 +570,12 @@ public class ZoneSelectorResource extends DbMapResource {
/**
* @param data
* @param loadProperties
* @param gloc
* @param limitZones
*/
public ZoneSelectorResource(DbMapResourceData data,
LoadProperties loadProperties, GridLocation gloc) {
LoadProperties loadProperties, GridLocation gloc,
List<String> limitZones) {
super(data, loadProperties);
this.zoneData = new HashMap<String, ZoneInfo>();
this.geomFactory = new GeometryFactory();
@ -571,6 +584,7 @@ public class ZoneSelectorResource extends DbMapResource {
this.outlineColor = RGBColors.getRGBColor("white");
this.wfoOutlineColor = RGBColors.getRGBColor("yellow");
this.gloc = gloc;
this.limitZones = limitZones;
GeneralEnvelope env = new GeneralEnvelope(MapUtil.LATLON_PROJECTION);
env.setEnvelope(-180.0, -90.0, 180.0, 90.0);
@ -849,13 +863,10 @@ public class ZoneSelectorResource extends DbMapResource {
query.append(geometryField);
// add any additional columns
List<String> additionalColumns = new ArrayList<String>();
if (resourceData.getColumns() != null) {
for (ColumnDefinition column : resourceData.getColumns()) {
query.append(", ");
query.append(column);
additionalColumns.add(column.getName());
}
}
@ -916,6 +927,22 @@ public class ZoneSelectorResource extends DbMapResource {
return newShadedShape;
}
/**
* @return the limitZones
*/
public List<String> getLimitZones() {
return limitZones;
}
/**
* @param limitZones
* the limitZones to set
*/
public void setLimitZones(List<String> limitZones) {
this.limitZones = limitZones;
issueRefresh();
}
/**
* @param labelZones
*/
@ -1024,6 +1051,16 @@ public class ZoneSelectorResource extends DbMapResource {
query.append(resourceData.getGeomField());
query.append(")) as extent");
// add editarea column
if (resourceData.getColumns() != null) {
for (ColumnDefinition column : resourceData.getColumns()) {
if (column.getName().equalsIgnoreCase("editarea")) {
query.append(", ");
query.append(column);
}
}
}
// add the geometry table
query.append(" FROM ");
query.append(resourceData.getTable());
@ -1048,6 +1085,14 @@ public class ZoneSelectorResource extends DbMapResource {
WKBReader wkbReader = new WKBReader();
for (int i = 0; i < mappedResult.getResultCount(); i++) {
String zoneName = (String) mappedResult.getRowColumnValue(
i, "editarea");
if (this.limitZones != null
&& !this.limitZones.contains(zoneName)) {
continue;
}
byte[] b = (byte[]) mappedResult.getRowColumnValue(i,
"extent");
if (b != null) {

View file

@ -22,6 +22,8 @@ package com.raytheon.viz.gfe.vtec;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
@ -60,6 +62,7 @@ import com.raytheon.viz.texteditor.util.VtecUtil;
* phensig but disjoint TimeRanges.
* Dec 18, 2013 #2641 dgilling Force ordering of items returned by
* getVtecLinesThatNeedEtn().
* Feb 05, 2014 #2774 dgilling Additional correction to previous fix.
*
* </pre>
*
@ -78,6 +81,24 @@ public class GFEVtecUtil {
public static final Collection<String> IGNORE_NATIONAL_ETN = ImmutableSet
.copyOf(GFEVtecConfig.getInstance().getSitesIgnoreNationalEtn());
private static final Comparator<VtecObject> VTEC_COMPARATOR = new Comparator<VtecObject>() {
@Override
public int compare(VtecObject vtec1, VtecObject vtec2) {
TimeRange tr1 = new TimeRange(vtec1.getStartTime(),
vtec1.getEndTime());
TimeRange tr2 = new TimeRange(vtec2.getStartTime(),
vtec2.getEndTime());
int retVal = tr1.getStart().compareTo(tr2.getStart());
if (retVal == 0) {
retVal = tr1.getEnd().compareTo(tr2.getEnd());
}
return retVal;
}
};
/**
* A private constructor so that Java does not attempt to create one for us.
* As this class should not be instantiated, do not attempt to ever call
@ -194,12 +215,12 @@ public class GFEVtecUtil {
* @return A <code>Set</code> of <code>VtecObject</code>s that need to have
* a new ETN assigned to them.
*/
public static List<VtecObject> getVtecLinesThatNeedEtn(String product) {
public static Map<String, List<VtecObject>> initETNCache(String product) {
if (StringUtil.isEmptyString(product)) {
return Collections.emptyList();
return Collections.emptyMap();
}
List<VtecObject> phensigs = new ArrayList<VtecObject>();
Map<String, List<VtecObject>> cache = new HashMap<String, List<VtecObject>>();
Matcher vtecMatcher = VtecUtil.VTEC_REGEX.matcher(product);
while (vtecMatcher.find()) {
@ -208,11 +229,24 @@ public class GFEVtecUtil {
&& ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN
.contains(vtec.getOffice()) && TROPICAL_PHENSIGS
.contains(vtec.getPhensig())))) {
phensigs.add(vtec);
List<VtecObject> vtecsForPhensig = cache.get(vtec.getPhensig());
if (vtecsForPhensig == null) {
vtecsForPhensig = new ArrayList<VtecObject>();
}
vtec.setSequence(0);
vtecsForPhensig.add(vtec);
cache.put(vtec.getPhensig(), vtecsForPhensig);
}
}
return phensigs;
for (String phensig : cache.keySet()) {
List<VtecObject> vtecsByTimeOrder = new ArrayList<VtecObject>(
cache.get(phensig));
Collections.sort(vtecsByTimeOrder, VTEC_COMPARATOR);
cache.put(phensig, vtecsByTimeOrder);
}
return cache;
}
/**
@ -244,46 +278,12 @@ public class GFEVtecUtil {
&& ((!NATIONAL_PHENSIGS.contains(vtec.getPhensig())) || (IGNORE_NATIONAL_ETN
.contains(vtec.getOffice()) && TROPICAL_PHENSIGS
.contains(vtec.getPhensig())))) {
// With GFE VTEC products, it's possible to have multiple
// segments with
// NEW vtec action codes and the same phensig. For this reason,
// HazardsTable.py implemented a "cache" that would ensure all
// NEWs for
// the same phensig would be assigned the same ETN. This Map
// replicates
// that legacy behavior.
//
// This "cache" has two levels:
// 1. The first level is keyed by the hazard's phensig.
// 2. The second level is keyed by the valid period of the
// hazard.
// Effectively, making this a Map<Phensig, Map<ValidPeriod,
// ETN>>.
// Some more clarification on the ETN assignment behavior: all
// NEW VTEC lines with the same phensig should be assigned the
// same ETN if the hazards' valid periods are adjacent or
// overlapping.
// If there's a discontinuity in TimeRanges we increment to the
// next ETN.
Integer newEtn = null;
String cacheKey = vtec.getPhensig();
String phensig = vtec.getPhensig();
TimeRange validPeriod = new TimeRange(vtec.getStartTime()
.getTime(), vtec.getEndTime().getTime());
Map<TimeRange, Integer> etnsByTR = etnCache.get(cacheKey);
if (etnsByTR != null) {
newEtn = etnsByTR.get(validPeriod);
for (TimeRange tr : etnsByTR.keySet()) {
if ((validPeriod.isAdjacentTo(tr))
|| (validPeriod.overlaps(tr))) {
vtec.setSequence(newEtn);
break;
}
}
}
Integer newEtn = etnCache.get(phensig).get(validPeriod);
vtec.setSequence(newEtn);
}
vtecMatcher
.appendReplacement(
finalOutput,
@ -293,4 +293,4 @@ public class GFEVtecUtil {
vtecMatcher.appendTail(finalOutput);
return finalOutput.toString();
}
}
}

View file

@ -21,7 +21,10 @@ package com.raytheon.viz.grid.rsc;
import java.util.Map;
import javax.measure.converter.UnitConverter;
import com.raytheon.uf.common.colormap.prefs.ColorMapParameters;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences;
import com.raytheon.uf.common.colormap.prefs.DataMappingPreferences.DataMappingEntry;
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.viz.core.exception.VizException;
@ -39,9 +42,11 @@ import com.raytheon.viz.grid.rsc.general.GeneralGridData;
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 13, 2010 bsteffen Initial creation
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Oct 13, 2010 bsteffen Initial creation
* Feb 07, 2014 2211 bsteffen Fix sampling
*
*
* </pre>
*
@ -71,29 +76,36 @@ public class DataMappedGridResource extends D2DGridResource {
if (map == null) {
return "NO DATA";
}
Double val = ((Float) map.get(INTERROGATE_VALUE)).doubleValue();
Double val = ((Number) map.get(INTERROGATE_VALUE)).doubleValue();
if (val.isNaN() || val <= -9999) {
return "No Data";
}
ColorMapParameters params = getCapability(ColorMapCapability.class)
.getColorMapParameters();
if (params != null) {
UnitConverter d2cm = params.getDisplayToColorMapConverter();
if (d2cm != null) {
val = d2cm.convert(val);
}
val = params.getDisplayToImageConverter().convert(val);
DataMappingPreferences dataMapping = params.getDataMapping();
if (dataMapping != null) {
for (DataMappingEntry entry : dataMapping.getEntries()) {
double pixelValue = entry.getPixelValue();
double relError = Math.abs((pixelValue - val) / val);
String text = entry.getLabel();
if (relError < 0.00001 && text != null) {
return text;
}
}
}
for (DataMappingEntry entry : params.getDataMapping().getEntries()) {
double pixelValue = entry.getPixelValue();
double relError = Math.abs((pixelValue - val) / val);
String text = entry.getLabel();
if (relError < 0.00001 && text != null) {
return text;
UnitConverter cm2d = params.getColorMapToDisplayConverter();
if (cm2d != null) {
val = cm2d.convert(val);
}
}
if (params != null && params.getImageToDisplayConverter() != null) {
val = params.getImageToDisplayConverter().convert(val);
}
return ((DataMappedGridResourceData) this.getResourceData())
.getSampleFormat().format(val) + map.get(INTERROGATE_UNIT);
}

View file

@ -39,9 +39,10 @@ import com.raytheon.viz.grid.rsc.general.GeneralGridData;
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 16, 2009 mnash Initial creation
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Dec 16, 2009 mnash Initial creation
* Feb 07, 2014 2211 bsteffen Fix sampling
*
* </pre>
*
@ -71,7 +72,7 @@ public class RcmResource extends D2DGridResource {
if (map == null) {
return "NO DATA";
}
float val = (Float) map.get(INTERROGATE_VALUE);
float val = ((Number) map.get(INTERROGATE_VALUE)).floatValue();
String sampleVal = "";
if (val < 1f) {
sampleVal = "No Data";

View file

@ -57,7 +57,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* ------------- -------- ----------- -----------------------------------------
* Mar 09, 2011 bsteffen Initial creation
* Jul 17, 2013 2185 bsteffen Cache computed grid reprojections.
* Aug 27, 2013 2287 randerso Removed 180 degree adjustment required by
@ -68,6 +68,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jan 14, 2014 2661 bsteffen For vectors only keep uComponent and
* vComponent, calculate magnitude and
* direction on demand.
* Feb 03, 2013 2764 bsteffen Ensure that internal buffers are array
* backed heap buffers.
*
* </pre>
*
@ -162,8 +164,17 @@ public class GeneralGridData {
private GeneralGridData(GeneralGridGeometry gridGeometry,
FloatBuffer scalarData, Unit<?> dataUnit) {
this.gridGeometry = GridGeometry2D.wrap(gridGeometry);
if (scalarData != null && !scalarData.hasArray()) {
/*
* TODO refactor dispaly code so it doesn't need array instead of
* copying data.
*/
FloatBuffer copy = FloatBuffer.allocate(scalarData.capacity());
scalarData.rewind();
copy.put(scalarData);
scalarData = copy;
}
this.scalarData = new FloatBufferWrapper(scalarData, this.gridGeometry);
;
this.dataUnit = dataUnit;
}

View file

@ -34,6 +34,7 @@ import com.raytheon.viz.hydrocommon.data.GageData.ThreatIndex;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 21, 2008 mpduff Initial creation
* Feb 03, 2014 16843 lbousaidi add a check for index OutOfBoundsException
*
* </pre>
*
@ -101,8 +102,9 @@ public class PDCFindBasis {
} else {
currentLid = fcstReportList.get(fcstIndex).getLid();
}
} else if (obsReportList.get(obsIndex) != null) {
currentLid = obsReportList.get(obsIndex).getLid();
} else if ((obsIndex< obsReportList.size()) && (obsReportList
.get(obsIndex) != null)) {
currentLid = obsReportList.get(obsIndex).getLid();
} else {
currentLid = fcstReportList.get(fcstIndex).getLid();
}

View file

@ -138,8 +138,9 @@ import com.raytheon.viz.hydrocommon.util.DbUtils;
* 16 Jan 2013 15695 wkwock Fix popup menu
* 24 Apr 2013 1921 mpduff Fix zoom reset to only reset the "active" graph
* 06 May 2013 1976 mpduff Refactored Hydro time series data access.
* 29 May 2013 2016 mpduff Fix TS Toggle Traces.
* 29 May 2013 2016 mpduff Fix TS Toggle Traces.
* 05 Sep 2013 #2332 lvenable Fixed memory leaks.
* 24 Jan 2013 15959 lbousaidi Swap the corner points of the bounding box when zooming.
* @author lvenable
* @version 1.0
*
@ -1241,7 +1242,13 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
}
Date xMin = pixel2x(gd, rubberBandX1 - GRAPHBORDER_LEFT);
Date xMax = pixel2x(gd, rubberBandX2 - GRAPHBORDER_LEFT);
//Swap the corner points of the bounding box when zooming
if (xMin.after(xMax)) {
Date xtmp;
xtmp= xMin;
xMin=xMax;
xMax=xtmp;
}
gd.setXMin(xMin);
gd.setXMax(xMax);
gd.setX(gd.getXMax().getTime() - gd.getXMin().getTime());
@ -1256,7 +1263,13 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements
if (ymin < gd.getYmin()) {
ymin = gd.getYmin();
}
//Swap the corner points of the bounding box when zooming
if (ymin > ymax) {
double ytmp;
ytmp= ymin;
ymin=ymax;
ymax=ytmp;
}
gd.setYmin(ymin);
gd.setYmax(ymax);
gd.setY2(gd.getYmax2() - gd.getYmin2());

View file

@ -36,6 +36,9 @@
<mapping key="pluginName">
<constraint constraintValue="binlightning" constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>

View file

@ -38,6 +38,9 @@
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
@ -55,10 +58,13 @@
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>
</bundle>

View file

@ -36,6 +36,9 @@
<mapping key="pluginName">
<constraint constraintValue="binlightning" constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>

View file

@ -36,6 +36,9 @@
<mapping key="pluginName">
<constraint constraintValue="binlightning" constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>

View file

@ -43,6 +43,9 @@
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
@ -66,6 +69,9 @@
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
@ -89,6 +95,9 @@
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
@ -112,6 +121,9 @@
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
@ -135,6 +147,9 @@
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
@ -158,10 +173,13 @@
<constraint constraintValue="binlightning"
constraintType="EQUALS" />
</mapping>
<mapping key="lightSource">
<constraint constraintValue="${lightSource}" constraintType="EQUALS" />
</mapping>
</metadataMap>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>
</bundle>

View 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.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/LightningPlot60Min.xml"
menuText="1hr CG stroke plot" id="1HrLightningStrokePlot"
productInterval="3600">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot15Min.xml"
menuText="15min CG stroke plot" id="15MinLightningStrokePlot"
productInterval="900">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot15MinPN.xml"
menuText="15min Pos/Neg CG stroke plot" id="15MinPNLightningStrokePlot"
productInterval="900">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot5Min.xml"
menuText="5min CG stroke plot" id="5MinLightningStrokePlot"
productInterval="300">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningSeq.xml"
menuText="1min Lgtng Seq CG stroke" id="1MinLightningStrokeSeq">
<dataURI>/binlightning/%</dataURI>
</contribute>
</menuTemplate>

View file

@ -20,6 +20,6 @@
-->
<menuContributionFile>
<include installTo="menu:obs?after=LIGHTNINGPLACEHOLDER"
fileName="menus/lightning/baseLightning.xml"
fileName="menus/lightning/lightningMenuItems.xml"
subMenu="Lightning"/>
</menuContributionFile>

View file

@ -0,0 +1,32 @@
<?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.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="subMenu" menuText="NLDN" id="NLDNSubMenu">
<contribute xsi:type="subinclude" fileName="menus/lightning/nldnLightningBundleItems.xml">
<substitute key="lightSource" value="NLDN"/>
</contribute>
</contribute>
<contribute xsi:type="subMenu" menuText="GLD" id="GLDSubMenu">
<contribute xsi:type="subinclude" fileName="menus/lightning/gldLightningBundleItems.xml">
<substitute key="lightSource" value="GLD"/>
</contribute>
</contribute>
</menuTemplate>

View 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.
-->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="bundleItem" file="bundles/LightningPlot60Min.xml"
menuText="1hr CG flash plot" id="1HrLightningFlashPlot"
productInterval="3600">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot15Min.xml"
menuText="15min CG flash plot" id="15MinLightningFlashPlot"
productInterval="900">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot15MinPN.xml"
menuText="15min Pos/Neg CG flash plot" id="15MinPNLightningFlashPlot"
productInterval="900">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningPlot5Min.xml"
menuText="5min CG flash plot" id="5MinLightningFlashPlot"
productInterval="300">
<dataURI>/binlightning/%</dataURI>
</contribute>
<contribute xsi:type="bundleItem" file="bundles/LightningSeq.xml"
menuText="1min Lgtng Seq CG flash" id="1MinLightningFlashSeq">
<dataURI>/binlightning/%</dataURI>
</contribute>
</menuTemplate>

View file

@ -38,7 +38,8 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Station;
* ------------ ---------- ----------- --------------------------
* Mar 11, 2009 snaples Initial creation
* May 02, 2011 8962 snaples Added render24hrPcpUsingFour6hr() method
*
* Jan 10, 2014 16976 cgobs Fixed issue on line 153.
* Changed pcp.value[row][col] to pcp.value[col][row]
* </pre>
*
* @author snaples
@ -149,7 +150,7 @@ public class RenderPcp {
for (int col = 0; col < hrap_grid.maxi; col++) {
for (int row = 0; row < hrap_grid.maxj; row++) {
value = pcp.value[row][col];
value = pcp.value[col][row];
if (value > maxValue) {
maxValue = value;

View file

@ -38,7 +38,8 @@ import com.raytheon.viz.mpe.util.DailyQcUtils.Station;
* ------------ ---------- ----------- --------------------------
* Mar 11, 2009 snaples Initial creation
* May 02, 2011 8962 snaples Added render24hrPcpUsingFour6hr() method
*
* Jan 10, 2014 16976 cgobs Fixed issue on line 290.
* Changed pcp.value[row][col] to pcp.value[col][row]
* </pre>
*
* @author snaples
@ -286,7 +287,7 @@ public class RenderPcpBlocking {
* not estimate precipitation for it.
*/
if (hrap_grid.owner[col][row] == -1) {
pcp.value[row][col] = 0;
pcp.value[col][row] = 0;
continue;
}
@ -308,7 +309,7 @@ public class RenderPcpBlocking {
resultingPrecipValue = 0.0;
}
// pcp.value[row][col] is the value of grid,
// pcp.value[col][row] is the value of grid,
// so we don't need to estimate a value for [row][col]
}

View file

@ -31,6 +31,7 @@ import org.eclipse.swt.printing.PrinterData;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.VizApp;
/**
* Common class for handling printing of text.
@ -45,13 +46,14 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* Text is printed using same font as the GUI
* Dec 31, 2012 15651 M Gamazaychikov Added setFont method to scale font for printing
* Sep 30, 2013 #2420 lvenable Fixed memory leak in the setFont method.
* Feb 12, 2014 #2773 lvenable Added code to provide a workaround to an Eclipse/SWT bug
* that occurs when disposing of the printer.
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class PrintDisplay {
public static void print(final String printedText, final FontData fontData,
IUFStatusHandler statusHandler) {
@ -108,19 +110,46 @@ public class PrintDisplay {
int end;
/**
* Constructor
*
* @param printer
* Printer object.
* @param text
* Text to print.
* @param fontData
* Font information.
*/
private PrintDisplay(Printer printer, String text, FontData fontData) {
this.printer = printer;
this.textToPrint = text;
this.printerFontData = fontData;
}
/**
* Print thread that will print the information to the printer.
*/
private void printJob() {
Thread thread = new Thread("Printing") {
public void run() {
printIt();
/** Dispose of the resources. */
printer.dispose();
/*
* Dispose of the printer resource. Running the dispose on the
* UI Thread should prevent the Eclipse/SWT bug from occurring.
*
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=259371
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=276438
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=265028
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=265265
*/
VizApp.runAsync(new Runnable() {
@Override
public void run() {
printer.dispose();
}
});
if (tmpFont != null && tmpFont.isDisposed() == false) {
tmpFont.dispose();
@ -130,9 +159,12 @@ public class PrintDisplay {
thread.start();
}
protected void setFont() {
/**
* Set the font using the fontData.
*/
private void setFont() {
/*
* get the max number of characters in a line of text and add a length
* Get the max number of characters in a line of text and add a length
* of tab
*/
String[] textLines = textToPrint.split("[\n]");
@ -197,6 +229,9 @@ public class PrintDisplay {
gc.setFont(tmpFont);
}
/**
* Print to the printer.
*/
private void printIt() {
if (printer.startJob("Text")) { // the string is the job name - shows up
// in the printer's job list
@ -245,6 +280,9 @@ public class PrintDisplay {
}
}
/**
* Print the text.
*/
private void printText() {
printer.startPage();
wordBuffer = new StringBuilder();
@ -281,6 +319,9 @@ public class PrintDisplay {
}
}
/**
* Print the work buffer.
*/
private void printWordBuffer() {
if (wordBuffer.length() > 0) {
String word = wordBuffer.toString();
@ -295,6 +336,9 @@ public class PrintDisplay {
}
}
/**
* Start a new line for printing.
*/
private void newline() {
x = leftMargin;
y += lineHeight;

View file

@ -34,6 +34,7 @@ import java.util.regex.Pattern;
* ------------ ---------- ----------- --------------------------
* Oct 14, 2009 bwoodle Initial creation
* May 08, 2013 #1842 dgilling Add getPhensig() method.
* Feb 17, 2014 #2774 dgilling Added toString() for debugging
*
* </pre>
*
@ -315,6 +316,11 @@ public class VtecObject {
VtecUtil.formatVtecTime(this.endTime));
}
@Override
public String toString() {
return generateVtec();
}
/*
* (non-Javadoc)
*/

View file

@ -34,6 +34,9 @@ import org.opengis.metadata.spatial.PixelOrientation;
import org.opengis.referencing.operation.MathTransform;
import com.raytheon.uf.common.dataplugin.warning.util.GeometryUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.contours.util.ContourContainer;
@ -76,6 +79,7 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
* 10/01/2013 DR 16632 Qinglu Lin Fixed the bug in for loop range.
* 10/17/2013 DR 16632 Qinglu Lin Updated removeOverlaidLinesegments().
* 10/18/2013 DR 16632 Qinglu Lin Catch exception thrown when coords length is less than 4 and doing createLinearRing(coords).
* 01/09/2014 DR 16974 D. Friedman Improve followup redraw-from-hatched-area polygons.
* </pre>
*
* @author mschenke
@ -83,6 +87,8 @@ import com.vividsolutions.jts.geom.prep.PreparedGeometryFactory;
*/
public class PolygonUtil {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PolygonUtil.class);
private WarngenLayer layer;
@ -114,6 +120,39 @@ public class PolygonUtil {
Geometry origWarningArea, Polygon oldWarningPolygon) throws VizException {
float[][] contourAreaData = toFloatData(origWarningArea);
/* If we have an oldWarningPolygon, we can take a shortcut and see
* if the intersection of the current polygon and the old polygon
* generates the same input to the contouring algorithm as the current
* hatched area. If it does, that intersection can be used instead of
* generating a new contour.
*/
if (oldWarningPolygon != null) {
try {
Geometry intersection = origPolygon.intersection(oldWarningPolygon);
if (intersection instanceof Polygon) {
Polygon polygonIntersection = (Polygon) intersection;
if (polygonIntersection.isValid() &&
polygonIntersection.getNumInteriorRing() == 0 &&
polygonIntersection.getNumPoints() - 1 <= maxVertices) {
/*
* Use buildIdealArea to clip the current polygon against the old
* polygon (actually oldWarningArea) and the CWA, using the same
* coordinate transformations that are used to generate
* origWarningArea.
*/
Geometry comparableIntersection = layer.buildIdealArea(origPolygon);
float[][] interAreaData = toFloatData(comparableIntersection);
if (areasEqual(interAreaData, contourAreaData)) {
return polygonIntersection;
}
}
}
} catch (RuntimeException e) {
statusHandler.handle(Priority.WARN,
"Error while using simple polygon redraw method. Will continue using contouring method.", e);
}
}
// Create contouring configuration
FortConConfig config = new FortConConfig();
config.generateMaxes = false;

View file

@ -195,6 +195,7 @@ import com.vividsolutions.jts.io.WKTReader;
* Use A1 hatching behavior when no county passes the inclusion filter.
* 10/29/2013 DR 16734 D. Friedman If redraw-from-hatched-area fails, don't allow the pollygon the be used.
* 12/04/2013 2604 jsanchez Refactored GisUtil.
* 01/09/2014 DR 16974 D. Friedman Improve followup redraw-from-hatched-area polygons.
* 02/19/2014 2819 randerso Removed unnecessary .clone() call
* </pre>
*
@ -2963,41 +2964,11 @@ public class WarngenLayer extends AbstractStormTrackResource {
state.snappedToArea = false;
if (areaHatcher != null) {
Polygon polygon = state.getWarningPolygon();
polygon = tryToIntersectWithOriginalPolygon(polygon);
areaHatcher.hatchArea(polygon, state.getWarningArea(),
state.getOldWarningPolygon());
}
}
/**
* Try to determine the intersection of the given polygon with the original
* warning polygon. If there is no original polygon, if the result of the
* intersection is not a single polygon, or if a problem occurs, just return
* the original polygon. The purpose of this is to pass the polygon that
* best represents the user's intent to the polygon redrawing algorithm.
*/
private Polygon tryToIntersectWithOriginalPolygon(Polygon polygon) {
if (state.getOldWarningPolygon() != null) {
try {
Geometry g = polygon.intersection(state.getOldWarningPolygon());
Polygon newPolygon = null;
if (g instanceof Polygon) {
newPolygon = (Polygon) g;
} else if ((g instanceof GeometryCollection)
&& (g.getNumGeometries() == 1)
&& (g.getGeometryN(0) instanceof Polygon)) {
newPolygon = (Polygon) g.getGeometryN(0);
}
if ((newPolygon != null) && newPolygon.isValid()) {
polygon = newPolygon;
}
} catch (TopologyException e) {
// ignore
}
}
return polygon;
}
private Collection<GeospatialData> getDataWithFips(String fips) {
List<GeospatialData> data = new ArrayList<GeospatialData>();
for (GeospatialData d : geoData.features) {
@ -3283,4 +3254,40 @@ public class WarngenLayer extends AbstractStormTrackResource {
}
}
}
/**
* Like buildArea, but does not take inclusion filters into account. Also
* returns a Geometry in lat/lon space.
* @param inputArea
* @return
*/
public Geometry buildIdealArea(Geometry inputArea) {
Geometry localHatchedArea = latLonToLocal(inputArea);
Geometry oldWarningArea = latLonToLocal(state.getOldWarningArea());
Geometry newHatchedArea = null;
for (GeospatialData f : geoData.features) {
// get the geometry of the county and make sure it intersects
// with our hatched area
PreparedGeometry prepGeom = (PreparedGeometry) f.attributes
.get(GeospatialDataList.LOCAL_PREP_GEOM);
Geometry intersection = null;
try {
// Get intersection between county and hatched boundary
intersection = GeometryUtil.intersection(localHatchedArea, prepGeom);
if (oldWarningArea != null) {
intersection = GeometryUtil.intersection(intersection,
oldWarningArea);
}
} catch (RuntimeException e) {
continue;
// This is a workaround for JTS 1.7.1
}
newHatchedArea = union(newHatchedArea, intersection);
}
Geometry result = newHatchedArea != null ? newHatchedArea : new GeometryFactory()
.createGeometryCollection(new Geometry[0]);
return localToLatLon(result);
}
}

View file

@ -1,5 +1,8 @@
### EDEX localization related variables ###
export AW_SITE_IDENTIFIER=OAX
## Cluster id can be set to the cluster's id (example:tbw for dx1-tbwo)
## it will be autogenerated if not set
export CLUSTER_ID
# database names
export DC_DB_NAME=dc_ob7oax

View file

@ -164,6 +164,18 @@
<pattern>%-5p %d [%t] %c{0}: %m%n</pattern>
</encoder>
</appender>
<!-- ohd log -->
<appender name="OhdLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${edex.home}/logs/edex-${edex.run.mode}-ohd-%d{yyyyMMdd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%-5p %d [%t] %c{0}: %m%n</pattern>
</encoder>
</appender>
<appender name="ThreadBasedLog" class="com.raytheon.uf.common.status.logback.ThreadBasedAppender">
<threadPatterns>RadarLog:radarThreadPool.*;SatelliteLog:satelliteThreadPool.*;ShefLog:shefThreadPool.*;TextLog:textThreadPool.*;SmartInitLog:smartInit.*;PurgeLog:Purge.*;ArchiveLog:Archive.*</threadPatterns>
@ -300,6 +312,12 @@
<level value="ERROR"/>
<appender-ref ref="FailedTriggerLog"/>
</logger>
<logger name="com.raytheon.uf.edex.ohd" additivity="false">
<level value="INFO"/>
<appender-ref ref="OhdLog" />
<appender-ref ref="console" />
</logger>
<!-- default logging -->
<root>

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