zoukankan      html  css  js  c++  java
  • 使用AE加载带有制图表达(Representation)的图层(Layer)

    制图表达(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

  • 相关阅读:
    UVA 11776
    NEFU 117
    hihocoder 1331
    NEFU 84
    虚拟机类加载机制
    动态规划 -- 01背包问题和完全背包问题
    动态规划 ---- 最长回文子串
    动态规划 ---- 最长公共子序列(Longest Common Subsequence, LCS)
    动态规划 ---- 最长不下降子序列(Longest Increasing Sequence, LIS)
    动态规划(Dynamic Programming, DP)---- 最大连续子序列和 & 力扣53. 最大子序和
  • 原文地址:https://www.cnblogs.com/cannel/p/2740870.html
Copyright © 2011-2022 走看看