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


C# ILayer.GetType方法代码示例

本文整理汇总了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;
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:13,代码来源:EthernetBaseLayer.cs

示例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");
        }
开发者ID:plaurin,项目名称:MonoGameEngine2D,代码行数:22,代码来源:XmlRepository.cs

示例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;
		}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:14,代码来源:Capabilities.cs

示例4: addLayer

        private void addLayer(ILayer layer)
        {
            MainMapImage.Map.Layers.Add(layer);

            LayersDataGridView.Rows.Insert(0, true, getLayerTypeIcon(layer.GetType()), layer.LayerName);
        }
开发者ID:junglewithyou,项目名称:SharpMap,代码行数:6,代码来源:MainForm.cs

示例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;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:25,代码来源:ServerCapabilities.cs

示例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);
        }
开发者ID:JackWangCUMT,项目名称:WiFiSpy,代码行数:32,代码来源:ArpLayer.cs

示例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;
        }
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:16,代码来源:Capabilities.cs

示例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
            };
        }
开发者ID:jrmsjorgesilva,项目名称:SharpMap.Rendering.Decorations.Legend,代码行数:22,代码来源:LegendFactory.cs

示例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);
        }
开发者ID:amitla,项目名称:Pcap.Net,代码行数:29,代码来源:IpV4Layer.cs

示例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;
        }
开发者ID:goranpavlovic,项目名称:Gis,代码行数:15,代码来源:Capabilities.cs

示例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;
        }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:14,代码来源:Capabilities.cs


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