本文整理汇总了C#中TagsCollectionBase类的典型用法代码示例。如果您正苦于以下问题:C# TagsCollectionBase类的具体用法?C# TagsCollectionBase怎么用?C# TagsCollectionBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TagsCollectionBase类属于命名空间,在下文中一共展示了TagsCollectionBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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));
}
}
}
}
开发者ID:OsmSharp,项目名称:sqlserver-dataprovider,代码行数:30,代码来源:ComparisonHelpers.cs
示例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);
}
开发者ID:cmberryau,项目名称:core,代码行数:7,代码来源:TagFilterAdditive.cs
示例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;
}
开发者ID:UnifyKit,项目名称:OsmSharp,代码行数:15,代码来源:Way.cs
示例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.
}
开发者ID:cmberryau,项目名称:routing,代码行数:13,代码来源:DefaultHighwayConstraints.cs
示例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;
}
开发者ID:cmberryau,项目名称:routing,代码行数:13,代码来源:EdgeInterpreter.cs
示例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;
}
开发者ID:UnifyKit,项目名称:OsmSharp,代码行数:15,代码来源:Relation.cs
示例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);
}
开发者ID:UnifyKit,项目名称:OsmSharp,代码行数:14,代码来源:TagsCollectionSerializer.cs
示例9: Evaluate
public override TagsCollectionBase Evaluate(TagsCollectionBase tags, OsmGeoType type)
{
if (tags == null)
{
throw new ArgumentNullException("tags");
}
return tags;
}
开发者ID:cmberryau,项目名称:core,代码行数:9,代码来源:TagFilterAny.cs
示例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;
}
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:14,代码来源:EdgeInterpreter.cs
示例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;
}
开发者ID:IsraelHikingMap,项目名称:Site,代码行数:11,代码来源:OsmGeoJsonConverter.cs
示例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);
}
开发者ID:cmberryau,项目名称:routing,代码行数:17,代码来源:MotorVehicle.cs
示例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));
}
}
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:20,代码来源:DutchLanguageGenerator.cs
示例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;
}
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:21,代码来源:EdgeInterpreter.cs
示例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;
}
开发者ID:cmberryau,项目名称:core,代码行数:16,代码来源:TagFilterNone.cs
示例16: GenerateDirectTurn
/// <summary>
/// Direct turn instruction.
/// </summary>
/// <param name="instruction"></param>
/// <param name="streetCountBeforeTurn"></param>
/// <param name="streetTo"></param>
/// <param name="direction"></param>
/// <param name="list"></param>
/// <returns></returns>
public Instruction GenerateDirectTurn(Instruction instruction,
int streetCountBeforeTurn,
TagsCollectionBase streetTo,
RelativeDirectionEnum direction,
List<PointPoi> list)
{
instruction.Text = string.Format("GenerateDirectTurn:{0}_{1}_{2}",
streetCountBeforeTurn, direction.ToString(), list.Count);
instruction.Extras = new Dictionary<string, object>();
instruction.Extras.Add("streetCountBeforeTurn", streetCountBeforeTurn);
instruction.Extras.Add("streetTo", streetTo);
instruction.Extras.Add("direction", direction);
instruction.Extras.Add("list", list);
return instruction;
}
开发者ID:vcotlearov,项目名称:OsmSharp,代码行数:26,代码来源:LanguageTestGenerator.cs
示例17: IsOnlyLocalAccessible
/// <summary>
/// Returns true if the edge with the given tags is only accessible locally.
/// </summary>
/// <param name="tags"></param>
/// <returns></returns>
public bool IsOnlyLocalAccessible(TagsCollectionBase tags)
{
string tag;
if (tags.TryGetValue("highway", out tag))
{
if (tag == "service")
{
return true;
}
}
if (tags.TryGetValue("access", out tag))
{
if (tag == "private" || tag == "official")
{
return true;
}
}
return false;
}
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:24,代码来源:EdgeInterpreter.cs
示例18: GenerateImmidiateTurn
/// <summary>
/// Generates an instruction for an immidiate turn.
/// </summary>
/// <param name="countBefore"></param>
/// <param name="firstStreet"></param>
/// <param name="firstDirection"></param>
/// <param name="secondStreet"></param>
/// <param name="secondDirection"></param>
/// <param name="pois"></param>
/// <returns></returns>
protected override string GenerateImmidiateTurn(int countBefore, TagsCollectionBase firstStreet, RelativeDirection firstDirection, TagsCollectionBase secondStreet, RelativeDirection secondDirection, List<PointPoi> pois)
{
countBefore++;
if (countBefore == 1)
{
return string.Format("Take the first turn {0}, on the {1}, and turn immidiately {2} on the {3}.",
TurnDirection(firstDirection),
this.GetName("en", firstStreet),
TurnDirection(secondDirection),
this.GetName("en", secondStreet));
}
else
{
return string.Format("Take the {4}d turn {0}, on the {1}, and turn immidiately {2} on the {3}.",
TurnDirection(firstDirection),
this.GetName("en", firstStreet),
TurnDirection(secondDirection),
this.GetName("en", secondStreet),
countBefore);
}
}
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:31,代码来源:EnglishLanguageGenerator.cs
示例19: GenerateDirectTurn
/// <summary>
/// Generates an instruction for a direct turn.
/// </summary>
/// <param name="instruction"></param>
/// <param name="street_count_before_turn"></param>
/// <param name="street_to"></param>
/// <param name="direction"></param>
/// <param name="list"></param>
/// <returns></returns>
public Instruction GenerateDirectTurn(Instruction instruction, int street_count_before_turn,
TagsCollectionBase street_to, RelativeDirectionEnum direction, List<PointPoi> list)
{
// if (street_count_before_turn == 1)
// {
// instruction.Text = string.Format("Neem de 1ste afslag {0}, de {1} op.",
// TurnDirection(direction),
// this.GetName("nl", street_to));
// }
// else
// {
// instruction.Text = string.Format("Neem de {0}de afslag {1}, de {2} op.",
// street_count_before_turn,
// TurnDirection(direction),
// this.GetName("nl", street_to));
// }
instruction.Text = string.Format ("Draai {0}", TurnDirection (direction));
// returns the instruction with text.
return instruction;
}
开发者ID:nubix-biz,项目名称:OsmSharp,代码行数:30,代码来源:SimpleDutchLanguageGenerator.cs
示例20: MatchWithEdge
/// <summary>
/// Returns true if the edge is a suitable candidate as a target for a point to be resolved on.
/// </summary>
/// <param name="vehicle"></param>
/// <param name="pointTags"></param>
/// <param name="edgeTags"></param>
/// <returns></returns>
public bool MatchWithEdge(Vehicle vehicle,
TagsCollectionBase pointTags, TagsCollectionBase edgeTags)
{
if (pointTags == null || pointTags.Count == 0)
{ // when the point has no tags it has no requirements.
return true;
}
if (edgeTags == null || edgeTags.Count == 0)
{ // when the edge has no tags, no way to verify.
return false;
}
string pointName, edgeName;
if (pointTags.TryGetValue("name", out pointName) &&
edgeTags.TryGetValue("name", out edgeName))
{ // both have names.
return (pointName == edgeName);
}
return false;
}
开发者ID:OpenMaps,项目名称:OsmSharp,代码行数:28,代码来源:IEdgeMatcher.cs
注:本文中的TagsCollectionBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论