| VRS - The Virtual Rendering System |
| version 3.3 |
00001 /********************************************************************** 00002 VRS - The Virtual Rendering System 00003 Copyright (C) 2001 Computer Graphics Systems Group at the 00004 Hasso-Plattner-Institute, Potsdam, Germany. 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 This library is distributed in the hope that it will be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 See the GNU Lesser General Public License for more details. 00013 You should have received a copy of the GNU Lesser+ General Public 00014 License along with this library; if not, write to the FreeSoftware 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA, 02111-1307, USA. 00016 **********************************************************************/ 00017 // $Id: planenavigation.h 6014 2007-08-09 07:51:16Z Konstantin_Baumann $ 00018 // $Date: 2007-08-09 09:51:16 +0200 (Thu, 09 Aug 2007) $ 00019 // $Revision: 6014 $ 00020 // $State$ 00021 // $Author: Konstantin_Baumann $ 00022 // 00023 // $Log$ 00024 // Revision 1.13 2005/01/03 01:43:10 klimetschek 00025 // - modified win32 project layout, splitted vrs.vcproj into vrs_container, vrs_core, vrs_sg, vrs_image, vrs_opengl and vrs_io 00026 // - removed vrs.vcproj 00027 // minor things: 00028 // - added all glutexamples to vrs4glut.sln 00029 // - fixed some problems in glutexamples 00030 // - removed all project references from all VS projects (using solution wide project dependencies instead) 00031 // 00032 // Revision 1.12 2004/10/28 14:16:01 basch 00033 // Class comment changed (Doxygen style) 00034 // 00035 // Revision 1.11 2004/07/01 13:18:58 kirsch 00036 // code cleanup 00037 // 00038 // Revision 1.10 2004/03/12 16:28:41 baumann 00039 // macros VRS_NAMESPACE_BEGIN/_END expanded and removed 00040 // 00041 // Revision 1.9 2003/07/06 16:27:29 buchholz 00042 // Regular movements (onTimer() method) will now be executed multiple times or left out according to the current time. In this way, the movement speed does not longer depend on the regularity of time events. 00043 // 00044 // Revision 1.8 2003/07/04 09:51:56 baumgarten 00045 // removed lookAt (it's a member of the base class already) 00046 // constructor has additional parameter launch 00047 // 00048 // Revision 1.7 2003/04/09 15:11:09 buchholz 00049 // some comments added 00050 // 00051 // Revision 1.6 2003/02/24 17:28:23 buchholz 00052 // keys can now be specified by optional constructor parameters 00053 // 00054 // Revision 1.5 2003/02/24 13:22:55 buchholz 00055 // bugfix: added destructor, that sets the static "activeNavigation_" to 0. 00056 // 00057 // Revision 1.4 2003/02/24 12:45:20 buchholz 00058 // - handle return type changed to BehaviorNode::InvalidationHint 00059 // - added: "launch" feature for plane navigation 00060 // - some bugs fixed 00061 // - navigation conflict management (using common base class (navigation.h will follow) 00062 // 00063 // Revision 1.3 2003/02/24 10:05:57 baumann 00064 // changed return type of BehaviorNode::handle() and Manipulator::drag*() 00065 // from "int" to "BehaviorNode::InvalidationHint" 00066 // 00067 // Revision 1.2 2003/02/19 21:24:07 kirsch 00068 // cleaned up includes 00069 // 00070 // Revision 1.1 2003/02/19 15:13:26 buchholz 00071 // some navigation classes 00072 // 00073 00074 00075 #ifndef VRS_SG_PLANENAVIGATION_H 00076 #define VRS_SG_PLANENAVIGATION_H 00077 00078 #include <vrs/sg/navigation.h> 00079 #include <vrs/vector.h> 00080 #include <vrs/sg/manipulator.h> 00081 #include <vrs/sg/keyevent.h> 00082 #include <vrs/sg/inputevent.h> 00083 00084 namespace VRS { 00085 00086 class DirectionInterpolator; 00087 class KeyEvent; 00088 class LookAt; 00089 class TimeEvent; 00090 00095 class VRS_CORE_API PlaneNavigation : public Navigation { 00096 00097 public: 00098 00099 PlaneNavigation(const Vector& onPlane, const double& minHeight, 00100 LookAt* target, 00101 InputEvent::Button button, 00102 InputEvent::Modifier must_modifier = InputEvent::NoModifier, 00103 InputEvent::Modifier must_not_modifier = InputEvent::NoModifier, 00104 unsigned long launchKey = 'l', unsigned long storeKey = 's', bool launch = false); 00112 void setNavMode(Navigation::NavMode mode); 00113 00114 void setSensitivity(double sensitivity); 00115 double getSensitivity() const; 00116 //<! Control the mouse sensitivity. The sensitivity parameter is expected to be positive. 00117 00118 void setScaling(double horizontal, double vertical); 00119 double getHorizontalScaling() const; 00120 double getVerticalScaling() const; 00129 virtual BehaviorNode::InvalidationHint dragStart(int x, int y, ButtonEvent*); 00130 virtual BehaviorNode::InvalidationHint dragMotion(int x, int y, MotionEvent*); 00131 virtual BehaviorNode::InvalidationHint dragEnd(int x, int y, ButtonEvent*); 00132 virtual BehaviorNode::InvalidationHint handle(Event*); 00134 00135 VRS_TYPEINFO(PlaneNavigation, Manipulator); 00136 00137 private: 00138 00139 BehaviorNode::InvalidationHint onTimer(TimeEvent* e); 00140 BehaviorNode::InvalidationHint onKey(KeyEvent* e); 00141 double getHeight() const; 00142 void launch(); 00143 00144 double sensitivity_; 00145 00146 Vector onPlane_; 00147 double minHeight_; 00148 double height_; 00149 00150 double lrSpeed_; 00151 double fbSpeed_; 00152 double maxSpeed_; 00153 double acceleration_; 00154 00155 int lastX_; 00156 int lastY_; 00157 double dx_; 00158 double dy_; 00159 double factor_; 00160 00161 bool movingX_; 00162 bool movingY_; 00163 00164 unsigned long launchKey_; 00165 unsigned long heightStoreKey_; 00166 double upDownSpeed_; 00167 double upDownAcceleration_; 00168 double targetHeight_; 00169 bool launching_; 00170 SO<DirectionInterpolator> interpol_; 00171 double rotationProgress_; 00172 double rotationTime_; 00173 00174 double horScaling_; 00175 double vertScaling_; 00176 00177 TransactionNo m_lastTransactionNo; 00178 00179 unsigned long lastTimeEvent_; 00180 }; 00181 00182 } // namespace VRS 00183 00184 #endif // VRS_SG_PLANENAVIGATION_H 00185