HecDssImage is an extension of HecDssFileStore, which contains additional information about image files, including the image size. (Images are often used to hold maps of watersheds, or photos of a stream gage or critical locations.)
For image files, the D part should be the word "IMAGE" (instead of "FILE"). Method calls are the same as those used in Files. The pathname conventions for Image data are:
Parts A, B and F – not specified
Part C: The image name
Part D: The word "IMAGE"
Part E: The file's extension (without the "." Separator)
The primary method calls for HecDssImage are:
public int write(File file)
public int write(File file, DSSPathname pathname)
public int exportToFile(File file)
public void runProcess()
public static void runProcess(String dssFileAndPath)
In addition, PhotoViewer (in hec.util) can be used to control and scroll through images read from HEC-DSS, if you want more control than just using the standard OS viewer. An image, and information about the image are passed in PhotoViewerInfo, which is used to read the image from DSS, then passed to the Photo Viewer Frame. For example:
HecDssImage dssImage = new HecDssImage();
int status = dssImage.setDSSFileName("C:/temp/Example7.dss");
dssImage.setPathname("///CrystalGage/IMAGE/jpg//");
PhotoViewerInfo pvInfo = new PhotoViewerInfo();
status = dssImage.read(pvInfo);
PhotoViewerJFrame viewerFrame = new PhotoViewerJFrame(pvInfo);
viewerFrame.setVisible(true);
You can use the same frame for viewing multiple images with the "addNextImage" method:
PhotoViewerJFrame addNextImage(PhotoViewerInfo pvInfo,boolean showNextButton);
The showNextButton allows the user to press a "Next" button to scroll through the images at their own pace. Pressing the Next Button causes an observable event with the name "nextImage", as demonstrated in the last image example.