Beispiel #1
0
        private void CalcAndOutputResults()
        {
            if (!init_)
            {
                return;
            }

            string s = "";

            double d = ClientCommonAPI.CalcTime();

            object_ = GetObject();
            s      += object_.Name + ":" + Environment.NewLine;

            double dec, ra;

            object_.CalcTopoRaDec(d, latitude_, longitude_, out dec, out ra);
            s += "R.A.\t= " + ClientCommonAPI.PrintTime(ra) + " (" + ra.ToString("F5") + "\x00B0)" + Environment.NewLine;
            s += "Dec.\t= " + ClientCommonAPI.PrintAngle(dec, true) + " (" + ClientCommonAPI.PrintDec(dec, "F5") + "\x00B0)" + Environment.NewLine;

            double azm, alt;

            object_.CalcAzimuthal(d, latitude_, longitude_, out azm, out alt);
            s += "Azm.\t= " + ClientCommonAPI.PrintAngle(azm) + " (" + azm.ToString("F5") + "\x00B0)" + Environment.NewLine;
            s += "Alt.\t= " + ClientCommonAPI.PrintAngle(alt) + " (" + alt.ToString("F5") + "\x00B0)" + Environment.NewLine;

            buttonOK.Enabled = (alt > 0);

            textBoxResults.Text = s;
        }
        private void ConnectionForm_Load(object sender, EventArgs e)
        {
            if (nightMode_)
            {
                ClientCommonAPI.EnterNightMode(this);
            }

            int i;

            string[] ports = AAB.UtilityLibrary.SerialConnection.MakeCorrectPortNames(SerialPort.GetPortNames());
            comboBoxSerialPort.Items.Add("Select Port");
            comboBoxSerialPort.Items.AddRange(ports);
            comboBoxSerialPort.Items.Add("Disconnect All");
            if (portName_ != null)
            {
                i = comboBoxSerialPort.Items.IndexOf(portName_);
                comboBoxSerialPort.SelectedIndex = i >= 0 ? i : 0;
            }
            else
            {
                comboBoxSerialPort.SelectedIndex = 0;
            }

            comboBoxBaudRate.Items.AddRange(new object[] { 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200 });
            i = comboBoxBaudRate.Items.IndexOf(baudRate_);
            if (i < 0)
            {
                i = comboBoxBaudRate.Items.IndexOf(9600);
            }
            comboBoxBaudRate.SelectedIndex = i >= 0 ? i : 0;

            checkBoxSwapAzmAlt.Checked = swapAzmAltEncoders_;

            init_ = true;
        }
Beispiel #3
0
        private void buttonAddObject_Click(object sender, EventArgs e)
        {
            if (!init_)
            {
                return;
            }

            double d = ClientCommonAPI.CalcTime();

            SkyObjectPosCalc.SkyPosition obj = GetObject();

            double azm, alt;

            obj.CalcAzimuthal(d, latitude_, longitude_, out azm, out alt);

            try
            {
                DSCAlignment alignmentNew = (DSCAlignment)alignment_.Clone();
                alignmentNew.AddStar(new AlignStar(obj.Name, new Vect3(azm * Const.toRad, alt * Const.toRad), new PairA(host_.AzmAngle, host_.AltAngle), host_.EquAngle));
                alignmentNew.ForceAlignment();
                alignment_ = alignmentNew;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Alignment Error", MessageBoxButtons.OK);
                return;
            }

            AlignmentChanged();
        }
Beispiel #4
0
        private void buttonRevalidate_Click(object sender, EventArgs e)
        {
            if (!alignment_.IsAligned)
            {
                return;
            }
            double d = ClientCommonAPI.CalcTime();

            SkyObjectPosCalc.SkyPosition obj = GetObject();

            double azm, alt;

            obj.CalcAzimuthal(d, latitude_, longitude_, out azm, out alt);

            try
            {
                alignment_.CorrectOffsets(new AlignStar(obj.Name, new Vect3(azm * Const.toRad, alt * Const.toRad), new PairA(host_.AzmAngle, host_.AltAngle), host_.EquAngle));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Correct Alignment Error", MessageBoxButtons.OK);
                return;
            }

            AlignmentChanged();
        }
Beispiel #5
0
        private void ScopeDSCClient_Load(object sender, EventArgs e)
        {
            iInitWidth_       = this.Width;
            iInitHeight_      = this.Height;
            positionFontSize_ = textBoxPosition.Font.Size;
            objectFontSize_   = objectNameLabel.Font.Size;

            latitude_  = settings_.Latitude;
            longitude_ = settings_.Longitude;
            showNearestAzmRotation_     = settings_.ShowNearestAzmRotation;
            connectToStellarium_        = settings_.ConnectToStellarium;
            stellariumTcpPort_          = settings_.TcpPort;
            oppositeHorzPositioningDir_ = settings_.OppositeHorzPositioningDir;

            if (connectToStellarium_)
            {
                OpenStellariumConnection(stellariumTcpPort_);
            }

            // Everything is changed! (Yes, it's redundant.)
            //OptionsOrTimeChanged();
            ConnectionChangedAltAzm();
            ConnectionChangedEqu();
            ConnectionChangedGPS();
            ObjectChanged();
            ScopePosChanged();
            ErrorCntChanged();
            TimeChanged();
            UpdateUI();

            LoadAlignment();
            ClientCommonAPI.BuildObjectDatabase(ref database_);
            ClientCommonAPI.BuildLocationDatabase(ref locations_);
        }
        private void ObjectFromCoordinatesForm_Load(object sender, EventArgs e)
        {
            Location = new Point(0, 0);

            if (nightMode_)
            {
                ClientCommonAPI.EnterNightMode(this);
            }

            ra_hour_ = settings_.ra_hour_;
            dec_     = settings_.dec_;
            epoch_   = settings_.epoch_;

            textBoxRADegWidth_       = textBoxRADeg.Width;
            radioButtonRAHMS.Checked = true;
            SetRAFormat(RADecFormat.HMS, true);

            textBoxDecDegWidth_       = textBoxDecDeg.Width;
            radioButtonDecDMS.Checked = true;
            SetDecFormat(RADecFormat.DMS, true);

            checkBoxJ2000.Checked = (epoch_ == Epoch.J2000);

            timer1.Enabled = true;

            init_ = true;
            ObjectChanged();
        }
        private void CalcRA()
        {
            try
            {
                switch (raFormat_)
                {
                case RADecFormat.HMS:
                case RADecFormat.DMS:
                {
                    double min = Convert.ToDouble(textBoxRAMin.Text);
                    if (min < 0)
                    {
                        min = 0;
                    }
                    else if (min > 59)
                    {
                        min = 59;
                    }

                    double sec = Convert.ToDouble(textBoxRASec.Text);
                    if (sec < 0)
                    {
                        sec = 0;
                    }
                    else if (sec >= 60)
                    {
                        sec = 59.9;
                    }

                    double ra;
                    if (ClientCommonAPI.ParseSignedValue(textBoxRADeg.Text, out ra))
                    {
                        ra += (min + sec / 60.0) / 60.0;
                    }
                    else
                    {
                        ra -= (min + sec / 60.0) / 60.0;
                    }
                    ra_hour_ = SkyObjectPosCalc.Rev((raFormat_ == RADecFormat.HMS) ? ra * 15.0 : ra) / 15.0;
                }
                break;

                case RADecFormat.Degree:
                    ra_hour_ = SkyObjectPosCalc.Rev(Convert.ToDouble(textBoxRADeg.Text)) / 15.0;
                    break;
                }
            }
            catch (System.FormatException)
            {
                ra_hour_ = 0;
            }
            ObjectChanged();
        }
Beispiel #8
0
 private void buttonNightMode_Click(object sender, EventArgs e)
 {
     if (nightMode_)
     {
         ClientCommonAPI.ExitNightMode(this);
         buttonNightMode.Text = "Night &Mode";
         nightMode_           = false;
     }
     else
     {
         ClientCommonAPI.EnterNightMode(this);
         buttonNightMode.Text = "Day &Mode";
         nightMode_           = true;
     }
 }
Beispiel #9
0
        private void CalcAndOutputResults()
        {
            if (!init_)
            {
                return;
            }

            string s = "";

            double d = ClientCommonAPI.CalcTime();

            SkyObjectPosCalc.SkyPosition obj = GetObject();
            s += obj.Name + ":" + Environment.NewLine;

            double dec, ra;

            obj.CalcTopoRaDec(d, latitude_, longitude_, out dec, out ra);
            s += "R.A.\t= " + ClientCommonAPI.PrintTime(ra) + " (" + ra.ToString("F5") + "\x00B0)" + Environment.NewLine;
            s += "Dec.\t= " + ClientCommonAPI.PrintAngle(dec, true) + " (" + ClientCommonAPI.PrintDec(dec, "F5") + "\x00B0)" + Environment.NewLine;

            double azm, alt;

            obj.CalcAzimuthal(d, latitude_, longitude_, out azm, out alt);
            s += "Azm.\t= " + ClientCommonAPI.PrintAngle(azm) + " (" + azm.ToString("F5") + "\x00B0)" + Environment.NewLine;
            s += "Alt.\t= " + ClientCommonAPI.PrintAngle(alt) + " (" + alt.ToString("F5") + "\x00B0)" + Environment.NewLine;
            s += Environment.NewLine;

            buttonAddObject.Enabled        = (alt > 0);
            buttonCorrectPolarAxis.Enabled = ClientCommonAPI.IsEquAxisCorrectionNeeded(latitude_, alignment_);

            if (alignment_.IsAligned)
            {
                s += "Alignment valid";
            }
            else
            {
                s += "Alignment not valid";
            }
            s += Environment.NewLine;
            s += alignment_.ToString(true);

            if (ClientCommonAPI.IsEquAxisCorrectionNeeded(latitude_, alignment_))
            {
                s += Environment.NewLine + ClientCommonAPI.AddEquAxisCorrectionText(latitude_, alignment_);
            }

            textBoxResults.Text = s;
        }
Beispiel #10
0
        private double CalcLocation(TextBox tbD, TextBox tbM, TextBox tbS, bool dms)
        {
            try
            {
                if (dms)
                {
                    double min = Convert.ToDouble(tbM.Text);
                    if (min < 0)
                    {
                        min = 0;
                    }
                    else if (min > 59)
                    {
                        min = 59;
                    }

                    double sec = Convert.ToDouble(tbS.Text);
                    if (sec < 0)
                    {
                        sec = 0;
                    }
                    else if (sec >= 60)
                    {
                        sec = 59.9;
                    }

                    double deg;
                    if (ClientCommonAPI.ParseSignedValue(tbD.Text, out deg))
                    {
                        deg += (min + sec / 60.0) / 60.0;
                    }
                    else
                    {
                        deg -= (min + sec / 60.0) / 60.0;
                    }
                    return(deg);
                }
                else
                {
                    return(Convert.ToDouble(tbD.Text));
                }
            }
            catch (System.FormatException)
            {
                return(0);
            }
        }
Beispiel #11
0
        private void SkyObjectForm_Load(object sender, EventArgs e)
        {
            if (nightMode_)
            {
                ClientCommonAPI.EnterNightMode(this);
            }

            buttonLastObj.Enabled = (lastObjects_.Length != 0 && lastObjects_[0] != null);
            if (stellariumConnection_ == null)
            {
                buttonStellarium.Enabled = false;
            }
            else
            {
                buttonStellarium.Enabled             = stellariumConnection_.IsConnected;
                stellariumConnection_.StatusChanged += StellariumStatusChangedHandlerAsync;
            }

            init_ = true;
            CalcAndOutputResults();
        }
Beispiel #12
0
        private void AlignmentForm_Load(object sender, EventArgs e)
        {
            if (nightMode_)
            {
                ClientCommonAPI.EnterNightMode(this);
            }

            comboBoxType.Items.AddRange(new object[]
            {
                "Solar System Object",
                "Star"
            });
            if (Settings.objTypeIdx_ >= 0 && Settings.objTypeIdx_ < comboBoxType.Items.Count)
            {
                comboBoxType.SelectedIndex = Settings.objTypeIdx_;
            }
            else
            {
                comboBoxType.SelectedIndex = 0;
            }

            FillObjectComboBox();
            if (Settings.objIdx_ >= 0 && Settings.objIdx_ < listBoxObj.Items.Count)
            {
                listBoxObj.SelectedIndex = Settings.objIdx_;
            }
            else
            {
                listBoxObj.SelectedIndex = 0;
            }

            timer1.Enabled = true;

            buttonOK.Enabled            = false;
            buttonSaveAlignment.Enabled = alignment_.IsAligned;

            init_ = true;
            CalcAndOutputResults();
        }
Beispiel #13
0
        private void SetPositionText()
        {
            if (!posTextChanged_)
            {
                return;
            }
            posTextChanged_ = false;

            string s = "";

            if (connectionAltAzm_ == null || connectionEqu_ == null || alignment_ == null || !alignment_.IsAligned || object_ == null)
            {
                s += "--, --";
            }
            else
            {
                double d = ClientCommonAPI.CalcTime();
                double azm, alt;
                object_.CalcAzimuthal(d, latitude_, longitude_, out azm, out alt);
                PairA objScope = alignment_.Horz2Scope(new PairA(azm * Const.toRad, alt * Const.toRad), EquAngle);

                if (!showNearestAzmRotation_)
                {
                    s += ClientCommonAPI.PrintAzmAltDifference(SkyObjectPosCalc.Rev(objScope.Azm * Const.toDeg) - AzmAngle * Const.toDeg, (objScope.Alt - AltAngle) * Const.toDeg, oppositeHorzPositioningDir_);
                }
                else
                {
                    double azmd = SkyObjectPosCalc.Rev(objScope.Azm * Const.toDeg - AzmAngle * Const.toDeg);
                    if (azmd > 180)
                    {
                        azmd -= 360;
                    }
                    s += ClientCommonAPI.PrintAzmAltDifference(azmd, (objScope.Alt - AltAngle) * Const.toDeg, oppositeHorzPositioningDir_);
                }
            }

            textBoxPosition.Text = s;
        }
        private void ObjectLastSelectionForm_Load(object sender, EventArgs e)
        {
            if (nightMode_)
            {
                ClientCommonAPI.EnterNightMode(this);
            }

            if (lastObjects_.Length == 0)
            {
                buttonOK.Enabled = false;
            }
            else
            {
                foreach (var obj in lastObjects_)
                {
                    if (obj != null)
                    {
                        listBoxLastObjs.Items.Add(obj.Name);
                    }
                }

                if (listBoxLastObjs.Items.Count <= 0)
                {
                    buttonOK.Enabled = false;
                }
                else
                {
                    listBoxLastObjs.SelectedIndex = 0;
                    object_          = lastObjects_[0];
                    buttonOK.Enabled = true;
                }
            }

            timer1.Enabled = true;

            init_ = true;
            ObjectChanged();
        }
Beispiel #15
0
        private void ObjectFromListForm_Load(object sender, EventArgs e)
        {
            if (nightMode_)
            {
                ClientCommonAPI.EnterNightMode(this);
            }

            foreach (var entry in database_)
            {
                comboBoxType.Items.Add(entry.name_);
            }

            if (settings_.objTypeIdx_ >= 0 && settings_.objTypeIdx_ < comboBoxType.Items.Count)
            {
                comboBoxType.SelectedIndex = settings_.objTypeIdx_;
            }
            else
            {
                comboBoxType.SelectedIndex = 0;
            }

            FillObjectListBox();
            if (settings_.objIdx_ >= 0 && settings_.objIdx_ < listBoxObj.Items.Count)
            {
                listBoxObj.SelectedIndex = settings_.objIdx_;
            }
            else
            {
                listBoxObj.SelectedIndex = 0;
            }

            timer1.Enabled = true;

            init_ = true;
            CalcAndOutputResults();
        }
        private void CalcDec()
        {
            try
            {
                switch (decFormat_)
                {
                case RADecFormat.HMS:
                case RADecFormat.DMS:
                {
                    double min = Convert.ToDouble(textBoxDecMin.Text);
                    if (min < 0)
                    {
                        min = 0;
                    }
                    else if (min > 59)
                    {
                        min = 59;
                    }

                    double sec = Convert.ToDouble(textBoxDecSec.Text);
                    if (sec < 0)
                    {
                        sec = 0;
                    }
                    else if (sec >= 60)
                    {
                        sec = 59.9;
                    }

                    double dec;
                    if (ClientCommonAPI.ParseSignedValue(textBoxDecDeg.Text, out dec))
                    {
                        dec += (min + sec / 60.0) / 60.0;
                    }
                    else
                    {
                        dec -= (min + sec / 60.0) / 60.0;
                    }
                    dec_ = dec;
                }
                break;

                case RADecFormat.Degree:
                    dec_ = Convert.ToDouble(textBoxDecDeg.Text);
                    break;
                }
                if (dec_ < -90)
                {
                    dec_ = -90;
                }
                else if (dec_ > 90)
                {
                    dec_ = 90;
                }
            }
            catch (System.FormatException)
            {
                dec_ = 0;
            }
            ObjectChanged();
        }
Beispiel #17
0
        private void OptionsForm_Load(object sender, EventArgs e)
        {
            Location = new Point(0, 0);

            if (nightMode_)
            {
                ClientCommonAPI.EnterNightMode(this);
            }

            textBoxLatDegWidth_ = textBoxLatDeg.Width;
            textBoxLonDegWidth_ = textBoxLonDeg.Width;

            comboBoxLocation.Items.Add("Enter Coordinates");
            int idx = 0;

            for (int i = 0; i < locations_.Count; ++i)
            {
                //comboBoxLocation.Items.Add(locations_[i].name_ + " (" + locations_[i].latitude_ + "," + locations_[i].longitude_ + ")");
                comboBoxLocation.Items.Add(locations_[i].name_ + " (" + ClientCommonAPI.PrintAngle(locations_[i].latitude_) + ", " + ClientCommonAPI.PrintAngle(locations_[i].longitude_) + ")");
                if (idx == 0 && Latitude == locations_[i].latitude_ && Longitude == locations_[i].longitude_)
                {
                    idx = i + 1;
                }
            }
            comboBoxLocation.SelectedIndex = idx;
            EnableLocationCtrls(idx == 0);

            radioButtonDMS.Checked = (locFmt_ == LocFormat.DMS);
            SetLocationText();

            checkBoxShowNearestAzmRotation.Checked   = ShowNearestAzmRotation;
            checkBoxConnectToStellarium.Checked      = ConnectToStellarium;
            labelStellariumTcpPort.Enabled           = ConnectToStellarium;
            textBoxStellariumTCPPort.Enabled         = ConnectToStellarium;
            textBoxStellariumTCPPort.Text            = StellariumTcpPort.ToString();
            checkBoxOppHorzPositionDirection.Checked = OppositeHorzPositioningDir;

            switch (AutoTrack)
            {
            default:
            case ClientCommonAPI.AutoTrack.DISABLED:
                checkBoxAutoTrack.Visible = checkBoxAutoTrack.Enabled = false;
                break;

            case ClientCommonAPI.AutoTrack.ON:
                checkBoxAutoTrack.Checked = true;
                break;

            case ClientCommonAPI.AutoTrack.OFF:
                checkBoxAutoTrack.Checked = false;
                break;
            }

#if LOGGING_ON
            comboBoxLoggingType0.Items.Add("M POS");
            comboBoxLoggingType0.Items.Add("M LOG");
            comboBoxLoggingType0.Items.Add("M SPD");
            comboBoxLoggingType0.Items.Add("M ERR");
            comboBoxLoggingType0.Items.Add("A POS");
            comboBoxLoggingType0.Items.Add("A LOG");
            comboBoxLoggingType0.Items.Add("A SPD");
            comboBoxLoggingType0.Items.Add("A ERR");

            comboBoxLoggingType1.Items.Add("M POS");
            comboBoxLoggingType1.Items.Add("M LOG");
            comboBoxLoggingType1.Items.Add("M SPD");
            comboBoxLoggingType1.Items.Add("M ERR");
            comboBoxLoggingType1.Items.Add("A POS");
            comboBoxLoggingType1.Items.Add("A LOG");
            comboBoxLoggingType1.Items.Add("A SPD");
            comboBoxLoggingType1.Items.Add("A ERR");
            switch (LoggingState)
            {
            case ClientCommonAPI.LoggingState.OFF:
                checkBoxLogging.Checked            = false;
                checkBoxLoggingAZM.Checked         = LoggingChannel == ClientCommonAPI.LoggingChannel.AZM;
                comboBoxLoggingType0.SelectedIndex = (int)LoggingType0;
                comboBoxLoggingType1.SelectedIndex = (int)LoggingType1;
                break;

            case ClientCommonAPI.LoggingState.ON:
                checkBoxLogging.Checked            = true;
                checkBoxLoggingAZM.Checked         = LoggingChannel == ClientCommonAPI.LoggingChannel.AZM;
                comboBoxLoggingType0.SelectedIndex = (int)LoggingType0;
                comboBoxLoggingType1.SelectedIndex = (int)LoggingType1;
                break;

            default:
                checkBoxLogging.Visible      = false;
                buttonSaveLog.Visible        = false;
                checkBoxLoggingAZM.Visible   = false;
                comboBoxLoggingType0.Visible = false;
                comboBoxLoggingType1.Visible = false;
                break;
            }
#else
            checkBoxLogging.Visible      = false;
            buttonSaveLog.Visible        = false;
            checkBoxLoggingAZM.Visible   = false;
            comboBoxLoggingType0.Visible = false;
            comboBoxLoggingType1.Visible = false;
#endif

            string hostConfigurationName = host_.GetConfigurationName;
            if (hostConfigurationName == null)
            {
                buttonHostConfig.Enabled = false;
                buttonHostConfig.Visible = false;
            }
            else
            {
                buttonHostConfig.Text = hostConfigurationName;
            }
            init_ = true;
        }
Beispiel #18
0
        private void SetScopePositionAndObjectText(bool sendPositionToStellarium)
        {
            if (!scopePosAndObjTextChanged_ && !sendPositionToStellarium)
            {
                return;
            }
            scopePosAndObjTextChanged_ = false;

            double d = ClientCommonAPI.CalcTime();

            string s = "";

            if (connectionAltAzm_ == null)
            {
                s += "Encoder Abs Positions Unknown" + Environment.NewLine;
            }
            else
            {
                s += "Encoder Abs Positions: Azm = " + ClientCommonAPI.PrintAngle(AzmAngle * Const.toDeg, false, false) + ", Alt = " + ClientCommonAPI.PrintAngle(AltAngle * Const.toDeg, false, false) + Environment.NewLine;
                s += "ErrCnt = " + errorCnt_ + Environment.NewLine;
            }

            if (connectionEqu_ == null)
            {
                s += "Equ Angle Unknown" + Environment.NewLine;
            }
            else
            {
                s += "Equ Angle = " + ClientCommonAPI.PrintAngle(EquAngle * Const.toDeg) + Environment.NewLine;
            }

            s += Environment.NewLine;
            if (connectionAltAzm_ == null || connectionEqu_ == null)
            {
                s += "Scope Position Unknown";
            }
            else if (alignment_ != null && alignment_.IsAligned)
            {
                PairA horz = alignment_.Scope2Horz(new PairA(AzmAngle, AltAngle), EquAngle);

                s += "Scope Position: Azm = " + ClientCommonAPI.PrintAngle(SkyObjectPosCalc.Rev(horz.Azm * Const.toDeg), false, false);
                s += ", Alt = " + ClientCommonAPI.PrintAngle(SkyObjectPosCalc.Rev(horz.Alt * Const.toDeg), false, false) + Environment.NewLine;

                double dec, ra;
                SkyObjectPosCalc.AzAlt2Equ(d, latitude_, longitude_, SkyObjectPosCalc.Rev(horz.Azm * Const.toDeg), SkyObjectPosCalc.Rev(horz.Alt * Const.toDeg), out dec, out ra);
                s += "R.A.\t= " + ClientCommonAPI.PrintTime(ra) + " (" + ra.ToString("F5") + "\x00B0)" + Environment.NewLine;
                s += "Dec.\t= " + ClientCommonAPI.PrintAngle(dec, true) + " (" + ClientCommonAPI.PrintDec(dec, "F5") + "\x00B0)" + Environment.NewLine;

                if (sendPositionToStellarium && stellariumConnection_ != null && stellariumConnection_.IsConnected)
                {
                    stellariumConnection_.SendPosition(dec, ra);
                }
            }

            s += Environment.NewLine;
            if (object_ == null)
            {
                s += "No Object Selected";
            }
            else
            {
                double azm, alt;
                object_.CalcAzimuthal(d, latitude_, longitude_, out azm, out alt);
                s += object_.Name + ": Azm = " + ClientCommonAPI.PrintAngle(azm, false, false);
                s += ", Alt = " + ClientCommonAPI.PrintAngle(alt, false, false) + Environment.NewLine;

                double dec, ra;
                object_.CalcTopoRaDec(d, latitude_, longitude_, out dec, out ra);
                s += "R.A.\t= " + ClientCommonAPI.PrintTime(ra) + " (" + ra.ToString("F5") + "\x00B0)" + Environment.NewLine;
                s += "Dec.\t= " + ClientCommonAPI.PrintAngle(dec, true) + " (" + ClientCommonAPI.PrintDec(dec, "F5") + "\x00B0)" + Environment.NewLine;

                /*
                 * double azm, alt;
                 * object_.CalcAzimuthal(d, latitude_, longitude_, out azm, out alt);
                 * s += "Azm.\t= " + ScopeDSCClient.PrintAngle(azm) + " (" + azm.ToString("F5") + "\x00B0)" + Environment.NewLine;
                 * s += "Alt.\t= " + ScopeDSCClient.PrintAngle(alt) + " (" + alt.ToString("F5") + "\x00B0)";
                 * */
            }

            textBoxObject.Text = s;
        }
Beispiel #19
0
        private void SetConnectionAndAlignmentText()
        {
            if (!connectionAndAlignTextChanged_)
            {
                return;
            }
            connectionAndAlignTextChanged_ = false;

            string s = "";

            if (connectionAltAzm_ == null)
            {
                s += "Alt-Azm not Connected";
            }
            else
            {
                s += "Alt-Azm Connected to " + connectionAltAzm_.connection_.PortName + " at " + connectionAltAzm_.connection_.BaudRate;
            }
            s += Environment.NewLine;

            if (connectionEqu_ == null)
            {
                s += "Equ not Connected";
            }
            else
            {
                s += "Equ Connected to " + connectionEqu_.connection_.PortName + " at " + connectionEqu_.connection_.BaudRate;
            }
            s += Environment.NewLine;

            if (connectionGPS_ == null)
            {
                s += "GPS not Connected";
            }
            else
            {
                s += "GPS Connected to " + connectionGPS_.connection_.PortName + " at " + connectionGPS_.connection_.BaudRate;
            }
            s += Environment.NewLine;

            if (alignment_ == null)
            {
                s += "Not Aligned";
            }
            else
            {
                if (alignment_.IsAligned)
                {
                    s += "Alignment valid";
                }
                else
                {
                    s += "Alignment not valid";
                }
                s += Environment.NewLine;
                s += alignment_.ToString();
                if (ClientCommonAPI.IsEquAxisCorrectionNeeded(latitude_, alignment_))
                {
                    s += Environment.NewLine;
                    s += ClientCommonAPI.AddEquAxisCorrectionText(latitude_, alignment_);
                }
            }

            textBoxAlignment.Text = s;
        }