00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STELMOVEMENTMGR_HPP_
00021 #define _STELMOVEMENTMGR_HPP_
00022
00023 #include "StelModule.hpp"
00024 #include "StelProjector.hpp"
00025
00028 class StelMovementMgr : public StelModule
00029 {
00030 Q_OBJECT
00031
00032 public:
00033 StelMovementMgr(StelCore* core);
00034 virtual ~StelMovementMgr();
00035
00037
00046 virtual void init();
00047
00049 virtual void update(double deltaTime) {;}
00051 virtual void draw(StelCore* acore) {;}
00053 virtual void handleKeys(QKeyEvent* event);
00055 virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b);
00057 virtual void handleMouseWheel(class QWheelEvent* event);
00059 virtual void handleMouseClicks(class QMouseEvent* event);
00061 virtual void selectedObjectChangeCallBack(StelModuleSelectAction action=StelModule::ReplaceSelection);
00062
00064
00065
00067 void updateMotion(double deltaTime);
00068
00069
00070 bool getHasDragged() const {return hasDragged;}
00071
00073
00074 double getZoomSpeed() {return keyZoomSpeed;}
00075
00076 public slots:
00078 void setFlagTracking(bool b=true);
00080 bool getFlagTracking(void) const {return flagTracking;}
00081
00083 void setFlagLockEquPos(bool b) {flagLockEquPos=b;}
00085 bool getFlagLockEquPos(void) const {return flagLockEquPos;}
00086
00091 void panView(double deltaAz, double deltaAlt);
00092
00095 void setAutoMoveDuration(float f) {autoMoveDuration = f;}
00098 float getAutoMoveDuration(void) const {return autoMoveDuration;}
00099
00101 void setFlagAutoZoomOutResetsDirection(bool b) {flagAutoZoomOutResetsDirection = b;}
00103 bool getFlagAutoZoomOutResetsDirection(void) {return flagAutoZoomOutResetsDirection;}
00104
00106 bool getFlagEnableZoomKeys() const {return flagEnableZoomKeys;}
00108 void setFlagEnableZoomKeys(bool b) {flagEnableZoomKeys=b;}
00109
00111 bool getFlagEnableMoveKeys() const {return flagEnableMoveKeys;}
00113 void setFlagEnableMoveKeys(bool b) {flagEnableMoveKeys=b;}
00114
00116 bool getFlagEnableMoveAtScreenEdge() const {return flagEnableMoveAtScreenEdge;}
00118 void setFlagEnableMoveAtScreenEdge(bool b) {flagEnableMoveAtScreenEdge=b;}
00119
00121 bool getFlagEnableMouseNavigation() const {return flagEnableMouseNavigation;}
00123 void setFlagEnableMouseNavigation(bool b) {flagEnableMouseNavigation=b;}
00124
00131 void moveTo(const Vec3d& aim, float moveDuration = 1., bool localPos = false, int zooming = 0);
00132
00136 void zoomTo(double aimFov, float moveDuration = 1.);
00138 double getCurrentFov() const {return currentFov;}
00139
00141 double getInitFov() const {return initFov;}
00143 void setInitFov(double fov) {initFov=fov;}
00144
00146 void setMaxFov(double max);
00148 double getMaxFov(void) const {return maxFov;}
00149
00151 void autoZoomIn(float moveDuration = 1.f, bool allowManualZoom = 1);
00153 void autoZoomOut(float moveDuration = 1.f, bool full = 0);
00154
00156 double getAimFov(void) const;
00157
00159 void turnRight(bool);
00160 void turnLeft(bool);
00161 void turnUp(bool);
00162 void turnDown(bool);
00163 void moveSlow(bool b) {flagMoveSlow=b;}
00164 void zoomIn(bool);
00165 void zoomOut(bool);
00166
00167 private:
00168 double currentFov;
00169 double initFov;
00170 double minFov;
00171 double maxFov;
00172
00173 void setFov(double f)
00174 {
00175 currentFov = f;
00176 if (f>maxFov)
00177 currentFov = maxFov;
00178 if (f<minFov)
00179 currentFov = minFov;
00180 }
00181 void changeFov(double deltaFov);
00182
00183 void updateVisionVector(double deltaTime);
00184 void updateAutoZoom(double deltaTime);
00185
00187 void dragView(int x1, int y1, int x2, int y2);
00188
00189 StelCore* core;
00190 class StelObjectMgr* objectMgr;
00191 bool flagLockEquPos;
00192 bool flagTracking;
00193
00194
00195 bool isMouseMovingHoriz;
00196 bool isMouseMovingVert;
00197
00198 bool flagEnableMoveAtScreenEdge;
00199 bool flagEnableMouseNavigation;
00200 float mouseZoomSpeed;
00201
00202 bool flagEnableZoomKeys;
00203 bool flagEnableMoveKeys;
00204 float keyMoveSpeed;
00205 float keyZoomSpeed;
00206 bool flagMoveSlow;
00207
00210 struct AutoMove
00211 {
00212 Vec3d start;
00213 Vec3d aim;
00214 float speed;
00215 float coef;
00216 bool localPos;
00217 };
00218
00219 AutoMove move;
00220 int flagAutoMove;
00221 int zoomingMode;
00222
00223 double deltaFov,deltaAlt,deltaAz;
00224
00225 bool flagManualZoom;
00226 float autoMoveDuration;
00227
00228
00229 bool isDragging, hasDragged;
00230 int previousX, previousY;
00231
00234 struct AutoZoom
00235 {
00236 double start;
00237 double aim;
00238 float speed;
00239 float coef;
00240 };
00241
00242
00243 AutoZoom zoomMove;
00244 bool flagAutoZoom;
00245 bool flagAutoZoomOutResetsDirection;
00246 };
00247
00248 #endif // _STELMOVEMENTMGR_HPP_
00249