|
@@ -90,6 +90,8 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
{
|
|
|
return m_StageEdgeGDIObjects[0];
|
|
|
}
|
|
|
+ public float GetZoomNum() { return m_StageEdgeGDIObjects[0].GetZoomNumber(); }
|
|
|
+ public PointF GetDisplayRefPoint() { return m_StageEdgeGDIObjects[0].GetDisplayRefPoint(); }
|
|
|
|
|
|
public CRectangleGDIObject GetHoleGDIBySampleName(string name)
|
|
|
{
|
|
@@ -216,7 +218,7 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
}
|
|
|
public PointF GetCenterPointF()
|
|
|
{
|
|
|
- var item = m_StageEdgeGDIObjects[0].GetRegionF();
|
|
|
+ var item = m_StageEdgeGDIObjects[0].GetZoomedRegionF();
|
|
|
//声明中心点变量
|
|
|
PointF pCenterPoint = new Point();
|
|
|
//获取在工作窗口中X,Y位置
|
|
@@ -257,15 +259,15 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
|
|
|
Bourary = GetCtrlCoordRectF(stageLeftTop, stageRightBottom);
|
|
|
|
|
|
- CreateRectangle CreateBourary;
|
|
|
+ CRectangleGDIObject CreateBourary;
|
|
|
//0:圆角矩形 1:圆形 2:文字 3:矩形
|
|
|
if (SData.bStageShape == (ShapeType.RECTANGLE))
|
|
|
{
|
|
|
- CreateBourary = new CreateRectangle(Bourary, CreateRectangleType.SampleBackGround_Rectangle);
|
|
|
+ CreateBourary = new CRectangleGDIObject(Bourary, CreateRectangleType.SampleBackGround_Rectangle);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- CreateBourary = new CreateRectangle(Bourary, CreateRectangleType.Circle);
|
|
|
+ CreateBourary = new CRectangleGDIObject(Bourary, CreateRectangleType.Circle);
|
|
|
}
|
|
|
|
|
|
//添加样品台 对象
|
|
@@ -274,11 +276,11 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
|
|
|
if (StageShape == (int)CreateRectangleType.Circle)
|
|
|
{
|
|
|
- MeasurePath.AddEllipse(CreateBourary.GetRegion);
|
|
|
+ MeasurePath.AddEllipse(CreateBourary.GetZoomedRegion);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- MeasurePath.AddRectangle(CreateBourary.GetRegion);
|
|
|
+ MeasurePath.AddRectangle(CreateBourary.GetZoomedRegion);
|
|
|
}
|
|
|
CreateBourary.GPath = MeasurePath;
|
|
|
CreateBourary.Shape = StageShape;
|
|
@@ -306,39 +308,39 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
float heightHole = Math.Abs(yHole.Y - xHole.Y);
|
|
|
var RecF = GetCtrlCoordRectF(xHole, yHole);
|
|
|
//获取矩形
|
|
|
- CreateRectangle CreateHole = null;
|
|
|
+ CRectangleGDIObject CreateHole = null;
|
|
|
//0:圆角矩形 1:圆形 2:文字 3:矩形
|
|
|
if (ChloeClrList[i].iSHoleShape == (int)CreateRectangleType.SampleBackGround_Rectangle)
|
|
|
{
|
|
|
- CreateHole = new CreateRectangle(RecF, CreateRectangleType.Rectangle);
|
|
|
+ CreateHole = new CRectangleGDIObject(RecF, CreateRectangleType.Rectangle);
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- CreateHole = new CreateRectangle(RecF, CreateRectangleType.Circle);
|
|
|
+ CreateHole = new CRectangleGDIObject(RecF, CreateRectangleType.Circle);
|
|
|
}
|
|
|
|
|
|
//绘制样品孔路径
|
|
|
- GraphicsPath HolePath = new GraphicsPath();
|
|
|
- if (ChloeClrList[i].iSHoleShape == (int)CreateRectangleType.Circle)
|
|
|
- {
|
|
|
- HolePath.AddEllipse(CreateHole.GetRegion);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- HolePath.AddRectangle(CreateHole.GetRegion);
|
|
|
- }
|
|
|
- CreateHole.GPath = HolePath;
|
|
|
+ //GraphicsPath HolePath = new GraphicsPath();
|
|
|
+ //if (ChloeClrList[i].iSHoleShape == (int)CreateRectangleType.Circle)
|
|
|
+ //{
|
|
|
+ // HolePath.AddEllipse(CreateHole.GetZoomedRegion);
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // HolePath.AddRectangle(CreateHole.GetZoomedRegion);
|
|
|
+ //}
|
|
|
+ //CreateHole.GPath = HolePath;
|
|
|
CreateHole.Name= ChloeClrList[i].sSHoleName;
|
|
|
m_SampleHoleGDIObjects.Add(CreateHole);
|
|
|
|
|
|
//添加文字
|
|
|
|
|
|
|
|
|
- CreateRectangle CreateContent = GetCtrlCoordRect(xHole, yHole, CreateRectangleType.Rectangle, "", "");
|
|
|
+ CRectangleGDIObject CreateContent = GetCtrlCoordRect(xHole, yHole, CreateRectangleType.Rectangle, "", "");
|
|
|
//类型 文字:2
|
|
|
CreateContent.CreateType = CreateRectangleType.Text;
|
|
|
- CreateContent.SetRegionF(CreateContent.GetRegionF());
|
|
|
+ CreateContent.SetInitRegionF(CreateContent.GetZoomedRegionF());
|
|
|
CreateContent.strContent = ChloeClrList[i].sSHoleName;
|
|
|
CreateContent.Name = ChloeClrList[i].sSHoleName;
|
|
|
m_ContentGDIObjects.Add(CreateContent);
|
|
@@ -350,7 +352,7 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
stageRightBottom = new PointF(SData.SampleRect.Right, SData.SampleRect.Bottom);
|
|
|
|
|
|
//获取矩形
|
|
|
- CreateRectangle CreateSTD;
|
|
|
+ CRectangleGDIObject CreateSTD;
|
|
|
if (StageShapes == (int)CreateRectangleType.Circle)
|
|
|
{
|
|
|
CreateSTD = GetCtrlCoordRect(stageLeftTop, stageRightBottom, CreateRectangleType.SpecimenCircle, "", "");
|
|
@@ -361,16 +363,16 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
}
|
|
|
|
|
|
//绘制标样路径
|
|
|
- GraphicsPath STDPath = new GraphicsPath();
|
|
|
- if (StageShapes == (int)CreateRectangleType.Circle)
|
|
|
- {
|
|
|
- STDPath.AddEllipse(CreateSTD.GetRegion);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- STDPath.AddRectangle(CreateSTD.GetRegion);
|
|
|
- }
|
|
|
- CreateSTD.GPath = STDPath;
|
|
|
+ //GraphicsPath STDPath = new GraphicsPath();
|
|
|
+ //if (StageShapes == (int)CreateRectangleType.Circle)
|
|
|
+ //{
|
|
|
+ // STDPath.AddEllipse(CreateSTD.GetZoomedRegion);
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // STDPath.AddRectangle(CreateSTD.GetZoomedRegion);
|
|
|
+ //}
|
|
|
+ //CreateSTD.GPath = STDPath;
|
|
|
m_SpecimenGDIObjects.Add(CreateSTD);
|
|
|
return;
|
|
|
}
|
|
@@ -380,17 +382,17 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
NLog.LogManager.GetCurrentClassLogger().Error( ex.ToString() );
|
|
|
}
|
|
|
}
|
|
|
- public CreateRectangle GetCtrlCoordRect(PointF OTSLeftTop, PointF OTSRightBottom, CreateRectangleType type, string content, string name)
|
|
|
+ public CRectangleGDIObject GetCtrlCoordRect(PointF OTSLeftTop, PointF OTSRightBottom, CreateRectangleType type, string content, string name)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
//将微米信息 转换为 像素
|
|
|
PointF xPoints = new Point();
|
|
|
PointF yPoints = new Point();
|
|
|
- xPoints.X = (int)MillimetersToPixelsWidth(OTSLeftTop.X );
|
|
|
- xPoints.Y = (int)MillimetersToPixelsWidth( OTSLeftTop.Y );
|
|
|
- yPoints.X = (int)MillimetersToPixelsWidth( OTSRightBottom.X );
|
|
|
- yPoints.Y = (int)MillimetersToPixelsWidth(OTSRightBottom.Y);
|
|
|
+ xPoints.X =(float) MicronConvertToPixel(OTSLeftTop.X );
|
|
|
+ xPoints.Y = (float)MicronConvertToPixel( OTSLeftTop.Y );
|
|
|
+ yPoints.X = (float)MicronConvertToPixel( OTSRightBottom.X );
|
|
|
+ yPoints.Y = (float)MicronConvertToPixel(OTSRightBottom.Y);
|
|
|
//计算位置
|
|
|
xPoints = (PointF)CalculateLocationF(xPoints);
|
|
|
yPoints = CalculateLocationF(yPoints);
|
|
@@ -402,11 +404,11 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
float realEndY = Math.Max(xPoints.Y, yPoints.Y);
|
|
|
|
|
|
//创建矩形 并返回类型对象
|
|
|
- return new CreateRectangle(realStartX, realStartY, realEndX - Math.Abs(realStartX), realEndY - Math.Abs(realStartY), type, content, name);
|
|
|
+ return new CRectangleGDIObject(realStartX, realStartY, realEndX - Math.Abs(realStartX), realEndY - Math.Abs(realStartY), type, content, name);
|
|
|
}
|
|
|
catch (Exception)
|
|
|
{
|
|
|
- return new CreateRectangle(new Rectangle(), 0, "");
|
|
|
+ return new CRectangleGDIObject(new Rectangle(), 0, "");
|
|
|
}
|
|
|
}
|
|
|
public RectangleF GetCtrlCoordRectF(PointF OTSLeftTop, PointF OTSRightBottom)
|
|
@@ -418,10 +420,10 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
//将微米信息 转换为 像素
|
|
|
PointF leftTop = new PointF();
|
|
|
PointF rightBottom = new PointF();
|
|
|
- leftTop.X = (float)MillimetersToPixelsWidth( OTSLeftTop.X);
|
|
|
- leftTop.Y = (float)MillimetersToPixelsWidth( OTSLeftTop.Y);
|
|
|
- rightBottom.X = (float)MillimetersToPixelsWidth( OTSRightBottom.X);
|
|
|
- rightBottom.Y = (float)MillimetersToPixelsWidth(OTSRightBottom.Y);
|
|
|
+ leftTop.X = (float)MicronConvertToPixel( OTSLeftTop.X);
|
|
|
+ leftTop.Y = (float)MicronConvertToPixel( OTSLeftTop.Y);
|
|
|
+ rightBottom.X = (float)MicronConvertToPixel( OTSRightBottom.X);
|
|
|
+ rightBottom.Y = (float)MicronConvertToPixel(OTSRightBottom.Y);
|
|
|
//计算位置
|
|
|
leftTop = CalculateLocationF(leftTop );
|
|
|
rightBottom = CalculateLocationF(rightBottom);
|
|
@@ -446,23 +448,103 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
public PointF CalculateLocationF(PointF point)
|
|
|
{
|
|
|
//获取窗体的高度与宽度
|
|
|
- int screenWidth = m_totalCtrlWidth;
|
|
|
- int screenHeight = m_totalCtrlHeight;
|
|
|
+ int ctrlWidth = m_totalCtrlWidth;
|
|
|
+ int ctrlHeight = m_totalCtrlHeight;
|
|
|
//获取屏幕中心点
|
|
|
PointF pointXY = new PointF();
|
|
|
- PointF screenPoint = new PointF(screenWidth / 2, screenHeight / 2);
|
|
|
+ PointF screenPoint = new PointF(ctrlWidth / 2, ctrlHeight / 2);
|
|
|
pointXY.X = screenPoint.X + point.X;
|
|
|
- pointXY.Y = screenPoint.Y - point.Y;
|
|
|
+ pointXY.Y = screenPoint.Y - point.Y;//using minus because the coordinate system defference of OTS system and control system.
|
|
|
return pointXY;
|
|
|
}
|
|
|
|
|
|
|
|
|
- public double MillimetersToPixelsWidth( double PointVal)
|
|
|
+ public double MicronConvertToPixel(double PointVal)
|
|
|
{
|
|
|
|
|
|
var v = m_VisualStageEdgeLength;
|
|
|
return PointVal / ((double)m_OTSCoordStageEdgeLength / v);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ //public PointF OTSCoordToCtrlCoord(PointF point)
|
|
|
+ //{
|
|
|
+ // var x = MicronConvertToPixel(point.X);
|
|
|
+ // var y = MicronConvertToPixel(point.Y);
|
|
|
+ // return CalculateLocationF(new PointF((float)x, (float)y));
|
|
|
+
|
|
|
+ //}
|
|
|
+
|
|
|
+
|
|
|
+ //public PointF CtrlCoordToOTSCoord(PointF point)
|
|
|
+ //{
|
|
|
+ // var ctrlcenter = m_StageEdgeGDIObjects[0].GetCenterPoint();
|
|
|
+ // var x = PixelConvertToMicron(point.X-ctrlcenter.X);
|
|
|
+ // var y = PixelConvertToMicron(-(point.Y-ctrlcenter.Y));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //}
|
|
|
+
|
|
|
+ public PointF CalculateOTSLocation(PointF p1)
|
|
|
+ {
|
|
|
+ float OTSWholeWidth = m_OTSCoordStageEdgeLength;
|
|
|
+ float OTSWholeHeight = m_OTSCoordStageEdgeLength;
|
|
|
+ //获取屏幕中心点
|
|
|
+ PointF pointXY = new PointF();
|
|
|
+ PointF centerPoint = new PointF(0, 0);
|
|
|
+ pointXY.X = centerPoint.X + p1.X;
|
|
|
+ pointXY.Y = centerPoint.Y + p1.Y;
|
|
|
+ return pointXY;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public RectangleF GetOTSCoordRegionF(PointF ctrlLeftTop, PointF ctrlRightBottom)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var ctrlcenter = m_StageEdgeGDIObjects[0].GetCenterPoint();
|
|
|
+
|
|
|
+
|
|
|
+ //将微米信息 转换为 像素
|
|
|
+ PointF leftTop = new PointF();
|
|
|
+ PointF rightBottom = new PointF();
|
|
|
+ leftTop.X = (float)PixelConvertToMicron(ctrlLeftTop.X-ctrlcenter.X);
|
|
|
+ leftTop.Y = (float)PixelConvertToMicron((ctrlLeftTop.Y-ctrlcenter.Y));
|
|
|
+ rightBottom.X = (float)PixelConvertToMicron(ctrlRightBottom.X-ctrlcenter.X);
|
|
|
+ rightBottom.Y = (float)PixelConvertToMicron((ctrlRightBottom.Y-ctrlcenter.Y));
|
|
|
+ //计算位置
|
|
|
+ leftTop = CalculateOTSLocation(leftTop);
|
|
|
+ rightBottom = CalculateOTSLocation(rightBottom);
|
|
|
+
|
|
|
+ //获取OTS图形四个点
|
|
|
+ float realStartX = Math.Min(leftTop.X, rightBottom.X);
|
|
|
+ float realStartY = Math.Min(leftTop.Y, rightBottom.Y);
|
|
|
+ float realEndX = Math.Max(leftTop.X, rightBottom.X);
|
|
|
+ float realEndY = Math.Max(leftTop.Y, rightBottom.Y);
|
|
|
+
|
|
|
+ //创建矩形 并返回类型对象
|
|
|
+ return new RectangleF(realStartX, -realEndY, realEndX - realStartX, realEndY - realStartY);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ return new RectangleF();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public float PixelConvertToMicron(float Pixel)
|
|
|
+ {
|
|
|
+ return (float)(Pixel * ((double)m_OTSCoordStageEdgeLength / m_VisualStageEdgeLength));
|
|
|
+ }
|
|
|
+
|
|
|
internal void DecreaseSampleCount(string sampleName)
|
|
|
{
|
|
|
foreach (var hole in m_SampleHoleGDIObjects)
|
|
@@ -488,33 +570,12 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
|
|
|
|
|
|
}
|
|
|
- public bool AddSample(SampleMeasurePara SMeasurePara, float globalZoomNum, out CVisualSampleArea a_visualSample)
|
|
|
+ public bool GetVisualSampleArea(SampleMeasurePara SMeasurePara, out CVisualSampleArea a_visualSample)
|
|
|
{
|
|
|
- PointF xHole = new PointF(SMeasurePara.MeasureRect.Left, SMeasurePara.MeasureRect.Top);
|
|
|
- PointF yHole = new PointF(SMeasurePara.MeasureRect.Right, SMeasurePara.MeasureRect.Bottom);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- RectangleF SampleRectangleF = GetCtrlCoordRectF(xHole, yHole);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- CRectangleGDIObject sampleGDIObject = GetCtrlCoordRect(xHole, yHole, (CreateRectangleType)SMeasurePara.iShape, "", "");
|
|
|
- sampleGDIObject.SetRegionF(SampleRectangleF);
|
|
|
- //测量区域名称 样品名称
|
|
|
- sampleGDIObject.SampleName = SMeasurePara.sSampleName;
|
|
|
- //测量区域类型
|
|
|
- sampleGDIObject.CreateType = (CreateRectangleType)SMeasurePara.iShape;
|
|
|
- string SampleHoleName = SMeasurePara.sampleHoleName;
|
|
|
- string SampleName = SMeasurePara.sSampleName;
|
|
|
-
|
|
|
- CRectangleGDIObject measureGDIObject;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
|
|
|
+
|
|
|
//设置样品选择状态为非工作样品
|
|
|
-
|
|
|
+ string SampleHoleName = SMeasurePara.sampleHoleName;
|
|
|
var item = GetSampleHoleGdiobjByName(SampleHoleName);
|
|
|
|
|
|
if (item != null)
|
|
@@ -522,49 +583,46 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
//设置颜色
|
|
|
string ColorStr = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleSelColor);
|
|
|
Color selColor = ColorTranslator.FromHtml(ColorStr);
|
|
|
- CreateRectangle NewSample = new CreateRectangle(item.OrigionalDrawRegionF, CreateRectangleType.SelectSample, item.Shape, item.Name, selColor);
|
|
|
+
|
|
|
//累加样品数量
|
|
|
item.SampleCount += 1;
|
|
|
item.IsWorkSample = true;
|
|
|
- NewSample.SampleName = SampleName;
|
|
|
- NewSample.Name = item.Name;
|
|
|
- //设置当前添加的样品为工作样品
|
|
|
- NewSample.IsWorkSample = true;
|
|
|
- // 获取样品孔的大小与初始大小
|
|
|
-
|
|
|
- NewSample.SetRegionF(item.OrigionalDrawRegionF);
|
|
|
-
|
|
|
- //绘制样品路径
|
|
|
- GraphicsPath NewSamplePath = new GraphicsPath();
|
|
|
- if (NewSample.Shape == (int)CreateRectangleType.Circle)
|
|
|
- {
|
|
|
- NewSamplePath.AddEllipse(NewSample.GetRegion);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- NewSamplePath.AddRectangle(NewSample.GetRegion);
|
|
|
- }
|
|
|
- NewSample.GPath = NewSamplePath;
|
|
|
|
|
|
+
|
|
|
|
|
|
-
|
|
|
+ CRectangleGDIObject sampleGDIObject = item.Duplicate(CreateRectangleType.SelectSample);
|
|
|
|
|
|
+ sampleGDIObject.sampleName = SMeasurePara.sSampleName;
|
|
|
|
|
|
- //获取测量区域尺寸与位置
|
|
|
- measureGDIObject = GetSampleMeasureInfo(NewSample, sampleGDIObject, globalZoomNum);
|
|
|
- //设置样品孔名称
|
|
|
- measureGDIObject.Name = item.Name;
|
|
|
- //根据节点设置样品台窗口中所选择的样品名称
|
|
|
+ sampleGDIObject.SelColor = selColor;
|
|
|
+;
|
|
|
|
|
|
- //添加测量区域
|
|
|
+ //GraphicsPath NewSamplePath = new GraphicsPath();
|
|
|
+ //if (sampleGDIObject.Shape == (int)CreateRectangleType.Circle)
|
|
|
+ //{
|
|
|
+ // NewSamplePath.AddEllipse(sampleGDIObject.GetZoomedRegion);
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // NewSamplePath.AddRectangle(sampleGDIObject.GetZoomedRegion);
|
|
|
+ //}
|
|
|
+ //sampleGDIObject.GPath = NewSamplePath;
|
|
|
+
|
|
|
+ //add the default measure area from config file.
|
|
|
|
|
|
CRectangleGDIObject newMeasureGDIObject;
|
|
|
- AddMeasurePath(measureGDIObject, out newMeasureGDIObject);
|
|
|
+ PointF xHole = new PointF(SMeasurePara.MeasureRect.Left, SMeasurePara.MeasureRect.Top);
|
|
|
+ PointF yHole = new PointF(SMeasurePara.MeasureRect.Right, SMeasurePara.MeasureRect.Bottom);
|
|
|
+
|
|
|
+ RectangleF SampleRectangleF = GetCtrlCoordRectF(xHole, yHole);
|
|
|
+
|
|
|
+ GetMeasureGdiObject(sampleGDIObject, SampleRectangleF, out newMeasureGDIObject);
|
|
|
+
|
|
|
var newsample = new CVisualSampleArea();
|
|
|
|
|
|
|
|
|
|
|
|
- newsample.SampleGDIObject = NewSample;
|
|
|
+ newsample.SampleGDIObject = sampleGDIObject;
|
|
|
newsample.MeasureGDIObject = newMeasureGDIObject;
|
|
|
a_visualSample = newsample;
|
|
|
return true;
|
|
@@ -584,45 +642,86 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
|
|
|
}
|
|
|
#region 根据样品位置 获取测量区域位置
|
|
|
- public CRectangleGDIObject GetSampleMeasureInfo(CRectangleGDIObject NewSample, CRectangleGDIObject m_MeasureGDIObjects, float globalZoomNum)
|
|
|
+
|
|
|
+ public SampleMeasurePara GetSampleMeasurePara(CRectangleGDIObject MeasureItem)
|
|
|
{
|
|
|
- //根据样品位置 获取测量区域位置
|
|
|
-
|
|
|
|
|
|
- float MeasureFPointX = (float)(NewSample.OrigionalDrawRegionF.Location.X + (NewSample.OrigionalDrawRegionF.Size.Width - m_MeasureGDIObjects.OrigionalDrawRegionF.Width*globalZoomNum) / 2);
|
|
|
- float MeasureFPointY = (float)(NewSample.OrigionalDrawRegionF.Location.Y + (NewSample.OrigionalDrawRegionF.Size.Height - m_MeasureGDIObjects.OrigionalDrawRegionF.Height * globalZoomNum) / 2);
|
|
|
- float MeasureFWidth = Convert.ToSingle(m_MeasureGDIObjects.OrigionalDrawRegionF.Width * globalZoomNum);
|
|
|
- float MeasureFHeight = Convert.ToSingle(m_MeasureGDIObjects.OrigionalDrawRegionF.Height * globalZoomNum);
|
|
|
|
|
|
|
|
|
- m_MeasureGDIObjects.SetRegionF(NewSample.OrigionalDrawRegionF);
|
|
|
+ //获取测量区域的OTS位置与尺寸
|
|
|
+ //SampleMeasurePara sampleMeasurePara = GetMeasureInfo(MeasureItem);
|
|
|
+ var item = MeasureItem;
|
|
|
+
|
|
|
+ SampleMeasurePara sampleMeasurePara = new SampleMeasurePara();
|
|
|
+
|
|
|
+ //设置测量区域位置与尺寸
|
|
|
+ float left = 0;
|
|
|
+ float Top = 0;
|
|
|
+ float Right = 0;
|
|
|
+ float Bottom = 0;
|
|
|
+ float Widths = 0;
|
|
|
+ float Height = 0;
|
|
|
+ //设置测量区域位置与尺寸
|
|
|
+ //left = PixelConvertToMicron(item.OrigionalDrawRegionF.X);
|
|
|
+ //Top = PixelConvertToMicron(item.OrigionalDrawRegionF.Y);
|
|
|
+ //var p = CtrlCoordToOTSCoord(item.OrigionalDrawRegionF.Location);
|
|
|
+ //Right = PixelConvertToMicron(item.OrigionalDrawRegionF.Right);
|
|
|
+ //Bottom = PixelConvertToMicron(item.OrigionalDrawRegionF.Bottom);
|
|
|
+ //Widths = PixelConvertToMicron(item.OrigionalDrawRegionF.Width);
|
|
|
+ //Height = PixelConvertToMicron(item.OrigionalDrawRegionF.Height);
|
|
|
+
|
|
|
+ var region = this.GetOTSCoordRegionF(item.OrigionalDrawRegionF.Location, new PointF(item.OrigionalDrawRegionF.Right, item.OrigionalDrawRegionF.Bottom));
|
|
|
+ //保存原位置
|
|
|
+ RectangleF polygonRectPara = item.OrigionalDrawRegionF;
|
|
|
+ if (item.CreateType == CreateRectangleType.Polygon)
|
|
|
+ {
|
|
|
+ polygonRectPara = OTSSamplespaceGraphicsPanelFun.GetPolygonToMinRectangle(item.DrawPolygonPointRegionF);
|
|
|
+ //设置测量区域位置与尺寸
|
|
|
+ left = PixelConvertToMicron(polygonRectPara.X);
|
|
|
+ Top = PixelConvertToMicron(polygonRectPara.Y);
|
|
|
+ Right = PixelConvertToMicron(polygonRectPara.Right);
|
|
|
+ Bottom = PixelConvertToMicron(polygonRectPara.Bottom);
|
|
|
+ Widths = PixelConvertToMicron(polygonRectPara.Width);
|
|
|
+ Height = PixelConvertToMicron(polygonRectPara.Height);
|
|
|
+ }
|
|
|
+ //设置测量区域
|
|
|
+ //PointF startPoint = p;
|
|
|
+ //SizeF MeasureSize = new SizeF(Widths, Height);
|
|
|
+
|
|
|
+ sampleMeasurePara.MeasureRect = region;
|
|
|
+
|
|
|
+ //sampleMeasurePara.MeasureRect = new Rectangle(new Point((int)startPoint.X, (int)startPoint.Y), new Size((int)MeasureSize.Width, (int)MeasureSize.Height));
|
|
|
+ //设置样品孔名称
|
|
|
+ sampleMeasurePara.sampleHoleName = item.Name;
|
|
|
+ //设置样品名称
|
|
|
+ sampleMeasurePara.sSampleName = item.SampleName;
|
|
|
+ //设置测量区域形状
|
|
|
+ sampleMeasurePara.iShape = item.Shape;
|
|
|
+ //设置多边形点集合
|
|
|
+ sampleMeasurePara.PolygonPointRegion = PointFConvertPoint(ConvertPolygonPointToOTSPoint(item.PolygonPointRegionF));
|
|
|
+ sampleMeasurePara.PolygonPointRegionF = ConvertPolygonPointToOTSPoint(item.PolygonPointRegionF);
|
|
|
+ sampleMeasurePara.DrawPolygonPointRegionF = ConvertPolygonPointToOTSPoint(item.DrawPolygonPointRegionF);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
- m_MeasureGDIObjects.SetScaleRegionF(new RectangleF(new PointF(MeasureFPointX, MeasureFPointY), new SizeF(MeasureFWidth, MeasureFHeight)));
|
|
|
-
|
|
|
- return m_MeasureGDIObjects;
|
|
|
- }
|
|
|
- public SampleMeasurePara GetSampleMeasurePara(CRectangleGDIObject MeasureItem)
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
|
|
|
- //获取测量区域的OTS位置与尺寸
|
|
|
- SampleMeasurePara sampleMeasurePara = GetMeasureInfo(MeasureItem);
|
|
|
|
|
|
//获取样品台 中心点
|
|
|
PointF RectanglePointCenter = GetCenterPointF();
|
|
|
|
|
|
- //获取样品台中心点
|
|
|
- float CenterX = PixelConvertToMicron((int)RectanglePointCenter.X );
|
|
|
+ ////获取样品台中心点
|
|
|
+ float CenterX = PixelConvertToMicron((int)RectanglePointCenter.X);
|
|
|
float CenterY = PixelConvertToMicron((int)RectanglePointCenter.Y);
|
|
|
- RectangleF sampleMeasureRect = new Rectangle();
|
|
|
+ //RectangleF sampleMeasureRect = new Rectangle();
|
|
|
|
|
|
- //根据样品台中心点获取开始点位置
|
|
|
- sampleMeasureRect.X = -(CenterX - sampleMeasurePara.MeasureRect.X);
|
|
|
- sampleMeasureRect.Y = CenterY - sampleMeasurePara.MeasureRect.Bottom;
|
|
|
- sampleMeasurePara.MeasureRect.X = sampleMeasureRect.X;
|
|
|
- sampleMeasurePara.MeasureRect.Y = sampleMeasureRect.Y;
|
|
|
+ ////根据样品台中心点获取开始点位置
|
|
|
+ //sampleMeasureRect.X = -(CenterX - sampleMeasurePara.MeasureRect.X);
|
|
|
+ //sampleMeasureRect.Y = CenterY - sampleMeasurePara.MeasureRect.Bottom;
|
|
|
+ //sampleMeasurePara.MeasureRect.X = sampleMeasureRect.X;
|
|
|
+ //sampleMeasurePara.MeasureRect.Y = sampleMeasureRect.Y;
|
|
|
|
|
|
for (int i = 0; i < sampleMeasurePara.DrawPolygonPointRegionF.Count; i++)
|
|
|
{
|
|
@@ -636,54 +735,7 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
sampleMeasurePara.sampleHoleName =MeasureItem.Name;
|
|
|
return sampleMeasurePara;
|
|
|
}
|
|
|
- public SampleMeasurePara GetMeasureInfo(CRectangleGDIObject item)
|
|
|
- {
|
|
|
- SampleMeasurePara sampleMeasurePara = new SampleMeasurePara();
|
|
|
-
|
|
|
- //设置测量区域位置与尺寸
|
|
|
- float left = 0;
|
|
|
- float Top = 0;
|
|
|
- float Right = 0;
|
|
|
- float Bottom = 0;
|
|
|
- float Widths = 0;
|
|
|
- float Height = 0;
|
|
|
- //设置测量区域位置与尺寸
|
|
|
- left = PixelConvertToMicron((int)item.OrigionalDrawRegionF.X);
|
|
|
- Top = PixelConvertToMicron((int)item.OrigionalDrawRegionF.Y);
|
|
|
- Right = PixelConvertToMicron((int)item.OrigionalDrawRegionF.Right);
|
|
|
- Bottom = PixelConvertToMicron((int)item.OrigionalDrawRegionF.Bottom);
|
|
|
- Widths = PixelConvertToMicron((int)item.OrigionalDrawRegionF.Width);
|
|
|
- Height = PixelConvertToMicron((int)item.OrigionalDrawRegionF.Height);
|
|
|
- //保存原位置
|
|
|
- RectangleF polygonRectPara = item.OrigionalDrawRegionF;
|
|
|
- if (item.CreateType == CreateRectangleType.Polygon)
|
|
|
- {
|
|
|
- polygonRectPara = OTSSamplespaceGraphicsPanelFun.GetPolygonToMinRectangle(item.DrawPolygonPointRegionF);
|
|
|
- //设置测量区域位置与尺寸
|
|
|
- left = PixelConvertToMicron((int)polygonRectPara.X);
|
|
|
- Top = PixelConvertToMicron((int)polygonRectPara.Y);
|
|
|
- Right = PixelConvertToMicron((int)polygonRectPara.Right);
|
|
|
- Bottom = PixelConvertToMicron((int)polygonRectPara.Bottom);
|
|
|
- Widths = PixelConvertToMicron((int)polygonRectPara.Width);
|
|
|
- Height = PixelConvertToMicron((int)polygonRectPara.Height);
|
|
|
- }
|
|
|
- //设置测量区域
|
|
|
- PointF startPoint = new PointF(left, Top);
|
|
|
- SizeF MeasureSize = new SizeF(Widths, Height);
|
|
|
- sampleMeasurePara.MeasureRect = new Rectangle(new Point((int)startPoint.X, (int)startPoint.Y), new Size((int)MeasureSize.Width, (int)MeasureSize.Height));
|
|
|
- //设置样品孔名称
|
|
|
- sampleMeasurePara.sampleHoleName = item.Name;
|
|
|
- //设置样品名称
|
|
|
- sampleMeasurePara.sSampleName = item.SampleName;
|
|
|
- //设置测量区域形状
|
|
|
- sampleMeasurePara.iShape = item.Shape;
|
|
|
- //设置多边形点集合
|
|
|
- sampleMeasurePara.PolygonPointRegion = PointFConvertPoint(ConvertPolygonPointToOTSPoint(item.PolygonPointRegionF));
|
|
|
- sampleMeasurePara.PolygonPointRegionF = ConvertPolygonPointToOTSPoint(item.PolygonPointRegionF);
|
|
|
- sampleMeasurePara.DrawPolygonPointRegionF = ConvertPolygonPointToOTSPoint(item.DrawPolygonPointRegionF);
|
|
|
-
|
|
|
- return sampleMeasurePara;
|
|
|
- }
|
|
|
+
|
|
|
public List<PointF> ConvertPolygonPointToOTSPoint(List<PointF> polygonPointList)
|
|
|
{
|
|
|
List<PointF> OTSPoint = new List<PointF>();
|
|
@@ -700,10 +752,7 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
}
|
|
|
return OTSPoint;
|
|
|
}
|
|
|
- public float PixelConvertToMicron(int Pixel)
|
|
|
- {
|
|
|
- return (float)(Pixel * ((double)m_OTSCoordStageEdgeLength / m_VisualStageEdgeLength));
|
|
|
- }
|
|
|
+
|
|
|
public List<Point> PointFConvertPoint(List<PointF> Points)
|
|
|
{
|
|
|
List<Point> PointFs = new List<Point>();
|
|
@@ -748,41 +797,54 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
/// <param name="IsIsDragging">是否选择样品 0:未选择 1:选择</param>
|
|
|
/// <param name="sampleName">样品名称</param>
|
|
|
/// <returns>是否成功</returns>
|
|
|
- public bool AddMeasurePath( CRectangleGDIObject MeasureGDIObject,out CRectangleGDIObject outMeasureRect)
|
|
|
+ public bool GetMeasureGdiObject( CRectangleGDIObject sampleGDIObject,RectangleF newRegion, out CRectangleGDIObject outMeasureRect)
|
|
|
{
|
|
|
|
|
|
//添加测量区域
|
|
|
- CreateRectangleType shape = MeasureGDIObject.CreateType;
|
|
|
- GraphicsPath MeasurePath = new GraphicsPath();
|
|
|
- if (shape == CreateRectangleType.Rectangle)
|
|
|
- {
|
|
|
- MeasurePath.AddRectangle(MeasureGDIObject.GetRegion);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MeasurePath.AddEllipse(MeasureGDIObject.GetRegion);
|
|
|
- }
|
|
|
- //缩小与样品的尺寸
|
|
|
- RectangleF rectMeasure = MeasureGDIObject.GetRegion;
|
|
|
+
|
|
|
+
|
|
|
Color MeasureColor = Color.Red;
|
|
|
- CreateRectangle MeasureRect = new CreateRectangle(rectMeasure, CreateRectangleType.MeasureArea, MeasureGDIObject.Shape, MeasureGDIObject.Name, MeasureGDIObject.SampleName, MeasureColor);
|
|
|
- MeasureRect.GPath = MeasurePath;
|
|
|
- MeasureRect.sampleName = MeasureGDIObject.SampleName;
|
|
|
- MeasureRect.Name = MeasureGDIObject.Name;
|
|
|
- //获取缩放前尺寸与位置
|
|
|
- MeasureRect.SetRegionF(MeasureGDIObject.OrigionalDrawRegionF);
|
|
|
- MeasureRect.SetScaleRegionF(MeasureGDIObject.GetRegionF ());
|
|
|
+ var MeasureRect = sampleGDIObject.Duplicate(CreateRectangleType.MeasureArea);
|
|
|
+ MeasureRect.SetInitRegionF(newRegion);
|
|
|
+
|
|
|
+ MeasureRect.SelColor = MeasureColor;
|
|
|
+
|
|
|
|
|
|
|
|
|
outMeasureRect = MeasureRect;
|
|
|
return true;
|
|
|
|
|
|
+ }
|
|
|
+ public bool GetMeasureGdiObject(CRectangleGDIObject sampleGDIObject, out CRectangleGDIObject outMeasureRect)
|
|
|
+ {
|
|
|
+
|
|
|
+ //添加测量区域
|
|
|
+ CreateRectangleType shape = sampleGDIObject.CreateType;
|
|
|
+ GraphicsPath MeasurePath = new GraphicsPath();
|
|
|
+ if (shape == CreateRectangleType.Rectangle)
|
|
|
+ {
|
|
|
+ MeasurePath.AddRectangle(sampleGDIObject.GetZoomedRegion);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MeasurePath.AddEllipse(sampleGDIObject.GetZoomedRegion);
|
|
|
+ }
|
|
|
+
|
|
|
+ Color MeasureColor = Color.Red;
|
|
|
+ var MeasureRect = sampleGDIObject.Duplicate(CreateRectangleType.MeasureArea);
|
|
|
+ MeasureRect.GPath = MeasurePath;
|
|
|
+ MeasureRect.SelColor = MeasureColor;
|
|
|
+
|
|
|
+
|
|
|
+ outMeasureRect = MeasureRect;
|
|
|
+ return true;
|
|
|
+
|
|
|
}
|
|
|
#endregion
|
|
|
public bool CheckMeasureAreaIsBeyondStageArea(RectangleF RMeasureArea)
|
|
|
{
|
|
|
otsdataconst.DOMAIN_SHAPE iShape = (otsdataconst.DOMAIN_SHAPE)m_StageEdgeGDIObjects[0].CreateType;
|
|
|
- RectangleF pStageArea = m_StageEdgeGDIObjects[0].GetRegion;
|
|
|
+ RectangleF pStageArea = m_StageEdgeGDIObjects[0].GetZoomedRegion;
|
|
|
Rectangle pMeasureArea = new Rectangle((int)RMeasureArea.Left, (int)RMeasureArea.Top, (int)RMeasureArea.Width, (int)RMeasureArea.Height);
|
|
|
|
|
|
|
|
@@ -815,9 +877,9 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
{
|
|
|
|
|
|
var domain = GetOTSSampleStageData().StageDomain;
|
|
|
- PointF rectLocation = m_StageEdgeGDIObjects[0].GetRegion.Location;
|
|
|
+ PointF rectLocation = m_StageEdgeGDIObjects[0].GetZoomedRegion.Location;
|
|
|
//样品台尺寸
|
|
|
- SizeF rectSize = m_StageEdgeGDIObjects[0].GetRegion.Size;
|
|
|
+ SizeF rectSize = m_StageEdgeGDIObjects[0].GetZoomedRegion.Size;
|
|
|
//鼠标在工作区域中的位置
|
|
|
|
|
|
//OTS坐标中鼠标的位置
|
|
@@ -995,7 +1057,7 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
diffNewY = (int)(moveToSEMLocation.Y * m_GlobalZoomNum);
|
|
|
//根据鼠标_更改测量区域的位置
|
|
|
//item.Region = new Rectangle(new Point(item.Region.X + m_StageCenterDiffX + diffNewX, item.Region.Y + m_StageCenterDiffY - diffNewY), new Size(item.Region.Width, item.Region.Height));
|
|
|
- item.SetRegionF(new RectangleF(new PointF(item.GetRegionF().X + (m_StageCenterDiffX + diffNewX), item.GetRegionF().Y + (m_StageCenterDiffY - diffNewY)), new SizeF(item.GetRegionF().Width, item.GetRegionF().Height)));
|
|
|
+ item.SetInitRegionF(new RectangleF(new PointF(item.GetZoomedRegionF().X + (m_StageCenterDiffX + diffNewX), item.GetZoomedRegionF().Y + (m_StageCenterDiffY - diffNewY)), new SizeF(item.GetZoomedRegionF().Width, item.GetZoomedRegionF().Height)));
|
|
|
//item.DrawRegionF = new RectangleF(new PointF(item.DrawRegionF.X + (m_StageCenterDiffX + diffNewX) / m_GlobalZoomNum, item.DrawRegionF.Y + (m_StageCenterDiffY - diffNewY) / m_GlobalZoomNum), new SizeF(item.DrawRegionF.Width, item.DrawRegionF.Height));
|
|
|
}
|
|
|
}
|
|
@@ -1022,7 +1084,7 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
diffNewY = (int)(moveToSEMLocation.Y * m_GlobalZoomNum);
|
|
|
//根据鼠标_更改测量区域的位置
|
|
|
//item.Region = new Rectangle(new Point(item.Region.X + m_StageCenterDiffX + diffNewX, item.Region.Y + m_StageCenterDiffY - diffNewY), new Size(item.Region.Width, item.Region.Height));
|
|
|
- item.SetRegionF(new RectangleF(new PointF(item.GetRegionF().X + (m_StageCenterDiffX + diffNewX) / m_GlobalZoomNum, item.GetRegionF().Y + (m_StageCenterDiffY - diffNewY) / m_GlobalZoomNum), new SizeF(item.GetRegionF().Width, item.GetRegionF().Height)));
|
|
|
+ item.SetInitRegionF(new RectangleF(new PointF(item.GetZoomedRegionF().X + (m_StageCenterDiffX + diffNewX) / m_GlobalZoomNum, item.GetZoomedRegionF().Y + (m_StageCenterDiffY - diffNewY) / m_GlobalZoomNum), new SizeF(item.GetZoomedRegionF().Width, item.GetZoomedRegionF().Height)));
|
|
|
//item.DrawRegionF = item.GetRegionF();
|
|
|
//修改多边形的绘制点集合
|
|
|
if (item.CreateType == CreateRectangleType.Polygon)
|
|
@@ -1076,16 +1138,16 @@ namespace OTSMeasureApp._4_OTSSamplespaceGraphicsPanel
|
|
|
SampleHolePara sampleHolePara = new SampleHolePara();
|
|
|
|
|
|
//保存原位置
|
|
|
- RectangleF rectPara = item.GetRegion;
|
|
|
+ RectangleF rectPara = item.GetZoomedRegion;
|
|
|
//设置测量区域
|
|
|
- sampleHolePara.SampleHoleRect = item.GetRegion;
|
|
|
+ sampleHolePara.SampleHoleRect = item.GetZoomedRegion;
|
|
|
//设置测量区域位置与尺寸
|
|
|
- float left = PixelConvertToMicron((int)item.GetRegionF().X);
|
|
|
- float Top = PixelConvertToMicron((int)item.GetRegionF().Y);
|
|
|
- float Right = PixelConvertToMicron((int)item.GetRegionF().Right);
|
|
|
- float Bottom = PixelConvertToMicron((int)item.GetRegionF().Bottom);
|
|
|
- float Widths = PixelConvertToMicron((int)item.GetRegionF().Width);
|
|
|
- float Height = PixelConvertToMicron((int)item.GetRegionF().Height);
|
|
|
+ float left = PixelConvertToMicron(item.GetZoomedRegionF().X);
|
|
|
+ float Top = PixelConvertToMicron(item.GetZoomedRegionF().Y);
|
|
|
+ float Right = PixelConvertToMicron(item.GetZoomedRegionF().Right);
|
|
|
+ float Bottom = PixelConvertToMicron(item.GetZoomedRegionF().Bottom);
|
|
|
+ float Widths = PixelConvertToMicron(item.GetZoomedRegionF().Width);
|
|
|
+ float Height = PixelConvertToMicron(item.GetZoomedRegionF().Height);
|
|
|
|
|
|
PointF startPoint = new PointF(left, Top);
|
|
|
SizeF sampleHoleSize = new SizeF(Widths, Height);
|