예제 #1
0
        public static async Task ProcessRawData(StandardChunkMetadata template, TraceListener log)
        {
            bool doMore = false;

            if (template.ZoomLevel <= Heights.Current.SourceDataZoom)
            {
                var ok = await Heights.Current.ExistsComputedChunk(template, log);

                log?.Write(ok ? "." : ("Heights:" + Heights.Current.GetShortFilename(template) + ":" + "missing"));
                doMore = true;
            }

            if (template.ZoomLevel <= Images.Current.SourceDataZoom)
            {
                var ok = await Images.Current.ExistsComputedChunk(template, log);

                log?.Write(ok ? "." : ("Images:" + Images.Current.GetShortFilename(template) + ":" + "missing"));
                doMore = true;
            }

            if (!doMore)
            {
                return;
            }

            foreach (var c in template.GetChildChunks())
            {
                await ProcessRawData(c, log);
            }
        }
예제 #2
0
        public async Task <ChunkHolder <T> > ProcessRawData(StandardChunkMetadata template, TraceListener log)
        {
            var computedChunk = await GetComputedChunk(template, log);

            string          fileName = computedChunk.Item1;
            ChunkHolder <T> ret      = computedChunk.Item2;

            if (computedChunk.Item2 != null)
            {
                log?.WriteLine("Cached " + description + " chunk file exists: " + fileName);
                return(computedChunk.Item2);
            }

            log?.WriteLine("Cached " + description + " chunk file does not exist: " + fileName);

            if (template.ZoomLevel > this.SourceDataZoom)
            {
                // Nothing to do for processing
                return(null);
            }
            else if (template.ZoomLevel == this.SourceDataZoom)
            {
                log?.WriteLine("Starting generation...");
                ret = await GenerateData(template, log);
                await WriteChunk(ret, fileName, log);

                log?.WriteLine("Finished generation of " + description + " cached chunk file: " + fileName);
                return(ret);
            }

            log?.WriteLine("Need to aggregate up from higher zoom data");
            var children = template.GetChildChunks();
            List <ChunkHolder <T> > chunks = new List <ChunkHolder <T> >();

            foreach (var child in children)
            {
                log?.WriteLine(child);
                chunks.Add(await ProcessRawData(child, log));
            }

            ret = new ChunkHolder <T>(
                template.LatSteps, template.LonSteps,
                template.LatLo, template.LonLo,
                template.LatHi, template.LonHi,
                null,
                toDouble,
                fromDouble);

            ret.RenderChunksInto(chunks, aggregate, log);
            await WriteChunk(ret, fileName, log);

            log?.WriteLine("Finished generation of " + description + " cached chunk file: " + fileName);

            return(ret);
        }