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

	Program:		Range Imaging Toolkit (RITK)
	Module:			ritkOpenGLPointPickerLinearEntity.h
	Version:		$Revision: 2786 $
	Date:			$Date: 2012-03-13 17:51:50 +0100 (Di, 13 Mrz 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 OPENGLPOINTPICKERLINEARENTITY_H__
#define OPENGLPOINTPICKERLINEARENTITY_H__

#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkSimpleFastMutexLock.h>
#include <QVector3D>
#include <QMouseEvent>

#include "ritkOpenGLPointPickerEntity.h"

#include <GL/glu.h>

namespace ritk
{

/**	@ingroup	Visualization
 *	@class		OpenGLPointPickeLinearEntity
 *	@author		Martin Stumpf
 *	@brief		PointPicker used to Measure distances of two points
 *
 *	@details
 */
	class VISUALIZATION_EXPORT OpenGLPointPickerLinearEntity : public OpenGLPointPickerEntity
{
	Q_OBJECT	

public:
	/**	@name	Standard ITK typedefs */
	//@{
	typedef OpenGLPointPickerLinearEntity					Self;
	typedef OpenGLPointPickerEntity							Superclass;
	typedef itk::SmartPointer<Self>							Pointer;
	typedef itk::SmartPointer<const Self>					ConstPointer;
	//@}
	
	/// Object creation
	itkNewMacro(Self);
	
	/// RTTI
	itkTypeMacro(OpenGLPointPickerEntity, itk::Object);
	
protected:
	/// Constructor
	OpenGLPointPickerLinearEntity();
	/// Destructor
	virtual ~OpenGLPointPickerLinearEntity();
	
	virtual bool Event_NewPoint(PickedPoint p);
	virtual bool Event_LineClicked(int index);
	virtual bool Event_PointClicked(int index);
	virtual bool Event_PointDragged(int index, PickedPoint newPos);
	virtual bool Event_DeletePoint(int index);
	virtual bool Event_DeleteLine(int index);
	virtual bool Event_PointReleased(int index);
	virtual bool Event_ResetAll();

	/// Re-generates the line list
	virtual void updateLineList();

	/// Emits all signals
	virtual void emitSignals();

signals:
	/**	@name Signals connected to the control unit. !*/
	//@{
	void Point1Changed(const QVector3D p);
	void Point2Changed(const QVector3D p);
	void DistanceChanged(float d);

	//@}

};


}



#endif //OPENGLPOINTPICKERLINEARENTITY_H__