/// <summary> /// 导出功能 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Export_Click(object sender, EventArgs e) { try { this.btn_Export.Enabled = false; GetCitSourceCheckFileList(); GetChannelNames(); if (channelNameList.Count == 0) { MessageBox.Show("请选择至少一个通道"); return; } string startMile = this.txtStartMile.Text.Trim(); string endMile = this.txtEndMile.Text.Trim(); for (int j = 0; j < citSourceCheckFileList.Count; j++) { dataList.Clear(); for (int i = 0; i < channelNameList.Count; i++) { if (!String.IsNullOrEmpty(startMile) && !String.IsNullOrEmpty(endMile) && Convert.ToDouble(endMile) > Convert.ToDouble(startMile)) { double[] d = citHelper.GetSingleChannelData(citSourceCheckFileList[j], channelNameList[i].sNameEn, Convert.ToDouble(startMile), Convert.ToDouble(endMile)); dataList.Add(d); } else { double[] d = citHelper.GetSingleChannelData(citSourceCheckFileList[j], citHelper.GetChannelId(channelNameList[i].sNameEn, citSourceCheckFileList[j])); dataList.Add(d); } } //使用中文名称 if (ckb_Chinese.Checked) { if (ckb_sameNameWithCit.Checked) { ExportDataTxt(true, citSourceCheckFileList[j].Replace(".cit", ".txt")); } else { ExportDataTxt(true, citSourceCheckFileNameList[j], citSourceCheckFileList[j]); } } else { if (ckb_sameNameWithCit.Checked) { ExportDataTxt(true, citSourceCheckFileList[j].Replace(".cit", ".txt")); } else { ExportDataTxt(false, citSourceCheckFileNameList[j], citSourceCheckFileList[j]); } } } MessageBox.Show("数据导出完成"); this.btn_Export.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public List <PowerSpectrum> GetResult(string filePath, string channelName, double kmStart, double kmEnd, double Nlen, double dt) { long startPos = 0; long endPos = 0; long pos1 = citHelper.GetCurrentPosition(filePath, Convert.ToSingle(kmStart) * 1000); long pos2 = citHelper.GetCurrentPosition(filePath, Convert.ToSingle(kmEnd) * 1000); if (pos1 > pos2) { startPos = pos2; endPos = pos1; } else { startPos = pos1; endPos = pos2; } double[] d_tt = citHelper.GetMilesData(filePath, startPos, endPos); int channelId = citHelper.GetChannelId(channelName, filePath); double[] d_wx = citHelper.GetSingleChannelData(filePath, channelId, startPos, endPos); #region 注释 //int indexStart = 0; //int indexEnd = d_tt.Length - 1; //if (d_tt[0] < d_tt[d_tt.Length - 1]) //{ // //增里程 // for (int i = 0; i < d_tt.Length; i++) // { // if (d_tt[i] >= kmStart) // { // indexStart = i; // break; // } // } // for (int i = 0; i < d_tt.Length; i++) // { // if (d_tt[i] >= kmEnd) // { // indexEnd = i; // break; // } // } //} //else //{ // //减里程 // for (int i = 0; i < d_tt.Length; i++) // { // if (d_tt[i] <= kmStart) // { // indexStart = i; // break; // } // } // for (int i = 0; i < d_tt.Length; i++) // { // if (d_tt[i] <= kmEnd) // { // indexEnd = i; // break; // } // } //} //int len = indexEnd - indexStart + 1; //double[] tt_new = new double[len]; //double[] wx_new = new double[len]; //Array.Copy(d_tt, indexStart, tt_new, 0, len); //Array.Copy(d_wx, indexStart, wx_new, 0, len); #endregion var list = Sub_Fourier_analysis(channelName, d_tt, d_wx, Nlen, dt); return(list); }