/// <summary> /// Start calculationg the visual magnitude. /// </summary> /// <param name="elevationMap">Elevation map</param> public void StartWorking(ref GeoMap elevationMap) { sumator = new Sumator(elevationMap.GetLength(0), elevationMap.GetLength(1)); sumator.Start(); startingQueueSize = workQueue.Count; runningThreads = threadCount; for (int i = 0; i < threadCount; i++) { VisualMagnitudeWorker worker = new VisualMagnitudeWorker(ref workQueue, ref elevationMap, ref sumator, this); Thread thread = new Thread(worker.Start); threads[i] = thread; thread.Start(); } }
/// <summary> /// Start processing the work queue. /// </summary> public void Start() { GeoMap losMap = new GeoMap(elevationMap.GetLength(0), elevationMap.GetLength(1)); while (workQueue.TryDequeue(out SpatialUtils.ViewpointProps viewpoint)) { System.Diagnostics.Debug.WriteLine(workQueue.Count + " left"); CalculateVisualMagnitude(viewpoint, losMap); } System.Diagnostics.Debug.WriteLine("ThreadDone"); parent.ThreadFinished(); }