IvfFlyHandler.h

00001 //
00002 // Copyright 1999-2006 by Structural Mechanics, Lund University.
00003 //
00004 // This library is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Library General Public
00006 // License as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later version.
00008 //
00009 // This library is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // Library General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Library General Public
00015 // License along with this library; if not, write to the Free Software
00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017 // USA.
00018 //
00019 // Please report all bugs and problems to "ivf@byggmek.lth.se".
00020 //
00021 //
00022 // Written by Jonas Lindemann
00023 //
00024 
00025 #ifndef _CIvfFlyHandler_h_
00026 #define _CIvfFlyHandler_h_
00027 
00028 #include <ivf/IvfBase.h>
00029 #include <ivf/IvfCamera.h>
00030 
00031 #include <ivfwidget/IvfWidgetBase.h>
00032 #include <ivfwidget/IvfHandlerBase.h>
00033 
00034 IvfSmartPointer(CIvfFlyHandler);
00035 
00053 class IVFWIDGET_API CIvfFlyHandler : public CIvfHandlerBase,
00054         CIvfKeyboardEvent,
00055         CIvfMouseUpEvent,
00056         CIvfMouseMoveEvent,
00057         CIvfMouseDownEvent
00058 {
00059 private:
00060         void doRedraw();
00061         int m_mouseDownPos[2];
00062         int     m_mouseDelta[2];
00063         double m_mouseSensitivity;
00064         double m_speed;
00065         double m_maxSpeed;
00066         double m_speedStep;
00067         double m_t;
00068         double m_dt;
00069         double m_verticalSpeed;
00070         double m_horisontalSpeed;
00071 
00072         bool m_firstFrame;
00073         bool m_doRedraw;
00074 
00075         CIvfCameraPtr m_camera;
00076         CIvfWidgetBase* m_widget;
00077 public:
00085         CIvfFlyHandler(CIvfWidgetBase* widget, CIvfCamera* camera);
00086         virtual ~CIvfFlyHandler();
00087 
00088         IvfClassInfo("CIvfFlyHandler",CIvfHandlerBase);
00089 
00098         void update();
00099 
00108         void setMouseSensitivity(double value);
00109 
00111         double getMouseSensitivity();
00112 
00120         void setSpeedStep(double step);
00121 
00123         double getSpeedStep();
00124 
00126         void setMaxSpeed(double speed);
00127 
00129         double getMaxSpeed();
00130 
00137         void setRedraw(bool flag);
00138 
00139         virtual void onKeyboard(int key, int x, int y);
00140         virtual void onMouseUp(int x, int y);
00141         virtual void onMouseDown(int x, int y);
00142         virtual void onMouseMove(int x, int y);
00143 
00144         void doKeyboard(int key, int x, int y);
00145         void doMouseUp(int x, int y);
00146         void doMouseMove(int x, int y);
00147         void doMouseDown(int x, int y);
00148 protected:
00149         virtual void doDeactivate();
00150         virtual void doActivate();
00151 };
00160 #endif
00161 

Generated on Fri Sep 1 15:36:47 2006 for Interactive Visualisation Framework - Ivf++ by  doxygen 1.4.6-NO