private void SetCurDataByIndex() { foreach (object obj in m_ayLists) { Data_Info pData = (Data_Info)obj; string strData_x = "0"; string strData_y = "0"; string strData_z = "0"; if (m_nCurIndex < pData.m_ayXData.Count) { m_ZedGraph.AddGraphicsData(1, pData.m_strName, (double)pData.m_ayXData[m_nCurIndex], m_nCurGraphicType); strData_x = pData.m_ayXData[m_nCurIndex].ToString(); } if (m_nCurIndex < pData.m_ayYData.Count) { m_ZedGraph.AddGraphicsData(2, pData.m_strName, (double)pData.m_ayYData[m_nCurIndex], m_nCurGraphicType); strData_y = pData.m_ayYData[m_nCurIndex].ToString(); } if (m_nCurIndex < pData.m_ayZData.Count) { m_ZedGraph.AddGraphicsData(3, pData.m_strName, (double)pData.m_ayZData[m_nCurIndex], m_nCurGraphicType); strData_z = pData.m_ayZData[m_nCurIndex].ToString(); } //将数据发下去 string CurData = strData_x + "," + strData_y + "," + strData_z; m_MainWindows.WriteDataToShareMemory(CurData, CurData.Length); ShowNotifyInfo(); } }
private void SetCurDataByIndex() { foreach (object obj in m_ayLists) { Data_Info pData = (Data_Info)obj; string strData_x = "0"; string strData_y = "0"; string strData_z = "0"; double dX = 0.0; double dY = 0.0; double dZ = 0.0; int nIndex = 0; if (m_nCurIndex < pData.m_ayXData.Count) { dX = (double)pData.m_ayXData[m_nCurIndex]; m_wndGraphic.AddGraphicsData(1, pData.m_strName, (double)pData.m_ayXData[m_nCurIndex], m_nCurGraphicType); ++nIndex; strData_x = pData.m_ayXData[m_nCurIndex].ToString(); } if (m_nCurIndex < pData.m_ayYData.Count) { dY = (double)pData.m_ayYData[m_nCurIndex]; m_wndGraphic.AddGraphicsData(2, pData.m_strName, (double)pData.m_ayYData[m_nCurIndex], m_nCurGraphicType); ++nIndex; strData_y = pData.m_ayYData[m_nCurIndex].ToString(); } if (m_nCurIndex < pData.m_ayZData.Count) { dZ = (double)pData.m_ayZData[m_nCurIndex]; m_wndGraphic.AddGraphicsData(3, pData.m_strName, (double)pData.m_ayZData[m_nCurIndex], m_nCurGraphicType); ++nIndex; strData_z = pData.m_ayZData[m_nCurIndex].ToString(); } if (m_nDataType == 3 && nIndex == 3 && null != m_WndAnalysis) { double dValue = Math.Sqrt(Math.Pow(dX, 2.0) + Math.Pow(dY, 2.0) + Math.Pow(dZ, 2.0)); dValue *= 2; m_WndAnalysis.AddAnalysisPoint(dValue, m_nCurGraphicType); } //将数据发下去 string CurData = strData_x + "," + strData_y + "," + strData_z; m_MainWindows.WriteDataToShareMemory(CurData, CurData.Length); ShowNotifyInfo(); } }
private void button_jump_Click(object sender, RoutedEventArgs e) { m_nCurIndex = Convert.ToInt32(textBox_input.Text.ToString()); //SetCurDataByIndex(); int nCurGraphicType = comboBox_List.SelectedIndex; int nBegin = 0; int nMax = Convert.ToInt32(textBox_GraphicNum.Text.ToString()); if (m_nCurIndex - nMax > 0) { nBegin = m_nCurIndex - nMax - 1; } m_wndGraphic.ClearGraphics(); ArrayList ayXList = new ArrayList(); ArrayList ayYList = new ArrayList(); ArrayList ayZList = new ArrayList(); int nIndex = 0; foreach (object obj in m_ayLists) { Data_Info pData = (Data_Info)obj; for (int i = nBegin; i <= m_nCurIndex; ++i) { if (i < pData.m_ayXData.Count) { ayXList.Add(pData.m_ayXData[i]); } if (i < pData.m_ayYData.Count) { ayYList.Add(pData.m_ayYData[i]); } if (i < pData.m_ayZData.Count) { ayZList.Add(pData.m_ayZData[i]); } } m_wndGraphic.AddCurveData(1, pData.m_strName, ayXList, nIndex, nCurGraphicType); m_wndGraphic.AddCurveData(2, pData.m_strName, ayYList, nIndex, nCurGraphicType); m_wndGraphic.AddCurveData(3, pData.m_strName, ayZList, nIndex, nCurGraphicType); ++nIndex; ShowNotifyInfo(); } }
private void button_load_Click(object sender, RoutedEventArgs e) { if (!m_wndGraphic.IsVisible) { m_wndGraphic.Show(); } if (!m_WndAnalysis.IsVisible) { m_WndAnalysis.Show(); } if (listBox_Data.SelectedIndex == -1) { return; } button_begin.IsEnabled = true; String strPath = listBox_Data.SelectedValue.ToString(); m_ayLists.Clear(); if (m_nDataType == 3) { Data_Info data = new Data_Info(strPath.Substring(strPath.LastIndexOf("\\") + 1)); int nSize = GetFileDatas(strPath + "\\X.csv", data.m_ayXData); m_nMaxSize = m_nMaxSize < nSize ? nSize : m_nMaxSize; nSize = GetFileDatas(strPath + "\\Y.csv", data.m_ayYData); m_nMaxSize = m_nMaxSize < nSize ? nSize : m_nMaxSize; nSize = GetFileDatas(strPath + "\\Z.csv", data.m_ayZData); m_nMaxSize = m_nMaxSize < nSize ? nSize : m_nMaxSize; m_ayLists.Add(data); } else if (m_nDataType == 1) { foreach (string dir in Directory.GetDirectories(strPath)) { Data_Info data = new Data_Info(dir.Substring(dir.LastIndexOf("\\") + 1)); int nSize = GetFileDatas(dir + "\\X.csv", data.m_ayXData); m_nMaxSize = m_nMaxSize < nSize ? nSize : m_nMaxSize; nSize = GetFileDatas(dir + "\\Y.csv", data.m_ayYData); m_nMaxSize = m_nMaxSize < nSize ? nSize : m_nMaxSize; nSize = GetFileDatas(dir + "\\Z.csv", data.m_ayZData); m_nMaxSize = m_nMaxSize < nSize ? nSize : m_nMaxSize; m_ayLists.Add(data); } } else if (m_nDataType == 2) { foreach (string dir in m_ayDirs) { if (dir.IndexOf(strPath) != -1) { String strName = dir.Substring(0, dir.IndexOf(strPath) - 1); Data_Info data = new Data_Info(strName.Substring(strName.LastIndexOf("\\") + 1)); int nSize = GetFileDatas(dir + "\\X.csv", data.m_ayXData); m_nMaxSize = m_nMaxSize < nSize ? nSize : m_nMaxSize; nSize = GetFileDatas(dir + "\\Y.csv", data.m_ayYData); m_nMaxSize = m_nMaxSize < nSize ? nSize : m_nMaxSize; nSize = GetFileDatas(dir + "\\Z.csv", data.m_ayZData); m_nMaxSize = m_nMaxSize < nSize ? nSize : m_nMaxSize; m_ayLists.Add(data); } } } ShowNotifyInfo(); slider_process.Minimum = 0; slider_process.Maximum = m_nMaxSize; m_wndGraphic.ClearGraphics(); m_WndAnalysis.ClearCurve(); }