当前位置: 首页>>代码示例>>C#>>正文


C# IScene.get_Layers方法代码示例

本文整理汇总了C#中IScene.get_Layers方法的典型用法代码示例。如果您正苦于以下问题:C# IScene.get_Layers方法的具体用法?C# IScene.get_Layers怎么用?C# IScene.get_Layers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IScene的用法示例。


在下文中一共展示了IScene.get_Layers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnClick

		/// <summary>
		/// Occurs when this command is clicked
		/// </summary>
		public override void OnClick()
		{
			//test whether connected to the service
      if (!m_bConnected) //in case not connected.
			{
        IGlobe globe = m_globeHookHelper.Globe;
        m_scene = globe as IScene;

				//create the instance of the layer
        if (null == m_weatherLayer)
				{				
					m_weatherLayer = new RSSWeatherLayer3DClass();
				}

        //test whether the layer has been added to the globe (allow for only one instance of the layer)
				bool bLayerHasBeenAdded = false;
				IEnumLayer layers = m_scene.get_Layers(null, false);
				layers.Reset();
				ILayer layer = layers.Next();
				while(layer != null)
				{
					if(layer is RSSWeatherLayer3DClass)
					{
						bLayerHasBeenAdded = true;
						break;
					}
					layer = layers.Next();
				}

				//in case that the layer hasn't been added
        if(!bLayerHasBeenAdded)
				{
					layer = (ILayer)m_weatherLayer;
					layer.Name = "RSS Weather Layer";
					try
					{
            //add the layer to the globe
						globe.AddLayerType(layer, esriGlobeLayerType.esriGlobeLayerTypeDraped, false);
					}
					catch(Exception ex)
					{
						System.Diagnostics.Trace.WriteLine("Failed" + ex.Message);
					}
				}

				//connect to the RSS weather service
				m_weatherLayer.Connect();
			}
			else
			{
				//disconnect from the service
				m_weatherLayer.Disconnect();
				
				//delete the layer from the globe
				m_scene.DeleteLayer(m_weatherLayer);

				//dispose the layer
				m_weatherLayer.Dispose();
				m_weatherLayer = null;
			}

      //set the connectionflag
			m_bConnected = !m_bConnected;
    }
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:67,代码来源:AddWeatherLayerCmd.cs


注:本文中的IScene.get_Layers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。