Example #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);
 }
Example #2
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);
            }
        }
Example #3
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;
         }
     }
 }
Example #4
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);
            }
        }
Example #5
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;//得到测边数
        }
Example #6
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); //更新未知点
        }
Example #7
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);
         }
     }
 }
Example #8
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);
        }