From: chanywa Date: Fri, 10 Feb 2017 11:24:39 +0000 (+0900) Subject: add APIs to set and get scale of the whole map X-Git-Tag: submit/tizen/20170213.034030^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=244d47870cfde89fb8b889bd177fee3f9cbcb88d;p=platform%2Fcore%2Fapi%2Fmaps-service.git add APIs to set and get scale of the whole map Change-Id: I7e8ec3d641860e2f3ba458c29d32864e6e0f4656 --- diff --git a/capi-maps-service.changes b/capi-maps-service.changes index 4b6508e..16ad586 100644 --- a/capi-maps-service.changes +++ b/capi-maps-service.changes @@ -1,3 +1,8 @@ +[Version] capi-maps-service_0.6.10 +[Date] 10 Feb 2017 +[Title] add APIs to set and get scale of the whole map +[Developer] Seechan Kim + [Version] capi-maps-service_0.6.9 [Date] 24 Nov 2016 [Title] added an api for plugins to get length of maps_item_list_h diff --git a/include/maps_view_plugin.h b/include/maps_view_plugin.h index d5d7742..8014181 100644 --- a/include/maps_view_plugin.h +++ b/include/maps_view_plugin.h @@ -133,6 +133,46 @@ int maps_view_get_maps_plugin_view_handle(maps_view_h view, void **maps_plugin_v */ int maps_view_set_maps_plugin_view_handle(maps_view_h view, void *maps_plugin_view_handle); +/** + * @brief Gets the scale factor of View. + * @details This function gets the current scale factor of View. + * @since_tizen 4.0 + * + * @param[in] view The view handle + * @param[out] scale The pointer to a double in which to store the + * current scale factor + * @return 0 on success, otherwise a negative error value + * @retval #MAPS_ERROR_NONE Successful + * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported + * + * @pre @a view is created using maps_view_create(). + * + * @see maps_view_set_scale_factor() + * @see maps_view_create() + */ +int maps_view_get_scale_factor(maps_view_h view, double *scale_factor); + +/** + * @brief Sets the scale factor of View. + * @details This function sets the current scale factor of View. + * @remarks View is resizable based on this scale factor. + * @since_tizen 4.0 + * + * @param[in] view The view handle + * @param[in] scale The new scale factor [0.1 ~ 10.0] + * @return 0 on success, otherwise a negative error value + * @retval #MAPS_ERROR_NONE Successful + * @retval #MAPS_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #MAPS_ERROR_NOT_SUPPORTED Not supported + * + * @pre @a view is created using maps_view_create(). + * + * @see maps_view_get_scale_factor() + * @see maps_view_create() + */ +int maps_view_set_scale_factor(maps_view_h view, double scale_factor); + #ifdef __cplusplus } #endif diff --git a/packaging/capi-maps-service.spec b/packaging/capi-maps-service.spec index a633229..0460bf6 100644 --- a/packaging/capi-maps-service.spec +++ b/packaging/capi-maps-service.spec @@ -1,6 +1,6 @@ Name: capi-maps-service Summary: Tizen Maps Service API -Version: 0.6.9 +Version: 0.6.10 Release: 1 Group: Location/API License: Apache-2.0 diff --git a/src/api/maps_view.cpp b/src/api/maps_view.cpp index 0499982..df89374 100644 --- a/src/api/maps_view.cpp +++ b/src/api/maps_view.cpp @@ -1878,26 +1878,60 @@ maps_view_object_h _maps_view_object_hit_test(maps_view_h view, int x, int y, ma return htd.object; } -EXPORT_API int maps_view_get_maps_plugin_view_handle(maps_view_h hView, void **maps_plugin_view_handle) +EXPORT_API int maps_view_get_maps_plugin_view_handle(maps_view_h view, void **maps_plugin_view_handle) { if (!maps_condition_check_maps_feature()) return MAPS_ERROR_NOT_SUPPORTED; - if (!hView || !maps_plugin_view_handle) + if (!view || !maps_plugin_view_handle) return MAPS_ERROR_INVALID_PARAMETER; - maps_view_s *v = (maps_view_s *)hView; + maps_view_s *v = (maps_view_s *)view; *maps_plugin_view_handle = v->maps_plugin_view_handle; return MAPS_ERROR_NONE; } -EXPORT_API int maps_view_set_maps_plugin_view_handle(maps_view_h hView, void *maps_plugin_view_handle) +EXPORT_API int maps_view_set_maps_plugin_view_handle(maps_view_h view, void *maps_plugin_view_handle) { if (!maps_condition_check_maps_feature()) return MAPS_ERROR_NOT_SUPPORTED; - if (!hView) + if (!view) return MAPS_ERROR_INVALID_PARAMETER; - maps_view_s *v = (maps_view_s *)hView; + maps_view_s *v = (maps_view_s *)view; v->maps_plugin_view_handle = maps_plugin_view_handle; return MAPS_ERROR_NONE; } + +EXPORT_API int maps_view_get_scale_factor(maps_view_h view, double *scale_factor) +{ + if (!maps_condition_check_maps_feature()) + return MAPS_ERROR_NOT_SUPPORTED; + if (!view || !scale_factor) + return MAPS_ERROR_INVALID_PARAMETER; + + const plugin::interface_s *plugin = __get_plugin_interface(view); + if (!plugin) + return MAPS_ERROR_INVALID_PARAMETER; + if (!plugin->maps_plugin_get_view_scale_factor) + return MAPS_ERROR_NOT_SUPPORTED; + return plugin->maps_plugin_get_view_scale_factor(view, scale_factor); +} + +EXPORT_API int maps_view_set_scale_factor(maps_view_h view, double scale_factor) +{ + if (!maps_condition_check_maps_feature()) + return MAPS_ERROR_NOT_SUPPORTED; + if (!view) + return MAPS_ERROR_INVALID_PARAMETER; + if (scale_factor < 0.1 || scale_factor > 10.0) + return MAPS_ERROR_INVALID_PARAMETER; + + const plugin::interface_s *plugin = __get_plugin_interface(view); + if (!plugin) + return MAPS_ERROR_INVALID_PARAMETER; + if (!plugin->maps_plugin_set_view_scale_factor) + return MAPS_ERROR_NOT_SUPPORTED; + + return plugin->maps_plugin_set_view_scale_factor(view, scale_factor); +} + diff --git a/src/plugin/empty_module.cpp b/src/plugin/empty_module.cpp index 8c52ab4..1f87a8a 100644 --- a/src/plugin/empty_module.cpp +++ b/src/plugin/empty_module.cpp @@ -270,6 +270,17 @@ int maps_plugin_capture_snapshot_empty(maps_view_h view, void **data, int *width return 0; } +int maps_plugin_get_view_scale_factor_empty(maps_view_h view, double *scale_factor) +{ + return 0; +} + +int maps_plugin_set_view_scale_factor_empty(maps_view_h view, double scale_factor) +{ + return 0; +} + + /* Interface of a plugin with all empty functions */ plugin::interface_s empty_interface = { /* Plugin dedicated functions */ @@ -321,6 +332,8 @@ plugin::interface_s empty_interface = { maps_plugin_get_max_zoom_level_empty, maps_plugin_get_center_empty, maps_plugin_capture_snapshot_empty, + maps_plugin_get_view_scale_factor_empty, + maps_plugin_set_view_scale_factor_empty, }; diff --git a/src/plugin/module.cpp b/src/plugin/module.cpp index 3275878..f5a8bf5 100644 --- a/src/plugin/module.cpp +++ b/src/plugin/module.cpp @@ -233,6 +233,12 @@ maps_plugin_h plugin::binary_extractor::init(const provider_info &info, new_plugin->interface.maps_plugin_capture_snapshot = (maps_plugin_capture_snapshot_f) gmod_find_sym(plugin, "maps_plugin_capture_snapshot"); + new_plugin->interface.maps_plugin_get_view_scale_factor = + (maps_plugin_get_view_scale_factor_f) gmod_find_sym(plugin, + "maps_plugin_get_view_scale_factor"); + new_plugin->interface.maps_plugin_set_view_scale_factor = + (maps_plugin_set_view_scale_factor_f) gmod_find_sym(plugin, + "maps_plugin_set_view_scale_factor"); /* 2.3 Check whether the plugin init function is valid */ if (!new_plugin->interface.maps_plugin_init) { diff --git a/src/plugin/module.h b/src/plugin/module.h index 3905e9c..5e28f0b 100644 --- a/src/plugin/module.h +++ b/src/plugin/module.h @@ -133,6 +133,8 @@ typedef int (*maps_plugin_get_max_zoom_level_f) (maps_view_h view, int *max_zoom typedef int (*maps_plugin_get_center_f) (maps_view_h view, maps_coordinates_h *coordinates); typedef int (*maps_plugin_capture_snapshot_f) (maps_view_h view, void **data, int *width, int *height, maps_view_colorspace_type_e *cs); +typedef int (*maps_plugin_get_view_scale_factor_f) (maps_view_h view, double *scale_factor); +typedef int (*maps_plugin_set_view_scale_factor_f) (maps_view_h view, double scale_factor); namespace plugin { @@ -188,6 +190,8 @@ typedef struct _interface_s { maps_plugin_get_max_zoom_level_f maps_plugin_get_max_zoom_level; maps_plugin_get_center_f maps_plugin_get_center; maps_plugin_capture_snapshot_f maps_plugin_capture_snapshot; + maps_plugin_get_view_scale_factor_f maps_plugin_get_view_scale_factor; + maps_plugin_set_view_scale_factor_f maps_plugin_set_view_scale_factor; } interface_s; /* Plugin structure */