private void Hieght(ILayer pLayer) { ChangeProp(pLayer); IFeatureLayer pFL = (IFeatureLayer)pLayer; pFL.Cached = true; IGlobeDisplayLayers globeDisplayLayers = (IGlobeDisplayLayers)m_Globe.GlobeDisplay; IGlobeLayerProperties drapeLayerGlobeLayerProperties = globeDisplayLayers.FindGlobeProperties(pLayer); IGlobeHeightProperties drapeLayerGlobeHeightProperties = drapeLayerGlobeLayerProperties.HeightProperties; // drapeLayerGlobeHeightProperties.BaseLayer = elevationRasterLayer; // drapeLayerGlobeHeightProperties.BaseOption = esriGlobeLayerBaseOption.esriGlobeLayerBaseLayer; drapeLayerGlobeHeightProperties.ElevationExpressionString = "[Elevation] * 1000"; // drapeLayerGlobeHeightProperties.HasElevationValues = true; //drapeLayerGlobeHeightProperties.ElevationExpression.Expression = "Elevation * 1000"; globeDisplayLayers.ApplyHeightProperties(pLayer); drapeLayerGlobeHeightProperties.Apply(m_Globe, pLayer); // m_globe.GlobeDisplay.RefreshViewers(); // IViewers3D v3d = (IViewers3D)m_globe.GlobeDisplay; // v3d.RefreshViewers(); globeDisplayLayers.RefreshLayer(pLayer); IActiveView pacv = (IActiveView)m_Globe; pacv.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFL, null); }
private void ChangeHeightProperties() { try { ILayer pLayer = ((IBasicMap)m_Globe).get_Layer(1); IFeatureLayer pFL = pLayer as IFeatureLayer; pFL.Cached = true; IGlobeDisplayLayers globeDisplayLayers = (IGlobeDisplayLayers)m_Globe.GlobeDisplay; IGlobeLayerProperties drapeLayerGlobeLayerProperties = globeDisplayLayers.FindGlobeProperties(pLayer); IGlobeHeightProperties drapeLayerGlobeHeightProperties = drapeLayerGlobeLayerProperties.HeightProperties; // drapeLayerGlobeHeightProperties.BaseLayer = elevationRasterLayer; // drapeLayerGlobeHeightProperties.BaseOption = esriGlobeLayerBaseOption.esriGlobeLayerBaseLayer; drapeLayerGlobeHeightProperties.ElevationExpressionString = "[Elevation] * 10"; // drapeLayerGlobeHeightProperties.HasElevationValues = true; //drapeLayerGlobeHeightProperties.ElevationExpression.Expression = "Elevation * 1000"; globeDisplayLayers.ApplyHeightProperties(pLayer); drapeLayerGlobeHeightProperties.Apply(m_Globe, pLayer); // m_globe.GlobeDisplay.RefreshViewers(); // IViewers3D v3d = (IViewers3D)m_globe.GlobeDisplay; // v3d.RefreshViewers(); globeDisplayLayers.RefreshLayer(pLayer); IActiveView pacv = (IActiveView)m_Globe; pacv.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFL, null); } catch (Exception ex) { // MessageBox.Show(ex.Message); } }
/// <summary> /// 加载.lyr文件 /// </summary> /// <param name="fileName"></param> private void OpenLyrFile(string fileName) { try { LayerFile playerFile = new LayerFile(); playerFile.New(fileName); ILayer pLayer = playerFile.Layer; axGlobeControl.Globe.AddLayerType(pLayer, esriGlobeLayerType.esriGlobeLayerTypeDraped, false); IGlobeDisplayLayers globeDisplayLayers = axGlobeControl.Globe.GlobeDisplay as IGlobeDisplayLayers; globeDisplayLayers.RefreshLayer(pLayer); } catch (Exception) { } }
public void AddDrapeLayerToGlobeElevationSurface(IGlobeDisplay globeDisplay, ILayer layer, System.String elevationRasterFilePath) { ChangeProp(layer); IGlobeDisplayLayers globeDisplayLayers = (IGlobeDisplayLayers)globeDisplay; // Explicit cast IFeatureLayer pFeatureLayer = (IFeatureLayer)layer; pFeatureLayer.Cached = true; // Create elevation raster layer IRasterLayer elevationRasterLayer = new RasterLayer(); elevationRasterLayer.CreateFromFilePath(elevationRasterFilePath); // Create and add the GlobeLayerProperties extension with the Type set to ElevationData IGlobeLayerProperties globeLayerProperties = new GlobeLayerProperties(); globeLayerProperties.Type = esriGlobeDataType.esriGlobeDataElevation; ILayerExtensions layerExtension = (ILayerExtensions)elevationRasterLayer; // Explicit cast layerExtension.AddExtension(globeLayerProperties); // Set the base option for layer to be esriGlobeLayerBaseLayer and its base layer to be ElevationLayer IGlobeLayerProperties drapeLayerGlobeLayerProperties = globeDisplayLayers.FindGlobeProperties(layer); IGlobeHeightProperties drapeLayerGlobeHeightProperties = drapeLayerGlobeLayerProperties.HeightProperties; // drapeLayerGlobeHeightProperties.BaseLayer = elevationRasterLayer; drapeLayerGlobeHeightProperties.BaseOption = esriGlobeLayerBaseOption.esriGlobeLayerBaseLayer; drapeLayerGlobeHeightProperties.ElevationExpressionString = "[Elevation] * 1000"; // drapeLayerGlobeHeightProperties.ExtrusionType = ESRI.ArcGIS.Analyst3D.esriExtrusionType.esriExtrusionBase; //drapeLayerGlobeHeightProperties.ExtrusionExpressionString = "Elevation * 1000"; // Apply the height properties of the layer globeDisplayLayers.ApplyHeightProperties(layer); drapeLayerGlobeHeightProperties.Apply(m_Globe, layer); // globeDisplay.RefreshViewers(); globeDisplayLayers.RefreshLayer(layer); IActiveView pacv = (IActiveView)m_Globe; pacv.PartialRefresh(esriViewDrawPhase.esriViewGeography, pFeatureLayer, null); }