• AE开发中栅格图层实现分级渲染


    GP工具IDW执行后,生成的栅格图层是黑白二色,需要手动进行分级渲染,似乎不是所有栅格图层都可以进行分级渲染,注意异常处理。注意ARCMAP中是有颜色的,无需自己处理。

    IRasterClassifyColorRampRenderer pClassRender = new RasterClassifyColorRampRendererClass();
    
                    IRasterRenderer pRasterRender = pClassRender as IRasterRenderer;
    
                    pRasterRender.Raster = rl.Raster;
    
                    pClassRender.ClassCount = 10; ////分10级
    
     
    
                    pRasterRender.Update();
    
                    IAlgorithmicColorRamp pRamp = new AlgorithmicColorRampClass();
    
                    IRgbColor startColor = new RgbColorClass();
    
                    IRgbColor endColor = new RgbColorClass(); ////自己选颜色吧
    
                    startColor.Red = 225;
    
                    startColor.Green = 0;
    
                    startColor.Blue = 128;
    
                    pRamp.FromColor = startColor as IColor;
    
                    endColor.Red = 135;
    
                    endColor.Green = 42;
    
                    endColor.Blue = 8;
    
                    pRamp.ToColor = endColor as IColor;
    
                    pRamp.Size = 10;
    
                    bool ok = true;
    
                    pRamp.CreateRamp(out ok);
    
                    ISimpleFillSymbol pFillSymbo = new SimpleFillSymbolClass();
    
                    for (int i = 0; i < 10; i++)
    
                    {
    
                        pFillSymbo.Color = pRamp.get_Color(i);
    
                        pClassRender.set_Symbol(i, pFillSymbo as ISymbol);
    
                        pClassRender.set_Label(i, Convert.ToString(i + 1));
    
                    }
    
                    pRasterRender.Update();
    
                    rl.Renderer = pClassRender as IRasterRenderer;
    
     
    
                    map.AddLayer(rl as ILayer);
  • 相关阅读:
    Solr的核心操作案例
    分布式锁
    AngularJS——AngularJS实现地址栏取值
    【转】保证消息队列的高可用性
    【转】Spring线程及线程池的使用
    微信支付实现
    分布式id的生成方式——雪花算法
    重载new和delete
    C++工程实践
    语言基础(27):异常处理
  • 原文地址:https://www.cnblogs.com/jhlong/p/5394487.html
Copyright © 2020-2023  润新知