zoukankan      html  css  js  c++  java
  • 根据图层获取要素的渲染颜色

    根据图层获取要素的渲染颜色

    public IColor GetFeatureLayerColor(IFeatureLayer pFeatureLayer,IFeature pFeature)
            {
                if (pFeature == null || pFeature == null) return null;
                IColor _result = new RgbColorClass();
                IGeoFeatureLayer pGeoFT = pFeatureLayer as IGeoFeatureLayer;
                IFeatureRenderer pFeatureRender = pGeoFT.Renderer;
                if (pFeatureRender != null)
                {
                    if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                    {
                        ILineSymbol pLineSymbol = null;
                        pLineSymbol = (ILineSymbol)pFeatureRender.get_SymbolByFeature(pFeature);
                        _result = pLineSymbol.Color;
                    }
                    else if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
                    {
                        IFillSymbol pFillSymboll = (IFillSymbol)pFeatureRender.get_SymbolByFeature(pFeature);
                        _result = pFillSymboll.Color;
                    }
                    else if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                    {
                        IMarkerSymbol pMarkerSymbol = (IMarkerSymbol)pFeatureRender.get_SymbolByFeature(pFeature);
                        _result = pMarkerSymbol.Color;
                    }
                }
                return _result;
            }
    通过IFeatureRender.get_SymbolByFeature(IFeature pFeature)方法获取要素的渲染方式,再根据不同类型图层的渲染方法转换到相应的接口获取颜色。

  • 相关阅读:
    Principle of Computing (Python)学习笔记(5) BFS Searching + Zombie Apocalypse
    《Java从入门到精通》src9-25
    《Java从入门到精通》src0-8
    windows查看某个端口被谁占用
    css selector: xpath:
    awk 正则表达式
    Centos系统各种日志存详解
    mysql日志文件
    mysql主键设置成auto_increment时,进行并发性能測试出现主键反复Duplicate entry 'xxx' for key 'PRIMARY'
    递归函数时间复杂度分析
  • 原文地址:https://www.cnblogs.com/lauer0246/p/1112777.html
Copyright © 2011-2022 走看看