Issue #2310 Switch awipstools to load using bundles.
Change-Id: I9a24e6359bd43bfb7c8f84686348f532748503c4 Former-commit-id: afc80cb00cce9b22f1ecd730b60da1de1afbfb2e
This commit is contained in:
parent
47b8d496ae
commit
d75fdcb916
36 changed files with 1181 additions and 973 deletions
|
@ -2,4 +2,5 @@ source.. = src/
|
|||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
icons/
|
||||
icons/,\
|
||||
localization/
|
||||
|
|
|
@ -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>
|
|
@ -19,40 +19,31 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.points.ui.action;
|
||||
|
||||
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
|
||||
import com.raytheon.uf.viz.points.ui.layer.PointsToolLayer;
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* Handles the Points Tool Action.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct032007 #455 ebabin Initial Creation.
|
||||
* 14Oct2009 #810 bsteffen Fix for grabbing points.
|
||||
* 10-21-09 #1711 bsteffen Refactor to common MovableTool model
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1
|
||||
* @author bsteffen
|
||||
* @version 2.0
|
||||
* @deprecated Use {@link LoadBundleHandler} with
|
||||
* bundleFile="bundles/tools/Points.xml".
|
||||
*/
|
||||
public class PointsToolAction extends AbstractGenericToolAction<PointsToolLayer> {
|
||||
|
||||
/*
|
||||
* (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);
|
||||
@Deprecated
|
||||
public class PointsToolAction extends LoadBundleHandler {
|
||||
|
||||
public PointsToolAction(){
|
||||
super("bundles/tools/Points.xml");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.TimeZone;
|
|||
|
||||
import org.eclipse.core.commands.Command;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.jface.action.ContributionItem;
|
||||
import org.eclipse.swt.SWT;
|
||||
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.IURIRefreshCallback;
|
||||
import com.raytheon.uf.viz.ui.menus.xml.BundleMenuContribution;
|
||||
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;
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* Provides an Eclipse menu contribution that loads a bundle, and is decorated
|
||||
|
@ -83,10 +80,13 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 12, 2009 chammack Initial creation
|
||||
* Jan 14, 2013 1442 rferrel Add Simulated Time Change Listener.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Mar 12, 2009 chammack Initial creation
|
||||
* Jan 14, 2013 1442 rferrel Add Simulated Time Change Listener.
|
||||
* Aug 30, 2013 2310 bsteffen Move loading of bundle to
|
||||
* LoadBundleHandler.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -397,20 +397,13 @@ public class BundleContributionItem extends ContributionItem {
|
|||
|
||||
private void loadBundle(Event event) {
|
||||
try {
|
||||
Bundle bundle = BundleLoader.getBundle(
|
||||
this.menuContribution.xml.bundleFile, substitutions,
|
||||
BundleInfoType.FILE_LOCATION);
|
||||
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);
|
||||
boolean fullBundleLoad = false;
|
||||
if (this.menuContribution.xml.fullBundleLoad != null) {
|
||||
fullBundleLoad = this.menuContribution.xml.fullBundleLoad;
|
||||
}
|
||||
loader.schedule();
|
||||
|
||||
new LoadBundleHandler(this.menuContribution.xml.bundleFile,
|
||||
substitutions, this.menuContribution.xml.editorType,
|
||||
fullBundleLoad).execute(null);
|
||||
if (this.menuContribution.xml.command != null) {
|
||||
ICommandService service = (ICommandService) PlatformUI
|
||||
.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 : "
|
||||
+ this.menuContribution.xml.bundleFile, e);
|
||||
}
|
||||
|
|
|
@ -9,23 +9,19 @@ Eclipse-BuddyPolicy: registered, ext, global
|
|||
Eclipse-RegisterBuddy: org.apache.velocity, com.raytheon.viz.core, com.raytheon.uf.common.serialization
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.ui,
|
||||
com.raytheon.viz.core,
|
||||
org.apache.commons.lang,
|
||||
org.geotools,
|
||||
com.raytheon.viz.ui.tools.map,
|
||||
com.raytheon.viz.ui,
|
||||
javax.measure,
|
||||
com.raytheon.uf.common.pointdata,
|
||||
javax.vecmath;bundle-version="1.3.1",
|
||||
com.raytheon.uf.common.serialization,
|
||||
com.raytheon.uf.common.awipstools;bundle-version="1.12.1112",
|
||||
com.raytheon.uf.common.serialization.comm;bundle-version="1.12.1112",
|
||||
com.raytheon.uf.viz.d2d.core,
|
||||
com.raytheon.uf.common.dataplugin.radar;bundle-version="1.0.0",
|
||||
com.raytheon.uf.viz.core.maps;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.d2d.ui,
|
||||
com.raytheon.uf.viz.points;bundle-version="1.0.0",
|
||||
com.raytheon.uf.viz.core.rsc;bundle-version="1.0.0"
|
||||
com.raytheon.uf.common.dataplugin.radar,
|
||||
com.raytheon.uf.viz.core.maps,
|
||||
com.raytheon.uf.viz.points,
|
||||
com.raytheon.uf.viz.core.rsc,
|
||||
com.raytheon.uf.viz.core,
|
||||
com.raytheon.uf.common.geospatial,
|
||||
com.raytheon.uf.common.datastorage,
|
||||
com.raytheon.uf.common.dataplugin,
|
||||
com.raytheon.uf.common.util
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.viz.awipstools,
|
||||
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.display,
|
||||
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
|
||||
Import-Package: com.raytheon.viz.core,
|
||||
com.raytheon.viz.core.interval,
|
||||
com.raytheon.viz.core.rsc,
|
||||
com.raytheon.viz.core.rsc.jts
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -19,37 +19,32 @@
|
|||
further_licensing_information.
|
||||
-->
|
||||
<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"
|
||||
commandId="com.raytheon.viz.awipstools.baselines"
|
||||
menuText="Baselines" />
|
||||
|
||||
<contribute xsi:type="bundleItem" file="bundles/tools/AzRan.xml"
|
||||
menuText="Az/Ran Overlay" id="AzRanTool" timeQuery="false" />
|
||||
|
||||
<contribute xsi:type="bundleItem" file="bundles/tools/Baselines.xml"
|
||||
menuText="Baselines" id="baselinesTool" timeQuery="false" />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.choosebyid"
|
||||
menuText="Choose By ID..." />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.distancebearing"
|
||||
menuText="Distance Bearing" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/tools/DistanceBearing.xml"
|
||||
menuText="Distance Bearing" id="distanceBearingTool" timeQuery="false" />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.distancespeed"
|
||||
menuText="Distance Speed" />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.distancetool"
|
||||
menuText="Distance Scale" />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.ffz"
|
||||
menuText="Feature Following Zoom" />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.estimatedactualvelocity"
|
||||
menuText="Estimated Actual Velocity" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/tools/DistanceScale.xml"
|
||||
menuText="Distance Scale" id="distanceScaleTool" timeQuery="false" />
|
||||
|
||||
<contribute xsi:type="bundleItem" file="bundles/tools/FeatureFollowingZoom.xml"
|
||||
menuText="Feature Following Zoom" id="featureFollowingZoomTool" timeQuery="false" />
|
||||
|
||||
<contribute xsi:type="bundleItem" file="bundles/tools/EstimatedActualVelocity.xml"
|
||||
menuText="Estimated Actual Velocity" id="estimatedActualVelocityTool" timeQuery="false" />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.ui.viz.radarapps.fsi.startFSI"
|
||||
|
@ -59,17 +54,15 @@
|
|||
commandId="com.raytheon.viz.awipstools.timeofarrival"
|
||||
menuText="Time Of Arrival / Lead Time" />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.home"
|
||||
menuText="Home" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/tools/Home.xml"
|
||||
menuText="Home" id="homeTool" timeQuery="false" />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.lapstools"
|
||||
menuText="LAPS tools..." />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.points"
|
||||
menuText="Points" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/tools/Points.xml"
|
||||
menuText="Points" id="pointsTool" timeQuery="false" />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.puthomecursor"
|
||||
|
@ -79,9 +72,8 @@
|
|||
commandId="com.raytheon.viz.radar.ui.RadarDisplayControls"
|
||||
menuText="Radar Display Controls..." />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.rangerings"
|
||||
menuText="Range Rings" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/tools/RangeRings.xml"
|
||||
menuText="Range Rings" id="rangeRingsTool" timeQuery="false" />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.sunrise"
|
||||
|
@ -95,9 +87,8 @@
|
|||
commandId="com.raytheon.viz.awipstools.unitscalculator"
|
||||
menuText="Units Calculator..." />
|
||||
|
||||
<contribute xsi:type="command"
|
||||
commandId="com.raytheon.viz.awipstools.vrshear"
|
||||
menuText="VR - Shear" />
|
||||
<contribute xsi:type="bundleItem" file="bundles/tools/VRShear.xml"
|
||||
menuText="VR - Shear" id="vrShearTool" timeQuery="false" />
|
||||
|
||||
<!-- example arbitrary command below, commandAction parameter is required,
|
||||
the others default to false if undefined. If captureOutput is true then after
|
||||
|
|
|
@ -212,7 +212,7 @@
|
|||
<menuContribution
|
||||
locationURI="toolbar:d2d-2?after=tools.toolbar">
|
||||
<command
|
||||
commandId="com.raytheon.viz.awipstools.points"
|
||||
commandId="com.raytheon.uf.viz.ui.loadbundle"
|
||||
icon="icons/points.gif"
|
||||
label="Points">
|
||||
<visibleWhen>
|
||||
|
@ -220,9 +220,13 @@
|
|||
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
|
||||
</reference>
|
||||
</visibleWhen>
|
||||
<parameter
|
||||
name="bundleFile"
|
||||
value="bundles/tools/Points.xml">
|
||||
</parameter>
|
||||
</command>
|
||||
<command
|
||||
commandId="com.raytheon.viz.awipstools.baselines"
|
||||
commandId="com.raytheon.uf.viz.ui.loadbundle"
|
||||
icon="icons/Baseline.gif"
|
||||
label="Baselines">
|
||||
<visibleWhen>
|
||||
|
@ -230,6 +234,9 @@
|
|||
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
|
||||
</reference>
|
||||
</visibleWhen>
|
||||
<parameter
|
||||
name="bundleFile"
|
||||
value="bundles/tools/Baselines.xml" />
|
||||
</command>
|
||||
</menuContribution>
|
||||
</extension>
|
||||
|
|
|
@ -19,43 +19,34 @@
|
|||
**/
|
||||
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.AzimuthToolLayer;
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* Show 'Az/Ran' Overlay.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep142007 #444 ebabin Initial Creation.
|
||||
* 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>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1
|
||||
* @author bsteffen
|
||||
* @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 {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
|
||||
*/
|
||||
@Override
|
||||
protected GenericToolsResourceData<AzimuthToolLayer> getResourceData() {
|
||||
return new GenericToolsResourceData<AzimuthToolLayer>(
|
||||
AzimuthToolLayer.AZIMUTH_LOCATION, AzimuthToolLayer.class);
|
||||
public AzimuthToolAction() {
|
||||
super("bundles/tools/AzRan.xml");
|
||||
HashMap<String, String> map = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,43 +19,33 @@
|
|||
**/
|
||||
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.InteractiveBaselinesLayer;
|
||||
import com.raytheon.viz.awipstools.ui.layer.BaselinesToolLayer;
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* Handles the Baseline Tools Action.
|
||||
* Loads a {@link BaselinesToolLayer} from the bundles/tools/Baselines.xml
|
||||
* localization file.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep192007 #447 ebabin Initial Creation.
|
||||
* 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
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1
|
||||
* @author bsteffen
|
||||
* @version 2.0
|
||||
* @deprecated Use {@link LoadBundleHandler} with
|
||||
* bundleFile="bundles/tools/Baselines.xml".
|
||||
*/
|
||||
public class BaselinesToolAction extends
|
||||
AbstractGenericToolAction<InteractiveBaselinesLayer> {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
|
||||
*/
|
||||
@Override
|
||||
protected GenericToolsResourceData<InteractiveBaselinesLayer> getResourceData() {
|
||||
return new GenericToolsResourceData<InteractiveBaselinesLayer>(
|
||||
"Interactive Baselines", InteractiveBaselinesLayer.class);
|
||||
@Deprecated
|
||||
public class BaselinesToolAction extends LoadBundleHandler {
|
||||
|
||||
public BaselinesToolAction() {
|
||||
super("bundles/tools/Baselines.xml");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,139 +22,53 @@ package com.raytheon.viz.awipstools.ui.action;
|
|||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.IEditorPart;
|
||||
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.layer.HomeToolLayer;
|
||||
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;
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Opens the {@link ChooseByIdDialog} and loads several other tools from the
|
||||
* bundles/tools/ChooseById.xml localization file.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 06Dec2007 #576 Eric Babin Initial Creation
|
||||
* 31Jul2012 #875 rferrel Added checks for disposed dialgos.
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Sep 03, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1.0
|
||||
* @author bsteffen
|
||||
* @version 2.0
|
||||
*/
|
||||
|
||||
public class ChooseByIdAction extends AbstractMapTool {
|
||||
public class ChooseByIdAction extends LoadBundleHandler {
|
||||
|
||||
private ChooseByIdDialog chooseByIdDialog;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.tools.AbstractTool#runTool()
|
||||
*/
|
||||
public ChooseByIdAction() {
|
||||
super("bundles/tools/ChooseById.xml");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
super.execute(arg0);
|
||||
|
||||
if (editor.getActiveDisplayPane().getDescriptor() instanceof MapDescriptor) {
|
||||
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(editor.getActiveDisplayPane()
|
||||
.getDescriptor());
|
||||
|
||||
chooseByIdDialog.open();
|
||||
chooseByIdDialog = null;
|
||||
} else {
|
||||
chooseByIdDialog.setDescriptor(editor.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();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (chooseByIdDialog == null || chooseByIdDialog.isDisposed()) {
|
||||
chooseByIdDialog = new ChooseByIdDialog(PlatformUI.getWorkbench()
|
||||
.getActiveWorkbenchWindow().getShell());
|
||||
chooseByIdDialog.open();
|
||||
} else {
|
||||
// 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();
|
||||
}
|
||||
// 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;
|
||||
return super.execute(arg0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,42 +19,35 @@
|
|||
**/
|
||||
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.DistanceBearingToolLayer;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* Handles the Distance Bearing Tools Action.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep272007 #455 ebabin Initial Creation.
|
||||
* Oct012007 #471 ebabin Clean up Clear handling.
|
||||
* 10-21-09 #1711 bsteffen Refactor to common MovableTool model
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1
|
||||
* @author bsteffen
|
||||
* @version 2.0
|
||||
* @deprecated Use {@link LoadBundleHandler} with
|
||||
* bundleFile="bundles/tools/DistanceBearing.xml".
|
||||
*/
|
||||
@Deprecated
|
||||
public class DistanceBearingToolAction extends
|
||||
AbstractGenericToolAction<DistanceBearingToolLayer> {
|
||||
LoadBundleHandler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
|
||||
*/
|
||||
@Override
|
||||
protected GenericToolsResourceData<DistanceBearingToolLayer> getResourceData() {
|
||||
return new GenericToolsResourceData<DistanceBearingToolLayer>(
|
||||
DistanceBearingToolLayer.DEFAULT_NAME,
|
||||
DistanceBearingToolLayer.class);
|
||||
protected String getBundleFile(ExecutionEvent event) {
|
||||
return "bundles/tools/DistanceBearing.xml";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,25 +19,33 @@
|
|||
**/
|
||||
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.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
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.tools.GenericToolsResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
|
||||
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>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct172007 #495 ebabin Initial Creation.
|
||||
* Feb152011 #7975 bkowal Restore the DistanceSpeedLayer
|
||||
* associated with the Display Pane.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Oct 17, 2007 495 ebabin Initial Creation.
|
||||
* Feb 15, 2011 7975 bkowal Restore the DistanceSpeedLayer
|
||||
* associated with the Display Pane.
|
||||
* Aug 30, 2013 2310 bsteffen Ensure tool is used on a map editor.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,6 +56,17 @@ import com.raytheon.viz.awipstools.ui.layer.DistanceSpeedLayer;
|
|||
public class DistanceSpeedAction extends
|
||||
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)
|
||||
*
|
||||
|
|
|
@ -20,37 +20,31 @@
|
|||
|
||||
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.common.DistanceTool;
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* Action for opening the distance tool
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 1/10/08 562 bphillip Initial Creation.
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* </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 {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
|
||||
*/
|
||||
@Override
|
||||
protected GenericToolsResourceData<DistanceTool> getResourceData() {
|
||||
return new GenericToolsResourceData<DistanceTool>("Distance Scale",
|
||||
DistanceTool.class);
|
||||
public DistanceToolAction() {
|
||||
super("bundles/tools/DistanceScale.xml");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,39 +19,33 @@
|
|||
**/
|
||||
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.ShearLayer;
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Loads a {@link EstimatedActualVelocityLayer} from the
|
||||
* bundles/tools/EstimatedActualVelocity.xml localization file.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Sep 03, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
* @author bsteffen
|
||||
* @version 2.0
|
||||
* @deprecated Use {@link LoadBundleHandler} with
|
||||
* bundleFile="bundles/tools/EstimatedActualVelocity.xml".
|
||||
*/
|
||||
@Deprecated
|
||||
public class EstimatedActualVelocityAction extends LoadBundleHandler {
|
||||
|
||||
public class EstimatedActualVelocityAction extends ShearAction {
|
||||
|
||||
/*
|
||||
* (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);
|
||||
public EstimatedActualVelocityAction() {
|
||||
super("bundles/tools/EstimatedActualVelocity.xml");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,9 +19,7 @@
|
|||
******************************************************************************************/
|
||||
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.FeatureFollowingZoomLayer;
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* Action for feature follow zoom
|
||||
|
@ -29,28 +27,23 @@ import com.raytheon.viz.awipstools.ui.layer.FeatureFollowingZoomLayer;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mschenke
|
||||
* @version 1.0
|
||||
* @author bsteffen
|
||||
* @version 2.0
|
||||
* @deprecated Use {@link LoadBundleHandler} with
|
||||
* bundleFile="bundles/tools/FeatureFollowingZoom.xml".
|
||||
*/
|
||||
@Deprecated
|
||||
public class FeatureFollowingZoomAction extends LoadBundleHandler {
|
||||
|
||||
public class FeatureFollowingZoomAction extends
|
||||
AbstractGenericToolAction<FeatureFollowingZoomLayer> {
|
||||
|
||||
/*
|
||||
* (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);
|
||||
public FeatureFollowingZoomAction() {
|
||||
super("bundles/tools/FeatureFollowingZoom.xml");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,126 +19,28 @@
|
|||
**/
|
||||
package com.raytheon.viz.awipstools.ui.action;
|
||||
|
||||
import java.util.Iterator;
|
||||
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;
|
||||
import com.raytheon.viz.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* Show 'Home' location. Also shows range and home from home.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Sep 03, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug242007 #429 ebabin Initial Creation.
|
||||
* 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>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1
|
||||
* @author bsteffen
|
||||
* @version 2.0
|
||||
*/
|
||||
public class HomeToolAction extends AbstractGenericToolAction<HomeToolLayer> {
|
||||
public class HomeToolAction extends LoadBundleHandler {
|
||||
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(HomeToolAction.class);
|
||||
|
||||
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;
|
||||
}
|
||||
public HomeToolAction() {
|
||||
super("bundles/tools/Home.xml");
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,49 +26,40 @@ import org.eclipse.ui.PlatformUI;
|
|||
|
||||
import com.raytheon.viz.awipstools.ui.dialog.PutHomeCursorDialog;
|
||||
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>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 10-21-09 #1049 bsteffen Synchronize with new Home Tool Layer
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Sep 03, 2013 2310 bsteffen Rewritten to extend HomeToolAction.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1.0
|
||||
* @author bsteffen
|
||||
* @version 2.0
|
||||
*/
|
||||
|
||||
public class PutHomeCursorAction extends AbstractMapTool {
|
||||
public class PutHomeCursorAction extends HomeToolAction {
|
||||
|
||||
private PutHomeCursorDialog putHomeCursorDialog;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.tools.AbstractTool#runTool()
|
||||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
super.execute(arg0);
|
||||
|
||||
HomeToolLayer homeToolLayer = (HomeToolLayer) getResource(
|
||||
HomeToolLayer.class, HomeToolAction.class);
|
||||
|
||||
if (putHomeCursorDialog == null
|
||||
|| putHomeCursorDialog.getShell() == null) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
putHomeCursorDialog = new PutHomeCursorDialog(shell, homeToolLayer
|
||||
.getResourceData());
|
||||
putHomeCursorDialog = new PutHomeCursorDialog(shell);
|
||||
putHomeCursorDialog.setBlockOnOpen(false);
|
||||
putHomeCursorDialog.open();
|
||||
}
|
||||
|
||||
return null;
|
||||
return super.execute(arg0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,38 +19,33 @@
|
|||
**/
|
||||
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.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* Handles the RangeRing Tools Action.
|
||||
* Loads a {@link RangeRingsLayer} from the bundles/tools/RangeRings.xml
|
||||
* localization file.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 10-21-09 #717 bsteffen Refactor to common MovableTool model
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Aug 30, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1.0
|
||||
* @author bsteffen
|
||||
* @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> {
|
||||
|
||||
/*
|
||||
* (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);
|
||||
|
||||
public RangeRingsAction() {
|
||||
super("bundles/tools/RangeRings.xml");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -19,38 +19,33 @@
|
|||
**/
|
||||
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.ui.actions.LoadBundleHandler;
|
||||
|
||||
/**
|
||||
* Handles the VR Shear Action.
|
||||
* Loads a {@link VRShearLayer} from the bundles/tools/VRShear.xml localization
|
||||
* file.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct172007 #492 ebabin Initial Creation.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Sep 03, 2013 2310 bsteffen Rewritten to extend LoadBundleHandler.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author ebabin
|
||||
* @version 1
|
||||
* @author bsteffen
|
||||
* @version 2.0
|
||||
* @deprecated Use {@link LoadBundleHandler} with
|
||||
* bundleFile="bundles/tools/VRShear.xml".
|
||||
*/
|
||||
public class VRShearAction extends ShearAction {
|
||||
@Deprecated
|
||||
public class VRShearAction extends LoadBundleHandler {
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.awipstools.ui.action.MapToolAction#getResourceData()
|
||||
*/
|
||||
@Override
|
||||
protected GenericToolsResourceData<ShearLayer> getResourceData() {
|
||||
return new GenericToolsResourceData<ShearLayer>(
|
||||
VRShearLayer.VRSHEAR_LOCATION, VRShearLayer.class);
|
||||
public VRShearAction() {
|
||||
super("bundles/tools/VRShear.xml");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,8 +30,6 @@ import org.eclipse.core.runtime.Status;
|
|||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
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.KeyListener;
|
||||
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.viz.core.HDF5Util;
|
||||
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.ScriptCreator;
|
||||
import com.raytheon.uf.viz.core.comm.Loader;
|
||||
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.rsc.AbstractVizResource;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||
import com.raytheon.uf.viz.core.globals.VizGlobalsManager;
|
||||
import com.raytheon.uf.viz.core.rsc.ResourceType;
|
||||
import com.raytheon.uf.viz.points.IPointChangedListener;
|
||||
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.ui.layer.HomeToolLayer;
|
||||
import com.raytheon.viz.awipstools.ui.layer.InteractiveBaselinesLayer;
|
||||
import com.raytheon.viz.ui.UiPlugin;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
@ -90,14 +85,16 @@ import com.vividsolutions.jts.geom.GeometryFactory;
|
|||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 07Dec2007 #576 Eric Babin Initial Creation.
|
||||
* 23Jul2010 #5948 bkowal Added the ability to move
|
||||
* a point to the location of a
|
||||
* "mesocyclone".
|
||||
* 31Jul2012 #875 rferrel Let preopen initialize components.
|
||||
* 05Nov2012 #1304 rferrel Added Point Change Listener.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Dec 07, 2007 576 Eric Babin Initial Creation.
|
||||
* Jul 23, 2010 5948 bkowal Added the ability to move a point to the
|
||||
* location of a "mesocyclone".
|
||||
* Jul 31, 2012 875 rferrel Let preopen initialize components.
|
||||
* Nov 05, 2012 1304 rferrel Added Point Change Listener.
|
||||
* Sep 03, 2013 2310 bsteffen Use IPointChangedListener and
|
||||
* IToolChangedListener instead of
|
||||
* IResourceDataChanged.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -116,20 +113,12 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
|
|||
|
||||
private Button pointsRdo, baselinesRdo, homeRdo;
|
||||
|
||||
private HomeToolLayer homeToolLayer;
|
||||
|
||||
private PointsToolLayer pointsToolLayer;
|
||||
|
||||
private InteractiveBaselinesLayer baselinesToolLayer;
|
||||
|
||||
private final List<IResourceDataChanged> changeListeners = new ArrayList<IResourceDataChanged>();
|
||||
|
||||
private final List<ChooseByIdKeyListener> changeListeners = new ArrayList<ChooseByIdKeyListener>();
|
||||
|
||||
private final List<Text> pointStationIdTextFields;
|
||||
|
||||
private final List<Text> baselineStationIdTextFields;
|
||||
|
||||
private IDescriptor descriptor;
|
||||
|
||||
private final PointsDataManager pointsDataManager = PointsDataManager
|
||||
.getInstance();
|
||||
|
||||
|
@ -190,7 +179,7 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
private class ChooseByIdKeyListener implements KeyListener,
|
||||
IResourceDataChanged {
|
||||
IPointChangedListener, IToolChangedListener {
|
||||
|
||||
private final String idName;
|
||||
|
||||
|
@ -273,8 +262,7 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
|
|||
if (obStation != null) {
|
||||
c = obStation.getGeometry().getCoordinate();
|
||||
} else {
|
||||
c = this.getDmdInformation(stationID,
|
||||
descriptor.getNumberOfFrames());
|
||||
c = this.getDmdInformation(stationID);
|
||||
}
|
||||
|
||||
if (c == null) {
|
||||
|
@ -326,39 +314,32 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
|
|||
if (isPoint()) {
|
||||
pointsDataManager.setCoordinate(idName,
|
||||
stationCoordinates.get(0));
|
||||
refreshToolLayer(pointsToolLayer);
|
||||
|
||||
pointsDataManager.addPointsChangedListener(this);
|
||||
} else if (isBaseline()) {
|
||||
toolsDataManager.setBaseline(idName, (new GeometryFactory())
|
||||
.createLineString(stationCoordinates
|
||||
.toArray(new Coordinate[] {})));
|
||||
refreshToolLayer(baselinesToolLayer);
|
||||
|
||||
toolsDataManager.addBaselinesChangedListener(this);
|
||||
} else if (isHome()) {
|
||||
pointsDataManager.setHome(stationCoordinates.get(0));
|
||||
refreshToolLayer(homeToolLayer);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param toolLayer
|
||||
*/
|
||||
private void refreshToolLayer(AbstractVizResource<?, ?> toolLayer) {
|
||||
if (toolLayer != null) {
|
||||
toolLayer.getResourceData().fireChangeListeners(
|
||||
ChangeType.DATA_UPDATE, null);
|
||||
toolLayer.getResourceData().addChangeListener(this);
|
||||
changeListeners.add(this);
|
||||
pointsDataManager.addHomeChangedListener(this);
|
||||
}
|
||||
changeListeners.add(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param mesoId
|
||||
* @param frameCount
|
||||
* @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;
|
||||
RadarRecord rr = null;
|
||||
|
||||
|
@ -507,17 +488,23 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
|
|||
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
|
||||
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;
|
||||
|
||||
if (stationCoordinates == null || stationCoordinates.size() == 0) {
|
||||
|
@ -569,7 +556,7 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
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.setMinimumSize(new Point(340, 570));
|
||||
}
|
||||
|
@ -612,13 +590,10 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
|
|||
*
|
||||
*/
|
||||
private void unregisterListeners() {
|
||||
for (IResourceDataChanged changeListener : changeListeners) {
|
||||
homeToolLayer.getResourceData()
|
||||
.removeChangeListener(changeListener);
|
||||
pointsToolLayer.getResourceData().removeChangeListener(
|
||||
changeListener);
|
||||
baselinesToolLayer.getResourceData().removeChangeListener(
|
||||
changeListener);
|
||||
for (ChooseByIdKeyListener changeListener : changeListeners) {
|
||||
pointsDataManager.removePointsChangedListener(changeListener);
|
||||
pointsDataManager.removeHomeChangedListener(changeListener);
|
||||
toolsDataManager.removeBaselinesChangedListener(changeListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -839,34 +814,10 @@ public class ChooseByIdDialog extends CaveSWTDialog implements
|
|||
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
|
||||
protected void disposed() {
|
||||
pointsDataManager.removePointsChangedListener(this);
|
||||
unregisterListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,20 +24,25 @@ package com.raytheon.viz.awipstools.ui.dialog;
|
|||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 5 2007 Eric Babin Initial Creation
|
||||
* 10Dec2007 #598 Eric Babin Added city, state query.
|
||||
* 20Dec2007 #656 Eric Babin Updated to refresh location after clicking GO.
|
||||
* 15Jan2007 ebabin Update for lat/lon put home cursor bug.
|
||||
* 10-21-09 #1049 bsteffen Synchronize with new Home Tool Layer
|
||||
* 07-09-10 #3654 bkowal The stationid column will now be used in the
|
||||
* station query instead of the icao column.
|
||||
* 07-21-10 #3654 bkowal Added additional logic to increase the 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.
|
||||
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Dec 05, 2007 Eric Babin Initial Creation
|
||||
* Dec 10, 2007 598 Eric Babin Added city, state query.
|
||||
* Dec 20, 2007 656 Eric Babin Updated to refresh location after
|
||||
* clicking GO.
|
||||
* Jan 15, 2007 ebabin Update for lat/lon put home cursor bug.
|
||||
* Oct 21, 2009 1049 bsteffen Synchronize with new Home Tool Layer
|
||||
* Jul 09, 2010 3654 bkowal The stationid column will now be used in
|
||||
* the station query instead of the icao
|
||||
* column.
|
||||
* Jul 21, 2010 3654 bkowal Added additional logic to increase the
|
||||
* 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>
|
||||
*
|
||||
* @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.UFStatus;
|
||||
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.rsc.AbstractResourceData;
|
||||
import com.raytheon.uf.viz.core.rsc.IResourceDataChanged;
|
||||
import com.raytheon.uf.viz.points.IPointChangedListener;
|
||||
import com.raytheon.uf.viz.points.PointsDataManager;
|
||||
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||
import com.vividsolutions.jts.geom.Coordinate;
|
||||
|
@ -85,7 +90,7 @@ import com.vividsolutions.jts.io.WKBReader;
|
|||
import com.vividsolutions.jts.io.WKTWriter;
|
||||
|
||||
public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
||||
IResourceDataChanged {
|
||||
IPointChangedListener {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PutHomeCursorDialog.class);
|
||||
|
||||
|
@ -125,13 +130,10 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
|||
|
||||
private Button goButton, closeButton;
|
||||
|
||||
private final AbstractResourceData resourceData;
|
||||
|
||||
public PutHomeCursorDialog(Shell shell,
|
||||
AbstractResourceData abstractResourceData) {
|
||||
public PutHomeCursorDialog(Shell shell) {
|
||||
super(shell);
|
||||
this.setBlockOnOpen(false);
|
||||
this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE);
|
||||
this.resourceData = abstractResourceData;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -320,12 +322,13 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
|||
@Override
|
||||
protected void configureShell(Shell shell) {
|
||||
super.configureShell(shell);
|
||||
resourceData.addChangeListener(this);
|
||||
PointsDataManager.getInstance().addHomeChangedListener(this);
|
||||
shell.addDisposeListener(new DisposeListener() {
|
||||
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
resourceData.removeChangeListener(PutHomeCursorDialog.this);
|
||||
PointsDataManager.getInstance().removeHomeChangedListener(
|
||||
PutHomeCursorDialog.this);
|
||||
}
|
||||
});
|
||||
shell.setText("Put Home Cursor");
|
||||
|
@ -346,7 +349,7 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
|||
* Exits the dialog.
|
||||
*/
|
||||
private void exitDialog() {
|
||||
this.resourceData.removeChangeListener(this);
|
||||
PointsDataManager.getInstance().removeHomeChangedListener(this);
|
||||
this.close();
|
||||
}
|
||||
|
||||
|
@ -367,8 +370,6 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
|||
stationTextField.setFocus();
|
||||
} else {
|
||||
PointsDataManager.getInstance().setHome(c);
|
||||
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE,
|
||||
null);
|
||||
stationTextField.setText(station);
|
||||
}
|
||||
} else {
|
||||
|
@ -401,7 +402,6 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
|||
cityTextField.setFocus();
|
||||
} else {
|
||||
PointsDataManager.getInstance().setHome(c);
|
||||
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
|
||||
cityTextField.setText(city);
|
||||
stateTextField.setText(state);
|
||||
}
|
||||
|
@ -434,7 +434,6 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
|||
return;
|
||||
}
|
||||
PointsDataManager.getInstance().setHome(c);
|
||||
resourceData.fireChangeListeners(ChangeType.DATA_UPDATE, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -584,12 +583,19 @@ public class PutHomeCursorDialog extends CaveJFACEDialog implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public void resourceChanged(ChangeType type, Object object) {
|
||||
Coordinate point = PointsDataManager.getInstance().getHome();
|
||||
lonTextField.setText(String.valueOf(point.x));
|
||||
latTextField.setText(String.valueOf(point.y));
|
||||
// find the nearest station and update the fields.
|
||||
updateStationInfo(point);
|
||||
public void pointChanged() {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Coordinate point = PointsDataManager.getInstance().getHome();
|
||||
lonTextField.setText(String.valueOf(point.x));
|
||||
latTextField.setText(String.valueOf(point.y));
|
||||
// find the nearest station and update the fields.
|
||||
updateStationInfo(point);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,10 @@ import java.util.regex.Pattern;
|
|||
|
||||
import javax.measure.converter.UnitConverter;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.geotools.referencing.GeodeticCalculator;
|
||||
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.viz.awipstools.common.ToolsUiUtil;
|
||||
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.GeometryFactory;
|
||||
import com.vividsolutions.jts.geom.LineString;
|
||||
|
@ -61,11 +65,13 @@ import com.vividsolutions.jts.geom.LineString;
|
|||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Mar 15, 2013 15693 mgamazaychikov Added magnification capability.
|
||||
* May 02, 2013 14587 D. Friedman Use base velocity.
|
||||
* Aug 29, 2013 2281 bsteffen Fix click distance calculations.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- -------------- --------------------------
|
||||
* Mar 15, 2013 15693 mgamazaychikov Added magnification capability.
|
||||
* May 02, 2013 14587 D. Friedman Use base velocity.
|
||||
* Aug 29, 2013 2281 bsteffen Fix click distance calculations.
|
||||
* Sep 03, 2013 2310 bsteffen Move MouseHandler from ShearAction to
|
||||
* ShearLayer.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -95,6 +101,7 @@ public class ShearLayer extends
|
|||
setDescriptor(descriptor);
|
||||
gc = new GeodeticCalculator(this.descriptor.getCRS());
|
||||
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)
|
||||
*
|
||||
|
@ -311,16 +303,18 @@ public class ShearLayer extends
|
|||
/**
|
||||
* Get the closest endpoint to the provided screen location.
|
||||
*
|
||||
* @param container
|
||||
* display container to use
|
||||
* @param refX
|
||||
* x location in screen pixels
|
||||
* @param refY
|
||||
* y location in screen pixels
|
||||
* @return T Coordinate of the endpoint, null if not found.
|
||||
*/
|
||||
public Coordinate isInsideEndpoint(IDisplayPaneContainer container, int x,
|
||||
public Coordinate isInsideEndpoint(int x,
|
||||
int y) {
|
||||
IDisplayPaneContainer container = getResourceContainer();
|
||||
if (container == null) {
|
||||
return null;
|
||||
}
|
||||
Coordinate[] coords = getBaseline().getCoordinates();
|
||||
int idx = ToolsUiUtil.closeToCoordinate(container, coords, x, y, 9);
|
||||
if (idx < 0) {
|
||||
|
@ -334,17 +328,17 @@ public class ShearLayer extends
|
|||
* Return the index of the linestring the user clicked in (for move for
|
||||
* instance).
|
||||
*
|
||||
* @param container
|
||||
* display container to use
|
||||
* @param refX
|
||||
* x location of reference point in screen pixels
|
||||
* @param refY
|
||||
* y location of reference point in screen pixels
|
||||
* @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();
|
||||
if (ToolsUiUtil.closeToLine(container, coords, x, y, 15)) {
|
||||
if (container != null
|
||||
&& ToolsUiUtil.closeToLine(container, coords, x, y, 15)) {
|
||||
return 0;
|
||||
} else {
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -31,15 +27,18 @@ import com.raytheon.viz.ui.tools.AbstractTool;
|
|||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 10, 2006 chammack Initial Creation.
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Oct 10, 2006 chammack Initial Creation.
|
||||
* Sep 03, 2013 2310 bsteffen Remove unused function, mark deprecated.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author chammack
|
||||
* @version 1
|
||||
* @deprected Extend {@link AbstractTool} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class AbstractMapTool extends AbstractTool {
|
||||
|
||||
/**
|
||||
|
@ -50,43 +49,4 @@ public abstract class AbstractMapTool extends AbstractTool {
|
|||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -357,6 +357,27 @@
|
|||
id="com.raytheon.viz.ui.actions.printScreenReverseAction"
|
||||
name="Print Screen Reverse">
|
||||
</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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue