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 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; }
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; }
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; }