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


C# Layer.GetType方法代码示例

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


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

示例1: switch

        /// <summary>
        /// Create a clone of a layer
        /// </summary>
        /// <param name="originalLayer">Layer to be cloned</param>
        /// <returns></returns>
        /*public Layer CloneLayer(Layer originalLayer)
        {
            switch (originalLayer.GetType().Name)
            {
                case "ArcGISTiledMapServiceLayer":
                    ArcGISTiledMapServiceLayer cloneLayer = new ArcGISTiledMapServiceLayer();
                    cloneLayer.Url = (originalLayer as ArcGISTiledMapServiceLayer).Url;
                    cloneLayer.ID = (originalLayer as ArcGISTiledMapServiceLayer).ID;
                    cloneLayer.Opacity = (originalLayer as ArcGISTiledMapServiceLayer).Opacity;
                    return cloneLayer;
                case "ArcGISDynamicMapServiceLayer":
                    ArcGISDynamicMapServiceLayer cloneLayer2 = new ArcGISDynamicMapServiceLayer();
                    cloneLayer2.Url = (originalLayer as ArcGISDynamicMapServiceLayer).Url;
                    cloneLayer2.ID = (originalLayer as ArcGISDynamicMapServiceLayer).ID;
                    cloneLayer2.Opacity = (originalLayer as ArcGISDynamicMapServiceLayer).Opacity;
                    return cloneLayer2;
                case "GraphicsLayer":
                    GraphicsLayer cloneLayer3 = new GraphicsLayer();
                    cloneLayer3.ID = (originalLayer as GraphicsLayer).ID;
                    cloneLayer3.Opacity = (originalLayer as GraphicsLayer).Opacity;
                    return cloneLayer3;
                default:
                    return null;

            }
        }*/
        public Layer CloneLayer(Layer originalLayer)
        {
            if (typeof(ClonableLayer).IsAssignableFrom(originalLayer.GetType()))
            {
                // If the layer implements its own clone function, use this.
                return ((ClonableLayer)originalLayer).CloneLayer();
            }
            else if (originalLayer is ArcGISTiledMapServiceLayer)
            {
                ArcGISTiledMapServiceLayer cloneLayer = new ArcGISTiledMapServiceLayer();
                cloneLayer.Url = (originalLayer as ArcGISTiledMapServiceLayer).Url;
                cloneLayer.ID = (originalLayer as ArcGISTiledMapServiceLayer).ID;
                cloneLayer.Opacity = (originalLayer as ArcGISTiledMapServiceLayer).Opacity;
                cloneLayer.Visible = originalLayer.Visible;
                return cloneLayer;
            }
            else if (originalLayer is ArcGISDynamicMapServiceLayer)
            {
                ArcGISDynamicMapServiceLayer cloneLayer = new ArcGISDynamicMapServiceLayer();
                cloneLayer.Url = (originalLayer as ArcGISDynamicMapServiceLayer).Url;
                cloneLayer.ID = (originalLayer as ArcGISDynamicMapServiceLayer).ID;
                cloneLayer.Opacity = (originalLayer as ArcGISDynamicMapServiceLayer).Opacity;
                cloneLayer.Visible = originalLayer.Visible;
                return cloneLayer;
            }
            else if (originalLayer is FeatureLayer)
            {
                FeatureLayer cloneLayer = new FeatureLayer();
                cloneLayer.Url = (originalLayer as FeatureLayer).Url;
                cloneLayer.ID = (originalLayer as FeatureLayer).ID;
                cloneLayer.Opacity = (originalLayer as FeatureLayer).Opacity;
                cloneLayer.Visible = originalLayer.Visible;
                return cloneLayer;
            }
            else if (originalLayer is GraphicsLayer)
            {
                GraphicsLayer cloneLayer = new GraphicsLayer();
                cloneLayer.ID = (originalLayer as GraphicsLayer).ID;
                cloneLayer.Opacity = (originalLayer as GraphicsLayer).Opacity;
                cloneLayer.Visible = originalLayer.Visible;
                DeepCopyGraphics((originalLayer as GraphicsLayer), cloneLayer);
                return cloneLayer;
            }
            else
                return null;
        }
开发者ID:ase-lab,项目名称:eGrid,代码行数:77,代码来源:MapLayersManager.cs

示例2: DesignAttribution

 public DesignAttribution(Layer layer)
 {
     Copyright = layer == null
                     ? string.Format(Properties.Resources.Attribution_Copyright, "Design")
                     : string.Format(Properties.Resources.Attribution_Copyright, layer.ID ?? layer.GetType().Name);
 }
开发者ID:Esri,项目名称:arcgis-toolkit-sl-wpf,代码行数:6,代码来源:Attribution.cs

示例3: CopyLayer

		private static Layer CopyLayer( Layer seed){
			try {
                Layer copy = null;
                if (seed is PythonLayer)
                {
                    copy = new PythonLayer(((PythonLayer)seed).Host, ((PythonLayer)seed).Code, seed.Name);
                }else
				     copy = (Layer)Activator.CreateInstance (seed.GetType());
				return copy;

			} catch (Exception e){
				Console.Error.WriteLine (e.StackTrace);
			}

			return null;
		}
开发者ID:nunb,项目名称:interpretation,代码行数:16,代码来源:ChainLoader.cs


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