/// <summary> /// Does the infection. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="MouseEventArgs"/> instance containing the event data.</param> private void DoInfection(object sender, MouseEventArgs args) { double lat, lon; int x, y; GraphicalUtilities.GraphicsCoordsToMapCoords(m_mapControl.Size, m_worldModel.Size, args.X, args.Y, out x, out y); m_data.DataXYToLatLon(x, y, out lat, out lon); m_worldModel.InfectAt(x, y); toolStripStatusLabel1.Text = $"Infection introduced at Lat = {Math.Abs(lat):F0} degrees {(lat < 0 ? "North" : "South")}, Lon = {Math.Abs(lon):F0} degrees {(lon > 0 ? "East" : "West")}."; }
private void SelectCountry(object sender, MouseEventArgs args) { int x, y; GraphicalUtilities.GraphicsCoordsToMapCoords(m_mapControl1.Size, m_mapControl1.MyWorldModel.Size, args.X, args.Y, out x, out y); DiseaseNode n = m_mapControl1.MyWorldModel.NodeAt(x, y); SimCountryData cd = m_mapControl1.MyWorldModel.CountryForCode(n.MapCell.CountryCode); if (cd != null) { CountrySelected?.Invoke(cd); } }
private void ReportVoxelData(object sender, MouseEventArgs args) { double lat, lon; int x, y; GraphicalUtilities.GraphicsCoordsToMapCoords(m_mapControl1.Size, m_mapControl1.MyWorldModel.Size, args.X, args.Y, out x, out y); m_mapControl1.MyWorldModel.MapData.DataXYToLatLon(x, y, out lat, out lon); DiseaseNode n = m_mapControl1.MyWorldModel.NodeAt(x, y); string where = n.MapCell.CountryCode; string text = $"data[{x},{y}] ({where}, Lat {lat:f2}/Lon {lon:f2} {n:d4}"; ReportStatus(text); }
private void InfectAtVoxel(object sender, MouseEventArgs args) { double lat, lon; int x, y; GraphicalUtilities.GraphicsCoordsToMapCoords(m_mapControl1.Size, m_mapControl1.MyWorldModel.Size, args.X, args.Y, out x, out y); m_mapControl1.MyWorldModel.MapData.DataXYToLatLon(x, y, out lat, out lon); m_mapControl1.MyWorldModel.InfectAt(x, y); m_mapControl1.MouseMove -= InfectAtVoxel; m_mapControl1.Cursor = Cursors.Default; DateTime when = m_mapControl1.MyWorldModel.Executive.Now; if (when == DateTime.MinValue) when = m_mapControl1.MyWorldModel.ExecutionParameters.StartTime; string countryName = ReverseGeocodeService.CountryNameForLatAndLong(lat, lon + 2) ?? "Unknown"; string text = $"{when} : Infection introduced at Lat = {Math.Abs(lat):F0} degrees {(lat < 0 ? "North" : "South")}, Lon = {Math.Abs(lon):F0} degrees {(lon > 0 ? "East" : "West")}. ({countryName})"; Console.WriteLine(text); SetMapMode(MapMode.Informational); }
private void InitialUI_Load(object sender, EventArgs e) { m_worldModel = new WorldModel(m_data, SimCountryData.LoadFrom(@"../../../Data/CountryData.dat")); m_mapControl.AssignWorldModel(m_worldModel); PlotForm dc1 = new PlotForm("Mortality"); dc1.Bind(m_worldModel, new[] { GetTotal(n => n.Killed), GetTotal(n => n.Dead) }, new[] { "Killed", "Dead" }); PlotForm dc2 = new PlotForm("Disease Stages"); dc2.Bind(m_worldModel, new[] { GetTotal(n => n.ContagiousAsymptomatic), GetTotal(n => n.ContagiousSymptomatic), GetTotal(n => n.NonContagiousInfected), GetTotal(n => n.Immune), }, new[] { "ContagiousAsymptomatic", "ContagiousSymptomatic", "NonContagiousInfected", "Immune" }); m_mapControl.Show(); dc1.Show(); dc2.Show(); /*PlotForm m_plotWindow1 = new PlotForm("Killed"); * m_plotWindow1.Bind(m_worldModel, GetTotal(n => n.Killed)); * m_plotWindow1.Show(); * * PlotForm m_plotWindow2 = new PlotForm("Immune"); * m_plotWindow2.Bind(m_worldModel, GetTotal(n => n.Immune)); * m_plotWindow2.Show(); * * PlotForm m_plotWindow3 = new PlotForm("Total Population"); * m_plotWindow3.Bind(m_worldModel, GetTotal(n => n.Population)); * m_plotWindow3.Show(); * * PlotForm m_plotWindow4 = new PlotForm("Immunization Effort"); * m_plotWindow4.Bind(m_worldModel, GetTotal(n => n.Flows[2](n))); * m_plotWindow4.Show();*/ m_mapControl.MouseMove += (o, args) => { double lat, lon; int x, y; GraphicalUtilities.GraphicsCoordsToMapCoords(panel1.Size, m_worldModel.Size, args.X, args.Y, out x, out y); m_data.DataXYToLatLon(x, y, out lat, out lon); string where = ReverseGeocodeService.CountryNameForLatAndLong(lat, lon + 2) ?? "Unknown"; DiseaseNode n = m_worldModel.NodeAt(x, y); toolStripStatusLabel1.Text = $"data[{x},{y}] is {where}, Lat {lat:f2}/Lon {lon:f2} {n:d4}"; Console.WriteLine(toolStripStatusLabel1.Text); }; toolStripStatusLabel1.TextChanged += (o, args) => Console.WriteLine(((ToolStripStatusLabel)o).Text); }