www.gusucode.com > 一个相对很完善的数据挖掘系统源码程序 > 一个相对很完善的数据挖掘系统源码程序/Discover/ClassTree.cpp

    // ClassTree.cpp : implementation file
//

#include "stdafx.h"
#include "discover.h"
#include "colledoc.h"
#include "ClassTree.h"

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

/////////////////////////////////////////////////////////////////////////////
// CClassTree

IMPLEMENT_DYNCREATE(CClassTree, CTreeView)

CClassTree::CClassTree()
{
}

CClassTree::~CClassTree()
{
}


BEGIN_MESSAGE_MAP(CClassTree, CTreeView)
	//{{AFX_MSG_MAP(CClassTree)
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CClassTree drawing
CCollectDoc* CClassTree::GetDocument() // non-debug version is inline
{
	
	return STATIC_DOWNCAST(CCollectDoc, m_pDocument);

}
void CClassTree::OnDraw(CDC* pDC)
{
	
	CCollectDoc*  pDoc = GetDocument();

}



/////////////////////////////////////////////////////////////////////////////
// CClassTree diagnostics

#ifdef _DEBUG
void CClassTree::AssertValid() const
{
	CTreeView::AssertValid();
}

void CClassTree::Dump(CDumpContext& dc) const
{
	CTreeView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CClassTree message handlers

static CString csTree[] =
{
	_T("ID3分类树"),
	//关联规则 1-4
	_T("天气"),	_T("晴"),	_T("多云"),	_T("雨	"),
	//分类 5-8
	_T("气温"),_T("热"),_T("适中"),_T("冷	"),
	//聚类 9-11
	_T("湿度"),_T("高"),_T("正常"),
	//回归 12-14
	_T("风"),_T("无"),_T("有")
};

int CClassTree::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CTreeView::OnCreate(lpCreateStruct) == -1)
		return -1;

	m_TreeCtrl = &GetTreeCtrl();
	// create the image list for the tree control
	m_ImageList.Create (IDB_IL_FILE, 16, 1, RGB(0,255,0));
	m_TreeCtrl->SetImageList (&m_ImageList, TVSIL_NORMAL);
	// add the parent item, make it bold
//	HTREEITEM htiParent = m_TreeCtrl->InsertItem (csTree[0]);
//	HTREEITEM htiChild; // child item
//
//	htiChild = m_TreeCtrl->InsertItem (csTree[1], 1, 1, htiParent, TVI_LAST);
//	m_TreeCtrl->SetItemState (htiChild, TVIS_BOLD, TVIS_BOLD);
//	// add the children of the parent item
//	for (int i = 2; i <= 4; i++) {
//		m_TreeCtrl->InsertItem (csTree[i], 2, 3, htiChild, TVI_LAST);
//	}
//
//	htiChild = m_TreeCtrl->InsertItem (csTree[5], 1, 1, htiParent, TVI_LAST);
//	m_TreeCtrl->SetItemState (htiChild, TVIS_BOLD, TVIS_BOLD);
//	for (i = 6; i <= 8; i++) {
//		m_TreeCtrl->InsertItem (csTree[i], 2, 3, htiChild, TVI_LAST);
//	}
//
//
//	htiChild = m_TreeCtrl->InsertItem (csTree[9], 1, 1, htiParent, TVI_LAST);
//	m_TreeCtrl->SetItemState (htiChild, TVIS_BOLD, TVIS_BOLD);
//	for (i = 10; i <=11; i++) {
//		m_TreeCtrl->InsertItem (csTree[i], 2, 3, htiChild, TVI_LAST);
//	}
//
//	htiChild = m_TreeCtrl->InsertItem (csTree[12], 1, 1, htiParent, TVI_LAST);
//	m_TreeCtrl->SetItemState (htiChild, TVIS_BOLD, TVIS_BOLD);
//	for (i = 13; i <=14; i++) {
//		m_TreeCtrl->InsertItem (csTree[i], 2, 3, htiChild, TVI_LAST);
//	}
//
//	m_TreeCtrl->Expand (htiParent, TVE_EXPAND);
//	m_TreeCtrl->Expand (htiChild, TVE_EXPAND);
	
	return 0;
}

BOOL CClassTree::PreCreateWindow(CREATESTRUCT& cs) 
{
	cs.style |= TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT;
	return CTreeView::PreCreateWindow(cs);
	
}