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"
24 class inertial_gesture : public gesture_detector {
27 touch_point _down[MAX_FINGERS];
28 touch_point _last[MAX_FINGERS];
29 touch_point _prev[MAX_FINGERS];
30 touch_point _inertial_start[MAX_FINGERS];
31 double _cur_x[MAX_FINGERS];
32 double _cur_y[MAX_FINGERS];
33 double _derivative_x[MAX_FINGERS];
34 double _derivative_y[MAX_FINGERS];
36 bool transiting_part[MAX_FINGERS];
37 bool transiting_trajectory;
38 unsigned transiting_start[MAX_FINGERS];
39 double _dt[MAX_FINGERS];
41 #if (__cplusplus >= 201103L)
42 static constexpr double __ACCURACY = 1;
44 static const double __ACCURACY = 1;
47 inertial_gesture(maps_view_h view);
50 inertial_gesture(const inertial_gesture &src);
51 inertial_gesture &operator=(const inertial_gesture &src);
53 virtual void tap(int finger_no, const touch_point &tp);
54 virtual void move(int finger_no, const touch_point &tp);
55 virtual void up(int finger_no, const touch_point &tp);
57 bool is_transiting() const { return transiting; }
58 void set_transiting(bool b) { transiting = b; }
59 bool next_transition_step();
61 //static void on_idle(void *data);
63 double get_next_point(const double &start,
64 const double &derivative,
66 double get_next_derivative(const double &derivative,
68 static unsigned int get_cur_time();
69 unsigned int get_transition_time(int finger_no) const;
71 void update_inertial_start_point(int finger_no);
75 #endif /* __MAPS_VIEW_INERTIAL_GESTURE_H__ */