OpenWalnut 1.2.5

WSelectionManager.h

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