www.pudn.com > snake_vc++.rar > MainWindow.h


// to avoid multiple class definitions by including this file more than once 
// we have to surround the class definition by this compiler flag 
#ifndef MAINWINDOW_H_ 
#define MAINWINDOW_H_ 
#include "Ui_MainWindow.h" 
 
// forward declarations 
class QLabel; 
 
/*! MainWindow Class 
* The class is a simple implementation of a QDesigner created form file 
* defining a simple QMainWindow application 
* The class inherits from QMainWindow and Ui_MainWindow. The Ui_MainWindow 
* provides the QDesigner part of the implementation, while the QMainWindow 
* provides the main functions of a QT Application 
* 
* \todo too much to mention here ;-) 
*/ 
class MainWindow : public QMainWindow, protected Ui_MainWindow 
{ 
	Q_OBJECT 
public: 
	/*! 
	 * Constructor of the MainWindow class 
	 * @param parent this optional parameter defines a parent widget the 
	 * created instance will be child of 
	 * @param flags optional parameter defining extra widget options 
	 * (see also the QT documentation) 
	 */ 
	MainWindow(QWidget* parent = 0, Qt::WindowFlags flags = 0); 
 
	/*! 
	 * Destructor of the MainWindow class, defined virtual to guarantee that 
	 * the destructor will be called even if the instance of this class is 
	 * saved in a variable of a parent class type 
	 */ 
	virtual ~MainWindow(); 
 
	//! getter function for actual image 
	inline const QImage* getImage(){return m_image;}; 
	//! setter function for actual image 
	void setImage(QImage* img){m_image = img;}; 
	//! loads image into pixmap 
	void showImage(QImage* img); 
	//! returns a pointer to the image label 
	inline QLabel* getImageLabel(){return m_imageLabel;}; 
 
	//! holds the filename from the original image 
	inline const QString* getFileName(){return m_fileName;}; 
 
	//! sets the upper left point of the ellipse bounding box 
	inline void setULPt(int x, int y){m_ulPt = QPoint(x,y);}; 
	//! gets the upper left point of the ellipse bounding box 
	inline QPoint getULPt(){return m_ulPt;}; 
 
	 
	//! sets the lower right point of the ellipse bounding box 
	inline void setLRPt(int x, int y){m_lrPt = QPoint(x,y);}; 
	//! gets the upper left point of the ellipse bounding box 
	inline QPoint getLRPt(){return m_lrPt;}; 
 
private slots: 
	//! opens and loads an image into \a m_imageLabel 
	void slotOpen(); 
	//! zooms to normal (initial) size 
	void slotZoomNormal(); 
	//! fits the image to the available image space 
    //void slotFitToWindow(); 
	void slotSnakeButtonPressed(); 
	//! triggers the demo with the ellipse image 
	void slotDemoButtonPressed(); 
	//! sets the initial curve from the snake to the actual ellipse 
	void slotInitCurveButtonPressed(); 
	//! switches the iteration window on when fitting the snake curve 
	void slotIterationOn(); 
	//! switches the iteration window on when fitting the snake curve 
	void slotIterationOff(); 
	//! lets the user do the iteration stepwise in the curve fitting window 
	void slotIterationStep(); 
 
 
private: 
	//! space for the image 
	QLabel* m_imageLabel; 
	//! filename of the actual image (for communication with OpenCV) 
	QString* m_fileName; 
	//! actual image 
	QImage* m_image; 
 
	//! scale factor for the displayed image 
	double m_scaleFactor; 
 
	//! upper left of the boundary box of the ellipse 
	QPoint m_ulPt; 
	//! lower right of the boundary box of the ellipse 
	QPoint m_lrPt; 
 
signals: 
	//! signal is emitted when the Snake button is pressed 
	void signalSnakeButtonPressed(); 
	//! signal is emitted when a new image is loaded within the gui 
	void signalImageOpened(); 
	//! signal is emitted when the demo button is pressed 
	void signalDemoButtonPressed(); 
	//! signal is emitted when the init curve should be set 
	void signalInitCurve(); 
	//! signal is emitted when the iteration flag is switched on 
	void signalIterationOn(); 
	//! signal is emitted when the iteration flag is switched off 
	void signalIterationOff(); 
	//! signal is emitted when the iteration should be done stepwise 
	void signalIterationStep(); 
}; 
#endif // end of #ifndef MAINWINDOW_H_