Esempio n. 1
0
  public static ModFileWriter createBand(
      PlotState state, ImagePlot plot, FileReadInfo readInfo, ActiveFitsReadGroup frGroup)
      throws FitsException, IOException, GeomException {
    ModFileWriter retval = null;
    Band band = readInfo.getBand();

    plot.setThreeColorBand(
        state.isBandVisible(readInfo.getBand()) ? readInfo.getFitsRead() : null,
        readInfo.getBand(),
        frGroup);
    HistogramOps histOps = plot.getHistogramOps(band, frGroup);
    FitsRead tmpFR = histOps.getFitsRead();
    if (tmpFR != readInfo.getFitsRead()
        && readInfo.getWorkingFile()
            != null) { // testing to see it the fits read got geomed when the band was added
      state.setImageIdx(0, band);
      retval =
          new ModFileWriter.GeomFileWriter(
              readInfo.getWorkingFile(), 0, tmpFR, readInfo.getBand(), false);
      FitsCacher.addFitsReadToCache(retval.getTargetFile(), new FitsRead[] {tmpFR});
    }

    RangeValues rv = state.getRangeValues(readInfo.getBand());
    if (rv == null) {
      rv = FitsRead.getDefaultFutureStretch();
      state.setRangeValues(rv, readInfo.getBand());
    }
    histOps.recomputeStretch(rv, true);
    return retval;
  }