Loading Tags
This commit is contained in:
parent
452c5d3177
commit
15628d3544
@ -25,6 +25,18 @@ public class RegionLoader
|
||||
Region r = GetRegion(regionHash);
|
||||
return r.ways;
|
||||
}
|
||||
|
||||
public TagManager GetTags(ulong regionHash)
|
||||
{
|
||||
Region r = GetRegion(regionHash);
|
||||
return r.tagManager;
|
||||
}
|
||||
|
||||
public HashSet<Tag>? GetTagsForWay(ulong regionHash, ulong wayId)
|
||||
{
|
||||
Region r = GetRegion(regionHash);
|
||||
return r.tagManager.GetTagsForWayId(wayId);
|
||||
}
|
||||
|
||||
public Region GetRegion(ulong regionHash)
|
||||
{
|
||||
@ -60,6 +72,17 @@ public class RegionLoader
|
||||
newRegion.nodes.Add(deserializedNode);
|
||||
}
|
||||
}
|
||||
|
||||
using (FileStream tagsFileStream = new FileStream(Path.Join(path, regionHash.ToString(), RegionConverter.tagsFileName), FileMode.Open))
|
||||
{
|
||||
while (tagsFileStream.Position < tagsFileStream.Length)
|
||||
{
|
||||
TagManager tm = (TagManager)bFormatter.Deserialize(tagsFileStream);
|
||||
ulong id = (ulong)tm.wayTagSets.First()!.Value.First(tag => tag.key == Tag.TagType.id)!.value;
|
||||
foreach(Tag tag in tm.wayTagSets.First()!.Value)
|
||||
newRegion.tagManager.AddTag(id, tag);
|
||||
}
|
||||
}
|
||||
#pragma warning restore SYSLIB0011
|
||||
|
||||
regionIdsDict.Add(regionHash, newRegion);
|
||||
|
Loading…
Reference in New Issue
Block a user