Ejemplo n.º 1
0
CCurve* Graph::GetCurvePoint(const int &xClt, const int &yClt,int &nSel)
{
	static int i, n, xc, yc;
	static double dist, x1, y1, x,y;
	CCurve *pOldCurve;

	x= ClientTox(xClt);
	y= ClientToy(yClt);
	for(i=0; i<m_oaCurves.size(); i++)
	{
		pOldCurve = (CCurve*)m_oaCurves.at(i);
		pOldCurve->GetClosestPoint(x, y, x1, y1, dist, n);

		xc = xToClient(x1);
		yc = yToClient(y1);

		if((xClt-xc)*(xClt-xc) + (yClt-yc)*(yClt-yc) <16)//sqrt(16) pixels distance
		{
			nSel = n;
			return pOldCurve;
		}
	}
	nSel = -1;
	return  NULL;
}