public void handle() { StreamReader sr = new StreamReader(path, Encoding.Default); string firstLine = sr.ReadLine(); string[] firstPoint = firstLine.Split(','); A[0] = Convert.ToDouble(firstPoint[1]); A[1] = Convert.ToDouble(firstPoint[2]); string secondLine = sr.ReadLine(); string[] secondPoint = secondLine.Split(','); B[0] = Convert.ToDouble(secondPoint[1]); B[1] = Convert.ToDouble(secondPoint[2]); string thirdLine = sr.ReadLine(); string[] sAngle = thirdLine.Split(','); angles = new AngleOperation[sAngle.Length];//观测角集合 for (int i = 0; i < sAngle.Length; i++) { angles[i] = new AngleOperation(sAngle[i]); } string forthLine = sr.ReadLine(); string[] sDistance = forthLine.Split(','); count = sDistance.Length + 1; distances = new double[sDistance.Length]; for (int i = 0; i < sDistance.Length; i++) { distances[i] = Convert.ToDouble(sDistance[i]); } Console.WriteLine(forthLine); sr.Close(); }
public void fillArr()//计算方位角,dx,dy { Azimuths = new AngleOperation[count]; double tempx = B[0]; double tempy = B[1]; AngleOperation temp = new AngleOperation("0.0000"); dx = new double[count - 1]; dy = new double[count - 1]; x = new double[count - 1]; y = new double[count - 1]; for (int i = 0; i < count; i++) { temp += angles[i]; Azimuths[i] = Azimuth + temp - new AngleOperation("180.0000") * (i + 1); } for (int i = 0; i < count - 1; i++) { dx[i] = distances[i] * Math.Cos(Azimuths[i].Radian); dy[i] = distances[i] * Math.Sin(Azimuths[i].Radian); } double[] cloX = xyClosure(dx); double[] cloY = xyClosure(dy); for (int i = 0; i < count - 1; i++) { x[i] = tempx + dx[i] + cloX[i]; tempx = x[i]; y[i] = tempy + dy[i] + cloY[i]; tempy = y[i]; } }
public int closure()//求闭合差 { AngleOperation sum = new AngleOperation("0.0000"); foreach (AngleOperation e in angles) { sum += e; } AngleOperation f = sum - new AngleOperation("180.0000") * (count - 1); return(f.Seconds); }