Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TuningFromIndex.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_MIXIN_TUNINGFROMINDEX_H_
21 #define OMNI_UI_MIXIN_TUNINGFROMINDEX_H_
22 
23 #include <omni/Session.h>
25 
26 namespace omni {
27  namespace ui {
28  namespace mixin {
29  template<typename WIDGET>
31  public:
32  TuningFromIndex(WIDGET& _widget) :
33  widget_(_widget) {}
34 
35  int index() const {
36  if (index_ >= 0) return index_;
37 
38  if (!widget_.dataModel()) return -1;
39 
40  return widget_.dataModel()->tunings().currentIndex();
41  }
42 
43  /// Set index of tuning
44  void setIndex(int _index) {
45  index_ = _index;
46  }
47 
48  /// Set index to current index
50  index_ = -1;
51  }
52 
53  /// Return pointer to tuning
55  return widget_.dataModel() ?
56  widget_.dataModel()->tunings()[index()] :
57  nullptr;
58  }
59 
60  /// Return pointer to tuning (const version)
61  omni::proj::Tuning const* tuning() const {
62  return widget_.dataModel() ?
63  widget_.dataModel()->tunings()[index()] :
64  nullptr;
65  }
66 
67  /// Return pointer to blend mask
69  {
70  if (!tuning()) return nullptr;
71 
72  return tuning() ? &tuning()->blendMask() : nullptr;
73  }
74 
75  /// Return pointer to blend mask (const version)
76  omni::BlendMask const* blendMask() const
77  {
78  if (!tuning()) return nullptr;
79 
80  return tuning() ? &tuning()->blendMask() : nullptr;
81  }
82 
83  /// Return pointer to warp grid
85  {
86  if (!tuning()) return nullptr;
87 
88  return tuning() ? &tuning()->warpGrid() : nullptr;
89  }
90 
91  /// Return pointer to warp grid (const version)
92  omni::WarpGrid const* warpGrid() const
93  {
94  if (!tuning()) return nullptr;
95 
96  return tuning() ? &tuning()->warpGrid() : nullptr;
97  }
98 
99  private:
100  int index_ = -1;
101  WIDGET& widget_;
102  };
103  }
104  }
105 }
106 
107 #endif /* OMNI_UI_MIXIN_TUNINGFROMINDEX_H_ */
TuningFromIndex(WIDGET &_widget)
Definition: TuningFromIndex.h:32
WIDGET & widget_
Definition: TuningFromIndex.h:101
int index() const
Definition: TuningFromIndex.h:35
omni::BlendMask const * blendMask() const
Return pointer to blend mask (const version)
Definition: TuningFromIndex.h:76
A projector tuning holds adjustment and distorsion data for a single projector and screen A tuning c...
Definition: Tuning.h:52
omni::WarpGrid const * warpGrid() const
Return pointer to warp grid (const version)
Definition: TuningFromIndex.h:92
omni::BlendMask * blendMask()
Return pointer to blend mask.
Definition: TuningFromIndex.h:68
WarpGrid & warpGrid()
Returns reference to warp grid.
Definition: Tuning.cpp:86
A warp grid is a 2D bezier grid with MxN points Default size 6x6 points. Selected points are also st...
Definition: WarpGrid.h:32
BlendMask & blendMask()
Returns reference to blend mask.
Definition: Tuning.cpp:96
int index_
Definition: TuningFromIndex.h:100
void setIndexToCurrent()
Set index to current index.
Definition: TuningFromIndex.h:49
void setIndex(int _index)
Set index of tuning.
Definition: TuningFromIndex.h:44
Definition: TuningFromIndex.h:30
omni::proj::Tuning const * tuning() const
Return pointer to tuning (const version)
Definition: TuningFromIndex.h:61
A blend mask consists of an edge mask and stroke mask with a brush Edge mask and stroke mask are sto...
Definition: BlendMask.h:35
omni::proj::Tuning * tuning()
Return pointer to tuning.
Definition: TuningFromIndex.h:54
omni::WarpGrid * warpGrid()
Return pointer to warp grid.
Definition: TuningFromIndex.h:84