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


C# TagsCollection.ContainsKey方法代码示例

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


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

示例1: IsVehicleAllowed

 /// <summary>
 /// Returns true if the vehicle is allowed on the way represented by these tags
 /// </summary>
 /// <param name="tags"></param>
 /// <param name="highwayType"></param>
 /// <returns></returns>
 protected override bool IsVehicleAllowed(TagsCollection tags, string highwayType)
 {
     // do the designated tags.
     if (tags.ContainsKey("bicycle"))
     {
         if (tags["bicycle"] == "designated")
         {
             return true; // designated bicycle
         }
         if (tags["bicycle"] == "yes")
         {
             return true; // yes for bicycle
         }
         if (tags["bicycle"] == "no")
         {
             return false; //  no for bicycle
         }
     }
     if (tags.ContainsKey("foot"))
     {
         if (tags["foot"] == "designated")
         {
             return false; // designated foot
         }
     }
     return AccessibleTags.ContainsKey(highwayType);
 }
开发者ID:jboneng,项目名称:OsmSharp,代码行数:33,代码来源:Vehicle.cs

示例2: GetName

 /// <summary>
 ///     Returns the name of a given way.
 /// </summary>
 /// <param name="tags"></param>
 /// <returns></returns>
 public string GetName(TagsCollection tags)
 {
     var name = string.Empty;
     if (tags.ContainsKey("name"))
     {
         name = tags["name"];
     }
     return name;
 }
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:14,代码来源:EdgeInterpreter.cs

示例3: TestSimpleTagsCollectionSimple

        public void TestSimpleTagsCollectionSimple()
        {
            var collection = new TagsCollection();

            collection["simple"] = "yes";

            Assert.IsTrue(collection.ContainsKey("simple"));
            Assert.IsTrue(collection.ContainsKeyValue("simple", "yes"));
            Assert.AreEqual("yes", collection["simple"]);
            Assert.AreEqual(1, collection.Count);
        }
开发者ID:nagyistoce,项目名称:OsmSharp-core,代码行数:11,代码来源:TagsCollectionTests.cs

示例4: TestTagsCollectionSimple

        /// <summary>
        /// Tests an empty tags collection.
        /// </summary>
        protected void TestTagsCollectionSimple()
        {
            TagsCollectionBase collection = new TagsCollection();

            collection["simple"] = "yes";

            Assert.IsTrue(collection.ContainsKey("simple"));
            Assert.IsTrue(collection.ContainsKeyValue("simple","yes"));
            Assert.AreEqual("yes", collection["simple"]);
            Assert.AreEqual(1, collection.Count);
        }
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:14,代码来源:TagsCollectionBaseTests.cs

示例5: IsRoutable

 /// <summary>
 ///     Returns true if the edge with the given tags is routable.
 /// </summary>
 /// <param name="tags"></param>
 /// <returns></returns>
 public bool IsRoutable(TagsCollection tags)
 {
     if (tags != null && tags.Count > 0)
     {
         return tags.ContainsKey("highway");
     }
     return false;
 }
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:13,代码来源:EdgeInterpreter.cs

示例6: GetName

 /// <summary>
 ///     Returns the name of a given way.
 /// </summary>
 /// <param name="tags"></param>
 /// <returns></returns>
 private string GetName(TagsCollection tags)
 {
     //TODO: Maybe passing tags around isn't the right way to do this
     var name = string.Empty;
     if (tags.ContainsKey("name"))
     {
         name = tags["name"];
     }
     return name;
 }
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:15,代码来源:Vehicle.cs

示例7: IsVehicleAllowed

 /// <summary>
 /// Returns true if the vehicle is allowed on the way represented by these tags
 /// </summary>
 /// <param name="tags"></param>
 /// <param name="highwayType"></param>
 /// <returns></returns>
 protected override bool IsVehicleAllowed(TagsCollection tags, string highwayType)
 {
     if (tags.ContainsKey("motor_vehicle"))
     {
         if (tags["motor_vehicle"] == "no")
         {
             return false;
         }
     }
     return AccessibleTags.ContainsKey(highwayType);
 }
开发者ID:robert-hickey,项目名称:OsmSharp,代码行数:17,代码来源:Vehicle.cs


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