private void OpenSavedAOI_Execute(object aoi) { if (aoi is AreaOfInterest aoiObj) { if (!AreasOfInterest.Any((a) => a.Name == aoiObj.Name)) { CmdCleanMap_Execute(null); AreasOfInterest.Add(aoiObj); Flights.AddRange(aoiObj.Flights); } NotifyPropertyChanged("AreasOfInterest"); NotifyPropertyChanged("Flights"); RenderMap(); } }
private void RenderMap() { BmpPlanner.Children.Clear(); if (RenderWeatherConditions) { BmpPlanner.Children.Add(new MapTileLayer() { TileSource = new MSLPTileSource(), Opacity = 1 }); } if (RenderFIRMS) { BmpPlanner.Children.Add(new MapTileLayer() { TileSource = new FIRMSTileSource(), Opacity = 1 }); } MapLayer labelLayer = new MapLayer(); int totalFireCount = 0; if (_draftMapModel != null) { RenderMap(_draftMapModel, labelLayer, null, null); } foreach (var aoi in AreasOfInterest) { RenderMap(aoi.MapModel, labelLayer, null, null); } foreach (var flight in Flights) { totalFireCount += RenderMap(flight.MapModel, labelLayer, "Potential fire", (ControlTemplate)Application.Current.Resources["FirePushPinTemplate"]); } if (RenderRedFlagAlerts) { foreach (var redflag in RedFlagsNotifications) { RenderMap(redflag.MapModel, labelLayer, "Red flag warning", null); } } if (totalFireCount > 0) { var centerPoint = Flights.Where((f) => f.FireDetected).First().MapModel.Marks.First(); BmpPlanner.SetView(new Location(centerPoint.Latitude, centerPoint.Longitude), Math.Max(MAP_ZOOM_LEVEL_AREA, BmpPlanner.ZoomLevel)); FireAlert = Visibility.Visible; AreaIsGood = Visibility.Collapsed; NotifyPropertyChanged("AreaIsGood"); NotifyPropertyChanged("FireAlert"); } else if (Flights.Any()) { var centerPoint = Flights.First().MapModel.Polygons.First().CenterPosition(); BmpPlanner.SetView(new Location(centerPoint.Latitude, centerPoint.Longitude), Math.Max(MAP_ZOOM_LEVEL_AREA, BmpPlanner.ZoomLevel)); AreaIsGood = Visibility.Visible; FireAlert = Visibility.Collapsed; NotifyPropertyChanged("AreaIsGood"); NotifyPropertyChanged("FireAlert"); } else if (AreasOfInterest.Any()) { var centerPoint = AreasOfInterest.First().MapModel.Polygons.First().CenterPosition(); BmpPlanner.SetView(new Location(centerPoint.Latitude, centerPoint.Longitude), Math.Max(MAP_ZOOM_LEVEL_AREA, BmpPlanner.ZoomLevel)); } BmpPlanner.Children.Add(labelLayer); }