package plugin.examples.usgs_dem;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import plugin.typeinterfaces.DataStreamSource;
import skomp.io.ColorInputStream;
import skomp.io.ColorMode;
public class Importer extends DataStreamSource<Integer> {
private Header header = null;
private String name;
private ColorInputStream stream;
public Header getHeader() {
return header;
}
public void setHeader(Header header) {
this.header = header;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Importer() {
super();
}
@Override
public Integer compute() {
if (header == null) {
try {
this.header = new DemHdrParser(new FileInputStream(name
+ ".HDR")).Start(System.out);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (ParseException e) {
e.printStackTrace();
}
}
if (stream == null) {
try {
stream = new ColorInputStream(new FileInputStream(name + ".DEM"),
ColorMode.HICOLOR16BIT, false);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
return null;
}
}