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

  • 相关阅读:
    UML学习
    A problem has been encountered while loading the setup components. VS2008
    C#获取资源中的图片文件
    [网络技巧]一个网线头来测试网络程序
    通过传递"窗体的名字"来实例化窗体
    [解决方案] Flex TypeError: Error #1007: 尝试实例化的函数不是构造函数。
    Flex编译器的一些参数
    ArcGIS 9.3安装流程(包括Desktop和Server)
    Oracle Wrong solution [整理中]
    What's DOM?(1)
  • 原文地址:https://www.cnblogs.com/lauer0246/p/1112777.html
Copyright © 2011-2022 走看看