예제 #1
0
        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);
        }