Added function to render a base-area-image.

This commit is contained in:
glax 2023-04-21 14:44:50 +02:00
parent c43c6dc985
commit 6373874495

View File

@ -26,28 +26,11 @@ public class Server
Coordinates start = new (48.7933798f, 9.8275859f);
Coordinates finish = new (48.795918f, 9.021618f);
TestVariables(workingDir, start, finish, 4);
TestVariables(workingDir, start, finish, 16);
/*
string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName;
/*
Console.WriteLine("Preparing BaseRender");
RegionManager allRegions = new(workingDir);
for (float lat = 48.78f - Region.RegionSize / 2; lat < 48.87f + Region.RegionSize / 2; lat += Region.RegionSize / 2)
{
for (float lon = 9f - Region.RegionSize / 2; lon < 9.9f + Region.RegionSize / 2; lon += Region.RegionSize / 2)
{
allRegions.GetRegion(new Coordinates(lat, lon));
}
}
Console.WriteLine("Regions Loaded. Rendering.");
ValueTuple<Image, Renderer.Bounds> baseRender = Renderer.DrawArea(allRegions);
*/
/*
Pathfinder result = new Pathfinder(workingDir).AStar(start,
finish, Tag.SpeedType.car, 0.034, 0.012,
0, 0.18);
@ -66,13 +49,33 @@ public class Server
#pragma warning restore CA1416*/
}
private static ValueTuple<Image, Renderer.Bounds> RenderAreaBaseImage(string workingDir, Coordinates c1, Coordinates c2)
{
float minLat = c1.latitude < c2.latitude ? c1.latitude : c2.latitude;
float minLon = c1.longitude < c2.longitude ? c1.longitude : c2.longitude;
float maxLat = c1.latitude > c2.latitude ? c1.latitude : c2.latitude;
float maxLon = c1.longitude > c2.longitude ? c1.longitude : c2.longitude;
RegionManager allRegions = new(workingDir);
for (float lat = minLat - Region.RegionSize; lat < maxLat + Region.RegionSize; lat += Region.RegionSize / 2)
{
for (float lon = minLon - Region.RegionSize; lon < maxLon + Region.RegionSize; lon += Region.RegionSize / 2)
{
allRegions.GetRegion(new Coordinates(lat, lon));
}
}
Console.WriteLine("Regions Loaded. Rendering.");
ValueTuple<Image, Renderer.Bounds> baseRender = Renderer.DrawArea(allRegions);
return baseRender;
}
private static void TestVariables(string workingDir, Coordinates start, Coordinates finish, int threads)
{
string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName;
Queue<Thread> calcThreads = new();
for (double sameRoadPriority = 0.002; sameRoadPriority < 0.4; sameRoadPriority += 0.02)
for (double sameRoadPriority = 0.02; sameRoadPriority < 0.4; sameRoadPriority += 0.02)
{
for (double roadLevelPriority = 0.4; roadLevelPriority > 0; roadLevelPriority -= 0.02)
{