Add LCOV remarkers to increase line coverage rate
[platform/core/api/maps-service.git] / src / view / inertial_camera.h
1 /* Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
2  *
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
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
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.
14  */
15
16 #ifndef __MAPS_VIEW_INERTIAL_CAMERA_H__
17 #define __MAPS_VIEW_INERTIAL_CAMERA_H__
18
19
20 #include "maps_view.h"
21
22 //LCOV_EXCL_START
23 namespace view
24 {
25         class inertial_camera {
26         protected:
27                 maps_view_h _view;
28
29                 /* Targets */
30                 double target_zoom_factor;
31                 double target_rotation_angle;
32                 maps_coordinates_h target_center;
33
34                 /* Current state of transition (or begining) */
35                 double cur_zoom_factor;
36                 double cur_rotation_angle;
37                 maps_coordinates_h cur_center;
38
39                 /* Is transition performing right now */
40                 bool transiting;
41         protected:
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;
46 #else
47                 static const double __GEO_ACCURACY = 0.00001;
48                 static const double __ZOOM_ACCURACY = 0.1;
49                 static const double __ROTATE_ACCURACY = 0.5;
50 #endif
51         public:
52                 inertial_camera(maps_view_h view);
53                 ~inertial_camera();
54         private:
55                 inertial_camera(const inertial_camera &src);
56                 inertial_camera &operator=(const inertial_camera &src);
57         public:
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);
64
65                 bool next_transition_step();
66
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; }
73
74         protected:
75                 double calc_next_step(const double &start,
76                                      const double &finish,
77                                      const double step_ratio) const;
78                 double calc_next_step_lon(const double &start,
79                                      const double &finish,
80                                      const double step_ratio) const;
81                 void set_cur_state();
82         };
83 };
84 //LCOV_EXCL_STOP
85
86 #endif /* __MAPS_VIEW_INERTIAL_CAMERA_H__ */