OpenWalnut  1.5.0dev
WMReadLAS.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 WMREADLAS_H
26 #define WMREADLAS_H
27 
28 #include <memory>
29 #include <string>
30 #include <vector>
31 
32 #include "core/dataHandler/WDataSetPoints.h"
33 #include "core/kernel/WDataModule.h"
34 #include "core/kernel/WModuleOutputData.h"
35 
36 /**
37  * This module loads LAS files (point data).
38  *
39  * \ingroup modules
40  */
41 class WMReadLAS: public WDataModule
42 {
43 public:
44  /**
45  * Default constructor.
46  */
47  WMReadLAS();
48 
49  /**
50  * Destructor.
51  */
52  virtual ~WMReadLAS();
53 
54  /**
55  * Gives back the name of this module.
56  * \return the module's name.
57  */
58  virtual const std::string getName() const;
59 
60  /**
61  * Gives back a description of this module.
62  * \return description to module.
63  */
64  virtual const std::string getDescription() const;
65 
66  /**
67  * Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
68  * should never be initialized or modified in some other way. A simple new instance is required.
69  *
70  * \return the prototype used to create every module in OpenWalnut.
71  */
72  virtual std::shared_ptr< WModule > factory() const;
73 
74  /**
75  * Define a list of file filters we support.
76  *
77  * \return the list of filters
78  */
79  virtual std::vector< WDataModuleInputFilter::ConstSPtr > getInputFilter() const;
80 protected:
81  /**
82  * Entry point after loading the module. Runs in separate thread.
83  */
84  virtual void moduleMain();
85 
86  /**
87  * Initialize the connectors this module is using.
88  */
89  virtual void connectors();
90 
91  /**
92  * Initialize the properties for this module.
93  */
94  virtual void properties();
95 
96  /**
97  * Load data.
98  */
99  virtual void load();
100 
101  /**
102  * Handle a newly set input. Implement this method to load the newly set input. You can get the input using the \ref getInput and \ref getInputAs
103  * methods. Please remember that it is possible to get a NULL pointer here.
104  * This happens when the user explicitly sets no input. In this case, you should clean up and reset your output connectors.
105  *
106  * \note it is very important to NOT load the data inside of this method. It is usually called in the GUI thread. This would block the whole GUI.
107  * Instead, use this method for firing a condition, which then wakes your module thread.
108  */
109  virtual void handleInputChange();
110 private:
111  /**
112  * The output connector for the filtered data.
113  */
114  std::shared_ptr< WModuleOutputData< WDataSetPoints > > m_output;
115 
116  /**
117  * True if the load function needs to be called. Usually set by handleInputChange or the reload trigger
118  */
119  bool m_reload;
120 };
121 
122 #endif // WMREADLAS_H
Base for all data loader modules.
Definition: WDataModule.h:47
This module loads LAS files (point data).
Definition: WMReadLAS.h:42
virtual void handleInputChange()
Handle a newly set input.
Definition: WMReadLAS.cpp:122
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...
Definition: WMReadLAS.cpp:56
virtual void moduleMain()
Entry point after loading the module.
Definition: WMReadLAS.cpp:86
virtual void properties()
Initialize the properties for this module.
Definition: WMReadLAS.cpp:81
virtual const std::string getName() const
Gives back the name of this module.
Definition: WMReadLAS.cpp:61
virtual const std::string getDescription() const
Gives back a description of this module.
Definition: WMReadLAS.cpp:67
std::shared_ptr< WModuleOutputData< WDataSetPoints > > m_output
The output connector for the filtered data.
Definition: WMReadLAS.h:114
bool m_reload
True if the load function needs to be called.
Definition: WMReadLAS.h:119
WMReadLAS()
Default constructor.
Definition: WMReadLAS.cpp:44
virtual ~WMReadLAS()
Destructor.
Definition: WMReadLAS.cpp:51
virtual void connectors()
Initialize the connectors this module is using.
Definition: WMReadLAS.cpp:73
virtual void load()
Load data.
Definition: WMReadLAS.cpp:129
virtual std::vector< WDataModuleInputFilter::ConstSPtr > getInputFilter() const
Define a list of file filters we support.
Definition: WMReadLAS.cpp:112