OpenWalnut  1.5.0dev
WMScalarOperator.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WMSCALAROPERATOR_H
26 #define WMSCALAROPERATOR_H
27 
28 #include <map>
29 #include <memory>
30 #include <string>
31 #include <vector>
32 
33 #include <osg/Geode>
34 #include <osg/Node>
35 #include <osg/Uniform>
36 
37 #include "core/dataHandler/WDataSetScalar.h"
38 #include "core/kernel/WModule.h"
39 #include "core/kernel/WModuleInputData.h"
40 
41 /**
42  * Operators for processing two WDataSetScalar.
43  *
44  * \ingroup modules
45  */
47 {
48 public:
49  /**
50  * Standard constructor.
51  */
53 
54  /**
55  * Destructor.
56  */
58 
59  /**
60  * Gives back the name of this module.
61  * \return the module's name.
62  */
63  virtual const std::string getName() const;
64 
65  /**
66  * Gives back a description of this module.
67  * \return description of module.
68  */
69  virtual const std::string getDescription() const;
70 
71  /**
72  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
73  * should never be initialized or modified in some other way. A simple new instance is required.
74  *
75  * \return the prototype used to create every module in OpenWalnut.
76  */
77  virtual std::shared_ptr< WModule > factory() const;
78 
79  /**
80  * Get the icon for this module in XPM format.
81  * \return The icon.
82  */
83  virtual const char** getXPMIcon() const;
84 
85 protected:
86  /**
87  * Entry point after loading the module. Runs in separate thread.
88  */
89  virtual void moduleMain();
90 
91  /**
92  * Initialize the connectors this module is using.
93  */
94  virtual void connectors();
95 
96  /**
97  * Initialize the properties for this module.
98  */
99  virtual void properties();
100 
101 private:
102  /**
103  * A condition used to notify about changes in several properties.
104  */
105  std::shared_ptr< WCondition > m_propCondition;
106 
107  /**
108  * A list of operations that are possible
109  */
110  std::shared_ptr< WItemSelection > m_operations;
111 
112  /**
113  * The currently selected operation.
114  */
115  WPropSelection m_opSelection;
116 
117  /**
118  * Lower border used for clamping.
119  */
120  WPropDouble m_lowerBorder;
121 
122  /**
123  * Upper border used for clamping.
124  */
125  WPropDouble m_upperBorder;
126 
127  std::shared_ptr< WModuleInputData< WDataSetScalar > > m_inputA; //!< Input connector required by this module.
128  std::shared_ptr< WModuleInputData< WDataSetScalar > > m_inputB; //!< Input connector required by this module.
129 
130  std::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output; //!< The only output of this filter module.
131 };
132 
133 #endif // WMSCALAROPERATOR_H
134 
Operators for processing two WDataSetScalar.
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
WMScalarOperator()
Standard constructor.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
virtual const std::string getDescription() const
Gives back a description of this module.
std::shared_ptr< WModuleOutputData< WDataSetScalar > > m_output
The only output of this filter module.
virtual const std::string getName() const
Gives back the name of this module.
WPropDouble m_lowerBorder
Lower border used for clamping.
WPropDouble m_upperBorder
Upper border used for clamping.
std::shared_ptr< WItemSelection > m_operations
A list of operations that are possible.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
~WMScalarOperator()
Destructor.
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_inputB
Input connector required by this module.
virtual void properties()
Initialize the properties for this module.
WPropSelection m_opSelection
The currently selected operation.
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_inputA
Input connector required by this module.
virtual void moduleMain()
Entry point after loading the module.
virtual void connectors()
Initialize the connectors this module is using.
Class representing a single module of OpenWalnut.
Definition: WModule.h:72