本文整理汇总了C#中TagsCollectionBase.ContainsKeyValue方法的典型用法代码示例。如果您正苦于以下问题:C# TagsCollectionBase.ContainsKeyValue方法的具体用法?C# TagsCollectionBase.ContainsKeyValue怎么用?C# TagsCollectionBase.ContainsKeyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagsCollectionBase
的用法示例。
在下文中一共展示了TagsCollectionBase.ContainsKeyValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompareTags
/// <summary>
/// Compares two tags collections.
/// </summary>
public static void CompareTags(TagsCollectionBase expected, TagsCollectionBase actual)
{
if (expected == null)
{
Assert.IsNull(actual);
}
else
{
if (expected.Count == 0)
{
Assert.IsTrue(actual == null || actual.Count == 0);
}
else
{
Assert.IsNotNull(actual);
Assert.AreEqual(expected.Count, actual.Count);
foreach (Tag tag in expected)
{
Assert.IsTrue(actual.ContainsKeyValue(tag.Key, tag.Value));
}
foreach (Tag tag in actual)
{
Assert.IsTrue(expected.ContainsKeyValue(tag.Key, tag.Value));
}
}
}
}
示例2: IsRestriction
/// <summary>
/// Returns true if the given object can be a routing restriction.
/// </summary>
/// <param name="type"></param>
/// <param name="tags"></param>
/// <returns></returns>
public bool IsRestriction(OsmGeoType type, TagsCollectionBase tags)
{ // at least there need to be some tags.
if (type == OsmGeoType.Relation)
{ // filter out relation-based turn-restrictions.
if (tags != null &&
tags.ContainsKeyValue("type", "restriction"))
{ // yep, there's a restriction here!
return true;
}
}
else if(type == OsmGeoType.Node)
{ // a node is possibly a restriction too.
if(tags != null)
{
return tags.ContainsKey("barrier");
}
}
return false;
}