Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Slots | Signals | Public Member Functions | Private Member Functions | Private Attributes
omni::ui::Rotation Class Reference

Rotation widget has three dials for rotation in X,Y,Z direction. More...

#include <Rotation.h>

Inheritance diagram for omni::ui::Rotation:
Inheritance graph
[legend]
Collaboration diagram for omni::ui::Rotation:
Collaboration graph
[legend]

Public Slots

void setX (double)
 Set value for X angle (roll angle) More...
 
void setY (double)
 Set value for Y angle (pitch angle) More...
 
void setZ (double)
 Set value for Z angle (yaw angle) More...
 
void setRotation (EulerAngles const &)
 Set rotation from euler angles. More...
 

Signals

void xChanged ()
 
void yChanged ()
 
void zChanged ()
 
void rotationChanged ()
 

Public Member Functions

 Rotation (QWidget *=nullptr)
 Construct from optional parent widget. More...
 
 Rotation (double _x, double _y, double _z, QWidget *=nullptr)
 Construct from given x,y,z angle values. More...
 
 ~Rotation ()
 
double x () const
 Return x angle (roll) value as double. More...
 
double y () const
 Return y angle (pitch) value as double. More...
 
double z () const
 Return z angle (yaw) value as double. More...
 
EulerAngles angles () const
 Return x,y,z values as euler angles. More...
 

Private Member Functions

void updateX ()
 
void updateY ()
 
void updateZ ()
 
void init (double, double, double)
 

Private Attributes

Dialx_
 
Dialy_
 
Dialz_
 

Additional Inherited Members

- Protected Member Functions inherited from omni::ui::mixin::Locked
template<typename F >
void locked (F f)
 Lock widget and execute given functor. More...
 
bool isLocked () const
 Return true if widget is locked. More...
 

Detailed Description

Rotation widget has three dials for rotation in X,Y,Z direction.

Constructor & Destructor Documentation

omni::ui::Rotation::Rotation ( QWidget *  _parent = nullptr)

Construct from optional parent widget.

26  :
27  QWidget(_parent)
28  {
29  init(0.0, 0.0, 0.0);
30  }
void init(double, double, double)
Definition: Rotation.cpp:41
omni::ui::Rotation::Rotation ( double  _x,
double  _y,
double  _z,
QWidget *  _parent = nullptr 
)

Construct from given x,y,z angle values.

32  :
33  QWidget(_parent)
34  {
35  init(_x, _y, _z);
36  }
void init(double, double, double)
Definition: Rotation.cpp:41
omni::ui::Rotation::~Rotation ( )
39  {}

Member Function Documentation

EulerAngles omni::ui::Rotation::angles ( ) const

Return x,y,z values as euler angles.

void omni::ui::Rotation::init ( double  _x,
double  _y,
double  _z 
)
private
42  {
43  QLayout *_layout = new QHBoxLayout();
44  auto setupDial = [&](double _value, QChar _letter) -> Dial *
45  {
46  Dial *_d = new Dial(_value, 0.0, 360.0);
47 
48  _d->setRange(0.0, 360.0);
49  _d->setSingleStep(5.0);
50  _d->setPageStep(45.0);
51  _d->setLetter(_letter);
52  _d->setSuffix("°");
53  _layout->addWidget(_d);
54  return _d;
55  };
56 
57  x_ = setupDial(_x, 'X');
58  connect(x_, &Dial::valueChanged, this, &Rotation::updateX);
59 
60  y_ = setupDial(_y, 'Y');
61  connect(y_, &Dial::valueChanged, this, &Rotation::updateY);
62 
63  z_ = setupDial(_z, 'Z');
64  connect(z_, &Dial::valueChanged, this, &Rotation::updateZ);
65 
66  setLayout(_layout);
67  }
void valueChanged()
Dial * y_
Definition: Rotation.h:86
Dial * x_
Definition: Rotation.h:85
void updateY()
Definition: Rotation.cpp:106
Dial * z_
Definition: Rotation.h:87
void updateZ()
Definition: Rotation.cpp:113
void updateX()
Definition: Rotation.cpp:99
void omni::ui::Rotation::rotationChanged ( )
signal
void omni::ui::Rotation::setRotation ( EulerAngles const &  _angles)
slot

Set rotation from euler angles.

120  {
121  this->locked([&]() {
122  x_->setValue(_angles.roll().degrees());
123  y_->setValue(_angles.pitch().degrees());
124  z_->setValue(_angles.yaw().degrees());
125  emit rotationChanged();
126  });
127  }
Dial * y_
Definition: Rotation.h:86
void locked(F f)
Lock widget and execute given functor.
Definition: Locked.h:30
void setValue(int)
Set value from integer.
Definition: Dial.cpp:132
Dial * x_
Definition: Rotation.h:85
Dial * z_
Definition: Rotation.h:87
void omni::ui::Rotation::setX ( double  _x)
slot

Set value for X angle (roll angle)

85  {
86  x_->setValue(_x);
87  }
void setValue(int)
Set value from integer.
Definition: Dial.cpp:132
Dial * x_
Definition: Rotation.h:85
void omni::ui::Rotation::setY ( double  _y)
slot

Set value for Y angle (pitch angle)

90  {
91  y_->setValue(_y);
92  }
Dial * y_
Definition: Rotation.h:86
void setValue(int)
Set value from integer.
Definition: Dial.cpp:132
void omni::ui::Rotation::setZ ( double  _z)
slot

Set value for Z angle (yaw angle)

95  {
96  z_->setValue(_z);
97  }
void setValue(int)
Set value from integer.
Definition: Dial.cpp:132
Dial * z_
Definition: Rotation.h:87
void omni::ui::Rotation::updateX ( )
private
99  {
100  if (!this->isLocked()) {
101  emit xChanged();
102  emit rotationChanged();
103  }
104  }
bool isLocked() const
Return true if widget is locked.
Definition: Locked.h:40
void omni::ui::Rotation::updateY ( )
private
106  {
107  if (!this->isLocked()) {
108  emit yChanged();
109  emit rotationChanged();
110  }
111  }
bool isLocked() const
Return true if widget is locked.
Definition: Locked.h:40
void omni::ui::Rotation::updateZ ( )
private
113  {
114  if (!this->isLocked()) {
115  emit zChanged();
116  emit rotationChanged();
117  }
118  }
bool isLocked() const
Return true if widget is locked.
Definition: Locked.h:40
double omni::ui::Rotation::x ( ) const

Return x angle (roll) value as double.

70  {
71  return x_->value();
72  }
value_type value() const
Return value.
Definition: RangedValue.h:65
Dial * x_
Definition: Rotation.h:85
void omni::ui::Rotation::xChanged ( )
signal
double omni::ui::Rotation::y ( ) const

Return y angle (pitch) value as double.

75  {
76  return y_->value();
77  }
value_type value() const
Return value.
Definition: RangedValue.h:65
Dial * y_
Definition: Rotation.h:86
void omni::ui::Rotation::yChanged ( )
signal
double omni::ui::Rotation::z ( ) const

Return z angle (yaw) value as double.

80  {
81  return z_->value();
82  }
value_type value() const
Return value.
Definition: RangedValue.h:65
Dial * z_
Definition: Rotation.h:87
void omni::ui::Rotation::zChanged ( )
signal

Field Documentation

Dial* omni::ui::Rotation::x_
private
Dial* omni::ui::Rotation::y_
private
Dial* omni::ui::Rotation::z_
private

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