/// <summary>
 /// Mark坐标定位 试矫正
 /// </summary>
 private void Mark_AFF_Correction()
 {
     if (Calibration.Calibrate_Mark(0))
     {
         //解析DXF文件
         ResolveData();
         //判断是否存在加工轨迹偏移轨迹
         if (File_Entity_Datas.LayerSectionDatas.Count <= 0)
         {
             StopEvent?.Invoke();
             return;
         }
         //Mark定位 检测是否Mark是否在相机视野
         //重新梳理定位Mark信息
         if (MarkType == 1)                              // 1 - 整块板定位(取4角)
         {
             File_Entity_Datas.PlatformMarkInfo.Clear(); //清空平台Mark坐标
             foreach (var o in File_Entity_Datas.DxfMarkInfo)
             {
                 File_Entity_Datas.PlatformMarkInfo.Add(new Vector(o.X + File_Entity_Datas.Mark.X, o.Y + File_Entity_Datas.Mark.Y));
             }
         }
         else if (MarkType == 2)// 2 - 阵列文件定位(小分区取4角);
         {
             for (int i = 0; i < File_Entity_Datas.LayerSectionDatas.Count; i++)
             {
                 for (int j = 0; j < File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas.Count; j++)
                 {
                     File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].PlatformMarkInfo.Clear();//清空平台Mark坐标
                     foreach (var o in File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].DxfMarkInfo)
                     {
                         File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].PlatformMarkInfo.Add(new Vector(o.X + File_Entity_Datas.Mark.X, o.Y + File_Entity_Datas.Mark.Y));
                     }
                 }
             }
         }
         //验证视野是否存在Mark图形
         if (MarkType == 1)// 1 - 整块板定位(取4角)
         {
             //Mark点位数量异常
             if ((File_Entity_Datas.PlatformMarkInfo.Count < 3) || (File_Entity_Datas.DxfMarkInfo.Count < 3))
             {
                 MessageBox.Show("Mark定位点位数据异常!!!");
                 return;
             }
             //验证
             for (int i = 0; i < File_Entity_Datas.PlatformMarkInfo.Count; i++)
             {
                 //定位到Mark点
                 Program.SystemContainer.GTS_Fun.Gts_Ready_Correct(File_Entity_Datas.PlatformMarkInfo[i]);
                 //调用相机,获取对比的坐标信息
                 Thread.Sleep(50);                                                                                                                          //延时50ms
                 Cam = new Vector(Program.SystemContainer.T_Client.Get_Cam_Deviation_Coordinate_Correct(Program.SystemContainer.SysPara.Camera_Mark_Type)); //触发拍照
                 if (Cam.Length == 0)
                 {
                     MessageBox.Show("相机坐标提取失败,请检查!!!");
                     return(null);
                 }
             }
         }
         else if (MarkType == 2)// 2 - 阵列文件定位(小分区取4角);
         {
             //处理数据
             for (int i = 0; i < File_Entity_Datas.LayerSectionDatas.Count; i++)
             {
                 for (int j = 0; j < File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas.Count; j++)
                 {
                     //验证
                 }
             }
         }
         appendInfo("Mark点矫正完成!!!");
         return;
     }
     else
     {
         appendInfo("Mark点矫正失败!!!");
         return;
     }
 }
        /// <summary>
        /// Mark定位 矫正偏转
        /// </summary>
        /// <param name="File_Entity_Datas"></param>
        /// <returns></returns>
        public bool CalibrateFileData(File_Entity_Data File_Entity_Datas)
        {
            Affinity_Matrix Matrix = new Affinity_Matrix();

            //重新梳理Mark信息
            if (MarkType == 1)                              // 1 - 整块板定位(取4角)
            {
                File_Entity_Datas.PlatformMarkInfo.Clear(); //清空平台Mark坐标
                foreach (var o in File_Entity_Datas.DxfMarkInfo)
                {
                    File_Entity_Datas.PlatformMarkInfo.Add(new Vector(o.X + File_Entity_Datas.Mark.X, o.Y + File_Entity_Datas.Mark.Y));
                }
            }
            else if (MarkType == 2)// 2 - 阵列文件定位(小分区取4角);
            {
                for (int i = 0; i < File_Entity_Datas.LayerSectionDatas.Count; i++)
                {
                    for (int j = 0; j < File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas.Count; j++)
                    {
                        File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].PlatformMarkInfo.Clear();//清空平台Mark坐标
                        foreach (var o in File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].DxfMarkInfo)
                        {
                            File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].PlatformMarkInfo.Add(new Vector(o.X + File_Entity_Datas.Mark.X, o.Y + File_Entity_Datas.Mark.Y));
                        }
                    }
                }
            }
            //计算偏转参数
            if (MarkType == 1)// 1 - 整块板定位(取4角)
            {
                //Mark点位数量异常
                if ((File_Entity_Datas.PlatformMarkInfo.Count < 3) || (File_Entity_Datas.DxfMarkInfo.Count < 3))
                {
                    MessageBox.Show("Mark定位点位数据异常!!!");
                    return(false);
                }
                //获取整图偏转参数
                Matrix = Calibration.Calibrate_Mark(File_Entity_Datas.DxfMarkInfo, File_Entity_Datas.PlatformMarkInfo);
                if (Matrix == null)
                {
                    return(false);               //Mark校准失败
                }
                //处理所有分区数据
                for (int i = 0; i < File_Entity_Datas.LayerSectionDatas.Count; i++)
                {
                    for (int j = 0; j < File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas.Count; j++)
                    {
                        File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].ArcLine    = DataResolve.CalDataByMatrix(File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].ArcLine, Matrix, true);
                        File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].Circle     = DataResolve.CalDataByMatrix(File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].Circle, Matrix, true);
                        File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].LWPolyline = DataResolve.CalDataByMatrix(File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].LWPolyline, Matrix, true);
                    }
                }
            }
            else if (MarkType == 2)// 2 - 每个小分区定位
            {
                //处理数据
                for (int i = 0; i < File_Entity_Datas.LayerSectionDatas.Count; i++)
                {
                    for (int j = 0; j < File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas.Count; j++)
                    {
                        //Mark点位数量异常
                        if ((File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].PlatformMarkInfo.Count < 3) || (File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].DxfMarkInfo.Count < 3))
                        {
                            MessageBox.Show("Mark定位点位数据异常!!!");
                            return(false);
                        }
                        //获取小分区偏转参数
                        Matrix = Calibration.Calibrate_Mark(File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].DxfMarkInfo, File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].PlatformMarkInfo);
                        if (Matrix == null)
                        {
                            return(false);               //Mark校准失败
                        }
                        //处理所有分区数据
                        File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].ArcLine    = DataResolve.CalDataByMatrix(File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].ArcLine, Matrix, true);
                        File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].Circle     = DataResolve.CalDataByMatrix(File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].Circle, Matrix, true);
                        File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].LWPolyline = DataResolve.CalDataByMatrix(File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].LWPolyline, Matrix, true);
                    }
                }
            }
            else//无Mark定位校准数据处理
            {
                //处理数据
                for (int i = 0; i < File_Entity_Datas.LayerSectionDatas.Count; i++)
                {
                    for (int j = 0; j < File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas.Count; j++)
                    {
                        File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].ArcLine    = DataResolve.CalDataByMatrix(File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].ArcLine, Matrix, false);
                        File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].Circle     = DataResolve.CalDataByMatrix(File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].Circle, Matrix, false);
                        File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].LWPolyline = DataResolve.CalDataByMatrix(File_Entity_Datas.LayerSectionDatas[i].SectionEntityDatas[j].LWPolyline, Matrix, false);
                    }
                }
            }
            //分区数据计算
            File_Entity_Datas = DataResolve.SeperateFileData(File_Entity_Datas);
            //返回
            return(true);
        }