#include "VisualizationKinectWidget.h"
#include "ritkDebugManager.h"


//----------------------------------------------------------------------------
VisualizationKinectWidget::VisualizationKinectWidget()
{
	setupUi(this);

	// create the RImage and Skeleton VisualizationKinectEntity
	m_RImageEntity = ritk::OpenGLRImageEntity::New();
	m_SkeletonEntity = ritk::OpenGLSkeletonEntity::New();

	// add entities
	m_VisualizationUnit->AddEntity(m_RImageEntity);
	m_VisualizationUnit->AddEntity(m_SkeletonEntity);

	connect(this->m_pushButtonLoadConfig, SIGNAL(clicked()), this, SLOT(LoadConfigButtonEvent()));
}


//----------------------------------------------------------------------------
VisualizationKinectWidget::~VisualizationKinectWidget()
{
}


//----------------------------------------------------------------------------
void 
VisualizationKinectWidget::UpdateGUI()
{	
}


//----------------------------------------------------------------------------
void 
VisualizationKinectWidget::SetRangeData(ritk::RImageF2::ConstPointer Data)
{
	m_Mutex.lock();

	m_RImageEntity->SetRangeData(Data);

	m_Mutex.unlock();
}


//----------------------------------------------------------------------------
void 
VisualizationKinectWidget::SetSkeletonData(SkeletonConstPointer Data)
{
	m_Mutex.lock();
	
	m_SkeletonEntity->SetSkeletonData(Data);

	m_Mutex.unlock();
}


//----------------------------------------------------------------------------
void 
VisualizationKinectWidget::LoadConfigButtonEvent()
{
	emit ConfigButtonPressed();
}