當前位置: 首頁>>代碼示例>>C#>>正文


C# TagsCollection.TryGetValue方法代碼示例

本文整理匯總了C#中OsmSharp.Collections.Tags.TagsCollection.TryGetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# TagsCollection.TryGetValue方法的具體用法?C# TagsCollection.TryGetValue怎麽用?C# TagsCollection.TryGetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OsmSharp.Collections.Tags.TagsCollection的用法示例。


在下文中一共展示了TagsCollection.TryGetValue方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: IsOnlyLocalAccessible

 /// <summary>
 ///     Returns true if the edge with the given tags is only accessible locally.
 /// </summary>
 /// <param name="tags"></param>
 /// <returns></returns>
 public bool IsOnlyLocalAccessible(TagsCollection tags)
 {
     string tag;
     if (tags.TryGetValue("highway", out tag))
     {
         if (tag == "service")
         {
             return true;
         }
     }
     if (tags.TryGetValue("access", out tag))
     {
         if (tag == "private" || tag == "official")
         {
             return true;
         }
     }
     return false;
 }
開發者ID:robert-hickey,項目名稱:OsmSharp,代碼行數:24,代碼來源:EdgeInterpreter.cs

示例2: MatchWithEdge

        /// <summary>
        /// Returns true if the edge is a suitable candidate as a target for a point to be resolved on.
        /// </summary>
        /// <param name="vehicle"></param>
        /// <param name="pointTags"></param>
        /// <param name="edgeTags"></param>
        /// <returns></returns>
        public bool MatchWithEdge(Vehicle vehicle,
            TagsCollection pointTags, TagsCollection edgeTags)
        {
            if (pointTags == null || pointTags.Count == 0)
            { // when the point has no tags it has no requirements.
                return true;
            }

            if (edgeTags == null || edgeTags.Count == 0)
            { // when the edge has no tags, no way to verify.
                return false;
            }

            string pointName, edgeName;
            if (pointTags.TryGetValue("name", out pointName) &&
                edgeTags.TryGetValue("name", out edgeName))
            { // both have names.
                return (pointName == edgeName);
            }
            return false;
        }
開發者ID:robert-hickey,項目名稱:OsmSharp,代碼行數:28,代碼來源:IEdgeMatcher.cs

示例3: TryGetHighwayType

 /// <summary>
 /// Trys to return the highwaytype from the tags
 /// </summary>
 /// <param name="tags"></param>
 /// <param name="highwayType"></param>
 /// <returns></returns>
 protected bool TryGetHighwayType(TagsCollection tags, out string highwayType)
 {
     return tags.TryGetValue("highway", out highwayType);
 }
開發者ID:jboneng,項目名稱:OsmSharp,代碼行數:10,代碼來源:Vehicle.cs

示例4: IsOneWay

 /// <summary>
 ///     Returns true if the edge is one way forward, false if backward, null if bidirectional.
 /// </summary>
 /// <param name="tags"></param>
 /// <returns></returns>
 public virtual bool? IsOneWay(TagsCollection tags)
 {
     string oneway;
     if (tags.TryGetValue("oneway", out oneway))
     {
         if (oneway == "yes")
         {
             return true;
         }
         return false;
     }
     string junction;
     if (tags.TryGetValue("junction", out junction))
     {
         if (junction == "roundabout")
         {
             return true;
         }
     }
     return null;
 }
開發者ID:jboneng,項目名稱:OsmSharp,代碼行數:26,代碼來源:Vehicle.cs

示例5: IsRoundabout

 /// <summary>
 ///     Returns true if the edge with the given properties represents a roundabout.
 /// </summary>
 /// <param name="tags"></param>
 /// <returns></returns>
 public bool IsRoundabout(TagsCollection tags)
 {
     string junction;
     return (tags != null && tags.TryGetValue("junction", out junction) && junction == "roundabout");
 }
開發者ID:robert-hickey,項目名稱:OsmSharp,代碼行數:10,代碼來源:EdgeInterpreter.cs

示例6: IsOneWay

 /// <summary>
 ///     Returns true if the edge is one way forward, false if backward, null if bidirectional.
 /// </summary>
 /// <param name="tags"></param>
 /// <returns></returns>
 public virtual bool? IsOneWay(TagsCollection tags)
 {
     string oneway;
     if (tags.TryGetValue("oneway", out oneway))
     {
         if (oneway == "yes")
         {
             return true;
         }
         return false;
     }
     return null;
 }
開發者ID:robert-hickey,項目名稱:OsmSharp,代碼行數:18,代碼來源:Vehicle.cs


注:本文中的OsmSharp.Collections.Tags.TagsCollection.TryGetValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。