Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Interface.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 
21 #ifndef OMNI_PATCH_INTERFACE_H_
22 #define OMNI_PATCH_INTERFACE_H_
23 
24 #include <vector>
25 #include <omni/visual/Interface.h>
27 #include <omni/input/Interface.h>
28 #include <omni/patch/PatchHandle.h>
29 
30 namespace omni {
31  namespace patch {
32  class Interface :
33  public visual::Interface,
35  public TypeIdInterface {
36  public:
37  virtual ~Interface() {}
38 
39  /**@brief Get handles under cursor (const version).
40  @detail Position is normalized [0,0] - [1,1].
41  **/
42  inline std::vector<PatchHandle const*> getHandles(QPointF const& _p) const {
43  std::vector<PatchHandle*> _handles = const_cast<Interface*>(this)->getHandles(_p);
44  std::vector<PatchHandle const*> _result;
45  for (auto& _handle : _handles) {
46  _result.push_back(_handle);
47  }
48  return _result;
49  }
50 
51  /**@brief Get handles under cursor.
52  @detail Position is normalized [0,0] - [1,1].
53  **/
54  virtual std::vector<PatchHandle*> getHandles(QPointF const&) = 0;
55 
56  /// Return pointer to widget
57  virtual inline QWidget* widget() { return nullptr; }
58 
59  virtual input::Interface* input() const = 0;
60 
61  virtual void assignInput(input::Interface*) = 0;
62  virtual void removeInput() = 0;
63 
64  inline virtual bool canHaveInput() const { return false; }
65  };
66 
67  /// Patch Factory typedef
69  }
70 
73 }
74 
75 #define OMNI_PATCH_INTERFACE_IID "org.omnidome.patch.Interface"
76 
78 
79 #define OMNI_PATCH_PLUGIN_DECL \
80  Q_OBJECT \
81  Q_PLUGIN_METADATA(IID OMNI_PATCH_INTERFACE_IID) \
82  Q_INTERFACES(omni::patch::Interface) \
83  OMNI_PLUGIN_TYPE("Patch")
84 
85 
86 #endif /* OMNI_PATCH_INTERFACE_H_ */
virtual void removeInput()=0
std::vector< PatchHandle const * > getHandles(QPointF const &_p) const
Get handles under cursor (const version). Position is normalized [0,0] - [1,1].
Definition: Interface.h:42
virtual void assignInput(input::Interface *)=0
Abstract interface for serialization Holds two member functions for serialization and deserializatio...
Definition: Interface.h:31
virtual input::Interface * input() const =0
patch::Factory PatchFactory
Definition: Interface.h:72
Basic visual interface.
Definition: Interface.h:28
patch::Interface Patch
Definition: Interface.h:71
Generic input interface.
Definition: Interface.h:53
AbstractFactory< Interface > Factory
Patch Factory typedef.
Definition: Interface.h:68
Definition: Interface.h:32
#define OMNI_PATCH_INTERFACE_IID
Definition: Interface.h:75
virtual QWidget * widget()
Return pointer to widget.
Definition: Interface.h:57
virtual ~Interface()
Definition: Interface.h:37
Abstract Interface with a single virtual member function which returns.
Definition: TypeIdInterface.h:28
virtual bool canHaveInput() const
Definition: Interface.h:64
The central factory class.
Definition: factory.hpp:38