bool SetupMarkers()//(bool force) { if (LastLinks == null) { return(false); } int pos = tbLinks.SelectionStart; int line_num = 1; for (int i = 0; i <= pos && i < tbLinks.Text.Length; i++) { if (tbLinks.Text[i] == '\n') { line_num++; } } LastLinePos = line_num; SelectedMarker = -1; if (ColGr == null) { ColGr = new Color[256]; for (int i = 0; i < 256; i++) { ColGr[i] = Color.FromArgb(i, 0, 0); } /*for (int i = 0; i < 256; i++) * ColGr[i+256] = Color.FromArgb(255, 255-i, 0);*/ } SpView.ClearAnalitMarkers(); for (int i = 0; i < LastLinks.Count; i++) { string tmp = Math.Round(LastLinks[i].Ly, 2).ToString() + "-" + Math.Round(LastLinks[i].Pixel, 1); if (Math.Abs(LastLinks[i].Dlt) > 0.1) { tmp += " " + Math.Round(LastLinks[i].Dlt, 2); } SpView.AddAnalitMarker(LastLinks[i].Ly, tmp, DlgToColor(LastLinks[i].Dlt), LastLinks[i].SrcLine == line_num); if (LastLinks[i].SrcLine == line_num) { SelectedMarker = i; } } int sn = -1; if (LastLinks.Count > 0 && SelectedMarker >= 0 && SelectedMarker < LastLinks.Count) { sn = LastLinks[SelectedMarker].Sn; } SpView.SetupDispersToPaint(Disp, sn); return(true); }
private void btNSpLyToText_Click(object sender, EventArgs e) { try { RestoreBeforeSelectLine(); float x, y; List <float> pix; List <int> sn; SpView.GetCursorPosition(out x, out y, out pix, out sn); LineDbRecord lr = SpView.SelSpLine; if (lr == null) { MessageBox.Show(MainForm.MForm, Common.MLS.Get(MLSConst, "Нет выбранной спектральной линии"), //"No selected spectr line"), Common.MLS.Get(MLSConst, "Проблема"), //"Problem"), MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } InsertText(Math.Round(pix[0], 1) + "-" + Math.Round(lr.Ly, 2) + " #" + lr.ElementName + " " + lr.IonLevel); RestoreBeforeSelectLine(); } catch (Exception ex) { Common.Log(ex); } }
private void cbTestList_SelectedIndexChanged(object sender, EventArgs e) { try { int test = cbTestList.SelectedIndex; if (test < 0) { return; } string tmp = Tests[test].Results(); if (tmp == null) { tmp = Common.MLS.Get(MLSConst, "Нет данных"); } tbTestResult.Text = tmp; string[] names; int view_type; Spectr[] sp = Tests[test].GetSpectrResults(out names, out view_type); SpView.DefaultViewType = view_type; SpView.ClearSpectrList(); if (sp != null) { for (int i = 0; i < sp.Length; i++) { SpView.AddSpectr(sp[i], names[i]); } } SpView.ShowAll(); //SpView.ReDraw(); } catch (Exception ex) { Common.Log(ex); } }
private void btCursorLyToText_Click(object sender, EventArgs e) { try { RestoreBeforeSelectLine(); float x, y; List <float> pix; List <int> sn; SpView.GetCursorPosition(out x, out y, out pix, out sn); InsertText(Math.Round(x, 2).ToString()); RestoreBeforeSelectLine(); } catch (Exception ex) { Common.Log(ex); } }
private void btCursorNToText2_Click(object sender, EventArgs e) { try { RestoreBeforeSelectLine(); float x, y; List <float> pix; List <int> sn; SpView.GetCursorPosition(out x, out y, out pix, out sn); if (pix.Count > 1) { InsertText(Math.Round(pix[1], 1).ToString() + "-"); } RestoreBeforeSelectLine(); } catch (Exception ex) { Common.Log(ex); } }
void ApplyDispersDelProc()//Dispers disp) { bool result; LastLinks = Disp.Compile(tbLinks.Text, true, out result); if (result == false) { ApplyDispResult = -1; return; } /*ulong hash = 0; * for (int i = 0; i < LastLinks.Count; i++) * hash += LastLinks[i].CalcHash(); * * if (hash == LastLineHash) * { * SetupMarkers(); * Control.SelectSpectr(); * ApplyDispResult = -1; * return; * }*/ //LastLineHash = hash; string[] names = Folder.GetRecordList("ss"); for (int i = 0; i < names.Length; i++) { Spectr sp = new Spectr(Folder, names[i]); sp.SetDispers(Disp);//disp); sp.Save(); } Control.SelectSpectr(); SetupMarkers();//true); //CheckSelection(); SpView.ReDraw(); ApplyDispResult = 1; return; }
private void mmLoadLinks4_Click(object sender, EventArgs e) { LoadLinks(4, SpView.GetSpectr(0).GetCommonDispers()); }
private void btCycleMeasuring_ThreadTech() { bool prev_gen = IsGenOn, prev_fl = IsFillLightOn; Spectr sp = Control.GetSelectedSpectrCT(); if (sp == null) { return; } SpectrConditionCompiledLine con = null; SpectrCondition cond = CCond;//sp.GetMeasuringCondition(); int sp_index = 0; for (int i = 0; i < cond.Lines.Count; i++) { if (cond.Lines[i].Type == SpectrCondition.CondTypes.Exposition && cond.Lines[i].IsActive) { con = cond.Lines[i]; sp_index = con.SpectrViewIndex; break; } } if (con == null) { return; } Common.Dev.CheckConnection(); Common.Dev.BeforeMeasuring(); sp.SetDispers(Common.Env.DefaultDisp); sp.OFk = Common.Env.DefaultOpticFk; int common_time_i; int[] exps_i; Common.Dev.CorrectExposition(con, out common_time_i, out exps_i); short[][] bb, be; while (CycleThread != null && Common.IsRunning) { try { short[][] datas = Common.Dev.Reg.RegFrame(common_time_i, exps_i, out bb, out be); float[][] data = new float[datas.Length][]; for (int s = 0; s < datas.Length; s++) { int size = datas[s].Length; data[s] = new float[size]; for (int j = 0; j < size; j++) { data[s][j] = datas[s][j]; } } SpectrDataView cur_spview = new SpectrDataView(new SpectrCondition(Common.Dev.Tick, con), data, bb, be, Common.Dev.Reg.GetMaxValue(), Common.Dev.Reg.GetMaxLinarValue()); sp.Set(cur_spview, sp_index); SpView.ReLoadSpectr(sp, 0); SpView.ReDraw(); if (prev_fl != IsFillLightOn) { prev_fl = IsFillLightOn; Common.Dev.Fill.SetFillLight(chbFillLight.Checked); } if (prev_gen != IsGenOn) { prev_gen = IsGenOn; Common.Dev.Gen.SetStatus(chbGenOn.Checked); } Thread.Sleep(500); } catch (Exception ex) { Common.Log(ex); break; } } sp.Save(); }