⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datapoint.cpp

📁 k-means聚类算法在二维平面上的可视化实现 聚类时可以设置类数和迭代阈值 聚类结果用色彩和类圆清楚的表现出来
💻 CPP
字号:
// DataPoint.cpp: implementation of the CDataPoint class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "KMeansV.h"
#include "DataPoint.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CDataPoint::CDataPoint()
{

}

CDataPoint::~CDataPoint()
{

}

CDataPoint::CDataPoint(CPoint point)
{
	m_ptPoint=point;
	m_nGroupTag=0;
}

void CDataPoint::ShowPoint(CDC* pDC)
{
	CRect Rect;
	::GetClientRect(((CFrameWnd*)(AfxGetApp()->m_pMainWnd))->GetActiveView()->m_hWnd,&Rect);
	pDC->Ellipse(m_ptPoint.x+Rect.right/2-1,Rect.bottom/2-m_ptPoint.y-1,m_ptPoint.x+Rect.right/2+1,Rect.bottom/2-m_ptPoint.y+1);
	CString sXY;
	sXY.Format("(%d,%d)",m_ptPoint.x,m_ptPoint.y);
	pDC->SetBkMode(TRANSPARENT);
	pDC->TextOut(m_ptPoint.x+Rect.right/2,Rect.bottom/2-m_ptPoint.y,sXY);
}

void CDataPoint::ShowPointWithGroup(CDC* pDC)
{
	CRect Rect;
	::GetClientRect(((CFrameWnd*)(AfxGetApp()->m_pMainWnd))->GetActiveView()->m_hWnd,&Rect);
	pDC->Ellipse(m_ptPoint.x+Rect.right/2-1,Rect.bottom/2-m_ptPoint.y-1,m_ptPoint.x+Rect.right/2+1,Rect.bottom/2-m_ptPoint.y+1);
	CString sXY;
	sXY.Format("(%d,%d)-%d",m_ptPoint.x,m_ptPoint.y,m_nGroupTag);
	pDC->SetBkMode(TRANSPARENT);
	pDC->TextOut(m_ptPoint.x+Rect.right/2,Rect.bottom/2-m_ptPoint.y,sXY);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -