glc_cuttingplane.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 3 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_CUTTINGPLANE_H_
00025 #define GLC_CUTTINGPLANE_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_CuttingPlane : public GLC_3DWidget
00039 {
00040         enum Manipulator
00041         {
00042                 TranslationManipulator,
00043                 RotationManipulator
00044         };
00046 
00048 
00049 public:
00051         GLC_CuttingPlane(const GLC_Point3d& center, const GLC_Vector3d& normal, double l1, double l2, GLC_3DWidgetManagerHandle*  pWidgetManagerHandle= NULL);
00052 
00054         GLC_CuttingPlane(const GLC_CuttingPlane& cuttingPlane);
00055 
00057         virtual ~GLC_CuttingPlane();
00059 
00061 
00063 
00064 public:
00066         inline GLC_Point3d center() const
00067         {return m_Center;}
00068 
00070         inline GLC_Vector3d normal() const
00071         {return m_Normal;}
00072 
00074         inline QColor color() const
00075         {return m_Color;}
00076 
00078         inline double opacity() const
00079         {return m_Opacity;}
00080 
00082 
00084 
00086 
00087 public:
00089         virtual GLC_CuttingPlane& operator=(const GLC_CuttingPlane& cuttingPlane);
00090 
00092         void updateLength(double l1, double l2);
00093 
00095         inline void setColor(const QColor& color)
00096         {m_Color= color;}
00097 
00099         inline void setOpacity(double opacity)
00100         {m_Opacity= opacity;}
00101 
00103         virtual void updateWidgetRep();
00104 
00106 
00108 
00110 
00111 public:
00112 
00114         virtual glc::WidgetEventFlag select(const GLC_Point3d&, GLC_uint id);
00115 
00117         virtual glc::WidgetEventFlag unselect(const GLC_Point3d&, GLC_uint id);
00118 
00120         virtual glc::WidgetEventFlag mousePressed(const GLC_Point3d&, Qt::MouseButton, GLC_uint id);
00121 
00123         virtual glc::WidgetEventFlag mouseReleased(Qt::MouseButton);
00124 
00126         virtual glc::WidgetEventFlag mouseMove(const GLC_Point3d&, Qt::MouseButtons, GLC_uint id);
00127 
00129 
00131 // Protected services function
00133 protected:
00135         virtual void create3DviewInstance();
00136 
00138         virtual void resetViewState();
00139 
00141 // Private services function
00143 private:
00145         void moveManipulatorRep(const GLC_Point3d& pos);
00146 
00148         GLC_AbstractManipulator* rotationNavigator(int index);
00149 
00151 // Private Member
00153 private:
00155         GLC_Point3d m_Center;
00156 
00158         GLC_Vector3d m_Normal;
00159 
00161         GLC_Matrix4x4 m_CompMatrix;
00162 
00164         double m_L1, m_L2;
00165 
00167         QColor m_Color;
00168 
00170         double m_Opacity;
00171 
00173         double m_ManipulatorOffsetFactor;
00174 
00176         double m_ScaleFactor;
00177 
00179         int m_SelectionIndex;
00180 
00182         Manipulator m_CurrentManipulator;
00183 
00185         GLC_AbstractManipulator* m_pCurrentManipulator;
00186 
00188         GLC_Point3d m_CurrentNavigatorPosition;
00189 
00190 
00191 };
00192 
00193 #endif /* GLC_CUTTINGPLANE_H_ */

SourceForge.net Logo

©2005-2011 Laurent Ribon