コード例 #1
0
        public async Task Initialize(IHyperArgsSink store, string metadataSetId, int smallestPageSize)
        {
            this.HyperStore = store;

            if (metadataSetId == null)
            {
                MetadataSetLoadFailed.Value = true;
                return;
            }

            MetadataSetId = new HyperDocumentId(metadataSetId, typeof(HyperMetadataSet));

            var metadataSetFilter = await store.ExecuteAsync(new RetrieveHyperDocumentArgs(MetadataSetId));

            if (metadataSetFilter != null)
            {
                this._smallestPageSize = smallestPageSize;

                PageSize = smallestPageSize;

                this._metadataSet = metadataSetFilter.GetPayload <HyperMetadataSet>();
                this.DashApiPort  = await GetDashApiPort();

                await LoadTotalPages();
                await LoadHyperTags();

                await InitializeMetadatasetEdgeDates();
            }
            else
            {
                MetadataSetLoadFailed.Value = true;
            }
        }
コード例 #2
0
        private async Task ApplyFilterConditions(FindHyperDocumentsArgs mainArgs, HyperMetadataSet id)
        {
            var conditions = await MetaDataSetHelper.GenerateFilterFromMetaDataSetAsync(_netStore, id);

            if (conditions.Value != null)
            {
                mainArgs.DescriptorConditions.AddCondition(conditions.Value);
            }
        }
コード例 #3
0
        public MasksHeatmapRenderer(IHyperArgsSink hyperStore, HyperMetadataSet metadataSet, HeatmapSettings settings)
        {
            _hyperStore  = hyperStore;
            _metadataSet = metadataSet;
            _settings    = settings;

            _keepWorking = true;
            _ctSource    = new CancellationTokenSource();
        }
コード例 #4
0
        public async Task <HyperMission> LoadMission(HyperMetadataSet metadataset)
        {
            var missionId = metadataset?.MissionIds?.FirstOrDefault().Id;

            if (string.IsNullOrWhiteSpace(missionId))
            {
                return(null);
            }

            var retrieveHyperDocumentArgs = new RetrieveHyperDocumentArgs()
            {
                DocumentId = HyperDocumentId.Create <HyperMission>(missionId)
            };

            var hyperDocument = await _netStore.ExecuteAsync(retrieveHyperDocumentArgs);

            var mission = hyperDocument.GetPayload <HyperMission>();

            return(mission);
        }
コード例 #5
0
 /// <summary>
 /// Tries to duplicate metadata set object to avoid modifying original one with local changes.
 /// </summary>
 private void ProtectOriginalMetadataSet()
 {
     _metadataSet          = _metadataSet.ShallowCopy();
     _metadataSet.TagTypes = (string[])_metadataSet.TagTypes.Clone();
 }
コード例 #6
0
        public async Task <HeatmapStepCache> CreateCache(DateTime startDate, DateTime endDate, HyperMetadataSet metadataSet, TimeSpan stepLength)
        {
            _percentageCompleted  = 0;
            GenerationWasCanceled = false;
            GenerationProgress?.Invoke(0);

            var newCache = new HeatmapStepCache()
            {
                MetadataSetId = metadataSet.Id
            };

            _stepToTasksMappings = new Dictionary <HeatmapCacheStep, MasksHeatmapRenderer>();
            var tasks          = new List <Task>();
            var tasksCompleted = 0;

            while (startDate < endDate)
            {
                var step = new HeatmapCacheStep
                {
                    From = startDate,
                    To   = startDate + stepLength > endDate ? endDate : startDate + stepLength
                };

                var renderer = new MasksHeatmapRenderer(_store, metadataSet, _heatmapSettings);
                renderer.PertcantageProcessedUpdated += (percentageLambda) =>
                {
                    _percentageCompleted += percentageLambda / tasks.Count;
                    this.GenerationProgress?.Invoke(_percentageCompleted);
                };
                var task = renderer.RunGenerationAsync(step.From, step.To)
                           .ContinueWith(t =>
                {
                    tasksCompleted++;
                });
                _stepToTasksMappings[step] = renderer;
                tasks.Add(task);

                startDate = startDate + stepLength;

                System.Diagnostics.Debug.WriteLine("Cache heatmap task added");
            }

            await Task.WhenAll(tasks);

            newCache.Steps.AddRange(_stepToTasksMappings.Keys);
            foreach (var kv in _stepToTasksMappings)
            {
                var step = kv.Key;
                step.ImageData = kv.Value.ImageProp.Value;
            }

            return(newCache);
        }