diff --git a/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/dialog/ImageExportDialog.java b/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/dialog/ImageExportDialog.java index 316ab933d5..1ada876423 100644 --- a/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/dialog/ImageExportDialog.java +++ b/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/dialog/ImageExportDialog.java @@ -308,7 +308,7 @@ public class ImageExportDialog extends CaveSWTDialog { options.setFrameSelection(FrameSelection.ALL); } else if (currentFramesButton.getSelection()) { options.setFrameSelection(FrameSelection.CURRENT); - } else { + } else if (selectedFramesButton.getSelection()) { options.setFrameSelection(FrameSelection.USER); try { int from = Integer.parseInt(framesFromText.getText()) - 1; @@ -350,7 +350,7 @@ public class ImageExportDialog extends CaveSWTDialog { try { double delayS = Double .parseDouble(lastFrameDwellText.getText()); - int delay = (int) (delayS / TimeUtil.MILLIS_PER_SECOND); + int delay = (int) (delayS * TimeUtil.MILLIS_PER_SECOND); options.setLastFrameDwell(delay); } catch (NumberFormatException e) { invalidNumberMessage(lastFrameDwellText, "last frame dwell"); diff --git a/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/handler/ExportImageHandler.java b/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/handler/ExportImageHandler.java index 72dd60c367..97a1f3cf78 100644 --- a/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/handler/ExportImageHandler.java +++ b/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/handler/ExportImageHandler.java @@ -134,9 +134,7 @@ public class ExportImageHandler extends AbstractImageCaptureHandler { options.setFileLocation(new File(path)); } else { - /* Advanced dialog */ - ImageExportDialog dialog = new ImageExportDialog(shell, options); - if (dialog.open() == null) { + if (openOptionsDialog(shell, options) == false) { return null; } } @@ -167,6 +165,16 @@ public class ExportImageHandler extends AbstractImageCaptureHandler { return null; } + /** + * Open an image dialog + * + * @return false if the user canceled, true otherwise. + */ + protected boolean openOptionsDialog(Shell shell, ImageExportOptions options) { + ImageExportDialog dialog = new ImageExportDialog(shell, options); + return dialog.open() != null; + } + public void saveImages(IProgressMonitor monitor, ImageExportOptions options, List images) { monitor.beginTask("Saving Images", images.size()); diff --git a/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/options/ImageExportOptions.java b/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/options/ImageExportOptions.java index eff8ed31bf..80695d807f 100644 --- a/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/options/ImageExportOptions.java +++ b/cave/com.raytheon.uf.viz.image.export/src/com/raytheon/uf/viz/image/export/options/ImageExportOptions.java @@ -27,7 +27,7 @@ import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.datastructure.LoopProperties; /** - * Configuration options taht control how an image is exported. + * Configuration options that control how an image is exported. * *
  * 
diff --git a/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF
index 34fdddb32d..5efc60d535 100644
--- a/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.viz.gfe/META-INF/MANIFEST.MF
@@ -32,7 +32,8 @@ Require-Bundle: org.eclipse.ui,
  com.raytheon.uf.common.colormap;bundle-version="1.12.1174",
  com.google.guava;bundle-version="1.0.0",
  com.raytheon.uf.common.style;bundle-version="1.0.0",
- com.raytheon.uf.common.activetable
+ com.raytheon.uf.common.activetable,
+ com.raytheon.uf.viz.image.export;bundle-version="1.14.0"
 Bundle-ActivationPolicy: lazy
 Export-Package: com.raytheon.viz.gfe,
  com.raytheon.viz.gfe.constants,
diff --git a/cave/com.raytheon.viz.gfe/plugin.xml b/cave/com.raytheon.viz.gfe/plugin.xml
index ce040a602c..99b6349edb 100644
--- a/cave/com.raytheon.viz.gfe/plugin.xml
+++ b/cave/com.raytheon.viz.gfe/plugin.xml
@@ -974,6 +974,15 @@
               definitionId="com.raytheon.viz.gfe.inGFEActionSet">
         
      
+  
+  
+     
+        
+        
+     
   
 	
 	
diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/export/image/GfeExportImageHandler.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/export/image/GfeExportImageHandler.java
new file mode 100644
index 0000000000..a94098f2f5
--- /dev/null
+++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/export/image/GfeExportImageHandler.java
@@ -0,0 +1,54 @@
+/**
+ * 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.gfe.export.image;
+
+import org.eclipse.swt.widgets.Shell;
+
+import com.raytheon.uf.viz.image.export.dialog.ImageExportDialog;
+import com.raytheon.uf.viz.image.export.handler.ExportImageHandler;
+import com.raytheon.uf.viz.image.export.options.ImageExportOptions;
+
+/**
+ * A custom {@link ExportImageHandler} for GFE which allows it to add options to
+ * the dialog.
+ * 
+ * 
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Jan 22, 2014  2312     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + * @see GfeImageExportDialog + */ +public class GfeExportImageHandler extends ExportImageHandler { + + @Override + protected boolean openOptionsDialog(Shell shell, ImageExportOptions options) { + ImageExportDialog dialog = new GfeImageExportDialog(shell, options); + return dialog.open() != null; + } + +} diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/export/image/GfeImageExportDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/export/image/GfeImageExportDialog.java new file mode 100644 index 0000000000..8a2f777ec0 --- /dev/null +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/export/image/GfeImageExportDialog.java @@ -0,0 +1,130 @@ +/** + * 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.gfe.export.image; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.MessageBox; +import org.eclipse.swt.widgets.Shell; + +import com.raytheon.uf.common.time.DataTime; +import com.raytheon.uf.common.time.TimeRange; +import com.raytheon.uf.viz.core.IDisplayPane; +import com.raytheon.uf.viz.core.IDisplayPaneContainer; +import com.raytheon.uf.viz.core.drawables.IDescriptor; +import com.raytheon.uf.viz.core.drawables.IDescriptor.FramesInfo; +import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; +import com.raytheon.uf.viz.image.export.dialog.ImageExportDialog; +import com.raytheon.uf.viz.image.export.options.ImageExportOptions; +import com.raytheon.uf.viz.image.export.options.ImageExportOptions.FrameSelection; +import com.raytheon.viz.gfe.core.DataManager; +import com.raytheon.viz.gfe.core.DataManagerUIFactory; +import com.raytheon.viz.gfe.core.parm.ParmOp; +import com.raytheon.viz.ui.EditorUtil; + +/** + * A custom {@link ImageExportDialog} for GFE which adds on option to use the + * Grid Manager Selected Time Range. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date          Ticket#  Engineer    Description
+ * ------------- -------- ----------- --------------------------
+ * Jan 22, 2014  2312     bsteffen    Initial creation
+ * 
+ * 
+ * + * @author bsteffen + * @version 1.0 + */ +public class GfeImageExportDialog extends ImageExportDialog { + + protected Button selectedFrameRangeButton; + + public GfeImageExportDialog(Shell parentShell, ImageExportOptions options) { + super(parentShell, options); + } + + @Override + protected void initializeFramesGroup(Group group) { + super.initializeFramesGroup(group); + selectedFrameRangeButton = new Button(group, SWT.RADIO); + selectedFrameRangeButton.setText("Grid Manager Selected Time Range"); + GridData gridData = new GridData(); + gridData.horizontalSpan = 5; + selectedFrameRangeButton.setLayoutData(gridData); + } + + @Override + protected void okPressed() { + if (selectedFrameRangeButton.getSelection()) { + DataManager dataManager = DataManagerUIFactory.getCurrentInstance(); + ParmOp parmOp = dataManager.getParmOp(); + TimeRange selectedRange = parmOp.getSelectionTimeRange(); + if (selectedRange == null || !selectedRange.isValid()) { + MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR + | SWT.OK); + mb.setText("No Time Range Selected"); + mb.setMessage("No Time Range is selected, select a time range in the grid manager."); + mb.open(); + return; + } + IDisplayPaneContainer container = EditorUtil + .getActiveVizContainer(); + IDisplayPane pane = container.getActiveDisplayPane(); + IRenderableDisplay renderableDispaly = pane.getRenderableDisplay(); + IDescriptor descriptor = renderableDispaly.getDescriptor(); + FramesInfo fi = descriptor.getFramesInfo(); + DataTime[] times = fi.getFrameTimes(); + int start = -1; + int end = -1; + for (int i = 0; i < times.length; i += 1) { + if (times[i] == null) { + continue; + } + TimeRange validRange = times[i].getValidPeriod(); + if (selectedRange.overlaps(validRange)) { + if (start == -1) { + start = i; + } + end = i; + } else if (start != -1) { + break; + } + } + if (start == -1) { + MessageBox mb = new MessageBox(getShell(), SWT.ICON_ERROR + | SWT.OK); + mb.setText("Invalid Selection"); + mb.setMessage("The selected time range does not contain any data, choose a new range."); + mb.open(); + return; + } + options.setFrameSelection(FrameSelection.USER); + options.setFirstFrameIndex(start); + options.setLastFrameIndex(end + 1); + } + super.okPressed(); + } +}