private static List<RasterDataNode> getReferencedVirtualBands(final RasterDataNode node) { final Product product = node.getProduct(); final List<RasterDataNode> rasterList = new ArrayList<RasterDataNode>(); if (product != null) { for (int i = 0; i < product.getNumBands(); i++) { final Band band = product.getBandAt(i); if (band instanceof VirtualBand) { final VirtualBand virtualBand = (VirtualBand) band; if (isNodeReferencedByExpression(node, virtualBand.getExpression())) { rasterList.add(virtualBand); } } } } return rasterList; }
private static List<RasterDataNode> getReferencedValidMasks(final RasterDataNode node) { final Product product = node.getProduct(); final List<RasterDataNode> rasterList = new ArrayList<RasterDataNode>(); if (product != null) { for (int i = 0; i < product.getNumBands(); i++) { final Band band = product.getBandAt(i); if (band != node) { if (isNodeReferencedByExpression(node, band.getValidPixelExpression())) { rasterList.add(band); } } } for (int i = 0; i < product.getNumTiePointGrids(); i++) { final TiePointGrid tiePointGrid = product.getTiePointGridAt(i); if (tiePointGrid != node) { if (isNodeReferencedByExpression(node, tiePointGrid.getValidPixelExpression())) { rasterList.add(tiePointGrid); } } } } return rasterList; }
private static List<RasterDataNode> getReferencedMasks(final RasterDataNode node) { final Product product = node.getProduct(); final List<RasterDataNode> rasterList = new ArrayList<RasterDataNode>(); if (product != null) { final ProductNodeGroup<Mask> maskGroup = product.getMaskGroup(); final Mask[] masks = maskGroup.toArray(new Mask[maskGroup.getNodeCount()]); for (final Mask mask : masks) { final String expression; if (mask.getImageType() == Mask.BandMathsType.INSTANCE) { expression = Mask.BandMathsType.getExpression(mask); } else if (mask.getImageType() == Mask.RangeType.INSTANCE) { expression = Mask.RangeType.getRasterName(mask); } else { expression = null; } if (isNodeReferencedByExpression(node, expression)) { rasterList.add(mask); } } } return rasterList; }