OSMServer/Server/Server.cs

33 lines
1.1 KiB
C#
Raw Normal View History

2023-04-01 01:00:22 +02:00
using OSMDatastructure;
using OSMDatastructure.Graph;
2023-04-01 14:43:22 +02:00
using Pathfinding;
2023-04-01 01:00:22 +02:00
2023-02-02 22:30:43 +01:00
namespace Server;
2023-02-02 19:03:00 +01:00
public class Server
{
2023-02-08 19:09:54 +01:00
2023-02-02 22:30:43 +01:00
public static void Main(string[] args)
2023-02-02 19:03:00 +01:00
{
ConsoleWriter newConsole = new ConsoleWriter();
Console.SetOut(newConsole);
Console.SetError(newConsole);
2023-04-01 01:00:22 +02:00
//RegionConverter.ConvertXMLToRegions("D:/stuttgart-regbez-latest.osm", "D:/stuttgart-regbez-latest");
2023-04-01 14:43:22 +02:00
//RegionConverter.ConvertXMLToRegions("D:/map.osm", "D:/map");
2023-04-01 01:00:22 +02:00
Console.WriteLine("Loaded");
2023-04-01 14:43:22 +02:00
2023-04-01 18:10:26 +02:00
Coordinates start = new Coordinates(48.793319f, 9.832102f);
2023-04-01 18:28:26 +02:00
Coordinates finish = new Coordinates(48.8407888f, 10.0676020f);
2023-04-01 18:10:26 +02:00
DateTime startTime = DateTime.Now;
OsmNode[] path = Pathfinder.CustomAStar("D:/stuttgart-regbez-latest", start, finish, Tag.SpeedType.car).ToArray();
TimeSpan duration = DateTime.Now - startTime;
Console.WriteLine($"Took {duration.TotalMilliseconds}ms ({duration:g})");
2023-02-08 19:09:54 +01:00
for (int i = 0; i < path.Length - 1; i++)
{
2023-04-01 18:10:26 +02:00
Console.WriteLine(path[i]);
2023-02-08 19:09:54 +01:00
}
2023-04-01 14:43:22 +02:00
Console.WriteLine();
2023-02-02 19:03:00 +01:00
}
}