本文整理汇总了C#中OsmSharp.Collections.Tags.TagsCollection.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# TagsCollection.ContainsKey方法的具体用法?C# TagsCollection.ContainsKey怎么用?C# TagsCollection.ContainsKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsmSharp.Collections.Tags.TagsCollection
的用法示例。
在下文中一共展示了TagsCollection.ContainsKey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsVehicleAllowed
/// <summary>
/// Returns true if the vehicle is allowed on the way represented by these tags
/// </summary>
/// <param name="tags"></param>
/// <param name="highwayType"></param>
/// <returns></returns>
protected override bool IsVehicleAllowed(TagsCollection tags, string highwayType)
{
// do the designated tags.
if (tags.ContainsKey("bicycle"))
{
if (tags["bicycle"] == "designated")
{
return true; // designated bicycle
}
if (tags["bicycle"] == "yes")
{
return true; // yes for bicycle
}
if (tags["bicycle"] == "no")
{
return false; // no for bicycle
}
}
if (tags.ContainsKey("foot"))
{
if (tags["foot"] == "designated")
{
return false; // designated foot
}
}
return AccessibleTags.ContainsKey(highwayType);
}
示例2: GetName
/// <summary>
/// Returns the name of a given way.
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
public string GetName(TagsCollection tags)
{
var name = string.Empty;
if (tags.ContainsKey("name"))
{
name = tags["name"];
}
return name;
}
示例3: TestSimpleTagsCollectionSimple
public void TestSimpleTagsCollectionSimple()
{
var collection = new TagsCollection();
collection["simple"] = "yes";
Assert.IsTrue(collection.ContainsKey("simple"));
Assert.IsTrue(collection.ContainsKeyValue("simple", "yes"));
Assert.AreEqual("yes", collection["simple"]);
Assert.AreEqual(1, collection.Count);
}
示例4: TestTagsCollectionSimple
/// <summary>
/// Tests an empty tags collection.
/// </summary>
protected void TestTagsCollectionSimple()
{
TagsCollectionBase collection = new TagsCollection();
collection["simple"] = "yes";
Assert.IsTrue(collection.ContainsKey("simple"));
Assert.IsTrue(collection.ContainsKeyValue("simple","yes"));
Assert.AreEqual("yes", collection["simple"]);
Assert.AreEqual(1, collection.Count);
}
示例5: IsRoutable
/// <summary>
/// Returns true if the edge with the given tags is routable.
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
public bool IsRoutable(TagsCollection tags)
{
if (tags != null && tags.Count > 0)
{
return tags.ContainsKey("highway");
}
return false;
}
示例6: GetName
/// <summary>
/// Returns the name of a given way.
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
private string GetName(TagsCollection tags)
{
//TODO: Maybe passing tags around isn't the right way to do this
var name = string.Empty;
if (tags.ContainsKey("name"))
{
name = tags["name"];
}
return name;
}
示例7: IsVehicleAllowed
/// <summary>
/// Returns true if the vehicle is allowed on the way represented by these tags
/// </summary>
/// <param name="tags"></param>
/// <param name="highwayType"></param>
/// <returns></returns>
protected override bool IsVehicleAllowed(TagsCollection tags, string highwayType)
{
if (tags.ContainsKey("motor_vehicle"))
{
if (tags["motor_vehicle"] == "no")
{
return false;
}
}
return AccessibleTags.ContainsKey(highwayType);
}