@Override public void visit(ProductNodeGroup group) { visitedList.add(group.getName()); }
private static ProductNode group(ProductNodeGroup<? extends RasterDataNode> bandGroup, Product.AutoGrouping autoGrouping) { HashMap<String, ProductNodeGroup<ProductNode>> subGroupMap = new HashMap<String, ProductNodeGroup<ProductNode>>(); ProductNodeGroup<ProductNode> newGroup = new ProductNodeGroup<ProductNode>(null, bandGroup.getName(), false); newGroup.setDescription(bandGroup.getDescription()); final int count = bandGroup.getNodeCount(); for (int i = 0; i < count; i++) { RasterDataNode band = bandGroup.get(i); String bandName = band.getName(); int groupPathIndex = autoGrouping.indexOf(bandName); if (groupPathIndex >= 0) { // todo - this is still wrong, must support group separators ('/') for nested groups (nf 20100622) String subGroupName = createGroupName(autoGrouping.get(groupPathIndex)); ProductNodeGroup<ProductNode> subGroup = subGroupMap.get(subGroupName); if (subGroup == null) { subGroup = new ProductNodeGroup<ProductNode>(null, subGroupName, false); subGroupMap.put(subGroupName, subGroup); newGroup.add(subGroup); } subGroup.add(band); } else { newGroup.add(band); } } return newGroup; }