Package plugin.examples.usgs_dem

Source Code of plugin.examples.usgs_dem.Importer

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;
  }
}
TOP

Related Classes of plugin.examples.usgs_dem.Importer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.