void CDrawObject::DrawTracker(HDC hDC, TrackerState state, BOOL bDrawSelectTool)
{
	FTLASSERT(this);

	switch (state)
	{
		case normal:
			break;

		case selected:
		case active:
			{
				int nHandleCount = GetHandleCount();
				for (int nHandle = 1; nHandle <= nHandleCount; nHandle += 1)
				{
					CPoint handle = GetHandle(nHandle);
					CRect rect(handle.x - TRACK_MARGIN, handle.y - TRACK_MARGIN, 
						handle.x + TRACK_MARGIN + 1, handle.y + TRACK_MARGIN + 1);
					::Rectangle(hDC, rect.left, rect.top, rect.right, rect.bottom);
					//ATLTRACE(_T("rect.left %d, rect.top %d, rect.right %d, rect.bottom %d nHandle %d\n"), rect.left, rect.top, rect.right, rect.bottom, nHandle);
				}
			}
			break;
	}
}
Exemplo n.º 2
0
// point is in logical coordinates
int CDrawObj::HitTest(CPoint point, CDrawView* pView, BOOL bSelected)
{
	ASSERT_VALID(this);
	ASSERT(pView != NULL);

	if (bSelected)
	{
		int nHandleCount = GetHandleCount();
		for (int nHandle = 1; nHandle <= nHandleCount; nHandle += 1)
		{
			// GetHandleRect returns in logical coords
			CRect rc = GetHandleRect(nHandle,pView);
			if (point.x >= rc.left && point.x < rc.right &&
				point.y <= rc.top && point.y > rc.bottom)
				return nHandle;
		}
	}
	else
	{
		if (point.x >= m_position.left && point.x < m_position.right &&
			point.y <= m_position.top && point.y > m_position.bottom)
			return 1;
	}
	return 0;
}
Exemplo n.º 3
0
int CTyBase::HitTest(PointStruct point, CElecMapView *pView, BOOL bSelected)
{
	ASSERT(pView != NULL);

	if (bSelected)
	{
		CPoint pt = pView->UPtoLP(point);
		int nHandleCount = GetHandleCount();
		for (int nHandle = 1; nHandle <= nHandleCount; nHandle += 1)
		{
			CRect rt = GetHandleLogRect(nHandle,pView);
			
			if (rt.PtInRect(pt)) 
				return  nHandle;
		}
	}
	else
	{
		float errL;
		errL = pView->LLtoUL(OFFSETX);

		if (PointInObj(point.x,point.y,errL))
			return 1;
	}
	return 0;

}
Exemplo n.º 4
0
void CDrawObj::DrawTracker(CDC* pDC, TrackerState state)
{
	ASSERT_VALID(this);

	switch (state)
	{
	case normal:
		break;

	case selected:
	case active:
		{
			int nHandleCount = GetHandleCount();
			for (int nHandle = 1; nHandle <= nHandleCount; nHandle += 1)
			{
				CPoint handle = GetHandle(nHandle);
				pDC->PatBlt(handle.x - 3, handle.y - 3, 7, 7, DSTINVERT);
			}
		}
		break;
	}
}
// point is in device coordinates
int CDrawObject::HitTest(CPoint point, BOOL bSelected)
{
	FTLASSERT(this);

	if (bSelected)
	{
		int nHandleCount = GetHandleCount();
		for (int nHandle = 1; nHandle <= nHandleCount; nHandle += 1)
		{
			// GetHandleRect returns in device coords
			CRect rc = GetHandleRect(nHandle);
			FTLASSERT(!rc.IsRectEmpty());
			//rc.NormalizeRect();
			//if (1 == nHandle || 2 == nHandle)
			//{
			//	FTLTRACE(TEXT("rcHandle[%d]=[%d,%d]x[%d,%d], point =[%d,%d]\n"),
			//		nHandle, rc.left, rc.top, rc.right, rc.bottom, point.x, point.y);
			//}
			if (rc.PtInRect(point))
			{
				return nHandle;
			}
		}
	}
	else
	{
		FTLASSERT(FALSE);
		CRect rcPosition = m_position;
		rcPosition.NormalizeRect();
		if (rcPosition.PtInRect(point))
		{
			return 1;
		}
	}
	return 0;
}
Exemplo n.º 6
0
void CTyBase::DrawTracker(CDC *pDC, CElecMapView *pView, TrackerState state)
{
	ASSERT_VALID(this);
	ASSERT(pView!=NULL);

	switch (state)
	{
	case normal:
		break;

	case selected:
	case active:
		{
			int nHandleCount = GetHandleCount();
			for (int nHandle = 1; nHandle <= nHandleCount; nHandle += 1)
			{
				CRect rt = GetHandleLogRect(nHandle,pView);
				pDC->PatBlt(rt.left,rt.top, rt.Width(),rt.Height(),DSTINVERT);
			}
		}
		break;
	}

}