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 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(); }
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(); }
private void ObjectChanged() { settings_.ra_hour_ = ra_hour_; settings_.dec_ = dec_; settings_.epoch_ = epoch_; object_ = new SkyObjectPosCalc.StarPosition("Unknown", ra_hour_, dec_, epoch_ == Epoch.J2000); CalcAndOutputResults(); }
private void listBoxLastObjs_SelectedIndexChanged(object sender, EventArgs e) { if (!init_ || listBoxLastObjs.SelectedIndex >= lastObjects_.Length) { return; } object_ = lastObjects_[listBoxLastObjs.SelectedIndex]; ObjectChanged(); }
private void buttonStellarium_Click(object sender, EventArgs e) { if (stellariumConnection_ != null && stellariumConnection_.IsConnected) { object_ = null; useStellarium_ = true; DialogResult = DialogResult.OK; } }
private void buttonLastObj_Click(object sender, EventArgs e) { ObjectLastSelectionForm form = new ObjectLastSelectionForm(nightMode_, latitude_, longitude_, lastObjects_); if (form.ShowDialog() == DialogResult.OK) { object_ = form.Object; DialogResult = DialogResult.OK; } }
private void buttonByCoordinates_Click(object sender, EventArgs e) { ObjectFromCoordinatesForm form = new ObjectFromCoordinatesForm(nightMode_, latitude_, longitude_, settings_.objCoordSettings_); if (form.ShowDialog() == DialogResult.OK) { object_ = form.Object; settings_.objCoordSettings_ = form.Settings; DialogResult = DialogResult.OK; } }
private void buttonFromList_Click(object sender, EventArgs e) { ObjectFromListForm form = new ObjectFromListForm(nightMode_, latitude_, longitude_, database_, settings_.objListLastSettings_); if (form.ShowDialog() == DialogResult.OK) { object_ = form.Object; settings_.objListLastSettings_ = form.Settings; DialogResult = DialogResult.OK; } }
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 buttonSelectObject_Click(object sender, EventArgs e) { SkyObjectForm form = new SkyObjectForm(new ClientHost(this), database_, stellariumConnection_, lastObjects_, lastObjSettings_); if (form.ShowDialog() != DialogResult.OK) { return; } object_ = form.UseStellarium ? stellariumObj_ : form.Object; if (object_ != null) { AddLastObject(object_); } lastObjSettings_ = form.Settings; ObjectChanged(); UpdateUI(); }
private void AddLastObject(SkyObjectPosCalc.SkyPosition obj) { for (int i = lastObjects_.Length; --i >= 0;) { if (lastObjects_[i] != null && obj.Name == lastObjects_[i].Name) { // move to first position lastObjects_[i] = lastObjects_[0]; lastObjects_[0] = obj; return; } } for (int i = lastObjects_.Length; --i >= 1;) { lastObjects_[i] = lastObjects_[i - 1]; } lastObjects_[0] = obj; }
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(); }
private void buttonUnselect_Click(object sender, EventArgs e) { object_ = null; useStellarium_ = false; DialogResult = DialogResult.OK; }