/*======================================================================================

	Program:		Range Imaging Toolkit (RITK)
	Module:			OpenGLRImageControlUnit.h
	Version:		$Revision: 1817 $
	Date:			$Date: 2011-09-30 16:52:28 +0200 (Fr, 30 Sep 2011) $

	Copyright (c) 2010-2011
	Pattern Recognition Lab, 
    University Erlangen-Nuremberg, Germany
    All rights reserved.

	This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
	See RITKCopyright.txt for more information.

	http://www5.informatik.uni-erlangen.de/research/software/ritk

========================================================================================*/

#ifndef OPENGLRIIMAGECONTROLUNIT_H__
#define OPENGLRIIMAGECONTROLUNIT_H__

#include "ritkVisualization.h"
#include "RImage.h"
#include "OpenGLRImageEntity.h"

#include "ui_OpenGLRImageControlUnit.h"

namespace ritk
{

/**	@ingroup	Visualization
 *	@class		OpenGLVisualizationModule
 *	@author		Jakob Wasza
 *	@brief		A controler for an RImageEntityy
 *
 *	@details
 */
class VISUALIZATION_EXPORT OpenGLRImageControlUnit : public QWidget, public Ui_OpenGLRImageControlUnit
{
	Q_OBJECT

public:
	/// Constructor
	OpenGLRImageControlUnit(QWidget *parent=0);
	/// Destructor
	~OpenGLRImageControlUnit();

protected slots:
	/// Connected to the alpha slider. Delegates the normalized value to the OpenGL widget
	void LUTAlphaSliderMoved(int value);
	/// Connected to the LUT combo box. Delegates the index to the OpenGL widget
	void LUTIndexChanged(int index);
	void ValidFlagsCheckBoxChanged(bool checked);
	/// Connected to the Radiobuttons
	void RadioButtonPolyDataClicked();

	/// Connected to the widget's range interval min spinbox
	void RangeIntervalMinChanged(double d);
	/// Connected to the widget's range interval max spinbox
	void RangeIntervalMaxChanged(double d);
	/// Connected to the widget's clamp range interval button
	void ClampRangeInterval();


signals:
	/**	@name internal communication */
	//@{
	void SetMinSignal(double value);
	void SetMaxSignal(double value);
	void SetRangeIntervalMinSpinBoxEnabled(bool b);
	void SetRangeIntervalMaxSpinBoxEnabled(bool b);
	void SetRangeIntervalClampPushButtonEnabled(bool b);
	void UpdateWidget();
	//@}

protected:
	/// Mutex used to synchronize rendering and data update
	QMutex m_Mutex;

  OpenGLRImageEntity* m_RImageEntity;

};
} // end namespace ritk

#endif // OPENGLRIIMAGECONTROLUNIT_H__