[ACR-591] Map Widget APIs for drawing and controlling 41/67041/13
authorchanywa <cbible.kim@samsung.com>
Mon, 25 Apr 2016 01:05:31 +0000 (10:05 +0900)
committerchanywa <cbible.kim@samsung.com>
Mon, 23 May 2016 02:46:47 +0000 (11:46 +0900)
Change-Id: If73c613b51e3481f6f14b77bc269e28389da4bee

include/maps_service.h
include/maps_view.h
include/maps_view_event_data.h
src/api/maps_view.cpp
src/view/gesture_detector_statemachine.cpp
src/view/gesture_processor.cpp
src/view/gesture_processor.h

index c6e5d0a..f7b5d7f 100644 (file)
@@ -67,9 +67,11 @@ typedef enum _maps_service_e {
        MAPS_SERVICE_SEARCH_ROUTE,                              /**< Indicates that maps_service_search_route() service is allowed */
        MAPS_SERVICE_SEARCH_ROUTE_WAYPOINTS,    /**< Indicates that maps_service_search_route_waypoints() service is allowed */
        MAPS_SERVICE_CANCEL_REQUEST,                    /**< Indicates that maps_service_cancel_request() service is allowed */
-       MAPS_SERVICE_MULTI_REVERSE_GEOCODE,             /**< Indicates that maps_service_multi_reverse_geocode() service is allowed (Since 3.0)*/
-       MAPS_SERVICE_SEARCH_PLACE_LIST,                 /**< Indicates that maps_service_search_place_list() service is allowed (Since 3.0) */
-       MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS   /**< Indicates that maps_service_search_get_place_details() service is allowed (Since 3.0) */
+       MAPS_SERVICE_MULTI_REVERSE_GEOCODE,             /**< Indicates that maps_service_multi_reverse_geocode() service is allowed @if MOBILE (Since 3.0) @endif */
+       MAPS_SERVICE_SEARCH_PLACE_LIST,                 /**< Indicates that maps_service_search_place_list() service is allowed @if MOBILE (Since 3.0) @endif */
+       MAPS_SERVICE_SEARCH_GET_PLACE_DETAILS,  /**< Indicates that maps_service_search_get_place_details() service is allowed @if MOBILE (Since 3.0) @endif */
+
+       MAPS_SERVICE_VIEW = 0x100                               /**< Indicates that maps view service is allowed @if MOBILE (Since 3.0) @endif */
 } maps_service_e;
 
 /**
@@ -89,7 +91,12 @@ typedef enum _maps_service_data_e {
        MAPS_PLACE_RELATED,             /**< Indicates the availability of related place link in the Place data */
        MAPS_ROUTE_PATH,                /**< Indicates that the Route Data Structure is defined as a Path (a list of geographical coordinates) */
        MAPS_ROUTE_SEGMENTS_PATH,               /**< Indicates that the Route Data Structure is defined as a list of Segments while each segment is defined as a Path */
-       MAPS_ROUTE_SEGMENTS_MANEUVERS   /**< Indicates that the Route Data Structure is defined as a list of Segments while each segment is defined as a list of Maneuvers*/
+       MAPS_ROUTE_SEGMENTS_MANEUVERS,  /**< Indicates that the Route Data Structure is defined as a list of Segments while each segment is defined as a list of Maneuvers*/
+
+       MAPS_VIEW_TRAFFIC = 0x100,      /**< Indicates the availability of traffic information on the Map @if MOBILE (Since 3.0) @endif */
+       MAPS_VIEW_PUBLIC_TRANSIT,       /**< Indicates the availability of public transit information on the Map @if MOBILE (Since 3.0) @endif */
+       MAPS_VIEW_BUILDING,             /**< Indicates the availability of 3D building drawable on the Map @if MOBILE (Since 3.0) @endif */
+       MAPS_VIEW_SCALEBAR              /**< Indicates the availability of scale bar on the Map @if MOBILE (Since 3.0) @endif */
 } maps_service_data_e;
 
 /**
@@ -360,6 +367,7 @@ int maps_service_provider_is_data_supported(const maps_service_h maps,
                                            maps_service_data_e data,
                                            bool *supported);
 
+
 /*----------------------------------------------------------------------------*/
 /*
  * Cancel Service Request
index 9ceda49..cb2d37d 100644 (file)
@@ -494,13 +494,17 @@ int maps_view_set_type(maps_view_h view, maps_view_type_e type);
 int maps_view_get_type(const maps_view_h view, maps_view_type_e *type);
 
 /**
- * @brief      Enables or disables 3D buildings.
- * @details This function enables or disables 3D buildings on the View.
+ * @brief      Indicates whether the map should show the 3D buildings layer.
+ * @details This function is called to indicate whether 3D buildings
+ * should be shown as a layer on the map.
  * @since_tizen 3.0
  * @privlevel public
  * @privilege %http://tizen.org/privilege/mapservice \n
  *            %http://tizen.org/privilege/internet \n
  *            %http://tizen.org/privilege/network.get
+ * @remarks    To check if Maps Provider is capable of drawing 3D buildings,
+ * use maps_service_provider_is_data_supported() with
+ * #MAPS_VIEW_BUILDING passed as a service data parameter.
  *
  * @param[in]  view            The view handle
  * @param[in]  enable          The enable status
@@ -510,18 +514,19 @@ int maps_view_get_type(const maps_view_h view, maps_view_type_e *type);
  * @retval     #MAPS_ERROR_PERMISSION_DENIED Permission Denied
  * @retval     #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
  * @retval     #MAPS_ERROR_NETWORK_UNREACHABLE Network unavailable
- * @retval  #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
  *
  * @pre @a view is created using maps_view_create().
  *
  * @see maps_view_create()
  * @see maps_view_get_buildings_enabled()
+ * @see maps_service_provider_is_data_supported()
  */
 int maps_view_set_buildings_enabled(maps_view_h view, bool enable);
 
 /**
- * @brief      Gets whether 3D buildings are enabled or not.
- * @details This function gets whether 3D buildings are enabled or not.
+ * @brief      Queries whether the map has the 3D buildings layer enabled.
+ * @details    This function checks whether the map is set to show the 3D buildings layer.
  * @since_tizen 3.0
  *
  * @param[in]  view    The view handle
@@ -532,20 +537,24 @@ int maps_view_set_buildings_enabled(maps_view_h view, bool enable);
  *
  * @pre @a view is created using maps_view_create().
  *
- * @see maps_view_set_view_mode()
  * @see maps_view_create()
  * @see maps_view_set_buildings_enabled()
+ * @see maps_service_provider_is_data_supported()
  */
 int maps_view_get_buildings_enabled(const maps_view_h view, bool *enable);
 
 /**
- * @brief      Turns the traffic layer on or off.
- * @details This function turns the traffic layer on or off.
+ * @brief      Indicates whether the map should show the traffic layer.
+ * @details This function is called to indicate whether traffic conditions
+ * should be shown as a layer on the map.
  * @since_tizen 3.0
  * @privlevel public
  * @privilege %http://tizen.org/privilege/mapservice \n
  *            %http://tizen.org/privilege/internet \n
  *            %http://tizen.org/privilege/network.get
+ * @remarks    To check if Maps Provider is capable of drawing traffic conditions,
+ * use maps_service_provider_is_data_supported() with
+ * #MAPS_VIEW_TRAFFIC passed as a service data parameter.
  *
  * @param[in]  view            The view handle
  * @param[in]  enable          The enable status
@@ -555,17 +564,19 @@ int maps_view_get_buildings_enabled(const maps_view_h view, bool *enable);
  * @retval     #MAPS_ERROR_PERMISSION_DENIED Permission Denied
  * @retval     #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
  * @retval     #MAPS_ERROR_NETWORK_UNREACHABLE Network unavailable
- * @retval  #MAPS_ERROR_NOT_SUPPORTED Not supported
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
  *
  * @pre @a view is created using maps_view_create().
  *
  * @see maps_view_create()
+ * @see maps_view_get_traffic_enabled()
+ * @see maps_service_provider_is_data_supported()
  */
 int maps_view_set_traffic_enabled(maps_view_h view, bool enable);
 
 /**
- * @brief      Gets whether the map is drawing traffic data.
- * @details This function gets whether the map is drawing traffic data or not.
+ * @brief      Queries whether the map has the traffic layer enabled.
+ * @details    This function checks whether the map is set to show the traffic layer.
  * @since_tizen 3.0
  *
  * @param[in]  view    The view handle
@@ -576,12 +587,63 @@ int maps_view_set_traffic_enabled(maps_view_h view, bool enable);
  *
  * @pre @a view is created using maps_view_create().
  *
- * @see maps_view_set_view_mode()
  * @see maps_view_create()
+ * @see maps_view_set_traffic_enabled()
+ * @see maps_service_provider_is_data_supported()
  */
 int maps_view_get_traffic_enabled(const maps_view_h view, bool *enable);
 
 /**
+ * @brief      Indicates whether the map should show the public transit layer.
+ * @details This function is called to indicate whether public transit routes
+ * should be shown as a layer on the map.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/mapservice \n
+ *            %http://tizen.org/privilege/internet \n
+ *            %http://tizen.org/privilege/network.get
+ * @remarks    To check if Maps Provider is capable of drawing public transit routes,
+ * use maps_service_provider_is_data_supported() with
+ * #MAPS_VIEW_PUBLIC_TRANSIT passed as a service data parameter.
+ *
+ * @param[in]  view            The view handle
+ * @param[in]  enable          The enable status
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval     #MAPS_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval     #MAPS_ERROR_CONNECTION_TIME_OUT Timeout error, no answer
+ * @retval     #MAPS_ERROR_NETWORK_UNREACHABLE Network unavailable
+ * @retval     #MAPS_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre @a view is created using maps_view_create().
+ *
+ * @see maps_view_create()
+ * @see maps_view_get_public_transit_enabled()
+ * @see maps_service_provider_is_data_supported()
+ */
+int maps_view_set_public_transit_enabled(maps_view_h view, bool enable);
+
+/**
+ * @brief      Queries whether the map has the public transit layer enabled.
+ * @details    This function checks whether the map is set to show the public transit routes layer.
+ * @since_tizen 3.0
+ *
+ * @param[in]  view    The view handle
+ * @param[out] enable  The pointer to a boolean in which to store the enable status
+ * @return     0 on success, otherwise a negative error value
+ * @retval     #MAPS_ERROR_NONE Successful
+ * @retval     #MAPS_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @pre @a view is created using maps_view_create().
+ *
+ * @see maps_view_create()
+ * @see maps_view_set_public_transit_enabled()
+ * @see maps_service_provider_is_data_supported()
+ */
+int maps_view_get_public_transit_enabled(const maps_view_h view, bool *enable);
+
+/**
  * @brief      Sets View language.
  * @details This function sets the language to the given View.
  * \n Note that map display language is different from places and route
index 41a36f7..998030f 100644 (file)
@@ -114,7 +114,6 @@ typedef enum _maps_view_gesture_e {
        MAPS_VIEW_GESTURE_TAP,                /**< Indicates the tap user gesture */
        MAPS_VIEW_GESTURE_DOUBLE_TAP,         /**< Indicates the double tap user gesture */
        MAPS_VIEW_GESTURE_2_FINGER_TAP,       /**< Indicates the two-finger tap user gesture */
-       MAPS_VIEW_GESTURE_SINGLE_FINGER_ZOOM, /**< Indicates the single finger zoom user gesture*/
        MAPS_VIEW_GESTURE_ROTATE,               /** Indicates the rotation user gesture */
        MAPS_VIEW_GESTURE_LONG_PRESS,         /**< Indicates the long press user gesture */
 } maps_view_gesture_e;
index f061977..1bb049c 100644 (file)
@@ -480,7 +480,6 @@ EXPORT_API int maps_view_create(maps_service_h maps, Evas_Image *obj, maps_view_
        v->gesture_actions[MAPS_VIEW_GESTURE_TAP] = MAPS_VIEW_ACTION_NONE;
        v->gesture_actions[MAPS_VIEW_GESTURE_DOUBLE_TAP] = MAPS_VIEW_ACTION_ZOOM_IN;
        v->gesture_actions[MAPS_VIEW_GESTURE_2_FINGER_TAP] = MAPS_VIEW_ACTION_ZOOM_OUT;
-       v->gesture_actions[MAPS_VIEW_GESTURE_SINGLE_FINGER_ZOOM] = MAPS_VIEW_ACTION_ZOOM;
        v->gesture_actions[MAPS_VIEW_GESTURE_ROTATE] = MAPS_VIEW_ACTION_ROTATE;
        v->gesture_actions[MAPS_VIEW_GESTURE_LONG_PRESS] = MAPS_VIEW_ACTION_NONE;
        v->gesture_actions[MAPS_VIEW_GESTURE_NONE] = MAPS_VIEW_ACTION_NONE;
@@ -491,7 +490,6 @@ EXPORT_API int maps_view_create(maps_service_h maps, Evas_Image *obj, maps_view_
        v->gesture_available[MAPS_VIEW_GESTURE_TAP] = true;
        v->gesture_available[MAPS_VIEW_GESTURE_DOUBLE_TAP] = true;
        v->gesture_available[MAPS_VIEW_GESTURE_2_FINGER_TAP] = true;
-       v->gesture_available[MAPS_VIEW_GESTURE_SINGLE_FINGER_ZOOM] = true;
        v->gesture_available[MAPS_VIEW_GESTURE_ROTATE] = true;
        v->gesture_available[MAPS_VIEW_GESTURE_LONG_PRESS] = true;
        v->gesture_available[MAPS_VIEW_GESTURE_NONE] = false;
index f090ad9..b4e5fea 100644 (file)
@@ -367,33 +367,8 @@ void view::gesture_detector_statemachine::state_machine_on_event(view_event_e
                        detected_second_long_press();   /* Second Long Press */
                        break;
                case FINGER_MOVE: {
-
-                       /* First click position */
-                       const touch_point p1 = _info_history._finger_down[0];
-
-                       /* Second click position */
-                       const touch_point p2 = _info._finger_down[0];
-
-                       MAPS_LOGI("Checking double tap: [%d, %d] -> [%d, %d]",
-                                 p1._x, p1._y, p2._x, p2._y);
-
-                       /*
-                        * Check if tapped in the same point
-                        * Note: accuracy is decreased for the sake of user's
-                        * convenience
-                        */
-
-                       if(get_trajectory_effective_length(p1, p2)
-                          <= (4 * __CLICK_AREA)) {
-                               maps_view_screen_to_geolocation(_view, p1._x, p1._y, &_info._start_view_state._center);
-                               _current_state = STATE_MOVING_AFTER_SECOND_PRESS;
-                               detected_single_finger_zoom();  /* Single Finger Zoom */
-                       } else {
-                               /* Seems like it is a simple click */
-                               _current_state = STATE_MOVING;
-
-                               detected_pan(); /* Tap */
-                       }
+                       _current_state = STATE_MOVING;
+                       detected_pan(); /* Tap */
                        break;
                }
                case FINGER2_DOWN:
@@ -419,33 +394,8 @@ void view::gesture_detector_statemachine::state_machine_on_event(view_event_e
                        _current_state = STATE_NONE;
                        break;
                case FINGER_MOVE: {
-
-                       /* First click position */
-                       const touch_point p1 = _info_history._finger_down[0];
-
-                       /* Second click position */
-                       const touch_point p2 = _info._finger_down[0];
-
-                       MAPS_LOGI("Checking double tap: [%d, %d] -> [%d, %d]",
-                                 p1._x, p1._y, p2._x, p2._y);
-
-                       /*
-                        * Check if tapped in the same point
-                        * Note: accuracy is decreased for the sake of user's
-                        * convenience
-                        */
-
-                       if(get_trajectory_effective_length(p1, p2)
-                          <= (4 * __CLICK_AREA)) {
-                               maps_view_screen_to_geolocation(_view, p1._x, p1._y, &_info._start_view_state._center);
-                               _current_state = STATE_MOVING_AFTER_SECOND_PRESS;
-                               detected_single_finger_zoom();  /* Single Finger Zoom */
-                       } else {
-                               /* Seems like it is a simple click */
-                               _current_state = STATE_MOVING;
-
-                               detected_pan(); /* Tap */
-                       }
+                       _current_state = STATE_MOVING;
+                       detected_pan();
                        break;
                }
                case FINGER_DOWN:
@@ -642,7 +592,6 @@ void view::gesture_detector_statemachine::state_machine_on_event(view_event_e
                        break;
                case FINGER_MOVE:
                        _current_state = STATE_MOVING_AFTER_SECOND_PRESS;
-                       detected_single_finger_zoom();  /* Single Finger Zoom */
                        break;
                default:
                        log_state(event, _current_state);
@@ -707,15 +656,6 @@ void view::gesture_detector_statemachine::detected_second_long_press()     /* Second
        _gp.on_long_press();
 }
 
-void view::gesture_detector_statemachine::detected_single_finger_zoom()        /* Single Finger Zoom */
-{
-       if (!is_gesture_available(MAPS_VIEW_GESTURE_SINGLE_FINGER_ZOOM))
-               return;
-
-       log("GESTURE SINGLE FINGER ZOOM DETECTED", FG_GREEN);
-       _gp.on_single_finger_zoom();
-}
-
 void view::gesture_detector_statemachine::detected_pan()               /* Pan */
 {
        if (!is_gesture_available(MAPS_VIEW_GESTURE_SCROLL))
index 9597948..c4268f4 100644 (file)
@@ -358,10 +358,6 @@ void view::gesture_processor::on_two_finger_tap()
        }
 }
 
-void view::gesture_processor::on_flick()
-{
-}
-
 void view::gesture_processor::on_panning_finished(int finger_no)
 {
        /* Obtain fresh central coordinates of the map in the Plugin */
@@ -426,81 +422,6 @@ view::touch_point view::gesture_processor::calc_center(
                           timestamp);
 }
 
-void view::gesture_processor::on_single_finger_zoom()
-{
-       gesture_detector::log("view::gesture_processor::on_single_finger_zoom",
-                             gesture_detector::FG_YELLOW);
-
-       /* Assumed that we do the zoom using single finger */
-
-       /* First finger effective way by now */
-       const touch_point start_tp_f1 = _gd->_info._finger_down[0];
-       const touch_point cur_tp_f1 = _gd->_info._finger_move[0];
-
-
-       /***********************/
-       MAPS_LOGI("%c[%d;%d;%dm"
-                 "Finger1: start(%d, %d), cur(%d, %d)\t"
-                 "%c[%d;%d;%dm",
-                 0x1B, 1, 0, gesture_detector::FG_YELLOW,
-                 start_tp_f1._x, start_tp_f1._y, cur_tp_f1._x, cur_tp_f1._y,
-                 0x1B, 0, 0, 0);
-       /***********************/
-
-
-       /* Calculating the current zoom factor, accordingly to vertical way
-        *  of finger */
-       const int vertical_way = cur_tp_f1._y - start_tp_f1._y;
-       if(vertical_way == 0)
-               return; /* No zoom happend */
-
-       int map_height = 0;
-       maps_view_get_screen_location(_gd->_view, NULL, NULL, NULL, &map_height);
-       const int half_height = map_height / 2;
-
-       const double delta_zoom = 1. * vertical_way / half_height;
-       double new_zoom_factor =
-               _gd->_info._start_view_state._zoom_factor + delta_zoom;
-
-
-       /* Correct the zoom factor accordingly to allowed limits */
-       /* TODO: it also may be cashed in the _info._start_view_state */
-       int min_zoom_level = 0;
-       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)
-               new_zoom_factor = min_zoom_level;
-       if(new_zoom_factor > max_zoom_level)
-               new_zoom_factor = max_zoom_level;
-
-       /* Invoke user registered event callback for ZOOM */
-       do {
-               maps_view_event_data_h ed =
-                       _maps_view_create_event_data(MAPS_VIEW_EVENT_GESTURE);
-               if(!ed)
-                       break;
-               _maps_view_event_data_set_gesture_type(ed, MAPS_VIEW_GESTURE_SINGLE_FINGER_ZOOM);
-               _maps_view_event_data_set_zoom_factor(ed, new_zoom_factor);
-               _maps_view_event_data_set_fingers(ed, 2);
-
-               /* Find the current center of the gesture */
-               const touch_point cur_center = cur_tp_f1;
-                       /*_gd->_info._start_view_state._center;*/
-               _maps_view_event_data_set_position(ed, cur_center._x, cur_center._y);
-               _maps_view_invoke_event_callback(_gd->_view, ed);
-               maps_view_event_data_destroy(ed);
-       } while(false);
-
-       /* Enqueue the detected zomm command */
-       q()->push(construct_gesture_command(MAPS_VIEW_GESTURE_SINGLE_FINGER_ZOOM,
-                                           _gd->_info._start_view_state._center,
-                                           true,
-                                           new_zoom_factor,
-                                           false,
-                                           .0));
-}
-
 void view::gesture_processor::on_zoom_rotate()
 {
        gesture_detector::log("view::gesture_processor::on_zoom_rotate",
@@ -663,11 +584,6 @@ void view::gesture_processor::on_zoom_rotate()
        maps_coordinates_destroy(new_center);
 }
 
-void view::gesture_processor::on_pinch()
-{
-}
-
-
 
 /* ---------------------------------------------------------------------------*/
 /*    VIEW EVENT STREAM                                                       */
index 6b93458..c306d9e 100644 (file)
@@ -99,12 +99,9 @@ namespace view
                void on_double_tap();
                void on_tap();
                void on_two_finger_tap();
-               void on_flick();
                void on_pan(int finger_no);
                void on_panning_finished(int finger_no);
                void on_zoom_rotate();
-               void on_single_finger_zoom();
-               void on_pinch();
        private:
                session::command_queue *q();
                void *get_maps();