本文整理汇总了C#中OsmSharp.Collections.Tags.TagsCollection.RemoveKey方法的典型用法代码示例。如果您正苦于以下问题:C# TagsCollection.RemoveKey方法的具体用法?C# TagsCollection.RemoveKey怎么用?C# TagsCollection.RemoveKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsmSharp.Collections.Tags.TagsCollection
的用法示例。
在下文中一共展示了TagsCollection.RemoveKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Interpret
/// <summary>
/// Interprets an OSM-object and returns the corresponding geometry.
/// </summary>
/// <param name="osmObject"></param>
/// <returns></returns>
public override GeometryCollection Interpret(CompleteOsmGeo osmObject)
{
// DISCLAIMER: this is a very very very simple geometry interpreter and
// contains hardcoded all relevant tags.
GeometryCollection collection = new GeometryCollection();
TagsCollectionBase tags;
if (osmObject != null)
{
switch (osmObject.Type)
{
case CompleteOsmType.Node:
TagsCollection newCollection = new TagsCollection(
osmObject.Tags);
newCollection.RemoveKey("FIXME");
newCollection.RemoveKey("node");
newCollection.RemoveKey("source");
if (newCollection.Count > 0)
{ // there is still some relevant information left.
collection.Add(new Point((osmObject as CompleteNode).Coordinate));
}
break;
case CompleteOsmType.Way:
tags = osmObject.Tags;
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;
}
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;
}
if (isArea)
{ // area tags leads to simple polygon
LineairRing lineairRing = new LineairRing((osmObject as CompleteWay).GetCoordinates().ToArray<GeoCoordinate>());
lineairRing.Attributes = new SimpleGeometryAttributeCollection(tags);
collection.Add(lineairRing);
}
else
{ // no area tag leads to just a line.
LineString lineString = new LineString((osmObject as CompleteWay).GetCoordinates().ToArray<GeoCoordinate>());
lineString.Attributes = new SimpleGeometryAttributeCollection(tags);
collection.Add(lineString);
}
break;
case CompleteOsmType.Relation:
CompleteRelation relation = (osmObject as CompleteRelation);
tags = relation.Tags;
string typeValue;
if (tags.TryGetValue("type", out typeValue))
{ // there is a type in this relation.
if (typeValue == "multipolygon")
{ // this relation is a multipolygon.
Geometry geometry = this.InterpretMultipolygonRelation(relation);
if (geometry != null)
{ // add the geometry.
collection.Add(geometry);
}
}
else if (typeValue == "boundary")
{ // this relation is a boundary.
}
}
break;
}
//.........这里部分代码省略.........