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 WSELECTIONMANAGER_H 00026 #define WSELECTIONMANAGER_H 00027 00028 #include <vector> 00029 00030 #include <boost/shared_ptr.hpp> 00031 00032 #include "../common/WProperties.h" 00033 #include "WCrosshair.h" 00034 00035 00036 template< typename T> 00037 class WGridRegular3DTemplate; 00038 00039 typedef enum 00040 { 00041 PAINTMODE_NONE = 0, 00042 PAINTMODE_PAINT = 1 00043 } 00044 WPaintMode; 00045 00046 /** 00047 * manages the several selection tools 00048 */ 00049 class WSelectionManager // NOLINT 00050 { 00051 public: 00052 /** 00053 * standard constructor 00054 */ 00055 WSelectionManager(); 00056 00057 /** 00058 * destructor 00059 */ 00060 virtual ~WSelectionManager(); 00061 00062 /** 00063 * Return the current position of the point selection 00064 * 00065 * \return the crosshair 00066 */ 00067 boost::shared_ptr< WCrosshair >getCrosshair(); 00068 00069 /** 00070 * function returns an index of the direction one is currently looking at the scene 00071 * 00072 * \return index 00073 */ 00074 int getFrontSector(); 00075 00076 /** 00077 * setter for paint mode, also forwards it to the graphics engine 00078 * 00079 * \param mode 00080 */ 00081 void setPaintMode( WPaintMode mode ); 00082 00083 /** 00084 * getter for paint mode 00085 * 00086 * \return the mode 00087 */ 00088 WPaintMode getPaintMode(); 00089 00090 /** 00091 * setter for texture and grid 00092 * 00093 * \param texture 00094 * \param grid 00095 */ 00096 void setTexture( osg::ref_ptr< osg::Texture3D > texture, boost::shared_ptr< WGridRegular3D >grid ); 00097 00098 /** 00099 * getter 00100 * \return grid 00101 */ 00102 boost::shared_ptr< WGridRegular3D >getGrid(); 00103 00104 /** 00105 * setter 00106 * \param flag 00107 */ 00108 void setUseTexture( bool flag = true ); 00109 00110 /** 00111 * getter 00112 * \return flag 00113 */ 00114 bool getUseTexture(); 00115 00116 /** 00117 * getter 00118 * \return the opacity 00119 */ 00120 float getTextureOpacity(); 00121 00122 /** 00123 * setter 00124 * \param value the new opacity to use with the texture 00125 */ 00126 void setTextureOpacity( float value ); 00127 00128 /** 00129 * The property controlling the current axial position of slices. 00130 * 00131 * \return property as double 00132 */ 00133 WPropDouble getPropAxialPos(); 00134 00135 /** 00136 * The property controlling the current coronal position of slices. 00137 * 00138 * \return property as double 00139 */ 00140 WPropDouble getPropCoronalPos(); 00141 00142 /** 00143 * The property controlling the current sagittal position of slices. 00144 * 00145 * \return property as double 00146 */ 00147 WPropDouble getPropSagittalPos(); 00148 00149 00150 /** 00151 * The property controlling the current axial visible-flag. 00152 * 00153 * \return property as bool 00154 */ 00155 WPropBool getPropAxialShow(); 00156 00157 /** 00158 * The property controlling the current coronal visible-flag. 00159 * 00160 * \return property as bool 00161 */ 00162 WPropBool getPropCoronalShow(); 00163 00164 /** 00165 * The property controlling the current sagittal visible-flag. 00166 * 00167 * \return property as bool 00168 */ 00169 WPropBool getPropSagittalShow(); 00170 00171 /** 00172 * setter for the shader index to be used with the custom texture 00173 * \param shader the index of the shader 00174 */ 00175 void setShader( int shader ); 00176 00177 /** 00178 * getter 00179 * \return shader index 00180 */ 00181 int getShader(); 00182 00183 protected: 00184 private: 00185 /** 00186 * Updates the crosshair position 00187 */ 00188 void updateCrosshairPosition(); 00189 00190 boost::shared_ptr< WCrosshair >m_crosshair; //!< stores pointer to crosshair 00191 00192 /** 00193 * Contains the slice related properties 00194 */ 00195 WProperties::SPtr m_sliceGroup; 00196 00197 /** 00198 * Axial slice position. 00199 */ 00200 WPropDouble m_axialPos; 00201 00202 /** 00203 * Coronal slice position. 00204 */ 00205 WPropDouble m_coronalPos; 00206 00207 /** 00208 * Sagittal slice position. 00209 */ 00210 WPropDouble m_sagittalPos; 00211 00212 /** 00213 * Axial visible-flag. 00214 */ 00215 WPropBool m_axialShow; 00216 00217 /** 00218 * Coronal visible-flag. 00219 */ 00220 WPropBool m_coronalShow; 00221 00222 /** 00223 * Sagittal visible-flag. 00224 */ 00225 WPropBool m_sagittalShow; 00226 00227 /** 00228 * The connection for the axial property 00229 */ 00230 boost::signals2::connection m_axialUpdateConnection; 00231 00232 /** 00233 * The connection for the coronal property 00234 */ 00235 boost::signals2::connection m_coronalUpdateConnection; 00236 00237 /** 00238 * The connection for the sagittal property 00239 */ 00240 boost::signals2::connection m_sagittalUpdateConnection; 00241 00242 WPaintMode m_paintMode; //!< stores the currently selected paint mode 00243 00244 /** 00245 * stores a pointer to a texture 3d, this is used to provide a faster texture generation process 00246 * than creating a new dataset for every texture change 00247 */ 00248 osg::ref_ptr< osg::Texture3D > m_texture; 00249 00250 /** 00251 * stores a pointer to the grid to be used together with the texture 00252 */ 00253 boost::shared_ptr< WGridRegular3D >m_textureGrid; 00254 00255 /** 00256 * the texture opacity 00257 */ 00258 float m_textureOpacity; 00259 00260 /** 00261 * flag indicating if this additional texture should be used. 00262 */ 00263 bool m_useTexture; 00264 00265 /** 00266 * index of the shader to use with the texture 00267 */ 00268 int m_shader; 00269 }; 00270 00271 #endif // WSELECTIONMANAGER_H