31 lines
1019 B
C#
31 lines
1019 B
C#
using OSMImporter;
|
|
using OSMDatastructure;
|
|
|
|
namespace Server;
|
|
|
|
public class Server
|
|
{
|
|
|
|
public static Region LoadRegion(string folderPath, Coordinates coordinates)
|
|
{
|
|
string fullPath = Path.Combine(folderPath, coordinates.GetRegionHash(Importer.regionSize).ToString());
|
|
Console.WriteLine(fullPath);
|
|
Region retRegion = new Region(coordinates, Importer.regionSize);
|
|
if (!File.Exists(fullPath))
|
|
return retRegion;
|
|
|
|
FileStream fileStream = new FileStream(fullPath, FileMode.Open);
|
|
|
|
byte[] regionBytes = new byte[fileStream.Length];
|
|
fileStream.Read(regionBytes, 0, regionBytes.Length);
|
|
fileStream.Close();
|
|
|
|
return ByteConverter.ToRegion(regionBytes);
|
|
}
|
|
|
|
public static void Main(string[] args)
|
|
{
|
|
Importer.Split("/home/glax/Downloads/bayern-latest.osm", "/home/glax/Downloads/bayern-latest");
|
|
Region r = LoadRegion("/home/glax/Downloads/bayern-latest", new Coordinates(47.890f,12.56f));
|
|
}
|
|
} |