當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。