RasterImageLayerType extends ImageLayer.Type { @Override public ImageLayer createLayer(LayerContext ctx, PropertySet configuration) { MultiLevelSource multiLevelSource = (MultiLevelSource) configuration.getValue( ImageLayer.PROPERTY_NAME_MULTI_LEVEL_SOURCE); if (multiLevelSource == null) { final RasterDataNode raster = (RasterDataNode) configuration.getValue(PROPERTY_NAME_RASTER); multiLevelSource = BandImageMultiLevelSource.create(raster, ProgressMonitor.NULL); configuration.setValue(ImageLayer.PROPERTY_NAME_MULTI_LEVEL_SOURCE, multiLevelSource); } return new ImageLayer(this, multiLevelSource, configuration); }  @Override ImageLayer createLayer(LayerContext ctx, PropertySet configuration); @Override PropertySet createLayerConfig(LayerContext ctx); Layer createLayer(RasterDataNode raster, MultiLevelSource multiLevelSource); static final String PROPERTY_NAME_RASTER; }
@Test public void testCreateLayerWithSingleRaster() { final RasterImageLayerType layerType = (RasterImageLayerType) getLayerType(); final Product product = new Product("N", "T", 10, 10); final Band raster = new VirtualBand("A", ProductData.TYPE_INT32, 10, 10, "42"); product.addBand(raster); final ImageLayer imageLayer = (ImageLayer) layerType.createLayer(raster, null); assertNotNull(imageLayer.getMultiLevelSource()); }