예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        /// <summary>
        /// 设置图层栅格化
        /// </summary>
        /// <param name="layerName">图层名称</param>
        /// <param name="bRasterize">是否栅格化</param>
        public void SetRasterize(string layerName, bool bRasterize)
        {
            if (!layerDic.ContainsKey(layerName))
            {
                return;
            }

            ILayer pLayer = layerDic[layerName];

            Dosomething((Action) delegate()
            {
                IScene m_scene = globeControl.Globe as IScene;                                      // 提供数据给成员控制场景
                m_scene.ActiveGraphicsLayer = pLayer;                                               // 活动的图层,如果没有则创建一个
                IGlobeGraphicsLayer pGL     = pLayer as IGlobeGraphicsLayer;                        //提供数据给地图图形图层

                IGlobeDisplay m_globeDisplay           = globeControl.Globe.GlobeDisplay;           // 提供数据给成员操作地图显示
                IGlobeDisplayLayers pGlobeLayer        = m_globeDisplay as IGlobeDisplayLayers;     // 提供数据给成员操作地图显示图层
                IGlobeLayerProperties pGlobeLayerProps = pGlobeLayer.FindGlobeProperties(pLayer);   // 提供数据给成员操纵图层属性,返回图层的属性
                IGlobeGraphicsElementProperties pGEP   = new GlobeGraphicsElementPropertiesClass(); // 图层的其他属性
                pGEP.DrapeElement = true;
                pGEP.DrapeZOffset = 10;
                pGEP.Rasterize    = bRasterize;                  //是否栅格化
                pGlobeLayerProps.ApplyDisplayProperties(pLayer); //应用属性到此图层
            }, true);
        }
예제 #4
0
        private void ChangeProp(ILayer pLayer)
        {
            IGlobeDisplayLayers   globeDisplayLayers             = (IGlobeDisplayLayers)m_Globe.GlobeDisplay;
            IGlobeLayerProperties drapeLayerGlobeLayerProperties = globeDisplayLayers.FindGlobeProperties(pLayer);

            // IGlobeLayerProperties drapeLayerGlobeLayerProperties = globeDisplayLayers.FindGlobeProperties(pLayer );
            //  IGlobeLayerProperties drapeLayerGlobeLayerProperties = GetGlobeLayerProperties((ILayer)featureLayer);
            ESRI.ArcGIS.GlobeCore.IGlobeDisplay2 globeDisplay2 = globeDisplayLayers as ESRI.ArcGIS.GlobeCore.IGlobeDisplay2;
            globeDisplay2.PauseCaching = true;
            drapeLayerGlobeLayerProperties.Scale3DSymbols          = true;
            drapeLayerGlobeLayerProperties.IsDynamicallyRasterized = false;
            drapeLayerGlobeLayerProperties.Type = esriGlobeDataType.esriGlobeDataVector;
            globeDisplay2.PauseCaching          = false;
        }
예제 #5
0
        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);
        }