From e5fa774d622d6852fe8e1f033045aed221649108 Mon Sep 17 00:00:00 2001
From: LYW <leeyeanwoo@diteam.co.kr>
Date: 금, 15 10월 2021 13:24:54 +0900
Subject: [PATCH] Ongoing80 #3662 CF AOI Review 전설비 알람 발생 조치

---
 ReviewHistory/ReveiwHistory/CHTrackerView.cpp |  124 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 124 insertions(+), 0 deletions(-)

diff --git a/ReviewHistory/ReveiwHistory/CHTrackerView.cpp b/ReviewHistory/ReveiwHistory/CHTrackerView.cpp
new file mode 100644
index 0000000..b8eabda
--- /dev/null
+++ b/ReviewHistory/ReveiwHistory/CHTrackerView.cpp
@@ -0,0 +1,124 @@
+// CHTrackerView.cpp : 구현 파일입니다.
+//
+
+#include "stdafx.h"
+#include "CHTrackerView.h"
+#include "CHBufferDC.h"
+
+// CCHTrackerView
+
+IMPLEMENT_DYNAMIC(CCHTrackerView, CCHImageView)
+
+CCHTrackerView::CCHTrackerView() : CCHImageView()
+{
+	m_rectTracker.m_rect = CRect(0,0,0,0);
+	m_rectTracker.m_nStyle = CRectTracker::dottedLine | CRectTracker::resizeOutside;
+	m_rectTracker.m_sizeMin = CSize(8,8);
+	m_bDrawTracker = FALSE;
+}
+
+
+CCHTrackerView::CCHTrackerView(CWnd *pParentWnd) : CCHImageView(pParentWnd)
+{
+	m_rectTracker.m_rect = CRect(0,0,0,0);
+	m_rectTracker.m_nStyle = CRectTracker::dottedLine | CRectTracker::resizeOutside;
+	m_rectTracker.m_sizeMin = CSize(8,8);
+	m_bDrawTracker = FALSE;
+}
+
+CCHTrackerView::~CCHTrackerView()
+{
+
+}
+
+
+BEGIN_MESSAGE_MAP(CCHTrackerView, CCHImageView)
+	ON_WM_SETCURSOR()
+	ON_WM_PAINT()
+	ON_WM_LBUTTONDOWN()
+END_MESSAGE_MAP()
+
+
+
+// CCHTrackerView 메시지 처리기입니다.
+
+BOOL CCHTrackerView::GetTrackerRect(CRect& rtRect)
+{
+	if (m_rectTracker.m_rect.Width()<0 || m_rectTracker.m_rect.Height()<0)
+	{
+		return FALSE;
+	}
+
+	rtRect = m_rectTracker.m_rect;
+
+	return TRUE;
+}
+
+void CCHTrackerView::SetTrackerRect(const CRect& rtRect)
+{
+	m_rectTracker.m_rect = rtRect;
+	Invalidate(TRUE);
+}
+
+void CCHTrackerView::ClearTrackerRect()
+{
+	m_rectTracker.m_rect = CRect(0,0,0,0);
+	Invalidate(TRUE);
+}
+
+BOOL CCHTrackerView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
+{
+	// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
+	if (m_rectTracker.SetCursor(this, nHitTest))
+		return TRUE;
+
+	return CCHImageView::OnSetCursor(pWnd, nHitTest, message);
+}
+
+void CCHTrackerView::OnPaint()
+{
+
+	CCHBufferDC *pDC = new CCHBufferDC(this); // device context for painting
+
+	UpdateImageView(pDC);
+
+	m_rectTracker.m_rect.NormalizeRect();
+
+	if (m_rectTracker.m_rect.left>0 && m_rectTracker.m_rect.right<GetWidth())
+	{
+		if (m_rectTracker.m_rect.top>0 && m_rectTracker.m_rect.bottom<GetHeight())
+		{
+			m_rectTracker.Draw(pDC);
+		}
+	}
+
+	delete pDC;
+	
+}
+
+void CCHTrackerView::OnLButtonDown(UINT nFlags, CPoint point)
+{
+	// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.
+
+	if (m_pParentWnd==NULL || !GetImageExist()) return;
+
+	if (point.x > -1 && point.x < GetScaleWidth() &&
+		point.y > -1 && point.y < GetScaleHeight() )
+	{
+		if (m_rectTracker.HitTest(point) < 0)
+		{
+			// just to demonstrate CRectTracker::TrackRubberBand
+			if (m_rectTracker.TrackRubberBand(this, point, TRUE))
+			{
+				Invalidate();
+			}
+		}
+		else if (m_rectTracker.Track(this, point, TRUE))
+		{
+			Invalidate();
+		}
+	}
+
+	CCHImageView::OnLButtonDown(nFlags, point);
+}
+

--
Gitblit v1.9.3