Preload Regions
This commit is contained in:
parent
2799db162d
commit
7b88616373
@ -30,7 +30,7 @@ public class Server
|
|||||||
GetShortestRoute("D:");
|
GetShortestRoute("D:");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ValueTuple<Image, Renderer.Bounds> area = RenderAreaBaseImage(workingDir, start, finish);
|
ValueTuple<Image, Renderer.Bounds> area = Renderer.DrawArea(LoadRegions(workingDir, start, finish));
|
||||||
area.Item1.Save(@"D:\Base.png", ImageFormat.Png);
|
area.Item1.Save(@"D:\Base.png", ImageFormat.Png);
|
||||||
|
|
||||||
ValueTuple<Image, Renderer.Bounds> areaDistance = Renderer.DrawPath(
|
ValueTuple<Image, Renderer.Bounds> areaDistance = Renderer.DrawPath(
|
||||||
@ -90,7 +90,7 @@ public class Server
|
|||||||
Console.WriteLine($"Shortest: {shortest.Key.distance} {shortest.Value}\nFastest: {shortest.Key.weight} {fastest.Value}\nCalcTime: {calcTime.Key.calcTime} {calcTime.Value}");
|
Console.WriteLine($"Shortest: {shortest.Key.distance} {shortest.Value}\nFastest: {shortest.Key.weight} {fastest.Value}\nCalcTime: {calcTime.Key.calcTime} {calcTime.Value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ValueTuple<Image, Renderer.Bounds> RenderAreaBaseImage(string workingDir, Coordinates c1, Coordinates c2)
|
private static RegionManager LoadRegions(string workingDir, Coordinates c1, Coordinates c2)
|
||||||
{
|
{
|
||||||
float minLat = c1.latitude < c2.latitude ? c1.latitude : c2.latitude;
|
float minLat = c1.latitude < c2.latitude ? c1.latitude : c2.latitude;
|
||||||
float minLon = c1.longitude < c2.longitude ? c1.longitude : c2.longitude;
|
float minLon = c1.longitude < c2.longitude ? c1.longitude : c2.longitude;
|
||||||
@ -105,16 +105,15 @@ public class Server
|
|||||||
allRegions.GetRegion(new Coordinates(lat, lon));
|
allRegions.GetRegion(new Coordinates(lat, lon));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Console.WriteLine("Regions Loaded. Rendering.");
|
Console.WriteLine("Loaded needed Regions");
|
||||||
ValueTuple<Image, Renderer.Bounds> baseRender = Renderer.DrawArea(allRegions);
|
return allRegions;
|
||||||
return baseRender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void TestVariables(string workingDir, Coordinates start, Coordinates finish, int threads)
|
private static void TestVariables(string workingDir, Coordinates start, Coordinates finish, int threads)
|
||||||
{
|
{
|
||||||
string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName;
|
string parentFolder = new DirectoryInfo(workingDir).Parent!.FullName;
|
||||||
|
|
||||||
RegionManager rm = new (workingDir);
|
RegionManager rm = LoadRegions(workingDir, start, finish);
|
||||||
|
|
||||||
Queue<Thread> calcThreads = new();
|
Queue<Thread> calcThreads = new();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user