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_CAMERA_H__
17 #define __MAPS_VIEW_INERTIAL_CAMERA_H__
20 #include "maps_view.h"
25 class inertial_camera {
30 double target_zoom_factor;
31 double target_rotation_angle;
32 maps_coordinates_h target_center;
34 /* Current state of transition (or begining) */
35 double cur_zoom_factor;
36 double cur_rotation_angle;
37 maps_coordinates_h cur_center;
39 /* Is transition performing right now */
42 #if (__cplusplus >= 201103L)
43 static constexpr double __GEO_ACCURACY = 0.00001;
44 static constexpr double __ZOOM_ACCURACY = 0.1;
45 static constexpr double __ROTATE_ACCURACY = 0.5;
47 static const double __GEO_ACCURACY = 0.00001;
48 static const double __ZOOM_ACCURACY = 0.1;
49 static const double __ROTATE_ACCURACY = 0.5;
52 inertial_camera(maps_view_h view);
55 inertial_camera(const inertial_camera &src);
56 inertial_camera &operator=(const inertial_camera &src);
58 void set_targets(const maps_coordinates_h center,
59 const double &zoom_factor,
60 const double &rotation_angle);
61 void set_center_target(const maps_coordinates_h center);
62 void set_zoom_target(const double &zoom_factor);
63 void set_rotation_target(const double &rotation_angle);
65 bool next_transition_step();
67 bool is_transiting() const { return transiting; }
68 void set_transiting(bool b) { transiting = b; }
69 maps_coordinates_h get_cur_center() const { return cur_center; }
70 double get_cur_zoom_factor() const { return cur_zoom_factor; }
71 double get_cur_rotation_angle() const {
72 return cur_rotation_angle; }
75 double calc_next_step(const double &start,
77 const double step_ratio) const;
78 double calc_next_step_lon(const double &start,
80 const double step_ratio) const;
86 #endif /* __MAPS_VIEW_INERTIAL_CAMERA_H__ */