2023-04-19 22:55:49 +02:00
|
|
|
using System.Drawing;
|
2023-04-20 19:41:40 +02:00
|
|
|
using System.Drawing.Imaging;
|
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-13 19:18:25 +02:00
|
|
|
using RenderPath;
|
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
|
|
|
{
|
2023-04-20 19:41:40 +02:00
|
|
|
ConsoleWriter newConsole = new();
|
2023-03-31 21:56:27 +02:00
|
|
|
Console.SetOut(newConsole);
|
|
|
|
Console.SetError(newConsole);
|
2023-04-20 19:41:40 +02:00
|
|
|
|
|
|
|
string workingDir = "D:/stuttgart-regbez-latest";
|
2023-03-31 21:56:27 +02:00
|
|
|
|
2023-04-13 00:24:33 +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-06 14:46:19 +02:00
|
|
|
//RegionConverter.ConvertXMLToRegions("D:/germany-latest.osm", "D:/germany-latest");
|
2023-04-13 00:24:33 +02:00
|
|
|
|
2023-04-20 19:41:40 +02:00
|
|
|
Coordinates start = new (48.7933798f, 9.8275859f);
|
|
|
|
Coordinates finish = new (48.795918f, 9.021618f);
|
|
|
|
Pathfinder result = new Pathfinder(workingDir).AStar(start,
|
2023-04-19 22:55:49 +02:00
|
|
|
finish, Tag.SpeedType.car, 0.01, 0.0001,
|
2023-04-13 00:24:33 +02:00
|
|
|
0);
|
2023-04-19 22:55:49 +02:00
|
|
|
|
2023-04-20 19:41:40 +02:00
|
|
|
string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName;
|
|
|
|
string resultFileName = $"{new DirectoryInfo(workingDir).Name}-{DateTime.Now.ToFileTime()}.result";
|
|
|
|
result.SaveResult(Path.Join(parentFolder, resultFileName));
|
|
|
|
|
|
|
|
string renderFileName = $"{new DirectoryInfo(workingDir).Name}-{DateTime.Now.ToFileTime()}.render.png";
|
|
|
|
Image render = Renderer.DrawPathfinder(result);
|
|
|
|
#pragma warning disable CA1416
|
|
|
|
render.Save(Path.Join(parentFolder, renderFileName), ImageFormat.Png);
|
|
|
|
#pragma warning restore CA1416
|
2023-02-02 19:03:00 +01:00
|
|
|
}
|
|
|
|
}
|