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

    &a

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

    Code
            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(nulltrue);
                IFeature pFeature 
    = pFeatCursor.NextFeature();

                
    if (pFeature == null)
                {
                    pFeature 
    = pFeatCursor.NextFeature();
                }
                
    else
                {
                    IFeatureRenderer pFeatRen;
                    pFeatRen 
    = pGeoFeatLayer.Renderer;
                    pSymbol 
    = pFeatRen.get_SymbolByFeature(pFeature);
                }
                
    return pSymbol;
            }
  • 相关阅读:
    DataTable 导出到Excel
    asp.net 连接新浪微博
    ASP.NET中的HTTP模块和处理程序
    asp.net 前台获得url参数的最简单方法
    将Excel导入到DataTable (用ODBC方法连接)
    下拉框控件dhtmlXCombo在ASP.NET中的使用详解
    iis站点 asp.net网站访问弹出提示框
    习惯的力量
    1.面向对象设计模式与原则
    5. Factory Method 工厂方法(创建型模式)
  • 原文地址:https://www.cnblogs.com/myparamita/p/1453740.html
Copyright © 2011-2022 走看看