This document is archived and information here might be outdated. Recommended version. |
Drape a layer on an elevation surface.
///<summary>Drape a layer on an elevation surface.</summary> /// ///<param name="globeDisplay">An IGlobeDisplay interface</param> ///<param name="layer">An ILayer which is to draped on the globe</param> ///<param name="elevationRasterFilePath">A System.String that is the location of the elevation raster file. Example: "C:\temp\theElevationRaster"</param> /// ///<remarks></remarks> public void AddDrapeLayerToGlobeElevationSurface(ESRI.ArcGIS.GlobeCore.IGlobeDisplay globeDisplay, ESRI.ArcGIS.Carto.ILayer layer, System.String elevationRasterFilePath) { ESRI.ArcGIS.GlobeCore.IGlobeDisplayLayers globeDisplayLayers=(ESRI.ArcGIS.GlobeCore.IGlobeDisplayLayers)globeDisplay; // Explicit cast // Create elevation raster layer ESRI.ArcGIS.Carto.IRasterLayer elevationRasterLayer=new ESRI.ArcGIS.Carto.RasterLayerClass(); elevationRasterLayer.CreateFromFilePath(elevationRasterFilePath); // Create and add the GlobeLayerProperties extension with the Type set to ElevationData ESRI.ArcGIS.GlobeCore.IGlobeLayerProperties globeLayerProperties=new ESRI.ArcGIS.GlobeCore.GlobeLayerPropertiesClass(); globeLayerProperties.Type=ESRI.ArcGIS.GlobeCore.esriGlobeDataType.esriGlobeDataElevation; ESRI.ArcGIS.Carto.ILayerExtensions layerExtension=(ESRI.ArcGIS.Carto.ILayerExtensions)elevationRasterLayer; // Explicit cast layerExtension.AddExtension(globeLayerProperties); // Set the base option for layer to be esriGlobeLayerBaseLayer and its base layer to be ElevationLayer ESRI.ArcGIS.GlobeCore.IGlobeLayerProperties drapeLayerGlobeLayerProperties=globeDisplayLayers.FindGlobeProperties(layer); ESRI.ArcGIS.GlobeCore.IGlobeHeightProperties drapeLayerGlobeHeightProperties=drapeLayerGlobeLayerProperties.HeightProperties; drapeLayerGlobeHeightProperties.BaseLayer=elevationRasterLayer; drapeLayerGlobeHeightProperties.BaseOption=ESRI.ArcGIS.GlobeCore.esriGlobeLayerBaseOption.esriGlobeLayerBaseLayer; // Apply the height properties of the layer drapeLayerGlobeHeightProperties.Apply(globeDisplay.Globe, layer); globeDisplay.RefreshViewers(); }
'''<summary>Drape a layer on an elevation surface.</summary> ''' '''<param name="globeDisplay">An IGlobeDisplay interface</param> '''<param name="layer">An ILayer which is to draped on the globe</param> '''<param name="elevationRasterFilePath">A System.String that is the location of the elevation raster file. Example: "C:\temp\theElevationRaster"</param> ''' '''<remarks></remarks> Public Sub AddDrapeLayerToGlobeElevationSurface(ByVal globeDisplay As ESRI.ArcGIS.GlobeCore.IGlobeDisplay, ByVal layer As ESRI.ArcGIS.Carto.ILayer, ByVal elevationRasterFilePath As System.String) Dim globeDisplayLayers As ESRI.ArcGIS.GlobeCore.IGlobeDisplayLayers=CType(globeDisplay, ESRI.ArcGIS.GlobeCore.IGlobeDisplayLayers) ' Explicit Cast ' Create elevation raster layer Dim elevationRasterLayer As ESRI.ArcGIS.Carto.IRasterLayer=New ESRI.ArcGIS.Carto.RasterLayerClass elevationRasterLayer.CreateFromFilePath(elevationRasterFilePath) ' Create and add the GlobeLayerProperties extension with the Type set to ElevationData Dim globeLayerProperties As ESRI.ArcGIS.GlobeCore.IGlobeLayerProperties=New ESRI.ArcGIS.GlobeCore.GlobeLayerPropertiesClass globeLayerProperties.Type=ESRI.ArcGIS.GlobeCore.esriGlobeDataType.esriGlobeDataElevation Dim layerExtension As ESRI.ArcGIS.Carto.ILayerExtensions=CType(elevationRasterLayer, ESRI.ArcGIS.Carto.ILayerExtensions) ' Explicit Cast layerExtension.AddExtension(globeLayerProperties) ' Set the base option for layer to be esriGlobeLayerBaseLayer and its base layer to be ElevationLayer Dim drapeLayerGlobeLayerProperties As ESRI.ArcGIS.GlobeCore.IGlobeLayerProperties=globeDisplayLayers.FindGlobeProperties(layer) Dim drapeLayerGlobeHeightProperties As ESRI.ArcGIS.GlobeCore.IGlobeHeightProperties=drapeLayerGlobeLayerProperties.HeightProperties drapeLayerGlobeHeightProperties.BaseLayer=elevationRasterLayer drapeLayerGlobeHeightProperties.BaseOption=ESRI.ArcGIS.GlobeCore.esriGlobeLayerBaseOption.esriGlobeLayerBaseLayer ' Apply the height properties of the layer drapeLayerGlobeHeightProperties.Apply(globeDisplay.Globe, layer) globeDisplay.RefreshViewers() End Sub