Example #1
0
 private static void GetPartTable(DataCenter dataCenter, ref DataTable table)
 {
     for (int i = 0; i < dataCenter.Stations.Count; i++)
     {
         DataRow row = table.NewRow();
         row["后视点名"]  = dataCenter.Stations[i].Point1.Name;
         row["前视点名"]  = dataCenter.Stations[i].Point2.Name;
         row["后距1"]   = dataCenter.Stations[i].list[0];
         row["后距2"]   = dataCenter.Stations[i].list[6];
         row["前距1"]   = dataCenter.Stations[i].list[2];
         row["前距2"]   = dataCenter.Stations[i].list[4];
         row["后视中丝1"] = dataCenter.Stations[i].list[1];
         row["后视中丝2"] = dataCenter.Stations[i].list[7];
         row["前视中丝1"] = dataCenter.Stations[i].list[3];
         row["前视中丝2"] = dataCenter.Stations[i].list[5];
         table.Rows.Add(row);
     }
 }
Example #2
0
        public static void PreProcess(ref DataCenter dataCenter)
        {
            for (int i = 0; i < dataCenter.Stations.Count; i++)
            {
                double[] a = new double[18];
                for (int j = 0; j < 8; j++)
                {
                    a[j] = dataCenter.Stations[i].list[j];
                }
                a[8]  = a[3] - a[5];
                a[9]  = a[1] - a[7];
                a[10] = a[9] - a[8];

                a[11] = a[0] - a[2];
                a[12] = a[6] - a[4];
                a[13] = (a[11] + a[12]) / 2;
                if (dataCenter.Stations[i].Point1.Name != "-1")
                {
                    a[14] = a[13];
                }
                else
                {
                    a[14] = a[13] + dataCenter.Stations[i - 1].list[14];
                }
                a[15] = a[1] - a[3];
                a[16] = a[7] - a[5];
                a[17] = (a[15] + a[16]) / 2;
                if (dataCenter.Stations[i].Point1.Name != "-1")
                {
                    dataCenter.Stations[i].deltaH = a[17];
                }
                else
                {
                    dataCenter.Stations[i].deltaH = dataCenter.Stations[i - 1].deltaH + a[17];
                }
                for (int j = 8; j < 18; j++)
                {
                    dataCenter.Stations[i].list.Add(a[j]);
                }
            }
        }
Example #3
0
        public static string GetReport(DataCenter dataCenter)
        {
            string str = "测站数据\r\n";

            for (int i = 0; i < dataCenter.Stations.Count; i++)
            {
                for (int j = 0; j < dataCenter.Stations[i].list.Count; j++)
                {
                    str += dataCenter.Stations[i].list[j].ToString("F3") + " ";
                }
                str += "\r\n";
            }
            str += "水准路线闭合高差\r\n";
            str += dataCenter.fh + "\r\n";
            str += "高差改正数\r\n";
            for (int i = 0; i < dataCenter.Stations.Count; i++)
            {
                str += dataCenter.Stations[i].v + "\r\n";
            }
            str += "矩阵求逆\r\n";
            str += Matrix.getInv(dataCenter.A).printMatrix() + "\r\n";
            str += "矩阵求和\r\n";
            str += Matrix.multiply(dataCenter.A, dataCenter.B).printMatrix() + "\r\n";
            str += "矩阵求转置\r\n";
            str += Matrix.getT(dataCenter.A).printMatrix() + "\r\n";
            str += "L矩阵\r\n";
            str += dataCenter.L.printMatrix() + "\r\n";
            str += "x矩阵\r\n";
            str += dataCenter.x.printMatrix() + "\r\n";
            str += "invBTPB矩阵\r\n";
            str += dataCenter.invBTPB.printMatrix() + "\r\n";
            str += "高程平差值计算";
            for (int i = 0; i < dataCenter.NewStations.Count - 1; i++)
            {
                str += dataCenter.NewStations[i].Point2.realH + "\r\n";
            }
            return(str);
        }
Example #4
0
 private static void GetHeaderTable(DataCenter dataCenter, ref DataTable table)
 {
     table.Columns.Add("后视点名", typeof(string));
     table.Columns.Add("前视点名", typeof(string));
     table.Columns.Add("后距1", typeof(double));
     table.Columns.Add("后距2", typeof(double));
     table.Columns.Add("前距1", typeof(double));
     table.Columns.Add("前距2", typeof(double));
     table.Columns.Add("距离差1", typeof(double));
     table.Columns.Add("距离差2", typeof(double));
     table.Columns.Add("距离差d", typeof(double));
     table.Columns.Add("Σd", typeof(double));
     table.Columns.Add("后视中丝1", typeof(double));
     table.Columns.Add("后视中丝2", typeof(double));
     table.Columns.Add("前视中丝1", typeof(double));
     table.Columns.Add("前视中丝2", typeof(double));
     table.Columns.Add("后视中丝差", typeof(double));
     table.Columns.Add("前视中丝差", typeof(double));
     table.Columns.Add("高差1", typeof(double));
     table.Columns.Add("高差2", typeof(double));
     table.Columns.Add("中丝差", typeof(double));
     table.Columns.Add("高差", typeof(double));
 }
Example #5
0
        public static void SaveDXF(string filename, DataCenter dataCenter)
        {
            double       h  = 100;
            StreamWriter sw = new StreamWriter(filename);

            sw.WriteLine("0");
            sw.WriteLine("SECTION");
            sw.WriteLine("2");
            sw.WriteLine("ENTITIES");
            sw.WriteLine("0");
            sw.WriteLine("POINT");
            sw.WriteLine("8");
            sw.WriteLine("pointLayer");
            sw.WriteLine("10");
            sw.WriteLine(0);
            sw.WriteLine("20");
            sw.WriteLine(dataCenter.KnownPoint1.H);

            sw.WriteLine("0");
            sw.WriteLine("TEXT");
            sw.WriteLine("8");
            sw.WriteLine("pointNameLayer");
            sw.WriteLine("10");
            sw.WriteLine(0);
            sw.WriteLine("20");
            sw.WriteLine(dataCenter.KnownPoint1.H);
            sw.WriteLine("40");
            sw.WriteLine(h);
            sw.WriteLine("1");
            sw.WriteLine(dataCenter.KnownPoint1.Name);

            for (int i = 0; i < dataCenter.NewStations.Count - 1; i++)
            {
                sw.WriteLine("0");
                sw.WriteLine("SECTION");
                sw.WriteLine("2");
                sw.WriteLine("ENTITIES");
                sw.WriteLine("0");
                sw.WriteLine("POINT");
                sw.WriteLine("8");
                sw.WriteLine("pointLayer");
                sw.WriteLine("10");
                sw.WriteLine(i + 1);
                sw.WriteLine("20");
                sw.WriteLine(dataCenter.NewStations[i].Point2.realH);

                sw.WriteLine("0");
                sw.WriteLine("TEXT");
                sw.WriteLine("8");
                sw.WriteLine("pointNameLayer");
                sw.WriteLine("10");
                sw.WriteLine(i + 1);
                sw.WriteLine("20");
                sw.WriteLine(dataCenter.NewStations[i].Point2.realH);
                sw.WriteLine("40");
                sw.WriteLine(h);
                sw.WriteLine("1");
                sw.WriteLine(dataCenter.NewStations[i].Point2.Name);
            }
            sw.WriteLine("0");
            sw.WriteLine("SECTION");
            sw.WriteLine("2");
            sw.WriteLine("ENTITIES");
            sw.WriteLine("0");
            sw.WriteLine("POINT");
            sw.WriteLine("8");
            sw.WriteLine("pointLayer");
            sw.WriteLine("10");
            sw.WriteLine(dataCenter.NewStations.Count);
            sw.WriteLine("20");
            sw.WriteLine(dataCenter.KnownPoint2.H);

            sw.WriteLine("0");
            sw.WriteLine("TEXT");
            sw.WriteLine("8");
            sw.WriteLine("pointNameLayer");
            sw.WriteLine("10");
            sw.WriteLine(dataCenter.NewStations.Count);
            sw.WriteLine("20");
            sw.WriteLine(dataCenter.KnownPoint2.H);
            sw.WriteLine("40");
            sw.WriteLine(h);
            sw.WriteLine("1");
            sw.WriteLine(dataCenter.KnownPoint2.Name);

            sw.WriteLine("0");
            sw.WriteLine("ENDSEC");
            sw.WriteLine("0");
            sw.WriteLine("EOF");
            sw.Close();
        }
Example #6
0
        public static void FinalProcess(ref DataCenter dataCenter)
        {
            for (int i = 0; i < dataCenter.Stations.Count; i++)
            {
                if (dataCenter.Stations[i].Point1.Name != "-1")
                {
                    Station station1 = new Station();
                    station1.Point1 = dataCenter.Stations[i].Point1;
                    dataCenter.NewStations.Add(station1);
                }
                if (dataCenter.Stations[i].Point2.Name != "-1")
                {
                    dataCenter.NewStations[dataCenter.NewStations.Count - 1].Point2 = dataCenter.Stations[i].Point2;
                    dataCenter.NewStations[dataCenter.NewStations.Count - 1].D      = dataCenter.Stations[i].list[14];
                    dataCenter.NewStations[dataCenter.NewStations.Count - 1].deltaH = dataCenter.Stations[i].deltaH;
                }
            }
            Matrix B = new Matrix();

            B.N = dataCenter.NewStations.Count - 1;
            B.M = dataCenter.NewStations.Count;
            for (int i = 0; i < B.M; i++)
            {
                for (int j = 0; j < B.N; j++)
                {
                    if (i == j)
                    {
                        B.array.Add(1);
                    }
                    else if (j + 1 == i)
                    {
                        B.array.Add(-1);
                    }
                    else
                    {
                        B.array.Add(0);
                    }
                }
            }
            Matrix L = new Matrix();

            L.M = dataCenter.NewStations.Count;
            L.N = 1;
            for (int i = 0; i < dataCenter.NewStations.Count; i++)
            {
                double l = -(dataCenter.NewStations[i].deltaH + dataCenter.NewStations[i].Point1.H - dataCenter.NewStations[i].Point2.H);
                L.array.Add(l);
            }
            dataCenter.L = L;
            Matrix P = new Matrix();

            P.M = dataCenter.NewStations.Count;
            P.N = dataCenter.NewStations.Count;
            for (int i = 0; i < P.M; i++)
            {
                for (int j = 0; j < P.N; j++)
                {
                    if (i == j)
                    {
                        P.array.Add(10 / dataCenter.NewStations[i].D);
                    }
                    else
                    {
                        P.array.Add(0);
                    }
                }
            }
            Matrix BT      = Matrix.getT(B);
            Matrix BTPB    = Matrix.multiply(Matrix.multiply(BT, P), B);
            Matrix invBTPB = Matrix.getInv(BTPB);

            dataCenter.invBTPB = invBTPB;
            Matrix BTPL = Matrix.multiply(Matrix.multiply(BT, P), L);
            Matrix x    = Matrix.multiply(invBTPB, BTPL);

            dataCenter.x = x;
            for (int i = 0; i < dataCenter.NewStations.Count - 1; i++)
            {
                dataCenter.NewStations[i].Point2.H     = dataCenter.NewStations[i].Point2.H;
                dataCenter.NewStations[i].Point2.realH = dataCenter.NewStations[i].Point2.H + x.array[i];
                dataCenter.Points.Add(dataCenter.NewStations[i].Point2);
            }
        }