Made Fields FileNames public

This commit is contained in:
glax 2023-04-01 00:40:06 +02:00
parent e7119b22ae
commit b12f959f48

View File

@ -17,9 +17,9 @@ public class RegionConverter
NumberDecimalSeparator = "." NumberDecimalSeparator = "."
}; };
private const string NodesFileName = "region.nodes"; public const string NodesFileName = "region.nodes";
private const string WaysFileName = "region.ways"; public const string WaysFileName = "region.ways";
private const string tagsFileName = "waytags"; public const string tagsFileName = "waytags";
public static void ConvertXMLToRegions(string filePath, string outputPath) public static void ConvertXMLToRegions(string filePath, string outputPath)
{ {
@ -43,7 +43,7 @@ public class RegionConverter
Dictionary<ulong, ulong> nodeRegions = new(); Dictionary<ulong, ulong> nodeRegions = new();
Dictionary<ulong, FileStream> regionFileStreams = new(); Dictionary<ulong, FileStream> regionFileStreams = new();
Dictionary<ulong, OsmNode> tmpAllNodes = new(); Dictionary<ulong, OsmNode> tmpAllNodes = new();
bool isHighway = false; bool isHighway;
HashSet<ulong> currentIds = new(); HashSet<ulong> currentIds = new();
while (xmlReader.Read()) while (xmlReader.Read())
{ {
@ -108,6 +108,7 @@ public class RegionConverter
return nodeRegions; return nodeRegions;
} }
//TODO write all tags in region to single file instead of separate wayfiles
private static void ImportWays(XmlReader xmlReader, Dictionary<ulong, ulong> nodeRegions, string outputPath) private static void ImportWays(XmlReader xmlReader, Dictionary<ulong, ulong> nodeRegions, string outputPath)
{ {
BinaryFormatter bFormatter = new BinaryFormatter(); BinaryFormatter bFormatter = new BinaryFormatter();
@ -219,5 +220,9 @@ public class RegionConverter
} }
} }
xmlReader.Close(); xmlReader.Close();
foreach (FileStream f in regionWaysFileStreams.Values)
{
f.Dispose();
}
} }
} }