Ejemplo n.º 1
0
        }//缓和曲线计算YH-HZ坐标

        public static Pointl zhixian(Pointl A, Pointl B, double liecheng, string dianhao)
        {
            Pointl f = new Pointl();
            double a = 0;

            f.dianhao = dianhao;
            f.licheng = liecheng;
            a         = fangwei(A.X, A.Y, B.X, B.Y);
            f.X       = A.X + (liecheng - A.licheng) * Math.Cos(a);
            f.Y       = A.Y + (liecheng - A.licheng) * Math.Sin(a);
            return(f);
        }//计算直线上点坐标
Ejemplo n.º 2
0
        }//缓和曲线计算HY-YH坐标

        public static Pointl huanquxian3(Pointl HZ, double licheng, string dianhao, double R, double Ls, double a, double k)
        {
            Pointl f  = new Pointl();
            double Li = HZ.licheng - licheng;
            double x1 = Li - Math.Pow(Li, 5) / (40 * R * R * Ls * Ls);
            double y1 = Li * Li * Li / (6 * R * Ls);

            f.dianhao = dianhao;
            f.X       = HZ.X + x1 * Math.Cos(a) + k * y1 * Math.Sin(a);
            f.Y       = HZ.Y + x1 * Math.Sin(a) - k * y1 * Math.Cos(a);
            f.licheng = licheng;
            return(f);
        }//缓和曲线计算YH-HZ坐标
Ejemplo n.º 3
0
        }//圆曲线上半部分计算坐标

        public static Pointl yuanquxian2(Pointl YZ, double licheng, string dianhao, double R, double a, double k)
        {
            Pointl f    = new Pointl();
            double jiao = (YZ.licheng - licheng) / R;
            double x1   = R * Math.Sin(jiao);
            double y1   = R * (1 - Math.Cos(jiao));

            f.dianhao = dianhao;
            f.X       = YZ.X + x1 * Math.Cos(a) + k * y1 * Math.Sin(a);
            f.Y       = YZ.Y + x1 * Math.Sin(a) - k * y1 * Math.Cos(a);
            f.licheng = licheng;
            return(f);
        }//圆曲线下半部分计算坐标
Ejemplo n.º 4
0
        }//缓和曲线计算ZH-HY坐标

        public static Pointl huanquxian2(Pointl ZH, double licheng, string dianhao, double R, double B0, double m, double P, double Ls, double a, double k)
        {
            Pointl f  = new Pointl();
            double Li = licheng - ZH.licheng;

            double jiao = B0 + (Li - Ls) / R;
            double x1   = m + R * Math.Sin(jiao);
            double y1   = P + R * (1 - Math.Cos(jiao));

            f.dianhao = dianhao;
            f.X       = ZH.X + x1 * Math.Cos(a) - k * y1 * Math.Sin(a);
            f.Y       = ZH.Y + x1 * Math.Sin(a) + k * y1 * Math.Cos(a);
            f.licheng = licheng;
            return(f);
        }//缓和曲线计算HY-YH坐标
Ejemplo n.º 5
0
        private void 计算ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            qingkong2();
            #region 预处理
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                Pointl ff = new Pointl();
                ff.dianhao = dataGridView1.Rows[i].Cells[0].Value.ToString();
                ff.X       = Convert.ToDouble(dataGridView1.Rows[i].Cells[2].Value); //数据格式不同,颠倒输入
                ff.Y       = Convert.ToDouble(dataGridView1.Rows[i].Cells[1].Value);
                yizhi.Add(ff);                                                       //输出至已知数组
                Xmax = Xmax < yizhi[i].X ? yizhi[i].X : Xmax;
                Xmin = Xmin > yizhi[i].X ? yizhi[i].X : Xmin;
                Ymax = Ymax < yizhi[i].Y ? yizhi[i].Y : Ymax;
                Ymin = Ymin > yizhi[i].Y ? yizhi[i].Y : Ymin;
            }

            R1 = Convert.ToDouble(dataGridView1.Rows[1].Cells[3].Value);
            R2 = Convert.ToDouble(dataGridView1.Rows[2].Cells[3].Value);
            Ls = Convert.ToDouble(dataGridView1.Rows[2].Cells[4].Value);

            a1     = Class1.fangwei(yizhi[0].X, yizhi[0].Y, yizhi[1].X, yizhi[1].Y);//计算各边方位角
            a2     = Class1.fangwei(yizhi[1].X, yizhi[1].Y, yizhi[2].X, yizhi[2].Y);
            a3     = Class1.fangwei(yizhi[2].X, yizhi[2].Y, yizhi[3].X, yizhi[3].Y);
            zhuan1 = a2 - a1;
            MessageBox.Show(Class1.hudutodms(a1).ToString());
            MessageBox.Show(Class1.hudutodms(a2).ToString());
            MessageBox.Show(Class1.hudutodms(a3).ToString());

            if (zhuan1 > 0)                                                        //计算转角系数
            {
                k1 = 1;
            }
            else
            {
                k1 = -1;
            }
            zhuan1 = Math.Abs(zhuan1);
            zhuan2 = a3 - a2;
            if (zhuan2 > 0)
            {
                k2 = 1;
            }
            else
            {
                k2 = -1;
            }
            zhuan2 = Math.Abs(zhuan2);
            #endregion
            #region 圆曲线要素及主点计算
            T  = R1 * Math.Tan(zhuan1 / 2);                                                 //圆曲线要素
            L  = R1 * zhuan1;
            E  = R1 * (1 / Math.Cos(zhuan1 / 2) - 1);
            q1 = 2 * T - L;
            double KJD1 = Math.Sqrt((yizhi[1].X - yizhi[0].X) * (yizhi[1].X - yizhi[0].X) + (yizhi[1].Y - yizhi[0].Y) * (yizhi[1].Y - yizhi[0].Y));
            Pointl f    = new Pointl();                                                    //储存点信息,重新使用需再次实例化
            f.dianhao = "ZY";
            f.X       = yizhi[1].X - T * Math.Cos(a1);
            f.Y       = yizhi[1].Y - T * Math.Sin(a1);
            f.licheng = KJD1 - T;
            yuanzhu.Add(f);
            double KQZ1 = KJD1 - T + L / 2;                                                 //曲中点里程
            yuanzhu.Add(Class1.yuanquxian1(f, KQZ1, "QZ", R1, a1, k1));                     //通过类计算曲中点位信息
            f         = new Pointl();
            f.dianhao = "YZ";
            f.X       = yizhi[1].X + T * Math.Cos(a2);
            f.Y       = yizhi[1].Y + T * Math.Sin(a2);
            f.licheng = KJD1 - T + L;
            if (2 * T - q1 != L)
            {
                MessageBox.Show("数据错误");
                return;
            }
            yuanzhu.Add(f);
            #endregion
            #region 缓和曲线要素及主点计算
            m  = Ls / 2 - Ls * Ls * Ls / (240 * R2 * R2);                                   //计算缓和曲线要素
            P  = Ls * Ls / (24 * R2);
            B  = Ls / (2 * R2);
            Th = m + (R2 + P) * Math.Tan(zhuan2 / 2);
            Lh = R2 * (zhuan2 - 2 * B) + 2 * Ls;
            Eh = (R2 + P) * (1 / Math.Cos(zhuan2 / 2)) - R2;
            q2 = 2 * Th - Lh;
            double KJD2 = yuanzhu[2].licheng + Math.Sqrt((yizhi[2].X - yuanzhu[2].X) * (yizhi[2].X - yuanzhu[2].X) + (yizhi[2].Y - yuanzhu[2].Y) * (yizhi[2].Y - yuanzhu[2].Y));//计算交点2里程
            f         = new Pointl();
            f.dianhao = "ZH";
            f.X       = yizhi[2].X - Th * Math.Cos(a2);
            f.Y       = yizhi[2].Y - Th * Math.Sin(a2);
            f.licheng = KJD2 - Th;
            huanzhu.Add(f);
            double KHY = KJD2 - Th + Ls;
            huanzhu.Add(Class1.huanquxian1(f, KHY, "HY", R2, Ls, a2, k2));
            double KQZ2 = KJD2 - Th + Lh / 2;
            huanzhu.Add(Class1.huanquxian2(f, KQZ2, "QZ", R2, B, m, P, Ls, a2, k2));
            f         = new Pointl();
            f.dianhao = "HZ";
            f.X       = yizhi[2].X + Th * Math.Cos(a3);
            f.Y       = yizhi[2].Y + Th * Math.Sin(a3);
            f.licheng = KJD2 - Th + Lh;
            double KYH = KJD2 - Th + Lh - Ls;
            huanzhu.Add(Class1.huanquxian3(f, KYH, "YH", R2, Ls, a3, k2));
            huanzhu.Add(f);
            #endregion
            #region 主点及要素输出
            for (int i = 0; i < yuanzhu.Count; i++)                                       //输出圆曲线主点
            {
                dataGridView2.Rows.Add();
                dataGridView2.Rows[i].Cells[0].Value = yuanzhu[i].dianhao;
                dataGridView2.Rows[i].Cells[1].Value = Math.Round(yuanzhu[i].X, 3);
                dataGridView2.Rows[i].Cells[2].Value = Math.Round(yuanzhu[i].Y, 3);
                dataGridView2.Rows[i].Cells[3].Value = Math.Round(yuanzhu[i].licheng, 3);
            }
            dataGridView2.Rows[0].HeaderCell.Value = "圆曲线";                     //添加行名
            for (int i = 0; i < huanzhu.Count; i++)                             //输出缓和曲线主点
            {
                dataGridView2.Rows.Add();
                dataGridView2.Rows[i + yuanzhu.Count].Cells[0].Value = huanzhu[i].dianhao;
                dataGridView2.Rows[i + yuanzhu.Count].Cells[1].Value = Math.Round(huanzhu[i].X, 3);
                dataGridView2.Rows[i + yuanzhu.Count].Cells[2].Value = Math.Round(huanzhu[i].Y, 3);
                dataGridView2.Rows[i + yuanzhu.Count].Cells[3].Value = Math.Round(huanzhu[i].licheng, 3);
            }
            dataGridView2.Rows[yuanzhu.Count].HeaderCell.Value = "缓和曲线";
            dataGridView2.RowHeadersWidth = 100;                                    //对行名宽度赋值
            dataGridView3.Rows.Add();                                               //输出曲线要素
            dataGridView3.Rows[0].HeaderCell.Value = "圆曲线";
            dataGridView3.Rows[0].Cells[0].Value   = "线路转角α:";
            dataGridView3.Rows[0].Cells[1].Value   = Class1.hudutodms(zhuan1);
            dataGridView3.Rows.Add();
            dataGridView3.Rows[1].Cells[0].Value = "切线长T: ";
            dataGridView3.Rows[1].Cells[1].Value = Math.Round(T, 3);
            dataGridView3.Rows.Add();
            dataGridView3.Rows[2].Cells[0].Value = "曲线长L: ";
            dataGridView3.Rows[2].Cells[1].Value = Math.Round(L, 3);
            dataGridView3.Rows.Add();
            dataGridView3.Rows[3].Cells[0].Value = "外矢距E:";
            dataGridView3.Rows[3].Cells[1].Value = Math.Round(E, 3);
            dataGridView3.Rows.Add();
            dataGridView3.Rows[4].Cells[0].Value = "切曲差q:";
            dataGridView3.Rows[4].Cells[1].Value = Math.Round(q1, 3);
            dataGridView3.Rows.Add();
            dataGridView3.Rows[5].HeaderCell.Value = "缓和曲线";
            dataGridView3.Rows[5].Cells[0].Value   = "线路转角α:";
            dataGridView3.Rows[5].Cells[1].Value   = Class1.hudutodms(zhuan2);
            dataGridView3.Rows.Add();
            dataGridView3.Rows[6].Cells[0].Value = "切线长TH:";
            dataGridView3.Rows[6].Cells[1].Value = Math.Round(Th, 3);
            dataGridView3.Rows.Add();
            dataGridView3.Rows[7].Cells[0].Value = "曲线长LH:";
            dataGridView3.Rows[7].Cells[1].Value = Math.Round(Lh, 3);
            dataGridView3.Rows.Add();
            dataGridView3.Rows[8].Cells[0].Value = "外矢距EH:";
            dataGridView3.Rows[8].Cells[1].Value = Math.Round(Eh, 3);
            dataGridView3.Rows.Add();
            dataGridView3.Rows[9].Cells[0].Value = "切曲差q:";
            dataGridView3.Rows[9].Cells[1].Value = Math.Round(q2, 3);
            dataGridView3.RowHeadersWidth        = 100;
            #endregion
            #region 里程桩计算
            yizhi[0].licheng = 0;
            yizhi[3].licheng = huanzhu[4].licheng + Math.Sqrt((yizhi[3].X - huanzhu[4].X) * (yizhi[3].X - huanzhu[4].X) + (yizhi[3].Y - huanzhu[4].Y) * (yizhi[3].Y - huanzhu[4].Y));
            for (double licheng = yizhi[0].licheng; licheng < yizhi[3].licheng; licheng += zhuangju)//循环判断点所处线形并赋值
            {
                if (licheng > yizhi[0].licheng && licheng < yuanzhu[0].licheng)
                {
                    string dianhao = "K" + licheng;
                    S.Add(Class1.zhixian(yizhi[0], yizhi[1], licheng, dianhao));
                }
                if (licheng > yuanzhu[0].licheng && licheng < yuanzhu[2].licheng)
                {
                    string dianhao = "K" + licheng;
                    S.Add(Class1.yuanquxian1(yuanzhu[0], licheng, dianhao, R1, a1, k1));
                }
                if (licheng > yuanzhu[2].licheng && licheng < huanzhu[0].licheng)
                {
                    string dianhao = "K" + licheng;
                    S.Add(Class1.zhixian(yuanzhu[2], yizhi[2], licheng, dianhao));
                }
                if (licheng > huanzhu[0].licheng && licheng < huanzhu[1].licheng)
                {
                    string dianhao = "K" + licheng;
                    S.Add(Class1.huanquxian1(huanzhu[0], licheng, dianhao, R2, Ls, a2, k2));
                }
                if (licheng > huanzhu[1].licheng && licheng < huanzhu[3].licheng)
                {
                    string dianhao = "K" + licheng;
                    S.Add(Class1.huanquxian2(huanzhu[0], licheng, dianhao, R2, B, m, P, Ls, a2, k2));
                }
                if (licheng > huanzhu[3].licheng && licheng < huanzhu[4].licheng)
                {
                    string dianhao = "K" + licheng;
                    S.Add(Class1.huanquxian3(huanzhu[4], licheng, dianhao, R2, Ls, a3, k2));
                }
                if (licheng > huanzhu[4].licheng && licheng < yizhi[3].licheng)
                {
                    string dianhao = "K" + licheng;
                    S.Add(Class1.zhixian(huanzhu[4], yizhi[3], licheng, dianhao));
                }
            }
            #endregion
            #region 里程桩输出
            for (int i = 0; i < S.Count; i++)
            {
                dataGridView4.Rows.Add();
                dataGridView4.Rows[i].Cells[0].Value = S[i].dianhao;
                dataGridView4.Rows[i].Cells[1].Value = Math.Round(S[i].X, 3);
                dataGridView4.Rows[i].Cells[2].Value = Math.Round(S[i].Y, 3);
                dataGridView4.Rows[i].Cells[3].Value = Math.Round(S[i].licheng, 3);
            }
            #endregion
            #region 生成计算报告
            richTextBox1.Text += "\n道路曲线要素计算与里程桩计算\n";
            richTextBox1.Text += "\n圆曲线的要素计算成果\n";
            richTextBox1.Text += "\n----------------------------------------\n";
            Class1.daochutoR(richTextBox1, dataGridView2);
            richTextBox1.Text += "\n缓和曲线的要素计算成果\n";
            richTextBox1.Text += "\n----------------------------------------\n";
            Class1.daochutoR(richTextBox1, dataGridView3);
            richTextBox1.Text += "\n里程点计算成果\n";
            richTextBox1.Text += "\n----------------------------------------\n";
            Class1.daochutoR(richTextBox1, dataGridView4);
            #endregion
        }