显示波段顺序设置

Posted on 2019-11-25 22:58  云起  阅读(11)  评论(0编辑  收藏  举报  来源

通过栅格渲染,控制栅格图层的显示。多波段栅格,创建默认栅格,通过RGB方式进行显示。在arcmap中,界面菜单如上。交互功能暂且不论,仅说设置波段顺序功能实现代码如下:

IRasterLayer rlyr = axMapControl1.get_Layer(0) as IRasterLayer;
IRasterRenderer rasterRender = rlyr.Renderer;
if (rasterRender is IRasterRGBRenderer)
{
    int r, g, b;
    IRasterRGBRenderer rgbRender = rasterRender as IRasterRGBRenderer;
    rgbRender.QueryBandIndices(out r, out g, out b);//获取rgb通道序列
    rgbRender.SetBandIndices(g,r,b);//设置rgb通道序列

    IRasterRGBRenderer2 rgbRenderer2 = rasterRender as IRasterRGBRenderer2;
    rgbRenderer2.UseAlphaBand = true;//使用透明通道
    rgbRenderer2.AlphaBandIndex = r;
    rlyr.Renderer = rgbRenderer2 as IR

Copyright © 2024 云起
Powered by .NET 9.0 on Kubernetes