OSMServer/Server/Server.cs

37 lines
1.2 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
Coordinates start = new Coordinates(48.7933989f, 9.8301467f);
Coordinates finish = new Coordinates(48.7906258f, 9.8355983f);
OsmNode[] path = Pathfinder.CustomAStar("D:/map", start, finish, Tag.SpeedType.pedestrian).ToArray();
2023-02-08 19:09:54 +01:00
Console.WriteLine("{0}\n", path[0].ToString());
for (int i = 0; i < path.Length - 1; i++)
{
OsmNode n1 = path[i];
OsmNode n2 = path[i + 1];
OsmEdge? e = n1.GetEdgeToNode(n2);
if(e != null)
Console.WriteLine("{0}\n{1}", e.ToString(), n2.ToString());
else
Console.WriteLine("NO EDGE\n{0}", n2.ToString());
}
2023-04-01 14:43:22 +02:00
Console.WriteLine();
2023-02-02 19:03:00 +01:00
}
}