image export includes full timestamp, export directory defined as /awips2/export/<user>

This commit is contained in:
mjames-upc 2016-01-18 20:11:31 -06:00
parent e2ae440409
commit 54f8dfdbd6
3 changed files with 13 additions and 9 deletions

View file

@ -58,7 +58,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Oct 28, 2014 3767 bsteffen Automatically change filename if selected * Oct 28, 2014 3767 bsteffen Automatically change filename if selected
* format does not support all options. * format does not support all options.
* Dec 4, 2014 DR16713 jgerth Support for date/time selection * Dec 4, 2014 DR16713 jgerth Support for date/time selection
* * Jan 18, 2016 ---- mjames@ucar datetimeButton selected by default
*
* </pre> * </pre>
* *
* @author bsteffen * @author bsteffen
@ -141,8 +142,7 @@ public class ImageExportDialog extends CaveSWTDialog {
datetimeButton = new Button(group, SWT.CHECK); datetimeButton = new Button(group, SWT.CHECK);
datetimeButton.setLayoutData(gridData); datetimeButton.setLayoutData(gridData);
datetimeButton.setText("Include date and time in file name"); datetimeButton.setText("Include date and time in file name");
datetimeButton datetimeButton.setSelection(true);
.setSelection(options.getDateTimeSelection() == DateTimeSelection.DATETIME);
datetimeButton datetimeButton
.setToolTipText("Append the date and time to the file name when Animate is not selected."); .setToolTipText("Append the date and time to the file name when Animate is not selected.");
} }

View file

@ -80,6 +80,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* Jul 26, 2006 chammack Initial Creation. * Jul 26, 2006 chammack Initial Creation.
* Jan 20, 2014 2312 bsteffen Move to image export plugin, animation. * Jan 20, 2014 2312 bsteffen Move to image export plugin, animation.
* Dec 4, 2014 DR16713 jgerth Support for date and time in file name * Dec 4, 2014 DR16713 jgerth Support for date and time in file name
* Jan 18, 2016 ---- mjames@ucar Append yyyy.MM.dd.HH.mm.ss to image filename
* *
* </pre> * </pre>
* *
@ -213,21 +214,22 @@ public class ExportImageHandler extends AbstractImageCaptureHandler {
for (Map.Entry<DataTime, BufferedImage> entry : dtbiHash.entrySet()) { for (Map.Entry<DataTime, BufferedImage> entry : dtbiHash.entrySet()) {
i++; i++;
BufferedImage bi = entry.getValue(); BufferedImage bi = entry.getValue();
String timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());
if (options.getDateTimeSelection() == DateTimeSelection.DATETIME) { if (options.getDateTimeSelection() == DateTimeSelection.DATETIME) {
DataTime key = entry.getKey(); DataTime key = entry.getKey();
Date validTime = key.getValidTimeAsDate(); Date validTime = key.getValidTimeAsDate();
if (validTime != null && !isFakeTime(key)) { if (validTime != null && !isFakeTime(key)) {
path = basePath + "-" + sdf.format(validTime) + "." + suffix; path = basePath + "-" + sdf.format(validTime) + "-" + timeStamp + "." + suffix;
if (path.equals(ppath)) { if (path.equals(ppath)) {
path = basePath + "-" + sdf.format(validTime) + "-" + twoDigit.format(i).toString() + "." + suffix; path = basePath + "-" + sdf.format(validTime) + "-" + twoDigit.format(i).toString() + "-" + timeStamp + "." + suffix;
} }
} else { } else {
path = basePath + "-" + twoDigit.format(i).toString() + "." + suffix; path = basePath + "-" + twoDigit.format(i).toString() + "-" + timeStamp + "." + suffix;
} }
} else if (dtbiHash.size() > 1) { } else if (dtbiHash.size() > 1) {
path = basePath + "-" + twoDigit.format(i).toString() + "." + suffix; path = basePath + "-" + twoDigit.format(i).toString() + "-" + timeStamp + "." + suffix;
} else { } else {
path = basePath + "." + suffix; path = basePath + "-" + timeStamp + "." + suffix;
} }
ppath = path; ppath = path;
stream = new FileImageOutputStream(new File(path)); stream = new FileImageOutputStream(new File(path));

View file

@ -39,6 +39,8 @@ import com.raytheon.uf.viz.core.datastructure.LoopProperties;
* Mar 10, 2014 2867 bsteffen Better frame range validation. * Mar 10, 2014 2867 bsteffen Better frame range validation.
* Oct 28, 2014 3767 bsteffen Change default name to screenCapture.png * Oct 28, 2014 3767 bsteffen Change default name to screenCapture.png
* Dec 4, 2014 DR16713 jgerth Support for date/time selection * Dec 4, 2014 DR16713 jgerth Support for date/time selection
* Jan 18, 2016 ---- mjames@ucar Save images to /awips2/export/<username> rather than
* /awips2/eclipse (and avoid guessing that /home/awips exists)
* *
* </pre> * </pre>
* *
@ -85,7 +87,7 @@ public class ImageExportOptions {
} }
private File fileLocation = new File("screenCapture.png"); private File fileLocation = new File("/awips2/export/" + System.getProperty("user.name") + "/screenCapture.png");
private ImageFormat imageFormat = ImageFormat.SEQUENCE; private ImageFormat imageFormat = ImageFormat.SEQUENCE;