29 #define M_PI_2 1.5707963267948966192E0 36 ViewerWidget::ViewerWidget(QWidget* parent) :
37 QGLViewer(parent), m_zMin(0.0),m_zMax(1.0) {
50 setMouseTracking(
true);
64 float pos[4] = {-1.0, 1.0, 1.0, 0.0};
66 glLightfv(GL_LIGHT0, GL_POSITION, pos);
81 QString
help =
"<h2>Octomap 3D viewer</h2>";
83 help +=
"The Octomap library implements a 3D occupancy grid mapping approach. " 84 "It provides data structures and mapping algorithms. The map is implemented " 85 "using an octree. 3D maps can be viewed an built using this 3D viewer." 87 "Octomap is available at http://octomap.github.com, and is actively " 88 "maintained by Kai M. Wurm and Armin Hornung. This 3D viewer is based on " 89 "libQGLViewer, available at http://www.libqglviewer.com/." 91 "Please refer to the \"Keyboard\" and \"Mouse\" tabs for instructions on " 92 "how to use the viewer.";
99 (*it)->enableHeightColorMode(enabled);
107 (*it)->enablePrintoutMode(enabled);
115 (*it)->enableSemanticColoring(enabled);
158 if(kfi && frame >= 0 && frame < kfi->numberOfKeyFrames()) {
162 std::cerr <<
"Error: Could not jump to frame " << frame <<
" of " << kfi->
numberOfKeyFrames() << std::endl;
168 if(
camera()->keyFrameInterpolator(
id)) {
169 disconnect(
camera()->keyFrameInterpolator(
id), SIGNAL(interpolated()),
this, SLOT(updateGL()));
180 if(!
camera()->keyFrameInterpolator(
id)) {
246 connect(kfi, SIGNAL(interpolated()),
this, SLOT(updateGL()));
254 if(
camera()->keyFrameInterpolator(
id) &&
camera()->keyFrameInterpolator(
id)->interpolationIsStarted()) {
255 disconnect(
camera()->keyFrameInterpolator(
id), SIGNAL(interpolated()),
this, SLOT(updateGL()));
300 for(std::vector<SceneObject*>::iterator it =
m_sceneObjects.begin();
323 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
325 glEnable(GL_LIGHTING);
331 for(std::vector<SceneObject*>::iterator it =
m_sceneObjects.begin();
358 glMatrixMode(GL_MODELVIEW);
364 glPushAttrib(GL_ALL_ATTRIB_BITS);
366 glDisable(GL_COLOR_MATERIAL);
int getGrabbedFrame() const
void startInterpolation(int period=-1)
void setKeyFrameInterpolator(unsigned int i, KeyFrameInterpolator *const kfi)
A keyFrame Catmull-Rom Frame interpolator.
static void drawGrid(qreal size=1.0, int nbSubdivisions=10)
qreal keyFrameTime(int index) const
void setOrientation(const Quaternion &q)
qreal interpolationTime() const
void addKeyFrame(const Frame &frame)
void lookAt(const Vec &target)
void draw(bool withNames=false)
QColor foregroundColor() const
virtual void deletePath(unsigned int i)
void setWheelSensitivity(qreal sensitivity)
void setMouseBinding(unsigned int state, MouseHandler handler, MouseAction action, bool withConstraint=true)
virtual void loadModelViewMatrix(bool reset=true) const
void setPosition(const Vec &pos)
void setGridIsDrawn(bool draw=true)
static void drawAxis(qreal length=1.0)
Vector3 rotate(const Vector3 &v) const
ManipulatedCameraFrame * frame() const
The Vec class represents 3D positions and 3D vectors.
void setManipulatedFrame(qglviewer::ManipulatedFrame *frame)
QColor backgroundColor() const
bool interpolationIsStarted() const
void setAxisIsDrawn(bool draw=true)
KeyFrameInterpolator * keyFrameInterpolator(unsigned int i) const
A versatile 3D OpenGL viewer based on QGLWidget.
void setBackgroundColor(const QColor &color)
The Quaternion class represents 3D rotations and orientations.
void setFromRotatedBasis(const Vec &X, const Vec &Y, const Vec &Z)
Quaternion orientation() const
virtual void addKeyFrameToPath(unsigned int i)
virtual bool restoreStateFromFile()
void setInterpolationTime(qreal time)
The Frame class represents a coordinate system, defined by a position and an orientation.
Frame keyFrame(int index) const
void setUpVector(const Vec &up, bool noMove=true)
void setSceneBoundingBox(const qglviewer::Vec &min, const qglviewer::Vec &max)
int numberOfKeyFrames() const
qglviewer::Camera * camera() const