使用AE加载带有制图表达(Representation)的图层(Layer)

本文介绍如何在ArcGIS中利用制图表达(Representation)功能将样式保存到数据文件,而不依赖于.mxd文件。通过具体步骤展示了如何在ArcEngine环境中手动加载制图表达样式,包括获取IRepresentationWorkspaceExtension接口及实例化RepresentationRendererClass等关键操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

制图表达(Representation)能把样式保存到数据而不用依赖mxd。

在ArcMap中添加这些有制图表达的图层,添加时就会自动加载制图表达作为样式。但在AE中,添加图层时制图表达不会自动使用,需要如下代码

1.先获取IRepresentationWorkspaceExtension接口

IWorkspaceExtensionManager tWorkspaceExtManager = tWorkspace as IWorkspaceExtensionManager;
UID tUID = new UIDClass();
tUID.Value = "{FD05270A-8E0B-4823-9DEE-F149347C32B6}";
IRepresentationWorkspaceExtension tRepWorkspaceExt = tWorkspaceExtManager.FindExtension(tUID) as IRepresentationWorkspaceExtension;

2.先用FeatureClassRepresentationNames获取FeatureClass对应的IRepresentationClass名称,然后再获取IRepresentationClass,最后实例化RepresentationRendererClass并赋值属性RepresentationClass,此时再把图层添加到MapControl中则带有制图表达。
IEnumDatasetName tEnumDatasetName = tRepWorkspaceExt.get_FeatureClassRepresentationNames(pFeatLayer.FeatureClass);
tEnumDatasetName.Reset();                
IDatasetName tDatasetName = tEnumDatasetName.Next();
if (tDatasetName != null)
{
   IRepresentationClass tRepClass = tRepWorkspaceExt.OpenRepresentationClass(tDatasetName.Name);
 
    IRepresentationRenderer tRepresentationRenderer = new RepresentationRendererClass();
    tRepresentationRenderer.RepresentationClass = tRepClass;
 
    tGeoFeatLayer.Renderer = tRepresentationRenderer as IFeatureRenderer;
 
 }
 总的思路就是,通过IRepresentationWorkspaceExtension获取该图层对应的IRepresentationClass,从而构成渲染对象IRepresentationRenderer
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值