latest version v1.9 - last update 10 Apr 2010 |
Abstract class for all main windows for the different data types. More...
#include <ltiViewer.h>
Public Types | |
enum | eDataType |
Public Member Functions | |
mainWindow () | |
mainWindow (const mainWindow &other) | |
virtual | ~mainWindow () |
virtual mainGTKWindow * | clone () const =0 |
void | setData (const matrix< ubyte > &data) |
void | setData (const matrix< int > &data) |
void | setData (const matrix< float > &data) |
void | setData (const matrix< double > &data) |
void | setData (const matrix< rgbPixel > &data) |
void | setData (const vector< ubyte > &data) |
void | setData (const vector< int > &data) |
void | setData (const vector< float > &data) |
void | setData (const vector< double > &data) |
virtual bool | drawData () |
void | useFunctor (viewerFunctor &fct) |
bool | lastClickedPosition (point &pos) const |
point | waitButtonPressed (const bool onlyValidPos) const |
int | lastKey () const |
int | waitKey () const |
point | waitKeyOrButton (bool &key, bool &button) const |
Protected Member Functions | |
Members to be reimplemented | |
virtual void | dataToImage (image &img)=0 |
virtual void | drawReady () |
virtual void | prepareParameters ()=0 |
virtual bool | validData (void) |
virtual void | indicateDataHide (void) |
virtual void | windowDestructionHandler () |
virtual void | mouseMovedHandler (const int &button, const point &pos, const bool shift, const bool ctrl) |
virtual void | mouseButtonHandler (const int &button, const point &pos, const bool shift, const bool ctrl, const bool pressed) |
virtual void | keyPressedHandler (const bool shift, const bool ctrl, const int key) |
virtual void | keyReleasedHandler (const bool shift, const bool ctrl, const int key) |
virtual void | updateStatusBar (const point &pos)=0 |
Protected Attributes | |
eDataType | dataType |
const mathObject * | theData |
viewerFunctor * | master |
float | norm |
bool | newDataFlag |
mutex | dataLock |
semaphore | drawRequestSem |
point | lastPosition |
bool | validLastPosition |
semaphore | waitInteraction |
bool | waitingForClick |
int | lastKeyCode |
bool | waitingForKey |
Abstract class for all main windows for the different data types.
Types accepted by this viewer (and its subclasses).
lti::viewer::mainWindow::mainWindow | ( | ) |
Constructor.
lti::viewer::mainWindow::mainWindow | ( | const mainWindow & | other | ) |
Copy constructor.
virtual lti::viewer::mainWindow::~mainWindow | ( | ) | [virtual] |
Destructor.
virtual mainGTKWindow* lti::viewer::mainWindow::clone | ( | ) | const [pure virtual] |
clone this window
Reimplemented from lti::mainGTKWindow.
Implemented in lti::viewer::mainWndChannelFixed, lti::viewer::mainWndChannelFloat, lti::viewer::mainWndVector, and lti::viewer::mainWndImage.
virtual void lti::viewer::mainWindow::dataToImage | ( | image & | img | ) | [protected, pure virtual] |
This method is the one where your data should be drawn.
You just need to draw on the "theImage" attribute image.
Reimplemented from lti::mainGTKWindow.
Implemented in lti::viewer::mainWndChannelFixed, lti::viewer::mainWndChannelFloat, lti::viewer::mainWndVector, and lti::viewer::mainWndImage.
virtual bool lti::viewer::mainWindow::drawData | ( | ) | [virtual] |
generate an event which will show the data
Reimplemented from lti::mainGTKWindow.
virtual void lti::viewer::mainWindow::drawReady | ( | ) | [protected, virtual] |
This method is called as soon as all data has been drawn.
You can use it to send a message to another widget or object, in order to allow further actions. The default implementation does nothing.
Reimplemented from lti::mainGTKWindow.
virtual void lti::viewer::mainWindow::indicateDataHide | ( | void | ) | [protected, virtual] |
this method will be called to invalidate the data.
Usually will set a few pointers to NULL to indicate that the window has been hidden, and no valid data is keeped in this class any more.
Reimplemented from lti::mainGTKWindow.
virtual void lti::viewer::mainWindow::keyPressedHandler | ( | const bool | shift, | |
const bool | ctrl, | |||
const int | key | |||
) | [protected, virtual] |
this method is called when a key is pressed while the viewer window is active.
shift | true if the shift-key has been pressed while moving the mouse. | |
ctrl | true if the control-key has been pressed while moving the mouse. | |
key | integer value containing the key code. You can find symbol definitions for the values used here in the file <gdk/gdkkeysym.h> |
Reimplemented from lti::mainGTKWindow.
virtual void lti::viewer::mainWindow::keyReleasedHandler | ( | const bool | shift, | |
const bool | ctrl, | |||
const int | key | |||
) | [protected, virtual] |
this method is called when a key is pressed while the viewer window is active.
shift | true if the shift-key has been pressed while moving the mouse. | |
ctrl | true if the control-key has been pressed while moving the mouse. | |
key | integer value containing the key code. You can find symbol definitions for the values used here in the file <gdk/gdkkeysym.h> |
Reimplemented from lti::mainGTKWindow.
bool lti::viewer::mainWindow::lastClickedPosition | ( | point & | pos | ) | const |
Get the last clicked position and write the result at the given parameter.
If this position lies within the displayed image, the returned value is true, otherwise false.
This method does not block the program execution. It just returns the last clicked position (which can be seen in the status bar)
Note that the clicked position can be out of range.
pos | the last clicked position will be written here |
int lti::viewer::mainWindow::lastKey | ( | ) | const |
return the last pressed key
This method does not block the program execution. It just returns the value of the last key pressed.
virtual void lti::viewer::mainWindow::mouseButtonHandler | ( | const int & | button, | |
const point & | pos, | |||
const bool | shift, | |||
const bool | ctrl, | |||
const bool | pressed | |||
) | [protected, virtual] |
this function is called when a mouse button is pressed.
button | which button is pressed (0 means none, 1 left button, 3 right button) | |
pos | actual position of mouse pointer | |
shift | true if the shift-key has been pressed while moving the mouse. | |
ctrl | true if the control-key has been pressed while moving the mouse. | |
pressed | true if the button was pressed, false if the button was released. |
Reimplemented from lti::mainGTKWindow.
virtual void lti::viewer::mainWindow::mouseMovedHandler | ( | const int & | button, | |
const point & | pos, | |||
const bool | shift, | |||
const bool | ctrl | |||
) | [protected, virtual] |
this function is called when a mouse button is pressed and the mouse moved.
button | which button is pressed (0 means none, 1 left button, 3 right button) | |
pos | actual position of mouse pointer | |
shift | true if the shift-key has been pressed while moving the mouse. | |
ctrl | true if the control-key has been pressed while moving the mouse. |
Reimplemented from lti::mainGTKWindow.
virtual void lti::viewer::mainWindow::prepareParameters | ( | ) | [protected, pure virtual] |
Prepare the parameters before the configuration dialog is started.
This member gets some information of the displayed data into the informational attributes of the parameters instance. It is called just before opening the settings dialog, and is the proper place to update the mentioned informational data.
Reimplemented from lti::mainGTKWindow.
Implemented in lti::viewer::mainWndChannelFixed, lti::viewer::mainWndChannelFloat, lti::viewer::mainWndVector, and lti::viewer::mainWndImage.
void lti::viewer::mainWindow::setData | ( | const vector< double > & | data | ) |
Set the data to be displayed.
void lti::viewer::mainWindow::setData | ( | const vector< float > & | data | ) |
Set the data to be displayed.
void lti::viewer::mainWindow::setData | ( | const vector< int > & | data | ) |
Set the data to be displayed.
Set the data to be displayed.
Set the data to be displayed.
void lti::viewer::mainWindow::setData | ( | const matrix< double > & | data | ) |
Set the data to be displayed (matrix<float> and inherited classes).
void lti::viewer::mainWindow::setData | ( | const matrix< float > & | data | ) |
Set the data to be displayed (matrix<float> and inherited classes).
void lti::viewer::mainWindow::setData | ( | const matrix< int > & | data | ) |
Set the data to be displayed.
Set the data to be displayed (matrix<ubyte> and inherited classes).
virtual void lti::viewer::mainWindow::updateStatusBar | ( | const point & | pos | ) | [protected, pure virtual] |
called when the status bar information needs to be updated
Implemented in lti::viewer::mainWndChannelFixed, lti::viewer::mainWndChannelFloat, lti::viewer::mainWndVector, and lti::viewer::mainWndImage.
void lti::viewer::mainWindow::useFunctor | ( | viewerFunctor & | fct | ) |
Indicate which functor should be used for painting.
virtual bool lti::viewer::mainWindow::validData | ( | void | ) | [protected, virtual] |
Indicate if there are valid data to show.
This method must check if the provided data is ready to be shown, i.e. if the dataToImage() can be already be used to draw the data.
Reimplemented from lti::mainGTKWindow.
point lti::viewer::mainWindow::waitButtonPressed | ( | const bool | onlyValidPos | ) | const |
Wait until the user clicks somewhere on the image/vector and returns the clicked position.
Note that the clicked position can be out of range.
int lti::viewer::mainWindow::waitKey | ( | ) | const |
point lti::viewer::mainWindow::waitKeyOrButton | ( | bool & | key, | |
bool & | button | |||
) | const |
Wait until the user presses a key or a mouse button.
key | will be set to true if the user presses a key, otherwise will be set to false. | |
button | will be set to true if the user presses a mouse button, otherwise will be set to false. |
virtual void lti::viewer::mainWindow::windowDestructionHandler | ( | ) | [protected, virtual] |
window destruction handler.
This method is called when the window is destroyed. You don't need to call GTK hide methods or stuff like that, because the enclosing application will take care on these matters. Just finalize tasks you started that should be active as long as the widget window does.
A typical use for this method is un-locking keyboard or mouse mutexes that wait for the user. If he closes the window without giving any information, these mutexes will remain locked, blocking some other threads. This method is the proper place to un-lock them.
Reimplemented from lti::mainGTKWindow.
mutex lti::viewer::mainWindow::dataLock [mutable, protected] |
mutex to protect the data attribute
eDataType lti::viewer::mainWindow::dataType [protected] |
Type of the data contained in this class.
semaphore lti::viewer::mainWindow::drawRequestSem [protected] |
drawing available
int lti::viewer::mainWindow::lastKeyCode [mutable, protected] |
last position in the image where the mouse was clicked
point lti::viewer::mainWindow::lastPosition [protected] |
last position in the image where the mouse was clicked
viewerFunctor* lti::viewer::mainWindow::master [protected] |
The painting functor.
bool lti::viewer::mainWindow::newDataFlag [protected] |
true if the data has been set and no statistics have been computed for it yet.
float lti::viewer::mainWindow::norm [protected] |
Value used as 1.0 in the given image type (usually 1.0 or 255);.
const mathObject* lti::viewer::mainWindow::theData [protected] |
copy of the data wished to be visualized
bool lti::viewer::mainWindow::validLastPosition [protected] |
This flag indicates, if the lastPosition contains a valid value, i.e.
if the point lies within the displayed image
bool lti::viewer::mainWindow::waitingForClick [mutable, protected] |
set to true, when the user waits for a mouse click
bool lti::viewer::mainWindow::waitingForKey [mutable, protected] |
set to true, when the user waits for a mouse click
semaphore lti::viewer::mainWindow::waitInteraction [mutable, protected] |
semaphore to wait until the user clicks on the window