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
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
#-------------------------------------------------------------------------
@ -112,9 +122,10 @@ RUN_MODE=
for arg in $@
do
case $arg in
-b|-d|--debug|-db|-bd) DEBUG_FLAG=on;;
-p|--profiler) PROFILE_FLAG=on;;
-h|--highmem) ;; # does nothing, only here to prevent issues if someone still uses -h
-b|-d|-debug|-db|-bd) DEBUG_FLAG=on;;
-p|-profiler) PROFILE_FLAG=on;;
-h|-highmem) HIGH_MEM=on;;
-noHighmem) HIGH_MEM=off;;
-noConsole) CONSOLE_FLAG=off;;
*) RUN_MODE=$arg;;
esac
@ -123,11 +134,13 @@ done
export EDEX_RUN_MODE=$RUN_MODE
if [ $CONSOLE_FLAG == "off" ]; then
CONSOLE_LOGLEVEL=NONE
CONSOLE_LOGLEVEL=NONE
fi
export CONSOLE_LOGLEVEL
# source environment files
. $EDEX_HOME/etc/default.sh

View file

@ -158,7 +158,7 @@ wrapper.app.parameter.2=start
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.timeout=120
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.action.oom=${WRAPPER_TRIGGER_ACTION}
#********************************************************************fil
#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console. (See docs for formats)

View file

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

View file

@ -19,9 +19,12 @@
# further licensing information.
##
export INIT_MEM=512 # 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_JMX_PORT=1620
export LOG_CONF=logback-registry.xml

View file

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

View file

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

View file

@ -20,6 +20,11 @@
##
export MAX_MEM=1536 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=2048
fi
export MAX_PERM_SIZE=192m
export EDEX_DEBUG_PORT=5012
export EDEX_JMX_PORT=1620
@ -29,4 +34,4 @@ export MGMT_PORT=9605
export METADATA_POOL_MAX=20
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.
##
export INIT_MEM=512 # 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_JMX_PORT=1617
export LOG_CONF=logback-ingest.xml

View file

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

View file

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

View file

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

View file

@ -20,6 +20,11 @@
##
export MAX_MEM=1536 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=2560
fi
export MAX_PERM_SIZE=192m
export EDEX_DEBUG_PORT=5012
export EDEX_JMX_PORT=1620
@ -29,4 +34,4 @@ export MGMT_PORT=9605
export METADATA_POOL_MAX=20
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
# further licensing information.
##
export INIT_MEM=128 # 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_STREAM_INIT_SIZE_MB=2
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
# further licensing information.
##
export INIT_MEM=128 # in Meg
if [ "$EDEX_ARCH" == "64-bit" ]; then
export MAX_MEM=1648 # in Meg
else
export MAX_MEM=880 # in Meg
export MAX_MEM=1536 # in Meg
if [ $HIGH_MEM == "on" ]; then
export MAX_MEM=2048
fi
export SERIALIZE_POOL_MAX_SIZE=24
export SERIALIZE_STREAM_INIT_SIZE_MB=2
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.
topLevelElementType=feature
buildType=I
buildId=CAVE
buildLabel=${buildType}.${buildId}
@ -28,4 +27,4 @@ generate.p2.metadata=true
p2.metadata.repo=file:/${buildDirectory}/repository
p2.artifact.repo=file:/${buildDirectory}/repository
p2.publish.artifacts=true
generateVersionsList=true
generateVersionsList=true

View file

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

View file

@ -20,18 +20,13 @@
############# 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
#Needed for p2, comment out these lines if using developer.product
p2.gathering=true
generate.p2.metadata = true
p2.metadata.repo=file:${buildDirectory}/repo
p2.artifact.repo=file:${buildDirectory}/repo
p2.metadata.repo=file:${buildDirectory}/repository
p2.artifact.repo=file:${buildDirectory}/repository
p2.flavor=tooling
p2.publish.artifacts=true

View file

@ -65,63 +65,7 @@
<!-- ===================================================================== -->
<!-- Steps to do after setup but before starting the build proper -->
<!-- ===================================================================== -->
<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>
<target name="postSetup">
<antcall target="getBaseComponents" />
</target>
@ -214,236 +158,8 @@
<!-- ===================================================================== -->
<!-- Steps to do after the build is done. -->
<!-- ===================================================================== -->
<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 name="postBuild">
</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"
unpack="false"/>
<plugin
id="org.codehaus.jackson"
download-size="0"
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.common.json"
download-size="0"

View file

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

View file

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

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: D2D Graph Adapters
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-RequiredExecutionEnvironment: JavaSE-1.7
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.viz.objectiveanalysis,
com.raytheon.viz.grid,
com.raytheon.viz.radar,
com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.time,
com.raytheon.uf.common.style,
com.raytheon.uf.common.comm,
javax.measure,
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,
com.raytheon.uf.viz.datacube,
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.interp.IInterpolation;
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.crosssection.adapter.AbstractCrossSectionAdapter;
import com.raytheon.uf.viz.xy.crosssection.graph.CrossSectionGraph;
import com.raytheon.viz.core.graphing.util.MeteolibInterpolation;
import com.raytheon.viz.core.slice.request.HeightScale;
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.LineSegment;
import com.vividsolutions.jts.geom.LineString;
@ -54,6 +54,8 @@ import com.vividsolutions.jts.geom.LineString;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 30, 2009 bsteffen Initial creation
* Oct 13, 2015 4897 bkowal Relocated {@link DmdTools} to a plugin
* that actually uses it.
*
* </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.time.DataTime;
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.viz.core.graphing.xy.XYData;
import com.raytheon.viz.core.graphing.xy.XYDataList;
import com.raytheon.viz.radar.util.DmdTools;
import com.vividsolutions.jts.geom.Coordinate;
/**
@ -45,6 +45,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 7, 2010 bsteffen Initial creation
* Oct 13, 2015 4897 bkowal Relocated {@link DmdTools} to a plugin
* that actually uses it.
*
* </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.time.DataTime;
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.viz.core.graphing.xy.XYData;
import com.raytheon.viz.radar.util.DmdTools;
import com.vividsolutions.jts.geom.Coordinate;
/**
@ -42,6 +42,8 @@ import com.vividsolutions.jts.geom.Coordinate;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 7, 2010 bsteffen Initial creation
* Oct 13, 2015 4897 bkowal Relocated {@link DmdTools} to a plugin
* that actually uses it.
*
* </pre>
*

View file

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

View file

@ -19,10 +19,17 @@
**/
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.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.daylight.transition.tileset.DaylightTransitionTileSetRenderable;
import com.raytheon.viz.satellite.rsc.SatResource;
import com.raytheon.viz.satellite.tileset.SatRenderable;
import com.raytheon.viz.satellite.tileset.SatTileSetRenderable;
/**
@ -38,6 +45,7 @@ import com.raytheon.viz.satellite.tileset.SatTileSetRenderable;
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Jul 28, 2015 4633 bsteffen Initial creation
* Oct 12, 2015 4937 bsteffen Move SatRenderable to new class, extend it here.
*
* </pre>
*
@ -54,12 +62,30 @@ public class DaylightTransitionSatResource extends SatResource {
this.resourceData = data;
}
@Override
protected SatTileSetRenderable createTileSet(SatelliteRecord record) {
SatTileSetRenderable tileSet = new DaylightTransitionTileSetRenderable(
this, record, resourceData.getSunDelta());
tileSet.project(descriptor.getGridGeometry());
return tileSet;
protected IRenderable constructRenderable(DataTime time,
List<PluginDataObject> records) throws VizException {
SatRenderable renderable = new DaylightTransitionSatRenderable(time);
updateRenderable(renderable, records.toArray(new PluginDataObject[0]));
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
* Apr 02, 2015 4288 randerso Fix Widget is disposed error
* 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>
*
@ -859,7 +862,6 @@ public class FileTreeView extends ViewPart implements IPartListener2,
// Add Copy/Paste/Delete
if ((fileList.size() == 1) && (selected.length == 1)) {
LocalizationFile selectedFile = fileList.get(0);
mgr.add(new Action("Copy") {
@Override
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
.toArray(new LocalizationFile[fileList.size()])));
@ -919,9 +921,9 @@ public class FileTreeView extends ViewPart implements IPartListener2,
}
// Add the move to item
if ((selected.length == 1) && (fileList.size() == 1)) {
mgr.add(new MoveFileAction(getSite().getPage(), fileList.get(0),
this));
if ((selected.length == 1) && (fileDataList.size() == 1)) {
mgr.add(new MoveFileAction(getSite().getPage(),
fileDataList.get(0), this));
mgr.add(new Separator());
}
@ -966,8 +968,9 @@ public class FileTreeView extends ViewPart implements IPartListener2,
if (fdata.isDirectory()) {
// We can import into true directories, not group datas
mgr.add(new Separator());
mgr.add(new ImportFileAction(fdata.getPathData().getType(),
fdata.getPath(), fdata.getPathData().getFilter()));
mgr.add(new ImportFileAction(
fdata.getPathData().getTypes(), fdata.getPath(),
fdata.getPathData().getFilter()));
}
}
}
@ -1080,14 +1083,14 @@ public class FileTreeView extends ViewPart implements IPartListener2,
String path = data.getPath();
String[] filter = pd.getFilter();
boolean recursive = pd.isRecursive();
LocalizationType type = pd.getType();
List<LocalizationType> types = pd.getTypes();
IPathManager pathManager = PathManagerFactory.getPathManager();
boolean success = false;
List<LocalizationFile> currentList = new ArrayList<LocalizationFile>();
LocalizationFile[] files = pathManager.listFiles(
getTreeSearchContexts(type), path, filter, false, !recursive);
getTreeSearchContexts(types), path, filter, false, !recursive);
if (files == null) {
statusHandler.handle(Priority.PROBLEM,
"Error getting list of files");
@ -1119,16 +1122,19 @@ public class FileTreeView extends ViewPart implements IPartListener2,
return success;
}
private LocalizationContext[] getTreeSearchContexts(LocalizationType type) {
private LocalizationContext[] getTreeSearchContexts(
List<LocalizationType> types) {
IPathManager pathManager = PathManagerFactory.getPathManager();
// Request for base/site/user
LocalizationContext[] searchHierarchy = pathManager
.getLocalSearchHierarchy(type);
List<LocalizationContext> searchContexts = new ArrayList<LocalizationContext>(
searchHierarchy.length);
for (LocalizationContext ctx : searchHierarchy) {
if (showSet.contains(ctx.getLocalizationLevel())) {
searchContexts.add(ctx);
List<LocalizationContext> searchContexts = new ArrayList<LocalizationContext>();
for (LocalizationType type : types) {
LocalizationContext[] searchHierarchy = pathManager
.getLocalSearchHierarchy(type);
for (LocalizationContext ctx : searchHierarchy) {
if (showSet.contains(ctx.getLocalizationLevel())) {
searchContexts.add(ctx);
}
}
}
@ -1152,11 +1158,12 @@ public class FileTreeView extends ViewPart implements IPartListener2,
|| ((myContext == null) && (context == null))) {
continue;
}
LocalizationContext ctx = pathManager.getContext(type,
level);
ctx.setContextName(context);
searchContexts.add(ctx);
for (LocalizationType type : types) {
LocalizationContext ctx = pathManager.getContext(type,
level);
ctx.setContextName(context);
searchContexts.add(ctx);
}
}
}
}
@ -1217,10 +1224,21 @@ public class FileTreeView extends ViewPart implements IPartListener2,
fData.clearChildData();
fData.setRequestedChildren(true);
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) {
FileTreeEntryData treeData = null;
if (!file.isDirectory()) {
treeData = new LocalizationFileEntryData(pd, file);
LocalizationLevel level = file.getContext()
.getLocalizationLevel();
treeData = new LocalizationFileEntryData(pd, file,
redundantLevels.contains(level));
addTreeItem(parentItem, treeData);
fData.addChildData((LocalizationFileEntryData) treeData);
}
@ -1268,13 +1286,26 @@ public class FileTreeView extends ViewPart implements IPartListener2,
LocalizationFile file = null;
int idx = parentItem.getItemCount();
if (treeData instanceof LocalizationFileEntryData) {
file = ((LocalizationFileEntryData) treeData).getFile();
LocalizationFileEntryData entryData = (LocalizationFileEntryData) treeData;
file = entryData.getFile();
LocalizationContext ctx = file.getContext();
LocalizationLevel level = ctx.getLocalizationLevel();
name = level.toString();
if (level != LocalizationLevel.BASE) {
name += " (" + ctx.getContextName() + ")";
StringBuilder nameBuilder = new StringBuilder(level.toString());
if (entryData.isMultipleTypes() || level != LocalizationLevel.BASE) {
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 {
List<TreeItem> applicableItems = new ArrayList<TreeItem>();
int start = -1;
@ -1318,9 +1349,10 @@ public class FileTreeView extends ViewPart implements IPartListener2,
IFolder folder = (IFolder) parentData.getResource();
IResource rsc = null;
if (file != null) {
rsc = folder.getFile(file.getContext().getLocalizationLevel() + "_"
+ file.getContext().getContextName() + "_"
+ parentItem.getText());
LocalizationContext context = file.getContext();
rsc = folder.getFile(context.getLocalizationType() + "_"
+ context.getLocalizationLevel() + "_"
+ context.getContextName() + "_" + parentItem.getText());
} else {
rsc = createFolder(folder, fileItem.getText());
}
@ -1465,7 +1497,7 @@ public class FileTreeView extends ViewPart implements IPartListener2,
private TreeItem find(TreeItem item, LocalizationContext ctx,
java.nio.file.Path path, boolean populateToFind) {
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());
if (path.startsWith(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.IOException;
import java.io.InputStream;
import java.util.ArrayList;
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.LocalizationUtil;
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.msgs.ListResponseEntry;
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
* ------------ ---------- ----------- --------------------------
* 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>
*
@ -144,7 +150,7 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
for (int i = 0; i < paths.length; ++i) {
files[i] = new File(paths[i]);
}
boolean rval = dropFile(data.getPathData().getType(),
boolean rval = dropFile(data.getPathData().getTypes(),
data.getPath(), files);
if (rval) {
toDelete = potentialDelete;
@ -152,8 +158,8 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
// Dragging from somewhere outside of FileTreeView
IPathManager pm = PathManagerFactory.getPathManager();
view.refresh(pm.getLocalizationFile(pm.getContext(data
.getPathData().getType(), LocalizationLevel.BASE),
data.getPath()));
.getPathData().getTypes().get(0),
LocalizationLevel.BASE), data.getPath()));
}
}
return rval;
@ -192,9 +198,12 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
toMoveData.getContext(), toMoveData.getFileName());
String fileName = LocalizationUtil.extractName(toMove.getName());
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(
data.getPathData().getType(), toMoveData.getContext()
.getLocalizationLevel()), newName);
type, toMoveData.getContext().getLocalizationLevel()), newName);
boolean move = true;
if (moveTo.exists()) {
move = MessageDialog.openQuestion(view.getSite().getShell(),
@ -227,23 +236,20 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
} else {
VizApp.runAsync(select);
}
try {
FileUtil.copyFile(toMove.getFile(), moveTo.getFile());
if (moveTo.save()) {
return true;
}
} catch (IOException e) {
try (InputStream is = toMove.openInputStream();
SaveableOutputStream os = moveTo.openOutputStream()) {
FileUtil.copy(is, os);
os.save();
return true;
} catch (IOException | LocalizationException e) {
UFStatus.getHandler().handle(Priority.PROBLEM,
"Error copying file contents", e);
} catch (LocalizationOpFailedException e) {
UFStatus.getHandler().handle(Priority.PROBLEM,
"Error saving file contents", e);
}
}
return false;
}
private boolean dropFile(LocalizationType type, String dirPath,
private boolean dropFile(List<LocalizationType> types, String dirPath,
File[] toCopyFiles) {
boolean oneGood = false;
List<File> files = new ArrayList<File>(toCopyFiles.length);
@ -260,14 +266,14 @@ public class LocalizationFileDragNDropSource extends ViewerDropAdapter
}
if (files.size() > 0) {
if (ImportFileAction.importFile(type, dirPath,
if (ImportFileAction.importFile(types, dirPath,
files.toArray(new File[files.size()]))) {
oneGood = true;
}
}
for (File dir : directories) {
if (dropFile(type,
if (dropFile(types,
dirPath + IPathManager.SEPARATOR + dir.getName(),
dir.listFiles())) {
oneGood = true;

View file

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

View file

@ -19,23 +19,29 @@
**/
package com.raytheon.uf.viz.localization.perspective.view.actions;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.Separator;
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.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.localization.exception.LocalizationException;
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.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;
/**
@ -48,7 +54,9 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
*
* 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>
*
@ -60,11 +68,20 @@ public class CopyToAction extends AbstractToAction {
private static final transient IUFStatusHandler statusHandler = UFStatus
.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);
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
protected void run(LocalizationLevel level) {
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationFile newFile = pm.getLocalizationFile(
ILocalizationFile newFile = pm.getLocalizationFile(
pm.getContext(file.getContext().getLocalizationType(), level),
file.getName());
removeAlternateTypeFiles(level);
copyFile(newFile);
}
protected boolean copyFile(LocalizationFile newFile) {
File copyTo = newFile.getFile();
File copyFrom = file.getFile();
/**
* If it is possible for the target to exist for multiple localization types
* 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
copyTo.delete();
// Make sure parent directories exist
if (copyTo.getParentFile().exists() == false) {
copyTo.getParentFile().mkdirs();
for (LocalizationType type : pathData.getTypes()) {
if (type != file.getContext().getLocalizationType()) {
LocalizationFile altFile = pm.getLocalizationFile(
pm.getContext(type, level), file.getName());
if (altFile.exists()) {
try {
altFile.delete();
} catch (LocalizationOpFailedException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to delete existing " + type.name()
+ " " + level + " file.", e);
}
}
}
}
}
try {
// Copy file contents locally
FileUtil.copyFile(copyFrom, copyTo);
} catch (IOException e) {
protected boolean copyFile(ILocalizationFile newFile) {
try (InputStream is = file.openInputStream();
SaveableOutputStream os = newFile.openOutputStream()) {
FileUtil.copy(is, os);
os.save();
return true;
} catch (LocalizationException | IOException e) {
statusHandler
.handle(Priority.PROBLEM, "Error copying file contents of "
+ 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;
}

View file

@ -31,11 +31,13 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
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.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.localization.SaveableOutputStream;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@ -51,8 +53,10 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 1, 2011 mschenke Initial creation
* Jun 11, 2015 4541 skorolev Added NULL test for lf.
* Nov 1, 2011 mschenke Initial creation
* 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>
*
@ -72,19 +76,21 @@ public class ImportFileAction extends Action {
private final String directoryPath;
private final LocalizationType contextType;
private final List<LocalizationType> contextTypes;
private String[] fileExtensionFilterArr;
public ImportFileAction(LocalizationType contextType, String directoryPath) {
public ImportFileAction(List<LocalizationType> contextTypes,
String directoryPath) {
super("Import File...");
this.contextType = contextType;
this.contextTypes = contextTypes;
this.directoryPath = directoryPath;
}
public ImportFileAction(LocalizationType contextType, String directoryPath,
public ImportFileAction(List<LocalizationType> contextTypes,
String directoryPath,
String[] filter) {
this(contextType, directoryPath);
this(contextTypes, directoryPath);
if (filter != null) {
this.fileExtensionFilterArr = new String[filter.length];
for (int i = 0; i < filter.length; ++i) {
@ -114,11 +120,11 @@ public class ImportFileAction extends Action {
String fileToImport = dialog.open();
if (fileToImport != null) {
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) {
List<File> applicable = new ArrayList<File>(importFiles.length);
for (File importFile : importFiles) {
@ -127,24 +133,38 @@ public class ImportFileAction extends Action {
applicable.add(importFile);
}
}
List<LocalizationFile> localizationFiles = new ArrayList<LocalizationFile>(
List<ILocalizationFile> localizationFiles = new ArrayList<ILocalizationFile>(
applicable.size());
List<LocalizationFile> existing = new ArrayList<LocalizationFile>(
List<ILocalizationFile> existing = new ArrayList<ILocalizationFile>(
applicable.size());
for (File importFile : applicable) {
String name = importFile.getName();
String newFilePath = directoryPath + IPathManager.SEPARATOR + name;
IPathManager pm = PathManagerFactory.getPathManager();
LocalizationFile lf = pm.getLocalizationFile(
pm.getContext(contextType, LocalizationLevel.USER),
newFilePath);
LocalizationFile lf = null;
for (LocalizationType contextType : contextTypes) {
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()) {
localizationFiles.add(lf);
if (lf.exists()) {
existing.add(lf);
}
} else {
localizationFiles.add(null);
statusHandler
.handle(Priority.WARN,
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() > 1) {
MultiConfirmDialog dialog = new MultiConfirmDialog(existing);
dialog.open();
existing.removeAll(dialog.getConfirmedFiles());
} else {
LocalizationFile file = existing.get(0);
ILocalizationFile file = existing.get(0);
if (MessageDialog.openConfirm(VizWorkbenchManager.getInstance()
.getCurrentWindow().getShell(), "Confirm Overwrite",
String.format(FORMAT_STRING, file.getName(), file
@ -174,10 +194,11 @@ public class ImportFileAction extends Action {
for (int i = 0; i < applicable.size(); ++i) {
File importFile = applicable.get(i);
if (!localizationFiles.isEmpty()) {
LocalizationFile lf = localizationFiles.get(i);
if (skip.contains(lf) == false) {
try {
lf.write(FileUtil.file2bytes(importFile));
ILocalizationFile lf = localizationFiles.get(i);
if (lf != null && skip.contains(lf) == false) {
try (SaveableOutputStream os = lf.openOutputStream()) {
os.write(FileUtil.file2bytes(importFile));
os.save();
++addCount;
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
@ -191,9 +212,9 @@ public class ImportFileAction extends Action {
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;
@ -206,13 +227,13 @@ public class ImportFileAction extends Action {
* @param dialogButtonLabels
* @param defaultIndex
*/
public MultiConfirmDialog(List<LocalizationFile> existingFiles) {
public MultiConfirmDialog(List<ILocalizationFile> existingFiles) {
super(VizWorkbenchManager.getInstance().getCurrentWindow()
.getShell(), "Confirm Overwrite", null, "",
MessageDialog.CONFIRM, new String[] { "Yes To All", "No",
"Cancel", "Yes" }, 0);
this.existingFiles = existingFiles;
this.confirmedFiles = new ArrayList<LocalizationFile>(
this.confirmedFiles = new ArrayList<ILocalizationFile>(
existingFiles.size());
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
protected Control createMessageArea(Composite composite) {
Control ctrl = super.createMessageArea(composite);
@ -273,12 +287,12 @@ public class ImportFileAction extends Action {
}
private void updateText() {
LocalizationFile file = existingFiles.get(curIdx);
ILocalizationFile file = existingFiles.get(curIdx);
messageLabel.setText(String.format(FORMAT_STRING, file.getName(),
file.getContext().getLocalizationLevel()));
}
public List<LocalizationFile> getConfirmedFiles() {
public List<ILocalizationFile> getConfirmedFiles() {
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.LocalizationUtil;
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.localization.filetreeview.LocalizationFileEntryData;
import com.raytheon.uf.viz.localization.service.ILocalizationService;
/**
@ -44,7 +47,10 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
*
* 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>
*
@ -53,20 +59,24 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
*/
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) {
super(file, service);
super(data, service);
setText("Move To");
this.page = page;
delete = new DeleteAction(page, new LocalizationFile[] { file }, false);
delete = new DeleteAction(page,
new LocalizationFile[] { data.getFile() }, false);
setEnabled(delete.isEnabled());
}
@ -104,7 +114,7 @@ public class MoveFileAction extends CopyToAction {
final LocalizationFile newFile = pm.getLocalizationFile(
pm.getContext(file.getContext().getLocalizationType(),
level), file.getName());
removeAlternateTypeFiles(level);
// Make sure we select the file after the drop
final ILocalizationFileObserver[] observers = new ILocalizationFileObserver[1];
ILocalizationFileObserver observer = new ILocalizationFileObserver() {

View file

@ -19,6 +19,8 @@
**/
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.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
@ -39,6 +41,9 @@ import com.raytheon.uf.viz.localization.service.ILocalizationService;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 3, 2010 6305 mpduff Initial creation
* Oct 13, 2015 4410 bsteffen Allow localization perspective to mix
* files for multiple Localization Types.
*
*
* </pre>
*
@ -54,7 +59,7 @@ public class PasteFileAction extends CopyToAction {
public PasteFileAction(ILocalizationService service, LocalizationFile file,
LocalizationFileGroupData data) {
super(file, service);
super(file, data.getPathData(), service);
setText("Paste To");
this.dataToCopyTo = data;
// 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
protected boolean isLevelEnabled(LocalizationLevel level) {
return pasteToProtectedLevel == null
|| level.compareTo(pasteToProtectedLevel) <= 0;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.localization.filetreeview.actions.AbstractToAction
* #run
* (com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel
* )
*/
@Override
protected void run(LocalizationLevel level) {
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);
LocalizationFile newFile = pm.getLocalizationFile(ctx,
dataToCopyTo.getPath());
removeAlternateTypeFiles(level);
copyFile(newFile);
}
}

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.uf.viz.localization.perspective.view.actions;
import java.io.InputStream;
import java.util.regex.Pattern;
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.LocalizationUtil;
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.Priority;
import com.raytheon.uf.common.util.FileUtil;
@ -52,7 +54,10 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
*
* 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>
*
@ -186,8 +191,12 @@ public class RenameAction extends Action {
}
}
FileUtil.copyFile(file.getFile(), newFile.getFile());
newFile.save();
try (InputStream is = file.openInputStream();
SaveableOutputStream os = newFile
.openOutputStream()) {
FileUtil.copy(is, os);
os.save();
}
if (deleteOld) {
file.delete();
}

View file

@ -641,7 +641,7 @@ public class FFMPMonitor extends ResourceMonitor {
// times, prevents mosaic brittleness from occurring.
retrieveNew = true;
if (source.getGuidanceType().equals(
if (source.getGuidanceType() != null && source.getGuidanceType().equals(
GUIDANCE_TYPE.ARCHIVE.getGuidanceType())) {
isTimeConstraint = false;
} else {
@ -1265,18 +1265,22 @@ public class FFMPMonitor extends ResourceMonitor {
/**
* Gets the guidance source types.
*
* @param product
* @param guidSrc
* @param siteKey
* @param dataKey
* @param sourceName
* @param date
* @param phuc
* @param pfaf
* @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)
throws VizException {
if (product != null) {
String guidSrc = FFMPConfig.getInstance().getFFMPConfigData()
.getGuidSrc();
SourceXML source = product.getGuidanceSourcesByType(guidSrc).get(0);
sourceName = source.getDisplayName();
}
@ -1542,6 +1546,7 @@ public class FFMPMonitor extends ResourceMonitor {
fproduct, type)) {
// Don't purge archive guidance!
if (guidSource != null
&& guidSource.getGuidanceType() != null
&& !guidSource.getGuidanceType()
.equals(GUIDANCE_TYPE.ARCHIVE
.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));
}

View file

@ -65,6 +65,7 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPGraphData;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 30, 2009 lvenable Initial creation
* Oct 10, 2015 4756 dhladky Dynamic bounding of Y axis.
*
* </pre>
*
@ -272,6 +273,12 @@ public class BasinTrendGraph {
* Time duration.
*/
private TimeDuration timeDur = TimeDuration.ALL;
/**
* Basin Trend Graph Bounds.
*/
private BasinTrendGraphBounds graphBounds;
/**
* Data to graph.
@ -400,6 +407,8 @@ public class BasinTrendGraph {
* Initialize method.
*/
private void init() {
determineGraphBounds();
display = parentComp.getDisplay();
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
@ -807,35 +816,47 @@ public class BasinTrendGraph {
double yCoord = 0.0;
String inchLbl;
double inchDbl = timeDur.getYCoordHours();
double inchDbl = graphBounds.getYCoordValues();
int skip = graphBounds.getSkipValue();
int count = 0;
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);
gc.drawString(inchLbl, leftIncCanvasWidth - dashLength - 3
- (inchLbl.length() * fontWidth),
doubleToInt(yCoord + 5.0), true);
} else {
if (inchDbl != 0.0) {
// When counter == skip, allow graph to draw a label.
if (count == skip) {
// resets the counter
if (yCoord > 1.0) {
count = 0;
}
if (inchDbl == graphBounds.getYCoordValues()) {
gc.drawLine(leftIncCanvasWidth, doubleToInt(yCoord + 1.0),
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;
inchDbl -= 1.0;
count++;
}
gc.drawLine(leftIncCanvasWidth, graphImageHeight + 1,
@ -877,30 +898,42 @@ public class BasinTrendGraph {
double yCoord = 0.0;
String inchLbl;
double inchDbl = timeDur.getYCoordHours();
double inchDbl = graphBounds.getYCoordValues();
int skip = graphBounds.getSkipValue();
int count = 0;
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);
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));
// When counter == skip, allow graph to draw a label.
if (count == skip) {
// resets the counter
if (yCoord > 1.0) {
count = 0;
}
}
if (inchDbl != 0.0 && inchDbl != timeDur.getYCoordHours()) {
inchLbl = String.format("%1.1f", inchDbl);
gc.drawString(inchLbl, 10, doubleToInt(yCoord - aveFontHeight),
true);
if (inchDbl == graphBounds.getYCoordValues()) {
gc.drawLine(0, doubleToInt(yCoord + 1.0), dashLength,
doubleToInt(yCoord + 5.0));
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;
inchDbl -= 1.0;
count++;
}
gc.drawLine(0, graphImageHeight + 1, dashLength, graphImageHeight - 5);
@ -986,7 +1019,7 @@ public class BasinTrendGraph {
* Draw horizontal black & grey grid lines.
*/
double yCoord = 0.0;
int hours = timeDur.getYCoordHours();
int hours = graphBounds.getYCoordValues();
for (int i = 0; i < hours; i++) {
gc.setForeground(display.getSystemColor(SWT.COLOR_GRAY));
@ -1225,7 +1258,7 @@ public class BasinTrendGraph {
/*
* 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) {
transparent = false;
gc.drawLine(newXCoord, 0, newXCoord, 6);
@ -2117,7 +2150,7 @@ public class BasinTrendGraph {
int x = 0;
int y = 0;
Double guid = this.getGuidForHour(timeDur.getHours());
Double guid = this.getGuidForHour(graphBounds.getHours());
ArrayList<Double> timesArray = new ArrayList<Double>(getQPEGraphTimes());
double offset = getQPEValueNearStartTimeOffset();
@ -2284,7 +2317,7 @@ public class BasinTrendGraph {
int x = 0;
int y = 0;
Double guid = this.getGuidForHour(timeDur.getHours());
Double guid = this.getGuidForHour(graphBounds.getHours());
ArrayList<Double> timesArray = new ArrayList<Double>(getQPEGraphTimes());
double offset = getQPEValueNearStartTimeOffset();
@ -2423,8 +2456,8 @@ public class BasinTrendGraph {
double maxGuid = Double.MIN_VALUE;
if (timesArray.contains((double) timeDur.getHours()) == true) {
maxGuid = graphData.getGuid((double) timeDur.getHours());
if (timesArray.contains((double) graphBounds.getHours()) == true) {
maxGuid = graphData.getGuid((double) graphBounds.getHours());
if (Double.isNaN(maxGuid) == true || maxGuid < 0.0) {
return;
@ -2492,7 +2525,7 @@ public class BasinTrendGraph {
* @return Array of QPE graph times.
*/
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
@ -2523,7 +2556,7 @@ public class BasinTrendGraph {
* @return Array of QPE graph times.
*/
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
@ -2598,8 +2631,8 @@ public class BasinTrendGraph {
graphImageHeight = graphViewHeight;
}
pixPerInc_XCoord = graphImageWidth / (double) timeDur.getHours();
pixPerInc_YCoord = graphImageHeight / (double) timeDur.getYCoordHours();
pixPerInc_XCoord = graphImageWidth / (double) graphBounds.getHours();
pixPerInc_YCoord = graphImageHeight / (double) graphBounds.getYCoordValues();
}
/**
@ -2611,17 +2644,6 @@ public class BasinTrendGraph {
graphCanvas.redraw();
}
/**
* Redraw the left side canvas.
*/
private void redrawLeftRightIncCanvases() {
this.createLeftIncImage();
leftIncCanvas.redraw();
this.createRightIncImage();
rightIncCanvas.redraw();
}
/**
* Redraw the bottom increment canvas.
*/
@ -2734,17 +2756,11 @@ public class BasinTrendGraph {
*/
public void setGraphData(FFMPGraphData graphData) {
// System.out.println("in BasinTrendGraph.setGraphData");
this.graphData = graphData;
redrawGraphCanvas();
// This should correctly update the increment labels when new data comes
// in.
redrawLeftRightIncCanvases();
// Update the bottom time canvas.
redrawBottomIncCanvas();
determineGraphBounds();
recalcPixelsIncrements();
regenerateImages();
redrawAllCanvases();
}
/**
@ -2789,4 +2805,19 @@ public class BasinTrendGraph {
redrawGraphCanvas();
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.FFMPGuidanceInterpolation;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPRecord;
import com.raytheon.uf.common.dataplugin.ffmp.FFMPTemplates;
import com.raytheon.uf.common.monitor.config.FFFGDataMgr;
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/22/13 1902 mpduff Added methods to get forced values.
* 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>
*
@ -118,6 +120,14 @@ public class FFFGForceUtil {
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,
List<Long> pfafList, String domain) {
boolean forced = false;
@ -219,6 +229,13 @@ public class FFFGForceUtil {
return retVal;
}
/**
* Get list of forced FFG basins
* @param source
* @param pfafList2
* @param ft
* @return
*/
private ArrayList<Long> getForcedBasins(String source,
List<Long> pfafList2, FFMPTemplates ft) {
FFFGDataMgr fdm = FFFGDataMgr.getInstance();
@ -247,6 +264,15 @@ public class FFFGForceUtil {
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,
FFMPGuidanceInterpolation interpolation, long expiration,
FFMPTemplates templates) {
@ -267,10 +293,8 @@ public class FFFGForceUtil {
return tvalue / i;
} 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,
interpolation.getStandardSource(), pfaf, countyFips);
if (value < tvalue) {
if (value > tvalue) {
tvalue = value;
}
}
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,
List<Long> forcedPfafs,
FFMPGuidanceInterpolation ffmpGuidanceInterpolation,
long guidSourceExpiration, FFMPTemplates ft) {
long guidSourceExpiration, FFMPTemplates ft, String huc) {
List<Float> guidList = new ArrayList<Float>();
if (pfafList != null) {
for (Long pfaf : pfafList) {
if (pfaf == null) {
continue;
if (huc.equals(FFMPRecord.ALL) || huc.equals(FFMPRecord.COUNTY)) {
// Add all pfafs in list
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);
}
List<Long> pl = new ArrayList<Long>();
pl.add(pfaf);
float val = getAvgForcedValue(pl, forcedPfafs,
ffmpGuidanceInterpolation, guidSourceExpiration, ft);
guidList.add(val);
}
} else {
// Only add aggregate value to guidList for numbered hucs (second pfaf in list for forcing).
if (pfafList.get(1) != null) {
List<Long> pl = new ArrayList<Long>();
pl.add(pfafList.get(1));
float val = getAvgForcedValue(pl, forcedPfafs,
ffmpGuidanceInterpolation, guidSourceExpiration, ft);
guidList.add(val);
}
}
}
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
* 02/01/13 1569 D. Hladky Added constants
* Oct 10, 2015 4756 dhladky Max value method.
*
* </pre>
*
@ -350,4 +351,40 @@ public class FFMPGraphData {
public void setQpfValue(Float 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();
timer.start();
FfmpTableConfig tableConfig = FfmpTableConfig.getInstance();
String ffgGraphType = tableConfig.getTableConfigData(getSiteKey())
.getFfgGraphType();
String ffgGraphType = tableConfig.getTableConfigData(getSiteKey()).getFfgGraphType();
Long basinPfaf = null;
Long dataId = null;
FFMPVirtualGageBasinMetaData fvgbmd = null;
FFMPBasin basin = null;
// System.out.println("*************************************************");
try {
basinPfaf = Long.parseLong(pfafString);
dataId = basinPfaf;
@ -3210,12 +3207,7 @@ public class FFMPResource extends
}
FFMPBasinMetaData mBasin = monitor.getTemplates(getSiteKey()).getBasin(
getSiteKey(), basinPfaf); /*
* TODO: mBasin is never used so it is
* not clear if this should be
* basinPfaf or dataId
*/
getSiteKey(), basinPfaf);
FFMPGraphData fgd = null;
// VGB
if (fvgbmd != null) {
@ -3237,8 +3229,8 @@ public class FFMPResource extends
Date oldestRefTime = getOldestTime();
Date mostRecentRefTime = getPaintTime().getRefTime();
Date barrierTime = getTableTime();// DR 16148
Date minUriTime = getTimeOrderedKeys().get(0);// DR 16148
Date barrierTime = getTableTime();
Date minUriTime = getTimeOrderedKeys().get(0);
// grabs the basins we need
try {
@ -3267,7 +3259,7 @@ public class FFMPResource extends
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing RATE dataset.");
"FFMPMonitor: getGraphData(): missing RATE dataset.", e);
}
try {
qpeBasin = monitor.getGraphQPEBasin(getProduct(), getSiteKey(),
@ -3300,7 +3292,7 @@ public class FFMPResource extends
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing QPE dataset.");
"FFMPMonitor: getGraphData(): missing QPE dataset.", e);
}
try {
@ -3324,25 +3316,15 @@ public class FFMPResource extends
double dtime = FFMPGuiUtils.getTimeDiff(mostRecentRefTime,
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));
qpfTimes.add(dtime);
// System.out.println("Have a time for QPF: " + dtime
// + " value: " + (double) qpfBasin.getValue(date));
}
}
fgd.setQpfTimes(qpfTimes);
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing QPF dataset.");
"FFMPMonitor: getGraphData(): missing QPF dataset.", e);
}
FFMPGuidanceInterpolation guidanceInterpolator = new FFMPGuidanceInterpolation(
@ -3354,7 +3336,7 @@ public class FFMPResource extends
try {
guidBasin = (FFMPGuidanceBasin) monitor.getGraphGuidanceBasin(
getProduct(), getSiteKey(), getDataKey(), null,
getProduct(), ffgGraphType, getSiteKey(), getDataKey(), null,
oldestRefTime, FFMPRecord.ALL, basinPfaf);
ArrayList<Double> guidTimes = new ArrayList<Double>();
for (SourceXML ffgSource : getProduct().getGuidanceSourcesByType(
@ -3377,7 +3359,7 @@ public class FFMPResource extends
guid = true;
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"FFMPMonitor: getGraphData(): missing GUIDANCE dataset.");
"FFMPMonitor: getGraphData(): missing GUIDANCE dataset.", e);
}
if (fvgbmd != null) {
@ -3389,10 +3371,6 @@ public class FFMPResource extends
mostRecentRefTime);
if (virtualBasin != null) {
// System.out.println("VGB DATA EXISTS! " + pfaf +
// " "
// + lid);
SortedSet<Date> vgbTimes = new TreeSet<Date>(virtualBasin
.getValues().descendingKeySet());
@ -3409,7 +3387,7 @@ public class FFMPResource extends
} catch (Exception e) {
statusHandler
.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);
}
// 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.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.FFMPBasinMetaData;
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.FIELDS;
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
* Jul 15, 2013 2184 dhladky Remove all HUC's for storage except ALL
* Apr 30, 2014 2060 njensen Safety checks for null guidance
* Oct 12, 2015 4948 dhladky Improved forced FFG handling.
*
* </pre>
*
@ -594,6 +594,7 @@ public class FFMPRowGenerator implements Runnable {
// run over each guidance type
int i = 0;
for (String guidType : guidBasins.keySet()) {
guidance = Float.NaN;
diffValue = Float.NaN;
ratioValue = Float.NaN;
@ -690,7 +691,7 @@ public class FFMPRowGenerator implements Runnable {
resource.getGuidanceInterpolators().get(
guidType), resource
.getGuidSourceExpiration(guidType),
ft);
ft, huc);
}
if ((!qpes.isEmpty())
@ -927,84 +928,8 @@ public class FFMPRowGenerator implements Runnable {
}
}
} else {
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;
// 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));
}
guidance = forceUtil.getInterpolatedForcedValue(ft, cBasinPfaf,
guidType);
}
return new FFMPTableCellData(FIELDS.GUIDANCE, guidance, forced);

View file

@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.regex.Pattern;
import org.eclipse.core.runtime.IStatus;
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.Shell;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
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.config.FSSObsMonitorConfigurationManager;
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.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
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.Monitor;
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 23, 2014 3356 njensen Remove unnecessary import
* 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>
*
@ -139,34 +136,19 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
private final TableData stationTableData = new TableData(
CommonConfig.AppName.FOG);
/** All FOG's datauri start with this **/
private final String OBS = "fssobs";
/** List of fogAlg listeners **/
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 FogMonitor() {
pluginPatterns.add(fogPattern);
pluginPatterns.add(fssPattern);
fogConfig = FSSObsMonitorConfigurationManager.getInstance(MonName.fog);
updateMonitoringArea();
initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
obData.setThresholdMgr(FogThresholdMgr.getInstance());
createDataStructures();
processProductAtStartup();
obData.getZoneTableData();
readTableConfig(MonitorThresholdConfiguration.FOG_THRESHOLD_CONFIG);
}
@ -180,12 +162,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
if (monitor == null) {
monitor = new FogMonitor();
// Pre-populate dialog with an observations from DB
monitor.createDataStructures();
monitor.getAdjAreas();
monitor.processProductAtStartup(MonName.fog.name());
monitor.fireMonitorEvent(monitor);
}
return monitor;
}
@ -209,10 +187,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
// [Jan 21, 2010, zhao]
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
obData.setThresholdMgr(FogThresholdMgr.getInstance());
obsData = new ObsData();
algorithmData = new TreeMap<Date, Map<String, FOG_THREAT>>();
for (String zone : MonitoringArea.getPlatformMap().keySet()) {
obsData.addArea(zone, MonitoringArea.getPlatformMap().get(zone));
}
@ -251,7 +227,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
*/
@Override
public void processProductMessage(final AlertMessage filtered) {
if (fogPattern.matcher(filtered.dataURI).matches()) {
if (fssPattern.matcher(filtered.dataURI).matches()) {
processURI(filtered.dataURI, filtered);
}
}
@ -264,7 +240,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
* -- the xml configuration filename
*/
public void readTableConfig(String file) {
// TODO update for Maritime
Map<String, List<String>> zones = new HashMap<String, List<String>>();
// create zones and stations list
try {
@ -594,35 +569,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
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)
*
@ -633,9 +579,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
@Override
protected void processAtStartup(ObReport 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);
}
}

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.fog.threshold;
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.ObConst.DataUsageKey;
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()
* May 20, 2014 3086 skorolev Cleaned code.
* 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>
*
@ -60,10 +58,7 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
*/
private FogThresholdMgr() {
super("DefaultFogDisplayThresholds.xml",
"DefaultFogMonitorThresholds.xml", AppName.FOG.name()
.toLowerCase());
areaConfigMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.fog);
"DefaultFogMonitorThresholds.xml", AppName.FOG);
init();
}
@ -76,7 +71,6 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
if (classInstance == null) {
classInstance = new FogThresholdMgr();
}
return classInstance;
}
@ -120,19 +114,4 @@ public class FogThresholdMgr extends AbstractThresholdMgr {
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();
}
}
/**
* DR#11279: re-initialize threshold manager and the monitor
* using new monitor area configuration
*/
fireConfigUpdateEvent();
resetStatus();
} 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.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* 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>
*
@ -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)
*
@ -220,7 +197,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
@Override
public void fireDialogShutdown(IMonitorListener iml) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Iterator<IMonitor> iter = getMonitorControlListeners()
.iterator();
@ -241,7 +217,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
@Override
public void fireKillMonitor() {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
Iterator<IMonitor> iter = getMonitorControlListeners()
.iterator();
@ -309,7 +284,6 @@ public class FogZoneTableDlg extends ZoneTableDlg {
if (configMgr == null || configMgr.isPopulated()) {
configMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.fog);
configMgr.setPopulated(false);
}
return configMgr;
}

View file

@ -25,26 +25,22 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
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.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.config.FSSObsMonitorConfigurationManager;
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.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
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.Monitor;
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
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* 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>
*
@ -127,12 +123,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
private final TableData stationTableData = new TableData(
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 **/
private final List<ISSResourceListener> safeSeasResources = new ArrayList<ISSResourceListener>();
@ -145,32 +135,21 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
/** data holder for FOG data **/
private Map<Date, Map<String, FOG_THREAT>> algorithmData = null;
/** Adjacent areas for current cwa **/
private Geometry geoAdjAreas;
/** List of fogAlg listeners **/
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 SafeSeasMonitor() {
pluginPatterns.add(ssPattern);
pluginPatterns.add(fssPattern);
ssAreaConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss);
updateMonitoringArea();
initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS);
obData.setThresholdMgr(SSThresholdMgr.getInstance());
obData.getZoneTableData();
createDataStructures();
processProductAtStartup();
readTableConfig(MonitorThresholdConfiguration.SAFESEAS_THRESHOLD_CONFIG);
}
/**
@ -179,10 +158,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
public static synchronized SafeSeasMonitor getInstance() {
if (monitor == null) {
monitor = new SafeSeasMonitor();
// Pre-populate dialog with an observation (METAR) for KOMA
monitor.createDataStructures();
monitor.getAdjAreas();
monitor.processProductAtStartup("ss");
monitor.fireMonitorEvent(monitor);
}
return monitor;
@ -207,6 +182,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
private void createDataStructures() {
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS);
obData.setThresholdMgr(SSThresholdMgr.getInstance());
obData.getZoneTableData();
algorithmData = new HashMap<Date, Map<String, FOG_THREAT>>();
}
@ -275,7 +251,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
*/
@Override
public void processProductMessage(final AlertMessage filtered) {
if (ssPattern.matcher(filtered.dataURI).matches()) {
if (fssPattern.matcher(filtered.dataURI).matches()) {
processURI(filtered.dataURI, filtered);
}
}
@ -596,36 +572,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
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
*
@ -687,5 +633,4 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
}
MonitoringArea.setPlatformMap(zones);
}
}

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.safeseas.threshold;
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.ObConst.DataUsageKey;
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().
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* 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>
*
@ -58,10 +56,7 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
*/
public SSThresholdMgr() {
super("DefaultSSDisplayThresholds.xml",
"DefaultSSMonitorThresholds.xml", AppName.SAFESEAS.name()
.toLowerCase());
areaConfigMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss);
"DefaultSSMonitorThresholds.xml", AppName.SAFESEAS);
init();
}
@ -116,18 +111,4 @@ public class SSThresholdMgr extends AbstractThresholdMgr {
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();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitoringAreaConfigDlg#
* handleOkBtnSelection()
*/
@Override
protected void handleOkBtnSelection() throws LocalizationException,
SerializationException, IOException {

View file

@ -57,8 +57,8 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* Nov 10, 2012 1297 skorolev Added initiateProdArray
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Aug 26, 2015 3841 skorolev Corrected getMonitorAreaConfigInstance().
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Sep 18, 2015 3873 skorolev Adjusted to AppName and MonName.
*
* </pre>
*
@ -71,8 +71,7 @@ public class SSZoneTableDlg extends ZoneTableDlg {
private SSDispMonThreshDlg ssThreshDlg;
/** Swell column names in the zone and station table. **/
private final String[] ssSwellCols = { "SSZT_SwellPeriod",
"SSZT_Swell2Period" };
private String[] ssSwellCols = { "SSZT_SwellPeriod", "SSZT_Swell2Period" };
/**
* Constructor (Dec 30, 2009, zhao)
@ -162,8 +161,7 @@ public class SSZoneTableDlg extends ZoneTableDlg {
Map<String, FOG_THREAT> fogAlgThreats = monitor
.getAlgorithmData(nominalTime);
obData.setFogAlgCellType(monitor.getAlgCellTypes(fogAlgThreats));
this.updateTableDlg(monitor.getObData().getObHourReports(
nominalTime));
this.updateTableDlg(obData.getObHourReports(nominalTime));
}
}
}
@ -333,7 +331,6 @@ public class SSZoneTableDlg extends ZoneTableDlg {
if (configMgr == null || configMgr.isPopulated()) {
configMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss);
configMgr.setPopulated(false);
}
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.
* 15 Aug 2013 2143 mpduff Remove resize.
* 12 Oct 2015 4929 rferrel Properly set up dialog when rateOfChangeRdo selected.
* </pre>
*
* @author
@ -243,7 +244,9 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
rateOfChangeRdo.addSelectionListener(new SelectionAdapter() {
@Override
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
* ------------ ---------- ----------- --------------------------
* Dec 2, 2010 mnash Initial creation
*
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
* Apr 18, 2013 1926 njensen Update for Long keys
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
* Apr 18, 2013 1926 njensen Update for Long keys
* Oct 12, 2015 4929 rferrel Ingore unset alarm values in calculateScanCells.
*
* </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 Map<String, Map<ScanTables, List<ScheduledAlarms>>> scheduledAlarmsMap;
@ -171,7 +176,7 @@ public class SCANAlarmAlertManager {
for (ScheduledAlarms alarm : scheduledAlarmsMap.get(site)
.get(tableType)) {
int index = config.getColumnIndex(tableType, alarm.colName);
if (index == -1) {
if ((alarm.value == NO_ALARM_VALUE) || (index == -1)) {
continue;
}
int row = 0;
@ -215,21 +220,18 @@ public class SCANAlarmAlertManager {
Set<Long> cellData = monitor.cellData.get(site)
.keySet();
Date previous = null;
if (!cellData.isEmpty()) {
if (!cellData.isEmpty() && (cellData.size() > 1)) {
Date[] times = new Date[cellData.size()];
Iterator<Long> itr = cellData.iterator();
for (int i = 0; i < times.length; i++) {
times[i] = new Date(itr.next());
}
if (times.length > 1) {
Arrays.sort(times);
previous = times[times.length - 2];
ScanTableData<?> tableDataPrev = monitor
.getTableData(tableType, site, previous);
getScanTableDiff(data, tableDataPrev,
tableType, colLength, sdg, alarm,
config, latestTime);
}
Arrays.sort(times);
previous = times[times.length - 2];
ScanTableData<?> tableDataPrev = monitor
.getTableData(tableType, site, previous);
getScanTableDiff(data, tableDataPrev, tableType,
colLength, sdg, alarm, config, latestTime);
}
}
}

View file

@ -25,18 +25,16 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
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.MonName;
import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
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.Monitor;
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
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* 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>
*
@ -104,13 +102,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
* This object contains all observation data necessary for the table dialogs
* and trending plots
*/
private final ObMultiHrsReports obData;
/** All SNOW datauri start with this */
private final String OBS = "fssobs";
/** regex wild card filter */
private final String wildCard = "[\\w\\(\\)-_:.]+";
private ObMultiHrsReports obData;
/** Time which Zone/County dialog shows. **/
private Date dialogTime = null;
@ -118,23 +110,20 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
/** Array of snow listeners **/
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 SnowMonitor() {
pluginPatterns.add(snowPattern);
pluginPatterns.add(fssPattern);
snowConfig = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow);
updateMonitoringArea();
initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);
// Set up thresholds.
obData.setThresholdMgr(SnowThresholdMgr.getInstance());
// Retrieve existing data.
processProductAtStartup();
obData.getZoneTableData();
}
@ -146,7 +135,6 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
public static synchronized SnowMonitor getInstance() {
if (monitor == null) {
monitor = new SnowMonitor();
monitor.processProductAtStartup("snow");
monitor.fireMonitorEvent(monitor);
}
return monitor;
@ -238,7 +226,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
*/
@Override
public void processProductMessage(final AlertMessage filtered) {
if (snowPattern.matcher(filtered.dataURI).matches()) {
if (fssPattern.matcher(filtered.dataURI).matches()) {
processURI(filtered.dataURI, filtered);
}
}
@ -384,7 +372,6 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
*
* @param dialogTime
*/
@Override
public void updateDialogTime(Date dialogTime) {
this.dialogTime = dialogTime;
fireMonitorEvent(this);

View file

@ -21,8 +21,6 @@ package com.raytheon.uf.viz.monitor.snow.threshold;
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.ObConst.DataUsageKey;
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()
* May 21, 2014 3086 skorolev Cleaned code.
* 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>
*
@ -57,11 +55,7 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
*/
private SnowThresholdMgr() {
super("DefaultSnowDisplayThresholds.xml",
"DefaultSnowMonitorThresholds.xml", AppName.SNOW.name()
.toLowerCase());
areaConfigMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow);
"DefaultSnowMonitorThresholds.xml", AppName.SNOW);
init();
}
@ -116,18 +110,4 @@ public class SnowThresholdMgr extends AbstractThresholdMgr {
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 19, 2014 2757 skorolev Updated handlers for dialog buttons.
* Oct 27, 2014 3667 skorolev Cleaned code.
* Feb 10, 2015 3886 skorolev Changed confirmation message.
* Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection.
* Feb 10, 2015 3886 skorolev Changed confirmation message.
* Aug 17, 2015 3841 skorolev Corrected handleOkBtnSelection.
* </pre>
*
* @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
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* 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>
*
@ -141,7 +141,6 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
if (zoneTable.isDisposed()) {
return;
}
if (me.getSource() instanceof SnowMonitor) {
SnowMonitor monitor = (SnowMonitor) me.getSource();
Date date = monitor.getDialogTime();
@ -268,7 +267,6 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
if (configMgr == null || configMgr.isPopulated()) {
configMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.snow);
configMgr.setPopulated(false);
}
return configMgr;
}

View file

@ -23,6 +23,7 @@ import com.raytheon.uf.viz.monitor.data.ObReport;
* skorolev Initial creation
* May 15, 2012 14510 zhao Modified generateObReport()
* Jan 06, 2014 2653 skorolev Included SNOW data into ObReport.
* Sep 20, 2015 3873 skorolev Added IsStationary and getReportType.
*
*
* </pre>
@ -46,10 +47,10 @@ public class GenerateFSSObReport {
public static ObReport generateObReport(PluginDataObject report) {
// Generate the observation report.
ObReport obReport = new ObReport();
FSSObsRecord metar = (FSSObsRecord) report;
FSSObsRecord fssData = (FSSObsRecord) report;
try {
obReport.setObservationTime(metar.getTimeObs().getTime());
obReport.setRefHour(metar.getRefHour().getTime());
obReport.setObservationTime(fssData.getTimeObs().getTime());
obReport.setRefHour(fssData.getRefHour().getTime());
} catch (Exception e) {
statusHandler
.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");
obReport.setTimesFromFssobDataURI(report.getDataURI());
}
obReport.setPlatformId(metar.getPlatformId());
obReport.setStationary(true);
obReport.setLatitude((float) metar.getLatitude());
obReport.setLongitude((float) metar.getLongitude());
obReport.setPlatformId(fssData.getPlatformId());
obReport.setStationary(fssData.getIsStationary());
obReport.setLatitude((float) fssData.getLatitude());
obReport.setLongitude((float) fssData.getLongitude());
// Table data:
obReport.setCeiling(metar.getCeiling());
obReport.setWindDir(metar.getWindDir());
obReport.setWindSpeed(metar.getWindSpeed());
obReport.setMaxWindSpeed(metar.getMaxWindSpeed());
obReport.setWindGust(metar.getWindGust());
obReport.setRelativeHumidity(metar.getRelativeHumidity());
obReport.setCeiling(fssData.getCeiling());
obReport.setWindDir(fssData.getWindDir());
obReport.setWindSpeed(fssData.getWindSpeed());
obReport.setMaxWindSpeed(fssData.getMaxWindSpeed());
obReport.setWindGust(fssData.getWindGust());
obReport.setRelativeHumidity(fssData.getRelativeHumidity());
try {
obReport.setVisibility(metar.getVisibility());
obReport.setVisibility(fssData.getVisibility());
} catch (Exception e) {
obReport.setVisibility(0);
}
obReport.setDewpoint(metar.getDewpoint());
obReport.setTemperature(metar.getTemperature());
obReport.setDewpointDepr(metar.getDewpointDepr());
obReport.setDewpoint(fssData.getDewpoint());
obReport.setTemperature(fssData.getTemperature());
obReport.setDewpointDepr(fssData.getDewpointDepr());
obReport.setPresentWx(getPrWX(metar.getPresWeather()));
obReport.setPresentWx(getPrWX(fssData.getPresWeather()));
obReport.setHighResWaveHeight(ObConst.MISSING);
obReport.setWaveSteepness(metar.getWaveSteepness());
obReport.setWaveSteepness(fssData.getWaveSteepness());
obReport.setSeaLevelPress(metar.getSeaLevelPress());
obReport.setWavePeriod(metar.getWavePeriod());
obReport.setWindGust(metar.getWindGust());
obReport.setPSwellHeight(metar.getPrimarySwellWaveHeight().floatValue());
obReport.setPSwellPeriod(metar.getPrimarySwellWavePeriod());
obReport.setPSwellDir(metar.getPrimarySwellWaveDir().floatValue());
obReport.setSSwellHeight(metar.getSecondarySwellWaveHeight()
obReport.setSeaLevelPress(fssData.getSeaLevelPress());
obReport.setWavePeriod(fssData.getWavePeriod());
obReport.setWindGust(fssData.getWindGust());
obReport.setPSwellHeight(fssData.getPrimarySwellWaveHeight()
.floatValue());
obReport.setSSwellPeriod(metar.getSecondarySwellWavePeriod());
obReport.setSSwellDir(metar.getSecondarySwellWaveDir().floatValue());
obReport.setPressure(metar.getPressureAltimeter());
obReport.setPressureChange(metar.getPressChange3Hour());
obReport.setPSwellPeriod(fssData.getPrimarySwellWavePeriod());
obReport.setPSwellDir(fssData.getPrimarySwellWaveDir().floatValue());
obReport.setSSwellHeight(fssData.getSecondarySwellWaveHeight()
.floatValue());
obReport.setSSwellPeriod(fssData.getSecondarySwellWavePeriod());
obReport.setSSwellDir(fssData.getSecondarySwellWaveDir().floatValue());
obReport.setPressure(fssData.getPressureAltimeter());
obReport.setPressureChange(fssData.getPressChange3Hour());
try {
obReport.setPressChangeChar(Short.parseShort(metar
obReport.setPressChangeChar(Short.parseShort(fssData
.getPressChangeChar()));
} catch (NumberFormatException e) {
obReport.setPressChangeChar((short) 0);
}
obReport.setHourlyPrecip(metar.getHourlyPrecip());
obReport.setHourlyPrecip(fssData.getHourlyPrecip());
obReport.setRawMessage(metar.getRawMessage());
obReport.setReportType(ReportType.METAR);
obReport.setSnincrHourly(metar.getSnincrHourly());
obReport.setSnincrTotal(metar.getSnincrTotal());
obReport.setFrostbiteTime(metar.getFrostbiteTime());
obReport.setWindChill(metar.getWindChill());
obReport.setSnowDepth(metar.getSnowDepth());
obReport.setSeaSurfaceTemp(metar.getSeaSurfaceTemp());
obReport.setRawMessage(fssData.getRawMessage());
ReportType reportType = getReportType(fssData.getReportType());
obReport.setReportType(reportType);
obReport.setSnincrHourly(fssData.getSnincrHourly());
obReport.setSnincrTotal(fssData.getSnincrTotal());
obReport.setFrostbiteTime(fssData.getFrostbiteTime());
obReport.setWindChill(fssData.getWindChill());
obReport.setSnowDepth(fssData.getSnowDepth());
obReport.setSeaSurfaceTemp(fssData.getSeaSurfaceTemp());
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.
*

View file

@ -24,10 +24,10 @@ import java.util.Collection;
import java.util.Iterator;
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.alerts.AlertMessage;
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.listeners.IMonitorConfigurationListener;
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.
* 3/2/2009 2047 grichard Added stationId resolution method.
* 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>
*
* @author dhladky
@ -199,7 +201,6 @@ public abstract class Monitor implements IMonitor, IMonitorThresholdListener,
final Monitor fmonitor = this;
final String ftype = type;
// System.out.println("Listener class: "+type);
VizApp.runAsync(new Runnable() {
public void run() {

View file

@ -28,11 +28,15 @@ import java.util.regex.Pattern;
import org.eclipse.swt.widgets.Display;
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.fssobs.FSSObsRecord;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecordTransform;
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.jms.notification.NotificationMessage;
import com.raytheon.uf.common.monitor.data.AdjacentWfoMgr;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.status.IUFStatusHandler;
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.exception.VizException;
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.monitor.data.MonitoringArea;
import com.raytheon.uf.viz.monitor.data.ObReport;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
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
* May 08, 2014 3086 skorolev Added current site definition.
* Sep 04, 2014 3220 skorolev Removed cwa and monitorUsefrom vals.
* Sep 18, 2015 3873 skorolev Included common definitions.
*
* </pre>
*
@ -106,6 +110,39 @@ public abstract class ObsMonitor extends Monitor {
/** Current CWA **/
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
*
@ -199,20 +236,13 @@ public abstract class ObsMonitor extends Monitor {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
try {
// Filter removed stations
ArrayList<String> zones = MonitoringArea
.getZoneIds(objectToSend
.getPlatformId());
if (!zones.isEmpty()) {
ObReport result = GenerateFSSObReport
.generateObReport(objectToSend);
statusHandler
.handle(Priority.INFO,
"New FSSrecord ===> "
+ objectToSend
.getDataURI());
process(result);
}
ObReport result = GenerateFSSObReport
.generateObReport(objectToSend);
statusHandler.handle(
Priority.INFO,
"New FSSrecord ===> "
+ objectToSend.getDataURI());
process(result);
} catch (Exception e) {
statusHandler
.handle(Priority.PROBLEM,
@ -240,7 +270,7 @@ public abstract class ObsMonitor extends Monitor {
* @param monitorName
*
*/
public void processProductAtStartup(String monitorName) {
public void processProductAtStartup() {
/**
* 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);
for (FSSObsRecord objectToSend : obsRecords) {
// Filter removed stations
ArrayList<String> zones = MonitoringArea
.getZoneIds(objectToSend.getPlatformId());
if (!zones.isEmpty()) {
ObReport result = GenerateFSSObReport
.generateObReport(objectToSend);
processAtStartup(result);
}
ObReport result = GenerateFSSObReport
.generateObReport(objectToSend);
processAtStartup(result);
}
}
} catch (DataCubeException e) {
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);
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 com.raytheon.uf.common.jms.notification.NotificationMessage;
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.IMonitorThresholdEvent;
@ -36,7 +36,8 @@ import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
*
* 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>
*

View file

@ -21,16 +21,24 @@ package com.raytheon.uf.viz.monitor.data;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
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.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.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
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
@ -40,14 +48,14 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec. 1, 2009 3424 zhao Initial creation.
* Oct.29, 2012 1297 skorolev Changed HashMap to Map
* Oct.31 2012 1297 skorolev Cleaned code.
* Sep 04 2014 3220 skorolev Added updateZones method.
* 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>
*
@ -62,19 +70,26 @@ public class ObHourReports {
/**
* the nominal time of this ObHourReports object
*/
private final Date nominalTime;
private Date nominalTime;
/**
* application name (SNOW, FOG, SAFESEAS)
*/
private final CommonConfig.AppName appName;
private CommonConfig.AppName appName;
/**
* 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
@ -86,10 +101,12 @@ public class ObHourReports {
this.nominalTime = nominalTime;
this.appName = appName;
this.thresholdMgr = thresholdMgr;
configMgr = this.thresholdMgr.getCfgMgr();
hourReports = new HashMap<String, ObZoneHourReports>();
Map<String, List<String>> zoneStationMap = MonitoringArea
.getPlatformMap();
for (String zone : zoneStationMap.keySet()) {
zones.clear();
zones.addAll(configMgr.getAreaList());
for (String zone : zones) {
hourReports.put(zone, new ObZoneHourReports(nominalTime, zone,
appName, thresholdMgr));
}
@ -102,28 +119,80 @@ public class ObHourReports {
*/
public void addReport(ObReport report) {
String station = report.getPlatformId();
List<String> zones = MonitoringArea.getZoneIds(station);
if (zones.size() == 0) {
statusHandler
.error("Error: station: "
+ station
+ " is not associated with any zone in the monitoring area");
return;
List<String> stationZones = configMgr.getAreaByStationId(station);
// If station has no associated zone:
if (stationZones.isEmpty()) {
if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
// Associate moving platform with monitoring zones
double shipDist = configMgr.getShipDistance();
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;
for (String zone : zones) {
// Add station report to all associated zones.
for (String zone : stationZones) {
if (hourReports.containsKey(zone)) {
hasZone = true;
hourReports.get(zone).addReport(report);
}
}
if (hasZone == false) {
statusHandler
.error("Error in addreport() of ObHourReports: unable to add obs report to data archive");
}
return;
}
/**
* 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
*/
public Map<String, ObZoneHourReports> getHourReports() {
@ -187,8 +256,8 @@ public class ObHourReports {
}
/**
* Returns the ObZoneHourReports object of a caller-specified zone. If such
* object not available, returns null.
* Gets ObZoneHourReports Returns the ObZoneHourReports object of a
* caller-specified zone. If such object not available, returns null.
*
* @param zone
* @return hour reports
@ -201,6 +270,8 @@ public class ObHourReports {
}
/**
* Gets NominalTime
*
* @return nominalTime
*/
public Date getNominalTime() {
@ -208,6 +279,8 @@ public class ObHourReports {
}
/**
* Gets AppName
*
* @return appName
*/
public CommonConfig.AppName getAppName() {
@ -216,51 +289,79 @@ public class ObHourReports {
/**
* Updates zones in the Hour Reports
*
* @param configMgr
*/
public void updateZones() {
Map<String, List<String>> zoneStationMap = MonitoringArea
.getPlatformMap();
// remove zones or stations
List<String> hourZones = new CopyOnWriteArrayList<String>(
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);
}
}
}
// Updated list of zones
List<String> updtZones = configMgr.getAreaList();
// remove zones
hourReports.keySet().retainAll(updtZones);
// add zones
for (String zone : zoneStationMap.keySet()) {
List<String> stations = new CopyOnWriteArrayList<String>(
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)) {
for (String zone : updtZones) {
if (!hourReports.keySet().contains(zone)) {
hourReports.put(zone, new ObZoneHourReports(nominalTime, zone,
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.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
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.AppName;
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.util.TimeUtil;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.CellType;
import com.raytheon.uf.viz.monitor.config.CommonTableConfig.ObsHistType;
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 24, 2009 3424 zhao added getTrendDataSet() that returns ObTrendDataSet object
* Jan 25, 2010 4281, 3888, 3877 wkwock/zhao added getHistTableData method
* Oct.31, 2012 1297 skorolev Clean code.
* Jan. 29, 2013 15654 zhao add Wind Chill calculation for SNOW
* Sep 04, 2014 3220 skorolev Updated getStationTableData method.
*
* Oct 31, 2012 1297 skorolev Clean code.
* Jan 29, 2013 15654 zhao add Wind Chill calculation for SNOW
* Sep 04, 2014 3220 skorolev Updated getStationTableData method.
* Sep 25, 2015 3873 skorolev Added multiHrsTabData.
*
* </pre>
*
* @author zhao
@ -61,6 +69,8 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
*/
public class ObMultiHrsReports {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(ObMultiHrsReports.class);
/**
* Thresholds manager
@ -78,17 +88,18 @@ public class ObMultiHrsReports {
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
* are to be archived. TODO: move MAX_FRAMES to a configuration file?
* Monitor Table data cache. Key is nominal time, value is TableData
*/
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
@ -97,28 +108,16 @@ public class ObMultiHrsReports {
*/
public ObMultiHrsReports(CommonConfig.AppName appName) {
this.appName = appName;
multiHrsReports = new TreeMap<Date, ObHourReports>();
if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
initFogAlgCellType();
}
}
/**
* Add an array of ObReport objects to the ObMultiHrsReports object (Don't
* use! VK)
*
* @param result
*/
public void addReports(ObReport[] results) {
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);
if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
if (appName.equals(AppName.FOG)) {
cfgMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.fog);
} else if (appName.equals(AppName.SAFESEAS)) {
cfgMgr = FSSObsMonitorConfigurationManager
.getInstance(MonName.ss);
}
addReport(report);
initFogAlgCellType();
}
}
@ -129,8 +128,6 @@ public class ObMultiHrsReports {
* @return returns multiHrsReports
*/
public void addReport(ObReport report) {
// Date nominalTime = TableUtil
// .getNominalTime(report.getObservationTime());
Date nominalTime = report.getRefHour();
/**
* 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
*/
if ( appName == AppName.SNOW ) {
if ( report.getTemperature() != ObConst.MISSING && report.getWindSpeed() != ObConst.MISSING ) {
report.setWindChill(calcWindChill( report.getTemperature(), report.getWindSpeed() ));
if (appName == AppName.SNOW) {
if (report.getTemperature() != ObConst.MISSING
&& report.getWindSpeed() != ObConst.MISSING) {
report.setWindChill(calcWindChill(report.getTemperature(),
report.getWindSpeed()));
}
}
if (multiHrsReports.containsKey(nominalTime)) {
multiHrsReports.get(nominalTime).addReport(report);
ObHourReports obHourReports;
// new nominal time; create a new ObHourReports object
if (multiHrsReports.isEmpty()
|| !multiHrsReports.containsKey(nominalTime)) {
obHourReports = new ObHourReports(nominalTime, appName,
thresholdMgr);
} else {
// new nominal time; create a new ObHourReports object
// the map is full; delete the oldest entry
if (multiHrsReports.size() >= maxFrames) {
// the map is full; delete the oldest entry
multiHrsReports.remove(multiHrsReports.firstKey());
}
ObHourReports obHourReports = new ObHourReports(nominalTime,
appName, thresholdMgr);
obHourReports.addReport(report);
multiHrsReports.put(nominalTime, obHourReports);
// update multiHrsReports with new data
obHourReports = multiHrsReports.get(nominalTime);
}
obHourReports.addReport(report);
// update data cache
multiHrsReports.put(nominalTime, obHourReports);
TableData tblData = obHourReports.getZoneTableData();
multiHrsTabData.put(nominalTime, tblData);
}
/**
* DR 15654:
* Wind Chill calculation formula based on
* http://www.nws.noaa.gov/om/windchill/
* as of Jan. 29, 2013
*
* @param temperature in degree F
* @param windSpeed in knots
* @return wind chill in degree F
*/
private float calcWindChill(float temp, float windSpd) {
if ( temp > 50.0 || windSpd < 3.0 ) {
return ObConst.MISSING;
}
/**
* 1 knots = 1.15078 mph
*/
float spd = (float) Math.pow(1.15078*windSpd, 0.16);
return 35.74f + 0.6215f*temp - 35.75f*spd + 0.4275f*temp*spd;
}
/**
* DR 15654: Wind Chill calculation formula based on
* http://www.nws.noaa.gov/om/windchill/ as of Jan. 29, 2013
*
* @param temp
* in degree F
* @param windSpd
* in knots
* @return wind chill in degree F
*/
private float calcWindChill(float temp, float windSpd) {
if (temp > 50.0 || windSpd < 3.0) {
return ObConst.MISSING;
}
/**
* 1 knots = 1.15078 mph
*/
float spd = (float) Math.pow(1.15078 * windSpd, 0.16);
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
* available (the map is empty), returns an empty zone TableData object
* (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
* 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
* @return
*/
public TableData getZoneTableData(Date nominalTime) {
TableData tabData = null;
if (nominalTime == null || !multiHrsReports.containsKey(nominalTime)) {
return getEmptyZoneTableData();
}
if (appName == AppName.FOG) {
return this.getObHourReports(nominalTime).getFogZoneTableData(
tabData = this.getObHourReports(nominalTime).getFogZoneTableData(
fogAlgCellType);
}
if (appName == AppName.SAFESEAS) {
return this.getObHourReports(nominalTime).getSSZoneTableData(
} else if (appName == AppName.SAFESEAS) {
tabData = this.getObHourReports(nominalTime).getSSZoneTableData(
fogAlgCellType);
}
return this.getObHourReports(nominalTime).getZoneTableData();
// return multiHrsReports.get(nominalTime).getZoneTableData();
} else {
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());
ObHourReports hourReports = new ObHourReports(nominalTime, appName,
thresholdMgr);
TableData tabData = null;
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
* data available, an empty/default station TableData object is returned
*
* @param zone
* @return
*/
public TableData getStationTableData(String zone) {
if (multiHrsReports.isEmpty()) {
@ -264,9 +284,13 @@ public class ObMultiHrsReports {
* Returns a station TableData object for a caller-specified nominal-time
* and zone ID. If no data available, an empty/default station TableData
* object is returned.
*
* @param nominalTime
* @param zone
* @return
*/
public TableData getStationTableData(Date nominalTime, String zone) {
if(zone.equals("")){
if (zone.equals("")) {
return this.getEmptyZoneTableData();
}
if (nominalTime == null) {
@ -296,6 +320,7 @@ public class ObMultiHrsReports {
* @param zone
* @param Station
* @param varName
* @param productName
* @return ObTrendDataSet object, or null if no data available
*/
public ObTrendDataSet getTrendDataSet(String zone, String station,
@ -304,81 +329,45 @@ public class ObMultiHrsReports {
if (multiHrsReports.isEmpty()) {
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
ObTrendDataSet trendData = new ObTrendDataSet(zone, varName,
productName, appName, thresholdMgr);
// trendData.setThresholdMgr(thresholdMgr);
Iterator<Date> nominalTimeIterator = multiHrsReports.keySet()
.iterator();
Date start = findStartNominalTime();
while (nominalTimeIterator.hasNext()) {
Date nominalTime = nominalTimeIterator.next();
if (nominalTime.compareTo(startNominalTime) >= 0) {
Set<Date> obsTimes = this.getObHourReports(nominalTime)
if (nominalTime.compareTo(start) >= 0) {
ObStnHourReports stnHrRpts = this.getObHourReports(nominalTime)
.getObZoneHourReports(zone)
.getObStnHourReports(station).getObsTimes();
if (obsTimes != null) {
for (Date obsTime : obsTimes) {
trendData.addDataPoint(obsTime,
new Float(this.getObHourReports(nominalTime)
.getObZoneHourReports(zone)
.getObStnHourReports(station)
.getObReport(obsTime).get(varName)));
.getObStnHourReports(station);
if (stnHrRpts != null) {
Set<Date> obsTimes = stnHrRpts.getObsTimes();
if (obsTimes != null) {
for (Date obsTime : obsTimes) {
trendData.addDataPoint(obsTime, new Float(stnHrRpts
.getObReport(obsTime).get(varName)));
}
} else {
continue;
}
}
}
}
return trendData;
}
/**
* Gets History Table Data
*
* @param zone
* : current zone
* @param station
* station ID
* : station ID
* @param obsType
* ObsHistType
* @return TableData object for obs history table
* : ObsHistType
* @return
*/
public TableData getHistTableData(String zone, String station,
ObsHistType obsType) {
@ -387,37 +376,69 @@ public class ObMultiHrsReports {
if (multiHrsReports.isEmpty()) {
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.
// 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
/ TimeUtil.MILLIS_PER_HOUR;
// difference in hours 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
// expected, but may not exist in multiHrsReports
Date expectedStartNominalTime = cal.getTime();
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) {
@ -427,81 +448,50 @@ public class ObMultiHrsReports {
}
}
}
// 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;
return startNominalTime;
}
/**
* 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() {
return multiHrsReports;
}
/**
* Returns a SortedMap object (key is nominal time, value is zone TableData
* object)
* Sets data cache
*
* @return
* @param multiHrsReports
*/
public SortedMap<Date, TableData> getMultiHrsTableData() {
SortedMap<Date, TableData> multiHrsTblData = new TreeMap<Date, TableData>();
if (appName == AppName.FOG) {
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;
public void setMultiHrsReports(
SortedMap<Date, ObHourReports> multiHrsReports) {
this.multiHrsReports = multiHrsReports;
}
/**
* Returns the latest nominal time if the map is not empty; otherwise,
* returns the nominal time of the present date-time
* Gets the Latest NominalTime Returns the latest nominal time if the map is
* not empty; otherwise, returns the nominal time of the present date-time
*
* @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() {
return multiHrsReports.keySet();
}
/**
* Returns the ObHourReports object of the latest nominal time. If no data
* available, returns an empty ObHourReports object.
* Gets ObHourReports Returns the ObHourReports object of the latest nominal
* time. If no data available, returns an empty ObHourReports object.
*
* @return
*/
public ObHourReports getObHourReports() {
if (multiHrsReports.isEmpty()) {
return new ObHourReports(TableUtil.getNominalTime(SimulatedTime
.getSystemTime().getTime()), appName, thresholdMgr);
ObHourReports obHrsReps = new ObHourReports(
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());
}
/**
* Returns an ObHourReports object of a caller-specified nominal time. If no
* data available, returns an empty ObHourReports object.
* Gets ObHourReports Returns an ObHourReports object of a caller-specified
* nominal time. If no data available, returns an empty ObHourReports
* object.
*
* @param nominalTime
* @return
@ -574,6 +572,7 @@ public class ObMultiHrsReports {
}
/**
* Gets Threshold Manager
*
* @return the threshold manager
*/
@ -591,6 +590,7 @@ public class ObMultiHrsReports {
}
/**
* Gets map of types for ALG cell
*
* @return fogAlgCellType
*/
@ -603,11 +603,20 @@ public class ObMultiHrsReports {
*/
private void initFogAlgCellType() {
fogAlgCellType = new HashMap<String, CellType>();
Set<String> zones = MonitoringArea.getPlatformMap().keySet();
List<String> zones = cfgMgr.getAreaList();
Iterator<String> itr = zones.iterator();
while (itr.hasNext()) {
fogAlgCellType.put(itr.next(), CellType.NotAvailable);
}
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.SpatialQueryFactory;
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.AppName;
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
* Feb 28, 2013 14410 zhao Modified getCellTypeForBlizWarn
* 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>
*
@ -114,17 +112,23 @@ public final class TableUtil {
isZone = true;
}
String hoverText = null;
DataUsageKey dataUsageKey;
if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
}
String hoverText = "";
if (isZone) {
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
.getObsManager(MonName.fog).getAreaXml(zone);
AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone);
if (zoneXML != null) {
hoverText = getZoneHoverText(zoneXML);
}
} else {
hoverText = getStationHoverText(areaId);
}
// zone or station ID
tblRowData.setTableCellData(0, new TableCellData(areaId, hoverText,
CellType.AreaId, false));
@ -139,14 +143,18 @@ public final class TableUtil {
visValue = visValue * 16.0f; // vis in units of "miles/16"; this is
// used to compare with Red/Yellow
// 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(
visString,
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.FogDisplay.FOG_DISP_METEO_VIS
.getXmlKey(), visValue), true);
TableCellData visCellData = new TableCellData(visString,
tm.getThresholdValueCellType(dataUsageKey, zone, mccVIS,
visValue), true);
visCellData.setValue(visValue); // visValue, instead of visString,
// will be used for sorting
@ -345,10 +353,16 @@ public final class TableUtil {
isZone = true;
}
String hoverText = null;
DataUsageKey dataUsageKey;
if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
}
String hoverText = "";
if (isZone) {
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
.getObsManager(MonName.ss).getAreaXml(zone);
AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone);
if (zoneXML != null) {
hoverText = getZoneHoverText(zoneXML);
}
@ -403,42 +417,52 @@ public final class TableUtil {
.getXmlKey(), report
.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
.setTableCellData(
6,
new TableCellData(
Math.round(new Float(report.getWindSpeed())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_WIND_SPEED
.getXmlKey(), report
.getWindSpeed()), true));
// peak wind
String mccPeakWind;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccPeakWind = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_PEAK_WIND
.getXmlKey();
} else {
mccPeakWind = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_PEAK_WIND
.getXmlKey();
}
tblRowData.setTableCellData(
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
.setTableCellData(
7,
new TableCellData(
Math.round(new Float(report.getMaxWindSpeed())),
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));
tblRowData.setTableCellData(
8,
new TableCellData(Math.round(new Float(report.getWindGust())),
tm.getThresholdValueCellType(dataUsageKey, zone,
mccWindGust, report.getWindGust()), true));
// visibility
float visValue = report.getVisibility(); // vis value in miles (statute
@ -456,20 +480,25 @@ public final class TableUtil {
// to compare with Red/Yellow threshold
// values
TableCellData visCellData = new TableCellData(
visString,
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS
.getXmlKey(), visValue), true);
String mccVis;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccVis = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_VIS
.getXmlKey();
} else {
mccVis = MonitorConfigConstants.SafeSeasMonitor.SS_MON_METEO_VIS
.getXmlKey();
}
TableCellData visCellData = new TableCellData(visString,
tm.getThresholdValueCellType(dataUsageKey, zone, mccVis,
visValue), true);
visCellData.setValue(visValue); // visValue, instead of visString,
// will be used for sorting
tblRowData.setTableCellData(9, visCellData);
}
// temperature
tblRowData
.setTableCellData(
10,
@ -481,7 +510,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_TEMP
.getXmlKey(), report
.getTemperature()), true));
// dewpoint
tblRowData
.setTableCellData(
11,
@ -493,7 +522,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_DEWPT
.getXmlKey(), report
.getDewpoint()), true));
// SLP
tblRowData
.setTableCellData(
12,
@ -505,7 +534,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SLP
.getXmlKey(), report
.getSeaLevelPress()), true));
// SST
tblRowData
.setTableCellData(
13,
@ -517,7 +546,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_SST
.getXmlKey(), report
.getSeaSurfaceTemp()), true));
// wave height
tblRowData
.setTableCellData(
14,
@ -530,7 +559,7 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_HT
.getXmlKey(), report
.getHighResWaveHeight()), true));
// wave steep
tblRowData
.setTableCellData(
15,
@ -542,79 +571,102 @@ public final class TableUtil {
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP
.getXmlKey(), report
.getWaveSteepness()), true));
tblRowData
.setTableCellData(
16,
new TableCellData(
Math.round(new Float(report.getPSwellHeight())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT
.getXmlKey(), report
.getPSwellHeight()), true));
tblRowData
.setTableCellData(
17,
new TableCellData(
Math.round(new Float(report.getPSwellPeriod())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD
.getXmlKey(), report
.getPSwellPeriod()), true));
tblRowData
.setTableCellData(
18,
new TableCellData(
Math.round(new Float(report.getPSwellDir())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_DIR_FROM
.getXmlKey(), report
.getPSwellDir()), true));
tblRowData
.setTableCellData(
19,
new TableCellData(
Math.round(new Float(report.getSSwellHeight())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_HT
.getXmlKey(), report
.getSSwellHeight()), true));
tblRowData
.setTableCellData(
20,
new TableCellData(
Math.round(new Float(report.getSSwellPeriod())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_PD
.getXmlKey(), report
.getSSwellPeriod()), true));
// swell height
String mccSwell;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccSwell = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT
.getXmlKey();
} else {
mccSwell = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_HT
.getXmlKey();
}
tblRowData.setTableCellData(
16,
new TableCellData(
Math.round(new Float(report.getPSwellHeight())), tm
.getThresholdValueCellType(dataUsageKey, zone,
mccSwell, report.getPSwellHeight()),
true));
// swell period
String mccSwellPD;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccSwellPD = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD
.getXmlKey();
} else {
mccSwellPD = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_PD
.getXmlKey();
}
tblRowData.setTableCellData(
17,
new TableCellData(
Math.round(new Float(report.getPSwellPeriod())), tm
.getThresholdValueCellType(dataUsageKey, zone,
mccSwellPD, report.getPSwellPeriod()),
true));
// swell dir TODO: from only
String mccSwellDirFrom;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccSwellDirFrom = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_WIND_DIR_FROM
.getXmlKey();
} else {
mccSwellDirFrom = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM
.getXmlKey();
}
tblRowData.setTableCellData(
18,
new TableCellData(Math.round(new Float(report.getPSwellDir())),
tm.getThresholdValueCellType(dataUsageKey, zone,
mccSwellDirFrom, report.getPSwellDir()), true));
// swell2 height
String mccSwell2HT;
if (dataUsageKey == DataUsageKey.DISPLAY) {
mccSwell2HT = MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_HT
.getXmlKey();
} else {
mccSwell2HT = MonitorConfigConstants.SafeSeasMonitor.SS_MON_SWELL_SEC_HT
.getXmlKey();
}
tblRowData.setTableCellData(
19,
new TableCellData(
Math.round(new Float(report.getSSwellPeriod())), tm
.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
.setTableCellData(
21,
new TableCellData(
Math.round(new Float(report.getPSwellDir())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SafeSeasDisplay.SS_DISP_SWELL_SEC_DIR_FROM
.getXmlKey(), report
.getSSwellDir()), true));
new TableCellData(Math.round(new Float(report
.getPSwellDir())),
tm.getThresholdValueCellType(dataUsageKey,
zone, mccSwell2DirFrom,
report.getSSwellDir()), true));
// fog
if (isZone) {
// zone table: fog monitored at zone level
tblRowData.setTableCellData(22, new TableCellData("", fogCellType,
@ -650,10 +702,16 @@ public final class TableUtil {
isZone = true;
}
String hoverText = null;
DataUsageKey dataUsageKey;
if (tm.getDataUsageKey() != null) {
dataUsageKey = tm.getDataUsageKey();
} else {
dataUsageKey = DataUsageKey.DISPLAY;
}
String hoverText = "";
if (isZone) {
AreaIdXML zoneXML = FSSObsMonitorConfigurationManager
.getObsManager(MonName.snow).getAreaXml(zone);
AreaIdXML zoneXML = tm.areaConfigMgr.getAreaXml(zone);
if (zoneXML != null) {
hoverText = getZoneHoverText(zoneXML);
}
@ -721,54 +779,64 @@ public final class TableUtil {
.getXmlKey(), report
.getWindDir()), true));
}
tblRowData
.setTableCellData(
6,
new TableCellData(
Math.round(new Float(report.getWindSpeed())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_WIND_SPEED
.getXmlKey(), report
.getWindSpeed()), true));
tblRowData
.setTableCellData(
7,
new TableCellData(
Math.round(new Float(report.getMaxWindSpeed())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SnowDisplay.SNOW_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.SnowDisplay.SNOW_DISP_WIND_GUST_SPEED
.getXmlKey(), report
.getWindGust()), true));
tblRowData
.setTableCellData(
9,
new TableCellData(
Math.round(new Float(report.getTemperature())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP
.getXmlKey(), report
.getTemperature()), true));
// wind speed
String wsk;
if (dataUsageKey == DataUsageKey.DISPLAY) {
wsk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_WIND_SPEED
.getXmlKey();
} else {
wsk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_WIND_SPEED
.getXmlKey();
}
tblRowData.setTableCellData(
6,
new TableCellData(Math.round(new Float(report.getWindSpeed())),
tm.getThresholdValueCellType(dataUsageKey, zone, wsk,
report.getWindSpeed()), true));
// wind peak
String wpk;
if (dataUsageKey == DataUsageKey.DISPLAY) {
wpk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_PEAK_WIND
.getXmlKey();
} else {
wpk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_PEAK_WIND
.getXmlKey();
}
tblRowData.setTableCellData(
7,
new TableCellData(
Math.round(new Float(report.getMaxWindSpeed())), tm
.getThresholdValueCellType(dataUsageKey, zone,
wpk, report.getMaxWindSpeed()), true));
// wind gust
String wgk;
if (dataUsageKey == DataUsageKey.DISPLAY) {
wgk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_WIND_GUST_SPEED
.getXmlKey();
} else {
wgk = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_GUST_SPEED
.getXmlKey();
}
tblRowData.setTableCellData(
8,
new TableCellData(Math.round(new Float(report.getWindGust())),
tm.getThresholdValueCellType(dataUsageKey, zone, wgk,
report.getWindGust()), true));
// temperature
String tmprk;
if (dataUsageKey == DataUsageKey.DISPLAY) {
tmprk = MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_TEMP
.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
.setTableCellData(
@ -794,13 +862,17 @@ public final class TableUtil {
// used to compare with Red/Yellow
// threshold values
TableCellData visCellData = new TableCellData(
visString,
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
zone,
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_VIS
.getXmlKey(), visValue), true);
String visKey;
if (dataUsageKey == DataUsageKey.DISPLAY) {
visKey = MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_VIS
.getXmlKey();
} else {
visKey = MonitorConfigConstants.SnowMonitor.SNOW_MON_METEO_VIS
.getXmlKey();
}
TableCellData visCellData = new TableCellData(visString,
tm.getThresholdValueCellType(dataUsageKey, zone, visKey,
visValue), true);
visCellData.setValue(visValue); // visValue, instead of visString,
// will be used for sorting
@ -819,14 +891,14 @@ public final class TableUtil {
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SLP
.getXmlKey(), report
.getSeaLevelPress()), true));
// wind chill
tblRowData
.setTableCellData(
13,
new TableCellData(
Math.round(new Float(report.getWindChill())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
dataUsageKey,
zone,
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_WIND_CHILL
.getXmlKey(), report
@ -855,14 +927,14 @@ public final class TableUtil {
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP
.getXmlKey(), report
.getHourlyPrecip()), true));
// snow depth
tblRowData
.setTableCellData(
16,
new TableCellData(
Math.round(new Float(report.getSnowDepth())),
tm.getThresholdValueCellType(
DataUsageKey.DISPLAY,
dataUsageKey,
zone,
MonitorConfigConstants.SnowDisplay.SNOW_DISP_METEO_SNOW_DEPTH
.getXmlKey(), report
@ -898,7 +970,7 @@ public final class TableUtil {
/**
* Gets Zone Hover Text.
*
* @param zoneXML
* @param zone
* @return
*/
private static String getZoneHoverText(AreaIdXML zoneXML) {
@ -926,8 +998,11 @@ public final class TableUtil {
sq = SpatialQueryFactory.create();
Object[] results = sq.dbRequest(sql, "maps");
if (results.length > 0) {
if (results[0] instanceof String) {
hoverText += (String) results[0];
if (results[0] instanceof Object[]) {
Object[] res = (Object[]) results[0];
hoverText += (String) res[0];
} else {
hoverText += (String) results[0].toString();
}
} else {
if (zoneXML.getCLat() != null) {
@ -976,6 +1051,8 @@ public final class TableUtil {
} else if (stnType.intValue() == 1000) {
hoverText = stnId + "#MESONET -- " + stnName;
}
} else {
hoverText = stnId;
}
} catch (Exception e) {
@ -1159,15 +1236,30 @@ public final class TableUtil {
public static CellType getCellTypeForFog(String zone, ObReport report,
AbstractThresholdMgr tm) {
float visValue = report.getVisibility();// in miles
if (visValue == ObConst.MISSING) {
return CellType.NotAvailable;
CellType retVal = CellType.NotAvailable;
DataUsageKey dataUsageKey;
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
// observation available
CellType snowDepth = tm
.getThresholdValueCellType(
DataUsageKey.DISPLAY,
@ -1690,5 +1781,5 @@ public final class TableUtil {
CommonTableConfig.obsHistCols.PTend));
return tblRowData;
}
// TODO: add MESONET data
}

View file

@ -19,7 +19,7 @@
**/
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;
/**
@ -32,6 +32,8 @@ import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 29, 2009 dhladky Initial creation
* Sep 20, 2015 3873 skorolev Replaced deprecated INotificationObserver
*
* </pre>
*
* @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.PathManagerFactory;
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.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.monitor.config.CommonTableConfig.CellType;
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
* Feb 16, 2011 #7346 zhao added getDirectionalThresholdValueCellType(...)
* Apr 28, 2014 3086 skorolev Updated getAreaConfigMgr method.
* Sep 18, 2015 3873 skorolev Added getCfgMgr().
*
* </pre>
*
@ -61,25 +67,28 @@ import com.raytheon.uf.viz.monitor.xml.ThresholdsXML;
*/
public abstract class AbstractThresholdMgr {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(AbstractThresholdMgr.class);
/**
* 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";
/**
* Default file name for the FOG monitor thresholds.
* Default file name for the monitor thresholds.
*/
private String defMonitorThreshName = "Unknown";
/**
* 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.
@ -117,10 +126,8 @@ public abstract class AbstractThresholdMgr {
/** current site **/
protected String site;
/*
* TODO : remove this when debugging is complete
*/
public ThresholdsXML threshXmlCopy;
/** threshold usage **/
protected DataUsageKey dataUsageKey;
/**
* Constructor.
@ -129,12 +136,12 @@ public abstract class AbstractThresholdMgr {
* @param defMonitorThreshName
*/
public AbstractThresholdMgr(String defDisplayThreshName,
String defMonitorThreshName, String appName) {
String defMonitorThreshName, AppName appName) {
this.defDisplayThreshName = defDisplayThreshName;
this.defMonitorThreshName = defMonitorThreshName;
this.appName = appName;
this.site = LocalizationManager.getInstance().getCurrentSite();
this.areaConfigMgr = getMonitorAreaConfigInstance();
this.areaConfigMgr = getCfgMgr();
}
/**
@ -148,7 +155,7 @@ public abstract class AbstractThresholdMgr {
defaultFileNameMgr.readXmlConfig();
/*
* Setup the Fog display threshold manager
* Setup the display threshold manager
*/
if (defaultFileNameMgr.getDefaultThresholdFilename() != null
&& 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()
+ defMonitorThreshName;
@ -201,7 +208,7 @@ public abstract class AbstractThresholdMgr {
LocalizationFile locFile = pm.getLocalizationFile(context,
pathAndFileName);
System.out.println("--- validate path = "
statusHandler.handle(Priority.DEBUG, "--- validate path = "
+ locFile.getFile().getAbsolutePath());
return locFile.getFile().exists();
@ -235,7 +242,6 @@ public abstract class AbstractThresholdMgr {
return monitorThreshMgr.getYellowValue(areaID, key);
}
}
return 0;
}
@ -284,30 +290,24 @@ public abstract class AbstractThresholdMgr {
if (hasArea(areaID, dataUsage) == false) {
return CellType.NotMonitored;
}
if (Double.isNaN(value) == true) {
return CellType.NotMonitored;
}
if (value == ObConst.MISSING) {
return CellType.NotAvailable;
}
double red = Double.NaN;
double yellow = Double.NaN;
if (dataUsage == DataUsageKey.DISPLAY) {
red = displayThreshMgr.getRedValue(areaID, key);
yellow = displayThreshMgr.getYellowValue(areaID, key);
return calcCellType(key, red, yellow, value);
} else if (dataUsage == DataUsageKey.MONITOR) {
red = monitorThreshMgr.getRedValue(areaID, key);
yellow = monitorThreshMgr.getYellowValue(areaID, key);
return calcCellType(key, red, yellow, value);
}
return CellType.NotMonitored;
}
@ -328,11 +328,9 @@ public abstract class AbstractThresholdMgr {
if (hasArea(areaID, dataUsage) == false) {
return CellType.NotMonitored;
}
if (Double.isNaN(value) == true) {
return CellType.NotMonitored;
}
if (value == ObConst.MISSING) {
return CellType.NotAvailable;
}
@ -357,7 +355,6 @@ public abstract class AbstractThresholdMgr {
return calcDirectionalCellType(redFrom, redTo, yellowFrom,
yellowTo, value);
}
return CellType.NotMonitored;
}
@ -379,25 +376,21 @@ public abstract class AbstractThresholdMgr {
return CellType.R;
}
}
if (redFrom > redTo) {
if (value > redFrom || value < redTo) {
return CellType.R;
}
}
if (yellowFrom < yellowTo) {
if (value > yellowFrom && value < yellowTo) {
return CellType.Y;
}
}
if (yellowFrom > yellowTo) {
if (value > yellowFrom || value < yellowTo) {
return CellType.Y;
}
}
return CellType.G;
}
@ -427,7 +420,6 @@ public abstract class AbstractThresholdMgr {
} else if (value <= yellow) {
return CellType.Y;
}
return CellType.G;
} else {
if (value < yellow) {
@ -435,7 +427,6 @@ public abstract class AbstractThresholdMgr {
} else if (value <= red) {
return CellType.Y;
}
return CellType.R;
}
} else if (redIsHigher == true) {
@ -444,7 +435,6 @@ public abstract class AbstractThresholdMgr {
} else if (value < red) {
return CellType.Y;
}
return CellType.R;
} else if (redIsHigher == false) {
if (value <= red) {
@ -452,10 +442,8 @@ public abstract class AbstractThresholdMgr {
} else if (value <= yellow) {
return CellType.Y;
}
return CellType.G;
}
return CellType.NotMonitored;
}
@ -472,11 +460,9 @@ public abstract class AbstractThresholdMgr {
+ defDisplayThreshName;
return;
}
if (fileName.endsWith(".xml") == false) {
fileName.concat(".xml");
}
if (fileName.compareTo(defDisplayThreshName) == 0) {
defaultFileNameMgr.setDefaultThresholdFilename("");
} else {
@ -495,9 +481,7 @@ public abstract class AbstractThresholdMgr {
loadDefaultDisplayThreshold();
return;
}
currFullDisplayXmlFileName = getDisplayThresholdPath() + fileName;
displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName);
displayThreshMgr.readThresholdXml();
}
@ -511,23 +495,18 @@ public abstract class AbstractThresholdMgr {
if (filename == null || filename.trim().length() == 0) {
currFullDisplayXmlFileName = getDisplayThresholdPath()
+ defDisplayThreshName;
List<String> areaIDs = null;
try {
areaIDs = areaConfigMgr.getAreaList();
} catch (Exception e) {
e.printStackTrace();
return;
}
// Sort the area IDs
Collections.sort(areaIDs);
ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.DISPLAY);
System.out.println("---- " + currFullDisplayXmlFileName);
statusHandler.handle(Priority.DEBUG, "---- "
+ currFullDisplayXmlFileName);
displayThreshMgr.createConfigFromDefaults(
currFullDisplayXmlFileName, areaIDs, threshKeys);
} else {
@ -543,21 +522,16 @@ public abstract class AbstractThresholdMgr {
public void loadDefaultMonitorThreshold() {
currFullMonitorXmlFileName = getMonitorThresholdPath()
+ defMonitorThreshName;
List<String> areaIDs = null;
try {
areaIDs = areaConfigMgr.getAreaList();
} catch (Exception e) {
e.printStackTrace();
return;
}
// Sort the area IDs
Collections.sort(areaIDs);
ArrayList<String> threshKeys = getThresholdKeys(DataUsageKey.MONITOR);
monitorThreshMgr.createConfigFromDefaults(currFullMonitorXmlFileName,
areaIDs, threshKeys);
}
@ -572,9 +546,7 @@ public abstract class AbstractThresholdMgr {
if (newFileName.trim().compareTo(defDisplayThreshName) == 0) {
return;
}
currFullDisplayXmlFileName = getDisplayThresholdPath() + newFileName;
displayThreshMgr.setFullPathFileName(currFullDisplayXmlFileName);
displayThreshMgr.saveThresholdXml();
}
@ -601,7 +573,6 @@ public abstract class AbstractThresholdMgr {
if (usageKey == DataUsageKey.DISPLAY) {
return defDisplayThreshName;
}
// Return the Monitor threshold file name as the default.
return defMonitorThreshName;
}
@ -616,61 +587,60 @@ public abstract class AbstractThresholdMgr {
return defaultFileNameMgr.getDefaultThresholdFilename();
}
/**
* Gets Thresholds XML Data
*
* @param usageKey
* @return
*/
public ThresholdsXML getThresholdsXmlData(DataUsageKey usageKey) {
if (usageKey == DataUsageKey.DISPLAY) {
return displayThreshMgr.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.
*/
public String getDisplayThresholdPath() {
String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder();
sb.append(appName).append(fs);
sb.append(appName.name().toLowerCase()).append(fs);
sb.append("threshold").append(fs);
sb.append("display").append(fs);
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.
*/
public String getMonitorThresholdPath() {
String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder();
sb.append(appName).append(fs);
sb.append(appName.name().toLowerCase()).append(fs);
sb.append("threshold").append(fs);
sb.append("monitor").append(fs);
return sb.toString();
}
/**
* Get the path where the XML file containing the user selected default file
* is located.
* Gets the path where the XML file containing the user selected default
* file is located.
*
* @return The path of the user selected default file XML.
*/
public String getDefaultThresholdFilePath() {
String fs = String.valueOf(File.separatorChar);
StringBuilder sb = new StringBuilder();
sb.append(appName).append(fs);
sb.append(appName.name().toLowerCase()).append(fs);
sb.append("threshold").append(fs);
sb.append("display").append(fs);
sb.append("defaultThresh").append(fs);
return sb.toString();
}
@ -686,7 +656,6 @@ public abstract class AbstractThresholdMgr {
} else if (dataUsageKey == DataUsageKey.MONITOR) {
return monitorThreshMgr.getThresholdsXmlCopy();
}
return null;
}
@ -698,7 +667,6 @@ public abstract class AbstractThresholdMgr {
*/
public boolean deleteFile(LocalizationFile fileName) {
boolean deletedUserSelectedDefault = false;
String fileNameStr = fileName.getFile().getName();
/*
@ -712,7 +680,6 @@ public abstract class AbstractThresholdMgr {
loadDefaultDisplayThreshold();
deletedUserSelectedDefault = true;
}
/*
* Delete the file.
*/
@ -721,7 +688,6 @@ public abstract class AbstractThresholdMgr {
} catch (Exception e) {
e.printStackTrace();
}
return deletedUserSelectedDefault;
}
@ -736,7 +702,6 @@ public abstract class AbstractThresholdMgr {
if (dataUsageKey == DataUsageKey.DISPLAY) {
return displayThreshMgr.getThresholdXML().hasAreaId(areaID);
}
return monitorThreshMgr.getThresholdXML().hasAreaId(areaID);
}
@ -764,34 +729,17 @@ public abstract class AbstractThresholdMgr {
ArrayList<AreaXML> areasArray = displayXML.getAreas();
for (AreaXML area : areasArray) {
System.out.println("--- " + area.getAreaId());
statusHandler.handle(Priority.DEBUG, "--- " + 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());
}
}
}
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());
statusHandler.handle(Priority.DEBUG,
"****** " + atXml.getKey());
statusHandler.handle(Priority.DEBUG,
" R " + atXml.getRed());
statusHandler.handle(Priority.DEBUG,
" Y " + atXml.getYellow());
}
}
}
@ -801,6 +749,37 @@ public abstract class AbstractThresholdMgr {
*
* @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 4, 2012 #1351 skorolev Cleaned code
* Sep 18, 2015 #3873 skorolev Added error message for corrupted or empty default threshold file.
*
* </pre>
*
@ -86,10 +87,11 @@ public class ThresholdMgr {
*/
public void readThresholdXml() {
try {
cfgXML = null;
ThresholdsXML newCfgXML = null;
IPathManager pm = PathManagerFactory.getPathManager();
File path = pm.getStaticFile(currFullPathAndFileName);
cfgXML = JAXB.unmarshal(path, ThresholdsXML.class);
newCfgXML = JAXB.unmarshal(path, ThresholdsXML.class);
this.setThresholdXML(newCfgXML);
} catch (Exception e) {
statusHandler.handle(Priority.ERROR, e.getMessage());
}
@ -145,7 +147,11 @@ public class ThresholdMgr {
ThresholdsXML.class);
createXmlFromDefaults(cfgXmlDefaults, areaIDs, keys);
} 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 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.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.AppName;
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.
* Apr 23, 2014 3054 skorolev Added MESONET handling.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Aug 17, 2015 3841 skorolev Corrected handleAddNewStation method.
*
* </pre>
*
@ -69,7 +67,7 @@ public class AddNewStationDlg extends CaveSWTDialog {
.getHandler(AddNewStationDlg.class);
/** Application name. */
private final AppName appName;
private AppName appName;
/** METAR radio button. */
private Button metarRdo;
@ -87,12 +85,10 @@ public class AddNewStationDlg extends CaveSWTDialog {
private Text stationTF;
/** Zone */
private final String area;
private String area;
/** Call back interface */
private final MonitoringAreaConfigDlg macDlg;
private final FSSObsMonitorConfigurationManager cfgMgr;
private MonitoringAreaConfigDlg macDlg;
/**
* Constructor.
@ -110,7 +106,6 @@ public class AddNewStationDlg extends CaveSWTDialog {
this.appName = appName;
this.area = area;
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.");
return;
}
macDlg.addNewStationAction(stn);
cfgMgr.addNewStation(area, stn, type, true);
cfgMgr.getStations().add(stn);
macDlg.getInstance().addStation(area, stn, type, false);
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.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
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 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Feb 10, 2015 3886 skorolev Added fixed width for dialog.
* Aug 17, 2015 3841 skorolev Corrected handleAddNewAction method.
*
* </pre>
*
@ -59,7 +59,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
public class AddNewZoneDlg extends CaveSWTDialog {
/** Application name. */
private final AppName appName;
private AppName appName;
/** Marine zone radio button. */
private Button marineZoneRdo;
@ -77,7 +77,7 @@ public class AddNewZoneDlg extends CaveSWTDialog {
private Text centroidLonTF;
/** Monitoring Area Configuration Dialog. */
private final MonitoringAreaConfigDlg macDlg;
private MonitoringAreaConfigDlg macDlg;
/**
* Constructor.
@ -144,15 +144,13 @@ public class AddNewZoneDlg extends CaveSWTDialog {
/*
* Add the radio controls.
*/
if (appName != AppName.SNOW) {
Composite radioComp = new Composite(topComp, SWT.NONE);
radioComp.setLayout(new GridLayout(1, false));
marineZoneRdo = new Button(radioComp, SWT.RADIO);
marineZoneRdo.setText("Marine Zone");
marineZoneRdo.setSelection(true);
countyRdo = new Button(radioComp, SWT.RADIO);
countyRdo.setText("County");
}
Composite radioComp = new Composite(topComp, SWT.NONE);
radioComp.setLayout(new GridLayout(1, false));
marineZoneRdo = new Button(radioComp, SWT.RADIO);
marineZoneRdo.setText("Marine Zone");
marineZoneRdo.setSelection(true);
countyRdo = new Button(radioComp, SWT.RADIO);
countyRdo.setText("County");
}
/**
@ -238,13 +236,9 @@ public class AddNewZoneDlg extends CaveSWTDialog {
addBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
String areaId = idTF.getText().toUpperCase();
idTF.setText(areaId);
String latString = centroidLatTF.getText();
String lonString = centroidLonTF.getText();
if (macDlg.formIsValid(areaId, latString, lonString)) {
handleAddNewAction(areaId, latString, lonString);
}
handleAddNewAction(latString, lonString);
}
});
@ -267,35 +261,58 @@ public class AddNewZoneDlg extends CaveSWTDialog {
* @param latString
* @param lonString
*/
private void handleAddNewAction(String areaId, String latString,
String lonString) throws NumberFormatException {
private void handleAddNewAction(String latString, String lonString) {
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)) {
macDlg.displayInputErrorMsg("The Area ID, "
displayInputErrorMsg("The Area ID, "
+ areaId
+ ", is already in your Monitoring Area or among your Additional Zones.");
return;
}
double lat = Double.parseDouble(latString.trim());
double lon = Double.parseDouble(lonString.trim());
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) {
if (latString == null || latString.isEmpty() || lonString == null
|| lonString.isEmpty()) {
macDlg.latLonErrorMsg(latString, lonString);
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;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
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.data.CommonConfig.AppName;
import com.raytheon.uf.common.monitor.xml.AreaIdXML;
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.
* Apr 23, 2014 3054 skorolev Fixed issue with deleting a new station.
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Aug 17, 2015 3841 skorolev Corrected deleteSelected method.
*
* </pre>
*
@ -68,12 +64,11 @@ public class DeleteStationDlg extends CaveSWTDialog {
/** Control font. */
private Font controlFont;
/** Area configuration manager. */
private FSSObsMonitorConfigurationManager configMgr;
/** Monitoring Area Configuration Dialog */
private final MonitoringAreaConfigDlg macDlg;
private final FSSObsMonitorConfigurationManager cfgMgr;
private final java.util.List<String> newAddedStns = new ArrayList<String>();
private MonitoringAreaConfigDlg macDlg;
/**
* Constructor.
@ -82,15 +77,13 @@ public class DeleteStationDlg extends CaveSWTDialog {
* Parent shell.
* @param appName
* Application name.
* @param area
* @param macDlg
*/
public DeleteStationDlg(Shell parent, AppName appName,
MonitoringAreaConfigDlg macDlg) {
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText(appName.toString() + ": Delete a Newly Entered Station");
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);
createListControl();
createBottomButtons();
java.util.List<AreaIdXML> areaList = cfgMgr.getConfigXml().getAreaIds();
newAddedStns.addAll(cfgMgr.getNewlyAddedStations(areaList));
areaList = cfgMgr.getAdjAreaConfigXml().getAreaIds();
newAddedStns.addAll(cfgMgr.getNewlyAddedStations(areaList));
populate();
}
@ -186,7 +175,8 @@ public class DeleteStationDlg extends CaveSWTDialog {
* Populate list of added stations.
*/
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()]));
}
@ -194,20 +184,15 @@ public class DeleteStationDlg extends CaveSWTDialog {
* Delete stations from the list.
*/
private String deleteSelected() {
String retval = "";
String retval = null;
if (stationList.getItemCount() != 0) {
if (stationList.getSelectionIndex() != -1) {
int idx = stationList.getSelectionIndex();
String selection = stationList.getItem(idx);
retval = configMgr.getAddedStations().get(idx);
configMgr.getAddedStations().remove(idx);
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();
macDlg.maStationsRemoved = true;
} else {
MessageBox messageBox = new MessageBox(shell,
SWT.ICON_INFORMATION | SWT.NONE);

View file

@ -19,8 +19,6 @@
**/
package com.raytheon.uf.viz.monitor.ui.dialogs;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
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.Text;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
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.monitor.xml.StationIdXML;
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 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Nov 10, 2014 3741 skorolev Fixed configXML issue.
* Aug 17, 2015 3841 skorolev Made editable a content of ID field.
*
* </pre>
*
@ -67,7 +62,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
public class EditNewZoneDlg extends CaveSWTDialog {
/** Call back interface. */
private final MonitoringAreaConfigDlg macDlg;
private MonitoringAreaConfigDlg macDlg;
/** Zone list control. */
private List zoneList;
@ -90,13 +85,17 @@ public class EditNewZoneDlg extends CaveSWTDialog {
/** Control font. */
private Font controlFont;
/** Marine station radio button. */
private Button marineRdo;
/** None Marine station radio button. */
private Button nonMarineRdo;
/** Bottom label */
private Label bottomLbl;
/** Deleted zone */
private boolean delZone = false;
private final FSSObsMonitorConfigurationManager cfgMgr;
private String delZone;
/**
* Constructor.
@ -112,7 +111,6 @@ public class EditNewZoneDlg extends CaveSWTDialog {
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText(appName.toString() + ": Edit a Newly Added Zone");
this.macDlg = macDlg;
cfgMgr = macDlg.getInstance();
}
/*
@ -144,7 +142,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
createListAndTextControls();
createBottomLabel();
createCloseButton();
populate("");
populate();
}
/**
@ -229,6 +227,21 @@ public class EditNewZoneDlg extends CaveSWTDialog {
lonTF = new Text(textButtonComp, SWT.BORDER);
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.widthHint = 80;
gd.verticalIndent = 5;
@ -238,17 +251,7 @@ public class EditNewZoneDlg extends CaveSWTDialog {
saveBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (zoneList.getItemCount() != 0) {
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.");
}
saveSelected();
}
});
gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, true);
@ -306,24 +309,9 @@ public class EditNewZoneDlg extends CaveSWTDialog {
/**
* Populate list of added zones.
*/
private void populate(String selected) {
java.util.List<String> newList = new ArrayList<String>();
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();
private void populate() {
java.util.List<String> newList = macDlg.configMgr.getAddedZones();
zoneList.setItems(newList.toArray(new String[newList.size()]));
macDlg.populateLeftLists(selected);
}
/**
@ -331,23 +319,27 @@ public class EditNewZoneDlg extends CaveSWTDialog {
*/
private void handleZoneSelection() {
String zone = zoneList.getItem(zoneList.getSelectionIndex());
AreaIdXML areaXml = cfgMgr.getAreaXml(zone);
AreaIdXML adjAreaXml = cfgMgr.getAdjAreaXML(zone);
AreaIdXML areaXml = macDlg.configMgr.getAreaXml(zone);
// DR #7343: a null areaXml causes an "Unhandled event loop exception"
if (areaXml != null) {
idTF.setText(areaXml.getAreaId());
idTF.setEnabled(false);
latTF.setText(String.valueOf(areaXml.getCLat()));
lonTF.setText(String.valueOf(areaXml.getCLon()));
} else if (adjAreaXml != null) {
idTF.setText(adjAreaXml.getAreaId());
latTF.setText(String.valueOf(adjAreaXml.getCLat()));
lonTF.setText(String.valueOf(adjAreaXml.getCLon()));
if (areaXml.getType() == ZoneType.REGULAR) {
nonMarineRdo.setSelection(true);
marineRdo.setSelection(false);
} else {
nonMarineRdo.setSelection(false);
marineRdo.setSelection(true);
}
}
}
/**
* Delete selected zones.
*/
private Boolean deleteSelected() {
private String deleteSelected() {
if (zoneList.getItemCount() != 0) {
if (zoneList.getSelectionIndex() == -1) {
MessageBox messageBox = new MessageBox(shell,
@ -356,97 +348,62 @@ public class EditNewZoneDlg extends CaveSWTDialog {
messageBox.setMessage("Please select zone to be deleted.");
messageBox.open();
zoneList.select(0);
return false;
return null;
}
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.select(0);
if (zoneList.getItemCount() != 0) {
handleZoneSelection();
} else {
idTF.setText("");
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;
macDlg.configMgr.removeArea(area);
idTF.setText("");
latTF.setText("");
lonTF.setText("");
return area;
} else {
bottomLbl.setText("No zones have been deleted.");
}
return false;
return null;
}
/**
* 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,
String lonStr) throws NumberFormatException {
java.util.List<StationIdXML> stationIds;
if (macDlg.getMaZones().contains(area)) {
stationIds = cfgMgr.getAreaXml(area).getStationIds();
} else if (macDlg.getAdditionalZones().contains(area)) {
stationIds = cfgMgr.getAdjAreaXML(area).getStationIds();
private void saveSelected() {
if (zoneList.getItemCount() != 0) {
String area = zoneList.getItem(zoneList.getSelectionIndex());
String latStr = latTF.getText();
String lontStr = lonTF.getText();
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 {
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.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import org.eclipse.jface.resource.ImageDescriptor;
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.data.CommonConfig;
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.status.IUFStatusHandler;
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.
* 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.
* Aug 17, 2015 3841 skorolev Added formIsValid method.
* Sep 18, 2015 3873 skorolev Added formIsValid method.
*
* </pre>
*
@ -187,7 +185,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
private Font controlFont;
/** Application name. **/
private final CommonConfig.AppName appName;
private CommonConfig.AppName appName;
/** The current site. **/
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. */
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.
*
@ -335,7 +350,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
// initialize zone/station lists
initZoneStationLists();
// Populate the dialog
populateLeftLists("");
populateLeftLists();
setValues();
shell.addShellListener(new ShellAdapter() {
@Override
@ -407,7 +422,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
mode = Mode.Zone;
changeZoneStationControls();
populateLeftLists("");
populateLeftLists();
if (!getShell().isDisposed()) {
getShell().setCursor(null);
}
@ -423,7 +438,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
mode = Mode.Station;
changeZoneStationControls();
populateLeftLists("");
populateLeftLists();
if (!getShell().isDisposed()) {
getShell().setCursor(null);
}
@ -792,10 +807,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
handleOkBtnSelection();
} catch (LocalizationException | SerializationException
| IOException e) {
statusHandler
.handle(Priority.PROBLEM,
"There is a problem with configuration XML file",
e);
statusHandler.handle(Priority.PROBLEM,
"There is a problem saving changes. ", e);
}
}
});
@ -901,7 +914,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void dialogClosed(Object returnValue) {
if ((Boolean) returnValue) {
// Update the dialog
populateLeftLists("");
populateLeftLists();
}
addNewZoneDlg = null;
}
@ -920,7 +933,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void dialogClosed(Object returnValue) {
if ((Boolean) returnValue) {
// Update the dialog
populateLeftLists("");
populateLeftLists();
}
addNewStnDlg = null;
}
@ -950,9 +963,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void dialogClosed(Object returnValue) {
if (returnValue instanceof String) {
// Update the edit dialog
String selectedZone = returnValue.toString();
maZones.remove(selectedZone);
populateLeftLists("");
populateLeftLists();
}
editDlg = null;
}
@ -966,9 +977,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof String) {
String station = returnValue.toString();
maStations.remove(station);
populateLeftLists("");
// Update the delete dialog
String selectedStn = returnValue.toString();
maStations.remove(selectedStn);
populateLeftLists();
}
deleteStnDlg = null;
}
@ -999,14 +1011,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
maRegionalList.setItems(additionalZones
.toArray(new String[additionalZones.size()]));
}
maRegionalList.select(0);
}
}
/**
* Populates the zone list boxes.
*/
protected void populateLeftLists(String selected) {
private void populateLeftLists() {
if (mode == Mode.Zone) {
/** Zone Mode */
Collections.sort(maZones);
@ -1026,11 +1037,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
if (monitorAreaList.getItemCount() > 0) {
// select top of the list
if (selected.equals("")) {
monitorAreaList.setSelection(0);
} else {
monitorAreaList.setSelection(monitorAreaList.indexOf(selected));
}
monitorAreaList.setSelection(0);
handleMonitorAreaListSelection();
}
}
@ -1109,7 +1116,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
if (mode == Mode.Zone) {
String zone = additionalList.getItem(additionalList
.getSelectionIndex());
AreaIdXML zoneXML = configMgr.getAdjAreaXML(zone);
additionalList.remove(additionalList.getSelectionIndex());
maZones.add(zone);
Collections.sort(maZones);
@ -1117,12 +1123,13 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.setItems(maZones.toArray(new String[maZones.size()]));
monitorAreaList.setSelection(maZones.indexOf(zone));
additionalZones.remove(zone);
configMgr.addArea(zoneXML);
handleMonitorAreaListSelection();
configMgr.addArea(zone, zone.charAt(2) == 'Z' ? ZoneType.MARITIME
: ZoneType.REGULAR);
if (!configMgr.getAddedZones().contains(zone)) {
configMgr.getAddedZones().add(zone);
}
configMgr.removeAdjArea(zoneXML);
configMgr.removeAdjArea(zone);
handleMonitorAreaListSelection();
} else { // Station mode
if (associatedList.getSelectionCount() == 0) {
showMessage(shell, SWT.ERROR, "Selection Needed",
@ -1142,7 +1149,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.getSelectionIndex());
String stnId = stn.substring(0, stn.indexOf('#'));
String stnType = stn.substring(stn.indexOf('#') + 1);
configMgr.addNewStation(zone, stnId, stnType, configMgr
configMgr.addStation(zone, stnId, stnType, configMgr
.getAddedStations().contains(stnId));
handleMonitorAreaListSelection();
}
@ -1164,11 +1171,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
String entry = monitorAreaList.getItem(monitorAreaList
.getSelectionIndex());
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
associatedList.removeAll();
if (mode == Mode.Zone) {
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
// entry is a zone to remove.
AreaIdXML zoneXML = configMgr.getAreaXml(entry);
if (!additionalZones.contains(entry)) {
additionalZones.add(entry);
}
@ -1177,30 +1183,23 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.toArray(new String[additionalZones.size()]));
additionalList.setSelection(additionalZones.indexOf(entry));
maZones.remove(entry);
configMgr.removeArea(zoneXML);
configMgr.removeArea(entry);
if (configMgr.getAddedZones().contains(entry)) {
configMgr.getAddedZones().remove(entry);
}
configMgr.addAdjArea(zoneXML);
associatedList.removeAll();
} else { // Station mode. entry is name#type of station.
if (associatedList.getItemCount() >= 1
&& associatedList.getSelectionIndex() < 0) {
showMessage(shell, SWT.ERROR, "Selection Needed",
"You must select a assopciated area zone to remove.");
return;
}
monitorAreaList.remove(monitorAreaList.getSelectionIndex());
String stnZone = associatedList.getSelection()[0];
configMgr.addAdjArea(entry,
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
: ZoneType.REGULAR);
} else { // Station mode
// entry is a station to remove.
additionalStns.add(entry);
Collections.sort(additionalStns);
additionalList.setItems(additionalStns
.toArray(new String[additionalStns.size()]));
additionalList.setSelection(additionalStns.indexOf(entry));
maStations.remove(entry);
// station removes from configuration XML files
configMgr.removeStationFromArea(stnZone,
entry.substring(0, entry.indexOf('#')));
configMgr.removeStation(entry.substring(0, entry.indexOf('#')));
}
}
@ -1234,8 +1233,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
}
String entry = maRegionalList.getItem(maRegionalList
.getSelectionIndex());
java.util.List<String> itemList = new LinkedList<String>(
Arrays.asList(associatedList.getItems()));
String[] items = associatedList.getItems();
ArrayList<String> itemList = new ArrayList<String>();
for (String item : items) {
itemList.add(item);
}
if (itemList.contains(entry)) {
/**
* if selected entry is already in associated list: highlight the
@ -1264,24 +1266,24 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
.getSelectionIndex());
String stnId = entry.substring(0, entry.indexOf('#'));
String stnType = entry.substring(entry.indexOf('#') + 1);
configMgr.addNewStation(zone, stnId, stnType, configMgr
configMgr.addStation(zone, stnId, stnType, configMgr
.getAddedStations().contains(stnId));
} else { // Station mode
if (regionalRdo.getSelection()) {
// entry is a zone selected from additional zones
AreaIdXML zoneXML = configMgr.getAdjAreaXML(entry);
maZones.add(entry);
Collections.sort(maZones);
additionalZones.remove(entry);
maRegionalList.remove(maRegionalList.getSelectionIndex());
configMgr.addArea(zoneXML);
configMgr.addArea(entry,
entry.charAt(2) == 'Z' ? ZoneType.MARITIME
: ZoneType.REGULAR);
}
String stn = monitorAreaList.getItem(monitorAreaList
.getSelectionIndex());
String stnId = stn.substring(0, stn.indexOf('#'));
String stnType = stn.substring(stn.indexOf('#') + 1);
configMgr.addNewStation(entry, stnId, stnType, configMgr
configMgr.addStation(entry, stnId, stnType, configMgr
.getAddedStations().contains(stnId));
}
}
@ -1306,10 +1308,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
if (mode == Mode.Zone) {
String zone = monitorAreaList.getItem(monitorAreaList
.getSelectionIndex());
configMgr.removeStationFromArea(zone, entry);
configMgr.removeStation(zone, entry);
java.util.List<String> zones = configMgr.getAreaByStationId(entry
.substring(0, entry.indexOf('#')));
if (zones.isEmpty()) {
if (zones.size() == 0) {
// entry is no longer an MA station
maStations.remove(entry);
additionalStns.add(entry);
@ -1325,7 +1327,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
} else { // Station mode
String stn = monitorAreaList.getItem(monitorAreaList
.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.
*/
private void handleMonitorAreaListSelection() {
if (monitorAreaList.getSelectionIndex() == -1) {
if (monitorAreaList.getSelectionIndex() < 0) {
return;
}
if (mode == Mode.Zone) {
@ -1380,7 +1382,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
getValues();
configMgr.saveConfigXml();
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
* there are no changes).
*
* @throws IOException
* @throws SerializationException
* @throws LocalizationException
* @throws IOException
*/
protected abstract void handleOkBtnSelection()
throws LocalizationException, SerializationException, IOException;
@ -1410,7 +1411,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void addZoneToMA(String zone) {
maZones.add(zone);
Collections.sort(maZones);
populateLeftLists(zone);
populateLeftLists();
}
/**
@ -1422,7 +1423,7 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
public void addStationToMA(String stnWithType) {
maStations.add(stnWithType);
Collections.sort(maStations);
populateLeftLists("");
populateLeftLists();
}
/*
@ -1452,35 +1453,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
return false;
}
/**
* Input test.
*
* @param area
* @param latString
* @param lonString
* @return
*/
public boolean formIsValid(String area, String latString, String lonString) {
boolean retVal = true;
String msg = "";
if (area.equals("") || area.length() != 6
|| !Character.isDigit(area.charAt(3))) {
msg = "Invalid Area ID = '"
+ 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);
|| (area.charAt(2) != 'C' && area.charAt(2) != 'Z')) {
displayInputErrorMsg(String.format(INVALID_AREA_MSG, area));
retVal = false;
}
if (latString == null || latString.isEmpty() || lonString == null
@ -1491,19 +1468,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
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)
*
@ -1550,20 +1514,10 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* @see
* com.raytheon.uf.viz.monitor.ui.dialogs.INewZoneStnAction#latLonErrorMsg()
*/
@Override
public void latLonErrorMsg(String latStr, String lonStr) {
MessageBox messageBox = new MessageBox(shell, SWT.ICON_INFORMATION
| SWT.OK);
messageBox.setText("Invalid Lat/Lon");
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.setMessage(INVALID_COORD_MSG);
messageBox.open();
}
@ -1571,7 +1525,6 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* Reset data status.
*/
protected void resetStatus() {
this.timeWindowChanged = false;
this.maZonesRemoved = false;
this.maStationsRemoved = false;
@ -1601,11 +1554,8 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
* @return
*/
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,
"Edit Thresholds Now?", message);
"Edit Thresholds Now?", MODIFY_THRESHOLD_MSG);
return yesno;
}
@ -1643,6 +1593,19 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
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.
*

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.viz.core.IDisplayPane;
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.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
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.
* Sep 15, 2014 3220 skorolev Added refreshZoneTableData method.
* 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>
*
@ -192,6 +195,8 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
private final DateFormat dFormat = new SimpleDateFormat(
"E MMM dd HH:mm:ss yyyy");
public static String datePattern = "yyyy-MM-dd HH:mm:ss";
/** list of variables to plot. **/
public List<String> prodArray;
@ -226,7 +231,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
protected abstract void shellDisposeAction();
/** 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. **/
public int rowIndex;
@ -243,7 +248,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
/** current site **/
protected String site;
protected FSSObsMonitorConfigurationManager configMgr = null;
protected FSSObsMonitorConfigurationManager configMgr;
/**
* Constructor
@ -654,6 +659,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
initiateProdArray();
dlgTitle = getTrendPlotName(prodArray) + " Trend Plot for " + station
+ "#" + dataSrc;
if (graphType == GraphType.Trend) {
TrendPlotDlg tpd = (TrendPlotDlg) openedDlgs.get(dlgTitle);
if (tpd == null) {
@ -789,7 +795,6 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
private void zoomToZone(String zone) throws Exception {
Coordinate zoneCenter = MonitorAreaUtils.getZoneCenter(zone);
if (zoneCenter == null) { // Test a newly added zone.
configMgr = getMonitorAreaConfigInstance();
AreaIdXML zoneXML = configMgr.getAreaXml(zone);
if (zoneXML != null // Coordinates do not the null values.
&& (zoneXML.getCLon() != null || zoneXML.getCLat() != null)) {
@ -814,11 +819,29 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
try {
Coordinate stnCenter = MonitorAreaUtils
.getStationCenter(selectedStation);
if (stnCenter != null) {
zoomAndRecenter(stnCenter, STATION_ZOOM_LEVEL);
if (stnCenter == null) {
// 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) {
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e);
zoomAndRecenter(stnCenter, STATION_ZOOM_LEVEL);
} 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("_");
if (prod.size() > 1) {
varName = name.substring(0, stInd);
if (varName.equals("SCA")) {
switch (varName) {
case "SCA":
varName = "Small Craft Advisory";
} else if (varName.equals("GALE")) {
break;
case "GALE":
varName = "Gale Warning";
} else if (varName.equals("STORM")) {
break;
case "STORM":
varName = "Storm Warning";
} else if (varName.equals("HURRICANE")) {
break;
case "HURRICANE":
varName = "Hurricane Force Wind Warning";
} else if (varName.equals("BLIZ")) {
break;
case "BLIZ":
varName = "Blizzard Warning";
} else if (varName.equals("FRZ")) {
break;
case "FRZ":
varName = "Freezing Precipitation";
} else if (varName.equals("HSW")) {
break;
case "HSW":
varName = "Heavy Snow Warning";
break;
default:
statusHandler.error("Invalid name for variable " + varName);
}
} else {
varName = name.substring(stInd + 1);

View file

@ -21,8 +21,10 @@ package com.raytheon.uf.viz.monitor.util;
import java.util.HashMap;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
/**
* TODO Add Description
* Monitor Configuration Constants.
*
* <pre>
*
@ -30,57 +32,59 @@ import java.util.HashMap;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 16, 2009 2076 avarani Initial creation
* Sep 18, 2015 3873 skorolev Corrected appName.
*
* </pre>
*
* @author avarani
* @version 1.0
*/
public class MonitorConfigConstants
{
public class MonitorConfigConstants {
private static HashMap<String, Boolean> ryHigherMapSS;
private static HashMap<String, Boolean> ryHigherMapSnow;
private static HashMap<String, Boolean> ryHigherMapFog;
private static boolean rankSwellPeriodHigh = false;
/*
* SAFESEAS
*/
public static enum SafeSeasDisplay
{
SS_DISP_PROD_SCA_WIND_SPEED("Display.Product.SCA.wind_speed"),
SS_DISP_PROD_SCA_GUST_SPEED("Display.Product.SCA.gust_speed"),
SS_DISP_PROD_SCA_PEAK_WIND("Display.Product.SCA.peak_wind_speed"),
SS_DISP_PROD_SCA_WAVE_HT("Display.Product.SCA.wave_height"),
SS_DISP_PROD_GALE_WIND_SPEED("Display.Product.Gale.wind_speed"),
SS_DISP_PROD_GALE_GUST_SPEED("Display.Product.Gale.gust_speed"),
SS_DISP_PROD_GALE_PEAK_WIND("Display.Product.Gale.peak_wind_speed"),
SS_DISP_PROD_STORM_WIND_SPEED("Display.Product.Storm.wind_speed"),
SS_DISP_PROD_STORM_GUST_SPEED("Display.Product.Storm.gust_speed"),
SS_DISP_PROD_STORM_PEAK_WIND("Display.Product.Storm.peak_wind_speed"),
SS_DISP_PROD_HFWW_WIND_SPEED("Display.Product.Hurricane.wind_speed"),
SS_DISP_PROD_HFWW_GUST_SPEED("Display.Product.Hurricane.gust_speed"),
SS_DISP_PROD_HFWW_PEAK_WIND("Display.Product.Hurricane.peak_wind_speed"),
SS_DISP_WIND_WIND_SPEED("Display.Wind.wind_speed"),
SS_DISP_WIND_PEAK_WIND("Display.Wind.peak_wind_speed"),
SS_DISP_WIND_GUST_SPEED("Display.Wind.gust_speed"),
SS_DISP_WIND_DIR_FROM("Display.Wind.dirFrom"),
SS_DISP_WIND_DIR_TO("Display.Wind.dirTo"),
SS_DISP_METEO_VIS("Display.Meteo.visibility"),
SS_DISP_METEO_TEMP("Display.Meteo.temperature"),
SS_DISP_METEO_DEWPT("Display.Meteo.dewpoint"),
SS_DISP_METEO_SLP("Display.Meteo.slp"),
SS_DISP_METEO_SST("Display.Meteo.sea_surface_temp"),
SS_DISP_METEO_WAVE_HT("Display.Meteo.wave_height"),
SS_DISP_METEO_WAVE_STEEP("Display.Meteo.wave_steepness"),
SS_DISP_SWELL_PRIM_HT("Display.Swell.Primary.height"),
SS_DISP_SWELL_PRIM_PD("Display.Swell.Primary.period"),
SS_DISP_SWELL_PRIM_DIR_FROM("Display.Swell.Primary.dirFrom"),
SS_DISP_SWELL_PRIM_DIR_TO("Display.Swell.Primary.dirTo"),
SS_DISP_SWELL_SEC_HT("Display.Swell.Secondary.height"),
SS_DISP_SWELL_SEC_PD("Display.Swell.Secondary.period"),
SS_DISP_SWELL_SEC_DIR_FROM("Display.Swell.Secondary.dirFrom"),
SS_DISP_SWELL_SEC_DIR_TO("Display.Swell.Secondary.dirTo");
* SAFESEAS
*/
public static enum SafeSeasDisplay {
SS_DISP_PROD_SCA_WIND_SPEED("Display.Product.SCA.wind_speed"), SS_DISP_PROD_SCA_GUST_SPEED(
"Display.Product.SCA.gust_speed"), SS_DISP_PROD_SCA_PEAK_WIND(
"Display.Product.SCA.peak_wind_speed"), SS_DISP_PROD_SCA_WAVE_HT(
"Display.Product.SCA.wave_height"), SS_DISP_PROD_GALE_WIND_SPEED(
"Display.Product.Gale.wind_speed"), SS_DISP_PROD_GALE_GUST_SPEED(
"Display.Product.Gale.gust_speed"), SS_DISP_PROD_GALE_PEAK_WIND(
"Display.Product.Gale.peak_wind_speed"), SS_DISP_PROD_STORM_WIND_SPEED(
"Display.Product.Storm.wind_speed"), SS_DISP_PROD_STORM_GUST_SPEED(
"Display.Product.Storm.gust_speed"), SS_DISP_PROD_STORM_PEAK_WIND(
"Display.Product.Storm.peak_wind_speed"), SS_DISP_PROD_HFWW_WIND_SPEED(
"Display.Product.Hurricane.wind_speed"), SS_DISP_PROD_HFWW_GUST_SPEED(
"Display.Product.Hurricane.gust_speed"), SS_DISP_PROD_HFWW_PEAK_WIND(
"Display.Product.Hurricane.peak_wind_speed"), SS_DISP_WIND_WIND_SPEED(
"Display.Wind.wind_speed"), SS_DISP_WIND_PEAK_WIND(
"Display.Wind.peak_wind_speed"), SS_DISP_WIND_GUST_SPEED(
"Display.Wind.gust_speed"), SS_DISP_WIND_DIR_FROM(
"Display.Wind.dirFrom"), SS_DISP_WIND_DIR_TO(
"Display.Wind.dirTo"), SS_DISP_METEO_VIS(
"Display.Meteo.visibility"), SS_DISP_METEO_TEMP(
"Display.Meteo.temperature"), SS_DISP_METEO_DEWPT(
"Display.Meteo.dewpoint"), SS_DISP_METEO_SLP(
"Display.Meteo.slp"), SS_DISP_METEO_SST(
"Display.Meteo.sea_surface_temp"), SS_DISP_METEO_WAVE_HT(
"Display.Meteo.wave_height"), SS_DISP_METEO_WAVE_STEEP(
"Display.Meteo.wave_steepness"), SS_DISP_SWELL_PRIM_HT(
"Display.Swell.Primary.height"), SS_DISP_SWELL_PRIM_PD(
"Display.Swell.Primary.period"), SS_DISP_SWELL_PRIM_DIR_FROM(
"Display.Swell.Primary.dirFrom"), SS_DISP_SWELL_PRIM_DIR_TO(
"Display.Swell.Primary.dirTo"), SS_DISP_SWELL_SEC_HT(
"Display.Swell.Secondary.height"), SS_DISP_SWELL_SEC_PD(
"Display.Swell.Secondary.period"), SS_DISP_SWELL_SEC_DIR_FROM(
"Display.Swell.Secondary.dirFrom"), SS_DISP_SWELL_SEC_DIR_TO(
"Display.Swell.Secondary.dirTo");
String XMLKey;
@ -92,22 +96,21 @@ public class MonitorConfigConstants
return XMLKey;
}
}
public static enum SafeSeasMonitor
{
SS_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"),
SS_MON_METEO_PEAK_WIND("Monitor.Meteo.peak_wind_speed"),
SS_MON_METEO_GUST_SPEED("Monitor.Meteo.gust_speed"),
SS_MON_METEO_WAVE_HT("Monitor.Meteo.wave_height"),
SS_MON_METEO_VIS("Monitor.Meteo.visibility"),
SS_MON_SWELL_PRIM_HT("Monitor.Swell.Primary.height"),
SS_MON_SWELL_PRIM_PD("Monitor.Swell.Primary.period"),
SS_MON_SWELL_PRIM_DIR_FROM("Monitor.Swell.Primary.dirFrom"),
SS_MON_SWELL_PRIM_DIR_TO("Monitor.Swell.Primary.dirTo"),
SS_MON_SWELL_SEC_HT("Monitor.Swell.Secondary.height"),
SS_MON_SWELL_SEC_PD("Monitor.Swell.Secondary.period"),
SS_MON_SWELL_SEC_DIR_FROM("Monitor.Swell.Secondary.dirFrom"),
SS_MON_SWELL_SEC_DIR_TO("Monitor.Swell.Secondary.dirTo");
public static enum SafeSeasMonitor {
SS_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), SS_MON_METEO_PEAK_WIND(
"Monitor.Meteo.peak_wind_speed"), SS_MON_METEO_GUST_SPEED(
"Monitor.Meteo.gust_speed"), SS_MON_METEO_WAVE_HT(
"Monitor.Meteo.wave_height"), SS_MON_METEO_VIS(
"Monitor.Meteo.visibility"), SS_MON_SWELL_PRIM_HT(
"Monitor.Swell.Primary.height"), SS_MON_SWELL_PRIM_PD(
"Monitor.Swell.Primary.period"), SS_MON_SWELL_PRIM_DIR_FROM(
"Monitor.Swell.Primary.dirFrom"), SS_MON_SWELL_PRIM_DIR_TO(
"Monitor.Swell.Primary.dirTo"), SS_MON_SWELL_SEC_HT(
"Monitor.Swell.Secondary.height"), SS_MON_SWELL_SEC_PD(
"Monitor.Swell.Secondary.period"), SS_MON_SWELL_SEC_DIR_FROM(
"Monitor.Swell.Secondary.dirFrom"), SS_MON_SWELL_SEC_DIR_TO(
"Monitor.Swell.Secondary.dirTo");
String XMLKey;
@ -121,34 +124,33 @@ public class MonitorConfigConstants
}
/*
* SNOW
* SNOW
*/
public static enum SnowDisplay
{
SNOW_DISP_PROD_BLIZZ_VIS("Display.Product.Blizzard.visibility"),
SNOW_DISP_PROD_BLIZZ_WIND_SPEED("Display.Product.Blizzard.wind_speed"),
SNOW_DISP_PROD_BLIZZ_GUST_SPEED("Display.Product.Blizzard.gust_speed"),
SNOW_DISP_PROD_BLIZZ_PEAK_WIND("Display.Product.Blizzard.peak_wind_speed"),
SNOW_DISP_PROD_FRZ_TEMP("Display.Product.Freezing_Precip.temperature"),
SNOW_DISP_PROD_FRZ_HOURLY_PRECIP("Display.Product.Freezing_Precip.hourly_precip"),
SNOW_DISP_PROD_HSW_SNINCR_HOURLY("Display.Product.Heavy_Snow_Warning.snincr_hourly"),
SNOW_DISP_PROD_HSW_SNINCR_TOTAL("Display.Product.Heavy_Snow_Warning.snincr_total"),
SNOW_DISP_PROD_HSW_SNOW_DEPTH("Display.Product.Heavy_Snow_Warning.snow_depth"),
SNOW_DISP_WIND_WIND_SPEED("Display.Product.Wind.wind_speed"),
SNOW_DISP_WIND_PEAK_WIND("Display.Product.Wind.peak_wind_speed"),
SNOW_DISP_WIND_GUST_SPEED("Display.Product.Wind.gust_speed"),
SNOW_DISP_WIND_DIR_FROM("Display.Product.Wind.dirFrom"),
SNOW_DISP_WIND_DIR_TO("Display.Product.Wind.dirTo"),
SNOW_DISP_METEO_TEMP("Display.Meteo.temperature"),
SNOW_DISP_METEO_DEWPT("Display.Meteo.dewpoint"),
SNOW_DISP_METEO_VIS("Display.Meteo.visibility"),
SNOW_DISP_METEO_SLP("Display.Meteo.slp"),
SNOW_DISP_METEO_HOURLY_PRECIP("Display.Meteo.hourly_precip"),
SNOW_DISP_METEO_WIND_CHILL("Display.Meteo.wind_chill"),
SNOW_DISP_METEO_FROSTBITE("Display.Meteo.frostbite_time"),
SNOW_DISP_METEO_SNOW_DEPTH("Display.Meteo.snow_depth"),
SNOW_DISP_METEO_SNINCR_HOURLY("Display.Meteo.snincr_hourly"),
SNOW_DISP_METEO_SNINCR_TOTAL("Display.Meteo.snincr_total");
public static enum SnowDisplay {
SNOW_DISP_PROD_BLIZZ_VIS("Display.Product.Blizzard.visibility"), SNOW_DISP_PROD_BLIZZ_WIND_SPEED(
"Display.Product.Blizzard.wind_speed"), SNOW_DISP_PROD_BLIZZ_GUST_SPEED(
"Display.Product.Blizzard.gust_speed"), SNOW_DISP_PROD_BLIZZ_PEAK_WIND(
"Display.Product.Blizzard.peak_wind_speed"), SNOW_DISP_PROD_FRZ_TEMP(
"Display.Product.Freezing_Precip.temperature"), SNOW_DISP_PROD_FRZ_HOURLY_PRECIP(
"Display.Product.Freezing_Precip.hourly_precip"), SNOW_DISP_PROD_HSW_SNINCR_HOURLY(
"Display.Product.Heavy_Snow_Warning.snincr_hourly"), SNOW_DISP_PROD_HSW_SNINCR_TOTAL(
"Display.Product.Heavy_Snow_Warning.snincr_total"), SNOW_DISP_PROD_HSW_SNOW_DEPTH(
"Display.Product.Heavy_Snow_Warning.snow_depth"), SNOW_DISP_WIND_WIND_SPEED(
"Display.Product.Wind.wind_speed"), SNOW_DISP_WIND_PEAK_WIND(
"Display.Product.Wind.peak_wind_speed"), SNOW_DISP_WIND_GUST_SPEED(
"Display.Product.Wind.gust_speed"), SNOW_DISP_WIND_DIR_FROM(
"Display.Product.Wind.dirFrom"), SNOW_DISP_WIND_DIR_TO(
"Display.Product.Wind.dirTo"), SNOW_DISP_METEO_TEMP(
"Display.Meteo.temperature"), SNOW_DISP_METEO_DEWPT(
"Display.Meteo.dewpoint"), SNOW_DISP_METEO_VIS(
"Display.Meteo.visibility"), SNOW_DISP_METEO_SLP(
"Display.Meteo.slp"), SNOW_DISP_METEO_HOURLY_PRECIP(
"Display.Meteo.hourly_precip"), SNOW_DISP_METEO_WIND_CHILL(
"Display.Meteo.wind_chill"), SNOW_DISP_METEO_FROSTBITE(
"Display.Meteo.frostbite_time"), SNOW_DISP_METEO_SNOW_DEPTH(
"Display.Meteo.snow_depth"), SNOW_DISP_METEO_SNINCR_HOURLY(
"Display.Meteo.snincr_hourly"), SNOW_DISP_METEO_SNINCR_TOTAL(
"Display.Meteo.snincr_total");
String XMLKey;
@ -160,16 +162,15 @@ public class MonitorConfigConstants
return XMLKey;
}
}
public static enum SnowMonitor
{
SNOW_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"),
SNOW_MON_METEO_PEAK_WIND("Monitor.Meteo.peak_wind_speed"),
SNOW_MON_METEO_GUST_SPEED("Monitor.Meteo.gust_speed"),
SNOW_MON_METEO_TEMP("Monitor.Meteo.temperature"),
SNOW_MON_METEO_WIND_CHILL("Monitor.Meteo.wind_chill"),
SNOW_MON_METEO_VIS("Monitor.Meteo.visibility"),
SNOW_MON_METEO_SNOW_DEPTH("Monitor.Meteo.snow_depth");
public static enum SnowMonitor {
SNOW_MON_METEO_WIND_SPEED("Monitor.Meteo.wind_speed"), SNOW_MON_METEO_PEAK_WIND(
"Monitor.Meteo.peak_wind_speed"), SNOW_MON_METEO_GUST_SPEED(
"Monitor.Meteo.gust_speed"), SNOW_MON_METEO_TEMP(
"Monitor.Meteo.temperature"), SNOW_MON_METEO_WIND_CHILL(
"Monitor.Meteo.wind_chill"), SNOW_MON_METEO_VIS(
"Monitor.Meteo.visibility"), SNOW_MON_METEO_SNOW_DEPTH(
"Monitor.Meteo.snow_depth");
String XMLKey;
@ -183,19 +184,18 @@ public class MonitorConfigConstants
}
// FOG
public static enum FogDisplay
{
FOG_DISP_METEO_VIS("Display.Meteo.visibility"),
FOG_DISP_METEO_CEILING("Display.Meteo.ceiling"),
FOG_DISP_METEO_TEMP("Display.Meteo.temperature"),
FOG_DISP_METEO_DEWPT("Display.Meteo.dewpoint"),
FOG_DISP_METEO_T_TD("Display.Meteo.t_td"),
FOG_DISP_METEO_REL_HUMIDITY("Display.Meteo.relative_humidity"),
FOG_DISP_WIND_WIND_SPEED("Display.Wind.wind_speed"),
FOG_DISP_WIND_PEAK_WIND("Display.Wind.peak_wind_speed"),
FOG_DISP_WIND_GUST_SPEED("Display.Wind.gust_speed"),
FOG_DISP_WIND_DIR_FROM("Display.Wind.dirFrom"),
FOG_DISP_WIND_DIR_TO("Display.Wind.dirTo");
public static enum FogDisplay {
FOG_DISP_METEO_VIS("Display.Meteo.visibility"), FOG_DISP_METEO_CEILING(
"Display.Meteo.ceiling"), FOG_DISP_METEO_TEMP(
"Display.Meteo.temperature"), FOG_DISP_METEO_DEWPT(
"Display.Meteo.dewpoint"), FOG_DISP_METEO_T_TD(
"Display.Meteo.t_td"), FOG_DISP_METEO_REL_HUMIDITY(
"Display.Meteo.relative_humidity"), FOG_DISP_WIND_WIND_SPEED(
"Display.Wind.wind_speed"), FOG_DISP_WIND_PEAK_WIND(
"Display.Wind.peak_wind_speed"), FOG_DISP_WIND_GUST_SPEED(
"Display.Wind.gust_speed"), FOG_DISP_WIND_DIR_FROM(
"Display.Wind.dirFrom"), FOG_DISP_WIND_DIR_TO(
"Display.Wind.dirTo");
String XMLKey;
@ -207,11 +207,10 @@ public class MonitorConfigConstants
return XMLKey;
}
}
public static enum FogMonitor
{
public static enum FogMonitor {
FOG_MONITOR_METEO_VIS("Monitor.Meteo.visiblity");
String XMLKey;
FogMonitor(String s) {
@ -222,340 +221,248 @@ public class MonitorConfigConstants
return XMLKey;
}
}
public static Boolean rValueIsHigher(String key, String appName)
{
if ( appName.equals("safeseas") ) {
if ( ryHigherMapSS == null ) {
createRYHigherMapSS();
}
if ( ryHigherMapSS.containsKey(key) == true ) {
return ryHigherMapSS.get(key);
}
} else if ( appName.equals("snow") ) {
if ( ryHigherMapSnow == null ) {
createRYHigherMapSnow();
}
if ( ryHigherMapSnow.containsKey(key) == true ) {
return ryHigherMapSnow.get(key);
}
} else if ( appName.equals("fog") ) {
if ( ryHigherMapFog == null ) {
createRYHigherMapFog();
}
if ( ryHigherMapFog.containsKey(key) == true ) {
return ryHigherMapFog.get(key);
}
} else {
// do nothing here
}
public static Boolean rValueIsHigher(String key, AppName appName) {
if (appName.equals(AppName.SAFESEAS)) {
if (ryHigherMapSS == null) {
createRYHigherMapSS();
}
if (ryHigherMapSS.containsKey(key) == true) {
return ryHigherMapSS.get(key);
}
} else if (appName.equals(AppName.SNOW)) {
if (ryHigherMapSnow == null) {
createRYHigherMapSnow();
}
if (ryHigherMapSnow.containsKey(key) == true) {
return ryHigherMapSnow.get(key);
}
} else if (appName.equals(AppName.FOG)) {
if (ryHigherMapFog == null) {
createRYHigherMapFog();
}
if (ryHigherMapFog.containsKey(key) == true) {
return ryHigherMapFog.get(key);
}
} else {
// do nothing here
}
return false;
}
private static void createRYHigherMapSS()
{
private static void createRYHigherMapSS() {
ryHigherMapSS = new HashMap<String, Boolean>();
/*
* SafeSeas Display
*/
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WIND_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_GUST_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WAVE_HT.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_WIND_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_GUST_SPEED.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_GALE_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_STORM_WIND_SPEED.getXmlKey(), true);
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_PROD_SCA_WIND_SPEED.getXmlKey(), true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_SCA_GUST_SPEED.getXmlKey(), true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_SCA_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_PROD_SCA_WAVE_HT.getXmlKey(),
true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_GALE_WIND_SPEED.getXmlKey(), true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_GALE_GUST_SPEED.getXmlKey(), true);
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_PROD_GALE_PEAK_WIND.getXmlKey(), true);
ryHigherMapSS
.put(SafeSeasDisplay.SS_DISP_PROD_STORM_WIND_SPEED.getXmlKey(),
true);
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_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_SST.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(), rankSwellPeriodHigh);
ryHigherMapSS.put(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);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_HT.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_METEO_WAVE_STEEP.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_HT.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(),
rankSwellPeriodHigh);
ryHigherMapSS.put(
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_PEAK_WIND.getXmlKey(), 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_WIND_SPEED.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_METEO_PEAK_WIND.getXmlKey(),
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_SWELL_PRIM_HT.getXmlKey(), true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey(), false);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey(), 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);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_HT.getXmlKey(),
true);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_PD.getXmlKey(),
false);
ryHigherMapSS.put(
SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_FROM.getXmlKey(), null);
ryHigherMapSS.put(SafeSeasMonitor.SS_MON_SWELL_PRIM_DIR_TO.getXmlKey(),
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()
{
ryHigherMapSnow = new HashMap<String, Boolean>();
private static void createRYHigherMapSnow() {
ryHigherMapSnow = new HashMap<String, Boolean>();
/*
* Snow Display
*/
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_VIS.getXmlKey(), false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_TEMP.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_HOURLY_PRECIP.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_HOURLY.getXmlKey(), true);
ryHigherMapSnow.put(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_PROD_BLIZZ_VIS.getXmlKey(),
false);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_PROD_BLIZZ_WIND_SPEED.getXmlKey(), true);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_PROD_BLIZZ_GUST_SPEED.getXmlKey(), true);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_PROD_BLIZZ_PEAK_WIND.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_PROD_FRZ_TEMP.getXmlKey(),
true);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_PROD_FRZ_HOURLY_PRECIP.getXmlKey(), true);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_PROD_HSW_SNINCR_HOURLY.getXmlKey(), true);
ryHigherMapSnow.put(
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_SLP.getXmlKey(), false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey(), false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey(), 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);
ryHigherMapSnow.put(
SnowDisplay.SNOW_DISP_METEO_HOURLY_PRECIP.getXmlKey(), true);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_WIND_CHILL.getXmlKey(),
false);
ryHigherMapSnow.put(SnowDisplay.SNOW_DISP_METEO_FROSTBITE.getXmlKey(),
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
*/
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_WIND_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_WIND_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_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_SNOW_DEPTH.getXmlKey(), true);
ryHigherMapSnow.put(SnowMonitor.SNOW_MON_METEO_SNOW_DEPTH.getXmlKey(),
true);
}
private static void createRYHigherMapFog()
{
ryHigherMapFog = new HashMap<String, Boolean>();
private static void createRYHigherMapFog() {
ryHigherMapFog = new HashMap<String, Boolean>();
/*
* Fog Display
*/
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_DEWPT.getXmlKey(), true);
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_WIND_WIND_SPEED.getXmlKey(), 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_METEO_REL_HUMIDITY.getXmlKey(),
true);
ryHigherMapFog.put(FogDisplay.FOG_DISP_WIND_WIND_SPEED.getXmlKey(),
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_TO.getXmlKey(), null);
/*
* Fog Monitor
*/
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",
"trend", "mClr", "clucon", "inTbl", "min", "intrvl", "range", "alarm",
"aAlarm", "units" };
"trend", "mClr", "clucon", "inTbl", "min", "intrvl", "range",
"alarm", "aAlarm", "units" };
public static final String[] FFMP_TABLE = { "ffmpTable", "name", "rate",
"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();
// }
// }
//
"qpe", "guidance", "ratio", "diff" };
public static enum tableFields {
LOW(0), MID(1), UPP(2), RANK(3), TREND(4), MCLR(5), CLUCON(6), INTBL(7),
MIN(8), INTRVL(9), RANGE(10), ALARM(11), AALARM(12), UNITS(13);
LOW(0), MID(1), UPP(2), RANK(3), TREND(4), MCLR(5), CLUCON(6), INTBL(7), MIN(
8), INTRVL(9), RANGE(10), ALARM(11), AALARM(12), UNITS(13);
int index;
@ -568,8 +475,7 @@ public class MonitorConfigConstants
return TABLE_FIELDS[index];
}
}
public static enum ffmpTable {
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) {
return FFMP_TABLE[0] + "." + FFMP_TABLE[index] + "." + field.toString();
return FFMP_TABLE[0] + "." + FFMP_TABLE[index] + "."
+ field.toString();
}
}
// Other Constants
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 COLUMN_LIST_KEY = "ColumnList";
public static final String SCAN_RADAR_ICAO = "radarIcao";
public static final String SCAN_WMO_NUMBER = "wmoNumber";
public static final String SCAN_START_INTERVAL = "startInterval";
public static final String SCAN_CELL_TILT = "cellTilt";
public static final String SCAN_DMD_TILT = "dmdTilt";
private MonitorConfigConstants() {
// no instantiation
}
public static void setRankSwellPeriodHigh(boolean rankSwellPeriodHigh) {
MonitorConfigConstants.rankSwellPeriodHigh = rankSwellPeriodHigh;
if ( ryHigherMapSS != null ) {
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(), rankSwellPeriodHigh);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(), rankSwellPeriodHigh);
}
}
public static void setRankSwellPeriodHigh(boolean rankSwellPeriodHigh) {
MonitorConfigConstants.rankSwellPeriodHigh = rankSwellPeriodHigh;
if (ryHigherMapSS != null) {
ryHigherMapSS.put(
SafeSeasDisplay.SS_DISP_SWELL_PRIM_PD.getXmlKey(),
rankSwellPeriodHigh);
ryHigherMapSS.put(SafeSeasDisplay.SS_DISP_SWELL_SEC_PD.getXmlKey(),
rankSwellPeriodHigh);
}
}
public static boolean isRankSwellPeriodHigh() {
return rankSwellPeriodHigh;
}
public static boolean isRankSwellPeriodHigh() {
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.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
*/
@ -39,14 +42,12 @@ public class Activator extends AbstractUIPlugin {
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
RcmResourceProvider.setInstance(new LocalizationRcmResourceProvider());
}
/*
* (non-Javadoc)

View file

@ -22,6 +22,9 @@ package com.raytheon.uf.viz.radarapps.rps;
import org.eclipse.ui.plugin.AbstractUIPlugin;
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
*/
@ -39,14 +42,12 @@ public class Activator extends AbstractUIPlugin {
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
RcmResourceProvider.setInstance(new LocalizationRcmResourceProvider());
}
/*
* (non-Javadoc)

View file

@ -40,7 +40,8 @@ import com.raytheon.uf.viz.thinclient.preferences.ThinClientPreferenceConstants;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 8, 2011 mschenke Initial creation
* Nov 8, 2011 mschenke Initial creation
* Oct 08, 2015 4891 njensen Added tooltips
*
* </pre>
*
@ -60,7 +61,7 @@ public class ThinClientCachePreferences extends FieldEditorPreferencePage {
super(GRID);
setPreferenceStore(Activator.getDefault().getPreferenceStore());
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()));
// 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(
ThinClientPreferenceConstants.P_CACHE_LOCALIZATION,
"Cache &Localization Files", getFieldEditorParent());
cacheLocalization
.getDescriptionControl(getFieldEditorParent())
.setToolTipText(
"Only download missing localization files (not updated files)");
addField(cacheLocalization);
// avoid the server for localization
disableRemoteLocalization = new SyncLocalizationEditor(
ThinClientPreferenceConstants.P_DISABLE_REMOTE_LOCALIZATION,
"Use &Only Cached Localization Files", getFieldEditorParent());
disableRemoteLocalization.getDescriptionControl(getFieldEditorParent())
.setToolTipText(
"Only use previously downloaded localization files");
addField(disableRemoteLocalization);
// map data
addField(new BooleanFieldEditor(
BooleanFieldEditor cacheMaps = new BooleanFieldEditor(
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.
* 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
* Oct 08, 2015 4891 njensen Added tooltip to useProxies
*
* </pre>
*
@ -90,8 +91,12 @@ public class ThinClientServerPreferences extends FieldEditorPreferencePage {
useProxies = new BooleanFieldEditor(
ThinClientPreferenceConstants.P_USE_PROXIES,
"&Use Proxy Servers", getFieldEditorParent());
useProxies
.getDescriptionControl(getFieldEditorParent())
.setToolTipText(
"Connect to a remote proxy server configured to support thin clients");
addField(useProxies);
proxyServer = new TextOrComboEditor(getFieldEditorParent(),
this.getPreferenceStore(),
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);
addConnectivityButton();

View file

@ -36,7 +36,8 @@ import com.raytheon.uf.viz.thinclient.Activator;
*
* 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>
*
@ -46,12 +47,6 @@ import com.raytheon.uf.viz.thinclient.Activator;
public class PreferenceInitializer extends AbstractPreferenceInitializer {
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#
* initializeDefaultPreferences()
*/
@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
@ -82,7 +77,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
// Default data refresh rate
store.setDefault(ThinClientPreferenceConstants.P_DATA_REFRESH_INTERVAL,
30);
5);
// By default, no proxy used
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
* Jun 03, 2014 3217 bsteffen Add option to always open startup dialog.
* 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();
}
});
useProxyCheck
.setToolTipText("Connect to a remote proxy server configured to support thin clients");
IPreferenceStore thinPrefs = Activator.getDefault()
.getPreferenceStore();

View file

@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.core,
com.raytheon.viz.ui;bundle-version="1.11.9",
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-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.raytheon.uf.common.dataplugin.persist,

View file

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

View file

@ -30,15 +30,16 @@
# SOFTWARE HISTORY
# 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
# ----------------------------------------------------------------------------
# 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
# 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):
from gfeConfig import *
@ -48,7 +49,7 @@ HideConfigFile = 1
DefaultGroup = "NewTerrain"
mutableModel = "EditTopo_Topo"
mutableModel = "EditTopo_NewTerrain"
dbTypes = ["EditTopo", ""]
@ -56,8 +57,11 @@ dbTypes = ["EditTopo", ""]
# fact that these grids have a 1 second resolution
SplitBoundaryDisplay = no
GMTED_fitToDataColorTable = "All Grids"
GTOPO_fitToDataColorTable = "All Grids"
NewTopo_fitToDataColorTable = "All Grids"
Topo_fitToDataColorTable = "All Grids"
NewTerrain_fitToDataColorTable = "All Grids"
OldTerrain_fitToDataColorTable = "All Grids"
GridManagerSortOrder = ['NewTopo', 'Topo', 'GMTED', 'GTOPO']
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
# ----------------------------------------------------------------------------
#
# 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
# Procedure is to appear.
@ -40,6 +47,7 @@ from numpy import *
import SmartScript
import AbsTime
import HazardUtils
import VTECPartners
import LogStream, logging
import UFStatusHandler
@ -89,7 +97,7 @@ class Procedure (SmartScript.SmartScript):
continue
# only look at the KNHC records
if v['officeid'] != 'KNHC':
if v['officeid'] not in VTECPartners.VTEC_TPC_SITE:
continue
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:
if "Cancel" == e.errorType() and "Cancel" == e.errorInfo():
return None
msg = moduleName + ":" + e.errorType() + ": " + e.errorInfo()
raise RuntimeError(msg)
raise
def getMenuName(self, name):
return getattr(sys.modules[name], "MenuItems", [])

View file

@ -1,6 +1,7 @@
<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="OldTerrain_SFC:OAX_GRID_EditTopo_NewTerrain_00000000_0000" relativeCycleNumber="-1"/>
<WEItem parmID="NewTerrain_SFC:OAX_GRID_EditTopo_NewTerrain_00000000_0000" relativeCycleNumber="-1"/>
<WEItem parmID="GMTED_SFC:OAX_GRID_EditTopo_BaseTerrain_00000000_0000" relativeCycleNumber="-1"/>
<WEItem parmID="GTOPO_SFC:OAX_GRID_EditTopo_BaseTerrain_00000000_0000" relativeCycleNumber="-1"/>
</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)
* Aug 31, 2015 4749 njensen Changed setCloseCallback to addCloseCallback
* 09/15/2015 4858 dgilling Disable store/transmit in DRT mode.
* 10/14/2015 4959 dgilling Support new function signature for wordWrap.
*
* </pre>
*
@ -2961,7 +2962,7 @@ public class ProductEditorComp extends Composite implements
while ((curLine <= lastLine) && (curLine < styledText.getLineCount())) {
int lineOff = styledText.getOffsetAtLine(curLine);
// 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 lastIdx = indices[1];
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.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.ProductEditorLogger;
import com.raytheon.uf.common.status.UFStatus;
@ -70,7 +68,7 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
/**
* Composite containing the product editor.
*
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
@ -91,12 +89,14 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
* editing of framing codes.
* 07/02/2015 13753 lshi Update times for products in Product Editor
* 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>
*
*
* @author lvenable
* @version 1.0
*
*
*/
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 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.
*/
private final ProductEditorComp parent;
private final WordWrapPythonExecutor wrapper;
/**
* Styled text editor.
*/
@ -166,8 +183,6 @@ public class StyledTextComp extends Composite {
private boolean dirty = false;
private PythonScript python = null;
protected Color bgColor;
protected Color fgColor;
@ -182,15 +197,6 @@ public class StyledTextComp extends Composite {
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() {
return autoWrapMode;
}
@ -201,7 +207,7 @@ public class StyledTextComp extends Composite {
/**
* Constructor.
*
*
* @param parent
* Parent composite.
* @param wrapMode
@ -214,6 +220,7 @@ public class StyledTextComp extends Composite {
this.parent = parent;
this.wrapColumn = wrapColumn;
this.autoWrapMode = wrapMode;
this.wrapper = new WordWrapPythonExecutor();
this.peLog = new ProductEditorLogger(parent.getProductName());
@ -250,30 +257,15 @@ public class StyledTextComp extends Composite {
this.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent arg0) {
wrapper.dispose();
textFont.dispose();
bgColor.dispose();
fgColor.dispose();
frameColor.dispose();
insertColor.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.
*
*
* @return The StyledText editor.
*/
public StyledText getTextEditorST() {
@ -332,7 +324,7 @@ public class StyledTextComp extends Composite {
/**
* Set the product text.
*
*
* @param text
* The product text.
*/
@ -502,7 +494,7 @@ public class StyledTextComp extends Composite {
/**
* Parse the product text string.
*
*
* @param productText
* Complete product text.
* @throws JepException
@ -598,7 +590,7 @@ public class StyledTextComp extends Composite {
/**
* Replacement of the text in the given range with new text.
*
*
* @param tip
* the range of text to be replaced
* @param text
@ -707,7 +699,7 @@ public class StyledTextComp extends Composite {
* 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
* field in the verify event indicates whether or not to modify the text.
*
*
* @param event
* 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
* selected text.
*
*
* @return True if there is selected text that contains locked text.
*/
private boolean selectionHasLockedText() {
@ -811,12 +803,12 @@ public class StyledTextComp extends Composite {
/**
* Check if there is locked text in the specified range of text.
*
*
* @param offset
* The starting point of the locked text search.
* @param length
* The length of the search.
*
*
* @return Whether or not there is text in the range that contains locked
* text.
*/
@ -834,7 +826,7 @@ public class StyledTextComp extends Composite {
/**
* Check if the key being pressed is a "non-edit" key.
*
*
* @param event
* Verify event.
* @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.
*
*
* @param e
* Event fired.
*/
@ -983,7 +975,7 @@ public class StyledTextComp extends Composite {
/**
* Checks if the system is editing, e.g. updating the issue time every
* minute, vs a user typing text in the text area
*
*
* @return
*/
private boolean isSystemTextChange() {
@ -1103,7 +1095,7 @@ public class StyledTextComp extends Composite {
eventCursor = event.start + event.length;
}
wordWrap(textEditorST, eventCursor, wrapColumn);
wordWrap(eventCursor, wrapColumn);
if (cursorOffset != eventCursor) {
// 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.
*
*
* @return the column number
*/
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.
*
*
* @param wrapColumn
* 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
* value. Create an SWT Color for display from the value and return it.
*
*
* @param prefs
* A preference store which might have config values.
* @param display
@ -1210,7 +1202,7 @@ public class StyledTextComp extends Composite {
/**
* Send a PROBLEM message if color1 is exactly equal to color2.
*
*
* @param color1
* the first color
* @param color2
@ -1237,7 +1229,7 @@ public class StyledTextComp extends Composite {
* <p>
* The getter name is different to avoid confusion with the getFgColor()
* method of Control.
*
*
* @return the foreground Color
*/
public Color getFgndColor() {
@ -1248,7 +1240,7 @@ public class StyledTextComp extends Composite {
* 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
* should not be disposed before then.
*
*
* @return the frameColor
*/
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
* a copy. It will be disposed when the StyledTextComp is, and should not be
* disposed before then.
*
*
* @return the insertColor
*/
public Color getInsertColor() {
@ -1270,7 +1262,7 @@ public class StyledTextComp extends Composite {
* 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
* should not be disposed before then.
*
*
* @return the lockColor
*/
public Color getLockColor() {
@ -1280,9 +1272,7 @@ public class StyledTextComp extends Composite {
/**
* Word wrap the text in the block around cursorIndex. Adjust the cursor
* position to account for inserted or deleted whitespace.
*
* @param st
* The StyledText in which word wrap is to be performed
*
* @param cursorIndex
* The cursor index
* @param width
@ -1294,15 +1284,11 @@ public class StyledTextComp extends Composite {
* <li>The length of the replacement text</li>
* </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 Pattern FUNNY_SEP_PATTERN = Pattern.compile(FUNNY_SEP,
Pattern.MULTILINE);
final Matcher FUNNY_SEP_MATCHER = FUNNY_SEP_PATTERN.matcher("");
final String NL = st.getLineDelimiter();
String line;
@ -1428,11 +1414,8 @@ public class StyledTextComp extends Composite {
preArgs.put("text", pre);
try {
python.instantiatePythonClass("_wrapper", "textwrap.TextWrapper",
args);
pre = (String) python.execute("fill", "_wrapper", preArgs);
} catch (JepException e) {
pre = wrapper.callWordWrapPython(args, preArgs);
} catch (Exception e) {
statusHandler.error("Python error wrapping text preceding cursor:",
e);
}
@ -1455,10 +1438,8 @@ public class StyledTextComp extends Composite {
postArgs.put("text", post);
try {
python.instantiatePythonClass("_wrapper", "textwrap.TextWrapper",
args);
post = (String) python.execute("fill", "_wrapper", postArgs);
} catch (JepException e) {
post = wrapper.callWordWrapPython(args, postArgs);
} catch (Exception 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.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@ -76,6 +75,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 08/14/2014 #3523 mapeters Updated deprecated {@link DrawableString#textStyle}
* assignments.
* 01/13/2015 #3955 randerso Fix NullPointerException when updateTime is not set
* 10/16/2015 #4971 bsteffen No longer need to reverse grids.
* </pre>
*
* @author chammack
@ -277,7 +277,6 @@ public class SamplePainter {
List<GridID> grids = Grids;
Collections.reverse(grids);
// if list is not defined, then all samples will be painted for
// all parms
@ -356,7 +355,6 @@ public class SamplePainter {
sampleLabels.add(label);
colors.add(labelColor);
}
Collections.reverse(grids);
}
/**

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