Exemplo n.º 1
0
 //计算水平网用到的点
 public List <PointClass> Calc_StartPoints()
 {
     foreach (StationClass ST in StationInfos)//提取用到的点
     {
         int CP_Index = Tool_Class.Belong(StartPoints, ST.BP.PID);
         //计算后视点在当前点集中
         if (CP_Index == -1)
         {
             StartPoints.Add(ST.BP); //不在执行添加
         }
         CP_Index = Tool_Class.Belong(StartPoints, ST.SP.PID);
         if (CP_Index == -1)
         {
             StartPoints.Add(ST.SP);//不在执行添加
         }
         CP_Index = Tool_Class.Belong(StartPoints, ST.FP.PID);
         if (CP_Index == -1)
         {
             StartPoints.Add(ST.FP);//不在执行添加
         }
     }
     //加入控制点信息
     foreach (PointClass P in StartPoints)
     {
         int cp_index = Tool_Class.Belong(ControlPoints, P.PID);
         //计算当前点是否在控制点集合中
         if (cp_index > -1)//在加入控制点信息
         {
             P.X          = ControlPoints[cp_index].X;
             P.Y          = ControlPoints[cp_index].Y;
             P.IsControlP = true;
         }
     }
     return(StartPoints);
 }
Exemplo n.º 2
0
        List <PointClass> StartPoints    = new List <PointClass>();   //控制点集合
        // 控制点文件
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            ReadFile readFile = new ReadFile("读入控制点文件");

            ControlPoints = CPlaneNetAdjust1.InputCtrData(readFile.getPath());
            Tool_Class.addData <PointClass>(dataGridView3, ControlPoints);
        }
Exemplo n.º 3
0
        private void MenuItem_Click_1(object sender, RoutedEventArgs e)
        {
            ReadFile f = new ReadFile("目标坐标文件");

            MyCoordtoTrans.InputData(f.getPath(), TargetPoints);
            Tool_Class.addData <PointClass>(dataGrid2, TargetPoints);
        }
Exemplo n.º 4
0
 // 二维坐标转换
 private void _2DCoordinateTransformation(object sender, RoutedEventArgs e)
 {
     CommonP = MyCoordtoTrans.IICoordTans(SourcePoints, TargetPoints, IIDimTraPoints);
     MyCoordtoTrans.IICoordTans(SourcePoints, TargetPoints, IIDimTraPoints);
     Tool_Class.addData <PointClass>(dataGrid3, CommonP);
     Tool_Class.addData <PointClass>(dataGrid4, IIDimTraPoints);
 }
Exemplo n.º 5
0
        //读入观测数据
        public List <StationClass> InputObsData(string FileName)
        //第一个参数为文件路径及名称,通过StationInfos返回函数值
        {
            FileStream   fs     = new FileStream(FileName, FileMode.Open); //定义流文件类
            StreamReader Reader = new StreamReader(fs, Encoding.ASCII);    //定义读取文件类

            //文件是否到最后
            while (Reader.EndOfStream != true)//通过循环读取文件信息
            {
                List <string> TempString = Reader.ReadLine().Split(' ').ToList <string>();
                //以空格作为分隔符号
                TempString.RemoveAll(Tool_Class.IsSpace); //删除所有的空格元素
                StationInfos.Add(new StationClass         //添加测站元素
                {
                    SP = new PointClass {
                        PID = TempString[0]
                    },                                          //测站点名
                    BP = new PointClass {
                        PID = TempString[1]
                    },                                          //后视点名
                    FP = new PointClass {
                        PID = TempString[2]
                    },                                          //前视点名
                    LAngle = Tool_Class.Deg_DMSToRad((double.Parse(TempString[3])) / 10000),
                    //将度分秒转成弧度付给左角
                    DisB = double.Parse(TempString[4]), //后视距离
                    DisF = double.Parse(TempString[5])  //前视距离
                });
            }
            Reader.Close();        //流文件关闭
            PerfectStationInfos(); //完善测站信息,添加控制点、方位角及距离
            return(StationInfos);
        }
Exemplo n.º 6
0
        public void AngleErrorEquations()
        {
            int        m_Pnumber = UnknowPoints.Count();
            int        numAngle = StationInfos.Count();
            PointClass FP, SP, BP;

            Ba = new Matrix(numAngle, m_Pnumber * 2); //系数
            La = new Matrix(numAngle, 1);             //常数项
            Va = new Matrix(numAngle, 1);             //改正数
            for (int Index = 0; Index < numAngle; Index++)
            {
                FP = StationInfos[Index].FP;
                BP = StationInfos[Index].BP;
                SP = StationInfos[Index].SP;
                int    j, k, h;
                double axj, ayj, bxk, byk, cxh, cyh;
                double rou = 180 * 60 * 60 / Math.PI;
                double dertY0_jk, dertY0_jh;
                double dertX0_jk, dertX0_jh;
                double S0_jk, S0_jh;
                double Li;
                j         = Tool_Class.Belong(UnknowPoints, SP.PID);
                k         = Tool_Class.Belong(UnknowPoints, FP.PID);
                h         = Tool_Class.Belong(UnknowPoints, BP.PID);
                S0_jh     = StationInfos[Index].DisB;
                S0_jk     = StationInfos[Index].DisF;
                dertY0_jh = BP.Y - SP.Y;
                dertX0_jh = BP.X - SP.X;
                dertY0_jk = FP.Y - SP.Y;
                dertX0_jk = FP.X - SP.X;
                axj       = rou * (dertY0_jk / S0_jk / S0_jk - dertY0_jh / S0_jh / S0_jh);
                ayj       = -rou * (dertX0_jk / S0_jk / S0_jk - dertX0_jh / S0_jh / S0_jh);
                bxk       = -rou * dertY0_jk / S0_jk / S0_jk;
                byk       = rou * dertX0_jk / S0_jk / S0_jk;
                cxh       = rou * dertY0_jh / S0_jh / S0_jh;
                cyh       = -rou * dertX0_jh / S0_jh / S0_jh;
                Li        = StationInfos[Index].LAngle - (StationInfos[Index].FAzimuth -
                                                          StationInfos[Index].BAzimuth);
                //非控制点放入到系数矩阵
                if (j > -1)
                {
                    Ba.SetNum(Index, 2 * j, axj);
                    Ba.SetNum(Index, 2 * j + 1, ayj);
                }
                if (k > -1)
                {
                    Ba.SetNum(Index, 2 * k, bxk);
                    Ba.SetNum(Index, 2 * k + 1, byk);
                }
                if (h > -1)
                {
                    Ba.SetNum(Index, 2 * h, cxh);
                    Ba.SetNum(Index, 2 * h + 1, cyh);
                }
                La.SetNum(Index, 0, Li);
            }
        }
Exemplo n.º 7
0
        // 观测数据
        private void MenuItem_Click_1(object sender, RoutedEventArgs e)
        {
            ReadFile readFile = new ReadFile("读入测站信息");

            StationInfos = CPlaneNetAdjust1.InputObsData(readFile.getPath());
            Tool_Class.addData <StationClass>(dataGridView1, StationInfos);
            for (int i = 0; i < dataGridView1.Items.Count; i++)
            {
                DataGridRow row = (DataGridRow)dataGridView1.ItemContainerGenerator.ContainerFromIndex(i);
                Console.WriteLine(row);
            }
        }
Exemplo n.º 8
0
 private void updataUnknowPoints(List <PointClass> unknowPoints, List <PointClass>
                                 StartPoints)
 {
     foreach (PointClass p in unknowPoints)
     {
         int index = Tool_Class.Belong(StartPoints, p.PID);
         if (index > -1)
         {
             p.X = StartPoints[index].X;
             p.Y = StartPoints[index].Y;
             StartPoints[index].IsControlP = false;
             p.IsControlP = false;
         }
     }
 }
Exemplo n.º 9
0
        public string ViewStationInfos()
        {
            string temp  = null;
            string temps = "测站 后视 前视 左角 后视距 后视方位角前视距前视方位角\n";

            foreach (StationClass CP1 in StationInfos)
            {
                temp = string.Format("{0,4}", CP1.SP.PID.ToString()) + string.Format("{0,5}",
                                                                                     CP1.BP.PID.ToString()) + string.Format("{0,6}", CP1.FP.PID.ToString()) +
                       string.Format("{0,15}", Tool_Class.RadToDeg_DMS(CP1.LAngle)) + string.Format("{0,11}",
                                                                                                    CP1.DisB.ToString("f3")) + string.Format("{0,15}",
                                                                                                                                             Tool_Class.RadToDeg_DMS(CP1.BAzimuth))
                       + string.Format("{0,11}", CP1.DisF.ToString("f3")) +
                       string.Format("{0,15}", Tool_Class.RadToDeg_DMS(CP1.FAzimuth))
                       + '\n';
                temps = temps + temp;
            }
            return(temps);
        }
Exemplo n.º 10
0
        public void DistErrorEquations()
        {
            int m_Pnumber = UnknowPoints.Count();
            int numAngle  = StationInfos.Count();
            List <LineClass> Distances = new List <LineClass>();//观测距离

            //列边长误差方程
            ExtractLineDist(Distances);
            int DistNum = Distances.Count;

            Bd = new Matrix(DistNum, m_Pnumber * 2);
            Ld = new Matrix(DistNum, 1);
            Vd = new Matrix(DistNum, 1);
            for (int D_index = 0; D_index < Distances.Count - 1; D_index++)
            {
                double dxj, dyj, dxk, dyk;
                int    j    = Tool_Class.Belong(UnknowPoints, Distances[D_index].SP.PID);
                int    k    = Tool_Class.Belong(UnknowPoints, Distances[D_index].EP.PID);
                double FWjk = Tool_Class.IIPointFW(Distances[D_index].SP,
                                                   Distances[D_index].EP);
                dxj = -Math.Cos(FWjk);
                dyj = -Math.Sin(FWjk);
                dxk = -dxj;
                dyk = -dyj;
                if (j > -1)
                {
                    Bd.SetNum(D_index, 2 * j, dxj);
                    Bd.SetNum(D_index, 2 * j + 1, dyj);
                }
                if (k > -1)
                {
                    Bd.SetNum(D_index, 2 * k, dxk);
                    Bd.SetNum(D_index, 2 * k + 1, dyk);
                }
                double ld = Distances[D_index].Distance -
                            Tool_Class.distIIP(Distances[D_index].SP, Distances[D_index].EP);
                Ld.SetNum(D_index, 0, ld);
            }
        }
Exemplo n.º 11
0
        //提取边信息
        public void ExtractLineDist(List <LineClass> Distances)
        {
            List <LineClass> Lines = new List <LineClass>();

            foreach (StationClass SC in StationInfos)
            {
                Lines.Add(new LineClass
                {
                    SP = new PointClass
                    {
                        PID = SC.SP.PID,
                        X   = SC.SP.X,
                        Y   = SC.SP.Y
                    },
                    EP = new PointClass
                    {
                        PID = SC.BP.PID,
                        X   = SC.BP.X,
                        Y   = SC.BP.Y
                    },
                    Distance = SC.DisB
                });
                Lines.Add(new LineClass
                {
                    SP = new PointClass
                    {
                        PID = SC.SP.PID,
                        X   = SC.SP.X,
                        Y   = SC.SP.Y
                    },
                    EP = new PointClass
                    {
                        PID = SC.FP.PID,
                        X   = SC.FP.X,
                        Y   = SC.FP.Y
                    },
                    Distance = SC.DisF
                });
            }
            foreach (LineClass L in Lines)
            {
                bool   IsExist = false;
                string FLName  = L.SP.PID + L.EP.PID;
                foreach (LineClass LT in Distances)
                {
                    string CLName1 = LT.SP.PID + LT.EP.PID;
                    string CLName2 = LT.EP.PID + LT.SP.PID;
                    if (string.Equals(FLName, CLName1) || string.Equals(FLName,
                                                                        CLName2))
                    {
                        IsExist = true;
                        break;
                    }
                }
                if (!IsExist)
                {
                    int  SPIndex = Tool_Class.Belong(ControlPoints, L.SP.PID);
                    int  EPIndex = Tool_Class.Belong(ControlPoints, L.EP.PID);
                    bool SPISContr = false, EPISContr = false;
                    if (SPIndex > -1)
                    {
                        SPISContr = true;
                    }
                    if (EPIndex > -1)
                    {
                        EPISContr = true;
                    }
                    if (SPISContr && EPISContr)//非控制点
                    {
                        IsExist = false;
                    }
                    else
                    {
                        Distances.Add(L);
                        IsExist = false;
                    }
                }
            }
            DistNum = Distances.Count;//得到测边数
        }
Exemplo n.º 12
0
        //初始值计算
        public void X0Y0Calculate()
        {
            int unkPnumber = UnknowPoints.Count;
            int kk         = 0;

            while (kk < unkPnumber)
            {
                foreach (StationClass SC in StationInfos)
                {
                    int SP_Index = Tool_Class.Belong(StartPoints, SC.SP.PID);
                    if (StartPoints[SP_Index].IsControlP)//测站有点
                    {
                        SC.SP.X          = StartPoints[SP_Index].X;
                        SC.SP.Y          = StartPoints[SP_Index].Y;
                        SC.SP.IsControlP = true;
                        int BP_Index = Tool_Class.Belong(StartPoints, SC.BP.PID);
                        if (StartPoints[BP_Index].IsControlP)//后视有点
                        {
                            SC.BP.X          = StartPoints[BP_Index].X;
                            SC.BP.Y          = StartPoints[BP_Index].Y;
                            SC.BP.IsControlP = true;
                            int FP_Index = Tool_Class.Belong(StartPoints, SC.FP.PID);
                            if (StartPoints[FP_Index].IsControlP == false)//前视无点
                            {
                                double BAzimuth = Tool_Class.IIPointFW(SC.SP, SC.BP);
                                double FAzimuth = BAzimuth + SC.LAngle;
                                FAzimuth = Tool_Class.AjustAngle(FAzimuth);//前视方位角
                                SC.FP    = Tool_Class.AzimuthDistToP(SC.SP, FAzimuth,
                                                                     SC.DisF);
                                SC.FP.PID                        = StartPoints[FP_Index].PID;
                                SC.FP.IsControlP                 = true;
                                StartPoints[FP_Index].X          = SC.FP.X;
                                StartPoints[FP_Index].Y          = SC.FP.Y;
                                StartPoints[FP_Index].IsControlP = true;
                                kk++;
                            }
                        }
                        else//后视无点
                        {
                            int FP_Index = Tool_Class.Belong(StartPoints, SC.FP.PID);
                            if (StartPoints[FP_Index].IsControlP)//前视有点
                            {
                                SC.FP.X          = StartPoints[FP_Index].X;
                                SC.FP.Y          = StartPoints[FP_Index].Y;
                                SC.FP.IsControlP = true;
                                double FAzimuth = Tool_Class.IIPointFW(SC.SP, SC.FP);
                                double BAzimuth = FAzimuth - SC.LAngle;
                                BAzimuth = Tool_Class.AjustAngle(BAzimuth);
                                SC.BP    = Tool_Class.AzimuthDistToP(SC.SP, BAzimuth,
                                                                     SC.DisB);
                                SC.BP.PID                        = StartPoints[BP_Index].PID;
                                SC.BP.IsControlP                 = true;
                                StartPoints[BP_Index].X          = SC.BP.X;
                                StartPoints[BP_Index].Y          = SC.BP.Y;
                                StartPoints[BP_Index].IsControlP = true;
                                kk++;
                            }
                        }
                    }
                }
            }
            //更新未知点
            PerfectStationInfos();                         //补充测站信息
            updataUnknowPoints(UnknowPoints, StartPoints); //更新未知点
        }
Exemplo n.º 13
0
 // 初始值计算
 private void MenuItem_Click_6(object sender, RoutedEventArgs e)
 {
     CPlaneNetAdjust1.X0Y0Calculate();
     Tool_Class.addData <PointClass>(dataGridView4, CPlaneNetAdjust1.UnknowPoints);
 }
Exemplo n.º 14
0
 // 提取未知点
 private void MenuItem_Click_5(object sender, RoutedEventArgs e)
 {
     Tool_Class.addData <PointClass>(dataGridView5, CPlaneNetAdjust1.Calc_UnknowPoints());
 }
Exemplo n.º 15
0
 // 提取所有点
 private void MenuItem_Click_4(object sender, RoutedEventArgs e)
 {
     Tool_Class.addData <PointClass>(dataGrideView2, CPlaneNetAdjust1.Calc_StartPoints());
 }
Exemplo n.º 16
0
 //完善测站信息
 private void PerfectStationInfos()
 {
     //添加控制点信息
     foreach (StationClass TC in StationInfos)
     {
         int index = Tool_Class.Belong(ControlPoints, TC.SP.PID);
         if (index > -1)
         {
             TC.SP.X          = ControlPoints[index].X;
             TC.SP.Y          = ControlPoints[index].Y;
             TC.SP.IsControlP = true;
         }
         index = Tool_Class.Belong(ControlPoints, TC.FP.PID);
         if (index > -1)
         {
             TC.FP.X          = ControlPoints[index].X;
             TC.FP.Y          = ControlPoints[index].Y;
             TC.FP.IsControlP = true;
         }
         index = Tool_Class.Belong(ControlPoints, TC.BP.PID);
         if (index > -1)
         {
             TC.BP.X          = ControlPoints[index].X;
             TC.BP.Y          = ControlPoints[index].Y;
             TC.BP.IsControlP = true;
         }
     }
     //将当前点信息添加到测站信息
     foreach (StationClass TC in StationInfos)
     {
         int SP_index, FP_index, BP_index;
         SP_index = Tool_Class.Belong(StartPoints, TC.SP.PID);
         if (SP_index > -1)
         {
             TC.SP = StartPoints[SP_index];
         }
         FP_index = Tool_Class.Belong(StartPoints, TC.FP.PID);
         if (SP_index > -1)
         {
             TC.FP = StartPoints[FP_index];
         }
         BP_index = Tool_Class.Belong(StartPoints, TC.BP.PID);
         if (BP_index > -1)
         {
             TC.BP = StartPoints[BP_index];
         }
     }
     //添加已知两点的方位角
     foreach (StationClass TC in StationInfos)
     {
         if (TC.SP.IsControlP && TC.BP.IsControlP)
         {
             TC.BAzimuth = Tool_Class.IIPointFW(TC.SP, TC.BP);
             TC.DisB     = Tool_Class.distIIP(TC.SP, TC.BP);
         }
         if (TC.SP.IsControlP && TC.FP.IsControlP)
         {
             TC.FAzimuth = Tool_Class.IIPointFW(TC.SP, TC.FP);
             TC.DisF     = Tool_Class.distIIP(TC.SP, TC.FP);
         }
     }
 }
Exemplo n.º 17
0
        public List <PointClass> IICoordTans(List <PointClass> SourcePoints, List <PointClass> TargetPoints, List <PointClass> IIDimTarPoints)
        {
            int Index = 0;
            List <PointClass> CommonP = new List <PointClass>();

            //计算公共点,并将公共点存到COMMONp
            foreach (PointClass TP in SourcePoints)
            {
                Index = Tool_Class.Belong(TargetPoints, TP.PID);//获取原坐标点在目标坐标系中的索引值
                if (Index != -1)
                {
                    CommonP.Add(new PointClass
                    {
                        PID       = TP.PID,
                        X         = TP.X,
                        Y         = TP.Y,
                        IsCommonP = true
                    });
                }
            }

            //确定旋转电与参照点:计算最远距离点,从而确定了旋转点(第0个元素)与参照点(第一个元素)点号
            string[]   sArray   = new string[2];    //记录旋转点与参照点名
            PointClass SRotateP = new PointClass(); //源坐标旋转点
            PointClass SRefP    = new PointClass(); //源坐标参照点
            PointClass TRotateP = new PointClass(); //目标坐标旋转点
            PointClass TRefP    = new PointClass(); //目标坐标参照点

            sArray   = Tool_Class.DistMaxListP(CommonP);
            Index    = Tool_Class.Belong(CommonP, sArray[0]);
            SRotateP = CommonP[Index];
            Index    = Tool_Class.Belong(CommonP, sArray[1]);
            SRefP    = CommonP[Index];
            //////////////////////////////////////////////
            double sfw = Tool_Class.IIPointFW(SRotateP, SRefP); //确定源坐标两个点(旋转点和参照点)方位角
            double sd  = Tool_Class.distIIP(SRotateP, SRefP);   //确定源坐标两个点(旋转点和参照点)距离

            ////////////获取目标系的旋转点与参照点
            Index    = Tool_Class.Belong(TargetPoints, sArray[0]);
            TRotateP = TargetPoints[Index];
            Index    = Tool_Class.Belong(TargetPoints, sArray[1]);
            TRefP    = TargetPoints[Index];
            ////////////////
            double Tfw   = Tool_Class.IIPointFW(TRotateP, TRefP); //确定源坐标两个点(旋转点和参照点)方位角
            double Td    = Tool_Class.distIIP(TRotateP, TRefP);   //确定源坐标两个点(旋转点和参照点)距离
            double detfw = Tfw - sfw;
            double k     = Td / sd - 1;
            //定义基线向量的矩阵
            Matrix sBase = new Matrix(2, SourcePoints.Count);
            Matrix tBase = new Matrix(2, SourcePoints.Count);

            //计算源坐标系中各点相对于旋转点的基线向量,并将其扩大到(k+1)后存储到sBase矩阵中
            for (Index = 0; Index < SourcePoints.Count; Index++)
            {
                double Bx = (SourcePoints[Index].X - SRotateP.X) * (1 + k);
                double By = (SourcePoints[Index].Y - SRotateP.Y) * (1 + k);
                sBase.SetNum(0, Index, Bx);
                sBase.SetNum(1, Index, By);
            }
            //计算旋转矩阵
            Matrix R = new Matrix(2, 2);

            R.SetNum(0, 0, Math.Cos(detfw));
            R.SetNum(0, 1, -Math.Sin(detfw));
            R.SetNum(1, 0, 1 * Math.Sin(detfw));
            R.SetNum(1, 1, Math.Cos(detfw));
            //对sBase中的基线向量进行旋转放到tBase中
            tBase = Matrix.Mutiply(R, sBase);
            //平移后,最终结果放到IIDimTraPoints
            for (Index = 0; Index < SourcePoints.Count; Index++)
            {
                IIDimTarPoints.Add(new PointClass
                {
                    PID = SourcePoints[Index].PID,
                    X   = TRotateP.X + tBase.getNum(0, Index),
                    Y   = TRotateP.Y + tBase.getNum(1, Index)
                });
            }
            return(CommonP);
        }