Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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:

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!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.