Privacy
An open-source, flexible 3D physical simulation framework
mars::graphics::GraphicsWidget Class Reference

Widget with OpenGL context and event handling. More...

#include <GraphicsWidget.h>

Public Member Functions

 GraphicsWidget (void *parent, osg::Group *scene, unsigned long id, bool hasRTTWidget=0, int f=0, GraphicsManager *gm=0)
 
 ~GraphicsWidget ()
 
void initializeOSG (void *data=0, GraphicsWidget *shared=0, int width=0, int height=0)
 
unsigned long getID (void)
 
mars::utils::Vector getMousePos ()
 returns actual mouse position More...
 
virtual void setWGeometry (int top, int left, int width, int height)
 
virtual void getWGeometry (int *top, int *left, int *width, int *height) const
 
void setFullscreen (bool val, int display=1)
 
osgViewer::View * getView (void)
 
interfaces::GraphicsCameraInterfacegetCameraInterface (void) const
 
osg::ref_ptr< osg::Camera > getMainCamera ()
 
osgViewer::GraphicsWindow * getGraphicsWindow ()
 
const osgViewer::GraphicsWindow * getGraphicsWindow () const
 
osg::Texture2D * getRTTTexture (void)
 
osg::Texture2D * getRTTDepthTexture (void)
 
osg::Image * getRTTImage (void)
 
osg::Image * getRTTDepthImage (void)
 
std::vector< osg::Node * > getPickedObjects ()
 
void clearSelectionVectors (void)
 
void setGraphicsEventHandler (interfaces::GraphicsEventInterface *graphicsEventHandler)
 
void addGraphicsEventHandler (interfaces::GraphicsEventInterface *graphicsEventHandler)
 
virtual osgWidget::WindowManager * getOrCreateWindowManager ()
 if you want to create your own gui without this interface, feel free to do so More...
 
void setHUD (HUD *theHUD)
 
void addHUDElement (HUDElement *elem)
 
void removeHUDElement (HUDElement *elem)
 
void switchHudElemtVis (int num_element)
 
void setClearColor (mars::utils::Color color)
 sets the clear color More...
 
const mars::utils::ColorgetClearColor () const
 
void setGrabFrames (bool grab)
 
void setSaveFrames (bool grab)
 
virtual void * getWidget ()
 
virtual void showWidget ()
 
virtual void updateView ()
 
virtual int createBox (const std::string &name, int type=0)
 Creates an osgWidget::Box. More...
 
virtual int createCanvas (const std::string &name)
 Creates an osgWidget::Canvas. More...
 
virtual int createFrame (const std::string &name, float x1, float y1, float x2, float y2)
 creates a Frame that basically holds on window. More...
 
virtual bool showWindow (int wndId)
 add the window with the id to the windowmanager More...
 
virtual bool hideWindow (int wndId)
 removes the window from the windowmanager More...
 
virtual bool deleteWindow (int wndId)
 deletes your window and all containing widgets More...
 
virtual bool deleteWidget (int wdgId)
 deletes one widget and his callbacks More...
 
virtual void setName (const std::string &name)
 
virtual const std::string getName () const
 
virtual bool windowSetPosition (int wndId, float x, float y)
 sets the position of a window on the screen More...
 
virtual int createWidget (const std::string &name, float sizex, float sizey)
 creates a basic widget, within the size you want it to be More...
 
virtual bool setColor (int id, float r, float g, float b, float a)
 sets the color of a widget or a window More...
 
virtual bool addWidgetToWindow (int window, int widget)
 adds window to a widget. More...
 
virtual bool addWidgetToWindow (int window, int widget, float x, float y)
 
virtual bool addWidgetToWindow (int window, int widget, int x, int y)
 
virtual int createLabel (const std::string &name, const std::string &text)
 creates a label,a widget with text in it. More...
 
virtual int createInput (const std::string &name, const std::string &text, int count)
 nearly like label, but you are able to input thinks into it More...
 
virtual bool setLabel (int id, const std::string &text)
 sets the text of a lable More...
 
virtual bool setFont (int id, const std::string &fontname)
 should be clear what does this mean. More...
 
virtual bool setFontColor (int id, float r, float g, float b, float a)
 
virtual bool setFontSize (int id, int size)
 
virtual bool createStyle (const std::string &name, const std::string &style)
 creates style, that you can apply to a widget or window, in order to set a lot of attributes, that are maybe not supported in this api More...
 
virtual bool setStyle (int id, const std::string &styleName)
 sets a style to a window or widget, that you created before with createStyle More...
 
virtual bool setSize (int id, float x, float y)
 sets the size of a widget More...
 
virtual bool addMousePushEventCallback (int id, guiClickCallBack function, guiClickCallBackBind *bindptr=0)
 used to add callback to a a widget. More...
 
virtual bool addMouseReleaseEventCallback (int id, guiClickCallBack function, guiClickCallBackBind *bindptr=0)
 
virtual bool addMouseEnterEventCallback (int id, guiClickCallBack function, guiClickCallBackBind *bindptr=0)
 
virtual bool addMouseLeaveEventCallback (int id, guiClickCallBack function, guiClickCallBackBind *bindptr=0)
 
bool addEventToWidget (int id, guiClickCallBack function, guiClickCallBackBind *bindptr, osgWidget::EventType type)
 
virtual bool setImage (int id, const std::string &path)
 sets the image of a widget More...
 
virtual int createTable (const std::string &name, int row, int colums)
 An osgWidget::Table provides a basic grid layout. More...
 
virtual bool setLayer (int id, int layer, int offset=0)
 sets the layer of a widget, please use the Layer enum for this More...
 
virtual bool getLayer (int id, int &layer)
 returns you the current layer More...
 
virtual bool setAlignHorizontal (int id, int h)
 sets the alignment for a widget, use the enums for this More...
 
virtual bool setAlignVertical (int id, int v)
 
virtual bool getAlignHorizontal (int id, int &h)
 
virtual bool getAlignVertical (int id, int &v)
 
virtual bool setAnchorVertical (int id, int va)
 like alignment but for windows, use also the same enums for this More...
 
virtual bool setAnchorHorizontal (int id, int ha)
 
virtual bool setCanFill (int id, bool state)
 
virtual bool setShadow (int id, float intensity)
 
virtual bool addSize (int id, float x, float y)
 add bogus size to your widget More...
 
virtual bool addColor (int id, float r, float g, float b, float a)
 add color to setColor. More...
 
virtual void getImageData (char *buffer, int &width, int &height)
 This function copies the image data in the given buffer. More...
 
virtual void getImageData (void **data, int &width, int &height)
 
virtual void getRTTDepthData (float *buffer, int &width, int &height)
 This function copies the depth image in the given buffer. More...
 
virtual void getRTTDepthData (float **data, int &width, int &height)
 
virtual osg::Group * getScene ()
 
virtual void setScene (osg::Group *s)
 
virtual void setHUDViewOffsets (double x1, double y1, double x2, double y2)
 
virtual void setupDistortion (double factor)
 
void grabFocus ()
 
void unsetFocus ()
 
- Public Member Functions inherited from mars::interfaces::GraphicsWindowInterface
virtual ~GraphicsWindowInterface ()
 
- Public Member Functions inherited from mars::interfaces::GraphicsGuiInterface
 GraphicsGuiInterface ()
 
virtual ~GraphicsGuiInterface ()
 

Protected Types

typedef std::map< int, osg::ref_ptr< osgWidget::Window > > WindowIdMapType
 
typedef std::map< int, osg::ref_ptr< osgWidget::Widget > > WidgetIdMapType
 
typedef std::pair< guiClickCallBack, std::tr1::shared_ptr< guiClickCallBackBind > > WidgetCallBackPairType
 
typedef std::list< WidgetCallBackPairTypeWidgetCallBackList
 
typedef std::map< int, WidgetCallBackListWidgetCallBackMapType
 

Protected Member Functions

bool manageClickEvent (osgWidget::Event &event)
 
osgWidget::Window * getWindowById (int wndId)
 
osgWidget::Widget * getWidgetById (int wdId)
 
int addOsgWidget (osgWidget::Widget *wid)
 
int addOsgWindow (osgWidget::Window *wnd)
 
void applyResize ()
 

Protected Attributes

int widgetWidth
 
int widgetHeight
 
int widgetX
 
int widgetY
 
std::string name
 
osgWidget::WindowManager * _osgWidgetWindowManager
 
WindowIdMapType _osgWindowIdMap
 
WidgetIdMapType _osgWidgetIdMap
 
WidgetCallBackMapType _widgetCallBackMap
 
unsigned int _osgWidgetWindowCnt
 
osg::ref_ptr< osgViewer::View > view
 
osg::Group * scene
 
bool isRTTWidget
 
osg::ref_ptr< osgViewer::GraphicsWindow > graphicsWindow
 
GraphicsCameragraphicsCamera
 
std::vector< interfaces::GraphicsEventInterface * > graphicsEventHandler
 
HUDmyHUD
 
osg::ref_ptr< osg::Camera > hudCamera
 
PostDrawCallbackpostDrawCallback
 
GraphicsManagergm
 
unsigned long widgetID
 
bool hasFocus
 

Private Types

enum  PickMode {
  DISABLED, STANDARD, FORCE_ADD, FORCE_REMOVE,
  SINGLE
}
 

Private Member Functions

virtual void initialize ()
 
virtual osg::ref_ptr< osg::GraphicsContext > createWidgetContext (void *parent, osg::ref_ptr< osg::GraphicsContext::Traits > traits)
 
void createContext (void *parent, GraphicsWidget *shared, int width, int height)
 
bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
 
bool handleKeyDownEvent (const osgGA::GUIEventAdapter &ea)
 
bool handleKeyUpEvent (const osgGA::GUIEventAdapter &ea)
 
bool handlePushEvent (const osgGA::GUIEventAdapter &ea)
 
bool handleMoveEvent (const osgGA::GUIEventAdapter &ea)
 
bool handleDragEvent (const osgGA::GUIEventAdapter &ea)
 
bool handleScrollEvent (const osgGA::GUIEventAdapter &ea)
 
bool handleResizeEvent (const osgGA::GUIEventAdapter &ea)
 
bool handleReleaseEvent (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
 
void sendKeyDownEvent (const osgGA::GUIEventAdapter &ea)
 
void sendKeyUpEvent (const osgGA::GUIEventAdapter &ea)
 
void translateKey (int &key, unsigned int &mod)
 
bool pick (const double x, const double y)
 
virtual void setWidgetFullscreen (bool val)
 

Private Attributes

utils::Color clearColor
 
bool isFullscreen
 
int mouseMask
 
bool isStereoDisplay
 
float cameraEyeSeparation
 
bool isHUDShown
 
bool isMouseButtonDown
 
bool isMouseMoving
 
int mouseX
 
int mouseY
 
osg::ref_ptr< osg::Texture2D > rttTexture
 
osg::ref_ptr< osg::Image > rttImage
 
osg::ref_ptr< osg::Texture2D > rttDepthTexture
 
osg::ref_ptr< osg::Image > rttDepthImage
 
std::vector< osg::Node * > pickedObjects
 
PickMode pickmode
 

Additional Inherited Members

- Public Types inherited from mars::interfaces::GraphicsGuiInterface
enum  Layer {
  LAYER_TOP = 100, LAYER_HIGH = 75, LAYER_MIDDLE = 50, LAYER_LOW = 25,
  LAYER_BG = 0
}
 use this to define the layer, if you set it More...
 
enum  VerticalAlignment { VA_CENTER, VA_TOP, VA_BOTTOM }
 used for setAlignVertical and and setAnchorVertical More...
 
enum  HorizontalAlignment { HA_CENTER, HA_LEFT, HA_RIGHT }
 use this for setAnchorHorizontal and setAlignHorizontal More...
 
typedef void(* guiClickCallBack) (double, double)
 callback declaration for simple callback More...
 
typedef std::tr1::function< void(double, double)> guiClickCallBackBind
 declaration for the binding for more sophisticated callback More...
 

Detailed Description

Widget with OpenGL context and event handling.

Definition at line 61 of file GraphicsWidget.h.

Member Typedef Documentation

◆ WidgetCallBackList

Definition at line 240 of file GraphicsWidget.h.

◆ WidgetCallBackMapType

Definition at line 241 of file GraphicsWidget.h.

◆ WidgetCallBackPairType

Definition at line 238 of file GraphicsWidget.h.

◆ WidgetIdMapType

typedef std::map<int,osg::ref_ptr<osgWidget::Widget> > mars::graphics::GraphicsWidget::WidgetIdMapType
protected

Definition at line 232 of file GraphicsWidget.h.

◆ WindowIdMapType

typedef std::map<int,osg::ref_ptr<osgWidget::Window> > mars::graphics::GraphicsWidget::WindowIdMapType
protected

Definition at line 230 of file GraphicsWidget.h.

Member Enumeration Documentation

◆ PickMode

Enumerator
DISABLED 
STANDARD 
FORCE_ADD 
FORCE_REMOVE 
SINGLE 

Definition at line 307 of file GraphicsWidget.h.

Constructor & Destructor Documentation

◆ GraphicsWidget()

mars::graphics::GraphicsWidget::GraphicsWidget ( void *  parent,
osg::Group *  scene,
unsigned long  id,
bool  hasRTTWidget = 0,
int  f = 0,
GraphicsManager gm = 0 
)

Definition at line 64 of file GraphicsWidget.cpp.

◆ ~GraphicsWidget()

mars::graphics::GraphicsWidget::~GraphicsWidget ( )

Definition at line 96 of file GraphicsWidget.cpp.

Member Function Documentation

◆ addColor()

bool mars::graphics::GraphicsWidget::addColor ( int  id,
float  r,
float  g,
float  b,
float  a 
)
virtual

add color to setColor.

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 522 of file GraphicsWidget.cpp.

◆ addEventToWidget()

bool mars::graphics::GraphicsWidget::addEventToWidget ( int  id,
guiClickCallBack  function,
guiClickCallBackBind bindptr,
osgWidget::EventType  type 
)

Definition at line 604 of file GraphicsWidget.cpp.

◆ addGraphicsEventHandler()

void mars::graphics::GraphicsWidget::addGraphicsEventHandler ( interfaces::GraphicsEventInterface graphicsEventHandler)
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1018 of file GraphicsWidget.cpp.

◆ addHUDElement()

void mars::graphics::GraphicsWidget::addHUDElement ( HUDElement elem)

Definition at line 1037 of file GraphicsWidget.cpp.

◆ addMouseEnterEventCallback()

bool mars::graphics::GraphicsWidget::addMouseEnterEventCallback ( int  id,
guiClickCallBack  function,
guiClickCallBackBind bindptr = 0 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 647 of file GraphicsWidget.cpp.

◆ addMouseLeaveEventCallback()

bool mars::graphics::GraphicsWidget::addMouseLeaveEventCallback ( int  id,
guiClickCallBack  function,
guiClickCallBackBind bindptr = 0 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 651 of file GraphicsWidget.cpp.

◆ addMousePushEventCallback()

bool mars::graphics::GraphicsWidget::addMousePushEventCallback ( int  id,
guiClickCallBack  function,
guiClickCallBackBind bindptr = 0 
)
virtual

used to add callback to a a widget.

use the first callback parameter for simple function call, if this is not what you are searching for, because you want to call the member function of a instance, feel free to use second parameter and set first to NULL

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 641 of file GraphicsWidget.cpp.

◆ addMouseReleaseEventCallback()

bool mars::graphics::GraphicsWidget::addMouseReleaseEventCallback ( int  id,
guiClickCallBack  function,
guiClickCallBackBind bindptr = 0 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 644 of file GraphicsWidget.cpp.

◆ addOsgWidget()

int mars::graphics::GraphicsWidget::addOsgWidget ( osgWidget::Widget *  wid)
protected

Definition at line 416 of file GraphicsWidget.cpp.

◆ addOsgWindow()

int mars::graphics::GraphicsWidget::addOsgWindow ( osgWidget::Window *  wnd)
protected

Definition at line 108 of file GraphicsWidget.cpp.

◆ addSize()

bool mars::graphics::GraphicsWidget::addSize ( int  id,
float  x,
float  y 
)
virtual

add bogus size to your widget

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 513 of file GraphicsWidget.cpp.

◆ addWidgetToWindow() [1/3]

bool mars::graphics::GraphicsWidget::addWidgetToWindow ( int  window,
int  widget 
)
virtual

adds window to a widget.

if you remember the different window types (table, canvas, box) their properties come into play here.

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 401 of file GraphicsWidget.cpp.

◆ addWidgetToWindow() [2/3]

bool mars::graphics::GraphicsWidget::addWidgetToWindow ( int  window,
int  widget,
float  x,
float  y 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 386 of file GraphicsWidget.cpp.

◆ addWidgetToWindow() [3/3]

bool mars::graphics::GraphicsWidget::addWidgetToWindow ( int  window,
int  widget,
int  x,
int  y 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 343 of file GraphicsWidget.cpp.

◆ applyResize()

void mars::graphics::GraphicsWidget::applyResize ( )
protected

Definition at line 1233 of file GraphicsWidget.cpp.

◆ clearSelectionVectors()

void mars::graphics::GraphicsWidget::clearSelectionVectors ( void  )

Definition at line 1066 of file GraphicsWidget.cpp.

◆ createBox()

int mars::graphics::GraphicsWidget::createBox ( const std::string &  name,
int  type = 0 
)
virtual

Creates an osgWidget::Box.

The parameter are for the type, how the box will order the widgets. Types are VERTICAL = 0 and HORIZONTAL = 1 A Box is the most basic window, that contain your widgets

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 681 of file GraphicsWidget.cpp.

◆ createCanvas()

int mars::graphics::GraphicsWidget::createCanvas ( const std::string &  name)
virtual

Creates an osgWidget::Canvas.

In a canvas you can put your widgets where ever you want. This means if you add a widget to the canvas you have to provide the coordinates.

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 655 of file GraphicsWidget.cpp.

◆ createContext()

void mars::graphics::GraphicsWidget::createContext ( void *  parent,
GraphicsWidget shared,
int  width,
int  height 
)
private

Definition at line 802 of file GraphicsWidget.cpp.

◆ createFrame()

int mars::graphics::GraphicsWidget::createFrame ( const std::string &  name,
float  x1,
float  y1,
float  x2,
float  y2 
)
virtual

creates a Frame that basically holds on window.

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 668 of file GraphicsWidget.cpp.

◆ createInput()

int mars::graphics::GraphicsWidget::createInput ( const std::string &  name,
const std::string &  text,
int  count 
)
virtual

nearly like label, but you are able to input thinks into it

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 256 of file GraphicsWidget.cpp.

◆ createLabel()

int mars::graphics::GraphicsWidget::createLabel ( const std::string &  name,
const std::string &  text 
)
virtual

creates a label,a widget with text in it.

Don't forget to set the font color and maybe other imported thinks for you after creation

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 262 of file GraphicsWidget.cpp.

◆ createStyle()

bool mars::graphics::GraphicsWidget::createStyle ( const std::string &  name,
const std::string &  style 
)
virtual

creates style, that you can apply to a widget or window, in order to set a lot of attributes, that are maybe not supported in this api

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 161 of file GraphicsWidget.cpp.

◆ createTable()

int mars::graphics::GraphicsWidget::createTable ( const std::string &  name,
int  row,
int  colums 
)
virtual

An osgWidget::Table provides a basic grid layout.

When adding the widget to the table you have to pass the place in the table as well.

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 661 of file GraphicsWidget.cpp.

◆ createWidget()

int mars::graphics::GraphicsWidget::createWidget ( const std::string &  name,
float  sizex,
float  sizey 
)
virtual

creates a basic widget, within the size you want it to be

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 429 of file GraphicsWidget.cpp.

◆ createWidgetContext()

osg::ref_ptr< osg::GraphicsContext > mars::graphics::GraphicsWidget::createWidgetContext ( void *  parent,
osg::ref_ptr< osg::GraphicsContext::Traits >  traits 
)
privatevirtual

Reimplemented in mars::graphics::QtOsgMixGraphicsWidget.

Definition at line 727 of file GraphicsWidget.cpp.

◆ deleteWidget()

bool mars::graphics::GraphicsWidget::deleteWidget ( int  wdgId)
virtual

deletes one widget and his callbacks

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 217 of file GraphicsWidget.cpp.

◆ deleteWindow()

bool mars::graphics::GraphicsWidget::deleteWindow ( int  wndId)
virtual

deletes your window and all containing widgets

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 233 of file GraphicsWidget.cpp.

◆ getAlignHorizontal()

bool mars::graphics::GraphicsWidget::getAlignHorizontal ( int  id,
int &  h 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 303 of file GraphicsWidget.cpp.

◆ getAlignVertical()

bool mars::graphics::GraphicsWidget::getAlignVertical ( int  id,
int &  v 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 312 of file GraphicsWidget.cpp.

◆ getCameraInterface()

GraphicsCameraInterface * mars::graphics::GraphicsWidget::getCameraInterface ( void  ) const
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1022 of file GraphicsWidget.cpp.

◆ getClearColor()

const mars::utils::Color & mars::graphics::GraphicsWidget::getClearColor ( ) const
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1088 of file GraphicsWidget.cpp.

◆ getGraphicsWindow() [1/2]

osgViewer::GraphicsWindow * mars::graphics::GraphicsWidget::getGraphicsWindow ( )

Definition at line 978 of file GraphicsWidget.cpp.

◆ getGraphicsWindow() [2/2]

const osgViewer::GraphicsWindow * mars::graphics::GraphicsWidget::getGraphicsWindow ( ) const

Definition at line 981 of file GraphicsWidget.cpp.

◆ getID()

unsigned long mars::graphics::GraphicsWidget::getID ( void  )

Definition at line 959 of file GraphicsWidget.cpp.

◆ getImageData() [1/2]

void mars::graphics::GraphicsWidget::getImageData ( char *  buffer,
int &  width,
int &  height 
)
virtual

This function copies the image data in the given buffer.

It assumes that the buffer ist correctly initalized with a char array of the size width * height * 4

Parameters
bufferbuffer in which the image gets copied
widthreturns the width of the image
heightreturns the height of the image

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1101 of file GraphicsWidget.cpp.

◆ getImageData() [2/2]

void mars::graphics::GraphicsWidget::getImageData ( void **  data,
int &  width,
int &  height 
)
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1119 of file GraphicsWidget.cpp.

◆ getLayer()

bool mars::graphics::GraphicsWidget::getLayer ( int  id,
int &  layer 
)
virtual

returns you the current layer

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 322 of file GraphicsWidget.cpp.

◆ getMainCamera()

osg::ref_ptr< osg::Camera > mars::graphics::GraphicsWidget::getMainCamera ( )

Definition at line 985 of file GraphicsWidget.cpp.

◆ getMousePos()

mars::utils::Vector mars::graphics::GraphicsWidget::getMousePos ( )

returns actual mouse position

Definition at line 989 of file GraphicsWidget.cpp.

◆ getName()

virtual const std::string mars::graphics::GraphicsWidget::getName ( ) const
inlinevirtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 132 of file GraphicsWidget.h.

◆ getOrCreateWindowManager()

osgWidget::WindowManager * mars::graphics::GraphicsWidget::getOrCreateWindowManager ( )
virtual

if you want to create your own gui without this interface, feel free to do so

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 688 of file GraphicsWidget.cpp.

◆ getPickedObjects()

std::vector< osg::Node * > mars::graphics::GraphicsWidget::getPickedObjects ( )

Definition at line 1078 of file GraphicsWidget.cpp.

◆ getRTTDepthData() [1/2]

void mars::graphics::GraphicsWidget::getRTTDepthData ( float *  buffer,
int &  width,
int &  height 
)
virtual

This function copies the depth image in the given buffer.

It assumes that the buffer ist correctly initalized with a double array of the size width * height

Parameters
bufferbuffer in which the image gets copied
widthreturns the width of the image
heightreturns the height of the image

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1131 of file GraphicsWidget.cpp.

◆ getRTTDepthData() [2/2]

void mars::graphics::GraphicsWidget::getRTTDepthData ( float **  data,
int &  width,
int &  height 
)
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1159 of file GraphicsWidget.cpp.

◆ getRTTDepthImage()

osg::Image * mars::graphics::GraphicsWidget::getRTTDepthImage ( void  )

Definition at line 1062 of file GraphicsWidget.cpp.

◆ getRTTDepthTexture()

osg::Texture2D * mars::graphics::GraphicsWidget::getRTTDepthTexture ( void  )

Definition at line 1054 of file GraphicsWidget.cpp.

◆ getRTTImage()

osg::Image * mars::graphics::GraphicsWidget::getRTTImage ( void  )

Definition at line 1058 of file GraphicsWidget.cpp.

◆ getRTTTexture()

osg::Texture2D * mars::graphics::GraphicsWidget::getRTTTexture ( void  )

Definition at line 1050 of file GraphicsWidget.cpp.

◆ getScene()

virtual osg::Group* mars::graphics::GraphicsWidget::getScene ( )
inlinevirtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 199 of file GraphicsWidget.h.

◆ getView()

osgViewer::View * mars::graphics::GraphicsWidget::getView ( void  )

Definition at line 963 of file GraphicsWidget.cpp.

◆ getWGeometry()

virtual void mars::graphics::GraphicsWidget::getWGeometry ( int *  top,
int *  left,
int *  width,
int *  height 
) const
inlinevirtual

Reimplemented in mars::graphics::QtOsgMixGraphicsWidget.

Definition at line 78 of file GraphicsWidget.h.

◆ getWidget()

virtual void* mars::graphics::GraphicsWidget::getWidget ( )
inlinevirtual

Reimplemented in mars::graphics::QtOsgMixGraphicsWidget.

Definition at line 114 of file GraphicsWidget.h.

◆ getWidgetById()

osgWidget::Widget * mars::graphics::GraphicsWidget::getWidgetById ( int  wdId)
protected

Definition at line 451 of file GraphicsWidget.cpp.

◆ getWindowById()

osgWidget::Window * mars::graphics::GraphicsWidget::getWindowById ( int  wndId)
protected

Definition at line 459 of file GraphicsWidget.cpp.

◆ grabFocus()

void mars::graphics::GraphicsWidget::grabFocus ( )
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1092 of file GraphicsWidget.cpp.

◆ handle()

bool mars::graphics::GraphicsWidget::handle ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  aa 
)
private

Definition at line 1170 of file GraphicsWidget.cpp.

◆ handleDragEvent()

bool mars::graphics::GraphicsWidget::handleDragEvent ( const osgGA::GUIEventAdapter &  ea)
private

Definition at line 1437 of file GraphicsWidget.cpp.

◆ handleKeyDownEvent()

bool mars::graphics::GraphicsWidget::handleKeyDownEvent ( const osgGA::GUIEventAdapter &  ea)
private

Definition at line 1310 of file GraphicsWidget.cpp.

◆ handleKeyUpEvent()

bool mars::graphics::GraphicsWidget::handleKeyUpEvent ( const osgGA::GUIEventAdapter &  ea)
private

Definition at line 1333 of file GraphicsWidget.cpp.

◆ handleMoveEvent()

bool mars::graphics::GraphicsWidget::handleMoveEvent ( const osgGA::GUIEventAdapter &  ea)
private

Definition at line 1451 of file GraphicsWidget.cpp.

◆ handlePushEvent()

bool mars::graphics::GraphicsWidget::handlePushEvent ( const osgGA::GUIEventAdapter &  ea)
private

Definition at line 1407 of file GraphicsWidget.cpp.

◆ handleReleaseEvent()

bool mars::graphics::GraphicsWidget::handleReleaseEvent ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &  aa 
)
private

Definition at line 1256 of file GraphicsWidget.cpp.

◆ handleResizeEvent()

bool mars::graphics::GraphicsWidget::handleResizeEvent ( const osgGA::GUIEventAdapter &  ea)
private

Definition at line 1247 of file GraphicsWidget.cpp.

◆ handleScrollEvent()

bool mars::graphics::GraphicsWidget::handleScrollEvent ( const osgGA::GUIEventAdapter &  ea)
private

Definition at line 1458 of file GraphicsWidget.cpp.

◆ hideWindow()

bool mars::graphics::GraphicsWidget::hideWindow ( int  wndId)
virtual

removes the window from the windowmanager

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 207 of file GraphicsWidget.cpp.

◆ initialize()

virtual void mars::graphics::GraphicsWidget::initialize ( )
inlineprivatevirtual

Reimplemented in mars::graphics::QtOsgMixGraphicsWidget.

Definition at line 310 of file GraphicsWidget.h.

◆ initializeOSG()

void mars::graphics::GraphicsWidget::initializeOSG ( void *  data = 0,
GraphicsWidget shared = 0,
int  width = 0,
int  height = 0 
)

Definition at line 758 of file GraphicsWidget.cpp.

◆ manageClickEvent()

bool mars::graphics::GraphicsWidget::manageClickEvent ( osgWidget::Event &  event)
protected

Definition at line 553 of file GraphicsWidget.cpp.

◆ pick()

bool mars::graphics::GraphicsWidget::pick ( const double  x,
const double  y 
)
private

Definition at line 1757 of file GraphicsWidget.cpp.

◆ removeHUDElement()

void mars::graphics::GraphicsWidget::removeHUDElement ( HUDElement elem)

Definition at line 1041 of file GraphicsWidget.cpp.

◆ sendKeyDownEvent()

void mars::graphics::GraphicsWidget::sendKeyDownEvent ( const osgGA::GUIEventAdapter &  ea)
private

Definition at line 1501 of file GraphicsWidget.cpp.

◆ sendKeyUpEvent()

void mars::graphics::GraphicsWidget::sendKeyUpEvent ( const osgGA::GUIEventAdapter &  ea)
private

Definition at line 1468 of file GraphicsWidget.cpp.

◆ setAlignHorizontal()

bool mars::graphics::GraphicsWidget::setAlignHorizontal ( int  id,
int  h 
)
virtual

sets the alignment for a widget, use the enums for this

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 286 of file GraphicsWidget.cpp.

◆ setAlignVertical()

bool mars::graphics::GraphicsWidget::setAlignVertical ( int  id,
int  v 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 294 of file GraphicsWidget.cpp.

◆ setAnchorHorizontal()

bool mars::graphics::GraphicsWidget::setAnchorHorizontal ( int  id,
int  ha 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 277 of file GraphicsWidget.cpp.

◆ setAnchorVertical()

bool mars::graphics::GraphicsWidget::setAnchorVertical ( int  id,
int  va 
)
virtual

like alignment but for windows, use also the same enums for this

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 268 of file GraphicsWidget.cpp.

◆ setCanFill()

bool mars::graphics::GraphicsWidget::setCanFill ( int  id,
bool  state 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 494 of file GraphicsWidget.cpp.

◆ setClearColor()

void mars::graphics::GraphicsWidget::setClearColor ( mars::utils::Color  color)
virtual

sets the clear color

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1082 of file GraphicsWidget.cpp.

◆ setColor()

bool mars::graphics::GraphicsWidget::setColor ( int  id,
float  r,
float  g,
float  b,
float  a 
)
virtual

sets the color of a widget or a window

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 435 of file GraphicsWidget.cpp.

◆ setFont()

bool mars::graphics::GraphicsWidget::setFont ( int  id,
const std::string &  fontname 
)
virtual

should be clear what does this mean.

Example: setFont(id,"fonts/arial.ttf"); setFontSize(id,10); setColor(id, 0.8f, 0.8f, 0.8f, 0.6f);

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 125 of file GraphicsWidget.cpp.

◆ setFontColor()

bool mars::graphics::GraphicsWidget::setFontColor ( int  id,
float  r,
float  g,
float  b,
float  a 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 137 of file GraphicsWidget.cpp.

◆ setFontSize()

bool mars::graphics::GraphicsWidget::setFontSize ( int  id,
int  size 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 149 of file GraphicsWidget.cpp.

◆ setFullscreen()

void mars::graphics::GraphicsWidget::setFullscreen ( bool  val,
int  display = 1 
)
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 993 of file GraphicsWidget.cpp.

◆ setGrabFrames()

void mars::graphics::GraphicsWidget::setGrabFrames ( bool  grab)
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1070 of file GraphicsWidget.cpp.

◆ setGraphicsEventHandler()

void mars::graphics::GraphicsWidget::setGraphicsEventHandler ( interfaces::GraphicsEventInterface graphicsEventHandler)

Definition at line 1014 of file GraphicsWidget.cpp.

◆ setHUD()

void mars::graphics::GraphicsWidget::setHUD ( HUD theHUD)

Definition at line 1028 of file GraphicsWidget.cpp.

◆ setHUDViewOffsets()

void mars::graphics::GraphicsWidget::setHUDViewOffsets ( double  x1,
double  y1,
double  x2,
double  y2 
)
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1786 of file GraphicsWidget.cpp.

◆ setImage()

bool mars::graphics::GraphicsWidget::setImage ( int  id,
const std::string &  path 
)
virtual

sets the image of a widget

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 580 of file GraphicsWidget.cpp.

◆ setLabel()

bool mars::graphics::GraphicsWidget::setLabel ( int  id,
const std::string &  text 
)
virtual

sets the text of a lable

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 540 of file GraphicsWidget.cpp.

◆ setLayer()

bool mars::graphics::GraphicsWidget::setLayer ( int  id,
int  layer,
int  offset = 0 
)
virtual

sets the layer of a widget, please use the Layer enum for this

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 331 of file GraphicsWidget.cpp.

◆ setName()

virtual void mars::graphics::GraphicsWidget::setName ( const std::string &  name)
inlinevirtual

Definition at line 128 of file GraphicsWidget.h.

◆ setSaveFrames()

void mars::graphics::GraphicsWidget::setSaveFrames ( bool  grab)
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1074 of file GraphicsWidget.cpp.

◆ setScene()

virtual void mars::graphics::GraphicsWidget::setScene ( osg::Group *  s)
inlinevirtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 202 of file GraphicsWidget.h.

◆ setShadow()

bool mars::graphics::GraphicsWidget::setShadow ( int  id,
float  intensity 
)
virtual

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 502 of file GraphicsWidget.cpp.

◆ setSize()

bool mars::graphics::GraphicsWidget::setSize ( int  id,
float  x,
float  y 
)
virtual

sets the size of a widget

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 172 of file GraphicsWidget.cpp.

◆ setStyle()

bool mars::graphics::GraphicsWidget::setStyle ( int  id,
const std::string &  styleName 
)
virtual

sets a style to a window or widget, that you created before with createStyle

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 189 of file GraphicsWidget.cpp.

◆ setupDistortion()

void mars::graphics::GraphicsWidget::setupDistortion ( double  factor)
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 940 of file GraphicsWidget.cpp.

◆ setWGeometry()

virtual void mars::graphics::GraphicsWidget::setWGeometry ( int  top,
int  left,
int  width,
int  height 
)
inlinevirtual

Reimplemented in mars::graphics::QtOsgMixGraphicsWidget.

Definition at line 77 of file GraphicsWidget.h.

◆ setWidgetFullscreen()

virtual void mars::graphics::GraphicsWidget::setWidgetFullscreen ( bool  val)
inlineprivatevirtual

Reimplemented in mars::graphics::QtOsgMixGraphicsWidget.

Definition at line 334 of file GraphicsWidget.h.

◆ showWidget()

virtual void mars::graphics::GraphicsWidget::showWidget ( )
inlinevirtual

Reimplemented in mars::graphics::QtOsgMixGraphicsWidget.

Definition at line 115 of file GraphicsWidget.h.

◆ showWindow()

bool mars::graphics::GraphicsWidget::showWindow ( int  wndId)
virtual

add the window with the id to the windowmanager

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 478 of file GraphicsWidget.cpp.

◆ switchHudElemtVis()

void mars::graphics::GraphicsWidget::switchHudElemtVis ( int  num_element)
virtual

Implements mars::interfaces::GraphicsWindowInterface.

Definition at line 1045 of file GraphicsWidget.cpp.

◆ translateKey()

void mars::graphics::GraphicsWidget::translateKey ( int &  key,
unsigned int &  mod 
)
private

Definition at line 1534 of file GraphicsWidget.cpp.

◆ unsetFocus()

void mars::graphics::GraphicsWidget::unsetFocus ( )

Definition at line 1097 of file GraphicsWidget.cpp.

◆ updateView()

void mars::graphics::GraphicsWidget::updateView ( void  )
virtual

Reimplemented in mars::graphics::QtOsgMixGraphicsWidget.

Definition at line 967 of file GraphicsWidget.cpp.

◆ windowSetPosition()

bool mars::graphics::GraphicsWidget::windowSetPosition ( int  wndId,
float  x,
float  y 
)
virtual

sets the position of a window on the screen

Implements mars::interfaces::GraphicsGuiInterface.

Definition at line 468 of file GraphicsWidget.cpp.

Member Data Documentation

◆ _osgWidgetIdMap

WidgetIdMapType mars::graphics::GraphicsWidget::_osgWidgetIdMap
protected

Definition at line 233 of file GraphicsWidget.h.

◆ _osgWidgetWindowCnt

unsigned int mars::graphics::GraphicsWidget::_osgWidgetWindowCnt
protected

Definition at line 244 of file GraphicsWidget.h.

◆ _osgWidgetWindowManager

osgWidget::WindowManager* mars::graphics::GraphicsWidget::_osgWidgetWindowManager
protected

Definition at line 226 of file GraphicsWidget.h.

◆ _osgWindowIdMap

WindowIdMapType mars::graphics::GraphicsWidget::_osgWindowIdMap
protected

Definition at line 231 of file GraphicsWidget.h.

◆ _widgetCallBackMap

WidgetCallBackMapType mars::graphics::GraphicsWidget::_widgetCallBackMap
protected

Definition at line 242 of file GraphicsWidget.h.

◆ cameraEyeSeparation

float mars::graphics::GraphicsWidget::cameraEyeSeparation
private

Definition at line 285 of file GraphicsWidget.h.

◆ clearColor

utils::Color mars::graphics::GraphicsWidget::clearColor
private

Definition at line 278 of file GraphicsWidget.h.

◆ gm

GraphicsManager* mars::graphics::GraphicsWidget::gm
protected

Definition at line 268 of file GraphicsWidget.h.

◆ graphicsCamera

GraphicsCamera* mars::graphics::GraphicsWidget::graphicsCamera
protected

Definition at line 257 of file GraphicsWidget.h.

◆ graphicsEventHandler

std::vector<interfaces::GraphicsEventInterface *> mars::graphics::GraphicsWidget::graphicsEventHandler
protected

Definition at line 259 of file GraphicsWidget.h.

◆ graphicsWindow

osg::ref_ptr<osgViewer::GraphicsWindow> mars::graphics::GraphicsWidget::graphicsWindow
protected

Definition at line 255 of file GraphicsWidget.h.

◆ hasFocus

bool mars::graphics::GraphicsWidget::hasFocus
protected

Definition at line 273 of file GraphicsWidget.h.

◆ hudCamera

osg::ref_ptr<osg::Camera> mars::graphics::GraphicsWidget::hudCamera
protected

Definition at line 264 of file GraphicsWidget.h.

◆ isFullscreen

bool mars::graphics::GraphicsWidget::isFullscreen
private

Definition at line 280 of file GraphicsWidget.h.

◆ isHUDShown

bool mars::graphics::GraphicsWidget::isHUDShown
private

Definition at line 288 of file GraphicsWidget.h.

◆ isMouseButtonDown

bool mars::graphics::GraphicsWidget::isMouseButtonDown
private

Definition at line 291 of file GraphicsWidget.h.

◆ isMouseMoving

bool mars::graphics::GraphicsWidget::isMouseMoving
private

Definition at line 291 of file GraphicsWidget.h.

◆ isRTTWidget

bool mars::graphics::GraphicsWidget::isRTTWidget
protected

Definition at line 252 of file GraphicsWidget.h.

◆ isStereoDisplay

bool mars::graphics::GraphicsWidget::isStereoDisplay
private

Definition at line 283 of file GraphicsWidget.h.

◆ mouseMask

int mars::graphics::GraphicsWidget::mouseMask
private

Definition at line 281 of file GraphicsWidget.h.

◆ mouseX

int mars::graphics::GraphicsWidget::mouseX
private

Definition at line 293 of file GraphicsWidget.h.

◆ mouseY

int mars::graphics::GraphicsWidget::mouseY
private

Definition at line 293 of file GraphicsWidget.h.

◆ myHUD

HUD* mars::graphics::GraphicsWidget::myHUD
protected

Definition at line 262 of file GraphicsWidget.h.

◆ name

std::string mars::graphics::GraphicsWidget::name
protected

Definition at line 220 of file GraphicsWidget.h.

◆ pickedObjects

std::vector<osg::Node*> mars::graphics::GraphicsWidget::pickedObjects
private

Definition at line 306 of file GraphicsWidget.h.

◆ pickmode

PickMode mars::graphics::GraphicsWidget::pickmode
private

Definition at line 308 of file GraphicsWidget.h.

◆ postDrawCallback

PostDrawCallback* mars::graphics::GraphicsWidget::postDrawCallback
protected

Definition at line 267 of file GraphicsWidget.h.

◆ rttDepthImage

osg::ref_ptr<osg::Image> mars::graphics::GraphicsWidget::rttDepthImage
private

Definition at line 303 of file GraphicsWidget.h.

◆ rttDepthTexture

osg::ref_ptr<osg::Texture2D> mars::graphics::GraphicsWidget::rttDepthTexture
private

Definition at line 301 of file GraphicsWidget.h.

◆ rttImage

osg::ref_ptr<osg::Image> mars::graphics::GraphicsWidget::rttImage
private

Definition at line 298 of file GraphicsWidget.h.

◆ rttTexture

osg::ref_ptr<osg::Texture2D> mars::graphics::GraphicsWidget::rttTexture
private

Definition at line 296 of file GraphicsWidget.h.

◆ scene

osg::Group* mars::graphics::GraphicsWidget::scene
protected

Definition at line 249 of file GraphicsWidget.h.

◆ view

osg::ref_ptr<osgViewer::View> mars::graphics::GraphicsWidget::view
protected

Definition at line 247 of file GraphicsWidget.h.

◆ widgetHeight

int mars::graphics::GraphicsWidget::widgetHeight
protected

Definition at line 215 of file GraphicsWidget.h.

◆ widgetID

unsigned long mars::graphics::GraphicsWidget::widgetID
protected

Definition at line 271 of file GraphicsWidget.h.

◆ widgetWidth

int mars::graphics::GraphicsWidget::widgetWidth
protected

Definition at line 215 of file GraphicsWidget.h.

◆ widgetX

int mars::graphics::GraphicsWidget::widgetX
protected

Definition at line 215 of file GraphicsWidget.h.

◆ widgetY

int mars::graphics::GraphicsWidget::widgetY
protected

Definition at line 215 of file GraphicsWidget.h.


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