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  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  *****************************************************************************/
00022 
00023 #ifndef GLC_ABSTRACTMANIPULATOR_H_
00024 #define GLC_ABSTRACTMANIPULATOR_H_
00025 
00026 #include "../maths/glc_vector3d.h"
00027 #include "../maths/glc_matrix4x4.h"
00028 #include "../maths/glc_plane.h"
00029 
00030 #include "../glc_config.h"
00031 
00032 class GLC_Viewport;
00033 
00036 
00039 
00040 class GLC_LIB_EXPORT GLC_AbstractManipulator
00041 {
00043 
00045 
00046 public:
00048         GLC_AbstractManipulator(GLC_Viewport* pViewport);
00049 
00051         GLC_AbstractManipulator(const GLC_AbstractManipulator& abstractManipulator);
00052 
00054         virtual ~GLC_AbstractManipulator();
00056 
00058 
00060 
00061 public:
00063         inline bool isInManipulateState() const
00064         {return m_IsInManipulateState;}
00065 
00067         const GLC_Point3d& previousPosition() const
00068         {return m_PreviousPosition;}
00069 
00071         inline GLC_Viewport* viewportHandle() const
00072         {return m_pViewport;}
00073 
00075         virtual GLC_AbstractManipulator* clone() const= 0;
00076 
00078 
00080 
00082 
00083 public:
00085         void enterManipulateState(const GLC_Point3d& startPoint);
00086 
00088         GLC_Matrix4x4 manipulate(const GLC_Point3d& newPoint);
00089 
00091         inline void exitManipulateState()
00092         {m_IsInManipulateState= false;}
00093 
00095         inline void setViewport(GLC_Viewport* pViewport)
00096         {m_pViewport= pViewport;}
00097 
00099 
00101 // Protected services function
00103 protected:
00105         virtual GLC_Matrix4x4 doManipulate(const GLC_Point3d& newPoint, const GLC_Vector3d& projectionDirection)= 0;
00106 
00108 // protected Member
00110 protected:
00112         GLC_Viewport* m_pViewport;
00113 
00115         GLC_Plane m_SliddingPlane;
00116 
00118         GLC_Point3d m_PreviousPosition;
00119 
00121         bool m_IsInManipulateState;
00122 
00123 };
00124 
00125 #endif /* GLC_ABSTRACTMANIPULATOR_H_ */

SourceForge.net Logo

©2005-2011 Laurent Ribon