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;
            }

  • 相关阅读:
    推荐美丽的flash网页MP3音乐播放器
    android混合动画实现
    swift UI专项训练39 用Swift实现摇一摇功能
    The return type is incompatible with JspSourceDependent.getDependants():JasperException问题分析与解决方法
    【翻译自mos文章】注意: ASMB process exiting due to lack of ASM file activity
    表格对象QTableWidget相关常见方法
    python 加密解密
    python报错ordinal not in range(128)
    scp,ssh双机互信操作步骤
    PyQt多窗口调用
  • 原文地址:https://www.cnblogs.com/CSharpLover/p/5970155.html
Copyright © 2011-2022 走看看