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)方法获取要素的渲染方式,再根据不同类型图层的渲染方法转换到相应的接口获取颜色。

  • 相关阅读:
    各种算法时空复杂度
    Python文本处理(1)
    数学之路(3)-机器学习(3)-机器学习算法-欧氏距离(3)
    为什么要选择cdn加速
    数据库中操作XML(openXML)
    HDU 3308 LCIS
    Android有效解决加载大图片时内存溢出的问题
    Pathchirp—有效的带宽估计方法(二)
    php三元运算
    C# MVC 自学笔记—4 添加视图
  • 原文地址:https://www.cnblogs.com/lauer0246/p/1112777.html
Copyright © 2011-2022 走看看