Просмотр исходного кода

三点法正确显示圆形修改

CXS 3 лет назад
Родитель
Сommit
c98a526cde

+ 9 - 11
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -1136,13 +1136,13 @@ namespace OTSMeasureApp
                     if (m_PolygonPoint.Count == 3)
                     {
                         //转为圆形这里
-                        m_DrawMeasureType = (int)CreateRectangleType.Circle;
+                        //m_DrawMeasureType = (int)CreateRectangleType.Circle;
                         float r = 0;
                         PointF Centerpoint = new PointF();
                         GetTriangleExcenterRadius(m_PolygonPoint[0], m_PolygonPoint[1], m_PolygonPoint[2], out r, out Centerpoint);
                         RectangleF rectangleThree = new RectangleF(new PointF(Centerpoint.X-r, Centerpoint.Y-r), new SizeF(r*2, r*2));
                         //在样品台内部缩放
-                        if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(new Rectangle(new Point((int)(Centerpoint.X - r), (int)(Centerpoint.Y - r)), new Size((int)r * 2, (int)r * 2)), m_RectangleGDIObjects[0].Region, m_DrawMeasureType))
+                        if (OTSSamplespaceGraphicsPanelFun.CheckMeasureAreaIsBeyondStageArea(new Rectangle(new Point((int)(Centerpoint.X - r), (int)(Centerpoint.Y - r)), new Size((int)r * 2, (int)r * 2)), m_RectangleGDIObjects[0].Region, (int)CreateRectangleType.Circle))
                         {
                             m_IsDrawMeasure = true;
                         }
@@ -1152,7 +1152,7 @@ namespace OTSMeasureApp
                             return;
                         }
                         Color MeasureColor = Color.Red;
-                        CreateRectangle createRectangle = new CreateRectangle(rectangleThree, m_PolygonPoint[0], (int)CreateRectangleType.MeasureArea, m_DrawMeasureType, sampleName, sampleName, MeasureColor);
+                        CreateRectangle createRectangle = new CreateRectangle(rectangleThree, m_PolygonPoint[0], (int)CreateRectangleType.CircleByThreePoints, m_DrawMeasureType, sampleName, sampleName, MeasureColor);
                         //在鼠标点击时添加一个默认大小与位置的图形
                         createRectangle.RegionF = createRectangle.Region;
                         createRectangle.DrawRegionF = createRectangle.Region;
@@ -1160,6 +1160,10 @@ namespace OTSMeasureApp
                         {
                             m_DrawMeasureGDIObjects[0] = createRectangle;
                         }
+                        else
+                        {
+                            m_DrawMeasureGDIObjects.Add(createRectangle);
+                        }
 
                         //清除当前的样品测量区域
                         for (int measureIndex = m_MeasureGDIObjects.Count - 1; measureIndex >= 0; measureIndex--)
@@ -1178,6 +1182,8 @@ namespace OTSMeasureApp
                                 m_SingleGDIObjects.RemoveAt(singleIndex);
                             }
                         }
+                        m_MeasureGDIObjects.Add(m_DrawMeasureGDIObjects[0]);
+                        m_DrawMeasureGDIObjects.Clear();
                         //设置手绘标识
                         m_IsDrawMeasureReady = false;
                         this.Cursor = Cursors.Default;
@@ -2502,14 +2508,6 @@ namespace OTSMeasureApp
             //SEM中心位置
             MouseUpFucntion(m_SEMCenterGDIObjects, e);
 
-            if (m_DrawMeasureType == (int)CreateRectangleType.CircleByThreePoints)
-            {
-                if (m_PolygonPoint.Count == 3)
-                {
-                    m_DrawMeasureType = (int)CreateRectangleType.Circle;
-                }
-            }
-
             //撤回原样品孔中
             if (IsContains == 0)
             {