OpenWalnut
1.4.0
|
00001 //--------------------------------------------------------------------------- 00002 // 00003 // Project: OpenWalnut ( http://www.openwalnut.org ) 00004 // 00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS 00006 // For more information see http://www.openwalnut.org/copying 00007 // 00008 // This file is part of OpenWalnut. 00009 // 00010 // OpenWalnut is free software: you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as published by 00012 // the Free Software Foundation, either version 3 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // OpenWalnut is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public License 00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>. 00022 // 00023 //--------------------------------------------------------------------------- 00024 00025 #ifndef WCREATECOLORARRAYSTHREAD_H 00026 #define WCREATECOLORARRAYSTHREAD_H 00027 00028 #include <vector> 00029 00030 #include "../common/WThreadedRunner.h" 00031 00032 /** 00033 * Thread for computing directional color coding of fibers. 00034 */ 00035 class WCreateColorArraysThread: public WThreadedRunner // NOLINT 00036 { 00037 public: 00038 /** 00039 * default constructor 00040 * 00041 * \param left start position of the first line to comput colors for 00042 * \param right last line for which the color is computed 00043 * \param vertices vertices of all lines 00044 * \param lineLengths line length in vertex array 00045 * \param globalColors where to write global coloring 00046 * \param localColors where to write local coloring 00047 * \param tangents 00048 */ 00049 WCreateColorArraysThread( int left, int right, boost::shared_ptr< std::vector< float > >vertices, 00050 boost::shared_ptr< std::vector< size_t > > lineLengths, 00051 boost::shared_ptr< std::vector< float > > globalColors, 00052 boost::shared_ptr< std::vector< float > > localColors, 00053 boost::shared_ptr< std::vector< float > > tangents ); 00054 00055 /** 00056 * destructor 00057 */ 00058 virtual ~WCreateColorArraysThread(); 00059 00060 /** 00061 * entry for the run command 00062 */ 00063 virtual void threadMain(); 00064 00065 /** 00066 * Return the value of the finished flag. 00067 * 00068 * \return true if finished 00069 */ 00070 inline bool isFinished(); 00071 00072 protected: 00073 private: 00074 bool m_myThreadFinished; //!< Has the thread finished? 00075 00076 int m_left; //!< left boundary 00077 00078 int m_right; //!< right boundary 00079 00080 /** 00081 * Point vector for all fibers 00082 */ 00083 boost::shared_ptr< const std::vector< float > > m_vertices; 00084 00085 /** 00086 * Point vector for tangents at each vertex, used for fake tubes 00087 */ 00088 boost::shared_ptr< std::vector< float > > m_tangents; 00089 00090 /** 00091 * Storing the global color value of the fibers for each point. 00092 */ 00093 boost::shared_ptr< std::vector< float > > m_globalColors; 00094 00095 /** 00096 * Storing the local color value of the fibers for each point. 00097 * \note it is mutable to allow getLocalColors creating it on demand. 00098 */ 00099 boost::shared_ptr< std::vector< float > > m_localColors; 00100 00101 /** 00102 * Line vector that contains the number of vertices for each line 00103 */ 00104 boost::shared_ptr< const std::vector< size_t > > m_lineLengths; 00105 }; 00106 00107 #endif // WCREATECOLORARRAYSTHREAD_H