XYConvertManager.cs 25.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSA_V.Common;

namespace TSA_V.DeviceLibrary
{
    public class XYConvertManager
    {
        public static int BoundsWidth = 1920;
        public static int BoundsHeight = 1080;
        private static List<ConBaseInfo> conList = null;
        public static List<ConBaseInfo> ConList
        {
            get
            {
                if (conList == null)
                {
                    try
                    {
                        conList = JsonHelper.DeserializeJsonToObject<List<ConBaseInfo>>(Setting_NInit.Data_LastCalibrateInfo);
                    }
                    catch (Exception ex)
                    {
                        LogUtil.error("转换lastCalibrateBean出错:" + ex.ToString());
                    }
                }
                return conList;

            }
            set
            {
                conList = value;
                Setting_NInit.Data_LastCalibrateInfo = JsonHelper.SerializeObject(conList);
            }
        }

        public static void SaveData(BoardInfo board)
        {
            List<ConBaseInfo> data = new List<ConBaseInfo>() {
                new ConBaseInfo(new Point(0,0),board.calInfo.leftUpPoint),
                new ConBaseInfo(new Point(board.boardWidth,board.boardLength),board.calInfo.rightBottomPoint),
                };
        }



        public static SMTPointInfo CalPointNodePosition(SMTPointInfo smtPoint, List<SMTPointInfo> checkOKList)
        {
            try
            {
                if (smtPoint.CheckOK && Setting_NInit.Work_UseCheckOK)
                {
                    //校准点不再自动计算
                    return smtPoint;
                }
                if (checkOKList.Count < 2)
                {
                    return smtPoint;
                }
                double oldX = smtPoint.NodePositionX;
                double oldY = smtPoint.NodePositionY;
                //SMTPointInfo APoint = GetPoint(smtPoint, checkOKList);

                //SMTPointInfo BPoint = GetPoint(APoint, checkOKList);
                SMTPointInfo APoint = checkOKList[0];
                SMTPointInfo BPoint = checkOKList[1];



                //计算坐标    
                if (Math.Abs(smtPoint.PositionX - APoint.PositionX) < 0.01)
                {
                    smtPoint.NodePositionX = APoint.NodePositionX;
                }
                else
                {
                    smtPoint.NodePositionX = APoint.NodePositionX + (BPoint.NodePositionX - APoint.NodePositionX) * (smtPoint.PositionX - APoint.PositionX) / (BPoint.PositionX - APoint.PositionX);
                    if (double.IsNaN(smtPoint.NodePositionX) || double.IsInfinity(smtPoint.NodePositionX))
                    {
                        smtPoint.NodePositionX = APoint.NodePositionX;
                    }
                }
                if (Math.Abs(smtPoint.PositionY - APoint.PositionY) < 0.01)
                {
                    smtPoint.NodePositionY = APoint.NodePositionY;
                }
                else
                {
                    smtPoint.NodePositionY = APoint.NodePositionY + (BPoint.NodePositionY - APoint.NodePositionY) * (smtPoint.PositionY - APoint.PositionY) / (BPoint.PositionY - APoint.PositionY);
                    if (double.IsNaN(smtPoint.NodePositionY) || double.IsInfinity(smtPoint.NodePositionY))
                    {
                        smtPoint.NodePositionY = APoint.NodePositionY;
                    }
                }
                if (smtPoint.NodePositionX <= 0)
                {
                    smtPoint.NodePositionX = 1;
                }
                else if (smtPoint.NodePositionX > BoundsWidth)
                {
                    smtPoint.NodePositionX = BoundsWidth;
                }
                if (smtPoint.NodePositionY <= 0)
                {
                    smtPoint.NodePositionY = 1;
                }
                else if (smtPoint.NodePositionY > BoundsHeight)
                {
                    smtPoint.NodePositionY = BoundsHeight;
                }

                if (smtPoint.PointSizeX < 1 || smtPoint.PointSizeX > 255)
                {
                    smtPoint.PointSizeX = Setting_NInit.Device_DefaultPointSize;
                }
                if (smtPoint.PointSizeY < 1 || smtPoint.PointSizeY > 255)
                {
                    smtPoint.PointSizeY = Setting_NInit.Device_DefaultPointSize;
                }


                double xXishu = (BPoint.NodePositionX - APoint.NodePositionX) / (BPoint.PositionX - APoint.PositionX);
                double yXishu = (BPoint.NodePositionY - APoint.NodePositionY) / (BPoint.PositionY - APoint.PositionY);
                //计算点大小
                if (smtPoint.imgP?.uTime > smtPoint.pUTime)
                {
                    smtPoint.PointSizeX = (int)((BPoint.NodePositionX - APoint.NodePositionX) * smtPoint.imgP.SizeX / (BPoint.PositionX - APoint.PositionX));
                    smtPoint.PointSizeY = (int)((BPoint.NodePositionY - APoint.NodePositionY) * smtPoint.imgP.SizeY / (BPoint.PositionY - APoint.PositionY));
                    smtPoint.PenWidth = (int)((BPoint.NodePositionX - APoint.NodePositionX) * smtPoint.imgP.PWidth / (BPoint.PositionX - APoint.PositionX));

                }

                //smtPoint.PointSize = 4;
                //smtPoint.NodePositionX = BPoint.NodePositionX - (BPoint.NodePositionX - APoint.NodePositionX) * (BPoint.PositionX - smtPoint.PositionX) / (BPoint.PositionX - APoint.PositionX);
                //smtPoint.NodePositionY = BPoint.NodePositionY - (BPoint.NodePositionY - APoint.NodePositionY) * (BPoint.PositionY - smtPoint.PositionY) / (BPoint.PositionY - APoint.PositionY);
                LogUtil.debug($" 【{smtPoint.PN}】图片坐标【{smtPoint.PositionX},{smtPoint.PositionY}】旧坐标【{oldX},{oldY}】新坐标【{smtPoint.NodePositionX},{smtPoint.NodePositionY}】" +
                    $"点尺寸({smtPoint.PointSizeX},{smtPoint.PointSizeY}),画笔宽{smtPoint.PenWidth}");
                return smtPoint;

            }
            catch (Exception ex)
            {
                LogUtil.error(" 【" + smtPoint.PN + "】图片坐标【" + smtPoint.PositionX + "," + smtPoint.PositionY + "】校准坐标出错:" + ex.ToString());

            }
            return smtPoint;
        }


        //public static Point CalPCBAreaNodePosition(Point position, List<SMTPointInfo> checkOKList, int type)
        //{
        //    Point nodePosition = new Point(0,0);
        //    try
        //    {
               
        //        if (checkOKList.Count < 2)
        //        {
        //            return nodePosition;
        //        }  
        //        SMTPointInfo APoint = checkOKList[0];
        //        SMTPointInfo BPoint = checkOKList[1];
                 
        //        //计算坐标    
        //        if (Math.Abs(position.X - APoint.PositionX) < 0.01)
        //        {
        //            nodePosition.X =(int) APoint.NodePositionX;
        //        }
        //        else
        //        {
        //            nodePosition.X =(int)( APoint.NodePositionX + (BPoint.NodePositionX - APoint.NodePositionX) * (position.X - APoint.PositionX) / (BPoint.PositionX - APoint.PositionX));
        //            if (double.IsNaN(nodePosition.X) || double.IsInfinity(nodePosition.X))
        //            {
        //                nodePosition.X =(int) APoint.NodePositionX;
        //            }
        //        }
        //        if (Math.Abs(position.Y - APoint.PositionY) < 0.01)
        //        {
        //            nodePosition.Y = (int)APoint.NodePositionY;
        //        }
        //        else
        //        {
        //            nodePosition.Y =(int)( APoint.NodePositionY + (BPoint.NodePositionY - APoint.NodePositionY) * (position.Y - APoint.PositionY) / (BPoint.PositionY - APoint.PositionY));
        //            if (double.IsNaN(nodePosition.Y) || double.IsInfinity(nodePosition.Y))
        //            {
        //                nodePosition.Y =(int) APoint.NodePositionY;
        //            }
        //        }
        //        if (nodePosition.X <= 0)
        //        {
        //            nodePosition.X = 1;
        //        }
        //        else if (nodePosition.X > BoundsWidth)
        //        {
        //            nodePosition.X = BoundsWidth;
        //        }
        //        if (nodePosition.Y <= 0)
        //        {
        //            nodePosition.Y = 1;
        //        }
        //        else if (nodePosition.Y > BoundsHeight)
        //        {
        //            nodePosition.Y = BoundsHeight;
        //        }
                  
        //        //LogUtil.info($" 【{smtPoint.PN}】图片坐标【{smtPoint.PositionX},{smtPoint.PositionY}】旧坐标【{oldX},{oldY}】新坐标【{smtPoint.NodePositionX},{smtPoint.NodePositionY}】" +
        //        //    $"点尺寸({smtPoint.PointSizeX},{smtPoint.PointSizeY}),画笔宽{smtPoint.PenWidth}");
        //        //return smtPoint;

        //    }
        //    catch (Exception ex)
        //    {
        //        LogUtil.error(" CalPointNodePosition 多PCB基准点计算错误【 图片坐标【" + position.X + "," + position.Y + "】校准坐标出错:" + ex.ToString());

        //    }
        //    return nodePosition;
        //}

        public static Point CalPCBAreaNodePosition(DPoint position, List<SMTPointInfo> checkOKList, int type)
        {
            DPoint nodePosition = new DPoint(0, 0);
            try
            {

                if (checkOKList.Count < 2)
                {
                    return nodePosition.ToPoint();
                }
                SMTPointInfo APoint = checkOKList[0];
                SMTPointInfo BPoint = checkOKList[1];

                //计算坐标    
                if (Math.Abs(position.X - APoint.PositionX) < 0.01)
                {
                    nodePosition.X = APoint.NodePositionX;
                }
                else
                {
                    nodePosition.X = (APoint.NodePositionX + (BPoint.NodePositionX - APoint.NodePositionX) * (position.X - APoint.PositionX) / (BPoint.PositionX - APoint.PositionX));
                    if (double.IsNaN(nodePosition.X) || double.IsInfinity(nodePosition.X))
                    {
                        nodePosition.X = APoint.NodePositionX;
                    }
                }
                if (Math.Abs(position.Y - APoint.PositionY) < 0.01)
                {
                    nodePosition.Y = APoint.NodePositionY;
                }
                else
                {
                    nodePosition.Y = (APoint.NodePositionY + (BPoint.NodePositionY - APoint.NodePositionY) * (position.Y - APoint.PositionY) / (BPoint.PositionY - APoint.PositionY));
                    if (double.IsNaN(nodePosition.Y) || double.IsInfinity(nodePosition.Y))
                    {
                        nodePosition.Y = APoint.NodePositionY;
                    }
                }
                if (nodePosition.X <= 0)
                {
                    nodePosition.X = 1;
                }
                else if (nodePosition.X > BoundsWidth)
                {
                    nodePosition.X = BoundsWidth;
                }
                if (nodePosition.Y <= 0)
                {
                    nodePosition.Y = 1;
                }
                else if (nodePosition.Y > BoundsHeight)
                {
                    nodePosition.Y = BoundsHeight;
                }

                //LogUtil.info($" 【{smtPoint.PN}】图片坐标【{smtPoint.PositionX},{smtPoint.PositionY}】旧坐标【{oldX},{oldY}】新坐标【{smtPoint.NodePositionX},{smtPoint.NodePositionY}】" +
                //    $"点尺寸({smtPoint.PointSizeX},{smtPoint.PointSizeY}),画笔宽{smtPoint.PenWidth}");
                //return smtPoint;

            }
            catch (Exception ex)
            {
                LogUtil.error(" CalPointNodePosition DPoint 多PCB基准点计算错误【 图片坐标【" + position.X + "," + position.Y + "】校准坐标出错:" + ex.ToString());

            }
            return nodePosition.ToPoint();
        }
        //private SMTPointInfo GetPoint(SMTPointInfo smtPoint, List<SMTPointInfo> checkOKList)
        //{
        //    SMTPointInfo p = null;
        //    double maxPingFang = 0;
        //    foreach (SMTPointInfo sm in checkOKList)
        //    {
        //        if (sm.pointNum.Equals(smtPoint.pointNum))
        //        {
        //            continue;
        //        }
        //        double xjuli = sm.PositionX - smtPoint.PositionX;
        //        double yjuli = sm.PositionY - smtPoint.PositionY;
        //        double cping = xjuli * xjuli + yjuli * yjuli;
        //        if (cping > maxPingFang)
        //        {
        //            p = sm;
        //            maxPingFang = cping;
        //            continue;
        //        }
        //    }
        //    if (p != null)
        //    {
        //        return p;
        //    }
        //    return null;
        //}


        public static List<ProjectorPInfo> GetCopyProjectPointCR(BoardInfo board, SMTPointInfo sMTPoint = null)
        {
            List<SMTPointInfo> pointList = GetCopyPointCR(board, sMTPoint);
            List<ProjectorPInfo> projectorPInfoList = new List<ProjectorPInfo>();
            foreach (SMTPointInfo point in pointList)
            {
                ProjectorPInfo projectorPInfo = point.GetScreenShowPInfo();
                projectorPInfoList.Add(projectorPInfo);
            }
            return projectorPInfoList;
        }

        /// <summary>
        /// 多板拷贝点,返回板子区域,每个板子返回四个点。
        /// </summary>
        /// <param name="board"></param>
        /// <param name="sMTPoint"></param>
        /// <param name="targetRow"></param>
        /// <param name="targetCol"></param>
        /// <param name="targetRowValue"></param>
        /// <param name="targetColValue"></param>
        /// <returns></returns>
        public static List<List<Point>> GetCopyArea(BoardInfo board, int targetRow = 0, int targetCol = 0, int targetRowValue = 0, int targetColValue = 0)
        {
            List<List<Point>> result = new List<List<Point>>();
            if (board == null || board.calInfo == null || board.calInfo.leftUpPoint == null || board.calInfo.rightBottomPoint == null)
            {
                return result;
            }
            try
            {
                result.Add(new List<Point>() { board.calInfo.leftUpPoint, board.calInfo.rightBottomPoint });
                List<SMTPointInfo> checkOKList = board.getCalPoint();

                if (board == null || checkOKList == null || checkOKList.Count < 2 || board.PCBCount == 1)
                {
                    return result;
                }

                if (board.pcbRow <= 1 && board.pcbCol <= 1)
                {
                    return result;
                }

                int pcbRow = targetRow > 0 ? targetRow : board.pcbRow;
                int pcbCol = targetCol > 0 ? targetCol : board.pcbCol;
                double pcbColValue = targetColValue > 0 ? targetColValue : board.pcbColValue;
                double pcbRowValue = targetRowValue > 0 ? targetRowValue : board.pcbRowValue;
                for (int currR = 1; currR <= pcbRow; currR++)
                {
                    for (int currC = 1; currC <= pcbCol; currC++)
                    {
                        int index = (currR - 1) * pcbCol + currC;
                        if (index == 1) continue; // PCB1 为基准


                        // 默认按均匀间距计算
                        double dx = (currC - 1) * pcbColValue;
                        double dy = (currR - 1) * pcbRowValue;
                        double dA = 0;//默认角度都是0
                        // 若设置了某个PCB相对PCB1的偏移,则覆盖默认值
                        try
                        {
                            if (board.mPCbOffsetMap != null && board.mPCbOffsetMap.ContainsKey(index))
                            {
                                var pOffset = board.mPCbOffsetMap[index];
                                dx = pOffset.X;
                                dy = pOffset.Y;
                                dA = pOffset.A;
                            }
                        }
                        catch { }

                        //返回四个角的坐标(左上角不偏移,以左上角为基准进行角度旋转)
                        DPoint leftPoint1 = new DPoint(dx, dy);
                        DPoint rightPoint2 = new DPoint(dx + board.boardWidth, dy);
                        DPoint leftPoint3 = new DPoint(dx, dy + board.boardLength);
                        DPoint rightPoint4 = new DPoint(dx + board.boardWidth, dy + board.boardLength); 

                        if (dA > 0 && dA <= 360)
                        {
                            //(double, double) newPo1 = RotatePoint(leftPoint1.X, leftPoint1.Y, 0, 0, dA);
                            //leftPoint1.X = (int)newPo1.Item1;
                            //leftPoint1.Y = (int)newPo1.Item2;

                            rightPoint2 = RotatePoint(rightPoint2.X, rightPoint2.Y, leftPoint1.X, leftPoint1.Y, dA);
                             
                            leftPoint3 = RotatePoint(leftPoint3.X, leftPoint3.Y, leftPoint1.X, leftPoint1.Y, dA);

                            rightPoint4 = RotatePoint(rightPoint4.X, rightPoint4.Y, leftPoint1.X, leftPoint1.Y, dA); 
                        }

                        if (checkOKList != null)
                        {
                            Point leftNodePoint1 = XYConvertManager.CalPCBAreaNodePosition(leftPoint1, checkOKList, 1);
                            Point rightNodePoint2 = XYConvertManager.CalPCBAreaNodePosition(rightPoint2, checkOKList, 2);
                            Point leftNodePoint3 = XYConvertManager.CalPCBAreaNodePosition(leftPoint3, checkOKList, 3);
                            Point rightNodePoint4 = XYConvertManager.CalPCBAreaNodePosition(rightPoint4, checkOKList, 4);

                            result.Add(new List<Point>() { leftNodePoint1, rightNodePoint2,  rightNodePoint4, leftNodePoint3 });
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogUtil.error("获取" + board.boardName + "拷贝点出错:" + ex.ToString());
            }
            finally
            {

            }
            return result;
        }

        /// <summary>
        /// 多板拷贝点
        /// </summary>
        /// <param name="board"></param>
        /// <param name="sMTPoint"></param>
        /// <param name="targetRow"></param>
        /// <param name="targetCol"></param>
        /// <param name="targetRowValue"></param>
        /// <param name="targetColValue"></param>
        /// <returns></returns>
        public static List<SMTPointInfo> GetCopyPointCR(BoardInfo board, SMTPointInfo sMTPoint = null,int targetRow=0,int targetCol=0,int targetRowValue=0,int targetColValue=0)
        {
            List<SMTPointInfo> pointList = new List<SMTPointInfo>();
            try
            {

                List<SMTPointInfo> basePoints = new List<SMTPointInfo>();
                if (sMTPoint == null)
                {
                    if (board != null)
                    {

                        basePoints = new List<SMTPointInfo>(board.GetSmtList());
                    }
                    else
                    {

                        return pointList;
                    }
                }
                else
                {
                    basePoints.Add(sMTPoint);
                }
                List<SMTPointInfo> checkOKList = null;
                try
                {
                    if (board.calInfo != null)
                    {
                        checkOKList = board.getCalPoint();
                    }
                }
                catch (Exception ex)
                {
                    LogUtil.error("获取" + board.boardName + "校准点出错:" + ex.ToString());
                }
                if (board == null || checkOKList == null || checkOKList.Count < 2)
                {
                    return pointList;
                }
                pointList.AddRange(basePoints);
                int baseCount = basePoints.Count;
                string msg = "";

                if (board.pcbRow <= 1 && board.pcbCol <= 1)
                {
                    return pointList;
                }
                int pcbRow =targetRow>0?targetRow: board.pcbRow; 
                int pcbCol = targetCol > 0?targetCol: board.pcbCol; 
                double pcbColValue = targetColValue > 0?targetColValue: board.pcbColValue;
                double pcbRowValue = targetRowValue > 0 ? targetRowValue: board.pcbRowValue;
          
                for (int currR = 1; currR <= pcbRow; currR++)
                {
                    for (int currC = 1; currC <= pcbCol; currC++)
                    {
                        int index = (currR - 1) * pcbCol + currC;
                        if (index == 1) continue; // PCB1 为基准
                        // 默认按均匀间距计算 
                        double dx = (currC - 1) * pcbColValue;
                        double dy = (currR - 1) * pcbRowValue;
                        double dA = 0;
                        // 若设置了某个PCB相对PCB1的偏移,则覆盖默认值
                        try
                        {
                            if (board.mPCbOffsetMap != null && board.mPCbOffsetMap.ContainsKey(index))
                            {
                                var pOffset = board.mPCbOffsetMap[index];
                                dx = pOffset.X;
                                dy = pOffset.Y;
                                dA = pOffset.A;
                            }
                        }
                        catch { }
                        foreach (SMTPointInfo point in basePoints)
                        {
                            SMTPointInfo newPoint = new SMTPointInfo(point);
                            newPoint.pointNum = baseCount + point.pointNum;
                           
                            newPoint.PositionX = newPoint.PositionX + dx;
                            newPoint.PositionY = newPoint.PositionY + dy;
                            newPoint.Group = index;
                            newPoint.TagNo = point.TagNo + "-" + index;
                            newPoint.PointSizeX = point.PointSizeX;
                            newPoint.CheckOK = false;

                            if (dA > 0 && dA <= 360)
                            {
                                //以单块电路板的左上角为基准点进行旋转
                                DPoint newPo = RotatePoint(newPoint.PositionX, newPoint.PositionY, dx, dy, dA);
                                newPoint.PositionX = newPo.X;
                                newPoint.PositionY = newPo.Y;
                            }


                            if (checkOKList != null)
                            {
                                try { newPoint = XYConvertManager.CalPointNodePosition(newPoint, checkOKList); } catch { }
                            }
                            msg += "\r\n" + point.pointName + "_" + point.PN + $",更改组={index} , X={newPoint.PositionX},Y={newPoint.PositionY},投影X={newPoint.NodePositionX},投影Y={newPoint.NodePositionY}";
                            pointList.Add(newPoint);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogUtil.error("获取" + board.boardName + "拷贝点出错:" + ex.ToString());
            }
            finally
            {

            }
            return pointList;
        }
        /// <summary>
        /// xy绕过X2,Y2旋转angle后的坐标
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="x2">X2,Y2默认是板子左上角。</param>
        /// <param name="y2"></param>
        /// <param name="angleInDegrees"></param>
        /// <returns></returns>
        public static  DPoint RotatePoint(double x, double y, double x2, double y2, double angleInDegrees)
        {
            double angleInRadians = angleInDegrees * (Math.PI / 180.0);
            double cosTheta = Math.Cos(angleInRadians);
            double sinTheta = Math.Sin(angleInRadians);

            double newX = cosTheta * (x - x2) - sinTheta * (y - y2) + x2;
            double newY = sinTheta * (x - x2) + cosTheta * (y - y2) + y2;

            return new DPoint(Math.Round(newX, 2), Math.Round(newY, 2));
        }
    }

    public class ConBaseInfo
    {
        public ConBaseInfo()
        {

        }
        public ConBaseInfo(Point point1,Point point2)
        {
            this.IPoint = point1;
            this.Point = point2;
        }
        /// <summary>
        /// 板子实际坐标
        /// </summary>
        public Point IPoint = new Point();
        /// <summary>
        /// 投影对应坐标
        /// </summary>
        public Point Point = new Point(); 
    }
}