本文整理汇总了C#中TagsCollectionBase类的典型用法代码示例。如果您正苦于以下问题:C# TagsCollectionBase类的具体用法?C# TagsCollectionBase怎么用?C# TagsCollectionBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TagsCollectionBase类属于命名空间,在下文中一共展示了TagsCollectionBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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));
}
}
}
}
示例3: Evaluate
public override TagsCollectionBase Evaluate(TagsCollectionBase tags, OsmGeoType type)
{
var a_result = _a.Evaluate(tags, type);
var b_result = _b.Evaluate(tags, type);
return a_result.Union(b_result);
}
示例4: Create
/// <summary>
/// Creates a new way.
/// </summary>
/// <param name="id"></param>
/// <param name="nodes"></param>
/// <param name="tags"></param>
/// <returns></returns>
public static Way Create(long id, TagsCollectionBase tags, params long[] nodes)
{
Way way = new Way();
way.Id = id;
way.Nodes = new List<long>(nodes);
way.Tags = tags;
return way;
}
示例5: GetLabelFor
/// <summary>
/// Returns a label for different categories of highways.
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
public RoutingLabel GetLabelFor(TagsCollectionBase tags)
{
if (_edge_intepreter.IsOnlyLocalAccessible(tags))
{
return new RoutingLabel('L', "OnlyLocalAccessible"); // local
}
return new RoutingLabel('R', "GeneralAccessible"); // regular.
}
示例6: 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;
}
示例7: Create
/// <summary>
/// Creates a new relation.
/// </summary>
/// <param name="id"></param>
/// <param name="tags"></param>
/// <param name="members"></param>
/// <returns></returns>
public static Relation Create(long id, TagsCollectionBase tags, params RelationMember[] members)
{
Relation relation = new Relation();
relation.Id = id;
relation.Members = new List<RelationMember>(members);
relation.Tags = tags;
return relation;
}
示例8: SerializeWithSize
/// <summary>
/// Serializes a tags collection to a byte array and addes the size in the first 4 bytes.
/// </summary>
/// <param name="collection"></param>
/// <param name="stream"></param>
/// <returns></returns>
public void SerializeWithSize(TagsCollectionBase collection, Stream stream)
{
RuntimeTypeModel typeModel = TypeModel.Create();
typeModel.Add(typeof(Tag), true);
var tagsList = new List<Tag>(collection);
typeModel.SerializeWithSize(stream, tagsList);
}
示例9: Evaluate
public override TagsCollectionBase Evaluate(TagsCollectionBase tags, OsmGeoType type)
{
if (tags == null)
{
throw new ArgumentNullException("tags");
}
return tags;
}
示例10: 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;
}
示例11: ConvertTags
private IAttributesTable ConvertTags(TagsCollectionBase tags, long id)
{
var properties = tags.ToStringObjectDictionary();
properties.Add("osm_id", id);
var table = new AttributesTable();
foreach (var key in properties.Keys)
{
table.AddAttribute(key, properties[key]);
}
return table;
}
示例12: 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);
}
示例13: GenerateDirectTurn
/// <summary>
/// Generates an instruction for a direct turn.
/// </summary>
/// <param name="countBefore"></param>
/// <param name="street"></param>
/// <param name="direction"></param>
/// <param name="pois"></param>
/// <returns></returns>
protected override string GenerateDirectTurn(int countBefore, TagsCollectionBase street, RelativeDirection direction, List<PointPoi> pois)
{
countBefore++;
if (countBefore == 1)
{
return string.Format("Neem de 1ste afslag {0}, de {1} op.", TurnDirection(direction), this.GetName("nl", street));
}
else
{
return string.Format("Neem de {0}de afslag {1}, de {2} op.", countBefore, TurnDirection(direction), this.GetName("nl", street));
}
}
示例14: GetNamesInAllLanguages
/// <summary>
/// Returns all the names in all languages and alternatives.
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
public Dictionary<string, string> GetNamesInAllLanguages(TagsCollectionBase tags)
{
var names = new Dictionary<string, string>();
//if (tags != null)
//{
// foreach (var pair in tags)
// {
// var m = Regex.Match(pair.Key, "name:[a-zA-Z]");
// if (m.Success)
// {
// //throw new NotImplementedException();
// }
// }
//}
return names;
}
示例15: Evaluate
public override TagsCollectionBase Evaluate(TagsCollectionBase tags, OsmGeoType type)
{
if (tags == null)
{
throw new ArgumentNullException("tags");
}
var result = tags;
if (type == _type)
{
result = TagsCollectionBase.Empty;
}
return result;
}