当前位置: 首页>>代码示例>>C#>>正文


C# TagsCollectionBase.ContainsKey方法代码示例

本文整理汇总了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);
 }
开发者ID:vcotlearov,项目名称:OsmSharp,代码行数:33,代码来源:Vehicle.cs

示例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;
 }
开发者ID:cmberryau,项目名称:routing,代码行数:13,代码来源:EdgeInterpreter.cs

示例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;
 }
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:14,代码来源:EdgeInterpreter.cs

示例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);
 }
开发者ID:cmberryau,项目名称:routing,代码行数:17,代码来源:MotorVehicle.cs

示例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;
        }
开发者ID:nubix-biz,项目名称:OsmSharp,代码行数:58,代码来源:SimpleGeometryInterpreter.cs

示例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;
 }
开发者ID:cmberryau,项目名称:routing,代码行数:25,代码来源:OsmRoutingInterpreter.cs


注:本文中的TagsCollectionBase.ContainsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。