private static void setSubsetSRGRCoefficients( final Product sourceProduct, final Product targetProduct, final ProductSubsetDef subsetDef, final MetadataElement absRoot, final boolean nearRangeOnLeft) { final MetadataElement SRGRCoefficientsElem = absRoot.getElement("SRGR_Coefficients"); if (SRGRCoefficientsElem != null) { final double rangeSpacing = absRoot.getAttributeDouble("RANGE_SPACING", 0); final double colIndex = subsetDef.getRegion() == null ? 0 : subsetDef.getRegion().getX(); for (MetadataElement srgrList : SRGRCoefficientsElem.getElements()) { final double grO = srgrList.getAttributeDouble("ground_range_origin", 0); double ground_range_origin_subset; if (nearRangeOnLeft) { ground_range_origin_subset = grO + colIndex * rangeSpacing; } else { final double colIndexFromRight = sourceProduct.getSceneRasterWidth() - colIndex - targetProduct.getSceneRasterWidth(); ground_range_origin_subset = grO + colIndexFromRight * rangeSpacing; } srgrList.setAttributeDouble("ground_range_origin", ground_range_origin_subset); } } }
private ProductNodeSubsetPane createAnnotationSubsetPane() { final MetadataElement metadataRoot = product.getMetadataRoot(); final MetadataElement[] metadataElements = metadataRoot.getElements(); final String[] metaNodes; if (metadataElements.length == 0) { return null; } // metadata elements must be added to includeAlways list // to ensure that they are selected if isIgnoreMetada is set to false if (givenProductSubsetDef != null && !givenProductSubsetDef.isIgnoreMetadata()) { metaNodes = new String[metadataElements.length]; for (int i = 0; i < metadataElements.length; i++) { final MetadataElement metadataElement = metadataElements[i]; metaNodes[i] = metadataElement.getName(); } } else { metaNodes = new String[0]; } final String[] includeNodes = StringUtils.addToArray(metaNodes, Product.HISTORY_ROOT_NAME); return new ProductNodeSubsetPane(metadataElements, includeNodes, true); }