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

The focus of the inclined plane is modified to the singleton state

cxs 1 месяц назад
Родитель
Сommit
8c6e11f8db

+ 2 - 1
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSampleParam.cs

@@ -41,7 +41,8 @@ namespace OTSDataType
             m_poImageScanParam = new COTSImgScanPrm();
             m_poImageProcessParam = new COTSImageProcParam();
             m_poXRayParam = new COTSXRayParam();
-            m_SlopParam = new CSlopFocusParam();
+            
+            //m_SlopParam = new CSlopFocusParam();
         }
         void Duplicate(CSampleParam a_oSource)
         {

+ 50 - 6
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/OTSSamplespaceWindow.cs

@@ -293,12 +293,16 @@ namespace OTSMeasureApp
 
                     break;
                 case "SlopFocusMenuItem":
-
-                    //if (slopFocus == null)
-                    //{
+                    //CSlopFocusParam slpopa = m_MeasureAppForm.m_ProjParam.GetWorkSample().GetMsrParams().SlopParam;
+                    if (slopFocus == null|| slopFocus.IsDisposed)
+                    {
                         slopFocus = new SlopFocus(this);
-                    //}
-
+                        slopFocus.FormClosed += SlopFocus_FormClosed;
+                    }
+                    else
+                    {
+                        slopFocus.Activate();
+                    }
                     slopFocus.Show();
 
                     break;
@@ -558,7 +562,44 @@ namespace OTSMeasureApp
                 PrepareVisualMeasureField(GetWorkingVisualSample());
             }
         }
+        public void DrawRectangleByLengthAndWidth()
+        {
+            frmInitializeLengthAndWidthRectangle frmInput = new frmInitializeLengthAndWidthRectangle();
+            DialogResult result = frmInput.ShowDialog();
+            if (result == DialogResult.OK)
+            {
+                double length = frmInput.length;
+                double wide = frmInput.width;
+                var sam = GetWorkingVisualSample();
+                CMeasureArea area= sam.GetMeasureGDIObject();
+                PointF center = new PointF(area.GetZoomedRegionF().Left + area.GetZoomedRegionF().Width / 2, area.GetZoomedRegionF().Top + area.GetZoomedRegionF().Height / 2);
+                PointF otslt = new PointF(), otsrb = new PointF();
+                PointF lt = new PointF((float)(center.X - m_visualStage.MicronConvertToPixel(length) / 2), (float)(center.Y - m_visualStage.MicronConvertToPixel(wide) / 2));
+                PointF rb = new PointF((float)(center.X + m_visualStage.MicronConvertToPixel(length) / 2), (float)(center.Y + m_visualStage.MicronConvertToPixel(wide) / 2));
+
+                m_visualStage.m_SEMStageData.ConvertSEMToOTSCoord(lt, ref otslt);
+                m_visualStage.m_SEMStageData.ConvertSEMToOTSCoord(rb, ref otsrb);
 
+                var visualRec = m_visualStage.GetCtrlCoordRectF(otslt, otsrb);
+                Color MeasureColor = Color.Red;
+                CMeasureArea newGDI = new CMeasureArea(visualRec, ShapeType.RECTANGLE, "", sam.GetSampleName(), MeasureColor);
+
+                newGDI.SetZoomNumber(m_visualStage.GetZoomNum());
+                newGDI.SetDisplayRefPoint(m_visualStage.GetDisplayRefPoint());
+                newGDI.IsWorkSample = true;
+                sam.SetMeasureGDIObject(newGDI);
+                m_DrawPolygonFinishGDIObject = null;
+                m_DrawMeasureGDIObject = null;
+                var para = m_visualStage.GetSampleMeasurePara(sam.GetMeasureGDIObject());
+
+
+
+
+
+                SetWorkSampleMeasureArea(para);
+                PrepareVisualMeasureField(GetWorkingVisualSample());
+            }
+        }
         public void SetWorkSampleMeasureArea(SampleMeasurePara SMeasurePara)
         {
             COTSSample WSample = m_MeasureAppForm.m_ProjParam.GetResultData().GetWorkingSample();
@@ -3574,7 +3615,10 @@ namespace OTSMeasureApp
         {
             this.OnMouseMove(e);
         }
-
+        private void SlopFocus_FormClosed(object sender, FormClosedEventArgs e)
+        {
+            slopFocus = null;
+        }
 
     }
 }