/** * Returns the tie-point grid at the given index. * * @param index the tie-point grid index * * @return the tie-point grid at the given index * * @throws IndexOutOfBoundsException if the index is out of bounds */ public TiePointGrid getTiePointGridAt(final int index) { return tiePointGridGroup.get(index); }
private Placemark getPlacemarkAt(final int selectedRow) { Placemark placemark = null; if (product != null) { if (selectedRow > -1 && selectedRow < getPlacemarkGroup(product).getNodeCount()) { placemark = getPlacemarkGroup(product).get(selectedRow); } } return placemark; }
private void ensureMaskVisible(ProductSceneView view) { Product product = view.getProduct(); ProductNodeGroup<Mask> overlayMaskGroup = view.getRaster().getOverlayMaskGroup(); Mask mask = overlayMaskGroup.getByDisplayName(MAGIC_WAND_MASK_NAME); if (mask == null) { mask = product.getMaskGroup().get(MAGIC_WAND_MASK_NAME); if (mask != null) { overlayMaskGroup.add(mask); } } }
private void copyIndexCoding() { final ProductNodeGroup<IndexCoding> indexCodingGroup = sourceProduct.getIndexCodingGroup(); for (int i = 0; i < indexCodingGroup.getNodeCount(); i++) { IndexCoding sourceIndexCoding = indexCodingGroup.get(i); ProductUtils.copyIndexCoding(sourceIndexCoding, targetProduct); } }
private static void addMasksToGroup(String[] maskNames, ProductNodeGroup<Mask> maskGroup, ProductNodeGroup<Mask> specialMaskGroup) { for (String maskName : maskNames) { final Mask mask = maskGroup.get(maskName); if (mask != null) { specialMaskGroup.add(mask); } } }
private static void registerMaskSymbols(WritableNamespace namespace, Product product, String namePrefix) { for (int i = 0; i < product.getMaskGroup().getNodeCount(); i++) { final Mask mask = product.getMaskGroup().get(i); final String symbolName = namePrefix + mask.getName(); namespace.registerSymbol(new RasterDataSymbol(symbolName, mask)); } }
/** * Returns the tie-point grid with the given name. * * @param name the tie-point grid name * * @return the tie-point grid with the given name or <code>null</code> if a tie-point grid with the given name is * not contained in this product. */ public TiePointGrid getTiePointGrid(final String name) { Guardian.assertNotNullOrEmpty("name", name); return tiePointGridGroup.get(name); }
protected void addIndexCodingsToProduct(Product product) { final ProductNodeGroup<IndexCoding> indexCodingGroup = getSourceProduct().getIndexCodingGroup(); for (int i = 0; i < indexCodingGroup.getNodeCount(); i++) { IndexCoding sourceIndexCoding = indexCodingGroup.get(i); IndexCoding destIndexCoding = new IndexCoding(sourceIndexCoding.getName()); destIndexCoding.setDescription(sourceIndexCoding.getDescription()); cloneIndexes(sourceIndexCoding, destIndexCoding); product.getIndexCodingGroup().add(destIndexCoding); } }
public void actionPerformed(ActionEvent e) { boolean useRoi = useRoiCheckBox.isSelected(); if (useRoi) { String selectedMaskName = (String) maskNameComboBox.getSelectedItem(); Mask mask = product.getMaskGroup().get(selectedMaskName); method.compute(mask); } else { method.compute(null); } } });
protected void addFlagCodingsToProduct(Product product) { final ProductNodeGroup<FlagCoding> flagCodingGroup = getSourceProduct().getFlagCodingGroup(); for (int i = 0; i < flagCodingGroup.getNodeCount(); i++) { FlagCoding sourceFlagCoding = flagCodingGroup.get(i); FlagCoding destFlagCoding = new FlagCoding(sourceFlagCoding.getName()); destFlagCoding.setDescription(sourceFlagCoding.getDescription()); cloneFlags(sourceFlagCoding, destFlagCoding); product.getFlagCodingGroup().add(destFlagCoding); } }
private static void reprojectBandData(Mask[] selectedMasks, Product sourceProduct, Product targetProduct) { final Map<String, Object> projParameters = Collections.EMPTY_MAP; Map<String, Product> projProducts = new HashMap<String, Product>(); projProducts.put("source", sourceProduct); projProducts.put("collocateWith", targetProduct); Product reprojectedProduct = GPF.createProduct("Reproject", projParameters, projProducts); for (Mask mask : selectedMasks) { Band band = createBandCopy(targetProduct, mask); MultiLevelImage image = reprojectedProduct.getMaskGroup().get(mask.getName()).getSourceImage(); band.setSourceImage(image); } }
private synchronized Layer createMaskCollectionLayer() { final LayerType maskCollectionType = LayerTypeRegistry.getLayerType(MaskCollectionLayerType.class); final PropertySet layerConfig = maskCollectionType.createLayerConfig(null); layerConfig.setValue(MaskCollectionLayerType.PROPERTY_NAME_RASTER, getRaster()); final Layer maskCollectionLayer = maskCollectionType.createLayer(this, layerConfig); ProductNodeGroup<Mask> productNodeGroup = getRaster().getProduct().getMaskGroup(); for (int i = 0; i < productNodeGroup.getNodeCount(); i++) { Layer layer = MaskLayerType.createLayer(getRaster(), productNodeGroup.get(i)); maskCollectionLayer.getChildren().add(layer); } return maskCollectionLayer; }
private static void setFlagCoding(final Element element, final Band band, Product product) { final String codingName = element.getChildTextTrim(DimapProductConstants.TAG_FLAG_CODING_NAME); if (codingName != null) { final FlagCoding flagCoding = product.getFlagCodingGroup().get(codingName); if (flagCoding != null) { band.setSampleCoding(flagCoding); } } }
@Test public void testMaskIsAddedWhenGcpIsAddedForTheFirstTime() throws Exception { final Product p = new Product("P", "T", 1, 1); p.getGcpGroup().add(Placemark.createPointPlacemark(GcpDescriptor.getInstance(), "a", "a", "a", new PixelPos(), new GeoPos(), null)); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("ground_control_points")); }
private static void setIndexCoding(Element element, Band band, Product product) { final String codingName = element.getChildTextTrim(DimapProductConstants.TAG_INDEX_CODING_NAME); if (codingName != null) { final IndexCoding indexCoding = product.getIndexCodingGroup().get(codingName); if (indexCoding != null) { band.setSampleCoding(indexCoding); } } }
@Test public void testMaskIsAddedWhenNonEmptyVdnIsAdded() throws Exception { final Product p = new Product("P", "T", 1, 1); final SimpleFeatureType featureType = new GeometryDescriptor().getBaseFeatureType(); final VectorDataNode node = new VectorDataNode("V", featureType); node.getFeatureCollection().add(new SimpleFeatureBuilder(featureType).buildFeature("id")); p.getVectorDataGroup().add(node); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("V")); }
private static void setFlagCoding(Band band, FlagCoding flagCoding) { if (flagCoding != null) { final String flagCodingName = flagCoding.getName(); final Product product = band.getProduct(); if (!product.getFlagCodingGroup().contains(flagCodingName)) { addFlagCoding(product, flagCoding); } band.setSampleCoding(product.getFlagCodingGroup().get(flagCodingName)); } }
@Test public void testMaskIsAddedWhenFeatureIsAddedForTheFirstTime() throws Exception { final Product p = new Product("P", "T", 1, 1); final SimpleFeatureType featureType = new GeometryDescriptor().getBaseFeatureType(); final VectorDataNode node = new VectorDataNode("V", featureType); p.getVectorDataGroup().add(node); node.getFeatureCollection().add(new SimpleFeatureBuilder(featureType).buildFeature("id")); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("V")); }
@Before() public void setup() { Product product = new Product("PinGroup Test", "TestType", 10, 10); VectorDataNode pinVectorDataNode = product.getVectorDataGroup().get("pins"); pinBuilder = new SimpleFeatureBuilder(pinVectorDataNode.getFeatureType()); placemarkGroup = pinVectorDataNode.getPlacemarkGroup(); pinFeatureCollection = pinVectorDataNode.getFeatureCollection(); }
@Test public void testMaskIsNotAddedWhenPinIsAddedForTheSecondTime() throws Exception { final Product p = new Product("P", "T", 1, 1); p.getPinGroup().add(Placemark.createPointPlacemark(PinDescriptor.getInstance(), "a", "a", "a", new PixelPos(), new GeoPos(), null)); p.getPinGroup().add(Placemark.createPointPlacemark(PinDescriptor.getInstance(), "b", "b", "b", new PixelPos(), new GeoPos(), null)); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("pins")); }