private void checkRaster(RasterDataNode raster, String type) { final String validExpr = raster.getValidPixelExpression(); if (validExpr != null && !product.isCompatibleBandArithmeticExpression(validExpr)) { raster.setValidPixelExpression(null); String pattern = "Valid pixel expression ''{0}'' removed from output {1} ''{2}'' " + "because it is not applicable."; /*I18N*/ messages.add(MessageFormat.format(pattern, validExpr, type, raster.getName())); } } });
public void testValidMaskExpressionIsAdjustedIfNodeNameChanged() { final RasterDataNode rasterDataNode = createRasterDataNode(); rasterDataNode.setValidPixelExpression("flagsBand.f1 || not flagsBand.f2"); final Product product = new Product("p", "NoType", rasterDataNode.getRasterWidth(), rasterDataNode.getRasterHeight()); addRasterDataNodeToProduct(product, rasterDataNode); final FlagCoding flagCoding = new FlagCoding("f"); flagCoding.addFlag("f1", 0x01, "descr"); flagCoding.addFlag("f2", 0x02, "descr"); final Band flagsBand = product.addBand("flagsBand", ProductData.TYPE_INT8); flagsBand.setSampleCoding(flagCoding); product.getFlagCodingGroup().add(flagCoding); flagsBand.setName("flags"); final String currentExpression = rasterDataNode.getValidPixelExpression(); final String expectedExpression = "flags.f1 || not flags.f2"; assertEquals("name is not changed", expectedExpression, currentExpression); }
final String renamedExpression = "ident_1 + newIdent - ident_3"; final RasterDataNode node = createRasterDataNode(); node.setValidPixelExpression(initialExpression); final int width = node.getSceneRasterWidth(); final int height = node.getSceneRasterHeight();
targetRaster.setNoDataValueUsed(sourceRaster.isNoDataValueUsed()); targetRaster.setNoDataValue(sourceRaster.getNoDataValue()); targetRaster.setValidPixelExpression(sourceRaster.getValidPixelExpression()); if (sourceRaster instanceof Band && targetRaster instanceof Band) { Band sourceBand = (Band) sourceRaster;
rasterDataNode.setValidPixelExpression(paramValidPixelExpr.getValueAsText());