Merge branch 'omaha_16.2.1' into asdt_16.2.1

Former-commit-id: 6d1b5f63867542721ed6241011250fe39a4c4b94
This commit is contained in:
Penghai.Wang 2015-10-20 17:42:04 +00:00
commit e3f4d27d0e
255 changed files with 12573 additions and 10748 deletions

View file

@ -100,6 +100,16 @@ export ALLOW_ARCHIVE_DATA="false"
# setup environment for HPE # setup environment for HPE
export AMQP_SPEC=$awips_home/python/share/amqp/amqp.0-10.xml export AMQP_SPEC=$awips_home/python/share/amqp/amqp.0-10.xml
# get total memory on system in bytes
MEM_IN_MEG=( `free -m | grep "Mem:"` )
export MEM_IN_MEG=${MEM_IN_MEG[1]}
HIGH_MEM=off
if [ $MEM_IN_MEG -gt 12288 ]; then
HIGH_MEM=on
fi
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
#read and interpret the command line arguments #read and interpret the command line arguments
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -112,9 +122,10 @@ RUN_MODE=
for arg in $@ for arg in $@
do do
case $arg in case $arg in
-b|-d|--debug|-db|-bd) DEBUG_FLAG=on;; -b|-d|-debug|-db|-bd) DEBUG_FLAG=on;;
-p|--profiler) PROFILE_FLAG=on;; -p|-profiler) PROFILE_FLAG=on;;
-h|--highmem) ;; # does nothing, only here to prevent issues if someone still uses -h -h|-highmem) HIGH_MEM=on;;
-noHighmem) HIGH_MEM=off;;
-noConsole) CONSOLE_FLAG=off;; -noConsole) CONSOLE_FLAG=off;;
*) RUN_MODE=$arg;; *) RUN_MODE=$arg;;
esac esac
@ -123,11 +134,13 @@ done
export EDEX_RUN_MODE=$RUN_MODE export EDEX_RUN_MODE=$RUN_MODE
if [ $CONSOLE_FLAG == "off" ]; then if [ $CONSOLE_FLAG == "off" ]; then
CONSOLE_LOGLEVEL=NONE CONSOLE_LOGLEVEL=NONE
fi fi
export CONSOLE_LOGLEVEL export CONSOLE_LOGLEVEL
# source environment files # source environment files
. $EDEX_HOME/etc/default.sh . $EDEX_HOME/etc/default.sh

View file

@ -158,7 +158,7 @@ wrapper.app.parameter.2=start
wrapper.ping.timeout=30 wrapper.ping.timeout=30
# NOTE: script must be located at /awips2/qpid/bin/yajsw/scripts for it to be found # NOTE: script must be located at /awips2/yajsw/scripts for it to be found
wrapper.script.ABORT=wrapperCapture.sh wrapper.script.ABORT=wrapperCapture.sh
wrapper.script.ABORT.timeout=120 wrapper.script.ABORT.timeout=120
wrapper.script.RESTART=wrapperCapture.sh wrapper.script.RESTART=wrapperCapture.sh
@ -186,7 +186,7 @@ wrapper.on_exit.default=${WRAPPER_ON_EXIT_ACTION}
wrapper.filter.trigger.oom=java.lang.OutOfMemoryError wrapper.filter.trigger.oom=java.lang.OutOfMemoryError
wrapper.filter.action.oom=${WRAPPER_TRIGGER_ACTION} wrapper.filter.action.oom=${WRAPPER_TRIGGER_ACTION}
#********************************************************************fil #********************************************************************
# Wrapper Logging Properties # Wrapper Logging Properties
#******************************************************************** #********************************************************************
# Format of output for the console. (See docs for formats) # Format of output for the console. (See docs for formats)

View file

@ -20,6 +20,11 @@
## ##
export MAX_MEM=2048 # in Meg export MAX_MEM=2048 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=3072
fi
export MAX_PERM_SIZE=192m export MAX_PERM_SIZE=192m
export EDEX_DEBUG_PORT=5011 export EDEX_DEBUG_PORT=5011
export EDEX_JMX_PORT=1622 export EDEX_JMX_PORT=1622

View file

@ -19,9 +19,12 @@
# further licensing information. # further licensing information.
## ##
export INIT_MEM=512 # in Meg
export MAX_MEM=1536 # in Meg export MAX_MEM=1536 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=2048
fi
export EDEX_DEBUG_PORT=5009 export EDEX_DEBUG_PORT=5009
export EDEX_JMX_PORT=1620 export EDEX_JMX_PORT=1620
export LOG_CONF=logback-registry.xml export LOG_CONF=logback-registry.xml

View file

@ -19,7 +19,6 @@
# further licensing information. # further licensing information.
## ##
export INIT_MEM=512 # in Meg
export MAX_MEM=1536 # in Meg export MAX_MEM=1536 # in Meg
export MAX_PERM_SIZE=192m export MAX_PERM_SIZE=192m
export EDEX_DEBUG_PORT=5010 export EDEX_DEBUG_PORT=5010

View file

@ -20,6 +20,11 @@
## ##
export INIT_MEM=512 # in Meg export INIT_MEM=512 # in Meg
export MAX_MEM=1300 # in Meg export MAX_MEM=1300 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=2560
fi
export MAX_PERM_SIZE=128m export MAX_PERM_SIZE=128m
export EDEX_JMX_PORT=1616 export EDEX_JMX_PORT=1616
export EDEX_DEBUG_PORT=5005 export EDEX_DEBUG_PORT=5005

View file

@ -20,6 +20,11 @@
## ##
export MAX_MEM=1536 # in Meg export MAX_MEM=1536 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=2048
fi
export MAX_PERM_SIZE=192m export MAX_PERM_SIZE=192m
export EDEX_DEBUG_PORT=5012 export EDEX_DEBUG_PORT=5012
export EDEX_JMX_PORT=1620 export EDEX_JMX_PORT=1620
@ -29,4 +34,4 @@ export MGMT_PORT=9605
export METADATA_POOL_MAX=20 export METADATA_POOL_MAX=20
export METADATA_POOL_TIMEOUT=60 export METADATA_POOL_TIMEOUT=60
export SOFT_REF_LRU_POLICY_MS_PER_MB=50 export SOFT_REF_LRU_POLICY_MS_PER_MB=50

View file

@ -19,9 +19,12 @@
# further licensing information. # further licensing information.
## ##
export INIT_MEM=512 # in Meg
export MAX_MEM=1280 # in Meg export MAX_MEM=1280 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=2560
fi
export EDEX_DEBUG_PORT=5006 export EDEX_DEBUG_PORT=5006
export EDEX_JMX_PORT=1617 export EDEX_JMX_PORT=1617
export LOG_CONF=logback-ingest.xml export LOG_CONF=logback-ingest.xml

View file

@ -18,9 +18,12 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
export INIT_MEM=256 # in Meg
export MAX_MEM=1856 # in Meg export MAX_MEM=1856 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=2560
fi
export METADATA_POOL_MAX=25 export METADATA_POOL_MAX=25
export EDEX_DEBUG_PORT=5008 export EDEX_DEBUG_PORT=5008
export EDEX_JMX_PORT=1619 export EDEX_JMX_PORT=1619

View file

@ -32,6 +32,7 @@ fi
let "MAX_MEM = GRIB_DECODE_THREADS * 128" # in Meg let "MAX_MEM = GRIB_DECODE_THREADS * 128" # in Meg
let "GRIB_MAX_GRID_POINTS = GRIB_DECODE_THREADS * 25000000" let "GRIB_MAX_GRID_POINTS = GRIB_DECODE_THREADS * 25000000"
let "GRID_PERSIST_THREADS = GRIB_DECODE_THREADS / 2" let "GRID_PERSIST_THREADS = GRIB_DECODE_THREADS / 2"
let "GRID_POSTPROCESS_THREADS = 1"
let "GRID_MAX_PERSIST_MEMORY_IN_MB = GRID_PERSIST_THREADS * 50" let "GRID_MAX_PERSIST_MEMORY_IN_MB = GRID_PERSIST_THREADS * 50"
export INIT_MEM=128 # in Meg export INIT_MEM=128 # in Meg
@ -39,6 +40,7 @@ export MAX_MEM
export GRIB_DECODE_THREADS export GRIB_DECODE_THREADS
export GRIB_MAX_GRID_POINTS export GRIB_MAX_GRID_POINTS
export GRID_PERSIST_THREADS export GRID_PERSIST_THREADS
export GRID_POSTPROCESS_THREADS
export GRID_MAX_PERSIST_MEMORY_IN_MB export GRID_MAX_PERSIST_MEMORY_IN_MB
export METADATA_POOL_MAX=10 export METADATA_POOL_MAX=10

View file

@ -19,9 +19,12 @@
# further licensing information. # further licensing information.
## ##
export INIT_MEM=412 # in Meg
export MAX_MEM=796 # in Meg export MAX_MEM=796 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=1024
fi
export METADATA_POOL_MAX=25 export METADATA_POOL_MAX=25
export EDEX_DEBUG_PORT=5006 export EDEX_DEBUG_PORT=5006
export EDEX_JMX_PORT=1617 export EDEX_JMX_PORT=1617

View file

@ -20,6 +20,11 @@
## ##
export MAX_MEM=1536 # in Meg export MAX_MEM=1536 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=2560
fi
export MAX_PERM_SIZE=192m export MAX_PERM_SIZE=192m
export EDEX_DEBUG_PORT=5012 export EDEX_DEBUG_PORT=5012
export EDEX_JMX_PORT=1620 export EDEX_JMX_PORT=1620
@ -29,4 +34,4 @@ export MGMT_PORT=9605
export METADATA_POOL_MAX=20 export METADATA_POOL_MAX=20
export METADATA_POOL_TIMEOUT=60 export METADATA_POOL_TIMEOUT=60
export SOFT_REF_LRU_POLICY_MS_PER_MB=50 export SOFT_REF_LRU_POLICY_MS_PER_MB=50

View file

@ -18,9 +18,12 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
export INIT_MEM=128 # in Meg
export MAX_MEM=2144 # in Meg export MAX_MEM=2144 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=3072
fi
export SERIALIZE_POOL_MAX_SIZE=24 export SERIALIZE_POOL_MAX_SIZE=24
export SERIALIZE_STREAM_INIT_SIZE_MB=2 export SERIALIZE_STREAM_INIT_SIZE_MB=2
export SERIALIZE_STREAM_MAX_SIZE_MB=8 export SERIALIZE_STREAM_MAX_SIZE_MB=8

View file

@ -18,12 +18,12 @@
# See the AWIPS II Master Rights File ("Master Rights File.pdf") for # See the AWIPS II Master Rights File ("Master Rights File.pdf") for
# further licensing information. # further licensing information.
## ##
export INIT_MEM=128 # in Meg export MAX_MEM=1536 # in Meg
if [ "$EDEX_ARCH" == "64-bit" ]; then
export MAX_MEM=1648 # in Meg if [ $HIGH_MEM == "on" ]; then
else export MAX_MEM=2048
export MAX_MEM=880 # in Meg
fi fi
export SERIALIZE_POOL_MAX_SIZE=24 export SERIALIZE_POOL_MAX_SIZE=24
export SERIALIZE_STREAM_INIT_SIZE_MB=2 export SERIALIZE_STREAM_INIT_SIZE_MB=2
export SERIALIZE_STREAM_MAX_SIZE_MB=8 export SERIALIZE_STREAM_MAX_SIZE_MB=8

View file

@ -1,6 +1,5 @@
# This build.properties file is used exclusively by the cave pde p2 builds. # This build.properties file is used exclusively by the cave pde p2 builds.
topLevelElementType=feature
buildType=I buildType=I
buildId=CAVE buildId=CAVE
buildLabel=${buildType}.${buildId} buildLabel=${buildType}.${buildId}
@ -28,4 +27,4 @@ generate.p2.metadata=true
p2.metadata.repo=file:/${buildDirectory}/repository p2.metadata.repo=file:/${buildDirectory}/repository
p2.artifact.repo=file:/${buildDirectory}/repository p2.artifact.repo=file:/${buildDirectory}/repository
p2.publish.artifacts=true p2.publish.artifacts=true
generateVersionsList=true generateVersionsList=true

View file

@ -18,9 +18,7 @@
message="usage: ant -f ${basedir}/build.xml [alertviz] [cave]" /> message="usage: ant -f ${basedir}/build.xml [alertviz] [cave]" />
</target> </target>
<target name="init"> <target name="init">
<antcall target="clean" />
<exec executable="/usr/bin/find" <exec executable="/usr/bin/find"
outputproperty="launcher.jar"> outputproperty="launcher.jar">
<arg value="${eclipse.dir}/plugins" /> <arg value="${eclipse.dir}/plugins" />
@ -73,7 +71,7 @@
<arg value="-DbuildDirectory=${basedir}/cave/tmp" /> <arg value="-DbuildDirectory=${basedir}/cave/tmp" />
<arg value="-Dbase=${basedir}/cave" /> <arg value="-Dbase=${basedir}/cave" />
<arg value="-Dconfigs=${build.os},${build.ws},${build.arch}" /> <arg value="-Dconfigs=${build.os},${build.ws},${build.arch}" />
<arg value="-DproductFile=${build.product}" /> <arg value="-Dproduct=${build.product}" />
<classpath> <classpath>
<pathelement <pathelement

View file

@ -20,18 +20,13 @@
############# PRODUCT/PACKAGING CONTROL ############# ############# PRODUCT/PACKAGING CONTROL #############
# The product file is specified in the build.xml as a default and is
# overridable setting 'build.product' from ant.
product=${base}/../../com.raytheon.viz.product.awips/${productFile}
#product=${base}/../../com.raytheon.viz.product.awips/developer.product
runPackager=true runPackager=true
#Needed for p2, comment out these lines if using developer.product #Needed for p2, comment out these lines if using developer.product
p2.gathering=true p2.gathering=true
generate.p2.metadata = true generate.p2.metadata = true
p2.metadata.repo=file:${buildDirectory}/repo p2.metadata.repo=file:${buildDirectory}/repository
p2.artifact.repo=file:${buildDirectory}/repo p2.artifact.repo=file:${buildDirectory}/repository
p2.flavor=tooling p2.flavor=tooling
p2.publish.artifacts=true p2.publish.artifacts=true

View file

@ -65,63 +65,7 @@
<!-- ===================================================================== --> <!-- ===================================================================== -->
<!-- Steps to do after setup but before starting the build proper --> <!-- Steps to do after setup but before starting the build proper -->
<!-- ===================================================================== --> <!-- ===================================================================== -->
<target name="postSetup"> <target name="postSetup">
<echo message="${buildDirectory}"/>
<mkdir dir="${buildDirectory}/plugins"/>
<echo message="com.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="com.*/**"/>
</copy>
<echo message="ucar.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="ucar.*/**"/>
</copy>
<echo message="features.*/**"/>
<copy todir="${buildDirectory}/features">
<fileset dir="${buildDirectory}/../../../" includes="*.feature*/**"/>
</copy>
<echo message="ncsa.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="ncsa.*/**"/>
</copy>
<echo message="org.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="org.*/**"/>
</copy>
<echo message="net.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="net.*/**"/>
</copy>
<echo message="ohd.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="ohd*/**"/>
</copy>
<echo message="javax.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="javax.*/**"/>
</copy>
<echo message="gov.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="gov.*/**"/>
</copy>
<echo message="edu.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="edu.*/**"/>
</copy>
<echo message="ogc.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="ogc.*/**"/>
</copy>
<echo message="de.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="de.*/**"/>
</copy>
<echo message="ch.*/**"/>
<copy todir="${buildDirectory}/plugins">
<fileset dir="${buildDirectory}/../../../" includes="ch.*/**"/>
</copy>
<antcall target="getBaseComponents" /> <antcall target="getBaseComponents" />
</target> </target>
@ -214,236 +158,8 @@
<!-- ===================================================================== --> <!-- ===================================================================== -->
<!-- Steps to do after the build is done. --> <!-- Steps to do after the build is done. -->
<!-- ===================================================================== --> <!-- ===================================================================== -->
<target name="postBuild"> <target name="postBuild">
<taskdef resource="net/sf/antcontrib/antlib.xml"
classpath="${builder}/../lib/ant/ant-contrib-1.0b3.jar" />
<!-- TODO: cleanup unused tasks + libs; next changeset -->
<taskdef name="xmltask"
classname="com.oopsconsultancy.xmltask.ant.XmlTask">
<classpath>
<pathelement path="${builder}/../lib/ant/xmltask-v1.15.1.jar"/>
<pathelement path="${builder}/../lib/ant/xalan-2.7.2.jar"/>
</classpath>
</taskdef>
</target> </target>
<macrodef name="extractCAVEini">
<attribute name="zip.file" />
<sequential>
<unzip src="@{zip.file}"
dest="/tmp">
<patternset>
<include name="**/cave/cave.ini" />
</patternset>
</unzip>
</sequential>
</macrodef>
<macrodef name="verifyVersion">
<attribute name="file.version" />
<sequential>
<property name="___memorySettingsVersion___"
value="4.0"/>
<if>
<not>
<equals
arg1="${___memorySettingsVersion___}"
arg2="@{file.version}" />
</not>
<then>
<fail
message="ERROR: memorySettings.xml Version Mismatch." />
</then>
</if>
</sequential>
</macrodef>
<target name="generateDynamicCAVE">
<xmlproperty file="${builder}/memorySettings.xml"
collapseAttributes="true"/>
<verifyVersion
file.version="${cave-memory-settings.file-version}" />
<property name="iniLookupScript"
value="/tmp/cave/iniLookup.sh" />
<!-- Start the iniLookup.sh script -->
<echo message="#!/bin/bash${line.separator}"
file="${iniLookupScript}" />
<echo message="${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message="# This auto-generated script will be sourced by caveUtil.sh.${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message="export ASSOCIATED_INI=${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message="${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message="function retrieveAssociatedINI()${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message="{${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message=" # Arguments${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message=" # ${1} == one in the set: {-component, -perspective}${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message=" # ${2} == the argument that corresponds to the first argument${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message="${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message=" # AUTOGENERATED IF STATEMENTS."
file="${iniLookupScript}"
append="true" />
<xmltask source="${builder}/memorySettings.xml">
<call path="//${cave.arch}/memory-setting">
<param name="first-arg"
path="command-line-args/first-arg/text()" />
<param name="second-arg"
path="command-line-args/second-arg/text()" />
<!-- TODO: Explore using copy and buffers to do
the following actions in a better way. -->
<param name="max-memory"
path="ini-substitutions/max-memory/value/text()" />
<param name="max-perm"
path="ini-substitutions/max-perm/value/text()" />
<actions>
<!-- Create a component-specific ini file -->
<copy verbose="true"
file="/tmp/cave/cave.ini"
tofile="/tmp/cave/@{second-arg}.ini"
overwrite="true" />
<!-- Update the ini file -->
<update.ini
ini.file="@{second-arg}.ini"
jvm.arg="${cave-memory-settings.default-memory-setting.default-max-memory.jvm-arg}"
current.value="${cave-memory-settings.default-memory-setting.default-max-memory.value}"
new.value="@{max-memory}" />
<update.ini
ini.file="@{second-arg}.ini"
jvm.arg="${cave-memory-settings.default-memory-setting.default-max-perm.jvm-arg}"
current.value="${cave-memory-settings.default-memory-setting.default-max-perm.value}"
new.value="@{max-perm}" />
<!-- Add to the ini lookup utility script -->
<echo message="${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message=" if [ &quot;$${1}&quot; == &quot;@{first-arg}&quot; ] &amp;&amp;${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message=" [ &quot;$${2}&quot; == &quot;@{second-arg}&quot; ]; then${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message="${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message=" export ASSOCIATED_INI=&quot;@{second-arg}.ini&quot;${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message=" return 0${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message="${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message=" fi${line.separator}"
file="${iniLookupScript}"
append="true" />
</actions>
</call>
<!-- site type specific overrides (wfo, ncep, etc) -->
<call path="//${cave.arch}/site-type-override">
<param name="site-type"
path="site-type/text()" />
<param name="max-memory"
path="ini-substitutions/max-memory/value/text()" />
<param name="max-perm"
path="ini-substitutions/max-perm/value/text()" />
<actions>
<!-- Create a site-type-specific ini file -->
<copy verbose="true"
file="/tmp/cave/cave.ini"
tofile="/tmp/cave/@{site-type}.ini"
overwrite="true" />
<!-- Update the ini file -->
<update.ini
ini.file="@{site-type}.ini"
jvm.arg="${cave-memory-settings.default-memory-setting.default-max-memory.jvm-arg}"
current.value="${cave-memory-settings.default-memory-setting.default-max-memory.value}"
new.value="@{max-memory}" />
<update.ini
ini.file="@{site-type}.ini"
jvm.arg="${cave-memory-settings.default-memory-setting.default-max-perm.jvm-arg}"
current.value="${cave-memory-settings.default-memory-setting.default-max-perm.value}"
new.value="@{max-perm}" />
</actions>
</call>
</xmltask>
<!-- Finish the iniLookup.sh script -->
<echo message="${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message=" return 1${line.separator}"
file="${iniLookupScript}"
append="true" />
<echo message="}"
file="${iniLookupScript}"
append="true" />
</target>
<macrodef name="update.ini">
<attribute name="ini.file" />
<attribute name="jvm.arg" />
<attribute name="current.value" />
<attribute name="new.value" />
<sequential>
<if>
<not>
<equals arg1="@{new.value}"
arg2="DEFAULT" />
</not>
<then>
<exec executable="/bin/sed"
output="/tmp/cave/ini.tmp">
<arg value="-e" />
<arg value="s/@{jvm.arg}@{current.value}/@{jvm.arg}@{new.value}/" />
<arg value="/tmp/cave/@{ini.file}" />
</exec>
<move verbose="true"
file="/tmp/cave/ini.tmp"
tofile="/tmp/cave/@{ini.file}"
overwrite="true" />
</then>
</if>
</sequential>
</macrodef>
<!-- ===================================================================== --> <!-- ===================================================================== -->

50
cave/build/features.txt Normal file
View file

@ -0,0 +1,50 @@
com.raytheon.uf.common.base.feature
com.raytheon.uf.viz.dataplugin.obs.feature
com.raytheon.uf.viz.sounding.feature
com.raytheon.uf.viz.cots.feature
com.raytheon.uf.viz.registry.feature
com.raytheon.uf.viz.common.core.feature
com.raytheon.uf.viz.dataplugins.feature
com.raytheon.viz.feature.awips
com.raytheon.uf.viz.application.feature
com.raytheon.uf.viz.base.feature
com.raytheon.uf.viz.nwsauth.feature
com.raytheon.uf.viz.archive.feature
com.raytheon.uf.viz.gisdatastore.feature
com.raytheon.uf.viz.useradmin.feature
com.raytheon.viz.dataaccess.feature
com.raytheon.uf.viz.localization.perspective.feature
com.raytheon.uf.viz.core.feature
com.raytheon.uf.viz.ncep.core.feature
com.raytheon.uf.viz.aviation.advisory.feature
com.raytheon.uf.viz.d2d.core.feature
com.raytheon.viz.radar.feature
com.raytheon.uf.viz.radarapps.feature
com.raytheon.uf.viz.grid.feature
com.raytheon.uf.viz.displays.feature
com.raytheon.viz.hydro.feature
com.raytheon.uf.viz.kml.export.feature
com.raytheon.uf.viz.d2d.damagepath.feature
com.raytheon.uf.viz.d2d.xy.feature
com.raytheon.viz.volumebrowser.feature
com.raytheon.uf.viz.core.maps.feature
com.raytheon.uf.viz.thinclient.feature
com.raytheon.uf.viz.npp.feature
com.raytheon.viz.text.feature
com.raytheon.viz.warngen.feature
com.raytheon.viz.gfe.feature
com.raytheon.uf.viz.dat.feature
com.raytheon.uf.viz.d2d.ui.awips.feature
com.raytheon.uf.viz.d2d.gfe.feature
com.raytheon.uf.viz.ncep.dataplugins.feature
com.raytheon.uf.viz.alertview.feature
com.raytheon.viz.satellite.feature
com.raytheon.uf.viz.ncep.displays.feature
com.raytheon.uf.viz.ncep.nsharp.feature
com.raytheon.uf.viz.d2d.nsharp.feature
com.raytheon.uf.viz.acarssounding.feature
com.raytheon.viz.avnfps.feature
com.raytheon.uf.viz.npp.sounding.feature
com.raytheon.uf.viz.ncep.npp.feature
com.raytheon.uf.viz.ncep.perspective.feature
com.raytheon.uf.viz.d2d.skewt.feature

View file

@ -119,6 +119,12 @@
version="0.0.0" version="0.0.0"
unpack="false"/> unpack="false"/>
<plugin
id="org.codehaus.jackson"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin <plugin
id="com.raytheon.uf.common.json" id="com.raytheon.uf.common.json"
download-size="0" download-size="0"

View file

@ -87,4 +87,11 @@
install-size="0" install-size="0"
version="0.0.0"/> version="0.0.0"/>
<plugin
id="org.apache.xerces"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature> </feature>

View file

@ -51,6 +51,8 @@
</command> </command>
<separator name="LocalData" visible="false"> <separator name="LocalData" visible="false">
</separator> </separator>
<separator name="CollectionDissemSep" visible="false">
</separator>
<separator name="EndOfLocalData" visible="true"> <separator name="EndOfLocalData" visible="true">
</separator> </separator>
<command commandId="com.raytheon.viz.ui.actions.titleAction" <command commandId="com.raytheon.viz.ui.actions.titleAction"

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: D2D Graph Adapters Bundle-Name: D2D Graph Adapters
Bundle-SymbolicName: com.raytheon.uf.viz.d2d.xy.adapters;singleton:=true Bundle-SymbolicName: com.raytheon.uf.viz.d2d.xy.adapters;singleton:=true
Bundle-Version: 1.14.0.qualifier Bundle-Version: 1.15.0.qualifier
Bundle-Vendor: RAYTHEON Bundle-Vendor: RAYTHEON
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
@ -18,14 +18,15 @@ Require-Bundle: com.raytheon.uf.viz.core;bundle-version="1.14.0",
com.raytheon.uf.common.pointdata;bundle-version="1.13.0", com.raytheon.uf.common.pointdata;bundle-version="1.13.0",
com.raytheon.uf.viz.objectiveanalysis, com.raytheon.uf.viz.objectiveanalysis,
com.raytheon.viz.grid, com.raytheon.viz.grid,
com.raytheon.viz.radar,
com.raytheon.uf.common.datastorage, com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.time, com.raytheon.uf.common.time,
com.raytheon.uf.common.style, com.raytheon.uf.common.style,
com.raytheon.uf.common.comm, com.raytheon.uf.common.comm,
javax.measure, javax.measure,
org.eclipse.swt;bundle-version="3.8.0", org.eclipse.swt;bundle-version="3.8.0",
com.raytheon.uf.viz.datacube;bundle-version="1.14.0" com.raytheon.uf.viz.datacube;bundle-version="1.14.0",
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.14.1",
com.raytheon.uf.common.wxmath;bundle-version="1.0.0"
Import-Package: com.raytheon.uf.common.inventory.exception, Import-Package: com.raytheon.uf.common.inventory.exception,
com.raytheon.uf.viz.datacube, com.raytheon.uf.viz.datacube,
com.raytheon.viz.core.map com.raytheon.viz.core.map

View file

@ -33,13 +33,13 @@ import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.interp.IInterpolation; import com.raytheon.uf.viz.core.interp.IInterpolation;
import com.raytheon.uf.viz.core.interp.InterpolationRequest; import com.raytheon.uf.viz.core.interp.InterpolationRequest;
import com.raytheon.uf.viz.d2d.xy.tools.DmdTools;
import com.raytheon.uf.viz.xy.InterpUtils; import com.raytheon.uf.viz.xy.InterpUtils;
import com.raytheon.uf.viz.xy.crosssection.adapter.AbstractCrossSectionAdapter; import com.raytheon.uf.viz.xy.crosssection.adapter.AbstractCrossSectionAdapter;
import com.raytheon.uf.viz.xy.crosssection.graph.CrossSectionGraph; import com.raytheon.uf.viz.xy.crosssection.graph.CrossSectionGraph;
import com.raytheon.viz.core.graphing.util.MeteolibInterpolation; import com.raytheon.viz.core.graphing.util.MeteolibInterpolation;
import com.raytheon.viz.core.slice.request.HeightScale; import com.raytheon.viz.core.slice.request.HeightScale;
import com.raytheon.viz.core.slice.request.HeightScale.ScaleType; import com.raytheon.viz.core.slice.request.HeightScale.ScaleType;
import com.raytheon.viz.radar.util.DmdTools;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.LineSegment; import com.vividsolutions.jts.geom.LineSegment;
import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.LineString;
@ -54,6 +54,8 @@ import com.vividsolutions.jts.geom.LineString;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 30, 2009 bsteffen Initial creation * Dec 30, 2009 bsteffen Initial creation
* Oct 13, 2015 4897 bkowal Relocated {@link DmdTools} to a plugin
* that actually uses it.
* *
* </pre> * </pre>
* *

View file

@ -30,10 +30,10 @@ import com.raytheon.uf.common.dataplugin.radar.util.RadarRecordUtil;
import com.raytheon.uf.common.style.level.SingleLevel; import com.raytheon.uf.common.style.level.SingleLevel;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.d2d.xy.tools.DmdTools;
import com.raytheon.uf.viz.xy.timeseries.adapter.AbstractTimeSeriesAdapter; import com.raytheon.uf.viz.xy.timeseries.adapter.AbstractTimeSeriesAdapter;
import com.raytheon.viz.core.graphing.xy.XYData; import com.raytheon.viz.core.graphing.xy.XYData;
import com.raytheon.viz.core.graphing.xy.XYDataList; import com.raytheon.viz.core.graphing.xy.XYDataList;
import com.raytheon.viz.radar.util.DmdTools;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
@ -45,6 +45,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 7, 2010 bsteffen Initial creation * May 7, 2010 bsteffen Initial creation
* Oct 13, 2015 4897 bkowal Relocated {@link DmdTools} to a plugin
* that actually uses it.
* *
* </pre> * </pre>
* *

View file

@ -28,9 +28,9 @@ import com.raytheon.uf.common.dataplugin.radar.RadarRecord;
import com.raytheon.uf.common.dataplugin.radar.util.RadarRecordUtil; import com.raytheon.uf.common.dataplugin.radar.util.RadarRecordUtil;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.d2d.xy.tools.DmdTools;
import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter; import com.raytheon.uf.viz.xy.varheight.adapter.AbstractVarHeightAdapter;
import com.raytheon.viz.core.graphing.xy.XYData; import com.raytheon.viz.core.graphing.xy.XYData;
import com.raytheon.viz.radar.util.DmdTools;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
/** /**
@ -42,6 +42,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 7, 2010 bsteffen Initial creation * May 7, 2010 bsteffen Initial creation
* Oct 13, 2015 4897 bkowal Relocated {@link DmdTools} to a plugin
* that actually uses it.
* *
* </pre> * </pre>
* *

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information. * further licensing information.
**/ **/
package com.raytheon.viz.radar.util; package com.raytheon.uf.viz.d2d.xy.tools;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -53,6 +53,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* ??? ??, ???? xxxxxxxx Initial creation * ??? ??, ???? xxxxxxxx Initial creation
* Aug 14, 2013 #2262 dgilling Use new wxmath method for ztopsa. * Aug 14, 2013 #2262 dgilling Use new wxmath method for ztopsa.
* Oct 13, 2015 #4759 bkowal Relocated to the viz xy adapters plugin.
* *
* </pre> * </pre>
* *

View file

@ -19,10 +19,17 @@
**/ **/
package com.raytheon.uf.viz.daylight.transition.resource; package com.raytheon.uf.viz.daylight.transition.resource;
import java.util.List;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord; import com.raytheon.uf.common.dataplugin.satellite.SatelliteRecord;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.drawables.IRenderable;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.daylight.transition.tileset.DaylightTransitionTileSetRenderable; import com.raytheon.uf.viz.daylight.transition.tileset.DaylightTransitionTileSetRenderable;
import com.raytheon.viz.satellite.rsc.SatResource; import com.raytheon.viz.satellite.rsc.SatResource;
import com.raytheon.viz.satellite.tileset.SatRenderable;
import com.raytheon.viz.satellite.tileset.SatTileSetRenderable; import com.raytheon.viz.satellite.tileset.SatTileSetRenderable;
/** /**
@ -38,6 +45,7 @@ import com.raytheon.viz.satellite.tileset.SatTileSetRenderable;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------- -------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Jul 28, 2015 4633 bsteffen Initial creation * Jul 28, 2015 4633 bsteffen Initial creation
* Oct 12, 2015 4937 bsteffen Move SatRenderable to new class, extend it here.
* *
* </pre> * </pre>
* *
@ -54,12 +62,30 @@ public class DaylightTransitionSatResource extends SatResource {
this.resourceData = data; this.resourceData = data;
} }
@Override @Override
protected SatTileSetRenderable createTileSet(SatelliteRecord record) { protected IRenderable constructRenderable(DataTime time,
SatTileSetRenderable tileSet = new DaylightTransitionTileSetRenderable( List<PluginDataObject> records) throws VizException {
this, record, resourceData.getSunDelta()); SatRenderable renderable = new DaylightTransitionSatRenderable(time);
tileSet.project(descriptor.getGridGeometry()); updateRenderable(renderable, records.toArray(new PluginDataObject[0]));
return tileSet; renderable.project();
return renderable;
}
private class DaylightTransitionSatRenderable extends SatRenderable {
public DaylightTransitionSatRenderable(DataTime renderableTime) {
super(DaylightTransitionSatResource.this, renderableTime);
}
@Override
protected SatTileSetRenderable createTileSet(SatelliteRecord record) {
SatTileSetRenderable tileSet = new DaylightTransitionTileSetRenderable(
DaylightTransitionSatResource.this, record,
resourceData.getSunDelta());
tileSet.project(descriptor.getGridGeometry());
return tileSet;
}
} }
} }

View file

@ -140,6 +140,9 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* Feb 06, 2015 4028 mapeters fixed file selection issue when reopening CAVE with files open * Feb 06, 2015 4028 mapeters fixed file selection issue when reopening CAVE with files open
* Apr 02, 2015 4288 randerso Fix Widget is disposed error * Apr 02, 2015 4288 randerso Fix Widget is disposed error
* Aug 24, 2015 4393 njensen Updates for observer changes * Aug 24, 2015 4393 njensen Updates for observer changes
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types.
*
* *
* </pre> * </pre>
* *
@ -859,7 +862,6 @@ public class FileTreeView extends ViewPart implements IPartListener2,
// Add Copy/Paste/Delete // Add Copy/Paste/Delete
if ((fileList.size() == 1) && (selected.length == 1)) { if ((fileList.size() == 1) && (selected.length == 1)) {
LocalizationFile selectedFile = fileList.get(0);
mgr.add(new Action("Copy") { mgr.add(new Action("Copy") {
@Override @Override
public void run() { public void run() {
@ -867,7 +869,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
} }
}); });
mgr.add(new CopyToAction(selectedFile, this)); mgr.add(new CopyToAction(fileDataList.get(0), this));
mgr.add(new DeleteAction(getSite().getPage(), fileList mgr.add(new DeleteAction(getSite().getPage(), fileList
.toArray(new LocalizationFile[fileList.size()]))); .toArray(new LocalizationFile[fileList.size()])));
@ -919,9 +921,9 @@ public class FileTreeView extends ViewPart implements IPartListener2,
} }
// Add the move to item // Add the move to item
if ((selected.length == 1) && (fileList.size() == 1)) { if ((selected.length == 1) && (fileDataList.size() == 1)) {
mgr.add(new MoveFileAction(getSite().getPage(), fileList.get(0), mgr.add(new MoveFileAction(getSite().getPage(),
this)); fileDataList.get(0), this));
mgr.add(new Separator()); mgr.add(new Separator());
} }
@ -966,8 +968,9 @@ public class FileTreeView extends ViewPart implements IPartListener2,
if (fdata.isDirectory()) { if (fdata.isDirectory()) {
// We can import into true directories, not group datas // We can import into true directories, not group datas
mgr.add(new Separator()); mgr.add(new Separator());
mgr.add(new ImportFileAction(fdata.getPathData().getType(), mgr.add(new ImportFileAction(
fdata.getPath(), fdata.getPathData().getFilter())); fdata.getPathData().getTypes(), fdata.getPath(),
fdata.getPathData().getFilter()));
} }
} }
} }
@ -1080,14 +1083,14 @@ public class FileTreeView extends ViewPart implements IPartListener2,
String path = data.getPath(); String path = data.getPath();
String[] filter = pd.getFilter(); String[] filter = pd.getFilter();
boolean recursive = pd.isRecursive(); boolean recursive = pd.isRecursive();
LocalizationType type = pd.getType(); List<LocalizationType> types = pd.getTypes();
IPathManager pathManager = PathManagerFactory.getPathManager(); IPathManager pathManager = PathManagerFactory.getPathManager();
boolean success = false; boolean success = false;
List<LocalizationFile> currentList = new ArrayList<LocalizationFile>(); List<LocalizationFile> currentList = new ArrayList<LocalizationFile>();
LocalizationFile[] files = pathManager.listFiles( LocalizationFile[] files = pathManager.listFiles(
getTreeSearchContexts(type), path, filter, false, !recursive); getTreeSearchContexts(types), path, filter, false, !recursive);
if (files == null) { if (files == null) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error getting list of files"); "Error getting list of files");
@ -1119,16 +1122,19 @@ public class FileTreeView extends ViewPart implements IPartListener2,
return success; return success;
} }
private LocalizationContext[] getTreeSearchContexts(LocalizationType type) { private LocalizationContext[] getTreeSearchContexts(
List<LocalizationType> types) {
IPathManager pathManager = PathManagerFactory.getPathManager(); IPathManager pathManager = PathManagerFactory.getPathManager();
// Request for base/site/user // Request for base/site/user
LocalizationContext[] searchHierarchy = pathManager
.getLocalSearchHierarchy(type); List<LocalizationContext> searchContexts = new ArrayList<LocalizationContext>();
List<LocalizationContext> searchContexts = new ArrayList<LocalizationContext>( for (LocalizationType type : types) {
searchHierarchy.length); LocalizationContext[] searchHierarchy = pathManager
for (LocalizationContext ctx : searchHierarchy) { .getLocalSearchHierarchy(type);
if (showSet.contains(ctx.getLocalizationLevel())) { for (LocalizationContext ctx : searchHierarchy) {
searchContexts.add(ctx); if (showSet.contains(ctx.getLocalizationLevel())) {
searchContexts.add(ctx);
}
} }
} }
@ -1152,11 +1158,12 @@ public class FileTreeView extends ViewPart implements IPartListener2,
|| ((myContext == null) && (context == null))) { || ((myContext == null) && (context == null))) {
continue; continue;
} }
for (LocalizationType type : types) {
LocalizationContext ctx = pathManager.getContext(type, LocalizationContext ctx = pathManager.getContext(type,
level); level);
ctx.setContextName(context); ctx.setContextName(context);
searchContexts.add(ctx); searchContexts.add(ctx);
}
} }
} }
} }
@ -1217,10 +1224,21 @@ public class FileTreeView extends ViewPart implements IPartListener2,
fData.clearChildData(); fData.clearChildData();
fData.setRequestedChildren(true); fData.setRequestedChildren(true);
PathData pd = fData.getPathData(); PathData pd = fData.getPathData();
Set<LocalizationLevel> levels = new HashSet<>();
Set<LocalizationLevel> redundantLevels = new HashSet<>();
for (LocalizationFile file : files) {
LocalizationLevel level = file.getContext().getLocalizationLevel();
if (!levels.add(level)) {
redundantLevels.add(level);
}
}
for (LocalizationFile file : files) { for (LocalizationFile file : files) {
FileTreeEntryData treeData = null; FileTreeEntryData treeData = null;
if (!file.isDirectory()) { if (!file.isDirectory()) {
treeData = new LocalizationFileEntryData(pd, file); LocalizationLevel level = file.getContext()
.getLocalizationLevel();
treeData = new LocalizationFileEntryData(pd, file,
redundantLevels.contains(level));
addTreeItem(parentItem, treeData); addTreeItem(parentItem, treeData);
fData.addChildData((LocalizationFileEntryData) treeData); fData.addChildData((LocalizationFileEntryData) treeData);
} }
@ -1268,13 +1286,26 @@ public class FileTreeView extends ViewPart implements IPartListener2,
LocalizationFile file = null; LocalizationFile file = null;
int idx = parentItem.getItemCount(); int idx = parentItem.getItemCount();
if (treeData instanceof LocalizationFileEntryData) { if (treeData instanceof LocalizationFileEntryData) {
file = ((LocalizationFileEntryData) treeData).getFile(); LocalizationFileEntryData entryData = (LocalizationFileEntryData) treeData;
file = entryData.getFile();
LocalizationContext ctx = file.getContext(); LocalizationContext ctx = file.getContext();
LocalizationLevel level = ctx.getLocalizationLevel(); LocalizationLevel level = ctx.getLocalizationLevel();
name = level.toString(); StringBuilder nameBuilder = new StringBuilder(level.toString());
if (level != LocalizationLevel.BASE) { if (entryData.isMultipleTypes() || level != LocalizationLevel.BASE) {
name += " (" + ctx.getContextName() + ")"; nameBuilder.append(" (");
if (level != LocalizationLevel.BASE) {
nameBuilder.append(ctx.getContextName());
}
if (entryData.isMultipleTypes()) {
if (level != LocalizationLevel.BASE) {
nameBuilder.append(" - ");
}
nameBuilder.append(ctx.getLocalizationType().name()
.toLowerCase());
}
nameBuilder.append(")");
} }
name = nameBuilder.toString();
} else { } else {
List<TreeItem> applicableItems = new ArrayList<TreeItem>(); List<TreeItem> applicableItems = new ArrayList<TreeItem>();
int start = -1; int start = -1;
@ -1318,9 +1349,10 @@ public class FileTreeView extends ViewPart implements IPartListener2,
IFolder folder = (IFolder) parentData.getResource(); IFolder folder = (IFolder) parentData.getResource();
IResource rsc = null; IResource rsc = null;
if (file != null) { if (file != null) {
rsc = folder.getFile(file.getContext().getLocalizationLevel() + "_" LocalizationContext context = file.getContext();
+ file.getContext().getContextName() + "_" rsc = folder.getFile(context.getLocalizationType() + "_"
+ parentItem.getText()); + context.getLocalizationLevel() + "_"
+ context.getContextName() + "_" + parentItem.getText());
} else { } else {
rsc = createFolder(folder, fileItem.getText()); rsc = createFolder(folder, fileItem.getText());
} }
@ -1465,7 +1497,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
private TreeItem find(TreeItem item, LocalizationContext ctx, private TreeItem find(TreeItem item, LocalizationContext ctx,
java.nio.file.Path path, boolean populateToFind) { java.nio.file.Path path, boolean populateToFind) {
FileTreeEntryData data = (FileTreeEntryData) item.getData(); FileTreeEntryData data = (FileTreeEntryData) item.getData();
if (data.getPathData().getType() == ctx.getLocalizationType()) { if (data.getPathData().getTypes().contains(ctx.getLocalizationType())) {
java.nio.file.Path itemPath = Paths.get(data.getPath()); java.nio.file.Path itemPath = Paths.get(data.getPath());
if (path.startsWith(itemPath)) { if (path.startsWith(itemPath)) {
if (path.equals(itemPath) if (path.equals(itemPath)

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.viz.localization.perspective.view;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -43,6 +44,8 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.LocalizationUtil; import com.raytheon.uf.common.localization.LocalizationUtil;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException; import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
import com.raytheon.uf.common.localization.msgs.ListResponseEntry; import com.raytheon.uf.common.localization.msgs.ListResponseEntry;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -63,7 +66,10 @@ import com.raytheon.uf.viz.localization.perspective.view.actions.ImportFileActio
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jul 1, 2011 mschenke Initial creation * Jul 1, 2011 mschenke Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types.
*
* *
* </pre> * </pre>
* *
@ -144,7 +150,7 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
for (int i = 0; i < paths.length; ++i) { for (int i = 0; i < paths.length; ++i) {
files[i] = new File(paths[i]); files[i] = new File(paths[i]);
} }
boolean rval = dropFile(data.getPathData().getType(), boolean rval = dropFile(data.getPathData().getTypes(),
data.getPath(), files); data.getPath(), files);
if (rval) { if (rval) {
toDelete = potentialDelete; toDelete = potentialDelete;
@ -152,8 +158,8 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
// Dragging from somewhere outside of FileTreeView // Dragging from somewhere outside of FileTreeView
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
view.refresh(pm.getLocalizationFile(pm.getContext(data view.refresh(pm.getLocalizationFile(pm.getContext(data
.getPathData().getType(), LocalizationLevel.BASE), .getPathData().getTypes().get(0),
data.getPath())); LocalizationLevel.BASE), data.getPath()));
} }
} }
return rval; return rval;
@ -192,9 +198,12 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
toMoveData.getContext(), toMoveData.getFileName()); toMoveData.getContext(), toMoveData.getFileName());
String fileName = LocalizationUtil.extractName(toMove.getName()); String fileName = LocalizationUtil.extractName(toMove.getName());
String newName = data.getPath() + File.separator + fileName; String newName = data.getPath() + File.separator + fileName;
LocalizationType type = toMove.getContext().getLocalizationType();
if (!data.getPathData().getTypes().contains(type)) {
type = data.getPathData().getTypes().get(0);
}
final LocalizationFile moveTo = pm.getLocalizationFile(pm.getContext( final LocalizationFile moveTo = pm.getLocalizationFile(pm.getContext(
data.getPathData().getType(), toMoveData.getContext() type, toMoveData.getContext().getLocalizationLevel()), newName);
.getLocalizationLevel()), newName);
boolean move = true; boolean move = true;
if (moveTo.exists()) { if (moveTo.exists()) {
move = MessageDialog.openQuestion(view.getSite().getShell(), move = MessageDialog.openQuestion(view.getSite().getShell(),
@ -227,23 +236,20 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
} else { } else {
VizApp.runAsync(select); VizApp.runAsync(select);
} }
try { try (InputStream is = toMove.openInputStream();
FileUtil.copyFile(toMove.getFile(), moveTo.getFile()); SaveableOutputStream os = moveTo.openOutputStream()) {
if (moveTo.save()) { FileUtil.copy(is, os);
return true; os.save();
} return true;
} catch (IOException e) { } catch (IOException | LocalizationException e) {
UFStatus.getHandler().handle(Priority.PROBLEM, UFStatus.getHandler().handle(Priority.PROBLEM,
"Error copying file contents", e); "Error copying file contents", e);
} catch (LocalizationOpFailedException e) {
UFStatus.getHandler().handle(Priority.PROBLEM,
"Error saving file contents", e);
} }
} }
return false; return false;
} }
private boolean dropFile(LocalizationType type, String dirPath, private boolean dropFile(List<LocalizationType> types, String dirPath,
File[] toCopyFiles) { File[] toCopyFiles) {
boolean oneGood = false; boolean oneGood = false;
List<File> files = new ArrayList<File>(toCopyFiles.length); List<File> files = new ArrayList<File>(toCopyFiles.length);
@ -260,14 +266,14 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
} }
if (files.size() > 0) { if (files.size() > 0) {
if (ImportFileAction.importFile(type, dirPath, if (ImportFileAction.importFile(types, dirPath,
files.toArray(new File[files.size()]))) { files.toArray(new File[files.size()]))) {
oneGood = true; oneGood = true;
} }
} }
for (File dir : directories) { for (File dir : directories) {
if (dropFile(type, if (dropFile(types,
dirPath + IPathManager.SEPARATOR + dir.getName(), dirPath + IPathManager.SEPARATOR + dir.getName(),
dir.listFiles())) { dir.listFiles())) {
oneGood = true; oneGood = true;

View file

@ -46,7 +46,9 @@ import com.raytheon.uf.viz.localization.filetreeview.PathData;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 7, 2012 mschenke Initial creation * Sep 7, 2012 mschenke Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types.
* *
* </pre> * </pre>
* *
@ -108,14 +110,14 @@ public class PathDataExtManager {
statusHandler statusHandler
.handle(Priority.PROBLEM, .handle(Priority.PROBLEM,
"Skipping path extension entry with no path set"); "Skipping path extension entry with no path set");
continue;
} }
pd.setFilter(element.getAttribute(FILTER_ATTR)); pd.setFilter(element.getAttribute(FILTER_ATTR));
String recurse = element.getAttribute(RECURSIVE_ATTR); String recurse = element.getAttribute(RECURSIVE_ATTR);
pd.setRecursive(Boolean.parseBoolean(recurse)); pd.setRecursive(Boolean.parseBoolean(recurse));
pd.setType(LocalizationType.valueOf(element String typesString = element.getAttribute(TYPE_ATTR);
.getAttribute(TYPE_ATTR))); if (typesString == null) {
if (pd.getType() == null) {
// Skip if bad localization type specified // Skip if bad localization type specified
statusHandler.handle( statusHandler.handle(
Priority.PROBLEM, Priority.PROBLEM,
@ -126,6 +128,11 @@ public class PathDataExtManager {
+ element.getAttribute(TYPE_ATTR)); + element.getAttribute(TYPE_ATTR));
continue; continue;
} }
List<LocalizationType> types = new ArrayList<>();
for (String typeString : typesString.split(",")) {
types.add(LocalizationType.valueOf(typeString));
}
pd.setTypes(types);
LocalizationPerspectiveAdapter adapter = DEFAULT_ADAPTER; LocalizationPerspectiveAdapter adapter = DEFAULT_ADAPTER;
try { try {
if (element.getAttribute(ADAPTER_ATTR) != null) { if (element.getAttribute(ADAPTER_ATTR) != null) {
@ -135,11 +142,11 @@ public class PathDataExtManager {
} catch (Throwable t) { } catch (Throwable t) {
statusHandler statusHandler
.handle(Priority.PROBLEM, .handle(Priority.PROBLEM,
"Skipping path with name: " "Error constructing adapter for path with name: "
+ pd.getName() + pd.getName()
+ " and path: " + " and path: "
+ pd.getPath() + pd.getPath()
+ " due to error constructing adapter: " + " the default adapter will be used: "
+ t.getLocalizedMessage(), t); + t.getLocalizedMessage(), t);
} }
pd.setAdapter(adapter); pd.setAdapter(adapter);

View file

@ -19,23 +19,29 @@
**/ **/
package com.raytheon.uf.viz.localization.perspective.view.actions; package com.raytheon.uf.viz.localization.perspective.view.actions;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.Separator;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException; import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil; import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.localization.filetreeview.LocalizationFileEntryData;
import com.raytheon.uf.viz.localization.filetreeview.PathData;
import com.raytheon.uf.viz.localization.service.ILocalizationService; import com.raytheon.uf.viz.localization.service.ILocalizationService;
/** /**
@ -48,7 +54,9 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 3, 2010 mschenke Initial creation * Nov 3, 2010 mschenke Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types.
* *
* </pre> * </pre>
* *
@ -60,11 +68,20 @@ public class CopyToAction extends AbstractToAction {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CopyToAction.class); .getHandler(CopyToAction.class);
protected ILocalizationService service; protected final ILocalizationService service;
public CopyToAction(LocalizationFile file, ILocalizationService service) { protected final PathData pathData;
public CopyToAction(LocalizationFile file, PathData pathData,
ILocalizationService service) {
super("Copy To", file); super("Copy To", file);
this.service = service; this.service = service;
this.pathData = pathData;
}
public CopyToAction(LocalizationFileEntryData data,
ILocalizationService service) {
this(data.getFile(), data.getPathData(), service);
} }
/* /*
@ -97,44 +114,50 @@ public class CopyToAction extends AbstractToAction {
@Override @Override
protected void run(LocalizationLevel level) { protected void run(LocalizationLevel level) {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
LocalizationFile newFile = pm.getLocalizationFile( ILocalizationFile newFile = pm.getLocalizationFile(
pm.getContext(file.getContext().getLocalizationType(), level), pm.getContext(file.getContext().getLocalizationType(), level),
file.getName()); file.getName());
removeAlternateTypeFiles(level);
copyFile(newFile); copyFile(newFile);
} }
protected boolean copyFile(LocalizationFile newFile) { /**
File copyTo = newFile.getFile(); * If it is possible for the target to exist for multiple localization types
File copyFrom = file.getFile(); * then delete any others that exist at the selected level so there are not
* multiple files at the same level after the operation completes.
*
* @param level
*/
protected void removeAlternateTypeFiles(LocalizationLevel level) {
IPathManager pm = PathManagerFactory.getPathManager();
// Delete local copy of existing contents for (LocalizationType type : pathData.getTypes()) {
copyTo.delete(); if (type != file.getContext().getLocalizationType()) {
// Make sure parent directories exist LocalizationFile altFile = pm.getLocalizationFile(
if (copyTo.getParentFile().exists() == false) { pm.getContext(type, level), file.getName());
copyTo.getParentFile().mkdirs(); if (altFile.exists()) {
try {
altFile.delete();
} catch (LocalizationOpFailedException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to delete existing " + type.name()
+ " " + level + " file.", e);
}
}
}
} }
}
try { protected boolean copyFile(ILocalizationFile newFile) {
// Copy file contents locally try (InputStream is = file.openInputStream();
FileUtil.copyFile(copyFrom, copyTo); SaveableOutputStream os = newFile.openOutputStream()) {
} catch (IOException e) { FileUtil.copy(is, os);
os.save();
return true;
} catch (LocalizationException | IOException e) {
statusHandler statusHandler
.handle(Priority.PROBLEM, "Error copying file contents of " .handle(Priority.PROBLEM, "Error copying file contents of "
+ file + " to " + newFile, e); + file + " to " + newFile, e);
return false;
}
try {
// Save localization file with new contents
boolean rval = newFile.save();
if (!rval) {
// If failed, make sure we get the latest file
newFile.getFile();
}
return rval;
} catch (LocalizationOpFailedException e) {
statusHandler.handle(Priority.PROBLEM, "Error saving " + newFile
+ ": " + e.getLocalizedMessage(), e);
} }
return false; return false;
} }

View file

@ -31,11 +31,13 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.localization.ILocalizationFile;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
@ -51,8 +53,10 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 1, 2011 mschenke Initial creation * Nov 1, 2011 mschenke Initial creation
* Jun 11, 2015 4541 skorolev Added NULL test for lf. * Jun 11, 2015 4541 skorolev Added NULL test for lf.
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types.
* *
* </pre> * </pre>
* *
@ -72,19 +76,21 @@ public class ImportFileAction extends Action {
private final String directoryPath; private final String directoryPath;
private final LocalizationType contextType; private final List<LocalizationType> contextTypes;
private String[] fileExtensionFilterArr; private String[] fileExtensionFilterArr;
public ImportFileAction(LocalizationType contextType, String directoryPath) { public ImportFileAction(List<LocalizationType> contextTypes,
String directoryPath) {
super("Import File..."); super("Import File...");
this.contextType = contextType; this.contextTypes = contextTypes;
this.directoryPath = directoryPath; this.directoryPath = directoryPath;
} }
public ImportFileAction(LocalizationType contextType, String directoryPath, public ImportFileAction(List<LocalizationType> contextTypes,
String directoryPath,
String[] filter) { String[] filter) {
this(contextType, directoryPath); this(contextTypes, directoryPath);
if (filter != null) { if (filter != null) {
this.fileExtensionFilterArr = new String[filter.length]; this.fileExtensionFilterArr = new String[filter.length];
for (int i = 0; i < filter.length; ++i) { for (int i = 0; i < filter.length; ++i) {
@ -114,11 +120,11 @@ public class ImportFileAction extends Action {
String fileToImport = dialog.open(); String fileToImport = dialog.open();
if (fileToImport != null) { if (fileToImport != null) {
File importFile = new File(fileToImport); File importFile = new File(fileToImport);
importFile(contextType, directoryPath, new File[] { importFile }); importFile(contextTypes, directoryPath, new File[] { importFile });
} }
} }
public static boolean importFile(LocalizationType contextType, public static boolean importFile(List<LocalizationType> contextTypes,
String directoryPath, File[] importFiles) { String directoryPath, File[] importFiles) {
List<File> applicable = new ArrayList<File>(importFiles.length); List<File> applicable = new ArrayList<File>(importFiles.length);
for (File importFile : importFiles) { for (File importFile : importFiles) {
@ -127,24 +133,38 @@ public class ImportFileAction extends Action {
applicable.add(importFile); applicable.add(importFile);
} }
} }
List<LocalizationFile> localizationFiles = new ArrayList<LocalizationFile>( List<ILocalizationFile> localizationFiles = new ArrayList<ILocalizationFile>(
applicable.size()); applicable.size());
List<LocalizationFile> existing = new ArrayList<LocalizationFile>( List<ILocalizationFile> existing = new ArrayList<ILocalizationFile>(
applicable.size()); applicable.size());
for (File importFile : applicable) { for (File importFile : applicable) {
String name = importFile.getName(); String name = importFile.getName();
String newFilePath = directoryPath + IPathManager.SEPARATOR + name; String newFilePath = directoryPath + IPathManager.SEPARATOR + name;
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
LocalizationFile lf = pm.getLocalizationFile( LocalizationFile lf = null;
pm.getContext(contextType, LocalizationLevel.USER), for (LocalizationType contextType : contextTypes) {
newFilePath); LocalizationFile testFile = pm.getLocalizationFile(
pm.getContext(contextType, LocalizationLevel.USER),
newFilePath);
if (lf == null) {
lf = testFile;
} else if (!lf.exists()
&& (testFile.exists() || lf.isProtected())) {
/*
* If a file exists we want to overwrite it to avoid 2 files
* at the same level
*/
lf = testFile;
}
}
if ((lf != null) && !lf.isProtected()) { if ((lf != null) && !lf.isProtected()) {
localizationFiles.add(lf); localizationFiles.add(lf);
if (lf.exists()) { if (lf.exists()) {
existing.add(lf); existing.add(lf);
} }
} else { } else {
localizationFiles.add(null);
statusHandler statusHandler
.handle(Priority.WARN, .handle(Priority.WARN,
newFilePath newFilePath
@ -152,14 +172,14 @@ public class ImportFileAction extends Action {
} }
} }
List<LocalizationFile> skip = new ArrayList<LocalizationFile>(); List<ILocalizationFile> skip = new ArrayList<ILocalizationFile>();
if (existing.size() > 0) { if (existing.size() > 0) {
if (existing.size() > 1) { if (existing.size() > 1) {
MultiConfirmDialog dialog = new MultiConfirmDialog(existing); MultiConfirmDialog dialog = new MultiConfirmDialog(existing);
dialog.open(); dialog.open();
existing.removeAll(dialog.getConfirmedFiles()); existing.removeAll(dialog.getConfirmedFiles());
} else { } else {
LocalizationFile file = existing.get(0); ILocalizationFile file = existing.get(0);
if (MessageDialog.openConfirm(VizWorkbenchManager.getInstance() if (MessageDialog.openConfirm(VizWorkbenchManager.getInstance()
.getCurrentWindow().getShell(), "Confirm Overwrite", .getCurrentWindow().getShell(), "Confirm Overwrite",
String.format(FORMAT_STRING, file.getName(), file String.format(FORMAT_STRING, file.getName(), file
@ -174,10 +194,11 @@ public class ImportFileAction extends Action {
for (int i = 0; i < applicable.size(); ++i) { for (int i = 0; i < applicable.size(); ++i) {
File importFile = applicable.get(i); File importFile = applicable.get(i);
if (!localizationFiles.isEmpty()) { if (!localizationFiles.isEmpty()) {
LocalizationFile lf = localizationFiles.get(i); ILocalizationFile lf = localizationFiles.get(i);
if (skip.contains(lf) == false) { if (lf != null && skip.contains(lf) == false) {
try { try (SaveableOutputStream os = lf.openOutputStream()) {
lf.write(FileUtil.file2bytes(importFile)); os.write(FileUtil.file2bytes(importFile));
os.save();
++addCount; ++addCount;
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
@ -191,9 +212,9 @@ public class ImportFileAction extends Action {
private static class MultiConfirmDialog extends MessageDialog { private static class MultiConfirmDialog extends MessageDialog {
private final List<LocalizationFile> confirmedFiles; private final List<ILocalizationFile> confirmedFiles;
private final List<LocalizationFile> existingFiles; private final List<ILocalizationFile> existingFiles;
private int curIdx = 0; private int curIdx = 0;
@ -206,13 +227,13 @@ public class ImportFileAction extends Action {
* @param dialogButtonLabels * @param dialogButtonLabels
* @param defaultIndex * @param defaultIndex
*/ */
public MultiConfirmDialog(List<LocalizationFile> existingFiles) { public MultiConfirmDialog(List<ILocalizationFile> existingFiles) {
super(VizWorkbenchManager.getInstance().getCurrentWindow() super(VizWorkbenchManager.getInstance().getCurrentWindow()
.getShell(), "Confirm Overwrite", null, "", .getShell(), "Confirm Overwrite", null, "",
MessageDialog.CONFIRM, new String[] { "Yes To All", "No", MessageDialog.CONFIRM, new String[] { "Yes To All", "No",
"Cancel", "Yes" }, 0); "Cancel", "Yes" }, 0);
this.existingFiles = existingFiles; this.existingFiles = existingFiles;
this.confirmedFiles = new ArrayList<LocalizationFile>( this.confirmedFiles = new ArrayList<ILocalizationFile>(
existingFiles.size()); existingFiles.size());
setShellStyle(getShellStyle() | SWT.SHEET); setShellStyle(getShellStyle() | SWT.SHEET);
} }
@ -258,13 +279,6 @@ public class ImportFileAction extends Action {
} }
} }
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.dialogs.IconAndMessageDialog#createMessageArea(
* org.eclipse.swt.widgets.Composite)
*/
@Override @Override
protected Control createMessageArea(Composite composite) { protected Control createMessageArea(Composite composite) {
Control ctrl = super.createMessageArea(composite); Control ctrl = super.createMessageArea(composite);
@ -273,12 +287,12 @@ public class ImportFileAction extends Action {
} }
private void updateText() { private void updateText() {
LocalizationFile file = existingFiles.get(curIdx); ILocalizationFile file = existingFiles.get(curIdx);
messageLabel.setText(String.format(FORMAT_STRING, file.getName(), messageLabel.setText(String.format(FORMAT_STRING, file.getName(),
file.getContext().getLocalizationLevel())); file.getContext().getLocalizationLevel()));
} }
public List<LocalizationFile> getConfirmedFiles() { public List<ILocalizationFile> getConfirmedFiles() {
return confirmedFiles; return confirmedFiles;
} }
} }

View file

@ -31,7 +31,10 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.LocalizationUtil; import com.raytheon.uf.common.localization.LocalizationUtil;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.localization.filetreeview.LocalizationFileEntryData;
import com.raytheon.uf.viz.localization.service.ILocalizationService; import com.raytheon.uf.viz.localization.service.ILocalizationService;
/** /**
@ -44,7 +47,10 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 25, 2011 mschenke Initial creation * Mar 25, 2011 mschenke Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types.
*
* *
* </pre> * </pre>
* *
@ -53,20 +59,24 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
*/ */
public class MoveFileAction extends CopyToAction { public class MoveFileAction extends CopyToAction {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(MoveFileAction.class);
private DeleteAction delete; private final DeleteAction delete;
private IWorkbenchPage page; private final IWorkbenchPage page;
/** /**
* @param file * @param localizationFileEntryData
* .getFile()
*/ */
public MoveFileAction(IWorkbenchPage page, LocalizationFile file, public MoveFileAction(IWorkbenchPage page, LocalizationFileEntryData data,
ILocalizationService service) { ILocalizationService service) {
super(file, service); super(data, service);
setText("Move To"); setText("Move To");
this.page = page; this.page = page;
delete = new DeleteAction(page, new LocalizationFile[] { file }, false); delete = new DeleteAction(page,
new LocalizationFile[] { data.getFile() }, false);
setEnabled(delete.isEnabled()); setEnabled(delete.isEnabled());
} }
@ -104,7 +114,7 @@ public class MoveFileAction extends CopyToAction {
final LocalizationFile newFile = pm.getLocalizationFile( final LocalizationFile newFile = pm.getLocalizationFile(
pm.getContext(file.getContext().getLocalizationType(), pm.getContext(file.getContext().getLocalizationType(),
level), file.getName()); level), file.getName());
removeAlternateTypeFiles(level);
// Make sure we select the file after the drop // Make sure we select the file after the drop
final ILocalizationFileObserver[] observers = new ILocalizationFileObserver[1]; final ILocalizationFileObserver[] observers = new ILocalizationFileObserver[1];
ILocalizationFileObserver observer = new ILocalizationFileObserver() { ILocalizationFileObserver observer = new ILocalizationFileObserver() {

View file

@ -19,6 +19,8 @@
**/ **/
package com.raytheon.uf.viz.localization.perspective.view.actions; package com.raytheon.uf.viz.localization.perspective.view.actions;
import java.util.List;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.LocalizationContext; import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -39,6 +41,9 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 3, 2010 6305 mpduff Initial creation * Dec 3, 2010 6305 mpduff Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types.
*
* *
* </pre> * </pre>
* *
@ -54,7 +59,7 @@ public class PasteFileAction extends CopyToAction {
public PasteFileAction(ILocalizationService service, LocalizationFile file, public PasteFileAction(ILocalizationService service, LocalizationFile file,
LocalizationFileGroupData data) { LocalizationFileGroupData data) {
super(file, service); super(file, data.getPathData(), service);
setText("Paste To"); setText("Paste To");
this.dataToCopyTo = data; this.dataToCopyTo = data;
// Grab the level this file is protected at (if any) // Grab the level this file is protected at (if any)
@ -64,39 +69,26 @@ public class PasteFileAction extends CopyToAction {
} }
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.localization.perspective.view.actions.CopyToAction
* #isLevelEnabled
* (com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
* )
*/
@Override @Override
protected boolean isLevelEnabled(LocalizationLevel level) { protected boolean isLevelEnabled(LocalizationLevel level) {
return pasteToProtectedLevel == null return pasteToProtectedLevel == null
|| level.compareTo(pasteToProtectedLevel) <= 0; || level.compareTo(pasteToProtectedLevel) <= 0;
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.localization.filetreeview.actions.AbstractToAction
* #run
* (com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
* )
*/
@Override @Override
protected void run(LocalizationLevel level) { protected void run(LocalizationLevel level) {
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
LocalizationType type = dataToCopyTo.getPathData().getType(); List<LocalizationType> types = dataToCopyTo.getPathData().getTypes();
LocalizationType type = file.getContext().getLocalizationType();
if(!types.contains(type)){
type = types.get(0);
}
LocalizationContext ctx = pm.getContext(type, level); LocalizationContext ctx = pm.getContext(type, level);
LocalizationFile newFile = pm.getLocalizationFile(ctx, LocalizationFile newFile = pm.getLocalizationFile(ctx,
dataToCopyTo.getPath()); dataToCopyTo.getPath());
removeAlternateTypeFiles(level);
copyFile(newFile); copyFile(newFile);
} }
} }

View file

@ -19,6 +19,7 @@
**/ **/
package com.raytheon.uf.viz.localization.perspective.view.actions; package com.raytheon.uf.viz.localization.perspective.view.actions;
import java.io.InputStream;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
@ -36,6 +37,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.LocalizationUtil; import com.raytheon.uf.common.localization.LocalizationUtil;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.util.FileUtil; import com.raytheon.uf.common.util.FileUtil;
@ -52,7 +54,10 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 27, 2011 mschenke Initial creation * Apr 27, 2011 mschenke Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types.
*
* *
* </pre> * </pre>
* *
@ -186,8 +191,12 @@ public class RenameAction extends Action {
} }
} }
FileUtil.copyFile(file.getFile(), newFile.getFile()); try (InputStream is = file.openInputStream();
newFile.save(); SaveableOutputStream os = newFile
.openOutputStream()) {
FileUtil.copy(is, os);
os.save();
}
if (deleteOld) { if (deleteOld) {
file.delete(); file.delete();
} }

View file

@ -641,7 +641,7 @@ public class FFMPMonitor extends ResourceMonitor {
// times, prevents mosaic brittleness from occurring. // times, prevents mosaic brittleness from occurring.
retrieveNew = true; retrieveNew = true;
if (source.getGuidanceType().equals( if (source.getGuidanceType() != null && source.getGuidanceType().equals(
GUIDANCE_TYPE.ARCHIVE.getGuidanceType())) { GUIDANCE_TYPE.ARCHIVE.getGuidanceType())) {
isTimeConstraint = false; isTimeConstraint = false;
} else { } else {
@ -1265,18 +1265,22 @@ public class FFMPMonitor extends ResourceMonitor {
/** /**
* Gets the guidance source types. * Gets the guidance source types.
* *
* @param product
* @param guidSrc
* @param siteKey
* @param dataKey
* @param sourceName
* @param date * @param date
* @param phuc * @param phuc
* @param pfaf * @param pfaf
* @return * @return
* @throws VizException
*/ */
public FFMPBasin getGraphGuidanceBasin(ProductXML product, String siteKey, public FFMPBasin getGraphGuidanceBasin(ProductXML product, String guidSrc, String siteKey,
String dataKey, String sourceName, Date date, String phuc, Long pfaf) String dataKey, String sourceName, Date date, String phuc, Long pfaf)
throws VizException { throws VizException {
if (product != null) { if (product != null) {
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
.getGuidSrc();
SourceXML source = product.getGuidanceSourcesByType(guidSrc).get(0); SourceXML source = product.getGuidanceSourcesByType(guidSrc).get(0);
sourceName = source.getDisplayName(); sourceName = source.getDisplayName();
} }
@ -1542,6 +1546,7 @@ public class FFMPMonitor extends ResourceMonitor {
fproduct, type)) { fproduct, type)) {
// Don't purge archive guidance! // Don't purge archive guidance!
if (guidSource != null if (guidSource != null
&& guidSource.getGuidanceType() != null
&& !guidSource.getGuidanceType() && !guidSource.getGuidanceType()
.equals(GUIDANCE_TYPE.ARCHIVE .equals(GUIDANCE_TYPE.ARCHIVE
.getGuidanceType())) { .getGuidanceType())) {
@ -1709,7 +1714,7 @@ public class FFMPMonitor extends ResourceMonitor {
} }
} }
} }
System.out.println("Time spent initializing templates: " statusHandler.info("Time spent initializing templates: "
+ (System.currentTimeMillis() - t0)); + (System.currentTimeMillis() - t0));
} }

View file

@ -65,6 +65,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPGraphData;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 30, 2009 lvenable Initial creation * Sep 30, 2009 lvenable Initial creation
* Oct 10, 2015 4756 dhladky Dynamic bounding of Y axis.
* *
* </pre> * </pre>
* *
@ -272,6 +273,12 @@ public class BasinTrendGraph {
* Time duration. * Time duration.
*/ */
private TimeDuration timeDur = TimeDuration.ALL; private TimeDuration timeDur = TimeDuration.ALL;
/**
* Basin Trend Graph Bounds.
*/
private BasinTrendGraphBounds graphBounds;
/** /**
* Data to graph. * Data to graph.
@ -400,6 +407,8 @@ public class BasinTrendGraph {
* Initialize method. * Initialize method.
*/ */
private void init() { private void init() {
determineGraphBounds();
display = parentComp.getDisplay(); display = parentComp.getDisplay();
sdf.setTimeZone(TimeZone.getTimeZone("GMT")); sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
@ -807,35 +816,47 @@ public class BasinTrendGraph {
double yCoord = 0.0; double yCoord = 0.0;
String inchLbl; String inchLbl;
double inchDbl = timeDur.getYCoordHours(); double inchDbl = graphBounds.getYCoordValues();
int skip = graphBounds.getSkipValue();
int count = 0;
while (yCoord < graphImageHeight) { while (yCoord < graphImageHeight) {
if (inchDbl == timeDur.getYCoordHours()) {
gc.drawLine(leftIncCanvasWidth, doubleToInt(yCoord + 1.0),
leftIncCanvasWidth - dashLength,
doubleToInt(yCoord + 5.0));
inchLbl = String.format("%1.1f", inchDbl); // When counter == skip, allow graph to draw a label.
gc.drawString(inchLbl, leftIncCanvasWidth - dashLength - 3 if (count == skip) {
- (inchLbl.length() * fontWidth), // resets the counter
doubleToInt(yCoord + 5.0), true); if (yCoord > 1.0) {
} else { count = 0;
if (inchDbl != 0.0) { }
if (inchDbl == graphBounds.getYCoordValues()) {
gc.drawLine(leftIncCanvasWidth, doubleToInt(yCoord + 1.0), gc.drawLine(leftIncCanvasWidth, doubleToInt(yCoord + 1.0),
leftIncCanvasWidth - dashLength, leftIncCanvasWidth - dashLength,
doubleToInt(yCoord + 1.0)); doubleToInt(yCoord + 5.0));
inchLbl = String.format("%1.1f", inchDbl);
gc.drawString(inchLbl, leftIncCanvasWidth - dashLength - 3
- (inchLbl.length() * fontWidth),
doubleToInt(yCoord + 5.0), true);
} else {
if (inchDbl != 0.0) {
gc.drawLine(leftIncCanvasWidth,
doubleToInt(yCoord + 1.0), leftIncCanvasWidth
- dashLength, doubleToInt(yCoord + 1.0));
}
}
if (inchDbl != 0.0 && inchDbl != graphBounds.getYCoordValues()) {
inchLbl = String.format("%1.1f", inchDbl);
gc.drawString(inchLbl, leftIncCanvasWidth - dashLength - 3
- (inchLbl.length() * fontWidth),
doubleToInt(yCoord - aveFontHeight), true);
} }
} }
if (inchDbl != 0.0 && inchDbl != timeDur.getYCoordHours()) {
inchLbl = String.format("%1.1f", inchDbl);
gc.drawString(inchLbl, leftIncCanvasWidth - dashLength - 3
- (inchLbl.length() * fontWidth), doubleToInt(yCoord
- aveFontHeight), true);
}
yCoord += pixPerInc_YCoord; yCoord += pixPerInc_YCoord;
inchDbl -= 1.0; inchDbl -= 1.0;
count++;
} }
gc.drawLine(leftIncCanvasWidth, graphImageHeight + 1, gc.drawLine(leftIncCanvasWidth, graphImageHeight + 1,
@ -877,30 +898,42 @@ public class BasinTrendGraph {
double yCoord = 0.0; double yCoord = 0.0;
String inchLbl; String inchLbl;
double inchDbl = timeDur.getYCoordHours(); double inchDbl = graphBounds.getYCoordValues();
int skip = graphBounds.getSkipValue();
int count = 0;
while (yCoord < graphImageHeight) { while (yCoord < graphImageHeight) {
if (inchDbl == timeDur.getYCoordHours()) {
gc.drawLine(0, doubleToInt(yCoord + 1.0), dashLength,
doubleToInt(yCoord + 5.0));
inchLbl = String.format("%1.1f", inchDbl); // When counter == skip, allow graph to draw a label.
gc.drawString(inchLbl, 10, doubleToInt(yCoord + 5.0), true); if (count == skip) {
} else { // resets the counter
if (inchDbl != 0.0) { if (yCoord > 1.0) {
gc.drawLine(0, doubleToInt(yCoord + 1.0), dashLength, count = 0;
doubleToInt(yCoord + 1.0));
} }
}
if (inchDbl != 0.0 && inchDbl != timeDur.getYCoordHours()) { if (inchDbl == graphBounds.getYCoordValues()) {
inchLbl = String.format("%1.1f", inchDbl); gc.drawLine(0, doubleToInt(yCoord + 1.0), dashLength,
gc.drawString(inchLbl, 10, doubleToInt(yCoord - aveFontHeight), doubleToInt(yCoord + 5.0));
true); inchLbl = String.format("%1.1f", inchDbl);
gc.drawString(inchLbl, 10, doubleToInt(yCoord + 5.0), true);
} else {
if (inchDbl != 0.0) {
gc.drawLine(0, doubleToInt(yCoord + 1.0), dashLength,
doubleToInt(yCoord + 1.0));
}
}
if (inchDbl != 0.0 && inchDbl != graphBounds.getYCoordValues()) {
inchLbl = String.format("%1.1f", inchDbl);
gc.drawString(inchLbl, 10, doubleToInt(yCoord
- aveFontHeight), true);
}
} }
yCoord += pixPerInc_YCoord; yCoord += pixPerInc_YCoord;
inchDbl -= 1.0; inchDbl -= 1.0;
count++;
} }
gc.drawLine(0, graphImageHeight + 1, dashLength, graphImageHeight - 5); gc.drawLine(0, graphImageHeight + 1, dashLength, graphImageHeight - 5);
@ -986,7 +1019,7 @@ public class BasinTrendGraph {
* Draw horizontal black & grey grid lines. * Draw horizontal black & grey grid lines.
*/ */
double yCoord = 0.0; double yCoord = 0.0;
int hours = timeDur.getYCoordHours(); int hours = graphBounds.getYCoordValues();
for (int i = 0; i < hours; i++) { for (int i = 0; i < hours; i++) {
gc.setForeground(display.getSystemColor(SWT.COLOR_GRAY)); gc.setForeground(display.getSystemColor(SWT.COLOR_GRAY));
@ -1225,7 +1258,7 @@ public class BasinTrendGraph {
/* /*
* Loop and draw the remaining hour labels. * Loop and draw the remaining hour labels.
*/ */
for (int i = 0; i <= timeDur.getHours(); i += pixelMultiplier) { for (int i = 0; i <= graphBounds.getHours(); i += pixelMultiplier) {
if (graphQPF == true && counter == 1) { if (graphQPF == true && counter == 1) {
transparent = false; transparent = false;
gc.drawLine(newXCoord, 0, newXCoord, 6); gc.drawLine(newXCoord, 0, newXCoord, 6);
@ -2117,7 +2150,7 @@ public class BasinTrendGraph {
int x = 0; int x = 0;
int y = 0; int y = 0;
Double guid = this.getGuidForHour(timeDur.getHours()); Double guid = this.getGuidForHour(graphBounds.getHours());
ArrayList<Double> timesArray = new ArrayList<Double>(getQPEGraphTimes()); ArrayList<Double> timesArray = new ArrayList<Double>(getQPEGraphTimes());
double offset = getQPEValueNearStartTimeOffset(); double offset = getQPEValueNearStartTimeOffset();
@ -2284,7 +2317,7 @@ public class BasinTrendGraph {
int x = 0; int x = 0;
int y = 0; int y = 0;
Double guid = this.getGuidForHour(timeDur.getHours()); Double guid = this.getGuidForHour(graphBounds.getHours());
ArrayList<Double> timesArray = new ArrayList<Double>(getQPEGraphTimes()); ArrayList<Double> timesArray = new ArrayList<Double>(getQPEGraphTimes());
double offset = getQPEValueNearStartTimeOffset(); double offset = getQPEValueNearStartTimeOffset();
@ -2423,8 +2456,8 @@ public class BasinTrendGraph {
double maxGuid = Double.MIN_VALUE; double maxGuid = Double.MIN_VALUE;
if (timesArray.contains((double) timeDur.getHours()) == true) { if (timesArray.contains((double) graphBounds.getHours()) == true) {
maxGuid = graphData.getGuid((double) timeDur.getHours()); maxGuid = graphData.getGuid((double) graphBounds.getHours());
if (Double.isNaN(maxGuid) == true || maxGuid < 0.0) { if (Double.isNaN(maxGuid) == true || maxGuid < 0.0) {
return; return;
@ -2492,7 +2525,7 @@ public class BasinTrendGraph {
* @return Array of QPE graph times. * @return Array of QPE graph times.
*/ */
private ArrayList<Double> getQPEGraphTimes() { private ArrayList<Double> getQPEGraphTimes() {
int hrs = timeDur.getHours(); int hrs = graphBounds.getHours();
/* /*
* If qpf is selected then adjust the hours. For example: hour = 24 then * If qpf is selected then adjust the hours. For example: hour = 24 then
@ -2523,7 +2556,7 @@ public class BasinTrendGraph {
* @return Array of QPE graph times. * @return Array of QPE graph times.
*/ */
private ArrayList<Double> getRateGraphTimes() { private ArrayList<Double> getRateGraphTimes() {
int hrs = timeDur.getHours(); int hrs = graphBounds.getHours();
/* /*
* If qpf is selected then adjust the hours. For example: hour = 24 then * If qpf is selected then adjust the hours. For example: hour = 24 then
@ -2598,8 +2631,8 @@ public class BasinTrendGraph {
graphImageHeight = graphViewHeight; graphImageHeight = graphViewHeight;
} }
pixPerInc_XCoord = graphImageWidth / (double) timeDur.getHours(); pixPerInc_XCoord = graphImageWidth / (double) graphBounds.getHours();
pixPerInc_YCoord = graphImageHeight / (double) timeDur.getYCoordHours(); pixPerInc_YCoord = graphImageHeight / (double) graphBounds.getYCoordValues();
} }
/** /**
@ -2611,17 +2644,6 @@ public class BasinTrendGraph {
graphCanvas.redraw(); graphCanvas.redraw();
} }
/**
* Redraw the left side canvas.
*/
private void redrawLeftRightIncCanvases() {
this.createLeftIncImage();
leftIncCanvas.redraw();
this.createRightIncImage();
rightIncCanvas.redraw();
}
/** /**
* Redraw the bottom increment canvas. * Redraw the bottom increment canvas.
*/ */
@ -2734,17 +2756,11 @@ public class BasinTrendGraph {
*/ */
public void setGraphData(FFMPGraphData graphData) { public void setGraphData(FFMPGraphData graphData) {
// System.out.println("in BasinTrendGraph.setGraphData");
this.graphData = graphData; this.graphData = graphData;
determineGraphBounds();
redrawGraphCanvas(); recalcPixelsIncrements();
regenerateImages();
// This should correctly update the increment labels when new data comes redrawAllCanvases();
// in.
redrawLeftRightIncCanvases();
// Update the bottom time canvas.
redrawBottomIncCanvas();
} }
/** /**
@ -2789,4 +2805,19 @@ public class BasinTrendGraph {
redrawGraphCanvas(); redrawGraphCanvas();
redrawBottomIncCanvas(); redrawBottomIncCanvas();
} }
/**
* Set the X and Y bounds of the graph.
*/
private void determineGraphBounds() {
graphBounds = new BasinTrendGraphBounds();
// maximum data value
double max = graphData.getMaximumValue();
int yMaxHeight = (int) Math.round(max+1);
graphBounds.setYCoordValues(yMaxHeight);
graphBounds.setHours(this.timeDur.getHours());
graphBounds.setTimeDurName(this.timeDur.getTimeDurName());
}
} }

View file

@ -0,0 +1,105 @@
/**
* 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.monitor.ffmp.ui.dialogs;
/**
* This class sets the Basin Trend Graph's boundaries.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 10, 2015 4756 dhladky Initial creation
*
* </pre>
*
* @author dhladky
* @version 1.0
*/
public class BasinTrendGraphBounds {
/** name of the graph **/
private String timeDurName;
/** hours, (X Axis) **/
private int hours;
/** number of y Coordinate values **/
private int yCoordValues;
public BasinTrendGraphBounds() {
}
public String getTimeDurName()
{
return timeDurName;
}
public int getHours()
{
return hours;
}
public int getYCoordValues()
{
return yCoordValues;
}
public void setYCoordValues(int yCoordValues) {
this.yCoordValues = yCoordValues;
}
public void setTimeDurName(String timeDurName) {
this.timeDurName = timeDurName;
}
public void setHours(int hours) {
this.hours = hours;
}
/**
* Gets the label skipping for the Y axis of the Basin trend Graph
* @return int
*/
public int getSkipValue() {
int skip = 0;
if (yCoordValues > 0) {
if (yCoordValues >= 50 && yCoordValues < 100) {
skip = 2;
} else if (yCoordValues >= 100 && yCoordValues < 200) {
skip = 5;
} else if (yCoordValues >= 200 && yCoordValues < 300) {
skip = 10;
} else if (yCoordValues >= 300 && yCoordValues < 500) {
skip = 20;
} else if (yCoordValues >= 500) {
skip = 50;
}
}
return skip;
}
}

View file

@ -24,6 +24,7 @@ import java.util.List;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates; import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
import com.raytheon.uf.common.monitor.config.FFFGDataMgr; import com.raytheon.uf.common.monitor.config.FFFGDataMgr;
import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager; import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager;
@ -45,6 +46,7 @@ import com.raytheon.uf.common.monitor.xml.SourceXML;
* 05/10/13 1919 mpduff If there are forced pfafs then the aggregate is forced. * 05/10/13 1919 mpduff If there are forced pfafs then the aggregate is forced.
* 05/22/13 1902 mpduff Added methods to get forced values. * 05/22/13 1902 mpduff Added methods to get forced values.
* 06/17/13 2085 njensen Made forceIt() more thread safe * 06/17/13 2085 njensen Made forceIt() more thread safe
* 12 Oct, 2015 4948 dhladky Simplified Forcings, forcings now work for interpolated "fake" guidance.
* *
* </pre> * </pre>
* *
@ -118,6 +120,14 @@ public class FFFGForceUtil {
return forceIt(ft, cBasin, pfafList, "NA"); return forceIt(ft, cBasin, pfafList, "NA");
} }
/**
* Force values for this given basin
* @param ft
* @param cBasin
* @param pfafList
* @param domain
* @return
*/
private ForceUtilResult forceIt(FFMPTemplates ft, FFMPBasin cBasin, private ForceUtilResult forceIt(FFMPTemplates ft, FFMPBasin cBasin,
List<Long> pfafList, String domain) { List<Long> pfafList, String domain) {
boolean forced = false; boolean forced = false;
@ -219,6 +229,13 @@ public class FFFGForceUtil {
return retVal; return retVal;
} }
/**
* Get list of forced FFG basins
* @param source
* @param pfafList2
* @param ft
* @return
*/
private ArrayList<Long> getForcedBasins(String source, private ArrayList<Long> getForcedBasins(String source,
List<Long> pfafList2, FFMPTemplates ft) { List<Long> pfafList2, FFMPTemplates ft) {
FFFGDataMgr fdm = FFFGDataMgr.getInstance(); FFFGDataMgr fdm = FFFGDataMgr.getInstance();
@ -247,6 +264,15 @@ public class FFFGForceUtil {
return forcedList; return forcedList;
} }
/**
* Average forced FFG value for list of aggregate pfafs.
* @param pfafList
* @param forcedPfafs
* @param interpolation
* @param expiration
* @param templates
* @return
*/
public float getAvgForcedValue(List<Long> pfafList, List<Long> forcedPfafs, public float getAvgForcedValue(List<Long> pfafList, List<Long> forcedPfafs,
FFMPGuidanceInterpolation interpolation, long expiration, FFMPGuidanceInterpolation interpolation, long expiration,
FFMPTemplates templates) { FFMPTemplates templates) {
@ -267,10 +293,8 @@ public class FFFGForceUtil {
return tvalue / i; return tvalue / i;
} else { } else {
// TODO interpolated code under new ticket return getInterpolatedForcedValue(interpolation, templates, forcedPfafs, INTERPOLATION_TYPE.AVG)/forcedPfafs.size();
} }
return Float.NaN;
} }
/** /**
@ -301,17 +325,16 @@ public class FFFGForceUtil {
value = dman.adjustValue(Float.NaN, value = dman.adjustValue(Float.NaN,
interpolation.getStandardSource(), pfaf, countyFips); interpolation.getStandardSource(), pfaf, countyFips);
if (value < tvalue) { if (value > tvalue) {
tvalue = value; tvalue = value;
} }
} }
return tvalue; return tvalue;
} else {
// TODO interpolated code
}
return Float.NaN; } else {
return getInterpolatedForcedValue(interpolation, templates, forcedPfafs, INTERPOLATION_TYPE.MAX);
}
} }
/** /**
@ -340,21 +363,273 @@ public class FFFGForceUtil {
public List<Float> getForcedGuidValues(List<Long> pfafList, public List<Float> getForcedGuidValues(List<Long> pfafList,
List<Long> forcedPfafs, List<Long> forcedPfafs,
FFMPGuidanceInterpolation ffmpGuidanceInterpolation, FFMPGuidanceInterpolation ffmpGuidanceInterpolation,
long guidSourceExpiration, FFMPTemplates ft) { long guidSourceExpiration, FFMPTemplates ft, String huc) {
List<Float> guidList = new ArrayList<Float>(); List<Float> guidList = new ArrayList<Float>();
if (pfafList != null) { if (pfafList != null) {
for (Long pfaf : pfafList) { if (huc.equals(FFMPRecord.ALL) || huc.equals(FFMPRecord.COUNTY)) {
if (pfaf == null) { // Add all pfafs in list
continue; for (Long pfaf : pfafList) {
if (pfaf == null) {
continue;
}
List<Long> pl = new ArrayList<Long>();
pl.add(pfaf);
float val = getAvgForcedValue(pl, forcedPfafs,
ffmpGuidanceInterpolation, guidSourceExpiration, ft);
guidList.add(val);
} }
} else {
List<Long> pl = new ArrayList<Long>(); // Only add aggregate value to guidList for numbered hucs (second pfaf in list for forcing).
pl.add(pfaf); if (pfafList.get(1) != null) {
float val = getAvgForcedValue(pl, forcedPfafs, List<Long> pl = new ArrayList<Long>();
ffmpGuidanceInterpolation, guidSourceExpiration, ft); pl.add(pfafList.get(1));
guidList.add(val); float val = getAvgForcedValue(pl, forcedPfafs,
} ffmpGuidanceInterpolation, guidSourceExpiration, ft);
guidList.add(val);
}
}
} }
return guidList; return guidList;
} }
/**
* Calculate Interpolation of forced values for group of basins
*
* @param interpolation
* @param templates
* @param forcedPfafs
* @param type
* @return
*/
private Float getInterpolatedForcedValue(
FFMPGuidanceInterpolation interpolation, FFMPTemplates templates,
List<Long> forcedPfafs, INTERPOLATION_TYPE type) {
float value1 = 0.0f;
float value2 = 0.0f;
String source1 = interpolation.getSource1();
String source2 = interpolation.getSource2();
double ratioOffset = interpolation.getInterpolationOffset();
Float adjValue1 = 0.0f;
Float adjValue2 = 0.0f;
Float guidance = Float.NaN;
Float tvalue = 0.0f;
// interpolate from zero to first guidance
if (source1.equals(source2)) {
if ((ratioOffset == Double.NaN) || (ratioOffset == 0.0)) {
adjValue2 = Float.NaN;
}
FFFGDataMgr dman = FFFGDataMgr.getInstance();
for (long pfaf : forcedPfafs) {
long countyFips = templates.getCountyFipsByPfaf(pfaf);
templates.getCountyFipsByPfaf(pfaf);
if (dman.isExpired() == false) {
adjValue2 = dman.adjustValue(adjValue2, source2, pfaf,
countyFips);
}
if (!adjValue2.isNaN()) {
value2 = adjValue2.floatValue();
}
// straight from awips1 code ( FFMPdataUtils.C )
// We have an extrapolation to zero (the low side).
// The formula below yields:
// coeff = 0.62 for 0.25 time frame (endpoints.second)
// coeff = 0.75 for 0.50 time frame (endpoints.second)
// coeff = 0.88 for 0.75 time frame (endpoints.second)
// coeff = 0.95 for 0.90 time frame (endpoints.second)
// float mid, frac;
// mid = endpoints.second / 2.0;
// frac = 1.0 - ( ( duration - mid ) / mid );
// coeff = ( duration / endpoints.second ) + (0.25 * frac);
if ((interpolation.getHour(source1) == 0)
|| (source1.equals(source2) && (interpolation
.getHour(source2) == 1))) {
Double ratio = new Double(ratioOffset);
if (ratio.equals(.25)) {
guidance = (float) (.62 * value2);
} else if (ratio.equals(.5)) {
guidance = (float) (.75 * value2);
} else if (ratio.equals(.75)) {
guidance = (float) (.88 * value2);
} else if (ratio.equals(.9)) {
guidance = (float) (.95 * value2);
}
}
if (type == INTERPOLATION_TYPE.MAX) {
if (guidance > tvalue) {
tvalue = guidance;
}
} else if (type == INTERPOLATION_TYPE.AVG) {
tvalue += guidance;
}
}// otherwise interpolate linearly I guess
} else {
// check if values at the source do not exist
FFFGDataMgr dman = FFFGDataMgr.getInstance();
for (long pfaf : forcedPfafs) {
long countyFips = templates.getCountyFipsByPfaf(pfaf);
templates.getCountyFipsByPfaf(pfaf);
if (dman.isExpired() == false) {
adjValue1 = dman.adjustValue(adjValue1, source1, pfaf,
countyFips);
}
if (!adjValue1.isNaN()) {
value1 = adjValue1.floatValue();
}
if (dman.isExpired() == false) {
adjValue2 = dman.adjustValue(adjValue2, source2, pfaf,
countyFips);
}
if (!adjValue2.isNaN()) {
value2 = adjValue2.floatValue();
}
if ((value1 == Float.NaN) || (value2 == Float.NaN)) {
guidance = Float.NaN;
}
guidance = (float) (value1 + ((value2 - value1) * ratioOffset));
if (type == INTERPOLATION_TYPE.MAX) {
if (guidance > tvalue) {
tvalue = guidance;
}
} else if (type == INTERPOLATION_TYPE.AVG) {
tvalue += guidance;
}
}
}
return tvalue;
}
/**
* Find forced value for individual basin
*
* @param templates
* @param cBasinPfaf
* @param guidType
* @return
*/
public Float getInterpolatedForcedValue(FFMPTemplates templates,
long cBasinPfaf, String guidType) {
float value1 = 0.0f;
float value2 = 0.0f;
FFMPGuidanceInterpolation interpolate = resource
.getGuidanceInterpolators().get(guidType);
String source1 = interpolate.getSource1();
String source2 = interpolate.getSource2();
double ratioOffset = interpolate.getInterpolationOffset();
Float adjValue1 = 0.0f;
Float adjValue2 = 0.0f;
float guidance = 0.0f;
// interpolate from zero to first guidance
if (source1.equals(source2)) {
if ((ratioOffset == Double.NaN) || (ratioOffset == 0.0)) {
adjValue2 = Float.NaN;
}
FFFGDataMgr dman = FFFGDataMgr.getInstance();
if (dman.isExpired() == false) {
adjValue2 = dman
.adjustValue(adjValue2, source2, cBasinPfaf, 0l);
}
if (!adjValue2.isNaN()) {
value2 = adjValue2.floatValue();
}
// straight from awips1 code ( FFMPdataUtils.C )
// We have an extrapolation to zero (the low side).
// The formula below yields:
// coeff = 0.62 for 0.25 time frame (endpoints.second)
// coeff = 0.75 for 0.50 time frame (endpoints.second)
// coeff = 0.88 for 0.75 time frame (endpoints.second)
// coeff = 0.95 for 0.90 time frame (endpoints.second)
// float mid, frac;
// mid = endpoints.second / 2.0;
// frac = 1.0 - ( ( duration - mid ) / mid );
// coeff = ( duration / endpoints.second ) + (0.25 * frac);
if ((interpolate.getHour(source1) == 0)
|| (source1.equals(source2) && (interpolate
.getHour(source2) == 1))) {
Double ratio = new Double(ratioOffset);
if (ratio.equals(.25)) {
guidance = (float) (.62 * value2);
} else if (ratio.equals(.5)) {
guidance = (float) (.75 * value2);
} else if (ratio.equals(.75)) {
guidance = (float) (.88 * value2);
} else if (ratio.equals(.9)) {
guidance = (float) (.95 * value2);
}
}
// otherwise interpolate linearly I guess
} else {
// check if values at the source do not exist
FFFGDataMgr dman = FFFGDataMgr.getInstance();
if (dman.isExpired() == false) {
adjValue1 = dman
.adjustValue(adjValue1, source1, cBasinPfaf, 0l);
}
if (!adjValue1.isNaN()) {
value1 = adjValue1.floatValue();
}
if (dman.isExpired() == false) {
adjValue2 = dman
.adjustValue(adjValue2, source2, cBasinPfaf, 0l);
}
if (!adjValue2.isNaN()) {
value2 = adjValue2.floatValue();
}
if ((value1 == Float.NaN) || (value2 == Float.NaN)) {
guidance = Float.NaN;
}
guidance = (float) (value1 + ((value2 - value1) * ratioOffset));
}
return guidance;
}
/**
*
* INTERPOLATION type MAX, AVG
*
* @author dhladky
* @version 1.0
*/
public enum INTERPOLATION_TYPE {
MAX("MAX"), AVG("AVG");
private final String itype;
private INTERPOLATION_TYPE(String name) {
itype = name;
}
public String getInterpolationType() {
return itype;
}
};
} }

View file

@ -37,6 +37,7 @@ import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 04/23/10 4494 D. Hladky Initial release * 04/23/10 4494 D. Hladky Initial release
* 02/01/13 1569 D. Hladky Added constants * 02/01/13 1569 D. Hladky Added constants
* Oct 10, 2015 4756 dhladky Max value method.
* *
* </pre> * </pre>
* *
@ -350,4 +351,40 @@ public class FFMPGraphData {
public void setQpfValue(Float qpfValue) { public void setQpfValue(Float qpfValue) {
this.qpfValue = qpfValue; this.qpfValue = qpfValue;
} }
/**
* Find the maximum value of the data for the graph
* @return Double
*/
public Double getMaximumValue() {
Double max = 0.0;
for (Double d : qpes.values()) {
if (d > max) {
max = d;
}
}
for (Double d : qpfs.values()) {
if (d > max) {
max = d;
}
}
for (Double d : rates.values()) {
if (d > max) {
max = d;
}
}
for (Double d : guids.values()) {
if (d > max) {
max = d;
}
}
return max;
}
} }

View file

@ -3189,15 +3189,12 @@ public class FFMPResource extends
ITimer timer = TimeUtil.getTimer(); ITimer timer = TimeUtil.getTimer();
timer.start(); timer.start();
FfmpTableConfig tableConfig = FfmpTableConfig.getInstance(); FfmpTableConfig tableConfig = FfmpTableConfig.getInstance();
String ffgGraphType = tableConfig.getTableConfigData(getSiteKey()) String ffgGraphType = tableConfig.getTableConfigData(getSiteKey()).getFfgGraphType();
.getFfgGraphType();
Long basinPfaf = null; Long basinPfaf = null;
Long dataId = null; Long dataId = null;
FFMPVirtualGageBasinMetaData fvgbmd = null; FFMPVirtualGageBasinMetaData fvgbmd = null;
FFMPBasin basin = null; FFMPBasin basin = null;
// System.out.println("*************************************************");
try { try {
basinPfaf = Long.parseLong(pfafString); basinPfaf = Long.parseLong(pfafString);
dataId = basinPfaf; dataId = basinPfaf;
@ -3210,12 +3207,7 @@ public class FFMPResource extends
} }
FFMPBasinMetaData mBasin = monitor.getTemplates(getSiteKey()).getBasin( FFMPBasinMetaData mBasin = monitor.getTemplates(getSiteKey()).getBasin(
getSiteKey(), basinPfaf); /* getSiteKey(), basinPfaf);
* TODO: mBasin is never used so it is
* not clear if this should be
* basinPfaf or dataId
*/
FFMPGraphData fgd = null; FFMPGraphData fgd = null;
// VGB // VGB
if (fvgbmd != null) { if (fvgbmd != null) {
@ -3237,8 +3229,8 @@ public class FFMPResource extends
Date oldestRefTime = getOldestTime(); Date oldestRefTime = getOldestTime();
Date mostRecentRefTime = getPaintTime().getRefTime(); Date mostRecentRefTime = getPaintTime().getRefTime();
Date barrierTime = getTableTime();// DR 16148 Date barrierTime = getTableTime();
Date minUriTime = getTimeOrderedKeys().get(0);// DR 16148 Date minUriTime = getTimeOrderedKeys().get(0);
// grabs the basins we need // grabs the basins we need
try { try {
@ -3267,7 +3259,7 @@ public class FFMPResource extends
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing RATE dataset."); "FFMPMonitor: getGraphData(): missing RATE dataset.", e);
} }
try { try {
qpeBasin = monitor.getGraphQPEBasin(getProduct(), getSiteKey(), qpeBasin = monitor.getGraphQPEBasin(getProduct(), getSiteKey(),
@ -3300,7 +3292,7 @@ public class FFMPResource extends
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing QPE dataset."); "FFMPMonitor: getGraphData(): missing QPE dataset.", e);
} }
try { try {
@ -3324,25 +3316,15 @@ public class FFMPResource extends
double dtime = FFMPGuiUtils.getTimeDiff(mostRecentRefTime, double dtime = FFMPGuiUtils.getTimeDiff(mostRecentRefTime,
date); date);
// TODO - START
// Float qpf =
// monitor.getq.get(qpfBasin.getPfaf()).getValue(
// monitor.getQpfWindow().getBeforeTime(),
// monitor.getQpfWindow().getAfterTime());
// TODO - END
fgd.setQpf(dtime, (double) qpfBasin.getValue(date)); fgd.setQpf(dtime, (double) qpfBasin.getValue(date));
qpfTimes.add(dtime); qpfTimes.add(dtime);
// System.out.println("Have a time for QPF: " + dtime
// + " value: " + (double) qpfBasin.getValue(date));
} }
} }
fgd.setQpfTimes(qpfTimes); fgd.setQpfTimes(qpfTimes);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing QPF dataset."); "FFMPMonitor: getGraphData(): missing QPF dataset.", e);
} }
FFMPGuidanceInterpolation guidanceInterpolator = new FFMPGuidanceInterpolation( FFMPGuidanceInterpolation guidanceInterpolator = new FFMPGuidanceInterpolation(
@ -3354,7 +3336,7 @@ public class FFMPResource extends
try { try {
guidBasin = (FFMPGuidanceBasin) monitor.getGraphGuidanceBasin( guidBasin = (FFMPGuidanceBasin) monitor.getGraphGuidanceBasin(
getProduct(), getSiteKey(), getDataKey(), null, getProduct(), ffgGraphType, getSiteKey(), getDataKey(), null,
oldestRefTime, FFMPRecord.ALL, basinPfaf); oldestRefTime, FFMPRecord.ALL, basinPfaf);
ArrayList<Double> guidTimes = new ArrayList<Double>(); ArrayList<Double> guidTimes = new ArrayList<Double>();
for (SourceXML ffgSource : getProduct().getGuidanceSourcesByType( for (SourceXML ffgSource : getProduct().getGuidanceSourcesByType(
@ -3377,7 +3359,7 @@ public class FFMPResource extends
guid = true; guid = true;
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing GUIDANCE dataset."); "FFMPMonitor: getGraphData(): missing GUIDANCE dataset.", e);
} }
if (fvgbmd != null) { if (fvgbmd != null) {
@ -3389,10 +3371,6 @@ public class FFMPResource extends
mostRecentRefTime); mostRecentRefTime);
if (virtualBasin != null) { if (virtualBasin != null) {
// System.out.println("VGB DATA EXISTS! " + pfaf +
// " "
// + lid);
SortedSet<Date> vgbTimes = new TreeSet<Date>(virtualBasin SortedSet<Date> vgbTimes = new TreeSet<Date>(virtualBasin
.getValues().descendingKeySet()); .getValues().descendingKeySet());
@ -3409,7 +3387,7 @@ public class FFMPResource extends
} catch (Exception e) { } catch (Exception e) {
statusHandler statusHandler
.handle(Priority.PROBLEM, .handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing VIRTUAL dataset."); "FFMPMonitor: getGraphData(): missing VIRTUAL dataset.", e);
} }
} }
@ -3452,14 +3430,6 @@ public class FFMPResource extends
ratio = FFMPUtils.getRatioValue(qpev, guidancev); ratio = FFMPUtils.getRatioValue(qpev, guidancev);
} }
// System.out.println("----------------------------------");
// System.out.println("guid is: " + guid);
// System.out.println(">>> graphTime: = " + fgdQpeTime);
// System.out.println(">>> qpev = " + qpev);
// System.out.println(">>> guidancev = " + guidancev);
// System.out.println(">>> diff = " + diff);
// System.out.println(">>> ratio = " + ratio);
fgd.setRatio(fgdQpeTime, ratio); fgd.setRatio(fgdQpeTime, ratio);
fgd.setDiff(fgdQpeTime, diff); fgd.setDiff(fgdQpeTime, diff);

View file

@ -29,7 +29,6 @@ import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData; import com.raytheon.uf.common.dataplugin.ffmp.FFMPBasinMetaData;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin; import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceBasin;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord; import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS; import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord.FIELDS;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates; import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
@ -62,6 +61,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FfmpTableConfigData;
* Jun 11, 2013 2085 njensen Initial creation * Jun 11, 2013 2085 njensen Initial creation
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL * Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
* Apr 30, 2014 2060 njensen Safety checks for null guidance * Apr 30, 2014 2060 njensen Safety checks for null guidance
* Oct 12, 2015 4948 dhladky Improved forced FFG handling.
* *
* </pre> * </pre>
* *
@ -594,6 +594,7 @@ public class FFMPRowGenerator implements Runnable {
// run over each guidance type // run over each guidance type
int i = 0; int i = 0;
for (String guidType : guidBasins.keySet()) { for (String guidType : guidBasins.keySet()) {
guidance = Float.NaN; guidance = Float.NaN;
diffValue = Float.NaN; diffValue = Float.NaN;
ratioValue = Float.NaN; ratioValue = Float.NaN;
@ -690,7 +691,7 @@ public class FFMPRowGenerator implements Runnable {
resource.getGuidanceInterpolators().get( resource.getGuidanceInterpolators().get(
guidType), resource guidType), resource
.getGuidSourceExpiration(guidType), .getGuidSourceExpiration(guidType),
ft); ft, huc);
} }
if ((!qpes.isEmpty()) if ((!qpes.isEmpty())
@ -927,84 +928,8 @@ public class FFMPRowGenerator implements Runnable {
} }
} }
} else { } else {
guidance = forceUtil.getInterpolatedForcedValue(ft, cBasinPfaf,
float value1 = 0.0f; guidType);
float value2 = 0.0f;
FFMPGuidanceInterpolation interpolate = resource.getGuidanceInterpolators().get(guidType);
String source1 = interpolate.getSource1();
String source2 = interpolate.getSource2();
double ratioOffset = interpolate.getInterpolationOffset();
Float adjValue1 = 0.0f;
Float adjValue2 = 0.0f;
// interpolate from zero to first guidance
if (source1.equals(source2)) {
if ((ratioOffset == Double.NaN) || (ratioOffset == 0.0)) {
adjValue2 = Float.NaN;
}
FFFGDataMgr dman = FFFGDataMgr.getInstance();
if (dman.isExpired() == false) {
adjValue2 = dman.adjustValue(adjValue2, source2, cBasinPfaf, 0l);
}
if (!adjValue2.isNaN()) {
value2 = adjValue2.floatValue();
}
// straight from awips1 code ( FFMPdataUtils.C )
// We have an extrapolation to zero (the low side).
// The formula below yields:
// coeff = 0.62 for 0.25 time frame (endpoints.second)
// coeff = 0.75 for 0.50 time frame (endpoints.second)
// coeff = 0.88 for 0.75 time frame (endpoints.second)
// coeff = 0.95 for 0.90 time frame (endpoints.second)
// float mid, frac;
// mid = endpoints.second / 2.0;
// frac = 1.0 - ( ( duration - mid ) / mid );
// coeff = ( duration / endpoints.second ) + (0.25 * frac);
if ((interpolate.getHour(source1) == 0)
|| (source1.equals(source2) && (interpolate
.getHour(source2) == 1))) {
Double ratio = new Double(ratioOffset);
if (ratio.equals(.25)) {
guidance = (float) (.62 * value2);
} else if (ratio.equals(.5)) {
guidance = (float) (.75 * value2);
} else if (ratio.equals(.75)) {
guidance = (float) (.88 * value2);
} else if (ratio.equals(.9)) {
guidance = (float) (.95 * value2);
}
}
// otherwise interpolate linearly I guess
} else {
// check if values at the source do not exist
FFFGDataMgr dman = FFFGDataMgr.getInstance();
if (dman.isExpired() == false) {
adjValue1 = dman.adjustValue(adjValue1, source1, cBasinPfaf, 0l);
}
if (!adjValue1.isNaN()) {
value1 = adjValue1.floatValue();
}
if (dman.isExpired() == false) {
adjValue2 = dman.adjustValue(adjValue2, source2, cBasinPfaf, 0l);
}
if (!adjValue2.isNaN()) {
value2 = adjValue2.floatValue();
}
if ((value1 == Float.NaN) || (value2 == Float.NaN)) {
guidance = Float.NaN;
}
guidance = (float)(value1 + ((value2 - value1) * ratioOffset));
}
} }
return new FFMPTableCellData(FIELDS.GUIDANCE, guidance, forced); return new FFMPTableCellData(FIELDS.GUIDANCE, guidance, forced);

View file

@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.Status;
@ -35,19 +34,16 @@ import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT; import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.geospatial.SpatialException; import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.common.monitor.MonitorAreaUtils; import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.IMonitor; import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.Monitor; import com.raytheon.uf.viz.monitor.Monitor;
import com.raytheon.uf.viz.monitor.ObsMonitor; import com.raytheon.uf.viz.monitor.ObsMonitor;
@ -91,7 +87,8 @@ import com.vividsolutions.jts.geom.Geometry;
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Sep 23, 2014 3356 njensen Remove unnecessary import * Sep 23, 2014 3356 njensen Remove unnecessary import
* Mar 09, 2014 3888 dhladky Stopped processing when dialogs are null or disposed. * Mar 09, 2014 3888 dhladky Stopped processing when dialogs are null or disposed.
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager. * Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage.
*
* *
* </pre> * </pre>
* *
@ -139,34 +136,19 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
private final TableData stationTableData = new TableData( private final TableData stationTableData = new TableData(
CommonConfig.AppName.FOG); CommonConfig.AppName.FOG);
/** All FOG's datauri start with this **/
private final String OBS = "fssobs";
/** List of fogAlg listeners **/ /** List of fogAlg listeners **/
private final List<IFogResourceListener> fogResources = new ArrayList<IFogResourceListener>(); private final List<IFogResourceListener> fogResources = new ArrayList<IFogResourceListener>();
/** regex wild card filter **/
private final String wildCard = "[\\w\\(\\)\\-_:.]+";
/** Geometry of adjacent areas **/
private Geometry geoAdjAreas = null;
/** Data URI pattern for fog **/
private final Pattern fogPattern = Pattern.compile(DataURI.SEPARATOR + OBS
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard);
/** /**
* Private constructor, singleton * Private constructor, singleton
*/ */
private FogMonitor() { private FogMonitor() {
pluginPatterns.add(fogPattern); pluginPatterns.add(fssPattern);
fogConfig = FSSObsMonitorConfigurationManager.getInstance(MonName.fog); fogConfig = FSSObsMonitorConfigurationManager.getInstance(MonName.fog);
updateMonitoringArea(); updateMonitoringArea();
initObserver(OBS, this); initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG); createDataStructures();
obData.setThresholdMgr(FogThresholdMgr.getInstance()); processProductAtStartup();
obData.getZoneTableData(); obData.getZoneTableData();
readTableConfig(MonitorThresholdConfiguration.FOG_THRESHOLD_CONFIG); readTableConfig(MonitorThresholdConfiguration.FOG_THRESHOLD_CONFIG);
} }
@ -180,12 +162,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
if (monitor == null) { if (monitor == null) {
monitor = new FogMonitor(); monitor = new FogMonitor();
// Pre-populate dialog with an observations from DB // Pre-populate dialog with an observations from DB
monitor.createDataStructures();
monitor.getAdjAreas();
monitor.processProductAtStartup(MonName.fog.name());
monitor.fireMonitorEvent(monitor); monitor.fireMonitorEvent(monitor);
} }
return monitor; return monitor;
} }
@ -209,10 +187,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
// [Jan 21, 2010, zhao] // [Jan 21, 2010, zhao]
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG); obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
obData.setThresholdMgr(FogThresholdMgr.getInstance()); obData.setThresholdMgr(FogThresholdMgr.getInstance());
obsData = new ObsData(); obsData = new ObsData();
algorithmData = new TreeMap<Date, Map<String, FOG_THREAT>>(); algorithmData = new TreeMap<Date, Map<String, FOG_THREAT>>();
for (String zone : MonitoringArea.getPlatformMap().keySet()) { for (String zone : MonitoringArea.getPlatformMap().keySet()) {
obsData.addArea(zone, MonitoringArea.getPlatformMap().get(zone)); obsData.addArea(zone, MonitoringArea.getPlatformMap().get(zone));
} }
@ -251,7 +227,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
*/ */
@Override @Override
public void processProductMessage(final AlertMessage filtered) { public void processProductMessage(final AlertMessage filtered) {
if (fogPattern.matcher(filtered.dataURI).matches()) { if (fssPattern.matcher(filtered.dataURI).matches()) {
processURI(filtered.dataURI, filtered); processURI(filtered.dataURI, filtered);
} }
} }
@ -264,7 +240,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
* -- the xml configuration filename * -- the xml configuration filename
*/ */
public void readTableConfig(String file) { public void readTableConfig(String file) {
// TODO update for Maritime
Map<String, List<String>> zones = new HashMap<String, List<String>>(); Map<String, List<String>> zones = new HashMap<String, List<String>>();
// create zones and stations list // create zones and stations list
try { try {
@ -594,35 +569,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
return null; return null;
} }
/**
* Gets adjacent areas.
*/
public void getAdjAreas() {
try {
this.geoAdjAreas = AdjacentWfoMgr.getAdjacentAreas(cwa);
} catch (SpatialException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
}
/**
* Gets geometry of adjacent areas.
*
* @return the geoAdjAreas
*/
public Geometry getGeoAdjAreas() {
return geoAdjAreas;
}
/**
* Sets the geoAdjAreas
*
* @param geoAdjAreas
*/
public void setGeoAdjAreas(Geometry geoAdjAreas) {
this.geoAdjAreas = geoAdjAreas;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -633,9 +579,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
@Override @Override
protected void processAtStartup(ObReport report) { protected void processAtStartup(ObReport report) {
obData.addReport(report); obData.addReport(report);
String zone = findZone(report.getPlatformId());
getTableData().getArea(zone).addReport(report.getObservationTime(),
report);
} }
/** /**
@ -663,5 +606,4 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
} }
MonitoringArea.setPlatformMap(zones); MonitoringArea.setPlatformMap(zones);
} }
} }

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.fog.threshold;
import java.util.ArrayList; import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -42,7 +40,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.FogMonitor;
* Feb 03, 2014 #2757 skorolev Fixed reInitialize() * Feb 03, 2014 #2757 skorolev Fixed reInitialize()
* May 20, 2014 3086 skorolev Cleaned code. * May 20, 2014 3086 skorolev Cleaned code.
* Sep 04, 2014 3220 skorolev Removed "site". * Sep 04, 2014 3220 skorolev Removed "site".
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager. * Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr.
* *
* </pre> * </pre>
* *
@ -60,10 +58,7 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
*/ */
private FogThresholdMgr() { private FogThresholdMgr() {
super("DefaultFogDisplayThresholds.xml", super("DefaultFogDisplayThresholds.xml",
"DefaultFogMonitorThresholds.xml", AppName.FOG.name() "DefaultFogMonitorThresholds.xml", AppName.FOG);
.toLowerCase());
areaConfigMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.fog);
init(); init();
} }
@ -76,7 +71,6 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
if (classInstance == null) { if (classInstance == null) {
classInstance = new FogThresholdMgr(); classInstance = new FogThresholdMgr();
} }
return classInstance; return classInstance;
} }
@ -120,19 +114,4 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
return threshKeys; return threshKeys;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
areaConfigMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.fog);
}
return areaConfigMgr;
}
} }

View file

@ -110,10 +110,6 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
fogMonitorDlg.open(); fogMonitorDlg.open();
} }
} }
/**
* DR#11279: re-initialize threshold manager and the monitor
* using new monitor area configuration
*/
fireConfigUpdateEvent(); fireConfigUpdateEvent();
resetStatus(); resetStatus();
} else { // Return back to continue edit. } else { // Return back to continue edit.

View file

@ -60,7 +60,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs. * Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Aug 26, 2015 3841 skorolev Corrected getMonitorAreaConfigInstance(). * Sep 18, 2015 3873 skorolev Adjusted to AppName and MonName.
* *
* </pre> * </pre>
* *
@ -164,29 +164,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
} }
} }
/**
* Jan 25, 2010, #4281, zhao, Modified to pass an ObMultiHrsReports object
* to table dialog
*
* @Override public void notify(IMonitorEvent me) { if
* (zoneTable.isDisposed()) return;
*
* if (me.getSource() instanceof FogMonitor) { FogMonitor monitor
* = (FogMonitor)me.getSource();
* this.updateTableDlg(monitor.getObData()); }
*
* //if (me.getSource() instanceof FogMonitor) { //
* IMPORTANT!!!!!! For now we just grab the most recent time from
* the OBSTable // When we have the CAVE rendering working we will
* grab it from the CaveResource! // Date date = new Date(); //
* FogMonitor fog = (FogMonitor)me.getSource(); //
* FogDataGenerator fdg = new FogDataGenerator(); // TableData
* tZoneTableData = fdg.generateZoneData(fog.getTableData(),
* fog.getAlgorithmData(), date); //
* updateZoneTable(tZoneTableData, fog.getStationTableData(),
* date); //} }
*/
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -220,7 +197,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
@Override @Override
public void fireDialogShutdown(IMonitorListener iml) { public void fireDialogShutdown(IMonitorListener iml) {
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() { public void run() {
Iterator<IMonitor> iter = getMonitorControlListeners() Iterator<IMonitor> iter = getMonitorControlListeners()
.iterator(); .iterator();
@ -241,7 +217,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
@Override @Override
public void fireKillMonitor() { public void fireKillMonitor() {
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() { public void run() {
Iterator<IMonitor> iter = getMonitorControlListeners() Iterator<IMonitor> iter = getMonitorControlListeners()
.iterator(); .iterator();
@ -309,7 +284,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
if (configMgr == null || configMgr.isPopulated()) { if (configMgr == null || configMgr.isPopulated()) {
configMgr = FSSObsMonitorConfigurationManager configMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.fog); .getInstance(MonName.fog);
configMgr.setPopulated(false);
} }
return configMgr; return configMgr;
} }

View file

@ -25,26 +25,22 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.fog.FogRecord; import com.raytheon.uf.common.dataplugin.fog.FogRecord;
import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT; import com.raytheon.uf.common.dataplugin.fog.FogRecord.FOG_THREAT;
import com.raytheon.uf.common.geospatial.SpatialException; import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.common.monitor.MonitorAreaUtils; import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.IMonitor; import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.Monitor; import com.raytheon.uf.viz.monitor.Monitor;
import com.raytheon.uf.viz.monitor.ObsMonitor; import com.raytheon.uf.viz.monitor.ObsMonitor;
@ -87,7 +83,7 @@ import com.vividsolutions.jts.geom.Geometry;
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter * Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager. * Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage.
* *
* </pre> * </pre>
* *
@ -127,12 +123,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
private final TableData stationTableData = new TableData( private final TableData stationTableData = new TableData(
CommonConfig.AppName.SAFESEAS); CommonConfig.AppName.SAFESEAS);
/** All SafeSeas datauri start with this */
private final String OBS = "fssobs";
/** regex wild card filter */
private final String wildCard = "[\\w\\(\\)-_:.]+";
/** List of SAFESEAS resource listeners **/ /** List of SAFESEAS resource listeners **/
private final List<ISSResourceListener> safeSeasResources = new ArrayList<ISSResourceListener>(); private final List<ISSResourceListener> safeSeasResources = new ArrayList<ISSResourceListener>();
@ -145,32 +135,21 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
/** data holder for FOG data **/ /** data holder for FOG data **/
private Map<Date, Map<String, FOG_THREAT>> algorithmData = null; private Map<Date, Map<String, FOG_THREAT>> algorithmData = null;
/** Adjacent areas for current cwa **/
private Geometry geoAdjAreas;
/** List of fogAlg listeners **/ /** List of fogAlg listeners **/
private final List<ISSResourceListener> fogResources = new ArrayList<ISSResourceListener>(); private final List<ISSResourceListener> fogResources = new ArrayList<ISSResourceListener>();
/** Pattern for SAFESEAS **/
private final Pattern ssPattern = Pattern.compile(DataURI.SEPARATOR + OBS
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard);
/** /**
* Private constructor, singleton * Private constructor, singleton
*/ */
private SafeSeasMonitor() { private SafeSeasMonitor() {
pluginPatterns.add(ssPattern); pluginPatterns.add(fssPattern);
ssAreaConfig = FSSObsMonitorConfigurationManager ssAreaConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss); .getInstance(MonName.ss);
updateMonitoringArea(); updateMonitoringArea();
initObserver(OBS, this); initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS); createDataStructures();
obData.setThresholdMgr(SSThresholdMgr.getInstance()); processProductAtStartup();
obData.getZoneTableData();
readTableConfig(MonitorThresholdConfiguration.SAFESEAS_THRESHOLD_CONFIG); readTableConfig(MonitorThresholdConfiguration.SAFESEAS_THRESHOLD_CONFIG);
} }
/** /**
@ -179,10 +158,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
public static synchronized SafeSeasMonitor getInstance() { public static synchronized SafeSeasMonitor getInstance() {
if (monitor == null) { if (monitor == null) {
monitor = new SafeSeasMonitor(); monitor = new SafeSeasMonitor();
// Pre-populate dialog with an observation (METAR) for KOMA
monitor.createDataStructures();
monitor.getAdjAreas();
monitor.processProductAtStartup("ss");
monitor.fireMonitorEvent(monitor); monitor.fireMonitorEvent(monitor);
} }
return monitor; return monitor;
@ -207,6 +182,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
private void createDataStructures() { private void createDataStructures() {
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS); obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS);
obData.setThresholdMgr(SSThresholdMgr.getInstance()); obData.setThresholdMgr(SSThresholdMgr.getInstance());
obData.getZoneTableData();
algorithmData = new HashMap<Date, Map<String, FOG_THREAT>>(); algorithmData = new HashMap<Date, Map<String, FOG_THREAT>>();
} }
@ -275,7 +251,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
*/ */
@Override @Override
public void processProductMessage(final AlertMessage filtered) { public void processProductMessage(final AlertMessage filtered) {
if (ssPattern.matcher(filtered.dataURI).matches()) { if (fssPattern.matcher(filtered.dataURI).matches()) {
processURI(filtered.dataURI, filtered); processURI(filtered.dataURI, filtered);
} }
} }
@ -596,36 +572,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
return zoneDialog; return zoneDialog;
} }
/**
* Gets adjacent areas
*/
public void getAdjAreas() {
try {
this.setGeoAdjAreas(AdjacentWfoMgr.getAdjacentAreas(cwa));
} catch (SpatialException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
}
/**
* Sets geometry of adjacent areas
*
* @param geoAdjAreas
* the geoAdjAreas to set
*/
public void setGeoAdjAreas(Geometry geoAdjAreas) {
this.geoAdjAreas = geoAdjAreas;
}
/**
* Gets geometry of adjacent areas
*
* @return the geoAdjAreas
*/
public Geometry getGeoAdjAreas() {
return geoAdjAreas;
}
/* /*
* Updates data of Fog monitor * Updates data of Fog monitor
* *
@ -687,5 +633,4 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
} }
MonitoringArea.setPlatformMap(zones); MonitoringArea.setPlatformMap(zones);
} }
} }

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.safeseas.threshold;
import java.util.ArrayList; import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -42,7 +40,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SafeSeasMonitor;
* Feb 03, 2014 #2757 skorolev Fixed reInitialize(). * Feb 03, 2014 #2757 skorolev Fixed reInitialize().
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Removed "site". * Sep 04, 2014 3220 skorolev Removed "site".
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager. * Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr.
* *
* </pre> * </pre>
* *
@ -58,10 +56,7 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
*/ */
public SSThresholdMgr() { public SSThresholdMgr() {
super("DefaultSSDisplayThresholds.xml", super("DefaultSSDisplayThresholds.xml",
"DefaultSSMonitorThresholds.xml", AppName.SAFESEAS.name() "DefaultSSMonitorThresholds.xml", AppName.SAFESEAS);
.toLowerCase());
areaConfigMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss);
init(); init();
} }
@ -116,18 +111,4 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
return threshKeys; return threshKeys;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
areaConfigMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss);
}
return areaConfigMgr;
}
} }

View file

@ -79,6 +79,12 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
SafeSeasMonitor.getInstance(); SafeSeasMonitor.getInstance();
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
* handleOkBtnSelection()
*/
@Override @Override
protected void handleOkBtnSelection() throws LocalizationException, protected void handleOkBtnSelection() throws LocalizationException,
SerializationException, IOException { SerializationException, IOException {

View file

@ -57,8 +57,8 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* Nov 10, 2012 1297 skorolev Added initiateProdArray * Nov 10, 2012 1297 skorolev Added initiateProdArray
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs. * Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Aug 26, 2015 3841 skorolev Corrected getMonitorAreaConfigInstance(). * Sep 18, 2015 3873 skorolev Adjusted to AppName and MonName.
* *
* </pre> * </pre>
* *
@ -71,8 +71,7 @@ public class SSZoneTableDlg extends ZoneTableDlg {
private SSDispMonThreshDlg ssThreshDlg; private SSDispMonThreshDlg ssThreshDlg;
/** Swell column names in the zone and station table. **/ /** Swell column names in the zone and station table. **/
private final String[] ssSwellCols = { "SSZT_SwellPeriod", private String[] ssSwellCols = { "SSZT_SwellPeriod", "SSZT_Swell2Period" };
"SSZT_Swell2Period" };
/** /**
* Constructor (Dec 30, 2009, zhao) * Constructor (Dec 30, 2009, zhao)
@ -162,8 +161,7 @@ public class SSZoneTableDlg extends ZoneTableDlg {
Map<String, FOG_THREAT> fogAlgThreats = monitor Map<String, FOG_THREAT> fogAlgThreats = monitor
.getAlgorithmData(nominalTime); .getAlgorithmData(nominalTime);
obData.setFogAlgCellType(monitor.getAlgCellTypes(fogAlgThreats)); obData.setFogAlgCellType(monitor.getAlgCellTypes(fogAlgThreats));
this.updateTableDlg(monitor.getObData().getObHourReports( this.updateTableDlg(obData.getObHourReports(nominalTime));
nominalTime));
} }
} }
} }
@ -333,7 +331,6 @@ public class SSZoneTableDlg extends ZoneTableDlg {
if (configMgr == null || configMgr.isPopulated()) { if (configMgr == null || configMgr.isPopulated()) {
configMgr = FSSObsMonitorConfigurationManager configMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss); .getInstance(MonName.ss);
configMgr.setPopulated(false);
} }
return configMgr; return configMgr;
} }

View file

@ -57,6 +57,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs. * 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs.
* 15 Aug 2013 2143 mpduff Remove resize. * 15 Aug 2013 2143 mpduff Remove resize.
* 12 Oct 2015 4929 rferrel Properly set up dialog when rateOfChangeRdo selected.
* </pre> * </pre>
* *
* @author * @author
@ -243,7 +244,9 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
rateOfChangeRdo.addSelectionListener(new SelectionAdapter() { rateOfChangeRdo.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
if (rateOfChangeRdo.getSelection() == true) {
alarmChoiceChanged();
}
} }
}); });

View file

@ -50,9 +50,9 @@ import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 2, 2010 mnash Initial creation * Dec 2, 2010 mnash Initial creation
* * 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue * Apr 18, 2013 1926 njensen Update for Long keys
* Apr 18, 2013 1926 njensen Update for Long keys * Oct 12, 2015 4929 rferrel Ingore unset alarm values in calculateScanCells.
* *
* </pre> * </pre>
* *
@ -76,6 +76,11 @@ public class SCANAlarmAlertManager {
} }
} }
/**
* Value to use to indicate no alarm for the AlarmTypes.
*/
public static final int NO_ALARM_VALUE = -999;
private static SCANAlarmAlertManager instance = null; private static SCANAlarmAlertManager instance = null;
private Map<String, Map<ScanTables, List<ScheduledAlarms>>> scheduledAlarmsMap; private Map<String, Map<ScanTables, List<ScheduledAlarms>>> scheduledAlarmsMap;
@ -171,7 +176,7 @@ public class SCANAlarmAlertManager {
for (ScheduledAlarms alarm : scheduledAlarmsMap.get(site) for (ScheduledAlarms alarm : scheduledAlarmsMap.get(site)
.get(tableType)) { .get(tableType)) {
int index = config.getColumnIndex(tableType, alarm.colName); int index = config.getColumnIndex(tableType, alarm.colName);
if (index == -1) { if ((alarm.value == NO_ALARM_VALUE) || (index == -1)) {
continue; continue;
} }
int row = 0; int row = 0;
@ -215,21 +220,18 @@ public class SCANAlarmAlertManager {
Set<Long> cellData = monitor.cellData.get(site) Set<Long> cellData = monitor.cellData.get(site)
.keySet(); .keySet();
Date previous = null; Date previous = null;
if (!cellData.isEmpty()) { if (!cellData.isEmpty() && (cellData.size() > 1)) {
Date[] times = new Date[cellData.size()]; Date[] times = new Date[cellData.size()];
Iterator<Long> itr = cellData.iterator(); Iterator<Long> itr = cellData.iterator();
for (int i = 0; i < times.length; i++) { for (int i = 0; i < times.length; i++) {
times[i] = new Date(itr.next()); times[i] = new Date(itr.next());
} }
if (times.length > 1) { Arrays.sort(times);
Arrays.sort(times); previous = times[times.length - 2];
previous = times[times.length - 2]; ScanTableData<?> tableDataPrev = monitor
ScanTableData<?> tableDataPrev = monitor .getTableData(tableType, site, previous);
.getTableData(tableType, site, previous); getScanTableDiff(data, tableDataPrev, tableType,
getScanTableDiff(data, tableDataPrev, colLength, sdg, alarm, config, latestTime);
tableType, colLength, sdg, alarm,
config, latestTime);
}
} }
} }
} }

View file

@ -25,18 +25,16 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.annotations.DataURI; import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.IMonitor; import com.raytheon.uf.viz.monitor.IMonitor;
import com.raytheon.uf.viz.monitor.Monitor; import com.raytheon.uf.viz.monitor.Monitor;
import com.raytheon.uf.viz.monitor.ObsMonitor; import com.raytheon.uf.viz.monitor.ObsMonitor;
@ -74,7 +72,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter * Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method. * Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea. * Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager. * Sep 18, 2015 3873 skorolev Removed common definitions. Replaced deprecated NotificationMessage.
* *
* </pre> * </pre>
* *
@ -104,13 +102,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
* This object contains all observation data necessary for the table dialogs * This object contains all observation data necessary for the table dialogs
* and trending plots * and trending plots
*/ */
private final ObMultiHrsReports obData; private ObMultiHrsReports obData;
/** All SNOW datauri start with this */
private final String OBS = "fssobs";
/** regex wild card filter */
private final String wildCard = "[\\w\\(\\)-_:.]+";
/** Time which Zone/County dialog shows. **/ /** Time which Zone/County dialog shows. **/
private Date dialogTime = null; private Date dialogTime = null;
@ -118,23 +110,20 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
/** Array of snow listeners **/ /** Array of snow listeners **/
private final List<ISnowResourceListener> snowResources = new ArrayList<ISnowResourceListener>(); private final List<ISnowResourceListener> snowResources = new ArrayList<ISnowResourceListener>();
/** Pattern for SNOW **/
private final Pattern snowPattern = Pattern.compile(DataURI.SEPARATOR + OBS
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard);
/** /**
* Private constructor, singleton * Private constructor, singleton
*/ */
private SnowMonitor() { private SnowMonitor() {
pluginPatterns.add(snowPattern); pluginPatterns.add(fssPattern);
snowConfig = FSSObsMonitorConfigurationManager snowConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow); .getInstance(MonName.snow);
updateMonitoringArea(); updateMonitoringArea();
initObserver(OBS, this); initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW); obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);
// Set up thresholds.
obData.setThresholdMgr(SnowThresholdMgr.getInstance()); obData.setThresholdMgr(SnowThresholdMgr.getInstance());
// Retrieve existing data.
processProductAtStartup();
obData.getZoneTableData(); obData.getZoneTableData();
} }
@ -146,7 +135,6 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
public static synchronized SnowMonitor getInstance() { public static synchronized SnowMonitor getInstance() {
if (monitor == null) { if (monitor == null) {
monitor = new SnowMonitor(); monitor = new SnowMonitor();
monitor.processProductAtStartup("snow");
monitor.fireMonitorEvent(monitor); monitor.fireMonitorEvent(monitor);
} }
return monitor; return monitor;
@ -238,7 +226,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
*/ */
@Override @Override
public void processProductMessage(final AlertMessage filtered) { public void processProductMessage(final AlertMessage filtered) {
if (snowPattern.matcher(filtered.dataURI).matches()) { if (fssPattern.matcher(filtered.dataURI).matches()) {
processURI(filtered.dataURI, filtered); processURI(filtered.dataURI, filtered);
} }
} }
@ -384,7 +372,6 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
* *
* @param dialogTime * @param dialogTime
*/ */
@Override
public void updateDialogTime(Date dialogTime) { public void updateDialogTime(Date dialogTime) {
this.dialogTime = dialogTime; this.dialogTime = dialogTime;
fireMonitorEvent(this); fireMonitorEvent(this);

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.snow.threshold;
import java.util.ArrayList; import java.util.ArrayList;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -42,7 +40,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants.SnowMonitor;
* Feb 03, 2014 #2757 skorolev Fixed reInitialize() * Feb 03, 2014 #2757 skorolev Fixed reInitialize()
* May 21, 2014 3086 skorolev Cleaned code. * May 21, 2014 3086 skorolev Cleaned code.
* Sep 04, 2014 3220 skorolev Removed "site". * Sep 04, 2014 3220 skorolev Removed "site".
* Sep 03, 2015 3841 skorolev Corrected getInstance for FSSObsMonitorConfigurationManager. * Sep 18, 2015 3873 skorolev Adjusted to AppName and removed areaConfigMgr.
* *
* </pre> * </pre>
* *
@ -57,11 +55,7 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
*/ */
private SnowThresholdMgr() { private SnowThresholdMgr() {
super("DefaultSnowDisplayThresholds.xml", super("DefaultSnowDisplayThresholds.xml",
"DefaultSnowMonitorThresholds.xml", AppName.SNOW.name() "DefaultSnowMonitorThresholds.xml", AppName.SNOW);
.toLowerCase());
areaConfigMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow);
init(); init();
} }
@ -116,18 +110,4 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
return threshKeys; return threshKeys;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr#
* getMonitorAreaConfigInstance()
*/
@Override
protected FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance() {
if (areaConfigMgr == null) {
areaConfigMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow);
}
return areaConfigMgr;
}
} }

View file

@ -54,8 +54,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler. * Sep 04, 2014 3220 skorolev Added fireConfigUpdateEvent method. Updated handler.
* Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons. * Sep 19, 2014 2757 skorolev Updated handlers for dialog buttons.
* Oct 27, 2014 3667 skorolev Cleaned code. * Oct 27, 2014 3667 skorolev Cleaned code.
* Feb 10, 2015 3886 skorolev Changed confirmation message. * Feb 10, 2015 3886 skorolev Changed confirmation message.
* Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection. * Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection.
* </pre> * </pre>
* *
* @author mpduff * @author mpduff

View file

@ -55,7 +55,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs * Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose. * Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Aug 26, 2015 3841 skorolev Corrected getMonitorAreaConfigInstance(). * Sep 18, 2015 3873 skorolev Adjusted to AppName and MonName.
* *
* </pre> * </pre>
* *
@ -141,7 +141,6 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
if (zoneTable.isDisposed()) { if (zoneTable.isDisposed()) {
return; return;
} }
if (me.getSource() instanceof SnowMonitor) { if (me.getSource() instanceof SnowMonitor) {
SnowMonitor monitor = (SnowMonitor) me.getSource(); SnowMonitor monitor = (SnowMonitor) me.getSource();
Date date = monitor.getDialogTime(); Date date = monitor.getDialogTime();
@ -268,7 +267,6 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
if (configMgr == null || configMgr.isPopulated()) { if (configMgr == null || configMgr.isPopulated()) {
configMgr = FSSObsMonitorConfigurationManager configMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow); .getInstance(MonName.snow);
configMgr.setPopulated(false);
} }
return configMgr; return configMgr;
} }

View file

@ -23,6 +23,7 @@ import com.raytheon.uf.viz.monitor.data.ObReport;
* skorolev Initial creation * skorolev Initial creation
* May 15, 2012 14510 zhao Modified generateObReport() * May 15, 2012 14510 zhao Modified generateObReport()
* Jan 06, 2014 2653 skorolev Included SNOW data into ObReport. * Jan 06, 2014 2653 skorolev Included SNOW data into ObReport.
* Sep 20, 2015 3873 skorolev Added IsStationary and getReportType.
* *
* *
* </pre> * </pre>
@ -46,10 +47,10 @@ public class GenerateFSSObReport {
public static ObReport generateObReport(PluginDataObject report) { public static ObReport generateObReport(PluginDataObject report) {
// Generate the observation report. // Generate the observation report.
ObReport obReport = new ObReport(); ObReport obReport = new ObReport();
FSSObsRecord metar = (FSSObsRecord) report; FSSObsRecord fssData = (FSSObsRecord) report;
try { try {
obReport.setObservationTime(metar.getTimeObs().getTime()); obReport.setObservationTime(fssData.getTimeObs().getTime());
obReport.setRefHour(metar.getRefHour().getTime()); obReport.setRefHour(fssData.getRefHour().getTime());
} catch (Exception e) { } catch (Exception e) {
statusHandler statusHandler
.error("Warning: missing obsTime or refHour at getTimeObs() when processing obs data; " .error("Warning: missing obsTime or refHour at getTimeObs() when processing obs data; "
@ -57,63 +58,82 @@ public class GenerateFSSObReport {
+ "; trying to set obsTime and refHour from dataURI"); + "; trying to set obsTime and refHour from dataURI");
obReport.setTimesFromFssobDataURI(report.getDataURI()); obReport.setTimesFromFssobDataURI(report.getDataURI());
} }
obReport.setPlatformId(metar.getPlatformId()); obReport.setPlatformId(fssData.getPlatformId());
obReport.setStationary(true); obReport.setStationary(fssData.getIsStationary());
obReport.setLatitude((float) metar.getLatitude()); obReport.setLatitude((float) fssData.getLatitude());
obReport.setLongitude((float) metar.getLongitude()); obReport.setLongitude((float) fssData.getLongitude());
// Table data: // Table data:
obReport.setCeiling(metar.getCeiling()); obReport.setCeiling(fssData.getCeiling());
obReport.setWindDir(metar.getWindDir()); obReport.setWindDir(fssData.getWindDir());
obReport.setWindSpeed(metar.getWindSpeed()); obReport.setWindSpeed(fssData.getWindSpeed());
obReport.setMaxWindSpeed(metar.getMaxWindSpeed()); obReport.setMaxWindSpeed(fssData.getMaxWindSpeed());
obReport.setWindGust(metar.getWindGust()); obReport.setWindGust(fssData.getWindGust());
obReport.setRelativeHumidity(metar.getRelativeHumidity()); obReport.setRelativeHumidity(fssData.getRelativeHumidity());
try { try {
obReport.setVisibility(metar.getVisibility()); obReport.setVisibility(fssData.getVisibility());
} catch (Exception e) { } catch (Exception e) {
obReport.setVisibility(0); obReport.setVisibility(0);
} }
obReport.setDewpoint(metar.getDewpoint()); obReport.setDewpoint(fssData.getDewpoint());
obReport.setTemperature(metar.getTemperature()); obReport.setTemperature(fssData.getTemperature());
obReport.setDewpointDepr(metar.getDewpointDepr()); obReport.setDewpointDepr(fssData.getDewpointDepr());
obReport.setPresentWx(getPrWX(metar.getPresWeather())); obReport.setPresentWx(getPrWX(fssData.getPresWeather()));
obReport.setHighResWaveHeight(ObConst.MISSING); obReport.setHighResWaveHeight(ObConst.MISSING);
obReport.setWaveSteepness(metar.getWaveSteepness()); obReport.setWaveSteepness(fssData.getWaveSteepness());
obReport.setSeaLevelPress(metar.getSeaLevelPress()); obReport.setSeaLevelPress(fssData.getSeaLevelPress());
obReport.setWavePeriod(metar.getWavePeriod()); obReport.setWavePeriod(fssData.getWavePeriod());
obReport.setWindGust(metar.getWindGust()); obReport.setWindGust(fssData.getWindGust());
obReport.setPSwellHeight(metar.getPrimarySwellWaveHeight().floatValue()); obReport.setPSwellHeight(fssData.getPrimarySwellWaveHeight()
obReport.setPSwellPeriod(metar.getPrimarySwellWavePeriod());
obReport.setPSwellDir(metar.getPrimarySwellWaveDir().floatValue());
obReport.setSSwellHeight(metar.getSecondarySwellWaveHeight()
.floatValue()); .floatValue());
obReport.setSSwellPeriod(metar.getSecondarySwellWavePeriod()); obReport.setPSwellPeriod(fssData.getPrimarySwellWavePeriod());
obReport.setSSwellDir(metar.getSecondarySwellWaveDir().floatValue()); obReport.setPSwellDir(fssData.getPrimarySwellWaveDir().floatValue());
obReport.setPressure(metar.getPressureAltimeter()); obReport.setSSwellHeight(fssData.getSecondarySwellWaveHeight()
obReport.setPressureChange(metar.getPressChange3Hour()); .floatValue());
obReport.setSSwellPeriod(fssData.getSecondarySwellWavePeriod());
obReport.setSSwellDir(fssData.getSecondarySwellWaveDir().floatValue());
obReport.setPressure(fssData.getPressureAltimeter());
obReport.setPressureChange(fssData.getPressChange3Hour());
try { try {
obReport.setPressChangeChar(Short.parseShort(metar obReport.setPressChangeChar(Short.parseShort(fssData
.getPressChangeChar())); .getPressChangeChar()));
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
obReport.setPressChangeChar((short) 0); obReport.setPressChangeChar((short) 0);
} }
obReport.setHourlyPrecip(metar.getHourlyPrecip()); obReport.setHourlyPrecip(fssData.getHourlyPrecip());
obReport.setRawMessage(metar.getRawMessage()); obReport.setRawMessage(fssData.getRawMessage());
obReport.setReportType(ReportType.METAR); ReportType reportType = getReportType(fssData.getReportType());
obReport.setSnincrHourly(metar.getSnincrHourly()); obReport.setReportType(reportType);
obReport.setSnincrTotal(metar.getSnincrTotal()); obReport.setSnincrHourly(fssData.getSnincrHourly());
obReport.setFrostbiteTime(metar.getFrostbiteTime()); obReport.setSnincrTotal(fssData.getSnincrTotal());
obReport.setWindChill(metar.getWindChill()); obReport.setFrostbiteTime(fssData.getFrostbiteTime());
obReport.setSnowDepth(metar.getSnowDepth()); obReport.setWindChill(fssData.getWindChill());
obReport.setSeaSurfaceTemp(metar.getSeaSurfaceTemp()); obReport.setSnowDepth(fssData.getSnowDepth());
obReport.setSeaSurfaceTemp(fssData.getSeaSurfaceTemp());
return obReport; return obReport;
} }
private static ReportType getReportType(String reportType) {
if (reportType == null) {
reportType = "";
}
switch (reportType) {
case "1003":
case "1004":
case "1005":
case "1006":
case "1007":
return ReportType.MARITIME;
// TODO:MESONET
default:
return ReportType.METAR;
}
}
/** /**
* Construct Present Weather string. * Construct Present Weather string.
* *

View file

@ -24,10 +24,10 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.events.IMonitorEvent; import com.raytheon.uf.viz.monitor.events.IMonitorEvent;
import com.raytheon.uf.viz.monitor.listeners.IMonitorConfigurationListener; import com.raytheon.uf.viz.monitor.listeners.IMonitorConfigurationListener;
import com.raytheon.uf.viz.monitor.listeners.IMonitorListener; import com.raytheon.uf.viz.monitor.listeners.IMonitorListener;
@ -46,7 +46,9 @@ import com.raytheon.viz.alerts.observers.ProductAlertObserver;
* 2/27/2009 2047 grichard Use 'foreach' in 'arrived' methods. * 2/27/2009 2047 grichard Use 'foreach' in 'arrived' methods.
* 3/2/2009 2047 grichard Added stationId resolution method. * 3/2/2009 2047 grichard Added stationId resolution method.
* 3/5/2009 2047 grichard Made plugin and station names arrays. * 3/5/2009 2047 grichard Made plugin and station names arrays.
* Dec 18, 2009 3424 zhao Made addMinitorListener public * Dec 18, 2009 3424 zhao Made addMinitorListener public.
* Sep 20, 2015 3873 skorolev Replaced deprecated NotificationMessage.
*
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -199,7 +201,6 @@ public abstract class Monitor implements IMonitor, IMonitorThresholdListener,
final Monitor fmonitor = this; final Monitor fmonitor = this;
final String ftype = type; final String ftype = type;
// System.out.println("Listener class: "+type);
VizApp.runAsync(new Runnable() { VizApp.runAsync(new Runnable() {
public void run() { public void run() {

View file

@ -28,11 +28,15 @@ import java.util.regex.Pattern;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil; import com.raytheon.uf.common.dataplugin.annotations.DataURIUtil;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecordTransform; import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecordTransform;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.geospatial.SpatialException;
import com.raytheon.uf.common.inventory.exception.DataCubeException; import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
import com.raytheon.uf.common.pointdata.PointDataContainer; import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -41,12 +45,11 @@ import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.datacube.DataCubeContainer; import com.raytheon.uf.viz.datacube.DataCubeContainer;
import com.raytheon.uf.viz.monitor.data.MonitoringArea;
import com.raytheon.uf.viz.monitor.data.ObReport; import com.raytheon.uf.viz.monitor.data.ObReport;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent; import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
import com.vividsolutions.jts.geom.Geometry;
/** /**
* *
@ -62,6 +65,7 @@ import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
* Feb 04, 2014 2757 skorolev Added filter for removed stations * Feb 04, 2014 2757 skorolev Added filter for removed stations
* May 08, 2014 3086 skorolev Added current site definition. * May 08, 2014 3086 skorolev Added current site definition.
* Sep 04, 2014 3220 skorolev Removed cwa and monitorUsefrom vals. * Sep 04, 2014 3220 skorolev Removed cwa and monitorUsefrom vals.
* Sep 18, 2015 3873 skorolev Included common definitions.
* *
* </pre> * </pre>
* *
@ -106,6 +110,39 @@ public abstract class ObsMonitor extends Monitor {
/** Current CWA **/ /** Current CWA **/
public static String cwa = LocalizationManager.getInstance().getSite(); public static String cwa = LocalizationManager.getInstance().getSite();
/** Adjacent areas for current cwa **/
private Geometry geoAdjAreas;
/** All FSSObs datauri start with this **/
protected final String OBS = "fssobs";
/** regex wild card filter **/
protected final String wildCard = "[\\w\\(\\)\\-_:.]+";
/** Pattern for FSSObs **/
protected final Pattern fssPattern = Pattern.compile(DataURI.SEPARATOR
+ OBS + DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard + DataURI.SEPARATOR + wildCard
+ DataURI.SEPARATOR + wildCard);
/**
* Constructor.
*/
public ObsMonitor() {
this.getAdjAreas();
}
/**
* Gets adjacent areas
*/
public void getAdjAreas() {
try {
this.setGeoAdjAreas(AdjacentWfoMgr.getAdjacentAreas(cwa));
} catch (SpatialException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
}
}
/** /**
* This method processes the incoming messages * This method processes the incoming messages
* *
@ -199,20 +236,13 @@ public abstract class ObsMonitor extends Monitor {
Display.getDefault().asyncExec(new Runnable() { Display.getDefault().asyncExec(new Runnable() {
public void run() { public void run() {
try { try {
// Filter removed stations ObReport result = GenerateFSSObReport
ArrayList<String> zones = MonitoringArea .generateObReport(objectToSend);
.getZoneIds(objectToSend statusHandler.handle(
.getPlatformId()); Priority.INFO,
if (!zones.isEmpty()) { "New FSSrecord ===> "
ObReport result = GenerateFSSObReport + objectToSend.getDataURI());
.generateObReport(objectToSend); process(result);
statusHandler
.handle(Priority.INFO,
"New FSSrecord ===> "
+ objectToSend
.getDataURI());
process(result);
}
} catch (Exception e) { } catch (Exception e) {
statusHandler statusHandler
.handle(Priority.PROBLEM, .handle(Priority.PROBLEM,
@ -240,7 +270,7 @@ public abstract class ObsMonitor extends Monitor {
* @param monitorName * @param monitorName
* *
*/ */
public void processProductAtStartup(String monitorName) { public void processProductAtStartup() {
/** /**
* Assume this number for MaxNumObsTimes is larger enough to cover data * Assume this number for MaxNumObsTimes is larger enough to cover data
@ -274,19 +304,14 @@ public abstract class ObsMonitor extends Monitor {
FSSObsRecord[] obsRecords = requestFSSObs(vals, selectedTimes); FSSObsRecord[] obsRecords = requestFSSObs(vals, selectedTimes);
for (FSSObsRecord objectToSend : obsRecords) { for (FSSObsRecord objectToSend : obsRecords) {
// Filter removed stations ObReport result = GenerateFSSObReport
ArrayList<String> zones = MonitoringArea .generateObReport(objectToSend);
.getZoneIds(objectToSend.getPlatformId()); processAtStartup(result);
if (!zones.isEmpty()) {
ObReport result = GenerateFSSObReport
.generateObReport(objectToSend);
processAtStartup(result);
}
} }
} }
} catch (DataCubeException e) { } catch (DataCubeException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"No data in database at startup. " + monitorName); "No data in database at startup.");
} }
} }
@ -315,4 +340,19 @@ public abstract class ObsMonitor extends Monitor {
constraints); constraints);
return FSSObsRecordTransform.toFSSObsRecords(pdc); return FSSObsRecordTransform.toFSSObsRecords(pdc);
} }
/**
* @return the geoAdjAreas
*/
public Geometry getGeoAdjAreas() {
return geoAdjAreas;
}
/**
* @param geoAdjAreas
* the geoAdjAreas to set
*/
public void setGeoAdjAreas(Geometry geoAdjAreas) {
this.geoAdjAreas = geoAdjAreas;
}
} }

View file

@ -22,8 +22,8 @@ package com.raytheon.uf.viz.monitor;
import java.util.Collection; import java.util.Collection;
import com.raytheon.uf.common.jms.notification.NotificationMessage;
import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.AlertMessage;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent; import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
@ -36,7 +36,8 @@ import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 9, 2010 dhladky Initial creation * Apr 9, 2010 dhladky Initial creation
* Sep 20, 2015 3873 skorolev Replaced deprecated NotificationMessage.
* *
* </pre> * </pre>
* *

View file

@ -21,16 +21,24 @@ package com.raytheon.uf.viz.monitor.data;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.Set;
import com.raytheon.uf.common.geospatial.SpatialException;
import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst.ReportType;
import com.raytheon.uf.common.monitor.xml.StationIdXML;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
import com.vividsolutions.jts.geom.Coordinate;
/** /**
* This class is a container of ObZoneHourReports objects for a caller-specified * This class is a container of ObZoneHourReports objects for a caller-specified
@ -40,14 +48,14 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec. 1, 2009 3424 zhao Initial creation. * Dec. 1, 2009 3424 zhao Initial creation.
* Oct.29, 2012 1297 skorolev Changed HashMap to Map * Oct.29, 2012 1297 skorolev Changed HashMap to Map
* Oct.31 2012 1297 skorolev Cleaned code. * Oct.31 2012 1297 skorolev Cleaned code.
* Sep 04 2014 3220 skorolev Added updateZones method. * Sep 04 2014 3220 skorolev Added updateZones method.
* Mar 17 2015 3888 dhladky check for nulls * Mar 17 2015 3888 dhladky check for nulls
* Sep 03, 2015 3841 skorolev Made final appName, hourReports and thresholdMgr. * Sep 25 2015 3873 skorolev Corrected addReport for moving platforms.
* *
* </pre> * </pre>
* *
@ -62,19 +70,26 @@ public class ObHourReports {
/** /**
* the nominal time of this ObHourReports object * the nominal time of this ObHourReports object
*/ */
private final Date nominalTime; private Date nominalTime;
/** /**
* application name (SNOW, FOG, SAFESEAS) * application name (SNOW, FOG, SAFESEAS)
*/ */
private final CommonConfig.AppName appName; private CommonConfig.AppName appName;
/** /**
* key is zone id, value is ObZoneHourReports object * key is zone id, value is ObZoneHourReports object
*/ */
private final Map<String, ObZoneHourReports> hourReports; private Map<String, ObZoneHourReports> hourReports;
private final AbstractThresholdMgr thresholdMgr; /**
* current threshold manager
*/
private AbstractThresholdMgr thresholdMgr;
private Set<String> zones = new HashSet<String>();
private FSSObsMonitorConfigurationManager configMgr;
/** /**
* constructor * constructor
@ -86,10 +101,12 @@ public class ObHourReports {
this.nominalTime = nominalTime; this.nominalTime = nominalTime;
this.appName = appName; this.appName = appName;
this.thresholdMgr = thresholdMgr; this.thresholdMgr = thresholdMgr;
configMgr = this.thresholdMgr.getCfgMgr();
hourReports = new HashMap<String, ObZoneHourReports>(); hourReports = new HashMap<String, ObZoneHourReports>();
Map<String, List<String>> zoneStationMap = MonitoringArea zones.clear();
.getPlatformMap(); zones.addAll(configMgr.getAreaList());
for (String zone : zoneStationMap.keySet()) { for (String zone : zones) {
hourReports.put(zone, new ObZoneHourReports(nominalTime, zone, hourReports.put(zone, new ObZoneHourReports(nominalTime, zone,
appName, thresholdMgr)); appName, thresholdMgr));
} }
@ -102,28 +119,80 @@ public class ObHourReports {
*/ */
public void addReport(ObReport report) { public void addReport(ObReport report) {
String station = report.getPlatformId(); String station = report.getPlatformId();
List<String> zones = MonitoringArea.getZoneIds(station); List<String> stationZones = configMgr.getAreaByStationId(station);
if (zones.size() == 0) { // If station has no associated zone:
statusHandler if (stationZones.isEmpty()) {
.error("Error: station: " if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
+ station // Associate moving platform with monitoring zones
+ " is not associated with any zone in the monitoring area"); double shipDist = configMgr.getShipDistance();
return; stationZones.addAll(findZoneForShip(report, shipDist));
} else {
statusHandler
.warn("Error: station: "
+ station
+ " is not associated with any zone in the monitoring area");
return;
}
} }
boolean hasZone = false; // Add station report to all associated zones.
for (String zone : zones) { for (String zone : stationZones) {
if (hourReports.containsKey(zone)) { if (hourReports.containsKey(zone)) {
hasZone = true;
hourReports.get(zone).addReport(report); hourReports.get(zone).addReport(report);
} }
} }
if (hasZone == false) { return;
statusHandler
.error("Error in addreport() of ObHourReports: unable to add obs report to data archive");
}
} }
/** /**
* Find zones to include a moving platform.
*
* @param report
* from moving platform
* @param shipDist
* distance from area configuration file
*/
private Set<String> findZoneForShip(ObReport report, double shipDist) {
double latShip = report.getLatitude();
double lonShip = report.getLongitude();
Set<String> shipZones = new HashSet<String>();
for (String zone : zones) {
try {
// use only marine zones
if (zone.charAt(2) == 'Z') {
Coordinate zcoor = MonitorAreaUtils.getZoneCenter(zone);
double shipToZone = distance(latShip, lonShip, zcoor.y,
zcoor.x);
if (shipToZone <= shipDist) {
// associate moving platform with monitoring zone.
shipZones.add(zone);
statusHandler.handle(Priority.DEBUG,
"<<<======>>>" + zone + "\tplatform = "
+ report.getPlatformId() + "\tdist = "
+ shipToZone + "\t shipDist = "
+ shipDist);
StationIdXML stnXML = new StationIdXML();
stnXML.setName(report.getPlatformId());
stnXML.setType(ReportType.MARITIME.name());
configMgr.getAreaXml(zone).addStationIdXml(stnXML);
}
} else {
continue;
}
} catch (SpatialException e) {
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
e);
}
}
// Update configuration file.
configMgr.saveConfigXml();
return shipZones;
}
/**
* Gets HourReports
*
* @return hourReports * @return hourReports
*/ */
public Map<String, ObZoneHourReports> getHourReports() { public Map<String, ObZoneHourReports> getHourReports() {
@ -187,8 +256,8 @@ public class ObHourReports {
} }
/** /**
* Returns the ObZoneHourReports object of a caller-specified zone. If such * Gets ObZoneHourReports Returns the ObZoneHourReports object of a
* object not available, returns null. * caller-specified zone. If such object not available, returns null.
* *
* @param zone * @param zone
* @return hour reports * @return hour reports
@ -201,6 +270,8 @@ public class ObHourReports {
} }
/** /**
* Gets NominalTime
*
* @return nominalTime * @return nominalTime
*/ */
public Date getNominalTime() { public Date getNominalTime() {
@ -208,6 +279,8 @@ public class ObHourReports {
} }
/** /**
* Gets AppName
*
* @return appName * @return appName
*/ */
public CommonConfig.AppName getAppName() { public CommonConfig.AppName getAppName() {
@ -216,51 +289,79 @@ public class ObHourReports {
/** /**
* Updates zones in the Hour Reports * Updates zones in the Hour Reports
*
* @param configMgr
*/ */
public void updateZones() { public void updateZones() {
Map<String, List<String>> zoneStationMap = MonitoringArea // Updated list of zones
.getPlatformMap(); List<String> updtZones = configMgr.getAreaList();
// remove zones or stations // remove zones
List<String> hourZones = new CopyOnWriteArrayList<String>( hourReports.keySet().retainAll(updtZones);
hourReports.keySet());
for (String zone : hourZones) {
if (hourReports.keySet().contains(zone)) {
List<String> stations = new CopyOnWriteArrayList<String>(
hourReports.get(zone).getZoneHourReports().keySet());
for (String stn : stations) {
if (zoneStationMap.get(zone) != null) {
if (!zoneStationMap.get(zone).contains(stn)) {
hourReports.get(zone).getZoneHourReports()
.remove(stn);
}
}
}
if (!zoneStationMap.keySet().contains(zone)) {
hourReports.remove(zone);
}
}
}
// add zones // add zones
for (String zone : zoneStationMap.keySet()) { for (String zone : updtZones) {
List<String> stations = new CopyOnWriteArrayList<String>( if (!hourReports.keySet().contains(zone)) {
zoneStationMap.get(zone));
for (String stn : stations) {
if (hourReports.get(zone) != null) {
if (!hourReports.get(zone).getZoneHourReports()
.containsKey(stn)) {
hourReports
.get(zone)
.getZoneHourReports()
.put(stn,
new ObStnHourReports(nominalTime, zone,
stn, appName, thresholdMgr));
}
}
}
if (!hourReports.containsKey(zone)) {
hourReports.put(zone, new ObZoneHourReports(nominalTime, zone, hourReports.put(zone, new ObZoneHourReports(nominalTime, zone,
appName, thresholdMgr)); appName, thresholdMgr));
} }
} }
// add and(or) remove stations
for (String zone : updtZones) {
// Updated list of stations in this zone
List<String> updtStns = configMgr.getAreaStations(zone);
// remove stations
hourReports.get(zone).getZoneHourReports().keySet()
.retainAll(updtStns);
// add stations
for (String stn : updtStns) {
if (!hourReports.get(zone).getZoneHourReports()
.containsKey(stn)) {
hourReports
.get(zone)
.getZoneHourReports()
.put(stn,
new ObStnHourReports(nominalTime, zone,
stn, appName, thresholdMgr));
}
}
// update hourReports for current zone
hourReports.get(zone).getZoneHourReports();
}
}
/**
* Distance between two coordinates.
*
* @param lat1
* @param lon1
* @param lat2
* @param lon2
* @return distance in km
*/
public static double distance(double lat1, double lon1, double lat2,
double lon2) {
// Earth's radius of 6378.137 kilometers
float EarthRadius = 6378.137f;
double dLat = toRad(lat2 - lat1);
double dLon = toRad(lon2 - lon1);
lat1 = toRad(lat1);
lat2 = toRad(lat2);
double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon / 2)
* Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return EarthRadius * c;
}
/**
* From grad to radian.
*
* @param value
* @return
*/
private static double toRad(double value) {
return value * Math.PI / 180;
} }
} }

View file

@ -24,15 +24,22 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.SortedMap; import java.util.SortedMap;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType;
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr; import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
@ -50,10 +57,11 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
* Dec. 1, 2009 3424 zhao Initial creation. * Dec. 1, 2009 3424 zhao Initial creation.
* Dec 24, 2009 3424 zhao added getTrendDataSet() that returns ObTrendDataSet object * Dec 24, 2009 3424 zhao added getTrendDataSet() that returns ObTrendDataSet object
* Jan 25, 2010 4281, 3888, 3877 wkwock/zhao added getHistTableData method * Jan 25, 2010 4281, 3888, 3877 wkwock/zhao added getHistTableData method
* Oct.31, 2012 1297 skorolev Clean code. * Oct 31, 2012 1297 skorolev Clean code.
* Jan. 29, 2013 15654 zhao add Wind Chill calculation for SNOW * Jan 29, 2013 15654 zhao add Wind Chill calculation for SNOW
* Sep 04, 2014 3220 skorolev Updated getStationTableData method. * Sep 04, 2014 3220 skorolev Updated getStationTableData method.
* * Sep 25, 2015 3873 skorolev Added multiHrsTabData.
*
* </pre> * </pre>
* *
* @author zhao * @author zhao
@ -61,6 +69,8 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
*/ */
public class ObMultiHrsReports { public class ObMultiHrsReports {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ObMultiHrsReports.class);
/** /**
* Thresholds manager * Thresholds manager
@ -78,17 +88,18 @@ public class ObMultiHrsReports {
private CommonConfig.AppName appName; private CommonConfig.AppName appName;
/** /**
* key is nominal time, value is ObHourReports object * FSSObs records cache. Key is nominal time, value is ObHourReports object
*/ */
private SortedMap<Date, ObHourReports> multiHrsReports; private SortedMap<Date, ObHourReports> multiHrsReports = new TreeMap<Date, ObHourReports>();
/** /**
* The maximum number of most recent hours within which observation reports * Monitor Table data cache. Key is nominal time, value is TableData
* are to be archived. TODO: move MAX_FRAMES to a configuration file?
*/ */
private final int MAX_FRAMES = 64; private ConcurrentHashMap<Date, TableData> multiHrsTabData = new ConcurrentHashMap<Date, TableData>();
private int maxFrames = MAX_FRAMES; private int maxFrames = ObConst.MAX_FRAMES;
private FSSObsMonitorConfigurationManager cfgMgr = null;
/** /**
* Constructor * Constructor
@ -97,28 +108,16 @@ public class ObMultiHrsReports {
*/ */
public ObMultiHrsReports(CommonConfig.AppName appName) { public ObMultiHrsReports(CommonConfig.AppName appName) {
this.appName = appName; this.appName = appName;
multiHrsReports = new TreeMap<Date, ObHourReports>();
if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
initFogAlgCellType();
}
}
/** if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
* Add an array of ObReport objects to the ObMultiHrsReports object (Don't if (appName.equals(AppName.FOG)) {
* use! VK) cfgMgr = FSSObsMonitorConfigurationManager
* .getInstance(MonName.fog);
* @param result } else if (appName.equals(AppName.SAFESEAS)) {
*/ cfgMgr = FSSObsMonitorConfigurationManager
public void addReports(ObReport[] results) { .getInstance(MonName.ss);
for (ObReport report : results) {
/**
* DR #8723: if wind speed is zero, wind direction should be N/A,
* not 0
*/
if (report.getWindSpeed() < 0.0001) { // zero wind speed
report.setWindDir(ObConst.MISSING);
} }
addReport(report); initFogAlgCellType();
} }
} }
@ -129,8 +128,6 @@ public class ObMultiHrsReports {
* @return returns multiHrsReports * @return returns multiHrsReports
*/ */
public void addReport(ObReport report) { public void addReport(ObReport report) {
// Date nominalTime = TableUtil
// .getNominalTime(report.getObservationTime());
Date nominalTime = report.getRefHour(); Date nominalTime = report.getRefHour();
/** /**
* DR #8723: if wind speed is zero, wind direction should be N/A, not 0 * DR #8723: if wind speed is zero, wind direction should be N/A, not 0
@ -151,50 +148,56 @@ public class ObMultiHrsReports {
/** /**
* DR15654: set Wind Chill for SNOW * DR15654: set Wind Chill for SNOW
*/ */
if ( appName == AppName.SNOW ) { if (appName == AppName.SNOW) {
if ( report.getTemperature() != ObConst.MISSING && report.getWindSpeed() != ObConst.MISSING ) { if (report.getTemperature() != ObConst.MISSING
report.setWindChill(calcWindChill( report.getTemperature(), report.getWindSpeed() )); && report.getWindSpeed() != ObConst.MISSING) {
report.setWindChill(calcWindChill(report.getTemperature(),
report.getWindSpeed()));
} }
} }
ObHourReports obHourReports;
if (multiHrsReports.containsKey(nominalTime)) { // new nominal time; create a new ObHourReports object
multiHrsReports.get(nominalTime).addReport(report); if (multiHrsReports.isEmpty()
|| !multiHrsReports.containsKey(nominalTime)) {
obHourReports = new ObHourReports(nominalTime, appName,
thresholdMgr);
} else { } else {
// new nominal time; create a new ObHourReports object // the map is full; delete the oldest entry
if (multiHrsReports.size() >= maxFrames) { if (multiHrsReports.size() >= maxFrames) {
// the map is full; delete the oldest entry
multiHrsReports.remove(multiHrsReports.firstKey()); multiHrsReports.remove(multiHrsReports.firstKey());
} }
ObHourReports obHourReports = new ObHourReports(nominalTime, // update multiHrsReports with new data
appName, thresholdMgr); obHourReports = multiHrsReports.get(nominalTime);
obHourReports.addReport(report);
multiHrsReports.put(nominalTime, obHourReports);
} }
obHourReports.addReport(report);
// update data cache
multiHrsReports.put(nominalTime, obHourReports);
TableData tblData = obHourReports.getZoneTableData();
multiHrsTabData.put(nominalTime, tblData);
} }
/** /**
* DR 15654: * DR 15654: Wind Chill calculation formula based on
* Wind Chill calculation formula based on * http://www.nws.noaa.gov/om/windchill/ as of Jan. 29, 2013
* http://www.nws.noaa.gov/om/windchill/ *
* as of Jan. 29, 2013 * @param temp
* * in degree F
* @param temperature in degree F * @param windSpd
* @param windSpeed in knots * in knots
* @return wind chill in degree F * @return wind chill in degree F
*/ */
private float calcWindChill(float temp, float windSpd) { private float calcWindChill(float temp, float windSpd) {
if ( temp > 50.0 || windSpd < 3.0 ) { if (temp > 50.0 || windSpd < 3.0) {
return ObConst.MISSING; return ObConst.MISSING;
} }
/** /**
* 1 knots = 1.15078 mph * 1 knots = 1.15078 mph
*/ */
float spd = (float) Math.pow(1.15078*windSpd, 0.16); float spd = (float) Math.pow(1.15078 * windSpd, 0.16);
return 35.74f + 0.6215f*temp - 35.75f*spd + 0.4275f*temp*spd; return 35.74f + 0.6215f * temp - 35.75f * spd + 0.4275f * temp * spd;
} }
/** /**
* Returns a zone TableData object of the latest nominal time. If no data * Returns a zone TableData object of the latest nominal time. If no data
* available (the map is empty), returns an empty zone TableData object * available (the map is empty), returns an empty zone TableData object
* (table cells filled with "N/A"). * (table cells filled with "N/A").
@ -211,26 +214,31 @@ public class ObMultiHrsReports {
/** /**
* Returns a zone TableData object for a caller-specified nominal-time. If * Returns a zone TableData object for a caller-specified nominal-time. If
* no data available, returns an empty/default zone TableData object (table * no data available, returns an empty/default zone TableData object (table
* cells filled with "N/A"). * cells filled with "N/A"). Updates multiHrsTabData table cache.
* *
* @param nominalTime * @param nominalTime
* @return * @return
*/ */
public TableData getZoneTableData(Date nominalTime) { public TableData getZoneTableData(Date nominalTime) {
TableData tabData = null;
if (nominalTime == null || !multiHrsReports.containsKey(nominalTime)) { if (nominalTime == null || !multiHrsReports.containsKey(nominalTime)) {
return getEmptyZoneTableData(); return getEmptyZoneTableData();
} }
if (appName == AppName.FOG) { if (appName == AppName.FOG) {
return this.getObHourReports(nominalTime).getFogZoneTableData( tabData = this.getObHourReports(nominalTime).getFogZoneTableData(
fogAlgCellType); fogAlgCellType);
} } else if (appName == AppName.SAFESEAS) {
if (appName == AppName.SAFESEAS) { tabData = this.getObHourReports(nominalTime).getSSZoneTableData(
return this.getObHourReports(nominalTime).getSSZoneTableData(
fogAlgCellType); fogAlgCellType);
}
return this.getObHourReports(nominalTime).getZoneTableData(); } else {
// return multiHrsReports.get(nominalTime).getZoneTableData(); tabData = this.getObHourReports(nominalTime).getZoneTableData();
}
// update table data cache
if (multiHrsTabData.replace(nominalTime, tabData) == null) {
multiHrsTabData.put(nominalTime, tabData);
}
return tabData;
} }
/** /**
@ -243,15 +251,27 @@ public class ObMultiHrsReports {
.getSystemTime().getTime()); .getSystemTime().getTime());
ObHourReports hourReports = new ObHourReports(nominalTime, appName, ObHourReports hourReports = new ObHourReports(nominalTime, appName,
thresholdMgr); thresholdMgr);
TableData tabData = null;
if (appName == AppName.FOG) { if (appName == AppName.FOG) {
return hourReports.getFogZoneTableData(fogAlgCellType); tabData = hourReports.getFogZoneTableData(fogAlgCellType);
} else {
tabData = hourReports.getZoneTableData();
} }
return hourReports.getZoneTableData(); // update data cache
multiHrsReports.put(nominalTime, hourReports);
// update cache with empty table data
if (multiHrsTabData.replace(nominalTime, tabData) == null) {
multiHrsTabData.put(nominalTime, tabData);
}
return tabData;
} }
/** /**
* Returns the station TableData object for the latest nominal time. If no * Returns the station TableData object for the latest nominal time. If no
* data available, an empty/default station TableData object is returned * data available, an empty/default station TableData object is returned
*
* @param zone
* @return
*/ */
public TableData getStationTableData(String zone) { public TableData getStationTableData(String zone) {
if (multiHrsReports.isEmpty()) { if (multiHrsReports.isEmpty()) {
@ -264,9 +284,13 @@ public class ObMultiHrsReports {
* Returns a station TableData object for a caller-specified nominal-time * Returns a station TableData object for a caller-specified nominal-time
* and zone ID. If no data available, an empty/default station TableData * and zone ID. If no data available, an empty/default station TableData
* object is returned. * object is returned.
*
* @param nominalTime
* @param zone
* @return
*/ */
public TableData getStationTableData(Date nominalTime, String zone) { public TableData getStationTableData(Date nominalTime, String zone) {
if(zone.equals("")){ if (zone.equals("")) {
return this.getEmptyZoneTableData(); return this.getEmptyZoneTableData();
} }
if (nominalTime == null) { if (nominalTime == null) {
@ -296,6 +320,7 @@ public class ObMultiHrsReports {
* @param zone * @param zone
* @param Station * @param Station
* @param varName * @param varName
* @param productName
* @return ObTrendDataSet object, or null if no data available * @return ObTrendDataSet object, or null if no data available
*/ */
public ObTrendDataSet getTrendDataSet(String zone, String station, public ObTrendDataSet getTrendDataSet(String zone, String station,
@ -304,81 +329,45 @@ public class ObMultiHrsReports {
if (multiHrsReports.isEmpty()) { if (multiHrsReports.isEmpty()) {
return null; return null;
} }
// Trend plot for the past 24 hours.
// Instead of using present time as the latest time,
// here we use the latest nominal time as the latest time
// and get data within 24 hours before the latest nominal time
// [probably present time should be used as the latest time for trending
// plots-- fix this later]
Date latestNominalTime = multiHrsReports.lastKey();
// determine trending start nominal time
Date startNominalTime = multiHrsReports.firstKey();
// startNominalTime must be within 24 hours before latestNominalTime
long diff = (latestNominalTime.getTime() - startNominalTime.getTime())
/ (60 * 60 * 60); // difference in hour between the two dates
if (diff > 24) {
// find the startNominalTime
Calendar cal = Calendar.getInstance();
cal.setTime(latestNominalTime);
cal.add(Calendar.DAY_OF_YEAR, -1);
Date expectedStartNominalTime = cal.getTime(); // expected, but may
// not exist in
// multiHrsReports
if (multiHrsReports.containsKey(expectedStartNominalTime)) {
startNominalTime = expectedStartNominalTime;
} else {
// this iterator is ordered since multiHrsReports is a sorted
// map
Iterator<Date> iterator = multiHrsReports.keySet().iterator();
while (iterator.hasNext()) {
Date nominalTime = iterator.next();
if (nominalTime.compareTo(expectedStartNominalTime) >= 0) {
startNominalTime = nominalTime;
break;
}
}
}
}
// get data // get data
ObTrendDataSet trendData = new ObTrendDataSet(zone, varName, ObTrendDataSet trendData = new ObTrendDataSet(zone, varName,
productName, appName, thresholdMgr); productName, appName, thresholdMgr);
// trendData.setThresholdMgr(thresholdMgr);
Iterator<Date> nominalTimeIterator = multiHrsReports.keySet() Iterator<Date> nominalTimeIterator = multiHrsReports.keySet()
.iterator(); .iterator();
Date start = findStartNominalTime();
while (nominalTimeIterator.hasNext()) { while (nominalTimeIterator.hasNext()) {
Date nominalTime = nominalTimeIterator.next(); Date nominalTime = nominalTimeIterator.next();
if (nominalTime.compareTo(startNominalTime) >= 0) { if (nominalTime.compareTo(start) >= 0) {
Set<Date> obsTimes = this.getObHourReports(nominalTime) ObStnHourReports stnHrRpts = this.getObHourReports(nominalTime)
.getObZoneHourReports(zone) .getObZoneHourReports(zone)
.getObStnHourReports(station).getObsTimes(); .getObStnHourReports(station);
if (obsTimes != null) { if (stnHrRpts != null) {
for (Date obsTime : obsTimes) { Set<Date> obsTimes = stnHrRpts.getObsTimes();
trendData.addDataPoint(obsTime, if (obsTimes != null) {
new Float(this.getObHourReports(nominalTime) for (Date obsTime : obsTimes) {
.getObZoneHourReports(zone) trendData.addDataPoint(obsTime, new Float(stnHrRpts
.getObStnHourReports(station) .getObReport(obsTime).get(varName)));
.getObReport(obsTime).get(varName))); }
} else {
continue;
} }
} }
} }
} }
return trendData; return trendData;
} }
/** /**
* Gets History Table Data
* *
* @param zone
* : current zone
* @param station * @param station
* station ID * : station ID
* @param obsType * @param obsType
* ObsHistType * : ObsHistType
* @return TableData object for obs history table * @return
*/ */
public TableData getHistTableData(String zone, String station, public TableData getHistTableData(String zone, String station,
ObsHistType obsType) { ObsHistType obsType) {
@ -387,37 +376,69 @@ public class ObMultiHrsReports {
if (multiHrsReports.isEmpty()) { if (multiHrsReports.isEmpty()) {
return tblData; return tblData;
} }
ArrayList<TableRowData> tblRows = new ArrayList<TableRowData>();
Iterator<Date> nominalTimeIterator = multiHrsReports.keySet()
.iterator();
Date start = findStartNominalTime();
while (nominalTimeIterator.hasNext()) {
Date nominalTime = nominalTimeIterator.next();
if (nominalTime.compareTo(start) >= 0) {
ObStnHourReports stnHrRpts = this.getObHourReports(nominalTime)
.getObZoneHourReports(zone)
.getObStnHourReports(station);
if (stnHrRpts != null) {
Set<Date> obsTimes = stnHrRpts.getObsTimes();
if (obsTimes != null) {
for (Date obsTime : obsTimes) {
ObReport report = stnHrRpts.getObReport(obsTime);
tblRows.add(TableUtil.getHistTableRowData(appName,
obsType, report));
}
} else {
continue;
}
}
}
}
/**
* sort first column descending in obs time
*/
ArrayList<TableRowData> tblRows2 = new ArrayList<TableRowData>();
for (int i = 0; i < tblRows.size(); i++) {
tblRows2.add(tblRows.get(tblRows.size() - 1 - i));
}
tblData.setTableRows(tblRows2);
return tblData;
}
private Date findStartNominalTime() {
// Trend plot for the past 24 hours. // Trend plot for the past 24 hours.
// Instead of using present time as the latest time, // Instead of using present time as the latest time,
// here we use the latest nominal time as the latest time // here we use the latest nominal time as the latest time
// and get data within 24 hours before the latest nominal time // and get data within 24 hours before the latest nominal time
// [probably present time should be used as the latest time for trending // [probably present time should be used as the latest time for trending
// plots-- fix this later] // plots-- fix this later]
Date latestNominalTime = multiHrsReports.lastKey(); Date latestNominalTime = multiHrsReports.lastKey();
// determine trending start nominal time // determine trending start nominal time
Date startNominalTime = multiHrsReports.firstKey(); Date startNominalTime = multiHrsReports.firstKey();
// startNominalTime must be within 24 hours before latestNominalTime // startNominalTime must be within 24 hours before latestNominalTime
long diff = (latestNominalTime.getTime() - startNominalTime.getTime()) long diff = (latestNominalTime.getTime() - startNominalTime.getTime())
/ (60 * 60 * 60); // difference in hour between the two dates / TimeUtil.MILLIS_PER_HOUR;
// difference in hours between the two dates
if (diff > 24) { if (diff > 24) {
// find the startNominalTime // find the startNominalTime
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(latestNominalTime); cal.setTime(latestNominalTime);
cal.add(Calendar.DAY_OF_YEAR, -1); cal.add(Calendar.DAY_OF_YEAR, -1);
Date expectedStartNominalTime = cal.getTime(); // expected, but may // expected, but may not exist in multiHrsReports
// not exist in Date expectedStartNominalTime = cal.getTime();
// multiHrsReports
if (multiHrsReports.containsKey(expectedStartNominalTime)) { if (multiHrsReports.containsKey(expectedStartNominalTime)) {
startNominalTime = expectedStartNominalTime; startNominalTime = expectedStartNominalTime;
} else { } else {
// this iterator is ordered since multiHrsReports is a sorted // this iterator is ordered since multiHrsReports is a sorted
// map // map
Iterator<Date> iterator = multiHrsReports.keySet().iterator(); Iterator<Date> iterator = multiHrsReports.keySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Date nominalTime = iterator.next(); Date nominalTime = iterator.next();
if (nominalTime.compareTo(expectedStartNominalTime) >= 0) { if (nominalTime.compareTo(expectedStartNominalTime) >= 0) {
@ -427,81 +448,50 @@ public class ObMultiHrsReports {
} }
} }
} }
return startNominalTime;
// get data
ArrayList<TableRowData> tblRows = new ArrayList<TableRowData>();
Iterator<Date> nominalTimeIterator = multiHrsReports.keySet()
.iterator();
while (nominalTimeIterator.hasNext()) {
Date nominalTime = nominalTimeIterator.next();
if (nominalTime.compareTo(startNominalTime) >= 0) {
Set<Date> obsTimes = this.getObHourReports(nominalTime)
.getObZoneHourReports(zone)
.getObStnHourReports(station).getObsTimes();
if (obsTimes != null) {
for (Date obsTime : obsTimes) {
ObReport report = getObHourReports(nominalTime)
.getObZoneHourReports(zone)
.getObStnHourReports(station)
.getObReport(obsTime);
tblRows.add(TableUtil.getHistTableRowData(appName,
obsType, report));
}
}
}
}
/**
* sort first column descending in obs time
*/
ArrayList<TableRowData> tblRows2 = new ArrayList<TableRowData>();
for (int i = 0; i < tblRows.size(); i++) {
tblRows2.add(tblRows.get(tblRows.size() - 1 - i));
}
tblData.setTableRows(tblRows2);
return tblData;
} }
/** /**
* Returns a SortedMap object <nominal time, ObHourReports object> * Gets table cache
* *
* @return multiHrsReports * @return
*/
public ConcurrentHashMap<Date, TableData> getMultiHrsTabData() {
return multiHrsTabData;
}
/**
* Sets table cache
*
* @param multiHrsTabData
*/
public void setMultiHrsTabData(
ConcurrentHashMap<Date, TableData> multiHrsTabData) {
this.multiHrsTabData = multiHrsTabData;
}
/**
* Gets data cache
*
* @return SortedMap object <nominal time, ObHourReports object>
*/ */
public SortedMap<Date, ObHourReports> getMultiHrsReports() { public SortedMap<Date, ObHourReports> getMultiHrsReports() {
return multiHrsReports; return multiHrsReports;
} }
/** /**
* Returns a SortedMap object (key is nominal time, value is zone TableData * Sets data cache
* object)
* *
* @return * @param multiHrsReports
*/ */
public SortedMap<Date, TableData> getMultiHrsTableData() { public void setMultiHrsReports(
SortedMap<Date, TableData> multiHrsTblData = new TreeMap<Date, TableData>(); SortedMap<Date, ObHourReports> multiHrsReports) {
if (appName == AppName.FOG) { this.multiHrsReports = multiHrsReports;
for (Date nominalTime : multiHrsReports.keySet()) {
multiHrsTblData.put(
nominalTime,
multiHrsReports.get(nominalTime).getFogZoneTableData(
fogAlgCellType));
}
return multiHrsTblData;
}
for (Date nominalTime : multiHrsReports.keySet()) {
multiHrsTblData.put(nominalTime, multiHrsReports.get(nominalTime)
.getZoneTableData());
}
return multiHrsTblData;
} }
/** /**
* Returns the latest nominal time if the map is not empty; otherwise, * Gets the Latest NominalTime Returns the latest nominal time if the map is
* returns the nominal time of the present date-time * not empty; otherwise, returns the nominal time of the present date-time
* *
* @return * @return
*/ */
@ -517,31 +507,39 @@ public class ObMultiHrsReports {
} }
/** /**
* Returns a set of nominal times * Gets Nominal Times
* *
* @return * @return a set of nominal times
*/ */
public Set<Date> getNominalTimes() { public Set<Date> getNominalTimes() {
return multiHrsReports.keySet(); return multiHrsReports.keySet();
} }
/** /**
* Returns the ObHourReports object of the latest nominal time. If no data * Gets ObHourReports Returns the ObHourReports object of the latest nominal
* available, returns an empty ObHourReports object. * time. If no data available, returns an empty ObHourReports object.
* *
* @return * @return
*/ */
public ObHourReports getObHourReports() { public ObHourReports getObHourReports() {
if (multiHrsReports.isEmpty()) { if (multiHrsReports.isEmpty()) {
return new ObHourReports(TableUtil.getNominalTime(SimulatedTime ObHourReports obHrsReps = new ObHourReports(
.getSystemTime().getTime()), appName, thresholdMgr); TableUtil.getNominalTime(SimulatedTime.getSystemTime()
.getTime()), appName, thresholdMgr);
// Save table data cache.
Date refTm = obHrsReps.getNominalTime();
TableData tabData = obHrsReps.getZoneTableData();
multiHrsTabData.clear();
multiHrsTabData.put(refTm, tabData);
return obHrsReps;
} }
return multiHrsReports.get(multiHrsReports.lastKey()); return multiHrsReports.get(multiHrsReports.lastKey());
} }
/** /**
* Returns an ObHourReports object of a caller-specified nominal time. If no * Gets ObHourReports Returns an ObHourReports object of a caller-specified
* data available, returns an empty ObHourReports object. * nominal time. If no data available, returns an empty ObHourReports
* object.
* *
* @param nominalTime * @param nominalTime
* @return * @return
@ -574,6 +572,7 @@ public class ObMultiHrsReports {
} }
/** /**
* Gets Threshold Manager
* *
* @return the threshold manager * @return the threshold manager
*/ */
@ -591,6 +590,7 @@ public class ObMultiHrsReports {
} }
/** /**
* Gets map of types for ALG cell
* *
* @return fogAlgCellType * @return fogAlgCellType
*/ */
@ -603,11 +603,20 @@ public class ObMultiHrsReports {
*/ */
private void initFogAlgCellType() { private void initFogAlgCellType() {
fogAlgCellType = new HashMap<String, CellType>(); fogAlgCellType = new HashMap<String, CellType>();
Set<String> zones = MonitoringArea.getPlatformMap().keySet(); List<String> zones = cfgMgr.getAreaList();
Iterator<String> itr = zones.iterator(); Iterator<String> itr = zones.iterator();
while (itr.hasNext()) { while (itr.hasNext()) {
fogAlgCellType.put(itr.next(), CellType.NotAvailable); fogAlgCellType.put(itr.next(), CellType.NotAvailable);
} }
setFogAlgCellType(fogAlgCellType); setFogAlgCellType(fogAlgCellType);
} }
/**
* Updates table cache
*/
public void updateTableCache() {
for (Date time : multiHrsReports.keySet()) {
getZoneTableData(time);
}
}
} }

File diff suppressed because it is too large Load diff

View file

@ -25,8 +25,6 @@ import java.util.Date;
import com.raytheon.uf.common.geospatial.ISpatialQuery; import com.raytheon.uf.common.geospatial.ISpatialQuery;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory; import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
import com.raytheon.uf.common.monitor.MonitorAreaUtils; import com.raytheon.uf.common.monitor.MonitorAreaUtils;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.monitor.data.ObConst;
@ -53,7 +51,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* May 23, 2012 14410 zhao Modified getCellTypeForBlizWarn and getCellTypeForHsnowWarn modules * May 23, 2012 14410 zhao Modified getCellTypeForBlizWarn and getCellTypeForHsnowWarn modules
* Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn * Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn
* May 23, 2014 3086 skorolev Corrected ObsHistType. Cleaned code. * May 23, 2014 3086 skorolev Corrected ObsHistType. Cleaned code.
* Aug 17, 2015 3841 skorolev Added coordinates in the hover text for a newly added zones. * Sep 18, 2015 3873 skorolev Added coordinates in the hover text for a newly added zones.Corrected code for Fog and SNOW table data.
* *
* </pre> * </pre>
* *
@ -114,17 +112,23 @@ public final class TableUtil {
isZone = true; isZone = true;
} }
String hoverText = null; DataUsageKey dataUsageKey;
if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
}
String hoverText = "";
if (isZone) { if (isZone) {
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone);
.getObsManager(MonName.fog).getAreaXml(zone);
if (zoneXML != null) { if (zoneXML != null) {
hoverText = getZoneHoverText(zoneXML); hoverText = getZoneHoverText(zoneXML);
} }
} else { } else {
hoverText = getStationHoverText(areaId); hoverText = getStationHoverText(areaId);
} }
// zone or station ID
tblRowData.setTableCellData(0, new TableCellData(areaId, hoverText, tblRowData.setTableCellData(0, new TableCellData(areaId, hoverText,
CellType.AreaId, false)); CellType.AreaId, false));
@ -139,14 +143,18 @@ public final class TableUtil {
visValue = visValue * 16.0f; // vis in units of "miles/16"; this is visValue = visValue * 16.0f; // vis in units of "miles/16"; this is
// used to compare with Red/Yellow // used to compare with Red/Yellow
// threshold values // threshold values
String mccVIS = "";
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccVIS = MonitorConfigConstants.FogDisplay.FOG_DISP_METEO_VIS
.getXmlKey();
} else {
mccVIS = MonitorConfigConstants.FogMonitor.FOG_MONITOR_METEO_VIS
.getXmlKey();
}
TableCellData visCellData = new TableCellData( TableCellData visCellData = new TableCellData(visString,
visString, tm.getThresholdValueCellType(dataUsageKey, zone, mccVIS,
tm.getThresholdValueCellType( visValue), true);
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.FogDisplay.FOG_DISP_METEO_VIS
.getXmlKey(), visValue), true);
visCellData.setValue(visValue); // visValue, instead of visString, visCellData.setValue(visValue); // visValue, instead of visString,
// will be used for sorting // will be used for sorting
@ -345,10 +353,16 @@ public final class TableUtil {
isZone = true; isZone = true;
} }
String hoverText = null; DataUsageKey dataUsageKey;
if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
}
String hoverText = "";
if (isZone) { if (isZone) {
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone);
.getObsManager(MonName.ss).getAreaXml(zone);
if (zoneXML != null) { if (zoneXML != null) {
hoverText = getZoneHoverText(zoneXML); hoverText = getZoneHoverText(zoneXML);
} }
@ -403,42 +417,52 @@ public final class TableUtil {
.getXmlKey(), report .getXmlKey(), report
.getWindDir()), true)); .getWindDir()), true));
} }
String mccWind;
// wind speed
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccWind = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED
.getXmlKey();
} else {
mccWind = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_WIND_SPEED
.getXmlKey();
}
tblRowData.setTableCellData(
6,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
tm.getThresholdValueCellType(dataUsageKey, zone,
mccWind, report.getWindSpeed()), true));
tblRowData // peak wind
.setTableCellData( String mccPeakWind;
6, if (dataUsageKey == DataUsageKey.DISPLAY) {
new TableCellData( mccPeakWind = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND
Math.round(new Float(report.getWindSpeed())), .getXmlKey();
tm.getThresholdValueCellType( } else {
DataUsageKey.DISPLAY, mccPeakWind = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_PEAK_WIND
zone, .getXmlKey();
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED }
.getXmlKey(), report tblRowData.setTableCellData(
.getWindSpeed()), true)); 7,
new TableCellData(
Math.round(new Float(report.getMaxWindSpeed())), tm
.getThresholdValueCellType(dataUsageKey, zone,
mccPeakWind, report.getMaxWindSpeed()),
true));
// wind gust
String mccWindGust;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccWindGust = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_GUST_SPEED
.getXmlKey();
} else {
mccWindGust = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_GUST_SPEED
.getXmlKey();
}
tblRowData tblRowData.setTableCellData(
.setTableCellData( 8,
7, new TableCellData(Math.round(new Float(report.getWindGust())),
new TableCellData( tm.getThresholdValueCellType(dataUsageKey, zone,
Math.round(new Float(report.getMaxWindSpeed())), mccWindGust, report.getWindGust()), true));
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND
.getXmlKey(), report
.getMaxWindSpeed()), true));
tblRowData
.setTableCellData(
8,
new TableCellData(
Math.round(new Float(report.getWindGust())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_GUST_SPEED
.getXmlKey(), report
.getWindGust()), true));
// visibility // visibility
float visValue = report.getVisibility(); // vis value in miles (statute float visValue = report.getVisibility(); // vis value in miles (statute
@ -456,20 +480,25 @@ public final class TableUtil {
// to compare with Red/Yellow threshold // to compare with Red/Yellow threshold
// values // values
TableCellData visCellData = new TableCellData( String mccVis;
visString, if (dataUsageKey == DataUsageKey.DISPLAY) {
tm.getThresholdValueCellType( mccVis = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS
DataUsageKey.DISPLAY, .getXmlKey();
zone, } else {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS mccVis = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_VIS
.getXmlKey(), visValue), true); .getXmlKey();
}
TableCellData visCellData = new TableCellData(visString,
tm.getThresholdValueCellType(dataUsageKey, zone, mccVis,
visValue), true);
visCellData.setValue(visValue); // visValue, instead of visString, visCellData.setValue(visValue); // visValue, instead of visString,
// will be used for sorting // will be used for sorting
tblRowData.setTableCellData(9, visCellData); tblRowData.setTableCellData(9, visCellData);
} }
// temperature
tblRowData tblRowData
.setTableCellData( .setTableCellData(
10, 10,
@ -481,7 +510,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_TEMP MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_TEMP
.getXmlKey(), report .getXmlKey(), report
.getTemperature()), true)); .getTemperature()), true));
// dewpoint
tblRowData tblRowData
.setTableCellData( .setTableCellData(
11, 11,
@ -493,7 +522,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_DEWPT MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_DEWPT
.getXmlKey(), report .getXmlKey(), report
.getDewpoint()), true)); .getDewpoint()), true));
// SLP
tblRowData tblRowData
.setTableCellData( .setTableCellData(
12, 12,
@ -505,7 +534,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SLP MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SLP
.getXmlKey(), report .getXmlKey(), report
.getSeaLevelPress()), true)); .getSeaLevelPress()), true));
// SST
tblRowData tblRowData
.setTableCellData( .setTableCellData(
13, 13,
@ -517,7 +546,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SST MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SST
.getXmlKey(), report .getXmlKey(), report
.getSeaSurfaceTemp()), true)); .getSeaSurfaceTemp()), true));
// wave height
tblRowData tblRowData
.setTableCellData( .setTableCellData(
14, 14,
@ -530,7 +559,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_HT MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_HT
.getXmlKey(), report .getXmlKey(), report
.getHighResWaveHeight()), true)); .getHighResWaveHeight()), true));
// wave steep
tblRowData tblRowData
.setTableCellData( .setTableCellData(
15, 15,
@ -542,79 +571,102 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP
.getXmlKey(), report .getXmlKey(), report
.getWaveSteepness()), true)); .getWaveSteepness()), true));
// swell height
tblRowData String mccSwell;
.setTableCellData( if (dataUsageKey == DataUsageKey.DISPLAY) {
16, mccSwell = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT
new TableCellData( .getXmlKey();
Math.round(new Float(report.getPSwellHeight())), } else {
tm.getThresholdValueCellType( mccSwell = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_HT
DataUsageKey.DISPLAY, .getXmlKey();
zone, }
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT tblRowData.setTableCellData(
.getXmlKey(), report 16,
.getPSwellHeight()), true)); new TableCellData(
Math.round(new Float(report.getPSwellHeight())), tm
tblRowData .getThresholdValueCellType(dataUsageKey, zone,
.setTableCellData( mccSwell, report.getPSwellHeight()),
17, true));
new TableCellData( // swell period
Math.round(new Float(report.getPSwellPeriod())), String mccSwellPD;
tm.getThresholdValueCellType( if (dataUsageKey == DataUsageKey.DISPLAY) {
DataUsageKey.DISPLAY, mccSwellPD = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD
zone, .getXmlKey();
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD } else {
.getXmlKey(), report mccSwellPD = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_PD
.getPSwellPeriod()), true)); .getXmlKey();
}
tblRowData tblRowData.setTableCellData(
.setTableCellData( 17,
18, new TableCellData(
new TableCellData( Math.round(new Float(report.getPSwellPeriod())), tm
Math.round(new Float(report.getPSwellDir())), .getThresholdValueCellType(dataUsageKey, zone,
tm.getThresholdValueCellType( mccSwellPD, report.getPSwellPeriod()),
DataUsageKey.DISPLAY, true));
zone, // swell dir TODO: from only
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM String mccSwellDirFrom;
.getXmlKey(), report if (dataUsageKey == DataUsageKey.DISPLAY) {
.getPSwellDir()), true)); mccSwellDirFrom = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_DIR_FROM
.getXmlKey();
tblRowData } else {
.setTableCellData( mccSwellDirFrom = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM
19, .getXmlKey();
new TableCellData( }
Math.round(new Float(report.getSSwellHeight())), tblRowData.setTableCellData(
tm.getThresholdValueCellType( 18,
DataUsageKey.DISPLAY, new TableCellData(Math.round(new Float(report.getPSwellDir())),
zone, tm.getThresholdValueCellType(dataUsageKey, zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_HT mccSwellDirFrom, report.getPSwellDir()), true));
.getXmlKey(), report // swell2 height
.getSSwellHeight()), true)); String mccSwell2HT;
if (dataUsageKey == DataUsageKey.DISPLAY) {
tblRowData mccSwell2HT = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_HT
.setTableCellData( .getXmlKey();
20, } else {
new TableCellData( mccSwell2HT = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_SEC_HT
Math.round(new Float(report.getSSwellPeriod())), .getXmlKey();
tm.getThresholdValueCellType( }
DataUsageKey.DISPLAY, tblRowData.setTableCellData(
zone, 19,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_PD new TableCellData(
.getXmlKey(), report Math.round(new Float(report.getSSwellPeriod())), tm
.getSSwellPeriod()), true)); .getThresholdValueCellType(dataUsageKey, zone,
mccSwell2HT, report.getSSwellPeriod()),
true));
// swell2 period
String mccSwell2PD;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccSwell2PD = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_PD
.getXmlKey();
} else {
mccSwell2PD = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_SEC_PD
.getXmlKey();
}
tblRowData.setTableCellData(
20,
new TableCellData(
Math.round(new Float(report.getSSwellPeriod())), tm
.getThresholdValueCellType(dataUsageKey, zone,
mccSwell2PD, report.getSSwellPeriod()),
true));
// swell2 dir TODO: only from
String mccSwell2DirFrom;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccSwell2DirFrom = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM
.getXmlKey();
} else {
mccSwell2DirFrom = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM
.getXmlKey();
}
tblRowData tblRowData
.setTableCellData( .setTableCellData(
21, 21,
new TableCellData( new TableCellData(Math.round(new Float(report
Math.round(new Float(report.getPSwellDir())), .getPSwellDir())),
tm.getThresholdValueCellType( tm.getThresholdValueCellType(dataUsageKey,
DataUsageKey.DISPLAY, zone, mccSwell2DirFrom,
zone, report.getSSwellDir()), true));
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM // fog
.getXmlKey(), report
.getSSwellDir()), true));
if (isZone) { if (isZone) {
// zone table: fog monitored at zone level // zone table: fog monitored at zone level
tblRowData.setTableCellData(22, new TableCellData("", fogCellType, tblRowData.setTableCellData(22, new TableCellData("", fogCellType,
@ -650,10 +702,16 @@ public final class TableUtil {
isZone = true; isZone = true;
} }
String hoverText = null; DataUsageKey dataUsageKey;
if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
}
String hoverText = "";
if (isZone) { if (isZone) {
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone);
.getObsManager(MonName.snow).getAreaXml(zone);
if (zoneXML != null) { if (zoneXML != null) {
hoverText = getZoneHoverText(zoneXML); hoverText = getZoneHoverText(zoneXML);
} }
@ -721,54 +779,64 @@ public final class TableUtil {
.getXmlKey(), report .getXmlKey(), report
.getWindDir()), true)); .getWindDir()), true));
} }
// wind speed
tblRowData String wsk;
.setTableCellData( if (dataUsageKey == DataUsageKey.DISPLAY) {
6, wsk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_WIND_SPEED
new TableCellData( .getXmlKey();
Math.round(new Float(report.getWindSpeed())), } else {
tm.getThresholdValueCellType( wsk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_WIND_SPEED
DataUsageKey.DISPLAY, .getXmlKey();
zone, }
MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_WIND_SPEED tblRowData.setTableCellData(
.getXmlKey(), report 6,
.getWindSpeed()), true)); new TableCellData(Math.round(new Float(report.getWindSpeed())),
tm.getThresholdValueCellType(dataUsageKey, zone, wsk,
tblRowData report.getWindSpeed()), true));
.setTableCellData( // wind peak
7, String wpk;
new TableCellData( if (dataUsageKey == DataUsageKey.DISPLAY) {
Math.round(new Float(report.getMaxWindSpeed())), wpk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_PEAK_WIND
tm.getThresholdValueCellType( .getXmlKey();
DataUsageKey.DISPLAY, } else {
zone, wpk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_PEAK_WIND
MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_PEAK_WIND .getXmlKey();
.getXmlKey(), report }
.getMaxWindSpeed()), true)); tblRowData.setTableCellData(
7,
tblRowData new TableCellData(
.setTableCellData( Math.round(new Float(report.getMaxWindSpeed())), tm
8, .getThresholdValueCellType(dataUsageKey, zone,
new TableCellData( wpk, report.getMaxWindSpeed()), true));
Math.round(new Float(report.getWindGust())), // wind gust
tm.getThresholdValueCellType( String wgk;
DataUsageKey.DISPLAY, if (dataUsageKey == DataUsageKey.DISPLAY) {
zone, wgk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_GUST_SPEED
MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_GUST_SPEED .getXmlKey();
.getXmlKey(), report } else {
.getWindGust()), true)); wgk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_GUST_SPEED
.getXmlKey();
tblRowData }
.setTableCellData( tblRowData.setTableCellData(
9, 8,
new TableCellData( new TableCellData(Math.round(new Float(report.getWindGust())),
Math.round(new Float(report.getTemperature())), tm.getThresholdValueCellType(dataUsageKey, zone, wgk,
tm.getThresholdValueCellType( report.getWindGust()), true));
DataUsageKey.DISPLAY, // temperature
zone, String tmprk;
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP if (dataUsageKey == DataUsageKey.DISPLAY) {
.getXmlKey(), report tmprk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP
.getTemperature()), true)); .getXmlKey();
} else {
tmprk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_TEMP
.getXmlKey();
}
tblRowData.setTableCellData(
9,
new TableCellData(
Math.round(new Float(report.getTemperature())), tm
.getThresholdValueCellType(dataUsageKey, zone,
tmprk, report.getTemperature()), true));
tblRowData tblRowData
.setTableCellData( .setTableCellData(
@ -794,13 +862,17 @@ public final class TableUtil {
// used to compare with Red/Yellow // used to compare with Red/Yellow
// threshold values // threshold values
TableCellData visCellData = new TableCellData( String visKey;
visString, if (dataUsageKey == DataUsageKey.DISPLAY) {
tm.getThresholdValueCellType( visKey = MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_VIS
DataUsageKey.DISPLAY, .getXmlKey();
zone, } else {
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_VIS visKey = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_VIS
.getXmlKey(), visValue), true); .getXmlKey();
}
TableCellData visCellData = new TableCellData(visString,
tm.getThresholdValueCellType(dataUsageKey, zone, visKey,
visValue), true);
visCellData.setValue(visValue); // visValue, instead of visString, visCellData.setValue(visValue); // visValue, instead of visString,
// will be used for sorting // will be used for sorting
@ -819,14 +891,14 @@ public final class TableUtil {
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SLP MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SLP
.getXmlKey(), report .getXmlKey(), report
.getSeaLevelPress()), true)); .getSeaLevelPress()), true));
// wind chill
tblRowData tblRowData
.setTableCellData( .setTableCellData(
13, 13,
new TableCellData( new TableCellData(
Math.round(new Float(report.getWindChill())), Math.round(new Float(report.getWindChill())),
tm.getThresholdValueCellType( tm.getThresholdValueCellType(
DataUsageKey.DISPLAY, dataUsageKey,
zone, zone,
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_WIND_CHILL MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_WIND_CHILL
.getXmlKey(), report .getXmlKey(), report
@ -855,14 +927,14 @@ public final class TableUtil {
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP
.getXmlKey(), report .getXmlKey(), report
.getHourlyPrecip()), true)); .getHourlyPrecip()), true));
// snow depth
tblRowData tblRowData
.setTableCellData( .setTableCellData(
16, 16,
new TableCellData( new TableCellData(
Math.round(new Float(report.getSnowDepth())), Math.round(new Float(report.getSnowDepth())),
tm.getThresholdValueCellType( tm.getThresholdValueCellType(
DataUsageKey.DISPLAY, dataUsageKey,
zone, zone,
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH
.getXmlKey(), report .getXmlKey(), report
@ -898,7 +970,7 @@ public final class TableUtil {
/** /**
* Gets Zone Hover Text. * Gets Zone Hover Text.
* *
* @param zoneXML * @param zone
* @return * @return
*/ */
private static String getZoneHoverText(AreaIdXML zoneXML) { private static String getZoneHoverText(AreaIdXML zoneXML) {
@ -926,8 +998,11 @@ public final class TableUtil {
sq = SpatialQueryFactory.create(); sq = SpatialQueryFactory.create();
Object[] results = sq.dbRequest(sql, "maps"); Object[] results = sq.dbRequest(sql, "maps");
if (results.length > 0) { if (results.length > 0) {
if (results[0] instanceof String) { if (results[0] instanceof Object[]) {
hoverText += (String) results[0]; Object[] res = (Object[]) results[0];
hoverText += (String) res[0];
} else {
hoverText += (String) results[0].toString();
} }
} else { } else {
if (zoneXML.getCLat() != null) { if (zoneXML.getCLat() != null) {
@ -976,6 +1051,8 @@ public final class TableUtil {
} else if (stnType.intValue() == 1000) { } else if (stnType.intValue() == 1000) {
hoverText = stnId + "#MESONET -- " + stnName; hoverText = stnId + "#MESONET -- " + stnName;
} }
} else {
hoverText = stnId;
} }
} catch (Exception e) { } catch (Exception e) {
@ -1159,15 +1236,30 @@ public final class TableUtil {
public static CellType getCellTypeForFog(String zone, ObReport report, public static CellType getCellTypeForFog(String zone, ObReport report,
AbstractThresholdMgr tm) { AbstractThresholdMgr tm) {
float visValue = report.getVisibility();// in miles CellType retVal = CellType.NotAvailable;
if (visValue == ObConst.MISSING) { DataUsageKey dataUsageKey;
return CellType.NotAvailable; if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
} }
visValue = visValue / milesPerNauticalMile; // in nautical miles
return tm.getThresholdValueCellType(DataUsageKey.DISPLAY, zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS
.getXmlKey(), visValue);
float visValue = report.getVisibility();// in miles
if (visValue != ObConst.MISSING) {
visValue = visValue / milesPerNauticalMile; // in nautical miles
String mccSafeseas;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccSafeseas = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS
.getXmlKey();
} else {
mccSafeseas = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_VIS
.getXmlKey();
}
retVal = tm.getThresholdValueCellType(dataUsageKey, zone,
mccSafeseas, visValue);
}
return retVal;
} }
/** /**
@ -1352,7 +1444,6 @@ public final class TableUtil {
CellType type = CellType.NotAvailable; // default, assuming no CellType type = CellType.NotAvailable; // default, assuming no
// observation available // observation available
CellType snowDepth = tm CellType snowDepth = tm
.getThresholdValueCellType( .getThresholdValueCellType(
DataUsageKey.DISPLAY, DataUsageKey.DISPLAY,
@ -1690,5 +1781,5 @@ public final class TableUtil {
CommonTableConfig.obsHistCols.PTend)); CommonTableConfig.obsHistCols.PTend));
return tblRowData; return tblRowData;
} }
// TODO: add MESONET data
} }

View file

@ -19,7 +19,7 @@
**/ **/
package com.raytheon.uf.viz.monitor.listeners; package com.raytheon.uf.viz.monitor.listeners;
import com.raytheon.uf.viz.core.notification.INotificationObserver; import com.raytheon.uf.common.jms.notification.INotificationObserver;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent; import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
/** /**
@ -32,6 +32,8 @@ import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 29, 2009 dhladky Initial creation * Jan 29, 2009 dhladky Initial creation
* Sep 20, 2015 3873 skorolev Replaced deprecated INotificationObserver
*
* </pre> * </pre>
* *
* @author dhladky * @author dhladky

View file

@ -31,8 +31,13 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.data.ObConst; import com.raytheon.uf.common.monitor.data.ObConst;
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey; import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
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.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType; import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.filename.DefaultFilenameMgr; import com.raytheon.uf.viz.monitor.filename.DefaultFilenameMgr;
@ -53,6 +58,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* Mar 22, 2010 #4282 zhao obtain zone IDs from monitoring-area-config-manager * Mar 22, 2010 #4282 zhao obtain zone IDs from monitoring-area-config-manager
* Feb 16, 2011 #7346 zhao added getDirectionalThresholdValueCellType(...) * Feb 16, 2011 #7346 zhao added getDirectionalThresholdValueCellType(...)
* Apr 28, 2014 3086 skorolev Updated getAreaConfigMgr method. * Apr 28, 2014 3086 skorolev Updated getAreaConfigMgr method.
* Sep 18, 2015 3873 skorolev Added getCfgMgr().
* *
* </pre> * </pre>
* *
@ -61,25 +67,28 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
*/ */
public abstract class AbstractThresholdMgr { public abstract class AbstractThresholdMgr {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractThresholdMgr.class);
/** /**
* Monitor Area Configuration Manager. * Monitor Area Configuration Manager.
*/ */
protected FSSObsMonitorConfigurationManager areaConfigMgr; public FSSObsMonitorConfigurationManager areaConfigMgr;
/** /**
* Default file name for the FOG display thresholds. * Default file name for the display thresholds.
*/ */
private String defDisplayThreshName = "Unknown"; private String defDisplayThreshName = "Unknown";
/** /**
* Default file name for the FOG monitor thresholds. * Default file name for the monitor thresholds.
*/ */
private String defMonitorThreshName = "Unknown"; private String defMonitorThreshName = "Unknown";
/** /**
* Application name that will be the starting path for the XML data. * Application name that will be the starting path for the XML data.
*/ */
private final String appName; private final AppName appName;
/** /**
* Full path and file name for the current FOG display file. * Full path and file name for the current FOG display file.
@ -117,10 +126,8 @@ public abstract class AbstractThresholdMgr {
/** current site **/ /** current site **/
protected String site; protected String site;
/* /** threshold usage **/
* TODO : remove this when debugging is complete protected DataUsageKey dataUsageKey;
*/
public ThresholdsXML threshXmlCopy;
/** /**
* Constructor. * Constructor.
@ -129,12 +136,12 @@ public abstract class AbstractThresholdMgr {
* @param defMonitorThreshName * @param defMonitorThreshName
*/ */
public AbstractThresholdMgr(String defDisplayThreshName, public AbstractThresholdMgr(String defDisplayThreshName,
String defMonitorThreshName, String appName) { String defMonitorThreshName, AppName appName) {
this.defDisplayThreshName = defDisplayThreshName; this.defDisplayThreshName = defDisplayThreshName;
this.defMonitorThreshName = defMonitorThreshName; this.defMonitorThreshName = defMonitorThreshName;
this.appName = appName; this.appName = appName;
this.site = LocalizationManager.getInstance().getCurrentSite(); this.site = LocalizationManager.getInstance().getCurrentSite();
this.areaConfigMgr = getMonitorAreaConfigInstance(); this.areaConfigMgr = getCfgMgr();
} }
/** /**
@ -148,7 +155,7 @@ public abstract class AbstractThresholdMgr {
defaultFileNameMgr.readXmlConfig(); defaultFileNameMgr.readXmlConfig();
/* /*
* Setup the Fog display threshold manager * Setup the display threshold manager
*/ */
if (defaultFileNameMgr.getDefaultThresholdFilename() != null if (defaultFileNameMgr.getDefaultThresholdFilename() != null
&& defaultFileNameMgr.getDefaultThresholdFilename().length() > 0) { && defaultFileNameMgr.getDefaultThresholdFilename().length() > 0) {
@ -175,7 +182,7 @@ public abstract class AbstractThresholdMgr {
} }
/* /*
* Setup the Fog monitor threshold manager * Setup the monitor threshold manager
*/ */
currFullMonitorXmlFileName = getMonitorThresholdPath() currFullMonitorXmlFileName = getMonitorThresholdPath()
+ defMonitorThreshName; + defMonitorThreshName;
@ -201,7 +208,7 @@ public abstract class AbstractThresholdMgr {
LocalizationFile locFile = pm.getLocalizationFile(context, LocalizationFile locFile = pm.getLocalizationFile(context,
pathAndFileName); pathAndFileName);
System.out.println("--- validate path = " statusHandler.handle(Priority.DEBUG, "--- validate path = "
+ locFile.getFile().getAbsolutePath()); + locFile.getFile().getAbsolutePath());
return locFile.getFile().exists(); return locFile.getFile().exists();
@ -235,7 +242,6 @@ public abstract class AbstractThresholdMgr {
return monitorThreshMgr.getYellowValue(areaID, key); return monitorThreshMgr.getYellowValue(areaID, key);
} }
} }
return 0; return 0;
} }
@ -284,30 +290,24 @@ public abstract class AbstractThresholdMgr {
if (hasArea(areaID, dataUsage) == false) { if (hasArea(areaID, dataUsage) == false) {
return CellType.NotMonitored; return CellType.NotMonitored;
} }
if (Double.isNaN(value) == true) { if (Double.isNaN(value) == true) {
return CellType.NotMonitored; return CellType.NotMonitored;
} }
if (value == ObConst.MISSING) { if (value == ObConst.MISSING) {
return CellType.NotAvailable; return CellType.NotAvailable;
} }
double red = Double.NaN; double red = Double.NaN;
double yellow = Double.NaN; double yellow = Double.NaN;
if (dataUsage == DataUsageKey.DISPLAY) { if (dataUsage == DataUsageKey.DISPLAY) {
red = displayThreshMgr.getRedValue(areaID, key); red = displayThreshMgr.getRedValue(areaID, key);
yellow = displayThreshMgr.getYellowValue(areaID, key); yellow = displayThreshMgr.getYellowValue(areaID, key);
return calcCellType(key, red, yellow, value); return calcCellType(key, red, yellow, value);
} else if (dataUsage == DataUsageKey.MONITOR) { } else if (dataUsage == DataUsageKey.MONITOR) {
red = monitorThreshMgr.getRedValue(areaID, key); red = monitorThreshMgr.getRedValue(areaID, key);
yellow = monitorThreshMgr.getYellowValue(areaID, key); yellow = monitorThreshMgr.getYellowValue(areaID, key);
return calcCellType(key, red, yellow, value); return calcCellType(key, red, yellow, value);
} }
return CellType.NotMonitored; return CellType.NotMonitored;
} }
@ -328,11 +328,9 @@ public abstract class AbstractThresholdMgr {
if (hasArea(areaID, dataUsage) == false) { if (hasArea(areaID, dataUsage) == false) {
return CellType.NotMonitored; return CellType.NotMonitored;
} }
if (Double.isNaN(value) == true) { if (Double.isNaN(value) == true) {
return CellType.NotMonitored; return CellType.NotMonitored;
} }
if (value == ObConst.MISSING) { if (value == ObConst.MISSING) {
return CellType.NotAvailable; return CellType.NotAvailable;
} }
@ -357,7 +355,6 @@ public abstract class AbstractThresholdMgr {
return calcDirectionalCellType(redFrom, redTo, yellowFrom, return calcDirectionalCellType(redFrom, redTo, yellowFrom,
yellowTo, value); yellowTo, value);
} }
return CellType.NotMonitored; return CellType.NotMonitored;
} }
@ -379,25 +376,21 @@ public abstract class AbstractThresholdMgr {
return CellType.R; return CellType.R;
} }
} }
if (redFrom > redTo) { if (redFrom > redTo) {
if (value > redFrom || value < redTo) { if (value > redFrom || value < redTo) {
return CellType.R; return CellType.R;
} }
} }
if (yellowFrom < yellowTo) { if (yellowFrom < yellowTo) {
if (value > yellowFrom && value < yellowTo) { if (value > yellowFrom && value < yellowTo) {
return CellType.Y; return CellType.Y;
} }
} }
if (yellowFrom > yellowTo) { if (yellowFrom > yellowTo) {
if (value > yellowFrom || value < yellowTo) { if (value > yellowFrom || value < yellowTo) {
return CellType.Y; return CellType.Y;
} }
} }
return CellType.G; return CellType.G;
} }
@ -427,7 +420,6 @@ public abstract class AbstractThresholdMgr {
} else if (value <= yellow) { } else if (value <= yellow) {
return CellType.Y; return CellType.Y;
} }
return CellType.G; return CellType.G;
} else { } else {
if (value < yellow) { if (value < yellow) {
@ -435,7 +427,6 @@ public abstract class AbstractThresholdMgr {
} else if (value <= red) { } else if (value <= red) {
return CellType.Y; return CellType.Y;
} }
return CellType.R; return CellType.R;
} }
} else if (redIsHigher == true) { } else if (redIsHigher == true) {
@ -444,7 +435,6 @@ public abstract class AbstractThresholdMgr {
} else if (value < red) { } else if (value < red) {
return CellType.Y; return CellType.Y;
} }
return CellType.R; return CellType.R;
} else if (redIsHigher == false) { } else if (redIsHigher == false) {
if (value <= red) { if (value <= red) {
@ -452,10 +442,8 @@ public abstract class AbstractThresholdMgr {
} else if (value <= yellow) { } else if (value <= yellow) {
return CellType.Y; return CellType.Y;
} }
return CellType.G; return CellType.G;
} }
return CellType.NotMonitored; return CellType.NotMonitored;
} }
@ -472,11 +460,9 @@ public abstract class AbstractThresholdMgr {
+ defDisplayThreshName; + defDisplayThreshName;
return; return;
} }
if (fileName.endsWith(".xml") == false) { if (fileName.endsWith(".xml") == false) {
fileName.concat(".xml"); fileName.concat(".xml");
} }
if (fileName.compareTo(defDisplayThreshName) == 0) { if (fileName.compareTo(defDisplayThreshName) == 0) {
defaultFileNameMgr.setDefaultThresholdFilename(""); defaultFileNameMgr.setDefaultThresholdFilename("");
} else { } else {
@ -495,9 +481,7 @@ public abstract class AbstractThresholdMgr {
loadDefaultDisplayThreshold(); loadDefaultDisplayThreshold();
return; return;
} }
currFullDisplayXmlFileName = getDisplayThresholdPath() + fileName; currFullDisplayXmlFileName = getDisplayThresholdPath() + fileName;
displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName); displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName);
displayThreshMgr.readThresholdXml(); displayThreshMgr.readThresholdXml();
} }
@ -511,23 +495,18 @@ public abstract class AbstractThresholdMgr {
if (filename == null || filename.trim().length() == 0) { if (filename == null || filename.trim().length() == 0) {
currFullDisplayXmlFileName = getDisplayThresholdPath() currFullDisplayXmlFileName = getDisplayThresholdPath()
+ defDisplayThreshName; + defDisplayThreshName;
List<String> areaIDs = null; List<String> areaIDs = null;
try { try {
areaIDs = areaConfigMgr.getAreaList(); areaIDs = areaConfigMgr.getAreaList();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return; return;
} }
// Sort the area IDs // Sort the area IDs
Collections.sort(areaIDs); Collections.sort(areaIDs);
ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.DISPLAY); ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.DISPLAY);
statusHandler.handle(Priority.DEBUG, "---- "
System.out.println("---- " + currFullDisplayXmlFileName); + currFullDisplayXmlFileName);
displayThreshMgr.createConfigFromDefaults( displayThreshMgr.createConfigFromDefaults(
currFullDisplayXmlFileName, areaIDs, threshKeys); currFullDisplayXmlFileName, areaIDs, threshKeys);
} else { } else {
@ -543,21 +522,16 @@ public abstract class AbstractThresholdMgr {
public void loadDefaultMonitorThreshold() { public void loadDefaultMonitorThreshold() {
currFullMonitorXmlFileName = getMonitorThresholdPath() currFullMonitorXmlFileName = getMonitorThresholdPath()
+ defMonitorThreshName; + defMonitorThreshName;
List<String> areaIDs = null; List<String> areaIDs = null;
try { try {
areaIDs = areaConfigMgr.getAreaList(); areaIDs = areaConfigMgr.getAreaList();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return; return;
} }
// Sort the area IDs // Sort the area IDs
Collections.sort(areaIDs); Collections.sort(areaIDs);
ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.MONITOR); ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.MONITOR);
monitorThreshMgr.createConfigFromDefaults(currFullMonitorXmlFileName, monitorThreshMgr.createConfigFromDefaults(currFullMonitorXmlFileName,
areaIDs, threshKeys); areaIDs, threshKeys);
} }
@ -572,9 +546,7 @@ public abstract class AbstractThresholdMgr {
if (newFileName.trim().compareTo(defDisplayThreshName) == 0) { if (newFileName.trim().compareTo(defDisplayThreshName) == 0) {
return; return;
} }
currFullDisplayXmlFileName = getDisplayThresholdPath() + newFileName; currFullDisplayXmlFileName = getDisplayThresholdPath() + newFileName;
displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName); displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName);
displayThreshMgr.saveThresholdXml(); displayThreshMgr.saveThresholdXml();
} }
@ -601,7 +573,6 @@ public abstract class AbstractThresholdMgr {
if (usageKey == DataUsageKey.DISPLAY) { if (usageKey == DataUsageKey.DISPLAY) {
return defDisplayThreshName; return defDisplayThreshName;
} }
// Return the Monitor threshold file name as the default. // Return the Monitor threshold file name as the default.
return defMonitorThreshName; return defMonitorThreshName;
} }
@ -616,61 +587,60 @@ public abstract class AbstractThresholdMgr {
return defaultFileNameMgr.getDefaultThresholdFilename(); return defaultFileNameMgr.getDefaultThresholdFilename();
} }
/**
* Gets Thresholds XML Data
*
* @param usageKey
* @return
*/
public ThresholdsXML getThresholdsXmlData(DataUsageKey usageKey) { public ThresholdsXML getThresholdsXmlData(DataUsageKey usageKey) {
if (usageKey == DataUsageKey.DISPLAY) { if (usageKey == DataUsageKey.DISPLAY) {
return displayThreshMgr.getThresholdXML(); return displayThreshMgr.getThresholdXML();
} }
return monitorThreshMgr.getThresholdXML(); return monitorThreshMgr.getThresholdXML();
} }
/** /**
* Get the path where the display thresholds XML files are contained. * Gets the path where the display thresholds XML files are contained.
* *
* @return File path. * @return File path.
*/ */
public String getDisplayThresholdPath() { public String getDisplayThresholdPath() {
String fs = String.valueOf(File.separatorChar); String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(appName.name().toLowerCase()).append(fs);
sb.append(appName).append(fs);
sb.append("threshold").append(fs); sb.append("threshold").append(fs);
sb.append("display").append(fs); sb.append("display").append(fs);
return sb.toString(); return sb.toString();
} }
/** /**
* Get the path where the monitor thresholds XML files are contained. * Gets the path where the monitor thresholds XML files are contained.
* *
* @return File path. * @return File path.
*/ */
public String getMonitorThresholdPath() { public String getMonitorThresholdPath() {
String fs = String.valueOf(File.separatorChar); String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(appName.name().toLowerCase()).append(fs);
sb.append(appName).append(fs);
sb.append("threshold").append(fs); sb.append("threshold").append(fs);
sb.append("monitor").append(fs); sb.append("monitor").append(fs);
return sb.toString(); return sb.toString();
} }
/** /**
* Get the path where the XML file containing the user selected default file * Gets the path where the XML file containing the user selected default
* is located. * file is located.
* *
* @return The path of the user selected default file XML. * @return The path of the user selected default file XML.
*/ */
public String getDefaultThresholdFilePath() { public String getDefaultThresholdFilePath() {
String fs = String.valueOf(File.separatorChar); String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(appName.name().toLowerCase()).append(fs);
sb.append(appName).append(fs);
sb.append("threshold").append(fs); sb.append("threshold").append(fs);
sb.append("display").append(fs); sb.append("display").append(fs);
sb.append("defaultThresh").append(fs); sb.append("defaultThresh").append(fs);
return sb.toString(); return sb.toString();
} }
@ -686,7 +656,6 @@ public abstract class AbstractThresholdMgr {
} else if (dataUsageKey == DataUsageKey.MONITOR) { } else if (dataUsageKey == DataUsageKey.MONITOR) {
return monitorThreshMgr.getThresholdsXmlCopy(); return monitorThreshMgr.getThresholdsXmlCopy();
} }
return null; return null;
} }
@ -698,7 +667,6 @@ public abstract class AbstractThresholdMgr {
*/ */
public boolean deleteFile(LocalizationFile fileName) { public boolean deleteFile(LocalizationFile fileName) {
boolean deletedUserSelectedDefault = false; boolean deletedUserSelectedDefault = false;
String fileNameStr = fileName.getFile().getName(); String fileNameStr = fileName.getFile().getName();
/* /*
@ -712,7 +680,6 @@ public abstract class AbstractThresholdMgr {
loadDefaultDisplayThreshold(); loadDefaultDisplayThreshold();
deletedUserSelectedDefault = true; deletedUserSelectedDefault = true;
} }
/* /*
* Delete the file. * Delete the file.
*/ */
@ -721,7 +688,6 @@ public abstract class AbstractThresholdMgr {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return deletedUserSelectedDefault; return deletedUserSelectedDefault;
} }
@ -736,7 +702,6 @@ public abstract class AbstractThresholdMgr {
if (dataUsageKey == DataUsageKey.DISPLAY) { if (dataUsageKey == DataUsageKey.DISPLAY) {
return displayThreshMgr.getThresholdXML().hasAreaId(areaID); return displayThreshMgr.getThresholdXML().hasAreaId(areaID);
} }
return monitorThreshMgr.getThresholdXML().hasAreaId(areaID); return monitorThreshMgr.getThresholdXML().hasAreaId(areaID);
} }
@ -764,34 +729,17 @@ public abstract class AbstractThresholdMgr {
ArrayList<AreaXML> areasArray = displayXML.getAreas(); ArrayList<AreaXML> areasArray = displayXML.getAreas();
for (AreaXML area : areasArray) { for (AreaXML area : areasArray) {
System.out.println("--- " + area.getAreaId()); statusHandler.handle(Priority.DEBUG, "--- " + area.getAreaId());
ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds(); ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds();
for (AreaThresholdXML atXml : atXmlArray) { for (AreaThresholdXML atXml : atXmlArray) {
System.out.println("****** " + atXml.getKey()); statusHandler.handle(Priority.DEBUG,
System.out.println(" R " + atXml.getRed()); "****** " + atXml.getKey());
System.out.println(" Y " + atXml.getYellow()); statusHandler.handle(Priority.DEBUG,
} " R " + atXml.getRed());
} statusHandler.handle(Priority.DEBUG,
} " Y " + atXml.getYellow());
public void printDisplayThresholdsXMLCopy() {
if (threshXmlCopy == null) {
threshXmlCopy = displayThreshMgr.getThresholdsXmlCopy();
}
ArrayList<AreaXML> areasArray = threshXmlCopy.getAreas();
for (AreaXML area : areasArray) {
System.out.println("--- " + area.getAreaId());
ArrayList<AreaThresholdXML> atXmlArray = area.getAreaThresholds();
for (AreaThresholdXML atXml : atXmlArray) {
System.out.println("****** " + atXml.getKey());
System.out.println(" R " + atXml.getRed());
System.out.println(" Y " + atXml.getYellow());
} }
} }
} }
@ -801,6 +749,37 @@ public abstract class AbstractThresholdMgr {
* *
* @return manager * @return manager
*/ */
protected abstract FSSObsMonitorConfigurationManager getMonitorAreaConfigInstance(); public FSSObsMonitorConfigurationManager getCfgMgr() {
FSSObsMonitorConfigurationManager mgr = null;
switch (this.appName) {
case FOG:
mgr = FSSObsMonitorConfigurationManager.getInstance(MonName.fog);
break;
case SAFESEAS:
mgr = FSSObsMonitorConfigurationManager.getInstance(MonName.ss);
break;
case SNOW:
mgr = FSSObsMonitorConfigurationManager.getInstance(MonName.snow);
break;
default:
statusHandler.error("Unable to handle unknown appName: "
+ this.appName);
break;
}
return mgr;
}
/**
* @return
*/
public DataUsageKey getDataUsageKey() {
return dataUsageKey;
}
/**
* @param dataUsageKey
*/
public void setDataUsageKey(DataUsageKey dataUsageKey) {
this.dataUsageKey = dataUsageKey;
}
} }

View file

@ -50,6 +50,7 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 15, 2009 #3963 lvenable Initial creation * Dec 15, 2009 #3963 lvenable Initial creation
* Dec 4, 2012 #1351 skorolev Cleaned code * Dec 4, 2012 #1351 skorolev Cleaned code
* Sep 18, 2015 #3873 skorolev Added error message for corrupted or empty default threshold file.
* *
* </pre> * </pre>
* *
@ -86,10 +87,11 @@ public class ThresholdMgr {
*/ */
public void readThresholdXml() { public void readThresholdXml() {
try { try {
cfgXML = null; ThresholdsXML newCfgXML = null;
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
File path = pm.getStaticFile(currFullPathAndFileName); File path = pm.getStaticFile(currFullPathAndFileName);
cfgXML = JAXB.unmarshal(path, ThresholdsXML.class); newCfgXML = JAXB.unmarshal(path, ThresholdsXML.class);
this.setThresholdXML(newCfgXML);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR, e.getMessage()); statusHandler.handle(Priority.ERROR, e.getMessage());
} }
@ -145,7 +147,11 @@ public class ThresholdMgr {
ThresholdsXML.class); ThresholdsXML.class);
createXmlFromDefaults(cfgXmlDefaults, areaIDs, keys); createXmlFromDefaults(cfgXmlDefaults, areaIDs, keys);
} catch (Exception e) { } catch (Exception e) {
statusHandler.handle(Priority.ERROR, e.getMessage()); statusHandler
.handle(Priority.ERROR,
"Default threshold configuration file "
+ fullDefaultPathName
+ " is corrupted.\nDelete the files in the folder on the server side and restart CAVE.");
return false; return false;
} }
return true; return true;

View file

@ -34,7 +34,6 @@ import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.geospatial.ISpatialQuery; import com.raytheon.uf.common.geospatial.ISpatialQuery;
import com.raytheon.uf.common.geospatial.SpatialQueryFactory; import com.raytheon.uf.common.geospatial.SpatialQueryFactory;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.xml.StationIdXML; import com.raytheon.uf.common.monitor.xml.StationIdXML;
@ -57,7 +56,6 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog. * Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
* Apr 23, 2014 3054 skorolev Added MESONET handling. * Apr 23, 2014 3054 skorolev Added MESONET handling.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method. * Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Aug 17, 2015 3841 skorolev Corrected handleAddNewStation method.
* *
* </pre> * </pre>
* *
@ -69,7 +67,7 @@ public class AddNewStationDlg extends CaveSWTDialog {
.getHandler(AddNewStationDlg.class); .getHandler(AddNewStationDlg.class);
/** Application name. */ /** Application name. */
private final AppName appName; private AppName appName;
/** METAR radio button. */ /** METAR radio button. */
private Button metarRdo; private Button metarRdo;
@ -87,12 +85,10 @@ public class AddNewStationDlg extends CaveSWTDialog {
private Text stationTF; private Text stationTF;
/** Zone */ /** Zone */
private final String area; private String area;
/** Call back interface */ /** Call back interface */
private final MonitoringAreaConfigDlg macDlg; private MonitoringAreaConfigDlg macDlg;
private final FSSObsMonitorConfigurationManager cfgMgr;
/** /**
* Constructor. * Constructor.
@ -110,7 +106,6 @@ public class AddNewStationDlg extends CaveSWTDialog {
this.appName = appName; this.appName = appName;
this.area = area; this.area = area;
this.macDlg = macDlg; this.macDlg = macDlg;
cfgMgr = macDlg.getInstance();
} }
/* /*
@ -265,10 +260,9 @@ public class AddNewStationDlg extends CaveSWTDialog {
+ "' is already in your Monitoring Area or among your Additional Stations."); + "' is already in your Monitoring Area or among your Additional Stations.");
return; return;
} }
macDlg.addNewStationAction(stn); macDlg.addNewStationAction(stn);
cfgMgr.addNewStation(area, stn, type, true); macDlg.getInstance().addStation(area, stn, type, false);
cfgMgr.getStations().add(stn); macDlg.getInstance().getStations().add(stn);
} }
/** /**

View file

@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout; import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
@ -49,7 +50,6 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 23, 2014 3054 skorolev Deleted unnecessary parameter in addArea method. * Apr 23, 2014 3054 skorolev Deleted unnecessary parameter in addArea method.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method. * Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Feb 10, 2015 3886 skorolev Added fixed width for dialog. * Feb 10, 2015 3886 skorolev Added fixed width for dialog.
* Aug 17, 2015 3841 skorolev Corrected handleAddNewAction method.
* *
* </pre> * </pre>
* *
@ -59,7 +59,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
public class AddNewZoneDlg extends CaveSWTDialog { public class AddNewZoneDlg extends CaveSWTDialog {
/** Application name. */ /** Application name. */
private final AppName appName; private AppName appName;
/** Marine zone radio button. */ /** Marine zone radio button. */
private Button marineZoneRdo; private Button marineZoneRdo;
@ -77,7 +77,7 @@ public class AddNewZoneDlg extends CaveSWTDialog {
private Text centroidLonTF; private Text centroidLonTF;
/** Monitoring Area Configuration Dialog. */ /** Monitoring Area Configuration Dialog. */
private final MonitoringAreaConfigDlg macDlg; private MonitoringAreaConfigDlg macDlg;
/** /**
* Constructor. * Constructor.
@ -144,15 +144,13 @@ public class AddNewZoneDlg extends CaveSWTDialog {
/* /*
* Add the radio controls. * Add the radio controls.
*/ */
if (appName != AppName.SNOW) { Composite radioComp = new Composite(topComp, SWT.NONE);
Composite radioComp = new Composite(topComp, SWT.NONE); radioComp.setLayout(new GridLayout(1, false));
radioComp.setLayout(new GridLayout(1, false)); marineZoneRdo = new Button(radioComp, SWT.RADIO);
marineZoneRdo = new Button(radioComp, SWT.RADIO); marineZoneRdo.setText("Marine Zone");
marineZoneRdo.setText("Marine Zone"); marineZoneRdo.setSelection(true);
marineZoneRdo.setSelection(true); countyRdo = new Button(radioComp, SWT.RADIO);
countyRdo = new Button(radioComp, SWT.RADIO); countyRdo.setText("County");
countyRdo.setText("County");
}
} }
/** /**
@ -238,13 +236,9 @@ public class AddNewZoneDlg extends CaveSWTDialog {
addBtn.addSelectionListener(new SelectionAdapter() { addBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
String areaId = idTF.getText().toUpperCase();
idTF.setText(areaId);
String latString = centroidLatTF.getText(); String latString = centroidLatTF.getText();
String lonString = centroidLonTF.getText(); String lonString = centroidLonTF.getText();
if (macDlg.formIsValid(areaId, latString, lonString)) { handleAddNewAction(latString, lonString);
handleAddNewAction(areaId, latString, lonString);
}
} }
}); });
@ -267,35 +261,58 @@ public class AddNewZoneDlg extends CaveSWTDialog {
* @param latString * @param latString
* @param lonString * @param lonString
*/ */
private void handleAddNewAction(String areaId, String latString, private void handleAddNewAction(String latString, String lonString) {
String lonString) throws NumberFormatException { String areaId = idTF.getText();
if (areaId.equals("") || areaId.length() != 6
|| (areaId.charAt(2) != 'C' && areaId.charAt(2) != 'Z')) {
displayInputErrorMsg("Invalid Area ID = '" + areaId
+ "' entered. Please enter a correctly formatted Area ID.");
return;
}
if (macDlg.isExistingZone(areaId)) { if (macDlg.isExistingZone(areaId)) {
macDlg.displayInputErrorMsg("The Area ID, " displayInputErrorMsg("The Area ID, "
+ areaId + areaId
+ ", is already in your Monitoring Area or among your Additional Zones."); + ", is already in your Monitoring Area or among your Additional Zones.");
return; return;
} }
double lat = Double.parseDouble(latString.trim()); if (latString == null || latString.isEmpty() || lonString == null
double lon = Double.parseDouble(lonString.trim()); || lonString.isEmpty()) {
ZoneType type = ZoneType.REGULAR;
if (appName != AppName.SNOW) {
if (marineZoneRdo.getSelection() || idTF.getText().charAt(2) == 'Z') {
type = ZoneType.MARITIME;
}
} else {
// Correct third character for METARs
char chr = idTF.getText().charAt(2);
if (chr != 'C') {
String c = idTF.getText().substring(2).replace(chr, 'C');
idTF.setText(idTF.getText().substring(0, 2) + c);
areaId = idTF.getText();
}
}
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
macDlg.latLonErrorMsg(latString, lonString); macDlg.latLonErrorMsg(latString, lonString);
return; return;
} else {
try {
double lat = Double.parseDouble(latString.trim());
double lon = Double.parseDouble(lonString.trim());
ZoneType type = ZoneType.REGULAR;
if (appName != AppName.SNOW) {
if (marineZoneRdo.getSelection()) {
type = ZoneType.MARITIME;
}
}
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
macDlg.latLonErrorMsg(latString, lonString);
return;
}
macDlg.configMgr.addArea(areaId, lat, lon, type);
macDlg.addNewZoneAction(areaId, centroidLatTF.getText(),
centroidLonTF.getText());
} catch (NumberFormatException e) {
macDlg.latLonErrorMsg(latString, lonString);
return;
}
} }
macDlg.configMgr.addNewArea(areaId, lat, lon, type); }
macDlg.addZoneToMA(areaId);
/**
* Displays Input Error Message
*
* @param msg
*/
private void displayInputErrorMsg(String msg) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
| SWT.OK);
messageBox.setText("Invalid input");
messageBox.setMessage(msg);
messageBox.open();
} }
} }

View file

@ -19,8 +19,6 @@
**/ **/
package com.raytheon.uf.viz.monitor.ui.dialogs; package com.raytheon.uf.viz.monitor.ui.dialogs;
import java.util.ArrayList;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
@ -37,7 +35,6 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/** /**
@ -53,7 +50,6 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Nov 20, 2012 1297 skorolev Changes for non-blocking dialog. * Nov 20, 2012 1297 skorolev Changes for non-blocking dialog.
* Apr 23, 2014 3054 skorolev Fixed issue with deleting a new station. * Apr 23, 2014 3054 skorolev Fixed issue with deleting a new station.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method. * Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Aug 17, 2015 3841 skorolev Corrected deleteSelected method.
* *
* </pre> * </pre>
* *
@ -68,12 +64,11 @@ public class DeleteStationDlg extends CaveSWTDialog {
/** Control font. */ /** Control font. */
private Font controlFont; private Font controlFont;
/** Area configuration manager. */
private FSSObsMonitorConfigurationManager configMgr;
/** Monitoring Area Configuration Dialog */ /** Monitoring Area Configuration Dialog */
private final MonitoringAreaConfigDlg macDlg; private MonitoringAreaConfigDlg macDlg;
private final FSSObsMonitorConfigurationManager cfgMgr;
private final java.util.List<String> newAddedStns = new ArrayList<String>();
/** /**
* Constructor. * Constructor.
@ -82,15 +77,13 @@ public class DeleteStationDlg extends CaveSWTDialog {
* Parent shell. * Parent shell.
* @param appName * @param appName
* Application name. * Application name.
* @param area
* @param macDlg
*/ */
public DeleteStationDlg(Shell parent, AppName appName, public DeleteStationDlg(Shell parent, AppName appName,
MonitoringAreaConfigDlg macDlg) { MonitoringAreaConfigDlg macDlg) {
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText(appName.toString() + ": Delete a Newly Entered Station"); setText(appName.toString() + ": Delete a Newly Entered Station");
this.macDlg = macDlg; this.macDlg = macDlg;
cfgMgr = macDlg.getInstance(); configMgr = macDlg.getInstance();
} }
/* /*
@ -121,10 +114,6 @@ public class DeleteStationDlg extends CaveSWTDialog {
controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL); controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL);
createListControl(); createListControl();
createBottomButtons(); createBottomButtons();
java.util.List<AreaIdXML> areaList = cfgMgr.getConfigXml().getAreaIds();
newAddedStns.addAll(cfgMgr.getNewlyAddedStations(areaList));
areaList = cfgMgr.getAdjAreaConfigXml().getAreaIds();
newAddedStns.addAll(cfgMgr.getNewlyAddedStations(areaList));
populate(); populate();
} }
@ -186,7 +175,8 @@ public class DeleteStationDlg extends CaveSWTDialog {
* Populate list of added stations. * Populate list of added stations.
*/ */
private void populate() { private void populate() {
stationList.setItems(newAddedStns.toArray(new String[newAddedStns java.util.List<String> addedStations = configMgr.getAddedStations();
stationList.setItems(addedStations.toArray(new String[addedStations
.size()])); .size()]));
} }
@ -194,20 +184,15 @@ public class DeleteStationDlg extends CaveSWTDialog {
* Delete stations from the list. * Delete stations from the list.
*/ */
private String deleteSelected() { private String deleteSelected() {
String retval = ""; String retval = null;
if (stationList.getItemCount() != 0) { if (stationList.getItemCount() != 0) {
if (stationList.getSelectionIndex() != -1) { if (stationList.getSelectionIndex() != -1) {
int idx = stationList.getSelectionIndex(); int idx = stationList.getSelectionIndex();
String selection = stationList.getItem(idx); String selection = stationList.getItem(idx);
retval = configMgr.getAddedStations().get(idx);
configMgr.getAddedStations().remove(idx);
stationList.remove(selection); stationList.remove(selection);
java.util.List<AreaIdXML> areaXmlList = cfgMgr.getConfigXml()
.getAreaIds();
cfgMgr.removeStation(selection.split("#")[0], areaXmlList);
areaXmlList = cfgMgr.getAdjAreaConfigXml().getAreaIds();
cfgMgr.removeStation(selection.split("#")[0], areaXmlList);
newAddedStns.remove(selection);
populate(); populate();
macDlg.maStationsRemoved = true;
} else { } else {
MessageBox messageBox = new MessageBox(shell, MessageBox messageBox = new MessageBox(shell,
SWT.ICON_INFORMATION | SWT.NONE); SWT.ICON_INFORMATION | SWT.NONE);

View file

@ -19,8 +19,6 @@
**/ **/
package com.raytheon.uf.viz.monitor.ui.dialogs; package com.raytheon.uf.viz.monitor.ui.dialogs;
import java.util.ArrayList;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
@ -36,11 +34,9 @@ import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.xml.AreaIdXML; import com.raytheon.uf.common.monitor.xml.AreaIdXML;
import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType; import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
import com.raytheon.uf.common.monitor.xml.StationIdXML;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/** /**
@ -57,7 +53,6 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 23, 2014 3054 skorolev Fixed issues with removing a new zone from list. * Apr 23, 2014 3054 skorolev Fixed issues with removing a new zone from list.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method. * Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Nov 10, 2014 3741 skorolev Fixed configXML issue. * Nov 10, 2014 3741 skorolev Fixed configXML issue.
* Aug 17, 2015 3841 skorolev Made editable a content of ID field.
* *
* </pre> * </pre>
* *
@ -67,7 +62,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
public class EditNewZoneDlg extends CaveSWTDialog { public class EditNewZoneDlg extends CaveSWTDialog {
/** Call back interface. */ /** Call back interface. */
private final MonitoringAreaConfigDlg macDlg; private MonitoringAreaConfigDlg macDlg;
/** Zone list control. */ /** Zone list control. */
private List zoneList; private List zoneList;
@ -90,13 +85,17 @@ public class EditNewZoneDlg extends CaveSWTDialog {
/** Control font. */ /** Control font. */
private Font controlFont; private Font controlFont;
/** Marine station radio button. */
private Button marineRdo;
/** None Marine station radio button. */
private Button nonMarineRdo;
/** Bottom label */ /** Bottom label */
private Label bottomLbl; private Label bottomLbl;
/** Deleted zone */ /** Deleted zone */
private boolean delZone = false; private String delZone;
private final FSSObsMonitorConfigurationManager cfgMgr;
/** /**
* Constructor. * Constructor.
@ -112,7 +111,6 @@ public class EditNewZoneDlg extends CaveSWTDialog {
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText(appName.toString() + ": Edit a Newly Added Zone"); setText(appName.toString() + ": Edit a Newly Added Zone");
this.macDlg = macDlg; this.macDlg = macDlg;
cfgMgr = macDlg.getInstance();
} }
/* /*
@ -144,7 +142,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
createListAndTextControls(); createListAndTextControls();
createBottomLabel(); createBottomLabel();
createCloseButton(); createCloseButton();
populate(""); populate();
} }
/** /**
@ -229,6 +227,21 @@ public class EditNewZoneDlg extends CaveSWTDialog {
lonTF = new Text(textButtonComp, SWT.BORDER); lonTF = new Text(textButtonComp, SWT.BORDER);
lonTF.setLayoutData(gd); lonTF.setLayoutData(gd);
gd = new GridData();
gd.horizontalSpan = 2;
gd.verticalIndent = 15;
marineRdo = new Button(textButtonComp, SWT.RADIO);
marineRdo.setLayoutData(gd);
marineRdo.setSelection(false);
marineRdo.setText("Marine Station");
gd = new GridData();
gd.horizontalSpan = 2;
nonMarineRdo = new Button(textButtonComp, SWT.RADIO);
nonMarineRdo.setLayoutData(gd);
nonMarineRdo.setSelection(true);
nonMarineRdo.setText("Non-Marine Station");
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true); gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
gd.widthHint = 80; gd.widthHint = 80;
gd.verticalIndent = 5; gd.verticalIndent = 5;
@ -238,17 +251,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
saveBtn.addSelectionListener(new SelectionAdapter() { saveBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (zoneList.getItemCount() != 0) { saveSelected();
String area = zoneList.getItem(zoneList.getSelectionIndex());
String areaStr = idTF.getText().toUpperCase();
String latStr = latTF.getText();
String lonStr = lonTF.getText();
if (macDlg.formIsValid(areaStr, latStr, lonStr)) {
saveSelected(area, areaStr, latStr, lonStr);
}
} else {
bottomLbl.setText("No zones have been edited.");
}
} }
}); });
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true); gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
@ -306,24 +309,9 @@ public class EditNewZoneDlg extends CaveSWTDialog {
/** /**
* Populate list of added zones. * Populate list of added zones.
*/ */
private void populate(String selected) { private void populate() {
java.util.List<String> newList = new ArrayList<String>(); java.util.List<String> newList = macDlg.configMgr.getAddedZones();
java.util.List<AreaIdXML> maList = cfgMgr.getConfigXml().getAreaIds();
for (AreaIdXML maZone : maList) {
if (maZone.getCLat() != null) {
newList.add(maZone.getAreaId());
}
}
java.util.List<AreaIdXML> adtnlList = cfgMgr.getAdjAreaConfigXml()
.getAreaIds();
for (AreaIdXML aZone : adtnlList) {
if (aZone.getCLat() != null) {
newList.add(aZone.getAreaId());
}
}
zoneList.removeAll();
zoneList.setItems(newList.toArray(new String[newList.size()])); zoneList.setItems(newList.toArray(new String[newList.size()]));
macDlg.populateLeftLists(selected);
} }
/** /**
@ -331,23 +319,27 @@ public class EditNewZoneDlg extends CaveSWTDialog {
*/ */
private void handleZoneSelection() { private void handleZoneSelection() {
String zone = zoneList.getItem(zoneList.getSelectionIndex()); String zone = zoneList.getItem(zoneList.getSelectionIndex());
AreaIdXML areaXml = cfgMgr.getAreaXml(zone); AreaIdXML areaXml = macDlg.configMgr.getAreaXml(zone);
AreaIdXML adjAreaXml = cfgMgr.getAdjAreaXML(zone); // DR #7343: a null areaXml causes an "Unhandled event loop exception"
if (areaXml != null) { if (areaXml != null) {
idTF.setText(areaXml.getAreaId()); idTF.setText(areaXml.getAreaId());
idTF.setEnabled(false);
latTF.setText(String.valueOf(areaXml.getCLat())); latTF.setText(String.valueOf(areaXml.getCLat()));
lonTF.setText(String.valueOf(areaXml.getCLon())); lonTF.setText(String.valueOf(areaXml.getCLon()));
} else if (adjAreaXml != null) { if (areaXml.getType() == ZoneType.REGULAR) {
idTF.setText(adjAreaXml.getAreaId()); nonMarineRdo.setSelection(true);
latTF.setText(String.valueOf(adjAreaXml.getCLat())); marineRdo.setSelection(false);
lonTF.setText(String.valueOf(adjAreaXml.getCLon())); } else {
nonMarineRdo.setSelection(false);
marineRdo.setSelection(true);
}
} }
} }
/** /**
* Delete selected zones. * Delete selected zones.
*/ */
private Boolean deleteSelected() { private String deleteSelected() {
if (zoneList.getItemCount() != 0) { if (zoneList.getItemCount() != 0) {
if (zoneList.getSelectionIndex() == -1) { if (zoneList.getSelectionIndex() == -1) {
MessageBox messageBox = new MessageBox(shell, MessageBox messageBox = new MessageBox(shell,
@ -356,97 +348,62 @@ public class EditNewZoneDlg extends CaveSWTDialog {
messageBox.setMessage("Please select zone to be deleted."); messageBox.setMessage("Please select zone to be deleted.");
messageBox.open(); messageBox.open();
zoneList.select(0); zoneList.select(0);
return false; return null;
} }
String area = zoneList.getItem(zoneList.getSelectionIndex()); String area = zoneList.getItem(zoneList.getSelectionIndex());
AreaIdXML zoneXML = null;
if (cfgMgr.getConfigXml().containsArea(area)) {
zoneXML = cfgMgr.getAreaXml(area);
} else if (cfgMgr.getAdjAreaConfigXml().containsArea(area)) {
zoneXML = cfgMgr.getAdjAreaXML(area);
}
zoneList.remove(zoneList.getSelectionIndex()); zoneList.remove(zoneList.getSelectionIndex());
zoneList.select(0); macDlg.configMgr.removeArea(area);
if (zoneList.getItemCount() != 0) { idTF.setText("");
handleZoneSelection(); latTF.setText("");
} else { lonTF.setText("");
idTF.setText(""); return area;
latTF.setText("");
lonTF.setText("");
}
if (zoneXML != null && macDlg.getMaZones().contains(area)) {
macDlg.getMaZones().remove(area);
cfgMgr.removeArea(zoneXML);
}
if (zoneXML != null && macDlg.getAdditionalZones().contains(area)) {
macDlg.getAdditionalZones().remove(area);
cfgMgr.removeAdjArea(zoneXML);
}
macDlg.populateLeftLists("");
macDlg.maZonesRemoved = true;
return true;
} else { } else {
bottomLbl.setText("No zones have been deleted."); bottomLbl.setText("No zones have been deleted.");
} }
return false; return null;
} }
/** /**
* Save selected zones. * Save selected zones.
*
* @param area
* Original zone ID
* @param areaStr
* New zone ID
* @param latStr
* Latitude
* @param lonStr
* Longitude
* @throws NumberFormatException
*/ */
private void saveSelected(String area, String areaStr, String latStr, private void saveSelected() {
String lonStr) throws NumberFormatException {
java.util.List<StationIdXML> stationIds; if (zoneList.getItemCount() != 0) {
if (macDlg.getMaZones().contains(area)) { String area = zoneList.getItem(zoneList.getSelectionIndex());
stationIds = cfgMgr.getAreaXml(area).getStationIds(); String latStr = latTF.getText();
} else if (macDlg.getAdditionalZones().contains(area)) { String lontStr = lonTF.getText();
stationIds = cfgMgr.getAdjAreaXML(area).getStationIds(); if (latStr == null || latStr.isEmpty() || lontStr == null
|| lontStr.isEmpty()) {
macDlg.latLonErrorMsg(latStr, lontStr);
return;
} else {
try {
double lat = Double.parseDouble(latStr);
double lon = Double.parseDouble(lontStr);
if (lat > 90.0 || lat < -90.0 || lon > 180.0
|| lon < -180.0) {
macDlg.latLonErrorMsg(latStr, lontStr);
return;
}
ZoneType type = ZoneType.REGULAR;
if (marineRdo.getSelection()) {
type = ZoneType.MARITIME;
}
// Replace previously added zone
macDlg.configMgr.removeArea(area);
macDlg.configMgr.removeAddedArea(area);
macDlg.configMgr.addArea(area, lat, lon, type);
populate();
// Return cursor to the top of the list.
zoneList.select(0);
} catch (NumberFormatException e) {
macDlg.latLonErrorMsg(latStr, lontStr);
return;
}
}
} else { } else {
return; bottomLbl.setText("No zones have been edited.");
} }
double lat = Double.parseDouble(latStr);
double lon = Double.parseDouble(lonStr);
if (lat > 90.0 || lat < -90.0 || lon > 180.0 || lon < -180.0) {
macDlg.latLonErrorMsg(latStr, lonStr);
return;
}
ZoneType type = ZoneType.REGULAR;
if (areaStr.charAt(2) != 'C') {
type = (ZoneType.MARITIME);
}
AreaIdXML areaXML = new AreaIdXML();
areaXML.setAreaId(areaStr);
areaXML.setCLat(lat);
areaXML.setCLon(lon);
areaXML.setType(type);
areaXML.setStationIds(stationIds);
// Replace previously added zone
if (cfgMgr.getAreaList().contains(area)) {
if (macDlg.getMaZones().contains(area)) {
int idx = macDlg.getMaZones().indexOf(area);
macDlg.getMaZones().set(idx, areaXML.getAreaId());
}
cfgMgr.replaceArea(cfgMgr.getAreaXml(area), areaXML);
} else if (macDlg.getAdditionalZones().contains(area)) {
if (macDlg.getAdditionalZones().contains(area)) {
int idx = macDlg.getAdditionalZones().indexOf(area);
macDlg.getAdditionalZones().set(idx, areaXML.getAreaId());
}
cfgMgr.replaceAdjArea(cfgMgr.getAdjAreaXML(area), areaXML);
}
populate(areaStr);
// Return cursor to the list.
zoneList.select(zoneList.indexOf(areaStr));
} }
/* /*

View file

@ -21,9 +21,7 @@ package com.raytheon.uf.viz.monitor.ui.dialogs;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
@ -49,7 +47,7 @@ import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager; import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig; import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName; import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.xml.AreaIdXML; import com.raytheon.uf.common.monitor.xml.AreaIdXML.ZoneType;
import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -84,7 +82,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Oct 27, 2014 3667 skorolev Corrected functionality of dialog. Cleaned code. * Oct 27, 2014 3667 skorolev Corrected functionality of dialog. Cleaned code.
* Nov 12, 2014 3650 skorolev Added confirmation box for unsaved changes in the dialog. * Nov 12, 2014 3650 skorolev Added confirmation box for unsaved changes in the dialog.
* Mar 08, 2015 3888 dhladky Restored threshold pop-up when adding new stations/zones. * Mar 08, 2015 3888 dhladky Restored threshold pop-up when adding new stations/zones.
* Aug 17, 2015 3841 skorolev Added formIsValid method. * Sep 18, 2015 3873 skorolev Added formIsValid method.
* *
* </pre> * </pre>
* *
@ -187,7 +185,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
private Font controlFont; private Font controlFont;
/** Application name. **/ /** Application name. **/
private final CommonConfig.AppName appName; private CommonConfig.AppName appName;
/** The current site. **/ /** The current site. **/
protected static String currentSite = null; protected static String currentSite = null;
@ -236,6 +234,23 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
/** Flag set when user wants to close with unsaved modifications. */ /** Flag set when user wants to close with unsaved modifications. */
protected boolean closeFlag = false; protected boolean closeFlag = false;
private final static String INVALID_AREA_MSG = "Invalid Area ID = '%s' entered.\n"
+ "Please enter a correctly formatted Area ID:\n"
+ "Zone ID must have six characters.\n"
+ "A third character should be C for county and Z for marine zone.\n"
+ "Use only capital characters.";
private final static String INVALID_COORD_MSG = "Invalid Lat/Lon entered:\n"
+ "Latitude = '%s'\n"
+ "Longitude = '%s'\n"
+ "Please enter correctly formatted Lat and Lon values:\n"
+ "Latitude should be between -90,90.\n"
+ "Longitude should be between -180,180.";
private final static String MODIFY_THRESHOLD_MSG = "New zones have been added, and their monitoring thresholds "
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
/** /**
* Constructor. * Constructor.
* *
@ -335,7 +350,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
// initialize zone/station lists // initialize zone/station lists
initZoneStationLists(); initZoneStationLists();
// Populate the dialog // Populate the dialog
populateLeftLists(""); populateLeftLists();
setValues(); setValues();
shell.addShellListener(new ShellAdapter() { shell.addShellListener(new ShellAdapter() {
@Override @Override
@ -407,7 +422,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
mode = Mode.Zone; mode = Mode.Zone;
changeZoneStationControls(); changeZoneStationControls();
populateLeftLists(""); populateLeftLists();
if (!getShell().isDisposed()) { if (!getShell().isDisposed()) {
getShell().setCursor(null); getShell().setCursor(null);
} }
@ -423,7 +438,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
getDisplay().getSystemCursor(SWT.CURSOR_WAIT)); getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
mode = Mode.Station; mode = Mode.Station;
changeZoneStationControls(); changeZoneStationControls();
populateLeftLists(""); populateLeftLists();
if (!getShell().isDisposed()) { if (!getShell().isDisposed()) {
getShell().setCursor(null); getShell().setCursor(null);
} }
@ -792,10 +807,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
handleOkBtnSelection(); handleOkBtnSelection();
} catch (LocalizationException | SerializationException } catch (LocalizationException | SerializationException
| IOException e) { | IOException e) {
statusHandler statusHandler.handle(Priority.PROBLEM,
.handle(Priority.PROBLEM, "There is a problem saving changes. ", e);
"There is a problem with configuration XML file",
e);
} }
} }
}); });
@ -901,7 +914,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
if ((Boolean) returnValue) { if ((Boolean) returnValue) {
// Update the dialog // Update the dialog
populateLeftLists(""); populateLeftLists();
} }
addNewZoneDlg = null; addNewZoneDlg = null;
} }
@ -920,7 +933,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
if ((Boolean) returnValue) { if ((Boolean) returnValue) {
// Update the dialog // Update the dialog
populateLeftLists(""); populateLeftLists();
} }
addNewStnDlg = null; addNewStnDlg = null;
} }
@ -950,9 +963,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
if (returnValue instanceof String) { if (returnValue instanceof String) {
// Update the edit dialog // Update the edit dialog
String selectedZone = returnValue.toString(); populateLeftLists();
maZones.remove(selectedZone);
populateLeftLists("");
} }
editDlg = null; editDlg = null;
} }
@ -966,9 +977,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
@Override @Override
public void dialogClosed(Object returnValue) { public void dialogClosed(Object returnValue) {
if (returnValue instanceof String) { if (returnValue instanceof String) {
String station = returnValue.toString(); // Update the delete dialog
maStations.remove(station); String selectedStn = returnValue.toString();
populateLeftLists(""); maStations.remove(selectedStn);
populateLeftLists();
} }
deleteStnDlg = null; deleteStnDlg = null;
} }
@ -999,14 +1011,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
maRegionalList.setItems(additionalZones maRegionalList.setItems(additionalZones
.toArray(new String[additionalZones.size()])); .toArray(new String[additionalZones.size()]));
} }
maRegionalList.select(0);
} }
} }
/** /**
* Populates the zone list boxes. * Populates the zone list boxes.
*/ */
protected void populateLeftLists(String selected) { private void populateLeftLists() {
if (mode == Mode.Zone) { if (mode == Mode.Zone) {
/** Zone Mode */ /** Zone Mode */
Collections.sort(maZones); Collections.sort(maZones);
@ -1026,11 +1037,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
} }
if (monitorAreaList.getItemCount() > 0) { if (monitorAreaList.getItemCount() > 0) {
// select top of the list // select top of the list
if (selected.equals("")) { monitorAreaList.setSelection(0);
monitorAreaList.setSelection(0);
} else {
monitorAreaList.setSelection(monitorAreaList.indexOf(selected));
}
handleMonitorAreaListSelection(); handleMonitorAreaListSelection();
} }
} }
@ -1109,7 +1116,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
if (mode == Mode.Zone) { if (mode == Mode.Zone) {
String zone = additionalList.getItem(additionalList String zone = additionalList.getItem(additionalList
.getSelectionIndex()); .getSelectionIndex());
AreaIdXML zoneXML = configMgr.getAdjAreaXML(zone);
additionalList.remove(additionalList.getSelectionIndex()); additionalList.remove(additionalList.getSelectionIndex());
maZones.add(zone); maZones.add(zone);
Collections.sort(maZones); Collections.sort(maZones);
@ -1117,12 +1123,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.setItems(maZones.toArray(new String[maZones.size()])); .setItems(maZones.toArray(new String[maZones.size()]));
monitorAreaList.setSelection(maZones.indexOf(zone)); monitorAreaList.setSelection(maZones.indexOf(zone));
additionalZones.remove(zone); additionalZones.remove(zone);
configMgr.addArea(zoneXML); configMgr.addArea(zone, zone.charAt(2) == 'Z' ? ZoneType.MARITIME
handleMonitorAreaListSelection(); : ZoneType.REGULAR);
if (!configMgr.getAddedZones().contains(zone)) { if (!configMgr.getAddedZones().contains(zone)) {
configMgr.getAddedZones().add(zone); configMgr.getAddedZones().add(zone);
} }
configMgr.removeAdjArea(zoneXML); configMgr.removeAdjArea(zone);
handleMonitorAreaListSelection();
} else { // Station mode } else { // Station mode
if (associatedList.getSelectionCount() == 0) { if (associatedList.getSelectionCount() == 0) {
showMessage(shell, SWT.ERROR, "Selection Needed", showMessage(shell, SWT.ERROR, "Selection Needed",
@ -1142,7 +1149,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.getSelectionIndex()); .getSelectionIndex());
String stnId = stn.substring(0, stn.indexOf('#')); String stnId = stn.substring(0, stn.indexOf('#'));
String stnType = stn.substring(stn.indexOf('#') + 1); String stnType = stn.substring(stn.indexOf('#') + 1);
configMgr.addNewStation(zone, stnId, stnType, configMgr configMgr.addStation(zone, stnId, stnType, configMgr
.getAddedStations().contains(stnId)); .getAddedStations().contains(stnId));
handleMonitorAreaListSelection(); handleMonitorAreaListSelection();
} }
@ -1164,11 +1171,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
} }
String entry = monitorAreaList.getItem(monitorAreaList String entry = monitorAreaList.getItem(monitorAreaList
.getSelectionIndex()); .getSelectionIndex());
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
associatedList.removeAll();
if (mode == Mode.Zone) { if (mode == Mode.Zone) {
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
// entry is a zone to remove. // entry is a zone to remove.
AreaIdXML zoneXML = configMgr.getAreaXml(entry);
if (!additionalZones.contains(entry)) { if (!additionalZones.contains(entry)) {
additionalZones.add(entry); additionalZones.add(entry);
} }
@ -1177,30 +1183,23 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.toArray(new String[additionalZones.size()])); .toArray(new String[additionalZones.size()]));
additionalList.setSelection(additionalZones.indexOf(entry)); additionalList.setSelection(additionalZones.indexOf(entry));
maZones.remove(entry); maZones.remove(entry);
configMgr.removeArea(zoneXML); configMgr.removeArea(entry);
if (configMgr.getAddedZones().contains(entry)) { if (configMgr.getAddedZones().contains(entry)) {
configMgr.getAddedZones().remove(entry); configMgr.getAddedZones().remove(entry);
} }
configMgr.addAdjArea(zoneXML);
associatedList.removeAll(); configMgr.addAdjArea(entry,
} else { // Station mode. entry is name#type of station. entry.charAt(2) == 'Z' ? ZoneType.MARITIME
if (associatedList.getItemCount() >= 1 : ZoneType.REGULAR);
&& associatedList.getSelectionIndex() < 0) { } else { // Station mode
showMessage(shell, SWT.ERROR, "Selection Needed", // entry is a station to remove.
"You must select a assopciated area zone to remove.");
return;
}
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
String stnZone = associatedList.getSelection()[0];
additionalStns.add(entry); additionalStns.add(entry);
Collections.sort(additionalStns); Collections.sort(additionalStns);
additionalList.setItems(additionalStns additionalList.setItems(additionalStns
.toArray(new String[additionalStns.size()])); .toArray(new String[additionalStns.size()]));
additionalList.setSelection(additionalStns.indexOf(entry)); additionalList.setSelection(additionalStns.indexOf(entry));
maStations.remove(entry); maStations.remove(entry);
// station removes from configuration XML files configMgr.removeStation(entry.substring(0, entry.indexOf('#')));
configMgr.removeStationFromArea(stnZone,
entry.substring(0, entry.indexOf('#')));
} }
} }
@ -1234,8 +1233,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
} }
String entry = maRegionalList.getItem(maRegionalList String entry = maRegionalList.getItem(maRegionalList
.getSelectionIndex()); .getSelectionIndex());
java.util.List<String> itemList = new LinkedList<String>( String[] items = associatedList.getItems();
Arrays.asList(associatedList.getItems())); ArrayList<String> itemList = new ArrayList<String>();
for (String item : items) {
itemList.add(item);
}
if (itemList.contains(entry)) { if (itemList.contains(entry)) {
/** /**
* if selected entry is already in associated list: highlight the * if selected entry is already in associated list: highlight the
@ -1264,24 +1266,24 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.getSelectionIndex()); .getSelectionIndex());
String stnId = entry.substring(0, entry.indexOf('#')); String stnId = entry.substring(0, entry.indexOf('#'));
String stnType = entry.substring(entry.indexOf('#') + 1); String stnType = entry.substring(entry.indexOf('#') + 1);
configMgr.addStation(zone, stnId, stnType, configMgr
configMgr.addNewStation(zone, stnId, stnType, configMgr
.getAddedStations().contains(stnId)); .getAddedStations().contains(stnId));
} else { // Station mode } else { // Station mode
if (regionalRdo.getSelection()) { if (regionalRdo.getSelection()) {
// entry is a zone selected from additional zones // entry is a zone selected from additional zones
AreaIdXML zoneXML = configMgr.getAdjAreaXML(entry);
maZones.add(entry); maZones.add(entry);
Collections.sort(maZones); Collections.sort(maZones);
additionalZones.remove(entry); additionalZones.remove(entry);
maRegionalList.remove(maRegionalList.getSelectionIndex()); maRegionalList.remove(maRegionalList.getSelectionIndex());
configMgr.addArea(zoneXML); configMgr.addArea(entry,
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
: ZoneType.REGULAR);
} }
String stn = monitorAreaList.getItem(monitorAreaList String stn = monitorAreaList.getItem(monitorAreaList
.getSelectionIndex()); .getSelectionIndex());
String stnId = stn.substring(0, stn.indexOf('#')); String stnId = stn.substring(0, stn.indexOf('#'));
String stnType = stn.substring(stn.indexOf('#') + 1); String stnType = stn.substring(stn.indexOf('#') + 1);
configMgr.addNewStation(entry, stnId, stnType, configMgr configMgr.addStation(entry, stnId, stnType, configMgr
.getAddedStations().contains(stnId)); .getAddedStations().contains(stnId));
} }
} }
@ -1306,10 +1308,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
if (mode == Mode.Zone) { if (mode == Mode.Zone) {
String zone = monitorAreaList.getItem(monitorAreaList String zone = monitorAreaList.getItem(monitorAreaList
.getSelectionIndex()); .getSelectionIndex());
configMgr.removeStationFromArea(zone, entry); configMgr.removeStation(zone, entry);
java.util.List<String> zones = configMgr.getAreaByStationId(entry java.util.List<String> zones = configMgr.getAreaByStationId(entry
.substring(0, entry.indexOf('#'))); .substring(0, entry.indexOf('#')));
if (zones.isEmpty()) { if (zones.size() == 0) {
// entry is no longer an MA station // entry is no longer an MA station
maStations.remove(entry); maStations.remove(entry);
additionalStns.add(entry); additionalStns.add(entry);
@ -1325,7 +1327,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
} else { // Station mode } else { // Station mode
String stn = monitorAreaList.getItem(monitorAreaList String stn = monitorAreaList.getItem(monitorAreaList
.getSelectionIndex()); .getSelectionIndex());
configMgr.removeStationFromArea(entry, stn); configMgr.removeStation(entry, stn);
} }
} }
@ -1333,7 +1335,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* Handles the monitor area list selection. * Handles the monitor area list selection.
*/ */
private void handleMonitorAreaListSelection() { private void handleMonitorAreaListSelection() {
if (monitorAreaList.getSelectionIndex() == -1) { if (monitorAreaList.getSelectionIndex() < 0) {
return; return;
} }
if (mode == Mode.Zone) { if (mode == Mode.Zone) {
@ -1380,7 +1382,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
getValues(); getValues();
configMgr.saveConfigXml(); configMgr.saveConfigXml();
configMgr.saveAdjacentAreaConfigXml(); configMgr.saveAdjacentAreaConfigXml();
configMgr.setPopulated(true);
} }
/** /**
@ -1395,9 +1396,9 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* Handles OK button. Save changes and close the dialog (or just close if * Handles OK button. Save changes and close the dialog (or just close if
* there are no changes). * there are no changes).
* *
* @throws IOException
* @throws SerializationException * @throws SerializationException
* @throws LocalizationException * @throws LocalizationException
* @throws IOException
*/ */
protected abstract void handleOkBtnSelection() protected abstract void handleOkBtnSelection()
throws LocalizationException, SerializationException, IOException; throws LocalizationException, SerializationException, IOException;
@ -1410,7 +1411,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void addZoneToMA(String zone) { public void addZoneToMA(String zone) {
maZones.add(zone); maZones.add(zone);
Collections.sort(maZones); Collections.sort(maZones);
populateLeftLists(zone); populateLeftLists();
} }
/** /**
@ -1422,7 +1423,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void addStationToMA(String stnWithType) { public void addStationToMA(String stnWithType) {
maStations.add(stnWithType); maStations.add(stnWithType);
Collections.sort(maStations); Collections.sort(maStations);
populateLeftLists(""); populateLeftLists();
} }
/* /*
@ -1452,35 +1453,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
return false; return false;
} }
/**
* Input test.
*
* @param area
* @param latString
* @param lonString
* @return
*/
public boolean formIsValid(String area, String latString, String lonString) { public boolean formIsValid(String area, String latString, String lonString) {
boolean retVal = true; boolean retVal = true;
String msg = "";
if (area.equals("") || area.length() != 6 if (area.equals("") || area.length() != 6
|| !Character.isDigit(area.charAt(3))) { || (area.charAt(2) != 'C' && area.charAt(2) != 'Z')) {
msg = "Invalid Area ID = '" displayInputErrorMsg(String.format(INVALID_AREA_MSG, area));
+ area
+ "' entered.\n"
+ "Please enter a correctly formatted Area ID:\n"
+ "Zone ID must have six characters. 3 letters and 3 digits.\n"
+ "Use only capital characters.\n";
retVal = false;
}
if (appName != AppName.SNOW
&& (area.charAt(2) != 'C' && area.charAt(2) != 'Z')) {
msg = msg
+ "A third character should be C for county and Z for marine zone.\n";
retVal = false;
}
if (!msg.isEmpty()) {
displayInputErrorMsg(msg);
retVal = false; retVal = false;
} }
if (latString == null || latString.isEmpty() || lonString == null if (latString == null || latString.isEmpty() || lonString == null
@ -1491,19 +1468,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
return retVal; return retVal;
} }
/**
* Displays Input Error Message
*
* @param msg
*/
public void displayInputErrorMsg(String msg) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
| SWT.OK);
messageBox.setText("Invalid input");
messageBox.setMessage(msg);
messageBox.open();
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -1550,20 +1514,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* @see * @see
* com.raytheon.uf.viz.monitor.ui.dialogs.INewZoneStnAction#latLonErrorMsg() * com.raytheon.uf.viz.monitor.ui.dialogs.INewZoneStnAction#latLonErrorMsg()
*/ */
@Override
public void latLonErrorMsg(String latStr, String lonStr) { public void latLonErrorMsg(String latStr, String lonStr) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
| SWT.OK); | SWT.OK);
messageBox.setText("Invalid Lat/Lon"); messageBox.setMessage(INVALID_COORD_MSG);
StringBuilder errMsg = new StringBuilder("Invalid Lat/Lon entered:");
errMsg.append("\nLatitude = ");
errMsg.append(latStr);
errMsg.append("\nLongitude = ");
errMsg.append(lonStr);
errMsg.append("\nPlease enter correctly formatted Lat and Lon values:");
errMsg.append("\nLatitude should be between -90,90.");
errMsg.append("\nLongitude should be between -180,180.");
messageBox.setMessage(errMsg.toString());
messageBox.open(); messageBox.open();
} }
@ -1571,7 +1525,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* Reset data status. * Reset data status.
*/ */
protected void resetStatus() { protected void resetStatus() {
this.timeWindowChanged = false; this.timeWindowChanged = false;
this.maZonesRemoved = false; this.maZonesRemoved = false;
this.maStationsRemoved = false; this.maStationsRemoved = false;
@ -1601,11 +1554,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* @return * @return
*/ */
protected int editDialog() { protected int editDialog() {
String message = "New zones have been added, and their monitoring thresholds "
+ "have been set to default values; would you like to modify "
+ "their threshold values now?";
int yesno = showMessage(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO, int yesno = showMessage(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO,
"Edit Thresholds Now?", message); "Edit Thresholds Now?", MODIFY_THRESHOLD_MSG);
return yesno; return yesno;
} }
@ -1643,6 +1593,19 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
return additionalStns; return additionalStns;
} }
/**
* Displays Input Error Message
*
* @param msg
*/
public void displayInputErrorMsg(String msg) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
| SWT.OK);
messageBox.setText("Invalid input");
messageBox.setMessage(msg);
messageBox.open();
}
/** /**
* Gets Configuration manager. * Gets Configuration manager.
* *

View file

@ -54,7 +54,10 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager; import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.map.IMapDescriptor; import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.monitor.IMonitor; import com.raytheon.uf.viz.monitor.IMonitor;
@ -96,7 +99,7 @@ import com.vividsolutions.jts.io.ParseException;
* May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager. * May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager.
* Sep 15, 2014 3220 skorolev Added refreshZoneTableData method. * Sep 15, 2014 3220 skorolev Added refreshZoneTableData method.
* Nov 03, 2014 3741 skorolev Updated zoom procedures. * Nov 03, 2014 3741 skorolev Updated zoom procedures.
* Aug 26, 2015 3841 skorolev Corrected zoomToZone procedure. * Sep 25, 2015 3873 skorolev Added center definition for moving platforms.
* *
* </pre> * </pre>
* *
@ -192,6 +195,8 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
private final DateFormat dFormat = new SimpleDateFormat( private final DateFormat dFormat = new SimpleDateFormat(
"E MMM dd HH:mm:ss yyyy"); "E MMM dd HH:mm:ss yyyy");
public static String datePattern = "yyyy-MM-dd HH:mm:ss";
/** list of variables to plot. **/ /** list of variables to plot. **/
public List<String> prodArray; public List<String> prodArray;
@ -226,7 +231,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
protected abstract void shellDisposeAction(); protected abstract void shellDisposeAction();
/** List of opened plots. **/ /** List of opened plots. **/
private final Map<String, CaveSWTDialog> openedDlgs = new HashMap<String, CaveSWTDialog>(); private Map<String, CaveSWTDialog> openedDlgs = new HashMap<String, CaveSWTDialog>();
/** row index in the station table. **/ /** row index in the station table. **/
public int rowIndex; public int rowIndex;
@ -243,7 +248,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
/** current site **/ /** current site **/
protected String site; protected String site;
protected FSSObsMonitorConfigurationManager configMgr = null; protected FSSObsMonitorConfigurationManager configMgr;
/** /**
* Constructor * Constructor
@ -654,6 +659,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
initiateProdArray(); initiateProdArray();
dlgTitle = getTrendPlotName(prodArray) + " Trend Plot for " + station dlgTitle = getTrendPlotName(prodArray) + " Trend Plot for " + station
+ "#" + dataSrc; + "#" + dataSrc;
if (graphType == GraphType.Trend) { if (graphType == GraphType.Trend) {
TrendPlotDlg tpd = (TrendPlotDlg) openedDlgs.get(dlgTitle); TrendPlotDlg tpd = (TrendPlotDlg) openedDlgs.get(dlgTitle);
if (tpd == null) { if (tpd == null) {
@ -789,7 +795,6 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
private void zoomToZone(String zone) throws Exception { private void zoomToZone(String zone) throws Exception {
Coordinate zoneCenter = MonitorAreaUtils.getZoneCenter(zone); Coordinate zoneCenter = MonitorAreaUtils.getZoneCenter(zone);
if (zoneCenter == null) { // Test a newly added zone. if (zoneCenter == null) { // Test a newly added zone.
configMgr = getMonitorAreaConfigInstance();
AreaIdXML zoneXML = configMgr.getAreaXml(zone); AreaIdXML zoneXML = configMgr.getAreaXml(zone);
if (zoneXML != null // Coordinates do not the null values. if (zoneXML != null // Coordinates do not the null values.
&& (zoneXML.getCLon() != null || zoneXML.getCLat() != null)) { && (zoneXML.getCLon() != null || zoneXML.getCLat() != null)) {
@ -814,11 +819,29 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
try { try {
Coordinate stnCenter = MonitorAreaUtils Coordinate stnCenter = MonitorAreaUtils
.getStationCenter(selectedStation); .getStationCenter(selectedStation);
if (stnCenter != null) { if (stnCenter == null) {
zoomAndRecenter(stnCenter, STATION_ZOOM_LEVEL); // Center for moving platforms.
SimpleDateFormat datef = new SimpleDateFormat(datePattern);
datef.setTimeZone(TimeZone.getTimeZone("GMT"));
String sql = "select longitude, latitude from fssobs where stationid = '"
+ selectedStation + "'";
List<Object[]> results = DirectDbQuery.executeQuery(sql,
"metadata", QueryLanguage.SQL);
double x;
double y;
if (!results.isEmpty()) {
x = Double.parseDouble(results.get(0)[0].toString());
y = Double.parseDouble(results.get(0)[1].toString());
stnCenter = new Coordinate();
stnCenter.x = x;
stnCenter.y = y;
}
} }
} catch (SpatialException | ParseException e) { zoomAndRecenter(stnCenter, STATION_ZOOM_LEVEL);
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e); } catch (SpatialException | ParseException | VizException e) {
statusHandler.handle(Priority.ERROR,
"Unable to find the station center for station: "
+ selectedStation, e);
} }
} }
@ -945,20 +968,30 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
int stInd = name.indexOf("_"); int stInd = name.indexOf("_");
if (prod.size() > 1) { if (prod.size() > 1) {
varName = name.substring(0, stInd); varName = name.substring(0, stInd);
if (varName.equals("SCA")) { switch (varName) {
case "SCA":
varName = "Small Craft Advisory"; varName = "Small Craft Advisory";
} else if (varName.equals("GALE")) { break;
case "GALE":
varName = "Gale Warning"; varName = "Gale Warning";
} else if (varName.equals("STORM")) { break;
case "STORM":
varName = "Storm Warning"; varName = "Storm Warning";
} else if (varName.equals("HURRICANE")) { break;
case "HURRICANE":
varName = "Hurricane Force Wind Warning"; varName = "Hurricane Force Wind Warning";
} else if (varName.equals("BLIZ")) { break;
case "BLIZ":
varName = "Blizzard Warning"; varName = "Blizzard Warning";
} else if (varName.equals("FRZ")) { break;
case "FRZ":
varName = "Freezing Precipitation"; varName = "Freezing Precipitation";
} else if (varName.equals("HSW")) { break;
case "HSW":
varName = "Heavy Snow Warning"; varName = "Heavy Snow Warning";
break;
default:
statusHandler.error("Invalid name for variable " + varName);
} }
} else { } else {
varName = name.substring(stInd + 1); varName = name.substring(stInd + 1);

View file

@ -21,8 +21,10 @@ package com.raytheon.uf.viz.monitor.util;
import java.util.HashMap; import java.util.HashMap;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
/** /**
* TODO Add Description * Monitor Configuration Constants.
* *
* <pre> * <pre>
* *
@ -30,57 +32,59 @@ import java.util.HashMap;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Mar 16, 2009 2076 avarani Initial creation * Mar 16, 2009 2076 avarani Initial creation
* Sep 18, 2015 3873 skorolev Corrected appName.
* *
* </pre> * </pre>
* *
* @author avarani * @author avarani
* @version 1.0 * @version 1.0
*/ */
public class MonitorConfigConstants public class MonitorConfigConstants {
{
private static HashMap<String, Boolean> ryHigherMapSS; private static HashMap<String, Boolean> ryHigherMapSS;
private static HashMap<String, Boolean> ryHigherMapSnow; private static HashMap<String, Boolean> ryHigherMapSnow;
private static HashMap<String, Boolean> ryHigherMapFog; private static HashMap<String, Boolean> ryHigherMapFog;
private static boolean rankSwellPeriodHigh = false; private static boolean rankSwellPeriodHigh = false;
/* /*
* SAFESEAS * SAFESEAS
*/ */
public static enum SafeSeasDisplay public static enum SafeSeasDisplay {
{ SS_DISP_PROD_SCA_WIND_SPEED("Display.Product.SCA.wind_speed"), SS_DISP_PROD_SCA_GUST_SPEED(
SS_DISP_PROD_SCA_WIND_SPEED("Display.Product.SCA.wind_speed"), "Display.Product.SCA.gust_speed"), SS_DISP_PROD_SCA_PEAK_WIND(
SS_DISP_PROD_SCA_GUST_SPEED("Display.Product.SCA.gust_speed"), "Display.Product.SCA.peak_wind_speed"), SS_DISP_PROD_SCA_WAVE_HT(
SS_DISP_PROD_SCA_PEAK_WIND("Display.Product.SCA.peak_wind_speed"), "Display.Product.SCA.wave_height"), SS_DISP_PROD_GALE_WIND_SPEED(
SS_DISP_PROD_SCA_WAVE_HT("Display.Product.SCA.wave_height"), "Display.Product.Gale.wind_speed"), SS_DISP_PROD_GALE_GUST_SPEED(
SS_DISP_PROD_GALE_WIND_SPEED("Display.Product.Gale.wind_speed"), "Display.Product.Gale.gust_speed"), SS_DISP_PROD_GALE_PEAK_WIND(
SS_DISP_PROD_GALE_GUST_SPEED("Display.Product.Gale.gust_speed"), "Display.Product.Gale.peak_wind_speed"), SS_DISP_PROD_STORM_WIND_SPEED(
SS_DISP_PROD_GALE_PEAK_WIND("Display.Product.Gale.peak_wind_speed"), "Display.Product.Storm.wind_speed"), SS_DISP_PROD_STORM_GUST_SPEED(
SS_DISP_PROD_STORM_WIND_SPEED("Display.Product.Storm.wind_speed"), "Display.Product.Storm.gust_speed"), SS_DISP_PROD_STORM_PEAK_WIND(
SS_DISP_PROD_STORM_GUST_SPEED("Display.Product.Storm.gust_speed"), "Display.Product.Storm.peak_wind_speed"), SS_DISP_PROD_HFWW_WIND_SPEED(
SS_DISP_PROD_STORM_PEAK_WIND("Display.Product.Storm.peak_wind_speed"), "Display.Product.Hurricane.wind_speed"), SS_DISP_PROD_HFWW_GUST_SPEED(
SS_DISP_PROD_HFWW_WIND_SPEED("Display.Product.Hurricane.wind_speed"), "Display.Product.Hurricane.gust_speed"), SS_DISP_PROD_HFWW_PEAK_WIND(
SS_DISP_PROD_HFWW_GUST_SPEED("Display.Product.Hurricane.gust_speed"), "Display.Product.Hurricane.peak_wind_speed"), SS_DISP_WIND_WIND_SPEED(
SS_DISP_PROD_HFWW_PEAK_WIND("Display.Product.Hurricane.peak_wind_speed"), "Display.Wind.wind_speed"), SS_DISP_WIND_PEAK_WIND(
SS_DISP_WIND_WIND_SPEED("Display.Wind.wind_speed"), "Display.Wind.peak_wind_speed"), SS_DISP_WIND_GUST_SPEED(
SS_DISP_WIND_PEAK_WIND("Display.Wind.peak_wind_speed"), "Display.Wind.gust_speed"), SS_DISP_WIND_DIR_FROM(
SS_DISP_WIND_GUST_SPEED("Display.Wind.gust_speed"), "Display.Wind.dirFrom"), SS_DISP_WIND_DIR_TO(
SS_DISP_WIND_DIR_FROM("Display.Wind.dirFrom"), "Display.Wind.dirTo"), SS_DISP_METEO_VIS(
SS_DISP_WIND_DIR_TO("Display.Wind.dirTo"), "Display.Meteo.visibility"), SS_DISP_METEO_TEMP(
SS_DISP_METEO_VIS("Display.Meteo.visibility"), "Display.Meteo.temperature"), SS_DISP_METEO_DEWPT(
SS_DISP_METEO_TEMP("Display.Meteo.temperature"), "Display.Meteo.dewpoint"), SS_DISP_METEO_SLP(
SS_DISP_METEO_DEWPT("Display.Meteo.dewpoint"), "Display.Meteo.slp"), SS_DISP_METEO_SST(
SS_DISP_METEO_SLP("Display.Meteo.slp"), "Display.Meteo.sea_surface_temp"), SS_DISP_METEO_WAVE_HT(
SS_DISP_METEO_SST("Display.Meteo.sea_surface_temp"), "Display.Meteo.wave_height"), SS_DISP_METEO_WAVE_STEEP(
SS_DISP_METEO_WAVE_HT("Display.Meteo.wave_height"), "Display.Meteo.wave_steepness"), SS_DISP_SWELL_PRIM_HT(
SS_DISP_METEO_WAVE_STEEP("Display.Meteo.wave_steepness"), "Display.Swell.Primary.height"), SS_DISP_SWELL_PRIM_PD(
SS_DISP_SWELL_PRIM_HT("Display.Swell.Primary.height"), "Display.Swell.Primary.period"), SS_DISP_SWELL_PRIM_DIR_FROM(
SS_DISP_SWELL_PRIM_PD("Display.Swell.Primary.period"), "Display.Swell.Primary.dirFrom"), SS_DISP_SWELL_PRIM_DIR_TO(
SS_DISP_SWELL_PRIM_DIR_FROM("Display.Swell.Primary.dirFrom"), "Display.Swell.Primary.dirTo"), SS_DISP_SWELL_SEC_HT(
SS_DISP_SWELL_PRIM_DIR_TO("Display.Swell.Primary.dirTo"), "Display.Swell.Secondary.height"), SS_DISP_SWELL_SEC_PD(
SS_DISP_SWELL_SEC_HT("Display.Swell.Secondary.height"), "Display.Swell.Secondary.period"), SS_DISP_SWELL_SEC_DIR_FROM(
SS_DISP_SWELL_SEC_PD("Display.Swell.Secondary.period"), "Display.Swell.Secondary.dirFrom"), SS_DISP_SWELL_SEC_DIR_TO(
SS_DISP_SWELL_SEC_DIR_FROM("Display.Swell.Secondary.dirFrom"), "Display.Swell.Secondary.dirTo");
SS_DISP_SWELL_SEC_DIR_TO("Display.Swell.Secondary.dirTo");
String XMLKey; String XMLKey;
@ -92,22 +96,21 @@ public class MonitorConfigConstants
return XMLKey; return XMLKey;
} }
} }
public static enum SafeSeasMonitor public static enum SafeSeasMonitor {
{ SS_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), SS_MON_METEO_PEAK_WIND(
SS_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), "Monitor.Meteo.peak_wind_speed"), SS_MON_METEO_GUST_SPEED(
SS_MON_METEO_PEAK_WIND("Monitor.Meteo.peak_wind_speed"), "Monitor.Meteo.gust_speed"), SS_MON_METEO_WAVE_HT(
SS_MON_METEO_GUST_SPEED("Monitor.Meteo.gust_speed"), "Monitor.Meteo.wave_height"), SS_MON_METEO_VIS(
SS_MON_METEO_WAVE_HT("Monitor.Meteo.wave_height"), "Monitor.Meteo.visibility"), SS_MON_SWELL_PRIM_HT(
SS_MON_METEO_VIS("Monitor.Meteo.visibility"), "Monitor.Swell.Primary.height"), SS_MON_SWELL_PRIM_PD(
SS_MON_SWELL_PRIM_HT("Monitor.Swell.Primary.height"), "Monitor.Swell.Primary.period"), SS_MON_SWELL_PRIM_DIR_FROM(
SS_MON_SWELL_PRIM_PD("Monitor.Swell.Primary.period"), "Monitor.Swell.Primary.dirFrom"), SS_MON_SWELL_PRIM_DIR_TO(
SS_MON_SWELL_PRIM_DIR_FROM("Monitor.Swell.Primary.dirFrom"), "Monitor.Swell.Primary.dirTo"), SS_MON_SWELL_SEC_HT(
SS_MON_SWELL_PRIM_DIR_TO("Monitor.Swell.Primary.dirTo"), "Monitor.Swell.Secondary.height"), SS_MON_SWELL_SEC_PD(
SS_MON_SWELL_SEC_HT("Monitor.Swell.Secondary.height"), "Monitor.Swell.Secondary.period"), SS_MON_SWELL_SEC_DIR_FROM(
SS_MON_SWELL_SEC_PD("Monitor.Swell.Secondary.period"), "Monitor.Swell.Secondary.dirFrom"), SS_MON_SWELL_SEC_DIR_TO(
SS_MON_SWELL_SEC_DIR_FROM("Monitor.Swell.Secondary.dirFrom"), "Monitor.Swell.Secondary.dirTo");
SS_MON_SWELL_SEC_DIR_TO("Monitor.Swell.Secondary.dirTo");
String XMLKey; String XMLKey;
@ -121,34 +124,33 @@ public class MonitorConfigConstants
} }
/* /*
* SNOW * SNOW
*/ */
public static enum SnowDisplay public static enum SnowDisplay {
{ SNOW_DISP_PROD_BLIZZ_VIS("Display.Product.Blizzard.visibility"), SNOW_DISP_PROD_BLIZZ_WIND_SPEED(
SNOW_DISP_PROD_BLIZZ_VIS("Display.Product.Blizzard.visibility"), "Display.Product.Blizzard.wind_speed"), SNOW_DISP_PROD_BLIZZ_GUST_SPEED(
SNOW_DISP_PROD_BLIZZ_WIND_SPEED("Display.Product.Blizzard.wind_speed"), "Display.Product.Blizzard.gust_speed"), SNOW_DISP_PROD_BLIZZ_PEAK_WIND(
SNOW_DISP_PROD_BLIZZ_GUST_SPEED("Display.Product.Blizzard.gust_speed"), "Display.Product.Blizzard.peak_wind_speed"), SNOW_DISP_PROD_FRZ_TEMP(
SNOW_DISP_PROD_BLIZZ_PEAK_WIND("Display.Product.Blizzard.peak_wind_speed"), "Display.Product.Freezing_Precip.temperature"), SNOW_DISP_PROD_FRZ_HOURLY_PRECIP(
SNOW_DISP_PROD_FRZ_TEMP("Display.Product.Freezing_Precip.temperature"), "Display.Product.Freezing_Precip.hourly_precip"), SNOW_DISP_PROD_HSW_SNINCR_HOURLY(
SNOW_DISP_PROD_FRZ_HOURLY_PRECIP("Display.Product.Freezing_Precip.hourly_precip"), "Display.Product.Heavy_Snow_Warning.snincr_hourly"), SNOW_DISP_PROD_HSW_SNINCR_TOTAL(
SNOW_DISP_PROD_HSW_SNINCR_HOURLY("Display.Product.Heavy_Snow_Warning.snincr_hourly"), "Display.Product.Heavy_Snow_Warning.snincr_total"), SNOW_DISP_PROD_HSW_SNOW_DEPTH(
SNOW_DISP_PROD_HSW_SNINCR_TOTAL("Display.Product.Heavy_Snow_Warning.snincr_total"), "Display.Product.Heavy_Snow_Warning.snow_depth"), SNOW_DISP_WIND_WIND_SPEED(
SNOW_DISP_PROD_HSW_SNOW_DEPTH("Display.Product.Heavy_Snow_Warning.snow_depth"), "Display.Product.Wind.wind_speed"), SNOW_DISP_WIND_PEAK_WIND(
SNOW_DISP_WIND_WIND_SPEED("Display.Product.Wind.wind_speed"), "Display.Product.Wind.peak_wind_speed"), SNOW_DISP_WIND_GUST_SPEED(
SNOW_DISP_WIND_PEAK_WIND("Display.Product.Wind.peak_wind_speed"), "Display.Product.Wind.gust_speed"), SNOW_DISP_WIND_DIR_FROM(
SNOW_DISP_WIND_GUST_SPEED("Display.Product.Wind.gust_speed"), "Display.Product.Wind.dirFrom"), SNOW_DISP_WIND_DIR_TO(
SNOW_DISP_WIND_DIR_FROM("Display.Product.Wind.dirFrom"), "Display.Product.Wind.dirTo"), SNOW_DISP_METEO_TEMP(
SNOW_DISP_WIND_DIR_TO("Display.Product.Wind.dirTo"), "Display.Meteo.temperature"), SNOW_DISP_METEO_DEWPT(
SNOW_DISP_METEO_TEMP("Display.Meteo.temperature"), "Display.Meteo.dewpoint"), SNOW_DISP_METEO_VIS(
SNOW_DISP_METEO_DEWPT("Display.Meteo.dewpoint"), "Display.Meteo.visibility"), SNOW_DISP_METEO_SLP(
SNOW_DISP_METEO_VIS("Display.Meteo.visibility"), "Display.Meteo.slp"), SNOW_DISP_METEO_HOURLY_PRECIP(
SNOW_DISP_METEO_SLP("Display.Meteo.slp"), "Display.Meteo.hourly_precip"), SNOW_DISP_METEO_WIND_CHILL(
SNOW_DISP_METEO_HOURLY_PRECIP("Display.Meteo.hourly_precip"), "Display.Meteo.wind_chill"), SNOW_DISP_METEO_FROSTBITE(
SNOW_DISP_METEO_WIND_CHILL("Display.Meteo.wind_chill"), "Display.Meteo.frostbite_time"), SNOW_DISP_METEO_SNOW_DEPTH(
SNOW_DISP_METEO_FROSTBITE("Display.Meteo.frostbite_time"), "Display.Meteo.snow_depth"), SNOW_DISP_METEO_SNINCR_HOURLY(
SNOW_DISP_METEO_SNOW_DEPTH("Display.Meteo.snow_depth"), "Display.Meteo.snincr_hourly"), SNOW_DISP_METEO_SNINCR_TOTAL(
SNOW_DISP_METEO_SNINCR_HOURLY("Display.Meteo.snincr_hourly"), "Display.Meteo.snincr_total");
SNOW_DISP_METEO_SNINCR_TOTAL("Display.Meteo.snincr_total");
String XMLKey; String XMLKey;
@ -160,16 +162,15 @@ public class MonitorConfigConstants
return XMLKey; return XMLKey;
} }
} }
public static enum SnowMonitor public static enum SnowMonitor {
{ SNOW_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), SNOW_MON_METEO_PEAK_WIND(
SNOW_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), "Monitor.Meteo.peak_wind_speed"), SNOW_MON_METEO_GUST_SPEED(
SNOW_MON_METEO_PEAK_WIND("Monitor.Meteo.peak_wind_speed"), "Monitor.Meteo.gust_speed"), SNOW_MON_METEO_TEMP(
SNOW_MON_METEO_GUST_SPEED("Monitor.Meteo.gust_speed"), "Monitor.Meteo.temperature"), SNOW_MON_METEO_WIND_CHILL(
SNOW_MON_METEO_TEMP("Monitor.Meteo.temperature"), "Monitor.Meteo.wind_chill"), SNOW_MON_METEO_VIS(
SNOW_MON_METEO_WIND_CHILL("Monitor.Meteo.wind_chill"), "Monitor.Meteo.visibility"), SNOW_MON_METEO_SNOW_DEPTH(
SNOW_MON_METEO_VIS("Monitor.Meteo.visibility"), "Monitor.Meteo.snow_depth");
SNOW_MON_METEO_SNOW_DEPTH("Monitor.Meteo.snow_depth");
String XMLKey; String XMLKey;
@ -183,19 +184,18 @@ public class MonitorConfigConstants
} }
// FOG // FOG
public static enum FogDisplay public static enum FogDisplay {
{ FOG_DISP_METEO_VIS("Display.Meteo.visibility"), FOG_DISP_METEO_CEILING(
FOG_DISP_METEO_VIS("Display.Meteo.visibility"), "Display.Meteo.ceiling"), FOG_DISP_METEO_TEMP(
FOG_DISP_METEO_CEILING("Display.Meteo.ceiling"), "Display.Meteo.temperature"), FOG_DISP_METEO_DEWPT(
FOG_DISP_METEO_TEMP("Display.Meteo.temperature"), "Display.Meteo.dewpoint"), FOG_DISP_METEO_T_TD(
FOG_DISP_METEO_DEWPT("Display.Meteo.dewpoint"), "Display.Meteo.t_td"), FOG_DISP_METEO_REL_HUMIDITY(
FOG_DISP_METEO_T_TD("Display.Meteo.t_td"), "Display.Meteo.relative_humidity"), FOG_DISP_WIND_WIND_SPEED(
FOG_DISP_METEO_REL_HUMIDITY("Display.Meteo.relative_humidity"), "Display.Wind.wind_speed"), FOG_DISP_WIND_PEAK_WIND(
FOG_DISP_WIND_WIND_SPEED("Display.Wind.wind_speed"), "Display.Wind.peak_wind_speed"), FOG_DISP_WIND_GUST_SPEED(
FOG_DISP_WIND_PEAK_WIND("Display.Wind.peak_wind_speed"), "Display.Wind.gust_speed"), FOG_DISP_WIND_DIR_FROM(
FOG_DISP_WIND_GUST_SPEED("Display.Wind.gust_speed"), "Display.Wind.dirFrom"), FOG_DISP_WIND_DIR_TO(
FOG_DISP_WIND_DIR_FROM("Display.Wind.dirFrom"), "Display.Wind.dirTo");
FOG_DISP_WIND_DIR_TO("Display.Wind.dirTo");
String XMLKey; String XMLKey;
@ -207,11 +207,10 @@ public class MonitorConfigConstants
return XMLKey; return XMLKey;
} }
} }
public static enum FogMonitor public static enum FogMonitor {
{
FOG_MONITOR_METEO_VIS("Monitor.Meteo.visiblity"); FOG_MONITOR_METEO_VIS("Monitor.Meteo.visiblity");
String XMLKey; String XMLKey;
FogMonitor(String s) { FogMonitor(String s) {
@ -222,340 +221,248 @@ public class MonitorConfigConstants
return XMLKey; return XMLKey;
} }
} }
public static Boolean rValueIsHigher(String key, String appName) public static Boolean rValueIsHigher(String key, AppName appName) {
{ if (appName.equals(AppName.SAFESEAS)) {
if ( appName.equals("safeseas") ) { if (ryHigherMapSS == null) {
if ( ryHigherMapSS == null ) { createRYHigherMapSS();
createRYHigherMapSS(); }
}
if (ryHigherMapSS.containsKey(key) == true) {
if ( ryHigherMapSS.containsKey(key) == true ) { return ryHigherMapSS.get(key);
return ryHigherMapSS.get(key); }
} } else if (appName.equals(AppName.SNOW)) {
} else if ( appName.equals("snow") ) { if (ryHigherMapSnow == null) {
if ( ryHigherMapSnow == null ) { createRYHigherMapSnow();
createRYHigherMapSnow(); }
}
if (ryHigherMapSnow.containsKey(key) == true) {
if ( ryHigherMapSnow.containsKey(key) == true ) { return ryHigherMapSnow.get(key);
return ryHigherMapSnow.get(key); }
} } else if (appName.equals(AppName.FOG)) {
} else if ( appName.equals("fog") ) { if (ryHigherMapFog == null) {
if ( ryHigherMapFog == null ) { createRYHigherMapFog();
createRYHigherMapFog(); }
}
if (ryHigherMapFog.containsKey(key) == true) {
if ( ryHigherMapFog.containsKey(key) == true ) { return ryHigherMapFog.get(key);
return ryHigherMapFog.get(key); }
} } else {
} else { // do nothing here
// do nothing here }
}
return false; return false;
} }
private static void createRYHigherMapSS() private static void createRYHigherMapSS() {
{
ryHigherMapSS = new HashMap<String, Boolean>(); ryHigherMapSS = new HashMap<String, Boolean>();
/* /*
* SafeSeas Display * SafeSeas Display
*/ */
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WIND_SPEED.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_GUST_SPEED.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_SCA_WIND_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_PEAK_WIND.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WAVE_HT.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_SCA_GUST_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_WIND_SPEED.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_GUST_SPEED.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_SCA_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_PEAK_WIND.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WAVE_HT.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_STORM_WIND_SPEED.getXmlKey(), true); true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_STORM_GUST_SPEED.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_STORM_PEAK_WIND.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_GALE_WIND_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_HFWW_WIND_SPEED.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_HFWW_GUST_SPEED.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_GALE_GUST_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_HFWW_PEAK_WIND.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED.getXmlKey(), true); SafeSeasDisplay.SS_DISP_PROD_GALE_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND.getXmlKey(), true); ryHigherMapSS
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_GUST_SPEED.getXmlKey(), true); .put(SafeSeasDisplay.SS_DISP_PROD_STORM_WIND_SPEED.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_DIR_FROM.getXmlKey(), null); true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_DIR_TO.getXmlKey(), null); ryHigherMapSS
.put(SafeSeasDisplay.SS_DISP_PROD_STORM_GUST_SPEED.getXmlKey(),
true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_STORM_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_HFWW_WIND_SPEED.getXmlKey(), true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_HFWW_GUST_SPEED.getXmlKey(), true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_HFWW_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_GUST_SPEED.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_WIND_DIR_FROM.getXmlKey(),
null);
ryHigherMapSS
.put(SafeSeasDisplay.SS_DISP_WIND_DIR_TO.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_VIS.getXmlKey(), false); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_VIS.getXmlKey(), false);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_TEMP.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_TEMP.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_DEWPT.getXmlKey(), true); ryHigherMapSS
.put(SafeSeasDisplay.SS_DISP_METEO_DEWPT.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_SLP.getXmlKey(), false); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_SLP.getXmlKey(), false);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_SST.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_SST.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey(), true); true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(), rankSwellPeriodHigh); true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM.getXmlKey(), null); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_TO.getXmlKey(), null); true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_HT.getXmlKey(), true); ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(),
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(), rankSwellPeriodHigh); rankSwellPeriodHigh);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM.getXmlKey(), null); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_TO.getXmlKey(), null); SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM.getXmlKey(), null);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_TO.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_HT.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(),
rankSwellPeriodHigh);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_TO.getXmlKey(),
null);
/* /*
* SafeSeas Monitor // TODO * SafeSeas Monitor
*/ */
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey(), true); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_WIND_SPEED.getXmlKey(),
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey(), true); true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey(), true); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey(),
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey(), true); true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_GUST_SPEED.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_WAVE_HT.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey(), false); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_VIS.getXmlKey(), false);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey(), true); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey(),
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey(), false); true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey(), null); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey(),
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey(), null); false);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey(), true); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey(), false); SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey(), null); ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey(),
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey(), null); null);
ryHigherMapSS
.put(SafeSeasMonitor.SS_MON_SWELL_SEC_HT.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_PD.getXmlKey(),
false);
ryHigherMapSS.put(
SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_FROM.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_SEC_DIR_TO.getXmlKey(),
null);
} }
private static void createRYHigherMapSnow() private static void createRYHigherMapSnow() {
{ ryHigherMapSnow = new HashMap<String, Boolean>();
ryHigherMapSnow = new HashMap<String, Boolean>();
/* /*
* Snow Display * Snow Display
*/ */
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_VIS.getXmlKey(), false); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_VIS.getXmlKey(),
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), true); false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), true); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), true); SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_TEMP.getXmlKey(), true); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_HOURLY_PRECIP.getXmlKey(), true); SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_HOURLY.getXmlKey(), true); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_TOTAL.getXmlKey(), true); SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_HSW_SNOW_DEPTH.getXmlKey(), true); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_TEMP.getXmlKey(),
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_WIND_SPEED.getXmlKey(), true); true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_PEAK_WIND.getXmlKey(), true); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_GUST_SPEED.getXmlKey(), true); SnowDisplay.SNOW_DISP_PROD_FRZ_HOURLY_PRECIP.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_DIR_FROM.getXmlKey(), null); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_DIR_TO.getXmlKey(), null); SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_HOURLY.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey(), false); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey(), false); SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_TOTAL.getXmlKey(), true);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_PROD_HSW_SNOW_DEPTH.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_WIND_SPEED.getXmlKey(),
true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_PEAK_WIND.getXmlKey(),
true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_GUST_SPEED.getXmlKey(),
true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_WIND_DIR_FROM.getXmlKey(),
null);
ryHigherMapSnow
.put(SnowDisplay.SNOW_DISP_WIND_DIR_TO.getXmlKey(), null);
ryHigherMapSnow
.put(SnowDisplay.SNOW_DISP_METEO_TEMP.getXmlKey(), false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_DEWPT.getXmlKey(),
false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey(), false); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_VIS.getXmlKey(), false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey(), false); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SLP.getXmlKey(), false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey(), true); ryHigherMapSnow.put(
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey(), false); SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey(), false); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey(),
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey(), true); false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey(), true); ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey(),
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey(), true); false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH.getXmlKey(),
true);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_METEO_SNINCR_HOURLY.getXmlKey(), true);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_METEO_SNINCR_TOTAL.getXmlKey(), true);
/* /*
* Snow Monitor * Snow Monitor
*/ */
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_WIND_SPEED.getXmlKey(), true); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_WIND_SPEED.getXmlKey(),
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_PEAK_WIND.getXmlKey(), true); true);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_GUST_SPEED.getXmlKey(), true); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_PEAK_WIND.getXmlKey(),
true);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_GUST_SPEED.getXmlKey(),
true);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_TEMP.getXmlKey(), false); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_TEMP.getXmlKey(), false);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_WIND_CHILL.getXmlKey(), false); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_WIND_CHILL.getXmlKey(),
false);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_VIS.getXmlKey(), false); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_VIS.getXmlKey(), false);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_SNOW_DEPTH.getXmlKey(), true); ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_SNOW_DEPTH.getXmlKey(),
true);
} }
private static void createRYHigherMapFog() private static void createRYHigherMapFog() {
{ ryHigherMapFog = new HashMap<String, Boolean>();
ryHigherMapFog = new HashMap<String, Boolean>();
/* /*
* Fog Display * Fog Display
*/ */
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_VIS.getXmlKey(), false); ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_VIS.getXmlKey(), false);
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_CEILING.getXmlKey(), false); ryHigherMapFog
.put(FogDisplay.FOG_DISP_METEO_CEILING.getXmlKey(), false);
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey(), true); ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_TEMP.getXmlKey(), true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_DEWPT.getXmlKey(), true); ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_DEWPT.getXmlKey(), true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_T_TD.getXmlKey(), false); ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_T_TD.getXmlKey(), false);
ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_REL_HUMIDITY.getXmlKey(), true); ryHigherMapFog.put(FogDisplay.FOG_DISP_METEO_REL_HUMIDITY.getXmlKey(),
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_WIND_SPEED.getXmlKey(), true); true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_PEAK_WIND.getXmlKey(), true); ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_WIND_SPEED.getXmlKey(),
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_GUST_SPEED.getXmlKey(), true); true);
ryHigherMapFog
.put(FogDisplay.FOG_DISP_WIND_PEAK_WIND.getXmlKey(), true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_GUST_SPEED.getXmlKey(),
true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_DIR_FROM.getXmlKey(), null); ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_DIR_FROM.getXmlKey(), null);
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_DIR_TO.getXmlKey(), null); ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_DIR_TO.getXmlKey(), null);
/* /*
* Fog Monitor * Fog Monitor
*/ */
ryHigherMapFog.put(FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey(), false); ryHigherMapFog.put(FogMonitor.FOG_MONITOR_METEO_VIS.getXmlKey(), false);
} }
// FOG Parameters
// public static final String FOG_IR_MIN = "fog.ir.min";
// public static final String FOG_IR_DELTA_YELLOW_LOW = "fog.ir.delta.yellow.low";
// public static final String FOG_IR_DELTA_YELLOW_HIGH = "fog.ir.delta.yellow.high";
// public static final String FOG_IR_DELTA_RED_LOW = "fog.ir.delta.red.low";
// public static final String FOG_IR_DELTA_RED_HIGH = "fog.ir.delta.red.high";
// public static final String FOG_IR_MAX = "fog.ir.max";
// public static final String FOG_IR_ICE_SNOW = "fog.ir.ice_snow_threshold";
// public static final String FOG_IR_CLOUD = "fog.ir.cloud_threshold";
// public static final String FOG_IR_CLOUD_FREE = "fog.ir.cloud_free_threshold";
// public static final String FOG_VIS_MIN = "fog.vis.min";
// public static final String FOG_VIS_YELLOW_LOW = "fog.vis.yellow.low";
// public static final String FOG_VIS_YELLOW_HIGH = "fog.vis.yellow.high";
// public static final String FOG_VIS_RED_LOW = "fog.vis.red.low";
// public static final String FOG_VIS_RED_HIGH = "fog.vis.red.high";
// public static final String FOG_VIS_MAX = "fog.vis.max";
// public static final String FOG_VIS_SMOOTHNESS = "fog.vis.smoothness_threshold";
// public static final String FOG_VIS_TWILIGHT_ANG = "fog.vis.twilight_threshold";
// public static final String FOG_VIS_FRACTAL_DIM = "fog.vis.fractal_dim_threshold";
// public static final String FOG_SCALE_STATE = "fog.scale_state";
// public static final String FOG_ICE_SNOW = "fog.ice_snow";
// public static final String FOG_CLOUD = "fog.cloud";
// public static final String FOG_CLOUD_FREE = "fog.cloud_free";
// public static final String FOG_SMOOTHNESS = "fog.smoothness";
// public static final String FOG_ADJACENCY = "fog.adjacency";
// public static final String FOG_ADJACENCY_THRESH = "fog.adjacency_threshold";
// public static final String FOG_TWILIGHT_ANG = "fog.twilight_ang";
// public static final String FOG_FRACTAL_DIM = "fog.fractal_dim";
//
// public static enum FogParameters {
// FOG_IR_MIN(MonitorConfigConstants.FOG_IR_MIN),
// FOG_IR_DELTA_YELLOW_LOW(MonitorConfigConstants.FOG_IR_DELTA_YELLOW_LOW),
// FOG_IR_DELTA_YELLOW_HIGH(MonitorConfigConstants.FOG_IR_DELTA_YELLOW_HIGH),
// FOG_IR_DELTA_RED_LOW(MonitorConfigConstants.FOG_IR_DELTA_RED_LOW),
// FOG_IR_DELTA_RED_HIGH(MonitorConfigConstants.FOG_IR_DELTA_RED_HIGH),
// FOG_IR_MAX(MonitorConfigConstants.FOG_IR_MAX),
// FOG_IR_ICE_SNOW(MonitorConfigConstants.FOG_IR_ICE_SNOW),
// FOG_IR_CLOUD(MonitorConfigConstants.FOG_IR_CLOUD),
// FOG_IR_CLOUD_FREE(MonitorConfigConstants.FOG_IR_CLOUD_FREE),
// FOG_VIS_MIN(MonitorConfigConstants.FOG_VIS_MIN),
// FOG_VIS_YELLOW_LOW(MonitorConfigConstants.FOG_VIS_YELLOW_LOW),
// FOG_VIS_YELLOW_HIGH(MonitorConfigConstants.FOG_VIS_YELLOW_HIGH),
// FOG_VIS_RED_LOW(MonitorConfigConstants.FOG_VIS_RED_LOW),
// FOG_VIS_RED_HIGH(MonitorConfigConstants.FOG_VIS_RED_HIGH),
// FOG_VIS_MAX(MonitorConfigConstants.FOG_VIS_MAX),
// FOG_VIS_SMOOTHNESS(MonitorConfigConstants.FOG_VIS_SMOOTHNESS),
// FOG_VIS_TWILIGHT_ANG(MonitorConfigConstants.FOG_VIS_TWILIGHT_ANG),
// FOG_VIS_FRACTAL_DIM(MonitorConfigConstants.FOG_VIS_FRACTAL_DIM),
// FOG_SCALE_STATE(MonitorConfigConstants.FOG_SCALE_STATE),
// FOG_ICE_SNOW(MonitorConfigConstants.FOG_ICE_SNOW),
// FOG_CLOUD(MonitorConfigConstants.FOG_CLOUD),
// FOG_CLOUD_FREE(MonitorConfigConstants.FOG_CLOUD_FREE),
// FOG_SMOOTHNESS(MonitorConfigConstants.FOG_SMOOTHNESS),
// FOG_ADJACENCY(MonitorConfigConstants.FOG_ADJACENCY),
// FOG_ADJACENCY_THRESH(MonitorConfigConstants.FOG_ADJACENCY_THRESH),
// FOG_TWILIGHT_ANG(MonitorConfigConstants.FOG_TWILIGHT_ANG),
// FOG_FRACTAL_DIM(MonitorConfigConstants.FOG_FRACTAL_DIM);
//
// String XMLKey;
//
// FogParameters(String s) {
// XMLKey = s;
// }
//
// @Override
// public String toString() {
// return XMLKey;
// }
// }
// SCAN
// public static final String SCAN_PLUGIN_NAME = "pluginName";
// public static final String SCAN_STATION_NAME = "stationName";
// public static final String SCAN_CELL_TABLE_ATTRIB = "cellTableAttributes";
// public static final String SCAN_MESO_TABLE_ATTRIB = "mesoTableAttributes";
// public static final String SCAN_TVS_TABLE_ATTRIB = "tvsTableAttributes";
//
// public static final String[] CELL_TABLE = { "cellTable", "time", "radar",
// "ident", "azm", "rng", "rank", "tvs", "mdaSR", "posh", "poh", "hsize",
// "vil", "dbz", "dbzHt", "top", "dir", "spd", "azm15", "rng15", "azm30",
// "rng30", "azm45", "rng45", "azm60", "rng60", "mvtErr", "mvtMn", "lat",
// "lon", "polh", "svrwx", "hvyPr", "pPos", "cgRate", "vcp", "cape",
// "sreh", "county" };
//
// public static final String[] MESO_TABLE = { "mesoTable", "time", "radar",
// "strmID","ident", "azm", "rng", "mdaSR", "class", "llVr", "llgtg",
// "base", "depth", "relDep", "maxVr", "htMxVr", "tvs", "dir", "spd",
// "msi","lat", "lon", "county" };
//
// public static final String[] TVS_TABLE = { "tvsTable", "time", "radar",
// "strmID", "ident", "type", "azm", "rng", "avgDv", "llDv", "maxDv",
// "mxDvHt", "base", "depth", "top", "shear", "shrHt", "lat", "lon", "county" };
//
public static final String[] TABLE_FIELDS = { "low", "mid", "upp", "rank", public static final String[] TABLE_FIELDS = { "low", "mid", "upp", "rank",
"trend", "mClr", "clucon", "inTbl", "min", "intrvl", "range", "alarm", "trend", "mClr", "clucon", "inTbl", "min", "intrvl", "range",
"aAlarm", "units" }; "alarm", "aAlarm", "units" };
public static final String[] FFMP_TABLE = { "ffmpTable", "name", "rate", public static final String[] FFMP_TABLE = { "ffmpTable", "name", "rate",
"qpe", "guidance", "ratio", "diff" }; "qpe", "guidance", "ratio", "diff" };
//
// public static enum ScanTables {
// CELL, MESO, TVS;
// }
//
// public static enum cellTable {
// TIME(1), RADAR(2), IDENT(3), AZM(4), RNG(5), RANK(6), TVS(7), MDASR(8),
// POSH(9), POH(10), HSIZE(11), VIL(12), DBZ(13), DBZHT(14), TOP(15), DIR(16),
// SPD(17), AZM15(18), RNG15(19), AZM30(20), RNG30(21), AZM45(22), RNG45(23),
// AZM60(24), RNG60(25), MVTERR(26), MVTMN(27), LAT(28), LON(29), POLH(30),
// SVRWX(31), HVYPR(32), PPOS(33), CGRATE(34), VCP(35), CAPE(36), SREH(37),
// COUNTY(38);
//
// int index;
//
// cellTable(int i) {
// index = i;
// }
//
// @Override
// public String toString() {
// return CELL_TABLE[index];
// }
//
// public String toString(tableFields field) {
// return CELL_TABLE[0] + "." + CELL_TABLE[index] + "." + field.toString();
// }
// }
//
// public static enum mesoTable {
// TIME(1), RADAR(2), STRMID(3), IDENT(4), AZM(5), RNG(6), MDASR(7), CLASS(8),
// LLVR(9), LLGTG(10), BASE(11), DEPTH(12), RELDEP(13), MAXVR(14), HTMXVR(15),
// TVS(16), DIR(18), SPD(19), MSI(20), LAT(21), LON(22), COUNTY(23);
//
// int index;
//
// mesoTable(int i) {
// index = i;
// }
//
// @Override
// public String toString() {
// return MESO_TABLE[index];
// }
//
// public String toString(tableFields t) {
// return MESO_TABLE[0] + "." + MESO_TABLE[index] + "." + t.toString();
// }
// }
//
// public static enum tvsTable {
// TIME(1), RADAR(2), STRMID(3), IDENT(4), TYPE(5), AM(6), RNG(7), AVGDV(8),
// LLDV(9), MAXDV(10), MXDVHT(11), BASE(12), DEPTH(13), TOP(14), SHEAR(15),
// SHRHT(16), LAT(17), LON(18), COUNTY(19);
//
// int index;
//
// tvsTable(int i) {
// index = i;
// }
//
// @Override
// public String toString() {
// return TVS_TABLE[index];
// }
//
// public String toString(tableFields t) {
// return TVS_TABLE[0] + "." + TVS_TABLE[index] + "." + t.toString();
// }
// }
//
public static enum tableFields { public static enum tableFields {
LOW(0), MID(1), UPP(2), RANK(3), TREND(4), MCLR(5), CLUCON(6), INTBL(7), LOW(0), MID(1), UPP(2), RANK(3), TREND(4), MCLR(5), CLUCON(6), INTBL(7), MIN(
MIN(8), INTRVL(9), RANGE(10), ALARM(11), AALARM(12), UNITS(13); 8), INTRVL(9), RANGE(10), ALARM(11), AALARM(12), UNITS(13);
int index; int index;
@ -568,8 +475,7 @@ public class MonitorConfigConstants
return TABLE_FIELDS[index]; return TABLE_FIELDS[index];
} }
} }
public static enum ffmpTable { public static enum ffmpTable {
NAME(1), RATE(2), QPE(3), QPF(4), GUIDANCE(5), RATIO(6), DIFF(7); NAME(1), RATE(2), QPE(3), QPF(4), GUIDANCE(5), RATIO(6), DIFF(7);
@ -585,12 +491,11 @@ public class MonitorConfigConstants
} }
public String toString(tableFields field) { public String toString(tableFields field) {
return FFMP_TABLE[0] + "." + FFMP_TABLE[index] + "." + field.toString(); return FFMP_TABLE[0] + "." + FFMP_TABLE[index] + "."
+ field.toString();
} }
} }
// Other Constants // Other Constants
public static final String AREA_IDS_KEY = "AreaIDs."; public static final String AREA_IDS_KEY = "AreaIDs.";
@ -603,30 +508,33 @@ public class MonitorConfigConstants
public static final String STATIONS_KEY = "Stations"; public static final String STATIONS_KEY = "Stations";
public static final String COLUMN_LIST_KEY = "ColumnList"; public static final String COLUMN_LIST_KEY = "ColumnList";
public static final String SCAN_RADAR_ICAO = "radarIcao"; public static final String SCAN_RADAR_ICAO = "radarIcao";
public static final String SCAN_WMO_NUMBER = "wmoNumber"; public static final String SCAN_WMO_NUMBER = "wmoNumber";
public static final String SCAN_START_INTERVAL = "startInterval"; public static final String SCAN_START_INTERVAL = "startInterval";
public static final String SCAN_CELL_TILT = "cellTilt"; public static final String SCAN_CELL_TILT = "cellTilt";
public static final String SCAN_DMD_TILT = "dmdTilt"; public static final String SCAN_DMD_TILT = "dmdTilt";
private MonitorConfigConstants() { private MonitorConfigConstants() {
// no instantiation // no instantiation
} }
public static void setRankSwellPeriodHigh(boolean rankSwellPeriodHigh) { public static void setRankSwellPeriodHigh(boolean rankSwellPeriodHigh) {
MonitorConfigConstants.rankSwellPeriodHigh = rankSwellPeriodHigh; MonitorConfigConstants.rankSwellPeriodHigh = rankSwellPeriodHigh;
if ( ryHigherMapSS != null ) { if (ryHigherMapSS != null) {
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(), rankSwellPeriodHigh); ryHigherMapSS.put(
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(), rankSwellPeriodHigh); SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(),
} rankSwellPeriodHigh);
} ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(),
rankSwellPeriodHigh);
}
}
public static boolean isRankSwellPeriodHigh() { public static boolean isRankSwellPeriodHigh() {
return rankSwellPeriodHigh; return rankSwellPeriodHigh;
} }
} }

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.viz.radarapps.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1 @@
bin.includes = feature.xml

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.raytheon.uf.viz.radarapps.feature"
label="Radar Apps Feature"
version="1.0.0.qualifier"
provider-name="RAYTHEON">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
</license>
<plugin
id="com.raytheon.rcm.lib"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.radarapps.config"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.radarapps.fsi"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.viz.radarapps.requests"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.radarapps.rps"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.radarapps.core"
download-size="0"
install-size="0"
version="0.0.0"/>
</feature>

View file

@ -22,6 +22,9 @@ package com.raytheon.uf.viz.radarapps.requests;
import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import com.raytheon.rcm.config.RcmResourceProvider;
import com.raytheon.uf.viz.radarapps.core.LocalizationRcmResourceProvider;
/** /**
* The activator class controls the plug-in life cycle * The activator class controls the plug-in life cycle
*/ */
@ -39,14 +42,12 @@ public class Activator extends AbstractUIPlugin {
public Activator() { public Activator() {
} }
/* @Override
* (non-Javadoc) public void start(BundleContext context) throws Exception {
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) super.start(context);
*/ plugin = this;
public void start(BundleContext context) throws Exception { RcmResourceProvider.setInstance(new LocalizationRcmResourceProvider());
super.start(context); }
plugin = this;
}
/* /*
* (non-Javadoc) * (non-Javadoc)

View file

@ -22,6 +22,9 @@ package com.raytheon.uf.viz.radarapps.rps;
import org.eclipse.ui.plugin.AbstractUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
import com.raytheon.rcm.config.RcmResourceProvider;
import com.raytheon.uf.viz.radarapps.core.LocalizationRcmResourceProvider;
/** /**
* The activator class controls the plug-in life cycle * The activator class controls the plug-in life cycle
*/ */
@ -39,14 +42,12 @@ public class Activator extends AbstractUIPlugin {
public Activator() { public Activator() {
} }
/* @Override
* (non-Javadoc) public void start(BundleContext context) throws Exception {
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) super.start(context);
*/ plugin = this;
public void start(BundleContext context) throws Exception { RcmResourceProvider.setInstance(new LocalizationRcmResourceProvider());
super.start(context); }
plugin = this;
}
/* /*
* (non-Javadoc) * (non-Javadoc)

View file

@ -40,7 +40,8 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 8, 2011 mschenke Initial creation * Nov 8, 2011 mschenke Initial creation
* Oct 08, 2015 4891 njensen Added tooltips
* *
* </pre> * </pre>
* *
@ -60,7 +61,7 @@ public class ThinClientCachePreferences extends FieldEditorPreferencePage {
super(GRID); super(GRID);
setPreferenceStore(Activator.getDefault().getPreferenceStore()); setPreferenceStore(Activator.getDefault().getPreferenceStore());
setTitle("Thin Client Caches"); setTitle("Thin Client Caches");
setDescription("Specify Thin Client Cache settings"); setDescription("Settings to reduce bandwidth usage by saving data locally");
} }
/* /*
@ -87,28 +88,41 @@ public class ThinClientCachePreferences extends FieldEditorPreferencePage {
getFieldEditorParent())); getFieldEditorParent()));
// Add caching options // Add caching options
// pypies
addField(new BooleanFieldEditor(
ThinClientPreferenceConstants.P_CACHE_WEATHER,
"Cache &Weather Data", getFieldEditorParent()));
// localization files
// data retrieved directly from pypies
BooleanFieldEditor cacheWx = new BooleanFieldEditor(
ThinClientPreferenceConstants.P_CACHE_WEATHER,
"Cache &Weather Data", getFieldEditorParent());
cacheWx.getDescriptionControl(getFieldEditorParent()).setToolTipText(
"Save data for swapping and multiple panes");
addField(cacheWx);
// localization files
cacheLocalization = new BooleanFieldEditor( cacheLocalization = new BooleanFieldEditor(
ThinClientPreferenceConstants.P_CACHE_LOCALIZATION, ThinClientPreferenceConstants.P_CACHE_LOCALIZATION,
"Cache &Localization Files", getFieldEditorParent()); "Cache &Localization Files", getFieldEditorParent());
cacheLocalization
.getDescriptionControl(getFieldEditorParent())
.setToolTipText(
"Only download missing localization files (not updated files)");
addField(cacheLocalization); addField(cacheLocalization);
// avoid the server for localization
disableRemoteLocalization = new SyncLocalizationEditor( disableRemoteLocalization = new SyncLocalizationEditor(
ThinClientPreferenceConstants.P_DISABLE_REMOTE_LOCALIZATION, ThinClientPreferenceConstants.P_DISABLE_REMOTE_LOCALIZATION,
"Use &Only Cached Localization Files", getFieldEditorParent()); "Use &Only Cached Localization Files", getFieldEditorParent());
disableRemoteLocalization.getDescriptionControl(getFieldEditorParent())
.setToolTipText(
"Only use previously downloaded localization files");
addField(disableRemoteLocalization); addField(disableRemoteLocalization);
// map data // map data
addField(new BooleanFieldEditor( BooleanFieldEditor cacheMaps = new BooleanFieldEditor(
ThinClientPreferenceConstants.P_CACHE_MAPS, "Cache &Map Data", ThinClientPreferenceConstants.P_CACHE_MAPS, "Cache &Map Data",
getFieldEditorParent())); getFieldEditorParent());
cacheMaps.getDescriptionControl(getFieldEditorParent()).setToolTipText(
"Cache map data such as state/county boundaries");
addField(cacheMaps);
} }

View file

@ -54,6 +54,7 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking. * Aug 02, 2013 2202 bsteffen Add edex specific connectivity checking.
* Feb 04, 2014 2704 njensen Only one field for proxy server * Feb 04, 2014 2704 njensen Only one field for proxy server
* Jun 26, 2014 3236 njensen Proxy server can now be text or combo field * Jun 26, 2014 3236 njensen Proxy server can now be text or combo field
* Oct 08, 2015 4891 njensen Added tooltip to useProxies
* *
* </pre> * </pre>
* *
@ -90,8 +91,12 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
useProxies = new BooleanFieldEditor( useProxies = new BooleanFieldEditor(
ThinClientPreferenceConstants.P_USE_PROXIES, ThinClientPreferenceConstants.P_USE_PROXIES,
"&Use Proxy Servers", getFieldEditorParent()); "&Use Proxy Servers", getFieldEditorParent());
useProxies
.getDescriptionControl(getFieldEditorParent())
.setToolTipText(
"Connect to a remote proxy server configured to support thin clients");
addField(useProxies); addField(useProxies);
proxyServer = new TextOrComboEditor(getFieldEditorParent(), proxyServer = new TextOrComboEditor(getFieldEditorParent(),
this.getPreferenceStore(), this.getPreferenceStore(),
ThinClientPreferenceConstants.P_PROXY_ADDRESS, ThinClientPreferenceConstants.P_PROXY_ADDRESS,
@ -104,7 +109,7 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
} }
}); });
proxyServer.setErrorMessage("Cannot connect to Proxy server"); proxyServer.setErrorMessage("Cannot connect to proxy server");
addField(proxyServer); addField(proxyServer);
addConnectivityButton(); addConnectivityButton();

View file

@ -36,7 +36,8 @@ import com.raytheon.uf.viz.thinclient.Activator;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 21, 2011 mschenke Initial creation * Oct 21, 2011 mschenke Initial creation
* Oct 08, 2015 4891 njensen Default data update interval to 5
* *
* </pre> * </pre>
* *
@ -46,12 +47,6 @@ import com.raytheon.uf.viz.thinclient.Activator;
public class PreferenceInitializer extends AbstractPreferenceInitializer { public class PreferenceInitializer extends AbstractPreferenceInitializer {
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
* initializeDefaultPreferences()
*/
@Override @Override
public void initializeDefaultPreferences() { public void initializeDefaultPreferences() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore(); IPreferenceStore store = Activator.getDefault().getPreferenceStore();
@ -82,7 +77,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
// Default data refresh rate // Default data refresh rate
store.setDefault(ThinClientPreferenceConstants.P_DATA_REFRESH_INTERVAL, store.setDefault(ThinClientPreferenceConstants.P_DATA_REFRESH_INTERVAL,
30); 5);
// By default, no proxy used // By default, no proxy used
store.setDefault(ThinClientPreferenceConstants.P_USE_PROXIES, false); store.setDefault(ThinClientPreferenceConstants.P_USE_PROXIES, false);

View file

@ -68,6 +68,7 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
* but dialog doesn't realize it * but dialog doesn't realize it
* Jun 03, 2014 3217 bsteffen Add option to always open startup dialog. * Jun 03, 2014 3217 bsteffen Add option to always open startup dialog.
* Jun 24, 2014 3236 njensen Add ability to remember multiple servers * Jun 24, 2014 3236 njensen Add ability to remember multiple servers
* Oct 08, 2015 4891 njensen Added tooltip to useProxyCheck
* *
* *
* *
@ -185,6 +186,8 @@ public class ThinClientConnectivityDialog extends ConnectivityPreferenceDialog {
updateProxyEnabled(); updateProxyEnabled();
} }
}); });
useProxyCheck
.setToolTipText("Connect to a remote proxy server configured to support thin clients");
IPreferenceStore thinPrefs = Activator.getDefault() IPreferenceStore thinPrefs = Activator.getDefault()
.getPreferenceStore(); .getPreferenceStore();

View file

@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.core, com.raytheon.uf.viz.core,
com.raytheon.viz.ui;bundle-version="1.11.9", com.raytheon.viz.ui;bundle-version="1.11.9",
org.geotools, org.geotools,
org.apache.commons.lang;bundle-version="2.3.0" org.apache.commons.lang;bundle-version="2.3.0",
com.raytheon.viz.pointdata;bundle-version="1.15.0"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.raytheon.uf.common.dataplugin.persist, Import-Package: com.raytheon.uf.common.dataplugin.persist,

View file

@ -60,6 +60,10 @@
<includes <includes
id="com.raytheon.viz.radar.feature" id="com.raytheon.viz.radar.feature"
version="0.0.0"/> version="0.0.0"/>
<includes
id="com.raytheon.uf.viz.radarapps.feature"
version="0.0.0"/>
<includes <includes
id="com.raytheon.viz.text.feature" id="com.raytheon.viz.text.feature"

View file

@ -30,15 +30,16 @@
# SOFTWARE HISTORY # SOFTWARE HISTORY
# Date Ticket# Engineer Description # Date Ticket# Engineer Description
# ------------ ---------- ----------- -------------------------- # ------------ ---------- ----------- --------------------------
# Jan 13, 2015 #3955 randerso Copied from EditTopo GFE config file and updated # 01/13/2015 #3955 randerso Copied from EditTopo GFE config file and updated
# 10/13/2015 #4961 randerso Renamed parameters from Terrain to Topo
# #
# Author: romberg # Author: romberg
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# This special GFE configuration file is for modifying the topo # This special GFE configuration file is for modifying the NewTopo
# grid that is stored on the ifpServer. Starting the GFE # grid that is stored on the ifpServer. Starting the GFE
# with this configuration file should bring up a special GFE with # with this configuration file should bring up a special GFE with
# just the Topo parameter. # just the Topo parameters
# Include this line to override gfeConfig (BASE configuration): # Include this line to override gfeConfig (BASE configuration):
from gfeConfig import * from gfeConfig import *
@ -48,7 +49,7 @@ HideConfigFile = 1
DefaultGroup = "NewTerrain" DefaultGroup = "NewTerrain"
mutableModel = "EditTopo_Topo" mutableModel = "EditTopo_NewTerrain"
dbTypes = ["EditTopo", ""] dbTypes = ["EditTopo", ""]
@ -56,8 +57,11 @@ dbTypes = ["EditTopo", ""]
# fact that these grids have a 1 second resolution # fact that these grids have a 1 second resolution
SplitBoundaryDisplay = no SplitBoundaryDisplay = no
GMTED_fitToDataColorTable = "All Grids"
GTOPO_fitToDataColorTable = "All Grids"
NewTopo_fitToDataColorTable = "All Grids"
Topo_fitToDataColorTable = "All Grids" Topo_fitToDataColorTable = "All Grids"
NewTerrain_fitToDataColorTable = "All Grids"
OldTerrain_fitToDataColorTable = "All Grids" GridManagerSortOrder = ['NewTopo', 'Topo', 'GMTED', 'GTOPO']
GM_TE_Layout = "OnLeft" GM_TE_Layout = "OnLeft"

View file

@ -0,0 +1,86 @@
# ----------------------------------------------------------------------------
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
#
# CopyFromNewTopo.py
#
# Creates a backup copy of the current GFE Topo in PrevTopo
# and then replaces the GFE Topo with the NewTopo
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 10/13/2015 #4961 randerso Initial creation
#
# Author: randerso
# ----------------------------------------------------------------------------
MenuItems = ["Edit"]
VariableList = []
import SmartScript
import TimeRange
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
class Procedure (SmartScript.SmartScript):
def __init__(self, dbss):
SmartScript.SmartScript.__init__(self, dbss)
def execute(self, timeRange):
mutableID = self.mutableID()
topoDbId = self.findDatabase("EditTopo_Topo")
if mutableID != topoDbId:
DisplayMessageDialog.openError("Invalid Mutable Database",
"You must be using the EditTopo GFE configuration to run this procedure.\n"
"Please restart CAVE and select the EditTopo GFE configuration.")
return
# check for existence of NewTopo grid
newTerrainDbId = self.findDatabase("EditTopo_NewTerrain")
newTopoParm = self.getParm(newTerrainDbId, "NewTopo", "SFC")
inventory = newTopoParm.getGridInventory()
if len(inventory) == 0:
DisplayMessage.openError("No NewTopo grid exists!",
"You must initialize and edit the NewTopo grid as desired.\n"
"You should run this procedure only when your edits are final.")
return
doIt = DisplayMessageDialog.openQuestion("WARNING!",
"You are about to replace your GFE Topo data with the NewTopo data.\n"
"You should only do this after you have completed all edits and have\n"
"resolved any border differences with your neighboring sites.\n\n"
"Do you wish to continue?")
if not doIt:
return;
baseTerrainDbId = self.findDatabase("EditTopo_BaseTerrain")
prevTopoParm = self.getParm(baseTerrainDbId, "PrevTopo", "SFC")
inventory = prevTopoParm.getGridInventory()
doIt = True
if len(inventory) > 0:
doIt = DisplayMessageDialog.openQuestion("WARNING PrevTopo exists!",
"It appears that you have previously run CopyFromNewTopo and a\n"
"backup copy of your original GFE Topo grid already exists.\n\n"
"Do you want to overwrite the backup copy with your current GFE Topo grid?")
if doIt:
# Save the current Topo grid to PrevTopo
topo = self.getGrids(topoDbId, "Topo", "SFC", timeRange, mode="First")
prevTopoParm.setMutable(True)
self.createGrid(baseTerrainDbId, "PrevTopo", "SCALAR", topo, TimeRange.allTimes())
prevTopoParm.saveParameter(True)
prevTopoParm.setMutable(False)
# Copy the NewTopo data to Topo
newTopo = self.getGrids(newTerrainDbId, "NewTopo", "SFC", timeRange, mode="First")
topoParm = self.getParm(topoDbId, "Topo", "SFC")
self.createGrid(topoDbId, "Topo", "SCALAR", newTopo, TimeRange.allTimes())
topoParm.saveParameter(True)
DisplayMessageDialog.openInformation("Topo Successfully Updated!",
"To revert to the previous version, run the RevertTopo procedure.")

View file

@ -1,62 +0,0 @@
# ----------------------------------------------------------------------------
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
#
# DiffNewTerrain.py
#
# Creates temporary elements newTerrainDiff and oldTerrainDiff by subtracting the
# GFE Topo grid from the NewTerrain and OldTerrain elements respectively.
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Jan 13, 2015 #3955 randerso Initial creation
#
# Author: randerso
# ----------------------------------------------------------------------------
MenuItems = ["Edit"]
VariableList = []
import SmartScript
import TimeRange
import numpy
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
class Procedure (SmartScript.SmartScript):
def __init__(self, dbss):
SmartScript.SmartScript.__init__(self, dbss)
def execute(self, editArea, timeRange, varDict):
mutableID = self.mutableID()
topoDbId = self.findDatabase("EditTopo_Topo")
if mutableID != topoDbId:
DisplayMessageDialog.openError("Invalid Mutable Database", "You must be using the NewTerrain GFE configuration to run this procedure.\nPlease restart CAVE and select the NewTerrain GFE configuraion")
return
newTerrainDbId = self.findDatabase("EditTopo_NewTerrain")
newTerrain = self.getGrids(newTerrainDbId, "NewTerrain", "SFC", timeRange, mode="First")
oldTerrain = self.getGrids(newTerrainDbId, "OldTerrain", "SFC", timeRange, mode="First")
topoDbId = self.findDatabase("EditTopo_Topo")
topo = self.getGrids(topoDbId, "Topo", "SFC", timeRange, mode="First")
self.unloadWEs(newTerrainDbId, [("newTerrainDiff", "SFC"),("oldTerrainDiff", "SFC")])
delta = topo - newTerrain
maxVal = numpy.nanmax(delta)
minVal = numpy.nanmin(delta)
maxDelta = max(abs(maxVal), abs(minVal))
self.createGrid(newTerrainDbId, "newTerrainDiff", "SCALAR", delta, TimeRange.allTimes(),
"NewTerrain - Topo", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")
delta = topo - oldTerrain
maxVal = numpy.nanmax(delta)
minVal = numpy.nanmin(delta)
maxDelta = max(1.0, abs(maxVal), abs(minVal))
self.createGrid(newTerrainDbId, "oldTerrainDiff", "SCALAR", delta, TimeRange.allTimes(),
"OldTerrain - Topo", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")

View file

@ -0,0 +1,86 @@
# ----------------------------------------------------------------------------
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
#
# DiffNewTopo.py
#
# Creates the following temporary difference elements:
# newTopoMinusTopo = NewTopo - Topo
# GMTEDminusGTOPO = GMTED - GTOPO
# newEdits = NewTopo - GMTED
# currentEdits = Topo - GTOPO
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 10/13/2015 #4961 randerso Initial creation
#
# Author: randerso
# ----------------------------------------------------------------------------
MenuItems = ["Edit"]
VariableList = []
import SmartScript
import TimeRange
import numpy
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
class Procedure (SmartScript.SmartScript):
def __init__(self, dbss):
SmartScript.SmartScript.__init__(self, dbss)
def execute(self, timeRange):
mutableID = self.mutableID()
newTerrainDbId = self.findDatabase("EditTopo_NewTerrain")
if mutableID != newTerrainDbId:
DisplayMessageDialog.openError("Invalid Mutable Database",
"You must be using the NewTerrain GFE configuration to run this procedure.\n"
"Please restart CAVE and select the NewTerrain GFE configuration.")
return
newTopo = self.getGrids(newTerrainDbId, "NewTopo", "SFC", timeRange, mode="First")
baseTerrainDbId = self.findDatabase("EditTopo_BaseTerrain")
gmted = self.getGrids(baseTerrainDbId, "GMTED", "SFC", timeRange, mode="First")
gtopo = self.getGrids(baseTerrainDbId, "GTOPO", "SFC", timeRange, mode="First")
topoDbId = self.findDatabase("EditTopo_Topo")
topo = self.getGrids(topoDbId, "Topo", "SFC", timeRange, mode="First")
self.unloadWEs(newTerrainDbId,
[("newTopoMinusTopo", "SFC"),
("GMTEDminusGTOPO", "SFC"),
("newEdits", "SFC"),
("currentEdits", "SFC")])
delta = newTopo - topo
maxVal = numpy.nanmax(delta)
minVal = numpy.nanmin(delta)
maxDelta = max(1.0, abs(maxVal), abs(minVal))
self.createGrid(newTerrainDbId, "newTopoMinusTopo", "SCALAR", delta, TimeRange.allTimes(),
"NewTopo - Topo", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")
delta = gmted - gtopo
maxVal = numpy.nanmax(delta)
minVal = numpy.nanmin(delta)
maxDelta = max(1.0, abs(maxVal), abs(minVal))
self.createGrid(newTerrainDbId, "GMTEDminusGTOPO", "SCALAR", delta, TimeRange.allTimes(),
"GMTED - GTOPO", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")
delta = newTopo - gmted
maxVal = numpy.nanmax(delta)
minVal = numpy.nanmin(delta)
maxDelta = max(1.0, abs(maxVal), abs(minVal))
self.createGrid(newTerrainDbId, "newEdits", "SCALAR", delta, TimeRange.allTimes(),
"NewTopo - GMTED", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")
delta = topo - gtopo
maxVal = numpy.nanmax(delta)
minVal = numpy.nanmin(delta)
maxDelta = max(1.0, abs(maxVal), abs(minVal))
self.createGrid(newTerrainDbId, "currentEdits", "SCALAR", delta, TimeRange.allTimes(),
"Topo - GTOPO", (0,60,60), 1, -maxDelta, maxDelta, "ft", defaultColorTable="GFE/Delta")

View file

@ -1,84 +0,0 @@
# ----------------------------------------------------------------------------
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
#
# InitializeNewTerrain.py
#
# Copies current GFE Topo grid to OldTerrain element in NewTerrain database.
# Populates NewTerrain element from GMTED2010 topo dataset.
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Jan 13, 2015 #3955 randerso Initial creation
#
# Author: randerso
# ----------------------------------------------------------------------------
MenuItems = ["Edit"]
VariableList = []
import SmartScript
import TimeRange
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
class Procedure (SmartScript.SmartScript):
def __init__(self, dbss):
SmartScript.SmartScript.__init__(self, dbss)
def execute(self, editArea, timeRange, varDict):
mutableID = self.mutableID()
topoDbId = self.findDatabase("EditTopo_Topo")
if mutableID != topoDbId:
DisplayMessageDialog.openError("Invalid Mutable Database", "You must be using the NewTerrain GFE configuration to run this procedure.\nPlease restart CAVE and select the NewTerrain GFE configuraion")
return
newTerrainDbId = self.findDatabase("EditTopo_NewTerrain")
newTerrainParm = self.getParm(newTerrainDbId, "NewTerrain", "SFC")
inventory = newTerrainParm.getGridInventory()
doIt = True
if len(inventory) > 0:
doIt = DisplayMessageDialog.openQuestion("NewTerrain Grid exists!", "Do you wish to re-initialize the NewTerrain Grid discarding all your edits?")
if doIt:
newTerrainParm.setMutable(True)
newTerrainGrid = self.getTerrainGrid()
self.createGrid(newTerrainDbId, "NewTerrain", "SCALAR", newTerrainGrid, TimeRange.allTimes())
newTerrainParm.saveParameter(True)
newTerrainParm.setMutable(False)
oldTerrainParm = self.getParm(newTerrainDbId, "OldTerrain", "SFC")
inventory = oldTerrainParm.getGridInventory()
doIt = True
if len(inventory) > 0:
doIt = DisplayMessageDialog.openQuestion("OldTerrain Grid exists!", "Do you wish to update it?")
if doIt:
oldTerrainParm.setMutable(True)
oldTerrainGrid = self.getTopo()
self.createGrid(newTerrainDbId, "OldTerrain", "SCALAR", oldTerrainGrid, TimeRange.allTimes())
oldTerrainParm.saveParameter(True)
oldTerrainParm.setMutable(False)
self.setActiveElement(topoDbId, "Topo", "SFC", TimeRange.allTimes())
def getTerrainGrid(self):
gloc = self.getGridLoc()
from com.raytheon.uf.common.geospatial import MapUtil
gridGeometry = MapUtil.getGridGeometry(gloc)
from com.raytheon.uf.common.topo import TopoQuery
from java.io import File
terrainData = TopoQuery.getInstance(File("/topo/gmted2010.h5"), 0).getHeight(gridGeometry)
from com.raytheon.uf.common.dataplugin.gfe.grid import Grid2DFloat
grid = Grid2DFloat.createGrid(gloc.getNx().intValue(), gloc.getNy().intValue(), terrainData).getNDArray()
grid /= 0.3048 # convert from meters to feet
return grid

View file

@ -0,0 +1,85 @@
# ----------------------------------------------------------------------------
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
#
# InitializeNewTopo.py
#
# Copies current GFE Topo grid to CurrentTopo element in NewTerrain database.
# Populates NewTopo element from GMTED2010 topo dataset.
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 10/13/2015 #4961 randerso Initial creation
#
# Author: randerso
# ----------------------------------------------------------------------------
MenuItems = ["Edit"]
VariableList = []
import SmartScript
import TimeRange
import numpy
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
class Procedure (SmartScript.SmartScript):
def __init__(self, dbss):
SmartScript.SmartScript.__init__(self, dbss)
def execute(self):
mutableID = self.mutableID()
newTerrainDbId = self.findDatabase("EditTopo_NewTerrain")
if mutableID != newTerrainDbId:
DisplayMessageDialog.openError("Invalid Mutable Database",
"You must be using the NewTerrain GFE configuration to run this procedure.\n"
"Please restart CAVE and select the NewTerrain GFE configuration.")
return
allTimes = TimeRange.allTimes()
baseTerrainDbId = self.findDatabase("EditTopo_BaseTerrain")
gtopoParm = self.getParm(baseTerrainDbId, "GTOPO", "SFC")
gtopoGrid = self.getTerrainGrid("gtopo30")
gtopoParm.setMutable(True)
self.createGrid(baseTerrainDbId, "GTOPO", "SCALAR", gtopoGrid, allTimes)
gtopoParm.saveParameter(True)
gtopoParm.setMutable(False)
gmtedParm = self.getParm(baseTerrainDbId, "GMTED", "SFC")
gmtedGrid = self.getTerrainGrid("gmted2010")
gmtedParm.setMutable(True)
self.createGrid(baseTerrainDbId, "GMTED", "SCALAR", gmtedGrid, allTimes)
gmtedParm.saveParameter(True)
gmtedParm.setMutable(False)
newTopoParm = self.getParm(newTerrainDbId, "NewTopo", "SFC")
inventory = newTopoParm.getGridInventory()
doIt = True
if len(inventory) > 0:
doIt = DisplayMessageDialog.openQuestion("NewTopo Grid exists!",
"Do you wish to re-initialize the NewTopo Grid discarding any edits?")
if doIt:
self.createGrid(newTerrainDbId, "NewTopo", "SCALAR", gmtedGrid, allTimes)
newTopoParm.saveParameter(True)
self.setActiveElement(newTerrainDbId, "NewTopo", "SFC", allTimes)
def getTerrainGrid(self, topoFile):
gloc = self.getGridLoc()
from com.raytheon.uf.common.geospatial import MapUtil
gridGeometry = MapUtil.getGridGeometry(gloc)
from com.raytheon.uf.common.topo import TopoQuery
from java.io import File
fileName = "/topo/" + topoFile + ".h5"
terrainData = TopoQuery.getInstance(File(fileName), 0).getHeight(gridGeometry)
grid = numpy.array(terrainData).reshape(self.getGridShape())
grid /= 0.3048 # convert from meters to feet
return grid

View file

@ -30,6 +30,13 @@
# #
# Author: lefebvre/mathewson # Author: lefebvre/mathewson
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 09/30/15 18141 ryu Allow processing for TCV issued by CPHC
########################################################################
# The MenuItems list defines the GFE menu item(s) under which the # The MenuItems list defines the GFE menu item(s) under which the
# Procedure is to appear. # Procedure is to appear.
@ -40,6 +47,7 @@ from numpy import *
import SmartScript import SmartScript
import AbsTime import AbsTime
import HazardUtils import HazardUtils
import VTECPartners
import LogStream, logging import LogStream, logging
import UFStatusHandler import UFStatusHandler
@ -89,7 +97,7 @@ class Procedure (SmartScript.SmartScript):
continue continue
# only look at the KNHC records # only look at the KNHC records
if v['officeid'] != 'KNHC': if v['officeid'] not in VTECPartners.VTEC_TPC_SITE:
continue continue
key = (v['phen'], v['sig'], v['etn']) key = (v['phen'], v['sig'], v['etn'])

View file

@ -0,0 +1,63 @@
# ----------------------------------------------------------------------------
# This software is in the public domain, furnished "as is", without technical
# support, and with no warranty, express or implied, as to its usefulness for
# any purpose.
#
# RevertTopo.py
#
# Restores the GFE Topo from the most recent backup in PrevTopo
#
# SOFTWARE HISTORY
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 10/13/2015 #4961 randerso Initial creation
#
# Author: randerso
# ----------------------------------------------------------------------------
MenuItems = ["Edit"]
VariableList = []
import SmartScript
import TimeRange
import numpy
from com.raytheon.viz.gfe.ui.runtimeui import DisplayMessageDialog
class Procedure (SmartScript.SmartScript):
def __init__(self, dbss):
SmartScript.SmartScript.__init__(self, dbss)
def execute(self, timeRange):
mutableID = self.mutableID()
topoDbId = self.findDatabase("EditTopo_Topo")
if mutableID != topoDbId:
DisplayMessageDialog.openError("Invalid Mutable Database",
"You must be using the EditTopo GFE configuration to run this procedure.\n"
"Please restart CAVE and select the EditTopo GFE configuration.")
return
# check for existence of PrevTopo grid
baseTerrainDbId = self.findDatabase("EditTopo_BaseTerrain")
prevTopoParm = self.getParm(baseTerrainDbId, "PrevTopo", "SFC")
inventory = prevTopoParm.getGridInventory()
if len(inventory) == 0:
DisplayMessageDialog.openError("No PrevTopo grid exists!",
"It appears you have not yet run CopyFromNewTopo so you have\n"
"no backup copy to restore.")
doIt = DisplayMessageDialog.openQuestion("RevertTopo",
"You are about to revert your GFE Topo data to the last saved state.\n\n"
"Do you wish to continue?")
if not doIt:
return
# Replace the current Topo grid with PrevTopo
prevTopo = self.getGrids(baseTerrainDbId, "PrevTopo", "SFC", timeRange, mode="First")
topoParm = self.getParm(topoDbId, "Topo", "SFC")
self.createGrid(topoDbId, "Topo", "SCALAR", prevTopo, TimeRange.allTimes())
topoParm.saveParameter(True)
DisplayMessageDialog.openInformation("Success!", "Topo successfully restored!")

View file

@ -106,8 +106,7 @@ class ProcedureInterface(RollbackMasterInterface.RollbackMasterInterface):
except Exceptions.EditActionError, e: except Exceptions.EditActionError, e:
if "Cancel" == e.errorType() and "Cancel" == e.errorInfo(): if "Cancel" == e.errorType() and "Cancel" == e.errorInfo():
return None return None
msg = moduleName + ":" + e.errorType() + ": " + e.errorInfo() raise
raise RuntimeError(msg)
def getMenuName(self, name): def getMenuName(self, name):
return getattr(sys.modules[name], "MenuItems", []) return getattr(sys.modules[name], "MenuItems", [])

View file

@ -1,6 +1,7 @@
<WEGroup name="EditTopo"> <WEGroup name="EditTopo">
<WEItem parmID="NewTopo_SFC:OAX_GRID_EditTopo_NewTerrain_00000000_0000" relativeCycleNumber="-1"/>
<WEItem parmID="Topo_SFC:SITE_GRID_EditTopo_Topo_00000000_0000" relativeCycleNumber="-1"/> <WEItem parmID="Topo_SFC:SITE_GRID_EditTopo_Topo_00000000_0000" relativeCycleNumber="-1"/>
<WEItem parmID="OldTerrain_SFC:OAX_GRID_EditTopo_NewTerrain_00000000_0000" relativeCycleNumber="-1"/> <WEItem parmID="GMTED_SFC:OAX_GRID_EditTopo_BaseTerrain_00000000_0000" relativeCycleNumber="-1"/>
<WEItem parmID="NewTerrain_SFC:OAX_GRID_EditTopo_NewTerrain_00000000_0000" relativeCycleNumber="-1"/> <WEItem parmID="GTOPO_SFC:OAX_GRID_EditTopo_BaseTerrain_00000000_0000" relativeCycleNumber="-1"/>
</WEGroup> </WEGroup>

View file

@ -174,6 +174,7 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
* 08/10/2015 4721 randerso Changed getNNNid() to use the productID field (not textdbPil) * 08/10/2015 4721 randerso Changed getNNNid() to use the productID field (not textdbPil)
* Aug 31, 2015 4749 njensen Changed setCloseCallback to addCloseCallback * Aug 31, 2015 4749 njensen Changed setCloseCallback to addCloseCallback
* 09/15/2015 4858 dgilling Disable store/transmit in DRT mode. * 09/15/2015 4858 dgilling Disable store/transmit in DRT mode.
* 10/14/2015 4959 dgilling Support new function signature for wordWrap.
* *
* </pre> * </pre>
* *
@ -2961,7 +2962,7 @@ public class ProductEditorComp extends Composite implements
while ((curLine <= lastLine) && (curLine < styledText.getLineCount())) { while ((curLine <= lastLine) && (curLine < styledText.getLineCount())) {
int lineOff = styledText.getOffsetAtLine(curLine); int lineOff = styledText.getOffsetAtLine(curLine);
// word wrap a block, and find out how the text length changed. // word wrap a block, and find out how the text length changed.
indices = textComp.wordWrap(styledText, lineOff, wrapColumn); indices = textComp.wordWrap(lineOff, wrapColumn);
int firstIdx = indices[0]; int firstIdx = indices[0];
int lastIdx = indices[1]; int lastIdx = indices[1];
int newLen = indices[2]; int newLen = indices[2];

View file

@ -56,8 +56,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Listener;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
import com.raytheon.uf.common.python.PythonScript;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.ProductEditorLogger; import com.raytheon.uf.common.status.ProductEditorLogger;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -70,7 +68,7 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
/** /**
* Composite containing the product editor. * Composite containing the product editor.
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
@ -91,12 +89,14 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
* editing of framing codes. * editing of framing codes.
* 07/02/2015 13753 lshi Update times for products in Product Editor * 07/02/2015 13753 lshi Update times for products in Product Editor
* 08/06/2015 13753 lshi use isSystemTextChange instead of isUpdateTime * 08/06/2015 13753 lshi use isSystemTextChange instead of isUpdateTime
* * 14 OCT 2015 4959 dgilling Use WordWrapperPythonExecutor to get
* python calls off UI thread.
*
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
* @version 1.0 * @version 1.0
* *
*/ */
public class StyledTextComp extends Composite { public class StyledTextComp extends Composite {
@ -129,11 +129,28 @@ public class StyledTextComp extends Composite {
private static final String PRODUCT_PARSE_ERROR = "An unhandled exception was encountered trying to parse your text product. Please cancel and run your formatter again."; private static final String PRODUCT_PARSE_ERROR = "An unhandled exception was encountered trying to parse your text product. Please cancel and run your formatter again.";
private static final String NORM_SEP = "^\\s*$";
private static final String FUNNY_SEP = "^(\\s*)\\*(\\s*)";
private static final String NWS_SEP = "^\\..*\\.{3}";
private static final String PARA_SEP_STRING = "(" + NORM_SEP + ")|("
+ FUNNY_SEP + ")|(" + NWS_SEP + ")";
private static final Pattern PARA_SEP_PATTERN = Pattern
.compile(PARA_SEP_STRING);
private static final Pattern FUNNY_SEP_PATTERN = Pattern.compile(FUNNY_SEP,
Pattern.MULTILINE);
/** /**
* Parent composite. * Parent composite.
*/ */
private final ProductEditorComp parent; private final ProductEditorComp parent;
private final WordWrapPythonExecutor wrapper;
/** /**
* Styled text editor. * Styled text editor.
*/ */
@ -166,8 +183,6 @@ public class StyledTextComp extends Composite {
private boolean dirty = false; private boolean dirty = false;
private PythonScript python = null;
protected Color bgColor; protected Color bgColor;
protected Color fgColor; protected Color fgColor;
@ -182,15 +197,6 @@ public class StyledTextComp extends Composite {
private final ProductEditorLogger peLog; private final ProductEditorLogger peLog;
private static final String NORM_SEP = "^\\s*$";
private static final String FUNNY_SEP = "^(\\s*)\\*(\\s*)";
private static final String NWS_SEP = "^\\..*\\.{3}";
private static final String PARA_SEP_STRING = "(" + NORM_SEP + ")|("
+ FUNNY_SEP + ")|(" + NWS_SEP + ")";
public boolean isAutoWrapMode() { public boolean isAutoWrapMode() {
return autoWrapMode; return autoWrapMode;
} }
@ -201,7 +207,7 @@ public class StyledTextComp extends Composite {
/** /**
* Constructor. * Constructor.
* *
* @param parent * @param parent
* Parent composite. * Parent composite.
* @param wrapMode * @param wrapMode
@ -214,6 +220,7 @@ public class StyledTextComp extends Composite {
this.parent = parent; this.parent = parent;
this.wrapColumn = wrapColumn; this.wrapColumn = wrapColumn;
this.autoWrapMode = wrapMode; this.autoWrapMode = wrapMode;
this.wrapper = new WordWrapPythonExecutor();
this.peLog = new ProductEditorLogger(parent.getProductName()); this.peLog = new ProductEditorLogger(parent.getProductName());
@ -250,30 +257,15 @@ public class StyledTextComp extends Composite {
this.addDisposeListener(new DisposeListener() { this.addDisposeListener(new DisposeListener() {
@Override @Override
public void widgetDisposed(DisposeEvent arg0) { public void widgetDisposed(DisposeEvent arg0) {
wrapper.dispose();
textFont.dispose(); textFont.dispose();
bgColor.dispose(); bgColor.dispose();
fgColor.dispose(); fgColor.dispose();
frameColor.dispose(); frameColor.dispose();
insertColor.dispose(); insertColor.dispose();
lockColor.dispose(); lockColor.dispose();
if (python != null) {
python.dispose();
python = null;
}
} }
}); });
List<String> preEvals = new ArrayList<String>();
preEvals.add("import textwrap");
try {
python = new PythonScript(
GfePyIncludeUtil.getCommonGfeIncludePath(), this.getClass()
.getClassLoader(), preEvals);
} catch (JepException je) {
if (python != null) {
python.dispose();
}
}
} }
/** /**
@ -323,7 +315,7 @@ public class StyledTextComp extends Composite {
/** /**
* Get the StyledText editor. * Get the StyledText editor.
* *
* @return The StyledText editor. * @return The StyledText editor.
*/ */
public StyledText getTextEditorST() { public StyledText getTextEditorST() {
@ -332,7 +324,7 @@ public class StyledTextComp extends Composite {
/** /**
* Set the product text. * Set the product text.
* *
* @param text * @param text
* The product text. * The product text.
*/ */
@ -502,7 +494,7 @@ public class StyledTextComp extends Composite {
/** /**
* Parse the product text string. * Parse the product text string.
* *
* @param productText * @param productText
* Complete product text. * Complete product text.
* @throws JepException * @throws JepException
@ -598,7 +590,7 @@ public class StyledTextComp extends Composite {
/** /**
* Replacement of the text in the given range with new text. * Replacement of the text in the given range with new text.
* *
* @param tip * @param tip
* the range of text to be replaced * the range of text to be replaced
* @param text * @param text
@ -707,7 +699,7 @@ public class StyledTextComp extends Composite {
* A verify event occurs after the user has done something to modify the * A verify event occurs after the user has done something to modify the
* text (typically typed a key), but before the text is modified. The doit * text (typically typed a key), but before the text is modified. The doit
* field in the verify event indicates whether or not to modify the text. * field in the verify event indicates whether or not to modify the text.
* *
* @param event * @param event
* Verify event that was fired. * Verify event that was fired.
*/ */
@ -797,7 +789,7 @@ public class StyledTextComp extends Composite {
/** /**
* Check if there is selected text and if there is locked text in the * Check if there is selected text and if there is locked text in the
* selected text. * selected text.
* *
* @return True if there is selected text that contains locked text. * @return True if there is selected text that contains locked text.
*/ */
private boolean selectionHasLockedText() { private boolean selectionHasLockedText() {
@ -811,12 +803,12 @@ public class StyledTextComp extends Composite {
/** /**
* Check if there is locked text in the specified range of text. * Check if there is locked text in the specified range of text.
* *
* @param offset * @param offset
* The starting point of the locked text search. * The starting point of the locked text search.
* @param length * @param length
* The length of the search. * The length of the search.
* *
* @return Whether or not there is text in the range that contains locked * @return Whether or not there is text in the range that contains locked
* text. * text.
*/ */
@ -834,7 +826,7 @@ public class StyledTextComp extends Composite {
/** /**
* Check if the key being pressed is a "non-edit" key. * Check if the key being pressed is a "non-edit" key.
* *
* @param event * @param event
* Verify event. * Verify event.
* @return True if the key is an arrow or "non-edit" key. * @return True if the key is an arrow or "non-edit" key.
@ -868,7 +860,7 @@ public class StyledTextComp extends Composite {
/** /**
* Handle the mouse down event. * Handle the mouse down event.
* *
* @param e * @param e
* Event fired. * Event fired.
*/ */
@ -983,7 +975,7 @@ public class StyledTextComp extends Composite {
/** /**
* Checks if the system is editing, e.g. updating the issue time every * Checks if the system is editing, e.g. updating the issue time every
* minute, vs a user typing text in the text area * minute, vs a user typing text in the text area
* *
* @return * @return
*/ */
private boolean isSystemTextChange() { private boolean isSystemTextChange() {
@ -1103,7 +1095,7 @@ public class StyledTextComp extends Composite {
eventCursor = event.start + event.length; eventCursor = event.start + event.length;
} }
wordWrap(textEditorST, eventCursor, wrapColumn); wordWrap(eventCursor, wrapColumn);
if (cursorOffset != eventCursor) { if (cursorOffset != eventCursor) {
// restore cursor position for programmatic changes // restore cursor position for programmatic changes
@ -1139,7 +1131,7 @@ public class StyledTextComp extends Composite {
/** /**
* Getter for the column at which wrap and auto-wrap will wrap the text. * Getter for the column at which wrap and auto-wrap will wrap the text.
* *
* @return the column number * @return the column number
*/ */
public int getWrapColumn() { public int getWrapColumn() {
@ -1148,7 +1140,7 @@ public class StyledTextComp extends Composite {
/** /**
* Getter for the column at which wrap and auto-wrap will wrap the text. * Getter for the column at which wrap and auto-wrap will wrap the text.
* *
* @param wrapColumn * @param wrapColumn
* the column number * the column number
*/ */
@ -1187,7 +1179,7 @@ public class StyledTextComp extends Composite {
/** /**
* Query the prefs for setting. If it does not exist, use colorDft as its * Query the prefs for setting. If it does not exist, use colorDft as its
* value. Create an SWT Color for display from the value and return it. * value. Create an SWT Color for display from the value and return it.
* *
* @param prefs * @param prefs
* A preference store which might have config values. * A preference store which might have config values.
* @param display * @param display
@ -1210,7 +1202,7 @@ public class StyledTextComp extends Composite {
/** /**
* Send a PROBLEM message if color1 is exactly equal to color2. * Send a PROBLEM message if color1 is exactly equal to color2.
* *
* @param color1 * @param color1
* the first color * the first color
* @param color2 * @param color2
@ -1237,7 +1229,7 @@ public class StyledTextComp extends Composite {
* <p> * <p>
* The getter name is different to avoid confusion with the getFgColor() * The getter name is different to avoid confusion with the getFgColor()
* method of Control. * method of Control.
* *
* @return the foreground Color * @return the foreground Color
*/ */
public Color getFgndColor() { public Color getFgndColor() {
@ -1248,7 +1240,7 @@ public class StyledTextComp extends Composite {
* Get the framed text color of the StyledTextComp. This is the actual * Get the framed text color of the StyledTextComp. This is the actual
* color, not a copy. It will be disposed when the StyledTextComp is, and * color, not a copy. It will be disposed when the StyledTextComp is, and
* should not be disposed before then. * should not be disposed before then.
* *
* @return the frameColor * @return the frameColor
*/ */
public Color getFrameColor() { public Color getFrameColor() {
@ -1259,7 +1251,7 @@ public class StyledTextComp extends Composite {
* Get the insert color of the StyledTextComp. This is the actual color, not * Get the insert color of the StyledTextComp. This is the actual color, not
* a copy. It will be disposed when the StyledTextComp is, and should not be * a copy. It will be disposed when the StyledTextComp is, and should not be
* disposed before then. * disposed before then.
* *
* @return the insertColor * @return the insertColor
*/ */
public Color getInsertColor() { public Color getInsertColor() {
@ -1270,7 +1262,7 @@ public class StyledTextComp extends Composite {
* Get the locked text color of the StyledTextComp. This is the actual * Get the locked text color of the StyledTextComp. This is the actual
* color, not a copy. It will be disposed when the StyledTextComp is, and * color, not a copy. It will be disposed when the StyledTextComp is, and
* should not be disposed before then. * should not be disposed before then.
* *
* @return the lockColor * @return the lockColor
*/ */
public Color getLockColor() { public Color getLockColor() {
@ -1280,9 +1272,7 @@ public class StyledTextComp extends Composite {
/** /**
* Word wrap the text in the block around cursorIndex. Adjust the cursor * Word wrap the text in the block around cursorIndex. Adjust the cursor
* position to account for inserted or deleted whitespace. * position to account for inserted or deleted whitespace.
* *
* @param st
* The StyledText in which word wrap is to be performed
* @param cursorIndex * @param cursorIndex
* The cursor index * The cursor index
* @param width * @param width
@ -1294,15 +1284,11 @@ public class StyledTextComp extends Composite {
* <li>The length of the replacement text</li> * <li>The length of the replacement text</li>
* </ol> * </ol>
*/ */
public int[] wordWrap(StyledText st, int cursorIndex, int width) { public int[] wordWrap(int cursorIndex, int width) {
StyledText st = getTextEditorST();
final Pattern PARA_SEP_PATTERN = Pattern.compile(PARA_SEP_STRING);
final Matcher PARA_MATCHER = PARA_SEP_PATTERN.matcher(""); final Matcher PARA_MATCHER = PARA_SEP_PATTERN.matcher("");
final Pattern FUNNY_SEP_PATTERN = Pattern.compile(FUNNY_SEP,
Pattern.MULTILINE);
final Matcher FUNNY_SEP_MATCHER = FUNNY_SEP_PATTERN.matcher(""); final Matcher FUNNY_SEP_MATCHER = FUNNY_SEP_PATTERN.matcher("");
final String NL = st.getLineDelimiter(); final String NL = st.getLineDelimiter();
String line; String line;
@ -1428,11 +1414,8 @@ public class StyledTextComp extends Composite {
preArgs.put("text", pre); preArgs.put("text", pre);
try { try {
python.instantiatePythonClass("_wrapper", "textwrap.TextWrapper", pre = wrapper.callWordWrapPython(args, preArgs);
args); } catch (Exception e) {
pre = (String) python.execute("fill", "_wrapper", preArgs);
} catch (JepException e) {
statusHandler.error("Python error wrapping text preceding cursor:", statusHandler.error("Python error wrapping text preceding cursor:",
e); e);
} }
@ -1455,10 +1438,8 @@ public class StyledTextComp extends Composite {
postArgs.put("text", post); postArgs.put("text", post);
try { try {
python.instantiatePythonClass("_wrapper", "textwrap.TextWrapper", post = wrapper.callWordWrapPython(args, postArgs);
args); } catch (Exception e) {
post = (String) python.execute("fill", "_wrapper", postArgs);
} catch (JepException e) {
statusHandler.error("Python error wrapping text after cursor:", e); statusHandler.error("Python error wrapping text after cursor:", e);
} }

View file

@ -0,0 +1,107 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.gfe.dialogs.formatterlauncher;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
import com.raytheon.uf.common.python.PythonScript;
/**
* Executor service for running GFE's python-based word wrapping code.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 14, 2015 #4959 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public final class WordWrapPythonExecutor {
private final ExecutorService execService;
private PythonScript python;
public WordWrapPythonExecutor() {
this.execService = Executors.newSingleThreadExecutor();
}
public synchronized String callWordWrapPython(
final Map<String, Object> classArgs,
final Map<String, Object> methodArgs) throws InterruptedException,
ExecutionException {
Callable<String> wordWrapTask = new Callable<String>() {
@Override
public String call() throws Exception {
if (python == null) {
List<String> preEvals = Arrays.asList("import textwrap");
python = new PythonScript(
GfePyIncludeUtil.getCommonGfeIncludePath(),
getClass().getClassLoader(), preEvals);
}
python.instantiatePythonClass("_wrapper",
"textwrap.TextWrapper", classArgs);
return (String) python.execute("fill", "_wrapper", methodArgs);
}
};
Future<String> result = execService.submit(wordWrapTask);
return result.get();
}
public void dispose() {
/*
* Have to create a Runnable to dispose the PythonScript instance to
* avoid thread access issues.
*/
Runnable disposeTask = new Runnable() {
@Override
public void run() {
if (python != null) {
python.close();
python = null;
}
}
};
execService.submit(disposeTask);
if (execService != null) {
execService.shutdown();
}
}
}

View file

@ -23,7 +23,6 @@ import java.awt.Point;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -76,6 +75,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 08/14/2014 #3523 mapeters Updated deprecated {@link DrawableString#textStyle} * 08/14/2014 #3523 mapeters Updated deprecated {@link DrawableString#textStyle}
* assignments. * assignments.
* 01/13/2015 #3955 randerso Fix NullPointerException when updateTime is not set * 01/13/2015 #3955 randerso Fix NullPointerException when updateTime is not set
* 10/16/2015 #4971 bsteffen No longer need to reverse grids.
* </pre> * </pre>
* *
* @author chammack * @author chammack
@ -277,7 +277,6 @@ public class SamplePainter {
List<GridID> grids = Grids; List<GridID> grids = Grids;
Collections.reverse(grids);
// if list is not defined, then all samples will be painted for // if list is not defined, then all samples will be painted for
// all parms // all parms
@ -356,7 +355,6 @@ public class SamplePainter {
sampleLabels.add(label); sampleLabels.add(label);
colors.add(labelColor); colors.add(labelColor);
} }
Collections.reverse(grids);
} }
/** /**

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