本文整理汇总了C#中TagsCollectionBase.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# TagsCollectionBase.ContainsKey方法的具体用法?C# TagsCollectionBase.ContainsKey怎么用?C# TagsCollectionBase.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagsCollectionBase
的用法示例。
在下文中一共展示了TagsCollectionBase.ContainsKey方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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(TagsCollectionBase 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: IsRoutable
/// <summary>
/// Returns true if the edge with the given tags is routable.
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
public bool IsRoutable(TagsCollectionBase tags)
{
if (tags != null && tags.Count > 0)
{
return tags.ContainsKey("highway");
}
return false;
}
示例3: GetName
/// <summary>
/// Returns the name of a given way.
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
public string GetName(TagsCollectionBase tags)
{
var name = string.Empty;
if (tags.ContainsKey("name"))
{
name = tags["name"];
}
return name;
}
示例4: 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(TagsCollectionBase tags, string highwayType)
{
if (tags.ContainsKey("motor_vehicle"))
{
if (tags["motor_vehicle"] == "no")
{
return false;
}
}
return AccessibleTags.ContainsKey(highwayType);
}
示例5: 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;
}
示例6: 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;
}