本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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");
}
示例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;
}