Draping a layer on an elevation surface in globe
To drape a layer on an elevation surface in globe, do the following steps:
- Properly initialize the following variables:
- ESRI.ArcGIS.GlobeCore.IGlobeDisplay globeDisplay
- ESRI.ArcGIS.Carto.ILayer layer - The layer to be draped on the elevation raster.
-
System.String elevationRasterFilePath - The path to the elevation raster file that is stored on disk.
-
Get the IGlobeDisplayLayers interface from globeDisplay as shown in the following code example:
IGlobeDisplayLayers globeDisplayLayers=(IGlobeDisplayLayers)globeDisplay;
// Explicit cast.
[VB.NET] Dim globeDisplayLayers As IGlobeDisplayLayers=CType(globeDisplay, IGlobeDisplayLayers) ' Explicit cast.
- Create the elevation raster (elevationRasterLayerCls) as shown in the following code example:
IRasterLayer elevationRasterLayerCls=new RasterLayerClass();
elevationRasterLayerCls.CreateFromFilePath(elevationRasterFilePath);
[VB.NET] Dim elevationRasterLayerCls As IRasterLayer=New RasterLayerClass()
elevationRasterLayerCls.CreateFromFilePath(elevationRasterFilePath)
- Create a variable of GlobeLayerPropertiesClass and set the type to elevation as shown in the following code example:
ESRI.ArcGIS.GlobeCore.IGlobeLayerProperties globeLayerPropertiesCls=new
ESRI.ArcGIS.GlobeCore.GlobeLayerPropertiesClass();
globeLayerPropertiesCls.Type =
ESRI.ArcGIS.GlobeCore.esriGlobeDataType.esriGlobeDataElevation;
[VB.NET] Dim globeLayerPropertiesCls As IGlobeLayerProperties=New GlobeLayerPropertiesClass()
globeLayerPropertiesCls.Type=esriGlobeDataType.esriGlobeDataElevation
- Get the ILayerExtensions interface for the elevationRasterLayerCls and add to it the globeLayerPropertiesCls extension as shown in the following code example:
ILayerExtensions layerExtension=(ILayerExtensions)elevationRasterLayerCls;
// Explicit cast.
layerExtension.AddExtension(globeLayerPropertiesCls);
[VB.NET] Dim layerExtension As ILayerExtensions=CType(elevationRasterLayerCls, ILayerExtensions) ' Explicit cast.
layerExtension.AddExtension(globeLayerPropertiesCls)
- Get IGlobeLayerProperties for the layer to be draped on the elevation raster as shown in the following code example:
IGlobeLayerProperties drapeLayerGlobeLayerProperties =
globeDisplayLayers.FindGlobeProperties(layer);
[VB.NET] Dim drapeLayerGlobeLayerProperties As IGlobeLayerProperties=globeDisplayLayers.FindGlobeProperties(layer)
- Get IGlobeHeightProperties for the layer to be draped on the elevation raster as shown in the following code example:
IGlobeHeightProperties drapeLayerGlobeHeightProperties =
drapeLayerGlobeLayerProperties.HeightProperties;
[VB.NET] Dim drapeLayerGlobeHeightProperties As IGlobeHeightProperties=drapeLayerGlobeLayerProperties.HeightProperties
- Set the base layer for drapeLayerGlobeHeightProperties to be the layer (elevationRasterLayerCls) as shown in the following code example:
drapeLayerGlobeHeightProperties.BaseLayer=elevationRasterLayerCls;
[VB.NET] drapeLayerGlobeHeightProperties.BaseLayer=elevationRasterLayerCls
- Set the base option for drapeLayerGlobeHeightProperties to be esriGlobeLayerBaseLayer as shown in the following code example:
drapeLayerGlobeHeightProperties.BaseOption =
ESRI.ArcGIS.GlobeCore.esriGlobeLayerBaseOption.esriGlobeLayerBaseLayer;
[VB.NET] drapeLayerGlobeHeightProperties.BaseOption=esriGlobeLayerBaseOption.esriGlobeLayerBaseLayer
- Apply the height properties (drapeLayerGlobeHeightProperties) to the layer to be draped on the elevation raster (layer) as shown in the following code example:
drapeLayerGlobeHeightProperties.Apply(globeDisplay.Globe, layer);
[VB.NET] drapeLayerGlobeHeightProperties.Apply(globeDisplay.Globe, layer)
- Refresh the globeDisplay as shown in the following code example:
globeDisplay.RefreshViewers();
[VB.NET] globeDisplay.RefreshViewers()
To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing | Deployment licensing |
---|---|
ArcGIS Desktop Advanced: 3D Analyst | ArcGIS Desktop Advanced: 3D Analyst |
ArcGIS Desktop Basic: 3D Analyst | ArcGIS Desktop Basic: 3D Analyst |
ArcGIS Desktop Standard: 3D Analyst | ArcGIS Desktop Standard: 3D Analyst |
Engine Developer Kit | Engine: 3D Analyst |