Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
BIAS::GuiBase Class Reference

Gui is a simple windowing environment... More...

#include <Gui/GuiBase.hh>

+ Inheritance diagram for BIAS::GuiBase:
+ Collaboration diagram for BIAS::GuiBase:

Public Member Functions

void AddDebugLevel (const long int lv)
 
void AddDebugLevel (const std::string &name)
 
virtual bool CheckForEvent (bool &KeyEvent, char &key, bool &Pressed, int &Button, int &Xpos, int &Ypos)
 as above but does return immediate with true if event occured More...
 
virtual bool CheckForEvent (char &key, bool &Pressed, int &Button, int &Xpos, int &Ypos)
 as above but does return immediate with true if event occured if key != -1 key event occured, if Xpos != -1 && YPos != -1 MouseButton Event occured, also both is possible More...
 
virtual char CheckForKeyEvent ()
 checks if any key is pressed and returns it returns -1 if no key is pressed More...
 
virtual bool CheckForMouseButtonEvent (bool &Pressed, int &Button, int &Xpos, int &Ypos)
 return true if mouse button is pressed or released, false else see WaitForMouseButtonEvent for detailed description More...
 
bool Closed ()
 returns true if window is closed by user via x button More...
 
bool DebugLevelIsSet (const long int lv) const
 
bool DebugLevelIsSet (const std::string &name) const
 
virtual int DestroyWindow ()
 stops the main loop and closes the window More...
 
int GetDebugLevel () const
 
std::ostream & GetDebugStream () const
 
void GetDebugStream (std::ostream &os) const
 
virtual void GetFactorOffset (int &xoffset, int &yoffset, int &factor)
 gets offset and factor for mouse position mouse position in (e.g. More...
 
int GetMouseX ()
 
int GetMouseY ()
 
std::string GetTitle ()
 
 GuiBase (bool ShowMousePos=true)
 
 GuiBase (std::string const &Title, bool ShowMousePos=true)
 as standard constructor, also sets Title_ More...
 
 GuiBase (const GuiBase &gui)
 
long int Name2DebugLevel (const std::string &name) const
 looks up a debuglevel in the internal map, returns 0 if not found More...
 
long int NewDebugLevel (const std::string &name)
 creates a new debuglevel More...
 
void PrintDebugLevel (std::ostream &os=std::cout) const
 
void RemoveDebugLevel (const long int lv)
 
void RemoveDebugLevel (const std::string &name)
 
void SetDebugLevel (const long int lv)
 
void SetDebugLevel (const std::string &name)
 
void SetDebugStream (const std::ostream &os)
 
virtual void SetFactorOffset (int xoffset, int yoffset, int factor)
 sets offset and factor for mouse position mouse position in (e.g. More...
 
virtual void SetTitle (std::string const &Title)
 
void ShowDebugLevel (std::ostream &os=std::cout) const
 prints all internally known debuglevels More...
 
virtual int ShowImage (ImageBase &image, float min=0.0, float max=255.0)
 shows/updates the image shown in window. More...
 
virtual int ShowImage (PyramidImage< unsigned char > &pim)
 
virtual int ShowImage (PyramidImage< float > &pim)
 
virtual void WaitForEvent (bool &KeyEvent, char &key, bool &Pressed, int &Button, int &Xpos, int &Ypos)
 waits for either KeyEvent or MouseButtonEvent, KeyEvent is set to true if key is pressed, the other variables are set as in WaitForKeyEvent and WaitForMouseButtonEvent More...
 
virtual char WaitForKeyEvent ()
 waits until a key is pressed and returns it tested More...
 
virtual void WaitForMouseButtonEvent (bool &Pressed, int &Button, int &Xpos, int &Ypos)
 waits until any mouse button is pressed or released More...
 
virtual ~GuiBase ()
 

Static Public Member Functions

static long int GetGlobalDebugLevel ()
 
static void SetGlobalDebugLevel (long int lev)
 

Protected Member Functions

long ConsumeNextFreeDebuglevel_ ()
 returns the next available debuglevel More...
 
template<class PixelType >
int ConvertToUC_ (Image< PixelType > &image, float min, float max)
 
virtual void Init_ (bool ShowMousePos)
 Set up thread and stuff. More...
 
virtual int ShowConvertedImage_ (Image< unsigned char > &image)
 Does the real update of the image shown in window. Must be overloaded. More...
 
bool TestImage_ (Image< unsigned char > &image)
 test if internal variables Width_, Height_ and nChannels_ are set correct for image these 3 variables are used as an indicator if Buffer_ is allocated in right size More...
 

Protected Attributes

long int _liDebugLevel
 
long int _liNextDebugLevel
 new concept, debuglevel are managed here in the debug class More...
 
std::map< std::string, long int > _String2Debuglevel
 
int Factor_
 
unsigned int Height_
 
int IsPyramid_
 
char KeyBuffer_
 
int MouseButtonPressed_
 
int MouseButtonPressX_
 
int MouseButtonPressY_
 
int MouseButtonReleased_
 
int MouseButtonReleaseX_
 
int MouseButtonReleaseY_
 
int MousePosX_
 
int MousePosY_
 
unsigned int nChannels_
 
ImageBase OrigPicture_
 This is the original representation of the picture. More...
 
unsigned int Pyramid0Height_
 
unsigned int Pyramid0Width_
 
unsigned int PyramidLevels_
 
bool ShowMouse_
 
std::string Title_
 
unsigned int Width_
 if the following 3 variables are set , Buffer_ is already allocated More...
 
bool WindowCreated_
 
int XOffset_
 
int YOffset_
 

Static Protected Attributes

static std::ostream _zDebugStream
 
static bool BaseInitialized_ =false
 
static long int GlobalDebugLevel = 0
 
static pthread_mutex_t MouseButtonMutex_
 

Detailed Description

Gui is a simple windowing environment...

This is a base class and should not be used directly.

Definition at line 75 of file GuiBase.hh.

Constructor & Destructor Documentation

GuiBase::GuiBase ( bool  ShowMousePos = true)

Definition at line 78 of file GuiBase.cpp.

References Init_().

GuiBase::GuiBase ( std::string const &  Title,
bool  ShowMousePos = true 
)

as standard constructor, also sets Title_

Definition at line 83 of file GuiBase.cpp.

References Init_(), and Title_.

GuiBase::GuiBase ( const GuiBase gui)

Definition at line 89 of file GuiBase.cpp.

References Init_(), ShowMouse_, and Title_.

GuiBase::~GuiBase ( )
virtual

Definition at line 96 of file GuiBase.cpp.

Member Function Documentation

void BIAS::Debug::AddDebugLevel ( const long int  lv)
inlineinherited
void BIAS::Debug::AddDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 362 of file Debug.hh.

bool GuiBase::CheckForEvent ( bool &  KeyEvent,
char &  key,
bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtual

as above but does return immediate with true if event occured

Definition at line 296 of file GuiBase.cpp.

References CheckForKeyEvent(), and CheckForMouseButtonEvent().

bool GuiBase::CheckForEvent ( char &  key,
bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtual

as above but does return immediate with true if event occured if key != -1 key event occured, if Xpos != -1 && YPos != -1 MouseButton Event occured, also both is possible

Definition at line 331 of file GuiBase.cpp.

References CheckForKeyEvent(), and CheckForMouseButtonEvent().

char GuiBase::CheckForKeyEvent ( )
virtual

checks if any key is pressed and returns it returns -1 if no key is pressed

Author
Felix Woelk

Reimplemented in BIAS::GuiCV.

Definition at line 340 of file GuiBase.cpp.

References KeyBuffer_.

Referenced by CheckForEvent(), and WaitForEvent().

bool GuiBase::CheckForMouseButtonEvent ( bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtual

return true if mouse button is pressed or released, false else see WaitForMouseButtonEvent for detailed description

Definition at line 369 of file GuiBase.cpp.

References MouseButtonMutex_, MouseButtonPressed_, MouseButtonPressX_, MouseButtonPressY_, MouseButtonReleased_, MouseButtonReleaseX_, and MouseButtonReleaseY_.

Referenced by CheckForEvent(), and WaitForEvent().

bool BIAS::GuiBase::Closed ( )
inline

returns true if window is closed by user via x button

Author
woelk 05/2003

Definition at line 164 of file GuiBase.hh.

long BIAS::Debug::ConsumeNextFreeDebuglevel_ ( )
inlineprotectedinherited

returns the next available debuglevel

Author
woelk 09/2006

Definition at line 521 of file Debug.hh.

template<class PixelType >
int GuiBase::ConvertToUC_ ( Image< PixelType > &  image,
float  min,
float  max 
)
protected
bool BIAS::Debug::DebugLevelIsSet ( const long int  lv) const
inlineinherited
bool BIAS::Debug::DebugLevelIsSet ( const std::string &  name) const
inlineinherited

Definition at line 350 of file Debug.hh.

int GuiBase::DestroyWindow ( )
virtual

stops the main loop and closes the window

Reimplemented in BIAS::GuiCV.

Definition at line 283 of file GuiBase.cpp.

int BIAS::Debug::GetDebugLevel ( ) const
inlineinherited
std::ostream& BIAS::Debug::GetDebugStream ( ) const
inlineinherited

Definition at line 405 of file Debug.hh.

void BIAS::Debug::GetDebugStream ( std::ostream &  os) const
inlineinherited

Definition at line 414 of file Debug.hh.

void GuiBase::GetFactorOffset ( int &  xoffset,
int &  yoffset,
int &  factor 
)
virtual

gets offset and factor for mouse position mouse position in (e.g.

zoomed) window is calculated as follows: x = real_xpos/factor + xoffset; y = real_ypos/factor + yoffset; real_x/ypos are in the window coordinate system

Definition at line 130 of file GuiBase.cpp.

References Factor_, XOffset_, and YOffset_.

static long int BIAS::Debug::GetGlobalDebugLevel ( )
inlinestaticinherited

Definition at line 431 of file Debug.hh.

int BIAS::GuiBase::GetMouseX ( )
inline

Definition at line 115 of file GuiBase.hh.

int BIAS::GuiBase::GetMouseY ( )
inline

Definition at line 116 of file GuiBase.hh.

std::string BIAS::GuiBase::GetTitle ( )
inline

Definition at line 89 of file GuiBase.hh.

void GuiBase::Init_ ( bool  ShowMousePos)
protectedvirtual
long int BIAS::Debug::Name2DebugLevel ( const std::string &  name) const
inlineinherited

looks up a debuglevel in the internal map, returns 0 if not found

Author
woelk 09/2006

Definition at line 454 of file Debug.hh.

long int BIAS::Debug::NewDebugLevel ( const std::string &  name)
inlineinherited
void BIAS::Debug::PrintDebugLevel ( std::ostream &  os = std::cout) const
inlineinherited

Definition at line 383 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const long int  lv)
inlineinherited

Definition at line 369 of file Debug.hh.

void BIAS::Debug::RemoveDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 376 of file Debug.hh.

void BIAS::Debug::SetDebugLevel ( const long int  lv)
inlineinherited
void BIAS::Debug::SetDebugLevel ( const std::string &  name)
inlineinherited

Definition at line 325 of file Debug.hh.

void BIAS::Debug::SetDebugStream ( const std::ostream &  os)
inlineinherited

Definition at line 398 of file Debug.hh.

void GuiBase::SetFactorOffset ( int  xoffset,
int  yoffset,
int  factor 
)
virtual

sets offset and factor for mouse position mouse position in (e.g.

zoomed) window is calculated as follows: x = real_xpos/factor + xoffset; y = real_ypos/factor + yoffset; real_x/ypos are in the window coordinate system

Definition at line 123 of file GuiBase.cpp.

References Factor_, XOffset_, and YOffset_.

static void BIAS::Debug::SetGlobalDebugLevel ( long int  lev)
inlinestaticinherited

Definition at line 424 of file Debug.hh.

void GuiBase::SetTitle ( std::string const &  Title)
virtual

Reimplemented in BIAS::GuiCV, and BIAS::GuiWX.

Definition at line 289 of file GuiBase.cpp.

int GuiBase::ShowConvertedImage_ ( Image< unsigned char > &  image)
protectedvirtual

Does the real update of the image shown in window. Must be overloaded.

Reimplemented in BIAS::GuiCV, and BIAS::GuiWX.

Definition at line 277 of file GuiBase.cpp.

Referenced by ConvertToUC_(), and ShowImage().

void BIAS::Debug::ShowDebugLevel ( std::ostream &  os = std::cout) const
inlineinherited

prints all internally known debuglevels

Author
woelk 09/2006

Definition at line 496 of file Debug.hh.

int GuiBase::ShowImage ( ImageBase image,
float  min = 0.0,
float  max = 255.0 
)
virtual
int GuiBase::ShowImage ( PyramidImage< unsigned char > &  pim)
virtual
int GuiBase::ShowImage ( PyramidImage< float > &  pim)
virtual
bool BIAS::GuiBase::TestImage_ ( Image< unsigned char > &  image)
inlineprotected

test if internal variables Width_, Height_ and nChannels_ are set correct for image these 3 variables are used as an indicator if Buffer_ is allocated in right size

Definition at line 217 of file GuiBase.hh.

References BIAS::ImageBase::GetChannelCount(), BIAS::ImageBase::GetHeight(), and BIAS::ImageBase::GetWidth().

void GuiBase::WaitForEvent ( bool &  KeyEvent,
char &  key,
bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtual

waits for either KeyEvent or MouseButtonEvent, KeyEvent is set to true if key is pressed, the other variables are set as in WaitForKeyEvent and WaitForMouseButtonEvent

Definition at line 311 of file GuiBase.cpp.

References CheckForKeyEvent(), CheckForMouseButtonEvent(), and WindowCreated_.

char GuiBase::WaitForKeyEvent ( )
virtual

waits until a key is pressed and returns it tested

Author
Felix Woelk

Reimplemented in BIAS::GuiCV.

Definition at line 352 of file GuiBase.cpp.

References KeyBuffer_, and WindowCreated_.

void GuiBase::WaitForMouseButtonEvent ( bool &  Pressed,
int &  Button,
int &  Xpos,
int &  Ypos 
)
virtual

waits until any mouse button is pressed or released

Xpos and Ypos are set to the coordinates within the drawing area Pressed is set to true if the button was pressed and to false if the button was released Button is set to th mouse button no: 1 = left, 2 = middle, 3 = right

Reimplemented in BIAS::GuiCV.

Definition at line 398 of file GuiBase.cpp.

References MouseButtonMutex_, MouseButtonPressed_, MouseButtonPressX_, MouseButtonPressY_, MouseButtonReleased_, MouseButtonReleaseX_, MouseButtonReleaseY_, and WindowCreated_.

Member Data Documentation

long int BIAS::Debug::_liDebugLevel
protectedinherited

Definition at line 510 of file Debug.hh.

Referenced by BIAS::Debug::operator=(), and BIAS::ImageBase::operator=().

long int BIAS::Debug::_liNextDebugLevel
protectedinherited

new concept, debuglevel are managed here in the debug class

Definition at line 516 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

std::map<std::string, long int> BIAS::Debug::_String2Debuglevel
protectedinherited

Definition at line 517 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

std::ostream BIAS::Debug::_zDebugStream
staticprotectedinherited

Definition at line 511 of file Debug.hh.

Referenced by BIAS::Debug::operator=().

bool GuiBase::BaseInitialized_ =false
staticprotected

Definition at line 208 of file GuiBase.hh.

Referenced by Init_().

int BIAS::GuiBase::Factor_
protected

Definition at line 203 of file GuiBase.hh.

Referenced by GetFactorOffset(), Init_(), and SetFactorOffset().

long int BIAS::Debug::GlobalDebugLevel = 0
staticprotectedinherited

Definition at line 513 of file Debug.hh.

unsigned int BIAS::GuiBase::Height_
protected

Definition at line 183 of file GuiBase.hh.

Referenced by Init_().

int BIAS::GuiBase::IsPyramid_
protected

Definition at line 205 of file GuiBase.hh.

Referenced by Init_(), and ShowImage().

char BIAS::GuiBase::KeyBuffer_
protected

Definition at line 202 of file GuiBase.hh.

Referenced by CheckForKeyEvent(), Init_(), and WaitForKeyEvent().

pthread_mutex_t GuiBase::MouseButtonMutex_
staticprotected
int BIAS::GuiBase::MouseButtonPressed_
protected
int BIAS::GuiBase::MouseButtonPressX_
protected
int BIAS::GuiBase::MouseButtonPressY_
protected
int BIAS::GuiBase::MouseButtonReleased_
protected
int BIAS::GuiBase::MouseButtonReleaseX_
protected
int BIAS::GuiBase::MouseButtonReleaseY_
protected
int BIAS::GuiBase::MousePosX_
protected

Definition at line 189 of file GuiBase.hh.

Referenced by BIAS::GuiCV::MouseCallback().

int BIAS::GuiBase::MousePosY_
protected

Definition at line 190 of file GuiBase.hh.

Referenced by BIAS::GuiCV::MouseCallback().

unsigned int BIAS::GuiBase::nChannels_
protected

Definition at line 184 of file GuiBase.hh.

Referenced by Init_().

ImageBase BIAS::GuiBase::OrigPicture_
protected

This is the original representation of the picture.

Definition at line 199 of file GuiBase.hh.

Referenced by ShowImage().

unsigned int BIAS::GuiBase::Pyramid0Height_
protected

Definition at line 186 of file GuiBase.hh.

Referenced by Init_(), and ShowImage().

unsigned int BIAS::GuiBase::Pyramid0Width_
protected

Definition at line 185 of file GuiBase.hh.

Referenced by Init_(), and ShowImage().

unsigned int BIAS::GuiBase::PyramidLevels_
protected

Definition at line 187 of file GuiBase.hh.

Referenced by Init_(), and ShowImage().

bool BIAS::GuiBase::ShowMouse_
protected

Definition at line 179 of file GuiBase.hh.

Referenced by GuiBase(), and Init_().

std::string BIAS::GuiBase::Title_
protected
unsigned int BIAS::GuiBase::Width_
protected

if the following 3 variables are set , Buffer_ is already allocated

Definition at line 182 of file GuiBase.hh.

Referenced by Init_().

bool BIAS::GuiBase::WindowCreated_
protected
int BIAS::GuiBase::XOffset_
protected

Definition at line 204 of file GuiBase.hh.

Referenced by GetFactorOffset(), Init_(), and SetFactorOffset().

int BIAS::GuiBase::YOffset_
protected

Definition at line 204 of file GuiBase.hh.

Referenced by GetFactorOffset(), Init_(), and SetFactorOffset().


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