Exemplo n.º 1
0
        public static StringBuilder GetReport(Ellipsoid ellipsoid, List <GeodesicInfo> data, int type)
        {
            StringBuilder sb = new StringBuilder();
            string        line;

            line = "**********************************************************************\r\n\r\n";
            sb.Append(line);
            line = "\t\t\t\t大地主题解算报告\r\n\r\n";
            sb.Append(line);
            line = "**********************************************************************\r\n\r\n\r\n";
            sb.Append(line);
            line = "------------------------------统计数据---------------------------------\r\n\r\n";
            sb.Append(line);
            line = "\t计算点对总数:".PadRight(20) + data.Count + "\r\n\r\n";
            sb.Append(line);
            line = "\t椭球长半轴:".PadRight(20) + ellipsoid.a + "\r\n\r\n";
            sb.Append(line);
            line = "\t椭球扁率:".PadRight(20) + ellipsoid.f + "\r\n\r\n";
            sb.Append(line);
            if (type == 1)
            {
                line = "\t计算类型:".PadRight(20) + "大地主题正算\t\r\n\r\n";
            }
            else
            {
                line = "\t计算类型:".PadRight(20) + "大地主题反算\t\r\n\r";
            }
            sb.Append(line);
            line = "\n\n";
            sb.Append(line);


            line = "------------------------------计算结果--------------------------------------\r\n\r\n";
            sb.Append(line);
            line = "\t点名\t纬度(B)\t\t经度 (L)\t\t大地方位角(A)\t\t大地线(S)\r\n\r\n";
            sb.Append(line);
            for (int i = 0; i < data.Count; i++)
            {
                GeodesicInfo info = data[i];
                Pointinfo    p1   = info.P1;
                Pointinfo    p2   = info.P2;
                line = "\n";
                sb.Append(line);
                line = "\t" + p1.Name.PadRight(10) + GeoPro.DMS2String(p1.B).PadRight(15) + GeoPro.DMS2String(p1.L).PadRight(15) + GeoPro.DMS2String(info.A12).PadRight(15) + info.S.ToString("0.000") + "\t\t\r\n\r\n";
                sb.Append(line);
                line = "\t" + p2.Name.PadRight(10) + GeoPro.DMS2String(p2.B).PadRight(15) + GeoPro.DMS2String(p2.L).PadRight(15) + GeoPro.DMS2String(info.A21).PadRight(15) + info.S.ToString("0.000") + "\t\t\r\n\r\n";
                sb.Append(line);
            }



            line = "\n";
            sb.Append(line);
            return(sb);
        }
Exemplo n.º 2
0
        public static List <GeodesicInfo> ReadPosData(string filepath, ref Ellipsoid ellipsoid)
        {
            List <GeodesicInfo> dataInfo = new List <GeodesicInfo>();

            try
            {
                StreamReader sr   = new StreamReader(filepath, Encoding.Default);
                string       line = "";
                string[]     info;

                //读椭球参数
                line = sr.ReadLine();
                info = line.Split(',');

                double a = double.Parse(info[0]);
                double f = 1.0 / double.Parse(info[1]);
                ellipsoid = new Ellipsoid(a, f);


                //读取点
                while ((line = sr.ReadLine()) != null)
                {
                    GeodesicInfo data = new GeodesicInfo();
                    info = line.Split(',');
                    //第一点
                    Pointinfo p1 = new Pointinfo();
                    p1.Name  = info[0];
                    p1.B     = double.Parse(info[1]);
                    p1.L     = double.Parse(info[2]);
                    data.A12 = double.Parse(info[3]);
                    data.S   = double.Parse(info[4]);


                    //第二点
                    Pointinfo p2 = new Pointinfo();
                    p2.Name = info[5];

                    data.P1 = p1;
                    data.P2 = p2;

                    dataInfo.Add(data);
                }

                sr.Close();

                return(dataInfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        private void UpdatePosTable()
        {
            DataRow dr;

            for (int i = 0; i < PosData.Count; i++)
            {
                GeodesicInfo data = PosData[i];

                dr = PosDataTable.Rows[i];
                Pointinfo p2 = data.P2;
                dr["终点"] = p2.Name;
                dr["B2"] = GeoPro.DMS2String(p2.B);
                dr["L2"] = GeoPro.DMS2String(p2.L);
                dr["A2"] = GeoPro.DMS2String(data.A21);
            }
        }
Exemplo n.º 4
0
        private void FindMBR()
        {
            maxB = minB = negdata[0].P1.B;
            maxL = minL = negdata[0].P1.L;
            for (int i = 0; i < negdata.Count; i++)
            {
                Pointinfo p1 = negdata[i].P1;
                Pointinfo p2 = negdata[i].P2;

                //p1
                if (p1.B > maxB)
                {
                    maxB = p1.B;
                }
                else if (p1.B < minB)
                {
                    minB = p1.B;
                }

                if (p1.L > maxL)
                {
                    maxL = p1.L;
                }
                else if (p1.L < minL)
                {
                    minL = p1.L;
                }

                //p2
                if (p2.B > maxB)
                {
                    maxB = p2.B;
                }
                else if (p2.B < minB)
                {
                    minB = p2.B;
                }
                if (p2.L > maxL)
                {
                    maxL = p2.L;
                }
                else if (p2.L < minL)
                {
                    minL = p2.L;
                }
            }
        }
Exemplo n.º 5
0
        private void NegData2Table()
        {
            NegDataTable = new DataTable();
            NegDataTable.Columns.Add("起点", System.Type.GetType("System.String"));
            NegDataTable.Columns.Add("B1", System.Type.GetType("System.String"));
            NegDataTable.Columns.Add("L1", System.Type.GetType("System.String"));
            NegDataTable.Columns.Add("终点", System.Type.GetType("System.String"));
            NegDataTable.Columns.Add("B2", System.Type.GetType("System.String"));
            NegDataTable.Columns.Add("L2", System.Type.GetType("System.String"));
            NegDataTable.Columns.Add("A1", System.Type.GetType("System.String"));
            NegDataTable.Columns.Add("A2", System.Type.GetType("System.String"));
            NegDataTable.Columns.Add("S", System.Type.GetType("System.String"));

            DataRow dr;

            for (int i = 0; i < NegData.Count; i++)
            {
                GeodesicInfo data = NegData[i];
                Pointinfo    p1   = data.P1;
                Pointinfo    p2   = data.P2;
                dr = NegDataTable.NewRow();

                dr["起点"] = p1.Name;
                dr["B1"] = GeoPro.DMS2String(p1.B);
                dr["L1"] = GeoPro.DMS2String(p1.L);
                dr["终点"] = p2.Name;
                dr["B2"] = GeoPro.DMS2String(p2.B);
                dr["L2"] = GeoPro.DMS2String(p2.L);


                NegDataTable.Rows.Add(dr);
            }

            EllipsoidA.Text  = "椭球长半轴(a):" + MyEllipsoid.a;
            Ellipsoidf_.Text = "椭球扁率(f):" + MyEllipsoid.f;

            dataGridViewNeg.DataSource = NegDataTable;
            for (int i = 0; i < dataGridViewNeg.ColumnCount; i++)
            {
                dataGridViewNeg.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
            }
        }
Exemplo n.º 6
0
        private void PosData2Table()
        {
            PosDataTable = new DataTable();
            PosDataTable.Columns.Add("起点", System.Type.GetType("System.String"));
            PosDataTable.Columns.Add("B1", System.Type.GetType("System.String"));
            PosDataTable.Columns.Add("L1", System.Type.GetType("System.String"));
            PosDataTable.Columns.Add("A1", System.Type.GetType("System.String"));
            PosDataTable.Columns.Add("S", System.Type.GetType("System.String"));
            PosDataTable.Columns.Add("终点", System.Type.GetType("System.String"));
            PosDataTable.Columns.Add("B2", System.Type.GetType("System.String"));
            PosDataTable.Columns.Add("L2", System.Type.GetType("System.String"));
            PosDataTable.Columns.Add("A2", System.Type.GetType("System.String"));

            DataRow dr;

            for (int i = 0; i < PosData.Count; i++)
            {
                GeodesicInfo data = PosData[i];
                Pointinfo    p1   = data.P1;
                dr = PosDataTable.NewRow();

                dr["起点"] = p1.Name;
                dr["B1"] = GeoPro.DMS2String(p1.B);
                dr["L1"] = GeoPro.DMS2String(p1.L);
                dr["A1"] = GeoPro.DMS2String(data.A12);
                dr["S"]  = data.S.ToString("0.000");


                PosDataTable.Rows.Add(dr);
            }

            dataGridViewPos.DataSource = PosDataTable;
            for (int i = 0; i < dataGridViewPos.ColumnCount; i++)
            {
                dataGridViewPos.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            EllipsoidA.Text  = "椭球长半轴(a):" + MyEllipsoid.a;
            Ellipsoidf_.Text = "椭球扁率(f):" + MyEllipsoid.f;
        }