文件名称:解析空中三角测量
文件大小:167KB
文件格式:DOC
更新时间:2016-09-24 03:25:39
空中三角测量
解析空中三角测量C#代码 private void 导入像点坐标数据ToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog FILE = new OpenFileDialog(); FILE.Filter = "文本文件(*.txt)|*.txt| 所有文件(*.*)|*.*"; FILE.FilterIndex = 1; if (FILE.ShowDialog() == DialogResult.OK) { StreamReader MSR = new StreamReader(FILE.FileName); string Line;//读取每行信息放在该字符串中 double[,] Temp = new double[34, 5];//每行信息存放在该二维数组中 int temp = 0; //将*.txt文件信息读到Temp[,]二维数组中 while ((Line = MSR.ReadLine()) != null) { char[] tt = new char[] { '\r', '\n' }; string[] split = Line.Split(tt); //字符串转换为字符串数组 string[] numbers;//读取的每行信息记录在数组中 for (int i = 0; i < split.Length; i++) { numbers = split[i].Split(' '); for (int j = 0, k = 0; j < numbers.Length && numbers[j] != ""; j++) Temp[temp, k++] = double.Parse(numbers[j]); } temp++; } MSR.Close(); //用Temp中的数据赋值,并将单位换成米,并实例化像点坐标 for (int i = 0; i < 3; i++) { LDot[i] = new int[C[i]]; x1[i] = new double[C[i]]; y1[i] = new double[C[i]]; x2[i] = new double[C[i]]; y2[i] = new double[C[i]]; } //像对1的坐标 for (int i = 0; i < 15; i++) { LDot[0][i] = (int)Temp[i, 0]; x1[0][i] = Temp[i, 1] / 1000000.0; y1[0][i] = Temp[i, 2] / 1000000.0; x2[0][i] = Temp[i, 3] / 1000000.0; y2[0][i] = Temp[i, 4] / 1000000.0; } //像对2的坐标 for (int i = 0; i < 8; i++) { LDot[1][i] = (int)Temp[i + 15, 0]; x1[1][i] = Temp[i + 15, 1] / 1000000.0; y1[1][i] = Temp[i + 15, 2] / 1000000.0; x2[1][i] = Temp[i + 15, 3] / 1000000.0; y2[1][i] = Temp[i + 15, 4] / 1000000.0; } //像对3的坐标 for (int i = 0; i < 11; i++) { LDot[2][i] = (int)Temp[i + 23, 0]; x1[2][i] = Temp[i + 23, 1] / 1000000.0; y1[2][i] = Temp[i + 23, 2] / 1000000.0; x2[2][i] = Temp[i + 23, 3] / 1000000.0; y2[2][i] = Temp[i + 23, 4] / 1000000.0; } //显示像对坐标数据 for (int i = 0; i < 34; i++) { ListViewItem a; a = lst像对坐标数据.Items.Add(Temp[i, 0].ToString()); a.SubItems.Add(Temp[i, 1].ToString()); a.SubItems.Add(Temp[i, 2].ToString()); a.SubItems.Add(Temp[i, 3].ToString()); a.SubItems.Add(Temp[i, 4].ToString()); } } }