Merge branch 'master_14.4.1' into asm_14.4.1

Former-commit-id: 20231cb1f2 [formerly 5dea200def84ed80d2bc38e37e1fe9bf3ac5b26c]
Former-commit-id: 0072544dba
This commit is contained in:
Fay.Liang 2015-02-19 13:12:16 -05:00
commit 0bd2ea9ff2
139 changed files with 5242 additions and 2829 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
@ -21,8 +21,23 @@
<!DOCTYPE project [
<!ENTITY substitute-targets SYSTEM "substitute.xml">
]>
<project name="RCMPackageBuilder" default="deploy" basedir=".">
<!--
<property file="${basedir}/../../edexOsgi/build.edex/edex/common.properties" />
<condition property="ant.lib.dir" value="${basedir}/../../edexOsgi/build.edex/lib/ant/" else="${basedir}/../build.edex/lib/ant/">
<available file="${basedir}/../../edexOsgi/build.edex/lib/ant/ant-contrib-1.0b3.jar" />
</condition>
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${ant.lib.dir}/ant-contrib-1.0b3.jar" />
<path id="ant.classpath">
<fileset dir="${ant.lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<!--
This build script expects the following projects to exist at the same
level as this project's folder. com.raytheon.rcm.lib
com.raytheon.rcm.server com.raytheon.rcm.server.mq
@ -31,175 +46,226 @@
-->
&substitute-targets;
<description>
Builds a deployment of the RCM for packaging
</description>
<!-- set global properties for this build -->
<property environment="user" />
<property name="src" location="src" />
<property name="build" location="build" />
<property name="deploy.dir" location="Deploy" />
<!-- set global properties for this build -->
<property environment="user" />
<property name="props.dir" location="${basedir}/properties" />
<property file="${props.dir}/build-local.properties" />
<property name="src" location="src" />
<property name="build" location="build" />
<property name="deploy.dir" location="Deploy" />
<available file="${basedir}/tmp" property="tmp.ready" />
<property name="props.dir" location="${basedir}/properties" />
<property file="${props.dir}/build-local.properties" />
<condition property="pde.not.ready">
<and>
<isset property="pde.build" />
<not>
<isset property="tmp.ready" />
</not>
</and>
</condition>
<condition property="cots.dir" value="${basedir}/.." else="${basedir}/../../cots">
<available file="${basedir}/../org.springframework" />
</condition>
<available file="${basedir}/tmp" property="tmp.ready" />
<condition property="edexsrc.dir" value="${basedir}/.." else="${basedir}/../../edexOsgi">
<available file="${basedir}/../com.raytheon.uf.common.util" />
</condition>
<condition property="pde.not.ready">
<and>
<isset property="pde.build" />
<not>
<isset property="tmp.ready" />
</not>
</and>
</condition>
<!-- Set default EDEX install location for copy filter -->
<property name="def.edex.install.dir" value="/awips" />
<condition property="edex.home" value="$EdexBaseDir" else="${def.edex.install.dir}">
<isset property="installer"/>
</condition>
<!-- Create clean deployment -->
<target name="deploy">
<echo message="----------------------------------------------------------------"/>
<echo message=" deploying RCM to ${deploy.dir}"/>
<echo message=" PDE Build = ${pde.build}"/>
<echo message="----------------------------------------------------------------"/>
<antcall target="un.deploy" />
<antcall target="re.deploy" />
<antcall target="config.deploy" />
</target>
<condition property="top.dir" value="${basedir}/.." else="${basedir}/../../..">
<available file="${basedir}/../build.edex/lib/ant/ant-contrib-1.0b3.jar" />
</condition>
<!--
<condition property="core_foss_lib.dir" value="${basedir}/.." else="${top.dir}/${core-foss.repo}/lib">
<available file="${basedir}/../build.edex/lib/ant/ant-contrib-1.0b3.jar" />
</condition>
<condition property="a2_foss_lib.dir" value="${basedir}/.." else="${top.dir}/${awips2-foss.repo}/lib">
<available file="${basedir}/../build.edex/lib/ant/ant-contrib-1.0b3.jar" />
</condition>
<condition property="core_common.dir" value="${basedir}/.." else="${top.dir}/${core.repo}/common/">
<available file="${basedir}/../build.edex/lib/ant/ant-contrib-1.0b3.jar" />
</condition>
<!-- Only check for directories on development workstation-->
<if>
<equals arg1="${top.dir}" arg2="${basedir}/../../.." />
<then>
<property name="tab" value=" " />
<echo level="info" message=" " />
<echo level="info" message="Deploy checks the following directories for source:" />
<echo level="info" message=" " />
<for list="${core.repositories}" param="repository.directory">
<sequential>
<echo level="info" message="${tab}@{repository.directory}" />
<if>
<not>
<available file="${top.dir}/@{repository.directory}" type="dir" />
</not>
<then>
<echo level="error" message="${tab}@{repository.directory} does not exist!" />
<property name="missingDir" value="true" />
</then>
</if>
</sequential>
</for>
<if>
<isset property="missingDir" />
<then>
<echo level="error" message=" " />
<echo level="error" message="Edit core.repositories=${core.repositories} in common.properties, rename source directories or create a symlink!" />
<echo level="error" message=" " />
<fail message="Unable to locate source directories." />
</then>
</if>
<echo level="info" message=" " />
</then>
</if>
<property name="edexsrc.dir" value="${basedir}/../../edexOsgi"/>
<!-- Set default EDEX install location for copy filter -->
<property name="def.edex.install.dir" value="/awips" />
<condition property="edex.home" value="$EdexBaseDir" else="${def.edex.install.dir}">
<isset property="installer"/>
</condition>
<!-- Create clean deployment -->
<target name="deploy">
<echo message="----------------------------------------------------------------"/>
<echo message=" deploying RCM to ${deploy.dir}"/>
<echo message=" PDE Build = ${pde.build}"/>
<echo message="----------------------------------------------------------------"/>
<antcall target="un.deploy" />
<antcall target="re.deploy" />
<antcall target="config.deploy" />
</target>
<!--
Deploy on top of existing deployment. Old files not removed nor is the
configuration file changed.
-->
<target name="re.deploy">
<mkdir dir="${deploy.dir}" />
<mkdir dir="${deploy.dir}/bin" />
<mkdir dir="${deploy.dir}/lib" />
<mkdir dir="${deploy.dir}/data" />
<!-- copy with filter -->
<copy todir="${deploy.dir}" verbose="false">
<filterset refid="installer.filter.set" />
<fileset dir="bits">
<include name="bin/*" />
</fileset>
</copy>
<chmod perm="a-w,a+x">
<fileset dir="${deploy.dir}/bin">
<include name="*" />
</fileset>
</chmod>
<!--
<target name="re.deploy">
<mkdir dir="${deploy.dir}" />
<mkdir dir="${deploy.dir}/bin" />
<mkdir dir="${deploy.dir}/lib" />
<mkdir dir="${deploy.dir}/data" />
<!-- copy with filter -->
<copy todir="${deploy.dir}" verbose="false">
<filterset refid="installer.filter.set" />
<fileset dir="bits">
<include name="bin/*" />
</fileset>
</copy>
<chmod perm="a-w,a+x">
<fileset dir="${deploy.dir}/bin">
<include name="*" />
</fileset>
</chmod>
<!--
Not all of these files should be made executable. Need to know all
executable names... or all non-executables...
-->
<copy todir="${deploy.dir}/bin" verbose="false">
<fileset dir="../com.raytheon.rcm.tools/src">
<include name="*.py" />
</fileset>
</copy>
<chmod perm="a+x">
<fileset dir="${deploy.dir}/bin">
<include name="*.py" />
<exclude name="stomp.py" />
</fileset>
</chmod>
<chmod perm="a-w">
<fileset dir="${deploy.dir}/bin">
<include name="*.py" />
</fileset>
</chmod>
<copy todir="${deploy.dir}/bin" verbose="false">
<fileset dir="../com.raytheon.rcm.tools/src">
<include name="*.py" />
</fileset>
</copy>
<chmod perm="a+x">
<fileset dir="${deploy.dir}/bin">
<include name="*.py" />
<exclude name="stomp.py" />
</fileset>
</chmod>
<chmod perm="a-w">
<fileset dir="${deploy.dir}/bin">
<include name="*.py" />
</fileset>
</chmod>
<copy todir="${deploy.dir}/lib" flatten="true">
<fileset dir="${cots.dir}/org.apache.activemq" includes="**/*.jar" />
<fileset dir="${cots.dir}/org.apache.qpid" includes="**/*.jar" />
<fileset dir="${cots.dir}/org.slf4j" includes="**/*.jar">
<include name="**/jcl-over-slf4j*.jar" />
<include name="**/jul-to-slf4j*.jar" />
<include name="**/slf4j-api*.jar" />
</fileset>
<fileset dir="${cots.dir}/org.apache.commons.beanutils" includes="**/*.jar" />
<fileset dir="${cots.dir}/org.apache.commons.codec" includes="**/*.jar" />
<fileset dir="${cots.dir}/org.apache.commons.collections" includes="**/*.jar" />
<fileset dir="${cots.dir}/org.apache.commons.lang" includes="**/*.jar" />
<fileset dir="${cots.dir}/ch.qos.logback" includes="**/*.jar" />
<fileset dir="${cots.dir}/javax.jms" includes="**/*.jar" />
<fileset dir="${cots.dir}/org.springframework">
<include name="**/*spring*beans*.jar" />
<include name="**/*spring*context*.jar" />
</fileset>
<fileset dir="${cots.dir}/org.itadaki.bzip2" includes="**/*.jar" />
<fileset dir="${cots.dir}/org.quartz" includes="**/*.jar" />
</copy>
<copy todir="${deploy.dir}/lib" flatten="true">
<fileset dir="${core_foss_lib.dir}/org.apache.activemq" includes="**/*.jar" />
<fileset dir="${core_foss_lib.dir}/org.apache.qpid" includes="**/*.jar" />
<fileset dir="${core_foss_lib.dir}/org.slf4j" includes="**/*.jar">
<include name="**/jcl-over-slf4j*.jar" />
<include name="**/jul-to-slf4j*.jar" />
<include name="**/slf4j-api*.jar" />
</fileset>
<fileset dir="${core_foss_lib.dir}/org.apache.commons.beanutils" includes="**/*.jar" />
<fileset dir="${core_foss_lib.dir}/org.apache.commons.codec" includes="**/*.jar" />
<fileset dir="${core_foss_lib.dir}/org.apache.commons.collections" includes="**/*.jar" />
<fileset dir="${core_foss_lib.dir}/org.apache.commons.lang" includes="**/*.jar" />
<fileset dir="${core_foss_lib.dir}/ch.qos.logback" includes="**/*.jar" />
<fileset dir="${core_foss_lib.dir}/javax.jms" includes="**/*.jar" />
<fileset dir="${core_foss_lib.dir}/org.springframework">
<include name="**/*spring*beans*.jar" />
<include name="**/*spring*context*.jar" />
</fileset>
<fileset dir="${a2_foss_lib.dir}/org.itadaki.bzip2" includes="**/*.jar" />
<fileset dir="${core_foss_lib.dir}/org.quartz" includes="**/*.jar" />
</copy>
<delete dir="bin" />
<mkdir dir="bin" />
<antcall target="local.jar" />
<antcall target="pde.jar" />
<jar destfile="${deploy.dir}/lib/radarserver-mq.jar" basedir="bin" />
<delete dir="bin" />
</target>
<delete dir="bin" />
<mkdir dir="bin" />
<antcall target="local.jar" />
<antcall target="pde.jar" />
<jar destfile="${deploy.dir}/lib/radarserver-mq.jar" basedir="bin" />
<delete dir="bin" />
</target>
<target name="local.jar" if="pde.build">
<copy toDir="bin">
<fileset dir="tmp/plugins/com.raytheon.rcm.lib/@dot"
<target name="local.jar" if="pde.build">
<copy toDir="bin">
<fileset dir="tmp/plugins/com.raytheon.rcm.lib/@dot"
includes="**/*.class" />
<fileset dir="tmp/plugins/com.raytheon.rcm.lib/@dot"
<fileset dir="tmp/plugins/com.raytheon.rcm.lib/@dot"
includes="**/*.txt" />
<fileset dir="tmp/plugins/com.raytheon.rcm.server/@dot"
<fileset dir="tmp/plugins/com.raytheon.rcm.server/@dot"
includes="**/*.class" />
<fileset dir="tmp/plugins/com.raytheon.rcm.server.mq/@dot"
<fileset dir="tmp/plugins/com.raytheon.rcm.server.mq/@dot"
includes="**/*.class" />
<fileset dir="tmp/plugins/com.raytheon.rcm.server.mq/@dot"
<fileset dir="tmp/plugins/com.raytheon.rcm.server.mq/@dot"
includes="**/*.txt" />
<fileset dir="tmp/plugins/com.raytheon.uf.common.util/@dot"
<fileset dir="tmp/plugins/com.raytheon.uf.common.util/@dot"
includes="**/*.class" />
</copy>
</target>
</copy>
</target>
<target name="pde.jar" unless="pde.build">
<copy todir="bin">
<fileset dir="../com.raytheon.rcm.lib/bin" includes="**/*.class" />
<fileset dir="../com.raytheon.rcm.lib/bin" includes="**/*.txt" />
<fileset dir="../com.raytheon.rcm.server/bin" includes="**/*.class" />
<fileset dir="../com.raytheon.rcm.server.mq/bin" includes="**/*.class" />
<fileset dir="../com.raytheon.rcm.server.mq/bin" includes="**/*.txt" />
<fileset dir="${edexsrc.dir}/com.raytheon.uf.common.util/bin" includes="**/*.class" />
</copy>
</target>
<target name="pde.jar" unless="pde.build">
<copy todir="bin">
<fileset dir="../com.raytheon.rcm.lib/bin" includes="**/*.class" />
<fileset dir="../com.raytheon.rcm.lib/bin" includes="**/*.txt" />
<fileset dir="../com.raytheon.rcm.server/bin" includes="**/*.class" />
<fileset dir="../com.raytheon.rcm.server.mq/bin" includes="**/*.class" />
<fileset dir="../com.raytheon.rcm.server.mq/bin" includes="**/*.txt" />
<fileset dir="${core_common.dir}/com.raytheon.uf.common.util/bin" includes="**/*.class" />
</copy>
</target>
<target name="config.deploy">
<copy todir="${deploy.dir}" verbose="false">
<filterset refid="installer.filter.set" />
<fileset dir="cfgbits">
<include name="**/*" />
<exclude name="**/config.xml"/>
</fileset>
</copy>
<!-- this is required because config.xml contains an '@' in a url -->
<copy todir="${deploy.dir}" verbose="false">
<filterset refid="config.xml.filter.set"/>
<fileset dir="cfgbits">
<include name="**/config.xml"/>
</fileset>
</copy>
</target>
<target name="config.deploy">
<copy todir="${deploy.dir}" verbose="false">
<filterset refid="installer.filter.set" />
<fileset dir="cfgbits">
<include name="**/*" />
<exclude name="**/config.xml"/>
</fileset>
</copy>
<!-- this is required because config.xml contains an '@' in a url -->
<copy todir="${deploy.dir}" verbose="false">
<filterset refid="config.xml.filter.set"/>
<fileset dir="cfgbits">
<include name="**/config.xml"/>
</fileset>
</copy>
</target>
<target name="un.deploy">
<delete dir="${deploy.dir}"></delete>
</target>
<target name="un.deploy">
<delete dir="${deploy.dir}">
</delete>
</target>
</project>

View file

@ -33,7 +33,7 @@
# Jul 10, 2014 #3363 bclement logs command used to launch application to console logs
# Oct 10, 2014 #3675 njensen Logback now does console logging to ensure correct pid
# Oct 13, 2014 #3675 bclement startup shutdown log includes both launching pid and placeholder
#
# Jan 28, 2015 #4018 randerso Added a productEditor log file to changes in the GFE product editor
#
@ -218,6 +218,7 @@ curTime=`date +%Y%m%d_%H%M%S`
export LOGFILE_CAVE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_logs.log"
export LOGFILE_CONSOLE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_console.log"
export LOGFILE_PERFORMANCE="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_perf.log"
export LOGFILE_PRODUCT_EDITOR="${LOGDIR}/${PROGRAM_NAME}_${curTime}_pid_%PID%_productEditor.log"
# can we write to log directory
if [ -w ${LOGDIR} ]; then

View file

@ -82,11 +82,11 @@ import com.vividsolutions.jts.geom.Geometry;
* Oct.31 2012 1297 skorolev Clean code
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Sep 23, 2014 3356 njensen Remove unnecessary import
* Oct 16, 2014 3220 skorolev Corrected fogConfig assignment.
* Dec 11, 2014 3220 skorolev Moved refreshing of table in the UI thread.
* Jan 08, 2015 3220 skorolev Replaced MonitoringArea with fogConfig.
* Sep 04, 2014 3220 skorolev
* Sep 23, 2014 3356 njensen Remove unnecessary import
* Jan 27, 2015 3220 skorolev Corrected fogConfig assignment.Moved refreshing of table in the UI thread.
* Updated configUpdate method and added updateMonitoringArea.
* Replaced MonitoringArea with fogConfig.Updated code for better performance.
*
*
* </pre>
@ -104,21 +104,12 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
/** Singleton instance of this class */
private static FogMonitor monitor = null;
/**
* This object contains all observation data necessary for the table dialogs
* and trending plots [this replaces the objects of ObsData and TableData
* below Jan 21, 2010, zhao]
*/
private ObMultiHrsReports obData;
/** data holder for FOG **/
private ObsData obsData;
/** data holder for FOG ALG data **/
private SortedMap<Date, Map<String, FOG_THREAT>> algorithmData = null;
private Date dialogTime = null;
/** list of coordinates for each zone **/
private Map<String, Geometry> zoneGeometries = null;
@ -129,7 +120,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
private MonitoringAreaConfigDlg areaDialog = null;
/** area config manager **/
private FSSObsMonitorConfigurationManager fogConfig = null;
private static FSSObsMonitorConfigurationManager fogConfig = null;
/** table data for the station table **/
private final TableData stationTableData = new TableData(
@ -162,7 +153,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
obData.setThresholdMgr(FogThresholdMgr.getInstance());
obData.getZoneTableData();
}
/**
@ -173,14 +163,10 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
public static synchronized FogMonitor getInstance() {
if (monitor == null) {
monitor = new FogMonitor();
// Pre-populate dialog with an observations from DB
monitor.createDataStructures();
monitor.getAdjAreas();
List<String> zones = monitor.fogConfig.getAreaList();
monitor.processProductAtStartup(zones);
monitor.fireMonitorEvent(monitor);
monitor.processProductAtStartup(fogConfig);
}
return monitor;
}
@ -204,7 +190,6 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
// [Jan 21, 2010, zhao]
obData = new ObMultiHrsReports(CommonConfig.AppName.FOG);
obData.setThresholdMgr(FogThresholdMgr.getInstance());
obsData = new ObsData();
algorithmData = new TreeMap<Date, Map<String, FOG_THREAT>>();
@ -247,8 +232,7 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
@Override
public void processProductMessage(final AlertMessage filtered) {
if (fogPattern.matcher(filtered.dataURI).matches()) {
List<String> zones = fogConfig.getAreaList();
processURI(filtered.dataURI, filtered, zones);
processURI(filtered.dataURI, filtered, fogConfig);
}
}
@ -285,8 +269,9 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
@Override
public void configUpdate(IMonitorConfigurationEvent me) {
fogConfig = (FSSObsMonitorConfigurationManager) me.getSource();
obData.getObHourReports().updateZones(fogConfig);
if (zoneDialog != null && !zoneDialog.isDisposed()) {
zoneDialog.refreshZoneTableData(obData);
obData.updateTableCache();
fireMonitorEvent(zoneDialog.getClass().getName());
}
}
@ -320,6 +305,8 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
@Override
protected void process(ObReport result) throws Exception {
obData.addReport(result);
// update table cache
obData.getZoneTableData(result.getRefHour());
// Get zones containing station
List<String> zones = fogConfig.getAreaByStationId(result
.getPlatformId());
@ -328,10 +315,10 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
AreaContainer ac = getTableData().getArea(zn);
if (ac != null) {
ac.addReport(result.getObservationTime(), result);
fireMonitorEvent(this);
}
}
}
fireMonitorEvent(this);
}
/**
@ -351,26 +338,20 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
*/
public void launchDialog(String type, Shell shell) {
if (type.equals("zone")) {
if (zoneDialog == null) {
zoneDialog = new FogZoneTableDlg(shell, obData);
addMonitorListener(zoneDialog);
zoneDialog.addMonitorControlListener(this);
fireMonitorEvent(zoneDialog.getClass().getName());
}
zoneDialog = new FogZoneTableDlg(shell, obData);
addMonitorListener(zoneDialog);
zoneDialog.addMonitorControlListener(this);
zoneDialog.open();
} else if (type.equals("area")) {
if (areaDialog == null) {
areaDialog = new FogMonitoringAreaConfigDlg(shell,
"Fog Monitor Area Configuration");
areaDialog.setCloseCallback(new ICloseCallback() {
areaDialog = new FogMonitoringAreaConfigDlg(shell,
"Fog Monitor Area Configuration");
areaDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
areaDialog = null;
}
});
}
@Override
public void dialogClosed(Object returnValue) {
areaDialog = null;
}
});
areaDialog.open();
}
}
@ -490,21 +471,18 @@ public class FogMonitor extends ObsMonitor implements IFogResourceListener {
*
* @param drawTime
*/
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ObsMonitor#updateDialogTime(java.util.Date)
*/
@Override
public void updateDialogTime(Date dialogTime) {
this.dialogTime = dialogTime;
fireMonitorEvent(zoneDialog.getClass().getName());
}
/**
* The date for the dialog to stay in step with
*
* @return
*/
public Date getDialogDate() {
return dialogTime;
}
/*
* (non-Javadoc)
*

View file

@ -51,7 +51,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Oct 16, 2014 3220 skorolev Corrected getInstance() method.
* Oct 27, 2014 3667 skorolev Cleaned code.
* Nov 21, 2014 3841 skorolev Corrected handleOkBtnSelection.
* Dec 11, 2014 3220 skorolev Removed unnecessary code.
* Dec 11, 2014 3220 skorolev Removed unnecessary code.
* Feb 03, 2015 3841 skorolev Replaced resetParams with resetStatus.
*
* </pre>
*
@ -71,7 +72,6 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
public FogMonitoringAreaConfigDlg(Shell parent, String title) {
super(parent, title, AppName.FOG);
FogMonitor.getInstance();
}
/*
@ -110,7 +110,7 @@ public class FogMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
* using new monitor area configuration
*/
fireConfigUpdateEvent();
resetParams();
resetStatus();
} else { // Return back to continue edit.
return;
}

View file

@ -58,9 +58,9 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* Dec 03, 2012 15216/15639 zhao fixed a bug related to Link-to-Frame
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Oct 16, 2014 3220 skorolev Corrected configMgr assignment.
*
* Jan 27, 2015 3220 skorolev Removed "site".Added check on dispose.Corrected configMgr assignment.
* Added table cache update.
* Feb 04, 2015 3841 skorolev Corrected notify method for empty table update.
* </pre>
*
* @author ?
@ -80,6 +80,9 @@ public class FogZoneTableDlg extends ZoneTableDlg {
public FogZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
super(parent, obData, CommonConfig.AppName.FOG);
configMgr = FSSObsMonitorConfigurationManager.getFogObsManager();
obData.updateTableCache();
zoneTblData = obData.getZoneTableData();
zoneTblData.sortData();
}
/**
@ -146,12 +149,11 @@ public class FogZoneTableDlg extends ZoneTableDlg {
// The algorithm output.
if (me.getSource() instanceof FogMonitor) {
FogMonitor fog = (FogMonitor) me.getSource();
Date date = fog.getDialogDate();
ObMultiHrsReports obData = fog.getObData();
Date date = fog.getDialogTime();
if (date != null) {
Date nominalTime = date;
ObMultiHrsReports obData = fog.getObData();
if (!isLinkedToFrame()) {
nominalTime = obData.getLatestNominalTime();
}
@ -160,33 +162,12 @@ public class FogZoneTableDlg extends ZoneTableDlg {
.getAlgorithmData(nominalTime));
obData.setFogAlgCellType(fogAlgCellType);
this.updateTableDlg(obData.getObHourReports(nominalTime));
} else {
this.updateZoneTable(obData.getLatestNominalTime());
}
}
}
/**
* Jan 25, 2010, #4281, zhao, Modified to pass an ObMultiHrsReports object
* to table dialog
*
* @Override public void notify(IMonitorEvent me) { if
* (zoneTable.isDisposed()) return;
*
* if (me.getSource() instanceof FogMonitor) { FogMonitor monitor
* = (FogMonitor)me.getSource();
* this.updateTableDlg(monitor.getObData()); }
*
* //if (me.getSource() instanceof FogMonitor) { //
* IMPORTANT!!!!!! For now we just grab the most recent time from
* the OBSTable // When we have the CAVE rendering working we will
* grab it from the CaveResource! // Date date = new Date(); //
* FogMonitor fog = (FogMonitor)me.getSource(); //
* FogDataGenerator fdg = new FogDataGenerator(); // TableData
* tZoneTableData = fdg.generateZoneData(fog.getTableData(),
* fog.getAlgorithmData(), date); //
* updateZoneTable(tZoneTableData, fog.getStationTableData(),
* date); //} }
*/
/*
* (non-Javadoc)
*

View file

@ -81,11 +81,9 @@ import com.vividsolutions.jts.geom.Geometry;
* Oct 26, 2012 1280 skorolev Clean code and made changes for non-blocking dialog
* Oct 30, 2012 1297 skorolev Changed HashMap to Map
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Oct 16, 2014 3220 skorolev Corrected ssAreaConfig assignment.
* Dec 11, 2014 3220 skorolev Moved refreshing of table in the UI thread.
* Jan 08, 2015 3220 skorolev Replaced MonitoringArea with ssAreaConfig.
* Jan 27, 2015 3220 skorolev Removed local getMonitorAreaConfig method.Updated configUpdate method and added updateMonitoringArea.
* Corrected ssAreaConfig assignment. Moved refreshing of table in the UI thread.
* Replaced MonitoringArea with ssAreaConfig.Updated code for better performance.
*
* </pre>
*
@ -109,13 +107,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
private SSMonitoringAreaConfigDlg areaDialog = null;
/** configuration manager **/
private FSSObsMonitorConfigurationManager ssAreaConfig = null;
/**
* This object contains all observation data necessary for the table dialogs
* and trending plots
*/
private ObMultiHrsReports obData;
private static FSSObsMonitorConfigurationManager ssAreaConfig = null;
/** table data for the zone table **/
private final TableData zoneTableData = new TableData(
@ -134,9 +126,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
/** List of SAFESEAS resource listeners **/
private final List<ISSResourceListener> safeSeasResources = new ArrayList<ISSResourceListener>();
/** Time which Zone/County dialog shows. **/
private Date dialogTime = null;
/** list of coordinates for each zone **/
private Map<String, Geometry> zoneGeometries = null;
@ -164,7 +153,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SAFESEAS);
obData.setThresholdMgr(SSThresholdMgr.getInstance());
obData.getZoneTableData();
}
/**
@ -173,12 +161,9 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
public static synchronized SafeSeasMonitor getInstance() {
if (monitor == null) {
monitor = new SafeSeasMonitor();
// Pre-populate dialog with an observation (METAR) for KOMA
monitor.createDataStructures();
monitor.getAdjAreas();
List<String> zones = monitor.ssAreaConfig.getAreaList();
monitor.processProductAtStartup(zones);
monitor.fireMonitorEvent(monitor);
monitor.processProductAtStartup(ssAreaConfig);
}
return monitor;
}
@ -213,26 +198,21 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
*/
public void launchDialog(String type, Shell shell) {
if (type.equals("zone")) {
if (zoneDialog == null) {
zoneDialog = new SSZoneTableDlg(shell, obData);
addMonitorListener(zoneDialog);
zoneDialog.addMonitorControlListener(this);
fireMonitorEvent(zoneDialog.getClass().getName());
}
zoneDialog = new SSZoneTableDlg(shell, obData);
addMonitorListener(zoneDialog);
zoneDialog.addMonitorControlListener(this);
zoneDialog.open();
} else if (type.equals("area")) {
if (areaDialog == null) {
areaDialog = new SSMonitoringAreaConfigDlg(shell,
"SAFESEAS Monitor Area Configuration");
areaDialog.setCloseCallback(new ICloseCallback() {
areaDialog = new SSMonitoringAreaConfigDlg(shell,
"SAFESEAS Monitor Area Configuration");
areaDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
areaDialog = null;
}
@Override
public void dialogClosed(Object returnValue) {
areaDialog = null;
}
});
}
});
areaDialog.open();
}
}
@ -271,8 +251,7 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
@Override
public void processProductMessage(final AlertMessage filtered) {
if (ssPattern.matcher(filtered.dataURI).matches()) {
final List<String> zones = ssAreaConfig.getAreaList();
processURI(filtered.dataURI, filtered, zones);
processURI(filtered.dataURI, filtered, ssAreaConfig);
}
}
@ -328,8 +307,11 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
@Override
public void configUpdate(IMonitorConfigurationEvent me) {
ssAreaConfig = (FSSObsMonitorConfigurationManager) me.getSource();
zoneDialog.refreshZoneTableData(obData);
fireMonitorEvent(zoneDialog.getClass().getName());
obData.getObHourReports().updateZones(ssAreaConfig);
if (zoneDialog != null && !zoneDialog.isDisposed()) {
obData.updateTableCache();
fireMonitorEvent(zoneDialog.getClass().getName());
}
}
/**
@ -383,6 +365,8 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
@Override
protected void process(ObReport result) throws Exception {
obData.addReport(result);
// update table cache
obData.getZoneTableData(result.getRefHour());
fireMonitorEvent(this);
}
@ -391,30 +375,18 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
*
* @param dialogTime
*/
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.ObsMonitor#updateDialogTime(java.util.Date)
*/
@Override
public void updateDialogTime(Date dialogTime) {
this.dialogTime = dialogTime;
fireMonitorEvent(zoneDialog.getClass().getName());
}
/**
* Gets Dialog Time.
*
* @return dialogTime
*/
public Date getDialogTime() {
return dialogTime;
}
/**
* Sets the dialogTime
*
* @param dialogTime
*/
public void setDialogTime(Date dialogTime) {
this.dialogTime = dialogTime;
}
/**
* Adds recourse listener
*
@ -460,7 +432,6 @@ public class SafeSeasMonitor extends ObsMonitor implements ISSResourceListener {
*/
@Override
public ArrayList<Date> getTimeOrderedKeys(IMonitor monitor, String type) {
// Not used
return null;
}

View file

@ -200,14 +200,6 @@ public class SafeSeasResourceData extends AbstractRequestableResourceData {
return fogThreatSS;
}
/** Get the SafeSeasMonitor monitor **/
protected SafeSeasMonitor getFogMonitor() {
if (monitor == null) {
monitor = SafeSeasMonitor.getInstance();
}
return monitor;
}
/**
* @return plotSource
*/

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Oct 27, 2014 3667 skorolev Cleaned code.
* Nov 21, 2014 3841 skorolev Corrected handleOkBtnSelection.
* Dec 11, 2014 3220 skorolev Removed unnecessary code.
* Feb 03, 2015 3841 skorolev Replaced resetParams with resetStatus.
*
*
* </pre>
@ -72,7 +73,6 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
public SSMonitoringAreaConfigDlg(Shell parent, String title) {
super(parent, title, AppName.SAFESEAS);
SafeSeasMonitor.getInstance();
}
@Override
@ -102,7 +102,7 @@ public class SSMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
}
}
fireConfigUpdateEvent();
resetParams();
resetStatus();
} else { // Return back to continue edit.
return;
}

View file

@ -54,10 +54,11 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
* Dec 30, 2009 3424 zhao use ObMultiHrsReports for obs data archive
* Oct 30, 2012 1297 skorolev Changed HashMap to Map
* Nov 10, 2012 1297 skorolev Added initiateProdArray
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs.
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Oct 16, 2014 3220 skorolev Corrected configMgr assignment.
* Jan 27, 2015 3220 skorolev Removed "site". Added check on dispose.Corrected configMgr assignment.
* Added table cache update.
* Feb 04, 2015 3841 skorolev Corrected notify method for empty table update.
*
* </pre>
*
@ -81,6 +82,9 @@ public class SSZoneTableDlg extends ZoneTableDlg {
public SSZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
super(parent, obData, CommonConfig.AppName.SAFESEAS);
configMgr = FSSObsMonitorConfigurationManager.getSsObsManager();
obData.updateTableCache();
zoneTblData = obData.getZoneTableData();
zoneTblData.sortData();
}
/**
@ -151,10 +155,10 @@ public class SSZoneTableDlg extends ZoneTableDlg {
if (me.getSource() instanceof SafeSeasMonitor) {
SafeSeasMonitor monitor = (SafeSeasMonitor) me.getSource();
ObMultiHrsReports obData = monitor.getObData();
Date date = monitor.getDialogTime();
if (date != null) {
Date nominalTime = date;
ObMultiHrsReports obData = monitor.getObData();
if (!isLinkedToFrame()) {
nominalTime = obData.getLatestNominalTime();
}
@ -163,6 +167,8 @@ public class SSZoneTableDlg extends ZoneTableDlg {
obData.setFogAlgCellType(monitor.getAlgCellTypes(fogAlgThreats));
this.updateTableDlg(monitor.getObData().getObHourReports(
nominalTime));
} else {
this.updateZoneTable(obData.getLatestNominalTime());
}
}
}
@ -280,7 +286,7 @@ public class SSZoneTableDlg extends ZoneTableDlg {
* setZoneSortColumnAndDirection()
*/
@Override
protected void setZoneSortColumnAndDirection() {
public void setZoneSortColumnAndDirection() {
if (zoneTblData != null) {
zoneSortColumn = zoneTblData.getSortColumn();
zoneSortDirection = zoneTblData.getSortDirection();

View file

@ -20,7 +20,6 @@
package com.raytheon.uf.viz.monitor.snow;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.regex.Pattern;
@ -69,10 +68,10 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Nov. 1, 2012 1297 skorolev Changed HashMap to Map and clean code
* Feb 15, 2013 1638 mschenke Changed code to reference DataURI.SEPARATOR instead of URIFilter
* Apr 28, 2014 3086 skorolev Removed local getMonitorAreaConfig method.
* Sep 04, 2014 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Oct 16, 2014 3220 skorolev Corrected snowConfig assignment.
* Dec 11, 2014 3220 skorolev Moved refreshing of table in the UI thread.
* Jan 08, 2015 3220 skorolev Replaced MonitoringArea with snowAreaConfig.
* Jan 27, 2015 3220 skorolev Updated configUpdate method and added updateMonitoringArea.
* Corrected snowConfig assignment.Corrected snowConfig assignment.
* Moved refreshing of table in the UI thread.Replaced MonitoringArea with snowAreaConfig.
* Updated code for better performance.
*
* </pre>
*
@ -96,13 +95,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
private SnowMonitoringAreaConfigDlg areaDialog = null;
/** SNOW configuration manager **/
private FSSObsMonitorConfigurationManager snowAreaConfig = null;
/**
* This object contains all observation data necessary for the table dialogs
* and trending plots
*/
private ObMultiHrsReports obData;
private static FSSObsMonitorConfigurationManager snowAreaConfig = null;
/** All SNOW datauri start with this */
private final String OBS = "fssobs";
@ -110,9 +103,6 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
/** regex wild card filter */
private final String wildCard = "[\\w\\(\\)-_:.]+";
/** Time which Zone/County dialog shows. **/
private Date dialogTime = null;
/** Array of snow listeners **/
private final List<ISnowResourceListener> snowResources = new ArrayList<ISnowResourceListener>();
@ -131,7 +121,6 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
initObserver(OBS, this);
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);
obData.setThresholdMgr(SnowThresholdMgr.getInstance());
obData.getZoneTableData();
}
/**
@ -142,13 +131,17 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
public static synchronized SnowMonitor getInstance() {
if (monitor == null) {
monitor = new SnowMonitor();
List<String> zones = monitor.snowAreaConfig.getAreaList();
monitor.processProductAtStartup(zones);
monitor.fireMonitorEvent(monitor);
monitor.createDataStructures();
monitor.processProductAtStartup(snowAreaConfig);
}
return monitor;
}
private void createDataStructures() {
obData = new ObMultiHrsReports(CommonConfig.AppName.SNOW);
obData.setThresholdMgr(SnowThresholdMgr.getInstance());
}
/**
* Re-initialization of monitor.
*
@ -169,26 +162,21 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
*/
public void launchDialog(String type, Shell shell) {
if (type.equals("zone")) {
if (zoneDialog == null) {
zoneDialog = new SnowZoneTableDlg(shell, obData);
addMonitorListener(zoneDialog);
zoneDialog.addMonitorControlListener(this);
fireMonitorEvent(zoneDialog.getClass().getName());
}
zoneDialog = new SnowZoneTableDlg(shell, obData);
addMonitorListener(zoneDialog);
zoneDialog.addMonitorControlListener(this);
zoneDialog.open();
} else if (type.equals("area")) {
if (areaDialog == null) {
areaDialog = new SnowMonitoringAreaConfigDlg(shell,
"SNOW Monitor Area Configuration");
areaDialog.setCloseCallback(new ICloseCallback() {
areaDialog = new SnowMonitoringAreaConfigDlg(shell,
"SNOW Monitor Area Configuration");
areaDialog.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
areaDialog = null;
}
@Override
public void dialogClosed(Object returnValue) {
areaDialog = null;
}
});
}
});
areaDialog.open();
}
}
@ -236,21 +224,7 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
@Override
public void processProductMessage(final AlertMessage filtered) {
if (snowPattern.matcher(filtered.dataURI).matches()) {
List<String> zones = snowAreaConfig.getAreaList();
processURI(filtered.dataURI, filtered, zones);
}
}
/**
* Sort by Date.
*
* @author dhladky
*
*/
public class SortByDate implements Comparator<Date> {
@Override
public int compare(Date o1, Date o2) {
return o1.compareTo(o2);
processURI(filtered.dataURI, filtered, snowAreaConfig);
}
}
@ -287,8 +261,9 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
@Override
public void configUpdate(IMonitorConfigurationEvent me) {
snowAreaConfig = (FSSObsMonitorConfigurationManager) me.getSource();
obData.getObHourReports().updateZones(snowAreaConfig);
if (zoneDialog != null && !zoneDialog.isDisposed()) {
zoneDialog.refreshZoneTableData(obData);
obData.updateTableCache();
fireMonitorEvent(zoneDialog.getClass().getName());
}
}
@ -318,27 +293,10 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
@Override
protected void process(ObReport result) throws Exception {
obData.addReport(result);
obData.getZoneTableData(result.getRefHour());
fireMonitorEvent(this);
}
/**
* Gets Dialog Time.
*
* @return dialogTime
*/
public Date getDialogTime() {
return dialogTime;
}
/**
* Sets dialog time.
*
* @param dialogTime
*/
public void setDialogTime(Date dialogTime) {
this.dialogTime = dialogTime;
}
/**
* Adds a listener.
*
@ -359,16 +317,6 @@ public class SnowMonitor extends ObsMonitor implements ISnowResourceListener {
snowResources.remove(isru);
}
/**
* SnowResource sets the Drawtime.
*
* @param dialogTime
*/
public void updateDialogTime(Date dialogTime) {
this.dialogTime = dialogTime;
fireMonitorEvent(this);
}
/**
* Close SNOW zone table dialog.
*/

View file

@ -52,6 +52,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Oct 27, 2014 3667 skorolev Cleaned code.
* Nov 21, 2014 3841 skorolev Corrected handleOkBtnSelection.
* Dec 11, 2014 3220 skorolev Removed unnecessary code.
* Feb 03, 2015 3841 skorolev Replaced resetParams with resetStatus.
*
* </pre>
*
@ -71,7 +72,6 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
*/
public SnowMonitoringAreaConfigDlg(Shell parent, String title) {
super(parent, title, AppName.SNOW);
SnowMonitor.getInstance();
}
/*
@ -111,7 +111,7 @@ public class SnowMonitoringAreaConfigDlg extends MonitoringAreaConfigDlg {
}
}
fireConfigUpdateEvent();
resetParams();
resetStatus();
} else { // Return back to continue edit.
return;
}

View file

@ -53,8 +53,9 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
* Nov. 8, 2012 1297 skorolev Added initiateProdArray method
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs
* Apr 28, 2014 3086 skorolev Updated getConfigMgr method.
* Sep 04, 2014 3220 skorolev Removed "site". Added check on dispose.
* Oct 16, 2014 3220 skorolev Corrected configMgr assignment.
* Jan 27, 2015 3220 skorolev Removed "site". Added check on dispose.Corrected configMgr assignment.
* Added table cache update.
* Feb 04, 2015 3841 skorolev Corrected notify method for empty table update.
*
* </pre>
*
@ -76,6 +77,9 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
public SnowZoneTableDlg(Shell parent, ObMultiHrsReports obData) {
super(parent, obData, CommonConfig.AppName.SNOW);
configMgr = FSSObsMonitorConfigurationManager.getSnowObsManager();
obData.updateTableCache();
zoneTblData = obData.getZoneTableData();
zoneTblData.sortData();
}
/**
@ -144,12 +148,15 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
if (me.getSource() instanceof SnowMonitor) {
SnowMonitor monitor = (SnowMonitor) me.getSource();
ObMultiHrsReports obData = monitor.getObData();
Date date = monitor.getDialogTime();
if (date != null) {
if (!isLinkedToFrame()) {
date = monitor.getObData().getLatestNominalTime();
date = obData.getLatestNominalTime();
}
this.updateTableDlg(monitor.getObData().getObHourReports(date));
this.updateTableDlg(obData.getObHourReports(date));
} else {
this.updateZoneTable(obData.getLatestNominalTime());
}
}
}

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.viz.monitor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -32,6 +33,7 @@ import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecord;
import com.raytheon.uf.common.dataplugin.fssobs.FSSObsRecordTransform;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.inventory.exception.DataCubeException;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@ -42,6 +44,7 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.datacube.DataCubeContainer;
import com.raytheon.uf.viz.monitor.data.ObMultiHrsReports;
import com.raytheon.uf.viz.monitor.data.ObReport;
import com.raytheon.uf.viz.monitor.events.IMonitorConfigurationEvent;
import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
@ -59,8 +62,7 @@ import com.raytheon.uf.viz.monitor.events.IMonitorThresholdEvent;
* Sep 11, 2013 2277 mschenke Got rid of ScriptCreator references
* Feb 04, 2014 2757 skorolev Added filter for removed stations
* May 08, 2014 3086 skorolev Added current site definition.
* Sep 04, 2014 3220 skorolev Removed cwa and monitorUsefrom vals.
* Jan 08, 2015 3220 skorolev Added zones parameter to processURI.
* Jan 27, 2015 3220 skorolev Removed cwa and monitorUsefrom vals.Added zones parameter to processURI.Updated code for better performance.
*
* </pre>
*
@ -102,6 +104,15 @@ public abstract class ObsMonitor extends Monitor {
/** these are the patterns for the stations **/
protected ArrayList<Pattern> stationPatterns = new ArrayList<Pattern>();
/**
* This object contains all observation data necessary for the table dialogs
* and trending plots
*/
protected ObMultiHrsReports obData;
/** current time of monitor dialog */
protected Date dialogTime;
/** Current CWA **/
public static String cwa = LocalizationManager.getInstance().getSite();
@ -186,10 +197,11 @@ public abstract class ObsMonitor extends Monitor {
*
* @param dataURI
* @param filtered
* @param zones
* @param areaConfig
*/
public void processURI(String dataURI, AlertMessage filtered,
final List<String> zones) {
final FSSObsMonitorConfigurationManager areaConfig) {
List<String> zones = areaConfig.getAreaList();
try {
Map<String, RequestConstraint> constraints = RequestConstraint
.toConstraintMapping(DataURIUtil.createDataURIMap(dataURI));
@ -223,51 +235,55 @@ public abstract class ObsMonitor extends Monitor {
* @param zones
*
*/
public void processProductAtStartup(List<String> zones) {
public void processProductAtStartup(
FSSObsMonitorConfigurationManager areaConfig) {
/**
* Assume this number for MaxNumObsTimes is larger enough to cover data
* of all observations (at least 24 hours' worth of data) in database
* [changed from 10 to 240 on May, 18, 2010 for DR #6015, zhao]
*/
int MaxNumObsTimes = 240;
Map<String, RequestConstraint> vals = new HashMap<String, RequestConstraint>();
try {
vals.put(FSSObsRecord.PLUGIN_NAME_ID, new RequestConstraint(
FSSObsRecord.PLUGIN_NAME));
List<String> zones = areaConfig.getAreaList();
if (!zones.isEmpty()) {
/**
* Assume this number for MaxNumObsTimes is larger enough to cover
* data of all observations (at least 24 hours' worth of data) in
* database [changed from 10 to 240 on May, 18, 2010 for DR #6015,
* zhao]
*/
int MaxNumObsTimes = 240;
Map<String, RequestConstraint> vals = new HashMap<String, RequestConstraint>();
try {
vals.put(FSSObsRecord.PLUGIN_NAME_ID, new RequestConstraint(
FSSObsRecord.PLUGIN_NAME));
DataTime[] dataTimesAvailable = DataCubeContainer.performTimeQuery(
vals, false);
DataTime[] selectedTimes = dataTimesAvailable;
DataTime[] dataTimesAvailable = DataCubeContainer
.performTimeQuery(vals, false);
DataTime[] selectedTimes = dataTimesAvailable;
// Ensure that the latest product is retrieved.
// [Modified: retrieve at most MaxNumObsTimes data
// points, Feb
// 19, 2010, zhao]
if (dataTimesAvailable.length > 0) {
Arrays.sort(dataTimesAvailable);
// at most, MaxNumObsTimes observation times are
// considered
if (dataTimesAvailable.length > MaxNumObsTimes) {
selectedTimes = new DataTime[MaxNumObsTimes];
System.arraycopy(dataTimesAvailable,
dataTimesAvailable.length - MaxNumObsTimes,
selectedTimes, 0, MaxNumObsTimes);
}
// Ensure that the latest product is retrieved.
// [Modified: retrieve at most MaxNumObsTimes data
// points, Feb
// 19, 2010, zhao]
if (dataTimesAvailable.length > 0) {
Arrays.sort(dataTimesAvailable);
// at most, MaxNumObsTimes observation times are
// considered
if (dataTimesAvailable.length > MaxNumObsTimes) {
selectedTimes = new DataTime[MaxNumObsTimes];
System.arraycopy(dataTimesAvailable,
dataTimesAvailable.length - MaxNumObsTimes,
selectedTimes, 0, MaxNumObsTimes);
}
FSSObsRecord[] obsRecords = requestFSSObs(vals, selectedTimes);
for (FSSObsRecord objectToSend : obsRecords) {
// Filter removed stations
if (!zones.isEmpty()) {
ObReport result = GenerateFSSObReport
FSSObsRecord[] obsRecords = requestFSSObs(vals,
selectedTimes);
for (FSSObsRecord objectToSend : obsRecords) {
// Filter removed stations
final ObReport result = GenerateFSSObReport
.generateObReport(objectToSend);
processAtStartup(result);
}
}
} catch (DataCubeException e) {
statusHandler.handle(Priority.PROBLEM,
"No data in database at startup.");
}
} catch (DataCubeException e) {
statusHandler.handle(Priority.PROBLEM,
"No data in database at startup.");
}
}
@ -296,4 +312,35 @@ public abstract class ObsMonitor extends Monitor {
constraints);
return FSSObsRecordTransform.toFSSObsRecords(pdc);
}
public ObMultiHrsReports getObData() {
return obData;
}
public void setObData(ObMultiHrsReports obData) {
this.obData = obData;
}
/**
* The date for the dialog to stay in step with
*
* @return
*/
public Date getDialogTime() {
return dialogTime;
}
public void setDialogTime(Date dialogTime) {
this.dialogTime = dialogTime;
}
/**
* Resource sets the Drawtime.
*
* @param dialogTime
*/
public void updateDialogTime(Date dialogTime) {
this.dialogTime = dialogTime;
fireMonitorEvent(this);
}
}

View file

@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig;
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
import com.raytheon.uf.common.status.IUFStatusHandler;
@ -45,8 +46,8 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
* Oct.29, 2012 1297 skorolev Changed HashMap to Map
* Oct.31, 2012 1297 skorolev Cleaned code.
* Sep 04, 2014 3220 skorolev Added updateZones method.
* Dec 18, 2014 3841 skorolev Corrected updateZones method.
* Jan 08, 2015 3220 skorolev Replaced MonitoringArea with areaConfig.
* Dec 18, 2014 3841 skorolev Corrected updateZones method.
* Jan 27, 2015 3220 skorolev Replaced MonitoringArea with areaConfig.Changed updateZones method.
*
* </pre>
*
@ -107,22 +108,16 @@ public class ObHourReports {
.getAreaByStationId(station);
if (zones.size() == 0) {
statusHandler
.error("Error: station: "
.info("Error: station: "
+ station
+ " is not associated with any zone in the monitoring area");
return;
}
boolean hasZone = false;
for (String zone : zones) {
if (hourReports.containsKey(zone)) {
hasZone = true;
hourReports.get(zone).addReport(report);
}
}
if (hasZone == false) {
statusHandler
.error("Error in addreport() of ObHourReports: unable to add obs report to data archive");
}
}
/**
@ -224,10 +219,12 @@ public class ObHourReports {
/**
* Updates zones in the Hour Reports
*
* @param configMgr
*/
public void updateZones() {
public void updateZones(FSSObsMonitorConfigurationManager configMgr) {
// Updated list of zones
List<String> updtZones = thresholdMgr.getAreaConfigMgr().getAreaList();
List<String> updtZones = configMgr.getAreaList();
// remove zones
hourReports.keySet().retainAll(updtZones);
// add zones

View file

@ -29,6 +29,7 @@ import java.util.Map;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
import com.raytheon.uf.common.monitor.config.FSSObsMonitorConfigurationManager;
import com.raytheon.uf.common.monitor.data.CommonConfig;
@ -53,9 +54,10 @@ import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
* Dec 24, 2009 3424 zhao added getTrendDataSet() that returns ObTrendDataSet object
* Jan 25, 2010 4281, 3888, 3877 wkwock/zhao added getHistTableData method
* Oct.31, 2012 1297 skorolev Clean code.
* Jan. 29, 2013 15654 zhao add Wind Chill calculation for SNOW
* Sep 04, 2014 3220 skorolev Updated getStationTableData method.
* Jan 08, 2015 3220 skorolev Replaced MonitoringArea with cfgMgr.
* Jan.29, 2013 15654 zhao add Wind Chill calculation for SNOW
* Jan 27, 2015 3220 skorolev Updated getStationTableData method.Replaced MonitoringArea with cfgMgr.
* Added multiHrsTabData - Table data cache.
* Feb 04, 2015 3841 skorolev Corrected getEmptyZoneTableData method.
*
* </pre>
*
@ -81,9 +83,14 @@ public class ObMultiHrsReports {
private CommonConfig.AppName appName;
/**
* key is nominal time, value is ObHourReports object
* FSSObs records cache. Key is nominal time, value is ObHourReports object
*/
private SortedMap<Date, ObHourReports> multiHrsReports;
private SortedMap<Date, ObHourReports> multiHrsReports = new TreeMap<Date, ObHourReports>();
/**
* Monitor Table data cache. Key is nominal time, value is TableData
*/
private ConcurrentHashMap<Date, TableData> multiHrsTabData = new ConcurrentHashMap<Date, TableData>();
/**
* The maximum number of most recent hours within which observation reports
@ -100,29 +107,10 @@ public class ObMultiHrsReports {
*/
public ObMultiHrsReports(CommonConfig.AppName appName) {
this.appName = appName;
multiHrsReports = new TreeMap<Date, ObHourReports>();
if (appName.equals(AppName.FOG) || appName.equals(AppName.SAFESEAS)) {
initFogAlgCellType();
}
}
/**
* Add an array of ObReport objects to the ObMultiHrsReports object (Don't
* use! VK)
*
* @param result
*/
public void addReports(ObReport[] results) {
for (ObReport report : results) {
/**
* DR #8723: if wind speed is zero, wind direction should be N/A,
* not 0
*/
if (report.getWindSpeed() < 0.0001) { // zero wind speed
report.setWindDir(ObConst.MISSING);
}
addReport(report);
}
}
/**
@ -132,8 +120,6 @@ public class ObMultiHrsReports {
* @return returns multiHrsReports
*/
public void addReport(ObReport report) {
// Date nominalTime = TableUtil
// .getNominalTime(report.getObservationTime());
Date nominalTime = report.getRefHour();
/**
* DR #8723: if wind speed is zero, wind direction should be N/A, not 0
@ -160,22 +146,24 @@ public class ObMultiHrsReports {
report.setWindChill(calcWindChill(report.getTemperature(),
report.getWindSpeed()));
}
}
if (multiHrsReports.containsKey(nominalTime)) {
multiHrsReports.get(nominalTime).addReport(report);
ObHourReports obHourReports;
// new nominal time; create a new ObHourReports object
if (multiHrsReports.isEmpty()
|| !multiHrsReports.containsKey(nominalTime)) {
obHourReports = new ObHourReports(nominalTime, appName,
thresholdMgr);
} else {
// new nominal time; create a new ObHourReports object
// the map is full; delete the oldest entry
if (multiHrsReports.size() >= maxFrames) {
// the map is full; delete the oldest entry
multiHrsReports.remove(multiHrsReports.firstKey());
}
ObHourReports obHourReports = new ObHourReports(nominalTime,
appName, thresholdMgr);
obHourReports.addReport(report);
multiHrsReports.put(nominalTime, obHourReports);
// update multiHrsReports with new data
obHourReports = multiHrsReports.get(nominalTime);
}
obHourReports.addReport(report);
// update data cache
multiHrsReports.put(nominalTime, obHourReports);
}
/**
@ -216,26 +204,31 @@ public class ObMultiHrsReports {
/**
* Returns a zone TableData object for a caller-specified nominal-time. If
* no data available, returns an empty/default zone TableData object (table
* cells filled with "N/A").
* cells filled with "N/A"). Updates multiHrsTabData table cache.
*
* @param nominalTime
* @return
*/
public TableData getZoneTableData(Date nominalTime) {
TableData tabData = null;
if (nominalTime == null || !multiHrsReports.containsKey(nominalTime)) {
return getEmptyZoneTableData();
}
if (appName == AppName.FOG) {
return this.getObHourReports(nominalTime).getFogZoneTableData(
tabData = this.getObHourReports(nominalTime).getFogZoneTableData(
fogAlgCellType);
}
if (appName == AppName.SAFESEAS) {
return this.getObHourReports(nominalTime).getSSZoneTableData(
} else if (appName == AppName.SAFESEAS) {
tabData = this.getObHourReports(nominalTime).getSSZoneTableData(
fogAlgCellType);
}
return this.getObHourReports(nominalTime).getZoneTableData();
// return multiHrsReports.get(nominalTime).getZoneTableData();
} else {
tabData = this.getObHourReports(nominalTime).getZoneTableData();
}
// update table data cache
if (multiHrsTabData.replace(nominalTime, tabData) == null) {
multiHrsTabData.put(nominalTime, tabData);
}
return tabData;
}
/**
@ -248,10 +241,19 @@ public class ObMultiHrsReports {
.getSystemTime().getTime());
ObHourReports hourReports = new ObHourReports(nominalTime, appName,
thresholdMgr);
TableData tabData = null;
if (appName == AppName.FOG) {
return hourReports.getFogZoneTableData(fogAlgCellType);
tabData = hourReports.getFogZoneTableData(fogAlgCellType);
} else {
tabData = hourReports.getZoneTableData();
}
return hourReports.getZoneTableData();
// update data cache
multiHrsReports.put(nominalTime, hourReports);
// update cache with empty table data
if (multiHrsTabData.replace(nominalTime, tabData) == null) {
multiHrsTabData.put(nominalTime, tabData);
}
return tabData;
}
/**
@ -483,7 +485,26 @@ public class ObMultiHrsReports {
}
/**
* Gets MultiHrsReports
* Gets table cache
*
* @return
*/
public ConcurrentHashMap<Date, TableData> getMultiHrsTabData() {
return multiHrsTabData;
}
/**
* Sets table cache
*
* @param multiHrsTabData
*/
public void setMultiHrsTabData(
ConcurrentHashMap<Date, TableData> multiHrsTabData) {
this.multiHrsTabData = multiHrsTabData;
}
/**
* Gets data cache
*
* @return SortedMap object <nominal time, ObHourReports object>
*/
@ -492,27 +513,13 @@ public class ObMultiHrsReports {
}
/**
* Gets MultiHrsTableData Returns a SortedMap object (key is nominal time,
* value is zone TableData object)
* Sets data cache
*
* @return
* @param multiHrsReports
*/
public SortedMap<Date, TableData> getMultiHrsTableData() {
SortedMap<Date, TableData> multiHrsTblData = new TreeMap<Date, TableData>();
if (appName == AppName.FOG) {
for (Date nominalTime : multiHrsReports.keySet()) {
multiHrsTblData.put(
nominalTime,
multiHrsReports.get(nominalTime).getFogZoneTableData(
fogAlgCellType));
}
return multiHrsTblData;
}
for (Date nominalTime : multiHrsReports.keySet()) {
multiHrsTblData.put(nominalTime, multiHrsReports.get(nominalTime)
.getZoneTableData());
}
return multiHrsTblData;
public void setMultiHrsReports(
SortedMap<Date, ObHourReports> multiHrsReports) {
this.multiHrsReports = multiHrsReports;
}
/**
@ -549,8 +556,14 @@ public class ObMultiHrsReports {
*/
public ObHourReports getObHourReports() {
if (multiHrsReports.isEmpty()) {
return new ObHourReports(TableUtil.getNominalTime(SimulatedTime
.getSystemTime().getTime()), appName, thresholdMgr);
ObHourReports obHrsReps = new ObHourReports(
TableUtil.getNominalTime(SimulatedTime.getSystemTime()
.getTime()), appName, thresholdMgr);
Date refTm = obHrsReps.getNominalTime();
TableData tabData = obHrsReps.getZoneTableData();
multiHrsTabData.clear();
multiHrsTabData.put(refTm, tabData);
return obHrsReps;
}
return multiHrsReports.get(multiHrsReports.lastKey());
}
@ -635,4 +648,13 @@ public class ObMultiHrsReports {
}
setFogAlgCellType(fogAlgCellType);
}
/**
* Updates table cache
*/
public void updateTableCache() {
for (Date time : multiHrsReports.keySet()) {
getZoneTableData(time);
}
}
}

View file

@ -57,6 +57,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Apr 28, 2014 3086 skorolev Removed local getAreaConfigMgr method.
* Nov 10, 2014 3741 skorolev Fixed configXML issue.
* Nov 21, 2014 3841 skorolev Content of ID field made an editable.
* Feb 03, 2015 3841 skorolev Fixed deleteSelected method.
*
* </pre>
*
@ -358,9 +359,14 @@ public class EditNewZoneDlg extends CaveSWTDialog {
}
String area = zoneList.getItem(zoneList.getSelectionIndex());
zoneList.remove(zoneList.getSelectionIndex());
idTF.setText("");
latTF.setText("");
lonTF.setText("");
zoneList.select(0);
if (zoneList.getItemCount() != 0) {
handleZoneSelection();
} else {
idTF.setText("");
latTF.setText("");
lonTF.setText("");
}
if (macDlg.getMaZones().contains(area)) {
macDlg.getMaZones().remove(area);
macDlg.configMgr.removeArea(area);

View file

@ -80,6 +80,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Nov 12, 2014 3650 skorolev Added confirmation box for unsaved changes in the dialog.
* Nov 21, 2014 3841 skorolev Added formIsValid method.
* Dec 18, 2014 3841 skorolev Corrected addZoneStn method.
* Feb 03, 2015 3841 skorolev Fixed saving problem for distance and time.
*
* </pre>
*
@ -1336,18 +1337,11 @@ public abstract class MonitoringAreaConfigDlg extends CaveSWTDialog implements
populateMaRegionalList();
}
/**
* Reset configuration parameters.
*/
protected void resetParams() {
getValues();
resetStatus();
}
/**
* Saving configuration parameters.
*/
protected void saveConfigs() {
getValues();
configMgr.saveConfigXml();
configMgr.saveAdjacentAreaConfigXml();
}

View file

@ -94,9 +94,8 @@ import com.vividsolutions.jts.io.ParseException;
* Nov.11, 2012 1297 skorolev new abstract initiateProdArray()
* May 13, 2014 3133 njensen Updated getting ObsHistType from configMgr
* May 15, 2014 3086 skorolev Replaced MonitorConfigurationManager with FSSObsMonitorConfigurationManager.
* Sep 15, 2014 3220 skorolev Added refreshZoneTableData method.
* Oct 17, 2014 3220 skorolev Added condition into launchTrendPlot to avoid NPE.
* Nov 03, 2014 3741 skorolev Updated zoom procedures.
* Jan 27, 2015 3220 skorolev Added refreshZoneTableData method.Added condition into launchTrendPlot to avoid NPE.Updated code for better performance.
*
* </pre>
*
@ -260,9 +259,6 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
this.site = LocalizationManager.getInstance().getCurrentSite();
dFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
this.obData = obData;
// the zone table data of the latest nominal time:
zoneTblData = obData.getZoneTableData();
zoneTblData.sortData();
nominalTime = obData.getLatestNominalTime();
}
@ -458,12 +454,16 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
* their current values
*/
setZoneSortColumnAndDirection();
zoneTblData = obData.getZoneTableData(date);
zoneTblData
.setSortColumnAndDirection(zoneSortColumn, zoneSortDirection);
zoneTblData.sortData();
zoneTable.setTableData(zoneTblData);
zoneTable.table.redraw();
// get tab cache data
zoneTblData = obData.getMultiHrsTabData().get(date);
// update table if there are tab data in cache
if (zoneTblData != null) {
zoneTblData.setSortColumnAndDirection(zoneSortColumn,
zoneSortDirection);
zoneTblData.sortData();
zoneTable.setTableData(zoneTblData);
zoneTable.table.redraw();
}
}
/**
@ -495,7 +495,7 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
/**
* Sets Column and Sort Direction for Zone table.
*/
protected void setZoneSortColumnAndDirection() {
public void setZoneSortColumnAndDirection() {
if (zoneTblData != null) {
zoneSortColumn = zoneTblData.getSortColumn();
zoneSortDirection = zoneTblData.getSortDirection();
@ -605,6 +605,9 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
*/
@Override
public void zoneTableAction(int rowNum) {
zoneTblData = obData.getZoneTableData(nominalTime);
zoneTblData.sortData();
// set selectedZone to the selected zone
selectedZone = zoneTblData.getTableRows().get(rowNum)
.getTableCellData(0).getCellText();
@ -968,14 +971,4 @@ public abstract class ZoneTableDlg extends CaveSWTDialog implements
}
return varName;
}
/**
* Refreshes Zone Table.
*
* @param obData
*/
public void refreshZoneTableData(ObMultiHrsReports obData) {
obData.getObHourReports().updateZones();
this.updateTableDlg(obData.getObHourReports());
}
}

View file

@ -26,6 +26,7 @@ Developed on the Raytheon Visualization Environment (viz)
-Dorg.eclipse.update.reconcile=false
-Dqpid.dest_syntax=BURL
-Dorg.eclipse.update.reconcile=false
-Dorg.eclipse.swt.internal.gtk.cairoGraphics=false
-XX:MaxPermSize=128m
-Dorg.eclipse.ui/KEY_CONFIGURATION_ID=com.raytheon.viz.ui.awips.scheme
-Dqpid.dest_syntax=BURL

View file

@ -62,6 +62,7 @@ import com.raytheon.uf.viz.thinclient.ui.ThinClientConnectivityDialog;
* May 19, 2014 3164 bsteffen Disable request compression if it
* doesn't work.
* Sep 05, 2014 3570 bclement HTTP client API changes
* Jan 26, 2014 3952 njensen gzip handled by default
*
* </pre>
*
@ -87,7 +88,6 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer {
HttpClient httpClient = HttpClient.getInstance();
HttpClientConfigBuilder confBuilder = new HttpClientConfigBuilder(
httpClient.getConfig());
confBuilder.setHandlingGzipResponses(true);
HttpClient.configureGlobalInstance(confBuilder.build());
if (promptUI) {
ThinClientConnectivityDialog dlg = new ThinClientConnectivityDialog(

View file

@ -59,7 +59,7 @@
<contribute xsi:type="command"
commandId="com.raytheon.viz.awipstools.lapstools"
menuText="LAPS tools..." />
menuText="LAPS tools..." id="lapsTools" />
<contribute xsi:type="bundleItem" file="bundles/tools/Points.xml"
menuText="Points" id="pointsTool" timeQuery="false" />

View file

@ -51,6 +51,7 @@ import com.raytheon.viz.gfe.smartscript.FieldDefinition;
* Oct 14, 2014 3676 njensen Moved getNumpyResult(GridType) here and
* hardened it by separating jep.getValue()
* calls from python copying/casting to correct types
* Feb 05, 2015 4089 njensen Replaced previous hardening with ensureResultType()
*
* </pre>
*
@ -116,11 +117,11 @@ public abstract class BaseGfePyController extends PythonScriptController {
}
/**
* Processes a module's varDict (variable list inputs), or sets the varDict
* to an empty dictionary if there is not a variable list
* Sets a module's varDict (variable list inputs), or sets the varDict to
* None if there is not a variable list
*
* @param moduleName
* the name of the module to process the varDict for
* @param varDict
* a string representation of a python dictionary
* @throws JepException
*/
public void setVarDict(String varDict) throws JepException {
@ -203,59 +204,20 @@ public abstract class BaseGfePyController extends PythonScriptController {
if (resultFound) {
int xDim, yDim = 0;
/*
* correctType is just a memory optimization. A copy is made when we
* call getValue(numpyArray), but doing array.astype(dtype) or
* numpy.ascontiguousarray(array, dtype) will create yet another
* copy.
*
* Note that if you attempt jep.getValue(array.astype(dtype)) or
* jep.getValue(numpy.ascontiguousarray(array, dtype)) you can
* potentially crash the JVM. jep.getValue(variable) should
* primarily retrieve variables that are globally scoped in the
* python interpreter as opposed to created on the fly.
*/
boolean correctType = false;
// this will safely alter the result dtypes in place if necessary
ensureResultType(type);
switch (type) {
case SCALAR:
correctType = (boolean) jep.getValue(RESULT
+ ".dtype.name == 'float32'");
if (!correctType) {
/*
* the following line needs to be separate from
* jep.getValue() to be stable
*/
jep.eval(RESULT + " = numpy.ascontiguousarray(" + RESULT
+ ", numpy.float32)");
}
// don't make python func calls within a jep.getValue() call
float[] scalarData = (float[]) jep.getValue(RESULT);
xDim = (Integer) jep.getValue(RESULT + ".shape[1]");
yDim = (Integer) jep.getValue(RESULT + ".shape[0]");
result = new Grid2DFloat(xDim, yDim, scalarData);
break;
case VECTOR:
correctType = (boolean) jep.getValue(RESULT
+ "[0].dtype.name == 'float32'");
if (!correctType) {
/*
* the following line needs to be separate from
* jep.getValue() to be stable
*/
jep.eval(RESULT + "[0] = numpy.ascontiguousarray(" + RESULT
+ "[0], numpy.float32)");
}
correctType = (boolean) jep.getValue(RESULT
+ "[1].dtype.name == 'float32'");
if (!correctType) {
/*
* the following line needs to be separate from
* jep.getValue() to be stable
*/
jep.eval(RESULT + "[1] = numpy.ascontiguousarray(" + RESULT
+ "[1], numpy.float32)");
}
// don't make python func calls within a jep.getValue() call
float[] mag = (float[]) jep.getValue(RESULT + "[0]");
float[] dir = (float[]) jep.getValue(RESULT + "[1]");
xDim = (Integer) jep.getValue(RESULT + "[0].shape[1]");
@ -267,17 +229,7 @@ public abstract class BaseGfePyController extends PythonScriptController {
break;
case WEATHER:
case DISCRETE:
correctType = (boolean) jep.getValue(RESULT
+ "[0].dtype.name == 'int8'");
if (!correctType) {
/*
* the following line needs to be separate from
* jep.getValue() to be stable
*/
jep.eval(RESULT + "[0] = numpy.ascontiguousarray(" + RESULT
+ "[0], numpy.int8)");
}
// don't make python func calls within a jep.getValue() call
byte[] bytes = (byte[]) jep.getValue(RESULT + "[0]");
String[] keys = (String[]) jep.getValue(RESULT + "[1]");
xDim = (Integer) jep.getValue(RESULT + "[0].shape[1]");
@ -297,4 +249,39 @@ public abstract class BaseGfePyController extends PythonScriptController {
return result;
}
/**
* Checks that a result numpy array is of the correct dtype for the
* GridType, and if not, corrects the type to ensure it comes across to Java
* safely.
*
* If the correct type is found, nothing is done and therefore memory and
* speed is saved over the alternative of always calling astype(dtype) or
* ascontiguousarray(array, dtype), both of which will create a copy of the
* array.
*
* Note that if you attempt jep.getValue(array.astype(dtype)) or
* jep.getValue(numpy.ascontiguousarray(array, dtype)) you can potentially
* crash the JVM. jep.getValue(variable) should primarily retrieve variables
* that are globally scoped in the python interpreter as opposed to created
* on the fly.
*
* @param type
*/
protected void ensureResultType(GridType type) throws JepException {
String safeType = null;
switch (type) {
case SCALAR:
case VECTOR:
safeType = "'float32'";
break;
case DISCRETE:
case WEATHER:
safeType = "'int8'";
break;
}
String safetyCheck = RESULT + " = " + "NumpyJavaEnforcer.checkdTypes("
+ RESULT + ", " + safeType + ")";
jep.eval("import NumpyJavaEnforcer");
jep.eval(safetyCheck);
}
}

View file

@ -26,7 +26,7 @@ package com.raytheon.viz.gfe.dialogs.formatterlauncher;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 18 APR 2008 ### lvenable Initial creation
* 18 APR 2008 ### lvenable Initial creation
*
* </pre>
*

View file

@ -548,7 +548,7 @@ public class FindReplaceDlg extends CaveSWTDialog {
this.searchOptions.remove(FindReplaceOptions.SEARCH_POS_END);
int[] matchRange = findString(searchString);
while (!(matchRange[0] == 0 && matchRange[1] == 0)) {
while (!((matchRange[0] == 0) && (matchRange[1] == 0))) {
int newOffset = matchRange[1];
editorST.replaceTextRange(matchRange[0], searchString.length(),
@ -607,7 +607,7 @@ public class FindReplaceDlg extends CaveSWTDialog {
int[] replaceMatch = findString(replaceString,
selectionToBeReplaced.x);
if (!(replaceMatch[0] == 0 && replaceMatch[1] == 0)) {
if (!((replaceMatch[0] == 0) && (replaceMatch[1] == 0))) {
editorComp.reParse();
editorST.setCaretOffset(replaceMatch[1]);
}
@ -630,8 +630,9 @@ public class FindReplaceDlg extends CaveSWTDialog {
*
*/
private void handleClickFind(SelectionEvent event) {
if (findTF.getText().equals(""))
if (findTF.getText().equals("")) {
return;
}
cursorOffset = editorST.getCaretOffset();
@ -639,8 +640,8 @@ public class FindReplaceDlg extends CaveSWTDialog {
// For BACKWARD_SEARCH option:
// Need skip the previously found string
if (searchOptions.contains(FindReplaceOptions.BACKWARD_SEARCH)) {
if (editorST.getSelectionRange() != null
&& editorST.getSelectionRange().y > 0) {
if ((editorST.getSelectionRange() != null)
&& (editorST.getSelectionRange().y > 0)) {
cursorOffset -= editorST.getSelectionRange().y;
if (cursorOffset < 0) {
cursorOffset = 0;
@ -671,7 +672,7 @@ public class FindReplaceDlg extends CaveSWTDialog {
private boolean findAndSelectString(String searchString) {
int[] matchRange = findString(searchString);
if (!(matchRange[0] == 0 && matchRange[1] == 0)) {
if (!((matchRange[0] == 0) && (matchRange[1] == 0))) {
editorST.setSelection(matchRange[0], matchRange[1]);
editorST.showSelection();
cursorOffset = editorST.getCaretOffset();
@ -744,8 +745,9 @@ public class FindReplaceDlg extends CaveSWTDialog {
// if (searchOptions.contains(FindReplaceOptions.EXACT_MATCH)
// && !searchOptions.contains(FindReplaceOptions.REGEX_SEARCH))
// searchRegex = "\\b" + searchRegex + "\\b";
if (searchOptions.contains(FindReplaceOptions.IGNORE_CASE))
if (searchOptions.contains(FindReplaceOptions.IGNORE_CASE)) {
regexFlags |= Pattern.CASE_INSENSITIVE;
}
// Need handle the PatternSyntaxException when user searches meta
// character(s) but forgot to toggle on the regex option.
@ -761,8 +763,9 @@ public class FindReplaceDlg extends CaveSWTDialog {
match[0] = matcher.start();
match[1] = matcher.end();
if (searchOptions
.contains(FindReplaceOptions.FORWARD_SEARCH))
.contains(FindReplaceOptions.FORWARD_SEARCH)) {
break;
}
}
}
} catch (PatternSyntaxException e) {
@ -829,7 +832,7 @@ public class FindReplaceDlg extends CaveSWTDialog {
int searchEndIndex;
int[] match = { 0, 0 };
if (searchString == null || searchString.equals("")) {
if ((searchString == null) || searchString.equals("")) {
return match;
}

View file

@ -26,7 +26,7 @@ package com.raytheon.viz.gfe.dialogs.formatterlauncher;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 18 APR 2008 ### lvenable Initial creation
* 18 APR 2008 ### lvenable Initial creation
*
* </pre>
*

View file

@ -23,19 +23,18 @@ package com.raytheon.viz.gfe.dialogs.formatterlauncher;
* Interface used for sending status of transmitted products.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 22, 2010 #2861 lvenable Initial creation
*
*
* </pre>
*
*
* @author lvenable
* @version 1.0
*/
public interface ITransmissionState
{
public interface ITransmissionState {
void setTransmissionState(ConfigData.productStateEnum state);
}

View file

@ -22,6 +22,7 @@ package com.raytheon.viz.gfe.dialogs.formatterlauncher;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.swt.graphics.Point;
@ -35,6 +36,7 @@ import org.eclipse.swt.graphics.Point;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 05 Jan 2008 1784 lvenable Initial creation
* 28 Jan 2015 4018 randerso Code cleanup
*
* </pre>
*
@ -51,12 +53,12 @@ public class ProductDataStruct {
/**
* HashMap of ci text index points.
*/
private HashMap<String, TextIndexPoints> ci;
private Map<String, TextIndexPoints> ci;
/**
* HashMap of mnd text index points.
*/
private HashMap<String, TextIndexPoints> mnd;
private Map<String, TextIndexPoints> mnd;
/**
* Array of segment data.
@ -66,7 +68,7 @@ public class ProductDataStruct {
/**
* Parsed map containing the parsed product text.
*/
private HashMap<String, Object> parsedMap;
private Map<String, Object> parsedMap;
/**
* A String array containing the product text. Each element in the array is
@ -89,8 +91,7 @@ public class ProductDataStruct {
* @param productText
* Product text.
*/
public ProductDataStruct(HashMap<String, Object> parsedMap,
String productText) {
public ProductDataStruct(Map<String, Object> parsedMap, String productText) {
this.parsedMap = parsedMap;
this.productText = productText;
@ -121,21 +122,20 @@ public class ProductDataStruct {
return;
}
if (parsedMap.get("frames") instanceof List == false) {
if ((parsedMap.get("frames") instanceof List) == false) {
return;
}
frames = new ArrayList<TextIndexPoints>();
List<?> parseFrames = (List<?>) parsedMap.get("frames");
for (Object object : parseFrames) {
HashMap frameMap = (HashMap) object;
List<Map<String, List<List<Integer>>>> parseFrames = (List<Map<String, List<List<Integer>>>>) parsedMap
.get("frames");
for (Map<String, List<List<Integer>>> frameMap : parseFrames) {
Set<String> keys = frameMap.keySet();
for (String key : keys) {
List<?> frameIndexes = (List<?>) frameMap.get(key);
List<List<Integer>> frameIndexes = frameMap.get(key);
TextIndexPoints tip = createTextIndexPoints(frameIndexes);
@ -156,15 +156,16 @@ public class ProductDataStruct {
return;
}
List<?> tmpArray;
List<List<Integer>> tmpArray;
TextIndexPoints tip;
HashMap parsedCi = (HashMap) parsedMap.get("ci");
Map<String, List<List<Integer>>> parsedCi = (Map<String, List<List<Integer>>>) parsedMap
.get("ci");
Set<String> keys = parsedCi.keySet();
for (String key : keys) {
tmpArray = (List<?>) parsedCi.get(key);
tmpArray = parsedCi.get(key);
tip = createTextIndexPoints(tmpArray);
ci.put(key, tip);
}
@ -181,19 +182,18 @@ public class ProductDataStruct {
return;
}
List<?> tmpArray;
List<List<Integer>> tmpArray;
TextIndexPoints tip;
HashMap parsedMnd = (HashMap) parsedMap.get("mnd");
Map<String, List<List<Integer>>> parsedMnd = (Map<String, List<List<Integer>>>) parsedMap
.get("mnd");
Set<String> keys = parsedMnd.keySet();
for (String key : keys) {
tmpArray = (List<?>) parsedMnd.get(key);
tmpArray = parsedMnd.get(key);
tip = createTextIndexPoints(tmpArray);
// TODO : remove
// System.out.println("mnd key = " + key + "\t\t" + tip.getText());
mnd.put(key, tip);
}
}
@ -210,36 +210,36 @@ public class ProductDataStruct {
}
TextIndexPoints tip;
List<?> tmpArray;
List<List<Integer>> tmpArray;
// Get the Array of segments from the parsed map.
List<?> parsedSegs = (List<?>) parsedMap.get("segs");
List<Map<String, Object>> parsedSegs = (List<Map<String, Object>>) parsedMap
.get("segs");
// Loop through each segment.
for (Object seg : parsedSegs) {
HashMap curSegMap = (HashMap) seg;
for (Map<String, Object> curSegMap : parsedSegs) {
Set<String> keys = curSegMap.keySet();
SegmentData segData = new SegmentData();
for (String key : keys) {
if (key.compareTo("headInfo") == 0) {
List<?> headInfoArray = (List<?>) curSegMap.get(key);
if (key.equals("headInfo")) {
List<Map<String, List<List<Integer>>>> headInfoArray = (List<Map<String, List<List<Integer>>>>) curSegMap
.get(key);
for (Object hiObj : headInfoArray) {
HashMap headInfoMap = (HashMap) hiObj;
Map<String, List<List<Integer>>> headInfoMap = (Map<String, List<List<Integer>>>) hiObj;
Set<String> headInfoKeys = headInfoMap.keySet();
for (String hiKey : headInfoKeys) {
tmpArray = (List<?>) headInfoMap.get(hiKey);
tmpArray = headInfoMap.get(hiKey);
tip = createTextIndexPoints(tmpArray);
segData.addToHeadInfoMap(hiKey, tip);
}
}
} else {
tmpArray = (List<?>) curSegMap.get(key);
tmpArray = (List<List<Integer>>) curSegMap.get(key);
tip = createTextIndexPoints(tmpArray);
segData.addToSegmentMap(key, tip);
}
@ -256,19 +256,18 @@ public class ProductDataStruct {
* Array of indexes.
* @return TextIndexPoint data.
*/
@SuppressWarnings("unchecked")
private TextIndexPoints createTextIndexPoints(List tmpArray) {
private TextIndexPoints createTextIndexPoints(List<List<Integer>> tmpArray) {
TextIndexPoints tip = new TextIndexPoints();
// Get the starting index
List<?> startPoints = (List<?>) tmpArray.get(0);
int startLine = ((Integer) startPoints.get(0)) - 1;
int startCol = (Integer) startPoints.get(1);
List<Integer> startPoints = tmpArray.get(0);
int startLine = (startPoints.get(0)) - 1;
int startCol = startPoints.get(1);
// Get the ending index
List<?> endPoints = (List<?>) tmpArray.get(1);
int endLine = ((Integer) endPoints.get(0)) - 1;
int endCol = ((Integer) endPoints.get(1));
List<Integer> endPoints = tmpArray.get(1);
int endLine = (endPoints.get(0)) - 1;
int endCol = (endPoints.get(1));
String text = getIndexString(startLine, startCol, endLine, endCol);
@ -320,7 +319,7 @@ public class ProductDataStruct {
} else {
int endColOffset = 0;
if (endCol - 1 == productTextArray[i].length()) {
if ((endCol - 1) == productTextArray[i].length()) {
endColOffset = -1;
}
@ -363,7 +362,7 @@ public class ProductDataStruct {
*
* @return The CI map.
*/
public HashMap<String, TextIndexPoints> getCiMap() {
public Map<String, TextIndexPoints> getCiMap() {
return ci;
}
@ -372,7 +371,7 @@ public class ProductDataStruct {
*
* @return The MND map.
*/
public HashMap<String, TextIndexPoints> getMndMap() {
public Map<String, TextIndexPoints> getMndMap() {
return mnd;
}
@ -412,72 +411,70 @@ public class ProductDataStruct {
*/
@SuppressWarnings("unused")
public void printData() {
// System.out.println("**** PRINT START ********************************");
// System.out.println("****");
System.out.println("**** PRINT START ********************************");
System.out.println("****");
/*
* Print the Frames information.
*/
// System.out.println("");
// System.out.println("--- frames");
System.out.println("");
System.out.println("--- frames");
for (TextIndexPoints frameData : frames) {
// System.out.println("frame text = " + frameData.getText());
System.out.println("frame text = " + frameData.getText());
}
/*
* Print the CI information.
*/
// System.out.println("");
// System.out.println("--- ci");
System.out.println("");
System.out.println("--- ci");
Set<String> ciKeys = ci.keySet();
for (String key : ciKeys) {
// System.out.println("key = " + key);
// System.out.println("text = " + ci.get(key).getText());
System.out.println("key = " + key);
System.out.println("text = " + ci.get(key).getText());
}
/*
* Print the MND information.
*/
// System.out.println("");
// System.out.println("--- mnd");
System.out.println("");
System.out.println("--- mnd");
Set<String> mndKeys = mnd.keySet();
for (String key : mndKeys) {
// System.out.println("key = " + key);
// System.out.println("text = " + mnd.get(key).getText());
System.out.println("key = " + key);
System.out.println("text = " + mnd.get(key).getText());
}
/*
* Print the Segments information.
*/
// System.out.println("");
// System.out.println("--- segments");
System.out.println("");
System.out.println("--- segments");
for (SegmentData segData : segments) {
// System.out.println("++++++ segment map");
HashMap<String, TextIndexPoints> segMap = segData.getSementMap();
System.out.println("++++++ segment map");
Map<String, TextIndexPoints> segMap = segData.getSementMap();
Set<String> segMapKeys = segMap.keySet();
for (String segMapKey : segMapKeys) {
// TextIndexPoints tip = segMap.get(segMapKey);
// System.out.println("SegMapKey = " + segMapKey);
// System.out.println("Text = " +
// segMap.get(segMapKey).getText());
TextIndexPoints tip = segMap.get(segMapKey);
System.out.println("SegMapKey = " + segMapKey);
System.out.println("Text = " + segMap.get(segMapKey).getText());
}
// System.out.println("++++++ headinfo map");
HashMap<String, TextIndexPoints> headInfoMap = segData
.getHeadInfoMap();
System.out.println("++++++ headinfo map");
Map<String, TextIndexPoints> headInfoMap = segData.getHeadInfoMap();
Set<String> headInfoKeys = headInfoMap.keySet();
for (String headInfoKey : headInfoKeys) {
// System.out.println("headInfoKey = " + headInfoKey);
// System.out.println("Text = "
// + headInfoMap.get(headInfoKey).getText());
System.out.println("headInfoKey = " + headInfoKey);
System.out.println("Text = "
+ headInfoMap.get(headInfoKey).getText());
}
}
// System.out.println("**** PRINT END **********************************");
System.out.println("**** PRINT END **********************************");
}
public String getWmoId() {
@ -505,7 +502,7 @@ public class ProductDataStruct {
return mnd.get("pline");
}
public TextIndexPoints getFunnyFiled() {
public TextIndexPoints getFunnyField() {
return ci.get("funnyfield");
}
@ -535,8 +532,9 @@ public class ProductDataStruct {
int column = 0;
for (line = 0; line < productTextArray.length; line++) {
int llen = productTextArray[line].length() + 1;
if (offset < llen)
if (offset < llen) {
break;
}
offset -= llen;
}
column = offset;

View file

@ -125,7 +125,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 18 APR 2008 ### lvenable Initial creation
* 19 JAN 2010 4085 ryu Save and load draft
@ -163,8 +163,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 12/01/2014 #624 zhao Modified saveFile()
* 12/16/2014 #14946 ryu Modified updateIssueExpireTimes() so issuance time is displayed
* for the local time zones for each segment.
* 01/28/2015 #4018 randerso Code cleanup.
* 02/04/2014 17039 ryu Removed menu item related to the HighlighFramingCodes feature.
*
* </pre>
*
* @author lvenable
@ -942,10 +942,7 @@ public class ProductEditorComp extends Composite implements
*/
private void createTextControl() {
textComp = new StyledTextComp(this);
textComp.setWrapColumn(wrapColumn);
textComp.setAutoWrapMode(wrapMode);
textComp = new StyledTextComp(this, wrapColumn, wrapMode);
createEditorPopupMenu();
@ -2000,8 +1997,7 @@ public class ProductEditorComp extends Composite implements
if (pds != null) {
String officeTimeZone = dm.getParmManager()
.compositeGridLocation()
.getTimeZone();
.compositeGridLocation().getTimeZone();
int numSegments = pds.getSegmentsArray().size();
SimpleDateFormat fmt = new SimpleDateFormat(longLocalFmtStr);
fmt.setTimeZone(localTimeZone);
@ -2010,8 +2006,7 @@ public class ProductEditorComp extends Composite implements
for (int i = 0; i < numSegments; i++) {
textComp.startUpdate();
HashMap<String, TextIndexPoints> segMap = pds
.getSegmentsArray()
.get(i).getSementMap();
.getSegmentsArray().get(i).getSementMap();
TextIndexPoints tip = segMap.get("purgeT");
if (tip != null) {
@ -2031,10 +2026,10 @@ public class ProductEditorComp extends Composite implements
// vtecs are fixed length and this is variable length,
// which ensures we only need to reParse() once per
// segment
List<String> zones = decodeUGCs(pds.getSegmentsArray().get(i));
List<String> zones = decodeUGCs(pds.getSegmentsArray()
.get(i));
List<String> timeZones = dm.getTextProductMgr()
.getTimeZones(zones,
officeTimeZone);
.getTimeZones(zones, officeTimeZone);
StringBuilder sb = new StringBuilder();
for (String tz : timeZones) {
@ -2239,18 +2234,18 @@ public class ProductEditorComp extends Composite implements
* Save the current text in the product editor to a file.
*/
private void saveFile() {
String fname = null;
if ( productDefinition.get("outputFile") != null ) {
fname = getDefString("outputFile");
if ( fname.equals(EMPTY) ) {
if (productDefinition.get("outputFile") != null) {
fname = getDefString("outputFile");
if (fname.equals(EMPTY)) {
return;
}
} else {
return;
}
fname = fixfname(fname);
FileDialog fd = new FileDialog(parent.getShell(), SWT.SAVE);
fd.setText("Save As");
String filePath = (new File(fname)).getParentFile().getPath();

View file

@ -37,7 +37,7 @@ import java.util.HashMap;
*
*/
public class SegmentData {
/**
* Segment map.
*/
@ -58,8 +58,11 @@ public class SegmentData {
/**
* Add entry into the segment map.
* @param key Map key.
* @param tip Text index point data.
*
* @param key
* Map key.
* @param tip
* Text index point data.
*/
public void addToSegmentMap(String key, TextIndexPoints tip) {
segMap.put(key, tip);
@ -67,8 +70,11 @@ public class SegmentData {
/**
* Add entry into the head info map.
* @param key Map key.
* @param tip Text index point data.
*
* @param key
* Map key.
* @param tip
* Text index point data.
*/
public void addToHeadInfoMap(String key, TextIndexPoints tip) {
headInfoMap.put(key, tip);
@ -76,7 +82,9 @@ public class SegmentData {
/**
* Get a text index point data from the segment map.
* @param key Map key.
*
* @param key
* Map key.
* @return Segment text index point data.
*/
public TextIndexPoints getSegmentDataIndexPoints(String key) {
@ -85,7 +93,9 @@ public class SegmentData {
/**
* Get a text index point data from the head info map.
* @param key Map key.
*
* @param key
* Map key.
* @return Segment text index point data.
*/
public TextIndexPoints getHeadInfoDataIndexPoints(String key) {
@ -94,6 +104,7 @@ public class SegmentData {
/**
* Get the segment map.
*
* @return The segment map.
*/
public HashMap<String, TextIndexPoints> getSementMap() {
@ -102,6 +113,7 @@ public class SegmentData {
/**
* Get the head info map.
*
* @return The head info map.
*/
public HashMap<String, TextIndexPoints> getHeadInfoMap() {

View file

@ -36,7 +36,7 @@ import com.raytheon.viz.gfe.core.DataManager;
* ------------ ---------- ----------- --------------------------
* 18 APR 2008 ### lvenable Initial creation
* 20 AUG 2010 4687 cjeanbap &quot;null&quot; showed up in
* countdown message.
* countdown message.
*
* </pre>
*
@ -45,182 +45,181 @@ import com.raytheon.viz.gfe.core.DataManager;
*
*/
public class StoreTransmitCountdownThread extends Thread {
/**
* Parent display.
*/
private Display display;
/**
* Parent display.
*/
private Display display;
/**
* Progress bar to be updated.
*/
private ProgressBar progressBar;
/**
* Progress bar to be updated.
*/
private ProgressBar progressBar;
/**
* Flag indicating if the thread is done running.
*/
private boolean isDone = false;
/**
* Flag indicating if the thread is done running.
*/
private boolean isDone = false;
/**
* Flag indicating if the thread has been canceled.
*/
private boolean isCancelled = false;
/**
* Flag indicating if the thread has been canceled.
*/
private boolean isCancelled = false;
/**
* Count down label.
*/
private Label countdownLbl;
/**
* Count down label.
*/
private Label countdownLbl;
/**
* Count down string.
*/
private String countdownStr;
/**
* Count down string.
*/
private String countdownStr;
/**
* Counter.
*/
private int counter = 5;
/**
* Counter.
*/
private int counter = 5;
/**
* Store/Transmit callback.
*/
private IStoreTransmitProduct storeCB;
/**
* Store/Transmit callback.
*/
private IStoreTransmitProduct storeCB;
/**
* Count down prefix string.
*/
private String countdownPrefix;
/**
* Count down prefix string.
*/
private String countdownPrefix;
/**
* Constructor.
*
* @param display
* Parent display.
* @param progressBar
* Progress bar.
* @param countdownLbl
* Count down label.
* @param countdownStr
* Count down string.
* @param cb
* Callback interface.
* @param isStore
* True to display store, false to display transmit.
*/
public StoreTransmitCountdownThread(Display display,
ProgressBar progressBar, Label countdownLbl, String countdownStr,
IStoreTransmitProduct cb, boolean isStore) {
this.display = display;
this.progressBar = progressBar;
this.countdownLbl = countdownLbl;
this.countdownStr = countdownStr;
this.storeCB = cb;
countdownPrefix = new String();
CAVEMode opMode = DataManager.getCurrentInstance().getOpMode();
if (!opMode.equals(CAVEMode.OPERATIONAL)) {
countdownPrefix = "Simulated ";
}
if (isStore == true) {
countdownPrefix += "Store in ";
} else {
countdownPrefix += "Transmit in ";
}
}
/**
* Constructor.
*
* @param display
* Parent display.
* @param progressBar
* Progress bar.
* @param countdownLbl
* Count down label.
* @param countdownStr
* Count down string.
* @param cb
* Callback interface.
* @param isStore
* True to display store, false to display transmit.
*/
public StoreTransmitCountdownThread(Display display,
ProgressBar progressBar, Label countdownLbl, String countdownStr,
IStoreTransmitProduct cb, boolean isStore) {
this.display = display;
this.progressBar = progressBar;
this.countdownLbl = countdownLbl;
this.countdownStr = countdownStr;
this.storeCB = cb;
countdownPrefix = new String();
CAVEMode opMode = DataManager.getCurrentInstance().getOpMode();
if (!opMode.equals(CAVEMode.OPERATIONAL)) {
countdownPrefix = "Simulated ";
}
if (isStore == true) {
countdownPrefix += "Store in ";
} else {
countdownPrefix += "Transmit in ";
}
}
/**
* Thread's run method.
*/
@Override
public void run() {
isDone = false;
countdownLabelStart();
/**
* Thread's run method.
*/
@Override
public void run() {
isDone = false;
countdownLabelStart();
for (int i = 0; i < 6; i++) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
for (int i = 0; i < 6; i++) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
if (isCancelled == false) {
display.asyncExec(new Runnable() {
public void run() {
if (progressBar.isDisposed()) {
return;
}
// Increment the progress bar
progressBar
.setSelection(progressBar.getSelection() + 1);
countdownLbl.setText(countdownPrefix + counter
+ " seconds...");
--counter;
}
});
} else {
break;
}
}
if (isCancelled == false) {
display.asyncExec(new Runnable() {
public void run() {
if (progressBar.isDisposed()) {
return;
}
// Increment the progress bar
progressBar.setSelection(progressBar.getSelection() + 1);
countdownLbl.setText(countdownPrefix + counter
+ " seconds...");
--counter;
}
});
} else {
break;
}
}
if (isCancelled == false) {
countdownLabelFinished();
}
if (isCancelled == false) {
countdownLabelFinished();
}
isDone = true;
isDone = true;
storeCB.storeTransmitProduct();
}
storeCB.storeTransmitProduct();
}
/**
* Check if the thread is done running.
*
* @return True if the thread is done running, false if it is still running.
*/
public boolean isDone() {
return isDone;
}
/**
* Check if the thread is done running.
*
* @return True if the thread is done running, false if it is still running.
*/
public boolean isDone() {
return isDone;
}
/**
* Cancel the running thread.
*/
public void cancelThread() {
isCancelled = true;
}
/**
* Cancel the running thread.
*/
public void cancelThread() {
isCancelled = true;
}
/**
* Check if the thread has been canceled.
*
* @return True if the thread was canceled, false otherwise.
*/
public boolean threadCancelled() {
return isCancelled;
}
/**
* Check if the thread has been canceled.
*
* @return True if the thread was canceled, false otherwise.
*/
public boolean threadCancelled() {
return isCancelled;
}
/**
* Set the count down label to have a red background and white text while
* the Store/Transmit is in count down mode.
*/
private void countdownLabelStart() {
display.asyncExec(new Runnable() {
public void run() {
countdownLbl.setBackground(display
.getSystemColor(SWT.COLOR_RED));
countdownLbl.setForeground(display
.getSystemColor(SWT.COLOR_WHITE));
}
});
}
/**
* Set the count down label to have a red background and white text while
* the Store/Transmit is in count down mode.
*/
private void countdownLabelStart() {
display.asyncExec(new Runnable() {
public void run() {
countdownLbl.setBackground(display
.getSystemColor(SWT.COLOR_RED));
countdownLbl.setForeground(display
.getSystemColor(SWT.COLOR_WHITE));
}
});
}
/**
* Set the count down label back to its original state.
*/
private void countdownLabelFinished() {
display.asyncExec(new Runnable() {
public void run() {
countdownLbl.setText(countdownStr);
countdownLbl.setBackground(display
.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
countdownLbl.setForeground(display
.getSystemColor(SWT.COLOR_BLACK));
}
});
}
/**
* Set the count down label back to its original state.
*/
private void countdownLabelFinished() {
display.asyncExec(new Runnable() {
public void run() {
countdownLbl.setText(countdownStr);
countdownLbl.setBackground(display
.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
countdownLbl.setForeground(display
.getSystemColor(SWT.COLOR_BLACK));
}
});
}
}

View file

@ -59,6 +59,7 @@ import org.eclipse.swt.widgets.Listener;
import com.raytheon.uf.common.dataplugin.gfe.python.GfePyIncludeUtil;
import com.raytheon.uf.common.python.PythonScript;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.ProductEditorLogger;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.RGBColors;
@ -83,6 +84,9 @@ import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
* 29 AUG 2013 #2250 dgilling Better error handling for parseProductText().
* 04 SEP 2013 16534 ryu Fixed word wrap to not insert duplicate text; refactor.
* 20 DEC 2013 16854 ryu Force re-parsing of text on type change.
* 28 JAN 2015 4018 randerso Code cleanup. Fixed reparsing when framing codes are cut
* or pasted instead of just typed over.
* Added logging of text changes to help diagnose future issues.
* 04 FEB 2015 17039 ryu Removed HighlightFramingCodes feature which prevented
* editing of framing codes.
*
@ -125,7 +129,7 @@ public class StyledTextComp extends Composite {
/**
* Parent composite.
*/
private Composite parent;
private ProductEditorComp parent;
/**
* Styled text editor.
@ -155,7 +159,7 @@ public class StyledTextComp extends Composite {
private boolean autoWrapMode;
private int wrapColumn = 80; // TODO: get from external
private int wrapColumn;
private boolean dirty = false;
@ -173,6 +177,8 @@ public class StyledTextComp extends Composite {
private boolean updatingForCor = false;
private ProductEditorLogger peLog;
private static final String NORM_SEP = "^\\s*$";
private static final String FUNNY_SEP = "^(\\s*)\\*(\\s*)";
@ -195,11 +201,18 @@ public class StyledTextComp extends Composite {
*
* @param parent
* Parent composite.
* @param wrapMode
* @param wrapColumn
*/
public StyledTextComp(Composite parent) {
public StyledTextComp(ProductEditorComp parent, int wrapColumn,
boolean wrapMode) {
super(parent, SWT.BORDER);
this.parent = parent;
this.wrapColumn = wrapColumn;
this.autoWrapMode = wrapMode;
this.peLog = new ProductEditorLogger(parent.getProductName());
init();
}
@ -285,6 +298,7 @@ public class StyledTextComp extends Composite {
@Override
public void modifyText(ExtendedModifyEvent event) {
logTextChange(event);
updateTextStyle(event);
checkAutoWrap(event);
@ -353,7 +367,7 @@ public class StyledTextComp extends Composite {
/*
* Lock the ci block text.
*/
HashMap<String, TextIndexPoints> ciMap = prodDataStruct.getCiMap();
Map<String, TextIndexPoints> ciMap = prodDataStruct.getCiMap();
TextIndexPoints ciBlockTip = ciMap.get("ciblock");
if (ciBlockTip != null) {
@ -365,7 +379,7 @@ public class StyledTextComp extends Composite {
/*
* Lock the mnd text.
*/
HashMap<String, TextIndexPoints> mndMap = prodDataStruct.getMndMap();
Map<String, TextIndexPoints> mndMap = prodDataStruct.getMndMap();
TextIndexPoints mndTip = mndMap.get("mnd");
if (mndTip != null) {
@ -401,7 +415,8 @@ public class StyledTextComp extends Composite {
// should be unlocked. Cities list is unlocked for editing
// when framing codes are present.
if (newProduct) {
if (cityTip != null && cityTip.getText().indexOf("|*") > 0) {
if ((cityTip != null)
&& (cityTip.getText().indexOf("|*") > 0)) {
unlockCitySegs.add(ugc);
}
}
@ -439,7 +454,7 @@ public class StyledTextComp extends Composite {
* correct the end value.
*/
int endLineOffset = 0;
if (endLine == productTextArray.length - 1) {
if (endLine == (productTextArray.length - 1)) {
++endLineOffset;
}
@ -492,11 +507,11 @@ public class StyledTextComp extends Composite {
* If python throws an Error trying to parse the product.
*/
private void parseProductText(String productText) throws JepException {
HashMap<String, Object> fmtResult = TextFmtParserUtil
Map<String, Object> fmtResult = TextFmtParserUtil
.parseText(productText);
prodDataStruct = new ProductDataStruct(fmtResult, productText);
prodDataStruct.printData();
// prodDataStruct.printData();
}
public void patchMND(String tag) {
@ -555,11 +570,11 @@ public class StyledTextComp extends Composite {
}
// Find the code and the pit
TextIndexPoints ff = prodDataStruct.getFunnyFiled();
TextIndexPoints ff = prodDataStruct.getFunnyField();
TextIndexPoints pit = prodDataStruct.getPIT();
if (ff == null) {
if (pit == null || newfield.length() == 0) {
if ((pit == null) || (newfield.length() == 0)) {
return; // No typecode or ci block found
} else {
ff = new TextIndexPoints();
@ -578,7 +593,7 @@ public class StyledTextComp extends Composite {
public void replaceText(TextIndexPoints tip, String text) {
replaceText(tip, text, false);
}
/**
* Replacement of the text in the given range with new text.
*
@ -599,8 +614,7 @@ public class StyledTextComp extends Composite {
// only reparse if we replaced with different length text or forced
// else, replace StyleRanges since the operation is safe
if ((tip.getText().length() != text.length())
|| forceReparse) {
if ((tip.getText().length() != text.length()) || forceReparse) {
dirty = true;
} else {
for (StyleRange range : ranges) {
@ -611,7 +625,7 @@ public class StyledTextComp extends Composite {
}
private void makeCorrections() {
((ProductEditorComp) parent).setPTypeCategory(PTypeCategory.COR);
parent.setPTypeCategory(PTypeCategory.COR);
List<SegmentData> segs = prodDataStruct.getSegmentsArray();
for (SegmentData seg : segs) {
if (seg.getSementMap().keySet().contains("vtec")) {
@ -626,20 +640,19 @@ public class StyledTextComp extends Composite {
try {
startUpdate();
List<SegmentData> segs = prodDataStruct.getSegmentsArray();
if (segs == null || segs.size() == 0) {
if ((segs == null) || (segs.size() == 0)) {
return;
}
int offset = textEditorST.getCaretOffset();
Pattern codePattern = Pattern.compile("\\.([A-Z]{3})\\.");
for (SegmentData segData : segs) {
HashMap<String, TextIndexPoints> segMap = segData
.getSementMap();
Map<String, TextIndexPoints> segMap = segData.getSementMap();
TextIndexPoints tipUgc = segMap.get("ugc");
int start = prodDataStruct.positionToOffset(tipUgc
.getStartIndex());
int end = prodDataStruct.positionToOffset(tipUgc.getEndIndex());
if (offset <= start || offset >= end) {
if ((offset <= start) || (offset >= end)) {
continue;
}
TextIndexPoints tipVtec = segMap.get("vtec");
@ -688,8 +701,10 @@ public class StyledTextComp extends Composite {
}
/**
* Handle the verify key event. This event fires after a change has been
* made to the control (after the text has been updated, for example)
* Handle the verify key event. Sent when the text is about to be modified.
* A verify event occurs after the user has done something to modify the
* text (typically typed a key), but before the text is modified. The doit
* field in the verify event indicates whether or not to modify the text.
*
* @param event
* Verify event that was fired.
@ -726,8 +741,8 @@ public class StyledTextComp extends Composite {
// this is specifically to handle the case of deleting line breaks
// between two separate locked sections so a locked section cannot be
// moved onto the end of an unlocked line
if (length == 1 && event.text.length() == 0) {
if (offset + 2 < textEditorST.getCharCount()
if ((length == 1) && (event.text.length() == 0)) {
if (((offset + 2) < textEditorST.getCharCount())
&& rangeHasLockedText(offset, 2)) {
event.doit = false;
return;
@ -739,21 +754,17 @@ public class StyledTextComp extends Composite {
}
private void updateTextStyle(ExtendedModifyEvent event) {
if (event.start + event.length + 1 < textEditorST.getCharCount()) {
if ((event.start + event.length + 1) < textEditorST.getCharCount()) {
int start = Math.max(0, event.start - 1);
int end = Math.min(textEditorST.getCharCount() - 1, event.start
+ event.length + 1);
StyleRange startRange = textEditorST.getStyleRangeAtOffset(start);
StyleRange endRange = textEditorST.getStyleRangeAtOffset(end);
// StyleRange startRange = textEditorST
// .getStyleRangeAtOffset(event.start - 1);
// StyleRange endRange = textEditorST
// .getStyleRangeAtOffset(event.start + event.length + 1);
// if it's in a framing code, turn it red
if (startRange != null && endRange != null
&& event.start > startRange.start
&& event.start + event.length < endRange.start
if ((startRange != null) && (endRange != null)
&& (event.start > startRange.start)
&& ((event.start + event.length) < endRange.start)
&& startRange.similarTo(endRange)
&& startRange.foreground.equals(frameColor)) {
StyleRange style = (StyleRange) startRange.clone();
@ -764,13 +775,14 @@ public class StyledTextComp extends Composite {
// framing code was deleted, need to turn it black
boolean framingCodeChange = false;
if (("*").equals(event.replacedText)
|| ("|").equals(event.replacedText)) {
if (event.replacedText.contains("*")
|| event.replacedText.contains("|")) {
framingCodeChange = true;
}
// framing code was added, need to turn it red
char newText = textEditorST.getText().charAt(event.start);
if (newText == '*' || newText == '|') {
String newText = textEditorST.getText().substring(event.start,
event.start + event.length);
if (newText.contains("*") || newText.contains("|")) {
framingCodeChange = true;
}
@ -826,10 +838,11 @@ public class StyledTextComp extends Composite {
* @return True if the key is an arrow or "non-edit" key.
*/
private boolean isNonEditKey(KeyEvent event) {
if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN
|| event.keyCode == SWT.ARROW_LEFT
|| event.keyCode == SWT.ARROW_RIGHT
|| event.keyCode == SWT.SHIFT) {
if ((event.keyCode == SWT.ARROW_UP)
|| (event.keyCode == SWT.ARROW_DOWN)
|| (event.keyCode == SWT.ARROW_LEFT)
|| (event.keyCode == SWT.ARROW_RIGHT)
|| (event.keyCode == SWT.SHIFT)) {
return true;
}
@ -1039,15 +1052,15 @@ public class StyledTextComp extends Composite {
int lineNum = textEditorST.getLineAtOffset(event.start);
int lineLength = textEditorST.getLine(lineNum).length();
if (lineLength < wrapColumn
&& event.length >= event.replacedText.length()) {
if ((lineLength < wrapColumn)
&& (event.length >= event.replacedText.length())) {
return;
}
String NL = textEditorST.getLineDelimiter();
String line = textEditorST.getLine(lineNum)
+ ((lineNum + 1 < totalLines) ? NL : EMPTY);
+ (((lineNum + 1) < totalLines) ? NL : EMPTY);
lineLength = line.length();
if (NL.equals(line) || EMPTY.equals(line)) {
return;
@ -1077,14 +1090,14 @@ public class StyledTextComp extends Composite {
// check for locked text
StyleRange styleRange = textEditorST.getStyleRangeAtOffset(lineOff
+ index);
if (styleRange != null && styleRange.foreground == lockColor) {
if ((styleRange != null) && (styleRange.foreground == lockColor)) {
return;
}
// deal with programmatic changes distant from the cursor
int eventCursor = cursorOffset;
if (eventCursor < event.start
|| eventCursor > event.start + event.length) {
if ((eventCursor < event.start)
|| (eventCursor > (event.start + event.length))) {
eventCursor = event.start + event.length;
}
@ -1162,7 +1175,7 @@ public class StyledTextComp extends Composite {
insertColor, lockColor };
String[] labels = new String[] { "Background", "Foreground", "Frame",
"Insert", "Locked" };
for (int i = 0; i < colors.length - 1; i++) {
for (int i = 0; i < (colors.length - 1); i++) {
for (int j = i + 1; j < colors.length; j++) {
warnIfEqual(colors[i], colors[j], labels[i], labels[j]);
}
@ -1346,7 +1359,7 @@ public class StyledTextComp extends Composite {
lineCursorPos = 0;
// remember last good endIndex
endIndex = lineStartOffset + line.length() - 1;
endIndex = (lineStartOffset + line.length()) - 1;
}
if (endIndex < 0) {
@ -1375,7 +1388,7 @@ public class StyledTextComp extends Composite {
// get the text from the caret to the end of the block
String post = "";
if (endIndex >= cursorIndex && cursorIndex < st.getCharCount()) {
if ((endIndex >= cursorIndex) && (cursorIndex < st.getCharCount())) {
post = st.getText(cursorIndex, endIndex);
}
@ -1384,7 +1397,7 @@ public class StyledTextComp extends Composite {
if (cursorIndex > 0) {
lchar = st.getTextRange(cursorIndex - 1, 1);
char lchar0 = lchar.charAt(0);
if (Character.isSpaceChar(lchar0) && lchar0 != NL.charAt(0)) {
if (Character.isSpaceChar(lchar0) && (lchar0 != NL.charAt(0))) {
lchar = " ";
} else {
lchar = "";
@ -1394,7 +1407,7 @@ public class StyledTextComp extends Composite {
String rchar = "";
if (post.length() > 0) {
char post0 = post.charAt(0);
if (Character.isSpaceChar(post0) && post0 != NL.charAt(0)) {
if (Character.isSpaceChar(post0) && (post0 != NL.charAt(0))) {
rchar = " ";
}
}
@ -1451,11 +1464,24 @@ public class StyledTextComp extends Composite {
post = post.replaceAll("^\\s*", "");
String text = pre + rchar + post;
st.replaceTextRange(startIndex, 1 + endIndex - startIndex, text);
st.replaceTextRange(startIndex, (1 + endIndex) - startIndex, text);
int newCaretOffset = startIndex + pre.length();
st.setCaretOffset(newCaretOffset);
return new int[] { startIndex, endIndex, text.length() };
}
protected void logTextChange(ExtendedModifyEvent event) {
StyledText st = ((StyledText) event.widget);
String oldText = event.replacedText;
String newText = "";
if (event.length > 0) {
newText = st.getText(event.start, (event.start + event.length) - 1);
}
if (!newText.equals(oldText)) {
peLog.logEdit(event.start, oldText, newText);
}
}
}

View file

@ -37,8 +37,6 @@ import javax.measure.unit.NonSI;
import javax.measure.unit.Unit;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.operation.TransformException;
@ -132,7 +130,7 @@ public class PointPrecipPlotResource extends
private Hashtable<String, Stn> pdataMap;
private final DailyQcUtils dqc = DailyQcUtils.getInstance();
static int prevPcpnDay;
/**
@ -174,8 +172,6 @@ public class PointPrecipPlotResource extends
strTree = new STRtree();
gageData = dqc.new Station();
if (!station.isEmpty()) {
if (!dqc.precip_stations.isEmpty()) {
int i = 0;
for (ListIterator<Station> it = dqc.precip_stations.listIterator(); it
@ -191,7 +187,8 @@ public class PointPrecipPlotResource extends
kv.append(":");
kv.append(pm);
dataMap.put(kv.toString(), gageData);
pdataMap.put(kv.toString(), DailyQcUtils.pdata[DailyQcUtils.pcpn_day].stn[i]);
pdataMap.put(kv.toString(),
DailyQcUtils.pdata[DailyQcUtils.pcpn_day].stn[i]);
/* Create a small envelope around the point */
Coordinate p1 = new Coordinate(xy.x + .02, xy.y + .02);
@ -336,7 +333,8 @@ public class PointPrecipPlotResource extends
}
for (m = 0; m < tsmax; m++) {
if (station.parm.substring(3, 5).equalsIgnoreCase(ts[m].abr)
if (station.parm.substring(3, 5)
.equalsIgnoreCase(dqc.ts[m].abr)
&& (DailyQcUtils.dflag[m + 1] == 1)) {
break;
}
@ -349,9 +347,9 @@ public class PointPrecipPlotResource extends
for (m = 0; m < 9; m++) {
if ((m == pdataMap.get(key).frain[time_pos].qual)
&& (qflag[m] == 1)) {
&& (dqc.qflag[m] == 1)) {
break;
} else if ((m == 7) && (qflag[7] == 1)
} else if ((m == 7) && (dqc.qflag[7] == 1)
&& (pdataMap.get(key).frain[time_pos].data == -99)
&& (pdataMap.get(key).frain[time_pos].qual == -99)) {
break;

View file

@ -0,0 +1,121 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.texteditor.scripting.dialogs.util;
import java.util.ArrayList;
import java.util.List;
import com.raytheon.uf.common.message.Message;
import com.raytheon.uf.common.message.Property;
import com.raytheon.viz.texteditor.TextDBQuery;
/**
* Contains utility methods for interactions with the text database.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 22, 2009 mfegan Initial creation
* Jul 13, 2010 2187 cjeanbap Add opertional mode functionality.
* 02Aug2010 2187 cjeanbap Update variable/method signature to be consistent.
* Feb 04, 2015 4086 njensen Resurrected class and changed to use TextDBQuery
*
* </pre>
*
* @author mfegan
* @version 1.0
*/
public final class TextDBUtilities {
public static final String TYPE_PROD = "PROD";
public static final String TYPE_INFO = "INFO";
/**
*
*/
private TextDBUtilities() {
// no class instances
}
public static String writeProductToDatabase(String prodID, String contents,
boolean operationalMode) throws Exception {
TextDBQuery query = createProductStoreMessage(prodID, contents,
operationalMode);
Message message = query.executeQuery();
StringBuffer sb = new StringBuffer();
for (Property property : message.getHeader().getProperties()) {
String value = property.getValue();
if (value.matches("^NORMAL")) {
sb.append(value.split(":")[1]).append("\n");
} else {
throw new Exception("Received error from product retrieval - "
+ value);
}
}
return sb.toString().trim();
}
public static String[] readProductFromDatabase(String prodID, String type,
boolean operationalMode) throws Exception {
TextDBQuery query = createProductRequestMessage(prodID, type,
operationalMode);
Message message = query.executeQuery();
List<String> products = new ArrayList<String>();
Property[] properties = message.getHeader().getProperties();
if (properties == null) {
return null;
}
for (Property property : message.getHeader().getProperties()) {
if ("stdout".equalsIgnoreCase(property.getName())) {
products.add(property.getValue());
} else {
throw new Exception(property.getValue());
}
}
return products.toArray(new String[] {});
}
private static TextDBQuery createProductRequestMessage(String prodID,
String type, Boolean operationalMode) {
TextDBQuery query = new TextDBQuery();
query.setQueryViewName("text");
query.setQueryOpName("GET");
query.setQuerySubObName(type);
query.setQueryAfosCmd(prodID);
query.setQueryOperationalMode(operationalMode.toString());
return query;
}
private static TextDBQuery createProductStoreMessage(String prodID,
String product, Boolean operationalMode) {
TextDBQuery query = new TextDBQuery();
query.setQueryViewName("text");
query.setQueryOpName("PUT");
query.setQueryProduct(product);
query.addProductId(prodID);
query.setQueryOperationalMode(operationalMode.toString());
return query;
}
}

View file

@ -0,0 +1,504 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.texteditor.scripting.runner;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jep.JepException;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.viz.core.mode.CAVEMode;
import com.raytheon.viz.texteditor.msgs.IScriptRunnerObserver;
import com.raytheon.viz.texteditor.scripting.dialogs.util.FileUtilities;
import com.raytheon.viz.texteditor.scripting.dialogs.util.TextDBUtilities;
import com.raytheon.viz.texteditor.scripting.dialogs.util.Utilities;
/**
* Class providing the top level implementations of the special Text WS
* scripting commands.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 29, 2009 mfegan Initial creation
* Jul 13, 2010 2187 cjeanbap Add operational mode functionality
* Feb 04, 2015 4086 njensen Resurrected class
*
* </pre>
*
* @author mfegan
* @version 1.0
*/
public class TextWsCommands {
private final String TIME_FMT = "%1$tD %1$tT";
private String editor = "";
private IScriptRunnerObserver observer = null;
private boolean canceled = false;
private boolean operationalMode = true;
/**
*
*/
public TextWsCommands() {
CAVEMode mode = CAVEMode.getMode();
this.operationalMode = (CAVEMode.OPERATIONAL.equals(mode)
|| CAVEMode.PRACTICE.equals(mode) ? true : false);
}
public void setEditor(String editor) {
this.editor = editor;
}
public void setObserver(Object observer) {
this.observer = (IScriptRunnerObserver) observer;
}
/**
* Implements the Text Workstation script runner's {@code run(file)}
* command. The file to execute must be in the current user's home
* directory.
*
* @param file
* name of the script to execute
*
* @throws Exception
* if any problem occurs
*/
public void runLocalFile(String file) throws JepException {
String homeDir = System.getProperty("user.home");
if (Utilities.isEmptyString(file)) {
throw new JepException("no file specified -- unable to execute");
}
if (file.indexOf("/") != -1) {
throw new JepException("expected local file but got \"" + file
+ "\"");
}
String script = homeDir + "/" + file;
// try {
// script = FileUtilities.loadFileToString(homeDir, file);
// } catch (IOException e) {
// throw new Exception("could not open \"" + file + "\"",e);
// }
System.out.println(script);
observer.executeTextScript(script);
}
/**
* Implements the Text Workstation script runner's {@code load(pid)}
* command. Reads the latest product matching the specified PID from the
* text database and sends it to the observer for display.
*
* @param pil
* the product ID (PID)
*
* @throws Exception
* when any error occurs
*/
public void loadTextProduct(String pil) throws Exception {
if (Utilities.isEmptyString(pil)) {
throw new Exception(
"no product ID provided -- unable to load product");
}
if (observer.isEditMode()) {
throw new Exception("Cannot load product: text window in edit mode");
}
if (pil.startsWith("E:") || pil.startsWith("M:")) {
throw new Exception(
"Cannot load product: cannot edit products while script is running");
}
observer.writeText("--- requesting " + pil
+ " from text database ---\n");
String[] products;// = observer.getProductFromDatabase(pid);
try {
products = TextDBUtilities.readProductFromDatabase(pil,
TextDBUtilities.TYPE_PROD, this.operationalMode);
} catch (Exception e) {
observer.writeText("--- product \"" + pil
+ "\" not available ---\n");
observer.showErrorMessage("failure reading from database.", e);
return;
}
if (products == null || products.length == 0) {
observer.writeText("--- product \"" + pil
+ "\" not available ---\n");
observer.showScriptStatus("Requested product \"" + pil
+ "\" not found in data base");
return;
}
observer.postProductToEditor(products, new String[] { pil });
}
/**
* Implements the Text Workstation script runner's
* {@code readdb(pid,filename)} command. Reads the latest product matching
* the pid and writes the product to the specified file. Emulates the AWIPS
* I <em>textdb -rd PIL</em> retrieval.
*
* @param pil
* the AFOS PIL to retrieve
* @param filename
* path to the file to contain the results
*
* @throws Exception
* if an error occurs
*/
public void saveProductToFile(String pil, String filename) throws Exception {
if (Utilities.isEmptyString(pil)) {
throw new Exception(
"no product ID provided -- unable to read product");
}
if (Utilities.isEmptyString(filename)) {
throw new Exception(
"no file name provided -- unable to read product");
}
observer.writeText("--- requesting " + pil
+ " from text database ---\n");
String[] products = null;
try {
products = TextDBUtilities.readProductFromDatabase(pil,
TextDBUtilities.TYPE_INFO, this.operationalMode);
} catch (Exception e) {
observer.writeText("--- product \"" + pil
+ "\" not available ---\n");
observer.showErrorMessage("failure reading from database.", e);
return;
}
if (products == null || products.length == 0) {
observer.writeText("--- product \"" + pil
+ "\" not available ---\n");
observer.showScriptStatus("Requested product \"" + pil
+ "\" not found in data base");
return;
}
int count = products.length;
String ln = System.getProperty("line.separator", "\n");
observer.writeText("--- obtained " + count + " records for " + pil
+ " ---\n");
StringBuffer sb = new StringBuffer();
for (String product : products) {
sb.append(product).append(ln);
}
observer.writeText("--- writing results for " + pil + " to " + filename
+ " ---\n");
try {
FileUtilities.writeStringToFile(filename, sb.toString());
} catch (Exception e) {
observer.writeText("--- cannot write to " + filename + " ---");
observer.showErrorMessage("cannot write to " + filename, e);
}
}
/**
* Implements the Text Workstation script runner's
* {@code writedb(pid,filename)} command. Reads the contents of the
* specified file and posts the contents to the text database using the
* specified product ID.
*
* @param pil
* the product ID
* @param filename
* the path to the data file
*
* @throws Exception
* if any problem occurs
*/
public void readProductFromFile(String pil, String filename)
throws Exception {
if (Utilities.isEmptyString(pil)) {
throw new Exception(
"no product ID provided -- unable to write product");
}
if (Utilities.isEmptyString(filename)) {
throw new Exception(
"no file name provided -- unable to write product");
}
observer.writeText("--- reading product from " + filename + " ---\n");
String contents = "";
try {
contents = FileUtilities.loadFileToString(filename);
} catch (Exception e) {
throw new Exception("cannot read from " + filename);
}
try {
String result = TextDBUtilities.writeProductToDatabase(pil,
contents, this.operationalMode);
observer.showScriptStatus(result);
} catch (Exception e) {
observer.showErrorMessage("failure writing to database ", e);
}
}
/**
* Puts the script runner into a "safe" wait state. This state can be
* interrupted by the user in one of two ways; 'Continue' and 'Cancel'.
*
* @throws Exception
* if an error occurs
*/
public void waitIndefinate() throws Exception {
observer.showScriptStatus("Waiting for user to continue...");
observer.activateControls(false, true);
// indefinite sleep loop
while (true) {
if (observer.cancelScript()) {
canceled = true;
break;
} else if (observer.continueScript()) {
break;
}
try {
Thread.sleep(100);
doEvents();
} catch (InterruptedException e) {
// nothing to do
}
}
observer.activateControls(false, false);
}
/**
* Waits until the specified number of minutes after the hour. the number of
* minutes must be between 0 and 59 inclusive. If the specified time is less
* than the current minutes after the hour, the delay is scheduled into the
* next hour.
*
* @param time
* time delay after the hour
*
* @throws Exception
* in case of any error
*/
public void waitUntilTime(int minToWait) throws Exception {
if (minToWait < 0 || minToWait > 59) {
throw new Exception(
"Invalid argument: expected integer between 0 and 59 but got \""
+ minToWait + "\"");
}
/* determine when to end wait */
Date date = (Date) SimulatedTime.getSystemTime().getTime().clone();
Calendar target = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
target.setTime(date);
int minPastHour = target.get(Calendar.MINUTE);
if (minPastHour > minToWait) {
// past target -- wait into next hour
target.add(Calendar.HOUR_OF_DAY, 1);
}
target.set(Calendar.MINUTE, minToWait);
target.set(Calendar.SECOND, 0);
/* execute the safe sleep */
safeSleep(target.getTime());
}
/**
* Waits for the specified amount of time. The format of the time
* specification is <em>HH:MM:SS</em>; resulting of a delay of up to 23hrs
* 59min 59sec.
*
* @param time
* the amount of time to delay
*
* @throws Exception
* in case of any error
*/
public void waitForTime(String time) throws Exception {
/* parse/validate the argument */
Pattern p = Pattern.compile("(\\d{2}):(\\d{2}):(\\d{2})");
Matcher m = p.matcher(time);
if (!m.matches()) {
throw new Exception(
"Invalid argument: expected format HH:MM:SS but got \""
+ time + "\"");
}
int hrs = 0;
int mins = 0;
int secs = 0;
try {
hrs = Integer.parseInt(m.group(1));
mins = Integer.parseInt(m.group(2));
secs = Integer.parseInt(m.group(3));
} catch (NumberFormatException e) {
throw new Exception(
"Invalid argument: expected format HH:MM:SS but got \""
+ time + "\"", e);
}
if (hrs < 0 || hrs > 23 || mins < 0 || mins > 59 || secs < 0
|| secs > 59) {
throw new Exception(
"Invalid argument: expected format HH:MM:SS but got \""
+ time + "\"");
}
/* delay time in seconds */
int delay = 3600 * hrs + 60 * mins + secs;
/* create a calendar representing the wait end time */
Date now = (Date) SimulatedTime.getSystemTime().getTime().clone();
Calendar date = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
date.setTime(now);
date.add(Calendar.SECOND, delay);
/* execute the safe sleep */
safeSleep(date.getTime());
}
/**
* Safely sleeps the specified number of seconds.
*
* @param sleepToTime
* provides the end time of the sleep
*
* @throws Exception
* if an error occurs
*/
private void safeSleep(Date sleepToTime) throws Exception {
/* short circuit -- return if end time already past */
if (SimulatedTime.getSystemTime().getTime().after(sleepToTime)) {
return;
}
observer.activateControls(true, false);
observer.showScriptStatus("Waiting until "
+ String.format(TIME_FMT, sleepToTime) + " to proceed...");
while (SimulatedTime.getSystemTime().getTime().before(sleepToTime)) {
if (observer.cancelScript()) {
canceled = true;
break;
} else if (observer.skipWait()) {
break;
}
try {
Thread.sleep(100);
doEvents();
} catch (InterruptedException e) {
// nothing to do
}
}
observer.activateControls(false, false);
}
/**
* Turns results accumulation on in the Text Editor Window.
*
* @param flag
* true to start accumulation, false to stop accumulation
*
* @throws Exception
* if an error occurs
*/
public void setAccumulation(boolean flag) throws Exception {
if (observer.isEditMode()) {
throw new Exception(
"Cannot set accumulate: text window in edit mode");
}
observer.writeText("--- turning accumulation " + (flag ? "on" : "off")
+ " ---\n");
observer.setAccumulation(flag);
}
/**
* Clears the Text Editor Window
*
* @throws Exception
* if an error occurs
*/
public void clearTextDisplay() throws Exception {
if (observer.isEditMode()) {
throw new Exception("Cannot clear: text window in edit mode");
}
observer.writeText("--- clearing text display window ---\n");
observer.clearTextDisplay();
}
/**
* Sends the specified text to the observer for display. This method is used
* to cause output from Python's print command to be redirected to the
* observer.
*
* @param text
* the text to display
*/
public void writeText(String text) {
observer.writeText(text);
}
/**
* Sends the specified text to the observer for display. This method is used
* to capture output from {@code stderr} in the a python script and redirect
* it to the observer.
*
* @param errMsg
* the stderr text to display
*/
public void writeError(String errMsg) {
observer.scriptError();
writeText(errMsg);
observer.addStdErrMsg(errMsg);
}
/**
* allows the script to request a refresh of the GUI
*/
public void doEvents() {
while (observer.getDisplay().readAndDispatch()) {
}
}
// /**
// *
// * @return
// */
// public boolean continueScript() {
// return observer.continueScript();
// }
// /**
// *
// * @return
// */
// public boolean skipWait() {
// return observer.skipWait();
// }
/**
* Returns {@code true} is the user has canceled the script via a user
* interface element. This method should be called periodically during loops
* and pauses to determine if a user ordered cancel has occurred.
*/
public boolean cancelScript() {
return observer.cancelScript();
}
/**
* Returns {@code true} if the script was canceled. This allows the Python
* wrapper to properly relay the script cancellation to the script runner.
* Note: this is not set by all commands.
*/
public boolean isCanceled() {
return canceled;
}
}

View file

@ -21,7 +21,7 @@
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="menuItem" menuText="Temperature" key="T"
indentText="false" />
contribute xsi:type="menuItem" menuText="Temp Anl Uncertainty"
<contribute xsi:type="menuItem" menuText="Temp Anl Uncertainty"
key="Terranl" indentText="true" />
<contribute xsi:type="menuItem" menuText="Dewpoint" key="DpT"
indentText="true" />

View file

@ -4,7 +4,11 @@ architecture=x86_64
includegen.filter=raytheon|noaa\.nws|noaa\.gsd|gov\.nasa\.msfc|edu\.wisc\.ssec\.cimss
# AWIPSII core repositories required for build
core.repositories=ufcore,ufcore-foss,AWIPS2_foss
core.repo=ufcore
core-foss.repo=ufcore-foss
awips2-foss.repo=AWIPS2_foss
core.repositories=${core.repo},${core-foss.repo},${awips2-foss.repo}
# Note: currently, there is a limit of 99 plugin directories.
dir.01=cave

View file

@ -10,6 +10,8 @@ export FXA_DB_NAME=fxatext
export HM_DB_NAME=hmdb
export IH_DB_NAME=hd_ob92oax
# Resolve conflict on AFOS PILs by finding site with first letter in the following order.
export PREFERRED_AFOS_FIRST_LETTER="KCPTXM"
### end of localization variables ###
# setup environment for HPE
@ -49,3 +51,4 @@ export SITE_IDENTIFIER=${AW_SITE_IDENTIFIER}
# set Fax environment variables pointing to ldad@ls1
export LDAD_EXTERNAL_HOME=/ldad
export LDAD_EXTERNAL_PUBLIC=/data/ldad/public

View file

@ -105,7 +105,6 @@
<property name="maxConnections" value="${PYPIES_MAX_CONN}"/>
<!-- value in milliseconds to allow socket to timeout, don't allow this to be zero, bad things could happen -->
<property name="socketTimeout" value="180000"/>
<property name="handlingGzipResponses" value="false"/>
</bean>
<bean id="httpClientConfig" factory-bean="httpClientConfigBuilder" factory-method="build"/>

View file

@ -391,7 +391,7 @@ AstroTide = ("AstroTide", SCALAR, "ft", "Astro Tide", 20.0, -8.0, 1, NO)
StormSurge = ("StormSurge", SCALAR, "ft", "Storm Surge", 30.0, -5.0, 1, NO)
# Parm for Aviation/GFSLAMPGrid
ClgHgt=("ClgHgt",SCALAR,"ft","Ceiling Height",25000.0,-100.0,0,NO)
CigHgt=("CigHgt",SCALAR,"ft","Ceiling Height",25000.0,-100.0,0,NO)
#---------------------------------------------------------------------------
#
@ -2055,7 +2055,7 @@ ENPwave_parms = [([WindWaveHeight, WaveHeight, SurfHeight, Wind], TC6),
([Swell, Swell2, Period, Period2], TC6)]
# GFSLAMPGrid
GFSLAMPGridPARMS=[([Temp, Td, Vis, ClgHgt],TC1)]
GFSLAMPGridPARMS=[([Temp, Td, Vis, CigHgt],TC1)]
#---------------------------------------------------------------------------
# Databases for a site.

View file

@ -8,17 +8,17 @@
################################################################################
# Import existing model database initialization parameters
from Init import *
class GFSLAMPForecaster(Forecaster):
class GFSLAMPGridForecaster(Forecaster):
def __init__(self):
Forecaster.__init__(self, "GFSLAMP","GFSLAMP")
Forecaster.__init__(self, "GFSLAMPGrid","GFSLAMPGrid")
def calcClgHgt(self, cc_CLG):
ceil = cc_CLG * 3.280839
def calcCigHgt(self, cc_CLG):
ceil = cc_CLG / 0.3048
ceil = where(less(cc_CLG, 0), -99., ceil)
return ceil
def calcVis(self, vis_SFC):
return (vis_SFC * 3.2808) / 5279.85564
return (vis_SFC / 0.3048 / 5280.0)
def calcT(self, t_FHAG2):
return self.KtoF(t_FHAG2)
@ -30,4 +30,4 @@ class GFSLAMPForecaster(Forecaster):
# Set this file up to run with SmartInitialization
def main():
GFSLAMPForecaster().run()
GFSLAMPGridForecaster().run()

View file

@ -29,6 +29,7 @@ SOFTWARE HISTORY
Date Ticket# Engineer Description
------------ ---------- ----------- --------------------------
Jul 09, 2008 1222 jelkins Split command line loader from class
Jan 26, 2015 4033 randerso Fix logging broken by #3685
@author: jelkins
"""
@ -46,12 +47,20 @@ from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request impo
SCRIPT_DIR = abspath(dirname(argv[0]))
# ---- Setup Logging ----------------------------------------------------------
LOG_CONF = join(SCRIPT_DIR,"preferences","logging.conf")
import logging
from time import strftime, gmtime
timeStamp = strftime("%Y%m%d", gmtime())
logFile = '/awips2/edex/logs/configureTextProducts-'+timeStamp+'.log'
import logging.config
logging.config.fileConfig(LOG_CONF)
LOG = logging.getLogger(basename(argv[0]))
LOG = logging.getLogger("configureTextProducts")
LOG.setLevel(logging.DEBUG)
handler = logging.FileHandler(logFile)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(levelname)-5s %(asctime)s [%(process)d:%(thread)d] %(filename)s: %(message)s")
handler.setFormatter(formatter)
for h in LOG.handlers:
LOG.removeHandler(h)
LOG.addHandler(handler)
class ConfigureTextProducts:
"""Command Line Interface for the TextProductsGenerator

View file

@ -930,6 +930,7 @@ public class FSSObsMonitorConfigurationManager implements
public void fileUpdated(FileUpdatedMessage message) {
if (message.getFileName().equals(getConfigFileName())) {
try {
readConfigXml();
// inform listeners
for (MonitorConfigListener fl : listeners) {
fl.configChanged(new MonitorConfigEvent(this));

View file

@ -27,10 +27,13 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -49,6 +52,7 @@ import org.springframework.orm.hibernate4.SessionFactoryUtils;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
import com.raytheon.edex.site.SiteUtil;
import com.raytheon.uf.common.dataplugin.text.db.OperationalStdTextProduct;
import com.raytheon.uf.common.dataplugin.text.db.PracticeStdTextProduct;
import com.raytheon.uf.common.dataplugin.text.db.StdTextProduct;
@ -60,14 +64,15 @@ import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.site.SiteMap;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.Pair;
import com.raytheon.uf.common.wmo.AFOSProductId;
import com.raytheon.uf.edex.database.cluster.ClusterLockUtils;
import com.raytheon.uf.edex.database.cluster.ClusterTask;
import com.raytheon.uf.edex.database.dao.CoreDao;
import com.raytheon.uf.edex.database.dao.DaoConfig;
import com.raytheon.uf.edex.database.purge.PurgeLogger;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
/**
* The dao implementation associated with the TextDao classes used for all
@ -91,9 +96,10 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* 03Oct2012 15244 mgamazaychikov Added the fix to query the appropriate table
* (operational or practice)
* May 20, 2014 2536 bclement moved from edex.textdb to edex.plugin.text
* Sep 18, 2014 3627 mapeters Updated deprecated {@link TimeTools} usage.
* Sep 18, 2014 3627 mapeters Updated deprecated TimeTools usage.
* 10/16/2014 3454 bphillip Upgrading to Hibernate 4
* 10/28/2014 3454 bphillip Fix usage of getSession()
* Jan 27, 2015 4031 rferrel Resolve AFOS PILs site conflict using preferredAfosFirstLetter.
* </pre>
*
* @author garmendariz
@ -125,6 +131,8 @@ public class StdTextProductDao extends CoreDao {
private static final String NNN_ID = "nnnid";
private static final String SITE = "site";
private static final String PRODUCT = "product";
private static final String ProdSITE = "prodId.site";
@ -141,23 +149,42 @@ public class StdTextProductDao extends CoreDao {
private static final String TM_QUERY_FMT = "select refTime from table_name where cccid='%s' and nnnid='%s' and xxxid='%s';";
private static final String SITE_QUERY_FMT = "select distinct site from table_name where cccid='%s' and nnnid='%s' and xxxid='%s';";
private static final String DEFAULT_PREFERRED_AFOS_FIRST_LETTER = "KCPTXM";
private static final String AFOS_QUERY_STMT = "from StdTextProduct where "
+ ProdCCC_ID
+ " = :"
+ CCC_ID
+ " and "
+ ProdNNN_ID
+ " = :"
+ NNN_ID
+ " and "
+ ProdXXX_ID
+ " = :"
+ XXX_ID
+ " order by "
+ REFTIME + " desc" + ", " + INSERTTIME + " desc";
+ ProdCCC_ID + " = :" + CCC_ID
+ " and " + ProdNNN_ID + " = :" + NNN_ID
+ " and " + ProdXXX_ID + " = :" + XXX_ID
+ " and " + ProdSITE + " = :" + SITE
+ " order by " + REFTIME + " desc" + ", " + INSERTTIME + " desc";
private Log logger = LogFactory.getLog(getClass());
private final static char[] preferredAfosFirstLetter;
static {
String afosLetters = System.getenv("PREFERRED_AFOS_FIRST_LETTER");
if (afosLetters == null) {
afosLetters = DEFAULT_PREFERRED_AFOS_FIRST_LETTER;
}
// Place site's first letter at the start of the preferred letters.
String awSite = SiteMap.getInstance().getSite4LetterId(
SiteUtil.getSite());
afosLetters = afosLetters.replaceAll(awSite.substring(0, 1), "");
preferredAfosFirstLetter = new char[afosLetters.length() + 1];
afosLetters.getChars(0, afosLetters.length(), preferredAfosFirstLetter,
1);
preferredAfosFirstLetter[0] = awSite.charAt(0);
}
private String siteQueryFmt;
/**
*
*/
@ -219,9 +246,8 @@ public class StdTextProductDao extends CoreDao {
String nnnid = prodId.getNnnid();
String xxxid = prodId.getXxxid();
Query query = session
.createQuery(
"SELECT versionstokeep FROM TextProductInfo WHERE "
+ "prodId.cccid = :cccid AND prodId.nnnid = :nnnid AND prodId.xxxid = :xxxid");
.createQuery("SELECT versionstokeep FROM TextProductInfo WHERE "
+ "prodId.cccid = :cccid AND prodId.nnnid = :nnnid AND prodId.xxxid = :xxxid");
query.setParameter("cccid", cccid);
query.setParameter("nnnid", nnnid);
query.setParameter("xxxid", xxxid);
@ -261,81 +287,16 @@ public class StdTextProductDao extends CoreDao {
* @param pastHours
* @return
*/
public List<StdTextProduct> cccnnnxxxReadVersion(final String ccc, final String nnn,
final String xxx, final int version) {
public List<StdTextProduct> cccnnnxxxReadVersion(final String ccc,
final String nnn, final String xxx, final int version) {
List<StdTextProduct> products = null;
boolean hasCCC = ((ccc != null) && (ccc.length() > 0) && (!ccc
.equals("000")));
boolean hasNNN = ((nnn != null) && (nnn.length() > 0) && (!nnn
.equals("000")));
boolean hasXXX = ((xxx != null) && (xxx.length() > 0) && (!xxx
.equals("000")));
final boolean createInitialFilter = !(hasCCC && hasNNN && hasXXX);
try {
final AFOSProductId[] afosIds = txTemplate
.execute(new TransactionCallback<AFOSProductId[]>() {
final List<Pair<String, AFOSProductId>> siteAfosIdList = querySiteAfosId(
ccc, nnn, xxx);
@Override
public AFOSProductId[] doInTransaction(
TransactionStatus status) {
String paddedccc = StringUtils.rightPad(ccc,
MAX_FIELD_LENGTH);
String paddednnn = StringUtils.rightPad(nnn,
MAX_FIELD_LENGTH);
String paddedxxx = StringUtils.rightPad(xxx,
MAX_FIELD_LENGTH);
Session session = getCurrentSession();
AFOSProductId[] afosIds = null;
StdTextProduct stdTextProduct = getStdTextProductInstance();
if (createInitialFilter) {
stdTextProduct.setCccid(paddedccc);
stdTextProduct.setNnnid(paddednnn);
stdTextProduct.setXxxid(paddedxxx);
Map<String, String> map = buildCriterions(
ProdCCC_ID, paddedccc, ProdNNN_ID,
paddednnn, ProdXXX_ID, paddedxxx);
Criteria criteria = session
.createCriteria(stdTextProduct
.getClass());
ProjectionList projList = Projections
.projectionList();
projList.add(Projections.property(ProdCCC_ID));
projList.add(Projections.property(ProdNNN_ID));
projList.add(Projections.property(ProdXXX_ID));
criteria.setProjection(Projections
.distinct(projList));
criteria.add(Restrictions.allEq(map));
criteria.addOrder(Order.asc(ProdCCC_ID));
criteria.addOrder(Order.asc(ProdNNN_ID));
criteria.addOrder(Order.asc(ProdXXX_ID));
List<?> list = criteria.list();
if (list != null && list.size() > 0) {
afosIds = new AFOSProductId[list.size()];
int i = 0;
for (Object row : list) {
Object[] cols = (Object[]) row;
afosIds[i++] = new AFOSProductId(
(String) cols[0],
(String) cols[1],
(String) cols[2]);
}
} else {
afosIds = new AFOSProductId[0];
}
} else {
afosIds = new AFOSProductId[1];
afosIds[0] = new AFOSProductId(paddedccc,
paddednnn, paddedxxx);
}
return afosIds;
}
});
products = txTemplate.execute(new TransactionCallback<List<StdTextProduct>>() {
products = txTemplate
.execute(new TransactionCallback<List<StdTextProduct>>() {
@Override
public List<StdTextProduct> doInTransaction(
@ -343,50 +304,60 @@ public class StdTextProductDao extends CoreDao {
List<StdTextProduct> products = null;
Session session = getCurrentSession();
/*
* DR15244 - Make sure that the query is performed on the appropriate
* table based on what StdTextProduct is requested (ultimately on CAVE mode)
* DR15244 - Make sure that the query is performed
* on the appropriate table based on what
* StdTextProduct is requested (ultimately on CAVE
* mode)
*/
Matcher m = Pattern.compile("StdTextProduct").matcher(AFOS_QUERY_STMT);
String tableName = getStdTextProductInstance().getClass().getSimpleName();
Matcher m = Pattern.compile("StdTextProduct")
.matcher(AFOS_QUERY_STMT);
String tableName = getStdTextProductInstance()
.getClass().getSimpleName();
String tableQuery = m.replaceAll(tableName);
Query query = session.createQuery(tableQuery);
if (version >= 0) {
query.setMaxResults(version + 1);
}
for (AFOSProductId afosId : afosIds) {
query.setParameter(CCC_ID, afosId.getCcc());
query.setParameter(NNN_ID, afosId.getNnn());
query.setParameter(XXX_ID, afosId.getXxx());
List<?> results = query.list();
if (results != null && results.size() > 0) {
if (version == -1) {
// want all versions
if (products == null) {
products = new ArrayList<StdTextProduct>(
results.size() * afosIds.length);
for (Pair<String, AFOSProductId> siteAfosId : siteAfosIdList) {
String site = siteAfosId.getFirst();
AFOSProductId afosId = siteAfosId.getSecond();
if (site != null) {
query.setParameter(CCC_ID, afosId.getCcc());
query.setParameter(NNN_ID, afosId.getNnn());
query.setParameter(XXX_ID, afosId.getXxx());
query.setParameter(SITE, site);
List<?> results = query.list();
if (results != null && results.size() > 0) {
if (version == -1) {
// want all versions
if (products == null) {
products = new ArrayList<StdTextProduct>(
results.size()
* siteAfosIdList
.size());
}
for (Object row : results) {
products.add((StdTextProduct) row);
}
} else if (results.size() > version) {
// want specific version
if (products == null) {
products = new ArrayList<StdTextProduct>(
siteAfosIdList.size());
}
products.add((StdTextProduct) results
.get(version));
}
for (Object row : results) {
products.add((StdTextProduct) row);
}
} else if (results.size() > version) {
// want specific version
if (products == null) {
products = new ArrayList<StdTextProduct>(
afosIds.length);
}
products.add((StdTextProduct) results.get(version));
}
}
}
return products;
}
});
} catch (Exception e) {
logger.error("Error occurred reading products", e);
}
@ -398,6 +369,188 @@ public class StdTextProductDao extends CoreDao {
return products;
}
/**
* Get desired site for the afosId the pairs are order by AfosId.
*
* @param ccc
* @param nnn
* @param xxx
* @return siteAfosIds
*/
private List<Pair<String, AFOSProductId>> querySiteAfosId(final String ccc,
final String nnn, final String xxx) {
boolean hasCCC = ((ccc != null) && (ccc.length() > 0) && (!ccc
.equals("000")));
boolean hasNNN = ((nnn != null) && (nnn.length() > 0) && (!nnn
.equals("000")));
boolean hasXXX = ((xxx != null) && (xxx.length() > 0) && (!xxx
.equals("000")));
final boolean createInitialFilter = !(hasCCC && hasNNN && hasXXX);
return txTemplate
.execute(new TransactionCallback<List<Pair<String, AFOSProductId>>>() {
@Override
public List<Pair<String, AFOSProductId>> doInTransaction(
TransactionStatus status) {
String paddedccc = StringUtils.rightPad(ccc,
MAX_FIELD_LENGTH);
String paddednnn = StringUtils.rightPad(nnn,
MAX_FIELD_LENGTH);
String paddedxxx = StringUtils.rightPad(xxx,
MAX_FIELD_LENGTH);
Session session = getCurrentSession();
List<Pair<String, AFOSProductId>> siteProductPairList = null;
StdTextProduct stdTextProduct = getStdTextProductInstance();
if (createInitialFilter) {
stdTextProduct.setCccid(paddedccc);
stdTextProduct.setNnnid(paddednnn);
stdTextProduct.setXxxid(paddedxxx);
Map<String, String> map = buildCriterions(
ProdCCC_ID, paddedccc, ProdNNN_ID,
paddednnn, ProdXXX_ID, paddedxxx);
Criteria criteria = session
.createCriteria(stdTextProduct.getClass());
ProjectionList projList = Projections
.projectionList();
projList.add(Projections.property(ProdCCC_ID));
projList.add(Projections.property(ProdNNN_ID));
projList.add(Projections.property(ProdXXX_ID));
projList.add(Projections.property(ProdSITE));
criteria.setProjection(Projections
.distinct(projList));
criteria.add(Restrictions.allEq(map));
criteria.addOrder(Order.asc(ProdCCC_ID));
criteria.addOrder(Order.asc(ProdNNN_ID));
criteria.addOrder(Order.asc(ProdXXX_ID));
List<?> list = criteria.list();
if ((list != null) && !list.isEmpty()) {
Map<Integer, Set<String>> siteMap = new HashMap<>();
List<AFOSProductId> orderedAfosIds = new ArrayList<>(
list.size());
for (Object row : list) {
Object[] cols = (Object[]) row;
AFOSProductId afosId = new AFOSProductId(
(String) cols[0], (String) cols[1],
(String) cols[2]);
String site = (String) cols[3];
int index = orderedAfosIds.indexOf(afosId);
if (index < 0) {
index = orderedAfosIds.size();
orderedAfosIds.add(afosId);
}
Set<String> sites = siteMap.get(index);
if (sites == null) {
sites = new HashSet<>();
siteMap.put(index, sites);
}
sites.add(site);
}
siteProductPairList = new ArrayList<>(siteMap
.size());
List<Integer> indices = new ArrayList<>(siteMap
.keySet());
Collections.sort(indices);
for (int index : indices) {
String site = getSite(siteMap.get(index)
.toArray());
AFOSProductId afosId = orderedAfosIds
.get(index);
Pair<String, AFOSProductId> pair = new Pair<String, AFOSProductId>(
site, afosId);
siteProductPairList.add(pair);
}
} else {
siteProductPairList = new ArrayList<Pair<String, AFOSProductId>>(
0);
}
} else {
AFOSProductId afosId = new AFOSProductId(paddedccc,
paddednnn, paddedxxx);
String site = getSite(afosId);
if (site == null) {
siteProductPairList = new ArrayList<Pair<String, AFOSProductId>>(
0);
} else {
siteProductPairList = new ArrayList<>(1);
siteProductPairList
.add(new Pair<String, AFOSProductId>(
site, afosId));
}
}
return siteProductPairList;
}
});
}
/**
* Get site based on the ordering from preferredAfosFirstLetter.
*
* @param afosId
* @return site or null when no data.
*/
private String getSite(AFOSProductId afosId) {
String ccc = afosId.getCcc();
String nnn = afosId.getNnn();
String xxx = afosId.getXxx();
if (siteQueryFmt == null) {
Matcher m = Pattern.compile("table_name").matcher(SITE_QUERY_FMT);
siteQueryFmt = m.replaceAll((operationalMode ? OPERATIONAL_TABLE
: PRACTICE_TABLE));
}
String siteQuery = String.format(siteQueryFmt, ccc, nnn, xxx);
Object[] values = null;
try {
values = executeSQLQuery(siteQuery);
} catch (Exception e) {
values = null;
}
return getSite(values);
}
/**
* From the array of sites determine which one is the preferred site.
*
* @param values
* - Assume sites with common afosId
* @return site first site based on preferredAfosFirstLetter
*/
private String getSite(Object[] values) {
if (values != null) {
if (values.length == 1) {
return (String) values[0];
} else if (values.length > 1) {
String[] sites = new String[values.length];
for (int i = 0; i < values.length; ++i) {
sites[i] = (String) values[i];
}
for (char c : preferredAfosFirstLetter) {
for (String site : sites) {
if (site.charAt(0) == c) {
return site;
}
}
}
if (logger.isInfoEnabled()) {
String message = "None of the sites first character in preferred AFOS first letter list \""
+ new String(preferredAfosFirstLetter)
+ "\". Using site: " + sites[0];
logger.info(message);
}
return sites[0];
}
}
return null;
}
/**
* Use the reference/creation time to restrict the results when obtaining a
* product.
@ -415,8 +568,10 @@ public class StdTextProductDao extends CoreDao {
xxx = StringUtils.rightPad(xxx, MAX_FIELD_LENGTH);
Session session = null;
List<StdTextProduct> products = new ArrayList<StdTextProduct>();
try {
List<Pair<String, AFOSProductId>> siteAfosIdList = querySiteAfosId(
ccc, nnn, xxx);
session = getSession();
Map<String, Object> tmp = new HashMap<String, Object>();
@ -434,23 +589,15 @@ public class StdTextProductDao extends CoreDao {
criteria.addOrder(Order.desc(REFTIME));
criteria.addOrder(Order.desc(ProdHDRTIME));
Iterator<?> iter = criteria.list().iterator();
return listProducts(criteria, siteAfosIdList);
while (iter.hasNext()) {
StdTextProduct prod = (StdTextProduct) iter.next();
if (prod != null && prod.getProduct() != null
&& prod.getProduct().length() > 0) {
products.add(prod);
}
}
} catch (Exception e) {
logger.error("Error occurred reading products", e);
} finally {
closeSession(session);
}
return products;
return new ArrayList<StdTextProduct>(0);
}
@ -475,8 +622,10 @@ public class StdTextProductDao extends CoreDao {
Session session = null;
List<StdTextProduct> products = new ArrayList<StdTextProduct>();
try {
List<Pair<String, AFOSProductId>> siteAfosIdList = querySiteAfosId(
ccc, nnn, xxx);
session = getSession();
Map<String, String> tmp = buildCriterions(ProdCCC_ID, ccc,
@ -495,22 +644,67 @@ public class StdTextProductDao extends CoreDao {
criteria.addOrder(Order.desc(INSERTTIME));
criteria.addOrder(Order.desc(ProdHDRTIME));
Iterator<?> iter = criteria.list().iterator();
return listProducts(criteria, siteAfosIdList);
while (iter.hasNext()) {
StdTextProduct prod = (StdTextProduct) iter.next();
if (prod != null && prod.getProduct() != null
&& prod.getProduct().length() > 0) {
products.add(prod);
}
}
} catch (Exception e) {
logger.error("Error occurred reading products", e);
} finally {
closeSession(session);
}
return new ArrayList<StdTextProduct>(0);
}
/**
* Get non-empty products and when sites have the same afoisId only add the
* products from the site based on preferredAfosFirstLetter. Keep products
* in the order returned by the criteria list. This assumes the results are
* ordered so identical afosIds are together.
*
*
* @param criteria
* - Assume results ordered by afosId
* @param siteAfosIdList
* - Assume ordered by afosId
* @return products
* @throws HibernateException
*/
private List<StdTextProduct> listProducts(Criteria criteria,
List<Pair<String, AFOSProductId>> siteAfosIdList)
throws HibernateException {
List<?> prodList = criteria.list();
List<StdTextProduct> products = null;
if ((prodList == null) || prodList.isEmpty()) {
products = new ArrayList<>(0);
} else {
products = new ArrayList<>(prodList.size());
Iterator<?> iter = prodList.iterator();
Iterator<Pair<String, AFOSProductId>> siteAfosIdIter = siteAfosIdList
.iterator();
Pair<String, AFOSProductId> pair = siteAfosIdIter.next();
while (iter.hasNext()) {
StdTextProduct prod = (StdTextProduct) iter.next();
if ((prod != null) && (prod.getProduct() != null)
&& !prod.getProduct().isEmpty()) {
AFOSProductId afosId = new AFOSProductId(prod.getCccid(),
prod.getNnnid(), prod.getXxxid());
while (!afosId.equals(pair.getSecond())) {
pair = siteAfosIdIter.next();
}
String site = prod.getSite();
if (site.equals(pair.getFirst())) {
products.add(prod);
}
}
}
}
return products;
}
@ -557,7 +751,7 @@ public class StdTextProductDao extends CoreDao {
long latestTime = 0L;
Session sess = null;
try {
sess = getSession();
@ -581,8 +775,8 @@ public class StdTextProductDao extends CoreDao {
}
} catch (Exception e) {
logger.error("Error occurred getting latest time", e);
}finally{
if(sess != null){
} finally {
if (sess != null) {
sess.close();
}
}
@ -746,13 +940,13 @@ public class StdTextProductDao extends CoreDao {
refTimeQueryBuilder.append(ProdXXX_ID).append(" = :xxxid");
refTimeQueryBuilder.append(" ORDER BY refTime DESC");
refTimeQueryBuilder.append(", insertTime DESC");
final String refTimeQueryString = refTimeQueryBuilder.toString();
final String refTimeQueryString = refTimeQueryBuilder
.toString();
StringBuilder delQueryBuilder = new StringBuilder(200);
delQueryBuilder.append("DELETE FROM ");
delQueryBuilder.append(getStdTextProductInstance()
.getClass().getSimpleName());
delQueryBuilder.append(getStdTextProductInstance().getClass()
.getSimpleName());
delQueryBuilder.append(" WHERE ");
delQueryBuilder.append(ProdCCC_ID).append(" = :cccid")
.append(" AND ");
@ -762,69 +956,87 @@ public class StdTextProductDao extends CoreDao {
.append(" AND ");
delQueryBuilder.append("refTime < :refTime");
final String delQueryString = delQueryBuilder.toString();
for (final TextProductInfo prodInfo : ids) {
rval += txTemplate.execute(new TransactionCallback<Integer>() {
rval += txTemplate
.execute(new TransactionCallback<Integer>() {
@Override
public Integer doInTransaction(TransactionStatus status) {
Session session = getCurrentSession();
TextProductInfoPK pk = prodInfo.getProdId();
String cccid = pk.getCccid();
String nnnid = pk.getNnnid();
String xxxid = pk.getXxxid();
int rowsDeleted = 0;
@Override
public Integer doInTransaction(
TransactionStatus status) {
Session session = getCurrentSession();
TextProductInfoPK pk = prodInfo.getProdId();
String cccid = pk.getCccid();
String nnnid = pk.getNnnid();
String xxxid = pk.getXxxid();
int rowsDeleted = 0;
try {
Query refTimeQuery = session
.createQuery(refTimeQueryString);
refTimeQuery.setString("cccid", cccid);
refTimeQuery.setString("nnnid", nnnid);
refTimeQuery.setString("xxxid", xxxid);
refTimeQuery
.setMaxResults(prodInfo.getVersionstokeep());
List<?> refTimes = refTimeQuery.list();
if (refTimes.size() >= prodInfo.getVersionstokeep()) {
long refTime = ((Number) refTimes.get(prodInfo
.getVersionstokeep() - 1)).longValue();
Query delQuery = session
.createQuery(delQueryString);
delQuery.setString("cccid", cccid);
delQuery.setString("nnnid", nnnid);
delQuery.setString("xxxid", xxxid);
delQuery.setLong("refTime", refTime);
try {
Query refTimeQuery = session
.createQuery(refTimeQueryString);
refTimeQuery.setString("cccid", cccid);
refTimeQuery.setString("nnnid", nnnid);
refTimeQuery.setString("xxxid", xxxid);
refTimeQuery.setMaxResults(prodInfo
.getVersionstokeep());
List<?> refTimes = refTimeQuery.list();
if (refTimes.size() >= prodInfo
.getVersionstokeep()) {
long refTime = ((Number) refTimes.get(prodInfo
.getVersionstokeep() - 1))
.longValue();
Query delQuery = session
.createQuery(delQueryString);
delQuery.setString("cccid", cccid);
delQuery.setString("nnnid", nnnid);
delQuery.setString("xxxid", xxxid);
delQuery.setLong("refTime", refTime);
if (PurgeLogger.isDebugEnabled()) {
PurgeLogger.logDebug("Purging records for ["
+ cccid + nnnid + xxxid
+ "] before refTime [" + refTime + "]",
PLUGIN_NAME);
if (PurgeLogger.isDebugEnabled()) {
PurgeLogger
.logDebug(
"Purging records for ["
+ cccid
+ nnnid
+ xxxid
+ "] before refTime ["
+ refTime
+ "]",
PLUGIN_NAME);
}
rowsDeleted = delQuery
.executeUpdate();
if (PurgeLogger.isDebugEnabled()) {
PurgeLogger.logDebug("Purged ["
+ rowsDeleted
+ "] records for ["
+ cccid + nnnid + xxxid
+ "]", PLUGIN_NAME);
}
} else if (PurgeLogger.isDebugEnabled()) {
PurgeLogger
.logDebug(
"VersionPurge: Product ["
+ cccid
+ nnnid
+ xxxid
+ "] has fewer than ["
+ prodInfo
.getVersionstokeep()
+ "] versions",
PLUGIN_NAME);
}
} catch (Exception e) {
PurgeLogger.logError(
"Exception occurred purging text products ["
+ cccid + nnnid + xxxid
+ "]", PLUGIN_NAME, e);
}
rowsDeleted = delQuery.executeUpdate();
if (PurgeLogger.isDebugEnabled()) {
PurgeLogger.logDebug("Purged [" + rowsDeleted
+ "] records for [" + cccid + nnnid
+ xxxid + "]", PLUGIN_NAME);
}
} else if (PurgeLogger.isDebugEnabled()) {
PurgeLogger.logDebug(
"VersionPurge: Product [" + cccid + nnnid
+ xxxid + "] has fewer than ["
+ prodInfo.getVersionstokeep()
+ "] versions", PLUGIN_NAME);
return rowsDeleted;
}
} catch (Exception e) {
PurgeLogger.logError(
"Exception occurred purging text products ["
+ cccid + nnnid + xxxid + "]",
PLUGIN_NAME, e);
}
return rowsDeleted;
}
});
});
}
}
} catch (Exception e) {
@ -898,13 +1110,13 @@ public class StdTextProductDao extends CoreDao {
String nnn, String xxx, String hdrTime, Long startTimeMillis,
String bbb, int intlProd, boolean readAllVersions,
boolean returnAllData) {
List<StdTextProduct> products = new ArrayList<StdTextProduct>();
Session session = null;
Connection conn = null;
try {
session = getSession();
conn = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
conn = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
String ccc = null;
@ -917,7 +1129,7 @@ public class StdTextProductDao extends CoreDao {
List<StdTextProduct> distinctProducts = getDistinctProducts(conn,
wmoId, site, ccc, nnn, xxx, bbb, hdrTime, startTimeMillis);
products = getProductMetaData(conn, distinctProducts, bbb, hdrTime,
return getProductMetaData(conn, distinctProducts, bbb, hdrTime,
startTimeMillis, readAllVersions);
} catch (Exception e) {
logger.error("Error occurred reading products", e);
@ -926,7 +1138,7 @@ public class StdTextProductDao extends CoreDao {
closeSession(session);
}
return products;
return new ArrayList<StdTextProduct>(0);
}
@SuppressWarnings("unchecked")
@ -1119,7 +1331,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(query1);
ps2 = c.prepareStatement(query2);
ps3 = c.prepareStatement(query3);
@ -1243,7 +1456,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(query);
ps1.setString(1, wmoId);
ps1.setInt(2, startTimeSeconds);
@ -1310,7 +1524,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(query1);
ps2 = c.prepareStatement(query2);
ps3 = c.prepareStatement(query3);
@ -1434,7 +1649,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(query);
ps1.setString(1, site);
ps1.setInt(2, startTimeSeconds);
@ -1501,7 +1717,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(query1);
ps2 = c.prepareStatement(query2);
ps1.setString(1, nnnId);
@ -1597,7 +1814,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(query1);
ps1.setString(1, wmoId);
ps1.setString(2, site);
@ -1664,7 +1882,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(query1);
ps1.setString(1, wmoId);
ps1.setString(2, site);
@ -1757,7 +1976,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
int count = 0;
/*
@ -1906,7 +2126,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(query);
ps1.setString(1, wmoId);
ps1.setString(2, site);
@ -1964,7 +2185,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(hdrQuery);
ps1.setString(1, wmoId);
ps1.setString(2, site);
@ -2054,7 +2276,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(hdrQuery);
ps1.setString(1, wmoId);
ps1.setString(2, site);
@ -2151,7 +2374,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
if (xxxId == null || xxxId.length() > 0) {
ps1 = c.prepareStatement(noXxxQuery);
@ -2252,7 +2476,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(hdrQuery);
ps1.setString(1, wmoId);
@ -2349,7 +2574,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ps1 = c.prepareStatement(hdrQuery);
ps1.setString(1, wmoId);
@ -2449,7 +2675,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
switch (intlProd) {
case 0: // fall through
@ -2573,7 +2800,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
switch (intlProd) {
case 0: // fall through
@ -2678,7 +2906,8 @@ public class StdTextProductDao extends CoreDao {
try {
session = getSession();
c = SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection();
c = SessionFactoryUtils.getDataSource(getSessionFactory())
.getConnection();
ret = read_product(c, wmoId, site, cccId, nnnId, xxxId, version);
} catch (SQLException e) {
// don't need to worry about rolling back transaction

View file

@ -8,11 +8,12 @@
<constructor-arg value="Ingest.SportLma.*" />
</bean>
<bean id="lmaDecoder" class="gov.nasa.msfc.sport.edex.plugin.lma.LmaDecoder">
<bean id="lmaDecoder" class="gov.nasa.msfc.sport.edex.plugin.lma.LmaDecoder" depends-on="getParameterHandlerRegistered">
<property name="gridCoverageLookup" ref="gridcoveragelookup"/>
<property name="levelDao" ref="sportlmalevelDao"/>
</bean>
<bean id="sportlmalevelDao" class="com.raytheon.uf.edex.plugin.level.dao.LevelDao"/>
<bean id="lmaDistRegistry" factory-bean="distributionSrv"

View file

@ -23,8 +23,6 @@ import ucar.nc2.NetcdfFile;
import ucar.nc2.Variable;
import ucar.units.SI;
import com.raytheon.edex.exception.DecoderException;
import com.raytheon.edex.plugin.AbstractDecoder;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.grid.GridRecord;
import com.raytheon.uf.common.dataplugin.level.Level;
@ -57,20 +55,6 @@ public class LmaDecoder {
/** The level dao allows looking up of the levels. */
public LevelDao levelDao;
/** The Lma Vars Dict helps to match up variables in the configuration files in the localization. This allows controls of what files to lookup
* allows looking up of the Variables and names. */
private LMAVarsDict lmaVarsDict;
/** The Param lookup allows looking up of the parameters in the database. */
private ParameterLookup paramLookup;
public LmaDecoder() throws DecoderException{
paramLookup = ParameterLookup.getInstance();
lmaVarsDict = LMAVarsDict.getInstance();
}
/**
* Decode the LMA netcdf 3 files. These files contain gridded data at 17 vertical levels. The first level is the sum of all levels.
*
@ -82,6 +66,12 @@ public class LmaDecoder {
//Create an empty records to hold the data once decoded.
GridRecord[] records = null;
/** The variable dictionary used to check which variables are supported by the ingest **/
LMAVarsDict lmaVarsDict = LMAVarsDict.getInstance();
/** The Param lookup allows looking up of the parameters in the database. */
ParameterLookup paramLookup = ParameterLookup.getInstance();
//Open the netcdf file for reading.
NetcdfFile file = NetcdfFile.open(fileInput.getAbsolutePath());
try {

View file

@ -8,7 +8,7 @@
via openfire whenever a user logs in to openfire.
</description>
<author>bkowal</author>
<version>2.0.0</version>
<version>2.1.0</version>
<date>8/08/2012</date>
<minServerVersion>3.7.1</minServerVersion>
@ -26,4 +26,4 @@
</sidebar>
</tab>
</adminconsole>
</plugin>
</plugin>

View file

@ -23,3 +23,4 @@ Import-Package: com.vividsolutions.jts.geom,
org.dom4j,
org.dom4j.io
Export-Package: gov.noaa.nws.ncep.staticdataprovider
Service-Component: OSGI-INF/staticDataProvider.xml

View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="gov.noaa.nws.ncep.staticdataprovider.StaticDataProvider" enabled="true">
<implementation
class="gov.noaa.nws.ncep.staticdataprovider.StaticDataProvider" />
<service>
<provide interface="gov.noaa.nws.ncep.common.staticdata.IStaticDataProvider" />
</service>
</component>

View file

@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
OSGI-INF/

View file

@ -8,8 +8,6 @@
package gov.noaa.nws.ncep.staticdataprovider;
import gov.noaa.nws.ncep.common.staticdata.IStaticDataProvider;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@ -39,20 +37,22 @@ public class Activator implements BundleActivator {
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext bundleContext) throws Exception {
@Override
public void start(BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
//Register service
context.registerService(IStaticDataProvider.class.getName(),
StaticDataProvider.getInstance(),
null);
// context.registerService(IStaticDataProvider.class.getName(),
// StaticDataProvider.getInstance(),
// null);
}
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext bundleContext) throws Exception {
@Override
public void stop(BundleContext bundleContext) throws Exception {
Activator.context = null;
}

View file

@ -70,7 +70,7 @@ public class StaticDataProvider implements IStaticDataProvider {
return dataProvider;
}
private StaticDataProvider() {
public StaticDataProvider() {
}

View file

@ -39,8 +39,10 @@ Export-Package: gov.noaa.nws.ncep.ui.pgen,
gov.noaa.nws.ncep.ui.pgen.store,
gov.noaa.nws.ncep.ui.pgen.tca,
gov.noaa.nws.ncep.ui.pgen.tools
Import-Package: com.raytheon.viz.core.contours.util,
Import-Package: com.raytheon.uf.viz.core.maps.display,
com.raytheon.viz.core.contours.util,
com.raytheon.viz.core.gl,
com.raytheon.viz.core.gl.images,
gov.noaa.nws.ncep.common.staticdata,
javax.measure.unit
Bundle-ClassPath: .

View file

@ -322,11 +322,6 @@
<handler
class="gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteAction"
commandId="gov.noaa.nws.ncep.ui.pgen.palette">
<enabledWhen>
<reference
definitionId="gov.noaa.nws.ncep.viz.ui.display.isMapEditor">
</reference>
</enabledWhen>
</handler>
<handler
class="gov.noaa.nws.ncep.ui.pgen.tools.PgenSinglePointDrawingTool"
@ -577,15 +572,56 @@
name="NMAP Views"/>
<view
category="gov.noaa.nws.ncep.viz.ui.nmap"
allowMultiple="false"
allowMultiple="true"
restorable="true"
class="gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow"
id="gov.noaa.nws.ncep.ui.PGEN"
name="PGEN"/>
<!--stickyView
closeable="true"
id="gov.noaa.nws.ncep.ui.PGEN"
location="RIGHT"
moveable="true">
</stickyView-->
</extension>
<extension
point="org.eclipse.ui.menus">
<menuContribution locationURI="menu:tools?after=lapsTools">
<command
commandId="gov.noaa.nws.ncep.ui.pgen.palette"
label="PGEN">
<visibleWhen>
<reference
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
</reference>
</visibleWhen>
</command>
</menuContribution>
<!--menuContribution
locationURI="toolbar:org.eclipse.ui.main.toolbar?after=plugins">
<toolbar
id="plugins">
<command
commandId="gov.noaa.nws.ncep.ui.pgen.palette"
label="PGEN">
<visibleWhen>
<and>
<reference
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
</reference>
<test
args="WFO"
forcePluginActivation="true"
property="com.raytheon.viz.warngen.site.SiteMode">
</test>
</and>
</visibleWhen>
</command>
</toolbar>
</menuContribution-->
<menuContribution
locationURI="toolbar:gov.noaa.nws.ncep.ui.PGEN">
<command
@ -3390,4 +3426,14 @@
</contextId>
</classContext>
</extension>
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension
targetID="com.raytheon.uf.viz.d2d.ui.perspectives.D2D5Pane">
<view id="gov.noaa.nws.ncep.ui.PGEN"
relative="org.eclipse.ui.editorss"
relationship="right"
ratio="0.8"
visible="false"/>
</perspectiveExtension>
</extension>
</plugin>

View file

@ -7,160 +7,478 @@
*/
package gov.noaa.nws.ncep.ui.pgen;
import gov.noaa.nws.ncep.ui.pgen.PgenUtil.PgenMode;
import gov.noaa.nws.ncep.ui.pgen.controls.PgenCommandManager;
import gov.noaa.nws.ncep.ui.pgen.filter.CategoryFilter;
import gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow;
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
//import gov.noaa.nws.ncep.viz.ui.display.NmapUiUtils;
import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResourceData;
import gov.noaa.nws.ncep.ui.pgen.tools.AbstractPgenTool;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.ui.IPartListener2;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.WorkbenchPage;
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.IDisplayPane;
import com.raytheon.uf.viz.core.IRenderableDisplayChangedListener;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
/**
* This singleton is intended to couple a PGEN Palette with a PGgenResource, so that
* a palette can be updated and used to modify a specific PgenResource
* This singleton is intended to couple a PGEN Palette with a PGgenResource, so
* that a palette can be updated and used to modify a specific PgenResource
*
* @author sgilbert
*
*
*/
public class PgenSession {
/*
* The singleton instance
*/
private static PgenSession instance = null;
/*
* the current PGEN resource
*/
private PgenResource pgenResource = null;
/*
* the current PGEN palette
*/
private PgenPaletteWindow palette = null;
/*
* Hide default constructor
*/
private PgenSession() {
}
/**
* Static method to get THE PgenSession instance
* @return PgenSession reference
*/
public static synchronized PgenSession getInstance() {
if ( instance == null ) instance = new PgenSession();
return instance;
}
/**
* Sets a PgenResource for the current session
* @param rsc a Pgen Resource
*/
public void setResource(PgenResource rsc) {
/*
* Remove the current PGEN Resource from the Session
*/
removeResource();
// set new PGEN resource
pgenResource = rsc;
// add the palette's stack listener to new resource's command Manager
if ( pgenResource != null ) pgenResource.getCommandMgr().addStackListener(palette);
/**
* Implements a drawing layer for PGEN products.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 12/14 R5413 B. Yin Added IPartListener2 and IRenderableDisplayChangedListener
* to make the swapping in D2D work
* 12/14 R5413 B. Yin Added exception handling, perspective id, and endSession.
* 01/15 R5413 B. Yin Added closePalette method.
*
*/
}
/**
* Removes the current PGEN resource from the Session
*/
public void removeResource() {
if ( pgenResource != null ) {
//Remove the Palette's stack listener from the Resource's CommandManager
pgenResource.getCommandMgr().removeStackListener(palette);
}
pgenResource = null;
/*
* disable the palette's Undo and redo buttons.
*/
if ( palette != null ) palette.disableUndoRedo();
}
/**
* Gets an appropriate PGEN Resource. Returns the current Pgen Resource registered with this
* PGEN Session if there is one. If not, it will look for an existing resource in the current
* editor. If one is not found, a new PgenResource will be created.
* @return the rsc
*/
public PgenResource getPgenResource() {
if ( pgenResource == null ) {
// PgenResource rsc = PgenUtil.findPgenResource(NmapUiUtils.getActiveNatlCntrsEditor());
PgenResource rsc = PgenUtil.findPgenResource(PgenUtil.getActiveEditor());
if ( rsc != null ) {
pgenResource = rsc;
}
else {
pgenResource = PgenUtil.createNewResource();
}
}
return pgenResource;
}
/**
* Get the PGEN Resource currently registered with the session
* @return
*/
public PgenResource getCurrentResource() {
return pgenResource;
}
@SuppressWarnings("restriction")
public class PgenSession implements IPartListener2,
IRenderableDisplayChangedListener {
/**
* Gets the Resource's Command Manager
* @return the commandMgr
*/
public PgenCommandManager getCommandManager() {
return pgenResource.getCommandMgr();
}
/*
* The singleton instance
*/
private static PgenSession instance = null;
/*
* the current PGEN resource
*/
private PgenResource pgenResource = null;
/*
* the current PGEN palette
*/
private PgenPaletteWindow palette = null;
private List<AbstractEditor> editors = new ArrayList<AbstractEditor>();
/*
* Active PGEN tool
*/
private AbstractPgenTool pgenTool = null;
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(PgenSession.class);
private String perspectiveId = "";
/*
* Hide default constructor
*/
private PgenSession() {
AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager();
if ( pMngr != null ){
setPerspectiveId(pMngr.getPerspectiveId());
}
}
/**
* Static method to get THE PgenSession instance
*
* @return PgenSession reference
*/
public static synchronized PgenSession getInstance() {
if (instance == null)
instance = new PgenSession();
return instance;
}
/**
* Sets a PgenResource for the current session
*
* @param rsc
* a Pgen Resource
*/
public void setResource(PgenResource rsc) {
/*
* Remove the current PGEN Resource from the Session
*/
removeResource();
// set new PGEN resource
pgenResource = rsc;
// add the palette's stack listener to new resource's command Manager
if (pgenResource != null && palette != null) {
pgenResource.getCommandMgr().addStackListener(palette);
}
}
/**
* Removes the current PGEN resource from the Session
*/
public void removeResource() {
if (pgenResource != null) {
// Remove the Palette's stack listener from the Resource's
// CommandManager
pgenResource.getCommandMgr().removeStackListener(palette);
}
pgenResource = null;
/*
* disable the palette's Undo and redo buttons.
*/
if (palette != null)
palette.disableUndoRedo();
}
/**
* Gets an appropriate PGEN Resource. Returns the current Pgen Resource
* registered with this PGEN Session if there is one. If not, it will look
* for an existing resource in the current editor. If one is not found, a
* new PgenResource will be created.
*
* @return the rsc
*/
public PgenResource getPgenResource() {
if (pgenResource == null) {
// PgenResource rsc =
// PgenUtil.findPgenResource(NmapUiUtils.getActiveNatlCntrsEditor());
PgenResource rsc = PgenUtil.findPgenResource(PgenUtil
.getActiveEditor());
if (rsc != null) {
pgenResource = rsc;
} else {
pgenResource = PgenUtil.createNewResource();
}
}
return pgenResource;
}
/**
* Get the PGEN Resource currently registered with the session
*
* @return
*/
public PgenResource getCurrentResource() {
return pgenResource;
}
/**
* Gets the Resource's Command Manager
*
* @return the commandMgr
*/
public PgenCommandManager getCommandManager() {
return pgenResource.getCommandMgr();
}
/**
* Register the given palette with the Session
*
* @param pal
*/
public void setPalette(PgenPaletteWindow pal) {
palette = pal;
// Register this palette's stack listener with the CommandManager, if
// able
if (pgenResource != null) {
pgenResource.getCommandMgr().addStackListener(palette);
}
}
/**
* Remove the current palette from this Session
*/
public void removePalette() {
// Remove this palette's stack listener from the CommandManager, if able
if (pgenResource != null)
pgenResource.getCommandMgr().removeStackListener(palette);
palette = null;
}
/**
* Clear and disable undo/redos.
*/
public void disableUndoRedo() {
if (pgenResource != null)
getCommandManager().clearStacks();
if (palette != null) {
palette.disableUndoRedo();
}
}
public PgenResourceData getPgenResourceData() {
if (pgenResource != null) {
return pgenResource.getResourceData();
} else {
return null;
}
}
/**
* Return the palette window
*/
public PgenPaletteWindow getPgenPalette() {
return palette;
}
public void addEditor(AbstractEditor editor) {
editors.add(editor);
}
public List<AbstractEditor> getEditors() {
return editors;
}
/*
* Remove PGEN handler when swapping to side view. Also open PGEN palette if
* there is a PGEN resource when swapping to main editor.
*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.IRenderableDisplayChangedListener#
* renderableDisplayChanged(com.raytheon.uf.viz.core.IDisplayPane,
* com.raytheon.uf.viz.core.drawables.IRenderableDisplay,
* com.raytheon.uf.viz
* .core.IRenderableDisplayChangedListener.DisplayChangeType)
*/
@Override
public void renderableDisplayChanged(IDisplayPane pane,
IRenderableDisplay newRenderableDisplay, DisplayChangeType type) {
if (type == DisplayChangeType.ADD
&& newRenderableDisplay.getContainer() instanceof VizMapEditor) {
VizMapEditor editorChanged = (VizMapEditor) newRenderableDisplay
.getContainer();
if (PgenUtil.getPgenMode() == PgenMode.SINGLE) {
// for D2d swapping, single pane mode
if (pgenResource != null) {
pgenResource.removeGhostLine();
pgenResource.removeSelected();
// Make sure PGEN resource repaint in the new editor.
PgenResource rsc = PgenUtil.findPgenResource(editorChanged );
if ( rsc != null ){
rsc.resetAllElements();
}
}
PgenUtil.setSelectingMode();
}
else { // for D2d swapping, multi-pane mode
// clean up current pgen resource
if (pgenResource != null) {
pgenResource.closeDialogs();
pgenResource.deactivatePgenTools();
pgenResource.getCommandMgr().removeStackListener(palette);
}
if (palette != null) {
if (PgenUtil.findPgenResource(editorChanged) == null) {
// editor does not have PGEN, close the palette
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().hideView(palette);
palette = null;
} else {
// editor has PGEN resource, reset to selecting mode
pgenResource = PgenUtil.findPgenResource(editorChanged);
pgenResource.setCatFilter(new CategoryFilter());
palette.setCurrentCategory(PgenPaletteWindow.CATEGORY_ANY);
PgenUtil.setSelectingMode();
}
} else {
// palette is closed
if (PgenUtil.findPgenResource(editorChanged) != null) {
// editor has PGEN, open the palette
IWorkbenchPage wpage = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
IViewPart vpart = wpage.findView(PgenUtil.VIEW_ID);
try {
if (vpart == null) {
vpart = wpage.showView(PgenUtil.VIEW_ID);
IViewReference pgenViewRef = wpage
.findViewReference(PgenUtil.VIEW_ID);
if (pgenViewRef != null
&& wpage instanceof WorkbenchPage) {
((WorkbenchPage) wpage)
.detachView(pgenViewRef);
}
} else {
if (!wpage.isPartVisible(vpart)) {
vpart = wpage.showView(PgenUtil.VIEW_ID);
IViewReference pgenViewRef = wpage
.findViewReference(PgenUtil.VIEW_ID);
if (pgenViewRef != null
&& wpage instanceof WorkbenchPage) {
((WorkbenchPage) wpage)
.detachView(pgenViewRef);
}
}
}
this.pgenResource = PgenUtil
.findPgenResource(editorChanged);
this.pgenResource.setCatFilter(new CategoryFilter());
this.palette.setCurrentCategory(PgenPaletteWindow.CATEGORY_ANY);
PgenUtil.setSelectingMode();
} catch (Exception e) {
statusHandler.handle(Priority.PROBLEM,
"Cannot open PGEN palette view", e);
}
}
}
}
} else if (type == DisplayChangeType.REMOVE
&& !(newRenderableDisplay.getContainer() instanceof AbstractEditor)) {
// remove to side view
// unregister pgen handlers
if (newRenderableDisplay.getContainer() instanceof IMultiPaneEditor) {
IMultiPaneEditor sideView = (IMultiPaneEditor) newRenderableDisplay
.getContainer();
if (this.getPgenTool() != null) {
sideView.unregisterMouseHandler(this.getPgenTool()
.getMouseHandler());
}
// Make sure PGEN resource repaint in the new editor.
if (PgenUtil.getPgenMode() == PgenMode.SINGLE) {
ResourceList rscList = sideView.getActiveDisplayPane().getDescriptor().getResourceList();
for (ResourcePair rp : rscList) {
AbstractVizResource<?, ?> rsc = rp.getResource();
if ( rsc instanceof PgenResource) {
((PgenResource)rsc).resetAllElements();
}
}
}
}
}
}
@Override
public void partActivated(IWorkbenchPartReference partRef) {
// TODO Auto-generated method stub
}
@Override
public void partBroughtToTop(IWorkbenchPartReference partRef) {
// TODO Auto-generated method stub
}
@Override
public void partClosed(IWorkbenchPartReference partRef) {
IWorkbenchPart part = partRef.getPart(false);
if (part instanceof VizMapEditor) { // for D2D
if (PgenUtil.findPgenResource((VizMapEditor) part) != null) {
((VizMapEditor) part)
.removeRenderableDisplayChangedListener(this);
}
}
}
@Override
public void partDeactivated(IWorkbenchPartReference partRef) {
// TODO Auto-generated method stub
}
@Override
public void partOpened(IWorkbenchPartReference partRef) {
// TODO Auto-generated method stub
}
@Override
public void partHidden(IWorkbenchPartReference partRef) {
// TODO Auto-generated method stub
}
@Override
public void partVisible(IWorkbenchPartReference partRef) {
// TODO Auto-generated method stub
}
@Override
public void partInputChanged(IWorkbenchPartReference partRef) {
// TODO Auto-generated method stub
}
public AbstractPgenTool getPgenTool() {
return pgenTool;
}
public void setPgenTool(AbstractPgenTool pgenTool) {
this.pgenTool = pgenTool;
}
public String getPerspectiveId() {
return perspectiveId;
}
public void setPerspectiveId(String perspectiveId) {
this.perspectiveId = perspectiveId;
}
public void endSession(){
instance = null;
}
public void closePalette(){
if ( palette != null ){
if ( PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage() != null ){
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().hideView(palette);
removePalette();
}
}
}
/**
* Register the given palette with the Session
* @param pal
*/
public void setPalette(PgenPaletteWindow pal) {
palette = pal;
// Register this palette's stack listener with the CommandManager, if able
if ( pgenResource != null ) pgenResource.getCommandMgr().addStackListener(palette);
}
/**
* Remove the current palette from this Session
*/
public void removePalette() {
// Remove this palette's stack listener from the CommandManager, if able
if ( pgenResource != null ) pgenResource.getCommandMgr().removeStackListener(palette);
palette = null;
}
/**
* Clear and disable undo/redos.
*/
public void disableUndoRedo() {
if ( pgenResource != null ) getCommandManager().clearStacks();
if ( palette != null ) {
palette.disableUndoRedo();
}
}
/**
* Return the palette window
*/
public PgenPaletteWindow getPgenPalette(){
return palette;
}
}

View file

@ -81,6 +81,7 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.localization.LocalizationManager;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.ResourceList;
@ -144,7 +145,10 @@ import com.vividsolutions.jts.linearref.LocationIndexedLine;
* 05/14 TTR998 J. Wu Added pixelToLatlon().
* 07/14 Chin Chen In latlonToPixel(), make sure not to add null pixel to its return pixel array
* 08/14 TTR962 J. Wu Add replaceWithDate to format output file with DD, MM, YYYY, HH.
* </pre>
* 12/14 R5413 B. Yin Add a listener for D2D swapping pane
* 12/14 R5413 B. Yin Check null in findResource
*
</pre>
*
* @author
* @version 1
@ -682,6 +686,73 @@ public class PgenUtil {
PgenResource drawingLayer = null;
// NCMapEditor editor = NmapUiUtils.getActiveNatlCntrsEditor();
AbstractEditor editor = getActiveEditor();
if (editor != null) {
try {
if (PgenUtil.isNatlCntrsEditor(editor)){
PgenSession.getInstance().addEditor(editor);
}
else if (editor instanceof VizMapEditor ){
//Add a listener for D2d to make the swap work.
PgenSession.getInstance().addEditor(editor);
editor.addRenderableDisplayChangedListener(PgenSession.getInstance());
}
switch (getPgenMode()) {
case SINGLE:
/*
* Use existing (or new) PgenResourceData to construct new
* Resources to add to each Pane's ResourceList
*/
if (rscData == null) {
rscData = new PgenResourceData();
}
int iii = 0;
for (IDisplayPane pane : editor.getDisplayPanes()) {
IDescriptor idesc = pane.getDescriptor();
if (idesc.getResourceList().size() > 0) {
drawingLayer = rscData.construct(
new LoadProperties(), idesc);
// System.out.println("NEW pgen resource: "+drawingLayer);
idesc.getResourceList().add(drawingLayer);
idesc.getResourceList().addPreRemoveListener(
drawingLayer);
drawingLayer.init(pane.getTarget());
}
}
break;
case MULTIPLE:
/*
* Add a new PgenResourceData and Resource to active Pane's
* ResourceList
*/
IMapDescriptor desc = (IMapDescriptor) editor
.getActiveDisplayPane().getRenderableDisplay()
.getDescriptor();
drawingLayer = new PgenResourceData().construct(
new LoadProperties(), desc);
desc.getResourceList().add(drawingLayer);
desc.getResourceList().addPreRemoveListener(drawingLayer);
drawingLayer
.init(editor.getActiveDisplayPane().getTarget());
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
return drawingLayer;
}
/**
* Create a new PgenResource and add it to the current editor.
*
* @return the PgenResource
*/
public static final PgenResource addPgenResourceToActiveEditor() {
PgenResource drawingLayer = null;
AbstractEditor editor = getActiveEditor();
if (editor != null) {
try {
switch (getPgenMode()) {
@ -696,8 +767,15 @@ public class PgenUtil {
for (IDisplayPane pane : editor.getDisplayPanes()) {
IDescriptor idesc = pane.getDescriptor();
if (idesc.getResourceList().size() > 0) {
drawingLayer = rscData.construct(
if ( PgenSession.getInstance().getPgenResource() != null ){
drawingLayer = PgenSession.getInstance().getPgenResource();
}
else {
drawingLayer = rscData.construct(
new LoadProperties(), idesc);
}
// System.out.println("NEW pgen resource: "+drawingLayer);
idesc.getResourceList().add(drawingLayer);
idesc.getResourceList().addPreRemoveListener(
@ -2002,9 +2080,9 @@ public class PgenUtil {
ResourceList rscList = disp.getDescriptor().getResourceList();
for (ResourcePair rp : rscList) {
AbstractVizResource rsc = rp.getResource();
AbstractVizResource<?, ?> rsc = rp.getResource();
if (rsc.getClass() == rscClass) {
if ( rsc != null && rsc.getClass() == rscClass) {
return rsc;
}
}

View file

@ -64,6 +64,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* 03/13 #928 B. Yin Make the button bar smaller.
* 04/13 #874 B. Yin Handle collection when OK is pressed for multi-selection.
* 04/13 TTR399 J. Wu Make the dialog compact
* 12/14 R5413 B. Yin Refresh editor after dialog close
*
* </pre>
*
@ -170,6 +171,7 @@ public abstract class AttrDlg extends Dialog implements IAttribute {
public void handleShellCloseEvent() {
drawingLayer.removeSelected();
drawingLayer.removeGhostLine();
mapEditor.refresh();
super.handleShellCloseEvent();
PgenUtil.setSelectingMode();
}

View file

@ -116,6 +116,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* 05/14 TTR1008 J. Wu Set default contour parameters through settings_tbl.xml.
* 05/14 TTR990 J. Wu Set default attributes for different contour labels.
* 08/14 ? J. Wu "Edit" line color should go to contoursAttrSettings to take effect..
* 01/15 R5413 B. Yin Added open methods for circle and line dialogs.
*
* </pre>
*
@ -148,9 +149,9 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
private String contourFcstHr = "f000";
private Calendar contourTime1 = (Calendar) Calendar.getInstance();
private Calendar contourTime1 = Calendar.getInstance();
private Calendar contourTime2 = (Calendar) Calendar.getInstance();
private Calendar contourTime2 = Calendar.getInstance();
private String defCint = ContoursInfoDlg.getCints().get(
contourParm + "-" + contourLevel);
@ -397,6 +398,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
setInfoBtnText();
infoBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
openContourInfoDlg();
}
@ -407,6 +409,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
makeGridBtn.setText("Make Grid");
makeGridBtn.setToolTipText("Generate grid from this Contours");
makeGridBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
openG2GDlg();
}
@ -468,6 +471,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
quickLineBtns.add(btn);
btn.addListener(SWT.MouseDoubleClick, new Listener() {
@Override
public void handleEvent(Event event) {
openLineTypePanel();
}
@ -527,6 +531,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
lineClosedBtn.setToolTipText("Click to draw a closed line");
lineClosedBtn.setSelection(drawClosedLine);
lineClosedBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
drawClosedLine = lineClosedBtn.getSelection();
}
@ -564,7 +569,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
if (de != null && de.getParent() != null
&& de.getParent() instanceof ContourLine) {
ContourLine pde = (ContourLine) de.getParent();
lineAttrDlg.setAttrForDlg((IAttribute) pde.getLine());
lineAttrDlg.setAttrForDlg(pde.getLine());
} else {
if (lineTemplate == null) {
@ -577,7 +582,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
.toString());
}
lineAttrDlg.setAttrForDlg((IAttribute) lineTemplate);
lineAttrDlg.setAttrForDlg(lineTemplate);
}
@ -642,6 +647,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
quickSymbolBtns.add(btn);
btn.addListener(SWT.MouseDoubleClick, new Listener() {
@Override
public void handleEvent(Event event) {
openSymbolPanel();
}
@ -724,7 +730,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
DrawableElement de = drawingLayer.getSelectedDE();
if (de != null && de instanceof Symbol
&& de.getParent() instanceof ContourMinmax) {
minmaxAttrDlg.setAttrForDlg((IAttribute) de);
minmaxAttrDlg.setAttrForDlg(de);
} else {
minmaxTemplate = (Symbol) contoursAttrSettings
.get(activeQuickSymbolBtn.getData().toString());
@ -736,8 +742,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
}
minmaxAttrDlg
.setAttrForDlg((IAttribute) minmaxTemplate);
minmaxAttrDlg.setAttrForDlg(minmaxTemplate);
}
@ -779,6 +784,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
setButtonColor(circleTypeBtn, circleTemplate.getColors()[0]);
circleTypeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
if (!ContoursAttrDlg.this.drawCircle()) {
if (circleTemplate == null) {
@ -830,8 +836,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
if (de != null && de.getParent() != null
&& de.getParent() instanceof ContourCircle) {
ContourCircle pde = (ContourCircle) de.getParent();
circleAttrDlg.setAttrForDlg((IAttribute) pde
.getCircle());
circleAttrDlg.setAttrForDlg(pde.getCircle());
} else {
if (circleTemplate == null) {
@ -840,8 +845,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
circleTemplate.setPgenType("Circle");
}
circleAttrDlg
.setAttrForDlg((IAttribute) circleTemplate);
circleAttrDlg.setAttrForDlg(circleTemplate);
}
@ -891,6 +895,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
labelTxt.setText("0");
labelTxt.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
float value = 0;
try {
@ -905,6 +910,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
}
@Override
public void focusGained(FocusEvent e) {
}
});
@ -912,6 +918,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
Button valueUpArrow = new Button(textValueComp, SWT.ARROW | SWT.UP);
valueUpArrow.setLayoutData(new GridData(20, 22));
valueUpArrow.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
changeLabel(true);
}
@ -921,6 +928,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
Button valueDownArrow = new Button(textValueComp, SWT.ARROW | SWT.DOWN);
valueDownArrow.setLayoutData(new GridData(20, 22));
valueDownArrow.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
changeLabel(false);
}
@ -967,18 +975,16 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
if (de.getParent() instanceof ContourLine
&& ((ContourLine) (de.getParent())).getLabels()
.size() > 0) {
labelAttrDlg
.setAttrForDlg((IAttribute) ((ContourLine) (de
.getParent())).getLabels().get(0));
labelAttrDlg.setAttrForDlg(((ContourLine) (de
.getParent())).getLabels().get(0));
if (isUseMainColor()) {
labelAttrDlg.setColor(lineTemplate.getColors()[0]);
}
} else if (de.getParent() instanceof ContourMinmax
&& ((ContourMinmax) (de.getParent()))
.getLabel() != null) {
labelAttrDlg
.setAttrForDlg((IAttribute) ((ContourMinmax) (de
.getParent())).getLabel());
labelAttrDlg.setAttrForDlg(((ContourMinmax) (de
.getParent())).getLabel());
if (isUseMainColor()) {
labelAttrDlg.setColor(minmaxTemplate
.getColors()[0]);
@ -986,9 +992,8 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
} else if (de.getParent() instanceof ContourCircle
&& ((ContourCircle) (de.getParent()))
.getLabel() != null) {
labelAttrDlg
.setAttrForDlg((IAttribute) ((ContourCircle) (de
.getParent())).getLabel());
labelAttrDlg.setAttrForDlg(((ContourCircle) (de
.getParent())).getLabel());
if (isUseMainColor()) {
labelAttrDlg.setColor(circleTemplate
.getColors()[0]);
@ -999,7 +1004,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
labelTemplate = (gov.noaa.nws.ncep.ui.pgen.elements.Text) contoursAttrSettings
.get(getLabelTempKey());
labelAttrDlg.setAttrForDlg((IAttribute) labelTemplate);
labelAttrDlg.setAttrForDlg(labelTemplate);
if (isUseMainColor()) {
if (drawingStatus == ContourDrawingStatus.DRAW_LINE) {
@ -1381,6 +1386,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
btn.setText(lblstr);
btn.setData(lblstr);
btn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
labelTxt.setText(event.widget.getData().toString());
if (labelTemplate != null) {
@ -1572,6 +1578,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
* Updates the selected contours and contour line, then redraws the PGEN
* layer.
*/
@Override
public void okPressed() {
/*
@ -2294,6 +2301,19 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
this.close();
}
/**
* Open the dialog if it doesn't exist.
*/
@Override
public int open() {
if (this.getShell() == null || this.getShell().isDisposed()) {
return super.open();
} else {
return CANCEL;
}
}
/**
* closes the line attribute dialog only
*/
@ -2463,6 +2483,19 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
}
this.close();
}
/**
* Open the dialog if it doesn't exist.
*/
@Override
public int open() {
if (this.getShell() == null || this.getShell().isDisposed()) {
return super.open();
} else {
return CANCEL;
}
}
/**
* closes the circle attribute dialog only
@ -2943,6 +2976,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
/**
* Updates the selected type's data string and image icon.
*/
@Override
public void okPressed() {
Color clr = activeButtonColor;
@ -3091,6 +3125,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
/**
* Updates the selected type's data string and image icon.
*/
@Override
public void okPressed() {
/*
@ -3199,7 +3234,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
* Update the symbol template first.
*/
minmaxTemplate = (gov.noaa.nws.ncep.ui.pgen.elements.Symbol) new DrawableElementFactory()
.create(DrawableType.SYMBOL, (IAttribute) this, "Symbol",
.create(DrawableType.SYMBOL, this, "Symbol",
getActiveSymbolObjType(), (Coordinate) null, null);
contoursAttrSettings.put(getActiveSymbolObjType(), minmaxTemplate);
@ -3789,6 +3824,7 @@ public class ContoursAttrDlg extends AttrDlg implements IContours,
/**
* Removes ghost line, handle bars, and closes the dialog
*/
@Override
public void cancelPressed() {
PgenUtil.setSelectingMode();

View file

@ -140,13 +140,14 @@ import com.vividsolutions.jts.operation.distance.DistanceOp;
* this class
* 11/13 TTR 752 J. Wu added methods to compute an element's range record.
* 12/13 #1089 B. Yin Modify watch to display county list
* 02/14 #2819 R. Anderson Removed unnecessary .clone() call
* 05/14 TTR 995 J. Wu Make contour label auto-placement an option.
* 05/14 TTR 995 J. Wu Make contour label auto-placement an option.
* 07/14 ? B. Yin Added support for dashed-line circle for TCM 12 feet sea.
* 08/14 ? B. Yin Fixed world wrap for TCM track and zero circle issues.
* 08/14 TTR972 J. Wu Draw filled object as filled only if either its layer's "filled" flag
* "true" or they are on the active layer, .
* 09/14 TTR750 J. Wu Draw track label with specified font styles.
* 12/14 R5413 B. Yin Dispose image and font in find*Ranges methods
* </pre>
*
* @author sgilbert
@ -711,8 +712,9 @@ public class DisplayElementFactory {
iDescriptor, PointStyle.CROSS);
try {
compiler.handle(cntyUnion, new RGB(colors[1].getRed(),
colors[1].getGreen(), colors[1].getBlue()));
compiler.handle((Geometry) cntyUnion.clone(),
new RGB(colors[1].getRed(), colors[1].getGreen(),
colors[1].getBlue()));
if (elem.getFillPattern() != FillPattern.TRANSPARENCY
&& elem.getFillPattern() != FillPattern.SOLID) {
@ -1818,8 +1820,7 @@ public class DisplayElementFactory {
double major = Math.sqrt((diff[0] * diff[0]) + (diff[1] * diff[1]));
double minor = major * arc.getAxisRatio();
if (major / this.screenToExtent < 0.000001) { // ignore circles with
// major = 0
if (major / this.screenToExtent < 0.000001) { // ignore circles with major = 0
return slist;
}
@ -1890,6 +1891,7 @@ public class DisplayElementFactory {
return slist;
}
/**
/**
* Creates a list of IDisplayable Objects from an IArc object
*
@ -5927,6 +5929,10 @@ public class DisplayElementFactory {
List<Coordinate> textPos = new ArrayList<Coordinate>();
textPos.add(new Coordinate(loc[0], loc[1]));
if ( font != null ){
font.dispose();
}
return new PgenRangeRecord(rngBox, textPos, false);
}
@ -6000,6 +6006,10 @@ public class DisplayElementFactory {
List<Coordinate> symPos = new ArrayList<Coordinate>();
symPos.add(sym.getLocation());
if ( pic != null ){
pic.dispose();
}
return new PgenRangeRecord(rngBox, symPos, false);
}

View file

@ -79,7 +79,8 @@ public class SymbolCirclePart extends SymbolPart {
* Gets the coordinates defining the line path
* @return the line path
*/
public Coordinate[] getPath() {
@Override
public Coordinate[] getPath() {
if ( pathNeedsUpdate ) updatePath();
return path;
}
@ -88,7 +89,8 @@ public class SymbolCirclePart extends SymbolPart {
* Gets whether area defined by line path should be filled
* @return the filled flag
*/
public boolean isFilled() {
@Override
public boolean isFilled() {
return filled;
}
@ -143,7 +145,7 @@ public class SymbolCirclePart extends SymbolPart {
int numpts = 16;
path = new Coordinate[numpts];
double increment = 360.0 / (double)numpts;
double increment = 360.0 / numpts;
double angle = 0.0;
for (int j=0; j<numpts; j++) {
x = center.x + ( radius * Math.cos(Math.toRadians(angle)) );

View file

@ -8,8 +8,8 @@
package gov.noaa.nws.ncep.ui.pgen.file;
import gov.noaa.nws.ncep.ui.pgen.elements.tcm.TcmWindQuarters;
import gov.noaa.nws.ncep.ui.pgen.elements.tcm.TcmFcst;
import gov.noaa.nws.ncep.ui.pgen.elements.tcm.TcmWindQuarters;
import java.util.ArrayList;
import java.util.List;
@ -20,12 +20,8 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import javax.xml.datatype.XMLGregorianCalendar;
import com.raytheon.uf.common.geospatial.adapter.CoordAdapter;
import com.vividsolutions.jts.geom.Coordinate;
/**
* <p>Java class for anonymous complex type.

View file

@ -18,6 +18,7 @@ import gov.noaa.nws.ncep.ui.pgen.elements.Text;
import gov.noaa.nws.ncep.ui.pgen.elements.labeledlines.LabeledLine;
import gov.noaa.nws.ncep.ui.pgen.elements.tcm.Tcm;
import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
import gov.noaa.nws.ncep.ui.pgen.palette.PgenPaletteWindow;
import gov.noaa.nws.ncep.ui.pgen.tca.TCAElement;
/**
@ -36,6 +37,10 @@ public class CategoryFilter implements ElementFilter {
public CategoryFilter(String category) {
this.category = category;
}
public CategoryFilter(){
this.category = PgenPaletteWindow.CATEGORY_ANY;
}
@Override
public boolean accept(AbstractDrawableComponent adc) {
@ -88,14 +93,14 @@ public class CategoryFilter implements ElementFilter {
(adc.getParent() instanceof LabeledLine ||
adc.getParent().getParent() instanceof LabeledLine )) {
//cannot select individual from LabeledLine collection
if ( category.equalsIgnoreCase("ANY")){
if ( category.equalsIgnoreCase(PgenPaletteWindow.CATEGORY_ANY)){
return true;
}
else {
return false;
}
}
else if ( category.equalsIgnoreCase("any") ||
else if ( category.equalsIgnoreCase(PgenPaletteWindow.CATEGORY_ANY) ||
adc.getPgenCategory().equalsIgnoreCase(category) ) {
if ( category.equalsIgnoreCase("Lines") ) {
if ( adc.getParent() instanceof Jet ||

View file

@ -8,6 +8,9 @@
package gov.noaa.nws.ncep.ui.pgen.palette;
import gov.noaa.nws.ncep.ui.pgen.PGenRuntimeException;
import gov.noaa.nws.ncep.ui.pgen.PgenSession;
import gov.noaa.nws.ncep.ui.pgen.PgenStaticDataProvider;
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
//import gov.noaa.nws.ncep.viz.ui.display.NCMapEditor;
@ -23,8 +26,24 @@ import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.WorkbenchPage;
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
/**
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 01/15 #5413 B. Yin Added meesage box if PGEN is running in another perspective
*
* </pre>
*
* @author ?
*/
public class PgenPaletteAction extends AbstractHandler {
@ -32,6 +51,39 @@ public class PgenPaletteAction extends AbstractHandler {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
try {
PgenStaticDataProvider.getProvider();
}
catch (PGenRuntimeException e ){
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING
| SWT.OK);
mb.setMessage( "Please start NCP first to initialize PGEN data!");
mb.open();
return null;
}
AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager();
if ( pMngr != null && pMngr.getPerspectiveId() != PgenSession.getInstance().getPerspectiveId() ){
if (PgenSession.getInstance().getPgenPalette() == null ){
//if PGEN palette is closed
PgenSession.getInstance().setPerspectiveId(pMngr.getPerspectiveId() );
}
else {
// if PGEN palette is open in another perspective
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING
| SWT.OK);
int idxLastDot = PgenSession.getInstance().getPerspectiveId().lastIndexOf('.');
mb.setMessage( "A PGEN session is alreadly running in perspective " + PgenSession.getInstance().getPerspectiveId().substring(++idxLastDot) + "!");
mb.open();
return null;
}
}
/*
* The viewID string is in the XML file for PGEN extension point.
*/
@ -80,6 +132,9 @@ public class PgenPaletteAction extends AbstractHandler {
mb.setMessage( "Pgen is not supported in this editor. Please select a mapEditor for Pgen to use first!");
mb.open();
}
return null;
}

View file

@ -76,6 +76,7 @@ import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.VizWorkbenchManager;
@ -110,6 +111,8 @@ import com.raytheon.viz.ui.tools.AbstractModalTool;
* 01/10 ? S. Gilbert Initial Creation.
* 08/13 TTR696/774 J. Wu Reset title/Close product manage dialog.
* 11/13 #1081 B. Yin Get selected DE to change front/line type.
* 12/14 R5413 B. Yin Removed unused variables, loops.
* 01/15 R5413 B. Yin Set perspective ID and editor for PGEN session.
*
* </pre>
*
@ -203,6 +206,8 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
private IContextActivation pgenContextActivation;
private AbstractEditor currentIsMultiPane = null;
public static final String CATEGORY_ANY = "Any";
/**
* Constructor
@ -305,14 +310,6 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
/* TODO: save on exit? dialog */
super.dispose();
/*
* remove product manage/layer dialog
*/
PgenResource pgen = PgenSession.getInstance().getPgenResource();
if (pgen != null) {
pgen.closeDialogs();
}
/*
* remove this palette from Pgen Session
*/
@ -395,8 +392,15 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
* the PgenSession
*/
PgenResource current = PgenUtil.findPgenResource(null);
if (current != null)
if (current != null) {
PgenSession.getInstance().setResource(current);
PgenUtil.setSelectingMode();
AbstractEditor actEditor = PgenUtil.getActiveEditor();
if ( actEditor != null && !PgenSession.getInstance().getEditors().contains(actEditor)){
PgenSession.getInstance().getEditors().add(actEditor);
}
}
}
@ -603,6 +607,16 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
IEditorPart editor = VizWorkbenchManager.getInstance()
.getActiveEditor();
//Set perspective ID in session
if ( PgenSession.getInstance().getPerspectiveId() == null ||
PgenSession.getInstance().getPerspectiveId().isEmpty()){
AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager();
if ( pMngr != null ){
PgenSession.getInstance().setPerspectiveId(pMngr.getPerspectiveId());
}
}
if (editor instanceof AbstractEditor) {// && ((NCMapEditor)
// editor).getApplicationName().equals("NA")
// ) {
@ -867,14 +881,28 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
// if ( part instanceof NCMapEditor &&((NCMapEditor)
// part).getApplicationName().equals("NA")) {
if (PgenUtil.isNatlCntrsEditor(part)) {
if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) {
//Prevent PGEN going to another perspective
AbstractVizPerspectiveManager pMngr = VizPerspectiveListener.getCurrentPerspectiveManager();
if ( pMngr != null && pMngr.getPerspectiveId() != PgenSession.getInstance().getPerspectiveId() ){
return;
}
PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part);
if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE))
// if ( PgenSession.getInstance().getPgenResource().getDescriptor()
// != )
if ((rsc == null) && (PgenUtil.getPgenMode() == PgenMode.SINGLE)) {
rsc = PgenUtil.createNewResource();
if (rsc != null)
}
if (rsc != null) {
rsc.setCatFilter(new CategoryFilter(
(currentCategory == null) ? "Any" : currentCategory));
(currentCategory == null) ? CATEGORY_ANY : currentCategory));
}
PgenSession.getInstance().setResource(rsc);
AbstractEditor editor = (AbstractEditor) part;
@ -885,9 +913,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
PgenUtil.addSelectedPaneChangedListener(editor, this);
}
activatePGENContext();
}
else if (part instanceof PgenPaletteWindow) {
} else if (part instanceof PgenPaletteWindow) {
activatePGENContext();
// found NCMapEditor
@ -926,7 +952,7 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
// );
partActivated(partRef);
if (PgenUtil.isNatlCntrsEditor(part)) {
if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) {
AbstractEditor editor = (AbstractEditor) part;
PgenResource rsc = PgenUtil.findPgenResource((AbstractEditor) part);
@ -966,17 +992,12 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
if (VizPerspectiveListener.getCurrentPerspectiveManager() == null)
return; // workbench probably closing
AbstractEditor[] editors = UiUtil.getEditors(PlatformUI
.getWorkbench().getActiveWorkbenchWindow(),
VizPerspectiveListener.getCurrentPerspectiveManager()
.getPerspectiveId());
/*
* UiUtil.getEditors returns active editor first. Run through
* list in reverse so that active editor is processed last.
*/
for (int i = editors.length - 1; i >= 0; i--) {
unloadPgenResource(editors[i]);
for (AbstractEditor editor : PgenSession.getInstance()
.getEditors()) {
unloadPgenResource(editor);
}
PgenSession.getInstance().endSession();
}
// if ( currentIsMultiPane != null )
@ -1055,11 +1076,12 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
// System.out.println("Something Hidden: "+part.getClass().getCanonicalName()
// );
if (PgenUtil.isNatlCntrsEditor(part)) {
if (PgenUtil.isNatlCntrsEditor(part) || part instanceof VizMapEditor) {
PgenResource pgen = PgenUtil
.findPgenResource((AbstractEditor) part);
if (pgen != null) {
pgen.closeDialogs();
pgen.deactivatePgenTools();
}
}
}
@ -1403,4 +1425,13 @@ public class PgenPaletteWindow extends ViewPart implements SelectionListener,
public String getCurrentObject() {
return currentObject;
}
/*
* Sets the category and its icon.
*/
public void setCurrentCategory(String currentCategory) {
this.resetIcon(this.currentCategory);
this.currentCategory = currentCategory;
this.setActiveIcon(currentCategory);
}
}

View file

@ -83,6 +83,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.EditableCapability;
import com.raytheon.viz.core.gl.IGLTarget;
import com.raytheon.viz.ui.cmenu.IContextMenuProvider;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
import com.raytheon.viz.ui.input.EditableManager;
import com.raytheon.viz.ui.perspectives.AbstractVizPerspectiveManager;
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
@ -146,6 +147,9 @@ import com.vividsolutions.jts.geom.Point;
* 09/14 TTR972 J. Wu "Filled" object on the active layer should be
* drawn as "filled" even if the "filled" flag for
* the layer is "false".
* 11/13 TTR 752 J. Wu Add methods for CCFP text auto placement.
* 11/14 R5413 B. Yin Display PGEN in side view in D2D
* 12/14 R5413 B. Yin Added resetAllElements(), reset ghost, removed "Any".
* </pre>
*
* @author B. Yin
@ -213,7 +217,7 @@ public class PgenResource extends
selectedSymbol = new HashMap<AbstractDrawableComponent, Symbol>();
displayMap = new ConcurrentHashMap<DrawableElement, AbstractElementContainer>();
filters = new ElementFilterCollection();
setCatFilter(new CategoryFilter("any"));
setCatFilter(new CategoryFilter());
// Register this new resource with the Session
PgenSession.getInstance().setResource(this);
@ -361,9 +365,10 @@ public class PgenResource extends
public void paintInternal(IGraphicsTarget target, PaintProperties paintProps)
throws VizException {
IDisplayPaneContainer editor = getResourceContainer();
if (editor instanceof AbstractEditor) {// && ((NCMapEditor)
// editor).getApplicationName().equals("NA")
// ) {
// Draw in main editor and side view (IMultiPaneEditor)
if (editor instanceof AbstractEditor
|| editor instanceof IMultiPaneEditor) {
DisplayElementFactory df = new DisplayElementFactory(target,
descriptor);
@ -541,6 +546,8 @@ public class PgenResource extends
if (this.ghost == null) {
this.ghost = new PgenResourceGhost();
} else {
this.ghost.dispose();
}
// this.ghost = ghost;
this.ghost.setGhostLine(ghost);
@ -679,7 +686,8 @@ public class PgenResource extends
private void drawSelected(IGraphicsTarget target, PaintProperties paintProps) {
if (!elSelected.isEmpty()) {
if (!elSelected.isEmpty()
&& PgenSession.getInstance().getPgenPalette() != null) {
DisplayElementFactory df = new DisplayElementFactory(target,
descriptor);
List<IDisplayable> displayEls = new ArrayList<IDisplayable>();
@ -1373,6 +1381,20 @@ public class PgenResource extends
}
}
/**
* Releases the resources held by all DEs to refresh all.
*
* @param adc
*/
public void resetAllElements(){
for ( Product prd : this.resourceData.getProductList() ){
for ( Layer layer : prd.getLayers()) {
this.resetADC(layer);
}
}
}
/**
* Finds the nearest element in the a DECollection to the input point.
*
@ -1745,22 +1767,26 @@ public class PgenResource extends
}
/**
* De-activate all PGEN tools
* De-activate all PGEN tools for all perspectives
*/
public void deactivatePgenTools() {
AbstractVizPerspectiveManager mgr = VizPerspectiveListener
.getCurrentPerspectiveManager();
if (mgr != null) {
Iterator<AbstractModalTool> it = mgr.getToolManager()
.getSelectedModalTools().iterator();
while (it.hasNext()) {
AbstractModalTool tool = it.next();
if (tool != null && tool instanceof AbstractPgenTool) {
tool.deactivate();
it.remove();
for (String pid : VizPerspectiveListener.getManagedPerspectives()) {
AbstractVizPerspectiveManager mgr = VizPerspectiveListener
.getInstance().getPerspectiveManager(pid);
if (mgr != null) {
Iterator<AbstractModalTool> it = mgr.getToolManager()
.getSelectedModalTools().iterator();
while (it.hasNext()) {
AbstractModalTool tool = it.next();
if (tool != null && tool instanceof AbstractPgenTool) {
tool.deactivate();
it.remove();
}
}
}
}
}
/**

View file

@ -44,6 +44,10 @@ import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.graphics.Image;
@ -69,10 +73,19 @@ import com.vividsolutions.jts.geom.Coordinate;
* Contains all the PGEN Products, layers, and Elements behind the PgenResource.
* Also holds the command manager to undo/redo changes to the data in the
* productlist
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 01/15 #5413 B. Yin Close PGEN palette in cleanup
*
* </pre>
*
* @author sgilbert
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class PgenResourceData extends AbstractResourceData implements
CommandStackListener {
private static final transient IUFStatusHandler statusHandler = UFStatus
@ -116,6 +129,8 @@ public class PgenResourceData extends AbstractResourceData implements
private boolean needsDisplay = false;
private int numberOfResources = 0;
private ArrayList<PgenResource> rscList = new ArrayList<PgenResource>();
// private static final String PRD_GRAPHIC = "xml";
@ -142,7 +157,9 @@ public class PgenResourceData extends AbstractResourceData implements
public PgenResource construct(LoadProperties loadProperties,
IDescriptor descriptor) throws VizException {
numberOfResources++;
return new PgenResource(this, loadProperties);
PgenResource rsc = new PgenResource(this, loadProperties);
rscList.add(rsc);
return rsc;
}
/*
@ -740,10 +757,15 @@ public class PgenResourceData extends AbstractResourceData implements
*/
public synchronized void cleanup(BufferedImage paneImage) {
closeDialogs();
PgenSession.getInstance().closePalette();
numberOfResources--;
if (numberOfResources != 0)
if (numberOfResources != 0){
return; // not ready yet
}
commandMgr.flushStacks();
commandMgr.removeStackListener(this);
@ -751,19 +773,21 @@ public class PgenResourceData extends AbstractResourceData implements
* remove Temp recovery file
*/
removeTempFile();
if (needsSaving) {
promptToSave(paneImage);
}
if (autosave)
storeAllProducts();
// saveProducts(autoSaveFilename, multiSave);
if (needsSaving) {
promptToSave(paneImage);
}
if (PgenUtil.getPgenMode() == PgenMode.SINGLE)
if (PgenUtil.getPgenMode() == PgenMode.SINGLE){
PgenUtil.resetResourceData();
}
deactivatePgenTools();
}
/**

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 15, 2012 bgonzale Initial creation
* Dec 10, 2014 R5413 byin Added dispose method.
*
* </pre>
*
@ -118,4 +119,13 @@ public class PgenResourceGhost {
public void setGhostLine(AbstractDrawableComponent ghost) {
this.component = ghost;
}
/*
* Release resources held by the ghost elements.
*/
public void dispose() {
for (AbstractElementContainer aec : componentMap.values()) {
aec.dispose();
}
}
}

View file

@ -24,7 +24,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.geotools.data.Query;
import org.geotools.data.DefaultQuery;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.feature.FeatureIterator;
import org.geotools.referencing.GeodeticCalculator;
@ -60,7 +60,6 @@ import com.vividsolutions.jts.geom.Polygon;
* 02/2012 #597 S. Gurung Moved snap functionalities to SnapUtil. Removed GUI snapping for Non ConvSigmet.
* 02/2012 S. Gurung Moved back isSnapADC() and getNumOfCompassPts() to SigmetInfo from SnapUtil
* 11/12 #893 J. Wu TTR635 - Fix volcano in alphabetical breakdown order.
* Mar 11, 2014 #2718 randerso Changes for GeoTools 10.5
* </pre>
*
* @author gzhang
@ -288,7 +287,7 @@ public class SigmetInfo {
public static Polygon getIsolatedPolygon(Coordinate vertex, double widthInNautical, IMapDescriptor mapDescriptor){
Coordinate[] isolated = getIsolated(vertex, widthInNautical, mapDescriptor);
Coordinate[] ip = new Coordinate[isolated.length+1];
ip = (Coordinate[]) Arrays.copyOf(isolated, isolated.length);
ip = Arrays.copyOf(isolated, isolated.length);
ip[ip.length-1] = isolated[0];
return getPolygon( ip,mapDescriptor );
}
@ -296,7 +295,7 @@ public class SigmetInfo {
public static Polygon getSOLPolygon(Coordinate[] coors, String line, double width, IMapDescriptor mapDescriptor){
Coordinate[] ip = getSOLCoors(coors, line, width, mapDescriptor);
Coordinate[] ipPlus = new Coordinate[ip.length+1];
ipPlus = (Coordinate[]) Arrays.copyOf(ip, ipPlus.length);
ipPlus = Arrays.copyOf(ip, ipPlus.length);
ipPlus[ipPlus.length-1] = ip[0];
return getPolygon( ipPlus,mapDescriptor );
}
@ -536,13 +535,18 @@ public class SigmetInfo {
FeatureIterator<SimpleFeature> featureIterator = null;
HashMap<String,Coordinate[]> firGeoMap = new HashMap<String,Coordinate[]>();
ShapefileDataStore shapefileDataStore=null;
ShapefileDataStore shapefileDataStore = null;
String shapeField=null;
try{
File file = PgenStaticDataProvider.getProvider().getFirBoundsFile();
shapefileDataStore = new ShapefileDataStore(file.toURI()
.toURL());
File file = PgenStaticDataProvider.getProvider().getFirBoundsFile();
shapefileDataStore = new ShapefileDataStore(file.toURI().toURL());
shapefileDataStore.setMemoryMapped(false);
shapefileDataStore.setIndexCreationEnabled(true);
// shapefileDataStore = new IndexedShapefileDataStore(file.toURI()
// .toURL(), null, false, true,
// org.geotools.data.shapefile.indexed.IndexType.QIX);
shapeField = shapefileDataStore.getFeatureSource().getSchema().getGeometryDescriptor().getLocalName();
}catch(Exception e){
@ -554,7 +558,7 @@ public class SigmetInfo {
try {
String[] types = shapefileDataStore.getTypeNames();
Query query = new Query();
DefaultQuery query = new DefaultQuery();
query.setTypeName(types[0]);
String[] fields = new String[labelFields.length+1];

View file

@ -18,8 +18,10 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
//import gov.noaa.nws.ncep.viz.ui.display.NCMapEditor;
@ -75,9 +77,11 @@ public abstract class AbstractPgenDrawingTool extends AbstractPgenTool {
protected void activateTool() {
IEditorPart ep = EditorUtil.getActiveEditor();
if (!PgenUtil.isNatlCntrsEditor(ep)) {
if (!PgenUtil.isNatlCntrsEditor(ep) && !(ep instanceof VizMapEditor)) {
// mapEditor = null;
return;
// drawingLayer = PgenUtil.findPgenResource((AbstractEditor)ep);
// if ( drawingLayer == null )
return;
}
if (!super.isDelObj()) {

View file

@ -33,6 +33,7 @@ import com.raytheon.viz.ui.tools.AbstractModalTool;
* 12/13 TTR899 J. Wu Set delObjFlag to false when any Pgen Action
* button is clicked
* 04/2014 TTR900 pswamy R-click cannot return to SELECT from Rotate and DEL_OBJ
* 12/2014 R5413 B. Yin Set PGEN tool in PGEN session
*
* </pre>
*
@ -80,7 +81,8 @@ public abstract class AbstractPgenTool extends AbstractModalTool {
// Get a PGEN Resource
drawingLayer = PgenSession.getInstance().getPgenResource();
if (this instanceof PgenDeleteObj) {
delObjFlag = true;
} else if ((this instanceof PgenSelectingTool)
@ -102,11 +104,14 @@ public abstract class AbstractPgenTool extends AbstractModalTool {
}
this.inputHandler = getMouseHandler();
if (this.inputHandler != null)
if (this.inputHandler != null){
mapEditor.registerMouseHandler(this.inputHandler);
}
// Turn off, so tool doesn't exihibit toggle behavior
setEnabled(false);
PgenSession.getInstance().setPgenTool(this);
}
abstract public IInputHandler getMouseHandler();
@ -130,9 +135,11 @@ public abstract class AbstractPgenTool extends AbstractModalTool {
}
if (mapEditor != null && this.inputHandler != null)
mapEditor.unregisterMouseHandler(this.inputHandler);
if (mapEditor != null && this.inputHandler != null){
mapEditor.unregisterMouseHandler(this.inputHandler);
}
PgenSession.getInstance().setPgenTool(null);
}
/**

View file

@ -172,38 +172,6 @@ public class PgenAddLabelHandler extends InputHandlerDefaultImpl {
}
else if ( button == 3 ) {
if ( ghostLabel != null ){
if(prevTool.getLabeledLine().getName().contains("CCFP_SIGMET")){
addCcfpLabel(loc, prevTool.getLabeledLine());
cleanUp();
return true;
}
else{
if ( !pts.isEmpty()){
// addLabel( pts.get(pts.size()-1), prevTool.getLabeledLine() );
addLabel( pts.get(pts.size()-1), (LabeledLine)lineSelected.getParent() );
}
else {
lineSelected = null;
ghostLabel = null;
drawingLayer.removeGhostLine();
mapEditor.refresh();
}
}
pts.clear();
}
else {
//clean up and exit
lineSelected = null;
drawingLayer.removeGhostLine();
mapEditor.refresh();
prevTool.resetMouseHandler();
dlg.resetLabeledLineBtns();
}
return true;
@ -296,8 +264,65 @@ public class PgenAddLabelHandler extends InputHandlerDefaultImpl {
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if ( !drawingLayer.isEditable()|| shiftDown ) return false;
else return true; }
else return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
*/
@Override
public boolean handleMouseUp(int x, int y, int mouseButton) {
if ( !drawingLayer.isEditable() || shiftDown ) return false;
// Check if mouse is in geographic extent
Coordinate loc = mapEditor.translateClick(x, y);
if ( loc == null ) {
return true;
}
if ( mouseButton == 3 ){
if ( ghostLabel != null ){
if(prevTool.getLabeledLine().getName().contains("CCFP_SIGMET")){
addCcfpLabel(loc, prevTool.getLabeledLine());
cleanUp();
return true;
}
else{
if ( !pts.isEmpty()){
// addLabel( pts.get(pts.size()-1), prevTool.getLabeledLine() );
addLabel( pts.get(pts.size()-1), (LabeledLine)lineSelected.getParent() );
}
else {
lineSelected = null;
ghostLabel = null;
drawingLayer.removeGhostLine();
mapEditor.refresh();
}
}
pts.clear();
}
else {
//clean up and exit
lineSelected = null;
drawingLayer.removeGhostLine();
mapEditor.refresh();
prevTool.resetMouseHandler();
dlg.resetLabeledLineBtns();
}
return true;
}
else {
return false;
}
}
/**
* Create label for line ln at location loc.
* @param loc

View file

@ -151,6 +151,9 @@ public class PgenAddPointAltHandler extends InputHandlerDefaultImpl {
return preempt;
}
else if ( button == 3 ){
return true;
}
else{

View file

@ -154,6 +154,9 @@ public class PgenAddPointHandler extends InputHandlerDefaultImpl {
return preempt;
}
else if ( button == 3 ){
return true;
}
else{
return false;

View file

@ -115,12 +115,7 @@ public class PgenAvnTextDrawingTool extends AbstractPgenDrawingTool {
}
else if ( button == 3 ) {
// The following methods are called when the tool is deactivated
// and are not needed here
//drawingLayer.removeGhostLine();
//mapEditor.refresh();
//attrDlg.close();
PgenUtil.setSelectingMode();
return true;
@ -168,6 +163,26 @@ public class PgenAvnTextDrawingTool extends AbstractPgenDrawingTool {
if ( shiftDown || !isResourceEditable()) return false;
else return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
*/
@Override
public boolean handleMouseUp(int x, int y, int mouseButton) {
if ( !isResourceEditable()|| shiftDown ) return false;
// prevent the click going through to other handlers
// in case adding labels to symbols or fronts.
if ( mouseButton == 3 ) {
PgenUtil.setSelectingMode();
return true;
}
else {
return false;
}
}
}

View file

@ -306,32 +306,7 @@ public class PgenConnectTool extends AbstractPgenDrawingTool {
} else if (button == 3) {
if (secondEl != null) {
// reselect the second element
ghostEl = createGhostElement(firstEl, nearPt, loc);
drawingLayer.setGhostLine(ghostEl);
secondEl = null;
secondJet = null;
} else {
if (firstEl != null) {
// unselect the first element but stay in "Connect" mode
drawingLayer.removeGhostLine();
drawingLayer.removeSelected();
nearPt = 0;
firstEl = null;
firstJet = null;
} else {
// Exit "Connect" mode & set selecting mode
PgenUtil.setSelectingMode();
}
}
mapEditor.refresh();
return false;
return true;
} else { // Button 2 - ignore
@ -383,6 +358,40 @@ public class PgenConnectTool extends AbstractPgenDrawingTool {
if (!isResourceEditable()) {
return false;
}
Coordinate loc = mapEditor.translateClick(x, y);
if (loc == null) {
return true;
}
if (button == 3) {
if (secondEl != null) {
// reselect the second element
ghostEl = createGhostElement(firstEl, nearPt, loc);
drawingLayer.setGhostLine(ghostEl);
secondEl = null;
secondJet = null;
} else {
if (firstEl != null) {
// unselect the first element but stay in "Connect" mode
drawingLayer.removeGhostLine();
drawingLayer.removeSelected();
nearPt = 0;
firstEl = null;
firstJet = null;
} else {
// Exit "Connect" mode & set selecting mode
PgenUtil.setSelectingMode();
}
}
mapEditor.refresh();
}
return true;
}

View file

@ -8,21 +8,9 @@
package gov.noaa.nws.ncep.ui.pgen.tools;
import java.awt.Color;
import java.util.Iterator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.geotools.coverage.grid.GridEnvelope2D;
import org.opengis.coverage.grid.GridEnvelope;
import com.raytheon.uf.viz.core.IExtent;
import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.vividsolutions.jts.geom.Coordinate;
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
import gov.noaa.nws.ncep.ui.pgen.annotation.Operation;
import gov.noaa.nws.ncep.ui.pgen.contours.Contours;
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
import gov.noaa.nws.ncep.ui.pgen.elements.DECollection;
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
@ -31,9 +19,19 @@ import gov.noaa.nws.ncep.ui.pgen.elements.WatchBox;
import gov.noaa.nws.ncep.ui.pgen.filter.OperationFilter;
import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
import gov.noaa.nws.ncep.ui.pgen.gfa.GfaReducePoint;
import gov.noaa.nws.ncep.ui.pgen.contours.Contours;
import gov.noaa.nws.ncep.viz.common.SnapUtil;
import gov.noaa.nws.ncep.ui.pgen.sigmet.SigmetInfo;
import gov.noaa.nws.ncep.viz.common.SnapUtil;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Iterator;
import org.geotools.coverage.grid.GridEnvelope2D;
import org.geotools.referencing.CRS;
import org.opengis.coverage.grid.GridEnvelope;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Implements a modal map tool for the PGEN copy element function.
@ -57,6 +55,7 @@ import gov.noaa.nws.ncep.ui.pgen.sigmet.SigmetInfo;
* 05/11 #808 J. Wu Update Gfa vor text
* 05/12 #610 J. Wu Add warning when GFA FROM lines > 3
* 08/12 #760 B. Yin Check for world wrap
* 09/14 ? B. Yin Handle map bounds.
*
* </pre>
*
@ -109,6 +108,7 @@ public class PgenCopyElement extends AbstractPgenTool {
protected boolean simulate;
private boolean isMercator = false;
/*
* (non-Javadoc)
@ -121,7 +121,7 @@ public class PgenCopyElement extends AbstractPgenTool {
if ( !isResourceEditable() ) return false;
preempt = false;
isMercator = (CRS.getMapProjection( mapEditor.getActiveDisplayPane().getDescriptor().getCRS())).getName().contains("Mercator");
// Check if mouse is in geographic extent
Coordinate loc = mapEditor.translateClick(anX, aY);
if ( loc == null || shiftDown || simulate ) return false;
@ -148,18 +148,6 @@ public class PgenCopyElement extends AbstractPgenTool {
}
else if ( button == 3 ) {
if ( drawingLayer.getSelectedComp() != null ){
// de-select element
drawingLayer.removeSelected();
drawingLayer.removeGhostLine();
ghostEl = null;
mapEditor.refresh();
}
else {
// set selecting mode
PgenUtil.setSelectingMode();
}
return true;
}
@ -225,6 +213,15 @@ public class PgenCopyElement extends AbstractPgenTool {
}
if ( ghostEl != null ) {
//save the original points
ArrayList<Coordinate> originalPts = new ArrayList<Coordinate>();
for ( Coordinate coord : ghostEl.getPoints()){
originalPts.add(new Coordinate(coord.x, coord.y, 0));
}
boolean hitBound = false;
// use screen coordinate to copy/move
//double[] locScreen = mapEditor.translateInverseClick(loc);
double[] ptScreen = mapEditor.translateInverseClick(ptSelected);
@ -242,17 +239,21 @@ public class PgenCopyElement extends AbstractPgenTool {
double[] world = mapEditor.getActiveDisplayPane().screenToGrid(scnPt[0], scnPt[1], 0);
if ( world[0] > ((GridEnvelope2D)ge).getWidth() ) {
if ( isMercator && world[0] > ((GridEnvelope2D)ge).getWidth() ) {
// System.out.println("idx=" + idx + " Out of Screen " + world[0] +" / " + ((GridEnvelope2D)ge).getWidth() );
world[0] -= ((GridEnvelope2D)ge).getWidth();
scnPt = mapEditor.getActiveDisplayPane().gridToScreen( world );
}
else if ( world[0] < 0 ){
// System.out.println("idx=" + idx + " Out of Screen " + world[0] +" / " + ((GridEnvelope2D)ge).getWidth() );
else if ( isMercator && world[0] < 0 ){
// System.out.println("idx=" + idx + " Out of Screen " + world[0] +" / " + ((GridEnvelope2D)ge).getWidth() );
world[0] += ((GridEnvelope2D)ge).getWidth();
scnPt = mapEditor.getActiveDisplayPane().gridToScreen( world );
}
else if ( world[0] > ((GridEnvelope2D)ge).getWidth() || world[0] < 0 ||
world[1] < 0 || world[1] > ((GridEnvelope2D)ge).getHeight()){
hitBound = true;
break;
}
Coordinate cord = mapEditor.translateClick(scnPt[0], scnPt[1]);
@ -263,6 +264,14 @@ public class PgenCopyElement extends AbstractPgenTool {
}
if ( hitBound ){
//restore original points
for ( int idx = 0; idx < ghostEl.getPoints().size(); idx++ ){
ghostEl.getPoints().get(idx).x = originalPts.get(idx).x;
ghostEl.getPoints().get(idx).y = originalPts.get(idx).y;
}
}
if ( elSelected instanceof Gfa ) {
double[] scnPt = mapEditor.translateInverseClick( ((Gfa) elSelected).getGfaTextCoordinate() );
@ -323,6 +332,24 @@ public class PgenCopyElement extends AbstractPgenTool {
if ( !isResourceEditable()|| shiftDown || simulate ) return false;
if ( button == 3 ) {
if ( drawingLayer.getSelectedComp() != null ){
// de-select element
drawingLayer.removeSelected();
drawingLayer.removeGhostLine();
ghostEl = null;
mapEditor.refresh();
}
else {
// set selecting mode
PgenUtil.setSelectingMode();
}
return true;
}
if ( ghostEl != null ) {
// reset color for the el and add it to PGEN resource

View file

@ -60,6 +60,24 @@ public class PgenDeleteObj extends AbstractPgenTool {
if (!isResourceEditable())
return false;
if (button == 3) {
return true;
}
return false;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseDown(int,
* int, int)
*/
@Override
public boolean handleMouseUp(int x, int y, int button) {
if (!isResourceEditable())
return false;
if (button == 3) {
// set selecting mode
PgenUtil.setSelectingMode();

View file

@ -242,15 +242,7 @@ public class PgenDeletePart extends PgenSelectingTool {
}
else if ( button == 3 ) {
// reset
ptSelected = false;
drawingLayer.removeGhostLine();
drawingLayer.removeSelected();
lil = null;
mapEditor.refresh();
PgenUtil.setSelectingMode();
return true;
}
@ -281,7 +273,23 @@ public class PgenDeletePart extends PgenSelectingTool {
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
return false;
if (!isResourceEditable())
return false;
if (button == 3) {
// reset
ptSelected = false;
drawingLayer.removeGhostLine();
drawingLayer.removeSelected();
lil = null;
mapEditor.refresh();
PgenUtil.setSelectingMode();
return true;
}
else {
return false;
}
}
/**

View file

@ -126,7 +126,9 @@ public class PgenDeletePointHandler extends PgenSelectHandler{
return true;
}
else if ( button == 3 ){
return true;
}
else{
return false;

View file

@ -135,21 +135,6 @@ public class PgenDualPointDrawingTool extends AbstractPgenDrawingTool {
}
else if ( button == 3 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
if ( points.size() == 0 ) {
// NmapUiUtils.setPanningMode();
PgenUtil.setSelectingMode();
}
else {
points.clear();
}
return true;
}
@ -205,7 +190,6 @@ public class PgenDualPointDrawingTool extends AbstractPgenDrawingTool {
}
return false;
}
@ -216,7 +200,36 @@ public class PgenDualPointDrawingTool extends AbstractPgenDrawingTool {
else return true;
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if (!isResourceEditable())
return false;
if (button == 3) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
if ( points.size() == 0 ) {
PgenUtil.setSelectingMode();
}
else {
points.clear();
}
return true;
}
else {
return false;
}
}
/*
* Check if the given starting angle is less than the ending angle
*/

View file

@ -36,49 +36,49 @@ import gov.noaa.nws.ncep.ui.pgen.filter.OperationFilter;
* @author J. Wu
*/
public class PgenExtrapTool extends AbstractPgenDrawingTool {
/**
* Input handler for mouse events.
*/
public PgenExtrapTool(){
super();
super();
}
/**
* Returns the current mouse handler.
* @return
*/
public IInputHandler getMouseHandler() {
if ( this.mouseHandler == null ) {
this.mouseHandler = new PgenExtrapHandler();
if ( this.mouseHandler == null ) {
this.mouseHandler = new PgenExtrapHandler();
}
return this.mouseHandler;
}
}
/**
* Implements input handler for mouse events.
* @author jwu
*
*/
public class PgenExtrapHandler extends InputHandlerDefaultImpl {
private boolean preempt;
/**
* Current extrapolation dialog.
*/
private PgenExtrapDlg extrapDlg = null;
private OperationFilter extrapFilter = new OperationFilter( Operation.EXTRAPOLATE );
private boolean preempt;
/**
* Current extrapolation dialog.
*/
private PgenExtrapDlg extrapDlg = null;
private OperationFilter extrapFilter = new OperationFilter( Operation.EXTRAPOLATE );
/*
* (non-Javadoc)
*
@ -87,86 +87,102 @@ public class PgenExtrapTool extends AbstractPgenDrawingTool {
*/
@Override
public boolean handleMouseDown( int anX, int aY, int button ) {
if ( !isResourceEditable() ) return false;
if ( !isResourceEditable() ) return false;
preempt = false;
// Check if mouse is in geographic extent
Coordinate loc = mapEditor.translateClick(anX, aY);
if ( loc == null || shiftDown ) return false;
if ( button == 1 ) {
preempt = false;
// Check if mouse is in geographic extent
Coordinate loc = mapEditor.translateClick(anX, aY);
if ( loc == null || shiftDown ) return false;
if ( button == 1 ) {
if ( drawingLayer.getSelectedComp() == null ) {
// Get the nearest element and set it as the selected element.
AbstractDrawableComponent elSelected = drawingLayer.getNearestComponent( loc, extrapFilter, true );
drawingLayer.setSelected( elSelected );
if ( elSelected != null ) preempt = true;
}
else {
extrapDlg = (PgenExtrapDlg)attrDlg;
AbstractDrawableComponent elem = drawingLayer.getSelectedComp();
AbstractDrawableComponent newDE = PgenToolUtils.extrapElement( elem,
extrapDlg.getDirection(), extrapDlg.getDistance() );
boolean getNewDE = true;
if ( newDE instanceof WatchBox ){
getNewDE = PgenWatchBoxModifyTool.resnapWatchBox(mapEditor, (WatchBox)newDE, (WatchBox)newDE);
}
if ( getNewDE ){
if ( extrapDlg.isCopy() ) {
drawingLayer.addElement( newDE );
}
else {
drawingLayer.replaceElement( drawingLayer.getSelectedComp(), newDE );
}
}
drawingLayer.removeSelected();
}
mapEditor.refresh();
return preempt;
}
else if ( button == 3 ) {
if ( drawingLayer.getSelectedComp() != null ) {
drawingLayer.removeSelected();
mapEditor.refresh();
// Get the nearest element and set it as the selected element.
AbstractDrawableComponent elSelected = drawingLayer.getNearestComponent( loc, extrapFilter, true );
drawingLayer.setSelected( elSelected );
if ( elSelected != null ) preempt = true;
}
else {
// set selecting mode
PgenUtil.setSelectingMode();
extrapDlg = (PgenExtrapDlg)attrDlg;
AbstractDrawableComponent elem = drawingLayer.getSelectedComp();
AbstractDrawableComponent newDE = PgenToolUtils.extrapElement( elem,
extrapDlg.getDirection(), extrapDlg.getDistance() );
boolean getNewDE = true;
if ( newDE instanceof WatchBox ){
getNewDE = PgenWatchBoxModifyTool.resnapWatchBox(mapEditor, (WatchBox)newDE, (WatchBox)newDE);
}
if ( getNewDE ){
if ( extrapDlg.isCopy() ) {
drawingLayer.addElement( newDE );
}
else {
drawingLayer.replaceElement( drawingLayer.getSelectedComp(), newDE );
}
}
drawingLayer.removeSelected();
}
return true;
mapEditor.refresh();
return preempt;
}
else if ( button == 3 ) {
return true;
}
else {
return false;
return false;
}
}
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if ( !isResourceEditable() || shiftDown ) return false;
else return preempt;
}
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if ( !isResourceEditable() || shiftDown ) return false;
else return preempt;
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if (!isResourceEditable())
return false;
if (button == 3) {
if ( drawingLayer.getSelectedComp() != null ) {
drawingLayer.removeSelected();
mapEditor.refresh();
}
else {
// set selecting mode
PgenUtil.setSelectingMode();
}
return true;
}
else {
return false;
}
}
}

View file

@ -40,52 +40,52 @@ import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
*/
public class PgenFlipDrawingElement extends AbstractPgenTool {
//private Log log = LogFactory.getLog(getClass());
//private Log log = LogFactory.getLog(getClass());
/**
* Input handler for mouse events.
*/
protected IInputHandler flipHandler;
public PgenFlipDrawingElement(){
super();
super();
}
/**
* Returns the current mouse handler.
* @return
*/
public IInputHandler getMouseHandler() {
if ( this.flipHandler == null ) {
this.flipHandler = new PgenFlipHandler(drawingLayer, mapEditor);
this.flipHandler = new PgenFlipHandler(drawingLayer, mapEditor);
}
return this.flipHandler;
}
/**
* Implements input handler for mouse events.
* @author Michael Gao
*
*/
public class PgenFlipHandler extends InputHandlerDefaultImpl {
private PgenResource flipPgenSource;
// private NCMapEditor flipNCMapEditor;
private AbstractEditor flipNCMapEditor;
private boolean preempt;
private OperationFilter flipFilter;
// public PgenFlipHandler(PgenResource _flipPgenSource, NCMapEditor _flipNCMapEditor) {
private PgenResource flipPgenSource;
// private NCMapEditor flipNCMapEditor;
private AbstractEditor flipNCMapEditor;
private boolean preempt;
private OperationFilter flipFilter;
// public PgenFlipHandler(PgenResource _flipPgenSource, NCMapEditor _flipNCMapEditor) {
public PgenFlipHandler(PgenResource _flipPgenSource, AbstractEditor _flipNCMapEditor) {
flipPgenSource = _flipPgenSource;
flipNCMapEditor = _flipNCMapEditor;
flipFilter = new OperationFilter( Operation.FLIP );
}
flipPgenSource = _flipPgenSource;
flipNCMapEditor = _flipNCMapEditor;
flipFilter = new OperationFilter( Operation.FLIP );
}
/*
* (non-Javadoc)
*
@ -94,54 +94,73 @@ public class PgenFlipDrawingElement extends AbstractPgenTool {
*/
@Override
public boolean handleMouseDown(int anX, int aY, int button) {
if ( !isResourceEditable() ) return false;
if ( !isResourceEditable() ) return false;
preempt = false;
// Check if mouse is in geographic extent
Coordinate loc = flipNCMapEditor.translateClick(anX, aY);
if ( loc == null || shiftDown ) return false;
//DrawableElement selectedDrawableElement = flipPgenSource.getSelectedDE();
AbstractDrawableComponent selectedDrawableElement = flipPgenSource.getSelectedComp();
preempt = false;
// Check if mouse is in geographic extent
Coordinate loc = flipNCMapEditor.translateClick(anX, aY);
if ( loc == null || shiftDown ) return false;
if ( button == 1 ) {
/*
* create a new DrawableElement with reversed points based on the selectedDrawableElement
*/
AbstractDrawableComponent reversedDrawableElement = null;
if ( selectedDrawableElement instanceof Cloud ){
reversedDrawableElement = selectedDrawableElement.copy();
DrawableElement de = flipPgenSource.getNearestElement( loc, (Cloud)reversedDrawableElement );
if ( de != null && de instanceof Line ){
((Cloud)reversedDrawableElement).add(PgenToolUtils.createReversedDrawableElement(de));
((Cloud)reversedDrawableElement).remove(de);
}
else {
return false;
}
}
else {
reversedDrawableElement = PgenToolUtils.createReversedDrawableElement(selectedDrawableElement);
}
leftMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, reversedDrawableElement, loc);
flipNCMapEditor.refresh();
if ( selectedDrawableElement != null ) preempt = true;
//DrawableElement selectedDrawableElement = flipPgenSource.getSelectedDE();
AbstractDrawableComponent selectedDrawableElement = flipPgenSource.getSelectedComp();
if ( button == 1 ) {
/*
* create a new DrawableElement with reversed points based on the selectedDrawableElement
*/
AbstractDrawableComponent reversedDrawableElement = null;
if ( selectedDrawableElement instanceof Cloud ){
reversedDrawableElement = selectedDrawableElement.copy();
DrawableElement de = flipPgenSource.getNearestElement( loc, (Cloud)reversedDrawableElement );
if ( de != null && de instanceof Line ){
((Cloud)reversedDrawableElement).add(PgenToolUtils.createReversedDrawableElement(de));
((Cloud)reversedDrawableElement).remove(de);
}
else {
return false;
}
}
else {
reversedDrawableElement = PgenToolUtils.createReversedDrawableElement(selectedDrawableElement);
}
leftMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, reversedDrawableElement, loc);
flipNCMapEditor.refresh();
if ( selectedDrawableElement != null ) preempt = true;
}
else if ( button == 3 ) {
rightMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, flipNCMapEditor);
return true;
}
return preempt;
return preempt;
}
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if ( !isResourceEditable() || shiftDown ) return false;
return preempt;
}
/*
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if ( !isResourceEditable() || shiftDown ) return false;
return preempt;
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if (!isResourceEditable())
return false;
if (button == 3) {
AbstractDrawableComponent selectedDrawableElement = flipPgenSource.getSelectedComp();
rightMouseButtonDownHandler(flipPgenSource, selectedDrawableElement, flipNCMapEditor);
return true;
}
else {
return false;
}
}
/*
* If the selectedDrawableElement is valid, reverse the Coordinate points of the
* DrawableElement and then set the reversed points back to the DrawableElement. Otherwise,
* retrieve the nearest DrawableElement object using the current mouse location
@ -151,21 +170,21 @@ public class PgenFlipDrawingElement extends AbstractPgenTool {
* @return
*/
private void leftMouseButtonDownHandler(PgenResource thePgenSource,
AbstractDrawableComponent selectedDrawableElement,
AbstractDrawableComponent reversedDrawableElement,
Coordinate currentMouselocation) {
if ( selectedDrawableElement == null ) {
// Get the nearest element and set it as the selected element.
selectedDrawableElement = thePgenSource.getNearestComponent( currentMouselocation, flipFilter, true );
if(selectedDrawableElement == null)
return;
thePgenSource.setSelected( selectedDrawableElement );
} else {
thePgenSource.replaceElement(selectedDrawableElement, reversedDrawableElement);
thePgenSource.setSelected( reversedDrawableElement );
}
AbstractDrawableComponent selectedDrawableElement,
AbstractDrawableComponent reversedDrawableElement,
Coordinate currentMouselocation) {
if ( selectedDrawableElement == null ) {
// Get the nearest element and set it as the selected element.
selectedDrawableElement = thePgenSource.getNearestComponent( currentMouselocation, flipFilter, true );
if(selectedDrawableElement == null)
return;
thePgenSource.setSelected( selectedDrawableElement );
} else {
thePgenSource.replaceElement(selectedDrawableElement, reversedDrawableElement);
thePgenSource.setSelected( reversedDrawableElement );
}
}
/*
* If a valid selectedDrawableElement still exists, de-select the element,
* Otherwise, change the action mode to Selecting Mode from the Flip Mode
@ -175,20 +194,20 @@ public class PgenFlipDrawingElement extends AbstractPgenTool {
* @return
*/
private void rightMouseButtonDownHandler(PgenResource thePpgenSource,
// AbstractDrawableComponent selectedDrawableElement, NCMapEditor theNCMapEditor) {
AbstractDrawableComponent selectedDrawableElement, AbstractEditor theNCMapEditor) {
if ( selectedDrawableElement != null ){
// de-select element
thePpgenSource.removeSelected();
selectedDrawableElement = null;
theNCMapEditor.refresh();
}
else {
// set selecting mode
PgenUtil.setSelectingMode();
}
// AbstractDrawableComponent selectedDrawableElement, NCMapEditor theNCMapEditor) {
AbstractDrawableComponent selectedDrawableElement, AbstractEditor theNCMapEditor) {
if ( selectedDrawableElement != null ){
// de-select element
thePpgenSource.removeSelected();
selectedDrawableElement = null;
theNCMapEditor.refresh();
}
else {
// set selecting mode
PgenUtil.setSelectingMode();
}
}
}
}

View file

@ -110,13 +110,6 @@ public class PgenFromTool extends AbstractPgenDrawingTool {
*/
else if ( button == 3 ) {
/*
* return to Pgen Select mode
*/
drawingLayer.removeSelected();
PgenUtil.setSelectingMode();
mapEditor.refresh();
return true;
}
@ -131,6 +124,29 @@ public class PgenFromTool extends AbstractPgenDrawingTool {
if ( !isResourceEditable() ) return false;
return preempt;
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if (!isResourceEditable())
return false;
if (button == 3) {
/*
* return to Pgen Select mode
*/
drawingLayer.removeSelected();
PgenUtil.setSelectingMode();
mapEditor.refresh();
return true;
}
else {
return false;
}
}
}
}

View file

@ -212,73 +212,7 @@ public class PgenGfaDrawingTool extends AbstractPgenDrawingTool {
}
else if ( button == 3 ) {
//exit drawing text mode
if ( startGfaText ) {
startGfaText = false;
if ( ((Gfa)elem).getGfaTextCoordinate() == null ){
//if right click before adding the text
((Gfa)elem).setGfaTextCoordinate(loc);
drawingLayer.addElement(elem);
validateGfa( (Gfa)elem) ;
mapEditor.refresh();
points.clear();
}
else {
//change to selecting mode to move points
PgenUtil.setSelectingMode(elem);
elem = null;
return true;
}
}
if ( points.size() == 0 ) {
closeAttrDlg(attrDlg);
attrDlg = null;
drawingLayer.removeSelected((Gfa)elem);
elem = null;
PgenUtil.setSelectingMode();
}
else if ( points.size() < 2 ){
removeClearRefresh();
}
else {
//Use pgenType value to decide if the DrawableType should be TRACK or LINE
if (drawableType == DrawableType.GFA && points.size() == 2 ) {
removeClearRefresh();
return true;
}
if(!((GfaAttrDlg)attrDlg).validateRequiredFields()) return false;
if(((IGfa)attrDlg).getGfaFcstHr().indexOf("-") > -1) {
// snap
points = SnapUtil.getSnapWithStation(points,SnapUtil.VOR_STATION_LIST,10,16);
}
// create a new DrawableElement.
elem = def.create( drawableType, (IAttribute)attrDlg,
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
//set the hour filter
if ( PgenFilterDlg.isFilterDlgOpen()){
PgenFilterDlg.getInstance(null).setHourChkBox(((Gfa)elem).getForecastHours(), true);
}
//set from line
String vorText = Gfa.buildVorText( (Gfa)elem );
((Gfa)elem).setGfaVorText( vorText );
((GfaAttrDlg)attrDlg).setVorText( vorText );
startGfaText = true;
attrDlg.setAttrForDlg(attrDlg); // update the parameters in GfaAttrDlg
return true;
}
return true;
}
else if ( button == 2 ){
@ -404,6 +338,94 @@ public class PgenGfaDrawingTool extends AbstractPgenDrawingTool {
return false;
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if (!isResourceEditable() || shiftDown )
return false;
Coordinate loc = mapEditor.translateClick(x, y);
if ( loc == null ) return true;
if (button == 3) {
//exit drawing text mode
if ( startGfaText ) {
startGfaText = false;
if ( ((Gfa)elem).getGfaTextCoordinate() == null ){
//if right click before adding the text
((Gfa)elem).setGfaTextCoordinate(loc);
drawingLayer.addElement(elem);
validateGfa( (Gfa)elem) ;
mapEditor.refresh();
points.clear();
}
else {
//change to selecting mode to move points
PgenUtil.setSelectingMode(elem);
elem = null;
return true;
}
}
if ( points.size() == 0 ) {
closeAttrDlg(attrDlg);
attrDlg = null;
drawingLayer.removeSelected((Gfa)elem);
elem = null;
PgenUtil.setSelectingMode();
}
else if ( points.size() < 2 ){
removeClearRefresh();
}
else {
//Use pgenType value to decide if the DrawableType should be TRACK or LINE
DrawableType drawableType = getDrawableType(pgenType);
if (drawableType == DrawableType.GFA && points.size() == 2 ) {
removeClearRefresh();
return true;
}
if(!((GfaAttrDlg)attrDlg).validateRequiredFields()) return false;
if(((IGfa)attrDlg).getGfaFcstHr().indexOf("-") > -1) {
// snap
points = SnapUtil.getSnapWithStation(points,SnapUtil.VOR_STATION_LIST,10,16);
}
// create a new DrawableElement.
elem = def.create( drawableType, (IAttribute)attrDlg,
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
//set the hour filter
if ( PgenFilterDlg.isFilterDlgOpen()){
PgenFilterDlg.getInstance(null).setHourChkBox(((Gfa)elem).getForecastHours(), true);
}
//set from line
String vorText = Gfa.buildVorText( (Gfa)elem );
((Gfa)elem).setGfaVorText( vorText );
((GfaAttrDlg)attrDlg).setVorText( vorText );
startGfaText = true;
attrDlg.setAttrForDlg(attrDlg); // update the parameters in GfaAttrDlg
return true;
}
return true;
}
else {
return false;
}
}
public void clearPoints(){
points.clear();
}

View file

@ -108,7 +108,6 @@ public class PgenGfaFormatTool extends AbstractPgenDrawingTool {
} else if (button == 3) {
PgenUtil.setSelectingMode();
return true;
} else {
@ -120,6 +119,24 @@ public class PgenGfaFormatTool extends AbstractPgenDrawingTool {
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
return false;
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if (!isResourceEditable())
return false;
if (button == 3) {
PgenUtil.setSelectingMode();
return true;
}
else {
return false;
}
}
}
public StringBuilder generate(PgenResource drawingLayer,

View file

@ -43,6 +43,7 @@ import gov.noaa.nws.ncep.ui.pgen.gfa.Gfa;
* 04/11 #? B. Yin Re-factor IAttribute
* 11/12 #? J. Wu Added GFA
* 07/13 #? J. Wu Interpolate GFA's top/bottom
* 01/15 R5413 B. Yin Clear status when de-activate.
* </pre>
*
* @author S. Gilbert
@ -76,7 +77,20 @@ public class PgenInterpolationTool extends AbstractPgenDrawingTool {
verifySymbol = new Symbol(null, new Color[] { new Color(255,0,0) }, 1.0f, 1.0,
false, null, "Marker", "FILLED_BOX" );
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.tools.AbstractModalTool#deactivateTool()
*/
// @Override
public void deactivateTool() {
status = SELECT_STATUS.START;
super.deactivateTool();
}
/**
* Creates and returns the current mouse handler.
* @return
@ -190,53 +204,7 @@ public class PgenInterpolationTool extends AbstractPgenDrawingTool {
* Right mouse button pressed
*/
else if ( button == 3 ) {
switch (status) {
case START:
/*
* return to Pgen Select mode
*/
PgenUtil.setSelectingMode();
break;
case SELECTED_1:
/*
* Remove currently selected element from selected list
*/
drawingLayer.removeSelected();
status = SELECT_STATUS.START;
break;
case VERIFIED_1:
/*
* Remove currently verified element from selected list
*/
interpDlg.enableStartTime();
interpDlg.enableEndTime();
drawingLayer.removeSelected();
status = SELECT_STATUS.START;
break;
case SELECTED_2:
/*
* Remove second selected element from selected list
*/
drawingLayer.removeSelected( selectedEls.get(1) );
status = SELECT_STATUS.VERIFIED_1;
break;
case VERIFIED_2:
/*
* remove all elements from the selected list
*/
drawingLayer.removeSelected();
interpDlg.enableStartTime();
interpDlg.enableEndTime();
interpDlg.disarm(); // Disable Interpolation button
status = SELECT_STATUS.START;
break;
}
mapEditor.refresh();
//System.out.println("Button 3333333 status = "+status);
return true;
}
else {
@ -244,6 +212,66 @@ public class PgenInterpolationTool extends AbstractPgenDrawingTool {
}
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if (!isResourceEditable())
return false;
if (button == 3) {
switch (status) {
case START:
/*
* return to Pgen Select mode
*/
PgenUtil.setSelectingMode();
break;
case SELECTED_1:
/*
* Remove currently selected element from selected list
*/
drawingLayer.removeSelected();
status = SELECT_STATUS.START;
break;
case VERIFIED_1:
/*
* Remove currently verified element from selected list
*/
interpDlg.enableStartTime();
interpDlg.enableEndTime();
drawingLayer.removeSelected();
status = SELECT_STATUS.START;
break;
case SELECTED_2:
/*
* Remove second selected element from selected list
*/
drawingLayer.removeSelected( selectedEls.get(1) );
status = SELECT_STATUS.VERIFIED_1;
break;
case VERIFIED_2:
/*
* remove all elements from the selected list
*/
drawingLayer.removeSelected();
interpDlg.enableStartTime();
interpDlg.enableEndTime();
interpDlg.disarm(); // Disable Interpolation button
status = SELECT_STATUS.START;
break;
}
mapEditor.refresh();
//System.out.println("Button 3333333 status = "+status);
return true;
}
else {
return false;
}
}
}

View file

@ -14,6 +14,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
import com.vividsolutions.jts.geom.Coordinate;
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
//import gov.noaa.nws.ncep.ui.display.InputHandlerDefaultImpl;
import gov.noaa.nws.ncep.ui.pgen.attrdialog.JetAttrDlg;
import gov.noaa.nws.ncep.ui.pgen.display.IText.DisplayType;
@ -110,12 +111,7 @@ public class PgenJetBarbAddingHandler extends InputHandlerDefaultImpl {
}
else if ( button == 3 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
if ( jetDlg != null )((JetAttrDlg)jetDlg).closeBarbDlg();
prevTool.resetMouseHandler();
return true;
}
@ -157,6 +153,27 @@ public class PgenJetBarbAddingHandler extends InputHandlerDefaultImpl {
else return true;
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if ( !drawingLayer.isEditable() || shiftDown ) return false;
if (button == 3) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
if ( jetDlg != null )((JetAttrDlg)jetDlg).closeBarbDlg();
prevTool.resetMouseHandler();
return true;
}
else {
return false;
}
}
/**
* Create the wind info(barb and FL text) at location loc.
* @param loc

View file

@ -136,10 +136,6 @@ public class PgenJetBarbDeletingHandler extends InputHandlerDefaultImpl {
}
else if ( button == 3 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
prevTool.resetMouseHandler();
return true;
}
@ -151,6 +147,25 @@ public class PgenJetBarbDeletingHandler extends InputHandlerDefaultImpl {
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if ( !drawingLayer.isEditable() || shiftDown ) return false;
if (button == 3) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
prevTool.resetMouseHandler();
return true;
}
else {
return false;
}
}
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if ( !drawingLayer.isEditable() || shiftDown ) return false;

View file

@ -184,54 +184,7 @@ public class PgenJetDrawingTool extends PgenMultiPointDrawingTool
}
else if ( button == 3 ) {
if ( points.size() == 0 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
attrDlg.close();
attrDlg = null;
PgenUtil.setSelectingMode();
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
// create a new Jet.
elem = def.create( DrawableType.JET, (IAttribute)attrDlg,
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
jet = (Jet)elem;
jet.setSnapTool(new PgenSnapJet(drawingLayer.getDescriptor(), mapEditor, (JetAttrDlg)attrDlg));
// add the jet to PGEN resource
drawingLayer.addElement( jet );
//reset the jet line attributes
AbstractDrawableComponent adc = AttrSettings.getInstance().getSettings().get( pgenType );
if ( adc != null && adc instanceof Jet ){
((Jet)adc).getJetLine().update(attrDlg);
}
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
((JetAttrDlg)attrDlg).setJetDrawingTool(PgenJetDrawingTool.this);
((JetAttrDlg)attrDlg).enableBarbBtns(true);
}
return true;
return true;
}
else{
@ -282,5 +235,70 @@ public class PgenJetDrawingTool extends PgenMultiPointDrawingTool
if ( !isResourceEditable() || shiftDown ) return false;
else return true;
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if ( !drawingLayer.isEditable() || shiftDown ) return false;
if (button == 3) {
if ( points.size() == 0 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
attrDlg.close();
attrDlg = null;
PgenUtil.setSelectingMode();
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
// create a new Jet.
elem = def.create( DrawableType.JET, (IAttribute)attrDlg,
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
jet = (Jet)elem;
jet.setSnapTool(new PgenSnapJet(drawingLayer.getDescriptor(), mapEditor, (JetAttrDlg)attrDlg));
// add the jet to PGEN resource
drawingLayer.addElement( jet );
//reset the jet line attributes
AbstractDrawableComponent adc = AttrSettings.getInstance().getSettings().get( pgenType );
if ( adc != null && adc instanceof Jet ){
((Jet)adc).getJetLine().update(attrDlg);
}
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
((JetAttrDlg)attrDlg).setJetDrawingTool(PgenJetDrawingTool.this);
((JetAttrDlg)attrDlg).enableBarbBtns(true);
}
return true;
}
else {
return false;
}
}
}
}

View file

@ -95,10 +95,6 @@ public class PgenJetHashAddingHandler extends InputHandlerDefaultImpl {
}
else if ( button == 3 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
prevTool.resetMouseHandler();
return true;
}
@ -109,7 +105,27 @@ public class PgenJetHashAddingHandler extends InputHandlerDefaultImpl {
}
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if ( !drawingLayer.isEditable() || shiftDown ) return false;
if (button == 3) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
prevTool.resetMouseHandler();
return true;
}
else {
return false;
}
}
/*
* (non-Javadoc)
*

View file

@ -125,11 +125,7 @@ public class PgenJetHashDeletingHandler extends InputHandlerDefaultImpl {
}
else if ( button == 3 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
prevTool.resetMouseHandler();
return true;
}
@ -140,7 +136,27 @@ public class PgenJetHashDeletingHandler extends InputHandlerDefaultImpl {
}
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if ( !drawingLayer.isEditable() || shiftDown ) return false;
if (button == 3) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
prevTool.resetMouseHandler();
return true;
}
else {
return false;
}
}
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if ( !drawingLayer.isEditable() || shiftDown ) return false;

View file

@ -128,15 +128,6 @@ public class PgenKinkLineDrawingTool extends AbstractPgenDrawingTool {
} else if (button == 3) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
if (points.size() == 0) {
PgenUtil.setSelectingMode();
} else {
points.clear();
}
return true;
} else if (button == 2) {
@ -150,7 +141,32 @@ public class PgenKinkLineDrawingTool extends AbstractPgenDrawingTool {
}
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if ( !drawingLayer.isEditable() || shiftDown ) return false;
if (button == 3) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
if (points.size() == 0) {
PgenUtil.setSelectingMode();
} else {
points.clear();
}
return true;
}
else {
return false;
}
}
/*
* (non-Javadoc)
*

View file

@ -8,6 +8,7 @@
package gov.noaa.nws.ncep.ui.pgen.tools;
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
import gov.noaa.nws.ncep.ui.pgen.attrdialog.AttrDlg;
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
@ -153,8 +154,6 @@ public class PgenLabeledLineDelHandler extends InputHandlerDefaultImpl {
}
else if ( button == 3 ) {
dlg.resetLabeledLineBtns();
prevTool.resetMouseHandler();
return true;
}
@ -165,7 +164,24 @@ public class PgenLabeledLineDelHandler extends InputHandlerDefaultImpl {
}
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if ( !drawingLayer.isEditable() || shiftDown ) return false;
if (button == 3) {
dlg.resetLabeledLineBtns();
prevTool.resetMouseHandler();
return true;
}
else {
return false;
}
}
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if ( !drawingLayer.isEditable() || shiftDown ) return false;

View file

@ -181,82 +181,6 @@ public class PgenLabeledLineDrawingTool extends AbstractPgenDrawingTool
return true;
} else if (button == 3) {
if (points.size() == 0) {
if (attrDlg.isAddLineMode()) {
// add mode
attrDlg.resetLabeledLineBtns();
} else {
// clean up
closeAttrDlg(attrDlg, pgenType);
attrDlg = null;
PgenUtil.setSelectingMode();
}
labeledLine = null;
} else if (points.size() < 2) {
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
} else {
// add the labeled line to PGEN resource
if (attrDlg.isAddLineMode()) {
elem = def.createLabeledLine(pgenCategory, pgenType,
(IAttribute) attrDlg, points, null,
drawingLayer.getActiveLayer());
drawingLayer.addElement(elem);
labeledLine = (LabeledLine) elem;
AttrSettings.getInstance().setSettings(elem);
}
if ("CCFP_SIGMET".equals(pgenType)) {
elem = def.createLabeledLine(pgenCategory, pgenType,
(IAttribute) attrDlg, points, null,
drawingLayer.getActiveLayer());
drawingLayer.addElement(elem);
labeledLine = (LabeledLine) elem;
if (ccdlg.isAreaType()) {// avoid 2 Sigmet elements
// issue
// If auto placement is on, add label directly.
if (!PgenUtil.getTextAutoPlacement()) {
/*
* return true;avoid right click cause no
* showing issue
*/
ccfpTxtFlag = true;
setAddingLabelHandler();
} else {
Text t = new Text();
Label lbl = new Label(t);
lbl.setParent(labeledLine);
setCcfpText(
labeledLine,
((gov.noaa.nws.ncep.ui.pgen.sigmet.Ccfp) labeledLine)
.getAreaLine(), t, lbl);
labeledLine.addLabel(lbl);
}
}
}
drawingLayer.removeGhostLine();
if (!ccfpTxtFlag)
points.clear();
mapEditor.refresh();
}
return true;
} else if (button == 2) {
@ -335,6 +259,98 @@ public class PgenLabeledLineDrawingTool extends AbstractPgenDrawingTool
points.clear();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int, int)
*/
@Override
public boolean handleMouseUp(int x, int y, int mouseButton) {
if ( !isResourceEditable() || shiftDown ) return false;
if ( mouseButton == 3 ){
if (points.size() == 0) {
if (attrDlg.isAddLineMode()) {
// add mode
attrDlg.resetLabeledLineBtns();
} else {
// clean up
closeAttrDlg(attrDlg, pgenType);
attrDlg = null;
PgenUtil.setSelectingMode();
}
labeledLine = null;
} else if (points.size() < 2) {
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
} else {
// add the labeled line to PGEN resource
if (attrDlg.isAddLineMode()) {
elem = def.createLabeledLine(pgenCategory, pgenType,
(IAttribute) attrDlg, points, null,
drawingLayer.getActiveLayer());
drawingLayer.addElement(elem);
labeledLine = (LabeledLine) elem;
AttrSettings.getInstance().setSettings(elem);
}
if ("CCFP_SIGMET".equals(pgenType)) {
elem = def.createLabeledLine(pgenCategory, pgenType,
(IAttribute) attrDlg, points, null,
drawingLayer.getActiveLayer());
drawingLayer.addElement(elem);
labeledLine = (LabeledLine) elem;
if (ccdlg.isAreaType()) {// avoid 2 Sigmet elements
// issue
// If auto placement is on, add label directly.
if (!PgenUtil.getTextAutoPlacement()) {
/*
* return true;avoid right click cause no
* showing issue
*/
ccfpTxtFlag = true;
setAddingLabelHandler();
} else {
Text t = new Text();
Label lbl = new Label(t);
lbl.setParent(labeledLine);
setCcfpText(
labeledLine,
((gov.noaa.nws.ncep.ui.pgen.sigmet.Ccfp) labeledLine)
.getAreaLine(), t, lbl);
labeledLine.addLabel(lbl);
}
}
}
drawingLayer.removeGhostLine();
if (!ccfpTxtFlag)
points.clear();
mapEditor.refresh();
}
return true;
}
else {
return false;
}
}
/**
* Returns the Labeled Line in the current layer with input
* type(Turb/Cloud).

View file

@ -185,57 +185,7 @@ public class PgenLabeledLineModifyTool extends PgenSelectingTool implements
return false;
}
//clean up
else if ( button == 3 ) {
if ( attrDlg.isAddLineMode()){
if ( points.size() == 0 ) {
attrDlg.resetLabeledLineBtns();
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
//add line to labeled line collection
// LabeledLine newll = def.createLabeledLine( labeledLine.getPgenCategory(), labeledLine.getPgenType(),
// (IAttribute)attrDlg, points, labeledLine.copy(), drawingLayer.getActiveLayer());
LabeledLine newll = def.createLabeledLine( pgenCategory, PgenLabeledLineModifyTool.this.pgenType, (IAttribute)attrDlg,
points, null, drawingLayer.getActiveLayer());
// drawingLayer.replaceElement(labeledLine, newll);
drawingLayer.addElement( newll );
labeledLine = newll;
drawingLayer.removeGhostLine();
points.clear();
//re-set selected
// resetSelected();
drawingLayer.setSelected(newll);
mapEditor.refresh();
}
}
else {
// Close the attribute dialog and do the cleanup.
if ( attrDlg != null ) {
attrDlg.close();
}
attrDlg = null;
drawingLayer.removeGhostLine();
ptSelected2 = false; ptSelected = false;
drawingLayer.removeSelected();
mapEditor.refresh();
PgenUtil.setSelectingMode();
}
return true;
}
@ -510,6 +460,58 @@ public class PgenLabeledLineModifyTool extends PgenSelectingTool implements
}
}
else if ( button ==3 ) {
if ( attrDlg.isAddLineMode()){
if ( points.size() == 0 ) {
attrDlg.resetLabeledLineBtns();
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
//add line to labeled line collection
// LabeledLine newll = def.createLabeledLine( labeledLine.getPgenCategory(), labeledLine.getPgenType(),
// (IAttribute)attrDlg, points, labeledLine.copy(), drawingLayer.getActiveLayer());
LabeledLine newll = def.createLabeledLine( pgenCategory, PgenLabeledLineModifyTool.this.pgenType, (IAttribute)attrDlg,
points, null, drawingLayer.getActiveLayer());
// drawingLayer.replaceElement(labeledLine, newll);
drawingLayer.addElement( newll );
labeledLine = newll;
drawingLayer.removeGhostLine();
points.clear();
//re-set selected
// resetSelected();
drawingLayer.setSelected(newll);
mapEditor.refresh();
}
}
else {
// Close the attribute dialog and do the cleanup.
if ( attrDlg != null ) {
attrDlg.close();
}
attrDlg = null;
drawingLayer.removeGhostLine();
ptSelected2 = false; ptSelected = false;
drawingLayer.removeSelected();
mapEditor.refresh();
PgenUtil.setSelectingMode();
}
return true;
}
//make sure the arrow line won't go through the text box.
if(labeledLine instanceof Ccfp) ((Ccfp)labeledLine).moveText2Last();

View file

@ -177,6 +177,67 @@ public class PgenModifyTool extends AbstractPgenTool {
} else if (button == 3) {
return true;
}
else {
return false;
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseMove(int,
* int)
*/
@Override
public boolean handleMouseMove(int x, int y) {
if (!isResourceEditable())
return false;
// Check if mouse is in geographic extent
Coordinate loc = mapEditor.translateClick(x, y);
if (loc == null)
return false;
// create the ghost element and put it in the drawing layer
if (clickPts != null && clickPts.size() >= 1) {
ArrayList<Coordinate> newPts = new ArrayList<Coordinate>(
clickPts);
newPts.add(loc);
pml.setClickPts(latlonToPixel(newPts
.toArray(new Coordinate[newPts.size()])));
ModifyLine();
ghostEl.setColors(new Color[] { ghostColor,
new java.awt.Color(255, 255, 255) });
drawingLayer.setGhostLine(ghostEl);
mapEditor.refresh();
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int,
* int)
*/
@Override
public boolean handleMouseUp(int x, int y, int button) {
if (!isResourceEditable() || shiftDown)
return false;
if ( button == 3 ) {
if (drawingLayer.getSelectedDE() != null) {
if (clickPts != null && !clickPts.isEmpty()) {
@ -265,68 +326,15 @@ public class PgenModifyTool extends AbstractPgenTool {
PgenUtil.setSelectingMode();
}
return true;
}
else {
return false;
}
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseMove(int,
* int)
*/
@Override
public boolean handleMouseMove(int x, int y) {
if (!isResourceEditable())
return false;
// Check if mouse is in geographic extent
Coordinate loc = mapEditor.translateClick(x, y);
if (loc == null)
return false;
// create the ghost element and put it in the drawing layer
if (clickPts != null && clickPts.size() >= 1) {
ArrayList<Coordinate> newPts = new ArrayList<Coordinate>(
clickPts);
newPts.add(loc);
pml.setClickPts(latlonToPixel(newPts
.toArray(new Coordinate[newPts.size()])));
ModifyLine();
ghostEl.setColors(new Color[] { ghostColor,
new java.awt.Color(255, 255, 255) });
drawingLayer.setGhostLine(ghostEl);
mapEditor.refresh();
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.input.IInputHandler#handleMouseUp(int, int,
* int)
*/
@Override
public boolean handleMouseUp(int x, int y, int button) {
return false;
}
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if (!isResourceEditable() || shiftDown)

View file

@ -13,6 +13,7 @@ import java.util.Iterator;
import com.raytheon.uf.viz.core.rsc.IInputHandler;
import com.vividsolutions.jts.geom.Coordinate;
import gov.noaa.nws.ncep.ui.pgen.PgenUtil;
import gov.noaa.nws.ncep.ui.pgen.elements.AbstractDrawableComponent;
import gov.noaa.nws.ncep.ui.pgen.elements.DrawableElement;
import gov.noaa.nws.ncep.ui.pgen.elements.WatchBox;
@ -74,9 +75,27 @@ public class PgenMoveElement extends PgenCopyElement {
@Override
public boolean handleMouseUp(int x, int y, int button) {
if ( !isResourceEditable() || shiftDown || simulate ) return false;
if ( ghostEl != null ) {
if ( !isResourceEditable() || shiftDown || simulate ) return false;
if ( button == 3 ) {
if ( drawingLayer.getSelectedComp() != null ){
// de-select element
drawingLayer.removeSelected();
drawingLayer.removeGhostLine();
ghostEl = null;
mapEditor.refresh();
}
else {
// set selecting mode
PgenUtil.setSelectingMode();
}
return true;
}
if ( ghostEl != null ) {
AbstractDrawableComponent comp = drawingLayer.getSelectedComp();
// reset color for the el and add it to PGEN resource

View file

@ -198,72 +198,7 @@ public class PgenMultiPointDrawingTool extends AbstractPgenDrawingTool {
}
else if ( button == 3 ) {
if ( points.size() == 0 ) {
closeAttrDlg(attrDlg, pgenType);
attrDlg = null;
PgenUtil.setSelectingMode();
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
//Use pgenType value to decide if the DrawableType should be TRACK or LINE
DrawableType drawableType = getDrawableType(pgenType);
// log.debug("PgenMultiPointDrawingTool, before call def.create, drawableType=" + drawableType + ", pgenType="+pgenType);
/*if(drawableType == DrawableType.CONV_SIGMET && ("NCON_SIGMET".equals(pgenType))) //"CONV_SIGMET".equals(pgenType)||
points = SnapUtil.getSnapWithStation(points, SnapUtil.VOR_STATION_LIST, 10, 8);*/
// create a new DrawableElement.
elem = def.create( drawableType, (IAttribute)attrDlg,
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
attrDlg.setDrawableElement((DrawableElement)elem);
AttrSettings.getInstance().setSettings((DrawableElement)elem);
if("CCFP_SIGMET".equals(pgenType)){//avoid 2 Sigmet elements issue
ccfpTxtFlag = true;
return true;//avoid right click cause no showing issue
}
else if ( elem != null && elem.getPgenCategory().equalsIgnoreCase("Front")
&& ((FrontAttrDlg)attrDlg).labelEnabled()){
DECollection dec = new DECollection("labeledFront");
dec.setPgenCategory(pgenCategory);
dec.setPgenType(pgenType);
dec.addElement(elem);
drawingLayer.addElement(dec);
PgenUtil.setDrawingTextMode( true, ((FrontAttrDlg)attrDlg).useFrontColor(), "", dec );
elem = null;
}else{
// add the product to PGEN resource
drawingLayer.addElement( elem );
}
if(isTrackElement(drawableType)) {
displayTrackExtrapPointInfoDlg((TrackAttrDlg)attrDlg, (Track)elem);
}
drawingLayer.removeGhostLine();
if( ! ccfpTxtFlag)
points.clear();
mapEditor.refresh();
}
return true;
}
@ -280,6 +215,87 @@ public class PgenMultiPointDrawingTool extends AbstractPgenDrawingTool {
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if ( !drawingLayer.isEditable() || shiftDown ) return false;
if (button == 3) {
if ( points.size() == 0 ) {
closeAttrDlg(attrDlg, pgenType);
attrDlg = null;
PgenUtil.setSelectingMode();
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
//Use pgenType value to decide if the DrawableType should be TRACK or LINE
DrawableType drawableType = getDrawableType(pgenType);
// log.debug("PgenMultiPointDrawingTool, before call def.create, drawableType=" + drawableType + ", pgenType="+pgenType);
/*if(drawableType == DrawableType.CONV_SIGMET && ("NCON_SIGMET".equals(pgenType))) //"CONV_SIGMET".equals(pgenType)||
points = SnapUtil.getSnapWithStation(points, SnapUtil.VOR_STATION_LIST, 10, 8);*/
// create a new DrawableElement.
elem = def.create( drawableType, (IAttribute)attrDlg,
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
attrDlg.setDrawableElement((DrawableElement)elem);
AttrSettings.getInstance().setSettings((DrawableElement)elem);
if("CCFP_SIGMET".equals(pgenType)){//avoid 2 Sigmet elements issue
ccfpTxtFlag = true;
return true;//avoid right click cause no showing issue
}
else if ( elem != null && elem.getPgenCategory().equalsIgnoreCase("Front")
&& ((FrontAttrDlg)attrDlg).labelEnabled()){
DECollection dec = new DECollection("labeledFront");
dec.setPgenCategory(pgenCategory);
dec.setPgenType(pgenType);
dec.addElement(elem);
drawingLayer.addElement(dec);
PgenUtil.setDrawingTextMode( true, ((FrontAttrDlg)attrDlg).useFrontColor(), "", dec );
elem = null;
}else{
// add the product to PGEN resource
drawingLayer.addElement( elem );
}
if(isTrackElement(drawableType)) {
displayTrackExtrapPointInfoDlg((TrackAttrDlg)attrDlg, (Track)elem);
}
drawingLayer.removeGhostLine();
if( ! ccfpTxtFlag)
points.clear();
mapEditor.refresh();
}
return true;
}
else {
return false;
}
}
@Override
public boolean handleMouseDownMove(int aX, int aY, int button) {
if ( !isResourceEditable() || shiftDown ) return false;

View file

@ -156,7 +156,7 @@ public class PgenMultiSelectTool extends AbstractPgenDrawingTool {
// Keep in multi-selecting mode
// PgenUtil.setSelectingMode();
}
return false;
return true;
} else {

View file

@ -166,7 +166,6 @@ public class PgenOutlookDrawingTool extends AbstractPgenDrawingTool {
public boolean handleMouseDown(int anX, int aY, int button) {
if ( !isResourceEditable() ) return false;
DECollection dec = null;
// Check if mouse is in geographic extent
Coordinate loc = mapEditor.translateClick(anX, aY);
@ -181,77 +180,6 @@ public class PgenOutlookDrawingTool extends AbstractPgenDrawingTool {
}
else if ( button == 3 ) {
if ( points.size() == 0 ) {
attrDlg.close();
attrDlg = null;
PgenUtil.setSelectingMode();
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
String lineType = ((OutlookAttrDlg)attrDlg).getLineType();
// create a new DrawableElement.
// if (((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("TROPICAL")
// || ((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("FLOOD"))
// elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg,
// "Lines", "LINE_SOLID", points, drawingLayer.getActiveLayer());
// else
elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg,
"Lines", lineType, points, drawingLayer.getActiveLayer());
//if (((IMultiPoint)attrDlg).getFillFlag()) ((Line)elem).setFillPattern(attrDlg.getFillPattern());
dec = new DECollection(Outlook.OUTLOOK_LABELED_LINE);
dec.setPgenCategory("MET");
otlk = getCurrentOtlk(((OutlookAttrDlg)attrDlg).getOutlookType());
Outlook newOtlk = def.createOutlook( ((OutlookAttrDlg)attrDlg).getOutlookType(),
elem, dec, otlk );
newOtlk.update( (OutlookAttrDlg)attrDlg );
// create a new outlook
if ( otlk == null || !otlk.getPgenType().equalsIgnoreCase(((OutlookAttrDlg)attrDlg).getOutlookType()) ){
drawingLayer.addElement( newOtlk );
}
else {
drawingLayer.replaceElement(otlk, newOtlk);
}
otlk = newOtlk;
attrDlg.setDrawableElement(elem);
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
//set TextDrawingtool or SymbolDrawingTool
//bring up the text or the symbol dialog
if ( ((OutlookAttrDlg)attrDlg).addLabel() ) {
if ( ((OutlookAttrDlg)attrDlg).addText() ) {
lbl = ((OutlookAttrDlg)attrDlg).getLblTxt();
PgenUtil.setDrawingTextMode( true, ((OutlookAttrDlg)attrDlg).useLineColor(),
lbl, dec );
}
else if ( ((OutlookAttrDlg)attrDlg).addSymbol() ) {
PgenUtil.setDrawingSymbolMode( ((OutlookAttrDlg)attrDlg).getSymbolCat(),
((OutlookAttrDlg)attrDlg).getSymbolType(),
((OutlookAttrDlg)attrDlg).useLineColor(), dec );
}
}
}
return true;
}
@ -267,7 +195,94 @@ public class PgenOutlookDrawingTool extends AbstractPgenDrawingTool {
}
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if ( !drawingLayer.isEditable() || shiftDown ) return false;
if (button == 3) {
DECollection dec = null;
if ( points.size() == 0 ) {
attrDlg.close();
attrDlg = null;
PgenUtil.setSelectingMode();
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
String lineType = ((OutlookAttrDlg)attrDlg).getLineType();
// create a new DrawableElement.
// if (((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("TROPICAL")
// || ((OutlookAttrDlg)attrDlg).getOutlookType().equalsIgnoreCase("FLOOD"))
// elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg,
// "Lines", "LINE_SOLID", points, drawingLayer.getActiveLayer());
// else
elem = (DrawableElement)def.create( DrawableType.LINE, (IAttribute)attrDlg,
"Lines", lineType, points, drawingLayer.getActiveLayer());
//if (((IMultiPoint)attrDlg).getFillFlag()) ((Line)elem).setFillPattern(attrDlg.getFillPattern());
dec = new DECollection(Outlook.OUTLOOK_LABELED_LINE);
dec.setPgenCategory("MET");
otlk = getCurrentOtlk(((OutlookAttrDlg)attrDlg).getOutlookType());
Outlook newOtlk = def.createOutlook( ((OutlookAttrDlg)attrDlg).getOutlookType(),
elem, dec, otlk );
newOtlk.update( (OutlookAttrDlg)attrDlg );
// create a new outlook
if ( otlk == null || !otlk.getPgenType().equalsIgnoreCase(((OutlookAttrDlg)attrDlg).getOutlookType()) ){
drawingLayer.addElement( newOtlk );
}
else {
drawingLayer.replaceElement(otlk, newOtlk);
}
otlk = newOtlk;
attrDlg.setDrawableElement(elem);
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
//set TextDrawingtool or SymbolDrawingTool
//bring up the text or the symbol dialog
if ( ((OutlookAttrDlg)attrDlg).addLabel() ) {
if ( ((OutlookAttrDlg)attrDlg).addText() ) {
lbl = ((OutlookAttrDlg)attrDlg).getLblTxt();
PgenUtil.setDrawingTextMode( true, ((OutlookAttrDlg)attrDlg).useLineColor(),
lbl, dec );
}
else if ( ((OutlookAttrDlg)attrDlg).addSymbol() ) {
PgenUtil.setDrawingSymbolMode( ((OutlookAttrDlg)attrDlg).getSymbolCat(),
((OutlookAttrDlg)attrDlg).getSymbolType(),
((OutlookAttrDlg)attrDlg).useLineColor(), dec );
}
}
}
return true;
}
else {
return false;
}
}
/*
* (non-Javadoc)
*

View file

@ -162,10 +162,6 @@ public class PgenOutlookSetCont extends AbstractPgenDrawingTool{
}
else if ( button == 3 ) {
drawingLayer.removeSelected();
PgenUtil.loadOutlookDrawingTool();
dec = null;
return true;
}
@ -176,7 +172,26 @@ public class PgenOutlookSetCont extends AbstractPgenDrawingTool{
}
}
/*
* overrides the function in selecting tool
*/
@Override
public boolean handleMouseUp(int x, int y, int button){
if ( !drawingLayer.isEditable() || shiftDown ) return false;
if (button == 3) {
drawingLayer.removeSelected();
PgenUtil.loadOutlookDrawingTool();
dec = null;
return true;
}
else {
return false;
}
}
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if ( !isResourceEditable() ) return false;

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