glc_axis.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  http://glc-lib.sourceforge.net
00006 
00007  GLC-lib is free software; you can redistribute it and/or modify
00008  it under the terms of the GNU Lesser General Public License as published by
00009  the Free Software Foundation; either version 2.1 of the License, or
00010  (at your option) any later version.
00011 
00012  GLC-lib is distributed in the hope that it will be useful,
00013  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  GNU Lesser General Public License for more details.
00016 
00017  You should have received a copy of the GNU Lesser General Public License
00018  along with GLC-lib; if not, write to the Free Software
00019  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020 
00021  *****************************************************************************/
00023 
00024 #ifndef GLC_AXIS_H_
00025 #define GLC_AXIS_H_
00026 
00027 #include "glc_3dwidget.h"
00028 #include "../glc_config.h"
00029 
00030 class GLC_AbstractManipulator;
00031 
00034 
00037 
00038 class GLC_LIB_EXPORT GLC_Axis : public GLC_3DWidget
00039 {
00040         enum Manipulator
00041         {
00042                 NoneManipulator,
00043                 X_AxisManipulator,
00044                 Y_AxisManipulator,
00045                 Z_AxisManipulator
00046         };
00047 
00049 
00051 
00052 public:
00054         GLC_Axis(const GLC_Point3d& center, GLC_3DWidgetManagerHandle*  pWidgetManagerHandle= NULL);
00055 
00057         GLC_Axis(const GLC_Axis& axis);
00058 
00060         virtual ~GLC_Axis();
00062 
00064 
00066 
00067 public:
00069         inline GLC_Point3d center() const
00070         {return m_Center;}
00071 
00073         inline double axisLength() const
00074         {return m_AxisLength;}
00076 
00078 
00080 
00081 public:
00083         virtual GLC_Axis& operator=(const GLC_Axis& axis);
00084 
00086         virtual void updateWidgetRep();
00087 
00089         void setAxisLength(double length);
00090 
00092         void setCenter(const GLC_Point3d& newCenter);
00093 
00095 
00097 
00099 
00100 public:
00101 
00103         virtual glc::WidgetEventFlag select(const GLC_Point3d&, GLC_uint id);
00104 
00106         virtual glc::WidgetEventFlag unselect(const GLC_Point3d&, GLC_uint id);
00107 
00109         virtual glc::WidgetEventFlag mousePressed(const GLC_Point3d&, Qt::MouseButton, GLC_uint id);
00110 
00112         virtual glc::WidgetEventFlag mouseReleased(Qt::MouseButton);
00113 
00115         virtual glc::WidgetEventFlag mouseMove(const GLC_Point3d&, Qt::MouseButtons, GLC_uint id);
00116 
00118 
00120 // Protected services function
00122 protected:
00124         virtual void create3DviewInstance();
00125 
00127         virtual void resetViewState();
00128 
00130 // Private services function
00132 private:
00134         void moveManipulatorRep(const GLC_Point3d& pos);
00135 
00137 // Private Member
00139 private:
00141         GLC_Point3d m_Center;
00142 
00144         double m_ScaleFactor;
00145 
00147         Manipulator m_CurrentManipulator;
00148 
00150         GLC_AbstractManipulator* m_pCurrentManipulator;
00151 
00153         double m_AxisLength;
00154 
00156         double m_AxisRadiusRatio;
00157 
00158 };
00159 
00160 #endif /* GLC_AXIS_H_ */

SourceForge.net Logo

©2005-2011 Laurent Ribon