AE学习笔记(三)——ArcScene下设置图层BaseHeight

AE学习笔记(三)——ArcScene下设置图层BaseHeight

 public partial class MainForm : Form
 {

       public I3DProperties Get3DPropsFromLayer(ILayer pLyr)
        {
            ILayerExtensions pLyrExts = (ILayerExtensions)pLyr;
            I3DProperties p3DProp = null;
            
            for (int i = 0; i < pLyrExts.ExtensionCount; i++)
                if (pLyrExts.get_Extension(i) is I3DProperties)
                    p3DProp = (I3DProperties)pLyrExts.get_Extension(i);
            return p3DProp;
        }

        public void SetlayerSurface()
        {
            ISceneGraph scenegraph = this.axSceneControl1.SceneGraph;
            IScene scene = scenegraph.Scene;
            ILayer layer;
            layer = scene.get_Layer(0);

            IRasterLayer rlayer;
            rlayer = layer as IRasterLayer;
            IRaster raster;
            IRasterSurface rsurface = new RasterSurface();
            ISurface surface;

            raster = (IRaster)rlayer.Raster;

            IRasterBandCollection rasterbands = raster as IRasterBandCollection;
            IRasterBand rasterband = rasterbands.Item(0);
            rsurface.RasterBand = rasterband;
            surface = rsurface as ISurface;

            ILayerExtensions layerextensions = layer as ILayerExtensions;
            I3DProperties properties = new Raster3DPropertiesClass();
            int i;
            object p3d;
            for (i = 0; i < layerextensions.ExtensionCount; i++)
            {
                p3d = layerextensions.get_Extension(i);
                if (p3d != null)
                {
                    properties = (I3DProperties)p3d;
                    break;
                }
            }

            properties.BaseOption = esriBaseOption.esriBaseSurface;
            properties.BaseSurface = surface;
            properties.Apply3DProperties(layer);
            properties.ZFactor = 20;

            scenegraph = scene.SceneGraph;
            scenegraph.RefreshViewers();
        }

}

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值