#pragma once #include "GlassDefectMapData.h" #include #include #include #include class AFX_EXT_CLASS CGlassDefectMap : public CWnd { DECLARE_DYNAMIC(CGlassDefectMap) public: CGlassDefectMap(CWnd* pParentWnd=NULL); virtual ~CGlassDefectMap(void); void SetParentWnd(CWnd* pParentWnd); void SetMapZoomLevel(float fLevel); void SetMapCenterPoint(const CPoint& ptPoint); void SetMapDefaultValue(); void SetMapBackColor(UINT nColor); void SetDrawData_Glass(const CDrawData_Glass& dataGlass); protected: void InitGlassDefectMap(); void CalTransformMatrix(); void CalCornerTransformMatrix(const D2D1_SIZE_F& fTrans, const D2D1_SIZE_F& fScale, const D2D1_POINT_2F& fPoint, const D2D1_SIZE_F& fViewSize, const CDrawData_Glass *pDataGlass, D2D1_MATRIX_3X2_F& matTransform); void ReleaseAllLayers(); void UpdateGlassLayer(ID2D1RenderTarget *pRenderTarget); void UpdateCellLayer(ID2D1RenderTarget *pRenderTarget); void UpdateDefectLayer(ID2D1RenderTarget *pRenderTarget); void UpdateGlassRuler(ID2D1RenderTarget *pRenderTarget, const CDrawData_Glass* pDrawData, const D2D1_SIZE_F& fScale); void UpdateGlassCorner( ID2D1RenderTarget *pRenderTarget, const CDrawData_Glass* pDataGlass, const D2D1_SIZE_F& fScale); void UpdateDrawData(ID2D1RenderTarget *pRenderTarget, const CDrawData* pDrawData, float fScale); void DrawGlassLayer(ID2D1RenderTarget *pRenderTarget, const D2D1_RECT_F* pDestRect); void DrawCellLayer(ID2D1RenderTarget *pRenderTarget, const D2D1_RECT_F* pDestRect); void DrawDefectLayer(ID2D1RenderTarget *pRenderTarget, const D2D1_RECT_F* pDestRect); protected: DECLARE_MESSAGE_MAP() protected: CWnd *m_pParentWnd; IWICImagingFactory *m_pWICFactory; ID2D1Factory *m_pD2DFactory; IDWriteFactory *m_pDWFactroy; ID2D1Bitmap *m_pLayerGlass; ID2D1Bitmap *m_pLayerCell; ID2D1Bitmap *m_pLayerDefect; ID2D1HwndRenderTarget *m_pRenderTargetHwnd; D2D1_RECT_F m_rtRenderTargetHwndRect; D2D1_SIZE_U m_uRenderTargetHwndSize; D2D1_SIZE_F m_fRenderTargetHwndSize; D2D1_SIZE_U m_pxRenderTargetHwndSize; D2D1_MATRIX_3X2_F m_matTransform; // map int m_nMapDrawType; float m_fMapZoomLevel; CPoint m_ptMapPoint; D2D1_SIZE_F m_fMapTranslation; D2D1_SIZE_F m_fMapScale; D2D1_POINT_2F m_fMapPoint; UINT m_nMapBackColor; // glass BOOL m_bDrawGlass; BOOL m_bDrawCell; BOOL m_bDrawDefect; // object CDrawData_Glass m_DrawData_Glass; VectorDrawData_Cell m_vecDrawData_Cell; public: afx_msg void OnPaint(); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); };