2014-04-28 21:09:25 +04:00
|
|
|
#pragma once
|
2009-12-09 17:23:22 +03:00
|
|
|
|
2011-10-01 03:36:30 +04:00
|
|
|
#include "system-gl.h"
|
2009-12-09 17:23:22 +03:00
|
|
|
#include <QGLWidget>
|
|
|
|
#include <QLabel>
|
|
|
|
|
2013-02-21 05:56:30 +04:00
|
|
|
#include <Eigen/Core>
|
|
|
|
#include <Eigen/Geometry>
|
2013-02-24 01:34:06 +04:00
|
|
|
#include "GLView.h"
|
|
|
|
#include "renderer.h"
|
2013-02-21 05:56:30 +04:00
|
|
|
|
2013-02-24 01:34:06 +04:00
|
|
|
class QGLView : public QGLWidget, public GLView
|
2009-12-09 17:23:22 +03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2011-07-30 23:29:40 +04:00
|
|
|
Q_PROPERTY(bool showFaces READ showFaces WRITE setShowFaces);
|
|
|
|
Q_PROPERTY(bool showEdges READ showEdges WRITE setShowEdges);
|
2010-01-15 16:03:42 +03:00
|
|
|
Q_PROPERTY(bool showAxes READ showAxes WRITE setShowAxes);
|
|
|
|
Q_PROPERTY(bool showCrosshairs READ showCrosshairs WRITE setShowCrosshairs);
|
|
|
|
Q_PROPERTY(bool orthoMode READ orthoMode WRITE setOrthoMode);
|
2015-01-02 10:32:37 +03:00
|
|
|
Q_PROPERTY(double showScaleProportional READ showScaleProportional WRITE setShowScaleProportional);
|
2009-12-09 17:23:22 +03:00
|
|
|
|
|
|
|
public:
|
2013-02-21 05:56:30 +04:00
|
|
|
QGLView(QWidget *parent = NULL);
|
|
|
|
QGLView(const QGLFormat & format, QWidget *parent = NULL);
|
2010-01-15 16:03:42 +03:00
|
|
|
#ifdef ENABLE_OPENCSG
|
|
|
|
bool hasOpenCSGSupport() { return this->opencsg_support; }
|
|
|
|
#endif
|
|
|
|
// Properties
|
2011-07-30 23:29:40 +04:00
|
|
|
bool showFaces() const { return this->showfaces; }
|
|
|
|
void setShowFaces(bool enabled) { this->showfaces = enabled; }
|
|
|
|
bool showEdges() const { return this->showedges; }
|
|
|
|
void setShowEdges(bool enabled) { this->showedges = enabled; }
|
2010-01-15 16:03:42 +03:00
|
|
|
bool showAxes() const { return this->showaxes; }
|
|
|
|
void setShowAxes(bool enabled) { this->showaxes = enabled; }
|
|
|
|
bool showCrosshairs() const { return this->showcrosshairs; }
|
|
|
|
void setShowCrosshairs(bool enabled) { this->showcrosshairs = enabled; }
|
2013-03-03 23:48:23 +04:00
|
|
|
bool orthoMode() const { return (this->cam.projection == Camera::ORTHOGONAL); }
|
2014-06-26 23:34:15 +04:00
|
|
|
void setOrthoMode(bool enabled);
|
2015-01-02 10:32:37 +03:00
|
|
|
bool showScaleProportional() const { return this->showscale; }
|
|
|
|
void setShowScaleProportional(bool enabled) { this->showscale = enabled; }
|
2013-02-24 05:19:33 +04:00
|
|
|
std::string getRendererInfo() const;
|
2014-05-31 23:52:08 +04:00
|
|
|
#if QT_VERSION >= 0x050100
|
2014-02-05 09:54:39 +04:00
|
|
|
float getDPI() { return this->devicePixelRatio(); }
|
2014-02-05 10:01:51 +04:00
|
|
|
#endif
|
2015-04-16 18:11:28 +03:00
|
|
|
|
2015-05-13 00:48:17 +03:00
|
|
|
const QImage & grabFrame();
|
2013-02-21 15:49:19 +04:00
|
|
|
bool save(const char *filename);
|
2014-04-11 03:18:08 +04:00
|
|
|
void resetView();
|
2014-06-22 00:12:55 +04:00
|
|
|
void viewAll();
|
2014-04-11 03:18:08 +04:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void ZoomIn(void);
|
|
|
|
void ZoomOut(void);
|
2011-12-09 06:43:06 +04:00
|
|
|
|
2011-07-30 23:29:40 +04:00
|
|
|
public:
|
2010-01-15 16:03:42 +03:00
|
|
|
QLabel *statusLabel;
|
|
|
|
|
|
|
|
private:
|
2010-11-17 09:27:03 +03:00
|
|
|
void init();
|
|
|
|
|
2009-12-09 17:23:22 +03:00
|
|
|
bool mouse_drag_active;
|
2011-05-15 01:29:45 +04:00
|
|
|
QPoint last_mouse;
|
2015-04-16 18:11:28 +03:00
|
|
|
QImage frame; // Used by grabFrame() and save()
|
2009-12-09 17:23:22 +03:00
|
|
|
|
|
|
|
void wheelEvent(QWheelEvent *event);
|
|
|
|
void mousePressEvent(QMouseEvent *event);
|
|
|
|
void mouseMoveEvent(QMouseEvent *event);
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event);
|
2014-07-06 09:38:57 +04:00
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event);
|
2009-12-09 17:23:22 +03:00
|
|
|
|
|
|
|
void initializeGL();
|
|
|
|
void resizeGL(int w, int h);
|
2013-02-21 16:31:18 +04:00
|
|
|
|
2009-12-09 17:23:22 +03:00
|
|
|
void paintGL();
|
2011-05-14 22:57:12 +04:00
|
|
|
void normalizeAngle(GLdouble& angle);
|
2009-12-09 17:23:22 +03:00
|
|
|
|
|
|
|
#ifdef ENABLE_OPENCSG
|
2011-11-28 02:02:38 +04:00
|
|
|
void display_opencsg_warning();
|
2013-02-24 21:21:45 +04:00
|
|
|
private slots:
|
|
|
|
void display_opencsg_warning_dialog();
|
2009-12-09 17:23:22 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void doAnimateUpdate();
|
|
|
|
};
|