예제 #1
0
파일: Form1.cs 프로젝트: Dyl4n84/DART
        private void stationList_SelectedIndexChanged(object sender, EventArgs e)
        {
            string selectedStationName = "XXXXX";

            ListView.SelectedListViewItemCollection selectedStations = stationList.SelectedItems;
            if (selectedStations.Count > 0)
            {
                selectedStationName = selectedStations[0].Text;
            }

            /***** Display buoy data according to station name *****/
            // Get selected station name
            for (int i = 0; i < Stations.blist.Count; ++i)
            {
                if (Stations.blist[i].getbname() == selectedStationName)
                {
                    // Get Buoy from BuoyList
                    Buoy tmp = new Buoy();
                    tmp = Stations.blist[i];

                    // Write Buoy data to labels
                    label1.Text  = "Name: " + tmp.getbname();
                    label2.Text  = "Lat/Lon:" + tmp.getlatlon();
                    label3.Text  = "Wind Speed:" + tmp.getwindspeed();
                    label4.Text  = "Gust:" + tmp.getgustspeed();
                    label5.Text  = "Wave Height:" + tmp.getwaveheight();
                    label6.Text  = "Wave Direction:" + tmp.getwavedir();
                    label7.Text  = "Wave Period:" + tmp.getdomwave();
                    label8.Text  = "Mean Tide Level:" + tmp.gettide();
                    label9.Text  = "Sea level Pressure:" + tmp.getseapress();
                    label10.Text = "Pressure Change:" + tmp.getpressten();
                    label11.Text = "Sea Temp.:" + tmp.getseatemp();
                    label12.Text = "Air Temp.:" + tmp.getairtemp();
                    label13.Text = "Dew Point:" + tmp.getdewtemp();
                    label14.Text = "Visibility:" + tmp.getvis();
                }
            }

            changeStationPicture(selectedStationName);
        }
예제 #2
0
파일: graphForm.cs 프로젝트: Dyl4n84/DART
        /**
         * This is the function for when the graph button is clicked on the graphingForm
         **/
        private void button1_Click(object sender, EventArgs e)
        {
            chart1.Series[0].Points.Clear();

            List <Buoy> .Enumerator data = Stations.blist.GetEnumerator();
            int stepper = 0;
            int graphSelection;

            graphSelection = comboBox1.SelectedIndex;

            switch (graphSelection)
            {
            //Wind Speed Graph
            case 0:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getwindspeed());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                windSpeedText();
                break;

            //Wind Direction Graph
            case 1:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getwinddirection());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                windDirectionText();
                break;

            //Dominant Wave Period Graph
            case 2:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getdomwave());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                dominantWavePeriodText();
                break;

            //Average Wave Period Graph
            case 3:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getavewave());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                averageWavePeriodText();
                break;

            //Sea Pressure Graph
            case 4:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getseapress());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                seaPressureText();
                break;

            //Air Tempreature Graph
            case 5:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getairtemp());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                airTemperatureText();
                break;

            //Sea Temperature Graph
            case 6:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getseatemp());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                seaTemperatureText();
                break;

            //Dew Temperature Graph
            case 7:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getdewtemp());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                dewTemperatureText();
                break;

            //Visibility Distance Graph
            case 8:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getvis());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                visibilityText();
                break;

            //Tide Height Graph
            case 9:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.gettide());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                tideHeightText();
                break;

            default:
                break;
            }

            //Displays the series value to the chart area
            chart1.Series[0].ChartArea = "ChartArea1";

            //Displays each values buoy name as a corresponding x-axis value
            chart1.ChartAreas[0].AxisX.Interval = 1;

            //Explination for the 0 values in the chart
            textBox1.AppendText(Environment.NewLine + Environment.NewLine
                                + "*For all 0 values in the graph assume the buoy or land station did not take a reading");
        }