Ejemplo n.º 1
0
  public void create(
      final String name,
      final String filename,
      final AnalysisExtent ae,
      int dataType,
      final int numBands,
      final GProjection projection) {

    if (projection == null) {
      _projection = ProjectionUtils.getDefaultProjection();
    } else {
      _projection = projection;
    }

    if (dataType == DataBuffer.TYPE_DOUBLE) {
      dataType = DataBuffer.TYPE_FLOAT;
    }

    System.out.println(ae.getNX());
    System.out.println(ae.getNY());
    _raster = RasterFactory.createBandedRaster(dataType, ae.getNX(), ae.getNY(), numBands, null);

    _filename = filename;
    _name = name;
    _layerExtent = ae;
    _noDataValue = DEFAULT_NO_DATA_VALUE;
  }
Ejemplo n.º 2
0
  @Override
  public void postProcess() {

    try {

      // BufferedImage bi = new
      // BufferedImage(RasterRenderer.getDefaultColorModel(
      // (WritableRaster)m_Raster), (WritableRaster)m_Raster, false,
      // null);
      // Sector sector = Sector.fromDegrees(m_LayerExtent.getYMin(),
      // m_LayerExtent.getYMax(),
      // m_LayerExtent.getXMin(), m_LayerExtent.getXMax());
      // GeotiffWriter writer;
      // File file = new File(m_sFilename);
      // writer = new GeotiffWriter(file);
      // writer.write(bi);
      // TODO:Sector???????????
      final File file = new File(_filename);
      final GRasterGeodata geodata =
          new GRasterGeodata(
              _layerExtent.getXMin(),
              _layerExtent.getYMin(),
              _layerExtent.getCellSize(),
              _layerExtent.getNY(),
              _layerExtent.getNX(),
              _projection);

      final GGlobeRasterLayer layer = new GGlobeRasterLayer(_raster, geodata);
      layer.setNoDataValue(_noDataValue);
      layer.setName(_name);
      ESRIAsciiFileTools.writeFile(layer, file);
      create(layer);

    } catch (final Exception e) {
      e.printStackTrace();
    }
  }