www.gusucode.com > matlab的GA工具箱与vc混和实现遗传算法源码程序 > GATestView.cpp

    // GATestView.cpp : implementation of the CGATestView class
//

#include "stdafx.h"
#include "GATest.h"

#include "GATestDoc.h"
#include "GATestView.h"

#include "matlib.h"
#include "main.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGATestView

IMPLEMENT_DYNCREATE(CGATestView, CView)

BEGIN_MESSAGE_MAP(CGATestView, CView)
	//{{AFX_MSG_MAP(CGATestView)
	ON_COMMAND(ID_START_GA1, OnStartGa1)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGATestView construction/destruction

CGATestView::CGATestView()
{
	// TODO: add construction code here

}

CGATestView::~CGATestView()
{
}

BOOL CGATestView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CGATestView drawing

void CGATestView::OnDraw(CDC* pDC)
{
	CGATestDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CGATestView printing

BOOL CGATestView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CGATestView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CGATestView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CGATestView diagnostics

#ifdef _DEBUG
void CGATestView::AssertValid() const
{
	CView::AssertValid();
}

void CGATestView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CGATestDoc* CGATestView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CGATestDoc)));
	return (CGATestDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CGATestView message handlers

void CGATestView::OnStartGa1() 
{
	// TODO: Add your command handler code here
	 begin_scope
    
    initM(MATCOM_VERSION);
    
    main();
    
    exitM();    
    end_scope
}