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

论坛 期权论坛 脚本     
匿名技术用户   2021-1-2 06:42   36   0

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();
}

}

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP