Пример #1
0
 /// <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;
 }
Пример #2
0
        /// <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;
        }
Пример #3
0
 /// <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);
 }
Пример #4
0
 /// <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;
 }
Пример #5
0
 /// <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");
 }
Пример #6
0
 /// <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;
 }