glc_abstractmanipulator.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  *****************************************************************************/
00024 
00025 #ifndef GLC_ABSTRACTMANIPULATOR_H_
00026 #define GLC_ABSTRACTMANIPULATOR_H_
00027 
00028 #include "../maths/glc_vector3d.h"
00029 #include "../maths/glc_matrix4x4.h"
00030 #include "../maths/glc_plane.h"
00031 
00032 #include "../glc_config.h"
00033 
00034 class GLC_Viewport;
00035 
00038 
00041 
00042 class GLC_LIB_EXPORT GLC_AbstractManipulator
00043 {
00045 
00047 
00048 public:
00050         GLC_AbstractManipulator(GLC_Viewport* pViewport);
00051 
00053         GLC_AbstractManipulator(const GLC_AbstractManipulator& abstractManipulator);
00054 
00056         virtual ~GLC_AbstractManipulator();
00058 
00060 
00062 
00063 public:
00065         inline bool isInManipulateState() const
00066         {return m_IsInManipulateState;}
00067 
00069         const GLC_Point3d& previousPosition() const
00070         {return m_PreviousPosition;}
00071 
00073         inline GLC_Viewport* viewportHandle() const
00074         {return m_pViewport;}
00075 
00077         virtual GLC_AbstractManipulator* clone() const= 0;
00078 
00080 
00082 
00084 
00085 public:
00087         void enterManipulateState(const GLC_Point3d& startPoint);
00088 
00090         GLC_Matrix4x4 manipulate(const GLC_Point3d& newPoint);
00091 
00093         inline void exitManipulateState()
00094         {m_IsInManipulateState= false;}
00095 
00097         inline void setViewport(GLC_Viewport* pViewport)
00098         {m_pViewport= pViewport;}
00099 
00101 
00103 // Protected services function
00105 protected:
00107         virtual GLC_Matrix4x4 doManipulate(const GLC_Point3d& newPoint, const GLC_Vector3d& projectionDirection)= 0;
00108 
00110 // protected Member
00112 protected:
00114         GLC_Viewport* m_pViewport;
00115 
00117         GLC_Plane m_SliddingPlane;
00118 
00120         GLC_Point3d m_PreviousPosition;
00121 
00123         bool m_IsInManipulateState;
00124 
00125 };
00126 
00127 #endif /* GLC_ABSTRACTMANIPULATOR_H_ */

SourceForge.net Logo

©2005 Laurent Ribon