|
|
@@ -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;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|