Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WarpPoint.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_WARPPOINT_H_
21 #define OMNI_WARPPOINT_H_
22 
24 #include <QPointF>
25 
26 namespace omni {
27  /**@brief A Warp defines a bezier point with one position and two handles
28  / *@detail Also stores flag if it is selected
29  **/
30  class WarpPoint {
31  public:
32  /// Default constructor
33  WarpPoint();
34 
35  /// Constructor from point
36  WarpPoint(
37  QPointF const& _pos,
38  QPointF const& _c1 = QPointF(0.0, 0.0),
39  QPointF const& _c2 = QPointF(0.0, 0.0));
40 
41  /// Set new position
42  void setPos(QPointF const& _pos);
43 
44  /// Returns reference to position
45  QPointF & pos();
46 
47  /// Returns const reference to position
48  QPointF const& pos() const;
49 
50  /// Return x coordinate of position
51  float x() const;
52 
53  /// Return y coordinate of position
54  float y() const;
55 
56  /// Set first bezier handle
57  void setC1(QPointF const& _c1);
58 
59  /// Returns reference to first bezier handle
60  QPointF & c1();
61 
62  /// Returns const reference to first bezier handle
63  QPointF const& c1() const;
64 
65  /// Set second bezier handle
66  void setC2(QPointF const& _c2);
67 
68  /// Returns reference to second bezier handle
69  QPointF & c2();
70 
71  /// Returns const reference to second bezier handle
72  QPointF const& c2() const;
73 
74  /// Set selection flag
75  void setSelected(bool);
76 
77  /// Return selection flag
78  bool selected() const;
79 
80  /// Test for equality
81  friend bool operator==(WarpPoint const&,
82  WarpPoint const&);
83 
84  /// Write tuning to stream
85  void toStream(QDataStream&) const;
86 
87  /// Read tuning from stream
88  void fromStream(QDataStream&);
89 
90  private:
91  QPointF pos_, c1_, c2_;
92  bool selected_ = false;
93  };
94 }
95 
97 
98 #endif /* OMNI_WARPPOINT_H_ */
float x() const
Return x coordinate of position.
Definition: WarpPoint.cpp:54
QPointF & pos()
Returns reference to position.
Definition: WarpPoint.cpp:44
QPointF & c2()
Returns reference to second bezier handle.
Definition: WarpPoint.cpp:84
void setC1(QPointF const &_c1)
Set first bezier handle.
Definition: WarpPoint.cpp:64
void setSelected(bool)
Set selection flag.
Definition: WarpPoint.cpp:94
void toStream(QDataStream &) const
Write tuning to stream.
Definition: WarpPoint.cpp:104
QPointF c2_
Definition: WarpPoint.h:91
float y() const
Return y coordinate of position.
Definition: WarpPoint.cpp:59
bool selected_
Definition: WarpPoint.h:92
WarpPoint()
Default constructor.
Definition: WarpPoint.cpp:26
#define OMNI_DECL_STREAM_OPERATORS(CLASS)
Definition: Interface.h:53
QPointF pos_
Definition: WarpPoint.h:91
A Warp defines a bezier point with one position and two handles / * Also stores flag if it is selecte...
Definition: WarpPoint.h:30
friend bool operator==(WarpPoint const &, WarpPoint const &)
Test for equality.
Definition: WarpPoint.cpp:126
void setC2(QPointF const &_c2)
Set second bezier handle.
Definition: WarpPoint.cpp:79
QPointF c1_
Definition: WarpPoint.h:91
void setPos(QPointF const &_pos)
Set new position.
Definition: WarpPoint.cpp:39
bool selected() const
Return selection flag.
Definition: WarpPoint.cpp:99
QPointF & c1()
Returns reference to first bezier handle.
Definition: WarpPoint.cpp:69
void fromStream(QDataStream &)
Read tuning from stream.
Definition: WarpPoint.cpp:115