Mantid
Loading...
Searching...
No Matches
MantidGLWidget.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2009 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//-----------------------------------------
10// Includes
11//-----------------------------------------
12#include <QGLWidget>
13#include <memory>
14
15#include "MantidKernel/V3D.h"
16
17//-----------------------------------------
18// Forward Declarations
19//-----------------------------------------
20namespace Mantid {
21namespace Geometry {
22class IObject;
23}
24} // namespace Mantid
25
26namespace MantidQt {
27namespace CustomDialogs {
28
36class MantidGLWidget : public QGLWidget {
37
38 Q_OBJECT
39
40public:
42 MantidGLWidget(QWidget *parent = nullptr);
44 ~MantidGLWidget() override;
45
47 void setDisplayObject(std::shared_ptr<Mantid::Geometry::IObject> object);
48
49protected:
51 void initializeGL() override;
53 void resizeGL(int width, int height) override;
55 void paintGL() override;
56
57private:
59 void setXRotation(int angle);
61 void setYRotation(int angle);
63 void setZRotation(int angle);
65 void setOrthoProjectionMatrix(GLdouble aspect_ratio);
66
67private:
69 void normalizeAngle(int *angle);
71 void mousePressEvent(QMouseEvent *event) override;
73 void mouseMoveEvent(QMouseEvent *event) override;
75 std::shared_ptr<Mantid::Geometry::IObject> m_display_object;
83 GLdouble m_bb_widths[3];
85 GLdouble m_bb_centres[3];
86};
87} // namespace CustomDialogs
88} // namespace MantidQt
double height
Definition: GetAllEi.cpp:155
This class provides a widget to display a Mantid Geometry object using OpenGL.
void setYRotation(int angle)
Set the rotation angle around the Y-axis.
GLdouble m_bb_centres[3]
The centre of the bounding box.
void paintGL() override
Render the scene.
void resizeGL(int width, int height) override
Set up the viewport.
GLdouble m_x_rot
The current X, Y and Z rotations.
QPoint m_click_point
The location of the cursor when the mouse button was clicked.
void initializeGL() override
Initialize the renderer.
void setXRotation(int angle)
Set the rotation angle around the X-axis.
void mouseMoveEvent(QMouseEvent *event) override
Handle a MouseMoveEvent.
GLdouble m_scale_factor
The scaling factor to use.
void setOrthoProjectionMatrix(GLdouble aspect_ratio)
Calculate and set the orthographic projection matrix.
void setZRotation(int angle)
Set the rotation angle around the Z-axis.
void setDisplayObject(std::shared_ptr< Mantid::Geometry::IObject > object)
Set the Mantid geometry object.
GLdouble m_bb_widths[3]
The separation of the bounding box sides in x,y,z respectively.
void mousePressEvent(QMouseEvent *event) override
Handle a MousePressEvent.
std::shared_ptr< Mantid::Geometry::IObject > m_display_object
A Mantid geometry object.
void normalizeAngle(int *angle)
Ensure the angle is in the range 0 < angle < 360.
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
Helper class which provides the Collimation Length for SANS instruments.