修改图层的symbol(AE+C#)
2009-05-10 19:37
337 查看
&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(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;
}
取出一个图层的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(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;
}
相关文章推荐
- 修改图层的symbol(AE+C#)
- AE+C#通过多线程向GlobeControl中增加图层
- AE+C# 图层中增加相应属性标注
- AE+C# 实现MERGE, AE实现相同结构图层的合并C#代码(转载)
- C#+AE 展开/收缩图层的图例
- C#+AE写的一段加载图层
- AE+C#开发问题之二——axTOCControl控件图层不显示问题
- c#+AE-图层唯一值渲染
- C#+AE加载shape图层
- AE+C#开发问题之五——地图代数ERROR 010328: Syntax error at or near symbol NEW-LINE.
- ae+C#实现图层管理控件上的图层移动功能
- C# + AE 判断图层类型
- C#+AE 调整TOCControl控件中图层的显示顺序
- 改变图层的透明度(AE+C#)
- AE+C# 给图层添加字段
- AE+C#多个相同类型的图层联合
- C# + AE 判断图层类型
- c# 使用datagridview 浏览shp图层属性表(是否可以在这里直接修改呢?有待研究)
- C#+AE 展开/收缩图层的图例
- AE实现不同图层的合并C#代码