OpenWalnut  1.5.0dev
WMWebglSupport.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 WMWEBGLSUPPORT_H
26 #define WMWEBGLSUPPORT_H
27 
28 #include <memory>
29 #include <string>
30 
31 #include <osg/Geode>
32 
33 #include "core/dataHandler/WDataSetScalar.h"
34 #include "core/dataHandler/WDataSetVector.h"
35 #include "core/graphicsEngine/WTriangleMesh.h"
36 #include "core/kernel/WModule.h"
37 #include "core/kernel/WModuleInputData.h"
38 #include "core/kernel/WModuleOutputData.h"
39 
40 /**
41  * Someone should add some documentation here.
42  * Probably the best person would be the module's
43  * creator, i.e. "ralph".
44  *
45  * This is only an empty template for a new module. For
46  * an example module containing many interesting concepts
47  * and extensive documentation have a look at "src/modules/template"
48  *
49  * \ingroup modules
50  */
51 class WMWebglSupport: public WModule
52 {
53 public:
54  /**
55  * constructor
56  */
58 
59  /**
60  * destructor
61  */
62  virtual ~WMWebglSupport();
63 
64  /**
65  * Gives back the name of this module.
66  * \return the module's name.
67  */
68  virtual const std::string getName() const;
69 
70  /**
71  * Gives back a description of this module.
72  * \return description to module.
73  */
74  virtual const std::string getDescription() const;
75 
76  /**
77  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
78  * should never be initialized or modified in some other way. A simple new instance is required.
79  *
80  * \return the prototype used to create every module in OpenWalnut.
81  */
82  virtual std::shared_ptr< WModule > factory() const;
83 
84  /**
85  * Get the icon for this module in XPM format.
86  * \return The icon.
87  */
88  virtual const char** getXPMIcon() const;
89 
90 protected:
91  /**
92  * Entry point after loading the module. Runs in separate thread.
93  */
94  virtual void moduleMain();
95 
96  /**
97  * Initialize the connectors this module is using.
98  */
99  virtual void connectors();
100 
101  /**
102  * Initialize the properties for this module.
103  */
104  virtual void properties();
105 
106  /**
107  * Initialize requirements for this module.
108  */
109  virtual void requirements();
110 
111 
112 private:
113  /**
114  * colors a connected triangle mesh with the connected gray scale texture
115  */
116  void colorTriMeshGray();
117 
118  /**
119  * colors a connected triangle mesh with the connected rgb texture
120  */
121  void colorTriMeshRGB();
122 
123  /**
124  * saves a connected gray scale 3D texture as set of 2D textures
125  */
126  void saveSlicesGray();
127 
128  /**
129  * saves a connected rgb 3D texture as set of 2D textures
130  */
131  void saveSlicesRGB();
132 
133  std::shared_ptr< WModuleInputData< WDataSetScalar > > m_datasetInputScalar; //!< Input connector required by this module.
134  std::shared_ptr< WModuleInputData< WDataSetVector > > m_datasetInputVector; //!< Input connector required by this module.
135 
136  std::shared_ptr< WModuleInputData< WTriangleMesh > > m_meshInput; //!< Input connector for a mesh
137  std::shared_ptr< WModuleOutputData< WTriangleMesh > > m_meshOutput; //!< Input connector required by this module.
138 
139  std::shared_ptr< WTriangleMesh > m_triMesh; //!< A pointer to the currently processed tri mesh
140  std::shared_ptr< WDataSetScalar > m_datasetScalar; //!< A pointer to the currently processed dataset
141  std::shared_ptr< WDataSetVector > m_datasetVector; //!< A pointer to the currently processed dataset
142 
143  std::shared_ptr< WCondition > m_propCondition; //!< A condition used to notify about changes in several properties.
144 
145  WPropTrigger m_propTriggerSaveGray; //!< This property triggers the actual writing,
146  WPropTrigger m_propTriggerSaveRGB; //!< This property triggers the actual writing,
147  WPropFilename m_fileName; //!< The mesh will be written to this file.
148  WPropFilename m_meshFile; //!< The mesh will be written to this file.
149 
150  WPropTrigger m_propTriggerUpdateOutputGray; //!< This property triggers the actual writing,
151  WPropTrigger m_propTriggerUpdateOutputRGB; //!< This property triggers the actual writing,
152 
153  /**
154  * A list of file type selection types
155  */
156  std::shared_ptr< WItemSelection > m_fileTypeSelectionsList;
157 
158  /**
159  * Selection property for file types
160  */
161  WPropSelection m_fileTypeSelection;
162 };
163 
164 #endif // WMWEBGLSUPPORT_H
Someone should add some documentation here.
std::shared_ptr< WModuleInputData< WTriangleMesh > > m_meshInput
Input connector for a mesh.
WPropTrigger m_propTriggerSaveRGB
This property triggers the actual writing,.
std::shared_ptr< WDataSetScalar > m_datasetScalar
A pointer to the currently processed dataset.
std::shared_ptr< WDataSetVector > m_datasetVector
A pointer to the currently processed dataset.
std::shared_ptr< WModuleInputData< WDataSetScalar > > m_datasetInputScalar
Input connector required by this module.
WPropTrigger m_propTriggerSaveGray
This property triggers the actual writing,.
std::shared_ptr< WCondition > m_propCondition
A condition used to notify about changes in several properties.
virtual void connectors()
Initialize the connectors this module is using.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
virtual void properties()
Initialize the properties for this module.
WPropFilename m_meshFile
The mesh will be written to this file.
void colorTriMeshGray()
colors a connected triangle mesh with the connected gray scale texture
virtual ~WMWebglSupport()
destructor
std::shared_ptr< WTriangleMesh > m_triMesh
A pointer to the currently processed tri mesh.
virtual void moduleMain()
Entry point after loading the module.
std::shared_ptr< WItemSelection > m_fileTypeSelectionsList
A list of file type selection types.
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...
virtual const std::string getDescription() const
Gives back a description of this module.
virtual void requirements()
Initialize requirements for this module.
void saveSlicesRGB()
saves a connected rgb 3D texture as set of 2D textures
WPropTrigger m_propTriggerUpdateOutputGray
This property triggers the actual writing,.
WPropTrigger m_propTriggerUpdateOutputRGB
This property triggers the actual writing,.
std::shared_ptr< WModuleOutputData< WTriangleMesh > > m_meshOutput
Input connector required by this module.
void saveSlicesGray()
saves a connected gray scale 3D texture as set of 2D textures
void colorTriMeshRGB()
colors a connected triangle mesh with the connected rgb texture
WPropSelection m_fileTypeSelection
Selection property for file types.
std::shared_ptr< WModuleInputData< WDataSetVector > > m_datasetInputVector
Input connector required by this module.
virtual const std::string getName() const
Gives back the name of this module.
WPropFilename m_fileName
The mesh will be written to this file.
WMWebglSupport()
constructor
Class representing a single module of OpenWalnut.
Definition: WModule.h:72