AltitudeAngelWings.Service.AltitudeAngelService.UpdateMapData C# (CSharp) Method

UpdateMapData() public method

Updates a map with the latest ground / air data
public UpdateMapData ( IMap map ) : System.Threading.Tasks.Task
map IMap The map to update
return System.Threading.Tasks.Task
        public async Task UpdateMapData(IMap map)
        {
            if (!IsSignedIn)
                return;

            RectLatLng area = map.GetViewArea();
            await _messagesService.AddMessageAsync($"Map area {area.Top}, {area.Bottom}, {area.Left}, {area.Right}");

            AAFeatureCollection mapData = await _aaClient.GetMapData(area);

            // build the filter list
            mapData.GetFilters();

            // this ensures the user sees the results before its saved
            _missionPlanner.SaveSetting("AAWings.Filters", JsonConvert.SerializeObject(FilteredOut));

            await _messagesService.AddMessageAsync($"Map area Loaded {area.Top}, {area.Bottom}, {area.Left}, {area.Right}");

            // add all items to cache
            mapData.Features.ForEach(feature => cache[feature.Id] = feature);

            // Only get the features that are enabled by default, and have not been filtered out
            IEnumerable<Feature> features = mapData.Features.Where(feature => feature.IsEnabledByDefault() && feature.IsFilterOutItem(FilteredOut)).ToList();

            ProcessFeatures(map, features);
        }