g2o
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
g2o::G2oQGLViewer Class Reference

OpenGL based viewer for the graph. More...

#include <g2o_qglviewer.h>

Inheritance diagram for g2o::G2oQGLViewer:
Inheritance graph
[legend]
Collaboration diagram for g2o::G2oQGLViewer:
Collaboration graph
[legend]

Public Member Functions

 G2oQGLViewer (QWidget *parent=NULL, const QGLWidget *shareWidget=0)
 
 G2oQGLViewer (const G2oQGLViewer &)=delete
 
G2oQGLVieweroperator= (const G2oQGLViewer &)=delete
 
 ~G2oQGLViewer ()
 
void draw ()
 
void init ()
 
bool updateDisplay () const
 
void setUpdateDisplay (bool updateDisplay)
 
DrawAction::Parametersparameters ()
 

Public Attributes

SparseOptimizergraph
 

Protected Attributes

HyperGraphElementAction_drawActions
 
GLuint _drawList
 
bool _updateDisplay
 
DrawAction::Parameters_drawActionParameters
 

Detailed Description

OpenGL based viewer for the graph.

Definition at line 33 of file g2o_qglviewer.h.

Constructor & Destructor Documentation

◆ G2oQGLViewer() [1/2]

g2o::G2oQGLViewer::G2oQGLViewer ( QWidget *  parent = NULL,
const QGLWidget *  shareWidget = 0 
)

Definition at line 88 of file g2o_qglviewer.cpp.

89 : QGLViewer(parent, shareWidget),
90 graph(0),
91 _drawActions(0),
92 _drawList(0),
93 _updateDisplay(true) {
94 setAxisIsDrawn(false);
95 _drawActionParameters = new DrawAction::Parameters();
96}
SparseOptimizer * graph
HyperGraphElementAction * _drawActions
DrawAction::Parameters * _drawActionParameters

References _drawActionParameters.

◆ G2oQGLViewer() [2/2]

g2o::G2oQGLViewer::G2oQGLViewer ( const G2oQGLViewer )
delete

◆ ~G2oQGLViewer()

g2o::G2oQGLViewer::~G2oQGLViewer ( )

Definition at line 98 of file g2o_qglviewer.cpp.

98 {
100 glDeleteLists(_drawList, 1);
101}

References _drawActionParameters, and _drawList.

Member Function Documentation

◆ draw()

void g2o::G2oQGLViewer::draw ( )

Definition at line 103 of file g2o_qglviewer.cpp.

103 {
104 if (!graph) return;
105
106 if (_drawActions == 0) {
108 assert(_drawActions);
109 }
110
111 if (!_drawActions) // avoid segmentation fault in release build
112 return;
113 if (_updateDisplay) {
114 _updateDisplay = false;
115 glNewList(_drawList, GL_COMPILE_AND_EXECUTE);
117 glEndList();
118 } else {
119 glCallList(_drawList);
120 }
121}
static HyperGraphActionLibrary * instance()
return the single instance of the HyperGraphActionLibrary
HyperGraphElementAction * actionByName(const std::string &name)
void applyAction(HyperGraph *graph, HyperGraphElementAction *action, HyperGraphElementAction::Parameters *params, const std::string &typeName)

References _drawActionParameters, _drawActions, _drawList, _updateDisplay, g2o::HyperGraphActionLibrary::actionByName(), g2o::applyAction(), graph, and g2o::HyperGraphActionLibrary::instance().

◆ init()

void g2o::G2oQGLViewer::init ( )

Definition at line 123 of file g2o_qglviewer.cpp.

123 {
124 QGLViewer::init();
125 // glDisable(GL_LIGHT0);
126 // glDisable(GL_LIGHTING);
127
128 setBackgroundColor(QColor::fromRgb(51, 51, 51));
129
130 // some default settings i like
131 glEnable(GL_LINE_SMOOTH);
132 glEnable(GL_BLEND);
133 glEnable(GL_DEPTH_TEST);
134 glEnable(GL_NORMALIZE);
135 // glEnable(GL_CULL_FACE);
136 glShadeModel(GL_FLAT);
137 // glShadeModel(GL_SMOOTH);
138 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
139
140 setAxisIsDrawn();
141
142 // don't save state
143 setStateFileName(QString());
144
145 // mouse bindings
146#ifdef QGLVIEWER_DEPRECATED_MOUSEBINDING
147 setMouseBinding(Qt::NoModifier, Qt::RightButton, CAMERA, TRANSLATE);
148 setMouseBinding(Qt::NoModifier, Qt::MiddleButton, CAMERA, TRANSLATE);
149#else
150 setMouseBinding(Qt::RightButton, CAMERA, TRANSLATE);
151 setMouseBinding(Qt::MidButton, CAMERA, TRANSLATE);
152#endif
153
154 // keyboard shortcuts
155 setShortcut(CAMERA_MODE, 0);
156 setShortcut(EXIT_VIEWER, 0);
157 // setShortcut(SAVE_SCREENSHOT, 0);
158
159 // replace camera
160 qglviewer::Camera* oldcam = camera();
161 qglviewer::Camera* cam = new StandardCamera();
162 setCamera(cam);
163 cam->setPosition(qglviewer::Vec(0., 0., 75.));
164 cam->setUpVector(qglviewer::Vec(0., 1., 0.));
165 cam->lookAt(qglviewer::Vec(0., 0., 0.));
166 delete oldcam;
167
168 // getting a display list
169 _drawList = glGenLists(1);
170}

References _drawList.

◆ operator=()

G2oQGLViewer & g2o::G2oQGLViewer::operator= ( const G2oQGLViewer )
delete

◆ parameters()

DrawAction::Parameters * g2o::G2oQGLViewer::parameters ( )
inline

Definition at line 50 of file g2o_qglviewer.h.

50{ return _drawActionParameters; }

Referenced by ViewerPropertiesWidget::setViewer().

◆ setUpdateDisplay()

void g2o::G2oQGLViewer::setUpdateDisplay ( bool  updateDisplay)

◆ updateDisplay()

bool g2o::G2oQGLViewer::updateDisplay ( ) const
inline

the viewer uses a display list to cache the drawing, use setUpdateDisplay() to force the creation of an updated display list.

Definition at line 47 of file g2o_qglviewer.h.

47{ return _updateDisplay; }

Referenced by setUpdateDisplay().

Member Data Documentation

◆ _drawActionParameters

DrawAction::Parameters* g2o::G2oQGLViewer::_drawActionParameters
protected

Definition at line 59 of file g2o_qglviewer.h.

Referenced by draw(), G2oQGLViewer(), and ~G2oQGLViewer().

◆ _drawActions

HyperGraphElementAction* g2o::G2oQGLViewer::_drawActions
protected

Definition at line 56 of file g2o_qglviewer.h.

Referenced by draw().

◆ _drawList

GLuint g2o::G2oQGLViewer::_drawList
protected

Definition at line 57 of file g2o_qglviewer.h.

Referenced by draw(), init(), and ~G2oQGLViewer().

◆ _updateDisplay

bool g2o::G2oQGLViewer::_updateDisplay
protected

Definition at line 58 of file g2o_qglviewer.h.

Referenced by draw(), and setUpdateDisplay().

◆ graph

SparseOptimizer* g2o::G2oQGLViewer::graph

Definition at line 53 of file g2o_qglviewer.h.

Referenced by draw().


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