Arcgis Engine符号化图层

2019-11-19  本文已影响0人  一位热爱文学的程序员

实际项目中可能会遇到类似需求就是将图层加载到map控件中时自动配准符号。遇到类似需求其实arcgis engine中提供了在layer图层上添加符号的接口。

ISymbol pSymbol;

IStyleGalleryItem pStyleGallerItem = null;

IStyleGallery pStyleGaller = new ServerStyleGalleryClass();

 IStyleGalleryStorage pStyleGalleryStorage = pStyleGaller as IStyleGalleryStorage;

//样式文件路径

string styleNames = path + "\\ESRI.ServerStyle";

pStyleGalleryStorage.AddFile(styleNames);

//获取线标识

pEnumSyleGalleryItem = pStyleGaller.get_Items("Line Symbols", styleNames, "");

//获取符号

 pSymbol = pStyleGallerItem.Item as ISymbol;

//更改符号样式

ISimpleRenderer pSimpleRenderer = new SimpleRendererClass();

pSimpleRenderer.Symbol = pSymbol;

//将标识附给图层

 geoFeatureLayer.Renderer = pSimpleRenderer as IFeatureRenderer;

核心部分是构建符号库,实际上arcgis里面有style文件,但是style文件不能直接被engine调用,故arcgis提供了一个小工具MakeServerStyleSet.exe。然后将style文件导入进去,即可生serverstyle文件供开发使用。

上一篇 下一篇

猜你喜欢

热点阅读