www.pudn.com > MotionEstimation.rar > MotionEstimationView.cpp
// MotionEstimationView.cpp : implementation of the CMotionEstimationView class
//
#include "stdafx.h"
#include "MotionEstimation.h"
#include "MotionEstimationDoc.h"
#include "MotionEstimationView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMotionEstimationView
IMPLEMENT_DYNCREATE(CMotionEstimationView, CScrollView)
BEGIN_MESSAGE_MAP(CMotionEstimationView, CScrollView)
//{{AFX_MSG_MAP(CMotionEstimationView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMotionEstimationView construction/destruction
CMotionEstimationView::CMotionEstimationView()
{
// TODO: add construction code here
}
CMotionEstimationView::~CMotionEstimationView()
{
}
BOOL CMotionEstimationView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CScrollView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CMotionEstimationView drawing
void CMotionEstimationView::OnDraw(CDC* pDC)
{
CMotionEstimationDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CRect rect1(0,0,pDoc->Image1.Width(),pDoc->Image1.Height());
CRect rect2(10+pDoc->Image2.Width(),0,10+pDoc->Image2.Width()*2,
pDoc->Image2.Height());
CRect rect3(20+pDoc->ImageEstimation.Width()*2,0,20+pDoc->ImageEstimation.Width()*3,
pDoc->ImageEstimation.Height());
//CString str;
if( pDoc->Image1.IsValid() )
{
pDoc->Image1.Paint(pDC->GetSafeHdc(),rect1);
pDC->DrawText("当前帧",CRect(0,pDoc->Image1.Height(),
pDoc->Image1.Width(),pDoc->Image1.Height()+40),DT_CENTER);
}
if( pDoc->Image2.IsValid() )
{
pDoc->Image2.Paint(pDC->GetSafeHdc(),rect2);
pDC->DrawText("参考帧的源帧",CRect(pDoc->Image2.Width()+10,
pDoc->Image2.Height(),10+pDoc->Image2.Width()*2,pDoc->Image2.Height()+40),DT_CENTER);
}
if( pDoc->ImageEstimation.IsValid() )
{
pDoc->ImageEstimation.Paint(pDC->GetSafeHdc(),rect3);
pDC->DrawText("预测当前帧",CRect(pDoc->ImageEstimation.Width()*2+20,
pDoc->ImageEstimation.Height(),20+pDoc->ImageEstimation.Width()*3,
pDoc->ImageEstimation.Height()+40),DT_CENTER);
}
}
void CMotionEstimationView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
// TODO: calculate the total size of this view
sizeTotal.cx = sizeTotal.cy = 2000;
SetScrollSizes(MM_TEXT, sizeTotal);
}
/////////////////////////////////////////////////////////////////////////////
// CMotionEstimationView diagnostics
#ifdef _DEBUG
void CMotionEstimationView::AssertValid() const
{
CScrollView::AssertValid();
}
void CMotionEstimationView::Dump(CDumpContext& dc) const
{
CScrollView::Dump(dc);
}
CMotionEstimationDoc* CMotionEstimationView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMotionEstimationDoc)));
return (CMotionEstimationDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMotionEstimationView message handlers