|
@@ -20,7 +20,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
|
|
|
{
|
|
|
|
|
|
}
|
|
|
- public void DrawStageBoundery(CStage a_pStage, int a_nWidth, int a_nHeight, Object pDC, double a_dPixSize)
|
|
|
+ public void DrawStageBoundery(CStage a_pStage, int a_nWidth, int a_nHeight, Object pDC, double a_dPixSizeX, double a_dPixSizeY)
|
|
|
{
|
|
|
if (a_pStage == null)
|
|
|
{
|
|
@@ -32,12 +32,12 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
|
|
|
nShape = pBoundery.GetShape();
|
|
|
|
|
|
Rectangle PixRect = new Rectangle();
|
|
|
- GetPixRect(pBoundery, a_nWidth, a_nHeight, a_dPixSize, ref PixRect);
|
|
|
+ GetPixRect(pBoundery, a_nWidth, a_nHeight, a_dPixSizeX, a_dPixSizeY, ref PixRect);
|
|
|
DrawShape(PixRect, pDC, nShape, true);
|
|
|
}
|
|
|
|
|
|
// draw stage hole
|
|
|
- public void DrawStageHole(CStage a_pStage, int a_nWidth, int a_nHeight, Object pDC, double a_dPixSize)
|
|
|
+ public void DrawStageHole(CStage a_pStage, int a_nWidth, int a_nHeight, Object pDC, double a_dPixSizeX, double a_dPixSizeY)
|
|
|
{
|
|
|
if (a_pStage == null)
|
|
|
{
|
|
@@ -55,12 +55,10 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
|
|
|
nShape = pHole.GetShape();
|
|
|
|
|
|
Rectangle PixRect = new Rectangle();
|
|
|
- GetPixRect(pHole, a_nWidth, a_nHeight, a_dPixSize, ref PixRect);
|
|
|
+ GetPixRect(pHole, a_nWidth, a_nHeight, a_dPixSizeX, a_dPixSizeY, ref PixRect);
|
|
|
|
|
|
DrawShape(PixRect, pDC, nShape, true);
|
|
|
|
|
|
- int nHeight = PixRect.Height * 2 / 3;
|
|
|
-
|
|
|
//设置文字对齐方式
|
|
|
StringFormat sf = new StringFormat();
|
|
|
sf.Alignment = StringAlignment.Center;
|
|
@@ -119,7 +117,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
|
|
|
}
|
|
|
|
|
|
// get pixle rect
|
|
|
- public bool GetPixRect(CDomain a_pDomain, int a_nWidth, int a_nHeight, double a_dPixSize, ref Rectangle PixRect)
|
|
|
+ public bool GetPixRect(CDomain a_pDomain, int a_nWidth, int a_nHeight, double a_dPixSizeX, double a_dPixSizeY, ref Rectangle PixRect)
|
|
|
{
|
|
|
if (a_pDomain == null)
|
|
|
{
|
|
@@ -128,25 +126,25 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
|
|
|
|
|
|
RectangleF DomainRect = a_pDomain.GetDomainRect();
|
|
|
|
|
|
- int CenterX = a_nWidth / 2; //pixle center
|
|
|
- int CenterY = a_nHeight / 2;
|
|
|
+ Double CenterX = a_nWidth / 2; //pixle center
|
|
|
+ Double CenterY = a_nHeight / 2;
|
|
|
|
|
|
PointF DomainCenter = a_pDomain.GetDomainCenter(); // um center
|
|
|
|
|
|
- Point PixCenter = new Point();
|
|
|
- PixCenter.X = (int)((double)DomainCenter.X / a_dPixSize);
|
|
|
- PixCenter.Y = (int)((double)DomainCenter.Y / a_dPixSize); // um to pixle
|
|
|
+ PointF PixCenter = new Point();
|
|
|
+ PixCenter.X = (float)(DomainCenter.X / a_dPixSizeX);
|
|
|
+ PixCenter.Y = (float)(DomainCenter.Y / a_dPixSizeY); // um to pixle
|
|
|
|
|
|
- int PixRectCenterX = CenterX + PixCenter.X;
|
|
|
- int PixRectCenterY = CenterY - PixCenter.Y;//OTS y dirction is different with pixle direction
|
|
|
+ Double PixRectCenterX = CenterX + PixCenter.X;
|
|
|
+ Double PixRectCenterY = CenterY - PixCenter.Y;//OTS y dirction is different with pixle direction
|
|
|
|
|
|
- int delteX = PixRectCenterX - PixCenter.X;
|
|
|
- int delteY = PixRectCenterY - PixCenter.Y;
|
|
|
+ Double delteX = PixRectCenterX - PixCenter.X;
|
|
|
+ Double delteY = PixRectCenterY - PixCenter.Y;
|
|
|
|
|
|
- int Left = (int)(DomainRect.Left / a_dPixSize + delteX);
|
|
|
- int Top = (int)(DomainRect.Top / a_dPixSize + delteY);
|
|
|
- int Right = (int)(DomainRect.Right / a_dPixSize + delteX);
|
|
|
- int Bottom = (int)(DomainRect.Bottom / a_dPixSize + delteY);
|
|
|
+ int Left = (int)Math.Round(DomainRect.Left / a_dPixSizeX + delteX);
|
|
|
+ int Top = (int)Math.Round(DomainRect.Top / a_dPixSizeY + delteY);
|
|
|
+ int Right = (int)Math.Round(DomainRect.Right / a_dPixSizeX + delteX);
|
|
|
+ int Bottom = (int)Math.Round(DomainRect.Bottom / a_dPixSizeY + delteY);
|
|
|
|
|
|
PixRect.Location = new Point(Left, Top);
|
|
|
PixRect.Size = new Size(Math.Abs(Right - Left), Math.Abs(Bottom - Top));
|
|
@@ -256,7 +254,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
|
|
|
/// 在任意的panel里画一个坐标,坐标所在的四边形距离panel边50像素
|
|
|
/// </summary>
|
|
|
/// <param name="pan"></param>
|
|
|
- public void DrawXY(Object a_pDC, double width,double height, double a_dPixSize,double coordinateSystemEndpointX, double coordinateSystemEndpointY)
|
|
|
+ public void DrawXY(Object a_pDC, double width,double height, double a_dPixSizeX, double a_dPixSizeY, double coordinateSystemEndpointX, double coordinateSystemEndpointY)
|
|
|
{
|
|
|
if (a_pDC == null)
|
|
|
{
|
|
@@ -267,19 +265,19 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
|
|
|
//绘制X轴,
|
|
|
double ObjectCenterX = width/ 2;
|
|
|
double ObjectCenterY = height / 2;
|
|
|
- int X0 = (int)(coordinateSystemEndpointX / a_dPixSize + ObjectCenterX);
|
|
|
- int Y0 = (int)(0 / a_dPixSize + ObjectCenterY);
|
|
|
- int X1 = (int)(-coordinateSystemEndpointX / a_dPixSize + ObjectCenterX);
|
|
|
- int Y1 = (int)(0 / a_dPixSize + ObjectCenterY);
|
|
|
+ int X0 = (int)(coordinateSystemEndpointX / a_dPixSizeX + ObjectCenterX);
|
|
|
+ int Y0 = (int)(0 / a_dPixSizeX + ObjectCenterY);
|
|
|
+ int X1 = (int)(-coordinateSystemEndpointX / a_dPixSizeX + ObjectCenterX);
|
|
|
+ int Y1 = (int)(0 / a_dPixSizeX + ObjectCenterY);
|
|
|
Point px1 = new Point(X0, Y0);
|
|
|
Point px2 = new Point(X1, Y1);
|
|
|
Pen pen = new Pen(Brushes.Green, 1);
|
|
|
g.DrawLine(pen, px1, px2);
|
|
|
//绘制Y轴
|
|
|
- int X3 = (int)(0 / a_dPixSize + ObjectCenterX);
|
|
|
- int Y3 = (int)(coordinateSystemEndpointY / a_dPixSize + ObjectCenterY);
|
|
|
- int X4 = (int)(0 / a_dPixSize + ObjectCenterX);
|
|
|
- int Y4 = (int)(-coordinateSystemEndpointY / a_dPixSize + ObjectCenterY);
|
|
|
+ int X3 = (int)(0 / a_dPixSizeY + ObjectCenterX);
|
|
|
+ int Y3 = (int)(coordinateSystemEndpointY / a_dPixSizeY + ObjectCenterY);
|
|
|
+ int X4 = (int)(0 / a_dPixSizeY + ObjectCenterX);
|
|
|
+ int Y4 = (int)(-coordinateSystemEndpointY / a_dPixSizeY + ObjectCenterY);
|
|
|
PointF py1 = new PointF(X3, Y3);
|
|
|
PointF py2 = new PointF(X4, Y4);
|
|
|
g.DrawLine(pen, py1, py2);
|
|
@@ -287,54 +285,54 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
|
|
|
int move = 5,len=10;
|
|
|
for (int i = 1; i <= len; i++) //len等分Y正轴
|
|
|
{
|
|
|
- Point px3 = new Point((int)ObjectCenterX + move, (int)(ObjectCenterY + (-coordinateSystemEndpointY / a_dPixSize) / len * i));
|
|
|
- Point px4 = new Point((int)ObjectCenterX, (int)(ObjectCenterY + (-coordinateSystemEndpointY / a_dPixSize) / len * i));
|
|
|
+ Point px3 = new Point((int)ObjectCenterX + move, (int)(ObjectCenterY + (-coordinateSystemEndpointY / a_dPixSizeY) / len * i));
|
|
|
+ Point px4 = new Point((int)ObjectCenterX, (int)(ObjectCenterY + (-coordinateSystemEndpointY / a_dPixSizeY) / len * i));
|
|
|
string sx = ((int)(-(-coordinateSystemEndpointY) / len * i)).ToString();
|
|
|
g.DrawLine(pen, px3, px4);
|
|
|
StringFormat drawFormat = new StringFormat();
|
|
|
drawFormat.Alignment = StringAlignment.Far;
|
|
|
drawFormat.LineAlignment = StringAlignment.Center;
|
|
|
- g.DrawString(sx, new Font("宋体", 8f), Brushes.Green, new Point((int)ObjectCenterX - 5, (int)(ObjectCenterY + (-coordinateSystemEndpointY / a_dPixSize) / len * i)), drawFormat);
|
|
|
+ g.DrawString(sx, new Font("宋体", 8f), Brushes.Green, new Point((int)ObjectCenterX - 5, (int)(ObjectCenterY + (-coordinateSystemEndpointY / a_dPixSizeY) / len * i)), drawFormat);
|
|
|
}
|
|
|
for (int i = 1; i <= len; i++)
|
|
|
{
|
|
|
- Point px3 = new Point((int)ObjectCenterX + move, (int)(ObjectCenterY + (coordinateSystemEndpointY / a_dPixSize) / len * i));
|
|
|
- Point px4 = new Point((int)ObjectCenterX, (int)(ObjectCenterY + (coordinateSystemEndpointY / a_dPixSize) / len * i));
|
|
|
+ Point px3 = new Point((int)ObjectCenterX + move, (int)(ObjectCenterY + (coordinateSystemEndpointY / a_dPixSizeY) / len * i));
|
|
|
+ Point px4 = new Point((int)ObjectCenterX, (int)(ObjectCenterY + (coordinateSystemEndpointY / a_dPixSizeY) / len * i));
|
|
|
string sx = ((int)((-coordinateSystemEndpointY) / len * i)).ToString();
|
|
|
g.DrawLine(pen, px3, px4);
|
|
|
StringFormat drawFormat = new StringFormat();
|
|
|
drawFormat.Alignment = StringAlignment.Far;
|
|
|
drawFormat.LineAlignment = StringAlignment.Center;
|
|
|
- g.DrawString(sx, new Font("宋体", 8f), Brushes.Green, new Point((int)ObjectCenterX - 5, (int)(ObjectCenterY + (coordinateSystemEndpointY / a_dPixSize) / len * i)), drawFormat);
|
|
|
+ g.DrawString(sx, new Font("宋体", 8f), Brushes.Green, new Point((int)ObjectCenterX - 5, (int)(ObjectCenterY + (coordinateSystemEndpointY / a_dPixSizeY) / len * i)), drawFormat);
|
|
|
}
|
|
|
for (int i = 1; i <= len; i++) //len等分X正轴
|
|
|
{
|
|
|
- Point px3 = new Point((int)(ObjectCenterX + (coordinateSystemEndpointX / a_dPixSize) / len * i) , (int)(ObjectCenterY + move));
|
|
|
- Point px4 = new Point((int)(ObjectCenterX + (coordinateSystemEndpointX / a_dPixSize) / len * i), (int)ObjectCenterY);
|
|
|
+ Point px3 = new Point((int)(ObjectCenterX + (coordinateSystemEndpointX / a_dPixSizeX) / len * i) , (int)(ObjectCenterY + move));
|
|
|
+ Point px4 = new Point((int)(ObjectCenterX + (coordinateSystemEndpointX / a_dPixSizeX) / len * i), (int)ObjectCenterY);
|
|
|
string sx = ((int)(coordinateSystemEndpointX / len * i)).ToString();
|
|
|
g.DrawLine(pen, px3, px4);
|
|
|
StringFormat drawFormat = new StringFormat();
|
|
|
drawFormat.Alignment = StringAlignment.Far;
|
|
|
drawFormat.LineAlignment = StringAlignment.Center;
|
|
|
- g.DrawString(sx, new Font("宋体", 6f), Brushes.Green, new Point((int)(ObjectCenterX + (coordinateSystemEndpointX / a_dPixSize) / len * i)+5, (int)(ObjectCenterY + 15)), drawFormat);
|
|
|
+ g.DrawString(sx, new Font("宋体", 6f), Brushes.Green, new Point((int)(ObjectCenterX + (coordinateSystemEndpointX / a_dPixSizeX) / len * i)+5, (int)(ObjectCenterY + 15)), drawFormat);
|
|
|
}
|
|
|
for (int i = 1; i <= len; i++)
|
|
|
{
|
|
|
- Point px3 = new Point((int)(ObjectCenterX + (-coordinateSystemEndpointX / a_dPixSize) / len * i), (int)(ObjectCenterY + move));
|
|
|
- Point px4 = new Point((int)(ObjectCenterX + (-coordinateSystemEndpointX / a_dPixSize) / len * i), (int)(ObjectCenterY));
|
|
|
+ Point px3 = new Point((int)(ObjectCenterX + (-coordinateSystemEndpointX / a_dPixSizeX) / len * i), (int)(ObjectCenterY + move));
|
|
|
+ Point px4 = new Point((int)(ObjectCenterX + (-coordinateSystemEndpointX / a_dPixSizeX) / len * i), (int)(ObjectCenterY));
|
|
|
string sx = ((int)((-coordinateSystemEndpointX) / len * i)).ToString();
|
|
|
g.DrawLine(pen, px3, px4);
|
|
|
StringFormat drawFormat = new StringFormat();
|
|
|
drawFormat.Alignment = StringAlignment.Far;
|
|
|
drawFormat.LineAlignment = StringAlignment.Center;
|
|
|
- g.DrawString(sx, new Font("宋体", 6f), Brushes.Green, new Point((int)(ObjectCenterX + (-coordinateSystemEndpointX / a_dPixSize) / len * i)+5, (int)(ObjectCenterY + 15)), drawFormat);
|
|
|
+ g.DrawString(sx, new Font("宋体", 6f), Brushes.Green, new Point((int)(ObjectCenterX + (-coordinateSystemEndpointX / a_dPixSizeX) / len * i)+5, (int)(ObjectCenterY + 15)), drawFormat);
|
|
|
}
|
|
|
|
|
|
//g.Dispose();
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
- public void DrawStageSTD(CStage a_pStage, int a_nWidth, int a_nHeight, Object pDC, double a_dPixSize)
|
|
|
+ public void DrawStageSTD(CStage a_pStage, int a_nWidth, int a_nHeight, Object pDC, double a_dPixSizeX, double a_dPixSizeY)
|
|
|
{
|
|
|
if (a_pStage == null)
|
|
|
{
|
|
@@ -346,7 +344,7 @@ namespace OTSMeasureApp._7_OTSProgMgrInfo.Stage
|
|
|
nShape = pSTD.GetShape();
|
|
|
|
|
|
Rectangle PixRect = new Rectangle();
|
|
|
- GetPixRect(pSTD, a_nWidth, a_nHeight, a_dPixSize, ref PixRect);
|
|
|
+ GetPixRect(pSTD, a_nWidth, a_nHeight, a_dPixSizeX, a_dPixSizeY, ref PixRect);
|
|
|
|
|
|
DrawShape(PixRect, pDC, nShape, false);
|
|
|
}
|