00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef VRS_SG_MOVEFOCUSGROUNDPLATENAVIGATION_H
00021 #define VRS_SG_MOVEFOCUSGROUNDPLATENAVIGATION_H
00022
00023 #include <vrs/sg/groundplatenavigation.h>
00024 #include <vrs/directioninterpolator.h>
00025
00026 namespace VRS {
00027
00030 class VRS_CORE_API MoveFocusGroundPlateNavigation : public GroundPlateNavigation {
00031
00032 public:
00033
00039 enum Mode { PRESERVE_POSITION, PRESERVE_ANGLE };
00040
00042 MoveFocusGroundPlateNavigation(double yValOfGroundPlate = 0.0, Mode mode = PRESERVE_POSITION);
00043
00044 static const MouseButtonFunctionID MoveFocus;
00045
00047 void setMode(Mode mode);
00048 Mode getMode() const;
00049
00052 void setAnimationTime(double minSeconds = 0.25, double maxSeconds = 2.5);
00053 double getMinAnimationTime() const;
00054 double getMaxAnimationTime() const;
00055
00057 virtual void onDragStart(int x, int y, SO<ButtonEvent>, MouseButtonFunctionID id);
00058 virtual void onTimer(SO<TimeEvent> event, double secondsSinceLastTimeEvent);
00059
00060 VRS_TYPEINFO(MoveFocusGroundPlateNavigation, GroundPlateNavigation);
00061
00062 private:
00063 static const double EPSILON;
00064
00065
00066
00067
00068
00069 bool updateFocus(const Vector& from, const Vector& to, SO<Canvas> canvas,
00070 Vector& newFocus);
00071
00072
00073 Vector oldFocus_;
00074 Vector newFocus_;
00075 Vector oldFrom_;
00076 Vector newFrom_;
00077 double minAnimationTime_;
00078 double maxAnimationTime_;
00079 double animationTime_;
00080 double animationTimeElapsed_;
00081 bool animationActive_;
00082 SO<DirectionInterpolator> interpol_;
00083 Mode mode_;
00084 };
00085
00086 }
00087
00088 #endif // VRS_SG_MOVEFOCUSGROUNDPLATENAVIGATION_H