Пример #1
0
  private void copyStx(RasterDataNode sourceRaster, RasterDataNode targetRaster) {
    final Stx sourceStx = sourceRaster.getStx();
    final Histogram sourceHistogram = sourceStx.getHistogram();
    final Histogram targetHistogram =
        new Histogram(
            sourceStx.getHistogramBinCount(),
            sourceHistogram.getLowValue(0),
            sourceHistogram.getHighValue(0),
            1);

    System.arraycopy(
        sourceHistogram.getBins(0),
        0,
        targetHistogram.getBins(0),
        0,
        sourceStx.getHistogramBinCount());

    final Stx targetStx =
        new Stx(
            sourceStx.getMinimum(),
            sourceStx.getMaximum(),
            sourceStx.getMean(),
            sourceStx.getStandardDeviation(),
            sourceStx.getCoefficientOfVariation(),
            sourceStx.getEquivalentNumberOfLooks(),
            sourceStx.isLogHistogram(),
            sourceStx.isIntHistogram(),
            targetHistogram,
            sourceStx.getResolutionLevel());

    targetRaster.setStx(targetStx);
  }
Пример #2
0
 private void copyImageInfo(RasterDataNode sourceRaster, RasterDataNode targetRaster) {
   final ImageInfo imageInfo;
   if (sourceRaster.getImageInfo() != null) {
     imageInfo = sourceRaster.getImageInfo().createDeepCopy();
     targetRaster.setImageInfo(imageInfo);
   }
 }
Пример #3
0
 private void collectNotIncludedReferences(
     final RasterDataNode rasterDataNode, final Set<String> notIncludedNames) {
   final RasterDataNode[] referencedNodes = getReferencedNodes(rasterDataNode);
   for (final RasterDataNode referencedNode : referencedNodes) {
     final String name = referencedNode.getName();
     if (!productSubsetDef.isNodeAccepted(name) && !notIncludedNames.contains(name)) {
       notIncludedNames.add(name);
       collectNotIncludedReferences(referencedNode, notIncludedNames);
     }
   }
 }
Пример #4
0
  private static RasterDataNode[] getReferencedNodes(final RasterDataNode node) {
    final Product product = node.getProduct();
    if (product != null) {
      final List<String> expressions = new ArrayList<String>(10);
      if (node.getValidPixelExpression() != null) {
        expressions.add(node.getValidPixelExpression());
      }
      final ProductNodeGroup<Mask> overlayMaskGroup = node.getOverlayMaskGroup();
      if (overlayMaskGroup.getNodeCount() > 0) {
        final Mask[] overlayMasks =
            overlayMaskGroup.toArray(new Mask[overlayMaskGroup.getNodeCount()]);
        for (final Mask overlayMask : overlayMasks) {
          final String expression;
          if (overlayMask.getImageType() == Mask.BandMathsType.INSTANCE) {
            expression = Mask.BandMathsType.getExpression(overlayMask);
          } else if (overlayMask.getImageType() == Mask.RangeType.INSTANCE) {
            expression = Mask.RangeType.getExpression(overlayMask);
          } else {
            expression = null;
          }
          if (expression != null) {
            expressions.add(expression);
          }
        }
      }
      if (node instanceof VirtualBand) {
        final VirtualBand virtualBand = (VirtualBand) node;
        expressions.add(virtualBand.getExpression());
      }

      final ArrayList<Term> termList = new ArrayList<Term>(10);
      for (final String expression : expressions) {
        try {
          final Term term = product.parseExpression(expression);
          if (term != null) {
            termList.add(term);
          }
        } catch (ParseException e) {
          // @todo se handle parse exception
          Debug.trace(e);
        }
      }

      final Term[] terms = termList.toArray(new Term[termList.size()]);
      final RasterDataSymbol[] refRasterDataSymbols = BandArithmetic.getRefRasterDataSymbols(terms);
      return BandArithmetic.getRefRasters(refRasterDataSymbols);
    }
    return new RasterDataNode[0];
  }
Пример #5
0
  @Override
  protected void updateComponents() {
    if (!isInitialized || !isVisible()) {
      return;
    }

    final RasterDataNode raster = getRaster();
    if (raster != null) {
      chart.setTitle(CHART_TITLE + " for " + raster.getName());
    } else {
      chart.setTitle(CHART_TITLE);
    }

    correlativeFieldSelector.updatePointDataSource(getProduct());

    updateDataSource();
    updateDataSet();
    updateUIState();
    super.updateComponents();
  }