datapoint.cpp

来自「k-means聚类算法在二维平面上的可视化实现 聚类时可以设置类数和迭代阈值 」· C++ 代码 · 共 56 行

CPP
56
字号
// 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 + =
减小字号Ctrl + -
显示快捷键?