LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::viewer::mainWindow Class Reference

Abstract class for all main windows for the different data types. More...

#include <ltiViewer.h>

Inheritance diagram for lti::viewer::mainWindow:
Inheritance graph
[legend]
Collaboration diagram for lti::viewer::mainWindow:
Collaboration graph
[legend]

List of all members.

Public Types

enum  eDataType

Public Member Functions

 mainWindow ()
 mainWindow (const mainWindow &other)
virtual ~mainWindow ()
virtual mainGTKWindowclone () 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 mathObjecttheData
viewerFunctormaster
float norm
bool newDataFlag
mutex dataLock
semaphore drawRequestSem
point lastPosition
bool validLastPosition
semaphore waitInteraction
bool waitingForClick
int lastKeyCode
bool waitingForKey

Detailed Description

Abstract class for all main windows for the different data types.


Member Enumeration Documentation

Types accepted by this viewer (and its subclasses).


Constructor & Destructor Documentation

lti::viewer::mainWindow::mainWindow (  ) 

Constructor.

lti::viewer::mainWindow::mainWindow ( const mainWindow other  ) 

Copy constructor.

virtual lti::viewer::mainWindow::~mainWindow (  )  [virtual]

Destructor.


Member Function Documentation

virtual mainGTKWindow* lti::viewer::mainWindow::clone (  )  const [pure virtual]
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.

Parameters:
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.

Parameters:
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.

See also:
waitButtonPressed()
Parameters:
pos the last clicked position will be written here
Returns:
true, if the position lies within the displayed image, false otherwise.
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.

See also:
waitKey()
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.

Parameters:
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.

Parameters:
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.

void lti::viewer::mainWindow::setData ( const vector< ubyte > &  data  ) 

Set the data to be displayed.

void lti::viewer::mainWindow::setData ( const matrix< rgbPixel > &  data  ) 

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.

void lti::viewer::mainWindow::setData ( const matrix< ubyte > &  data  ) 

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.

See also:
lastClickedPosition()
int lti::viewer::mainWindow::waitKey (  )  const

Wait until the user press some key while the viewer window is active and return the code of the key pressed.

See also:
lastKey()
point lti::viewer::mainWindow::waitKeyOrButton ( bool &  key,
bool &  button 
) const

Wait until the user presses a key or a mouse button.

Parameters:
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.
Returns:
the key code if the user presses a key or the mouse button number.
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.


Member Data Documentation

mutex to protect the data attribute

Type of the data contained in this class.

drawing available

int lti::viewer::mainWindow::lastKeyCode [mutable, protected]

last position in the image where the mouse was clicked

last position in the image where the mouse was clicked

The painting functor.

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);.

copy of the data wished to be visualized

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 to wait until the user clicks on the window


The documentation for this class was generated from the following file:

Generated on Sat Apr 10 15:29:05 2010 for LTI-Lib by Doxygen 1.6.1