Merge branch 'ss_sync (12.3.1)' into 11-Collaboration
Former-commit-id:23d65caf2e
[formerly e8402b080c7d2a712f4f385293aa9b5d1a18484e] Former-commit-id:753de872e0
This commit is contained in:
commit
e3477c90ae
930 changed files with 109434 additions and 16495 deletions
|
@ -1,260 +1,262 @@
|
|||
<project name="Build specific targets and properties" default="noDefault">
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Run a given ${target} on all elements being built -->
|
||||
<!-- Add on <ant> task for each top level element being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<property name="allElementsFile" value="${builder}/allElements.xml"/>
|
||||
<import file="${allElementsFile}" />
|
||||
<target name="allElements">
|
||||
<antcall target="allElementsDelegator" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
|
||||
<get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
|
||||
<unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
|
||||
</target>
|
||||
|
||||
<target name="checkLocalBase">
|
||||
<available file="${base}" property="skipBase" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Check out map files from correct repository -->
|
||||
<!-- Replace values for mapsCheckoutTag as desired. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="checkLocalMaps">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="tagMapFiles" if="tagMaps">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<target name="clean" unless="noclean">
|
||||
<antcall target="allElements">
|
||||
<param name="target" value="cleanElement" />
|
||||
</antcall>
|
||||
</target>
|
||||
|
||||
<target name="gatherLogs">
|
||||
<mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
|
||||
<antcall target="allElements">
|
||||
<param name="target" value="gatherLogs" />
|
||||
</antcall>
|
||||
<unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
|
||||
<fileset dir="${buildDirectory}/features">
|
||||
<include name="**/*.log.zip" />
|
||||
</fileset>
|
||||
</unzip>
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before setup -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preSetup">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- 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>
|
||||
<project name="Build specific targets and properties" default="noDefault">
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Run a given ${target} on all elements being built -->
|
||||
<!-- Add on <ant> task for each top level element being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<property name="allElementsFile" value="${builder}/allElements.xml"/>
|
||||
<import file="${allElementsFile}" />
|
||||
<target name="allElements">
|
||||
<antcall target="allElementsDelegator" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
|
||||
<get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
|
||||
<unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
|
||||
</target>
|
||||
|
||||
<target name="checkLocalBase">
|
||||
<available file="${base}" property="skipBase" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Check out map files from correct repository -->
|
||||
<!-- Replace values for mapsCheckoutTag as desired. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="checkLocalMaps">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="tagMapFiles" if="tagMaps">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<target name="clean" unless="noclean">
|
||||
<antcall target="allElements">
|
||||
<param name="target" value="cleanElement" />
|
||||
</antcall>
|
||||
</target>
|
||||
|
||||
<target name="gatherLogs">
|
||||
<mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
|
||||
<antcall target="allElements">
|
||||
<param name="target" value="gatherLogs" />
|
||||
</antcall>
|
||||
<unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
|
||||
<fileset dir="${buildDirectory}/features">
|
||||
<include name="**/*.log.zip" />
|
||||
</fileset>
|
||||
</unzip>
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before setup -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preSetup">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- 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>
|
||||
</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>
|
||||
</copy>
|
||||
<echo message="meteolib.*/**"/>
|
||||
<copy todir="${buildDirectory}/plugins">
|
||||
<fileset dir="${buildDirectory}/../../../" includes="meteolib.*/**"/>
|
||||
</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>
|
||||
<antcall target="getBaseComponents" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before fetching the build elements -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preFetch">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after fetching the build elements -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postFetch">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before generating the build scripts. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preGenerate">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after generating the build scripts. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postGenerate">
|
||||
<antcall target="clean" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running the build.xmls for the elements being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preProcess">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running the build.xmls for the elements being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postProcess">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running assemble. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preAssemble">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running assemble. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postAssemble">
|
||||
<copy todir="${buildDirectory}/../../static/common/alertviz/etc"
|
||||
verbose="true">
|
||||
<fileset dir="${buildDirectory}/../../static/common/cave/etc">
|
||||
<include name="alertViz*/**" />
|
||||
<include name="monitorIcons/**" />
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<!-- Update the 32-bit linux AlertViz zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/common"
|
||||
excludes="cave/**" />
|
||||
<fileset dir="${buildDirectory}/../../static/linux"
|
||||
excludes="cave/**" />
|
||||
|
||||
</zip>
|
||||
<!-- Update the 64-bit linux AlertViz zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86_64.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/common"
|
||||
excludes="cave/**" />
|
||||
<fileset dir="${buildDirectory}/../../static/linux"
|
||||
excludes="cave/**" />
|
||||
|
||||
</zip>
|
||||
<!-- Update the 32-bit win32 AlertViz zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-win32.win32.x86.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/common"
|
||||
excludes="cave/**" />
|
||||
|
||||
</zip>
|
||||
|
||||
<delete includeEmptyDirs="true">
|
||||
<fileset dir="${buildDirectory}/../../static/common/alertviz/etc">
|
||||
<include name="alertViz*/**" />
|
||||
<include name="monitorIcons/**" />
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running package. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="prePackage">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running package. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postPackage">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after the build is done. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postBuild">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<!-- Steps to do to test the build results -->
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<target name="test">
|
||||
|
||||
<ant antfile="${builder}/test.xml" />
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
|
||||
<target name="checkJUnitTestResults">
|
||||
|
||||
<taskdef name="checkJUnitReports" classname="sample.tools.TestResultCheck" classpath="${builder}/bin;${builder}/extraTools/sampletools.jar" />
|
||||
|
||||
<checkJUnitReports dir="${buildDirectory}/${buildLabel}/testresults" output="${buildDirectory}/junitresults.txt" />
|
||||
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do to publish the build results -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="publish">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Default target -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="noDefault">
|
||||
<echo message="You must specify a target when invoking this file" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
</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>
|
||||
<antcall target="getBaseComponents" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before fetching the build elements -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preFetch">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after fetching the build elements -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postFetch">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before generating the build scripts. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preGenerate">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after generating the build scripts. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postGenerate">
|
||||
<antcall target="clean" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running the build.xmls for the elements being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preProcess">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running the build.xmls for the elements being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postProcess">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running assemble. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preAssemble">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running assemble. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postAssemble">
|
||||
<copy todir="${buildDirectory}/../../static/common/alertviz/etc"
|
||||
verbose="true">
|
||||
<fileset dir="${buildDirectory}/../../static/common/cave/etc">
|
||||
<include name="alertViz*/**" />
|
||||
<include name="monitorIcons/**" />
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<!-- Update the 32-bit linux AlertViz zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/common"
|
||||
excludes="cave/**" />
|
||||
<fileset dir="${buildDirectory}/../../static/linux"
|
||||
excludes="cave/**" />
|
||||
|
||||
</zip>
|
||||
<!-- Update the 64-bit linux AlertViz zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86_64.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/common"
|
||||
excludes="cave/**" />
|
||||
<fileset dir="${buildDirectory}/../../static/linux"
|
||||
excludes="cave/**" />
|
||||
|
||||
</zip>
|
||||
<!-- Update the 32-bit win32 AlertViz zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-win32.win32.x86.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/common"
|
||||
excludes="cave/**" />
|
||||
<fileset dir="${buildDirectory}/../../static/win32.x86"
|
||||
excludes="cave/**" />
|
||||
|
||||
</zip>
|
||||
|
||||
<delete includeEmptyDirs="true">
|
||||
<fileset dir="${buildDirectory}/../../static/common/alertviz/etc">
|
||||
<include name="alertViz*/**" />
|
||||
<include name="monitorIcons/**" />
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running package. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="prePackage">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running package. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postPackage">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after the build is done. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postBuild">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<!-- Steps to do to test the build results -->
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<target name="test">
|
||||
|
||||
<ant antfile="${builder}/test.xml" />
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
|
||||
<target name="checkJUnitTestResults">
|
||||
|
||||
<taskdef name="checkJUnitReports" classname="sample.tools.TestResultCheck" classpath="${builder}/bin;${builder}/extraTools/sampletools.jar" />
|
||||
|
||||
<checkJUnitReports dir="${buildDirectory}/${buildLabel}/testresults" output="${buildDirectory}/junitresults.txt" />
|
||||
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do to publish the build results -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="publish">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Default target -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="noDefault">
|
||||
<echo message="You must specify a target when invoking this file" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,484 +1,485 @@
|
|||
<project name="Build specific targets and properties" default="noDefault">
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Run a given ${target} on all elements being built -->
|
||||
<!-- Add on <ant> task for each top level element being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<property name="allElementsFile" value="${builder}/allElements.xml"/>
|
||||
<import file="${allElementsFile}" />
|
||||
<target name="allElements">
|
||||
<antcall target="allElementsDelegator" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
|
||||
<get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
|
||||
<unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
|
||||
</target>
|
||||
|
||||
<target name="checkLocalBase">
|
||||
<available file="${base}" property="skipBase" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Check out map files from correct repository -->
|
||||
<!-- Replace values for mapsCheckoutTag as desired. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="checkLocalMaps">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="tagMapFiles" if="tagMaps">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<target name="clean" unless="noclean">
|
||||
<antcall target="allElements">
|
||||
<param name="target" value="cleanElement" />
|
||||
</antcall>
|
||||
</target>
|
||||
|
||||
<target name="gatherLogs">
|
||||
<mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
|
||||
<antcall target="allElements">
|
||||
<param name="target" value="gatherLogs" />
|
||||
</antcall>
|
||||
<unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
|
||||
<fileset dir="${buildDirectory}/features">
|
||||
<include name="**/*.log.zip" />
|
||||
</fileset>
|
||||
</unzip>
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before setup -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preSetup">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- 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>
|
||||
<project name="Build specific targets and properties" default="noDefault">
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Run a given ${target} on all elements being built -->
|
||||
<!-- Add on <ant> task for each top level element being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<property name="allElementsFile" value="${builder}/allElements.xml"/>
|
||||
<import file="${allElementsFile}" />
|
||||
<target name="allElements">
|
||||
<antcall target="allElementsDelegator" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="getBaseComponents" depends="checkLocalBase" unless="skipBase">
|
||||
<get src="${eclipseBaseURL}" dest="${buildDirectory}/../temp-base.zip" />
|
||||
<unzip dest="${base}" overwrite="true" src="${buildDirectory}/../temp-base.zip" />
|
||||
</target>
|
||||
|
||||
<target name="checkLocalBase">
|
||||
<available file="${base}" property="skipBase" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Check out map files from correct repository -->
|
||||
<!-- Replace values for mapsCheckoutTag as desired. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="getMapFiles" depends="checkLocalMaps" unless="skipMaps">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="checkLocalMaps">
|
||||
|
||||
</target>
|
||||
|
||||
<target name="tagMapFiles" if="tagMaps">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<target name="clean" unless="noclean">
|
||||
<antcall target="allElements">
|
||||
<param name="target" value="cleanElement" />
|
||||
</antcall>
|
||||
</target>
|
||||
|
||||
<target name="gatherLogs">
|
||||
<mkdir dir="${buildDirectory}/${buildLabel}/compilelogs" />
|
||||
<antcall target="allElements">
|
||||
<param name="target" value="gatherLogs" />
|
||||
</antcall>
|
||||
<unzip dest="${buildDirectory}/${buildLabel}/compilelogs" overwrite="true">
|
||||
<fileset dir="${buildDirectory}/features">
|
||||
<include name="**/*.log.zip" />
|
||||
</fileset>
|
||||
</unzip>
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before setup -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preSetup">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- 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>
|
||||
</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>
|
||||
</copy>
|
||||
<echo message="meteolib.*/**"/>
|
||||
<copy todir="${buildDirectory}/plugins">
|
||||
<fileset dir="${buildDirectory}/../../../" includes="meteolib.*/**"/>
|
||||
</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>
|
||||
<antcall target="getBaseComponents" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before fetching the build elements -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preFetch">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after fetching the build elements -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postFetch">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before generating the build scripts. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preGenerate">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after generating the build scripts. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postGenerate">
|
||||
<antcall target="clean" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running the build.xmls for the elements being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preProcess">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running the build.xmls for the elements being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postProcess">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running assemble. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preAssemble">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running assemble. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postAssemble">
|
||||
<!-- Update the 32-bit linux CAVE zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/linux"
|
||||
excludes="alertviz/**" />
|
||||
<fileset dir="${buildDirectory}/../../static/linux.x86" />
|
||||
|
||||
</zip>
|
||||
<!-- Update the 64-bit linux CAVE zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86_64.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/linux"
|
||||
excludes="alertviz/**" />
|
||||
<fileset dir="${buildDirectory}/../../static/linux.x86_64" />
|
||||
|
||||
</zip>
|
||||
<!-- Update the 32-bit win32 CAVE zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-win32.win32.x86.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/win32.x86" />
|
||||
<!-- Include cave/etc in the win32 CAVE zip -->
|
||||
<fileset dir="${buildDirectory}/../../static/common"
|
||||
excludes="alertviz/**" />
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running package. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="prePackage">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running package. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postPackage">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- 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" />
|
||||
|
||||
<taskdef name="xmltask"
|
||||
classpath="${builder}/../lib/ant/xmltask-v1.15.1.jar"
|
||||
classname="com.oopsconsultancy.xmltask.ant.XmlTask" />
|
||||
|
||||
<!-- Generate the 32-bit CAVE ini files -->
|
||||
<var name="cave.arch" value="arch.x86" />
|
||||
<extractCAVEini
|
||||
zip.file="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86.zip" />
|
||||
<antcall target="generateDynamicCAVE" />
|
||||
<!-- Update the 32-bit CAVE zip file -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86.zip"
|
||||
basedir="/tmp"
|
||||
includes="cave/*.ini, cave/*.sh"
|
||||
update="true" />
|
||||
|
||||
<!-- Generate the 64-bit CAVE ini files -->
|
||||
<var name="cave.arch" value="arch.x86_64" />
|
||||
<extractCAVEini
|
||||
zip.file="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86_64.zip" />
|
||||
<antcall target="generateDynamicCAVE" />
|
||||
<!-- Update the 64-bit cave.ini file -->
|
||||
<antcall target="update64BitINI" />
|
||||
<!-- Update the 64-bit CAVE zip file -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86_64.zip"
|
||||
basedir="/tmp"
|
||||
includes="cave/*.ini, cave/*.sh"
|
||||
update="true" />
|
||||
</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="3.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 [ "$${1}" == "@{first-arg}" ] &&${line.separator}"
|
||||
file="${iniLookupScript}"
|
||||
append="true" />
|
||||
<echo message=" [ "$${2}" == "@{second-arg}" ]; then${line.separator}"
|
||||
file="${iniLookupScript}"
|
||||
append="true" />
|
||||
<echo message="${line.separator}"
|
||||
file="${iniLookupScript}"
|
||||
append="true" />
|
||||
|
||||
<echo message=" export ASSOCIATED_INI="@{second-arg}.ini"${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>
|
||||
</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>
|
||||
|
||||
<!-- Used to update cave.ini for the x86_64 cave. -->
|
||||
<target name="update64BitINI">
|
||||
<xmlproperty file="${builder}/memorySettings.xml"
|
||||
collapseAttributes="true"/>
|
||||
|
||||
<property name="caveXmx" value="2048M" />
|
||||
<property name="caveMaxPermSize" value="256m" />
|
||||
|
||||
<update.ini
|
||||
ini.file="cave.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="${caveXmx}" />
|
||||
|
||||
<update.ini
|
||||
ini.file="cave.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="${caveMaxPermSize}" />
|
||||
</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>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<!-- Steps to do to test the build results -->
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<target name="test">
|
||||
|
||||
<ant antfile="${builder}/test.xml" />
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
|
||||
<target name="checkJUnitTestResults">
|
||||
|
||||
<taskdef name="checkJUnitReports" classname="sample.tools.TestResultCheck" classpath="${builder}/bin;${builder}/extraTools/sampletools.jar" />
|
||||
|
||||
<checkJUnitReports dir="${buildDirectory}/${buildLabel}/testresults" output="${buildDirectory}/junitresults.txt" />
|
||||
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do to publish the build results -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="publish">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Default target -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="noDefault">
|
||||
<echo message="You must specify a target when invoking this file" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
</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>
|
||||
<antcall target="getBaseComponents" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before fetching the build elements -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preFetch">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after fetching the build elements -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postFetch">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before generating the build scripts. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preGenerate">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after generating the build scripts. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postGenerate">
|
||||
<antcall target="clean" />
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running the build.xmls for the elements being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preProcess">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running the build.xmls for the elements being built. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postProcess">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running assemble. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="preAssemble">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running assemble. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postAssemble">
|
||||
<!-- Update the 32-bit linux CAVE zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/linux"
|
||||
excludes="alertviz/**" />
|
||||
<fileset dir="${buildDirectory}/../../static/linux.x86" />
|
||||
|
||||
</zip>
|
||||
<!-- Update the 64-bit linux CAVE zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86_64.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/linux"
|
||||
excludes="alertviz/**" />
|
||||
<fileset dir="${buildDirectory}/../../static/linux.x86_64" />
|
||||
|
||||
</zip>
|
||||
<!-- Update the 32-bit win32 CAVE zip with static files -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-win32.win32.x86.zip"
|
||||
update="true">
|
||||
|
||||
<fileset dir="${buildDirectory}/../../static/win32.x86"
|
||||
excludes="alertviz/**" />
|
||||
<!-- Include cave/etc in the win32 CAVE zip -->
|
||||
<fileset dir="${buildDirectory}/../../static/common"
|
||||
excludes="alertviz/**" />
|
||||
</zip>
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do before running package. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="prePackage">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do after running package. -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="postPackage">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- 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" />
|
||||
|
||||
<taskdef name="xmltask"
|
||||
classpath="${builder}/../lib/ant/xmltask-v1.15.1.jar"
|
||||
classname="com.oopsconsultancy.xmltask.ant.XmlTask" />
|
||||
|
||||
<!-- Generate the 32-bit CAVE ini files -->
|
||||
<var name="cave.arch" value="arch.x86" />
|
||||
<extractCAVEini
|
||||
zip.file="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86.zip" />
|
||||
<antcall target="generateDynamicCAVE" />
|
||||
<!-- Update the 32-bit CAVE zip file -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86.zip"
|
||||
basedir="/tmp"
|
||||
includes="cave/*.ini, cave/*.sh"
|
||||
update="true" />
|
||||
|
||||
<!-- Generate the 64-bit CAVE ini files -->
|
||||
<var name="cave.arch" value="arch.x86_64" />
|
||||
<extractCAVEini
|
||||
zip.file="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86_64.zip" />
|
||||
<antcall target="generateDynamicCAVE" />
|
||||
<!-- Update the 64-bit cave.ini file -->
|
||||
<antcall target="update64BitINI" />
|
||||
<!-- Update the 64-bit CAVE zip file -->
|
||||
<zip destfile="${buildDirectory}/${buildLabel}/${buildId}-linux.gtk.x86_64.zip"
|
||||
basedir="/tmp"
|
||||
includes="cave/*.ini, cave/*.sh"
|
||||
update="true" />
|
||||
</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="3.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 [ "$${1}" == "@{first-arg}" ] &&${line.separator}"
|
||||
file="${iniLookupScript}"
|
||||
append="true" />
|
||||
<echo message=" [ "$${2}" == "@{second-arg}" ]; then${line.separator}"
|
||||
file="${iniLookupScript}"
|
||||
append="true" />
|
||||
<echo message="${line.separator}"
|
||||
file="${iniLookupScript}"
|
||||
append="true" />
|
||||
|
||||
<echo message=" export ASSOCIATED_INI="@{second-arg}.ini"${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>
|
||||
</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>
|
||||
|
||||
<!-- Used to update cave.ini for the x86_64 cave. -->
|
||||
<target name="update64BitINI">
|
||||
<xmlproperty file="${builder}/memorySettings.xml"
|
||||
collapseAttributes="true"/>
|
||||
|
||||
<property name="caveXmx" value="2048M" />
|
||||
<property name="caveMaxPermSize" value="256m" />
|
||||
|
||||
<update.ini
|
||||
ini.file="cave.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="${caveXmx}" />
|
||||
|
||||
<update.ini
|
||||
ini.file="cave.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="${caveMaxPermSize}" />
|
||||
</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>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<!-- Steps to do to test the build results -->
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
|
||||
<target name="test">
|
||||
|
||||
<ant antfile="${builder}/test.xml" />
|
||||
|
||||
</target>
|
||||
|
||||
|
||||
|
||||
<target name="checkJUnitTestResults">
|
||||
|
||||
<taskdef name="checkJUnitReports" classname="sample.tools.TestResultCheck" classpath="${builder}/bin;${builder}/extraTools/sampletools.jar" />
|
||||
|
||||
<checkJUnitReports dir="${buildDirectory}/${buildLabel}/testresults" output="${buildDirectory}/junitresults.txt" />
|
||||
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Steps to do to publish the build results -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="publish">
|
||||
</target>
|
||||
|
||||
<!-- ===================================================================== -->
|
||||
<!-- Default target -->
|
||||
<!-- ===================================================================== -->
|
||||
<target name="noDefault">
|
||||
<echo message="You must specify a target when invoking this file" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
<color r = "0.549019607843" g = "0.541176470588" b = "0.541176470588" a = "1.0" />
|
||||
<color r = "0.698039215686" g = "0.749019607843" b = "0.788235294118" a = "1.0" />
|
||||
<color r = "0.760784313725" g = "0.360784313725" b = "0.36862745098" a = "1.0" />
|
||||
<color r = "0.929411764706" g = "0.752941176471" b = "0.36862745098" a = "1.0" />
|
||||
<color r = "0.929411764706" g = "0.427450980392" b = "0.729411764706" a = "1.0" />
|
||||
<color r = "0.874509803922" g = "0.325490196078" b = "0.674509803922" a = "1.0" />
|
||||
<color r = "0.760784313725" g = "0.141176470588" b = "0.533333333333" a = "1.0" />
|
||||
|
|
|
@ -1050,6 +1050,7 @@ Hazards_commonValues = [ \
|
|||
"Advisories|Winter Weather|WW.Y",
|
||||
"Statements|Coastal Flooding|CF.S",
|
||||
"Statements|Coastal Flooding|LS.S",
|
||||
"Statements|Coastal Flooding|RP.S",
|
||||
"Statements|Marine|MA.S",
|
||||
]
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ class Procedure (SmartScript.SmartScript):
|
|||
statMagSums[4]=statMagSums[3]*statMagSums[3]
|
||||
statMagSums[7]=statMagSums[3]*statMagSums[5]
|
||||
for k in xrange(numthresh):
|
||||
statMagSums[8+k]=less(statDirSums[2],magThresholds[k])
|
||||
statMagSums[8+k]=less(statMagSums[2],magThresholds[k])
|
||||
#
|
||||
# Setup place for sums
|
||||
#
|
||||
|
|
|
@ -61,7 +61,7 @@ if siteID == "GUM":
|
|||
'Hydrology' : ["FF.A", "FA.A"],
|
||||
'Fire Weather' : ["FW.A", "FW.W"],
|
||||
'Coastal Flood' : ["CF.S", "LS.S", "CF.Y", "CF.W", "CF.A",
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A"],
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A", "RP.S"],
|
||||
'Non-Precipitation' : ["AF.W", "AF.Y", "AQ.Y", "AS.O", "AS.Y", "DU.Y",
|
||||
"DS.W", "EH.W", "EH.A", "EC.W", "EC.A", "FG.Y", "FZ.W", "FZ.A",
|
||||
"HZ.W", "HZ.A", "ZF.Y", "FR.Y", "HT.Y", "HW.W", "HW.A",
|
||||
|
@ -84,7 +84,7 @@ else:
|
|||
'Fire Weather' : ["FW.A", "FW.W"],
|
||||
'Convective Watches' : ["SV.A", "TO.A"],
|
||||
'Coastal Flood' : ["CF.S", "LS.S", "CF.Y", "CF.W", "CF.A",
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A"],
|
||||
"SU.Y", "SU.W", "LS.Y", "LS.W", "LS.A", "RP.S"],
|
||||
'Non-Precipitation' : ["AF.W", "AF.Y", "AQ.Y", "AS.O", "AS.Y", "DU.Y",
|
||||
"DS.W", "EH.W", "EH.A", "EC.W", "EC.A", "FG.Y", "FZ.W", "FZ.A",
|
||||
"HZ.W", "HZ.A", "ZF.Y", "FR.Y", "HT.Y", "HW.W", "HW.A",
|
||||
|
|
|
@ -138,6 +138,7 @@ class CallToActions:
|
|||
"MH.Y": self.ctaMHY,
|
||||
"MS.Y": self.ctaMSY,
|
||||
"RB.Y": self.ctaRBY,
|
||||
"RP.S": self.ctaRPS,
|
||||
"SC.Y": self.ctaSCY,
|
||||
"SE.A": self.ctaSEA,
|
||||
"SE.W": self.ctaSEW,
|
||||
|
@ -504,6 +505,14 @@ LISTEN TO NOAA WEATHER RADIO OR LOCAL MEDIA FOR FURTHER INFORMATION.""",
|
|||
"""A SMALL CRAFT ADVISORY FOR ROUGH BAR MEANS THAT WAVE CONDITIONS ARE EXPECTED TO BE HAZARDOUS TO SMALL CRAFT IN OR NEAR HARBOR ENTRANCES.""",
|
||||
]
|
||||
|
||||
def ctaRPS(self):
|
||||
return [
|
||||
"""THERE IS A HIGH RISK OF RIP CURRENTS.
|
||||
|
||||
RIP CURRENTS ARE POWERFUL CHANNELS OF WATER FLOWING QUICKLY AWAY FROM SHORE...WHICH OCCUR MOST OFTEN AT LOW SPOTS OR BREAKS IN THE SANDBAR AND IN THE VICINITY OF STRUCTURES SUCH AS GROINS...JETTIES AND PIERS. HEED THE ADVICE OF LIFEGUARDS AND THE BEACH PATROL. PAY ATTENTION TO FLAGS AND POSTED SIGNS.
|
||||
|
||||
IF YOU BECOME CAUGHT IN A RIP CURRENT...DO NOT PANIC. REMAIN CALM AND BEGIN TO SWIM PARALLEL TO SHORE. ONCE YOU ARE AWAY FROM THE FORCE OF THE RIP CURRENT...BEGIN TO SWIM BACK TO THE BEACH. DO NOT ATTEMPT TO SWIM DIRECTLY AGAINST A RIP CURRENT. EVEN A STRONG SWIMMER CAN BECOME EXHAUSTED QUICKLY.""",
|
||||
]
|
||||
def ctaSCY(self):
|
||||
return [
|
||||
"""A SMALL CRAFT ADVISORY MEANS THAT WIND SPEEDS OF 21 TO 33 KNOTS ARE EXPECTED TO PRODUCE HAZARDOUS WAVE CONDITIONS TO SMALL CRAFT. INEXPERIENCED MARINERS...ESPECIALLY THOSE OPERATING SMALLER VESSELS SHOULD AVOID NAVIGATING IN THESE CONDITIONS.""",
|
||||
|
|
|
@ -431,13 +431,13 @@ class SAF_Overrides:
|
|||
"PrePunctuation": "",
|
||||
"PostPunctuation": ", ",
|
||||
"Weekday" : {
|
||||
0 : "Sunday",
|
||||
1 : "Monday",
|
||||
2 : "Tuesday",
|
||||
3 : "Wednesday",
|
||||
4 : "Thursday",
|
||||
5 : "Friday",
|
||||
6 : "Saturday"
|
||||
6 : "Sunday",
|
||||
0 : "Monday",
|
||||
1 : "Tuesday",
|
||||
2 : "Wednesday",
|
||||
3 : "Thursday",
|
||||
4 : "Friday",
|
||||
5 : "Saturday"
|
||||
},
|
||||
"Now": "Now",
|
||||
"Today":"Today",
|
||||
|
|
|
@ -156,7 +156,7 @@ class BOIVerifyUtility(SmartScript.SmartScript):
|
|||
#
|
||||
# Setup DEBUG level
|
||||
#
|
||||
self.DEBUG=10
|
||||
self.DEBUG=0
|
||||
#
|
||||
# Setup Observed file info
|
||||
#
|
||||
|
|
|
@ -5,8 +5,8 @@ overflow="visible"
|
|||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
<font id="LargeSpecialSymbols" horiz-adv-x="1536"><font-face
|
||||
font-family="LargeSpecialSymbolFont"
|
||||
<font id="LrgSpecialSymbols" horiz-adv-x="7"><font-face
|
||||
font-family="LrgSpecialSymbolFont"
|
||||
units-per-em="12"
|
||||
alphabetic="0" />
|
||||
<glyph unicode="199" glyph-name="199" d="M-4 6H2L-1 3L2 0L-1 -3V-2M-1 -3H0M-3 -3V6M-2 7H0L-1 9L-2 7" />
|
||||
|
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
@ -8,7 +8,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255, 255, 255);">
|
|||
<style type="text/css">
|
||||
<![CDATA[
|
||||
@font-face { font-family: "LargeSpecialSymbolFont";
|
||||
src: url(LargeSpecialSymbols.svg#LargeSpecialSymbols); }
|
||||
src: url(LargeSpecialSymbols.svg#LrgSpecialSymbols); }
|
||||
|
||||
text.special
|
||||
{
|
||||
|
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -8,7 +8,7 @@ xmlns:xlink="http://www.w3.org/1999/xlink" style="stroke: rgb(255, 255, 255);">
|
|||
<style type="text/css">
|
||||
<![CDATA[
|
||||
@font-face { font-family: "LrgSpecialSymbolFont";
|
||||
src: url(LargeSpecialSymbols.svg#LargeSpecialSymbols); }
|
||||
src: url(LargeSpecialSymbols.svg#LrgSpecialSymbols); }
|
||||
|
||||
text.special
|
||||
{
|
||||
|
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
@ -17,6 +17,13 @@
|
|||
|
||||
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
|
||||
further_licensing_information.
|
||||
|
||||
SOFTWARE HISTORY
|
||||
|
||||
Date Ticket# Engineer Description
|
||||
__________________________________________________________________________
|
||||
02/28/2012 14536 Xiaochuan Changed DefaultRank to default
|
||||
|
||||
-->
|
||||
<ScanConfigMesoTable>
|
||||
<LinkToFrame>false</LinkToFrame>
|
||||
|
@ -24,7 +31,7 @@
|
|||
<TipsOption>false</TipsOption>
|
||||
<FilterOption>false</FilterOption>
|
||||
<ZoomFactor>4</ZoomFactor>
|
||||
<DefaultRank>mdaSR</DefaultRank>
|
||||
<DefaultRank>default</DefaultRank>
|
||||
|
||||
<!--
|
||||
MESO Table attributes
|
||||
|
|
|
@ -20,9 +20,12 @@
|
|||
|
||||
SOFTWARE HISTORY
|
||||
|
||||
Date Ticket# Engineer Description
|
||||
Date Ticket# Engineer Description
|
||||
__________________________________________________________________________
|
||||
Dec 28, 2011 14230 mgamazay Changed DefaultRank to ident
|
||||
Dec 28, 2011 14230 mgamazay Changed DefaultRank to ident
|
||||
|
||||
02/28/2012 14538 Xiaochuan Changed DefaultRank to default
|
||||
|
||||
-->
|
||||
<ScanConfigTvsTable>
|
||||
<LinkToFrame>false</LinkToFrame>
|
||||
|
@ -30,7 +33,7 @@
|
|||
<TipsOption>false</TipsOption>
|
||||
<FilterOption>false</FilterOption>
|
||||
<ZoomFactor>4</ZoomFactor>
|
||||
<DefaultRank>ident</DefaultRank>
|
||||
<DefaultRank>default</DefaultRank>
|
||||
|
||||
<!--
|
||||
TVS Table attributes
|
||||
|
|
69
cave/build/static/win32.x86/alertviz/alertviz.bat
Normal file
69
cave/build/static/win32.x86/alertviz/alertviz.bat
Normal file
|
@ -0,0 +1,69 @@
|
|||
@echo OFF
|
||||
|
||||
REM Determine if we are running on a 32-bit or 64-bit OS.
|
||||
IF NOT EXIST C:\Windows\SysWOW64\reg.exe (
|
||||
SET REG_EXE=C:\Windows\System32\reg.exe
|
||||
) ELSE (
|
||||
SET REG_EXE=C:\Windows\SysWOW64\reg.exe
|
||||
)
|
||||
|
||||
REM Determine where we are located.
|
||||
SET CONTAINING_DIRECTORY=%~dp0
|
||||
|
||||
REM Prepare the environment.
|
||||
|
||||
REM Registry Query Variables.
|
||||
SET A2_JAVA_REG="HKLM\Software\Raytheon\Runtime Environment\AWIPS II Java"
|
||||
SET A2_PYTHON_REG="HKLM\Software\Raytheon\Runtime Environment\AWIPS II Python"
|
||||
REM Determine where AWIPS II Java (the jre) is located.
|
||||
%REG_EXE% QUERY %A2_JAVA_REG% /v JavaJreDirectory > NUL 2>&1
|
||||
IF ERRORLEVEL 1 (echo ENVIRONMENT ERROR - Unable to find AWIPS II Java. && PAUSE && EXIT)
|
||||
FOR /F "tokens=2* delims= " %%A IN (
|
||||
'%REG_EXE% QUERY %A2_JAVA_REG% /v JavaJreDirectory') DO (
|
||||
SET JavaJreDirectory=%%B)
|
||||
REM Determine where AWIPS II Python is located.
|
||||
%REG_EXE% QUERY %A2_PYTHON_REG% /v PythonInstallDirectory > NUL 2>&1
|
||||
IF ERRORLEVEL 1 (echo ENVIRONMENT ERROR - Unable to find AWIPS II Python. && PAUSE && EXIT)
|
||||
FOR /F "tokens=2* delims= " %%A IN (
|
||||
'%REG_EXE% QUERY %A2_PYTHON_REG% /v PythonInstallDirectory') DO (
|
||||
SET PythonInstallDirectory=%%B)
|
||||
|
||||
REM Add Java and Python to the path.
|
||||
SET Path=%PythonInstallDirectory%;%PythonInstallDirectory%\DLLs;%Path%
|
||||
SET Path=%JavaJreDirectory%\bin;%Path%
|
||||
REM Define 'PythonPath'.
|
||||
SET PythonPath=%PythonInstallDirectory%\Lib\lib-tk;%PythonPath%
|
||||
SET PythonPath=%PythonInstallDirectory%\DLLs;%PythonPath%
|
||||
SET PythonPath=%PythonInstallDirectory%\Lib;%PythonPath%
|
||||
SET PythonPath=%PythonInstallDirectory%;%PythonPath%
|
||||
|
||||
REM Eliminate variables that will no longer be used.
|
||||
SET PythonInstallDirectory=
|
||||
SET JavaJreDirectory=
|
||||
SET REG_EXE=
|
||||
SET A2_JAVA_REG=
|
||||
SET A2_PYTHON_REG=
|
||||
|
||||
REM Determine where we will be logging to.
|
||||
SET HOME_DIRECTORY=%HOMEDRIVE%%HOMEPATH%
|
||||
SET CAVEDATA_LOG_DIRECTORY=%HOMEDRIVE%%HOMEPATH%\caveData\logs
|
||||
SET CONSOLE_LOG_DIRECTORY=%CAVEDATA_LOG_DIRECTORY%\consoleLogs\%COMPUTERNAME%
|
||||
IF NOT EXIST "%CONSOLE_LOG_DIRECTORY%" (MKDIR "%CONSOLE_LOG_DIRECTORY%")
|
||||
|
||||
echo Starting ALERTVIZ; leave this CMD window open to enable AlertViz 'restart'.
|
||||
REM Start AlertViz (and implement the alertviz restart capability).
|
||||
:AlertVizLoopStart
|
||||
SET RND=%random%
|
||||
SET RND_DATETIME_FILE=%TMP%\awips2dt_%RND%.tmp
|
||||
REM Python is used to retrieve the current date and time because the order
|
||||
REM of the Windows date/time fields is not necessarily guaranteed and the
|
||||
REM Windows date/time fields can only be extracted using substring operations
|
||||
REM instead of -formatter- strings like Linux allows.
|
||||
python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%%d_%%H%%M%%S');" > %RND_DATETIME_FILE%
|
||||
SET /p LOG_DATETIME= < %RND_DATETIME_FILE%
|
||||
DEL %RND_DATETIME_FILE%
|
||||
"%CONTAINING_DIRECTORY%alertviz.exe" %* > "%CONSOLE_LOG_DIRECTORY%\alertviz_%LOG_DATETIME%.log" 2>&1
|
||||
IF %ERRORLEVEL% == 0 (EXIT)
|
||||
echo Restarting AlertViz.
|
||||
GOTO AlertVizLoopStart
|
||||
|
|
@ -1,26 +1,72 @@
|
|||
@echo OFF
|
||||
|
||||
REM TODO: Add logic to place the win32 versions of awips2-java and awips2-python
|
||||
REM into the path if they are not already present.
|
||||
|
||||
set HOME_DIRECTORY=%HOMEDRIVE%%HOMEPATH%
|
||||
set CAVEDATA_LOG_DIRECTORY=%HOMEDRIVE%%HOMEPATH%\caveData\logs
|
||||
set CONSOLE_LOG_DIRECTORY=%CAVEDATA_LOG_DIRECTORY%\consoleLogs\%COMPUTERNAME%
|
||||
IF NOT EXIST "%CONSOLE_LOG_DIRECTORY%" (MKDIR "%CONSOLE_LOG_DIRECTORY%")
|
||||
|
||||
set RND=%random%
|
||||
set RND_DATETIME_FILE=%TMP%\awips2dt_%RND%.tmp
|
||||
REM Python is used to retrieve the current date and time because the order
|
||||
REM of the Windows date/time fields is not necessarily guaranteed and the
|
||||
REM Windows date/time fields can only be extracted using substring operations
|
||||
REM instead of -formatter- strings like Linux allows.
|
||||
python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%%d_%%H%%M%%S');" > %RND_DATETIME_FILE%
|
||||
set /p LOG_DATETIME= < %RND_DATETIME_FILE%
|
||||
del %RND_DATETIME_FILE%
|
||||
|
||||
set CONTAINING_DIRECTORY=%~dp0
|
||||
echo THIS CMD WINDOW CAN BE CLOSED AT ANY TIME!
|
||||
"%CONTAINING_DIRECTORY%cave.exe" %* > "%CONSOLE_LOG_DIRECTORY%\cave_%LOG_DATETIME%.log" 2>&1
|
||||
IF ERRORLEVEL 1 (echo CAVE WAS NOT SUCCESSFULLY STARTED - check the logs for additional information. && PAUSE)
|
||||
|
||||
EXIT
|
||||
@echo OFF
|
||||
|
||||
REM Determine if we are running on a 32-bit or 64-bit OS.
|
||||
IF NOT EXIST C:\Windows\SysWOW64\reg.exe (
|
||||
SET REG_EXE=C:\Windows\System32\reg.exe
|
||||
) ELSE (
|
||||
SET REG_EXE=C:\Windows\SysWOW64\reg.exe
|
||||
)
|
||||
|
||||
REM Determine where we are located.
|
||||
SET CONTAINING_DIRECTORY=%~dp0
|
||||
|
||||
REM Prepare the environment.
|
||||
|
||||
REM Registry Query Variables.
|
||||
SET A2_JAVA_REG="HKLM\Software\Raytheon\Runtime Environment\AWIPS II Java"
|
||||
SET A2_PYTHON_REG="HKLM\Software\Raytheon\Runtime Environment\AWIPS II Python"
|
||||
REM Determine where AWIPS II Java (the jre) is located.
|
||||
%REG_EXE% QUERY %A2_JAVA_REG% /v JavaJreDirectory > NUL 2>&1
|
||||
IF ERRORLEVEL 1 (echo ENVIRONMENT ERROR - Unable to find AWIPS II Java. && PAUSE && EXIT)
|
||||
FOR /F "tokens=2* delims= " %%A IN (
|
||||
'%REG_EXE% QUERY %A2_JAVA_REG% /v JavaJreDirectory') DO (
|
||||
SET JavaJreDirectory=%%B)
|
||||
REM Determine where AWIPS II Python is located.
|
||||
%REG_EXE% QUERY %A2_PYTHON_REG% /v PythonInstallDirectory > NUL 2>&1
|
||||
IF ERRORLEVEL 1 (echo ENVIRONMENT ERROR - Unable to find AWIPS II Python. && PAUSE && EXIT)
|
||||
FOR /F "tokens=2* delims= " %%A IN (
|
||||
'%REG_EXE% QUERY %A2_PYTHON_REG% /v PythonInstallDirectory') DO (
|
||||
SET PythonInstallDirectory=%%B)
|
||||
|
||||
REM Add Java and Python to the path.
|
||||
SET Path=%PythonInstallDirectory%;%PythonInstallDirectory%\DLLs;%Path%
|
||||
SET Path=%JavaJreDirectory%\bin;%Path%
|
||||
REM Add the CAVE lib directory to the path.
|
||||
SET Path=%CONTAINING_DIRECTORY%lib;%Path%
|
||||
REM Define 'PythonPath'.
|
||||
SET PythonPath=%CONTAINING_DIRECTORY%lib;%PythonPath%
|
||||
SET PythonPath=%PythonInstallDirectory%\Lib\lib-tk;%PythonPath%
|
||||
SET PythonPath=%PythonInstallDirectory%\DLLs;%PythonPath%
|
||||
SET PythonPath=%PythonInstallDirectory%\Lib;%PythonPath%
|
||||
SET PythonPath=%PythonInstallDirectory%;%PythonPath%
|
||||
|
||||
REM Eliminate variables that will no longer be used.
|
||||
SET PythonInstallDirectory=
|
||||
SET JavaJreDirectory=
|
||||
SET REG_EXE=
|
||||
SET A2_JAVA_REG=
|
||||
SET A2_PYTHON_REG=
|
||||
|
||||
REM Determine where we will be logging to.
|
||||
SET HOME_DIRECTORY=%HOMEDRIVE%%HOMEPATH%
|
||||
SET CAVEDATA_LOG_DIRECTORY=%HOMEDRIVE%%HOMEPATH%\caveData\logs
|
||||
SET CONSOLE_LOG_DIRECTORY=%CAVEDATA_LOG_DIRECTORY%\consoleLogs\%COMPUTERNAME%
|
||||
IF NOT EXIST "%CONSOLE_LOG_DIRECTORY%" (MKDIR "%CONSOLE_LOG_DIRECTORY%")
|
||||
|
||||
SET RND=%random%
|
||||
SET RND_DATETIME_FILE=%TMP%\awips2dt_%RND%.tmp
|
||||
REM Python is used to retrieve the current date and time because the order
|
||||
REM of the Windows date/time fields is not necessarily guaranteed and the
|
||||
REM Windows date/time fields can only be extracted using substring operations
|
||||
REM instead of -formatter- strings like Linux allows.
|
||||
python -c "from datetime import datetime; print datetime.now().strftime('%%Y%%m%%d_%%H%%M%%S');" > %RND_DATETIME_FILE%
|
||||
SET /p LOG_DATETIME= < %RND_DATETIME_FILE%
|
||||
DEL %RND_DATETIME_FILE%
|
||||
|
||||
echo THIS CMD WINDOW CAN BE CLOSED AT ANY TIME!
|
||||
cd %HOMEPATH%
|
||||
REM Start CAVE.
|
||||
"%CONTAINING_DIRECTORY%cave.exe" %* > "%CONSOLE_LOG_DIRECTORY%\cave_%LOG_DATETIME%.log" 2>&1
|
||||
IF ERRORLEVEL 1 (echo CAVE ERROR - check the logs for additional information. && PAUSE)
|
||||
|
||||
EXIT
|
||||
|
|
BIN
cave/build/static/win32.x86/cave/lib/gridslice.pyd
Normal file
BIN
cave/build/static/win32.x86/cave/lib/gridslice.pyd
Normal file
Binary file not shown.
BIN
cave/build/static/win32.x86/cave/lib/libgcc_s_dw2-1.dll
Executable file
BIN
cave/build/static/win32.x86/cave/lib/libgcc_s_dw2-1.dll
Executable file
Binary file not shown.
BIN
cave/build/static/win32.x86/cave/lib/libgfortran-3.dll
Executable file
BIN
cave/build/static/win32.x86/cave/lib/libgfortran-3.dll
Executable file
Binary file not shown.
BIN
cave/build/static/win32.x86/cave/lib/libquadmath-0.dll
Executable file
BIN
cave/build/static/win32.x86/cave/lib/libquadmath-0.dll
Executable file
Binary file not shown.
|
@ -20,6 +20,7 @@ Import-Package: com.raytheon.edex.meteoLib,
|
|||
com.raytheon.uf.common.pointdata,
|
||||
com.raytheon.uf.common.pointdata.spatial,
|
||||
com.raytheon.uf.common.serialization,
|
||||
com.raytheon.uf.common.status,
|
||||
com.raytheon.uf.common.time,
|
||||
com.raytheon.uf.viz.core.alerts,
|
||||
com.raytheon.uf.viz.core.catalog,
|
||||
|
|
|
@ -39,14 +39,19 @@ import com.raytheon.uf.common.datastorage.records.IntegerDataRecord;
|
|||
import com.raytheon.uf.common.datastorage.records.LongDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.StringDataRecord;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
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.catalog.ScriptCreator;
|
||||
import com.raytheon.uf.viz.core.comm.Loader;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator;
|
||||
import com.raytheon.viz.pointdata.util.PointDataCubeAdapter;
|
||||
import com.raytheon.viz.pointdata.util.AbstractPointDataInventory;
|
||||
import com.raytheon.viz.pointdata.util.PointDataCubeAdapter;
|
||||
|
||||
public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(ACARSSoundingDataCubeAdapter.class);
|
||||
|
||||
protected static final String REFTIME = AcarsSoundingInventory.REFTIME;
|
||||
|
||||
|
@ -101,11 +106,16 @@ public class ACARSSoundingDataCubeAdapter extends PointDataCubeAdapter {
|
|||
|
||||
@Override
|
||||
public void initInventory() {
|
||||
derParLibrary = DerivedParameterGenerator.getDerParLibrary();
|
||||
if (inventory == null) {
|
||||
AbstractPointDataInventory pointInventory = new AcarsSoundingInventory();
|
||||
pointInventory.initTree(derParLibrary);
|
||||
this.inventory = pointInventory;
|
||||
try {
|
||||
pointInventory.initTree(DerivedParameterGenerator
|
||||
.getDerParLibrary());
|
||||
this.inventory = pointInventory;
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.viz.alertviz.ui.dialogs;
|
|||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import org.eclipse.equinox.app.IApplication;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.MenuDetectEvent;
|
||||
|
@ -90,6 +91,7 @@ import com.raytheon.uf.viz.core.VizApp;
|
|||
* changed.
|
||||
* 03 May 2011 9101 cjeanbap Pass a clone object into AlertVizPython class.
|
||||
* 31 May 2011 8058 cjeanbap Kill sound based on TextMsgBox id.
|
||||
* 17 Jan 2012 27 rferrel Refactored to allow override of createTrayMenuItems
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -102,7 +104,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
|
|||
/**
|
||||
* Dialog shell.
|
||||
*/
|
||||
private Shell shell;
|
||||
protected Shell shell;
|
||||
|
||||
/**
|
||||
* The display control.
|
||||
|
@ -132,7 +134,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
|
|||
/**
|
||||
* A pop-up menu for the tray item.
|
||||
*/
|
||||
private Menu trayItemMenu;
|
||||
protected Menu trayItemMenu;
|
||||
|
||||
/**
|
||||
* Show alert visualization menu item.
|
||||
|
@ -212,13 +214,15 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
|
|||
/**
|
||||
* Is this running as a standalone application
|
||||
*/
|
||||
private final boolean runningStandalone;
|
||||
protected final boolean runningStandalone;
|
||||
|
||||
private Rectangle prevLocation = null;
|
||||
|
||||
private ConfigContext configContext;
|
||||
|
||||
private Configuration prevConfigFile;
|
||||
|
||||
private Integer exitStatus = IApplication.EXIT_OK;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -381,7 +385,7 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
|
|||
/**
|
||||
* Create the tray menu items.
|
||||
*/
|
||||
private void createTrayMenuItems() {
|
||||
protected void createTrayMenuItems() {
|
||||
|
||||
showAlertDialogMI = new MenuItem(trayItemMenu, SWT.CHECK);
|
||||
showAlertDialogMI.setText("Show Alert Dialog");
|
||||
|
@ -810,6 +814,10 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
|
|||
}
|
||||
}
|
||||
|
||||
public Integer getExitStatus() {
|
||||
return exitStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the button click event for the alertPopupDialog. This function is
|
||||
* called when "Hide Dialog" is clicked.
|
||||
|
@ -825,9 +833,13 @@ public class AlertVisualization implements ITimerAction, IAudioAction,
|
|||
@Override
|
||||
public void restart() {
|
||||
if (runningStandalone) {
|
||||
// exit with an error code. alertViz.sh will then
|
||||
// restart AlertViz
|
||||
System.exit(1);
|
||||
// Must use EXIT_RELAUNCH. EXIT_RESTART causes the
|
||||
// executable to do a restart without returning to
|
||||
// the shell/bat script. This fails. Any other value
|
||||
// such as Integer(1) the executable attempts to bring
|
||||
// up an error screen before exiting with the error code.
|
||||
exitStatus = IApplication.EXIT_RELAUNCH;
|
||||
display.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
private static final PointDataDescription rtpDescription = new PointDataDescription();
|
||||
|
||||
static {
|
||||
ffgDescription.parameters = new ParameterDescription[8];
|
||||
ffgDescription.parameters = new ParameterDescription[9];
|
||||
ffgDescription.parameters[0] = new ParameterDescription("time",
|
||||
Type.LONG);
|
||||
ffgDescription.parameters[1] = new ParameterDescription("latitude",
|
||||
|
@ -98,8 +98,9 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
ffgDescription.parameters[6] = new ParameterDescription("stationId",
|
||||
Type.STRING);
|
||||
ffgDescription.parameters[7] = new ParameterDescription("id", Type.INT);
|
||||
ffgDescription.parameters[8] = new ParameterDescription("dataURI", Type.STRING);
|
||||
|
||||
rtpDescription.parameters = new ParameterDescription[6];
|
||||
rtpDescription.parameters = new ParameterDescription[7];
|
||||
rtpDescription.parameters[0] = new ParameterDescription("time",
|
||||
Type.LONG);
|
||||
rtpDescription.parameters[1] = new ParameterDescription("latitude",
|
||||
|
@ -111,6 +112,8 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
rtpDescription.parameters[4] = new ParameterDescription("stationId",
|
||||
Type.STRING);
|
||||
rtpDescription.parameters[5] = new ParameterDescription("id", Type.INT);
|
||||
rtpDescription.parameters[6] = new ParameterDescription("dataURI", Type.STRING);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -238,6 +241,7 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
pdv.setFloat("3hr", Float.valueOf(parts[1]));
|
||||
pdv.setFloat("6hr", Float.valueOf(parts[2]));
|
||||
pdv.setString("stationId", station);
|
||||
pdv.setString("dataURI", "/textPoints/" + station + "/" + time);
|
||||
// TODO this id is not really guaranteed to be unique
|
||||
pdv.setInt("id", ((int) time) + station.hashCode());
|
||||
}
|
||||
|
@ -315,6 +319,7 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
pdv.setFloat("latitude", (float) coord.latlon.y);
|
||||
pdv.setFloat("precip", precip);
|
||||
pdv.setString("stationId", station);
|
||||
pdv.setString("dataURI", "/textPoints/" + station + "/" + time);
|
||||
// TODO this id is not really guaranteed to be unique
|
||||
pdv.setInt("id", ((int) time) + station.hashCode());
|
||||
}
|
||||
|
@ -402,12 +407,6 @@ public class CoopPrecipDataCubeAdapter implements IDataCubeAdapter {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String recordKeyGenerator(PluginDataObject pdo) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initInventory() {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
|
@ -69,7 +69,6 @@ public class CoopPrecipPlotInfoRetriever extends AbstractPlotInfoRetriever {
|
|||
for (int uriCounter = 0; uriCounter < pdc.getCurrentSz(); uriCounter++) {
|
||||
PointDataView pdv = pdc.readRandom(uriCounter);
|
||||
PlotInfo stationInfo = new PlotInfo();
|
||||
stationInfo.id = pdv.getInt("id");
|
||||
stationInfo.latitude = pdv.getNumber("latitude").doubleValue();
|
||||
stationInfo.longitude = pdv.getNumber("longitude")
|
||||
.doubleValue();
|
||||
|
@ -80,6 +79,7 @@ public class CoopPrecipPlotInfoRetriever extends AbstractPlotInfoRetriever {
|
|||
stationInfo.pdv = new PlotData();
|
||||
}
|
||||
stationInfo.pdv.addData(pdv);
|
||||
stationInfo.dataURI = pdv.getString("dataURI");
|
||||
info.add(stationInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,8 @@ Require-Bundle: org.eclipse.ui,
|
|||
org.apache.commons.lang;bundle-version="2.3.0",
|
||||
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.productbrowser;bundle-version="1.12.1152",
|
||||
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0"
|
||||
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0",
|
||||
com.raytheon.uf.viz.ui.menus;bundle-version="1.12.1174"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.viz.core
|
||||
|
|
|
@ -22,15 +22,15 @@ package com.raytheon.uf.viz.core.maps.menus;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.action.IContributionItem;
|
||||
import org.eclipse.jface.action.IMenuManager;
|
||||
import org.eclipse.jface.action.MenuManager;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.eclipse.ui.actions.CompoundContributionItem;
|
||||
import org.eclipse.ui.menus.CommandContributionItem;
|
||||
import org.eclipse.ui.menus.CommandContributionItemParameter;
|
||||
|
||||
import com.raytheon.uf.viz.core.maps.MapStore;
|
||||
import com.raytheon.uf.viz.core.maps.MapStore.MapNode;
|
||||
import com.raytheon.uf.viz.ui.menus.widgets.AbstractTearOffableCompoundContributionItem;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -48,22 +48,32 @@ import com.raytheon.uf.viz.core.maps.MapStore.MapNode;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MapsMenu extends CompoundContributionItem {
|
||||
public class MapsMenu extends AbstractTearOffableCompoundContributionItem {
|
||||
|
||||
/**
|
||||
* @param text
|
||||
* @param id
|
||||
*/
|
||||
public MapsMenu() {
|
||||
super("Maps", MapsMenu.class.getName());
|
||||
}
|
||||
|
||||
boolean addTear = false;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
|
||||
* @see com.raytheon.uf.viz.ui.menus.widgets.
|
||||
* AbstractTearOffableCompoundContributionItem
|
||||
* #addContributionItems(org.eclipse.jface.action.IMenuManager)
|
||||
*/
|
||||
@Override
|
||||
protected IContributionItem[] getContributionItems() {
|
||||
protected void addContributionItems(IMenuManager manager) {
|
||||
MapNode node = MapStore.getMapTree();
|
||||
return createMenu(node).getItems();
|
||||
createMenu(manager, node);
|
||||
}
|
||||
|
||||
private MenuManager createMenu(MapNode root) {
|
||||
MenuManager menuMgr = new MenuManager(root.getName());
|
||||
private void createMenu(IMenuManager manager, MapNode root) {
|
||||
for (MapNode node : root.getSubTree()) {
|
||||
if (node.getSubTree() == null) {
|
||||
Map<String, String> parms = new HashMap<String, String>();
|
||||
|
@ -78,11 +88,13 @@ public class MapsMenu extends CompoundContributionItem {
|
|||
parms, null, null, null, node.getName(), null,
|
||||
null, CommandContributionItem.STYLE_CHECK,
|
||||
null, true));
|
||||
menuMgr.add(item);
|
||||
manager.add(item);
|
||||
} else {
|
||||
menuMgr.add(createMenu(node));
|
||||
IMenuManager subMenu = new MenuManager(node.getName(),
|
||||
manager.getId() + "." + node.getName());
|
||||
createMenu(subMenu, node);
|
||||
manager.add(subMenu);
|
||||
}
|
||||
}
|
||||
return menuMgr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.core.maps.rsc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
@ -29,7 +28,6 @@ import com.raytheon.uf.common.status.UFStatus;
|
|||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
|
||||
import com.raytheon.uf.viz.core.drawables.IFont;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.IMapDescriptor;
|
||||
|
@ -89,6 +87,7 @@ public abstract class AbstractDbMapResource<T extends AbstractDbMapResourceData,
|
|||
|
||||
if (font != null) {
|
||||
font.dispose();
|
||||
font = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,25 +151,10 @@ public abstract class AbstractDbMapResource<T extends AbstractDbMapResourceData,
|
|||
*/
|
||||
public List<String> getLabelFields() {
|
||||
if (this.labelFields == null) {
|
||||
List<String> labelFields = new ArrayList<String>();
|
||||
try {
|
||||
int p = resourceData.getTable().indexOf('.');
|
||||
String schema = resourceData.getTable().substring(0, p);
|
||||
String table = resourceData.getTable().substring(p + 1);
|
||||
|
||||
StringBuilder query = new StringBuilder(
|
||||
"SELECT column_name FROM information_schema.columns WHERE table_schema = '");
|
||||
query.append(schema);
|
||||
query.append("' AND table_name='");
|
||||
query.append(table);
|
||||
query.append("' AND udt_name != 'geometry' ORDER BY ordinal_position;");
|
||||
List<Object[]> results = MapQueryCache.executeQuery(
|
||||
query.toString(), "maps", QueryLanguage.SQL);
|
||||
|
||||
for (Object[] obj : results) {
|
||||
labelFields.add(obj[0].toString());
|
||||
}
|
||||
|
||||
this.labelFields = DbMapQueryFactory.getMapQuery(
|
||||
resourceData.getTable(), resourceData.getGeomField())
|
||||
.getColumnNamesWithoutGeometries();
|
||||
ColumnDefinition[] columns = resourceData.getColumns();
|
||||
if (columns != null) {
|
||||
for (ColumnDefinition col : columns) {
|
||||
|
@ -181,7 +165,6 @@ public abstract class AbstractDbMapResource<T extends AbstractDbMapResourceData,
|
|||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error querying available label fields", e);
|
||||
}
|
||||
this.labelFields = labelFields;
|
||||
}
|
||||
return this.labelFields;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.maps.rsc;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.vividsolutions.jts.geom.Envelope;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 9, 2011 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DbMapQueryFactory {
|
||||
|
||||
public interface DbMapQuery {
|
||||
public QueryResult queryWithinEnvelope(Envelope env,
|
||||
List<String> columns, List<String> additionalConstraints)
|
||||
throws VizException;
|
||||
|
||||
public List<String> getColumnNamesWithoutGeometries()
|
||||
throws VizException;
|
||||
|
||||
public String getGeometryType() throws VizException;
|
||||
|
||||
public List<Double> getLevels() throws VizException;
|
||||
|
||||
}
|
||||
|
||||
private static DbMapQueryFactory instance;
|
||||
|
||||
public static DbMapQuery getMapQuery(String table, String geomField) {
|
||||
return getInstance().getMapQueryInternal(table, geomField);
|
||||
}
|
||||
|
||||
protected static DbMapQueryFactory getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new DbMapQueryFactory();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
protected static void setCustomInstance(DbMapQueryFactory factory) {
|
||||
instance = factory;
|
||||
}
|
||||
|
||||
protected DbMapQueryFactory() {
|
||||
|
||||
}
|
||||
|
||||
protected DbMapQuery getMapQueryInternal(String table, String geomField) {
|
||||
return new DefaultDbMapQuery(table, geomField);
|
||||
}
|
||||
|
||||
}
|
|
@ -53,6 +53,7 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
|
|||
import com.raytheon.uf.viz.core.IGraphicsTarget.HorizontalAlignment;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
|
||||
import com.raytheon.uf.viz.core.drawables.IShadedShape;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
|
@ -161,18 +162,18 @@ public class DbMapResource extends
|
|||
|
||||
String shadingField;
|
||||
|
||||
String query;
|
||||
Envelope envelope;
|
||||
|
||||
Map<Object, RGB> colorMap;
|
||||
|
||||
Request(IGraphicsTarget target, IMapDescriptor descriptor,
|
||||
DbMapResource rsc, String query, String geomField,
|
||||
DbMapResource rsc, Envelope envelope, String geomField,
|
||||
String labelField, String shadingField,
|
||||
Map<Object, RGB> colorMap) {
|
||||
this.target = target;
|
||||
this.descriptor = descriptor;
|
||||
this.rsc = rsc;
|
||||
this.query = query;
|
||||
this.envelope = envelope;
|
||||
this.geomField = geomField;
|
||||
this.labelField = labelField;
|
||||
this.shadingField = shadingField;
|
||||
|
@ -207,9 +208,9 @@ public class DbMapResource extends
|
|||
|
||||
public Throwable cause;
|
||||
|
||||
public String query;
|
||||
public Envelope query;
|
||||
|
||||
private Result(String query) {
|
||||
private Result(Envelope query) {
|
||||
this.query = query;
|
||||
failed = true;
|
||||
}
|
||||
|
@ -228,7 +229,7 @@ public class DbMapResource extends
|
|||
}
|
||||
|
||||
public void request(IGraphicsTarget target, IMapDescriptor descriptor,
|
||||
DbMapResource rsc, String query, String geomField,
|
||||
DbMapResource rsc, Envelope query, String geomField,
|
||||
String labelField, String shadingField,
|
||||
Map<Object, RGB> colorMap) {
|
||||
if (requestQueue.size() == QUEUE_LIMIT) {
|
||||
|
@ -255,7 +256,7 @@ public class DbMapResource extends
|
|||
protected IStatus run(IProgressMonitor monitor) {
|
||||
Request req = requestQueue.poll();
|
||||
while (req != null) {
|
||||
Result result = new Result(req.query);
|
||||
Result result = new Result(req.envelope);
|
||||
try {
|
||||
String table = resourceData.getTable();
|
||||
if (canceled) {
|
||||
|
@ -263,10 +264,35 @@ public class DbMapResource extends
|
|||
result = null;
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
QueryResult mappedResult = MapQueryCache
|
||||
.executeMappedQuery(req.query, "maps",
|
||||
QueryLanguage.SQL);
|
||||
List<String> constraints = new ArrayList<String>();
|
||||
if (resourceData.getConstraints() != null) {
|
||||
constraints.addAll(Arrays.asList(resourceData
|
||||
.getConstraints()));
|
||||
}
|
||||
List<String> fields = new ArrayList<String>();
|
||||
fields.add(GID);
|
||||
if (req.labelField != null
|
||||
&& !fields.contains(req.labelField)) {
|
||||
fields.add(req.labelField);
|
||||
}
|
||||
if (req.shadingField != null
|
||||
&& !fields.contains(req.shadingField)) {
|
||||
fields.add(req.shadingField);
|
||||
}
|
||||
|
||||
if (resourceData.getColumns() != null) {
|
||||
for (ColumnDefinition column : resourceData
|
||||
.getColumns()) {
|
||||
if (fields.contains(column.getName())) {
|
||||
fields.remove(column.getName());
|
||||
}
|
||||
fields.add(column.toString());
|
||||
}
|
||||
}
|
||||
QueryResult mappedResult = DbMapQueryFactory.getMapQuery(
|
||||
resourceData.getTable(),
|
||||
resourceData.getGeomField()).queryWithinEnvelope(
|
||||
req.envelope, fields, constraints);
|
||||
Map<Integer, Geometry> gidMap = new HashMap<Integer, Geometry>(
|
||||
mappedResult.getResultCount() * 2);
|
||||
List<Integer> toRequest = new ArrayList<Integer>(
|
||||
|
@ -309,7 +335,7 @@ public class DbMapResource extends
|
|||
result = null;
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
QueryResult geomResults = MapQueryCache
|
||||
QueryResult geomResults = DirectDbQuery
|
||||
.executeMappedQuery(geomQuery.toString(),
|
||||
"maps", QueryLanguage.SQL);
|
||||
for (int i = 0; i < geomResults.getResultCount(); ++i) {
|
||||
|
@ -330,7 +356,7 @@ public class DbMapResource extends
|
|||
"Expected byte[] received "
|
||||
+ obj.getClass().getName()
|
||||
+ ": " + obj.toString()
|
||||
+ "\n query=\"" + req.query
|
||||
+ "\n query=\"" + req.envelope
|
||||
+ "\"");
|
||||
}
|
||||
gidMap.put(gid, g);
|
||||
|
@ -514,7 +540,7 @@ public class DbMapResource extends
|
|||
if (shadedShape != null) {
|
||||
shadedShape.dispose();
|
||||
}
|
||||
|
||||
lastExtent = null;
|
||||
super.disposeInternal();
|
||||
}
|
||||
|
||||
|
@ -525,7 +551,7 @@ public class DbMapResource extends
|
|||
getLabelFields().toArray(new String[0]));
|
||||
}
|
||||
|
||||
private String buildQuery(PixelExtent extent) throws VizException {
|
||||
private Envelope buildEnvelope(PixelExtent extent) throws VizException {
|
||||
Envelope env = null;
|
||||
try {
|
||||
Envelope e = descriptor.pixelToWorld(extent, descriptor.getCRS());
|
||||
|
@ -535,60 +561,7 @@ public class DbMapResource extends
|
|||
} catch (Exception e) {
|
||||
throw new VizException("Error transforming extent", e);
|
||||
}
|
||||
|
||||
double[] levels = getLevels();
|
||||
String geometryField = getGeomField(levels[levels.length - 1]);
|
||||
|
||||
// get the geometry field
|
||||
StringBuilder query = new StringBuilder("SELECT ");
|
||||
query.append(GID);
|
||||
|
||||
// add any additional columns
|
||||
List<String> additionalColumns = new ArrayList<String>();
|
||||
if (resourceData.getColumns() != null) {
|
||||
for (ColumnDefinition column : resourceData.getColumns()) {
|
||||
query.append(", ");
|
||||
query.append(column);
|
||||
|
||||
additionalColumns.add(column.getName());
|
||||
}
|
||||
}
|
||||
|
||||
// add the label field
|
||||
String labelField = getCapability(LabelableCapability.class)
|
||||
.getLabelField();
|
||||
if (labelField != null && !additionalColumns.contains(labelField)) {
|
||||
query.append(", ");
|
||||
query.append(labelField);
|
||||
}
|
||||
|
||||
// add the shading field
|
||||
String shadingField = getCapability(ShadeableCapability.class)
|
||||
.getShadingField();
|
||||
if (shadingField != null && !additionalColumns.contains(shadingField)) {
|
||||
query.append(", ");
|
||||
query.append(shadingField);
|
||||
}
|
||||
|
||||
// add the geometry table
|
||||
query.append(" FROM ");
|
||||
query.append(resourceData.getTable());
|
||||
|
||||
// add the geospatial constraint
|
||||
query.append(" WHERE ");
|
||||
query.append(getGeospatialConstraint(geometryField, env));
|
||||
|
||||
// add any additional constraints
|
||||
if (resourceData.getConstraints() != null) {
|
||||
for (String constraint : resourceData.getConstraints()) {
|
||||
query.append(" AND ");
|
||||
query.append(constraint);
|
||||
}
|
||||
}
|
||||
|
||||
query.append(';');
|
||||
|
||||
return query.toString();
|
||||
return env;
|
||||
}
|
||||
|
||||
protected String getGeomField(double simpLev) {
|
||||
|
@ -599,18 +572,6 @@ public class DbMapResource extends
|
|||
return resourceData.getGeomField() + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
protected Object getGeospatialConstraint(String geometryField, Envelope env) {
|
||||
// create the geospatial constraint from the envelope
|
||||
String geoConstraint = String.format(
|
||||
"%s && ST_SetSrid('BOX3D(%f %f, %f %f)'::box3d,4326)",
|
||||
geometryField, env.getMinX(), env.getMinY(), env.getMaxX(),
|
||||
env.getMaxY());
|
||||
return geoConstraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dpp
|
||||
* @return
|
||||
|
@ -665,7 +626,7 @@ public class DbMapResource extends
|
|||
clipToProjExtent(screenExtent).getEnvelope())) {
|
||||
if (!paintProps.isZooming()) {
|
||||
PixelExtent expandedExtent = getExpandedExtent(screenExtent);
|
||||
String query = buildQuery(expandedExtent);
|
||||
Envelope query = buildEnvelope(expandedExtent);
|
||||
queryJob.request(aTarget, descriptor, this, query,
|
||||
getGeomField(simpLev), labelField, shadingField,
|
||||
colorMap);
|
||||
|
@ -856,27 +817,13 @@ public class DbMapResource extends
|
|||
protected double[] getLevels() {
|
||||
if (levels == null) {
|
||||
try {
|
||||
int p = resourceData.getTable().indexOf('.');
|
||||
String schema = resourceData.getTable().substring(0, p);
|
||||
String table = resourceData.getTable().substring(p + 1);
|
||||
StringBuilder query = new StringBuilder(
|
||||
"SELECT f_geometry_column FROM public.geometry_columns WHERE f_table_schema='");
|
||||
query.append(schema);
|
||||
query.append("' AND f_table_name='");
|
||||
query.append(table);
|
||||
query.append("' AND f_geometry_column LIKE '");
|
||||
query.append(resourceData.getGeomField());
|
||||
query.append("_%';");
|
||||
List<Object[]> results = MapQueryCache.executeQuery(
|
||||
query.toString(), "maps", QueryLanguage.SQL);
|
||||
|
||||
List<Double> results = DbMapQueryFactory.getMapQuery(
|
||||
resourceData.getTable(), resourceData.getGeomField())
|
||||
.getLevels();
|
||||
levels = new double[results.size()];
|
||||
int i = 0;
|
||||
for (Object[] objs : results) {
|
||||
String s = ((String) objs[0]).substring(
|
||||
resourceData.getGeomField().length() + 1).replace(
|
||||
'_', '.');
|
||||
levels[i++] = Double.parseDouble(s);
|
||||
for (Double d : results) {
|
||||
levels[i++] = d;
|
||||
}
|
||||
Arrays.sort(levels);
|
||||
} catch (VizException e) {
|
||||
|
@ -891,19 +838,9 @@ public class DbMapResource extends
|
|||
protected String getGeometryType() {
|
||||
if (geometryType == null) {
|
||||
try {
|
||||
int p = resourceData.getTable().indexOf('.');
|
||||
String schema = resourceData.getTable().substring(0, p);
|
||||
String table = resourceData.getTable().substring(p + 1);
|
||||
StringBuilder query = new StringBuilder(
|
||||
"SELECT type FROM geometry_columns WHERE f_table_schema='");
|
||||
query.append(schema);
|
||||
query.append("' AND f_table_name='");
|
||||
query.append(table);
|
||||
query.append("' LIMIT 1;");
|
||||
List<Object[]> results = MapQueryCache.executeQuery(
|
||||
query.toString(), "maps", QueryLanguage.SQL);
|
||||
|
||||
geometryType = (String) results.get(0)[0];
|
||||
geometryType = DbMapQueryFactory.getMapQuery(
|
||||
resourceData.getTable(), resourceData.getGeomField())
|
||||
.getGeometryType();
|
||||
} catch (Throwable e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error querying geometry type", e);
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.core.maps.rsc;
|
|||
import java.awt.geom.Rectangle2D;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
|
||||
|
@ -32,6 +33,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.geotools.geometry.jts.ReferencedEnvelope;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
|
||||
import com.raytheon.uf.common.pointdata.vadriver.VA_Advanced;
|
||||
|
@ -45,7 +47,6 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.PointStyle;
|
|||
import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
|
||||
import com.raytheon.uf.viz.core.PixelExtent;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.map.MapDescriptor;
|
||||
|
@ -158,18 +159,19 @@ public class DbPointMapResource extends
|
|||
private class Request {
|
||||
DbPointMapResource rsc;
|
||||
|
||||
boolean labeled;
|
||||
String labelField;
|
||||
|
||||
boolean useGoodness;
|
||||
String goodnessField;
|
||||
|
||||
String query;
|
||||
Envelope env;
|
||||
|
||||
Request(DbPointMapResource rsc, String query, boolean labeled,
|
||||
boolean useGoodness) {
|
||||
public Request(DbPointMapResource rsc, String labelField,
|
||||
String goodnessField, Envelope env) {
|
||||
super();
|
||||
this.rsc = rsc;
|
||||
this.query = query;
|
||||
this.labeled = labeled;
|
||||
this.useGoodness = useGoodness;
|
||||
this.labelField = labelField;
|
||||
this.goodnessField = goodnessField;
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -200,11 +202,12 @@ public class DbPointMapResource extends
|
|||
}
|
||||
|
||||
public void request(IGraphicsTarget target, DbPointMapResource rsc,
|
||||
String query, boolean labeled, boolean useGoodness) {
|
||||
Envelope envelope, String labelField, String goodnessField) {
|
||||
if (requestQueue.size() == QUEUE_LIMIT) {
|
||||
requestQueue.poll();
|
||||
}
|
||||
requestQueue.add(new Request(rsc, query, labeled, useGoodness));
|
||||
requestQueue.add(new Request(rsc, labelField, goodnessField,
|
||||
envelope));
|
||||
|
||||
this.cancel();
|
||||
this.schedule();
|
||||
|
@ -226,10 +229,37 @@ public class DbPointMapResource extends
|
|||
while (req != null) {
|
||||
Result result = new Result();
|
||||
try {
|
||||
System.out.println(req.query);
|
||||
long t0 = System.currentTimeMillis();
|
||||
List<Object[]> results = MapQueryCache.executeQuery(
|
||||
req.query, "maps", QueryLanguage.SQL);
|
||||
List<String> columns = new ArrayList<String>();
|
||||
if (req.labelField != null) {
|
||||
columns.add(req.labelField);
|
||||
}
|
||||
if (req.goodnessField != null
|
||||
&& req.goodnessField != req.labelField) {
|
||||
columns.add(req.goodnessField);
|
||||
}
|
||||
if (resourceData.getColumns() != null) {
|
||||
for (ColumnDefinition column : resourceData
|
||||
.getColumns()) {
|
||||
if (columns.contains(column.getName())) {
|
||||
columns.remove(column.getName());
|
||||
}
|
||||
columns.add(column.toString());
|
||||
}
|
||||
}
|
||||
columns.add("AsBinary(" + resourceData.getGeomField()
|
||||
+ ") as " + resourceData.getGeomField());
|
||||
|
||||
List<String> constraints = null;
|
||||
if (resourceData.getConstraints() != null) {
|
||||
constraints = Arrays.asList(resourceData
|
||||
.getConstraints());
|
||||
}
|
||||
|
||||
QueryResult results = DbMapQueryFactory.getMapQuery(
|
||||
resourceData.getTable(),
|
||||
resourceData.getGeomField()).queryWithinEnvelope(
|
||||
req.env, columns, constraints);
|
||||
|
||||
long t1 = System.currentTimeMillis();
|
||||
System.out.println("Maps DB query took: " + (t1 - t0)
|
||||
|
@ -238,41 +268,48 @@ public class DbPointMapResource extends
|
|||
List<LabelNode> newLabels = new ArrayList<LabelNode>();
|
||||
|
||||
WKBReader wkbReader = new WKBReader();
|
||||
for (Object[] r : results) {
|
||||
for (int c = 0; c < results.getResultCount(); c++) {
|
||||
if (canceled) {
|
||||
canceled = false;
|
||||
result = null;
|
||||
// System.out.println("MapQueryJob Canceled.");
|
||||
return Status.CANCEL_STATUS;
|
||||
}
|
||||
int i = 0;
|
||||
Geometry g = null;
|
||||
if (r[i] instanceof byte[]) {
|
||||
byte[] wkb = (byte[]) r[i++];
|
||||
Object geomObj = results.getRowColumnValue(c,
|
||||
resourceData.getGeomField());
|
||||
if (geomObj instanceof byte[]) {
|
||||
byte[] wkb = (byte[]) geomObj;
|
||||
g = wkbReader.read(wkb);
|
||||
} else {
|
||||
statusHandler.handle(Priority.ERROR,
|
||||
"Expected byte[] received "
|
||||
+ r[i].getClass().getName() + ": "
|
||||
+ r[i].toString() + "\n query=\""
|
||||
+ req.query + "\"");
|
||||
+ geomObj.getClass().getName()
|
||||
+ ": " + geomObj.toString()
|
||||
+ "\n query=\"" + req.env + "\"");
|
||||
}
|
||||
|
||||
if (g != null) {
|
||||
String label = "";
|
||||
if (req.labeled && r[i] != null) {
|
||||
if (r[i] instanceof BigDecimal) {
|
||||
label = Double.toString(((Number) r[i++])
|
||||
if (req.labelField != null
|
||||
&& results.getRowColumnValue(c,
|
||||
req.labelField) != null) {
|
||||
Object r = results.getRowColumnValue(c,
|
||||
req.labelField);
|
||||
if (r instanceof BigDecimal) {
|
||||
label = Double.toString(((Number) r)
|
||||
.doubleValue());
|
||||
} else {
|
||||
label = r[i++].toString();
|
||||
label = r.toString();
|
||||
}
|
||||
}
|
||||
LabelNode node = new LabelNode(label,
|
||||
g.getCentroid());
|
||||
|
||||
if (req.useGoodness) {
|
||||
node.setGoodness(((Number) r[i++]).intValue());
|
||||
if (req.goodnessField != null) {
|
||||
node.setGoodness(((Number) results
|
||||
.getRowColumnValue(c, req.goodnessField))
|
||||
.intValue());
|
||||
}
|
||||
newLabels.add(node);
|
||||
}
|
||||
|
@ -293,7 +330,7 @@ public class DbPointMapResource extends
|
|||
}
|
||||
Double[] distances;
|
||||
|
||||
if (req.useGoodness) {
|
||||
if (req.goodnessField != null) {
|
||||
distances = distanceCalc.getVaAdvanced(coords,
|
||||
goodness, dst);
|
||||
} else {
|
||||
|
@ -358,7 +395,7 @@ public class DbPointMapResource extends
|
|||
queryJob = new MapQueryJob();
|
||||
}
|
||||
|
||||
private String buildQuery(IGraphicsTarget target, PixelExtent extent)
|
||||
private void requestData(IGraphicsTarget target, PixelExtent extent)
|
||||
throws VizException {
|
||||
|
||||
Envelope env = null;
|
||||
|
@ -370,62 +407,13 @@ public class DbPointMapResource extends
|
|||
} catch (Exception e) {
|
||||
throw new VizException("Error transforming extent", e);
|
||||
}
|
||||
// System.out.println(env);
|
||||
|
||||
String geometryField = resourceData.getGeomField();
|
||||
|
||||
// create the geospatial constraint from the envelope
|
||||
String geoConstraint = String.format(
|
||||
"%s && ST_SetSrid('BOX3D(%f %f, %f %f)'::box3d,4326)",
|
||||
geometryField, env.getMinX(), env.getMinY(), env.getMaxX(),
|
||||
env.getMaxY());
|
||||
|
||||
// get the geometry field
|
||||
StringBuilder query = new StringBuilder("SELECT AsBinary(");
|
||||
query.append(geometryField);
|
||||
query.append(")");
|
||||
|
||||
// add the label field
|
||||
String labelField = getCapability(LabelableCapability.class)
|
||||
.getLabelField();
|
||||
if (labelField != null) {
|
||||
query.append(", ");
|
||||
query.append(labelField);
|
||||
}
|
||||
|
||||
// add the goodness field
|
||||
if (resourceData.getGoodnessField() != null) {
|
||||
query.append(", ");
|
||||
query.append(resourceData.getGoodnessField());
|
||||
}
|
||||
|
||||
// add any additional columns
|
||||
if (resourceData.getColumns() != null) {
|
||||
for (ColumnDefinition column : resourceData.getColumns()) {
|
||||
query.append(", ");
|
||||
query.append(column);
|
||||
}
|
||||
}
|
||||
|
||||
// add the geometry table
|
||||
query.append(" FROM ");
|
||||
query.append(resourceData.getTable());
|
||||
|
||||
// add the geo constraint
|
||||
query.append(" WHERE ");
|
||||
query.append(geoConstraint);
|
||||
|
||||
// add any addtional constraints
|
||||
if (resourceData.getConstraints() != null) {
|
||||
for (String constraint : resourceData.getConstraints()) {
|
||||
query.append(" AND ");
|
||||
query.append(constraint);
|
||||
}
|
||||
}
|
||||
|
||||
query.append(';');
|
||||
|
||||
return query.toString();
|
||||
queryJob.request(target, this, env, labelField,
|
||||
resourceData.getGoodnessField());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -454,9 +442,7 @@ public class DbPointMapResource extends
|
|||
clipToProjExtent(screenExtent).getEnvelope())) {
|
||||
if (!paintProps.isZooming()) {
|
||||
PixelExtent expandedExtent = getExpandedExtent(screenExtent);
|
||||
String query = buildQuery(aTarget, expandedExtent);
|
||||
queryJob.request(aTarget, this, query, isLabeled,
|
||||
resourceData.getGoodnessField() != null);
|
||||
requestData(aTarget, expandedExtent);
|
||||
lastExtent = expandedExtent;
|
||||
lastLabelField = labelField;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.maps.rsc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.maps.rsc.DbMapQueryFactory.DbMapQuery;
|
||||
import com.vividsolutions.jts.geom.Envelope;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 9, 2011 bsteffen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DefaultDbMapQuery implements DbMapQuery {
|
||||
|
||||
protected static final String MAPS = "maps";
|
||||
|
||||
protected final String table;
|
||||
|
||||
protected final String geomField;
|
||||
|
||||
protected DefaultDbMapQuery(String table, String geomField) {
|
||||
this.table = table;
|
||||
this.geomField = geomField;
|
||||
}
|
||||
|
||||
@Override
|
||||
public QueryResult queryWithinEnvelope(Envelope env, List<String> columns,
|
||||
List<String> additionalConstraints) throws VizException {
|
||||
// add the geospatial constraint
|
||||
if (env != null) {
|
||||
// copy before modifying
|
||||
if (additionalConstraints == null) {
|
||||
additionalConstraints = new ArrayList<String>();
|
||||
} else {
|
||||
additionalConstraints = new ArrayList<String>(
|
||||
additionalConstraints);
|
||||
}
|
||||
// geospatial constraint will be first
|
||||
additionalConstraints.add(0, String.format(
|
||||
"%s && ST_SetSrid('BOX3D(%f %f, %f %f)'::box3d,4326)",
|
||||
geomField, env.getMinX(), env.getMinY(), env.getMaxX(),
|
||||
env.getMaxY()));
|
||||
}
|
||||
|
||||
StringBuilder query = new StringBuilder("SELECT ");
|
||||
if (columns != null && !columns.isEmpty()) {
|
||||
Iterator<String> iter = columns.iterator();
|
||||
query.append(iter.next());
|
||||
while (iter.hasNext()) {
|
||||
query.append(", ");
|
||||
query.append(iter.next());
|
||||
}
|
||||
}
|
||||
|
||||
query.append(" FROM ");
|
||||
query.append(table);
|
||||
|
||||
// add any additional constraints
|
||||
if (additionalConstraints != null && !additionalConstraints.isEmpty()) {
|
||||
query.append(" WHERE ");
|
||||
Iterator<String> iter = additionalConstraints.iterator();
|
||||
query.append(iter.next());
|
||||
while (iter.hasNext()) {
|
||||
query.append(" AND ");
|
||||
query.append(iter.next());
|
||||
}
|
||||
}
|
||||
|
||||
query.append(';');
|
||||
|
||||
return DirectDbQuery.executeMappedQuery(query.toString(), MAPS,
|
||||
QueryLanguage.SQL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getColumnNamesWithoutGeometries() throws VizException {
|
||||
List<String> labelFields = new ArrayList<String>();
|
||||
int p = table.indexOf('.');
|
||||
String schema = table.substring(0, p);
|
||||
String table = this.table.substring(p + 1);
|
||||
|
||||
StringBuilder query = new StringBuilder(
|
||||
"SELECT column_name FROM information_schema.columns WHERE table_schema = '");
|
||||
query.append(schema);
|
||||
query.append("' AND table_name='");
|
||||
query.append(table);
|
||||
query.append("' ");
|
||||
query.append("AND udt_name != 'geometry' ");
|
||||
query.append("ORDER BY ordinal_position;");
|
||||
List<Object[]> results = DirectDbQuery.executeQuery(query.toString(),
|
||||
MAPS, QueryLanguage.SQL);
|
||||
|
||||
for (Object[] obj : results) {
|
||||
labelFields.add(obj[0].toString());
|
||||
}
|
||||
return labelFields;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGeometryType() throws VizException {
|
||||
int p = table.indexOf('.');
|
||||
String schema = table.substring(0, p);
|
||||
String table = this.table.substring(p + 1);
|
||||
StringBuilder query = new StringBuilder(
|
||||
"SELECT type FROM geometry_columns WHERE f_table_schema='");
|
||||
query.append(schema);
|
||||
query.append("' AND f_table_name='");
|
||||
query.append(table);
|
||||
query.append("' LIMIT 1;");
|
||||
List<Object[]> results = DirectDbQuery.executeQuery(query.toString(),
|
||||
MAPS, QueryLanguage.SQL);
|
||||
|
||||
return (String) results.get(0)[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Double> getLevels() throws VizException {
|
||||
int p = table.indexOf('.');
|
||||
String schema = table.substring(0, p);
|
||||
String table = this.table.substring(p + 1);
|
||||
StringBuilder query = new StringBuilder(
|
||||
"SELECT f_geometry_column FROM public.geometry_columns WHERE f_table_schema='");
|
||||
query.append(schema);
|
||||
query.append("' AND f_table_name='");
|
||||
query.append(table);
|
||||
query.append("' AND f_geometry_column LIKE '");
|
||||
query.append(geomField);
|
||||
query.append("_%';");
|
||||
List<Object[]> results = DirectDbQuery.executeQuery(query.toString(),
|
||||
MAPS, QueryLanguage.SQL);
|
||||
|
||||
List<Double> levels = new ArrayList<Double>(results.size());
|
||||
for (Object[] objs : results) {
|
||||
String s = (String) objs[0];
|
||||
s = s.replace(geomField + "_", "");
|
||||
s = s.replace('_', '.');
|
||||
levels.add(Double.parseDouble(s));
|
||||
}
|
||||
return levels;
|
||||
}
|
||||
}
|
|
@ -1,269 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.maps.rsc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResult;
|
||||
import com.raytheon.uf.common.dataquery.db.QueryResultRow;
|
||||
import com.raytheon.uf.common.localization.FileLocker;
|
||||
import com.raytheon.uf.common.localization.FileLocker.Type;
|
||||
import com.raytheon.uf.common.serialization.DynamicSerializationManager;
|
||||
import com.raytheon.uf.common.serialization.DynamicSerializationManager.SerializationType;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.util.cache.ICacheObject;
|
||||
import com.raytheon.uf.common.util.cache.LRUCache;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
|
||||
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.maps.rsc.MapQueryCache.QueryCacheable;
|
||||
|
||||
/**
|
||||
* Map query caching derived from Erik Magnuson's code changes to DirectDbQuery
|
||||
* to keep map results around on the client and not waste time/bandwidth
|
||||
* querying.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 9, 2011 njensen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MapQueryCache extends LRUCache<String, QueryCacheable> {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(MapQueryCache.class);
|
||||
|
||||
private static MapQueryCache mapQueryCache = new MapQueryCache(
|
||||
64 * 1024 * 1024);
|
||||
|
||||
private static boolean cache = false;
|
||||
|
||||
@DynamicSerialize
|
||||
protected static class QueryCacheable implements ICacheObject {
|
||||
|
||||
@DynamicSerializeElement
|
||||
QueryResult queryResult;
|
||||
|
||||
public QueryCacheable() {
|
||||
|
||||
}
|
||||
|
||||
protected QueryCacheable(QueryResult result) {
|
||||
queryResult = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
// TODO get better number or move this off LRU
|
||||
return queryResult.getColumnCount() * queryResult.getRows().length
|
||||
* 4;
|
||||
}
|
||||
|
||||
public QueryResult getQueryResult() {
|
||||
return queryResult;
|
||||
}
|
||||
|
||||
public void setQueryResult(QueryResult queryResult) {
|
||||
this.queryResult = queryResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@DynamicSerialize
|
||||
protected static class CachePair {
|
||||
|
||||
@DynamicSerializeElement
|
||||
String queryKey;
|
||||
|
||||
@DynamicSerializeElement
|
||||
QueryCacheable cacheable;
|
||||
|
||||
public CachePair() {
|
||||
|
||||
}
|
||||
|
||||
protected CachePair(String key, QueryCacheable obj) {
|
||||
this.queryKey = key;
|
||||
this.cacheable = obj;
|
||||
}
|
||||
|
||||
public String getQueryKey() {
|
||||
return queryKey;
|
||||
}
|
||||
|
||||
public void setQueryKey(String queryKey) {
|
||||
this.queryKey = queryKey;
|
||||
}
|
||||
|
||||
public QueryCacheable getCacheable() {
|
||||
return cacheable;
|
||||
}
|
||||
|
||||
public void setCacheable(QueryCacheable cacheable) {
|
||||
this.cacheable = cacheable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor
|
||||
*
|
||||
* @param maxSize
|
||||
*/
|
||||
private MapQueryCache(long maxSize) {
|
||||
super(maxSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a mapped query against DirectDbQuery API. If cache is enabled
|
||||
* will check the cache before sending a query and if sending a query, will
|
||||
* store the result in the cache.
|
||||
*
|
||||
* @param query
|
||||
* @param database
|
||||
* @param language
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public static QueryResult executeMappedQuery(String query, String database,
|
||||
QueryLanguage language) throws VizException {
|
||||
QueryResult queryResult = null;
|
||||
String key = query + database + language;
|
||||
|
||||
if (cache) {
|
||||
QueryCacheable cacheResult = mapQueryCache.get(key);
|
||||
if (cacheResult != null) {
|
||||
queryResult = cacheResult.queryResult;
|
||||
}
|
||||
}
|
||||
|
||||
if (queryResult == null) {
|
||||
// either cache was disabled, it wasn't in cache, or reading cache
|
||||
// failed, so send the query
|
||||
queryResult = DirectDbQuery.executeMappedQuery(query, database,
|
||||
language);
|
||||
if (cache) {
|
||||
mapQueryCache.put(key, new QueryCacheable(queryResult));
|
||||
}
|
||||
}
|
||||
|
||||
return queryResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a query against DirectDbQuery API. If cache is enabled will
|
||||
* check the cache before sending a query and if sending a query, will store
|
||||
* the result in the cache.
|
||||
*
|
||||
* @param query
|
||||
* @param database
|
||||
* @param language
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public static List<Object[]> executeQuery(String query, String database,
|
||||
QueryLanguage language) throws VizException {
|
||||
QueryResult result = executeMappedQuery(query, database, language);
|
||||
List<Object[]> unmappedResults = new ArrayList<Object[]>();
|
||||
|
||||
for (QueryResultRow row : result.getRows()) {
|
||||
unmappedResults.add(row.getColumnValues());
|
||||
}
|
||||
return unmappedResults;
|
||||
}
|
||||
|
||||
public static void setCaching(boolean caching) {
|
||||
cache = caching;
|
||||
}
|
||||
|
||||
private Collection<CachePair> getCacheables() {
|
||||
List<CachePair> pairs = new ArrayList<CachePair>(lruMap.size());
|
||||
synchronized (this) {
|
||||
for (Entry<String, Item> entry : lruMap.entrySet()) {
|
||||
pairs.add(new CachePair(entry.getKey(), entry.getValue().value));
|
||||
}
|
||||
}
|
||||
return pairs;
|
||||
}
|
||||
|
||||
private void setCacheables(Collection<CachePair> pairs) {
|
||||
for (CachePair pair : pairs) {
|
||||
put(pair.queryKey, pair.cacheable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the geometry cache from the file system
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static synchronized void restoreCache(File cacheFile) {
|
||||
try {
|
||||
FileLocker.lock(MapQueryCache.class, cacheFile, Type.READ);
|
||||
if (cacheFile.exists() && cacheFile.length() > 0) {
|
||||
FileInputStream fin = new FileInputStream(cacheFile);
|
||||
Collection<CachePair> pairs = (Collection<CachePair>) DynamicSerializationManager
|
||||
.getManager(SerializationType.Thrift).deserialize(fin);
|
||||
mapQueryCache.setCacheables(pairs);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
statusHandler.error("Error restoring cache from file system", e);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
FileLocker.unlock(MapQueryCache.class, cacheFile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the geometry cache to the file system
|
||||
*/
|
||||
public static synchronized void storeCache(File cacheFile) {
|
||||
try {
|
||||
FileLocker.lock(MapQueryCache.class, cacheFile, Type.WRITE);
|
||||
FileOutputStream out = new FileOutputStream(cacheFile);
|
||||
DynamicSerializationManager.getManager(SerializationType.Thrift)
|
||||
.serialize(mapQueryCache.getCacheables(), out);
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
statusHandler.error("Error storing cache to file system", e);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
FileLocker.unlock(MapQueryCache.class, cacheFile);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -23,6 +23,7 @@
|
|||
<httpServerAddress>http://localhost:9581/services</httpServerAddress>
|
||||
<dataDirectory>/awips2/edex/data/share</dataDirectory>
|
||||
<textureCardPreference>512</textureCardPreference>
|
||||
<tearoffmenus>true</tearoffmenus>
|
||||
<framesPerSecondPreference>25</framesPerSecondPreference>
|
||||
<tileBoundaries>false</tileBoundaries>
|
||||
<fontMagnification>1.0</fontMagnification>
|
||||
|
|
|
@ -133,11 +133,4 @@ public abstract class AbstractGraphicsFactoryAdapter {
|
|||
public abstract Canvas constrcutCanvas(Composite canvasComp)
|
||||
throws VizException;
|
||||
|
||||
/**
|
||||
* Dispose of the canvas, it can be assumed the canvas is the same type
|
||||
* created from constructCanvas
|
||||
*
|
||||
* @param canvas
|
||||
*/
|
||||
public abstract void disposeCanvas(Canvas canvas);
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@ import org.eclipse.core.runtime.IExtension;
|
|||
import org.eclipse.core.runtime.IExtensionPoint;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.contexts.IContextActivation;
|
||||
import org.eclipse.ui.contexts.IContextService;
|
||||
import org.eclipse.ui.services.IServiceLocator;
|
||||
|
||||
/**
|
||||
* Uses extension point to look up contexts for editors
|
||||
|
@ -61,7 +61,7 @@ public class ContextManager {
|
|||
|
||||
private static final String EXTENSION_POINT = "com.raytheon.uf.viz.core.classContext";
|
||||
|
||||
private static Map<IWorkbenchWindow, ContextManager> instanceMap = new HashMap<IWorkbenchWindow, ContextManager>();
|
||||
private static Map<IServiceLocator, ContextManager> instanceMap = new HashMap<IServiceLocator, ContextManager>();
|
||||
|
||||
private static synchronized String[] getContextsForClass(String name) {
|
||||
if (contexts == null) {
|
||||
|
@ -126,11 +126,11 @@ public class ContextManager {
|
|||
}
|
||||
|
||||
public static synchronized ContextManager getInstance(
|
||||
IWorkbenchWindow window) {
|
||||
ContextManager manager = instanceMap.get(window);
|
||||
IServiceLocator locator) {
|
||||
ContextManager manager = instanceMap.get(locator);
|
||||
if (manager == null) {
|
||||
manager = new ContextManager(window);
|
||||
instanceMap.put(window, manager);
|
||||
manager = new ContextManager(locator);
|
||||
instanceMap.put(locator, manager);
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
@ -141,8 +141,8 @@ public class ContextManager {
|
|||
|
||||
private IContextService service;
|
||||
|
||||
private ContextManager(IWorkbenchWindow window) {
|
||||
service = (IContextService) window.getService(IContextService.class);
|
||||
private ContextManager(IServiceLocator locator) {
|
||||
service = (IContextService) locator.getService(IContextService.class);
|
||||
activeObjects = new HashSet<Object>();
|
||||
activeMap = new HashMap<String, ContextManager.Context>();
|
||||
}
|
||||
|
|
|
@ -45,11 +45,16 @@ public class DrawableImage {
|
|||
|
||||
private PixelCoverage coverage;
|
||||
|
||||
private RasterMode mode = RasterMode.SYNCHRONOUS;
|
||||
private RasterMode mode;
|
||||
|
||||
public DrawableImage(IImage image, PixelCoverage coverage) {
|
||||
this(image, coverage, RasterMode.SYNCHRONOUS);
|
||||
}
|
||||
|
||||
public DrawableImage(IImage image, PixelCoverage coverage, RasterMode mode) {
|
||||
this.image = image;
|
||||
this.coverage = coverage;
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
public IImage getImage() {
|
||||
|
|
|
@ -39,6 +39,8 @@ import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
|||
import com.raytheon.uf.viz.core.drawables.IShadedShape;
|
||||
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.geom.PixelCoordinate;
|
||||
import com.vividsolutions.jts.geom.LinearRing;
|
||||
|
@ -64,7 +66,7 @@ import com.vividsolutions.jts.geom.LinearRing;
|
|||
* @author chammack
|
||||
* @version 1
|
||||
*/
|
||||
public interface IGraphicsTarget {
|
||||
public interface IGraphicsTarget extends IImagingExtension {
|
||||
|
||||
/** Defines alignment characteristics */
|
||||
public static enum HorizontalAlignment {
|
||||
|
@ -189,24 +191,6 @@ public interface IGraphicsTarget {
|
|||
public abstract boolean drawRaster(IImage image, PixelCoverage extent,
|
||||
PaintProperties paintProps) throws VizException;
|
||||
|
||||
/**
|
||||
* Draw a raster to a target, given an extent and an alpha (transparency)
|
||||
* value. Assumes synchronous operation.
|
||||
*
|
||||
* This operation will block on unavailable data.
|
||||
*
|
||||
* @param image
|
||||
* the image reference object to draw
|
||||
* @param extent
|
||||
* the extent of the drawable area
|
||||
* @param paintProps
|
||||
* the paint properties
|
||||
* @return status whether the raster was able to be drawn
|
||||
* @throws VizException
|
||||
*/
|
||||
public abstract boolean drawRasters(PaintProperties paintProps,
|
||||
DrawableImage... images) throws VizException;
|
||||
|
||||
/**
|
||||
* Draw a raster to a target, given an extent and an alpha (transparency)
|
||||
* value
|
||||
|
@ -662,15 +646,6 @@ public interface IGraphicsTarget {
|
|||
*/
|
||||
public abstract boolean isNeedsRefresh();
|
||||
|
||||
/**
|
||||
* Stage an image
|
||||
*
|
||||
* @param image
|
||||
* the image to stage
|
||||
* @throws VizException
|
||||
*/
|
||||
public abstract void stage(final IImage image) throws VizException;
|
||||
|
||||
/**
|
||||
* Sets the background color of the panes.
|
||||
*
|
||||
|
@ -680,6 +655,10 @@ public interface IGraphicsTarget {
|
|||
public abstract void setBackgroundColor(RGB backgroundColor);
|
||||
|
||||
/**
|
||||
* DEPRECATED: This method has no effect. IGraphicsTargets are not
|
||||
* responsible to drawing a colorbar. Use method drawColorRamp to draw a
|
||||
* color ramp
|
||||
*
|
||||
* Sets whether to display a builtin colorbar when displaying colormapped
|
||||
* images (Defaults to true)
|
||||
*
|
||||
|
@ -687,6 +666,7 @@ public interface IGraphicsTarget {
|
|||
* boolean flag indicating whether to display the built in
|
||||
* colorbar
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void setUseBuiltinColorbar(boolean isColorbarDisplayed);
|
||||
|
||||
/**
|
||||
|
@ -1044,6 +1024,7 @@ public interface IGraphicsTarget {
|
|||
* @param extensionClass
|
||||
* @return
|
||||
*/
|
||||
public abstract <T> T getExtension(Class<T> extensionClass)
|
||||
throws VizException;
|
||||
public abstract <T extends IGraphicsExtensionInterface> T getExtension(
|
||||
Class<T> extensionClass) throws VizException;
|
||||
|
||||
}
|
||||
|
|
|
@ -19,14 +19,13 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.core;
|
||||
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderable;
|
||||
import com.raytheon.uf.viz.core.rsc.hdf5.ImageTile;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* Base for any mesh 2D/3D, Quad/Triangle -- etc
|
||||
* Base for any mesh 2D/3D, Quad/Triangle -- etc. See {@link PixelCoverage} /
|
||||
* {@link DrawableImage}
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
|
@ -40,27 +39,7 @@ import com.raytheon.uf.viz.core.rsc.hdf5.ImageTile;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IMesh extends IRenderable {
|
||||
|
||||
/**
|
||||
* Calculate all the mesh vertices and texture coordinates
|
||||
*
|
||||
* @param pc
|
||||
* @param tile
|
||||
* @param toLatLon
|
||||
* translate the tile coordinates to lat/lon coords if the tile
|
||||
* envelope is not already
|
||||
*/
|
||||
public abstract void calculateMesh(PixelCoverage pc, ImageTile tile,
|
||||
MathTransform toLatLon);
|
||||
|
||||
/**
|
||||
* Calculate all the mesh vertices and texture coordinates
|
||||
*
|
||||
* @param pc
|
||||
* @param gg
|
||||
*/
|
||||
public void calculateMesh(PixelCoverage pc, GridGeometry2D gg);
|
||||
public interface IMesh {
|
||||
|
||||
/**
|
||||
* Dispose of the mesh data
|
||||
|
@ -73,4 +52,12 @@ public interface IMesh extends IRenderable {
|
|||
* @param extent
|
||||
*/
|
||||
public boolean intersects(IExtent extent);
|
||||
|
||||
/**
|
||||
* Reprojects the mesh into the new target geometry
|
||||
*
|
||||
* @param targetGeometry
|
||||
*/
|
||||
public void reproject(GeneralGridGeometry targetGeometry)
|
||||
throws VizException;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
**/
|
||||
|
@ -38,8 +38,6 @@ import java.util.Map;
|
|||
*/
|
||||
|
||||
public class AlertMessage {
|
||||
/** The id of the alert */
|
||||
public Integer id;
|
||||
|
||||
/** The raw string dataURI */
|
||||
public String dataURI;
|
||||
|
|
|
@ -77,8 +77,6 @@ public class Colormapper {
|
|||
boolean log = parameters.isLogarithmic();
|
||||
double logFactor = parameters.getLogFactor();
|
||||
boolean mirror = parameters.isMirror();
|
||||
double naturalMin = parameters.getDataMin();
|
||||
double naturalMax = parameters.getDataMax();
|
||||
double cmapMin = parameters.getColorMapMin();
|
||||
double cmapMax = parameters.getColorMapMax();
|
||||
int colorMapSz = parameters.getColorMap().getSize();
|
||||
|
|
|
@ -34,7 +34,6 @@ import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
|||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequestSet;
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.raytheon.uf.common.datastorage.StorageException;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
|
@ -42,10 +41,7 @@ import com.raytheon.uf.common.pointdata.PointDataContainer;
|
|||
import com.raytheon.uf.common.time.BinOffset;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.catalog.ScriptCreator;
|
||||
import com.raytheon.uf.viz.core.comm.Loader;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
/**
|
||||
* The DataCubeContainer is responsible for handling requests for data times,
|
||||
|
@ -101,7 +97,7 @@ public class DataCubeContainer {
|
|||
if (container.adapter != null) {
|
||||
synchronized (container.adapter) {
|
||||
Boolean initialized = initializedMap.get(container.adapter);
|
||||
if (!initialized) {
|
||||
if (initialized == null || !initialized) {
|
||||
container.adapter.initInventory();
|
||||
initializedMap.put(container.adapter, true);
|
||||
}
|
||||
|
@ -121,21 +117,9 @@ public class DataCubeContainer {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IDataRecord[] getDataRecordInternal(PluginDataObject obj)
|
||||
throws VizDataCubeException {
|
||||
if (adapter != null) {
|
||||
return adapter.getRecord(obj);
|
||||
} else {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException(
|
||||
"Error retrieving 2D grid record.", e);
|
||||
}
|
||||
return new IDataRecord[] { record };
|
||||
if (adapter == null) {
|
||||
// Construct default adapter for plugin if none found
|
||||
adapter = new DefaultDataCubeAdapter(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,23 +137,7 @@ public class DataCubeContainer {
|
|||
*/
|
||||
public static IDataRecord[] getDataRecord(PluginDataObject obj)
|
||||
throws VizDataCubeException {
|
||||
return getInstance(obj.getPluginName()).getDataRecordInternal(obj);
|
||||
}
|
||||
|
||||
private IDataRecord[] getDataRecordInternal(PluginDataObject obj,
|
||||
Request req, String dataset) throws VizDataCubeException {
|
||||
if (adapter != null) {
|
||||
return adapter.getRecord(obj, req, dataset);
|
||||
} else {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName, req, dataset);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException(
|
||||
"Error retrieving 2D grid record.", e);
|
||||
}
|
||||
return new IDataRecord[] { record };
|
||||
}
|
||||
return getInstance(obj.getPluginName()).adapter.getRecord(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -188,29 +156,10 @@ public class DataCubeContainer {
|
|||
*/
|
||||
public static IDataRecord[] getDataRecord(PluginDataObject obj,
|
||||
Request req, String dataset) throws VizDataCubeException {
|
||||
return getInstance(obj.getPluginName()).getDataRecordInternal(obj, req,
|
||||
return getInstance(obj.getPluginName()).adapter.getRecord(obj, req,
|
||||
dataset);
|
||||
}
|
||||
|
||||
private void getDataRecordsInternal(List<PluginDataObject> objs,
|
||||
Request req, String dataset) throws VizDataCubeException {
|
||||
if (adapter != null) {
|
||||
adapter.getRecords(objs, req, dataset);
|
||||
} else {
|
||||
for (PluginDataObject obj : objs) {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName, req,
|
||||
dataset);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException(
|
||||
"Error retrieving 2D grid record.", e);
|
||||
}
|
||||
obj.setMessageData(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* For each PluginDataObject requests the DataRecords specified by Request
|
||||
* and dataSet and stores those DataRecords in the PluginDataObject message
|
||||
|
@ -238,41 +187,25 @@ public class DataCubeContainer {
|
|||
"All PluginDataObjects must be for the same plugin");
|
||||
}
|
||||
}
|
||||
getInstance(pluginName).getDataRecordsInternal(objs, req, dataset);
|
||||
}
|
||||
|
||||
private PointDataContainer getPointDataInternal(String[] params,
|
||||
Map<String, RequestConstraint> map) throws VizException {
|
||||
if (adapter != null) {
|
||||
return adapter.getPoints(pluginName, params, map);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
getInstance(pluginName).adapter.getRecords(objs, req, dataset);
|
||||
}
|
||||
|
||||
public static PointDataContainer getPointData(String plugin,
|
||||
String[] params, Map<String, RequestConstraint> map)
|
||||
throws VizException {
|
||||
return getInstance(plugin).getPointDataInternal(params, map);
|
||||
}
|
||||
|
||||
private PointDataContainer getPointDataInternal(String[] params,
|
||||
String levelKey, Map<String, RequestConstraint> map)
|
||||
throws VizException {
|
||||
if (levelKey == null) {
|
||||
return getPointData(pluginName, params, map);
|
||||
}
|
||||
if (adapter != null) {
|
||||
return adapter.getPoints(pluginName, params, levelKey, map);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
DataCubeContainer container = getInstance(plugin);
|
||||
return container.adapter.getPoints(container.pluginName, params, map);
|
||||
}
|
||||
|
||||
public static PointDataContainer getPointData(String plugin,
|
||||
String[] params, String levelKey, Map<String, RequestConstraint> map)
|
||||
throws VizException {
|
||||
return getInstance(plugin).getPointDataInternal(params, levelKey, map);
|
||||
DataCubeContainer container = getInstance(plugin);
|
||||
if (levelKey == null) {
|
||||
return getPointData(container.pluginName, params, map);
|
||||
}
|
||||
return container.adapter.getPoints(container.pluginName, params,
|
||||
levelKey, map);
|
||||
}
|
||||
|
||||
public static DataTime[] performTimeQuery(
|
||||
|
@ -308,20 +241,6 @@ public class DataCubeContainer {
|
|||
new DataTime[0]);
|
||||
}
|
||||
|
||||
public List<List<DataTime>> performTimeQueriesInternal(
|
||||
List<TimeQueryRequest> requests) throws VizException {
|
||||
if (adapter == null) {
|
||||
TimeQueryRequestSet set = new TimeQueryRequestSet();
|
||||
set.setRequests(requests.toArray(new TimeQueryRequest[0]));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<List<DataTime>> result = (List<List<DataTime>>) ThriftClient
|
||||
.sendRequest(set);
|
||||
return result;
|
||||
} else {
|
||||
return adapter.timeQuery(requests);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a bulk time query request when all requests have the same plugin
|
||||
* type.
|
||||
|
@ -334,7 +253,7 @@ public class DataCubeContainer {
|
|||
if (requests.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return getInstance(pluginName).performTimeQueriesInternal(requests);
|
||||
return getInstance(pluginName).adapter.timeQuery(requests);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -346,8 +265,8 @@ public class DataCubeContainer {
|
|||
*/
|
||||
public static List<List<DataTime>> performTimeQueries(String pluginName,
|
||||
TimeQueryRequest... requests) throws VizException {
|
||||
return getInstance(pluginName).performTimeQueriesInternal(
|
||||
Arrays.asList(requests));
|
||||
return getInstance(pluginName).adapter.timeQuery(Arrays
|
||||
.asList(requests));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -403,17 +322,6 @@ public class DataCubeContainer {
|
|||
return result;
|
||||
}
|
||||
|
||||
private synchronized List<Object> getDataInternal(LayerProperty property,
|
||||
int timeOut) throws VizException {
|
||||
if (adapter == null) {
|
||||
String scriptToExecute = ScriptCreator.createScript(property);
|
||||
return Loader
|
||||
.loadScripts(new String[] { scriptToExecute }, timeOut);
|
||||
} else {
|
||||
return adapter.getData(property, timeOut);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of responses for the requested layer property. If a
|
||||
* derived parameter, this will piece together the base parameteters.
|
||||
|
@ -432,31 +340,11 @@ public class DataCubeContainer {
|
|||
.getEntryQueryParameters(false);
|
||||
String pluginName = originalQuery.get("pluginName")
|
||||
.getConstraintValue();
|
||||
return getInstance(pluginName).getDataInternal(property, timeOut);
|
||||
}
|
||||
|
||||
private Object getInventoryInternal() {
|
||||
if (adapter != null) {
|
||||
return adapter.getInventory();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return getInstance(pluginName).adapter.getData(property, timeOut);
|
||||
}
|
||||
|
||||
public static Object getInventory(String plugin) {
|
||||
return getInstance(plugin).getInventoryInternal();
|
||||
}
|
||||
|
||||
private List<Map<String, RequestConstraint>> getBaseUpdateConstraintsInternal(
|
||||
Map<String, RequestConstraint> constraints) {
|
||||
if (adapter != null) {
|
||||
return adapter.getBaseUpdateConstraints(constraints);
|
||||
} else {
|
||||
List<Map<String, RequestConstraint>> result = new ArrayList<Map<String, RequestConstraint>>(
|
||||
1);
|
||||
result.add(constraints);
|
||||
return result;
|
||||
}
|
||||
return getInstance(plugin).adapter.getInventory();
|
||||
}
|
||||
|
||||
public static List<Map<String, RequestConstraint>> getBaseUpdateConstraints(
|
||||
|
@ -467,8 +355,8 @@ public class DataCubeContainer {
|
|||
&& pluginRC.getConstraintType() == ConstraintType.EQUALS) {
|
||||
plugin = pluginRC.getConstraintValue();
|
||||
}
|
||||
return getInstance(plugin)
|
||||
.getBaseUpdateConstraintsInternal(constraints);
|
||||
return getInstance(plugin).adapter
|
||||
.getBaseUpdateConstraints(constraints);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ public class DecisionTree<T> {
|
|||
}
|
||||
|
||||
protected List<DataPair> getDataPairs() {
|
||||
return dataPairs;
|
||||
return new ArrayList<DecisionTree<T>.DataPair>(dataPairs);
|
||||
}
|
||||
|
||||
private static double calcEntropy(int numExamples, Integer[] values) {
|
||||
|
|
|
@ -0,0 +1,239 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.datastructure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequestSet;
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.catalog.ScriptCreator;
|
||||
import com.raytheon.uf.viz.core.comm.Loader;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
/**
|
||||
* Default implementation of IDataCubeAdapter, function implementations were
|
||||
* moved from DataCubeContainer into here
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 7, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DefaultDataCubeAdapter implements IDataCubeAdapter {
|
||||
|
||||
private String pluginName;
|
||||
|
||||
public DefaultDataCubeAdapter(String pluginName) {
|
||||
this.pluginName = pluginName;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getSupportedPlugins
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public String[] getSupportedPlugins() {
|
||||
return new String[] { pluginName };
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#timeQuery(java
|
||||
* .util.List)
|
||||
*/
|
||||
@Override
|
||||
public List<List<DataTime>> timeQuery(List<TimeQueryRequest> requests)
|
||||
throws VizException {
|
||||
TimeQueryRequestSet set = new TimeQueryRequestSet();
|
||||
set.setRequests(requests.toArray(new TimeQueryRequest[0]));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<List<DataTime>> result = (List<List<DataTime>>) ThriftClient
|
||||
.sendRequest(set);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getPoints(java
|
||||
* .lang.String, java.lang.String[], java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public PointDataContainer getPoints(String plugin, String[] parameters,
|
||||
Map<String, RequestConstraint> queryParams) throws VizException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getPoints(java
|
||||
* .lang.String, java.lang.String[], java.lang.String, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public PointDataContainer getPoints(String plugin, String[] parameters,
|
||||
String levelKey, Map<String, RequestConstraint> queryParams)
|
||||
throws VizException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecord(com
|
||||
* .raytheon.uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
public IDataRecord[] getRecord(PluginDataObject obj)
|
||||
throws VizDataCubeException {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException("Error retrieving 2D data record.",
|
||||
e);
|
||||
}
|
||||
return new IDataRecord[] { record };
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecord(com
|
||||
* .raytheon.uf.common.dataplugin.PluginDataObject,
|
||||
* com.raytheon.uf.common.datastorage.Request, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public IDataRecord[] getRecord(PluginDataObject obj, Request req,
|
||||
String dataset) throws VizDataCubeException {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName, req, dataset);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException("Error retrieving 2D data record.",
|
||||
e);
|
||||
}
|
||||
return new IDataRecord[] { record };
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecords(java
|
||||
* .util.List, com.raytheon.uf.common.datastorage.Request, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void getRecords(List<PluginDataObject> objs, Request req,
|
||||
String dataset) throws VizDataCubeException {
|
||||
for (PluginDataObject obj : objs) {
|
||||
IDataRecord record = null;
|
||||
try {
|
||||
record = CubeUtil.retrieveData(obj, pluginName, req, dataset);
|
||||
} catch (VizException e) {
|
||||
throw new VizDataCubeException(
|
||||
"Error retrieving 2D grid record.", e);
|
||||
}
|
||||
obj.setMessageData(record);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getData(com.raytheon
|
||||
* .uf.viz.core.catalog.LayerProperty, int)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> getData(LayerProperty property, int timeOut)
|
||||
throws VizException {
|
||||
String scriptToExecute = ScriptCreator.createScript(property);
|
||||
return Loader.loadScripts(new String[] { scriptToExecute }, timeOut);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#initInventory()
|
||||
*/
|
||||
@Override
|
||||
public void initInventory() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getInventory()
|
||||
*/
|
||||
@Override
|
||||
public Object getInventory() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#
|
||||
* getBaseUpdateConstraints(java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, RequestConstraint>> getBaseUpdateConstraints(
|
||||
Map<String, RequestConstraint> constraints) {
|
||||
List<Map<String, RequestConstraint>> result = new ArrayList<Map<String, RequestConstraint>>(
|
||||
1);
|
||||
result.add(constraints);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
|
@ -145,16 +145,6 @@ public interface IDataCubeAdapter {
|
|||
public List<Object> getData(LayerProperty property, int timeOut)
|
||||
throws VizException;
|
||||
|
||||
/**
|
||||
* A simple method that will create a unique string based on the information
|
||||
* in the PluginDataObject passed in.
|
||||
*
|
||||
* @param pdo
|
||||
* The PDO to generate a unique name from
|
||||
* @return A string unique to that PDO
|
||||
*/
|
||||
public String recordKeyGenerator(PluginDataObject pdo);
|
||||
|
||||
/**
|
||||
* If the inventory for a particular data type is large (for example, Grib),
|
||||
* a call to this method should get a copy of that data type's inventory
|
||||
|
|
|
@ -31,7 +31,22 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridEnvelope;
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.GeneralEnvelope;
|
||||
import org.geotools.referencing.CRS;
|
||||
import org.geotools.referencing.operation.DefaultMathTransformFactory;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.crs.GeneralDerivedCRS;
|
||||
import org.opengis.referencing.datum.PixelInCell;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.serialization.adapters.GridGeometryAdapter;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -39,6 +54,7 @@ import com.raytheon.uf.common.time.DataTime;
|
|||
import com.raytheon.uf.viz.core.AbstractTimeMatcher;
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.uf.viz.core.IExtent;
|
||||
import com.raytheon.uf.viz.core.VizConstants;
|
||||
import com.raytheon.uf.viz.core.datastructure.LoopProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -111,6 +127,19 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
/** The frame coordination object */
|
||||
protected IFrameCoordinator frameCoordinator;
|
||||
|
||||
private MathTransform worldToPixel;
|
||||
|
||||
private MathTransform pixelToWorld;
|
||||
|
||||
/** The spatial grid for the descriptor */
|
||||
private GeneralGridGeometry gridGeometry;
|
||||
|
||||
public AbstractDescriptor(GeneralGridGeometry gridGeometry) {
|
||||
this();
|
||||
this.gridGeometry = gridGeometry;
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
@ -196,7 +225,8 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
protected void preAddListener(ResourcePair rp)
|
||||
throws WrongProjectionException {
|
||||
|
||||
AbstractVizResource resource = rp.getResource();
|
||||
AbstractVizResource<?, AbstractDescriptor> resource = (AbstractVizResource<?, AbstractDescriptor>) rp
|
||||
.getResource();
|
||||
|
||||
resource.setDescriptor(this);
|
||||
|
||||
|
@ -654,6 +684,119 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
return frameCoordinator;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
GeneralGridGeometry gridGeometry = getGridGeometry();
|
||||
MathTransform worldToCRS = getWorldToCRSTransform(gridGeometry);
|
||||
if (worldToCRS != null) {
|
||||
try {
|
||||
MathTransform crsToPixel = gridGeometry.getGridToCRS(
|
||||
PixelInCell.CELL_CENTER).inverse();
|
||||
worldToPixel = new DefaultMathTransformFactory()
|
||||
.createConcatenatedTransform(worldToCRS, crsToPixel);
|
||||
pixelToWorld = worldToPixel.inverse();
|
||||
} catch (Exception e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error setting up Math Transforms,"
|
||||
+ " this descriptor may not work properly", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IDescriptor#getCRS()
|
||||
*/
|
||||
@Override
|
||||
public final CoordinateReferenceSystem getCRS() {
|
||||
if (gridGeometry != null && gridGeometry.getEnvelope() != null) {
|
||||
return gridGeometry.getEnvelope().getCoordinateReferenceSystem();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IDescriptor#getGridGeometry()
|
||||
*/
|
||||
@Override
|
||||
@XmlElement
|
||||
@XmlJavaTypeAdapter(value = GridGeometryAdapter.class)
|
||||
public final GeneralGridGeometry getGridGeometry() {
|
||||
return gridGeometry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the grid geometry
|
||||
*
|
||||
* @param gridGeometry
|
||||
* the gridGeometry to set
|
||||
* @throws VizException
|
||||
*/
|
||||
public void setGridGeometry(GeneralGridGeometry gridGeometry)
|
||||
throws VizException {
|
||||
this.gridGeometry = gridGeometry;
|
||||
init();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor#pixelToWorld(double[])
|
||||
*/
|
||||
@Override
|
||||
public final double[] pixelToWorld(double[] pixel) {
|
||||
double[] output = new double[3];
|
||||
double[] wpixel = pixel;
|
||||
|
||||
if (pixel.length == 2) {
|
||||
wpixel = new double[] { pixel[0], pixel[1], 0 };
|
||||
}
|
||||
|
||||
if (pixelToWorld != null) {
|
||||
try {
|
||||
pixelToWorld.transform(wpixel, 0, output, 0, 1);
|
||||
} catch (TransformException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
System.arraycopy(wpixel, 0, output, 0, wpixel.length);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor#worldToPixel(double[])
|
||||
*/
|
||||
@Override
|
||||
public final double[] worldToPixel(double[] world) {
|
||||
double[] output = new double[3];
|
||||
double[] input = world;
|
||||
if (world.length == 2) {
|
||||
input = new double[] { world[0], world[1], 0 };
|
||||
}
|
||||
|
||||
if (worldToPixel != null) {
|
||||
try {
|
||||
worldToPixel.transform(input, 0, output, 0, 1);
|
||||
} catch (TransformException e) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
System.arraycopy(input, 0, output, 0, input.length);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -683,4 +826,40 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
|
|||
getFrameCoordinator().changeFrame(loopProperties);
|
||||
}
|
||||
|
||||
protected static GeneralGridGeometry createGridGeometry(IExtent extent,
|
||||
CoordinateReferenceSystem crs) {
|
||||
GeneralEnvelope envelope = new GeneralEnvelope(2);
|
||||
envelope.setRange(0, extent.getMinX(), extent.getMaxX());
|
||||
envelope.setRange(1, extent.getMinY(), extent.getMaxY());
|
||||
envelope.setCoordinateReferenceSystem(crs);
|
||||
return new GridGeometry2D(
|
||||
new GeneralGridEnvelope(new int[] { 0, 0 }, new int[] {
|
||||
(int) extent.getWidth(), (int) extent.getHeight() },
|
||||
false), envelope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the world to CRS transform used for {@link #worldToPixel(double[])}
|
||||
* and {@link #pixelToWorld(double[])}
|
||||
*
|
||||
* @param gridGeometry
|
||||
* @return The world to gridGeometry CRS transform or null if there is none
|
||||
*/
|
||||
public static MathTransform getWorldToCRSTransform(
|
||||
GeneralGridGeometry gridGeometry) {
|
||||
CoordinateReferenceSystem crs = gridGeometry.getEnvelope()
|
||||
.getCoordinateReferenceSystem();
|
||||
if (crs instanceof GeneralDerivedCRS) {
|
||||
GeneralDerivedCRS projCRS = (GeneralDerivedCRS) crs;
|
||||
CoordinateReferenceSystem worldCRS = projCRS.getBaseCRS();
|
||||
try {
|
||||
return CRS.findMathTransform(worldCRS, crs);
|
||||
} catch (FactoryException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error setting up Math Transforms,"
|
||||
+ " this descriptor may not work properly", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,8 +206,8 @@ public class ColorMapLoader {
|
|||
ColorMap cm = (ColorMap) SerializationUtil
|
||||
.jaxbUnmarshalFromXmlFile(colorMapFile.getFile()
|
||||
.getAbsolutePath());
|
||||
|
||||
cm.setName(name);
|
||||
cm.setChanged(false);
|
||||
return cm;
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
@ -22,6 +22,8 @@ package com.raytheon.uf.viz.core.drawables;
|
|||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.measure.converter.UnitConverter;
|
||||
import javax.measure.unit.Unit;
|
||||
|
@ -116,7 +118,7 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
|
|||
|
||||
}
|
||||
|
||||
protected IColorMapParametersListener listener;
|
||||
protected Set<IColorMapParametersListener> listeners = new HashSet<IColorMapParametersListener>();
|
||||
|
||||
/** Units of the colormap parameters (min/max) */
|
||||
protected Unit<?> displayUnit;
|
||||
|
@ -714,13 +716,19 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
|
|||
}
|
||||
|
||||
private void notifyListener() {
|
||||
if (listener != null) {
|
||||
for (IColorMapParametersListener listener : listeners) {
|
||||
listener.colorMapChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void setListener(IColorMapParametersListener listener) {
|
||||
this.listener = listener;
|
||||
public void addListener(IColorMapParametersListener listener) {
|
||||
if (listener != null) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeListener(IColorMapParametersListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
|
||||
public void setAlphaMask(byte[] alphaMask) {
|
||||
|
@ -741,8 +749,8 @@ public class ColorMapParameters implements Cloneable, ISerializableObject {
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (listener != null) {
|
||||
return listener.hashCode();
|
||||
if (listeners.size() > 0) {
|
||||
return listeners.hashCode();
|
||||
} else if (colorMap != null) {
|
||||
return colorMap.hashCode();
|
||||
} else {
|
||||
|
|
|
@ -20,6 +20,9 @@
|
|||
|
||||
package com.raytheon.uf.viz.core.drawables;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* Describes a generic Image resource. The IImage resource is an interface
|
||||
* handle to an image. The image resource manages the lifecycle of the
|
||||
|
@ -63,6 +66,11 @@ public interface IImage {
|
|||
UNLOADED, STAGED, LOADED, LOADING, FAILED, INVALID
|
||||
};
|
||||
|
||||
/**
|
||||
* Stages any data required for the image to load/draw
|
||||
*/
|
||||
public abstract void stage() throws VizException;
|
||||
|
||||
/**
|
||||
* @return the status
|
||||
*/
|
||||
|
@ -106,4 +114,10 @@ public interface IImage {
|
|||
*/
|
||||
public abstract void setContrast(float contrast);
|
||||
|
||||
/**
|
||||
* Gets the extension class for this image
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract Class<? extends IImagingExtension> getExtensionClass();
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.drawables;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget.RasterMode;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage.Status;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.TextureLoader;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* Support class for rendering images to a target
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 13, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ImagingSupport {
|
||||
|
||||
protected static final TextureLoader textureLoader = TextureLoader
|
||||
.getInstance();
|
||||
|
||||
/**
|
||||
* Prepares images for painting by staging and/or targeting the image
|
||||
*
|
||||
* @param target
|
||||
* @param images
|
||||
* @throws VizException
|
||||
*/
|
||||
public static void prepareImages(IGraphicsTarget target,
|
||||
DrawableImage... images) throws VizException {
|
||||
for (DrawableImage di : images) {
|
||||
IImage image = di.getImage();
|
||||
RasterMode mode = di.getMode();
|
||||
|
||||
if (image.getStatus() != Status.LOADED
|
||||
&& image.getStatus() != Status.STAGED) {
|
||||
if (mode == RasterMode.ASYNCHRONOUS) {
|
||||
textureLoader.requestLoad(image);
|
||||
target.setNeedsRefresh(true);
|
||||
} else if (mode == RasterMode.SYNCHRONOUS) {
|
||||
image.stage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Routes the images to be rendered by their proper extensions, expects
|
||||
* images have already been "prepared" (Status=STAGED)
|
||||
*
|
||||
* @param target
|
||||
* @param paintProps
|
||||
* @param images
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public static boolean routeImages(IGraphicsTarget target,
|
||||
PaintProperties paintProps, DrawableImage[] images)
|
||||
throws VizException {
|
||||
boolean rval = true;
|
||||
boolean skipped = false;
|
||||
List<DrawableImage> bulk = new ArrayList<DrawableImage>();
|
||||
Class<? extends IImagingExtension> lastExt = null;
|
||||
for (DrawableImage di : images) {
|
||||
IImage image = di.getImage();
|
||||
IImage.Status imageSts = image.getStatus();
|
||||
if (imageSts == IImage.Status.LOADED
|
||||
|| imageSts == IImage.Status.STAGED) {
|
||||
Class<? extends IImagingExtension> imageExt = image
|
||||
.getExtensionClass();
|
||||
if (imageExt.equals(lastExt) == false && bulk.size() > 0) {
|
||||
DrawableImage[] extImages = bulk
|
||||
.toArray(new DrawableImage[bulk.size()]);
|
||||
// Render what we have
|
||||
IImagingExtension impl = target.getExtension(lastExt);
|
||||
rval &= impl.drawRasters(paintProps, extImages);
|
||||
bulk.clear();
|
||||
}
|
||||
|
||||
bulk.add(di);
|
||||
lastExt = imageExt;
|
||||
} else {
|
||||
skipped = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (bulk.size() > 0) {
|
||||
// Render what is left
|
||||
IImagingExtension impl = target.getExtension(lastExt);
|
||||
rval &= impl.drawRasters(paintProps,
|
||||
bulk.toArray(new DrawableImage[bulk.size()]));
|
||||
}
|
||||
|
||||
return rval & skipped;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepares the images, then routes them for rendering
|
||||
*
|
||||
* @param paintProps
|
||||
* @param images
|
||||
* @return
|
||||
*/
|
||||
public static boolean drawRasters(IGraphicsTarget target,
|
||||
PaintProperties paintProps, DrawableImage[] images)
|
||||
throws VizException {
|
||||
prepareImages(target, images);
|
||||
return routeImages(target, paintProps, images);
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
package com.raytheon.uf.viz.core.drawables;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
public class SingleColorImage implements IImage {
|
||||
|
||||
private IImage image = null;
|
||||
|
||||
private RGB color = null;
|
||||
|
||||
public IImage getWrappedImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setWrappedImage(IImage image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public void setColor(RGB color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public RGB getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public SingleColorImage(IImage image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Status getStatus() {
|
||||
return image.getStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInterpolated(boolean isInterpolated) {
|
||||
image.setInterpolated(isInterpolated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
image.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return image.getWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return image.getHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBrightness(float brightness) {
|
||||
image.setBrightness(brightness);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContrast(float contrast) {
|
||||
image.setContrast(contrast);
|
||||
}
|
||||
|
||||
}
|
|
@ -40,15 +40,22 @@ import com.raytheon.uf.viz.core.IGraphicsTarget;
|
|||
*/
|
||||
public abstract class GraphicsExtension<T extends IGraphicsTarget> {
|
||||
|
||||
public static enum Compatibilty {
|
||||
INCOMPATIBLE(-1), GENERIC(0), TARGET_COMPATIBLE(1000), ENHANCED_TARGET_COMPATIBLE(
|
||||
2000);
|
||||
/**
|
||||
* Interface that other interfaces should extend if they want to be used as
|
||||
* a graphics extension
|
||||
*/
|
||||
public static interface IGraphicsExtensionInterface {
|
||||
|
||||
public int value;
|
||||
}
|
||||
|
||||
private Compatibilty(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
public static class Compatibilty {
|
||||
public static final int INCOMPATIBLE = -1;
|
||||
|
||||
public static final int GENERIC = 0;
|
||||
|
||||
public static final int TARGET_COMPATIBLE = 1000;
|
||||
|
||||
public static final int ENHANCED_TARGET_COMPATIBLE = 2000;
|
||||
}
|
||||
|
||||
protected T target;
|
||||
|
@ -69,12 +76,19 @@ public abstract class GraphicsExtension<T extends IGraphicsTarget> {
|
|||
public final int setTarget(IGraphicsTarget target) {
|
||||
try {
|
||||
this.target = (T) target;
|
||||
return getCompatibilityValue(this.target);
|
||||
} catch (ClassCastException e) {
|
||||
return Compatibilty.INCOMPATIBLE.value;
|
||||
this.target = null;
|
||||
return Compatibilty.INCOMPATIBLE;
|
||||
}
|
||||
return getCompatibilityValue(this.target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the target compability value.
|
||||
*
|
||||
* @param target
|
||||
* @return
|
||||
*/
|
||||
public abstract int getCompatibilityValue(T target);
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,7 @@ 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.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
public class GraphicsExtensionManager {
|
||||
|
@ -67,8 +68,8 @@ public class GraphicsExtensionManager {
|
|||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public synchronized <T> T getExtension(Class<T> extensionClass)
|
||||
throws VizException {
|
||||
public synchronized <T extends IGraphicsExtensionInterface> T getExtension(
|
||||
Class<T> extensionClass) throws VizException {
|
||||
if (cached.containsKey(extensionClass)) {
|
||||
return extensionClass.cast(cached.get(extensionClass));
|
||||
}
|
||||
|
@ -76,10 +77,14 @@ public class GraphicsExtensionManager {
|
|||
int bestVal = -1;
|
||||
for (Class<?> eClass : extensions) {
|
||||
if (extensionClass.isAssignableFrom(eClass)) {
|
||||
GraphicsExtension<?> graphicsExt;
|
||||
try {
|
||||
graphicsExt = GraphicsExtension.class.cast(eClass
|
||||
GraphicsExtension<?> graphicsExt = GraphicsExtension.class.cast(eClass
|
||||
.newInstance());
|
||||
int val = graphicsExt.setTarget(target);
|
||||
if (val > bestVal) {
|
||||
bestVal = val;
|
||||
bestExt = extensionClass.cast(graphicsExt);
|
||||
}
|
||||
} catch (InstantiationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
|
@ -89,11 +94,6 @@ public class GraphicsExtensionManager {
|
|||
e.getLocalizedMessage(), e);
|
||||
continue;
|
||||
}
|
||||
int val = graphicsExt.setTarget(target);
|
||||
if (val > bestVal) {
|
||||
bestVal = val;
|
||||
bestExt = extensionClass.cast(graphicsExt);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bestExt != null) {
|
||||
|
|
|
@ -17,24 +17,23 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.radar.gl.mosaic;
|
||||
package com.raytheon.uf.viz.core.drawables.ext;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.core.gl.IGLTarget;
|
||||
import com.raytheon.viz.core.gl.glsl.AbstractShaderLoader;
|
||||
import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Interface extensions that return IImage objects should implement
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 20, 2010 mschenke Initial creation
|
||||
* Dec 15, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -42,22 +41,17 @@ import com.raytheon.viz.core.gl.glsl.GLShaderProgram;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CompReflShaderLoader extends AbstractShaderLoader {
|
||||
public interface IImagingExtension extends IGraphicsExtensionInterface {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
/**
|
||||
* Draw the images passed in
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.core.gl.glsl.IShaderLoader#loadData(com.raytheon.viz
|
||||
* .core.gl.IGLTarget, com.raytheon.viz.core.gl.glsl.GLShaderProgram,
|
||||
* com.raytheon.uf.viz.core.drawables.IImage,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties)
|
||||
* @param paintProps
|
||||
* @param images
|
||||
* @return whether all images were drawn or not
|
||||
* @throws VizException
|
||||
*/
|
||||
@Override
|
||||
public void loadData(IGLTarget target, GLShaderProgram program,
|
||||
IImage image, PaintProperties paintProps) throws VizException {
|
||||
// load radar data to GL_TEXTURE0 (bound in drawRaster)
|
||||
program.setUniform("radarData", 0);
|
||||
}
|
||||
public boolean drawRasters(PaintProperties paintProps,
|
||||
DrawableImage... images) throws VizException;
|
||||
|
||||
}
|
|
@ -4,9 +4,11 @@ import java.nio.Buffer;
|
|||
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
public interface IOffscreenRenderingExtension {
|
||||
public interface IOffscreenRenderingExtension extends
|
||||
IGraphicsExtensionInterface {
|
||||
/**
|
||||
* All drawing between a call to renderOffscreen and the next call to
|
||||
* renderOnscreen will be drawn to offscreenImage rather than to the screen.
|
||||
|
|
|
@ -17,52 +17,49 @@
|
|||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.drawables.ext;
|
||||
|
||||
package com.raytheon.viz.core.gl.glsl;
|
||||
import java.awt.image.RenderedImage;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* Define common interface for vertex and fragement shaders.
|
||||
* Extension for creating images that should be mapped to a single color
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
*
|
||||
* Dec 15, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author estrabal
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.core.gl.IGLTarget;
|
||||
public interface ISingleColorImageExtension extends IImagingExtension {
|
||||
|
||||
public interface IShaderLoader {
|
||||
public static interface ISingleColorImage extends IImage {
|
||||
|
||||
public void setColor(RGB color);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an ISingleColorImage image that maps the image passed into to
|
||||
* the single color value
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public abstract String getName();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public abstract void setName(String name);
|
||||
|
||||
/**
|
||||
* load shader variables using IImage and PaintProperties
|
||||
*
|
||||
* @param target
|
||||
* @param program
|
||||
* @param image
|
||||
* @param paintProps
|
||||
* @param color
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public abstract void loadData(IGLTarget target, GLShaderProgram program,
|
||||
IImage image, PaintProperties paintProps) throws VizException;
|
||||
public ISingleColorImage constructImage(RenderedImage image, RGB color);
|
||||
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
|
||||
package com.raytheon.uf.viz.core.drawables.ext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.ui.services.IDisposable;
|
||||
|
||||
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.Activator;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.jobs.JobPool;
|
||||
|
||||
/**
|
||||
* Class that loads data for AbstractGLImages asynchronously
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 7/1/06 chammack Initial Creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
*
|
||||
*/
|
||||
public class TextureLoader {
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(TextureLoader.class);
|
||||
|
||||
/** The instance */
|
||||
private static TextureLoader instance;
|
||||
|
||||
private JobPool loaderPool;
|
||||
|
||||
private List<IImage> texturesToLoad;
|
||||
|
||||
/**
|
||||
* Get the currently running instance of the texture loader
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static synchronized TextureLoader getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new TextureLoader();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use getInstance() instead of constructor
|
||||
*
|
||||
*/
|
||||
private TextureLoader() {
|
||||
this.texturesToLoad = new ArrayList<IImage>();
|
||||
this.loaderPool = new JobPool("Texture Loader", Runtime.getRuntime()
|
||||
.availableProcessors(), true);
|
||||
// Make sure we get shutdown properly
|
||||
Activator.getDefault().registerDisposable(new IDisposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
shutdown();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Request an image to be loaded
|
||||
*
|
||||
* @param img
|
||||
* the image
|
||||
*/
|
||||
public void requestLoad(final IImage img) {
|
||||
if (!texturesToLoad.contains(img)) {
|
||||
texturesToLoad.add(img);
|
||||
loaderPool.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
try {
|
||||
img.stage();
|
||||
} catch (Throwable t) {
|
||||
statusHandler.handle(
|
||||
Priority.PROBLEM,
|
||||
"Error staging texture: "
|
||||
+ t.getLocalizedMessage(), t);
|
||||
}
|
||||
} finally {
|
||||
texturesToLoad.remove(img);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Request the job to be shut down
|
||||
*
|
||||
*/
|
||||
public void shutdown() {
|
||||
loaderPool.cancel();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,240 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.drawables.ext.colormap;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapData;
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.data.prep.Colormapper;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IColorMapParametersListener;
|
||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* General colormapped image, regenerates image if parameters change
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 16, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ColormappedImage implements IColormappedImage,
|
||||
IRenderedImageCallback, IColorMapParametersListener {
|
||||
|
||||
private IImage image;
|
||||
|
||||
private IColorMapDataRetrievalCallback callback;
|
||||
|
||||
private ColorMapParameters parameters;
|
||||
|
||||
public ColormappedImage(IGraphicsTarget target,
|
||||
IColorMapDataRetrievalCallback callback,
|
||||
ColorMapParameters parameters) {
|
||||
this.callback = callback;
|
||||
setColorMapParameters(parameters);
|
||||
image = target.initializeRaster(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the wrapped image for the colormapped image
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IImage getWrappedImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#getStatus()
|
||||
*/
|
||||
@Override
|
||||
public Status getStatus() {
|
||||
return image.getStatus();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#setInterpolated(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setInterpolated(boolean isInterpolated) {
|
||||
image.setInterpolated(isInterpolated);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (image != null) {
|
||||
image.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#getWidth()
|
||||
*/
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return image.getWidth();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#getHeight()
|
||||
*/
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return image.getHeight();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#setBrightness(float)
|
||||
*/
|
||||
@Override
|
||||
public void setBrightness(float brightness) {
|
||||
image.setBrightness(brightness);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#setContrast(float)
|
||||
*/
|
||||
@Override
|
||||
public void setContrast(float contrast) {
|
||||
image.setContrast(contrast);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#getExtensionClass()
|
||||
*/
|
||||
@Override
|
||||
public Class<? extends IImagingExtension> getExtensionClass() {
|
||||
return GeneralColormappedImageExtension.class;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IColormappedImage#getColorMapParameters
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public ColorMapParameters getColorMapParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IColormappedImage#setColorMapParameters
|
||||
* (com.raytheon.uf.viz.core.drawables.ColorMapParameters)
|
||||
*/
|
||||
@Override
|
||||
public void setColorMapParameters(ColorMapParameters params) {
|
||||
if (params != this.parameters) {
|
||||
if (this.parameters != null) {
|
||||
this.parameters.removeListener(this);
|
||||
}
|
||||
this.parameters = params;
|
||||
if (this.parameters != null) {
|
||||
this.parameters.addListener(this);
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IColormappedImage#getValue(int,
|
||||
* int)
|
||||
*/
|
||||
@Override
|
||||
public double getValue(int x, int y) {
|
||||
return Double.NaN;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.data.IRenderedImageCallback#getImage()
|
||||
*/
|
||||
@Override
|
||||
public RenderedImage getImage() throws VizException {
|
||||
if (parameters == null || parameters.getColorMap() == null) {
|
||||
return null;
|
||||
}
|
||||
ColorMapData colorMapData = callback.getColorMapData();
|
||||
return Colormapper.colorMap(colorMapData, parameters);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IColorMapParametersListener#
|
||||
* colorMapChanged()
|
||||
*/
|
||||
@Override
|
||||
public void colorMapChanged() {
|
||||
dispose();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.drawables.IImage#stage()
|
||||
*/
|
||||
@Override
|
||||
public void stage() throws VizException {
|
||||
image.stage();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.drawables.ext.colormap;
|
||||
|
||||
import java.awt.image.RenderedImage;
|
||||
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapData;
|
||||
import com.raytheon.uf.viz.core.data.IRenderedImageCallback;
|
||||
import com.raytheon.uf.viz.core.data.prep.Colormapper;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* General {@link IRenderedImageCallback} that takes a
|
||||
* {@link IColorMapDataRetrievalCallback} and {@link ColorMapParameters} and
|
||||
* will colormap the data returned from the callback into a
|
||||
* {@link RenderedImage}
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 22, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class ColormappedRenderedImageCallback implements IRenderedImageCallback {
|
||||
|
||||
private IColorMapDataRetrievalCallback callback;
|
||||
|
||||
private ColorMapParameters parameters;
|
||||
|
||||
/**
|
||||
* Construct a ColormappedRenderedImageCallback for the colormap data
|
||||
* callback and parameters
|
||||
*
|
||||
* @param dataCallback
|
||||
* @param parameters
|
||||
*/
|
||||
public ColormappedRenderedImageCallback(
|
||||
IColorMapDataRetrievalCallback dataCallback,
|
||||
ColorMapParameters parameters) {
|
||||
this.callback = dataCallback;
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.data.IRenderedImageCallback#getImage()
|
||||
*/
|
||||
@Override
|
||||
public RenderedImage getImage() throws VizException {
|
||||
ColorMapData colorMapData = callback.getColorMapData();
|
||||
return Colormapper.colorMap(colorMapData, parameters);
|
||||
}
|
||||
}
|
|
@ -19,11 +19,17 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.core.drawables.ext.colormap;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.core.DrawableImage;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
* General colormapped image extension. Uses
|
||||
|
@ -56,10 +62,10 @@ public class GeneralColormappedImageExtension extends
|
|||
* com.raytheon.uf.viz.core.drawables.ColorMapParameters)
|
||||
*/
|
||||
@Override
|
||||
public IImage initializeRaster(IColorMapDataRetrievalCallback dataCallback,
|
||||
public IColormappedImage initializeRaster(
|
||||
IColorMapDataRetrievalCallback dataCallback,
|
||||
ColorMapParameters colorMapParameters) {
|
||||
return target.initializeRaster(new ColormappedRenderedImageCallback(
|
||||
dataCallback, colorMapParameters));
|
||||
return new ColormappedImage(target, dataCallback, colorMapParameters);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -70,7 +76,29 @@ public class GeneralColormappedImageExtension extends
|
|||
*/
|
||||
@Override
|
||||
public int getCompatibilityValue(IGraphicsTarget target) {
|
||||
return Compatibilty.GENERIC.value;
|
||||
return Compatibilty.GENERIC;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.ext.IImagingExtension#drawRasters(
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties,
|
||||
* com.raytheon.uf.viz.core.DrawableImage[])
|
||||
*/
|
||||
@Override
|
||||
public boolean drawRasters(PaintProperties paintProps,
|
||||
DrawableImage... images) throws VizException {
|
||||
List<DrawableImage> renderables = new ArrayList<DrawableImage>();
|
||||
for (DrawableImage di : images) {
|
||||
if (di.getImage() instanceof ColormappedImage) {
|
||||
renderables.add(new DrawableImage(((ColormappedImage) di
|
||||
.getImage()).getWrappedImage(), di.getCoverage()));
|
||||
}
|
||||
}
|
||||
return target.drawRasters(paintProps,
|
||||
renderables.toArray(new DrawableImage[renderables.size()]));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import org.eclipse.swt.graphics.RGB;
|
|||
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IShadedShape;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
|
@ -53,7 +54,8 @@ import com.vividsolutions.jts.geom.LineString;
|
|||
* @author bsteffen
|
||||
* @version 1.0
|
||||
*/
|
||||
public interface IColormapShadedShapeExtension {
|
||||
public interface IColormapShadedShapeExtension extends
|
||||
IGraphicsExtensionInterface {
|
||||
|
||||
public interface IColormapShadedShape {
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ package com.raytheon.uf.viz.core.drawables.ext.colormap;
|
|||
import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback;
|
||||
import com.raytheon.uf.viz.core.drawables.ColorMapParameters;
|
||||
import com.raytheon.uf.viz.core.drawables.IColormappedImage;
|
||||
import com.raytheon.uf.viz.core.drawables.IImage;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.IImagingExtension;
|
||||
|
||||
/**
|
||||
* Extension for creating {@link IColormappedImage} objects
|
||||
|
@ -41,7 +41,7 @@ import com.raytheon.uf.viz.core.drawables.IImage;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IColormappedImageExtension {
|
||||
public interface IColormappedImageExtension extends IImagingExtension {
|
||||
|
||||
/**
|
||||
* Initializes an IColormappedImage given the dataCallback and colormap
|
||||
|
@ -51,6 +51,7 @@ public interface IColormappedImageExtension {
|
|||
* @param colorMapParameters
|
||||
* @return
|
||||
*/
|
||||
public IImage initializeRaster(IColorMapDataRetrievalCallback dataCallback,
|
||||
public IColormappedImage initializeRaster(
|
||||
IColorMapDataRetrievalCallback dataCallback,
|
||||
ColorMapParameters colorMapParameters);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.eclipse.core.runtime.jobs.Job;
|
|||
* if you have dozens or hundreds of tasks that each take a short time. Creating
|
||||
* a job for each task can result in more threads than is useful. If you instead
|
||||
* use a JobPool it reduces the number of threads by limiting the number of
|
||||
* eclipse jobs that are created. For many tasks a JobPool may perform faster
|
||||
* eclipse jobs tBhat are created. For many tasks a JobPool may perform faster
|
||||
* than using eclipse Jobs directly because thread creation and context
|
||||
* switching are reduced.
|
||||
*
|
||||
|
@ -113,6 +113,18 @@ public class JobPool {
|
|||
join();
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels the specified runnable. Returns true if the provided runnable was
|
||||
* waiting to be run but now is now. Returns false if the provided runnable
|
||||
* is already running or if it was not enqueued to begin with.
|
||||
*
|
||||
* @param runnable
|
||||
* @return
|
||||
*/
|
||||
public synchronized boolean cancel(Runnable runnable) {
|
||||
return workQueue.remove(runnable);
|
||||
}
|
||||
|
||||
protected class PooledJob extends Job {
|
||||
|
||||
public PooledJob(String name) {
|
||||
|
|
|
@ -27,13 +27,13 @@ import javax.xml.bind.annotation.XmlAccessorType;
|
|||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||
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.Activator;
|
||||
import com.raytheon.uf.viz.core.status.StatusConstants;
|
||||
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||
|
||||
/**
|
||||
* Class defines a database level
|
||||
|
@ -55,7 +55,9 @@ import com.raytheon.uf.viz.core.status.StatusConstants;
|
|||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement
|
||||
public class DatabaseLevelMapping {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(DatabaseLevelMapping.class);
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(DatabaseLevelMapping.class);
|
||||
|
||||
@XmlAttribute
|
||||
private String levelName = null;
|
||||
|
||||
|
@ -100,7 +102,7 @@ public class DatabaseLevelMapping {
|
|||
this.unit = unit;
|
||||
}
|
||||
|
||||
public List<Level> getLevels() {
|
||||
public List<Level> getLevels() throws VizCommunicationException {
|
||||
String[] levelOneValues = new String[0];
|
||||
String[] levelTwoValues = new String[0];
|
||||
|
||||
|
@ -143,12 +145,16 @@ public class DatabaseLevelMapping {
|
|||
}
|
||||
|
||||
// handle any aliasing etc
|
||||
Level level = LevelFactory.getInstance().getLevel(levelName, lvl1,
|
||||
lvl2, unit);
|
||||
|
||||
if (level != null) {
|
||||
rval.add(level);
|
||||
try {
|
||||
Level level = LevelFactory.getInstance().getLevel(levelName,
|
||||
lvl1, lvl2, unit);
|
||||
if (level != null) {
|
||||
rval.add(level);
|
||||
}
|
||||
} catch (CommunicationException e) {
|
||||
throw new VizCommunicationException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return rval;
|
||||
|
|
|
@ -31,6 +31,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||
|
||||
/**
|
||||
* Class defines a mapping from a display level to one or more database levels.
|
||||
|
@ -38,14 +39,14 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
|
|||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 11/01/2007 #518 S.Manoj Initial version
|
||||
* 11/16/2009 #3120 rjpeter Modifed to better integrate with level framework.
|
||||
* 11/21/2009 #3576 rjpeter Added group
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 11/01/2007 #518 S.Manoj Initial version
|
||||
* 11/16/2009 #3120 rjpeter Modifed to better integrate with level framework.
|
||||
* 11/21/2009 #3576 rjpeter Added group
|
||||
*
|
||||
* @author smanoj
|
||||
* @version 1.0
|
||||
*/
|
||||
|
@ -118,12 +119,13 @@ public class LevelMapping implements ISerializableObject {
|
|||
this.databaseLevels = databaseLevels;
|
||||
}
|
||||
|
||||
public List<Level> getLevels() {
|
||||
public List<Level> getLevels() throws VizCommunicationException {
|
||||
if (levelList == null) {
|
||||
levelList = new ArrayList<Level>();
|
||||
List<Level> levelList = new ArrayList<Level>();
|
||||
for (DatabaseLevelMapping mapping : databaseLevels) {
|
||||
levelList.addAll(mapping.getLevels());
|
||||
}
|
||||
this.levelList = levelList;
|
||||
}
|
||||
|
||||
return levelList;
|
||||
|
|
|
@ -35,6 +35,7 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||
|
||||
/**
|
||||
* Factory for getting level mappings
|
||||
|
@ -56,15 +57,22 @@ public class LevelMappingFactory {
|
|||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(LevelMappingFactory.class);
|
||||
|
||||
private static LevelMappingFactory instance = new LevelMappingFactory();
|
||||
private static LevelMappingFactory instance = null;
|
||||
|
||||
private Map<String, LevelMapping> keyToLevelMappings = new HashMap<String, LevelMapping>();
|
||||
|
||||
private boolean levelToLevelMappingsInitialized = false;
|
||||
|
||||
private Map<Level, LevelMapping> levelToLevelMappings = new HashMap<Level, LevelMapping>();
|
||||
|
||||
private boolean groupToMasterLevelsInitialized = false;
|
||||
|
||||
private Map<String, Map<MasterLevel, Set<Level>>> groupToMasterLevels = new HashMap<String, Map<MasterLevel, Set<Level>>>();
|
||||
|
||||
public static LevelMappingFactory getInstance() {
|
||||
public synchronized static LevelMappingFactory getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new LevelMappingFactory();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -96,47 +104,6 @@ public class LevelMappingFactory {
|
|||
}
|
||||
}
|
||||
|
||||
for (LevelMapping mapping : keyToLevelMappings.values()) {
|
||||
String group = mapping.getGroup();
|
||||
Map<MasterLevel, Set<Level>> masterLevels = null;
|
||||
|
||||
if (group != null) {
|
||||
masterLevels = groupToMasterLevels.get(mapping.getGroup());
|
||||
if (masterLevels == null) {
|
||||
masterLevels = new HashMap<MasterLevel, Set<Level>>();
|
||||
groupToMasterLevels.put(group, masterLevels);
|
||||
}
|
||||
}
|
||||
|
||||
for (Level l : mapping.getLevels()) {
|
||||
if (levelToLevelMappings.containsKey(l)) {
|
||||
LevelMapping oldMapping = levelToLevelMappings.get(l);
|
||||
// Only replace the old level mapping if we have less
|
||||
// levels than the old mapping
|
||||
// This should cause the most specific mapping to be
|
||||
// used
|
||||
if (mapping.getLevels().size() < oldMapping.getLevels()
|
||||
.size()) {
|
||||
levelToLevelMappings.put(l, mapping);
|
||||
}
|
||||
} else {
|
||||
levelToLevelMappings.put(l, mapping);
|
||||
}
|
||||
|
||||
// populate grouping map
|
||||
if (masterLevels != null) {
|
||||
MasterLevel ml = l.getMasterLevel();
|
||||
Set<Level> levels = masterLevels.get(ml);
|
||||
|
||||
if (levels == null) {
|
||||
levels = new HashSet<Level>();
|
||||
masterLevels.put(ml, levels);
|
||||
}
|
||||
|
||||
levels.add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
long finish = System.currentTimeMillis();
|
||||
System.out.println("LevelMappingFactory initialization took ["
|
||||
|
@ -147,7 +114,11 @@ public class LevelMappingFactory {
|
|||
return keyToLevelMappings.get(key);
|
||||
}
|
||||
|
||||
public LevelMapping getLevelMappingForLevel(Level level) {
|
||||
public LevelMapping getLevelMappingForLevel(Level level)
|
||||
throws VizCommunicationException {
|
||||
if (!levelToLevelMappingsInitialized) {
|
||||
initializeLevelToLevelMappings();
|
||||
}
|
||||
return levelToLevelMappings.get(level);
|
||||
}
|
||||
|
||||
|
@ -155,11 +126,75 @@ public class LevelMappingFactory {
|
|||
return keyToLevelMappings.values();
|
||||
}
|
||||
|
||||
public Set<Level> getAllLevels() {
|
||||
public Set<Level> getAllLevels() throws VizCommunicationException {
|
||||
if (!levelToLevelMappingsInitialized) {
|
||||
initializeLevelToLevelMappings();
|
||||
}
|
||||
return levelToLevelMappings.keySet();
|
||||
}
|
||||
|
||||
public Map<MasterLevel, Set<Level>> getLevelMapForGroup(String group) {
|
||||
public Map<MasterLevel, Set<Level>> getLevelMapForGroup(String group)
|
||||
throws VizCommunicationException {
|
||||
if (!groupToMasterLevelsInitialized) {
|
||||
initializeGroupToMasterLevels();
|
||||
}
|
||||
return groupToMasterLevels.get(group);
|
||||
}
|
||||
|
||||
private void initializeLevelToLevelMappings()
|
||||
throws VizCommunicationException {
|
||||
for (LevelMapping mapping : keyToLevelMappings.values()) {
|
||||
String group = mapping.getGroup();
|
||||
|
||||
for (Level l : mapping.getLevels()) {
|
||||
if (levelToLevelMappings.containsKey(l)) {
|
||||
LevelMapping oldMapping = levelToLevelMappings.get(l);
|
||||
// Only replace the old level mapping if we have less
|
||||
// levels than the old mapping
|
||||
// This should cause the most specific mapping to be
|
||||
// used
|
||||
if (mapping.getLevels().size() < oldMapping.getLevels()
|
||||
.size()) {
|
||||
levelToLevelMappings.put(l, mapping);
|
||||
}
|
||||
} else {
|
||||
levelToLevelMappings.put(l, mapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
levelToLevelMappingsInitialized = true;
|
||||
}
|
||||
|
||||
private void initializeGroupToMasterLevels()
|
||||
throws VizCommunicationException {
|
||||
for (LevelMapping mapping : keyToLevelMappings.values()) {
|
||||
String group = mapping.getGroup();
|
||||
Map<MasterLevel, Set<Level>> masterLevels = null;
|
||||
|
||||
if (group != null) {
|
||||
masterLevels = groupToMasterLevels.get(mapping.getGroup());
|
||||
if (masterLevels == null) {
|
||||
masterLevels = new HashMap<MasterLevel, Set<Level>>();
|
||||
groupToMasterLevels.put(group, masterLevels);
|
||||
}
|
||||
}
|
||||
|
||||
for (Level l : mapping.getLevels()) {
|
||||
|
||||
// populate grouping map
|
||||
if (masterLevels != null) {
|
||||
MasterLevel ml = l.getMasterLevel();
|
||||
Set<Level> levels = masterLevels.get(ml);
|
||||
|
||||
if (levels == null) {
|
||||
levels = new HashSet<Level>();
|
||||
masterLevels.put(ml, levels);
|
||||
}
|
||||
|
||||
levels.add(l);
|
||||
}
|
||||
}
|
||||
}
|
||||
groupToMasterLevelsInitialized = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.core.level;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataplugin.level.LevelContainer;
|
||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||
|
@ -37,6 +38,7 @@ import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
|
||||
|
@ -45,11 +47,14 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
|||
.getHandler(LevelRetrievalAdapter.class);
|
||||
|
||||
@Override
|
||||
public Level getLevel(GetLevelRequest request) {
|
||||
public Level getLevel(GetLevelRequest request)
|
||||
throws CommunicationException {
|
||||
Level rval = null;
|
||||
|
||||
try {
|
||||
rval = (Level) ThriftClient.sendRequest(request);
|
||||
} catch (VizCommunicationException e) {
|
||||
throw new CommunicationException(e);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred retrieving level information from server.",
|
||||
|
@ -60,11 +65,14 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Level getLevel(GetLevelByIdRequest request) {
|
||||
public Level getLevel(GetLevelByIdRequest request)
|
||||
throws CommunicationException {
|
||||
Level rval = null;
|
||||
|
||||
try {
|
||||
rval = (Level) ThriftClient.sendRequest(request);
|
||||
} catch (VizCommunicationException e) {
|
||||
throw new CommunicationException(e);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred retrieving level information from server.",
|
||||
|
@ -75,10 +83,13 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MasterLevel getMasterLevel(GetMasterLevelRequest request) {
|
||||
public MasterLevel getMasterLevel(GetMasterLevelRequest request)
|
||||
throws CommunicationException {
|
||||
MasterLevel rval = null;
|
||||
try {
|
||||
rval = (MasterLevel) ThriftClient.sendRequest(request);
|
||||
} catch (VizCommunicationException e) {
|
||||
throw new CommunicationException(e);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred retrieving level information from server.",
|
||||
|
@ -89,10 +100,13 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
|||
|
||||
@Override
|
||||
public LevelContainer getAllLevelsForMasterLevel(
|
||||
GetAllLevelsForMasterLevelRequest request) {
|
||||
GetAllLevelsForMasterLevelRequest request)
|
||||
throws CommunicationException {
|
||||
LevelContainer rval = null;
|
||||
try {
|
||||
rval = (LevelContainer) ThriftClient.sendRequest(request);
|
||||
} catch (VizCommunicationException e) {
|
||||
throw new CommunicationException(e);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred retrieving level information from server.",
|
||||
|
@ -102,7 +116,7 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LevelContainer getAllLevels() {
|
||||
public LevelContainer getAllLevels() throws CommunicationException {
|
||||
LevelContainer rval = null;
|
||||
DbQueryRequest query = new DbQueryRequest();
|
||||
query.setConstraints(new HashMap<String, RequestConstraint>());
|
||||
|
@ -114,6 +128,8 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
|||
for (Map<String, Object> result : resp.getResults()) {
|
||||
rval.add((Level) result.get(null));
|
||||
}
|
||||
} catch (VizCommunicationException e) {
|
||||
throw new CommunicationException(e);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error occurred retrieving level information from server.",
|
||||
|
@ -123,7 +139,8 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public MasterLevelContainer getAllMasterLevels() {
|
||||
public MasterLevelContainer getAllMasterLevels()
|
||||
throws CommunicationException {
|
||||
MasterLevelContainer rval = null;
|
||||
DbQueryRequest query = new DbQueryRequest();
|
||||
query.setConstraints(new HashMap<String, RequestConstraint>());
|
||||
|
@ -135,6 +152,8 @@ public class LevelRetrievalAdapter implements ILevelRetrievalAdapter {
|
|||
for (Map<String, Object> result : resp.getResults()) {
|
||||
rval.add((MasterLevel) result.get(null));
|
||||
}
|
||||
} catch (VizCommunicationException e) {
|
||||
throw new CommunicationException(e);
|
||||
} catch (VizException e) {
|
||||
statusHandler
|
||||
.handle(Priority.PROBLEM,
|
||||
|
|
|
@ -29,10 +29,12 @@ import java.util.TreeSet;
|
|||
import javax.measure.unit.Unit;
|
||||
import javax.measure.unit.UnitFormat;
|
||||
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.dataplugin.level.CompareType;
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||
|
||||
/**
|
||||
* Level utilities
|
||||
|
@ -62,14 +64,24 @@ public class LevelUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean isPressureLevel(long levelId) {
|
||||
return isPressureLevel(LevelFactory.getInstance().getLevel(levelId)
|
||||
.getMasterLevel());
|
||||
public static boolean isPressureLevel(long levelId)
|
||||
throws VizCommunicationException {
|
||||
try {
|
||||
return isPressureLevel(LevelFactory.getInstance().getLevel(levelId)
|
||||
.getMasterLevel());
|
||||
} catch (CommunicationException e) {
|
||||
throw new VizCommunicationException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPressureLevel(String masterLevelName) {
|
||||
return isPressureLevel(LevelFactory.getInstance().getMasterLevel(
|
||||
masterLevelName));
|
||||
public static boolean isPressureLevel(String masterLevelName)
|
||||
throws VizCommunicationException {
|
||||
try {
|
||||
return isPressureLevel(LevelFactory.getInstance().getMasterLevel(
|
||||
masterLevelName));
|
||||
} catch (CommunicationException e) {
|
||||
throw new VizCommunicationException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isPressureLevel(Level level) {
|
||||
|
@ -89,9 +101,10 @@ public class LevelUtilities {
|
|||
*
|
||||
* @param masterLevelName
|
||||
* @return
|
||||
* @throws CommunicationException
|
||||
*/
|
||||
public synchronized static NavigableSet<Level> getOrderedSetOfStandardLevels(
|
||||
String masterLevelName) {
|
||||
String masterLevelName) throws VizCommunicationException {
|
||||
if (masterLevelToOrderedSet == null) {
|
||||
Comparator<Level> levelComparator = new Comparator<Level>() {
|
||||
|
||||
|
@ -108,7 +121,7 @@ public class LevelUtilities {
|
|||
}
|
||||
|
||||
};
|
||||
masterLevelToOrderedSet = new HashMap<String, NavigableSet<Level>>();
|
||||
Map<String, NavigableSet<Level>> masterLevelToOrderedSet = new HashMap<String, NavigableSet<Level>>();
|
||||
for (Level level : LevelMappingFactory.getInstance().getAllLevels()) {
|
||||
NavigableSet<Level> levels = masterLevelToOrderedSet.get(level
|
||||
.getMasterLevel().getName());
|
||||
|
@ -118,12 +131,18 @@ public class LevelUtilities {
|
|||
.getName(), levels);
|
||||
}
|
||||
if (level.isRangeLevel()) {
|
||||
levels.add(level.getUpperLevel());
|
||||
levels.add(level.getLowerLevel());
|
||||
|
||||
try {
|
||||
levels.add(level.getUpperLevel());
|
||||
levels.add(level.getLowerLevel());
|
||||
} catch (CommunicationException e) {
|
||||
throw new VizCommunicationException(e);
|
||||
}
|
||||
} else {
|
||||
levels.add(level);
|
||||
}
|
||||
}
|
||||
LevelUtilities.masterLevelToOrderedSet = masterLevelToOrderedSet;
|
||||
}
|
||||
return masterLevelToOrderedSet.get(masterLevelName);
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public class BundleScanner {
|
|||
String pathToLookFor, Map<String, Bundle> toSearch) {
|
||||
File file = null;
|
||||
Bundle b = toSearch.get(bundleToSearch);
|
||||
if (b != null) {
|
||||
if (b != null && b.getState() != Bundle.UNINSTALLED) {
|
||||
URL url = FileLocator.find(b, new Path(basePath + File.separator
|
||||
+ pathToLookFor), null);
|
||||
if (url != null) {
|
||||
|
|
|
@ -19,7 +19,12 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.core.map;
|
||||
|
||||
import org.geotools.coverage.grid.GeneralGridGeometry;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
|
||||
import com.raytheon.uf.viz.core.IMesh;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.ext.GraphicsExtension.IGraphicsExtensionInterface;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
||||
/**
|
||||
|
@ -39,17 +44,31 @@ import com.raytheon.uf.viz.core.exception.VizException;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IMapMeshExtension {
|
||||
public interface IMapMeshExtension extends IGraphicsExtensionInterface {
|
||||
|
||||
/**
|
||||
* Create a mesh
|
||||
*
|
||||
* @param descriptor
|
||||
* Constructs a mesh for mapping the imageGeometry onto the targetGeometry
|
||||
*
|
||||
* @param imageGeometry
|
||||
* @param targetGeometry
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public abstract IMesh constructMesh(IMapDescriptor descriptor)
|
||||
throws VizException;
|
||||
public abstract IMesh constructMesh(GridGeometry2D imageGeometry,
|
||||
GeneralGridGeometry targetGeometry) throws VizException;
|
||||
|
||||
/**
|
||||
* Convenient method for constructing a mesh for mapping the imageGeometry
|
||||
* onto the targetDescriptor. Same as calling
|
||||
* {@link #constructMesh(GridGeometry2D, GeneralGridGeometry)} passing in
|
||||
* target.getGridGeometry()
|
||||
*
|
||||
* @param imageGeometry
|
||||
* @param targetDescriptor
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
public abstract IMesh constructMesh(GridGeometry2D imageGeometry,
|
||||
IDescriptor targetDescriptor) throws VizException;
|
||||
|
||||
}
|
||||
|
|
|
@ -26,9 +26,7 @@ import java.util.ArrayList;
|
|||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.geotools.coverage.grid.GeneralGridEnvelope;
|
||||
|
@ -36,23 +34,16 @@ import org.geotools.coverage.grid.GeneralGridGeometry;
|
|||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.DirectPosition2D;
|
||||
import org.geotools.geometry.GeneralEnvelope;
|
||||
import org.geotools.referencing.CRS;
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
import org.geotools.referencing.crs.DefaultGeocentricCRS;
|
||||
import org.geotools.referencing.crs.DefaultGeographicCRS;
|
||||
import org.geotools.referencing.operation.DefaultMathTransformFactory;
|
||||
import org.opengis.geometry.DirectPosition;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.datum.PixelInCell;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
import org.opengis.referencing.operation.MathTransformFactory;
|
||||
import org.opengis.referencing.operation.TransformException;
|
||||
|
||||
import com.raytheon.uf.common.geospatial.CRSCache;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.adapters.GridGeometryAdapter;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
|
@ -196,24 +187,12 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
return gridGeom;
|
||||
}
|
||||
|
||||
/** The transform from lat/lon to the current CRS */
|
||||
protected MathTransform coordinateTransform;
|
||||
|
||||
/** The transform from the current CRS to lat/lon */
|
||||
protected MathTransform inverseCoordinateTransform;
|
||||
|
||||
/** The mapping from grid to coordinate */
|
||||
protected MathTransform mapToCoordinateTransform;
|
||||
|
||||
/** The mapping from coordinate to grid */
|
||||
protected MathTransform coordinateToMapTransform;
|
||||
|
||||
/** The mapping from wgs84 to grid */
|
||||
protected MathTransform wgsToGridTransform;
|
||||
|
||||
/** The mapping from grid to wgs84 */
|
||||
protected MathTransform gridToWGSTransform;
|
||||
|
||||
/** The time in ms that the last blink state was used */
|
||||
protected long timeLastBlink;
|
||||
|
||||
|
@ -229,9 +208,6 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
*/
|
||||
protected int mapWidth;
|
||||
|
||||
/** The geospatial descriptor for the grid */
|
||||
protected GeneralGridGeometry gridGeometry;
|
||||
|
||||
/** elevation exaggeration */
|
||||
protected double elevationExageration = 0;
|
||||
|
||||
|
@ -242,8 +218,6 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
LAT_LON_FORMATTER.setMaximumFractionDigits(2);
|
||||
}
|
||||
|
||||
private String cloudSourceName;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
@ -274,49 +248,26 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
*
|
||||
*/
|
||||
public MapDescriptor(GeneralGridGeometry gridGeometry) throws VizException {
|
||||
super();
|
||||
|
||||
this.gridGeometry = gridGeometry;
|
||||
super(gridGeometry);
|
||||
init();
|
||||
}
|
||||
|
||||
protected void init() throws VizException {
|
||||
MathTransformFactory mtf = new DefaultMathTransformFactory();
|
||||
|
||||
try {
|
||||
|
||||
mapToCoordinateTransform = this.gridGeometry
|
||||
GeneralGridGeometry gridGeometry = getGridGeometry();
|
||||
mapToCoordinateTransform = gridGeometry
|
||||
.getGridToCRS(PixelInCell.CELL_CENTER);
|
||||
coordinateToMapTransform = mapToCoordinateTransform.inverse();
|
||||
CoordinateReferenceSystem descriptorCRS = this.gridGeometry
|
||||
.getCoordinateReferenceSystem();
|
||||
if (descriptorCRS.toWKT().equals(
|
||||
DefaultGeocentricCRS.CARTESIAN.toWKT())) {
|
||||
inverseCoordinateTransform = CRS.findMathTransform(
|
||||
descriptorCRS, DefaultGeographicCRS.WGS84_3D);
|
||||
|
||||
coordinateTransform = inverseCoordinateTransform.inverse();
|
||||
|
||||
} else {
|
||||
inverseCoordinateTransform = CRSCache.getInstance()
|
||||
.getTransformToLatLon(descriptorCRS);
|
||||
coordinateTransform = inverseCoordinateTransform.inverse();
|
||||
}
|
||||
|
||||
wgsToGridTransform = mtf.createConcatenatedTransform(
|
||||
coordinateTransform, coordinateToMapTransform);
|
||||
gridToWGSTransform = mtf.createConcatenatedTransform(
|
||||
mapToCoordinateTransform, inverseCoordinateTransform);
|
||||
|
||||
CoordinateReferenceSystem crs = this.gridGeometry
|
||||
CoordinateReferenceSystem crs = gridGeometry
|
||||
.getCoordinateReferenceSystem();
|
||||
|
||||
DirectPosition s1, d1, s2, d2;
|
||||
if (crs.getCoordinateSystem().getDimension() == 2) {
|
||||
double centerX = (this.gridGeometry.getGridRange().getLow(0) + this.gridGeometry
|
||||
double centerX = (gridGeometry.getGridRange().getLow(0) + gridGeometry
|
||||
.getGridRange().getHigh(0)) / 2;
|
||||
|
||||
double centerY = (this.gridGeometry.getGridRange().getLow(1) + this.gridGeometry
|
||||
double centerY = (gridGeometry.getGridRange().getLow(1) + gridGeometry
|
||||
.getGridRange().getHigh(1)) / 2;
|
||||
|
||||
s1 = new DirectPosition2D(centerX, centerY);
|
||||
|
@ -367,43 +318,6 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor#pixelToWorld(double[])
|
||||
*/
|
||||
@Override
|
||||
public double[] pixelToWorld(final double[] pixel) {
|
||||
// if (pixel[0] < 1.0)
|
||||
// pixel[0] = 1;
|
||||
//
|
||||
// if (pixel[0] > theWorldWidth - 1.0)
|
||||
// pixel[0] = theWorldWidth - 1.0;
|
||||
//
|
||||
// if (pixel[1] < 1.0)
|
||||
// pixel[1] = 1;
|
||||
//
|
||||
// if (pixel[1] > theWorldHeight - 1.0)
|
||||
// pixel[1] = theWorldHeight;
|
||||
|
||||
double[] output = new double[3];
|
||||
double[] wpixel = pixel;
|
||||
|
||||
if (pixel.length == 2) {
|
||||
wpixel = new double[] { pixel[0], pixel[1], 0 };
|
||||
}
|
||||
|
||||
try {
|
||||
gridToWGSTransform.transform(wpixel, 0, output, 0, 1);
|
||||
} catch (TransformException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -417,7 +331,7 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
if (crs == MapUtil.LATLON_PROJECTION) {
|
||||
return pixelToWorld(pixel);
|
||||
} else if (!crs.getName().equals(
|
||||
this.gridGeometry.getCoordinateReferenceSystem().getName())) {
|
||||
getGridGeometry().getCoordinateReferenceSystem().getName())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -431,33 +345,6 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
return output2;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.drawables.IDescriptor#worldToPixel(double[])
|
||||
*/
|
||||
@Override
|
||||
public double[] worldToPixel(double[] world) {
|
||||
|
||||
double[] output = new double[3];
|
||||
|
||||
double[] input = null;
|
||||
if (world.length == 2) {
|
||||
input = new double[] { world[0], world[1], 0 };
|
||||
} else {
|
||||
input = world;
|
||||
}
|
||||
|
||||
try {
|
||||
wgsToGridTransform.transform(input, 0, output, 0, 1);
|
||||
} catch (TransformException e) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -466,11 +353,10 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
*/
|
||||
@Override
|
||||
public double[] worldToPixel(double[] pixel, CoordinateReferenceSystem crs) {
|
||||
|
||||
if (crs == MapUtil.LATLON_PROJECTION) {
|
||||
return worldToPixel(pixel);
|
||||
} else if (!crs.getName().equals(
|
||||
this.gridGeometry.getCoordinateReferenceSystem().getName())) {
|
||||
getGridGeometry().getCoordinateReferenceSystem().getName())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -618,18 +504,6 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
return pc;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.map.IMapDescriptor#getMapData()
|
||||
*/
|
||||
@Override
|
||||
@XmlElement
|
||||
@XmlJavaTypeAdapter(value = GridGeometryAdapter.class)
|
||||
public GeneralGridGeometry getGridGeometry() {
|
||||
return this.gridGeometry;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -656,29 +530,10 @@ public class MapDescriptor extends AbstractDescriptor implements
|
|||
@Override
|
||||
public void setGridGeometry(GeneralGridGeometry gridGeometry)
|
||||
throws VizException {
|
||||
this.gridGeometry = gridGeometry;
|
||||
|
||||
super.setGridGeometry(gridGeometry);
|
||||
init();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.map.IMapDescriptor#getCRS()
|
||||
*/
|
||||
@Override
|
||||
public CoordinateReferenceSystem getCRS() {
|
||||
if (this.gridGeometry != null) {
|
||||
return this.gridGeometry.getCoordinateReferenceSystem();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public MathTransform getToGridTransform() {
|
||||
return this.wgsToGridTransform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current display width
|
||||
*
|
||||
|
|
|
@ -193,29 +193,7 @@ public class NotificationManagerJob implements ExceptionListener, IDisposable {
|
|||
try {
|
||||
ConnectionFactory connectionFactory = JMSConnection.getInstance()
|
||||
.getFactory();
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.stop();
|
||||
} catch (Exception e) {
|
||||
if (notifyError) {
|
||||
statusHandler
|
||||
.handle(Priority.SIGNIFICANT,
|
||||
"NotificationManager failed to stop a connection.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
if (notifyError) {
|
||||
statusHandler
|
||||
.handle(Priority.SIGNIFICANT,
|
||||
"NotificationManager failed to close a connection.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
connection = null;
|
||||
}
|
||||
disconnect(notifyError);
|
||||
|
||||
// Create a Connection
|
||||
connection = connectionFactory.createConnection();
|
||||
|
@ -250,6 +228,31 @@ public class NotificationManagerJob implements ExceptionListener, IDisposable {
|
|||
}
|
||||
}
|
||||
|
||||
protected void disconnect(boolean notifyError) {
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.stop();
|
||||
} catch (Exception e) {
|
||||
if (notifyError) {
|
||||
statusHandler.handle(Priority.SIGNIFICANT,
|
||||
"NotificationManager failed to stop a connection.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
connection.close();
|
||||
} catch (Exception e) {
|
||||
if (notifyError) {
|
||||
statusHandler
|
||||
.handle(Priority.SIGNIFICANT,
|
||||
"NotificationManager failed to close a connection.",
|
||||
e);
|
||||
}
|
||||
}
|
||||
connection = null;
|
||||
}
|
||||
}
|
||||
|
||||
private TimerTask task = null;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.raytheon.uf.viz.core.requests;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
@ -12,6 +13,7 @@ import com.raytheon.uf.common.auth.req.AbstractPrivilegedRequest;
|
|||
import com.raytheon.uf.common.auth.resp.SuccessfulExecution;
|
||||
import com.raytheon.uf.common.auth.resp.UserNotAuthenticated;
|
||||
import com.raytheon.uf.common.auth.resp.UserNotAuthorized;
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.comm.HttpClient;
|
||||
import com.raytheon.uf.common.comm.NetworkStatistics;
|
||||
import com.raytheon.uf.common.serialization.SerializationException;
|
||||
|
@ -23,6 +25,7 @@ import com.raytheon.uf.common.serialization.comm.response.ServerErrorResponse;
|
|||
import com.raytheon.uf.common.serialization.comm.util.ExceptionWrapper;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.auth.UserController;
|
||||
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.localization.LocalizationManager;
|
||||
|
||||
|
@ -311,6 +314,12 @@ public class ThriftClient {
|
|||
// Log request stats
|
||||
stats.log(request.getClass().getSimpleName(), message.length,
|
||||
responseLen);
|
||||
} catch (IOException e) {
|
||||
throw new VizCommunicationException(
|
||||
"unable to post request to server", e);
|
||||
} catch (CommunicationException e) {
|
||||
throw new VizCommunicationException(
|
||||
"unable to post request to server", e);
|
||||
} catch (Exception e) {
|
||||
throw new VizException("unable to post request to server", e);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,340 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.rsc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.IGraphicsTarget;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderable;
|
||||
import com.raytheon.uf.viz.core.drawables.PaintProperties;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability;
|
||||
|
||||
/**
|
||||
* Abstract resource class that manages frames with renderable objects
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 21, 2011 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AbstractPluginDataObjectResource<T extends AbstractResourceData, D extends IDescriptor>
|
||||
extends AbstractVizResource<T, D> {
|
||||
|
||||
private static class Frame {
|
||||
List<PluginDataObject> records = new ArrayList<PluginDataObject>();
|
||||
|
||||
IRenderable renderable;
|
||||
}
|
||||
|
||||
private Map<DataTime, Frame> frames = new HashMap<DataTime, Frame>();
|
||||
|
||||
private Object lock = new Object();
|
||||
|
||||
/**
|
||||
* @param resourceData
|
||||
* @param loadProperties
|
||||
*/
|
||||
protected AbstractPluginDataObjectResource(T resourceData,
|
||||
LoadProperties loadProperties) {
|
||||
super(resourceData, loadProperties);
|
||||
dataTimes = new ArrayList<DataTime>();
|
||||
resourceData.addChangeListener(new IResourceDataChanged() {
|
||||
@Override
|
||||
public void resourceChanged(ChangeType type, Object object) {
|
||||
if (type == ChangeType.DATA_UPDATE) {
|
||||
if (object instanceof PluginDataObject) {
|
||||
addDataObject((PluginDataObject) object);
|
||||
} else if (object instanceof PluginDataObject[]) {
|
||||
for (PluginDataObject pdo : (PluginDataObject[]) object) {
|
||||
addDataObject((PluginDataObject) pdo);
|
||||
}
|
||||
} else if (object instanceof Object[]) {
|
||||
for (Object obj : (Object[]) object) {
|
||||
if (obj instanceof PluginDataObject) {
|
||||
addDataObject((PluginDataObject) obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == ChangeType.CAPABILITY) {
|
||||
if (object instanceof AbstractCapability) {
|
||||
AbstractCapability capability = (AbstractCapability) object;
|
||||
for (Frame frame : frames.values()) {
|
||||
if (frame.renderable != null) {
|
||||
capabilityChanged(frame.renderable, capability);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the pdo to the appropriate time and removes any renderable or data
|
||||
* cached for that time.
|
||||
*
|
||||
* @param pdo
|
||||
*/
|
||||
protected final void addDataObject(PluginDataObject pdo) {
|
||||
synchronized (lock) {
|
||||
if (frames == null) {
|
||||
// Check for null in case we were waiting for lock from
|
||||
// disposeInternal in which case we shouldn't process add
|
||||
return;
|
||||
}
|
||||
DataTime time = getDataObjectTime(pdo);
|
||||
Frame frame = frames.get(time);
|
||||
if (frame == null) {
|
||||
frame = new Frame();
|
||||
frames.put(time, frame);
|
||||
}
|
||||
if (frame.records.contains(pdo)) {
|
||||
frame.records.remove(pdo);
|
||||
}
|
||||
frame.records.add(pdo);
|
||||
if (frame.renderable != null) {
|
||||
if (updateRenderable(frame.renderable, pdo) == false) {
|
||||
dispose(frame.renderable);
|
||||
}
|
||||
}
|
||||
if (!dataTimes.contains(dataTimes)) {
|
||||
dataTimes.add(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DataTime to be associated with this record. Default returns
|
||||
* PluginDataObject.getDataTime()
|
||||
*
|
||||
* @param pdo
|
||||
* @return
|
||||
*/
|
||||
protected DataTime getDataObjectTime(PluginDataObject pdo) {
|
||||
return pdo.getDataTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the records for the given time. Empty list will be returned if no
|
||||
* frame for time
|
||||
*
|
||||
* @param time
|
||||
* @return
|
||||
*/
|
||||
protected List<PluginDataObject> getPluginDataObjects(DataTime time) {
|
||||
Frame frame = frames.get(time);
|
||||
if (frame != null) {
|
||||
return frame.records;
|
||||
}
|
||||
return new ArrayList<PluginDataObject>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current time for the resource, default calls
|
||||
* descriptor.getTimeForResoruce(this)
|
||||
*
|
||||
* @return the current time
|
||||
*/
|
||||
protected DataTime getTimeForResource() {
|
||||
return descriptor.getTimeForResource(this);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#remove(com.raytheon.
|
||||
* uf.common.time.DataTime)
|
||||
*/
|
||||
@Override
|
||||
public final void remove(DataTime dataTime) {
|
||||
synchronized (lock) {
|
||||
super.remove(dataTime);
|
||||
Frame frame = frames.remove(dataTime);
|
||||
if (frame != null && frame.renderable != null) {
|
||||
IRenderable dispose = frame.renderable;
|
||||
frame.renderable = null;
|
||||
dispose(dispose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose of a renderable.
|
||||
*
|
||||
* @param renderable
|
||||
*/
|
||||
private void dispose(final IRenderable renderable) {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
disposeRenderable(renderable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void project(CoordinateReferenceSystem crs)
|
||||
throws VizException {
|
||||
Iterator<Frame> iter = frames.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Frame frame = iter.next();
|
||||
IRenderable renderable = frame.renderable;
|
||||
if (renderable != null) {
|
||||
if (!projectRenderable(renderable, crs)) {
|
||||
frame.renderable = null;
|
||||
dispose(renderable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.rsc.AbstractVizResource#paintInternal(com.raytheon
|
||||
* .uf.viz.core.IGraphicsTarget,
|
||||
* com.raytheon.uf.viz.core.drawables.PaintProperties)
|
||||
*/
|
||||
@Override
|
||||
protected final void paintInternal(IGraphicsTarget target,
|
||||
PaintProperties paintProps) throws VizException {
|
||||
DataTime time = paintProps.getDataTime();
|
||||
if (time == null) {
|
||||
time = getTimeForResource();
|
||||
}
|
||||
Frame currFrame = frames.get(time);
|
||||
if (currFrame != null) {
|
||||
IRenderable renderable = currFrame.renderable;
|
||||
if (renderable == null) {
|
||||
currFrame.renderable = renderable = constructRenderable(currFrame.records);
|
||||
}
|
||||
|
||||
if (renderable != null) {
|
||||
renderable.paint(target, paintProps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.rsc.AbstractVizResource#disposeInternal()
|
||||
*/
|
||||
@Override
|
||||
protected final void disposeInternal() {
|
||||
synchronized (lock) {
|
||||
for (Frame frame : frames.values()) {
|
||||
if (frame.renderable != null) {
|
||||
disposeRenderable(frame.renderable);
|
||||
}
|
||||
}
|
||||
frames.clear();
|
||||
frames = null;
|
||||
}
|
||||
disposeResource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose method for the resource to dispose any data not tied to a
|
||||
* renderable. Called after all renderables have been disposed. Default impl
|
||||
* does nothing
|
||||
*/
|
||||
protected void disposeResource() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification that a capability has changed and the renderable should be
|
||||
* updated
|
||||
*
|
||||
* @param renderable
|
||||
* @param capability
|
||||
*/
|
||||
protected abstract void capabilityChanged(IRenderable renderable,
|
||||
AbstractCapability capability);
|
||||
|
||||
/**
|
||||
* Dispose the renderable object
|
||||
*
|
||||
* @param renderable
|
||||
*/
|
||||
protected abstract void disposeRenderable(IRenderable renderable);
|
||||
|
||||
/**
|
||||
* Attempt to reproject the renderable object into this specified
|
||||
* projection. If unable to reproject, return false and renderable will be
|
||||
* recreated next paint
|
||||
*
|
||||
* @param renderable
|
||||
* @param crs
|
||||
* @return
|
||||
*/
|
||||
protected abstract boolean projectRenderable(IRenderable renderable,
|
||||
CoordinateReferenceSystem crs) throws VizException;
|
||||
|
||||
/**
|
||||
* Construct a renderable object for the given records. This method is
|
||||
* called from paintInternal. Null can be returned and this method will be
|
||||
* called next paintInternal. That can be used if requesting data that is
|
||||
* required for the renderable asynchronously.
|
||||
*
|
||||
* NOTE: The size of the pdo list will only grow so it can be used to
|
||||
* determine if new data has arrived since last call
|
||||
*
|
||||
* @param records
|
||||
* @return
|
||||
*/
|
||||
protected abstract IRenderable constructRenderable(
|
||||
List<PluginDataObject> records) throws VizException;
|
||||
|
||||
/**
|
||||
* Update the renderable with the new pdo, if the renderable is updatable,
|
||||
* return true. If the renderable needs to be recreated from scratch, return
|
||||
* false
|
||||
*
|
||||
* @param renderable
|
||||
* @param pdo
|
||||
* @return
|
||||
*/
|
||||
protected abstract boolean updateRenderable(IRenderable renderable,
|
||||
PluginDataObject pdo);
|
||||
}
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.viz.core.rsc;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -385,11 +386,6 @@ public abstract class AbstractRequestableResourceData extends
|
|||
|
||||
Set<DataTime> currentSet = new HashSet<DataTime>(Arrays.asList(current));
|
||||
|
||||
boolean initialLoad = false;
|
||||
if (currentSet.size() == 0) {
|
||||
initialLoad = true;
|
||||
}
|
||||
|
||||
Set<DataTime> loadSet = new HashSet<DataTime>();
|
||||
for (DataTime t : desiredSet) {
|
||||
boolean found = false;
|
||||
|
@ -409,6 +405,21 @@ public abstract class AbstractRequestableResourceData extends
|
|||
return new PluginDataObject[0];
|
||||
}
|
||||
|
||||
return requestPluginDataObjects(loadSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* Request plugin data objects for the passed in times. This method is
|
||||
* called from getLatestPluginDataObjects(DataTime[],DataTime[]) after time
|
||||
* filter from desired and current has been done. The times passed in is a
|
||||
* collection of new times needed
|
||||
*
|
||||
* @param loadSet
|
||||
* @return
|
||||
* @throws VizException
|
||||
*/
|
||||
protected PluginDataObject[] requestPluginDataObjects(
|
||||
Collection<DataTime> loadSet) throws VizException {
|
||||
LayerProperty property = new LayerProperty();
|
||||
// TODO fix?
|
||||
property.setDesiredProduct(ResourceType.PLAN_VIEW);
|
||||
|
@ -476,7 +487,7 @@ public abstract class AbstractRequestableResourceData extends
|
|||
/**
|
||||
* Comparator for response array.
|
||||
*/
|
||||
private static Comparator<PluginDataObject> layerComparator = new Comparator<PluginDataObject>() {
|
||||
protected static Comparator<PluginDataObject> layerComparator = new Comparator<PluginDataObject>() {
|
||||
|
||||
@Override
|
||||
public int compare(PluginDataObject arg0, PluginDataObject arg1) {
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
package com.raytheon.uf.viz.core.rsc;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
|
@ -152,11 +152,11 @@ public abstract class AbstractVizResource<T extends AbstractResourceData, D exte
|
|||
protected AbstractVizResource(T resourceData, LoadProperties loadProperties) {
|
||||
this.resourceData = resourceData;
|
||||
this.loadProperties = loadProperties;
|
||||
refreshListeners = new HashSet<IRefreshListener>();
|
||||
initListeners = new HashSet<IInitListener>();
|
||||
paintListeners = new HashSet<IPaintListener>();
|
||||
paintStatusListeners = new HashSet<IPaintStatusChangedListener>();
|
||||
disposeListeners = new HashSet<IDisposeListener>();
|
||||
refreshListeners = new CopyOnWriteArraySet<IRefreshListener>();
|
||||
initListeners = new CopyOnWriteArraySet<IInitListener>();
|
||||
paintListeners = new CopyOnWriteArraySet<IPaintListener>();
|
||||
paintStatusListeners = new CopyOnWriteArraySet<IPaintStatusChangedListener>();
|
||||
disposeListeners = new CopyOnWriteArraySet<IDisposeListener>();
|
||||
|
||||
if (resourceData != null) {
|
||||
resourceData.addChangeListener(new IResourceDataChanged() {
|
||||
|
@ -717,7 +717,7 @@ public abstract class AbstractVizResource<T extends AbstractResourceData, D exte
|
|||
*/
|
||||
public final void recycle() {
|
||||
if (status == ResourceStatus.INITIALIZED) {
|
||||
dispose();
|
||||
disposeInternal();
|
||||
}
|
||||
status = ResourceStatus.NEW;
|
||||
initJob = null;
|
||||
|
|
|
@ -83,7 +83,12 @@ public class URICatalog extends DecisionTree<List<IURIRefreshCallback>> {
|
|||
}
|
||||
|
||||
protected static synchronized void setCustomInstance(URICatalog catalog) {
|
||||
// TODO what to do if there already is an isntance.
|
||||
if (instance != null) {
|
||||
for (DataPair pair : instance.getDataPairs()) {
|
||||
catalog.insertCriteria(pair.metadata, pair.data, false);
|
||||
}
|
||||
catalog.rebuildTree();
|
||||
}
|
||||
instance = catalog;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,9 @@ public class ColorMapCapability extends AbstractCapability implements
|
|||
public void setColorMapParameters(ColorMapParameters colorMapParameters,
|
||||
boolean notify) {
|
||||
if (this.colorMapParameters != colorMapParameters) {
|
||||
if (this.colorMapParameters != null) {
|
||||
this.colorMapParameters.removeListener(this);
|
||||
}
|
||||
this.colorMapParameters = colorMapParameters;
|
||||
if (notify) {
|
||||
capabilityChanged();
|
||||
|
@ -80,7 +83,7 @@ public class ColorMapCapability extends AbstractCapability implements
|
|||
}
|
||||
|
||||
if (this.colorMapParameters != null) {
|
||||
this.colorMapParameters.setListener(this);
|
||||
this.colorMapParameters.addListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,23 +21,115 @@ package com.raytheon.uf.viz.core.rsc.hdf5;
|
|||
|
||||
import java.awt.Rectangle;
|
||||
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import org.geotools.coverage.grid.GeneralGridEnvelope;
|
||||
import org.geotools.coverage.grid.GridGeometry2D;
|
||||
import org.geotools.geometry.GeneralEnvelope;
|
||||
import org.geotools.geometry.jts.ReferencedEnvelope;
|
||||
import org.opengis.coverage.grid.GridEnvelope;
|
||||
import org.opengis.geometry.Envelope;
|
||||
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
||||
/**
|
||||
* ImageTile is an object that represents an image (or part of an image)
|
||||
* geospatially, it contains a grid geometry that represents the projection and
|
||||
* size of the image and a PixelCoverage which contains the screen projected
|
||||
* data for the image. Because a single ImageTile can represent multiple images,
|
||||
* this class does not contain the actual image it represents so the tile can be
|
||||
* shared between images
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 13, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
public class ImageTile {
|
||||
|
||||
public com.vividsolutions.jts.geom.Envelope envelope;
|
||||
|
||||
public double elevation;
|
||||
public GridGeometry2D imageGeometry;
|
||||
|
||||
public PixelCoverage coverage;
|
||||
|
||||
public Rectangle rect;
|
||||
/**
|
||||
* Checks to see if the x/y coordinate is contained by the ImageTile's CRS
|
||||
* Envelope
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(double x, double y) {
|
||||
Envelope env = imageGeometry.getEnvelope();
|
||||
return env.getMinimum(0) <= x && env.getMaximum(0) >= x
|
||||
&& env.getMinimum(1) <= y && env.getMaximum(1) >= y;
|
||||
}
|
||||
|
||||
// TODO clean up occlusionQueries move to GLImage?
|
||||
public int query = -1;
|
||||
/**
|
||||
* Checks to see if the Coordinate is contained by the ImageTile's CRS
|
||||
* Envelope
|
||||
*
|
||||
* @param c
|
||||
* @return
|
||||
*/
|
||||
public boolean contains(Coordinate c) {
|
||||
return contains(c.x, c.y);
|
||||
}
|
||||
|
||||
public boolean occlude = false;
|
||||
/**
|
||||
* Set the grid geometry of the tile given the image rectangle and the
|
||||
* referenced envelope
|
||||
*
|
||||
* @param rect
|
||||
* @param env
|
||||
*/
|
||||
public void setGridGeometry(Rectangle rect, ReferencedEnvelope env) {
|
||||
GeneralGridEnvelope gge = new GeneralGridEnvelope(rect);
|
||||
GeneralEnvelope ge = new GeneralEnvelope(env);
|
||||
imageGeometry = new GridGeometry2D(gge, ge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the image geometry
|
||||
*
|
||||
* @param imageGeometry
|
||||
*/
|
||||
public void setGridGeometry(GridGeometry2D imageGeometry) {
|
||||
this.imageGeometry = imageGeometry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the image rectangle. This could be a subsection of a larger image so
|
||||
* x and y may not be 0,0
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Rectangle getRectangle() {
|
||||
GridEnvelope env = imageGeometry.getGridRange();
|
||||
return new Rectangle(env.getLow(0), env.getLow(1), env.getSpan(0),
|
||||
env.getSpan(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the spatially referenced envelope of the image tile
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ReferencedEnvelope getEnvelope() {
|
||||
return new ReferencedEnvelope(imageGeometry.getEnvelope());
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose the image tile, disposes of the coverage object associated with
|
||||
* it
|
||||
*/
|
||||
public void dispose() {
|
||||
if (coverage != null) {
|
||||
coverage.dispose();
|
||||
|
|
|
@ -1,163 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.core.rsc.hdf5;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
|
||||
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.IMesh;
|
||||
import com.raytheon.uf.viz.core.IMeshCallback;
|
||||
import com.raytheon.uf.viz.core.PixelCoverage;
|
||||
import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory;
|
||||
|
||||
/**
|
||||
* Persistent job used to calculate mesh tiles outside of the rendering thread
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 1, 2007 chammack Initial Creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author cnh
|
||||
* @version 1
|
||||
*/
|
||||
public class MeshCalculatorJob extends Job {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(MeshCalculatorJob.class);
|
||||
|
||||
private static MeshCalculatorJob instance;
|
||||
|
||||
private ConcurrentLinkedQueue<PixelCoverage> requests;
|
||||
|
||||
private ConcurrentHashMap<PixelCoverage, MeshParameters> map;
|
||||
|
||||
private MeshCalculatorJob() {
|
||||
super("Mesh Calculator");
|
||||
requests = new ConcurrentLinkedQueue<PixelCoverage>();
|
||||
map = new ConcurrentHashMap<PixelCoverage, MeshParameters>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to have the mesh be calculated in the mesh thread
|
||||
*
|
||||
* @param mesh
|
||||
* @param tile
|
||||
* @param preTransform
|
||||
*/
|
||||
public synchronized void requestLoad(IMesh mesh, ImageTile tile,
|
||||
MathTransform preTransform) {
|
||||
if (!requests.contains(tile.coverage)) {
|
||||
MeshParameters params = new MeshParameters();
|
||||
params.tile = tile;
|
||||
params.mesh = mesh;
|
||||
params.preTransform = preTransform;
|
||||
|
||||
map.put(tile.coverage, params);
|
||||
requests.add(tile.coverage);
|
||||
}
|
||||
instance.schedule();
|
||||
}
|
||||
|
||||
/**
|
||||
* Request to have the mesh be calculated in the mesh thread, with the
|
||||
* callback being notified after the mesh has been calculated
|
||||
*
|
||||
* @param callback
|
||||
* @param mesh
|
||||
* @param tile
|
||||
* @param preTransform
|
||||
*/
|
||||
public synchronized void requestLoad(IMeshCallback callback, IMesh mesh,
|
||||
ImageTile tile, MathTransform preTransform) {
|
||||
if (!requests.contains(tile.coverage)) {
|
||||
MeshParameters params = new MeshParameters();
|
||||
params.tile = tile;
|
||||
params.mesh = mesh;
|
||||
params.preTransform = preTransform;
|
||||
params.callback = callback;
|
||||
|
||||
map.put(tile.coverage, params);
|
||||
requests.add(tile.coverage);
|
||||
}
|
||||
instance.schedule();
|
||||
}
|
||||
|
||||
public static synchronized MeshCalculatorJob getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new MeshCalculatorJob();
|
||||
instance.setSystem(true);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @seeorg.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
|
||||
* IProgressMonitor)
|
||||
*/
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
|
||||
while (requests.size() > 0) {
|
||||
PixelCoverage coverage = requests.peek();
|
||||
try {
|
||||
MeshParameters p = map.get(coverage);
|
||||
|
||||
coverage.setMesh(null);
|
||||
p.mesh.calculateMesh(coverage, p.tile, p.preTransform);
|
||||
coverage.setMesh(p.mesh);
|
||||
|
||||
if (p.callback != null) {
|
||||
p.callback.meshCalculated(p.tile);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
statusHandler.handle(Priority.PROBLEM, "An error occured during mesh calculations, some images may not be properly reprojected.", t);
|
||||
}
|
||||
map.remove(coverage);
|
||||
requests.remove();
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
|
||||
private class MeshParameters {
|
||||
// public MapDescriptor mapDescriptor;
|
||||
|
||||
public IMesh mesh;
|
||||
|
||||
public ImageTile tile;
|
||||
|
||||
public MathTransform preTransform;
|
||||
|
||||
public IMeshCallback callback;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,19 +1,19 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
**/
|
||||
|
@ -50,7 +50,17 @@ public class DataUpdateTree extends DecisionTree<AbstractVizResource<?, ?>> {
|
|||
return instance;
|
||||
}
|
||||
|
||||
public DataUpdateTree() {
|
||||
protected static synchronized void setCustomInstance(DataUpdateTree tree) {
|
||||
if (instance != null) {
|
||||
for (DataPair pair : instance.getDataPairs()) {
|
||||
tree.insertCriteria(pair.metadata, pair.data, false);
|
||||
}
|
||||
tree.rebuildTree();
|
||||
}
|
||||
instance = tree;
|
||||
}
|
||||
|
||||
protected DataUpdateTree() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ Import-Package: com.raytheon.uf.common.dataplugin,
|
|||
com.raytheon.uf.viz.d2d.core.time,
|
||||
com.raytheon.viz.core.graphing,
|
||||
com.raytheon.viz.ui,
|
||||
com.raytheon.viz.ui.actions,
|
||||
com.raytheon.viz.ui.dialogs,
|
||||
com.raytheon.viz.ui.editor,
|
||||
com.raytheon.viz.ui.perspectives,
|
||||
|
@ -50,6 +51,7 @@ Import-Package: com.raytheon.uf.common.dataplugin,
|
|||
gov.noaa.nws.ncep.ui.nsharp.skewt.bkgd,
|
||||
gov.noaa.nws.ncep.ui.nsharp.skewt.rsc,
|
||||
gov.noaa.nws.ncep.viz.common.soundingQuery,
|
||||
gov.noaa.nws.ncep.viz.ui.display,
|
||||
javax.measure.converter,
|
||||
javax.measure.unit,
|
||||
org.eclipse.core.commands,
|
||||
|
@ -57,6 +59,7 @@ Import-Package: com.raytheon.uf.common.dataplugin,
|
|||
org.eclipse.swt,
|
||||
org.eclipse.swt.graphics,
|
||||
org.eclipse.swt.layout,
|
||||
org.eclipse.swt.printing,
|
||||
org.eclipse.swt.widgets,
|
||||
org.eclipse.ui,
|
||||
org.eclipse.ui.part,
|
||||
|
|
|
@ -31,4 +31,27 @@
|
|||
visible="false"/>
|
||||
</perspectiveExtension>
|
||||
</extension>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.ui.handlers">
|
||||
<handler
|
||||
class="com.raytheon.uf.viz.d2d.nsharp.rsc.action.NSharpSaveScreenAction"
|
||||
commandId="com.raytheon.viz.ui.actions.saveScreen">
|
||||
<activeWhen>
|
||||
<with variable="activeEditorId">
|
||||
<equals value="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpSkewTEditor"/>
|
||||
</with>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
<handler
|
||||
class="com.raytheon.uf.viz.d2d.nsharp.rsc.action.NSharpPrintScreenAction"
|
||||
commandId="com.raytheon.viz.ui.actions.printScreenAction">
|
||||
<activeWhen>
|
||||
<with variable="activeEditorId">
|
||||
<equals value="gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpSkewTEditor"/>
|
||||
</with>
|
||||
</activeWhen>
|
||||
</handler>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -0,0 +1,199 @@
|
|||
/**
|
||||
* 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.d2d.nsharp.rsc.action;
|
||||
|
||||
import gov.noaa.nws.ncep.ui.nsharp.palette.NsharpPrintHandle;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpSkewTDescriptor;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpSkewTEditor;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.skewt.rsc.NsharpSkewTResource;
|
||||
import gov.noaa.nws.ncep.ui.nsharp.skewt.rsc.NsharpSkewTResource.ElementStateProperty;
|
||||
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.swt.printing.PrintDialog;
|
||||
import org.eclipse.swt.printing.Printer;
|
||||
import org.eclipse.swt.printing.PrinterData;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IFrameCoordinator.FrameChangeMode;
|
||||
import com.raytheon.uf.viz.core.drawables.IFrameCoordinator.FrameChangeOperation;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
import com.raytheon.viz.ui.actions.PrintScreenAction;
|
||||
|
||||
/**
|
||||
* Print the current map
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 26, 2006 chammack Initial Creation.
|
||||
* Aug 08, 2008 #703 randerso fixed bug, changed to scale to fit
|
||||
* paper and rotate if necessary
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
* @version 1
|
||||
*/
|
||||
public class NSharpPrintScreenAction extends PrintScreenAction {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
|
||||
* ExecutionEvent)
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
NsharpSkewTEditor editor = null;
|
||||
IEditorPart part = EditorUtil.getActiveEditor();
|
||||
if (part instanceof NsharpSkewTEditor) {
|
||||
editor = (NsharpSkewTEditor) part;
|
||||
}
|
||||
if (editor == null) {
|
||||
return super.execute(event);
|
||||
}
|
||||
IDisplayPane pane = editor.getActiveDisplayPane();
|
||||
IDescriptor desc = pane.getDescriptor();
|
||||
|
||||
NsharpSkewTDescriptor ndesc = editor.getNsharpSkewTDescriptor();
|
||||
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
|
||||
// display the printer dialog to get print options
|
||||
PrintDialog pd = new PrintDialog(shell);
|
||||
String frameMode = event.getParameter("frameSelection");
|
||||
if (frameMode == null || frameMode.equalsIgnoreCase("current")) {
|
||||
// selection doesn't seem to work.
|
||||
pd.setScope(PrinterData.PAGE_RANGE);
|
||||
pd.setStartPage(getCurrentIndex(ndesc.getSkewtResource()) + 1);
|
||||
pd.setEndPage(getCurrentIndex(ndesc.getSkewtResource()) + 1);
|
||||
} else if (frameMode.equalsIgnoreCase("all")) {
|
||||
pd.setScope(PrinterData.ALL_PAGES);
|
||||
} else {
|
||||
throw new ExecutionException("Invalid frameMode: " + frameMode);
|
||||
}
|
||||
PrinterData printerData = pd.open();
|
||||
if (printerData == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
NsharpPrintHandle handle = new NsharpPrintHandle();
|
||||
handle.createPrinter(printerData);
|
||||
if (handle.startJob()) {
|
||||
switch (pd.getScope()) {
|
||||
case PrinterData.ALL_PAGES: {
|
||||
try {
|
||||
printAllFrames(handle, editor);
|
||||
} catch (VizException e) {
|
||||
throw new ExecutionException(
|
||||
"Error occurred while writing image", e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PrinterData.PAGE_RANGE: {
|
||||
try {
|
||||
printFrames(handle, editor, pd.getStartPage() - 1,
|
||||
pd.getEndPage());
|
||||
} catch (VizException e) {
|
||||
throw new ExecutionException(
|
||||
"Error occurred while writing image", e);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PrinterData.SELECTION: {
|
||||
printImage(handle, editor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
handle.endJob();
|
||||
|
||||
}
|
||||
handle.disposePrinter();
|
||||
return null;
|
||||
}
|
||||
|
||||
private int getCurrentIndex(NsharpSkewTResource rsc) {
|
||||
int index = rsc.getDataTimelineList().size();
|
||||
for (ElementStateProperty element : rsc.getDataTimelineList()) {
|
||||
index -= 1;
|
||||
if (element.getElementDescription().equals(
|
||||
rsc.getPickedStnInfoStr())) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void printAllFrames(NsharpPrintHandle printer,
|
||||
NsharpSkewTEditor editor) throws VizException {
|
||||
printFrames(printer, editor, 0, editor.getNsharpSkewTDescriptor()
|
||||
.getSkewtResource().getDataTimelineList().size());
|
||||
}
|
||||
|
||||
private void printFrames(NsharpPrintHandle printer,
|
||||
NsharpSkewTEditor editor, int startIndex, int endIndex)
|
||||
throws VizException {
|
||||
NsharpSkewTDescriptor ndesc = editor.getNsharpSkewTDescriptor();
|
||||
IDisplayPane pane = editor.getActiveDisplayPane();
|
||||
String picked = ndesc.getSkewtResource().getPickedStnInfoStr();
|
||||
if (getCurrentIndex(ndesc.getSkewtResource()) > startIndex) {
|
||||
ndesc.getFrameCoordinator().changeFrame(FrameChangeOperation.FIRST,
|
||||
FrameChangeMode.TIME_AND_SPACE);
|
||||
editor.getActiveDisplayPane().refresh();
|
||||
}
|
||||
renderPane(pane, editor.getLoopProperties());
|
||||
boolean first = true;
|
||||
for (int i = getCurrentIndex(ndesc.getSkewtResource()); i < endIndex; i++) {
|
||||
if (!first) {
|
||||
ndesc.getFrameCoordinator().changeFrame(
|
||||
FrameChangeOperation.NEXT,
|
||||
FrameChangeMode.TIME_AND_SPACE);
|
||||
pane.refresh();
|
||||
renderPane(pane, editor.getLoopProperties());
|
||||
}
|
||||
if (i >= startIndex) {
|
||||
printImage(printer, editor);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
while (!ndesc.getSkewtResource().getPickedStnInfoStr().equals(picked)) {
|
||||
ndesc.getFrameCoordinator().changeFrame(FrameChangeOperation.NEXT,
|
||||
FrameChangeMode.TIME_AND_SPACE);
|
||||
pane.refresh();
|
||||
renderPane(pane, editor.getLoopProperties());
|
||||
}
|
||||
}
|
||||
|
||||
private void printImage(NsharpPrintHandle printer, NsharpSkewTEditor editor) {
|
||||
printer.printPage(editor.getNsharpSkewTDescriptor());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,109 @@
|
|||
/**
|
||||
* 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.d2d.nsharp.rsc.action;
|
||||
|
||||
import gov.noaa.nws.ncep.ui.nsharp.skewt.NsharpSkewTDescriptor;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.IFrameCoordinator.FrameChangeMode;
|
||||
import com.raytheon.uf.viz.core.drawables.IFrameCoordinator.FrameChangeOperation;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.viz.ui.actions.SaveScreenAction;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
|
||||
/**
|
||||
* Save the current screen to a file
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jul 26, 2006 chammack Initial Creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
* @version 1
|
||||
*/
|
||||
public class NSharpSaveScreenAction extends SaveScreenAction {
|
||||
|
||||
@Override
|
||||
protected BufferedImage captureCurrentFrames(AbstractEditor editor) {
|
||||
return editor.getActiveDisplayPane().getTarget().screenshot();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<BufferedImage> captureAllFrames(AbstractEditor editor)
|
||||
throws VizException {
|
||||
IDescriptor desc = editor.getActiveDisplayPane().getDescriptor();
|
||||
if (!(desc instanceof NsharpSkewTDescriptor)) {
|
||||
return super.captureAllFrames(editor);
|
||||
}
|
||||
NsharpSkewTDescriptor ndesc = (NsharpSkewTDescriptor) desc;
|
||||
int startIndex = 0;
|
||||
int endIndex = ndesc.getSkewtResource().getDataTimelineList().size();
|
||||
return captureFrames(editor, startIndex, endIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<BufferedImage> captureFrames(AbstractEditor editor,
|
||||
int startIndex, int endIndex) throws VizException {
|
||||
IDisplayPane pane = editor.getActiveDisplayPane();
|
||||
IDescriptor desc = pane.getDescriptor();
|
||||
if (!(desc instanceof NsharpSkewTDescriptor)) {
|
||||
return super.captureFrames(editor, startIndex, endIndex);
|
||||
}
|
||||
NsharpSkewTDescriptor ndesc = (NsharpSkewTDescriptor) desc;
|
||||
// save the frame we are on;
|
||||
String picked = ndesc.getSkewtResource().getPickedStnInfoStr();
|
||||
List<BufferedImage> images = new ArrayList<BufferedImage>();
|
||||
|
||||
desc.getFrameCoordinator().changeFrame(FrameChangeOperation.FIRST,
|
||||
FrameChangeMode.TIME_AND_SPACE);
|
||||
pane.refresh();
|
||||
renderPane(pane, editor.getLoopProperties());
|
||||
for (int i = 0; i < endIndex; i++) {
|
||||
if (i >= startIndex) {
|
||||
images.add(captureCurrentFrames(editor));
|
||||
}
|
||||
if (i < endIndex - 1) {
|
||||
desc.getFrameCoordinator().changeFrame(
|
||||
FrameChangeOperation.NEXT,
|
||||
FrameChangeMode.TIME_AND_SPACE);
|
||||
pane.refresh();
|
||||
renderPane(pane, editor.getLoopProperties());
|
||||
}
|
||||
}
|
||||
while (!ndesc.getSkewtResource().getPickedStnInfoStr().equals(picked)) {
|
||||
desc.getFrameCoordinator().changeFrame(FrameChangeOperation.NEXT,
|
||||
FrameChangeMode.TIME_AND_SPACE);
|
||||
pane.refresh();
|
||||
renderPane(pane, editor.getLoopProperties());
|
||||
}
|
||||
return images;
|
||||
}
|
||||
|
||||
}
|
|
@ -26,12 +26,12 @@ import org.eclipse.core.commands.AbstractHandler;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
|
||||
import com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource;
|
||||
import com.raytheon.uf.viz.d2d.core.legend.D2DLegendResource.LegendMode;
|
||||
import com.raytheon.viz.ui.EditorUtil;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -68,8 +68,9 @@ public class ChangeLegendModeHandler extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
IEditorPart part = HandlerUtil.getActiveEditor(event);
|
||||
if (part instanceof IDisplayPaneContainer) {
|
||||
IEditorPart part = (IEditorPart) EditorUtil
|
||||
.getActiveEditorAs(IDisplayPaneContainer.class);
|
||||
if (part != null) {
|
||||
IDisplayPane[] panes = ((IDisplayPaneContainer) part)
|
||||
.getDisplayPanes();
|
||||
for (IDisplayPane pane : panes) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -245,19 +245,23 @@ public class PointDataTimeSeriesAdapter extends
|
|||
// The level mapping for surface has way to much junk in it.
|
||||
return level;
|
||||
}
|
||||
LevelMapping mapping = LevelMappingFactory.getInstance()
|
||||
.getLevelMappingForKey(resourceData.getLevelKey());
|
||||
for (Level l : mapping.getLevels()) {
|
||||
if (LevelUtilities.isPressureLevel(l)) {
|
||||
try {
|
||||
level = new SingleLevel(l.getMasterLevel().getName());
|
||||
level.setValue(l.getLevelonevalue());
|
||||
break;
|
||||
} catch (IllegalArgumentException e) {
|
||||
level = new SingleLevel("SURFACE");
|
||||
level.setValue(0.0);
|
||||
try {
|
||||
LevelMapping mapping = LevelMappingFactory.getInstance()
|
||||
.getLevelMappingForKey(resourceData.getLevelKey());
|
||||
for (Level l : mapping.getLevels()) {
|
||||
if (LevelUtilities.isPressureLevel(l)) {
|
||||
try {
|
||||
level = new SingleLevel(l.getMasterLevel().getName());
|
||||
level.setValue(l.getLevelonevalue());
|
||||
break;
|
||||
} catch (IllegalArgumentException e) {
|
||||
level = new SingleLevel("SURFACE");
|
||||
level.setValue(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (VizException e) {
|
||||
// return the default
|
||||
}
|
||||
return level;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ import com.raytheon.uf.common.datastorage.records.IntegerDataRecord;
|
|||
import com.raytheon.uf.common.datastorage.records.LongDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.ShortDataRecord;
|
||||
import com.raytheon.uf.common.datastorage.records.StringDataRecord;
|
||||
import com.raytheon.uf.common.python.PythonScript;
|
||||
import com.raytheon.uf.common.python.PythonInterpreter;
|
||||
import com.raytheon.uf.viz.derivparam.library.DerivedParameterRequest;
|
||||
import com.raytheon.uf.viz.derivparam.tree.CubeLevel;
|
||||
|
||||
|
@ -55,7 +55,9 @@ import com.raytheon.uf.viz.derivparam.tree.CubeLevel;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class MasterDerivScript extends PythonScript {
|
||||
public class MasterDerivScript extends PythonInterpreter {
|
||||
|
||||
protected static final String RESULT = "__result";
|
||||
|
||||
private static final String DATA_NAME = "Data";
|
||||
|
||||
|
@ -116,21 +118,13 @@ public class MasterDerivScript extends PythonScript {
|
|||
jep.eval(functionCall.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(String methodName, Map<String, Object> args) {
|
||||
// TODO maybe refactor architecture so all python scripts
|
||||
// have a master controller and execute becomes obsolete
|
||||
throw new UnsupportedOperationException(
|
||||
"For derived parameters, use executeScript() instead.");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void evaluateArgument(String argName, Object argValue)
|
||||
throws JepException {
|
||||
if (prevArgs.containsKey(argValue)) {
|
||||
jep.eval(argName + " = " + prevArgs.get(argValue));
|
||||
} else if (argValue instanceof List) {
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "rawtypes" })
|
||||
List valList = (List) argValue;
|
||||
Object val = valList.get(0);
|
||||
if (val instanceof CubeLevel) {
|
||||
|
@ -261,7 +255,6 @@ public class MasterDerivScript extends PythonScript {
|
|||
/**
|
||||
* Retrieves the result of the method execution
|
||||
*/
|
||||
@Override
|
||||
protected List<?> getExecutionResult() throws JepException {
|
||||
// Retrieve the results and return them
|
||||
List<IDataRecord> result = null;
|
||||
|
|
|
@ -7,30 +7,26 @@ Bundle-Activator: com.raytheon.uf.viz.derivparam.Activator
|
|||
Bundle-Vendor: RAYTHEON
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
javax.measure,
|
||||
com.raytheon.uf.common.dataquery
|
||||
com.raytheon.uf.common.dataquery,
|
||||
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.datastorage;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
|
||||
Import-Package: com.raytheon.edex.meteoLib,
|
||||
com.raytheon.edex.util,
|
||||
com.raytheon.uf.common.comm,
|
||||
com.raytheon.uf.common.dataplugin,
|
||||
com.raytheon.uf.common.dataplugin.level,
|
||||
com.raytheon.uf.common.dataplugin.persist,
|
||||
com.raytheon.uf.common.datastorage.records,
|
||||
com.raytheon.uf.common.derivparam.tree,
|
||||
com.raytheon.uf.common.localization,
|
||||
com.raytheon.uf.common.message.response,
|
||||
com.raytheon.uf.common.serialization,
|
||||
com.raytheon.uf.common.serialization.adapters,
|
||||
com.raytheon.uf.common.status,
|
||||
com.raytheon.uf.common.time,
|
||||
com.raytheon.uf.viz.core,
|
||||
com.raytheon.uf.viz.core.catalog,
|
||||
com.raytheon.uf.viz.core.comm,
|
||||
com.raytheon.uf.viz.core.exception,
|
||||
com.raytheon.uf.viz.core.level,
|
||||
com.raytheon.uf.viz.core.localization,
|
||||
com.raytheon.uf.viz.core.status
|
||||
com.raytheon.uf.common.time
|
||||
Export-Package: com.raytheon.uf.viz.derivparam,
|
||||
com.raytheon.uf.viz.derivparam.data,
|
||||
com.raytheon.uf.viz.derivparam.inv,
|
||||
|
|
|
@ -0,0 +1,394 @@
|
|||
/**
|
||||
* 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.derivparam.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.DbQueryRequestSet;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint.ConstraintType;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequestSet;
|
||||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponse;
|
||||
import com.raytheon.uf.common.dataquery.responses.DbQueryResponseSet;
|
||||
import com.raytheon.uf.common.datastorage.Request;
|
||||
import com.raytheon.uf.common.datastorage.records.IDataRecord;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter;
|
||||
import com.raytheon.uf.viz.core.datastructure.VizDataCubeException;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode;
|
||||
import com.raytheon.uf.viz.derivparam.tree.AbstractRequestableLevelNode.Dependency;
|
||||
|
||||
/**
|
||||
* Abstract data cube adapter for standard data type that uses derived
|
||||
* parameters
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 30, 2012 mschenke Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class AbstractDataCubeAdapter implements IDataCubeAdapter {
|
||||
|
||||
private String[] supportedPlugins;
|
||||
|
||||
protected AbstractDataCubeAdapter(String[] supportedPlugins) {
|
||||
this.supportedPlugins = supportedPlugins;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getSupportedPlugins
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public String[] getSupportedPlugins() {
|
||||
return supportedPlugins;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#timeQuery(java
|
||||
* .util.List)
|
||||
*/
|
||||
@Override
|
||||
public List<List<DataTime>> timeQuery(List<TimeQueryRequest> requests)
|
||||
throws VizException {
|
||||
int mapSize = (int) (requests.size() * 1) + 1;
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache = new HashMap<AbstractRequestableLevelNode, Set<DataTime>>(
|
||||
mapSize);
|
||||
LinkedHashMap<AbstractRequestableLevelNode, TimeQueryRequest> queries = new LinkedHashMap<AbstractRequestableLevelNode, TimeQueryRequest>(
|
||||
mapSize);
|
||||
|
||||
for (TimeQueryRequest request : requests) {
|
||||
List<AbstractRequestableLevelNode> requestNodes = evaluateRequestConstraints(request
|
||||
.getQueryTerms());
|
||||
// pull out time queries and bulk submit
|
||||
for (AbstractRequestableLevelNode requestNode : requestNodes) {
|
||||
getTimeQuery(request, requestNode, false, queries, cache, null);
|
||||
}
|
||||
}
|
||||
|
||||
// set the results back into the cache's
|
||||
TimeQueryRequestSet reqSet = new TimeQueryRequestSet();
|
||||
reqSet.setRequests(queries.values().toArray(
|
||||
new TimeQueryRequest[queries.size()]));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<List<DataTime>> qResponses = (List<List<DataTime>>) ThriftClient
|
||||
.sendRequest(reqSet);
|
||||
int index = 0;
|
||||
for (AbstractRequestableLevelNode node : queries.keySet()) {
|
||||
// put results into cache
|
||||
node.setTimeQueryResults(false, qResponses.get(index++), cache,
|
||||
null);
|
||||
}
|
||||
List<List<DataTime>> finalResponse = new ArrayList<List<DataTime>>(
|
||||
requests.size());
|
||||
for (TimeQueryRequest request : requests) {
|
||||
List<AbstractRequestableLevelNode> requestNodes = evaluateRequestConstraints(request
|
||||
.getQueryTerms());
|
||||
// pull the actual results from the cache
|
||||
Set<DataTime> results = new HashSet<DataTime>(64);
|
||||
for (AbstractRequestableLevelNode requestNode : requestNodes) {
|
||||
Set<DataTime> times = requestNode.timeQuery(request, false,
|
||||
cache, null);
|
||||
if (times == AbstractRequestableLevelNode.TIME_AGNOSTIC) {
|
||||
// TODO: include time agnostic query in main bulk query as
|
||||
// each pressure level will cause a separate query
|
||||
List<DataTime> temp = timeAgnosticQuery(request
|
||||
.getQueryTerms());
|
||||
if (temp != null) {
|
||||
results.addAll(temp);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
results.addAll(times);
|
||||
}
|
||||
}
|
||||
if (!request.isMaxQuery() || results.isEmpty()) {
|
||||
finalResponse.add(new ArrayList<DataTime>(results));
|
||||
} else {
|
||||
ArrayList<DataTime> response = new ArrayList<DataTime>(results);
|
||||
Collections.sort(response);
|
||||
finalResponse
|
||||
.add(Arrays.asList(response.get(response.size() - 1)));
|
||||
}
|
||||
}
|
||||
return finalResponse;
|
||||
}
|
||||
|
||||
protected void getTimeQuery(
|
||||
TimeQueryRequest originalRequest,
|
||||
AbstractRequestableLevelNode req,
|
||||
boolean latestOnly,
|
||||
LinkedHashMap<AbstractRequestableLevelNode, TimeQueryRequest> queries,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
List<Dependency> depends = req.getDependencies();
|
||||
if (depends.isEmpty()) {
|
||||
// is source node
|
||||
TimeQueryRequest myQ = req.getTimeQuery(originalRequest,
|
||||
latestOnly, cache, latestOnlyCache);
|
||||
if (myQ != null) {
|
||||
// no need to merge timeQueries
|
||||
queries.put(req, myQ);
|
||||
}
|
||||
} else {
|
||||
for (Dependency dep : depends) {
|
||||
// TODO: Optimize dTime/fTime to use bulk query mechanism,
|
||||
// small case that is a not easy to get right with a bulk
|
||||
// query
|
||||
if (dep.timeOffset == 0 || !latestOnly) {
|
||||
getTimeQuery(originalRequest, dep.node, latestOnly,
|
||||
queries, cache, latestOnlyCache);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getPoints(java
|
||||
* .lang.String, java.lang.String[], java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public PointDataContainer getPoints(String plugin, String[] parameters,
|
||||
Map<String, RequestConstraint> queryParams) throws VizException {
|
||||
// TODO Someday we should put objective analysis code
|
||||
// into this area
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getPoints(java
|
||||
* .lang.String, java.lang.String[], java.lang.String, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public PointDataContainer getPoints(String plugin, String[] parameters,
|
||||
String levelKey, Map<String, RequestConstraint> queryParams)
|
||||
throws VizException {
|
||||
// TODO Someday we should put objective analysis code
|
||||
// into this area
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getData(com.raytheon
|
||||
* .uf.viz.core.catalog.LayerProperty, int)
|
||||
*/
|
||||
@Override
|
||||
public List<Object> getData(LayerProperty property, int timeOut)
|
||||
throws VizException {
|
||||
List<AbstractRequestableLevelNode> requests = evaluateRequestConstraints(property
|
||||
.getEntryQueryParameters(false));
|
||||
int mapSize = (int) (requests.size() * 1.25) + 1;
|
||||
Map<AbstractRequestableLevelNode, List<AbstractRequestableData>> cache = new HashMap<AbstractRequestableLevelNode, List<AbstractRequestableData>>(
|
||||
mapSize);
|
||||
LinkedHashMap<AbstractRequestableLevelNode, DbQueryRequest> queries = new LinkedHashMap<AbstractRequestableLevelNode, DbQueryRequest>(
|
||||
mapSize);
|
||||
for (AbstractRequestableLevelNode req : requests) {
|
||||
getDataQuery(req, property, timeOut, queries, cache);
|
||||
}
|
||||
DbQueryRequestSet reqSet = new DbQueryRequestSet();
|
||||
reqSet.setQueries(queries.values().toArray(
|
||||
new DbQueryRequest[queries.size()]));
|
||||
DbQueryResponseSet qSetResponse = (DbQueryResponseSet) ThriftClient
|
||||
.sendRequest(reqSet);
|
||||
DbQueryResponse[] qResponses = qSetResponse.getResults();
|
||||
int index = 0;
|
||||
for (AbstractRequestableLevelNode node : queries.keySet()) {
|
||||
// put results into cache
|
||||
node.setDataQueryResults(qResponses[index++], cache);
|
||||
}
|
||||
|
||||
// pull the actual results from the cache
|
||||
List<AbstractRequestableData> requesters = new ArrayList<AbstractRequestableData>(
|
||||
requests.size());
|
||||
for (AbstractRequestableLevelNode request : requests) {
|
||||
requesters.addAll(request.getData(property, timeOut, cache));
|
||||
}
|
||||
|
||||
return getData(property, requesters);
|
||||
}
|
||||
|
||||
protected void getDataQuery(
|
||||
AbstractRequestableLevelNode req,
|
||||
LayerProperty property,
|
||||
int timeOut,
|
||||
LinkedHashMap<AbstractRequestableLevelNode, DbQueryRequest> queries,
|
||||
Map<AbstractRequestableLevelNode, List<AbstractRequestableData>> cache)
|
||||
throws VizException {
|
||||
List<Dependency> depends = req.getDependencies();
|
||||
if (depends.isEmpty()) {
|
||||
// is source node
|
||||
DbQueryRequest myQ = req.getDataQuery(property, timeOut, cache);
|
||||
if (myQ != null) {
|
||||
addDataQuery(req, myQ, queries);
|
||||
}
|
||||
} else {
|
||||
for (Dependency dep : depends) {
|
||||
// TODO: Optimize dTime/fTime to use bulk query mechanism,
|
||||
// small case that is a not easy to get right with a bulk
|
||||
// query
|
||||
if (dep.timeOffset == 0) {
|
||||
getDataQuery(dep.node, property, timeOut, queries, cache);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addDataQuery(AbstractRequestableLevelNode req,
|
||||
DbQueryRequest query,
|
||||
LinkedHashMap<AbstractRequestableLevelNode, DbQueryRequest> queries) {
|
||||
DbQueryRequest curQuery = queries.get(req);
|
||||
if (curQuery == null) {
|
||||
queries.put(req, query);
|
||||
} else {
|
||||
// merge
|
||||
// assume same DB, fields, etc, should only be different
|
||||
// time constraints since its the same node
|
||||
RequestConstraint curDTs = curQuery.getConstraints()
|
||||
.get("dataTime");
|
||||
RequestConstraint myDTs = query.getConstraints().get("dataTime");
|
||||
if (curDTs != null && myDTs != null) {
|
||||
// only merge if both require dataTimes, otherwise one
|
||||
// would be constrained when it needs everything, also
|
||||
// assuming both to be in lists and needing to be merged
|
||||
curDTs.setConstraintType(ConstraintType.IN);
|
||||
Pattern split = Pattern.compile(",");
|
||||
|
||||
String[] curVals = split.split(curDTs.getConstraintValue());
|
||||
String[] myVals = split.split(myDTs.getConstraintValue());
|
||||
HashSet<String> dups = new HashSet<String>(curVals.length
|
||||
+ myVals.length);
|
||||
dups.addAll(Arrays.asList(curVals));
|
||||
dups.addAll(Arrays.asList(myVals));
|
||||
curDTs.setConstraintValueList(dups.toArray(new String[dups
|
||||
.size()]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#
|
||||
* getBaseUpdateConstraints(java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, RequestConstraint>> getBaseUpdateConstraints(
|
||||
Map<String, RequestConstraint> constraints) {
|
||||
List<Map<String, RequestConstraint>> result = new ArrayList<Map<String, RequestConstraint>>(
|
||||
1);
|
||||
result.add(constraints);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecord(com
|
||||
* .raytheon.uf.common.dataplugin.PluginDataObject)
|
||||
*/
|
||||
@Override
|
||||
public IDataRecord[] getRecord(PluginDataObject obj)
|
||||
throws VizDataCubeException {
|
||||
return getRecord(obj, Request.ALL, null);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.core.datastructure.IDataCubeAdapter#getRecord(com
|
||||
* .raytheon.uf.common.dataplugin.PluginDataObject,
|
||||
* com.raytheon.uf.common.datastorage.Request, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public IDataRecord[] getRecord(PluginDataObject obj, Request req,
|
||||
String dataset) throws VizDataCubeException {
|
||||
getRecords(Arrays.asList(obj), req, dataset);
|
||||
IDataRecord[] result = (IDataRecord[]) obj.getMessageData();
|
||||
obj.setMessageData(null);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan the inventory for AbstractRequestableLevelNodes that match the
|
||||
* request constraints
|
||||
*
|
||||
* @param constraints
|
||||
* @return
|
||||
*/
|
||||
protected abstract List<AbstractRequestableLevelNode> evaluateRequestConstraints(
|
||||
Map<String, RequestConstraint> constraints);
|
||||
|
||||
/**
|
||||
* @param queryTerms
|
||||
* @return
|
||||
*/
|
||||
protected abstract List<DataTime> timeAgnosticQuery(
|
||||
Map<String, RequestConstraint> queryTerms) throws VizException;
|
||||
|
||||
/**
|
||||
* @param requesters
|
||||
* @return
|
||||
*/
|
||||
protected abstract List<Object> getData(LayerProperty property,
|
||||
List<AbstractRequestableData> requesters) throws VizException;
|
||||
}
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.derivparam.inv;
|
|||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -32,6 +33,7 @@ import java.util.Set;
|
|||
import java.util.SortedSet;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.derivparam.tree.AbstractNode;
|
||||
|
@ -43,6 +45,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
|
|||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||
import com.raytheon.uf.viz.core.level.LevelUtilities;
|
||||
|
@ -179,9 +182,12 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
* tree and populates it with available derived parameters based on what is
|
||||
* available from the base parameters.
|
||||
*
|
||||
* @throws VizException
|
||||
*
|
||||
*
|
||||
*/
|
||||
public synchronized void initTree(Map<String, DerivParamDesc> derParLibrary) {
|
||||
public synchronized void initTree(Map<String, DerivParamDesc> derParLibrary)
|
||||
throws VizException {
|
||||
DerivedParameterGenerator.registerUpdateListener(this);
|
||||
if (derParLibrary == null) {
|
||||
this.derParLibrary = new HashMap<String, DerivParamDesc>(0);
|
||||
|
@ -189,7 +195,8 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
this.derParLibrary = derParLibrary;
|
||||
}
|
||||
long startTime = System.currentTimeMillis();
|
||||
DataTree newTree = createBaseTree();
|
||||
DataTree newTree = null;
|
||||
newTree = createBaseTree();
|
||||
if (newTree == null) {
|
||||
return;
|
||||
}
|
||||
|
@ -198,7 +205,13 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
allLevels = null;
|
||||
dataTree = newTree;
|
||||
for (SourceNode sourceNode : dataTree.getSourceNodes().values()) {
|
||||
doSupplement(sourceNode);
|
||||
try {
|
||||
doSupplement(sourceNode);
|
||||
} catch (VizCommunicationException e) {
|
||||
// TODO need to recover from this
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
}
|
||||
for (ParameterNode parameterNode : sourceNode.getChildNodes()
|
||||
.values()) {
|
||||
String value = parameterNode.getValue();
|
||||
|
@ -216,7 +229,11 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
|
||||
@Override
|
||||
public void updateDerParLibrary(Map<String, DerivParamDesc> derParLibrary) {
|
||||
initTree(derParLibrary);
|
||||
try {
|
||||
initTree(derParLibrary);
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public String getParameterUnit(String source, String parameter) {
|
||||
|
@ -254,8 +271,10 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
* Resolve any Supplement Derived Parameters.
|
||||
*
|
||||
* @param sNode
|
||||
* @throws VizCommunicationException
|
||||
*/
|
||||
private void doSupplement(SourceNode sNode) {
|
||||
private void doSupplement(SourceNode sNode)
|
||||
throws VizCommunicationException {
|
||||
Set<StackEntry> nodata = new HashSet<StackEntry>();
|
||||
Deque<StackEntry> stack = new ArrayDeque<StackEntry>();
|
||||
for (DerivParamDesc desc : derParLibrary.values()) {
|
||||
|
@ -300,7 +319,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
}
|
||||
}
|
||||
|
||||
protected abstract DataTree createBaseTree();
|
||||
protected abstract DataTree createBaseTree() throws VizException;
|
||||
|
||||
/**
|
||||
* Handle a query for a time agnostic node.
|
||||
|
@ -320,7 +339,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
protected Collection<String> getAllSources() {
|
||||
if (allSources == null) {
|
||||
if (dataTree == null) {
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
} else {
|
||||
return new ArrayList<String>(dataTree.getSources());
|
||||
}
|
||||
|
@ -452,10 +471,18 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
* See get allSources, same function but for levels
|
||||
*
|
||||
* @return
|
||||
* @throws VizCommunicationException
|
||||
*/
|
||||
protected Collection<Level> getAllLevels() {
|
||||
if (allLevels == null) {
|
||||
return LevelMappingFactory.getInstance().getAllLevels();
|
||||
try {
|
||||
return LevelMappingFactory.getInstance().getAllLevels();
|
||||
} catch (VizCommunicationException e) {
|
||||
// TODO recover from this.
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(),
|
||||
e);
|
||||
return Collections.emptyList();
|
||||
}
|
||||
} else {
|
||||
return allLevels;
|
||||
}
|
||||
|
@ -552,7 +579,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
|| levelsToProcess == null || sourcesToProcess.isEmpty()
|
||||
|| paramsToProcess.isEmpty() || levelsToProcess.isEmpty()
|
||||
|| derParLibrary == null) {
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (clazz != null) {
|
||||
// when clazz == null we need to link the aliases to the source
|
||||
|
@ -605,8 +632,13 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
Level level = lit.next();
|
||||
AbstractRequestableLevelNode result = null;
|
||||
if (derive) {
|
||||
result = resolveNode(node, param, level, stack,
|
||||
nodata);
|
||||
try {
|
||||
result = resolveNode(node, param, level, stack,
|
||||
nodata);
|
||||
} catch (VizCommunicationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
} else {
|
||||
ParameterNode pNode = node.getChildNode(param);
|
||||
result = (AbstractRequestableLevelNode) (pNode == null ? null
|
||||
|
@ -654,11 +686,17 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
List<AbstractRequestableLevelNode> choices = new ArrayList<AbstractRequestableLevelNode>();
|
||||
for (String aliasModel : sourceAliases
|
||||
.get(source)) {
|
||||
AbstractRequestableLevelNode alias;
|
||||
AbstractRequestableLevelNode alias = null;
|
||||
if (derive) {
|
||||
alias = resolveNode(
|
||||
dataTree.getSourceNode(aliasModel),
|
||||
param, level, stack, nodata);
|
||||
try {
|
||||
alias = resolveNode(
|
||||
dataTree.getSourceNode(aliasModel),
|
||||
param, level, stack, nodata);
|
||||
} catch (VizCommunicationException e) {
|
||||
statusHandler.handle(
|
||||
Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
} else {
|
||||
ParameterNode pNode = node
|
||||
.getChildNode(param);
|
||||
|
@ -722,10 +760,12 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
* @param stack
|
||||
* @param nodata
|
||||
* @return
|
||||
* @throws VizCommunicationException
|
||||
*/
|
||||
protected synchronized AbstractRequestableLevelNode resolveNode(
|
||||
SourceNode sourceNode, String param, Level level,
|
||||
Deque<StackEntry> stack, Set<StackEntry> nodata) {
|
||||
Deque<StackEntry> stack, Set<StackEntry> nodata)
|
||||
throws VizCommunicationException {
|
||||
ParameterNode pNode = sourceNode.getChildNode(param);
|
||||
LevelNode lNode = pNode == null ? null : pNode.getChildNode(Long
|
||||
.toString(level.getId()));
|
||||
|
@ -861,8 +901,14 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
}// method loop
|
||||
}
|
||||
if (level.isRangeLevel()) {
|
||||
Level upperLevel = level.getUpperLevel();
|
||||
Level lowerLevel = level.getLowerLevel();
|
||||
Level upperLevel;
|
||||
Level lowerLevel;
|
||||
try {
|
||||
upperLevel = level.getUpperLevel();
|
||||
lowerLevel = level.getLowerLevel();
|
||||
} catch (CommunicationException e) {
|
||||
throw new VizCommunicationException(e);
|
||||
}
|
||||
|
||||
List<AbstractRequestableLevelNode> nodes = new ArrayList<AbstractRequestableLevelNode>();
|
||||
int endCount = 0;
|
||||
|
@ -956,10 +1002,11 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
* @param nodata
|
||||
* @return Should be Either some IStaticData or an
|
||||
* AbstractRequestableLevelNode
|
||||
* @throws VizCommunicationException
|
||||
*/
|
||||
private synchronized Object resolveField(SourceNode sourceNode,
|
||||
Level level, IDerivParamField ifield, Deque<StackEntry> stack,
|
||||
Set<StackEntry> nodata) {
|
||||
Set<StackEntry> nodata) throws VizCommunicationException {
|
||||
// process the next field
|
||||
if (ifield.getClass() == DerivParamConstantField.class) {
|
||||
return new FloatRequestableData(
|
||||
|
@ -1004,10 +1051,14 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
if (type == null) {
|
||||
fieldLevel = level;
|
||||
} else if (level.isRangeLevel()) {
|
||||
if (type == LevelType.Upper) {
|
||||
fieldLevel = level.getUpperLevel();
|
||||
} else {
|
||||
fieldLevel = level.getLowerLevel();
|
||||
try {
|
||||
if (type == LevelType.Upper) {
|
||||
fieldLevel = level.getUpperLevel();
|
||||
} else {
|
||||
fieldLevel = level.getLowerLevel();
|
||||
}
|
||||
} catch (CommunicationException e) {
|
||||
throw new VizCommunicationException(e);
|
||||
}
|
||||
} else {
|
||||
SortedSet<Level> levels = null;
|
||||
|
@ -1067,7 +1118,7 @@ public abstract class AbstractInventory implements DerivParamUpdateListener {
|
|||
|
||||
protected abstract LevelNode getCubeNode(SourceNode sNode,
|
||||
DerivParamField field, Deque<StackEntry> stack,
|
||||
Set<StackEntry> nodata);
|
||||
Set<StackEntry> nodata) throws VizCommunicationException;
|
||||
|
||||
protected abstract AbstractDerivedLevelNode getImportNode(
|
||||
AbstractRequestableData nodeToImport, SourceNode destSourceNode,
|
||||
|
|
|
@ -29,6 +29,7 @@ import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
|||
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.adapters.UnitAdapter;
|
||||
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||
import com.raytheon.uf.viz.core.level.LevelMapping;
|
||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||
|
||||
|
@ -82,14 +83,14 @@ public class DerivParamField implements ISerializableObject, IDerivParamField {
|
|||
this.param = param;
|
||||
}
|
||||
|
||||
public LevelMapping getLevelMapping() {
|
||||
public LevelMapping getLevelMapping() throws VizCommunicationException {
|
||||
if (levelType == null && level != null) {
|
||||
setLevel(level);
|
||||
}
|
||||
return levelMapping;
|
||||
}
|
||||
|
||||
public LevelType getLevelType() {
|
||||
public LevelType getLevelType() throws VizCommunicationException {
|
||||
if (levelType == null && level != null) {
|
||||
setLevel(level);
|
||||
}
|
||||
|
@ -125,8 +126,9 @@ public class DerivParamField implements ISerializableObject, IDerivParamField {
|
|||
* @param level
|
||||
* @return true upon success, false if the token is not recognized, in which
|
||||
* case levelType and levelMapping will both be reset to null
|
||||
* @throws VizCommunicationException
|
||||
*/
|
||||
public boolean setLevel(String level) {
|
||||
public boolean setLevel(String level) throws VizCommunicationException {
|
||||
levelType = LevelType.parseLevel(level);
|
||||
if (levelType == LevelType.LevelMapping) {
|
||||
levelMapping = LevelMappingFactory.getInstance()
|
||||
|
|
|
@ -38,9 +38,8 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.status.StatusConstants;
|
||||
import com.raytheon.uf.viz.derivparam.Activator;
|
||||
|
||||
/**
|
||||
* Metadata about a derived parameter method.
|
||||
|
@ -61,7 +60,8 @@ import com.raytheon.uf.viz.derivparam.Activator;
|
|||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@XmlRootElement
|
||||
public class DerivParamMethod implements ISerializableObject {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(DerivParamMethod.class);
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(DerivParamMethod.class);
|
||||
|
||||
public enum FrameworkMethod {
|
||||
ALIAS, MODELRUN, TIMERANGE, OR, UNION, SUPPLEMENT, IMPORT, NODERIVATION;
|
||||
|
@ -149,7 +149,7 @@ public class DerivParamMethod implements ISerializableObject {
|
|||
fields.add(field);
|
||||
}
|
||||
|
||||
public Set<Level> getValidLevels() {
|
||||
public Set<Level> getValidLevels() throws VizCommunicationException {
|
||||
if (validLevels == null && levels != null && levels.length() > 0) {
|
||||
ValidLevelGenerator lvlGen = new ValidLevelGenerator();
|
||||
validLevels = lvlGen.generateLevels(levels);
|
||||
|
@ -253,13 +253,13 @@ public class DerivParamMethod implements ISerializableObject {
|
|||
tmp.append(pFieldTokens[k]);
|
||||
}
|
||||
|
||||
statusHandler.handle(
|
||||
Priority.SIGNIFICANT,
|
||||
"Derived parameter ["
|
||||
+ "field ["
|
||||
+ field.getParam()
|
||||
+ "], contains unknown parameter modifier ["
|
||||
+ tmp.toString() + "]");
|
||||
statusHandler
|
||||
.handle(Priority.SIGNIFICANT,
|
||||
"Derived parameter ["
|
||||
+ "field ["
|
||||
+ field.getParam()
|
||||
+ "], contains unknown parameter modifier ["
|
||||
+ tmp.toString() + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,10 +28,12 @@ import java.util.Map;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.comm.CommunicationException;
|
||||
import com.raytheon.uf.common.dataplugin.level.CompareType;
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataplugin.level.LevelFactory;
|
||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||
import com.raytheon.uf.viz.core.exception.VizCommunicationException;
|
||||
import com.raytheon.uf.viz.core.level.LevelMapping;
|
||||
import com.raytheon.uf.viz.core.level.LevelMappingFactory;
|
||||
|
||||
|
@ -72,7 +74,7 @@ public class ValidLevelGenerator {
|
|||
}
|
||||
|
||||
public Set<Level> generateLevels(String validLevelsString)
|
||||
throws IllegalArgumentException {
|
||||
throws IllegalArgumentException, VizCommunicationException {
|
||||
masterLevels = new HashMap<MasterLevel, Set<Level>>();
|
||||
validLevels = new HashSet<Level>();
|
||||
masterLevelsHandled = new HashSet<MasterLevel>();
|
||||
|
@ -121,7 +123,11 @@ public class ValidLevelGenerator {
|
|||
|
||||
if (tokensToProcess.size() > 0) {
|
||||
for (String token : tokensToProcess) {
|
||||
processLevelToken(token);
|
||||
try {
|
||||
processLevelToken(token);
|
||||
} catch (CommunicationException e) {
|
||||
throw new VizCommunicationException(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Set<Level> levels : masterLevels.values()) {
|
||||
|
@ -133,7 +139,8 @@ public class ValidLevelGenerator {
|
|||
return validLevels;
|
||||
}
|
||||
|
||||
private void processLevelToken(String token) {
|
||||
private void processLevelToken(String token)
|
||||
throws VizCommunicationException, CommunicationException {
|
||||
boolean negate = token.charAt(0) == '!';
|
||||
int rangeIndex = token.indexOf('>');
|
||||
|
||||
|
@ -318,7 +325,8 @@ public class ValidLevelGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
private Type determineType(String token) {
|
||||
private Type determineType(String token) throws CommunicationException,
|
||||
VizCommunicationException {
|
||||
Type rval = null;
|
||||
LevelMapping mapping = lmf.getLevelMappingForKey(token);
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Set;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.derivparam.library.DerivParamDesc;
|
||||
|
@ -67,11 +68,13 @@ public abstract class AbstractAliasLevelNode extends AbstractDerivedLevelNode {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
public Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
return sourceNode.timeQuery(latestOnly, cache, latestOnlyCache);
|
||||
return sourceNode.timeQuery(originalRequest, latestOnly, cache,
|
||||
latestOnlyCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,6 +31,7 @@ import java.util.Set;
|
|||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.CatalogQuery;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
|
@ -270,7 +271,8 @@ public abstract class AbstractCubeLevelNode extends AbstractDerivedLevelNode {
|
|||
Map<String, RequestConstraint> requestContraintsToFilter);
|
||||
|
||||
@Override
|
||||
public Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
public Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -299,8 +301,8 @@ public abstract class AbstractCubeLevelNode extends AbstractDerivedLevelNode {
|
|||
|
||||
results.addAll(mergedTimeQuery(merge(requests), latestOnly));
|
||||
for (AbstractRequestableLevelNode request : requests) {
|
||||
results.addAll(request
|
||||
.timeQuery(latestOnly, cache, latestOnlyCache));
|
||||
results.addAll(request.timeQuery(originalRequest, latestOnly,
|
||||
cache, latestOnlyCache));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
|
|
@ -243,7 +243,8 @@ public abstract class AbstractDerivedLevelNode extends
|
|||
}
|
||||
|
||||
@Override
|
||||
protected TimeQueryRequest getTimeQueryInternal(boolean latestOnly,
|
||||
protected TimeQueryRequest getTimeQueryInternal(
|
||||
TimeQueryRequest originalRequest, boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache)
|
||||
throws VizException {
|
||||
throw new UnsupportedOperationException(
|
||||
|
|
|
@ -205,7 +205,8 @@ public abstract class AbstractRequestableLevelNode extends LevelNode {
|
|||
protected abstract List<AbstractRequestableData> processDataQueryResults(
|
||||
DbQueryResponse queryResponse) throws VizException;
|
||||
|
||||
public Set<DataTime> timeQuery(boolean latestOnly,
|
||||
public Set<DataTime> timeQuery(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -215,15 +216,16 @@ public abstract class AbstractRequestableLevelNode extends LevelNode {
|
|||
return latestOnlyCache.get(this);
|
||||
}
|
||||
|
||||
Set<DataTime> results = timeQueryInternal(latestOnly, cache,
|
||||
latestOnlyCache);
|
||||
Set<DataTime> results = timeQueryInternal(originalRequest, latestOnly,
|
||||
cache, latestOnlyCache);
|
||||
if (cache != null && !latestOnly) {
|
||||
cache.put(this, results);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public TimeQueryRequest getTimeQuery(boolean latestOnly,
|
||||
public TimeQueryRequest getTimeQuery(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -233,7 +235,7 @@ public abstract class AbstractRequestableLevelNode extends LevelNode {
|
|||
return null;
|
||||
}
|
||||
|
||||
return getTimeQueryInternal(latestOnly, cache);
|
||||
return getTimeQueryInternal(originalRequest, latestOnly, cache);
|
||||
}
|
||||
|
||||
public void setTimeQueryResults(boolean latestOnly,
|
||||
|
@ -386,13 +388,14 @@ public abstract class AbstractRequestableLevelNode extends LevelNode {
|
|||
return rval;
|
||||
}
|
||||
|
||||
protected abstract Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
protected abstract Set<DataTime> timeQueryInternal(
|
||||
TimeQueryRequest originalRequest, boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException;
|
||||
|
||||
protected abstract TimeQueryRequest getTimeQueryInternal(
|
||||
boolean latestOnly,
|
||||
TimeQueryRequest originalRequest, boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache)
|
||||
throws VizException;
|
||||
|
||||
|
@ -408,8 +411,9 @@ public abstract class AbstractRequestableLevelNode extends LevelNode {
|
|||
Map<AbstractRequestableLevelNode, List<AbstractRequestableData>> cache)
|
||||
throws VizException;
|
||||
|
||||
protected Set<DataTime> timeQuery(boolean latestOnly) throws VizException {
|
||||
return timeQuery(latestOnly,
|
||||
protected Set<DataTime> timeQuery(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly) throws VizException {
|
||||
return timeQuery(originalRequest, latestOnly,
|
||||
new HashMap<AbstractRequestableLevelNode, Set<DataTime>>(),
|
||||
new HashMap<AbstractRequestableLevelNode, Set<DataTime>>());
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.dataplugin.level.Level;
|
||||
import com.raytheon.uf.common.dataquery.requests.TimeQueryRequest;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.viz.core.catalog.LayerProperty;
|
||||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
|
@ -102,7 +103,8 @@ public class CompositeAverageLevelNode extends UnionLevelNode {
|
|||
* boolean, java.util.Map)
|
||||
*/
|
||||
@Override
|
||||
public Set<DataTime> timeQueryInternal(boolean latestOnly,
|
||||
public Set<DataTime> timeQueryInternal(TimeQueryRequest originalRequest,
|
||||
boolean latestOnly,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> cache,
|
||||
Map<AbstractRequestableLevelNode, Set<DataTime>> latestOnlyCache)
|
||||
throws VizException {
|
||||
|
@ -114,8 +116,8 @@ public class CompositeAverageLevelNode extends UnionLevelNode {
|
|||
for (AbstractRequestableLevelNode request : requests) {
|
||||
// Do not request just latest only because if two nodes have
|
||||
// different latests than this will return no times
|
||||
Set<DataTime> times = request.timeQuery(false, cache,
|
||||
latestOnlyCache);
|
||||
Set<DataTime> times = request.timeQuery(originalRequest, false,
|
||||
cache, latestOnlyCache);
|
||||
if (times == TIME_AGNOSTIC) {
|
||||
continue;
|
||||
} else if (results == TIME_AGNOSTIC) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue