matcherView2.cpp
资源名称:matcher.rar [点击查看]
上传用户:quan1896
上传日期:2013-04-17
资源大小:94k
文件大小:3k
源码类别:
2D图形编程
开发平台:
Visual C++
- // matcherView2.cpp : implementation file
- //
- #include "stdafx.h"
- #include "matcher.h"
- #include "matcherDoc.h"
- #include "matcherView2.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMatcherView2
- IMPLEMENT_DYNCREATE(CMatcherView2, CScrollView)
- CMatcherView2::CMatcherView2()
- {
- }
- CMatcherView2::~CMatcherView2()
- {
- }
- BEGIN_MESSAGE_MAP(CMatcherView2, CScrollView)
- //{{AFX_MSG_MAP(CMatcherView2)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMatcherView2 drawing
- void CMatcherView2::OnInitialUpdate()
- {
- CScrollView::OnInitialUpdate();
- CSize sizeTotal;
- // TODO: calculate the total size of this view
- sizeTotal.cx = sizeTotal.cy = 100;
- SetScrollSizes(MM_TEXT, sizeTotal);
- }
- void CMatcherView2::OnDraw(CDC* pDC)
- {
- CMatcherDoc* pDoc = GetDocument();
- // TODO: add draw code here
- m_frame2.Show(pDC->GetSafeHdc(),0,0,pDoc->m_imgsize2.width,pDoc->m_imgsize2.height,0,0);
- ReleaseDC(pDC);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMatcherView2 diagnostics
- #ifdef _DEBUG
- void CMatcherView2::AssertValid() const
- {
- CScrollView::AssertValid();
- }
- void CMatcherView2::Dump(CDumpContext& dc) const
- {
- CScrollView::Dump(dc);
- }
- #endif //_DEBUG
- //需要将此函数放在DEBUG外,否则出现链接错误(inline?????)
- CMatcherDoc* CMatcherView2::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMatcherDoc)));
- return (CMatcherDoc*)m_pDocument;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMatcherView2 message handlers
- void CMatcherView2::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
- {
- // TODO: Add your specialized code here and/or call the base class
- CMatcherDoc* pDoc = GetDocument();
- //使Scrollbar符合图像大小
- if(pDoc->IMG2OPEN)
- SetScrollSizes(MM_TEXT,CSize(pDoc->m_imgsize2.width,pDoc->m_imgsize2.height));
- //保证每次创建的显示图像内存大小与待打开图像大小一致
- m_frame2.Create(pDoc->m_imgsize2.width,pDoc->m_imgsize2.height,24);
- //填充显示图像内存区域
- if(pDoc->IMG2OPEN)
- {
- ShownImage2=m_frame2.GetImage();
- cvSetImageROI(ShownImage2,cvRect(0,0,pDoc->m_imgsize2.width,pDoc->m_imgsize2.height));
- cvCopy(pDoc->showImg2,ShownImage2);
- Invalidate(FALSE);
- }
- }
- void CMatcherView2::ShowHitPoint(CvPoint point)
- {
- }