public void SetColorizer( CIMRasterColorizer colorizer )
Public Sub SetColorizer( _ ByVal colorizer As CIMRasterColorizer _ )
Parameters
- colorizer
- Your custom colorizer that will be used to draw the raster layer.
public void SetColorizer( CIMRasterColorizer colorizer )
Public Sub SetColorizer( _ ByVal colorizer As CIMRasterColorizer _ )
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
System.ArgumentException | Cannot set colorizer for layer. |
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(async () => { // Check if the Stretch colorizer can be applied to the raster layer. if (rasterLayer.GetApplicableColorizers().Contains(RasterColorizerType.StretchColorizer)) { // Create a new Stretch Colorizer Definition using the default constructor. StretchColorizerDefinition stretchColorizerDef_default = new StretchColorizerDefinition(); // Create a new Stretch colorizer using the colorizer definition created above. CIMRasterStretchColorizer newStretchColorizer_default = await rasterLayer.CreateColorizerAsync(stretchColorizerDef_default) as CIMRasterStretchColorizer; // Set the new colorizer on the raster layer. rasterLayer.SetColorizer(newStretchColorizer_default); } });
await QueuedTask.Run(async () => { // Check if the Stretch colorizer can be applied to the raster layer. if (rasterLayer.GetApplicableColorizers().Contains(RasterColorizerType.StretchColorizer)) { // Create a new Stretch Colorizer Definition specifying parameters // for band index, stretch type, gamma and color ramp. StretchColorizerDefinition stretchColorizerDef_custom = new StretchColorizerDefinition(1, RasterStretchType.ESRI, 2, colorRamp); // Create a new stretch colorizer using the colorizer definition created above. CIMRasterStretchColorizer newStretchColorizer_custom = await rasterLayer.CreateColorizerAsync(stretchColorizerDef_custom) as CIMRasterStretchColorizer; // Set the new colorizer on the raster layer. rasterLayer.SetColorizer(newStretchColorizer_custom); } });
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(async () => { // Get the image sub-layer from the mosaic layer. ImageMosaicSubLayer mosaicImageSubLayer = mosaicLayer.GetImageLayer(); // Check if the Stretch colorizer can be applied to the image sub-layer. if (mosaicImageSubLayer.GetApplicableColorizers().Contains(RasterColorizerType.StretchColorizer)) { // Create a new Stretch Colorizer Definition using the default constructor. StretchColorizerDefinition stretchColorizerDef_default = new StretchColorizerDefinition(); // Create a new Stretch colorizer using the colorizer definition created above. CIMRasterStretchColorizer newStretchColorizer_default = await mosaicImageSubLayer.CreateColorizerAsync(stretchColorizerDef_default) as CIMRasterStretchColorizer; // Set the new colorizer on the image sub-layer. mosaicImageSubLayer.SetColorizer(newStretchColorizer_default); } });
await QueuedTask.Run(async () => { // Get the image sub-layer from the mosaic layer. ImageMosaicSubLayer mosaicImageSubLayer = mosaicLayer.GetImageLayer(); // Check if the Stretch colorizer can be applied to the image sub-layer. if (mosaicImageSubLayer.GetApplicableColorizers().Contains(RasterColorizerType.StretchColorizer)) { // Create a new Stretch colorizer definition specifying parameters // for band index, stretch type, gamma and color ramp. StretchColorizerDefinition stretchColorizerDef_custom = new StretchColorizerDefinition(1, RasterStretchType.ESRI, 2, colorRamp); // Create a new stretch colorizer using the colorizer definition created above. CIMRasterStretchColorizer newStretchColorizer_custom = await mosaicImageSubLayer.CreateColorizerAsync(stretchColorizerDef_custom) as CIMRasterStretchColorizer; // Set the new colorizer on the image sub-layer. mosaicImageSubLayer.SetColorizer(newStretchColorizer_custom); } });
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); } });
await QueuedTask.Run(async () => { // Check if the Stretch colorizer can be applied to the image service layer. if (isLayer.GetApplicableColorizers().Contains(RasterColorizerType.StretchColorizer)) { // Create a new Stretch Colorizer Definition using the default constructor. StretchColorizerDefinition stretchColorizerDef_default = new StretchColorizerDefinition(); // Create a new Stretch colorizer using the colorizer definition created above. CIMRasterStretchColorizer newStretchColorizer_default = await isLayer.CreateColorizerAsync(stretchColorizerDef_default) as CIMRasterStretchColorizer; // Set the new colorizer on the image service layer. isLayer.SetColorizer(newStretchColorizer_default); } });
await QueuedTask.Run(async () => { // Check if the Stretch colorizer can be applied to the image service layer. if (isLayer.GetApplicableColorizers().Contains(RasterColorizerType.StretchColorizer)) { // Create a new Stretch Colorizer Definition specifying parameters // for band index, stretch type, gamma and color ramp. StretchColorizerDefinition stretchColorizerDef_custom = new StretchColorizerDefinition(1, RasterStretchType.ESRI, 2, colorRamp); // Create a new stretch colorizer using the colorizer definition created above. CIMRasterStretchColorizer newStretchColorizer_custom = await isLayer.CreateColorizerAsync(stretchColorizerDef_custom) as CIMRasterStretchColorizer; // Set the new colorizer on the image service layer. isLayer.SetColorizer(newStretchColorizer_custom); } });
Target Platforms: Windows 11, Windows 10, Windows 8.1