Issue #2310 Switch awipstools to load using bundles.

Change-Id: I9a24e6359bd43bfb7c8f84686348f532748503c4

Former-commit-id: afc80cb00cce9b22f1ecd730b60da1de1afbfb2e
This commit is contained in:
Ben Steffensmeier 2013-09-04 11:44:59 -05:00
parent 47b8d496ae
commit d75fdcb916
36 changed files with 1181 additions and 973 deletions

View file

@ -2,4 +2,5 @@ source.. = src/
output.. = bin/ output.. = bin/
bin.includes = META-INF/,\ bin.includes = META-INF/,\
.,\ .,\
icons/ icons/,\
localization/

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Interactive Points</name>
<classT>com.raytheon.uf.viz.points.ui.layer.PointsToolLayer</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -19,9 +19,7 @@
**/ **/
package com.raytheon.uf.viz.points.ui.action; package com.raytheon.uf.viz.points.ui.action;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData; import com.raytheon.viz.ui.actions.LoadBundleHandler;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
/** /**
* Handles the Points Tool Action. * Handles the Points Tool Action.
@ -31,28 +29,21 @@ import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Oct032007 #455 ebabin Initial Creation. * Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* 14Oct2009 #810 bsteffen Fix for grabbing points.
* 10-21-09 #1711 bsteffen Refactor to common MovableTool model
* *
* </pre> * </pre>
* *
* @author ebabin * @author bsteffen
* @version 1 * @version 2.0
* @deprecated Use {@link LoadBundleHandler} with
* bundleFile="bundles/tools/Points.xml".
*/ */
public class PointsToolAction extends AbstractGenericToolAction<PointsToolLayer> { @Deprecated
public class PointsToolAction extends LoadBundleHandler {
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
*/
@Override
protected GenericToolsResourceData<PointsToolLayer> getResourceData() {
return new GenericToolsResourceData<PointsToolLayer>(
PointsToolLayer.DEFAULT_NAME, PointsToolLayer.class);
public PointsToolAction(){
super("bundles/tools/Points.xml");
} }
} }

View file

@ -29,6 +29,7 @@ import java.util.TimeZone;
import org.eclipse.core.commands.Command; import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.jface.action.ContributionItem; import org.eclipse.jface.action.ContributionItem;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Event;
@ -58,11 +59,7 @@ import com.raytheon.uf.viz.core.procedures.BundleUtil.BundleDataItem;
import com.raytheon.uf.viz.core.rsc.URICatalog; import com.raytheon.uf.viz.core.rsc.URICatalog;
import com.raytheon.uf.viz.core.rsc.URICatalog.IURIRefreshCallback; import com.raytheon.uf.viz.core.rsc.URICatalog.IURIRefreshCallback;
import com.raytheon.uf.viz.ui.menus.xml.BundleMenuContribution; import com.raytheon.uf.viz.ui.menus.xml.BundleMenuContribution;
import com.raytheon.viz.ui.BundleLoader; import com.raytheon.viz.ui.actions.LoadBundleHandler;
import com.raytheon.viz.ui.BundleLoader.BundleInfoType;
import com.raytheon.viz.ui.BundleProductLoader;
import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
/** /**
* Provides an Eclipse menu contribution that loads a bundle, and is decorated * Provides an Eclipse menu contribution that loads a bundle, and is decorated
@ -84,9 +81,12 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Mar 12, 2009 chammack Initial creation * Mar 12, 2009 chammack Initial creation
* Jan 14, 2013 1442 rferrel Add Simulated Time Change Listener. * Jan 14, 2013 1442 rferrel Add Simulated Time Change Listener.
* Aug 30, 2013 2310 bsteffen Move loading of bundle to
* LoadBundleHandler.
*
* *
* </pre> * </pre>
* *
@ -397,20 +397,13 @@ public class BundleContributionItem extends ContributionItem {
private void loadBundle(Event event) { private void loadBundle(Event event) {
try { try {
Bundle bundle = BundleLoader.getBundle( boolean fullBundleLoad = false;
this.menuContribution.xml.bundleFile, substitutions, if (this.menuContribution.xml.fullBundleLoad != null) {
BundleInfoType.FILE_LOCATION); fullBundleLoad = this.menuContribution.xml.fullBundleLoad;
AbstractEditor editor = UiUtil.createOrOpenEditor(
this.menuContribution.xml.editorType, bundle.getDisplays());
BundleLoader loader;
if (this.menuContribution.xml.fullBundleLoad == null
|| this.menuContribution.xml.fullBundleLoad == false) {
loader = new BundleProductLoader(editor, bundle);
} else {
loader = new BundleLoader(editor, bundle);
} }
loader.schedule(); new LoadBundleHandler(this.menuContribution.xml.bundleFile,
substitutions, this.menuContribution.xml.editorType,
fullBundleLoad).execute(null);
if (this.menuContribution.xml.command != null) { if (this.menuContribution.xml.command != null) {
ICommandService service = (ICommandService) PlatformUI ICommandService service = (ICommandService) PlatformUI
.getWorkbench().getService(ICommandService.class); .getWorkbench().getService(ICommandService.class);
@ -430,7 +423,7 @@ public class BundleContributionItem extends ContributionItem {
} }
} }
} catch (VizException e) { } catch (ExecutionException e) {
statusHandler.handle(Priority.PROBLEM, "Error loading bundle : " statusHandler.handle(Priority.PROBLEM, "Error loading bundle : "
+ this.menuContribution.xml.bundleFile, e); + this.menuContribution.xml.bundleFile, e);
} }

View file

@ -9,23 +9,19 @@ Eclipse-BuddyPolicy: registered, ext, global
Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.viz.core, com.raytheon.uf.common.serialization Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.viz.core, com.raytheon.uf.common.serialization
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui, org.eclipse.ui,
com.raytheon.viz.core,
org.apache.commons.lang, org.apache.commons.lang,
org.geotools,
com.raytheon.viz.ui.tools.map,
com.raytheon.viz.ui, com.raytheon.viz.ui,
javax.measure, javax.measure,
com.raytheon.uf.common.pointdata, com.raytheon.uf.common.pointdata,
javax.vecmath;bundle-version="1.3.1", com.raytheon.uf.common.dataplugin.radar,
com.raytheon.uf.common.serialization, com.raytheon.uf.viz.core.maps,
com.raytheon.uf.common.awipstools;bundle-version="1.12.1112", com.raytheon.uf.viz.points,
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1112", com.raytheon.uf.viz.core.rsc,
com.raytheon.uf.viz.d2d.core, com.raytheon.uf.viz.core,
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0", com.raytheon.uf.common.geospatial,
com.raytheon.uf.viz.core.maps;bundle-version="1.12.1174", com.raytheon.uf.common.datastorage,
com.raytheon.uf.viz.d2d.ui, com.raytheon.uf.common.dataplugin,
com.raytheon.uf.viz.points;bundle-version="1.0.0", com.raytheon.uf.common.util
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0"
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.awipstools, Export-Package: com.raytheon.viz.awipstools,
com.raytheon.viz.awipstools.capabilities, com.raytheon.viz.awipstools.capabilities,
@ -35,7 +31,8 @@ Export-Package: com.raytheon.viz.awipstools,
com.raytheon.viz.awipstools.ui.action, com.raytheon.viz.awipstools.ui.action,
com.raytheon.viz.awipstools.ui.display, com.raytheon.viz.awipstools.ui.display,
com.raytheon.viz.awipstools.ui.layer com.raytheon.viz.awipstools.ui.layer
Import-Package: com.raytheon.uf.common.topo,
com.raytheon.uf.viz.d2d.core,
com.raytheon.uf.viz.d2d.ui.dialogs.procedures
Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: com.raytheon.viz.core,
com.raytheon.viz.core.interval,
com.raytheon.viz.core.rsc,
com.raytheon.viz.core.rsc.jts

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Az/Ran Overlay</name>
<classT>com.raytheon.viz.awipstools.ui.layer.AzimuthToolLayer</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Interactive Baselines</name>
<classT>com.raytheon.viz.awipstools.ui.layer.InteractiveBaselinesLayer</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Home Location</name>
<classT>com.raytheon.viz.awipstools.ui.layer.HomeToolLayer</classT>
</resourceData>
</resource>
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Interactive Points</name>
<classT>com.raytheon.uf.viz.points.ui.layer.PointsToolLayer</classT>
</resourceData>
</resource>
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Interactive Baselines</name>
<classT>com.raytheon.viz.awipstools.ui.layer.InteractiveBaselinesLayer</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Distance Bearing</name>
<classT>com.raytheon.viz.awipstools.ui.layer.DistanceBearingToolLayer</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Distance Scale</name>
<classT>com.raytheon.viz.awipstools.common.DistanceTool</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Estimated Act Vel</name>
<classT>com.raytheon.viz.awipstools.ui.layer.EstimatedActualVelocityLayer</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Feature Following Zoom</name>
<classT>com.raytheon.viz.awipstools.ui.layer.FeatureFollowingZoomLayer</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Home Location</name>
<classT>com.raytheon.viz.awipstools.ui.layer.HomeToolLayer</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>Range Rings</name>
<classT>com.raytheon.viz.awipstools.ui.layer.RangeRingsLayer</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!--
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
This_software_product_contains_export-restricted_data_whose
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
an_export_license_or_other_authorization.
Contractor_Name:________Raytheon_Company
Contractor_Address:_____6825_Pine_Street,_Suite_340
________________________Mail_Stop_B8
________________________Omaha,_NE_68106
________________________402.291.0100
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
further_licensing_information.
-->
<bundle>
<displayList>
<displays xsi:type="mapRenderableDisplay" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<descriptor xsi:type="mapDescriptor">
<resource>
<loadProperties/>
<resourceData xsi:type="genericToolsResourceData">
<name>VR Shear</name>
<classT>com.raytheon.viz.awipstools.ui.layer.VRShearLayer</classT>
</resourceData>
</resource>
</descriptor>
</displays>
</displayList>
</bundle>

View file

@ -19,37 +19,32 @@
further_licensing_information. further_licensing_information.
--> -->
<menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <menuTemplate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<contribute xsi:type="command"
commandId="com.raytheon.viz.awipstools.azran"
menuText="Az/Ran Overlay" />
<contribute xsi:type="command" <contribute xsi:type="bundleItem" file="bundles/tools/AzRan.xml"
commandId="com.raytheon.viz.awipstools.baselines" menuText="Az/Ran Overlay" id="AzRanTool" timeQuery="false" />
menuText="Baselines" />
<contribute xsi:type="bundleItem" file="bundles/tools/Baselines.xml"
menuText="Baselines" id="baselinesTool" timeQuery="false" />
<contribute xsi:type="command" <contribute xsi:type="command"
commandId="com.raytheon.viz.awipstools.choosebyid" commandId="com.raytheon.viz.awipstools.choosebyid"
menuText="Choose By ID..." /> menuText="Choose By ID..." />
<contribute xsi:type="command" <contribute xsi:type="bundleItem" file="bundles/tools/DistanceBearing.xml"
commandId="com.raytheon.viz.awipstools.distancebearing" menuText="Distance Bearing" id="distanceBearingTool" timeQuery="false" />
menuText="Distance Bearing" />
<contribute xsi:type="command" <contribute xsi:type="command"
commandId="com.raytheon.viz.awipstools.distancespeed" commandId="com.raytheon.viz.awipstools.distancespeed"
menuText="Distance Speed" /> menuText="Distance Speed" />
<contribute xsi:type="command" <contribute xsi:type="bundleItem" file="bundles/tools/DistanceScale.xml"
commandId="com.raytheon.viz.awipstools.distancetool" menuText="Distance Scale" id="distanceScaleTool" timeQuery="false" />
menuText="Distance Scale" />
<contribute xsi:type="command" <contribute xsi:type="bundleItem" file="bundles/tools/FeatureFollowingZoom.xml"
commandId="com.raytheon.viz.awipstools.ffz" menuText="Feature Following Zoom" id="featureFollowingZoomTool" timeQuery="false" />
menuText="Feature Following Zoom" />
<contribute xsi:type="command" <contribute xsi:type="bundleItem" file="bundles/tools/EstimatedActualVelocity.xml"
commandId="com.raytheon.viz.awipstools.estimatedactualvelocity" menuText="Estimated Actual Velocity" id="estimatedActualVelocityTool" timeQuery="false" />
menuText="Estimated Actual Velocity" />
<contribute xsi:type="command" <contribute xsi:type="command"
commandId="com.raytheon.viz.ui.viz.radarapps.fsi.startFSI" commandId="com.raytheon.viz.ui.viz.radarapps.fsi.startFSI"
@ -59,17 +54,15 @@
commandId="com.raytheon.viz.awipstools.timeofarrival" commandId="com.raytheon.viz.awipstools.timeofarrival"
menuText="Time Of Arrival / Lead Time" /> menuText="Time Of Arrival / Lead Time" />
<contribute xsi:type="command" <contribute xsi:type="bundleItem" file="bundles/tools/Home.xml"
commandId="com.raytheon.viz.awipstools.home" menuText="Home" id="homeTool" timeQuery="false" />
menuText="Home" />
<contribute xsi:type="command" <contribute xsi:type="command"
commandId="com.raytheon.viz.awipstools.lapstools" commandId="com.raytheon.viz.awipstools.lapstools"
menuText="LAPS tools..." /> menuText="LAPS tools..." />
<contribute xsi:type="command" <contribute xsi:type="bundleItem" file="bundles/tools/Points.xml"
commandId="com.raytheon.viz.awipstools.points" menuText="Points" id="pointsTool" timeQuery="false" />
menuText="Points" />
<contribute xsi:type="command" <contribute xsi:type="command"
commandId="com.raytheon.viz.awipstools.puthomecursor" commandId="com.raytheon.viz.awipstools.puthomecursor"
@ -79,9 +72,8 @@
commandId="com.raytheon.viz.radar.ui.RadarDisplayControls" commandId="com.raytheon.viz.radar.ui.RadarDisplayControls"
menuText="Radar Display Controls..." /> menuText="Radar Display Controls..." />
<contribute xsi:type="command" <contribute xsi:type="bundleItem" file="bundles/tools/RangeRings.xml"
commandId="com.raytheon.viz.awipstools.rangerings" menuText="Range Rings" id="rangeRingsTool" timeQuery="false" />
menuText="Range Rings" />
<contribute xsi:type="command" <contribute xsi:type="command"
commandId="com.raytheon.viz.awipstools.sunrise" commandId="com.raytheon.viz.awipstools.sunrise"
@ -95,9 +87,8 @@
commandId="com.raytheon.viz.awipstools.unitscalculator" commandId="com.raytheon.viz.awipstools.unitscalculator"
menuText="Units Calculator..." /> menuText="Units Calculator..." />
<contribute xsi:type="command" <contribute xsi:type="bundleItem" file="bundles/tools/VRShear.xml"
commandId="com.raytheon.viz.awipstools.vrshear" menuText="VR - Shear" id="vrShearTool" timeQuery="false" />
menuText="VR - Shear" />
<!-- example arbitrary command below, commandAction parameter is required, <!-- example arbitrary command below, commandAction parameter is required,
the others default to false if undefined. If captureOutput is true then after the others default to false if undefined. If captureOutput is true then after

View file

@ -212,7 +212,7 @@
<menuContribution <menuContribution
locationURI="toolbar:d2d-2?after=tools.toolbar"> locationURI="toolbar:d2d-2?after=tools.toolbar">
<command <command
commandId="com.raytheon.viz.awipstools.points" commandId="com.raytheon.uf.viz.ui.loadbundle"
icon="icons/points.gif" icon="icons/points.gif"
label="Points"> label="Points">
<visibleWhen> <visibleWhen>
@ -220,9 +220,13 @@
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet"> definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
</reference> </reference>
</visibleWhen> </visibleWhen>
<parameter
name="bundleFile"
value="bundles/tools/Points.xml">
</parameter>
</command> </command>
<command <command
commandId="com.raytheon.viz.awipstools.baselines" commandId="com.raytheon.uf.viz.ui.loadbundle"
icon="icons/Baseline.gif" icon="icons/Baseline.gif"
label="Baselines"> label="Baselines">
<visibleWhen> <visibleWhen>
@ -230,6 +234,9 @@
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet"> definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
</reference> </reference>
</visibleWhen> </visibleWhen>
<parameter
name="bundleFile"
value="bundles/tools/Baselines.xml" />
</command> </command>
</menuContribution> </menuContribution>
</extension> </extension>

View file

@ -19,9 +19,9 @@
**/ **/
package com.raytheon.viz.awipstools.ui.action; package com.raytheon.viz.awipstools.ui.action;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData; import java.util.HashMap;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.viz.awipstools.ui.layer.AzimuthToolLayer; import com.raytheon.viz.ui.actions.LoadBundleHandler;
/** /**
* Show 'Az/Ran' Overlay. * Show 'Az/Ran' Overlay.
@ -31,31 +31,22 @@ import com.raytheon.viz.awipstools.ui.layer.AzimuthToolLayer;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Sep142007 #444 ebabin Initial Creation. * Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* May282010 #5361 bkowal We now pass the mouseButton *
* identifier to the Azimuth Tool Layer
* handle mouse button function.
* Jun142010 #6360 bkowal Ensured that the legend will no longer
* change when the user changes the position
* of the tool with the right-mouse button.
* </pre> * </pre>
* *
* @author ebabin * @author bsteffen
* @version 1 * @version 2.0
* @deprecated Use {@link LoadBundleHandler} with
* bundleFile="bundles/tools/AzRan.xml".
*/ */
public class AzimuthToolAction extends AbstractGenericToolAction<AzimuthToolLayer> { @Deprecated
public class AzimuthToolAction extends LoadBundleHandler {
/* public AzimuthToolAction() {
* (non-Javadoc) super("bundles/tools/AzRan.xml");
* HashMap<String, String> map = null;
* @see
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
*/
@Override
protected GenericToolsResourceData<AzimuthToolLayer> getResourceData() {
return new GenericToolsResourceData<AzimuthToolLayer>(
AzimuthToolLayer.AZIMUTH_LOCATION, AzimuthToolLayer.class);
} }
} }

View file

@ -19,43 +19,33 @@
**/ **/
package com.raytheon.viz.awipstools.ui.action; package com.raytheon.viz.awipstools.ui.action;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData; import com.raytheon.viz.awipstools.ui.layer.BaselinesToolLayer;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction; import com.raytheon.viz.ui.actions.LoadBundleHandler;
import com.raytheon.viz.awipstools.ui.layer.InteractiveBaselinesLayer;
/** /**
* Handles the Baseline Tools Action. * Loads a {@link BaselinesToolLayer} from the bundles/tools/Baselines.xml
* localization file.
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Sep192007 #447 ebabin Initial Creation. * Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* 20Dec2007 #645 ebabin Updated to fix sampling.
* 12May2008 #1031 ebabin Fix for baselines editing.
* 14Oct2009 #683 bsteffen Fix for grabbing points.
* 10-21-09 #1711 bsteffen Refactor to common MovableTool model
* *
* </pre> * </pre>
* *
* @author ebabin * @author bsteffen
* @version 1 * @version 2.0
* @deprecated Use {@link LoadBundleHandler} with
* bundleFile="bundles/tools/Baselines.xml".
*/ */
public class BaselinesToolAction extends @Deprecated
AbstractGenericToolAction<InteractiveBaselinesLayer> { public class BaselinesToolAction extends LoadBundleHandler {
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
*/
@Override
protected GenericToolsResourceData<InteractiveBaselinesLayer> getResourceData() {
return new GenericToolsResourceData<InteractiveBaselinesLayer>(
"Interactive Baselines", InteractiveBaselinesLayer.class);
public BaselinesToolAction() {
super("bundles/tools/Baselines.xml");
} }
} }

View file

@ -22,74 +22,43 @@ package com.raytheon.viz.awipstools.ui.action;
import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.core.DescriptorMap;
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.MapDescriptor;
import com.raytheon.uf.viz.core.maps.actions.NewMapEditor;
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
import com.raytheon.uf.viz.points.ui.action.PointsToolAction;
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
import com.raytheon.viz.awipstools.ui.dialog.ChooseByIdDialog; import com.raytheon.viz.awipstools.ui.dialog.ChooseByIdDialog;
import com.raytheon.viz.awipstools.ui.layer.HomeToolLayer; import com.raytheon.viz.ui.actions.LoadBundleHandler;
import com.raytheon.viz.awipstools.ui.layer.InteractiveBaselinesLayer;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.tools.map.AbstractMapTool;
/** /**
* TODO Add Description * Opens the {@link ChooseByIdDialog} and loads several other tools from the
* bundles/tools/ChooseById.xml localization file.
* *
* <pre> * <pre>
*
* SOFTWARE HISTORY * SOFTWARE HISTORY
*
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* 06Dec2007 #576 Eric Babin Initial Creation * Sep 03, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* 31Jul2012 #875 rferrel Added checks for disposed dialgos.
* *
* </pre> * </pre>
* *
* @author ebabin * @author bsteffen
* @version 1.0 * @version 2.0
*/ */
public class ChooseByIdAction extends LoadBundleHandler {
public class ChooseByIdAction extends AbstractMapTool {
private ChooseByIdDialog chooseByIdDialog; private ChooseByIdDialog chooseByIdDialog;
/* public ChooseByIdAction() {
* (non-Javadoc) super("bundles/tools/ChooseById.xml");
* }
* @see com.raytheon.viz.ui.tools.AbstractTool#runTool()
*/
@Override @Override
public Object execute(ExecutionEvent arg0) throws ExecutionException { public Object execute(ExecutionEvent arg0) throws ExecutionException {
super.execute(arg0);
if (editor.getActiveDisplayPane().getDescriptor() instanceof MapDescriptor) {
if (chooseByIdDialog == null || chooseByIdDialog.isDisposed()) { if (chooseByIdDialog == null || chooseByIdDialog.isDisposed()) {
chooseByIdDialog = new ChooseByIdDialog(PlatformUI chooseByIdDialog = new ChooseByIdDialog(PlatformUI.getWorkbench()
.getWorkbench().getActiveWorkbenchWindow().getShell()); .getActiveWorkbenchWindow().getShell());
chooseByIdDialog.setHomeResource(getResource(
HomeToolLayer.class, HomeToolAction.class));
chooseByIdDialog.setPointsResource(getResource(
PointsToolLayer.class, PointsToolAction.class));
chooseByIdDialog.setBaslinesResource(getResource(
InteractiveBaselinesLayer.class,
BaselinesToolAction.class));
chooseByIdDialog.setDescriptor(editor.getActiveDisplayPane()
.getDescriptor());
chooseByIdDialog.open(); chooseByIdDialog.open();
chooseByIdDialog = null;
} else { } else {
chooseByIdDialog.setDescriptor(editor.getActiveDisplayPane()
.getDescriptor());
// find and activate the dialog // find and activate the dialog
for (Shell s : chooseByIdDialog.getParent().getShells()) { for (Shell s : chooseByIdDialog.getParent().getShells()) {
@ -99,62 +68,7 @@ public class ChooseByIdAction extends AbstractMapTool {
} }
} }
} }
} else { return super.execute(arg0);
// If a map editor is open, activate and use. Otherwise, create one.
AbstractRenderableDisplay display = null;
String editorId = DescriptorMap.getEditorId(MapDescriptor.class
.getName());
IEditorPart editorPart = EditorUtil.findEditor(editorId);
if (editorPart == null) {
try {
new NewMapEditor().execute(null);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
editorPart = EditorUtil.findEditor(editorId);
}
AbstractEditor editor = (AbstractEditor) editorPart;
display = (AbstractRenderableDisplay) editor.getActiveDisplayPane()
.getRenderableDisplay().createNewDisplay();
try {
display.setDescriptor(new MapDescriptor());
} catch (VizException e) {
throw new RuntimeException(e);
}
AbstractEditor mapEditor = UiUtil.createOrOpenEditor(
VizMapEditor.EDITOR_ID, display);
if (chooseByIdDialog == null || chooseByIdDialog.isDisposed()) {
chooseByIdDialog = new ChooseByIdDialog(PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getShell());
chooseByIdDialog.setHomeResource(getResource(
HomeToolLayer.class, HomeToolAction.class));
chooseByIdDialog.setPointsResource(getResource(
PointsToolLayer.class, PointsToolAction.class));
chooseByIdDialog.setBaslinesResource(getResource(
InteractiveBaselinesLayer.class,
BaselinesToolAction.class));
chooseByIdDialog.setDescriptor(mapEditor.getActiveDisplayPane()
.getDescriptor());
chooseByIdDialog.open();
chooseByIdDialog = null;
} else {
chooseByIdDialog.setDescriptor(mapEditor.getActiveDisplayPane()
.getDescriptor());
// find and activate the dialog
for (Shell s : chooseByIdDialog.getParent().getShells()) {
if (s.getText().equals(ChooseByIdDialog.DIALOG_TITLE)) {
s.setVisible(true);
s.setActive();
}
}
}
}
return null;
} }
} }

View file

@ -19,9 +19,9 @@
**/ **/
package com.raytheon.viz.awipstools.ui.action; package com.raytheon.viz.awipstools.ui.action;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData; import org.eclipse.core.commands.ExecutionEvent;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.viz.awipstools.ui.layer.DistanceBearingToolLayer; import com.raytheon.viz.ui.actions.LoadBundleHandler;
/** /**
* Handles the Distance Bearing Tools Action. * Handles the Distance Bearing Tools Action.
@ -31,30 +31,23 @@ import com.raytheon.viz.awipstools.ui.layer.DistanceBearingToolLayer;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Sep272007 #455 ebabin Initial Creation. * Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* Oct012007 #471 ebabin Clean up Clear handling.
* 10-21-09 #1711 bsteffen Refactor to common MovableTool model
* *
* </pre> * </pre>
* *
* @author ebabin * @author bsteffen
* @version 1 * @version 2.0
* @deprecated Use {@link LoadBundleHandler} with
* bundleFile="bundles/tools/DistanceBearing.xml".
*/ */
@Deprecated
public class DistanceBearingToolAction extends public class DistanceBearingToolAction extends
AbstractGenericToolAction<DistanceBearingToolLayer> { LoadBundleHandler {
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
*/
@Override @Override
protected GenericToolsResourceData<DistanceBearingToolLayer> getResourceData() { protected String getBundleFile(ExecutionEvent event) {
return new GenericToolsResourceData<DistanceBearingToolLayer>( return "bundles/tools/DistanceBearing.xml";
DistanceBearingToolLayer.DEFAULT_NAME,
DistanceBearingToolLayer.class);
} }
} }

View file

@ -19,25 +19,33 @@
**/ **/
package com.raytheon.viz.awipstools.ui.action; package com.raytheon.viz.awipstools.ui.action;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.maps.actions.NewMapEditor;
import com.raytheon.uf.viz.core.maps.display.VizMapEditor;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData; import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction; import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.viz.awipstools.ui.layer.DistanceSpeedLayer; import com.raytheon.viz.awipstools.ui.layer.DistanceSpeedLayer;
import com.raytheon.viz.ui.EditorUtil;
/** /**
* Handles Distance Speed tool creation. * Loads a {@link DistanceSpeedLayer} to a {@link VizMapEditor}.
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Oct172007 #495 ebabin Initial Creation. * Oct 17, 2007 495 ebabin Initial Creation.
* Feb152011 #7975 bkowal Restore the DistanceSpeedLayer * Feb 15, 2011 7975 bkowal Restore the DistanceSpeedLayer
* associated with the Display Pane. * associated with the Display Pane.
* Aug 30, 2013 2310 bsteffen Ensure tool is used on a map editor.
* *
* </pre> * </pre>
* *
@ -48,6 +56,17 @@ import com.raytheon.viz.awipstools.ui.layer.DistanceSpeedLayer;
public class DistanceSpeedAction extends public class DistanceSpeedAction extends
AbstractGenericToolAction<DistanceSpeedLayer> { AbstractGenericToolAction<DistanceSpeedLayer> {
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
IEditorPart editorPart = EditorUtil.findEditor(VizMapEditor.EDITOR_ID);
if (editorPart == null) {
new NewMapEditor().execute(arg0);
} else {
editorPart.getSite().getPage().bringToTop(editorPart);
}
return super.execute(arg0);
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *

View file

@ -20,9 +20,7 @@
package com.raytheon.viz.awipstools.ui.action; package com.raytheon.viz.awipstools.ui.action;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData; import com.raytheon.viz.ui.actions.LoadBundleHandler;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.viz.awipstools.common.DistanceTool;
/** /**
* Action for opening the distance tool * Action for opening the distance tool
@ -32,25 +30,21 @@ import com.raytheon.viz.awipstools.common.DistanceTool;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* 1/10/08 562 bphillip Initial Creation. * Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* *
* </pre> * </pre>
* *
* @author bphillip * @author bsteffen
* * @version 2.0
* @deprecated Use {@link LoadBundleHandler} with
* bundleFile="bundles/tools/DistanceScale.xml".
*/ */
public class DistanceToolAction extends AbstractGenericToolAction<DistanceTool> { @Deprecated
public class DistanceToolAction extends LoadBundleHandler {
/* public DistanceToolAction() {
* (non-Javadoc) super("bundles/tools/DistanceScale.xml");
*
* @see
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
*/
@Override
protected GenericToolsResourceData<DistanceTool> getResourceData() {
return new GenericToolsResourceData<DistanceTool>("Distance Scale",
DistanceTool.class);
} }
} }

View file

@ -19,39 +19,33 @@
**/ **/
package com.raytheon.viz.awipstools.ui.action; package com.raytheon.viz.awipstools.ui.action;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
import com.raytheon.viz.awipstools.ui.layer.EstimatedActualVelocityLayer; import com.raytheon.viz.awipstools.ui.layer.EstimatedActualVelocityLayer;
import com.raytheon.viz.awipstools.ui.layer.ShearLayer; import com.raytheon.viz.ui.actions.LoadBundleHandler;
/** /**
* TODO Add Description * Loads a {@link EstimatedActualVelocityLayer} from the
* bundles/tools/EstimatedActualVelocity.xml localization file.
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* *
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Sep 03, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* *
* </pre> * </pre>
* *
* @author mnash * @author bsteffen
* @version 1.0 * @version 2.0
* @deprecated Use {@link LoadBundleHandler} with
* bundleFile="bundles/tools/EstimatedActualVelocity.xml".
*/ */
@Deprecated
public class EstimatedActualVelocityAction extends LoadBundleHandler {
public class EstimatedActualVelocityAction extends ShearAction { public EstimatedActualVelocityAction() {
super("bundles/tools/EstimatedActualVelocity.xml");
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
*/
@Override
protected GenericToolsResourceData<ShearLayer> getResourceData() {
return new GenericToolsResourceData<ShearLayer>(
EstimatedActualVelocityLayer.EST_ACT_VEL_LOCATION,
EstimatedActualVelocityLayer.class);
} }
} }

View file

@ -19,9 +19,7 @@
******************************************************************************************/ ******************************************************************************************/
package com.raytheon.viz.awipstools.ui.action; package com.raytheon.viz.awipstools.ui.action;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData; import com.raytheon.viz.ui.actions.LoadBundleHandler;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.viz.awipstools.ui.layer.FeatureFollowingZoomLayer;
/** /**
* Action for feature follow zoom * Action for feature follow zoom
@ -29,28 +27,23 @@ import com.raytheon.viz.awipstools.ui.layer.FeatureFollowingZoomLayer;
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* *
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* *
* </pre> * </pre>
* *
* @author mschenke * @author bsteffen
* @version 1.0 * @version 2.0
* @deprecated Use {@link LoadBundleHandler} with
* bundleFile="bundles/tools/FeatureFollowingZoom.xml".
*/ */
@Deprecated
public class FeatureFollowingZoomAction extends LoadBundleHandler {
public class FeatureFollowingZoomAction extends public FeatureFollowingZoomAction() {
AbstractGenericToolAction<FeatureFollowingZoomLayer> { super("bundles/tools/FeatureFollowingZoom.xml");
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
*/
@Override
protected GenericToolsResourceData<FeatureFollowingZoomLayer> getResourceData() {
return new GenericToolsResourceData<FeatureFollowingZoomLayer>(
"Feature Following Zoom", FeatureFollowingZoomLayer.class);
} }
} }

View file

@ -19,25 +19,7 @@
**/ **/
package com.raytheon.viz.awipstools.ui.action; package com.raytheon.viz.awipstools.ui.action;
import java.util.Iterator; import com.raytheon.viz.ui.actions.LoadBundleHandler;
import java.util.LinkedList;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
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.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.viz.awipstools.ui.layer.HomeToolLayer;
import com.raytheon.viz.ui.input.EditableManager;
/** /**
* Show 'Home' location. Also shows range and home from home. * Show 'Home' location. Also shows range and home from home.
@ -47,98 +29,18 @@ import com.raytheon.viz.ui.input.EditableManager;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Aug242007 #429 ebabin Initial Creation. * Sep 03, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* 25Oct2007 #499 ebaibn Added sampling switch to mouseMove action. *
* 19Dec2007 #647 ebabin Fix mouse following issue..
* 10-21-09 #1049 bsteffen Refactor to common MovableTool model
* </pre> * </pre>
* *
* @author ebabin * @author bsteffen
* @version 1 * @version 2.0
*/ */
public class HomeToolAction extends AbstractGenericToolAction<HomeToolLayer> { public class HomeToolAction extends LoadBundleHandler {
private static final transient IUFStatusHandler statusHandler = UFStatus public HomeToolAction() {
.getHandler(HomeToolAction.class); super("bundles/tools/Home.xml");
private HomeToolLayer resource;
/**
* check the descriptor for a reference to the passed in HomeToolLayer
*
* @param resource
* @return
*/
private HomeToolLayer checkAndGetResource() {
LinkedList<HomeToolLayer> resources = new LinkedList<HomeToolLayer>();
// looking for this exact resource, not one that is equivalent
for (IDisplayPane pane : getSelectedPanes()) {
IDescriptor desc = pane.getDescriptor();
Iterator<ResourcePair> iter = desc.getResourceList().iterator();
while (iter.hasNext()) {
ResourcePair pair = iter.next();
AbstractVizResource<?, ?> rsc = pair.getResource();
if (rsc instanceof HomeToolLayer) {
resources.add((HomeToolLayer) rsc);
}
}
} }
if (resources.size() > 0) {
if (resources.size() > 1) {
statusHandler.handle(Priority.EVENTA,
"More than one HomeToolLayer found! (found "
+ resources.size() + ")");
}
return resources.getFirst();
} else {
return null;
}
}
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
boolean turnOnEditable = false;
// if the descriptor has the saved resource then enable editable
if ((resource = checkAndGetResource()) != null) {
turnOnEditable = true;
}
Object rval = super.execute(arg0);
// make resource editable if needed
if (turnOnEditable && resource != null) {
EditableManager.makeEditable(resource, true);
}
return rval;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
*/
@Override
protected GenericToolsResourceData<HomeToolLayer> getResourceData() {
return new GenericToolsResourceData<HomeToolLayer>(
HomeToolLayer.DEFAULT_NAME, HomeToolLayer.class);
}
@Override
protected HomeToolLayer getResource(LoadProperties loadProperties,
IDescriptor descriptor) throws VizException {
if (resource == null || data == null) {
// if the resource or resourcedata is null then it needs to be
// rebuilt
resource = super.getResource(loadProperties, descriptor);
}
return resource;
}
} }

View file

@ -26,49 +26,40 @@ import org.eclipse.ui.PlatformUI;
import com.raytheon.viz.awipstools.ui.dialog.PutHomeCursorDialog; import com.raytheon.viz.awipstools.ui.dialog.PutHomeCursorDialog;
import com.raytheon.viz.awipstools.ui.layer.HomeToolLayer; import com.raytheon.viz.awipstools.ui.layer.HomeToolLayer;
import com.raytheon.viz.ui.tools.map.AbstractMapTool;
/** /**
* TODO Add Description * Opens the {@link PutHomeCursorDialog} and loads the {@link HomeToolLayer}
* bundles/tools/Home.xml localization file.
* *
* <pre> * <pre>
*
* SOFTWARE HISTORY * SOFTWARE HISTORY
*
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* 10-21-09 #1049 bsteffen Synchronize with new Home Tool Layer * Sep 03, 2013 2310 bsteffen Rewritten to extend HomeToolAction.
* *
* </pre> * </pre>
* *
* @author ebabin * @author bsteffen
* @version 1.0 * @version 2.0
*/ */
public class PutHomeCursorAction extends HomeToolAction {
public class PutHomeCursorAction extends AbstractMapTool {
private PutHomeCursorDialog putHomeCursorDialog; private PutHomeCursorDialog putHomeCursorDialog;
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.tools.AbstractTool#runTool()
*/
@Override @Override
public Object execute(ExecutionEvent arg0) throws ExecutionException { public Object execute(ExecutionEvent arg0) throws ExecutionException {
super.execute(arg0);
HomeToolLayer homeToolLayer = (HomeToolLayer) getResource(
HomeToolLayer.class, HomeToolAction.class);
if (putHomeCursorDialog == null if (putHomeCursorDialog == null
|| putHomeCursorDialog.getShell() == null) { || putHomeCursorDialog.getShell() == null) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell(); .getShell();
putHomeCursorDialog = new PutHomeCursorDialog(shell, homeToolLayer putHomeCursorDialog = new PutHomeCursorDialog(shell);
.getResourceData()); putHomeCursorDialog.setBlockOnOpen(false);
putHomeCursorDialog.open(); putHomeCursorDialog.open();
} }
return null; return super.execute(arg0);
} }
} }

View file

@ -19,38 +19,33 @@
**/ **/
package com.raytheon.viz.awipstools.ui.action; package com.raytheon.viz.awipstools.ui.action;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.viz.awipstools.ui.layer.RangeRingsLayer; import com.raytheon.viz.awipstools.ui.layer.RangeRingsLayer;
import com.raytheon.viz.ui.actions.LoadBundleHandler;
/** /**
* Handles the RangeRing Tools Action. * Loads a {@link RangeRingsLayer} from the bundles/tools/RangeRings.xml
* localization file.
* *
* <pre> * <pre>
*
* SOFTWARE HISTORY * SOFTWARE HISTORY
*
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* 10-21-09 #717 bsteffen Refactor to common MovableTool model * Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* *
* </pre> * </pre>
* *
* @author ebabin * @author bsteffen
* @version 1.0 * @version 2.0
* @deprecated Use {@link LoadBundleHandler} with
* bundleFile="bundles/tools/RangeRings.xml".
*/ */
@Deprecated
public class RangeRingsAction extends LoadBundleHandler {
public class RangeRingsAction extends AbstractGenericToolAction<RangeRingsLayer> { public RangeRingsAction() {
super("bundles/tools/RangeRings.xml");
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
*/
@Override
protected GenericToolsResourceData<RangeRingsLayer> getResourceData() {
return new GenericToolsResourceData<RangeRingsLayer>(
RangeRingsLayer.DEFAULT_NAME, RangeRingsLayer.class);
} }
} }

View file

@ -1,243 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.awipstools.ui.action;
import org.eclipse.swt.SWT;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.viz.awipstools.ui.layer.ShearLayer;
import com.raytheon.viz.ui.input.InputAdapter;
import com.vividsolutions.jts.geom.Coordinate;
/**
* Handles the shear action.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 11, 2010 mnash
* Aug 29, 2013 2281 bsteffen Fix click distance calculations.
*
* </pre>
*
* @author mnash
* @version 1.0
*/
public abstract class ShearAction extends AbstractGenericToolAction<ShearLayer> {
protected ShearLayer getResource(LoadProperties loadProperties,
IDescriptor descriptor) throws VizException {
ShearLayer sLayer = super.getResource(loadProperties, descriptor);
sLayer.setMouseHandler(new MouseHandler(sLayer));
return sLayer;
}
/**
* Associated navigation modes:
* <UL>
* <LI>CREATE - Create the initial baseline
* <LI>MOVE_LINE - Move an existing line within the baseline.
* <LI>MOVE_POINT - Move one endpoint of an existing baseline linestring.
* <LI>PAN - Allow other tools, such as pan, to have control
*/
private enum Mode {
CREATE, MOVE_LINE, MOVE_POINT, PAN
};
public class MouseHandler extends InputAdapter {
private int indexOfMovedEndpoint;
private ShearLayer shearLayer;
/** The mode of the mouse. By default, create */
private Mode mode = Mode.CREATE;
/** The last mouse position - x */
private int lastMouseX = -1;
/** The last mouse position - y */
private int lastMouseY = -1;
/** The index of the line to be moved */
private int lineToMove;
/** The millisecond time of the right mouse button down event */
private long rightMouseButtonDownTime;
private Coordinate coordinateMoved;
private Coordinate coordinateFound = null;
public MouseHandler(ShearLayer shearLayer) {
this.shearLayer = shearLayer;
}
public boolean handleMouseDown(int x, int y, int mouseButton) {
lastMouseX = x;
lastMouseY = y;
if (shearLayer.isEditable()) {
if (mouseButton == 1) {
lineToMove = -1;
coordinateFound = shearLayer.isInsideEndpoint(editor, x, y);
if (coordinateFound != null) {
this.mode = Mode.MOVE_POINT;
coordinateMoved = coordinateFound;
return true;
}
if ((lineToMove = shearLayer.isInsideLine(editor, x, y)) != -1) {
this.mode = Mode.MOVE_LINE;
return true;
}
} else if (mouseButton == 3) {
// move prior unmoved end point
this.rightMouseButtonDownTime = System.currentTimeMillis();
}
} else {
this.mode = Mode.PAN;
}
editor.refresh();
return false;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.map.IMouseHandler#handleMouseDownMove(int,
* int)
*/
public boolean handleMouseDownMove(int x, int y, int button) {
if (button != 1)
return false;
if (this.mode == Mode.PAN)
return false;
if (this.mode == Mode.MOVE_LINE || this.mode == Mode.MOVE_POINT) {
Coordinate c = editor.translateClick(lastMouseX, lastMouseY);
Coordinate c2 = editor.translateClick(x, y);
Coordinate delta = new Coordinate(c2.x - c.x, c2.y - c.y);
if (this.mode == Mode.MOVE_LINE) {
shearLayer.moveBaseline(delta, this.lineToMove);
} else {
shearLayer.movePoint(delta, coordinateMoved);
}
lastMouseX = x;
lastMouseY = y;
editor.refresh();
return true;
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.map.IMouseHandler#handleMouseUp(int, int)
*/
public boolean handleMouseUp(int x, int y, int mouseButton) {
if (mouseButton == 3) {
if (System.currentTimeMillis() - this.rightMouseButtonDownTime < 275) {
Coordinate c = editor.translateClick(x, y);
// move prior unmoved end point
Coordinate[] coords = shearLayer.getBaseline()
.getCoordinates();
indexOfMovedEndpoint = (indexOfMovedEndpoint >= coords.length - 1) ? 0
: ++indexOfMovedEndpoint;
Coordinate coord = coords[indexOfMovedEndpoint];
Coordinate delta = new Coordinate(c.x - coord.x, c.y
- coord.y, c.z - coord.z);
shearLayer.movePoint(delta, coord);
}
} else if (this.mode == Mode.PAN)
return false;
// Default back to pan operation
mode = Mode.PAN;
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.mouse.IMouseHandler#handleMouseMove(int,
* int)
*/
public boolean handleMouseMove(int x, int y) {
if (shearLayer.isEditable()) {
if (shearLayer.isInsideEndpoint(editor, x, y) != null) {
// Change the cursor to a hand.
this.setCursorHand();
return true;
}
if (shearLayer.isInsideLine(editor, x, y) != -1) {
// Change the cursor to crosshairs.
this.setCursorCross();
return true;
}
}
this.changeCursorNormal();
return false;
}
protected void changeCursorNormal() {
this.updateCursorStandard(SWT.CURSOR_ARROW);
}
private void setCursorHand() {
this.updateCursorStandard(SWT.CURSOR_HAND);
}
private void setCursorCross() {
this.updateCursorStandard(SWT.CURSOR_SIZEALL);
}
private void updateCursorStandard(int cursorEnum) {
IWorkbenchWindow window = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow();
window.getShell().setCursor(
window.getShell().getDisplay().getSystemCursor(cursorEnum));
}
}
}

View file

@ -19,38 +19,33 @@
**/ **/
package com.raytheon.viz.awipstools.ui.action; package com.raytheon.viz.awipstools.ui.action;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
import com.raytheon.viz.awipstools.ui.layer.ShearLayer;
import com.raytheon.viz.awipstools.ui.layer.VRShearLayer; import com.raytheon.viz.awipstools.ui.layer.VRShearLayer;
import com.raytheon.viz.ui.actions.LoadBundleHandler;
/** /**
* Handles the VR Shear Action. * Loads a {@link VRShearLayer} from the bundles/tools/VRShear.xml localization
* file.
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Oct172007 #492 ebabin Initial Creation. * Sep 03, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
* *
* </pre> * </pre>
* *
* @author ebabin * @author bsteffen
* @version 1 * @version 2.0
* @deprecated Use {@link LoadBundleHandler} with
* bundleFile="bundles/tools/VRShear.xml".
*/ */
public class VRShearAction extends ShearAction { @Deprecated
public class VRShearAction extends LoadBundleHandler {
/* public VRShearAction() {
* (non-Javadoc) super("bundles/tools/VRShear.xml");
*
* @see
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
*/
@Override
protected GenericToolsResourceData<ShearLayer> getResourceData() {
return new GenericToolsResourceData<ShearLayer>(
VRShearLayer.VRSHEAR_LOCATION, VRShearLayer.class);
} }
} }

View file

@ -30,8 +30,6 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
@ -65,21 +63,18 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.HDF5Util; import com.raytheon.uf.viz.core.HDF5Util;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.VizConstants;
import com.raytheon.uf.viz.core.catalog.LayerProperty; import com.raytheon.uf.viz.core.catalog.LayerProperty;
import com.raytheon.uf.viz.core.catalog.ScriptCreator; import com.raytheon.uf.viz.core.catalog.ScriptCreator;
import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.comm.Loader;
import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.core.rsc.ResourceType; import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.points.IPointChangedListener; import com.raytheon.uf.viz.points.IPointChangedListener;
import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.uf.viz.points.PointsDataManager;
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer; import com.raytheon.viz.awipstools.IToolChangedListener;
import com.raytheon.viz.awipstools.ToolsDataManager; import com.raytheon.viz.awipstools.ToolsDataManager;
import com.raytheon.viz.awipstools.ui.layer.HomeToolLayer;
import com.raytheon.viz.awipstools.ui.layer.InteractiveBaselinesLayer;
import com.raytheon.viz.ui.UiPlugin; import com.raytheon.viz.ui.UiPlugin;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
@ -91,13 +86,15 @@ import com.vividsolutions.jts.geom.GeometryFactory;
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* 07Dec2007 #576 Eric Babin Initial Creation. * Dec 07, 2007 576 Eric Babin Initial Creation.
* 23Jul2010 #5948 bkowal Added the ability to move * Jul 23, 2010 5948 bkowal Added the ability to move a point to the
* a point to the location of a * location of a &quot;mesocyclone&quot;.
* &quot;mesocyclone&quot;. * Jul 31, 2012 875 rferrel Let preopen initialize components.
* 31Jul2012 #875 rferrel Let preopen initialize components. * Nov 05, 2012 1304 rferrel Added Point Change Listener.
* 05Nov2012 #1304 rferrel Added Point Change Listener. * Sep 03, 2013 2310 bsteffen Use IPointChangedListener and
* IToolChangedListener instead of
* IResourceDataChanged.
* *
* </pre> * </pre>
* *
@ -116,20 +113,12 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
private Button pointsRdo, baselinesRdo, homeRdo; private Button pointsRdo, baselinesRdo, homeRdo;
private HomeToolLayer homeToolLayer; private final List<ChooseByIdKeyListener> changeListeners = new ArrayList<ChooseByIdKeyListener>();
private PointsToolLayer pointsToolLayer;
private InteractiveBaselinesLayer baselinesToolLayer;
private final List<IResourceDataChanged> changeListeners = new ArrayList<IResourceDataChanged>();
private final List<Text> pointStationIdTextFields; private final List<Text> pointStationIdTextFields;
private final List<Text> baselineStationIdTextFields; private final List<Text> baselineStationIdTextFields;
private IDescriptor descriptor;
private final PointsDataManager pointsDataManager = PointsDataManager private final PointsDataManager pointsDataManager = PointsDataManager
.getInstance(); .getInstance();
@ -190,7 +179,7 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
} }
private class ChooseByIdKeyListener implements KeyListener, private class ChooseByIdKeyListener implements KeyListener,
IResourceDataChanged { IPointChangedListener, IToolChangedListener {
private final String idName; private final String idName;
@ -273,8 +262,7 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
if (obStation != null) { if (obStation != null) {
c = obStation.getGeometry().getCoordinate(); c = obStation.getGeometry().getCoordinate();
} else { } else {
c = this.getDmdInformation(stationID, c = this.getDmdInformation(stationID);
descriptor.getNumberOfFrames());
} }
if (c == null) { if (c == null) {
@ -326,39 +314,32 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
if (isPoint()) { if (isPoint()) {
pointsDataManager.setCoordinate(idName, pointsDataManager.setCoordinate(idName,
stationCoordinates.get(0)); stationCoordinates.get(0));
refreshToolLayer(pointsToolLayer); pointsDataManager.addPointsChangedListener(this);
} else if (isBaseline()) { } else if (isBaseline()) {
toolsDataManager.setBaseline(idName, (new GeometryFactory()) toolsDataManager.setBaseline(idName, (new GeometryFactory())
.createLineString(stationCoordinates .createLineString(stationCoordinates
.toArray(new Coordinate[] {}))); .toArray(new Coordinate[] {})));
refreshToolLayer(baselinesToolLayer); toolsDataManager.addBaselinesChangedListener(this);
} else if (isHome()) { } else if (isHome()) {
pointsDataManager.setHome(stationCoordinates.get(0)); pointsDataManager.setHome(stationCoordinates.get(0));
refreshToolLayer(homeToolLayer); pointsDataManager.addHomeChangedListener(this);
} }
}
/**
* @param toolLayer
*/
private void refreshToolLayer(AbstractVizResource<?, ?> toolLayer) {
if (toolLayer != null) {
toolLayer.getResourceData().fireChangeListeners(
ChangeType.DATA_UPDATE, null);
toolLayer.getResourceData().addChangeListener(this);
changeListeners.add(this); changeListeners.add(this);
} }
}
/** /**
* *
* @param mesoId * @param mesoId
* @param frameCount
* @return * @return
*/ */
private Coordinate getDmdInformation(String mesoId, int frameCount) { private Coordinate getDmdInformation(String mesoId) {
int frameCount = 64;
Object framesObj = VizGlobalsManager.getCurrentInstance()
.getPropery(VizConstants.FRAMES_ID);
if (framesObj instanceof Integer) {
frameCount = (Integer) framesObj;
}
Coordinate c = null; Coordinate c = null;
RadarRecord rr = null; RadarRecord rr = null;
@ -507,17 +488,23 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
this.isBaseline = isBaseline; this.isBaseline = isBaseline;
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.core.rsc.IResourceDataChanged#resourceChanged
* (com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType,
* java.lang.Object)
*/
@Override @Override
public void resourceChanged(ChangeType type, Object object) { public void pointChanged() {
toolChanged();
}
@Override
public void toolChanged() {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
handleChange();
}
});
}
public void handleChange() {
boolean stationLocationHasChanged = false; boolean stationLocationHasChanged = false;
if (stationCoordinates == null || stationCoordinates.size() == 0) { if (stationCoordinates == null || stationCoordinates.size() == 0) {
@ -569,7 +556,7 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
} }
public ChooseByIdDialog(Shell parentShell) { public ChooseByIdDialog(Shell parentShell) {
super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText(DIALOG_TITLE); setText(DIALOG_TITLE);
pointStationIdTextFields = new ArrayList<Text>(); pointStationIdTextFields = new ArrayList<Text>();
@ -595,15 +582,6 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
} }
}); });
// remove registered listeners when closing the dialog
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
unregisterListeners();
}
});
shell.pack(); shell.pack();
shell.setMinimumSize(new Point(340, 570)); shell.setMinimumSize(new Point(340, 570));
} }
@ -612,13 +590,10 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
* *
*/ */
private void unregisterListeners() { private void unregisterListeners() {
for (IResourceDataChanged changeListener : changeListeners) { for (ChooseByIdKeyListener changeListener : changeListeners) {
homeToolLayer.getResourceData() pointsDataManager.removePointsChangedListener(changeListener);
.removeChangeListener(changeListener); pointsDataManager.removeHomeChangedListener(changeListener);
pointsToolLayer.getResourceData().removeChangeListener( toolsDataManager.removeBaselinesChangedListener(changeListener);
changeListener);
baselinesToolLayer.getResourceData().removeChangeListener(
changeListener);
} }
} }
@ -839,34 +814,10 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
baselineStationIdTextFields)); baselineStationIdTextFields));
} }
/**
* @param containsResource
*/
public void setHomeResource(AbstractVizResource<?, ?> containsResource) {
this.homeToolLayer = (HomeToolLayer) containsResource;
}
/**
* @param containsResource
*/
public void setPointsResource(AbstractVizResource<?, ?> containsResource) {
this.pointsToolLayer = (PointsToolLayer) containsResource;
}
/**
* @param containsResource
*/
public void setBaslinesResource(AbstractVizResource<?, ?> containsResource) {
this.baselinesToolLayer = (InteractiveBaselinesLayer) containsResource;
}
public void setDescriptor(IDescriptor descriptor) {
this.descriptor = descriptor;
}
@Override @Override
protected void disposed() { protected void disposed() {
pointsDataManager.removePointsChangedListener(this); pointsDataManager.removePointsChangedListener(this);
unregisterListeners();
} }
@Override @Override

View file

@ -25,19 +25,24 @@ package com.raytheon.viz.awipstools.ui.dialog;
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Dec 5 2007 Eric Babin Initial Creation * Dec 05, 2007 Eric Babin Initial Creation
* 10Dec2007 #598 Eric Babin Added city, state query. * Dec 10, 2007 598 Eric Babin Added city, state query.
* 20Dec2007 #656 Eric Babin Updated to refresh location after clicking GO. * Dec 20, 2007 656 Eric Babin Updated to refresh location after
* 15Jan2007 ebabin Update for lat/lon put home cursor bug. * clicking GO.
* 10-21-09 #1049 bsteffen Synchronize with new Home Tool Layer * Jan 15, 2007 ebabin Update for lat/lon put home cursor bug.
* 07-09-10 #3654 bkowal The stationid column will now be used in the * Oct 21, 2009 1049 bsteffen Synchronize with new Home Tool Layer
* station query instead of the icao column. * Jul 09, 2010 3654 bkowal The stationid column will now be used in
* 07-21-10 #3654 bkowal Added additional logic to increase the likelihood * the station query instead of the icao
* that we will get enough information to fill all * column.
* of the fields on the interface for the query by * Jul 21, 2010 3654 bkowal Added additional logic to increase the
* station id and the query by city, state. * likelihood that we will get enough
* information to fill all of the fields on
* the interface for the query by station id
* and the query by city, state.
* Sep 03, 2013 2310 bsteffen Extend IPointChangedListener instead of
* IResourceDataChanged.
*
* </pre> * </pre>
* *
* @author ebabin * @author ebabin
@ -72,9 +77,9 @@ import com.raytheon.uf.common.pointdata.spatial.ObStation;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData; import com.raytheon.uf.viz.points.IPointChangedListener;
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.uf.viz.points.PointsDataManager;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
@ -85,7 +90,7 @@ import com.vividsolutions.jts.io.WKBReader;
import com.vividsolutions.jts.io.WKTWriter; import com.vividsolutions.jts.io.WKTWriter;
public class PutHomeCursorDialog extends CaveJFACEDialog implements public class PutHomeCursorDialog extends CaveJFACEDialog implements
IResourceDataChanged { IPointChangedListener {
private static final transient IUFStatusHandler statusHandler = UFStatus private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(PutHomeCursorDialog.class); .getHandler(PutHomeCursorDialog.class);
@ -125,13 +130,10 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
private Button goButton, closeButton; private Button goButton, closeButton;
private final AbstractResourceData resourceData; public PutHomeCursorDialog(Shell shell) {
public PutHomeCursorDialog(Shell shell,
AbstractResourceData abstractResourceData) {
super(shell); super(shell);
this.setBlockOnOpen(false);
this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE);
this.resourceData = abstractResourceData;
} }
/* /*
@ -320,12 +322,13 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
@Override @Override
protected void configureShell(Shell shell) { protected void configureShell(Shell shell) {
super.configureShell(shell); super.configureShell(shell);
resourceData.addChangeListener(this); PointsDataManager.getInstance().addHomeChangedListener(this);
shell.addDisposeListener(new DisposeListener() { shell.addDisposeListener(new DisposeListener() {
@Override @Override
public void widgetDisposed(DisposeEvent e) { public void widgetDisposed(DisposeEvent e) {
resourceData.removeChangeListener(PutHomeCursorDialog.this); PointsDataManager.getInstance().removeHomeChangedListener(
PutHomeCursorDialog.this);
} }
}); });
shell.setText("Put Home Cursor"); shell.setText("Put Home Cursor");
@ -346,7 +349,7 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
* Exits the dialog. * Exits the dialog.
*/ */
private void exitDialog() { private void exitDialog() {
this.resourceData.removeChangeListener(this); PointsDataManager.getInstance().removeHomeChangedListener(this);
this.close(); this.close();
} }
@ -367,8 +370,6 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
stationTextField.setFocus(); stationTextField.setFocus();
} else { } else {
PointsDataManager.getInstance().setHome(c); PointsDataManager.getInstance().setHome(c);
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE,
null);
stationTextField.setText(station); stationTextField.setText(station);
} }
} else { } else {
@ -401,7 +402,6 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
cityTextField.setFocus(); cityTextField.setFocus();
} else { } else {
PointsDataManager.getInstance().setHome(c); PointsDataManager.getInstance().setHome(c);
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
cityTextField.setText(city); cityTextField.setText(city);
stateTextField.setText(state); stateTextField.setText(state);
} }
@ -434,7 +434,6 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
return; return;
} }
PointsDataManager.getInstance().setHome(c); PointsDataManager.getInstance().setHome(c);
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
} }
} }
@ -584,12 +583,19 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
} }
@Override @Override
public void resourceChanged(ChangeType type, Object object) { public void pointChanged() {
VizApp.runAsync(new Runnable() {
@Override
public void run() {
Coordinate point = PointsDataManager.getInstance().getHome(); Coordinate point = PointsDataManager.getInstance().getHome();
lonTextField.setText(String.valueOf(point.x)); lonTextField.setText(String.valueOf(point.x));
latTextField.setText(String.valueOf(point.y)); latTextField.setText(String.valueOf(point.y));
// find the nearest station and update the fields. // find the nearest station and update the fields.
updateStationInfo(point); updateStationInfo(point);
} }
});
}
} }

View file

@ -25,7 +25,10 @@ import java.util.regex.Pattern;
import javax.measure.converter.UnitConverter; import javax.measure.converter.UnitConverter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.geotools.referencing.GeodeticCalculator; import org.geotools.referencing.GeodeticCalculator;
import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.crs.CoordinateReferenceSystem;
@ -51,6 +54,7 @@ import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.uf.viz.points.PointsDataManager;
import com.raytheon.viz.awipstools.common.ToolsUiUtil; import com.raytheon.viz.awipstools.common.ToolsUiUtil;
import com.raytheon.viz.ui.input.EditableManager; import com.raytheon.viz.ui.input.EditableManager;
import com.raytheon.viz.ui.input.InputAdapter;
import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.LineString; import com.vividsolutions.jts.geom.LineString;
@ -62,10 +66,12 @@ import com.vividsolutions.jts.geom.LineString;
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- -------------- --------------------------
* Mar 15, 2013 15693 mgamazaychikov Added magnification capability. * Mar 15, 2013 15693 mgamazaychikov Added magnification capability.
* May 02, 2013 14587 D. Friedman Use base velocity. * May 02, 2013 14587 D. Friedman Use base velocity.
* Aug 29, 2013 2281 bsteffen Fix click distance calculations. * Aug 29, 2013 2281 bsteffen Fix click distance calculations.
* Sep 03, 2013 2310 bsteffen Move MouseHandler from ShearAction to
* ShearLayer.
* *
* </pre> * </pre>
* *
@ -95,6 +101,7 @@ public class ShearLayer extends
setDescriptor(descriptor); setDescriptor(descriptor);
gc = new GeodeticCalculator(this.descriptor.getCRS()); gc = new GeodeticCalculator(this.descriptor.getCRS());
this.baseline = createDefaultBaseline(); this.baseline = createDefaultBaseline();
this.mouseHandler = new MouseHandler(this);
} }
/* /*
@ -110,21 +117,6 @@ public class ShearLayer extends
} }
} }
/**
* @return the mouseHandler
*/
public IInputHandler getMouseHandler() {
return mouseHandler;
}
/**
* @param mouseHandler
* the mouseHandler to set
*/
public void setMouseHandler(IInputHandler mouseHandler) {
this.mouseHandler = mouseHandler;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -311,16 +303,18 @@ public class ShearLayer extends
/** /**
* Get the closest endpoint to the provided screen location. * Get the closest endpoint to the provided screen location.
* *
* @param container
* display container to use
* @param refX * @param refX
* x location in screen pixels * x location in screen pixels
* @param refY * @param refY
* y location in screen pixels * y location in screen pixels
* @return T Coordinate of the endpoint, null if not found. * @return T Coordinate of the endpoint, null if not found.
*/ */
public Coordinate isInsideEndpoint(IDisplayPaneContainer container, int x, public Coordinate isInsideEndpoint(int x,
int y) { int y) {
IDisplayPaneContainer container = getResourceContainer();
if (container == null) {
return null;
}
Coordinate[] coords = getBaseline().getCoordinates(); Coordinate[] coords = getBaseline().getCoordinates();
int idx = ToolsUiUtil.closeToCoordinate(container, coords, x, y, 9); int idx = ToolsUiUtil.closeToCoordinate(container, coords, x, y, 9);
if (idx < 0) { if (idx < 0) {
@ -334,17 +328,17 @@ public class ShearLayer extends
* Return the index of the linestring the user clicked in (for move for * Return the index of the linestring the user clicked in (for move for
* instance). * instance).
* *
* @param container
* display container to use
* @param refX * @param refX
* x location of reference point in screen pixels * x location of reference point in screen pixels
* @param refY * @param refY
* y location of reference point in screen pixels * y location of reference point in screen pixels
* @return int Index of line they matched on. * @return int Index of line they matched on.
*/ */
public int isInsideLine(IDisplayPaneContainer container, int x, int y) { public int isInsideLine(int x, int y) {
IDisplayPaneContainer container = getResourceContainer();
Coordinate[] coords = getBaseline().getCoordinates(); Coordinate[] coords = getBaseline().getCoordinates();
if (ToolsUiUtil.closeToLine(container, coords, x, y, 15)) { if (container != null
&& ToolsUiUtil.closeToLine(container, coords, x, y, 15)) {
return 0; return 0;
} else { } else {
return -1; return -1;
@ -516,4 +510,198 @@ public class ShearLayer extends
} }
} }
/**
* Associated navigation modes:
* <UL>
* <LI>CREATE - Create the initial baseline
* <LI>MOVE_LINE - Move an existing line within the baseline.
* <LI>MOVE_POINT - Move one endpoint of an existing baseline linestring.
* <LI>PAN - Allow other tools, such as pan, to have control
*/
private static enum Mode {
CREATE, MOVE_LINE, MOVE_POINT, PAN
};
private static class MouseHandler extends InputAdapter {
private int indexOfMovedEndpoint;
private ShearLayer shearLayer;
/** The mode of the mouse. By default, create */
private Mode mode = Mode.CREATE;
/** The last mouse position - x */
private int lastMouseX = -1;
/** The last mouse position - y */
private int lastMouseY = -1;
/** The index of the line to be moved */
private int lineToMove;
/** The millisecond time of the right mouse button down event */
private long rightMouseButtonDownTime;
private Coordinate coordinateMoved;
private Coordinate coordinateFound = null;
public MouseHandler(ShearLayer shearLayer) {
this.shearLayer = shearLayer;
}
public boolean handleMouseDown(int x, int y, int mouseButton) {
lastMouseX = x;
lastMouseY = y;
if (shearLayer.isEditable()) {
if (mouseButton == 1) {
lineToMove = -1;
coordinateFound = shearLayer.isInsideEndpoint(x, y);
if (coordinateFound != null) {
this.mode = Mode.MOVE_POINT;
coordinateMoved = coordinateFound;
return true;
}
if ((lineToMove = shearLayer.isInsideLine(x, y)) != -1) {
this.mode = Mode.MOVE_LINE;
return true;
}
} else if (mouseButton == 3) {
// move prior unmoved end point
this.rightMouseButtonDownTime = System.currentTimeMillis();
}
} else {
this.mode = Mode.PAN;
}
shearLayer.issueRefresh();
return false;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.map.IMouseHandler#handleMouseDownMove(int,
* int)
*/
public boolean handleMouseDownMove(int x, int y, int button) {
if (button != 1)
return false;
if (this.mode == Mode.PAN)
return false;
if (this.mode == Mode.MOVE_LINE || this.mode == Mode.MOVE_POINT) {
IDisplayPaneContainer container = shearLayer
.getResourceContainer();
if (container == null) {
return false;
}
Coordinate c = container.translateClick(lastMouseX, lastMouseY);
Coordinate c2 = container.translateClick(x, y);
Coordinate delta = new Coordinate(c2.x - c.x, c2.y - c.y);
if (this.mode == Mode.MOVE_LINE) {
shearLayer.moveBaseline(delta, this.lineToMove);
} else {
shearLayer.movePoint(delta, coordinateMoved);
}
lastMouseX = x;
lastMouseY = y;
shearLayer.issueRefresh();
return true;
}
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.map.IMouseHandler#handleMouseUp(int, int)
*/
public boolean handleMouseUp(int x, int y, int mouseButton) {
if (mouseButton == 3) {
if (System.currentTimeMillis() - this.rightMouseButtonDownTime < 275) {
IDisplayPaneContainer container = shearLayer
.getResourceContainer();
if (container == null) {
return false;
}
Coordinate c = container.translateClick(x, y);
// move prior unmoved end point
Coordinate[] coords = shearLayer.getBaseline()
.getCoordinates();
indexOfMovedEndpoint = (indexOfMovedEndpoint >= coords.length - 1) ? 0
: ++indexOfMovedEndpoint;
Coordinate coord = coords[indexOfMovedEndpoint];
Coordinate delta = new Coordinate(c.x - coord.x, c.y
- coord.y, c.z - coord.z);
shearLayer.movePoint(delta, coord);
}
} else if (this.mode == Mode.PAN)
return false;
// Default back to pan operation
mode = Mode.PAN;
return true;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.mouse.IMouseHandler#handleMouseMove(int,
* int)
*/
public boolean handleMouseMove(int x, int y) {
if (shearLayer.isEditable()) {
if (shearLayer.isInsideEndpoint(x, y) != null) {
// Change the cursor to a hand.
this.setCursorHand();
return true;
}
if (shearLayer.isInsideLine(x, y) != -1) {
// Change the cursor to crosshairs.
this.setCursorCross();
return true;
}
}
this.changeCursorNormal();
return false;
}
protected void changeCursorNormal() {
this.updateCursorStandard(SWT.CURSOR_ARROW);
}
private void setCursorHand() {
this.updateCursorStandard(SWT.CURSOR_HAND);
}
private void setCursorCross() {
this.updateCursorStandard(SWT.CURSOR_SIZEALL);
}
private void updateCursorStandard(int cursorEnum) {
IWorkbenchWindow window = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow();
window.getShell().setCursor(
window.getShell().getDisplay().getSystemCursor(cursorEnum));
}
}
} }

View file

@ -20,10 +20,6 @@
package com.raytheon.viz.ui.tools.map; package com.raytheon.viz.ui.tools.map;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
import com.raytheon.viz.ui.tools.AbstractTool; import com.raytheon.viz.ui.tools.AbstractTool;
/** /**
@ -32,14 +28,17 @@ import com.raytheon.viz.ui.tools.AbstractTool;
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------- -------- ----------- --------------------------
* Oct 10, 2006 chammack Initial Creation. * Oct 10, 2006 chammack Initial Creation.
* Sep 03, 2013 2310 bsteffen Remove unused function, mark deprecated.
* *
* </pre> * </pre>
* *
* @author chammack * @author chammack
* @version 1 * @version 1
* @deprected Extend {@link AbstractTool} instead.
*/ */
@Deprecated
public abstract class AbstractMapTool extends AbstractTool { public abstract class AbstractMapTool extends AbstractTool {
/** /**
@ -50,43 +49,4 @@ public abstract class AbstractMapTool extends AbstractTool {
super(); super();
} }
/**
* Gets the given resource class, loads the resource class if it hasn't been
* loaded yet
*
* @param resourceClass
* the resource to get
* @param resourceAction
* to use to load the resource in the case it hasn't already been
* loaded
* @return the resource matching the given class
* @throws ExecutionException
*/
protected AbstractVizResource<?, ?> getResource(
Class<? extends AbstractVizResource<?, ?>> resourceClass,
Class<? extends AbstractTool> resourceAction)
throws ExecutionException {
AbstractVizResource<?, ?> resourceLayer = containsResource(resourceClass);
// attempt to load the resource through it's action
if (resourceLayer == null) {
try {
resourceAction.newInstance().execute(new ExecutionEvent());
} catch (Exception e) {
throw new ExecutionException("Unable to load "
+ resourceAction.getCanonicalName());
}
}
resourceLayer = containsResource(resourceClass);
if (resourceLayer == null) {
throw new ExecutionException("Unable to load "
+ resourceClass.getCanonicalName());
}
return resourceLayer;
}
} }

View file

@ -357,6 +357,27 @@
id="com.raytheon.viz.ui.actions.printScreenReverseAction" id="com.raytheon.viz.ui.actions.printScreenReverseAction"
name="Print Screen Reverse"> name="Print Screen Reverse">
</command> </command>
<command
defaultHandler="com.raytheon.viz.ui.actions.LoadBundleHandler"
description="Load a bundle from a file"
id="com.raytheon.uf.viz.ui.loadbundle"
name="Load Bundle">
<commandParameter
id="bundleFile"
name="Bundle File Location"
optional="false">
</commandParameter>
<commandParameter
id="editorType"
name="Editer Type"
optional="true">
</commandParameter>
<commandParameter
id="fullBundleLoad"
name="Full Bundle Load"
optional="true">
</commandParameter>
</command>
</extension> </extension>
<extension <extension

View file

@ -0,0 +1,175 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.ui.actions;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.raytheon.uf.viz.core.DescriptorMap;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.procedures.Bundle;
import com.raytheon.viz.ui.BundleLoader;
import com.raytheon.viz.ui.BundleLoader.BundleInfoType;
import com.raytheon.viz.ui.BundleProductLoader;
import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* Handler for eclipse command that loads a bundle file to the display. This
* handler can be used from plugin.xml by using command parameters to specify
* what to load. It can also be used directly by configuring it using a
* constructor.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------- -------- ----------- --------------------------
* Aug 30, 2013 2310 bsteffen Initial creation
*
* </pre>
*
* @author bsteffen
* @version 1.0
*/
public class LoadBundleHandler extends AbstractHandler {
private final String bundleFile;
private final Map<String, String> variableSubstitutions;
private final String editorType;
private final Boolean fullBundleLoad;
public LoadBundleHandler() {
this(null);
}
public LoadBundleHandler(String bundleFile) {
this(bundleFile, null, null, null);
}
public LoadBundleHandler(String bundleFile,
Map<String, String> variableSubstitutions, String editorType,
Boolean fullBundleLoad) {
this.bundleFile = bundleFile;
this.variableSubstitutions = variableSubstitutions;
this.editorType = editorType;
this.fullBundleLoad = fullBundleLoad;
}
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
Bundle bundle = BundleLoader.getBundle(getBundleFile(event),
getVariableSubstitutions(event),
BundleInfoType.FILE_LOCATION);
AbstractEditor editor = UiUtil.createOrOpenEditor(
getEditorType(event, bundle), bundle.getDisplays());
BundleLoader loader;
if (isFullBundleLoad(event)) {
loader = new BundleLoader(editor, bundle);
} else {
loader = new BundleProductLoader(editor, bundle);
}
loader.schedule();
return event;
} catch (VizException e) {
throw new ExecutionException("Unable to load bundle", e);
}
}
protected String getBundleFile(ExecutionEvent event) {
if (this.bundleFile != null) {
return bundleFile;
} else if (event != null){
return event.getParameter("bundleFile");
}else{
throw new IllegalStateException(
"LoadBundleHandler requires a bundle file.");
}
}
protected Map<String, String> getVariableSubstitutions(ExecutionEvent event) {
if (this.variableSubstitutions != null) {
return variableSubstitutions;
} else if (event != null){
Map<String,String> variableSubstitutions = new HashMap<String, String>();
Map<?,?> parameters = event.getParameters();
for(Entry<?, ?> parameter : parameters.entrySet()){
if (parameter.getKey() instanceof String
&& parameter.getValue() instanceof String) {
variableSubstitutions.put((String) parameter.getKey(),
(String) parameter.getValue());
}
}
return variableSubstitutions;
}else{
return null;
}
}
protected String getEditorType(ExecutionEvent event, Bundle bundle) {
if (this.editorType != null) {
return editorType;
}else if(event != null){
String editorType = event.getParameter("editorType");
if(editorType != null){
return editorType;
}
}
String editorType = bundle.getEditor();
if (editorType == null) {
for (IRenderableDisplay display : bundle.getDisplays()) {
String descEditorType = DescriptorMap.getEditorId(display
.getDescriptor().getClass().getName());
if (descEditorType != null) {
if (editorType == null) {
editorType = descEditorType;
} else if (!editorType.equals(descEditorType)) {
// If this happens there are no reasonable guesses, just
// let UIUtil figure it out.
return null;
}
}
}
}
return editorType;
}
protected boolean isFullBundleLoad(ExecutionEvent event) {
if (this.fullBundleLoad != null) {
return fullBundleLoad;
} else if (event != null) {
return Boolean.valueOf(event.getParameter("fullBundleLoad"));
}else{
return false;
}
}
}