コード例 #1
0
        /// <summary>
        /// 在一列textbox控件上打印出数据,采用度分秒形式打印出来
        /// </summary>
        public void printByAMS(int Startindex, TextBox[] tbArr, double[] dArr, bool isRemain = true)
        {
            angleTransform AT = new angleTransform();
            int            i;

            for (i = Startindex; i < wire.VA_num - 1; i++)
            {
                tbArr[i].Text = AT.AtoAMS(dArr[i]);
            }
            if (isRemain)        //打印出最后一个数据
            {
                tbArr[15].Text = AT.AtoAMS(dArr[i]);
            }
            else
            {
                tbArr[i].Text = AT.AtoAMS(dArr[i]);
            }
        }
コード例 #2
0
ファイル: frm_Main.cs プロジェクト: eglrp/XSurvey
        /// <summary>
        /// 导线平差
        /// </summary>
        private void traverseAdjust()
        {
            double fB, K, f, fx, fy;

            //进行步骤②
            #region 界面控件数组
            TextBox[] tb_viewAngle = new TextBox[16] {
                VA1, VA2, VA3, VA4, VA5, VA6, VA7, VA8, VA9, VA10, VA11, VA12, VA13, VA14, VA15, VA16
            };
            TextBox[] tb_VA_adj_num = new TextBox[16] {
                _V1, _V2, _V3, _V4, _V5, _V6, _V7, _V8, _V9, _V10, _V11, _V12, _V13, _V14, _V15, _V16
            };
            TextBox[] tb_VA_adj = new TextBox[16] {
                dA1, dA2, dA3, dA4, dA5, dA6, dA7, dA8, dA9, dA10, dA11, dA12, dA13, dA14, dA15, dA16
            };
            TextBox[] tb_Azimuth_adj = new TextBox[17] {
                A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15, A16
            };
            TextBox[] tb_distance = new TextBox[16] {
                _D1, _D2, _D3, _D4, _D5, _D6, _D7, _D8, _D9, _D10, _D11, _D12, _D13, _D14, _D15, _D16
            };
            TextBox[] tb_detx = new TextBox[16] {
                dx1, dx2, dx3, dx4, dx5, dx6, dx7, dx8, dx9, dx10, dx11, dx12, dx13, dx14, dx15, dx16
            };
            TextBox[] tb_dety = new TextBox[16] {
                dy1, dy2, dy3, dy4, dy5, dy6, dy7, dy8, dy9, dy10, dy11, dy12, dy13, dy14, dy15, dy16
            };
            TextBox[] tb_adj_detx = new TextBox[16] {
                Vx1, Vx2, Vx3, Vx4, Vx5, Vx6, Vx7, Vx8, Vx9, Vx10, Vx11, Vx12, Vx13, Vx14, Vx15, Vx16
            };
            TextBox[] tb_adj_dety = new TextBox[16] {
                Vy1, Vy2, Vy3, Vy4, Vy5, Vy6, Vy7, Vy8, Vy9, Vy10, Vy11, Vy12, Vy13, Vy14, Vy15, Vy16
            };
            TextBox[] tb_X = new TextBox[16] {
                X1, X2, X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16
            };
            TextBox[] tb_Y = new TextBox[16] {
                Y1, Y2, Y3, Y4, Y5, Y6, Y7, Y8, Y9, Y10, Y11, Y12, Y13, Y14, Y15, Y16
            };
            #endregion
            double[] viewAngel = new double[16];
            double[] distance  = new double[16];
            //进行步骤③
            string         tempVA, tempD;
            int            VA_num = 0; //观测角个数
            angleTransform AT     = new angleTransform();

            /*
             * 1.将观测角转换成度表达形式 & 将距离写入double[] 数组
             */

            for (int i = 0; i < tb_viewAngle.Length; i++)
            {
                if (tb_viewAngle[i].Text != "")
                {
                    tempVA            = Convert.ToString(AT.AMStoA(tb_viewAngle[i].Text));
                    tempD             = tb_distance[i].Text;
                    viewAngel[VA_num] = double.Parse(tempVA);
                    if (tempD != "")
                    {
                        distance[VA_num] = double.Parse(tempD);
                    }
                    VA_num++;
                }
            }

            /*
             * 2.求观测角之和
             */

            double sum_viewAngle = 0;
            sum_viewAngle = math.sumOfArr(viewAngel);             //求和函数

            /*
             * 3.计算未改正前坐标方位角
             */

            wire     W                 = new wire(viewAngel, distance, VA_num);
            double[] Coodinate_Azi     = new double[VA_num + 1];
            double[] adj_Coodinate_Azi = new double[VA_num + 1];
            //获取初始坐标方位角
            if (A0.Text == "")
            {
                Coodinate_Azi[0] = W.Azimuth1(X0.Text, Y0.Text, X1.Text, Y1.Text);
            }
            else
            {
                Coodinate_Azi[0] = AT.AMStoA(A0.Text);
            }
            //获取终坐标方位角
            if (A16.Text == "")
            {
                Coodinate_Azi[VA_num] = W.Azimuth1(X16.Text, Y16.Text, X17.Text, Y17.Text);
            }
            else
            {
                Coodinate_Azi[VA_num] = AT.AMStoA(A16.Text);
            }
            //写入剩余坐标方位角
            W.fB = fB = W.adj_Azimuth(Coodinate_Azi, viewAngel);

            /*
             * 4.修正方位角
             */

            //得出各观测角对应改正数和改正角
            int[]    adj_VA_num = W.VA_adj_num(fB, VA_num);
            double[] adj_VA     = new double[VA_num];
            for (int i = 0; i < VA_num; i++)
            {
                adj_VA[i] = viewAngel[i] + adj_VA_num[i] / 3600.0;
            }

            //写入改正数和改正角
            int    sum_VA_adj_num = math.sumOfArr(adj_VA_num);
            double sum_VA_adj     = math.sumOfArr(adj_VA);
            //计算修正后方位角
            double adj_fB = W.adj_Azimuth(Coodinate_Azi, adj_VA);

            /*
             * 5.计算detx,dety
             */

            //求距离之和
            double[] D        = new double[VA_num - 1];
            double[] detx     = new double[VA_num - 1];
            double[] dety     = new double[VA_num - 1];
            double   Radian   = 0;  //弧度
            double   sumD     = 0;
            double   sum_detx = 0;
            double   sum_dety = 0;
            for (int i = 0; i < D.Length; i++)
            {
                D[i] = Convert.ToDouble(tb_distance[i].Text);
            }
            //计算detx,dety
            for (int i = 0; i < D.Length; i++)
            {
                Radian  = AT.AtoR(Coodinate_Azi[i + 1]);       //方法AtoR:度转换成弧度
                detx[i] = Math.Round(D[i] * Math.Cos(Radian), 3);
                dety[i] = Math.Round(D[i] * Math.Sin(Radian), 3);
            }
            //求和
            sumD     = math.sumOfArr(D);
            sum_detx = math.sumOfArr(detx);
            sum_dety = math.sumOfArr(dety);

            /*
             * 6.改正detx,dety
             */

            double[] adj_detx     = new double[VA_num - 1];
            double[] adj_dety     = new double[VA_num - 1];
            double   sum_adj_detx = 0;
            double   sum_adj_dety = 0;
            //计算各类限差
            double XB = Convert.ToDouble(X1.Text);
            double YB = Convert.ToDouble(Y1.Text);
            double XC = Convert.ToDouble(X16.Text);
            double YC = Convert.ToDouble(Y16.Text);
            W.fx = fx = sum_detx - (XC - XB);
            W.fy = fy = sum_dety - (YC - YB);
            W.f  = f = Math.Sqrt(fx * fx + fy * fy);
            W.K  = K = Math.Round(sumD / f);
            for (int i = 0; i < adj_detx.Length; i++)
            {
                adj_detx[i] = Math.Round((detx[i] - fx / sumD * D[i]), 3);
                adj_dety[i] = Math.Round((dety[i] - fy / sumD * D[i]), 3);
            }
            sum_adj_detx = math.sumOfArr(adj_detx);
            sum_adj_dety = math.sumOfArr(adj_dety);

            /*
             * 7.计算坐标X,坐标Y
             */

            //计算
            double   accum_Vx = 0; //累加x
            double   accum_Vy = 0; //累加y
            double[] X        = new double[VA_num - 1];
            double[] Y        = new double[VA_num - 1];
            for (int i = 0; i < VA_num - 2; i++)
            {
                accum_Vx += adj_detx[i];
                accum_Vy += adj_dety[i];
                X[i + 1]  = Math.Round(XB + accum_Vx, 3);
                Y[i + 1]  = Math.Round(YB + accum_Vy, 3);
            }

            /* 8.输出 */

            //输出每列计算
            W.print(0, tb_VA_adj_num, adj_VA_num);
            W.printByAMS(0, tb_VA_adj, adj_VA);
            W.printByAMS(0, tb_Azimuth_adj, Coodinate_Azi, false);
            W.print(0, tb_detx, detx, false);
            W.print(0, tb_dety, dety, false);
            W.print(0, tb_adj_detx, adj_detx, false);
            W.print(0, tb_adj_dety, adj_dety, false);
            W.print(1, tb_X, X, false);
            W.print(1, tb_Y, Y, false);

            //输出求和值
            SUM_VA.Text   = AT.AtoAMS(sum_viewAngle);  //将观测角之和值写入
            SUM_Vnum.Text = sum_VA_adj_num.ToString();
            SUM_dA.Text   = AT.AtoAMS(sum_VA_adj);
            SUM_D_.Text   = sumD.ToString();
            SUM_dx.Text   = sum_detx.ToString();
            SUM_dy.Text   = sum_dety.ToString();
            SUM_Vx.Text   = sum_adj_detx.ToString();
            SUM_Vy.Text   = sum_adj_dety.ToString();

            //输出辅助计算信息
            lb_aidMessage.Text = W.WireAidResult();
        }