本文整理汇总了C#中ILayer.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ILayer.GetType方法的具体用法?C# ILayer.GetType怎么用?C# ILayer.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILayer
的用法示例。
在下文中一共展示了ILayer.GetType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEthernetType
internal static EthernetType GetEthernetType(EthernetType ethernetType, ILayer nextLayer)
{
if (ethernetType != EthernetType.None)
return ethernetType;
if (nextLayer == null)
throw new ArgumentException("Can't determine ether type automatically from next layer because there is not next layer");
IEthernetNextLayer ethernetNextLayer = nextLayer as IEthernetNextLayer;
if (ethernetNextLayer == null)
throw new ArgumentException("Can't determine ether type automatically from next layer (" + nextLayer.GetType() + ")");
return ethernetNextLayer.PreviousLayerEtherType;
}
示例2: ToXml
public static XElement ToXml(ILayer layerBase)
{
var drawingLayer = layerBase as DrawingLayer;
if (drawingLayer != null) return DrawingXmlRepository.ToXml(drawingLayer);
var hexLayer = layerBase as HexLayer;
if (hexLayer != null) return HexXmlRepository.ToXml(hexLayer);
var colorLayer = layerBase as ColorLayer;
if (colorLayer != null) return ColorXmlRepository.ToXml(colorLayer);
var imageLayer = layerBase as ImageLayer;
if (imageLayer != null) return ImageXmlRepository.ToXml(imageLayer);
var spriteLayer = layerBase as SpriteLayer;
if (spriteLayer != null) return SpriteXmlRepository.ToXml(spriteLayer);
var tileLayer = layerBase as TileLayer;
if (tileLayer != null) return TileXmlRepository.ToXml(tileLayer);
throw new NotSupportedException(layerBase.GetType() + " is not supported");
}
示例3: GetWmsLayerNode
private static XmlNode GetWmsLayerNode(ILayer layer, XmlDocument doc)
{
XmlNode LayerNode = doc.CreateNode(XmlNodeType.Element, "Layer", wmsNamespaceURI);
LayerNode.AppendChild(CreateElement("Name", layer.Name, doc, false, wmsNamespaceURI));
LayerNode.AppendChild(CreateElement("Title", layer.Name, doc, false, wmsNamespaceURI));
//If this is a grouplayer, add childlayers recursively
if (layer.GetType() == typeof(SharpMap.Layers.GroupLayer))
foreach (SharpMap.Layers.Layer childlayer in ((SharpMap.Layers.GroupLayer)layer).Layers)
LayerNode.AppendChild(GetWmsLayerNode(childlayer, doc));
LayerNode.AppendChild(GenerateBoundingBoxElement(layer.Envelope, (int) layer.DataSource.CoordinateSystem.AuthorityCode, doc));
return LayerNode;
}
示例4: addLayer
private void addLayer(ILayer layer)
{
MainMapImage.Map.Layers.Add(layer);
LayersDataGridView.Rows.Insert(0, true, getLayerTypeIcon(layer.GetType()), layer.LayerName);
}
示例5: GetWmsLayerNode
private static XmlNode GetWmsLayerNode(ILayer layer, XmlDocument doc)
{
XmlNode LayerNode = doc.CreateNode(XmlNodeType.Element, "Layer", wmsNamespaceURI);
LayerNode.AppendChild(CreateElement("Name", layer.LayerName, doc, false, wmsNamespaceURI));
LayerNode.AppendChild(CreateElement("Title", layer.LayerName, doc, false, wmsNamespaceURI));
//if this is a vector layer with themes property set, add the Styles
if (layer.GetType() == typeof(VectorLayer))
if ((layer as VectorLayer).Themes != null)
foreach (KeyValuePair<string,SharpMap.Rendering.Thematics.ITheme> kvp in (layer as VectorLayer).Themes)
{
XmlNode styleNode = doc.CreateNode(XmlNodeType.Element, "Style", wmsNamespaceURI);
styleNode.AppendChild(CreateElement("Name", kvp.Key, doc, false, wmsNamespaceURI));
styleNode.AppendChild(CreateElement("Title", kvp.Key, doc, false, wmsNamespaceURI));
LayerNode.AppendChild(styleNode);
}
//If this is a grouplayer, add childlayers recursively
if (layer.GetType() == typeof (LayerGroup))
foreach (Layer childlayer in ((LayerGroup) layer).Layers)
LayerNode.AppendChild(GetWmsLayerNode(childlayer, doc));
LayerNode.Attributes.Append(CreateAttribute("queryable", GetQueriable(layer), doc));
LayerNode.AppendChild(GenerateBoundingBoxElement(layer.Envelope, layer.SRID, doc));
return LayerNode;
}
示例6: Write
/// <summary>
/// Writes the layer to the buffer.
/// </summary>
/// <param name="buffer">The buffer to write the layer to.</param>
/// <param name="offset">The offset in the buffer to start writing the layer at.</param>
/// <param name="payloadLength">The length of the layer's payload (the number of bytes after the layer in the packet).</param>
/// <param name="previousLayer">The layer that comes before this layer. null if this is the first layer.</param>
/// <param name="nextLayer">The layer that comes after this layer. null if this is the last layer.</param>
public override void Write(byte[] buffer, int offset, int payloadLength, ILayer previousLayer, ILayer nextLayer)
{
if (previousLayer == null)
throw new ArgumentNullException("previousLayer");
IArpPreviousLayer arpPreviousLayer = previousLayer as IArpPreviousLayer;
if (arpPreviousLayer == null)
throw new ArgumentException("The layer before the ARP layer must be an ARP previous layer and can't be " + previousLayer.GetType());
if (SenderHardwareAddress.Count != TargetHardwareAddress.Count)
{
throw new ArgumentException("Sender hardware address length is " + SenderHardwareAddress.Count + " bytes " +
"while target hardware address length is " + TargetHardwareAddress.Count + " bytes");
}
if (SenderProtocolAddress.Count != TargetProtocolAddress.Count)
{
throw new ArgumentException("Sender protocol address length is " + SenderProtocolAddress.Count + " bytes " +
"while target protocol address length is " + TargetProtocolAddress.Count + " bytes");
}
ArpDatagram.WriteHeader(buffer, offset,
arpPreviousLayer.PreviousLayerHardwareType, ProtocolType, Operation,
SenderHardwareAddress, SenderProtocolAddress, TargetHardwareAddress, TargetProtocolAddress);
}
示例7: GetWmsLayerNode
private static XmlNode GetWmsLayerNode(ILayer layer, XmlDocument doc)
{
XmlNode LayerNode = doc.CreateNode(XmlNodeType.Element, "Layer", wmsNamespaceURI);
LayerNode.AppendChild(CreateElement("Name", layer.LayerName, doc, false, wmsNamespaceURI));
LayerNode.AppendChild(CreateElement("Title", layer.LayerName, doc, false, wmsNamespaceURI));
//If this is a grouplayer, add childlayers recursively
if (layer.GetType() == typeof (LayerGroup))
{
foreach (ILayer childlayer in ((LayerGroup) layer))
LayerNode.AppendChild(GetWmsLayerNode(childlayer, doc));
}
LayerNode.AppendChild(GenerateBoundingBoxElement((IExtents2D) layer.Extents, layer.Srid, doc));
return LayerNode;
}
示例8: Create
/// <summary>
/// Method to create a legend item for a layer
/// </summary>
/// <param name="settings">The legend settings</param>
/// <param name="layer">The layer to create an item for</param>
/// <returns>A legend item</returns>
protected virtual ILegendItem Create(ILegendSettings settings, ILayer layer)
{
var factory = LookUpFactory(layer.GetType());
if (factory != null)
return factory.Create(settings, layer);
return new LegendItem
{
Label = layer.LayerName, LabelFont = LegendSettings.ItemFont, LabelBrush = LegendSettings.ForeColor,
Symbol = CreateGenericSymbol(layer),
Exclude = !layer.Enabled,
Indentation = LegendSettings.Indentation,
Padding = LegendSettings.Padding,
Expanded = true
};
}
示例9: Write
/// <summary>
/// Writes the layer to the buffer.
/// </summary>
/// <param name="buffer">The buffer to write the layer to.</param>
/// <param name="offset">The offset in the buffer to start writing the layer at.</param>
/// <param name="payloadLength">The length of the layer's payload (the number of bytes after the layer in the packet).</param>
/// <param name="previousLayer">The layer that comes before this layer. null if this is the first layer.</param>
/// <param name="nextLayer">The layer that comes after this layer. null if this is the last layer.</param>
public override void Write(byte[] buffer, int offset, int payloadLength, ILayer previousLayer, ILayer nextLayer)
{
IpV4Protocol protocol;
if (Protocol == null)
{
if (nextLayer == null)
throw new ArgumentException("Can't determine protocol automatically from next layer because there is no next layer");
IIpNextLayer ipNextLayer = nextLayer as IIpNextLayer;
if (ipNextLayer == null)
throw new ArgumentException("Can't determine protocol automatically from next layer (" + nextLayer.GetType() + ")");
protocol = ipNextLayer.PreviousLayerProtocol;
}
else
protocol = Protocol.Value;
IpV4Datagram.WriteHeader(buffer, offset,
TypeOfService, Identification, Fragmentation,
Ttl, protocol, HeaderChecksum,
Source, CurrentDestination,
Options, payloadLength);
}
示例10: GetWmsLayerNode
private static XmlNode GetWmsLayerNode(ILayer layer, XmlDocument doc)
{
XmlNode LayerNode = doc.CreateNode(XmlNodeType.Element, "Layer", wmsNamespaceURI);
LayerNode.AppendChild(CreateElement("Name", layer.LayerName, doc, false, wmsNamespaceURI));
LayerNode.AppendChild(CreateElement("Title", layer.LayerName, doc, false, wmsNamespaceURI));
//If this is a grouplayer, add childlayers recursively
if (layer.GetType() == typeof (LayerGroup))
foreach (Layer childlayer in ((LayerGroup) layer).Layers)
LayerNode.AppendChild(GetWmsLayerNode(childlayer, doc));
LayerNode.Attributes.Append(CreateAttribute("queryable", GetQueriable(layer), doc));
LayerNode.AppendChild(GenerateBoundingBoxElement(layer.Envelope, layer.SRID, doc));
return LayerNode;
}
示例11: GetWmsLayerNode
private static XmlNode GetWmsLayerNode(ILayer layer, XmlDocument doc)
{
XmlNode LayerNode = doc.CreateNode(XmlNodeType.Element, "Layer", wmsNamespaceURI);
LayerNode.AppendChild(CreateElement("Name", layer.Name, doc, false, wmsNamespaceURI));
LayerNode.AppendChild(CreateElement("Title", layer.Name, doc, false, wmsNamespaceURI));
//If this is a grouplayer, add childlayers recursively
if (layer.GetType() == typeof (LayerGroup))
foreach (Layer childlayer in ((LayerGroup) layer).Layers)
LayerNode.AppendChild(GetWmsLayerNode(childlayer, doc));
LayerNode.AppendChild(GenerateBoundingBoxElement(layer.Envelope, int.Parse(layer.CRS.Substring(ProjectionHelper.EpsgPrefix.Length)), doc));
return LayerNode;
}