Exemple #1
0
        public void UpdateColumn(string brname, ref DxfDocument SideLine, ref Dictionary <string, Align> CLList)
        {
            string           selectString = string.Format("SELECT * FROM {0} order by Station asc", brname);
            MySqlDataAdapter adapter      = new MySqlDataAdapter(selectString, ConnectionStr);
            DataSet          dataset      = new DataSet();

            adapter.Fill(dataset);
            DataTable dt = dataset.Tables[0];

            adapter.Dispose();

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow item       = dt.Rows[i];
                string  LineName   = (string)item["Line"];
                string  BridgeName = (string)item["Bridge"];
                Align   CL         = CLList[(string)item["Line"]];
                string  trName     = (string)item["Bridge"] == "SEC2-10"?"SEC210": string.Join("0", ((string)item["Bridge"]).Split('-').ToArray());
                if (trName != brname || ((string)item["SubType"])[0] != 'C')
                {
                    continue;
                }
                double curPK      = (double)item["Station"];
                double WidthLeft  = (double)item["WidthLeft"];
                double WidthRight = (double)item["WidthRight"];
                Angle  Theta      = Angle.FromDegrees((double)item["Angle"]);
                Align  RefCL      = GetCLByName((string)item["FundType"]);

                Vector2D Center = new Vector2D(CL.curPQX.GetCoord(curPK)[0], CL.curPQX.GetCoord(curPK)[1]);
                Vector2D dir    = new Vector2D(CL.curPQX.GetDir(curPK)[0], CL.curPQX.GetDir(curPK)[1]);
                Vector2D Cdir   = dir.Rotate(Theta);

                SubStructure thisSB = new PierNone();


                if (brname.StartsWith("SEC"))
                {
                    double DistLR = 0;
                    if (LineName == "L1K" && (curPK <= 19100 || curPK >= 19750))
                    {
                        Align RK = GetCLByName("R1K");

                        double   RKPK       = RK.curPQX.GetStation(Center.X, Center.Y, (Center + Cdir).X, (Center + Cdir).Y);
                        Vector2D CenterofRK = new Vector2D(RK.curPQX.GetCoord(RKPK)[0], RK.curPQX.GetCoord(RKPK)[1]);
                        DistLR = (Center - CenterofRK).Length;
                        Center = Center - Cdir * 0.5 * DistLR;

                        WidthLeft  += 0.5 * DistLR;
                        WidthRight -= 0.5 * DistLR;
                    }
                    Line A = new Line(Center.Convert2(), Center.Convert2() + Cdir.Convert2() * 50);
                    Line B = new Line(Center.Convert2(), Center.Convert2() - Cdir.Convert2() * 50);

                    List <Vector2D> DistListLeft  = new List <Vector2D>();
                    List <Vector2D> DistListRight = new List <Vector2D>();

                    foreach (Line line in SideLine.Lines)
                    {
                        var f = A.Intersectwith(line.Flatten());
                        if (f != null)
                        {
                            Vector2D pt = ((Vector2)f).Convert2DS();
                            DistListLeft.Add(pt - Center);
                        }
                        var g = B.Intersectwith(line.Flatten());
                        if (g != null)
                        {
                            Vector2D pt = ((Vector2)g).Convert2DS();
                            DistListRight.Add(pt - Center);
                        }
                    }
                    foreach (netDxf.Entities.Arc line in SideLine.Arcs)
                    {
                        var f = A.Intersectwith(line);
                        if (f != null)
                        {
                            Vector2D pt = ((Vector2)f).Convert2DS();
                            DistListLeft.Add(pt - Center);
                        }
                        var g = B.Intersectwith(line);
                        if (g != null)
                        {
                            Vector2D pt = ((Vector2)g).Convert2DS();
                            DistListRight.Add(pt - Center);
                        }
                    }

                    foreach (Circle cc in SideLine.Circles)
                    {
                        var f = A.Intersectwith(cc);
                        if (f != null)
                        {
                            Vector2D pt = ((Vector2)f).Convert2DS();
                            DistListLeft.Add(pt - Center);
                        }
                        var g = B.Intersectwith(cc);
                        if (g != null)
                        {
                            Vector2D pt = ((Vector2)g).Convert2DS();
                            DistListRight.Add(pt - Center);
                        }
                    }


                    DistListLeft.Sort((x, y) => x.Length.CompareTo(y.Length));
                    DistListRight.Sort((x, y) => x.Length.CompareTo(y.Length));

                    //SubStructure thisSB = PierKnowledge.Arrange3(dt, i, ref CL, ref RefCL,DistListLeft,DistListRight);
                    thisSB = PierKnowledge.Arrange2("F", curPK, Theta, WidthLeft, WidthRight, DistListLeft, DistListRight, ref CL, 0.5 * DistLR);
                }
                else
                {
                    DataRow Pre = dt.Rows[i - 1];
                    thisSB = PierKnowledge.ArrangeRamp(curPK, Theta, ref CL, item, Pre);
                }



                // -----------------------------------------------------------------------------------


                MySqlCommand cmd;
                CurConn.Open();


                string tmp = string.Format("Insert into sub_tbl values({0},'{1}','{2}',{3},'{4}',{5},{6},{7},'{8}','{9}','{10}',{11},{12},{13},{14});",
                                           thisSB.ID, item["Line"], item["Bridge"], curPK, thisSB.TypeStr, thisSB.Theta.Degrees, thisSB.CapBeamLeft, thisSB.CapBeamRight,
                                           thisSB.DistList.ToString2(), thisSB.PierAngList.ToString2(), thisSB.FundAngList.ToString2(), thisSB.H0, thisSB.H1, thisSB.SlopLeft, thisSB.SlopRight);

                cmd = new MySqlCommand(tmp, CurConn);
                cmd.ExecuteNonQuery();
                CurConn.Close();
            }
            Console.WriteLine("#  {0} 已配置下部结构...", brname);
        }