OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
WCreateColorArraysThread.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 WCREATECOLORARRAYSTHREAD_H
26 #define WCREATECOLORARRAYSTHREAD_H
27 
28 #include <vector>
29 
30 #include "../common/WThreadedRunner.h"
31 #include "WExportDataHandler.h"
32 
33 /**
34  * implements a thread that updates the fiber selection bit field
35  */
37 {
38 public:
39  /**
40  * default constructor
41  *
42  * \param left
43  * \param right
44  * \param vertices
45  * \param lineStartIndexes
46  * \param lineLengths
47  * \param globalColors
48  * \param localColors
49  * \param tangents
50  */
51  WCreateColorArraysThread( int left, int right, boost::shared_ptr< std::vector< float > >vertices,
52  boost::shared_ptr< std::vector< size_t > > lineStartIndexes,
53  boost::shared_ptr< std::vector< size_t > > lineLengths,
54  boost::shared_ptr< std::vector< float > > globalColors,
55  boost::shared_ptr< std::vector< float > > localColors,
56  boost::shared_ptr< std::vector< float > > tangents );
57 
58  /**
59  * destructor
60  */
61  virtual ~WCreateColorArraysThread();
62 
63  /**
64  * entry for the run command
65  */
66  virtual void threadMain();
67 
68  /**
69  * Return the value of the finished flag.
70  *
71  * \return true if finished
72  */
73  inline bool isFinished();
74 
75 protected:
76 private:
77 
78  bool m_myThreadFinished; //!< Has the thread finished?
79 
80  int m_left; //!< left boundary
81 
82  int m_right; //!< right boundary
83 
84  /**
85  * Point vector for all fibers
86  */
87  boost::shared_ptr< std::vector< float > > m_vertices;
88 
89  /**
90  * Point vector for tangents at each vertex, used for fake tubes
91  */
92  boost::shared_ptr< std::vector< float > > m_tangents;
93 
94  /**
95  * Storing the global color value of the fibers for each point.
96  */
97  boost::shared_ptr< std::vector< float > > m_globalColors;
98 
99  /**
100  * Storing the local color value of the fibers for each point.
101  * \note it is mutable to allow getLocalColors creating it on demand.
102  */
103  mutable boost::shared_ptr< std::vector< float > > m_localColors;
104 
105  /**
106  * Line vector that contains the start index of its first point for each line.
107  * \warning The index returned cannot be used in the vertices array until
108  * the number of components for each point is multiplied.
109  */
110  boost::shared_ptr< std::vector< size_t > > m_lineStartIndexes;
111 
112  /**
113  * Line vector that contains the number of vertices for each line
114  */
115  boost::shared_ptr< std::vector< size_t > > m_lineLengths;
116 };
117 
118 #endif // WCREATECOLORARRAYSTHREAD_H