当前位置: 首页>>代码示例>>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;未经允许,请勿转载。