Issue #2847: Add option to export only selected parms to GFE KML export dialog.
Change-Id: I6f0111d0f8eaed302c18dcd08e4433a7e544e669 Former-commit-id:7f36b8ba9c
[formerly7e165846d2
[formerly965d76c139
] [formerly7f36b8ba9c
[formerly cdb6f07f0a514c159e792e3bb911ef93a8354b2d]]] Former-commit-id:7e165846d2
[formerly965d76c139
] Former-commit-id:7e165846d2
Former-commit-id:f32b34b736
This commit is contained in:
parent
94fe261c6b
commit
735e3be676
3 changed files with 89 additions and 7 deletions
|
@ -59,6 +59,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Jun 05, 2012 bsteffen Initial creation
|
||||
* Jan 23, 2014 2703 bsteffen Enable subclasses to add custom frame
|
||||
* selection options.
|
||||
* Apr 03, 2014 2847 dgilling Add some additional methods for
|
||||
* use by sub-classes.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -169,6 +171,7 @@ public class KmlExportDialog extends CaveSWTDialog {
|
|||
Button button = new Button(group, SWT.PUSH);
|
||||
button.setText("Browse ...");
|
||||
button.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
selectDestinationFile();
|
||||
}
|
||||
|
@ -383,7 +386,7 @@ public class KmlExportDialog extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
|
||||
private void populateProductSubTree(List<ResourcePair> rscList,
|
||||
protected void populateProductSubTree(List<ResourcePair> rscList,
|
||||
final TreeItem parent) {
|
||||
TreeItem[] items = parent != null ? parent.getItems() : productTree
|
||||
.getItems();
|
||||
|
@ -605,4 +608,11 @@ public class KmlExportDialog extends CaveSWTDialog {
|
|||
return true;
|
||||
}
|
||||
|
||||
public boolean isExportHiddenSelected() {
|
||||
return exportHiddenButton.getSelection();
|
||||
}
|
||||
|
||||
public boolean isExportMapsSelected() {
|
||||
return exportMapsButton.getSelection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,17 +19,27 @@
|
|||
**/
|
||||
package com.raytheon.viz.gfe.export.kml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.kml.export.KmlExportDialog;
|
||||
import com.raytheon.uf.viz.kml.export.KmlExportOptions;
|
||||
import com.raytheon.uf.viz.kml.export.KmlPane;
|
||||
import com.raytheon.viz.gfe.core.IParmManager;
|
||||
import com.raytheon.viz.gfe.core.parm.Parm;
|
||||
import com.raytheon.viz.gfe.export.image.GfeImageExportDialog;
|
||||
import com.raytheon.viz.gfe.rsc.GFEResource;
|
||||
|
||||
/**
|
||||
* A custom {@link KmlExportDialog} for GFE which adds on option to use the Grid
|
||||
|
@ -42,6 +52,7 @@ import com.raytheon.viz.gfe.export.image.GfeImageExportDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jan 23, 2014 2702 bsteffen Initial creation
|
||||
* Apr 03, 2014 2847 dgilling Add "Export Selected" option.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -53,8 +64,14 @@ public class GfeKmlExportDialog extends KmlExportDialog {
|
|||
|
||||
protected Button selectedFrameRangeButton;
|
||||
|
||||
public GfeKmlExportDialog(Shell shell, KmlExportOptions options) {
|
||||
protected Button exportSelectParmsButton;
|
||||
|
||||
private final IParmManager parmMgr;
|
||||
|
||||
public GfeKmlExportDialog(Shell shell, KmlExportOptions options,
|
||||
IParmManager parmMgr) {
|
||||
super(shell, options);
|
||||
this.parmMgr = parmMgr;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,10 +89,10 @@ public class GfeKmlExportDialog extends KmlExportDialog {
|
|||
if (selectedFrameRangeButton.getSelection()) {
|
||||
KmlPane pane = options.getSinglPane();
|
||||
IRenderableDisplay renderableDispaly = pane.getDisplay();
|
||||
|
||||
int[] frameRange = GfeImageExportDialog.getSelectedFrameRange(getShell(),
|
||||
renderableDispaly);
|
||||
if(frameRange == null){
|
||||
|
||||
int[] frameRange = GfeImageExportDialog.getSelectedFrameRange(
|
||||
getShell(), renderableDispaly);
|
||||
if (frameRange == null) {
|
||||
return;
|
||||
}
|
||||
options.setFirstFrameIndex(frameRange[0]);
|
||||
|
@ -84,4 +101,50 @@ public class GfeKmlExportDialog extends KmlExportDialog {
|
|||
super.okPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeOptionsGroup(Group group) {
|
||||
if (parmMgr != null) {
|
||||
exportSelectParmsButton = new Button(group, SWT.CHECK);
|
||||
exportSelectParmsButton.setText("Export Selected");
|
||||
exportSelectParmsButton.setSelection(true);
|
||||
exportSelectParmsButton
|
||||
.setToolTipText("Include only selected weather elements in the selection of products to export.");
|
||||
exportSelectParmsButton
|
||||
.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
populateProductTree();
|
||||
}
|
||||
});
|
||||
}
|
||||
super.initializeOptionsGroup(group);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populateProductTree() {
|
||||
boolean exportMaps = isExportMapsSelected();
|
||||
boolean exportHidden = isExportHiddenSelected();
|
||||
boolean exportSelected = exportSelectParmsButton.getSelection();
|
||||
List<ResourcePair> prelimRscList = options.getSinglPane().getResources(
|
||||
exportMaps, exportHidden);
|
||||
|
||||
List<ResourcePair> rscList;
|
||||
if (exportSelected) {
|
||||
rscList = new ArrayList<ResourcePair>();
|
||||
List<Parm> selectedParms = Arrays
|
||||
.asList(parmMgr.getSelectedParms());
|
||||
for (ResourcePair rp : prelimRscList) {
|
||||
GFEResource gfeRsc = (GFEResource) rp.getResource();
|
||||
if (selectedParms.contains(gfeRsc.getParm())) {
|
||||
rscList.add(rp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rscList = prelimRscList;
|
||||
}
|
||||
|
||||
populateProductSubTree(rscList, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.ui.handlers.HandlerUtil;
|
||||
|
||||
import com.raytheon.uf.viz.kml.export.KmlExportHandler;
|
||||
import com.raytheon.viz.gfe.core.DataManager;
|
||||
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
|
||||
import com.raytheon.viz.gfe.core.IParmManager;
|
||||
|
||||
/**
|
||||
* A custom {@link KmlExportHandler} for GFE which allows adds options to the
|
||||
|
@ -36,6 +39,7 @@ import com.raytheon.uf.viz.kml.export.KmlExportHandler;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------- -------- ----------- --------------------------
|
||||
* Jan 23, 2014 2702 bsteffen Initial creation
|
||||
* Apr 03, 2014 2847 dgilling Pass ParmManager instance to dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -47,8 +51,13 @@ public class GfeKmlExportHandler extends KmlExportHandler {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||
DataManager dataMgr = DataManagerUIFactory.getCurrentInstance();
|
||||
IParmManager parmMgr = null;
|
||||
if (dataMgr != null) {
|
||||
parmMgr = dataMgr.getParmManager();
|
||||
}
|
||||
new GfeKmlExportDialog(HandlerUtil.getActiveShell(event),
|
||||
getDefaultOptions()).open();
|
||||
getDefaultOptions(), parmMgr).open();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue