Example #1
0
 public TraverseEdge(TraversePoint startPoint, TraversePoint endPoint, bool isGyroDirEdge, int surveyNum)
 {
     StartPoint    = startPoint;
     EndPoint      = endPoint;
     IsGyroDirEdge = isGyroDirEdge;
     SurveyNum     = surveyNum;
 }
Example #2
0
        /// <summary>
        /// 打开并读取数据文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OpenDataFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MyOpenFileDialog.InitialDirectory = Application.StartupPath;
            MyOpenFileDialog.Filter           = "txt file(*.txt)|*.txt"; // 文件类型过滤器设置为txt文件
            bool estiThroErrData = false;

            if (MyOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                string[] allText = File.ReadAllLines(MyOpenFileDialog.FileName, Encoding.UTF8); // 读取txt文件中全部的数据
                for (int i = 0; i < allText.Length - 1; i++)
                {
                    string[] rowText = allText[i].Replace(" ", "").Replace(",,", ",").Split(',');   // 每一行的数据
                    if (rowText[0] == "")
                    {
                        estiThroErrData = true;
                        i       = i + 1;
                        rowText = allText[i].Replace(" ", "").Replace(",,", ",").Split(',');        // 每一行的数据
                        ml      = Convert.ToDouble(rowText[0]);
                        mb      = AngleTransUtil.DegreeToRand(Convert.ToDouble(rowText[1]) / 3600); //将mb转成弧度
                        //ma = DegreeToRand(DMSToDegree(Convert.ToDouble(rowText[2])));
                        continue;
                    }
                    if (estiThroErrData)
                    {   // 贯通数据
                        bool          isDirEdge  = Convert.ToInt16(rowText[3]) == 1;
                        int           surveyNum  = Convert.ToInt16(rowText[4]);
                        TraversePoint startPoint = new TraversePoint(rowText);
                        startPoint.Pointindex = PointNum;
                        rowText = allText[i + 1].Replace(" ", "").Replace(",,", ",").Split(',');   // 每一行的数据
                        TraversePoint endPoint = new TraversePoint(rowText);
                        endPoint.Pointindex = PointNum + 1;
                        TraverseEdge traverEdge = new TraverseEdge(startPoint, endPoint, isDirEdge, surveyNum);
                        traverseEdge.Add(traverEdge);
                        PointNum++;
                    }
                    else
                    {
                        // 陀螺经纬仪观测数据
                        ObserveData obData = new ObserveData(rowText); // 观测数据
                        if (rowText[0] == "DM")
                        {                                              //地面
                            groundData.Add(obData);
                        }
                        if (rowText[0] == "JX")
                        {
                            //井下
                            downholeData.Add(obData);
                        }
                    }
                }
            }
            isReadData = true;
            InitState();
            // 更新表格数据
            InsertObDataIntoTable();
        }