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"
24 class inertial_camera {
29 double target_zoom_factor;
30 double target_rotation_angle;
31 maps_coordinates_h target_center;
33 /* Current state of transition (or begining) */
34 double cur_zoom_factor;
35 double cur_rotation_angle;
36 maps_coordinates_h cur_center;
38 /* Is transition performing right now */
41 #if (__cplusplus >= 201103L)
42 static constexpr double __GEO_ACCURACY = 0.00001;
43 static constexpr double __ZOOM_ACCURACY = 0.1;
44 static constexpr double __ROTATE_ACCURACY = 0.5;
46 static const double __GEO_ACCURACY = 0.00001;
47 static const double __ZOOM_ACCURACY = 0.1;
48 static const double __ROTATE_ACCURACY = 0.5;
51 inertial_camera(maps_view_h view);
54 inertial_camera(const inertial_camera &src);
55 inertial_camera &operator=(const inertial_camera &src);
57 void set_targets(const maps_coordinates_h center,
58 const double &zoom_factor,
59 const double &rotation_angle);
60 void set_center_target(const maps_coordinates_h center);
61 void set_zoom_target(const double &zoom_factor);
62 void set_rotation_target(const double &rotation_angle);
64 bool next_transition_step();
66 bool is_transiting() const { return transiting; }
67 void set_transiting(bool b) { transiting = b; }
68 maps_coordinates_h get_cur_center() const { return cur_center; }
69 double get_cur_zoom_factor() const { return cur_zoom_factor; }
70 double get_cur_rotation_angle() const {
71 return cur_rotation_angle; }
74 double calc_next_step(const double &start,
76 const double step_ratio) const;
77 double calc_next_step_lon(const double &start,
79 const double step_ratio) const;
84 #endif /* __MAPS_VIEW_INERTIAL_CAMERA_H__ */