Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AffineTransform.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OMNI_UI_AFFINETRANSFORM_H_
21 #define OMNI_UI_AFFINETRANSFORM_H_
22 
23 #include <memory>
24 #include <QWidget>
26 #include <omni/ui/RangedFloat.h>
27 #include <omni/ui/mixin/Scale.h>
29 
30 namespace omni {
31  namespace ui {
32  namespace Ui {
33  class AffineTransform;
34  }
35 
36  /// A widget for editing an affine transformation
38  public QWidget,
39  public mixin::UnsharedDataModel<omni::AffineTransform>,
40  private mixin::Scale<RangedFloat>{
41  Q_OBJECT
42  OMNI_UI_UNSHARED_DATAMODEL(omni::AffineTransform)
43 
45  public:
46  AffineTransform(QWidget * = nullptr);
47  ~AffineTransform();
48 
49  /// Return true if translation sliders are visible
50  bool isTranslationVisible() const;
51 
52  /// Return true if rotation widget is visible
53  bool isRotationVisible() const;
54 
55  /// Return true if scale sliders are visible
56  bool isScaleVisible() const;
57 
58  /// Return value of scale range (5.0 by default)
59  float scaleRange() const;
60 
61  public slots:
62  /// Set visibility of translation sliders
63  void setTranslationVisible(bool);
64 
65  /// Set visibility of rotation widget
66  void setRotationVisible(bool);
67 
68  /// Set visibility of scale sliders
69  void setScaleVisible(bool);
70 
71  /// Set new value for scale range (5.0 by default)
72  void setScaleRange(float);
73 
74  /// Set unit suffix for offset
75  void setOffsetUnit(QString const& _unit);
76 
77  /// Set scale of ranges for offsets
78  void setOffsetRangeScale(float);
79 
80  /// Set value if offset values are rescaled
81  void setRescaleOffsetValues(bool);
82 
83  signals:
84  void dataModelChanged();
85 
86  private:
87  /// Setup widget
88  void setup();
89 
90  /// Update sliders from current transform
91  void dataToFrontend();
92 
93  /// Assign slider values to current transform
94  bool frontendToData();
95 
96  float scaleRange_ = 5.0;
97  std::unique_ptr<Ui::AffineTransform> ui_;
98  };
99  }
100 }
101 
102 #endif /* OMNI_UI_AFFINETRANSFORM_H_ */
void setTranslationVisible(bool)
Set visibility of translation sliders.
Definition: AffineTransform.cpp:51
bool isScaleVisible() const
Return true if scale sliders are visible.
Definition: AffineTransform.cpp:43
void setup()
Setup widget.
Definition: AffineTransform.cpp:163
void setScaleRange(float)
Set new value for scale range (5.0 by default)
Definition: AffineTransform.cpp:70
void dataToFrontend()
Update sliders from current transform.
Definition: AffineTransform.cpp:100
void setRotationVisible(bool)
Set visibility of rotation widget.
Definition: AffineTransform.cpp:58
std::unique_ptr< Ui::AffineTransform > ui_
Definition: AffineTransform.h:97
A widget for editing an affine transformation.
Definition: AffineTransform.h:37
bool isTranslationVisible() const
Return true if translation sliders are visible.
Definition: AffineTransform.cpp:35
void setScaleVisible(bool)
Set visibility of scale sliders.
Definition: AffineTransform.cpp:63
A slider with float value within a minimum and maximum.
Definition: RangedFloat.h:30
bool frontendToData()
Assign slider values to current transform.
Definition: AffineTransform.cpp:138
#define OMNI_UI_UNSHARED_DATAMODEL(MODEL)
Definition: DataModel.h:219
Holds a specific data model with frontend update mechanism.
Definition: DataModel.h:87
Scales a set of sliders and sets a common unit suffix.
Definition: Scale.h:30
float scaleRange() const
Return value of scale range (5.0 by default)
Definition: AffineTransform.cpp:47
void setOffsetRangeScale(float)
Set scale of ranges for offsets.
Definition: AffineTransform.cpp:89
void setRescaleOffsetValues(bool)
Set value if offset values are rescaled.
Definition: AffineTransform.cpp:96
bool isRotationVisible() const
Return true if rotation widget is visible.
Definition: AffineTransform.cpp:39
void setOffsetUnit(QString const &_unit)
Set unit suffix for offset.
Definition: AffineTransform.cpp:84
float scaleRange_
Definition: AffineTransform.h:96