1 /* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "runtime_data.h"
19 #include "maps_util.h"
20 #include "maps_view_plugin.h"
23 view::touch_point::touch_point()
31 view::touch_point::~touch_point()
35 view::touch_point::touch_point(const int x,
37 const unsigned int ts)
44 view::touch_point::touch_point(const touch_point &src)
52 view::touch_point &view::touch_point::operator=(const touch_point &src)
57 _timestamp = src._timestamp;
62 void view::touch_point::reset()
69 bool view::touch_point::empty() const
79 /* ---------------------------------------------------------------------------*/
82 view::map_state::map_state()
86 , _prev_zoom_factor(.1)
87 , _prev_rotation_angle(.0)
92 view::map_state::~map_state()
95 maps_coordinates_destroy(_center);
99 view::map_state::map_state(const map_state &src)
102 , _rotation_angle(.0)
103 , _prev_zoom_factor(.1)
104 , _prev_rotation_angle(.0)
109 view::map_state &view::map_state::operator=(const map_state &src)
113 maps_coordinates_clone(src._center, &_center);
114 _zoom_factor = src._zoom_factor;
115 _rotation_angle = src._rotation_angle;
116 _prev_zoom_factor = src._prev_zoom_factor;
117 _prev_rotation_angle = src._prev_rotation_angle;
122 void view::map_state::reset()
125 maps_coordinates_destroy(_center);
129 _rotation_angle = .0;
130 _prev_zoom_factor = .1;
131 _prev_rotation_angle = .0;
134 MAPS_LOGI("%c[%d;%d;%dm"
135 "central coordinates: RESET"
142 void view::map_state::capture(maps_view_h view)
149 maps_view_get_center(view, &_center);
150 maps_view_get_zoom_factor(view, &_zoom_factor);
151 maps_view_get_orientation(view, &_rotation_angle);
152 _prev_zoom_factor = _zoom_factor;
153 _prev_rotation_angle = _rotation_angle;
156 maps_coordinates_h central_coords = NULL;
157 maps_view_get_center(view, ¢ral_coords);
158 double lat = .0, lon = .0;
159 maps_coordinates_get_latitude_longitude(central_coords, &lat, &lon);
160 maps_coordinates_destroy(central_coords);
161 MAPS_LOGI("%c[%d;%d;%dm"
162 "central coordinates: (%f, %f)"
169 void view::map_state::trace()
171 double latitude = .0;
172 double longitude = .0;
173 maps_coordinates_get_latitude_longitude(_center, &latitude, &longitude);
175 MAPS_LOGI("%c[%d;%d;%dm"
176 "Map State: center(%f,%f), zoom(%f), angle(%f)"
179 latitude, longitude, _zoom_factor, _rotation_angle,
182 /* ---------------------------------------------------------------------------*/
184 view::runtime_touch_info::runtime_touch_info()
185 : _fingers_pressed(0)
186 , _cur_gesture(MAPS_VIEW_GESTURE_NONE)
192 view::runtime_touch_info::~runtime_touch_info()
196 view::runtime_touch_info::runtime_touch_info(const runtime_touch_info &src)
201 view::runtime_touch_info &view::runtime_touch_info::operator=(const
206 _fingers_pressed = src._fingers_pressed;
207 _cur_gesture = src._cur_gesture;
208 /*_going = src._going;*/
209 _start_view_state = src._start_view_state;
211 for(unsigned int i = 0; i < MAX_FINGERS; i ++) {
212 _finger_down[i] = src._finger_down[i];
213 _finger_move[i] = src._finger_move[i];
214 _prev_finger_down[i] = src._prev_finger_down[i];
215 _finger_up[i] = src._finger_up[i];
216 _is_finger_pressed[i] = src._is_finger_pressed[i];
222 void view::runtime_touch_info::reset()
226 _fingers_pressed = 0;
228 for(unsigned int i = 0; i < MAX_FINGERS; i ++) {
229 _finger_down[i].reset();
230 _finger_move[i].reset();
231 _prev_finger_down[i].reset();
232 _finger_up[i].reset();
233 _is_finger_pressed[i] = false;
236 _cur_gesture = MAPS_VIEW_GESTURE_NONE;
238 _start_view_state.reset();
241 int view::runtime_touch_info::calc_finger_pressed()
244 for(unsigned int i = 0; i < MAX_FINGERS; i ++)
245 if(_is_finger_pressed[i])