本文整理汇总了C#中TagsCollectionBase.TryGetValue方法的典型用法代码示例。如果您正苦于以下问题:C# TagsCollectionBase.TryGetValue方法的具体用法?C# TagsCollectionBase.TryGetValue怎么用?C# TagsCollectionBase.TryGetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagsCollectionBase
的用法示例。
在下文中一共展示了TagsCollectionBase.TryGetValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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(TagsCollectionBase 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,
TagsCollectionBase pointTags, TagsCollectionBase 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: IsRoundabout
/// <summary>
/// Returns true if the edge with the given properties represents a roundabout.
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
public bool IsRoundabout(TagsCollectionBase tags)
{
string junction;
return (tags != null && tags.TryGetValue("junction", out junction) && junction == "roundabout");
}
示例4: TryGetHighwayType
/// <summary>
/// Trys to return the highwaytype from the tags
/// </summary>
/// <param name="tags"></param>
/// <param name="highwayType"></param>
/// <returns></returns>
protected bool TryGetHighwayType(TagsCollectionBase tags, out string highwayType)
{
highwayType = string.Empty;
return tags != null && tags.TryGetValue("highway", out highwayType);
}
示例5: 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(TagsCollectionBase 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;
}
示例6: IsPotentiallyArea
/// <summary>
/// Returns true if the given tags collection contains tags that could represents an area.
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
public override bool IsPotentiallyArea(TagsCollectionBase tags)
{
if (tags == null || tags.Count == 0) { return false; } // no tags, assume no area.
bool isArea = false;
if ((tags.ContainsKey("building") && !tags.IsFalse("building")) ||
(tags.ContainsKey("landuse") && !tags.IsFalse("landuse")) ||
(tags.ContainsKey("amenity") && !tags.IsFalse("amenity")) ||
(tags.ContainsKey("harbour") && !tags.IsFalse("harbour")) ||
(tags.ContainsKey("historic") && !tags.IsFalse("historic")) ||
(tags.ContainsKey("leisure") && !tags.IsFalse("leisure")) ||
(tags.ContainsKey("man_made") && !tags.IsFalse("man_made")) ||
(tags.ContainsKey("military") && !tags.IsFalse("military")) ||
(tags.ContainsKey("natural") && !tags.IsFalse("natural")) ||
(tags.ContainsKey("office") && !tags.IsFalse("office")) ||
(tags.ContainsKey("place") && !tags.IsFalse("place")) ||
(tags.ContainsKey("power") && !tags.IsFalse("power")) ||
(tags.ContainsKey("public_transport") && !tags.IsFalse("public_transport")) ||
(tags.ContainsKey("shop") && !tags.IsFalse("shop")) ||
(tags.ContainsKey("sport") && !tags.IsFalse("sport")) ||
(tags.ContainsKey("tourism") && !tags.IsFalse("tourism")) ||
(tags.ContainsKey("waterway") && !tags.IsFalse("waterway")) ||
(tags.ContainsKey("wetland") && !tags.IsFalse("wetland")) ||
(tags.ContainsKey("water") && !tags.IsFalse("water")) ||
(tags.ContainsKey("aeroway") && !tags.IsFalse("aeroway")))
{ // these tags usually indicate an area.
isArea = true;
}
string typeValue;
if (tags.TryGetValue("type", out typeValue))
{ // there is a type in this relation.
if (typeValue == "multipolygon")
{ // this relation is a multipolygon.
isArea = true;
}
else if (typeValue == "boundary")
{ // this relation is a boundary.
isArea = true;
}
}
if (tags.IsTrue("area"))
{ // explicitly indicated that this is an area.
isArea = true;
}
else if (tags.IsFalse("area"))
{ // explicitly indicated that this is not an area.
isArea = false;
}
return isArea;
}
示例7: TryGetHighwayType
/// <summary>
/// Trys to return the highwaytype from the tags
/// </summary>
/// <param name="tags"></param>
/// <param name="highwayType"></param>
/// <returns></returns>
protected bool TryGetHighwayType(TagsCollectionBase tags, out string highwayType)
{
return tags.TryGetValue("highway", out highwayType);
}