Ejemplo n.º 1
0
#pragma warning disable 1998
        /// <summary>
        /// Performs the initial data load
        /// </summary>
        /// <returns></returns>
        private async Task PerformInitialLoad()
        {
            AppController.Logger.Log("Performing initial data load from " + AppController.InputPath);
            TileDataLoader loader = new TileDataLoader(AppController.InputPath);

            TileLoadBuffer = loader.LoadTileData();
        }
Ejemplo n.º 2
0
#pragma warning restore 1998

        /// <summary>
        /// Performs the actual tiling operations.
        /// </summary>
        public void Tile()
        {
            // Start from a clean state
            Reset();
            AppController.Logger.Log("Performing the tiling operations...");

            // Handle the tiles in the tile load buffer
            Parallel.ForEach(TileLoadBuffer.Buffer, new ParallelOptions {
                MaxDegreeOfParallelism = AppController.MaxTilingThreads
            }, (values, state) =>
            {
                if (AppController.StopRequested) // User requested tiling thread be stopped
                {
                    state.Break();
                }

                List <Tile> tileStore = values.Value;
                if (tileStore.Count > 0)
                {
                    foreach (Tile currentTile in tileStore)
                    {
                        ProcessTile(currentTile);
                    }
                }
            });

            TileLoadBuffer.Clear();
            TileLoadBuffer = null;

            if (AppController.StopRequested)
            {
                return;
            }

            // Clear some memory
            CompleteTiles.Clear();
            CompleteTiles = null;

            // Perform the merge jobs
            AppController.Logger.Log("Handling the merge queue...");
            AppController.MergeEngine.Run();

            // Cleanup
            Cleanup();
        }