Arcgis Engine符号化图层

实际项目中可能会遇到类似需求就是将图层加载到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文件供开发使用。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容