分享

ArcEngine更改指定Polyline图层的显示符号

 昵称QAb6ICvc 2013-01-31

使用AE开发,有时会由程序生成新的图层,并添加到MapControl中显示,而此时如果没有完备的符号选择器的话,新添加的此图层的显示,比如最基础的线条的颜色粗细就会被随机指定。有时这个问题无所谓,但有时我们就会希望能由程序指定其显示的具体方式。于是就有了下面的函数代码,当然,这个函数只是为polyline图层指定相应的显示方式,point以及polygon的显示方式还没有涉及到,貌似也差不多。

实现代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
private void funChangeStyle(IFeatureLayer pFL)
{
    IFeatureLayer featureLayer = pFL;
    IGeoFeatureLayer geoFeatureLayer = (IGeoFeatureLayer)featureLayer;
    ISimpleRenderer simpleRenderer;
    ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
    simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
    simpleLineSymbol.Width = 1.5;
    IRgbColor rgbColor = new RgbColorClass();
    rgbColor.Red = 255;
    rgbColor.Green = 0;
    rgbColor.Blue = 0;
    simpleLineSymbol.Color = rgbColor;
    simpleRenderer = new SimpleRendererClass();
    simpleRenderer.Symbol = (ISymbol)simpleLineSymbol;
    geoFeatureLayer.Renderer = (IFeatureRenderer)simpleRenderer;
    mainMap.ActiveView.ContentsChanged();
    mainMap.Refresh(esriViewDrawPhase.esriViewGeography, null, null);
}

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多