Public Function Clone() As CIMRasterStretchColorizer
public CIMRasterStretchColorizer Clone()
Public Function Clone() As CIMRasterStretchColorizer
public CIMRasterStretchColorizer Clone()
{
// Check if the Stretch colorizer can be applied to the raster layer.
//Note: needs to be called on the QueuedTask
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);
}
}
{
// Check if the Stretch colorizer can be applied to the raster layer.
//Get a color ramp from a style
StyleProjectItem ArcGISColorsStyleItem =
Project.Current.GetItems<StyleProjectItem>().FirstOrDefault(s => s.Name == "ArcGIS Colors");
var colorRamps = ArcGISColorsStyleItem.SearchColorRamps("Heat Map 4 - Semitransparent");
CIMColorRamp colorRampToUse = colorRampList[0].ColorRamp;
//Note: needs to be called on the QueuedTask
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);
}
}
{
// Get the image sub-layer from the mosaic layer.
//Note: needs to be called on the QueuedTask
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);
}
}
{
// Get the image sub-layer from the mosaic layer.
//Note: needs to be called on the QueuedTask
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);
}
}
{
// Check if the Stretch colorizer can be applied to the image service layer.
if (imageServiceLayer.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 imageServiceLayer.CreateColorizerAsync(stretchColorizerDef_default) as CIMRasterStretchColorizer;
// Set the new colorizer on the image service layer.
imageServiceLayer.SetColorizer(newStretchColorizer_default);
}
}
{
// Check if the Stretch colorizer can be applied to the image service layer.
//Note: needs to be called on the QueuedTask
if (imageServiceLayer.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 imageServiceLayer.CreateColorizerAsync(stretchColorizerDef_custom) as CIMRasterStretchColorizer;
// Set the new colorizer on the image service layer.
imageServiceLayer.SetColorizer(newStretchColorizer_custom);
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)