/** * Copies the overlay {@link Mask}s from the source product's raster data nodes to * the target product's raster data nodes. * <p/> * IMPORTANT NOTE: This method should only be used, if it is known that all masks * in the source product will also be valid in the target product. This method does * <em>not</em> copy overlay masks, which are not contained in the target product's * mask group. * * @param sourceProduct the source product * @param targetProduct the target product */ public static void copyOverlayMasks(Product sourceProduct, Product targetProduct) { for (RasterDataNode sourceNode : sourceProduct.getTiePointGrids()) { copyOverlayMasks(sourceNode, targetProduct); } for (RasterDataNode sourceNode : sourceProduct.getBands()) { copyOverlayMasks(sourceNode, targetProduct); } }
mergeAutoGrouping(srcProduct); ProductUtils.copyMasks(srcProduct, targetProduct); ProductUtils.copyOverlayMasks(srcProduct, targetProduct);
/** * Copies all bands which contain a flag-coding from the source product to the target product. * * @param sourceProduct the source product * @param targetProduct the target product * @param copySourceImage whether the source image of the source band should be copied. * * @since BEAM 4.10 */ public static void copyFlagBands(Product sourceProduct, Product targetProduct, boolean copySourceImage) { Guardian.assertNotNull("source", sourceProduct); Guardian.assertNotNull("target", targetProduct); if (sourceProduct.getFlagCodingGroup().getNodeCount() > 0) { // loop over bands and check if they have a flags coding attached for (int i = 0; i < sourceProduct.getNumBands(); i++) { Band sourceBand = sourceProduct.getBandAt(i); String bandName = sourceBand.getName(); if (sourceBand.isFlagBand() && targetProduct.getBand(bandName) == null) { copyBand(bandName, sourceProduct, targetProduct, copySourceImage); } } // first the bands have to be copied and then the masks // other wise the referenced bands, e.g. flag band, is not contained in the target product // and the mask is not copied copyMasks(sourceProduct, targetProduct); copyOverlayMasks(sourceProduct, targetProduct); } }
ProductUtils.copyOverlayMasks(sourceProduct, targetProduct);
addGeoCodingToProduct(product); ProductUtils.copyVectorData(sourceProduct, product); ProductUtils.copyOverlayMasks(sourceProduct, product); ProductUtils.copyPreferredTileSize(sourceProduct, product); setSceneRasterStartAndStopTime(product);
ProductUtils.copyMasks(getSourceProduct(), product); ProductUtils.copyVectorData(sourceProduct, product); ProductUtils.copyOverlayMasks(sourceProduct, product); ProductUtils.copyPreferredTileSize(sourceProduct, product); product.setStartTime(sourceProduct.getStartTime());
ProductUtils.copyOverlayMasks(sourceProduct, targetProduct); targetProduct.setAutoGrouping(sourceProduct.getAutoGrouping());