void CBase_SampleChart::ResetAxis()
{
	GetBottomAxis()->SetCoordinate(0, 5, COORDINATE_SET);
	GetLeftAxis()->SetCoordinate(-10, 500, COORDINATE_SET);

	GetBottomAxis()->GetGrid()->SetVisible(false);
	GetLeftAxis()->GetGrid()->SetVisible(false);

	if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC_PX) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1120) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC2400) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1100W) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_GC1100P) == 0)) 
		 GetLeftAxis()->SetZoomLimit(0.01);
	else if((g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_LC1620A) == 0) || (g_cConfigIni.CurrentSystemName().Compare(PASYSTEM_NAME_IC1800) == 0)) 
		 GetLeftAxis()->SetZoomLimit(0.1);
	else GetLeftAxis()->SetZoomLimit(0.1);
	GetTopAxis()->SetZoomLimit(0.1);
	GetRightAxis()->SetZoomLimit(0.1);
	GetBottomAxis()->SetZoomLimit(0.1);
}
Пример #2
0
void CChartCtrl::OnMouseMove(UINT nFlags, CPoint point) 
{
	if (m_bRMouseDown && m_bPanEnabled)
	{
		if (point != m_PanAnchor)
		{
			GetLeftAxis()->PanAxis(m_PanAnchor.y,point.y);
			GetRightAxis()->PanAxis(m_PanAnchor.y,point.y);
			GetBottomAxis()->PanAxis(m_PanAnchor.x,point.x);
			GetTopAxis()->PanAxis(m_PanAnchor.x,point.x);

			RefreshCtrl();
			m_PanAnchor = point;
		}
	}

	if (m_bLMouseDown && m_bZoomEnabled)
	{
		m_rectZoomArea.BottomRight() = point;
		Invalidate();
	}

	CWnd::OnMouseMove(nFlags, point);
}
Пример #3
0
void CChartCtrl::OnLButtonUp(UINT nFlags, CPoint point) 
{
	m_bLMouseDown = false;
	if (m_bZoomEnabled)
	{
		if ( (m_rectZoomArea.left > m_rectZoomArea.right) ||
			 (m_rectZoomArea.top > m_rectZoomArea.bottom))
		{
			GetBottomAxis()->UndoZoom();
			GetTopAxis()->UndoZoom();
			GetLeftAxis()->UndoZoom();
			GetRightAxis()->UndoZoom();
		}
		else
		{
			CChartAxis* pBottom = GetBottomAxis();
			double MinVal = 0;			
			double MaxVal = 0;
			
			if (pBottom->IsInverted())
			{
				MaxVal = pBottom->ScreenToValue(m_rectZoomArea.left);
				MinVal = pBottom->ScreenToValue(m_rectZoomArea.right);
			}
			else
			{
				MinVal = pBottom->ScreenToValue(m_rectZoomArea.left);
				MaxVal = pBottom->ScreenToValue(m_rectZoomArea.right);
			}
			pBottom->SetZoomMinMax(MinVal,MaxVal);

			CChartAxis* pLeft = GetLeftAxis();
			if (pLeft->IsInverted())
			{
				MaxVal = pLeft->ScreenToValue(m_rectZoomArea.bottom);
				MinVal = pLeft->ScreenToValue(m_rectZoomArea.top);
			}
			else
			{
				MinVal = pLeft->ScreenToValue(m_rectZoomArea.bottom);
				MaxVal = pLeft->ScreenToValue(m_rectZoomArea.top);
			}
			pLeft->SetZoomMinMax(MinVal,MaxVal);

			CChartAxis* pTop = GetTopAxis();
			if (pTop->IsInverted())
			{
				MaxVal = pTop->ScreenToValue(m_rectZoomArea.left);
				MinVal = pTop->ScreenToValue(m_rectZoomArea.right);
			}
			else
			{
				MinVal = pTop->ScreenToValue(m_rectZoomArea.left);
				MaxVal = pTop->ScreenToValue(m_rectZoomArea.right);
			}
			pTop->SetZoomMinMax(MinVal,MaxVal);

			CChartAxis* pRight = GetRightAxis();
			if (pRight->IsInverted())
			{
				MaxVal = pRight->ScreenToValue(m_rectZoomArea.bottom);
				MinVal = pRight->ScreenToValue(m_rectZoomArea.top);
			}
			else
			{
				MinVal = pRight->ScreenToValue(m_rectZoomArea.bottom);
				MaxVal = pRight->ScreenToValue(m_rectZoomArea.top);
			}
			pRight->SetZoomMinMax(MinVal,MaxVal);
		}

		RefreshCtrl();
	}

	CWnd::OnLButtonUp(nFlags, point);
}
Пример #4
0
bool OrientedBoundingBox::CheckCollision(const OrientedBoundingBox &other, glm::vec3 axis) const
{
	if (axis == glm::vec3(0))
		return true;
	axis = glm::normalize(axis);

	float thisMin = glm::dot(this->m_centre, axis);
	float thisMax = glm::dot(this->m_centre, axis);
	float otherMin = glm::dot(other.m_centre, axis);
	float otherMax = glm::dot(other.m_centre, axis);
	float temp;

	for (int frontcount = MIN_LENGTH; frontcount <= MAX_LENGTH; ++frontcount)
	for (int upcount = MIN_LENGTH; upcount <= MAX_LENGTH; ++upcount)
	for (int rightcount = MIN_LENGTH; rightcount <= MAX_LENGTH; ++rightcount)
	{
		temp = glm::dot(this->m_centre + m_frontAxis * m_lengths[FRONT_AXIS][frontcount] + m_upAxis * m_lengths[UP_AXIS][upcount] + GetRightAxis() * m_lengths[RIGHT_AXIS][rightcount], axis);
		thisMin = (thisMin < temp) ? thisMin : temp;
		thisMax = (thisMax > temp) ? thisMax : temp;
		temp = glm::dot(other.m_centre + other.m_frontAxis * other.m_lengths[FRONT_AXIS][frontcount] + other.m_upAxis * other.m_lengths[UP_AXIS][upcount] + other.GetRightAxis() * other.m_lengths[RIGHT_AXIS][rightcount], axis);
		otherMin = (otherMin < temp) ? otherMin : temp;
		otherMax = (otherMax > temp) ? otherMax : temp;
	}

	float span = (thisMax > otherMax ? thisMax : otherMax) - (thisMin < otherMin ? thisMin : otherMin);
	float length = (thisMax - thisMin) + (otherMax - otherMin);
	return !(span > length);
}