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

	Program:		Range Imaging Toolkit (RITK)
	Module:			ritkOpenGLEntity.h
	Version:		$Revision: 2535 $
	Date:			$Date: 2012-02-08 01:22:46 +0100 (Mi, 08 Feb 2012) $

	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 OPENGLENTITY_H__
#define OPENGLENTITY_H__

#include <QObject>
#include <QDockWidget>
#include <QVector2D>

#include "ritkVisualization.h"

#include <itkVector.h>


namespace ritk
{

// Forward declaration
class OpenGLVisualizationWidget;

/**	@ingroup	Visualization
 *	@class		OpenGLEntity
 *	@author		Jakob Wasza
 *	@brief		Base class for all entities to be drawn in an OpenGL widget
 *
 *	@details
 */
	
class VISUALIZATION_EXPORT OpenGLEntity : public QObject
{
	Q_OBJECT

public:
	/// Constructor
	OpenGLEntity();
	/// Destructor
	virtual ~OpenGLEntity();
	
	/// React on mouse press events
	virtual bool RightMousePressed(QMouseEvent *e);

		/// React on mouse released events
		virtual bool RightMouseReleased(QMouseEvent *e);
	
	/// React on mouse moved events
	virtual bool MouseMoved(QMouseEvent *e);

	/// Render the entity in 3D Space
	virtual void Render3D(const OpenGLVisualizationWidget *Widget)=0;
		
	/// Render the entity in 2D Space
	virtual void Render2D(const OpenGLVisualizationWidget *Widget, QVector2D ImgDimensions)=0;
	
	/// Get Size of internal Payload (used for 2D Rendering)
	virtual QVector2D GetPayloadDimensions(){ return QVector2D(0.0f, 0.0f); };

	/// Control the entity @todo Check the const qualifier
	virtual QDockWidget* GetControlUnit() const =0;
	
	/// Set the rendermode
	virtual void SetRender3D(bool);

	/**	@name	Bounding box [xmin, ymin, zmin, xmax, ymax, zmax] */
	//@{
	typedef float						RealType;
	typedef itk::Vector<RealType, 6>	BoundingBoxType;
	virtual BoundingBoxType				GetBoundingBox() const =0;
	//@}

	/** @name	get/set parent widget */
	//@{
	OpenGLVisualizationWidget *getParentWidget();
	void setParentWidget(OpenGLVisualizationWidget *parentWidget);
	//@}

protected:
	/// Pointer to the parent Visualization Widget
	OpenGLVisualizationWidget *parentWidget;
			

signals:
	/// Signal that is emitted if the internal status of the entity changes
	void StatusChanged();
	
protected:
	/// renderMode 2D or 3D
	bool m_Render3D;
};

} // namespace ritk


#endif // OPENGLENTITY_H__
