* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*/
typedef enum _maps_error_e {
-
MAPS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
MAPS_ERROR_PERMISSION_DENIED =
TIZEN_ERROR_PERMISSION_DENIED, /**< Permission Denied */
MAPS_ERROR_OUT_OF_MEMORY =
- TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
MAPS_ERROR_INVALID_PARAMETER =
TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
MAPS_ERROR_NOT_SUPPORTED =
- TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+ TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
MAPS_ERROR_CONNECTION_TIME_OUT =
TIZEN_ERROR_CONNECTION_TIME_OUT,/**< Timeout error, no answer */
TIZEN_ERROR_KEY_NOT_AVAILABLE, /**< Invalid key */
MAPS_ERROR_RESOURCE_BUSY =
- TIZEN_ERROR_RESOURCE_BUSY, /**< Maps Service busy */
+ TIZEN_ERROR_RESOURCE_BUSY, /**< Maps Service busy */
MAPS_ERROR_CANCELED =
- TIZEN_ERROR_CANCELED, /**< Maps Service request aborted */
+ TIZEN_ERROR_CANCELED, /**< Maps Service request aborted */
MAPS_ERROR_UNKNOWN =
- TIZEN_ERROR_UNKNOWN, /**< Unknown error */
+ TIZEN_ERROR_UNKNOWN, /**< Unknown error */
MAPS_ERROR_SERVICE_NOT_AVAILABLE =
TIZEN_ERROR_MAPS_SERVICE | 0x01,/**< Service unavailable */
MAPS_ERROR_NOT_FOUND =
- TIZEN_ERROR_MAPS_SERVICE | 0x02/**< Result not found */
-
+ TIZEN_ERROR_MAPS_SERVICE | 0x02 /**< Result not found */
} maps_error_e;
#ifdef __cplusplus
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*/
typedef enum {
-
- MAPS_ROUTE_DIRECTION_NONE, /**< Indicates unknown direction */
-
- MAPS_ROUTE_DIRECTION_NORTH, /**< Indicates north direction */
-
- MAPS_ROUTE_DIRECTION_NORTHWEST, /**< Indicates north-west direction */
-
- MAPS_ROUTE_DIRECTION_NORTHEAST, /**< Indicates north-east direction */
-
- MAPS_ROUTE_DIRECTION_SOUTH, /**< Indicates south direction */
-
- MAPS_ROUTE_DIRECTION_SOUTHEAST, /**< Indicates south-east direction */
-
- MAPS_ROUTE_DIRECTION_SOUTHWEST, /**< Indicates south-west direction */
-
- MAPS_ROUTE_DIRECTION_WEST, /**< Indicates west direction */
-
- MAPS_ROUTE_DIRECTION_EAST /**< Indicates east direction */
-
+ MAPS_ROUTE_DIRECTION_NONE, /**< Indicates unknown direction */
+ MAPS_ROUTE_DIRECTION_NORTH, /**< Indicates north direction */
+ MAPS_ROUTE_DIRECTION_NORTHWEST, /**< Indicates north-west direction */
+ MAPS_ROUTE_DIRECTION_NORTHEAST, /**< Indicates north-east direction */
+ MAPS_ROUTE_DIRECTION_SOUTH, /**< Indicates south direction */
+ MAPS_ROUTE_DIRECTION_SOUTHEAST, /**< Indicates south-east direction */
+ MAPS_ROUTE_DIRECTION_SOUTHWEST, /**< Indicates south-west direction */
+ MAPS_ROUTE_DIRECTION_WEST, /**< Indicates west direction */
+ MAPS_ROUTE_DIRECTION_EAST /**< Indicates east direction */
} maps_route_direction_e;
/**
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*/
typedef enum {
-
- MAPS_ROUTE_TURN_TYPE_NONE, /**< Indicates unknown instruction. */
-
- MAPS_ROUTE_TURN_TYPE_STRAIGHT, /**< Indicates instruction to move
- straight */
-
- MAPS_ROUTE_TURN_TYPE_BEAR_RIGHT, /**< Indicates instruction to bear
- right. */
-
- MAPS_ROUTE_TURN_TYPE_LIGHT_RIGHT, /**< Indicates instruction slightly to
- the right. */
-
- MAPS_ROUTE_TURN_TYPE_RIGHT, /**< Indicates instruction to turn right. */
-
- MAPS_ROUTE_TURN_TYPE_HARD_RIGHT, /**< Indicates instruction to turn hard
- to the right. */
-
- MAPS_ROUTE_TURN_TYPE_UTURN_RIGHT, /**< Indicates instruction to u-turn
- to the right. */
-
- MAPS_ROUTE_TURN_TYPE_UTURN_LEFT, /**< Indicates instruction to u-turn
- to the left. */
-
- MAPS_ROUTE_TURN_TYPE_HARD_LEFT, /**< Indicates instruction to turn hard
- to the left. */
-
- MAPS_ROUTE_TURN_TYPE_LEFT, /**< Indicates instruction to turn left. */
-
- MAPS_ROUTE_TURN_TYPE_LIGHT_LEFT, /**< Indicates instruction to turn
- lightly to the left. */
-
- MAPS_ROUTE_TURN_TYPE_BEAR_LEFT, /**< Indicates instruction to bear
- left. */
-
- MAPS_ROUTE_TURN_TYPE_RIGHT_FORK, /**< Indicates right fork
- instruction. */
-
- MAPS_ROUTE_TURN_TYPE_LEFT_FORK, /**< Indicates left fork instruction. */
-
- MAPS_ROUTE_TURN_TYPE_STRAIGHT_FORK /**< Indicates straight fork
- instruction. */
+ MAPS_ROUTE_TURN_TYPE_NONE, /**< Indicates unknown instruction. */
+ MAPS_ROUTE_TURN_TYPE_STRAIGHT, /**< Indicates instruction to move straight */
+ MAPS_ROUTE_TURN_TYPE_BEAR_RIGHT, /**< Indicates instruction to bear right. */
+ MAPS_ROUTE_TURN_TYPE_LIGHT_RIGHT, /**< Indicates instruction slightly to the right. */
+ MAPS_ROUTE_TURN_TYPE_RIGHT, /**< Indicates instruction to turn right. */
+ MAPS_ROUTE_TURN_TYPE_HARD_RIGHT, /**< Indicates instruction to turn hard to the right. */
+ MAPS_ROUTE_TURN_TYPE_UTURN_RIGHT, /**< Indicates instruction to u-turn to the right. */
+ MAPS_ROUTE_TURN_TYPE_UTURN_LEFT, /**< Indicates instruction to u-turn to the left. */
+ MAPS_ROUTE_TURN_TYPE_HARD_LEFT, /**< Indicates instruction to turn hard to the left. */
+ MAPS_ROUTE_TURN_TYPE_LEFT, /**< Indicates instruction to turn left. */
+ MAPS_ROUTE_TURN_TYPE_LIGHT_LEFT, /**< Indicates instruction to turn lightly to the left. */
+ MAPS_ROUTE_TURN_TYPE_BEAR_LEFT, /**< Indicates instruction to bear left. */
+ MAPS_ROUTE_TURN_TYPE_RIGHT_FORK, /**< Indicates right fork instruction. */
+ MAPS_ROUTE_TURN_TYPE_LEFT_FORK, /**< Indicates left fork instruction. */
+ MAPS_ROUTE_TURN_TYPE_STRAIGHT_FORK /**< Indicates straight fork instruction. */
} maps_route_turn_type_e;
/*----------------------------------------------------------------------------*/
* @since_tizen 3.0
*/
typedef enum _maps_view_object_operation_e {
-
- /** Indicates the add object operation */
- MAPS_VIEW_OBJECT_ADD,
-
- /** Indicates the change object visibility operation */
- MAPS_VIEW_OBJECT_SET_VISIBLE,
-
- /** Indicates the move object operation */
- MAPS_VIEW_OBJECT_MOVE,
-
- /** Indicates the operation of changing object specific properties */
- MAPS_VIEW_OBJECT_CHANGE,
-
- /** Indicates the remove object operation */
- MAPS_VIEW_OBJECT_REMOVE,
+ MAPS_VIEW_OBJECT_ADD, /**< Indicates the add object operation */
+ MAPS_VIEW_OBJECT_SET_VISIBLE, /**< Indicates the change object visibility operation */
+ MAPS_VIEW_OBJECT_MOVE, /**< Indicates the move object operation */
+ MAPS_VIEW_OBJECT_CHANGE, /**< Indicates the operation of changing object specific properties */
+ MAPS_VIEW_OBJECT_REMOVE, /**< Indicates the remove object operation */
} maps_view_object_operation_e;
int maps_view_object_marker_set_size(const maps_view_object_h marker, int width, int height);
if (lon_interval < 180 && lon_interval > -180) {
if (rb_lon <= tf_lon || rb_lat >= tf_lat)
return MAPS_ERROR_INVALID_PARAMETER;
- }
- else {
+ } else {
if (rb_lon >= tf_lon || rb_lat >= tf_lat)
return MAPS_ERROR_INVALID_PARAMETER;
}
} else {
return MAPS_ERROR_INVALID_PARAMETER;
}
- }
- else if (origin_handle->type == MAPS_AREA_CIRCLE) {
+ } else if (origin_handle->type == MAPS_AREA_CIRCLE) {
maps_area_h new_circle = NULL;
maps_area_circle_s cir = origin_handle->circle;
maps_coordinates_s center = cir.center;
double radius = cir.radius;
- maps_area_create_circle((maps_coordinates_h) & center, radius,
- &new_circle);
+ maps_area_create_circle((maps_coordinates_h) & center, radius, &new_circle);
if (new_circle) {
*cloned = new_circle;
} else {
if (lon_interval < 180 && lon_interval > -180) {
if (rb_lon <= tf_lon || rb_lat >= tf_lat)
ret = false;
- }
- else {
+ } else {
if (rb_lon >= tf_lon || rb_lat >= tf_lat)
ret = false;
}
ret = false;
break;
}
- }
- else if (handle->type == MAPS_AREA_CIRCLE) {
+ } else if (handle->type == MAPS_AREA_CIRCLE) {
maps_area_circle_s cir = handle->circle;
maps_coordinates_s center = cir.center;
ret = false;
break;
}
- }
- else {
+ } else {
ret = false;
}
} while (false);
const int error = clone_func((void *) data, &p);
if (error != MAPS_ERROR_NONE)
return error;
- }
- else {
+ } else {
p = (void*)data;
}
maps_item_list_s *l = (maps_item_list_s *) list;
if (clone_func) {
if (clone_func(data, &clone) != MAPS_ERROR_NONE)
continue;
- }
- else {
+ } else {
clone = data;
}
if (!callback(index++, total, clone, user_data))
int index = 0;
g_hash_table_iter_init(&iter, t->t);
while (g_hash_table_iter_next(&iter, &key, &value)) {
-
if(!key || !value)
continue;
int *value_ptr = (int *)value;
if (!callback(index++, total, *key_ptr, *value_ptr, user_data))
break;
-
}
return MAPS_ERROR_NONE;
}
int error = MAPS_ERROR_NONE;
do {
-
error = maps_int_hashtable_create(cloned);
if (!(*cloned) || (error != MAPS_ERROR_NONE))
break;
}
return MAPS_ERROR_NONE;
-
} while (false);
maps_int_hashtable_destroy(*cloned);
/* The table of available data features */
maps_int_hashtable_h supported_data;
-
} maps_place_s;
/* TODO: extract all such constants to the dedcated header file */
}
return MAPS_ERROR_NONE;
-
} while (false);
maps_place_category_destroy(*cloned);
}
static bool __maps_preference_properties_helper_cb(int index, int total,
- char *key, void *value,
- void *user_data)
+ char *key, void *value,
+ void *user_data)
{
/* Do not return the "named" preference, which can be obtained, */
/* with other functions from this module. */
}
EXPORT_API int maps_preference_clone(const maps_preference_h origin,
- maps_preference_h *cloned)
+ maps_preference_h *cloned)
{
if (!cloned || !origin)
return MAPS_ERROR_INVALID_PARAMETER;
/*----------------------------------------------------------------------------*/
-EXPORT_API int maps_preference_get_distance_unit(const maps_preference_h
- preference,
- maps_distance_unit_e *unit)
+EXPORT_API int maps_preference_get_distance_unit(const maps_preference_h preference,
+ maps_distance_unit_e *unit)
{
if (!preference || !unit)
return MAPS_ERROR_INVALID_PARAMETER;
}
EXPORT_API int maps_preference_get_language(const maps_preference_h preference,
- char **language)
+ char **language)
{
if (!preference || !language)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_LANGUAGE", language);
}
-EXPORT_API int maps_preference_get_max_results(const maps_preference_h
- preference,
- int *max_results)
+EXPORT_API int maps_preference_get_max_results(const maps_preference_h preference,
+ int *max_results)
{
if (!preference || !max_results)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_MAX_RESULTS", max_results);
}
-EXPORT_API int maps_preference_get_country_code(const maps_preference_h
- preference,
- char **country_code)
+EXPORT_API int maps_preference_get_country_code(const maps_preference_h preference,
+ char **country_code)
{
if (!preference || !country_code)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_COUNTRY_CODE", country_code);
}
-EXPORT_API int maps_preference_get_route_optimization(const maps_preference_h
- preference,
- maps_route_optimization_e*
- optimization)
+EXPORT_API int maps_preference_get_route_optimization(const maps_preference_h preference,
+ maps_route_optimization_e *optimization)
{
if (!preference || !optimization)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_ROUTE_OPTIMIZATION", (int *) optimization);
}
-EXPORT_API int maps_preference_get_route_transport_mode(const maps_preference_h
- preference,
- maps_route_transport_mode_e *
- transport_mode)
+EXPORT_API int maps_preference_get_route_transport_mode(const maps_preference_h preference,
+ maps_route_transport_mode_e *transport_mode)
{
if (!preference || !transport_mode)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_ROUTE_TRANSPORT_MODE", (int *) transport_mode);
}
-EXPORT_API int maps_preference_get_route_feature_weight(const maps_preference_h
- preference,
- maps_route_feature_weight_e *
- feature_weight)
+EXPORT_API int maps_preference_get_route_feature_weight(const maps_preference_h preference,
+ maps_route_feature_weight_e *feature_weight)
{
if (!preference || !feature_weight)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_ROUTE_FEATURE_WEIGHT", (int *) feature_weight);
}
-EXPORT_API int maps_preference_get_route_feature(const maps_preference_h
- preference,
- maps_route_feature_e * feature)
+EXPORT_API int maps_preference_get_route_feature(const maps_preference_h preference,
+ maps_route_feature_e * feature)
{
if (!preference || !feature)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_ROUTE_FEATURE", (int *) feature);
}
-EXPORT_API int maps_preference_get_route_alternatives_enabled(const maps_preference_h preference, bool *enable)
+EXPORT_API int maps_preference_get_route_alternatives_enabled(
+ const maps_preference_h preference, bool *enable)
{
if (!preference)
return MAPS_ERROR_INVALID_PARAMETER;
}
-EXPORT_API int maps_preference_foreach_property(const maps_preference_h
- preference,
- maps_preference_properties_cb
- callback, void *user_data)
+EXPORT_API int maps_preference_foreach_property(const maps_preference_h preference,
+ maps_preference_properties_cb callback, void *user_data)
{
if (!preference || !callback)
return MAPS_ERROR_INVALID_PARAMETER;
/*----------------------------------------------------------------------------*/
EXPORT_API int maps_preference_set_distance_unit(maps_preference_h preference,
- const maps_distance_unit_e
- unit)
+ const maps_distance_unit_e unit)
{
if (!preference)
return MAPS_ERROR_INVALID_PARAMETER;
}
EXPORT_API int maps_preference_set_language(maps_preference_h preference,
- const char *language)
+ const char *language)
{
if (!preference || !language)
return MAPS_ERROR_INVALID_PARAMETER;
}
EXPORT_API int maps_preference_set_max_results(maps_preference_h preference,
- const int max_results)
+ const int max_results)
{
if (!preference || max_results <= 0)
return MAPS_ERROR_INVALID_PARAMETER;
}
EXPORT_API int maps_preference_set_country_code(maps_preference_h preference,
- const char *country_code)
+ const char *country_code)
{
if (!preference || !country_code)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_COUNTRY_CODE", country_code);
}
-EXPORT_API int maps_preference_set_route_optimization(maps_preference_h
- preference,
- const maps_route_optimization_e
- optimization)
+EXPORT_API int maps_preference_set_route_optimization(maps_preference_h preference,
+ const maps_route_optimization_e optimization)
{
if (!preference)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_ROUTE_OPTIMIZATION", optimization);
}
-EXPORT_API int maps_preference_set_route_transport_mode(maps_preference_h
- preference,
- const maps_route_transport_mode_e
- transport_mode)
+EXPORT_API int maps_preference_set_route_transport_mode(maps_preference_h preference,
+ const maps_route_transport_mode_e transport_mode)
{
if (!preference)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_ROUTE_TRANSPORT_MODE", transport_mode);
}
-EXPORT_API int maps_preference_set_route_feature_weight(maps_preference_h
- preference,
- const maps_route_feature_weight_e
- feature_weight)
+EXPORT_API int maps_preference_set_route_feature_weight(maps_preference_h preference,
+ const maps_route_feature_weight_e feature_weight)
{
if (!preference)
return MAPS_ERROR_INVALID_PARAMETER;
}
EXPORT_API int maps_preference_set_route_feature(maps_preference_h preference,
- const maps_route_feature_e
- feature)
+ const maps_route_feature_e feature)
{
if (!preference)
return MAPS_ERROR_INVALID_PARAMETER;
"MAPS_PREFERENCE_ROUTE_FEATURE", feature);
}
-EXPORT_API int maps_preference_set_route_alternatives_enabled(maps_preference_h preference, bool enable)
+EXPORT_API int maps_preference_set_route_alternatives_enabled(maps_preference_h preference,
+ bool enable)
{
if (!preference)
return MAPS_ERROR_INVALID_PARAMETER;
preference, maps_item_list_h feature_list,
maps_route_feature_weight_e feature)
{
-
if (!preference || max_result_count <= 0)
return MAPS_ERROR_INVALID_PARAMETER;
preference, maps_item_list_h feature_list,
maps_route_feature_weight_e feature)
{
-
if (!preference || !feature_list)
return MAPS_ERROR_INVALID_PARAMETER;
* The structure of Maps View internal data
*/
typedef struct _maps_view_s {
-
/* Map Coordinates and Area */
maps_area_h area;
maps_coordinates_h center;
bool _maps_view_is_gesture_available(maps_view_h view, maps_view_gesture_e gesture)
{
- if(!view)
+ if (!view)
return false;
maps_view_s *v = (maps_view_s *)view;
return v->gesture_available[gesture];
maps_view_action_e _maps_view_get_gesture_action(maps_view_h view, maps_view_gesture_e gesture)
{
- if(!view)
+ if (!view)
return MAPS_VIEW_ACTION_NONE;
maps_view_s *v = (maps_view_s *)view;
return v->gesture_actions[gesture];
void *_maps_view_get_maps_service_ptr(maps_view_h view)
{
- if(!view)
+ if (!view)
return NULL;
maps_view_s *v = (maps_view_s *)view;
return v->maps;
int _maps_view_on_object_operation(maps_view_h view, maps_view_object_h object, maps_view_object_operation_e operation)
{
- if(!view)
+ if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
- if(!__get_plugin_interface(view)->maps_plugin_on_object)
+ if (!__get_plugin_interface(view)->maps_plugin_on_object)
return MAPS_ERROR_INVALID_PARAMETER;
return __get_plugin_interface(view)->maps_plugin_on_object(view, object, operation);
static void __on_canvas_tap(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
MAPS_LOGI("__on_canvas_tap");
- if(!event_info || !data)
+ if (!event_info || !data)
return;
/* Extract the view ptr */
maps_view_s *v = (maps_view_s *)data;
- if(!v->finger_stream)
+ if (!v->finger_stream)
return;
/* Detect & Process the gesture */
static void __on_canvas_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
MAPS_LOGI("__on_canvas_up");
- if(!event_info || !data)
+ if (!event_info || !data)
return;
/* Extract the view ptr */
maps_view_s *v = (maps_view_s *)data;
- if(!v->finger_stream)
+ if (!v->finger_stream)
return;
/* Detect & Process the gesture */
static void __on_canvas_line(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
MAPS_LOGI("__on_canvas_line");
- if(!event_info || !data)
+ if (!event_info || !data)
return;
/* Extract view ptr */
maps_view_s *v = (maps_view_s *)data;
- if(!v->finger_stream)
+ if (!v->finger_stream)
return;
/* Detect & Process the gesture */
static void __on_canvas_multi_tap(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
MAPS_LOGI("__on_canvas_multi_tap");
- if(!event_info || !data)
+ if (!event_info || !data)
return;
/* Extract view ptr */
maps_view_s *v = (maps_view_s *)data;
- if(!v->finger_stream)
+ if (!v->finger_stream)
return;
/* Detect & Process the gesture */
static void __on_canvas_multi_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
MAPS_LOGI("__on_canvas_multi_up");
- if(!event_info || !data)
+ if (!event_info || !data)
return;
/* Extract view ptr */
maps_view_s *v = (maps_view_s *)data;
- if(!v->finger_stream)
+ if (!v->finger_stream)
return;
/* Detect & Process the gesture */
return __get_plugin_interface(view)->maps_plugin_render_map(view,
coordinates, zoom_factor, rotation_angle);
-
}
static void __on_canvas_multi_line(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
MAPS_LOGI("__on_canvas_multi_line");
- if(!event_info || !data)
+ if (!event_info || !data)
return;
/* Extract view ptr */
maps_view_s *v = (maps_view_s *)data;
- if(!v->finger_stream)
+ if (!v->finger_stream)
return;
/* Detect & Process the gesture */
void _maps_view_set_idle_listener(const maps_view_h view,
void (*callback)(void *user_data), void *user_data)
{
- if(!view)
+ if (!view)
return;
maps_view_s *v = (maps_view_s *)view;
v->idle_listener.callback = callback;
void _maps_view_halt_inertial_camera(maps_view_h view)
{
maps_view_s *v = (maps_view_s *)view;
- if(v && v->inertial_camera && v->inertial_camera->is_transiting()) {
+ if (v && v->inertial_camera && v->inertial_camera->is_transiting()) {
v->inertial_camera->set_transiting(false);
g_usleep(0);
}
bool is_continue = false;
view::inertial_gesture *ig = v->inertial_gesture;
- if(ig && ig->is_transiting()) {
+ if (ig && ig->is_transiting()) {
is_transiting |= true;
is_continue |= ig->next_transition_step();
g_usleep(5*1000);
}
view::inertial_camera *ic = v->inertial_camera;
- if(ic && ic->is_transiting()) {
+ if (ic && ic->is_transiting()) {
is_transiting |= true;
is_continue |= ic->next_transition_step();
__maps_plugin_render_map(v,
if (is_transiting && !is_continue) {
maps_view_event_data_h ed = _maps_view_create_event_data(MAPS_VIEW_EVENT_READY);
- if(ed) {
+ if (ed) {
_maps_view_invoke_event_callback(v, ed);
maps_view_event_data_destroy(ed);
}
/* Invoke user registered event callback */
maps_view_event_data_h ed = _maps_view_create_event_data(MAPS_VIEW_EVENT_READY);
- if(ed) {
+ if (ed) {
_maps_view_invoke_event_callback(view, ed);
maps_view_event_data_destroy(ed);
}
__get_plugin_interface(v)->maps_plugin_get_min_zoom_level(v, &v->min_zoom_level);
__get_plugin_interface(v)->maps_plugin_get_max_zoom_level(v, &v->max_zoom_level);
- if(v->min_zoom_level <= 0)
+ if (v->min_zoom_level <= 0)
v->min_zoom_level = 2;
- if(v->max_zoom_level <= 0)
+ if (v->max_zoom_level <= 0)
v->max_zoom_level = 2;
v->zoom_level = v->min_zoom_level;
maps_view_s *v = (maps_view_s *) view;
/* Unregister gesture processing */
- if(v->finger_stream)
+ if (v->finger_stream)
delete v->finger_stream;
v->finger_stream = NULL;
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_s *v = (maps_view_s *) view;
- if(v->center != coordinates) {
+ if (v->center != coordinates) {
if (v->center)
maps_coordinates_destroy(v->center);
maps_coordinates_clone(coordinates, &v->center);
maps_view_s *v = (maps_view_s *) view;
/* Set up the target for camera inertial movement */
- if(v->inertial_camera)
+ if (v->inertial_camera)
v->inertial_camera->set_targets(coordinates,
zoom_factor,
rotation_angle);
zoom_factor,
rotation_angle);
- if(v->center != coordinates) {
+ if (v->center != coordinates) {
maps_coordinates_destroy(v->center);
maps_coordinates_clone(coordinates, &v->center);
}
/* Invoke user registered event callback */
maps_view_event_data_h ed =
_maps_view_create_event_data(MAPS_VIEW_EVENT_ACTION);
- if(ed) {
+ if (ed) {
_maps_view_event_data_set_action_type(ed, MAPS_VIEW_ACTION_SCROLL);
_maps_view_event_data_set_center(ed, v->center);
_maps_view_invoke_event_callback(v, ed);
/* Invoke user registered event callback */
maps_view_event_data_h ed =
_maps_view_create_event_data(MAPS_VIEW_EVENT_ACTION);
- if(ed) {
+ if (ed) {
_maps_view_event_data_set_action_type(ed, MAPS_VIEW_ACTION_SCROLL);
_maps_view_event_data_set_delta(ed, delta_x, delta_y);
_maps_view_invoke_event_callback(view, ed);
if (new_level > v->max_zoom_level) new_level = v->max_zoom_level;
/* Add inertia to the zoom process */
- if(v->inertial_camera)
+ if (v->inertial_camera)
v->inertial_camera->set_zoom_target(double(new_level));
v->zoom_level = new_level;
/* Invoke user registered event callback */
maps_view_event_data_h ed =
_maps_view_create_event_data(MAPS_VIEW_EVENT_ACTION);
- if(ed) {
+ if (ed) {
_maps_view_event_data_set_action_type(ed, MAPS_VIEW_ACTION_ZOOM);
_maps_view_event_data_set_zoom_factor(ed, v->zoom_factor);
_maps_view_invoke_event_callback(v, ed);
if (new_factor > v->max_zoom_level) new_factor = v->max_zoom_level;
/* Add inertia to the zoom process */
- if(v->inertial_camera)
+ if (v->inertial_camera)
v->inertial_camera->set_zoom_target(new_factor);
/* Update Map View zoom factor */
if (rotation_changed) {
/* Add inertia to the rotation process */
- if(v->inertial_camera)
+ if (v->inertial_camera)
v->inertial_camera->set_rotation_target(angle);
/* Update Map View rotation angle */
/* Invoke user registered event callback */
maps_view_event_data_h ed =
_maps_view_create_event_data(MAPS_VIEW_EVENT_ACTION);
- if(ed) {
+ if (ed) {
_maps_view_event_data_set_action_type(ed, MAPS_VIEW_ACTION_ZOOM);
_maps_view_event_data_set_zoom_factor(ed, v->zoom_factor);
_maps_view_invoke_event_callback(v, ed);
/* Invoke user registered event callback */
maps_view_event_data_h ed =
_maps_view_create_event_data(MAPS_VIEW_EVENT_ACTION);
- if(ed) {
+ if (ed) {
_maps_view_event_data_set_action_type(ed, MAPS_VIEW_ACTION_ROTATE);
_maps_view_event_data_set_rotation_angle(ed, v->rotation_angle);
_maps_view_invoke_event_callback(v, ed);
/* Add inertia to the rotation process */
maps_view_s *v = (maps_view_s *)view;
- if(v->inertial_camera)
+ if (v->inertial_camera)
v->inertial_camera->set_rotation_target(angle);
return _maps_view_set_zoom_rotate(view, false, .0, true, angle);
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_s *v = (maps_view_s *) view;
- if(enabled) {
- if(!v->inertial_gesture) {
+ if (enabled) {
+ if (!v->inertial_gesture) {
v->inertial_gesture = new view::inertial_gesture(view);
if (!v->inertial_gesture) {
MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
}
}
- if(!v->inertial_camera) {
+ if (!v->inertial_camera) {
v->inertial_camera = new view::inertial_camera(view);
if (!v->inertial_camera) {
MAPS_LOGE("OUT_OF_MEMORY(0x%08x)", MAPS_ERROR_OUT_OF_MEMORY);
} else {
v->finger_stream->set_gesture_detector(new view::gesture_detector_statemachine(view));
- if(v->inertial_gesture) {
+ if (v->inertial_gesture) {
/* Unset Inertial Camera */
- if(v->inertial_gesture->is_transiting()) {
+ if (v->inertial_gesture->is_transiting()) {
v->inertial_gesture->set_transiting(false);
sleep(0);
}
delete inertial_gesture;
}
- if(v->inertial_camera) {
+ if (v->inertial_camera) {
/* Unset Inertial Camera */
- if(v->inertial_camera->is_transiting()) {
+ if (v->inertial_camera->is_transiting()) {
v->inertial_camera->set_transiting(false);
sleep(0);
}
};
bool supported = false;
for(unsigned int i = 0; i < (sizeof(lngs) / sizeof(lngs[0])); i ++) {
- if(g_strcmp0(language, lngs[i]) == 0) {
+ if (g_strcmp0(language, lngs[i]) == 0) {
supported = true;
break;
}
}
- if(!supported)
+ if (!supported)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_s *v = (maps_view_s *) view;
{
if (!view || !callback)
return MAPS_ERROR_INVALID_PARAMETER;
- if((type < MAPS_VIEW_EVENT_GESTURE) || (type > MAPS_VIEW_EVENT_READY))
+ if ((type < MAPS_VIEW_EVENT_GESTURE) || (type > MAPS_VIEW_EVENT_READY))
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_s *v = (maps_view_s *) view;
{
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
- if((type < MAPS_VIEW_EVENT_GESTURE) || (type > MAPS_VIEW_EVENT_READY))
+ if ((type < MAPS_VIEW_EVENT_GESTURE) || (type > MAPS_VIEW_EVENT_READY))
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_s *v = (maps_view_s *) view;
{
if (!view)
return MAPS_ERROR_INVALID_PARAMETER;
- if((gesture < MAPS_VIEW_GESTURE_NONE) || (gesture > MAPS_VIEW_GESTURE_LONG_PRESS))
+ if ((gesture < MAPS_VIEW_GESTURE_NONE) || (gesture > MAPS_VIEW_GESTURE_LONG_PRESS))
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_s *v = (maps_view_s *) view;
v->gesture_available[gesture] = enabled;
{
if (!view || !enabled)
return MAPS_ERROR_INVALID_PARAMETER;
- if((gesture < MAPS_VIEW_GESTURE_NONE) || (gesture > MAPS_VIEW_GESTURE_LONG_PRESS))
+ if ((gesture < MAPS_VIEW_GESTURE_NONE) || (gesture > MAPS_VIEW_GESTURE_LONG_PRESS))
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_s *v = (maps_view_s *) view;
*enabled = v->gesture_available[gesture];
/* Add Visual Object to the list of View Visual Objects */
maps_view_s *v = (maps_view_s *)view;
error = maps_item_list_append(v->view_objects, object, NULL);
- if(error != MAPS_ERROR_NONE)
+ if (error != MAPS_ERROR_NONE)
break;
/* Link the object with the View */
error = _maps_view_object_set_view(object, view);
- if(error != MAPS_ERROR_NONE)
+ if (error != MAPS_ERROR_NONE)
break;
/* Notify the plugin about added object */
error = _maps_view_on_object_operation(view, object, MAPS_VIEW_OBJECT_ADD);
- if(error != MAPS_ERROR_NONE)
+ if (error != MAPS_ERROR_NONE)
break;
/* Redraw the view */
error = _maps_view_redraw(v);
- if(error != MAPS_ERROR_NONE)
+ if (error != MAPS_ERROR_NONE)
break;
return MAPS_ERROR_NONE;
- } while(false);
+ } while (false);
return error;
}
/* Remove Visual Object from the list of View Visual Objects */
maps_view_s *v = (maps_view_s *)view;
error = maps_item_list_remove(v->view_objects, object, maps_view_object_destroy);
- if(error != MAPS_ERROR_NONE)
+ if (error != MAPS_ERROR_NONE)
return error;
/* Redraw the view */
error = _maps_view_redraw(v);
- if(error != MAPS_ERROR_NONE)
+ if (error != MAPS_ERROR_NONE)
return error;
return MAPS_ERROR_NONE;
- } while(false);
+ } while (false);
return error;
}
do {
maps_view_s *v = (maps_view_s *)view;
error = maps_item_list_remove_all(v->view_objects, maps_view_object_destroy);
- if(error != MAPS_ERROR_NONE)
+ if (error != MAPS_ERROR_NONE)
return error;
/* Redraw the view */
error = _maps_view_redraw(v);
- if(error != MAPS_ERROR_NONE)
+ if (error != MAPS_ERROR_NONE)
return error;
return MAPS_ERROR_NONE;
- } while(false);
+ } while (false);
return error;
}
{
maps_view_event_data_h event_data = NULL;
const int error = _maps_view_event_data_create(&event_data);
- if(error != MAPS_ERROR_NONE) {
+ if (error != MAPS_ERROR_NONE) {
maps_view_event_data_destroy(event_data);
return NULL;
}
- if(!event_data)
+ if (!event_data)
return NULL;
_maps_view_event_data_set_type(event_data, type);
return event_data;
void _maps_view_invoke_event_callback(maps_view_h view, maps_view_event_data_h event_data)
{
- if(!view || !event_data)
+ if (!view || !event_data)
return;
maps_view_s *v = (maps_view_s *)view;
static bool __maps_view_object_poly_collect_points_cb(int index, maps_coordinates_h point, void *user_data)
{
- if(!point || !user_data)
+ if (!point || !user_data)
return false;
maps_view_collect_poly_object_point_s *cpop =
int x = 0;
int y = 0;
- if(maps_view_geolocation_to_screen(cpop->v, point, &x, &y) == MAPS_ERROR_NONE)
+ if (maps_view_geolocation_to_screen(cpop->v, point, &x, &y) == MAPS_ERROR_NONE)
cpop->pd->add_point(float(x), float(y));
return true;
static bool __maps_view_hit_test_cb(int index, int total, maps_view_object_h object, void *user_data)
{
- if(!object || !user_data)
+ if (!object || !user_data)
return false;
/* If it is an unvisible object, skip this hit-testing. */
maps_view_collect_poly_object_point_s cpop = {htd->v, &pd};
int error = maps_view_object_polyline_foreach_point(object,
__maps_view_object_poly_collect_points_cb, &cpop);
- if(error != MAPS_ERROR_NONE)
+ if (error != MAPS_ERROR_NONE)
break;
int width = 0;
maps_view_object_polyline_get_width(object, &width);
- if(pd.hit_test(float(htd->x), float(htd->y), false, width))
+ if (pd.hit_test(float(htd->x), float(htd->y), false, width))
htd->object = object;
break;
maps_view_collect_poly_object_point_s cpop = {htd->v, &pd};
int error = maps_view_object_polygon_foreach_point(object,
__maps_view_object_poly_collect_points_cb, &cpop);
- if(error != MAPS_ERROR_NONE)
+ if (error != MAPS_ERROR_NONE)
break;
- if(pd.hit_test(float(htd->x), float(htd->y), true))
+ if (pd.hit_test(float(htd->x), float(htd->y), true))
htd->object = object;
break;
if (h < 30) h = 30;
/* Check hit-area */
- if((x > (htd->x - w)) && (x < (htd->x + w))
+ if ((x > (htd->x - w)) && (x < (htd->x + w))
&& (y > (htd->y - h)) && (y < (htd->y + h))) {
htd->object = object;
}
break;
}
- if(htd->object)
+ if (htd->object)
return false;
return true;
* This represents visual event object information
*/
typedef struct _maps_view_event_data_s {
-
maps_view_event_type_e event_type;
/* Applicable for set_center action */
/* Applicable for object event */
maps_view_object_h object;
-
} maps_view_event_data_s;
/*----------------------------------------------------------------------------*/
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
- if(e->center)
+ if (e->center)
maps_coordinates_destroy(e->center);
g_slice_free(maps_view_event_data_s, e);
{
if (!event)
return MAPS_ERROR_INVALID_PARAMETER;
- if((gesture_type < MAPS_VIEW_GESTURE_NONE) || (gesture_type > MAPS_VIEW_GESTURE_LONG_PRESS))
+ if ((gesture_type < MAPS_VIEW_GESTURE_NONE) || (gesture_type > MAPS_VIEW_GESTURE_LONG_PRESS))
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
e->gesture_type = gesture_type;
{
if (!event)
return MAPS_ERROR_INVALID_PARAMETER;
- if((action_type < MAPS_VIEW_ACTION_NONE) || (action_type > MAPS_VIEW_ACTION_ROTATE))
+ if ((action_type < MAPS_VIEW_ACTION_NONE) || (action_type > MAPS_VIEW_ACTION_ROTATE))
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
e->action_type = action_type;
if (!event || !gesture_type)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
- if((e->event_type != MAPS_VIEW_EVENT_GESTURE) && (e->event_type != MAPS_VIEW_EVENT_OBJECT))
+ if ((e->event_type != MAPS_VIEW_EVENT_GESTURE) && (e->event_type != MAPS_VIEW_EVENT_OBJECT))
return MAPS_ERROR_INVALID_PARAMETER;
*gesture_type = e->gesture_type;
return MAPS_ERROR_NONE;
if (!event || !action_type)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
- if(e->event_type != MAPS_VIEW_EVENT_ACTION)
+ if (e->event_type != MAPS_VIEW_EVENT_ACTION)
return MAPS_ERROR_INVALID_PARAMETER;
*action_type = e->action_type;
return MAPS_ERROR_NONE;
if (!event || !delta_x || !delta_y)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
- if(e->event_type != MAPS_VIEW_EVENT_ACTION)
+ if (e->event_type != MAPS_VIEW_EVENT_ACTION)
return MAPS_ERROR_INVALID_PARAMETER;
*delta_x = e->delta_x;
*delta_y = e->delta_y;
if (!event || !x || !y)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
- if(e->event_type != MAPS_VIEW_EVENT_GESTURE && e->event_type != MAPS_VIEW_EVENT_OBJECT)
+ if (e->event_type != MAPS_VIEW_EVENT_GESTURE && e->event_type != MAPS_VIEW_EVENT_OBJECT)
return MAPS_ERROR_INVALID_PARAMETER;
*x = e->x;
*y = e->y;
if (!event || !fingers)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
- if(e->event_type != MAPS_VIEW_EVENT_GESTURE)
+ if (e->event_type != MAPS_VIEW_EVENT_GESTURE)
return MAPS_ERROR_INVALID_PARAMETER;
*fingers = e->fingers;
return MAPS_ERROR_NONE;
if (!event || !zoom_factor)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
- if((e->event_type != MAPS_VIEW_EVENT_GESTURE) && (e->event_type != MAPS_VIEW_EVENT_ACTION))
+ if ((e->event_type != MAPS_VIEW_EVENT_GESTURE) && (e->event_type != MAPS_VIEW_EVENT_ACTION))
return MAPS_ERROR_INVALID_PARAMETER;
*zoom_factor = e->zoom_factor;
return MAPS_ERROR_NONE;
if (!event || !rotation_angle)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
- if((e->event_type != MAPS_VIEW_EVENT_GESTURE) && (e->event_type != MAPS_VIEW_EVENT_ACTION))
+ if ((e->event_type != MAPS_VIEW_EVENT_GESTURE) && (e->event_type != MAPS_VIEW_EVENT_ACTION))
return MAPS_ERROR_INVALID_PARAMETER;
*rotation_angle = e->rotation_angle;
return MAPS_ERROR_NONE;
if (!event || !object)
return MAPS_ERROR_INVALID_PARAMETER;
maps_view_event_data_s *e = (maps_view_event_data_s *) event;
- if(e->event_type != MAPS_VIEW_EVENT_OBJECT)
+ if (e->event_type != MAPS_VIEW_EVENT_OBJECT)
return MAPS_ERROR_INVALID_PARAMETER;
*object = e->object;
return MAPS_ERROR_NONE;
* This represents visual object information
*/
typedef struct _maps_view_object_s {
- maps_view_object_type_e type; /* marker, polyline, polygon, group */
-
- void *shape_data; /* Pointer to the visual object data, such as
- maps_view_marker_data_s or
- maps_view_polyline_data_s */
-
+ maps_view_object_type_e type; /* marker, polyline, polygon, group */
+ void *shape_data; /* Pointer to the visual object data, such as
+ maps_view_marker_data_s or maps_view_polyline_data_s */
bool visible;
-
maps_view_object_h parent_group; /* The group, owning the object */
-
maps_view_h view; /* Link with the parent Map View */
-
} maps_view_object_s;
-int _maps_view_on_object_operation(maps_view_h view, maps_view_object_h object, maps_view_object_operation_e operation);
+int _maps_view_on_object_operation(maps_view_h view, maps_view_object_h object,
+ maps_view_object_operation_e operation);
static maps_view_h __get_view(const maps_view_object_h object);
static maps_view_polyline_data_s *__get_polyline_data(const maps_view_object_h object);
*polyline = (maps_view_polyline_data_s *) p;
return MAPS_ERROR_NONE;
- } while(false);
+ } while (false);
__maps_view_polyline_data_destroy(p);
return error;
*polygon = (maps_view_polygon_data_s *) p;
return MAPS_ERROR_NONE;
- } while(false);
+ } while (false);
__maps_view_polygon_data_destroy(p);
return error;
m->z_order = 0;
*marker = (maps_view_marker_data_s *) m;
return MAPS_ERROR_NONE;
- } while(false);
+ } while (false);
__maps_view_marker_data_destroy(m);
return error;
*object = (maps_view_object_h) o;
return MAPS_ERROR_NONE;
- } while(false);
+ } while (false);
maps_view_object_destroy(o);
return error;
}
MAPS_LOGD("START PLUGIN FILES DISCOVERY:");
dir = g_dir_open(MAPS_PLUGINS_PATH_PREFIX, 0, &error);
if (dir) {
-
GPatternSpec *plugin_name_pattern = g_pattern_spec_new("*?.so");
while ((filename = g_dir_read_name(dir))) {
MAPS_LOGD("found plugin binary: %s", filename);
- if (g_pattern_match_string(plugin_name_pattern,
- filename)) {
- MAPS_LOGD("\tadded plugin binary: %s",
- filename);
+ if (g_pattern_match_string(plugin_name_pattern, filename)) {
+ MAPS_LOGD("\tadded plugin binary: %s", filename);
l.push_back(string(filename));
}
}
g_pattern_spec_free(plugin_name_pattern);
-
g_dir_close(dir);
- }
- else if (error) {
- MAPS_LOGE("%d: Can not open directory: %s\n", error->code,
- error->message); /* g_error */
+ } else if (error) {
+ MAPS_LOGE("%d: Can not open directory: %s\n", error->code, error->message);
}
return l;
plugin::provider_info plugin::binary_extractor::get_plugin_info(const
string &file_name) const
{
-
if (file_name.empty())
return provider_info::empty_instance;
/* 2. Perform steps to completely initialize a plugin */
do {
-
if (!new_plugin) {
MAPS_LOGE("OUT_OF_MEMORY(0x%08x)",
MAPS_ERROR_OUT_OF_MEMORY);
/* 2.5 Return newly initialized plugin */
return new_plugin;
-
} while (FALSE);
MAPS_LOGE("Shut down the plugin becuause of error");
plugin::GMod *plugin::binary_extractor::gmod_new(const string &module_file,
gboolean is_resident) const
{
-
if (!g_module_supported()) {
MAPS_LOGE("ERROR! g_module_supported is false\n\n");
return NULL;
void plugin::binary_extractor::trace_dbg(const plugin_s *plugin) const
{
-
MAPS_LOGD("*********************************************");
MAPS_LOGD("PLUGIN INFO");
if (!plugin) {
const GMod *mod = (const GMod *) plugin->module;
if (!mod) {
MAPS_LOGD("PLUGIN module is NULL");
- }
- else {
+ } else {
MAPS_LOGD("module address:\t\t\t%p", mod->module);
MAPS_LOGD("module name:\t\t\t%s", mod->name);
MAPS_LOGD("module path:\t\t\t%s", mod->path);
if (!plugin->request_queue) {
MAPS_LOGD("PLUGIN request queue is NULL");
- }
- else {
+ } else {
MAPS_LOGD("plugin request queue:\t\t\t%p", plugin->request_queue);
}
/* Plugin interface */
typedef struct _interface_s {
-
/* Plugin dedicated functions */
maps_plugin_init_f maps_plugin_init;
maps_plugin_shutdown_f maps_plugin_shutdown;
plugin::interface_s *session::command::interface() const
{
if (!m)
- return plugin::get_empty_interface_ptr(); /* PROBLEM!!! Why have
- no maps service!! Returning default empty interface */
+ return plugin::get_empty_interface_ptr();
plugin::plugin_s *p = __extract_plugin(m);
if (!p)
- return plugin::get_empty_interface_ptr(); /* PROBLEM!!! Why have
- no plugin!! Returning default empty interface */
+ return plugin::get_empty_interface_ptr();
return &p->interface;
}
static command_queue_sync sync_queue;
return &sync_queue;
#endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
- }
- else {
+ } else {
static command_queue_sync sync_queue;
return &sync_queue;
}
/* Attempting to update existing command with freshier data.
* It is decided not to store a number of commands of the same type:
* one command is enough */
- if(c_new) {
- if(ca->get_type() == c_new->get_type()) {
+ if (c_new) {
+ if (ca->get_type() == c_new->get_type()) {
ca->merge(c_new);
//c_new->set_merged();
- } else if(cb->get_type() == c_new->get_type()) {
+ } else if (cb->get_type() == c_new->get_type()) {
cb->merge(c_new);
//c_new->set_merged();
}
{
/*g_print("session::command_queue_view::push "
"pushed a command: %p\n", c);*/
- if(c == command::empty_ptr())
+ if (c == command::empty_ptr())
return MAPS_ERROR_NONE;
if (!c || !c->plugin() || !c->plugin()->request_queue)
queue_autoref(c->plugin()->request_queue);
-
#if 0
/* ---------------------------------------------- */
/* This is the routine without queue modification */
const bool _dbg_simple_queue = false;
- if(_dbg_simple_queue) {
- g_async_queue_push (c->plugin()->request_queue, c);
+ if (_dbg_simple_queue) {
+ g_async_queue_push(c->plugin()->request_queue, c);
return MAPS_ERROR_NONE;
}
/* ---------------------------------------------- */
#endif
-
-
/* Iterating the queue; sorting it and simultaneously attempting
* to update the data of the existing command of the current type.
* This approach allows to store only one instance of a command per
* given type */
/*__dbg_queue_length = 0;*/
- g_async_queue_sort (c->plugin()->request_queue,
+ g_async_queue_sort(c->plugin()->request_queue,
session::command_queue_view::iterate, c);
/*g_print("Queue Length: %d\n", __dbg_queue_length);*/
*
* https://developer.gnome.org/glib/stable/
* glib-Asynchronous-Queues.html#g-async-queue-push-sorted */
- if(c->merged())
+ if (c->merged())
delete c;
else
- g_async_queue_push_sorted (c->plugin()->request_queue, c,
+ g_async_queue_push_sorted(c->plugin()->request_queue, c,
session::command_queue_view::iterate,
NULL);
* https://developer.gnome.org/glib/stable/glib-Asynchronous-Queues.html#g-async-queue-timeout-pop
*/
command* c =
- (command*) g_async_queue_timeout_pop(p->request_queue,
+ (command*)g_async_queue_timeout_pop(p->request_queue,
/*300 * G_TIME_SPAN_MILLISECOND);*/
/* Small timeout is better for UI */
10 * G_TIME_SPAN_MILLISECOND);
- /*if(c)
+ /*if (c)
g_print("session::command_queue_view::pop "
"extracted a command: %p\n", c);*/
return (c) ? c : command::empty_ptr();
extern int _maps_view_move_center(maps_view_h view, const int delta_x, const int delta_y);
extern int _maps_view_set_zoom_rotate(maps_view_h view,
- const bool zoom_changed, const double zoom_factor,
- const bool rotation_changed, const double rotation_angle);
+ const bool zoom_changed, const double zoom_factor,
+ const bool rotation_changed, const double rotation_angle);
extern bool maps_address_is_valid(const maps_address_h address);
extern bool maps_area_is_valid(const maps_area_h area);
extern bool maps_coordinates_is_valid(const maps_coordinates_h coordinates);
static int __put_to_hashtable(session::command_handler *ch,
- maps_service_data_e feature,
- maps_int_hashtable_h t)
+ maps_service_data_e feature,
+ maps_int_hashtable_h t)
{
if (!ch || !t)
return MAPS_ERROR_INVALID_PARAMETER;
/* need to create the handler when the function is NULL */
pr.add(my_req_id);
handler = new command_geocode_handler(plugin(),
- callback,
- user_data,
- my_req_id);
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
pr.update(my_req_id, handler);
MAPS_LOGD("session::command_geocode::run: %d", my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().maps_plugin_geocode;
coordinates,
void *user_data)
{
-
command_geocode_handler *handler = (command_geocode_handler *) user_data;
if (request_id != handler->plg_req_id) {
if (maps_area_is_valid(b)) {
bounds = b;
- }
- else {
+ } else {
error = MAPS_ERROR_INVALID_PARAMETER;
*request_id = -1;
}
-
}
session::command_geocode_inside_bounds::~command_geocode_inside_bounds()
pr.update(my_req_id, handler);
MAPS_LOGD("session::command_geocode_inside_bounds::run: %d", my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().
if (maps_address_is_valid(a)) {
address = a;
- }
- else {
+ } else {
error = MAPS_ERROR_INVALID_PARAMETER;
*request_id = -1;
MAPS_LOGD("Invalid parameter");
}
-
}
session::command_geocode_by_structured_address::
handler, &handler->plg_req_id);
pr.update(my_req_id, handler);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().
{
*request_id = command::command_request_id++;
my_req_id = *request_id;
-
}
session::command_reverse_geocode::~command_reverse_geocode()
pr.update(my_req_id, handler);
MAPS_LOGD("session::command_reverse_geocode::run: %d", my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().
maps_address_h address,
void *user_data)
{
-
command_reverse_geocode_handler *handler =
(command_reverse_geocode_handler *) user_data;
if (request_id != handler->plg_req_id) {
- MAPS_LOGE(
-"\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
+ MAPS_LOGE("\n\nERROR! Incorrect request id [%d] come from the plugin; expected [%d]\n\n",
request_id, handler->plg_req_id);
}
pr.update(my_req_id, handler);
MAPS_LOGD("session::command_multi_reverse_geocode::run: %d", my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().
if (maps_coordinates_is_valid(pos)) {
position = pos;
- }
- else {
+ } else {
error = MAPS_ERROR_INVALID_PARAMETER;
*request_id = -1;
MAPS_LOGD("Invalid parameter");
pr.update(my_req_id, handler);
MAPS_LOGD("session::command_search_place::run: %d", my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().maps_plugin_search_place;
maps_place_h place,
void *user_data)
{
-
command_search_place_handler *handler =
(command_search_place_handler *) user_data;
if (maps_area_is_valid(b)) {
boundary = b;
- }
- else {
+ } else {
error = MAPS_ERROR_INVALID_PARAMETER;
*request_id = -1;
}
user_data,
my_req_id);
if (handler) {
-
/* Run the plugin interface function */
error = func(boundary, filter,
preference, command_search_place_handler::foreach_place_cb,
pr.update(my_req_id, handler);
MAPS_LOGD("session::command_search_by_area_place::run: %d", my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().
pr.update(my_req_id, handler);
MAPS_LOGD("session::command_search_by_address_place::run: %d", my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().
pr.update(my_req_id, handler);
MAPS_LOGD("session::command_search_place_list::run: %d", my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().maps_plugin_search_place_list;
MAPS_LOGD("session::command_get_place_details::run: %d",
my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().
void session::command_get_place_details_handler::foreach_place_details_cb(maps_error_e error,
int request_id, maps_place_h place, void *user_data)
{
-
command_get_place_details_handler *handler =
(command_get_place_details_handler *) user_data;
if (maps_coordinates_is_valid(orig)) {
origin = orig;
- }
- else {
+ } else {
error = MAPS_ERROR_INVALID_PARAMETER;
}
if (maps_coordinates_is_valid(dest)) {
destination = dest;
- }
- else {
+ } else {
error = MAPS_ERROR_INVALID_PARAMETER;
}
/* No need to create the handler when the function is NULL */
pr.add(my_req_id);
handler = new command_search_route_handler(plugin(),
- callback,
- user_data,
- my_req_id);
+ callback, user_data, my_req_id);
if (handler) {
/* Run the plugin interface function */
error = func(origin, destination, preference,
- command_search_route_handler::foreach_route_cb,
- handler, &handler->plg_req_id);
+ command_search_route_handler::foreach_route_cb,
+ handler, &handler->plg_req_id);
pr.update(my_req_id, handler);
MAPS_LOGD("session::command_search_route::run: %d", my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().maps_plugin_search_route;
pr.update(my_req_id, handler);
MAPS_LOGD("session::command_search_place::run: %d", my_req_id);
- }
- else {
+ } else {
error = MAPS_ERROR_OUT_OF_MEMORY;
}
- }
- else {
+ } else {
/* Plugin Function is NULL: use default empty function */
/*
func = plugin::get_empty_interface().
lat, lon);
}
- if(!v)
+ if (!v)
return MAPS_ERROR_INVALID_PARAMETER;
int error = MAPS_ERROR_NONE;
error = maps_view_set_center(v, c);
if(error != MAPS_ERROR_NONE)
break;
- } while(false);
+ } while (false);
const int ret = error;
destroy();
error = _maps_view_move_center(v, _delta_x, _delta_y);
if(error != MAPS_ERROR_NONE)
break;
- } while(false);
+ } while (false);
const int ret = error;
destroy();
int session::command_view_zoom::run()
{
- MAPS_LOGD ("session::command_view_zoom::run factor = %f", zoom_factor);
+ MAPS_LOGD("session::command_view_zoom::run factor = %f", zoom_factor);
if (!v)
return MAPS_ERROR_INVALID_PARAMETER;
- const int ret = maps_view_set_zoom_factor (v, zoom_factor);
+ const int ret = maps_view_set_zoom_factor(v, zoom_factor);
- destroy ();
+ destroy();
return ret;
}
command_view_zoom *cmd = (command_view_zoom *)c;
if (v == cmd->v) {
zoom_factor = cmd->zoom_factor;
- cmd->set_merged ();
+ cmd->set_merged();
}
}
/*----------------------------------------------------------------------------*/
int session::command_view_rotate::run()
{
- MAPS_LOGD ("session::command_view_rotate::run angle = %f",
+ MAPS_LOGD("session::command_view_rotate::run angle = %f",
rotation_angle);
if (!v)
const int ret = maps_view_set_orientation(v, rotation_angle);
- destroy ();
+ destroy();
return ret;
}
int session::command_view_zoom_rotate::run()
{
- MAPS_LOGD ("session::command_view_zoom_rotate::run "
+ MAPS_LOGD("session::command_view_zoom_rotate::run "
"factor = %f, angle = %f",
zoom_factor, rotation_angle);
true, zoom_factor,
true, rotation_angle);
- destroy ();
+ destroy();
return ret;
}
command_get_place_details() : command(NULL)
{
}
- command_get_place_details( const command_get_place_details &src)
+ command_get_place_details(const command_get_place_details &src)
: command(NULL)
{
}
session::thread::thread()
{
-
}
session::thread::~thread()
{
-
}
/* Thread function: pops the item from the queue and performs the command */
void *session::thread::queue_thread(void *data)
{
-
sleep(0); /* Just switch the thread to accomplish previous
initialization routines */
void session::thread::run(plugin::plugin_s *p)
{
-
if (!p)
return;
if (p->thread)
- return; /* Check whether the thread is already
- started, */
+ return; /* Check whether the thread is already started, */
/* Start if needed */
p->is_working = true;
Eina_Bool view::gesture_detector::__on_tap_timer(void *data)
{
gesture_detector *d = (gesture_detector *)data;
- if(!d)
+ if (!d)
return ECORE_CALLBACK_CANCEL;
d->log("------- TAP TIMER EVENT -------", FG_MAGENTA);
Eina_Bool view::gesture_detector::__on_long_press_timer(void *data)
{
gesture_detector *d = (gesture_detector *)data;
- if(!d)
+ if (!d)
return ECORE_CALLBACK_CANCEL;
d->log("------- LONG PRESS TIMER EVENT -------", FG_MAGENTA);
if(up_time < press_time)
return false; /* Not yet unpressed */
unsigned int press_duration = up_time - press_time;
- if((press_duration >= duration_min) && (press_duration <= duration_max))
+ if ((press_duration >= duration_min) && (press_duration <= duration_max))
return true;
return false;
}
FG_LITE_MAGENTA = 95,
FG_LITE_CYAN = 96,
FG_LITE_WHITE = 97
-
};
static void log(const char *str, log_colors color = FG_WHITE);
void log_map_center(int color = FG_LITE_BLUE);
void view::gesture_detector_statemachine::tap(int finger_no,
const touch_point &tp)
{
-
switch(finger_no) {
-
case 0: /* Single finger pressed */
_info._finger_down[0] = tp;
_info._finger_move[0] = tp;
const touch_point &tp)
{
switch(finger_no) {
-
case 0: /* Up the single finger */
_info._finger_up[0] = tp;
stop_long_press_timer();
switch(finger_no) {
-
case 0: /* Moving the first (single) finger */
_info._prev_finger_down[0] = _info._finger_move[0];
_info._finger_move[0] = tp;
detector_states_e old_state = _current_state;
switch(_current_state) {
-
case STATE_NONE: {
-
_info._start_view_state.capture(_view);
log_map_center(FG_WHITE);
if(finger_pressed_enough(0, 0, __CLICK_DURATION)) {
_current_state = STATE_CLICKED;
start_tap_timer();
- } else
+ } else {
_current_state = STATE_NONE;
+ }
break;
}
case LONG_PRESS_TIMER:
case STATE_SECOND_PRESSED: {
switch(event) {
case FINGER_UP: {
-
/* First click position */
const touch_point p1 = _info_history._finger_down[0];
* convenience
*/
- if(get_trajectory_effective_length(p1, p2)
- <= (4 * __CLICK_AREA)) {
-
+ if(get_trajectory_effective_length(p1, p2) <= (4 * __CLICK_AREA)) {
/* Switching to Double Tap state */
_current_state = STATE_SECOND_CLICKED;
* No need to expect other events here.
* Immediatelly switching to the initial State
*/
- _current_state = STATE_NONE;
+ _current_state = STATE_NONE;
} else {
/* Seems like it is a simple click */
_current_state = STATE_CLICKED;
stop_long_press_timer();
start_tap_timer();
}
-
break;
}
case TAP_TIMER:
}
case STATE_MOVING: {
-
if(event != FINGER_MOVE)
finish_panning(0);
}
case STATE_FINGER2_MOVING: {
-
if(event != FINGER2_MOVE)
finish_panning(1);
case STATE_FINGER1_PRESSED: {
switch(event) {
case FINGER_UP:
-
if(finger_pressed_enough(0, 0, __CLICK_DURATION)
&& finger_pressed_enough(1, 0, __CLICK_DURATION)){
_current_state = STATE_2FINGERS_CLICKED;
void view::gesture_detector_statemachine::log_state(view_event_e event,
detector_states_e state)
{
-
string e = get_event_str(event);
string s = get_state_str(state);
const double cur_r = sqrt(cur_dx * cur_dx + cur_dy * cur_dy) / 2;
/* Calculating the zoom factor */
- if((start_r != .0) && (cur_r != .0) && (start_r != cur_r)) {
+ if ((start_r != .0) && (cur_r != .0) && (start_r != cur_r)) {
if (cur_r > start_r)
_new_zoom_factor = (cur_r / start_r) - 1;
else
if (curl < 0) {
_new_rotation_angle = (angle / M_PI * 180.);
_rotation_happend = true;
- }
- else if (curl > 0) {
+ } else if (curl > 0) {
_new_rotation_angle = 360 - (angle / M_PI * 180.);
_rotation_happend = true;
}
case MAPS_VIEW_ACTION_SCROLL: {
maps_coordinates_h coords = c;
maps_coordinates_h center_clone = NULL;
- if(!coords) {
+ if (!coords) {
maps_view_get_center(_gd->_view, ¢er_clone);
coords = center_clone;
}
maps_coordinates_h coords = c;
maps_coordinates_h center_clone = NULL;
- if(!coords) {
+ if (!coords) {
maps_view_get_center(_gd->_view, ¢er_clone);
coords = center_clone;
}
}
case MAPS_VIEW_ACTION_ZOOM:
case MAPS_VIEW_ACTION_ROTATE: {
- if(zoom_changed & rotation_changed) {
+ if (zoom_changed & rotation_changed) {
MAPS_LOGD("rotation_angle=%f", rotation_angle);
- if(zoom_factor == .0)
+ if (zoom_factor == .0)
maps_view_get_zoom_factor(_gd->_view, &zoom_factor);
- if(rotation_angle == .0)
+ if (rotation_angle == .0)
maps_view_get_orientation(_gd->_view, &rotation_angle);
rotation_angle -= (int(rotation_angle) / 360) * 360;
return new session::command_view_zoom_rotate(get_maps(), _gd->_view, zoom_factor, rotation_angle);
- } else if(zoom_changed) {
- if(zoom_factor == .0)
+ } else if (zoom_changed) {
+ if (zoom_factor == .0)
maps_view_get_zoom_factor(_gd->_view, &zoom_factor);
MAPS_LOGI("\t set new zoom command: %f\n", zoom_factor);
return new session::command_view_zoom(get_maps(), _gd->_view, zoom_factor);
- } else if(rotation_changed) {
- if(rotation_angle == .0)
+ } else if (rotation_changed) {
+ if (rotation_angle == .0)
maps_view_get_orientation(_gd->_view, &rotation_angle);
rotation_angle -= (int(rotation_angle) / 360) * 360;
return new session::command_view_rotate(get_maps(), _gd->_view, rotation_angle);
/* Invoke user registered event callback */
maps_view_event_data_h ed = _maps_view_create_event_data(MAPS_VIEW_EVENT_GESTURE);
- if(ed) {
+ if (ed) {
_maps_view_event_data_set_gesture_type(ed, MAPS_VIEW_GESTURE_LONG_PRESS);
_maps_view_event_data_set_position(ed, tp._x, tp._y);
_maps_view_event_data_set_fingers(ed, 1);
/* Invoke user registered event callback */
maps_view_event_data_h ed = _maps_view_create_event_data(MAPS_VIEW_EVENT_GESTURE);
- if(ed) {
+ if (ed) {
_maps_view_event_data_set_gesture_type(ed, MAPS_VIEW_GESTURE_DOUBLE_TAP);
_maps_view_event_data_set_position(ed, tp._x, tp._y);
_maps_view_event_data_set_fingers(ed, 1);
/* Invoke user registered event callback */
maps_view_event_data_h ed = _maps_view_create_event_data(MAPS_VIEW_EVENT_GESTURE);
- if(ed) {
+ if (ed) {
_maps_view_event_data_set_gesture_type(ed, MAPS_VIEW_GESTURE_TAP);
_maps_view_event_data_set_position(ed, tp._x, tp._y);
_maps_view_event_data_set_fingers(ed, 1);
/* Invoke user registered event callback */
maps_view_event_data_h ed = _maps_view_create_event_data(MAPS_VIEW_EVENT_GESTURE);
- if(ed) {
+ if (ed) {
_maps_view_event_data_set_gesture_type(ed, MAPS_VIEW_GESTURE_2_FINGER_TAP);
_maps_view_event_data_set_position(ed, gesture_center._x, gesture_center._y);
_maps_view_event_data_set_fingers(ed, 2);
return;
touch_point prev_tp = _gd->_info._prev_finger_down[finger_no];
- if(prev_tp.empty())
+ if (prev_tp.empty())
prev_tp = _gd->_info._finger_down[finger_no];
/* a. Calculating the delta of the gesture */
/* Invoke user registered event callback */
maps_view_event_data_h ed = _maps_view_create_event_data(MAPS_VIEW_EVENT_GESTURE);
- if(ed) {
+ if (ed) {
_maps_view_event_data_set_gesture_type(ed, MAPS_VIEW_GESTURE_SCROLL);
_maps_view_event_data_set_position(ed, cur_tp._x, cur_tp._y);
_maps_view_event_data_set_fingers(ed, 1);
double new_zoom_factor = zc.get_zoom_factor();
/* Analyse zoom factor changes */
- if(zc.zoom_happend()) {
+ if (zc.zoom_happend()) {
/* Apply newly calculated zoom factor */
new_zoom_factor += _gd->_info._start_view_state._zoom_factor;
int max_zoom_level = 0;
maps_view_get_min_zoom_level(_gd->_view, &min_zoom_level);
maps_view_get_max_zoom_level(_gd->_view, &max_zoom_level);
- if(new_zoom_factor < min_zoom_level)
+ if (new_zoom_factor < min_zoom_level)
new_zoom_factor = min_zoom_level;
- if(new_zoom_factor > max_zoom_level)
+ if (new_zoom_factor > max_zoom_level)
new_zoom_factor = max_zoom_level;
/* Check if the zoom changed relatively to initial state */
double diff = _gd->_info._start_view_state._prev_zoom_factor - new_zoom_factor;
if ((!zoom_changed && (diff > 0.10 || diff < -0.10)) ||
- ( zoom_changed && (diff > 0.02 || diff < -0.02))) {
+ (zoom_changed && (diff > 0.02 || diff < -0.02))) {
_gd->_info._start_view_state._prev_zoom_factor = new_zoom_factor;
zoom_changed = true;
MAPS_LOGD("[zoom_changed] %f, %f -> %f",
diff, _gd->_info._start_view_state._prev_zoom_factor, new_zoom_factor);
- }
- else
+ } else {
zoom_changed = false;
+ }
}
- if(!zoom_changed)
+ if (!zoom_changed)
return false;
zoom_factor = new_zoom_factor;
double new_rotation_angle = zc.get_rotation_angle();
/* Analyze rotation angle changes */
- if(zc.rotation_happend()) {
+ if (zc.rotation_happend()) {
/* Apply newly calculated rotation angle */
new_rotation_angle += _gd->_info._start_view_state._rotation_angle;
/* Check if the zoom changed relatively to initial state */
double diff = calc_angle(_gd->_info._start_view_state._prev_rotation_angle, new_rotation_angle);
if ((!rotation_changed && (diff > 4.0 || diff < -4.0)) ||
- ( rotation_changed && (diff > 0.5 || diff < -0.5))) {
+ (rotation_changed && (diff > 0.5 || diff < -0.5))) {
_gd->_info._start_view_state._prev_rotation_angle = new_rotation_angle;
rotation_changed = true;
MAPS_LOGD("[rotation_changed] %f, %f -> %f",
diff, _gd->_info._start_view_state._prev_rotation_angle, new_rotation_angle);
- }
- else
+ } else {
rotation_changed = false;
+ }
}
- if(!rotation_changed)
+ if (!rotation_changed)
return false; // Seems nothing changed, we can return
rotation_angle = new_rotation_angle;
_maps_view_event_data_set_rotation_angle(ed, rotation_angle);
_maps_view_invoke_event_callback(_gd->_view, ed);
}
- maps_view_event_data_destroy(ed);
+ maps_view_event_data_destroy(ed);
}
}
#else
void view::finger_event_stream::set_gesture_detector(gesture_detector *d)
{
- if(!d)
+ if (!d)
return;
- if(d != _d) {
+ if (d != _d) {
_d->halt_gesture();
delete _d;
_d = d;
view::finger_event_stream::~finger_event_stream()
{
- if(_d) {
+ if (_d) {
_d->halt_gesture();
delete _d;
}
void view::finger_event_stream::tap(Evas_Event_Mouse_Down *ev)
{
MAPS_LOGI("finger_event_stream::tap");
- if(!ev)
+ if (!ev)
return;
/*
* so we have to skip this "late" event "press" for the sake of
* detector simplicity
*/
- if(_finger_pressed[0]) {
+ if (_finger_pressed[0]) {
MAPS_LOGI("finger_event_stream::tap [SKIPED]");
return;
}
void view::finger_event_stream::move(Evas_Event_Mouse_Move *ev)
{
- if(!ev)
+ if (!ev)
return;
/* Current touch point info */
* so we have to emulate the "press" for the sake of
* detector simplicity
*/
- if(!_finger_pressed[0]) {
+ if (!_finger_pressed[0]) {
MAPS_LOGI("finger_event_stream::tap [CORRECTION]");
_finger_pressed[0] = true;
_finger_down[0] = tp;
/* It's needed to correct the touch point, when the finger moved out of
* assigned movement threshold */
- if(!_finger_moving[0] && !_finger_moving[1]
+ if (!_finger_moving[0] && !_finger_moving[1]
&& finger_dragged_enough(0, tp)) {
_d->_info._finger_down[0] = tp;
}
* We think that the movement happend when the finger moved out of
* some small area.
*/
- if(_finger_moving[0] || _finger_moving[1]
+ if (_finger_moving[0] || _finger_moving[1]
|| finger_dragged_enough(0, tp)) {
-
_finger_moving[0] = true;
/* Process finger move */
void view::finger_event_stream::up(Evas_Event_Mouse_Up *ev)
{
MAPS_LOGI("finger_event_stream::up");
- if(!ev)
+ if (!ev)
return;
/* Process finger up */
void view::finger_event_stream::multi_tap(Evas_Event_Multi_Down *ev)
{
MAPS_LOGI("finger_event_stream::multi_tap");
- if(!ev)
+ if (!ev)
return;
const int finger_no = ev->device;
- if(finger_no >= MAX_FINGERS)
+ if (finger_no >= MAX_FINGERS)
return;
/* Current touch point info */
* so we have to skip this "late" event "press" for the sake of
* detector simplicity
*/
- if(_finger_pressed[finger_no]) {
+ if (_finger_pressed[finger_no]) {
MAPS_LOGI("finger_event_stream::multi_tap [SKIPED]");
return;
}
void view::finger_event_stream::multi_move(Evas_Event_Multi_Move *ev)
{
- if(!ev)
+ if (!ev)
return;
const int finger_no = ev->device;
- if(finger_no >= MAX_FINGERS)
+ if (finger_no >= MAX_FINGERS)
return;
/* Current touch point info */
* so we have to emulate the "press" for the sake of
* detector simplicity
*/
- if(!_finger_pressed[finger_no]) {
+ if (!_finger_pressed[finger_no]) {
MAPS_LOGI("finger_event_stream::multi_tap [CORRECTION]");
_finger_pressed[finger_no] = true;
_finger_down[finger_no] = tp;
/* It's needed to correct the touch point, when the finger moved out of
* assigned movement threshold */
- if(!_finger_moving[0] && !_finger_moving[1]
+ if (!_finger_moving[0] && !_finger_moving[1]
&& finger_dragged_enough(finger_no, tp)) {
_d->_info._finger_down[finger_no] = tp;
}
* We think that the movement happend when the finger moved out of
* some small area.
*/
- if(_finger_moving[0] || _finger_moving[1]
+ if (_finger_moving[0] || _finger_moving[1]
|| finger_dragged_enough(finger_no, tp)) {
_finger_moving[finger_no] = true;
void view::finger_event_stream::multi_up(Evas_Event_Multi_Up *ev)
{
MAPS_LOGI("finger_event_stream::multi_up");
- if(!ev)
+ if (!ev)
return;
const int finger_no = ev->device;
- if(finger_no >= MAX_FINGERS)
+ if (finger_no >= MAX_FINGERS)
return;
/* Process finger up */
void view::inertial_camera::set_cur_state()
{
- if(!_view)
+ if (!_view)
return;
- if(!cur_center)
+ if (!cur_center)
maps_coordinates_destroy(cur_center);
maps_view_get_center(_view, &cur_center);
maps_view_get_zoom_factor(_view, &cur_zoom_factor);
const double &zoom_factor,
const double &rotation_angle)
{
- if(!_view)
+ if (!_view)
return;
/* Store the targets */
- if(!target_center)
+ if (!target_center)
maps_coordinates_destroy(target_center);
maps_coordinates_clone(center, &target_center);
target_rotation_angle = rotation_angle;
/* Store current state */
- if(!transiting)
+ if (!transiting)
set_cur_state();
/* Start transition */
void view::inertial_camera::set_center_target(const maps_coordinates_h center)
{
- if(!_view)
+ if (!_view)
return;
/* Store the target */
- if(!target_center)
+ if (!target_center)
maps_coordinates_destroy(target_center);
maps_coordinates_clone(center, &target_center);
/* Store current state */
- if(!transiting)
+ if (!transiting)
set_cur_state();
/* Start transition */
void view::inertial_camera::set_zoom_target(const double &zoom_factor)
{
- if(!_view)
+ if (!_view)
return;
/* Store the target */
target_zoom_factor = zoom_factor;
/* Store current state */
- if(!transiting)
+ if (!transiting)
set_cur_state();
/* Start transition */
void view::inertial_camera::set_rotation_target(const double &rotation_angle)
{
- if(!_view)
+ if (!_view)
return;
/* Store the target */
target_rotation_angle = rotation_angle;
/* Store current state */
- if(!transiting)
+ if (!transiting)
set_cur_state();
/* Start transition */
const double &finish,
const double step_ratio) const
{
- if(start == finish)
+ if (start == finish)
return start;
/* Expanential transition */
double step = (finish - start) * step_ratio;
double new_pos = start + step;
- if(finish > start) {
+ if (finish > start) {
new_pos = MAX(new_pos, start);
new_pos = MIN(new_pos, finish);
} else {
const double &finish,
const double step_ratio) const
{
- if(start == finish)
+ if (start == finish)
return start;
double _f = finish;
bool view::inertial_camera::next_transition_step()
{
- if(!_view)
+ if (!_view)
return false;
transiting = false;
/* Transiting zoom */
cur_zoom_factor = calc_next_step(cur_zoom_factor, target_zoom_factor, .2);
- if(ABS(cur_zoom_factor - target_zoom_factor) > __ZOOM_ACCURACY)
+ if (ABS(cur_zoom_factor - target_zoom_factor) > __ZOOM_ACCURACY)
transiting = true;
else
cur_zoom_factor = target_zoom_factor;
/* Transizint orientation */
- if(target_rotation_angle - cur_rotation_angle > 180.)
+ if (target_rotation_angle - cur_rotation_angle > 180.)
target_rotation_angle -= 360.;
- else if(target_rotation_angle - cur_rotation_angle < -180.)
+ else if (target_rotation_angle - cur_rotation_angle < -180.)
target_rotation_angle += 360.;
cur_rotation_angle = calc_next_step(cur_rotation_angle, target_rotation_angle, .5);
- if(ABS(cur_rotation_angle - target_rotation_angle) > __ROTATE_ACCURACY)
+ if (ABS(cur_rotation_angle - target_rotation_angle) > __ROTATE_ACCURACY)
transiting = true;
else
cur_rotation_angle = target_rotation_angle;
{
//_maps_view_set_idle_listener(_view, NULL, NULL);
- if(_d)
+ if (_d)
delete _d;
_d = NULL;
}
_maps_view_halt_inertial_camera(_view);
- if(transiting) { /* Halt the transition */
- for(int i = 0; i < MAX_FINGERS; i ++) {
- if(!transiting_part[i])
+ if (transiting) { /* Halt the transition */
+ for (int i = 0; i < MAX_FINGERS; i ++) {
+ if (!transiting_part[i])
continue;
unsigned int timestamp = _last[i]._timestamp + get_transition_time(i);
_cur_x[finger_no] = tp._x;
_cur_y[finger_no] = tp._y;
- if(_d)
+ if (_d)
_d->tap(finger_no, tp);
}
_cur_x[finger_no] = tp._x;
_cur_y[finger_no] = tp._y;
- if(_d)
+ if (_d)
_d->move(finger_no, tp);
}
MAPS_LOGD("trajectory=%d", trajectory);
if (trajectory <= 5) dt = 0;
- if(dt == 0) {
+ if (dt == 0) {
_derivative_x[finger_no] = .0;
_derivative_y[finger_no] = .0;
} else {
transiting = false;
//static const double dt = 1.;
- for(int i = 0; i < MAX_FINGERS; i ++) {
- if(!transiting_part[i])
+ for (int i = 0; i < MAX_FINGERS; i ++) {
+ if (!transiting_part[i])
continue;
transiting_part[i] = false;
- if(ABS(_derivative_x[i]) > __ACCURACY) {
+ if (ABS(_derivative_x[i]) > __ACCURACY) {
_cur_x[i] = get_next_point(_cur_x[i], _derivative_x[i], _dt[i]);
_derivative_x[i] = get_next_derivative(_derivative_x[i], _dt[i]);
transiting_part[i] |= ABS(_derivative_x[i]) > __ACCURACY;
}
- if(ABS(_derivative_y[i]) > __ACCURACY) {
+ if (ABS(_derivative_y[i]) > __ACCURACY) {
_cur_y[i] = get_next_point(_cur_y[i], _derivative_y[i], _dt[i]);
_derivative_y[i] = get_next_derivative(_derivative_y[i], _dt[i]);
transiting_part[i] |= ABS(_derivative_y[i]) > __ACCURACY;
unsigned int timestamp = _last[i]._timestamp + get_transition_time(i);
const touch_point tp(_cur_x[i], _cur_y[i], timestamp);
- if(transiting_part[i]) {
+ if (transiting_part[i]) {
MAPS_LOGI("TRANSITION finger %d move FAKE time: %d", i, tp._timestamp);
_d->move(i, tp);
} else {
step in transient is needed */
}
- if(!transiting)
+ if (!transiting)
reset();
return transiting;
const double &dt)
{
/* Simple square parabola */
- /*if(derivative > 0)
+ /*if (derivative > 0)
return (derivative + __ACCEL * dt);
else
return (derivative - __ACCEL * dt);*/
/* Exponential spped down */
- if(_d->_info._fingers_pressed <= 1)
+ if (_d->_info._fingers_pressed <= 1)
return (derivative * .9);
else
return (derivative * .5);
void view::inertial_gesture::on_idle(void *data)
{
inertial_gesture *ig = (inertial_gesture *)data;
- if(ig && ig->transiting) {
+ if (ig && ig->transiting) {
MAPS_LOGI("TRANSITION on idle");
ig->next_transition_step();
g_usleep(5*1000);
void view::inertial_gesture::reset()
{
transiting = false;
- for(int i = 0; i < MAX_FINGERS; i ++) {
+ for (int i = 0; i < MAX_FINGERS; i ++) {
transiting_part[i] = false;
transiting_start[i] = 0;
}
/* SUCCESS */
return marker;
-
- } while(false);
+ } while (false);
/* FAILURE: Releasing objects */
maps_view_object_destroy(marker);
bool view::poly_shape_hit_test::hit_test(const float x, const float y,
const bool polygon, const int w) const
{
- if(__x.empty())
+ if (__x.empty())
return false;
/* 1. Check if the point in the bounding box of a poly-figure */
- if(!hit_test_bounding_box(x, y))
+ if (!hit_test_bounding_box(x, y))
return false;
/* 2. Check if the point near the polyline */
- if(hit_test_polyline(x, y, polygon, w))
+ if (hit_test_polyline(x, y, polygon, w))
return true;
/* 3. Check if the point near the vertices */
- if(hit_test_vertices(x, y))
+ if (hit_test_vertices(x, y))
return true;
/* 4. Check if the point inside the polygon (for polygon only) */
- if(polygon)
- if(pnpoly(x, y))
+ if (polygon)
+ if (pnpoly(x, y))
return true;
return false;
float x_max = 1. * FLT_MIN;
float y_min = 1. * FLT_MAX;
float y_max = 1. * FLT_MIN;
- for(unsigned int i = 0; i < __x.size(); i ++) {
- if(__x[i] < x_min)
+ for (unsigned int i = 0; i < __x.size(); i ++) {
+ if (__x[i] < x_min)
x_min = __x[i];
- if(__x[i] > x_max)
+ if (__x[i] > x_max)
x_max = __x[i];
- if(__y[i] < y_min)
+ if (__y[i] < y_min)
y_min = __y[i];
- if(__y[i] > y_max)
+ if (__y[i] > y_max)
y_max = __y[i];
}
x_min -= accuracy;
float a = x2 - x1;
float b = y2 - y1;
float c = sqrt(a * a + b * b);
- if(c == 0)
+ if (c == 0)
return false;
float sina = b / c;
float cosa = a / c;
float x_rotated = x_shifted * cosa + y_shifted * sina;
float y_rotated = x_shifted * sina - y_shifted * cosa;
- if((x_rotated >= 0) && (x_rotated <= c)
+ if ((x_rotated >= 0) && (x_rotated <= c)
&& (y_rotated >= (-1. * (accuracy + w / 2)))
&& (y_rotated <= (accuracy + w / 2)))
return true;
bool view::poly_shape_hit_test::hit_test_polyline(const float x, const float y,
const bool polygon, const int w) const
{
- if(__x.size() < 1)
+ if (__x.size() < 1)
return false;
- for(unsigned int i = 1; i < __x.size(); i ++) {
-
- if(hit_test_segment(__x[i - 1], __y[i - 1],
+ for (unsigned int i = 1; i < __x.size(); i ++) {
+ if (hit_test_segment(__x[i - 1], __y[i - 1],
__x[i], __y[i], x, y, w))
return true;
}
- if(polygon) {
+ if (polygon) {
/* Final section */
- if(hit_test_segment(__x[__x.size() - 1], __y[__x.size() - 1],
+ if (hit_test_segment(__x[__x.size() - 1], __y[__x.size() - 1],
__x[0], __y[0], x, y))
return true;
}
bool view::poly_shape_hit_test::hit_test_vertices(const float x, const float y) const
{
- for(unsigned int i = 0; i < __x.size(); i ++) {
+ for (unsigned int i = 0; i < __x.size(); i ++) {
float cur_x_min = __x[i] - accuracy;
float cur_x_max = __x[i] + accuracy;
float cur_y_min = __y[i] - accuracy;
float cur_y_max = __y[i] + accuracy;
- if((x >= cur_x_min) && (x <= cur_x_max)
+ if ((x >= cur_x_min) && (x <= cur_x_max)
&& (y >= cur_y_min) && (y <= cur_y_max))
return true;
}
/* SUCCESS */
return polygon;
-
- } while(false);
+ } while (false);
/* FAILURE: Releasing objects */
maps_view_object_destroy(polygon);
/* SUCCESS */
return polyline;
-
- } while(false);
+ } while (false);
/* FAILURE: Releasing objects */
maps_view_object_destroy(polyline);
int cnt = 0;
for(unsigned int i = 0; i < MAX_FINGERS; i ++)
if(_is_finger_pressed[i])
- cnt ++;
+ cnt++;
return cnt;
}