public CIMRasterColorizer GetColorizer()
Public Function GetColorizer() As CIMRasterColorizer
public CIMRasterColorizer GetColorizer()
Public Function GetColorizer() As CIMRasterColorizer
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
await QueuedTask.Run(() => { // Get the colorizer from the raster layer. CIMRasterColorizer rasterColorizer = rasterLayer.GetColorizer(); // Update raster colorizer properties. rasterColorizer.Brightness = 10; rasterColorizer.Contrast = -5; rasterColorizer.ResamplingType = RasterResamplingType.NearestNeighbor; // Update the raster layer with the changed colorizer. rasterLayer.SetColorizer(rasterColorizer); });
await QueuedTask.Run(() => { // Get the colorizer from the raster layer. CIMRasterColorizer rColorizer = rasterLayer.GetColorizer(); // Check if the colorizer is an RGB colorizer. if (rColorizer is CIMRasterRGBColorizer rasterRGBColorizer) { // Update RGB colorizer properties. rasterRGBColorizer.StretchType = RasterStretchType.ESRI; // Update the raster layer with the changed colorizer. rasterLayer.SetColorizer(rasterRGBColorizer); } });
await QueuedTask.Run(() => { // Get the image sub-layer from the mosaic layer. ImageMosaicSubLayer mosaicImageSubLayer = mosaicLayer.GetImageLayer(); // Get the colorizer from the image sub-layer. CIMRasterColorizer rasterColorizer = mosaicImageSubLayer.GetColorizer(); // Update raster colorizer properties. rasterColorizer.Brightness = 10; rasterColorizer.Contrast = -5; rasterColorizer.ResamplingType = RasterResamplingType.NearestNeighbor; // Update the image sub-layer with the changed colorizer. mosaicImageSubLayer.SetColorizer(rasterColorizer); });
await QueuedTask.Run(() => { // Get the image sub-layer from the mosaic layer. ImageMosaicSubLayer mosaicImageSubLayer = mosaicLayer.GetImageLayer(); // Get the colorizer from the image sub-layer. CIMRasterColorizer rColorizer = mosaicImageSubLayer.GetColorizer(); // Check if the colorizer is an RGB colorizer. if (rColorizer is CIMRasterRGBColorizer rasterRGBColorizer) { // Update RGB colorizer properties. rasterRGBColorizer.StretchType = RasterStretchType.ESRI; // Update the image sub-layer with the changed colorizer. mosaicImageSubLayer.SetColorizer(rasterRGBColorizer); } });
await QueuedTask.Run(() => { // Get the colorizer from the image service layer. CIMRasterColorizer rasterColorizer = isLayer.GetColorizer(); // Update the colorizer properties. rasterColorizer.Brightness = 10; rasterColorizer.Contrast = -5; rasterColorizer.ResamplingType = RasterResamplingType.NearestNeighbor; // Update the image service layer with the changed colorizer. isLayer.SetColorizer(rasterColorizer); });
await QueuedTask.Run(() => { // Get the colorizer from the image service layer. CIMRasterColorizer rColorizer = isLayer.GetColorizer(); // Check if the colorizer is an RGB colorizer. if (rColorizer is CIMRasterRGBColorizer rasterRGBColorizer) { // Update RGB colorizer properties. rasterRGBColorizer.StretchType = RasterStretchType.ESRI; // Update the image service layer with the changed colorizer. isLayer.SetColorizer((CIMRasterColorizer)rasterRGBColorizer); } });
//If a raster dataset has statistics, you can create a raster layer and get these statistics by accessing the colorizer. await QueuedTask.Run(() => { //Accessing the raster layer var lyr = MapView.Active.Map.GetLayersAsFlattenedList().OfType<BasicRasterLayer>().FirstOrDefault(); //Getting the colorizer var colorizer = lyr.GetColorizer() as CIMRasterStretchColorizer; //Accessing the statistics var stats = colorizer.StretchStats; var max = stats.max; var min = stats.min; });
Target Platforms: Windows 11, Windows 10