コード例 #1
0
        private void SunPos()
        {
            var position = New_Formula.CalculateSunPosition(DateTime.Now, -25.681768, 28.130103);

            //double RAH = position.Altitude;
            //RAH = RAH / 24;
            //double RAM = position.Altitude - RAH / 60;
            //double RAS = position.Altitude - RAH - RAM / 60;
            //string RA = RAH.ToString() + "h" + RAM.ToString() + "m" + RAS + "s";
            //txtboxRAS.Text = RA;
            //StringBuilder sb = new StringBuilder();
            //sb.AppendLine(position.Altitude.ToString());
            //DataTable dt = new DataTable();
            //dt.Columns.Add("Right Ascension");
            //dt.Rows.Add(sb);
            //dgvSun.DataSource = dt;
            if (position.Altitude < 0)
            {
                double alt = -(position.Altitude) + 2;
                txtboxRAS.Text = alt.ToString();
            }
            else
            {
                txtboxRAS.Text = position.Altitude.ToString();
            }
            if (position.Azimuth > 90)
            {
                double alt = position.Altitude - 90;
                txtboxAzimuthS.Text = alt.ToString();
            }
            else
            if (position.Azimuth < 0)
            {
                double alt = position.Altitude + 90;
                txtboxAzimuthS.Text = alt.ToString();
            }
            else
            {
                txtboxAzimuthS.Text = position.Azimuth.ToString();
            }

            //Senddata s = new Senddata(Convert.ToDouble(txtboxAzimuthS.Text), Convert.ToDouble(txtboxRAS.Text));
            //s.SendVec();
            float azimuthval = float.Parse(txtboxAzimuthS.Text);

            if (float.Parse(txtboxAzimuthS.Text) < 0)
            {
                azimuthval = float.Parse(txtboxAzimuthS.Text.Substring(1));
            }
            Serializer s = new Serializer(float.Parse(txtboxRAS.Text), azimuthval);

            p.WriteLine(s.SendJson());
        }
コード例 #2
0
        private void SunPos()
        {
            //var position = new Math_Formulae(DateTime.Now);
            //txtboxAzimuthS = position.ToString();
            var position = New_Formula.CalculateSunPosition(DateTime.Now, -25.684044, 28.131091);

            //double RAH = position.Altitude;
            //RAH = RAH / 24;
            //double RAM = position.Altitude - RAH / 60;
            //double RAS = position.Altitude - RAH - RAM / 60;
            //string RA = RAH.ToString() + "h" + RAM.ToString() + "m" + RAS + "s";
            //txtboxRAS.Text = RA;
            //StringBuilder sb = new StringBuilder();
            //sb.AppendLine(position.Altitude.ToString());
            //DataTable dt = new DataTable();
            //dt.Columns.Add("Right Ascension");
            //dt.Rows.Add(sb);
            //dgvSun.DataSource = dt;

            txtboxAzimuthS.Text = position.Azimuth.ToString();
            txtboxRAS.Text      = position.Altitude.ToString();

            if (position.Altitude < 0)
            {
                double alt = -(position.Altitude) + 2;
                txtboxRAS.Text = alt.ToString();
            }
            else
            {
                txtboxRAS.Text = position.Altitude.ToString();
            }
            if (position.Azimuth > 90)
            {
                double alt = position.Altitude - 90;
                txtboxAzimuthS.Text = alt.ToString();
            }
            else
            if (position.Azimuth < 0)
            {
                double alt = position.Altitude + 90;
                txtboxAzimuthS.Text = alt.ToString();
            }
            else
            {
                txtboxAzimuthS.Text = position.Azimuth.ToString();
            }
        }