I have an image catalog composed of 4 band rasters. I would like to use the same image catalog, and set custom renderers for a true color and false color combination and save each of those catalogs off as a layer file. In addition I would like to turn off the default stretch for each catalog. The code I am using is below (where lyr is a reference to a raster catalog):
IRasterCatalogLayer rcl = lyr as IRasterCatalogLayer;
IRasterRGBRenderer pRGB = new RasterRGBRendererClass();
IRasterStretch pRasStretch = pRGB as IRasterStretch;
rcl.Renderer = pRGB as IRasterRenderer;
pRasStretch.StretchType = esriRasterStretchTypesEnum.esriRasterStretch_NONE;
int r, g, b;
pRGB.QueryBandIndices(out r, out g, out b);
pRGB.UseRedBand = true;
pRGB.RedBandIndex = 3;
pRGB.UseGreenBand = true;
pRGB.GreenBandIndex = 0;
pRGB.UseBlueBand = true;
pRGB.BlueBandIndex = 1;
int r1, g1, b1;
pRGB.QueryBandIndices(out r1, out g1, out b1);
rcl.Renderer.Update();
The stretch is being applied without problem, but I cannot change the band combinations. Thoughts? Is there a better way to do this without resorting to ArcObjects to create layer files.