http://gishuangjun.blog.sohu.com/139346974.html
这个是对要素图层渲染,有属性表信息,而我的数据是栅格图像,没有属性表,不能用这种方式。下面这种方式最适合,但是不知道为什么少了一种颜色,您能帮忙看看吗。结果是没有白色。蓝色赋给了两种值
IRasterClassifyColorRampRenderer ClassifyColor = new RasterClassifyColorRampRendererClass();
IRasterRenderer RasterRender = ClassifyColor as IRasterRenderer;
//RasterRender.Raster = RasterLayer.Raster;
//断点设置
ClassifyColor.ClassCount = 6;
ClassifyColor.set_Break(0, 0);
ClassifyColor.set_Break(1, BreakPoint1);
ClassifyColor.set_Break(2, BreakPoint2);
ClassifyColor.set_Break(3, BreakPoint3);
ClassifyColor.set_Break(4, BreakPoint4);
ClassifyColor.set_Break(5, BreakPoint5);
//各个分类的颜色设置
IFillSymbol Symbol = new SimpleFillSymbolClass() as IFillSymbol;
Symbol.Color = new RgbColor() { Red = 0, Green = 0, Blue = 0 }; //0 黑色
ClassifyColor.set_Symbol(0, Symbol as ISymbol);
Symbol.Color = new RgbColor() { Red = 255, Green = 255, Blue = 0 };//1 黄色
ClassifyColor.set_Symbol(1, Symbol as ISymbol);
Symbol.Color = new RgbColor() { Red = 0, Green = 255, Blue = 0 };//2 150
ClassifyColor.set_Symbol(2, Symbol as ISymbol);
Symbol.Color = new RgbColor() { Red = 255, Green = 0, Blue = 0 };//3 200
ClassifyColor.set_Symbol(3, Symbol as ISymbol);
Symbol.Color = new RgbColor() { Red = 255, Green = 255, Blue = 255 };//0
ClassifyColor.set_Symbol(4, Symbol as ISymbol);
Symbol.Color = new RgbColor() { Red = 0, Green = 0, Blue = 255 };//5 255 5 50
ClassifyColor.set_Symbol(5, Symbol as ISymbol);
RasterLayer.Renderer = RasterRender;