Esempio n. 1
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);
     }
   }
 }
Esempio n. 2
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];
  }
Esempio n. 3
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();
  }