示例#1
0
 private void addSubsetInfoMetadata(Product product) {
   if (getSubsetDef() != null) {
     ProductSubsetDef subsetDef = getSubsetDef();
     Product sourceProduct = getSourceProduct();
     String nameSubsetinfo = "SubsetInfo";
     MetadataElement subsetElem = new MetadataElement(nameSubsetinfo);
     addAttribString("SourceProduct.name", sourceProduct.getName(), subsetElem);
     subsetElem.setAttributeInt("SubSampling.x", subsetDef.getSubSamplingX());
     subsetElem.setAttributeInt("SubSampling.y", subsetDef.getSubSamplingY());
     if (subsetDef.getRegion() != null) {
       Rectangle region = subsetDef.getRegion();
       subsetElem.setAttributeInt("SubRegion.x", region.x);
       subsetElem.setAttributeInt("SubRegion.y", region.y);
       subsetElem.setAttributeInt("SubRegion.width", region.width);
       subsetElem.setAttributeInt("SubRegion.height", region.height);
     }
     String[] nodeNames = subsetDef.getNodeNames();
     if (nodeNames != null) {
       for (int i = 0; i < nodeNames.length; i++) {
         addAttribString("ProductNodeName." + (i + 1), nodeNames[i], subsetElem);
       }
     }
     ProductUtils.addElementToHistory(product, subsetElem);
   }
 }
示例#2
0
 private boolean isFullScene(ProductSubsetDef subsetDef) {
   if (subsetDef == null) {
     return true;
   }
   final Rectangle sourceRegion =
       new Rectangle(0, 0, sourceProduct.getSceneRasterWidth(), getSceneRasterHeight());
   return subsetDef.getRegion() == null
       || subsetDef.getRegion().equals(sourceRegion)
           && subsetDef.getSubSamplingX() == 1
           && subsetDef.getSubSamplingY() == 1;
 }