1 /* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef __MAPS_VIEW_INERTIAL_GESTURE_H__
17 #define __MAPS_VIEW_INERTIAL_GESTURE_H__
20 #include "gesture_detector.h"
25 class inertial_gesture : public gesture_detector {
28 touch_point _down[MAX_FINGERS];
29 touch_point _last[MAX_FINGERS];
30 touch_point _prev[MAX_FINGERS];
31 touch_point _inertial_start[MAX_FINGERS];
32 double _cur_x[MAX_FINGERS];
33 double _cur_y[MAX_FINGERS];
34 double _derivative_x[MAX_FINGERS];
35 double _derivative_y[MAX_FINGERS];
37 bool transiting_part[MAX_FINGERS];
38 bool transiting_trajectory;
39 unsigned transiting_start[MAX_FINGERS];
40 double _dt[MAX_FINGERS];
42 #if (__cplusplus >= 201103L)
43 static constexpr double __ACCURACY = 1;
45 static const double __ACCURACY = 1;
48 inertial_gesture(maps_view_h view);
51 inertial_gesture(const inertial_gesture &src);
52 inertial_gesture &operator=(const inertial_gesture &src);
54 virtual void tap(int finger_no, const touch_point &tp);
55 virtual void move(int finger_no, const touch_point &tp);
56 virtual void up(int finger_no, const touch_point &tp);
58 bool is_transiting() const { return transiting; }
59 void set_transiting(bool b) { transiting = b; }
60 bool next_transition_step();
62 //static void on_idle(void *data);
64 double get_next_point(const double &start,
65 const double &derivative,
67 double get_next_derivative(const double &derivative,
69 static unsigned int get_cur_time();
70 unsigned int get_transition_time(int finger_no) const;
72 void update_inertial_start_point(int finger_no);
77 #endif /* __MAPS_VIEW_INERTIAL_GESTURE_H__ */