#pragma once // CDefectMap #include "CHImageControls/CHImageData.h" #include "CHReviewResult/GlassResult.h" #include "CHReviewResult/DefectResult.h" #include "CHReviewSetting/GlassTypeInfo.h" #include "ModuleStatus.h" #include "CHPathScheduler/PathScheduler.h" #include "CameraController.h" #define GLASS_SIZE_X_UM 1500000 #define GLASS_SIZE_Y_UM 1300000 #define DEFECT_SIZE 3 #define REVIEW_SIZE 4 #define GLASS_MAP_CLK_RANGE 4 #define UWM_SEND_DEFECTMAP_EVENT (WM_USER + 200) #define UM_DBLCLK_DEFECT_MAP (WM_USER + 7000) #define UM_DBRCLK_DEFECT_MAP (WM_USER + 7001) #define UM_LBDOWN_DEFECT_MAP (WM_USER + 7002) #define UM_LBDOWN_DEFECT_MAP2 (WM_USER + 7003) #define UM_MOUSEWHEEL_DEFECT_MAP (WM_USER + 7004) class CDefectMap : public CWnd, public CCHImageData, public IUpdateDefectFilter, public IUpdateProcessStatus, public IUpdateMotorPosition, public IUpdateReviewResult { DECLARE_DYNAMIC(CDefectMap) public: CDefectMap(CWnd *pParentWnd); virtual ~CDefectMap(); virtual void UpdateDefectFilter(const SDefectFilter* pDefectFilter); virtual void UpdateProcessStatus(int nLineType, int nMachineType, int nProcessStatus, const CGlassResult* pGlassResult); virtual void UpdateMotorPosition(int nModuleIndex, BOOL bSelected, const SMotorPosition* pMotorPosition); virtual void UpdateReviewResult(int nModuleIndex, const CGlassResult* pGlassResult, int nPlanIndex); void SetSelectedCameraIndex(int nIndex) { m_nSelectedIndex = nIndex; } void SetGlassInfo(int nSizeX, int nSizeY, int nCornerCutDir, int nGlassOriginDir); void SetGlassInfo2(int nSizeX, int nSizeY, int nCornerCutDir, int nGlassOriginDir); void SetGlassResult(const CGlassResult* pGlassResult); void SetRationX(double dSizeRatioX) { m_dOrignSizeRatioX = dSizeRatioX; } void SetRationY(double dSizeRatioY) { m_dOrignSizeRatioY = dSizeRatioY; } double GetRationX() { return m_dOrignSizeRatioX; } double GetRationY() { return m_dOrignSizeRatioY; } void SetOriginX(int nOriginX) { m_nOriginSizeX = nOriginX; } void SetOriginY(int nOriginY) { m_nOriginSizeY = nOriginY; } int GetOriginX() { return m_nOriginSizeX; } int GetOriginY() { return m_nOriginSizeY; } void SetDefectFilter(const SDefectFilter* pDefectFilter) { m_pDefectFilter = pDefectFilter; } void DrawDefectPoint(int nPosX, int nPosY, COLORREF nColor); void DrawDefectPoint2(int nPosX, int nPosY, COLORREF nColor); void DrawCamera(VectorInteger& vectorType, VectorInteger& vectorPosX, VectorInteger& vectorPosY); void SetGlassResult2(const CGlassResult * pGlassResult, BOOL bHistory); void TransformGlass2Map(int& nUMGlassPosX, int& nUMGlassPosY); void TransformGlass2Map2(int& nUMGlassPosX, int& nUMGlassPosY); void TransformGlass2Map3(int& nUMGlassPosX, int& nUMGlassPosY); void TransformMap2Glass(int& nUMMapPosX, int& nUMMapPosY); void TransformMap2Glass2(int& nUMMapPosX, int& nUMMapPosY); double GetScaleX() { return m_dSizeRatioX; } double GetScaleY() { return m_dSizeRatioY; } void SetDrawCollision(BOOL bValue) { m_bDrawCollision = bValue; } BOOL GetDrawCollision() { return m_bDrawCollision; } void SetDefectZoom(double dDefectZoom) { m_dDefectZoom = dDefectZoom; } void SetrevDefectZoom(double drevDefectZoom) { m_dRevDefectZoom = drevDefectZoom; } DOUBLE GetDefectZoom() { return m_dDefectZoom; } DOUBLE GetrevDefectZoom() { return m_dRevDefectZoom; } void SetDisplayClickedPoint(const CDefectResult* pDefectResult); BOOL IsValideClickedPoint(const CPoint origPoint, CPoint compPoint, int nRange); void UpdateHistoryDefectMap(); static int FilterDefect(const SDefectFilter& defectFilter, const CDefectResult* pDefectResult); static int FilterDefect(const SDefectFilter* pDefectFilter, const CDefectResult* pDefectResult); static int FilterDefectPos(const SDefectFilter& defectFilter, const SReviewResult* pSReviewResult); static int FilterDefectPos(const SDefectFilter* pDefectFilter, const SReviewResult* pSReviewResult); protected: void UpdateDefectMap(); void UpdateDefectMap2(); void UpdateDefectMap3(); void UpdateReviewResult(CDC *pDC); void UpdateReviewResult2(CDC *pDC); void Reset(); void DrawGlass(CDC *pDC, const CRect& rtRect); void RectChange(const CRect & rtRect); void DrawCornerCut(CDC* pDC); void DrawCell(CDC *pDC); void DrawDefect(CDC *pDC); void DrawCell2(CDC *pDC); void DrawDefect2(CDC *pDC); void DrawUserPoint(CDC *pDC); void DrawUserPath(CDC *pDC); void DrawUserPointPath(CDC *pDC); void DrawUserPoint2(CDC *pDC); void DrawUserPath2(CDC *pDC); void DrawUserPointPath2(CDC *pDC); void DrawReflowPoint(CDC *pDC); void DrawReflowPath(CDC *pDC); void DrawReflowPointPath(CDC *pDC); void DrawReflowPoint2(CDC *pDC); void DrawReflowPath2(CDC *pDC); void DrawReflowPointPath2(CDC *pDC); void DrawMeasurePoint(CDC *pDC); void DrawMeasurePath(CDC *pDC); void DrawMeasurePointPath(CDC *pDC); void DrawMeasurePoint2(CDC *pDC); void DrawMeasurePath2(CDC *pDC); void DrawMeasurePointPath2(CDC *pDC); void DrawReviewDefect(CDC *pDC); void DrawReviewPath(CDC *pDC); void DrawReviewDefectPath(CDC *pDC); void DrawReviewDefect2(CDC *pDC); void DrawReviewPath2(CDC *pDC); void DrawReviewDefectPath2(CDC *pDC); void DrawWsiDefect(CDC *pDC); void DrawWsiPath(CDC *pDC); void DrawWsiDefectPath(CDC *pDC); void DrawWsiDefect2(CDC *pDC); void DrawWsiPath2(CDC *pDC); void DrawWsiDefectPath2(CDC *pDC); void DrawWsiReflowPoint(CDC *pDC); void DrawWsiReflowPath(CDC *pDC); void DrawWsiReflowPointPath(CDC *pDC); void DrawWsiReflowPoint2(CDC *pDC); void DrawWsiReflowPath2(CDC *pDC); void DrawWsiReflowPointPath2(CDC *pDC); void DrawClickedPoint(CDC *pDC); void DrawReviewImg(CDC *pDC); void DrawCollisionRange(CDC* pDC, const CRect& rtRect); void DrawCollisionRange2(CDC* pDC, const CRect& rtRect); void DrawUserWsiDefect(CDC *pDC); void DrawUserWsiPath(CDC *pDC); void DrawUserWsiDefectPath(CDC *pDC); void DrawUserWsiDefect2(CDC *pDC); void DrawUserWsiPath2(CDC *pDC); void DrawUserWsiDefectPath2(CDC *pDC); int TransX(double x); int TransY(double y); int TransX(int x); int TransY(int y); CDC m_memDC; CBitmap m_bitmap; CRect m_rtViewRect; int m_nOriginX; int m_nOriginY; int m_nOriginDir; int m_nCornerCutDir; CPoint m_clkPoint; int m_nDrawDirX; int m_nDrawDirY; double m_dOrignSizeRatioX; double m_dOrignSizeRatioY; int m_nOriginSizeX; int m_nOriginSizeY; double m_dSizeRatioX; double m_dSizeRatioY; CWnd* m_pParentWnd; int m_nSelectedIndex; VectorInteger m_vecCameraType; VectorInteger m_vecCameraPosX; VectorInteger m_vecCameraPosY; int m_nReviewIndex; const SDefectFilter* m_pDefectFilter; const CGlassResult* m_pGlassResult; const VectorReviewResult* m_pVecReviewResult; COLORREF m_RowColor[6]; CBrush m_pDefectBrush[6]; CPen m_pDefectPen[6]; //CPen m_pOffsetPen; //CBrush m_pOffsetBrush; CPoint m_pMousePt; CPoint m_pMouseDwPt; CPoint m_pMouseUpPt; int m_nDefectSize; int m_nReviewSize; // 181203 SJB, PlanIndex int m_nPlanIndex; BOOL m_bDrawCollision; BOOL m_bHistoryEnable; /* int m_nHistoryCount;*/ int m_nPointX; int m_nPointY; short m_sDelta; DECLARE_MESSAGE_MAP() public: void SetOffsetmodeparma(BOOL bMode, int nCamidx, int nScanidx, double nXpos, double nYpos); void SetOffsetparm(int nCamidx, int nScanidx, BOOL bUse); BOOL nOffSetMode; int nGlassMax; int nGlassMin; int nCamIndex; int nCamSacnIndex; int m_nDefectOffsetX; int m_nDefectOffsetY; int m_nDefectCenterX; int m_nDefectCenterY; int m_nRectTop; int m_nRectRight; int m_nRectBottom; int m_nRectLeft; double m_dDefectZoom; double m_dRevDefectZoom; public: afx_msg void OnPaint(); // afx_msg LRESULT OnMotorPositionUpdate(WPARAM wParam, LPARAM lParam); // afx_msg LRESULT OnDefectFilterUpdate(WPARAM wParam, LPARAM lParam); // afx_msg LRESULT OnProcessStatusUpdate(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnUpdateDefectMap(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnUpdateDefectMap2(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnReviewResultUpdate(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnUpdateDefectMapDefault(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnHistoryWhell(WPARAM wParam, LPARAM lParam); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint point); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnRButtonDblClk(UINT nFlags, CPoint point); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnRButtonUp(UINT nFlags, CPoint point); void ClearDefectMap(void); };