01: package com.vividsolutions.jump.workbench.imagery.mrsid;
02:
03: /*
04: * The Unified Mapping Platform (JUMP) is an extensible, interactive GUI
05: * for visualizing and manipulating spatial features with geometry and attributes.
06: *
07: * Copyright (C) 2003 Vivid Solutions
08: *
09: * This program is free software; you can redistribute it and/or
10: * modify it under the terms of the GNU General Public License
11: * as published by the Free Software Foundation; either version 2
12: * of the License, or (at your option) any later version.
13: *
14: * This program is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: * GNU General Public License for more details.
18: *
19: * You should have received a copy of the GNU General Public License
20: * along with this program; if not, write to the Free Software
21: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22: *
23: * For more information, contact:
24: *
25: * Vivid Solutions
26: * Suite #1A
27: * 2328 Government Street
28: * Victoria BC V8T 5G5
29: * Canada
30: *
31: * (250)385-6040
32: * www.vividsolutions.com
33: */
34: import java.io.IOException;
35:
36: import com.vividsolutions.jump.JUMPException;
37: import com.vividsolutions.jump.workbench.imagery.ReferencedImage;
38: import com.vividsolutions.jump.workbench.imagery.ReferencedImageFactory;
39:
40: public class MrSIDImageFactory implements ReferencedImageFactory {
41: public static final String MRSIDDECODE = "mrsidgeodecode.exe";
42: public static final String MRSIDINFO = "mrsidgeoinfo.exe";
43:
44: public String getTypeName() {
45: return "MrSID";
46: }
47:
48: public ReferencedImage createImage(String location)
49: throws JUMPException {
50:
51: return new MrSIDReferencedImage(SIDInfo.readInfo(location),
52: location);
53: }
54:
55: public String getDescription() {
56: return getTypeName();
57: }
58:
59: public String[] getExtensions() {
60: return new String[] { "sid" };
61: }
62:
63: public boolean isEditableImage(String location) {
64: return false;
65: }
66:
67: public boolean isAvailable() {
68: int i = -1;
69: try {
70: Process p = Runtime.getRuntime().exec(MRSIDINFO + " -h");
71: p.waitFor();
72: i = p.exitValue();
73: p.destroy();
74: } catch (IOException e) {
75: // eat it
76: return false;
77: } catch (InterruptedException e) {
78: // eat it
79: return false;
80: }
81:
82: return i == 0;
83: }
84:
85: }
|