// 坐标平差 private bool AdjCoord() { mDspStr += ">>> 4.坐标近似平差计算 <<<\r\n"; double fx, fy, fs; double totalS = 0.0; int n = mTraverseLine.Lines.Count; // 导线所有直线段数 for (int i = 1; i <= n - 2; i++) // 计算观测直线总长 { totalS += mTraverseLine.Lines[i].Distance; } double fs0 = 5000.0; fx = mTraverseLine.Lines[n - 1].StartPt.X - mTraverseLine.KnowedObsData.X0[2]; fy = mTraverseLine.Lines[n - 1].StartPt.Y - mTraverseLine.KnowedObsData.Y0[2]; fs = Math.Sqrt(fx * fx + fy * fy); fs = Math.Floor(1 / (fs / totalS)); mDspStr += " 坐标闭合差fx=" + (fx * 1000).ToString("0.0") + "mm fy=" + (fy * 1000).ToString("0.0") + "mm 边长相对误差fs=1/" + fs.ToString("0") + " 限差=1/" + fs0.ToString("0") + "\r\n"; if (fs < fs0) { mDspStr += "坐标闭合差超限!\r\n"; return(false); } // 计算坐标改正数 mDspStr += "坐标改正数\r\n"; double[] Vx = new double[n - 3 + 1], Vy = new double[n - 3 + 1]; double Vx0 = -fx / totalS; double Vy0 = -fy / totalS; for (int i = 0; i <= n - 3; i++) { Vx[i] = Vx0 * mTraverseLine.Lines[i + 1].Distance; Vy[i] = Vy0 * mTraverseLine.Lines[i + 1].Distance; mDspStr += mTraverseLine.Lines[i + 1].EndPt.Name + " 点 的坐标改正数Vx=" + (Vx[i] * 1000).ToString("0.0") + "mm Vy=" + (Vy[i] * 1000).ToString("0.0") + "mm \r\n"; } // 计算坐标改正数 mDspStr += "坐标平差值\r\n"; double totalVx, totalVy; totalVx = totalVy = 0.0; for (int i = 0; i <= n - 3; i++) { totalVx += Vx[i]; totalVy += Vy[i]; mTraverseLine.Lines[i + 1].EndPt.X += totalVx; mTraverseLine.Lines[i + 1].EndPt.Y += totalVy; mDspStr += mTraverseLine.Lines[i + 1].EndPt.Name + " 点 平差坐标X=" + mTraverseLine.Lines[i + 1].EndPt.X.ToString("0.000") + " Y=" + mTraverseLine.Lines[i + 1].EndPt.Y.ToString("0.000") + "\r\n"; // 重新计算导线距离、方位角等数据 mTraverseLine.Lines[i + 1].Direction = BaseFunction.DirectAB(mTraverseLine.Lines[i + 1]); mTraverseLine.Lines[i + 1].Distance = BaseFunction.DistAB(mTraverseLine.Lines[i + 1]); } return(true); }
// 改正方位角 private bool AdjDirect() { double aaE; // 终止方位角 double fbeta; // 方位角闭合差 int n = mTraverseLine.KnowedObsData.bb.Count; // 观测夹角个数 double fbeta0 = 24 * Math.Sqrt(n) / 10000; // 方位角闭合差限差(三级导线),转为dd.mmss形式 mDspStr += "\r\n"; mDspStr += ">>> 2.方位角近似平差 <<<\r\n"; aaE = BaseFunction.DirectAB(mTraverseLine.KnowedObsData.X0[2], mTraverseLine.KnowedObsData.Y0[2], mTraverseLine.KnowedObsData.X0[3], mTraverseLine.KnowedObsData.Y0[3]); // 显示终止方位角 mDspStr += " 终止方位角: " + BaseFunction.Hu2DMS(aaE).ToString("0.0000") + "\r\n"; // 计算角度闭合差 fbeta = mTraverseLine.Lines[n].Direction - aaE; mDspStr += " 角度闭合差=" + BaseFunction.Hu2DMS(fbeta).ToString("0.0000") + " 限差=" + fbeta0.ToString("0.0000") + "\r\n"; if (Math.Abs(BaseFunction.Hu2DMS(fbeta)) > fbeta0) { mDspStr += "方位角闭合差超限!\r\n"; return(false); } // 改正后的方位角 double Vbeta0 = -fbeta / n; double alpha; // 改正后方位角 for (var i = 1; i <= n; i++) { alpha = mTraverseLine.Lines[i].Direction; alpha += i * Vbeta0; if (alpha >= 2 * Math.PI) { alpha -= 2 * Math.PI; } if (alpha < 0) { alpha += 2 * Math.PI; } mTraverseLine.Lines[i].Direction = alpha; mDspStr += mTraverseLine.Lines[i].Name + " 边改正后的方位角=" + BaseFunction.Hu2DMS(alpha).ToString("0.0000") + "\r\n"; } mDspStr += "\r\n"; return(true); }
// 计算近似方位角 private void CalcDirect0() { int n = mTraverseLine.KnowedObsData.bb.Count; // 观测夹角个数 double alpha; // 近似方位角 double beta; // 观测夹角 if (mTraverseLine.NetType == 1) { for (var i = 1; i <= n; i++) { beta = mTraverseLine.KnowedObsData.bb[i - 1]; alpha = BaseFunction.DirectAB(mTraverseLine.Lines[i - 1], beta, mTraverseLine.AngleType); mTraverseLine.Lines[i].Direction = alpha; } } else { if (mTraverseLine.AngleType == 1) { mTraverseLine.KnowedObsData.bb[0] = 2 * Math.PI - mTraverseLine.KnowedObsData.bb[0]; } mTraverseLine.KnowedObsData.bb[n - 1] = mTraverseLine.KnowedObsData.bb[n - 1] + (2 * Math.PI - mTraverseLine.KnowedObsData.bb[0]); // 最后一个夹角(转为附和导线) if (mTraverseLine.KnowedObsData.bb[n - 1] >= 2 * Math.PI) { mTraverseLine.KnowedObsData.bb[n - 1] = mTraverseLine.KnowedObsData.bb[n - 1] - 2 * Math.PI; } mTraverseLine.AngleType = 2; // 转换为附和导线后,夹角固定为右角 for (var i = 1; i <= n; i++) { beta = mTraverseLine.KnowedObsData.bb[i - 1]; alpha = BaseFunction.DirectAB(mTraverseLine.Lines[i - 1], beta, mTraverseLine.AngleType); mTraverseLine.Lines[i].Direction = alpha; } } mDspStr = ">>> 1.近似方位角计算 <<<\r\n"; for (var i = 1; i <= n; i++) { mDspStr += mTraverseLine.Lines[i].Name + " 边的近似方位角=" + BaseFunction.Hu2DMS(mTraverseLine.Lines[i].Direction).ToString("0.0000") + "\r\n"; } }
// 初始化导线 private void Intil() { MyPoint startPt, endPt; MyLine line; int n = mTraverseLine.KnowedObsData.Pnames.Count; // 总点数(已知点4+未知点数) // 赋值第一条起始边 startPt = new MyPoint(); startPt.Name = mTraverseLine.KnowedObsData.Pnames[0]; startPt.X = mTraverseLine.KnowedObsData.X0[0]; startPt.Y = mTraverseLine.KnowedObsData.Y0[0]; startPt.Type = 1; endPt = new MyPoint(); endPt.Name = mTraverseLine.KnowedObsData.Pnames[1]; endPt.X = mTraverseLine.KnowedObsData.X0[1]; endPt.Y = mTraverseLine.KnowedObsData.Y0[1]; endPt.Type = 1; line = new MyLine(); line.StartPt = startPt; line.EndPt = endPt; line.Name = startPt.Name + endPt.Name; line.Distance = BaseFunction.DistAB(line); line.Direction = BaseFunction.DirectAB(line); line.Type = 1; mTraverseLine.Lines.Add(line); // 赋值中间未知边 for (int i = 2; i <= n - 2; i++) { startPt = endPt; endPt = new MyPoint(); endPt.Name = mTraverseLine.KnowedObsData.Pnames[i]; endPt.Type = 2; if (i == n - 2) { endPt.Type = 1; endPt.X = mTraverseLine.KnowedObsData.X0[2]; endPt.Y = mTraverseLine.KnowedObsData.Y0[2]; } line = new MyLine(); line.StartPt = startPt; line.EndPt = endPt; line.Name = startPt.Name + endPt.Name; line.Distance = mTraverseLine.KnowedObsData.SS[i - 2]; // 赋值实测距离 line.Type = 2; mTraverseLine.Lines.Add(line); } // 赋值最后一条已知边 startPt = endPt; endPt = new MyPoint(); endPt.Name = mTraverseLine.KnowedObsData.Pnames[n - 1]; endPt.Type = 1; endPt.X = mTraverseLine.KnowedObsData.X0[3]; endPt.Y = mTraverseLine.KnowedObsData.Y0[3]; line = new MyLine(); line.StartPt = startPt; line.EndPt = endPt; line.Name = startPt.Name + endPt.Name; line.Distance = BaseFunction.DistAB(line); line.Direction = BaseFunction.DirectAB(line); line.Type = 1; mTraverseLine.Lines.Add(line); }