本文整理汇总了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;
}
示例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);
}
示例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;
}