zoukankan      html  css  js  c++  java
  • 修改图层的symbol(AE+C#)

    取出一个图层的symbol 在其基础上对其进行修改

       private void button1_Click(object sender, EventArgs e)
            {
      mp;nbsp;          //设定要改变symbol的图层
                ILayer pLayer=m_mapControl.get_Layer(0);
                IGeoFeatureLayer pGeoFeatLayer = pLayer as IGeoFeatureLayer;

                //得到此图层的symbol
                ISimpleMarkerSymbol pMarkerSymbol=new SimpleMarkerSymbolClass();
                pMarkerSymbol=GetFeatureLayerSymbol(pLayer) as ISimpleMarkerSymbol;

                //对symbol进行改变操作
                pMarkerSymbol.Size=20;    

                //把改变后的symbol赋给此图层
                ISimpleRenderer pRenderer=new SimpleRendererClass();
                pRenderer.Symbol=pMarkerSymbol as ISymbol;
                pGeoFeatLayer.Renderer = pRenderer as IFeatureRenderer;

              
            }

            /// <summary> 得到指定图层的symbol</summary>
            /// <param name="layer"></param>
            /// <returns></returns>
            public ISymbol GetFeatureLayerSymbol(ILayer layer)
            {
                ISymbol pSymbol = null;

                IGeoFeatureLayer pGeoFeatLayer = (IGeoFeatureLayer)layer;
                IFeatureClass pFeatClass = pGeoFeatLayer.FeatureClass;
                IFeatureCursor pFeatCursor = pFeatClass.Search(null, true);
                IFeature pFeature = pFeatCursor.NextFeature();

                if (pFeature == null)
                {
                    pFeature = pFeatCursor.NextFeature();
                }
                else
                {
                    IFeatureRenderer pFeatRen;
                    pFeatRen = pGeoFeatLayer.Renderer;
                    pSymbol = pFeatRen.get_SymbolByFeature(pFeature);
                }
                return pSymbol;
            }

  • 相关阅读:
    rename 批量重命名
    shell脚本实现轮询查看进程是否结束
    mysql 修改max_connections
    window10下的solr6.1.0入门笔记之---安装部署
    php下载大文件
    【转】Pyhton 单行、多行注释符号使用方法及规范
    window10系统下使用python版本实现mysql查询
    Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A
    【Visual Studio】 使用EF、 Linq2Sql快速创建数据交互层(一)
    【OPCAutomation】 使用OPCAutomation实现对OPC数据的访问
  • 原文地址:https://www.cnblogs.com/CSharpLover/p/5970155.html
Copyright © 2011-2022 走看看