I've been trying to drape floating layers in a globe document onto a new elevation surface programmatically, but haven't had much luck. The big picture is as follows:
1) Assign globe document to my application's GlobeControl
2) Add an elevation layer to the globe
3) Loop through all floating layers, and re-drape on that elevation surface.
I found several ESRI developer articles on the various pieces, but haven't had success putting them together. Here's the code:
ADD ELEVATION LAYER TO GLOBE (works OK):
IGlobe theGlobe = axGlobeControl1.Globe;
IRasterLayer mergedElevLyr = new RasterLayerClass();
mergedElevLyr.CreateFromFilePath("C:\\temp\\Alpacas\\DTED\\MergedElev_111711.img");
mergedElevLyr.Visible = false;
theGlobe.AddLayerType((ILayer)mergedElevLyr, esriGlobeLayerType.esriGlobeLayerTypeElevation, false);
RE-DRAPE FLOATING LAYERS (doesn't seem to work):
IGlobeDisplay theGlobeDisp = theGlobe.GlobeDisplay;
IGlobeDisplayLayers theGlobeDispLyrs = (IGlobeDisplayLayers)theGlobeDisp;
IGlobeLayerProperties globeLayerPropertiesCls = new GlobeLayerPropertiesClass();
globeLayerPropertiesCls.Type = esriGlobeDataType.esriGlobeDataElevation;
ILayerExtensions layerExtension = (ILayerExtensions)mergedElevLyr;
layerExtension.AddExtension(globeLayerPropertiesCls);
IGlobeLayerProperties pGlobeLyrProps = null;
IGlobeHeightProperties pGlobeHtProps = null;
// Find and loop through floating layers (works OK)
IEnumLayer floatingLayers = theGlobe.get_GlobeLayers(null, false, false, true);
ILayer theFloatingLayer = floatingLayers.Next();
while (theFloatingLayer != null)
{
pGlobeLyrProps = theGlobeDispLyrs.FindGlobeProperties(theFloatingLayer);
pGlobeHtProps = pGlobeLyrProps.HeightProperties;
pGlobeHtProps.BaseLayer = mergedElevLyr;
pGlobeHtProps.BaseOption = esriGlobeLayerBaseOption.esriGlobeLayerBaseLayer;
pGlobeHtProps.Apply(theGlobe, theFloatingLayer);
theGlobe.GlobeDisplay.RefreshViewers();
theFloatingLayer = floatingLayers.Next();
pGlobeLyrProps = null;
pGlobeHtProps = null;
}
For the re-draping, I'm doing what I found in the following articles:
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000019z000000
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//004900000003000000
If I go into ArcGlobe, add the elevation layer, and then do the re-draping everything seems to be OK. However, when doing it in my application, I don't see any change in the view after the re-draping.
If anyone can offer any suggestions, I'd really appreciate it. Thanks!