|
@@ -41,19 +41,19 @@ namespace OTSMeasureApp
|
|
|
|
|
|
public CRectangleGDIObject(RectangleF rect, CreateRectangleType cType)
|
|
|
{
|
|
|
- //m_RegionF = rect;
|
|
|
+
|
|
|
m_OrigineRegionF = rect;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
CreateType = cType;
|
|
|
ID = System.Guid.NewGuid().ToString();
|
|
|
- startPoint = new PointF(rect.Left, rect.Top);
|
|
|
- EndPoint = new PointF(rect.Right, rect.Bottom);
|
|
|
+ //startPoint = new PointF(rect.Left, rect.Top);
|
|
|
+ //EndPoint = new PointF(rect.Right, rect.Bottom);
|
|
|
OTSX = -1;
|
|
|
OTSY = -1;
|
|
|
}
|
|
|
public CRectangleGDIObject(RectangleF rect, CreateRectangleType cType, string name)
|
|
|
{
|
|
|
- //m_RegionF = rect;
|
|
|
+
|
|
|
m_OrigineRegionF = rect;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
CreateType = cType;
|
|
@@ -64,7 +64,7 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
public CRectangleGDIObject(RectangleF rect, CreateRectangleType cType, ShapeType shape, string name)
|
|
|
{
|
|
|
- //m_RegionF = rect;
|
|
|
+
|
|
|
m_OrigineRegionF = rect;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
CreateType = cType;
|
|
@@ -76,7 +76,7 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
public CRectangleGDIObject(RectangleF rect, CreateRectangleType cType, ShapeType shape, string name, Color selColor)
|
|
|
{
|
|
|
- //m_RegionF = rect;
|
|
|
+
|
|
|
m_OrigineRegionF = rect;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
CreateType = cType;
|
|
@@ -89,7 +89,7 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
public CRectangleGDIObject(RectangleF rectMeasure, CreateRectangleType cType, ShapeType shape, string name, string sampleName, Color selColor)
|
|
|
{
|
|
|
- //m_RegionF = rectMeasure;
|
|
|
+
|
|
|
m_OrigineRegionF = rectMeasure;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
CreateType = cType;
|
|
@@ -105,7 +105,7 @@ namespace OTSMeasureApp
|
|
|
//绘制帧图
|
|
|
public CRectangleGDIObject(RectangleF rectSingle, CreateRectangleType cType, string name, string sampleName, Color selColor)
|
|
|
{
|
|
|
- //m_RegionF = rectSingle;
|
|
|
+
|
|
|
m_OrigineRegionF = rectSingle;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
CreateType = cType;
|
|
@@ -120,7 +120,7 @@ namespace OTSMeasureApp
|
|
|
//绘制帧图
|
|
|
public CRectangleGDIObject(RectangleF rectSingle, int OTSx, int OTSy, CreateRectangleType cType, string name, string sampleName, Color selColor)
|
|
|
{
|
|
|
- //m_RegionF = rectSingle;
|
|
|
+
|
|
|
m_OrigineRegionF = rectSingle;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
CreateType = cType;
|
|
@@ -145,7 +145,7 @@ namespace OTSMeasureApp
|
|
|
/// <param name="cType">绘制类型</param>
|
|
|
public CRectangleGDIObject(RectangleF rect, int OTSx, int OTSy, string sampleName, string sampleHoleName, Image bseImage, float bseImageWitdh, float bseImageHeight, CreateRectangleType cType)
|
|
|
{
|
|
|
- //m_RegionF = rect;
|
|
|
+
|
|
|
m_OrigineRegionF = rect;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
Name = sampleHoleName;
|
|
@@ -169,14 +169,13 @@ namespace OTSMeasureApp
|
|
|
|
|
|
public CRectangleGDIObject(RectangleF rect, Point ImgPoint, float m_Multiple, CreateRectangleType cType)
|
|
|
{
|
|
|
- //m_RegionF.X = rect.X - ImgPoint.X * m_Multiple;
|
|
|
- //m_RegionF.Y = rect.Y - ImgPoint.Y * m_Multiple;
|
|
|
+
|
|
|
m_OrigineRegionF = rect;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
CreateType = cType;
|
|
|
ID = System.Guid.NewGuid().ToString();
|
|
|
- startPoint = new PointF(rect.Left, rect.Top);
|
|
|
- EndPoint = new PointF(rect.Right, rect.Bottom);
|
|
|
+ //startPoint = new PointF(rect.Left, rect.Top);
|
|
|
+ //EndPoint = new PointF(rect.Right, rect.Bottom);
|
|
|
OTSX = -1;
|
|
|
OTSY = -1;
|
|
|
}
|
|
@@ -188,232 +187,27 @@ namespace OTSMeasureApp
|
|
|
public CRectangleGDIObject(List<PointF> mPoint, CreateRectangleType cType, ShapeType shape, string name, string sampleName, Color selColor)
|
|
|
{
|
|
|
ID = System.Guid.NewGuid().ToString();
|
|
|
- List<Point> PointRegion = new List<Point>();
|
|
|
- foreach (var item in mPoint)
|
|
|
- {
|
|
|
- PointRegion.Add(new Point((int)item.X, (int)item.Y));
|
|
|
- }
|
|
|
- PolygonPointRegion = PointRegion;
|
|
|
- PolygonPointRegionF = mPoint;
|
|
|
- List<PointF> DrawPoint = new List<PointF>();
|
|
|
- foreach (var item in mPoint)
|
|
|
- {
|
|
|
- DrawPoint.Add(item);
|
|
|
- }
|
|
|
-
|
|
|
- m_PolygonPointRegionF = DrawPoint;
|
|
|
+
|
|
|
+ this.PolygonPointFList = mPoint;
|
|
|
+
|
|
|
+
|
|
|
Name = name;
|
|
|
SampleName = sampleName;
|
|
|
CreateType = cType;
|
|
|
Shape = shape;
|
|
|
SelColor = selColor;
|
|
|
- }
|
|
|
- #region 变量重写
|
|
|
- public Image BSEImage
|
|
|
- {
|
|
|
- get { return bseImage; }
|
|
|
- set { bseImage = value; }
|
|
|
- }
|
|
|
- public float BSEImageWitdh
|
|
|
- {
|
|
|
- get { return bseImageWidth; }
|
|
|
- set { bseImageWidth = value; }
|
|
|
- }
|
|
|
- public float BSEImageHeight
|
|
|
- {
|
|
|
- get { return bseImageHeight; }
|
|
|
- set { bseImageHeight = value; }
|
|
|
- }
|
|
|
- public PointF BSEImageLocation
|
|
|
- {
|
|
|
- get { return bseImageLocation; }
|
|
|
- set { bseImageLocation = value; }
|
|
|
- }
|
|
|
- public Color LineColor
|
|
|
- {
|
|
|
- get { return lineColor; }
|
|
|
- set { lineColor = value; }
|
|
|
- }
|
|
|
- public float LineLength
|
|
|
- {
|
|
|
- get { return lineLength; }
|
|
|
- set { lineLength = value; }
|
|
|
- }
|
|
|
- public PointF LineStartPoint
|
|
|
- {
|
|
|
- get { return lineStartPoint; }
|
|
|
- set { lineStartPoint = value; }
|
|
|
- }
|
|
|
- public PointF SEMCenterPoint
|
|
|
- {
|
|
|
- get { return semCenterPoint; }
|
|
|
- set { semCenterPoint = value; }
|
|
|
- }
|
|
|
- public int OTSX
|
|
|
- {
|
|
|
- get { return otsX; }
|
|
|
- set { otsX = value; }
|
|
|
- }
|
|
|
- public int OTSY
|
|
|
- {
|
|
|
- get { return otsY; }
|
|
|
- set { otsY = value; }
|
|
|
- }
|
|
|
- public CreateRectangleType CreateType
|
|
|
- {
|
|
|
- get { return createType; }
|
|
|
- set { createType = value; }
|
|
|
- }
|
|
|
- public ShapeType Shape
|
|
|
- {
|
|
|
- get { return shape; }
|
|
|
- set { shape = value; }
|
|
|
- }
|
|
|
- public Color SelColor
|
|
|
- {
|
|
|
- get { return selColor; }
|
|
|
- set { selColor = value; }
|
|
|
- }
|
|
|
- public string Name
|
|
|
- {
|
|
|
- get { return name; }
|
|
|
- set { name = value; }
|
|
|
- }
|
|
|
- public string ID
|
|
|
- {
|
|
|
- get { return id; }
|
|
|
- set { id = value; }
|
|
|
- }
|
|
|
- public string SampleName
|
|
|
- {
|
|
|
- get { return sampleName; }
|
|
|
- set { sampleName = value; }
|
|
|
- }
|
|
|
- public int SampleCount
|
|
|
- {
|
|
|
- get { return sampleCount; }
|
|
|
- set { sampleCount = value; }
|
|
|
- }
|
|
|
- public string StrContent
|
|
|
- {
|
|
|
- get { return strContent; }
|
|
|
- set { strContent = value; }
|
|
|
- }
|
|
|
- public RectangleF GetZoomedRegion
|
|
|
- {
|
|
|
-
|
|
|
- get {
|
|
|
- var m_Region = new RectangleF();
|
|
|
- m_Region.X = m_RegionF.X;
|
|
|
- m_Region.Y = m_RegionF.Y;
|
|
|
- m_Region.Width = m_RegionF.Width;
|
|
|
- m_Region.Height = m_RegionF.Height;
|
|
|
- return m_Region;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
- public RectangleF GetZoomedRegionF()
|
|
|
- {
|
|
|
- return m_RegionF;
|
|
|
- }
|
|
|
- public void SetInitRegionF(RectangleF OrigineRegionF)//not zoomed regine value
|
|
|
- {
|
|
|
|
|
|
+ //if(mPoint.Count>2)
|
|
|
+
|
|
|
+ //GPath.AddPolygon(PolygonPointFList.ToArray());
|
|
|
+
|
|
|
|
|
|
- float x1, y1;
|
|
|
- x1 = OrigineRegionF.X * m_zoomNum + m_refPoint.X;
|
|
|
- y1 = OrigineRegionF.Y * m_zoomNum + m_refPoint.Y;
|
|
|
-
|
|
|
- float w1, h1;
|
|
|
- w1 = OrigineRegionF.Width * m_zoomNum;
|
|
|
- h1 = OrigineRegionF.Height * m_zoomNum;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- m_OrigineRegionF = OrigineRegionF;
|
|
|
-
|
|
|
- m_RegionF = new RectangleF(x1, y1, w1, h1);
|
|
|
-
|
|
|
- CreateRectangleType shape = this.CreateType;
|
|
|
- GraphicsPath MeasurePath = new GraphicsPath();
|
|
|
- if (shape == CreateRectangleType.Rectangle)
|
|
|
- {
|
|
|
- MeasurePath.AddRectangle(m_RegionF);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MeasurePath.AddEllipse(m_RegionF);
|
|
|
- }
|
|
|
- this.g_Path = MeasurePath;
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- public RectangleF OrigionalDrawRegionF
|
|
|
- {
|
|
|
- get { return m_OrigineRegionF; }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public List<Point> PolygonPointRegion
|
|
|
- {
|
|
|
- get { return m_PolygonPointRegion; }
|
|
|
- set { m_PolygonPointRegion = value; }
|
|
|
- }
|
|
|
-
|
|
|
- public List<PointF> PolygonPointRegionF
|
|
|
- {
|
|
|
- get { return m_PolygonPointRegionF; }
|
|
|
- set { m_PolygonPointRegionF = value; }
|
|
|
- }
|
|
|
-
|
|
|
- public List<PointF> DrawPolygonPointRegionF
|
|
|
- {
|
|
|
- get { return m_DrawPolygonPointRegionF; }
|
|
|
- //set { m_DrawPolygonPointRegionF = value; }
|
|
|
- }
|
|
|
|
|
|
- public GraphicsPath GPath
|
|
|
- {
|
|
|
- get { return g_Path; }
|
|
|
- set { g_Path = value; }
|
|
|
}
|
|
|
- public PointF StartPoint
|
|
|
- {
|
|
|
- get { return startPoint; }
|
|
|
- set { startPoint = value; }
|
|
|
- }
|
|
|
- public PointF EndPoint
|
|
|
- {
|
|
|
- get { return endPoint; }
|
|
|
- set { endPoint = value; }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public Point GetZoomedCenterPoint()
|
|
|
- {
|
|
|
- Point pCenterPoint = new Point();
|
|
|
- //获取在工作窗口中X,Y位置
|
|
|
- pCenterPoint.X = (int)(this.GetZoomedRegion.X + this.GetZoomedRegion.Width / 2);
|
|
|
- pCenterPoint.Y = (int)(this.GetZoomedRegion.Y + this.GetZoomedRegion.Height / 2);
|
|
|
- return pCenterPoint;
|
|
|
- }
|
|
|
-
|
|
|
- public Point GetCenterPoint()
|
|
|
- {
|
|
|
- Point pCenterPoint = new Point();
|
|
|
- //获取在工作窗口中X,Y位置
|
|
|
- pCenterPoint.X = (int)(this.OrigionalDrawRegionF.X + this.OrigionalDrawRegionF.Width / 2);
|
|
|
- pCenterPoint.Y = (int)(this.OrigionalDrawRegionF.Y + this.OrigionalDrawRegionF.Height / 2);
|
|
|
- return pCenterPoint;
|
|
|
- }
|
|
|
- #endregion
|
|
|
-
|
|
|
-
|
|
|
- public void OnPaint(PaintEventArgs e)
|
|
|
+ #region 变量重写
|
|
|
+ public void OnPaint(PaintEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
|
|
|
//createType=0 圆角矩形 createType=1 圆形 createType=2 文字
|
|
|
if (createType == CreateRectangleType.SampleBackGround_Rectangle)
|
|
@@ -531,11 +325,11 @@ namespace OTSMeasureApp
|
|
|
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
|
|
@@ -545,7 +339,7 @@ namespace OTSMeasureApp
|
|
|
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);
|
|
|
|
|
|
}
|
|
@@ -688,8 +482,8 @@ namespace OTSMeasureApp
|
|
|
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));
|
|
|
+ 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)
|
|
@@ -700,25 +494,21 @@ namespace OTSMeasureApp
|
|
|
Color myColor = selColor;
|
|
|
System.Drawing.SolidBrush sampleBrush = new System.Drawing.SolidBrush(myColor);
|
|
|
Pen pen = new Pen(myColor, 1);
|
|
|
- if (PolygonPointRegionF.Count > 0)
|
|
|
+ if (PolygonPointFList.Count > 1)
|
|
|
{
|
|
|
List<PointF> PolygonPointF = new List<PointF>();
|
|
|
- foreach (var item in PolygonPointRegionF)
|
|
|
+ foreach (var item in m_PolygonPoints)
|
|
|
{
|
|
|
PolygonPointF.Add(item);
|
|
|
}
|
|
|
- if (EndPoint.X != 0 && EndPoint.Y != 0)
|
|
|
+ if (PolygonDrawingEndPoint.X != 0 && PolygonDrawingEndPoint.Y != 0)
|
|
|
{
|
|
|
- PolygonPointF.Add(EndPoint);
|
|
|
+ PolygonPointF.Add(PolygonDrawingEndPoint);
|
|
|
}
|
|
|
-
|
|
|
- e.Graphics.DrawLines(pen, PolygonPointF.ToArray());
|
|
|
- //多边形的外接矩形
|
|
|
- //if (Region != null)
|
|
|
- //{
|
|
|
- // e.Graphics.DrawRectangle(new Pen(Color.Green), Region);
|
|
|
- //}
|
|
|
+
|
|
|
+ e.Graphics.DrawLines(pen, PolygonPointF.ToArray());
|
|
|
|
|
|
+
|
|
|
}
|
|
|
}//多边形测量区域完成标识
|
|
|
else if (createType == CreateRectangleType.DrawPolygonFinish)
|
|
@@ -750,25 +540,312 @@ namespace OTSMeasureApp
|
|
|
e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; //图片柔顺模式选择
|
|
|
e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;//高质量
|
|
|
e.Graphics.CompositingQuality = CompositingQuality.HighQuality;//再加一点
|
|
|
-
|
|
|
+
|
|
|
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
|
|
|
+ {
|
|
|
+ get { return bseImage; }
|
|
|
+ set { bseImage = value; }
|
|
|
+ }
|
|
|
+ public float BSEImageWitdh
|
|
|
+ {
|
|
|
+ get { return bseImageWidth; }
|
|
|
+ set { bseImageWidth = value; }
|
|
|
+ }
|
|
|
+ public float BSEImageHeight
|
|
|
+ {
|
|
|
+ get { return bseImageHeight; }
|
|
|
+ set { bseImageHeight = value; }
|
|
|
+ }
|
|
|
+ public PointF BSEImageLocation
|
|
|
+ {
|
|
|
+ get { return bseImageLocation; }
|
|
|
+ set { bseImageLocation = value; }
|
|
|
+ }
|
|
|
+ public Color LineColor
|
|
|
+ {
|
|
|
+ get { return lineColor; }
|
|
|
+ set { lineColor = value; }
|
|
|
+ }
|
|
|
+ public float LineLength
|
|
|
+ {
|
|
|
+ get { return lineLength; }
|
|
|
+ set { lineLength = value; }
|
|
|
+ }
|
|
|
+ public PointF LineStartPoint
|
|
|
+ {
|
|
|
+ get { return lineStartPoint; }
|
|
|
+ set { lineStartPoint = value; }
|
|
|
+ }
|
|
|
+ public PointF SEMCenterPoint
|
|
|
+ {
|
|
|
+ get { return semCenterPoint; }
|
|
|
+ set { semCenterPoint = value; }
|
|
|
+ }
|
|
|
+ public int OTSX
|
|
|
+ {
|
|
|
+ get { return otsX; }
|
|
|
+ set { otsX = value; }
|
|
|
+ }
|
|
|
+ public int OTSY
|
|
|
+ {
|
|
|
+ get { return otsY; }
|
|
|
+ set { otsY = value; }
|
|
|
+ }
|
|
|
+ public CreateRectangleType CreateType
|
|
|
+ {
|
|
|
+ get { return createType; }
|
|
|
+ set { createType = value; }
|
|
|
+ }
|
|
|
+ public ShapeType Shape
|
|
|
+ {
|
|
|
+ get { return shape; }
|
|
|
+ set { shape = value; }
|
|
|
+ }
|
|
|
+ public Color SelColor
|
|
|
+ {
|
|
|
+ get { return selColor; }
|
|
|
+ set { selColor = value; }
|
|
|
+ }
|
|
|
+ public string Name
|
|
|
+ {
|
|
|
+ get { return name; }
|
|
|
+ set { name = value; }
|
|
|
+ }
|
|
|
+ public string ID
|
|
|
+ {
|
|
|
+ get { return id; }
|
|
|
+ set { id = value; }
|
|
|
+ }
|
|
|
+ public string SampleName
|
|
|
+ {
|
|
|
+ get { return sampleName; }
|
|
|
+ set { sampleName = value; }
|
|
|
+ }
|
|
|
+ public int SampleCount
|
|
|
+ {
|
|
|
+ get { return sampleCount; }
|
|
|
+ set { sampleCount = value; }
|
|
|
+ }
|
|
|
+ public string StrContent
|
|
|
+ {
|
|
|
+ get { return strContent; }
|
|
|
+ set { strContent = value; }
|
|
|
+ }
|
|
|
+ public RectangleF GetZoomedRegion
|
|
|
+ {
|
|
|
+
|
|
|
+ get {
|
|
|
+ var m_Region = new RectangleF();
|
|
|
+ m_Region.X = m_RegionF.X;
|
|
|
+ m_Region.Y = m_RegionF.Y;
|
|
|
+ m_Region.Width = m_RegionF.Width;
|
|
|
+ m_Region.Height = m_RegionF.Height;
|
|
|
+ return m_Region;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public RectangleF GetZoomedRegionF()
|
|
|
+ {
|
|
|
+ return m_RegionF;
|
|
|
+ }
|
|
|
+ public void SetInitRegionF(RectangleF OrigineRegionF)//not zoomed regine value
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ float x1, y1;
|
|
|
+ x1 = OrigineRegionF.X * m_zoomNum + m_refPoint.X;
|
|
|
+ y1 = OrigineRegionF.Y * m_zoomNum + m_refPoint.Y;
|
|
|
+
|
|
|
+ float w1, h1;
|
|
|
+ w1 = OrigineRegionF.Width * m_zoomNum;
|
|
|
+ h1 = OrigineRegionF.Height * m_zoomNum;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ m_OrigineRegionF = OrigineRegionF;
|
|
|
+
|
|
|
+ m_RegionF = new RectangleF(x1, y1, w1, h1);
|
|
|
+
|
|
|
+ CreateRectangleType shape = this.CreateType;
|
|
|
+ GraphicsPath MeasurePath = new GraphicsPath();
|
|
|
+ if (shape == CreateRectangleType.Rectangle)
|
|
|
+ {
|
|
|
+ MeasurePath.AddRectangle(m_RegionF);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MeasurePath.AddEllipse(m_RegionF);
|
|
|
+ }
|
|
|
+ this.g_Path = MeasurePath;
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ internal void SetScaleRegionF(RectangleF scaleRectangleF)
|
|
|
+ {
|
|
|
+ float x1, y1;
|
|
|
+ x1 = (scaleRectangleF.X-m_refPoint.X) / m_zoomNum ;
|
|
|
+ y1 = (scaleRectangleF.Y-m_refPoint.Y) / m_zoomNum ;
|
|
|
+
|
|
|
+ float w1, h1;
|
|
|
+ w1 = scaleRectangleF.Width / m_zoomNum;
|
|
|
+ h1 = scaleRectangleF.Height / m_zoomNum;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ m_OrigineRegionF = new RectangleF(x1, y1, w1, h1);
|
|
|
+
|
|
|
+ m_RegionF = scaleRectangleF;
|
|
|
+
|
|
|
+ CreateRectangleType shape = this.CreateType;
|
|
|
+ GraphicsPath MeasurePath = new GraphicsPath();
|
|
|
+ if (shape == CreateRectangleType.Rectangle)
|
|
|
+ {
|
|
|
+ MeasurePath.AddRectangle(m_RegionF);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MeasurePath.AddEllipse(m_RegionF);
|
|
|
+ }
|
|
|
+ this.g_Path = MeasurePath;
|
|
|
+ }
|
|
|
+
|
|
|
+ public RectangleF GetOrigionalDrawRegionF()
|
|
|
+ { return m_OrigineRegionF; }
|
|
|
+
|
|
|
+ public List<Point> PolygonPointRegion
|
|
|
+ {
|
|
|
+ get {
|
|
|
+ var m_PolygonPointRegion = new List<Point>();
|
|
|
+ foreach (var p in m_PolygonPoints)
|
|
|
+ {
|
|
|
+ m_PolygonPointRegion.Add(new Point((int)(p.X), (int)(p.Y)));
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ return m_PolygonPointRegion;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ public List<PointF> OriginalPolygonPointFList
|
|
|
+ {
|
|
|
+ get { return m_originalPolygonPoints; }
|
|
|
+
|
|
|
+ }
|
|
|
+ public List<PointF> PolygonPointFList
|
|
|
+ {
|
|
|
+ get { return m_PolygonPoints; }
|
|
|
+ set {
|
|
|
+ if (m_zoomNum != 1)
|
|
|
+ {
|
|
|
+ var ps = new List<PointF>();
|
|
|
+ foreach (var p in value)
|
|
|
+ {
|
|
|
+ var p1 = new PointF();
|
|
|
+ //x1 = (scaleRectangleF.X - m_refPoint.X) / m_zoomNum;
|
|
|
+ //y1 = (scaleRectangleF.Y - m_refPoint.Y) / m_zoomNum;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public GraphicsPath GPath
|
|
|
+ {
|
|
|
+ get {
|
|
|
+
|
|
|
+ var measureItem = this;
|
|
|
+ //重新绘制测量区域路径
|
|
|
+ GraphicsPath GPath = new GraphicsPath();
|
|
|
+ if (measureItem.CreateType == CreateRectangleType.Polygon)
|
|
|
+ {
|
|
|
+ GraphicsPath PolygonMeasurePath = new GraphicsPath();
|
|
|
+ PolygonMeasurePath.AddPolygon(measureItem.PolygonPointFList.ToArray());
|
|
|
+ GPath = PolygonMeasurePath;
|
|
|
+ }
|
|
|
+ else if (measureItem.CreateType == CreateRectangleType.CircleByThreePoints)
|
|
|
+ {
|
|
|
+ GPath.AddEllipse(GetZoomedRegionF());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (measureItem.Shape == (int)CreateRectangleType.Circle)
|
|
|
+ {
|
|
|
+ GPath.AddEllipse(GetZoomedRegionF());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ GPath.AddRectangle(GetZoomedRegionF());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ g_Path = GPath;
|
|
|
+ return g_Path;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public PointF PolygonDrawingEndPoint
|
|
|
+ {
|
|
|
+ get { return endPoint; }
|
|
|
+ set { endPoint = value; }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public Point GetZoomedCenterPoint()
|
|
|
+ {
|
|
|
+ Point pCenterPoint = new Point();
|
|
|
+ //获取在工作窗口中X,Y位置
|
|
|
+ pCenterPoint.X = (int)(this.GetZoomedRegion.X + this.GetZoomedRegion.Width / 2);
|
|
|
+ pCenterPoint.Y = (int)(this.GetZoomedRegion.Y + this.GetZoomedRegion.Height / 2);
|
|
|
+ return pCenterPoint;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Point GetCenterPoint()
|
|
|
+ {
|
|
|
+ Point pCenterPoint = new Point();
|
|
|
+ //获取在工作窗口中X,Y位置
|
|
|
+ pCenterPoint.X = (int)(this.GetOrigionalDrawRegionF().X + this.GetOrigionalDrawRegionF().Width / 2);
|
|
|
+ pCenterPoint.Y = (int)(this.GetOrigionalDrawRegionF().Y + this.GetOrigionalDrawRegionF().Height / 2);
|
|
|
+ return pCenterPoint;
|
|
|
+ }
|
|
|
+ #endregion
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public bool IsDragging
|
|
|
{
|
|
|
get { return m_IsDragging; }
|
|
|
set { m_IsDragging = value; }
|
|
|
}
|
|
|
- public bool IsSelect
|
|
|
+ public bool IsAltering// moving position or changing the size by gui operating.
|
|
|
{
|
|
|
- get { return m_IsSelect; }
|
|
|
- set { m_IsSelect = value; }
|
|
|
+ get { return m_IsAlter; }
|
|
|
+ set { m_IsAlter = value; }
|
|
|
}
|
|
|
|
|
|
public bool IsWorkSample
|
|
@@ -789,6 +866,10 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
m_refPoint = value;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
+ if (m_originalPolygonPoints.Count != 0)
|
|
|
+ {
|
|
|
+ this.PolygonPointFList = m_originalPolygonPoints;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public float GetZoomNumber()
|
|
@@ -799,7 +880,10 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
m_zoomNum = value;
|
|
|
SetInitRegionF(m_OrigineRegionF);
|
|
|
-
|
|
|
+ if (m_originalPolygonPoints.Count != 0)
|
|
|
+ {
|
|
|
+ this.PolygonPointFList = m_originalPolygonPoints;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -822,7 +906,7 @@ namespace OTSMeasureApp
|
|
|
return roundedRect;
|
|
|
}
|
|
|
|
|
|
- public bool IfContains(Point mousePoint)
|
|
|
+ public bool IfScaleContains(Point mousePoint)
|
|
|
{
|
|
|
if (mousePoint.X > m_RegionF.Left && mousePoint.X < m_RegionF.Left + m_RegionF.Width)
|
|
|
{
|
|
@@ -833,6 +917,20 @@ namespace OTSMeasureApp
|
|
|
}
|
|
|
|
|
|
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ public bool IfContains(Point thePoint)
|
|
|
+ {
|
|
|
+ if (thePoint.X > m_OrigineRegionF.Left && thePoint.X < m_OrigineRegionF.Left + m_OrigineRegionF.Width)
|
|
|
+ {
|
|
|
+ if (thePoint.Y > m_OrigineRegionF.Top && thePoint.Y < m_OrigineRegionF.Top + m_OrigineRegionF.Height)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
@@ -849,8 +947,9 @@ namespace OTSMeasureApp
|
|
|
{
|
|
|
if (m_zoomNum == 1)
|
|
|
{
|
|
|
- m_RegionF = OrigionalDrawRegionF;
|
|
|
+ m_RegionF = m_OrigineRegionF;
|
|
|
m_refPoint = new PointF(0, 0);
|
|
|
+ m_PolygonPoints = m_originalPolygonPoints;
|
|
|
}
|
|
|
float curZoom = m_zoomNum;
|
|
|
|
|
@@ -864,8 +963,8 @@ namespace OTSMeasureApp
|
|
|
m_refPoint.X= (m_refPoint.X-mousePoint.X)/ curZoom * deltaZoom+m_refPoint.X;
|
|
|
m_refPoint.Y = (m_refPoint.Y - mousePoint.Y) / curZoom * deltaZoom + m_refPoint.Y;
|
|
|
|
|
|
- float Width = OrigionalDrawRegionF.Width * zoomNum;
|
|
|
- float Height = OrigionalDrawRegionF.Height * zoomNum;
|
|
|
+ float Width = GetOrigionalDrawRegionF().Width * zoomNum;
|
|
|
+ float Height = GetOrigionalDrawRegionF().Height * zoomNum;
|
|
|
m_RegionF = new RectangleF(X1, Y1, Width, Height);
|
|
|
m_zoomNum = zoomNum;
|
|
|
|
|
@@ -876,10 +975,32 @@ namespace OTSMeasureApp
|
|
|
BSEImageLocation = m_RegionF.Location;
|
|
|
SEMCenterPoint = 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)
|
|
|
{
|
|
|
|
|
@@ -901,9 +1022,33 @@ namespace OTSMeasureApp
|
|
|
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 Show(PointF location)
|
|
|
+ {
|
|
|
+ m_RegionF.Location = location;
|
|
|
}
|
|
|
|
|
|
public CRectangleGDIObject Duplicate(CreateRectangleType newType)
|
|
@@ -914,7 +1059,7 @@ namespace OTSMeasureApp
|
|
|
r.m_OrigineRegionF = this.m_OrigineRegionF;
|
|
|
|
|
|
r.IsWorkSample = this.IsWorkSample;
|
|
|
- r.IsSelect = this.IsSelect;
|
|
|
+ //r.IsAltering = this.IsAltering;
|
|
|
r.m_RegionF = this.m_RegionF;
|
|
|
|
|
|
|
|
@@ -928,18 +1073,13 @@ namespace OTSMeasureApp
|
|
|
return r;
|
|
|
}
|
|
|
|
|
|
- public void Reset()
|
|
|
- {
|
|
|
- m_RegionF = m_OrigineRegionF;
|
|
|
- //Zoom(m_refPoint, 1);
|
|
|
- }
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
//是否设置为选择样品
|
|
|
- private bool m_IsSelect;
|
|
|
+ private bool m_IsAlter;
|
|
|
//是否存在帧图信息
|
|
|
- //private bool m_IsSingle;
|
|
|
+
|
|
|
//是否设置为拖动
|
|
|
private bool m_IsDragging;
|
|
|
//是否为工作样品
|
|
@@ -958,7 +1098,7 @@ namespace OTSMeasureApp
|
|
|
private RectangleF m_RegionF;
|
|
|
//绘制时与移动缩放时记录的位置与尺寸
|
|
|
private RectangleF m_OrigineRegionF;
|
|
|
- private GraphicsPath g_Path;
|
|
|
+ private GraphicsPath g_Path=new GraphicsPath();
|
|
|
private PointF startPoint;
|
|
|
private PointF endPoint;
|
|
|
|
|
@@ -978,18 +1118,20 @@ namespace OTSMeasureApp
|
|
|
private PointF bseImageLocation;
|
|
|
//绘制SEM中心位置
|
|
|
private PointF semCenterPoint;
|
|
|
- //
|
|
|
- private List<Point> m_PolygonPointRegion;
|
|
|
- private List<PointF> m_PolygonPointRegionF;
|
|
|
+
|
|
|
+
|
|
|
+ private List<PointF> m_PolygonPoints=new List<PointF>();
|
|
|
//绘制时与移动缩放时记录的位置
|
|
|
- private List<PointF> m_DrawPolygonPointRegionF;
|
|
|
+ private List<PointF> m_originalPolygonPoints = new List<PointF>();
|
|
|
|
|
|
- private List<CRectangleGDIObject> subItems;
|
|
|
+ private List<CRectangleGDIObject> subItems=new List<CRectangleGDIObject>();
|
|
|
|
|
|
|
|
|
private float m_zoomNum=1;
|
|
|
|
|
|
private PointF m_refPoint=new PointF(0,0);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public enum SEMControlIndex
|