|
@@ -1,23 +1,27 @@
|
|
|
-
|
|
|
|
|
-using OTSDataType;
|
|
|
|
|
-using System;
|
|
|
|
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
|
|
+using System.ComponentModel;
|
|
|
|
|
+using System.Data;
|
|
|
using System.Drawing;
|
|
using System.Drawing;
|
|
|
-using System.Drawing.Drawing2D;
|
|
|
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
-using System.Runtime.InteropServices;
|
|
|
|
|
using System.Text;
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
|
-using System.Windows;
|
|
|
|
|
using System.Windows.Forms;
|
|
using System.Windows.Forms;
|
|
|
-using System.Media;
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+using OTSDataType;
|
|
|
|
|
|
|
|
-namespace OTSModelSharp
|
|
|
|
|
|
|
+namespace OTSModelSharp.Measure.GetStageInfo
|
|
|
{
|
|
{
|
|
|
- public class DlgStageMgr
|
|
|
|
|
|
|
+ public partial class DlgStageMgr : Form
|
|
|
{
|
|
{
|
|
|
|
|
+ public DlgStageMgr()
|
|
|
|
|
+ {
|
|
|
|
|
+ InitializeComponent();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void DlgStageMgr_Load(object sender, EventArgs e)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
public static NLog.Logger loger = NLog.LogManager.GetCurrentClassLogger();
|
|
public static NLog.Logger loger = NLog.LogManager.GetCurrentClassLogger();
|
|
|
|
|
|
|
|
otsdataconst model = new otsdataconst();
|
|
otsdataconst model = new otsdataconst();
|
|
@@ -64,12 +68,12 @@ namespace OTSModelSharp
|
|
|
|
|
|
|
|
public struct BLENDFUNCTION
|
|
public struct BLENDFUNCTION
|
|
|
{
|
|
{
|
|
|
- public Byte BlendOp;
|
|
|
|
|
- public Byte BlendFlags;
|
|
|
|
|
- public Byte SourceConstantAlpha;
|
|
|
|
|
- public Byte AlphaFormat;
|
|
|
|
|
|
|
+ public Byte BlendOp;
|
|
|
|
|
+ public Byte BlendFlags;
|
|
|
|
|
+ public Byte SourceConstantAlpha;
|
|
|
|
|
+ public Byte AlphaFormat;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
public enum OTS_SOFT_PACKAGE_ID
|
|
public enum OTS_SOFT_PACKAGE_ID
|
|
|
{
|
|
{
|
|
@@ -81,7 +85,7 @@ namespace OTSModelSharp
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// soft pack id
|
|
// soft pack id
|
|
|
- public OTS_SOFT_PACKAGE_ID m_nPackId;
|
|
|
|
|
|
|
+ public OTS_SOFT_PACKAGE_ID m_nPackId;
|
|
|
|
|
|
|
|
// CDlgStageMgr message map
|
|
// CDlgStageMgr message map
|
|
|
public void OnClickedBtnImport()
|
|
public void OnClickedBtnImport()
|
|
@@ -205,7 +209,8 @@ namespace OTSModelSharp
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public bool UpdateData(bool bSaveAndValidate) {
|
|
|
|
|
|
|
+ public bool UpdateData(bool bSaveAndValidate)
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
return true;
|
|
return true;
|
|
|
|
|
|
|
@@ -219,7 +224,7 @@ namespace OTSModelSharp
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- Rect rc = new Rect();
|
|
|
|
|
|
|
+ Rectangle rc = new Rectangle();
|
|
|
System.Drawing.Rectangle re = new System.Drawing.Rectangle();
|
|
System.Drawing.Rectangle re = new System.Drawing.Rectangle();
|
|
|
int pWnd = GetDlgItem(otsdataconst.IDC_PIC_STAGE);
|
|
int pWnd = GetDlgItem(otsdataconst.IDC_PIC_STAGE);
|
|
|
|
|
|
|
@@ -259,17 +264,17 @@ namespace OTSModelSharp
|
|
|
}
|
|
}
|
|
|
//draw boundery
|
|
//draw boundery
|
|
|
Brush pLTGrayBrush = GetStockObject(LTGRAY_BRUSH);
|
|
Brush pLTGrayBrush = GetStockObject(LTGRAY_BRUSH);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
DrawStageBoundery(pStage[LTGRAY_BRUSH], nWidth, nHeight, pDC, PixSize);
|
|
DrawStageBoundery(pStage[LTGRAY_BRUSH], nWidth, nHeight, pDC, PixSize);
|
|
|
|
|
|
|
|
//draw STD
|
|
//draw STD
|
|
|
Brush pBlackBrush = GetStockObject(BLACK_BRUSH);
|
|
Brush pBlackBrush = GetStockObject(BLACK_BRUSH);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
DrawStageSTD(pStage[BLACK_BRUSH], nWidth, nHeight, pDC, PixSize);
|
|
DrawStageSTD(pStage[BLACK_BRUSH], nWidth, nHeight, pDC, PixSize);
|
|
|
|
|
|
|
|
//draw holes
|
|
//draw holes
|
|
|
Brush pWriteBrush = GetStockObject(WHITE_BRUSH);
|
|
Brush pWriteBrush = GetStockObject(WHITE_BRUSH);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
DrawStageHole(pStage[WHITE_BRUSH], nWidth, nHeight, pDC, PixSize);
|
|
DrawStageHole(pStage[WHITE_BRUSH], nWidth, nHeight, pDC, PixSize);
|
|
|
|
|
|
|
|
// draw ratio
|
|
// draw ratio
|
|
@@ -285,17 +290,19 @@ namespace OTSModelSharp
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
pOldBrush.Dispose();
|
|
pOldBrush.Dispose();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public int GetDlgItem(int nID) {
|
|
|
|
|
|
|
+ public int GetDlgItem(int nID)
|
|
|
|
|
+ {
|
|
|
return nID;
|
|
return nID;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// stage file get and set
|
|
// stage file get and set
|
|
|
- public CStageFile GetStageFile() {
|
|
|
|
|
|
|
+ public CStageFile GetStageFile()
|
|
|
|
|
+ {
|
|
|
return m_pStageFile;
|
|
return m_pStageFile;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -311,10 +318,10 @@ namespace OTSModelSharp
|
|
|
public void SetPackId(OTS_SOFT_PACKAGE_ID a_nPackId) { m_nPackId = a_nPackId; }
|
|
public void SetPackId(OTS_SOFT_PACKAGE_ID a_nPackId) { m_nPackId = a_nPackId; }
|
|
|
|
|
|
|
|
// draw shape
|
|
// draw shape
|
|
|
- public void DrawShape(Rect a_PixRect, Object a_pDC, DOMAIN_SHAPE a_nShape, bool a_bIsRand) { }
|
|
|
|
|
|
|
+ public void DrawShape(Rectangle a_PixRect, Object a_pDC, DOMAIN_SHAPE a_nShape, bool a_bIsRand) { }
|
|
|
|
|
|
|
|
// get pixle rect
|
|
// get pixle rect
|
|
|
- public bool GetPixRect(CDomain a_pDomain, int a_nWidth, int a_nHeight, double a_dPixSize, Rect PixRect) { return true; }
|
|
|
|
|
|
|
+ public bool GetPixRect(CDomain a_pDomain, int a_nWidth, int a_nHeight, double a_dPixSize, Rectangle PixRect) { return true; }
|
|
|
|
|
|
|
|
// draw stage boundery
|
|
// draw stage boundery
|
|
|
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_dPixSize) { }
|
|
@@ -325,7 +332,7 @@ namespace OTSModelSharp
|
|
|
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_dPixSize) { }
|
|
|
|
|
|
|
|
// draw ratio
|
|
// draw ratio
|
|
|
- public void DrawRatio(int a_nBounderyWidth, int a_nWidth, int a_nHeight, Object pDC, IntPtr pWnd, Rect rc) { }
|
|
|
|
|
|
|
+ public void DrawRatio(int a_nBounderyWidth, int a_nWidth, int a_nHeight, Object pDC, IntPtr pWnd, Rectangle rc) { }
|
|
|
|
|
|
|
|
//public Brush GetStockObject(int i) {
|
|
//public Brush GetStockObject(int i) {
|
|
|
|
|
|
|
@@ -333,67 +340,70 @@ namespace OTSModelSharp
|
|
|
// return (Brush)brushConverter.ConvertFromString(LTGRAY_BRUSH.ToString());
|
|
// return (Brush)brushConverter.ConvertFromString(LTGRAY_BRUSH.ToString());
|
|
|
|
|
|
|
|
//}
|
|
//}
|
|
|
- public Brush GetStockObject(int i) {
|
|
|
|
|
|
|
+ public Brush GetStockObject(int i)
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// boundary
|
|
// boundary
|
|
|
- public CDomain GetBoundary() {
|
|
|
|
|
|
|
+ public CDomain GetBoundary()
|
|
|
|
|
+ {
|
|
|
return m_poBourary;
|
|
return m_poBourary;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public Brush SelectObject(Brush pBrush) {
|
|
|
|
|
|
|
+ public Brush SelectObject(Brush pBrush)
|
|
|
|
|
+ {
|
|
|
|
|
|
|
|
return pBrush;
|
|
return pBrush;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void DrawRatio(int a_nBounderyWidth, int a_nWidth, int a_nHeight, int pDC, int pWnd, Rect rc)
|
|
|
|
|
- {
|
|
|
|
|
- if (pDC ==0)
|
|
|
|
|
- {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (pWnd == 0)
|
|
|
|
|
- {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ public void DrawRatio(int a_nBounderyWidth, int a_nWidth, int a_nHeight, int pDC, int pWnd, Rectangle rc)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (pDC == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ if (pWnd == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- int nRatio = a_nBounderyWidth * (a_nWidth / 2 - RATIO_RECT_LEFT - 10) / (a_nWidth - PIC_EDGE * 2) / 1000; //显示在标尺上的mm数
|
|
|
|
|
- String.Format("%dcm", nRatio);
|
|
|
|
|
|
|
|
|
|
- System.Drawing.Point oRatioStart = new System.Drawing.Point();
|
|
|
|
|
- oRatioStart.X = RATIO_RECT_LEFT;
|
|
|
|
|
- oRatioStart.Y = a_nHeight - RATIO_RECT_HEIGHT - RATIO_RECT_DOWN;
|
|
|
|
|
|
|
+ int nRatio = a_nBounderyWidth * (a_nWidth / 2 - RATIO_RECT_LEFT - 10) / (a_nWidth - PIC_EDGE * 2) / 1000; //显示在标尺上的mm数
|
|
|
|
|
+ String.Format("%dcm", nRatio);
|
|
|
|
|
|
|
|
- System.Drawing.Point oRatioEnd = new System.Drawing.Point();
|
|
|
|
|
- oRatioEnd.X = a_nWidth / 2;
|
|
|
|
|
- oRatioEnd.Y = a_nHeight - RATIO_RECT_DOWN;
|
|
|
|
|
|
|
+ System.Drawing.Point oRatioStart = new System.Drawing.Point();
|
|
|
|
|
+ oRatioStart.X = RATIO_RECT_LEFT;
|
|
|
|
|
+ oRatioStart.Y = a_nHeight - RATIO_RECT_HEIGHT - RATIO_RECT_DOWN;
|
|
|
|
|
|
|
|
- Control control = new Control();
|
|
|
|
|
|
|
+ System.Drawing.Point oRatioEnd = new System.Drawing.Point();
|
|
|
|
|
+ oRatioEnd.X = a_nWidth / 2;
|
|
|
|
|
+ oRatioEnd.Y = a_nHeight - RATIO_RECT_DOWN;
|
|
|
|
|
+
|
|
|
|
|
+ Control control = new Control();
|
|
|
//标尺
|
|
//标尺
|
|
|
-
|
|
|
|
|
- FontDialog fontdialog = new FontDialog();
|
|
|
|
|
- fontdialog.ShowDialog();
|
|
|
|
|
- control.Font = fontdialog.Font;
|
|
|
|
|
- control.Font = new System.Drawing.Font("华文新魏", 22.2f, FontStyle.Bold );
|
|
|
|
|
|
|
|
|
|
- System.Drawing.Font def_font = new System.Drawing.Font(control.Font, FontStyle.Regular);
|
|
|
|
|
|
|
+ FontDialog fontdialog = new FontDialog();
|
|
|
|
|
+ fontdialog.ShowDialog();
|
|
|
|
|
+ control.Font = fontdialog.Font;
|
|
|
|
|
+ control.Font = new System.Drawing.Font("华文新魏", 22.2f, FontStyle.Bold);
|
|
|
|
|
+
|
|
|
|
|
+ System.Drawing.Font def_font = new System.Drawing.Font(control.Font, FontStyle.Regular);
|
|
|
|
|
+
|
|
|
|
|
|
|
|
-
|
|
|
|
|
BLENDFUNCTION bf = new BLENDFUNCTION();
|
|
BLENDFUNCTION bf = new BLENDFUNCTION();
|
|
|
bf.BlendOp = 1;
|
|
bf.BlendOp = 1;
|
|
|
- bf.BlendFlags = 0;
|
|
|
|
|
- bf.AlphaFormat = 0;
|
|
|
|
|
- bf.SourceConstantAlpha = 10;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ bf.BlendFlags = 0;
|
|
|
|
|
+ bf.AlphaFormat = 0;
|
|
|
|
|
+ bf.SourceConstantAlpha = 10;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
public CStageFile ShowStageMgrDialog(OTS_SOFT_PACKAGE_ID a_nPackId, CStageFile a_pStageFile)
|
|
public CStageFile ShowStageMgrDialog(OTS_SOFT_PACKAGE_ID a_nPackId, CStageFile a_pStageFile)
|
|
|
{
|
|
{
|
|
|
- if (a_pStageFile==null)
|
|
|
|
|
|
|
+ if (a_pStageFile == null)
|
|
|
{
|
|
{
|
|
|
//LogErrorTrace(__FILE__, __LINE__, _T("ShowStageMgrDialog:invalid stage file."));
|
|
//LogErrorTrace(__FILE__, __LINE__, _T("ShowStageMgrDialog:invalid stage file."));
|
|
|
loger.Error("ShowStageMgrDialog:invalid stage file.");
|
|
loger.Error("ShowStageMgrDialog:invalid stage file.");
|
|
@@ -401,7 +411,7 @@ namespace OTSModelSharp
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//show the dialog
|
|
//show the dialog
|
|
|
- DlgStageMgr dlg=new DlgStageMgr();
|
|
|
|
|
|
|
+ DlgStageMgr dlg = new DlgStageMgr();
|
|
|
dlg.SetStageFile(a_pStageFile);
|
|
dlg.SetStageFile(a_pStageFile);
|
|
|
dlg.SetPackId(a_nPackId);
|
|
dlg.SetPackId(a_nPackId);
|
|
|
|
|
|
|
@@ -409,7 +419,7 @@ namespace OTSModelSharp
|
|
|
|
|
|
|
|
CStageFile pStageFile = dlg.GetStageFile();
|
|
CStageFile pStageFile = dlg.GetStageFile();
|
|
|
//ASSERT(pStageFile);
|
|
//ASSERT(pStageFile);
|
|
|
- if (pStageFile==null)
|
|
|
|
|
|
|
+ if (pStageFile == null)
|
|
|
{
|
|
{
|
|
|
//LogErrorTrace(__FILE__, __LINE__, _T("ShowStageMgrDialog: Load stage from stage manager dlg failed."));
|
|
//LogErrorTrace(__FILE__, __LINE__, _T("ShowStageMgrDialog: Load stage from stage manager dlg failed."));
|
|
|
loger.Error("ShowStageMgrDialog: Load stage from stage manager dlg failed.");
|
|
loger.Error("ShowStageMgrDialog: Load stage from stage manager dlg failed.");
|