Merge tag 'OB_14.4.1-13m' into omaha_15.1.1

14.4.1-13


Former-commit-id: ea76883b615967a79e8c9d0ee16accebd210ee0b
This commit is contained in:
Steve Harris 2015-02-20 13:17:47 -06:00
commit 266e2af93a
89 changed files with 2797 additions and 1469 deletions

View file

@ -37,13 +37,16 @@ import com.raytheon.rcm.config.RadarConfig;
* 2009-04-22 #1693 D. Friedman Initial checkin
* ...
* 2014-02-03 DR 14762 D. Friedman Add Category enum
* 2015-02-11 DR 17092 D. Friedman Handle NDM cronOTRs.xml updates.
* </pre>
*
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ConfigEvent {
public static enum Category { GLOBAL_CONFIG, RADAR_CONFIG, PROD_DISTRIBUTION, NATIONAL_RPS_LISTS }
public static enum Category {
GLOBAL_CONFIG, RADAR_CONFIG, PROD_DISTRIBUTION, NATIONAL_RPS_LISTS, CRON_OTRS
}
private String radarID; // null indicates global configuration change.
private RadarConfig oldConfig;

View file

@ -27,6 +27,7 @@ import org.quartz.impl.StdSchedulerFactory;
import com.raytheon.rcm.config.Configuration;
import com.raytheon.rcm.config.RadarConfig;
import com.raytheon.rcm.config.Util;
import com.raytheon.rcm.event.ConfigEvent;
import com.raytheon.rcm.event.OtrEvent;
import com.raytheon.rcm.event.RadarEventAdapter;
import com.raytheon.rcm.event.RadarEventListener;
@ -37,6 +38,19 @@ import com.raytheon.rcm.request.Request;
import com.raytheon.rcm.server.Log;
import com.raytheon.rcm.server.RadarServer;
/**
* Represents the standard configuration model of the AWIPS 2 RadarServer.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* ...
* 2015-02-11 DR 17092 D. Friedman Handle NDM cronOTRs.xml updates.
* </pre>
*
*/
public class RequestScheduler extends RadarEventAdapter {
// Quartz job detail properties
@ -46,8 +60,6 @@ public class RequestScheduler extends RadarEventAdapter {
private RadarServer radarServer;
private OTRManager otrManager;
private CronOTRConfiguration cronConfig;
private Scheduler scheduler;
private Random random = new Random();
@ -70,16 +82,29 @@ public class RequestScheduler extends RadarEventAdapter {
OTRManager.class.getSimpleName());
return;
}
loadConfiguration();
}
private synchronized void loadConfiguration() {
if (scheduler != null) {
try {
scheduler.shutdown();
} catch (SchedulerException e) {
Log.errorf("Error stopping cron-OTR scheduler: %s", e);
}
}
try {
scheduler = StdSchedulerFactory.getDefaultScheduler();
scheduler.start();
} catch (SchedulerException e) {
Log.errorf("Failed to start cron-OTR scheduler: %s", e);
Log.errorf("Failed to start cron-OTR scheduler: %s", e);
scheduler = null;
}
if (scheduler != null) {
CronOTRConfiguration cronConfig = null;
InputStream ins = null;
try {
ins = radarServer.getConfiguration().getDropInData("cronOTRs.xml");
@ -91,7 +116,7 @@ public class RequestScheduler extends RadarEventAdapter {
} catch (Exception e) {
Log.errorf("Error loading cron-OTR configuration: %s", e);
}
if (cronConfig != null) {
int jobIndex = 1; // Used to generate unique JobDetail names
for (CronOTR cronOTR : cronConfig.cronOTRList) {
@ -104,7 +129,7 @@ public class RequestScheduler extends RadarEventAdapter {
cronOTR.getCron(), e);
continue;
}
JobDetail jd = new JobDetail(name, null, CronOTRJob.class);
JobDataMap jdm = jd.getJobDataMap();
jdm.put(SCHEDULER, this);
@ -112,10 +137,10 @@ public class RequestScheduler extends RadarEventAdapter {
try {
scheduler.scheduleJob(jd, trigger);
} catch (Exception e) {
Log.errorf("Error schedule cron \"%s\": %s",
Log.errorf("Error scheduling cron \"%s\": %s",
cronOTR.getCron(), e);
}
jobIndex++;
}
}
@ -179,7 +204,13 @@ public class RequestScheduler extends RadarEventAdapter {
runCron(cronOTR);
}
public void handleConfigEvent(ConfigEvent event) {
if (event.getCategory() == ConfigEvent.Category.CRON_OTRS) {
loadConfiguration();
}
}
/**
* This class declared public only so that it can be instantiated by
* Quartz.

View file

@ -40,6 +40,8 @@ import com.raytheon.rcm.config.LinkType;
import com.raytheon.rcm.config.RadarConfig;
import com.raytheon.rcm.config.StandardProductDistInfoDB;
import com.raytheon.rcm.config.awips1.Awips1ConfigProvider;
import com.raytheon.rcm.event.ConfigEvent;
import com.raytheon.rcm.event.RadarEventListener;
import com.raytheon.rcm.server.Log;
@ -54,6 +56,7 @@ import com.raytheon.rcm.server.Log;
* ------------ ---------- ----------- --------------------------
* ...
* 2014-02-03 DR 14762 D. Friedman Handle updated NDM config files.
* 2015-02-11 DR 17092 D. Friedman Handle NDM cronOTRs.xml updates.
* </pre>
*
*/
@ -62,6 +65,7 @@ public class StandardConfigProvider implements ConfigurationProvider {
private static String WSR_88D_PROD_LIST_NAME = "prodList.txt";
private static String TDWR__PROD_LIST_NAME = "tdwrProdList.txt";
private static String WMO_SITE_INFO_NAME = "wmoSiteInfo.txt";
private static String CRON_OTRS_NAME = "cronOTRs.xml";
private static JAXBContext jaxbContext;
private static Unmarshaller u;
@ -266,6 +270,12 @@ public class StandardConfigProvider implements ConfigurationProvider {
loadProdListDB();
} else if (WMO_SITE_INFO_NAME.equals(name)) {
updateRegionCode();
} else if (CRON_OTRS_NAME.equals(name)) {
RadarEventListener target = config.getConfigurationEventTarget();
if (target != null) {
ConfigEvent ev = new ConfigEvent(ConfigEvent.Category.CRON_OTRS);
target.handleConfigEvent(ev);
}
} else if (Pattern.matches("^rps-.*OP.*$", name)) {
config.notifyNationalRpsLists();
} else {

View file

@ -20,7 +20,7 @@
##
export INIT_MEM=512 # in Meg
export MAX_MEM=896 # in Meg
export MAX_MEM=1280 # in Meg
export EDEX_DEBUG_PORT=5006
export EDEX_JMX_PORT=1617

View file

@ -19,7 +19,7 @@
# further licensing information.
##
export INIT_MEM=256 # in Meg
export MAX_MEM=1792 # in Meg
export MAX_MEM=1856 # in Meg
export METADATA_POOL_MAX=25
export EDEX_DEBUG_PORT=5008

View file

@ -19,7 +19,7 @@
# further licensing information.
##
export INIT_MEM=128 # in Meg
export MAX_MEM=512 # in Meg
export MAX_MEM=544 # in Meg
export METADATA_POOL_MAX=10
export EDEX_DEBUG_PORT=5007

View file

@ -19,7 +19,7 @@
# further licensing information.
##
export INIT_MEM=128 # in Meg
export MAX_MEM=2048 # in Meg
export MAX_MEM=2144 # in Meg
export SERIALIZE_POOL_MAX_SIZE=24
export SERIALIZE_STREAM_INIT_SIZE_MB=2

View file

@ -59,7 +59,7 @@
<contribute xsi:type="command"
commandId="com.raytheon.viz.awipstools.lapstools"
menuText="LAPS tools..." />
menuText="LAPS tools..." id="lapsTools" />
<!-- TODO move into points plugin somehow -->
<contribute xsi:type="bundleItem" file="bundles/tools/Points.xml"

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

@ -395,7 +395,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)
#---------------------------------------------------------------------------
#
@ -2069,7 +2069,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

@ -32,6 +32,10 @@
<constructor-arg value="wmoSiteInfo.txt" />
<constructor-arg ref="radarServerNdmListener" />
</bean>
<bean factory-bean="ndmProc" factory-method="registerListener">
<constructor-arg value="cronOTRs.xml" />
<constructor-arg ref="radarServerNdmListener" />
</bean>
<camelContext id="rpgenvdata-camel" xmlns="http://camel.apache.org/schema/spring" errorHandlerRef="errorHandler">

View file

@ -266,6 +266,7 @@ insert into afoslookup (origin, ccc) values ('KJEF','STL');
insert into afoslookup (origin, ccc) values ('KJFK','NYC');
insert into afoslookup (origin, ccc) values ('KJKL','SDF');
insert into afoslookup (origin, ccc) values ('KKCI','MKC');
insert into afoslookup (origin, ccc) values ('KKEY','MIA');
insert into afoslookup (origin, ccc) values ('KKRF','MKC');
insert into afoslookup (origin, ccc) values ('KLAF','IND');
insert into afoslookup (origin, ccc) values ('KLAN','ARB');

View file

@ -150,19 +150,16 @@ public final class RunReportAlarmSrv {
private static void saveProductToTextDb(final String productText,
final String productId) throws Exception {
TextDB textdb = new TextDB();
long statusCode = textdb.writeProduct(productId, productText, true,
long insertTime = textdb.writeProduct(productId, productText, true,
null);
// Set the current time and send product alarm alert.
Date d = new Date(System.currentTimeMillis());
d.setTime(statusCode);
AlarmAlertUtil.sendProductAlarmAlert(productId,
String.valueOf(d.getTime()),
true);
if (statusCode != Long.MIN_VALUE) {
statusHandler.info("Product successfully sent");
if (insertTime != Long.MIN_VALUE) {
// Set the write time and send product alarm alert.
Date d = new Date();
d.setTime(insertTime);
AlarmAlertUtil.sendProductAlarmAlert(productId, d, true);
statusHandler.info("Saved product to textdb successfully.");
} else {
statusHandler.error("Product send error detected.");
statusHandler.error("Error detected saving product to textdb.");
}
}
}

View file

@ -54,6 +54,7 @@
<property name="gfe.suite.home" value="${install.dir}" />
<property name="gfe.suite.bin" value="${install.dir}/bin" />
<property name="gfe.suite.hti" value="${install.dir}/hti" />
<property name="gfe.suite.nwps" value="${install.dir}/nwps" />
<!-- Create the copy filter -->
<!-- filter set -->
@ -68,8 +69,10 @@
<echo message="deploy.client=${deploy.client}" />
<mkdir dir="${gfe.suite.bin}"/>
<mkdir dir="${gfe.suite.hti}"/>
<mkdir dir="${gfe.suite.nwps}"/>
<antcall target="-deploy.cli.common"/>
<antcall target="-deploy.hti"/>
<antcall target="-deploy.nwps"/>
<antcall target="-deploy.svcBackup"/>
<!-- <antcall target="-deploy.cli.client"/> -->
<antcall target="-set.permissions"/>
@ -101,6 +104,16 @@
</copy>
</target>
<target name="-deploy.nwps"
description="Deploys NWPS software to a specific directory">
<!-- copy the CLI tools to the deploy directory -->
<echo message="Copying in NWPS files" />
<copy todir="${gfe.suite.nwps}" overwrite="true">
<fileset dir="${basedir}/nwps"/>
<filterset refid="installer.filter.set"/>
</copy>
</target>
<target name="-deploy.svcBackup" if="deploy.svcBackup"
description="Deploys service backup scripts to a specific directory">
<echo message="Copying in service backup scripts" />

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

@ -1 +1 @@
049e7b47e9c8ce3a9839dac563a90ce743b2446c
b0ccb6afd656a3d8b4e26247bfa669f5f9e31291

View file

@ -49,14 +49,11 @@
#
export PRODUCT_ID=CCCCQPEBIN
export FXA_HOME=/awips/fxa
#
# Set up the D2D environment...
. $FXA_HOME/readenv.sh
RUN_FROM_DIR=`dirname $0`
. $RUN_FROM_DIR/../../../set_hydro_env
. $RUN_FROM_DIR/../../set_hydro_env
export GAQ_LOG_DIR=$(get_apps_defaults gaq_log_dir)
export MPE_SEND_QPE_TO_SBN=$(get_apps_defaults mpe_send_qpe_to_sbn)
export MPE_SAVE_GRIB=$(get_apps_defaults mpe_save_grib)

View file

@ -49,14 +49,11 @@
#
export PRODUCT_ID=CCCCQPEBIN
export FXA_HOME=/awips/fxa
#
# Set up the D2D environment...
. $FXA_HOME/readenv.sh
RUN_FROM_DIR=`dirname $0`
. $RUN_FROM_DIR/../../../set_hydro_env
. $RUN_FROM_DIR/../../set_hydro_env
export GAQ_LOG_DIR=$(get_apps_defaults gaq_log_dir)
export MPE_SEND_QPE_TO_SBN=$(get_apps_defaults mpe_send_qpe_to_sbn)
export MPE_SAVE_GRIB=$(get_apps_defaults mpe_save_grib)

View file

@ -1 +1 @@
049e7b47e9c8ce3a9839dac563a90ce743b2446c
b0ccb6afd656a3d8b4e26247bfa669f5f9e31291

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;

View file

@ -288,9 +288,31 @@ public class PgenRotateElement extends AbstractPgenDrawingTool {
mapEditor.refresh();
}
return true;
}
else if (button == 3) {
return false;
if (trackExtrapPointInfoDlg != null) {
trackExtrapPointInfoDlg.close();
trackExtrapPointInfoDlg = null;
}
if (drawingLayer.getSelectedDE() != null) {
drawingLayer.removeGhostLine();
ptSelected = false;
drawingLayer.removeSelected();
mapEditor.refresh();
} else {
// set selecting mode
PgenUtil.setSelectingMode();
}
return true;
}
else {
return false;
}
}
/**

View file

@ -261,6 +261,7 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell()).setWatchBox((WatchBox) elSelected);
PgenUtil.loadWatchBoxModifyTool(elSelected);
return false;
} else if (elSelected instanceof Tcm) {
PgenUtil.loadTcmTool(elSelected);
}
@ -474,7 +475,11 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
}
else {
else if (button == 3 && pgenrsc.getSelectedDE() != null) {
// Right button click does not fall through to other handlers if
// there is pgen element is selected
return true;
} else {
return false;
@ -1046,12 +1051,16 @@ public class PgenSelectHandler extends InputHandlerDefaultImpl {
}
trackExtrapPointInfoDlg = null;
if (pgenrsc.getSelectedDE() != null) {
preempt = true;
}
pgenrsc.removeGhostLine();
ptSelected = false;
pgenrsc.removeSelected();
mapEditor.refresh();
// return false;
return preempt;
}

View file

@ -184,44 +184,6 @@ public class PgenSinglePointDrawingTool extends AbstractPgenDrawingTool {
}
else if ( button == 3 ) {
if ( elem != null && ((SymbolAttrDlg)attrDlg).labelEnabled()){
drawingLayer.removeGhostLine();
mapEditor.refresh();
String defaultTxt = "";
if ( attrDlg instanceof VolcanoAttrDlg ){
defaultTxt = ((VolcanoAttrDlg)attrDlg).getVolText();
dec.setCollectionName("Volcano");
}
//in case the label is enabled after symbol is placed.
if (dec == null && ((SymbolAttrDlg)attrDlg).labelEnabled()){
dec = new DECollection("labeledSymbol");
dec.setPgenCategory(pgenCategory);
dec.setPgenType(pgenType);
dec.addElement(elem);
drawingLayer.replaceElement(elem, dec);
}
PgenUtil.setDrawingTextMode( true, ((LabeledSymbolAttrDlg)attrDlg).useSymbolColor(), defaultTxt, dec );
dec = null;
elem = null;
}
else {
if ( prevElem != null){
usePrevColor = false;
if ( prevElem.getParent().getPgenCategory().equalsIgnoreCase("OUTLOOK")){
PgenUtil.loadOutlookDrawingTool();
}
prevElem = null;
}
else {
elem = null;
PgenUtil.setSelectingMode();
}
}
return true;
}
@ -274,6 +236,62 @@ public class PgenSinglePointDrawingTool extends AbstractPgenDrawingTool {
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;
if ( mouseButton == 3 ){
// prevent the click going through to other handlers
// in case adding labels to symbols or fronts.
if ( elem != null && ((SymbolAttrDlg)attrDlg).labelEnabled()){
drawingLayer.removeGhostLine();
mapEditor.refresh();
String defaultTxt = "";
if ( attrDlg instanceof VolcanoAttrDlg ){
defaultTxt = ((VolcanoAttrDlg)attrDlg).getVolText();
dec.setCollectionName("Volcano");
}
//in case the label is enabled after symbol is placed.
if (dec == null && ((SymbolAttrDlg)attrDlg).labelEnabled()){
dec = new DECollection("labeledSymbol");
dec.setPgenCategory(pgenCategory);
dec.setPgenType(pgenType);
dec.addElement(elem);
drawingLayer.replaceElement(elem, dec);
}
PgenUtil.setDrawingTextMode( true, ((LabeledSymbolAttrDlg)attrDlg).useSymbolColor(), defaultTxt, dec );
dec = null;
elem = null;
}
else {
if ( prevElem != null){
usePrevColor = false;
if ( prevElem.getParent().getPgenCategory().equalsIgnoreCase("OUTLOOK")){
PgenUtil.loadOutlookDrawingTool();
}
prevElem = null;
}
else {
elem = null;
PgenUtil.setSelectingMode();
}
}
return true;
}
else {
return false;
}
}
}
/**

View file

@ -111,48 +111,13 @@ public class PgenSpenesDrawingTool extends AbstractPgenDrawingTool {
}
else if ( button == 3 ) {
if ( points.size() == 0 ) {
if (attrDlg != null) attrDlg.close();
attrDlg = null;
PgenUtil.setSelectingMode();
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
// create a line
elem = def.create( DrawableType.SPENES, (IAttribute)attrDlg,
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
attrDlg.setDrawableElement((DrawableElement)elem);
// AttrSettings.getInstance().setSettings((DrawableElement)elem);
// add the product to PGEN resource
drawingLayer.addElement( elem );
//System.out.println(USState.statesInGeometry(((Spenes)elem).toJTSPolygon()));
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
return true;
}
else if ( button == 2 ){
return true;
return false;
}
else{
@ -203,6 +168,59 @@ public class PgenSpenesDrawingTool extends AbstractPgenDrawingTool {
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 ) {
if (attrDlg != null) attrDlg.close();
attrDlg = null;
PgenUtil.setSelectingMode();
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
// create a line
elem = def.create( DrawableType.SPENES, (IAttribute)attrDlg,
pgenCategory, pgenType, points, drawingLayer.getActiveLayer());
attrDlg.setDrawableElement((DrawableElement)elem);
// AttrSettings.getInstance().setSettings((DrawableElement)elem);
// add the product to PGEN resource
drawingLayer.addElement( elem );
//System.out.println(USState.statesInGeometry(((Spenes)elem).toJTSPolygon()));
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
return true;
}
else {
return false;
}
}
private void clearPoints(){
points.clear();
}

View file

@ -413,6 +413,22 @@ public class PgenTcaTool extends AbstractPgenDrawingTool {
// right mouse button pressed
else if (button == 3) {
return true;
} else
return false;
}
/*
* 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) {
switch (mode) {
case IDLE:
@ -456,12 +472,12 @@ public class PgenTcaTool extends AbstractPgenDrawingTool {
}
return true;
} else
}
else {
return false;
}
}
/*
* (non-Javadoc)
*

View file

@ -124,21 +124,7 @@ public class PgenTcmDrawingTool extends AbstractPgenDrawingTool {
}
else if ( button == 3 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
if ( points.size() == 0 ) {
PgenUtil.setSelectingMode();
}
else {
points.clear();
}
return true;
}
@ -154,7 +140,37 @@ public class PgenTcmDrawingTool 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

@ -272,32 +272,6 @@ public class PgenTextDrawingTool extends AbstractPgenDrawingTool {
}
else if ( button == 3 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
if (addLabelToSymbol){
addLabelToSymbol = false;
usePrevColor = false;
if ( prevElem.getName().equalsIgnoreCase("labeledSymbol") ){
if ( prevElem.getPrimaryDE() instanceof Symbol ) {
PgenUtil.setDrawingSymbolMode( prevElem.getPrimaryDE().getPgenCategory(), prevElem.getPgenType(), false, null );
}
else if ( prevElem.getPrimaryDE() instanceof ComboSymbol ){
PgenUtil.setDrawingSymbolMode( "Combo", prevElem.getPgenType(), false, null );
}
}
else if ( prevElem instanceof DECollection && prevElem.getPgenCategory().equalsIgnoreCase("Front") ){
PgenUtil.setDrawingFrontMode((Line)prevElem.getPrimaryDE());
}
else if ( prevElem.getName().equalsIgnoreCase(Outlook.OUTLOOK_LABELED_LINE)){
PgenUtil.loadOutlookDrawingTool();
}
prevElem = null;
}
else {
PgenUtil.setSelectingMode();
}
return true;
}
@ -379,7 +353,56 @@ public class PgenTextDrawingTool extends AbstractPgenDrawingTool {
if ( !isResourceEditable()|| shiftDown ) 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 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
if (addLabelToSymbol){
addLabelToSymbol = false;
usePrevColor = false;
if ( prevElem.getName().equalsIgnoreCase("labeledSymbol") ){
if ( prevElem.getPrimaryDE() instanceof Symbol ) {
PgenUtil.setDrawingSymbolMode( prevElem.getPrimaryDE().getPgenCategory(), prevElem.getPgenType(), false, null );
}
else if ( prevElem.getPrimaryDE() instanceof ComboSymbol ){
PgenUtil.setDrawingSymbolMode( "Combo", prevElem.getPgenType(), false, null );
}
}
else if ( prevElem instanceof DECollection && prevElem.getPgenCategory().equalsIgnoreCase("Front") ){
PgenUtil.setDrawingFrontMode((Line)prevElem.getPrimaryDE());
}
else if ( prevElem.getName().equalsIgnoreCase(Outlook.OUTLOOK_LABELED_LINE)){
PgenUtil.loadOutlookDrawingTool();
}
prevElem = null;
}
else {
PgenUtil.setSelectingMode();
}
return true;
}
else{
return false;
}
}
}
/**
* Check if a point is at right or left of the line.

View file

@ -154,20 +154,6 @@ public class PgenVectorDrawingTool extends AbstractPgenDrawingTool {
}
else if ( button == 3 ) {
drawingLayer.removeGhostLine();
mapEditor.refresh();
if ( points.size() > 0 ) {
points.clear();
}
else {
attrDlg.close();
PgenUtil.setSelectingMode();
}
return true;
}
@ -213,7 +199,37 @@ public class PgenVectorDrawingTool extends AbstractPgenDrawingTool {
return false;
}
/*
* 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 ) {
points.clear();
}
else {
attrDlg.close();
PgenUtil.setSelectingMode();
}
return true;
}
else {
return false;
}
}
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if (!isResourceEditable() || shiftDown ) return false;

View file

@ -16,11 +16,11 @@ import gov.noaa.nws.ncep.ui.pgen.rsc.PgenResource;
import java.util.List;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.factory.CommonFactoryFinder;
import org.geotools.factory.GeoTools;
import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.FeatureCollection;
import org.geotools.feature.FeatureIterator;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.referencing.crs.DefaultGeographicCRS;
@ -45,7 +45,6 @@ import com.vividsolutions.jts.geom.Point;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 12/09 #159 B. Yin Initial Creation.
* Mar 11, 2014 #2718 randerso Changes for GeoTools 10.5
*
* </pre>
*
@ -61,7 +60,7 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl {
//feature collection used to find which county a location is in
static DefaultFeatureCollection counties;
static DefaultFeatureCollection counties;
/**
* Public constructor
@ -106,9 +105,9 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl {
Point click = gf.createPoint(loc);
//apply filter
SimpleFeatureCollection fc = counties.subCollection(createFilter(click));
FeatureCollection<SimpleFeatureType,SimpleFeature> fc = counties.subCollection(createFilter(click));
SimpleFeatureIterator featureIterator = fc.features();
FeatureIterator<SimpleFeature> featureIterator = fc.features();
//find the ID of the county the location is inside of
String ugc = null;
@ -122,7 +121,6 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl {
break;
}
}
featureIterator.close();
boolean gotCnty = false;
SPCCounty county = null;
@ -195,23 +193,35 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl {
}
else if ( button == 3 ) {
wbTool.resetMouseHandler();
((WatchBoxAttrDlg)wbTool.attrDlg).getWatchInfoDlg().enableAllButtons(true);
((WatchBoxAttrDlg)wbTool.attrDlg).enableDspBtn(true);
((WatchBoxAttrDlg)wbTool.attrDlg).buttonBar.setEnabled(true);
return true;
return true;
}
else{
return false;
}
}
/*
* 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) {
wbTool.resetMouseHandler();
((WatchBoxAttrDlg)wbTool.attrDlg).getWatchInfoDlg().enableAllButtons(true);
((WatchBoxAttrDlg)wbTool.attrDlg).enableDspBtn(true);
((WatchBoxAttrDlg)wbTool.attrDlg).buttonBar.setEnabled(true);
return true;
}
else {
return false;
}
}
@Override
public boolean handleMouseDownMove(int x, int y, int mouseButton) {
if ( !drawingLayer.isEditable() || shiftDown ) return false;
@ -223,7 +233,7 @@ public class PgenWatchBoxAddDelCntyHandler extends InputHandlerDefaultImpl {
*/
private void createCountyFeatureCollection(){
counties = new DefaultFeatureCollection();
counties = new DefaultFeatureCollection(null, null);
// create simple feature type
SimpleFeatureTypeBuilder builder2 = new SimpleFeatureTypeBuilder();

View file

@ -163,32 +163,11 @@ public class PgenWatchBoxDrawingTool 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();
}
return true;
}
else{
return false;
}
}
/*
@ -246,12 +225,35 @@ public class PgenWatchBoxDrawingTool extends AbstractPgenDrawingTool {
points.clear();
mapEditor.refresh();
}
return true;
}
return true;
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();
}
return true;
}
else{
return false;
}
}
/*

View file

@ -133,29 +133,11 @@ public class PgenWatchBoxModifyTool extends PgenSelectingTool {
}
// clean up
else if ( button == 3 ) {
// Close the attribute dialog and do the cleanup.
if ( PgenWatchBoxModifyTool.this.attrDlg != null ) {
PgenWatchBoxModifyTool.this.attrDlg.close();
}
PgenWatchBoxModifyTool.this.attrDlg = null;
drawingLayer.removeGhostLine();
ptSelected = false;
drawingLayer.removeSelected();
mapEditor.refresh();
PgenUtil.setSelectingMode();
return true;
}
else{
return false;
}
}
/*
@ -230,55 +212,76 @@ public class PgenWatchBoxModifyTool extends PgenSelectingTool {
*/
@Override
public boolean handleMouseUp(int x, int y, int button) {
firstDown = null;
if ( !isResourceEditable() ) return false;
firstDown = null;
if ( !isResourceEditable() ) return false;
// Finish the editing
if (button == 1 && drawingLayer != null ){
// Create a copy of the currently editing watch box
WatchBox el = (WatchBox) drawingLayer.getSelectedDE();
// Finish the editing
if (button == 1 && drawingLayer != null ){
if ( el != null ){
WatchBox newEl = (WatchBox)el.copy();
// Create a copy of the currently editing watch box
WatchBox el = (WatchBox) drawingLayer.getSelectedDE();
if ( ptSelected ) {
if ( el != null ){
ptSelected = false;
// re-snap the new watch box
resnapWatchBox( mapEditor, (WatchBox)ghostEl, newEl );
((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).setWatchBox(newEl);
WatchInfoDlg infoDlg = ((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).getWatchInfoDlg();
if ( infoDlg != null && infoDlg.getShell()!= null ){
if ( ! infoDlg.isCountyLock()){
newEl.clearCntyList();
infoDlg.clearCwaPane();
}
infoDlg.setStatesWFOs();
}
// Replace the selected watch box with this new watch box
drawingLayer.replaceElement(el, newEl);
// Set this new element as the currently selected element
// Collections do not need to reset.
if ( !(drawingLayer.getSelectedComp() instanceof DECollection )){
drawingLayer.setSelected(newEl);
}
WatchBox newEl = (WatchBox)el.copy();
drawingLayer.removeGhostLine();
if ( ptSelected ) {
}
mapEditor.refresh();
ptSelected = false;
}
}
return true;
// re-snap the new watch box
resnapWatchBox( mapEditor, (WatchBox)ghostEl, newEl );
((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).setWatchBox(newEl);
WatchInfoDlg infoDlg = ((WatchBoxAttrDlg)PgenWatchBoxModifyTool.this.attrDlg).getWatchInfoDlg();
if ( infoDlg != null && infoDlg.getShell()!= null ){
if ( ! infoDlg.isCountyLock()){
newEl.clearCntyList();
infoDlg.clearCwaPane();
}
infoDlg.setStatesWFOs();
}
// Replace the selected watch box with this new watch box
drawingLayer.replaceElement(el, newEl);
// Set this new element as the currently selected element
// Collections do not need to reset.
if ( !(drawingLayer.getSelectedComp() instanceof DECollection )){
drawingLayer.setSelected(newEl);
}
drawingLayer.removeGhostLine();
}
mapEditor.refresh();
}
return true;
}
else if ( button == 3 ) {
// Close the attribute dialog and do the cleanup.
if ( PgenWatchBoxModifyTool.this.attrDlg != null ) {
PgenWatchBoxModifyTool.this.attrDlg.close();
}
PgenWatchBoxModifyTool.this.attrDlg = null;
drawingLayer.removeGhostLine();
ptSelected = false;
drawingLayer.removeSelected();
mapEditor.refresh();
PgenUtil.setSelectingMode();
return true;
}
else{
return false;
}
}
}

View file

@ -139,73 +139,84 @@ public class PgenWatchStatusLineDrawingTool extends AbstractPgenDrawingTool{
}
else if ( button == 3 ) {
if ( points.size() == 0 ) {
//close the line attr dialog
if ( attrDlg != null ) attrDlg.close();
attrDlg = null;
//return to watch modifying tool
PgenUtil.loadWatchBoxModifyTool(wb);
//set the watch element as selected
drawingLayer.setSelected(wb);
//open and initialize watch box attr dialog
WatchBoxAttrDlg wbdlg = WatchBoxAttrDlg.getInstance(null);
wbdlg.openSpecDlg( false );
wbdlg.setDrawableElement(wb);
wbdlg.setMouseHandlerName("Pgen Select");
wbdlg.setAttrForDlg( (IAttribute)wb );
wbdlg.enableButtons();
wbdlg.setPgenCategory(wb.getPgenCategory());
wbdlg.setPgenType( wb.getPgenType() );
wbdlg.setDrawingLayer( drawingLayer );
wbdlg.setMapEditor( mapEditor );
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
// create a status line
Line statusLine = new Line(null, attrDlg.getColors(), attrDlg.getLineWidth(),
1.0, false, false, points, ((ILine)attrDlg).getSmoothFactor(),FillPattern.SOLID,
"Lines","POINTED_ARROW");
// add the line to watch DECollection
((DECollection)wb.getParent()).add(statusLine);
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
return true;
return true;
}
else if ( button == 2 ){
return true;
}
else{
return false;
}
}
/*
* 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 ) {
//close the line attr dialog
if ( attrDlg != null ) attrDlg.close();
attrDlg = null;
//return to watch modifying tool
PgenUtil.loadWatchBoxModifyTool(wb);
//set the watch element as selected
drawingLayer.setSelected(wb);
//open and initialize watch box attr dialog
WatchBoxAttrDlg wbdlg = WatchBoxAttrDlg.getInstance(null);
wbdlg.openSpecDlg( false );
wbdlg.setDrawableElement(wb);
wbdlg.setMouseHandlerName("Pgen Select");
wbdlg.setAttrForDlg( (IAttribute)wb );
wbdlg.enableButtons();
wbdlg.setPgenCategory(wb.getPgenCategory());
wbdlg.setPgenType( wb.getPgenType() );
wbdlg.setDrawingLayer( drawingLayer );
wbdlg.setMapEditor( mapEditor );
}
else if ( points.size() < 2 ){
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
else {
// create a status line
Line statusLine = new Line(null, attrDlg.getColors(), attrDlg.getLineWidth(),
1.0, false, false, points, ((ILine)attrDlg).getSmoothFactor(),FillPattern.SOLID,
"Lines","POINTED_ARROW");
// add the line to watch DECollection
((DECollection)wb.getParent()).add(statusLine);
drawingLayer.removeGhostLine();
points.clear();
mapEditor.refresh();
}
return true;
}
else {
return false;
}
}
/*
* (non-Javadoc)
*

View file

@ -96,14 +96,21 @@ rm -rf ${RPM_BUILD_ROOT}
%dir /awips2
%dir /awips2/GFESuite
/awips2/GFESuite/*
%defattr(644,awips,fxalpha,775)
%dir /awips2/GFESuite/nwps
/awips2/GFESuite/nwps/*
%defattr(755,awips,fxalpha,755)
%dir /awips2/GFESuite/bin
/awips2/GFESuite/bin/*
%dir /awips2/GFESuite/hti/bin
/awips2/GFESuite/hti/bin/*
%dir /awips2/GFESuite/nwps/bin
/awips2/GFESuite/nwps/bin/*
%defattr(755,awips,fxalpha,777)
%dir /awips2/GFESuite/hti/etc
/awips2/GFESuite/hti/etc/*
%dir /awips2/GFESuite/nwps/domains
/awips2/GFESuite/nwps/domains/*
%defattr(644,awips,fxalpha,755)
%dir /awips2/GFESuite/bin/src
/awips2/GFESuite/bin/src/*

View file

@ -222,7 +222,7 @@ HDS ^([LM].[ABCDEFGHMNRST].{1,3}) (KWB.) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([
# that edit also removed the HPCGuide data. Josh Watson
NGRID ^([LM][ABCDFGH]U...) (KWBN) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/]*)/([0-9]{8})([0-9]{4})(F[0-9]{3})/([^/]*)
FLE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/\7/GRID\8/\(10)Z_\(11)_\(12)-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H
FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/\7/GRID\8/\(10)Z_\(11)_\(12)-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H
# DR 17426
# 2.5km CONUS GMOS
@ -284,7 +284,7 @@ NGRID ^([LM].[EF].{1,3}) (KWBD) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([
# The noaaportIngester does not yet read a grib2 SBN file with more than one message.
NGRID ^(L...[0-9][0-9]) (KMDL) (..)(..)(..)
FILE -overwrite -log -close -edex /data_store/grib2/(\3:yyyy)(\3:mm)\3/\4/LAMP/GRID184/\1_\2_\3\4\5_(seq).grib2.%Y%m%d%H
NGRID ^(L[CDEF]U[0-9][0-9]) (KWNO) (..)(..)(..)
NGRID ^(L[CDEF]U.[0-9][0-9]) (KWNO) (..)(..)(..)
FILE -overwrite -log -close -edex /data_store/grib2/(\3:yyyy)(\3:mm)\3/\4/LAMP/GRID184/\1_\2_\3\4\5_(seq).grib2.%Y%m%d%H
# AWIPS1: GRID ^L[UV]I.*KWBJ* /Grid/SBN/rawGrib2