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  Version 2.0.0 Beta 1, packaged on April 2010.
00006 
00007  http://glc-lib.sourceforge.net
00008 
00009  GLC-lib is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  GLC-lib is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with GLC-lib; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023  *****************************************************************************/
00025 
00026 #ifndef GLC_CUTTINGPLANE_H_
00027 #define GLC_CUTTINGPLANE_H_
00028 
00029 #include "glc_3dwidget.h"
00030 #include "../glc_config.h"
00031 
00032 class GLC_AbstractManipulator;
00033 
00036 
00039 
00040 class GLC_LIB_EXPORT GLC_CuttingPlane : public GLC_3DWidget
00041 {
00042         enum Manipulator
00043         {
00044                 TranslationManipulator,
00045                 RotationManipulator
00046         };
00047         Q_OBJECT
00049 
00051 
00052 public:
00054         GLC_CuttingPlane(const GLC_Point3d& center, const GLC_Vector3d& normal, double l1, double l2, GLC_3DWidgetManagerHandle*  pWidgetManagerHandle= NULL);
00055 
00057         GLC_CuttingPlane(const GLC_CuttingPlane& cuttingPlane);
00058 
00060         virtual ~GLC_CuttingPlane();
00062 
00064 
00066 
00067 public:
00069         inline GLC_Point3d center() const
00070         {return m_Center;}
00071 
00073         inline GLC_Vector3d normal() const
00074         {return m_Normal;}
00075 
00077         inline QColor color() const
00078         {return m_Color;}
00079 
00081         inline double opacity() const
00082         {return m_Opacity;}
00083 
00085 
00087 
00089 
00090 public:
00092         virtual GLC_CuttingPlane& operator=(const GLC_CuttingPlane& cuttingPlane);
00093 
00095         void updateLength(double l1, double l2);
00096 
00098         inline void setColor(const QColor& color)
00099         {m_Color= color;}
00100 
00102         inline void setOpacity(double opacity)
00103         {m_Opacity= opacity;}
00104 
00106         virtual void updateWidgetRep();
00107 
00109 
00111 
00113 
00114 public:
00115 
00117         virtual glc::WidgetEventFlag select(const GLC_Point3d&, GLC_uint id);
00118 
00120         virtual glc::WidgetEventFlag unselect(const GLC_Point3d&, GLC_uint id);
00121 
00123         virtual glc::WidgetEventFlag mousePressed(const GLC_Point3d&, Qt::MouseButton, GLC_uint id);
00124 
00126         virtual glc::WidgetEventFlag mouseReleased(Qt::MouseButton);
00127 
00129         virtual glc::WidgetEventFlag mouseMove(const GLC_Point3d&, Qt::MouseButtons, GLC_uint id);
00130 
00132 
00134 // Protected services function
00136 protected:
00138         virtual void create3DviewInstance();
00139 
00140 
00142 // Private services function
00144 private:
00146         void moveManipulatorRep(const GLC_Point3d& pos);
00147 
00149         GLC_AbstractManipulator* rotationNavigator(int index);
00150 
00152 // Private Member
00154 private:
00156         GLC_Point3d m_Center;
00157 
00159         GLC_Vector3d m_Normal;
00160 
00162         GLC_Matrix4x4 m_CompMatrix;
00163 
00165         double m_L1, m_L2;
00166 
00168         QColor m_Color;
00169 
00171         double m_Opacity;
00172 
00174         double m_ManipulatorOffsetFactor;
00175 
00177         double m_ScaleFactor;
00178 
00180         int m_SelectionIndex;
00181 
00183         Manipulator m_CurrentManipulator;
00184 
00186         GLC_AbstractManipulator* m_pCurrentManipulator;
00187 
00189         GLC_Point3d m_CurrentNavigatorPosition;
00190 
00191 
00192 };
00193 
00194 #endif /* GLC_CUTTINGPLANE_H_ */

SourceForge.net Logo

©2005 Laurent Ribon