|
|
@@ -29,12 +29,12 @@ namespace OTSMeasureApp
|
|
|
/// <param name="height">高度</param>
|
|
|
/// <param name="cType">图形类型:createType=0 圆角矩形 createType=1 圆形 createType=2 文字</param>
|
|
|
/// <param name="content">文字内容</param>
|
|
|
- public CDisplayGDIObject(float startx, float starty, float width, float height, CreateRectangleType cType, string content, string name)
|
|
|
+ public CDisplayGDIObject(float startx, float starty, float width, float height, GDIType cType, string content, string name)
|
|
|
{
|
|
|
var rec = new RectangleF(startx, starty, width, height);
|
|
|
m_OrigineRegionF = rec;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
- CreateType = cType;
|
|
|
+ GDIType = cType;
|
|
|
strContent = content;
|
|
|
NameOrHoleName = name;
|
|
|
ID = System.Guid.NewGuid().ToString();
|
|
|
@@ -42,87 +42,59 @@ namespace OTSMeasureApp
|
|
|
OTSY = -1;
|
|
|
}
|
|
|
|
|
|
- public CDisplayGDIObject(RectangleF rect, CreateRectangleType cType)
|
|
|
+ public CDisplayGDIObject(RectangleF rect, GDIType cType)
|
|
|
{
|
|
|
|
|
|
m_OrigineRegionF = rect;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
- CreateType = cType;
|
|
|
+ GDIType = cType;
|
|
|
ID = System.Guid.NewGuid().ToString();
|
|
|
|
|
|
OTSX = -1;
|
|
|
OTSY = -1;
|
|
|
}
|
|
|
- public CDisplayGDIObject(RectangleF rect, CreateRectangleType cType, string name)
|
|
|
+ public CDisplayGDIObject(RectangleF rect, GDIType cType, string name)
|
|
|
{
|
|
|
|
|
|
m_OrigineRegionF = rect;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
- CreateType = cType;
|
|
|
+ GDIType = cType;
|
|
|
NameOrHoleName = name;
|
|
|
ID = System.Guid.NewGuid().ToString();
|
|
|
OTSX = -1;
|
|
|
OTSY = -1;
|
|
|
}
|
|
|
|
|
|
- public CDisplayGDIObject(RectangleF rect, CreateRectangleType cType, ShapeType shape, string name, Color selColor)
|
|
|
+ public CDisplayGDIObject(RectangleF rect, GDIType cType, string name, Color selColor)
|
|
|
{
|
|
|
|
|
|
m_OrigineRegionF = rect;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
- CreateType = cType;
|
|
|
+ GDIType = cType;
|
|
|
NameOrHoleName = name;
|
|
|
- Shape = shape;
|
|
|
+
|
|
|
SelColor = selColor;
|
|
|
ID = System.Guid.NewGuid().ToString();
|
|
|
OTSX = -1;
|
|
|
OTSY = -1;
|
|
|
}
|
|
|
- public CDisplayGDIObject(RectangleF rectMeasure, CreateRectangleType cType, ShapeType shape, string name, string sampleName, Color selColor)
|
|
|
- {
|
|
|
-
|
|
|
- m_OrigineRegionF = rectMeasure;
|
|
|
- SetInitRegionF(m_OrigineRegionF);
|
|
|
- CreateType = cType;
|
|
|
- NameOrHoleName = name;
|
|
|
- Shape = shape;
|
|
|
- SelColor = selColor;
|
|
|
-
|
|
|
- SampleName = sampleName;
|
|
|
- ID = System.Guid.NewGuid().ToString();
|
|
|
- OTSX = -1;
|
|
|
- OTSY = -1;
|
|
|
- }
|
|
|
- //绘制帧图
|
|
|
- public CDisplayGDIObject(RectangleF rectSingle, CreateRectangleType cType, string name, string sampleName, Color selColor)
|
|
|
+
|
|
|
+ //绘制小矩形
|
|
|
+ public CDisplayGDIObject(RectangleF rectSingle, GDIType cType, string name, string sampleName, Color selColor)
|
|
|
{
|
|
|
|
|
|
m_OrigineRegionF = rectSingle;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
- CreateType = cType;
|
|
|
+ GDIType = cType;
|
|
|
NameOrHoleName = name;
|
|
|
- Shape = 0;
|
|
|
+
|
|
|
SelColor = selColor;
|
|
|
SampleName = sampleName;
|
|
|
ID = System.Guid.NewGuid().ToString();
|
|
|
OTSX = -1;
|
|
|
OTSY = -1;
|
|
|
}
|
|
|
- //绘制帧图
|
|
|
- public CDisplayGDIObject(RectangleF rectField, int OTSx, int OTSy, CreateRectangleType cType, string name, string sampleName, Color selColor)
|
|
|
- {
|
|
|
-
|
|
|
- m_OrigineRegionF = rectField;
|
|
|
- SetInitRegionF(m_OrigineRegionF);
|
|
|
- CreateType = cType;
|
|
|
- NameOrHoleName = name;
|
|
|
- Shape = 0;
|
|
|
- SelColor = selColor;
|
|
|
- SampleName = sampleName;
|
|
|
- ID = System.Guid.NewGuid().ToString();
|
|
|
- OTSX = OTSx;
|
|
|
- OTSY = OTSy;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取样品孔中BSE图像
|
|
|
@@ -134,7 +106,7 @@ namespace OTSMeasureApp
|
|
|
/// <param name="bseImageHeight">图像高度</param>
|
|
|
/// <param name="drawImageLocation">图像开始位置</param>
|
|
|
/// <param name="cType">绘制类型</param>
|
|
|
- public CDisplayGDIObject(RectangleF rect, int OTSx, int OTSy, string sampleName, string sampleHoleName, float bseImageWitdh, float bseImageHeight, CreateRectangleType cType)
|
|
|
+ public CDisplayGDIObject(RectangleF rect, int OTSx, int OTSy, string sampleName, string sampleHoleName, float bseImageWitdh, float bseImageHeight, GDIType cType)
|
|
|
{
|
|
|
|
|
|
m_OrigineRegionF = rect;
|
|
|
@@ -143,8 +115,7 @@ namespace OTSMeasureApp
|
|
|
SampleName = sampleName;
|
|
|
//生成编号
|
|
|
ID = System.Guid.NewGuid().ToString();
|
|
|
- //图像信息
|
|
|
- //BSEImage = bseImage;
|
|
|
+
|
|
|
//图像宽度
|
|
|
BSEImageWitdh = bseImageWitdh;
|
|
|
//图像高度
|
|
|
@@ -154,72 +125,26 @@ namespace OTSMeasureApp
|
|
|
OTSX = OTSx;
|
|
|
OTSY = OTSy;
|
|
|
//绘制类型
|
|
|
- CreateType = cType;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public CDisplayGDIObject(RectangleF rect, Point ImgPoint, float m_Multiple, CreateRectangleType cType)
|
|
|
- {
|
|
|
-
|
|
|
- m_OrigineRegionF = rect;
|
|
|
- SetInitRegionF(m_OrigineRegionF);
|
|
|
- CreateType = cType;
|
|
|
- ID = System.Guid.NewGuid().ToString();
|
|
|
-
|
|
|
- OTSX = -1;
|
|
|
- OTSY = -1;
|
|
|
+ GDIType = cType;
|
|
|
}
|
|
|
- /// <summary>
|
|
|
- /// 获取多边形点集合
|
|
|
- /// </summary>
|
|
|
- /// <param name="mPoint"></param>
|
|
|
- /// <param name="cType"></param>
|
|
|
- public CDisplayGDIObject(List<PointF> mPoint, CreateRectangleType cType, ShapeType shape, string name, string sampleName, Color selColor)
|
|
|
- {
|
|
|
- ID = System.Guid.NewGuid().ToString();
|
|
|
|
|
|
- this.SetOriginalPolygonPointFList(mPoint);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- CreateType = cType;
|
|
|
- Shape = shape;
|
|
|
- SelColor = selColor;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
#region 变量重写
|
|
|
public virtual void OnPaint(PaintEventArgs e)
|
|
|
{
|
|
|
- if (createType == CreateRectangleType.SampleBackGround_Rectangle)
|
|
|
+ if (createType == GDIType.StageBoundary_RoundedRectangle)
|
|
|
{
|
|
|
//获取颜色
|
|
|
Color myColor = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.RoundRectangleColor);
|
|
|
|
|
|
System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
GraphicsPath grPath = CreateRoundedRectanglePath(m_RegionF, 20);
|
|
|
- //e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
|
|
|
+
|
|
|
e.Graphics.FillPath(sampleBrush, grPath);
|
|
|
e.Graphics.DrawPath(Pens.Black, grPath);
|
|
|
}
|
|
|
- //样品台-圆形
|
|
|
- else if (createType == CreateRectangleType.SampleBackGround_Circle)
|
|
|
- {
|
|
|
- //获取颜色
|
|
|
- Color myColor = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.SampleBackGroundColor);
|
|
|
-
|
|
|
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
- e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; //图片柔顺模式选择
|
|
|
- e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
|
|
|
- e.Graphics.CompositingQuality = CompositingQuality.HighQuality;//再加一点
|
|
|
- e.Graphics.FillEllipse(sampleBrush, m_RegionF);
|
|
|
- e.Graphics.DrawEllipse(Pens.Black, m_RegionF);
|
|
|
- }
|
|
|
+
|
|
|
//圆形
|
|
|
- else if (createType == CreateRectangleType.Circle)
|
|
|
+ else if (createType == GDIType.StageBoundary_Circle)
|
|
|
{
|
|
|
System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(System.Drawing.Color.White);
|
|
|
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; //图片柔顺模式选择
|
|
|
@@ -229,7 +154,7 @@ namespace OTSMeasureApp
|
|
|
e.Graphics.DrawEllipse(Pens.Black, m_RegionF);
|
|
|
}
|
|
|
//文字
|
|
|
- else if (createType == CreateRectangleType.Text)
|
|
|
+ else if (createType == GDIType.Text)
|
|
|
{
|
|
|
//设置文字对齐方式
|
|
|
StringFormat sf = new StringFormat();
|
|
|
@@ -258,7 +183,7 @@ namespace OTSMeasureApp
|
|
|
|
|
|
}
|
|
|
//矩形
|
|
|
- else if (createType == CreateRectangleType.Rectangle)
|
|
|
+ else if (createType == GDIType.Rectangle)
|
|
|
{
|
|
|
Color myColor = System.Drawing.Color.White;
|
|
|
System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
@@ -272,61 +197,10 @@ namespace OTSMeasureApp
|
|
|
m_Region.Width = (int)m_RegionF.Width;
|
|
|
m_Region.Height = (int)m_RegionF.Height;
|
|
|
e.Graphics.DrawRectangle(Pens.Black, m_Region);
|
|
|
- }
|
|
|
- //选择样品台
|
|
|
- else if (createType == CreateRectangleType.SelectSample)
|
|
|
- {
|
|
|
- Color myColor = selColor;
|
|
|
-
|
|
|
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
-
|
|
|
- if (Shape == 0)
|
|
|
- {
|
|
|
-
|
|
|
- e.Graphics.FillEllipse(sampleBrush, m_RegionF);
|
|
|
- e.Graphics.DrawEllipse(Pens.Black, m_RegionF);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- e.Graphics.FillRectangle(sampleBrush, m_RegionF);
|
|
|
- var m_Region = new Rectangle();
|
|
|
- m_Region.X = (int)m_RegionF.X;
|
|
|
- m_Region.Y = (int)m_RegionF.Y;
|
|
|
- m_Region.Width = (int)m_RegionF.Width;
|
|
|
- m_Region.Height = (int)m_RegionF.Height;
|
|
|
- e.Graphics.DrawRectangle(Pens.Black, m_Region);
|
|
|
- }
|
|
|
- }
|
|
|
- //测试区域
|
|
|
- else if (createType == CreateRectangleType.MeasureArea)
|
|
|
- {
|
|
|
- Color myColor = selColor;
|
|
|
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
- Pen p = new Pen(myColor, 1);
|
|
|
- e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; //图片柔顺模式选择
|
|
|
- e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
|
|
|
- e.Graphics.CompositingQuality = CompositingQuality.HighQuality;//再加一点
|
|
|
-
|
|
|
-
|
|
|
- if (Shape == 0)
|
|
|
- {
|
|
|
-
|
|
|
- e.Graphics.DrawEllipse(p, m_RegionF);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- var m_Region = new Rectangle();
|
|
|
- m_Region.X = (int)m_RegionF.X;
|
|
|
- m_Region.Y = (int)m_RegionF.Y;
|
|
|
- m_Region.Width = (int)m_RegionF.Width;
|
|
|
- m_Region.Height = (int)m_RegionF.Height;
|
|
|
-
|
|
|
- e.Graphics.DrawRectangle(p, m_Region);
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
//绘制帧图 直线
|
|
|
- else if (createType == CreateRectangleType.SingleLine)
|
|
|
+ else if (createType == GDIType.SingleLine)
|
|
|
{
|
|
|
//设置颜色
|
|
|
Color myColor = OTSSamplespaceGraphicsPanelFun.GetColorValue(ColorType.FieldColor);
|
|
|
@@ -347,7 +221,7 @@ namespace OTSMeasureApp
|
|
|
|
|
|
}
|
|
|
//绘制标样
|
|
|
- else if (createType == CreateRectangleType.SpecimenRectangle)
|
|
|
+ else if (createType == GDIType.SpecimenRectangle)
|
|
|
{
|
|
|
Color myColor = System.Drawing.Color.Black;
|
|
|
System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
@@ -359,10 +233,10 @@ namespace OTSMeasureApp
|
|
|
m_Region.Width = (int)m_RegionF.Width;
|
|
|
m_Region.Height = (int)m_RegionF.Height;
|
|
|
e.Graphics.DrawRectangle(pen, m_Region);
|
|
|
- e.Graphics.FillRectangle(sampleBrush, m_Region);
|
|
|
+ e.Graphics.FillRectangle(sampleBrush, m_RegionF);
|
|
|
}
|
|
|
//绘制标样
|
|
|
- else if (createType == CreateRectangleType.SpecimenCircle)
|
|
|
+ else if (createType == GDIType.SpecimenCircle)
|
|
|
{
|
|
|
Color myColor = System.Drawing.Color.Black;
|
|
|
System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
@@ -371,67 +245,10 @@ namespace OTSMeasureApp
|
|
|
e.Graphics.DrawEllipse(pen, m_RegionF);
|
|
|
e.Graphics.FillEllipse(sampleBrush, m_RegionF);
|
|
|
}
|
|
|
- //绘制帧图
|
|
|
- else if (createType == CreateRectangleType.FieldRectangle)
|
|
|
- {
|
|
|
- Color myColor = SelColor;
|
|
|
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
- Pen pen = new Pen(sampleBrush, 0.01f);
|
|
|
- e.Graphics.SmoothingMode = SmoothingMode.Default;
|
|
|
- //设置直线位置与尺寸
|
|
|
- PointF startPointF = new PointF(m_RegionF.Left, m_RegionF.Top);
|
|
|
- PointF endPointF = new PointF(m_RegionF.Right, m_RegionF.Bottom);
|
|
|
- if (m_RegionF.Height > 20)//won't display when it's too small,to speed up
|
|
|
- {
|
|
|
- float fontSize = m_RegionF.Width / 4;
|
|
|
- Font font;
|
|
|
- if (fontSize == 0)
|
|
|
- {
|
|
|
- font = new Font("宋体", 5, FontStyle.Regular);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- font = new Font("宋体", fontSize, FontStyle.Regular);
|
|
|
- }
|
|
|
-
|
|
|
- StringFormat sf = new StringFormat();
|
|
|
- sf.Alignment = StringAlignment.Center;
|
|
|
- sf.LineAlignment = StringAlignment.Center;
|
|
|
-
|
|
|
- e.Graphics.DrawString(m_sequenceNum.ToString(), font, sampleBrush, m_RegionF, sf);
|
|
|
- }
|
|
|
-
|
|
|
- //绘制帧图
|
|
|
- e.Graphics.DrawRectangle(pen, startPointF.X, startPointF.Y, endPointF.X - startPointF.X, endPointF.Y - startPointF.Y);
|
|
|
- }
|
|
|
- //绘制颗粒
|
|
|
- else if (createType == CreateRectangleType.ParticleLine)
|
|
|
- {
|
|
|
- Color myColor = LineColor;
|
|
|
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
- Pen pen = new Pen(sampleBrush, 0.01f);
|
|
|
- e.Graphics.SmoothingMode = SmoothingMode.Default;
|
|
|
- //设置直线位置与长度
|
|
|
- PointF startPointF = LineStartPoint;
|
|
|
- float length = LineLength;
|
|
|
- PointF endPointF = new PointF(startPointF.X + length, startPointF.Y);
|
|
|
- e.Graphics.DrawLine(pen, startPointF, endPointF);
|
|
|
- }
|
|
|
- //矩形
|
|
|
- else if (createType == CreateRectangleType.ParticleAreaRectangle)
|
|
|
- {
|
|
|
- Color myColor = System.Drawing.Color.White;
|
|
|
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
-
|
|
|
- var m_Region = new Rectangle();
|
|
|
- m_Region.X = (int)m_RegionF.X;
|
|
|
- m_Region.Y = (int)m_RegionF.Y;
|
|
|
- m_Region.Width = (int)m_RegionF.Width;
|
|
|
- m_Region.Height = (int)m_RegionF.Height;
|
|
|
- e.Graphics.DrawRectangle(Pens.Black, m_Region);
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
//绘制样品孔BSE图像
|
|
|
- else if (createType == CreateRectangleType.DrawFrameOfHoleBSEImage)
|
|
|
+ else if (createType == GDIType.DrawFrameOfHoleBSEImage)
|
|
|
{
|
|
|
|
|
|
|
|
|
@@ -446,62 +263,9 @@ namespace OTSMeasureApp
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- else if (createType == CreateRectangleType.DrawSEMCenterPoint)
|
|
|
- {
|
|
|
- Color myColor = System.Drawing.Color.Red;
|
|
|
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
-
|
|
|
- //X轴线
|
|
|
- PointF startPointX = semCenterPoint;
|
|
|
- startPointX.X = startPointX.X - 3;
|
|
|
- PointF endPointX = semCenterPoint;
|
|
|
- endPointX.X = endPointX.X + 3;
|
|
|
- //Y轴线
|
|
|
- PointF startPointY = semCenterPoint;
|
|
|
- startPointY.Y = startPointY.Y - 3;
|
|
|
- PointF endPointY = semCenterPoint;
|
|
|
- endPointY.Y = endPointY.Y + 3;
|
|
|
- //绘制XY轴交叉线+
|
|
|
- Pen pen = new Pen(sampleBrush, 0.0001f);
|
|
|
- e.Graphics.DrawLine(pen, startPointX, endPointX);
|
|
|
- e.Graphics.DrawLine(pen, startPointY, endPointY);
|
|
|
- }
|
|
|
- //绘制BSE标记
|
|
|
- else if (createType == CreateRectangleType.DrawBSEElementSignPoint)
|
|
|
- {
|
|
|
- System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Green);
|
|
|
|
|
|
- Pen pen = new Pen(sampleBrush, 2f);
|
|
|
- int X = (int)m_OrigineRegionF.X;
|
|
|
- int Y = (int)m_OrigineRegionF.Y;
|
|
|
- e.Graphics.DrawLine(pen, new Point(X - 8, Y), new Point(X + 8, Y));
|
|
|
- e.Graphics.DrawLine(pen, new Point(X, Y - 8), new Point(X, Y + 8));
|
|
|
- }
|
|
|
- //绘制多边形测量区域
|
|
|
- else if (createType == CreateRectangleType.Polygon)
|
|
|
- {
|
|
|
-
|
|
|
- Color myColor = selColor;
|
|
|
- //System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
- Pen pen = new Pen(myColor, 1);
|
|
|
- if (GetPolygonPointFList().Count > 0)
|
|
|
- {
|
|
|
- List<PointF> PolygonPointF = new List<PointF>();
|
|
|
- foreach (var item in m_PolygonPoints)
|
|
|
- {
|
|
|
- PolygonPointF.Add(item);
|
|
|
- }
|
|
|
- if (PolygonDrawingEndPoint.X != 0 && PolygonDrawingEndPoint.Y != 0)
|
|
|
- {
|
|
|
- PolygonPointF.Add(PolygonDrawingEndPoint);
|
|
|
- }
|
|
|
-
|
|
|
- e.Graphics.DrawLines(pen, PolygonPointF.ToArray());
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }//多边形测量区域完成标识
|
|
|
- else if (createType == CreateRectangleType.DrawPolygonFinish)
|
|
|
+
|
|
|
+ else if (createType == GDIType.DrawPolygonFinish)
|
|
|
{
|
|
|
Color myColor = selColor;
|
|
|
|
|
|
@@ -513,22 +277,7 @@ namespace OTSMeasureApp
|
|
|
m_Region.Height = (int)m_RegionF.Height;
|
|
|
e.Graphics.DrawRectangle(pen, m_Region);
|
|
|
}
|
|
|
- //绘制多边形测量区域
|
|
|
- else if (createType == CreateRectangleType.CircleByThreePoints)
|
|
|
- {
|
|
|
- Color myColor = selColor;
|
|
|
-
|
|
|
- Pen p = new Pen(myColor, 1);
|
|
|
-
|
|
|
-
|
|
|
- var m_Region = new Rectangle();
|
|
|
- m_Region.X = (int)m_RegionF.X;
|
|
|
- m_Region.Y = (int)m_RegionF.Y;
|
|
|
- m_Region.Width = (int)m_RegionF.Width;
|
|
|
- m_Region.Height = (int)m_RegionF.Height;
|
|
|
- e.Graphics.DrawEllipse(p, m_Region);
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public Image BSEImage
|
|
|
@@ -577,16 +326,12 @@ namespace OTSMeasureApp
|
|
|
get { return otsY; }
|
|
|
set { otsY = value; }
|
|
|
}
|
|
|
- public CreateRectangleType CreateType
|
|
|
+ public GDIType GDIType
|
|
|
{
|
|
|
get { return createType; }
|
|
|
set { createType = value; }
|
|
|
}
|
|
|
- public ShapeType Shape
|
|
|
- {
|
|
|
- get { return shape; }
|
|
|
- set { shape = value; }
|
|
|
- }
|
|
|
+
|
|
|
public Color SelColor
|
|
|
{
|
|
|
get { return selColor; }
|
|
|
@@ -640,7 +385,16 @@ namespace OTSMeasureApp
|
|
|
vertexPoint.Add(new PointF(region.X + region.Width, region.Y + region.Height));
|
|
|
return vertexPoint;
|
|
|
}
|
|
|
-
|
|
|
+ public List<PointF> GetOriginalRegionVertexPoints()
|
|
|
+ {
|
|
|
+ List<PointF> vertexPoint = new List<PointF>();
|
|
|
+ var region = this.GetOrigionalDrawRegionF();
|
|
|
+ vertexPoint.Add(region.Location);
|
|
|
+ vertexPoint.Add(new PointF(region.X, region.Y + region.Height));
|
|
|
+ vertexPoint.Add(new PointF(region.X + region.Width, region.Y));
|
|
|
+ vertexPoint.Add(new PointF(region.X + region.Width, region.Y + region.Height));
|
|
|
+ return vertexPoint;
|
|
|
+ }
|
|
|
public RectangleF GetZoomedRegionF()
|
|
|
{
|
|
|
return m_RegionF;
|
|
|
@@ -682,124 +436,23 @@ namespace OTSMeasureApp
|
|
|
m_RegionF = scaleRectangleF;
|
|
|
|
|
|
}
|
|
|
- private Rectangle GetMinRectangleOfPolygon(List<PointF> polygonPointList)
|
|
|
- {
|
|
|
- if (polygonPointList != null)
|
|
|
- {
|
|
|
- if (polygonPointList.Count > 0)
|
|
|
- {
|
|
|
- int pCount = polygonPointList.Count;
|
|
|
- float minX = polygonPointList[0].X;
|
|
|
- float minY = polygonPointList[0].Y;
|
|
|
- float maxX = polygonPointList[0].X;
|
|
|
- float maxY = polygonPointList[0].Y;
|
|
|
- //获取最小X,Y 最大X,Y
|
|
|
- for (int i = 0; i < pCount; i++)
|
|
|
- {
|
|
|
- minX = Math.Min(minX, polygonPointList[i].X);
|
|
|
- minY = Math.Min(minY, polygonPointList[i].Y);
|
|
|
- maxX = Math.Max(maxX, polygonPointList[i].X);
|
|
|
- maxY = Math.Max(maxY, polygonPointList[i].Y);
|
|
|
- }
|
|
|
-
|
|
|
- //创建外接矩形
|
|
|
- Rectangle rect = new Rectangle();
|
|
|
- rect.Location = new Point((int)minX, (int)minY);
|
|
|
- rect.Size = new Size((int)maxX - (int)minX, (int)maxY - (int)minY);
|
|
|
- return rect;
|
|
|
- }
|
|
|
- }
|
|
|
- return new Rectangle();
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
public RectangleF GetOrigionalDrawRegionF()
|
|
|
{ return m_OrigineRegionF; }
|
|
|
|
|
|
|
|
|
- public List<PointF> GetOriginalPolygonPointFList()
|
|
|
- { return m_originalPolygonPoints; }
|
|
|
- public void SetOriginalPolygonPointFList(List<PointF> value)
|
|
|
- {
|
|
|
- if (m_zoomNum != 1)
|
|
|
- {
|
|
|
- var ps = new List<PointF>();
|
|
|
- foreach (var p in value)
|
|
|
- {
|
|
|
- var p1 = new PointF();
|
|
|
-
|
|
|
- p1.X = p.X * m_zoomNum+m_refPoint.X;
|
|
|
- p1.Y = p.Y *m_zoomNum+ m_refPoint.Y;
|
|
|
- ps.Add(p1);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- m_PolygonPoints = ps;
|
|
|
- m_originalPolygonPoints = value;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- m_originalPolygonPoints = value;
|
|
|
- m_PolygonPoints = value;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public List<PointF> GetPolygonPointFList()
|
|
|
- { return m_PolygonPoints; }
|
|
|
- public void SetPolygonPointFList(List<PointF> value)
|
|
|
- {
|
|
|
- if (m_zoomNum != 1)
|
|
|
- {
|
|
|
- var ps = new List<PointF>();
|
|
|
- foreach (var p in value)
|
|
|
- {
|
|
|
- var p1 = new PointF();
|
|
|
-
|
|
|
- p1.X = (p.X - m_refPoint.X) / m_zoomNum;
|
|
|
- p1.Y = (p.Y - m_refPoint.Y) / m_zoomNum;
|
|
|
- ps.Add(p1);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- m_originalPolygonPoints = ps;
|
|
|
- m_PolygonPoints = value;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- m_originalPolygonPoints = value;
|
|
|
- m_PolygonPoints = value;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- var region = GetMinRectangleOfPolygon(m_PolygonPoints);
|
|
|
- SetZoomedRegionF(region);
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
- public GraphicsPath GetGPath()
|
|
|
+ public virtual GraphicsPath GetGPath()
|
|
|
{
|
|
|
|
|
|
var measureItem = this;
|
|
|
//重新绘制测量区域路径
|
|
|
GraphicsPath GPath = new GraphicsPath();
|
|
|
-
|
|
|
- if (measureItem.CreateType == CreateRectangleType.Polygon)
|
|
|
- {
|
|
|
- GraphicsPath PolygonMeasurePath = new GraphicsPath();
|
|
|
- PolygonMeasurePath.AddPolygon(measureItem.GetPolygonPointFList().ToArray());
|
|
|
- GPath = PolygonMeasurePath;
|
|
|
- }
|
|
|
- else if (measureItem.CreateType == CreateRectangleType.CircleByThreePoints)
|
|
|
- {
|
|
|
- GPath.AddEllipse(GetZoomedRegionF());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (measureItem.Shape == (int)CreateRectangleType.Circle)
|
|
|
+
|
|
|
+
|
|
|
+ if (measureItem.GDIType == GDIType.StageBoundary_Circle)
|
|
|
{
|
|
|
GPath.AddEllipse(GetZoomedRegionF());
|
|
|
}
|
|
|
@@ -807,17 +460,13 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
GPath.AddRectangle(GetZoomedRegionF());
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
return GPath;
|
|
|
|
|
|
}
|
|
|
|
|
|
- public PointF PolygonDrawingEndPoint
|
|
|
- {
|
|
|
- get { return endPoint; }
|
|
|
- set { endPoint = value; }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
public Point GetZoomedCenterPoint()
|
|
|
@@ -857,24 +506,17 @@ namespace OTSMeasureApp
|
|
|
get { return m_IsWorkSample; }
|
|
|
set { m_IsWorkSample = value; }
|
|
|
}
|
|
|
- public PointF DraggingPoint
|
|
|
+ virtual public PointF DraggingPoint
|
|
|
{
|
|
|
get { return m_DraggingPoint; }
|
|
|
set {
|
|
|
|
|
|
m_DraggingPoint = value;
|
|
|
- if (subItems.Count != 0)
|
|
|
- {
|
|
|
- foreach (var item in subItems)
|
|
|
- {
|
|
|
- item.DraggingPoint = m_DraggingPoint;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public int SequenceNum { get => m_sequenceNum; set => m_sequenceNum = value; }
|
|
|
+
|
|
|
public bool IsMoving { get => m_IsMoving; set => m_IsMoving = value; }
|
|
|
|
|
|
public PointF GetDisplayRefPoint()
|
|
|
@@ -884,24 +526,18 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
m_refPoint = value;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
- if (m_originalPolygonPoints.Count != 0)
|
|
|
- {
|
|
|
- this.SetPolygonPointFList(m_originalPolygonPoints);
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public float GetZoomNumber()
|
|
|
{ return m_zoomNum; }
|
|
|
|
|
|
|
|
|
- public void SetZoomNumber(float value)
|
|
|
+ virtual public void SetZoomNumber(float value)
|
|
|
{
|
|
|
m_zoomNum = value;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
- if (m_originalPolygonPoints.Count != 0)
|
|
|
- {
|
|
|
- this.SetPolygonPointFList(m_originalPolygonPoints);
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -953,22 +589,9 @@ namespace OTSMeasureApp
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- public List<CDisplayGDIObject> SubItems()
|
|
|
- {
|
|
|
- if (subItems == null) subItems = new List<CDisplayGDIObject>();
|
|
|
- return subItems;
|
|
|
- }
|
|
|
- public void AddSubItems(CDisplayGDIObject item)
|
|
|
- {
|
|
|
- if (subItems == null) subItems = new List<CDisplayGDIObject>();
|
|
|
- subItems.Add(item);
|
|
|
- }
|
|
|
- public void ClearSubItems()
|
|
|
- {
|
|
|
- subItems.Clear();
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
- public void Zoom(PointF mousePoint, float zoomNum)
|
|
|
+ virtual public void Zoom(PointF mousePoint, float zoomNum)
|
|
|
|
|
|
{
|
|
|
float X1;
|
|
|
@@ -980,7 +603,7 @@ namespace OTSMeasureApp
|
|
|
m_zoomNum = 1;
|
|
|
m_RegionF = m_OrigineRegionF;
|
|
|
m_refPoint = new PointF(0, 0);
|
|
|
- m_PolygonPoints = m_originalPolygonPoints;
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1008,33 +631,11 @@ namespace OTSMeasureApp
|
|
|
BSEImageLocation = m_RegionF.Location;
|
|
|
|
|
|
|
|
|
- var scalePs = new List<PointF>();
|
|
|
- foreach (var p in m_PolygonPoints)
|
|
|
- {
|
|
|
- float x, y;
|
|
|
- x = (p.X - mousePoint.X) / curZoom * deltaZoom + p.X;
|
|
|
- y = (p.Y - mousePoint.Y) / curZoom * deltaZoom + p.Y;
|
|
|
-
|
|
|
- scalePs.Add(new PointF(x, y));
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- m_PolygonPoints = scalePs;
|
|
|
-
|
|
|
-
|
|
|
- if (this.subItems.Count != 0)
|
|
|
- {
|
|
|
- foreach (var g in subItems)
|
|
|
- {
|
|
|
- g.Zoom(mousePoint,zoomNum);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void Move(PointF location)
|
|
|
+ virtual public void Move(PointF location)
|
|
|
{
|
|
|
|
|
|
PointF offset = new PointF(location.X - DraggingPoint.X, location.Y - DraggingPoint.Y);
|
|
|
@@ -1054,35 +655,14 @@ namespace OTSMeasureApp
|
|
|
BSEImageWitdh = m_RegionF.Width;
|
|
|
BSEImageHeight = m_RegionF.Height;
|
|
|
BSEImageLocation = m_RegionF.Location;
|
|
|
- //SEMCenterPoint = m_RegionF.Location;
|
|
|
+
|
|
|
LineStartPoint = m_RegionF.Location;
|
|
|
|
|
|
m_DraggingPoint = new Point((int)location.X,(int)location.Y);
|
|
|
|
|
|
- var scalePs = new List<PointF>();
|
|
|
- foreach (var p in m_PolygonPoints)
|
|
|
- {
|
|
|
- float x, y;
|
|
|
- x = (p.X + offset.X);
|
|
|
- y = (p.Y + offset.Y);
|
|
|
-
|
|
|
- scalePs.Add(new PointF(x, y));
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- m_PolygonPoints = scalePs;
|
|
|
|
|
|
- if (this.subItems.Count != 0)
|
|
|
- {
|
|
|
- foreach (var g in subItems)
|
|
|
- {
|
|
|
- g.Move(location);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
}
|
|
|
- public void PositionAltering(PointF location,bool ifZoomCoord)
|
|
|
+ virtual public void PositionAltering(PointF location,bool ifZoomCoord)
|
|
|
{
|
|
|
|
|
|
PointF offset = new PointF(location.X - DraggingPoint.X, location.Y - DraggingPoint.Y);
|
|
|
@@ -1109,44 +689,12 @@ namespace OTSMeasureApp
|
|
|
|
|
|
LineStartPoint = m_RegionF.Location;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- var scalePs = new List<PointF>();
|
|
|
- var OriginalPs = new List<PointF>();
|
|
|
- foreach (var p in m_PolygonPoints)
|
|
|
- {
|
|
|
- float x, y;
|
|
|
- x = (p.X + offset.X);
|
|
|
- y = (p.Y + offset.Y);
|
|
|
- scalePs.Add(new PointF(x, y));
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- m_PolygonPoints = scalePs;
|
|
|
-
|
|
|
- foreach (var p in m_originalPolygonPoints)
|
|
|
- {
|
|
|
-
|
|
|
- OriginalPs.Add(new PointF(p.X + realShift.X, p.Y + realShift.Y));
|
|
|
-
|
|
|
- }
|
|
|
- m_originalPolygonPoints = OriginalPs;
|
|
|
-
|
|
|
m_DraggingPoint = new Point((int)location.X, (int)location.Y);
|
|
|
|
|
|
- if (this.subItems.Count != 0)
|
|
|
- {
|
|
|
- foreach (var g in subItems)
|
|
|
- {
|
|
|
- g.PositionAltering(location,ifZoomCoord);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- public CDisplayGDIObject Duplicate(CreateRectangleType newType)
|
|
|
+ public CDisplayGDIObject Duplicate()
|
|
|
{
|
|
|
CDisplayGDIObject r = new CDisplayGDIObject();
|
|
|
r.NameOrHoleName = this.nameOrHoleName;
|
|
|
@@ -1160,16 +708,13 @@ namespace OTSMeasureApp
|
|
|
r.m_refPoint = this.m_refPoint;
|
|
|
r.m_zoomNum = this.m_zoomNum;
|
|
|
|
|
|
- r.shape = this.shape;
|
|
|
+
|
|
|
|
|
|
- r.createType = newType;
|
|
|
+ r.createType = this.createType;
|
|
|
|
|
|
return r;
|
|
|
}
|
|
|
- virtual public bool ifRectangleIntersect(CDisplayGDIObject othergdi)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
#endregion
|
|
|
//是否设置为选择样品
|
|
|
@@ -1182,25 +727,24 @@ namespace OTSMeasureApp
|
|
|
private bool m_IsMoving;
|
|
|
//是否为工作样品
|
|
|
private bool m_IsWorkSample;
|
|
|
- private CreateRectangleType createType;
|
|
|
- private ShapeType shape;
|
|
|
+ private GDIType createType;
|
|
|
+
|
|
|
private string id;
|
|
|
protected string nameOrHoleName="";
|
|
|
public string sampleName="";
|
|
|
//样品孔中样品的数量
|
|
|
public int sampleCount = 0;
|
|
|
public string strContent;
|
|
|
- private Color selColor;
|
|
|
- private PointF m_DraggingPoint;
|
|
|
+
|
|
|
+ protected PointF m_DraggingPoint;
|
|
|
|
|
|
- private int m_sequenceNum;
|
|
|
-
|
|
|
+
|
|
|
+ protected Color selColor;
|
|
|
protected RectangleF m_RegionF;
|
|
|
//绘制时与移动缩放时记录的位置与尺寸
|
|
|
protected RectangleF m_OrigineRegionF;
|
|
|
|
|
|
- private PointF startPoint;
|
|
|
- private PointF endPoint;
|
|
|
+
|
|
|
|
|
|
//绘制颗粒图
|
|
|
private Color lineColor;
|
|
|
@@ -1216,20 +760,18 @@ namespace OTSMeasureApp
|
|
|
private float bseImageHeight;
|
|
|
//绘制样品孔BSE图像位置
|
|
|
private PointF bseImageLocation;
|
|
|
- //绘制SEM中心位置
|
|
|
- private PointF semCenterPoint;
|
|
|
-
|
|
|
-
|
|
|
- private List<PointF> m_PolygonPoints=new List<PointF>();
|
|
|
- //绘制时与移动缩放时记录的位置
|
|
|
- private List<PointF> m_originalPolygonPoints = new List<PointF>();
|
|
|
|
|
|
- private List<CDisplayGDIObject> subItems=new List<CDisplayGDIObject>();
|
|
|
+
|
|
|
+ private PointF startPoint;
|
|
|
+ private PointF endPoint;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
protected float m_zoomNum=1;
|
|
|
|
|
|
- private PointF m_refPoint=new PointF(0,0);
|
|
|
+ protected PointF m_refPoint=new PointF(0,0);
|
|
|
|
|
|
|
|
|
}
|
|
|
@@ -1241,50 +783,35 @@ namespace OTSMeasureApp
|
|
|
Y = 1
|
|
|
}
|
|
|
|
|
|
- public enum CreateRectangleType
|
|
|
+ public enum GDIType
|
|
|
{
|
|
|
- //样品台-圆形
|
|
|
- SampleBackGround_Circle = -1,
|
|
|
+
|
|
|
//圆形
|
|
|
- Circle = 0,
|
|
|
+ StageBoundary_Circle = 0,
|
|
|
//圆角矩形
|
|
|
- SampleBackGround_Rectangle = 1,
|
|
|
+ StageBoundary_RoundedRectangle = 1,
|
|
|
//样品孔中的文字
|
|
|
Text = 2,
|
|
|
//矩形
|
|
|
Rectangle = 3,
|
|
|
- //选择的样品
|
|
|
- SelectSample = 4,
|
|
|
- //测量区域
|
|
|
- MeasureArea = 5,
|
|
|
+ //样品孔背景
|
|
|
+ CorrelateSampleHoleBackGround = 4,//every sample area has a sample hole correlation.
|
|
|
+
|
|
|
//帧图-直线绘制方式
|
|
|
SingleLine = 6,
|
|
|
//表样-矩形
|
|
|
SpecimenRectangle = 7,
|
|
|
//表样-圆形
|
|
|
SpecimenCircle = 8,
|
|
|
- //帧图-矩形绘制
|
|
|
- FieldRectangle = 9,
|
|
|
- //颗粒直线图
|
|
|
- ParticleLine = 10,
|
|
|
- //颗粒分布图 鼠标
|
|
|
- ParticleAreaRectangle = 11,
|
|
|
- //绘制拍摄样品孔BSE照片
|
|
|
- DrawFrameOfHoleBSEImage = 12,
|
|
|
- //绘制sem中心点+
|
|
|
- DrawSEMCenterPoint=13,
|
|
|
- //绘制BSE采集标记
|
|
|
- DrawBSEElementSignPoint = 14,
|
|
|
- //多边形
|
|
|
- Polygon = 15,
|
|
|
+
|
|
|
+ DrawFrameOfHoleBSEImage = 9,
|
|
|
+
|
|
|
+
|
|
|
//多边形完成标识
|
|
|
- DrawPolygonFinish = 16,
|
|
|
- //圆形三点法
|
|
|
- CircleByThreePoints=17,
|
|
|
-
|
|
|
- RingShape=18,
|
|
|
+ DrawPolygonFinish = 11,
|
|
|
+
|
|
|
|
|
|
- SampleHoleImageBuffer=19
|
|
|
+ SampleHoleImageBuffer=12
|
|
|
}
|
|
|
|
|
|
|