Esempio n. 1
0
 private void setStx(Stx stx) {
   if (stx != null) {
     HistogramPanelModel.HistogramConfig config = createHistogramConfig();
     if (config == null) {
       return;
     }
     if (!model.hasStx(config)) {
       model.setStx(config, stx);
     }
     dataset = new XIntervalSeriesCollection();
     final int[] binCounts = stx.getHistogramBins();
     final RasterDataNode raster = getRaster();
     final XIntervalSeries series = new XIntervalSeries(raster.getName());
     final Histogram histogram = stx.getHistogram();
     for (int i = 0; i < binCounts.length; i++) {
       final double xMin = histogram.getBinLowValue(0, i);
       final double xMax =
           i < binCounts.length - 1
               ? histogram.getBinLowValue(0, i + 1)
               : histogram.getHighValue(0);
       series.add(xMin, xMin, xMax, binCounts[i]);
     }
     dataset.addSeries(series);
   }
   handleStxChange();
 }
Esempio n. 2
0
 private void updateLogXAxisCheckBox() {
   HistogramPanelModel.HistogramConfig config = createHistogramConfig();
   final boolean enabled =
       dataset != null
           && model.hasStx(config)
           && model.getStx(config).getMinimum() > 0
           && !model.getStx(config).isLogHistogram();
   Binding binding = xAxisRangeControl.getBindingContext().getBinding(PROPERTY_NAME_LOG_SCALED);
   if (!enabled) {
     binding.setPropertyValue(false);
   }
   log10AxisEnablement.apply();
   binding.adjustComponents();
 }
Esempio n. 3
0
  @Override
  public String getDataAsText() {
    HistogramPanelModel.HistogramConfig config = createHistogramConfig();
    if (!model.hasStx(config)) {
      return null;
    }

    Stx stx = model.getStx(config);
    final int[] binVals = stx.getHistogramBins();
    final int numBins = binVals.length;
    final double min = stx.getMinimum();
    final double max = stx.getMaximum();

    final StringBuilder sb = new StringBuilder(16000);

    sb.append("Product name:\t").append(getRaster().getProduct().getName()).append("\n");
    sb.append("Dataset name:\t").append(getRaster().getName()).append("\n");
    sb.append('\n');
    sb.append("Histogram minimum:\t")
        .append(min)
        .append("\t")
        .append(getRaster().getUnit())
        .append("\n");
    sb.append("Histogram maximum:\t")
        .append(max)
        .append("\t")
        .append(getRaster().getUnit())
        .append("\n");
    sb.append("Histogram bin size:\t")
        .append(
            getRaster().isLog10Scaled()
                ? ("NA\t")
                : ((max - min) / numBins + "\t") + getRaster().getUnit() + "\n");
    sb.append("Histogram #bins:\t").append(numBins).append("\n");
    sb.append('\n');

    sb.append("Bin center value");
    sb.append('\t');
    sb.append("Bin counts");
    sb.append('\n');

    for (int i = 0; i < numBins; i++) {
      sb.append(min + ((i + 0.5) * (max - min)) / numBins);
      sb.append('\t');
      sb.append(binVals[i]);
      sb.append('\n');
    }

    return sb.toString();
  }
Esempio n. 4
0
 private void handleStxChange() {
   if (model.hasStx(createHistogramConfig())) {
     refreshButton.setEnabled(false);
   }
   log10HistEnablement.apply();
   updateLogXAxisCheckBox();
   chart.getXYPlot().setDataset(dataset);
   updateXAxis();
   chart.fireChartChanged();
 }
Esempio n. 5
0
 @Override
 public void nodeDataChanged(ProductNodeEvent event) {
   super.nodeDataChanged(event);
   if (!histogramPlotConfig.useRoiMask) {
     return;
   }
   final Mask roiMask = histogramPlotConfig.roiMask;
   if (roiMask == null) {
     return;
   }
   final ProductNode sourceNode = event.getSourceNode();
   if (!(sourceNode instanceof Mask)) {
     return;
   }
   final String maskName = sourceNode.getName();
   if (roiMask.getName().equals(maskName)) {
     model.removeStx(createHistogramConfig());
     updateComponents();
   }
 }
Esempio n. 6
0
 private void updateRefreshButton() {
   refreshButton.setEnabled(getRaster() != null && !model.hasStx(createHistogramConfig()));
 }