private void textBoxTilt_TextChanged(object sender, EventArgs e) { textBox_TextChanged(new object(), new EventArgs()); try { textBoxAngleBetween12.Text = (FindZoneAxis.GetAngleBetweenHolders(photo1.Tilt1, photo1.Tilt2, photo2.Tilt1, photo2.Tilt2) / Math.PI * 180).ToString("f3"); textBoxAngleBetween23.Text = (FindZoneAxis.GetAngleBetweenHolders(photo2.Tilt1, photo2.Tilt2, photo3.Tilt1, photo3.Tilt2) / Math.PI * 180).ToString("f3"); textBoxAngleBetween31.Text = (FindZoneAxis.GetAngleBetweenHolders(photo3.Tilt1, photo3.Tilt2, photo1.Tilt1, photo1.Tilt2) / Math.PI * 180).ToString("f3"); } catch { } }
private void buttonSearch_Click(object sender, EventArgs e) { if (formMain.Crystal == null || formMain.Crystal.A * formMain.Crystal.B * formMain.Crystal.C == 0) { return; } List <ZoneAxis> za = new List <ZoneAxis>(); PhotoInformation photo; if (((Button)sender).Name == "buttonSearchPhoto1" && photo1.Paintable) { photo = photo1; } else if (((Button)sender).Name == "buttonSearchPhoto2" && photo2.Paintable) { photo = photo2; } else if (((Button)sender).Name == "buttonSearchPhoto3" && photo3.Paintable) { photo = photo3; } else { return; } for (int i = 0; i < formMain.Crystals.Length; i++) { za.AddRange(FindZoneAxis.GetZoneAxis(formMain.Crystals[i], photo, true)); } if (za.Count > 1000) { MessageBox.Show("Number of candidates are over 1000. Set more limeted conditions."); } else if (za.Count > 0) { if (formTEMIDResults != null) { formTEMIDResults.Close(); } formTEMIDResults = new FormTEMIDResults(this); formTEMIDResults.Show(); formTEMIDResults.SetDataSet(photo, za); } else { MessageBox.Show("No candidate is found"); } }
private void buttonSearchAll_Click(object sender, EventArgs e) { textBox_TextChanged(new object(), new EventArgs()); //photo3が選択されているかどうかで分岐 List <ZoneAxes> candidate = new List <ZoneAxes>(); if (!checkBoxPhoto3.Checked) {//1,2だけ選択されている場合 for (int i = 0; i < formMain.Crystals.Length; i++) { candidate.AddRange(FindZoneAxis.ZoneAxisFromTwoZoneAxis(formMain.Crystals[i], photo1, photo2, true)); } } else {//1,2,3が選択されている場合 for (int i = 0; i < formMain.Crystals.Length; i++) { candidate.AddRange(FindZoneAxis.ZoneAxisFromThreeZoneAxis(formMain.Crystals[i], photo1, photo2, photo3, true)); } } if (candidate.Count > 1000) { MessageBox.Show("Number of candidates are over 1000. Set more limeted conditions."); } else if (candidate.Count > 0) { double[] obsAngle = new double[] { FindZoneAxis.GetAngleBetweenHolders(photo1.Tilt1, photo1.Tilt2, photo2.Tilt1, photo2.Tilt2), FindZoneAxis.GetAngleBetweenHolders(photo2.Tilt1, photo2.Tilt2, photo3.Tilt1, photo3.Tilt2), FindZoneAxis.GetAngleBetweenHolders(photo3.Tilt1, photo3.Tilt2, photo1.Tilt1, photo1.Tilt2) }; if (formTEMIDResults != null) { formTEMIDResults.Close(); } formTEMIDResults = new FormTEMIDResults(this); formTEMIDResults.Show(); formTEMIDResults.SetDataSet(obsAngle, candidate); } else { MessageBox.Show("No candidate is found"); } }