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