#ifndef __CALIBRATEWIDGET_HH
#define __CALIBRATEWIDGET_HH


#include <boost/array.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/smart_ptr.hpp>
#include <QtOpenGL/QGLWidget>
#include "image.h"
#include "image_input.h"

/// Widget for displaying calibration pattern.
class CalibrateWidget: public QGLWidget
{
  Q_OBJECT
public:
  ///
  typedef boost::numeric::ublas::vector< double > Vector;
  ///
  CalibrateWidget( QWidget *parent = 0, Qt::WFlags f = 0 );
  ///
  CalibrateWidget( const mimas::image< unsigned char > &_projectedPattern,
                   QWidget *parent = 0, Qt::WFlags f = 0 );
  /** ith position of projected pattern.
      <ul>
      <li><b>i=1</b> left-top corner</li>
      <li><b>i=2</b> right-top corner</li>
      <li><b>i=3</b> left-bottom corner</li>
      <li><b>i=4</b> right-bottom corner</li>
      <li><b>i=5</b> center of screen</li>
      </ul>
      @param i index of position
      @return coordinates to display patten at. */
  Vector getPos( int i );
public slots:
  /** Display pattern at specified position
      @see pattern
      @see getPos */
  void setPattern(int);
protected:
  ///
  void initializeGL(void);
  ///
  void resizeGL( int w, int h );
  ///
  void paintGL(void);
  /// Image storing projection pattern
  mimas::image< unsigned char > projectedPattern;
  /** Index of current pattern-position.
      @see setPattern */
  int pattern;
};

#endif