예제 #1
0
        string Report()
        {
            string res = Obs.ToString();

            //如果XYZ坐标已经计算出来
            if (XYZ)
            {
                res += string.Format("\r\n大地坐标(BLH)转换为空间坐标(XYZ)\r\n");
                res += "--------------------------------------\r\n";
                res += $"{"点名",-5}{"B",10}{"L",15}{"  H",8:f4}";
                res += $"{"X",15:f4} {"Y",15:f4}{"Z",15:f4}\r\n";

                foreach (var d in Obs.Data)
                {
                    res += $"{d.Name,-5}{GeoPro.Rad2Str(d.B),15}{GeoPro.Rad2Str(d.L),15}{d.H,10:f4}";
                    res += $"{d.X,15:f4}{d.Y,15:f4}{d.Z,15:f4}\r\n";
                }
            }
            if (BLH)
            {
                res += string.Format("\r\n空间坐标(XYZ)转换为大地坐标(BLH)\r\n");
                res += "--------------------------------------\r\n";
                res += $"{"点名",-5}{"X",15:f4}{"Y",15:f4}{"Z",15:f4}";
                res += $"{"B",15}{"L",15}{"   H",8:f4}\r\n";
                Position pos = new Position(Obs.Datum);

                for (int i = 0; i < Obs.Data.Count; i++)
                {
                    double B, L, H;
                    double X = Obs.Data[i].X + 1000.0; //+1000
                    double Y = Obs.Data[i].Y + 1000.0; //+1000
                    double Z = Obs.Data[i].Z + 1000.0; //+1000
                    pos.CartesianToGeodetic(X, Y, Z, out B, out L, out H);


                    res += $"{Obs.Data[i].Name,-5}{X,15:f4}{Y,15:f4}{Z,15:f4}";
                    res += $"{GeoPro.Rad2Str(B),15}{GeoPro.Rad2Str(L),15}{H,10:f4}\r\n";
                }
            }
            if (xy)
            {
                res += string.Format("\r\n高斯正算(BL-->xy)\r\n");
                res += "--------------------------------------\r\n";
                res += $"{"点名",-5} {"B",12} {"L",12}";
                res += $" {"x",10:f4} {"y",10:f4} \r\n";
                foreach (var d in Obs.Data)
                {
                    res += $"{d.Name,-5} {GeoPro.Rad2Str(d.B),12} {GeoPro.Rad2Str(d.L),12}";
                    res += $" {d.x,10:f4}  {d.y,10:f4}\r\n";
                }
            }
            if (BL)
            {
                res += string.Format("\n高斯反算(xy-->BL)\r\n");
                res += "--------------------------------------\r\n";
                res += $"{"点名",-5} {"x",10:f4} {"y",10:f4}";
                res += $" {"B",12} {"L",12}\r\n";
                Gauss  pos = new Gauss(Obs.Datum, Obs.L0);
                double B, L;
                for (int i = 0; i < Obs.Data.Count; i++)
                {
                    // Obs.Data[i].B = 0; Obs.Data[i].L = 0;
                    double x = Obs.Data[i].x + 1000.0;
                    double y = Obs.Data[i].y + 1000.0;
                    pos.xy2BL(x, y, out B, out L);

                    res += $"{Obs.Data[i].Name,-5} {x,10:f4}  {y,10:f4}";
                    res += $" {GeoPro.Rad2Str(B),15}  {GeoPro.Rad2Str(L),15}\r\n ";
                }
            }
            return(res);
        }